akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>

int main(int argc, const char * argv[]) {
    
    int dice[24][6] = {{2 ,6 ,3 ,4 ,1 ,5},
        {6 ,5 ,3 ,4 ,2 ,1},
        {5 ,1 ,3 ,4 ,6 ,2},
        {4 ,1 ,5 ,2 ,6 ,3},
        {6 ,4 ,5 ,2 ,3 ,1},
        {3 ,6 ,5 ,2 ,1 ,4},
        {1 ,3 ,5 ,2 ,4 ,6},
        {5 ,3 ,6 ,1 ,4 ,2},
        {3 ,2 ,6 ,1 ,5 ,4},
        {2 ,4 ,6 ,1 ,3 ,5},
        {4 ,5 ,6 ,1 ,2 ,3},
        {1 ,5 ,4 ,3 ,2 ,6},
        {2 ,1 ,4 ,3 ,6 ,5},
        {6 ,2 ,4 ,3 ,5 ,1},
        {5 ,6 ,4 ,3 ,1 ,2},
        {4 ,6 ,2 ,5 ,1 ,3},
        {6 ,3 ,2 ,5 ,4 ,1},
        {3 ,1 ,2 ,5 ,6 ,4},
        {1 ,4 ,2 ,5 ,3 ,6},
        {5 ,4 ,1 ,6 ,3 ,2},
        {3 ,5 ,1 ,6 ,2 ,4},
        {2 ,3 ,1 ,6 ,4 ,5},
        {4 ,2 ,1 ,6 ,5 ,3},
        {1 ,2 ,3 ,4 ,5 ,6}};
    
    int num2[6],i,j,count=0,num[6]={0};
    
    for (i = 0; i < 6; i++) {
        scanf("%d",&num[i]);
    }
    
    for (i = 0 ; i < 6; i++) {
        scanf("%d",&num2[i]);
    }
    
    for (i = 0; i < 24; i++) {
        
        for (j = 0; j < 6; j++) {
            if(num[j] != num2[dice[i][j]-1]){
                break;
            }
            count++;
        }
        
        if (count == 6) {
            printf("Yes\n");
            return 0;
        }
        
        count = 0;
    }
    
    printf("No\n");
    
    
    return 0;
}


Measured memory_bytes: 2112
a,b =(input().split())
a = int(a)
b = int(b)
soma = a + b
if a % 3 == 0:
    print ('Possible')
elif b % 3 == 0:
    print ('Possible')
elif soma % 3 == 0:
    print ('Possible')
else:
    print ('Impossible')

Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
int mv=1e5+5;
int main()
{
    int n,W; cin>>n>>W;
    int w,v;
    vector<long long int> V(mv+1 ,INT_MAX);
    V[0]=0;
	for(int i=0;i<n;i++)
	{
		 cin>>w>>v;
		 for(int j=mv;j>=v;j--)
		 if(V[j-v]!=INT_MAX)
		 V[j]=min(V[j],V[j-v]+w);
		 
	}
	int j;
	for(j= mv;j>=0;j--)
	if(V[j]<=W)
	break;
	cout<<j;

}

Measured memory_bytes: 1024
N = int(input())
memo = {}
for i in range(N):
    s = input()
    if s in memo:
        memo[s] += 1
    else:
        memo[s] = 1

M = int(input())
for i in range(M):
    t = input()
    if t in memo:
        memo[t] -= 1
    else:
        memo[t] = -1

score = sorted(memo.items(), key=lambda x:-x[1])
print(max(score[0][1],0))

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

int main(){
    int k, n;
    cin >> k >> n;
    vector<int> a(n), b(n);
    rep(i, n) cin >> a[i];
    rep(i, n) {
        if (i==n-1) {
            b[i] = k + a[0] - a[i];
        } else {
            b[i] = a[i+1] - a[i];
        }
    }
    sort(all(b), greater<>());
    cout << k - b[0] << endl;
    return 0;
}

Measured memory_bytes: 1792
#include<stdio.h> 

#define NMAX 10000
#define QMAX 500

int main(){
  int i,j,k,l,n,q,count=0,S[NMAX],T[QMAX];
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&S[i]);
  }
  scanf("%d",&q);
  for(j=0;j<q;j++){
    scanf("%d",&T[j]);
  }
  for(k=0;k<j;k++){
    for(l=0;l<i;l++){
      S[i]=T[k];
      if(S[l]==T[k]){
	count++;
	break;
      }
    }
  }
  printf("%d\n",count);
  return 0;
}
  



Measured memory_bytes: 2108
#pragma region header
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define rev(i, n) for(int i = (int)(n - 1); i >= 0; i--)
#define rev1(i, n) for(int i = (int)(n); i > 0; i--)
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define resort(v) sort((v).rbegin(), (v).rend())
#define vi vector<int>
#define vvi vector<vector<int>>
#define vc vector<char>
#define vvc vector<vector<char>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
using ll = long long;
using P = pair<int, int>;
/* ----------------よく使う数字や配列----------------- */
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};
constexpr ll mod = 1e9+7;
constexpr int inf = INT32_MAX/2;
constexpr ll INF = LLONG_MAX/2;
constexpr long double eps = DBL_EPSILON;
constexpr long double pi = 3.141592653589793238462643383279;
/* ----------------------end----------------------- */

/* --------------------テンプレート------------------ */
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
/* ----------------------end----------------------- */

/* --------------------ライブラリ-------------------- */
ll fact(int i) {       //階乗
    if (i == 0) return 1;
    return (fact(i - 1)) * i % mod;
}
ll gcd(ll a, ll b) {        //最大公約数
    if(b == 0) return a;
    return gcd(b, a % b); 
}
ll lcm(ll a, ll b) {      //最小公倍数
    return a * b / gcd(a, b);
}
int keta(ll n) {        //桁数を求める
    if(n == 0) return 1;
    int count = 0;
    while(n != 0) {
        n /= 10;
        count++;
    }
    return count;
}
ll ketasum(ll n) {    //各桁の和
    ll sum = 0;
    while(n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
/* ----------------------end----------------------- */
#pragma endregion
int ans[55][55];
int main() {
    int n,x;cin >> n >> x;
    vi a(n);
    int GCD;
    rep(i, n) {
        cin >> a[i];
        a[i]=abs(a[i]-x);
        if(i==1)GCD=gcd(a[1],a[0]);
        if(i>1) GCD = gcd(GCD,a[i]);
    }
    if(n==1)cout << a[0] << endl;
    else cout << GCD << endl;
    return 0;
}

Measured memory_bytes: 3768
n, l = gets.split(" ").map(&:to_i)
taste = []
for i in 1..n
  t = l + i - 1
  taste << t
end
full_apple_pie = taste.inject(:+)
apple_pies = taste.combination(n-1).to_a
abses = []
apple_pies.each_with_index do |pie, i|
  abs = (full_apple_pie - pie.inject(:+)).abs
  abses << abs
end
index = abses.index(abses.min)
puts apple_pies[index].inject(:+)

Measured memory_bytes: 1916
#include<bits/stdc++.h>
#define INF 2147483647
#define inf 1000000007
#define SYOU(x) setprecision(x+1)
#define abs(x,y) (max(x,y)-min(x,y))
#define lol long long
#define mp make_pair
#define fi first
#define se second
using namespace std;
lol a,b;
lol i[100];
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  lol c=1,d=1,e=0,f=0,g=0,h=0;
  cin >>a;
  for(int n=0;n<a;n++) cin >>i[n];
  for(int n=0;n<a-1;n++){
      for(int m=n+1;m<a;m++){
	  e+=i[n]*i[m];
      }
  }
  cout <<e<<'\n';
  return (0);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
string st;
int main(void)
{
	cin>>st;
	int ans=0;
	for(int i=0;i<st.size()-1;i++)
	  if(st[i]!=st[i+1])ans++;
	cout<<ans;
	return 0;
}

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

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define inv(n, a) for(int i = 0; i < n; i++) cin >> a[i]
#define MOD 1000000007
#define INF 1e7
#define LINF 1e15
typedef long long ll;
typedef long double ld;
using Graph = vector<vector<int>>;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
// 'a' = 97 'z' = 122 => 'a' = 0 'z' = 25

int main() {
    int n; cin >> n;
    int a;   
    map<ll, ll> m;
    ll ans = 0;
    for(int i = 1; i <= n; i++){
        cin >> a;
        ll l = i - a;
        ll r = i + a;
        ans += m[l];
        m[r]++;
    }
    cout << ans << endl;
    // map<ll, ll> am;
    // ll hi;
    // ll ans=0;
    // for(ll i=1;i<=n;i++){
    //     cin>>hi;
    //     ans+=am[i-hi];
    //     am[hi+i]+=1;
    // }
    // printf("%lli\n",ans);
    // return 0;
}


Measured memory_bytes: 26320
import numpy as np

def unique(w):
    d = {}
    for c in w:
        if c in d.keys():
            d[c] += 1
        else:
            d.setdefault(c, 1)
    return list(d.keys()), list(d.values())

def number_of_divisor(n):
	import numpy as np
	result = []
	while n > 1:
		div = divisor(n)
		result.append(div)
		n //= div
	index, result = unique(result)
	result = [x + 1 for x in result]
	return np.prod(result)

def divisor(n):
    if n % 2 == 0:
        return 2
    elif n % 3 == 0:
        return 3
    maxitr = intSqrt(n)
    i = 1
    while True:
        i += 4
        if i > maxitr:
            return n
        elif n % i == 0:
            return i
        i += 2
        if i > maxitr:
            return n
        elif n % i == 0:
            return i

def intSqrt(n):
    x = 1
    while True:
        x2 = (x + n // x) // 2
        if x2 ** 2 <= n and abs(x - x2) <= 1:
            break
        x = x2
    return x2

def ABC106B(n):
    count = 0
    for i in range(3, n+1, 2):
        if number_of_divisor(i) == 8:
            count += 1
    print(count)

n = int(input())
ABC106B(n)


Measured memory_bytes: 12480
import sys
input = sys.stdin.readline


class BIT1():
    """
    Binary Indexed Tree (1-indexed)
    """
    def __init__(self, n, data=None):
        self.n = n
        self.bit = [0] * (self.n + 1)
        self.data = [0] * (self.n + 1)
        if data:
            self.build(data)

    def build(self, data):
        for i in range(self.n):
            self.bit[i + 1] = self.data[i + 1] = data[i]
        for i in range(1, self.n):
            j = i + (i & (-i))
            if j <= self.n:
                self.bit[j] += self.bit[i]

    def add(self, idx, x):
        # add x to idx-th element
        # idx: 1-indexed
        self.data[idx] += x
        while idx <= self.n:
            self.bit[idx] += x
            idx += (idx & (-idx))

    def sum(self, idx):
        # get sum of [1, idx]
        # idx: 1-indexed
        s = 0
        while idx:
            s += self.bit[idx]
            idx -= (idx & (-idx))
        return s


n, q = map(int, input().split())
a = list(map(int, input().split()))
bit = BIT1(n, a)
for _ in range(q):
    t, p, q = map(int, input().split())
    if t == 0:
        bit.add(p + 1, q)
    else:
        print(bit.sum(q) - bit.sum(p))


Measured memory_bytes: 131828
/*
    問題をよく読もう！
    論理的に考えよう！
    サンプルを確認しよう!
    絶対に諦めるな！
    工夫をしろ！
    配列は少し多めにとっておく

    Twitterは終わるまでログアウト！
    （間違えて解法をツイートしてはいけないから）

*/
//include
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
#include<stdio.h>
#include<cstring>
//namespace
using namespace std;
//繰り返し
#define REP(i, m, n) for(int i=(int)m; i<(int)n; ++i)
#define rep(i, n) REP(i, 0, n)
//イテレータ
#define all_range(C) begin(C), end(C)
//簡略化
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
typedef pair<string,int> pst;

const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
//最大最小
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) {if(a>b) a=b;}
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) {if(a<b) a=b;}

//関数

//最大公約数を求める
ll my_gcd(ll x, ll y) {
  ll r;

  while(y!=0) {
    r = x%y;
    x = y;
    y = r;
  }

  return x;
}

//最小公約数を求める
ll my_lcm(ll x, ll y) {

  return (x*y)/my_gcd(x,y);
}

//xのy乗を求める ※参考：10^18乗まで
ll my_pow(ll x, ll y) {
  ll sum = 1;

  while(y>0) {
    sum *= x;
  }

  return sum;
}

/*考えを書くスペース

*/
//main.cpp----------------------------
#define max_n 100

void solve();

string s;

int main() {
  cin >> s;

  solve();

  return 0;
}

void solve() {

  ll length = (int)(s.length());
  for(int i=0; i<length-1; ++i) {
    if(s[i]=='S'&&s[i+1]=='T') {
      s.erase(s.begin()+i);
      s.erase(s.begin()+i);
      i = i-2;
      length = (int)(s.length());
    }
  }

  cout << (int)(s.length()) << endl;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define vi vector<int>
#define vvi vector<vector<int>>
#define pii pair<int,int>
#define vs vector<string>
#define ll long long
#define ull unsigned long long
#define fastio ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
#define ld long double
#define mod 1000000007LL
using namespace std;
using namespace __gnu_pbds;

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

ll binexp(ull a, ull b)
{
    ull res = 1;
    while(b)
    {
        if(b&1) res = (res%mod * a)%mod;
        a *= a;
        a%=mod;
        b>>=(ll)(1);
    }
    return res%mod;
}

ll inverse(ull a)
{
    return binexp(a, mod-2)%mod;
}

ll ncr(ll n, ll r)
{
    if(r>n) return 0;
    if(n==r || r==0)
    {
        return 1;
    }

    if(r>n-r) r = n-r;

    ull num = 1, den = 1;
    for(ll i = 0; i<r; ++i)
    {
        num = (num*(n-i))%mod;
        den = (den*(i+1))%mod;
    }

    return ((num%mod) * (inverse(den)))%mod;
}

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

    ll res = (binexp(2, n) - (ncr(n, a) + ncr(n, b) + 1)%mod + mod)%mod;

    cout<<res%mod;
}


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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// グラフの辺表現
using Edge = map<pair<int,int>,int>;

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

// 最大公約数
ll gcd(ll a,ll b){
   if (a%b == 0) return(b);
   else return(gcd(b, a%b));
}

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

int main()
{
    cout << fixed << setprecision(15);
    double A, B, H, M;
    cin >> A >> B >> H >> M;

    double s1 = 30*H+M/2;
    double s2 = 6*M;

    // cout << s1 << " " << s2 << endl;
    double temp = A*A + B*B - 2*A*B*cos((M_PI / 180) * abs(s1-s2));
    // cout << temp << endl;
    cout << sqrt(temp) << endl;
    return 0;
}

Measured memory_bytes: 4196
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
	while (true) {
		bool fin = false;
		vector<int> x(3), y(3);
		for (int i = 0; i < 3; ++i) {
			cin >> x[i] >> y[i];
			if (i == 0 && x[i] == 0 && y[i] == 0) {
				fin = true;
				break;
			}
		}
		if (fin) break;
		int xc, yc, r;
		cin >> xc >> yc >> r;
		vector<int> crs(3);
		for (int i = 0; i < 3; ++i) {
			int vx = xc - x[i], vy = yc - y[i];
			int wx = x[(i + 1) % 3] - x[i], wy = y[(i + 1) % 3] - y[i];
			crs[i] = vx * wy - wx * vy;
		}
		bool inner = true;
		for (int i = 0; i < 3; ++i) {
			if (1LL * crs[i] * crs[(i + 1) % 3] < 0) {
				inner = false;
			}
		}
		int contain = 0;
		for (int i = 0; i < 3; ++i) {
			int dx = x[i] - xc, dy = y[i] - yc;
			if (dx * dx + dy * dy <= r * r) {
				++contain;
			}
		}
		int intersect = 0, border = 0;
		for (int i = 0; i < 3; ++i) {
			int dx = x[(i + 1) % 3] - x[i], dy = y[(i + 1) % 3] - y[i];
			int px = x[i] - xc, py = y[i] - yc;
			int qx = x[(i + 1) % 3] - xc, qy = y[(i + 1) % 3] - yc;
			if (px * px + py * py <= r * r || qx * qx + qy * qy <= r * r) {
				++intersect;
			}
			else {
				int pdot = dx * px + dy * py;
				int qdot = dx * qx + dy * qy;
				if (pdot <= 0 && qdot >= 0) {
					long long ca = 1LL * crs[i] * crs[i];
					long long cb = 1LL * (dx * dx + dy * dy) * (r * r);
					if (ca <= cb) {
						++intersect;
					}
					if (ca == cb) ++border;
				}
			}
		}
		if (inner) {
			if (contain == 3) {
				cout << "b" << endl;
			}
			else if (intersect - border == 0) {
				cout << "a" << endl;
			}
			else {
				cout << "c" << endl;
			}
		}
		else {
			if (contain == 3) {
				cout << "b" << endl;
			}
			else if (intersect == 0) {
				cout << "d" << endl;
			}
			else {
				cout << "c" << endl;
			}
		}
	}
	return 0;
}


Measured memory_bytes: 3012
N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = input()

score = {"r":R, "s":S, "p":P}

TT = ""
for c in T:
    if c == "r":
        TT+="p"
    elif c == "s":
        TT+="r"
    else:
        TT+="s"

T = T.replace('r', 's')
flag = [False] * N
ans = 0
for idx, c in enumerate(TT):
    if idx - K < 0:
        ans += score[c]
        flag[idx] = True
    else:
        if c == TT[idx-K]:
            if flag[idx-K] == False:
                ans += score[c]
                flag[idx] = True
            else:
                pass
        else:
            ans += score[c]
            flag[idx] = True
print(ans)

Measured memory_bytes: 4212
import math
q = int(input())
ab = [list(map(int, input().split())) for _ in range(q)]

for a, b in ab:
    a, b = min(a, b), max(a, b)
    p = a*b
    n = math.ceil((-1+(1+4*p)**(1/2))/2)
    if a <= n:
        lower1 = a-1

    if b <= n:
        lower2 = b-1
    else:
        m = p//n if p%n > 0 else p//n-1
        n_lim = p//(a+1) if p%(a+1) > 0 else p//(a+1)-1
        if n > n_lim:
            lower2 = n_lim
        else:
            lower2 = n + m - (a+1)
            
    print(lower1+lower2)


Measured memory_bytes: 3316
#include <cstdio>
#include <algorithm>
#include <bitset>
static const int MAXN = 403;
static const int MAXM = 100003;

int n, m;
int x[MAXM], y[MAXM];
std::bitset<MAXN> s[MAXN];

int main()
{
    scanf("%d%d", &n, &m);
    for (int i = 0; i < m; ++i) scanf("%d%d", &x[i], &y[i]), --x[i], --y[i];

    for (int i = 0; i < n; ++i) {
        s[i].set(i);
        for (int j = m - 1; j >= 0; --j)
            switch ((s[i].test(x[j]) << 1) | (s[i].test(y[j]))) {
                case 0:
                    break;
                case 1:
                    s[i].set(x[j]);
                    break;
                case 2:
                    s[i].set(y[j]);
                    break;
                case 3:
                    s[i].reset();
                    break;
            }
    }

    int ans = 0;
    for (int i = 0; i < n - 1; ++i) if (s[i].any())
        for (int j = i + 1; j < n; ++j) if (s[j].any()) {
            if ((s[i] & s[j]).none()) ++ans;
        }
    printf("%d\n", ans);

    return 0;
}


Measured memory_bytes: 1152
#include <bits/stdc++.h>
#define ll long long 
#define pb push_back
using namespace std;

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
	int n, x, t;
	cin >> n >> x >> t;
	int res = ceil((double)n/x);
	cout << res*t;
	return 0;
}


Measured memory_bytes: 3596
#include<stdio.h>
#include<string.h>
#include<stdlib.h>

#include <math.h>



int main(){

	long long int i, N, *A, *B, *C, enemy, count=0;

	

	scanf("%lld", &N);


	A = (long long int*)malloc((N+1) * sizeof(long long int));

	B = (long long int*)malloc(N * sizeof(long long int));


	C = (long long int*)malloc(N * sizeof(long long int));

	for (i = 0; i < N+1; i++){
		scanf("%lld", &A[i]);
	}
	for (i = 0; i < N; i++){
		scanf("%lld", &B[i]);
	}


	for (i = 0; i < N; i++){
		enemy = A[i] + A[i + 1];
		if (enemy <= B[i]){
			count += enemy;
			A[i + 1] = 0;
		}
		else{
			count += B[i];
			if (A[i] < B[i]){
				A[i + 1] -= (B[i] - A[i]);
			}
		}
	}
	printf("%lld\n", count);

  return 0;
}


Measured memory_bytes: 1792
/*#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization("unroll-loops")
*/

#include <bits/stdc++.h>
using namespace std;
#define pi acos(-1)
#define IOS ios_base::sync_with_stdio(0); cin.tie(); cout.tie();
#define fi first
#define se second
#define pf push_front
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define debug(x) cerr<<#x<<": "<<(x)<<'\n'
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
const ll mod = 1e9+7;
const ll inf = 0x3f3f3f3f;
const ll nax = 0;
int n, x, t;

int main(){
	IOS
	cin >> n >> x >> t;
	int bagi=(n/x)+(n%x!=0);
	//debug(n/x); debug(n%x);
	cout << t*(bagi) << '\n';
}


Measured memory_bytes: 3596
;; E - Payment

(defun solve (n)
  (labels ((accumulator (char acc)
             (destructuring-bind (sum carry prev) acc
               (let* ((x (+ (digit-char-p char) carry))
                      (y (if (= prev 5) (1+ x) x)))
                 (if (or (> x 5) (= x prev 5))
                     (list (+ sum (- 10 y)) 1 y)
                     (list (+ sum x) 0 x))))))
    (destructuring-bind (s c p)
      (reduce #'accumulator n :initial-value '(0 0 0) :from-end t)
      (+ s c))))

(let ((n (read-line)))
  (princ (solve n)))


Measured memory_bytes: 57704
n = int(input())
s = input()
x = int(s, 2)
p = s.count("1")
if p > 1:
	pre0 = x%(p-1)
pre1 = x%(p+1)

nxt = [i for i in range(n+10)]
for i in range(1, n+10):
	nxt[i] %= bin(i).count("1")

for i in range(n):
	if x == 1<<(n-1-i):
		print(0)
		continue
	if s[i] == "0":
		tmp = (pre1 + pow(2, n-1-i, p+1)) % (p+1)
	else:
		tmp = (pre0 - pow(2, n-1-i, p-1)) % (p-1)
	ans = 1
	while tmp > 0:
		ans += 1
		tmp = nxt[tmp]
	print(ans)

Measured memory_bytes: 86488
dx = [-1,0,1,0]
dy = [0,-1,0,1]
 
def bfs(ch,cw):
    q = [[] for _ in range(1000000)]
    
    S[ch][cw] = 0
    q[S[ch][cw]].append([ch,cw])
    
    counter = 0
    
    while True:
        if not q[counter]:
          counter += 1
          if not q[counter]:
              break
        p = q[counter].pop()
        
        if p[0]==dh and p[1]==dw:
            break
        
        for i in range(4):
            next_p = [p[0]+dx[i],p[1]+dy[i]]
            if next_p[0]<0 or next_p[1]<0 or next_p[0]>=h or next_p[1]>=w:
                continue
            if S[next_p[0]][next_p[1]] > S[p[0]][p[1]]:
                S[next_p[0]][next_p[1]] = S[p[0]][p[1]]
                q[counter].append(next_p)
                
                
        for i in range(-2,3):
            for j in range(-2,3):
                if (i == 0 and j == 0) or (i==-1 and j==0)or(i==1 and j==0)or(i==0 and j==-1)or (i==0 and j==1):
                    continue
                next_p = [p[0]+i,p[1]+j]
                if next_p[0]<0 or next_p[1]<0 or next_p[0]>=h or next_p[1]>=w:
                    continue
                if S[next_p[0]][next_p[1]] > S[p[0]][p[1]]+1:
                    S[next_p[0]][next_p[1]] = S[p[0]][p[1]]+1
                    q[counter+1].append(next_p)
                    
            
    return 
        
h,w = map(int,input().split())
ch,cw = map(int,input().split())
ch -= 1
cw -= 1
dh,dw = map(int,input().split())
dh -= 1
dw -= 1
S = [list(input()) for _ in range(h)]
 
for i in range(h):
    for j in range(w):
        if S[i][j] == '.':
            S[i][j] = float('inf')
        else:
            S[i][j] = -1
 
 
bfs(ch,cw)
if S[dh][dw] != float('inf'):
    print(S[dh][dw])
else:
    print(-1)

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

namespace ProgramingStudying2
{
    class Program
    {

        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var a = Console.ReadLine().Split().Select(int.Parse).ToArray();
            
            for(int i = 0; i < n; i++)
            {
                if(a[i] % 2 == 0 && a[i] % 3 != 0 && a[i] % 5 != 0)
                {
                    Console.WriteLine("DENIED");
                    return;
                }
            }
            Console.WriteLine("APPROVED");
        }
    }
}


Measured memory_bytes: 28208
#include "bits/stdc++.h"
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
static const int INF = 0x3f3f3f3f; static const long long INFL = 0x3f3f3f3f3f3f3f3fLL;
typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
template<typename T, typename U> static void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> static void amax(T &x, U y) { if(x < y) x = y; }

ll rec(int i, ll cur, ll sum, const string &S) {
	if(i == S.size()) {
		return sum;
	}
	int d = S[i] - '0';
	ll res = 0;
	if(i + 1 != S.size())
		res += rec(i + 1, cur * 10 + d, sum, S);
	res += rec(i + 1, 0, sum + cur * 10 + d, S);
	return res;
}

int main() {
	string S;
	while(cin >> S) {
		ll ans = rec(0, 0, 0, S);
		printf("%lld\n", ans);
	}
	return 0;
}


Measured memory_bytes: 764
tmp = gets.split(' ')
n = tmp[0].to_i
m= tmp[1].to_i

if (n<2) and (m>2) then
  print m-2
elsif (m<2) and (n>2) then
  print n-2
elsif (n==2) or (m==2) then
  print 0
else 
  print (n-2)*(m-2)
end

Measured memory_bytes: 1788
#include <iostream>
using namespace std;
const int limn=1e5+5;
int tab[limn];
int dp[limn];
int bzw(int a)
{
  if(a<0)
    return a*-1;
  else
    return a;
}
int main()
{
  int n;
  cin>>n;
  for(int i=0;i<n;i++)
    dp[i]=1e9;
  for(int i=0;i<n;i++)
    {
      cin>>tab[i];
    }
  for(int i=0;i<n;i++)
    {
      for(int j=max(0,i-2);j<i;j++)
	dp[i]=min(dp[i],bzw(tab[i]-tab[j])+dp[j]);
      if(dp[i]==1e9)
	dp[i]=0;
    }
  
  cout<<dp[n-1] << endl;
  return 0;
}



Measured memory_bytes: 1024
#include <string>
#include <vector>
#include <iostream>

using namespace std;

int main() {
    string input;
    cin >> input;

    if((input[0] == input[1] and
        input[1] == input[2])
         or
        (input[1] == input[2] and
         input[2] == input [3])) 
    {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
n, a = map(int, input().split())
x = list(map(int, input().split()))

y = []
for i in range(n):
    y.append(x[i] - a)

dp = [[0 for i in range(110*n)] for j in range(n+1)]

const = 50*n
dp[0][const] = 1


for i in range(n):
    for j in range(100*n + 1):
        dp[i+1][j] = dp[i][j]
        if j - y[i] >= 0 and j - y[i] <= 100*n:
            dp[i+1][j] += dp[i][j - y[i]]

print(dp[n][const]-1)

Measured memory_bytes: 6000
#include <cstdio>

using namespace std;

int main() {
    int n, m, mod = 1000000007, i;
    long long ans = 0;
    
    scanf("%d %d", &n, &m);
    
    if (n + 1 == m || m + 1 == n) {
        ans = 1;
        
        for (i = 1; i <= n; i++) ans = ans * i % mod;
        for (i = 1; i <= m; i++) ans = ans * i % mod;
    } else if (n == m) {
        ans = 1;
        
        for (i = 1; i <= n; i++) ans = ans * i % mod;
        for (i = 1; i <= m; i++) ans = ans * i % mod;
        
        ans = ans * 2 % mod;
    }
    
    printf("%lld\n", ans);
    
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include<complex>
#include <cassert>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repd(i, n) for (int i = n; i > 0; i--)
#define mod 1000000007
#define MOD 998244353
#define inf 1e20
typedef long long int ll;
typedef pair<ll, ll> pr;
typedef complex<double> com;


int main(){
	string s;
	cin >>s;
	if (s == "a" || s == "i" || s == "u" || s == "e" || s == "o") {
		cout << "vowel";
	}
	else {
		cout << "consonant";
	}
	return 0;
}
//Ctrl+Aを使わない

Measured memory_bytes: 256
S = input()

if len(S)<=10 and len(S)>=1:
    if (("hi" in S)and(len(S)==2))or(("hihi" in S)and(len(S)==4))or(("hihihi" in S)and(len(S)==6))or(("hihihihi" in S) and (len(S)==8))or(("hihihihihi" in S) and (len(S)==10)):
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 38384
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
#define allR(v) v.rbegin(), v.rend()
#define PRINT(v) for (auto x : (v)) cout <<x <<" " ; cout <<endl;
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
typedef pair<int,int> Pi;
const ll MOD = 1000000007;
const ll INF = 10000000000000000;
const int inf = 1001001001;
vector<int> x4 = {0, 1, 0, -1}, x8 = {0, 1, 1, 1, 0, -1, -1, -1};
vector<int> y4 = {1, 0, -1, 0}, y8 = {1, 1, 0, -1, -1, -1, 0, 1};
template<class T> inline bool chmin(T& a, T b){if (a>b){a = b; return true;}return false;}
template<class T> inline bool chmax(T& a, T b){if (a<b){a = b; return true;}return false;}
template<class T> inline T powerM(T a,T b){if (b==0) return 1;
T tmp = powerM(a,b/2); if (b%2==0) return tmp*tmp%MOD; else return tmp*tmp%MOD*a%MOD; }
template<class T> inline T power(T a,T b,T m=numeric_limits<T>::max()){ if (b==0) return 1;
  T tmp = power(a,b/2,m); if (b%2==0) return tmp*tmp%m; else return tmp*tmp%m*a%m; }
template<class T> inline T gcd(T a, T b){if (b==0) return a; return gcd(b, a%b);}
template<class T> inline T lcm(T a, T b){return a / gcd(a,b) * b;}
// ax+by=gcd(a,b)を解く
template<class T> inline T extgcd(T a,T b,T &x,T &y){if (b==0){x=1; y=0; return a;} T d=extgcd(b,a%b,y,x); y -= a/b*x; return d;}
void hey(){ cout <<"hey" <<endl; }

template<class T> struct edge { int to; T cost;};


bool solve(int N, vector<ll> &a){
  sort(all(a));
  if (a[N-1] == 0) return true;
  vector<ll> b = a;
  b.erase(unique(all(b)), b.end());
  if (N%3 != 0) return false;
  if (b.size() > 3) return false;

  for (int i=0;   i<N/3;   i++) if (a[i] != a[0])   return false;
  for (int i=N/3; i<2*N/3; i++) if (a[i] != a[N/3]) return false;
  for (int i=2*N/3; i<N; i++) if (a[i] != a[2*N/3]) return false;

  if ((a[0] ^ a[N/3]) == a[2*N/3]) return true;
  return false;
}

int main() {
  int N; cin >>N;
  vector<ll> a(N); rep(i, N) cin >>a[i];
  bool res = solve(N, a);
  cout <<(res ? "Yes" : "No") <<endl;
}

Measured memory_bytes: 1792
//#include<stdio.h>
//#include<iostream>
//#include<algorithm>
//#include<vector>
//#include<cstring>
//#include<cmath>
//#include<map>
#include<bits/stdc++.h>
using namespace std;

#define fast ios_base::sync_with_stdio(false)
#define outs(x) cout << x << " "
#define outn(x) cout << x << "\n"
#define sf scanf
#define pf printf

int main()
{
    fast;
    string s;
    char ch[20];
    while(cin >> s)
    {
        int len = s.length() , chlen=-1;

        for(int i=0; i<len; i++)
        {
            if(s[i] != 'B')
            {
                 chlen++;
                ch[chlen] = s[i];
            }

            else if(s[i] == 'B')
            {
                if(chlen > -1) chlen--;
            }

            //cout << chlen << " " << ch[chlen] << "\n";
        }

        if(chlen > 0)
        {
            for(int i=0; i<=chlen; i++) cout << ch[i];
        }

        else
        {
            cout << ch[0];
        }

        cout << "\n";
    }

    return 0;
}


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

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

    string ans;
    for(int i = 0; i < n; i++){
        ans += a[i];
        ans += b[i];
    }


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

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <vector>
#include <queue> 
using namespace std;
const int N=100100;
int n,m;
int u,v,s,t;
bool vis[N];
vector<int> ga[N];
queue<int> q;
int dist[N];
void dfs(int u)
{
	vis[u]=1;
	for(int i=0;i<ga[u].size();i++)
		if(!vis[ga[u][i]]) dfs(ga[u][i]);
}
/*void bfs(int t)
{
	vis[t]=1;
	for(int i=0;i<ga[u].size();i++)
		if(!vis[ga[t][i]]) bfs(ga[t][i]);
}*/
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=m;i++)
	{
		scanf("%d%d",&u,&v);
		ga[u].push_back(v);
	}
	scanf("%d%d",&s,&t);
	memset(dist,63,sizeof(dist));
	dfs(s);
	if(!vis[t])
	{
		printf("-1\n");
		return 0;
	}
	q.push(s);
	dist[s]=0;
	while(q.size())
	{
		int u=q.front();
		q.pop();
		for(int i=0;i<ga[u].size();i++)
		{
			int v=ga[u][i];
			for(int j=0;j<ga[v].size();j++)
			{
				int w=ga[v][j];
				for(int k=0;k<ga[w].size();k++)
				{
					int x=ga[w][k];
					if(dist[x]>=1e9)
					{
						if(x==t)
						{
							cout<<dist[u]+1<<endl;
							return 0;
						}
						dist[x]=dist[u]+1;
						q.push(x);
					}
				}
			}
		}
	}
	printf("-1\n");
	return 0;
}

Measured memory_bytes: 9344
#include <cstdio>
#include <iostream>
using namespace std;
int main(){
 int n,i,x;
 scanf("%d",&n);
 i=1;
 do {
  x=i;
  if(x%3==0){
   cout << " " << i;
  } else do {
   if ( x%10 == 3 ) {
      cout << " " << i;
      x=0; 
   } 
  } while (x/=10,x>0);
 } while (++i <= n);
 cout << endl;
};

   
    

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

int main(){
  char a,b;
  cin >> a >>b;
  
  if(a=='H'){
    if(b=='H') cout<<'H';
    else cout <<'D';
  }
  else{
    if(b=='D') cout<<'H';
    else cout <<'D';
  }
  return 0;
}


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

const int N=5100,mod=1e9+7;
int n;
int head[N],ce;
struct edge{int to,nxt;} e[N<<1];
LL fac[N],f[N][N][2],sz[N],Ans,tmp[N][2];

void Adde(int a,int b) {e[++ce]=(edge){b,head[a]},head[a]=ce;}

void dfs(int u,int lst)
{
	sz[u]=1,f[u][1][0]=1;
	for(int i=head[u],v;i;i=e[i].nxt)
	{
		v=e[i].to;
		if(v == lst) continue;
		dfs(v,u);
		memset(tmp,0,sizeof(tmp));
		for(int j=1;j<=sz[u];++j)
			for(int k=1;k<=sz[v];++k)
			{
				LL t0=(f[u][j][0]*f[v][k][0]%mod+f[u][j][1]*f[v][k][1]%mod)%mod;
				LL t1=(f[u][j][1]*f[v][k][0]%mod+f[u][j][0]*f[v][k][1]%mod)%mod;
				
				(tmp[j+k][0] += t0)%=mod;
				(tmp[j+k][1] += t1)%=mod;
				(tmp[j][1] += t0*fac[k]%mod)%=mod;
				(tmp[j][0] += t1*fac[k]%mod)%=mod;
			}
		memcpy(f[u],tmp,sizeof(tmp));
		sz[u]+=sz[v];
	}
	//for(int i=1;i<=sz[u];++i)
	//	cout<<u<<" "<<i<<" "<<f[u][i][0]<<" "<<f[u][i][1]<<endl;
}

int main()
{
	scanf("%d",&n);
	for(int i=1,u,v;i<n;++i)
	{
		scanf("%d%d",&u,&v);
		Adde(u,v); Adde(v,u);
	}
	fac[2]=1;
	for(int i=4;i<=n;i+=2) (fac[i]=fac[i-2]*(i-1)%mod)%=mod;
	dfs(1,0);
	for(int i=2;i<=n;i+=2)
		(Ans+=(f[1][i][0]-f[1][i][1])*fac[i]%mod)%=mod;
	printf("%lld",(Ans+mod)%mod);
	return 0;
}

Measured memory_bytes: 400256
#include<bits/stdc++.h>
using namespace std;
int w,h,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
string a[51];
bool used[51][51];

int dfs(int y,int x){
  if(y==-1||y==h||x==-1||x==w)return 0;
  if(a[y][x]=='B')return 1;
  if(a[y][x]=='W')return 2;
  if(used[y][x])return 0;
  used[y][x]=1;
  int pr=0;
  for(int t,i=0;i<4;i++){
    t=dfs(y+dy[i],x+dx[i]);
    if(!pr)pr=t;
    else if(t&&pr!=t)pr=3;
  }
  return pr;
}

int main(){
  while(cin>>w>>h,w){
    for(int i=0;i<h;i++)cin>>a[i];
    int ans[5]={};
    for(int i=0;i<h;i++)
      for(int j=0;j<w;j++){  
	memset(used,0,sizeof(used));
	if(a[i][j]=='.')ans[dfs(i,j)]++;
      }
    cout<<ans[1]<<" "<<ans[2]<<endl;
  }
  return 0;
}

Measured memory_bytes: 3140
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <stack>
#include <istream>
#include <map>
#include <set>
#include <queue>
#define rep0(i,n) for (int i = 0; i < (n); ++i)
#define rep1(i,n) for (int i = 1; i < (n); ++i)
#define REP(i,a,b) for (int i = a; i < (b); ++i) 
typedef long long ll;
using namespace std;
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	/*
	/
	/
	/
	*/
	string a, b;
	cin >> a >> b;
	if (a > b) {
		cout << ">" << endl;
	}
	else if(a == b){
		cout << "=" << endl;
	}
	else {
		cout << "<" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
'use strict';
process.stdin.on('data', function(chunk) {
    var inputs = chunk.toString().trim().split(' ');
    var a = Number(inputs[0]);
    var b = Number(inputs[1]);
    var c = Number(inputs[2]);
    var sortTable = [a,b,c].sort(function(a,b){
    	return a - b;
    });
    console.log(sortTable.join(' '));

});
process.stdin.resume();
process.stdin.setEncoding('utf8');

Measured memory_bytes: 15560
input_line = input()
# W,H,x,y,r
input_data = input_line.strip().split(' ')

W, H, x, y, r = [int(i) for i in input_data]

if x < 0 or y < 0:
    print("No")
elif W >= (x+r) and H >= (y+r):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 7708
#include <cstdio>

int main(){
    int n;
    scanf("%d",&n);
    for(int i = 1;i <= n;i++){
        int x = i;
        if(i % 3 == 0)
            printf(" %d",i);
        else{ 
            do{
                if(x % 10 == 3){
                    printf(" %d",i);
                    break;
                }
                x /= 10;
            }   
            while (x);
        }
    }
    printf("\n");

    return 0;
}


Measured memory_bytes: 2696
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
using namespace std;
 
#define MOD (long long int)(1e9+7)
#define ll long long int

int powa(int a,int b){
	if(b==1){
		return a;
	}else if(b%2==0){
		return powa(a,b/2)*powa(a,b/2);
	}else{
		return powa(a,b/2)*powa(a,b/2)*a;
	}
}


int main(void){
	
	int a,b;
	cin>>a>>b;
	int memo=1;
	for(int i=1;i<5;i++){
		if(b<((int)(powa(10,i)))){
			memo=i;
			break;
		}
		
	}
	a=a*((int)powa(10,memo));

	a+=b;
	//cout<<a;
	bool ans=false;
	for(int i=1;i<400;i++){
		//cout<<((powa(i,2)))<<(int)a<<(((int)(powa(i,2)))==(int)a)<<endl;
		if(((int)(powa(i,2)))==(int)a){
			ans=true;
		
			break;
		}
	}
	cout<<(ans?"Yes":"No")<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
long long n,k;
double o;
long long answer;
using namespace std;
int main() {
    // insert code here...
    cin>>n;
    
    o=sqrt(n);
    int j=o;
    if ((o-j)>=0.5) {
        j+=1;
    }

    for (long long i=1; i<=j-1; i++) {
        
        if (n%i==0) {
            long long l=n/i;
            answer+=(l-1);
        }
    }
    printf("%lld",answer);
    cout<<endl;
    return 0;
}

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

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

    int res = 0;
    if(N >= 105 && N < 135) res = 1;
    if(N >= 135 && N < 165) res = 2;
    if(N >= 165 && N < 189) res = 3;
    if(N >= 189 && N < 195) res = 4;
    if(N >= 195) res = 5;

    cout << res << 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 ALL(a) a.begin(),a.end()
#define INIT(a,b) memset(a,b,sizeof(a))
using lint = long long int;

const lint MOD = 998244353;

void modAdd(lint& a, lint b, lint m) {
    a = (a + b + m) % m;
}

int main() {
    int N, K;
    cin >> N >> K;

    vector<int> L(K), R(K);
    for_(k,0,K) cin >> L[k] >> R[k];

    vector<lint> dp(N+1, 0);
    dp[1] = 1; dp[2] = -1;

    for_(i,1,N) {
        modAdd(dp[i + 1], dp[i], MOD);
        for_(k,0,K) {
            if (i + L[k] <= N) modAdd(dp[i + L[k]], dp[i], MOD);
            if (i + R[k] + 1 <= N)  modAdd(dp[i + R[k] + 1], -dp[i], MOD);
        }
        // for_(j,1,N+1) cerr << dp[j] << " ";
        // cerr << endl;
    }

    cout << dp[N] << endl;
}

Measured memory_bytes: 4764
import heapq
import sys

input = sys.stdin.readline

def dijkstra(s,edge):
    #始点sから各頂点への最短距離
    d = [10**20] * n
    used = [True] * n #True:未確定
    d[s] = 0
    used[s] = False
    edgelist = []
    for a,b in edge[s]:
        heapq.heappush(edgelist,a*(10**6)+b)
    while len(edgelist):
        minedge = heapq.heappop(edgelist)
        #まだ使われてない頂点の中から最小の距離のものを探す
        if not used[minedge%(10**6)]:
            continue
        v = minedge%(10**6)
        d[v] = minedge//(10**6)
        used[v] = False
        for e in edge[v]:
            if used[e[1]]:
                heapq.heappush(edgelist,(e[0]+d[v])*(10**6)+e[1])
    return d

n,x,y = map(int,input().split())

edge = [[] for i in range(n)]
#edge[i] : iから出る道の[重み,行先]の配列
for i in range(n-1):
    edge[i].append((1,i+1))
    edge[i+1].append((1,i))
edge[x-1].append((1,y-1))
edge[y-1].append((1,x-1))

ans = [0 for _ in range(n)]
for i in range(n):
    #dijkstra(始点,edge)
    res = dijkstra(i,edge)
    for j in range(i+1,n):
        ans[res[j]] += 1

for i in range(1,n):
    print(ans[i])


Measured memory_bytes: 85468
#include<cstdio>
#include<set>
#include<map>
#include<vector>
#include<algorithm>
using namespace std;
const int MAXN=100005;

int H,W,N;
set<pair<int,int> > ans[10],blk;
pair<int,int> P[MAXN];

int Count(pair<int,int> R)
{
	int cnt=0;
	for(int i=R.first;i<R.first+3;i++)
		for(int j=R.second;j<R.second+3;j++)
			cnt+=blk.count(make_pair(i,j));
	return cnt;
}

int main()
{
	scanf("%d%d%d",&H,&W,&N);
	for(int i=1;i<=N;i++)
	{
		scanf("%d%d",&P[i].first,&P[i].second);
		if(!blk.count(P[i]))
			blk.insert(P[i]);
	}
	
	for(int i=1;i<=N;i++)
	{
		for(int x=max(P[i].first-2,1);x<=P[i].first&&x+2<=H;x++)
			for(int y=max(P[i].second-2,1);y<=P[i].second&&y+2<=W;y++)
			{
				pair<int,int> r=make_pair(x,y);
				int c=Count(r);
				ans[c].insert(r);
			}
	}
	long long ans0=(1LL*(W-2)*(H-2));
	for(int i=1;i<10;i++)
		ans0-=ans[i].size();
	printf("%lld\n",ans0);
	for(int i=1;i<10;i++)
		printf("%u\n",ans[i].size());
	
	return 0;
}


Measured memory_bytes: 47872
#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<algorithm>
#include<map>
#include<cstdlib>
#include<cmath>
#include<numeric>
#include<iomanip>
#include<functional>
#include<cstdlib>
#include<queue>
#include<deque>
const double PI = acos(-1);
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
using ll =long long;
const int mod = 1000000007;

//map<string>a
class mint {
	long long x;
public:
	mint(long long x = 0) : x((x% mod + mod) % mod) {}
	mint operator-() const {
		return mint(-x);
	}
	mint& operator+=(const mint & a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint & operator-=(const mint & a) {
		if ((x += mod - a.x) >= mod) x -= mod;
		return *this;
	}
	mint & operator*=(const  mint & a) {
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint & a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint & a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint & a) const {
		mint res(*this);
		return res *= a;
	}
	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}
	// for prime mod
	mint inv() const {
		return pow(mod - 2);
	}
	mint& operator/=(const mint & a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint & a) const {
		mint res(*this);
		return res /= a;
	}

	friend ostream& operator<<(ostream & os, const mint & m) {
		os << m.x;
		return os;
	}
};
int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}
//組み合わせ
void recursive_comb(vector<int> indexes, int s, int rest, std::function<void(vector<int>)> f) {
	if (rest == 0) {
		f(indexes);
	}
	else {
		if (s < 0) return;
		recursive_comb(indexes, s - 1, rest, f);
		indexes[rest - 1] = s;
		recursive_comb(indexes, s - 1, rest - 1, f);
	}
}

// nCkの組み合わせに対して処理を実行する
void foreach_comb(int n, int k, std::function<void(vector<int>)> f) {
	vector<int>indexes(k);
	recursive_comb(indexes, n - 1, k, f);
}

ll gcd(ll a, ll b) {
	if (a % b == 0) {
		return b;
	}
	else {
		return gcd(b, a % b);
	}
}
ll lcm(ll a, ll b) {
	return a * b / gcd(a, b);
};
//fixed << setprecision(2)
int popcount(int x) {
	int ans=0;
	int tmp;
	while (x != 0) {
		tmp = x >> 2;
			tmp = tmp << 1;
			if (tmp == x) {
				ans++;
			}
			x >> 1;
	}
	return ans;

}
int main() {
	int n;
	cin >>n;
	ll ans=0;
	vector<string>s(n);
	rep(i, n)cin >> s[i];
	rep(i, n) {
		sort(s[i].begin(), s[i].end());
	}
	ll tmp;
	sort(s.begin(), s.end());
	for (int i = 1; i < n;i++) {
		tmp = 1;
		while(i<n&&s[i] == s[i - 1]){
			
				tmp++;
				i++;
	
			
		}
		if (tmp != 1) {
			ans += tmp * (tmp -1) / 2;
			i--;
		}
	}
	cout << ans;
}
	


Measured memory_bytes: 6364
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <string.h>
#include <ctype.h>
#include <algorithm>
#include <math.h>

using namespace std;

int main() {
  int n,a,b;
  cin >> n >> a >> b;
  
  if((b-a) % 2 == 0)
    cout << "Alice" << endl;
  else
    cout << "Borys" << endl; 
}

Measured memory_bytes: 3600
#include<iostream>
using namespace std;
long N,M,mod=998244353;
long F[1<<25],I[1<<25];
long power(long a,long b){return b?power(a*a%mod,b/2)*(b%2?a:1)%mod:1;}
long C(long a,long b)
{
	return a<b||a<0||b<0?0:F[a]*I[b]%mod*I[a-b]%mod;
}
long H(long a,long b){return a<0?0:C(a+b-1,b-1);}
long calc(long n,long m,long s)
{
	long ret=0;
	for(int i=0;i<=n&&i<=m;i++)
	{
		if(s-i&1)continue;
		(ret+=C(n,i)*H((s-i)/2,n)%mod)%=mod;
	}
	return ret;
}
main()
{
	cin>>N>>M;
	long T=2*M+N;
	F[0]=1;
	for(long i=1;i<T;i++)F[i]=F[i-1]*i%mod;
	I[T-1]=power(F[T-1],mod-2);
	for(long i=T-1;i--;)I[i]=I[i+1]*(i+1)%mod;
	cout<<(calc(N,M,3*M)-calc(N,M,M)*N%mod+calc(N-1,M,M)*N%mod+mod)%mod<<endl;
}


Measured memory_bytes: 33024
#include <bits/stdc++.h>
using namespace std;
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define in(x,y,h,w) x >= 0 && x < h && y >= 0 && y < w

#define int long long
#define double long double
//typedef    long long          ll;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      P;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
 
const int INF=1e+18;
const double EPS=1e-9;
const int MOD=1000000007;

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

signed main(){
	int n,c,ma = 0,x[100010],v[100010],sum = 0;
	cin >> n >> c;
	for(int i = 1;i <= n;i++){
		cin >> x[i] >> v[i];
		sum += v[i];
	}
	x[0] = 0;
	x[n + 1] = c;
	priority_queue<int> que;
	int tv = 0,td = 0,tsum = sum - 2 * x[n];
	que.push(0);
	for(int i = n;i >= 1;i--){
		tv += v[i];
		td += x[i + 1] - x[i];
		que.push(tv - td);
		tsum += 2 * (x[i] - x[i - 1]) - v[i];
		chmax(ma,tsum + que.top());
	}
	while(que.size()) que.pop();
	que.push(0);
	tv = 0,td = 0,tsum = sum - 2 * (c - x[1]);
	for(int i = 1;i <= n;i++){
		tv += v[i];
		td += x[i] - x[i - 1];
		que.push(tv - td);
		tsum += 2 * (x[i + 1] - x[i]) - v[i];
		chmax(ma,tsum + que.top());
	}
	cout << ma << endl;
	return 0;
}

Measured memory_bytes: 2936
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define mp make_pair
#define vi vector<int>
#define inf 1e18
#define mod pow(10,9)+7
#define mii map<int,int>
#define pii pair<int,int>
#define setbits(x) __builtin_popcountll(x)
#define lcm(x,y)  (x*y)/__gcd(x,y)
/*void c_p_c()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
#ifndef  ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}*/
int32_t main()
{
	//c_p_c();
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	int div_c = b / c  -  (a - 1) / c;
	int div_d = b / d  -   (a - 1) / d;
	//cout << div_c << " " << div_d << " ";
	int lcmab = lcm(c, d);
	//cout << lcmab << " " << endl;
	int cdiv = b / lcmab  -  (a - 1) / lcmab;
	//cout << cdiv << endl;

	cout << (b - a + 1) - (div_c + div_d -  cdiv);




	return 0;
}

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

// --------------------------------------------------------------------------------
#define FASTIO	ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define ll long long 
#define mset(arr,val) memset(arr,val,sizeof(arr))
#define fset(arr,n,val) for(int i=0;i<n;++i) arr[i] = val
#define deb(name,value) cout <<"->>  "<<name<< "= " <<value<<" "
#define frepi(a,b) for(int i=a;i<=b;i++)
#define frepj(a,b) for(int j=a;j<=b;j++)
// --------------------------------------------------------------------------------

void solve_main()
{
    int n;cin>>n;
    map<string,int>mp;
    mp["AC"] = 0;
    mp["RE"] = 0;
    mp["WA"] = 0;
    mp["TLE"] = 0;
    for(int i=0;i<n;++i)
    {
    	string s;cin>>s;
    	mp[s]++;
    }
    for(auto x:mp)
    	if(x.first=="AC")
    		cout<<"AC x "<<x.second<<"\n";
    for(auto x:mp)
    	if(x.first=="WA")
    		cout<<"WA x "<<x.second<<"\n";
    for(auto x:mp)
    	if(x.first=="TLE")
    		cout<<"TLE x "<<x.second<<"\n";
    for(auto x:mp)
    	if(x.first=="RE")
    		cout<<"RE x "<<x.second<<"\n";
}

int main()
{

	#ifndef ONLINE_JUDGE
		freopen("/home/suryakant/input.txt","r",stdin);
		freopen("/home/suryakant/output.txt","w",stdout);
	#endif

    int t=1;
    // cin>>t;
    while(t--)
    {
    	solve_main();
    }
    //for(int caset=1;caset<=t;++caset)
    //{
    //    solve_main();
    //}
    
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	char c;
	cin >> c;
	if (c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o'){
		cout << "vowel" << endl;
	}
	else {
		cout << "consonant" << endl;
	}
}

Measured memory_bytes: 256