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

#define REP(i,n) for(ll i=0;i<ll(n);++i)
#define RREP(i,n) for(ll i=ll(n)-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<ll(n);++i)
#define RFOR(i,m,n) for(ll i=ll(n)-1;i>=ll(m);--i)
#define ALL(v) (v).begin(),(v).end()
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

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


using namespace std;

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

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

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n; cin >> n;
	vector<string> v(n);
	REP(i, n)cin >> v[i];
	int ans = 0;
	REP(i, n) {
		REP(j, v[i].size() - 1) {
			if (v[i][j] == 'A' && v[i][j + 1] == 'B')ans++;
		}
	}
	int a = 0, b = 0, ab = 0;
	REP(i, n) {
		if (v[i].front() == 'B' && v[i].back() == 'A')ab++;
		else if (v[i].front() == 'B')b++;
		else if (v[i].back() == 'A')a++;
	}
	ans += max(0, ab - 1);
	if (a > 0 && ab > 0) {
		a--;
		ans++;
	}
	if (b > 0 && ab > 0) {
		b--;
		ans++;
	}
	ans += min(a, b);
	cout << ans << endl;
}


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

int main(int argc, char *argv[]) {
  ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);

  int n;cin>>n;
  set<string> st;
  string ps="";
  bool ok=true;
  for(int i=0;i<n;i++){
    string s;
    cin>>s;
    if(i>0){
      ok = ok && (ps[ps.size()-1]==s[0]);
    }
    st.insert(s);
    ps=s;
  }

  if(!ok || st.size() != n){
    cout<<"No"<<endl;
    return 0;
  }
  cout<<"Yes"<<endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define lli long long int
#define MAX(A,B) A>B?A:B
#define MIN(A,B) A<B?A:B
#define gcd(A,B) __gcd(A,B)
#define lcm(A,B) A/(__gcd(A,B))*B
#define MP make_pair
#define PB push_back
#define EPS 1e-9
#define ld long double
#define modulo 998244353
using namespace std;

typedef pair<int,int> pii;
typedef pair<int,string> pis;
typedef pair<int,double> pid;

int main()
{
    int n;
    scanf("%d",&n);
    int x=0;
    while(n>x)
        x+=111;
    printf("%d",x);
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <queue>
#include <list>
#include <cmath>
#include <stack>
#include <iomanip>

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

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

//cout << fixed << setprecision(10);

const int MAX = 510000;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
    ll N,A,B;
    cin >> N  >> A >> B;
    vector<ll> v(N);
    for(int i=0;i<N;i++) cin >> v[i];

    sort(v.rbegin(),v.rend());
    ll tmp=v[A-1];
    bool jg=true;
    ll ct=0;
    ll idx=0;
    for(int i=0;i<N;i++){
        if(tmp==v[i])ct++;

        if(jg==true && tmp==v[i]){
            idx=i;
            jg=false;
        }
    }
    ll as=0;
    for(int i=0;i<A;i++){
        as+=v[i];
    }
    if(ct<A-idx){
        cout << fixed << setprecision(10) << (double)as/A << endl;
        cout << 1 << endl;
        return 0;
    }
    COMinit();
    ll cnt=0;
    ll tm=ct;
    for(int i=1;i<A;i++){
        tm*=(ct-i);
        tm/=(i+1);
    }
    if(tmp==v[0]){
        for(int i=A;i<=B;i++){
            if(i>ct)break;
            cnt+=tm;
            tm*=(ct-i);
            tm/=(i+1);
        }
    }
    else{
        cnt+=COM(ct,A-idx);
    }

    cout << fixed << setprecision(10) << (double)as/A << endl;
    cout << cnt << endl;
    


    return 0;
}

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

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { std::cout << #a << " = " << a << "\n"; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }
template<class T, class V> istream& operator>> (istream& ist, pair<T, V>& p) { return ist >> p.first >> p.second; }
template<class T> ostream& operator<< (ostream& ost, pair<T, T>& p) { return ost << p.first << ", " << p.second; }
template<class T> istream& operator>> (istream& ist, vector<T>& vs) { for(auto& e: vs) ist >> e; return ist; }

typedef long long ll;
int const inf = INT_MAX / 2;

int main() {
  int N, M, X;
  cin >> N >> M >> X;
  vector<vector<int>> A(N, vector<int>(M));
  vector<int> C(N);
  rep(i, N) {
    cin >> C[i];
    rep(j, M) cin >> A[i][j];
  }
  int min_payment = inf;
  rep(S, 1 << N) {
    int sum_payment = 0;
    vector<int> sum_A(M);
    rep(i, N) {
      if (S >> i & 1) {
        sum_payment += C[i];
        rep(j, M) sum_A[j] += A[i][j];
      }
    }
    bool ok = 1;
    rep(j, M) ok = ok && sum_A[j] >= X;
    if (ok) {
      min_payment = min(min_payment, sum_payment);
    }
  }
  if (min_payment < inf) {
    cout << min_payment << "\n";
  } else {
    cout << "-1\n";
  }
}


Measured memory_bytes: 3568
#include<stdio.h>
#include<stdlib.h>
int compare(const void *a, const void *b) {
    return *(int*)a - *(int*)b;
}
int main() {
    int n, i,a[111111];
long ans=0,copy;
    scanf("%d", &n);
    for (i = 0; i < n; i++)
        scanf("%d", &a[i]);
    qsort(a, n, sizeof(int), compare);
    int flag = 0, s = 0, g = n - 1, p = n / 2,b4;
    ans += a[p]-a[0];
    p = g;
b4=a[0];
    flag = 1;
    s++;
if(n==2){
printf("%d\n",ans);
return 0;
}
    while (p!=n/2) {
        if (flag == 1) {
copy=a[p]-b4;
            ans += copy;
            flag = 0;
            p = s;
b4=a[g];
            g--;
        }
        else {
copy=b4-a[p];
            ans +=copy;
            flag = 1;
            p = g;
b4=a[s];
            s++;
        }
    }
long ans2=0;
s=0;
g=n-1;
p=n/2;
if(n%2==1){
ans2+=a[g]-a[p];
p=s;
b4=a[g];
flag=0;
g--;
while (p!=n/2) {
        if (flag == 1) {
copy=a[p]-b4;
            ans2 += copy;
            flag = 0;
            p = s;
b4=a[g];
            g--;
        }
        else {
copy=b4-a[p];
            ans2 +=copy;
            flag = 1;
            p = g;
b4=a[s];
            s++;
        }
    }
if(ans2>ans)
ans=ans2;
}
    printf("%ld\n", ans);
    return 0;
}


Measured memory_bytes: 1020
#define _USE_MATH_DEFINES
#include <math.h>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstdlib>

using namespace std;
typedef long long ll;

int main() {
    
    int N;
    cin >> N;
    ll a = 0;
    ll out = 0;
    for(int i=0;i<N;i++){
        cin >> a;
        while(a%2 == 0){
            out++;
            a /= 2;
        }
    }
    cout << out << endl;
    return 0;
}


Measured memory_bytes: 256
#dpでできないかな？
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

n=I()
lis=LI()
i=0
count=0
while i<n:
    if lis[i]==i+1:
        count+=1
        i+=2
    else:
        i+=1
    #print(i)
print(count)

Measured memory_bytes: 53648
#pragma gcc optimize("O3")
#include <bits/stdc++.h>
using namespace std;
const int MOD=1000000007;
int d,a,b,i2,pos;
long long dp[102],res,tmp[102];
char k[10002];
int main()
{
    scanf("%s",&k);
    for(; k[pos]!=0; ++pos) a+=k[pos]-'0';
    scanf("%d",&d);
    dp[0]=1;
    a%=d;
    if(a==0) ++res;
    while(--pos>=0){
        if(k[pos]!='0'){
            b=k[pos]-'0';
            a-=b;
            while(a<0)
                a+=d;
            if(a)
                i2=d-a;
            else
                i2=0;
            for(int i=0; i<b; ++i){
                res+=dp[i2--];
                if(i2<0) i2+=d;
            }
            while(res>=MOD) res-=MOD;
        }
        tmp[0]=0;
        i2=d-1;
        for(int i=0; i<9; ++i){
            tmp[0]+=dp[i2--];
            if(i2<0) i2+=d;
            if(tmp[0]>=MOD) tmp[0]-=MOD;
        }
        for(int i=1; i<d; ++i) tmp[i]=tmp[i-1]+dp[i-1]-dp[++i2%d];
        for(int i=0; i<d; ++i){
            dp[i]=dp[i]+tmp[i];
            if(dp[i]>=MOD){
                dp[i]-=MOD;
                while(dp[i]>=MOD) dp[i]-=MOD;
            }
            else if(dp[i]<0){
                dp[i]+=MOD;
                while(dp[i]<0) dp[i]+=MOD;
            }
        }
    }
    if(--res<0) res+=MOD;
    printf("%d",res);
    return 0;
}


Measured memory_bytes: 256
from math import gcd
_, *e = [[*map(int, t.split())] for t in open(0)]
ans = 1
mod = 10 ** 9 + 7
slope_dict = {}
zeros = 0
for x, y in e:
    if x == y == 0:
        zeros += 1
    else:
        d = gcd(x, y)
        x //= d
        y //= d
        if x < 0 or x == 0 < y:
            x, y = -x, -y
        s = 0
        if y < 0:
            x, y, s = -y, x, 1
        if (x, y) not in slope_dict:
            slope_dict[(x, y)] = [0, 0]
        slope_dict[(x, y)][s] += 1

for k in slope_dict:
    ans = ans * (pow(2, slope_dict[k][0], mod) +
                 pow(2, slope_dict[k][1], mod) - 1) % mod
print((ans + zeros - 1) % mod)


Measured memory_bytes: 99168
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int t,a,b,one;
  cin >> t >> a >> b;
  one = t * a;
  if (one <= b) {
    cout << one<< endl;
  } else if (one > b) {
    cout << b << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <string> 
#include <cmath>  
#include <cstdlib>
#include <ctime>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <random>
#include <functional>

using namespace std;
using ll = long long;
using ull = unsigned long long;

#define FOR(i, m, n) for(int i = int(m);i < int(n);i++)
#define REFOR(i, m, n) for(int i = int(n - 1);i >= int(m);i--)
#define REP(i,n) for(int i = 0; i < int(n); i++)
#define REREP(i,n) for(int i = int(n - 1); i >= 0; i--)
#define VI vector<int>
#define VVI vector<vector<int>>
#define VVVI vector<vector<vector<int>>>
#define VD vector<double>
#define VL vector<ll>
#define VVL vector<vector<ll>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define PAIR pair<int,int>
#define MP make_pair
#define VP vector<pair<int,int>>
#define VS vector<string>
#define MAP map<int,int>
#define QUE queue<int>
#define DEQ deque<int>
#define PQUE priority_queue<int> //5,5,4,3,3,2,...
#define REPQUE priority_queue<int, vector<int>, greater<int>> //1,1,2,3,4,4,5,...
#define SUM(obj) accumulate((obj).begin(), (obj).end(), 0)
#define SORT(obj) sort((obj).begin(), (obj).end()) // 1,2,3,4,5...
#define RESORT(obj) sort((obj).begin(), (obj).end(), greater<int>()) // 5,4,3,2,1...
#define UB(obj,n) upper_bound((obj).begin(), (obj).end(), n) //itr > n
#define LB(obj,n) lower_bound((obj).begin(), (obj).end(), n) //itr>= n

const ll MOD = (ll)1e9 + 7;
const ll INF = (ll)1e17;

void ANS(bool flag){
	cout << ((flag) ? "YES" : "NO") << endl;
}

void Ans(bool flag) {
	cout << ((flag) ? "Yes" : "No") << endl;
}

void ans(bool flag) {
	cout << ((flag) ? "yes" : "no") << endl;
}

double Euclidean_distance(double x1, double y1, double x2, double y2){
	return sqrt((x1 - x2)*(x1 - x2) + (y1 - y2)*(y1 - y2));
}

const double pi = 4.0*atan(1.0);//Pi

int main() {
	int N;
	cin >> N;
	VD x(N), y(N), node(N,0.), dist(N);
	REP(i, N) cin >> x[i] >> y[i];
	
	int M = 3000000;
	//double r = 1e13;
	for (double theta = 0.; theta < 2 * pi; theta += 2. * pi / M) {
		//double xo = r*cos(theta);
		//double yo = r*sin(theta);
		//REP(i, N) dist[i] = Euclidean_distance(x[i],y[i],xo,yo);
		REP(i, N) dist[i] = x[i]*cos(theta) + y[i]*sin(theta);
		node[distance(dist.begin(), max_element(dist.begin(), dist.end()))] += 1.;
	}
	REP(i, N) printf("%lf\n", node[i] / M);
	//cin >> N;
	return 0;
}


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

using namespace std;


int main(){
 string s;
  cin >> s;
  
  for(int i=0;i<s.length()-1;i++){
  if(s.substr(i,2)=="AC") {
    cout << "Yes" << endl;
     return 0;
  }
  }   
    
 cout << "No" << endl;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<boost/variant.hpp>
using namespace std;
typedef long long ll;
typedef vector<boost::variant<bool, ll, int, string, double, char*, const char*>> any;
template<typename T> inline void pr(const vector<T> &xs){
	for(int i=0; i<xs.size()-1; i++) cout<<xs[i]<<" ";
	(xs.empty()?cout:(cout<<xs[xs.size()-1]))<<endl;
}
#ifdef DEBUG
#define debug(...) pr(any{__VA_ARGS__})
#define debugv(x) pr((x))
#else
#define debug(...)
#define debugv(x)
#endif

ll fact[200000];

// Extended Euclid's greatest common divisor algorithm
// Find (x, y, g)
// where $a*x + b*y = g$ and g is the greatest common divisor of (a, b)
ll ext_gcd(ll a, ll b, ll &x, ll &y){
	if(b == 0){
		x = 1;
		y = 0;
		return a;
	}
	ll nx, ny;
	ll g = ext_gcd(b, a%b, nx, ny);
	x = ny;
	y = nx - a/b *ny;
	return g;
}

// Modular inverse of x given modulo p, y
// x*y = 1 mod p
// <=> x*y + z*p = 1
ll inv_mod(ll x, ll p){
	ll y,z;
	ext_gcd(x, p, y, z);
	return y>=0 ? y : p+(y%p);
}


// Modular factorial of n, also counting p's appearance e
// n! = a * p^e
// return: a % p
// n! = n * (n-1) * ... * (k*p+1) *
//      (k*p) * (k*p-1) * ... ((k-1)*p+1) *
//      ...
//      p * (p-1) * ... * 2 * 1   (k = floor(n/p))
//    = (n%p) * ... * 1 *
//      (k*p) * (p-1) * ... * 1 *
//      p * (p-1) * ... * 1       (mod p, preserving p's multiples)
//    = (n%p)! * p^k * k! * (p-1)^k
//    = (n%p)! * p^k * k! * (p-1)^(k%2)
//
// From the facts:
//   (p-1)! = p-1 (mod p) (c.f. Willson's theorem)
//   (p-2)**2 = 1 (mod p)
ll fact_mod(ll n, ll p, ll &e){
	if(n == 0){
		e = 0;
		return 1;
	}

	ll na = fact_mod(n/p, p, e);

	e += n/p;
	ll a = na * fact[n%p] % p;

	if((n/p)%2) a = a * (p-1)%p;
	return a;
}


// Modular combination (n, m) given module p
// (n, m) = n!/(n-m)!m!
//        = (a_n * p^(e_n)) / ((a_{n-m} * p^(e_{n-m}) * (a_m * p^e_m))
//        = a_n / (a_{n-m} * a_m) * p^(e_n - e_{n-m} - e_m)
ll comb_mod(ll n, ll m, ll p){
	ll e1,e2,e3;
	ll a1 = fact_mod(n, p, e1);
	ll a2 = fact_mod(m, p, e2);
	ll a3 = fact_mod(n-m, p, e3);

	if(e1 > e2+e3) return 0;
	else return a1*inv_mod(a2*a3%p, p)%p;
}

const ll P = 1e9+7;

int main(){
	fact[0] = fact[1] = 1;
	for(int i=2; i<200000; i++) fact[i] = fact[i-1]*i%P;

	int N;
	cin >> N;
	vector<int> A(N);
	for(int i=0; i<N; i++) cin >> A[i];

	int cnt[3] = {0, 0, 0};

	ll ans = 1;
	for(int i=0; i<N; i++){
		bool ok = false;
		ll nans = 0;
		for(int j=0; j<3; j++){
			if(A[i] == cnt[j]){
				nans += ans;
				nans %= P;
			}
		}
		for(int j=0; j<3; j++){
			if(A[i] == cnt[j]){
				cnt[j]++;
				break;
			}
		}
		ans = nans;
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 2304
#include <iostream>
// g++ hello.cpp && ./a.out
using namespace std;
	void alphabet(char n) {
		if (n >= 'A'&& n <= 'Z') {
			cout << "A" << endl;
		}
		else {
			cout << "a" << endl;
		}
	}

int main() {
	char n;
	cin >> n;
	alphabet (n);
	return 0;
}

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

A.sort()
A.append(A[0] + K)
dif = 0
for i in range(1, N + 1):
	dif = max(dif, A[i] - A[i - 1])

print(K - dif)

Measured memory_bytes: 26060
import java.io.*;
import java.util.*;
public class Main{
    public static void main(String[] args) throws IOException{
        MyReader r = new MyReader();    
        int N, M;
        {int[] a = r.ii(); N = a[0]; M = a[1];}
        int[] a = new int[M];
        int[] b = new int[M];
        int j = 0;
        int k = 0;
        for(int i = 0; i < M ; i++){
            int[] temp = r.ii();
            if(temp[0] == 1)
                b[k++] = temp[1];
            else if(temp[1] == N)
                a[j++] = temp[0];
        }
        Arrays.parallelSort(a, 0, j);
        Arrays.parallelSort(b, 0, k);
        for(int i = 0; i < j; i++){
            if(Arrays.binarySearch(b, 0, k, a[i]) >= 0){
                println("POSSIBLE");
                return;
            }
        }
        println("IMPOSSIBLE");
    }
    static void print(Object o){
        System.out.print(o.toString());
    }
    static void println(Object o){
        System.out.println(o.toString());
    }
    static int Int(String s){
        return Integer.parseInt(s);
    }
    static long Long(String s){
        return Long.parseLong(s);
    }
    static class MyReader extends BufferedReader{
        MyReader(){
            super(new InputStreamReader(System.in));
        }
        String s() throws IOException{
            return readLine();
        }
        String[] ss() throws IOException{
            return s().split(" ");
        }
        int i() throws IOException{
            return Int(s());
        }
        int[] ii() throws IOException{
            String[] ss = ss();
            int size = ss.length;
            int[] ii = new int[size];
            for(int j = 0; j < size; j++) ii[j] = Int(ss[j]);
            return ii;
        }
        long l() throws IOException{
            return Long(s());
        }
        long[] ll() throws IOException{
            String[] ss = ss();
            int size = ss.length;
            long[] ll = new long[size];
            for(int j = 0; j < size; j++) ll[j] = Long(ss[j]);            
            return ll;
        }
    }
}

Measured memory_bytes: 60328
import java.util.*

fun main(args: Array<String>) {
    val count = arrayOf(-1, 2, 5, 5, 4, 5, 6, 3, 7, 6)

    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    val m = sc.nextInt()
    val a = IntArray(m) { sc.nextInt() }.sorted().reversed()

    val dp = IntArray(n + 10) { (if (it == 0) 0 else -1) }
    (0..n).forEach { index ->
        if (dp[index] < 0) return@forEach
        a.forEach { v ->
            val c = count[v]
            dp[index + c] = Math.max(dp[index + c], dp[index] + 1)
        }
    }

    var cur = n
    val sb = StringBuilder()
    while (cur != 0) {
        val v = a.first {
            val c = count[it]
            cur - c >= 0 && dp[cur - c] + 1 == dp[cur]
        }

        sb.append(v)
        cur -= count[v]
    }

    val ret = sb.toString()
    println(ret)
}


Measured memory_bytes: 36412
#include<stdio.h>
int main(){
  int a,b,c;
  scanf("%d %d %d",&a,&b,&c);
  if(a == b && b == c){
    printf("Yes\n");
  }else{
    printf("No\n");
  }
  return 0;
}
//for(int i = 0;i < n;i++){
//printf("%d");

Measured memory_bytes: 128
import java.util.Scanner;
public class Main{
    static int[]A;
    static String[]mark;
    static int[]num;
    public static void main(String args[]){
	int i,n,j;
	Scanner scat=new Scanner(System.in);
	n=scat.nextInt();
	A =new int[n];
	mark = new String[n];
	num=new int[n];
	for(i=0;i<n;i++){
	    mark[i]=scat.next();
	    A[i]=scat.nextInt();
	    num[i]=i;
	}
	quickSort(0,n-1);
	System.out.println(hantei());
	for(j=0;j<n;j++){
	    System.out.println(mark[j]+" "+A[j]);
	}
    }
    public static  void quickSort(int p,int r){
	int q;
	if(p<r){
	    q=partition(p,r);
	    quickSort(p,q-1);
	    quickSort(q+1,r);
    }
    }
	public static int partition(int p,int r){
	    int j,i,x;
	    int hz;
	    String hzs;
	x=A[r];
	i=p-1;
	for(j=p;j<r;j++){
	    if(A[j]<=x){
		i++;
		hz=A[i];
		A[i]=A[j];
		A[j]=hz;
		hz=num[i];
		num[i]=num[j];
		num[j]=hz;
		hzs=mark[i];
		mark[i]=mark[j];
		mark[j]=hzs;
		
	    }
	}
	hz=A[i+1];
	A[i+1]=A[r];
	A[r]=hz;
      	hz=num[i+1];
       	num[i+1]=num[r];
       	num[r]=hz;
	hzs=mark[i+1];
      	mark[i+1]=mark[r];
       	mark[r]=hzs;		
	return i+1;
	}
       static String hantei(){
       	int i;
	for(i=0;i<A.length-1;i++){
	 if(A[i]==A[i+1]){
		if(num[i]>num[i+1]){
		         return "Not stable";
		   }
				}
	}
		return "Stable";
       }	
}




Measured memory_bytes: 103524
#include<iostream>
#include<algorithm>
#include<bits/stdc++.h>
using namespace std;
//#define mp make_pair
#define pb push_back
#define int long long
#define pi 3.141592653589793238462643383279502
#define M 998244353
#define F first
#define S second
#define pii pair<int,int>
#define rep(i,n) for(int i=0;i<n;i++)
bool isPowerOfTwo(int n)
{
   if(n==0)
   return false;

   return (ceil(log2(n)) == floor(log2(n)));
}
int power(int x, unsigned int y)
{
    int res = 1;

    x = x;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x)%M;

        y = y>>1;
        x = (x*x)%M;
    }
    return res%M;
}
bool isprime(int x)
{
      if(x<2)
        return false;
    for(int i=2;i*i<=x;i++)
     {
        if (x%i==0)
            return false;
    }
    return true;
}
vector<pair<int,int>>primeFactors(int n)
{
    vector<pair<int,int>>v;
    int x=0;
    while (n % 2 == 0)
    {
        x++;
        n = n/2;
    }
    if(x>0)
    v.pb({2,x});
    for (int i = 3; i <= sqrt(n); i = i + 2)
    {
        int y=0;
        while (n % i == 0)
        {
            y++;
            n = n/i;
        }
        if(y>0)
        v.pb({i,y});
    }
    if (n > 2)
        v.pb({n,1});
    return v;
}
int maxSubArraySum(int a[], int size)
{
    int max_so_far = INT_MIN, max_ending_here = 0;

    for (int i = 0; i < size; i++)
    {
        max_ending_here = max_ending_here + a[i];
        if (max_so_far < max_ending_here)
            max_so_far = max_ending_here;

        if (max_ending_here < 0)
            max_ending_here = 0;
    }
    return max_so_far;
}

void solve()
{
int a;
string s;
cin>>a>>s;
int x=(s[0]-'0')*100+(s[2]-'0')*10+(s[3]-'0');
cout<<(x*a)/100;
}
signed main()
{ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
int t;
//cin>>t;
t=1;
while(t--)
{

solve();

}
}


Measured memory_bytes: 3672
def check(k):
    cnt = 0
    for i in range(1, k + 1):
        if k % i == 0:
            cnt += 1
    if cnt == 8:return 1
    else:return 0

n = int(input())
pre = [0] * n

for i in range(n):
    if i % 2 == 1:
        pre[i] = pre[i - 1]
    else:
        temp = check(i + 1)
        pre[i] = pre[i - 1] + temp
print(pre[n - 1])

Measured memory_bytes: 3064
package main

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

var sc = bufio.NewScanner(os.Stdin)

func scanInt() int {
	num, _ := strconv.Atoi(scanString())
	return num
}

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

func scanStrings(n int) []string {
	sl := make([]string, n)
	for i := range sl {
		sl[i] = scanString()
	}
	return sl
}

func init() {
	sc.Split(bufio.ScanWords)
}

func main() {
	n := scanInt()
	w := scanStrings(n)

	m := map[string]bool{}
	lc := w[0][0]
	for _, s := range w {
		if m[s] || s[0] != lc {
			fmt.Println("No")
			return
		}

		lc = s[len(s)-1]
		m[s] = true
	}

	fmt.Println("Yes")
}


Measured memory_bytes: 640
#include<bits/stdc++.h>;
#define very int64_t
#define ll long long
using namespace std;
int main()
{
very n;
  cin>>n;
  very k=sqrt(n);
    if(pow(k,2)==n){cout<<2*(k-1)<<endl; return 0;}
  very road=n-1;
  for(ll i=1; i<=sqrt(n); i++){
    if(n%i==0){
    very ans= i+n/i-2;
    road=min(road, ans);
      }
  }
cout<<road<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>

struct List {
    int v;
    List *prev;
    List *next;
    List():
        v{-1}, prev{nullptr}, next{nullptr}
    {}
    ~List() = default;
};

void listInsert(List& l, int x)
{
    List *head = l.next;
    List *node = new List;
    node->v = x;
    if (head == nullptr) {
        l.next = node;
        l.prev = node;
        node->prev = &l;
        node->next = &l;
    } else {
        node->next = head;
        head->prev->next = node;
        node->prev = head->prev;
        head->prev = node;
    }
}

void listDelete(List& l, int x)
{
    for (List *p = l.next; p != &l; p = p->next) {
        if (p->v == x) {
            p->prev->next = p->next;
            p->next->prev = p->prev;
            delete p;
            p = nullptr;
            break;
        }
    }
}

void listDeleteFirst(List& l)
{
    List *p = l.next;
    if (!p || p == &l) {
        return;
    }
    p->prev->next = p->next;
    p->next->prev = p->prev;
    delete p;
}

void listDeleteLast(List& l)
{
    List *p = l.prev;
    if (!p || p == &l) {
        return;
    }
    p->prev->next = p->next;
    p->next->prev = p->prev;
    delete p;
}

int main()
{
    int n;
    scanf("%d\n", &n);
    int x;
    char cmd[20];
    List list; 
    while (scanf("%s", cmd) == 1) {
        size_t len = strlen(cmd);
        if (len == 6 && cmd[0] == 'i') {
            scanf("%d\n", &x);
            listInsert(list, x);
        } else if (len == 6 && cmd[0] == 'd') {
            scanf("%d\n", &x);
            listDelete(list, x);
        } else if (len == 11) {
            listDeleteFirst(list);
        } else if (len == 10) {
            listDeleteLast(list);
        }
    }

    List *p = list.next;
    List *q = p;
    bool first = true;
    while (p && p != &list) {
        printf("%s%d", (first ? "" : " "), p->v);
        first = false;
        q = p->next;
        delete p;
        p = q;
    }
    printf("\n");
}


Measured memory_bytes: 33852
#include <stdio.h>
#include <stdlib.h>
#include "time.h"
#include "unistd.h"
#include "string.h"
#include <math.h>
int ans;
int main(int argc, char* argv[]){
  long int a,b,c;
  scanf("%ld",&a);
  if (a/10==9||a-(a/10)*10==9) {
    printf("Yes");
  }else{
    printf("No\n" );
  }
}


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

const ll mod=1000000007;

int main() {
  ll a,b,c,k;
  cin >> a >> b >> c >> k;
  if(k<=a)cout<<k<<endl;
  else if(k<=a+b)cout<<a<<endl;
  else cout<<2*a+b-k<<endl;
}

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

#define all(x) (x).begin(),(x).end()
#define SP <<" "<<
#define MOD 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000

typedef long long LL;
typedef long double LD;

int main(){
  int n,q;
  cin >> n >> q;
  string s;
  cin >> s;
  vector<pair<char,char>> td(q);
  for(int i=0;i<q;i++){
    cin >> td[i].first >> td[i].second;
  }
  reverse(all(td));
  int l=0,r=n;
  for(int i=0;i<q;i++){
    if(td[i].second=='L'){
      if(s[l]==td[i].first) l++;
      if(r<n) if(s[r]==td[i].first) r++;
    }else{
      if(l>0) if(s[l-1]==td[i].first) l--;
      if(s[r-1]==td[i].first) r--;
    }
  }
  cout << r-l << endl;
  return 0;
}


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

int main(int argc, char const *argv[]) {
        string odd, even;
        cin >> odd;
        cin >> even;
        for (auto i = 0; i < even.size(); ++i) {
          cout << odd[i] << even[i] << flush;
        }
        if (odd.size() > even.size()) {
          cout << odd[odd.size() - 1] << flush;
        }
        cout << endl;
        return 0;
}


Measured memory_bytes: 256
// AOJ 2420: Anipero 2012
// 2017.12.30 bal4u@uu

#include <stdio.h>

int a[52], b[52], c[52];
int dp[52][52][10];
char mk[52][52][10];

int main()
{
	int n, m, i, j, k, u, v, w, s, ans;

	scanf("%d%d", &n, &m);
	for (i = 0; i < n; i++) scanf("%d%d%d", a+i,  b+i, c+i);

	dp[0][m][0] = 0, mk[0][m][0] = 1;
	for (i = 0; i < n; i++) for (j = 0; j <= m; j++) for (k = 0; k <= 8; k++) if (mk[i][j][k]) {
		for (u = 0; u <= k; u++) {
			int t, r;
			t = 8 - u; if (j < t) t = j;
			r = 8;     if (j < r) r = j;
			for (v = 0; v <= t; v++) {
				if (!u && !v) s = c[i];
				else s = v*a[i] + u*b[i];
				for (w = v; w <= r; w++) {
					int x = dp[i][j][k] + s;
					if (!mk[i+1][j-w][w] || x > dp[i+1][j-w][w]) 
						dp[i+1][j-w][w] = x, mk[i+1][j-w][w] = 1;
				}
			}
		}
	}
	ans = -0x7fffff;
	for (j = 0; j <= m; j++) for (k = 0; k <= 8; k++)
		if (mk[n][j][k] && dp[n][j][k] > ans) ans = dp[n][j][k];
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 1968
#include<stdio.h>

int main(){
  int minj,i,j,a=0,count=0;
  int N,A[100];
  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;
	
      }
    }
    if(minj!=i){
    a=A[i];
    A[i]=A[minj];
    A[minj]=a;
    
    count++;
    }
    
  }
  for(i=0;i<N-1;i++){
    printf("%d ",A[i]);
}
  printf("%d\n",A[N-1]);
  printf("%d\n",count);
  return 0;
}

Measured memory_bytes: 2716
#include <stdio.h>

#define N 100

int main(){
	int n;
	scanf("%d",&n);
	int A[N][N];
	int i;
	int v;
	int j;
	int p;
	int q;
	for(i=0;i<n;i++){
		for(j=0;j<n;j++){
			A[i][j]=0;
		}
	}
	for(i=0;i<n;i++){
		scanf("%d",&v);
		scanf("%d",&q);
		for(j=0;j<q;j++){
			scanf("%d",&p);
			A[v-1][p-1] = 1;
		}
	}
	for(i=0;i<n;i++){
		for(j=0;j<n-1;j++){
			printf("%d ",A[i][j]);
		}
		printf("%d\n",A[i][j]);
	}
	return 0;
}

Measured memory_bytes: 2744
#include<iostream>
#include<unordered_map>
#include<numeric>

using ui  = unsigned int;
using ull = unsigned long long;

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

	std::unordered_map<ui, ui> mp;
	
	// small type version
	ui accum = 0;
	mp[0] += 1;
	for (ui i{}; i < n; ++i) {
		ui ai;
		std::cin >> ai;
		accum += ai;
//		accum %= m;
//		std::cout << accum << " ";
		mp[accum %= m] += 1;

	}

	auto ans 
		=	std::accumulate(
				std::begin(mp)
				,std::end(mp)
				, ull{}
			, [](auto init, auto& x) {
				const auto& t = x.second;
				//std::cout << t << " ";
				return
					init += t <= 1 ? 0 : ull{t} *(t - 1) / 2;
				}
			);

	std::cout << ans << "\n";

	return 0;
}

Measured memory_bytes: 2976
import java.util.*;

public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		while(true){
			String[] s = sc.nextLine().split(" ");
			if(s[0].compareTo("0")==0) break;
			int n = s.length;
			int[] a = new int[n];
			for(int i=0;i<n;i++) a[i] = Integer.valueOf(s[i]);
			
			boolean flag = false;
			int sum = 0;
			for(int i=0;i<n;i++){
				if(a[i]>10) sum+=10;
				else sum+=a[i];
				if(a[i]==1) flag = true;
			}
			if(flag==true && sum+10<=21) sum+=10;
			
			if(sum>21) System.out.println(0);
			else System.out.println(sum);
		}	
	}	
}

Measured memory_bytes: 19180
n, k = map(int, input().split())
x = list(map(int, input().split()))
ans = []
for i in range(n-k+1):
    l = x[i]
    r = x[i+k-1]
    ans.append(min(abs(l) + abs(r-l), abs(r) + abs(l-r)))
print(min(ans))


Measured memory_bytes: 14252
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#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(obj) (obj).begin(), (obj).end()
#define DEBUG(val) cout << #val << " : " << val << endl
#define MOD 1000000007

int main() {
  int n, m;
  cin >> n >> m;
  map<int, int> mp;
  REP(i, m) {
    int a, b;
    cin >> a >> b;
    mp[a]++;
    mp[b]++;
  }
  for (auto v : mp) {
    if (v.second % 2 != 0) {
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
}

Measured memory_bytes: 7640
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<algorithm>
#include<map>
#include<cmath>
#include<deque>
using namespace std;

using ll = long long;

int res[51][51];
char tizu[51][51];

int h, w;

void update(int y, int x, int score)
{
    if (y < 1 || y > h || x < 1 || x > w) {
        return;
    }
    if (tizu[y][x] == '#') {
        return;
    }

    int newScore = min(score + 1, res[y][x]);
    if (newScore == res[y][x]) {
        return;
    }
    res[y][x] = newScore;
    update(y + 1, x, newScore);
    update(y, x + 1, newScore);
    update(y - 1, x, newScore);
    update(y, x - 1, newScore);
}

int main()
{
    cin >> h >> w;
    int blackCount = 0;
    for (int i = 1; i <= h; i++) {
        for (int j = 1; j <= w; j++) {
            res[i][j] = 100000000;
            char tmp;
            cin >> tmp;
            tizu[i][j] = tmp;
            if (tmp == '#') {
                blackCount++;
            }
        }
    }

    update(1, 1, 0);


    if (res[h][w] == 100000000) {
        cout << -1 << endl;
        return 0;
    }

    cout << h * w - blackCount - res[h][w] << endl;
}


Measured memory_bytes: 384
n = int(input())
l=sorted(list(map(int,input().split())))

cnt = 0
for i in range(n-2):
  for j in range(i+1, n-1):
    for k in range(j+1, n):
      if l[i] + l[j] > l[k] and l[i] != l[j] and l[j] != l[k]:
        cnt += 1
print(cnt)

Measured memory_bytes: 9192
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i<(n);++i)
const int INF =1001001001;
using ll=long long;
using P = pair<int,int>;
using Graph =vector<string>;
Graph field;
queue<P> q;

int main() {
  ll ans,n,d;
  ans=0;
  cin>>n>>d;
  rep(i,n){
    ll x,y;
    cin>>x>>y;
    if(x*x+y*y<=d*d){
      ans++;
    }

  }
      cout<<ans<<endl;

}


Measured memory_bytes: 3632
#include <iostream>
#include <cstdlib>
#include <string.h>
#include <string>
#include <cstring>
using namespace std;

int main(){
	string x;
	cin >> x ;
	int le;
	le = x.length();
	int i=0;
	for(i=0;i<le;i=i+2){
		cout << x[i];
	}
	cout << endl;

	return 0;
}

Measured memory_bytes: 512
s = int(input())
if s <= 10 ** 9:
    print('0 0 {} 0 0 1'.format(s))
else:
    y1 = s // 10 ** 9
    y2 = (s + 10 ** 9 - 1) // 10 ** 9
    x1 = s % 10 ** 9
    print('{} 0 0 {} {} {}'.format(x1, y1, 10**9, y2))

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
#define ss(x) (int) x.size()
#define fi first
#define se second
#define cat(x) cerr << #x << " = " << x << endl
#define rep(i, j, n) for (int i = j; i <= n; ++i)
#define per(i, j, n) for (int i = n; j <= i; --i)
#define all(x) x.begin(), x.end()
#define ull unsigned long long
 
using namespace std;	

int main() {	
	string s;
	cin >> s;
	for (auto &it : s)
		if (it == '?')
			it = 'D';
	cout << s;
	
	return 0;
}	


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

int main(){

    int a, b;
    cin >> a >> b;
    
    int position = b - a;
    int length = 0;
    for( int i = 1; i <= position; i++ ) length += i;

    cout << length - b << endl;

    return 0;

}

Measured memory_bytes: 256
n = int(input())
h = list(map(int,input().split()))
count = 0
lst = []
if (n == 1):
    print(0)
else:
    for i in range(n - 1):
        if (h[i] >= h[i + 1]):
            count = count + 1
        else:
            lst.append(count)
            count = 0
    if (count != 0):
        lst.append(count)

    lst.sort()
    lst.reverse()

    print(lst[0])


Measured memory_bytes: 20648
#include<bits/stdc++.h>
using namespace std;
 
typedef    long long          ll;
typedef    vector<long long>    vi; 
typedef    vector<vi>         vvi; 
typedef    pair<long,long>      ii; 
#define    sz(a)              long((a).size()) 
#define    pb                 push_back 
#define    mp                   make_pair
#define    all(c)             (c).begin(),(c).end() 
#define    tr(c,i)            for(typeof((c).begin() i = (c).begin(); i != (c).end(); i++) 
#define    present(c,x)       ((c).find(x) != (c).end()) 
#define    cpresent(c,x)      (find(all(c),x) != (c).end())  
#define    input(v,n)           for(ll i = 0 ; i<n ; i++) cin>>v[i]
#define    output(v,n)          for(ll i = 0 ; i<n ; i++) cout<<v[i]<<" "
#define    ff           first
#define    ss           second

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


    string s,t;
    cin>>s>>t;
    ll ans = 1e6,i,j;

    for(i=0;i+t.length() <= s.length();i++)
    {
      ll diff = 0;
      for(j=0;j<t.length();j++)
      {
        if(s[i+j]!=t[j])diff++;
      }
      ans = min(ans,diff);
    }

    cout<<ans;


  return 0;
}

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

using namespace std;

#define ll                long long

static const int maxn = 6e5 + 5;

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


      int x, a;
      cin >> x >> a;
      if (x < a) cout << 0 << endl;
      else cout << 10 << endl;
}


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

int main() {
    int N;
    cin >> N;
    string S;
    cin >> S;
    
    // false: wolf  true: sheep
    for(int i=0; i<4; ++i) {
        vector<bool> a(N);
        a[0] = i % 2;
        a[1] = (i >> 1) % 2;

        for(int i=1; i+1<N; ++i) {
            if((S[i] == 'o') ^ a[i]) a[i + 1] = !a[i - 1];
            else a[i + 1] = a[i - 1];
        }

        if(a[0]) {
            if(S[0] == 'o' && a[N-1] != a[1]) continue;
            if(S[0] == 'x' && a[N-1] == a[1]) continue; 
        } else {
            if(S[0] == 'o' && a[N-1] == a[1]) continue;
            if(S[0] == 'x' && a[N-1] != a[1]) continue; 
        }

        if(a[N-1]) {
            if(S[N-1] == 'o' && a[N-2] != a[0]) continue;
            if(S[N-1] == 'x' && a[N-2] == a[0]) continue; 
        } else {
            if(S[N-1] == 'o' && a[N-2] == a[0]) continue;
            if(S[N-1] == 'x' && a[N-2] != a[0]) continue; 
        }

        for(int i=0; i<N; ++i) cout << (a[i] ? 'S' : 'W');
        cout << endl;
        return 0;
    }

    cout << -1 << endl;
}

Measured memory_bytes: 512
import sys
a=int(input())
for i in range(151):
  b=i**5-a
  c=abs(b)
  j=0
  while j**5<=c:
    if j**5==c:
      if b>=0:
        print(i,j)
        sys.exit()
      else:
        print(i,-j)
        sys.exit()
    j+=1
      
    

Measured memory_bytes: 9056
//
//  alds_1_1_d.cpp
//  program
//
//  Created by 李青坪 on 2018/9/11.
//  Copyright © 2018年 李青坪. All rights reserved.
//
#include <stdio.h>
#include "iostream"

using namespace std;

int main(){
    int n;
    scanf("%d", &n);
    int r[n];
    for (int i = 0; i<n; i++) {
        scanf("%d", &r[i]);
    }
    int max_index = 1;
    int min_index = 0;
    int delta_max = r[1] - r[0];
    for (int i = 1; i<n;i++){
        if (r[i] > r[max_index]){
            max_index = i;
        }
        if (r[i] < r[min_index]) {
            min_index = i;
        }
        if (max_index <= min_index) {
            max_index = min_index + 1;
        }
        if (max_index > n-1 ){
            continue;
        }
        if ((max_index > min_index) && ( r[max_index] - r[min_index] > delta_max)) {
            delta_max =r[max_index] - r[min_index];
        }
    }
    printf("%d\n", delta_max);
}



Measured memory_bytes: 3952
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    
    ll N;
    cin >> N;
    ll ans = 0;
    for (ll i = 2; i * i <= N; i++)
    {
        if (N % i != 0)
            continue;
        ll num = 0;
        while (N % i == 0)
        {
            N /= i;
            num++;
        }
        for (ll j = 1;; j++)
        {
            if (num >= j)
            {
                num -= j;
                ans++;
            }
            else
                break;
        }
    }
    if (N != 1)
        ans++;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl; 
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define int ll

bool isSame(vector<int> x,vector<int> y){
    bool f=true;
    rep(i,x.size()){
        if(x[i]!=y[i]) f=false;
    }
    return f;
}

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

    int n;cin>>n;
    vector<int> v(n),p(n),q(n);
    rep(i,n) cin>>p[i];
    rep(i,n) cin>>q[i];
    rep(i,n) v[i]=i+1;
    int a,b;
    int k=0;
    do{
        if(isSame(v,p)) a=k;
        if(isSame(v,q)) b=k;
        k++;
    }while(next_permutation(ALL(v)));
    cout<<abs(a-b)<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define     fast                    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define     ll                      long long
#define     pb                      push_back
#define     M                       1000000007
using namespace std;
int main()
{
    ll n,x,y,sum=0;
    string s;
    cin>>s;
    for(ll i=0; i<s.size(); i++)
    {
        if(s[i] == '+') sum++;
        else sum--;
    }
     cout<<sum<<endl;


}


Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
//NOT TO SUBMIT IN WRONG PLACE OR BY WRONG COMPILER
//ABC 159, task d, 2020/09/08
//ms,
/*
*/

int main(void){
  int N;
  vector<int64_t> rec(200001);//インデックスはボールに書かれた数字、要素は個数
  vector<int> a;
  int64_t cases=0;

  for(int i=0;i<200000;i++) rec[i]=0;

  cin >>N;
  for(int i=0;i<N;i++){
    int tmp_a;
    cin >>tmp_a;
    rec[tmp_a]++;
    a.push_back(tmp_a);
  }

  for(int i=1;i<200000;i++) cases+=rec[i]*(rec[i]-1)/2;

  for(int i=0;i<N;i++){
    int same_balls =rec[a[i]];
    int64_t ans=cases - same_balls*(same_balls-1)/2;
    ans += (same_balls-1)*(same_balls-2)/2;
    cout <<ans <<endl;

  }


  return 0;
}
/*
*/


Measured memory_bytes: 5868
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cctype>
using namespace std;

#define REP(i,n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef pair<int, int> pint;

bool solve(string S) {
  int len = S.length();
  int cntA = 0;
  int cntC = 0;
  int cntL = 0;
  for(int i = 0; i < len; i++) {
    if(S[i] == 'A') cntA++;
    else if(S[i] == 'C') cntC++;
    else if(islower(S[i])) cntL++;
  }
  //  cout << cntA << " " << cntC << " " << cntL << endl;                       
  if(cntA != 1) return false;
  if(cntC != 1) return false;
  if(cntL != len-2) return false;
  if(S[0] != 'A') return false;
  for(int i = 3-1; i <= len-2; i++) {
    if(S[i] == 'C') return true;
  }
  return false;
}


int main() {
  string S; cin>>S;
  bool ans = solve(S);
  cout << (ans ? "AC" : "WA") << endl;
  return 0;
}



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

using namespace std;
int a[100005],dp[100003];
int n;
int mincost(int x)
{
	if(x==n)
	{
		dp[x]=0;
		return dp[x];
	}
	if(x==n-1)
	{
		if(dp[x]==-1)
			dp[x]= abs(a[n]-a[n-1]);
		return dp[x];
	}
	if(dp[x+1]==-1)
		dp[x+1]=mincost(x+1);
	if(dp[x+2]==-1)
		dp[x+2]=mincost(x+2);
	dp[x]=min(dp[x+1]+abs(a[x+1]-a[x]),dp[x+2]+abs(a[x+2]-a[x]));
	return dp[x];
}
int main()
{
	cin>>n;
	for (int i = 1; i <=n; ++i)
	{
		cin>>a[i];
	}
	for (int i = 0; i < 100002; ++i)
	{
		dp[i]=-1;
	}
	
	cout<<mincost(1)<<'\n';
	// for (int i = 1; i <= n; ++i)
	// {
	// 	cout<<dp[i]<<' ';
	// }
	// cout<<'\n';

}

Measured memory_bytes: 4096
import sys
sys.setrecursionlimit(10**7)

readline = sys.stdin.buffer.readline
def readstr():return readline().rstrip().decode()
def readstrs():return list(readline().decode().split())
def readint():return int(readline())
def readints():return list(map(int,readline().split()))
def printrows(x):print('\n'.join(map(str,x)))
def printline(x):print(' '.join(map(str,x)))

n  =readint()
a = readints()

if n%2==0:
    b = 0
    for i in range(n):
        b^=a[i]
    ans = [b^a[i] for i in range(n)]
else:
    b = a[0]
    ans = [0]+[b^a[i] for i in range(1,n)]

printline(ans)



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

#define boost                         \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define ll long long int
// #define int ll
#define vi vector<ll>
#define vvi vector<vi>
#define pii pair<int, int>
#define vii vector<pii>
#define pb push_back
#define B begin()
#define E end()
#define sz(A) (ll)(A).size()
#define F first
#define S second
#define loop(z, v) for (auto &z : v)
#define sp << ' ' <<
#define sps << ' '
#define nl "\n"
// #define nl endl
#define fat 1000000007
// #define fat 998244353
#define PI_2 1.57079632679489661923

vii dir = {{-1, 0}, {0, -1}, {1, 0}, {0, 1}};

int main() {
    ll tt = 1, n, m, l, r, c, i, j, k, w, x, y;
    boost;

    // cin >> tt;
    ll ans = 0;
    ll x1, y1, z1, x2, y2, z2;
    for(int _ = 1; _ <= tt; _++) {
        int h, w, cx, cy, dx, dy;
        cin >> h >> w >> cx >> cy >> dx >> dy;
        vector<vector<bool>> mat(h, vector<bool>(w, 0));
        for(i = 0; i < h; i++){
            for(j = 0; j < w; j++){
                char c;
                cin >> c;
                if(c == '.') mat[i][j] = 1;
            }
        }
        cx--, cy--, dx--, dy--;

        priority_queue<pair<ll, pii>, vector<pair<ll, pii>>, greater<pair<ll, pii>>> pq;
        vvi dist(h, vi(w, INT_MAX));
        dist[cx][cy] = 0;
        pq.push({dist[cx][cy], {cx, cy}});

        while(!pq.empty()){
            ll d = pq.top().F;
            ll ux = pq.top().S.F;
            ll uy = pq.top().S.S;

            pq.pop();
            if(d != dist[ux][uy]) continue;
            for(auto &z: dir){
                ll nx = ux + z.F, ny = uy + z.S;
                if(nx < 0 || ny < 0 || nx >= h || ny >= w) continue;
                if(!mat[nx][ny]) continue;

                if(dist[nx][ny] > dist[ux][uy]){
                    dist[nx][ny] = dist[ux][uy];
                    pq.push({dist[nx][ny], {nx, ny}});
                }
            }

            for(int i = -2; i < 3; i++){
                for(int j = -2; j < 3; j++){
                    ll nx = ux + i, ny = uy + j;
                    if(nx < 0 || ny < 0 || nx >= h || ny >= w) continue;
                    if(!mat[nx][ny]) continue;
                    if(abs(i) + abs(j) <= 1) continue;

                    if(dist[nx][ny] > dist[ux][uy] + 1){
                        dist[nx][ny] = dist[ux][uy] + 1;
                        pq.push({dist[nx][ny], {nx, ny}});
                    }
                }
            }
        }

        cout << (dist[dx][dy] == INT_MAX?-1:dist[dx][dy]) << nl;
    }
}

Measured memory_bytes: 11608
def prime_fact(n):
    primes = []
    i = 2
    while i * i <= n:
        cnt = 0
        while n % i == 0:
            n //= i
            cnt += 1
        if cnt:
            primes.append([i, cnt])
        i += 1

    if n != 1:
        primes.append([n, 1])
    return primes

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

if b < a:
    a, b = b, a

fact = prime_fact(a)
ans = 1
for i, j in fact:
    if b % i == 0:
        ans += 1
if a == 1:
    ans = 1

print(ans)

Measured memory_bytes: 63040
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i, n) FOR(i, 0, (n))
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define LAR(a, b) ((a)=max((a),(b)))
#define SML(a, b) ((a)=min((a),(b)))
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pair<int, int>> vpii;
typedef pair<int, int> pii;
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define ALL(a) (a).begin(), (a).end()
#ifdef LOCAL_DEBUG
#define DEBUG(...) printf(__VA_ARGS__)
#else
#define DEBUG(...)
#endif

int main(){
	int n; scanf("%d", &n);
	printf("%d", n*n*n);
}


Measured memory_bytes: 256
/*
 * main.c
 *
 *  Created on: 2016/12/23
 *      Author: stoneriver
 */

#include <stdio.h>

int main() {
	int nums[3];
	scanf("%d %d %d", &nums[0], &nums[1], &nums[2]);
	int i;
	for (i = 0; i < 2; i++) {
		int j;
		for (j = 2; j > i; j--) {
			if (nums[j] < nums[j - 1]) {
				int tmp = nums[j];
				nums[j] = nums[j - 1];
				nums[j - 1] = tmp;
			}
		}
	}
	printf("%d %d %d\n", nums[0], nums[1], nums[2]);
	return 0;
}

Measured memory_bytes: 2708