akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef map<int,int> mii;
typedef map<ll,ll> mll;
#define pi 3.141592653589793
#define mod 998244353
#define pb push_back
#define all(v) v.begin(),v.end()
#define tc int t;cin>>t;while(t--)
#define pqmax priority_queue<int>
#define pqmin priority_queue<int,vi,greater<int>>
#define fast_io ios_base::sync_with_stdio(0), cin.tie(NULL)
#define tc_g int tt;cin>>tt;for(int ti=1;ti<=tt;ti++)
#define case_g "Case #"<<ti<<": "
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<int, null_type, greater_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_multiset;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
typedef tree<int, int, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_map;
using namespace std;
int main()
{
    ll N;
    cin >> N;
    ll ans = 0;
    for(int i = 1; i <= N; ++i)
    {
        if(!((!i%3 && !i%5) || !(i%3) || !(i%5)))
            ans += i;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3636
#include <iostream>
#include <cstdint>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <algorithm>

int main(void)
{
    int64_t H, A;
    std::cin >> H >> A;

    int64_t ans = H / A;

    if (H%A != 0) ans++; 

    std::cout << ans << std::endl;

    return 0;
}

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

int main() {
  string s;
  ll k;
  cin >> s >> k;
  REP(i,k){
    if(s[i] != '1'){
      cout << s[i] << endl;
      return 0;
    }
  }
  cout << 1 << endl;
}


Measured memory_bytes: 3588
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
int main()
{
    ll n,sum=0;
    cin>>n;
    ll a[n+2];
    vector<vector<ll>>vp(100005,vector<ll>());
    for(int i=1;i<=n;i++){cin>>a[i];sum+=a[i];vp[a[i]].push_back(a[i]);}
    ll k;
    cin>>k;
    for(int i=1;i<=k;i++)
    {
        ll x,y,d;
        cin>>x>>y;
        for(ll j=0;j<vp[x].size();j++)
        {
            //cout<<a[x]<<endl;
            sum-=vp[x][j];
            sum+=y;
            //a[x]=y;
            vp[y].push_back(y);
        }
        //for(auto k:vp[2])cout<<k<<" ";
        //for(int i=0;i<5;i++)
           // for(int j=0;j<4;j++)cout<<vp[i][j]<<" \n"[j==3];
        vp[x].clear();
        cout<<sum<<endl;
    }

}


Measured memory_bytes: 53436
mod = 1_000_000_007

n = gets.to_s.to_i

h = Hash.new{|h, k| h[k] = [0, 0] }
genten_iwashi = 0

n.times do
  a, b = gets.to_s.split.map{|s| s.to_i }
  
  if a == 0 && b == 0
    genten_iwashi += 1
  else
    f = a.zero? || a * b > 0
    r = ( f ? Rational(a,b) : -Rational(b,a) )
    h[r][ f ? 0 : 1 ] += 1
  end
end

ans = 1
h.each do |k, (a, b)|
  ans *= ( 2.pow(a,mod) + 2.pow(b, mod) - 1)
  ans %= mod
end

ans = ( ans - 1 + genten_iwashi ) % mod

puts ans

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

constexpr char NL = '\n';
constexpr int MOD = 1e9 + 7;

struct safe_hash {
    static uint64_t splitmix64(uint64_t x) {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

void solve()
{
    int n, m; cin >> n >> m;

    int sx, sy; cin >> sx >> sy;
    int dx, dy; cin >> dx >> dy;
    --sx; --sy; --dx; --dy;
    
    vector<vector<char>> v(n, vector<char>(m));
    vector<vector<bool>> visited(n, vector<bool>(m, false));
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < m; ++j) {
            cin >> v[i][j];
        }
    }

    deque<pair<pair<int, int>, int>> q;
    q.push_back({{sx, sy}, 0});

    vector<pair<int, int>> coords = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}};

    while (!q.empty()) {
        pair<int, int> pos = q.front().first;
        int weight = q.front().second;

        if (pos.first == dx && pos.second == dy) {
            cout << weight << NL;
            return;
        }

        q.pop_front();

        visited[pos.first][pos.second] = true;

        for (int i = 0; i < 4; ++i) {
            int nx = pos.first + coords[i].first;
            int ny = pos.second + coords[i].second;

            if (nx < 0 || ny < 0 || nx >= n || ny >= m || visited[nx][ny] || v[nx][ny] == '#') continue;

            q.push_front({{nx, ny}, weight});
        }

        for (int i = -2; i <= 2; ++i) {
            for (int j = -2; j <= 2; ++j) {
                int nx = pos.first + i;
                int ny = pos.second + j;

                if (nx < 0 || ny < 0 || nx >= n || ny >= m || visited[nx][ny] || v[nx][ny] == '#') continue;

                q.push_back({{nx, ny}, weight + 1});
            }
        }
    }

    cout << -1 << NL;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    solve();
    return 0;
}

Measured memory_bytes: 11988
import sys

INPUT = lambda: sys.stdin.readline().rstrip()
INT = lambda: int(INPUT())

sys.setrecursionlimit(10 ** 9)


def main():
    N = INT()
    S = INPUT()

    if N%2 == 1:
        print("No")
    else:
        if S[:N//2] == S[N//2:]: print("Yes")
        else: print("No")


if __name__ == '__main__':
    main()

Measured memory_bytes: 39860
#include <bits/stdc++.h>
#define all(vec) vec.begin(), vec.end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
constexpr ll INF = (1LL << 30) - 1LL;
constexpr ll LINF = (1LL << 60) - 1LL;
constexpr ll MOD = 1e9 + 7;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll a, b;
    cin >> a >> b;
    ll g = __gcd(a, b);
    int ans = 1;
    for (ll i = 2; i * i <= g; i++) {
        if (g % i == 0) {
            while (g % i == 0) {
                g /= i;
            }
            ans++;
        }
    }
    if (g != 1) {
        ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repf(i, a, b) for(ll i = (a); i < (b) ; i++ )
const ll mo = 1000000007;
const ll INF = 1LL << 60; //MAX 9223372036854775807
ll ans = 0;

int main()
{
ll a,b,c,d;
cin >> a>>b>>c>>d;
a--;
ans+=b-a;
ans-=b/c-a/c;
ans-=b/d-a/d;
ll aa=d*c/__gcd(d,c);
ans+=b/aa-a/aa;

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

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

typedef long long ll;
const int MAXN=1e5+5;

int n,L,T;
int a[MAXN],w[MAXN];
int ans[MAXN];

int main(){
    scanf("%d%d%d",&n,&L,&T);
    for(int i=1;i<=n;i++){
        scanf("%d%d",&a[i],&w[i]);
        if(w[i]==2) w[i]=-1;
    }
    ll cnt=0;
    for(int i=1;i<=n;i++){
        ll np=a[i]+w[i]*T;
        if(!np) continue;
        if(np>0) (cnt+=np/L)%=n;
        else (cnt+=(np+1)/L-1)%=n;
        ans[i]=(np%L+L)%L;
    }
    sort(ans+1,ans+n+1);
    cnt=(cnt+n)%n;
    for(int i=cnt+1;i<=n;i++) printf("%d\n",ans[i]);
    for(int i=1;i<=cnt;i++) printf("%d\n",ans[i]);
}


Measured memory_bytes: 2304
//i hate _____
#include<bits/stdc++.h>

#define ll long long int 
#define ld long double 
#define pb push_back
#define mk make_pair
#define ii pair<int,int>

using namespace std;
double pi=2*acos(0.0);

/*freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);*/

template<typename T> 
ostream& operator<<(ostream &os, const vector<T> &v) { 
    os << '{'; 
    for (const auto &x : v) os << " " << x;
        return os << '}'; 
}

int n,in; 
vector<int>v;
map<int,int>mp;
ll ans=0;

void input(){
    cin>>n;
    for (int i=0;i<n;i++){
        cin>>in; mp[in]++;
        if (mp[in]==1) v.pb(in);
    }
    sort(v.begin(),v.end());
}

bool ck(int a,int b, int c){
    if ((a+b)>c && (b+c)>a && (c+a)>b) {
        return true;
    }
    else {
        return false;
    }
}

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

    input();
    
    int sz=v.size();
    for (int i=0;i<sz;i++){
        for (int j=i+1;j<sz;j++){
            for (int k=j+1;k<sz;k++){
                if (ck(v[i],v[j],v[k])){
                    ans+=(mp[v[i]]*mp[v[j]]*mp[v[k]]);
                }
            }
        }
    }

    cout << ans << endl;
    
    return 0;
}
/*
    problems are the sign of life
*/


Measured memory_bytes: 3672
import java.io.*;

public class Main{
    public static void main(String[] args)throws IOException{
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	String s;
	int rst = 0;
	while((s=br.readLine()) != null){
	    boolean flg = true;
	    for(int i=0,j=s.length()-1; i!=j && i!=j+1; i++,j--){
		if(s.charAt(i) != s.charAt(j)){
		    flg = false;
		    break;
		}
	    }
	    if(flg) rst++;
	}
	System.out.println(rst);
    }
}

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

int main() {
	int n,k;cin>>n>>k;
	map<int,int> mp;
	for(int i=0;i<k;++i) {
		int j;cin>>j;
		mp[j]++;
	}
	
	for(int bit=0;bit<(1<<n);++bit){
		bool ok= true;
		for(auto &&mi: mp){
			ok &= bit>>mi.first&1;
		}
		if(!ok) continue;
		cout<<bit<<":";
		for(int i=0;i<n;++i){
			if(bit>>i&1) {
				cout<<" "<<i;
			}
		}
		cout<<endl;
	}
  return 0;
}



Measured memory_bytes: 3080
#include <bits/stdc++.h>
using namespace std;
#define IO ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
typedef long long ll;
const int maxn = 105;
const ll mod = 1e9 + 7;
ll powmod(ll a, ll b)
{
    if (!b)
        return 1;
    ll ans = 1;
    while (b)
    {
        if (b & 1)
            ans = ans * a % mod;
        b >>= 1;
        a = a * a % mod;
    }
    return ans;
}
ll exgcd(ll a, ll b, ll &x, ll &y) //扩展欧几里得算法
{
    if (b == 0)
    {
        x = 1, y = 0;
        return a;
    }
    ll ret = exgcd(b, a % b, y, x);
    y -= a / b * x;
    return ret;
}
ll getInv(ll a, ll mod) //求a在mod下的逆元，不存在逆元返回-1s
{
    ll x, y;
    ll d = exgcd(a, mod, x, y);
    return d == 1 ? (x % mod + mod) % mod : -1;
}
ll cal(ll a, ll b)
{
    ll ans = 1;
    ll cnt = b;
    for (ll i = a; i >= a - b + 1; --i)
        ans = (ans * i) % mod;
    for (ll i = 1; i <= b; ++i)
        ans = (ans * getInv(i, mod)) % mod;
    return ans;
}
int main()
{
    IO;
    ll n, a, b;
    cin >> n >> a >> b;
    ll ans = powmod(2, n) - 1;
    ans = (ans + mod) % mod;
    ans = (ans + mod - cal(n, a)) % mod;
    ans = (ans + mod - cal(n, b)) % mod;
    cout << ans << endl;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = Integer.parseInt(sc.next());
    
    int sum = 0;
    for (int i = 1; i <= N; i++) {
      if (String.valueOf(i).length() % 2 == 1) {
        sum++;
      }
    }
    
    System.out.println(sum);
  }
}

Measured memory_bytes: 28116
import java.util.*;

public class Main {
	public static void main (String[] args) {
    	Scanner sc = new Scanner(System.in);
    	int n = sc.nextInt();
    	int gcd = sc.nextInt();
    	HashSet<Integer> primes = new HashSet<>();
    	int x = gcd;
    	for (int i = 2; i <= Math.sqrt(x); i++) {
    	    while (x % i == 0) {
    	        primes.add(i);
    	        x /= i;
    	    }
    	    if (x > 1) {
    	        primes.add(x);
    	    }
    	}
    	boolean isPair = true;
    	for (int i = 1; i < n; i++) {
    	    int y = sc.nextInt();
    	    gcd = getGCD(gcd, y);
    	    for (int j = 2; j <= Math.sqrt(y) && isPair; j++) {
    	        if (y % j == 0) {
    	            if (primes.contains(j)) {
    	                isPair = false;
    	                break;
    	            }
    	            primes.add(y);
    	            y /= j;
    	            while (y % j == 0) {
    	                y /= j;
    	            }
    	        }
    	    }
    	    if (isPair && y > 1) {
    	        if (primes.contains(y)) {
    	            isPair = false;
    	        } else {
    	            primes.add(y);
    	        }
    	    }
    	}
    	if (isPair) {
    	    System.out.println("pairwise coprime");
    	} else if (gcd == 1) {
    	    System.out.println("setwise coprime");
    	} else {
    	    System.out.println("not coprime");
    	}
    }
    
    static int getGCD(int x, int y) {
        if (x % y == 0) {
            return y;
        } else {
            return getGCD(y, x % y);
        }
    }
}


Measured memory_bytes: 67392
#include<iostream>
#include<climits>
#include<cstring>
#define ll long long
using namespace std;
int h[ 100000 ];
ll sum[ 100000 ];
ll fun( int index, int size );
int main(){
    int N;
    cin >> N;
    for( int i = 0; i < N; i++ ){
        cin >> h[ i ];
    }
    memset( sum, -1, sizeof( sum ) );
    ll answer = fun( 0, N );
    cout << answer << "\n";
    return 0;
}
ll fun( int index, int size ){
    if( index == size - 1 ){
        return 0LL;
    }
    if( sum[ index ] != -1 ){
        return sum[ index ];
    }
    ll left = abs( h[ index ] - h[ index + 1] ) + fun( index + 1, size );
    ll right = INT_MAX;
    if( index < size - 2 )
        right = abs( h[ index ] - h[ index + 2] ) + fun( index + 2, size );
    sum[ index ] = min( left, right );    
    return sum[ index ];
}

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

int main()
{
  while(1){
    int x,y,s;
    cin>>x>>y>>s;

    if(x==0 && y==0 && s==0)
      break;

    int tmax = -1;

    for(int i=1; i<=s-1; i++){
      int ax = i*(100+x)/100;
      int ay = i*(100+y)/100;

      for(int j=1; j<=s-1; j++){
        int bx = j*(100+x)/100;
        int by = j*(100+y)/100;

        if(ax+bx ==s){
          tmax = max(tmax, ay+by);
        }
        else if(ax+bx>s){
          break;
        }
      }
    }
    cout<<tmax<<endl;
  }
  return 0;
}



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

int main()
{
  string S;
  int count = 0, M = 0;
  cin >> S;
  int N = S.size();
  for (int i = 0; i < N; i++)
  {
    if (S.at(i) == 'A' || S.at(i) == 'C' || S.at(i) == 'G' || S.at(i) == 'T')
    {
      count++;
    }
    else
    {

      if (M < count)
      {
        M = count;
        count = 0;
      }
    }
  }
  cout << max(M, count) << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main(){
   char str[30];
   scanf("%s",str);
   int length=strlen(str);
   int i,j,flag=1;
   for(i=0;i<length;i++){
      for(j=i+1;j<length;j++){
        if(str[i]==str[j]){
            flag=0;
            break;
        }
      }
      if(flag==0)break;
   }
   if(flag)printf("yes\n");
   else printf("no\n");
   return 0;
}


Measured memory_bytes: 128
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);

		int K = scanner.nextInt();
		long answer = 0;

		for (int a = 1; a <= K; a++) {
			for (int b = 1; b <= K; b++) {
				for (int c = 1; c <= K; c++) {
					answer += gcd(gcd(a, b), c);
				}
			}
		}

		System.out.println(answer + "");
	}

	public static int gcd(int a, int b) {

		int big = Math.max(a, b);
		int small = Math.min(a, b);

		int amari = big % small;

		if (big % small == 0) {
			return small;
		}

		amari = gcd(small, amari);

		return amari;
	}
}


Measured memory_bytes: 38872
#include <cstdio>
#include <cstring>
#include <cassert>
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

#define TRACE(x) cerr << #x << " = " << x << endl
#define REP(i, n) for (int i=0; i<n; i++)
#define FOR(i, a, b) for (int i=(a); i<(b); i++)
#define _ << " " <<

typedef long long ll;
typedef pair<int, int> P;
#define X first
#define Y second

const int MAX = 1<<17;

int n, p[MAX];

int main()
{
  scanf("%d", &n);
  REP(i, n) scanf("%d", &p[i]);

  int rje = 0;
  for (int i=0; i<n; ) {
    int j = i+1, st = -1;
    for (; j<n; j++) {
      if (p[j] != p[j-1]) {
	int nst = p[j] > p[j-1];
	if (st == -1) st = nst;
	else if (st != nst) {
	  break;
	}
      }
    }
    i = j;
    rje++;
  }

  printf("%d\n", rje);

  return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define ll long long
#define MAX 500005
using namespace std;

template<typename T>
void read(T &n){
    n = 0;
    T f = 1;
    char c = getchar();
    while(!isdigit(c) && c != '-') c = getchar();
    if(c == '-') f = -1, c = getchar();
    while(isdigit(c)) n = n*10+c-'0', c = getchar();
    n *= f;
}
template<typename T>
void write(T n){
    if(n < 0) putchar('-'), n = -n;
    if(n > 9) write(n/10);
    putchar(n%10+'0');
}

int n;
ll a[MAX];
map<ll, ll> mp1, mp2;

int main()
{
    cin >> n;
    for(int i = 1; i <= n; i++){
        read(a[i]);
        if(i > 1) mp2[(ll)i-a[i]]++;
    }
    ll ans = 0;
    for(int i = 1; i <= n; i++){
        if(i > 1) mp2[(ll)i-a[i]]--;
        ans += mp2[a[i]+i]+mp1[a[i]-i];
        mp1[-a[i]-i]++;
    }
    cout << ans/2 << endl;

    return 0;
}

Measured memory_bytes: 50648
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ll i,j,k,m,n;
    cin>>n>>k;
    ll cnt=1,ans;
    for(i=1;i<=n-1;i++)
        cnt*=(k-1);
    cout<<cnt*k;
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#define _USE_MATH_DEFINES
#include <cmath>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <iomanip>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007; // 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};

struct IOSetup {
  IOSetup() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    cerr << fixed << setprecision(10);
  }
} iosetup;
/*-------------------------------------------------*/
int main() {
  int n; cin >> n;
  int ans = 0;
  FOR(i, 1, n) {
    if (n - i > i && n - i != i) ++ans;
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 256
import sys
from sys import stdin
def input(): return sys.stdin.readline().strip()
import numpy as np

N = int(input())
pn = list(map(float,input().split()))
dp = np.array([0.0] * (N+1))
dp[0] = 1.0
for i in range(N):
    tmp = dp * (1-pn[i])
    tmp[1:] += dp[:-1] * pn[i]
    dp = tmp

print(sum(dp[N // 2 +1:]))

Measured memory_bytes: 12504
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
int main(){
  vector<int> x(3);
  cin >> x.at(0) >> x.at(1) >> x.at(2);
  sort(x.begin(), x.end());
  cout << x.at(1)+x.at(0) << endl;

  return 0;
}

Measured memory_bytes: 256
def main():
    n, m = map(int, input().split())
    # 隣接するカードの枚数が奇数の時は，偶数回ひっくり返されるので表になる
    # 偶数の時は，奇数回ひっくり返されるので，裏になる．これをカウントしたい．
    # 真ん中のカードは裏になる．
    if n > m:
        n, m = m, n
    # nのほうが小さい
    if n == 1 and m == 1:
        print(1)
    elif n == 1:
        print(m - 2)
    else:
        print((n - 2) * (m - 2))



if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#define rep(i,e)for(int i=0;i<e;i++)
#define grade(a) cout << a << endl
using namespace std;

int main(){
    int i;
    int count[26];
    rep(i,26)count[i]=0;
    char s;
    while(cin >> s){
        if(!isalpha(s))continue;
        if(isupper(s)) s = tolower(s);
        count[s - 'a']++;
    }
    rep(i,26) cout << char('a'+i) << " : " << count[i] << endl;
    return 0;
}


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

#define ll long long
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define vll vector<ll>
#define vi vector<int>
#define pi pair<int,int>

using namespace std;

const string str = "ABC";

pi parse(string query)
{
  pi ret;
  if (query=="AB") ret=pi(0,1);
  if (query=="AC") ret=pi(0,2);
  if (query=="BC") ret=pi(1,2);
  return ret;
}

int main()
{
  int N; cin>>N;
  vll v(3);
  rep(i,3) cin>>v[i];
  vector<string> s(N);
  rep(i,N) cin>>s[i];
  if ((v[0]==0&&v[1]==0&&v[2]==0)){
    cout<<"No"<<endl;
    return 0;
  }
  vi ans(N);
  rep(i,N){
    int x,y;
   	tie(x,y) = parse(s[i]);
    auto select = [&](int idx){
      if (idx==x){
        ans[i] = x;
        v[x]++; v[y]--;
      }else{
        ans[i] = y;
        v[y]++; v[x]--;
      }
	};
    if (v[x]==0&&v[y]==0){
      cout<<"No"<<endl;
      return 0;
    }
    if (i<N-1 && v[x]==1&&v[y]==1){
      int nx,ny;
      tie(nx,ny) = parse(s[i+1]);
      if (nx==x||ny==x){
        select(x);
      }else{
        select(y);
      }
    }else{
      if (v[x]>v[y]){
        select(y);
      }else{
        select(x);
      }
    }
  }
  cout<<"Yes"<<endl;
  rep(i,N) cout<<str[ans[i]]<<endl;
  return 0;
}

Measured memory_bytes: 6708
#include <iostream>
using namespace std;
int main(void){
    int a,b,c,sum=0,n;
    cin >> a >> b >>c;
    //if(c/a > 7){
        for(int i=0; i<100000000; i++){
            sum=i*a+i/7*b;
            if(c<=sum){
                cout << i << endl;
                break;
            }
        }
    //}
    //else{
        //n=c/a;
        //cout << n << endl;
    //}
}



Measured memory_bytes: 3084
#include "bits/stdc++.h"
#define ll long long
#define lld long double
#define MOD 1000000007LL
#define inf 1000000000000000000ll
#define pii pair<int,int>
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define all(v) v.begin(),v.end()
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
ll power(ll x,ll y, ll md=MOD){ll res = 1;x%=md;while(y){if(y&1)res = (res*x)%md;x *= x; if(x>=md) x %= md; y >>= 1;}return res;}
 
using namespace std;

#define endl '\n'
#define int ll

struct node {
	vector<int> v,w;
};



signed main() {
	fast;

	int x;
	cin>>x;

	int n;
	cin>>n;
	vector<int> v(102,0);
	for(int i=0;i<n;i++) {
		int temp;
		cin>>temp;
		v[temp] = 1;
	}

	int ans = 0;
	for(int i=0;i<102;i++) {
		if(v[i]==0)
			if(abs(ans-x)>abs(x-i)) ans = i;
	}
	cout<<ans;

}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
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; }
typedef long long ll;
const long long INF = 1LL << 60;
typedef pair<int, int> P;
int main()
{
    ll A, V, B, W, T;
    cin >> A >> V >> B >> W >> T;

    ll dis = abs(A - B);
    ll diff = V - W;

    if (diff == 0) {
        cout << "NO" << endl;
        return 0;
    }

    ll t = (dis + diff - 1) / diff;
    if (dis == 0) cout << "YES" << endl;
    else if (t <= T && diff >= 0) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 3620
n, a, b, c = map(int, input().split())
d = {'AB': (0, 1), 'AC': (0, 2), 'BC': (1, 2)}
queries = [d[input()] for _ in range(n)]
history = []
abc = [a, b, c]
for i in range(n):
    x, y = queries[i]
    if abc[x] == 0 and abc[y] == 0:
        print('No')
        exit()
    if abc[x] == 1 and abc[y] == 1:
        if i == n - 1:
            history.append('ABC'[x])
            abc[x] += 1
            abc[y] -= 1
        elif x in queries[i + 1]:
            history.append('ABC'[x])
            abc[x] += 1
            abc[y] -= 1
        else:
            history.append('ABC'[y])
            abc[x] -= 1
            abc[y] += 1
    else:
        if abc[x] > abc[y]:
            history.append('ABC'[y])
            abc[x] -= 1
            abc[y] += 1
        else:
            history.append('ABC'[x])
            abc[x] += 1
            abc[y] -= 1
print('Yes')
print('\n'.join(history))


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

int main(){
	int n;
	cin >> n;
    int count = n;
  	double ans = 1;
  if(n != 1){
    if(n % 2 != 0){
     count = n + 1; 
    }
    int t = count / 2;
    ans = (double)t / n;
  }
	printf("%.10lf\n", ans);
}

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

#define rep(i,n) for(ll i = 0; i < n; i++)
#define per(i,n) for(ll i = n-1; i >= 0; i--)
#define REP(i,n) for(ll i = 1; i < n; i++)
#define PER(i,n) for(ll i = n; i >= 1; i--)
#define sz(x) int(x.size())
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define endl '\n'
#define fi first
#define se second
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vii = vector<vi>;
using vl = vector<ll>;
using vll = vector<vl>;
using vs = vector<string>;
using vb = vector<bool>;
using vc = vector<char>;
using vcc = vector<vc>;
using vP = vector<P>;
using vPP = vector<vP>;
using vPl = vector<Pl>;
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
const int inf = (1<<30)-1;
const ll infll = (1LL<<62)-1;
ll ceil(const ll &a, const ll &b){return ((a)+(b)-1)/b;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }



int main(){
  int n, m;
  cin >> n >> m;
  vb ac(n);
  vi wa(n);
  rep(i,m) {
    int p;
    string s;
    cin >> p >> s;
    p--;
    if(s == "AC") ac[p] = true;
    else {
      if(!ac[p]) wa[p]++;
    }
  }
  int AC = 0, WA = 0;
  rep(i,n) {
    if(ac[i]) {
      AC++;
      WA += wa[i];
    }
  }
  cout << AC << ' ' << WA << endl;
}

Measured memory_bytes: 3768
#include<stdio.h>
#include<string.h>

int main(void){
  char sentence[1050];
  int n;
  scanf("%d\n",&n);
  for(int i=0;i<n;i++){
        for(int j=0;j<1050;j++){
            sentence[j]=getchar();
            if(sentence[j]=='\n'){
                sentence[j]=0;
                break;
            }
        }
    for(int j=0;j<1025;j++){
        if(sentence[j]==0)break;
        if(!strncmp(sentence+j,"Hoshino",7)){
            sentence[j+6]='a';
        }
    }
    puts(sentence);
  }
  return 0;
    
}

Measured memory_bytes: 1012
//#pragma warning(disable : 4996)
#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>
#include<fstream>
#include<stdio.h>
#include<map>
#include<set>
#include<limits.h>
#include<list>
#include <cassert>
#include<sstream>
#include <bitset>
using namespace std;
using ll = long long int;
using uint = unsigned int;


int main() {
	ll N, A, B;
	cin >> N >> A >> B;
	ll ans;
	if
		(A > B || A != B && N < 2)ans = 0;
	else
		if (A == B) ans = 1;
		else
		{
			ans = (N - 1) * B + A - (N - 1) * A - B + 1;
		}
	cout << ans;
	return 0;
} 





Measured memory_bytes: 3604
import java.io.*;
import java.util.StringTokenizer;
import static java.lang.Math.*;

public class Main {
  public static void main(String[] args) {
    new Main().solve();
  }

  private void solve() {
    try(InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out)) {

      int n = in.nextInt();
      String ans = (n /100 == n % 10) ? "Yes" : "No";
      out.println(ans);
    }
    catch(IOException e) {
      System.err.println(e);
    }
  }

  int atoi(String s) { return Integer.parseInt(s); }
  long atol(String s) { return Long.parseLong(s); }

  static class InputReader implements AutoCloseable {
    public BufferedReader br;
    public StringTokenizer st;

    public InputReader(InputStream stream) {
      br = new BufferedReader(new InputStreamReader(stream), 32768);
      st = null;
    }

    public String nextLine() throws IOException {
      return br.readLine();
    }
    public String next() {
      if (st == null || !st.hasMoreTokens()) {
        try { st = new StringTokenizer(br.readLine());
        } catch (IOException e) {
          throw new UncheckedIOException(e);
        }
      }
      return st.nextToken();
    }
    public int nextInt() { return Integer.parseInt(next()); }
    public long nextLong() { return Long.parseLong(next()); }
    int[] mapInt(int len) {
      int[] ret = new int[len];
      for (int i = 0; i < len; i++) ret[i] = Integer.parseInt(next());
      return ret;
    }
    long[] mapLong(int len) {
      long[] ret = new long[len];
      for (int i = 0; i < len; i++) ret[i] = Long.parseLong(next());
      return ret;
    }
    @Override public void close() throws IOException { br.close(); }
  }
}

Measured memory_bytes: 21204
#include <iostream>
#include <cstdio>
#include <vector>
#include <array>
#include <chrono>
#include <numeric>
#include <algorithm>

using namespace std;

int main() {
	long long H;
	long long sum = 0;
	long long num_enemy = 1;

	cin >> H;

	while(H){
		sum += num_enemy;
		num_enemy *= 2;
		H /= 2;
	}

	cout << sum << endl;

	return 0;
}



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

int ans = 0;
long long N;
long long M;
long long Q;
std::vector<long long> a;
std::vector<long long> b;
std::vector<long long> c;
std::vector<long long> d;

void score(vector<int> &v){
    int calc = 0;
    for(int i = 0;i < Q;i++){
        if(v[b[i] - 1] - v[a[i] - 1] == c[i])calc += d[i]; 
    }
    ans = max(ans, calc);
}

void zrk(int i, vector<int> v){
    if(i == N){
        score(v);
        return;
    }
    if(i == 0){
        for(int j = 1;j <= M;j++){
            v.push_back(j);
            zrk(i + 1, v);
            v.pop_back();
        }
        return;
    }
    int uku = v.back();
    for(int j = uku;j <= M;j++){
        v.push_back(j);
        zrk(i + 1, v);
        v.pop_back(); 
    }
}

void solve(){
    zrk(0, vector<int>());
    cout<<ans<<endl;
}

int main(){
    scanf("%lld",&N);
    scanf("%lld",&M);
    scanf("%lld",&Q);
    std::vector<long long> _a(Q);a = _a;
    std::vector<long long> _b(Q);b = _b;
    std::vector<long long> _c(Q);c = _c;
    std::vector<long long> _d(Q);d = _d;
    for(int i = 0 ; i < Q ; i++){
        scanf("%lld",&a[i]);
        scanf("%lld",&b[i]);
        scanf("%lld",&c[i]);
        scanf("%lld",&d[i]);
    }
    solve();
    return 0;
}


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

void solve()
{
    int n, k;
    cin >> n >> k;
    int a[n];
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    sort(a, a + n);
    int ans = 0;
    for (int i = 0; i < k; i++)
    {
        ans += a[i];
    }
    cout << ans;
}

int main()
{
    int t = 1;
    //cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 3600
use std::io::*;
use std::str::FromStr;
use std::collections::HashMap;
use std::collections::BTreeSet;
use std::collections::HashSet;
use std::cmp;
use std::f64::consts;

fn main() {
    let height: i64 = read();
    let width: i64 = read();

    let mut count = 0;

    if height == 1 && width == 1 {
        count+=1;
    } else if height == 1 {
        count += width - 2;
    } else if width == 1{
        count += height - 2;
    } else {
        count += (height-2) * (width-2);
    }

    println!("{}", count);
}

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

// 最大公約数
fn gcd(a: i32, b: i32) -> i32 {
    match b {
        0 => a,
        _ => gcd(b, a % b)
    }
}

// 最小公倍数
fn lcm(a: i32, b: i32) -> i32 {
    a * b / gcd(a, b)
}

// 階乗
fn kaijou(n: i32)->i32 {
    if n == 1 {
        return n;
    }
    return n * kaijou(n-1);
}

Measured memory_bytes: 4352
#![allow(unused_imports)]
#![allow(unused_macros)]
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(unused_variables)]
#![allow(unused_mut)]
#![allow(unused_assignments)]
use proconio::input;
use proconio::marker::Usize1;
use std::collections::*;
use std::cmp::*;
use std::f64::consts::*;

const MOD: u64 = 1000000007;
const INF: usize = std::usize::MAX / 4;

fn main() {
    input! {
        S: String,
        T: String,
    }

    let A: Vec<char> = S.chars().collect();
    let B: Vec<char> = T.chars().collect();

    if A.len() + 1 != B.len() {
        println!("No");
        return;
    }

    for i in 0..A.len() {
        if A[i] != B[i] {
            println!("No");
            return;
        }
    }

    println!("Yes");
}


Measured memory_bytes: 2144
#pragma GCC optimize("Ofast") 
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define sz(a) a.size()
#define all(a) a.begin(),a.end()
#define lb lower_bound
#define ub upper_bound
#define owo ios_base::sync_with_stdio(0);cin.tie(0);
#define MOD (ll)(998244353)
#define INF (ll)(1e18)
#define debug(...) fprintf(stderr, __VA_ARGS__),fflush(stderr)
#define time__(d) for(long blockTime = 0; (blockTime == 0 ? (blockTime=clock()) != 0 : false);\
debug("%s time : %.4fs\n", d, (double)(clock() - blockTime) / CLOCKS_PER_SEC))
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> PII;
typedef pair<int,int> pii;
typedef vector<vector<int>> vii;
typedef vector<vector<ll>> VII;
ll gcd(ll a,ll b){if(!b)return a;else return gcd(b,a%b);}
int main()
{
	int n,q;
	cin>>n>>q;
	vector<ll>a(n+2),b(n+2);
	for(int i=0;i<=n;i++)a[i] = b[i] = n;
	ll ans = (n-2)*1LL*(n-2);
	int h,w;
	h = w = n;
	while(q--){
		int t,x;
		cin>>t>>x;
		if(t == 1){
			if(x<w){
			  for(int i=x;i<w;i++)a[i] = h;
			  w = x;
		    }
			ans-=a[x]-2;
		}else{
			if(x<h){
		       for(int i=x;i<h;i++)b[i] = w;
		       h = x;
		   }
		    ans-=b[x]-2;
		}
	}
	cout<<ans;
}


Measured memory_bytes: 6236
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <limits.h>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string>
#include <vector>
#include <cstdio>
#define ll long long
#define rep2(i,a,b) for(int i=a;i<=b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define rep3(i,a,b) for(int i=a;i>=b;i--)
#define REP(e,v) for(auto e:v)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>()>
#define pb push_back
#define vec vector<int>
#define vecll vector<ll>
#define bs binary_search
#define All(c) (c).begin(),(c).end()
#define mp make_pair
using namespace std;
int in(){int x;scanf("%d",&x);return x;}
string stin(){string s;cin>>s;return s;}
ll lin(){ll x;scanf("%lld",&x);return x;}
int main(){
    int h=in(),w=in(),n=in();
    queue<int> q;
    rep(i,n){
        int x=in();
        rep(j,x){
            q.push(i+1);
        }
    }
    rep(i,h){
        if(i%2==0){
            rep(j,w){
                cout<<q.front()<<" ";
                q.pop();
            }
        }else{
            vec a(w);
            rep3(j,w-1,0){
                a[j]=q.front();
                q.pop();
            }
            rep(j,w){
                cout<<a[j]<<" ";
            }
        }
        cout<<endl;
    }
}

Measured memory_bytes: 384
#include <stdio.h>
#include <string.h>

int main(void)
{
    int i;
    char str[100000 + 1];

    scanf("%s", str);
    int red = 0, blue = 0;
    for (i = 0; i < strlen(str); i++)
    {
        if(str[i] == '0'){
            red++;
        }else{
            blue++;
        }
    }
    printf("%d\n", red < blue ? red * 2 : blue * 2);

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S;
  cin >> S;
  if(S.at(2) == S.at (3) && S.at(4) == S.at(5)){
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
// -----------------------------------
// Author     : MatsuTaku
// Affiliation: Tokushima University
// Country    : Japan
// Date       : 04/04/2020
// -----------------------------------

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

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

  int k; cin>>k;

  struct D {
    int l;
    ll n;
    D(int l=0, ll n=0) : l(l),n(n) {}
    bool operator>(const D& x) const {return l!=x.l?l>x.l:n>x.n;}
    int d() const {
      auto c = n;
      for (int i = 0; i < l-1; i++)
        c/=10;
      return c;
    }
  };
  priority_queue<D, vector<D>, greater<>> qs;
  for (int i = 0; i < 10; i++) {
    qs.emplace(1,i);
  }
  int cnt = 0;
  vector<ll> pow_ten(64);
  pow_ten[0]=1;
  for (int i = 1; i < 64; i++)
    pow_ten[i] = pow_ten[i-1]*10;
  while (cnt < k-1) {
    auto q = qs.top(); qs.pop();
    if (q.d()!=0)
      cnt++;
    if (q.d() > 0)
      qs.emplace(q.l+1, (ll)(q.d()-1)*pow_ten[q.l]+q.n);
    qs.emplace(q.l+1, (ll)(q.d())*pow_ten[q.l]+q.n);
    if (q.d() < 9)
      qs.emplace(q.l+1, (ll)(q.d()+1)*pow_ten[q.l]+q.n);
  }
  D ans;
  while (ans.d() == 0) {
    ans = qs.top(); qs.pop();
  }
  cout << ans.n << endl;


  return 0;
}


Measured memory_bytes: 6000
#include<iostream>
using namespace std;
const long mod=998244353;
long dp[3030][3030];
int A,B,C,D;
main()
{
	cin>>A>>B>>C>>D;
	dp[A][B]=1;
	for(int i=A;i<=C;i++)for(int j=B;j<=D;j++)
		if(i-A|j-B)dp[i][j]=(dp[i-1][j]*j+dp[i][j-1]*i-dp[i-1][j-1]*(i-1)*(j-1)%mod+mod)%mod;
	cout<<dp[C][D]<<endl;
}

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

struct Edge{
    int to;
    int cost;
};
using Graph=vector<vector<Edge>>;
using P = pair<int,int>;

const int INF = 1e9;
int bfs01(int s,int t,const Graph& g){
    int n = g.size();
    vector<int> d(n,INF);
    vector<int> used(n);
    d[s]=0;
    deque<int> deq;
    deq.push_back(s);
    while(!deq.empty()){
        int v = deq.front(); deq.pop_front();
        if(used[v]) continue;
        used[v] = true;
        for(auto &e:g[v]){
            d[e.to] = min(d[e.to],d[v] + e.cost);
            if(e.cost==1) deq.push_back(e.to);
            else deq.push_front(e.to);    
        }
    }
    return d[t];
}
int main(){
    int n,m;
    cin>>n>>m;
    
    Graph g(n+2*m);
    int next_v = n;
    map<P,int> dict;
    auto vertex=[&](int pos,int c){
        if(c==-1) return pos;
        if(!dict.count({pos,c})){
            g[next_v].push_back({pos,0});
            g[pos].push_back({next_v,1});
            dict[{pos,c}]=next_v++;
        }
        return dict[{pos,c}];
    };

    for(int i=0;i<m;i++){
        int p,q,c;
        cin>>p>>q>>c;
        p--,q--,c--;
        int pv = vertex(p,c);
        int qv = vertex(q,c);
        g[pv].push_back({qv,0});
        g[qv].push_back({pv,0});
    }
    
    int ans = bfs01(0,n-1,g);
    if(ans>=INF){
        cout<<-1<<endl;
    }
    else{
        cout<<ans<<endl;
    }

    return 0;
}


Measured memory_bytes: 59648
#!/usr/bin/env python3
import sys


def solve(n: int, p: "List[int]"):
    count = 0
    for i in range(1, n-1):
        if (p[i-1] < p[i] and p[i] < p[i+1]) or (p[i-1] > p[i] and p[i] > p[i+1]):
            count += 1
    print(count)
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    n = int(next(tokens))  # type: int
    p = [ int(next(tokens)) for _ in range(n) ]  # type: "List[int]"
    solve(n, p)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
n = int(input())
s = [int(input()) for _ in range(n)]

dp = [set() for _ in range(n + 1)]
for i in range(n):
    dp[i + 1].update(dp[i])
    for x in dp[i]:
        dp[i + 1].add(x + s[i])
    dp[i + 1].add(s[i])


ans = 0
for x in dp[i + 1]:
    if x % 10 != 0:
        ans = max(ans, x)
print(ans)


Measured memory_bytes: 18932
#include<bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define REP2(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(v) (v).begin(),(v).end()
#define INF 2e9
typedef long long ll;

int main()
{
  int n,l;
  cin>>n>>l;
  vector<string> s(n);
  REP(i,n) cin>>s[i];
  sort(ALL(s));

  REP(i,n) cout<<s[i];
  cout<<endl;
  
	return 0;
}

Measured memory_bytes: 256
// #define int long long
// #define repeat(i, n) for (int i = 0; i < n; ++i)

#include <cmath> // cmath includes sqrt, abs
#include <iostream> // iostream includes cout, endl
#include <string> // string
#include <algorithm> // algorithm includes sort

#include <set>

using namespace std;

int main() {
  bool can = false;
  int num = 0;
  string S;
  int N;

  int min = 1000;
  int max = 0;
  
  int l[100];

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

  for (int i = 0; i < N; ++i) {
    if (l[i] < min) {
      min = l[i];
    }
    if (max < l[i]) {
      max = l[i];
    }
  }
  
  num = max - min;

  cout << num << endl;
  
  // if (can) cout << "Yes" << endl;
  // else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  vector<int> A(N);
  vector<int> cpy(N);
  for(int i=0;i<N;i++){
    cin >> A.at(i);
    cpy.at(i) = A.at(i);
  }
  sort(cpy.begin(),cpy.end());
  reverse(cpy.begin(),cpy.end());
  for(int i=0;i<N;i++){
    if(A.at(i)==cpy.at(0)){
      cout << cpy.at(1) << endl;
    } else if(A.at(i)!=cpy.at(0)){
      cout << cpy.at(0) << endl;
    }
  }
}

Measured memory_bytes: 3200
#include<iostream>
#include<cstring>
#include<cstdlib>
#include<cstdio>
using namespace std;
int n;
int a[210000],f[210000],ans;
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	  scanf("%d",&a[i]);
	ans=n;
	for(int i=1;i<=n;i++)
	{
	  f[a[i]]=max(1,f[a[i]-1]+1);
	  ans=min(ans,n-a[i]+a[i]-f[a[i]]);
	}
	printf("%d\n",ans);
}

Measured memory_bytes: 1792
from sys import stdin,stdout

if __name__=="__main__":
    n=int(stdin.readline())

    a=[int(x) for x in stdin.readline().split()]
    b=[int(x) for x in stdin.readline().split()]

    sm=0

    for i in range(n):
        if(a[i]>b[i]):
            sm+=a[i]-b[i]

    stdout.write(str(sm)+"\n")


Measured memory_bytes: 9064
#pragma GCC optimize("O3")
#include<bits/stdc++.h>
using namespace std;

// Begin Template IO/Utility
#define dbg(...) cerr << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__)
void dbg_out(){
	cerr<<endl;
}
template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T){
	cerr<<' '<< H; 
	dbg_out(T...);
}
template<typename T> ostream& operator<<(ostream &os, const vector<T> &V){
	for(int i=0;i<(int)V.size();i++)
		os<<V[i]<<"\n";
	return os;
}
template<typename T> istream& operator>>(istream &is, vector<T> &V){
	for(T &x:V)
		is>>x;
	return is;
}
template<typename T, typename U> ostream& operator<<(ostream &os, const pair<T,U> &p){
	os<<'{'<<p.first<<','<<p.second<<'}';
	return os;
}
template<typename T, typename U> istream& operator>>(istream &is, pair<T,U> &p){
	is>>p.first>>p.second;
	return is;
}
template<typename T> void minself(T &a, T &b){
	a=min(a,b);
}
template<typename T> void maxself(T &a, T &b){
	a=max(a,b);
}
// End Template IO/Utility
int main(){
	cin.tie(0),cin.sync_with_stdio(0),cout.tie(0),cout.sync_with_stdio(0);
	int n;
	cin>>n;
	vector<int> ans(n);
	int tmp;
	for(int i=0;i<n-1;i++){
		cin>>tmp;
		ans[tmp-1]++;
	}
	cout<<ans;
}


Measured memory_bytes: 3988
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<cstring>
#include<math.h>
#include<bitset>
#include<queue>
#include<set>
#include<iomanip>
#include<math.h>
#include<assert.h>
// #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long int INFLL = 1001001001001001LL;
constexpr int INFI = 1000000007;
const int mod = 1000000007;


int main(){
  int N,K;
  cin >> N >> K;
  vector<bool> D(15,false);
  for(int i=0; i<K; i++){
    int d;
    cin >> d;
    D[d] = true;
  }
  int ans;
  for(int i=1; i<100000; i++){
    if(i>=N){
      bool can=true;
      int T=i;
      while(T>0){
        if(D[T%10]){
          can = false;
          break;
        }
        T /= 10;
      }
      if(can){
        ans = i;
        break;
      }
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007
#define EPS 1e-10
#define MAX_N 20000
#define MAX_M 16

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;
typedef pair<P, char> PC;

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007
#define EPS 1e-10
#define MAX_N 20000
#define MAX_M 16

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;
typedef pair<P, char> PC;

int m, n, t, y;
double r, x, s;

int main(){
	cin >> m;
	while (m--){
		int ans = -1;
		cin >> s >> y >> n;
		REP(i, n){
			cin >> t >> r >> x;
			double money = s;
			if (t == 0){
				int sum = 0;
				REP(i, y){
					sum += (int)(money*r);
					money -= x;
				}
				money += sum;
			}
			else{
				REP(i, y){
					money = money + (int)(money*r) - x;
				}
			}
			ans = max(ans, (int)money);
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 1232
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 100000000000000000



int main(){
	
	int N;
	cin>>N;
	
	for(int i=0;i<100;i++){
		for(int j=0;j<100;j++){
			if(i*4+j*7==N){
				cout<<"Yes"<<endl;
				return 0;
			}
		}
	}
	
	cout<<"No"<<endl;
	
    return 0;
}


Measured memory_bytes: 256
n = int(input())
p = list(map(int, input().split()))
ans = 0
for i in range(1,n-1):
    if p[i] > p[i-1] and p[i] < p[i+1] or p[i] < p[i-1] and p[i] > p[i+1]:
        ans += 1
print(ans)

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

using namespace std;

const int maxN = 18;
const int maxM = 1 << maxN;

int N, M;
int A[maxM];
int f[maxM];
int g[maxM];
int h[maxM][maxN];

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

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

	for (int s = 0; s < M; s++) {
		g[s] = A[s];
		for (int b = 0; b < N; b++) {
			if (s >> b & 1) {
				g[s] = max(g[s], g[s & ~(1 << b)]);
				h[s][b] = max(h[s][b], A[s]);
			}
			for (int c = 0; c < N; c++) {
				if (s >> c & 1)
					h[s][b] = max(h[s][b], h[s & ~(1 << c)][b]);
			}
		}
	}

	for (int s = 1; s < M; s++) {
		f[s] = max(f[s], f[s - 1]);
		for (int b = 0; b < N; b++) {
			if (~s >> b & 1)
				continue;
			int t = s & ~(1 << b);
			f[s] = max(f[s], f[t]);
			f[s] = max(f[s], g[t] + h[s][b]);
		}
	}

	for (int i = 1; i < M; i++)
		cout << f[i] << '\n';

	return 0;
}


Measured memory_bytes: 24576