akhauriyash/Code-Regression huggingface dataset:
//include
//------------------------------------------
#include <bits/stdc++.h>
using namespace std;
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef long long ll;
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const long long INF = 1000000007;
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
// chmax chmin
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

bool isMeet(string &s, int n){
    REP(i,n){
        if(s[i] != s[n+i]) return false;
    }
    return true;
}

int main(void){
    string s; cin >> s;
    int init;
    if(s.size()%2) init=s.size()/2;
    else init=s.size()/2-1;
    for(int i=init; i>0; i--){
        if(isMeet(s, i)){
            cout << 2*i << endl;
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>
  
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
  
using namespace std;
  
typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;
  
const int INF=1<<29;
const double EPS=1e-9;
  
const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};


int main() {
    int sx, sy, tx, ty;
    cin >> sx >> sy >> tx >> ty;
    int u = 0, r = 0;
    for(int i = sy; i < ty; i++) {
        cout << "U";
        u++;
    }
    for(int j = sx; j < tx; j++) {
        cout << "R";
        r++;
    }

    for(int i = 0; i < u; i++) {
        cout << "D";
    }
    for(int j = 0; j < r; j++) {
        cout << "L";
    }

    cout << "L";
    for(int i = 0; i <= u; i++) {
        cout << "U";
    }
    for(int j = 0; j <= r; j++) {
        cout << "R";
    }
    cout << "D";
    cout << "R";
    for(int i = 0; i <= u; i++) {
        cout << "D";
    }
    for(int j = 0; j <= r; j++) {
        cout << "L";
    }
    cout << "U" << endl;

    return 0;
}

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

using namespace std;

int main() {
	int n;
	cin >> n;
	
	int max_height = -1;
	int can_see = 0;
	
	for(int i = 0; i < n; i++) {
		int val;
		cin >> val;
		
		if(val >= max_height) can_see++;
		max_height = max(max_height, val);
	}
	
	cout << can_see;
	
	return 0;
}

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

using namespace std;
#define sz(a) (int)a.size()
#define int int64_t
const int MAXN = 2e5 + 1;
template<typename T1, typename T2>
ostream &operator<<(ostream &out, pair<T1, T2> &p) {
     out << "{" << p.first << ", " << p.second << "} ";//optional
     return out;
}

template<typename T1, typename T2>
istream &operator>>(istream &in, pair<T1, T2> &p) {
     in >> p.first >> p.second;
     return in;
}

template<typename T>
istream &operator>>(istream &in, vector<T> &arr) {
     for (auto &i : arr)
          in >> i;
     return in;
}

template<typename T>
ostream &operator<<(ostream &out, vector<T> &arr) {
     for (int i = 0; i < (int)arr.size(); ++i) {
          if (i != 0) {
               out << ' ';
          }
          out << arr[i];//optional
     }
     out << endl;
     return out;
}


signed main() {
     int n;
     cin >> n;
     vector<int> a(n);
     cin >> a;
     vector<int> ans(n);
     int l = 0;
     if (n % 2 == 1) {
          vector<int> aa = a;
          aa.pop_back();
          for (int i = n - 2; i >= 0; i -= 2) {
               ans[l++] = aa[i];
          }
          for (int i = 0; i < n - 1; i += 2) {
               ans[l++] = aa[i];
          }
          ans.back() = a.back();
          reverse(ans.begin(), ans.end());
     }
     l = 0;
     if (n % 2 == 0) {
          for (int i = n - 1; i >= 0; i -= 2) {
               ans[l++] = a[i];
          }
          for (int i = 0; i < n; i += 2) {
               ans[l++] = a[i];
          }
     }
     cout << ans << endl;
     return 0;
}

Measured memory_bytes: 5348
#include <iostream>
#include <stdio.h>
using namespace std;

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    if (a==b && a!=c) cout << "Yes" << endl;
    else if (b==c && c!=a) cout << "Yes" << endl;
    else if (c==a && a!=b) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}
const ll INF = 1LL<<60;
const ll M = pow(10,9)+7;
/*template*/

int main()
{
  ll n,m;cin>>n>>m;
  ll h[n];
  for(ll i=0;i<n;i++)cin>>h[i];
  ll hoge,huga;
  bool a[n]={false};
  for(ll i=0;i<m;i++){
    cin>>hoge>>huga;
    if(h[hoge-1]>h[huga-1]){
      a[huga-1]=true;
    }else if(h[hoge-1]<h[huga-1]){
      a[hoge-1]=true;
    }else{
      a[hoge-1]=true;
      a[huga-1]=true;
    }
  }
  ll ans=0;
  for(ll i=0;i<n;i++)if(!a[i])ans++;
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 4516
x = int(input())

l = -(-x//105)
h = x//100
#fix = l*100

for i in range(l,h+1):
    for b in range(0,i+1):
        for c in range(0,i+1):
            for d in range(0,i+1):
                for e in range(0,i+1):
                    if x - (i*100 + 1*b+2*c+3*d+4*e+5*(i-b-c-d-e)) == 0:
                            print('1')
                            exit()
else:
    print('0')

Measured memory_bytes: 9180
#include <stdio.h>

int main(int argc, const char * argv[]) {
    // insert code here...
    int m,min,max;
    while(scanf("%d%d%d",&m,&min,&max)==3){
        if(m == 0&& min == 0&& max == 0){
            break;
        }
        else{
            int a[10010];
            for(int i=0;i<m;i++){
                scanf("%d",&a[i]);
            }
            int step = 0;
            int index = 0;
            for(int i=min;i<=max;i++){
                if(a[i-1]-a[i]>=step){
                    step = a[i-1]-a[i];
                    index = i;
                }
            }
            printf("%d\n",index);
        }
    }
    return 0;
}



Measured memory_bytes: 2064
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(long i = 0; i < n; i++)
#define erep(i, n) for(long i = 1; i <= n; i++)
const long MOD = 1000000007;
#define all(a) a.begin(), a.end()
#define eall(a) a.begin()+1, a.end()
#define show(ans)  cout << ans << endl;


int main(){long N;
cin >> N;
vector<long> h(N+1);
long cnt = 0;
    erep(i, N) cin >> h[i];

if(N >= 2){
    for(long i = 1; i <= N-2; i++){
        if(h[i] >= h[i+1]){
            cnt += h[i] - h[i+1]; 
        }
    }
    if(h[N-1] > h[N]) cnt += h[N-1];
    else cnt += h[N];

}
else cnt = h[1];

show(cnt);
return 0;
}

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

#define rep(i, n) for (int i=0; i< (n); ++i)
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

using namespace std;

int main() {
    int a[9];
    int n;
    rep(i, 9) {
        cin >> a[i];
    }
    cin >> n;

    int b[n];
    rep(i, n) {
        cin >> b[i];

        rep(j, 9) {
            if (a[j] == b[i]) {
                a[j] = 0;
                break;
            }
        }
    }

    int ok = 1;

    // check tate
    rep(i, 3) {
        ok = 1;
        rep(j, 3) {
            if (a[3*j+i] != 0) {
                ok = 0;
                break;
            }
        }

        if (ok == 1) {
            cout << "Yes" << endl;
            return 0;
        }
    }

    // check yoko
    rep(i, 3) {
        ok = 1;
        rep(j, 3) {
            if (a[3*i+j] != 0) {
                ok = 0;
                break;
            }
        }

        if (ok == 1) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    // check naname
    if (a[0] == 0 && a[4] == 0 && a[8] == 0) {
        cout << "Yes" << endl;
        return 0;
    }
    if (a[2] == 0 && a[4] == 0 && a[6] == 0) {
        cout << "Yes" << endl;
        return 0;
    }

    cout << "No" << endl;
}


Measured memory_bytes: 256
n = int(input())
l = list(map(int, input().split()))

if n < 3 :
    print(0)
    exit(0)

l = sorted(l)

cnt = 0

for x in range(len(l)):
    for y in range(x+1, len(l)):
        su = l[x] + l[y]
        for z in range(y+1, len(l)):
            if l[x] == l[y] or l[x] == l[z] or l[y] == l[z]:
                continue
            if su > l[z]:
                cnt += 1
                #print(l[x], l[y], l[z])
            else:
                break

    continue

print(cnt)

Measured memory_bytes: 9164
def sget; gets.chomp; end
def iget; sget.to_i; end
def saget; gets.chomp.split; end
def iaget; saget.map {|a| a.to_i }; end

require "pp"
counts = Hash[* "NSEW".split(//).map {|s| [s, 0] }.flatten]
S = sget;
S.split(//).each {|s| counts[s] = 1 }
if (counts["N"] ^ counts["S"]) == 0 && (counts["E"] ^ counts["W"]) == 0
    puts "Yes"
else
    puts "No"
end

Measured memory_bytes: 2300
{-# OPTIONS_GHC -O #-}

import Control.Monad
import Data.List
import Data.Ord
import qualified Data.ByteString.Lazy.Char8 as B

readIntLL :: IO [[Int]]
readIntLL = map(unfoldr(B.readInt.B.dropWhile(==' '))).B.lines<$>B.getContents

rsort = sortBy $ flip compare

ts [] = [0,0]
ts (_:[]) = [0,0]
ts (a:b:as)
    | a == b = a : (ts as)
    | True = ts (b:as)

main=do
    n:as <- readIntLL
    print $ product $ take 2 $ ts $ rsort $ head as


Measured memory_bytes: 16636
#include <cstdio>
using namespace std;
typedef long long ll;
ll H, atk;
int main() {
  scanf("%ld", &H);
  ll t = 1<<0, i = 0;
  while(t <= H) {
    atk += t;
    t = 1LL<<++i;
  }
  printf("%ld\n", atk);
}

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

int main() {
    int H, W;
    cin >> H >> W;

    while(!(H == 0 && W == 0)) {
        for(int i=0; i<H; ++i) {
            for(int j=0; j<W; ++j) {
                cout << "#";
            }
            cout << endl;
        }
        cout << endl;

        cin >> H >> W;
    }

    return 0;
}


Measured memory_bytes: 3100
#include<stdio.h>
#include<string.h>
int main(){
	int n;
	scanf("%d",&n);
	int data[n];
	char product[n][6];
	int i,j,k=0;
	for(i=0;i<n;i++){
		scanf(" %s %d",product[k],&data[k]);
		for(j=0;j<k;j++){
			if(strcmp(product[j],product[k])==0){//もし今までのデータに同じ製品があるなら統合
				product[k][0]='\0';
				data[j]+=data[k];
				data[k]=0;
				k--;
				break;
			}
		}
		k++;
	}
	while(k<n){//未使用部を初期化
		product[k][0]='\0';
		data[k]=0;
		k++;
	}
	int count=0;//商品の種類をカウント
	for(i=0;i<n;i++){
		if(product[i][0]!='\0'){
			count++;
		}
	}
	char carry[5];
	int temp;
	for(i=1;i<count;i++){//辞書式バブルソート
		for(j=count-1;j>=i;j--){
			if(strcmp(product[j-1],product[j])>0){
				strcpy(carry,product[j-1]);
				strcpy(product[j-1],product[j]);
				strcpy(product[j],carry);
				temp=data[j-1];
				data[j-1]=data[j];
				data[j]=temp;
			}
		}
	}
	for(i=1;i<6;i++){//文字数の少ない順に出力
		for(j=0;j<count;j++){
			if(strlen(product[j])==i){
				printf("%s %d\n",product[j],data[j]);
			}
		}
	}
	return 0;
}

Measured memory_bytes: 728
def lackSatisfaction(c, d, last):
    lack = 0
    max = 0
    mindex = 0
    for i in range(len(c)):
        tmp = c[i] * (d - last[i])
        lack += tmp
        if (max < tmp):
            max = tmp
            mindex = i
    return max, mindex

#365
D = int(input())
c = list(map(int, input().split()))

d = []
last = {}
for i in range(26):
    last[i] = 0

for i in range(D):
    s = list(map(int, input().split()))
    rate = 0
    type = 0
    maxLack, mindex = lackSatisfaction(c, i + 1, last)
    for j in range(len(s)):
        if (rate < s[j]):
            rate = s[j]
            type = j + 1
    if (maxLack < rate):
        d.append(type)
    else:
        d.append(mindex)
    last[type - 1] = i + 1

for i in range(len(d)):
    print(d[i])

Measured memory_bytes: 9304
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N,satisfy=0,x,y;
   cin>>N;
  vector<int> a(N);
  vector<int> b(N);
  vector<int> c(N);
 
  for(int i=0;i<N;i++) {
    cin>>a[i]; 
   	//cout<<a[i]<<endl;
  }
  for(int i=0;i<N;i++){
    cin>>b[i];
  	//cout<<b[i]<<endl;
  }
  for(int i=0;i<N-1;i++) {
    cin>>c[i];
  	//cout<<c[i]<<endl;
  }
  
  for(int i=0;i<N;i++){
    x=a[i]-1;
    //cout<<x<<endl;
    satisfy+=b[x];
    //cout<<b[x]<<endl;
    if(a[i]+1==a[i+1]){
      //cout<<"flag"<<endl;
      y=a[i]-1;
      //cout<<c[y]<<endl;
      satisfy+=c[y];
    }
  //  cout<<satisfy<<endl;
  }
  cout<<satisfy<<endl;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,Q,A,B,L,R;
string S,T;
const ll MOD = (1e+9) + 7;
const ll INF = 1LL << 60;
typedef pair<ll,ll> P;

typedef vector<P> vp;
typedef vector<vp> matP;

int main(){
    cin>>N>>M;
    vec p(N);
    rep(i,N){
        cin>>p[i];
        --p[i];
    }
    class union_find{
            vector<long> parent, tree_size;
        public:
            union_find(unsigned long _n) : parent(_n), tree_size(_n, 1){
                for(unsigned long i = 0; i < _n; ++i)parent[i] = i;
            }
            ll find(ll x){
                while(parent[x] != x)x = parent[x] = parent[parent[x]];
                return x;
            }
            void merge(ll a, ll b){
                a = find(a);
                b = find(b);
    	    if(a==b) return;
                if(tree_size[a] < tree_size[b])swap(a, b);
                tree_size[a] += tree_size[b];
                parent[b] = a;
                return;
            }
    	bool same(ll a, ll b){
    	    a = find(a);
    	    b = find(b);
    	    return a == b;
    	}
    };
    union_find uf(N);
    rep(i,M){
        cin>>A>>B;
        --A; --B;
        uf.merge(A, B);
    }
    ll ans = 0;
    rep(i,N) ans += (uf.same(i, p[i])) || (i == p[i]);
    cout<<ans<<endl;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, s, n) for (int i = (s); i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
  int n;
  cin >> n;
  int h[n];
  rep(i, n) cin >> h[i];
  int ans = 0;
  while (1) {
    int mini = 101;
    rep(i, n) {
      if (h[i] != 0) {
        mini = min(mini, h[i]);
        h[i]--;
        if (i == n - 1) ans++;
      } else {
        if (mini == 101)
          continue;
        else {
          ans++;
          mini = 101;
        }
      }
    }
    int sum = 0;
    rep(i, n) sum += h[i];
    if (sum == 0) break;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <string>
#include <iterator>
using namespace std;
int main()
{
	string inp;
	cin>>inp;
	int s=inp.size(),i;
	map <char,int> var;
	for(i=0 ; i<s ; i++){
		var[inp[i]]++;
	}
	auto itr=var.begin();
	for( ; itr!=var.end(); itr++){
		int x=itr->second;
		if(x%2!=0) break;
	}
	if(itr==var.end()) cout<<"Yes\n";
	else cout<<"No\n";
	return 0;
}

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

using namespace std;

int main(int, char**) {
        long long n, m;
        cin >> n >> m;
        long long m_max = (n - 1) / 2;
        int dif_e, dif_o;
        bool odd;
        if (m_max%2==0) {
                odd = false;
                dif_e = m_max;
                dif_o = m_max - 1;
        } else {
                odd = true;
                dif_o = m_max;
                dif_e = m_max - 1;
        }
        for (long long i=0; i<m; i++) {
                long long a, b;
                int j = i/2;
                if (!odd) {
                        a = j + 1;
                        b = a + dif_e - 2 * j;
                } else {
                        a = dif_e + 2 + j;
                        b = a + dif_o - 2 * j;
                }
                cout << a << " " << b << endl;
                odd = !odd;
        }
        return 0;
}


Measured memory_bytes: 3596
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<math.h>
using namespace std;
#define N (1000000000+7)
#define INF 1e16
typedef long long ll;
typedef pair<ll,ll> P;

ll kaijo[200010];
void init() {
	kaijo[0] = 1;
	for (ll i = 1;i <= 200000;i++)kaijo[i] = (kaijo[i - 1] * i) % N;
}

ll inv(ll x,ll power) {
	ll res = 1;
	ll k = power;
	ll y = x;
	while (k) {
		if (k & 1)res = (res*y) % N;
		y = (y%N*y%N) % N;
		k /= 2;
	}
	return res;
}

ll Comb(ll n, ll k) {
	//if (n < 0 || k < 0 || (n - k) < 0)return 0;
	ll b = kaijo[n];
	ll c = kaijo[n - k];
	ll d = kaijo[k];
	ll cd = (c*d) % N;
	return ((b%N)*(inv(cd,N-2)) % N) % N;
}

int main(void){
    ll n,a,b;
    cin>>n>>a>>b;
    ll tmp1 = 1,tmp2 = 1;
    init();
    for(ll i=0;i<a;i++){
        tmp1*=(n-i);
        tmp1 = tmp1%N;
    }
    for(ll i=0;i<b;i++){
        tmp2 *=(n-i);
        tmp2 = tmp2%N;
    }
    tmp1 = tmp1*inv(kaijo[a],N-2);
    tmp2 = tmp2*inv(kaijo[b],N-2);
    tmp1 = tmp1%N;
    tmp2 = tmp2%N;
    ll ans = inv((ll)2,n);
    ans = ans - 1 -tmp1 -tmp2;
    ans = ans%N;
    cout<<(ans+N)%N<<endl;
    return 0;
}

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

int N;
int Q;
int idx;
int cups[114514];
set<int> cnt;

int main() {
  scanf("%d%d", &N, &Q);
  for (int i=0; i<N; i++) cups[i] = i;
  idx = 0;
  cnt.insert(0);
  cnt.insert(1);
  for (int i=0; i<Q; i++) {
    int a;
    int b;
    scanf("%d%d", &a, &b);
    --a;
    --b;
    swap(cups[a], cups[b]);
    if (idx == b) idx = a;
    else if (idx == a) idx = b;
    cnt.insert(cups[idx]);
    if (idx-1 >= 0) cnt.insert(cups[idx-1]);
    if (idx+1 < N) cnt.insert(cups[idx+1]);
  }

  printf("%d\n", (int)cnt.size());
}


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

using namespace std;

int main() {
   int n,k; string s;
   cin >> n >> k >> s;
   s[k-1]=tolower(s[k-1]);
   cout << s << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define all(v) v.begin(), v.end()
const int MOD = 1e9 + 7;
const int INF = 1e9;
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int main() {
    int n, d;
    cin >> n >> d;
    int x[n][d];
    rep(i, 0, n) rep(j, 0, d) cin >> x[i][j];
    int ans = 0;
    rep(i, 0, n - 1) {
        rep(j, i + 1, n) {
            int sum = 0;
            rep(k, 0, d) {
                sum += abs(x[i][k] - x[j][k]) * abs(x[i][k] - x[j][k]);
            }
            int r = sqrt(sum);
            if (r * r == sum) ans++;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll MOD = 1e9 + 7;
int mx[] = {-1, 1, 0, 0}, my[] = {0, 0, -1, 1};
int n;
void solve(string str,char mx){
  if(str.length()==n){
    cout<<str<<endl;
    return;
  }else if(str.length()<n){
    for(char i='a';i<=mx+1;++i){
      solve(str+i,max(i,mx));
    }
    return;
  }
}
int main()
{
  cin>>n;
  solve("a",'a');
  return 0;
}

Measured memory_bytes: 1536
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>


using namespace std;
using ll = long long;
using ull = unsigned long long;

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

#define REP(i, n) for(ll i = 0; i < n; i++)







class SegmentTree
{
private:
    ll n;    // 配列の要素数
    ll s;    // 配列を初期化するときの値
    vector<ll> data;     // セグメントツリーを持つ配列
public:
    SegmentTree(ll m, ll t);   // mは配列の要素数、tは配列を初期化するときの値
    ll operation(ll t1, ll t2); // 二項演算
    void update(ll k, ll a);  // k番目(0-indexed)の値をaに変更
    ll query(ll a, ll b);   // [a, b) の値を求める。
    ll query(ll a, ll b, ll k, ll l, ll r);   // [a, b) の値を求める。
};

SegmentTree::SegmentTree(ll m, ll t){
    n = 1;
    
    while(n < m) n *= 2;
    
    data.assign(2 * n - 1, t);
    
    s = t;
}

ll SegmentTree::operation(ll t1, ll t2){
    return min(t1, t2);
}

void SegmentTree::update(ll k, ll a){
    k += n - 1;
    data[k] = a;
    
    while(k > 0){
        k = (k - 1) / 2;
        data[k] = operation(data[k * 2 + 1], data[k * 2 + 2]);
    }
}

ll SegmentTree::query(ll a, ll b){
    return query(a, b, 0, 0, n);
}

ll SegmentTree::query(ll a, ll b, ll k, ll l, ll r){
    if(r <= a || b <= l) return s;
    if(a <= l && r <= b){
        return data[k];
    }
    else{
        ll vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
        ll vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
        
        return operation(vl, vr);
    }
}

int main() {
    ll n;
    cin >> n;
    ll cnt = 0;
    vector<ll> b(n + 1);
    REP(i, n){
        cin >> b[i + 1];
        if(b[i + 1] == 0) cnt++;
    }
    ll q;
    cin >> q;
    vector<vector<ll>> v(n + 1);
    REP(i, q){
        ll l, r;
        cin >> l >> r;
        v[l].push_back(r);
    }
    
    SegmentTree st(n + 1, INF);
    st.update(0, 0);
    for(ll i = 1; i <= n; i++){
        sort(v[i].rbegin(), v[i].rend());
        for(auto &r : v[i]){
            ll res = st.query(i - 1, r);
            if(res < st.query(r, r + 1)) st.update(r, res);
        }
        ll res = st.query(i - 1, i) + (b[i]? 1 : -1);
        if(res < st.query(i, i + 1)) st.update(i, res);
    }
    cout << st.query(n, n + 1) + cnt << endl;
}


Measured memory_bytes: 14848
#include<bits/stdc++.h>
using namespace std;
int gcd(int a, int b){
	if(b==0)
		return a;
	return gcd(b, a%b);
}
int main(){
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int n; cin>>n;
	vector<int>a(n), pre(n), suf(n);
	for(int i=0;i<n;i++) cin>>a[i];
	for(int i=0;i<n;i++){
		if(i>0) pre[i]=gcd(pre[i-1],a[i]);
		else pre[i]=a[i];
	}
	for(int i=n-1;i>=0;i--){
		if(i<n-1) suf[i]=gcd(suf[i+1],a[i]);
		else suf[i]=a[i];
	}
	int mx=suf[1];
	for(int i=1;i<n-1;i++){
		int g=gcd(pre[i-1],suf[i+1]);
		mx=max(mx,g);
	}
	mx=max(pre[n-2],mx);
	cout<<mx<<'\n';
	return 0;
}

Measured memory_bytes: 1408
n,m=map(int,input().split())
H=list(map(int,input().split()))
D=[[] for i in range(n)]
for i in range(m):
    a,b=map(int,input().split())
    D[a-1].append(H[b-1])
    D[b-1].append(H[a-1])
c=0
for i in range(n):
    if D[i]==[]:
        c+=1
    elif H[i]>max(D[i]):
        c+=1
print(c)

Measured memory_bytes: 92752
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n)repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
typedef pair<int,int> P;
typedef pair<int, P> PP;
#define all(v) v.begin(),v.end()
#define fi first
#define se second
const int inf = 1e9;
int mod = 1e9+7;

int a[100], b[100], n;
signed main(){
	scanf("%lld", &n);
	rrep(i,n)scanf("%lld", &a[i]);
	
	int mi = 0, s = 1;
	rrep(i,n)if(a[i] == -1)mi = 1;
	rrep(i,n)if(a[i] == -2 || a[i] == 2)s *= a[i];
	if(s == 1){
		printf("0\n");
		return 0;
	}
	int cnt = 0;
	if(s < 0){
		if(mi == 1){
			rrep(i,n)if(a[i] == -1){
				b[i] = 1;cnt++;
				break;
			}
		}else{
			drep(i,n,1)if(a[i] == -2){
				b[i] = -1;
				break;
			}
		}
	}
	rrep(i,n){
		if(b[i] == 0 && a[i]*a[i] == 4){b[i] = 1;cnt++;}
	}
	printf("%lld\n",cnt);
	rrep(i,n){
		if(b[i] == 1)printf("%lld\n", i);
	}
	return 0;
}



Measured memory_bytes: 3200
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

using boost::multiprecision::cpp_int;
using namespace std;

#if __has_include("print.hpp")
  #include "print.hpp"
#endif

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MOD 1000000007

typedef long long ll;
typedef pair<ll, ll> p;


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  double h, w, n;
  cin >> h >> w >> n;
  cout << ceil(n / max(h, w)) << endl;
}


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

int main(){
  int a,b,c;
  cin>>a>>b>>c;
  int d=max(a,max(b,c));
  int e=min(a,min(b,c));
  cout<<d-e<<endl;
}

Measured memory_bytes: 256
n, m = map(int, input().split())
s = input()[::-1]

here = 0
ans = []

while here!=n:
    j = m
    if(here+j>n): j=n-here;
    while s[here+j]!="0":
        j -= 1
        if j<1:
            print(-1)
            exit()
    ans.append(j)
    here += j
print(*ans[::-1])

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

int main() {
  int64_t N, M;
  cin >> N >> M;
  int64_t answer = -1;
  if ( N > 1 ) {
    if ( M > 1 ) {
      answer = (N-2)*(M-2);
    }
    else {
      answer = N - 2;
    }
  }
  else if ( M > 1 ) {
    answer = M - 2;
  }
  else {
    answer = 1;
  }
  cout << answer << endl;
}

Measured memory_bytes: 256
n = int(input())
al = list(map(int, input().split()))

money = 1000
kabu = 0
pos = 'no'
p = 0
for i, t in enumerate(al):
    if pos != 'no':
        if p < t:
            money += (kabu*t)
            kabu = 0
            pos = 'no'

    if pos == 'no' and money // t >= 1:
        f = False
        for j, a in enumerate(al[i:]):
            if a > t:
                if t == min(al[i:i+j+1]):
                    f = True
                    break
        if f:
            kabu += (money // t)
            money -= kabu*t
            pos = 'b'
            p = t
print(money)


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

#define N 1000007
int main() {
	long long arr[N]{};
	long long num,l,sum=0; std::cin >> num;
	for (long long x = 0; x < num; x++) {
		std::cin >> l, arr[l]++;
		sum += l;
	}


	long long Q; std::cin >> Q;
	while (Q--) {
		long long B, C;
		std::cin >> B >> C;
		if (arr[B]) {
			long long int number = arr[B]*B;
			sum += ((arr[B] * C)-number);
			arr[C] += arr[B];
			arr[B] = 0;
		}


		std::cout << sum << "\n";
	}

}

Measured memory_bytes: 11448
#include <stdio.h>
#include <assert.h>
#include <fstream>
#include <iostream>
#include <algorithm>
#include <array>
#include <vector>
#include <queue>
#include <set>
#include <cmath>
#include <bitset>
//#include <unordered_map>
//#include <unordered_set>
//#include <boost/container/static_vector.hpp>
//#include <boost/unordered_set.hpp>
//#include <boost/unordered_map.hpp>
//#include <unistd.h>

const long long MAX_TMP = 1000050;
long long N;

std::set<long long> st;

int main(int argc, char **argv) {
    std::cin >> N;

    for (long long p = 1; p <= std::min(N, MAX_TMP); p++) {
        if (0 < N - p && (N - p) % p == 0) {
            long long m = (N - p) / p;
            if (p < m) {
                st.insert(m);
            }
        }
    }

    for (long long m = 1; m <= std::min(N, MAX_TMP); m++) {
        if (N / m == N % m) {
            st.insert(m);
        }
    }

    long long ret = 0;
    for(auto itr = st.begin(); itr != st.end(); ++itr) {
        //std::cout << "check:" << (*itr) << std::endl;

        ret += (*itr);
    }

    std::cout << ret << std::endl;

    return 0;
}

Measured memory_bytes: 384
A, B, C, K = map(int, input().split())
ans = 0

if A <= K:
    ans += A
    K -= A
elif A > K:
    ans += K*1
    print(ans)
    exit()

if B <= K:
    K -= B
elif B > K:
    print(ans)
    exit()

if C <= K:
    ans -= C
    print(ans)
    exit()
else:
    ans -= K
    print(ans)
    exit()

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

int main() {
  int N, K;
  cin >> N >> K;
  
  int num = 1;
  for (int i = 0; i < N; i++) {
    if ((num * 2) <= (num + K)) {
      num *= 2;
    }else{
      num += K;
    }
  }
  
  cout << num << endl;
}

Measured memory_bytes: 256
use std::io::Read;

fn run() {
    let mut s = String::new();
    std::io::stdin().read_to_string(&mut s).unwrap();
    let mut it = s.trim().split_whitespace();
    let n: usize = it.next().unwrap().parse().unwrap();
    let t: Vec<usize> = (0..n).map(|_| it.next().unwrap().parse().unwrap()).collect();
    let a: Vec<usize> = (0..n).map(|_| it.next().unwrap().parse().unwrap()).collect();
    let mut l = vec![(1, 1_000_000_000); n];
    l[0] = (t[0], t[0]);
    for i in 1..n {
        if t[i - 1] < t[i] {
            l[i] = (t[i], t[i]);
        } else {
            l[i] = (1, t[i]);
        }
    }
    let mut r = vec![(1, 1_000_000_000); n];
    r[n - 1] = (a[n - 1], a[n - 1]);
    for i in (0..(n - 1)).rev() {
        if a[i] > a[i + 1] {
            r[i] = (a[i], a[i]);
        } else {
            r[i] = (1, a[i]);
        }
    }
    const MOD: usize = 1_000_000_007;
    let mut ans = 1;
    for i in 0..n {
        let x = std::cmp::max(l[i].0, r[i].0);
        let y = std::cmp::min(l[i].1, r[i].1);
        if x > y {
            ans = 0;
        } else {
            ans = ans * (y - x + 1) % MOD;
        }
    }
    println!("{}", ans);
}

fn main() {
    run();
}


Measured memory_bytes: 14328
/* Author: Jason L.(int3xccATgmailDOTcom), Sat Jun  3 10:31:07 CST 2017 */
#include <bits/stdc++.h>
using namespace std;
using ll = long long; using pll = pair<ll, ll>; using dd = long double;
//=========================================================================
namespace {
static bool constexpr dbg =
#ifdef INT3XCC_DEBUG
        1;
#else
        0;
#endif
#define Dprintf(fmt, ...) do{if(dbg) printf(fmt, ##__VA_ARGS__);}while(0)
#define REP0(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define REP1(i, n) for (ll i = 1; i <= (ll)(n); ++i)
//=========================================================================
ll constexpr N = 3.1e5;
ll n, res, x[N];
struct E {
    ll v, idx;
    bool operator<(E const &e) const {
        if (e.v != v) return v > e.v;
        return idx < e.idx;
    }
} a[N];
struct Cmp {
    bool operator()(E const &e1, E const &e2) const{
        return pll(e1.v, e1.idx) < pll(e2.v, e2.idx);
    }
};
//=========================================================================
void init() {
    cin>>n; REP1(i, 3*n) { cin>>x[i]; a[i].v = x[i]; a[i].idx = i;}
    set<E> se1;
    set<E, Cmp> se2, rem2;
    ll sum1 = 0, sum2 = 0;
    REP1(i, n) { se1.insert(a[i]); sum1 += a[i].v;}
    sort(a+n+1, a+1+3*n, Cmp());
    for (ll i = n+1; i <= 2*n; ++i) {sum2 += a[i].v; se2.insert(a[i]);}
    for (ll i = 2*n+1; i <= 3*n; ++i) { rem2.insert(a[i]); }
    res = sum1 - sum2;
    for (ll i = n+1; i <= 2*n; ++i) {
        E t; t.v = x[i]; t.idx = i;
        auto bck = se1.end(); --bck;
        if (x[i] > bck->v) {
            sum1 = sum1 - bck->v + x[i];
            se1.erase(bck);
            se1.insert(t);
        }
        if (rem2.count(t)) {
            rem2.erase(t);
        } else if (se2.count(t)) {
            sum2 = sum2 - x[i] + rem2.begin()->v;
            se2.erase(t); se2.insert(*rem2.begin());
            rem2.erase(rem2.begin());
        }
        res = max(res, sum1 - sum2);
    }
    cout<<res;
}
void solve() {
}}
//=========================================================================
int main() {
    if (!dbg) { std::ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);}
    cout<<fixed<<setprecision(20); init(); solve(); return 0;
}

Measured memory_bytes: 26240
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <vector>

using namespace std;

#define loop(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < n; ++i)
#define dump(a) cerr << #a << " = " << (a) << "(L:" << __LINE__ << ")" << endl

const string YES = "Yes";
const string NO = "No";

void solve(long long A, long long B, long long C, long long K) {
    rep(i, K) {
        if (!(A < B)) {
            B *= 2;
            continue;
        } 
        if (!(B < C)) {
            C *= 2;
            continue;
        }
    }
    if (A < B && B < C) {
        cout << YES << endl;
    } else {
        cout << NO << endl;
    }
}

int main() {
    long long A;
    scanf("%lld", &A);
    long long B;
    scanf("%lld", &B);
    long long C;
    scanf("%lld", &C);
    long long K;
    scanf("%lld", &K);
    solve(A, B, C, K);
    return 0;
}


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

#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define REP(i, n)  FOR(i, 0, n)
#define ASC(c) sort((c).begin(), (c).end())
#define DESC(c) sort((c).begin(), (c).end(), greater<int>())

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

typedef long long ll;
typedef unsigned long long ull;
struct edge { int u, v; ll w; };
 
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

int main() {
  int n; cin >> n;
  vector<int> p(n);
  REP(i, n) cin >> p[i];
  DESC(p);
  int ans = p[0] / 2;
  FOR(i, 1, n) ans += p[i];
  cout << ans << endl;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9+7;
typedef long long LL;
LL a[300005];
int cnt[300005][60];
int main(){
    int n;
    scanf("%d", &n);   
    for(int i=1;i<=n;i++){
        scanf("%lld", &a[i]);
        for(int j=0;j<60;j++){
            if((a[i]>>j)&1) cnt[i][j]++;
        }
        for(int j=0;j<60;j++) cnt[i][j] += cnt[i-1][j];
    }
    LL ans = 0;
    for(int i=1;i<=n-1;i++){
        for(int j=0;j<60;j++){
            int c = cnt[n][j] - cnt[i][j];
            if((a[i]>>j)&1) c = (n-i)-c;
            ans = (ans + (1ll<<j)%mod*c)%mod;
        }
    }
    printf("%lld\n", ans);
}

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

using namespace std;
typedef long long ll;
//typedef unsigned long long ll;

#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define sz(x) ll(x.size())
//typedef pair<ll, int> P;
//typedef pair<ll, ll> P;
//const double INF = 1e10;
//const ll INF = LONG_LONG_MAX / 100;
//const ll INF = (1ll << 31) - 1;
//const ll INF = 1e15;
const ll MINF = LONG_LONG_MIN;
//const int INF = INT_MAX / 10;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
//typedef pair<int, int> P;
//typedef pair<double, double> P;

//bool contain(set<P> &s, P a) { return s.find(a) != s.end(); }

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
const int mod = 1000000007;
typedef priority_queue<long long, vector<long long>, greater<long long>> PQ_ASK;


void print_line(vector<string> &line) {
    if (line.size() == 0ll) {
        cout << endl;
        return;
    }
    for (ll i = 0; i < line.size(); i++) {
        cout << line[i];
        if (i == line.size() - 1) cout << endl;
        else cout << ' ';
    }
}

#define EPS (1e-10)

struct Point {
    double x, y;

    Point(double x = 0, double y = 0) : x(x), y(y) {}

    Point operator+(Point p) { return Point(x + p.x, y + p.y); }

    Point operator-(Point p) { return Point(x - p.x, y - p.y); }

    Point operator*(double a) { return Point(a * x, a * y); }

    Point operator/(double a) { return Point(x / a, y / a); }

    double abs() { return sqrt(norm()); }

    double norm() { return x * x + y * y; }

    bool operator<(const Point &p) const {
        return x != p.x ? x < p.x : y < p.y;
    }

    bool operator==(const Point &p) const {
        return fabs(x - p.x) < EPS && fabs(y - p.y) < EPS;
    }
};

typedef Point Vector;
typedef vector<Point> Polygon;


static const int IN = 2;
static const int ON = 1;
static const int OUT = 0;

double dot(Vector a, Vector b) {
    return a.x * b.x + a.y * b.y;
}

double cross(Vector a, Vector b) {
    return a.x * b.y - a.y * b.x;
}

int contains(Polygon g, Point p) {
    int n = g.size();
    bool x = false;
    for (int i = 0; i < n; i++) {
        Point a = g[i] - p, b = g[(i + 1) % n] - p;
        if (abs(cross(a, b)) < EPS && dot(a, b) < EPS) return ON;
        if (a.y > b.y) swap(a, b);
        if (a.y<EPS && EPS < b.y && cross(a, b)>EPS) x = !x;
    }
    return x ? IN : OUT;
}

int main() {
    int n;
    cin >> n;
    Polygon g;
    for (int i = 0; i < n; i++) {
        double x, y;
        cin >> x >> y;
        g.push_back(Point(x, y));
    }
    int q;
    cin >> q;
    rep (i, q) {
        double x, y;
        cin >> x >> y;
        cout << contains(g, Point(x, y)) << endl;
    }
}




Measured memory_bytes: 3236
A, B, H, M = map(int, input().split())

import math

M_rad = math.radians(360 * (M / 60))
H_rad = math.radians(30 * (M / 60) + 360 * (H / 12))

AB = abs(M_rad - H_rad)
ans = (A ** 2 + B ** 2 - 2 * A * B * math.cos(AB)) ** 0.5
print(ans)

Measured memory_bytes: 9424
#include<iostream>
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
typedef long long ll;

int main(){
    int a, b;
    cin >> a >> b;
    int n=0, sum=0;

    if(b==1){
        cout << "0" << endl;
        return 0;
    }

    n=1;
    sum = b-a;
    while(sum > 0){
        sum -=(a-1);
        n++;
    }
    
    cout << n << endl;

    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();
		int C = sc.nextInt();
		
		int ans = Math.min(B/A, C);
	
		
		System.out.println(ans);
	}
}


Measured memory_bytes: 25300
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int mod=1000000007;
int n,k,cnt[610],p[610],f[610],dp[610][610],ans;
bool check(int x,int y)
{
	if((cnt[y]-cnt[x-1])&1)return 0;
	for(int i=x;i<=y;++i)if(p[i]&&(p[i]<x||p[i]>y))return 0;
	return 1;
}
int main()
{
	scanf("%d %d",&n,&k);
	int x,y;
	for(int i=1;i<=k;++i)
	{
		scanf("%d %d",&x,&y);
		p[x]=y,p[y]=x;
	}
	for(int i=1;i<=2*n;++i)cnt[i]=cnt[i-1]+(!p[i]);
	f[0]=1;
	for(int i=2;i<=2*n;++i)f[i]=1ll*f[i-2]*(i-1)%mod;
	for(int len=1;len<=2*n;++len)
		for(int i=1,j=i+len-1;j<=2*n;++i,++j)
			if(check(i,j))
			{
				dp[i][j]=f[cnt[j]-cnt[i-1]];
				for(int k=i;k<j;++k)dp[i][j]=(dp[i][j]+1ll*(mod-dp[i][k])*f[cnt[j]-cnt[k]])%mod;
			//	printf("%d %d %d\n",i,j,dp[i][j]);
				ans=(ans+1ll*dp[i][j]*f[cnt[2*n]-cnt[j]+cnt[i-1]])%mod;
			}
	printf("%d",ans);
	return 0;
}


Measured memory_bytes: 1664
from collections import Counter
N, K = map(int, input().split())
a = Counter(list(map(int, input().split())))
if N == K:
    print(0)
else:
    num = list(a.values())
    if len(num) <= K:
        print(0)
    else:
        print(sum(sorted(num)[:-K]))

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

int main() {
  int S, h, m, s;

  cin >> S;

  h = S / 3600;
  S -= h * 3600;
  m = S / 60;
  s = S - m * 60;

  cout << h << ":" << m << ":" << s << endl;

  return 0;
}

Measured memory_bytes: 3096
import io.StdIn.{ readLong }

object Main extends App {
  val largeN = readLong

  val hnws = for {
    h <- 1 to 3500
    n <- 1 to 3500
    den = largeN * h * n
    num = 4 * h * n - largeN * n - largeN * h
    if num != 0 && den * num > 0 && den % num == 0
  } yield (h, n, den / num)

  val (h, n, w) = hnws(0)

  assert(4 * h * n * w == n * w * largeN + w * largeN * h + largeN * h * n)

  println("%d %d %d".format(h, n, w))
}


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

#define REP(i,m,n) for(int i=(m); i<(int)(n); i++)
#define RREP(i,m,n) for(int i=(int)(n-1); i>=m; i--)
#define rep(i,n) REP(i,0,n)
#define rrep(i,n) RREP(i,0,n)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aut(r,v) __typeof(v) r = (v)
#define each(it,o) for(aut(it,(o).begin()); it!=(o).end(); ++it)
#define reach(it,o) for(aut(it,(o).rbegin()); it!=(o).rend(); ++it)
#define fi first
#define se second
#define debug(...) {cerr<<"[L"<<__LINE__<<"] "; _debug(__VA_ARGS__);}

template<typename T1, typename T2> ostream& operator<<(ostream& o, const pair<T1, T2>& p)
{return o<<"("<<p.first<<", "<<p.second<<")";}
template<typename T>string join(const vector<T>&v, string del=", ")
{stringstream s;rep(i,v.size())s<<del<<v[i];return s.str().substr(del.size());}
template<typename T>ostream& operator<<(ostream& o, const vector<T>&v)
{if(v.size())o<<"["<<join(v)<<"]";return o;}
template<typename T>ostream& operator<<(ostream& o, const vector<vector<T> >&vv)
{int l=vv.size();if(l){o<<endl;rep(i,l){o<<(i==0?"[ ":",\n  ")<<vv[i]<<(i==l-1?" ]":"");}}return o;}
template<typename T>ostream& operator<<(ostream& o, const set<T>& st)
{vector<T> v(st.begin(),st.end());o<<"{ "<<join(v)<<" }";return o;}
template<typename T1, typename T2>ostream& operator<<(ostream& o, const map<T1, T2>& m)
{each(p,m){o<<(p==m.begin()?"{ ":",\n  ")<<*p<<(p==--m.end()?" }":"");}return o;}
inline void _debug(){cerr<<endl;}
template<class First, class... Rest>
void _debug(const First& first, const Rest&... rest){cerr<<first<<" ";_debug(rest...);}

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;

const double PI = (1*acos(0.0));
const double EPS = 1e-9;
const ll INF = 0x3f3f3f3f;
const ll INFL = 0x3f3f3f3f3f3f3f3fLL;
const ll mod = 1e9 + 7;

inline void finput(string filename) {
    freopen(filename.c_str(), "r", stdin);
}

struct UnionFind {
    vector<int> dat;
    UnionFind(int _size) : dat(_size, -1) { }
    bool unionSet(int x, int y) {
        x = root(x); y = root(y);
        if (x != y) {
            if (dat[y] < dat[x]) swap(x, y);
            dat[x] += dat[y];
            dat[y] = x;
        }
        return x != y;
    }
    bool findSet(int x, int y) { return root(x) == root(y); }
    int root(int x) { return dat[x] < 0 ? x : dat[x] = root(dat[x]); }
    int size(int x) { return -dat[root(x)]; }
};

int main(){
    ios_base::sync_with_stdio(0);
    // finput("./input");
    int n,m,k; cin >> n >> m >> k;
    vi cnt(n);
    UnionFind uf_friend(n);
    UnionFind uf_block(n);
    rep(i,m){
        int a,b; cin >> a >> b;
        a--; b--;
        uf_friend.unionSet(a,b);
        cnt[a]++;
        cnt[b]++;
    }
    rep(i,k){
        int a,b; cin >> a >> b;
        a--; b--;
        uf_block.unionSet(a,b);
        if(uf_friend.findSet(a,b)){
            cnt[a]++;
            cnt[b]++;
        }
    }

    vi ans(n);
    rep(i,n) ans[i] = uf_friend.size(i) - 1 - cnt[i];
    cout << join(ans, " ") << endl;
    return 0;
}

Measured memory_bytes: 3716
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;int p[10001],M=10001,i,j,c;vector<int>s(1,0);main(){for(i=1;++i<M;)for(j=i+i;j<M;j+=i)p[j]=1;for(i=1;++i<M;)if(!p[i])s.push_back(i+s.back());for(;cin>>j,j;cout<<c<<endl){vector<int>::iterator t=s.begin();for(c=0;t!=s.end();t++)c+=count(t,s.end(),*t+j);}}

Measured memory_bytes: 1272
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef double dd;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> ii;
typedef pair<ll, int> li;
typedef pair<int, ll> il;
typedef pair<ll , ll> lli;
typedef vector<ii> vii;
typedef vector<il> vil;
typedef vector<li> vli;
typedef vector<lli> vlli;
typedef pair < ll , pair < ll , ll > > cm;

#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define in insert
#define f0(b) for(int i=0;i<(b);i++)
#define f00(b) for(int j=0;j<(b);j++)
#define f1(b) for(int i=1;i<=(b);i++)
#define f11(b) for(int j=1;j<=(b);j++)
#define f2(a,b) for(int i=(a);i<=(b);i++)
#define f22(a,b) for(int j=(a);j<=(b);j++)
#define sf(a) scanf("%lld",&a)
#define sff(a,b) scanf("%lld %lld", &a , &b)
#define pf(a) printf("%lld\n",a)
#define pff(a,b) printf("%lld %lld\n", a , b)
#define PI 3.14159265359
#define bug printf("**!\n")
#define mem(a , b) memset(a, b ,sizeof(a))
#define front_zero(n) __builtin_clzll(n)
#define back_zero(n) __builtin_ctzll(n)
#define total_one(n) __builtin_popcountll(n)
#define clean cout.flush()

const ll mod = (ll)1e9+7;
const ll maxn = (ll)2e5+5;
const int nnn = 1048590;
const int inf = numeric_limits<int>::max()-1;
//const ll INF = numeric_limits<ll>::max()-1;
const ll INF = 1e18;

ll dx[]={0,1,0,-1};
ll dy[]={1,0,-1,0};
ll dxx[]={0,1,0,-1,1,1,-1,-1};
ll dyy[]={1,0,-1,0,1,-1,1,-1};

void solve(){
	
	ll n;
	cin >> n;
	if(n%1000 == 0) cout << 0;
	else cout << 1000-(n%1000);
	
	return;
}


int main(int argc, char *argv[]) {
   
   ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
    ll T;
    T=1;
    //cin >> T;
    //scanf("%lld",&T);
    ll CT = 0;
    //work();
    while(T--){
    	//cout << "Case " << ++CT <<": " ;
    //	printf("Case %lld: \n",++CT);
		solve();
	}
    
    return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
signed main()
{
   ios_base::sync_with_stdio(false);
   cin.tie(NULL);
   cout.tie(NULL);
   string str;
   cin>>str;
   if(str.length()==2)
   {
      cout<<str;
      return 0;
   }
   reverse(str.begin(),str.end());
   cout<<str;
 }

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

typedef int64_t i64;

constexpr i64 llinf=4611686018427387903LL;

int main(void){
    vector<i64> a;
    i64 q;
    scanf("%lli",&q);
    for(i64 i=0;i<q;i++){
        i64 t;
        scanf("%lli",&t);
        if(t==0){
            i64 x;
            scanf("%lli",&x);
            a.push_back(x);
        }
        else if(t==1){
            i64 p;
            scanf("%lli",&p);
            printf("%lli\n",a.at(p));
        }
        else a.pop_back();
    }
    return 0;
}



Measured memory_bytes: 4980
n = int(input())
a = list(map(int, input().split()))
a.sort()
a.reverse()

x, y = 0, 0

i = 0
while i < n - 1:
    if a[i] == a[i + 1]:
        x = a[i]
        i += 2
        break
    i += 1

while i < n - 1:
    if a[i] == a[i + 1]:
        y = a[i]
        i += 2
        break
    i += 1
print(x * y)

Measured memory_bytes: 14252
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll mod=1e9+7;
ll mod_pow(ll a,ll b){
  ll res=1;
  for(int i=0;i<60;i++){
    if(b>>i&1){
      res=res*a%mod;
    }
    a=a*a%mod;
  }
  return res;
}
 
int main(){
  ll m,n;
  cin>>m>>n;
  cout<<mod_pow(m,n)<<endl;
  return 0;
}


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

int main() {
  string s;
  cin >> s;
  if (s.at(1) == s.at(2) && (s.at(0) == s.at(1) || s.at(2) == s.at(3))) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256