akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

typedef long long  ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef double ld;
typedef complex<ld> Point;
const ll INF = mod * mod;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
typedef vector<int> vec;

void solve() {
	int cnt = 0;
	string s; cin >> s;
	rep(i, s.length()) {
		if (s[i] == 'o')cnt++;
	}
	cnt += 15 - (int)s.length();
	if (cnt >= 8) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(5);
	//while (cin >> n)solve();
	solve();
	//stop
	return 0;
}

Measured memory_bytes: 256
dic = {'A':10, 'B':11, 'C':12, 'D':13, 'E':14, 'F':15}
x, y = map(str, input().split())

if dic[x] < dic[y]:
    print('<')

elif dic[x] == dic[y]:
    print('=')

else:
    print('>')

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

//#define int long long
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i < b; i++)
#define out(x) cout << x << endl
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<bool> > vvb;
typedef vector<vector<double> > vvd;
typedef vector<vector<string> > vvs;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

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;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

signed main()
{   
    gearup;
    ll n;cin>>n;
    map<ll,ll> mp;
    vl a(n);
    rep(i,n)cin>>a[i];
    vl b(n);
    rep(i,n){
        b[i]=i+1+a[i];
        mp[b[i]]++;
    }
    vl c(n);
    ll res = 0;
    rep(i,n){
        c[i]=i+1-a[i];
        res+=mp[c[i]];
    }
    out(res);
}


Measured memory_bytes: 30476
x=int(input())
from math import sqrt

def prime_judge(n):
    m=int(sqrt(n)//1)
    for i in range(2,m+1):
        if n%i==0:
            return False
    return True

for i in range(x,x+100000):
    if prime_judge(i):
        print(i)
        exit()

Measured memory_bytes: 62428
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

int main() {
    ll a, b, c;
    cin >> a >> b >> c;
    cout <<  b + min(c, a + b + 1) << endl;

    return 0;
}


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

#include <assert.h>    // LON
#include <math.h>    // sqrt()


using namespace std;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) ll(x.size())
typedef long long ll;
//typedef pair<int, int> P;
typedef pair<ll, ll> P;
//const double INF = 1e10;
const ll INF = LONG_LONG_MAX;
const ll MINF = LONG_LONG_MIN;
//const int INF = INT_MAX;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }


//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

typedef priority_queue<ll, vector<ll>, greater<ll>> PQ_ASK;
const int mod = 1000000007;


int main() {
    string o, e;
    cin >> o >> e;

    for (int i = 0; i < o.size() + e.size(); i++) {
        if (i % 2 == 0) {
            cout << o[i / 2];
        } else {
            cout << e[i / 2];
        }
    }
    cout << endl;

}



Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <iostream>
#include <utility>
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) 
 
using namespace std;
using ll = long long;
using ld = long double;
using Vl = vector<ll>;
using pll = pair<ll, ll>;
using vb = vector<bool>;
using vs = vector<string>;

#define REP(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, m, n) for(int i = m; i < (n); i++)

ll N,K,Q;
ll A[100001];
int main() {
    cin >> N >> K >> Q;
    REP(i,Q){
        ll ai;
        cin >> ai;
        A[ai-1] += 1;
    }
    REP(i,N){
        if(A[i]>Q-K){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
const int maxn = 3000;
double p[maxn];
double dp[maxn][maxn];		//dp[i][j]´ú±íµ½ÁËµÚi¸öÓ²±ÒÓÐj¸öÓ²±ÒÊÇÕýÃæµÄ¸ÅÂÊ 

//dp[i][j] = dp[i-1][j-1]*p[i] + dp[i-1][j]*(1-p[i]) 
int main() {
	int n;cin>>n;
	for(int i = 1;i <= n;i++) cin>>p[i];
	
	dp[1][1] = p[1];
	dp[1][0] = 1-p[1];
	for(int i = 2;i <= n;i++) {
		for(int j = 0;j <= n;j++) {
			dp[i][j] = dp[i-1][j-1]*p[i] + dp[i-1][j]*(1-p[i]);
 		}
	}
	double ans = 0;
	for(int i = n/2+1;i <= n;i++) {
		ans += dp[n][i];
	}
	printf("%.10lf\n",ans);
	return 0;
} 

Measured memory_bytes: 70528
import java.util.Scanner

object Main {
  def main(args:Array[String]) {
    val sc:Scanner = new Scanner(System.in)
    val a, b, c = sc.nextInt()

    if ((a == b && a < c) || (b == c && a > b) || (c == a && a < b)) {
      print("YES")
    } else {
      print("NO")
    }
  }
}

Measured memory_bytes: 25404
#include <stdio.h>

int main() {
  int fee_a, fee_b, fee_c, fee_d, cost = 0;
  scanf("%d %d %d %d", &fee_a, &fee_b, &fee_c, &fee_d);
  cost += (fee_a < fee_b)? fee_a : fee_b;
  cost += (fee_c < fee_d)? fee_c : fee_d;
  printf("%d\n", cost);
  return 0;
}


Measured memory_bytes: 128
#include<cstdio>
#include<vector>
#include<cstdlib>
#include<map>
#define RI register int
#define CI const int&
using namespace std;
const int N=100005;
int n,cur,pfx[N<<1]; vector <int> v[N<<1]; map <int,int> Hash;
inline void addedge(CI x,CI y)
{
	printf("%d %d\n",x,y); v[x].push_back(y); v[y].push_back(x);
}
inline void DFS(CI now=1,CI fa=0)
{
	pfx[now]=pfx[fa]^(now<=n?now:now-n);
	if (pfx[now]==n) addedge(1,n),addedge(now,n<<1),exit(0);
	if (Hash.count(pfx[now]^n^1))
	addedge(Hash[pfx[now]^n^1],n),addedge(now,n<<1),exit(0);
	Hash[pfx[now]]=now; for (vector <int>::iterator it=v[now].begin();it!=v[now].end();++it)
	if (*it!=fa) DFS(*it,now);
}
int main()
{
	//freopen("CODE.in","r",stdin); freopen("CODE.out","w",stdout);
	scanf("%d",&n); for (cur=1;cur<n;cur<<=1);
	if (cur==n) return puts("No"),0; puts("Yes");
	addedge(1,2); addedge(2,3); addedge(3,n+1); addedge(n+1,n+2); addedge(n+2,n+3);
	for (RI i=5;i<=n;i+=2) addedge(1,i-1),addedge(i,i-1),addedge(1,n+i),addedge(n+i,n+i-1);
	if (n&1) return 0; return DFS(),0;
}

Measured memory_bytes: 17272
"use strict";

//　組み合わせ(被りなし)
const combineWithoutRepetitions = (comboOptions, comboLength) => {
  if (comboLength === 1) {
    return comboOptions.map(comboOption => [comboOption]);
  }

  // Init combinations array.
  const combos = [];

  // Eliminate characters one by one and concatenate them to
  // combinations of smaller lengths.
  comboOptions.forEach((currentOption, optionIndex) => {
    const smallerCombos = combineWithoutRepetitions(
      comboOptions.slice(optionIndex + 1),
      comboLength - 1
    );

    smallerCombos.forEach((smallerCombo) => {
      combos.push([currentOption].concat(smallerCombo));
    });
  });

  return combos;
}

const main = arg => {
    arg = arg.trim().split("\n");
    const N = parseInt(arg[0]);
    const names = arg.splice(1, N + 1);
    
    const p = [0, 0, 0, 0, 0, 0, 1, 1, 1, 2];
    const q = [1, 1, 1, 2, 2, 3, 2, 2, 3, 3];
    const r = [2, 3, 4, 3, 4, 4, 3, 4, 4, 4];
    
    let march = [0, 0, 0, 0, 0];
    
    for(let i in names) {
        if(names[i][0] === "M") {
            march[0]++;
        }
        
        if(names[i][0] === "A") {
            march[1]++;
        }
        
        if(names[i][0] === "R") {
            march[2]++;
        }
        
        if(names[i][0] === "C") {
            march[3]++;
        }
        
        if(names[i][0] === "H") {
            march[4]++;
        }
    }
    
    let answer = 0;
    
    for(let i=0; i<10; i++) {
        answer += march[p[i]] * march[q[i]] * march[r[i]];
    }
    
    console.log(answer);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

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

int c[11][1010];

int main() {
    int h, w, k;
    cin >> h >> w >> k;
    vector<string> s(h);
    rep(i, h) cin >> s[i];

    int ans = h * w;
    rep(bit, 1 << (h - 1)) {
        int g = 0;
        vector<int> id(h);
        rep(i, h) {
            id[i] = g;
            if (bit >> i & 1) ++g;
        }
        ++g;
        rep(i, g) rep(j, w) c[i][j] = 0;
        rep(i, h) rep(j, w) {
            c[id[i]][j] += (s[i][j] - '0');
        }

        int score = g - 1;
        vector<int> now(g);
        auto add = [&](int j) {
            rep(i, g) now[i] += c[i][j];
            rep(i, g) if (now[i] > k) return false;
            return true;
        };
        rep(j,w){
            if(!add(j)){
                score++;
                now = vector<int>(g);
                if(!add(j)){
                    score = 1e9;
                    break;
                }
            }
        }
        ans = min(ans, score);
    }
    cout << ans << endl;
}

Measured memory_bytes: 3660
n = int(input())
t,a = map(int, input().split())
h = list(map(int, input().split()))
ans = float('INF')
pos = 0
for i in range(n):
  temp = t - h[i] * 0.006
  if abs(temp - a) < ans:
    ans = abs(temp - a)
    pos = i + 1
print(pos)

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {

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

		int countcase = 0;

		while(true) {
			int getNum = sc.nextInt();
			if(getNum==0) {
				sc.close();
				break;
			}else {
				countcase++;
				System.out.println("Case " + countcase + ": " + getNum);

			}

		}


	}

}



Measured memory_bytes: 41456
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define llong long long
#define pb(a) push_back(a)
#define INF 9999999

using namespace std;

typedef pair<int,int> P;

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

long Comb(int x,int y){
	long ans=1;
	for(int i=x;i>x-y;i--){
		ans=ans*i;
	}
	for(int i=1;i<=y;i++){
		ans=ans/i;
	}
	return ans;
}
int main(){
	int n,a[100001];
	cin>>n;
	REP(i,n){
		cin>>a[i];
	}
	SORT(a,n);
	long m=a[n-1];
	long x,y;
	int med;
	if(m%2==0){
		med=m/2;
	}
	else{
		med=m/2+1;
	}
	long div=2000000000;
	REP(i,n){
		if(abs(med-a[i])<div){
			div=med-a[i];
			y=a[i];
		}
	}
	x=m;
	cout<<x<<" "<<y;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using p = pair<int,string>;
auto const INF = (ll)1e19;

int main(){
  string s;
  cin >> s;
  char b=s[0];
  auto c = 1;
  auto cc = vector<long long>();
  for(int i=1;i<s.size();i++){
     if(s[i]==b) c++;
     else{
        cc.push_back(c);
        c=1;
     }
     b=s[i];
  }
  cc.push_back(c);
  long long ans =0;
  int i= s[0]=='<'?0:1;
  for(;i<cc.size()-1;i+=2){
         ans += (min(cc[i],cc[i+1])-1)*min(cc[i],cc[i+1])/2;
         ans += max(cc[i],cc[i+1])*(max(cc[i],cc[i+1])+1)/2;
  }
  if(s[0]=='<'){
     if(cc.size()%2==1){
        ans+=cc.back()*(cc.back()+1)/2;
     }
     cout << ans<<endl;
  }else{
     ans+=cc.front()*(cc.front()+1)/2;
     if(cc.size()%2==0){
        ans+=cc.back()*(cc.back()+1)/2;
     }
     cout << ans << endl;
  }

}

Measured memory_bytes: 3068
#include <bits/stdc++.h>
#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 rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define show(x) cout << #x << " = " << (x) << endl
#define show2(x,y) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl
#define show3(x,y,z) cout << #x << " = " << (x) << ", " << #y << " = " << (y) <<  ", " << #z << " = " << (z) << endl
#define showv(v) rep(i,v.size()) printf("%d%c", v[i], i==v.size()-1?'\n':' ')
#define showv2(v) rep(j,v.size()) showv(v[j])
#define showt(t,n) rep(i,n) printf("%d%c", t[i], i==n-1?'\n':' ')
#define showt2(t,r,c) rep(j,r) showt(t[j],c)
#define showvp(p) rep(i,p.size()) printf("%d %d\n", p[i].first, p[i].second);
#define printv(v) rep(i,v.size()) printf("%d\n", v[i])
#define printt(t,n) rep(i,n) printf("%d\n", t[i])
#define incl(v,x) find(rng(v),x)!=v.end()
#define incls(s,c) s.find(c)!=string::npos
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define bit(n,k) ((n>>k)&1) // nのk bit目
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vs = vector<string>;
using P = pair<int, int>;
using T = tuple<int, int, int>;
using vp = vector<P>;
using vt = vector<T>;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = (1<<30)-1;
//const ll INF = (1LL<<62)-1;
#define dame { puts("No"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
//inline int in() { int x; scanf("%d",&x); return x;}
template<class T = int> inline T in() { T x; cin >> x; return (x);}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
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; }

int main () {
  int n = in();
  map<string,int> mp;
  rep(i,n) {
    string s = in<string>();
    mp[s]++;
  }
  int mx = 0;
  for (auto p : mp) {
    chmax(mx,p.se);
  }
  for (auto p : mp) {
    if (p.se == mx) cout << p.fi << '\n';
  }
  return 0;
}

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

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
#define fout(x) cout << fixed << setprecision(10) << x << endl
//#define int long long int
const int MOD = 1000000007;
const ll LINF = (ll)1e18 - 1;
const int INF = 1e9 - 1;
const double EPS = 0.000000001;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

auto print = [](auto &v) {
  for(auto x : v) {
    cout << x << " ";
  }
  cout << endl;
};

signed main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  VVI d(10, VI(10, 0));
  rep(i, n) {
    d[to_string(i + 1)[0] - '0'][(i + 1) % 10]++;
  }
  int ans = 0;
  rep(i, 10) rep(j, 10) {
    ans += d[i][j] * d[j][i];
  }
  out(ans);
  return 0;
}


Measured memory_bytes: 256
N=int(input())
A=list(map(int,input().split()))
s=[0]*(N+1)
for i in range(N): s[i + 1]=s[i]+A[i]
C=[0]*(N)
C[0]=-s[N]
x=10**10
p=0
for i in range(1, N):
    C[i]=C[i-1]+2*A[i-1]
    if x>abs(C[i]):
        x=abs(C[i])
        p=i
print(x)
#print(C)


Measured memory_bytes: 28652
#include <bits/stdc++.h>
#define endl '\n'
#define int long long
using namespace std;

int N, W;
int constexpr max_val = 100009, max_item = 109, inf = numeric_limits<int>::max() / 8;
int dp[max_item][max_val]; // dp[i][v] = min weight that can afford value v to i

signed main() {
    ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
    fill(&dp[0][0], &dp[0][0] + max_item * max_val, inf);

    cin >> N >> W;
    for(int i = 1; i <= N; ++i) {
        int w, v;
        cin >> w >> v;
        dp[i][v] = w;
        if(i == 1) continue ;
        for(int j = 0; j < max_val; ++j) {
            dp[i][j] = min(dp[i][j], dp[i - 1][j]);
            if(j + v >= max_val) continue;
            dp[i][j + v] = min(dp[i][j + v], dp[i - 1][j] + w);
        }
    }

    int ans = 0;

    for(int j = 0; j < max_val; ++j) {
        if(dp[N][j] <= W) ans = j;
    }
    cout << ans << endl;
}

Measured memory_bytes: 85376
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp>     // Including tree_order_statistics_node_update
using namespace __gnu_pbds;
using namespace std;
/*
         ########     ########   ########   #########   ##       #######   ##       #######
         #      #     #      #   #      #       #       # #      #     #   # #      #     #
         #      #     #      #   #      #       #       #  #     #     #   #  #     #     #
         ########     #      #   #      #       #       #   #    #     #   #   #    #     #
         ###          #      #   #      #       #       #    #   #######   #    #   #######
         #  #         #      #   #      #       #       #   #    #     #   #   #    #     #
         #   #        #      #   #      #       #       #  #     #     #   #  #     #     #
         #    #       #      #   #      #       #       # #      #     #   # #      #     #
         #     #      ########   ########       #       ##       #     #   ##       #     #     
*/

#define rep(i, a, b) for (__typeof((b)) i = (a); i < (b); i++)
#define nrep(i, a, b) for (__typeof((b)) i = (a); i > (b); i--)
#define all(a) (a).begin(), (a).end()
#define ff first
#define ss second
#define ppi pair<int, int>
#define pppi pair<ppi, int>
#define vi vector<int>
#define vii vector<ppi>
#define viii vector<pppi>
#define vs vector<string>
#define pb push_back
#define bitcount __builtin_popcount //count no's of ones in a set bit
#define prq priority_queue
#define mp make_pair
#define mem(x, val) memset((x), (val), sizeof(x));
#define sz(x) (int)x.size()
#define M_PI 3.14159265358979323846
#define rootdada                      \
    ios_base::sync_with_stdio(false); \
    cin.tie(0);                       \
    cout.tie(0);
#define test  \
    int t;    \
    cin >> t; \
    while (t--)
#define debug(a)          \
    cerr << #a << ": ";   \
    for (auto i : a)      \
        cerr << i << " "; \
    cerr << '\n';
#define trace(a) cerr << #a << ": " << a << "\n"
#define print(ar, n)            \
    for (int u = 0; u < n; u++) \
    {                           \
        cout << ar[u] << " ";   \
    }                           \
    cout << endl;
#define int long long
#define M 1000000007
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
signed main()
{
    rootdada;

    int x, y;
    cin >> x >> y;
    int c = (4 * x - y) / 2;
    int t = (y - 2 * x) / 2;
    // cout << c << " " << t << endl;
    if (c + t == x && (2 * c + 4 * t) == y && c >= 0 && t >= 0)
        cout << "Yes\n";
    else
    {
        cout << "No\n";
    }
}

Measured memory_bytes: 3632
#include<cstdio>
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

int main(void) {
	string A, B;
	cin >> A >> B;
	if (A.size() < B.size()) {
		printf("LESS\n");
	} else if (A.size() > B.size()) {
		printf("GREATER\n");
	} else {
		for (int i = 0; i < A.size(); i++) {
			if (A[i] < B[i]) {
				printf("LESS\n");
				return 0;
			} else if (A[i] > B[i]) {
				printf("GREATER\n");
				return 0;
			}
		}
		printf("EQUAL\n");
	}

	return 0;
}


Measured memory_bytes: 3540
#include <iostream>

using namespace std;

int main(){

    int K, S;
    cin >> K >> S;

    int ans = 0;
    for (int i = 0; i <= K; i++){
        for (int j = 0; i + j <= S && j <= K; j++){
            if (S - (i + j) <= K){
                ans++;
            }
        }
    }

    cout << ans << endl;

    return 0;
}

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

int main(){
  long long H,res,i;
  cin >> H;
  res = 0;
  i = -1;
  while(H>0){
    H = floor((double)H/2);
    i = i + 1;
    res = res + pow((double)2,(double)i);
  }

  cout << res << endl;
  
  return 0;
}


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

int main() {

    int X;
    cin >> X;

    if (X >= 30) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 3616
import qualified Data.Vector as V
import qualified Data.ByteString.Char8 as C
import qualified Data.Array.IO as A

main = do
    n <- readLn
    as <- V.replicateM n C.getLine :: IO (V.Vector C.ByteString)
    let innerAB = V.sum $ V.map (countAB 0) as

    let blist = V.map ((=='B') . C.head) as
    let alist = V.map ((=='A') . C.last) as

    let bothlen = V.length $ (V.filter id) $ V.zipWith (&&) blist alist
    let lenBAchain = max 0 (bothlen - 1)

    let alen = V.length (V.filter id alist) - bothlen
    let blen = V.length (V.filter id blist) - bothlen

    let addi = min alen blen
    let chainRemnant = if bothlen>0 && alen+blen > 0 then 1 else 0

    print $ innerAB + lenBAchain + chainRemnant + addi

countAB :: Int -> C.ByteString -> Int
countAB n as = let (l,r) = C.breakSubstring (C.pack "AB") as
                in if C.null r then n else countAB (n+1) (C.tail (C.tail r))


Measured memory_bytes: 3196
#include <stdio.h>

int main(void){
  char c;
  scanf("%c",&c);
  if(c == 'a'||c == 'e'||c == 'i'||c == 'o'||c == 'u'){
    printf("vowel\n");
  }else printf("consonant\n");

  return 0;
}


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

#define rep(n) for(int i=0;i<n;i++)
#define repp(j, n) for(int j=0;j<n;j++)
#define reppp(i, m, n) for(int i=m;i<n;i++)
#define all(c) c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define debug(x) cerr << #x << ": " << x << endl

using namespace std;

typedef long long ll;
typedef pair<ll, ll> Pll;
typedef pair<int, int> Pii;

const ll MOD = 1000000007;
const long double EPS = 10e-10;

int main(){
    std::ios::sync_with_stdio(0); cin.tie(0);
    int a,b;
    cin >> a >> b;
    cout << ((a%2)&&(b%2)?"Yes":"No") << '\n';
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<map>
using namespace std;
const int N=200005;
map<int,int> mp;
map<int,int>::iterator ddq;
int n,i,j,k,l,x,y,ans,a[N],b[N],c[N],d[N],cnt,p[N];
bool brg[N];
int Abs(int a)
{
	return a>0?a:-a;
}
int find(int x)
{
	return !p[x]?x:p[x]=find(p[x]);
}
int main()
{
	scanf("%d",&n);
	for(i=1;i<=n;++i)
	{
		scanf("%d",a+i);
		a[n+1]^=a[i];
	}
	for(i=1;i<=n;++i)
	{
		scanf("%d",b+i);
		b[n+1]^=b[i];
	}
	for(i=1;i<=n+1;++i)
		c[i]=a[i],d[i]=b[i];
	sort(c+1,c+1+n+1);
	sort(d+1,d+1+n+1);
	for(i=1;i<=n+1;++i)
		if(c[i]!=d[i])
		{
			printf("-1");
			return 0;
		}
	for(i=1;i<=n;++i)
	if(a[i]!=b[i])
	{
		if(!mp.count(a[i]))
			mp[a[i]]=++cnt;
		if(!mp.count(b[i]))
			mp[b[i]]=++cnt;
		ans++;
		if(find(mp[a[i]])!=find(mp[b[i]]))
			p[find(mp[a[i]])]=find(mp[b[i]]);
	}
	for(i=1;i<=cnt;++i)
		if(find(i)==i)
			++ans;
	--ans;
	for(i=1;i<=n;++i)
		if(a[n+1]==b[i]&&a[i]!=b[i])
			break;
	if(i>n)
		++ans;
	printf("%d",ans);
	return 0;
}


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

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

	int N; cin >> N;
	int max_digit = to_string(N).size();

	int ans = 0;
	FOR(i, 1, N+1) {
		int first = to_string(i).front()-'0';
		int last = to_string(i).back()-'0';
		if (first==0 || last==0) continue;	
		if (to_string(i).size()==1) ++ans;
		if (to_string(i).size()!=1 && last==first) ++ans;
		FOR(j, 1, max_digit) {
			// if (first==last && to_string(i).size()==1) 	++ans;
			int tmp_min = 0, tmp_max = 0;
			tmp_min += last*pow(10, j);
			tmp_min += first;
			tmp_max = tmp_min;
			FOR(k, 1, j) tmp_max += 9*pow(10,k);
			// cout << i << " " << tmp_max << " " << tmp_min << endl;
			if (tmp_max <= N) ans += pow(10,j-1);
			else if (tmp_min <= N) {
				while (tmp_min <= N) {
					++ans;
					tmp_min += 10;
				}
			}
			// if ((last*pow(10,j) + first) <= N) {
			// 	cout << i << " " <<  last*pow(10,j) + first << " " << pow(10, j-1) <<  endl;
			// 	ans += pow(10, j-1);
			// }
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
// #define DEBUGGING
#include <bits/stdc++.h>
#define endl '\n'
#define ALL(V) (V).begin(), (V).end()
#define ALLR(V) (V).rbegin(), (V).rend()
template <typename T> using V = std::vector<T>;
template <typename T> using VV = V<V<T>>;
using ll = std::int64_t;
using ull = std::uint64_t;
using PLL = std::pair<ll, ll>;
using TLL = std::tuple<ll, ll, ll>;
template <typename T> const T& var_min(const T &t) { return t; }
template <typename T> const T& var_max(const T &t) { return t; }
template <typename T, typename... Tail> const T& var_min(const T &t, const Tail&... tail) { return std::min(t, var_min(tail...)); }
template <typename T, typename... Tail> const T& var_max(const T &t, const Tail&... tail) { return std::max(t, var_max(tail...)); }
template <typename T, typename... Tail> void chmin(T &t, const Tail&... tail) { t = var_min(t, tail...); }
template <typename T, typename... Tail> void chmax(T &t, const Tail&... tail) { t = var_max(t, tail...); }
template <typename T> const T& clamp(const T &t, const T &low, const T &high) { return std::max(low, std::min(high, t)); }
template <typename T> void chclamp(T &t, const T &low, const T &high) { return t = clamp(t, low, high); }
namespace init__ { struct InitIO { InitIO() { std::cin.tie(nullptr); std::ios_base::sync_with_stdio(false); std::cout << std::fixed << std::setprecision(30); } } init_io; }
#define mv_rec make_v(init, tail...)
template <typename T> T make_v(T init) { return init; }
template <typename T, typename... Tail> auto make_v(T init, size_t s, Tail... tail) { return V<decltype(mv_rec)>(s, mv_rec); }
#undef mv_rec
using namespace std;
#ifdef DEBUGGING
#include "../../debug/debug.cpp"
#else
#define DEBUG(...) 0
#define DEBUG_SEPARATOR_LINE 0
#endif

const size_t SIZE = 5010;
ll dp1[SIZE], dp2[SIZE * SIZE];

int main() {
    ll N;
    cin >> N;
    V<ll> A(3), B(3);
    for(ll &e : A) cin >> e;
    for(ll &e : B) cin >> e;
    
    for(ll i = 0; i <= N; i++) {
        chmax(dp1[i], i);
        for(ll j = 0; j < 3; j++) {
            if(i < A[j]) continue;
            chmax(dp1[i], dp1[i - A[j]] + B[j]);
        }
    }

    ll max_n = dp1[N];

    for(ll i = 0; i <= max_n; i++) {
        chmax(dp2[i], i);
        for(ll j = 0; j < 3; j++) {
            if(i < B[j]) continue;
            chmax(dp2[i], dp2[i - B[j]] + A[j]);
        }
    }

    cout << dp2[max_n] << endl;
    return 0;
}


Measured memory_bytes: 195584
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)


def main():
    n, m = map(int, input().split())
    h = list(map(int, input().split()))
    tree = [[] for i in range(n)]
    mv = [-1] * (n)
    for i in range(m):
        a, b = map(int, input().split())
        a -= 1
        b -= 1
        tree[a].append(b)
        tree[b].append(a)
    ans = 0
    for i in range(n):
        mm = i
        for j in range(len(tree[i])):
            if h[mm] <= h[tree[i][j]]:
                mm = tree[i][j]
        if mm == i:
            ans += 1

    print(ans)


main()


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

int main() {
  string s;
  cin>>s;
  int n=s.size();
  
  int r=0,b=0;
  for(int i=0;i<n;i++){
    if(s[i]=='1')
      r++;
    else b++;
  }
  
  cout<<2*min(r,b);
  
}

Measured memory_bytes: 512
#include<iostream>
#include<algorithm>
#include<string>
#include<deque>
#define rep(i,rept)	for(int i = 0; i<(ll)rept;++i)
typedef long long ll;
using namespace std;

int main() {

	int n = 0, a = 0, b = 0, c = 0;
	int m_a[200] = {}, m_b[200] = {}, m_c[200] = {};
	int fa[200] = {}, fb[200] = {}, fc[200] = {};
	int ans[200] = {};
	cin >> n;
	rep(i, n) {
		cin >> a >> b >> c;
		m_a[i] = a;
		m_b[i] = b;
		m_c[i] = c;
		fa[m_a[i]]++;
		fb[m_b[i]]++;
		fc[m_c[i]]++;
	}

	rep(i, n) {

		if (fa[m_a[i]] == 1) {
			ans[i] += m_a[i];
		}
		if (fb[m_b[i]] == 1) {
			ans[i] += m_b[i];
		}
		if (fc[m_c[i]] == 1) {
			ans[i] += m_c[i];
		}
	}
	rep(i, n) {
		cout << ans[i] << endl;
	}
	return 0;

}



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

const int MOD = 1000000007;

//long long
using ll = long long;

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

//for
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

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

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


int main(){
  int N;
  cin >> N;
  vector<string>S(N);
  vector<int>B(26, MOD);
  REP(i, N) cin >> S.at(i);
  REP(i, N){
    vector<int>A(26, 0);
    REP(j, S.at(i).size()){
      A.at(S.at(i).at(j) - 'a')++;
    }
  
    REP(j, 26){
      if(A.at(j) < B.at(j)) B.at(j) = A.at(j);
    }
  
  
  }

REP(i, 26){
  REP(j, B.at(i)) {
    cout << (char)('a' + i);
  }
}
cout << endl;

}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int d1[6], d2[6], i;
	char ch;

	for (i = 0; i < 6; i++)
		scanf("%d", &d1[i]);

	ch = getchar();

	while (1) {
		ch = getchar();

		if (ch == 'N') {
			d2[0] = d1[1];
			d2[1] = d1[5];
			d2[2] = d1[2];
			d2[3] = d1[3];
			d2[4] = d1[0];
			d2[5] = d1[4];
		}
		else if(ch == 'E') {
			d2[0] = d1[3];
			d2[1] = d1[1];
			d2[2] = d1[0];
			d2[3] = d1[5];
			d2[4] = d1[4];
			d2[5] = d1[2];
		}
		else if (ch == 'S') {
			d2[0] = d1[4];
			d2[1] = d1[0];
			d2[2] = d1[2];
			d2[3] = d1[3];
			d2[4] = d1[5];
			d2[5] = d1[1];
		}
		else if (ch == 'W') {
			d2[0] = d1[2];
			d2[1] = d1[1];
			d2[2] = d1[5];
			d2[3] = d1[0];
			d2[4] = d1[4];
			d2[5] = d1[3];
		}
		else if(ch == '\n') break;

		for (i = 0; i < 6; i++)
			d1[i] = d2[i];
	}

	printf("%d\n", d1[0]);

	return 0;
}

Measured memory_bytes: 600
N,Q = list(map(int,input().split()))
s = input()
q = []
for i in range(Q):
    t,d = input().split()
    q.append((t,d))

def simulate(i,mode):
    now = i
    for t,d in q:
        if s[now]==t:
            if d=="L":
                now-=1
                if now<0:
                    if mode=="L":
                        return False
                    else:
                        return True
            else:
                now+=1
                if now>N-1:
                    if mode=="R":
                        return False
                    else:
                        return True

    return True

#left

if not simulate(N-1,"L"):
    left = N
elif simulate(0,"L"):
    left = 0
else:
    l = 0
    r = N-1
    while r-l>1:
        if not simulate((l+r)//2,"L"):
            l = (l+r)//2
        else:
            r = (l+r)//2
    left = r

#right

if not simulate(0,"R"):
    right = N
elif simulate(N-1,"R"):
    right = 0
else:
    l = 0
    r = N-1
    while r-l>1:
        if not simulate((l+r)//2,"R"):
            r = (l+r)//2
        else:
            l = (l+r)//2
    right = N-r

print(N-right-left)



Measured memory_bytes: 90828
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define IFOR(i, m, n) for (ll i = n - 1; i >= m; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define FOREACH(x, a) for (auto&(x) : (a))
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ll(x.size())

int main() {
  ll n;
  cin >> n;
  map<string, ll> mp;
  vector<string> s = {"AC", "WA", "TLE", "RE"};
  for (string str : s) {
    mp[str] = 0;
  }
  REP(i, n) {
    string s;
    cin >> s;
    mp[s]++;
  }

  for (string str : s) {
    cout << str << " x " << mp[str] << endl;
  }
}

Measured memory_bytes: 3644
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader bf = null;
		bf = new BufferedReader(new InputStreamReader(System.in));
		int ans = 0;
		boolean temp,now;
		String str;
		String[] s;
		str = bf.readLine();
		s = str.split("");
		now = Integer.parseInt(s[0]) == 1;
		for(int i = 1;i < s.length;++i) {
			temp = Integer.parseInt(s[i]) == 1;
			if(now == temp) {
				ans++;
			}
			now = !now;
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 30804
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mod 1000000007

int main(){
    ll n;
    cin>>n;
    ll a[n];
    ll ans=0;
    for(int i=0;i<n;++i)cin>>a[i];
    ll soul=INT_MIN;
    for(int i=0;i<n;++i){
        if(soul<=a[i]){
            soul = a[i];
        }
        else {
            ans = ans + soul-a[i];
        }
    }
    cout<<ans;











    return 0;
}

Measured memory_bytes: 5156
import math
# 1 -> 5 -> 6

x = int(input())

if x <= 6:
    print(1)

elif x <= 11:
    print(2)

else:
    x -= 11
    ans = 2

    temp = x % 11

    if temp == 0:
        pass
    elif temp <= 6:
        ans += 1
    elif temp >= 5:
        ans += 2

    print(ans + int(math.floor(x / 11)) * 2)

Measured memory_bytes: 3060
from scipy.sparse.csgraph import floyd_warshall
import sys
input = sys.stdin.readline

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

cost = floyd_warshall(c)
ans = 0

for i in a:
    for j in i:
        if j != -1:
            ans += cost[j][1]

print(int(ans))

Measured memory_bytes: 17388
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/rope>

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define long long long 

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cout << name << " : " << arg1 << endl;
        //use cerr if u want to display at the bottom
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
#else
#define trace(...)
#endif

typedef trie<string,null_type,trie_string_access_traits<>,pat_trie_tag,trie_prefix_search_node_update> pref_trie;
typedef tree<long int,null_type,less<long int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef cc_hash_table<long int,long int, hash<long int>, equal_to<long int>, direct_mask_range_hashing<long int>, 
hash_standard_resize_policy<hash_exponential_size_policy<>, hash_load_check_resize_trigger<true>, true>> ht;

long int s;

int main(){
   IOS;
 /*    #ifndef ONLINE_JUDGE
         freopen("in.txt",  "r",  stdin);
         freopen("out.txt", "w", stdout);
     #endif */
  
  cin>>s;
  long int ans = 0, sum = 100;
  long int time = 0, add = 0;

  for(time = 0;true; time++){
      add = sum / 100;
      if(sum + add > s)
        break;
      sum +=  add;
  }

  if(sum < s)
    time++;

  cout<<time;

   return 0;
}

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

bool card[4][13];

int main(){
  int n, b;
  char a;
  cin >> n;
  for( int i = 0; i < n; i++){
    cin >> a >> b;
    switch(a){
      case 'S':
        card[0][b-1] =1;
        break;
      case 'H':
        card[1][b-1] =1;
        break;
      case 'C':
        card[2][b-1] =1;
        break;
      case 'D':
        card[3][b-1] =1;
        break;
    }
  }
  for( int i = 0; i < 52; i++){
    switch(i / 13){
      case 0:
        if( card[0][i%13] == 0) cout << "S " << i+1 << endl;
        break;
      case 1:
        if( card[1][i%13] == 0) cout << "H " << i%13+1 << endl;
        break;
      case 2:
        if( card[2][i%13] == 0) cout << "C " << i%13+1 << endl;
        break;
      case 3:
        if( card[3][i%13] == 0) cout << "D " << i%13+1 << endl;
        break;
    }
  }
}


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

int main(){
    int n;
    cin >> n;
    vector<string> s(n);
    int a = 0, w = 0, t = 0, r = 0;
    for(int i = 0; i < n; i++){
        cin >> s.at(i);
        if(s.at(i) == "AC") a++;
        else if(s.at(i) == "WA") w++;
        else if(s.at(i) == "TLE") t++;
        else r++;
    }
    cout << "AC x " << a << endl;
    cout << "WA x " << w << endl;
    cout << "TLE x " << t << endl;
    cout << "RE x " << r << endl;
}


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

using namespace std;

int main(){
    int m,n,sum=0;
    cin>>m>>n;
    int a[m];
    for(int i=0;i<m;i++)
      cin>>a[i];
    sort(a,a+m);
    for(int i=0;i<n;i++)
      sum = sum+a[i];
    cout<<sum;
}

Measured memory_bytes: 3624
import sys
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 7)

import numpy as np
from fractions import gcd

# 1と素数をとる

A,B = map(int,readline().split())

D = gcd(A,B)

U = 10**6 + 100
is_prime = np.zeros(U,dtype=np.bool)
is_prime[2] = 1
is_prime[3::2] = 1
for p in range(int(U**.5)+10):
    if is_prime[p]:
        is_prime[p*p::p+p] = 0
primes = is_prime.nonzero()[0]

factor = primes[D%primes==0]

for p in factor:
    while D%p == 0:
        D //= p

answer = 1+len(factor)
if D != 1:
    answer += 1
print(answer)

Measured memory_bytes: 24872
S = list(input())
s_1 = S[0::2]
s_2 = S[1::2]
s_1_w = s_1.count('0')
s_2_w = s_2.count('0')
s_1_b = s_1.count('1')
s_2_b = s_2.count('1')

if s_1_w+s_2_b <= s_1_b+s_2_w:
  print(s_1_w+s_2_b)
elif s_1_b+s_2_w <= s_1_w+s_2_b:
  print(s_1_b+s_2_w)

Measured memory_bytes: 4652
#include<algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<iostream>
#include<vector>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<string>
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define rep2(i,s,n) for(int i=s;i< (int)n; i++)
#define ll long long 
#define all(v) v.begin(),v.end()
using namespace std;
int main(){
  int h,w; cin>>h>>w;
  vector<string> s(h);
  rep(i,h) cin>>s[i];
  vector<vector<char>> x(h+2,vector<char>(w+2));
  rep(i,w) {
    x[0][i]='0';
    x[h+1][i]='0';
  }
  rep(i,h){
    x[i][0]='0';
    x[i][w+1]='0';
  }
  rep(i,h)rep(j,w) x[i+1][j+1]=s[i][j];
  //map<pair<int,int>,int> mp;
  vector<vector<int>> y(h+2,vector<int>(w+2));
  rep2(i,1,h+1){
    rep2(j,1,w+1){
      if(x[i][j]=='.'){
      if(x[i-1][j-1]=='#') y[i][j]++;
      if(x[i-1][j]=='#') y[i][j]++;
      if(x[i-1][j+1]=='#') y[i][j]++;
      if(x[i][j-1]=='#') y[i][j]++;
      if(x[i][j+1]=='#') y[i][j]++;
      if(x[i+1][j-1]=='#') y[i][j]++;
      if(x[i+1][j]=='#') y[i][j]++;
      if(x[i+1][j+1]=='#') y[i][j]++;
      }
    }
  }
  rep2(i,1,h+1){
    rep2(j,1,w){
      if(x[i][j]=='#'){
        cout <<'#';
      }else{
        cout<< y[i][j];
      }
    }
    if(x[i][w]=='#'){
        cout <<'#'<<endl;
      }else{
        cout<<y[i][w]<<endl;
      }
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fo(i,a,b)for(int i=a,_e=b;i<=_e;++i)
#define db double
using namespace std;
int n,c,l[9],w[9],jc,o,v,nc;
int f[2][1<<5][305];
db ans;
int main(){
	cin>>n>>c;
	fo(i,0,n-1)cin>>l[i];
	sort(l,l+n);
	jc=1;
	fo(i,0,n-2)w[i]=i,jc=jc*(i+1);
	nc=n*c;
	fo(go,1,jc){
		memset(f,0,sizeof f);
		o=0;
		f[0][0][l[n-1]*n]=1;
		fo(i,1,nc){
			int x=i%n?i%n-1:-1;
			o^=1;
			memset(f[o],0,sizeof f[o]);
			fo(j,0,(1<<n-1)-1)
				fo(k,i,nc)if(v=f[!o][j][k]){
					f[o][j][k]+=v;
					if(x>-1&&!(j&(1<<x)))
						f[o][j|(1<<x)][min(nc,max(k,i+l[w[x]]*n))]+=v;
				}
		}
		ans+=f[o][(1<<n-1)-1][nc];
		next_permutation(w,w+n-1);
	}
	ans/=jc;
	fo(i,1,n-1)ans/=c;
	printf("%.15lf",ans);
}

Measured memory_bytes: 384
#include<stdio.h>
int main()
{
  int N,A[100],i,h=0,minj=0,j,x=0;

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

  for(i=0;i<=N-1;i++)
    {
      minj=i;
      for(j=i;j<=N-1;j++)
	{
	  if(A[j]<A[minj])
	    minj=j;	  
	}
      x=A[i];
      A[i]=A[minj];
      A[minj]=x;
      if(minj!=i)h++;
    }
    
  for(i=0;i<N;i++)
    {
    if(i>0)printf(" ");
  printf("%d",A[i]);
    }
  printf("\n%d\n",h);
  return 0;
}

Measured memory_bytes: 604
#define _USE_MATH_DEFINES
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <numeric>
#include <functional>
#include <cctype>
#include <list>
#include <limits>
#include <cassert>
//#include <boost/multiprecision/cpp_int.hpp>

const double EPS = (1e-10);


using namespace std;
using Int = long long;
//using namespace boost::multiprecision;

const Int MOD = 1000000007;

long long mod_pow(long long x, long long n) {
    long long res = 1;
    for(int i = 0;i < 60; i++){
        if(n >> i & 1) res = res * x % MOD;
        x = x * x % MOD;
    }
    return res;
}

template<typename T>
T gcd(T a, T b) {
    return b != 0 ? gcd(b, a % b) : a;
}

template<typename T>
T lcm(T a, T b) {
    return a * b / gcd(a, b);
}

void fast_input() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}

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

int solve(int N, int M, int L, int K, int A, int H) {
    int ret = -1;

    int const INF = 100000000;
    int edge[105][105];
    int edge2[105][105];
    int dist[105][105];
    int dist2[105][105];
    for (int i = 0; i < 105; i++) {
        for (int j = 0; j < 105; j++) {
            edge[i][j] = INF;
            edge2[i][j] = INF;
            dist[i][j] = INF;
            dist2[i][j] = INF;
        }
    }

    vector<int> safe(N);
    for (int i = 0; i < L; i++) {
        int tmp; cin >> tmp;
        safe[tmp] = 1;
    }
    safe[A] = 1;
    safe[H] = 1;
    for (int i = 0; i < K; i++) {
        int a, b, c; cin >> a >> b >> c;
        edge[a][b] = c;
        edge[b][a] = c;
        dist[a][b] = c;
        dist[b][a] = c;
    }


    for (int k = 0; k < N; k++) {
        for (int i = 0; i < N; i++) {
            for (int j = 0; j < N; j++) {
                dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
            }
        }
    }

    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            if (safe[i] && safe[j]) {
                if (dist[i][j] <= M) {
                    edge2[i][j] = dist[i][j];
                    dist2[i][j] = dist[i][j];
                }
            }
        }
    }

    for (int k = 0; k < N; k++) {
        for (int i = 0; i < N; i++) {
            for (int j = 0; j < N; j++) {
                dist2[i][j] = min(dist2[i][j], dist2[i][k] + dist2[k][j]);
            }
        }
    }

    if (dist2[A][H] == INF) {
        return -1;
    } else if (M < dist2[A][H]) {
        return dist2[A][H]*2 - M;
    } else if (M >= dist2[A][H]) {
        return dist2[A][H];
    }
    
}

int main(void) {
    int N, M, L, K, A, H;
    vector<int> ans;
    while (1) {
        cin >> N >> M >> L >> K >> A >> H;
        if (N+M+L+K+A+H == 0) break;
        ans.push_back(solve(N, M, L, K, A, H));
    }
    for (auto i : ans) {
        if (i == -1) cout << "Help!" << endl;
        else cout << i << endl;
    }
}




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

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

  if( a < b ) cout<<"a < b"<<endl;
  if( a > b ) cout<<"a > b"<<endl;
  if( a == b ) cout<<"a == b"<<endl;

  return 0;
}



Measured memory_bytes: 3092
# -*- coding: utf-8 -*-
s = input()
s = map(int,[s[0], s[1], s[2]]) #入力文字列を分割して配列に格納したあとintに変換
bedama = 0
for masu in s:
  if masu == 1:
    bedama += 1
print(bedama)

Measured memory_bytes: 2940
N=int(input())
A=list(map(int,input().split()))
P=(sum(A))//N
P0=P-1
P1=P+1
M,M1,M0=0,0,0
for i in A:
  M+=(i-P)**2
  M1+=(i-P1)**2
  M0+=(i-P0)**2
print(min(M,M1,M0))
  

Measured memory_bytes: 3060