akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <random>
#include <chrono>

using namespace std;

typedef long long ll;
typedef long double ld;
#define fastInp cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);

const ll SIZE = 1e5 * 2 + 100, INF = 1e9 + 10, MOD = 1e9 + 7;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

ll n, m, psh[SIZE * 8], tree[SIZE * 8];
vector<vector<pair<ll, ll>>> add;

void input() {
    cin >> n >> m;

    add.resize(m + 1);
    for (int i = 0; i < n; i++) {
        ll l, r;
        cin >> l >> r;

        add[r - l + 1].push_back({ l, r });
    }
}

void p(int v) {
    tree[v * 2 + 1] += psh[v];
    tree[v * 2 + 2] += psh[v];
    psh[v * 2 + 1] += psh[v];
    psh[v * 2 + 2] += psh[v];

    psh[v] = 0;
}

void upd(int v, int l, int r, int askl, int askr, int val) {
    if (l >= askr || r <= askl) return;

    if (l >= askl && r <= askr) {
        psh[v] += val;
        return;
    }

    int mid = (l + r) / 2;
    upd(v * 2 + 1, l, mid, askl, askr, val);
    upd(v * 2 + 2, mid, r, askl, askr, val);
}

ll get(int v, int l, int r, int pos) {
    if (l == r - 1) {
        return psh[v];
    }
    else {
        int mid = (l + r) / 2;
        if (pos < mid) {
            return get(v * 2 + 1, l, mid, pos) + psh[v];
        }
        else {
            return get(v * 2 + 2, mid, r, pos) + psh[v];
        }
    }
}

void sol() {
    ll longer = n;

    for (int i = 1; i <= m; i++) {
        ll ans = longer;
        for (int j = 0; j <= m; j += i) {
            ans += get(0, 0, m + 1, j);
        }

        for (auto cur : add[i]) {
            upd(0, 0, m + 1, cur.first, cur.second + 1, 1);
            longer--;
        }
        cout << ans << "\n";
    }
}

int main()
{
    fastInp;

    ll t = 1;

    while (t--) {
        input();
        sol();
    }

    return 0;
}

Measured memory_bytes: 14936
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define vi vector<int>
#define vll vector<ll>
#define vvll vector<vll>
#define vvi vector<vector<int>>
#define vvb vector<vector<bool>>
#define vb vector<bool>
#define pii pair<int, int>
#define vpli vector<pair<long long, int>>
#define deb(x) cout << "deb " << #x << " " << x << endl
#define all(x) x.begin(), x.end()
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define endl "\n"
template <typename T>
void printvec(vector<T> &v, int n, int start = 0)
{
    //cout << "\nprinting vector\n";
    for (int i = start; i < n; i++)
    {
        cout << v[i] << " ";
    }
    cout << "done printing";
    cout << endl;
}
const int mod = 1e9 + 7;
const int BIG = 1e7 + 7;
inline void swap(int &a, int &b)
{
    int t = a;
    a = b;
    b = t;
}

void solve()
{  
    int n;
    cin>>n;
    int ans = 0 ;
    for(int i=1;i<n;i++)
    {
        ans += (n-1)/i;
    }
    cout<<ans<<endl;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t = 1;
    // cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define mod (int)1000000007
#define MOD (int)10000000007
#define X 1001100011100001111ll
#define M 26388279066623ll
#define all(a) a.begin(),a.end()
#define for0(i, n) for (int i = 0; i < n; i++)
#define for0e(i, n) for (int i = 0; i <= n; i++)
#define for1(i, n) for (int i = 1; i <= n; i++)
#define loop(i,a,b) for (int i = a; i < b; i++)
#define bloop(i,a,b) for (int i = a ; i>=b;i--)
#define tc(t) int t; cin >> t; while (t--)
#define ll long long
#define pb emplace_back
#define fio ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
#define in(x) scanf("%d", &x)
#define rr return 0
#define prec(n) fixed<<setprecision(n)
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int> >
#define inf (int)(1e18)
#define ini(a, i) memset(a, i, sizeof(a))
#define vi vector<int> 
#define F first
#define S second
#define pi pair<int, int>
#define ppi pair<pair<int,int> , int >
#define vii vector<pi>
const int MAXN = (int)((1e5) + 100);
int max(int a,int b){if(a>b) return a; else return b;}
int min(int a,int b){if(a<b) return a; else return b;} 
int gcd(int a,int b) { if (a == 0) return b; return gcd(b%a, a);}
int cbrt(int x){ int lo=1,hi=min(2000000ll,x);while(hi-lo>1){int mid=(lo+hi)/2;if(mid*mid*mid<x){lo=mid;}else hi=mid;}if(hi*hi*hi<=x) return hi;else return lo;} 
const int dx[4] = {-1, 1, 0, 0};
const int dy[4] = {0, 0, -1, 1};
const int N =  (int)(1e6+5); 
signed main(){
  fio;
    int n,m;
    cin>>n>>m;
    int ans = n*(n-1)/2 + m*(m-1)/2;
    cout<<ans<<"\n"; 
  rr;
}



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


using namespace std;

int main(){
    int N; cin >> N;
    vector<int> L(N);
    int count = 0;
    
    for(int k=0; k<N; k++){
        cin >> L.at(k);
    }
    
    sort(L.begin(),L.end());//昇順ソート
    
    for(int a=0; a<N-2;a++){
        for(int b=a+1; b<N-1;b++){
            for(int c=b+1; c<N;c++){
                if(L.at(c) < L.at(a) + L.at(b)){
                    count += 1;
                    
                }
                else{
                    continue;
                }
            }
        }
    }
    cout << count << endl;
    
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int 
int main()
{
	ll n;
	cin>>n;
	if(n%2==1){
		cout<<0<<endl;
		return 0;
	}
	ll ans=0;
	ll val=10;
	while(n/val){
		ans+=(n/val);
		val*=5;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
input_numbers = list(map(int,input().split()))
a = input_numbers[0]
b = input_numbers[1]
A = a
B = b
x = 0
y = 0
while A > 0:
  x += 10 ** (A-1) * b
  A -= 1
while B > 0:
  y += 10 ** (B-1) * a
  B -= 1
if x > y:
  print(x)
else:
  print(y)

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

int main() {
  int N,count=1,min;
  cin >> N;
  vector<int> a(N);
  for(int i=0;i<N;i++)
    cin >> a.at(i);
  sort(a.begin(),a.end());
  for(int i=1;i<N;i++){
    if(a.at(i-1)<a.at(i))
      count++;
  }
  cout << count << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
  public static void main(String args[]){
try(Scanner sc =new Scanner(System.in)){
 String line = sc.nextLine();
 String answer = "";
     int length =line.length();
     for(int i=0;i<length;i++){
         char ch = line.charAt(i);
         if(Character.isLowerCase(ch)){
             answer=answer+Character.toUpperCase(ch);
         }else answer=answer+Character.toLowerCase(ch);
     }
        System.out.println(answer);
    }
    }
}


        


Measured memory_bytes: 31400
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll MOD = 1'000'000'007;
const ld PI = acos(-1);  
const ld EPS = 0.0000000001;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define REP(i, n) for(ll i=0; i<(ll)(n); i++)
#define REPD(i, n) for(ll i=n-1; 0<=i; i--)
#define FOR(i, a, b) for(ll i=a; i<(ll)(b); i++)
#define FORD(i, a, b) for(ll i=a; (ll)(b)<=i; i--)
#define ALL(x) x.begin(), x.end()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int main(){
    ll n;   cin >> n;
    vector<ll> a(n);
    REP(i, n)   cin >> a[i];
    sort(ALL(a));
    ll res=LINF;
    FOR(i, -100, 101){
        ll tmp=0;
        REP(k, n){
            tmp += pow(a[k]-i, 2.0);
        }
        res = min(res, tmp);
    }
    cout << res << endl;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
int len;
char str[1000];
int main(){
	scanf("%s",str+1);
	len=strlen(str+1);
	if (len%2==0) {puts("No"); return 0;}
	bool jay=true;
	for (register int i=1; i<=len; ++i)
	if (str[i]!=str[len-i+1]) {puts("No"); return 0;}
	int n=(len-1)/2;
	for (register int i=1; i<=n; ++i)
	if (str[i]!=str[n-i+1]) {puts("No"); return 0;}
	
	for (register int i=(len+3)/2; i<=len; ++i)
	if (str[i]!=str[len-i+(len+3)/2]) {puts("No"); return 0;}
	puts("Yes"); 
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);
        while(true){
            int n = sc.nextInt();
            if(n==0) break;
            int[] s;
            s = new int[n];
            int sum=0;
            double ave, bunsan=0.0;
            for(int i=0;i<n;i++){
                s[i] = sc.nextInt();
                sum+= s[i];
            }
            ave = (double)sum/n;
            for(int j=0;j<n;j++){
                bunsan += (double)(s[j]-ave) * (s[j]-ave) / n;
            }
            System.out.println(Math.sqrt(bunsan));
        }
        sc.close();
    }
}


Measured memory_bytes: 31316
n = int(input())
a, b, c = [0] * n, [0] * n, [0] * n
for i in range(n):
    a[i], b[i], c[i] = map(int, input().split())

dp = [[0] * (n + 1) for i in range(3)]

for i in range(1, n + 1):
    if i == 1:
        dp[0][i] = dp[0][i - 1] + a[i - 1]
        dp[1][i] = dp[1][i - 1] + b[i - 1]
        dp[2][i] = dp[2][i - 1] + c[i - 1]
    dp[0][i] = max(dp[1][i - 1], dp[2][i - 1]) + a[i - 1]
    dp[1][i] = max(dp[0][i - 1], dp[2][i - 1]) + b[i - 1]
    dp[2][i] = max(dp[0][i - 1], dp[1][i - 1]) + c[i - 1]

print(max(dp[0][n],dp[1][n],dp[2][n]))

Measured memory_bytes: 26740
N = int(input())
X = list(map(int, input().split()))

res = 0
for i in range(N - 2):
    for j in range(i + 1, N - 1):
        for k in range(j + 1, N):
            if (X[i] != X[j] and X[j] != X[k] and X[i] != X[k]):
                less = max(X[i], X[j], X[k])
                if sum([X[i], X[j], X[k]]) - less > less:
                    res += 1

print(res)


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


using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0; i<int(n); i++)
#define FOR(i,m,n) for(int i=int(m); i<int(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define VI vector<int>
#define VLL vector<long long>
#define VVI vector<vector<int>>
#define VVLL vector<vector<long long>>
#define VC vector<char>
#define VS vector<string>
#define VVC vector<vector<char>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define fore(i,a) for(auto &i:a)

typedef pair <int, int> P;
template<class T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
const int  INF = 1 << 29;
const ll INFL = 1LL << 60;
const ll mod = 1000000007;



int main() {

	ll n;
	cin >> n;
	VLL d(n);
	REP(i, n)cin >> d[i];

	ll ans = 0;

	REP(i, n) {
		FOR(j, i + 1, n) {
			ans += d[i] * d[j];
		}
	}
	cout << ans << endl;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(v) v.begin(),v.end()
#define len(x) (ll)(x).length()
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int INF=1e9;
const int di[] = {-1,0,1,0};
const int dj[] = {0,-1,0,1};
 
int main(){
  int a,b,c;
  cin>>a>>b>>c;
  for(int i=a;i<=a*b;i+=a){
    if(i%b==c){
      cout<<"YES"<<endl;
      return 0;
    }
  }
  cout<<"NO"<<endl;
}


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

#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define abs(a) max((a),-(a))
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repe(i,n) rep(i,(n)+1)
#define per(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define pere(i,n) rep(i,(n)+1)
#define all(x) (x).begin(),(x).end()
#define SP <<" "<<
#define RET return 0
#define MOD 1000000007
#define INF 1000000000000000000

typedef long long LL;
typedef long double LD;

int main(){
  int n;
  cin >> n;
  vector<int> v(n);
  for(int i=0;i<n;i++){
    cin >> v[i];
  }
  vector<int> c1(100010,0),c2(100010,0);
  for(int i=0;i<n;i+=2){
    c1[v[i]]++;
    c2[v[i+1]]++;
  }
  int ma1=0,ma2=0;
  for(int i=0;i<100010;i++){
    if(c1[i]>c1[ma1]) ma1=i;
    if(c2[i]>c2[ma2]) ma2=i;
  }
  vector<int> a(100010,-1),b(100010,-1);
  int now1=0,now2=0;
  int count=0;
  for(int i=0;i<100010;i++){
    if((c1[i]==c1[ma1])^(c2[i]==c2[ma2])){
      cout << n-c1[ma1]-c2[ma2] << endl;
      return 0;
    }
    if(c1[i]==c1[ma1]) count++;
  }
  int ma111=0,ma222=0;
  for(int i=0;i<100010;i++){
    if(c1[i]>c1[ma111]&&c1[i]<c1[ma1]) ma111=i;
    if(c2[i]>c2[ma222]&&c2[i]<c2[ma2]) ma222=i;
  }
  if(count>1){
    cout << n-c1[ma1]-c2[ma2] << endl;
  }else{
    cout << min(n-c1[ma1]-c2[ma222],n-c1[ma111]-c2[ma2]) << endl;
  }
  return 0;
}


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

int main(){
  int N,K;
  cin>>N>>K;
  string S;
  cin>>S;
  if(S.at(K-1)=='A'){
    S.at(K-1)='a';
  }
  if(S.at(K-1)=='B'){
    S.at(K-1)='b';
  }
  if(S.at(K-1)=='C'){
    S.at(K-1)='c';
  }
  cout<<S<<endl;
}

Measured memory_bytes: 256
/* Jai Shree Ram
ॐ नमो भगवते वासुदेवाय नमः*/

#include <bits/stdc++.h>
#define endl "\n"
#define FIXED_FLOAT(x,pres) std::fixed <<std::setprecision(pres)<<(x)
#define pb push_back
#define all(a) a.begin(),a.end()
using namespace std;
typedef long long ll;

template <typename T>
class Range {
  public:
    Range(const T& start, const T& stop, const T& step) : start_{start}, stop_{stop}, step_{step} {
        if (step_ == 0) {
            throw std::invalid_argument("Range step argument must not be zero");
        } else {
            if ((start_ > stop_ && step_ > 0) || (start_ < stop_ && step_ < 0)) {
                throw std::invalid_argument("Range arguments must result in termination");
            }
        }
    }
    
    class iterator {
      public:
        typedef std::forward_iterator_tag iterator_category;
        typedef T value_type;
        typedef T& reference;
        typedef T* pointer;

        iterator(value_type value, value_type step, value_type boundary) : value_{value}, step_{step},
                                                                           boundary_{boundary},
                                                                           positive_step_(step_ > 0) {}
        iterator operator++() { value_ += step_; return *this; }
        reference operator*() { return value_; }
        const pointer operator->() { return &value_; }
        bool operator==(const iterator& rhs) { return positive_step_ ? (value_ >= rhs.value_ && value_ > boundary_)
                                                                     : (value_ <= rhs.value_ && value_ < boundary_); }
        bool operator!=(const iterator& rhs) { return positive_step_ ? (value_ < rhs.value_ && value_ >= boundary_)
                                                                     : (value_ > rhs.value_ && value_ <= boundary_); }
        
      private:
        value_type value_;
        const T step_;
        const T boundary_;
        const bool positive_step_;
    };
    
    iterator begin() const {
        return iterator(start_, step_, start_);
    }
    
    iterator end() const {
        return iterator(stop_, step_, start_);
    }
  
  private:
    const T start_;
    const T stop_;
    const T step_;
};

template <typename T>
Range<T> range(const T& stop) {
    return Range<T>(T{0}, stop, T{1});
}

template <typename T>
Range<T> range(const T& start, const T& stop) {
    return Range<T>(start, stop, T{1});
}

template <typename T>
Range<T> range(const T& start, const T& stop, const T& step) {
    return Range<T>(start, stop, step);
}
/*-----------------------------------------------------------------------------*/

/*-----------------------------------------------------------------------------*/
void solve(){
    ll a[2],b[2];
    cin >> a[0] >> a[1] >> b[0] >> b[1];
    ll mx = a[0]*b[0];
    for(ll i : a){
        for(ll j : b){
            if(i*j > mx) mx = i*j;
        }
    }
    cout << mx;
}

int main(){
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int t=1;
    // cin>>t;
    while(t--){
        solve();
        // cout<< endl;
    }
    return 0;
}

Measured memory_bytes: 3620
n = int(input())
left = [None for i in range(n)]
right = [None for i in range(n)]
root = sum(range(n)) - n - 1

for i in range(n):
    i, l, r = map(int, input().split())
    left[i] = l
    right[i] = r
    root -= (l + r)

def Preorder(i):
    if i == -1:
        return
    print(" {}".format(i), end = "")
    Preorder(left[i])
    Preorder(right[i])

def Inorder(i):
    if i == -1:
        return
    Inorder(left[i])
    print(" {}".format(i), end = "")
    Inorder(right[i])

def Postorder(i):
    if i == -1:
        return
    Postorder(left[i])
    Postorder(right[i])
    print(" {}".format(i), end = "")

print("Preorder")
Preorder(root)
print()

print("Inorder")
Inorder(root)
print()

print("Postorder")
Postorder(root)
print()

Measured memory_bytes: 7848
colors = list(map(str, input().split()))
numbers = list(map(int, input().split()))
target_color = input() 

for index, color in enumerate(colors):
  if color == target_color:
    numbers[index] = numbers[index] - 1
    
 
for num in numbers:
  print(str(num) + " ", end="") 
  


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

int main()
{
  int N, K;
  while (cin >> N >> K && N != 0) {
    vector<int> s(K);
    for (int i = 0; i < K; i++) {
      cin >> s[i];
    }
    for (int i = 0; i < N; i++) {
      for (int j = 0; j < K; j++) {
        int x;
        cin >> x;
        s[j] -= x;
      }
    }
    if (find_if(s.begin(), s.end(), bind2nd(less<int>(), 0)) == s.end()) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 896
package main

import (
	"fmt"
)

func main() {
	var a, b, x int64
	fmt.Scan(&a, &b, &x)
	f := func(n int64) int64 {
		if n == -1 {
			return 0
		} else {
			return n/x + 1
		}
	}
	fmt.Println(f(b) - f(a-1))
}


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

void Division( long num1, long num2 );

int main()
{
    char str1[15];
    char str2[15];
    long num1;
    long num2;
    char *dummy;
    
    fscanf(stdin, "%s", str1);
    fscanf(stdin, "%s", str2);
    num1 = strtol(str1,&dummy,0);
    num2 = strtol(str2,&dummy,0);
    
    Division( num1,num2 );

    return 0;
}

void Division( long x, long y )
{
    long remainder = 1;
    if( x >= y )
    {
        while( 0 != remainder )
        {
            remainder = x % y;
            x = y;
            y = remainder;
        }
        printf("%d\n",x);
    }
    else
    {
        while( 0 != remainder )
        {
            remainder = y % x;
            y = x;
            x = remainder;
        }
        printf("%d\n",y);
    }
}




Measured memory_bytes: 2104
#include<algorithm>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cstdio>
#include<iomanip>
#include<cmath>
using namespace std;

int main() {
    string S;
    cin >> S;
    if (S == "ARC") {
        cout << "ABC";
    } else {
        cout << "ARC";
    }
    return 0;
}

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

using namespace std;

#define ge getchar()
#define Re read()

inline int read() {
	int x = 0, ch;
	while(!isdigit(ch = ge)) ;
	while(isdigit(ch)) x = (x << 1) + (x << 3) + (ch ^ 48), ch = ge;
	return x;
}

template<typename T>
inline void chkmax(T&a, T b) { a = a > b ? a : b; }
template<typename T>
inline void chkmin(T&a, T b) { a = a < b ? a : b; }

int res[3001];
int A[3001];
int B[3001];
int C[3001];
int len;
int p;

inline int ksm(int x, int k) {
	int s = 1;
	while(k) {
		if(k & 1) s = 1LL * s * x % p;
		x = 1LL * x * x % p; k >>= 1;
	} return s;
}

inline void Add(int a[], int b[], int m) {
	for(int i = 0; i < p; i++)
		a[i] = (a[i] + b[i] * m) % p;
}

inline void Div(int a[], int b[], int v) {
	int rt = 0;
	for(int i = len - 1; i; i--) {
		int ml = rt + a[i]; b[i - 1] = ml;
		a[i - 1] = (a[i - 1] + v * ml) % p;
	}
}

int main() {
	p = Re; A[1] = 1, len = 2;
	for(int i = 1; i < p; i++) {
		for(int j = len; j >= 1; j--) {
			A[j] = (-A[j] * i % p + p + A[j - 1]) % p;
		} ++len;
	}
	for(int i = 0; i < p; i++) {
		int a = Re, mul = 1;
		if(!a) continue;
		for(int j = 0; j < p; j++)
			if(i != j) mul = mul * (i - j + p) % p;
		mul = ksm(mul, p - 2);
		memcpy(C, A, sizeof(A));
		// for(int j = 0; j <= p; j++) cout << C[j] << ' '; cout << endl;
		Div(C, B, i);
		// for(int j = 0; j < p; j++) cout << B[j] << ' '; cout << endl;
		Add(res, B, mul);
	}
	for(int i = 0; i < p; i++) printf("%d ", res[i]); puts("");
	return 0;
}

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

typedef long long ll;

#define rep(i, a, n) for (ll i = a; i < (ll)n; ++i)
#define INF 10e9
#define MOD 1000000000 + 7
#define MAX 51000
#define all(x) (x).begin(), (x).end()
#define MX(x) *max_element(all(x))
#define MN(x) *min_element(all(x))

using namespace std;

int main(void)
{
    ll x;
    cin >> x;
    ll i = 0;
    while (x > 0)
        x -= i, i++;
    cout << --i << endl;
}

Measured memory_bytes: 3596
#include<stdio.h>
long long int h[400005], l;
int comp_h(long long int a, long long int b)
{
	if (h[a] < h[b])return 1;
	return -1;
}
void swap_h(long long int a, long long int b)
{
	long long int f = h[a];
	h[a] = h[b];
	h[b] = f;
	return;
}
void f1(long long int ne)
{
	h[l] = ne;
	long long int p = l;
	l++;
	while (p > 0)
	{
		if (comp_h((p - 1) / 2, p) > 0)
			swap_h((p - 1) / 2, p);
		p = (p - 1) / 2;
	}
	return;
}
long long int f2()
{
	l--;
	swap_h(0, l);
	long long int p = 0;
	for (;;)
	{
		if (2 * p + 2 < l)
		{
			if (comp_h(2 * p + 1, 2 * p + 2) > 0)
			{
				if (comp_h(p, 2 * p + 2) > 0)
					swap_h(p, 2 * p + 2);
				p = 2 * p + 2;
			}
			else
			{
				if (comp_h(p, 2 * p + 1) > 0)
					swap_h(p, 2 * p + 1);
				p = 2 * p + 1;
			}
		}
		else if (2 * p + 1 < l)
		{
			if (comp_h(p, 2 * p + 1) > 0)
				swap_h(p, 2 * p + 1);
			p = 2 * p + 1;
		}
		else
			break;
	}
	return h[l];
}
int main()
{
	long long int n;
	scanf("%lld", &n);
	long long int i;
	long long int a[200005];
	for (i = 0; i < n; i++)
		scanf("%lld", &a[i]);
	l = 0;
	for (i = 0; i < n; i++)
		f1(a[i]);
	for (i = 0; i < n; i++)
		a[i] = f2();
	long long int ans = 0;
	long long int r;
	l = r = 0;
	h[r] = a[0];
	r++;
	for (i = 1; i < n; i++)
	{
		ans += h[l];
		l++;
		h[r] = h[r + 1] = a[i];
		r += 2;
	}
	printf("%lld\n", ans);
	return 0;
}

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


int x,y;
int sx[200],sy[200],gx[1000],gy[1000],m,n,ss;
void Ssort(){
	int a,b,c;
	for(a=0;a<m-1;a++){
		for(b=a;b<m;b++){
			if(sy[a]>sy[b]){
				c=sy[a];
				sy[a]=sy[b];
				sy[b]=c;
				c=sx[a];
				sx[a]=sx[b];
				sx[b]=c;
			}
			if(sy[a]==sy[b] && sx[a]>sx[b]){
				c=sy[a];
				sy[a]=sy[b];
				sy[b]=c;
				c=sx[a];
				sx[a]=sx[b];
				sx[b]=c;
			}
		}
	}
}
void Gsort(){
	int a,b,c;
	for(a=0;a<n-1;a++){
		for(b=a;b<n;b++){
			if(gy[a]>gy[b]){
				c=gy[a];
				gy[a]=gy[b];
				gy[b]=c;
				c=gx[a];
				gx[a]=gx[b];
				gx[b]=c;
			}
			if(gy[a]==gy[b] && gx[a]>gx[b]){
				c=gy[a];
				gy[a]=gy[b];
				gy[b]=c;
				c=gx[a];
				gx[a]=gx[b];
				gx[b]=c;
			}
		}
	}
}
int Scheck(int k){
	int a;
	for(a=k;a<n;a++){
		if(sy[ss]<gy[a]-y){
			return 0;
		}
		if(sx[ss]+x==gx[a] && sy[ss]+y==gy[a]){
			ss++;
		}
		if(ss==m){
			return 1;
		}
	}
	return 0;
}
int Seiza(){
	int a;
	for(a=0;a<n-m+1;a++){
		ss=1;
		x=gx[a]-sx[0];
		y=gy[a]-sy[0];
		if(Scheck(a)==1)return 1;
	}
	return 0;
	
}
int main(void){
	int a,b;
	while(1){
		scanf("%d",&m);
		if(m==0)break;
		for(a=0;a<m;a++){
			scanf("%d %d",&sx[a],&sy[a]);
		}
		Ssort();
		scanf("%d",&n);
		for(a=0;a<n;a++){
			scanf("%d %d",&gx[a],&gy[a]);
		}
		Gsort();
		if(Seiza()==1)printf("%d %d\n",x,y);else printf("-1\n");
	}
	return 0;
}

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

int main() {
	int n, a[100];
	cin >> n;
	for(int i=1; i<=n; i++)
		cin >> a[i];
	if(n%2 == 0){
		for(int j=1; j<=n/2; j++)
		std::swap(a[j], a[n-j+1]);		
	}
	else{
		for(int j=1; j<=(n-1)/2; j++)
		std::swap(a[j], a[n-j+1]);
	}
	for(int k=1; k<n; k++)
		std::cout << a[k] << " ";
	cout << a[n] <<endl;
}


Measured memory_bytes: 3120
#include <bits/stdc++.h>
#define rep(i, N) for (int i = 0; i < (N); i++)
#define vec vector<int>
using namespace std;
int p(int D)
{
    int s = 1;
    for (int i = 0; i < D; i++)
    {
        s *= 100;
    }
    return s;
}
int main()
{
    int D, N;
    cin >> D >> N;
    if (N == 100)
    {
        cout << 101 * p(D) << endl;
    }
    else
    {
        cout << p(D) * N << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> iint;
typedef pair<ll,ll> llll;
#define ALL(x) (x).begin(),(x).end()
const ll zero = 0;
const ll one = 1;
const ll INF = 9223372036854775807; //10^18
const int inINF = 2147483647; //10^9
const ll MOD = 1000000007; //10^9+7
const ll MOD2 = 998244353;
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int main(){
    ll N, M; cin >> N >> M;
    vector<ll> a(N);
    for (ll i = 0; i < N; i++) {
        cin >> a[i];
    }
    vector<ll> s(N+1);
    s[0] = 0;
    for (ll i = 0; i < N; i++) {
        s[i+1] = (s[i] + a[i]) % M;
    }

    map<ll,ll> m;
    for (ll i = 0; i < N+1; i++) {
        if(m.count(s[i])){
            m[s[i]]++;
        }
        else{
            m[s[i]] = 1;
        }
    }

    ll ans = 0;
    for (auto v : m){
        ll c = v.second;
        ans += c * (c-1) / 2;
    }
    printf("%lld\n", ans);

}

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

int main(){
  int A, B, K;
  cin >> A >> B >> K;
  int buff=0;
  if(A < B){
    buff=B;
  }else{
    buff=A;
  }
  
  int cnt=0;
  for(int i=buff; i>0; i--){
    if(A%i==0 && B%i==0){
      cnt++;
      if(cnt == K){
        cout << i << endl;
        return 0;
      }
    }
  
  }

  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<sstream>
#include<cmath>
#include<vector>
#include<iomanip>
#include<map>
#include<set>
#include<queue>
#include<deque>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i,n) for(int i = 0; i < n;i++)
#define req(i,n) for(int i = 1;i <= n;i++)
#define rrep(i,n) for(int i = n -1;i >= 0;i--)
#define ALL(a)  (a).begin(),(a).end()
#define fix  fixed << setprecision(10)
const int MOD = 1000000007;
const ll INF = (1LL << 60);
string s,t; ll n,m, q, ans = 0, sum;
bool f = true;
int main() {
    cin >> n >> m; vector<int> a(m);
    rep(i, m) {
        cin >> a[i]; sum += a[i];
    }
    if (sum > n) cout << -1 << endl;
    else cout << n - sum << endl;
}

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

long long N, A[87];
long long dp[87];

int main() {
	cin >> N;
	for (int i = 1; i <= N; i++) cin >> A[i];

	dp[1] = 1000;
	for (int i = 2; i <= N; i++) {
		dp[i] = dp[i - 1];
		for (int j = 1; j <= i - 1; j++) {
			long long V = dp[j] / A[j];
			long long W = dp[j] + (A[i] - A[j]) * V;
			dp[i] = max(dp[i], W);
		}
	}
	cout << dp[N] << endl;
	return 0;
}


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

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

const Int INF = 1e15;
Int dp[1<<4][111][111];

signed main(){
  Int n,m,e,s,t,r;
  cin>>n>>m>>e>>s>>t>>r;
  vector<vector<Int>> G(n),H(n);
  for(Int i=0;i<m;i++){
    Int a,b;
    cin>>a>>b;
    G[a].emplace_back(b);
    G[b].emplace_back(a);
  }

  vector<Int> as(e),bs(e),cs(e);
  for(Int i=0;i<e;i++) cin>>as[i]>>bs[i]>>cs[i];

  for(Int b=0;b<16;b++)
    for(Int i=0;i<111;i++)
      for(Int j=0;j<111;j++)
	dp[b][i][j]=INF;

  using T = tuple<Int, Int, Int>;
  deque<T> que;
  dp[0][s][0]=0;
  que.emplace_back(0,s,0);

  while(!que.empty()){
    Int b,v,d;
    tie(b,v,d)=que.front();que.pop_front();


    // event
    for(Int i=0;i<e;i++){
      if(v==cs[i]){
	Int nb=b|(1<<i);
	Int nv=v;
	Int nd=d;	
	if(dp[nb][nv][nd]>dp[b][v][d]+0){
	  dp[nb][nv][nd]=dp[b][v][d]+0;
	  que.emplace_front(nb,nv,nd);
	}
      }
    }

    // okarina
    {
      Int nb=b;
      Int nv=s;
      Int nd=0;      
      if(dp[nb][nv][nd]>dp[b][v][d]+1){
	dp[nb][nv][nd]=dp[b][v][d]+1;
	que.emplace_back(nb,nv,nd);
      }
    }
    
    if(d==r) continue;
    
    // normal route
    for(Int u:G[v]){
      Int nb=b;
      Int nv=u;
      Int nd=d+1;      
      if(dp[nb][nv][nd]>dp[b][v][d]+1){
	dp[nb][nv][nd]=dp[b][v][d]+1;
	que.emplace_back(nb,nv,nd);
      }
    }

    // event route
    for(Int i=0;i<e;i++){
      if((~b>>i)&1) continue;
      if(bs[i]==v) swap(as[i],bs[i]);
      if(as[i]!=v) continue;
      // a -> b
      Int nb=b;
      Int nv=bs[i];
      Int nd=d+1;      
      if(dp[nb][nv][nd]>dp[b][v][d]+1){
	dp[nb][nv][nd]=dp[b][v][d]+1;
	que.emplace_back(nb,nv,nd);
      }
    }
  }  
  
  Int ans=INF;  
  for(Int b=0;b<16;b++)
    for(Int j=0;j<=r;j++)
      chmin(ans,dp[b][t][j]);
  if(ans==INF) ans=-1;
  
  cout<<ans<<endl;
  return 0;
}



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



int main()
{
	int t;
	cin >> t;
	int h = t / 3600;
	int M = t % 3600;
	int m = M / 60;
	int s = M % 60;
	cout << h << ":" << m << ":" << s << endl;
    return 0;
}

Measured memory_bytes: 3076
#include<bits/stdc++.h>
using namespace std;
int n,m,num;
int a[105],sum;
int main(){
	cin>>n>>m;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
		sum+=a[i];
	}
	double x=sum/(4.0*m); 
	for(int i=1;i<=n;i++)
	{
		if(a[i]>=x)
		num++;
	}
	if(num>=m)
    cout<<"Yes";
    else
    cout<<"No";
return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <complex>
#include <utility>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <tuple>
#include <cmath>
#include <bitset>
#include <cctype>
#include <set>
#include <map>
#include <unordered_map>
#include <numeric>
#include <functional>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
inline void Yes(bool condition){ if(condition) PRINT("Yes"); else PRINT("No"); }
template<class itr> void cins(itr first,itr last){
    for (auto i = first;i != last;i++){
        cin >> (*i);
    }
}
template<class itr> void array_output(itr start,itr goal){
    string ans = "",k = " ";
    for (auto i = start;i != goal;i++) ans += to_string(*i)+k;
    if (!ans.empty()) ans.pop_back();
    PRINT(ans);
}
ll gcd(ll a, ll b) {
    return a ? gcd(b%a,a) : b;
}
const ll INF = 1e15;
const ll MOD = 1000000007;
const ll MOD2 = 998244353;
typedef pair<ll,ll> P;
typedef pair<double,double> point;
const ll MAX = 2000005;
constexpr ll nx[8] = {1,0,-1,0,1,-1,1,-1};
constexpr ll ny[8] = {0,1,0,-1,1,1,-1,-1};
ll fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

ll COM(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
ll RepeatSquaring(ll N, ll P, ll M){
    if(P==0) return 1;
    if(P%2==0){
        ll t = RepeatSquaring(N, P/2, M);
        return t*t % M;
    }
    return N * RepeatSquaring(N, P-1, M)%M;
}
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll k;
    cin >> k;
    string s;
    cin >> s;
    ll n = s.length();
    COMinit();
    ll ans = 0;
    rep(i,n,n+k+1){
        ans += COM(i-1,n-1)*RepeatSquaring(25,i-n,MOD)%MOD*RepeatSquaring(26,n+k-i,MOD)%MOD;
        ans %= MOD;
    }
    PRINT(ans);
}


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

inline int read()
{
	int x = 0, f = 1; char ch = getchar();
	for (; ch < '0' || ch > '9'; ch = getchar()) if (ch == '-') f = -1;
	for (; ch >= '0' && ch <= '9'; ch = getchar()) x = (x << 1) + (x << 3) + ch - '0';
	return x * f;
}

const int N = 2e5 + 5;
int Max[N][20], Min[N][20], low[N];

int Maxs(int l, int r)
{
	int p = low[r - l + 1];
	return max(Max[l][p], Max[r - (1 << p) + 1][p]);
}

int Mins(int l, int r)
{
	int p = low[r - l + 1];
	return min(Min[l][p], Min[r - (1 << p) + 1][p]);
}

int main()
{
	int n = read();
	int k = read();
	for (int i = 1; i <= n; ++i) Min[i][0] = Max[i][0] = read();
	for (int p = 1; (1 << p) <= n; ++p)
		for (int i = 1; i + (1 << p) - 1 <= n; ++i)
			Max[i][p] = max(Max[i][p - 1], Max[i + (1 << (p - 1))][p - 1]),
			Min[i][p] = min(Min[i][p - 1], Min[i + (1 << (p - 1))][p - 1]);
	for (int i = 2; i <= n; ++i) low[i] = low[i >> 1] + 1;
	
	int ans = 0;
	for (int i = 1, j = 1; i <= n; i = j)
	{
		++j;
		while (Min[j][0] > Min[j - 1][0] && j <= n) ++j;
		ans += (j - i >= k);
	}
	
	ans = n - k + 1 - max(0, ans - 1);
	for (int i = 1; i <= n - k; ++i)
	{
		int l = i, r = i + k;
		if (Mins(l, r) == Min[l][0] && Maxs(l, r) == Max[r][0])
			--ans;
	}
	printf("%d\n", ans);
	
	return 0;
}


Measured memory_bytes: 32256
import java.util.*;
import java.io.*;
import java.awt.geom.*;
import java.math.*;

public class Main {

	static final Scanner in = new Scanner(System.in);
	static final PrintWriter out = new PrintWriter(System.out,false);
	static boolean debug = false;

	static boolean solve() {
		int n = in.nextInt();
		int m = in.nextInt();
		if (n + m == 0) return false;

		boolean[][] time = new boolean[m][2000];

		HashMap<Integer,Integer> map = new HashMap<>();

		int r = in.nextInt();
		for (int i=0; i<r; i++) {
			int t = in.nextInt();
			int p = in.nextInt() - 1;
			int x = in.nextInt() - 1;
			int s = in.nextInt();
			if (s == 1) {
				map.put(x*n+p, t);
			} else {
				int from = map.get(x*n+p);
				for (int j=from; j<t; j++) {
					time[x][j] = true;
				}
			}
		}

		int q = in.nextInt();
		while (q-- > 0) {
			int s = in.nextInt();
			int e = in.nextInt();
			int x = in.nextInt() - 1;
			int ans = 0;
			for (int i=s; i<e; i++) {
				if (time[x][i]) ans++;
			}
			out.println(ans);
		}

		return true;
	}

	public static void main(String[] args) {
		debug = args.length > 0;
		long start = System.nanoTime();

		while(solve());
		out.flush();

		long end = System.nanoTime();
		dump((end - start) / 1000000 + " ms");
		in.close();
		out.close();
	}

	static void dump(Object... o) { if (debug) System.err.println(Arrays.deepToString(o)); }
}

Measured memory_bytes: 125672
#include <iostream>
#include <iomanip>
#include <algorithm>
 
using namespace std;
 
int det(int a, int b, int c, int d) {
    return a * d - b * c;
}
 
int main() {
    int a[6];
    while(cin) {
        for(int i = 0; i < 6; i++)
            cin >> a[i];
        if(!cin)
            break;
        int d = det(a[0], a[1], a[3], a[4]);
        int x1 = det(a[2], a[1], a[5], a[4]);
        int x2 = det(a[0], a[2], a[3], a[5]);
        cout << setprecision(3) << fixed << 1. * x1 / d + 1e-9 << " ";
        cout << setprecision(3) << fixed << 1. * x2 / d + 1e-9 << endl;
    }
 
    return 0;
}

Measured memory_bytes: 1240
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;
//
#define int long long
#define ALL(x) (x).begin(), (x).end()
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
#define m0(x) memset((x), 0, sizeof(x))
#define mm(x) memset((x), -1, sizeof(x))
// bit_macro
#define bit(n) (1LL << (n))
#define bitset(a, b) (a) |= (1 << (b))
#define bitunset(a, b) (a) |= ~(1 << (b))
#define bitcheck(a, b) ((a) >> (b)) & 1
#define bitcount(a) __builtin_popcountll((a))
//
typedef int lint;
typedef pair<int, int> P;
typedef tuple<int, int, int> TP;
typedef vector<int> vec;
typedef vector<vec> mat;
//
const int INF = (int)1e18;
const int MOD = (int)1e9 + 7;
const double EPS = (double)1e-10;
const int dx[] = {-1, 0, 0, 1};
const int dy[] = {0, -1, 1, 0};
//
template <typename T> void chmax(T &a, T b) { a = max(a, b); }
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
//
struct Accelerate_Cin {
  Accelerate_Cin() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(20);
  };
};

int n, s, sub, b = -1;

signed main() {
  cin >> n >> s;
  sub = n - s;
  if (n == s) {
    cout << n + 1 << endl;
    return 0;
  }
  for (int i = 2; i * i <= n; ++i) {
    int now = n, sum = 0;
    while (now > 0) {
      sum += now % i;
      now /= i;
    }
    if (sum == s) {
      cout << i << endl;
      return 0;
    }
  }
  for (int i = 1; i * i <= sub; ++i) {
    if (sub >= 0 && sub % i == 0) {
      int x = sub / i + 1;
      if (x > (s - i) && i <= s && x * i + (s - i) == n) {
        if (b == -1)
          b = x;
        b = min(b, x);
      }
      x = i + 1;
      if (x * x > n && x > i && sub / i <= s &&
          x * (sub / i) + (s - (sub / i)) == n) {
        if (b == -1)
          b = x;
        b = min(b, x);
      }
    }
  }
  cout << b << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;
int main()
{
    int n,m,a[202];
    cin>>n>>m;
    int maxi;
    if(n>m){
       maxi = n;
    }
    else{
        maxi = m;
    }
    ///cout<<maxi<<endl;
    for(int i=1;i<=maxi*2;i+=1){
        if(i%2==0){
           a[i] = 0;
           if(n>0){
              a[i] = i;
              ///cout<<a[i]<<endl;
              n--;
           }
        }
        else{
           a[i] = 0;
           if(m>0){
              a[i] = i;
              ///cout<<a[i]<<endl;
              m--;
           }
       }
    }
    int s,sum=0;
    for(int i=1;i<=maxi*2;i+=1){
        if(a[i]!=0){
            for(int j=i+1;j<=maxi*2;j+=1){
                if(a[j]!=0){
                s = a[i]+a[j];
                ///cout<<s<<endl;
                if(s%2==0){
                    sum++;
                }
               }
            }
        }
    }
    cout<<sum<<endl;


    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int x1,y1,x2,y2;
    cin >> x1 >> y1 >>x2>>y2;
    int x3,y3,x4,y4;
    x3 = x2+(y1-y2);
    y3 = y2-(x1-x2);
    x4 = x3+(y2-y3);
    y4 = y3-(x2-x3);
    cout << x3 << " " << y3 <<" "<<x4<<" "<<y4<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	long long s=0;
	for(int i=1;i<=n;i++)
	{
		if(i%3!=0 && i%5!=0)
		s+=i;
	}
	cout<<s;
 } 

Measured memory_bytes: 3592
n=int(input())
h = [input() for d in range (n)]
alphabet=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
list=[]


for k in range(26):
    m=50
    for i in range (n):
         x =h[i].count(alphabet[k])
         m =min(x,m)
    list.append(alphabet[k]*m)

print(''.join(list))



Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<double,int>;
const ll inf = numeric_limits<ll>::max()/3;

int main(void){
  int n;
  vector< ll > a;
  cin >> n;
  a.resize(n);
  map<ll,ll> m;
  ll calc = 0,cnt = 0;
  m[0] = 1;
  for(int i = 0;i < n;++i){
    cin >> a[i];
    calc += a[i];
    cnt += m[calc];
    ++m[calc];
  }
  cout << cnt << endl;
  return 0;
}



Measured memory_bytes: 14336
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int k,a,b,count=0;
    cin>>k>>a>>b;
    for(int i=k;i<=b;i=i+k)
    {
        if(i>=a && i<=b)
        {
            count++;
            break;
        }
    }
    if(count==0)
    {
        cout<<"NG";
    }
    else
    {
        cout<<"OK";
    }
}


Measured memory_bytes: 3636
// AOJ 1008: What Color Is The Universe?
// 2017.8.19 bal4u@uu
// 2017.11.9 retry

#include <stdio.h>
#include <string.h>

#define HASHSIZ 120011
typedef struct { int n, c; } HASH;
HASH hash[HASHSIZ+2], *hashend = hash+HASHSIZ;

int color, cnt;

int lookup(int n)
{
	HASH *p = hash + n % HASHSIZ;
	while (p->n) {
		if (p->n == n) return ++(p->c);
		if (++p == hashend) p = hash;
	}
	p->n = n, p->c = 1;
	return 1;
}

char buf[11000000], *p;
int getint()
{
	int n = 0;
	while (*p >= '0') n = (n<<3) + (n<<1) + (*p++ & 0xf);
	return n;
}

int main()
{
	int n, n2, i, k;

	while (fgets(p=buf, 20, stdin) && *p != '0') {
		n = getint(), n2 = n >> 1;
		memset(hash, 0, sizeof(hash));
		fgets(p=buf, sizeof(buf), stdin);
		for (cnt = 1, i = n; i--; ) {
			k = getint(), p++;
			if (lookup(k) == cnt) cnt++, color = k;
		}
		if (--cnt > n2) printf("%d\n", color);
		else puts("NO COLOR");
	}
	return 0;
}

Measured memory_bytes: 8228
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>

using namespace std;

#define x first
#define y second
#define mp make_pair
#define pb push_back

typedef long long ll;

const ll MOD = 1e9+7;

int main() {
	int n;
	cin >>n;
	cout <<(n-1)/2<<endl;
	return 0;
}

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

int main() {
    while (true) {
        int sales[5][2];
        for (int i = 0; i < 5; i++) {
            cin >> sales[i][0] >> sales[i][1];
        }
        if (sales[0][0] == 0 && sales[0][1] == 0) {
            break;
        }
        int max[2] = {};
        for (int i = 0; i < 5; i++) {
            int s = sales[i][0] + sales[i][1];
            if (max[1] < s) {
                max[0] = i;
                max[1] = s;
            }
        }
        printf("%c %d\n", 'A' + max[0], max[1]);
    }
}

Measured memory_bytes: 0
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <queue>
using namespace std;
inline int read()
{
	int f = 1, x = 0;
	char ch;

	do{
		ch = getchar();
		if (ch == '-')
			f = -1;
	}while(ch < '0' || ch > '9');
	do{
		x = x * 10 + ch - '0';
		ch = getchar();
	}while(ch >= '0' && ch <= '9');
	return f * x;
}
const int N = 2e5 + 1;

int n, s, t;
int a[N + 1], b[N + 1];
int id[3][N + 1], cnt;
struct Edge {
	int	to, next, oppo;
	int	done, maxx;
} edge[(N << 3) + 1];
int tot, start[N + 1], cur[N + 1];
queue<int> q;
int vis[N + 1], dep[N + 1];
int ans, num;

inline void add(int u, int v, int flow)
{
	edge[++tot] = Edge{ v, start[u], tot + 1, 0, flow };
	start[u] = tot;
	edge[++tot] = Edge{ u, start[v], tot - 1, 0, 0 };
	start[v] = tot;
	return;
}
inline bool bfs()
{
	for (int i = s; i <= t; i++)
		vis[i] = dep[i] = 0;
	q.push(s);
	dep[s] = vis[s] = 1;
	while (q.size()) {
		int u = q.front();
		q.pop();
		for (int i = start[u]; i; i = edge[i].next) {
			int v = edge[i].to;
			if (!vis[v] && edge[i].done < edge[i].maxx) {
				dep[v] = dep[u] + 1;
				vis[v] = 1;
				q.push(v);
			}
		}
	}
	return dep[t];
}
inline int dfs(int u, int flow)
{
	if (u == t || !flow)
		return flow;
	int val = 0;

	for (int &i = cur[u]; i; i = edge[i].next) {
		int v = edge[i].to;
		if (dep[v] == dep[u] + 1) {
			int w = dfs(v, min(flow, edge[i].maxx - edge[i].done));
			if (w > 0) {
				edge[i].done += w;
				edge[edge[i].oppo].done -= w;
				val += w;
				flow -= w;
				if (!flow)
					break;
			}
		}
	}
	return val;
}
inline void dinic()
{
	while (bfs()) {
		for (int i = s; i <= t; i++)
			cur[i] = start[i];
		ans += dfs(s, 2147483647);
	}
	return;
}
inline void number(int now, int opt)
{
	if (id[opt][now])
		return;
	id[opt][now] = cnt;
	if (opt == 1)
		number(a[now] + 1, opt);
	else
		number(b[now] + 1, opt);
	return;
}
int main()
{
	n = read();
	for (int i = 1; i <= n; i++)
		a[i] = read();
	for (int i = 1; i <= n; i++)
		b[i] = read();
	for (int i = 1; i <= n; i++) {
		if (!id[1][i]) {
			cnt++;
			number(i, 1);
		}
	}
	for (int i = 1; i <= n; i++) {
		if (!id[2][i]) {
			cnt++;
			number(i, 2);
		}
	}
	s = 0;
	t = ++cnt;
	for (int i = 1; i <= n; i++) {
		if (a[i] == b[i]) {
			if (a[i] == i - 1) {
				num++;
			} else {
				add(id[1][i], id[2][i], 1);
				add(id[2][i], id[1][i], 1);
			}
		} else {
			if (a[i] != i - 1 && b[i] == i - 1)
				add(s, id[1][i], 1);
			if (a[i] == i - 1 && b[i] != i - 1)
				add(id[2][i], t, 1);
			if (a[i] != i - 1 && b[i] != i - 1)
				add(id[2][i], id[1][i], 1);
		}
	}

	dinic();

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


Measured memory_bytes: 15564
#include <iostream>

using namespace std;

int main()
{
    string week[]{"SUN", "MON", "TUE", "WED", "THU", "FRI",  "SAT"};


    string s;
    cin>>s;

    if(s=="SUN")cout<<7<<endl;
    else if(s=="MON")cout<<6<<endl;
    else if (s=="TUE")cout<<5<<endl;
    else if (s=="WED")cout<<4<<endl;
    else if (s=="THU")cout<<3<<endl;
    else if (s=="FRI")cout<<2<<endl;
    else if (s=="SAT")cout<<1<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <utility>
#include <queue>
#include <set>
#include <map>

#define inf  100000000000007
#define ll long long
#define PA pair<int,int>
#define PPAP pair<int,pa>
#define  MP make_pair
#define  PB push_back
#define VI vector<int>

using namespace std;
long long  mod = 1000000007;

int main(){
	int n;
	cin >> n;
	vector<vector<ll> > a(n,vector<ll>(n)),b(n,vector<ll>(n)),c(n,vector<ll>(n));
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			cin >> a[i][j];
		}
	}
	b = a;
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			for(int k=0;k<n;k++){
				if(k==i||k==j)continue;			
				if(a[i][j]==(a[i][k]+a[k][j])){
					b[i][j]=inf;
				}
			}
		}
	}
	/*for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			cout << b[i][j] << " ";
		}
		cout << endl;
	}*/
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			if(i==j){
				c[i][j]=0;
			}else if(b[i][j]!=inf){
				c[i][j]=b[i][j];
			}else{
				c[i][j]=inf;
			}
		}
	}

	for(int k=0;k<n;k++){
		for(int i=0;i<n;i++){
			for(int j=0;j<n;j++){
				c[i][j] = min(c[i][j],c[i][k]+c[k][j]);
			}
		}
	}
	/*for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			cout << c[i][j] << " ";
		}
		cout << endl;
	}*/
	long long ans=0;
	bool flag=1;
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			if(a[i][j]!=c[i][j])flag = 0;
		}
	}
	if(flag){
		for(int i=0;i<n;i++){
			for(int j=0;j<n;j++){
				if(b[i][j]!=inf){
					ans += b[i][j];
				}
			}
		}
		cout << ans/2 << endl;
	}else{
		cout << -1 << endl;
	}
	return 0;
}

Measured memory_bytes: 2432
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace __gnu_pbds;
using namespace std;
#define ll long long
#define hii cout << "hii" << endl
#define int ll
#define endl '\n'
#define all(s) s.begin(), s.end()
 
template <class T> ostream& operator << (ostream &os, const vector<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T> ostream& operator << (ostream &os, const set<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T, class S> ostream& operator << (ostream &os, const pair<T, S> &v) { os << v.first << ' ' << v.second; return os; }
template <class T, class S> ostream& operator << (ostream &os, const unordered_map<T, S> &v) { for (auto i : v) os << '(' << i.first << "=>" << i.second << ')' << ' '; return os; } 
 
 
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <class Arg1> void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 << endl; }
    template <class Arg1, class... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args) {
        const char* sep = strchr(names + 1, ',');
        cerr.write(names, sep - names) << " : " << arg1 << "  ";
        __f(sep + 1, args...);
    }
#else
#define trace(...) 0
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("avx2,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define _CRT_SECURE_NO_WARNINGS
#endif // ifndef ONLINE_JUDGE
 
 
const int N = 1e6 + 5;
const int MAXN = 1e5 + 5;
const int M = 5e5;
const int mod = 998244353;
const int MOD = 998244353;
const int INF = 1e15;
const int LG = 21;

int arr[N];

class f
{
public:
	int l;
	int r;
	int idx;
	f(int a, int b, int c)
	{
		l = a;
		r = b;
		idx = c;
	}
};

void solve() 
{
	int n;
	cin >> n;
	set<string> s;
	while(n--)
	{
		string input;
		cin >> input;
		s.insert(input);
	}
	cout << s.size() << endl;
}

 
 
int32_t main() 
{	
    ios_base:: sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	    int t = 1;
	    // cin >> t;
	while(t--)solve();
	return 0;
}

Measured memory_bytes: 19288