akhauriyash/Code-Regression huggingface dataset:
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Spandan Mishra
 */
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);
        AABCSwap solver = new AABCSwap();
        solver.solve(1, in, out);
        out.close();
    }

    static class AABCSwap {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int x = in.readInt();
            int y = in.readInt();
            int z = in.readInt();

            out.println(z + " " + x + " " + y);
        }

    }

    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 RuntimeException();
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new RuntimeException();
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int readInt() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

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

    }
}



Measured memory_bytes: 20692
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())
        
n,m = map(int,input().split())
abl = []
for _ in range(m):
    a,b = map(int,input().split())
    abl.append((a,b))
    
uf = UnionFind(n)

ansl = [0]
point = 0
for a,b in abl[::-1]:
    if uf.same(a-1, b-1) == False:
        before_size1 = uf.size(a-1)
        before_size2 = uf.size(b-1)
        uf.union(a-1, b-1)
        new_size = uf.size(a-1)
        point += (new_size * (new_size - 1) // 2) - (before_size1 * (before_size1 - 1) // 2) - (before_size2 * (before_size2 - 1) // 2)
    ansl.append(point)

for i in range(m):
    print(ansl[-1] - ansl[m-i-1])
    
    
    
    
    
    

Measured memory_bytes: 115288
#include "bits/stdc++.h"
using namespace std;
int main()
{
	int a,b;
	scanf("%d %d",&a,&b);
	if(a>b)
	{
		printf("%d\n",a-1);
	}
	else
	{
		printf("%d\n",a);
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#ifdef DEMETRIO
#define deb(...) fprintf(stderr,__VA_ARGS__)
#define deb1(x) cerr << #x << " = " << x << endl
#else
#define deb(...) 0
#define deb1(x) 0
#endif
#define pb push_back
#define mp make_pair
#define fst first
#define snd second
#define fore(i,a,b) for(int i=a,ThxDem=b;i<ThxDem;++i)
#define SZ(x) ((int)x.size())
using namespace std;
typedef long long ll;

int n;
pair<ll,ll> x[5005]; // p,h
vector<int> r;
vector<ll> s;

int main(){
	scanf("%d",&n);
	fore(i,0,n){
		ll h,p;
		scanf("%lld%lld",&h,&p);
		x[i]=mp(p,h);
	}
	sort(x,x+n);
	s.pb(0);
	fore(i,0,n){
		vector<int> rr=r;
		vector<ll> ss=s;
		rr.pb(i);
		ss.pb(ss.back()+x[i].fst);
		int k=SZ(rr)-1; // pos
		bool can=true;
		while(ss[k]>x[i].snd){
			assert(rr[k]==i);
			swap(rr[k],rr[k-1]);
			ss[k]=ss[k-1]+x[rr[k-1]].fst;
			if(ss[k]>x[rr[k]].snd){can=false;break;}
			k--;
		}
		if(can){
			assert(rr[k]==i);
			while(k>0){
				assert(rr[k]==i);
				ll ms=x[i].snd-ss[k];
				assert(ms>=0);
				ll ms2=x[rr[k-1]].snd-(ss[k-1]+x[i].fst);
				if(ms>=ms2)break;
				swap(rr[k],rr[k-1]);
				ss[k]=ss[k-1]+x[rr[k-1]].fst;
				k--;
			}
			r=rr;s=ss;
		}
	}
	printf("%d\n",SZ(r));
	return 0;
}

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

using namespace std;

using LL = long long;
const LL MOD = (LL)1e9 + 7;
const LL NS = (LL)2e5 + 4;
LL N;
LL A[NS], B[NS], tpow[NS];
map < pair < LL, LL >, LL > cnt;

int main(){
//    freopen("input.txt", "r", stdin);
    tpow[0] = 1;
    for(int i = 1; i < NS; ++i){
        tpow[i] = tpow[i - 1] * 2 % MOD;
    }
    for(int i = 0; i < NS; ++i){
        --tpow[i];
        if(tpow[i] < 0) tpow[i] += MOD;
    }
    scanf("%lld", &N);
    LL ans = 1, ans2 = 0;
    for(LL i = 0; i < N; ++i){
        scanf("%lld %lld", A + i, B + i);
        if(A[i] == B[i] && !A[i]){
            ++ans2;
            continue;
        }
        if(B[i] == 0){
            ++cnt[{(LL)3e18, (LL)3e18}];
            continue;
        }
        LL absA = abs(A[i]), absB = abs(B[i]);
        LL gcd = __gcd(absA, absB);
        if(B[i] < 0){
            B[i] *= -1, A[i] *= -1;
        }
        if(A[i] == 0){
            B[i] = 1; gcd = 1;
        }
        ++cnt[{A[i] / gcd, B[i] / gcd}];
    }
    for(auto&div:cnt){
        if(!div.second){
            continue;
        }
        if(!div.first.first){
            ans *= tpow[div.second] + tpow[cnt[{(LL)3e18, (LL)3e18}]] + 1;
            ans %= MOD;
            div.second = cnt[{(LL)3e18, (LL)3e18}] = 0;
            continue;
        }
        pair < LL, LL > now = div.first;
        pair < LL, LL > op = {now.second, -now.first};
        if(op.second < 0){
            op.first *= -1, op.second *= -1;
        }
        LL absA = abs(op.first), absB = abs(op.second);
        LL gcd = __gcd(absA, absB);
        op = {op.first / gcd, op.second / gcd};
        ans *= tpow[div.second] + tpow[cnt[op]] + 1;
        div.second = cnt[op] = 0;
        ans %= MOD;
    }
    --ans; ans += ans2; ans %= MOD;
    if(ans < 0) ans += MOD;
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 33364
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  
  sort(a.begin(), a.end());

  cout << a[n / 2] - a[n / 2 - 1];
}

Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>
#include <iomanip>
#include <map>
using namespace std;


void solve(){
  int a, b; cin >> a >> b;
  if(a >= 13) cout << b << endl;
  else if(a >= 6) cout << b / 2 << endl;
  else cout << 0 << endl;
  return;
}

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;using ll=long long;using vi=vector<int>;using vvi=vector<vi>;using vl=vector<ll>;using vvl=vector<vl>;using P=pair<int,int>;using PL=pair<ll,ll>;using vp=vector<P>;using vpl=vector<PL>;
template<typename T>constexpr auto inf=numeric_limits<T>::max()/2;constexpr int INF=inf<int>,MOD=1000000007;constexpr ll LINF=inf<ll>;
#define _ol3(_1,_2,_3,name,...)name
#define _rep(i,n)_repi(i,0,n)
#define _repi(i,a,b)for(int i=a,i##_l=(b);i<i##_l;++i)
#define REP(...)_ol3(__VA_ARGS__,_repi,_rep,)(__VA_ARGS__)
#define REPR(i,n)for(int i=n-1;i>=0;--i)
#define REPA(i,v)REP(i,(v).size())
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define bit(n)(1ll<<(n))
#define F first
#define S second
#define endl '\n'
#define cho(n,a,b)cout<<((n)?a:b)<<endl
void YES(int n){cho(n,"YES","NO");}void Yes(int n){cho(n,"Yes","No");}void Poss(int n){cho(n,"Possible","Impossible");}
void _print(ostream&){}template<class T,class...U>void _print(ostream&s,const T&t,const U&...u){s<<t<<(sizeof...(u)?' ':'\n');_print(s,u...);}
template<class...T>void print(const T&...t){_print(cout,t...);}template<class...T>void dprint(const T&...t){_print(cerr,t...);}
#ifndef LOCAL
struct osd{template<class T>osd&operator<<(const T&t){return*this;}};osd cer_;
#define dprint(...)
#define cerr cer_
#endif
template<class T>bool chmax(T&a,const T&b){bool x=a<b;x?a=b:b;return x;}template<class T>bool chmin(T&a,const T&b){bool x=a>b;x?a=b:b;return x;}
template<class T,class U>ostream&operator<<(ostream&o,const pair<T,U>&p){return o<<p.F<<' '<<p.S;}
template<class T,class U>istream&operator>>(istream&i,pair<T,U>&p){return i>>p.F>>p.S;}
template<class T>class iterable{static false_type c(string v);template<class U>static auto c(U v)->decltype(all(v),true_type());static false_type c(...);public:const static bool value=decltype(c(declval<T>()))::value;};
template<class T,typename=enable_if_t<iterable<T>::value>>ostream&operator<<(ostream&o,const T&v){for(auto&&i:v)o<<i<<' ';return o;}
template<class T>istream&operator>>(istream&i,vector<T>&v){for(T&j:v)i>>j;return i;}
template<class T>vector<T>&operator<<(vector<T>&v,const T&t){v.push_back(t);return v;}
template<class T>set<T>&operator<<(set<T>&v,const T&t){v.insert(t);return v;}
template<class T>multiset<T>&operator<<(multiset<T>&v,const T&t){v.insert(t);return v;}

int main(){
    cin.tie(0);ios::sync_with_stdio(0);
    int n;
    cin>>n;
    vi a(n);
    cin>>a;
    vi last(20,-1);
    vi ma(n, n);
    REP(i,n){
        REP(j,20){
            if(a[i]&bit(j)){
                if(last[j]>=0){
                    chmin(ma[last[j]], i);
                }
                last[j]=i;
            }
        }
    }
    int mi=INF;
    ll ans=0;
    REPR(i,n){
        chmin(mi,ma[i]);
        ans+=mi-i;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>                          
using namespace std;    
string s;
int num;
int main(){	
	cin>>s;
	if(s[0]!='A') {cout<<"WA";return 0;}
	if(s[1]>'A'&&s[1]<='Z') {cout<<"WA";return 0;}
	for(int i=2;i<s.size()-1;i++)
	{
		if(s[i]=='C') num++;
		if(num==2){cout<<"WA";return 0;}
		if((s[i]>'A'&&s[i]<='Z'&&s[i]!='C')) {cout<<"WA";return 0;}
	}
	if((s[s.size()-1]>'A'&&s[s.size()-1]<='Z')||num==0) {cout<<"WA";return 0;}
    cout<<"AC";
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
#define pq_pair_tB priority_queue <pair<ll,ll>, vector<pair<ll,ll> > , greater<pair<ll,ll> > >
#define pq_pair_ts priority_queue <pair<ll,ll> > //第二成分の大きさが関係ない
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}
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;}

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

	int N ;
	int D;
	cin >> N >> D;
	if(D==100) D = 101;
	ll ans = D*pow(100, N) ;
	cout << ans  << endl;



	//cout << fixed << setprecision(16) << ans << endl;
	return 0;
}


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

const int N = 100000;
const int NIL = -1;

int n;
vector<int> G[N];
int color[N];

void dfs(int r, int c){
    stack<int> S;
    S.push(r);
    color[r] = c;

    while(!S.empty()){
        int x = S.top(); S.pop();
        for(int i = 0; i < G[x].size(); i++){
            int v = G[x][i];
            if(color[v] == NIL){
                color[v] = c;
                S.push(v);
            }
        }
    }
}

void solve(){
    int id = 1;
    for(int i = 0; i < n; i++)  color[i] = NIL;
    for(int u = 0; u < n; u++){
        if(color[u] == NIL) dfs(u, id++);
    }
}

int main(){
    int q, s, t;
    cin >> n >> q;

    while(q-- > 0){
        cin >> s >> t;
        G[s].push_back(t);
        G[t].push_back(s);
    }

    solve();

    cin >> q;
    while(q-- > 0){
        cin >> s >> t;
        if(color[s] == color[t])    cout << "yes" << endl;
        else                        cout << "no" << endl;
    }

    return 0;
}


Measured memory_bytes: 8892
#include<string>
#include<iostream>
#include<algorithm>
#include<set>
#include<math.h>
#include<vector>
#include<sstream>
#include<queue>
#include<functional>
#include<bitset>
#include<cstdio>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include <string.h>
using ll = long long;

#define rep(i, n) for(ll i = 0; i < (int)(n); i++)
#define reps(i,x) for(ll i=1;i<=(int)(x);i++)
#define rrep(i,x) for(ll i=((int)(x)-1);i>=0;i--)
#define rreps(i,x) for(ll i=(int)(x);i>0;i--)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define vll vector<ll>
#define vi vector<int>
#define mp make_pair
#define vpll vector<pair<ll,ll>>
#define vpi vector<pair<int,int>>
#define mod 1000000007 
using namespace std;
ll n, m;
string s[55];

int main() {
	ll h,w;
	cin >> h >> w;
	rep(i, h) {
		cin >> s[i];
	}
	rep(i, h) {
		rep(j, w) {
			if (s[i][j] != '#')continue;
			ll of[] = { 1, 0, -1, 0, 1 };
			bool f = false;
			rep(k, 4) {
				ll y = i + of[k];
				ll x = j + of[k + 1];
				if (x < 0 || y < 0 || y >= h || x >= w)continue;
				if (s[y][x] == '#')
				{
					f = true;
					break;
				}
			}
			if (!f) {
				cout << "No" << endl;
				return 0;
			}
		}
	}
	cout << "Yes" << endl;

	return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline

S = '-' + input().rstrip()
N = len(S) - 1

def solve(S):
    if S[1] == '0':
        print(-1)
        exit()
    if S[N] == '1':
        print(-1)
        exit()
    prev = 1
    graph = []
    for n in range(1,N//2 + 1):
        if S[n] != S[N-n]:
            print(-1)
            exit()
        if S[n] == '0':
            continue
        for i in range(prev,n):
            graph.append('{} {}'.format(i,n))
        prev = n
    for i in range(prev,N):
        graph.append('{} {}'.format(i,N))
    return graph

graph = solve(S)

if graph is None:
    print(-1)
else:
    print('\n'.join(graph))


Measured memory_bytes: 14232
import java.util.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        //入力
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
      	//Bの配列格納
        int[] B = new int[N-1];
        for (int i = 0; i < (N-1); ++i){
            B[i]= sc.nextInt();
        }
        
        int sum = B[0] + B[N-2];
      	
        for (int i = 0; i < (N-2); ++i){
          	//比較して小さい方を加算
            sum += Math.min(B[i],B[i+1]);
        }
        
        //出力
        System.out.println(sum);
        
    }
}

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

namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var kn = Console.ReadLine().Split().Select(s => int.Parse(s)).ToArray();
            var a = Console.ReadLine().Split().Select(s => int.Parse(s)).ToArray();
            int k = kn[0];
            int n = kn[1];
            int max = 0;
            

            for (int i = 0; i < n; i++)
            {
                int temp = (i == n - 1) ? Math.Abs(k - a[i] + a[0]) : a[i + 1] - a[i];
                if(max <= temp) max = temp;

            }
           
            Console.WriteLine(k - max);

        }
    }
}


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

typedef pair <int, int> ii;

#define MAX 100000000

int k, digits;
int seven, cur;
int ans;

int main() {
	scanf("%d", &k);
	digits = log10(k);
	for (int i = 0; i < digits; i++) {
		seven = seven * 10 + 7;
	}
	if (k > seven) seven = seven * 10 + 7;
	for (int j = 0; j < 10000000; j++) {
        int temp = cur;
		for (int i = 0; i < 10; i++) {
			if (temp + k * i <= seven) cur = temp + k * i;
		}
		//printf("%d, %d\n", cur, seven);
		if (cur == seven) {
			printf("%d\n", ans + (int) log10(cur) + 1);
			return 0;
		}
		cur *= 10; seven = seven * 10 + 7;
		if (cur >= MAX) {
			ans++;
			cur %= MAX;
			seven %= MAX;
		}
	}
	printf("-1\n");
	return 0;
}


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

#define eps 1e-8
#define PI acos(-1.0)
#define INF 0x3f3f3f3f
#define FAST_IO ios::sync_with_stdio(false)
const int N=1e5+10;

typedef long long LL;
int prime[N];
bool is_prime[N+1];

int sieve(int n){
    int p=0;
    for(int i=0;i<=n;i++) is_prime[i]=1;
    is_prime[0]=is_prime[1]=0;
    for(int i=2;i<=n;i++){
        if(is_prime[i]){
            prime[p++]=i;
            for(int j=2*i;j<=n;j+=i) is_prime[j]=0;
        }
    }
    return p;
}

int ans[N];

bool check(int num){
    int cnt=0;
    for(int k=1;k<=5;k++){
        int sum=ans[1]+ans[2]+ans[3]+ans[4]+ans[5];
        sum-=ans[k];sum+=num;
        for(int i=2;i*i<=sum;i++){
            if(sum%i==0) {cnt++;break;}
        }
    }
    if(cnt==5) return true;
    return false;
}

int main(){
    int cnt=sieve(55556);//5637个素数
    int n;
    cin>>n;
    vector <int> ans;
    for(int i=1;i<=5000;i++){
        if(ans.size()==n) break;
        if(prime[i]%10==3) ans.push_back(prime[i]);
    }
    for(int i=0;i<n;i++){
        if(i!=n-1) cout<<ans[i]<<" ";
        else cout<<ans[i]<<endl;
    }

    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define pb push_back
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using vi = vector<int>;
using pii = pair<ll, ll>;
const int INF = 0x3f3f3f3f;
int a[1005];
int main() {
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < n; i++)
    cin >> a[i];
  sort(a, a + n);
  int sum = 0;
  for (int i = 0; i < k; i++)
    sum += a[i];
  cout << sum << endl;
}

Measured memory_bytes: 3624
//It is made by wfj_2048~
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <vector>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#define inf (1<<30)
#define il inline
#define RG register
#define ll long long

using namespace std;

int a[1010],n;

il int gi(){
    RG int x=0,q=1; RG char ch=getchar(); while ((ch<'0' || ch>'9') && ch!='-') ch=getchar();
    if (ch=='-') q=-1,ch=getchar(); while (ch>='0' && ch<='9') x=x*10+ch-48,ch=getchar(); return q*x;
}

il void work(){
    n=gi(); for (RG int i=1;i<=n;++i) a[i]=gi();
    sort(a+1,a+n+1); printf("%d\n",a[n]-a[1]);
}

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using i64 = long long;
using std::cout;
using std::endl;
using std::cin;

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


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

int main(){
    int a, b;
    int ans = 0;
    cin >> a >> b;
    string s;
    string r_s = "";
    for (int num = a; num < b + 1; num ++){
        r_s = "";
        s = to_string(num);
        for (int i = 0; i < s.size(); i ++){
            r_s += s[s.size() - 1 - i];
        }
        if (s == r_s){
            ans += 1;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3636
n,m,x=map(int,input().split())
a=list(map(int,input().split()))
cost=[0,0]
for i in range(x,n+1):
    for j in a:
        if i==j:
            cost[1]+=1
for i in range(0,x):
    for j in a:
        if i==j:
            cost[0]+=1
print(min(cost))

Measured memory_bytes: 3060
#![allow(non_snake_case, unused)]
use std::cmp::*;
use std::collections::*;
use std::f64::consts::*;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

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

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

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

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

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

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

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

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

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

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

fn main() {
    input!{
        n: usize,
        mut h: [i64; n],
    }
    h.reverse();
    let mut acc = h[0];
    for i in 1..n {
        if h[i] <= acc {
            acc = h[i];
            continue;
        } else if h[i] - acc <= 1 {
            acc = h[i]-1;
            continue;
        } else {
            return println!("No")
        }
    }
    println!("Yes");
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)

using namespace std;

int N, K, R, S, P;

int getScore(char ch) {
	if (ch == 'r')return P;
	else if (ch == 's')return R;
	else if (ch == 'p')return S;
	else return 0;
}

int main() {
	string T;
	cin >> N >> K >> R >> S >> P >> T;

	int ans = 0;
	rep(i, K) {
		int count = 0;
		int sameCount = 0;
		char preCh = 'a';
		while (true) {
			char ch = T[i + count * K];
			if (preCh == ch)sameCount++;
			else {
				ans += getScore(preCh) * ((sameCount + 2) / 2);
				sameCount = 0;
			}
			preCh = ch;
			count++;
			if (i + (count) * K > N - 1) {
				ans += getScore(ch) * ((sameCount + 2) / 2);
				//cout << ans << endl;
				break;
			}
			//cout << ans << endl;
		}
	}
	cout << ans;
}

Measured memory_bytes: 512
//#include <tourist>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = 1e9;
const ll LINF = ll(1e18);
const int MOD = 1000000007;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define rep(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define debug(v)          \
    cout << #v << ":";    \
    for (auto x : v)      \
    {                     \
        cout << x << ' '; \
    }                     \
    cout << endl;
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;
}
//cout<<fixed<<setprecision(15);有効数字15桁
//-std=c++14
//-std=gnu++17
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
ll n, m;
vector<ll> a, b;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n;
    a.resize(100);
    a[0]=2;
    a[1]=1;
    for(int i=2;i<=n;i++){
        a[i]=a[i-1]+a[i-2];
    }
    cout << a[n]<< "\n";
}


Measured memory_bytes: 256
/**
 *      purpose : ABC 124 C
 *      author  : kyomukyomupurin
 *      created : 
**/

// input/output
#include <iostream>
#include <fstream>
#include <sstream>
// container class
#include <array>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
// math, algorithm
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
// etc
#include <bitset>
#include <cctype>
#include <cstring>
#include <chrono>
#include <iomanip>
#include <random>
#include <utility>
// using-directive
using namespace std;
// alias template
using int64 = int64_t;
using pii = pair<int, int>;
using pll = pair<int64_t, int64_t>;
// text macro replacement
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define print(x) cout << (x) << '\n'
#define debug(x) cout << #x << ": " << (x) << '\n'

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

  string s; cin >> s;
  int b1 = 0, w1 = 0, b2 = 0, w2 = 0;
  int n = s.size();

  // 偶数を'0'
  for (int i = 0; i < n; ++i){
    if (i % 2 == 0 && s[i] == '1') ++b1;
    if (i % 2 == 1 && s[i] == '0') ++w1;
  }

  // 奇数を'1'
  for (int i = 0; i < n; ++i){
    if (i % 2 == 0 && s[i] == '0') ++w2;
    if (i % 2 == 1 && s[i] == '1') ++b2;
  }
  print(min(b1 + w1, b2 + w2));

  return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<string>
using namespace std;
int koyaku(int n,int m)
{
  //nの方が大きい
  if(n<m) swap(n,m);
  int r;
  while((r=n%m)!=0)
  {
    n=m;
    m=r;
  }
  return m;
}

int main()
{
  int n,y;
  cin>>n>>y;
  vector<int> x(n),det(n);
  for(int i=0;i<n;i++)
  {
    cin>>x[i];
    det[i]=max(x[i],y) -min(x[i],y);
  }

  int ans=det[0];
  for(int i=0;i<n;i++)
  {
    ans=koyaku(ans,det[i]);
  }

  cout<<ans<<endl;
}

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

using namespace std;

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

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

#define DEBUG(x) cout<<#x<<": "<<x<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

#define CHMIN(a, b) a=min((a), (b))
#define CHMAX(a, b) a=max((a), (b))

const ll MOD=1000000007ll;
// const ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-11;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll n;
	cin>>n;
	if(n==0){
		cout<<n<<'\n';
		return 0;
	}
	ll b=1;
	string ans="";
	while(n){
		if(n%(b*(-2))){
			n-=b;
			ans='1'+ans;
		}
		else{
			ans='0'+ans;
		}
		b*=-2;
	}
	cout<<ans<<'\n';
	return 0;
}


Measured memory_bytes: 256
num = input().split()
a = int(num[0])
b = int(num[1])
c = int(num[2])

if a > b:
    sub = a
    a = b
    b = sub
    
if a > c:
    sub = a
    a = c
    c = sub

if b > c:
    sub = b
    b = c
    c = sub
    
print(a, b, c)


Measured memory_bytes: 5596
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long
int dp[3010][3010];

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    string S; cin >> S;
    rep(i, N) dp[0][i] = 1;
    rep(i, N) {
        if(S[i] == '>') {
            rep(j, N - i - 1) {
                dp[i + 1][j] = dp[i][j];
                if (j != 0) dp[i + 1][j] += dp[i + 1][j - 1];
                dp[i + 1][j] %= mod;
            }
        } else {
            rrep(j, N - i - 2) {
                dp[i + 1][j] = (dp[i][j + 1] + dp[i + 1][j + 1]) % mod;
            }
        }
    }
    cout << dp[N - 1][0] << endl;

    return 0;
}


Measured memory_bytes: 70016
N = int(input())
A = list(map(int, input().split()))

cnt = [0] * (10 ** 5 + 1)
for a in A:
  cnt[a] += 1

cnt2 = 0
answer = 0
for i in range(10 ** 5 + 1):
  if cnt[i]:
    answer += 1
  if cnt[i] > 1 and cnt[i] % 2 == 0:
      cnt2 += 1
print(answer if cnt2 % 2 == 0 else answer - 1)

Measured memory_bytes: 52916
n = int(input())
if n < 3:
  print(0)
else:
  s = list(map(int, input().split()))
  c = 0
  for i in range(n):
    for j in range(i+1, n):
      for k in range(j+1, n):
        m = max(s[i], s[j], s[k])
        su = s[i] + s[j] + s[k]
        if m < su - m and s[i] != s[j] and s[j] != s[k] and s[k] != s[i]:
          c += 1
  print(c)

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

int main() {
  std::size_t n, m;
  std::cin >> n >> m;

  std::vector<std::size_t> a(n);
  for (std::size_t i = 0; i < n; ++i) std::cin >> a[i];

  std::sort(a.begin(), a.end());

  // std::vector<std::size_t> b(m);
  // std::vector<std::size_t> c(m);
  // std::vector<std::size_t> ids(m);
  // for (std::size_t i = 0; i < m; ++i) std::cin >> b[i] >> c[i];
  // for (std::size_t i = 0; i < m; ++i) ids[i] = i;
  // std::sort(ids.begin(), ids.end(),
  //           [&c](auto i, auto j) { return c[i] > c[j]; });
  //
  // std::size_t k = 0;
  // for (std::size_t i = 0; i < m; ++i) {
  //   const auto id = ids[i];
  //   const auto bi = b[id];
  //   const auto ci = c[id];
  //   for (std::size_t j = 0; j < bi; ++j) {
  //     if (a[k] < ci)
  //       a[k++] = ci;
  //     else
  //       break;
  //   }
  // }

  std::vector<std::pair<std::size_t, std::size_t>> pairs(m);
  for (auto&& pair : pairs) std::cin >> pair.first >> pair.second;
  std::sort(pairs.begin(), pairs.end(), [](const auto& p1, const auto& p2) {
    return p1.second > p2.second;
  });

  std::size_t k = 0;
  for (auto&& pair : pairs) {
    const auto b = pair.first;
    const auto c = pair.second;
    for (std::size_t j = 0; j < b; ++j) {
      if (a[k] < c)
        a[k++] = c;
      else
        break;
    }
  }

  const auto sum = std::accumulate(a.begin(), a.end(), 0ull);
  std::cout << sum << std::endl;
}


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

typedef long long ll;
typedef unsigned int ui;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<long long> vll;

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

    int n;    
    cin >> n;
    vector<double> p(n);
    vector<vector<double>> dp(n + 1, vector<double>(n + 1));
    for (int i = 0; i < n; ++i) {
        cin >> p[i];
    }

    dp[0][0] = 1;
    for (int i = 1; i <= n; ++i) {
        dp[i][0] = (1 - p[i - 1]) * dp[i - 1][0];
        for (int j = 1; j <= i; ++j) {
            dp[i][j] = p[i - 1] * dp[i - 1][j - 1] + (1 - p[i - 1]) * dp[i - 1][j];
        }
    }

    double ans = 0;
    for (int i = (n - 1)/2 + 1; i <= n; ++i) {
        ans += dp[n][i];
    }
    cout << setprecision(12) << ans << '\n';

    return 0;
}

Measured memory_bytes: 70784
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pull = pair<ull, ll>;
using pis = pair<int, string>;
#define all(x) (x).begin(), (x).end()
#define INF 1000000000
#define LLINF 10000000000000000ll
#define MOD 1000000007ll

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  //cout << fixed << setprecision(15)
  int n;
  cin >> n;
  vector<ll> dist1, dist2;
  for (int i = 0; i < n; i++) {
    ll x, y;
    cin >> x >> y;
    dist1.emplace_back(x + y);
    dist2.emplace_back(1000000000LL - x + y);
  }
  sort(all(dist1)); sort(all(dist2));
  cout << max(dist1[n-1] - dist1[0], dist2[n-1] - dist2[0]) << endl;
}


Measured memory_bytes: 6692
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<string>
#include<vector>
#include<list>
#include<set>
#include<cctype>
#include<stack>
#define ld long double
#define ll long long int
#define ull unsigned long long int
using namespace std;
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;}
const long long INF=1LL<<60;
//set<int>::iterator it;

int main(void){
    int r;
    cin>>r;
    cout<<3*r*r<<endl;

    return 0;
}


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


int main(){

  int N, K;
  cin >> N >> K;
  string S;
  cin >> S;

  if(S[K-1] == 'A') S[K-1] = 'a';
  if(S[K-1] == 'B') S[K-1] = 'b';
  if(S[K-1] == 'C') S[K-1] = 'c';

  cout << S << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld; 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	string s; cin>>s;
	cout<<s.substr(0,5)<<' '<<s.substr(6,7)<<' '<<s.substr(14,5)<<'\n';
}


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

using namespace std;

#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define repn(i, n) for(int (i) = 1; (i) <= (n); (i)++)
#define repr(i, n) for(int (i) = (n-1); (i) >= 0; (i)--)
#define all(x) (x).begin(), (x).end()
#define lint long long

int main(){
    int n; cin >> n;
    vector<lint> v;
    rep(i, n){
        lint x; cin >> x;
        v.push_back(x - i);
    }
    sort(all(v));
    lint res = 0;
    rep(i, n){
        if(n % 2 == 0){
            if(i < n / 2) res -= v[i];
            else res += v[i];
        }
        else{
            int mid = (n-1)/2;
            if(i < mid) res -= v[i];
            else if(i > mid) res += v[i];
        }
    }
    cout << res << endl;
}

Measured memory_bytes: 2420
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cstring>
#include <cmath>
#include <climits>
#include <deque>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <array>
#include <bitset>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
using namespace std;
#define io() ios_base::sync_with_stdio(false); cin.tie(nullptr)
#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define us unsigned short
#define fi first
#define se second
#define IN(i,l,r) (l<i&&i<r)
#define LINR(i,l,r) (l<=i&&i<=r)
#define LIN(i,l,r) (l<=i&&i<r)
#define INR(i,l,r) (l<i&&i<=r)
#define v(T) vector<T>
#define p(T, N) pair<T, N>
#define tp(A, B, C) tuple<A, B, C>
#define ii p(int, int)
#define vi v(int)
#define vii v(p(int, int))
#define vvi v(v(int))
#define vl v(long long)
#define vll v(p(long long, long long))
#define si set<int>
#define msi map<string, int>
#define rsz(a) resize(a)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define qsort(a) sort(all(a))
#define qsortd(a) sort(all(a), greater<>())
#define qsortf(a, f) sort(all(a), f)
#define qsortsi(v) sort(v.begin(), v.end(), [](pair<int, int> a, pair<int, int> b){return a.se < b.se;})
#define pb(n) push_back(n)
#define eb(n) emplace_back(n)
#define pp(a, b) emplace_back(make_pair(a, b))
#define pt(a, b, c) emplace_back(make_tuple(a, b, c))
#define elif else if
#define fori(i, n) for(ll i = 0; i < n; ++i)
#define foris(i, a, b) for(ll i = a; i < b; ++i)
#define forise(i, a, b) for(ll i = a; i <= b; ++i)
#define ford(i, n) for(ll i = n; i >= 0; --i)
#define fords(i, a, b) for(ll i = a; i >= b; --i)
#define fordse(i, a, b) for(ll i = a; i > b; --i)
#define fora(i, a) for (auto &i: a)
#define rev(a) reverse(a.begin(), a.end())
#define revf(a, b, c) (reverse(a.begin() + b, a.begin() + c))
#define umap unordered_map
#define uset unordered_set
#define pq(T) priority_queue<T>
#define rpq(T) priority_queue<T, vector<T>, greater<T> >
#define nl '\n'
#define fileio(in, out) freopen(in, "r", stdin); freopen(out, "w", stdout)
const int mod = 1000000007;
int digits(int n) {
  n = abs(n);
  if(n < 10) return 1;
  elif(n < 100) return 2;
  elif(n < 1000) return 3;
  elif(n < 10000) return 4;
  elif(n < 100000) return 5;
  elif(n < 1000000) return 6;
  elif(n < 10000000) return 7;
  elif(n < 100000000) return 8;
  elif(n < 1000000000) return 9;
  else return 10;
}


int main() {
  io();
  
  int n;
  cin >> n;
  uset<int> arr;
  fori(i, n) {
    int a;
    cin >> a;
    arr.insert(a);
  }
  
  if(arr.size() == n) cout << "YES";
  else cout << "NO";
  
  return 0;
}

Measured memory_bytes: 8520
n=int(input())
s=[]
t=[]
ans=0
for i in range(n):
    s.append(input())
m=int(input())
for i in range(m):
    t.append(input())
for i in range(n):
    ans=max(ans,s.count(s[i])-t.count(s[i]))
print(ans)

Measured memory_bytes: 3064
using System;
using System.Collections.Generic;
	class Program
	{
		public static void Main(string[] args)
		{
			int n=int.Parse(Console.ReadLine());
			int[] array= new int[n];
			for(int k=0;k<n;k++)
			{
				array[k]=int.Parse(Console.ReadLine());
			}
			int cnt=0;
			int m=1;//?????£??????????????°???h=3???m?????????/??? h<n???
			List<int> G=new List<int>();//?????£??????????´???????????????£???????????????????????????????????????????????£??????
			G.Add(1);
			int h=0;
			for(int gap=2;(h=(int)((Math.Pow(3,gap)-1)/2))<n;gap++)
			{			
				m++;
				G.Add(h);
			}
			
			/*
			for(int i=0;i<m;i++)
			{
				G.Add((int)((Math.Pow(3,i+1)-1)/2));
			}
*/			
			for(int j=0;j<m;j++)
			{
				cnt+=sort( array, n, G[m-1-j]);//?????\?????????????????????
			}
			//?????????????????????m???????????????G[i]????????????????????§???????????????G?????¨????????´??????count?????????
			//????????????????????????????????????
			Console.WriteLine(m);
			for(int o=0;o<m-1;o++)
			{
				Console.Write(G[m-1-o]+" ");
			}
			Console.Write(G[0]+"\r\n");//???????????§?????????
			Console.WriteLine(cnt);//?????????
			for(int l=0;l<n;l++)
			{
				Console.WriteLine(array[l]);
			
			}
			
			
		}
		public static int sort(int [] A,int n,int g)
		{
			int count=0;//??????????????°
			for (int k=0;k<g;k++)
			{
				
			for(int i=k+g;i<n;i+=g)
			{
				
				int v=A[i];
				int j=i-g;
				while(j>=0&&A[j]>v)
				{
					A[j+g]=A[j];
					j=j-g;
				count ++; //????????????????????§????????????????????§??????????????¢??????
				A[j+g]=v;//????????????A[j]???????????????????§?????????????????????\????????????
				//??????????????????????°?????????????????????´?????????????????£?????????????????????????´??????´???????????????????°?????????????????????????0
				//?????????????????????????????\???
				}
				
			}
			}
			return count;
		}
		
	}
	

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

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

Measured memory_bytes: 3096
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
typedef long long ll;


int main(void){
  int n,i,t[53],ans=0;
  string s[53],x;
  
  cin >> n;
  for (i=0;i<n;i++) cin >> s[i] >> t[i];
  cin >> x;
  
  i=0;
  while (s[i]!=x) i++;
  
  i++;
  while (i<n){
    ans+=t[i];
    i++;
  }
  
  cout << ans << endl;
  
  return 0;
}

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

const int MOD = 1000000007;
const int INF = 1e9;

//long long
using ll = long long;

//出力系
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
 
// begin() end()
#define all(x) (x).begin(),(x).end()

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

//最大公約数 
unsigned gcd(unsigned a, unsigned b) {
  if(a < b) return gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
} 

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

     for(int i = 0; i < 3; i++){ 
          if(S.at(i) == '1') S.at(i) = '9';
          else S.at(i) = '1';
     }

     print(S);
}


Measured memory_bytes: 256
/*
___mennat khoday ra azz o va jall ke taatash mojebe ghorbat ast o be shokr andarash mazide nemat.
___har nafasi ke foro miravad momedde hayatast o chon bar miayad mofarrahe zat.
___pas dar har nafasi 2 nemat mojod ast o bar har nematy shokry vajeb.

___az dast o zabane ke barayad ?
___kaz ohdeye shokrash be dar ayad !


___man be to dami gharar natvanam kard
___va ehsane to ra shomar natvanam kard
####################
___gar bar tane man zaban shavad har moyee
___yek shokre to az hezar natvanam kard

*/

#include <bits/stdc++.h>

#define pb push_back
#define SALI main
#define left(x) ((x)*2)
#define right(x) (((x)*2)+1)
#define fuck(x) cout << #x << " : " << x << endl;
#define findLowVec(v,x) (lower_bound(v.begin(), v.end(), x) - v.begin())
#define findUpVec(v,x) (upper_bound(v.begin(), v.end(), x) - v.begin())
#define findLowArr(a,n,x) (lower_bound(a, a+n, x) - a)
#define findUpArr(a,n,x) (upper_bound(a, a+n, x) - a)
#define int long long

using namespace std;

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

template<class A, class B> ostream& operator <<(ostream& out, const pair<A, B> &p)
{return out << "(" << p.first << ", " << p.second << ")";}

template<class A> ostream& operator <<(ostream& out, const vector<A> &v)
{out << "[";for(int i = 0; i < v.size(); i++) {if(i) out << ", ";out << v[i];}return out << "]";}

template<class A,class B> ostream& operator <<(ostream& out, const set<A,B> &s)
{out << "[";for(auto i = s.begin(); i != s.end(); i++) {out << ", ";out << *i;}return out << "]";}

template<class A> ostream& operator <<(ostream& out, const set<A> &s)
{out << "[";for(auto i = s.begin(); i != s.end(); i++) {out << ", ";out << *i;}return out << "]";}



int32_t SALI()
{
    int n; cin >> n;
    int a[n+1];
    int b[n+1];
    int c[n+1];
    for(int i = 1; i <= n; i++){
        cin >> a[i] >> b[i] >> c[i];
    }
    int dp[n+1][3];
    for(int i = 0; i <= n; i++) dp[i][0] = dp[i][1] = dp[i][2] = 0;

    for(int i = 1; i <= n; i++){
        dp[i][0] = max(dp[i-1][1],dp[i-1][2]) + a[i];
        dp[i][1] = max(dp[i-1][0],dp[i-1][2]) + b[i];
        dp[i][2] = max(dp[i-1][0],dp[i-1][1]) + c[i];
    }
    cout << max({dp[n][0],dp[n][1],dp[n][2]});
}


/**< WRITEN BY ALI ADELKHAH */



Measured memory_bytes: 8252
#include <bits/stdc++.h> 
#define rep(i,n) for(long long i = 0; i < (long long)(n); i++)
#define per(i,n) for(long long i = (long long)(n-1);i >= 0;--i)
#define REP(i,s,t) for(long long i=s;i<t;i++)
#define PER(i,s,t) for(long long i=s;i>t;--i)
#define all(x) x.begin(),x.end()
#define sp(n) setprecision(n)
typedef long long ll;
using namespace std;
int main(){
  string s;
  cin>>s;
  bool ans=false;
  int k=0,n=s.size();
  if(s[0]!='A'){cout<<"WA"<<endl;}
  else{REP(i,2,n-1){if(s[i]=='C'){k++;}}
       if(k!=1){cout<<"WA"<<endl;}
       else{k=0;
            rep(i,n){if(s[i]>='A'&&s[i]<='Z'){k++;}}
            if(k==2){cout<<"AC"<<endl;}
            else cout<<"WA"<<endl;}
      }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define MOD 1000000007
#define EPS 1e-9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long long int lli;
#define MAXNM 2010
lli sumTable[MAXNM][MAXNM];
lli S[MAXNM];
lli T[MAXNM];
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N, M;
  cin >> N >> M;
  REPS(i, N) { cin >> S[i]; }
  REPS(i, M) { cin >> T[i]; }

 
  sumTable[0][0] = 1;
  REPS(i, N) { sumTable[i][0] = 1; }
  REPS(i, M) { sumTable[0][i] = 1; }

  REPS(i, N) {
    REPS(j, M) {
      lli val = 0;
      if (S[i] == T[j]) {
        val = sumTable[i - 1][j - 1];
      }
      sumTable[i][j] = (sumTable[i - 1][j] + sumTable[i][j - 1] -
                        sumTable[i - 1][j - 1] + val+MOD) %
                       MOD;
    }
  }
  /*
    REPS(i, N) {
      REPS(j, M) { cout << table[i][j] << " "; }
      cout << "\n";
    }
    cout << "\n";

    REPS(i, N) {
      REPS(j, M) { cout << sumTable[i][j] << " "; }
      cout << "\n";
    }*/
  cout << sumTable[N][M] << "\n";
}

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

const long long MOD = 1000000007;
const long long INF = 1LL << 60;

int main()
{
  string S, T;
  cin >> S >> T;
  int A, B;
  cin >> A >> B;
  string U;
  cin >> U;
  int ans = 0;
  if (U == S)
    cout << A - 1 << " " << B << endl;
  else if (U == T)
    cout << A << " " << B - 1 << endl;
  else
    cout << A + B << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using  namespace std;
#define PB push_back
#define MP make_pair
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(a) (a).begin(),(a).end()
 
int main() {
	int n;
	int a[101];
	cin>>n;
	REP(i,n)cin>>a[i];
	int mi=1e9;
	for(int i=-100;i<=100;i++){
		int t=0;
		REP(j,n)t+=(a[j]-i)*(a[j]-i);
		mi=min(mi,t);
	}
	cout<<mi<<endl;
}

Measured memory_bytes: 256