akhauriyash/Code-Regression huggingface dataset:
using namespace std;
#include<bits/stdc++.h>
#define BEGIN ios_base::sync_with_stdio(0);cin.tie(0)
#define END return EXIT_SUCCESS
#define FOR(I,A,B) for((I)=(A);(I)<(B);(I)++)
#define REP(I,N) FOR(I,0,N)
#define UP(I,A,B) for((I)=(A);(I)<=(B);(I)++)
#define DW(I,A,B) for((I)=(A);(I)>=(B);(I)--)
#define IN(P) cin>>(P)
#define IN2(P1,P2) cin>>(P1)>>(P2)
#define IN3(P1,P2,P3) cin>>(P1)>>(P2)>>(P3)
#define INS(I,N,V) REP(I,N) cin>>V[I]
#define INS2(I,N,V1,V2) REP(I,N) cin>>V1[I]>>V2[I];
#define INS3(I,N,V1,V2,V3) REP(I,N) cin>>V1[I]>>V2[I]>>V3[I];
#define OUT(P) cout<<P<<endl
#define OUT2(P1,P2) cout<<P1<<" "<<P2<<endl
#define OUT3(P1,P2,P3) cout<<P1<<" "<<P2<<" "<<P3<<endl
#define OUTS(I,N,V) REP(I,N) cout<<V[i]<<endl
#define ALL(C) (C).begin(),(C).end()
#define RALL(C) (C).rbegin(),(C).rend()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
typedef unsigned long ul;
const ul INF = 1LL<<60;
ul X,Y,len,num;
inline void solve(){
  IN2(X,Y);
  for(num=X;num<=Y;num*=2)len++;
  OUT(len);
}

int main(int argc,char**argv){
  BEGIN;
  solve();
  END;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
typedef long long ll;
namespace mp = boost::multiprecision;
using Mint = mp::cpp_int;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = int(a); i < int(b); i++)
#define all(v) v.begin(), v.end()
#define uni(v) v.erase(unique(all(v)), v.end())
#define sort_g(v) sort(all(v), greater<int>())
#define dump(x) cerr << #x << ' ' << '=' << ' ' << x << endl

int main() {
    string S;
    cin >> S;
    if(S.size() == 3) reverse(all(S));
    cout << S << endl;
}

Measured memory_bytes: 764
/**
 *  Author: Wasi Ur Rahman
 *  FROM RMSTU
**/
#include <bits/stdc++.h>
#define    fast    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std;
#define ll long long
set<string> s;
int main()
{
    fast;
    int t;
    cin >> t;

    while(t--){
        string str;
        cin >> str;
        s.insert(str);
    }
    cout << s.size() << endl;
    return 0;
}



Measured memory_bytes: 19272
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll inf = 100100100100;
int main(){
  ll a,b,c,d,e,f,i,j,k,l,noww,nows,answ = inf,anss = 0;
  scanf("%lld%lld%lld%lld%lld%lld",&a,&b,&c,&d,&e,&f);
  for(i=0;i*a*100<=f;i++){
    for(j=0;i*a*100+j*b*100<=f;j++){
      if(i==0 && j==0) continue;
      for(k=0;i*a*100+j*b*100+k*c<=f;k++){
        for(l=0;i*a*100+j*b*100+k*c+l*d<=f;l++){
          noww = i*a*100+j*b*100+k*c+l*d;
          nows = k*c+l*d;
          if(nows*(100+e) <= e*noww && nows*answ >= anss*noww){
            answ = noww;anss = nows;
          }
        }
      }
    }
  }
  printf("%lld %lld\n",answ,anss);
}

Measured memory_bytes: 256
// clang-format off
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define rep1(i,n) for(ll i=1, i##_len=(n); i<=i##_len; ++i)
#define rrep(i,n) for(ll i=n-1; i>=0; --i)
#define rrep1(i,n) for(ll i=n; i>0; --i)
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort(all(x))
#define SORT_DESC(x) sort((x).rbegin(),(x).rend())
#define pb push_back
#define mp make_pair
#define coutl cout<<fixed<<setprecision(10)
#define ANS(ans) cout<<ans<<endl
#define END(ans) ANS(ans); return
const ll LINF = (1LL << 62) - 1;
const int INF = (1 << 30) - 1;
template<class T>inline bool chmax(T &a, const T &b){if (a<b){a=b;return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if (b<a){a=b;return 1;}return 0;}
// clang-format on

void solve(long long N, long long W, std::vector<long long> w, std::vector<long long> v) {
  ll V = N * 1000 + 1;
  vector<vector<ll>> dp(N + 1, vector<ll>(V, INF));
  dp[0][0] = 0;
  rep(i, N) rep(sum_v, V) {
    if (sum_v - v[i] >= 0) {
      chmin(dp[i + 1][sum_v], dp[i][sum_v - v[i]] + w[i]);
    }
    chmin(dp[i + 1][sum_v], dp[i][sum_v]);
  }
  ll ans = 0;
  rrep(sum_v, V) {
    if (dp[N][sum_v] <= W) {
      ANS(sum_v);
      return;
    }
  }
}

// clang-format off
int main() {
  long long N;
  scanf("%lld",&N);
  long long W;
  scanf("%lld",&W);
  std::vector<long long> w(N);
  std::vector<long long> v(N);
  for(int i = 0 ; i < N ; i++){
    scanf("%lld",&w[i]);
    scanf("%lld",&v[i]);
  }
  solve(N, W, std::move(w), std::move(v));
  return 0;
}


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

int main() {
    int n;
    cin >> n;
    string s[n];

    for (int i = 0; i < n; i++) {
        cin >> s[i];
    }
    for (int i = 0; i < n; i++) {
        if (s[i] == "Y") {
            cout << "Four" << endl;
            exit(0);
        }
    }
    cout << "Three" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <functional>
#include <queue>
#include <string>
#include <cstring>
#include <numeric>
#include <cstdlib>
#include <cmath>
using namespace std;

typedef long long ll;

#define INF 10e17 // 4倍しても(4回足しても)long longを溢れない
#define rep(i,n) for(int i=0; i<n; i++)
#define rep_r(i,n,m) for(int i=m; i<n; i++)
#define END cout << endl
#define MOD 1000000007
#define pb push_back
#define sorti(x) sort(x.begin(), x.end())
#define sortd(x) sort(x.begin(), x.end(), std::greater<int>())
#define debug(x) std::cerr << (x) << std::endl;
#define roll(x) for (auto itr : x) { debug(itr); }

int main() {
  ll n;
  string s;
  cin >> n;
  cin >> s;

  vector<ll> sums(n + 1, 0), sumb(n + 1, 0);

  ll ans = INF, cntlast = 0;
  for (int i = 0; i < n; ++i) {
    if (s[i] == '.')  {
      sums[i + 1] = sums[i] + 1;
      sumb[i + 1] = sumb[i];
    } else {
      sumb[i + 1] = sumb[i] + 1;
      sums[i + 1] = sums[i];
    }
    // cout << sumb[i + 1] << " " << sums[i + 1] << endl;
  }

  bool flag = false;
  int pre = 0;
  for (int i = 0; i < n; ++i) {
    ll tmp = INF;
    if (s[i] == '#' and !flag) {
      flag = true;
      pre = i;
    } else if (s[i] == '#' and flag) {
      // white, black,  black, black,  white, white
      tmp = sumb[i] - sumb[pre] + sums[n] - sums[i];
      tmp = min(sums[i] - sums[pre]  + sums[n] - sums[i], tmp);
      tmp = min(tmp, sumb[i] - sumb[pre] + sumb[n] - sumb[i]);
    }

    ans = min(ans, tmp);
  }
  
  if (ans == INF and flag) {
    ans = min(sumb[n] - sumb[pre], sums[n] - sums[pre]);
  } else if (ans == INF and !flag) {
    ans = 0;
  }
  cout << ans << endl;
}


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

total = 0
count1 = 0
for i in range(n):
    total += a[i]
    if i % 2 == 0:
        if total <= 0:
            tmp = abs(total) + 1
            total += tmp
            count1 += tmp
    else:
        if total >= 0:
            tmp = abs(total) + 1
            total -= tmp
            count1 += tmp
count2 = 0
total = 0
for i in range(n):
    total += a[i]
    if i % 2 != 0:
        if total <= 0:
            tmp = abs(total) + 1
            total += tmp
            count2 += tmp
    else:
        if total >= 0:
            tmp = abs(total) + 1
            total -= tmp
            count2 += tmp
print(min(count1, count2))

Measured memory_bytes: 14468
import math
N,K=map(int,input().split())

def combinations_count(n,r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))

for i in range(1,K+1):
    if N-K+1>=i:
        print((combinations_count(N-K+1,i)*combinations_count(K-1,i-1))%(10**9+7))
    else:
        print(0)

Measured memory_bytes: 3316
import java.util.Scanner;

public class Main {
    public static void main(final String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final int x = scanner.nextInt();
        final int a = scanner.nextInt();

        if (x < a) {
            System.out.println(0);
        } else {
            System.out.println(10);
        }
    }
}


Measured memory_bytes: 21844
N=int(input())
if N==1:
    print(0)
    exit()

def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p

p = 10 ** 9 + 7
n = 10 ** 6  # N は必要分だけ用意する
fact = [1, 1]  # fact[n] = (n! mod p) 階乗のmod
factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1]  # factinv 計算用
 
for i in range(2, n + 1):
    fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)

ans=0
# otherの数
for i in range(0,N-1):
    # 0 or 9
    num09=N-i
    now=cmb(N, N-i,p)*(pow(2,N-i,p)-2)*pow(8,i,p)%p
    ans+=now
    ans%=p

print(ans)


Measured memory_bytes: 168396
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define Rep(i,n) for(int i=1;i<=(n);++i)
using LL = long long;
using ULL = unsigned long long;

int x[101];

int main()
{
    int n, k;
	cin >> n >> k;
	while(k--) {
		int d, a;
		cin >> d;
		while(d--) cin >> a, x[a] = 1;
	}
	int ans = 0;
	Rep(i, n) ans += x[i] == 0;
	cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) FOR(i, 0, (n))
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define LAR(a, b) ((a)=max((a),(b)))
#define SML(a, b) ((a)=min((a),(b)))
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vl = vector<ll>;
using pii = pair<int, int>;
using vpii = vector<pair<int, int>>;
template<typename T>
using pque = priority_queue<T, vector<T>, greater<T>>;
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define ALL(a) (a).begin(), (a).end()
#ifdef LOCAL_DEBUG
#define DEBUG(...) printf(__VA_ARGS__)
#else
#define DEBUG(...)
#endif

int main(){
	int n; scanf("%d", &n);
	ll ans = 0;
	FOR(i, 1, n+1){
		if(i%3 && i%5){
			ans += i;
		}
	}
	printf("%lld\n", ans);
}


Measured memory_bytes: 3824
# ABC 109, B - shiritori

n = int(input())
w = []
for i in range(n):
    w.append(input())


used = []

for i in range(n):
    if i == 0:
        used.append(w[i])
        tail = w[i][-1]
    else:
        # no if the same word is used
        if w[i] in used:
            print('No')
            break
        # no if the hean and tail is not equal
        elif w[i][0] != tail:
                print('No')
                break
        else:
            used.append(w[i])
            tail = w[i][-1]
else:
    print('Yes')


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define cc cin>>
#define st strlen
#define ch char
#define out cout<<
ch as[10010000];
ll ans,now,o;
int main()
{
	cc o;
	cc as;
	for(int i=0;i<st(as);i++)
	{
		if(as[i]=='I') now++;
		else now--;
		ans=max(ans,now);
	}
	out ans;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define ff first
#define ss second
#define P 1000000007
#define in(x, a, b) (a <= x && x < b)

using namespace std;
using ll = long long;
typedef pair<int, int> ii;
typedef vector<ii> vii; 
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
const ll inf = 1000000001, INF = (ll)1e18 + 1;

void solve() {
	int n, m, s, t;
	cin >> n >> m;
	
	vector<vvii> adj(n, vvii(3));
	for(int i = 0; i < m; i++) {
		int u, v;
		cin >> u >> v;
		u--; v--;
		
		for(int j = 0; j < 3; j++) {
			adj[u][j].pub({v, (j + 1) % 3});
		}
	}
	
	cin >> s >> t;
	s--; t--;
	
	priority_queue<pair<int, ii>> q;
	vvi dist(n, vi(3, inf));
	dist[s][0] = 0;
	q.push({-dist[s][0], {s, 0}});
	while(!q.empty()) {
		int node = q.top().ss.ff, state = q.top().ss.ss; q.pop();
		
		for(ii i : adj[node][state]) {
			if(dist[node][state] + 1 < dist[i.ff][i.ss]) {
				dist[i.ff][i.ss] = dist[node][state] + 1;
				q.push({-dist[i.ff][i.ss], {i.ff, i.ss}});
			}
		}
	}
	
	if(dist[t][0] == inf) cout << -1 << endl;
	else cout << dist[t][0] / 3 << endl;
}

int main(){
	ios_base::sync_with_stdio(false);
	solve();
    return 0;
}

Measured memory_bytes: 28328
#include <iostream>
#include<cstdlib>
#include<queue>
#include<set>
#include<vector>
#include<stack>
#include<map>
#include<string>
#include<algorithm>
#include<cstdio>
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
#define mp make_pair
#define pb push_back
#define P pair<int,int>
#define ll __int64
//#define __int64 long long
int n,m;
vector<int>G[300000];

int main(){
	cin>>n>>m;

	rep(i,m){
		int a,b;
		cin>>a>>b;
		a--;b--;
		G[a].push_back(b);
		G[b].push_back(a);
	}
	
	for(int i=0;i<G[0].size();i++){
			int x=G[0][i];
			for(int j=0;j<G[x].size();j++){
				if(G[x][j]==n-1){
				cout<<"POSSIBLE"<<endl;
				return 0;
			}
		}
	}
	cout<<"IMPOSSIBLE"<<endl;
	return 0;
}

Measured memory_bytes: 14320
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define all(z) (z).begin(),(z).end() 
#define MOD 1000000007
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll isprime(ll n)
{
	for(int i=2;i<n;i++)
		if(n%i==0)
		return 0;
		
	return 1;	
}
int main()
{ 
    FAST;
	ll a,b,c;
	cin>>a>>b>>c;
	if(a+b+c>=22)cout<<"bust";
	else cout<<"win";
}


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

#define long long int

const int D = 365;
vector<int> C(26), ans(D, 0);
vector<vector<int>> S(D, vector<int>(26));

void input()
{
    int tmp;
    cin >> tmp;
    rep(i,26) cin >> C[i];
    rep(i,D)rep(j,26) cin >> S[i][j];
    rep(i,D) cin >> ans[i]; rep(i,D) ans[i]--; //B,C問題用
}
void output()
{
    for(auto x : ans)
        cout << x+1 << "\n";
}
int calc(vector<int> &vec)
{
    int score = 0;
    vector<int> last(26, -1);
    rep(i,D) score += S[i][ans[i]];
    rep(i,D)
    {
        int cur = vec[i];
        last[cur] = i;
        rep(j,26)
        {
            score -= C[j] * (i - last[j]);
        }
    }
    return score;
}
void incremental()
{
    rep(t, 110000)
    {
        int d = rand() % D, q = rand() % 26;
        vector<int> old = ans;
        ans[d] = q;
        if(calc(ans) < calc(old))
            ans = old;
    }
}
void greedy()
{
    vector<int> last(26, -1);
    rep(i,D)
    {
      int cur = 0, pt = -1e9;
      rep(j,26)
      {
        int sum = S[i][j];
        rep(k, 26)
        {
          if(j == k) continue;
          sum -= C[k] * (i - last[k]);
        }
        if(sum > pt)
        {
          cur = j;
          pt = sum;
        }
      }
      ans[i] = cur;
      last[cur] = i;
    }   
}
void solve()
{
  greedy();
  incremental();
}

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


Measured memory_bytes: 3692
def resolve():
    n = int(input())
    aa = list(map(int, input().split()))

    if min(aa) == max(aa) == 0:
        flg = True
    else:
        flg = len(aa) % 3 == 0

        aa.sort()

        if flg:
            flg = aa[0]            == aa[len(aa)//3  -1] \
              and aa[len(aa)//3]   == aa[len(aa)//3*2-1] \
              and aa[len(aa)//3*2] == aa[len(aa)     -1]

        tmp1 = aa[0]
        tmp2 = aa[len(aa)//3]
        tmp3 = aa[len(aa)-1]

        if flg:
            flg = tmp1 == tmp2 ^ tmp3 and tmp2 == tmp1 ^ tmp3 and tmp3 == tmp1 ^ tmp2

    print('Yes' if flg else 'No')
    
resolve()

Measured memory_bytes: 60784
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair <int, int> P;

template <typename T> T gcd(T x, T y) { return( y ? gcd(y, x % y) : x); }
template <typename T> T lcm(T x, T y) { return( x / gcd(x, y) * y); }
template <typename T> void printVec(vector<T> &vec) {
  cout << "";
  for (auto it = vec.begin(); it != vec.end(); ++it) {
    cout << *it << " ";
  }
  cout << endl;
}

int main() {

  int n, k;
  cin >> n >> k;
  vector <int> p(n);
  for (int i = 0; i < n; i++) {
    cin >> p[i];
  }
  int ans = 0;
  sort(p.begin(), p.end());
  for (int i = 0; i < k; i++) {
    ans = ans + p[i];
  }
  cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3616
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String s = sc.next();
        char c = s.charAt(0);
        int ans = 1;
        for (int i = 1; i< n;i++) {
            if (c != s.charAt(i)) {
                ans++;
                c = s.charAt(i);
            }
        }
        System.out.println(ans);
    }
}


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

using namespace std;

static const double PI = 3.141592;

int main()
{
    int m,r,dr;
    double x = 0.0, y = 0.0;
    r = 0;
    while(scanf("%d,%d", &m, &dr) == 2 && (m != 0 || dr != 0)) {
        double dx = (m * cos(r * PI / 180.0)), dy = (m * sin(r * PI / 180.0));
        x += dx; y += dy;
        r = (r + dr + 360) % 360;
    }
    cout << (int)y << endl;
    cout << (int)x << endl;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int dp[30] ;
int main()
{

	memset(dp,100,sizeof dp);
	int n;
	cin >> n;
	vector<string>v;
    for(int i=1; i<=n; i++)
    {
        map<char,int>mp;
        string s;
        cin >> s;
        for(int i=0; i<s.size(); i++)
        {
            mp[s[i]]++;
        }
        for(char cc = 'a'; cc<='z'; cc++)
        {
            dp[cc-'a'] = min(dp[cc-'a'],mp[cc]);
        }

    }
    string ans = "" ;
    for(char c = 'a' ; c<='z' ; c++)
    {
        if(dp[c-'a'])
        {
            int kk = dp[c-'a'];
            while(kk--)ans+=c;
        }
    }
    cout << ans << endl;


}


Measured memory_bytes: 3616
#include<bits/stdc++.h>
#define inf 0x7fffffff
#define RG register
#define maxn 1000005
#define maxm 205
using namespace std;
typedef long long ll;
const ll mod = 1e9 + 7;
inline ll read(){
    ll x = 0, f = 1;
    char ch = getchar();
    while(ch > '9' || ch < '0') {if(ch == '-') f = -1;ch = getchar();}
    while(ch >= '0' && ch <= '9'){x = x *10 + ch -'0';ch = getchar();}
    return x * f;
}
 
int n, m, k, po[2][maxn];
int qpow(int a, int b){
	int ans = 1, base = a;
	while(b){
		if(b & 1) ans = 1ll * ans * base % mod;
		base= 1ll * base * base % mod;
		b >>= 1;
	}
	return ans;
}
int fac[maxn], inv[maxn], ans;
int C(int n, int m){return 1ll * fac[n] * inv[m] % mod *inv[n - m] % mod;}
int main(){
	int i, j, x, l, r, mid;
	fac[0] = po[0][0] = po[1][0] = 1;
	for(i = 1;i <= maxn - 5;i++) fac[i] = 1ll * fac[i - 1] * i % mod, po[0][i] = po[0][i - 1] * 2ll % mod, po[1][i] = po[1][i - 1] * 3ll % mod;
	inv[maxn - 5] = qpow(fac[maxn - 5], mod - 2);
	for(i = maxn - 6;i >= 0;i--) inv[i] = 1ll * inv[i + 1] * (i + 1) % mod; 
	n = read(), m = read(), k = read();
	int las = 1;
	for(i = 0;i <= m + k;i++){
		ans = (ans + 1ll * C(n + i - 1, n - 1) * po[1][m + k -i] % mod * las % mod) % mod;
		if(i + 1 <= m && i + 1 <= k) las = las * 2ll % mod;
		else{
			if(i + 1 <= k) las = ((las * 2ll - C(i, m)) % mod + mod) % mod; 
			else if(i + 1 <= m) las = ((las * 2ll - C(i, i - k)) % mod + mod) % mod;
			else las = (((las * 2ll - C(i, i - k)) % mod + mod - C(i, m) ) % mod + mod ) % mod;
		}
	}
	printf("%lld\n",ans);
	return 0;
}

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

namespace my {
/*汎用*/
template <typename T>
void input_vec(vector<T> &a, ll n) {
  if (!a.empty()) {
    cout << "error in input_vec" << endl;
    exit(1);
  }
  for (ll i = 0; i < n; i++) {
    T tmp;
    cin >> tmp;
    a.push_back(tmp);
  }
}
template <typename T>
void input_set(set<T> &a, ll n) {
  if (!a.empty()) {
    cout << "error in input_set" << endl;
    exit(1);
  }
  for (ll i = 0; i < n; i++) {
    T tmp;
    cin >> tmp;
    a.insert(tmp);
  }
}

char itoc(int i) { return i + '0'; }
int ctoi(char c) { return c - '0'; }

/*整数*/
ll gcd(ll a, ll b) {  // O( log(max(a,b)) )
  a = abs(a);
  b = abs(b);
  if (a < b) swap(a, b);
  while (b != 0) {
    a %= b;
    swap(a, b);
  }
  return a;
}
ll lcm(ll a, ll b) { return a * (b / my::gcd(a, b)); }  // O( log(max(a,b)) )
ll modinv(ll n, ll mod) {                               // O( log(max(n,mod)) )
  if (mod < 0 || my::gcd(n, mod) != 1) {
    cout << "error in modinv" << endl;
    exit(1);
  }
  n %= mod;
  if (n < 0) n += mod;
  ll a = mod, b = n, x = 1, y = 0;
  while (b != 0) {
    ll q = a / b, r = a % b;
    a = b;
    b = r;
    y -= q * x;
    swap(x, y);
  }
  y %= mod;
  if (y < 0) y += mod;
  return y;
}

bool isPrime(ll n) {  // O( sqrt(n) )
  bool flag = true;
  for (ll i = 2; i * i <= n; i++) {
    if (n % i == 0) {
      flag = false;
      break;
    }
  }
  return flag;
}
vector<pair<ll, ll>> primeFac(ll n) {  // O( sqrt(n) )
  vector<pair<ll, ll>> ret;
  for (ll i = 2; i * i <= n; i++) {
    if (n % i != 0) continue;
    ll exp = 0;
    while (n % i == 0) {
      n /= i;
      exp++;
    }
    ret.push_back(make_pair(i, exp));
  }
  if (n != 1) ret.push_back(make_pair(n, 1));
  return ret;
}
}  // namespace my
////////////////////////////////////////////////

class unionfind {
 private:
  /*根のparの値は「-(その木の要素数)」とする*/
  vector<ll> par;
  ll n_;

  ll root(ll a) {
    if (par.at(a) < 0)
      return a;
    else {
      par.at(a) = root(par.at(a));  //経路圧縮
      return par.at(a);
    }
  }

 public:
  unionfind(ll n) : n_(n), par(n, -1) {}

  void unite(ll a, ll b) {
    assert(0 <= a && a < n_);
    assert(0 <= b && b < n_);
    if (root(a) == root(b))
      return;
    else {
      ll ra = root(a), rb = root(b);
      if (-par.at(ra) < -par.at(rb)) swap(ra, rb);  //サイズによる併合
      par.at(ra) += par.at(rb);
      par.at(rb) = ra;
    }
  }

  bool is_same(ll a, ll b) {
    assert(0 <= a && a < n_);
    assert(0 <= b && b < n_);
    return root(a) == root(b);
  }

  ll size(ll a) {
    assert(0 <= a && a < n_);
    return -par.at(root(a));
  }
};

int main() {
  int n, m;
  cin >> n >> m;
  unionfind uf(n);
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    uf.unite(--a, --b);
  }

  ll sizemax = 0;
  for (int i = 0; i < n; i++) {
    sizemax = max(sizemax, uf.size(i));
  }
  cout << sizemax << endl;
}

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

using namespace std;

int main(){
  string s,t;
  cin>>s>>t;
  int cnt=0;
  for(int i=0;i<s.size();++i){
    if(s[i]!=t[i])
      cnt+=1;
  }
  cout<<cnt<<endl;
  return 0;
}


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

int main() {
  string s;
  cin >> s;
  int size = s.size();
  int start = -1;
  int end;
  for (int i = 0; i < size; i++) {
    if (start == -1 && s[i] == 'A') start = i;
    if (s[i] == 'Z') end = i;
  }
  cout << (end - start + 1) << endl;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define int long long int
#define double long double
#define inf (int)(1e15)
#define all(x) (x).begin(), (x).end()
#define pair pair<int, int>
typedef vector<int> vi;   // Vector of long long
typedef vector<vi> vvi;   // Vector of vi
typedef vector<pair> vii; // Vector of pairs
typedef vector<vii> vvii; // Vector of Vector of pairs
typedef vector<bool> vb;  // Vector of bool
#define pq priority_queue // Max heap (To convert to min heap, use negative sign before every value)
#define ff first          // For pairs
#define ss second
const int dx4[] = {1, 0, -1, 0}, dy4[] = {0, -1, 0, 1};
const int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1}, dy8[] = {1, -1, 1, 0, -1, 1, -0, -1};
#define testcases(t) \
    int(t);          \
    cin >> (t);      \
    while ((t)--)
signed main()
{
    int n, sum = 0, maxside = -1;
    cin >> n;
    for (int i = 0, side; i < n; i++)
    {
        cin >> side;
        sum += side;
        maxside = max(maxside, side);
    }
    if (2 * maxside >= sum)
        cout << "No" << endl;
    else
        cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 3596
# 解説AC
n,m=map(int,input().split())
x=list(map(int,input().split()))
y=list(map(int,input().split()))
mod=10**9+7
ans,ans2=0,0 #sum[0<=i<j<n](x[j]-x[i])を求める.
for i in range(n):
    ans=(ans+(-n+2*i+1)*x[i])%mod
for i in range(m):
    ans2=(ans2+(-m+2*i+1)*y[i])%mod
print(ans*ans2%mod)

Measured memory_bytes: 18624
#include<iostream>
#include<cstring>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
using namespace std;
#define rep(i,s,n) for(int i = s;i<n;i++)
#define repe(i,s,n) for(int i = s;i<=n;i++)
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
static const ll maxLL = (ll)1 << 62;
const int mod=1e9+7;

int main(){
    int n;
    cin>>n;
    vint a(n),b(n),c(n);
    rep(i,0,n)cin>>a[i];
    rep(i,0,n)cin>>b[i];
    rep(i,0,n)cin>>c[i];
    sort(a.begin(),a.end());
    sort(b.begin(),b.end());
    sort(c.begin(),c.end());
    
    ll ans=0;
    rep(i,0,n){
        ll x=lower_bound(a.begin(),a.end(),b[i])-a.begin();
        ll y=n-(upper_bound(c.begin(),c.end(),b[i])-c.begin());
        ans+=x*y;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define inf (int)(1e9+7)
#define INF (ll)(1e18)
#define abs(x) (x >= 0 ? x : -(x))
#define ceil(a, b) a / b + !!(a % b)
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }





int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    
    
    string s;
    cin >> s;
    map<char, int> mp;
    
    rep(i, sz(s)) {
        mp[s[i]] = 1;
    }
    
    if ((mp['S'] + mp['N'] == 1) || (mp['W'] + mp['E']) == 1) cout << "No" << endl;
    else cout << "Yes" << endl;
}


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


int main(){
 
    int p ;
    cin>>p;
    int n;
    cin>> n;
    int arr[n];
    for(int i=0;i<n;i++){
        cin>>arr[i];
    }
    int ans = INT_MAX;
    for(int i=0;i<n;i++){
        int x = arr[(i+1)%n] - arr[i];
        if(x<0){
            x += p;
        }
        ans = min(ans , p-x);
    }
    cout<<ans<<endl;
    return 0;
}

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


int main(){
	std::vector<std::vector<int>> obstacle;
	std::vector<std::vector<int>> road;
	int a,b;

	while(std::cin >> a >> b){
		//end
		if(a ==0 && b == 0)break;
		
		int obstacleNum;
		std::cin >> obstacleNum;

		std::vector<std::vector<int>> obstacle(a+1, std::vector<int>(b+1, 0));
		std::vector<std::vector<int>> road(a+1, std::vector<int>(b+1, 0));

		//obstacle input
		int tmp_a,tmp_b;
		for(int i = 0;i < obstacleNum; ++i) {
			std::cin >> tmp_a >> tmp_b;
			obstacle[tmp_a][tmp_b] = 1;
		}

		for (int i = 1; i <= a; ++i){
			for (int j = 1; j <= b; ++j){
				if(i == 1 && j == 1)road[i][j] = 1;
				else if(obstacle[i][j] == 1) road[i][j] = 0;
				else road[i][j] = road[i-1][j] + road[i][j-1];
			}
		}
		//output
		std::cout << road[a][b] << std::endl;

	}
	return 0;
}

Measured memory_bytes: 1220
#include <iostream>
#include <iomanip>
#include <fstream>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <string>
#include <tuple>
#include <vector>
#include <map>
#include <unordered_map>
#include <list>
#include <set>
#include <stack>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <cassert>
using namespace std;
#define LL long long
#define MP(a, b) make_pair(a, b)
#define POWER9 1000000000
#define MOD POWER9+7
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483647
#define INT_MAX 2147483647
#define LL_MIN (LL)-9223372036854775807
#define LL_MAX (LL)9223372036854775807
#define PI 3.14159265359

int N,A,B,C,l[8];
int ans = INT_MAX;
void solve(int now, int a, int b, int c, int cost){
	if(now == N){
		if(a==0 || b==0 || c==0) return;
		ans = min(ans, abs(A-a)+abs(B-b)+abs(C-c)+cost-30);
	}
	else{
		solve(now+1, a, b, c, cost);
		solve(now+1, a+l[now], b, c, cost+10);
		solve(now+1, a, b+l[now], c, cost+10);
		solve(now+1, a, b, c+l[now], cost+10);
	}
}

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

	cin >> N >> A >> B >> C;
	for(int i=0; i<N; i++) cin >> l[i];
	solve(0,0,0,0,0);
	cout << ans << endl;

	return 0;
}


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

int main(){
    int w,h;
    while(cin>>w>>h,w){
        auto vv=[&](int i,int j){
            return i*w+j;
        };

        vector<vector<int>> edge(w*h);
        for(int k=0;k<2*h-1;k++){
            if(k%2==0){
                for(int i=0;i<w-1;i++){
                    int val;
                    cin>>val;
                    if(val==0){
                        edge[vv(k/2,i)].push_back(vv(k/2,i+1));
                        edge[vv(k/2,i+1)].push_back(vv(k/2,i));
                    }
                }
            }
            else{
                for(int i=0;i<w;i++){
                    int val;
                    cin>>val;
                    if(val==0){
                        edge[vv(k/2,i)].push_back(vv(k/2+1,i));
                        edge[vv(k/2+1,i)].push_back(vv(k/2,i));
                    }
                }

            }
        }

        edge[vv(h-1,w-1)].push_back(h*w);
        queue<pair<int,int>> que;
        que.push({0,0});
        int res=-1;

        vector<int> been(h*w+1,0);
        been[0]=true;
        while(!que.empty()){
            pair<int,int> v=que.front();
            que.pop();
            if(v.first==h*w){
                res=v.second;
                break;
            }

            for(int i=0;i<edge[v.first].size();i++){
                int to=edge[v.first][i];
                
                if(!been[to]){
                
                    que.push({to,v.second+1});
                    been[to]=true;
                }
            }
        }
        cout<<(res!=-1 ? res : 0)<<endl;
        
    }
    return 0;
}

Measured memory_bytes: 3068
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <cfloat>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <numeric>

using namespace std;

typedef unsigned int UI;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int,int> PII;
typedef istringstream ISS;
typedef ostringstream OSS;

#define REP( i, m, n ) for ( int i = (int)( m ); i < (int)( n ); ++i )
#define FOR( v, c ) for ( auto &v : c )

#define ITER( c ) __typeof( (c).begin() )
#define EACH( it, c ) for ( ITER(c) it = c.begin(); it != c.end(); ++it )
#define ALL( c ) (c).begin(), (c).end()

#define PB( n ) push_back( n )
#define MP( a, b ) make_pair( ( a ), ( b ) )
#define EXIST( c, e ) ( (c).find( e ) != (c).end() )

#define fst first
#define snd second

#define DUMP( x ) cerr << #x << " = " << ( x ) << endl
#define DEBUG( x ) cerr << __FILE__ << ":" << __LINE__ << ": " << #x << " = " << ( x ) << endl

vector<int> eratosthenes( int n )
{
	vector<bool> nums( n + 1, true );
	nums[0] = nums[1] = false;
	vector<int> res;

	for ( int i = 0; i < nums.size(); i++ )
	{
		if ( !nums[i] )
		{
			continue;
		}

		res.push_back( i );
		for ( int j = 1; i * j < nums.size(); j++ )
		{
			nums[ i * j ] = false;
		}
	}

	return res;
}

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

	VI primes = eratosthenes( 10000 );

	int n;
	while ( cin >> n )
	{
		VI num( n ), rev( n );
		REP( i, 0, n )
		{
			num[i] = i + 1;
			rev[i] = n - i;
		}

		int res = 0;
		REP( i, 0, n )
		{
			res += binary_search( ALL( primes ), num[i] ) && binary_search( ALL( primes ), rev[i] );
		}

		cout << res << endl;
	}

	return 0;
}

Measured memory_bytes: 1320
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<map>
#include<set>
#include<cstring>
#define inf 0x3f3f3f3f
using namespace std;
typedef long long LL;

const int maxn=1e6+7;
char a[maxn];

int main (){
	int a,b;
	cin>>a>>b;
	if(a*b==15) puts("*");
	else if(a+b==15) puts("+");
	else puts("x");
	return 0;
}


Measured memory_bytes: 256
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  x=I()

  ans=0
  while True:
    if x//500>0:
      ans+=(x//500)*1000
      x=x%500
    else:
      ans+=(x//5)*5
      return ans

# main()
print(main())


Measured memory_bytes: 5680
#include <bits/stdc++.h>
#include <set>
#include <queue>

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++) 
#define reps(i, s, n) for (int i = s; i < (int)(n); i++) 
#define ll long long
#define ld long double
#define repl(i, n) for (ll i = 0; i < (ll)(n); i++) 
#define repsl(i, s, n) for (ll i = s; i < (ll)(n); i++)  
#define outdeb(fir, sec, thr) cout << fir << ":" << sec << ":" << thr << endl
#define readVarll(nam) ll nam; cin >> nam
#define INF 99999999999

ll calc(ll n, ll k)
{
  return n;
}

int main()
{
  string s;
  cin >> s;
  int sum = 0;
  repl(i, s.length())
  {
    int a = s[i] - '0';
    sum += a;
  }

  string ans = "Yes";
  if(sum % 9 != 0)
  {
    ans = "No";
  }

  cout << fixed << ans << endl;

  return 0;
}

Measured memory_bytes: 3720
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define INF LLONG_MAX/10
#define rep(i,n) for(int i=0;i<n;i++)
#define krep(i,k,n,m) for(int i=k;i<n;i+=m)
#define erep(i,k,n) for(int i=k;i<n;i++)
#define mod 1000000007
//最大公約数
int gcd(int s,int t){
    if(t==0)return s;
    return gcd(t,s%t);
}
signed main(){
    int a;
    cin>>a;
    cout<<a+a*a+a*a*a<<endl;
}


Measured memory_bytes: 3628
#include <stdio.h>
#include <algorithm>

int m = 0;
int count = 0;
int G[1000000];

void trace(int a[], int size) {
    for (int i = 0; i < size; ++i) {
        if (i > 0) {
            printf(" ");
        }
        printf("%d", a[i]);
    }
    printf("\n");
}

void InsertionSort(int A[], int N, int g) {
    for (int i = g; i < N; ++i) {
        int key = A[i];
        int j = i - g;
        while (j >= 0 && A[j] > key) {
            A[j+g] = A[j];
            j = j - g;
            count++;
        }
        A[j + g] = key;
    }
}

void ShellSort(int A[], int N) {
    int g = 0;
    while(true) {
        g = 3 * g + 1;
        if (g > N) { break; }
        G[m] = g;
        ++m;
    }
    for (int i = m - 1; i >= 0; --i) {
        InsertionSort(A, N, G[i]);
    }

}

int main() {
    int N;
    int A[1000000];

    scanf("%d", &N);
    for (int i = 0; i < N; i++) {
        scanf("%d", &A[i]);
    }

    ShellSort(A, N);

    printf("%d\n", m);
    for (int i = m - 1; i >= 0; --i) {
        printf("%d", G[i]);
        if (i > 0) printf(" ");
    }
    printf("\n");
    printf("%d\n", count);
    for (int i = 0; i < N; i++) {
        printf("%d\n", A[i]);
    }
    return 0;
}

Measured memory_bytes: 6656
#include<algorithm>//sort(all(変数),greater<型名>())　で降順に
#include<cmath>//切り上げceil(値)
#include<deque>
#include<iomanip>//setprecision(数字)
#include<iostream>
#include<list>
#include<map>
#include<numeric> //xとyの最大公約数は__gcd(x,y),xとyの最小公倍数は(x*y)/__gcd
#include<queue>//priority_queue<型名> 変数：優先度付きキュー　最大値の探索が早い
#include<set>
#include<stack>
#include<string>
#include<vector>

#include<bits/stdc++.h>
#include<cstdio>
#include<cstdlib>
#include<limits>
#include<tuple>
#include<utility>
#define rep0(i,n)  for(ll i=0; i<n; i++)
#define rrep0(i,n) for(ll i=n-1; 0<=i; i--)
#define rep1(i,n)  for(ll i=1; i<=n; i++)
#define rrep1(i,n) for(ll i=n; 1<=i; i--)
#define vll vector<ll>
#define vi vector<int>
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define INF 1e18
using ll = long long;
using namespace std;

int main(){
  ll n; cin >> n;
  ll x = sqrt(n)+1;
  while(n%x != 0){
    x--;
  }
  cout << x+n/x-2;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int left = n - 1;
		long[][] ans = new long[left][21];
		ans[0][in.nextInt()] = 1;
		for (int i = 1; i < left; i++) {
			int val = in.nextInt();
			for (int num = 0; num <= 20; num++) {
				if (ans[i - 1][num] != 0) {
					if (0 <= num - val)
						ans[i][num - val] += ans[i - 1][num];
					if (num + val <= 20) {
						ans[i][num + val] += ans[i - 1][num];
					}
				}
			}
		}
		System.out.println(ans[left - 1][in.nextInt()]);

	}

}

Measured memory_bytes: 18252
#include<cstdio>
const int MOD = 998244353;
const int MAXA = 1000000;
inline int add(int a, int b) {return (a + b)%MOD;}
inline int mul(int a, int b) {return 1LL*a*b%MOD;}
inline int sub(int a, int b) {return add(a,MOD-b);}
bool nprm[MAXA + 5];
int prm[MAXA + 5], mu[MAXA + 5], pcnt;
void sieve() {
	mu[1] = 1;
	for(int i=2;i<=MAXA;i++) {
		if( !nprm[i] )
			prm[++pcnt] = i, mu[i] = MOD - 1;
		for(int j=1;i*prm[j]<=MAXA;j++) {
			nprm[i*prm[j]] = true;
			if( i % prm[j] == 0 ) {
				mu[i*prm[j]] = 0;
				break;
			}
			else mu[i*prm[j]] = MOD - mu[i];
		}
	}
}
int f[MAXA + 5], iv[MAXA + 5];
void init() {
	iv[1] = 1;
	for(int i=2;i<=MAXA;i++)
		iv[i] = MOD - mul(MOD / i, iv[MOD % i]);
	for(int i=1;i<=MAXA;i++)
		for(int j=i;j<=MAXA;j+=i)
			f[j] = add(f[j], mul(mu[j/i], iv[i]));
}
int cnt[MAXA + 5];
int main() {
	sieve(), init();
	int N, x; scanf("%d", &N);
	for(int i=1;i<=N;i++)
		scanf("%d", &x), cnt[x]++;
	int ans = 0;
	for(int i=1;i<=MAXA;i++) {
		int sum = 0, del = 0;
		for(int j=i;j<=MAXA;j+=i) {
			if( cnt[j] ) {
				del = add(del, mul(cnt[j], mul(sum, j)));
				del = add(del, mul(1LL*cnt[j]*(cnt[j]-1)/2%MOD, mul(j, j)));
				sum = add(sum, mul(cnt[j], j));
			}
		}
		ans = add(ans, mul(f[i], del));
	}
	printf("%d\n", ans);
}

Measured memory_bytes: 18560
n = int(input())
a = [list(map(int,input().split())) for i in range(2)]
ans = 0
su1 = [0]*n
su2 = [0]*n
su1[0],su2[0] = a[0][0],a[1][0]
for i in range(n):
    if i>0:
        su1[i] = su1[i-1]+a[0][i]
        su2[i] = su2[i - 1] + a[1][i]
#print(su1)
#print(su2)
for i in range(n):
    temp = su1[i]+su2[n-1]-(su2[i-1] if i>0 else 0)
    ans = max(ans, temp)
print(ans)

Measured memory_bytes: 3064
#include <stdio.h>
int main(void){
    int a,b;
    scanf("%d%d",&a,&b);
    if(a==1){
        if(b==2){
            printf("3");
        }
        if(b==3){
            printf("2");
        }
    }
    if(a==2){
        if(b==1){
            printf("3");
        }
        if(b==3){
            printf("1");
        }
    }
    if(a==3){
        if(b==1){
            printf("2");
        }
        if(b==2){
            printf("1");
        }
    }
    return 0;
}


Measured memory_bytes: 128
MOD = (10 ** 9) + 7

list_size = 1000000

f_list = [1] * list_size
f_r_list = [1] * list_size

for i in range(list_size - 1):
	f_list[i + 1] = int((f_list[i] * (i + 2)) % MOD)

def power(n, x):
	if x == 1:
		return n
	elif x % 2 == 0:
		return power(int((n * n) % MOD), int(x / 2))
	else:
		return int((n * power(n, x - 1)) % MOD)

f_r_list[-1] = power(f_list[-1], MOD - 2)

for i in range(2, list_size + 1):
	f_r_list[-i] = int((f_r_list[-i + 1] * (list_size + 2 - i)) % MOD)

def factorial(i):
	if i == 0:
		return 1
	else:
		return f_list[i-1]

def comb(n, r):
	if n < r:
		return 0
	elif n == 0 or r == 0 or n == r:
		return 1
	else:
		return (((f_list[n - 1] * f_r_list[n - r - 1]) % MOD) * f_r_list[r - 1]) % MOD 

n = int(input())
ans = ((n - 1) * factorial(n - 1)) % MOD
for i in range(n - 2, (n + 1) // 2 - 1, -1):
	ans -= comb(i - 1, n - i - 1) * factorial(n - i - 1) * factorial(i)
	ans %= MOD
	#print(ans, cnt)
print(ans)

Measured memory_bytes: 56940
// {{{
#include <iostream>
#include <iomanip>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <complex>
#include <vector>
#include <list>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <algorithm>
#include <numeric>
using namespace std;

#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define FOR(i, a, b) for(ll i = static_cast<ll>(a); i < static_cast<ll>(b); i++)
#define FORR(i, a, b) for(ll i = static_cast<ll>(a); i >= static_cast<ll>(b); i--)
#define REP(i, n) for(ll i = 0ll; i < static_cast<ll>(n); i++)
#define REPR(i, n) for(ll i = static_cast<ll>(n); i >= 0ll; i--)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> IP;
typedef pair<ll, LP> LLP;

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

constexpr int INF = 100000000;
constexpr ll LINF = 10000000000000000ll;
constexpr int MOD = static_cast<int>(1e9 + 7);
constexpr double EPS = 1e-9;

static inline ll mod(ll x, ll m)
{
    ll y = x % m;
    return (y >= 0 ? y : y+m);
}

// }}}

double n;

void solve()
{
    int m = ((int)n % 2 == 0 ? (int)n/2 : (int)n/2+1);
    cout << fixed << setprecision(9) << (double)m/n << endl;
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n;
    solve();
    return 0;
}

// vim:set foldmethod=marker:


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <stack>
#include <algorithm>
#include <sstream>
#include <limits.h>
using namespace std;

int main()
{
    std::string s; 
    std::getline(std::cin, s);
    //cout << s << endl;

    std::vector<std::string> v;
    istringstream iss(s);
    std::string tmp;
    while(iss >> tmp){
        v.push_back(tmp);
    }

    int ans = 0;
    std::stack<int> st;
    std::vector<std::string>::iterator itr = v.begin();
    while(itr != v.end()){
        std::string str = *itr;
        if(str == "+" || str == "-" || str == "*"){
            int op2 = st.top(); st.pop();
            int op1 = st.top(); st.pop();
            //cout << op1 << str << op2 << endl;
            if(str == "+") st.push(op1 + op2);
            else if(str == "-") st.push(op1 - op2);
            else if(str == "*") st.push(op1 * op2);
        }else{
            int num = std::stoi(str);
            st.push(num);
        }
        ++itr;
    }
    cout << st.top() << endl;
}


Measured memory_bytes: 3208
#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>;

int main() {
  int n;
  cin >> n;
  vector<ll> l(n);
  rep(i, n) cin >> l[i];

  ll ans = 0;
  for(int i=0;i<n;i++) {
    for(int j=i+1;j<n;j++) {
      for(int k=j+1;k<n;k++) {
        bool is = false;
        if(l[i] != l[j] && l[j] != l[k] && l[i] != l[k]) {
          int lm = max({ l[i], l[j], l[k] });
          int ot = l[i] + l[j] + l[k] - lm;
          if(lm < ot) {
            is=true;
            ans++;
          }
        }
        // if(is) cout << i+1 << "," << j+1 << "," << k+1 << endl;
      }
    }
  }
  cout << ans << endl;
  return 0;
}


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

int main(void){

    string S;
    cin >> S;


    vector<char> Nums;
    for(char c : S){
        Nums.push_back(c);
    }

    int blue=0, red=0;
    for(int i=0;i<Nums.size();i++){
        if(Nums[i]=='1'){
            blue++;
        } else {
            red++;
        }
    }

    cout << min(blue*2, red*2) << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define all(v) v.begin(),v.end()

using namespace std;
typedef long long ll;




int main()
{
    
    string S;
    cin >> S;
    
    string ss = S.substr(0, 4) + S.substr(5, 2) + S.substr(8, 2);
    int a = stoi(ss);
    
    
    if (a <= 20190430) {
        cout << "Heisei" << endl;
        
    }else{
        cout << "TBD" << endl;
    }
    
    
    return 0;
}



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

using namespace std;

typedef double db;
typedef long long ll;
typedef long double ld;
typedef unsigned int ui;
typedef unsigned long long ull;

typedef pair < db, db > pdd;
typedef pair < db, ld > pdl;
typedef pair < ld, db > pld;
typedef pair < ld, ld > ldp;

typedef pair < ll, ll > pll;
typedef pair < int, ll > pil;
typedef pair < ll, int > pli;
typedef pair < int, int > pii;

#define F first
#define S second

#define en end()
#define bg begin()

#define rev reverse
#define mp make_pair
#define pb push_back

#define y1 y1234567890
#define um unordered_map

#define all(x) x.bg, x.en
#define sz(x) (int)x.size()
#define len(x) (int)strlen(x)

#define sqr(x) ((x + 0ll) * (x))
#define sqrd(x) ((x + 0.0) * (x))

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

const ll inf = (ll)1e18;
const ll mod = (ll)1e9 + 7;

const db eps = (db)1e-9;
const db pi = acos(-1.0);

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

const int N = 200500;
const int shift = 100001;

int n, a[N], p[N], t[N];

inline void add(int i) {
	for (; i < N; i += i & -i)
		t[i]++;
}

inline int get(int i) {
	int res = 0;
	for (; i >= 1; i -= i & -i)
		res += t[i];
	return res;
}

inline bool check(int x) {
	memset(t, 0, sizeof(t));
	ll res = 0;
	for (int i = 1; i <= n; i++) {
		add(p[i - 1] + shift);
		p[i] = p[i - 1] + (a[i] >= x ? 1 : -1);
		res += get(p[i] + shift);
	}
	return res >= (n * (n + 1ll) / 2 + 1) / 2;
}

int main() {
	//freopen(".in", "r", stdin);
	//freopen(".out", "w", stdout);
	//freopen(".err", "w", stderr);

	//srand(time(NULL));

	cin.tie(NULL);
	cout.tie(NULL);
	ios_base::sync_with_stdio(false);

	//cout << setprecision(10) << fixed;
	
	cin >> n;

	for (int i = 1; i <= n; i++)
		cin >> a[i];

	int l = 1, r = (int)1e9, ans;

	while (l <= r) {
		int mid = (l + r) >> 1;
		if (check(mid)) {
			ans = mid;
			l = mid + 1;
		}
		else
			r = mid - 1;
	}

	cout << ans;
	
	//cerr << (clock() + 0.0) / CLOCKS_PER_SEC;

	return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define ll long long
#define pet pair<int,int>
#define one first
#define two second

#ifdef debug
#define cin fin 
#define fileopen fin.open("test.txt");
#else
#define fileopen
#endif

#define int long long
#define big 1000000007
#define all(x) x.begin(),x.end()

using namespace std;

ifstream fin;

vector<vector<int>> primes;

int power(int a,int b,int m=big)
{
	if(b==0)
	return 1;

	int ans=power(a,b/2,m);
	if(b%2==0)
	return ans*ans%m;

	return ((a*ans)%m*ans)%m;
}

int inverse(int a,int m=big)
{
	return power(a,m-2,m);
}

int ceil(int a,int b)
{
	return (a-1)/b+1;
}

void init_prime()
{
	int size=1e6+1;
	primes.resize(1e6);

	for(int i=2;i<size;i++)
	{
		if(primes[i].size()==0)
		{
			for(int j=i;j<size;j+=i)
			primes[j].push_back(i);
		}
	}
}

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


/*_______________________________

			START
			FROM
			BELOW

		  #pragyanc2#
________________________________
*/

void solve()
{
    double n;
    cin >> n;

    double stuff = n/3;

    cout << fixed << setprecision(15);

    cout << stuff*stuff*stuff;
}

signed main()
{
	fileopen
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	
	//init_prime();

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

	for(int i=1;i<=1;i++)
	solve();
}

Measured memory_bytes: 256