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

#define mod 1000000007

#define rep(i, n) for(int i=0; i<n; ++i)

using namespace std;
typedef long long ll;
const long long INF = 1LL << 60;
 
int main(void){
	
	int N, count = 0, ans = 0;
	
	cin >> N;
	
	bool check[8];
	rep(i, 8)
		check[i] = false;
	
	rep(i, N){
		int a;
		cin >> a;
		if(a <= 399)
			check[0] = true;
		else if(a <= 799)
			check[1] = true;
		else if(a <= 1199)
			check[2] = true;
		else if(a <= 1599)
			check[3] = true;
		else if(a <= 1999)
			check[4] = true;
		else if(a <= 2399)
			check[5] = true;
		else if(a <= 2799)
			check[6] = true;
		else if(a <= 3199)
			check[7] = true;
		else
			count++;
	}
	
	rep(i, 8)
		if(check[i])
			ans++;
	if(ans == 0)
		cout << 1 << " " << count << endl;
	else
		cout << ans << " " << ans + count << endl;
	
	return 0;
}

Measured memory_bytes: 256
while True:
    a, op, b = input().split()
    a = int(a)
    b = int(b)
    
    if op == "?":
        break
    elif op == "+":
        print(a + b)
    elif op == "-":
        print(a - b)
    elif op == "*":
        print(a * b)
    elif op == "/":
        print(a // b)


Measured memory_bytes: 5592
#include <bits/stdc++.h>
using namespace std;
int main(){
  for(int i=0; i<3; ++i){
    for(int j=0; j<3; ++j){
      char c; cin >> c;
      if(i == j){
        cout << c;
      }
    }
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
/**
 *    author:  DFLMKWR
 *    created: 12.08.2020 19:05:53
**/
#include <iostream>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int t;
  cin >> t;
  cout << t / 3600 << ":" << t % 3600 / 60 << ":" << t % 3600 % 60 << "\n";
  return 0;
}
  



Measured memory_bytes: 3228
#include <stdio.h>

int main(void) {
	int i;
	int cnt[11] = {0};

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

	puts(cnt[5] == 2 && cnt[7] == 1 ? "YES" : "NO");

	return 0;
}


Measured memory_bytes: 128
def c_dubious_document_2(S, T):
    # S:鍵の文字列のいくつかを'?'で置き換えたもの
    # T:Sの中に含まれている可能性のある文字列
    candidate = []  # 解の候補('?'を含む)
    for i in range(len(S) - len(T) + 1):
        # Sの中にTを置く場所がないままTがSの末尾をはみ出すなら、復元不可能が確定
        for j in range(len(T)):
            if S[i + j] != '?' and S[i + j] != T[j]:
                break  # Sのi文字目以降にTを埋め込める可能性がなくなった
        else:
            # TをSのi文字目以降に埋め込める。解の候補とする
            candidate.append(S[:i] + T + S[i + len(T):])
    if len(candidate) == 0:
        ans = 'UNRESTORABLE'
    else:
        tmp = []
        for s in candidate:
            tmp.append(s.replace('?', 'a'))
        ans = sorted(tmp)[0]
    return ans

S = input()
T = input()
print(c_dubious_document_2(S, T))

Measured memory_bytes: 3064
package main

import (
	"bufio"
	"fmt"
	"log"
	"os"
	"strconv"
)

func main() {
	log.SetFlags(log.Lshortfile)
	X := nextInt()
	Y := nextInt()
	fmt.Println(X + Y/2)
}
func Max(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r < a[i] {
			r = a[i]
		}
	}
	return r
}
func Min(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r > a[i] {
			r = a[i]
		}
	}
	return r
}
func Sum(a []int) (r int) {
	for i := range a {
		r += a[i]
	}
	return r
}
func Abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

type Pair struct {
	a, b int
}

type Pairs []Pair

func (p Pairs) Len() int {
	return len(p)
}
func (p Pairs) Swap(i, j int) {
	p[i], p[j] = p[j], p[i]
}

func (p Pairs) Less(i, j int) bool {
	return p[i].b < p[j].b
}

var nextReader func() string

func init() {
	nextReader = NewScanner()
}

func NewScanner() func() string {
	r := bufio.NewScanner(os.Stdin)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)
	return func() string {
		r.Scan()
		return r.Text()
	}
}
func nextString() string {
	return nextReader()
}
func nextInt64() int64 {
	v, _ := strconv.ParseInt(nextReader(), 10, 64)
	return v
}
func nextInt() int {
	v, _ := strconv.Atoi(nextReader())
	return v
}
func nextInts(n int) []int {
	r := make([]int, n)
	for i := 0; i < n; i++ {
		r[i] = nextInt()
	}
	return r
}
func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(nextReader(), 64)
	return f
}


Measured memory_bytes: 640
#! /usr/bin/env ruby

input = STDIN.read.split("\n")
s = input[0]
t = input[1]

has_same_chars = t.split("").uniq.sort == s.split("").uniq.sort

dic_s = {}
dic_t = {}
has_same_stack = true;
for i in 0..(s.length - 1) do
  if dic_s.has_key?(s[i]) then
    if dic_s[s[i]] != t[i] then
      has_same_stack = false
      break
    end
  else
    dic_s[s[i]] = t[i]
  end
  if dic_t.has_key?(t[i]) then
    if dic_t[t[i]] != s[i] then
      has_same_stack = false
      break
    end
  else 
    dic_t[t[i]] = s[i]
  end
end

puts has_same_stack ? 'Yes' : 'No'



Measured memory_bytes: 28412
def div(num,d):
    cnt = 0
    while True:
        if num % d or num == 1 : return cnt
        num /= d; cnt += 1

while True:
    n = int(raw_input())
    if n == 0: break
    n2,n5 = 0,0
    for i in xrange(2,n+1):
        n2 += div(i,2);
        n5 += div(i,5)
    print min(n2,n5)

Measured memory_bytes: 4216
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<utility>
#include<cmath>
#include<climits>
#include<queue>
#include<stack>
#include<numeric>
#include<set>
#include<iomanip>
#include<map>
#include<type_traits>
#include<tuple>
#include<deque>
#include<cassert>
#include<bitset>

using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,N) for(int (i)=0;(i)<(N);(i)++)
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
const double PI = 3.1415926535897932384626433832795;
const int mod = 1000000007;
const ll INF = 1LL<<60;

ll dp[200010][5];

ll cost(int num, int div) {
  if (div == 0 || div == 4) return num;
  else if (num == 0) {
    if (div == 1 || div == 3) return 2;
    else return 1;
  } else if(div == 1 || div == 3) {
    if (num % 2 == 0) return 0;
    else return 1;
  } else {
    if (num % 2 == 0) return 1;
    else return 0;
  }
}

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

  rep(i, l + 1) rep(j, 5) dp[i][j] = INF;
  rep(i, 5) dp[0][i] = 0;
  rep(i, l) rep(j, 5) for (int k = j; k < 5; ++k) {
    chmin(dp[i + 1][k], dp[i][j] + cost(a[i], k));
  }

  ll ans = INF;
  rep(i, 5) {
    chmin(ans, dp[l][i]);
  }
  cout << ans << endl;
}

Measured memory_bytes: 11940
#include <bits/stdc++.h>
using namespace std;
int main (){
   int n , k ;
   cin >>n ;
   string s ;
   cin >> s ;
   cin >> k;
   char mezirusi;
   mezirusi = s.at(k-1);
  
   for ( int i= 0 ; i < s.size() ; i++){
     if(s.at(i) != mezirusi ){
       s.at(i) = '*';
       }
       }
       cout << s << endl;
       }

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

#define rep(X,N) for(ll X = 0; X < (N); X++)
#define PI (acos(-1.0))
#define pback push_back
#define mpair make_pair
#define MODN 1000000007
#define ALL(V) (V).begin(),(V).end()
#define CERR if(false) cerr
#define INT_MAX_HALF (INT_MAX / 2)
#define EPS (1e-10)

using namespace std;

typedef long long ll;

int main(){

    int n;
    string s;
    cin >> n;
    cin >> s;

    vector<int> left(n);
    vector<int> right(n);

    left[0] = (1<<(s[0] - '0'));

    for(int i = 1; i  < n - 1; i++){
        left[i] = left[i - 1] | (1<<(s[i] - '0'));
    }

    right[n - 1] = (1<<(s[n - 1] - '0'));

    for(int i = n - 2; i > 0; i--){
        right[i] = right[i + 1] | (1<<(s[i] - '0'));
    }

    set<int> se;

    for(int i = 1; i < n - 1; i++){

        rep(j, 10){
            if(left[i - 1] & (1<<j)){
                rep(k, 10){
                    if(right[i + 1] & (1<<k)){
                        int tmp = j * 100 + (s[i] - '0') * 10 + k;

                        //cerr << tmp << endl;
                        se.insert(tmp);
                    }
                }
            }
        }
    }

    cout << se.size() << endl;

    return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
# define mod 100000
int main()
{
    ios_base::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin>>n;
	int m;
	cin>>m;
	if(n<=m)
	{
for(int i=0;i<m;i++)
cout<<n;	
	}
	else{
		for(int i=0;i<n;i++)
		cout<<m;
	}
}


Measured memory_bytes: 256
N = int(input())
A = list(map(int,input().split()))

minus = 0
for i in range(N):
    if A[i] < 0:
        minus += 1
        A[i] = abs(A[i])
    minus %= 2

ans = 0
for i in range(N):
    ans += A[i]
    
if minus == 1:
    ans -= min(A)*2
    
print(ans)

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, ans;
  cin >> n;
  vector<int> v(n);
  REP(i, n) cin >> v[i];
  vector<int> G(100002, 0);
  vector<int> K(100002, 0);
  bool allsame = true;
  for(int i = 0; i < n - 1; i++) {
    if(v[i] != v[i + 1]) {
      allsame = false;
    }
  }
  for(int i = 0; i < n; i += 2) {
    G[v[i]]++;
    K[v[i + 1]]++;
  }
  int maxig = 0;
  int maxg = 0;
  for(int i = 0; i < G.size(); i++) {
    if(maxg < G[i]) {
      maxg = G[i];
      maxig = i;
    }
  }
  int maxik = 0;
  int maxk = 0;
  for(int i = 0; i < K.size(); i++) {
    if(maxk < K[i]) {
      maxk = K[i];
      maxik = i;
    }
  }
  if(allsame) {
    cout << n / 2 << endl;
  } else if(maxig != maxik) {
    ans = n - G[maxig] - K[maxik];
    cout << ans << endl;
  } else if(maxig == maxik) {
    ans = n - G[maxig] - K[maxik];
    int tempans1, tempans2;
    G[maxig] = 0;
    K[maxik] = 0;
    int secig = 100001;
    int secg = 0;
    for(int i = 0; i < G.size(); i++) {
      if(secg < G[i]) {
        secg = G[i];
        secig = i;
      }
    }
    int secik = 100001;
    int seck = 0;
    for(int i = 0; i < K.size(); i++) {
      if(seck < K[i]) {
        seck = K[i];
        secik = i;
      }
    }
    tempans1 = n - maxg - seck;
    tempans2 = n - secg - maxk;

    cout << min(tempans1, tempans2) << endl;
  }

  return 0;
}

Measured memory_bytes: 1408
# -*- coding: utf-8 -*-
"""
https://beta.atcoder.jp/contests/abc079/tasks/abc079_b

"""
import sys
from sys import stdin
from functools import lru_cache
input = stdin.readline


@lru_cache()
def solve(N):
    if N == 0:
        return 2
    elif N == 1:
        return 1
    return solve(N - 1) + solve(N - 2)



def main(args):
    N = int(input())
    ans = solve(N)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])
    


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

const int N = 2e5 + 123;

ll sum[N];

int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i ++) {
    int x;
    scanf("%d", &x);
    sum[i] = sum[i - 1] + x;
  }
  ll ans = 1e17;
  for (int i = 1; i < n; i ++) {
    ll dif = abs(sum[n] - sum[i] - sum[i]);
    ans = min(ans, dif);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std; 
using lint  =                           long long int;
using pint  =                           pair<int, int>;
using plint =                           pair<lint, lint>;
#define vli                             vector<lint>
#define pb                              push_back
#define ALL(x)                          begin(x),end(x)
#define inf                             (1LL<63)-1
#define MOD                             1000000007
#define SZ(x)                           ((lint)(x).size())
#define                                 FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define                                 IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define                                 REP(i, n) FOR(i,0,n)
#define                                 IREP(i, n) IFOR(i,0,n)
#define                                 f_ip   ios_base::sync_with_stdio(false); cin.tie(NULL);
#define                                 debug(x) cerr << #x << " " << (x) << endl
struct fast_ios                         { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
template<typename T>                    istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T>                    bool chmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T>                    bool chmin(T &m, const T q) { if (q < m) {m = q; return true;} else return false; }

lint pow_mod(lint base,lint expo) { 
   lint ret = 1;
   for(;expo;) { 
      if(expo&1)  ret = (ret*base)%MOD; 

      expo = (expo>>1);
      base = (base*base)%MOD;
   }
   return ret;
}

/* -------
         |
    **   |
   -------      
   |
   ---------------------------------------------------------------------------------------------------------------------------------*/

void solve(){  
    int N;
    cin >> N;
    vector<int> bosses(N-1);
    cin >> bosses;

    map<int,int> map;

    for(int i = 2;i <= N; ++i) {
        int curr = bosses[i-2];  // based indexing;

        ++map[curr];
    }
   
    for(int i = 1;i <= N; ++i){
        cout << map[i] << endl;
        // cout << i << endl;
    }
}

int main(){   
  
 // freopen("input.txt","r",stdin);
 // freopen("output.txt","w",stdout);
 
 solve();

 return 0;
}


Measured memory_bytes: 13552
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n) ;i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
using ll=long long;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define MOD  1000000007
const ll INF=1e18;
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; }



int main(int argc, char const *argv[]) {
  int n;
  cin >> n;
  pair<string,int> p[n];
  string x;
  rep(i,n){
    cin >> p[i].fi >> p[i].se;
  }
  cin >>x;
  int cnt=0,ans=0;
  rep(i,n){
    if(p[i].fi==x) cnt=i+1;
  }
  for(int i=cnt; i<n; i++) ans+=p[i].se;
  cout << ans << endl;
  return 0;
}


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

ll mod(ll a, ll b){
  ll ret=a%b;
  if(ret<0) ret+=b;
  return ret;
}

ll modpow(ll a,ll b,ll c){
  ll res=1;
  while(b>0){
    if(b&1) res=mod(res*a,c);
    a=mod(a*a,c);
    b>>=1;
  }
  return res;
}

int main() {
  int a,b,k;
  cin>>a>>b>>k;
  int cur=0;
  for(int i=min(a,b);i>0;i--){
    if(a%i==0 and b%i==0){
      cur++;
    }
    if(cur==k){
      cout<<i<<endl;
      break;
    }
  }
  return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#define IO(i, o) freopen(i, "r", stdin), freopen(o, "w", stdout)

using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count());

int n, a[51], b[51], c[51];
int main(){
	//IO("input.txt", "output.txt");
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> n;
	for(int i = 1; i <= n; i++) cin >> a[i];
	for(int i = 1; i <= n; i++) cin >> b[i];
	for(int i = 1; i < n; i++) cin >> c[i];
	int sum = 0;
	for(int i = 1; i <= n; i++){
		sum += b[a[i]];
		if(a[i - 1] + 1 == a[i]) sum += c[a[i - 1]];
	}
	cout << sum << "\n";
	return 0;
}

Measured memory_bytes: 256
<?php
//error_reporting(0);
//$N = trim(fgets(STDIN));
list($A,$B) =  explode(" ",trim(fgets(STDIN)));
//$d =  explode(" ",trim(fgets(STDIN)));

if ($A % 2 != $B %2)
  printf("IMPOSSIBLE\n");
else
printf("%d\n",($A+$B)/2);


Measured memory_bytes: 4728
#include <bits/stdc++.h>
#include<iostream>
#include<vector>
#include <cmath>
#include <map>
#include <algorithm>
#include <string>
#define rep(i, n) for (int i = 0; i < n; ++i)
using ll = long long;
using namespace std;
#define P pair<int, int>

int main () {
    ll N ;
    cin >> N ;
    char wo[N] ;
    ll a[3] ;
    a[0] =  0 ;
    a[1] = 0 ; 
    a[2] = 0 ;
    for(ll i = 0 ; i < N ; i++){
        cin >> wo[i] ;
        if(wo[i] == 'R' ){
            a[0] ++ ;
        }else if(wo[i] == 'G'){
            a[1] ++ ;
        }else{
            a[2] ++ ;
        }
    }
    ll ans ;
    ans = a[0] * a[1] * a[2] ;
    ll s ; 
   
    s = (N - 3)/ 2 ;
   
    for(ll num = 1 ;  num <=s+1 ;num++){
    for(ll j = 0 ; j < N  ; j++){
    if(j + 2 * num < N){
       if(wo[j] != wo[j+num]){
           if( wo[j] != wo[j + 2 * num]){
               if(wo[j+num] != wo[j + 2 * num]){
                   ans-- ;
               }
           }

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

 


Measured memory_bytes: 3596
n = int(input())
if n<=9:
    print(n)
elif 10<=n and n<=99 :
    print(9)
elif 100<=n and n<=999:
    print(9+n-100+1)
elif 1000<=n and n<=9999:
    print(909)
elif 10000<=n and n<=99999:
    print(909+n-10000+1)
else :
    print(90909)

Measured memory_bytes: 9144
n = int(raw_input())
count,res,ais,i = 0,0, map(int , raw_input().split()),0
while(i < n+1):
	if (ais[i] if i < n else -1) != i + 1:
		res += (count + 1)/2# + 1
		count = 0
	else: count +=1
	i+=1
print res

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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;

const ll LongINF=1e13+7;
const int INF=1e9+7;
const int dx[]={0,1,0,-1};
const int dy[]={1,0,-1,0};

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template <class T, class Y>T GCD(T a, Y b){if(a<b){int c=a;a=b;b=c;}if (a % b == 0){return b;}return GCD(b, a % b);}
template<class T,class Y>T LCM(T a,Y b){return (a*b)/GCD(a,b);}
void clear(queue<pair<int, int>> &q){queue<pair<int, int>> empty;swap(q, empty);} //queueの中身の型は適時変更を忘れない

using vi=vector<int>;
using vii=vector<vi>;

#define REP(i,a,b) for(ll i=(a);i<(b);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define rv reverse
#define ALL(a) (a).begin(),(a).end()
#define decimal(x) fixed<<setprecision(x)


int main(){
    int n,cnt=0;
    ll sum=0;
    cin>>n;
    vi a(n),b;
    rep(i,n){
        cin>>a[i];
        if(a[i]<0)cnt++;
        a[i]=abs(a[i]);
        sum+=a[i];
    }
    sort(ALL(a));
    if(cnt%2==0){
        cout<<sum<<endl;
    }else{
        cout<<sum-2*a[0]<<endl;
    }
    return 0;
}

//a=97,z=122

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

#define rep(i,n) for(ll i=0;i<(n);++i)
using ll = long long;
using pll = pair<ll,ll>;
constexpr ll INF = (1LL<<60);
constexpr ll MOD = (1e9+7);
//constexpr ll MOD = (998244353);
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(a>b){a=b;return 1;}return 0;}
#if loc||debg||local||debug
void dump(){cerr<<endl;}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){cerr<<h<<", ";dump(forward<Ts>(t)...);}
#else
template<class T,class... Ts> void dump(T&& h, Ts&&... t){}
#endif
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T> ostream &operator<<(ostream& os,vector<T>const& v){for(auto const& vi:v)os<<vi<<" ";return os;}
template<class T>vector<T> vec(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto vec(size_t a, Ts... ts){return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...));}
template<class T>vector<T> _vec(size_t a,T v){return vector<T>(a,v);}
template<class T, class... Ts>auto _vec(size_t a, Ts... ts){return vector<decltype(_vec<T>(ts...))>(a, _vec<T>(ts...));}

int main(){

  string s,t;
  cin>>s>>t;

  cout<<t<<s<<endl;

}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
typedef long long ll;
ll a[110];
int n;
int i;
int main()
{
    int tmp;
    cin>>n>>tmp;
    for(int i=1;i<=n;i++)  cin>>a[i];
    sort(a+1,a+n+1);
    int ans=0;
    for(i=1;i<=n;i++)
    {
        if(tmp>=a[i])
        {
            tmp-=a[i];
            ans++;
        }
        else break;
    }
    if(i==n+1&&tmp!=0)  ans--;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<cstdlib>
using namespace std;
#define il inline
#define re register
#define debug printf("Now is Line : %d\n",__LINE__)
#define file(a) freopen(#a".in","r",stdin);freopen(#a".out","w",stdout)
//#define int long long
#define D double
#define inf 123456789
#define mod 1000000007
il int read() {
    re int x = 0, f = 1; re char c = getchar();
    while(c < '0' || c > '9') { if(c == '-') f = -1; c = getchar();}
    while(c >= '0' && c <= '9') x = x * 10 + c - 48, c = getchar();
    return x * f;
}
#define rep(i , a , b) for(int i = (a) , i##Limit = (b) ; i <= i##Limit ; ++ i)
#define drep(i , b , a) for(int i = (a) , i##Limit = (b) ; i >= i##Limit ; -- i)
#define Next(i, u) for(re int i = head[u]; i; i = e[i].next)
#define mem(k, p) memset(k, p, sizeof(k))
#define lb(x) (x)&(-(x))
#define ls k * 2
#define rs k * 2 + 1
#define maxn 300005
int n, m, a[maxn];
char c[maxn];
int main() {
	scanf("%s", c + 1), n = strlen(c + 1);
	rep(i, 1, n / 2) if(c[i] != c[n - i + 1]) ++ m;
	cout << m;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>  // clang-format off
using namespace std;
using Int = long long;
#define REP2(i, n) for (Int i = 0, max_i = (n); i < max_i; i++)
#define REP3(i, a, b) for (Int i = (a), max_i = (b); i < max_i; i++)
#define OVERLOAD2(_1, _2, _3, name, ...) name
#define REP(...) OVERLOAD2(__VA_ARGS__, REP3, REP2)(__VA_ARGS__)
struct SetupIO { SetupIO() { cin.tie(nullptr), ios::sync_with_stdio(false), cout << fixed << setprecision(13); } } setup_io;
#ifndef _MY_DEBUG
#define dump(...)
#endif  // clang-format on

/**
 *    author:  knshnb
 *    created: Mon Feb 10 22:50:13 JST 2020
 **/

signed main() {
    Int n, K;
    cin >> n >> K;
    vector<Int> a(n);
    REP(i, n) cin >> a[i];
    sort(a.rbegin(), a.rend());
    Int ans = 0;
    REP(i, K, n) ans += a[i];
    cout << ans << endl;
}


Measured memory_bytes: 1792
W, H, N = list(map(int, input().split()))

min_x = 0
min_y = 0
max_x = W
max_y = H

for i in range(N):
    x, y, a = list(map(int, input().split()))
    if a == 1:
        min_x = max(min_x, x)
    if a == 2:
        max_x = min(max_x, x)
    if a == 3:
        min_y = max(min_y, y)
    if a == 4:
        max_y = min(max_y, y)

ans_W = max(0, (max_x - min_x))
ans_H = max(0, (max_y - min_y))

print(ans_W * ans_H)

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

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

	long long ans = 0;
	for (long long i = 1; i <= n; i++)
	{
		long long fk = (n / i) * (n / i + 1) * i / 2;
		ans += fk;
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3580
#include <algorithm>
#include <array>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <string>
#include <utility>
#include <vector>
#define FOR(i,a,b) for (int i=(a),for_##i##_max=(b);i<=(for_##i##_max);++i)
#define RFOR(i,a,b) for (int i=(a),rfor_##i##_min=(b);i>=(rfor_##i##_min);--i)
#define REP(i,n) for (int i=0,rep_##i##_len=(n);i<(rep_##i##_len);++i)
#define RREP(i,n) for (int i=(n)-1;i>=0;--i)

namespace { // Basics

template<typename T>
void chmin(T &x, T y) {
  x = std::min(x, y);
}

template<typename T>
void chmax(T &x, T y) {
  x = std::max(x, y);
}

template<typename T>
__attribute__((unused))
const auto minimum = static_cast<T const &(*)(T const &, T const &)>(std::min);

template<typename T>
__attribute__((unused))
const auto maximum = static_cast<T const &(*)(T const &, T const &)>(std::max);

template<typename T>
__attribute__((unused))
T constexpr infty = std::numeric_limits<T>::max / 3;
template<>
__attribute__((unused))
auto constexpr infty<int> = 1'100'100'100;
template<>
__attribute__((unused))
auto constexpr infty<long long int> = 100'500'400'300'200'100LL;

using lli = long long int;
using ld = long double;

} // namespace

using namespace std;

void solve(int T, int D, int L, vector<int> dat) {
  int ans = 0, last = -infty<int>;
  REP(t, T) {
    if (dat[t] >= L) {
      ans += D - max(0, last - t);
      last = t + D;
    }
  }
  ans -= max(0, last - T + 1);
  cout << ans << endl;
}

int main() {
  // cout << fixed << setprecision(10);

  int T, D, L;
  while (cin >> T >> D >> L && T) {
    vector<int> dat;
    REP(i, T) {
      int X; cin >> X;
      dat.push_back(X);
    }
    solve(T, D, L, dat);
  }
  return 0;
}



Measured memory_bytes: 3576
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Collection;
import java.io.IOException;
import java.util.stream.Collectors;
import java.io.InputStreamReader;
import java.util.List;
import java.util.stream.Stream;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.util.LinkedList;
import java.util.Collections;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        MyScanner in = new MyScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        D solver = new D();
        solver.solve(1, in, out);
        out.close();
    }

    static class D {
        public void solve(int testNumber, MyScanner in, PrintWriter out) {
            String S = in.next();
            List<String> list = new LinkedList<>();
            list.addAll(Arrays.stream(S.split("")).collect(Collectors.toList()));
            int Q = in.nextInt();
            boolean rev = false;
            for (int i = 0; i < Q; i++) {
                int T = in.nextInt();
                if (T == 1) {
                    rev = !rev;
                } else {
                    int F = in.nextInt();
                    String C = in.next();
                    if (!rev) {
                        if (F == 1) {
                            list.add(0, C);
                        } else {
                            list.add(C);
                        }
                    } else {
                        if (F == 1) {
                            list.add(C);
                        } else {
                            list.add(0, C);
                        }
                    }
                }
            }
            if (rev) {
                Collections.reverse(list);
            }
            out.println(list.stream().collect(Collectors.joining()));
        }

    }

    static class MyScanner {
        private BufferedReader in;
        private StringTokenizer st;

        public MyScanner(InputStream stream) {
            in = new BufferedReader(new InputStreamReader(stream));
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String rl = in.readLine();
                    if (rl == null) {
                        return null;
                    }
                    st = new StringTokenizer(rl);
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 81096
#include<bits/stdc++.h>
#include<iostream>
#define ll long long
using namespace std;
int main(){
    ll n,k;
    ll a[200003];
    ll i,j;
    cin>>n>>k;
    for(i=0;i<n;i++)cin>>a[i];
    for(i=k;i<n;i++){
        if(a[i]>a[i-k])cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
    return 0;
}


Measured memory_bytes: 5212
using System;

namespace AizuOnLine_Lesson
{
    class Program
    {
        static void Main(string[] args)
        {
            int num1;
            int num2;
            Program.GetData(out num1, out num2);

            while (num1 % num2 != 0)
            {
                Program.Euclid(ref num1, ref num2);
            }

            Console.WriteLine(num2);
        }

        private static void GetData(out int num1, out int num2)
        {

            string[] line = System.Console.ReadLine().Split(' ');

            num1 = Convert.ToInt32(line[0]);
            num2 = Convert.ToInt32(line[1]);
        }

        private static void Euclid(ref int num1, ref int num2)
        {
            int amari = num1 % num2;
            num1 = num2;
            num2 = amari;
        }
    }
}

Measured memory_bytes: 5664
#include <cstdio>
#include <algorithm>
#include <queue>
#include <deque>
#include <vector>
#include <string>
#include <string.h>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <map>
#include <set>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <numeric>
#include <cctype>
#include <bitset>
#include <cassert>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(s) s.begin(), s.end()
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const int MX = 100005, INF = 1001001001;
const ll LINF = 1e18;
const double eps = 1e-10;
const int DIV = 1e9+7;
 
int main()
{
    int n;
    vi a;
 
    cin >> n;
    a.resize(n);
    rep(i,n) cin >> a[i];
 
    sort(all(a), greater<int>());
 
    int e[3];
    int m = 0;
    rrep(i,n-1){
        if(i == 0) continue;
        if(a[i] == a[i-1]){
            e[++m] = a[i];
            i++;
        }
        if(m == 2) break;
    }
    ll ans = (ll)e[1] * (ll)e[2];
    if(m < 2) puts("0");
    else cout << ans << endl;
}


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

int main()
{
  string S;
  cin >> S;
  char char1;
  int char1_count = 0;
  char char2;
  int char2_count = 0;
  rep(i, S.size()) {
    char1 = S.at(0);
    if (S.at(i) != char1) {
      char2 = S.at(i);
    }
  }
  rep(i, S.size()){
    if (S.at(i) == char1) {
      char1_count++;
    } else if (S.at(i) == char2) {
      char2_count++;
    } else {
      cout << "No" << endl;
      return 0;
    }
  }
  if (char1_count == 2 && char2_count == 2){
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
using namespace std;
int main() {
  
  long long N;
  cin>>N;
  
  string res="";
  
  
  while(N>0){
    N--;
    res+=(char)('a'+(N%26));
    N/=26;
  }
  
  reverse(res.begin(),res.end());
  cout<<res<<endl;
}

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

int main() {
    int n; cin >> n;
    vector<string> s(n);
    set<string> se;

    rep(i, n) {
        cin >> s.at(i);
        se.insert(s.at(i));
    }
    int m; cin >> m;
    vector<string> t(m);
    rep(i, m) {
        cin >> t.at(i);
    }

    int ans = 0;
    for (auto it = begin(se); it != end(se); it++) {
        int tmp = 0;
        rep(i, n) {
            if (*it == s.at(i))
                tmp++;
        }
        rep(i, m) {
            if (*it == t.at(i))
                tmp--;
        }
        ans = max(ans, tmp);
    }

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

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#define MAX 2000000
#define VMAX 10000

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

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

  A = malloc(sizeof(short)*num);
  B = malloc(sizeof(short)*num);

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

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

    C[A[i + 1]]++;
  }

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

  for ( j = 1; j <= num; j++ ){

    B[C[A[j]]] = A[j];
    C[A[j]]--;
  }

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

  return 0;
}

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

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

int main(void) {
	int n, tmp;
	vector<int> v;
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d", &tmp);
		v.push_back(tmp);
	}
	bool prev_flag;
	if (prev_permutation(v.begin(), v.end())) {
		output(v);
	}
	next_permutation(v.begin(), v.end());
	output(v);
	if (next_permutation(v.begin(), v.end())) {
		output(v);
	}
}


Measured memory_bytes: 3280
#include <map>
#include <set>
#include <vector>
#include <iostream>
#include <algorithm>

using namespace std;

#define int long long

const int N = 1e6 + 10;

int l[N];
vector<int> p;

int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);   
  for (int i = 2; i < N; ++i) {
    if (!l[i]) {
      l[i] = i;
      p.push_back(i);
    }
    for (int j = 0; j < p.size() && p[j] <= l[i] && i * p[j] < N; ++j) {
      l[i * p[j]] = p[j];
    }
  }
  int n;
  cin >> n;
  int g = 0;
  map<int, int> m;
  for (int i = 0; i < n; ++i) {
    int z;
    cin >> z;
    g = __gcd(g, z);
    set<int> s;
    while (l[z]) {
      s.insert(l[z]);
      z /= l[z];
    }
    for (int x : s) {
      ++m[x];
    }
  }
  for (auto &i : m) {
    if (i.second > 1) {
      if (g == 1) {
        cout << "setwise coprime";
        return 0;
      } else {
        cout << "not  coprime";
        return 0;
      }
    }
  }
  cout << "pairwise coprime";
  return 0;
}


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

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n; cin >> n;
  long long ans = 0;
  for(int i = 1; i <= n; i++){
    for(int j = 1; j <= n; j++){
      for(int k = 1; k <= n; k++){
        ans += __gcd(__gcd(i, j), k);
      }
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3652
class NormalInput {
  input: string[];
  pointer: number;
  constructor(raw: string) {
    this.input = raw.split(/ |\n/);
    this.pointer = 0;
  }
  read<T>(parser: (v: string) => T): () => T {
    return () => {
      const ret = parser(this.input[this.pointer]);
      this.pointer++;
      return ret;
    };
  }
  int = this.read(str => parseInt(str, 10));
  ints = (length: number): number[] => {
    let ret: number[] = [];
    for (let i = 0; i < length; i++) {
      ret.push(this.int());
    }
    return ret;
  };
  str = (): string => {
    const ret = this.input[this.pointer];
    this.pointer++;
    return ret;
  };
  strs = (length: number): string[] => {
    let ret: string[] = [];
    for (let i = 0; i < length; i++) {
      ret.push(this.str());
    }
    return ret;
  };
  bint = (): bigint => {
    const ret = BigInt(this.input[this.pointer]);
    this.pointer++;
    return ret;
  };
  bints = (length: number): bigint[] => {
    let ret: bigint[] = [];
    for (let i = 0; i < length; i++) {
      ret.push(this.bint());
    }
    return ret;
  };
}
function rep(a: number, b: number) {
  let arr = [];
  for (let i = a; i < b; i++) arr.push(i);
  return arr;
}

function Main({ int, str, strs, ints, bint }: NormalInput) {
  const X = bint();
  for (let a = BigInt(-120); a < 120; a++)
    for (let b = BigInt(-120); b < 120; b++) {
      if (X === a * a * a * a * a - b * b * b * b * b) {
        console.log(`${a} ${b}`);
        return;
      }
    }
}

//DO NOT EDIT
Main(new NormalInput(require("fs").readFileSync("/dev/stdin", "utf8")));


Measured memory_bytes: 35308
#include<stdio.h>
int main()
{
    int w, h, x, y, r;
    scanf("%d%d%d%d%d", &w, &h, &x, &y, &r);
    if(x - r >= 0 && w >= (x + r) && y - r >= 0 && h >= (y + r)){
        printf("Yes\n");
    }
    else{
        printf("No\n");
    }
    return 0;
}


Measured memory_bytes: 2124
//Link : https://codeforces.com/contest/1253

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define N 200005
#define mod 998244353
/*
#include <limits.h>
INT_MAX
LLONG_MAX
*/

int add(int x,int y) {
  return ((x+y)%mod+mod)%mod;
}
pair<int,int> in[N];
int dp[N],maxi[N];
int seg[N*4];
void update(int pos,int l,int r,int ql,int qr,int v) {
  if(qr< l || r<ql) {
    return;
  }
  if(ql<=l && r<=qr) {
    seg[pos] = max(seg[pos],v);
    return;
  }
  int mid = (l+r)/2;
  update(pos*2,l,mid,ql,qr,v);
  update(pos*2+1,mid+1,r,ql,qr,v);
  seg[pos] = max(seg[pos*2],seg[pos*2+1]);
}
int query(int pos,int l,int r,int ql,int qr) {
  if(qr< l || r<ql) {
    return 0;
  }
  if(ql<=l && r<=qr) {
    return seg[pos];
  }
  int mid = (l+r)/2;
  return max(query(pos*2,l,mid,ql,qr), query(pos*2+1,mid+1,r,ql,qr));
}
void solve() {
  int n;
  scanf("%d ", &n);
  for(int i=0;i<n;++i) {
    scanf("%d %d ", &in[i].first,&in[i].second);
  }
  sort(in,in+n);
  in[n] = {(int)2e9 + 150,0};
  dp[n] = 1;
  for(int i=n-1;i>=0;--i) {
    int ind = lower_bound(in,in+n+1,make_pair(in[i].first + in[i].second,0)) - in;
    if(in[i].first + in[i].second> in[i+1].first)
      ind = query(1,0,n-1,i+1,ind-1);
    dp[i] = add(dp[i+1], dp[ind]);
    update(1,0,n-1,i,i,ind);
  }
  printf("%d\n", dp[0]);
}

int main() {
    //freopen("input.txt","r",stdin);
    solve();
    return 0;
}


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

using namespace std;

void Main() {
    int A, B, C;
    cin >> A >> B >> C;
    if (A == B) {
        cout << C << endl;
    }
    else if (B == C) {
        cout << A << endl;
    }
    else {
        cout << B << endl;
    }
}

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


Measured memory_bytes: 3636
# damedatta
def binsearch(l, r, fn):
    while r - l > 1:
        m = (l + r) // 2
        if fn(m):
            l = m
        else:
            r = m
    return l
def main():
    X, Y, Z, K = map(int, input().split())
    D = sorted(map(int, input().split()), reverse=True)
    B = list(map(int, input().split()))
    C = list(map(int, input().split()))
    A = sorted((i + j for i in B for j in C), reverse=True)
    def calc(x):
        t = 0
        ii = len(D) - 1
        for i in A:
            while ii >= 0 and D[ii] + i < x:
                ii -= 1
            t += ii + 1
            if t >= K:
                return True
            if ii < 0:
                return False
        return t >= K
    l = binsearch(D[-1] + A[-1], D[0] + A[0]+1, calc)
    ii = len(D) - 1
    rl = []
    for i in A:
        while ii >= 0 and D[ii] + i < l + 1:
            ii -= 1
        if ii < 0:
            break
        rl.extend(i + j for j in D[:ii+1])
    rl.sort(reverse=True)
    rl += [l] * (K - len(rl))
    print('\n'.join(str(i) for i in rl))
main()


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

using namespace std;

int main() {

	long long int n, y;
	cin >> n >> y;
	y /= 1000;
	bool h = true;
	for (long long int i = 0; i <= n; i++) {
		for (long long int j = 0; i + j <= n; j++) {
			long long int k = n - (i + j);
			if (10LL * i + 5LL * j + k == y) {
				cout << i << ' ' << j << ' ' << k << endl;
				h = false;
				break;
			}
		}
		if (!h) {
			break;
		}
	}
	if (h) {
		cout << "-1 -1 -1" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
//MISHON69
//DATE:6/22/2020
#include<bits/stdc++.h>
using namespace std;
int main(){
 string w;
 cin>>w;
 if(w=="Sunny")
 cout<<"Cloudy"<<endl;
 else if(w=="Cloudy")
 cout<<"Rainy"<<endl;
 else
 cout<<"Sunny"<<endl;  
}  


Measured memory_bytes: 3568
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
REP(i,v.size()){if(i)os<<" ";os<<v[i];}return os;}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
REP(i,v.size()){if(i)os<<endl;os<<v[i];}return os;}

int main() {
    // メインプログラムここから
    double R1, R2;
    cin >> R1 >> R2;
    cout << fixed << setprecision(10);
    cout << 1/((1/R1) + (1/R2)) << endl;
    // ここまで
}

Measured memory_bytes: 256
#include<math.h>
#include<stdio.h>
int main()
{
  int a,b,c,another,min,max,sum=0;
  scanf("%d %d %d",&a,&b,&c);
  min=a;
  min=fmin(min,b);
  min=fmin(min,c);

  max=a;
  max=fmax(max,b);
  max=fmax(max,c);

  sum=a+b+c;
  another=sum-max-min;
  printf("%d %d %d\n",min,another,max);
  return 0;
}



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

typedef long long int ll;

int N, D;
vector<string> names;
//
//ll to_int(string s){
//    const int MOD = 1000000009;
//    ll res = 0;
//    for(auto c: s){
//        res = (res*26 + (c - 'a')) % MOD;
//    }
//    return res;
//}

void solve(){
    sort(names.begin(), names.end());
    
    map<string, set<int>> mp;
    for(int ni=0; ni<N; ni++){
        string name = names[ni];
        int L = name.size();
        
        //delete
        for(int i=0; i<L; i++){
            string t = name;
            t.erase(t.begin()+i);
            mp[t].insert(ni);
        }
        //insert
        for(int i=0; i<=L; i++){
            for(char c='a'; c<='z'; c++){
                string t = name;
                t.insert(t.begin()+i, c);
                mp[t].insert(ni);
            }
        }
        //replace
        for(int i=0; i<L; i++){
            for(char c='a'; c<='z'; c++){
                string t = name;
                t[i] = c;
                mp[t].insert(ni);
            }
        }
        //swap
        for(int i=0; i<L-1; i++){
            string t = name;
            swap(t[i], t[i+1]);
            mp[t].insert(ni);
        }
    }
    if(D == 1){
        int cnt = 0;
        for(int ni=0; ni<N; ni++){
            string name = names[ni];
            if(mp[name].size() > 1){
                for(auto v: mp[name]){
                    if(v <= ni) continue;
                    cout << name << "," << names[v] << endl;
                    cnt++;
                }
            }
        }
        cout << cnt << endl;
    }
    if(D == 2){
        set<pair<int, int>> s;
        for(auto v: mp) if(v.second.size() > 1){
            vector<int> vec;
            for(auto vv: v.second) vec.push_back(vv);
            for(int i=0; i<vec.size(); i++){
                for(int j=i+1; j<vec.size(); j++){
                    s.insert(make_pair(vec[i], vec[j]));
                }
            }
        }
        for(auto v: s){
            cout << names[v.first] << "," << names[v.second] << endl;
        }
        cout << s.size() << endl;
    }

}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    while(cin>>N, N){
        cin >> D;
        names.resize(N);
        for(auto &v: names) cin >> v;
        solve();
    }
    
    return 0;
}

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

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define LOOP(i) while(i--)
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

vector<ll> enum_prime(ll N){
	deque<bool> is_prime(N+1,true);
	vector<ll> P;
	for(ll i=2;i<=N;i++){
		if(is_prime[i]){
			for(ll j=i*i;j<=N;j+=i){
				is_prime[j] = false;
			}
			P.emplace_back(i);
		}
	}
	return P;
}

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

	auto res = enum_prime(200000);
	sort(ALL(res));
	while(true){
		int N=in();
		if(!N) break;
		out(accumulate(res.begin(),res.begin()+N,0LL));
	}

	return 0;
}


Measured memory_bytes: 3324
#include<iostream>
    #include<stdio.h>
    //#include <bits/stdc++.h>
    #include<vector>
    #include<float.h>
    #include<iomanip>
    #include<algorithm>
    #include<string>
    #include<cstring>
    #include<math.h>
    #include<cmath>
    #include<sstream>
    #include<set>
    #include<map>
    #include<queue>
    #include<cassert>
    #include<cmath>
    #include<cstdint>
     
    #define INF 1e9
    #define rep(i,n)for(int i=0;(i)<(int)(n);i++)
    #define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
    #define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
    #define vec(type,n) vector<type>(n)
    #define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
    #define ALL(a)  (a).begin(),(a).end()
    #define chmin(a, b) a = min(a, b)
    #define chmax(a, b) a = max(a, b)
    #define pb push_back
    #define sz size()
     
    using namespace std;
    using ll = long long int;
    using Graph = vector<vector<int>>;
    using P = pair<ll, ll>;
    using Vl = vector<ll>;
     
const int MOD = 1e9 + 7;
const ll ZER = 0;

//bit全探索
vector<ll>bitSearch(int bit,int n){
    vector<ll>S;
    rep(i,n)if(bit&(1<<i))S.push_back(i);
    S.push_back(1e9);
    return S;
}

ll dp1[3010][2], dp2[3010][2];
int main(){
    int n, m;
    cin >> n >> m;
    vector<int> cnt(n, 0);
    rep(i, m){
        int a, b;
        cin >> a >> b;
        a--;b--;
        cnt[a]++;
        cnt[b]++;
    }
    rep(i, n){
        if(cnt[i] % 2 != 0){
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
}



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

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

int main(int argc, char *argv[])
{
  int a, b, k;
  vector<int> ans;
  cin >> a >> b >> k;
  int gcdNum = gcd(a, b);
  for(int i = 1;  gcdNum >= i; i++) {
    if(gcdNum % i == 0) ans.push_back(i);
  }
  cout << ans.at(ans.size() - k) << endl;
  return 0;
}


Measured memory_bytes: 256
#include <deque>
#include <iostream>
using namespace std;
int main() {
    int n, x; cin >> n >> x;
    int a[2*n]; for (int i = 0; i < n; i++) cin >> a[i], a[i+n] = a[i];
    long long ans = 1LL<<60;
    for (int k = 0; k < n; k++) {
        deque<pair<int, int> > deq;
        long long tmp = 0;
        for (int i = n-k; i < n; i++) {
            while (!deq.empty() && deq.back().second > a[i]) deq.pop_back();
            deq.push_back({i, a[i]});
        }
        for (int i = n; i < 2*n; i++) {
            while (!deq.empty() && deq.front().first < i-k) deq.pop_front();
            while (!deq.empty() && deq.back().second > a[i]) deq.pop_back();
            deq.push_back({i, a[i]});
            tmp += deq.front().second;
        }
        ans = min(ans, tmp + (long long)k * x);
    }
    cout << ans << endl;
}


Measured memory_bytes: 256