akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;

inline int read() {
	int x=0;char c=getchar();
	while (c<'0'||c>'9') c=getchar();
	while (c>='0'&&c<='9') x=x*10+c-'0',c=getchar();
	return x;
}
int x,y;
int main() {
	scanf("%d%d",&x,&y);
	bool ok=false;
	if (4*x-y>=0&&(4*x-y)%2==0&&y-2*x>=0&&(y-2*x)%2==0)
		ok=true;
	puts(ok?"Yes":"No");
	return 0;
}

Measured memory_bytes: 3760
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b,c;
  cin>>a>>b>>c;
  if(a == b && b == c){
  	cout<<"No"<<endl;
  }else if(a == b || a == c || b == c){
  	cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
}

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

int main() {
  int N;
  cin >> N;
  
  int a = N / 1000;
  int b = (N % 1000) / 100;
  int c = (N % 100) / 10;
  int d = N % 10;

  if (b == c) {
    if (a == b || c == d) {
      cout << "Yes" << endl;
    }
    else {
      cout << "No" << endl;
    }
  }
  else {
    cout << "No" << endl;
  }
}

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

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node Node;
Node* NIL;

Node *root;

/*Node* treeSearch(Node *u, int k){
  if((u->left== NIL)&&(u->right==NIL)){
    return NIL;
  }
  else{
    if(k < u->key){
      treeSearch(u->left,k);
    }
    else if (k > u->key){
      treeSearch(u->right,k);
    }
    else {
      return u;
    }
  }
}
*/

Node* treeSearch(Node *u, int k){
  while((u!=NIL)&&(k!=u->key)){
    if(k<u->key) u=u->left;
    else u=u->right;
  }
  return u;
}


void insert(int k){
  Node *y = NIL;
  Node *x = root;
  Node *z;

  z=(Node*)malloc(sizeof(Node));
  z->key=k;
  z->left=NIL;
  z->right=NIL;

  while(x!=NIL){
    y=x;
    if(z->key < x->key){
      x=x->left;
    }
    else{
      x=x->right;
    }
  }
  z->parent=y;

  if(y==NIL){
    root=z;
  }
  else if(z->key < y->key){
    y->left=z;
  }
  else{
    y->right=z;
  }
}

void inorder(Node *u){
  if (u==NIL)return ;
  inorder(u->left);
  printf(" %d",u->key);
  inorder(u->right);
}
void preorder(Node *u){
  if(u==NIL)return;
  printf(" %d",u->key);
  preorder(u->left);
  preorder(u->right);
}

int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);

    if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node* t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    }

    else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    }

    else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }

  }

  return 0;
}



Measured memory_bytes: 20496
#include <bits/stdc++.h>
#define rep(i,m,n) for(int i=m; i<n; i++)
#define co(n) cout << n << endl
using namespace std;
int main(){
  int n, a=1, b=0, c;
  cin >> n;
  
  rep(i,1,50001){
    c=a*1.08;
    if(c==n){
      b++;
      break;
    }
    a++;
  }
  if(b==1) co(a);
  else co(":(");
  
  return 0;
  
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define PI acos(-1)
typedef  long long ll;
ll gcd(ll x,ll y){
   if(y==0) return x;
   else return gcd(y,x%y);
}
ll lcm(ll x,ll y){
   return x/gcd(x,y)*y;
}
using namespace std;

int main(){
  int n;
  cin>>n;
  
  rep(i,10000){
     if(i==0) continue;
     else{
        if((n*i)%360==0){
           cout<<i;
           return 0;
        }
     }
  }

  
  

  
 

return 0;
}


Measured memory_bytes: 3620
#include <iostream>
#include <fstream>
#include <vector>
#include <map>
#include <unordered_map>
#include <string>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <functional>
#include <numeric>
#include <iomanip>
#include <queue>
using namespace std;

typedef int64_t ll;
const ll INF = 1000000000000000000;
#define fori(i, a, b) for (ll i = (a); i < (b); ++i)
#define ford(i, a, b) for (ll i = (b - 1); (a) <= i; --i)
#define rep(i, n) fori(i, 0, n)
#define vll vector<ll>
#define all(v) v.begin(), v.end()


int main() {
	ll H, W;
	cin >> H >> W;
	vector<string> a(H);
	rep(i, H) cin >> a[i];

	rep(i, H) {
		rep(j, W) {
			bool flag1 = false, flag2 = false;
			rep(k, H) if (a[k][j] == '#') flag1 = true;
			rep(k, W) if (a[i][k] == '#') flag2 = true;

			if (flag1 && flag2) {
				cout << a[i][j];
			}
			else if (flag2 == false) break;
			if (j == W - 1) cout << endl;
		}
		
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define all(n) begin(n), end(n)
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int>> vvint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef unsigned long long ull;
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }

template <typename T, typename... Ts>
auto make_v(size_t a, Ts... ts)
{
    return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T &t, const V &v) { t = v; }

template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T &t, const V &v)
{
    for (auto &e : t)
        fill_v(e, v);
}
ll N,K;
vll imos(vll A)
{
    vll table(N+1);
    for (ll i = 0; i < N; i++)
    {
        table[max(0LL,i-A[i])]++;
        table[min((ll)(N),i+A[i]+1)]--;
    }

//    cout<<table[0]<<" ";
    for (ll i = 1; i < N; i++)
    {
        table[i] += table[i-1];
//        cout<<table[i]<<" ";
    }
//    cout<<endl;
    table.pop_back();
    return table;
}

int main()
{
    
    cin>>N>>K;
    vll A(N),B=A;
    for (size_t i = 0; i < N; i++)
    {
        cin>>A[i];
    }
   for (size_t i = 0; i < K; i++)
    {
        B = imos(A);
        if(A==B)
        {
            A=B;
            break;
        }
        
        else
        A=B;
    }
    
//    chmin(K,50LL);
//    auto ans = solve(imos,A);
    for (size_t i = 0; i < N; i++)
    {
        cout<<A[i]<<" ";
    }
    
    
    return 0;
}

Measured memory_bytes: 9524
# class Node:
#     def __init__(self, data): #コンストラクタ
#         self.data = data #ノードがもつ数値
#         self.left = None #左エッジ
#         self.right = None #右エッジ
#
# class BST:
#     def __init__(self, number_list): #コンストラクタ
#         self.root = None #ルート初期化
#         for node in number_list: #数値を持つ配列から二分木を生成
#             self.insert(node) #挿入メソッドを使ってノードを挿入する
#
#     #挿入
#     def insert(self, data):
#         n = self.root #nにルートを代入
#         if n == None: #ルートに何も入っていない場合
#             self.root = Node(data) #ルートにノードを代入(二分探索木の一番上の部分が出来る)
#             return #呼び出し部分に戻る
#         else: #ルートノードに既に数値が入ってる場合
#             while True: #return等が入るまでずっと実行
#                 entry = n.data #entryにnが持つデータ(数値)を入れる
#                 if data < entry: #entryとdata(代入するデータ)を比較してentryの方が大きい場合
#                     if n.left is None: #nの左エッジに何も入っていない場合
#                         n.left = Node(data) #nの左エッジにdata(代入するデータ)を代入
#                         return ##呼び出し部分に戻る
#                     n = n.left #nの左に何か入っている場合nにnのleftを代入
#                 elif data > entry: #entryとdata(代入するデータ)を比較してentryの方が小さい場合
#                     if n.right is None: #nの右エッジに何も入っていない場合
#                         n.right = Node(data) #nの右エッジにdata(代入するデータ)を代入
#                         return #呼び出し部分に戻る
#                     n = n.right #nの右エッジに何か入っている場合nにnのrightを代入
#                 else: #上2つの条件分岐以外の場合
#                     n.data = data #nのdataにdata(代入するデータ)を代入
#                     return #呼び出し部分に戻る

n = int(input())
h = list(map(int, input().split()))
h2 = [0] + h
# for i in h:
#     h2.append(max(h) - i)
ans = 0
imosarray = [0 for _ in range(n + 1)]
for i in range(n):
    imosarray[i] = h2[i + 1] - h2[i]
    ans += max(0, h2[i + 1] - h2[i])

print(ans)

Measured memory_bytes: 38256
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 c=a*b;
        if(c%2==1){
            System.out.println("Odd");
        }else{
            System.out.println("Even");
       
        }
        


    }
}

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

#define io ios::sync_with_stdio(false)
#define pb push_back
#define pqueue priority_queue
#define fi first
#define se second
#define ls rt<<1
#define rs rt<<1|1
#define sz(x) (int)(x).size()
#define dbg(x) cout<<#x<<" --- "<<x<<endl
#define mst(x,a) memset(x,a,sizeof(x))
#define fin(a) freopen(a,"r",stdin)
#define fout(a) freopen(a,"w",stdout)
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
ll gcd(ll a,ll b){ return b==0?a:gcd(b,a%b); }
ll qpow(ll a,ll b,ll m){ ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r; }
const int inf=0x7fffffff;
char a[10][10];
int n,m,k;

int main(){
	io;
	cin>>n>>m>>k;
	for(int i=1;i<=n;i++)cin>>(a[i]+1);
	int ans=0;
	for(int i=0;i<(1<<n);i++){
		for(int j=0;j<(1<<m);j++){
			int cnt=0;
			for(int ii=1;ii<=n;ii++){
				for(int jj=1;jj<=m;jj++){
					if(((1<<(ii-1))&i)||((1<<(jj-1))&j)){
						// cout<<"0";
						continue;
					}
					// cout<<1;
					if(a[ii][jj]=='#')cnt++;
				}
				// cout<<endl;
			}
			// cout<<endl
			if(cnt==k)ans++;
		}
	}
	cout<<ans<<endl;
	return 0;
}

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

int main(){
    string str;
    cin >> str;
    vector<int> L(str.size(),0); //Lの連続している個数を数える
    vector<int> R(str.size(),0); //Rの連続している個数を数える
    vector<int> ans(str.size(),0);
    int i=0;
    int cnt=1;
    //連続するLの個数をカウント
    while(i+cnt<str.size()){
        if(str[i+cnt]=='L'){
            cnt++;
        }else{
            L[i] += cnt-1;
            if(cnt>3){
                L[i+1] += cnt-2;
            }
            i += cnt;
            cnt =1;
        }
    }
    L[i] += cnt-1;
    if(cnt>3){
        L[i+1] += cnt-2;
    }

    i = str.size()-1;
    cnt = 1;
    //連続するRの個数をカウント
    while(i-cnt>=0){
        if(str[i-cnt]=='R'){
            cnt++;
        }else{
            R[i] += cnt-1;
            if(cnt>3){
                R[i-1] += cnt-2;
            }
            i -= cnt;
            cnt =1;
        }
    }
    R[i] += cnt-1;
    if(cnt>3){
        R[i-1] += cnt-2;
    }

    /*for(int i=0;i<str.size();i++){
        cout << L[i] << " ";
    }
    cout << endl;
    for(int i=0;i<str.size();i++){
        cout << R[i] << " ";
    }
    cout << endl;*/

    //答えを求める
    for(int i=0;i<str.size();i++){
        ans[i] += L[i]/2 + R[i]/2;
        if(str[i]=='R' && str[i+1]=='L'){
            ans[i]++;
        }
        if(str[i]=='L' && str[i-1]=='R'){
            ans[i]++;
        }
    }
    for(int i=0;i<str.size();i++){
        cout << ans[i] << " ";
    }
    cout << endl;
}

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

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 998244353

typedef long long ll;
typedef pair<ll,ll> P;
ll ans[555][555];
int main(){
	cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);
	ll n;cin >> n;
	REP(i, n){
		REP(j, n){
			if(i == j)continue;
			for(int k = 30;k >= 0;k--){
				if((i & (1 << k)) != (j & (1 << k))){
					ans[i][j] = (k + 1);
					break;
				}
			}
		}
	}
	REP(i, n-1){
		REP(j, n){
			if(i < j)cout << ans[i][j] << " ";
		}
		cout << endl;
	}
	return 0;
}


Measured memory_bytes: 2688
#include<bits/stdc++.h>
using namespace std;
#define INIT  ios_base :: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define mp make_pair
#define pb push_back
#define ft first
#define sc second
#define ll long long
#define pii pair<int, int>
#define count_bits __builtin_popcount
#define int ll

int t, n, m, k, a[300010], q, l, r;


int32_t main(){
INIT
string s; cin>>s;
int con=0;
int mx=0;
for(int i=0; i<3; i++){
if(s[i]=='R'){
    con++;
}
else{
    mx=max(mx, con);
    con=0;
}

}
mx=max(con, mx);
cout<<mx;


return 0;
}





Measured memory_bytes: 3648
#include<stdio.h>
int main()
{
   int n,count=0;
   scanf("%d",&n);
   while(n!=0)
   {
       int r=n%10;
       n=n/10;
       if(r==7)
       {
          count++;
           break;
       }
       }
   if(count==0)
    printf("No");
   else
    printf("Yes");
return 0;
}


Measured memory_bytes: 1732
#include <bits/stdc++.h>
struct Fast {Fast(){std::cin.tie(0);std::ios::sync_with_stdio(false);}} fast;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < (int)(n); i++)
#define repR(i, n) for(ll i = n; i >= 0; i--)
#define For(i, m, n) for(ll i = m; i < n; i++)

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) v.begin(), v.end()

using namespace std;

ll mod = 1e9+7;
inline ll gcd(ll a, ll b){
    ll r = a % b;
    while(r!=0){
        a = b;
        b = r;
        r = a % b;
    }
    return b;
}

inline ll lcm(ll x, ll y)
{
    if(x == 0 || y == 0) {
        return -1;
    }
    
    return (x * y / gcd(x, y));
}

inline ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

inline ll nCr(ll n, ll r) {
    if ( r * 2 > n ) r = n - r;
    ll dividend = 1;
    ll divisor  = 1;
    for ( ll i = 1; i <= r; ++i ) {
        dividend *= (n-i+1);
        divisor  *= i;
    }
    return (dividend / divisor);
}

// 因数分解
inline vector<pair<ll, int>>factorize(ll n){
    vector<pair<ll, int>> res;
    for(ll i = 2; i * i <= n; ++i){
        if(n % i) continue;
        res.emplace_back(i, 0);
        while(n % i == 0){
            n /= i;
            res.back().second++;
        }
    }
    if(n != 1) res.emplace_back(n, 1);
    return res;
}

inline bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}

//階乗
inline ll factorialMethod(ll k){
    ll sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}

inline ll vector_finder(std::vector<ll> vec, ll number) {
    auto itr = std::find(vec.begin(), vec.end(), number);
    size_t index = std::distance( vec.begin(), itr );
    if (index != vec.size()) { // 発見できたとき
        return 1;
        
        
    }
    else { // 発見できなかったとき
        return 0;
    }
}

void recursive_comb(ll *indexes, ll s, ll rest, std::function<void(ll *)> f) {
    if (rest == 0) {
        f(indexes);
    } else {
        if (s < 0) return;
        recursive_comb(indexes, s - 1, rest, f);
        indexes[rest - 1] = s;
        recursive_comb(indexes, s - 1, rest - 1, f);
    }
}

void foreach_permutation(int n, std::function<void(int *)> f) {
    int indexes[n];
    for (int i = 0; i < n; i++) indexes[i] = i;
    do {
        f(indexes);
    } while (std::next_permutation(indexes, indexes + n));
}

int main(){
    ll ans = 0;
    ll n, k;
    cin >> n >> k;
    priority_queue<ll> h;
    rep(i, n){
        ll x;
        cin >> x;
        h.push(x);
    }
    
    rep(i, k){
        h.pop();
    }
    
    rep(i, n-k){
        ans += h.top();
        h.pop();
    }

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


Measured memory_bytes: 2420
use proconio::input;

use std::f64::consts::PI;

fn main() {
    input! {
        (a,b,h,m): (f64, f64, f64, f64)
    };

    let b_ang = PI / 2f64 - m / 60f64 * 2f64 * PI;
    let b_x = b * b_ang.cos(); // b * math.cos(b_ang)
    let b_y = b * b_ang.sin(); // b * math.sin(b_ang)

    let a_ang = PI / 2f64 - h / 12f64 * 2f64 * PI - 2f64 * PI / 12f64 * m / 60f64;
    let a_x = a * a_ang.cos();
    let a_y = a * a_ang.sin();

    println!("{}",
            ((b_x - a_x).powf(2f64) + (b_y - a_y).powf(2f64)).sqrt());
}


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

using namespace std;

#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define FORR(i, a, b) for(ll i = (a); i > (b); --i)
#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOREACH(x, a) for(auto &(x) : (a))
#define VECCIN(x)                                                              \
    for(auto &youso_ : (x)) cin >> youso_
#define mp make_pair
#define bitcnt __builtin_popcount
#define SZ(x) ((ll)(x).size())
#define All(a) (a).begin(), (a).end()
template <typename T = long long> inline T IN() {
    T x;
    cin >> x;
    return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&... tail) {
    cin >> head;
    CIN(move(tail)...);
}
#define CINT(...)                                                              \
    int __VA_ARGS__;                                                           \
    CIN(__VA_ARGS__)
#define LCIN(...)                                                              \
    ll __VA_ARGS__;                                                            \
    CIN(__VA_ARGS__)
#define SCIN(...)                                                              \
    string __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define Yes(a) cout << (a ? "Yes" : "No") << "\n"
#define YES(a) cout << (a ? "YES" : "NO") << "\n"

typedef long long ll;
typedef unsigned long long ul;
typedef vector<int> V;
typedef vector<ll> VL;
typedef pair<ll, ll> PL;
typedef priority_queue<ll> PQ;
typedef priority_queue<ll, V, greater<ll>> PQG;

const int INF = 1e9;
const int MOD = 1e9 + 7;
// const int MOD = 998244353;
const ll LINF = 1e18;

struct Edge {
    ll to, cost;
};
ll N;
VL color;
vector<vector<Edge>> g;
ll tmp, ans;

void dfs(ll v, ll c) {
    color[v] = c;
    FOREACH(next, g[v]) {
        if(color[next.to] == 0) {
            if(next.cost % 2)
                dfs(next.to, -c);
            else
                dfs(next.to, c);
        }
    }
}

int main() {
    cin >> N;
    color.resize(N);
    g.resize(N);
    REP(i, N - 1) {
        CINT(u, v, w);
        g[--u].push_back({--v, w});
        g[v].push_back({u, w});
    }
    dfs(0, 1);
    REP(i, N) if(color[i] == -1) color[i] = 0;
    REP(i, N) cout << color[i] << "\n";
    return 0;
}


Measured memory_bytes: 9984
#include <iostream>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <string.h>
#include <stack>
#define Endl endl
#define mp make_pair
#define rep(N) for(int i=0;i<N;i++)
#define repj(N) for(int j=0;j<N;j++)
#define ll long long 
#define pii pair<int,int>
#define pll pair<ll,ll>
#define For(I,N) for(int I=0;I<N;I++)
#define cinone(N) int N;cin>>N;
#define scanfone(N) int N;cin>>N;
#define cinng(N,M) int N[M];for(int yiuytvnm=0;yiuytvnm<M;yiuytvnm++) cin>>N[yiuytvnm];
#define scanfng(N,M) int N[M];for(int qrwuoiq=0;qrwuoiq<M;qrwuoiq++) scanf("%d",&N[qrwuoiq]);
#define over(A) {cout<<A<<endl;exit(0);}
#define all(A) A.begin(),A.end()
#define ceil(a,b) ((a-1)/b+1)
typedef unsigned long long ull;
const int inf=1039074182;
using namespace std;
int n;
ll dp[405][405];
int a[405];
ll sum[405];

ll calc(int l,int r)
{
	return sum[r]-(l?sum[l-1]:0);
}

int main()
{
//	freopen("input.txt","r",stdin);
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
	}
	sum[0]=a[0];
	for(int i=1;i<n;i++)
	{
		sum[i]=sum[i-1]+a[i];
	}
	memset(dp,0x3f,sizeof(dp));
	for(int i=0;i<n;i++)
	{
		dp[i][i]=0;
	}
	for(int k=2;k<=n;k++)
	{
		for(int i=0;i<n;i++)
		{
			int j=i+k-1;
			if(j>=n) break;
			for(int o=i;o<j;o++)
			{
				dp[i][j]=min(dp[i][j],dp[i][o]+dp[o+1][j]+calc(i,o)+calc(o+1,j));
			}
//			dp[i][j]=min(dp[i+1][j]+a[i]+calc(i+1,j),dp[i][j-1]+a[j]+calc(i,j-1));
		}
	}
	cout<<dp[0][n-1]<<endl;
	return 0;
}

Measured memory_bytes: 1536
def solve(n):
    if n % 2 == 0:
        return n // 2 - 1
    else:
        return (n - 1) // 2


def main():
    n = int(input())
    res = solve(n)
    print(res)


def test():
    assert solve(4) == 1
    assert solve(999999) == 499999


if __name__ == "__main__":
    test()
    main()


Measured memory_bytes: 38256
// ※※※ 解答不能 ※※※
// LHiC氏.
// https://atcoder.jp/contests/yahoo-procon2019-qual/submissions/4214380
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
#define rep(i, n) for(int i = 0; i < n; i++)
#define repx(i, a, b) for(int i = a; i < b; i++)
const LL MOD = 998244353;
const int MAXN = 310;
bitset<MAXN> bb[MAXN];

LL pw(LL a, LL b){
    LL ans = 1;
    while(b){
        while(!(b & 1)) b >>= 1, a = (a * a) % MOD;
        ans = (ans * a) % MOD, --b;
    }
    return ans;
}

int main(){
    int n, m, x;
    scanf("%d %d", &n, &m);
    rep(i, n){
        rep(j, m){
            scanf("%d", &x);
            bb[i][j] = x;
        }
    }
    int now = 0;
    rep(i, m){
        int fl = 0;
        repx(j, now, n){
            if(bb[j][i]){
                fl = 1;
                swap(bb[j], bb[now]);
                break;
            }
        }
        if(!fl) continue;
        repx(j, now + 1, n) if(bb[j][i]) bb[j] ^= bb[now];
        ++now;
    }
    LL go = (pw(2, n) + MOD - pw(2, n - now)) % MOD;
    printf("%lld\n", (go * pw(2, m - 1)) % MOD);
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#define _USE_MATH_DEFINES
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007; // 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
/*-------------------------------------------------*/
int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  // freopen("input.txt", "r", stdin);

  int n, k; cin >> n >> k;
  int ans = 0;
  while (n--) {
    int h; cin >> h;
    if (h >= k) ++ans;
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 256
#include <iostream>

char S[101010];

int main()
{
	scanf("%s", S);

	bool app[26];
	for (int i = 0; i < 26; ++i) {
		app[i] = false;
	}
	for (int i = 0; S[i] != '\0'; ++i) {
		app[S[i] - 'a'] = true;
	}
	for (int i = 0; i < 26; ++i) {
		if (!app[i]) {
			printf("%c\n", (char)(i + 'a'));
			return 0;
		}
	}
	puts("None");
	return 0;
}


Measured memory_bytes: 384
#pragma GCC optimize("Ofast")
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"

using namespace std;

using u8 = uint8_t;
using u16 = uint16_t;
using u32 = uint32_t;
using u64 = uint64_t;
using i8 = int8_t;
using i16 = int16_t;
using i32 = int32_t;
using i64 = int64_t;

constexpr char newl = '\n';
constexpr double eps = 1e-10;

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define F0R(i,b) FOR(i,0,b)
#define RFO(i,a,b) for (int i = ((b)-1); i >=(a); i--)
#define RF0(i,b) RFO(i,0,b)
#define fi first
#define se second
#define debug(x) cout << #x << ": " << x << '\n';
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()

template<typename T1, typename T2> inline void chmin(T1& a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
template<class T> void Print(vector<T> v) {
  F0R(i, v.size()) {
    cout << v[i] << ' ';
  }
  cout << newl;
}

#if 1


// INSERT ABOVE HERE
signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  int H, W, h, w;
  cin >> H >> W >> h >> w;

  cout << (H * W - W * h - w * (H - h));
}
#endif


Measured memory_bytes: 3652
#include <iostream>
#include <cmath>

int main() {

    int n;
    std::cin >> n;

    const int max = std::sqrt(n);

    for (int i=1; i<=n; ++i) {
        int count = 0;

        for (int x=1; x<max; ++x) {
            int f_x = i;
            f_x -= x * x;
            if (f_x <= 0) break;

            for (int y=1; y<max; ++y) {
                int f_y = f_x;
                f_y -= y * y;
                f_y -= x * y;
                if (f_y < 0) break;

                for (int z=1; z<max; ++z) {
                    int f_z = f_y;
                    f_z -= z * z;
                    f_z -= y * z;
                    f_z -= z * x;
                    if (f_z < 0) break;
                    if (f_z == 0)  {
                        count++;
                    }
                }
            }
        }

        std::cout << count << std::endl;
    }

    return 0;

}

Measured memory_bytes: 3520
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (double i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef long long ll;
const long long INF = 1LL << 60;
typedef pair<int, int> P;
int main()
{
    int N, K;
    cin >> N >> K;

    vector<int> p(N), sum(N + 1, 0);
    vector<double> P(1001, 0);

    rep(i, N) {
        cin >> p[i];
        sum[i + 1] = sum[i] + p[i];
    }

    int m = 0;
    int index = 0;
    repd(i, K, N + 1) {
        if (m < sum[i] - sum[i - K]) {
            m = sum[i] - sum[i - K];
            index = i - K;
        }
    }

    double ans = 0;
    repd(i, 1, 1001) {
        repd(j, 1, i + 1) {
            P[i] += j / i;
        }
    }

    repd(i, index, index + K) {
        ans += P[p[i]];
    }

    cout << fixed << setprecision(11) << ans << endl;
    return 0;
}


Measured memory_bytes: 4824
n = gets.to_i
a = gets
b = gets
c = gets

split_words_a = a.split("")
split_words_b = b.split("")
split_words_c = c.split("")
i = 0
ancer = 0

n.times do
  if split_words_a[i] == split_words_b[i] && split_words_b[i] == split_words_c[i]
    i += 1
    next
  elsif split_words_a[i] == split_words_b[i]
    ancer += 1
  elsif split_words_a[i] == split_words_c[i]
    ancer += 1
  elsif split_words_b[i] == split_words_c[i]
    ancer += 1
  else
    ancer += 2
  end
  i += 1
end


puts ancer


Measured memory_bytes: 1788
#include <iostream>

int main(){
  uint64_t Num,B,R;
  
  std::cin >> Num >> B >> R;

  uint64_t BR = B + R;

  uint64_t much = Num / BR;
  uint64_t lest = Num % BR;

  if(lest > B)
    lest = B;
  
  std::cout << much * B + lest << std::endl;
  return 0;
}


Measured memory_bytes: 256
use proconio::input;

// ABC086C - Traveling
// https://atcoder.jp/contests/abs/fasks/arc089_a

fn main() {
    input! {
        n: usize,
        m: usize,
    }
    let mut input: Vec<Vec<i32>> = Vec::with_capacity(m);
    for _ in 0..m {
        input! {
            k:usize,
            mut a:[i32;k]
        }
        input.push(a);
    }
    input! {
        p:[i32;m]
    }

    let mut result = 0;
    for i in 0..1 << n {
        let mut on = true;
        for (j, s) in input.iter().enumerate() {
            let sum = s.iter().filter(|s| (1 << (*s - 1)) & i != 0).count();
            if sum % 2 != p[j] as usize {
                on = false;
            }
        }
        if on {
            result += 1;
        }
    }

    println!("{}", result);
}


Measured memory_bytes: 2172
#include <cmath>
#include <string>
#include <vector>
#include <iomanip>
#include <iostream>
#include <algorithm>
#include <functional>
#pragma warning(disable : 4996)
using namespace std;
int N, K, p[200009], bit[200009]; long long a[200009];
int main() {
	scanf("%d %d", &N, &K);
	for (int i = 0; i < N; i++) scanf("%lld", &a[i + 1]), a[i + 1] += a[i] - K, p[i + 1] = i + 1;
	sort(p, p + N + 1, [](int i, int j) { return a[i] != a[j] ? a[i] < a[j] : i < j; });
	long long ret = 0;
	for (int i = 0; i <= N; i++) {
		for (int j = p[i]; j >= 1; j -= j & (-j)) ret += bit[j];
		for (int j = p[i] + 1; j <= N; j += j & (-j)) bit[j]++;
	}
	printf("%lld\n", ret);
	return 0;
}

Measured memory_bytes: 3456
#include<bits/stdc++.h>
using namespace std;
using ll = int64_t;
using P = pair<ll, ll>;
const ll INF = 5e15;
int main(){
    ll N;
    cin >> N;
    vector<ll> V(N);
    map<ll, ll> ma;
    for(ll i = 0; i < N; i++){
        cin >> V[i];
        ma[V[i]]++;
    }
    sort(V.begin(), V.end());
    reverse(V.begin(), V.end());
    vector<ll> pows;
    for(ll i = 0; (1ll << i) <= 2e9; i++) pows.push_back(1ll << i);
    reverse(pows.begin(), pows.end());
    ll ans = 0;
    for(ll u : V){
        if(ma[u] == 0) continue;
        for(ll p : pows){
            if(p <= u) continue;
            if((u != p - u && ma[p - u] >= 1) || 
               (u == p - u && ma[p - u] >= 2)){
                ma[u]--;
                ma[p - u]--;
                ans++;
                break;
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 40192
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int K = scanner.nextInt();
        int sum = 0;
        int[] prices = new int[N];
        for (int i = 0; i < N; i++){
            prices[i] = scanner.nextInt();
        }
        Arrays.sort(prices);
        for (int i = 0; i < K; i++) {
            sum += prices[i];
        }
        System.out.println(sum);
        scanner.close();
    }
}


Measured memory_bytes: 38788
def calDistance(y,z)
    d = 0
    y.length.times do |i|
        d += (y[i].to_f-z[i].to_f)**2
    end
    Math.sqrt(d)
end
N,D = gets.split.map(&:to_i)
X = Array.new(N).map{Array.new(D)}
N.times do |i|
    X[i] = gets.split.map(&:to_i)
end
res = 0
[*0..(N-1)].combination(2).to_a.each_with_index do |z, index|
    d = calDistance(X[z[0]],X[z[1]])
    is_integer = d == d.to_i
    res += 1 if is_integer
end
puts res

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

int main() {
    int64_t n, a, b, c, d, e;
    cin >> n >> a >> b >> c >> d >> e;
    int64_t min_abcde = min(min(min(min(a,b),c),d),e);
    cout << 4+(n-1)/min_abcde+1 << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <climits>
#include <cmath>
#include <complex>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <iomanip>
#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 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;
}
class KMP
{
public:
    string pattern;
    int plen;
    vector<int> table;
    KMP(const string& s) : pattern(s), plen((int)pattern.size()), table(plen + 1){
        table[0] = -1;
        int j = -1;
        for(int i = 0; i < plen; ++i){
            while(j >= 0 && pattern[i] != pattern[j]){
                j = table[j];
            }
            table[i+1] = ++j;
        }
    }
    void search(const string& text, vector<int>& res){
        int head = 0, j = 0, tlen = (int)text.size();
        while(head + j < tlen){
            if(pattern[j] == text[head + j]) {
                if(++j == plen){
                    res.push_back(head);
                    head = head + j - table[j];
                    j = table[j];
                }
            }else{
                head = head + j - table[j];
                if(j) j = table[j];
            }
        }
    }
};
 
// 文字列 s[0, i] の最小周期の長さ
void minimum_cycle(const string& s, vector<int>& res){
	KMP kmp(s);
	res.resize((int)s.size());
	for(int i = 0; i < (int)s.size(); ++i){
		res[i] = i + 1 - kmp.table[i+1];
	}
}

int main(){
    string s;
    cin >> s;
    int n =  s.size();
    string t = s;
    reverse(all(t));
    bool flag = 1;
    rep(i,n){
        if(s[i]!=s[0]){
            flag = 0;
        }
    }    
    if(flag){
        cout << n << endl;
        cout << 1 << endl;
        return 0;
    }
    vector<int> res,res2;
    minimum_cycle(s,res);
    minimum_cycle(t,res2);
    reverse(all(res2));
    if(res[n-1]==n||n%res[n-1]!=0){
        cout << 1 << endl;
        cout << 1 << endl;
        return 0;
    }
    int sm = 0;
    for(int i=0;i<n-1;i++){
        if(res[i]==(i+1)||(i+1)%res[i]!=0){
            if(res2[i+1]==(n-1-i)||(n-1-i)%res2[i+1]!=0){
                sm++;
            }
        }
    }
    cout << 2 << endl;
    cout << sm << endl;
    return 0;
}

Measured memory_bytes: 7656
#include<cstdio>
#include<algorithm>
#include<functional>
#include<cstring>
using namespace std;
void func(long long,long long,int);
char s[11];
long long sum;
int len;
int main(void)
{
	long long nn;
	scanf("%s",s);
	len=strlen(s);
	nn=s[0]-'0';
	sum=0;
	func(0,nn,0);
	printf("%lld\n",sum);
	return 0;
}
void func(long long nsum,long long nn,int cnt)
{
	long long x;
	if(cnt==len-1)	{
		sum+=nsum+nn;
//		printf("sum=%lld\n",nsum+nn);
	}
	else {
		x=nn*10+s[cnt+1]-'0';
		func(nsum,x,cnt+1);
		x=s[cnt+1]-'0';
		func(nsum+nn,x,cnt+1);
	}
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;

string S, T;
int n, m, q, cnts[N], cntt[N];

int main() {
  ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
  cin >> S >> T;
  n = S.length();
  m = T.length();
  for (int i = 1; i <= n; ++i) cnts[i] = (cnts[i - 1] + ((S[i - 1] == 'A') ? 1 : 2)) % 3;
  for (int i = 1; i <= m; ++i) cntt[i] = (cntt[i - 1] + ((T[i - 1] == 'A') ? 1 : 2)) % 3;
  cin >> q;
  while (q--) {
    int a, b, c, d; cin >> a >> b >> c >> d;
    if ((cnts[b] - cnts[a - 1] + 3) % 3 == (cntt[d] - cntt[c - 1] + 3) % 3)
      cout << "YES\n";
    else
      cout << "NO\n";
  }
  return 0;
}

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

int main(){
    int n;
    cin >> n;
    vector<string> a(n);
    map<string, int> mp;
    int i;
    for(i = 0; i < n; i++){
        cin >> a.at(i);
    }
    for(auto x : a){
        mp[x]++;
    }
    int max = 0;
    for(auto x : mp){
        if(x.second > max){
            max = x.second;
        }
    }
    for(auto x : mp){
        if(x.second == max){
            cout << x.first << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 26752
import sys
from itertools import accumulate
readline = sys.stdin.readline

def accumulate2d(X):
    N = len(X)
    M = len(X[0])
    
    for i in range(1, N):
        for j in range(1, M):
            X[i][j] += X[i][j-1]
    
    for j in range(1, M):
        for i in range(1, N):
            X[i][j] += X[i-1][j]
    
    return X
    

N, M, Q = map(int, readline().split())
G = [[0]*(M+2)] + [[0] + list(map(int, readline().strip())) + [0] for _ in range(N)] + [[0]*(M+2)]
U = [[0]*(M+2) for _ in range(N+2)]
L = [[0]*(M+2) for _ in range(N+2)]
for i in range(1, N+1):
    for j in range(1, M+1):
        if G[i][j]:
            if G[i-1][j]:
                U[i][j] += 1
            if G[i][j-1]:
                L[i][j] += 1
G = accumulate2d(G)
L = accumulate2d(L)
U = accumulate2d(U)
Ans = [None]*Q 
for qu in range(Q):
    x1, y1, x2, y2 = map(int, readline().split())
    u = U[x1][y1-1] + U[x2][y2] - U[x1][y2] - U[x2][y1-1]
    l = L[x1-1][y1] + L[x2][y2] - L[x1-1][y2] - L[x2][y1]
    g = G[x1-1][y1-1] + G[x2][y2] - G[x1-1][y2] - G[x2][y1-1]
    Ans[qu] = g - u - l
print('\n'.join(map(str, Ans)))

Measured memory_bytes: 166536
#include <iostream>
#include <stdio.h>
#include <fstream>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <limits.h>
#include <math.h>
#include <functional>
#include <bitset>
#include <iomanip>

#define repeat(i,n) for (long long i = 0; (i) < (n); ++ (i))
#define debug(x) cerr << #x << ": " << x << '\n'
#define debugArray(x,n) for(long long i = 0; (i) < (n); ++ (i)) cerr << #x << "[" << i << "]: " << x[i] << '\n'
#define debugArrayP(x,n) for(long long i = 0; (i) < (n); ++ (i)) cerr << #x << "[" << i << "]: " << x[i].first<< " " << x[i].second << '\n'

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> Pii;
typedef vector<int> vint;
typedef vector<ll> vll;
const ll INF = INT_MAX;
const ll MOD = 1e9+7;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;cin>>N;
  int ans;
  for(ans=1;ans*ans<=N;ans++);
  ans--;
  ans *= ans;
  cout << ans << endl;
  return 0;
}


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

int main(){
    
    int i = 0, num[26] = {0};
    char c;
    
    while(scanf("%c", &c) != EOF){
        if((c >= 65) && (c <= 90)){
            num[(c - 65)]++;
        } else if((c >= 97) && (c <= 122)){
            num[c - 97]++;
        }
        i++;
    }
    
    for(i = 0; i < 26; i++){
        printf("%c : %d\n", i + 97, num[i]);
    }
    
    return 0;
}

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

count = 0
for i in range(n):
    if a[i] <= b[i]:
        count += a[i]
        b[i] -= a[i]
        a[i] = 0
    else:
        count += b[i]
        a[i] -= b[i]
        b[i] = 0

    if a[i+1] <= b[i]:
        count += a[i+1]
        b[i] -= a[i+1]
        a[i+1] = 0
    else:
        count += b[i]
        a[i+1] -= b[i]
        b[i] = 0

print(count)


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

int main(){
    int n,m;
    cin >> n >> m;
    vector<int> p(m);
    vector<int> ac(n);
    vector<int> wa(n);
    rep(i,n){
        ac[i]=0;
        wa[i]=0;
    }
    rep(i,m){
        string s;
        cin >> p[i] >> s;
        if (s=="AC"){
            if (ac[p[i]-1]==0) ac[p[i]-1]++;
        }
        else{
            if(ac[p[i]-1]==0) wa[p[i]-1]++;
        }
    }

    int num_ac=0,num_wa=0;

    rep(i,n){
        num_ac+=ac[i];
        if(ac[i]==1) num_wa+=wa[i];
    }


    cout << num_ac << " " <<num_wa << endl;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
#define RALL(c) rbegin(c),rend(c)
typedef long long llong;
using vi = vector<int>;

int main() {
	int flag = 0;
	int ans = 0;
	int N, M, X, Y;
	cin >> N >> M >> X >> Y;
	vi x(N);
	vi y(M);

	for (int i = 0; i < N; i++) cin >> x[i];
	for (int i = 0; i < M; i++) cin >> y[i];

	for (int z = X + 1; z <= Y; z++) {
		int flag = 0;
		for (int i = 0; i < N; i++) {
			if (x[i] >= z) flag = 1;
		}

		if (flag == 1) continue;

		for (int i = 0; i < M; i++) {
			if (y[i] < z) flag = 1;
		}
		if (flag == 1) continue;
		cout << "No War" << endl;
		return 0;
	}
	cout << "War" << endl;
}

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

int main() {
  ll n, x, t;
  cin >> n >> x >> t;
  ll i = 0;
  while (true) {
    if (n <= x * i) {
      cout << i * t << endl;
      return 0;
    }
    ++i;
  }
}


Measured memory_bytes: 3632
package main

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

func print(a, b int) {
	if a < b {
		fmt.Println("a < b")
	} else if a > b {
		fmt.Println("a > b")
	} else {
		fmt.Println("a == b")
	}
}

func nextInt(sc *bufio.Scanner) int {
	sc.Scan()
	num, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(1)
	}
	return num
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	a := nextInt(scanner)
	b := nextInt(scanner)
	print(a, b)
}



Measured memory_bytes: 1084
def slove():
    import sys
    import collections
    input = sys.stdin.readline
    n, m = list(map(int, input().rstrip('\n').split()))
    d = collections.defaultdict(int)
    for i in range(m):
        d[int(input().rstrip('\n'))]
    dp = [0] * (n + 1)
    dp[0] = 1 if 0 not in d else 0
    dp[1] = 1 if 1 not in d else 0
    for i in range(2, len(dp)):
        dp[i] = (dp[i-1] + dp[i-2]) % (1000000007) if i not in d else 0
    print(dp[-1])


if __name__ == '__main__':
    slove()


Measured memory_bytes: 50136
#include <iostream>

using namespace std;

void solve()
{
	int W, H, x, y, r;
	cin >> W >> H >> x >> y >> r;
	bool flag = false;
	if (0 <= x - r && x - r <= W && 0 <= x + r && x + r <= W && 
		0 <= y - r && y - r <= H && 0 <= y + r && y + r <= H)
	{
		flag = true;
	}
	if (flag)
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}
}

int main()
{
	solve();
	return(0);
}

Measured memory_bytes: 1156
import java.util.Scanner;


public class Main
{
	public static void main(String[] args)
	{
		Scanner scanner = new Scanner(System.in);
		
		for(; scanner.hasNext();)
		{
			int w = scanner.nextInt();
			int wsum = 0;
			
			for(int i=0; (i<10 || w>0); i++,w/=2)
			{
				if(w%2 == 1)
				{
					System.out.print((int)Math.pow(2, i));
					if(w/2 > 0)
					{
						System.out.print(" ");
					}
				}				
			}
			System.out.println("");
		}
	}
}

Measured memory_bytes: 26060
//↓template↓

#include "bits/stdc++.h"
using namespace std;
#define Would
#define you
#define all(n)  n.begin(),n.end()
#define rall(n) n.rbegin(),n.rend()
typedef long long ll;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;
const double pi = acos(-1);
const ll SIZE = 1 << 17;
int dx[] = { 1,0,-1,0 }, dy[] = { 0,1,0,-1 }, alp[30];
ll fac[200005], finv[200005], inv[200005];
vector<ll>dij;
struct edge { ll to, cost; };
vector<vector<edge> >G;

ll mod_pow(ll a, ll b) {
	ll res = 1, mul = a;
	for (int i = 0; i < 31; ++i) {
		if (b >> i & 1) {
			res *= mul;
			res %= MOD;
		}
		mul = (mul * mul) % MOD;
	}

	return res;
}

void addedge(int from, int to, int cost) {
	G[from].push_back({ to,cost });
	G[to].push_back({ from,cost });
}


template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }

template<typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
	return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}

template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T &t, const V &v) { t = v; }

template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T &t, const V &v) {
	for (auto &e : t) fill_v(e, v);
}

template<typename T>
void outp(vector<T>v) {
	for (int i = 0; i < v.size(); ++i) {
		cout << v[i];
		if (i != v.size() - 1) { cout << " "; }
	}
}

//↑template↑


/*int main() {



ll n;
cin >> n;
vector<pair<long double, pair<long double, long double>>>v(n);
for (int i = 0; i < n; ++i) {
cin >> v[i].second.first >> v[i].second.second;
v[i].first = (long double)(v[i].second.second / v[i].second.first);
}
sort(all(v));

ll time = 0;

for (auto i : v) { cout << i.first << endl; }
for (int i = 0; i < v.size(); ++i) {
time += v[i].second.first;
if (time > v[i].second.second) { cout << "No" << endl; return 0; }
}

cout << "Yes" << endl;
}
*/



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

	ll ans = 0, anss = INF, mon = 0, ansss;
	for (int i = 1; i <= a; ++i) {
		ans += b + i - 1;
	}

	for (int i = 1; i <= a; ++i) {
		mon = 0;
		for (int j = 1; j <= a; ++j) {
			if (i != j) { mon += (b + j - 1); }
		}
		if (anss > abs(ans - mon)) {
			ansss = mon;
			anss = abs(ans - mon);
		}
	}

	cout << ansss << endl;
}

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

int main()
{
    string s;
    cin >> s;
    int one = 0;
    int zero = 0;
    for(int i=0; i<s.size(); i++){
        if(s[i] == '0'){
            one++;
        }else{
            zero++;
        }
    }
    cout << s.size() - abs(one-zero)<< endl;
    return 0;
}


Measured memory_bytes: 512
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define reps(i, n) for (int i = 1; i <= (n); ++i)
#define repd(i, n) for (int i = (n)-1; i >= 0; --i)
#define repds(i, n) for (int i = (n); i > 0; --i)
#define loop(i, x, n) for (int i = (x); i < (n); ++i)
#define loops(i, x, n) for (int i = (x); i <= (n); ++i)
#define loopd(i, x, n) for (int i = (x); i > (n); --i)
#define loopds(i, x, n) for (int i = (x); i >= (n); --i)
#define itrep(i, a) for (auto i = begin(a); i != end(a); ++i)
#define itrepd(i, a) for (auto i = rbegin(a); i != rend(a); ++i)
#define each(i, x) for (auto &&i : x)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(a) ((int)a.size())
#define pow2(n) (n * n)
// #define int ll
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
template <class T>
using priority_queuel = priority_queue<T, vector<T>, greater<T>>;
constexpr ll inf = static_cast<ll>(1e18);
constexpr int iinf = static_cast<int>(1e9);
constexpr double dinf = 1e10;
constexpr ld ldinf = 1e18;
constexpr double eps = 1e-9;
ll mod = static_cast<ll>(1e9 + 7);
template <class T, class... Args>
constexpr void mins(T &a, Args... args) { a = min<T>({a, args...}); }
template <class T, class... Args>
constexpr void maxs(T &a, Args... args) { a = max<T>({a, args...}); }
template <class F>
class FixPoint : private F {
public:
    explicit constexpr FixPoint(F &&f) : F(std::forward<F>(f)) {}
    template <class... Args>
    constexpr decltype(auto) operator()(Args &&... args) const { return F::operator()(*this, std::forward<Args>(args)...); }
};
template <class F>
constexpr decltype(auto) funcs(F &&f) { return FixPoint<F>{std::forward<F>(f)}; }
template <class T>
std::vector<T> vecs(int n, T &&val) { return std::vector<T>(std::forward<int>(n), std::forward<T>(val)); }
template <class... Args>
decltype(auto) vecs(int n, Args &&... args) { return std::vector<decltype(vecs(std::forward<Args>(args)...))>(std::forward<int>(n), vecs(std::forward<Args>(args)...)); }
template <class V, class T>
void fill(V &x, const T &val) { x = val; }
template <class V, class T>
void fill(vector<V> &vec, const T &val) {
    for (auto &&v : vec)
        fill(v, val);
}

void solve() {
    int n;
    cin>>n;
    if(n%10==2||n%10==4||n%10==5||n%10==7||n%10==9) cout<<"hon"<<endl;
    else if(n%10==0||n%10==1||n%10==6||n%10==8) cout<<"pon"<<endl;
    else
        cout << "bon" << endl;
}

signed main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
    cout.flush();
    return 0;
}

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

using namespace std;

const int Nmax = 1e5+5;
int i, n, a[Nmax];
long long s[Nmax];

int main()
{
    cin >> n;
    for(i=1; i<=n; ++i) cin >> a[i];
    sort(a+1, a+n+1);
    for(i=1; i<=n; ++i) s[i] = s[i-1] + a[i];

    for(i=n; i; --i)
        if(a[i] > 2*s[i-1]) break;

    cout << n-i+1 << '\n';

    return 0;
}


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

int main(){
  int a,b,c;
  int count=0;

  cin >> a >> b >> c;

  for (int i = a;i<=b;i++){
    if (c % i == 0)
      count += 1;
  }

  cout << count << "\n";
  
  return 0;
}



Measured memory_bytes: 3136