akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <string>
#include <limits.h>
#include <vector>
#include <numeric>

using namespace std;



bool gooddis(long long int n) {

	long long int a = 0;

	while (n >= a * a) {
		if (n == a * a)return true;
		a++;
	}

	return false;
}



vector<pair<long long int, long long int>> getPrimeElements(long long int num) {

	long long int firstnum = num;

	vector<pair<long long int, long long int>> result;
	pair<long long int, long long int> wk;

	if (num % 2 == 0) {
		wk.first = 2;
		wk.second = 0;
		while (num % 2 == 0) {
			wk.second++;
			num /= 2;
		}

		result.push_back(wk);
	}

	long long int waru = 3;

	while (true) {

		if (num % waru == 0) {
			wk.first = waru;
			wk.second = 0;
			while (num % waru == 0) {
				wk.second++;
				num /= waru;
			}

			result.push_back(wk);
		}
		waru += 2;

		if (waru * waru > num) break;

	}

	if (num != 1) {
		wk.first = num;
		wk.second = 1;
		result.push_back(wk);

	}

	return result;
}


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

	vector<pair<long long int, long long int>> gohan(n);

	for (int i = 0; i < gohan.size(); i++) {
		cin >> gohan[i].first;
		cin >> gohan[i].second;
	}

	vector<long long int> wa(n);
	long long int aokisum = 0;
	for (int i = 0; i < wa.size(); i++) {
		wa[i] = gohan[i].first + gohan[i].second;
		aokisum += gohan[i].second;
	}

	sort(wa.begin(), wa.end(), greater<long long int>());

	int gohantaberu = (n + 1) / 2;

	long long int ans = (-1) * aokisum;

	for (int i = 0; i < gohantaberu; i++) {
		ans += wa[2 * i];
	}

	cout << ans << endl;
	 
	return 0;

}




Measured memory_bytes: 2560
import itertools
import math

n=int(input())
xy=[[int(i) for i in input().split()] for _ in range(n)]
p = itertools.permutations(range(n),n)

lenlist=[]
for v in p:
    len=0
    for i in range(n-1):
        len +=  ( (xy[v[i+1]][0]-xy[v[i]][0])**2 + (xy[v[i+1]][1]-xy[v[i]][1])**2 )**0.5
    lenlist.append(len)

print(sum(lenlist)/math.factorial(n))


Measured memory_bytes: 10844
#include <bits/stdc++.h>
#define whlie while
#define pb push_back
#define eb emplace
#define fi first
#define se second
#define rep(i,N) for(int i = 0; i < (N); i++)
#define repr(i,N) for(int i = (N) - 1; i >= 0; i--)
#define rep1(i,N) for(int i = 1; i <= (N) ; i++)
#define repr1(i,N) for(int i = (N) ; i > 0 ; i--)
#define each(x,v) for(auto& x : v)
#define all(v) (v).begin(),(v).end()
#define sz(v) ((int)(v).size())
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) ll __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
using namespace std; void solve();
using ll = long long; using vl = vector<ll>;
using vi = vector<int>; using vvi = vector< vector<int> >;
constexpr int inf = 1001001001;
constexpr ll infLL = (1LL << 61) - 1;
struct IoSetupNya {IoSetupNya() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); cerr << fixed << setprecision(10);} } iosetupnya;
template<typename T, typename U> inline bool amin(T &x, U y) { return (y < x) ? (x = y, true) : false; }
template<typename T, typename U> inline bool amax(T &x, U y) { return (x < y) ? (x = y, true) : false; }
template<typename T, typename U> ostream& operator <<(ostream& os, const pair<T, U> &p) { os << p.first << " " << p.second; return os; }
template<typename T, typename U> istream& operator >>(istream& is, pair<T, U> &p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator <<(ostream& os, const vector<T> &v) { int s = (int)v.size(); rep(i,s) os << (i ? " " : "") << v[i]; return os; }
template<typename T> istream& operator >>(istream& is, vector<T> &v) { for(auto &x : v) is >> x; return is; }
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
template<typename T>void die(T x){out(x); exit(0);}
#ifdef NyaanDebug
  #include "NyaanDebug.h"
  #define trc(...) do { cerr << #__VA_ARGS__ << " = "; dbg_out(__VA_ARGS__);} while(0)
  #define trca(v,N) do { cerr << #v << " = "; array_out(v , N);cout << endl;} while(0)
#else
  #define trc(...)
  #define trca(...)
  int main(){solve();}
#endif
using P = pair<int,int>; using vp = vector<P>;
constexpr int MOD = /** 1000000007; //*/ 998244353;
////////////////

void solve(){
  ini(N);
  vl a(N); in(a);
  int ans = 0;
  rep(i , N - 1){
    if(a[i] < a[i + 1]) { trc(i); ans++;}
  }
  out(ans);
}


Measured memory_bytes: 3632
#include "bits/stdc++.h"
#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,cc,n) for(int i=cc;i<(n);++i)
#define dreps(i,cc,n) for(int i=cc;i>(n);--i)
#define llreps(i,cc,n) for(long long i=cc;i<(n);++i)
#define ALL(v) begin(v),end(v)
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;

int main()
{
	int cnt = 0;
	string s,t;
	cin >> s >> t;
	rep(i, s.length())
	{
		if (s[i] != t[i])
			++cnt;
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 3916
import java.io.*;
import java.util.StringTokenizer;

class Main {
	public static void main(String args[]) {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String buf;

		try {
			while ((buf = br.readLine())!=null) {
				int r[] = {1,1,1,1,1,1,1,1,1,1};
				StringTokenizer st = new StringTokenizer(buf);
				int c[] = new int[4];
				for (int i=0;i<3;i++) {
					c[i] = Integer.parseInt(st.nextToken());
					r[c[i]-1] = 0;
				}
				int count = 0;
				for (int i=0;i<10;i++) { //7*6=42 42/2=21
					if (r[i]==0) continue;
					c[3] = i+1;
					r[i] = 0;
					for (int j=0;j<10;j++) {
						if (r[j]==1&&c[0]+c[1]+j+1<=20) count++;
					}
					r[i] = 1;
				}
				if (count>=21) System.out.println("YES");
				else System.out.println("NO");
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}

Measured memory_bytes: 16864
#include <bits/stdc++.h>
using namespace std;
#define SELECTER(_1, _2, _3, SELECT, ...) SELECT
#define REP1(i, n) for(int (i)=0; (i)<(n); (i)++)
#define REP2(i, a, b) for(int (i)=(a); (i)<(b); (i)++)
#define REP(...) SELECTER(__VA_ARGS__, REP2, REP1,) (__VA_ARGS__)
#define MOD 1000000007

template <class T> ostream& operator<<(ostream& os, const vector<T>& v){ os << "{"; for(size_t i=0; i<v.size(); i++) os << v[i] << (i+1==v.size() ? "" : ", "); os << "}"; return os; }
template <class T, class U> ostream& operator<<(ostream& os, const pair<T, U>& p){ return os << "{" << p.first << ", " << p.second << "}"; }


tuple<bool, double, double, double, double> calc_circles_intersections(double x0, double y0, double r0, double x1, double y1, double r1){
    // return: ok, xa, ya, xb, yb
    double dx = x1 - x0;
    double dy = y1 - y0;
    double d2 = dx*dx + dy*dy;
    assert(d2!=0.0);
    double a = (d2 + r0*r0 - r1*r1) / 2;
    double tmp = d2*r0*r0-a*a;
    if(tmp < 0){
        return make_tuple(false, 0.0, 0.0, 0.0, 0.0);
    }
    tmp = sqrt(tmp);
    double xa = (a*dx+dy*tmp)/d2 + x0;
    double xb = (a*dx-dy*tmp)/d2 + x0;
    double ya = (a*dy-dx*tmp)/d2 + y0;
    double yb = (a*dy+dx*tmp)/d2 + y0;
    return make_tuple(true, xa, ya, xb, yb);
}

int N, K;
vector<tuple<double, double, double>> xyc;

bool check(double t){
    vector<pair<double, double>> xys;
    for(int i=0; i<N; i++){
        for(int j=i+1; j<N; j++){
            double x0, y0, c0;
            double x1, y1, c1;
            tie(x0, y0, c0) = xyc[i];
            tie(x1, y1, c1) = xyc[j];
            double r0 = t / c0;
            double r1 = t / c1;
            bool ok;
            double xa, ya, xb, yb;
            tie(ok, xa, ya, xb, yb) = calc_circles_intersections(x0, y0, r0, x1, y1, r1);
            if(ok){
                xys.emplace_back(xa, ya);
                xys.emplace_back(xb, yb);
            }
        }
    }
    for(int i=0; i<N; i++){
        double x0, y0, c0;
        tie(x0, y0, c0) = xyc[i];
        xys.emplace_back(x0, y0);
    }
    for(auto xy : xys){
        double x0 = xy.first;
        double y0 = xy.second;
        int cnt = 0;
        for(int i=0; i<N; i++){
            double x, y, c;
            tie(x, y, c) = xyc[i];
            double d2 = (x-x0)*(x-x0) + (y-y0)*(y-y0);
            if(c*c*d2 <= t*t + 1e-4) cnt++;
        }
        if(cnt >= K) return true;
    }
    return false;
}

int main(){
    cin >> N >> K;
    xyc.resize(N);
    REP(i, N){
        double x, y, c;
        cin >> x >> y >> c;
        xyc[i] = make_tuple(x, y, c);
    }
    if(N == 1){
        cout << 0 << endl;
        return 0;
    }

    double lb = 0.0;
    double ub = 1e6;
    for(int i=0; i<100; i++){
        double t = (lb + ub) / 2;
        if(check(t)) ub = t;
        else lb = t;
    }
    cout << fixed << setprecision(32) << ub << endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//ここから編集する


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

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

    int n = s.size();

    bool flag = false;
    for(int i = 0; i < n; ++i){
        string tmp;
        for(int j = i; j < n; ++j){
            tmp += s[j];
        }
        for(int j = 0; j < i; ++j){
            tmp += s[j];
        }

        if(tmp == t){
            flag = true;
        }
    }

    if(flag){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 1000000007

int main(void)
{
  int n;
  cin>>n;
  bool flag=false;
  for(int i=0;i<=n;i+=7){
    if((n-i)%4==0){
      flag=true;
    }
    if(flag==true) break;
  }
  if(flag==true){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
#include <set>
#include <stdio.h>
#include <math.h>
using namespace std;
typedef long long int lli;
const long long int MaxN=300005;
const lli mod=1e9+7;
#define fst first
#define snd second
#define mp make_pair
const float pi=3.1415926535897932384626433832795028;
	lli mcd(lli a,lli b){
		if(a==0)return b;
		return mcd(b%a,a);
	}
	lli prew[MaxN],sufe[MaxN];
	void solve(){
		lli N,i,j,p,q,res=1e9;
		cin>>N;		
		string word;
		cin>>word;
		word='0'+word;
		for(i=1;i<=N;i++){
			p=0;
			if(word[i]=='W')p=1;
			prew[i]=prew[i-1]+p;
		}
		for(i=N;i>=1;i--){
			p=0;
			if(word[i]=='E')p=1;
			sufe[i]=sufe[i+1]+p;
		}
		for(i=1;i<=N;i++){
			res=min(res,prew[i-1]+sufe[i+1]);
		}
		cout<<res;
	}
int main(){
	cin.tie(0),ios_base::sync_with_stdio(0);
	lli i,t;
	t=1;
	for(i=1;i<=t;i++){
		solve();
	}
}

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

#include<iostream>
using namespace std;
int main()
{
    int N;
    string S;

    cin >> S ;

    string ans = "No";
    
    if (S[0] == S[1] && S[0] != S[2] && S[0] != S[3]) {
        if (S[2] == S[3]) ans = "Yes";
    };

    if (S[0] == S[2] && S[0] != S[1] && S[0] != S[3]) {
        if (S[1] == S[3]) ans = "Yes";
    };

    if (S[0] == S[3] && S[0] != S[1] && S[0] != S[2]) {
        if (S[1] == S[2]) ans = "Yes";
    };


    // 出力
    cout << ans << endl;

    
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String[] args) {
        // write your code here
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();

        long ans = 0;

        for (int i = 1; i <= n; i++) {
            if (i % 3 == 0 || i % 5 == 0) {
                continue;
            }
            ans += i;
        }

        System.out.println(ans);
    }
}

Measured memory_bytes: 35800
w = input()
t = []
count = 0

while True:
    t.extend(input().split())
    if t[len(t) - 1] == "END_OF_TEXT":
        break

i = 0
for i in range(len(t)):
    if w.lower() == t[i].lower():
        count += 1

print(count)



Measured memory_bytes: 5564
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

typedef struct {
    double x;
    double y;
} Point;

void koch(Point p1, Point p2, int n) {
    Point s, t, u;
    if (n == 0) return;
    s.x = (2 * p1.x + 1 * p2.x) / 3;
    s.y = (2 * p1.y + 1 * p2.y) / 3;
    t.x = (1 * p1.x + 2 * p2.x) / 3;
    t.y = (1 * p1.y + 2 * p2.y) / 3;
    u.x = (t.x - s.x) * cos(M_PI / 3) - (t.y - s.y) * sin(M_PI / 3) + s.x;
    u.y = (t.x - s.x) * sin(M_PI / 3) + (t.y - s.y) * cos(M_PI / 3) + s.y;
    
    koch(p1, s, n - 1);
    printf("%.8f %.8f\n", s.x, s.y);
    koch(s, u, n - 1);
    printf("%.8f %.8f\n", u.x, u.y);
    koch(u, t, n - 1);
    printf("%.8f %.8f\n", t.x, t.y);
    koch(t, p2, n - 1);
}

int main() {
    int n;
    Point p1, p2;

    p1.x = 0.0;
    p1.y = 0.0;
    p2.x = 100.0;
    p2.y = 0.0;
    
    scanf("%d", &n);

    printf("%.8f %.8f\n", 0.0, 0.0);
    koch(p1, p2, n);
    printf("%.8f %.8f\n", 100.0, 0.0);
    
    return 0;
}



Measured memory_bytes: 2040
//header{{{
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/tag_and_trait.hpp>
#include <ext/pb_ds/trie_policy.hpp>
 
using namespace __gnu_pbds;
using namespace std;
 
#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) begin(x),end(x)
#define Fixed fixed << setprecision(12)
#define int int_fast64_t
using pii = pair<int,int>;
constexpr int INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod1 = 1e9+7;
constexpr int mod2 = 998244353;
 
template <class Func>
class FixPoint : Func {
public:
    explicit constexpr FixPoint(Func&& f) noexcept : Func(forward<Func>(f)) {}
 
    template <class... Args>
    constexpr decltype(auto) operator()(Args&&... args) const {
        return Func::operator()(*this, std::forward<Args>(args)...);
    }
};
 
template <class Func>
static inline constexpr decltype(auto) makeFixPoint(Func&& f) noexcept {
    return FixPoint<Func>{forward<Func>(f)};
}
 
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
 
template <class T> using min_heap = priority_queue<T,vector<T>,greater<T> >;
template <class T> using max_heap = priority_queue<T>;
template <class A, class B> using umap = unordered_map<A,B>;
template <class T> using Set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <class K, class V> using Umap = gp_hash_table<K, V>;
using Trie = trie<string, null_type, trie_string_access_traits<>, pat_trie_tag, trie_prefix_search_node_update>;
 
inline int square(int a){ return a * a;}
inline int updiv(int a,int b){ return (a + b - 1) / b; }
 
constexpr int dx[] = {1,0,-1,0,1,1,-1,-1};
constexpr int dy[] = {0,-1,0,1,1,-1,-1,1};
//}}}

signed main(){
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout.setf(ios_base::fixed);
    cout.precision(10);

    int n;
    cin >> n;

    vector<vector<int> > dp(n+1, vector<int>(4));

    int res = 0;

    dp[0][0] = 8;  // 1~8のみ
    dp[0][1] = 1;  // 0を含み、あとは1~8
    dp[0][2] = 1;  // 9を含み、あとは1~8
    dp[0][3] = 0;  // 0と9を含む

    rep(i,n){
        (dp[i+1][0] = dp[i][0] * 8) %= mod1;
        (dp[i+1][1] = dp[i][1] * 9 + dp[i][0]) %= mod1;
        (dp[i+1][2] = dp[i][2] * 9 + dp[i][0]) %= mod1;
        (dp[i+1][3] = dp[i][3] * 10 + dp[i][1] + dp[i][2]) %= mod1;
    }

    cout << dp[n-1][3] << '\n';

    return 0;
}

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

int main() {
  int N;
  cin >> N;
  int ans = 0;
  for(int i = 0; i < N; i++){
    int l,r;
    cin >> l >> r;
    ans += r - l + 1;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
import bisect
from collections import defaultdict
dd = defaultdict(int)

N=int(input())

a1=[1]
p=1
for i in range(100):
    p*=6
    if p>N:
        break
    a1.append(p)
    
p=1
a2=[1]
for i in range(100):
    p*=9
    if p>N:
        break
    a2.append(p)
    

def rep(NN):
    if dd[NN]!=0:
        return dd[NN]
    if NN==0:
        return 0
    x1=bisect.bisect_right(a1,NN)
    x2=bisect.bisect_right(a2,NN)
    dd[NN]=min(rep(NN-a1[x1-1]), rep(NN-a2[x2-1]))+1
    return dd[NN]
    
rep(N)
print(dd[N])





Measured memory_bytes: 38384
package main

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

var sc = bufio.NewScanner(os.Stdin)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	sc.Split(bufio.ScanWords)

	h, w := nextInt(), nextInt()
	board := make([][]int, h)
	for i := 0; i < h; i++ {
		r := make([]int, w)
		for j := 0; j < w; j++ {
			r[j] = nextInt()
		}
		board[i] = r
	}

	// ジグザク走査してコイン枚数が奇数のときだけ次のマスにコインを移動させる
	var ans [][]int
	col := 0
	for i := 0; i < h; i++ {
		if i%2 == 0 {
			col = 0
		} else {
			col = w-1
		}
		for 0 <= col && col < w {
			cur := board[i][col]

			if cur%2 == 0 || (i == h-1 && ((i%2 == 0 && col == w-1) || (i%2 != 0 && col == 0))) {
				if i%2 == 0 {
					col++
				} else {
					col--
				}
				continue
			}

			nrow, ncol := -1, -1
			if (col == 0 && i%2 == 1) || (col == w-1 && i%2 == 0) {
				nrow = i+1
				ncol = col
			} else if i%2 == 0 {
				nrow = i
				ncol = col+1
			} else {
				nrow = i
				ncol = col-1
			}
			board[i][col]--
			board[nrow][ncol]++
			ans = append(ans, []int{i+1, col+1, nrow+1, ncol+1})

			if i%2 == 0 {
				col++
			} else {
				col--
			}
		}
	}

	fmt.Println(len(ans))
	for i := 0; i < len(ans); i++ {
		str := ""
		for _, v := range ans[i] {
			str += fmt.Sprintf("%d ", v)
		}
		str = strings.TrimRight(str, " ")
		fmt.Println(str)
	}
}

Measured memory_bytes: 21248
#include<iostream>
using namespace std;
long int d[100000];
void swap(int a,int b)
{int t;t=d[a];d[a]=d[b];d[b]=t;}
int main()
{
long int n,ans=0,i;
cin>>n;
for(i=0;i<n;i++)cin>>d[i];
for(i=0;i<n;i++)
{
if(d[i]==i+1)
{
ans++;
if(i==n-1)swap(i,i-1);
else swap(i,i+1);
}
}
cout<<ans;
return 0;
}



Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include<vector>
using namespace std;
#define FOR(i, a, n) for(int i=a; i<n; i++)
#define RFOR(i, a, n) for(int i=n-1; i>=a; i--)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) FOR(i, 0, n)

void getCha(int num[26], string str) {
	for (int j = 0; j < str.size(); j++) {
		num[str[j] - 'a']++;
	}
	return;
}

int main()
{
	int n;
	int num1[26] = {};
	cin >> n;

	string s;
	cin >> s;
	getCha(num1, s);
	FOR(i, 1, n){
		int num2[26] = {};
		string str;
		cin >> str;
		getCha(num2, str);

		int number[26] = {};
		REP(j, 26) {
			if (num1[j] == 0 && num2[j] == 0) continue;
			else if (num1[j] == num2[j]) number[j] = num1[j];
			else if (num1[j] < num2[j]) number[j] = num1[j];
			else number[j] = num2[j];
		}
		REP(j, 26) num1[j] = number[j];
	}
	
	REP(i, 26) {
		RREP(j, num1[i]) {
			cout << (char)('a' + i);
		}
	}
	cout << endl;
	return 0;
}

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

int main()
{
	string S;
	cin >> S;
	int min = 999;
	int X;
	int dif = 100;
	string temp;

	for (int i = 0; i < (int)S.length() - 2; i++) {
		temp = S.substr(i, 3);
//		cout << temp << endl;
		X = stoi(temp);
		dif = abs(X - 753);
		if (min > dif) {
			min = dif;
		}
	}

	std::cout << min;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <utility>
#include <vector>


using namespace std;

int main(){

	int N;

	cin >> N;

	string word[N];
	char lchar;
	cin >> word[0];
	lchar = word[0][word[0].size()-1];
	bool k = true;

	for(int i=1;i<N;i++){
		cin >> word[i];
		for(int j=0;j<i;j++){
			if(word[i] == word[j]){
				k = false;
			}
		}
		if(word[i][0] != lchar){
			k = false;
		}
		lchar = word[i][word[i].size()-1];
	}

	if(k == true){
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<math.h>
int main() {
	while (true) {
		int b;
		std::cin >> b;
		int x=0, y=0;
		if (b == 0)break;
		int max_a = sqrt(b * 2);
		for (int a = 1; a <=max_a; a++) {
			if ((b * 2) % a == 0) {
				if (((b * 2 / a) + 1 - a) % 2 == 0) {
					y = ((b * 2 / a) + 1 - a) / 2;
					x = a;
				}
			}
		}
		std::cout << y << " " << x << std::endl;
	}
	return 0;
}


Measured memory_bytes: 3076
using System;
using System.Collections.Generic;
using System.Linq;

class MainClass
{
    static void Main()
    {
        string s = Console.ReadLine();
        var ep = Console.ReadLine().Split().Select(_=>int.Parse(_)+8000).ToArray();
        
        var dpx = new bool[16001];
        var dpy = new bool[16001];

        int index = 0;
        int fx = 8000;
        while (index < s.Length && s[index] == 'F')
        {
            fx++;
            index++;
        }
        dpx[fx] = true;
        dpy[8000] = true;

        bool dir = false;

        while (index < s.Length)
        {
            while (index < s.Length && s[index] == 'T')
            {
                dir = !dir;
                index++;
            }

            int dist = 0;
            while (index < s.Length && s[index] == 'F')
            {
                dist++;
                index++;
            }

            if (dir)
            {
                var ny = new bool[16001];
                for (int i = 1; i < 16000; i++)
                {
                    if (dpy[i])
                    {
                        ny[i - dist] = true;
                        ny[i + dist] = true;
                    }
                }
                dpy = ny;
            }
            else
            {
                var nx = new bool[16001];
                for (int i = 0; i < 16000; i++)
                {
                    if (dpx[i])
                    {
                        nx[i + dist] = true;
                        nx[i - dist] = true;
                    }
                }
                dpx = nx;
            }
        }

        Console.WriteLine((dpx[ep[0]] && dpy[ep[1]]) ? "Yes" : "No");
    }
}


Measured memory_bytes: 46484
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

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

    static class KStones {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int N = in.nextInt();
            int K = in.nextInt();
            int[] a = in.nextIntArray(N);
            boolean[] dp = new boolean[K + 1];  // true at 'i' implies first wins optimally

            for (int i = 0; i <= K; i++) {
                // goes to all possible j such that optimally with i-aj the first player wouldve lost there which implies first wouldve won if played from i
                for (int j = 0; j < N; j++) {
                    if (a[j] <= i && !dp[i - a[j]]) {
                        dp[i] = true;
                    }
                }
            }

            if (dp[K]) {
                out.print("First");
            } else {
                out.print("Second");
            }
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1)
                throw new InputMismatchException();
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        private boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public int[] nextIntArray(int size) {
            int[] array = new int[size];
            for (int i = 0; i < size; i++)
                array[i] = nextInt();
            return array;
        }

    }
}



Measured memory_bytes: 23764
package main
import "fmt"
const mod int64 = 1000000007
const size int = 50
func main() {
  var n,a,b,c,m,k int64
  fmt.Scan(&n,&a,&b,&c)
  initlz(2*n)
  for k=0;k<n;k++ {
    m = (m+((comb(n+k,n)*((pow(a,n)*pow(b,k))%mod+(pow(a,k)*pow(b,n))%mod)%mod)%mod)*inv(pow(100-c,n+k+1)))%mod
  }
  m = (m*n*100)%mod
  fmt.Println(m)
}
var f []int64
var invf []int64
func initlz(n int64) {
  f = make([]int64,n+1)
  invf = make([]int64,n+1)
  f[0] = 1
  invf[0] = 1
  for i:=int64(1);i<n+1;i++ {
    f[i] = (f[i-1]*(i%mod))%mod
    invf[i] = inv(f[i])
  }
}
func pow(b,n int64) int64 {
  if n == 0 { return 1 }
  if n%2 == 0 {
    h := pow(b,n/2)
    return (h*h)%mod
  }
  return (b*pow(b,n-1))%mod
}
func comb(n,k int64) int64 {
  if k < 0 || k > n { return 0 }
  if n == 0 && k == 0 { return 1 }
  if n == 0 { return 0 }
  return (f[n]*((invf[k]*invf[n-k])%mod))%mod
}
func inv(n int64) int64 {
  if n == 1 { return 1 }
  k := make([]int64,size)
  a,b,u := mod,n,size
  for i:=0;i<size;i++ {
    k[i],a,b = a/b,b,a%b
    if b == 0 { u = i;break }
  }
  var y0,y1 int64 = 1,-k[0]
  for i:=1;i<u;i++ { y0,y1 = y1,y0-k[i]*y1 }
  for y1 < 0 { y1 += mod }
  return y1%mod
}

Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n-1); i >= 0; i--)
#define all(v) (v).begin(),(v).end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template <class T> T lcm(T a, T b) { return a/gcd(a,b)*b; }
typedef pair<int, int> P;
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
const ll MOD = 1e9+7;

// Binary Indexed Tree (Fenwick Tree)
// https://youtu.be/lyHk98daDJo?t=7960
template<typename T>
struct BIT {
  int n;
  vector<T> d;
  BIT(int n=0):n(n),d(n+1) {}
  void add(int i, T x=1) {
    for (i++; i <= n; i += i&-i) {
      d[i] += x;
    }
  }
  T sum(int i) {
    T x = 0;
    for (i++; i; i -= i&-i) {
      x += d[i];
    }
    return x;
  }
  T sum(int l, int r) {
    return sum(r-1) - sum(l-1);
  }
};

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, q;
	cin >> n >> q;
    vector<int> c(n);
    rep(i,n) cin >> c[i];
    vector<int> pi(n+1, -1);
    vector<vector<int>> ps(n);
    rep(i,n) {
        int l = pi[c[i]];
        if (l != -1) ps[l].push_back(i);
        pi[c[i]] = i;
    }

    vector<vector<P>> qs(n);
    rep(qi,q) {
        int l, r;
        cin >> l >> r;
        --l; --r;
        qs[l].emplace_back(r,qi);
    }

    vector<int> ans(q);
    BIT<int> d(n);
    for (int x = n-1; x >= 0; --x) {
        for (int y : ps[x]) d.add(y,1);
        for (P query : qs[x]) {
          int r = query.first, i = query.second;
          ans[i] = (r-x+1) - d.sum(r);
        }
    }    

    rep(i,q) cout << ans[i] << "\n";
	return 0;
}


Measured memory_bytes: 59844
import java.util.*;
import java.util.stream.*;

class Main {
	Scanner sc;
	
	static class Student {
		int n, A;
	}

	Main() {
		sc = new Scanner(System.in);
	}
	
	void calc() {
		int N = sc.nextInt();
		Student[] s = new Student[N];
		for (int i = 0; i < N; i++) {
			s[i] = new Student();
			s[i].n = i+1;
			s[i].A = sc.nextInt();
		}
		Arrays.sort(s, Comparator.comparing(t -> t.A));
		
		System.out.println(Arrays.stream(s).map(t -> String.valueOf(t.n)).collect(Collectors.joining(" ")));
	}

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

Measured memory_bytes: 80668
//abc175_b.cpp
//Sat Aug 15 20:46:15 2020

#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#define INTINF 2147483647
#define LLINF 9223372036854775807
#define MOD 1000000007
#define rep(i,n) for (int i=0;i<(n);++i)

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

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

	int l[n];
	rep(i,n) cin >> l[i];

	sort(l,l+n);

	int ans = 0;
	for(int i=0;i<n;i++){
		for(int j=i+1;j<n;j++){
			for(int k=j+1;k<n;k++){
				if (l[i]==l[j] || l[i]==l[k] || l[j]==l[k]){
					continue;
				}
				if (l[i]+l[j]>l[k]){
					ans++;
				}
			}
		}
	}

	cout << ans << endl;
//	printf("%.4f\n",ans);
}

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

int main(){
  int m,n;
  n=1;
  while(n>0){
    cin >> n >> m;
    if(n==0) break;
    
    int d[n],p[n];
    int s=0;
    for(int i=0;i<n;i++){
      cin >> d[i] >> p[i];
      s += d[i]*p[i];
    }

    for(int i=0;i<n;i++){
      for(int j=i;j<n;j++){
	int a,b;
	if(p[j]<p[i]){
	  a = d[i];
	  b = p[i];
	  d[i] = d[j];
	  p[i] = p[j];
	  d[j] = a;
	  p[j] = b;
	}
      }
    }

    int i=0;
    while(m>0 && i<=n-1){
      if(m>=d[n-i-1]){
	m-=d[n-i-1];
	s-=d[n-i-1]*p[n-i-1];
      }else{
	s-=m*p[n-i-1];
	m=0;
      }
      i++;
    }
    cout << s << endl;
  }
}

Measured memory_bytes: 3100
#include<iostream>

using namespace std;

int ryou[3][6]={{60,80,100,120,140,160},
				{2,5,10,15,20,25},
				{600,800,1000,1200,1400,1600}};

int main(void){
	int n,sumPrice;
	int x,y,h,w,length;
	while(cin>>n,n){
		sumPrice=0;
		for(int i=0;i<n;i++){
			cin>>x>>y>>h>>w;
			length=x+y+h;
			for(int j=0;j<6;j++){
				if(length<=ryou[0][j] && w<=ryou[1][j]){
					sumPrice=sumPrice+ryou[2][j];
					break;
				}
			}
		}
		cout<<sumPrice<<endl;
	}
}

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

#define irep(i,n) for(int i = 0; i < (int)(n); i++)
#define irep2(i,a,n) for(int i = (int)(a); i <= (int)(n); i++)
#define lrep(i,n) for(long long  i = 0; i < (long long)(n); i++)
#define lrep2(i,a,n) for(long long i = (long long)(a); i <= (long long)(n); i++)
#define irrep(i,n) for(int i = (int)(n-1); i > -1; i--)
#define irrep2(i,a,n) for(int i = (int)(n); i >= (int)(a); i--)

typedef long long ll;
typedef std::vector<char> v_char;
typedef std::vector<v_char > v2_char;
typedef std::vector<double> v_double;
typedef std::vector<v_double > v2_double;
typedef std::vector<int> v_int;
typedef std::vector<v_int > v2_int;
typedef std::vector<ll> v_ll;
typedef std::vector<v_ll > v2_ll;
typedef std::vector<std::string> v_string;
typedef std::vector<v_string > v2_string;
typedef std::vector<bool> v_bool;
typedef std::vector<v_bool > v2_bool;
typedef std::pair<ll, ll> pll;
typedef std::pair<int, int> pii;

const double PI = 3.14159265359;
const int INF = (int)1e9;
const ll LINF = 1e18;
const int IMOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[5] = {0, 1, 0, -1};

using namespace std; 

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

    map<int, int> p;

    irep(i, n) {
        int tmp;
        cin >> tmp;
        p[tmp]++;
    }

    int m;
    cin >> m;
    bool ok = true;
    irep(i, m) {
        int tmp;
        cin >> tmp;
        if(p[tmp] == 0) { 
            ok = false;
        } else {
            p[tmp]--;
        }
    }

    if(ok) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
    return 0;
}
/** atcoder **/



Measured memory_bytes: 9600
//Atcoder Begineer Contest050
//B - Contest with Drinks Easy
//2018/06/26/11:22

#include<stdio.h>
#define MAX 100

int main(void)
{
  int i,j;
  int N,M;
  int res[MAX]={};
  int T[MAX],P[MAX],X[MAX];

  scanf("%d",&N);

  for(i=0;i<N;i++){
    scanf("%d",&T[i]);
  }

  scanf("%d",&M);

  for(i=0;i<M;i++){
    scanf("%d %d",&P[i],&X[i]);
  }

  for(i=0;i<M;i++){
    for(j=0;j<N;j++){
      if(P[i]-1==j){
        res[i] += X[i];
      }
      else{
        res[i] += T[j];
      }
    }
  }

  for(i=0;i<M;i++){
    printf("%d\n",res[i]);
  }

  return 0;
}


Measured memory_bytes: 128
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

H, W = map(int, input().split())
A = [list(map(int, input().split())) for _ in range(H)]

ans = []


def root(s, g):
    sx, sy = s
    gx, gy = g

    sx += 1
    sy += 1
    gx += 1
    gy += 1

    while sx != gx or sy != gy:
        if sy % 2 == 0 and sx == 1:
            ans.append((sy, sx, sy + 1, sx))
            sy += 1
        elif sy % 2 == 1 and sx == W:
            ans.append((sy, sx, sy + 1, sx))
            sy += 1
        else:
            if sy % 2 == 1:
                ans.append((sy, sx, sy, sx + 1))
                sx += 1
            else:
                ans.append((sy, sx, sy, sx - 1))
                sx -= 1


s = None
for h in range(H):
    if h % 2 == 0:
        for w in range(W):
            if A[h][w] % 2 == 1:
                if s:
                    root(s, (w, h))
                    A[h][w] -= 1
                    A[s[1]][s[0]] += 1
                    s = None
                    pass
                else:
                    s = (w, h)
    else:
        for w in range(W - 1, -1, -1):
            if A[h][w] % 2 == 1:
                if s:
                    root(s, (w, h))
                    A[h][w] -= 1
                    A[s[1]][s[0]] += 1
                    s = None
                    pass
                else:
                    s = (w, h)


l = len(ans)
print(l)
for a in ans:
    print(*a)

Measured memory_bytes: 25276
#include <bits/stdc++.h>
#define ll long long
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
using P = pair <int, int>;
 
 
int main(){
    
   int a,b,c,d;
   cin >> a>>b>>c>>d;

   if(a+b>c+d)cout << "Left" <<endl;
   else if(a+b==c+d) cout << "Balanced" <<endl;
   else cout << "Right" <<endl;
}

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

int main(){
    int a, b;
    cin >> a >> b;
    string s = "", t = "";
    for(int i = 0; i < b; i++)  s += to_string(a);
    for(int i = 0; i < a; i++)  t += to_string(b);
    cout << min(s,t) << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
    int n,j,k;
    cin>>n;
    int arr[n-1],temp[n-1];
    for(int i=0;i<n;i++)
    {
        cin>>arr[i];
    }
    for(j=n-1,k=0;j>=0;j--,k++)
    {
        temp[k]=arr[j];
        cout<<temp[k];
        if(k<n-1)
        {
            cout<<" ";
        }
    }
   cout<<endl;
    return 0;

}



Measured memory_bytes: 3112
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>

using namespace std;
using ull = unsigned long long;
using ll = long long;
using lli = long long int;
using ld = long double;
using pa = pair<int,int>;
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define GRESORT(v) sort(v.begin(),v.end(),greater<int>())
#define REVERSE(v) reverse(v.begin(),v.end())
#define overlap(v) v.erase(unique(v.begin(),v.end()),v.end())
#define debug(x) cout << #x << ": " << x << endl
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,n) FOR(i,0,n)
#define RFOR(i,a,b) for(int i = (b-1); i >= a; i--)
#define rrep(i,n) RFOR(i,0,n)
#define INF 999999999

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

//8??????
//int dy[]={0,0,1,-1,1,1,-1,-1};
//int dx[]={1,-1,0,0,1,-1,1,-1};

ll mod = (ll)1e9+7;

void solve(){
    ll n; cin >> n;
    ll ans = 100000;
    rep(i,n){
        ans *= 1.05;
        if(ans % 1000){
            ans -= ans % 1000;
            ans += 1000;
        }
    }
    cout << ans << endl;
}

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

    solve();

    return 0;
}

Measured memory_bytes: 3088
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	if((abs(a-b)<=d&&abs(c-b)<=d)||abs(a-c)<=d)
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 764
#pragma warning disable IDE0011
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using static System.Math;
using static Extentions;

class IO
{
    int idx;
    string[] line;

    public void R(params char[] sep) { line = Console.ReadLine().Split(sep); idx = 0; }
    public string S => line[idx++];
    public string[] Ss => line.Skip(idx++).ToArray();
    public char C => char.Parse(line[idx++]);
    public char[] Cs => line.Skip(idx++).Select(char.Parse).ToArray();
    public int I => int.Parse(line[idx++]);
    public int[] Is => line.Skip(idx++).Select(int.Parse).ToArray();
    public long L => long.Parse(line[idx++]);
    public long[] Ls => line.Skip(idx++).Select(long.Parse).ToArray();
    public double F => double.Parse(line[idx++]);
    public double[] Fs => line.Skip(idx++).Select(double.Parse).ToArray();
    public decimal D => decimal.Parse(line[idx++]);
    public decimal[] Ds => line.Skip(idx++).Select(decimal.Parse).ToArray();
    public BigInteger B => BigInteger.Parse(line[idx++]);
    public BigInteger[] Bs => line.Skip(idx++).Select(BigInteger.Parse).ToArray();

    public void Write(params object[] xs)
    {
        Console.Write(xs.First());
        foreach (var x in xs.Skip(1)) Console.Write(" " + x);
        Console.WriteLine();
    }
}

static class Extentions
{
}

static class Program
{
    static void Main()
    {
        Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
        Solve(new IO());
        Console.Out.Flush();
    }

    static void Solve(IO io)
    {
        io.R(); var n = io.I;
        var a = new int[n + 1];
        for (var i = 1; i <= n; i++) { io.R(); a[i] = io.I; }

        var set = new HashSet<int> { 1 };
        var next = 1;
        var cnt = 0;

        while (true)
        {
            cnt++;
            next = a[next];

            if (next == 2)
            {
                io.Write(cnt);
                return;
            }
            if (!set.Add(next))
            {
                io.Write(-1);
                return;
            }
        }
    }
}

Measured memory_bytes: 20180
///AJoy Sarker ,CSE JAHANGIRNAGAR UNIVERSITY 48 Batch
#include<bits/stdc++.h>
using namespace std;
#define SORT(c) sort((c).begin(),(c).end());
#define pb push_back
#define MP make_pair
#define pii pair<int,int>
#define pcc pair<char,char>
#define pic pair<int,char>
#define pci pair<char,int>
#define VS vector<string>
#define VI vector<int>
#define pi 3.141592653589793
#define ll long long
#define ull unsigned long long
#define w(x) int x;cin>>x;while(x--)
#define fast ios_base::sync_with_stdio(0)
#define sz size()
typedef unsigned long long UL;
template<typename T>inline T  S(T a)
{
    return a*a;
}
template<class T>inline string tostring(T a)
{
    ostringstream os("");
    os << a;
    return os.str();
}
template<typename T>inline ll tolong(T a)
{
    ll res;
    istringstream os(a);
    os>>res;
    return res;
}
template<typename T>inline T gcd(T a, T b)
{
    if (b == 0)return a;
    else return gcd(b, a % b);
}
template<typename T>inline T bigmod(T a, T b, T m)
{
    if (b == 0)return 1;
    else if (b % 2 == 0)return S(bigmod(a, b / 2, m)) % m;
    else return (a % m*bigmod(a, b - 1, m)) % m;
}
const int inf = (int)1e9 + 5;
const ll linf = (ll)1e16 + 5;
const ll modd = (ll)1e9 + 7;
const int mod = 10000007;
/*#define N 20000009
bool prime[N];
vector<ll> prm;
void seive ()
{

    memset(prime, true, sizeof(prime));

    for( ll i=2; i*i<=N; i++)
    {
        if (prime[i] == true)
        {
            prm.pb(i);
            for (ll j=i*i; j<=N; j += i)
                prime[j] = false;
        }
    }
}*/
void pr (int f)
{
    if(f==1)
        cout<<"Yes\n";
    else
        cout<<"No\n";
}
map<int,int>mp;
multiset<string> st;
multiset<string> :: iterator it;

deque <char> q ;
int vis [1000];
int main()
{
    fast ;
    map<char,int>m;
    string s;
    cin >> s;
    for ( char c : s)
    {
        m[c]++;
    }
   int f = 1;
    for(auto it=m.begin();it!=m.end();it++)
    {
        //cout << it->second<<endl;
        if(it->second%2)
            {f = 0;break;}
    }
    pr(f);
}







Measured memory_bytes: 3664
#include <bits/stdc++.h>
using namespace std;
#define int long long   // <-----!!!!!!!!!!!!!!!!!!!

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rrep2(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()

typedef long long ll;
typedef pair<int, int> Pii;
typedef tuple<int, int, int> TUPLE;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
typedef vector<vector<int>> Graph;
const int inf = 1e9;
const int mod = 1e9 + 7;

const int MAX_T = 30;
const int MAX_DAY = 100;

int T, N;
int t[MAX_T];
int m[MAX_DAY]; // the first meeting time of the day
int memo[MAX_DAY][MAX_T];
int dfs(int day, int step) {
    if (day == MAX_DAY) return 0;
    if (memo[day][step] != -1) return memo[day][step];
    if (m[day] < t[step]) return inf;

    return memo[day][step] = min(dfs(day + 1, (step + 1) % T), dfs(day + 1, 0) + 1);
}

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

    while (cin >> T, T) {
        rep(i, T) cin >> t[i];
        cin >> N;
        fill(m, m + MAX_DAY, inf);
        rep(i, N) {
            int D, M;
            cin >> D >> M;
            D--;
            m[D] = min(m[D], M);
        }
        rep(i, MAX_DAY) fill(memo[i], memo[i] + MAX_T, -1);
        cout << dfs(0, 0) << endl;
    }
}

Measured memory_bytes: 3056
#include <algorithm>
#include <iostream>
#include <queue>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

#define MOD 1000000007
#define REP(i, N) for (int i = 0; i < N; ++i)
#define REP1(i, N) for (int i = 1; i <= N; ++i)
#define RREP(i, N) for (int i = N - 1; i >= 0; --i)
#define ALL(a) a.begin(), a.end()

int main() {
  int n, q;
  cin >> n >> q;
  priority_queue<int> que[n];
  REP(i, q) {
    int num, t;
    cin >> num >> t;
    if (num == 0) {
      int x;
      cin >> x;
      que[t].push(x);
    } else if (num == 1) {
      if (que[t].size()) {
        cout << que[t].top() << endl;
      }
    } else {
      if (que[t].size()) {
        que[t].pop();
      }
    }
  }
  return 0;
}


Measured memory_bytes: 4016
public class Main {
	static java.util.Scanner scan = new java.util.Scanner(System.in);
	public static void main(String[] args) {
		StringBuffer input = new StringBuffer(scan.nextLine());
		input.reverse();
		print(input.toString());
	}
	
	public static void print(Object out) {
		System.out.println(out);
	}
}

Measured memory_bytes: 17116
S = input()
if S[0] == 'A':
	if S[2:-1].count('C') == 1:
		if S[-1] == S[-1].lower():
			if S.count('A') == 1:
				if S.replace('A', 'a').replace('C', 'c') == S.lower():
					print('AC')
					exit()
print('WA')

Measured memory_bytes: 3064
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<numeric>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b));i>=((int)(a));i--)
typedef long long ll;
typedef pair<ll, ll> mp;

int main(void){
	int a,b,c,d;
	scanf("%d%d%d%d",&a,&b,&c,&d);
	printf("%d\n",min(a,b)+min(c,d));
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<iostream>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<map>
#include<algorithm>
     
#define INT unsigned long long int
#define FOR1(n) for(int i=0;i<n;i++)
#define FOR2(j, n) for(int j=0;j<n;j++)
#define FOR3(i, m, n) for(int i=m;i<=n;i++)
#define PINT(d) printf("%d", d);
#define PDOUBLE(lf) printf("%lf", lf);
#define PSTR(s) printf("%s", s);
#define ALL(c) c.begin(), c.end()
#define MOD 1000000007
#define MAX_N 100000
     
using namespace std;

main(){
 	map<char, int> m;
   	char c;
   	while(scanf("%c", &c) == 1){
   		if('a' <= c && c <= 'z'){
   			m[c]++;
   		}
   	}
   	bool result = true;
   	for(auto item : m){
   		if(item.second % 2 == 1){
   			result = false;
   			break;
   		}
   	}
    	
   	PSTR(result ? "Yes" : "No")
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int n,m,x[114514],ans,sum;
main(){
    cin>>n>>m;
    if(n<m){
      for(int i=0;i<m;i++)cin>>x[i];
    	sort(x,x+m);
   		for(int i=0;i<m-1;i++){
        	x[i]=x[i+1]-x[i];
        	sum+=x[i];
    	}
    	sort(x,x+m-1);
    	for(int i=0;i<n-1;i++)ans+=x[m-2-i];
    }
    cout<<sum-ans<<endl;
}

Measured memory_bytes: 640