akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
using namespace std;

int main(){
    long N, A, B;
    cin >> N >> A >> B;
    long X[N];
    long ans;
    for(long i=0; i<N; i++){
        cin >> X[i];
    }

    ans=0;
    for(long i=0; i<N-1; i++){
        if( (X[i+1]-X[i])*A > B  ){
            ans+=B;
        }else{
            ans+=(X[i+1]-X[i])*A;
        }
    }    

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1024
/* Ajay Jadhav */
#include <bits/stdc++.h>
 
#define ll          long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define hell        1000000007
#define rep(i,a,b)  for(int i=a;i<b;i++)
using namespace std;

void solve()
{
 	int a,b;
    cin>>a>>b;
    cout<<a*b;
}
 
signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t=1;
    // cin>>t;
    while(t--)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 3652
#include<iostream>

int main(){
    std::string S;
    std::cin >> S;

    int i = 0;
    int lens = 0;
    int ans = 0;
    
    while(S[i] != '\0'){
        if (S[i] == 'A' || S[i] == 'C' || S[i] == 'G' || S[i] == 'T')lens++;

        else if(lens > ans){
            ans= lens;
            lens = 0;
        }
        else {
            lens = 0;
        }

        i++;
    }
    if(lens > ans){
        ans = lens;
    }

    std::cout << ans << std::endl;
    return 0;
}

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

namespace program
{
    class Program
    {
        static void Main()
        {
            int[] a = Input.ScanIntArray();
          int x = (a[0]+11)%13;
          int y = (a[1]+11)%13;
          if(x==y) Console.WriteLine("Draw");
          if(x>y) Console.WriteLine("Alice");
          if(x<y) Console.WriteLine("Bob");
        }
    }

    static class Input
    {
        static public int ScanInt() { return int.Parse(Console.ReadLine()); }
        static public uint ScanUint() { return uint.Parse(Console.ReadLine()); }
        static public long ScanLong() { return long.Parse(Console.ReadLine()); }
        static public ulong ScanUlong() { return ulong.Parse(Console.ReadLine()); }
        static public int[] ScanIntArray() { return Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray(); }
        static public uint[] ScanUintArray() { return Console.ReadLine().Split(' ').Select(x => uint.Parse(x)).ToArray(); }
        static public long[] ScanLongArray() { return Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray(); }
        static public ulong[] ScanUlongArray() { return Console.ReadLine().Split(' ').Select(x => ulong.Parse(x)).ToArray(); }

        static public string ScanStr() { return Console.ReadLine(); }
        static public string[] ScanStrArray() { return ScanStr().Split(' '); }
    }

    static class MyMath
    {
        public static int GCD(int a, int b)
        {
            Func<int, int, int> gcd = null;
            gcd = (x, y) => y == 0 ? x : gcd(y, x % y);
            return a > b ? gcd(a, b) : gcd(b, a);
        }
        public static ulong GCD(ulong a, ulong b)
        {
            Func<ulong, ulong, ulong> gcd = null;
            gcd = (x, y) => y == 0 ? x : gcd(y, x % y);
            return a > b ? gcd(a, b) : gcd(b, a);
        }
        public static int LCM(int a, int b)
        {
            return a * b / GCD(a, b);
        }
        public static ulong LCM(ulong a, ulong b)
        {
            return a * b / GCD(a, b);
        }
    }
}


Measured memory_bytes: 11348
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0;i<n;i++)
#define erep(i,n) for(int i = 0;i<=n;i++)
#define rep1(i,n) for(int i = 1;i<n;i++)
#define erep1(i,n) for(int i = 1;i<=n;i++)
typedef long long ll;
#define vint vector<int>
#define vstring vector<string>
#define vll vector<ll>
#define vbool vector<bool>
#define INF 1000000000


ll gcm(ll a,ll b);
ll lcm(ll a,ll b);
ll fac(ll a);

int main(){
  ll h,w;
  cin >> h >> w;
  vll square(3);
  ll ans = INF;
  rep1(i,h){
    square[0] = i*w;
    if(w%2 == 0){
      square[1] = w/2*(h-i);
      square[2] = w/2*(h-i);
    }
    else{
      square[1] = (w+1)/2*(h-i);
      square[2] = w/2*(h-i);
    }
    sort(square.begin(),square.end());
    if(square[0] != 0)
    	ans = min(ans,square[2] - square[0]);
  }
  rep1(i,h){
    square[0] = i*w;
    if((h-i)%2 == 0){
      square[1] = (h-i)/2*w;
      square[2] = (h-i)/2*w;
    }
    else{
      square[1] = (h-i+1)/2*w;
      square[2] = (h-i)/2*w;
    }
    sort(square.begin(),square.end());
    if(square[0] != 0)
    	ans = min(ans,square[2] - square[0]);
  }
  rep1(i,w){
    square[0] = i*h;
    if(h%2 == 0){
      square[1] = h/2*(w-i);
      square[2] = h/2*(w-i);
    }
    else{
      square[1] = (h+1)/2*(w-i);
      square[2] = h/2*(w-i);
    }
    sort(square.begin(),square.end());
    if(square[0] != 0)
    	ans = min(ans,square[2] - square[0]);
  }
  rep1(i,w){
    square[0] = i*h;
    if((w-i)%2 == 0){
      square[1] = (w-i)/2*h;
      square[2] = (w-i)/2*h;
    }
    else{
      square[1] = (w-i+1)/2*h;
      square[2] = (w-i)/2*h;
    }
    sort(square.begin(),square.end());
    if(square[0] != 0)
    	ans = min(ans,square[2] - square[0]);
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        int a=sc.nextInt();
        int b=sc.nextInt();
        int area=a*b;
        int length=2*(a+b);
        System.out.println(area + " " + length);
        sc.close();
    }
}


Measured memory_bytes: 26304
#include <iostream>

constexpr int MAX_N=(int)1e5+1;

int n;

int t[MAX_N],x[MAX_N],y[MAX_N];

int main() {

    std::cin>>n;

    for(int i=1;i<=n;++i)
        std::cin>>t[i]>>x[i]>>y[i];

    for(int i=1;i<=n;++i){
        if((abs(x[i]-x[i-1])+abs(y[i]-y[i-1])>t[i]-t[i-1])
        ||((t[i]-t[i-1])%2!=(abs(x[i]-x[i-1])+abs(y[i]-y[i-1]))%2)){
            std::cout<<"No"<<std::endl;
            return 0;
        }
    }

    std::cout<<"Yes"<<std::endl;

    return 0;
}

Measured memory_bytes: 1408
x,y = map(int,input().split())
l = [0,300000,200000,100000]
alpha = 400000
ans = 0
if x == 1 and y == 1:
  ans = l[1]*2 + alpha
  print(ans)
else:
  if 1 <= x <= 3:
    ans += l[x]
  if 1 <= y <= 3:
    ans += l[y]  
  print(ans)

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





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

	vector<int>ans(4);
	ans[0]=a;
	ans[1]=a-1;
	ans[2]=b;
	ans[3]=b-1;
	
	sort(ans.begin(), ans.end()); // vector
	cout<<ans[2]+ans[3];
	}


Measured memory_bytes: 256
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <cfloat>
#include <complex>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

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

  string ans;
  for (ll i = 0; i <= 7; i++) {
    ans = "";
    ans += str[0];
    ll tmp = str[0] - '0';
    for (ll j = 0; j <= 2; j++) {
      ll lol = (i >> j) & 1LL;
      ll dig = str[j + 1] - '0';
      if (lol == 1) {
        tmp += dig;
        ans += '+';
      } else {
        tmp -= dig;
        ans += '-';
      }
      ans += str[j + 1];
    }
    if (tmp == 7) {
      break;
    }
  }

  cout << ans + "=7" << endl;

  return 0;
}


Measured memory_bytes: 256
s = input().strip()
smax = 0
c = 0
for i in s:
    if i == 'A' or i == 'T' or i == 'C' or i == 'G':
        c += 1
    else:
        if smax < c:
            smax = c
        c = 0
if smax < c:
    smax = c
print(smax)


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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var k = int.Parse(Console.ReadLine());
            var ab = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();
            for (int i = ab[0]; i <= ab[1]; i++)
            {
                if (i % k != 0) continue;
                Console.WriteLine("OK");
                return;
            }
            Console.WriteLine("NG");
        }
    }
}


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

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

  if(a == b && b != c){
    cout << "Yes" << endl;
    return 0;
  }
  else if(a == c && a != b){
    cout << "Yes" << endl;
    return 0;
  }
  else if(b == c && a != b){
    cout << "Yes" << endl;
    return 0;
  }
  else{
    cout << "No" << endl;
    return 0;
  }
}

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

using namespace std;
using ll = long long;
using ld = long double;

//#define int long long
//signed main(){
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >> n;
    cout << n/3 << "\n";

    return 0;
}

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

using namespace std;

using ll = long long;

#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 input(...) __VA_ARGS__; in(__VA_ARGS__)

template<class T>
void print(vector<T> a) {
  cout << "[ ";
  REP(i, a.size()) cout << a[i] << " ";
  cout << "]" << endl;
}

void print() {
  std::cout << std::endl;
}

template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
  std::cout << head << " ";
  print(std::forward<Tail>(tail)...);
}

void in() { }

template <class Head, class... Tail>
void in(Head&& head, Tail&&... tail) {
  cin >> head;
  in(std::forward<Tail>(tail)...);
}

int main() {
  ll input(n, m, k);
  vector<ll> a(n);
  vector<ll> b(m);
  REP(i, n) cin >> a[i];
  REP(i, m) cin >> b[i];

  vector<ll> ca(n + 1);
  partial_sum(a.begin(), a.end(), ca.begin() + 1);
  vector<ll> cb(m);
  partial_sum(b.begin(), b.end(), cb.begin());

  ll maxv = 0;
  REP(i, n + 1) {
    ll diff = k - ca[i];
    if (diff < 0) continue;
    ll bdiff = distance(cb.begin(), upper_bound(cb.begin(), cb.end(), diff) - 1);
    maxv = max(maxv, i + (bdiff + 1));
  }
  cout << maxv << endl;
}

Measured memory_bytes: 9612
flag2 = False
while True:
    a,b = map(int, input().split())
    flag = True
    if b == 0:
        break
    if flag2:
        print()
    for y in range(a, b + 1):
        if y%4 == 0:
            if y%100 == 0:
                if y%400 == 0:
                    print(y)
                    flag = False
                    continue
                continue
            print(y)
            flag = False
    if flag:
        print("NA")
    flag2 = True



Measured memory_bytes: 5720
import java.util.*;
import java.math.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] a = new int[N];
        for (int i = 0; i < N; i++) {
            a[i] = sc.nextInt();
        }

        long[][] dp = new long[N][N];


        long res = backtrack(dp, 0, N - 1, a);
        System.out.println(res);
    }

    public static long backtrack(long[][] dp, int start, int end, int[] a) {
        if (start == end) return 0;
        //if (start > end) return 0;

        if (dp[start][end] != 0) return dp[start][end];
        long sum = 0;
        for (int i = start; i <= end; i++) sum += a[i];

        long min = Long.MAX_VALUE;
        for (int i = start; i < end; i++) {
            min = Math.min(min, sum + backtrack(dp, start, i, a) + backtrack(dp, i + 1, end, a));
        }
        dp[start][end] = min;
        return dp[start][end];
    }
}


Measured memory_bytes: 26440
#include<iostream>
#include<cstdio>
#include<functional>
#include<cstring>
#include<string>
#include<vector>
#include<queue>
#include<cmath>
#include<algorithm>
#include<map>
#include<ctime>
using namespace std;
typedef long long ll;
typedef long double ld;
const int maxn = 7e4+7;
const int inf = 1e5;
const int modn = 1e9+7;
const ld eps = 1e-8;
const long double PI = acos(-1.0);
void qRead(ll &x){x = 0;char a;for(a = getchar();a <'0' || a > '9';a = getchar());for(;a >= '0' && a <= '9';a = getchar())x = x*10 + a-'0';}
void qRead(int &x){x = 0;char a;for(a = getchar();a <'0' || a > '9';a = getchar());for(;a >= '0' && a <= '9';a = getchar())x = x*10 + a-'0';}
ll qpow(ll a,ll b,ll mo = modn){
//    printf("%lld\n",mo);
    ll res = 1;
    while(b){
        if(b & 1)res = (res*a) % mo;
        a = (a*a) % mo;
        b >>= 1;
    }
    return res;
}
ld qpow(ld a,ll b){
    ld res = 1;
    while(b){
        if(b & 1)res *= a;
        a = a*a;
        b >>= 1;
    }
    return res;
}
ll gcd(ll a,ll b){
    if(!b)return a;
    return gcd(b,a%b);
}
//ll vis[maxn],prime[maxn],cnt,smallP[maxn];
//void getPrime(int n){
//    cnt = 0;
//    for(int i = 1;i <= n;i++)vis[i] = 0;
//    for(ll i = 2;i <= n;i++){
//        if(!vis[i]){
//            prime[++cnt] = i;
//            smallP[i] = i;
//        }
//        for(int j = 1;j <= cnt && i*prime[j] <= n;j++){
//            vis[prime[j]*i] = 1;
//            smallP[prime[j]*i] = prime[j];
//            if((i % prime[j]) == 0)break;
//        }
//    }
//}
//ll cnm[maxn][maxn];
//void getCnm(){
//    cnm[0][0] = 1;
//    for(int i = 1;i < maxn;i++){
//        for(int j = 0;j <= i;j++){
//            cnm[i][j] = cnm[i-1][j];
//            if(j)cnm[i][j] += cnm[i-1][j-1];
//            cnm[i][j] %= (modn-1);
//        }
//    }
//}
//ll f[maxn],invF[maxn];
//void getF(){
//    f[0] = invF[0] = 1;
//    for(int i = 1;i < maxn;i++)f[i] = f[i-1]*i % modn;
//    invF[maxn-1] = qpow(f[maxn-1],modn-2);
//    for(int i = maxn-2;i >= 1;i--)invF[i] = invF[i+1]*(i+1) % modn;
//}
int main(){
    int k;
    scanf("%d",&k);
    printf("%d\n",k/2*((k+1)/2));
}


Measured memory_bytes: 256
import math
r,g,b,n = map(int,input().split())
 
ans = 0
for i in range(math.ceil(n/r)+1):
  for j in range(math.ceil((n-r*i)/g)+1):
    if (n - r*i - g*j)%b == 0 and n - r*i - g*j >= 0:
      ans += 1
print(ans)


Measured memory_bytes: 40556
#include <bits/stdc++.h>
using namespace std;
#define int long long int
int n, m;
signed main()
{
    priority_queue<int> pq;
    cin >> n >> m;
    for (int i = 0, price; i < n; i++)
    {
        cin >> price;
        pq.push(price);
    }
    while (m--)
    {
        int exp = pq.top();
        pq.pop();
        pq.push(exp / 2);
    }
    int cost = 0;
    while (pq.size())
    {
        // cout << pq.top() << " ";
        cost += pq.top();
        pq.pop();
    }
    // cout << endl;
    cout << cost << endl;
    return 0;
}

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

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { cout << #a << " = " << a << endl; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }
template<class T> void operator>> (istream& ist, vector<T>& vs) { for(auto& e: vs) cin >> e; }

typedef long long ll;
int const inf = 1<<29;

int main() {
  int N; cin >> N;
  vector<int> A(N);
  rep(i, N) cin >> A[i];  
  A.erase(unique(A.begin(), A.end()), A.end());
  int ans = 1;
  REP(i, 2, A.size()) {
    if (A[i - 2] <= A[i - 1] && A[i - 1] <= A[i]) {}
    else if (A[i - 2] >= A[i - 1] && A[i - 1] >= A[i]) {}
    else {
      ans++;
      i++;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 640
#include<algorithm>
#include <iostream>
#include <math.h>
#include <cstdio>
#include <string.h>
using namespace std;
int main(void){
	int a,b,c,sum=0,i;
	cin>>a>>b>>c;
	while(sum<=a*b){
		sum+=a;
		if(sum%b==c){
			cout<<"YES\n";
			return 0;
		}
	}
	cout<<"NO\n";
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#define _CRT_DISABLE_PERFCRIT_LOCKS
#include <bits/stdc++.h>

using namespace std;
#define BOOST ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define pb push_back
#define fileIn freopen("1.txt", "r", stdin)
#define fileOut freopen("output.txt", "w", stdout)
#define dbg(n) cout << n <<"\n"
#define dbg2(n) cout << n <<" "
#define all(a) a.begin(), a.end()
#define cinArr(arr) for(auto &v : arr) cin>>v
#define coutArr(arr) for(auto &v : arr) cout<<v<<" "
#define FOR(i, a, b) for(int i = a; i < b; i++)
typedef int64_t ll;
typedef uint64_t ull;
typedef vector<int> vi;
typedef vector<vi > vii;


int main()
{
    BOOST;
    int n;
    cin>>n;
    vi a(n);
    cinArr(a);
    ll ans = 0;
    bool flag; int cnt = 0;
    FOR(i, 0, n){
        cnt += a[i] < 0;
        a[i] = abs(a[i]);
        ans += a[i];
    }
    if(!(flag || !(cnt % 2))) ans -= 2 * (*min_element(all(a)));
    cout<<ans;
    return 0;
}





















Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 5LL << 60;
const ll mod = 1e9 + 7;

const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for(int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if(n < k) return 0;
	if(n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
	COMinit();
	ll n, k;
	cin >> n >> k;
	ll ans = 0;
	for(int i = 0; i <= min(n - 1, k); i++) {
		ans += (COM(n, i) * COM(n - 1, n - 1 - i)) % MOD;
		ans %= MOD;
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 15556
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <map>
#include <string>
#define int long long
#define REP(i,n) for(int i=0; i<n; i++)
#define pb push_back
#define mp make_pair
#define Pii pair< int, int > 
#define Pid pair< int, double > 
#define Pdd pair< double, double > 
#define MOD 1000000007
#define EPS 0.00000001
#define N_MAX 100000

using namespace std;

int gcd(int x, int y) {
    if (x>y) swap(x,y);
    while (true) {
        y = y % x;
        if (y == 0) return x;
        swap(x,y);
    }
}

signed main() {
    int k;
    cin >> k;
    int ans = 0;
    REP(i,k) REP(j,k) REP(l,k) ans += gcd(gcd(i+1,j+1),l+1);
    cout << ans << "\n";
}

Measured memory_bytes: 3636
// Vicfred
// https://atcoder.jp/contests/abc139/tasks/abc139_c
// implementation
import std.algorithm;
import std.array;
import std.conv;
import std.stdio;

void main() {
    long n;
    readf("%d", &n);
    readln;

    long[] h = 0~readln.split.map!(to!long).array;
    long[] ans = new long[n+1];

    foreach(i; 1..n)
        ans[n-i] = h[n-i] >= h[n-i+1] ? ans[n-i+1] + 1 : 0;
    const long maxima = maxElement(ans);

    maxima.writeln;
}



Measured memory_bytes: 7732
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
template<typename T> void chkmax(T &a, const T &b) { a = a > b ? a : b; }
template<typename T> void chkmin(T &a, const T &b) { a = a < b ? a : b; }

const int MAXN = 500005, MOD = 998244353;
LL fac[MAXN], inv[MAXN];
int n, K;
LL modpow(LL a, int b) {
	LL res = 1;
	for (; b; b >>= 1) {
		if (b & 1) res = res * a % MOD;
		a = a * a % MOD;
	}
	return res;
}

void init() {
	int n = 5e5;
	for (int i = fac[0] = 1; i <= n; i++)
		fac[i] = fac[i - 1] * i % MOD;
	inv[n] = modpow(fac[n], MOD - 2);
	for (int i = n; i > 0; i--)
		inv[i - 1] = inv[i] * i % MOD;
}

LL C(int a, int b) {
	return a < b ? 0 : fac[a] * inv[b] % MOD * inv[a - b] % MOD;
}

LL calc(int R, int B) {
	if (R < n) return 0;
	assert(R > B);
	return C(R + B, R) - C(R + B, R + R - n + 1) + MOD;
}

int main() {
	scanf("%d%d", &n, &K);
	if (n > K) return puts("0"), 0;
	init();
	LL ans = 0;
	for (int R = (K + 1) / 2; R <= K; R++) {
		int B = K - R;
		if (R == B) ans += calc(R, B - 1);
		else ans += calc(R, B);
	}
	printf("%lld\n", ans % MOD);
	return 0;
}

Measured memory_bytes: 8064
H, W = map(int, raw_input().split())

def solve(H, W):
    S = 100000000
    for h in range(H):
        A = h * W
        B = (H - h) / 2 * W
        C = H*W - A - B
        S = min(S, max(A, B, C) - min(A, B, C))

        B = (H - h) * (W / 2)
        C = H*W - A - B
        S = min(S, max(A, B, C) - min(A, B, C))

    return S

print min(solve(H, W), solve(W, H))


Measured memory_bytes: 5764
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(s,t) for (int s = 0; s < t; ++s);
using ll = long long;


int main() {
  long long a;
  long double b;

  cin >> a >> b;

  long long ans;

  ans = a*b;

  cout << ans << endl;

}

Measured memory_bytes: 3716
#include <iostream>
    #include <vector>
    #include <string>
    #include <algorithm>
    #include <iostream>
    #include <vector>
    #include <numeric>
    #include <string>
    #include <functional>
    #include <functional>   // std::minus
    #include <numeric>      // std::accumulate
     
    using namespace std;
	typedef long long ll;
    int main(){
      	string str;
      	cin>>str;
      
      	ll size = str.size();
      	vector<ll> vec0(size+1, 0), vec1(size+1, 0);
      	for (ll i=0; i<size; i++){
         	if (str[i] == '<'){
             	vec0[i+1] = vec0[i] + 1;
            }     
        }
      
      	for (ll i=size-1; i>=0; i--){
         	if (str[i] == '>'){
             	vec1[i] = vec1[i+1] + 1; 
            }      
        }
      
      	ll sum = 0;
      	for (ll i=0; i<vec0.size(); i ++){
         	 sum += max(vec0[i], vec1[i]);
        }	
              
      	std::cout<<sum;
      
     	return 0; 
    }

Measured memory_bytes: 8708
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <climits>
#include <cmath>
#include <complex>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <cstdint>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
#define MP make_pair
#define PB push_back
#define inf 1000000007
#define mod 1000000007
#define rep(i,n) for(int i = 0; i < (int)(n); ++i)
#define all(x) (x).begin(),(x).end()

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}
 
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;
}
template<typename T> class segtree{
private:
    int n,sz;
    vector<T> node;
public:
    segtree(const vector<T>& v) : n(1), sz((int)v.size()){
        while(n < sz) n *= 2;
        node.resize(2*n-1, numeric_limits<T>::max());
        for(int i = 0; i < sz; i++){
            node[i+n-1] = v[i];
        }
        for(int i=n-2; i>=0; i--){
            node[i] = min(node[i*2+1], node[i*2+2]);
        }
    }
    void update(int k,T a){
        k += n-1;
        node[k] = a;
        while(k>0){
            k = (k-1)/2;
            node[k] = min(node[2*k+1],node[2*k+2]);
        }
    }
    T query(int a,int b,int k=0,int l=0,int r=-1){
        if(r < 0) r = n;
        if(r <= a || b <= l){
            return numeric_limits<T>::max();
        }
        if(a <= l && r <= b){
            return node[k];
        }else{
            T vl = query(a,b,2*k+1,l,(l+r)/2);
            T vr = query(a,b,2*k+2,(l+r)/2,r);
            return min(vl,vr);
        }
    }
    void print(){
        for(int i = 0; i < sz; i++){
            cout<<query(i,i+1)<< " ";
        }
        cout<<endl;
    }
};


int main(){
    int n;
    cin >> n;
    vector<pair<ll,ll> > a;

    rep(i,n){
        ll b,c;
        cin >> b >> c;
        a.push_back(MP(b,c));
    }   
    sort(a.begin(),a.end());
    vector<ll> l(n),r(n);
    for(int i=0;i<n;i++){
        l[i] = -a[i].first;
        r[i] = a[i].second;
    }
    segtree<ll> sgl(l),sgr(r);
    ll mx  = 0;
    for(int i=1;i<n;i++){
        ll A = max(0LL,sgr.query(0,i) + sgl.query(0,i)+1);
        ll B = max(0LL,sgr.query(i,n) + sgl.query(i,n)+1);
        chmax(mx,A+B);
        A = max(0LL,min(sgr.query(0,i),sgr.query(i+1,n)) + min(sgl.query(0,i),sgl.query(i+1,n))+1);
        B = max(0LL,sgr.query(i,i+1)+sgl.query(i,i+1)+1);
        chmax(mx,A+B);
    }
    cout << mx << endl;
    return 0;
}

Measured memory_bytes: 9072
tmp = input().split(" ")
person = int(tmp[0])
init_pt = int(tmp[1])
questions = int(tmp[2])
points = [0] * (person + 1)
  
for i in range(questions):
  points[int(input())] += 1
  
for i in range(1, person + 1):
  if points[i] > questions - init_pt:
    print("Yes")
  else:
    print("No")

Measured memory_bytes: 50520
import java.util.*;
class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int max = sc.nextInt();
		int sum = sc.nextInt();
		int result = 0;
		for (int i=0; i<=max; i++) {
			for (int j=0; j<=max; j++) {
				int tmp = sum - i - j;
				if(0 <= tmp && tmp <= max) result++;
			}
			
		}
		System.out.println(Integer.toString(result));
	}

}

Measured memory_bytes: 21716
#include<bits/stdc++.h>
using namespace std;
int main(void)
{
	int n;
	cin>>n;
	char s[n];
	int ans=0;
	for(int i=0;i<n;i++)
	{
		cin>>s[i];
	}
	for(int i=2;i<n;i++)
	{
		if(s[i-2]=='A' && s[i-1]=='B' && s[i]=='C')
		ans++;
	}
	cout<<ans<<endl;
}

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


int main(){
    int n;
    ll k;
    cin >> n >> k;
    vector<int> a(n);
    vector<int> f(n);
    rep(i,n) cin >> a[i];
    rep(i,n) cin >> f[i];
    sort(a.begin(), a.end());
    sort(f.rbegin(), f.rend());
    ll l = -1, r = 1e12;
    while(l+1 < r){
        ll c = (l+r)/2;
        bool ok = [&]{
            ll s = 0;
            rep(i,n){
                s += max(0ll, a[i]-c/f[i]);
            }
            return s <= k;
        }();
        if(ok) r = c;
        else l = c;
    }
    cout << r << endl;
}


Measured memory_bytes: 1792
S=gets.chomp
T=gets.chomp
s_to_t = {}
t_to_s = {}
(0..(S.length-1)).each do |i|
    s = S[i]
    t = T[i]
    if s_to_t[s] == nil && t_to_s[t] == nil
        s_to_t[s] = t
        t_to_s[t] = s
    elsif s_to_t[s] != t || t_to_s[t] != s
        puts 'No'
        exit
    end
end
puts 'Yes'


Measured memory_bytes: 2624
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
# from fractions import gcd
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from functools import reduce
from bisect import bisect_left, insort_left
from heapq import heapify, heappush, heappop

INPUT = lambda: sys.stdin.readline().rstrip()
INT = lambda: int(INPUT())
MAP = lambda: map(int, INPUT().split())
S_MAP = lambda: map(str, INPUT().split())
LIST = lambda: list(map(int, INPUT().split()))
S_LIST = lambda: list(map(str, INPUT().split()))

sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7


def main():
    S = INPUT()
    print("No" if S == "A"*len(S) or S == "B"*len(S) else "Yes")


if __name__ == '__main__':
    main()


Measured memory_bytes: 4084
#include <cstdio>
#include <algorithm>

int main()
{
  long long n, a, b;
  scanf("%lld%lld%lld", &n, &a, &b);
  long long ans1 = (b - a) & 1 ? 4000000000000000000 : (b - a) / 2;
  long long ans2 = (a - 1) + 1 + (b - a) / 2;
  long long ans3 = (n - b) + 1 + (b - a) / 2;
  printf("%lld\n", std::min(std::min(ans1, ans2), ans3));
  return 0;
}


Measured memory_bytes: 128
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define pb push_back
#define mp make_pair
 
// random generator
// mt19937 rndm(time(0));
 
// ll gcd(ll a, ll b)
// {
//     while (b>0)
//     {
//         ll tmp = a;
//         a = b;
//         b = tmp%b;
//     }
//     return a;
// }
 
 
// long long gcd(long long a, long long b) {
//  return a? gcd(b % a, a) : b;
// }
 
 
const int M=1e9+7;
ll powmod(ll a,ll b, ll mod) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res%mod;}/* a^b%mod */
const int N=2e5+10;



int main() {	
   
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
	
	int n, k;
	cin>>n>>k;
	int kk=(n+1)/2;
	if(kk>=k)cout<<"YES\n";
	else cout<<"NO\n";
	return 0;
}




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

int main(){
    int N,K;
    cin >> N >> K;
    string s;
    cin >> s;
	if(s[K-1]=='A'){
        s[K-1] ='a';}
    else{
        if(s[K-1]=='B'){
            s[K-1]='b';}
        else{
            s[K-1]='c';}
    }
    cout << s;
    return 0;
}

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

#define M_PI       3.14159265358979323846

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }
inline int readInt() { int x; scanf("%d", &x); return x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;


//container util

//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SQ(a) ((a)*(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,s,n) for(int i=s;i<(int)n;++i)
#define REP(i,n) FOR(i,0,n)
#define MOD 1000000007

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

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

#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)


struct Edge {
    int to, from;
    ll cost;
    Edge(int from, int to, ll cost): from(from), to(to), cost(cost) {}
};

typedef vector<vector<Edge>> AdjList;
AdjList graph;

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

    ll N; cin >> N;
    
    ll B[11000]; 
    REP(i, N-1) {
        cin >> B[i];
    }
    ll ans = B[0] + B[N-2];

    for(int i=0; i<N-2; ++i){
        ans += min(B[i], B[i+1]);
    }
    cout << ans << endl;
    return 0;

}

Measured memory_bytes: 256
# coding: utf-8
# Your code here!
l,r=map(int,input().split())
flg=0
m=2020
for i in range(10**6):
    if l<=2019*i<=r:
        flg=1
        m=0

for i in range(l,r): 
    if flg==1:
        break
    for j in range(i+1,r+1):
        if ((i%2019)*(j%2019))%2019<m and i!=j:
            m=(i*j)%2019

print(m)


Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <array>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <list>
#include <numeric>
#include <stack>
#include <iomanip>
#include <random>
#include <complex>
#include <functional>
#include <tuple>

using namespace std;

#define Rep(i,a,b) for(int i = a; i < b; ++i)
#define rep(i,b) Rep(i,0,b)
#define allof(a) (a).begin(), (a).end()

#define Yes(q) ((q) ? "Yes" : "No")
#define YES(q) ((q) ? "YES" : "NO")
#define Possible(q) ((q) ? "Possible" : "Impossible")
#define POSSIBLE(q) ((q) ? "POSSIBLE" : "IMPOSSIBLE")

using ll = long long;

using pint = std::pair<int, int>;
using pll = std::pair<ll, ll>;


constexpr int inf = 1e9 + 7;
constexpr ll infll = 1ll << 62ll;
constexpr ll mod = 1e9 + 7;
// 0~3までは右左下上 4~7までは斜め
constexpr int dx[] = { 1, 0, -1, 0, 1, 1, -1, -1 };
constexpr int dy[] = { 0, -1, 0, 1, 1, -1, -1, 1 };

namespace {
    template<typename T> void chmax(T& a, T b) { a = std::max(a, b); }
    template<typename T> void chmin(T& a, T b) { a = std::min(a, b); }
    template<typename T> void chadd(T& a, T b) { a = a + b; }

    void Cout(long long x, const char* end = "\n") { std::cout << x << end; }
    template <typename T> void Cout(const T& x, const char* end = "\n") { std::cout << x << end; }
    template <typename T> void Cout(const std::vector<T>& x, const char* sep = " ", const char* end = "\n") { for (std::size_t i = 0, sz = x.size(); i < sz; i++) { std::cout << x[i] << (i == sz - 1 ? end : sep); } }

    void CCout(long long x, const char* end = "\n") { std::cerr << x << end; }
    template <typename T> void CCout(const T& x, const char* end = "\n") { std::cerr << x << end; }
    template <typename T> void CCout(const std::vector<T>& x, const char* sep = " ", const char* end = "\n") { for (std::size_t i = 0, sz = x.size(); i < sz; i++) { std::cerr << x[i] << (i == sz - 1 ? end : sep); } }

    // 標準入出力
    struct inp {
        std::size_t sz;
        inp(std::size_t _sz = 1) : sz(_sz) {}
        template <typename T> operator T () const { T a; std::cin >> a; return a; }
        template <typename T> operator std::vector<T>() const { vector<T> a(sz); for (std::size_t i = 0; i < sz; i++) std::cin >> a[i]; return a; }
        template <typename T, typename U> operator std::pair<T, U>() const { T f; U s; std::cin >> f >> s; return std::pair<T, U>(f, s); }
    };

    inp inp1; // input one
}

int main() {

    int n = inp1;

    Cout((n + 1) / 2);

    return 0;
}

Measured memory_bytes: 256
n, c, k = map(int, input().split())
t = [int(input()) for _ in range(n)]
t.sort()

t_crr = t[0]
cnt = 0
ans = 1

for i in t:
    # print(cnt, ans, t_crr, i)
    if i - t_crr <= k and cnt < c:
        cnt += 1
        continue
    else:
        t_crr = i
        ans += 1
        cnt = 1

print(ans)

Measured memory_bytes: 7384
#include <bits/stdc++.h>
using namespace std;
  
int main(){
  int d, g;
  cin >> d >> g;
  int p[d], c[d];
  for(int i = 0; i < d; i++) cin >> p[i] >> c[i];
  int res = 1e9;
  for(int bit = 0; bit < 1 << d; bit++){
    int sum = 0, num = 0;
    for(int i = 0; i < d; i++){
      if(bit >> i & 1) sum += c[i] + p[i] * 100 * (i + 1), num += p[i];
    }
    if(sum >= g) res = min(res, num);
    else{
      for(int i = d - 1; i >= 0; i--){
        if(bit >> i & 1) continue;
        for(int j = 0; j < p[i]; j++){
          if(sum >= g) break;
          sum += 100 * (i + 1);
          num++;
        }
      }
      res = min(res, num);
    }
  }
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 256
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <chrono>
#include <stack>
#include <string>
#include <bitset>
#include <unordered_map>
#include <unordered_set>
#include <cstdio>
#include <limits>
#include <vector>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <fstream>
#include <numeric>
#include <sstream>
#include <cassert>
#include <tuple>
#include <iomanip>
#include <random>
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <fstream>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<bool> vb;

#define pb push_back
#define fi first
#define se second
#define in insert
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

const int mod = 1e9 + 7;
const int inf = 1e9;

template <class T>
istream& operator>>(istream& ss, vector<T>& v) {
    for (int i = 0; i < v.size(); i++) ss >> v[i];
    return ss;
}

template <class T>
ostream& operator<<(ostream& ss, const vector<T>& v) {
    for (int i = 0; i < v.size(); i++) ss << v[i] << ' ';
    return ss;
}

void solve() {
    int s, w;
    cin >> s >> w;
    if (s > w) cout << "safe";
    else cout << "unsafe";
}

int main() {
    int t = 1;
    //cin >> t;
    for(int i = 1; i <= t; i++){
        solve();
    }
}


Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
#define  ft  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define  ll  long long
#define  pi  pair<int,int>
#define  pb  push_back
#define  F   first
#define  S   second
const ll N=2e5+3;
//string s,p;
//vector<int>v;
//map<int,int>mp;
ll M=1e9+7;
int main()
{
    ft
    ll t,i,j,n,m,l,r,s=0;
    cin>>n>>m;
    for(i=m;i<=n+1;i++)
    {
        l=(n*(n+1))/2ll;
        l-=((n-i)*(n-i+1))/2ll;
        r=(i*(i-1))/2ll;
        s+=(l-r+1);
        s%=M;
    }
    cout<<s<<"\n";
    return 0;
}



Measured memory_bytes: 3652
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int a = scan.nextInt();
		n = n % 500;
		String message = "No";
		if(n <= a) {
			message = "Yes";
		}
		System.out.println(message);
	}
}

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

int main (){
  string s;
  bool flag = false;
  cin >> s;
  int count=0;
  int ans = 0;
  for (int i=0;i<s.size();i++){
  	if (!flag && s[i]=='A'){
    	count=0;
      	flag = true;
    }
    if (flag && s[i]=='Z'){
      	count ++;
    	ans = count;
    }
    else{
    	count ++;
    }
    
  }
  cout << ans;
}

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

#define fori( tt,aa)      for(int i= tt; i<aa; i++)
#define forj( yy,bb)      for(int j=yy; j<bb; j++)
#define fork( uu,cc)      for(int k=uu; k<cc; k++)
#define all(v)   v.begin(), v.end()
#define endl "\n";
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define EPS 1e-7
#define F first
#define S second
#define JULEE_DO_THE_THING fast()
#define to_str to_string
#define isOdd(n)    (n&1)
#define sc scanf
#define print printf
#define LLMAX LLONG_MAX
#define LLMIN LLONG_MIN
#define IMIN INT_MIN
#define IMAX INT_MAX

typedef long long ll;
typedef long double ld;
typedef double dd;
typedef string String;
typedef string str;
typedef vector<int> vecint;
typedef vector<ll> vecll;
typedef pair<int, int> pii;

void fast(){
    cin.tie(0);
    cout.tie(0);
    cin.sync_with_stdio(0);
}

ll numOfDigits(ll n);
bool compare(int &a, int &b){
    return a>b;
}

ll pow (ll a, ll b);

dd BN (vector<pii> &v, ll n, ll m);



dd sum(dd mid){
    return ((dd)mid/2)*(mid+1);
}
int  N, M, NUM, mn = IMAX;
#define MAX 1000000
bool visited[15][102];
bool arr[15][102];

bool valid(int r, int c){//if not out of the bounds
    if(r>=N || r<0) return 0;
    if(c>=M || c<0) return 0;
    return 1;
}
void countReachable(int r, int c, int cnt, int i){
    //if out of bounds || visited before
    if(!valid(r, c) || visited[r][c])
        return;

    visited[r][c] = 1; //mark as visited

    if(i==NUM) {mn = min(mn, cnt); return;}
    //try 4 moves
    countReachable(r,c+1, cnt+1, i+arr[r][c]);//right

    countReachable(r,c-1, cnt+1, i+arr[r][c]);//left

    countReachable(r+1,c, cnt+1, i+arr[r][c]);//up
    visited[r][c] = 0;
    countReachable(r-1,c, cnt+1, i+arr[r][c]);//down
    visited[r][c] = 0;

}

int main()
{
    JULEE_DO_THE_THING;
    //freopen("test cases\\.txt", "r", stdin) ;
    int h, a; cin>>h>>a;
    cout<<h/a + (h%a!=0);
    return 0;
}


dd BN (vector<pii> &v, ll n, ll m){
dd low = 0;
dd up = 1e21;
dd ans = 0;
while(low<=up){
    dd mid = trunc((low+ up)/2);
    dd fx = 0;
    fori(0, n){
        fx += max(0.0, mid-v[i].F)*v[i].S;
    }
    if(fx<=m) {
        ans = mid;
        low = mid+1;
    }else up = mid-1;
}
return ans;
}

ll pow (ll a, ll b){
    ll pow = 1;
    fori(0,b)
        pow *=a;
    return pow;
}
ll numOfDigits(ll n){
    if(!n) return 1;
    return (ll)(log10(n)+1);
}


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

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

Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <vector>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <climits>
#include <stack>
#include <queue>
#include <set>
#include <cctype>
#include <bitset>
#include <type_traits>

#include <list>
using namespace std;

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define YES(j) cout << (j ? "YES" : "NO") << endl;
#define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
#define yes(j) std::cout << (j ? "yes" : "no") << endl;

int main(void)
{
    int n;
    cin >> n;
    int minv, ans;

    cin >> minv;
    ans = -1e9;

    REP(i, n - 1)
    {
        int tmp;
        cin >> tmp;
        ans = max(ans, tmp - minv);
        minv = min(minv, tmp);
    }
    cout << ans << endl;
}


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

namespace AtCoder
{
	class Program
	{
		static void Main(string[] args)
		{
            var s = Console.ReadLine();
            
            if (s[2] == s[3] && s[4] == s[5])
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
		}
	}
}


Measured memory_bytes: 11092
sa = list(map(str, input()))
sb = list(map(str, input()))
sc = list(map(str, input()))

turn = 0

while True:
    s = ""
    if turn == 0:
        if len(sa) != 0:
            s = sa.pop(0)
        else:
            print("A")
            exit()
    elif turn == 1:
        if len(sb) != 0:
            s = sb.pop(0)
        else:
            print("B")
            exit()
    else:
        if len(sc) != 0:
            s = sc.pop(0)
        else:
            print("C")
            exit()

    if s == "a":
        turn = 0
    elif s == "b":
        turn = 1
    else:
        turn = 2

Measured memory_bytes: 9088
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string.h>
#include <queue>
#include <stack>
#include <utility>
#include <queue>
#define mp make_pair
#define pii pair<int,int> 
#define ff first
#define ss second

using namespace std;

char a;

int main()
{
	while(scanf("%c",&a)!=EOF)
	{
		a=toupper(a);
		printf("%c",a);
	}
	return 0;
}

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

typedef long long int ll;
typedef pair<ll, ll> pll;

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

ll A[55];

int main()
{
    int N;
    cin >> N;
    ll max = 0, min = 0;
    REP(i, N)
    {
        cin >> A[i];
        if (A[max] < A[i])
            max = i;
        if (A[min] > A[i])
            min = i;
    }

    //! 一番大きい要素、または小さい要素を全体に足すと、全体はマイナスかプラスのどちらかになる
    if (abs(A[max]) > abs(A[min]))
    {
        cout << 2 * N - 1 << endl;
        cout << max + 1 << " " << max + 1 << endl;
        REP(i, N)
        {
            if (max == i)
                continue;
            cout << max + 1 << " " << i + 1 << endl;
        }
        //! 全部プラスになっている
        REP(i, N - 1)
        {
            cout << i + 1 << " " << i + 2 << endl;
        }
    }
    else
    {
        cout << 2 * N - 1 << endl;
        cout << min + 1 << " " << min + 1 << endl;
        REP(i, N)
        {
            if (min == i)
                continue;
            cout << min + 1 << " " << i + 1 << endl;
        }
        //! 全部マイナスになっている
        for (int i = N; i > 1; --i)
        {
            cout << i << " " << i - 1 << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<string.h>
 
typedef long long int ll;
#define all(x) (x).begin(), (x).end()
 
using namespace std;

int nxt() {
    int x;
    cin >> x;
    return x;
}

ll nxtl(){
    ll x;
    cin>>x;
    return x;
}
 
void SieveOfEratosthenes(int n,vector <int> &primes) 
{ 
    // Create a boolean array "prime[0..n]" and initialize 
    // all entries it as true. A value in prime[i] will 
    // finally be false if i is Not a prime, else true. 
    bool prime[n+1]; 
    memset(prime, true, sizeof(prime)); 
  
    for (int p=2; p*p<=n; p++) 
    { 
        // If prime[p] is not changed, then it is a prime 
        if (prime[p] == true) 
        { 
            // Update all multiples of p greater than or  
            // equal to the square of it 
            // numbers which are multiple of p and are 
            // less than p^2 are already been marked.  
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
  
    // Print all prime numbers 
    for (int p=2; p<=n; p++) 
       if (prime[p]) 
          primes.push_back(p);
} 
 
ll max(ll a,ll b)
{
    if(a>b)
        return a;
    return b;
}
 
ll power(ll x, ll y,ll mod) 
{ 
    ll temp; 
    if( y == 0) 
        return 1; 
    temp = power(x, y/2,mod); 
    if (y%2 == 0) 
        return (temp*temp)%mod; 
    else
        return (((x*temp)%mod)*temp)%mod; 
} 

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n=nxt();
    vector <int> v(n);
    generate(all(v),nxt);
    ll test=0;
    sort(v.begin(),v.end());
    for(int i=0;i<n;i++)
        for(int j=i+1;j<n;j++)
        {
            int k=j;
            int l=j+1,r=n-1;
            int sum=v[i]+v[j];
            while(l<=r)
            {
                int mid=(l+r)/2;
                if(v[mid]<sum)
                {
                    l=mid+1;
                    k=mid;
                }
                else
                    r=mid-1;
            }
            test+=(k-j);
        }
        cout<<test<<endl;
    
    return 0;   
}


 
 


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin, (x).rend()
#define endl '\n'
#define F first
#define S second
typedef pair<int,int> pii;
typedef long long ll;

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0);
	int x, y, z;
	cin>>x>>y>>z;
	cout<<min({x+y, x+z, y+z})<<endl;
}


Measured memory_bytes: 3608