akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define ll long long int
#define ld long double
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);

	int n;
	cin>>n;

	int a[n][3];

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

			//cout<<a[i][j]<<" ";
			
			
		}
		//cout<<endl;
	}
	cout<<max({a[n-1][0],a[n-1][1],a[n-1][2]});
	

}

Measured memory_bytes: 1408
#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(x) begin(x),end(x)

#define forn(i, n) for (int i = 0; i < n; ++i)
#define rforn(i, n) for (int i = n - 1; i >= 0; --i)

const int N = 2e5 + 5, M = 998244353;
const int dx[]{0, 1, 0, -1}, dy[]{1, 0, -1, 0};
const ll INF = 1e18 + 10LL;
const ld PI = 4.0 * atan((ld) 1.0), EPS = 1e-6;
const char nl = '\n';

template <typename T> inline T gcd(T a, T b) { return b == 0 ? a : gcd(b, a % b); }
template <typename T> inline T lcm(T a, T b) { return a / gcd(a, b) * b; }
template <class T> void ckmin(T& a, T b) { a = min(a, b); }
template <class T> void ckmax(T& a, T b) { a = max(a, b); }
template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

string YN(bool x) { return x ? "YES" : "NO"; }

ll pow(ll b, ll e, ll m = 0LL, ll ans = 1LL) { while (e) { if (e & 1LL) { ans *= b; if (m) ans %= m; } b *= b, e >>= 1LL; if (m) b %= m; } return ans; }

ll dp[3001][3001];

void solve(int tcn) {
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	dp[a][b] = 1LL;
	for (int i = 1; i <= c; ++i) {
		for (int j = 1; j <= d; ++j) {
			dp[i][j] += (j * dp[i-1][j]) % M;
			dp[i][j] %= M;
			dp[i][j] += (i * dp[i][j-1]) % M;
			dp[i][j] %= M;
			dp[i][j] -= (i - 1) * (j - 1) % M * (dp[i - 1][j - 1]) % M;
			dp[i][j] %= M;
			if (dp[i][j] < 0)
				dp[i][j] += M;
		}
	}
	cout << dp[c][d] << nl;
}

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

	int t = 1; //cin >> t;
	for (int i = 1; i <= t; ++i) {
		solve(i);
	}
	return 0;
}


Measured memory_bytes: 73920
#include<iostream>
using namespace std;
int main(){
	string s;
	int x;
	cin>>x>>s;
	if(s.size()%2==1){
		cout<<"No"<<endl;
		return 0;
	}
	for(int i=0;i<s.size()/2;++i)
		if(s[i]!=s[i+s.size()/2]){
			cout<<"No"<<endl;
			return 0;
		}
	cout<<"Yes"<<endl;
	return 0;
}

Measured memory_bytes: 256
package main

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

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

// Arithmetic
func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

func ceil(a, b int) int {
	if a%b == 0 {
		return a / b
	} else {
		return a/b + 1
	}
}

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

func lcm(a, b int) int {
	return a / gcd(a, b) * b
}

// Sort
type RuneSlice []rune

func (a RuneSlice) Len() int           { return len(a) }
func (a RuneSlice) Less(i, j int) bool { return a[i] < a[j] }
func (a RuneSlice) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

// Main
const MOD = int(1e+9) + 7
const INF = 1 << 60

func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	defer wtr.Flush()
	X, Y, Z, K := sc.nextInt(), sc.nextInt(), sc.nextInt(), sc.nextInt()
	A := sc.nextIntSlice(X)
	B := sc.nextIntSlice(Y)
	C := sc.nextIntSlice(Z)
	AB := []int{}
	for i := 0; i < X; i++ {
		for j := 0; j < Y; j++ {
			AB = append(AB, A[i]+B[j])
		}
	}
	sort.Sort(sort.Reverse(sort.IntSlice(AB)))
	sort.Sort(sort.Reverse(sort.IntSlice(C)))
	D := []int{}
	for i := 0; i < min(K, X*Y); i++ {
		for j := 0; j < min(K, Z); j++ {
			D = append(D, AB[i]+C[j])
		}
	}
	sort.Sort(sort.Reverse(sort.IntSlice(D)))
	for i := 0; i < K; i++ {
		fmt.Fprintln(wtr, D[i])
	}
}


Measured memory_bytes: 93184
package main

import (
	"fmt"
	"regexp"
)

func main() {
	var S string
	fmt.Scan(&S)
	r := regexp.MustCompile(`^(eraser|erase|dreamer|dream)+$`)
	if r.MatchString(S) {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}


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

int main() {
	int n;
	cin >> n;
	string s;
	cin >> s;
	int r=0, g=0, b=0;
	for (char c : s) {
		if (c == 'R') ++r;
		else if (c == 'G') ++g;
		else if (c == 'B') ++b;
	}
	long long ans = (long long)r * g * b;
	for (int i = 0; i < n; i++) {
		for (int j = i+1; j < n; j++) {
			int k = 2*j - i;
			if (k < n) {
				if (s[i] != s[j] && s[j] != s[k] && s[i] != s[k]) ans--;
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3624
#include <iostream>
#include <cstdio>

using namespace std;

static const int N = 100;
static int M[N + 1][N + 1] = {}, p[N + 1] = {};

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

  int number, count, value;
  for (int i = 0; i < n; i++) {
    cin >> number >> count;
//    printf("n = %d, number = %d, count = %d\n", n, number, count);
    for (int j = 0; j < count; j++) {
     cin >> value;
//     printf("value = %d.\n", value);
     M[number - 1][value - 1] = 1; 
    }
  }

  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {    
      if (j != 0) {
        cout << " ";
      }
      cout << M[i][j];
    } 
    cout << endl;
  }

  return 0;
}



Measured memory_bytes: 3140
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace C
{
    // 全Nケース MケースでTLE
    // M ... 1900ms 0.5でac, N - M ... 100ms ac

    class Program
    {
        static readonly int acTime = 100;
        static readonly int tleTime = 1900;
        static void Main(string[] args)
        {
            var nm = Console.ReadLine().Split(' ')
                .Select(s => int.Parse(s)).ToList();
            var N = nm[0];
            var M = nm[1];
            var oneTime = (N - M) * acTime + M * tleTime;
            int itr = (int)Math.Pow(2, M);
            Console.WriteLine(oneTime * itr);
        }
    }
}

Measured memory_bytes: 13268
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
#define pb push_back
#define mpr make_pair
#define pii pair<int, int>
#define pll pair<ll, ll>
#define ll long long
#define ld long double
#define fi first
#define se second
#define all(arr) arr.begin(), arr.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define fo(i, l, r) for (int i = l; i <= r; i++)
#define INF 1000000001
#define inf1 1000000000000000001
#define MOD 1000000007
#define mod 1000000007
#define pie 3.14159265358979323846264338327950L
#define N 200009
#define M 2000009
#define mid(l, r) l + (r - l) / 2
#define vec vector<int>
#define umap unordered_map<int, int>
#define yes cout << "Yes" << endl;
#define no cout << "No" << endl;
#define endl "\n"
#define int long long
using namespace std;
 
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};  
int ddx[8]={1,1,0,-1,-1,-1,0,1},ddy[8]={0,1,1,1,0,-1,-1,-1};
ll gcd(ll a,ll b){ if(!a)return b;return gcd(b%a,a);}
ll lcm(ll a, ll b) { return (a*b)/ gcd(a,b);}



void test_case()
{
  int n;
  cin>>n;

  bool check = false;
  int prev = 0;
  for(int i=0; i<n; i++) {
    int x, y;
    cin>>x>>y;

    if( x == y) {
      prev++;
    } else {
      prev = 0;
    }

    if(prev >= 3) {
      check = true;
    }
  }

  if(check) {
    yes;
  } else {
    no;
  }

}
 
signed main ()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cout << fixed << setprecision(20);
 
    //  freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
 
    int t = 1;
    // cin >> t;
    while (t--)
    {
        test_case();
    }
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;

template<unsigned P> struct ModInt {
  using M = ModInt;
  unsigned v;
  constexpr ModInt() : v(0) {}
  constexpr ModInt(auto x) : v(x >= 0 ? x % P : (P - -x % P) % P) {}
  constexpr ModInt(unsigned v, int) : v(v) {}
  static constexpr unsigned p() { return P; }
  M operator+() const { return *this; }
  M operator-() const { return {v ? P - v : 0, 0}; }
  explicit operator bool() const noexcept { return v; }
  bool operator!() const noexcept { return !(bool)*this; }
  M operator*(M r) const { return M(*this) *= r; }
  M operator/(M r) const { return M(*this) /= r; }
  M operator+(M r) const { return M(*this) += r; }
  M operator-(M r) const { return M(*this) -= r; }
  bool operator==(M r) const { return v == r.v; }
  bool operator!=(M r) const { return !(*this == r); }
  M& operator*=(M r) { v = (uint64_t)v * r.v % P; return *this; }
  M& operator/=(M r) { return *this *= r.inv(); }
  M& operator+=(M r) { if ((v += r.v) >= P) v -= P; return *this; }
  M& operator-=(M r) { if ((v += P - r.v) >= P) v -= P; return *this; }
  M inv() const {
    int a = v, b = P, x = 1, u = 0;
    while (b) {
      int q = a / b;
      swap(a -= q * b, b);
      swap(x -= q * u, u);
    }
    assert(a == 1);
    return x;
  }
  M pow(auto n) const {
    if (n < 0) return pow(-n).inv();
    M res = 1;
    for (M a = *this; n; a *= a, n >>= 1) if (n & 1) res *= a;
    return res;
  }
  friend M operator*(auto l, M r) { return M(l) *= r; }
  friend M operator/(auto l, M r) { return M(l) /= r; }
  friend M operator+(auto l, M r) { return M(l) += r; }
  friend M operator-(auto l, M r) { return M(l) -= r; }
  friend ostream& operator<<(ostream& os, M r) { return os << r.v; }
  friend istream& operator>>(istream& is, M& r) { lint x; is >> x; r = x; return is; }
  friend bool operator==(auto l, M r) { return M(l) == r; }
  friend bool operator!=(auto l, M r) { return !(l == r); }
};
using Mint = ModInt<998244353>;

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  int n; cin >> n;
  string s; cin >> s;
  const string t = "RGB";

  Mint res = 1;
  V<> a(8);
  for (char c : s) {
    int i = t.find(c);
    [&]() -> void {
      if (a[7 ^ 1 << i]) {
        res *= a[7 ^ 1 << i]--;
        return;
      }
      for (int j = 0; j < 3; ++j) if (j != i and a[1 << i | 1 << j]) {
        if (a[1 << j]) {
          res *= a[1 << j]--;
          ++a[1 << i | 1 << j];
        } else {
          ++a[1 << i];
        }
        return;
      }
      for (int j = 0; j < 3; ++j) if (j != i) {
        if (a[1 << j]) {
          res *= a[1 << j]--;
          ++a[1 << i | 1 << j];
          return;
        }
      }
      ++a[1 << i];
    }();
  }

  for (int i = 0; i < n; ++i) {
    res *= i + 1;
  }
  cout << res << '\n';
}

Measured memory_bytes: 720
if isfile("mystdin.txt");mystdin=open("mystdin.txt","r");redirect_stdin(mystdin);end
pI(x)=parse(Int,x)
pM(x::Array{SubString{String},1})=map(pI,x)
function kakuketanowa(n::Int)
  s=string(n)
  S=0
  for i=s
    S+=parse(Int,i)
  end
  return S
end 
function main()
  n,a,b=pM(split(readline()))
  ans=0
  for i=1:n
    if a<=kakuketanowa(i)<=b
      ans+=i
    end
  end
  println(ans)
end
main()
if isdefined(Base, :mystdin);close(mystdin);end

Measured memory_bytes: 165412
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
const int inf = 1e9 + 7;
const ll INF = 1e18;
const int mod = 1000000007;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<typename T> T pow(T a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
ll modpow(ll a, int b, int _mod) { return b ? modpow(a * a % _mod, b / 2, _mod) * (b % 2 ? a : 1) % _mod : 1; }
template<class T> ostream& operator << (ostream& os, const vector<T>& vec) { for (auto &vi: vec) os << vi << " "; return os; }
template<class T, class U> ostream& operator << (ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; return os; }
template<typename T >inline istream& operator >> (istream& is, vector<T>& v) { rep(j, sz(v)) is >> v[j]; return is; }
template<class T> inline void add(T &a, int b) { a += b; if (a >= mod) a -= mod; }



void solve();

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout << fixed << setprecision(10);
    
    int T;
    // cin >> T;
    T = 1;
    
    while (T--) {
        solve();
    }
}



vector<int> rolling_hash(vector<int> a, vector<int> b) {
    typedef unsigned long long ull;
    ull B = 1000000007;
    
    
    
    ull ah = 0, t = 1;
    rep(j, sz(a)) t *= B;
    rep(j, sz(a)) {
        ah = ah * B + a[j];
    }
    
    ull bh = 0;
    rep(j, sz(a)) bh = bh * B + b[j];
    
    vector<ull> bhs;
    rep(i, sz(b)) {
        bhs.eb(bh);
        bh = bh * B - b[i] * t + b[i + sz(a)];
    }
    
    vector<int> ret;
    rep(i, sz(a)) if (ah == bhs[i]) ret.eb(i);
    return ret;
}
// youtube editorial
void solve() {
    /*
     a を k shift
     s とする
     
     si ^ x = bi
     x = si ^ bi
     
     si ^ bi = si+1 ^ bi+1
     bi = si ^ si+1 ^ bi+1
     bi ^ bi+1 = si ^ si+1
     
     s' = si ^ si+1
     b' = bi ^ bi+1
     s' = b'
     
     ここで, s は a から a' にするのにおいて ^ x してないが
     s' においては等しくなる
     s' = (si ^ x) ^ (si+1 ^ x)
     = ai' ^ ai+1'
     */
    
    int n;
    cin >> n;
    vector<int> a(n);
    cin >> a;
    vector<int> b(n);
    cin >> b;
    
    vector<int> c(n), d(n);
    rep(i, n) {
        c[i] = a[i] ^ a[(i + 1) % n];
        d[i] = b[i] ^ b[(i + 1) % n];
    }
    rep(i, n) c.push_back(c[i]);
    auto v = rolling_hash(d, c);
    rep(i, sz(v)) {
        cout << v[i] << " ";
        cout << (a[(0 + v[i]) % n] ^ b[0]) << endl;
    }
}



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

using namespace std;

typedef long long ll;

const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = (ll)1e9 + 7;

int main()
{
  int N; scanf("%d", &N);
  ll ans = 1;
  for (int i = 1; i <= N; ++i) {
    ans = (ans * i) % MOD;
  }
  printf("%lld\n", ans);
  return 0;
}


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

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    vector<int> arr(n);
    for(int i = 0; i < n; ++i) {
        cin >> arr[i];
        if(i == 0 || arr[i] > arr[i-1]) --arr[i];
    }
    for(int i = 1; i < n; ++i) {
        if(arr[i] < arr[i-1]) {
            cout << "No\n";
            return 0;
        }
    }
    cout << "Yes\n";
}


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

typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef vector<vector<long long>> VVL;
typedef pair<int,int> P;
typedef tuple<int,int,int> tpl;

#define ALL(a)  (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define EXIST(m,v) (m).find((v)) != (m).end()
#define LB(a,x) lower_bound((a).begin(), (a).end(), x) - (a).begin()
#define UB(a,x) upper_bound((a).begin(), (a).end(), x) - (a).begin()

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);--i)
#define RREP(i,n) RFOR(i,n,0)

#define en "\n"

constexpr double EPS = 1e-9;
constexpr double PI  = 3.1415926535897932;
constexpr int INF = 2147483647;
constexpr long long LINF = 1LL<<60;
constexpr long long MOD = 1000000007; // 998244353;

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

void Main(){
    int H,W; cin >> H >> W;
    int ch,cw,dh,dw; cin >> ch >> cw >> dh >> dw;
    ch--;cw--;dh--;dw--;

    char S[H][W]; REP(i,H)REP(j,W) cin >> S[i][j];
    int d[H][W]; REP(i,H)REP(j,W) d[i][j] = INF;

    vector<P> dir{P(0,1),P(0,-1),P(1,0),P(-1,0)};

    deque<P> q; q.emplace_back(ch*W+cw,0);
    while(!q.empty()){
        P p = q.front(); q.pop_front();
        int loc = p.first, cost = p.second;
        int x = loc/W, y = loc%W;

        if(!chmin(d[x][y], cost)) continue;

        for(auto& v : dir){
            int s = x+v.first, t = y+v.second;
            if(s<0||t<0||s>=H||t>=W) continue;
            if(S[s][t] == '#') continue;

            if(cost < d[s][t]) q.emplace_front(s*W+t,cost);
        }

        for(int i=-2; i<3; ++i)for(int j=-2; j<3; ++j){
            int s = x+i, t = y+j;
            if(s<0||t<0||s>=H||t>=W) continue;
            if(S[s][t] == '#') continue;

            if(cost < d[s][t]) q.emplace_back(s*W+t,cost+1);
        }
    }

    int ans = d[dh][dw];
    cout << (ans<INF ? ans : -1) << en;
    return;
}

int main(void){
    cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);cout<<fixed<<setprecision(15);
    int t=1; //cin>>t;
    REP(_,t) Main();
    return 0;
}

Measured memory_bytes: 8928
using System;
using System.Linq;
using System.Collections;
					
public class Program
{
	public static void Main()
	{
		string s = Console.In.ReadLine();
		Stack q = new Stack();
		Stack p = new Stack();
		
		foreach(char c in s)
		{
			if(c!='B')
				q.Push(c);
			else if (q.Count>0)
				q.Pop();
		}
		while(q.Count>0)
		{
			p.Push(q.Pop());
		}
		while(p.Count>0)
		{
			Console.Write(p.Pop());
		}
		Console.WriteLine();
	}
}

Measured memory_bytes: 2904
#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl '\n'
#define INF (1LL<<59)
#define ff first
#define ss second
#define mod 998244353
#define pb push_back
#define mp make_pair
#define int long long
#define all(a) a.begin(), a.end()
#define inf (1LL<<61)
#define ull unsigned long long
#define debug1(x) cerr << #x << ": " << x <<'\n'
#define debug2(x, y) cerr << #x << ": " << x << '\t' << #y << ": " << y <<'\n'
#define debug3(x, y, z) cerr << #x << ": " << x << '\t' << #y << ": " << y << '\t' << #z << ": " << z <<'\n'
using namespace std;
int dx[]={1,0,-1,0};int dy[]={0,1,0,-1}; //4 Direction
//int dx[]={1,1,0,-1,-1,-1,0,1};int dy[]={0,1,1,1,0,-1,-1,-1};//8 direction
int gcd(int x,int y)
{
    if(y==0)
        return x;
    else
        return gcd(y,x%y);
}
int expo(int n,int m,int p)   //modULAR EXPONENTIATION
{
    int r=1;
    n=n%p;
    while(m>0)
    {
        if(m%2)
            r=(r*n)%p;
        n=(n*n)%p;
        m=m/2;
    }
    return r%p;
}
bool isPrime(int n)
{
    // Corner cases
    if (n <= 1)  return false;
    if (n <= 3)  return true;
 
    // This is checked so that we can skip 
    // middle five numbers in below loop
    if (n%2 == 0 || n%3 == 0) return false;
 
    for (int i=5; i*i<=n; i=i+6)
        if (n%i == 0 || n%(i+2) == 0)
           return false;
 
    return true;
}
int32_t main()
{
   IOS;
  /* #ifndef ONLINE_JUDGE
   freopen("input.txt","r",stdin); 
   freopen("output.txt","w",stdout);
   #endif 
   /********************* Code starts here ***********************/   
   // int n,ans=inf;
   // cin>>n;
   // vector<int>a(n);
   // for(int i=0;i<n;i++)
   // {
   // 	cin>>a[i];
   // }
   int n;
   cin>>n;
   vector<int>a(n),b(n);
   for(int i=0;i<n;i++)
   {
   	cin>>a[i];
   	b[i]=a[i];
   }
   sort(all(b));
   for(int i=0;i<n;i++)
   {
   	if(a[i]==b[n-1])
   	{
   		cout<<b[n-2]<<endl;
   	}
   	else
   	{
   		cout<<b[n-1]<<endl;
   	}
   }
}	

Measured memory_bytes: 4736
import sys
readline = sys.stdin.readline
from operator import or_
class Segtree:
    def __init__(self, A, intv, initialize = True, segf = max):
        self.N = len(A)
        self.N0 = 2**(self.N-1).bit_length()
        self.intv = intv
        self.segf = segf
        if initialize:
            self.data = [intv]*self.N0 + A + [intv]*(self.N0 - self.N)
            for i in range(self.N0-1, 0, -1):
                self.data[i] = self.segf(self.data[2*i], self.data[2*i+1]) 
        else:
            self.data = [intv]*(2*self.N0)
        
    def update(self, k, x):
        k += self.N0
        self.data[k] = x
        while k > 0 :
            k = k >> 1
            self.data[k] = self.segf(self.data[2*k], self.data[2*k+1])
    
    def query(self, l, r):
        L, R = l+self.N0, r+self.N0
        s = self.intv
        while L < R:
            if R & 1:
                R -= 1
                s = self.segf(s, self.data[R])
            if L & 1:
                s = self.segf(s, self.data[L])
                L += 1
            L >>= 1
            R >>= 1
        return s
    
    def binsearch(self, l, r, check, reverse = False):
        L, R = l+self.N0, r+self.N0
        SL, SR = [], []
        while L < R:
            if R & 1:
                R -= 1
                SR.append(R)
            if L & 1:
                SL.append(L)
                L += 1
            L >>= 1
            R >>= 1
        
        if reverse:
            for idx in (SR + SL[::-1]):
                if check(self.data[idx]):
                    break
            else:
                return -1
            while idx < self.N0:
                if check(self.data[2*idx+1]):
                    idx = 2*idx + 1
                else:
                    idx = 2*idx
            return idx - self.N0
        else:
            for idx in (SL + SR[::-1]):
                if check(self.data[idx]):
                    break
            else:
                return -1
            while idx < self.N0:
                if check(self.data[2*idx]):
                    idx = 2*idx
                else:
                    idx = 2*idx + 1
            return idx - self.N0
def popcount(i):
    assert 0 <= i < 0x100000000
    i = i - ((i >> 1) & 0x55555555)
    i = (i & 0x33333333) + ((i >> 2) & 0x33333333)
    return (((i + (i >> 4) & 0xF0F0F0F) * 0x1010101) & 0xffffffff) >> 24


N = int(readline())
S = []
for s in readline().strip():
    S.append(1<<(ord(s) - 97))
Q = int(readline())
T = Segtree(S, 0, initialize = True, segf = or_)
Ans = []
for _ in range(Q):
    ty, x, y = readline().strip().split()
    ty = int(ty)
    x = int(x) - 1
    if ty == 1:
        k = 1<<(ord(y) - 97)
        T.update(x, k)
    else:
        y = int(y)
        Ans.append(popcount(T.query(x, y)))
print('\n'.join(map(str, Ans)))


Measured memory_bytes: 93640
k = int(input())
 
even_list = []
odd_list = []
 
is_odd = True
for j in range(1, k + 1):
    if is_odd:
        odd_list.append(j)
    else:
        even_list.append(j)
    is_odd = not is_odd
 
print(int(len(even_list) * len(odd_list)))

Measured memory_bytes: 2940
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <bitset>
#include <map>
#include <tuple>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <numeric>
#include <utility>
#include <iterator>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <ctime>
#include <cassert>
#include <random>
#include <cstring>


#define rep(i,n) for(int i=0;i<int(n);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back

using namespace std;
using ll = long long;

const ll mod = 1000000007;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int ddx[8]={-1,-1,0,1,1,1,0,-1};
int ddy[8]={0,1,1,1,0,-1,-1,-1};
bool debug=false;

/*---------------------------------------------------*/

#define int long long

struct UnionFind
{
  vector< int > data;

  UnionFind(int sz)
  {
    data.assign(sz, -1);
  }

  bool unite(int x, int y)
  {
    x = find(x), y = find(y);
    if(x == y) return(false);
    if(data[x] > data[y]) swap(x, y);
    data[x] += data[y];
    data[y] = x;
    return(true);
  }

  int find(int k)
  {
    if(data[k] < 0) return(k);
    return(data[k] = find(data[k]));
  }

  int size(int k)
  {
    return(-data[find(k)]);
  }
};


signed main(){
  int N, M;
  cin >> N >> M;
  vector<int> data(N + 1, 0), A(M), B(M);
  for(int i = 0; i < M; i++){
    cin >> A[i] >> B[i];
  }

  vector<ll> ans(M);
  UnionFind uni(10000000);
  ans[M - 1] = N * (N - 1) / 2;
  for(int i = M - 1; i >= 1; i--){
    ans[i - 1] = ans[i];
    if(uni.find(A[i]) != uni.find(B[i])){
      ans[i - 1] -= uni.size(A[i]) * uni.size(B[i]);
      uni.unite(A[i], B[i]);
    }
  }

  for(int i = 0; i < M; i++){
    cout << ans[i] << endl;
  }
  return 0;
}

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

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

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define FORR(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)

#define DEBUG(x) cout << #x << ": " << (x) << endl
#define DEBUG_VEC(v)                               \
  cerr << #v << ": ";                              \
  REP(__i, (v).size()) cerr << ((v)[__i]) << ", "; \
  cerr << endl
#define PRINT(x) cout << x << endl
#define all(x) x.begin(), x.end()
#define MM << " " <<
int main() {
  ll a, b, n;

  cin >> a >> b >> n;

  // floor(ax/b) - a*floor(x/b) を最大化

  //   for (int x = 0; x <= n; x++) {
  //     cout << x << " : " << (a * x / b) << "-" << a * (x / b) << " = "
  //          << (a * x / b) - a * (x / b) << endl;
  //   }

  // A>B 周期A
  // A<B 周期B？
  // 単調増加である
  // BもしくはAを超えない最大の


  ll ans = 0;

  for (ll x = max(0LL, n - 100); x <= n; x++) {
    if (x > n) continue;
    ans = max(ans, (a * x / b) - a * (x / b));
  }

  for (ll x = max(0LL, b - 100); x <= b+10; x++) {
    if (x > n) continue;
    ans = max(ans, (a * x / b) - a * (x / b));
  }

  for (ll x = max(0LL, a - 100); x <= a+10; x++) {
    if (x > n) continue;
    ans = max(ans, (a * x / b) - a * (x / b));
  }

  cout << ans << endl;
}


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


int main()
{
  int n, k;
  cin >> n >> k;
  vector<bool> arr(n, false);
  rep(i, k)
  {
    int d;
    cin >> d;
    rep(j, d)
    {
      int a;
      cin >> a;
      arr[a - 1] = true;
    }
  }
  int ans = 0;
  rep(i, n)
    if (!arr[i])
      ans++;
  printf("%d\n", ans);
  return 0;
}

Measured memory_bytes: 3732
import sys
import math
input = sys.stdin.readline


def main():
    MOD = 10 ** 9 + 7
    sc = Scan()
    n, m = sc.intarr()
    w = sc.intarr_ver(m)
    is_safe = [True] * (n+2)
    for a in w:
        is_safe[a + 1] = False
    dp = [0] * (n+2)
    dp[1] = 1
    for i in range(2, n+2):
        if is_safe[i]:
            dp[i] = dp[i-1] + dp[i-2]
            dp[i] %= MOD
        else:
            dp[i] = 0

    print(dp[n+1])


class Scan():

    def intarr(self):
        line = input()
        array = line.split(' ')
        num_array = [int(n) for n in array]
        return num_array

    def intarr_ver(self, n):
        return [int(input()) for _ in range(n)]

    def strarr(self):
        line = input()
        array = line.split(' ')
        array[-1] = array[-1].strip('\n')
        return array


main()


Measured memory_bytes: 8616
#include <bits/stdc++.h>
typedef long long ll;
#define ALL(l)  (l).begin(),(l).end()
#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
using namespace std;

//const ll mod =  1000000007;
//const ll maxn = 1000000000;

//---------------------------------------------------------------------------------------------------
using vi = vector<int>; // intの1次元の型に vi という別名をつける
using vll = vector<ll>; // intの1次元の型に vi という別名をつける
using vvll = vector<vll>; // intの2次元の型に vvi という別名をつける
using vs = vector<string>; // stringの1次元の型に vs という別名をつける
using pll = pair<ll, ll>; // これ以降 pii という型名はpair<ll, ll> と同じ意味で使える
//---------------------------------------------------------------------------------------------------


int main() {
   int n;
   cin>>n;
   vi ans(n,-1);
   vi g[n];
   rep(i,n){
       int h,k;
       cin>>h>>k;
       rep(j,k){
           int t;
           cin>>t;
           //cout<<i<<" "<<t-1<<endl;
           g[i].push_back(t-1);
       }
   }
  
   ans.at(0)=0;
   queue<int> q ;
   q.push(0);
   
   while(!q.empty()){
      int from=q.front();
      q.pop();
      for(int to : g[from]){
          if(ans.at(to)!=-1)continue;
          ans.at(to)=ans.at(from)+1;
          q.push(to);
      }
   }
   rep(i,n){
       cout<<i+1<<" "<<ans.at(i)<<endl;
   }
}



Measured memory_bytes: 3164
#include <math.h>

#include <algorithm>
#include <cstring>
#include <iostream>
#include <numeric>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
using ll = long long;

int main() {
  int n;
  cin >> n;
  vector<ll> h(n);
  rep(i, n) cin >> h.at(i);
  int count = 0;
  int temp = 0;
  for (int i = 0; i < n - 1; i++) {
    if (h.at(i + 1) <= h.at(i)) {
      count++;
    } else {
      temp = max(count, temp);
      count = 0;
    }
  }
  cout << max(temp, count);
  return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int n,q,a,b,c;
main(){
	cin>>n;
	vector<int>v(n);
	for(int i=0;i<n;i++)cin>>v[i];
	cin>>q;
	while(q--){
		cin>>a>>b;
		reverse(v.begin()+a,v.begin()+b);
	}
	for(int i=0;i<n;i++){
		if(i)cout<<' ';
		cout<<v[i];
	}
	cout<<endl;
}


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

using namespace std;

int main(){
  long long n, k, x[50], y[59];
  vector<long long> X, Y;
  cin >> n >> k;
  for(int i=0;i<n;i++){
    cin >> x[i] >> y[i];
    X.push_back(x[i]);
    Y.push_back(y[i]);
  };
  sort(X.begin(), X.end());
  sort(Y.begin(), Y.end());
  unsigned long long mn=(2e9)*(2e9);
  for(int xn=0; xn<n;xn++){
    for(int xx=xn+1;xx<n;xx++){
      for(int yn=0;yn<n;yn++){
        for(int yx=yn+1;yx<n;yx++){
          int cnt=0;
          for(int i=0;i<n;i++){
            if(X[xn]<=x[i]&&x[i]<=X[xx]&&Y[yn]<=y[i]&&y[i]<=Y[yx])cnt++;
          }
          long long square=(X[xx]-X[xn])*(Y[yx]-Y[yn]);
          if(cnt>=k && mn>square){
            mn = square;
            // cout << mn << ' ';
            // cout << X[xn] << ' ' << X[xx] << ' ';
            // cout << Y[yn] << ' ' << Y[yx] << endl;
          }
        }
      }
    }
  }
  cout << mn << endl;
}



Measured memory_bytes: 3612
<?php
  
fscanf(STDIN, "%d %d %d", $L, $R, $d);

$d_count = 0;
for ($i=1;$i<200;$i++) {
  $d_d = $d * $i;
  if ($d_d >= $L && $d_d <=$R) {
   	$d_count++; 
  }
  
  if ($d_d > $R){
    break; 
  }
}

echo($d_count);

Measured memory_bytes: 16152
#include <iostream>
#include <string>
#include <vector>
#include <numeric>
#include <algorithm>
#include <set>
#include <cmath>
#include <iomanip>
#define REP(i, n) for(int i=0; i<n; i++)
#define REPR(i, n) for(int i=n; i>=0; i--)
#define FOR(i, m, n) for(int i=m; i<n; i++)
#define FORR(i, m, n) for(int i=m; i>=n; i--)
#define INF 999999999
#define ll long long
#define VSORT(v) sort(v.begin(), v.end())
#define pb(a) push_back(a)
using namespace std;

#ifdef INPUT
#include <sstream>
stringstream input(R"(
7 3
)");
#define cin input
#endif

int main()
{
	int n, k;
	cin >> n >> k;

	cout << (n%k == 0 ? 0:1) << endl;
}

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

int main(){
    int n,m;
    cin>>n>>m;
    vector<int>x(m);
    rep(i,m) cin>>x[i];
    vector<int>sa(m-1);
    sort(x.begin(),x.end());
    if(n>m){
        cout<<0<<endl;
        return 0;
    }else{
        rep(i,m-1)sa[i]=x[i+1]-x[i];

    }
    sort(sa.begin(),sa.end());
    int ans=0;
    rep(i,m-n)ans+=sa[i];
    cout<<ans<<endl;
}

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

using namespace std;

const int maxn = 1e7 + 700;


int n,fre[maxn],p[220],ispr[maxn],dd[maxn],even,odd,wrong;
vector <int> edge[220],v2;

bool fin(int u) {
    if (fre[u]==wrong) return false;
    fre[u]=wrong;
    for (int j=0;j<edge[u].size();j++) {
        int v=edge[u][j];
       // cout<<u<<" "<<v<<endl;
        if (p[v]==-1 || fin(p[v])) {
            p[v]=u;
            return true;
        }
    }
    return false;
}

int main() {
 //   freopen("in.txt","r",stdin);
    ios_base::sync_with_stdio(0); cin.tie(0);
    ispr[1]=1;
    for (int i=2;i<maxn;i++)
        if (ispr[i]==0) {
            for (int j=i+i;j<maxn;j+=i) ispr[j]=1;
        }
    cin>>n;
    for (int i=1;i<=n;i++) {
        int x;
        cin>>x;
        if (dd[x]==1) continue;
        dd[x]=1;
        fre[x]^=1;
        fre[x+1]^=1;
    }
    even=0; odd=0; wrong=2;
    for (int i=0;i<maxn;i++)
        if (fre[i]==1) {
            v2.push_back(i);
            if (i%2==0) even++;
            else odd++;
        }
    // for (int i=0;i<v2.size();i++) cout<<v2[i]<<" ";
   //  cout<<endl;
    for (int i=0;i<v2.size();i++)
        for (int j=0;j<v2.size();j++)
            if (v2[i]%2==0 && v2[j]%2==1 && ispr[ abs(v2[j] - v2[i]) ]==0 && abs(v2[j] - v2[i])%2==1) {
                edge[i].push_back(j);
                //cout<<i<<" "<<j<<" "<<v2[i]<<" "<<v2[j]<<endl;
            }
    int cnt=0;
     for (int i=0;i<v2.size();i++) if (v2[i]%2==1) p[i]=-1;
    for (int i=0;i<v2.size();i++)
     if (v2[i]%2==0) {
        wrong++;
        cnt+=fin(i);
    }
  //   cout<<" " <<even<<" "<<odd<<" "<<cnt<<endl;
    cout<< cnt + (even-cnt)/2 *2 + (odd-cnt)/2 * 2 + (even-cnt)%2*3;
}


Measured memory_bytes: 115072
#include<stdio.h>
int main()
{
    int n,i;

    int a[100];
 scanf("%d",&n);
    for(i=0;i<n;i++)
    {

        scanf("%d",&a[i]);
    }
            for(i=n-1;i>0;i--)
            {
               printf("%d ",a[i]);


        }

printf("%d\n",a[0]);
return 0;
}



Measured memory_bytes: 2100
#include <cstdio>
#include <cstring>
#include <string>
#include <iostream>
#include <algorithm>
#define MAXN 1001

int n ,k, ans, a[MAXN];

int main() {
	scanf("%d %d", &n, &k);
	for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
	std::sort(a + 1, a + n + 1);
	for (int i = 1; i <= k; ++i) {
		ans += a[i];
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 3840
from functools import partial

N = int(input())
S = input()
lst = [chr(ord("A")+i) for i in range(26)]

def convert(x,n,l):
  id = ord(x) - ord("A")
  return l[(id+n)%26]

ans = "".join(map(partial(convert,n=N,l=lst),S))
print(ans)

Measured memory_bytes: 9592
#include<iostream>
using namespace std;
int main()
{
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  while(true){
    c-=b;
    if(c<=0){
      cout << "Yes" << endl;
      return 0;
    }
    a-=d;
    if(a<=0){
      cout << "No" << endl;
      return 0;
    }
  }
  return 0;
}

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

#define NMAX 1001
#define INF 2000000000

#define MOD 1000000007

using namespace std;

int n;
int vect[NMAX];
double maxVal;

int main()
{
    cin >> n;
    for(int i = 0; i < n; i++)
        cin >> vect[i];

    sort(vect, vect + n);

    maxVal = vect[0];
    for(int i = 1; i < n; i++)
    {
        maxVal = (maxVal + vect[i]) / 2.;
    }
    cout << fixed << setprecision(5) << maxVal;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

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

    if ((a == b) && (b != c)) {
        cout << c << endl;
    } else if ((a == c) && (c != b)) {
        cout << b << endl;
    } else if ((b == c) && (c != a)) {
        cout << a << endl;
    }
}


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

using namespace std;

#include <vector>
#include <map>
#include <set>
#include <queue>
#include <math.h>
#include <iostream>
#include <stdio.h>

typedef long long ll;
typedef vector<ll> vll;
typedef pair<ll,ll> pairll;

#define sll(x) scanf("%lld",&x);
#define READ freopen("in.txt","r",stdin)
#define WRITE freopen("out.txt","w",stdout)

#define ff first
#define ss second

inline ll readInt()
{
    ll in; scanf("%lld",&in); return in;
}

inline ll ADD(ll a, ll b, ll mod)
{
    return (a + b + mod + mod)%mod;
}

inline ll SUBS(ll a, ll b, ll mod)
{
    return (a-b+mod + mod) %mod;
}

inline ll MUL(ll a, ll b, ll mod)
{
    return (a*b + mod)%mod;
}

ll bigMod(ll base, ll power, ll mod)
{
    if(!power) return 1;
    if(!base) return 0;

    ll temp = bigMod(base, power/2, mod);

    if(power%2 == 0)
    {
        return (temp*temp)%mod;
    }
    else return (((temp*temp)%mod)*base)%mod;
}

inline ll modInverse(ll a, ll modp)
{
    return bigMod(a, modp -2, modp);
}

inline ll modInverseExtended(ll a, ll m) 
{ 
    ll m0 = m; 
    ll y = 0, x = 1; 
  
    if (m == 1) 
      return 0; 
  
    while (a > 1) 
    { 
        // q is quotient 
        ll q = a / m; 
        ll t = m; 
  
        // m is remainder now, process same as 
        // Euclid's algo 
        m = a % m, a = t; 
        t = y; 
  
        // Update y and x 
        y = x - q * y; 
        x = t; 
    } 
  
    // Make x positive 
    if (x < 0) 
       x += m0; 
  
    return x; 
} 
  

void autoinput()
{
    #ifndef ONLINE_JUDGE
    READ; 
    //WRITE;

    #endif
}

int main()
{
    autoinput();

    ll a = readInt(), b = readInt();
    ll c = readInt(), d = readInt();

    ll T = readInt();

    ll dif = c - a;
    if(dif < 0) dif = 0 - dif;

    ll v = b - d;

    if(v <= 0) puts("NO");
    else
    {
        ll s = v * T;
        if(s >= dif) puts("YES");
        else puts("NO");
    }
    
}



Measured memory_bytes: 3676
from collections import Counter
n = int(input())
s = list(input() for hoge in range(n))
m = int(input())
t  = list(input() for hoge in range(m))
scount = Counter(s)
tcount = Counter(t)
maxyen = 0
for i in range(n):
         if (scount[s[i]] - tcount[s[i]]) > maxyen:
                  maxyen = (scount[s[i]] - tcount[s[i]])
print(maxyen)


Measured memory_bytes: 3316
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n , k;
  cin>>n>>k;
  string s[n];
  for(int i =0;i<n;i++) cin >>s[i];
  sort(s, s+n);
  for(int i =0;i<n;i++)cout<<s[i];
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll long long
#define ld long double
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back
int main()
{
	SPEED
	int n;
	cin >> n;
	int count = 0;
	char prev, ch;
	cin >> prev;
	count++;
	for (int i = 1; i < n; ++i)
	{
		cin >> ch;
		if (ch!=prev)
		{
			count++;
		}
		prev = ch;
	}
	cout << count;
	return 0;
}

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

typedef long long ll;

int N,K;
ll mod = 1000000007;
ll dp[2010][2010];
ll ans;

int main()
{
    scanf("%d%d",&N,&K);

    ll p = 1;
    for(int i = 0; i < N - K - 1; i++)p = p * 2 % mod;

    dp[0][0] = 1;
    for(int i = 1; i < N; i++)
    {
        for(int j = N; j >= 0; j--)
        {
            dp[i][j] = dp[i][j + 1];
            dp[i][j] += dp[i - 1][j];
            dp[i][j] %= mod;
            if(i - j == K - 1)
            {
                ans += dp[i][j];
                ans %= mod;
            }
        }
        for(int j = 0; j < N; j++)
        {
            if(j)dp[i][j] += dp[i - 1][j - 1];
            dp[i][j] %= mod;
        }
    }
    ans += (K == 1);

    printf("%lld\n",ans * p % mod);
    return 0;
}


Measured memory_bytes: 31616
//templates
#include <iostream>
#include <algorithm>
#include <string>
#include <numeric>
#include <vector>
#include <unordered_map>
#include <map>
#include <cmath>
#include <iomanip>
#include <bitset>
#include <sstream>
#define rep(i,n) for(int i = 0; i < (n); i++)
#define ALL(x) (x).begin(),(x).end()
#define sort_key(struct_name,key_name) [](const struct_name &x, const struct_name &y){return x.key_name < y.key_name;}
#define pb(x) push_back(x)
typedef long long ll;
const long long MOD = 1e9 + 7;
using namespace std;

//main
int main(){
    int N,K,Q; cin >> N >> K >> Q;
    vector<int> A(Q);
    rep(i,Q) cin >> A[i];
    vector<int> B(N,0);
    vector<int> C(N,K);
    rep(i,Q){
        B[A[i]-1] += 1;
    }
    rep(i,N){
        C[i] = C[i]-Q+B[i];
    }
    rep(i,N){
        if(C[i]<=0) cout << "No" << endl;
        else cout << "Yes" << endl;
    }
}



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

#define F first
#define S second
#define vsort(v) sort((v).begin(), (v).end())
#define vrev(v) reverse((v).begin(), (v).end())

using namespace std;
using ll = long long;

int main(int argc, const char * argv[]) {
    string s;
    cin >> s;
    if (s[0] == s[1] && s[1] == s[2] || s[1] == s[2] && s[2] == s[3]) {
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip> //! for setprecision(10)
#include <math.h>
#include <algorithm>
#include <functional> 
#include <string>
#include <vector>

#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <utility>
#include <limits.h>

using namespace std;

typedef long long LL;

#define rep(i,n) for (int i = 0; i < (n); ++i)
#define dump(c) { for (auto it = c.begin(); it != c.end(); ++it) if (it == c.begin()) cout << *it; else cout << ' ' << *it; cout << endl; } 
#define dumpMap(m) { for (auto it: m) cout << it.first << "=>" << it.second << ' '; }

const int MOD = 1000000007;

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(0);
    
    char c;
    cin >> c;
    ++c;

    cout << c << endl;

    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
/////////////////// TYPES & MACROS ///////////////////////////////
#define mp make_pair
#define eb emplace_back
#define pb push_back
#define all(x) x.begin(),x.end()
#define ff first
#define ss second
#define vv vector
#define exist(s,e) (s.find(e)!=s.end())
#define sz(x) ((int)(x).size())
#define int ll
#define el '\n'
template<class T> bool rmn(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool rmx(T &a, T b) { return a < b ? (a = b, true) : false; }
typedef long long ll; typedef long double ld; typedef double dd; typedef pair<int, int> pii;
const ll INFLL=0x7f7f7f7f7f7f7f7f, MOD=1e9+7; const int INF=0x7f7f7f7f;

//////////////////// DEBUG /////////////////////////////////////////
#define D(x) cerr<<#x<<" is:\t"<<x<<'\n';
#define DD(x,y) cerr<<'('<<#x<<','<<#y<<") are:\t"<<x<<' '<<y<<'\n';
#define DDD(x,y,z) cerr<<'('<<#x<<','<<#y<<','<<#z<<") are:\t"<<x<<' '<<y<<' '<<z<<'\n';

/////////////////// VARIABLES & FUNCTIONS//////////////////////////
vv<vv<int>> adj; vv<int> vis, color; 
int dx8[]={0,1,1,1,0,-1,-1,-1}, dy8[]={1,1,0,-1,-1,-1,0,1},dx4[]={0,1,0,-1}, dy4[]={1,0,-1,0};
inline ll mexp(ll x,ll n,ll m=MOD){ll res=1;x%=m;while(n){if(n&1)res=(res*x)%m;n>>=1;x=(x*x)%m;}return res;}
inline ll gcd(ll a, ll b){if(a<0) a=-a; if(b<0) b=-b; while (a>0 && b>0){if(a>b)a%=b;else b%=a;}return a+b;}

///////////////////// MAIN STARTS //////////////////////////////////
int32_t main(void){
ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
cout<<fixed;cerr<<fixed; cout<<setprecision(10); cerr<<setprecision(3);
mt19937 genr(chrono::high_resolution_clock::now().time_since_epoch().count());

int n,m,p; cin>>n>>m>>p;
vv<pair<int,pii>> edj;
for(int i=0;i<m;++i){
	int x,y,d; cin>>x>>y>>d;
	--x, --y;
	d-=p;
	edj.eb(d,mp(x,y));
}
vv<int> dist(n,-INFLL);
dist[0]=0;
for(int i=0;i<n-1;++i){
	for(auto e: edj){
		dist[e.ss.ss]=max(dist[e.ss.ss],dist[e.ss.ff]+e.ff);
	}
}
int prev=dist[n-1];
for(int i=0;i<n-1;++i){
	for(auto e: edj){
		dist[e.ss.ss]=max(dist[e.ss.ss],dist[e.ss.ff]+e.ff);
	}
}
if(dist[n-1]>prev){
	cout<<-1<<endl;
} else {
	cout<<max(0LL,dist[n-1])<<endl;
}

return 0;
}


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

using namespace std;

int main(){
	int n,k;
	vector<int> d;
	vector<vector<int> > a;
	cin>>n>>k;
	d.resize(k);
	a.resize(k,vector<int>());
	for(int i=0;i<k;i++){
		cin>>d[i];
		a[i].resize(d[i]);
		for(int j=0;j<d[i];j++){
			cin>>a[i][j];
		}
	}
	int ans=0;
	for(int i=1;i<=n;i++){
		bool have=false;
		for(auto v:a){
			for(auto p:v){
				if(p==i)	have=true;
			}
		}
		if(!have)	ans++;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 3652
#include "bits/stdc++.h"
using namespace std;

int main(){
	long long int n,c,k;
	cin>>n>>c>>k;
	vector<int> t(n);
	for(int i=0;i<n;i++)cin>>t[i];
	sort(t.begin(),t.end());
	
	long long int np=t[0]+k;
	long long int ans=1;
	long long int count=1;
	
	for(int i=1;i<n;i++){
		if(count<c&&t[i]<=np){
			count++;
		}else{
			ans++;
			count=1;
			np=t[i]+k;
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 640
#pragma region

#include "bits/stdc++.h"
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define _rep3(i, begin, end) for (register int i = (begin), i##_end = (end); i < i##_end; i++)
#define _irep3(i, begin, end) for (register int i = (end)-1, i##_begin = (begin); i >= i##_begin; i--)
#define _rep2(i, n) _rep3(i, 0, n)
#define _irep2(i, n) _irep3(i, 0, n)
#define _overload3(_1, _2, _3, name, ...) name
#define rep(...) _overload3(__VA_ARGS__, _rep3, _rep2, )(__VA_ARGS__)
#define irep(...) _overload3(__VA_ARGS__, _irep3, _irep2, )(__VA_ARGS__)
#define out(x) cout << (x) << '\n';
#define debug(x) cerr << #x << " = " << (x) << " (line: " << __LINE__ << ") " << endl;

using namespace std;
using ll = long long;
using vi = vector<int>;
using vl = vector<long long>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<long long>>;

template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
  for (auto &v : vec) is >> v;
  return is;
}
template <typename T1, typename T2>
istream &operator>>(istream &is, pair<T1, T2> &pair) {
  cin >> pair.first >> pair.second;
  return is;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  os << "[ ";
  rep(i, vec.size()) i == 0 ? os << vec[i] : os << ", " << vec[i];
  os << " ]";
  return os;
}

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

template <class T>
bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

void init() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(16) << boolalpha;
}

#pragma endregion

#define MOD 1000000007
#define INF 2147483647

int main() {
  init();

  int n, r;
  cin >> n >> r;

  out(n >= 10 ? r : (r + 100 * (10 - n)));
}


Measured memory_bytes: 256