akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define MOD 1000000007
#define INF 2000000000
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
typedef unsigned long long int ull;

using namespace std;

int main(void){
  int N,ans=0;
  cin >> N;
  int a[N];
  int b[100001]={};
  rep(i,N) cin >> a[i];
  rep(i,N) b[a[i]]++;
  for(int i=1;i<99999;i++) ans=max(ans,b[i-1]+b[i]+b[i+1]);
  cout << ans << endl;
}

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

using namespace std;

int main () {
	string s;
	cin >> s;
	int ans = (s.size () - 1) * 9;
	int ok = 0;
	for (int i = 1;i < s.size ();i ++) if (s[i] != '9') ok = 1;
	ans += (s[0] - '0') - ok;
	cout << ans;
	return 0;
}

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

const ll INF=1e9;

int main(){
    ll n;
    cin>>n;
    vector<vector<ll>> f(n,vector<ll>(10)),p(n,vector<ll>(11));
    rep(i,n)rep(j,10) cin>>f[i][j];
    rep(i,n)rep(j,11) cin>>p[i][j];
    ll mx=-INF;
    for(ll t=1;t<(1<<10);t++){
        ll sum=0;
        rep(i,n){
            ll cnt=0;
            rep(j,10){
                if((t>>j)&f[i][j]) cnt++;
            }
            sum+=p[i][cnt];
        }
        mx=max(mx,sum);
    }
    cout<<mx<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int m=1,n;
  cin >> n ;
  vector<string> s(n);
  vector<string> t(n);
  vector<int> z(n,1);
  for (int i = 0; i < n; i++) {
    cin >> s[i];
  }
  sort(s.begin(), s.end());
  t[0]=s[0];
  int x=0;
  for (int i = 1; i < n; i++) {
    if(t[x]==s[i]){
      z[x]++;
      m=max(m,z[x]);
    }else{
      x++;
      t[x]=s[i];
    }
  }
  for (int i = 0; i <= x; i++) {
    if(z[i]==m) {
      cout << t[i] << endl;
    }
  }
}

Measured memory_bytes: 16640
a, b = map(int, input().split())
MOD = 10 ** 9 + 7
n = [0] * (a + 1)

for i in range(1, a + 1):
    n[i] = n[i - 1] + i

ans = 0
for k in range(b - 1, a + 1):

    ans = (ans + (n[a] - n[max(0, a - k - 1)]) - n[k] + 1) % MOD

print(ans)


Measured memory_bytes: 19132
#include <iostream>
using namespace std;
int main()
{
    int a,b,c,d,e,k;
    cin >> a >> b >> c >> d >> e >> k;
    
    if(e - a > k){
        cout << ":(" << endl;
    }else{
        cout << "Yay!" << endl;
        
    }
    
    
    return 0;
}

Measured memory_bytes: 256
N = int(input())
a = list(map(int,input().split()))
ans = 0
if N >= 3:
  for i in range(N):
    for j in range(i+1,N):
      for k in range(j+1,N):
        if a[i]+a[j]>a[k] and a[j]+a[k]>a[i] and a[k]+a[i]>a[j]:
          if a[i] != a[j] and a[j] != a[k] and a[k] != a[i]:
            ans+=1
            #print(a[i],a[j],a[k])
print(ans)

Measured memory_bytes: 9200
/// 標準入力マクロ
/// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

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

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

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

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

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

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

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

fn main() {
    input! {
        n: usize,
        a: [i32; n]
    }

    let mut ret = 1000;
    for e in a.iter() {
        let mut e: i32 = *e;
        let mut div = 0;
        while e % 2 == 0 {
            e = e / 2;
            div = div + 1;
        }

        if ret > div {
            ret = div;
        }
    }

    println!("{}", ret);
}


Measured memory_bytes: 2092
#include<iostream>
#include<vector>
#include<map>
#include<string>
#include<utility>
#include<algorithm>
#include<cstdio>
#include<iomanip>
using namespace std;
#define ll int64_t
#define REP(i, n) for (ll i=0; i<n; i++)

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

    ll N;
    cin >> N;

    ll score = 0;
    ll hard;

    for (ll i=1; i<=N; i++){
        score += i;
        if (score >= N) {
            hard = i;
            break;
        }
    }

    vector<ll> ans;
    ans.push_back(hard);
    N -= hard;
    for (ll i=hard-1; i>0; i--){
        if (N >= i) {
            ans.push_back(i);
            N -= i;
        }
    }

    REP(i, ans.size()) {
        cout << ans[i] << "\n";
    }
}

Measured memory_bytes: 384
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int height = scan.nextInt();
		int width = scan.nextInt();
		scan.nextLine();

		int[][][] dp = new int[height][width][2];

		for (int h = 0; h < height; h++) {

			String[] widthArray = scan.nextLine().split("");

			for (int w = 0; w < width; w++) {

				// 道：０　壁：１
				dp[h][w][0] = widthArray[w].equals(".")
						? 0
						: 1;
			}
		}

		// 開始地点は１通り
		dp[0][0][1] = 1;

		for (int h = 0; h < height; h++) {

			for (int w = 0; w < width; w++) {

				if (dp[h][w][0] == 0) {

					if (h == 0 && w == 0) {
						continue;

					} else if (h == 0) {

						dp[h][w][1] = dp[h][w - 1][1];

					} else if (w == 0) {

						dp[h][w][1] = dp[h - 1][w][1];

					} else {

						dp[h][w][1] = dp[h - 1][w][1] + dp[h][w - 1][1];
					}

					dp[h][w][1] = dp[h][w][1] % 1000000007;
				}
			}
		}

		System.out.println(dp[height - 1][width - 1][1]);
	}
}


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

int f(int n) {
  int sum = 0;
  while (n > 0) {
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

int main(void){
  int n;
  cin >> n;
  
  if (n % f(n) == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <stdio.h>
#include <vector>
using namespace std;

int N, K, C[200200], S[200200], E[200200], Z[200200];
vector<int> V[200200], I[200200]; long long A[200200];

void go(int x, int l)
{
	S[x] = ++K;

	auto &i = I[C[x]];
	for (auto &y : V[x]) if (y != l){
		go(y, x);
		int n = Z[y];
		while (!i.empty()){
			int z = i.back();
			if (S[y] <= S[z]){
				n -= Z[z];
				i.pop_back();
			}
			else break;
		}
		A[C[x]] -= 1ll * n * (n + 1) / 2;
	}
	i.push_back(x);

	E[x] = K;
	Z[x] = E[x] - S[x] + 1;
}

int main()
{
	scanf ("%d", &N);
	for (int i = 1; i <= N; i++) scanf ("%d", &C[i]);
	for (int i = 1; i < N; i++){
		int x, y; scanf ("%d %d", &x, &y);
		V[x].push_back(y);
		V[y].push_back(x);
	}
	go(1, 0);

	for (int c = 1; c <= N; c++){
		A[c] += 1ll * N * (N + 1) / 2;
		int n = N;
		for (auto &x : I[c]) n -= Z[x];
		A[c] -= 1ll * n * (n + 1) / 2;
		printf ("%lld\n", A[c]);
	}

	return 0;
}


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

long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}


int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll MOD = 1000000007;
  ll s;
  cin >> s;
  ll ans = 0;
  for(int i = 0; i < s/3; i++){
    ll rest = s-(i+1)*3;
    ll tasu = 1;
    for(int j=0; j<i; j++){
      tasu *= rest + i - j;
      tasu %= MOD;
    }
    for(int j=1; j<=i; j++){
      tasu = tasu * modinv(j, MOD) % MOD;
    }
    ans += tasu;
    ans %= MOD;
  }
  cout << ans << endl;
}


Measured memory_bytes: 3560
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cstdint>
#include <cassert>
#include <random>

using namespace std;
using i64 = int64_t;
using i32 = int32_t;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0) 
{ v = vector<T>(n+o); for (size_t i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> void read_n(T a[], size_t n, size_t o = 0)
{ for (size_t i=o; i<n+o; ++i) cin >> a[i]; }
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

int main() {
  string s;
  cin >> s;
  for (i64 i = s.size() / 2 - 1; i >= 0; i--) {
    if (s.substr(0, i) == s.substr(i, i)) {
      cout << 2 * i << endl;
      return 0;
    }
  }
  return 0;
}



Measured memory_bytes: 256
<?php
$server = "php://stdin";
$handle = fopen($server, "r");
$t = trim(fgets($handle));
$a=trim(fgets($handle));
$a=explode(' ',$a);
$check=1;
foreach ($a as $g)
{
    if($g%2==0)
    {
        if( ($g%3==0  || $g%5==0))
        {
            continue;
        }else
        {
            $check=0;
            break;

        }

    }
}
if($check)
{
    echo "APPROVED";
}else
{
    echo "DENIED";
}
?>

Measured memory_bytes: 4728
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cassert>
#include<climits>
#include<algorithm>
#include<vector>
#include<deque>
#include<map>
#include<set>
#include<sstream>
#include<cstring>

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

using namespace std;

int x[2], y[2];

int main() {
  rep(i,2) cin >> x[i] >> y[i];
  string answer = "";
  answer += string(y[1]-y[0],'U') + string(x[1]-x[0],'R');
  answer += string(y[1]-y[0],'D') + string(x[1]-x[0],'L');
  answer += "L" + string(y[1]-y[0]+1,'U') + string(x[1]-x[0]+1,'R') + "D";
  answer += "R" + string(y[1]-y[0]+1,'D') + string(x[1]-x[0]+1,'L') + "U";
  cout << answer << endl;
  return 0;
}

Measured memory_bytes: 256
#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; }

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout<<setprecision(20);

    int n;
    cin>>n;
    if(n%2==0){
        cout<<"0.5"<<endl;
    }
    else{
        int x=n/2;
        double y=x+1.0;
        double z=(double)n;
        cout<<(y/z)<<endl;
    }
    return 0;
}


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

int main() {
  string s, t;
  cin >> s >> t;
  int len = s.length();
  for(int i = 0; i < len; i++) {
    int f = 1;
    for(int j = 0; j < len; j++) {
      if(t.at(j) != s.at((i + j) % len)) {
        f = 0;
        break;
      }
    }
    if(f) {
      printf("Yes\n");
      return 0;
    }
  }
  printf("No\n");
}

Measured memory_bytes: 256
n = int(input())
l = [list(map(int, input().split())) for _ in range(n)]

t = 0
x = 0
y = 0
i = 0
flag = True
for i in range(n):
    if abs(l[i][1]-x)+abs(l[i][2]-y) <= l[i][0]-t:
        if (l[i][0]-t) % 2 != (l[i][1]-x + l[i][2]-y) % 2:
            flag = False
            break
    else:
        flag = False
        break
    t = l[i][0]
    x = l[i][1]
    y = l[i][2]

if flag:
    print("Yes")
else:
    print("No")


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

using cat = long long;

cat pw(cat a, cat e, cat mod) {
	if(e <= 0) return 1;
	cat x = pw(a, e/2, mod);
	return (e&1) ? x * x % mod * a % mod : (x * x % mod);
}

int main() {
	int R, C, K;
	cat mod;
	cin >> R >> C >> K >> mod;
	cat fac[102], fac_inv[102];
	fac[0] = fac_inv[0] = 1;
	for(int i = 1; i <= 100; i++) {
		fac[i] = fac[i-1] * i % mod;
		fac_inv[i] = fac_inv[i-1] * pw(i, mod-2, mod) % mod;
	}
	int dp[102][102];
	memset(dp, 0, sizeof(dp));
	dp[C][R] = 1;
	for(int k = 0; k < K; k++) {
		static cat dpw[102];
		for(int i = 0; i <= 100; i++) {
			dpw[i] = (pw(k+1, i, mod) - pw(k, i, mod)) % mod;
			if(dpw[i] < 0) dpw[i] += mod;
		}
		for(int c = 0; c <= C; c++) {
			static cat coef_x[102];
			cat p = (pw(K-k, C-c, mod) - pw(K-k-1, C-c, mod)) * pw(k+1, c, mod) % mod, pw_p = 1;
			if(p < 0) p += mod;
			for(int i = 0; i <= R; i++) {
				coef_x[i] = fac_inv[i] * pw_p % mod;
				pw_p = pw_p * p % mod;
			}
			static int coef_y[102][102];
			for(int i = 0; i <= R; i++) {
				cat a = dpw[i] * pw(K-k, R-i, mod) % mod, pw_a = 1;
				for(int j = 0; j <= C-c; j++) {
					coef_y[i][j] = fac_inv[j] * pw_a % mod;
					pw_a = pw_a * a % mod;
				}
			}
			cat mod2 = mod * mod * 5;
			static int inner_sum[102];
			for(int i = 0; i <= R; i++) {
				cat s = 0;
				for(int j = 0; j <= C-c; j++) {
					s += 1LL * dp[c+j][i] * coef_y[i][j];
					if(s >= mod2) s -= mod2;
				}
				inner_sum[i] = s % mod;
			}
			for(int r = 0; r <= R; r++) {
				cat s = 0;
				for(int x = r; x <= R; x++) {
					s += inner_sum[x] * coef_x[x-r];
					if(s >= mod2) s -= mod2;
				}
				dp[c][r] = s % mod;
			}
		}
	}
	cout << dp[0][0] * fac[R] % mod * fac[C] % mod << "\n";
}


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

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

Measured memory_bytes: 256
//Love and Freedom.
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstring>
#include<map>
#define ll __int128
#define inf 20021225
using namespace std;
ll read()
{
	ll s=0,t=1; char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')	t=-1; ch=getchar();}
	while(ch>='0' && ch<='9')	s=s*10+ch-'0',ch=getchar();
	return s*t;
}
map<ll,ll> f; ll a,b,c,d;
ll abs(ll x){return x>0?x:-x;}
ll dfs(ll x)
{
	if(!x)	return 0;
	if(f.find(x)!=f.end())	return f[x];
	ll l2 = x/2 , r2 = l2 + 1; f[x]=x*d; //printf("%lld\n",f[x]);
	f[x] = min(f[x],min(dfs(r2) + a + abs(r2*2 - x) * d , dfs(l2) + a + abs(l2*2 - x) * d));
	ll l3 = x/3 , r3 = l3 + 1;
	f[x] = min(f[x],min(dfs(r3) + b + abs(r3*3 - x) * d , dfs(l3) + b + abs(l3*3 - x) * d));
	ll l5 = x/5 , r5 = l5 + 1;
	f[x] = min(f[x],min(dfs(r5) + c + abs(r5*5 - x) * d , dfs(l5) + c + abs(l5*5 - x) * d));
	return f[x];
}
int main()
{
	int T=read();
	while(T--)
	{
		ll n=read(); a=read(),b=read(),c=read(),d=read(); f.clear();
		printf("%lld\n",(long long)dfs(n));
	}
	return 0;
}


Measured memory_bytes: 4496
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
#define vec(s) vector
;
#define vvec(s) vector<vector
> ;
typedef vector<lli> vi;
typedef vector<vi> vvi;
typedef pair<lli,lli> pii;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define YN(x) cout<<(bool x?"Yes":"No")<<endl;
#define out(s) cout<<s<<endl;
#define pb(s) push_back(s);
#define sp " ";
#define INF 10000000000
#define all(s) s.begin(),s.end()
void vout(vector<int> v){
    for(int i=0;i<v.size();i++)
    cout<<v.at(i)<<endl;
}
int main(){
    string s;
    lli n;
    lli c=0,x=0;
    cin>>n>>s;
    rep(i,n){
        if(s[i]=='(') c++;
        else c--;
        x=min(c,x);
    }
    rep(i,-x){
        s='('+s;
    }
    rep(i,c-x){
        s=s+')';
    }
    out(s);


}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	// Code for B - Sum of Three Integers
	var K, S int
	fmt.Scanf("%d %d", &K, &S)

	var count int = 0
	for i := 0; i <= K; i++ {
		for j := 0; j <= K; j++ {
			k := S - i - j
			if 0 <= k && k <= K {
				count++
			}
		}
	}
	fmt.Println(count)
}


Measured memory_bytes: 1844
//Sorting Five Numbers
#include<bits/stdc++.h>
using namespace std;

int v[5];

int main(){
  cin>>v[0]>>v[1]>>v[2]>>v[3]>>v[4];
  sort(v, v+5, greater<int>());
  for(int i=0; i<5; i++){
    cout<<v[i];
    if(i!=4) cout<<' ';
    else cout<<'\n';
  }
  return 0;
}

Measured memory_bytes: 1176
n, k = gets.chomp.split().map(&:to_i)
r, s, p = gets.chomp.split().map(&:to_i)
predicts = gets.chomp.chars
score = 0
wins = {r: p, s: r, p: s}
memo = Array.new(n, true)

n.times do |i|
  now = predicts[i]
  
  if i > k - 1 && predicts[ i - k ] === now && memo[i - k]
    #相手がk回前と同じ手を出した時は負ける、奇数回目なら勝てる
    memo[i] = false
    next
  end
  score += wins[now.to_sym]
end

puts score

Measured memory_bytes: 7676
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const int INF = 1001001001;

int main(){
  int n; cin >> n;
  vector<int> a(n,0);
  for(int i=0;i<n;i++) cin >> a.at(i);

  vector<int> left(n,0) , right(n,0);
  left.at(0) = a.at(0);
  right.at(n-1) = a.at(n-1);
  for(int i=1;i<n;i++) left.at(i) = __gcd(left.at(i-1),a.at(i));
  for(int i=n-2;i>=0;i--) right.at(i) = __gcd(right.at(i+1),a.at(i));
  int ans = 0;
  ans=max(left.at(n-2),right.at(1));
  for(int i=1;i<n-1;i++) ans = max(ans,(__gcd(left.at(i-1),(right.at(i+1)))));
  cout << ans << endl;
}

Measured memory_bytes: 1408
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long a = sc.nextLong();
        long b = sc.nextLong();
        long ans = 0;
        long tmp = (b - a + 1) / 2;
        if((b - a + 1) % 2 != 0) tmp += a % 2;
        if(tmp % 2 != 0) ans += 1;
        for (long i = 2; i < b*2; i *= 2) {
            long c = 0;
            long r1 = a % (i * 2);
            if(r1 >= i) c += (i*2) - r1;
            long r2 = b % (i * 2);
            if(r2 >= i) c += r2 - (i * 2 - 1);
            if(c % 2 != 0){
                ans += i;
            }
        }

        System.out.println(ans);
        sc.close();
    }

}


Measured memory_bytes: 23252
import glob

# 問題ごとのディレクトリのトップからの相対パス
REL_PATH = 'ABC\\166\\A'

# テスト用ファイル置き場のトップ
TOP_PATH = 'C:\\AtCoder'

class Common:

    problem = []
    index = 0

    def __init__(self, rel_path):
        self.rel_path = rel_path

    def initialize(self, path):
        file = open(path)
        self.problem = file.readlines()
        self.index = 0
        return

    def input_data(self):
        try:
            IS_TEST
            self.index += 1
            return self.problem[self.index-1]

        except NameError:
            return input()

    def resolve(self):
        pass

    def exec_resolve(self):
        try:
            IS_TEST
            for path in glob.glob(TOP_PATH + '\\' + self.rel_path + '/*.txt'):
                print("Test: " + path)
                self.initialize(path)
                self.resolve()
                print("\n\n")
        except NameError:
            self.resolve()


class Solver(Common):

    def resolve(self):


        S = self.input_data()

        if S == 'ABC':
            print('ARC')
        else:
            print('ABC')



solver = Solver(REL_PATH)
solver.exec_resolve()

Measured memory_bytes: 9776
n,m = map(int,input().split())
D = dict()
A = []
for i in range(m):
    p,y = map(int,input().split())
    A.append([p,y,i,0])
A.sort(key = lambda x:x[1])
for a in A:
    if a[0] not in D:
        D[a[0]] = 1
    else:
        D[a[0]] +=1
    a[3] = D[a[0]]
A.sort(key = lambda x:x[2])
for a in A:
    print(str(a[0]).zfill(6)+str(a[3]).zfill(6))


Measured memory_bytes: 33612
/* ****TCIITB**** */

#include<bits/stdc++.h>
#define io          ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); 
#define ll          long long
#define pb          push_back
#define	endl		'\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define rep(i,a,b)	for(ll int i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define time        cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
using namespace std;

#define N  100005

int main()
{
	
	io
	ll a,b;
	cin>>a>>b;
	ll curr=1;	
	while(1)
	{
		long double z1=curr*1.0*0.08;
		long double z2=curr*1.0*0.10;
		ll z3=z1;
		ll z4=z2;
		if(z3==a && z4==b)
		{
			cout<<curr;
			exit(0);
		}
		curr++;
		if(curr>=100000000)
		{
			cout<<"-1";
			exit(0);
		}
	}
	
}

Measured memory_bytes: 256
import math
import functools


def mmul(a, b, mod):
    return (a % mod) * (b % mod) % mod


def mfact(a, mod):
    fact = 1
    for m in range(a + 1):
        fact *= m % mod
        fact %= mod
    return fact


def mpow(a, b, mod):
    if b == 0:
        return 1
    if b == 1:
        return a % mod
    if b % 2 == 0:
        return mpow(a, b / 2, mod) ** 2 % mod
    return mpow(a, b // 2, mod) ** 2 * a % mod


def mdiv(a, b, mod):
    return mmul(a, mpow(b, mod - 2, mod), mod)


# (n+a)Ca = (n+a)! / n!a! mod mod for n >> a
def mnpaca(n, a, mod):
    res = 1
    for num in range(n + 1, n + a + 1):
        res *= num % mod
        res %= mod
    return mdiv(res, math.factorial(a), mod)


mod = 10 ** 9 + 7

N, M = map(int, input().split())

prime_counts = []
i = 2
while i * i <= M:
    count = 0
    while M % i == 0:
        M /= i
        count += 1
    if count:
        prime_counts.append(count)
    i += 1
if M > 1:
    prime_counts.append(1)

res = functools.reduce(lambda x, y: x * y, [mnpaca(N - 1, c, mod) for c in prime_counts], 1)

print(res % mod)


Measured memory_bytes: 3692
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;
const int INF = 1000000000;

int main(){
	ios_base::sync_with_stdio(false);
	while(true){
		int n;
		cin >> n;
		if(n == 0){ break; }
		vector<int> a(n), b(n), c(n);
		for(int i = 0; i < n; ++i){ cin >> a[i] >> b[i] >> c[i]; }
		vector< vector<int> > possible(n);
		for(int i = 0; i < n; ++i){
			for(int j = 0; j < 60; ++j){
				int t[3] = {
					(a[i] + j) % 60, (b[i] + j) % 60, (c[i] + j) % 60
				};
				sort(t, t + 3);
				do {
					const int h = t[0] / 5;
					const int m = t[1];
					const int s = t[2];
					if(t[0] % 5 == m / 12){
						possible[i].push_back(h * 60 * 60 + m * 60 + s);
					}
				} while(next_permutation(t, t + 3));
			}
			possible[i].push_back(INF);
			sort(possible[i].begin(), possible[i].end());
		}
		int answer_begin = 0, answer_end = 12 * 60 * 60;
		for(int i = 12 * 60 * 60 - 1; i >= 0; --i){
			int last = 0;
			for(int j = 0; j < n; ++j){
				last = max(last, *lower_bound(
					possible[j].begin(), possible[j].end(), i));
			}
			if(last - i <= answer_end - answer_begin){
				answer_begin = i;
				answer_end = last;
			}
		}
		cout << setfill('0') << setw(2) << answer_begin / 60 / 60 << ":";
		cout << setfill('0') << setw(2) << answer_begin / 60 % 60 << ":";
		cout << setfill('0') << setw(2) << answer_begin % 60 << " ";
		cout << setfill('0') << setw(2) << answer_end / 60 / 60 << ":";
		cout << setfill('0') << setw(2) << answer_end / 60 % 60 << ":";
		cout << setfill('0') << setw(2) << answer_end % 60 << endl;
	}
	return 0;
}

Measured memory_bytes: 1232
#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long ll;
int a[100005];
int n;
int ans;
inline void read(int &x)
{
	int f;char c;
	for (f=1,c=getchar();c<'0'||c>'9';c=getchar()) if(c=='-') f=-1;
	for (x=0;c<='9'&&c>='0';c=getchar()) x=x*10+(c&15);x*=f;
}
inline int mn(int _x,int _y)
{
	return _x<_y?_x:_y;
}
inline int mx(int _x,int _y)
{
	return _x>_y?_x:_y;
}
inline int ab(int _x)
{
	if(_x<0) return -_x;
	else return _x;
}
inline bool cmp(int p,int q)
{
	return p<q;
}
int main()
{
	read(n);
	for(int i=1;i<=n;i++) read(a[i]);
	sort(a+1,a+n+1,cmp);
	for(int i=2;i<=n;i++)
		ans+=(a[i]==a[i-1]);
	if(ans&1) ans++;
	printf("%d\n",n-ans);
	return 0;
}



Measured memory_bytes: 640
#include <iostream>
#include <stdio.h>
#include <string>
#include <vector>
#include <stdlib.h>

using namespace std;

//1からnまでの自然数の和を返す
int getSum(int n) {
	return (n*(n+1)/2);
}

int main(void){
	//FILE* fp_in = freopen("data.txt", "r", stdin);

	while(1) {
		int N, ans = 0;
		cin >> N;
		if( N == 0 ) break;

		for(int i = 1; i < N; i++) {
			for(int j = i + 1; j < N; j++) {
				//かならずjのほうが大きい
				if( getSum(j) - getSum( i - 1 ) == N ) ans ++;
			}
		}

		cout << ans << endl;
	}

	//while(1){}
	return 0;
}

Measured memory_bytes: 1164
//header{{{
#include<bits/stdc++.h>
  
using namespace std;
 
#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define setout(n,x) setw(n) << setfill(x)
#define Fixed fixed << setprecision(10)
#define int long long
using pii = pair<int,int>;
constexpr int INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod = 1e9+7; 
 
int gcd(int a,int b){ return b ? gcd(b,a % b) : a;}
int lcm(int a,int b){ return a / gcd(a,b) * b;}
//}}}

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	int sum = 0;
	for(int i = 1;i * i < n;++i){
		if(n % i == 0 && n / (n / i -1) == n % (n / i -1)) sum += n / i -1;
	}
	cout << sum << '\n';
	return 0;
}


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

#define int long long
#define rep(i,l,r) for(int i=(int)(l);i<(int)(r);i++)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)x.size())
template<class T>bool chmax(T &a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,T b){if(a>b){a=b;return 1;}return 0;}


/*{
  }*/

using vi = vector<int>;
using vvi = vector<vi>;
using P = pair<int,int>;

//constexpr int mod = 1e9+7;
//constexpr int inf = 1<<30;
int n;
vi x[15], y[15];

signed main(){
  cin >> n;

  rep(i, 0, n){
    int a; cin >> a;
    rep(j, 0, a){
      int X, Y;
      cin >> X >> Y;
      X--; 
      x[i].emplace_back(X);
      y[i].emplace_back(Y);
    }
  }

  int ans = 0;
  rep(mask, 0, 1<<n){
    bool ok = true;
    int cnt = 0;
    rep(i, 0, n) if(mask & (1<<i)){
      cnt++;
      rep(j, 0, sz(x[i])){
        if(y[i][j] == 0){
          if(mask & (1<<x[i][j])) ok = false;
        }else{
          if((mask & (1<<x[i][j])) == 0) ok = false;
        }
      }
    }
    if(ok) chmax(ans, cnt);
  }

  cout << ans << endl;

  return 0;
}



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

const ll INF = 1LL << 60;

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

    double area = x / a; 
    double radian = 0;
    if (2 * area >= a * b) {
        // 半分以上
        double tmp = 2 * (b - x / (a * a)); 
        radian = atan2(tmp, a);
    } else {
        // 半分未満
        double tmp = (2 * x) / (a * b);
        radian = atan2(b, tmp);
    }
    // radian = atan2(1, 1);
    double degree = radian * 180.0 / M_PI;

    printf("%.10f\n", degree);
}

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

int main(){
  int W, H, N;
  cin >> W >> H >> N;
  int xl=0, xr=W, yt=H, yb=0;
  for(int i=0; i<N; i++){
    int x, y, a;
    cin >> x >> y >> a;
    if(a==1 && xl<x){
      xl=x;
    }
    else if(a==2 && x<xr){
      xr=x;
    }
    else if(a==3 && yb<y){
      yb=y;
    }
    else if(a==4 && y<yt){
      yt=y;
    }
  }
  if(xl<xr && yb<yt){
    cout << (xr-xl)*(yt-yb) << endl;
    return 0;
  }
  cout << "0" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <cstring>
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
using namespace std;
int a[100010];
int main()
{

    int n,k,mx=0,gy;
    scanf("%d%d",&n,&k);
    for(int i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
        mx=max(mx,a[i]);
        if(i==0) gy=a[i];
        else gy=__gcd(gy,a[i]);
        if(a[i]==k)
        {
            printf("POSSIBLE");
            return 0;
        }
    }
    if(k>mx)
    {
        printf("IMPOSSIBLE");
    }
    else
    {
        while(mx>0)
        {
            if(mx==k)
            {
                printf("POSSIBLE");
                return 0;
            }
            mx-=gy;
        }
        printf("IMPOSSIBLE");
    }
    return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#include<boost/multiprecision/cpp_int.hpp>
using namespace std;
using namespace boost::multiprecision;
#define BEGIN ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define END return EXIT_SUCCESS
#define rep(I,N) for(auto I=0;I<(N);++I)
#define up(I,A,B) for(auto I=(A);I<=(B);++I)
#define dw(I,A,B) for(auto I=(A);I>=(B);--I)
#define all(C) (C).begin(),(C).end()
#define rall(C) (C).rbegin(),(C).rend()
#define ft first
#define sd second
#define mp make_pair
#define mt make_tuple
#define pf push_front
#define pb push_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define rs resize
typedef long long ll;
typedef unsigned long long ull;
template<class T>inline void                                      in(T &p){cin>>p;}
template<class T1,class T2>inline void                            in(T1 &p1,T2 &p2){cin>>p1>>p2;}
template<class T1,class T2,class T3>inline void                   in(T1 &p1,T2 &p2,T3 &p3){cin>>p1>>p2>>p3;}
template<class T1,class T2,class T3,class T4>inline void          in(T1 &p1,T2 &p2,T3 &p3,T4 &p4){cin>>p1>>p2>>p3>>p4;}
template<class T1,class T2,class T3,class T4,class T5>inline void in(T1 &p1,T2 &p2,T3 &p3,T4 &p4,T5 &p5){cin>>p1>>p2>>p3>>p4>>p5;}
template<class T>inline void                                      ins(T &p){for_each(all(p),in<decltype(p[0])>);}
template<class T>inline void                             out(T p){cout<<p<<endl;}
template<class T1,class T2>inline void                   out(T1 p1,T2 p2){cout<<p1<<" "<<p2<<endl;}
template<class T1,class T2,class T3>inline void          out(T1 p1,T2 p2,T3 p3){cout<<p1<<" "<<p2<<" "<<p3<<endl;}
template<class T1,class T2,class T3,class T4>inline void out(T1 p1,T2 p2,T3 p3,T4 p4){cout<<p1<<" "<<p2<<" "<<p3<<" "<<p4<<endl;}
inline                                              void out(double p){printf("%.10f\n",p);}
template<class T>inline                             void outs(T p){for_each(all(p),out<decltype(p[0])>);}

inline void solve(void){
  int N,M;
  in(N,M);
  priority_queue<long>q;
  rep(i,N){
    long A;
    in(A);
    q.push(A);
  }
  while(M){
    long A=q.top();q.pop();
    q.push(A/2);
    M--;
  }
  long ans=0;
  while(!q.empty()){
    ans+=q.top();
    q.pop();
  }
  out(ans);
}
int main(int argc,char**argv){
  BEGIN;
  solve();
  END;
}


Measured memory_bytes: 1400
#include <bits/stdc++.h>
using namespace std;
int main() {
  double N,K;
  cin>>N>>K;
  double kotae=0;
  for(int i=1;i<=N;i++){
    double p=1;
    int x=i;
    while(x<K){
      p*=0.5;
      x*=2;
    }
    kotae+=p/N;
  }
  cout<<fixed<<setprecision(12)<<kotae<<endl;
  return 0;
}

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

int main(){
    int count=0;
    int k,s;
    cin>>k>>s;
    for(int i=0;i<=k;i++){
        if(i>s) break;
        for(int j=0;j<=k;j++){
            if(i+j>s) break;
            if(s-i-j<=k) count++;
        }
    }
    cout<<count<<endl;
    
    return 0;
    
}

Measured memory_bytes: 256
a, b, c = input().split()
a = int(a)
b = int(b)
c = int(c)
cnt = 0
while True:
    if a % 2 or b % 2 or c % 2:
        break;
    if a == b and b == c:
        cnt = -1;
        break
    ta = b / 2 + c / 2
    tb = a / 2 + c / 2
    tc = a / 2 + b / 2
    a = ta
    b = tb
    c = tc
    cnt += 1
print (cnt)

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

signed main() {
	int s; cin >> s;
	set<int>S;
	vector<int>v;
	v.push_back(s);
	S.insert(s);
	while (1) {
		if (s & 1)s = 3 * s + 1;
		else s /= 2;
		if (S.find(s) == S.end()) {
			S.insert(s); v.push_back(s);
		}
		else {
			cout << v.size()+1 << endl; return 0;
		}
	}
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int n,m,s;
int main()
{
	cin>>n>>m;
    s=1900*pow(2,m)*m+100*pow(2,m)*(n-m);
    cout<<s<<endl;
	return 0;
	}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
typedef long long LL;
int N,M;
vector<int>G[100001];
bool used[100001];
void dfs(int x){
	used[x]=true;
	REP(i,G[x].size()){
		if(used[G[x][i]]==false){
			dfs(G[x][i]);
		}
	}
}
int main(){
	cin>>N>>M;
	REP(i,M){
		int X,Y,Z;
		cin>>X>>Y>>Z;
		X--;
		Y--;
		G[X].push_back(Y);
		G[Y].push_back(X);
	}
	REP(i,N){
		used[i]=false;
	}
	int ans=0;
	REP(i,N){
		if(used[i]==false){
			ans++;
			dfs(i);
		}
	}
	cout<<ans<<endl;
}

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

int main(){
	int n,i;
	cin>>n;
	
	for(i=1;i<=3;i++){
		if(n%10==7){
			cout<<"Yes";
			return 0;
		}else{
			n/=10;
		}
	}
	
	cout<<"No";
	return 0;
}

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

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

	while (true) {
		C -= B;
		if (C <= 0) {
			cout << "Yes" << endl;
			break;
		}
		A -= D;
		if (A <= 0) {
			cout << "No" << endl;
			break;
		}
	}
	return 0;
}

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

#ifndef LOCAL_
#define fprintf if( false ) fprintf
#endif // LOCAL_
#define dump() fprintf(stderr, "#%s.%d\n", __func__, __LINE__);
#define dumpl(x1) fprintf(stderr, "#%s.%d (%s) = (%ld)\n", __func__, __LINE__, #x1, x1);
#define dumpll(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%ld, %ld)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define dumplll(x1, x2, x3) fprintf(stderr, "#%s.%d (%s, %s, %s) = (%ld, %ld, %ld)\n", __func__, __LINE__, #x1, #x2, #x3, x1, x2, x3);
#define dumpd(x1) fprintf(stderr, "#%s.%d (%s) = (%lf)\n", __func__, __LINE__, #x1, x1);
#define dumpdd(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%lf, %lf)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define loop for(;;)
typedef std::vector<long> LI;
typedef std::queue<long> QI;
#define rep(i,n) for(long i = 0; i < (long)n; ++i)
const double pi = M_PI;
const long mod = 1000000007;

template<typename T> void scan1(T& x) { fprintf(stderr, "unknown type\n"); }
template<> void scan1(long& x) { if( scanf("%ld", &x) < 0 ) exit(0); }
template<> void scan1(std::string& x) { if( not ( std::cin >> x ) ) exit(0); }
void scan() {}
template<typename Head, typename... Tail>
void scan(Head& x, Tail&... xs) {
  scan1(x); scan(xs...);
}

struct Solver {
   Solver() { fprintf(stderr, "--------Solver begin--------\n"); }
   ~Solver() { fprintf(stderr, "--------Solver end--------\n"); }
   void solve() {
      long n, m; scan(n, m);
      long res = (n - 1) * (m - 1);
      printf("%ld\n", res);
   }
};

int main() {
   loop std::unique_ptr<Solver>(new Solver())->solve();
}



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

map<pair<long long, long long>, long long> mp;
long long hoge(long long h, long long n) {
    if (h == 1) return n;
    if (mp.count({h, n})) return mp[{h, n}];
    return mp[{h, n}] = 1 + 2 * hoge(h / 2, n);
}

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

    long long h;
    cin >> h;

    cout << hoge(h, 1) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define itn int
#define nibu(K,x) binary_search(K.begin(),K.end(),x)
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) x.begin(),x.end()
#define sz(x) x.size()
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define out(x) cout<<x<<endl
#define put(x) out(x)
#define in(x) cin>>x
#define maxx(a,b,c) max(a,max(b,c))
#define minn(a,b,c) min(a,min(b,c))
using ll = long long;
using vl = vector<ll>;
using vs = vector<string>;
const double pi = 3.14159265358979;
const ll mod = 1000000007;

int main() {
int N;
  in(N);
  vl A(N);
  rep(i,N) in(A[i]);
  sort(all(A));
  int a = A[0];
  int b = A[N-1];
  map <int,int> k;
  rep(i,N){
    k[A[i]]++;
  }
  int ans =0;
  for(int i=a;i<=b;i++){
    ans = max(ans,k[i-1]+k[i]+k[i+1]);
  }
  out(ans);
}

Measured memory_bytes: 5760
#include<iostream>
#define MAX 100000
#define SENTINEL 2000000000

struct Card{char suit;int value; };
struct Card L[MAX/2+2],R[MAX/2+2];

void merge(struct Card A[],int left,int right,int mid){
    for(int i=0;i<mid-left;i++) L[i] = A[left+i];
    for(int i=0;i<right-mid;i++) R[i] = A[mid+i];
    L[mid-left].value=SENTINEL;R[right-mid].value=SENTINEL;
    int i=0,j=0;
    for(int k=left;k<right;k++){
        if(L[i].value <= R[j].value){
            A[k]=L[i++];
        }else{
            A[k]=R[j++];
        }
    }
}

void mergeSort(struct Card A[],int left,int right){
    if(left+1<right){
        int mid=(left+right)/2;
        mergeSort(A,left,mid);
        mergeSort(A,mid,right);
        merge(A,left,right,mid);
    }
}

int partition(struct Card A[],int p,int r){
    int a=p;
    struct Card t;
    int x=A[r].value;
    for(int i=p;i<=r;i++){
        if(A[i].value<=x){
            t=A[a];
            A[a] = A[i];
            A[i]=t;
            a++;
        }
    }
    if(a==0)printf("AAA");
    return a-1;
}

void quickSort(struct Card A[],int p,int r){
    if(p<r){
        int q = partition(A,p,r);
        quickSort(A,p,q-1);
        quickSort(A,q+1,r);
    }
}

int main(){
    int n,v;
    int stable=1;
    struct Card A[MAX],B[MAX];
    char S[10];
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%s %d",S,&v);
        A[i].suit = S[0];
        B[i].suit = S[0];
        A[i].value = v;
        B[i].value = v;
    }
    mergeSort(A,0,n);
    quickSort(B,0,n-1);

    for(int i=0;i<n;i++){
        if(A[i].suit != B[i].suit){
            stable=0;
            break;
        }
    }

    printf((stable?"Stable\n":"Not stable\n"));
    for(int i=0;i<n;i++){
        printf("%c %d\n",B[i].suit,B[i].value);
    }
    return 0;
}



Measured memory_bytes: 5532
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cassert>
#include <complex>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <sstream>
#include <ctime>
#include <cctype>
#include <set>
#include <map>
#include <queue>
#include <bitset>
#include <deque>
#include <stack>
#include <memory.h>
using namespace std;
#define ll long long 
int n;
vector<int> g[200005];
int d1[100005],d2[100005];
inline void dfs(int r,int f,int d,int dist[])
{
    dist[r]=d;
    for(int x=0;x<g[r].size();x++){
        if(g[r][x]!=f){
        	dfs(g[r][x],r,d+1,dist);
		}
    }
}
int main()
{
    cin>>n;
    for(int i=0;i<n-1;i++)
    {
    	int a,b;
        cin>>a>>b;
        a--,b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    dfs(0,-1,0,d1);
    dfs(n-1,-1,0,d2);
    int ans=0;
    for(int i=0;i<n;i++){
        if(d1[i]<=d2[i]){
            ans++;
		}
        else{
        	ans--;
        }
    }
    if(ans>0){
    	cout <<"Fennec"<< endl;
	}
    else{
    	cout<<"Snuke"<<endl;
	}
    return 0;
}

Measured memory_bytes: 12288
N = int(input())
A = [int(i) for i in input().split()]

m = [0] * (max(A) + 1)
for a in A:
    m[a] += 1
    
ans = 0
for i in range(len(m)):
    ans = max(ans, sum(m[i : i + 3]))
    
print(ans)

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

int main(){
  int n,ans=0,a[100000];cin>>n;
  REP(i,n) cin>>a[i];
  sort(a,a+n);
  
  auto Iter_a=lower_bound(a,a+n,a[n-1]/2);
  if(n==2) ans=a[0];
  else{
    int dif=abs(*Iter_a-a[n-1]/2);ans=*Iter_a;
    if(abs(*(Iter_a-1)-a[n-1]/2)<dif) ans=*(Iter_a-1);
  }
  
  cout<<a[n-1]<<" "<<ans<<endl;
}



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

# build stairs

if __name__ == "__main__":
    n = int(input())
    h = list(map(int, input().split()))
    max = 0
    for i in range(0, len(h)):
        if h[i] < max-1:
            print("No")
            exit(0)
        if h[i] > max:
            max = h[i]
    print("Yes")



Measured memory_bytes: 14252
'use strict'

const main = (input) => {
    const S = input.split('\n')[0]
    const chars = S.split('')

    const first = chars.shift()
    if (first !== 'A') {
        console.log('WA')
        return
    }
    
    const arr = chars.slice(1, -1)
    if(arr.filter(v => v === 'C').length !== 1) {
        console.log('WA')
        return
    }
    let count = 0
    chars.forEach((v) => {
        if(v !== v.toLowerCase()){
            count++
        }
    })
    if(count === 1){
        console.log('AC')
    }else{
        console.log('WA')
    }
}

main(require('fs').readFileSync('/dev/stdin', 'utf-8'))

Measured memory_bytes: 7372
#include <bits/stdc++.h>
#define r(i,n) for(int i = 0; i<n; i++)
using namespace std;
 
int main() {
  int n,a,b;
  cin >> n;
  if(n==1) cout << "Hello World" << endl;
  else {
    cin >> a>> b;
    cout << a+b<< endl;
  }
}

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

int main( int argc, char *argv[] )
{
int A;
int B;
int C;

	cin >> A;
	cin >> B;
	cin >> C;
	if( C >= A && C <= B )
		cout << "Yes" << endl;
	else
		cout << "No" << endl;

	return 0;
}






Measured memory_bytes: 256
#include <bits/stdc++.h>
      
#define FOR(i,a,b) for( ll i = (a); i < (ll)(b); i++ )
#define REP(i,n) FOR(i,0,n)
#define YYS(x,arr) for(auto& x:arr)
#define ALL(x) (x).begin(),(x).end()
#define SORT(x) sort( (x).begin(),(x).end() )
#define REVERSE(x) reverse( (x).begin(),(x).end() )
#define UNIQUE(x) (x).erase( unique( ALL( (x) ) ) , (x).end() )
#define PW(x) (1LL<<(x))
#define SZ(x) ((ll)(x).size())
#define SHOW(x) cout << #x << " = " << x << endl
     
#define pb emplace_back
#define fi first
#define se second
     
using namespace std;

typedef long double ld;
typedef long long int ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<ld> vd;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<vpl> gr;
typedef vector<vl> ml;
typedef vector<vd> md;
typedef vector<vi> mi;
     
const ll INF = (ll)1e9 + 10;
const ll INFLL = (ll)1e18 + 10;
const ld EPS = 1e-12;
const ll MOD = 1e9+7;
     
template<class T> T &chmin( T &a , const T &b ){ return a = min(a,b); }
template<class T> T &chmax( T &a , const T &b ){ return a = max(a,b); }
template<class T> inline T sq( T a ){ return a * a; }

ll in(){ ll x; scanf( "%lld" , &x ); return x; }
char yuyushiki[1000010]; string stin(){ scanf( "%s" , yuyushiki ); return yuyushiki; }

// head

ll n, x;

ll ans;

ll f( ll a , ll b ){
  if( a % b == 0 ){
    ans += ( ( a / b ) * 2 - 1 ) * b;
  } else {
    ans += ( a / b ) * 2 * b;
    f( b , a % b );
  }
}

int main(){

  n = in();
  x = in();

  ans = n;
  f( x , n-x );

  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ios ios_base::sync_with_stdio(0);cin.tie(0)
#define scn(n) scanf("%d",&n)
#define lscn(n) scanf("%lld",&n)
typedef long long ll;
#define pri(n) printf("%d\n",n)
#define lpri(n) printf("%lld\n",n);
#define rep(i,st,ed) for(int i=st;i<ed;i++)
#define var(n) int n; scn(n)
#define F first
#define S second 
#define pb push_back
const int N=1e5+5;
// const ll M = 998244353;
const ll M=1e9+7;
const ll inf=1e18;

int dp[N]; 

int main()
{
	var(n);var(w);
	for(int i=0;i<N;i++)
		dp[i] = M;
	rep(i,0,n)
	{
		var(wt);
		var(val);
		for(int j=N-1;j>=0;j--)
		{			
			if(dp[j]!=M)
				dp[j+val] = min(dp[j+val],dp[j]+wt);
		}
		dp[val] = min(dp[val],wt);
		
	}
	int ans = 0;
	for(int i=N-1;i>=0;i--)
	{
		int wt = dp[i];
		if(wt<=w)
		{
			ans = i;
			break;
		}
	}
	pri(ans);
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int N,K;
  cin>>N>>K;
  int H[N];
  for(int i=0;i<N;i++)
    cin>>H[i];
  sort(H,H+N);
  long long int sum=0;
  for(int i=0;i<(N-K);i++)
    sum+=H[i];
  cout<<sum;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define f first
#define s second
#define fore(i,a,b) for(int i = (a), ThxMK = (b); i < ThxMK; ++i)
#define pb push_back
#define all(s) begin(s), end(s)
#define _ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define sz(s) int(s.size())
#define ENDL '\n'
using namespace std;
typedef long double ld;
typedef long long lli;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<lli> vl;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
#define deb(x) cout << #x": " << (x) << endl;

const int N = 1e3;
const lli INF = 1e18;
const lli MOD = 1e9+7;

vi primes(1,2);
vector<vector<ld>>nk;
void sieve(){
	vi m(N+1,0);
	for(int i = 4; i<N; i+=2)m[i]=1;
	for(int i = 3; i*i<=N; i+=2)if(!m[i])for(int j = i*i; j<N; j+=i)m[j]=1;
	for(int i = 3; i<N; i+=2)if(!m[i])primes.pb(i);
}

void pascal(){
	nk =vector<vector<ld>>(N,vector<ld>(N,0.0));
	fore(i,0,N)nk[i][0]=nk[i][i]=1.0;
	fore(i,1,N)fore(j,1,i)nk[i][j]=nk[i-1][j-1]+nk[i-1][j];
}

lli gcd(lli a, lli b){return (b?gcd(b,a%b):a);}

lli lcm(lli a, lli b){
	if(a<b)swap(a,b);
	lli c = gcd(a,b);
	a/=c;
	return a*b;
}

int popcount(lli x) { return __builtin_popcountll(x); }

lli poww(lli a, lli b){
	lli res =1;
	while(b){
		if(b&1) res = res * a;
		a = a*a;
		b/=2;
	}
	return res;
}

lli powm(lli a, lli b){
	lli res =1;
	while(b){
		if(b&1) res = (res * a)%MOD;
		a = (a*a)%MOD;
		b/=2;
	}
	return res;
}

bool isPrime(lli x){
	if(x==1)return 0;
	for(auto i:primes){
		if(i*i>x)return 1;
		if(x%i==0)return 0;
	}
	return 1;
}


lli SUM(lli a, lli b, lli mod=MOD){
	return (a+b+mod)%mod;
}

lli PROD(lli a, lli b, lli mod=MOD){
	a%=mod; b%=mod;
	return a*b % mod;
}

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

vvi graph(int n, int m){
	vvi v(n+1);
	fore(i,0,m){
		int a,b; cin>>a>>b;
		v[a].pb(b);
		v[b].pb(a);
	}
	return v;
}

// ---- コーディングはここから！ ('-')7

void solve(){
	int n,mod; cin>>n>>mod;
	vvi v=graph(n,n-1);
	vl dp(n+1,1);
	auto f=[&](auto f, int u, int pr)->void{
		for(auto i:v[u])if(i!=pr)f(f,i,u);
		for(auto i:v[u])if(i!=pr)dp[u] = PROD(dp[u],dp[i]+1,mod);
	};
	f(f,1,1);
	auto g=[&](auto g, int u, int pr, lli up)->void{
		vl pre(1,1),post(1,1);
		for(auto i:v[u])if(i!=pr)pre.pb(PROD(pre.back(),dp[i]+1,mod));
		for(int j = sz(v[u])-1;j>=0; j--){
			int i = v[u][j];
			if(i!=pr)post.pb(PROD(post.back(),dp[i]+1,mod));
		}
		reverse(all(post));
		dp[u]= PROD(dp[u],up,mod);
		int j = 0;
		for(auto i:v[u])
			if(i!=pr){
				g(g,i,u,SUM(PROD(PROD(pre[j],post[j+1],mod),up,mod),1,mod));
				j++;
		}
	};
	g(g,1,1,1);
	fore(i,1,n+1)cout<<dp[i]<<ENDL;

}

int main(){_
	//int t; cin>>t; while(t--)
	solve();
}


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

using namespace std;

int main()
{
    string s;

    cin >> s;

    cout << 'A';

    if (s[1] == 'R')
        cout << 'B';
    else
        cout << 'R';
    
    cout << 'C';

    cout << '\n';

    return 0;
}

Measured memory_bytes: 3584
#include<stdio.h>

int main(){

   int a=0,b=0,c=0;

   scanf("%d %d %d",&a, &b, &c);

   if( (a < b) && (b < c) ){
      printf("Yes\n");
   }
   else{
      printf("No\n");
   }

   return 0;

}

Measured memory_bytes: 0
function main(input) {
  const args = input.split(' ').map(n => parseInt(n, 10));
  let go = 0;
  let nana = 0;
  
  for (let i = 0; i < args.length; i++) {
    if (args[i] === 5) { go++; };
    if (args[i] === 7) { nana++; };
  }
  
  if (go === 2 && nana === 1) {
    console.log('YES');
  } else {
    console.log('NO');
  }
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 29608