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

#define PB push_back
#define PF push_front
#define MP make_pair
#define FF first
#define SS second
#define _sz(x) (int)x.size()

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

int n;
string s;

int main(){
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin >> s; n = s.size();

	int p = n >> 1;
	for (int i = 0; i < n; i ++)
		if (s[i] == 'p') p --;

	cout << p << '\n';
}


Measured memory_bytes: 640
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.math.BigInteger;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

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

    static class TaskA {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            long a = 1, b = 1;
            for (int i = 0; i < n; ++i) {
                long u = in.nextInt(), v = in.nextInt();
                long g = BigInteger.valueOf(u).gcd(BigInteger.valueOf(v)).longValue();
                u /= g;
                v /= g;

                long ratio = Math.max((a + u - 1) / u, (b + v - 1) / v);
                a = u * ratio;
                b = v * ratio;
            }
            out.print(a + b);
        }

    }

    static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (Exception e) {
                    throw new UnknownError();
                }
            }
            return tokenizer.nextToken();
        }

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

    }
}



Measured memory_bytes: 9424
#include <bits/stdc++.h>
#include <math.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rrep(i, n) for(int i = 0; i <= (n); i++)
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
const ll INF = 1LL<<60;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using Graph = vector<vector<int>>;

typedef pair<int, int> P;

struct city {int no, p, y;};

bool comp(city a, city b){
    if (a.p == b.p){
        return a.y < b.y;
    }
    else{
        return a.p < b.p;
    }
}

int main(){
    int N, M; cin >> N >> M;
    vector<city> Y(M);
    rep(i,M){
        int p,y; cin >> p >> y;
        city c = {i, p, y};
        Y[i] = c;
    }

    //sort(Y.begin(), Y.end(), comp);
	sort(Y.begin(), Y.end(), comp);
    vector<string> ans(M);
    int prev_city = -1;
    int count = 1;
    rep(i,M){
        string rno;
        /* 6桁の0埋め*/
        ostringstream sout;
        sout << setfill('0') << setw(6) << Y[i].p;
        if (prev_city == Y[i].p){
            count++;
        }
        else{
            count = 1;
            prev_city = Y[i].p;
        }
        sout << setfill('0') << setw(6) << count;
        rno += sout.str();

        ans[Y[i].no] = rno;
    }
    
    rep(i,M){
        cout << ans[i] << endl;
    }

}

Measured memory_bytes: 7420
import java.math.BigDecimal;
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		
		long a = stdIn.nextLong();
		double b = stdIn.nextDouble();
		
		
	//	System.out.println((long)Math.floor(a*b));
		
		
		BigDecimal bd1 = BigDecimal.valueOf(a);
		BigDecimal bd2 = BigDecimal.valueOf(b);
		
		BigDecimal ans = bd1.multiply(bd2).setScale(0,BigDecimal.ROUND_DOWN);
		
		System.out.println(ans);
		
		
		
		
	}

}


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


int main () {
  string s, t;
  cin >> s >> t;
  int a = s.size(), b = t.size();
  int k = -1;
  if (a >= b) {
    for (int i = 0; i <= a-b; i++) {
      bool x = false;
      for (int j = 0; j < b; j++) {
        int p = i+j;
        if (s.at(p) != '?' && t.at(j) != s.at(i+j)) {
          x = true;
          break;
        }
      }
      if (x) continue;
      k = i;
    }
  }
  if (k == -1) cout << "UNRESTORABLE" << endl;
  else {
    for (int i = 0; i < b; i++) {
      s.at(k+i) = t.at(i);
    }
    for (int i = 0; i < a; i++) {
      if (s.at(i) == '?') s.at(i) = 'a';
    }
    cout << s << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef pair<int, int> Pint;
typedef pair<int64_t, int64_t> Pll;

int main() {
    int H, W, N;
    cin >> H >> W >> N;
    vector<int> A(N);
    for (int i = 0; i < N; i++) {
        cin >> A.at(i);
    }
    vector<vector<int>> HW(H, vector<int>(W));
    int nowH = 0, nowW = 0;
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < A.at(i); j++) {
            HW.at(nowH).at(nowW) = i + 1;
            nowW++;
            if (nowW == W) {
                nowW = 0;
                nowH++;
            }
        }
    }
    for (int i = 0; i < H; i += 2) {
        reverse(ALL(HW.at(i)));
    }
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++){
            cout << HW.at(i).at(j);
            if (j == W - 1) {
                cout << endl;
            }
            else {
                cout << " ";
            }
        }
    }
}


Measured memory_bytes: 384
#import sys
#import numpy as np
import math
#from fractions import Fraction
import itertools
from collections import deque
from collections import Counter
import heapq
from fractions  import gcd
#input=sys.stdin.readline
#import bisect
n=int(input())
a=list(map(int,input().split()))
mod=10**9+7

if n%2==0:
    c=Counter(a)
    for x in c:
        if x%2==0 or c[x]!=2:
            print(0)
            break
    else:
        print(pow(2,n//2,mod))
else:
    c=Counter(a)
    if 0 not in c or c[0]!=1:
        print(0)
        exit()
    for x in c:
        if x==0:
          continue
        if x%2==1 or c[x]!=2:
            print(0)
            break
    else:
        print(pow(2,(n-1)//2,mod))

Measured memory_bytes: 96680
#include <iostream>

using namespace std;

int main()
{
    int w, h, x, y, r;
    cin >> w >> h >> x >> y >> r;
    if(x-r>=0 && y-r>=0 && x+r<=w && y+r<=h)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}


Measured memory_bytes: 3108
S=[]
H=[]
C=[]
D=[]
count=0
for i in range(0,30):
    S.append(0)
    H.append(0)
    C.append(0)
    D.append(0)

n=(int)(input())

for h in range(n):
    b,f,r,v=map(int,input().split())
    if b==1:
        if f==1:
            S[r-1]=S[r-1]+v
        if f==2:
            S[9+r]=S[9+r]+v
        if f==3:
            S[19+r]=S[19+r]+v
    elif b==2:
        if f==1:
            H[r-1]=H[r-1]+v
        if f==2:
            H[9+r]=H[9+r]+v
        if f==3:
            H[19+r]=H[19+r]+v
    elif b==3:
        if f==1:
            C[r-1]=C[r-1]+v
        if f==2:
            C[9+r]=C[9+r]+v
        if f==3:
            C[19+r]=C[19+r]+v
    elif b==4:
        if f==1:
            D[r-1]=D[r-1]+v
        if f==2:
            D[9+r]=D[9+r]+v
        if f==3:
            D[19+r]=D[19+r]+v

for j in range(len(S)):
    if j==10 or j==20:
        print("")
    print(" {0}".format(S[j]),end="")
print("")
print("####################")
for j in range(len(H)):
    if j==10 or j==20:
        print("")
    print(" {0}".format(H[j]),end="")
print("")
print("####################")
for j in range(len(C)):
    if j==10 or j==20:
        print("")
    print(" {0}".format(C[j]),end="")
print("")
print("####################")
for j in range(len(D)):
    if j==10 or j==20:
        print("")
    print(" {0}".format(D[j]),end="")
print("")



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

int main() {
	string N;
	cin >> N;

	int len = N.length();
	int A = 0;

	for (int i = 0; i < len; i++) A += N[i] - '0';

	if (A % 9 == 0) cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 3720
#include<iostream>
#include<string>
#include<stdio.h>
#include<cctype>
#include<algorithm>
#include<climits>
#include<cmath>
#include<map>
#include<vector>
#define INF INT_MAX
using namespace std;

string N;
int sum;

int main(){
	cin >> N;

	for (int i = 0; i < N.size(); i++){
		sum += N[i] - '0';
	}
	if (sum % 9 == 0)cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 3744
import collections as col

graph = col.defaultdict(set)
used = set()
ans = 0

def dfs(x,t):
    if x == t:
        return True
    used.add(x)
    ret = False
    for y in graph[x]:
        if y not in used:
            ret = ret or dfs(y,t)
    return ret

def solve():
    n,m = map(int,input().split())
    global used,ans
    for i in range(0,m):
        a,b = map(int,input().split())
        graph[a].add(b)
        graph[b].add(a)
    for a in graph:
        for b in graph[a]:
            graph[a].remove(b)
            used = set()
            if not dfs(a,b):
                ans += 1
            graph[a].add(b)
    print(ans//2)
    return

if __name__ == "__main__":
    solve()


Measured memory_bytes: 3316
#include<iostream>
#include<string>
#include<cstring>
using namespace std;
int main()
{
	int num1;
	int test[30];


	for(int i=0;i<30;i++){
		test[i]=0;
	}
	for(int i=0;i<28;i++){
		cin>>num1;
		test[num1-1]=1;
		num1=0;
	}
	for(int i=0;i<30;i++){
		if(test[i]==0){
			cout<<i+1;
			cout<<"\n";
		}
	}
	return 0;
}

Measured memory_bytes: 1160
n = int(input())
A = list(map(int, input().split()))

snuke = A[0]
arai = sum(A[1:])
ans = abs(arai - snuke)
for a in A[1:n-2]:
    snuke += a
    arai -= a
    ans = min(ans, abs(snuke - arai))

print(ans)


Measured memory_bytes: 24812
n, x = map(int, input().split())
A = sorted(list(map(int, input().split())))

if sum(A) < x:
    cnt = -1
else:
    cnt = 0
    
for a in A:
    x -= a
    if x >= 0:
        cnt += 1
    if x <= 0:
        print(cnt)
        exit()
print(cnt)

Measured memory_bytes: 9088
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int W = sc.nextInt();
        int[] w = new int[N];
        long[] v = new long[N];
        for (int i = 0; i < N; i++) {
            w[i] = sc.nextInt();
            v[i] = sc.nextLong();
        }

        long[][] dp = new long[N + 1][W + 1];
        for (int i = 0; i < N; i++) {
            for (int sumw = 0; sumw <= W; sumw++) {
                if (sumw >= w[i]) {
                    dp[i + 1][sumw] = dp[i][sumw - w[i]] + v[i];
                }
                dp[i + 1][sumw] = Math.max(dp[i + 1][sumw], dp[i][sumw]);
            }
        }
        System.out.println(dp[N][W]);
    }

}


Measured memory_bytes: 128212
#include <iostream>
using namespace std;
typedef long long LL;
string s;
LL sum;
int main(){
	cin>>s;
	for(int i=0;i<s.size();i++) sum+=s[i]-'0';
	if(sum%9==0) cout<<"Yes";
	else cout<<"No"; 
	return 0;
}


Measured memory_bytes: 3736
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#define int long long
using namespace std;
signed main() {
    int N,A;
    cin>>N>>A;
    
    cout<<N*N-A<<endl;
}

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

using ll = long long int;

int solve(){
    int h, w;
    cin >> h >> w;
    vector<string> s(h);
    for(int i=0;i<h;i++){
        cin >> s[i];
    }
    vector<vector<ll> > ocnt(h, vector<ll>(w+1)), icnt(h+1, vector<ll>(w));
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            if(s[i][j] == 'O'){
                ocnt[i][j+1]++;
            }
            if(s[i][j] == 'I'){
                icnt[i+1][j]++;
            }
            ocnt[i][j+1] += ocnt[i][j];
            icnt[i+1][j] += icnt[i][j];
        }
    }
    ll ans = 0;
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            if(s[i][j] == 'J'){
                ans += (ocnt[i][w]-ocnt[i][j])*(icnt[h][j]-icnt[i][j]);
            }
        }
    }
    cout << ans << endl;
    return 0;
}

int main(){
    solve();
    return 0;
}



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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<P> VP;
typedef vector<vector<ll>> VV;
typedef vector<vector<int>> VVi;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
const ll INF=1e18+18;
const ll MAX=100005;
const ll MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define ALL(v) v.begin(), v.end()
#define rALL(v) v.rbegin(), v.rend()
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define REPM(i, mp) for (auto i = mp.begin(); i != mp.end(); ++i)
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbgmap(mp) cerr << #mp << ":"<<endl; for (auto i = mp.begin(); i != mp.end(); ++i) { cerr << i->first <<":"<<i->second << endl;}
#define dbgarr(n,m,arr) rep(i,n){rep(j,m){cerr<<arr[i][j]<<" ";}cerr<<endl;}
#define dbgdp(n,arr) rep(i,n){cerr<<arr[i]<<" ";}cerr<<endl;
#define dbgmint(n,arr) rep(i,n){cerr<<arr[i].x<<" ";}cerr<<endl;
#define out(a) cout<<a<<endl
#define out2(a,b) cout<<a<<" "<<b<<endl
#define vout(v) rep(i,v.size()){cout<<v[i]<<" ";}cout<<endl
#define Uniq(v) v.erase(unique(v.begin(), v.end()), v.end())
#define fi first
#define se second

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 (b<a) { a=b; return true; } return false; }

template<typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &p) { return s<<"("<<p.first<<", "<<p.second<<")"; }

template<typename T>istream& operator>>(istream&i,vector<T>&v)
{rep(j,v.size())i>>v[j];return i;}

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<"	";
    }
    return s;
}

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}

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

    string s;
    cin>>s;

    string x;
    char prev='.';
    rep(i,s.length()){
        if(s[i]!=prev){
            prev = s[i];
            x += prev;
        }
    }
    ll ans=x.length()-1;
    cout<<ans<<endl;
    return  0;
}


Measured memory_bytes: 592
import sys
sys.setrecursionlimit(10 ** 6)
# input = sys.stdin.readline    ####
int1 = lambda x: int(x) - 1
def II(): return int(input())

def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())

def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

INF = float('inf')

def solve():
    S = list(input())
    T = list(input())

    ds = {}
    dt = {}
    ids = ''
    idt = ''
    cids = 0
    cidt = 0
    for i in range(len(S)):
        s = S[i]
        t = T[i]
        if s in ds:
            idss = ds[s]
            ids = ids + str(idss)
        else:
            cids += 1
            ds[s] = cids
            ids = ids + str(cids)

        if t in dt:
            idst = dt[t]
            idt = idt + str(idst)
        else:
            cidt += 1
            dt[t] = cidt
            idt = idt + str(cidt)

    print('Yes' if ids == idt else 'No')



if __name__ == '__main__':
    solve()


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

#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, n, m) for(int (i) = (n); (i) < (m); ++(i))

// constexpr int INF = 1e9;
// constexpr ll INF = 1LL<<61;
constexpr ll mod = 1e9+7;



int main(){
  int N;
  cin >> N;
  vector<string> S(N);
  map<string, int> mp;
  REP(i, N){
    cin >> S[i];
    mp[S[i]]++;
  }
  vector<string> ans = {"AC", "WA", "TLE", "RE"};
  REP(i, 4){
    cout << ans[i] << " x " << mp[ans[i]] << endl;
  }
  return 0;
}


Measured memory_bytes: 6436
#include <bits/stdc++.h>
#define all(vec) vec.begin(), vec.end()
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using vll = vector<ll>;
using vll2 = vector<vector<ll>>;
constexpr ll INF = (1LL << 30) - 1LL;
constexpr ll LINF = (1LL << 60) - 1LL;
constexpr ll MOD = 1e9 + 7;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> a(n), b(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    for (int i = 0; i < n; i++) {
        cin >> b[i];
    }
    int res = INF;
    for (int i = 0; i < (1 << n); i++) {
        vector<P> v1, v2;
        for (int j = 0; j < n; j++) {
            if ((i >> j) & 1) {
                if (j % 2 == 0) {
                    v1.push_back(P(a[j], j));
                } else {
                    v2.push_back(P(a[j], j));
                }
            } else {
                if (j % 2 == 0) {
                    v2.push_back(P(b[j], j));
                } else {
                    v1.push_back(P(b[j], j));
                }
            }
        }
        sort(all(v1));
        sort(all(v2));
        int i1 = 0, i2 = 0, s = 0, be = -1, f = true;
        vector<int> to(n);
        for (int j = 0; j < n; j++) {
            if (j % 2 == 0) {
                if (i1 >= v1.size()) {
                    f = false;
                    break;
                }
                int t = v1[i1].first, id = v1[i1].second;
                if (t < be) {
                    f = false;
                    break;
                }
                be = t;
                to[j] = id;
                i1++;
            } else {
                if (i2 >= v2.size()) {
                    f = false;
                    break;
                }
                int t = v2[i2].first, id = v2[i2].second;
                if (t < be) {
                    f = false;
                    break;
                }
                be = t;
                to[j] = id;
                i2++;
            }
            for (int k = 0; k < j; k++) {
                if (to[k] > to[j]) {
                    s++;
                }
            }
        }
        if (f) {
            chmin(res, s);
        }
    }
    if (res == INF) {
        cout << -1 << endl;
    } else {
        cout << res << endl;
    }
}


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

int size,A[MAX+1];

void max(int i)
{
  int l,r,largest,t;

  l=2*i;
  r=2*i+1;
  if(l<=size && A[l]>A[i]) largest=l;
  else largest = i;
  if(r<=size&&A[r]>A[largest]) largest = r;
  if(largest != i)
    {
      t=A[i];A[i]=A[largest];A[largest]=t;
      max(largest);
    }
}

int extract()
{
  int maxv;
  if(size<1) return 0; 
  maxv=A[1];
  A[1]=A[size--];
  max(1);
  return maxv;
}

void increase(int i,int key)
{
  int tmp;
  if(key<A[i]) return;
  A[i]=key;
  while(i>1&&A[i/2]<A[i])
  {
    tmp=A[i];
    A[i]=A[i/2];
    A[i/2]=tmp;
    i=i/2;
  }
}

void insert(int key)
{
  size++;
  A[size]=-1000000001;
  increase(size,key);
}

int main ()
{
  int key;
  char com[20];

  while(1)
  {
    scanf("%s",com);
    if(com[0]=='i')
    {
      scanf("%d",&key);
      insert(key);
    }
    else if (strcmp(com,"extract")==0)
    {
     printf("%d\n",extract());
   }
    else break;
    }

  return 0;
}



Measured memory_bytes: 5644
#include <bits/stdc++.h>
using namespace std;
const int M = 200000;
int main() {
    int X;
    cin >> X;
    vector<int> primes;
    auto f = [](int i, vector<int> &p) {
        for (int j = 0; j < p.size(); j++) {
            if(i%p.at(j)==0) {return false;}
        }
        p.push_back(i);
        return true;
    };
    int ret = -1;
    int i = 2;
    while (ret==-1 && i<=M) {
        bool t = f(i, primes);
        if (i>=X && t) {ret = i; break;}
        i++;
    }
    cout << ret << endl;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp> 
#include<ext/pb_ds/tree_policy.hpp> 
#define int long long int
#define all(v) v.begin(),v.end() 
#define rev(v) v.rbegin(),v.rend()
#define ssd ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define mod 1000000007
#define ordered_set tree<ll, null_type, less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update>
#define trace(x) cerr<<#x<<" : "<<x<<endl;
#define inp 100005
#define en "\n"
using namespace std;
using namespace __gnu_pbds;

signed main() 
{
    ssd
    int i,j,k,n;
	cin>>n;
	vector<int> val(n+5);
	for(i=1;i<=n;i++) cin>>val[i];

	vector<vector<pair<int,int>>> dp(n+5, vector<pair<int,int>> (n+5,{0,0}));
	for(i=1;i<=n;i++)
	{
		dp[1][i] = {val[i],0};
	} 
	for(i=2;i<=n;i++)
	{
		for(j=1;j<=n;j++)
		{
			if(j+i-1>n) break;
			if(i&1)
			{
				int a1 = dp[i-1][j].first + val[i+j-1], b1 = dp[i-1][j].second;
				int a2 = dp[i-1][j+1].first + val[j], b2 = dp[i-1][j+1].second;
				if(a1>a2) dp[i][j] = {a1,b1};
				else dp[i][j] = {a2,b2};
			}
			else
			{
				int a1 = dp[i-1][j].first, b1 = dp[i-1][j].second + val[i+j-1];
				int a2 = dp[i-1][j+1].first, b2 = dp[i-1][j+1].second + val[j];
				if(b1>b2) dp[i][j] = {a1,b1};
				else dp[i][j] = {a2,b2};
			}
			// cout<<i<<" "<<j<<endl;
			// cout<<dp[i][j].first<<" "<<dp[i][j].second<<endl;
		}
	}
	if(n&1) cout<<dp[n][1].first - dp[n][1].second;
	else cout<<dp[n][1].second - dp[n][1].first;
    return 0;           
}

Measured memory_bytes: 144336
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string n;
	cin>>n;
	int sum=0;
	for(int i=0;i<n.length();i++)
	{
		sum+=(n[i]-'0');
	}
	if(sum%9==0) cout<<"Yes";
	else cout<<"No";
	return 0;
}


Measured memory_bytes: 3692
#include<cstring>
#include<queue>
#include<bitset>
#include<cstdio>
#include<vector>
#include<iostream>
using namespace std;
char s[10000];
int p[2], n,fir;
vector < int > d[2];
bitset < 30000 > inq;
bool check(int k){queue < int > q, q2; q.push(0); inq.reset();
    for (int i = 0; i < d[k].size(); ++i, swap(q, q2))
        for (int u, v; !q.empty();) {
            u = q.front(); q.pop(); inq[u+10000] = 0;v = u + d[k][i];
            if (!inq[v+10000]) q2.push(v), inq[v+10000] = 1;v = u - d[k][i];
            if (!inq[v+10000]) q2.push(v), inq[v+10000] = 1;
        }
    for (; !q.empty(); q.pop())
        if (q.front() == p[k]) return true;
    return false;
}
int main() {
scanf("%s",s);
scanf("%d%d",&p[0],&p[1]);
n = strlen(s);
for(register int fir=1,m=0,i=0,t=0;i<n;++i){
if (s[i]=='F')++m;
if (s[i]=='T'||i==n-1){
if(fir)p[0]-=m,m = fir = 0;if(m)d[t].push_back(m);m=0,t ^= 1;}}puts(check(0)&&check(1)?"Yes":"No");
}

Measured memory_bytes: 384
class Combinator
  MAX = 2200 # nCkの最大のnより大きいこと。MODより小さいこと。
  MOD = 1000000007

  def initialize
    @fac = Array.new(MAX)
    @fac[0] = 1
    @fac[1] = 1
    @finv = Array.new(MAX)
    @finv[0] = 1
    @finv[1] = 1
    @inv = Array.new(MAX)
    @inv[1] = 1
    (2..(MAX-1)).each do |i|
      @fac[i] = @fac[i-1]*i%MOD
      @inv[i] = MOD-@inv[MOD%i]*(MOD/i)%MOD
      @finv[i] = @finv[i-1]*@inv[i]%MOD
    end
  end

  def call(all, select)
    return 0 if all < select
    return 0 if all < 0||select < 0
    @fac[all]*(@finv[select]*@finv[all-select]%MOD)%MOD
  end
end
@combinator = Combinator.new

s = gets.to_i
if s < 3
  puts 0
  exit 0
elsif s == 3
  puts 1
  exit 0
end

max_len = s / 3
sum = 1
(2..max_len).each do |len|
  d = s - len * 3
  # d を len 個のどこに配分するかのパターン数 = len個から重複ありでd個選ぶ組み合わせの数
  sum += @combinator.call(len+d-1, d)
  sum %= 1000000007
end
puts sum

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

int main(){
    int a[11];
    for(int i = 0; i < 10; i++){
        cin >> a[i];
    }
    sort(a, a + 10);
    for(int i = 9; i >= 7; i--){
        cout << a[i] << endl;
    }
}

Measured memory_bytes: 3148
import sys


def input():
    return sys.stdin.readline().rstrip()

def main():
    S =input()
    T =input()
    ls =len(S)
    lt =len(T)

    count = lt
    for i in range(ls-lt+1):
        fixing =0
        for j in range(lt):
            if T[j] !=S[i+j]:
                fixing +=1

        count =min(count,fixing)
    print(count)












if __name__ == "__main__":
    main()


Measured memory_bytes: 72860
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		String S = sc.next();
		char c = ' ';

		for(int i=0;i<S.length();i=i+2) {
			c=S.charAt(i);
			if(c!='R'&&c!='U'&&c!='D') {
				System.out.println("No");
				return;
			}
		}
		for(int k=1;k<S.length();k=k+2) {
			c=S.charAt(k);
			if(c!='L'&&c!='U'&&c!='D') {
				System.out.println("No");
				return;
			}
		}
		System.out.println("Yes");
	}

}


Measured memory_bytes: 21844
#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;
#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; }
const int mod = 1000000007;
ll modpow(ll a, int b) { return b ? modpow(a * a % mod, b / 2) * (b % 2 ? a : 1) % mod : 1; }
template<class T> ostream& operator<<(ostream& os, const vector<T>& vec) { rep(i, sz(vec)) { if (i) os << " "; os << vec[i]; } return os; }
template<class T, class U> ostream& operator<<(ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; return os; }
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();
  }
}

/*
x ≤ y

y, x の最初の桁違う
y の最初の桁のとこ y ^ x = 1, y % x = 0
よって不可

y, x の最初の桁同じ
y % x = y - x

y - x = y ^ x
      = y + x - 2(y & x)
2x    = 2(y & x)
x     = y & x

y = 1, x = 0, 1
y = 0, x = 0
*/

// youtube editorial
// そのコードも参考になる
// https://atcoder.jp/contests/abc138/submissions/7013926

void solve() {
  ll ll, rr;
  cin >> ll >> rr;

  vector<int> L, R;

  auto to_bit = [&](long long a) {
    vector<int> v;
    rep(i, 60) {
      v.eb(a % 2);
      a /= 2;
    }
    reverse(all(v));
    return v;
  };

  L = to_bit(ll), R = to_bit(rr);
  // cout << L << endl << R << endl;

  // 桁, L < x, y < R, 先頭 bit がすでに現れたか
  int dp[61][2][2][2];
  fill_n(***dp, 61 * 2 * 2 * 2, 0);
  dp[0][0][0][0] = 1;

  rep(i, 60) rep(j, 2) rep(k, 2) rep(l, 2) rep(xi, 2) rep(yi, 2) {
    if (yi == 0 && xi == 1) continue;
    if (l == 0 && xi != yi) continue; // l = 0, xi = 0, yi = 0 でも遷移させていい (1 を運ぶだけ)

    int li = L[i];
    int ri = R[i];
    if (j == 0 && li > xi) continue; // L > x
    if (k == 0 && yi > ri) continue;
    // cout << i << " " << j << " " << k << " " << l << " " << xi << " " << yi << endl;
    add(dp[i + 1][j | (li < xi)][k | (yi < ri)][l | (xi + yi == 2)], dp[i][j][k][l]);
  }
  int ans = 0;
  rep(j, 2) rep(k, 2) add(ans, dp[60][j][k][1]);
  cout << ans << endl;
  // rep(i, 60) rep(j, 2) rep(k, 2) rep(l, 2) cout << dp[i][j][k][l] << " "; cout << endl;
}


Measured memory_bytes: 256
//#include "pch.h"
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <limits.h>
#include <string>
#include <deque>
#include <cmath>
#include <bitset>
#include <complex>
#include <time.h>
#include <stdio.h>

using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;

#define rip(i, n, s) for (int i = (s);i < (int)( n ); i++)
#define mpa make_pair
#define all(a) a.begin(), a.end()

template<typename T>
void vdeb(vector<T> &da) {
	int size = da.size();
	for (int i = 0;i < size;i++) {
		if (i == size - 1) {
			cout << da[i] << endl;
		}
		else {
			cout << da[i] << ' ';
		}
	}
}
template<typename T>
void vvdeb(vector<T> &da) {
	int size = da.size();
	for (int i = 0;i < size;i++) {
		vdeb(da[i]);
	}
}

template<typename T>
struct BIT{
    vector<T> li;
    int size;
    BIT (int n){
        li=vector<T>(n+1,0);
        size=n;
    }
    T sum (int i){
        int s=0;
        while(i>0){
            s+=li[i];
            i-=i & -i;
        }
        return s;
    }
    void add(int i,T x){
        while(i<=size){
            li[i]+=x;
            i+=i & -i;
        }
    }
};

int main(){
	int n,k;cin >> n >> k;
	vector<ll> da(n);
	vector<P> li(n+1);
	li[0]= mpa(0,0);
	ll now = 0;
	rip(i,n,0){
		cin >> da[i];
		da[i]-=k;
		now += da[i];
		li[i+1] = mpa(now, i+1);
	}
	sort(all(li));
	rip(i,n+1,0){
		li[i].first = i;
		swap(li[i].first, li[i].second);
	}
	//rip(i,n+1,0) cout << li[i].first << endl;
	sort(all(li));
	BIT<int> bt(n+1);
	ll ans = 0;
	bt.add(li[0].second+1,1);
	rip(i,n+1,1){
		//vdeb(bt.li);
		ans += bt.sum(li[i].second+1);
		bt.add(li[i].second+1,1);
	}
	cout << ans << endl;
}

Measured memory_bytes: 5760
N, W = gets.split.map(&:to_i)
ws, vs = [], []
N.times do |i|
    ws[i], vs[i] = gets.split.map(&:to_i)
end

def knap_recurse(n, w, weights, values, dp)
    return -Float::INFINITY if w < 0
    return 0 if n < 0
    return dp[n][w] if dp[n][w]

    dp[n][w] = [
        knap_recurse(n - 1, w, weights, values, dp),
        knap_recurse(n - 1, w - weights[n], weights, values, dp) + values[n]
    ].max
    return dp[n][w]
end

def knapsack(n_items, w_limit, weights, values)
    dp = Array.new(n_items + 1){Hash.new}
    return knap_recurse(n_items - 1, w_limit, weights, values, dp)
end

puts knapsack(N, W, ws, vs)

Measured memory_bytes: 7932
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
using namespace std;
int main() {
	bool b = true;
	int n;
	int a;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> a;
		if (a % 2 == 1 || a % 3 == 0 || a % 5 == 0)
		{
			
		}
		else
		{
			b = false;
			break;
		}
	}
	b ? cout << "APPROVED" << endl : cout << "DENIED" << endl;
}

Measured memory_bytes: 256
#include<iostream>
int main(){
int a,b;
int x,y,z,count;
while(true){
std::cin>>a>>b;
count=0;
if(a==0&&b==0)break;
x=1;y=0;z=0;
for(int i=1;i<=a-2;i++){
for(int j=i+1;j<=a-1;j++){
for(int k=j+1;k<=a;k++){
if(i+j+k==b){
count++;
break;
}
}
}
}
std::cout<<count<<std::endl;
    }

    return 0;

}



Measured memory_bytes: 3080
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <array>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <sstream>
#include <stdio.h>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <list>
#include <numeric>
#include <stack>
#include <iomanip>

using namespace std;

#define Rep(i,a,b) for(int i = a; i < b; i++)
#define rep(i,b) Rep(i,0,b)
#define rrep(i,a) for(int i = a; i >= 0; i--)
#define allof(a) (a).begin(), (a).end()

typedef long long ll;
const int inf = 1e9 + 7;
const ll infll = 1ll << 60ll;
const ll mod = 1e9 + 7;
// 0~3までは右左下上 4~7までは斜め
constexpr int dx[] = { 1, 0, -1, 0, 1, 1, -1, -1 };
constexpr int dy[] = { 0, -1, 0, 1, 1, -1, -1, 1 };

/*
// 最大公約数
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

// 最小公倍数
ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}*/

bool check(const vector<ll>& a, ll value, int n, int k) {
	ll sumK = 0;
	ll sum = 0;
	vector<ll> num(n);
	rep(i, n) {
		ll tmp = a[i] % value;
		// まずできるか
		sum += tmp;
		num[i] = tmp;
	}
	if (sum % value != 0) return false;

	sort(allof(num), greater<ll>());
	// 出来た
	// 次に k いかに収まるか

	// 一つ元となるやつを作る
	int right = n - 1;
	rep(left, n) {
		while (num[left] % value != 0) {
			ll remain = value - num[left];
			while (num[right] != 0) {
				if (num[right] >= remain) {
					sumK += remain;
					num[right] -= remain;
					remain = 0;
					num[left] = value;
					break;
				}
				else {
					sumK += num[right];
					remain -= num[right];
					num[left] += num[right];
					num[right] = 0;
				}
				if (remain == 0) break;
			}
			if (remain == 0) break;
			right--;
		}
		if (left == right) break;
	}

	//cout << sumK << endl;
	if (sumK <= k) return true;
	return false;
}

int main() {

	ll n, k;
	cin >> n >> k;
	vector<ll> a(n);
	rep(i, n) cin >> a[i];

	// 低いやつは0にすると良さそう
	// -7とかも7の倍数

	// 各要素を足し合わせる
	// そもそも最大となる条件は？

	// Aがなりうる値を全探索？
	ll sum = accumulate(allof(a), 0LL);

	ll ans = 0;

	// 因数分解
	for (ll i = 1; i * i <= sum; i++) {
		// 反対側も出す
		if (sum % i != 0) continue;

		ll first = i;
		ll second = sum / i;

		// 全要素 first を目指す
		if (check(a, first, n, k)) {
			ans = max(ans, i);
		}
		if (check(a, second, n, k)) {
			ans = second;
			break;
		}
	}

	cout << ans << endl;

	return 0;
}


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

using ll = long long;
using ull = unsigned long long;

#define MOD 1000000007

int main(void) {
    string O, E;
    cin >> O >> E;
    for(ll i = 0;i < O.size();i++) {
        cout << O[i];
        if(i < E.size()) cout << E[i];
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <vector>

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

  std::vector<int> res(N);
  for (int i=0; i<2*M; ++i) {
    int a;
    scanf("%d", &a);
    ++res[--a];
  }

  for (int res_: res)
    printf("%d\n", res_);

  return 0;
}


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

struct UnionFind {
    std::vector<int> par, sz;
    int gnum;

    explicit UnionFind(int n)
        : par(n), sz(n, 1), gnum(n) {
        std::iota(par.begin(), par.end(), 0);
    }

    int find(int v) {
        return (par[v] == v) ? v : (par[v] = find(par[v]));
    }

    void unite(int u, int v) {
        u = find(u), v = find(v);
        if (u == v) return;

        if (sz[u] < sz[v]) std::swap(u, v);
        sz[u] += sz[v];
        par[v] = u;
        --gnum;
    }

    bool same(int u, int v) { return find(u) == find(v); }
    bool ispar(int v) { return v == find(v); }
    int size(int v) { return sz[find(v)]; }
};

using lint = long long;

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

    std::vector<int> ans(n, -1);

    UnionFind uf(n);
    while (m--) {
        int u, v;
        std::cin >> u >> v;
        --u, --v;
        uf.unite(u, v);
        --ans[u], --ans[v];
    }

    for (int v = 0; v < n; ++v) {
        ans[v] += uf.size(v);
    }

    while (k--) {
        int u, v;
        std::cin >> u >> v;
        --u, --v;
        if (uf.same(u, v)) {
            --ans[u];
            --ans[v];
        }
    }

    for (auto a : ans) std::cout << a << " ";
    std::cout << std::endl;
}

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

    solve();

    return 0;
}


Measured memory_bytes: 2048
#include<bits/stdc++.h>
using namespace std;
#define BeatMeScanf ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define ll long long
#define mod 10000007

int main(){
    char ch;
    cin>>ch;
    cout<<char(int(ch)+1)<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

void solve()
{
	char a[5], b[5];
	while(cin >> a >> b)
	{
		if(a[0] == '0' && b[0] == '0')
		{
			break;
		}
		int Hit = 0;
		int Blow = 0;
		for(int i = 0; i < 4; ++i)
		{
			for(int j = 0; j < 4; ++j)
			{
				if(a[i] == b[j] && i == j)
				{
					++Hit;
				}
				else if(a[i] == b[j])
				{
					++Blow;
				}
			}
		}
		cout << Hit << " " << Blow << endl;
	}
}

int main()
{
	solve();
	return(0);
}

Measured memory_bytes: 860
#[allow(unused_imports)]
use std::cmp;

// Input macro from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
  (source = $s:expr, $($r:tt)*) => {
    let mut iter = $s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
  ($($r:tt)*) => {
    #[allow(unused_mut)]
    let mut s = {
      use std::io::Read;
      let mut s = String::new();
      std::io::stdin().read_to_string(&mut s).unwrap();
      s
    };
    let mut iter = s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
}

macro_rules! input_inner {
  ($iter:expr) => {};
  ($iter:expr, ) => {};

  ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
    let $var = read_value!($iter, $t);
    input_inner!{$iter $($r)*}
  };
}

macro_rules! read_value {
  ($iter:expr, ( $($t:tt),* )) => {
    ( $(read_value!($iter, $t)),* )
  };

  ($iter:expr, [ $t:tt ; $len:expr ]) => {
    (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
  };

  ($iter:expr, chars) => {
    read_value!($iter, String).chars().collect::<Vec<char>>()
  };

  ($iter:expr, usize1) => {
    read_value!($iter, usize) - 1
  };

  ($iter:expr, $t:ty) => {
    $iter.next().unwrap().parse::<$t>().expect("Parse error")
  };
}

fn solve(n: usize, x: i64, size: &Vec<i64>, all: &Vec<i64>) -> i64 {
  if n == 0 {
    x
  } else if x <= size[n-1] + 1 {
    solve(n - 1, cmp::max(x - 1, 0), size, all)
  } else {
    all[n-1] + 1 + solve(n - 1, cmp::min(x - size[n-1] - 2, size[n-1]), size, all)
  }
}

fn main() {
  input! {
    n: usize,
    x: i64,
  }
  let mut size = vec![0i64; n+1];
  size[0] = 1;
  let mut all = vec![0i64; n+1];
  all[0] = 1;
  for i in 0 .. n {
    size[i+1] = 2 * size[i] + 3;
    all[i+1] = 2 * all[i] + 1;
  }

  println!("{}", solve(n, x, &size, &all));
}


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

int main(){
  int A,B;
  cin >> A >> B;
  if(A>12){
    cout << B << endl;
  }
  else if(A>5){
    cout << B/2 << endl;
  }
  else{
    cout << 0 << endl;
  }
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC push_options
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
#include <xmmintrin.h>
#include <immintrin.h>
using namespace::std;
__attribute__((constructor))void init(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}
// #include<ext/pb_ds/assoc_container.hpp>
// #include<ext/pb_ds/tree_policy.hpp>
// #include <ext/pb_ds/priority_queue.hpp>
// #include<ext/pb_ds/tag_and_trait.hpp>
// #include <boost/multiprecision/cpp_dec_float.hpp>
// #include <boost/multiprecision/cpp_int.hpp>
// namespace mp = boost::multiprecision;
// typedef mp::number<mp::cpp_dec_float<0>> cdouble;
// typedef mp::cpp_int cint;
// template<typename T>using pbds=__gnu_pbds::tree<T,__gnu_pbds::null_type,less<T>,__gnu_pbds::rb_tree_tag,__gnu_pbds::tree_order_statistics_node_update>;
// template<typename T>using pbds_map=__gnu_pbds::tree<T,T,less<T>,__gnu_pbds::rb_tree_tag,__gnu_pbds::tree_order_statistics_node_update>;
// template<typename T,typename E>using hash_map=__gnu_pbds::gp_hash_table<T,E>;
// template<typename T>using pqueue =__gnu_pbds::priority_queue<T, greater<T>,__gnu_pbds::rc_binomial_heap_tag>;
typedef long long lint;
#define INF (1LL<<60)
#define IINF (1<<30)
#define EPS (1e-10)
#define MOD 1000000007LL
//#define MOD 998244353LL
typedef vector<lint> vec;
typedef vector<vector<lint>> mat;
typedef vector<vector<vector<lint>>> mat3;
typedef vector<string> svec;
typedef vector<vector<string>> smat;
template<typename T>inline void numout(T t){bool f=0;for(auto i:t){cout<<(f?" ":"")<<i<INF/2?i:"INF";f=1;}cout<<endl;}
template<typename T>inline void numout2(T t){for(auto i:t)numout(i);}
template<typename T>inline void output(T t){bool f=0;for(auto i:t){cout<<(f?" ":"")<<i;f=1;}cout<<endl;}
template<typename T>inline void output2(T t){for(auto i:t)output(i);}
template<typename T>inline void _output(T t){bool f=0;for(lint i=0;i<t.size();i++){cout<<f?"":" "<<t[i];f=1;}cout<<endl;}
template<typename T>inline void _output2(T t){for(lint i=0;i<t.size();i++)output(t[i]);}
#define rep(i,n) for(lint i=0;i<lint(n);++i)
#define repi(i,a,b) for(lint i=lint(a);i<(lint)(b);++i)
#define rrep(i,n) for(lint i=lint(n)-1;i>=0;--i)
#define rrepi(i,a,b) for(lint i=lint(b)-1;i>=lint(a);--i)
#define irep(i) for(lint i=0;;++i)
#define all(n) begin(n),end(n)
#define dist(a,b,c,d) sqrt(pow(a-c,2)+pow(b-d,2))
inline lint gcd(lint A,lint B){return B?gcd(B,A%B):A;}
inline lint lcm(lint A,lint B){return A/gcd(A,B)*B;}
// inline cint cgcd(cint A,cint B){return B?cgcd(B,A%B):A;}
// inline cint clcm(cint A,cint B){return A/cgcd(A,B)*B;}
inline bool chmin(auto& s,const auto& t){bool res=s>t;s=min(s,t);return res;}
inline bool chmax(auto& s,const auto& t){bool res=s<t;s=max(s,t);return res;}
const vector<lint> dx={1,0,-1,0,1,1,-1,-1};
const vector<lint> dy={0,1,0,-1,1,-1,1,-1};
#define SUM(v) accumulate(all(v),0LL)
auto call=[&](auto f,auto... args){return f(f,args...);};

int main(){
    lint n,l;
    cin>>n>>l;
    svec s(n);
    rep(i,n)cin>>s[i];
    sort(all(s));
    rep(i,n)cout<<s[i];
    cout<<endl;
}


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

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

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


int main() {
    cin>>A>>B>>C;
    if(A == C) cout<<B<<endl;
    if(A == B) cout<<C<<endl;
    if(B == C) cout<<A<<endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
#define DEBUG(X) cerr<<__LINE__<<" "<<#X<<": "<<X<<endl;
#define sciiA(x, y) int x,y;scanf("%lld%lld",&x,&y);
#define REP(i,y) for(int i=0;i<(int)(y);i++)
#define REPP(i,y) for(int i=1;i<=(int)(y);i++)
#define FOR(i,x,y) for(int i=(x);i<(int)(y);i++)
template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<typename T> T inf;
typedef long long ll;
template<> constexpr int inf<int> = 1e9;
template<> constexpr ll inf<ll> = 1e18;
#define int long long

int adjust(int H, int W) {
  int m = inf<ll>;

  if (H%3==0)
    chmin(m, 0LL);
  else if (H>3)
    chmin(m, W);

  FOR(i,1,W) {
    int S_A = i*H;
    int S_B = (W-i)*(H/2);
    int S_C = (W-i)*(H-(H/2));
    chmin(m, max(max(abs(S_A-S_B), abs(S_B-S_C)), abs(S_C-S_A)));
  }
  return m;
}

signed main() {
  sciiA(H,W);
  int m = min(adjust(H,W), adjust(W,H));
  printf("%lld\n",m);
}

Measured memory_bytes: 256
using System;

namespace _0209
{
    class Program
    {
        static int n, m;
        static int[,] w = new int[100, 100];
        static int[,] p = new int[50, 50];
        static int[,] p90 = new int[50, 50];
        static int[,] p180 = new int[50, 50];
        static int[,] p270 = new int[50, 50];
        static void Main(string[] args)
        {
            while (ReadInput()) Solve();
        }

        static void Solve()
        {
            for (int i = 0; i <= n - m; i++)
            {
                for (int j = 0; j <= n - m; j++)
                {
                    int resX = 100, resY = 100;
                    Match(i, j, p, ref resX, ref resY);
                    Match(i, j, p90, ref resX, ref resY);
                    Match(i, j, p180, ref resX, ref resY);
                    Match(i, j, p270, ref resX, ref resY);
                    if (resX != 100)
                    {
                        Console.WriteLine("{1} {0}", resX + 1, resY + 1);
                        return;
                    }
                }
            }
            Console.WriteLine("NA");
        }

        static void Match(int x, int y, int[,] p, ref int resx, ref int resy)
        {
            int sx = -1, sy = -1;
            for (int i = 0; i < m; i++)
            {
                for (int j = 0; j < m; j++)
                {
                    var val = p[i, j];
                    if (val != -1)
                    {
                        if (sx == -1)
                        {
                            sx = x + i;
                            sy = y + j;
                        }
                        if (val != w[x + i, y + j]) return;
                    }
                }
            }
            if (sx < resx || (sx == resx && sy < resy))
            {
                resx = sx;
                resy = sy;
            }
        }

        static bool ReadInput()
        {
            var strs = Console.ReadLine().Split(' ');
            n = int.Parse(strs[0]);
            m = int.Parse(strs[1]);
            if (n == 0 && m == 0) return false;
            for (int i = 0; i < n; i++)
            {
                strs = Console.ReadLine().Split(' ');
                for (int j = 0; j < n; j++) w[i, j] = int.Parse(strs[j]);
            }
            for (int i = 0; i < m; i++)
            {
                strs = Console.ReadLine().Split(' ');
                for (int j = 0; j < m; j++)
                {
                    var val = int.Parse(strs[j].Trim());
                    var d = m - 1;
                    p[i, j] = val;
                    p90[-j + d, i] = val;
                    p180[-i + d, -j + d] = val;
                    p270[j, -i + d] = val;
                }
            }
            return true;
        }
    }
}

Measured memory_bytes: 9452