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

#define loop(i, a, b) for (int i = a; i < b; i++)
#define rep(i, a) loop(i, 0, a)

using namespace std;

template <class T>
using vec = std::vector<T>;
typedef long long ll;
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 long long INF = 1LL << 60;

const double PI = acos(-1.0);

// long long積のオーバーフロー検出
bool detect_mul_overflow(ll a, ll b)
{
    return a >= LONG_MAX / b;
}

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

struct edge
{
    int from, to, cost;
};

// int型の2次元配列(3×4要素の)の宣言
// vector<vector<int>> data(3, vector<int>(4));
int N;

int main()
{
    cin >> N;
    vec<ll> L(N, 0);
    rep(i, N)
    {
        cin >> L[i];
    }

    int cnt = 0;

    rep(i, N)
    {
        for (int j = i+1; i < j && j < N; j++)
        {
            for (int k = j+1; j < k && k < N; k++)
            {
                // cout << i << " " << j << " " << k << endl;
                if (L[i] != L[j] && L[j] != L[k] && L[k] != L[i] && L[i] + L[j] > L[k] && L[j] + L[k] > L[i] && L[k] + L[i] > L[j])
                {

                    cnt++;
                }
            }
        }
    }

    cout << cnt << endl;

    return 0;
}


Measured memory_bytes: 3620
from collections import deque
N=int(input())
S=input()
w=[0]
e=[0]
a=0
b=0
c=N
for i in range(len(S)-1):
    if S[i]=="W":
        a+=1   
    w.append(a)
    if S[-(i+1)]=="E":
        b+=1
    e.append(b)
for i in range(N):
    d=w[i]+e[-(i+1)]
    if d<c:
        c=d
print(c)

Measured memory_bytes: 18452
def gauss(matrix):
    dimension = len(matrix)
    for i in range(dimension):
        tmp = matrix[i][i]
        for j in range(dimension + 1):
            matrix[i][j] /= tmp
        for j in range(dimension):
            if i == j:
                continue
            else:
                tmp2 = matrix[j][i]
                for k in range(i, dimension + 1):
                    matrix[j][k] -= tmp2 * matrix[i][k]
    return zip(*matrix)[-1]

while 1:
    try:
        a, b, c, d, e, f = map(float, raw_input().split())
        matrix = [[a, b, c], [d, e, f]]
        print "%.3f %.3f" % gauss(matrix)
    except:
        break

Measured memory_bytes: 4256
import java.util.*;
class Main
{
  public static void main(String args[])
  {
    Scanner sc=new Scanner(System.in);
    int n=sc.nextInt();
    int k=sc.nextInt();
    int a[]=new int[n];
    for(int i=0;i<n;i++)
      a[i]=sc.nextInt();
    int dp[]=new int[n];
    dp[0]=0;
    dp[1]=Math.abs(a[0]-a[1]);
    for(int i=1;i<n;i++)
    {
        dp[i]=Integer.MAX_VALUE;
        for(int j=i-1;j>=i-k && j>=0;j--)
        {
            //if(j>=0)
            dp[i]=Math.min(dp[i],Math.abs(a[i]-a[j])+dp[j]);
        }
    }
      //dp[i]=Math.min(Math.abs(a[i-1]-a[i])+dp[i-1],Math.abs(a[i-2]-a[i])+dp[i-2]);
    System.out.println(dp[n-1]);
  }
}

Measured memory_bytes: 50660
#include <bits/stdc++.h>
using namespace std;
typedef complex<double> P;

const double eps = 1e-8;

double dot(P a, P b) {
  return a.real()*b.real() + a.imag()*b.imag();
}

double cross(P a, P b) {
  return a.real()*b.imag() - a.imag()*b.real();
}

P project(P s1, P s2, P p) {
  P base = s2 - s1;
  double t = dot(p - s1, base)/norm(base);
  return s1 + base * t;
}

P reflect(P s1, P s2, P p) {
  return p + (project(s1, s2, p) - p) * 2.0;
}

P getCrossP(P a1, P a2, P b1, P b2) {
  P a = a2 - a1;
  P b = b2 - b1;
  return a1 + a * cross(b, b1 - a1) / cross(b, a);
}

struct Elm {
  bool isPoint;
  P p1, p2;
  Elm(P p1) : isPoint(true), p1(p1), p2(0, 0) {}
  Elm(P p1, P p2) : isPoint(false), p1(p1), p2(p2) {}
};

string s;
int p;

Elm exp();
Elm fact();

Elm exp() {
  Elm x = fact();
  while(s[p] == '@') {
    ++p;
    Elm y = fact();
    if(x.isPoint && y.isPoint) {
      x = Elm(x.p1, y.p1);
    } else if(x.isPoint && !y.isPoint) {
      x = Elm(reflect(y.p1, y.p2, x.p1));
    } else if(!x.isPoint && y.isPoint) {
      x = Elm(reflect(x.p1, x.p2, y.p1));
    } else {
      x = Elm(getCrossP(x.p1, x.p2, y.p1, y.p2));
    }
  }
  return x;
}

Elm fact() {
  if(isdigit(s[p+1]) || s[p+1] == '-') {
    ++p;
    string t;
    while(s[p] != ')') t += s[p++];
    ++p;
    replace(t.begin(), t.end(), ',', ' ');
    stringstream ss(t);
    int a, b;
    ss >> a >> b;
    Elm x(P(a, b));
    return x;
  } else {
    ++p;
    Elm x = exp();
    ++p;
    return x;
  }
}

int main() {
  while(cin >> s && s != "#") {
    p = 0;
    Elm res = exp();
    printf("%.10f %.10f\n", res.p1.real(), res.p1.imag());
  }
  return 0;
}

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

//C++14 (GCC 5.4.1)
int main() {
    string S;
    cin >>S;

    //-----------------------------------
    int zs_dif=0,//0101...との違い
        os_dif=0;//1010...
    rep(i,S.size()){
        if(i%2==1){
            //odd
            if(S[i]=='0')zs_dif++;else os_dif++;
        }else{
            //even
            if(S[i]=='1')zs_dif++;else os_dif++;
        }
    }

    cout << min(zs_dif,os_dif) <<endl;
    return (0);
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B,C ,D;
  cin >>A >> B >> C >> D;

  string ans ="Yes";

  while(A>=0 && C>=0){
    C -= B;
    if(C<=0){
      //ans ="No";
      break;
    }
    A -= D;
    if(A<=0){
      ans ="No";
      break;
    }
  }
  cout << ans <<endl;
}

Measured memory_bytes: 3624
#include <stdio.h>

int main(void) {
	
	char mark[9];
	int num[9], r_num[9], b_num[9], g_num[9], set, i, j;
	
	//セット数を入力する
	scanf("%d", &set);
	int ans[set];
	
	//各配列を初期化する
	for(i = 0 ; i < 9 ; i++){
		r_num[i] = 0;
		g_num[i] = 0;
		b_num[i] = 0;
	}
	
	
	for(i = 0 ; i < set ; i++){
		ans[i] = 0;
	}
	
	//セット数分繰り返す
	for(i = 0 ; i < set ; i++){
		
		
		for(j = 0 ; j < 9 ; j++){
			scanf("%d", &num[j]);
		}
		for(j = 0 ; j < 9 ; j++){
			
			if(j == 9){
				scanf("%c", &mark[j]);
			}else{
				scanf(" %c", &mark[j]);
			}
		}
		
		//色ごとの配列に分割する	
		for(j = 0 ; j < 9 ; j++){
			if(mark[j] == 'R'){
				r_num[j] = num[j];
			}else if(mark[j] == 'G'){
				g_num[j] = num[j];
			}else if(mark[j] == 'B'){
				b_num[j] = num[j];
			}
		}
		
		//ソート処理
		sort(r_num);
		sort(g_num);
		sort(b_num);
		
		//判定処理
		if(judge(r_num) == 1 && judge(g_num) == 1 && judge(b_num) == 1){
			ans[i] = 1;
		}else{
			ans[i] = 0;
		}
		
		//各配列を初期化する
		for(j = 0 ; j < 9 ; j++){
			r_num[j] = 0;
			g_num[j] = 0;
			b_num[j] = 0;
		}
	
	}
	for(i = 0 ; i < set ; i++){
		printf("%d\n", ans[i]);
	}
	return 0;
}


void sort(int num[]){
	
	int p, q, tmp;
	
		for(p = 0; p < 8; p++){
			for(q = p + 1; q < 9; q++){
				if(num[p] > num[q]){
					tmp = num[p];
					num[p] = num[q];
					num[q] = tmp;
				}
			}
		}	
	
}


int judge(int num[]){

	int cnt = 0;
	int i, j, k;
	//配列の中の0の数をカウント
	for(i = 0; i < 9; i++){
		if(num[i] == 0){
			cnt++;
		}
	}
	//0の数が3の倍数でなければ0を返す
	if(cnt % 3 != 0){
		return 0;
	}
	//勝利条件を満たしているか判定
	for(i = cnt; i < 9; i++){
		if(num[i] != 0){
			for(j = cnt; j < 9; j++){
				if(num[j] != 0 && j != i){
					if(num[i] == num[j]){
						for(k = cnt; k < 9; k++){
							if(num[k] != 0 && (k != i && k != j)){
								if(num[i] == num[k]){
									num[i] = 0;
									num[j] = 0;
									num[k] = 0;
								}
							}
						}
					}else if(num[j] - num[i] == 1){
						for(k = cnt; k < 9; k++){
							if(num[k] != 0 && (k != i && k != j)){
								if(num[k] - num[j] == 1){
									num[i] = 0;
									num[j] = 0;
									num[k] = 0;
								}
							}
						}
					}
				}
			}
		}
	}
	cnt = 0;
	for(i = 0; i < 9; i++){
		if(num[i] == 0){
			cnt++;
		}
	}
	if(cnt == 9){
		return 1;
	}else{
		return 0;
	}

}

Measured memory_bytes: 596
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] s = sc.next().toCharArray();
		Arrays.sort(s);
		if(s[0] == s[1] && s[2] == s[3] && s[1] != s[2]) System.out.println("Yes");
		else System.out.println("No");
	}

}


Measured memory_bytes: 23508
#include <bits/stdc++.h>
#define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++)
#define irep(i,a,b) for(ll i=ll(a);i>=ll(b);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; }
#define pb push_back
#define mp make_pair
#define F .first
#define S .second 
using ll=long long;
using ld=long double;
const ll INF = 1LL<<60;
const ll mod=1e9+7;
using namespace std;
ll GCD(ll a, ll b) { return b ? GCD(b, a%b) : a; }

int main(){
    ll s,w;
    cin>>s>>w;
    if(w>=s)cout<<"unsafe";
    else cout<<"safe";
    
}


Measured memory_bytes: 3632
#!/usr/bin/env python
import collections
import itertools
N = int(input())
d = {'M':0, 'A':0, 'R':0, 'C':0, 'H':0}
for i in range(N):
    s = input()
    if s[0] in d:
        d[s[0]] += 1

ans = 0
for i in itertools.combinations(['M', 'A', 'R', 'C', 'H'], 3):
    ans = ans + d[i[0]]*d[i[1]]*d[i[2]]

print(ans)


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

using namespace std;

int main()
{
    int n;
    cin>>n;
    int ud=n%10;;

    if(ud == 2||ud==4||ud==5||ud==7||ud==9)
        cout<<"hon";
    else if(ud==0||ud==1||ud==6||ud==8)
        cout<<"pon";
    else
        cout<<"bon";
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

int main() {
	int n;
	cin >> n;
	vector<int> v(n), c(n);
	rep(i, n) cin >> v[i];
	rep(i, n) cin >> c[i];

	int ans = 0;
	rep(i, n) {
		if (v[i] - c[i] > 0) ans += v[i] - c[i];
	}

	cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<iomanip>
#include<bitset>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())

const int MAX = 510000;
const int MOD = 1000000007;

map<ll,ll> m;
ll A, B, C, D;
ll solve(ll N){
  if(N == 0) return 0;
  if(N == 1) return D;
  if(m.count(N)) return m[N];

  m[N] = 1e18;
  if(N / 1e9 * D < 3e9) m[N] = min(m[N] , N * D);

  m[N] = min(m[N] , A + D * (N % 2) + solve(N / 2) );
  m[N] = min(m[N] , A + D * (2 - N % 2) + solve((N + 2) / 2) );

  m[N] = min(m[N] , B + D * (N % 3) + solve(N / 3) );
  m[N] = min(m[N] , B + D * (3 - N % 3) + solve((N + 3) / 3) );

  m[N] = min(m[N] , C + D * (N % 5) + solve(N / 5) );
  m[N] = min(m[N] , C + D * (5 - N % 5) + solve((N + 5) / 5) );

  return m[N];

}

int main(){
  ll T; cin >> T;
  vector<ll> ans;
  rep(i,T){
    ll N; cin >> N; cin >> A >> B >> C >> D;
    m.clear();
    ll tmp = solve(N);
    ans.pb(tmp);
  }
  rep(i,T) cout << ans[i] << endl;
}


Measured memory_bytes: 4772
#pragma optimization_level 3
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
#define F first
#define S second
#define vec vector
#define pb push_back
#define pll pair<ll,ll>
#define pdd pair<ld, ld>
#define pq priority_queue
#define umap unordered_map
#define uset unordered_set
#define pii pair<int, int>
#define pnn pair<Node*, Node*>
#define uid uniform_int_distribution
#define FILE ifstream in("input.txt");ofstream out("output.txt");
#define fast cin.tie(0);cout.tie(0);cin.sync_with_stdio(0);cout.sync_with_stdio(0);
using namespace std;
typedef string str;
typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

int main() {
    fast;
    int a; cin>>a;
    int o = 0;
    for(int q=0; q<a; q++){
        int x; cin>>x;
        o += x&1 && q%2==0;
    }
    cout<<o;
}

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

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

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

vec memo(100010,-1);
ll func(ll n){
    if(memo[L-n] != -1) return memo[L-n];
    ll res = 1;
    while(n%(res*2) == 0) res *= 2;
    memo[L-n] = res;
    return res;
}

ll compare(string s, vector<string> &comp){
    int ans = 0;
    for(string c : comp){
        rep(i,min(s.size(), c.size())){
            if(s[i] != c[i]){
                ans = max(ans, i);
                break;
            }
        }
    }
    return ans;
}

int main() {
    cin>>N>>L;
    vector<string> s(N);
    set<string> s_set;
    rep(i,N) {
      cin>>s[i];
    }
    ll ans = 0;
    rep(i,N){
        vector<string> comp;
        auto ite = s_set.lower_bound(s[i]);
        if(ite != s_set.end()) comp.push_back(*ite);
        if(ite != s_set.begin()) comp.push_back(*(--ite));
        reps(j,compare(s[i], comp), s[i].size()){
            //cout<<compare(s[i], comp)<<endl;
            ans = ans ^ func(L - j);
        }
        //cout<<ans<<endl;
        s_set.insert(s[i]);
    }
    cout<<(ans > 0 ? "Alice" : "Bob")<<endl;
    //cout<<ans<<endl;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
	
	ll a,b,k;
	cin>>a>>b>>k;
	if(k <= a){
		cout << a - k << " " << b <<endl;
 	}else if(k <= a+b){
 		cout << 0 << " "<< b - (k-a) <<endl;
 	}else{
 		cout << 0 << " " << 0 <<endl;
 	}
}

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

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

    vector<ll> a(N+1);
    for (int i = 1; i <= N; i++) {
        cin >> a[i];
    }

    vector<ll> b(N+1);
    for (int i = N; i > 0; i--) {
        ll sum = 0;
        for (int j = 2; j <= N / i; j++) {
            sum += b[j*i];
        }
        b[i] = a[i] ^ (sum & 1);
    }

    int cnt = 0;
    for (int i = 1; i <= N; i++) {
        if (b[i] == 1) {
            cnt++;
        }
    }

    if (cnt == 0) {
        cout << 0 << endl;
        return 0;
    }

    vector<ll> candidate;
    for (int i = 1; i <= N; i++) {
        if (b[i] == 1) {
            candidate.push_back(i);
        }
    }

    cout << cnt << endl;
    for (int i = 0; i < cnt; i++) {
        if (i == 0) {
            cout << candidate[0];
        } else {
            cout << " " << candidate[i];
        }
    }
    cout << endl;

    return 0;
}

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

int main() {
  int n;
  cin >> n;
  int a[n];
  rep(i,n) cin >> a[i];
  
  map<ll,ll> m1, m2;
  rep(i,n) {
    m1[i + a[i]]++;
    m2[i - a[i]]++;
  }
  
  ll ans = 0;
  rep(i,n) ans += m1[i]*m2[i];
  
  cout << ans << endl;
}

Measured memory_bytes: 46980
n, y = map(int, input().split())
result = (-1,-1,-1)
for i in range(n+1):
    for j in range(n+1):
        if (i*10000+j*5000+1000*(n-i-j) == y) and n-i-j >= 0:
                result = (i,j,(n-i-j))
                break
print("{} {} {}".format(*result))

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

#define ll long long 

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

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

    int n = s.length();
    for (int i = 0; i < n; i++) {
        if (s[i] != t[i]) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;


    return 0; 
}



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

int main(){
    int a,b,c;
    cin >> a >> b >> c;
    cout << a+b+c - max(a, max(b, c)) << endl;
    return 0;
}

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

int main(void) {
	int n;
	cin >> n;
	map<int, int> a;
	for (int i = 1; i <= n; i++) {
		int b;
		cin >> b;
		a[b]++;
	}
	int ans = 0;
	for (auto p:a) {
		if (p.second % 2 == 1) ans++;
	}
	
	cout << ans << endl;
	return 0;
}


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


int main() {
  int n = 3;
  vector<int> arr(n);
  for (int i = 0; i < n; ++i) {
    cin >> arr[i];
  }
  sort(arr.begin(), arr.end());
  cout << (arr[0] == 5 && arr[1] == 5 && arr[2] == 7 ? "YES" : "NO") << endl;
}


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

int main(){
	int A, B;
	string S;
	cin >> A >> B >> S;
	rep(i,A) {
		if (S[i]-'0'<0 || S[i]-'9'>0) {
			cout << "No" << endl;
			return 0;
		}
	}
	if (S[A] != '-') {
		cout << "No" << endl;
		return 0;
	}
	rep(i,B) {
		if (S[i+A+1]-'0'<0 || S[i+A+1]-'9'>0) {
			cout << "No" << endl;
			return 0;
		}
	}
	 cout << "Yes" << endl;

	return 0;
}


Measured memory_bytes: 3608
#include<stdio.h>

 int main(){
     int i,a,b,tmp;
     for(i=0;;i++){
          scanf("%d%d",&a,&b);
          if(a==0&&b==0)break;
          else if(a>b){tmp=a;a=b;b=tmp;}
          printf("%d %d\n",a,b);
          }
     return 0;
     }


Measured memory_bytes: 2044
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;
#define ll long long
#define ii pair<ll,ll>
#define iii pair<ii,ll>
#define fi first
#define se second
#define endl '\n'
#define debug(x) cout << #x << " is " << x << endl;

#define rep(x,start,end) for(auto x=(start)-((start)>(end));x!=(end)-((start)>(end));((start)<(end)?x++:x--))
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()

ll MAX(ll a){return a;}
ll MIN(ll a){return a;}
template<typename... Args>
ll MAX(ll a,Args... args){return max(a,MAX(args...));}
template<typename... Args>
ll MIN(ll a,Args... args){return min(a,MIN(args...));}

#define indexed_set tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>

mt19937 rng(chrono::system_clock::now().time_since_epoch().count());

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	ll a,b;
	
	double temp;
	
	cin>>a>>temp;
	
	b=(ll)(temp*100+0.5);
	
	cout<<a*b/100<<endl;
}

Measured memory_bytes: 3740
#include <iostream>
#include <string>
#include <array>
#include <algorithm>
#include <vector>
#include <string>
#include <set>
#include <cctype>
#include <map>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <ctype.h>
#include <queue>


#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

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

using namespace std;

bool is_integer( float x ){
    return floor(x)==x;
}

bool is_prime(long long N) {
    if (N == 1) return false;
    for (long long i = 2; i * i <= N; ++i) {
        if (N % i == 0) return false;
    }
    return true;
}

//yakusuu rekkyo
vector<long long> enum_divisors(long long N) {
    vector<long long> res;
    for (long long i = 1; i * i <= N; ++i) {
        if (N % i == 0) {
            res.push_back(i);
            // push its partner
            if (N/i != i) res.push_back(N/i);
        }
    }

    sort(res.begin(), res.end());
    return res;
}


vector<pair<long long, long long> > prime_factorize(long long N) {
    vector<pair<long long, long long> > res;
    for (long long a = 2; a * a <= N; ++a) {
        if (N % a != 0) continue;
        long long ex = 0; // exponential

        // divide as much as you can
        while (N % a == 0) {
            ++ex;
            N /= a;
        }

        // push the result
        res.push_back({a, ex});
    }

    // last num (if the lasting n is prime number and not 1)
    if (N != 1) res.push_back({N, 1});
    return res;
}



int main() {
    ll n,n1,n2; cin >> n;
    n1 = n2 = 1;
    ll Min = 1000000000000;
    vector<long long > p;

    p = enum_divisors(n);

    rep(i,p.size()){
        Min = min(Min,p[i]+n/p[i]);
    }
    cout << Min-2;

    return 0;
}











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

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define a first
#define b second
#define sz size()
#define pb(x) push_back(x) 
#define bg begin()
#define ed end()
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define mp(x,y) make_pair(x,y)
const ll MOD=1000000007;

vector<ll> pw2(51,1);
vector<ll> pw10(19,1);

ll maxx(ll x,ll y,ll z){
	return max(max(x,y),z);
}
ll minn(ll x,ll y,ll z){
	return min(min(x,y),z);
}
ll gcd(ll x,ll y){
	if(x%y==0) return y;
    else return gcd(y,x%y);
}
ll lcm(ll x,ll y){
	return x*(y/gcd(x,y));
}
ll myceil(ll x,ll y){
	if(x<=y) return 1;
	else if(x%y==0) return x/y;
	else return x/y+1;
}

//a,b x
int main(){
	//keyence
	string s; cin>>s;
	ll L=s.sz-7;
	rep(i,s.sz-L+1){
		string t="";
		rep(j,s.sz){
			if(i<=j && j<=i+L-1) continue;
			t+=s[j];
		}
		if(t=="keyence"){
			cout<<"YES";
			return 0;
		}
	}
	cout<<"NO";
}

Measured memory_bytes: 256
import java.util.*;
import java.util.stream.*;
class Main {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int a,b,c;
        a = input.nextInt();
        b = input.nextInt();
        c = input.nextInt();
        String ans;
        if ((a < b) && (b < c)){
            ans = "Yes";
        } else {
            ans = "No";
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 26076
#! -*- coding: utf-8 -*-

a,b = map(int,raw_input().split())

print 100,100

for i in range(100):
    line = ""
    if i < 50:
        if i%2==0:
            for j in range(100):
                if j%2==0:
                    if a > 1:
                        line+="."
                        a -= 1
                    else:
                        line+="#"
                else:
                    line+="#"
        else:
            for j in range(100):
                line+="#"
    else:
        if not i%2==0:
            for j in range(100):
                if j%2==0:
                    if b > 1250:
                        line+="#"
                    else:
                        line+="."
                        b += 1
                else:
                    line+="."
        else:
            for j in range(100):
                line+="."
    print line


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

using namespace std;

typedef long long LL;
typedef pair<int , int> P2;
typedef pair<pair<int , int> , int> P3;
typedef pair<pair<int , int> , pair<int , int> > P4;
#define PB(a) push_back(a)
#define MP(a , b) make_pair((a) , (b))
#define M3P(a , b , c) make_pair(make_pair((a) , (b)) , (c))
#define M4P(a , b , c , d) make_pair(make_pair((a) , (b)) , make_pair((c) , (d)))
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)

int main(){
	const LL mod = 1e9 +7;
	int H,W; cin >> H >> W;
	string S[H];
	repp(i,0,H) cin >> S[i];
	vector<vector<LL>> dp(H,vector<LL>(W,0));
	dp[0][0] = 1;
	repp(i,0,H) repp(j,0,W){
		if(S[i][j] == '#') continue;
		if(i > 0) (dp[i][j] += dp[i-1][j]) %= mod;
		if(j > 0) (dp[i][j] += dp[i][j-1]) %= mod;
	}
	cout << dp[H-1][W-1] << endl;
	return 0;
}


Measured memory_bytes: 9216
#include <bits/stdc++.h>
using namespace std;
#define FOR(I,X,Y) for(long long (I)=(X);(I)<(Y);(I)++)
#define REP(I,X,Y) for(long long (I)=(Y)-1;(I)>=(X);(I)--)
#define ALL(X) (X).begin(),(X).end()
#define pb push_back
#define debug(x) cerr<<#x<<':'<<x<<endl;
#define DEBUG(v) cerr<<#v<<':';for(auto x:v)cerr<<x<<' ';cerr<<endl;
#define INF 1000000007
#define LINF 1000000000000000007
#define EPS 1e-9
typedef long long ll;

signed main(){
  int N;
  cin >> N;
  int p[N],ans=0;
  FOR(i,0,N)cin >> p[i];
  FOR(i,0,N){
    if(i+1 == p[i]){
      swap(p[i],p[i+1]);
      ans++;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 640
//{{{
#include<algorithm>
#include<cmath>
#include<deque>
#include<fstream>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<random>
#include<set>
#include<sstream>
#include<sys/time.h>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include"rprint2.hpp"
#else
#define FUNC(name) template <ostream& out = cout, class... T> void name(T&&...){ }
FUNC(printde) FUNC(printdbe) FUNC(printdwe) FUNC(printdu) FUNC(printe) FUNC(printe0);
#endif
template <template <class T, class = std::allocator<T>> class V, class E>
istream& operator >> (istream& in, V<E>& v){ for(auto& e : v){ in >> e; } return in; }
//}}}

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    int n, x, t;
    cin >> n >> x >> t;
    cout << (n + x - 1) / x * t << '\n';
}


Measured memory_bytes: 3196
// #pragma GCC target ("avx2")
// #pragma GCC optimization ("O3")
// #pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
using namespace std;
#define FastRead ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
#define ll int
#define bits_count __builtin_popcountll
#define endl '\n'
#define double long double
#define ld double
#define FOR(i,a,n) for (ll i=(a);i<=(n);++i)
#define RFOR(i,a,n) for (ll i=(n);i>=(a);--i)
#define FI(i,n) for (ll i=0; i<(n); ++i)
#define ZERO(a) memset((a),0,sizeof((a)))
#define MINUS(a) memset((a),-1,sizeof((a)))
#define f first
#define s second
#define pb push_back
#define mk make_pair
#define all(g) g.begin(),g.end()
#define sz(x) (ll)x.size()
#define pr pair<int,int>
int fastMax(int x, int y) { return (((y-x)>>(32-1))&(x^y))^y; }
int fastMin(int x, int y) { return (((y-x)>>(32-1))&(x^y))^x; }

// #include <ext/pb_ds/assoc_container.hpp> // Common file
// #include <ext/pb_ds/tree_policy.hpp>     // Including tree_order_statistics_node_updat
// using namespace __gnu_pbds;
// typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

vector<pair<pair<int,int>,int>> edges;

void solve(){
    int L; cin>>L;

    int N = 0;
    while(pow(2,N) <= L) N++;

    FOR(i,1,N-1){
        edges.push_back(make_pair(make_pair(i,i+1),0));
        edges.push_back(make_pair(make_pair(i,i+1),pow(2,i-1)));
    }

    RFOR(i,1,N-1){
        if(pow(2,N-1) <= L-pow(2,i-1)){
            edges.push_back(make_pair(make_pair(i,N),L-pow(2,i-1)));
            L -= pow(2,i-1);
        }
    }

    cout<<N<<" "<<sz(edges)<<endl;
    for(auto x:edges) cout<<x.f.f<<" "<<x.f.s<<" "<<x.s<<endl;
}

signed main(){

   FastRead;    


    int t = 1; 
    // cin>>t; 
    FOR(i,1,t){
        // cout<<"Case #"<<i<<": ";
        solve();
    }
}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <math.h>
using namespace std;

unsigned long long int gcd(unsigned long long int a, unsigned long long int b)
{
    if (a < b) {
        a ^= b;
        b ^= a;
        a ^= b;
    }
    
    return b ? gcd(b, a % b) : a;
}

unsigned long long int lcm(unsigned long long int a, unsigned long long int b)
{
    return a * b / gcd(a, b);
}
unsigned long long int divide_count(unsigned long long int a, int count){
    if(a%2 == 0){
        count++;
        return divide_count(a/2, count);
    }
    else{
        return count;
    }
}
int main()
{
    unsigned long long int N;
    unsigned long long int M;
    
    cin >> N;
    cin >> M;
    
    unsigned long long int ans = 1;
    unsigned long long int divide;
    for(unsigned long long int i=0; i<N; i++){
        unsigned long long int a;
        cin >> a;
        if(i == 0){
            divide = divide_count(a,0);
        }
        else{
            if(divide != divide_count(a,0)){
                cout << 0 << endl;
                return 0;
            }
        }
        
        ans = lcm(ans,a/2);
    }
    unsigned long long int answer;
    if (ans > M){
        cout << 0 << endl;
        return 0;
    }
    answer = M/ans;
    
    if(answer % 2 == 0){
        cout << answer/2 << endl;
    }
    else{
        cout << (answer/2)+1 << endl;
    }
    
    return 0;
}


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

int main(){
    int n,a,b,c;
    cin >> n;
    a = n%100;
    b = a/5;
    c = n/100;
    if(n%5!=0) b = b + 1;
    if(c>=b) cout << 1 <<endl;
    else cout << 0 <<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define rgi register int
#define pii pair<int,int>
#define mkp make_pair
#define fi first
#define se second
#define pb push_back
#define filein(x) freopen(x,"r",stdin)
#define fileout(x) freopen(x,"w",stdout)
using namespace std;
int n,ans;
string s;
signed main()
{
	ios::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
	cin>>s;
	n=s.size();
	rgi i=0,j=n-1;
	while(i<j)
	{
		if(s[i]!=s[j])
			++ans;
		++i,--j;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
    public static class item{
        int weight;
        int value;
        item(int weight, int value) {
            this.weight = weight;
            this.value = value;
        }
    }
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        int w = input.nextInt();
        item[] items = new item[n];
        for(int i = 0; i < n; i++) {
            items[i] = new item(input.nextInt(), input.nextInt());
        }
        long[] dp = new long[100001];
        Arrays.fill(dp, Integer.MAX_VALUE);
        dp[0] = 0;
        for(int i = 0; i < n; i++) {
            for(int k = 100000; k >= 0; k--) {
                if(dp[k] != -1) {
                    try{
                        dp[k + items[i].value] = Math.min(dp[k + items[i].value], dp[k] + items[i].weight);
                    } catch(Exception e) {

                    }
                }
            }
        }
        long max = 0;
        for(int i = 0; i <= 100000; i++) {
            if(dp[i] != Integer.MAX_VALUE && dp[i] <= w) {
                max = Math.max(max, i);
            }
        }
        System.out.println(max);
    }
}


Measured memory_bytes: 26940
#include <bits/stdc++.h>
#define maxn 600086
using namespace std; 

const double pi = acos(-1);

struct Complex{
	double x, y;
	Complex(double xx = 0, double yy = 0){
		x = xx, y = yy;
	}
};

Complex operator + (Complex a, Complex b){
	return Complex(a.x + b.x, a.y + b.y);
}

Complex operator - (Complex a, Complex b){
	return Complex(a.x - b.x, a.y - b.y);
}

Complex operator * (Complex a, Complex b){
	return Complex(a.x * b.x - a.y * b.y, a.x * b.y + a.y * b.x);
}

int pos[maxn];//蝴蝶变换 

void FFT(Complex *a, int lim, int type){
	for(int i = 0;i < lim;i++){
		pos[i] = (pos[i >> 1] >> 1) | ((i & 1) ? (lim >> 1) : 0);//相当于翻转后的i>>1是i的后缀 再判断一下最低位如果是1就翻转到最高位 
		if(i < pos[i]) swap(a[i], a[pos[i]]);//对应二进制翻转 因此有pos[pos[i]] = i 保证位置交换正确 
	}
	for(int mid = 1;mid < lim;mid <<= 1){//区间半长 n/2
		Complex wn(cos(pi / mid), type * sin(pi / mid));//一个单位根的跨度 
		for(int i = mid << 1, j = 0;j < lim;j += i){//i是区间全场 j是当前区间左端点 
			Complex w(1, 0);//单位根
			for(int k = 0;k < mid;k++, w = w * wn){//枚举左半部分 右半部分O(1)获得 
				Complex x = a[j + k], y = w * a[j + k + mid];
				a[j + k] = x + y;
				a[j + k + mid] = x - y;
			} 
		}
	}
	if(type == -1) for(int i = 0;i < lim;i++) a[i].x /= lim;
} 

const int p = 200003;

int n, x;
int f[maxn], g[maxn], cnt[maxn];
Complex a[maxn];

int main(){
	scanf("%d", &n);
	for(int i = 0, j = 1;i <= p - 2;i++, j = 2 * j % p) f[i] = j, g[j] = i;
	for(int i = 1;i <= n;i++){
		scanf("%d", &x);
		if(x) cnt[g[x]]++, a[g[x]].x++;
	}
	int lim = 1;
	while(lim <= 2 * p) lim <<= 1;
	FFT(a, lim, 1);
	for(int i = 0;i < lim;i++) a[i] = a[i] * a[i];
	FFT(a, lim, -1);
	for(int i = 0;i <= p - 2;i++) a[i * 2].x -= cnt[i];
	long long ans = 0;
	for(int i = 0;i < lim;i++) ans += f[i % (p - 1)] * (long long)(a[i].x / 2 + 0.5);
	printf("%lld", ans);
}

Measured memory_bytes: 17876
# coding: UTF-8
from collections import deque
operators = {'+','*','-'}

def operate(L,R,C):
  if C == '+':
    return L + R
  elif C == '*':
    return L * R
  else: #<=>if C == '-'
    return L - R

raw = input().split()
stack = deque()
for C in raw:
  if C in operators:
    R = stack.pop()
    L = stack.pop()
    stack.append(operate(L,R,C))
  else:
    stack.append(int(C))
print(stack.pop())



Measured memory_bytes: 6004
package main

import "fmt"

func main() {
	val := 0
	ans := val

	var N int
	var S string
	fmt.Scan(&N, &S)

	for i := 0; i < N; i++ {
		val = val + judge(S[i])
		ans = max(ans, val)
	}
	fmt.Println(ans)
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func judge(v byte) int {
	if v == byte('I') {
		return 1
	} else if v == byte('D') {
		return -1
	}
	return 0
}


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

int main() {
  char c;
  string judge;
  
  cin >> c;
  switch(c) {
  case 'a':
  case 'e':
  case 'i':
  case 'o':
  case 'u':
    judge = "vowel";
    break;
  default:
    judge = "consonant";
    break;
  }

  cout << judge << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define to edge[i].v
#define mp make_pair
#define rint register int
#define debug(x) cout<<#x<<"="<<x<<endl
#define fgx cout<<"-------------"<<endl
#define N 10000
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
char c[N];int a[N],p[2],pos[N][2],b[N],id[N],ban[N];string s[N],f[N];
int main()
{	int n,sum=0,m=0,la=1; cin>>n; n+=n; scanf("%s",c+1);
	for(rint i=1;i<=n;i++)
	{	sum+=(a[i]=(c[i]=='a'))?1:-1; pos[id[i]=++p[a[i]]][a[i]]=i;
		if(!sum) b[++m]=la,la=i+1;
	}
	b[++m]=n+1;
	for(rint i=1;i<m;i++)
	if(a[b[i]])
	{	for(rint j=b[i],k=b[i];j<b[i+1];j=k)
		if(a[k]) for(s[i]+="ab",ban[pos[id[k]][0]]=1;k<b[i+1]&&(a[k]||!ban[k]);k++);
		else k++;
	}
	else
	{	int l=id[b[i]],r=id[b[i+1]-1]; set<pair<int,char>> S;
		for(rint j=r;j>=l;j--)
		{	S.insert(mp(pos[j][0],'b')),S.insert(mp(pos[j][1],'a')); string t="";
			for(set<pair<int,char>>::iterator it=S.begin();it!=S.end();it++)
			t+=(*it).second; s[i]=max(s[i],t);
		}
	}
	for(rint i=1;i<m;i++)
	for(rint j=0;j<i;j++) f[i]=max(f[i],f[j]+s[i]);
	cout<<f[m-1];
	return 0;
}


Measured memory_bytes: 14464
"use strict";

class Dice {
    /**
     *    +--+
     *    |0 |
     * +--+--+--+--+
     * |3 |1 |2 |4 |
     * +--+--+--+--+
     *    |5 |
     *    +--+
     */
    constructor(stat) {
        this.stat = stat.slice(0, 6);
    }

    fix(top, front) {
        switch (this.stat.indexOf(top)) {
            case 1: this.rot_ns(1); break;
            case 2: this.rot_we(1); break;
            case 3: this.rot_we(-1); break;
            case 4: this.rot_ns(-1); break;
            case 5: this.rot_ns(2); break;
        }
        for (let i = 0; i < 4; ++i) {
            if (this.stat[1] === front)
                return true;
            this.rot(1);
        }
        return false;
    }

    rot(val) {
        if (val < 0) val += 4 * Math.floor(-val / 4) + 4;
        const old_i = [1, 2, 4, 3];
        const new_i = [val, val + 1, val + 2, val + 3].map(elt => old_i[elt % 4]);
        [this.stat[old_i[0]], this.stat[old_i[1]], this.stat[old_i[2]], this.stat[old_i[3]]] =
            [this.stat[new_i[0]], this.stat[new_i[1]], this.stat[new_i[2]], this.stat[new_i[3]]];
    }

    rot_ns(val) {
        if (val < 0) val += 4 * Math.floor(-val / 4) + 4;
        const old_i = [0, 1, 5, 4];
        const new_i = [val, val + 1, val + 2, val + 3].map(elt => old_i[elt % 4]);
        [this.stat[old_i[0]], this.stat[old_i[1]], this.stat[old_i[2]], this.stat[old_i[3]]] =
            [this.stat[new_i[0]], this.stat[new_i[1]], this.stat[new_i[2]], this.stat[new_i[3]]];
    }

    rot_we(val) {
        if (val < 0) val += 4 * Math.floor(-val / 4) + 4;
        const old_i = [0, 2, 5, 3];
        const new_i = [val, val + 1, val + 2, val + 3].map(elt => old_i[elt % 4]);
        [this.stat[old_i[0]], this.stat[old_i[1]], this.stat[old_i[2]], this.stat[old_i[3]]] =
            [this.stat[new_i[0]], this.stat[new_i[1]], this.stat[new_i[2]], this.stat[new_i[3]]];
    }

    equals(dice) {
        const cmp = (u, v) => u.map((e, i) => e === v[i]).reduce((car, cdr) => car && cdr, true);
        const self = new Dice(this.stat);
        for (let i = 0; i < 4; ++i) {
            if (cmp(self.stat, dice.stat)) return true;
            self.rot_ns(1);
            for (let j = 0; j < 4; ++j) {
                if (cmp(self.stat, dice.stat)) return true;
                self.rot(1);
            }
            self.rot_ns(-1);
            self.rot(1);
        }
        self.rot_ns(2);
        for (let j = 0; j < 4; ++j) {
            if (cmp(self.stat, dice.stat)) return true;
            self.rot(1);
        }
        return false;
    }
}


new Promise(function (resolve, reject) {
    let content = "";
    process.stdin.on("data", chunk => { content += chunk; });
    process.stdin.on("end", () => { resolve([content, process.stdout]); });
}).then(function([cin, cout]) {
    const [a, b] = cin.split("\n").map(elt => new Dice(elt.split(" ").map(e => parseInt(e))));
    cout.write(`${a.equals(b) ? "Yes" : "No"}\n`);
});



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

// 1-21.cpp
// author: Seong Yong-ju ( @sei40kr )
// Copyright (c) 2018 Seong Yong-ju

#define DEBUG(x) cout << #x << ": " << x << endl

#define MIN(a, b) (a > b ? b : a)
#define MAX(a, b) (a > b ? a : b)

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); --i)

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define RREP(i, n) for (int i = (n)-1; i >= 0; --i)

#define ALL(a) (a).begin(), (a).end()

using namespace std;

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

  int a, b;
  cin >> a >> b;
  int val = a * (int)pow(10, (int)log10(b) + 1) + b;

    bool ans = false;
    FOR(n, 1, 400) {
      if (n * n == val) {
        ans = true;
      }
    }

  cout << (ans ? "Yes" : "No") << endl;
}


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


int main(){
  long long N, K;
  cin >> N >> K;
  long long ans;
  if(K%2!=0){
    ans=(N/K)*(N/K)*(N/K);
  }
  else{
    ans=(N/K)*(N/K)*(N/K)+((N+K/2)/K)*((N+K/2)/K)*((N+K/2)/K);
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
void ABC50(void);
void ABC52(void);
void ABC53(void);
void ABC54(void);
void ABC55(void);
void ABC56(void);
void ABC57(void);
void ABC58(void);
void ABC59(void);

int main(void){
    ABC53();
    return 0;
}

void ABC53(void){
    int n;
    cin >>n;
    if(n<1200)cout<<"ABC"<<endl;
    else cout<<"ARC"<<endl;
}

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

int main(){
    int n;
    cin >> n;
    string s;
    cin >> s;
    char last = s[0];
    int ans = 1;
    for(int i = 1; i < s.length(); i++){
        if(s[i] != last){
            ans++;
            last = s[i];
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb(x) push_back(x)
#define all(x) x.begin(), x.end()
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = 1e9;
const ll INF = 1e18;
const ld EPS = 1e-10;

struct edge {
    int to;
    ll cost;
};

const int MAX_V = 3e5;
vector<edge> es[MAX_V];
vector<ll> d(MAX_V, INF);

void add_edge(int s, int t, ll c){
    es[s].emplace_back((edge) {t, c});
}

void dijkstra(int s){
    priority_queue<pli, vector<pli>, greater<pli> > que;
    d[s] = 0;
    que.push(pii(0, s));
    while(!que.empty()){
        pli p = que.top();
        que.pop();
        int i = p.second;
        if(d[i] < p.first) continue;
        for(auto &e: es[i]){
            if(d[e.to] > d[i]+e.cost){
                d[e.to] = d[i]+e.cost;
                que.push(pli(d[e.to], e.to));
            }
        }
    }
}

int main(){
    int N, M, S;
    cin >> N >> M >> S;
    //銀貨の最大枚数
    int L = 5001;
    ll u, v, A, B;
    //銀貨をj枚持ってiにいる状態をL*i+jと表す
    rep(i, M){
        cin >> u >> v >> A >> B;
        u--, v--;
        rep(j, L){
            if(j < A) continue;
            add_edge(L*u+j, L*v+j-A, B);
            add_edge(L*v+j, L*u+j-A, B);
        }
    }
    ll C, D;
    rep(i, N){
        cin >> C >> D;
        rep(j, L){
            if(j+C >= L) break;
            add_edge(L*i+j, L*i+j+C, D);
        }
    }
    dijkstra(min(S, L-1));
    rep2(i, 1, N-1){
        ll ans = INF;
        rep(j, L) ans = min(ans, d[L*i+j]);
        cout << ans << endl;
    }
}

Measured memory_bytes: 45980
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#define ll long long

using namespace std;

int main() {
    int n;
    cin >> n;
    int sum = 0;
    vector<int> dists(n);
    for (int i = 0; i < n; i++) {
        int x;
        cin >> x;
        sum += x;
        dists[i] = x;
    }
    int avg = sum / n;
    int avg2 = avg + 1;
    int tot_energy_1 = 0;
    int tot_energy_2 = 0;
    for (int i = 0; i < n; i++) {
        tot_energy_1 += pow(avg - dists[i], 2);
        tot_energy_2 += pow(avg2 - dists[i], 2);
    }
    cout << min(tot_energy_1, tot_energy_2);
}

Measured memory_bytes: 3576
#include <bits/stdc++.h>
using namespace std;
typedef vector<int > vi;
class UnionFind {
private:
	vi p, rank, setSize;
	int numSets;
public:
	UnionFind(int N) {
		p.assign(N, 0); rank.assign(N, 1); setSize.assign(N, 1);
		numSets = N; for (int i = 0; i<N; i++)p[i] = i;
	}
	int find_set(int i) { return p[i] == i ? i : p[i] = find_set(p[i]); }	//find the representative element(root of the tree)
	bool issameset(int i, int j) {
		//1 for same set
		return find_set(i) == find_set(j);
	}
	void Unionset(int i, int j) {
		if (!issameset(i, j)) {
			int x = find_set(i); int y = find_set(j);
			numSets--;
			if (rank[x] < rank[y]) {
				p[x] = y;
				setSize[y] += setSize[x];
			}
			else {
				p[y] = x;
				setSize[x] += setSize[y];
				if (rank[x] == rank[y])rank[x] ++;
			}
 
		}
 
	}
	int numDisjointsets() {
		return numSets;
	}
	int sizeOfSet(int i) { 
		return setSize[find_set(i)]; 
	}
 
};
int main(){
	int n;cin>>n;
	UnionFind dis(n);
	vector<int> arrmv;
	for(int i=0;i<n;i++){
		int t;cin>>t;
		arrmv.push_back(t);
	}
	for(int i=1;i<(int)arrmv.size();i++){
		if(arrmv[i]<=arrmv[i-1])dis.Unionset(i,i-1);
	}
	int maxno=-1;
	for(int i=0;i<n;i++){
		maxno=max(maxno,dis.sizeOfSet(i));
	}
	cout<<maxno-1<<endl;
	return 0;
}


Measured memory_bytes: 2044
package main

import "fmt"

type Combination struct {
	n int
	f *Factorial
}

func NewCombination(n int, m int64) *Combination {
	f := NewFactorial(n, m)
	return &Combination{n, f}
}

func (c *Combination) Combination(n, k int) int64 {
	return c.f.F[n] * c.f.Inv[k] % c.f.Mod * c.f.Inv[n-k] % c.f.Mod
}

func (c *Combination) Permutation(n, k int) int64 {
	return c.Combination(n+k-1, n-1)
}

func (c *Combination) Factorial(n int) int64 {
	return c.f.F[n]
}

type Factorial struct {
	n      int
	Mod    int64
	F, Inv []int64
}

func NewFactorial(n int, m int64) *Factorial {
	f := Factorial{n, m, nil, nil}
	f.F = make([]int64, n+1)
	f.Inv = make([]int64, n+1)
	f.F[0] = 1
	for i := 1; i <= n; i++ {
		f.F[i] = f.F[i-1] * int64(i) % f.Mod
	}
	f.Inv[n] = pow(f.F[n], f.Mod-2, f.Mod)
	for i := n; i > 0; i-- {
		f.Inv[i-1] = f.Inv[i] * int64(i) % f.Mod
	}
	return &f
}

func pow(x, n, m int64) int64 {
	if n == 0 {
		return 1
	}
	if n&1 == 0 {
		r := pow(x, n/2, m)
		return r * r % m
	}
	return x * pow(x, n-1, m) % m
}

func div(x, n, m int64) int64 {
	return x * pow(n, m-2, m) % m
}

func main() {
	var n, m, k int
	const M int64 = 998244353
	fmt.Scan(&n, &m, &k)
	c := NewCombination(n, M)
	var ans int64
	for i := 0; i <= k; i++ {
		m64, p := int64(m), int64(n-i-1)
		x := c.Combination(n-1, i)
		x = x * m64 % M
		x = x * pow(m64-1, p, M) % M
		ans += x
		ans %= M
	}
	fmt.Println(ans)
}


Measured memory_bytes: 5056
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列
using namespace std;
long long choose(long long a){
  return a*(a-1)/2;
}
 
int main() {
  int n;
  cin>>n;
  vector<int> a(n);
  for(int i=0;i<n;i++){
    cin>>a.at(i);
    a.at(i)--;
  }
  vector<int> count(n);
  for(int i=0;i<n;i++) count.at(a.at(i))++;
  long long tot=0;
  for(int i=0;i<n;i++) tot+=choose(count.at(i));
  for(int i=0;i<n;i++){
    long long ans=0;
    ans+=tot;
    ans-=choose(count.at(a.at(i)));
    ans+=choose(count.at(a.at(i))-1);
    cout<<ans<<endl;
  }
}

Measured memory_bytes: 4224
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication5
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int a = int.Parse(Console.ReadLine());

            int remain = n % 500;
            if(remain > a)
            {
                Console.WriteLine("No");
            } 
            else
            {
                Console.WriteLine("Yes");
            }
            
        }
    }
}


Measured memory_bytes: 11092
from collections import Counter
S = ''
while True:
    try:
        s = input().lower()
    except:
        break
    S += s
C = Counter(S)
A = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r',
     's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
for Ai in A:
    print(Ai + ' : ' + '{0}'.format(C[Ai]))


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


namespace ConsoleApp9
{
    class Program
    {
        static void Main(string[] args)
        {
            char[] s = Console.ReadLine().ToArray();
            char[] t = Console.ReadLine().ToArray();
            Array.Sort(s);
            Array.Sort(t);
            string ans = null;
            int Length;
            int Lengthkind;
            if (s.Length >= t.Length) { Length = t.Length; Lengthkind = 0; }
            else { Length = s.Length; Lengthkind = 1; }
            for (int i = 0; i < Length; i++)
            {
                if (s[i] > t[t.Length - i - 1]) { ans = "No"; break; }
                else if (s[i] < t[t.Length - i - 1]) { ans = "Yes";break; }
                if (i == Length - 1)
                {
                    if (Lengthkind == 0) ans = "No";
                    else ans = "Yes";
                    break;
                }
            }
            Console.WriteLine(ans);
        }
    }
}

Measured memory_bytes: 13396