akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<iomanip>

using namespace std;
using ll=long long;

#define rep(i, a, n) for (int i = (a); i < (n); ++i)

int main(){
  std::cin.tie(nullptr);                  // 標準入出力高速化
  std::ios_base::sync_with_stdio(false);  // SとS++の入出力出力を非同期
  int n,q;
  cin>>n>>q;
  string s;
  cin>>s;

  // 累積和
  vector<int> a(n+1, 0); // s[0] = 0 になる
  for (int i = 0; i < n; ++i){
      if(i+1 < n && s[i] == 'A' && s[i+1] == 'C') a[i+1] = a[i] + 1;
      else a[i+1]=a[i];
  }

  //クエリ
  int l,r;
  rep(i,0,q){
      cin>>l>>r;
      --l,--r;
      cout << a[r] - a[l] << endl;
  }
}

Measured memory_bytes: 1488
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const ll mod = 1e9+7;
ll cum[100005];
ll a[100005];
int main() {
  int n;
  cin >> n;
  for(int i=1;i<=n;i++) cin >> a[i];
  for(int i=1;i<=n;i++) {
     cum[i] += cum[i-1] + a[i];
  }
  ll runSum = 0;
  ll A  = 0;
  for(int i=1;i<=n;i++) {
     cum[i] += runSum;
     if(i&1) { // positive case
       if(cum[i] <= 0) {
          A += (llabs(cum[i]) + 1);
          runSum += (llabs(cum[i]) + 1);
       }
     }
     else {  // negative case
        if(cum[i] >= 0) {
          A += (llabs(cum[i]) + 1);
          runSum -= (llabs(cum[i]) + 1);
        }
     }
  }
  runSum = 0;
  ll B = 0;
  memset(cum,0,sizeof cum);
  for(int i=1;i<=n;i++) {
     cum[i] += cum[i-1] + a[i];
  }
  for(int i=1;i<=n;i++) {
     cum[i] += runSum;
     if(i&1) { // negative case
       if(cum[i] >= 0) {
          B += (llabs(cum[i]) + 1);
          runSum -= (llabs(cum[i]) + 1);
       }
     }
     else {  // positive case
        if(cum[i] <= 0) {
          B += (llabs(cum[i]) + 1);
          runSum += (llabs(cum[i]) + 1);
        }
     }
  }
  cout << min(A,B) << endl;
  return 0;
}


Measured memory_bytes: 1792
//----AUTHOR:kkdrummer----/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include<ext/rope>
using namespace __gnu_cxx;
using namespace __gnu_pbds;
using namespace std;
typedef    long long   ll;
typedef    long double   ld;
//typedef    unordered_set<ll>   usll;
//typedef    unordered_multiset<ll>   umsll;
typedef    multiset<ll>   msll;
typedef    set<ll>   sll;
typedef    vector<ll>   vll;
typedef    pair<ll,ll>   pll;
typedef    vector<pll>   vpll;
typedef    priority_queue<ll>   pqll;
typedef    vector<int>   vi;
typedef    set<int>   si;
typedef    multiset<int>   msi;
//typedef    unordered_multiset<int>   umsi;
//typedef    unordered_set<int>   usi;
typedef     pair<int,int>   pi;
typedef    vector<pi>   vpi;
typedef    pair<double,double>   pd;
typedef    vector<pd>   vpd;
typedef    priority_queue<int>   pqi;
typedef    tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>   ind_set;
typedef    tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>   ind_setll;
#define    in   insert
#define    fi   first
#define    se   second
#define    pb   push_back
#define    mp   make_pair
#define    be   begin
#define    en   end
#define    itr   iterator
#define io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define    mo   1000000007
#define    inf  9223372036854775807
#define    ninf   -inf
#define    ima   2147483647
#define    imi   -ima
#define    oncnt    __builtin_popcount
#define    zerobegin   __builtin_clz
#define    zeroend   __builtin_ctz
#define    parity   __builtin_parity
#define all(x) x.be(),x.en()
#define    eps   1e-9
#define    coutd   cout<<setprecision(10)<<fixed
const    ld   PI=3.14159265359;
inline ll modpow(ll x,ll n){if(n==0)return 1;if(n==1)return(x%mo);ll u=(modpow(x,n/2));u=(u*u)%mo;if(n%2!=0)u=(u*x%mo)%mo;return u;}
inline ll modinv(ll x){return modpow(x,mo-2);}
inline ll mmul(ll a,ll b){    if(a>=mo)a=a%mo;if(b>=mo)b=b%mo;if(a*b>=mo)return(a*b)%mo;return(a*b);}
inline ll madd(ll a, ll b){if(a>=mo)a=a%mo;if(b>=mo)b=b%mo;if(a+b>=mo)return(a+b)%mo;return(a+b);}
inline ll msub(ll a, ll b){if(a>=mo)a=a%mo;if(b>=mo)b=b%mo;return(((a-b)%mo+mo)%mo);}
inline ll mdiv(ll a,ll bb){if(a>=mo)a=a%mo;ll b=modinv(bb);if(b>=mo)b=b%mo;if(a*b>=mo)return(a*b)%mo;return(a*b);}
inline ll gcd(ll a,ll b){return __gcd(a,b);}



int main()
{
io
int testcases=1;//cin>>testcases;
while(testcases--)
{
ll n,k;
cin>>n>>k;
ll an=0;
ll mat=(n*(n+1))/2;
for(ll i=k;i<=n+1;i++)
{
	ll a1=((i-1)*i)/2;
	ll h=n-i;
	ll a2=mat-((h+1)*h)/2;
	a2=a2-a1+1;
	an=madd(an,a2);
}


cout<<an;






}return 0;}

Measured memory_bytes: 3640
// Problem : C - management
// Contest : AtCoder - AtCoder Beginner Contest 163
// URL : https://atcoder.jp/contests/abc163/tasks/abc163_c
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

//QWsin
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define rep(i,x,y) for(int i=x;i<=y;++i)
#define out(i,u) for(int i=first[u];i!=-1;i=nxt[i])
#define repvc(i,vc) for(int i=0,Sz=vc.size();i<Sz;++i)
using namespace std;
inline int read()
{
	char ch=getchar();int ret=0,f=1;
	while(ch<'0' || ch>'9') {if(ch=='-')f=-1;ch=getchar();}
	for(;ch>='0' && ch<='9';ch=getchar()) ret=ret*10+ch-'0';
	return ret*f;
}

typedef long long ll;
const int INF=1<<30;

const int maxn=200000+10;
int ans[maxn];

int main()
{
	int n;cin>>n;
	rep(i,2,n){
		ans[read()]++;
	}
	rep(i,1,n){
		cout<<ans[i]<<endl;
	}
	return 0;
}


Measured memory_bytes: 4364
#include<stdio.h>
#define N 200000
 
int main(){
 
  int i,n,maxv,minv;
  int arr[N];
   
  scanf("%d",&n);
   
  for(i=0;i<n;i++){
    scanf("%d",&arr[i]);
  }
   
  maxv = arr[1] - arr[0];
  minv = arr[0];
   
  for(i=1;i<n;i++){
    if(maxv<arr[i]-minv){  
    maxv = arr[i]-minv;
    }
    if(minv>arr[i]){
      minv = arr[i];
    }
  }
     
  printf("%d\n",maxv);
 
  return 0;
}


Measured memory_bytes: 2568
/*input
10 4
40 10 20 70 80 10 20 70 80 60
*/
 
// author - Madhav Thakker
 
#include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize ("O3")
#pragma GCC optimize ("O2")
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
using namespace std;
 
#define ll long long
#define ld long double
#define int ll
#define endl '\n'

typedef pair<int, int> pii; 
typedef pair<ld, ld> pdd;
 
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define FileIn(file) freopen(file, "r", stdin)
#define FileOut(file) freopen(file, "w", stdout)
#define all(c) c.begin(), c.end() 
#define tr(container, it )\
for(__typeof__(container.begin()) it = container.begin(); it != container.end(); it++) 
#define present(container, element) (container.find(element) != container.end())  //map, set
#define cpresent(container, element) (find(aint(container),element) != container.end()) //vector
#define what_is(x) cout << #x << " is " << x << endl; 
#define all(c) c.begin(), c.end() 
 
// #define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
 
int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};
const int MOD = 1e9+7;
 
 
int fast_pow(int a, int b){
	int res = a, ret = 1;
	while(b>0){
		if(b%2)
			ret = (ret*res)%MOD;
		res = (res*res)%MOD;b/=2;
	}
	return ret;
}
 
// --
// -- 
// -- 
// std::cout << std::fixed;
// std::cout << std::setprecision(26) << f << '\n';
// str = to_string(n)
// stoi , stoll, stol
// sort(arr, arr+n, greater<int>());
// fill(prefix.begin(), prefix.end(), 0);
// 
// 
 
 
 
////
const int maxN = 1e5+700;
int arr[maxN];
int dp[maxN];
////


signed main(){
 
	fastio;
	time_t time_t1, time_t2;
	time_t1 = clock();
 
	////////////////////////////////

	int t = 1;
	// cin >> t ;

	while(t--){

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

		for (int i = 0; i <= n; ++i){
			dp[i] = 1e16;
		}		
		
		dp[0] = 0;
		
		for (int i = 0; i < n; ++i){
			for (int j = 1; j <= k; ++j){
				dp[i+j] = min(dp[i+j], dp[i] + abs(arr[i+j] - arr[i]));
			}
		}

		cout << dp[n-1] << endl;
	}
 	
	///////////////////////////////
	// 
 
	time_t2 = clock();
	// cerr << "time taken :" << time_t2 - time_t1 << endl;
 
	return 0;
}


Measured memory_bytes: 1792
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <bitset>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
#include <chrono>
#include <random>
#include <tuple>
#include <utility>
#include <fstream>
#include <complex>
#define _USE_CMATH_DEFINES

const long INF = (1l << 30);
const long LINF = (1l << 60); //1.15*10^18

std::string s;
long cnt[2];

int main(){
    std::cin >> s;
    for(int i = 0; i < 3; i++){
        cnt[s[i] - 'A']++;
    }
    if(cnt[0] != 0 && cnt[1] != 0){
        printf("Yes\n");
    }else{
        printf("No\n");
    }
}


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

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

using namespace std;

int main() {
	int N,N1,sum=0;
	string ans = "No";
	cin >> N ;
	N1 = N;
	sum = N % 10;
	while(N/10){
		N /= 10;
		sum += N % 10;
	}
	if (N1%sum==0)
		ans = "Yes";
	cout << ans << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

int main()
{
    double a, b, h, m;
    cin >> a >> b >> h >> m;
    double theta = h * 2.0 * M_PI / 12.0 + m * 2.0 * M_PI / (12.0 * 60.0);
    double phi = m * 2.0 * M_PI / 60.0;
    double angle = theta - phi;
    cout << setprecision(18) << sqrt(a * a + b * b - 2.0 * a * b * cos(angle))
         << endl;
    return 0;
}

Measured memory_bytes: 3640
package main

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

func configure(scanner *bufio.Scanner) {
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
}
func getNextString(scanner *bufio.Scanner) string {
	scanned := scanner.Scan()
	if !scanned {
		panic("scan failed")
	}
	return scanner.Text()
}
func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}
func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}
func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}
func main() {
	fp := os.Stdin
	wfp := os.Stdout
	extra := 0
	if os.Getenv("I") == "IronMan" {
		fp, _ = os.Open(os.Getenv("END_GAME"))
		extra = 100
	}
	scanner := bufio.NewScanner(fp)
	configure(scanner)
	writer := bufio.NewWriter(wfp)
	defer func() {
		r := recover()
		if r != nil {
			fmt.Fprintln(writer, r)
		}
		writer.Flush()
	}()
	solve(scanner, writer)
	for i := 0; i < extra; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
}
func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	n := getNextInt(scanner)
	q := getNextInt(scanner)
	aa := make([][]int, n)
	for i := 0; i < q; i++ {
		s := getNextInt(scanner)
		switch s {
		case 0:
			t := getNextInt(scanner)
			x := getNextInt(scanner)
			aa[t] = append(aa[t], x)
		case 1:
			t := getNextInt(scanner)
			if len(aa[t]) == 0 {
				continue
			}
			fmt.Fprintln(writer, aa[t][0])
		case 2:
			t := getNextInt(scanner)
			if len(aa[t]) == 0 {
				continue
			}
			aa[t] = aa[t][1:]
		}
	}
}



Measured memory_bytes: 8940
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<queue>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<queue>
#include<cstring>
#include<string>
#include<cmath>
#include<map>
#define mem0(a) memset(a,0,sizeof(a))
#define meminf(a) memset(a,0x3f,sizeof(a))
#define Lson L, mid, rt<<1  
#define Rson mid+1, R, rt<<1|1 
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef double db;
const int maxn = 31 * 31 * 31;
string s;
int ans = 700;
int main()
{
	cin >> s;
	if (s[0] == 'o')ans += 100;
	if (s[1] == 'o')ans += 100;
	if (s[2] == 'o')ans += 100;
	cout << ans;
	return 0;
}

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

int main()
{
	int N, a[100];
	cin >> N;
	for(int i = 0 ; i < N; ++i)
	{
		cin >> a[i];
	}
	
	int swap = 0;
	for(int i = 0; i < N - 1; ++i)
	{
		for(int j = N - 1; j > i; --j)
		{
			if(a[j] < a[j - 1])
			{
				int temp = a[j];
				a[j] = a[j - 1];
				a[j - 1] = temp;
				
				++swap;
			}
		}
	}
	
	for(int i = 0 ; i < N; ++i)
	{
		if(i != 0)
		{
			cout << " ";
		}
		cout << a[i];
	}
	cout << endl << swap << endl;

    return 0;
}



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

int main(){
    int n;
    cin>>n;
    map<int,int>mp;
    rep(i,n){
        int a; cin>>a;
        mp[a]++;
    }
    int ans=0;
    for(auto&p:mp){
        if(p.first<p.second)ans+=p.second-p.first;
        if(p.first>p.second)ans+=p.second;
    }
    cout<<ans<<endl;
    return 0;
}

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


int main() 
{
    int n;
    cin>>n;
    double headp[n];
    for(int i=0;i<n;i++)
        cin>>headp[i];
    double dp[n+1][n+1];
    memset(dp,0.00,sizeof(dp));
    dp[0][0]=1;
    for(int i=1;i<=n;i++)
        dp[0][i]=dp[0][i-1]*(1-headp[i-1]);
    
    for(int i=1;i<=n;i++)
    {
        for(int j=i;j<=n;j++)
        {
            dp[i][j]+=(dp[i][j-1]*(1-headp[j-1]));
            dp[i][j]+=(dp[i-1][j-1]*headp[j-1]);
        }
    }
    double ans=0;
    for(int i=n/2+1;i<=n;i++)
        ans+=dp[i][n];
    cout<<fixed<<setprecision(16)<<ans<<endl;
}

Measured memory_bytes: 74008
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <climits>
#include <cassert>
using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

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

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define foreach(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)

const double EPS = 1e-9;
const double PI  = acos(-1.0);
const int dx[] = {-1,1,0,0};
const int dy[] = {0,0,1,-1};

#define CLR(a) memset((a), 0 ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

class unionfind {
	vector<int> par, rank;

public:
	void init(int n) {
		par.resize(n);
		rank.resize(n);

		for (int i = 0; i < n; i++) {
			par[i] = i;
			rank[i] = 0;
		}
	}

	int find(int x) {
		if (par[x] == x) return x;
		else return par[x] = find(par[x]);
	}

	void unite(int x, int y) {
		x = find(x);
		y = find(y);
		if (x == y) return ;

		if (rank[x] < rank[y]) par[x] = y;
		else {
			par[y] = x;
			if (rank[x] == rank[y]) ++rank[x];
		}
	}

	bool same(int x, int y) { return (find(x) == find(y)); }
} uf;

int N;
pii pt[100010];
vector<pair<pii,int>> v1, v2;
vector<pair<int, pii>> es;
ll ret;

int main() {
	cin >> N;
	uf.init(N);

	rep(i, N) {
		cin >> pt[i].fi >> pt[i].se;
		v1.eb(pt[i], i);
		v2.eb(mp(pt[i].se, pt[i].fi), i);
	}

	sort(v1.begin(), v1.end());
	sort(v2.begin(), v2.end());

	rep(i, N-1) {
		es.eb(mp(v1[i+1].fi.fi - v1[i].fi.fi, mp(v1[i].se, v1[i+1].se)));
	}

	rep(i, N-1) {
		es.eb(mp(v2[i+1].fi.fi - v2[i].fi.fi, mp(v2[i].se, v2[i+1].se)));
	}

	sort(es.begin(), es.end());

	for (auto t : es) {
		int a = t.se.fi, b = t.se.se, c = t.fi;
		if (!uf.same(a, b)) {
			uf.unite(a, b);
			ret += c;
		}
	}

	cout << ret << endl;

	return 0;
}

Measured memory_bytes: 8748
input()
a = input().split(" ")

a = list(map(int, a))

count = 0
for i in range(1, len(a)):
  if a[i]<a[i-1]:
    count += (a[i-1] - a[i])
    a[i] += (a[i-1] - a[i])
    
print(count)

Measured memory_bytes: 32304
#include <stdio.h>

int cost(int s, int d)
{
	int t = 1;
	
	if (s >= d) return 0;
	
	while (!(s % (t * 2)) && s + (t * 2) <= d) {
		t *= 2;
	}
	
	return cost(s + t, d) + 1;
}


int main(void) {
	int n;
	
	scanf("%d", &n);
	
	while (n--) {
		int s, d;

		scanf("%d%d", &s, &d);
		printf("%d\n", cost(s, d));
	}
	
	return 0;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
//#define int long long

signed main(){
    int n; cin >> n;
    vector<int> L(n);
    rep(i,n) cin >> L[i];
    sort(ALL(L));
    
    long long ans = 0;
    reps(a,0,n-3)reps(b,a+1,n-2){
        auto c = lower_bound(ALL(L),L[a]+L[b]) - L.begin();
        ans += (c-1) - b;
    }
    
    cout << ans << endl;
}

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

int main()
{
  int N;scanf("%d",&N);
  int A[N];
  for(int i=0;i<N;i++)scanf("%d ",&A[i]);
  int minus=1;
  for(int i=0;i<N;i++)minus*=(2-A[i]%2);
  printf("%d\n",(int)pow(3,N)-minus);
}

Measured memory_bytes: 4160
#include<stdio.h>

#define MAX_LENTH 30001

int main(void){

    int N,i,j,k,ans = 0,password,find_num;
    int S_num[MAX_LENTH];
    char S[MAX_LENTH];

    scanf("%d",&N);
    scanf("%s",S);

    for(i = 0;i < N;i++){
        S_num[i] = (int)(S[i]-'0');
    }

    for(password = 0;password <= 999;password++){
        int c[3] = {password/100,(password/10)%10,password%10};
        find_num = 0;
        for(i = 0;i < N;i++){
            if(S_num[i] == c[find_num]){
                find_num++;
                if(find_num == 3) break;
            }
        }
        if(find_num == 3) ans++;
    }

    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define st first
#define nd second
#define PQ priority_queue

using ll = long long ;
using namespace std;
using pii = pair<int,int>;
const int N = 0;
const int mod = 0;
vector<int> prime;
int main(){
	int n;
	scanf("%d", &n);
	if(n < 2) return !printf("0");
	int sum = 1;
	prime.push_back(2);
	for(int i = 3; i <= 1000; i++){
		bool io = true;
		for(auto it: prime){
			if(it * it > i) break;
			if(i % it == 0) {
				io = false;
				break;
			}
		}
		if(io) prime.push_back(i);
	}
	for(int j = 2; j < n; j++){
		int mul = 1;
		int i = j;
		for(auto it: prime){
			if(it * it > i) break;
			int cnt = 1;
			for(; i % it == 0; cnt ++, i /= it);
			mul *= cnt;
		}
		if(i != 1) mul *= 2;
		sum += mul;
	}
	printf("%d", sum);


}

Measured memory_bytes: 3828
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define repi(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define repdi(i,a,b) for(ll i=(a)-1;i>=(b);--i)
#define repd(i,a) repdi(i,a,0)
#define itr(it,a) for( auto it = (a).begin(); it != (a).end(); ++it )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define endl '\n'
#define debug(x) std::cerr << #x << " = " << (x) << endl;

using ll = long long;
using P = std::pair<ll, ll>;

constexpr ll INF = 1ll<<60;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

template<class S, class T>
std::ostream& operator<< ( std::ostream& out, const std::pair<S,T>& a )
{ std::cout << '(' << a.first << ", " << a.second << ')'; return out; }

template<class T>
std::ostream &operator<< ( std::ostream& out, const std::vector<T>& a )
{ std::cout << '['; rep( i, a.size() ){ std::cout << a[i]; if( i != a.size()-1 ) std::cout << ", "; } std::cout << ']'; return out; }

struct UnionFind {
  std::vector<int> d;
  UnionFind(int n=0): d(n,-1) {}
  int find(int x) {
    if (d[x] < 0) return x;
    return d[x] = find(d[x]);
  }
  bool unite(int x, int y) {
    x = find(x); y = find(y);
    if (x == y) return false;
    if (d[x] > d[y]) std::swap(x,y);
    d[x] += d[y];
    d[y] = x;
    return true;
  }
  bool same(int x, int y) { return find(x) == find(y);}
  int size(int x) { return -d[find(x)];}
};

ll N, M;
std::vector<ll> G[100010];
UnionFind uf( 100010 );
ll deg[100010];
std::vector<P> es;

void dfs( ll v, ll p = -1 ) {
  for( auto u : G[v] ) if( u != p ) {
    dfs( u, v );
  }

  if( p != -1 ) {
    if( deg[v]&1 ) {
      es.emplace_back( v, p );
      ++deg[v];
    } else {
      es.emplace_back( p, v );
      ++deg[p];
    }
  }

  return;
}

int main() {
  std::cin >> N >> M;

  rep( i, M ) {
    ll A, B;
    std::cin >> A >> B;
    --A; --B;

    if( !uf.same( A, B ) ) {
      G[A].emplace_back( B );
      G[B].emplace_back( A );
      uf.unite( A, B );
    } else {
      ++deg[A];
      es.emplace_back( A, B );
    }
  }

  if( M&1 ) {
    std::cout << -1 << endl;

    return 0;
  }

  dfs( 0 );

  for( auto e : es ) {
    std::cout << e.first+1 << ' ' << e.second+1 << endl;
  }

  return 0;
}

Measured memory_bytes: 15884
#include <cstdio>
#include <vector>
#include <stack>
#include <iostream>
#include <string>
#include <tuple>
#include <random>
#include <map>
#include <queue>
#include <set>
#include <complex>
#include <algorithm>
#include <cassert>
#include <iterator>
#include <numeric>
#include <cmath>
#include <stdio.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> T;

const double eps = 1e-8;

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


int main() {
	ll N;
	cin >> N;
	vector<T> v(N);
	for (int i = 0;i < N;i++) {
		ll a, b;
		cin >> a >> b;
		v[i] = T(-(a + b), a, b);
	}
	sort(v.begin(), v.end());
	ll ans = 0;
	for (int i = 0;i < N;i++) {
		ll sub, a, b;
		tie(sub, a, b) = v[i];
		if (i % 2)
			ans -= b;
		else
			ans += a;
	}
	cout << ans << endl;
	return 0;
}

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

#define rep(i,n) for(int i = 0; i < (n); i++)
#define ll long long

using namespace std;

int main(){
  int n;cin>>n;
  string s;cin>>s;
  int result=0;
  rep(i, s.size()-2)if(s[i]=='A' && s[i+1]=='B' && s[i+2]=='C')result++;
  cout<<result;

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
	int a,b;
	while(cin>>a>>b){
		if(!a&&!b)break;
		int x=(a>=b)?a:b,y=(a>=b)?b:a,step=0,tmp;
		while(y!=0){
			x=x%y;
			tmp=x;
			x=y;
			y=tmp;
			++step;
		}
		cout<<x<<" "<<step<<"\n";
	}
	return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
inline int getint() {
    register char ch;
    while(!isdigit(ch=getchar()));
    register int x=ch^'0';
    while(isdigit(ch=getchar())) x=(((x<<2)+x)<<1)+(ch^'0');
    return x;
}
int main() {
    std::multiset<std::string> set;
    for(register int i=getint();i;i--) set.insert("a");
    for(register int i=getint();i;i--) set.insert("b");
    for(register int i=getint();i;i--) set.insert("c");
    while(set.size()>1) {
        std::string s=*set.begin(),t=*set.rbegin();
        set.erase(set.lower_bound(s));
        set.erase(set.lower_bound(t));
        set.insert(s+t);
    }
    printf("%s\n",(*set.begin()).c_str());
    return 0;
} 

Measured memory_bytes: 256
import java.util.*;

class Main{
	public static void main(String args[]){
		int[][] buil1 = new int[3][10];
		int[][] buil2 = new int[3][10];
		int[][] buil3 = new int[3][10];
		int[][] buil4 = new int[3][10];

		Scanner scan = new Scanner(System.in);
		int num = scan.nextInt();

		for(int i=0; i<num; i++){
			switch(scan.nextInt()){
				case 1: //A?£?
					buil1[(scan.nextInt()-1)][(scan.nextInt()-1)] += scan.nextInt();
					break;
				case 2: //B?£?
					buil2[(scan.nextInt()-1)][(scan.nextInt()-1)] += scan.nextInt();
					break;
				case 3: //C?£?
					buil3[(scan.nextInt()-1)][(scan.nextInt()-1)] += scan.nextInt();
					break;
				case 4: //D?£?
					buil4[(scan.nextInt()-1)][(scan.nextInt()-1)] += scan.nextInt();
					break;
				default :
					break;
			}
		}
		//A?£??????¨???
		for(int i=0; i<3; i++){
			for(int k=0; k<10; k++){
				System.out.print(" " + buil1[i][k]);
			}
			System.out.println("");
		}
		for(int i=0; i<20; i++){
			System.out.print("#");
		}
		System.out.println("");

		//B?£??????¨???
		for(int i=0; i<3; i++){
			for(int k=0; k<10; k++){
				System.out.print(" " + buil2[i][k]);
			}
			System.out.println("");
		}
		for(int i=0; i<20; i++){
			System.out.print("#");
		}
		System.out.println("");

		//C?£??????¨???
		for(int i=0; i<3; i++){
			for(int k=0; k<10; k++){
				System.out.print(" " + buil3[i][k]);
			}
			System.out.println("");
		}
		for(int i=0; i<20; i++){
			System.out.print("#");
		}
		System.out.println("");

		//D?£??????¨???
		for(int i=0; i<3; i++){
			for(int k=0; k<10; k++){
				System.out.print(" " + buil4[i][k]);
			}
			System.out.println("");
		}
	}
}

Measured memory_bytes: 29904
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    int ans = 100;
    REP(i,n){
        int a;
        cin >> a;
        int bi = 0;
        while(a%2==0){
            bi++;
            a>>=1;
        }
        ans = min(ans,bi);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   main.cpp                                           :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: monoue <marvin@student.42.fr>              +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2020/04/22 12:30:15 by monoue            #+#    #+#             */
/*   Updated: 2020/05/02 10:05:50 by monoue           ###   ########.fr       */
/*                                                                            */
/* ************************************************************************** */

#include <bits/stdc++.h>

/* #include <boost/multi_array.hpp> */
/* #include <boost/optional.hpp> */
/* #include <boost/range/irange.hpp> */
/* #include <boost/range/algorithm.hpp> */
/* #include <boost/range/adaptors.hpp> */
/* #include <boost/multiprecision/cpp_int.hpp> */
/* #include <boost/algorithm/string/classification.hpp> // is_any_of */
/* #include <boost/algorithm/string/split.hpp> */
/* #include <boost/algorithm/string/join.hpp> */
/* #include <boost/algorithm/string/replace.hpp> */
/* #include <boost/math/tools/minima.hpp> */
/* namespace adaptor = boost::adaptors; */
/* using boost::math::tools::brent_find_minima; */
/* using boost::irange; */
/* using boost::algorithm::join; */
/* using boost::algorithm::split; */
/* using boost::algorithm::replace_all; */
/* using boost::multiprecision::cpp_int; */

using namespace std;

#define	int	long long
#define MOD 1000000007
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define rrep(i, n) for (int i = (n); i >= 0; --i)

typedef long long 			ll;
typedef vector<int>			VI;
typedef vector<vector<int>>	VVI;
typedef pair<int, int>		PII;

// TOP
// int		f(int n)
// {
// 	if (n < 2)
// 		return (1);
// 	return (n * f(n - 2) % 1000000000000000);
// }

void	Main()
{
	int n;
	cin >> n;
	if (n % 2)
	{
		cout << 0 << endl;
		return;
	}
	n /= 2;
	// n / 5 + n / 5 * 5 + ...
	int	sum;
	sum = 0;
	for (int i = 5; i <= n; i *= 5)
		sum += n / i;
	cout << sum << endl;

	// for (int i = 0; i < 100; i += 2)
	// {
	// 	int	n;
	// 	n = 0;
	// 	int x;
	// 	x = f(i);
	// 	while (x % 10 == 0)
	// 	{
	// 		x /= 10;
	// 		n++;
	// 	}
	// 	// cout << i / 10 << ": " << n << endl;
	// 	cout << "i/2:" << i / 2 << " " << n << endl;
	// }
}
// END

int32_t	main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(15);
	Main();
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<algorithm>
#include<math.h>
using namespace std;

int main() {
	int X, t;
	int ans;
	cin >> X >> t;
	ans = X < t ? 0 : X - t;
	cout << ans << endl;

	return 0;
}


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

int rel_c_c( double, double, double, double, double, double );

int main( void ) {
	int n;
	double xa, ya, ra, xb, yb, rb;

	for ( scanf( "%d", &n ); n--; printf( "%d\n", rel_c_c( xa, ya, ra, xb, yb, rb ) ) )
		scanf( "%lf %lf %lf %lf %lf %lf", &xa, &ya, &ra, &xb, &yb, &rb );

	return 0;
}

// int rel_c_c( double x1, double y1, double r1, double x2, double y2, double r2 ) {
// 	int sign;
// 	double R, r, d = sqrt( ( x1 - x2 ) * ( x1 - x2 ) + ( y1 - y2 ) * ( y1 - y2 ) );

// 	if ( d > r1 + r2 )
// 		return 0;

// 	if ( r1 >= r2 ) {
// 		sign = 1;
// 		R = r1;
// 		r = r2;
// 	} else {
// 		sign = -1;
// 		R = r2;
// 		r = r1;
// 	}
// 	if ( R - r <= d && d <= R + r )
// 		return 1;
// 	if ( d < R - r )
// 		return sign * 2;
// }

int rel_c_c( double x1, double y1, double r1, double x2, double y2, double r2 ) {
	int sign;
	double R, r, d = sqrt( ( x1 - x2 ) * ( x1 - x2 ) + ( y1 - y2 ) * ( y1 - y2 ) );

	if ( d == 0 && r1 == r2 )
		return 12345;
	if ( d > r1 + r2 )
		return 0;
	if ( d == r1 + r2 )
		return 1;

	if ( r1 >= r2 ) {
		sign = 1;
		R = r1;
		r = r2;
	} else {
		sign = -1;
		R = r2;
		r = r1;
	}
	if ( R - r < d && d < R + r )
		return 1;
	if ( d == R - r )
		return 1;
	if ( d < R - r )
		return sign * 2;
}

Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <fstream>
#include <vector>
#include <deque>
#include <assert.h>
#include <stack>
#include <set>
#include <map>
#include <stdio.h>
#include <string.h>
#include <utility>
#include <math.h>
#include <bitset>
#include <iomanip>
#include <complex>
#include <queue>
using namespace std;
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define print(x) cout<<(x)<<'\n'
#define print_vec(v) rep(i,v.size()){if(i!=0)cout<<" ";cout<<v[i];}cout<<'\n'
#define pe(x) cout<<(x)<<" "
#define DEBUG(x) cout<<#x<<": "<<x<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";rep(i,v.size())cout<<" "<<v[i];cout<<'\n'
#define pb push_back
#define mp make_pair
#define MOD 1000000007 //10^9+7
#define fi first
#define sc second
using ll=long long;
using pll=pair<ll,ll>;
using vll=vector<ll>;
using vvll=vector<vll>;
using vstr=vector<string>;

string S,T;
ll N,M,H,W,K,L,A,B,C;
void solve() {
    cin >> A >> B >> C >> K;
    ll k = K;
    rng(i,1,K+1){
        if(B <= A){
            B *= 2;
            k--;
        }
    }
    K = k;
    rng(j,1,K+1){
        if(C <= B){
            C *= 2;
            k--;
        }
    }
    if(B>A && C>B) print("Yes");
    else print("No");
}
 
int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
	cout<<fixed<<setprecision(20);
    //int q; cin >> q;
	//while (q--)
		solve();
    return 0;
}

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

int n,a[2005],sum;
bitset<4000005> dp;

int main(){

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    cin>>n;
    dp[0]=1;
    for(int i=0;i<n;i++){
        cin>>a[i];
        sum+=a[i];
        dp|=dp<<a[i];
    }
    cout<<dp._Find_next(sum-1>>1)<<endl;

    return 0;
}

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

#define loop(n, i) for(int i=0;i<n;i++)
#define HERE cout << "HERE: " << __LINE__ << endl;
#define INSP(v) cout << v << " at " << __LINE__ << endl;
using namespace std;
using ll = long long;
template <class T>
using vec = vector<T>;

int main() {
    int n, k; cin >> n >> k;
    vec<int> A(n);
    loop (n, i) cin >> A[i];

    int p = 0;
    loop (n, i) if (A[i] == 1) p = i;

    int ans = 1<<29;
    loop (k, i) {
        int s = max(0, p - k + 1 + i);
        int f = max(0, n - (s + k));
        ans = min(ans, 1 + (s + k - 2) / (k - 1) + (f + k - 2) / (k - 1));
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <iomanip>
#include <string>
#include <unordered_map>
#include <cmath>
#include <algorithm>

typedef long long ll;
typedef long double ld;

using namespace std;
int main()
{
  ll n, a[200010];
  unordered_map<ll, ll> amap;

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

  for (ll i = 0; i < n; i++)
  {
    amap[a[i]]++;
    if (amap[a[i]] > 1)
    {
      cout << "NO" << endl;
      return 0;
    }
  }

  cout << "YES" << endl;
  return 0;
}


Measured memory_bytes: 10056
// D - Factorization

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// const int INF = 2147483647;
// const ll INF = 9223372036854775807;

const int MOD = 1000000007;

vector<pair<ll, ll>> prime_factorize(ll n) {
	vector<pair<ll, ll> > result;
	for (ll p=2; p*p<=n; p++) {
		if (n % p != 0) continue;
		ll num = 0;
		while (n % p == 0) {
			num++;
			n /= p;
		}
		result.push_back(make_pair(p, num));
    }
    if (n != 1) {
    	result.push_back(make_pair(n, 1));
    }
    return result;
}

vector<ll> prime_factorize_straight(ll n) {
	vector<ll> result;
	vector<pair<ll, ll>> pair_result = prime_factorize(n);
	for (auto pair : pair_result) {
		for (ll i=0; i<pair.second; i++) {
			result.push_back(pair.first);
		}
	}

	return result;
}

// mod p （pは素数）の下でのべき乗を求める
ll mod_pow(ll a, ll n, ll p) {
		ll result = 1;
		while (n > 0) {
			if (n & 1) result = result * a % p;
			a = a * a % p;
			n >>= 1;
		}
		return result;
	};

// mod p（pは素数）の下での逆元を求める（フェルマーの小定理を利用）
ll mod_inverse(ll a, ll p) {
	return mod_pow(a, p-2, p);
}

// mod p （pは素数）の下での除算 (a / b)
ll mod_devide(ll a, ll b, ll p) {
	return a * mod_inverse(b, p) % p;
}

ll mod_comb(ll n, ll k, ll p) {
	ll numerator = 1;
	for (int i=n; i>n-k; i--) {
		numerator *= i;
		numerator %= p;
	}

	ll denominator = 1;
	for (int i=k; i>0; i--) {
		denominator *= i;
		denominator %= p;
	}

	return mod_devide(numerator, denominator, p);
}


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

	vector<pair<ll, ll>> pf = prime_factorize(M);

	ll ans = 1;

	for (auto p : pf) {
		int k = p.second;
		ans = (ans * mod_comb(k+N-1, N-1, MOD)) % MOD;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3588
#include<cstdio>
#include<set>
using namespace std;
const int MAXN=100005;
int n,a[MAXN],ans;
multiset<int>low;
int main()
{
    scanf("%d",&n);
    for (int i=1;i<=n;++i) scanf("%d",&a[i]);
    for (int i=1;i<=n;++i)
    {
        set<int>::iterator sec=low.upper_bound(-a[i]);
        if(sec!=low.end())
        {
            low.erase(sec);
            low.insert(-a[i]);
        } else {
            low.insert(-a[i]);
            ++ans;
        }
    }
    printf("%d",ans);
    return 0;
}

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

int main(){
  int n;
  while(1){
    cin>>n;
    if(n==0) break;
    int y=sqrt(n);
    long x=0;
    for(int i=1;i<=y;i++){
      if(n==1) break;
      if(n%i==0){
	x+=i;
	if(y==i && y*y==n || i==1) 1; else x+=n/i;
      }
    }
    if(x==n) cout<<"perfect number"<<endl;
    if(x<n) cout<<"deficient number"<<endl;
    if(x>n) cout<<"abundant number"<<endl;
  }
  return 0;
}



Measured memory_bytes: 3104
/*D - Brick Break*/

#include <bits/stdc++.h>

using namespace std;

int main(){

	int ans = 0;
	int aux = 1;
	int tam;
	int num;

	cin >> tam;

	for (int i = 0; i < tam; ++i)
	{
		cin >> num;

		if(num == aux)
			aux++;
		else
			ans++;
	}

	if(aux == 1)
		cout << "-1";
	else
		cout << ans;
	return 0;
}

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

int main() {
    long long x;
    cin >> x;

    long long res = x / 11;
    if (x % 11 > 6) {
        cout << res * 2 + 2 << endl;
    }
    else if (x % 11 == 0) {
        cout << res * 2 << endl;
    }
    else {
        cout << res * 2 + 1 << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int dx[]={1,0,0,-1,1,-1,-1,1};
const int dy[]={0,1,-1,0,1,1,-1,-1};
const int INF = 1<<30;
const double EPS = 1e-8;
#define PB push_back
#define mk make_pair
#define fr first
#define sc second
#define reps(i,j,k) for(int i = (j); i < (k); ++i)
#define rep(i,j) reps(i,0,j)
#define MOD 1000000007
#define lengthof(x) (sizeof(x) / sizeof(*(x)))
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> Pii;
typedef pair<int,vi > P;
typedef long long ll;
ll data[2001];
ll memo[2][2001][2001];
int N;
ll solve(int dep,int left,int right){
    if(dep == N){
        return 0;
    }
    int d = dep%2;
    if(memo[d][left][right] != -1)return memo[d][left][right];
    ll ret = 0;
    int l = left-1;
    int r = right+1;
    if(l<0)l=N-1;
    if(r==N)r=0;
 
    if(d == 1){
        if(data[right] > data[left]){
            ret = solve(dep+1,left,r);
        }
        else{
            ret = solve(dep+1,l,right);
        }
    }
    else{
        ret = max(data[right]+solve(dep+1,left,r),
                    data[left]+solve(dep+1,l,right));
    }
    return memo[d][left][right] = ret;
}
int main(){
    scanf("%d",&N);
    rep(i,N){
        scanf("%lld",&data[i]);
    }
    ll ans = -INF;
    memset(memo,-1,sizeof(memo));
    rep(i,N){
        int l = i-1;
        int r = i+1;
        if(l<0)l=N-1;
        if(r==N)r=0;
        ans = max(ans,data[i]+solve(1,l,r));
    }
    printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 63928
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <deque>

long long mod=1e9+7;
std::map<int, int> mp_final;

void getyakusuu(int n){
  std::map<int, int> mp;
  for (int i=2; i*i<=n; i++){
    while(n%i==0){
      mp[i]++;
      n = n/i;
    }
  }
  if(n!=1){
    mp[n]++;
  }
  for (auto &entry: mp){
    //    mp_final[entry.first] = std::max(mp_final[entry.first], entry.second);
    mp_final[entry.first] += entry.second;
  }
  return;
}
int main(){
  int N;
  scanf("%d", &N);
  long long ans = 1;
  for (int i=1; i<=N; i++){
    getyakusuu(i);
  }
  for (auto &entry: mp_final){
    //std::cout << entry.first << "," << entry.second << std::endl;
    ans *= entry.second+1;
    ans %= mod;
  }
  std::cout << ans << std::endl;
  return 0;
}


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

int main(){
    vector<int> x,y;
    int a,b;
    do{
        cin >> a >> b;
        x.push_back(a);
        y.push_back(b);
    }while(!(a == 0 && b == 0));
    
    for(int i=0; i<x.size()-1; i++)
        if(x[i] >= y[i])
            cout << y[i] << " " << x[i] << endl;
        else
            cout << x[i] << " " << y[i] << endl;
    return 0;
}


Measured memory_bytes: 3128
#!/usr/bin/env python3
n, m = map(int, input().split())
s = [-1 for _ in range(m)]
c = [-1 for _ in range(m)]
for i in range(m):
    s[i], c[i] = map(int, input().split())

for i in range(1000):
    flg = True
    numstr = str(i)

    if len(numstr) != n:
        continue

    for j in range(m):
#        print('numstr =', numstr)
#        print('j =', j)
#        print('numstr[s[j]-1] =', numstr[s[j]-1])
#        print('c[j] =', c[j])
#        print()
        if numstr[s[j]-1] != str(c[j]):
            flg = False
    if flg == True:
        print(i)
        exit(0)
print(-1)

Measured memory_bytes: 3064
#include <iostream>
#include <fstream>
#include <vector>
#include <cstring>
#include <queue>
#include <algorithm> // sort

#define REP(i, n) for (long long i = 0; i < (n); i++) 
typedef long long ll;
static const ll mod = 1000000007;
static const ll INF = 1000000000000000000LL;
using namespace std;


int main(){
    ll a,b,c;
    cin >> a >> b >> c;
    ll res;
    //cを先に食べる
    if(a + b < c)
    {
        res = b + (a + b + 1);
    }
    else
    {
        res = b + c;
    }
    cout << res << endl;

    return 0;
}





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

int h, w, white;
char c[60][60];
int maze[60][60];
int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
typedef pair<int, int> pint;

int main() {
	cin >> h >> w;
	for (int i = 1; i <= h; i++) {
		for (int j = 1; j <= w; j++) {
			cin >> c[i][j];
			if (c[i][j] == '.')white++;
		}
	}
	queue<pint>que;
	que.push(pint(1,1));
	c[1][1] = '#';
	int nx, ny, ans;
	while (!que.empty()) {
		pint a = que.front(); que.pop();
		for (int i = 0; i < 4; i++) {
			ny = a.first + dy[i], nx = a.second + dx[i];
			if (nx >= 1 && nx <= w&&ny >= 1 && ny <= h&&c[ny][nx] != '#'&&maze[ny][nx] == 0) {
				que.push(pint(ny, nx));
				maze[ny][nx] = maze[a.first][a.second] + 1;
			}
		}
	}
	if (maze[h][w] == 0)ans = -1;
	else ans = white - 1 - maze[h][w];
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
using namespace __gnu_pbds; 
using namespace std;

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define MOD           1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define endl "\n"
#define FIO             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
int fc[100001], in[100001];
/*int pwmd(int a, int n)
{
	if (!n)
		return 1;
	int pt = pwmd(a, n / 2);
	pt *= pt, pt %= mod;
	if (n & 1)
		pt *= a, pt %= mod;
	return pt;
}*/

/*void dfs(int i,int par)
{
	for(int x:adj[i])
	{
		if(x!=par)
		{
			dfs(x,i);
		    sub[i]+=sub[x];
		}
	}
}*/
int pow(int a,int b,int m)
{
	int ans=1; 
	while(b>0)
	{ 
		if(b%2==1) 
			ans=(ans*a)%m; 
		 b/=2; 
		 a=(a*a)%m; 
	}
		return ans%m; 
}


int c1,c2,c3;
int dp[3005][3];
int32_t main()
{
	FIO;
	int n;
	cin>>n;
	n=n%10;

	if(n==3)
		cout<<"bon"<<endl;
	else if(n==0 || n==1 || n==6 || n==8)
		cout<<"pon"<<endl;
	else
		cout<<"hon"<<endl;


}

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

int main(void){
  vector<int> a(3);

  for(int i = 0; i < 3; i ++)
    cin >> a.at(i);

  sort(a.begin(), a.end());

  cout << a.at(1) - a.at(0) + a.at(2) - a.at(1) << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
#define max1 100005
#define sz1 100001
#define mod 1000000007
#define moda 421412341324321ll
#define inf 1e18
#define ll long long int
#define debug(x) cout<<#x<<" "<<x<<endl
typedef pair<ll,ll> pr;
#define rte cout<<"Correct";exit(0);

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  /*#ifndef ONLINE_JUDGE
  freopen("input.txt","r",stdin);
  freopen("output.txt","w",stdout);
  #endif*/
  ll n,m;
  cin>>n>>m;
  if(n<m)
  {
    for(ll i=0;i<m;i++)
    {
      cout<<n;
    }
  }
  else
  {
    for(ll i=0;i<n;i++)
    {
      cout<<m;
    }
  }
} 


Measured memory_bytes: 256
//package AtCoder;

//package AtCoder;
import java.io.*;
import java.util.*;

public class Main {
	static int h,w,a[][];
	static long dp[][];
	static long dp(int i,int j)
	{
		if(i == h-1 && j == w-1)
			return 1;
		
		if(dp[i][j] != -1)
			return dp[i][j];
		
		long right=0,down=0;
		if(j+1 < w && a[i][j+1] != '#')
			right = dp(i,j+1);
		
		if( i+1 < h && a[i+1][j] != '#')
			down = dp(i+1,j);
		
		return dp[i][j] = (right+down)%((int)1e9+7);
	}
	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner();
		PrintWriter pw = new PrintWriter(System.out);
		h=sc.nextInt();w=sc.nextInt();
		a=new int[h][w];
		dp=new long[h][w];
		for(int i=0;i<h;i++)
		{	
			String s=sc.nextLine();
			for(int j=0;j<w;j++)
			{	
				
				a[i][j]=s.charAt(j);
				dp[i][j]=-1;
			}
		}
		System.out.println(dp(0,0));
		pw.close();
	}

	static class Scanner {
		BufferedReader br;
		StringTokenizer st;

		Scanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() throws IOException {
			while (st == null || !st.hasMoreTokens()) {
				st = new StringTokenizer(br.readLine());
			}
			return st.nextToken();
		}

		int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		String nextLine() throws IOException {
			return br.readLine();
		}

		boolean hasnext() throws IOException {
			return br.ready();
		}

		public int[] nextIntArray(int n) throws IOException {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		public Integer[] nextIntegerArray(int n) throws IOException {
			Integer[] a = new Integer[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		char[] nextCharArray() throws IOException {
			return br.readLine().toCharArray();
		}

		public double[] nextDoubleArray(int n) throws IOException {
			double[] ans = new double[n];
			for (int i = 0; i < n; i++)
				ans[i] = nextDouble();
			return ans;
		}

	}
}


Measured memory_bytes: 40084