akhauriyash/Code-Regression huggingface dataset:
#include "stdio.h"
#include "stdlib.h"

int s[1000];

typedef struct
{
	int a;
	int b;
	int w1;
	int w2;
}yoko;

yoko w[100000];

int z[1000];

int ten[1000];

int sortw(const void* a,const void* b)
{
	if(((yoko*)a)[0].a < ((yoko*)b)[0].a)
	{
		return -1;
	}
	else if(((yoko*)a)[0].a == ((yoko*)b)[0].a)
	{
		return 0;
	}
	else
	{
		return 1;
	}
}

int ans[1000];

int main()
{
	int nww = 0;
	while(1)
	{
		int n,m,h,k;
		scanf("%d %d %d %d",&n,&m,&h,&k);
		if(n == 0 && m == 0 && h == 0 && k == 0)
		{
			break;
		}
		for(int i = 0; i < n; i++)
		{
			scanf("%d",&(s[i]));
		}
		for(int i = 0; i < m; i++)
		{
			scanf("%d %d",&(w[i].b),&(w[i].a));
		}
		qsort(w,m,sizeof(yoko),sortw);
		for(int i = 0; i < n; i++)
		{
			z[i] = i;
		}
		int d;
		for(int i = 0; i < m; i++)
		{
			w[i].w1 = z[w[i].b];
			w[i].w2 = z[w[i].b - 1];
			d = z[w[i].b];
			z[w[i].b] = z[w[i].b - 1];
			z[w[i].b - 1] = d;
		}
		for(int i = 0; i < n; i++)
		{
			ten[z[i]] = s[i];
		}
		int min;
		int www = 0;
		for(int i = 0; i < k; i++)
		{
			www = www + ten[i];
		}
		min = www;
		for(int i = 0; i < m; i++)
		{
			d = ten[w[i].w1];
			ten[w[i].w1] = ten[w[i].w2];
			ten[w[i].w2] = d;
			www = 0;
			for(int i = 0; i < k; i++)
			{
				www = www + ten[i];
			}
			if(www < min)
			{
				min = www;
			}
			d = ten[w[i].w1];
			ten[w[i].w1] = ten[w[i].w2];
			ten[w[i].w2] = d;
		}
		ans[nww] = min;
		nww++;
	}
	for(int i = 0; i < nww; i++)
	{
		printf("%d\n",ans[i]);
	}
	return 0;
}

Measured memory_bytes: 4124
#include <iostream>
#include <bits/stdc++.h>
#include <cmath>
#include <vector>
#include<math.h>
#define _USE_MATH_DEFINES
#define ll long long int
#define mp make_pair
#define pb push_back
#define vi vector<int>
using namespace std;
void solve(){
    long double r;
    cin>>r;
    cout<<fixed<<setprecision(12)<<(long double)3.1415926535897932384626433832*r*2;
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
}

Measured memory_bytes: 3804
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;

ll sum_arr[2001][2001] = {};
ll same_arr[2001][2001] = {};
ll dp[2001][2001] = {};

ll get_sum(int a,int b, int c, int d) {
	return sum_arr[c][d]-sum_arr[a][d]-sum_arr[b][d]+sum_arr[a][b];
}

int main() {
	int n,m;
	cin >> n >> m;
	int a[2001];
	int b[2001];
	for(int i = 0; i < n; i++) {
		cin >> a[i];
	}
	for(int i = 0; i < m; i++) {
		cin >> b[i];
	}
	/*
	for(int i = 1; i <= n; i++) {
		sum_arr[i][0] = same_arr[i-1][0]+sum_arr[i-1][0];
	}
	for(int i = 1; i <= m; i++) {
		sum_arr[0][i] = same_arr[0][i-1]+sum_arr[0][i-1];
	}
	*/
	for(int i = 1; i <= n; i++) {
		for(int j = 1; j <= m; j++) {
			//if(a[i]==b[j]) dp[i][j] = sum_arr[i-1][j-1] + 1;
			if(a[i-1]==b[j-1]) dp[i][j] = (sum_arr[i-1][j-1] + 1LL)%MOD;
			sum_arr[i][j] = (dp[i][j]+sum_arr[i-1][j]+sum_arr[i][j-1]-sum_arr[i-1][j-1]+MOD)%MOD;
		}
		//cout << endl;
	}
	/*
	for(int i = 0; i <= n; i++) {
		for(int j = 0; j <= m; j++) {
			cout << sum_arr[i][j] << " ";
		}
		cout << endl;
	}
	*/
	/*
	for(int i = 0; i <= n; i++) {
		for(int j = 0; j <= m; j++) {
			cout << dp[i][j] << " ";
		}
		cout << endl;
	}
	*/
	/*
	ll ans = 1;
	for(int i = 0; i < n; i++) {
		for(int j = 0; j < m; j++) {
			ans = (ans+(same_arr[i][j]*(get_sum(i+1,j+1,n,m)+1LL))%MOD)%MOD;
			cout << ans << endl;
		}
	}
	cout << ans << endl;
	*/
	cout << ((sum_arr[n][m]+1LL)%MOD) << endl;
}


Measured memory_bytes: 65280
import collections

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

n=int(input())
f=prime_factorize(n)
c = collections.Counter(f)
count=0
res={}
for i in range(len(f)):
    num=c[f[i]]#素数f[i]の個数
    for j in range(1,num+1):
        if f[i]**j not in res:
            res[f[i]**j]=1
            count+=1
            c[f[i]]-=j
            break
print(count)






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

using namespace std;
typedef long long int ll;
typedef pair <ll,ll> P;
#define REP(i, n) for(ll i = 0LL; i < (ll)(n); i++)
#define REPR(i, n) for(ll i = n-1; i > 0LL; i--)
#define FOR(i, n, m) for(ll i = n; i < (ll)(m); i++)
#define PRINT(x) cout << x << endl
#define ALL(v) v.begin(), v.end()
#define INF (ll)1e18
#define PI 3.14159265358979
#define MOD 1000000007

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; }

int main()
{
	ll H, W, K;
	cin >> H >> W >> K;
	vector<vector<ll>> mat(H, vector<ll>(W, 0));
	REP(i, H) {
		string s;
		cin >> s;
		REP(j, W) {
			if (s[j] == '1') {
				mat[i][j] = 1;
			}
		}
	}
	ll ans = INF;
	REP(i, pow(2, H-1)) {
		ll tmp = __builtin_popcount(i);
		ll n = tmp+1;
		// PRINT(tmp);
		vector<ll> v(n);
		REP(j, W) {
			ll cur = 0;
			vector<ll> tmpv(n);
			REP(k, H) {
				tmpv[cur] += mat[k][j];
				if ((i >> k) & 1) cur++;
			}
			bool flag = false;
			REP(k, n) {
				if (tmpv[k] > K) {
					tmp = MOD;
					break;
				}
				if (v[k] + tmpv[k] > K) {
					flag = true;
				}
			}
			if(flag) {
				REP(k, n) {
					v[k] = tmpv[k];
				}
				tmp++;
			} else {
				REP(k, n) {
					v[k] += tmpv[k];
				}
			}
			// REP(k, H) cout << v[k] << " ";
			// cout << endl;
		}
		// PRINT(tmp);
		ans = min(ans, tmp);
		// cout << endl;
	}
	PRINT(ans);
    return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
#include<functional>
using namespace std;
 
#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
//#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592
 
using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;

double dp[310][310][310];
int N;
vector<int> a;
bool flag[310][310][310];

double solve(int c1,int c2,int c3){
	if(flag[c1][c2][c3]) return dp[c1][c2][c3];
	flag[c1][c2][c3] = 1;
	if(c1+c2+c3 == 0) return 0;
	double res = 1/(1-(double)(N-c1-c2-c3)/N);
	if(c1-1 >= 0) res += solve(c1-1,c2,c3)*c1/N/(1-(double)(N-c1-c2-c3)/N);
	if(c2-1 >= 0) res += solve(c1+1,c2-1,c3)*c2/N/(1-(double)(N-c1-c2-c3)/N);
	if(c3-1 >= 0) res += solve(c1,c2+1,c3-1)*c3/N/(1-(double)(N-c1-c2-c3)/N);
	return dp[c1][c2][c3] = res;
}

 
int main(){
	cin >> N;
	a.resize(N);
	vector<int> num(4);
	rep(i,N){
		cin >> a[i];
		num[a[i]]++;
	}
	double ans = solve(num[1],num[2],num[3]);
	cout << fixed << setprecision(20) <<  ans << endl;

}


Measured memory_bytes: 256256
#include<stdio.h>
 
struct card{
  char mark;
  int num;
  int we;
};
 
int main(){
   
  int i,j,n,s,minj,stable=0;
  struct card card[37],card2[37];
   
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf(" %c%d",&card[i].mark,&card[i].num);
    card[i].we = i;
    card2[i]= card[i];
  }
   
  //BubbleSort
  for(i=0;i<n;i++){
    for(j=n-1;j>i;j--){
      if(card[j].num<card[j-1].num){
    card[36] = card[j-1];
    card[j-1] = card[j];
    card[j] = card[36];
      }
    }
  }
   
  //SelectionSort
  for(i=0;i<n;i++){
    minj = i;
    for(j=i;j<n;j++){
      if(card2[j].num<card2[minj].num){
    minj = j;
      }
    }
    card2[36] = card2[i];
    card2[i] = card2[minj];
    card2[minj] = card2[36];
 
  }
   
  //print BubbleSort
  for(i=0;i<n;i++){
    printf("%c%d",card[i].mark,card[i].num);
    if(i==n-1){
      printf("\n");
      break;
    }
    printf(" ");
  }
  printf("Stable\n");
   
   
  //print SelectionSort
  for(i=0;i<n;i++){
    printf("%c%d",card2[i].mark,card2[i].num);
    if(i==n-1){
      printf("\n");
      break;
    }
    printf(" ");
  }
   
  for(i=0;i<n;i++){
    if(card2[i].we>card2[i+1].we&&card2[i].num==card2[i+1].num)stable =1;
  }
   
  if(stable == 1){
    printf("Not stable\n");
  }else{
    printf("Stable\n");
  }
   
  return 0;
}

Measured memory_bytes: 1040
/**
 *
 * AtCoder Beginner Contest 105 - Problema D: Candy Distribution (https://abc105.contest.atcoder.jp/tasks/abc105_d)
 *
 * Find the number of pairs [i,j] such as as[i] + ... + as[j] is a multiple of M.
 *
 * DP solution: compute the prefix sum ps[i] for all i = 1,...,N. From right to the left,
 * update the number of prefix sums equals to ps[k] and add to the answer all prefix sums
 * until now equals to ps[k - 1] (because as[i] + ... + as[j] = ps[j] - ps[i - 1]).
 */
#include <iostream>
#include <map>

using namespace std;
using ll = long long;

const int MAX { 100010 };

ll as[MAX], ps[MAX];

void solve(ll N, ll M)
{
    map<ll,ll> hist;

    for (int i = 1; i <= N; ++i)
        ps[i] = (ps[i - 1] + as[i]) % M;

    ll ans = 0;

    for (int i = N; i > 0; --i)
    {
        hist[ps[i]]++;

        auto x = ps[i - 1];
        auto it = hist.find(x);
        ans += (it != hist.end() ? it->second : 0);
    }

    cout << ans << endl;
}

int main()
{
    ios::sync_with_stdio(false);

    ll N, M;
    cin >> N >> M;

    for (int i = 1; i <= N; ++i)
        cin >> as[i];

    solve(N, M);

    return 0;
}


Measured memory_bytes: 5760
#include <iostream>
#include <cctype>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <string>
#include <functional>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iomanip>
#include <bitset>

#define PB push_back
#define MP make_pair
#define YES cout<<"YES"<<endl
#define Yes cout<<"Yes"<<endl
#define NO cout<<"NO"<<endl
#define No cout<<"No"<<endl
#define INF (1<<30)
#define LLINF (1LL<<60)
#define MOD 1000000007
#define REP(i, n) for(int i=0;i<n;i++)
using ll = long long;
using namespace std;

int main() {
    string s;
    cin >> s;
    if (s.length() >=101) {
        for (int i = 0; i <= s.length() - 3; i++) {
            if (s[i] == s[i + 1]) {
                cout << i + 1 << ' ' << i + 2 << endl;
                return 0;
            }
            else if (s[i] == s[i + 2]) {
                cout << i + 1 << ' ' << i + 3 << endl;
                return 0;
            }
        }
        if (s[s.length() - 2] == s[s.length() - 1]) {
            cout << s.length() - 1 << ' ' << s.length() << endl;
            return 0;
        }
    }
    else {
        for (int begin = 0; begin < s.length()-1; begin++) {
            for (int end = 2; end <= s.length()-begin; end++) {
                string t = s.substr(begin, end);
                int count[200] = {};
                for (int i = 0; i < t.length(); i++) {
                    count[t[i]]++;
                    if (count[t[i]] == t.length() / 2 + 1) {
                        cout << begin + 1 << ' ' << begin + end << endl;
                        return 0;
                    }
                }
            }
        }
    }
    cout << -1 << ' ' << -1 << endl;
    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define For(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define int ll
#define MOD (ll)(1e9+7)
using namespace std;
using ll=long long;
using pii=pair<int,int>;

int32_t main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int n,a,b; cin>>n>>a>>b;
	a+=b;
	string s; cin>>s;
	for(auto &i:s){
		bool ac=false;
		if(i=='a' && a>0){
			ac=true;
			a--;
		}
		else if(i=='b' && a>0 && b>0){
			ac=true;
			a--; b--;
		}
		if(ac) cout<<"Yes\n";
		else cout<<"No\n";
	}
	return 0;
}












Measured memory_bytes: 848
#include <iostream>
using namespace std;
 
int main(){
 
  int n,max=0,sum=0;
  cin >> n;
  int a;
  for(int i=0; i<n; ++i){
    cin >> a;
    sum += a;
    max = (a>max)? a:max;
  }
  if(max<(sum-max)){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  
  return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

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

const long double EPS = 1e-10;
const long long INF = 1e18;
const long double PI = acos(-1.0L);
//const ll mod = 1000000007;

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    for(int t = 0; t <= 1e6; t++) {
        int T = 60 * t + c;
        int delta = T % (a + b);
        if(delta <= a) {
            cout << T << endl;
            return 0;
        }
    }
    cout << -1 << endl;
    return 0;
}


Measured memory_bytes: 3112
def cal(x,y,d):
    res = 0
    for i in range(d):
        res+=(x[i]-y[i])**2
    for i in range(res+1):
        if i*i == res:
            return True
    return False
n, d = map(int, input().split())
ans=0
l = []
for i in range(n):
    a = list(map(int,input().split()))
    l.append(a)
for i in range(n):
    for j in range(i+1,n):
        if (cal(l[i],l[j],d)):
            ans+=1
print(ans)

Measured memory_bytes: 3064
#include<iostream>
#include<vector>
#include<queue>
#include <cmath>
#include <string>
#include <algorithm>
using namespace std;

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

 // cout << ( (a-1) * (b-1) );
  
  if (a%3==0 || b%3==0 || (a+b)%3==0){
   cout<<"Possible"; 
  }else{
    cout<<"Impossible";
  }

    return 0;
}






Measured memory_bytes: 256
A, B, C, D = map(int, input().split())
i = 0
while True:
    if i % 2 == 0:
        C -= B
        if C <= 0:
            print("Yes")
            exit()
    else:
        A -= D
        if A <= 0:
            print("No")
            exit()
    i += 1



Measured memory_bytes: 9116
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#include <list>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

using namespace std;
using namespace boost::multiprecision;

typedef long long ll;
typedef long double ld;

#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
#define mii map<int,int>
#define mis map<int,string>
#define msi map<string,int>
#define mll map<ll,ll>
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rep1(i,n) for(int i=1; i<=(int)(n); i++)
#define all(c) c.begin(),c.end()
#define srta(a) sort(all(a))
#define srtd(a) sort(all(a),greater<型>())
#define rvs(s) reverse(all(s))
#define psb push_back
#define ppb pop_back
#define isu isupper
#define isl islower
#define lb(a,k) lower_bound(all(a),k)
#define ub(a,k) upper_bound(all(a),k)
#define bs(a,k) binary_search(all(a),k)
#define popcount __builtin_popcount
#define popcountll __builtin_popcountll

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

const int I_INF = 1001001001;
const ll LL_INF = 1001001001001001001;
const ld EPS = 0.001;

int main() {
    ll A, B, C, K;
    cin >> A >> B >> C >> K;

    int idx = 0;
    rep1 (i, K) {
        if (B <= A) {
            B *= 2;
            idx = i;
        }
    }
    rep (i, K-idx) {
        if (C <= B) C *= 2;
    }

    string ans = "No";
    if (B > A && C > B) ans = "Yes";

    cout << ans << endl;
}


Measured memory_bytes: 3544
#include <bits/stdc++.h>
#define LLI long long int
#define FOR(v, a, b) for(LLI v = (a); v < (b); ++v)
#define FORE(v, a, b) for(LLI v = (a); v <= (b); ++v)
#define REP(v, n) FOR(v, 0, n)
#define REPE(v, n) FORE(v, 0, n)
#define REV(v, a, b) for(LLI v = (a); v >= (b); --v)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define ITR(it, c) for(auto it = (c).begin(); it != (c).end(); ++it)
#define RITR(it, c) for(auto it = (c).rbegin(); it != (c).rend(); ++it)
#define EXIST(c,x) ((c).find(x) != (c).end())
#define fst first
#define snd second
#define popcount __builtin_popcount
#define UNIQ(v) (v).erase(unique(ALL(v)), (v).end())
#define bit(i) (1LL<<(i))
#define sz(v) ((LLI)(v).size())

#ifdef DEBUG
#include <misc/C++/Debug.cpp>
#else
#define dump(...) ((void)0)
#endif

#define gcd __gcd

using namespace std;
template <class T> constexpr T lcm(T m, T n){return m/gcd(m,n)*n;}

template <typename I> void join(ostream &ost, I s, I t, string d=" "){for(auto i=s; i!=t; ++i){if(i!=s)ost<<d; ost<<*i;}ost<<endl;}
template <typename T> istream& operator>>(istream &is, vector<T> &v){for(auto &a : v) is >> a; return is;}
template <typename T, typename U> istream& operator>>(istream &is, pair<T,U> &p){is >> p.first >> p.second; return is;}

template <typename T, typename U> bool chmin(T &a, const U &b){return (a>b ? a=b, true : false);}
template <typename T, typename U> bool chmax(T &a, const U &b){return (a<b ? a=b, true : false);}
template <typename T, size_t N, typename U> void fill_array(T (&a)[N], const U &v){fill((U*)a, (U*)(a+N), v);}

LLI f(LLI a, LLI b, LLI c){ // [a,b]
  return b/c - (a-1)/c;
}

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

  LLI a,b,c,d;
  while(cin >> a >> b >> c >> d){
    LLI ans = (b-a+1) - f(a,b,c) - f(a,b,d) + f(a,b,lcm(c,d));

    //    dump(b-a+1, f(a,b,c), f(a,b,d), f(a,b,lcm(c,d)));

    cout << ans << endl;
  }

  
  return 0;
}


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

const int MAXN = 10e5+5;

int n, arr[MAXN], dp[MAXN];

int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    cin >> n;
    for (int i = 0; i < n; i++) cin >> arr[i];
    dp[0] = 0;
    dp[1] = abs(arr[1]-arr[0]);
    for (int i = 2; i < n; i++) dp[i] = min(dp[i-2]+abs(arr[i-2]-arr[i]), dp[i-1]+abs(arr[i-1]-arr[i]));
    cout << dp[n-1] << "\n";
    return 0;
}


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

struct Card{char suit,value;};
//構造体、Cardに対応した関数に作り替えなくては。
void BubbleSort(struct Card A[],int n){
    bool flg=1;
    while(flg){
        flg=0;
        for(int j=n-1;j>0;j--){
            if(A[j].value<A[j-1].value){
                Card tmp=A[j];
                A[j]=A[j-1];
                A[j-1]=tmp;
                flg=1;
            }
        }
    }
}

void SelectionSort(struct Card A[],int n){
    for(int i=0;i<n;i++){
        int minj=i;
        for(int j=i;j<n;j++){
            if(A[j].value<A[minj].value){
                minj=j;
            }
        }
        Card tmp=A[i];
        A[i]=A[minj];
        A[minj]=tmp;
    }
}

void print(struct Card A[],int n ){
    for(int i=0;i<n;i++){
        if(i>0)cout<<' ';
        cout<<A[i].suit<<A[i].value;
    }
    cout<<endl;
}

bool judge(struct Card A[],struct Card B[],int n){
    int flg=0;
    for(int i=0;i<n;i++){
        if(A[i].suit!=B[i].suit)flg=1;
    }
    if(flg==1)return false;
    else{return true;}
}

int main(){
    int n;
    cin>>n;
    Card C1[n],C2[n];
    for(int i=0;i<n;i++)cin>>C1[i].suit>>C1[i].value;
    for(int i=0;i<n;i++)C2[i]=C1[i];
    BubbleSort(C1,n);
    SelectionSort(C2,n);
    print(C1,n);
    cout<<"Stable"<<endl;
    print(C2,n);
    if(judge(C1,C2,n))cout<<"Stable"<<endl;
    else{cout<<"Not stable"<<endl;}
    return 0;
}


Measured memory_bytes: 3104
#include <iostream>
#include <algorithm>

using namespace std;

int main() {
  while (true) {
    int H, W;
    cin >> H >> W;
    if (H + W == 0) {
      break;
    }
    for (int i = 0; i < H; i++) {
      for (int j = 0; j < W; j++) {
        if ((i + j) % 2 == 0) {
          cout << '#';
        } else {
          cout << '.';
        }
      }
      cout << endl;
    }
    cout << endl;
  }

  return 0;
}

Measured memory_bytes: 1152
n = int(input())
al = list(map(int, input().split()))

import collections

c = collections.Counter(al)
temp = sorted(list(set(al)),reverse = True)
x = 0
y = 0

for i in temp:
    if c[i]>=4:
        if x ==0:
            x = i
        if y ==0:
            y = i
    elif c[i] >=2:
        if x ==0:
            x =i
        elif y ==0:
            y = i
    if x*y != 0:
        print(x*y)
        exit()    
print(x*y)

Measured memory_bytes: 20616
n,m=map(int,input().split())
a=[0]*n
w=[0]*n
ac=0
wc=0
for _ in range(m):
    p,s=input().split()
    p=int(p)-1
    if a[p]==0:
        if s=='AC':
            a[p]=1
            ac+=1
            wc+=w[p]
        else:
            w[p]+=1
print(ac,wc)

Measured memory_bytes: 4596
//abc064_a.cpp
//Sun Sep 30 18:14:47 2018

#include <iostream>
#include <string>
#include <queue>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#define INTINF 2147483647
#define LLINF 9223372036854775807
using namespace std;
using ll=long long;
typedef pair<int,int> P;

int main(){
	int r,g,b;
	cin >> r >> g >> b;

	if ((r*100+g*10+b)%4 == 0){
		cout << "YES" << endl;
	}else {
		cout << "NO" << endl;
	}
}

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

ans = [0]*(N+1)

for i in range(1, N + 1)[::-1]:
    sum_ans = sum(ans[x] for x in range(i, N + 1, i))
    if sum_ans % 2 != A[i - 1]:
        ans[i] = 1
        
print(sum(ans))
# print(ans)

prt = []
if sum(ans) > 0:
  for i, v in enumerate(ans):
    if v != 0:
      prt.append(i)
  print(*prt)
  

Measured memory_bytes: 14132
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<P, ll> P3;
typedef pair<P ,P> PP;
constexpr ll MOD = ll(1e9) + 7;
constexpr int IINF = INT_MAX;
constexpr ll LLINF = LLONG_MAX;
constexpr int MAX_N = int(2e5) + 5;
constexpr double EPS = 1e-9;
constexpr int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i > 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define SORTR(v) sort((v).rbegin(), (v).rend())
#define ALL(v) (v).begin(), (v).end()

ll n, a[MAX_N]{}, b[MAX_N]{};

int main() {
    cin >> n;
    REP(i,n) cin >> a[i+1];
    for(ll i=n;i>0;i--){
        ll s = 0;
        for(int j=i*2; j<=n;j+=i){
            s += b[j];
        }
        s &= 1LL;
        b[i] = s^a[i];
    }
    vector<int> ans;
    REP(i,n){
        if(b[i+1]) ans.push_back(i+1);
    }
    int m = ans.size();
    cout << m << endl;
    REP(i,m){
        cout << ans[i] << " \n"[i==m-1];
    }
    return 0;
}


Measured memory_bytes: 4600
#include <bits/stdc++.h>
using namespace std;
 
int main () {
  int N;
  cin >> N;
  vector<int> B(N - 1);
  for (int i = 0; i < N - 1; i++) {
    cin >> B.at(i);
  }
  int ans = 0;
  ans += B.at(0);
  ans += B.at(N - 2);
  for (int i = 0; i < N - 2; i++) {
    ans += min(B.at(i), B.at(i + 1));
  }
  cout << ans << endl;
  
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
#define lint long long
#define ll long long
#define pq priority_queue
#define mp make_pair
#define vl vector<long long>
long long INF = 1e10;
#define pii pair<long long,long long>
#define all(x) (x).begin(),(x).end()
#define rep(x) for(int i = 0;i < (x);i++)
#define repj(x) for(int j = 0;j < (x);j++)
#define REP(i,x) for(int (i) = 0;(i) < (x);(i)++)
#define rrep(x) for(int i = (x);i >= 0;i--)
#define mod 1000000007
/******************************define**********************************/

/*****************************functions********************************/

/****************************main function*****************************/
int main(void){
    ll x;cin>>x;
    if(x%11==0) cout<<2*(x/11)<<endl;
    else if(x%11<=6)cout<<2*(x/11)+1<<endl;
    else cout<<2*(x/11)+2<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>

using namespace std;
int main()
{
	string S;
  	cin>>S;
  if(S.find("hi") != std::string::npos){
    if(S=="hi"||S=="hihi"||S=="hihihi"||S=="hihihihi"||S=="hihihihihi")
  	cout<<"Yes"<<endl;
    else
      cout<<"No"<<endl;
  }
  else
    cout<<"No"<<endl;
}


Measured memory_bytes: 384
#include <cstring>
#include <cstdio>
#include <algorithm>
using namespace std;
#include <cmath>
int n;
long long  sum;
long long  a[10005];
int main()
{
	a[0]=2;
	a[1]=1;
	while(~scanf("%d",&n))
	{
			if(n>=2){
			for(int i=2;i<=n;i++)
		{
			a[i]=a[i-1]+a[i-2];
			sum=a[i];
	    }
	    printf("%.0lld\n",sum);
	          sum=0;
			}
	    	if(n==0){
			printf("2\n");
			sum=0;
			}
		if(n==1){
			printf("1\n");
			sum=0;
		}
	}
	return 0;
}


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

signed main(){
    bool ans[3]={1,1,1};
    int a,b;cin>>a>>b;a--;b--;
    ans[a]=false;ans[b]=false;
    rep(i,3)if(ans[i]){cout<<i+1<<endl;return 0;}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define mod 1000000007
typedef long long ll;
#define PI 3.14159265
ll exponent(ll x,ll n,ll m)
{  if(n==0)
    return 1;
    if(n%2!=0)
    {
        return (x*exponent(((x%m)*(x%m))%m,(n-1)/2,m))%m;
    }
    else
    return exponent(((x%m)*(x%m))%m,n/2,m);
}
ll find(ll fact[],ll invfact[],ll n,ll a,ll r)
{
    if(r>a)
        return 0;
    ll ans=fact[a];
    ans=(ans%mod*invfact[r]%mod)%mod;
    ans=(ans%mod*invfact[a-r]%mod)%mod;
    return ans;
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(NULL);
    string s;
    ll n;
    cin>>n;
    vector<int>a;
    for(int i=0;i<n;i++)
        {
            int x;
            cin>>x;
            a.pb(x);
        }
    vector<int>b;
    for(int i=0;i<n;i++)
        {
            int x;
            cin>>x;
            b.pb(x);
        }
    int c[n];
    for(int i=0;i<n;i++)
        c[i]=i+1;
    vector<vector<int>>v;
    do{
        vector<int>v1;
        for(int i=0;i<n;i++)
            v1.pb(c[i]);
        v.pb(v1);
    }while(next_permutation(c,c+n));
    int start,end;
    for(int i=0;i<v.size();i++)
    {
        vector<int>v1=v[i];
        if(v1==a)
            start=i;
        if(v1==b)
            end=i;
    }
    cout<<abs(end-start);
    return 0;
}


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

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

typedef long long ll;
using namespace std;
int mod = 1000000007;

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N, L; cin >> N >> L;
    string A[N]; rep(i, N) cin >> A[i];
    sort(A, A+N);
    rep(i, N) cout << A[i]; cout << "\n";
    return 0;
}

Measured memory_bytes: 256
#if 1
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <array>
#include <deque>
#include <algorithm>
#include <utility>
#include <cstdint>
#include <functional>
#include <iomanip>
#include <numeric>
#include <assert.h>
#include <bitset>
#include <list>

auto& in = std::cin;
auto& out = std::cout;
#define all_range(C) std::begin(C), std::end(C)
const double PI = 3.141592653589793238462643383279502884197169399375105820974944;


// 最大公約数（Greatest Common Divisor）
uint64_t gcd(uint64_t m, uint64_t n)
{
	// ユークリッドの互除法
	for (;;)
	{
		if (0 == m) { return n; }
		n %= m;
		if (0 == n) { return m; }
		m %= n;
	}
}
// 最小公倍数（Least Common Multiple）を返す。
uint64_t lcm(uint64_t m, uint64_t n)
{
	if (0 == m) { return n; }
	if (0 == n) { return m; }
	return ((m / gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}

uint64_t N,M;
std::string s, t;

int main()
{
	using std::endl;
	in.sync_with_stdio(false);
	out.sync_with_stdio(false);
	in.tie(nullptr);
	out.tie(nullptr);

	in >> N>>M;
	in >> s >> t;

	auto len = lcm(N, M);

	auto diff_n = (len / N);
	auto diff_m = (len / M);
	auto add = lcm(diff_n, diff_m);

	for (uint64_t i = 0; i < len; i+= add)
	{
		if (i % diff_n == 0 && i % diff_m == 0)
		{
			if (s[i / diff_n] != t[i / diff_m]) {
				out << -1 << endl;
				return 0;
			}
		}

	}
	out << len << endl;

	return 0;
}
#endif


Measured memory_bytes: 888
fun main(args: Array<String>) {
    val (n, x) = readLine()?.split(" ")?.map { it.toInt() } ?: return
    val aList = readLine()?.split(" ")?.map { it.toInt() }?.sorted() ?: return

    var count = 0
    var total = x
    for (a in aList) {
        if (a > total) {
            println(count)
            return
        }
        total -= a
        count++
    }
    if (total > 0 && count == n) {
        count--
    }
    println(count)
}

Measured memory_bytes: 36136
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
namespace mp = boost::multiprecision;
#define ll long long
#define cpp mp::cpp_int
#define dequeue deque
#define rep(i, n) for(int i = 0; i < n; i++)
#define rrep(i, n) for(int i = 1; i <= n; i++)
#define drep(i, n) for(int i = n-1; i >= 0; i--)
#define srep(i, s, t) for (int i = s; i < t; i++)
#define vi vector<int>
#define P pair<ll, ll>
int mod = 1'000'000'000 + 7;
struct edge {
	int to;
	ll cost;
};

void COME_LET_THE_GAMES_BEGIN() {
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << setprecision(20);
}
void reverse(string* s) {
	reverse((*s).begin(), (*s).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() {
	COME_LET_THE_GAMES_BEGIN();
	int N, L;
	cin >> N >> L;
	int a = L + 1 - 1, b = L + N - 1;
	int ans = (a + b) * N / 2;
	if (a > 0) {
		ans -= a;
	}
	else if (b < 0) {
		ans -= b;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;


public class Main {

	private static Scanner sc;
	private static Printer pr;

	private static void solve() {
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();

		if (b - a == c - b) {
			pr.println("YES");
		} else {
			pr.println("NO");
		}
	}

	// ---------------------------------------------------
	public static void main(String[] args) {
		sc = new Scanner(System.in);
		pr = new Printer(System.out);

		solve();

		pr.close();
		sc.close();
	}

	private static class Printer extends PrintWriter {
		Printer(PrintStream out) {
			super(out);
		}
	}
}


Measured memory_bytes: 21972
#include<stdio.h>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<utility>
#include<memory>
#include<cmath>
#include<stack>
#include<tuple>
#include<numeric>
#include<cassert>

#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define pb push_back
#define DEBUG false

using namespace std;

using ll = long long;
using P = pair<int,int>;
using Point = pair<double,double>;

const int mod=1e9+7,INF=1<<30;
const double EPS=1e-12,PI=3.1415926535897932384626;
const ll LINF=1LL<<60;
const int MAX_N = 105;
const ll lmod = 1e9+7;

double t[MAX_N],v[MAX_N];
double sum_tt = 0.0;
int N;

double f(double x,double a,double b,double c){
  if(x<a){
    return c+a-x;
  }else if(x>b){
    return c+x-b;
  }else{
    return c;
  }
}

double g(double x){
  double res = min(f(x,0.0,0.0,0.0),f(x,sum_tt,sum_tt,0.0));
  rep(i,N) res = min(res,f(x,t[i],t[i+1],v[i]));
  return res;
}

int main(){
  cin >> N ;
  t[0] = 0.0;
  rep(i,N){
    double temp_tt;
    scanf("%lf",&temp_tt);
    sum_tt += temp_tt;
    t[i+1] = sum_tt;
  }
  rep(i,N) scanf("%lf",v+i);
  double ans = 0.0;
  for(double i=0.0;i<sum_tt;i+=0.5){
    ans += (g(i)+g(i+0.5));
    // cout << ans << endl;
  }
  printf("%.10lf",ans/4.0);
  return 0;
}


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

int main(){
    int n,m,l;
    cin >> n >> m >> l;
    vector<vector<long long> > a(n+1,vector<long long>(m+1));
    vector<vector<long long> > b(m+1,vector<long long>(l+1));
    vector<vector<long long> > c(n+1,vector<long long>(l+1,0));
    for(int i=1; i<=n; i++){
        for(int j=1; j<=m; j++){
            cin >> a[i][j];
        }
    }
    for(int i=1; i<=m; i++){
        for(int j=1; j<=l; j++){
            cin >> b[i][j];
        }
    }
    for(int i=1; i<=n; i++){
        for(int j=1; j<=l; j++){
            for(int k=1; k<=m; k++){
                c[i][j]+=a[i][k]*b[k][j];
            }
            if(j!=l) cout << c[i][j] << " ";
            else    cout << c[i][j] << endl;
        }
 
    }
    return 0;
}


Measured memory_bytes: 3260
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

class Program
{
    static void Main(string[] args)
    {
        while (true)
        {
            var line = Console.ReadLine();
            if (string.IsNullOrEmpty(line))
            {
                break;
            }
            var m = Regex.Match(line, @"^(?<x>\d+)\s+(?<y>\d+)$");
            if (!m.Success)
            {
                break;
            }
            var value = int.Parse(m.Groups["x"].Value) + int.Parse(m.Groups["y"].Value);
            Console.WriteLine(value.ToString().Length);
        }
    }
}

Measured memory_bytes: 7556
import java.io.IOException;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {

		new Main().run();
	}

	private void run() throws IOException {
		Scanner scanner = new Scanner(System.in);
		char[] chs = scanner.next().toCharArray();
		for (char c : chs) {
			c -= 3;
			if (c < 'A')
				c += 26;
			System.out.print(c);
		}
		System.out.println();
	}
}

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

typedef long long int ll;
typedef vector<int> vi; 
typedef pair<int,int> pi; 
typedef vector<ll> vll; 


#define F first;
#define S second;
#define PB push_back;
#define MP make_pair;
#define rep(i, a, b) for (int i=a; i<b; i++)

int main(){
	ll n;
	cin >>n;
    ll arr[n][3];
    ll cx,cy,h,x=0;
	rep(i,0,n){
		cin >> arr[i][0]>>arr[i][1]>>arr[i][2];
        if(! x && arr[i][2] ) x= i;

    }
    ll f=0;
    rep(j,0,101){
        rep(k,0,101){
            ll num = 0;
            ll flag=0;
            ll nump=0; 
            ll prevh = -1;
            
            h = arr[x][2] + abs(arr[x][0]-j) + abs(arr[x][1]-k);
      
            rep(i,0,n){    

            if(arr[i][2] != max ( (h - abs(arr[i][0]-j) - abs(arr[i][1]-k)) ,(ll) 0)){
                flag = 1; 
                break;
                } 
            }  

            if(flag==0){
                cout << j<<" "<<k<<" "<<h;
                f=1;
                break;
            }

        }


        if(f==1){
            break;
        }
           
    }






	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
  char s[99];
  scanf("%s",s);
  int i;
  for(i=0;s[i]!='\0';i++);
  int j,x=1;
  for(j=0;j<i/2;j++){
    if(s[j]!=s[i-j-1]){
      x=0;
    }
  }
  for(j=0;j<(i-3)/2;j++){
    if(s[j]!=s[(i-3)/2-j]){
      x=0;
    }
  }
  for(j=(i+1)/2;j<i-1;j++){
    if(s[j]!=s[i-1-j]){
      x=0;
    }
  }
  if(x==0){
    printf("No");
  }else{
    printf("Yes");
  }
  return 0;
                     }

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

using namespace std;

#ifndef ONLINE_JUDGE
  #define pr_debug(...) do { printf("DEBUG: line %d: %s: ", __LINE__, __PRETTY_FUNCTION__); printf(__VA_ARGS__); } while(0)
  #define pr_vars(...) do { pr_debug(" "); pr_var(split(#__VA_ARGS__, ',').begin(), __VA_ARGS__); } while(0)
#else
  __attribute__ ((constructor)) static void fast_cin() { ios_base::sync_with_stdio(false); cin.tie(0); }
  #define pr_debug(...) do { } while(0)
  #define pr_vars(...) do { } while(0)
#endif /* ONLINE_JUDGE */

using ll = int64_t;
using ull = uint64_t;

template<typename X, typename Y> ostream &operator<< (ostream &fout, const pair<X, Y> &p)
{ fout << '{' << p.first << ", " << p.second << "} "; return fout; }

template<typename T> ostream &operator<< (ostream &fout, const vector<T> &vec)
{ for (const auto &el : vec) fout << el << ' '; return fout; }

template<typename T> istream &operator>> (istream &fin, vector<T> &vec)
{ for (size_t i = 0; i < vec.size(); i++) fin >> vec[i]; return fin; }

vector<string> split(const string &s, char c) { vector<string> v; ull st = 0, fn = 0, lvl = 0;
for ( ; fn < s.size(); fn++ ) { if (s[fn] == c && lvl == 0) { v.push_back(s.substr(st, fn - st)); st = fn + 1; }
if (s[fn] == '(') { lvl++; } if (s[fn] == ')') { lvl--; } } v.push_back(s.substr(st, fn - st)); return v; }

void pr_var(vector<string>::iterator it) { (void) it; cout << endl; }
template<typename T, typename... Args> void pr_var(vector<string>::iterator it, T a, Args... args)
{ cout << *it << "=" << a << "  "; pr_var(++it, args...); }

ll div_ceil(ll n, ll d) { ll res = n / d; if (res >= 0) res += n % d ? 1 : 0; return res; }
ll gcd(ll a, ll b) { a = llabs(a); b = llabs(b); while (a && b) a > b ? a %= b : b %= a; return a + b; }
ll lcm(ll a, ll b) { ll c = gcd(a, b); return c == 0 ? 0 : llabs(a / c * b); }

#define setp(a) fixed << setprecision(a)
const double PI = acos(-1.0);
constexpr double EPS = 1e-9;
constexpr double INF = 2e18;

using mp = pair<ll, ll>;
using mt = tuple<ll, ll, ll>;    // unpack: tie(ll, ll, ll) = mt;

constexpr ll MAX = 1e5 + 5;

int main()
{
    ll n, a, b; cin >> n >> a >> b;
    ll al = 1, cnt = 1e5;
    while (--cnt) {
        if (al) {
            if (a < b && (a + 1) != b && (a + 1) <= n) { a++; al = !al; continue; }
            else if ((a - 1) != b && (a - 1) >= 1) { a--; al = !al; continue; }
            else { cout << "Borys" << endl; exit(0); }

//            if (a > b && (a - 1) != b && (a - 1) >= 1) { a--; al = !al; continue; }
//            else if ((a + 1) != b && (a + 1) >= 1) { a++; al = !al; continue; }
//            else { cout << "Borys" << endl; exit(0); }
        } else {
//            if (b < a && (b + 1) != a && (b + 1) <= n) { b++; al = !al; continue; }
//            else if ((b - 1) != a && (b - 1) >= 1) { b--; al = !al; continue; }
//            else { cout << "Alice" << endl; exit(0); }

            if (b > a && (b - 1) != a && (b - 1) >= 1) { b--; al = !al; continue; }
            else if ((b + 1) != a && (b + 1) <= n) { b++; al = !al; continue; }
            else { cout << "Alice" << endl; exit(0); }
        }
    }
    cout << "Draw" << endl;
    return 0;
}


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

int a[200001],b[200001],c[200001],d[200001];
int t[29];
int n;

int main() {

    t[0] = 1;

    for(int i=1; i<29; i++){
        t[i] = t[i-1]*2;
    }

    int n;

    cin >> n;

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

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

    int ans = 0;

    for(int k=0; k<29; k++) {

        for(int i=0; i<n; i++){
            d[i] = a[i]%(2*t[k]);
            c[i] = b[i]%(2*t[k]);
        }

        sort(c,c+n);
        //sort(d,d+n);


        unsigned long tmp = 0;

        for (int i = 0; i < n; i++) {
            unsigned long under_start = lower_bound(c,c+n,t[k]-d[i]) - c;
            unsigned long under_limit = lower_bound(c,c+n,2*t[k]-d[i]) - c;
            unsigned long upper_start = lower_bound(c,c+n,3*t[k]-d[i]) - c;
            unsigned long upper_limit = lower_bound(c,c+n,4*t[k]-d[i]) - c;

            tmp += under_limit - under_start + upper_limit - upper_start;
        }

        if(tmp%2 == 1){
            ans += t[k];
        }

    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3328
n = int(input())
li = list(map(int, input().split()))
minli = min(li)
maxli = max(li)
somme = []
for i in range(minli,maxli+1):
	s = 0
	for j in range(len(li)):
		s += (li[j] - i)**2
	somme.append(s)

print(min(somme))

Measured memory_bytes: 3064
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>
#include <cassert>

#if __cplusplus >= 201103L
#include <array>
#include <tuple>
#include <initializer_list>
#include <unordered_set>
#include <unordered_map>
#include <forward_list>

using namespace std;

#define cauto const auto&
#define ALL(v) begin(v),end(v)
#else
#define ALL(v) (v).begin(),(v).end()
#endif

namespace{
typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
	v.assign(a, vector<T>(b, t));
}
template <class T> inline T &chmin(T &x, const T &y){ return x = min(x, y); }
template <class T> inline T &chmax(T &x, const T &y){ return x = max(x, y); }
template <class F, class T>
void convert(const F &f, T &t){
	stringstream ss;
	ss << f;
	ss >> t;
}
template <class Con>
string concat(const Con &c, const string &spr){
	stringstream ss;
	typename Con::const_iterator it = c.begin(), en = c.end();
	bool fst = true;
	for(; it != en; ++it){
		if(!fst){ ss << spr; }
		fst = false;
		ss << *it;
	}
	return ss.str();
}

template <class Con, class Fun>
vector<typename Con::value_type> cfilter(const Con &c, Fun f) {
	vector<typename Con::value_type> ret;
	typename Con::const_iterator it = c.begin(), en = c.end();
	for(; it != en; ++it){
		if(f(*it)){
			ret.emplace_back(*it);
		}
	}
	return ret;
}
#if __cplusplus >= 201103L
template <class Con, class Fun>
auto cmap(const Con &c, Fun f) -> vector<decltype(f(*c.begin()))> {
	vector<decltype(f(*c.begin()))> ret;
	ret.reserve(c.size());
	for(const auto &x: c){
		ret.emplace_back(f(x));
	}
	return ret;
}
#endif


#define REP(i,n) for(int i=0;i<int(n);++i)
#define RALL(v) (v).rbegin(),(v).rend()
#define tget(t,i) get<i>(t)

#define MOD 1000000007LL
#define EPS 1e-8


void mainmain(){
	int n;
	cin >> n;
	LL a = 1, b = 1, c = 1;
	for(int i = 0; i < n; ++i){
		a = a * 10 % MOD;
		b = b * 9 % MOD;
		c = c * 8 % MOD;
	}
	LL ans = (a - 2 * b + c + 10 * MOD) % MOD;
	cout << ans << endl;
}



}
int main() try{
//	ios::sync_with_stdio(false); cin.tie(0);
	cout << fixed << setprecision(10);
	cerr << fixed << setprecision(4);
	mainmain();
}
catch(const exception &e){
	cerr << "exception: " << e.what() << endl;
	abort();
}
catch(...){
	cerr << "exception" << endl;
	abort();
}


Measured memory_bytes: 3640
// general helpers
const debug = (message?: any, ...optionalParams: any[]) => {
  if (process.env.LOCAL_DEBUG === '1') console.log(message, ...optionalParams)
}

// helpers
const parseLines = (
  lines: string[]
): { N: number, B: number[] } => {
  const N = +lines[0]
  const B = lines[1].split(' ').map(line => +line)
  const obj = { N, B }
  debug(obj)
  return obj
}
// solver
export const solve = (lines: string[]): string => {
  const { N, B } = parseLines(lines)
  const A = [B[0]]
  for (let i = 1; i < N; i++) {
    if (B[i] === undefined) {
      A.push(B[i-1])
      continue
    }
    if (B[i-1] < B[i]) {
      A.push(B[i-1])
    } else {
      A.push(B[i])
    }
  }
  const result = A.reduce((prev, current) => prev += current, 0)
  return `${result}`
}

// main
const main = (lines: string[]) => {
  console.log(solve(lines))
}

// exec main function for submit
if (process.env.LOCAL_DEBUG !== '1') {
  const { stdin: input, stdout: output } = process
  input.resume()
  input.setEncoding('utf8')
  const lines: string[] = []
  require('readline')
    .createInterface({ input, output })
    .on('line', (line: string) => lines.push(line))
    .on('close', () => main(lines))
}


Measured memory_bytes: 7628
N = int(input())
d = dict()

for i in range(N):
    s = input()
    if s not in d:
        d[s] = 1
    else:
        d[s] += 1

maxi = 0
ans = []
for key, val in d.items():
    if val > maxi:
        maxi = val
        ans = [key]
    elif val == maxi:
        ans.append(key)

ans.sort()
for answer in ans:
    print(answer)


Measured memory_bytes: 92376
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <sstream>
#include <math.h>
#include <queue>
#include <map>
#include <set>
#include <ios>     // std::left, std::right
#include <iomanip> // std::setw(int), std::setfill(char)
using namespace std;


int main(){
int A,P;
cin>>A>>P;
int ans;
ans=(A*3+P)/2;
cout<<ans<<"\n";
return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; i++)
#define repr(i, s, e) for(int i=s; i>=e; i--)
#define reps(i, s, e) for(int i=s; i<=e; i++)
#define inf 1e18
#define all(v) v.begin(),v.end()
#define vsort(v) sort(v.begin(), v.end())
#define vsortr(v) sort(v.begin(), v.end(), greater<ll>())
#define sz(x) x.size()
#define ceil(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
#define sp << " " <<
using namespace std;
using ll = long long;
template<typename T> inline bool chmax(T &a, T b){ if(a<b){ a=b; return true; } return false; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a){ a=b; return true; } return false; }
template<typename T> T gcd(T a, T b){ if(b==0) return a; return gcd(b, a%b); }
template<typename T> T lcm(T a, T b){ return a*b/gcd(a, b); }
template<typename T> void vdebug(vector<T> v){ for(auto vv : v){ cout << vv << " "; } cout << endl; }
template<typename T> void adebug(T arr[], int n){ rep(i, n){ cout << arr[i] << " "; } cout << endl; }
void ans(bool b){ if(b) cout << "Yes" << endl; else cout << "No" << endl; }
void ans2(bool b){ if(b) cout << "YES" << endl; else cout << "NO" << endl; }
int keta(ll num){ int k=0; while(num>0){ num/=10; k++; } return k; }
int dx[] = {1, -1, 0, 0, 1, -1, 1, -1};
int dy[] = {0, 0, 1, -1, 1, -1, -1, 1};


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

    int n;
    cin >> n;

    ll res = inf;
    reps(i, 1, n-1){
        int a = i;
        int b = n - a;
        ll sum = 0;

        a *= 10;
        do {
            a /= 10;
            sum += a%10;
        }while(keta(a) > 1);

        //cout << "a" sp sum << endl;

        b *= 10;
        do {
            b /= 10;
            sum += b%10;
        }while(keta(b) > 1);

        //cout << "b" sp sum << endl;
        res = min(res, sum);
    }

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
    int n;
    cin >> n;
    int p, min = n, cnt = 0;
    for (int i=0; i<n; i++) {
        cin >> p;
        if (p <= min) {
            cnt++;
            min = p;
        }
    }
    cout << cnt << endl;
}

Measured memory_bytes: 256
#-*-coding:utf-8-*-

def main():
    N, X = list(map(int, input().split()))

    donut_list = []
    for i in range(N):
        donut_list.append(int(input()))
    
    X -= sum(donut_list)
    if X == 0:
        print(N)
        exit()

    donuts = X // min(donut_list)

    print(N + donuts)


if __name__ == '__main__':
    main()

Measured memory_bytes: 3060