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

template<typename T, typename U>
using pv=vector<pair<T,U>>;
template<typename T>
using matrix=vector<vector<T>>;
template<typename T>
using pque=priority_queue<T>;
template<typename T>
using lpque=priority_queue<T,vector<T>,greater<T>>;

using ll=long long;
using intpair=pair<int,int>;
using llpair=pair<ll,ll>;
using ilpair=pair<int,ll>;
using lipair=pair<ll,int>;
using intvec=vector<int>;
using llvec=vector<ll>;
using intq=queue<int>;
using llq=queue<ll>;
using intmat=vector<intvec>;
using llmat=vector<llvec>;

#define PI 3.141592653589793
#define INTINF ((1<<30)-1)
#define LLINF 1LL<<60
#define MPRIME 1000000007
#define MPRIME9 998244353
#define MMPRIME (1ll<<61)-1

#define len length()
#define pushb push_back
#define fi first
#define se second

#define setpr fixed<<setprecision(15)
#define all(name) name.begin(),name.end()
#define rall(name) name.rbegin(),name.rend()
#define gsort(vbeg,vend) sort(vbeg,vend,greater<>())

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

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

template<class T>
inline void init(T& v) {
	for(auto &a: v) cin>>a;
}
template<class T, class U>
inline void init(vector<pair<T,U>>& v) {
	for(auto &a: v) cin>>a.first>>a.second;
}
template<class T, class N>
inline void init(T& v, N n) {
	v.resize(n);
	for(auto &a: v) cin>>a;
}
template<class T, class U, class N>
inline void init(vector<pair<T,U>>& v, N n) {
	v.resize(n);
	for(auto &a: v) cin>>a.first>>a.second;
}

inline void out() {
	cout<<endl;
}
template<class T, class... U>
inline void out(T a, U... alist) {
	cout<<a<<" ";
	out(forward<U>(alist)...);
}

template<class N>
void resiz(N n) {
	//empty
}
template<class N, class T, class... U>
void resiz(N n, T&& hd, U&&... tl) {
	hd.resize(n);
	resiz(n,forward<U>(tl)...);
}

bool isout(int h, int w, int H, int W) {
	return ( h<0 || h>=H || w<0 || w>=W );
}

ll binpow(ll a, ll ex, ll p) {
	ll result=1;
	while(ex>0) {
		if(ex&1) result=result*a%p;
		ex>>=1;
		a=a*a%p;
	}
	return result;
}


int N,M;
intvec X, md, bat;
int res;

void input() {
	cin>>N>>M;
	init(X,N);
	resiz(M,md,bat);
}

void solve() {
	sort(all(X));
	bool nbat=false;
	md[X[0]%M]++;
	for(int i=1; i<N; i++) {
		md[X[i]%M]++;
		if(X[i-1]==X[i]) {
			if(nbat) {
				nbat=false;
			}
			else {
				nbat=true;
				bat[X[i]%M]++;
			}
		}
		else nbat=false;
	}

	for(int i=1; i<=M/2; i++) {
		if(i==M/2 && M%2==0) break;

		if(md[i]>md[M-i]) {
			res+=md[M-i];
			res+=min(bat[i],(md[i]-md[M-i])/2);
		}
		else {
			res+=md[i];
			res+=min(bat[M-i],(md[M-i]-md[i])/2);
		}
	}
	res+=md[0]/2;
	if(M%2==0) res+=md[M/2]/2;

	cout<<res<<endl;
}

int main() {
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout<<fixed<<setprecision(15);
	int t=1;
	while(t) {
		input();
		solve();
		t--;
	}
}


Measured memory_bytes: 4488
using System;

namespace MinMaxandSum
{
	class MainClass
	{
		public static void Main (string[] args)
		{
			int intMin = 0;
			int intMax = 0;
			double sum = 0;

			string n = Console.ReadLine ();
			int cnt = int.Parse (n); 

			string input = Console.ReadLine ();
			char[] CharSeparators = new char[] { ' ' };
			string[] array = input.Split (CharSeparators);

			intMin = int.Parse(array[0]);
			intMax = intMin;
			sum += (double)intMin;

			for(int i = 1; i < cnt; i++){

				int intNum2 = int.Parse(array[i]);

				if(intNum2 < intMin) {
					intMin = intNum2;
				}
			
				if(intMax < intNum2) {
					intMax = intNum2;
				}
				sum += (double)intNum2;	
			}
			Console.WriteLine(intMin + " " + intMax + " " + sum);
		}
	}
}

Measured memory_bytes: 19960
#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;
int mod;
#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, ll b, ll _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();
    }
}

void solve() {
  int a, b;
  cin >> a >> b;
  if ((a + b) % 2) cout << "IMPOSSIBLE" << endl;
  else cout << (a + b) / 2 << endl;
}


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

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

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

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

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

class ConnectNodeInfo{
	vector<vector<pair<ll,ll>>> graph;
public:
	ConnectNodeInfo(int node_num){
		graph.resize(node_num);
	}
	void AddNonDirectionalConnection(ll u,ll v,ll w){
		graph[u].emplace_back(v,w);
		graph[v].emplace_back(u,w);
	}
	void AddDirectionalConnection(ll u,ll v,ll w){
		graph[u].emplace_back(v,w);
	}
	vector<pair<ll,ll>>& operator[](ll index){
		return graph[index];
	}
	size_t size(){return graph.size();}
};

class TreeDiameter{
	pair<ll,ll> DFS(int parent,int child,ConnectNodeInfo& connect){
		pair<ll,ll> res(child,0);
		for(auto& x:connect[child]){
			if(x.first!=parent){
				auto p = DFS(child,x.first,connect);
				p.second += x.second;
				if(p.second>res.second){
					res = p;
				}
			}
		}
		return res;
	}
public:
	ll CalcDiameter(ConnectNodeInfo& connect){
		auto t = DFS(-1,0,connect);
		auto r = DFS(-1,t.first,connect);
		return r.second;
	};
};

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

	int N=in();
	ConnectNodeInfo connect(N);
	REP(i,N-1){
		int u=in(),v=in(),w=in();
		connect.AddNonDirectionalConnection(u,v,w);
	}
	TreeDiameter TD;
	
	out(TD.CalcDiameter(connect));
	return 0;
}


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

int main(int argc, const char * argv[]) {
    int N;
    
    cin >> N;
    
    vector<int> a(N);
    
    for (int i = 0; i < N; i++) cin >> a[i];
    
    sort(a.rbegin(), a.rend());
    
    int aliceScore = 0;
    int bobScore = 0;
    for (int i = 0; i < N; i++) {
        if (i % 2 == 0) {
            aliceScore += a[i];
        } else {
            bobScore += a[i];
        }
    }
    
    cout << abs(aliceScore - bobScore) << endl;
    
    return 0;
}

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

int main() {
  int K, S;
  int count;

  cin >> K >> S;

  for (int i = 0; i <= K; i++){
    for (int j = 0; j <= K; j++){
        int k = S - i - j;
        int s = i + j + k;
        if (S - i - j >= 0){
          if (K >= S - i - j){
            count++;
          }
        }
    }
  }


  cout << count << endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int f[100000+9];
int const mod = 1e9+7;
int main(){
    f[0] = 1;
    for(int i = 1;i<1e5+3;i++){
        f[i] = (1LL*f[i-1] * i)%mod;
    }
    int n , m;
    cin>>n>>m;
    if(abs(n-m) > 1){
        cout<<0;
        return 0;
    }
    int ans =(1LL*f[n]*f[m])%mod;
    if(abs(n-m) == 0){
        ans = (ans*2)%mod;
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 640
#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
#define DEBUG(X) cerr<<__LINE__<<" "<<#X<<": "<<X<<endl;

int main() {
  string a,b,c;
  cin >> a >> b >> c;
  if (a[a.size()-1] == b[0] && b[b.size()-1] == c[0]) {
    printf("YES\n");
  } else {
    printf("NO\n");
  }
}

Measured memory_bytes: 256
//#include "atcoder/all"
#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <vector>

const int MOD = 1e9 + 7;
const int iINF = 2147483647 / 2;
const long long int llINF = 9223372036854775807 / 2;

using namespace std;
// using namespace atcoder;
using ll = long long int;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;

typedef pair<ll, ll> pll;
bool paircomp(const pll &a, const pll &b) {
  if (a.first == b.first)
    return a.second < b.second;
  return a.first < b.first;
}

#define REP(i, n) for (ll i = 0; i < (n); i++)
#define RREP(i, n) for (ll i = (n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define AUTO(i, m) for (auto &i : m)
#define ALL(a) (a).begin(), (a).end()
#define MAX(vec) *std::max_element(vec.begin(), vec.end())
#define MIN(vec) *std::min_element(vec.begin(), vec.end())
#define ARGMAX(vec)                                                            \
  std::distance(vec.begin(), std::max_element(vec.begin(), vec.end()))
#define ARGMIN(vec)                                                            \
  std::distance(vec.begin(), std::min_element(vec.begin(), vec.end()))
#define REV(T) greater<T>()
#define PQ(T) priority_queue<T, vector<T>, greater<T>>
#define VVL(a, b, c) vector<vector<ll>>(a, vector<ll>(b, c))
#define VV(T, a, b, c) vector<vector<T>>(a, vector<T>(b, c))
#define VVVL(a, b, c, d)                                                       \
  vector<vector<vector<ll>>>(a, vector<vector<ll>>(b, vector<ll>(c, d)))
#define VVV(T, a, b, c, d)                                                     \
  vector<vector<vector<T>>>(a, vector<vector<T>>(b, vector<T>(c, d)))
#define SP(a) fixed << setprecision(a)
#define SQRT(a) sqrt((long double)(a))
#define DPOW(a, b) pow((long double)(a), (long double)(b))
#define UNIQUE(vec)                                                            \
  do {                                                                         \
    sort(ALL((vec)));                                                          \
    (vec).erase(std::unique(ALL((vec))), (vec).end());                         \
  } while (0)

ll POW(ll n, ll m) {
  if (m == 0) {
    return 1;
  } else if (m % 2 == 0) {
    ll tmp = POW(n, m / 2);
    return (tmp * tmp);
  } else {
    return (n * POW(n, m - 1));
  }
}

int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll N;
  cin >> N;
  vl A;
  // bool ok=false;
  vl D1(N), D2(N);
  REP(i, N) cin >> D1[i] >> D2[i];

  REP(i, N - 2) {
    bool s = true;
    REP(j, 3) {
      if (D1[i + j] != D2[i + j])
        s = false;
    }
    if (s) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 3640
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define mod 1000000007
#define lim 1000000000000000007
#define lim1 18446744073709551615  //Unsigned
#define sq(a) ((a)*(a))
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define mms(v,i) memset(v,i,sizeof(v))
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define REP(i,a,b) for (int i = a; i <= b; i++)
#define REPN(i,a,b) for (int i = a; i >= b; i--)
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<int,int> pi;
typedef pair<ll,ll> PL;
typedef pair<ll,int> PLI;
typedef pair<int,ll> PIL;
typedef pair<int,pair<int,int> > pii;
typedef pair<double,double> pdd;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
ll power(ll a,ll b) {
    if (b==0) return 1;
    ll c = power(a,b>>1);
    c = (c*c)%mod;
    if (b&1) return (c*a)%mod;
    return c;
}
ll powerwithoutmod(ll a,ll b) {
    if (b==0) return 1;
    ll c = power(a,b>>1);
    c = (c*c);
    if (b&1) return (c*a);
    return c;
}
ll gcdll(ll a,ll b) {
    if (b==0) return a;
    return gcdll(b,a%b);
}
int gcd(int a,int b) {
    if (b==0) return a;
    return gcd(b,a%b);
}

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        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);
    }
};

const int N = (int)1e5+5;
const int Q = 301;
const int logN = 18;

int a[] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
void solve() {
    ll h,w;
    cin>>h>>w;
  if (h==1 || w==1) {
    cout<<1;
    return;
  }
    ll ans = ((h+1)/2)*((w+1)/2) + ((h)/2)*((w)/2);
    cout<<ans;
}
int main() {
    //freopen("output.txt","r",stdin);
    //freopen("output.txt","w",stdout);

    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int T=1;
    //cin>>T;
    REP(TC,1,T) {
        //cout<<"Case #"<<TC<<": ";
        solve();
        cout<<"\n";
    }
}


Measured memory_bytes: 256
X,Y = map(int,input().split())
def dision(x):
    if(x == 1):
        return 300000
    elif(x == 2):
        return 200000
    elif(x==3):
        return 100000
    else:
        return 0
ans = dision(X)
ans+=dision(Y)
if(X == 1 and Y == 1):
    ans += 400000
print(ans)

Measured memory_bytes: 38488
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s, t;
	cin >> s >> t;
	sort(s.begin(), s.end());
	sort(t.rbegin(), t.rend());
	if(s < t) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 3640
#include <cstdint>
#include <iostream>

namespace null_null {

using i32 = std::int_fast32_t;
using i64 = std::int_fast64_t;
using u32 = std::uint_fast32_t;
using u64 = std::uint_fast64_t;
using usize = std::size_t;

} // namespace null_null

namespace null_null {

void main_() {
  i32 A, B, C;
  std::cin >> A >> B >> C;

  if (A - B > C) {
    std::cout << 0 << std::endl;
  } else {
    std::cout << C - (A - B) << std::endl;
  }
}

} // namespace null_null

int main() {
  null_null::main_();
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<set>
#include <bitset>
#include<queue>
#include<vector>
#include<map>
#include<stack>
#include <cstdio>
#include<algorithm>
#include <sstream>
#include<string>
#include<string.h>
#include <cmath>
#include <iomanip>
#include <string>
#include<list>
#include <limits>
#include <numeric>
#include <type_traits>
#define int long long
#define ll long long
#define mod  1000000007
#define inf 1e17
#define rep(i,j,n) for(int i=j;i<n;i++)
#define P pair<int,int>
#define ps push_back
double pi = 3.141592653589793;
using namespace std;
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    fill( (T*)array, (T*)(array+N), val );
}
//ここから始めよう
signed main(){
    string s;cin>>s;int ans=0;int cnt=0;
    rep(i,0,s.size()){
        if(s[i]=='B')cnt++;
        else ans+=cnt;
    }
    cout<<ans<<endl;
}

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

typedef long long ll;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define each(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); ++itr)
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define fi first
#define se second

int main()
{
    int n;
    int A[101][101]={0};
    int dp[101][101]={0};

    cin >>n;
    for(int i=1; i<=n; ++i)
    for(int j=1; j<=n; ++j)
    scanf(" %d", &A[i][j]);

    dp[1][1]=A[1][1];

    for(int i=2; i<=n; ++i) dp[1][i]=dp[1][i-1]+A[1][i];

    for(int i=2; i<=n; ++i) dp[i][1]=dp[i-1][1]+A[i][1];

    for(int i=2; i<=n; ++i)
    for(int j=2; j<=n; ++j)
    dp[i][j]=A[i][j]+dp[i-1][j]+dp[i][j-1]-dp[i-1][j-1];

/*
    for(int i=1; i<=n; ++i)
    {
        for(int j=1; j<=n; ++j)printf(" %d", dp[i][j]);
        printf("\n");
    }
*/
    int ans=-10000;

    for(int i=1; i<=n; ++i)
    for(int j=1; j<=n; ++j)
    ans=max(ans,A[i][j]);

    for(int a=1; a<=n; ++a)
    for(int b=1; b<=n; ++b)
    for(int c=a; c<=n; ++c)
    for(int d=b; d<=n; ++d)
    {
        int t=dp[c][d]-dp[a-1][d]-dp[c][b-1]+dp[a-1][b-1];
        ans=max(ans,t);
    }

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

Measured memory_bytes: 3308
#include<stdio.h>
#include<string.h>
int f(char ch);
int main(){
	char ch,s[100];
	int i,sum=0;
	while(scanf("%s",s)!=EOF){
		ch = s[strlen(s)-1];
		sum += f(ch);
		for(i=strlen(s)-2;i>=0;i--){
			if(f(ch)<=f(s[i])){
				ch = s[i];
				sum+=f(ch);
			}
			else
				sum-=f(s[i]);
		}
		printf("%d\n",sum);
		sum = 0;
	}
	return 0;
}
	int f(char ch){
		int x=0;
		if(ch=='I')
		x=1;
	else if(ch=='V')
		x=5;
	else if(ch=='X')
		x=10;
	else if(ch=='L')
		x=50;
	else if(ch=='C')
		x=100;
	else if(ch=='D')
		x=500;
	else if(ch=='M')
		x=1000;
	return x;
}

Measured memory_bytes: 0
package main

import (
	"fmt"
)

func main() {
	var s string
	cnt := 0
	fmt.Scan(&s)
	for i := 0; i < len(s); i++ {
		if cnt == 0 && s[i] == 'C' {
			cnt = 1
		} else if cnt == 1 && s[i] == 'F' {
			cnt = 2
		}
	}
	if cnt == 2 {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 512
#include <iostream>
#include <cmath>
#include <vector>
#include <bitset>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <climits>
#include <set>
#include <map>
#include <iomanip>
#include <cassert>
#include <functional>

using namespace std;

typedef pair<int, int> P;
#define FOR(i, a, b) for(ll (i)=a;(i)<(b);++(i))
#define rep(i, n)  FOR(i,0,n)
#define rrep(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.begin(), v.end(),greater<int>());
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define all(c) (c).begin(),(c).end()
#define ll long long
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define vs vector<string>
#define vc vector<char>
#define vvc vector<vector<char>>
#define Print(p) cout<<(p)<<endl
#define _1 first
#define _2 second
#define pb push_back
#define mod 1000000007
#define INF 1050000000

const int maxn = 1e5 + 10;



int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int n,m; cin >> n >> m;
	cout << (n - 1)*(m - 1) << endl;

	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		int c = scan.nextInt();
		if(b - a == c - b) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
		scan.close();

	}

}


Measured memory_bytes: 21844
// #pragma GCC optimize("O3", "unroll-loops")
// #pragma GCC target("avx2")
 
#include <bits/stdc++.h>
using namespace std;
 
// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
// using namespace __gnu_pbds;
// #define ost tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
 
#define    int                      long long int
#define    ld                       long double
#define    f(i,j,n)                 for(int i = j; i <= n; i++)
#define    r(i,n,j)                 for(int i = n; i >= j; i--)
#define    mod                      1000000007
#define    speed                    ios_base::sync_with_stdio(false);
#define    upp                      cin.tie(NULL);
#define    pb                       push_back
#define    mp                       make_pair
#define    T                        int ttt; cin >> ttt; while(ttt--)
#define    ff                       first
#define    ss                       second
#define    all(container)            container.begin() , container.end()
#define    sz(container)            (int)container.size()
#define    pii                      pair <int , int>
#define    sp(x)                    setprecision(x)
#define    bp(x)                    __builtin_popcount(x)
 
int power(int x, int y, int p)  
{  
    int res = 1;    
    x = x % p; 
    if (x == 0) return 0; 
    while (y > 0)  
    {     
        if (y & 1)  
            res = (res*x) % p;  
        y = y>>1; 
        x = (x*x) % p;  
    }  
    return res; 
}

int32_t main()
{
    speed upp
    int n,m;
    cin>>n>>m;
    if(m>=n)
        cout<<"unsafe";
    else
        cout<<"safe";
}

Measured memory_bytes: 3640
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<functional>
#include<vector>
#include<queue>
#include<stack>
#include<set>
using namespace std;
#define MOD 1000000007
#define f(i,n) for(int i=0;i<int(n);i++)
#define N 100


int main(){
	char a[N + 1];
	f(i, N + 1)a[i] = 0;
	char c[2];
	int n, k;
	int x, y, z;
	long long s, ans;
	bool v = true;
	ans = 0;
	scanf("%s", a);
	n = strlen(a);
	scanf("%lld", &s);
	c[0] = 0;
	f(i, n){
		if (a[i] > '1')c[0] = a[i];
		else if (i == s - 1)c[0] = a[i];
		if (c[0] != 0)break;
	}

	printf("%c\n", c[0]);


	return 0;
}

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

void print(vector<int> l) {
  for (int i : l) {
    cout << i;
  }
  cout << endl;
}

int main() {
  int T;
  cin >> T;
  for (int n = 0; n < T; n++) {
    bool ans = true;
    vector<int> a, b, c;
    vector<int> cardN(9);
    for (int i = 0; i < 9; i++)
      cin >> cardN[i];
    for (int i = 0; i < 9; i++) {
      string cardC;
      cin >> cardC;
      if (cardC == "R")
        a.push_back(cardN[i]);
      if (cardC == "G")
        b.push_back(cardN[i]);
      if (cardC == "B")
        c.push_back(cardN[i]);
    }

    if ((a.size() % 3) || (b.size() % 3) || (c.size() % 3)) {
			cout<<0<<endl;//最初はans=falseにしてた
      continue;
    }

    for (vector<int> nv : {a, b, c}) {
      sort(nv.begin(), nv.end());
      while (nv.size() != 0) {
        if ((nv[0] == nv[1]) && (nv[1] == nv[2]))
          nv.erase(nv.begin(), nv.begin() + 3);
				//eraseの２つめの引数は削除したい範囲の次を指す
        else {
          auto p2 = find(nv.begin(), nv.end(), nv[0] + 1);
          auto p3 = find(nv.begin(), nv.end(), nv[0] + 2);
          if ((p2 != end(nv)) && (p3 != end(nv))) {
            nv.erase(p3);
            nv.erase(p2);
						nv.erase(nv.begin());//最初忘れてた
						/*nv.erase(nv.begin());
            nv.erase(p2);
            nv.erase(p3);//ミス
						*/
          } else {
            ans = false;
            break;
          }
        }
      }
    }

    cout << ans << endl;
  }
}



Measured memory_bytes: 3144
{-# LANGUAGE TypeApplications #-}

import Control.Monad

main = do
    xs <- readLn @ Int >>= (flip replicateM) getLine
    ys <- readLn @ Int >>= (flip replicateM) getLine

    print $ (foldl max 0 . fmap (\x -> ((length . filter (== x)) xs) - ((length . filter (== x)) ys))) xs


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

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

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

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

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

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);

	while(true){
		int N=in();
		if(!N) break;
		vector<int> F(N,0);
		int start=in()-1;
		F[start] = 1;
		int goal=in()-1;
		int d=in();
		vector<string> S(d);
		REP(i,d){
			S[i]=in<string>();
		}
		
		int pos = start;
		vector<int> sh(d+1);
		sh[0] = pos;
		REP(i,d){
			if(pos>0 && S[i][pos-1]=='1') pos--;
			else if(pos<N-1 && S[i][pos]=='1') pos++;
			sh[i+1] = pos;
		}
		if(pos==goal){
			out(0);
			continue;
		}

		pos = goal;
		vector<int> gh(d+1);
		gh[0] = pos;
		REP(i,d){
			if(pos>0 && S[d-1-i][pos-1]=='1') pos--;
			else if(pos<N-1 && S[d-1-i][pos]=='1') pos++;
			gh[i+1] = pos;
		}
		reverse(ALL(gh));
		bool exist=false;
		REP(i,d){
			if(abs(sh[i]-gh[i])==1){
				pos = min(sh[i],gh[i]);
				if(S[i][pos]=='1' || (pos>0 && S[i][pos-1]=='1') || (pos<N-2 && S[i][pos+1]=='1')) continue;
				out(i+1,pos+1);
				exist = true;
				break;
			}
		}
		if(!exist) out(1);
	}

	return 0;
}


Measured memory_bytes: 2992
object Main {

  def main(args: Array[String]): Unit = {
    import scala.io.StdIn._

    // 3倍しても2で割る回数が増えることがないので、
    // 要するに, 全ての数を素因数分解した時の2の個数

    val N = readLine().toInt
    val A = readLine().split(" ").map(_.toLong)

    def count2(a: Long, count: Long): Long =
      if (a % 2 == 0)
        count2(a / 2, count + 1)
      else count

    println(A.map { a =>
      count2(a, 0)
    }. sum)
  }

}

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

int dsum(int x){
    int sum = 0;
    while(x>0){
        sum += x%10;
        x /= 10;
    }
    return sum;
}

int main(void){
    int n,a,b;
    cin>>n>>a>>b;
    int sum = 0;
    rep(i,n+1){
        int ds = dsum(i);
        if(ds >= a && ds <= b){
            sum += i;
        }
    }
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fr first
#define sc second
#define Fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define p(x,y) cout<<fixed<<setprecision(y)<<x<<"\n";
#define PI 3.1415926535897
#define debug(x) cout<<" [ " << #x << " is: " << x << " ] "<<endl;
#define mod 1000000007;

int main()
{
    Fast;
   int n;
   cin >> n;
   int d[n];
   int b[n];
   for(int i = 0; i < n; i++){
       cin >> d[i] >> b[i];
       if(i >= 2){
           if(d[i] == b[i] and d[i - 1] == b[i - 1] and d[i - 2] == b[i - 2])return cout << "Yes\n", 0;
       }
   }
   cout << "No\n";
    return 0;
}


Measured memory_bytes: 3648
import sys
import os


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = int(sys.stdin.readline().rstrip())

    ret = N
    for n in range(N+1):
        cnt = 0
        i = n

        while (i > 0):
            cnt += i % 6
            i //= 6

        j = N - n
        while (j > 0):
            cnt += j % 9
            j //= 9

        ret = min(cnt, ret)

    print(ret)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3188
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<map>
using namespace std;
#define ll long long
const int mod = 1000000007;
const ll INF = 1000000000000000000;

int main()
{
	int N, A, B, C, D;
	string S;
	cin >> N >> A >> B >> C >> D >> S;
	bool cross = false;
	for (int i = A - 1; i < max(C, D) - 1; i++) {
		if (S[i] == '#' && S[i + 1] == '#') {
			cout << "No" << endl;
			return 0;
		}
	}
	if (D < C) {
		for (int i = B - 2; i <= D - 2; i++) {
			if (S[i] == '.' && S[i + 1] == '.' && S[i + 2] == '.') {
				cout << "Yes" << endl;
				return 0;
			}
		}
		cout << "No" << endl;
	}
	else cout << "Yes" << endl;
}

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

// macro
#define rep(i,n) for(int i=0;i<n;i++)
#define ll long long
#define all(v) v.begin(), v.end()

// code starts
int main()
{
  int i;
  int n,c,k;cin>>n>>c>>k;
  vector<int> t(n+1,2010101010);
  rep(i,n)cin>>t[i];
  sort(all(t));
  int nwait=0;
  int ans=0;
  while(nwait<n)
  {
    int lim=t[nwait]+k;
    int count=0;
    while(count<c&&t[nwait]<=lim)
    {
      count++;
      nwait++;
    }
    ans++;
  }
  cout<<ans<<endl;
}


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

using namespace std;

int main(){
    int N, M;
    cin >> N >> M;
    int ans, ansMax, temp;

    ansMax = M / N;

    for(ans = ansMax; ans > 0; --ans){
        temp = M - ans * (N - 1);
        if((temp % ans) == 0){
            cout << ans << endl;
            return 0;
        }
    }

    return 0;
}

Measured memory_bytes: 256
using System;

namespace RedOrNot
{
    class Program
    {
        static void Main(string[] args)
        {
            int s = int.Parse(Console.ReadLine());
            String ss = Console.ReadLine();

            if(s >= 3200){
                Console.WriteLine(ss);
            }else{
                Console.WriteLine("red");
            }

        }
    }
}


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

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


Measured memory_bytes: 3564
using System;
using System.Linq;
using System.Text;

class Program
{
	static void Main(string[] args)
	{
		var ABC = Console.ReadLine().Split().Select(int.Parse).ToArray();
		int A = ABC[0], B = ABC[1], C = ABC[2];
		int antidote = A + B;
		bool v = antidote >= C;
		Console.WriteLine(value: v ? B + C : B + antidote + 1);
	}
}

Measured memory_bytes: 13396
#include<stdio.h>
#define MAX 100005
#define NIL -1

struct Node_struct{int p, l, r;};
typedef struct Node_struct Node;

Node T[MAX];
int D[MAX];

void print(int u){
  int i, c;
  printf("node %d: parent = %d, depth = %d, ", u, T[u].p, D[u]);

  if(T[u].p == NIL) printf("root, ");
  else if(T[u].l == NIL) printf("leaf, ");
  else printf("internal node, ");
  
  printf("[");
  for (i=0, c = T[u].l; c != NIL; i++, c = T[c].r){
    if(i) printf(", ");
    printf("%d", c);
  }
  printf("]\n");
  
}

void calcDepth(int u, int p){
  D[u] = p;
  if(T[u].r != NIL) calcDepth(T[u].r, p);
  if(T[u].l != NIL) calcDepth(T[u].l, p+1);
}

int main(){
  int i, j, k;
  int n;
  int id, sib, child;
  int root = NIL;
  scanf("%d", &n);
  for(i=0; i<n; i++) T[i].p = T[i].l = T[i].r = NIL;
  
  for(i=0; i<n; i++){
    scanf("%d %d", &id, &k);
    for(j = 0, sib = NIL; j<k; j++){
      scanf("%d", &child);
      T[child].p = id;
      if(j == 0) T[id].l = child;
      else T[sib].r = child;
      sib = child;
    }
  }


  for(i=0; i<n; i++){
    if(T[i].p == -1) root = i;
  }
  

  calcDepth(root, 0);


  for(i=0; i<n; i++) print(i);
  
  return 0;
}




Measured memory_bytes: 6416
import java.util.*;
class Main{
	
    public static void main(String args[]){
    	Scanner sc=new Scanner(System.in);
    	int a=sc.nextInt();
    	int b=sc.nextInt();
    	System.out.println((a+b)%2==0?(a+b)/2:(a+b+1)/2);
    }
}

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

int main(){
	ll n,k;
	cin >> n >> k;
	ll a = 0;
	ll b = 0;
	REP(i,n){
		if(i % k == 0) a++;
		if(i % k == k/2) b++;
	}
	ll ans = 0;
	if(k % 2 == 0){
		ans = a * a * a + b * b * b;
	}else{
		ans = a * a * a;
	}
	cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3644
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<set>
#include<bitset>
#include<map>

#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)

using namespace std;

typedef long long LL;
typedef double db;

int get(){
	char ch;
	while(ch=getchar(),(ch<'0'||ch>'9')&&ch!='-');
	if (ch=='-'){
		int s=0;
		while(ch=getchar(),ch>='0'&&ch<='9')s=s*10+ch-'0';
		return -s;
	}
	int s=ch-'0';
	while(ch=getchar(),ch>='0'&&ch<='9')s=s*10+ch-'0';
	return s;
}

const int N = 105;
const int INF = 1e9;

int A,B;
int d[11][11];
int f[N][N];
int m,ed[N*4][3];
bool bz[11][11];
bool v[N][N];
int n;
int id0[N],id1[N],S,T;

int main(){
	A=get();B=get();
	fo(i,1,A)fo(j,1,B)d[i][j]=get();
	fo(i,0,100)
		fo(j,0,100){
			f[i][j]=-INF;
			fo(x,1,A)
				fo(y,1,B)
				f[i][j]=max(f[i][j],d[x][y]-x*i-y*j);
		}
	int cnt=0;
	S=n=1;
	fo(i,0,100)id0[i]=++n;
	fo(i,0,100)id1[i]=++n;
	T=++n;
	ed[m=1][0]=S;ed[1][1]=id0[0];ed[1][2]=0;
	fo(i,0,99){
		m++;
		ed[m][0]=id0[i];ed[m][1]=id0[i+1];ed[m][2]=-1;
	}
	fo(i,0,99){
		m++;
		ed[m][0]=id1[i+1];ed[m][1]=id1[i];ed[m][2]=-2;
	}
	m++;
	ed[m][0]=id1[0];ed[m][1]=T;ed[m][2]=0;
	while(cnt<A*B){
		bool pd=0;
		fo(i,0,100){
			fo(j,0,100)
			if (!v[i][j]&&f[i][j]<=100&&f[i][j]>=0){
				int ct=0;
				fo(x,1,A)
					fo(y,1,B)
					if (!bz[x][y]&&d[x][y]-x*i-y*j==f[i][j])ct++;
				if (ct){
					pd=1;
					fo(x,1,A)
						fo(y,1,B)
						if (d[x][y]-x*i-y*j==f[i][j])bz[x][y]=1;
					ed[++m][0]=id0[i];ed[m][1]=id1[j];ed[m][2]=f[i][j];
					cnt=cnt+ct;
					break;
				}
				else v[i][j]=1;
			}
			if (pd)break;
		}
		if (!pd)break;
	}
	if (cnt!=A*B)printf("Impossible\n");
	else{
		printf("Possible\n");
		printf("%d %d\n",n,m);
		fo(i,1,m){
			printf("%d %d ",ed[i][0],ed[i][1]);
			if (ed[i][2]==-1)printf("X\n");
			if (ed[i][2]==-2)printf("Y\n");
			if (ed[i][2]>=0)printf("%d\n",ed[i][2]);
		}
		printf("%d %d\n",S,T);
	}
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
  char s[202],p[101];
  int i,j,l=0,m=0;
  int yes=0,no=0;
  for(l=0;;l++)
    {
      scanf("%c",&s[l]);
      if(s[l]=='\n') break;
    }
  for(i=0;i<l;i++)
    {
      s[i+l]=s[i];
    }
  for(m=0;;m++)
    {
      scanf("%c",&p[m]);
      if(p[m]=='\n') break;
    }
  for(i=0;i<=2*l-m;i++)
    {
      for(j=0;j<=m-1;j++)
	{
	  if(s[i+j]!=p[j])
	    {
	      no=1;
	      break;
	    }
	}
      if(no==0)
	{
	  printf("Yes\n");
	  yes=1;
	  break;
	}
      no=0;
    }
  if(yes==0) printf("No\n");
  return 0;
}

Measured memory_bytes: 524
#include"bits/stdc++.h"
#include<unordered_set>
#include<unordered_map>
#include<random>
using namespace std;
typedef long long ll;
const ll MOD = (ll)(1e9+7);
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int (i)=0; (i)<(int)(n); (i)++)
int dx[4]={ 1,0,-1,0 };
int dy[4]={ 0,1,0,-1 };

int N, M;
int H[100000];
vector<int> e[200000];

signed main(){
    cin >> N >> M;
    rep(i, N) cin >> H[i];
    rep(i, M){
        int a, b;
        cin >> a >> b;
        e[a-1].pb(b-1);
        e[b-1].pb(a-1);
    }

    int ans = 0;
    rep(i, N){
        bool isGood = true;
        rep(j, e[i].size()){
            if(H[i] <= H[e[i][j]]) isGood = false;
        }
        if(isGood) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 11492
#include <iostream>
#include <string>
#include <cstdio>
#include <vector>
using namespace std;

int V, E;
bool G[1100][1100];

bool pre_seen[1100];
int co;

void rec(int v) {
	pre_seen[v] = true;
	for (int i = 0; i < V; ++i) {
		if (!G[v][i]) continue;
		if (pre_seen[i]) continue;
		rec(i);
	}
	++co;
}

bool seen[1100][1100][3];
bool memo[1100][1100][3];

bool iswin(int even, int odd, int rem) {
	if (seen[even][odd][rem]) return memo[even][odd][rem];
	if (even + odd == 2) {
		if (rem == 0) return false;
		else return true;
	}

	bool res = false;
	if (even >= 1) if ( !iswin(even-1, odd, 1-rem) ) return true;
	if (odd >= 2) if ( !iswin(even+1, odd-2, rem) ) return true;
	if (rem == 1) if ( !iswin(even, odd, 1-rem) ) return true;

	seen[even][odd][rem] = true;
	return memo[even][odd][rem] = res;
}

int main() {
	while (cin >> V) {
		E = 0;
		for (int i = 0; i < V; ++i) {
			string str; cin >> str;
			for (int j = 0; j < str.size(); ++j) if (str[j] == 'Y') G[i][j] = 1, ++E;
		}
		E /= 2;
		
		int even = 0, odd = 0, rem = 0;
		int per = 0;
		for (int i = 0; i < V; ++i) {
			if (pre_seen[i]) continue;
			co = 0;
			rec(i);
			if (co & 1) ++odd;
			else ++even;
			per += co * (co - 1) / 2;
		}
		rem = E - per;

		if (V & 1) {
			int rem = (V-1)*(V-2)/2 - E;
			if (rem & 1) puts("Taro");
			else puts("Hanako");
		}
		else {
			if ( iswin(even, odd, (rem&1)) ) puts("Taro");
			else puts("Hanako");
		}
	}
    return 0;
}


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

using namespace std;

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

typedef long long ll;
typedef unsigned long long ull;

int main() {
    int N;
    cin >> N;
    int d[N];
    rep(i, N) { cin >> d[i]; }
    map<int, int> dmap;
    rep(i, N) { dmap[d[i]]++; }
    // for (auto &value : dmap) {
    //     cout << value.second << endl;
    // }
    cout << dmap.size() << endl;
    return 0;
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define endl '\n';
#define FASTER ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
const ll POSITIVE_INFINITY = 9223372036854775807;
const ll NEGATIVE_INFINITY = -9223372036854775807;
const ll MOD = 1000000007;
const ld PI = acos(-1.0);

template <typename T> inline T bigMod(T A,T B,T M = MOD){A %= M;T ret = 1;while(B){if(B & 1) ret = (ret * A) % M;A = (A * A) % M;B = B >> 1;}return ret;}
template <typename T> inline T invMod (T A,T M = MOD){return bigMod(A,M-2,M);}

const int N = 200005;

int main(){
  FASTER;
  int n, l;
  cin >> n >> l;
  vector<string>ar(n);
  for (int i = 0; i < n; i++){
    cin >> ar[i];
  }
  sort(ar.begin(), ar.end());
  for (string v : ar){
    cout << v;
  }
  cout << '\n';
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<algorithm>
#include<stdint.h>
#include<vector>
#include<deque>
#include<stack>
#include<functional>
#include<string>
#include<cstring>
#include<time.h>
#include<array>
#include<iomanip>
#include<list>
#include<set>
#include<unordered_map>
#include<unordered_set>
#include<random>
#include<bitset>
#include <queue>
#include <map>


using namespace std;
using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
using ldouble = long double;


//BDD,ZDD,kdtree, bdtree,bicalc, bolonoy, doloney, tree, chinesemod,segmenttree,daikusutora, saidairyuu, 2bugurahu, heirokenshutu, topologicalsort, kyourenketuseibun

#define REP(i,a,b) for(int i = a; i < b; ++i)
#define PRI(s) cout << s << endl
#define PRIY PRI("Yes")
#define PRIN PRI("No")


int main() {
	int N;
	cin >> N;
	vector<ll> a(N);
	vector<ll> b(N);
	REP(i, 0, N)cin >> a[i];
	b[0] = a[1];
	for (int i = 2; i < N; ++i) b[0] ^= a[i];
	for (int i = 1; i < N; ++i) b[i] = a[0] ^ a[i] ^ b[0];
	REP(i, 0, N) PRI(b[i]);
	return 0;
}




Measured memory_bytes: 6320
const Main = (input) => {
    ans=''
    const lines = input.split('\r')
    for(i=0;i<lines.length;i++){
        if(lines[i].length===0 || lines[i]==='\n'){
            continue
        }
        line=lines[i].trim().split(" ")
        a=line[0]
        ans+=solve(a)+'\n'
    }
    ans=ans.trim()
    console.log(ans)
    return ans
}

function solve(a){
    if(a=='ABC'){
        return "ARC"
    }else if(a=='ARC'){
        return "ABC"
    }else {
        return "WA"
    }
}

Main(require('fs').readFileSync('/dev/stdin', 'utf8'))

Measured memory_bytes: 29624
///////////////////// author : TrEbLeCleF /////////////////////
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<pii> vpii;
#define FOr(i, a, b) for (int i=a; i<(b); i++)
#define For(i, a) for (int i=0; i<(a); i++)
#define FOrr(i,a,b) for (int i = (b)-1; i >= a; i--)
#define Forr(i,a) for (int i = (a)-1; i >= 0; i--)
/////////////////////////// ..... ///////////////////////////
#define deb(...) cerr << "[" << #__VA_ARGS__ << "] : [", DBG(__VA_ARGS__) 
void DBG() { cerr << "]\n";}
template<typename T, typename ...Args> void DBG(T first, Args... args){
cerr << first; if(sizeof...(args))cerr<<", "; DBG(args...); }
/////////////////////////// ..... ///////////////////////////
#define int ll
#define pb(x) push_back(x)
#define print(v,s,e) for(int i = s; i < e; i++)cout << v[i]<<" ";cout<<"\n";
#define INF 1e17
#define PI 3.14159265358979323846 
int del_x[4] = {-1, 1, 0, 0};
int del_y[4] = {0, 0, 1, -1};
int XX[8] = {-1, -1, -1, 0, 1, 1, 1, 0};
int YY[8] = {-1, 0, 1, 1, 1, 0, -1, -1};
/////////////////////////// GLOBAL ///////////////////////////
const int N = 1e5+2;
int dp[N+1];
int a[N+1];
/////////////////////////// GLOBAL ///////////////////////////
void solve(){
	int n,k;cin >> n >> k;
	For(i,n)cin >> a[i];
	For(i,n)dp[i]=INF;
	dp[0]=0;
	FOr(i,0,n){
		for(int steps=1; steps <=k; steps++){
			if(i+steps>=N)continue;
			dp[i+steps] = min(dp[i+steps],abs(a[i]-a[i+steps])+dp[i]);
		}
	}
	cout << dp[n-1] <<"\n";
}

int32_t main(){ 
	#ifndef ONLINE_JUDGE
		clock_t tStart = clock();
		freopen("TC", "r", stdin);
		//freopen("output.txt","w",stdout);
	#endif 
    ios_base:: sync_with_stdio(false); 
   	cin.tie(0); 
	int t=1;
	//cin >> t;
	for(int tt=1;tt<=t;tt++){
		//cout << "Case #"<<tt<<": ";
		solve();
	}
	#ifndef ONLINE_JUDGE
    	cerr << "\nRun Time -> "<<(double)(clock()-tStart)/CLOCKS_PER_SEC <<" sec\n";
    #endif
}

Measured memory_bytes: 5120
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF (1ll << 60)
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
using ll = long long;
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;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}
int main() {
    int n,m;
    cin >> n >> m;
    vector<vector<int>> jobs(m);
    REP(i, n) {
        int a, b;
        cin >> a >> b;
        if(a>m) continue;
        jobs[m-a].push_back(b);
        //その Ai日後に報酬 Biが得られます。
    }
    priority_queue<int> q;
    ll ans = 0;
    for (int i = m-1; i >=0; i--)
    {
        //priority que は使いまわしている
        for (auto b:jobs[i])
        {
            q.push(b);
        }
        if(!q.empty()){
            ans += q.top();
            q.pop();
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 5632
#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f
#include <cstdio>
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>
 
using namespace std;
 
typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P > PP;
 
const static int tx[] = {0,1,1,1,0,-1,-1,-1};
const static int ty[] = {-1,-1,0,1,1,1,0,-1};

class Node{
private:
  vector<string> constituents;
  int score;
public:
  
  int get_score() const { return score; }
  void print_result() {
    
    printf("%d ",score);
    for(int i=0;i<constituents.size();i++){
      if(i==0){
	cout << constituents[i];
      }
      else{
	cout << " " <<constituents[i];
      }
    }
    printf("\n");
  }
  Node(const string& _c) {
    constituents.push_back(_c);
    score = atoi(_c.c_str());
  }
  
  Node(const string& _c,int _s) : score(_s) {
    constituents.push_back(_c);
  }
  
  void cat(const string& _c,int _s){
    constituents.push_back(_c);
    score = score + _s;
  }
  void erase_last (int last_score){
    score -= last_score;
    constituents.pop_back();
  }
  
};

int main(){
  int target_num;
  string card;
  while(cin >> target_num >> card){
    if(target_num == 0 && card == "0") break;

    //1 ^(1) 2 ^(2) 2 ^(3) 4 ^(4)
    vector<Node> dp[100];
    for(int i=0;i<card.size();i++){
      dp[i].push_back(Node(card.substr(0,i+1)));
      for(int j=0;j<i;j++){
	//0->j j->i
	for(int k=0;k<dp[j].size();k++){
	  int rear = atoi(card.substr(j+1,i-j).c_str());
	  dp[j][k].cat(card.substr(j+1,i-j),rear);
	  dp[i].push_back(dp[j][k]);
	  dp[j][k].erase_last(rear);
	  // printf("%d %d\n",dp[j][k],rear);
	}
      }
    }

    Node res("",-1);
    bool reject = false;
    for(int i=0;i<dp[card.size()-1].size();i++){
      if(target_num >= dp[card.size()-1][i].get_score()){
	if(res.get_score() < dp[card.size()-1][i].get_score()){
	  res = dp[card.size()-1][i];
	  reject = false;
	}
	else if(res.get_score() == dp[card.size()-1][i].get_score()){
	  reject = true;
	}
      }
      // printf("%d\n",dp[card.size()-1][i]);
    }
    
    if(res.get_score() == -1){
      printf("error\n");
    }
    else if(reject){
      printf("rejected\n");
    }
    else{
      res.print_result();
    }
  }
}

Measured memory_bytes: 1260
const main = (inputs) => {
  A = inputs[0].split(" ")[0]-0;
  B = inputs[0].split(" ")[1]-0;
  C = inputs[0].split(" ")[2]-0;
  var ans = A+B+C;
  ans = Math.min(ans, A+B);
  ans = Math.min(ans, A+C);
  ans = Math.min(ans, B+C);
  console.log(ans);
}

main(require('fs').readFileSync('/dev/stdin', 'UTF-8').trim().split("\n"));


Measured memory_bytes: 21956