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

using namespace std;

int main()
{

    int k;
    scanf("%d", &k);

    int cnt = 0;

    for(int i = 1; i <= k; i++)
    {
        if(i % 2 == 0)
        {
            for(int j = 1 ; j <= k; j++)
            {
                if(j % 2 == 1)
                    cnt++;

            }
        }
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define mod 1000000007ll
using namespace std;
ll fact[2000006];
ll bigmod(ll b, ll p)
{
    if(!p)return 1ll;
    ll ret= bigmod(b, p/2);
    ret= (ret*ret)%mod;
    if(p&1ll)return ret= (ret*b)%mod;
    return ret;
}
ll ncr(ll n, ll r)
{
    ll nume= fact[n];
    ll deno= (fact[n-r]*fact[r])%mod;
    return (nume*bigmod(deno, mod-2))%mod;
}
int main()
{
    fact[0]= 1ll;
    for(ll i=1; i<=2000000; i++)
    fact[i]= (fact[i-1]*i)%mod;
    int n, m, cnt= 0;
    scanf("%d %d", &n, &m);
    if(n<m)swap(n, m);
    int tot= (n+m)/3;
    while(n>0 && m>0 && 2*n>m)n--, n--, m--, cnt++;
    if(2*n==m)printf("%lld\n", ncr(tot, cnt));
    else puts("0");
    return 0;
}


Measured memory_bytes: 15872
n,m = map(int,input().split())
h = list(map(int,input().split()))
a = [0]*m
b = [0]*m
for i in range(m):
    a[i],b[i] = map(int,input().split())
sw = [1]*n
for i in range(m):
    if h[a[i]-1] > h[b[i]-1]:
        sw[b[i]-1] = 0
    elif h[a[i]-1] < h[b[i]-1]:
        sw[a[i]-1] = 0
    else:
        sw[a[i]-1] = 0
        sw[b[i]-1] = 0
print(sw.count(1))

Measured memory_bytes: 21844
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <iomanip>
#include <queue>
#include <deque>
#include <map>
#include <unordered_map>
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define repr(e,x) for(auto& e:x)
using namespace std;
typedef long long ll;

int N,K;

int main(){
    cin>>N>>K;
    
    ll ans=0;
    repn(b,N){
        ans+=N/b*max(0,b-K);
        ans+=max(0,N%b-K+1);
    }
    if(K==0) ans-=N;

    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, a, n) for(ll i = (ll)a; i < (ll)n; i++)
#define FORR(i, n) for(ll i = (ll)n - 1LL; i >= 0LL; i--)
#define rep(i, n) FOR(i, 0, n)
#define ALL(x) begin(x), end(x)
using namespace std;
using ll = long long;
constexpr ll Mod = 998244353;
constexpr ll mod = 1e9 + 7;
constexpr ll inf = 1LL << 60;
const double PI = acos(-1);
template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) {
    return a < b && (a = b, true);
}
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) {
    return a > b && (a = b, true);
}
/*-------------------------------------------*/

int D;
int c[26];
ll s[365][26];

int last[26];

set<int> st[26];
vector<int> ans;

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

    srand((unsigned)time(NULL));

    rep(i, 26) st[i].insert(-1);

    cin >> D;
    rep(i, 26) cin >> c[i];
    rep(i, D) rep(j, 26) cin >> s[i][j];

    rep(d, D) {
        ll a = -1, mx = -1;
        rep(i, 26) if(chmax(mx, (d - *st[i].rbegin()) * c[i] + s[d][i])) a = i;
        ans.push_back(a);
        st[a].insert(d);
    }

    rep(i, 26) st[i].insert(D);

    while(clock() < CLOCKS_PER_SEC * 1.9) {
        int x = rand() % D;
        ll a = -1, mx = -inf;
        rep(i, 26) {
            auto it1 = st[i].upper_bound(x);
            auto it2 = st[i].lower_bound(x);
            it2--;
            ll y = s[x][i] + (*it1 - *it2) * (*it1 - *it2 - 1) / 2 * c[i];
            y -= (*it1 - x) * c[i];
            y -= (x - *it2) * c[i];
            if(chmax(mx, y)) a = i;
        }
        if(ans[x] != a) {
            st[a].insert(x);
            st[ans[x]].erase(x);
            ans[x] = a;
        }
    }

    rep(i, D) cout << ans[i] + 1 << endl;

    return 0;
}

Measured memory_bytes: 3752
#include<bits/stdc++.h>
using namespace std;
int A,B;
char t[100];
void solve(int a,int b){
  if(a>A||b>B)return;
  if(a==A&&b==B){
    t[a+b]='\0';
    printf("%s\n",t);
    return;
  }
  if(a==5&&b<=3)return;
  if(b==5&&a<=3)return;
  if(a==6&&b==4)return;
  if(b==6&&a==4)return;

  t[a+b]='A';
  solve(a+1,b);
  t[a+b]='B';
  solve(a,b+1);
}
int main(){
  cin>>A>>B;
  solve(0,0);
}


Measured memory_bytes: 3104
#include<stdio.h>
#include<string.h>
int main(){
	int n,i,list[5]={0};
	char str[10];
	for(;scanf("%d,%s\n",&n,str)!=EOF;){
		if(strcmp(str,"B")==0)list[1]++;
		else if(strcmp(str,"O")==0)list[3]++;
		else if(strcmp(str,"AB")==0)list[2]++;
		else if(strcmp(str,"A")==0)list[0]++;
	}
	for(i=0;i<4;i++)printf("%d\n",list[i]);
	return 0;
}

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

using namespace std;

typedef long long ll;
const ll INF = 1LL<<60;

ll gcd(ll a, ll b) {
  if(b == 0) return a;
  return gcd(b, a % b);
}

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; }

ll modpow(ll a, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}

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

  vector<int> kake(50001);

  int N;
  cin >> N;
  
  for(int i = 1; i < 50001; i++){
    kake[i] = int(floor(double(i) * 1.08));
  }

  // for(int i = 1000; i < 2000; i=i+87){
  //   cout << i << " " << kake[i] << endl;
  // }

  int ans = -1;
  for(int i = 1; i < 50001; i++){
    if(N == kake[i]){
      ans = i;
    }
  }

  if(ans==-1){
    cout << ":(" << endl;
  }else{
    cout << ans << endl;    
  }
  
  return 0;
}


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

unsigned long long popcount(unsigned long long x) {
    x = ((x & 0xaaaaaaaaaaaaaaaaUL) >> 1) +
        (x & 0x5555555555555555UL);
    x = ((x & 0xccccccccccccccccUL) >> 2) +
        (x & 0x3333333333333333UL);
    x = ((x & 0xf0f0f0f0f0f0f0f0UL) >> 4) +
        (x & 0x0f0f0f0f0f0f0f0fUL);
    x = ((x & 0xff00ff00ff00ff00UL) >> 8) +
        (x & 0x00ff00ff00ff00ffUL);
    x = ((x & 0xffff0000ffff0000UL) >> 16) +
        (x & 0x0000ffff0000ffffUL);
    x = ((x & 0xffffffff00000000UL) >> 32) +
        (x & 0x00000000ffffffffUL);
    return x;
}

long long n, a, b;
vector<long long> ans;

vector<long long> solve(long long st, long long fin, long long rem);

int main(){
    cin >> n >> a >> b;
    if(popcount(a^b)%2) {
        ans = solve(0, a ^ b, (1LL << n) - 1);
        cout << "YES" << endl;
        for(int i = 0;i < ans.size();++i){
            if(i != 0)cout << " ";
            cout << (ans[i] ^ a);
        }
    }
    else cout << "NO" << endl;
    return 0;
}

vector<long long> solve(long long st, long long fin,long long rem){
    vector<long long> now,nowans;
    long long nowsize = 0;
    if(popcount(rem) == 1){
        nowans.push_back(st);
        nowans.push_back(fin);
        return nowans;
    }
    for(int i = 0;i < n;++i)
        if(((st ^ fin) >> i) & (rem >> i) & 1){
            for(int j = 0;j < n;++j)
                if(i != j && (rem >> j) & 1){
                    long long med = st ^ (1 << j);
                    nowans = solve(st,med,rem - (1 << i));
                    now = solve(med ^ (1 << i),fin,rem - (1 << i));
                    nowsize = now.size();
                    for(int k = 0;k < nowsize;++k)nowans.push_back(now[k]);
                    break;
                }
            break;
        }
    return nowans;
}


Measured memory_bytes: 2288
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#include<unordered_map>
using namespace std;
//<DEFINE>
void Fast() {
	ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
}
void File() {
#ifndef ONLINE_JUDGE
	freopen("Input.txt", "r", stdin);
	freopen("Output.txt", "w", stdout);
#endif
}
#ifdef _MSC_VER
#include <intrin.h>
#define __builtin_popcount __popcnt
#ifdef _WIN64
#define __builtin_popcountll __popcnt64
#else
inline int __builtin_popcountll(__int64 a) {
	return __builtin_popcount((unsigned int)a) + __builtin_popcount(a >> 32);
}
#endif
#endif
using ll = long long;
using ull = unsigned long long;
#define mod 1000000007
ll gcd(ll a, ll b) {
	return!b ? a : gcd(b, a % b);
}
#define fix(n) cout << fixed << setprecision(n);
#define all(a) a.begin(), a.end()
#define skip continue
#define stop(n) return cout<<n,0
#define pi  acos(-1)
#define endl "\n"
#define ceil(x,y) (x+y-1)/y//be careful from the multiplication while using this define 
#define TC int t;cin>>t;while(t--)
//</DEFINE>
//<FUNCTIONS>
//</FUNCTIONS>	
int main() {
	Fast();
	int n, cpcty;
	cin >> n >> cpcty;
	vector<vector<ll>>dp(n, vector<ll>(cpcty + 1));
	vector<pair<ll, ll>>v(n);
	for (int i = 0; i < n; i++)cin >> v[i].first >> v[i].second;
	for (int i = v[n - 1].first; i <= cpcty; i++)dp[n - 1][i] = v[n - 1].second;
	for (int i = n - 2; i >= 0; i--) {
		for (int j = 1; j <= cpcty; j++) {
			if (j >= v[i].first)dp[i][j] = max(dp[i + 1][j - v[i].first] + v[i].second, dp[i + 1][j]);
			else dp[i][j] = dp[i + 1][j];
		}
	}
	cout << dp[0][cpcty] << endl;
}

Measured memory_bytes: 82380
#include<iostream>
using namespace std;
int main(){
  long int n,m,sum=0;
  cin>>n>>m;
  long int arr[m];
  for(int i=0;i<m;i++){
    cin>>arr[i];
    sum+=arr[i];
  }
  if(sum==n){
    cout<<"0";
  }
  else if(sum<n){
    cout<<n-sum;
  }
  else
    cout<<"-1";
  return 0;
}

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

using namespace std;

//#define int long long
#define INF 1e9
#define LINF 1e18

const int MOD = 1e9 + 7;
const int dy[]={0, 0, 1, -1};
const int dx[]={1, -1, 0, 0};

typedef pair<int, int> P;
typedef pair<P, int> Pi;
typedef pair<P, P> PP;

template <class T> void chmin(T& a, const T& b) { a = min(a, b); }
template <class T> void chmax(T& a, const T& b) { a = max(a, b); }

int N, C;
int D[31][31], c[500][500];
int cnt[3][31];

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

    cin >> N >> C;
    for(int i = 1; i <= C; ++i) for(int j = 1; j <= C; ++j) cin >> D[i][j];
    for(int i = 0; i < N; ++i) for(int j = 0; j < N; ++j) cin >> c[i][j];
    for(int k = 1; k <= C; ++k) {
        for(int i = 0; i < N; ++i) for(int j = 0; j < N; ++j) {
                if(c[i][j] != k) cnt[(i + j + 2) % 3][k] += D[c[i][j]][k];
        }
    }
    int res = INF;
    for(int i = 1; i <= C; ++i) {
        for(int j = 1; j <= C; ++j) {
            if(i == j) continue;
            for(int k = 1; k <= C; ++k) {
                if(i == k || j == k) continue;
                chmin(res, cnt[0][i] + cnt[1][j] + cnt[2][k]);
            }
        }
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 1788
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<vector>
using namespace std;
typedef pair<int,int>P;
int F(P a,P b){return abs(a.first-b.first)+abs(a.second-b.second);}
int main()
{
    int w,h,i,j,k,n,c;
    char s[9];
    vector<P>p[2502];
    vector<int>d[2502];
    P g;
    while(scanf("%d%d",&w,&h),w)
    {
        for(n=i=0;i<2502;++i)p[i].clear();
        for(i=0;i<h;++i)for(j=0;j<w;++j)
        {
            scanf("%s",s);
            if(*s=='S')p[0].push_back(P(j,i));
            else if(*s=='G')g=P(j,i);
            else if(*s!='.')
            {
                c=atoi(s);
                if(n<c)n=c;
                p[c].push_back(P(j,i));
            }
        }
        p[n+1].push_back(g);
        n+=2;
        for(i=0;i<n;++i)
        {
            d[i].resize(c=p[i].size());
            for(j=0;j<c;++j)d[i][j]=(1<<30);
        }
        d[0][0]=0;
        for(i=1;i<n;++i)
            for(j=0;j<d[i-1].size();++j)
                for(k=0;k<d[i].size();++k)
                    d[i][k]=min(d[i][k],d[i-1][j]+F(p[i-1][j],p[i][k]));
        printf("%d\n",d[n-1][0]);
    }
    return 0;
}

Measured memory_bytes: 1420
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	long int n,i,j,k,sum=0;
	cin>>n;
	for(i=1;i<=n;i++)
	{
		for(j=1;j<=n;j++)
		{
			long int m=__gcd(i,j);
			for(k=1;k<=n;k++)
			{
				sum=sum+__gcd(m,k);
			}
		}
	}
	cout<<sum;
}

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

using namespace std;

#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define DEBUG_MAT(v) cerr<<#v<<endl;for(int i=0;i<v.size();i++){for(int j=0;j<v[i].size();j++) {cerr<<v[i][j]<<" ";}cerr<<endl;}


typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(n);i>0;i--)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.end()
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 (a>b) { a = b; return 1; } return 0; }
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
const ll inf = 1000000001;
const ll INF = (ll)1e18 + 1;
const ll MOD = 1000000007;
//const ll MOD = 998244353;
const double pi = 3.14159265358979323846;
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx[4] = { 1,0, -1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);
//#define mp make_pair

void add(set<vector<pii> > &st, vector<pii> ori) {
  st.insert(ori);
  rep (aaa, 3) {
    rep (j, ori.size()) {
      if (ori[j].first != 0) {
        swap(ori[j].first, ori[j].second);
      }
      else {
        swap(ori[j].first, ori[j].second);
        ori[j].first *= -1;
      }
    }
    st.insert(ori);
  }
}

int main() {
  while (true) {
    int n;
    cin >> n;
    if (n == 0) return 0;

    vector<pii> ori;
    vi ans;
    set<vector<pii> > st;
    rep (i, n + 1) {
      int m;
      cin >> m;
      pii now;
      cin >> now.first >> now.second;
      vector<pii> diff;
      rep (j, m - 1) {
        pii nex;
        cin >> nex.first >> nex.second;
        diff.push_back(nex - now);
        now = nex;
      }
      if (i == 0) {
        ori = diff;
        add(st, ori);
      }
      else {
        auto diff2 = diff;
        reverse(all(diff2));
        if (st.count(diff) || st.count(diff2)) {
          ans.push_back(i);
        }
      }
    }
    rep (i, ans.size()) cout << ans[i] << endl;
    cout << "+++++" << endl;
  }
}



Measured memory_bytes: 3056
import java.util.Scanner;

/**
 *
 * @author k16075kk
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in)) {
            while (true) {
                int m = sc.nextInt(), f = sc.nextInt(), r = sc.nextInt();
                if (m == -1 && f == -1 && r == -1) {
                    break;
                }
                if (m == -1 || f == -1) {
                    System.out.println("F");
                } else if (m + f >= 80) {
                    System.out.println("A");
                } else if (m + f >= 65) {
                    System.out.println("B");
                } else if (m + f >= 50) {
                    System.out.println("C");
                } else if (m + f >= 30) {
                    if (r >= 50) {
                        System.out.println("C");
                    } else {
                        System.out.println("D");
                    }
                } else {
                    System.out.println("F");
                }
            }
        }
    }
}


Measured memory_bytes: 26288
#include <bits/stdc++.h>
 using namespace std;
 using pii = pair<int, int>;
 using ll = long long;
 #define rep(i, j, n) for(int i = j; i < (int)(n); i++)
 const ll MOD = 1000000007;
 const ll INFL = (1LL << 60);
 const int INFI = (1 << 30);

 struct UnionFind {
     vector<int> par;

     UnionFind(int n) : par(n, -1) { }
     void init(int n) { par.assign(n, -1); }

     int root(int x) {
         if (par[x] < 0) return x;
         else return par[x] = root(par[x]);
     }

     bool issame(int x, int y) {
         return root(x) == root(y);
     }

     bool merge(int x, int y) {
         x = root(x); y = root(y);
         if (x == y) return false;
         if (par[x] > par[y]) swap(x, y); // merge technique
         par[x] += par[y];
         par[y] = x;
         return true;
     }

     int size(int x) {
         return -par[root(x)];
     }
 };

 int main() {
     ll N, M; cin >> N >> M;
     vector<int> A(M), B(M);
     for (int i = 0; i < M; ++i) {
         cin >> A[i] >> B[i];
         A[i]--;
         B[i]--;
     }

     UnionFind uf(N);
     ll cur = N * (N-1) / 2;
     vector<ll> res;
     for (int i = 0; i < M; ++i) {
         res.push_back(cur);
         int a = A[M-1-i], b = B[M-1-i];
         if (uf.issame(a, b)) continue;

         ll sa = uf.size(a), sb = uf.size(b);
         cur -= sa * sb;
         uf.merge(a, b);
     }
         
     reverse(res.begin(), res.end());
     for (int i = 0; i < res.size(); ++i) cout << res[i] <<endl;
 }


Measured memory_bytes: 3444
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import collections

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

d = collections.deque()
def LI(): return list(map(int, sys.stdin.readline().split()))

N, K = LI()
ans = 0
tmp = 1
while tmp - 1 < N:
    tmp *= K
    ans += 1

print(ans)

Measured memory_bytes: 66156
n = int(input())
s = [input() for i in range(n)]
ac = s.count('AC')
wa = s.count('WA')
tle = s.count('TLE')
re = s.count('RE')
print('AC x ', ac)
print('WA x ', wa)
print('TLE x ', tle)
print('RE x ', re)

Measured memory_bytes: 16268
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define INF 1000000021
#define MOD 1000000007
#define pb push_back
#define sqr(a) (a)*(a)
#define M(a, b) make_pair(a,b)
#define F first
#define S second
#define all(x) (x.begin(), x.end())
#define deb(x) cerr << #x << " = " << x << '\n'
#define N 222222

using namespace std;
using namespace __gnu_pbds;

typedef long double ld;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;

const ld pi = 2 * acos(0.0);
template<class T> bool umin(T& a, T b){if(a>b){a=b;return 1;}return 0;}
template<class T> bool umax(T& a, T b){if(a<b){a=b;return 1;}return 0;}
template<class T, class TT> bool pal(T a, TT n){int k=0;for(int i=0;i<=n/2;i++){if(a[i]!=a[n-i-1]){k=1;break;}}return k?0:1;}

//int month[] = {0,31,28,31,30,31,30,31,31,30,31,30,31};

int main()
{
	int n;
	cin >> n;
	vll a(n + 2, 0 );
	ll mx = 0;
	for(int i = 1; i <= n; i ++)
	{
		cin >> a[i];
	}
	for(int i = 1; i <= n; i ++)
	for(int j = 1; j <= n; j ++)
		{
			if(i == j)
				continue;
			umax(mx, abs(a[i] - a[j]));
		}
	cout << mx;





	





	getchar();
	getchar();
	return 0;
	//ios::sync_with_stdio(false);
	//cin.tie(0);
}

Measured memory_bytes: 256
#include <iostream>

int main(void) {
  int a, b;
  int plus, minus, multiply;
  std::cin >> a;
  std::cin >> b;
  plus = a + b;
  minus = a - b;
  multiply = a * b;

  if (plus > minus && plus > multiply) {
    std::cout << plus << std::endl;
  } else if (minus > multiply) {
    std::cout << minus << std::endl;
  } else {
    std::cout << multiply << std::endl;
  }

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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<int MOD> struct ModInt {
    static const int Mod = MOD; unsigned x; ModInt() : x(0) { }
    ModInt(signed sig) { x = sig < 0 ? sig % MOD + MOD : sig % MOD; }
    ModInt(signed long long sig) { x = sig < 0 ? sig % MOD + MOD : sig % MOD; }
    int get() const { return (int)x; }
    ModInt &operator+=(ModInt that) { if ((x += that.x) >= MOD) x -= MOD; return *this; }
    ModInt &operator-=(ModInt that) { if ((x += MOD - that.x) >= MOD) x -= MOD; return *this; }
    ModInt &operator*=(ModInt that) { x = (unsigned long long)x * that.x % MOD; return *this; }
    ModInt &operator/=(ModInt that) { return *this *= that.inverse(); }
    ModInt operator+(ModInt that) const { return ModInt(*this) += that; }
    ModInt operator-(ModInt that) const { return ModInt(*this) -= that; }
    ModInt operator*(ModInt that) const { return ModInt(*this) *= that; }
    ModInt operator/(ModInt that) const { return ModInt(*this) /= that; }
    ModInt inverse() const { long long a = x, b = MOD, u = 1, v = 0;
        while (b) { long long t = a / b; a -= t * b; std::swap(a, b); u -= t * v; std::swap(u, v); }
        return ModInt(u); }
    bool operator==(ModInt that) const { return x == that.x; }
    bool operator!=(ModInt that) const { return x != that.x; }
    ModInt operator-() const { ModInt t; t.x = x == 0 ? 0 : Mod - x; return t; }
};
template<int MOD> ostream& operator<<(ostream& st, const ModInt<MOD> a) { st << a.get(); return st; };
template<int MOD> ModInt<MOD> operator^(ModInt<MOD> a, unsigned long long k) {
    ModInt<MOD> r = 1; while (k) { if (k & 1) r *= a; a *= a; k >>= 1; } return r; }
typedef ModInt<1000000007> mint;

const int MAX_H = 110, MAX_W = 10;

int main(){
    int H, W, K; cin >> H >> W >> K;
    mint ans = 0;

    mint dp[MAX_H][MAX_W] = {0};
    mint memo[MAX_W][2], count[MAX_W];
    memo[1][0] = 1;
    memo[1][1] = 0;
    count[0] = 1;
    count[1] = 1;
    for(int i = 2; i < MAX_W; i++){
        memo[i][0] = memo[i-1][0] + memo[i-1][1];
        memo[i][1] = memo[i-1][0];
        count[i] = memo[i][0] + memo[i][1];
    }

    dp[0][0] = 1;
    for(int i = 1; i <= H; i++){
        for(int j = 0; j < W; j++){
            dp[i][j] = dp[i-1][j] * count[W - 1 - j] * count[j];
            if(j - 1 >= 0)dp[i][j] += (dp[i-1][j-1]) * count[j-1] * count[W - 1 - j];
            if(j + 1 <  W)dp[i][j] += (dp[i-1][j+1]) * count[j] * count[W - j - 2];
        }
    }
    cout << dp[H][K - 1] << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main()
{
    int n, l;
    cin >> n >> l;
    vector<int> a(n);
    int sum = 0, mn = 300;
    rep(i, n){
        a[i] = l + i;
        sum += a[i];
        if(abs(a[i]) < abs(mn)) mn = a[i];
    }
    cout << sum - mn << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
//INSERT ABOVE HERE
Int dp[111][11111];
Int po[111];
const Int MOD = 1e9+7;
Int dfs(Int n,Int k,Int d){
  if(n==0) return 0;
  Int &res=dp[n][d];
  if(~res) return res;
  res=0;
  for(Int i=0;i<=k;i++){
    if(i<=n) res+=dfs(n-1,k,d+(d+i)/n)+((d+i)%n)*po[n-1];
    else res+=dfs(n-1,k,d)+(d+i)*po[n-1];
    res%=MOD;
  }
  //cout<<n<<" "<<d<<":"<<res<<endl;
  return res;
}
signed main(){
  Int n,k;
  cin>>n>>k;
  
  po[0]=1;
  for(Int i=0;i<n;i++) po[i+1]=po[i]*(k+1)%MOD;
  
  memset(dp,-1,sizeof(dp));
  cout<<dfs(n,k,0)<<endl;
  return 0;
}


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

int main() {
  int a,b,c,x,y; cin>>a>>b>>c>>x>>y;
  int ans=1e9;
  for(int i=0;i<=2*max(x,y);i++) {
    int cost=(max(x-i/2,0)*a)+(max(y-i/2,0)*b)+i*c;
    ans=min(ans,cost);
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(n);i++)
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
const ll INF=1e18;
const int MOD=1e9+7;
const double pi=acos(-1);


int main(){
  ll h,n;
  cin >> h >> n;
  rep(i,n){
    ll a;
    cin >> a;
    h-=a;
  }
  if(h>0)cout <<"No"<<endl;
  else cout<<"Yes"<<endl;
}


Measured memory_bytes: 256
n,x=map(int,input().split())
l=list(map(int,input().split()))
l.sort()
t=0
for i,a in enumerate(l):
    t+=a
    if(t>x):
        print(i)
        break
else:
    if(t==x):
        print(n)
    else:
        print(n-1)

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

int main() {
  int H, N;
  cin >> H >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++) cin >> A.at(i);
  long acc = accumulate(A.begin(), A.end(), 0L);
  cout << ((H <= acc) ? "Yes" : "No") << "\n";
}

Measured memory_bytes: 3728
#include<bits/stdc++.h>
using namespace std;
int x,y;
signed main()
{
	scanf("%d%d",&x,&y);
	int ans=0;
	if(x==1) ans+=300000;
	if(x==2) ans+=200000;
	if(x==3) ans+=100000;
	if(y==1) ans+=300000;
	if(y==2) ans+=200000;
	if(y==3) ans+=100000;
	if(x==1&&y==1) ans+=400000;
	printf("%d",ans);
	return 0;
}


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



#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = (int)(n-1); i >= 0; i--)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define all(x) (x).begin(),(x).end()

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; }

typedef long long ll;

using namespace std;


int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  vector<string>s={"SUN","MON","TUE","WED","THU","FRI","SAT"};
  string t;cin>>t;
  rep(i,7){
    if(t==s[i]){
      if(i==0){
        cout<<7<<endl;
      }
      else {
        cout<<7-i<<endl;
      }
    }
  }

  return 0;

}


Measured memory_bytes: 256
#include<iostream>
#include<vector>

int main(void){
    int n, k, d;
    std::cin >> n >> k;
    std::vector<int> snuflag(n);
    for(int i = 0; i < k; i++){
	std::cin >> d;
	int a;
	for(int j = 0; j < d; j++){
	    std::cin >> a;
	    a--;
	    if(snuflag[a] == 0) snuflag[a] = 1;
	}
    }

    int ans = 0;
    for(int i = 0; i < n; i++){
	if(snuflag[i] == 0){
	    ans++;
	}
    }
    std::cout << ans << std::endl;

    return 0;
}


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

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = std::int64_t;
using P = std::tuple<int,int>;

int N;
int H[150];
double dp[151][301];

double rec(int i, int y){
    if(i == N){
        return 0;
    }

    if(dp[i][y] != -1){
        return dp[i][y];
    }

    double S = 1e10;
    
    for(int ny=1;ny<=300;++ny){
        if(y <= H[i]){
            if(ny <= H[i]){
                S = std::min(S, 0.5 * (2 * H[i] - y - ny) + rec(i + 1, ny));
            }else{
                double p = 1.0 * (H[i] - y) / (ny - y);
                S = std::min(S, 0.5 * (p * (H[i] - y) + (1.0 - p) * (ny - H[i])) + rec(i + 1, ny));
            }
        }else{
            if(ny <= H[i]){
                double p = 1.0 * (y - H[i]) / (y - ny);
                S = std::min(S, 0.5 * (p * (y - H[i]) + (1.0 - p) * (H[i] - ny)) + rec(i + 1, ny));
            }else{
                S = std::min(S, 0.5 * (y + ny - 2 * H[i]) + rec(i + 1, ny));
            }
        }
    }

    return dp[i][y] = S;
}

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

    std::cin >> N;

    for(int i=0;i<N;++i){
        std::cin >> H[i];
    }

    std::fill(&dp[0][0], &dp[0][0] + 151 * 301, -1);

    double S = rec(0, 1);

    printf("%.10f\n", S);
}



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

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0), cout.tie(0);
	
	long long x, k, d;
	cin >> x >> k >> d;
	
	if (abs(x)/d >= k) cout << abs(x) - k*d;
	else {
		int y = k - abs(x)/d;
		cout << (y&1 ? d - abs(x)%d : abs(x)%d);
	}
}

Measured memory_bytes: 3660
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S;
  cin >> S;
  if ( S.at(0) == S.at(1) ) cout << "Bad" << endl;
  else if ( S.at(1) == S.at(2) ) cout << "Bad" << endl;
  else if ( S.at(2) == S.at(3) ) cout << "Bad" << endl;
  else cout << "Good" << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{

    int a, b;

    scanf("%d %d", &a, &b);

    if (a > b)
        printf("a > b\n");
    if (a < b)
        printf("a < b\n");
    if (a == b)
        printf("a == b\n");

    return 0;
}

Measured memory_bytes: 580
/********   All Required Header Files ********/
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
using namespace std;
// ****  All Required define Pre-Processors and typedef Constants *******/
#define mem(a, b) memset(a, (b), sizeof(a))
#define FOR(i, j, k, in) for (int i=j ; i<k ; i+=in)
#define RFOR(i, j, k, in) for (int i=j ; i>=k ; i-=in)
#define fl(i, j) FOR(i, 0, j, 1)
#define RREP(i, j) RFOR(i, j, 0, 1)

#define fi(it, l) for (auto it = l.begin(); it != l.end(); it++)

#define PB push_back
#define INF (int)1e9
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
const double pi=acos(-1.0);
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef map<int,int> dmap;
typedef set<int> dset;
typedef long int int32;
typedef unsigned long int uint32;
typedef long long int int64;
typedef unsigned long long int  uint64;
/********** solver function **********/
vector<int>xx={1,0}; vector<int>yy={0,1};
long long int dfs(int x, int y, vector<vector<char>>& grid, vector<vector<long long int>>&dp){
    if( x==grid.size()-1 && y==grid[0].size()-1) return 1;
    if( dp[x][y]!=-1) return dp[x][y];
   long long int ans=0;

    for( int i=0;i<2;i++){
        int r=x+xx[i];
        int c=y+yy[i];
        if( r>=grid.size() || c>=grid[0].size()) continue;
        if( grid[r][c]=='.'){
            ans= (ans%1000000007+dfs(r,c,grid, dp)%1000000007)%1000000007;
        }
    }
	return dp[x][y]= ans%1000000007;
}
/********** Main()  function **********/
int main()
{std::ios::sync_with_stdio(false);
	int r,c;
    cin>>r>>c;
    vector<vector<char> >grid(r, vector<char>(c));
    vector<vector<long long int>>dp(r+1,vector<long long int> ( c+1, -1));
    for( int i=0;i<r;i++){
        for( int j=0;j<c;j++)
        cin>>grid[i][j];
    }
    // queue<int> qx;
    // queue<int> qy;
    // qx.push(0);
    // qy.push(0);
    // int ans=1;
    // while( !qx.empty()){
    //     int row=qx.front();
    //     int col=qy.front();
    //     qx.pop(); qy.pop();
    //     if( row==r-1 && col==c-1) { break;}
    //     if( row+1<r && col+1<c) ans=(ans*2)%1000000007;
    //     if( row+1<r && col+1<c && grid[row+1][col]=='#' && )

    // }
    cout<<dfs(0,0,grid, dp)<<endl;
	return 0;
}

Measured memory_bytes: 11868
#include <bits/stdc++.h>
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = ((int)(n)-1); i >= 0; i--)
#define all(x) (x).begin(),(x).end()
 
using namespace std;
using ll = long long;
 
struct edge { int to, cost; };
 
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> P;
 
const int INF = 1e9;
const double EPS = 1e-10;
const int MOD = 1e9+7;
const double PI = acos(-1.0);

const int mx4[] = {0,1,0,-1};
const int my4[] = {1,0,-1,0};
const int mx8[] = {0,1,1,1,0,-1,-1,-1};
const int my8[] = {1,1,0,-1,-1,-1,0,1};

int main()
{
	int n;
	cin >> n;
	vi a(n+1),b(n);
	rep(i,n+1) cin >> a[i];
	rep(i,n) cin >> b[i];

	ll ans = 0,num;
	for(int i = 0; i < n; i++){
		num = min(a[i],b[i]);
		a[i] -= num;
		b[i] -= num;
		ans += num;
		if(b[i] > 0){
			num = min(a[i+1],b[i]);
			a[i+1] -= num;
			b[i] -= num;
			ans += num;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <queue>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using namespace std;

template<class T>
constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;

int main() {
    int n, k, q;
    cin >> n >> k >> q;
    vector<int> v(n);
    vector<pair<int, int>> p;
    for (int i = 0; i < n; ++i) {
        int x;
        cin >> x;
        v[i] = x;
        p.emplace_back(x, i);
    }
    sort(p.begin(), p.end());
    queue<pair<int, int>> Q;
    Q.emplace(0, n-1);
    int ans = INF<int>;
    for (int i = 0; i < n; ++i) {
        int sz = static_cast<int>(Q.size());
        int num, id;
        tie(num, id) = p[i];
        vector<int> mn;
        for (int j = 0; j < sz; ++j) {
            int a, b;
            tie(a, b) = Q.front(); Q.pop();
            if(a > b) continue;
            vector<int> u;
            for (int l = a; l <= b; ++l) {
                u.emplace_back(v[l]);
            }
            sort(u.begin(), u.end());
            for (int l = 0; l < (ll)b-a-k+2; ++l) {
                mn.emplace_back(u[l]);
            }
            if(a <= id && id <= b){
                Q.emplace(a, id-1);
                Q.emplace(id+1, b);
            }else Q.emplace(a, b);
        }
        if(mn.size() < q) break;
        sort(mn.begin(), mn.end());
        ans = min(ans, mn[q-1]-mn[0]);
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 256
from sys import stderr
from functools import reduce
from operator import add
import bisect
def f(): return [int(i) for i in input().split()]
def yes(n): print("Yes" if n else "No")
def debug(*x, sep=" ", end="\n"):
    for item in x:
        stderr.write(str(item))
        stderr.write(sep)
    stderr.write(end)

n = int(input())
a = sorted(f())
b = sorted(f())
c = sorted(f())
debug(a,b,c,sep='\n')
ans = 0

# 各bに対して、上に乗せられるaの数を予め求めておく(後のために累積和とする)
canRideOnB = [bisect.bisect_left(a, b[0])]
for middle in b[1:]:
    top = bisect.bisect_left(a, middle)
    canRideOnB.append(top+canRideOnB[-1])
debug(canRideOnB)

# 各cに対して、上に乗せられるbの範囲を求める
canRideOnC = []
for bottom in c:
    mid = bisect.bisect_left(b, bottom)
    canRideOnC.append(mid)
debug(canRideOnC)

# 以上の計算から答えを求める
for bot in canRideOnC:
    if bot == 0:
        pass
    else:
        ans += canRideOnB[bot-1]

print(ans)

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

int main()
{
  string s,left,right;
  int n,m;
  while(1){
    cin>>s;
    if(s=="-")break;
    cin>>n;
    for(int i=0;i<n;i++){
      cin>>m;
      left=s.substr(0,m);
      right=s.substr(m,s.length());
      s=right+left;
    }
    cout<<s<<endl;
  }
  return 0;
}

Measured memory_bytes: 1216
#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 a, b, c;
  cin >> a >> b >> c;
  int k;
  k=(c+0.5)/a;
  co(k*b);
  
  return 0;
}


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

using namespace std;

#define ll long long
#define endl '\n'
const int N = 1e6 + 5;
unordered_map<ll, ll> mem;
ll A, B, C, D;
ll DP(ll n){
        if (n == 0) return 0;
        if (n == 1) return D;
        if (mem.count(n)) return mem[n];
        ll res = 1e18;
        if (n < (res / D)) res = n * D;
        ll l2 = (n / 2) * 2;
        ll r2 = ((n + 1) / 2) * 2;
        ll l3 = (n / 3) * 3;
        ll r3 = ((n + 2) / 3) * 3;
        ll l5 = (n / 5) * 5;
        ll r5 = ((n + 4) / 5) * 5;
        res = min(res, llabs(n - l2) * D + A + DP(l2 / 2));
        res = min(res, llabs(n - r2) * D + A + DP(r2 / 2));
        res = min(res, llabs(n - l3) * D + B + DP(l3 / 3));
        res = min(res, llabs(n - r3) * D + B + DP(r3 / 3));
        res = min(res, llabs(n - l5) * D + C + DP(l5 / 5));
        res = min(res, llabs(n - r5) * D + C + DP(r5 / 5));
        return mem[n] = res;
}
int main(){
        ios_base::sync_with_stdio(false);
        cin.tie(0);
        if (fopen("BONUS.INP", "r")){
                freopen("BONUS.INP", "r", stdin);
                freopen("BONUS.OUT", "w", stdout);
        }
        ll t;
        cin >> t;
        while (t--){
                ll n;
                mem.clear();
                cin >> n >> A >> B >> C >> D;
                cout << DP(n) << endl;
        }
}


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

int main() {
  long long A, B, C;
  long K;
  cin >> A >> B >> C;
  cin >> K;

  long long ans = 0;
  if (C >= A && C >= B) ans = A + B + C * pow(2, K);
  else if (B >= A && B >= C) ans = A + C + B * pow(2, K);
  else if (A >= C && A >= B) ans = B + C + A * pow(2, K);

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
	    public static void main(String[] args){
	        Scanner sc = new Scanner(System.in);
	        int n = sc.nextInt();
	        String[] a = new String[n];
	        for (int i = 0;i<n;i++) {
	            a[i] = sc.next();
	        }
	        int max = 0;
	        Map<String, Integer> map = new HashMap<>();
	        for (String s : a) {
	            int count = map.getOrDefault(s, 0);
	            ++count;
	            map.put(s,count);
	            max = Math.max(max, count);
	        }
	        List<String> l = new ArrayList<>();
	        for (Map.Entry<String, Integer> e : map.entrySet()) {
	            if (max == e.getValue()) l.add(e.getKey());
	        }
	        Collections.sort(l);
	        for (String s : l) System.out.println(s);
	        sc.close();
	    }
}


Measured memory_bytes: 81892
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;
public static class P
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine());
        Console.WriteLine(Power(10, n) - 2 * Power(9, n) + Power(8, n));
    }

    static ModInt Power(ModInt n, long m)
    {
        ModInt pow = n;
        ModInt res = 1;
        while (m > 0)
        {
            if ((m & 1) == 1) res *= pow;
            pow *= pow;
            m >>= 1;
        }
        return res;
    }
}


struct ModInt
{
    public const int Mod = 1000000007;
    const long POSITIVIZER = ((long)Mod) << 31;
    long Data;
    public ModInt(long data) { if ((Data = data % Mod) < 0) Data += Mod; }
    public static implicit operator long(ModInt modInt) => modInt.Data;
    public static implicit operator ModInt(long val) => new ModInt(val);
    public static ModInt operator +(ModInt a, int b) => new ModInt() { Data = (a.Data + b + POSITIVIZER) % Mod };
    public static ModInt operator +(ModInt a, long b) => new ModInt(a.Data + b);
    public static ModInt operator +(ModInt a, ModInt b) { long res = a.Data + b.Data; return new ModInt() { Data = res >= Mod ? res - Mod : res }; }
    public static ModInt operator -(ModInt a, int b) => new ModInt() { Data = (a.Data - b + POSITIVIZER) % Mod };
    public static ModInt operator -(ModInt a, long b) => new ModInt(a.Data - b);
    public static ModInt operator -(ModInt a, ModInt b) { long res = a.Data - b.Data; return new ModInt() { Data = res < 0 ? res + Mod : res }; }
    public static ModInt operator *(ModInt a, int b) => new ModInt(a.Data * b);
    public static ModInt operator *(ModInt a, long b) => a * new ModInt(b);
    public static ModInt operator *(ModInt a, ModInt b) => new ModInt() { Data = a.Data * b.Data % Mod };
    public static ModInt operator /(ModInt a, ModInt b) => new ModInt() { Data = a.Data * GetInverse(b) % Mod };
    public static bool operator ==(ModInt a, ModInt b) => a.Data == b.Data;
    public static bool operator !=(ModInt a, ModInt b) => a.Data != b.Data;
    public override string ToString() => Data.ToString();
    public override bool Equals(object obj) => (ModInt)obj == this;
    public override int GetHashCode() => (int)Data;
    static long GetInverse(long a)
    {
        long div, p = Mod, x1 = 1, y1 = 0, x2 = 0, y2 = 1;
        while (true)
        {
            if (p == 1) return x2 + Mod; div = a / p; x1 -= x2 * div; y1 -= y2 * div; a %= p;
            if (a == 1) return x1 + Mod; div = p / a; x2 -= x1 * div; y2 -= y1 * div; p %= a;
        }
    }
}


Measured memory_bytes: 27388
#include<iostream>
#include<algorithm>
#include<cstdio>

using namespace std;

#define MAX	110

long long int DP[MAX][MAX];
long long int target;
long long int input[MAX];
long long int n;
long long int dfs_end;


long long int dfs(int now , int sum)
{
	if (now == dfs_end)
	{
		if (sum == target)
		{
			return 1;
		}
		return 0;
	}
	if (sum > 20 || 0 > sum)
	{
		return 0;
	}
	if (DP[now][sum] != 0)
	{
		return DP[now][sum];
	}

	DP[now][sum] += dfs(now + 1 , sum + input[now]);
	DP[now][sum] += dfs(now + 1 , sum - input[now]);

	return DP[now][sum];
}



int main()
{
	cin >> n;
	for (int i = 0; i < MAX; i++)
	{
		for (int j = 0; j < MAX; j++)
		{
			DP[i][j] = 0;
		}
	}

	for (int i = 0; i < n; i++)
	{
		cin >> input[i];
	}

	target = input[n - 1];
	dfs_end = n - 1;

	int i = 0;
	while (input[i] == 0)
	{
		i++;
	}
	
	DP[0][0] = dfs(i , 0);
	
	printf("%lld" , DP[0][0]);
	puts("");

	return 0;
}

Measured memory_bytes: 1252
#include<iostream>
#include<string>
#include<vector>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;

int main() {
	int N = 0;
	int count = 0;
	int max = 0;
	cin >> N;
	vector<long long> a(N + 1);
	rep(i, N) {
		cin >> a.at(i);
	}
	a.at(N) = 1000000001;
		rep(i, N) {
			if (a.at(i) >= a.at(i + 1)) {
				count++;
				if (count > max) {
					max = count;
				}
			}
			else {
				count = 0;
			}
		}

	cout << max << endl;
	return 0;
}

Measured memory_bytes: 1024
N, M = gets.strip.split.map(&:to_i)
m = []
M.times do
  m << gets.strip.to_i
end

n=Array.new(N+1, 0)

n[0]=1
n[1]=1

m.each{|i| n[i]= nil}
n[1]= n[1].to_i
S=1000000007

(2).upto(N){|i|
  n[i] = n[i] ? n[i-1]+n[i-2] : 0
}
puts n[N].to_i % S

Measured memory_bytes: 433020
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.Scanner;

/**
 * https://abc066.contest.atcoder.jp/tasks/arc077_a
 */
public class Main {

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		int[] a = new int[N];
		for(int i=0; i<N; i++) a[i] = Integer.parseInt(sc.next());
		sc.close();
		
		List<Integer> b = new LinkedList<>();
		
		for(int i=0; i<N; i++){
			if(i%2==0){
				b.add(a[i]);
			}else{
				b.add(0,a[i]);
			}
		}
		
		if(N%2==1)
			Collections.reverse(b);

		StringBuilder sb = new StringBuilder();
		int i=0;
		for(int n:b){
			sb.append(n);
			if(++i!=N) sb.append(" ");
		}		
		System.out.println(sb.toString());
			
	}

}

Measured memory_bytes: 65264
#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>;
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)

int n;
vector<ll>a;
ll solve(){
    vector<ll>b(n);
    rep(i,n)b[i]=a[i]-(i+1);
    sort(b.begin(),b.end());
    ll x=b[b.size()/2];
    ll ans=0;
    rep(i,n)ans+=abs(b[i]-x);
    return ans;
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    cin>>n;
    a.resize(n);
    rep(i,n)cin>>a[i];
    cout<<solve()<<endl;
    return 0;
}

Measured memory_bytes: 3328
# include <bits/stdc++.h>
# define ll int64_t
# define rep(i,n) for(ll i=0;i<n;i++)
# define rrep(i,n) for(ll i=1;i<=n;i++)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define mod 1000000007

using namespace std;

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

bool my_compare(pair<string,ll> a,pair<string,ll> b){
    
    if(a.first != b.first) return a.first<b.first;
    if(a.second != b.second) return a.second>b.second;
    else return true;
}

ll factorial(ll n){
    ll x=1;
    rrep(i,n) x *= i;
    return x;
}

ll gcd(ll a, ll b)
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}

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

int main(){
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    ll upc=b/c,dowc=(a-1)/c,upd=b/d,dowd=(a-1)/d;
    ll upe=b/lcm(c,d),dowe=(a-1)/lcm(c,d);
    cout<<b-a-(upc+upd-dowc-dowd+dowe-upe)+1<<endl;
    return 0;
}


Measured memory_bytes: 256
h, w = map(int, input().split())
s = [list(input()) for _ in range(h)]

dx = [-1, 0, 1, 1, 1, 0, -1, -1]  #任意のマスの周り8方向のマスの差分を
dy = [1, 1, 1, 0, -1, -1, -1, 0]  #左上から時計回りに用意した

for i in range(h):
    for j in range(w):
        if s[i][j] == '.':
            bomb = 0
            for k in range(8):
                if 0 <= i + dy[k] < h and 0 <= j + dx[k] < w:
                    if s[i+dy[k]][j+dx[k]] == '#':
                        bomb += 1
            s[i][j] = bomb
for i in s:
    print(*i, sep='')

Measured memory_bytes: 3444
#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 = a; i <= b; i++) cout << i << endl;
    } else {
        for (int i = a; i < a+k; i++) cout << i << endl;
        for (int i = b-k+1; i <= b; i++) cout << i << endl;
    }
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	private int[] in;
	private int size;
	public Main(int[] input) {
		this.in = input;
		this.size = input.length;
	}
	
	public void print() {
		for (int i = 0; i < size; i++) {
			int parent = (i - 1) / 2;
			int left = 2 * i + 1;
			int right = 2 * i + 2;
			System.out.printf("node %d: key = %d, ", i + 1, in[i]);
			if (parent >= 0 && parent < size && i != 0) {
				System.out.printf("parent key = %d, ", in[parent]);
			}
			if (left > 0 && left < size) {
				System.out.printf("left key = %d, ", in[left]);
			}
			if (right > 0 && right < size) {
				System.out.printf("right key = %d, ", in[right]);
			}
			System.out.println();
		}
	}
	
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int size = in.nextInt();
		int[] inputs = new int[size];
		for(int i = 0; i < size; i++) {
			inputs[i] = in.nextInt();
		}
		Main test = new Main(inputs);
		test.print();
		
		in.close();
	}
}


Measured memory_bytes: 30172