akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = int_fast64_t;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;

//struct edge {int from, to, cost;};

constexpr double EPS = 1e-10;
//constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;

template<class T> inline T sqr(T x) {return x*x;}

void solve() {
    int n,k;
    cin >> n >> k;
    VI v(n+1);
    int in;
    REP(i,0,n) {
        cin >> in;
        v[in]++;
    }
    int cnt = 0;
    REP(i,1,n+1) if (v[i] > 0) ++cnt;
    sort(all(v));
    int index = 0;
    while (v[index] == 0) ++index;
    int ans = 0;
    while (cnt - k > 0) {
        ans += v[index];
        --cnt;
        ++index;
    }
    cout << ans << endl;
}

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

Measured memory_bytes: 1024
#include <algorithm>
#include<iostream>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<list>
#include<map>
#include<set>
#include<string>
#include <sstream>
#include<bitset>

#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<limits.h>
const int INF = 0x7fffffff;
using lll = long long;
using ull = unsigned long long;
using namespace std;


int main(){
  lll ii,jj,kk;
  vector<int> ret;

  int n;

  cin >> n;
  int ac,wa,tle,re;
  string tmp;
  ac = 0;
  wa = 0;
  tle = 0;
  re = 0;
  for(ii=0;ii<n;ii++){
    cin >> tmp;
    if(tmp == "AC"){
      ac++;
    }
    else if(tmp == "WA"){
      wa++;
    }
    else if(tmp == "TLE"){
      tle++;
    }
    else if(tmp == "RE"){
      re++;
    }
  }
  cout << "AC x " << ac << endl;
  cout << "WA x " << wa << endl;
  cout << "TLE x " << tle << endl;
  cout << "RE x "  << re << endl;
  
  return 0;
}


Measured memory_bytes: 3576
#include<cstdio>
#include<cstring>
#include<list>
using namespace std;
int main()
{
    list<int> L;
    char minglin[21];
    int n,zhi;
    scanf("%d",&n);
    for (int i=0;i<n;i++)
        {
            scanf("%s",minglin);
            if(minglin[0]=='i')
            {
                scanf("%d",&zhi);
                L.push_front(zhi);
            }
            else if(minglin[6]=='F') L.pop_front();
            else if(minglin[6]=='L') L.pop_back();
            else if(minglin[0]=='d')
            {
                scanf("%d",&zhi);
                for (list<int>::iterator j=L.begin();j!=L.end();j++)
                {
                    if(*j==zhi)
                    {
                        L.erase(j);
                        break;
                    }
                }
            }
        }
        int i=0;
        for (list<int>::iterator j=L.begin();j!=L.end();j++)
        {
            if(i++)   printf(" ");
            printf("%d",*j);
        }
        printf("\n");
    return 0;
}

Measured memory_bytes: 34004
#include <stdio.h>
int main(void){
    int a=0,b=0,c=0,n;
    while(scanf("%d",&n)>0){
        if(n>c)c=n;
        if(c>b)n=b,b=c,c=n;
        if(b>a)n=a,a=b,b=n;
    }
    printf("%d\n%d\n%d\n",a,b,c);
    return 0;
}

Measured memory_bytes: 1032
#include <iostream>
using namespace std;
int main()
{
int a,b,c;
cin>>a>>b>>c;
if(b > c)swap(b,c);
if(a > b)swap(a,b);
if(b > c)swap(b,c);
cout<<a<<" "<<b<<" "<<c<<endl;
return 0;
}

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

typedef long long ll;

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl

const int maxn = 1e6 + 5;

int n;
int a[maxn], b[maxn], c[maxn];
int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);  cout.tie(0);


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

  sort(a,a+n);
  sort(b,b+n);
  sort(c,c+n);

  ll ans = 0;

  int u = 0; int l = 0;
  for (int i=0; i<n; i++) {
    while (l<n && c[l]<=b[i]) l++;
    while (u<n && a[u]<b[i]) u++;

    ll x = n-l;
    ll y = u;
    //cout<<x<<" "<<y<<endl;
    ans += x*y;
  }

  cout<<ans<<endl;  

  return 0;
}
// don't forget to read in the input :^)


Measured memory_bytes: 8832
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        java.util.Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        int[] v = new int[n];
        for (int i = 0; i < n; i++) v[i] = input.nextInt();
        Arrays.sort(v);
        double u = v[0];
        for (int i = 1; i < n; i++) {
            u = (u + v[i]) / 2;
        }
        System.out.println(BigDecimal.valueOf(u).toPlainString());
    }
}


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

#define lint long long
#define P pair<int, int>
#define LLP pair<long long, long long>
#define REP(i, x, n) for(int i = (x), i##_len = (int)(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = (int)(n) ; i < i##_len ; ++i)
#define repr(i, n) for(int i = (int)(n) - 1 ; i >= 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())

const int IINF = (1 << 30) - 1;
const long long LLINF = 1LL << 61;
const long long MOD = 1000000007LL;
const int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};
const double EPS = 1e-8;

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

bool solve(void){
    int n;
    cin >> n;

    vector<int> cnt(n);
    int maxi = -1;
    rep(i, n){
        int a;
        cin >> a;
        ++cnt[a];
        chmax(maxi, a);
    }

    if(maxi % 2 == 0){
        REP(i, maxi / 2 + 1, maxi + 1){
            if(cnt[i] < 2){
                return false;
            }
        }
        if(cnt[maxi / 2] != 1){
            return false;
        }
        rep(i, maxi / 2){
            if(cnt[i] > 0){
                return false;
            }
        }
    }else{
        REP(i, maxi / 2 + 2, maxi + 1){
            if(cnt[i] < 2){
                return false;
            }
        }
        if(cnt[maxi / 2 + 1] != 2){
            return false;
        }
        rep(i, maxi / 2 + 1){
            if(cnt[i] > 0){
                return false;
            }
        }
    }

    return true;
}

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

    if(solve()){
        cout << "Possible" << endl;
    }else{
        cout << "Impossible" << endl;
    }

    return 0;
}

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

int main(){
    int w,h,x,y,r;
    cin >> w >> h >> x >> y >> r;
    if(x-r<0 || y-r<0 || x+r>w || y+r>h){
        cout << "No" << endl;
    }else{
        cout << "Yes" << endl;
    }
    
    return 0;
}



Measured memory_bytes: 3100
from sys import stdin


def get_result(data):
    S = data[0]
    return 'Yes' if S != 'AAA' and S != 'BBB' else 'No'


if __name__ == '__main__':
    data = list(map(str, stdin.readline().rstrip('\n').split(' ')))
    result = get_result(data)
    print(result)


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

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
template<typename T> void view(T cont) {std::cout << cont << std::endl;}
template<typename T> void view(T* cont, ll sz) {rep(i, sz) std::cout << cont[i] << " "; std::cout << std::endl;}
template<typename T> void view(const std::vector<T>& v) {for (const auto& f: v) std::cout << f << " "; std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv) { for (const auto& v: vv) {view(v);}}
const long long INF = 1LL<<60;
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

int main(){
    int N; cin >> N;
    vector<int> L(N, 0);
    rep(i, N) {
        cin >> L[i];
    }
    sort(L.begin(), L.end());
    int max_el = L[L.size() - 1];
    L.pop_back();
    int sum_n1 = accumulate(L.begin(), L.end(), 0);
    if (max_el < sum_n1) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

// マクロ
#define rep(i,N) for(int i = 0; i < N; i++)
#define all(x) x.begin(), x.end()
#define sort(x) sort(all(x))
#define cou(x) cout << x << endl
#define y() cout << "Yes" << endl
#define n() cout << "No" << endl
#define Y() cout << "YES" << endl
#define N() cout << "NO" << endl
#define x2(x) x * x

// 型エイリアス
using lint = long long;
using vi = vector<int>;
using vs = vector<string>;
using vb = vector<bool>;
using vvi = vector<vector<int>>;

int main() {

	int N, K;
	lint count = 0;
	cin >> N >> K;

	vi hp(N);
	int p;
	rep(i, N) {
		cin >> p;
		hp[i] = p;
	}
	sort(hp);
	rep(i, K) {
		if (hp.size()) {
			hp.pop_back();
		}
		else {
			cou(0);
			exit(0);
		}
	}
	rep(i, hp.size()) {
		count += hp[i];
	}
	cou(count);
}

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

#define len(x)  (int((x).size()))
#define append push_back
#define pp make_pair
#define ff(a, b)    for (int a = 0; a < int(b); ++a)
#define kk(n)    ff(k, n)
#define xx(n)    ff(x, n)
#define yy(n)    ff(y, n)
#define ii(n)    ff(i, n)
#define fff(a, b, c) for (int a = int(b); a < int(c); ++a)
#define kkk(a, b) fff(k, a, b)
#define xxx(a, b) fff(x, a, b)
#define yyy(a, b) fff(y, a, b)
#define iii(a, b) fff(i, a, b)
#define bb begin()
#define ee end()
#define uu first
#define vv second
#define all(x)  (x).bb, (x).ee
#define ite(v)   decltype((v).bb)
#define fe(i, v) for(ite(v) i = (v).bb; i != (v).ee; ++i)
#define err(...)    { fprintf(stderr, __VA_ARGS__); fflush(stderr); }
#define zz(array, byte)   memset(array, byte, sizeof(array));

using LL = long long;
using DD = long double;
using pii = pair<int, int>;


const LL  INFLL  = 0x7f7f7f7f7f7f7f7fLL;
const int INFint = 0x7f7f7f7f;  //Works with memset(..).
   




int main() {
    ios_base::sync_with_stdio(false);     cin.tie(NULL);
    //cout << '\n';     //Avoid flushing with endl.
    cout.precision(16);


    int N;
    cin >> N;
    vector<LL> strengths(3*N);
    ii (3*N)
        cin >> strengths[i];

    sort(all(strengths));

    LL rr = 0;
    ii (N)
        rr += strengths[3*N-1 -1 -2*i];

    cout << rr << '\n';
    

    return 0;
}



Measured memory_bytes: 2560
#include "iostream"
#include "algorithm"
#include "string"
#include "vector"
#include "cmath"
using namespace std;
int main() {
	string n;
	cin >> n;
	if (n[0] == '9' || n[1] == '9')cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
from math import gcd
n = int(input())
s = list(map(int, input().split()))
s.sort()
dp = [0] * ((10 ** 6) + 100)

res = s[0]
for ss in s:
    dp[ss] += 1
    res = gcd(res, ss)

A = max(s)
pairwise = True
setwise = (res == 1)

for i in range(2, A + 1):
    cnt = 0
    for j in range(i, A + 1, i):
        cnt += dp[j]
    if cnt > 1:
        pairwise = False

if pairwise:
    print("pairwise coprime")
elif setwise:
    print("setwise coprime")
else:
    print("not coprime")


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

int main(){
    int N;
    cin >> N;
    string S;
    cin >> S;
    
    int ans = 0;
    rep(i,N){
        if(S.substr(i,3) == "ABC") ans++;
    }
    
    cout << ans << endl;
}


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

using namespace std;

#define ll long long
#define fix cout << fixed; cout << setprecision(0)





void solve() {

	int n;
	cin >> n;
	string s;
	cin >> s;
	if(n & 1) {
		cout << "No";
		return;
	}
	string a = s.substr(0, n / 2);
	string b = s.substr(n / 2);
	if(a == b) {
		cout << "Yes";
	}
	else {
		cout << "No";
	}	
	




	
}

int main() {

	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	fix;
	solve();

	return 0;
}

Measured memory_bytes: 3576
import sys,math
def I(): return int(sys.stdin.readline().rstrip())
def S(): return sys.stdin.readline().rstrip()

A,B,H,M =map(int,S().split())


h = H*math.pi/6 +M/60 * math.pi/6
m = M*math.pi/30

x = A*math.cos(h)-B*math.cos(m)
y = A*math.sin(h)-B*math.sin(m)

z = math.sqrt(x**2+y**2)
print(z)

Measured memory_bytes: 9576
#include <bits/stdc++.h>
 
//LIFE IS NOT A PROBLEM TO BE SOLVED
 
#define rep(i,a,b) for( int i = (int) a; i < (int) b; i++ )
#define PER(i,a,b) for( int i = (int) a; i >= (int) b; i-- )
#define F first
#define S second
#define mk make_pair
#define pb push_back
#define debug(a) cout << #a << " = " << a << endl;
#define debug2(a,b) cout << #a << " = " << a << " --- " << #b << " = " << b << endl;
#define debugP(a) cout << a.F << " " << a.S << endl;
#define debugV(v, n) { rep( i, 0, n ) { if(i) printf(" "); printf("%d", v[i]); } printf("\n"); }
#define debugM(mat,n,m) rep( i, 0, n ){ rep( j, 0, m ) { if(j) printf(" "); printf("%d", mat[i][j]); } printf("\n"); }
#define all(s) s.begin(), s.end()
 
using namespace std;
 
typedef long long int ll;
typedef pair <int, int> ii;
typedef pair <int, ii> iii;
 
const int MAX = 2e3+3;
const int mod = 1e9+7;



int main(){
	
	ll v[4];
	rep(i, 0, 4) cin >> v[i];
	
	ll ans = -1e18-2;
	rep(i, 0, 2){
		rep(j, 2, 4){
			ans = max(ans, v[i]*v[j]);
		}
	}
	
	cout << ans << '\n';
	
	
    return 0;
}

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


typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef long double ld;

typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;
const int MAXN = 1e6 + 3;

#define _  %  MOD
#define __ %= MOD

#define      each(it,s)        for(auto it = s.begin(); it != s.end(); ++it)
#define      sortA(v)          sort(v.begin(), v.end())
#define      sortD(v)          sort(v.begin(), v.end(), greater<auto>())
#define      fill(a)           memset(a, 0, sizeof (a))

#define      swap(a,b)        {a=a+b;b=a-b;a=a-b;}
#define      rep(i, n)         for(ll i = 0; i < (n); ++i)
#define      repA(i, a, n)     for(ll i = a; i <= (n); ++i)
#define      repD(i, a, n)     for(ll i = a; i >= (n); --i)
#define watch(x) cout << (#x) << " is " << (x) <<endl

#define fi first
#define se second
#define mp make_pair
#define pb push_back

#define fbo find_by_order
#define ook order_of_key
#define mark(x) cout<<"Here -- "<<x<<endl;
#define pv(v)   {rep(i,v.size()) cout<<v[i]<<" "; cout<<endl;}


ll gcd(ll a,ll b){if(b==0) return a; else return gcd(b,a%b);}
ll power(ll x,ll y){ll res=1; while(y>0){if(y&1) res=res*x;y=y>>1;x=x*x;}return res;} // modular exponent

int main()
{
    ios_base::sync_with_stdio(false); // don't use printf and scanf
    cin.tie(NULL); // cout<<fixed<<setprecision
    //freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
    set<char> x;
    string s;
    cin>>s;
    rep(i,s.size()){
        x.insert(s[i]);
    }

    if(x.size()>1){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }

    return 0;
} 

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <bitset>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <time.h>
#include <random>
#include <string>
#include <cassert>
#include <vector>
#include <ostream>
#include <istream>
#include <stack>
#include <deque>
#include <queue>
#include <functional>

using namespace std;

#define int long long
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define pii pair<int, int>
#define ld long double

ostream& operator << (ostream &a, const vector<int> &b) {
    for (auto k : b) cout << k << " ";
    return a;
}

#ifdef LOCAL
    #define dbg(x) cout << #x << " : " << (x) << "\n";
    const int INF = 1e18;
//    const int mod = 2600000069;
//    const int p = 10;
//    const ld PI = 3.1415926535;
#else
    #define dbg(x)
    const int INF = 1e18;
//    const int mod = 2600000069;
//    const int p = 179;
//    const ld PI = 3.1415926535;
#endif

//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,sse3,sse4")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("fast-math")
//#pragma GCC target("avx2")
//#pragma GCC optimize("section-anchors")
//#pragma GCC optimize("profile-values,profile-reorder-functions,tracer")
//#pragma GCC optimize("vpt")
//#pragma GCC optimize("rename-registers")
//#pragma GCC optimize("move-loop-invariants")
//#pragma GCC optimize("unswitch-loops")
//#pragma GCC optimize("function-sections")
//#pragma GCC optimize("data-sections")

const int MAXN = 101;

int dp[2][MAXN][4];

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    string n;
    int k;
    cin >> n >> k;
    int sz = n.size();
    dp[0][0][1] = n[0] - '1';
    dp[0][0][0] = 1;
//    dp[0][1][1] = 9;
    int cnt = 1;
    dp[1][0][1] = 1;
    for (int i = 1; i < sz; i++) {
        if (n[i] != '0') cnt++;
        if (cnt > 3) break;
        dp[1][i][cnt] = 1;
    }
    for (int i = 1; i < sz; i++) {
        for (int j = 0; j <= k; j++) {
            dp[0][i][j] = (n[i] != '0' ? dp[1][i - 1][j] : 0) + dp[0][i - 1][j];
            if (j != 0) {
                dp[0][i][j] += 9 * dp[0][i - 1][j - 1] + max(n[i] - '1', 0) * dp[1][i - 1][j - 1];
            }
        }
    }
//    for (int i = 0; i < sz; i++) {
//        for (int j = 0; j <= k; j++) {
//            cout << i << " " << j << " " << dp[0][i][j] << "\n";
//        }
//    }
    cout << dp[0][sz - 1][k] + dp[1][sz - 1][k];
}
/*

*/


Measured memory_bytes: 888
N = int(input())
A = [tuple(map(int, input().split())) for _ in range(N)]
ans = []
import numpy as np
import itertools
for zyun in itertools.permutations(range(N)):
    cnt = 0
    for k in range(len(zyun)-1):
        cnt += np.sqrt((A[zyun[k+1]][0]-A[zyun[k]][0])**2+(A[zyun[k+1]][1]-A[zyun[k]][1])**2 )
    ans.append(cnt)
print(sum(ans) / len(ans))

Measured memory_bytes: 28576
import java.util.*;
import java.lang.*;

class Lamp{
    List<Integer> validSwitch;
    int p;
    public Lamp(List<Integer> validSwitch, int p){
        this.validSwitch = validSwitch;
        this.p = p;
    }
    boolean lighted(long switchSet){
        int cur=p;
        for(int s:validSwitch){
            if((switchSet & (1<<s))!=0) cur++;
        }
        return cur%2==0;
    }
}

public class Main {
    static int popCount(long bits){
        bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
        bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
        bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
        bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
        return (int)((bits & 0x0000ffff) + (bits >>16 & 0x0000ffff));
    }
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        Lamp[] lamp = new Lamp[M];
        List<Integer>[] validSwitch = new ArrayList[M];
        for(int m=0; m<M; m++){
            int K = sc.nextInt();
            validSwitch[m] = new ArrayList<>(K);
            for(int k=0; k<K; k++) validSwitch[m].add(sc.nextInt()-1);
        }
        for(int m=0; m<M; m++) lamp[m] = new Lamp(validSwitch[m], sc.nextInt());

        long ans=0;
        for(long s=0; s<(1<<N); s++){
            boolean allLight = true;
            for(Lamp l: lamp) if(!l.lighted(s)) allLight=false;
            if(allLight) ans++;
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 23636
#include <iostream>
#include <vector>
using namespace std;
int main(void){
    int N;
    vector<int> D;
    cin >>N;
    for(int i = 0; i < N; i++){
        int tmp;
        cin >> tmp;
        D.push_back(tmp);
    }
    int ans = 0;
    for(int i = 0; i < N - 1; i++){
        for(int j = i + 1; j < N; j++){
            ans += D[i] * D[j];
        }
    }
    cout << ans << endl;
    return 0;
}

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

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

    cout << max(a+b, max(a-b, a*b)) << endl;
}


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

int main(){
  int n;
  cin >> n;
  int a[n];
  int b[n];
  int c[n];
  int res = 0;
  for (int i = 0; i < n; i++){
    cin >> a[i];
  }
  for (int i = 0; i < n; i++){
    cin >> b[i];
  }
  for (int i = 0; i < n-1; i++){
    cin >> c[i];
  }
  
  res += b[a[0] - 1];
  for (int j = 1; j < n; j++){
    res += b[a[j] - 1];
    if (a[j] == a[j-1] + 1) res += c[a[j-1] - 1];
  }
  cout << res << endl;
  return 0;
}

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

int main() {
  int N, H, I;
  string ans = "Yes";
  cin >> N;
  cin >> H >> I;
  H--;
  
  for (int i = 1; i < N; i++) {
    if (H < I) {
      I--;
    } else if (H > I) {
      ans = "No";
      break;
    }
    
    H = I;
    cin >> I;
  }
    
  cout << ans;
}

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

int main(){
  int a, b, c, ans;
  cin >> a >> b >> c;
  int sum = a + b + c;
  int M = max({a, b, c});
  int j = 3 * M - (a + b + c);

  if(j % 2 == 0){
    ans =j / 2;
  }else{
    ans = (j + 3) / 2;
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
#include<cstdio>
#include<functional>
#include<algorithm>
using namespace std;
int main(void)
{
	int i,u,j,n1,c1;
	int n,k[101],v[101][100],c[101];
	int q[100],nn[100],p1,p2;
	scanf("%d",&n);
	for(i=1;i<=n;i++)	{
		scanf("%d %d",&u,&k[i]);
		for(j=0;j<k[i];j++)	{
			scanf("%d",&v[i][j]);
		}
	}
	for(i=1;i<=n;i++)	c[i]=-1;
	c[1]=0;
	p1=0;	p2=0;
	q[p1]=1;	nn[p1]=0;
	p1++;
	c[1]=0;
	while(p1!=p2)	{
		n1=q[p2];	c1=nn[p2];
		p2++;
//		printf("n1=%d c1=%d\n",n1,c1);
		for(i=0;i<k[n1];i++)	{
//			printf("v=%d\n",v[n1][i]);
			if(c[v[n1][i]]==-1)	{
				q[p1]=v[n1][i];
				nn[p1]=c1+1;
//				printf("q=%d nn=%d\n",v[n1][i],c1+1);
				p1++;
				c[v[n1][i]]=c1+1;
			}
		}
	}
	for(i=1;i<=n;i++)	printf("%d %d\n",i,c[i]);
	return 0;
}


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

using namespace std;

typedef long long ll;

int digit(ll n) {
	if(n==0) return 1;
	int len=0;
	for(;n;n/=10,++len);
	return len;
}

int main() {
	ll N;
	scanf("%lld",&N);
	int mn=digit(N);
	for(ll a=2;a*a<=N;a++) if(N%a==0)
		mn=min(mn,max(digit(a),digit(N/a)));
	printf("%d\n",mn);
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		if ((A+1)/2>=B) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}
}


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

using namespace std;
int n,a[100005],f[100005];
int main()
{
    cin>>n;
    for(int i=1;i<=n;i++)
        cin>>a[i];
    f[1]=0;
    f[2]=abs(a[2]-a[1]);
    for(int i=3;i<=n;i++)
    f[i]=min(f[i-1]+abs(a[i]-a[i-1]),f[i-2]+abs(a[i]-a[i-2]));
    cout<<f[n];

}


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

using namespace std;

#define LL long long
#define FAST() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

LL BigMod(LL val,LL pow,LL mod)
{
    LL res = 1;
    val = val % mod;
    while(pow > 0)
    {
        if(pow & 1)res = (res*val) % mod;
        pow = pow >> 1;
        val = (val*val) % mod;
    }
    return res;
}

int ans[200005],pre[200005];

void PreCal()
{
    int i,x;
    for(i=1;i<200001;i++)
    {
        x=i%__builtin_popcount(i);
        pre[i]=pre[x]+1;
    }
}

int main()
{
    FAST();
    PreCal();
    int i,n,x;
    char s[200005];
    LL cnt=0,sum1=0,sum2=0,mod1,mod2;
    cin >> n >> s+1;
    reverse(s+1,s+n+1);
    for(i=1;i<=n;i++)
    {
        if(s[i] == '1')++cnt;
    }
    if(cnt == 0)
    {
        for(i=1;i<=n;i++)cout << "1\n";
        return 0;
    }
    mod1=cnt-1,mod2=cnt+1;
    for(i=1;i<=n;i++)
    {
        if(s[i] == '1')
        {
            if(mod1)sum1=(sum1+BigMod(2,i-1,mod1))%mod1;
            sum2=(sum2+BigMod(2,i-1,mod2))%mod2;
        }
    }
    for(i=1;i<=n;i++)
    {
        if(s[i] == '1'  &&  mod1)x=(sum1-BigMod(2,i-1,mod1)+mod1)%mod1;
        else if(s[i] == '0')x=(sum2+BigMod(2,i-1,mod2))%mod2;
        else continue;
        ans[n-i+1]=pre[x]+1;
    }
    for(i=1;i<=n;i++)cout << ans[i] << '\n';
    return 0;
}


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

using namespace std;

void Main() {
    string S, T;
    cin >> S >> T;

    int n = S.size() - T.size() + 1;
    int maxMatch = 0;
    for (int i = 0; i < n; ++i) {
        string sub = S.substr(i, T.size());
        int submatch = 0;
        for (int j = 0; j < T.size(); ++j) {
            if (sub[j] == T[j]) {
                ++submatch;
            }
        }
        maxMatch = max(maxMatch, submatch);
    }

    cout << (T.size() - maxMatch) << endl;
}

int main() {
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


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

using namespace std;
typedef long long ll;
#define int ll

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

#define REP(i,n) for(int i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000000007;
const int MAX_N = 100010;

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

    int H, N;
    cin >> H >> N;
    vector<int> A(N, 0);
    int sum = 0;
    REP(i, N) {
        cin >> A[i];
        sum += A[i];
    }

    if(H <= sum) { printf("Yes\n"); }
    else { printf("No\n"); }

    return 0;
}


Measured memory_bytes: 1024
N = int(input())

if N == 0:
    print(0)
else:
    curr = N
    ans = ""
    idx = 0
    while curr != 0:
        c = curr // pow(2, idx)
        if c % 2 == 1:
            ans = "1" + ans
            curr -= pow(-2, idx)
        else:
            ans = "0" + ans
        idx += 1
    print(ans)


Measured memory_bytes: 3060
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <queue>
#include <sstream>
#include <stack>
#include <time.h>
#include <vector>
#include <complex>
#include <map>
#include <set>
#include <iomanip>
#include <math.h>
#include <stdlib.h>
#include <list>
#include <utility>
#include <memory>
#include <cstring>
#include <fstream>
#include <numeric>
#include <assert.h>
#include <bits/stdc++.h>
using namespace std;
int divs[108],n,ans=0;
int qil[25]={2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97};
int ru[25];
void dfs(int x,int t){
	if (x==1) return;
	if (x%qil[t]==0){
		ru[t]++;
		dfs(x/qil[t],t);
	}
	else
		dfs(x,t+1);
}
vector <int> v;
void dfs1(int k,int q){
	if (q>=25) return; 
	if (k==1){
		if (ru[v[0]]>=74) ans++;
	}
	if (k==2){
		if (ru[v[1]]>=2 && ru[v[0]]>=24) ans++;
		if (ru[v[0]]>=2 && ru[v[1]]>=24) ans++;
		if (ru[v[1]]>=4 && ru[v[0]]>=14) ans++;
		if (ru[v[0]]>=4 && ru[v[1]]>=14) ans++;
	}
	if (k==3){
		if (ru[v[0]]>=2 && (ru[v[1]]>=4 && ru[v[2]]>=4)) ans++;
		if (ru[v[1]]>=2 && (ru[v[0]]>=4 && ru[v[2]]>=4)) ans++;
		if (ru[v[2]]>=2 && (ru[v[0]]>=4 && ru[v[1]]>=4)) ans++;
		return;
	}
	for (int i=q;i<25;i++){
		v.push_back(i);
		dfs1(k+1,i+1);
		v.pop_back(); 
	}
}
int main(){
	memset (ru,0,sizeof(ru));
	cin>>n;
	if (n==1){
		cout<<"0";
		return 0;
	}
	for (int i=n;i>=2;i--){
		int qq=i;
		dfs(qq,0);
	}
	for (int i=0;i<25;i++){
	
	} 
	dfs1(0,0);
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b,n,ans;
	cin>>a>>b>>n;
	ans=((n+999)/1000)*a;
	//cout<<ans<<endl;
	ans=min(ans,((n/1000)*a)+((((n%1000)+499)/500)*b));
	//cout<<ans<<endl;
	ans=min(ans,((n+499)/500)*b);
	cout<<ans<<endl;
}


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

int main(){
    int n,k; cin >> n >> k;
    int r,s,p; cin >> r >> s >> p;
    string t; cin >> t;

    int yo[k];
    int tt=(n-1)%k;
    rep(i,k){
        if(tt<i) yo[i] = n-1-tt+i-k;
        else yo[i] = n-1-tt+i;
    }
    int rans=0; int sans=0; int pans=0;
    for(int i=0; i<k; i++){
        int kaburi=1;
        int ans=0;
        for(int j=i; j<n-k; j=j+k){
            if(t[j] == t[j+k]) kaburi++;
            else{
                kaburi=(kaburi+1)/2;
                if(t[j]=='r') pans+=p*kaburi;
                else if(t[j]=='s') rans+=r*kaburi;
                else if(t[j]=='p') sans+=s*kaburi;
                kaburi=1;
            }
        }
        if(kaburi>1){
            kaburi=(kaburi+1)/2;
            if(t[yo[i]]=='r') pans+=p*kaburi;
            else if(t[yo[i]]=='s') rans+=r*kaburi;
            else if(t[yo[i]]=='p') sans+=s*kaburi;
            kaburi=1;
        }
        else{
            if(t[yo[i]]=='r') pans+=p;
            else if(t[yo[i]]=='s') rans+=r;
            else if(t[yo[i]]=='p') sans+=s;
        }
    }
    int ans=pans+rans+sans;
    cout << ans << endl;
return 0;
}


Measured memory_bytes: 768
#include <cstdio>
#include <vector>

using namespace std;

char s[5];
int ans[200];

int ask(vector <int> &v) {
    int i;
    
    putchar('?');
    for (i = 0; i < v.size(); i++) printf(" %d", v[i]);
    puts("");
    fflush(stdout);
    
    scanf("%s", s);
    if (s[0] == 'R') {
        return 0;
    } else {
        return 1;
    }
}

int main() {
    int n, c, x, l, r, m, i, j;
    vector <int> v, w;
    
    scanf("%d", &n);
    
    for (i = 1; i <= n * 2; i++) v.push_back(i);
    
    for (i = 0; i < n; i++) w.push_back(v[i]);
    c = ask(w);
    
    l = 0, r = n, m = (l + r) / 2;
    
    while (r - l > 1) {
        vector <int> z;
        
        for (i = m; i < m + n; i++) z.push_back(v[i]);
        
        if (ask(z) == c) {
            l = m;
            m = (l + r) / 2;
        } else {
            r = m;
            m = (l + r) / 2;
        }
    }
    
    x = r;
    
    ans[x - 1] = c;
    ans[x + n - 1] = 1 - c;
    
    for (i = x; i < x + n - 1; i++) {
        vector <int> z;
        
        for (j = x - 1; j <= x + n - 1; j++) {
            if (j == i) continue;
            z.push_back(v[j]);
        }
        
        if (ask(z) == c) {
            ans[i] = 1 - c;
        } else {
            ans[i] = c;
        }
    }
    
    for (i = 0; i < n * 2; i++) {
        vector <int> z;
        
        if (i >= x - 1 && i <= x + n - 1) continue;
        
        for (j = x; j < x + n - 1; j++) z.push_back(v[j]);
        
        z.push_back(v[i]);
        
        if (ask(z) == c) {
            ans[i] = c;
        } else {
            ans[i] = 1 - c;
        }
    }
    
    printf("! ");
    for (i = 0; i < n * 2; i++) {
        if (ans[i] == 0) {
            putchar('R');
        } else {
            putchar('B');
        }
    }
    puts("");
    fflush(stdout);
    
    return 0;
}


Measured memory_bytes: 724
#include<stdio.h>
#include<stdlib.h>
#define MAX 2000001
#define VMAX 10000

int main(){
  unsigned short *A,*B;

  int C[VMAX+1];
  int n,i,j;
  scanf("%d",&n);

  A=malloc(sizeof(short)*n+1);
  B=malloc(sizeof(short)*n+1);

  for(i=0;i<=VMAX;i++) C[i]=0;

  for(i=0;i<n;i++){
    scanf("%hu",&A[i+1]);
    C[A[i+1]]++;
  }

  for(i=1;i<=VMAX;i++) C[i]=C[i]+C[i-1];

  for(j=1;j<=n;j++){
    B[C[A[j]]]=A[j];
    C[A[j]]--;
  }

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

  return 0;
}
    



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

int main(){
  int n, a=0, w=0, t=0, r=0;
  cin >> n;
  vector<string> s(n);
  rep(i, n){
    cin >> s[i];
    if(s[i]=="AC"){
      a++;
    }
    if(s[i]=="WA"){
      w++;
    }
    if(s[i]=="TLE"){
      t++;
    }
    if(s[i]=="RE"){
      r++;
    }
  }

  cout << "AC x " << a << endl << "WA x " << w << endl << "TLE x " << t << endl << "RE x " << r << endl;

  return 0;
}

Measured memory_bytes: 6368
/*
Hey there stalker....

█▀▀▄░░░░░░░░░░░▄▀▀█
░█░░░▀▄░▄▄▄▄▄░▄▀░░░█
░░▀▄░░░▀░░░░░▀░░░▄▀
░░░░▌░▄▄░░░▄▄░▐▀▀
░░░▐░░█▄░░░▄█░░▌▄▄▀▀▀▀█
░░░▌▄▄▀▀░▄░▀▀▄▄▐░░░░░░█
▄▀▀▐▀▀░▄▄▄▄▄░▀▀▌▄▄▄░░░█
█░░░▀▄░█░░░█░▄▀░░░░█▀▀▀
░▀▄░░▀░░▀▀▀░░▀░░░▄█▀
░░░█░░░░░░░░░░░▄▀▄░▀▄
░░░█░░░░░░░░░▄▀█░░█░░█
░░░█░░░░░░░░░░░█▄█░░▄▀
░░░█░░░░░░░░░░░████▀
░░░▀▄▄▀▀▄▄▀▀▄▄▄█▀

Like what you see?
*/
#include <bits/stdc++.h>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define pii         pair<ll ,ll>
#define vi          vector<ll>
#define present(container, element) (container.find(element) != container.end()) /* For set n maps */
#define cpresent(container, element) (find(all(container),element) != container.end()) /* For vectors */
#define all(a)      (a).begin(),(a).end()
#define invect(data,n,commands) for(int i = 0;i<n;i++){int tmp;cin>>tmp;data.pb(tmp);commands}
#define inset(data,n,commands) for(int i = 0;i<n;i++){int tmp;cin>>tmp;data.I(tmp);commands}
#define F           first
#define S           second
#define I           insert
#define sz(x)       (ll)x.size()
#define rep(i,a,b)    for(ll  i=a;i<b;i++)
#define repr(i,a,b) for(ll  i=a;i>b;i--)
#define trav(a, x) 	for(auto& a : x)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define lcase(a) (char)tolower(a)
#define ll long long int
#define lld long double
#define endl "\n"
#define PI 3.14159265358979323844
#define MOD 1000000007
#define max(a, b) (a < b ? b : a)
#define min(a, b) ((a > b) ? b : a)
#define mod 1e9 + 7
/*	For Debugging	*/
#define DEBUG 		cerr<<"\n>>>I'm Here<<<\n"<<endl;
#define display(x) trav(a,x) cout<<a<<" ";cout<<endl;
#define what_is(x)  cerr << #x << " is " << x << endl;

int main()
{
   IOS

    int TESTS=1;
  //  cin >> TESTS;
    while (TESTS--)
    {
        ll n;
        cin>> n;
        string s;
        while(n!=0)
        {
            n--;
            s+=char('a'+ n%26);
            n=n/26;
        }
        for(int i=s.size()-1;i>=0;i--)
        {
            cout<< s[i];
        }
        cout<< "\n";




    }
    return 0;
}


Measured memory_bytes: 3608
/*
 Abu Jafor Mohammad Saleh
 ios_base :: sync_with_stdio(false);
 cin.tie(NULL);
 
 */

#include<cstdio>
#include<iomanip>
#include<sstream>
#include<cstdlib>
#include<cctype>
#include<cmath>
#include<algorithm>
#include<set>
#include<queue>
#include<deque>
#include<stack>
#include<list>
#include<iostream>
#include<fstream>
#include<numeric>
#include<string>
#include<vector>
#include<cstring>
#include<map>
#include<iterator>
#include<limits>
#include <algorithm>
#include <unordered_map>
#include<fstream>
#define f first
#define s second
#define MOD 1000003

#define INF (int)1e9
#define PI 3.1415926535897932384626433832795
#define BOUNDARY(i, j) ((i >= 0 && i < rows) && (j >= 0 && j < coloums))

//#include<bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll long long
const int maxn = 100001;
using namespace std;
int X[] = {0, 1, 0, -1};
int Y[] = {-1, 0, 1, 0};
int rows,coloums;
long long  gcd(long long  a, long long b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}

int main()
{
    fast;
    int n,m;
    cin>>n>>m;
    ll ans = 0;
    ans = (n*(n-1))/2;
    ans += (m*(m-1))/2;
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n, sum, a[105];
int main(){
	cin >> n;
	for(int i = 1; i <= n; i++){
		cin >> a[i];
		if(a[i] % 2 == 1 && i % 2 == 1)
			sum++;
	}
	printf("%d\n", sum);
	return 0;
}

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


int main() {
  int K;
  string S;
  cin >> K >> S;
  int a = S.size();
  if (a <= K){
    cout << S << endl;
  }
  else{
    rep(i, K){
      cout <<S[i];
    }
    cout << "..." << endl;
  }
}

Measured memory_bytes: 3624
#include <iostream>
#include <vector>
#include <unordered_set>
#include <string>

#include <algorithm>

using namespace std;

using us = unordered_set<int>;

int main() {
	int n, k;
	cin >> n >> k;
	us availables = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};

	for(int i = 0; i < k; i++) {
		int num; cin >> num;
		availables.erase(num);
	}

	while(true) {
		string num = to_string(n);
		bool found = false;
		for(int i = 0; i < num.size(); i++) {
			if(availables.find(num[i] - '0') == availables.end()) {
				break;
			}
			if(i == num.size() - 1) {
				found = true;
			}
		}
		if(found) {
			break;
		} else {
			n++;
		}
	}
	cout << n << endl;
}

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

using namespace std;

unsigned long long int gcd(unsigned long long int x, unsigned long long int y);
unsigned long long int lcm(unsigned long long int x, unsigned long long int y);

	int main(void) {
		int n;
		unsigned long long int time[102];
		unsigned long long int lcm_num;

		cin >> n;

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

		lcm_num = time[1];

		if (n >= 2) {
			for (int t = 2; t <= n; t++) {
				if (lcm_num > time[t]) {
					lcm_num = lcm(lcm_num, time[t]);
				}
				else if (lcm_num<time[t]) {
					lcm_num = lcm(time[t], lcm_num);
				}
			}
		}
		

		cout << lcm_num << endl;
		return 0;
	}
	unsigned long long int gcd(unsigned long long int x, unsigned long long int y) {
		unsigned long long int r;

		while ((r = x % y) != 0)
		{
			x = y;
			y = r;
		}
		return y;
	}

	unsigned long long int lcm(unsigned long long int x, unsigned long long int y) {
		unsigned long long int p;
		p = (x / gcd(x, y))*y;
		return (p);
	}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cstdio>
#include <algorithm>
#include <set>
#include <map>
#include <cassert>
#include <numeric>
#include <string>
#include <cstring>
#include <cmath>
using namespace std;

#ifdef LOCAL
	#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
	#define eprintf(...) 42
#endif

typedef long long int int64;




int main(int,  char **)
{
#ifdef LOCAL
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
#endif

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

	int sum = 0;
	int mx;
	for (int i = 1; ; i++)
	{
		sum += i;
		if (sum >= n)
		{
			mx = i;
			break;
		}
	}
	for (int i = mx; i >= 1; i--)
		if (n >= i)
		{
			printf("%d ", i);
			n -= i;
		}
	if (n != 0) throw;


	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <sstream>
 
using namespace std;
 
int h1[2000000];
int w1[2000000];
 
int main(){
     
    while(true){
         
        int N, M;
         
        cin >> N >> M;
        if(N == 0 && M == 0){
            break;
        }
         
        int h[2000];
        int w[2000];
         
        for(int i = 0; i < 2000000; i++){
            h1[i] = 0;
            w1[i] = 0;
        }
         
         
        for(int i = 0; i < N; i++){
            cin >> h[i];
        }
         
        for(int i = 0; i < M; i++){
            cin >> w[i];
        }
         
        for(int i = 0; i < N; i++){
            int sum = 0;
            for(int j = i; j < N; j++){
                sum += h[j];
                h1[sum]++;
            }
        }
         
        for(int i = 0; i < M; i++){
            int sum = 0;
            for(int j = i; j < M; j++){
                sum += w[j];
                w1[sum]++;
            }
        }
         
        int ans = 0;
         
        for(int i = 0; i < 2000000; i++){
            ans += h1[i] * w1[i];
        }
         
        cout << ans << endl;
    }
     
    return 0;
}

Measured memory_bytes: 18708
#include <iostream>
#include <sstream>
#include <stdio.h>
#include<vector>
#include<climits>
#include<algorithm>
#include<bitset>
#include<cmath>
#include<functional>
#include <numeric>
#include <map>
#define FORi(N) for(int i=0;i<N;++i)
#define FORj(N) for(int j=0;j<N;++j)
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
ll gcd(ll m,ll n){
  if(n==0)return abs(m);
  return(gcd(n,m%n));
}
void putYN(bool b){
  if(b){
    cout<<"YES"<<endl;
  }else{
    cout<<"NO"<<endl;
  }
}
int main(){
  vector<ll> ae(5);
  ll k;
  FORi(5){
    cin>>ae[i];
  }
  cin>>k;
  bool flag = true;
  FORi(5){
    FORj(5){
      if(i==j)continue;
      if(abs(ae[i]-ae[j])>k){
        flag=false;
      }
    }
  }
  if(flag){
    cout<<"Yay!"<<endl;
  }else{
    cout<<":("<<endl;
  }
    
  return 0;
}


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

#define loop(i,a,b) for(int i = a; i<b; i++)
int main ()
{
	int n;
	cin >> n;
	vector<int> ans(n);
	loop(i, 1 ,n)
	{
		int a;
		cin >> a;
		ans[a-1] ++;
	}
	for(int c : ans)
		cout << c << "\n";
}


Measured memory_bytes: 4052
N,C,K = map(int,input().split())
T = sorted([int(input()) for i in range(N)])
B,P,N = 1,1,T[0]

for i in T[1:]:
    if P == C or i > N + K:
        B += 1
        P = 0
        N = i
    P += 1
print(B)

Measured memory_bytes: 8280
import java.util.*;
public class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        if (N%2 == 0){
            System.out.println(N);
        }
        else{
            System.out.println(N*2);
        }
        sc.close();
    }
}

Measured memory_bytes: 22228
/*
    CP Submission
*/

#include<bits/stdc++.h>

using namespace std;

/* Shortcuts */
#define MP make_pair
#define PB push_back
#define ALL(x) x.begin(), x.end()
#define VAL(x) cout << #x << ": " << (x) << endl;
#define LOG(x) cout << (x) << endl;
#define SZ(x) (int)(x.size())
#define REP(i, a, b) for(int i = a; i < b; i++)

/* typedefs */
typedef long long ll;
typedef pair<int,int> ii;
typedef pair<string,int> si;
typedef pair<int,ii> iii;
typedef vector <si> vsi;
typedef vector <ii> vii;
typedef vector <int> vi;
typedef vector <vi> vvi;
typedef vector <char> vc;
typedef vector <string> vs;
typedef map <string,vs> msvs;
typedef map <string,int> msi;
typedef map <string,string> mss;

int happ[3][100000];
int dp[3][100000];

int main(){

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

    int n;
    cin>>n;

    REP(i,0,n){
        REP(j,0,3){
            cin>>happ[j][i];
        }
    }

    dp[0][n - 1] = happ[0][n-1];
    dp[1][n - 1] = happ[1][n-1];
    dp[2][n - 1] = happ[2][n-1];

    for(int i = n-2; i>=0; i--){
        for(int j = 0; j < 3; j++){
            for(int k = 0; k < 3; k++){
                if(j == k) continue;
                dp[j][i] = max(dp[j][i], dp[k][i+1] + happ[j][i]);
            }
        }
    }

    int ans = 0;
    REP(i,0,3){
        ans = max(ans, dp[i][0]);
    }

    LOG(ans);





    return 0;
}


Measured memory_bytes: 2560
#include <stdio.h>

int euclid(int a, int b)
{
	return b ? euclid(b, a % b) : a;
}

int main(void)
{
	int a, b, r, e;
	while (scanf("%d%d", &a, &b) != EOF) {
		printf("%ld %ld\n", euclid(a, b), (b / euclid(a, b)) * a);
	}
	return (0);
}

Measured memory_bytes: 596
// O(N^2) solution
#include <string>
#include <iostream>
using namespace std;
int n, a[3][100009], p[100009], dr[100009];
int main() {
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	cin >> n;
	for (int i = 0; i < 3; i++) {
		for (int j = 0; j < n; j++) {
			cin >> a[i][j]; a[i][j]--;
		}
	}
	bool flag = true;
	for (int i = 0; i < n; i++) {
		p[i] = a[0][i] / 3;
		if (a[1][i] < p[i] * 3 || a[1][i] > p[i] * 3 + 2 || a[2][i] < p[i] * 3 || a[2][i] > p[i] * 3 + 2) flag = false;
		else if (a[0][i] < a[1][i] && a[1][i] < a[2][i]) dr[i + 2] = 0;
		else if (a[0][i] > a[1][i] && a[1][i] > a[2][i]) dr[i + 2] = 1;
		else flag = false;
		if (i % 2 != p[i] % 2) flag = false;
	}
	for (int i = 0; i < n; i++) dr[i] ^= dr[i + 2];
	if (!flag) cout << "No\n";
	else {
		for (int i = 0; i < n; i++) {
			int pos = -1;
			for (int j = i; j < n; j += 2) {
				if (p[j] == i) {
					pos = j;
					break;
				}
			}
			for (int j = pos - 2; j >= i; j -= 2) p[j + 2] = p[j];
			dr[i] ^= 1; dr[i + 2] ^= 1;
			dr[pos] ^= 1; dr[pos + 2] ^= 1;
			dr[i + 1] ^= 1; dr[pos + 1] ^= 1;
			p[i] = i;
		}
		for (int i = 0; i < n; i++) dr[i + 2] ^= dr[i];
		int ac = 0, bc = 0;
		for (int i = 0; i < n; i++) {
			if (i % 2 == 0) ac ^= dr[i];
			else bc ^= dr[i];
		}
		cout << (ac + bc ? "No\n" : "Yes\n");
	}
	return 0;
}

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

typedef long long int LL;
typedef long long int LLint;

//Faster Program
#define endl "\n"

//Faster Coding
#define ED return
#define GET(a) int a;cin >> a
#define DGET(a) double a;cin >> a
#define SGET(a) string a;cin >> a
#define CGET(a) char a;cin >> a
#define PRINT(a) cout << a << "\n"
#define ANS(a,b) int a;cin >> a;cout << b << "\n"
#define FOR(n) for(int i = 0;i < n;i++)
#define SORT(vec) sort(vec.begin(),vec.end())
#define REV(vec) reverse(vec.begin(),vec.end())

//As Function
#define UP(a,b) ((a+(b-1))/b)
#define ipow(x,y) LL(pow(x,y))

//Debug
#define TEST cout << "OK\n"

const double PI = M_PI;
const long long INF = int(10e9-1);
const long long MOD = int(10e9+7);

//Settings
const bool DO_BENCHMARK = false;
const int DOUBLE_ACCURACY = 15;

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(DOUBLE_ACCURACY);
    void solve();
    if(DO_BENCHMARK){
        clock_t clock_start = clock();
        solve();
        clock_t clock_end = clock();
        const double time = static_cast<double>(clock_end-clock_start)/CLOCKS_PER_SEC*1000.0;
        cout << "\n" << time << "[ms]\n";
    }
    else solve();
}

void solve(){
    int N;
    string S;
    cin >> N >> S;
    int ans = 0;
    vector<bool> selected (10,false);
    for(int i = 0;i < N-2;i++){
        if(selected[S[i]-'0'] == false){
            selected[S[i]-'0'] = true;
            vector<bool> selected2 (10,false);
            for(int j = i+1;j < N-1;j++){
                if(selected2[S[j]-'0'] == false){
                    selected2[S[j]-'0'] = true;
                    vector<bool> selected3 (10,false);
                    for(int k = j+1;k < N;k++){
                        if(selected3[S[k]-'0'] == false){
                            selected3[S[k]-'0'] = true;
                            ans++;
                        }
                        else{
                            continue;
                        }
                    }
                }
                else{
                    continue;
                }
            }
        }
        else{
            continue;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 384