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

int main() {
  cin.tie(nullptr)->sync_with_stdio(false);
  vector<tuple<char, int, int, int>> res;
  int a = 0, b = 1, c = 2, ab = 3;
  res.emplace_back('+', a, b, ab);
  vector<int> pw(60);
  iota(begin(pw), end(pw), 4);
  res.emplace_back('<', c, ab, pw[0]);
  for (int i = 1; i < 60; ++i) {
    res.emplace_back('+', pw[i - 1], pw[i - 1], pw[i]);
  }
  int r = 199999;
  auto mul = [&](int i, int j, int k) {
    res.emplace_back('+', i, j, r);
    res.emplace_back('<', pw[0], r, k);
    res.emplace_back('<', r, r, r);
  };
  auto pw2 = [&](int i, int cond, int dst) {
    res.emplace_back('+', r, cond, dst);
    while (i--) {
      res.emplace_back('+', dst, dst, dst);
    }
  };
  auto encode = [&](int src, int dst) {
    int cnt = 1e5, sum = cnt + 1, pwi = sum + 1, srco = pwi + 1;
    res.emplace_back('+', src, pw[0], srco);
    for (int i = 60; i--; ) {
      res.emplace_back('+', cnt, pw[i], sum);
      res.emplace_back('<', sum, srco, dst + i);
      pw2(i, dst + i, pwi);
      res.emplace_back('+', cnt, pwi, cnt);
    }
    res.emplace_back('<', cnt, cnt, cnt);
    res.emplace_back('<', cnt, cnt, sum);
  };
  int s = 100, t = 200;
  encode(a, s);
  encode(b, t);
  int cur = r - 1, coeff = cur - 1;
  for (int i = 0; i < 30; ++i) {
    for (int j = 0; j < 30; ++j) {
      mul(s + i, t + j, coeff);
      pw2(i + j, coeff, cur);
      res.emplace_back('+', c, cur, c);
      res.emplace_back('<', cur, cur, cur);
      res.emplace_back('<', cur, cur, coeff);
    }
  }
  cout << size(res) << '\n';
  vector<long long> arr(2e5);
  arr[0] = 13, arr[1] = 10;
  for (auto [op, i, j, k] : res) {
    cout << op << ' ' << i << ' ' << j << ' ' << k << '\n';
    if (op == '+') {
      arr[k] = arr[i] + arr[j];
    } else {
      arr[k] = arr[i] < arr[j];
    }
  }
  cerr << arr[2] << '\n';
  for (int i = 0; i < 60; ++i) {
    cerr << arr[pw[i]] << " \n"[i == 60 - 1];
  }
  for (int i = 0; i < 30; ++i) cerr << arr[s + i] << " \n"[i == 30 - 1];
  for (int i = 0; i < 30; ++i) cerr << arr[t + i] << " \n"[i == 30 - 1];
}


Measured memory_bytes: 5596
n = int(input())
txy = [list(map(int, input().split())) for _ in range(n)]
st, stx, sty = 0, 0, 0
ans = "Yes"
for t, x, y in txy:
    ta, xa, ya = abs(t - st), abs(x - stx), abs(y - sty)
    if ta >= xa + ya and (
        (ta % 2 == 1 and (xa + ya) % 2 == 1) or (ta % 2 == 0 and (xa + ya) % 2 == 0)
    ):
        st, stx, sty = t, x, y
    else:
        ans = "No"
        break
print(ans)


Measured memory_bytes: 27028
ans = 0
while True:
    try:
        S = input()
    except EOFError:
        break
    ok = True
    for i in range(0,len(S) // 2):
        if S [i] != S [len(S) - i - 1]:
            ok = False
    if ok:
        ans += 1

print(ans)

Measured memory_bytes: 7316
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
int main (){
    int a,b; cin>>a>>b;
    if(a+b>=a-b&&a+b>=a*b){
        cout<<a+b;}
        else if(a-b>=a+b&&a-b>=a*b){
            cout<<a-b;
        }else{
        cout<<a*b;}
}

























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

int main() {
  int n;
  int ans=0;
  double a,t;
  cin >>n;
  cin >>t;
  cin>>a;
  vector<double> h(n);
  for (int i=0;i<n;i++){
    cin >> h[i];
  }
  
  vector<double> tmp(n);
  
  for (int i=0;i<n;i++){
    tmp[i]=abs(a-t+0.006*h[i]);
  }
  double min=100000000;
  for (int i=0;i<n;i++){
    if (tmp[i]<min){
      min=tmp[i];
      ans=i+1;
    }
  }
  cout <<ans<<endl;
}

Measured memory_bytes: 256
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from functools import reduce



INF = float('inf')
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007


n, m = LI()


def mod_comb(n, r, mod=10 ** 9 + 7):
    fact = 1
    for i in range(n - r + 1, n + 1):
        fact = fact * i % mod

    divisor = 1
    for j in range(1, r + 1):
        divisor = divisor * j % mod

    return fact * pow(divisor, mod - 2, mod) % mod


def prime_fac(n):
    table =[]
    i = 2
    while n >= i**2:
    # nのその数自身を除いた素因数は√n以下であることから。
        while n % i == 0:
            table.append(i)
            n //= i
        i += 1
    if n > 1:
        table.append(n)
# 最後に残った、最大の素因数をリストに入れる。
    return table


ans = 1
for k, v in Counter(prime_fac(m)).items():
    ans = ans * mod_comb(v + n - 1, n - 1) % mod



print(ans)

Measured memory_bytes: 39280
#include<bits/stdc++.h>
#define fi first
#define se second
#define lc (x<<1)
#define rc (x<<1|1)
#define gc getchar()//(p1==p2&&(p2=(p1=buf)+fread(buf,1,size,stdin),p1==p2)?EOF:*p1++)
#define mk make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pb push_back
#define IT iterator 
#define vi vector<int>
#define TP template<class o>
#define SZ(a) ((int)a.size())
#define all(a) a.begin(),a.end()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
const int N=2e5+10,size=1<<20,mod=998244353,inf=2e9;

//char buf[size],*p1=buf,*p2=buf;
template<class o> void qr(o &x) {
    char c=gc; x=0; int f=1;
    while(!isdigit(c)){if(c=='-')f=-1; c=gc;}
    while(isdigit(c)) x=x*10+c-'0',c=gc;
    x*=f;
}
template<class o> void qw(o x) {
    if(x/10) qw(x/10);
    putchar(x%10+'0');
}
template<class o> void pr1(o x) {
    if(x<0)x=-x,putchar('-');
    qw(x); putchar(' ');
}
template<class o> void pr2(o x) {
    if(x<0)x=-x,putchar('-');
    qw(x); putchar('\n');
}

int n,x[N],y[N],sz[N],last,p;
bool v[N];

int main() {
    qr(n);
    for(int i=1;i<=n;i++) qr(x[i]),qr(y[x[i]]);
    p=n; last=1;
    for(int i=1;i<=n;i++) {
        v[y[i]]=1;
        while(v[p]) p--;
        if(n-p==i) {
            int s=i-last+1;
            while(last<=i) sz[last++]=s;
        }
    }
    for(int i=1;i<=n;i++) pr2(sz[x[i]]);
    return 0;
}


Measured memory_bytes: 6160
#include<set>
#include<map>
#include<list>
#include<queue>
#include<stack>
#include<string>
#include<math.h>
#include<time.h>
#include<vector>
#include<bitset>
#include<memory>
#include<utility>
#include<fstream>
#include<stdio.h>
#include<sstream>
#include<iostream>
#include<stdlib.h>
#include<string.h>
#include<algorithm>
using namespace std;
int a[105],b[105];
int c[105],d[105];
struct edge
{
    int y;
    edge * next;
};
edge * new_edge()
{
    static edge a[100005];
    static int top=0;
    return &a[top++];
}
edge * li[105];
void insert_edge(int x,int y)
{
    edge * t=new_edge();
    t->y=y;
    t->next=li[x];
    li[x]=t;
}
int g[105][105];
int n;
int t[105];
bool vis[105];
bool dfs(int x,int y)
{
    if (vis[x]) return false;
    vis[x]=true;
    int j;
    for (j=y;j<n;j++)
    {
        if (g[x][j])
        {
            if ((t[j]==-1)||(dfs(t[j],0)))
            {
                t[j]=x;
                return true;
            }
        }
    }
    return false;
}
int main()
{
    #ifdef absi2011
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
    scanf("%d",&n);
    int i;
    for (i=0;i<n;i++)
    {
        scanf("%d%d",&a[i],&b[i]);
    }
    for (i=0;i<n;i++)
    {
        scanf("%d%d",&c[i],&d[i]);
    }
    for (i=0;i<n;i++)
    {
        int j;
        for (j=0;j<n;j++)
        {
            if ((a[i]<c[j])&&(b[i]<d[j]))
            {
                g[i][j]=true;
            }
        }
    }
    memset(t,-1,sizeof(t));
    int ans=0;
    for (i=0;i<n;i++)
    {
        memset(vis,0,sizeof(vis));
        ans+=dfs(i,0);
    }
    printf("%d\n",ans);
    return 0;
} 


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <set>
#include <cmath>
#include <cstring>
#include <stdio.h>
#include <string.h>
#include <sstream>
#include <stdlib.h>
#include <vector>
#include <iomanip>
#include <ctime>
#include <deque>
#include <bitset>
#include <functional>
#include <numeric>
#include <utility>
#include <cstdlib>
#include <cassert>

#define nl "\n"
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define p_un(a) ((void)a)
#define p_st(a) string(a)
#define sz(a) (int)a.size()
#define all(a) a.begin(), a.end()
#define naj ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define NL cout << endl;
#define sqr(x) (sqrt(x) * 1LL)
#define pcnt(i) __builtin_popcount(i)
#define lcm(a,b) (a * b) / __gcd(a, b)
#define E 2.718281828459045
#define PI 3.141592653589793
#define up_b upper_bound
#define low_b lower_bound
#define FILE_NAME "A"
#define show(x) cout << (#x) << ": " << x << endl

using namespace std;

typedef long long llong;
typedef long double ldouble;
typedef unsigned long long ullong;
typedef vector <llong> vl;
typedef vector <bool> vb;
typedef vector <char> vc;
typedef vector <int> vi;
typedef vector <string> vs;
typedef pair <llong, llong> pll;
typedef map <llong, llong> mll;
typedef set <llong> sl;
typedef set <char> sc;
typedef map <string, llong> msl;
typedef map <string, bool> msb;
typedef map <char, llong> mcl;
typedef map <string, string> mss;

const llong MXN = 1e6 + 1;
const llong MOD = 1e9 + 7;
const llong INF = 1e18;
const ldouble EPS = 1e-9;

#define int int64_t

//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 dx[]={2,1,-1,-2,-2,-1,1,2}; int dy[]={1,2,2,1,-1,-2,-2,-1};//Knight Direction
//int dx[]={-1,-1,+0,+1,+1,+0}; int dy[]={-1,+1,+2,+1,-1,-2}; //Hexagonal Direction

int n, a, b, c;
vector <int> l(n, 0);
int ans, mx;

signed main() {

    naj;
#ifdef LOL
    freopen(FILE_NAME".in", "r", stdin);
    freopen(FILE_NAME".out", "w", stdout);
#endif
    string s;
    getline(cin, s);
    cout << (s <= "2019/04/30" ? "Heisei" : "TBD");
    return 0;
}


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

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

int main()
{
	int p, q, r;
	cin >> p >> q >> r;

	int ans = min(p+q, min(q+r, r+p));

	cout << ans << "\n";

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <cmath>
#include <set>
using namespace std;

int main() {
        vector<int> x(3), y(3);
        for (int i = 0; i < 3; i ++) scanf("%d%d", &x[i], &y[i]);
        vector<double> edge;
        for (int i = 0; i < 3; i ++) {
                for (int j = i + 1; j < 3; j ++) {
                        edge.push_back(sqrt((double)(pow(x[i] - x[j], 2) + pow(y[i] - y[j], 2))));
                }
        }
        sort(edge.rbegin(), edge.rend());
        double a = edge[0], b = edge[1], c = edge[2];
        double s = (a + b + c) / 2;
        double area = sqrt(s * (s - a) * (s - b) * (s - c));
        double R = 2.0 * area / (a + b + c);
        double l = a;
        double ans = l / (l / R + 2.0);
        printf("%.20lf\n", ans);
        return 0;
}



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

int main(){
    int A,B,C,D;
    cin >> A >> B >> C >> D;
    int E;
    int F;
    if (C % B == 0) {
        E = C / B;
    } else {
        E = C / B + 1;
    }
    if (A % D == 0) {
        F = A / D;
    } else {
        F = A / D + 1;
    }
    if (C - B <= A - D) {
        if (E <= F){
            cout << "Yes" << endl;
        return 0;
        }
    } 
    if (C - B >= A - D) {
        if (E <= F) {
            cout << "Yes" << endl;
            return 0;
        }
    }
        cout << "No" << endl;
}


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

map<string, int> memo;

int main(){
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		string s;
		cin>>s;
		memo[s] +=1;
	}
	int maxv=0;
	for(const auto& x:memo){
		int v=x.second;
		if(v>maxv) maxv=v;
	}
	for(auto it=memo.begin(); it!=memo.end(); it++){
		if(it->second==maxv){
			cout<<it->first<<endl;
		}
	}
	return 0;	
}

Measured memory_bytes: 25216
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列
using namespace std;

typedef long long ll;

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000 //10^12
#define MOD 10000007 //10^9+7
#define MAXR 100000 //10^5:最大のrange(素数列挙などで使用)

int main(void){
    string a, b;
    cin >> a;
    cin >> b;
    int n = a.size();
    REP(i, n) {
        char c = a[n-1];
        a.pop_back();
        a.insert(0, 1, c);
        if(a == b) {
            cout << "Yes"<< endl;
            return 0;
        }
    }
    cout << "No"<< endl;
    return 0;
}

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

#define f first
#define s second
#define pb push_back
#define mp make_pair
#define all(v) v.begin(), v.end()
#define sz(v) (int)v.size()

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define F0R(i, n) for (int i = 0; i < (n); i++)
#define dFOR(i, a, b) for (int i = (b)-1; i >= a; i--)
#define dF0R(i, n) for (int i = (n)-1; i >= 0; i--)

#define print(x) cout << x << '\n';
#define dbg(x) cerr << ">>> " << #x << " = " << x << "\n";
#define finish(x) return cout << x << '\n', 0;

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef pair<ld, ld> pd;
typedef complex<ld> cd;


int N;
int h[100001][3];
int dp[100001][3];

int main() 
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin >> N;
    FOR(i,1,N+1) {
        cin >> h[i][0] >> h[i][1] >> h[i][2];
    }
    dp[1][0] = h[1][0];
    dp[1][1] = h[1][1];
    dp[1][2] = h[1][2];

    FOR(i,2,N+1) {
        F0R (j,3) {
            // Choose to do action j at timestep i
            dp[i][j] = dp[i-1][(j+1)%3] + h[i][j];

            dp[i][j] = max(dp[i][j], dp[i-1][(j+2)%3] + h[i][j]);
        }
    } 
    finish(*max_element(dp[N],dp[N]+3));



    return 0;
}


Measured memory_bytes: 2560
#from collections import deque,defaultdict
from sys import stdin
input = stdin.readline
printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 10**18
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

a,b = inm()
print(a*b)


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

#define eb emplace_back
#define ld long double
#define ll long long

using namespace std;

const int nm = 200002;

int n;
ll a[nm];

int main() {
#ifdef LOCAL
	freopen("input.txt", "r", stdin);
#endif
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin >> n;
	for (int i = 1; i <= n; ++i) {
		cin >> a[i];
	}
	ll s = 0;
	for (int i = 1; i <= n; ++i) {
		if (a[i] < a[i - 1]) {
			s += a[i - 1] - a[i];
			a[i] = a[i - 1];
		}
	}
	cout << s << "\n";
}


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


def solve(A: "List[int]"):
    if sum(A)>=22:
      print("bust")
    else:
      print("win")



# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = [int(next(tokens)) for _ in range(3)]  # type: "List[int]"
    solve(A)

if __name__ == '__main__':
    main()


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

#define endl "\n"

//typedef
//------------------------------------------
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;

//REPEAT
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//container util
//------------------------------------------
#define pb push_back
#define paired make_pair
#define ALL(a) (a).begin(),(a).end()
#define PRINT(V) for (auto v : (V)) cout << v << " "
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())

//constant
//------------------------------------------
const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

//math
//------------------------------------------
int QP(int a,int b){int ans=1;do{if(b&1)ans=1ll*ans*a%MOD;a=1ll*a*a%MOD;}while(b>>=1);return ans;}
int QP(int a,int b,int MOD){int ans=1;do{if(b&1)ans=1ll*ans*a%MOD;a=1ll*a*a%MOD;}while(b>>=1);return ans;}
int GCD(int a,int b){return b?GCD(b,a%b):a;}

//debug
//------------------------------------------
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//動的計画法で役に立つ関数
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

//最大公約数と最小公倍数
ll gcd(ll a, ll b) {
    if(b==0)return a;
    return gcd(b, a%b);
}

ll lcm(ll a, ll b) {
  ll g = gcd(a, b);
  return a/g*b;
}

vector<vector<long long> > comb(int n) {
  vector<vector<long long> > v(n + 1,vector<long long>(n + 1, 0));
  for (int i = 0; i < v.size(); i++) {
    v[i][0] = 1;
    v[i][i] = 1;
  }
  for (int j = 1; j < v.size(); j++) {
    for (int k = 1; k < j; k++) {
      v[j][k] = (v[j - 1][k - 1] + v[j - 1][k]);
    }
  }
  return v;
}

int main() 
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
    int N, A; cin >> N >> A;
    cout << N*N - A << endl;
  
    return 0;
}



Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main(void){
   int K,N,p[200001],sum[200000];
   double max=0.0;
   scanf("%d %d",&N,&K);
   for(int i=0;i<N;i++){
      scanf("%d",&p[i]);
      if(i!=0){
      sum[i]=p[i]+sum[i-1]+1;
      }else{
         sum[i]=p[i]+1;
      }
   }
   max=(double)sum[K-1];
   for(int i=K;i<N;i++){
      if(max<sum[i]-sum[i-K]){
         max=(double)(sum[i]-sum[i-K]);
      }
   }
   
   printf("%.12f",max/2.0);
   return 0;
}


Measured memory_bytes: 1664
#include<iostream>
#include<cmath>
using namespace std;
typedef long long int LL;
const LL INF=(LL)1<<32;
LL dp[100005];
int h[100005];
int main(){
	int n,m;
	LL a,b,c;
	cin>>n>>m;
	for(int i=0;i<n;i++)cin>>h[i],dp[i]=INF;
	dp[0]=0;
	for(int i=1;i<n;i++){
		for(int j=1;j<=m;j++){
			if(i<j)break;
			a=dp[i-j]+abs(h[i]-h[i-j]);
			if(dp[i]>a)dp[i]=a;
		}
	}
	cout<<dp[n-1]<<endl;
	return 0;
}


Measured memory_bytes: 1408
import numpy as np
N = int(input())
A = np.array([input().split() for _ in range(N)], dtype=np.int64)

np.fill_diagonal(A, 10**9)

ans = 0
for i in range(N):
  for j in range(i+1,N):
    d = np.min(A[i]+A[j])
    if A[i][j] < d:
      ans += A[i][j]
    elif d < A[i][j]:
      print(-1)
      exit()

print(ans)


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

int main()
{
    int x;
    cin >> x;
    int ans;
    if (x < 600) ans = 8;
    else if (x < 800) ans = 7;
    else if (x < 1000) ans = 6;
    else if (x < 1200) ans = 5;
    else if (x < 1400) ans = 4;
    else if (x < 1600) ans = 3;
    else if (x < 1800) ans = 2;
    else ans = 1;
    cout << ans << endl;
}

Measured memory_bytes: 3632
#include <cstdio>

int main(){
  int n,s;
  while(scanf("%d %d",&n,&s),n){
    int ans=0;
    for(int i=0; i<1024; i++){
      int a=0,b=0;
      for(int j=0; j<10; j++)
	if((i>>j)&1){a+=j;b++;}
      if(a==s&&b==n) ans++;
    }
    printf("%d\n",ans);
  }
}

Measured memory_bytes: 1028
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bits/stdc++.h>
#include<cmath>
#include<bitset>
#define INF ((1LL<<62)-(1LL<<31))
using namespace std;

int main(){
  long long int a,b;
  cin>>a>>b;
  long long int W[a+1],V[a+1],DP[a+1][100001];
  //DP[i][j] i番目までの品物を、価値がj以上になるように選んだ時の最小の重さ
  
  for(int i=0; i<=a; ++i){
    if(i>0) cin>>W[i]>>V[i];
    for(int j=0; j<100001; ++j){
      DP[i][j]=INF;
    }
  }
  
  DP[0][0]=0;
  
  for(int i=1; i<=a; ++i){
    for(int j=0; j<100001; ++j){
      if(j>=V[i]) DP[i][j]=min(DP[i-1][j],DP[i-1][j-V[i]]+W[i]);
      else DP[i][j]=DP[i-1][j];
    }
  }
  
  int ans=100000;
  while(DP[a][ans]>b) ans--;
  cout<<ans<<endl;
}


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

#define fi first
#define se second
#define FO(x, n) for (int x = 0; x < n; ++x)
#define FOR(x, a, b) for (int x = a; x < b; ++x)
#define RFO(x, n) for (int x = n - 1; x >= 0; --x)
#define RFOR(x, a, b) for (int x = b - 1; x >= a; --x)
#define FOR_ITER(x, a) for(auto x = a.begin(); x != a.end(); ++x)



using namespace std;
typedef unsigned char byte;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef pair<string, string> pss;
typedef pair<ll, ll> pll;
inline bool feq(const double& a, const double& b) { return fabs(a - b) < 1e-10; }

using namespace std;


int main(){
//    int n, l;
//    cin >> n >> k;
//    vector<bool> dislike(10, false);
//
//    FOR(i, 0, k) {
//        int t;
//        cin >> t;
//        dislike[t] = true;
//    }




string str;

cin >>str;

int s = 0;
int e = str.size() -1;

FO(i, (e + 1)) {
    if('A' == str.at(i)) {
        s = i;
        break;
    }
}

RFO(i, (e + 1)) {
    if('Z' == str.at(i)) {
        e = i;
        break;
    }
}

cout << (e - s + 1)<< endl;
    return 0;
}


Measured memory_bytes: 640
/*input
6
8 3
4 9
12 19
18 1
13 5
7 6
*/
#include <bits/stdc++.h>
using namespace std;
const int N = 100007;

int Arr[N], sizee[N], n, ans;
pair<pair<int, int>, int> point[N];
vector<pair<int, pair<int, int> > > edges;

void initialize_dsu(int a, int b) {for(int i=a; i<=b; ++i) Arr[i] = i, sizee[i] = 1;}
int root(int a) { if(a == Arr[a]) return a; return Arr[a] = root(Arr[a]);}
bool find(int a, int b) {return (root(a) == root(b));}
void union_set(int a, int b){
	int u = root(a), v = root(b); if(find(u, v)) return;
	if(sizee[u] < sizee[v]) swap(u, v); Arr[v] = Arr[u], sizee[u] += sizee[v];
}

int main()
{
	ios_base::sync_with_stdio(false); cin.tie(0);
	cin >> n; initialize_dsu(1, n);
	for(int i=1; i<=n; ++i)
		cin >> point[i].first.first >> point[i].first.second, point[i].second = i;
	sort(point + 1, point + n + 1);
	swap(point[1].first.first, point[1].first.second);
	for(int i=2; i<=n; ++i)
		swap(point[i].first.first, point[i].first.second),
		edges.push_back(make_pair(point[i].first.second - point[i-1].first.second, make_pair(point[i].second, point[i-1].second)));
	
	sort(point + 1, point + n + 1);
	for(int i=2; i<=n; ++i) 
		edges.push_back(make_pair(point[i].first.first - point[i-1].first.first, make_pair(point[i].second, point[i-1].second)));
	
	sort(edges.begin(), edges.end());
	for(auto &v:edges){
		if(find(v.second.second, v.second.first)) continue;
		union_set(v.second.first, v.second.second); ans += v.first;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 6900
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
/*
//#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
*/
 
// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
/*
//#if __cplusplus >= 201103L
#include <array>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
*/
using namespace std;
#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
 
#define uni(x) x.erase(unique(all(x)),x.end())
template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;}
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) > (b) ? (b) : (a))
 
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;
 
#define INF INT_MAX/3
#define MAX_N 1000
#define M_INF 1000000000
int n,m,v,i;
void solve(){
   cin.tie(0);
  ios::sync_with_stdio(false);
  cin>>n;
  vector<ll> vec;
  rep(i,n){
    cin>>v;
    vec.pb(v);
  }
  sort(all(vec));
  ll ans = 0;
  rep(i,vec.size()-1){
    if(vec[i]!=vec[i+1]) {
      ans++;
      // cout<<i<<endl;
    } else {
      ll flg = 0;
      // cout<<i<<endl;
      while(vec[i] == vec[i+1] && vec.size() > i){
        flg++;
        i++;
        // cout<<i<<endl;
      }
      if(flg%2==0) {
        ans++;
        // cout<<i<<endl;
      }
    }
  }
  if(vec[vec.size()-1] == vec[vec.size()-2])cout<<ans<<endl;
  else cout<<ans+1<<endl;
}
 
int main(){
  solve();
  return 0;
}

Measured memory_bytes: 1400
N, M = map(int, input().split())
lis = [[x, -1] for x in range(1, N + 1)]
Blis = [list(map(int, input().split())) for _ in range(M)]
inc = int(N*(N - 1)/2)
ans = [x for x in range(M)]
ans[M - 1] = inc
def root(a):
    if lis[a - 1][1] < 0:
        return lis[a - 1][0]
    else:
        k = root(lis[a - 1][1])
        lis[a - 1][1] = k
        return k
def size(a):
    return -lis[root(a) - 1][1]
def connect(a, b):
    A = root(a)
    B = root(b)
    if A == B:
        return None
    else:
        if size(A) < size(B):
            A, B = B, A
        lis[A - 1][1] += lis[B - 1][1]
        lis[B - 1][1] = A
for i in reversed(range(1, M)):
    if root(Blis[i][0]) != root(Blis[i][1]):
        ans[i - 1] = ans[i] - size(Blis[i][0])*size(Blis[i][1])
        connect(Blis[i][0], Blis[i][1])
    else:
      ans[i - 1] = ans[i]    
for i in range(M):
  print(ans[i])

Measured memory_bytes: 46236
import Data.List
import Control.Monad
--assuming 1st arg sorted by price
solver::[(Int,Int)]->Int->Int
solver _ 0 = 0
solver ((price,n):xs) m = let buy = min n m in
                            if m == buy then price * buy
                                        else price * buy + (solver xs (m - buy))

main::IO()
main=do
  n:m:[]<-return.map read.words=<<getLine
  dat<-forM [1..n] (\_->return.(\ (a:b:[]) -> (a,b) ).map read.words=<<getLine)
  let srtd = sortBy (\ (p_1,_) -> \ (p_2,_) -> compare p_1 p_2) dat
  print (solver srtd m)


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

int main(){
  int a,b,k;
  cin >> a >> b >> k;
  if(b-a+1<=2*k){
    for(int i=0; i<b-a+1; i++) cout << a+i << endl;
  }
  else{
    for (int i=0; i<k; i++) cout << a+i << endl;
    for (int i=0; i<k; i++) cout << b-k+i+1 << endl;
  }
}

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

using namespace std;

int main(){
    string s;
    cin >> s;
    
    int len = s.length();

    int ans = 0;

    for(int i = len; i >= 2; i--){
//        cout << "i" << i << endl;
        if(i != len && i % 2 == 0){
            string l_s, r_s;
            for(int j = 0; j < i / 2; j++){
                l_s += s[j];
            }
            for(int k = i / 2; k < i; k++){
                r_s += s[k];
            }
//            cout << l_s << r_s << endl;
            if(l_s == r_s){
                ans = max(ans, i);
            }
        }
    }

    cout << ans << endl;

}

Measured memory_bytes: 256
read a b k
r=$((k-a))
a=$((a-k))
if [[ r -lt 0 ]];then r=0;fi
if [[ a -le 0 ]];then b=$((b-r));fi

if [[ a -lt 0 ]];then a=0;fi
if [[ b -lt 0 ]];then b=0;fi
echo $a $b

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

int main(){
    int x, y, z;
    cin >> x >> y >> z;

    put((x - z) / (y + z));
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<vector>
#include<map>
#include<unordered_map>
#include<set>
#include<string>
#include<algorithm>
#include<math.h>
#include<numeric>
#include<iomanip>
#include<queue>
#include<functional>
#include<iso646.h>
#include<bitset>

#ifndef M_PI
#define M_PI 3.14159265358979
#endif
#define deg_to_rad(deg) (((deg)/360)*2*M_PI)
#define rad_to_deg(rad) (((rad)/2/M_PI)*360)

using namespace std;

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

const ll INF = 1e15;
const ll MOD = 1e9 + 7;


int main() {
	ll i, j;
	ll N;
	string S;
	cin >> N;
	cin >> S;
	if (N % 2 == 1) {
		cout << "No" << endl;
		return 0;
	}
	for (i = 0; i < N / 2; i++) {
		if (S[i] != S[N / 2 + i]) {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;


	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
bool flag = 0;

for(int i=1 ; i<=9 ; i++){
    int div;
    if(n%i==0){
        div = n/i;
        if(div>=1 && div<=9)
            flag = 1;
    }
}

if(flag) cout<<"Yes"<<endl;
else cout<<"No"<<endl;

}


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

namespace EDPC
{
    class B
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');

            int N = int.Parse(input[0]);
            int K = int.Parse(input[1]);

            input = Console.ReadLine().Split(' ');

            // initialize
            int[] h = new int[N];
            for (int i = 0; i < N; i++)
            {
                h[i] = int.Parse(input[i]);
            }


            long H = int.MaxValue;
            long[] dp = new long[N];
            for (int i = 0; i < N; i++)
            {
                dp[i] = H;
            }
            //var dp = Enumerable.Repeat(int.MaxValue, N).ToArray();

            // Main processing
            dp[0] = 0;
            for (int i = 1; i < N; i++)
            {
                for (int j = 1; j <= K; j++)
                {
                    if (j <= i)
                    {
                        dp[i] = Math.Min(dp[i], dp[i - j] + Math.Abs(h[i] - h[i - j]));
                    }
                }
            }
            Console.WriteLine(dp[N - 1]);
        }
    }
}


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

ll n, dp[2005][2005];
pair <ll, ll> a[2005];

bool cmp (pair <ll, ll> a, pair <ll, ll> b) {
	return (a.first>b.first);
}

ll hitung (ll x, ll y) {
	if (x>n) return 0;
	if (dp[x][y]==-1) {
		ll kiri=hitung(x+1, y+1)+a[x].first*abs(a[x].second-y-1);
		ll kanan=hitung (x+1, y)+a[x].first*abs(a[x].second-(n-x+1+y));
		dp[x][y]=max(kiri, kanan);
	}
	return dp[x][y];
}

int main() {
	cin>>n;
	memset (dp, -1, sizeof(dp));
	for (int i=1; i<=n; i++) {
		cin>>a[i].first;
		a[i].second=i;
	}
	sort (a+1, a+n+1, cmp);
	cout<<hitung(1, 0)<<endl;
}



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

inline ll real() {
    ll x = 0, f = 1; char ch = getchar();
    while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); }
    while (ch >= '0' && ch <= '9') { x = x * 10 + ch - 48; ch = getchar(); }
    return x * f;
}

const int N = 1e5 + 10;
ll a[N];

int main() {
    ll ans = 0;
    ll n = real();
    for (int i = 1; i <= n; i++) a[i] = real();
    for (int i = 1; i <= n - 1; i++) {
        if (a[i] < 0) a[i+1] *= -1, a[i] *= -1;
        ans += a[i];
    }     
    ans += a[n];
    ll temp = *min_element(a + 1, a + n);
    if (a[n] < 0) ans = max(ans, ans - 2 * a[n] - 2 * temp);
    printf("%lld\n", ans);
    return 0;
}            

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define SZ(X) ((int)(X).size())
#define endl "\n";
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
 string s,t;
 int n;
 cin>>n>>s>>t;
 for (int i = 0; i < n; ++i)
 	{
 		cout<<s[i]<<t[i];
 	}	

   return 0;
}


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

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

int main() {
	int W, H;
	while (cin >> W >> H) {
		if (W == 0) return 0;
		H = H * 2 - 1, W = W * 2 - 1;
		vector<vector<int> > V(H, vector<int>(W));
		for (int i = 0; i < H; i++) {
			for (int j = 0; j < W; j++) {
				if (i % 2 == j % 2) V[i][j] = i % 2;
				else cin >> V[i][j];
			}
		}
		vector<vector<int> > Dist(H, vector<int>(W, INF));
		queue<pair<int, int> > Q;
		Q.push({ 0, 0 });
		Dist[0][0] = 0;
		while (!Q.empty()) {
			pair<int, int> P = Q.front();
			Q.pop();
			int X = P.first, Y = P.second;
			for (int i = 0; i < 4; i++) {
				int NX = X + dx[i], NY = Y + dy[i];
				if (0 <= NX && NX < H && 0 <= NY && NY < W) {
					if (V[NX][NY] == 0 && Dist[NX][NY] > Dist[X][Y] + 1) {
						Dist[NX][NY] = Dist[X][Y] + 1;
						Q.push({ NX, NY });
					}
				}
			}
		}
		cout << (Dist[H - 1][W - 1] == INF ? 0 : Dist[H - 1][W - 1] / 2 + 1) << endl;
	}
}


Measured memory_bytes: 3092
N, M = map(int, input().split())
X = [[] for _ in range(N)]

for _ in range(M):
    u, v, d = map(int, input().split())
    X[u-1].append((v-1, d))
    X[v-1].append((u-1, d))

input()    
T = int(input())
t = 0
x = 0

while t < T:
    if t < 5000:
        print(-1)
        t += 1

        continue
    
    y, d = max([(y, d) for y, d in X[x]])
    
    for i in range(d):
        print(y+1)
        t += 1
    
        if t >= T:
            break
    x = y


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

int main() {
  int N;
  cin >> N;
  
  if(N % 10 == 3){
    cout << "bon";
  }else if(N % 10 == 0 || N % 10 == 1 || N % 10 == 6 || N % 10 == 8){
    cout << "pon";
  }else{
    cout << "hon"; 
  }
}


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

int main() {
  int n; cin >> n;
  vector<int> a(n);
  for(int i = 0; i < n; i++){
    cin >> a.at(i);
  }
  long long out = 1;
  int min = a.at(0);
  for(int i = 1; i < n; i++){
    if(min >= a.at(i)){
      out++;
      min = a.at(i);
    }
  }
  cout << out;
    
}


Measured memory_bytes: 1152
H = int(input())
memo = {1: 1}
def dfs(h):
  global memo
  memo[2] = 3
  if h in memo:
    return memo[h]
  memo[h] = dfs(h // 2) + dfs(h // 2) + 1
  return memo[h]
print(dfs(H))

Measured memory_bytes: 2940
#include <iostream>
#include <string>
using namespace std;
int main()
{
	int n, jud, a=0, b=0;
	string s;
	cin>>s;
	n=s.length();
	for(int i=0;i<n;i++)
	{
		jud=i%2;
		if(jud!=s[i]-48)a++;
		else b++;
	}
	if(a<b)
	{
		cout<<a<<endl;
	}
	else
	{
		cout<<b<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 512
#![allow(unused_imports)]
use std::io::*;
use std::fmt::*;
use std::str::*;
use std::cmp::*;
use std::collections::*;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

#[allow(unused_macros)]
macro_rules! ifv {
    ($cond:expr, $a:expr, $b:expr) => {
        if $cond {
            $a
        } else {
            $b
        }
    }
}

fn main() {
    input! {
        n: usize, m: usize,
        edges: [(usize1, usize1); m]
    };

    let mut incoming = vec![vec![]; n];
    let mut outdeg = vec![0; n];
    for i in 0..m {
        let (u, v) = edges[i];
        incoming[v].push(u);
        outdeg[u] += 1;
    }

    let mut dp = vec![0; n];

    let mut queue = VecDeque::new();
    for i in 0..n {
        if outdeg[i] == 0 {
            queue.push_front(i);
        }
    }
    while queue.len() >= 1 {
        let v = queue.pop_back().unwrap();
        for &i in incoming[v].iter() {
            dp[i] = max(dp[i], dp[v]+1);
            outdeg[i] -= 1;
            if outdeg[i] == 0 {
                queue.push_front(i);
            }
        }
    }

    let best = dp.iter().max().unwrap();
    println!("{}", best);
}

Measured memory_bytes: 14588
#include <stdio.h>

int		main(void)
{
	unsigned long	H;
	unsigned long	W;
	unsigned long	answer;

	answer = 0;
	scanf("%ld%ld", &H, &W);
	if (H == 1 || W == 1)
		printf("1");
	else
	{
		if (H % 2 == 0)
			printf("%ld", ((H / 2) * W));
		else
		{
			while (W)
			{
				if (W % 2 == 0)
					answer = answer + (H / 2);
				else
					answer = answer + ((H + 1) / 2);
				W--;
			}
			printf("%ld", answer);
		}
	}
	return 0;
}


Measured memory_bytes: 128
n = int(input())
a, b = map(int, input().split())
p = list(map(int, input().split()))

one, two, three = 0, 0, 0
for i in p:
	if i <= a:
		one += 1
	elif a < i <= b:
		two += 1
	else:
		three += 1
print(min(one, two, three))

Measured memory_bytes: 3064
N, M = [int(x) for x in input().split()]
V = [tuple(map(int, input().split())) for i in range(N)]
V.sort()

money = 0
count = 0

for a, b in V:
  if count + b < M:
    count += b
    money += a * b
  else:
    money += (M - count) * a
    break
print(money)

Measured memory_bytes: 16976
N = int(input())
c = [None] * N
r_cnt = 0
for n,s in enumerate(input()):
    c[n] = s
    if s == "R":
        r_cnt += 1
w_cnt = 0
for i in range(r_cnt):
    if c[i] == "W":
        w_cnt += 1
print(w_cnt)

Measured memory_bytes: 11036
#include <bits/stdc++.h>
using std::cin;
using std::ifstream;
using std::cout;
using std::vector;
using std::min;
using std::max;
using std::string;
using std::map;
using std::cerr;
using std::endl;
using std::sort;
using std::__gcd;
using std::ios_base;

#define oo(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}
unsigned lcm(int a, int b) { return (a / __gcd(a, b) * b); }
#define fri(i,n) 			for(int i = 0 ; i < n;++i) 
#define jri(j,k,n) 		for(int j = k ; j >= n;j--) 
#define swapnumsxor 	a ^= b; b ^= a; a ^= b
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#define inp(i) 				cin >> i 
#define inp2(i,j) 		cin >> i >> j  
#define inp3(i,j,k) 	cin >> i >> j >> k
#define oup(i) 				cout << i << "\n"
#define oup2(i,j) 		cout << i << " "<<j<< "\n"
#define oup3(i,j,k) 	cout << i << " "<< j << " "<<k<< "\n"
#define MOD 1000000007
#define rmdup 				std::sort(str.begin(), str.end());str.erase(std::unique(str.begin(), str.end()), str.end());

typedef long long int lli;
typedef unsigned long long int ulli;
#define pb 		emplace_back
#define mp 		make_pair
#define MAXN 	1000000
#define vi vector<int>
const int INF = 0x3f3f3f3f;

int main()
{ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
// ifstream in("input.txt");
  int n;
  inp(n);
  vi h(n);
  for(int &x : h) inp(x);
  vi dp(n,INF);
  dp[0] = 0;
  for(int i = 0 ; i< n ; i++){
    for(int j : { i+1 ,i+2 }){
      if(j < n){
        dp[j] = min( dp[j] , dp[i] + abs( h[i]-h[j] ));
      };
    }
  }

  oup(dp[n-1]);
  return 0;
}


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

using namespace std;

#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RFOR(i,a,b) for(int i=(int)b-1;i>=(int)a;--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define debug(x) cerr << #x << ":" << x << endl;
#define OK(ok) cout << (ok ? "Yes" : "No") << endl;
typedef long long ll;

void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail) {
  cin >> head; CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

const int INF = 1e9 + 1;
const int MOD = 1e9 + 7;
const int MAX_N = 1e5 + 1;

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

  CIN(N);
  ll ans = 0ll;
  REP(i, N) {
    LCIN(a);
    ans += a - 1ll;
  }
  cout << ans << endl;

  return 0;
}




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

int main(){
  int c[3][3];
  for (int i=0;i<3;i++){
      for(int j=0;j<3;j++){
        cin >> c[i][j];}}
   
  int d1=(c[0][0]-c[0][1]);
  int d2=(c[0][1]-c[0][2]);

  for (int i=1;i<3;i++){
    if(c[i][0]-c[i][1]==d1 && c[i][1]-c[i][2]==d2)
      continue;
    else {cout <<"No";goto Exit;}}
 
   cout << "Yes";
    
   Exit: ;

}

Measured memory_bytes: 256
#define rep(i, n) for (int i = 0; i < (n); i++)
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int MOD = 1000000007;
// MAX int 2,147,483,647
// MAX O(n) 10^18

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

    int ans = 0;
    for (int i = 1; i <= N; i++) {
        string strI = to_string(i);
        int length = strI.size();
        if (length % 2 == 1) {
            ans++;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3652
N,M,Q = map(int,input().split())
LR = [[0 for x in range(N+1)] for y in range(N+1)]
for i in range(M):
    L,R = map(int,input().split())
    LR[L][R] += 1

LRsum = [[0 for x in range(N+1)] for y in range(N+1)]
for i in range(1,N+1):
    for j in range(1,N+1):
        LRsum[i][j] = LRsum[i][j-1] + LR[i][j]

pq = []
for i in range(Q):
    pq.append(list(map(int,input().split())))
for i in range(Q):
    p,q = pq[i]
    ans = 0
    for i in range(p,q+1):
        ans += LRsum[i][q] - LRsum[i][p-1]
    print(ans)


Measured memory_bytes: 83032
N, M, X = map(int, input().split())
C = [0]*N
A = [None]*N
for i in range(N):
  C[i], *A[i] = map(int, input().split())

oo = 10**10
ans = oo
for b in range(2**N):
  c = 0
  T = [0]*M
  for i in range(N):
    if b>>i&1:
      c += C[i]
      for j in range(M):
        T[j] += A[i][j]
  ok = True
  for i in range(M):
    if T[i]<X:
      ok = False
  if ok:
    ans = min(ans, c)

print(ans if ans<oo else -1)


Measured memory_bytes: 9228
#include <stdio.h>
#include <iostream>
template <class _T> static _T tp_max(_T a, _T b) {
	return a > b ? a : b;
}
template<class _T> static void get1int(_T& a) {
	const char* fmt = " %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld";
	}

	if (scanf(fmt, &a) < 0) {
		printf("g1int Error\n");
	}
}

static void ABC087C_Candies();

#if 1
int main()
{
	ABC087C_Candies();
	fflush(stdout);
	return 0;
}
#endif

static void ABC087C_Candies()
{
	int N;
	get1int(N);

	int candies[2][100] = { 0 };
	int candySum[2][101] = { 0 };
	for (int i = 0; i < 2; i++) {
		for (int j = 0; j < N; j++) {
			get1int(candies[i][j]);
			candySum[i][j + 1] = candies[i][j] + candySum[i][j];
		}
	}

	int total = 0;
	for (int i = 0; i < N; i++) {
		total = tp_max(total, candySum[0][i + 1] + candySum[1][N] - candySum[1][i]);
	}

	printf("%d\n", total);
}


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

const int di[] = {-1, 0, 1, 0};
const int dj[] = {0, -1, 0, 1};

int main()
{
    int h, w;
    cin >> h >> w;
    int si, sj;
    cin >> si >> sj;
    int ti, tj;
    cin >> ti >> tj;
    --si;
    --sj;
    --ti;
    --tj;
    vector<string> s(h);
    rep(i, h) cin >> s[i];
    const int INF = 1e9;
    vector<vector<int>> dist(h, vector<int>(w, INF));
    deque<P> q;
    dist[si][sj] = 0;
    q.emplace_back(si, sj);
    while (!q.empty())
    {
        int i = q.front().first;
        int j = q.front().second;
        int d = dist[i][j];
        q.pop_front();
        if (dist[i][j] != d)
            continue;
        rep(v, 4)
        {
            int ni = i + di[v], nj = j + dj[v];
            if (ni < 0 || ni >= h || nj < 0 || nj >= w)
                continue;
            if (s[ni][nj] == '#')
                continue;
            if (dist[ni][nj] <= d)
                continue;
            dist[ni][nj] = d;
            q.emplace_front(ni, nj);
        }
        for (int ei = -2; ei <= 2; ++ei)
        {
            for (int ej = -2; ej <= 2; ++ej)
            {
                int ni = i + ei, nj = j + ej;
                if (ni < 0 || ni >= h || nj < 0 || nj >= w)
                    continue;
                if (s[ni][nj] == '#')
                    continue;
                if (dist[ni][nj] <= d + 1)
                    continue;
                dist[ni][nj] = d + 1;
                q.emplace_back(ni, nj);
            }
        }
    }
    int ans = dist[ti][tj];
    if (ans == INF)
        ans = -1;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 9460