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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define LCM(a, b) (a) / __gcd((a), (b)) * (b)
#define CEIL(a, b) (a)/(b)+(((a)%(b))?1:0)
#define ln '\n'

using namespace std;
using LL = long long;
using ldouble = long double;
using P = pair<int, int>;
using LP = pair<LL, LL>;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1e9 + 7;
static const int SIZE = 200005;

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

vector<LL> Div(LL n) {
    vector<LL> ret;
    for(LL i = 1; i * i <= n; ++i) {
        if(n % i == 0) {
            ret.pb(i);
            if(i * i != n) ret.pb(n / i);
        }
    }
    sort(all(ret));
    return ret;
}

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

    int N;
    cin >> N;
    vector<int> v(N);
    for(int i = 0; i < N; ++i) {
        cin >> v[i];
    }
    sort(all(v));

    LL a, b;
    a = 0, b = 0;
    for(int i = 0; i < N - 1; ++i) {
        if(v[i] == v[i + 1]) {
            b = a;
            a = v[i];
            i++;
        }
    }
    cout << a * b << endl;

    return 0;
}


Measured memory_bytes: 3700
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>

int main(){
    int x, t;
    std::cin>>x>>t;

    std::cout<<(x - t >= 0 ? x - t : 0)<<std::endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1LL<<60;
#define REP(i,n) for(int i=0; i<(n);++i)
#define FOR(i,k,n) for(int i=(k);i<(n);++i)
 
int main(){
    int N;cin>>N;
    vector<ll> a(N);
    REP(i,N)cin>>a[i];
    vector<vector<ll>> dp(N,vector<ll>(N,0LL));
    if(N%2==0){
        REP(i,N)dp[i][0]=-a[i];
        FOR(j,1,N)FOR(i,0,N){
            if(i+j>=N)continue;
            else{
                if((j+1)%2==0){
                    dp[i][j]=max(a[i]+dp[i+1][j-1],a[i+j]+dp[i][j-1]);
                }else{
                    dp[i][j]=min(-a[i]+dp[i+1][j-1],-a[i+j]+dp[i][j-1]);
                }
            }
        }
    }
    if(N%2==1){
        REP(i,N)dp[i][0]=a[i];
        FOR(j,1,N)FOR(i,0,N){
            if(i+j>=N)continue;
            else{
                if((j+1)%2==0){
                    dp[i][j]=min(-a[i]+dp[i+1][j-1],-a[i+j]+dp[i][j-1]);
                }else{
                    dp[i][j]=max(a[i]+dp[i+1][j-1],a[i+j]+dp[i][j-1]);
                }
            }
        }
    }
    cout<<dp[0][N-1]<<endl;
    return 0;
}

Measured memory_bytes: 70784
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>

using Int = long long int;
using Char = char;
using String = std::string;
template <class T>
using Vector = std::vector<T>;

int main() {
    Int h, w;
    std::cin >> h >> w;
    Int n = std::max(h, w) + 2;

    Vector<String> s(n, String(n, '#'));
    for (Int x = 1; x <= h; ++x) {
        for (Int y = 1; y <= w; ++y) {
            std::cin >> s[x][y];
        }
    }

    Int x, y;
    auto search = [&] {
        for (x = 0; x < n; ++x) {
            for (y = 0; y < n; ++y) {
                if (s[x][y] != '#' &&
                    s[x][y] != '.' &&
                    s[x][y] != 'G' &&
                    s[x][y] != 'o') return;
            }
        }
    };

    auto rotateL = [&] {
        for (Int i = 0; i < n; ++i) {
            for (Int j = 0; j < i; ++j) {
                std::swap(s[i][j], s[j][i]);
            }
        }
        std::reverse(s.begin(), s.end());
        search();
    };

    auto rotateR = [&] {
        std::reverse(s.begin(), s.end());
        for (Int i = 0; i < n; ++i) {
            for (Int j = 0; j < i; ++j) {
                std::swap(s[i][j], s[j][i]);
            }
        }
        search();
    };

    search();
    {
        Char dir = s[x][y];
        s[x][y] = '^';
        if (dir == '>') {
            rotateL();
        } else if (dir == '<') {
            rotateR();
        } else if (dir == 'v') {
            rotateL(), rotateL();
        }
    }

    /*
    std::cerr << "begin" << '(' << x << ',' << y << ')' << std::endl;
    for (auto& v : s) {
        std::cerr << v << std::endl;
    }
    */

    for (Int t = 0; t < n * n * 10; ++t) {
        if (s[x - 1][y] == '#') {
            rotateR();
        } else {
            s[x][y] = 'o';
            --x;
            if (s[x][y] == 'G') break;
            s[x][y] = '^';

            if (s[x][y + 1] != '#') rotateL();
        }

        /*
        std::cerr << t << '(' << x << ',' << y << ')' << std::endl;
        for (auto& v : s) {
            std::cerr << v << std::endl;
        }
        */
    }

    Int ans = -1;
    if (s[x][y] == 'G') {
        s[x][y] = 'o';
        ans = 0;
        for (auto& v : s) ans += std::count(v.begin(), v.end(), 'o');
    }

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



Measured memory_bytes: 3184
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<vector>
#include<functional>
#include<algorithm>
#include<stdlib.h>
#include<string>
#include<string.h>
#define _USE_MATH_DEFINES
#include<math.h>
#include<deque>
#include<set>
#include<map>
#include<queue>
#include<list>
#include<iostream>
#include <bitset>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(auto i=a;i<b;i++)
#define all(_x) _x.begin(), _x.end()
#define r_sort(_x) sort(_x.begin(), _x.end(), std::greater<int>())
#define vec_cnt(_a, _n) (upper_bound(all(_a), _n) - lower_bound(all(_a), _n))
#define vec_unique(_a) _a.erase(std::unique(all(_a)), _a.end());
#define vvec vector<vector<ll>>
ll gcd(ll a, ll b) { return a % b == 0 ? b : gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
#define INF 1 << 30
const int mod = 1000000007;
ll power(ll x, ll p) { ll a = 1; while (p > 0) { if (p % 2 == 0) { x *= x; p /= 2; } else { a *= x; p--; } }return a; }
ll mpower(ll x, ll p) { ll a = 1; while (p > 0) { if (p % 2 == 0) { x = x * x % mod; p /= 2; } else { a = a * x % mod; p--; } }return a; }
ll c(ll n, ll k) { ll a = 1; rep(i, 1, k) { a *= n - i + 1; a /= i; }return a; }
ll mc(ll n, ll m) { ll k = 1, l = 1; rep(i, n - m + 1, n + 1) k = k * i % mod; rep(i, 1, m + 1) l = l * i % mod; l = mpower(l, mod - 2); return k * l % mod; }
int main(void) {
	int T;
	cin >> T;
	rep(_i, 0, T) {
		ll N, A, B, C, D, V[3], a, b, x[3] = {2, 3, 5}, c = 0;
		cin >> N >> A >> B >> C >> D;
		V[0] = A;
		V[1] = B;
		V[2] = C;
		deque<pair<ll, ll>> v;
		map<ll, ll> mp;
		v.push_back(make_pair(N, 0));
		ll ans = 1ll << 60;
		while (v.size()) {
			c++;
			auto it = v.front();
			v.pop_front();
			//printf("%lld %lld\n", it.second, it.first);
			if(D < 10000)ans = min(ans, it.second + it.first * D);

			if (it.first == 0) {
				ans = min(ans, it.second);
			}
			else {
				if (it.second >= ans)continue;
				rep(i, 0, 3) {
					a = (it.first - it.first % x[i]) / x[i];
					b = it.second + (a != 0) * V[i] + it.first % x[i] * D;
					if (mp[a] == 0 || mp[a] > b) {
						v.push_back(make_pair(a, b));
						mp[a] = b;
					}
					a = (it.first - it.first % x[i]) / x[i] + 1;
					b = it.second + V[i] + (x[i] - it.first % x[i]) * D;
					if (mp[a] == 0 || mp[a] > b) {
						v.push_back(make_pair(a, b));
						mp[a] = b;
					}
				}
			}
		}
		printf("%lld\n", ans);
	}
	return 0;
}


Measured memory_bytes: 4736
def main():
    N = int(input())
    F = [[int(i) for i in input().split()] for j in range(N)]
    P = [[int(i) for i in input().split()] for j in range(N)]
    ans = [0] * (1 << 10)
    for i in range(N):
        for bit in range(1 << 10):
            c = 0
            for j in range(10):
                if bit & (1 << j):
                    if F[i][j] == 1:
                        c += 1
            ans[bit] += P[i][c]
    ans[0] = -(1 << 60)
    print(max(ans))


if __name__ == '__main__':
    main()


Measured memory_bytes: 41836
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <vector>
#include <numeric>
#include <algorithm>
#include <iostream>
#include <string>
#include <cstring>
#include <sstream>
#include <functional>
#include <queue>
#include <deque>
#include <stack>
#include <cassert>
#include <bitset>
#include <cmath>
#include <iomanip>

using namespace std;

using int64 = long long;

/////////////////////
// Code starts here//
/////////////////////


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

    int N, K;
    cin >> N >> K;

    vector<int> A(N);
    for (int i = 0; i < N; i++)
        cin >> A[i];

    vector<int> dp(N);

    for (int i = 1; i < N; i++) {
        dp[i] = dp[i-1] + abs(A[i] - A[i-1]);
        for (int j = 2; j <= K; j++)
            if (i - j >= 0)
                dp[i] = min(dp[i], dp[i-j] + abs(A[i] - A[i-j]));
    }

    cout << dp[N-1] << "\n";

    return 0;
}


Measured memory_bytes: 1024
import sys
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def NI(): return int(sys.stdin.readline())


N = NI()
a = [0, 0, 0]
for x in LI():
    a[x-1] += 1
dp = [[[0.0] * (N+1) for _ in range(N+1)] for _ in range(N+1)]

for k in range(a[2]+1):
    for j in range(a[1]+a[2]+1):
        for i in range(N+1):
            if not (0 < i+j+k <= N):
                continue
            x = 0.0
            if i > 0:
                x += dp[i-1][j][k] * (i/N)
            if j > 0:
                x += dp[i+1][j-1][k] * (j/N)
            if k > 0:
                x += dp[i][j+1][k-1] * (k/N)
            x += 1.0
            x *= N / (i+j+k)
            dp[i][j][k] = x
print(dp[a[0]][a[1]][a[2]])


Measured memory_bytes: 254472
#include <cstdlib>
#include <iostream>
#include <string>
#include <time.h>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <iomanip>
#include <vector>
#include <functional>
//#include "bits/stdc++.h"
using namespace std;
//using namespace std::vector;
#define rep(i,a,b) for(int i=(a);i<(b);++i)

#define huge 1000000007
typedef long long ll;
ll gcd(ll a, ll b);

int main(void) {

	ll N = 0;
	ll A = 0;
	ll B = 0;
	ll C = 0;
	ll X = 0;
	ll M = 0;
	ll Q = 0;
	//ll x[500][500] = {};
	//ll c[100000] = {};
	//ll v[100] = {};
	ll *x, *c, *d;
	string S[100],T,U;
	ll count = 0;
	ll sum = 0;
	ll min = 100000;
	ll max = 0;
	int flag = 0;
	char temp,head;
	//int is = 0;
	

	//char p;
	cin >> N >> A >> B;
	//x = (ll *)malloc((N+1) * sizeof(ll));
	//c = (ll *)malloc((N) * sizeof(ll));

	if ((N == 1 && A != B) || A > B)
		cout << 0 << endl;
	else
		cout << (B*(N - 1) + A) - (A*(N - 1) + B) + 1 << endl;

	//cin >> D >> G;
	//vector<pair<int,int>> tr(M);
	//vector<pair<int,int>> qes(Q);
	//sort(is.begin(), is.end());
	
	//c = (ll *)malloc(D * sizeof(ll));
	//d = (ll *)malloc(D * sizeof(ll));

	//sort(l,l+N);


	return 0;

}

ll gcd(ll a, ll b) {
	ll c;
	c = a % b;
	while (c != 0) {
		a = b;
		b = c;
		c = a % b;
	}

	return b;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
  using namespace std;
  typedef long long int ll;
  #define mod 1000000007
  #define all(v)  v.begin(),v.end()
  #define pb push_back
  #define size(v)  (int) v.size()
  #define fast ios_base:: sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL)
  ll power_mod(ll a,ll x){if(x==0) return 1;ll y=power_mod(a,x/2);ll ans=(y*y)%mod; if(x%2) ans=(ans*a)%mod;return ans;}
  ll inv(ll a){return power_mod(a,mod-2);}
  ll power(ll a, ll x){ if(x==0) return 1; ll y= power(a,x/2); ll ans=(y*y); if(x%2) ans*=a; return ans;}

  int main()
  {


      int n,m;
      cin>>n>>m;

      int s[n+1],t[m+1];
      for( int i=1;i<=n;i++) cin>>s[i];
      for( int j=1;j<=m;j++) cin>>t[j];

       ll dp[n+1][m+1];
       memset(dp,0,sizeof(dp));
      for( int i=1;i<=n;i++) dp[i][0]=1;
      for(int j=1;j<=m;j++) dp[0][j]=1;
       dp[0][0]=1;
       ll ans=0;
       for( int i=1;i<=n;i++)
       {
         for(int j=1;j<=m;j++)
         {
          
          
             dp[i][j]=(dp[i][j]+dp[i][j-1]+dp[i-1][j]-dp[i-1][j-1]+ mod)%mod;

             if(s[i]==t[j])
             {
                dp[i][j]=(dp[i][j]+dp[i-1][j-1])%mod;
             }
         }   

        
       }


       cout<<dp[n][m]<<endl;
   
 }
  

Measured memory_bytes: 31488
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <array>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdio>
#include <iomanip>
#include <utility>
#include <unordered_map>

using namespace std;
typedef long long int ll;

#define SP(x) setprecision((int)x)
#define ALL(v) v.begin(), v.end()

int sum[2001][2001];
int l[2001][2001];

int main(int argc, char const *argv[])
{
    ll h, w;
    cin >> h >> w;
    vector<string> s;
    for (ll i = 0; i < h; i++)
    {
        string t;
        cin >> t;
        s.push_back(t);
    }

    for (ll i = 0; i < h; i++)
    {
        for (ll k = 0; k < w; k++)
        {
            if (s[i][k] == '#')
            {
                l[i][k] = 0;
            }
            else
            {
                if (k == 0)
                {
                    l[i][k] = 1;
                }
                else
                {
                    l[i][k] = l[i][k - 1] + 1;
                }
            }
            sum[i][k] += l[i][k];
        }
    }

    for (ll i = 0; i < h; i++)
    {
        for (ll k = w - 1; k >= 0; k--)
        {
            if (s[i][k] == '#')
            {
                l[i][k] = 0;
            }
            else
            {
                if (k == w - 1)
                {
                    l[i][k] = 1;
                }
                else
                {
                    l[i][k] = l[i][k + 1] + 1;
                }
            }
            sum[i][k] += l[i][k];
        }
    }

    for (ll k = 0; k < w; k++)
    {
        for (ll i = 0; i < h; i++)
        {
            if (s[i][k] == '#')
            {
                l[i][k] = 0;
            }
            else
            {
                if (i == 0)
                {
                    l[i][k] = 1;
                }
                else
                {
                    l[i][k] = l[i - 1][k] + 1;
                }
            }
            sum[i][k] += l[i][k];
        }
    }

    for (ll k = 0; k < w; k++)
    {
        for (ll i = h - 1; i >= 0; i--)
        {
            if (s[i][k] == '#')
            {
                l[i][k] = 0;
            }
            else
            {
                if (i == h - 1)
                {
                    l[i][k] = 1;
                }
                else
                {
                    l[i][k] = l[i + 1][k] + 1;
                }
            }
            sum[i][k] += l[i][k];
        }
    }

    ll ans = 0;
    for (ll i = 0; i < h; i++)
    {
        for (ll k = 0; k < w; k++)
        {
            if (ans < sum[i][k] - 3)
            {
                ans = sum[i][k] - 3;
            }
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 35584
import sys
N,M = map(int,input().split())
result = [0]*N
A = []
if N == 1 and M == 0:
    print(0)
    sys.exit()
if N == 1:
    result = 10
    for i in range(M):
        s, c = map(int, input().split())
        if result > 9:
            result = c
        else:
            if result != c:
                print(-1)
                sys.exit()
    print(result)
else:
    for i in range(M):
        s, c = map(int, input().split())
        if s == 1 and c == 0:
            print(-1)
            sys.exit()
        else:
            None
        if result[s - 1] == 0:
            result[s - 1] = c
        else:
            if result[s - 1] == c:
                None
            else:
                print(-1)
                sys.exit()
        if c == 0:
            A.append(s)


    for k in range(len(A)):
        if result[A[k] - 1] != 0:
            print(-1)
            sys.exit()

    if result[0] == 0:
        result[0] = 1

    ans = ""
    for j in range(len(result)):
        ans += str(result[j])

    print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define MOD (1000000007l)
#define rep(i, n) for(long i = 0; i < (n); i++)

using namespace std;

void solve() {
  long A, B, C, X, Y;
  cin >> A >> B >> C >> X >> Y;
  long ans = 0;
  ans += min(A+B, 2*C) * min(X, Y);
  if (X > Y) ans += min(A, 2*C) * (X-Y);
  if (X < Y) ans += min(B, 2*C) * (Y-X);
  cout << ans << endl;
}

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout.precision(12);
  solve();
  return 0;
}


Measured memory_bytes: 256
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float("INF")

#A
def A():
    x, y = LI()
    print(x+y//2)
    return

#B
def B():
    II()
    t, a = LI()
    h = LI()
    ans = [0,inf]
    for num, i in enumerate(h):
        if ans[1] > abs(t - a - i * 0.006):
            ans = [num, abs(t - a - i * 0.006)]
    print(ans[0] + 1)
    return

#C
def C():
    n, m = LI()
    py = LIR(m)
    pya = py[::1]
    py.sort(key=lambda x: x[1])
    city = [1 for i in range(n)]
    dicity = {}
    for p, y in py:
        dicity[(p,y)] = city[p-1]
        city[p-1] += 1    
    for p, y in pya:
        a = "00000" + str(p)
        a = a[-6:]
        b = "00000" + str(dicity[(p, y)])
        b = b[-6:]
        print(a+b)

    return

#D
def D():
    h, w, k = LI()
    stick = [[0, 0] for i in range(w)]
    stick[0] = [1, 0]
    for i in range(1, w):
        stick[i][0] += stick[i - 1][0] + stick[i - 1][1]
        stick[i][1] += stick[i - 1][0]
    dp1 = [0] * (w + 2)
    dp1[1] = 1
    for i in range(h):
        dp2 = [0] * (w + 2)
        for wi in range(1, w + 1):
            tmp = dp1[wi - 1] * stick[wi - 1][1] * stick[w - wi][0]
            tmp += dp1[wi + 1] * stick[w - wi][1] * stick[wi - 1][0]
            tmp += dp1[wi] * stick[wi - 1][0] * stick[w - wi][0]
            dp2[wi] = tmp
            dp2[wi] %= mod
        dp1 = dp2
    print(dp2[k])

    return

#Solve
if __name__ == '__main__':
    D()


Measured memory_bytes: 40560
//#include "bits/stdc++.h"

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>
#include<unordered_set>
#include<bitset>
#include<complex>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD =  (int)1e9 + 7;
const double EPS = 1e-9;

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

	int N;
	string S[100];
	int T[100];
	string Q;

	cin >> N;
	rep(i, 0, N)
	{
		cin >> S[i] >> T[i];
	}
	cin >> Q;

	int ans = 0;
	bool ok = false;
	rep(i, 0, N)
	{
		if (S[i] == Q)
		{
			ok = true;
			continue;
		}
		if (!ok)continue;
		ans += T[i];
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 764
import random


def gcd(a, b):
    if a == 0:
        return b
    return gcd(b % a, a)


def lcm(a, b):
    return (a * b) / gcd(a, b)

n=int(input())
a=list(map(int, input().split()))
c=0
for i in range(n):
    for j in range(i+1,n):
        for k in range(j+1, n):
            if a[i]+a[j]>a[k] and a[i]+a[k]>a[j] and a[j]+a[k]>a[i] and a[i]!=a[j] and a[j]!=a[k] and a[k]!=a[i]:
                #print(a[i],a[j],a[k])
                c+=1
print(c)


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

using namespace std;

int main() {
    
    int n;
    cin >> n;    
    vector<vector<double>> dp(n+1, vector<double>(n+1));

    dp[0][0] = 1;
    for(int i = 1; i <= n; ++i) {
        
        double p;
        cin >> p;
        for(int j = 0; j <= i; ++j) {

            if(j != 0) {

                dp[i][j] += dp[i-1][j-1] * p;
            }
            dp[i][j] += dp[i-1][j] * (1-p);
        }
    }
    double ans = 0;
    for(int i = 0; i <= n; ++i) {

        int j = n - i;
        if(i > j) {

            ans += dp[n][i];
        }
    }

    cout << setprecision(10) << ans;

    return 0;
}

Measured memory_bytes: 70656
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    int a, b, k;
    cin >> a >> b >> k;
    for (int i = a; i <= min(b, a + k - 1); i++) cout << i << '\n';
    for (int i = max({min(b, a + k - 1) + 1, b - k + 1, a}); i <= b; i++) cout << i << '\n';
}


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

using namespace std;

#define ll  long long
#define ld  double

#define sz(x)   (int)x.size()
#define all(x)  x.begin(),x.end()

#define pb  emplace_back
#define X   first
#define Y   second

const int   N   = 405;
const int   mod = 998244353;

void add(int &a,int b)  {
    a += b;
    if (a >= mod)
        a -= mod;
}
void sub(int &a,int b)  {
    a -= b;
    if (a <  0)
        a += mod;
}
int mul(int a,int b)    {
    return  1ll * a * b % mod;
}
int Pow(int a,int b)    {
    int ans = 1;
    while (b)   {
        if(b & 1)   ans = mul(ans,a);
        a = mul(a,a);   b >>= 1;
    }
    return  ans;
}
int inv(int a,int p)    {
    return  a == 1 ? 1 : p - 1ll * p * inv(p % a,a) / a;
}

typedef pair<int,int>   ii;

int Fac[N];
int Inv[N];

int f[N][N];
int a[N];
int b[N];

int main()  {
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    Fac[0] = Inv[0] = 1;

    for(int i = 1 ; i < N ; ++i)    Fac[i] = mul(Fac[i - 1],i);     Inv[N - 1] = inv(Fac[N - 1],mod);
    for(int i = N - 2 ; i ; --i)    Inv[i] = mul(Inv[i + 1],i + 1);

    int n;  cin >> n;
    int S = 0;

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

    f[0][0] = mod - 1;

    for(int i = 1 ; i <= n ; ++i)
    for(int j = S ; j >= 0 ; --j)
        for(int k = N - 1 ; k >= 0 ; --k) if (f[j][k])  {
            int x = 1;

            for(int t = 0 ; t < b[i] ; ++t) {
                x = mul(x,Inv[t]);  sub(f[j + a[i]][k + t],mul(x,f[j][k])); //the sign of this dp-array has been contained in this process
                x = mul(x,Fac[t]);
                x = mul(x,a[i]);
            }
        }

    int ans = 0;

    for(int i = 1 ; i <= S ; ++i)
    for(int x = 0 ; x <  N ; ++x)   {
        int v = f[i][x];

        v = mul(v,Fac[x]);
        v = mul(v,Pow(i,mod - 2 - x));

        add(ans,mul(v,S));
    }
    cout << ans << endl;
}

Measured memory_bytes: 896
#include<stdio.h>
#include<stdlib.h>

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

Node root;

Node treeMinimum(Node x){
  while(x->left != NIL)
    x = x->left;
  return x;
}

Node treeMaximum(Node x){
  while(x->right != NIL)
    x = x->right;
  return x;
}

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

Node treeSuccessor(Node x){
  Node y;
  if(x->right != NIL)
    return treeMinimum(x->right);

  y = x->parent;

  while(y != NIL && x == y->right){
    x = y;
    y = y->parent;
  }
  return y;
}

void treeDelete(Node z){
  Node y; // node to be deleted                                                 
  Node x; // child of y                                                         

  if(z->left == NIL || z->right == NIL) y = z;
  else y = treeSuccessor(z);

  if(y->left != NIL) x = y->left;
  else x = y->right;

  if(x != NIL) x->parent = y->parent;

  if(y->parent == NIL) root = x;
  else if(y == y->parent->left) y->parent->left = x;
  else y->parent->right = x;

  if(y != z) z->key = y->key;

}

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

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

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

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

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


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

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    } else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }
  }

  return 0;
}




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

long int njou (int a, int n) { //aのn乗を計算
    if (n == 0) {
        return 1;
    }

    return a * njou(a, n - 1);
}

long int stirng_int (string S) {
    int N = S.size();
    long int sum = 0;
    for (int i = 0; i < N; i++) {
        sum += (S.at(N - i - 1) - '0') * njou(10, i);
    }

    return sum;
}

long int goukei (string S) {
    int a = S.at(0) - '0';
    int N = S.size();
    long int sum = 0;
    if (N == 1) {
        return a;
    }

    for (int i = 0; i < N - 1; i++) {
        string A, B;
        for (int j = 0; j < i + 1; j++) {
            A += S.at(j);
        }
        for (int j = i + 1; j < N; j++) {
            B += S.at(j);
        }

        sum += stirng_int(A) * njou(2, B.size() - 1);

        sum += goukei(B);
    }

    sum += stirng_int(S);

    return sum;
}

int main () {
    string S;
    cin >> S;
    cout << goukei(S) << endl;
}

Measured memory_bytes: 256
function Main(input) {
  var list = input.split("\n").map(s => parseInt(s, 10));
  var min = list[1];
  var ans = 0;
  var last = 10;
  
  for (i = 1; i < 6; i++) {
    if (list[i] < min) min = list[i];
  }
  
  ans = Math.floor((list[0]-1)/min) + 5;
  
  console.log(ans);
}
 
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define forr(i,k,n) for(ll i=k;i<n;i++)
int main(){
  string s,t;
  cin>>s>>t;
  bool flag=true;
  forr(i,0,s.size()) {
    if(s[i]!=t[i]) flag = false;
  }
  if(flag) cout<<"Yes\n";
  else cout<<"No\n";
}

Measured memory_bytes: 3628
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <functional>
#include <bitset>
#include <string>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#include <list>
#include <deque>
using namespace std;
#define INF 10000000
#define LLINF 100000000000000
typedef pair<int, int> P;
typedef long long ll;
#define pb push_back
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define VSORT(v) sort(v.begin(), v.end());
#define fi first
#define se second
#define out(x) cout << x << endl;
int dx[] = { 1, 0, -1, 0 }, dy[] = { 0,1,0,-1 };
ll MOD = 1000000007;

int h, n;
int locate[] = { 0,3,6,12,15 };
int dp[2][1 << 4] = { 0 };
int add[] = { 0,1,1,1,2 };
int f[10005] = { 0 };

int main() {
	cin >> h >> n;
	for (int i = 0; i < n; i++) {
		int x, y;
		cin >> x >> y;
		f[y] |= 1 << x;
	}
	int *crt = dp[0];
	int *next = dp[1];
	for (int i = 0; i < 1 << 4; i++) {
		if (i&f[0]) {
			crt[i] = -1;
		}
		else {
			crt[i] = 0;
		}
	}
	for (int i = 0; i < h - 1; i++) {
		fill(next, next + (1 << 4), -1);
		for (int j = 0; j < 1 << 4; j++) {
			if (crt[j] == -1) continue;
			for (int k = 0; k < 5; k++) {
				int sc = f[i] & locate[k];
				int sn = f[i + 1] & locate[k];
				if (!sc && !sn && !(j&locate[k])) {
					next[f[i+1] | locate[k]] = max(next[f[i+1] | locate[k]], crt[j] + add[k]);
				}
			}
		}
		swap(crt, next);
	}
	int res = 0;
	for (int i = 0; i < 1 << 4; i++) {
		res = max(res, crt[i]);
	}
	out(res);
	return 0;
}


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

#define NN 100010

int main(void)
{
  int i, k, id, N, K, sum;
  scanf("%d %d",&N, &K);
  int s[NN];
  for(i=0;i<N;i++){
    scanf("%01d",&s[i]);
  }
  /**/
  //  int len[N+2];
  int len[NN];
  int old = 1;
  int d = 0;  
  //  for(i=0;i<N+2;i++) len[i] = 0;
  for(i=0;i<NN;i++) len[i] = 0;
  for(i=0;i<N;i++){
    if(old != s[i] ) d ++;
    len[d] ++; 
    old = s[i];
  }
  if(s[N-1] == 0){
    d++;
    len[d]=0;
  }
  int L = d+1;
  int max = 0;
  // if K==0
  if(K==0){
    for(i=0;i<L;i+=2){
      if (len[i] > max ){
	max = len[i];
	id = i;
      }
    }
    printf("%d", max); 
    return (0);
  }
  //-----
    
  //  if(K> (L/2) ) K = L/2;
  if(K> N ) K = N;

  // --max
   int sumL, sumR;
   int idL, idR;

   idL = 0;
   idR = 2*K;
   if(idR > N ) idR=N;
   sum =0;
   for(i=0;i<=(idR);i++)  sum += len[i];

   max = sum;
   for(i=(idR+2);i<L;i+=2){
     if(i>L) break;
     sum -= len[i-2-idR] + len[i-1-idR] ;
     sum += len[i-1] + len[i];
     if (sum > max )   max = sum;
   }

   
   printf("%d", max); 
   return (0);
}


Measured memory_bytes: 896
#include<bits/stdc++.h>                             
#define loop(i,b) for(int i = 0; i < (b); i++)      
#define loop2(i,h,b) for(int i = (h); i < (b); i++) 
#define all(a) a.begin(),a.end()                    
using namespace std;                                
                                                    
int main(){                                         
  int N,K;                                          
  scanf("%d%d",&N,&K);                              
                                                    
  priority_queue<int> que;                          
                                                    
  loop(n,N){                                        
    int i;                                          
    scanf("%d",&i);                                 
    que.push(i);                                    
  }                                                 
                                                    
  int sum = 0;                                      
  loop(n,K){                                        
    sum += que.top();                               
    que.pop();                                      
  }                                                 
                                                    
  printf("%d\n",sum);                               
                                                    
  return 0;                                         
}                                                   

Measured memory_bytes: 256
#include <stdio.h> 
int main(void) 
{ 
    int n, m, x, a[1000], i, j, p, q;
    
    scanf("%d%d%d",&n,&m,&x);
    for(i=0;i<m;i++) scanf("%d",&a[i]);
    
    p=q=0;
    for(i=x;i>0;i--){
        for(j=0;j<m;j++){
            if(i==a[j]){
                p++;
                break;
            }
        }
    }
    for(i=x;i<n;i++){
        for(j=0;j<m;j++){
            if(i==a[j]){
                q++;
                break;
            }
        }
    }
    if(p>q) printf("%d\n",q);
    else    printf("%d\n",p);
	return 0;
}

Measured memory_bytes: 1704
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
#define rep(i, a, n) for (ll i = (a); i < (n); i++)
#define debug(x) cerr << #x << ": " << x << endl;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

int main() {
    ll r;
    cin >> r;
    cout << r * r << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Math;

namespace CSharp
{
    static class Program
    {
        static void Main(string[] args)
        {
            ReadString();
            var P = ReadIntArray();
            bool ans = P.Select((x, index) => new { Value = x, Index = index }).Count(x => x.Index + 1 != x.Value) <= 2;
            Console.WriteLine(ans ? "YES" : "NO");
        }

        #region Helpers

        static int[] ReadIntArray() => Console.ReadLine().Split().Select(s => int.Parse(s)).ToArray();
        static long[] ReadLongArray() => Console.ReadLine().Split().Select(s => long.Parse(s)).ToArray();

        static int[] ReadLineIntArray(int count) => Enumerable.Repeat(0, count).Select(_ => int.Parse(Console.ReadLine())).ToArray();
        static long[] ReadLineLongArray(int count) => Enumerable.Repeat(0, count).Select(_ => long.Parse(Console.ReadLine())).ToArray();

        static string ReadString() => Console.ReadLine();
        static int ReadInt() => int.Parse(Console.ReadLine());
        static long ReadLong() => long.Parse(Console.ReadLine());

        static void ReadInt(out int first)
        {
            var array = ReadIntArray();
            first = array[0];
        }

        static void ReadInt(out int first, out int second)
        {
            var array = ReadIntArray();
            first = array[0];
            second = array[1];
        }

        static void ReadInt(out int first, out int second, out int third)
        {
            var array = ReadIntArray();
            first = array[0];
            second = array[1];
            third = array[2];
        }

        static void ReadInt(out int first, out int second, out int third, out int fourth)
        {
            var array = ReadIntArray();
            first = array[0];
            second = array[1];
            third = array[2];
            fourth = array[3];
        }

        static void ReadLong(out long first)
        {
            var array = ReadLongArray();
            first = array[0];
        }

        static void ReadLong(out long first, out long second)
        {
            var array = ReadLongArray();
            first = array[0];
            second = array[1];
        }

        static void ReadLong(out long first, out long second, out long third)
        {
            var array = ReadLongArray();
            first = array[0];
            second = array[1];
            third = array[2];
        }

        static void ReadLong(out long first, out long second, out long third, out long fourth)
        {
            var array = ReadLongArray();
            first = array[0];
            second = array[1];
            third = array[2];
            fourth = array[3];
        }

        #endregion
    }
}

Measured memory_bytes: 13396
def f(n):
    if n % 2 == 0:
        return int(n/2)
    else:
        return int(3*n + 1)

s = int(input())

result = [s]
i = 0
while True:
    target = f(result[i])
    if target in result:
        print(i+2)
        break
    else:
        result.append(target)
        i += 1



Measured memory_bytes: 2940
#include<iostream>
using namespace std;
int main(){
    int a,b,c,d=0;
    cin>>a>>b>>c;
    if(a<b&&b<c){
        cout<<"Yes"<<endl;
        d=1;
    }
    if(d==0){
        cout<<"No"<<endl;
    }
    return 0;
}

Measured memory_bytes: 1156
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define REP(i,a,b) for (int i = a; i < (b); ++i)
#define all(x) (x).begin(),(x).end()
#define YY puts("Yes")
#define NN puts("No")
const int INF = 1000000007;
typedef long long ll;
using namespace std;
using Graph = vector<vector<int>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a,b); }
ll fac(ll a) { return a > 1 ? fac(a - 1) * a : 1; }
bool sumiko[2000000];
int solve(){
  int n,m;
  cin >> n >> m;
  Graph G(n);
  int a,b;
  rep(i,m){
    cin >> a >> b;
    G[a - 1].push_back(b - 1);
    G[b - 1].push_back(a - 1);
  }
  rep(i,G[0].size()){
    sumiko[G[0][i]] = true; 
  }
  rep(i,G[n - 1].size()){
    if(sumiko[G[n - 1][i]]){
      puts("POSSIBLE");
      return 0;
    }
  }
  puts("IMPOSSIBLE");
  return 0;
}
int main(){
  ios::sync_with_stdio(false);cin.tie(nullptr);
  // cout << fixed;cout << setprecision(16) << endl; 
  solve();
  return 0;
}

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

using ll = long long ;
using namespace std;
using pii = pair<int,int>;

int main(){
	int a, b, c, k;
	scanf("%d %d %d %d", &a, &b, &c, &k);
	int cnt = 0;
	while(b <= a) b *= 2, cnt++;
	while(c <= b) c *= 2, cnt++;
	printf("%s", cnt <= k ? "Yes" : "No");

}

Measured memory_bytes: 3824
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
#include<string>
#include<cmath>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<vector>
#include<complex>
#include<unordered_map>
#define deg(x) cout<<#x<<"="<<x<<endl;
#define fd(x) for(int i=0;i<x;i++)
#define fdd(a,x) for(int i=a;i<x;i++)
#define fx(x,n) for(int i=n-1;i>=x;i--)
#define mst(x) memset(x,0,sizeof(x));
#define fi first
#define se second
#define TB ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define ok "ok"
#define HH puts("");
#define ls rt<<1
#define rs rt<<1|1
#define pb(a,b) a.push_back(b);
#define FIN  freopen("1.in","r",stdin);
#define FOUT freopen("1.out","w",stdout);
using namespace std;
typedef long long ll;typedef long long LL;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<string,int> pss;
typedef unsigned long long ull;
const ll mod=1e9+7;
const ll inf=1e9+7;
const long double eps=1e-8;
ll qpow(ll a,ll b,ll m){ ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r;}
const double pi=acos(-1);



int main()
{
    TB
    int l,r,d;
    cin>>l>>r>>d;
    l--;
    cout<<(r/d)-(l/d)<<'\n';
    return 0;
}


Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
int n,m;
bool visited[100005];
#define ll long long int
#define MOD 1000000007
vector<ll>grp[100005];
ll coun,ans;
void explore(ll s){
	visited[s]=true;
	//cout<<s<<endl;
	for(ll i=0;i<grp[s].size();i++){
		if(!visited[grp[s][i]]){
			explore(grp[s][i]);
		}
	}
}
void dfs(ll source){
	explore(source);
	for(ll i=1;i<=n;i++){
		if(!visited[i]){
			explore(i);
			coun++;
			
		}
		
	}
}
int main(){
	ll t=1;
	while(t--){
		for(int i=0;i<100005;i++)
			grp[i].clear();
		coun=1;
		cin>>n>>m;
		for(ll i=0;i<=n;i++){
			visited[i]=false;
		}
		for(ll i=0;i<m;i++){
			ll u,v,w;
			cin>>u>>v>>w;
			grp[u].push_back(v);
			grp[v].push_back(u);
		}
		ll source=1;
		dfs(source);
		cout<<coun<<endl;
	}
}

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

int main(){
	int n;
  	cin>>n;
  	int freq[n+1] = {0};
  	for(int i=1;i<n;i++){
    	int x;
      	cin>>x;
      	freq[x]++;
    }
  	for(int i=1;i<=n;i++){
    	cout<<freq[i]<<endl;
    }
  return 0;
}

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

unordered_map<int, int> appear;
int N, un[3], unc, tp, zero;

int main() {

  cin >> N;
  for(int i = 0; i < N; i++){
    cin >> tp;
    if(tp == 0)zero=1;
    if(!appear.count(tp)){
      if(unc == 3){cout << "No\n"; exit(0);}
      un[unc] = tp;
      unc++;
      appear[tp] = 1;
    }else appear[tp]++;
  }
  if(zero){
    if(unc>2){cout << "No\n"; exit(0);}
    if(unc == 2){
      if(!un[0])swap(un[0], un[1]);
      if(appear[un[0]]==appear[un[1]]<<1){cout << "Yes\n";}
      else cout << "No\n";
    }else cout << "Yes\n";
  }else {
    if(appear[un[1]] == appear[un[0]] && appear[un[0]] == appear[un[2]] && (un[1] ^ un[2]) == un[0])cout << "Yes\n";
    else cout << "No\n";
  }
}

Measured memory_bytes: 384
#!/usr/bin/env python3
from collections import deque


def search(moji):
    num = len(moji)
    setsn = set([])
    for i in range(len(s)-num+1):
        if s[i:i+num] == moji:
            str_ = s[i:i+num+1]
            if len(str_) == num+1:
                setsn.add(str_)
    sorted_setsn = sorted(setsn, reverse=True)

    return sorted_setsn


s = str(input())
k = int(input())
n = len(s)

sets1 = set([])
for i in range(0, len(s)):
    sets1.add(s[i])

sorted_sets1 = sorted(sets1)

# if k == 1:
#     print(sorted_sets1[0])
#     exit()
# else:
#     k -= 1

dq = deque(sorted_sets1)

while(len(dq)):
    # print(dq, k)
    moji = dq.popleft()
    k -= 1
    if k == 0:
        print(moji)
        exit()
    sorted_setsn = search(moji)

    # print(sorted_setsn)
    dq.extendleft(sorted_setsn)


Measured memory_bytes: 9480
// String - Equivalence.cpp
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <set>
#include <unordered_map>
#include <queue>
#include <stack>
#include <cmath>
#include <functional>
#include <deque>
#include <bitset>
#include <climits>
#include <cstdio>
#include <list>
#include <iomanip>
using namespace std;

#define ll long long int

void helper(int i, int n, char a, char out[])
{

	if (i == n)
	{

		out[i] = '\0';
		cout << out << endl;
		return;

	}


	for ( char ch = 'a' ; ch <= a; ch++ )
	{
		out[i] = ch;
		if (ch == a)
		{
			helper(i + 1, n, a + 1, out);
		}
		else
		{
			helper(i + 1, n, a, out);
		}

	}





}





int main() {
//	fastIO


	int n;
	cin >> n;
	char out[100];


	helper(0, n, 'a', out);



	return 0;
}

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

using namespace std;

int ar[105];

int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &ar[i]);
  }
  sort(ar, ar + n);
  int ans = 1;
  for (int i = 1; i < n; i++) {
    if (ar[i-1] < ar[i]) {
      ans++;
    }
  }
  printf("%d\n", ans);
  return 0;
}

Measured memory_bytes: 128
S=input()
smallcount=0    #>の数
smallflag=0     #>があったかの判定
bigcount=0      #<の数
bigflag=1       #<があったかの判定
endflag=0
event=0
count=0

def renzokusum(n):
    return int((n*(n+1))/2)
#print(renzokusum(0))
for i in range(len(S)):
    #print(i,[bigcount,bigflag,smallcount,event,count])
    if (S[i]=="<"):
        bigflag=1
    if (S[i]==">"):
        smallflag=1
    if (S[i]=="<")and(bigflag==1)and(smallflag==1):
        count=count+renzokusum(max(smallcount,bigcount))+renzokusum(min(smallcount,bigcount)-1)
        smallflag=0
        bigcount=0
        smallcount=0
    if (S[i] == "<"):
        bigcount = bigcount + 1
    if (S[i]==">"):
        smallcount = smallcount + 1

count=count+renzokusum(max(smallcount,bigcount))+renzokusum(min(smallcount,bigcount)-1)

print(count)

Measured memory_bytes: 44616
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    ArrayList<Integer> ar = new ArrayList<Integer>();

    for(int i=0;i<3;i++){
      int A = sc.nextInt();
      ar.add(A);
    }
    Collections.sort(ar);
    int task1 = ar.get(1) - ar.get(0);
    int task2 = ar.get(2) - ar.get(1);
    System.out.println(task1 + task2);
  }
}


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

using namespace std;

typedef long long ll;

const double pi = 3.14159265358979323846;

#define rep(i, n) for (ll i = 0; i < n; i++)
#define mod 1000000007LL
#define PS(p) cout << setprecision(15) << fixed << p << endl;
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
#define ALL(c) c.begin(), c.end()
#define CIN(v) cin >> v;
#define COUT(v) cout << v << endl;

int main() {
  ll N;

  CIN(N);
  COUT (N * (N - 1) / 2);

  return 0;
}


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

int main(){
    int k,x;
    cin >> k>>x;
    if (500 * k >= x) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

int main()
{
    int n;
    ll tmp, res = 1, max = 1000000000000000000;
    cin >> n;
    bool ng = false;

    for(int i = 0; i < n; ++i)
    {
        cin >> tmp;
        if(tmp == 0)
        {
            cout << 0 << "\n";
            return 0;
        }
        if(ng || tmp > max / res)
        {
            ng = true;
        }
        res *= tmp;
    }

    cout << (ng ? -1 : res) << "\n";
    return 0;
}

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

int main(){
	int n,k;
	cin>>n>>k;
	long long h[n];
	for(int i=0;i<n;i++)cin>>h[i];
	sort(h,h+n,std::greater<int>());
	//for(int i=0;i<n;i++)cout<<h[i]<<endl;
	long long res = 1000000010;
	for(int i=0;i<n-k+1;i++){
		//cout<<h[i] - h[k-1+i]<<endl;
		res = min(res,h[i] - h[k-1+i]);
	}
	cout<<res<<endl;
}


Measured memory_bytes: 1024
#include<stdio.h>
#define MAX 1000000

int sise, A[MAX+1];

void maxHeapify(int i){
  int l, r, largest, t;
  l = 2*i;
  r = 2*i+1;
  if ( l <= sise && A[l] > A[i] )
     largest = l;
  else 
    largest = i;

  if ( r<=sise && A[r] > A[largest] ) 
    largest = r;
  if ( largest != i ){
    t = A[i];
    A[i] = A[largest]; 
    A[largest] = t;
    maxHeapify(largest);
  }
}

main(){
  scanf("%d", &sise);
  int i;
  for ( i = 1; i <= sise; i++ ) 
    scanf("%d", &A[i]);

  for ( i = sise/2; i >= 1; i-- ) 
    maxHeapify(i);

  for ( i = 1; i <= sise; i++ ) {
    printf(" %d", A[i]);
  }
  printf("\n");



  return 0;
}


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

typedef long long ll;

ll rec(vector<ll>& a,vector<vector<ll>>& dp,int i,int j,int n) {
    if (dp[i][j] > INT64_MIN) return dp[i][j];
    if (i+j == n) return dp[i][j] = 0;
    if ((i+j)&1) return dp[i][j] = min(rec(a,dp,i+1,j,n)-a[i],rec(a,dp,i,j+1,n)-a[n-j-1]);
    else return dp[i][j] = max(rec(a,dp,i+1,j,n)+a[i],rec(a,dp,i,j+1,n)+a[n-j-1]);
}
int main() {
    int n;
    cin >> n;
    vector<ll> a(n);
    vector<vector<ll>> dp(n+1,vector<ll>(n+1,INT64_MIN));
    for (int i = 0;i < n;++i) cin >> a[i];
    cout << rec(a,dp,0,0,n);
    return 0;
}

Measured memory_bytes: 72960