akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>

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

	long counter;
	std::vector<int> v;

	v.emplace_back( 105 ); // 105以下で条件を満たすのは105だけ

	// Nは最大200なので、ゴリ押し（全探索）
	for ( int i = 107; i <= N; i += 2 )	//	107から探す
	{
		counter = 0;
		for ( int j = 1; j <= N; j += 2 )	//	奇数でしか割れない
		{
			if ( i % j == 0 )
			{
				counter++;
			}
		}
		if ( counter == 8 )
		{
			v.emplace_back( i );
		}
	}

	if ( N < 105 )
	{
		std::cout << "0" << std::endl;
	}
	else
	{
		std::cout << v.size() << std::endl;
	}

	return ( 0 );
}


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

int main(){
  int x;
  cin >>x;
  
  if(400<=x && x<=599)      {cout<<8<<endl;}
  else if(600<=x && x<=799) {cout<<7<<endl;}
  else if(800<=x&& x<=999)   {cout<<6<<endl;}
  else if(1000<=x && x<=1199) {cout<<5<<endl;}
  else if(1200<=x && x<=1399)  {cout<<4<<endl;}
  else if(1400<=x && x<=1599) {cout<<3<<endl;}
  else if(1600<=x && x<=1799) {cout<<2<<endl;}
  else {cout<<1<<endl;}

 return 0;
}



Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

int main(){
    int w,n;
    while(cin >>w >>n,w){
        vector<int> x(n+1);
        rep(i,n) cin >>x[i+1];

        vector<ll> pre(n+1);
        for(int i=1; i<=n; ++i) pre[i] = pre[i-1]+x[i];

        auto check = [&](ll m){
            vector<int> dp(n+2);
            dp[1] = 1;

            int ct = 0;
            int L=1,R=1;
            // 右端i
            for(int i=2; i<=n; ++i){
                while(1){
                    if(R==i) break;
                    ll t = pre[i]-pre[R-1]+m*(i-R);
                    if(t>=w){
                        ct += dp[R];
                        ++R;
                    }
                    else break;
                }

                while(1){
                    if(L==i) break;
                    ll t = pre[i]-pre[L-1]+(i-L);
                    if(t>w){
                        ct -= dp[L];
                        ++L;
                    }
                    else break;
                }

                dp[i+1] = (ct>0);
            }

            if(dp[n+1]) return true;
            for(int i=n; i>0; --i){
                // dbg(i);
                ll t = pre[n]-pre[i-1]+n-i;
                if(t<=w && dp[i]) return true;
            }
            return false;
        };

        int l=0, r=w;
        while(r-l>1){
            int m = (l+r)/2;
            if(check(m)) r = m;
            else l = m;
        }
        printf("%d\n",r);
    }
    return 0;
}



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

int main() {
    ll n, m;   cin >> n >> m;
    map<ll, ll> remain;
    ll sum = 0, ele = 0, result = 0;
    for(int i = 0; i < n; ++i) {
        cin >> ele;
        sum += ele;
        sum %= m;

        if(sum == 0)  result += 1;
        result += remain[sum];
        remain[sum]++;
    }
    cout << result << endl;

    return 0;
}

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

int main() {
    int N;
    cin >> N;
    int max_iter = N / 4;
    for (int i = 0; i <= max_iter; i++) {
        if ((N - 4 * i) % 7 == 0) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cmath>
#include <numeric>
#include <iomanip>
#include <stack>
#include <complex>
#include <functional>
#include <tuple>

using namespace std;

#define Rep(i,a,b) for(ll i = a; i < b; ++i)
#define rep(i,b) Rep(i,0,b)
#define allof(a) (a).begin(), (a).end()

#define Yes(q) ((q) ? "Yes" : "No")
#define YES(q) ((q) ? "YES" : "NO")
#define Possible(q) ((q) ? "Possible" : "Impossible")
#define POSSIBLE(q) ((q) ? "POSSIBLE" : "IMPOSSIBLE")

using ll = long long;

constexpr int inf = 1e9 + 7;
constexpr ll infll = 1ll << 60ll;
constexpr ll mod = 1e9 + 7;
// 0~3までは右下左上 4~7までは斜め
constexpr int dx[] = { 1, 0, -1, 0, 1, -1 };
constexpr int dy[] = { 0, 1, 0, -1, 1, 1 };

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

    void Cout(long long x, const char* end = "\n") { std::cout << x << end; }
    template <typename T> void Cout(const T& x, const char* end = "\n") { std::cout << x << end; }
    template <typename T> void Cout(const std::vector<T>& x, const char* sep = " ", const char* end = "\n") { for (std::size_t i = 0, sz = x.size(); i < sz; ++i) { std::cout << x[i] << (i == sz - 1 ? end : sep); } }

    // 標準入出力
    struct inp {
        std::size_t szi, szj;
        inp(std::size_t _szi = 1, std::size_t _szj = 1) : szi(_szi), szj(_szj) {}
        template <typename T> operator T () const { T a; std::cin >> a; return a; }
        template <typename T> operator std::vector<T>() const { std::vector<T> a(szi); for (std::size_t i = 0; i < szi; ++i) std::cin >> a[i]; return a; }
        template <typename T> operator std::vector<std::vector<T>>() const {
            std::vector<std::vector<T>> a(szi, std::vector<T>(szj));
            for (std::size_t i = 0; i < szi; ++i) for (std::size_t j = 0; j < szj; ++j) cin >> a[i][j]; return a;
        }
    };
    inp inp1;
}

int main() {

    ll n, m, k;
    cin >> n >> m >> k;
    vector<ll> a = inp(n);
    vector<ll> b = inp(m);

    // それぞれどこまで読むか
    vector<ll> sum_a(n + 1, 0);
    rep(i, n) sum_a[i + 1] = sum_a[i] + a[i];
    vector<ll> sum_b(m + 1, 0);
    rep(i, m) sum_b[i + 1] = sum_b[i] + b[i];

    int ans = 0;

    // aをi冊読む
    rep(i, n + 1) {
        ll need = sum_a[i];
        if (need > k) break;

        // どこまで読めるか
        int add = upper_bound(allof(sum_b), k - need) - sum_b.begin() - 1;
        chmax(ans, (int)i + add);
    }

    Cout(ans);

    return 0;
}


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

using namespace std;

typedef long long ll;

const int N = 1e5 + 10, M = 1e6 + 10;
const int mod = 1e9 + 7;
const ll inf = 0x3f3f3f3f;

int t;

ll a[N * 2];

ll n, k;

bool check(ll mid) //找小于等于它的有多少个
{
    ll cnt = 0;
    for (int i = 0; i < n - 1; i++)
    {
        if (mid == 0)
        {
            if (a[i] <= 0)
            {
                int id = lower_bound(a + i + 1, a + n, 0) - a;
                cnt += n - id;
            }
        }
        else if (mid > 0)
        {
            if (a[i] == 0)
            {
                cnt += n - i - 1;
            }
            else
            {
                 int id = lower_bound(a + i + 1, a + n, mid / a[i]) - a;
                if (a[i] < 0)
                {
                    cnt += n - id;
                }
                else
                {
                    if (id == n)
                        cnt += n - i - 1;
                    else if (a[id] * a[i] <= mid)
                        cnt += id - i;
                    else if (a[id - 1] * a[i] <= mid)
                        cnt += id - i - 1;
                }
            }
        }
        else //小于0
        {
            if (a[i] >= 0)
                continue;
            else //小于0
            {
                if (mid >= a[i])
                {
                    int id = lower_bound(a + i + 1, a + n, 1) - a;
                    cnt += n - id;
                }
                else
                {
                    ll x = mid / a[i];
                    if ((-mid) % (-a[i]) != 0)
                        x++;
                    int id = lower_bound(a + i + 1, a + n, x) - a;
                    cnt += n - id;
                }
            }
        }
    }
    return cnt >= k;
}

int main()
{
    cin >> n >> k;
    for (int i = 0; i < n; i++)
        scanf("%lld", &a[i]);
    sort(a, a + n);
    ll l = -1e18, r = 1e18;
    while (l <= r)
    {
        ll mid = (l + r) >> 1;
        if (check(mid))
            r = mid - 1;
        else
        {
            l = mid + 1;
        }
    }
    cout << r + 1 << endl;
    return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
int hyou[10][10];
int n,m,cnt;

void tansaku() {
	int cnt0 = 0;
	int cnt2[10] = {};
	int cnt1[10] = {};
	rep(i, n){
		rep(j, n) {
			if (i == j) continue;
			if (hyou[i][j] == 2) cnt2[i] ++;
			if (hyou[i][j] == 1) cnt1[i] ++;
			if (hyou[i][j] == 0) cnt0 ++;
		}
		if (cnt1[i] > n / 2 or cnt2[i] > n / 2) {
			return;
		}
	}
	if (cnt0 == 0) {
		cnt ++;
		return;
	}
	rep(i, n) {
		for (int j = i + 1; j < n; j++) {
			if (hyou[i][j] != 0) continue;
			if (cnt2[i] + 1 <= n / 2 and cnt1[j] + 1 <= n / 2 and cnt1[i] + 1 <= n / 2 and cnt2[j] + 1 <= n /2) {
				hyou[i][j] = 2;
				hyou[j][i] = 1;
				tansaku();
				hyou[i][j] = 1;
				hyou[j][i] = 2;
				tansaku();
			}
			else if (cnt2[i] + 1 <= n / 2 and cnt1[j] + 1 <= n / 2) {
				hyou[i][j] = 2;
				hyou[j][i] = 1;
				tansaku();
				
			}
			else if (cnt1[i] + 1 <= n / 2 and cnt2[j] + 1 <= n / 2) {
				hyou[i][j] = 1;
				hyou[j][i] = 2;
				tansaku();
			}
			hyou[i][j] = 0;
			hyou[j][i] = 0;
			return;
		}
	}
}


int main() {
	while(cin >> n, n){
		cin >> m;
		for(int i = 0; i < n; i++) {
			for(int j = 0; j < n; j++) {
				hyou[i][j] = 0;
			}
		}
		int x,y;
		for(int i = 0; i < m; i++) {
			cin >> x >> y;
			x--;
			y--;
			hyou[x][y] = 2;
			hyou[y][x] = 1;
		}
		cnt = 0;
		tansaku();
		cout << cnt << endl;
	}
}


Measured memory_bytes: 3100
<?php
$n = trim(fgets(STDIN));
$str = trim(fgets(STDIN));

$white = 0;
for($i = 0; $i < $n ;$i++){
    $white += (@$str[$i] == ".");
}
$min = $white;
for($i = 0; $i < $n ;$i++){
    if(@$str[$i] == "."){
        $white--;
    }else{
        $white++;
    }
    $min = min($min, $white);
}
echo $min;



Measured memory_bytes: 4728
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

int gcd(int x, int y) {
	return y ? gcd(y, x % y) : x;
}

int main() {
	int N, X; cin >> N >> X;
	int mini = X;
	vector<int> x(N);
	for (int i = 0; i < N; ++i) {
		cin >> x[i];
		mini = min(mini, x[i]);
	}
	int ans = X - mini;
	for (int i = 0; i < N; ++i) {
		ans = gcd(ans, x[i] - mini);
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 640
using System;

class Program
{
    static void Main(string[] args)
    {
        var s = Console.ReadLine();
        var x = 0;
        var y = 0;
        for (int i = 0; i < s.Length; i++)
        {
            if (s[i] == '0') x++;
            else y++;
        }

        var ans = s.Length - Math.Abs(x - y);
        Console.WriteLine(ans);
    }
}


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

typedef long long int ll;
#define INF 1999999999
#define MODA 1000000007
#define PI 3.1415926535897932384626433

int main()
{
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(0);
    int k;
    cin >> k;
    int sum = 0;
    for(int a = 1; a <= k; a++){
        for(int b = 1; b <= k; b++){
            int m = __gcd(a, b);
            for(int c = 1; c <= k; c++){
                 sum += __gcd(m, c);
            }
        }
    }
    cout << sum << endl;

    return 0;
}


Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N,M,C;
  cin >> N >> M >> C;
  int B[M];
  for (int i=0;i<M;i++) cin >> B[i];
  int A[N][M];
  for (int i=0;i<N;i++){
    for (int j=0;j<M;j++){
      cin >> A[i][j];
    }
  }
  int ans=0;
  for (int i=0;i<N;i++){
    int count = 0;
    for (int j=0;j<M;j++){
      count +=A[i][j]*B[j];
    }
    count += C;
    if (count>0) ans++;
  }
  cout << ans;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>

/* カードの山 (0 番目を一番上のカードとする) */
int length;
int* cards;
int* buffer;

/* カードの山を指定された枚数で初期化する */
void init(int n) {
	int i;
	free(cards);
	free(buffer);
	length = n;
	cards = (int*)malloc(sizeof(int) * length);
	buffer = (int*)malloc(sizeof(int) * length);
	for (i = 0; i < length; i++) cards[i] = length - i; /* カードに番号をつける */
}

/* カット操作を行う (上からp枚目の札からc枚の札を山から抜き取り、山の一番上に置く) */
void cut(int p, int c) {
	int i;
	int* q;
	/* カット操作後のカードの山を buffer 配列に生成する */
	for (i = 0; i < c; i++) buffer[i] = cards[p - 1 + i];
	for (i = 0; i < p - 1; i++) buffer[c + i] = cards[i];
	for (i = p - 1 + c; i < length; i++) buffer[i] = cards[i];
	/* cards と buffer の参照を入れ換え、 cards をカット操作後の状態にする */
	q = cards;
	cards = buffer;
	buffer = q;
}

int main(void) {
	int n; /* 山にある札の枚数 */
	int r; /* カット操作の回数 */
	int p, c, i;

	/* データセット毎の処理 */
	while (scanf("%d%d", &n, &r) == 2) {
		if (n < 1 || n > 50 || r < 1 || r > 50) break;
		/* シミュレーション */
		init(n);
		for (i = 0; i < r; i++) {
			scanf("%d%d", &p, &c);
			cut(p, c);
		}
		/* 出力 */
		printf("%d\n", cards[0]);
	}

    return 0;
}

Measured memory_bytes: 600
def main():
    N,K  = map(int, input().split()) 
    A = list(map(int, input().split()))  
    A.insert(0,0)
    B = [0]*(N+1)
    tel = 1
    telmae = 1

    for i in range(K):
        if B[tel] ==0:
            B[tel] = i
            telmae = tel
            tel = A[tel]
        else:
            temp =  i - B[tel]
            joyo = (K-B[tel]) % temp
            for j in range(joyo):
                telmae = tel
                tel = A[tel]
            print(tel)
            return


    print(tel)





if __name__ == '__main__':
    main()

Measured memory_bytes: 92304
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
typedef long long ll;
#define all(x) (x).begin(), (x).end()  // sortなどの引数を省略
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define max3(x, y, z) max(x, max(y, z))

#ifdef _MSC_FULL_VER  //デバッグ出力
#define dout cout
#define debug() if (true)
#define check(x) std::cout << "★" << #x << "の値:" << (x) << endl
#define pass(x) std::cout << "☆" << x << endl
#else
#define dout \
  if (false) cout
#define debug() if (false)
#define check(x) \
  if (false) cout << "★" << #x << "の値:" << (x) << endl
#define pass(x) \
  if (false) cout << "☆" << x << endl
#endif
using namespace std;
int main() {
  ll A;
  cin >> A;
  if (A > 2400) {
    cout << 1;
    return 0;
  }
  rep(i, A/100+1) {
    rep(j, A / 100 + 1) {
      rep(k, A / 100 + 1) {
        rep(l, A / 100 + 1) {
          rep(m, A / 100 + 1) {
            rep(n, A / 100 + 1) {
              if (i * 100 + j * 101 + k * 102 + l * 103 + m * 104 + n * 105 == A) {
                cout << 1;
                return 0;
              }
            }
          }
        }
      }
    }
  }
  cout << 0;
  return 0;
}
/*
//よく使うやつ
int N;
cin >> N;
vector<int> list(N);
for (int i = 0; i < N; i++) {
cin >> list[i];
}
// for文
for (int i = 0; i < N; i++) {
}
//配列
vector<int> list;
list.at(i)
vector<vector<int>> list(10, vector<int>(10));
sort(all(list));
sort(all(list), greater<int>());
  //配列の内容表示
dout << "====listの内容====\n";
for (int i = 0; i < N; i++) dout << list[i] << endl;
dout << "====ここまで====\n";
*/


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
struct Edge {
    int to;     // 辺の行き先
    int weight; // 辺の重み
    Edge(int t, int w) : to(t), weight(w) { }
};
using Graph = vector<vector<Edge>>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reprep(i,j,w,h) rep(j,h)rep(i,w)
#define rrep(i,m, n) for(int i = m; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define aall(x,n) (x).begin(),(x).begin()+(n)
#define VEC(type,name,n) std::vector<type> a(n);rep(i,n)std::cin >> a[i];
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define sum accumulate
#define keta fixed<<setprecision
#define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a))
#define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<int>(n,a)));
typedef long long ll;
const int INF = 2000000000;
const long INF64 = 1000000000000000ll;
const ll MOD = 1000000007LL;
int main(){
    int a,b,c;
    std::cin >>a>>b>>c;
    if(a+b+c>21)std::cout << "bust" << std::endl;
    else std::cout << "win" << std::endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n, k;
	cin >> n >> k;
	long long a[n];
	for(int i=0; i<n; i++){
		cin >> a[i];
	}
	sort(a, a+n);
	if(n-k<=0){
		cout << 0;
		return 0;
	}
	long long Sum=0;
	for(int i=0; i<n-k; i++){
		Sum+=a[i];
	}
	cout << Sum;
}

Measured memory_bytes: 1792
ab = [list(map(int, input().split())) for _ in range(3)]
dict_ab = {}

for i in range(3):
    if ab[i][0] not in dict_ab:
        dict_ab[ab[i][0]] = 1
    else:
        dict_ab[ab[i][0]] += 1
    if ab[i][1] not in dict_ab:
        dict_ab[ab[i][1]] = 1
    else:
        dict_ab[ab[i][1]] += 1

if min(dict_ab.values()) == 1 and max(dict_ab.values()) == 2:
    print('YES')
else:
    print('NO')

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

int main()
{
    string S, T;
    while(cin >> S >> T)
    {
        int lenS = S.length();
        int lenT = T.length();
        int minlen = INT_MAX;
        for(int i=0; i<lenS; ++i)
        {
            int tmplen = 0;
            if(lenS-i>=lenT)
            {
                for(int j=0; j<lenT; ++j)
                {
                    if(T[j]!=S[i+j])
                        ++tmplen;
                }
                minlen = min(minlen,tmplen);
            }
        }
        cout << minlen << endl;
    }
}

Measured memory_bytes: 3560
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	int a[10];
	int mi=10,s=0;
	for(int i=0;i<5;i++) {
		cin >> a[i] ;
		if(a[i]%10!=0&&a[i]%10<mi) mi=a[i]%10;
		if(a[i]%10>0) a[i]=(a[i]/10+1)*10;
		s+=a[i] ; 
	}
	cout <<(s-10+mi) ;
	return 0;
}

Measured memory_bytes: 256
// Undone
#include <bits/stdc++.h>
#define int long long
#define double long double
#define INF 1e18
using namespace std;
signed main() {
  int N, X; cin >> N >> X;
  int cnt = 0, ans = 1;
  for (int i = 0; i < N; i++) {
    int d; cin >> d;
    cnt += d;
    if (cnt > X) break;
    ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include<algorithm>
#include<iomanip>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for(int i=m;i<(int)(n);i++)
typedef pair<int,int> pint;
typedef long long ll;
const int inf   = 1<<29;
const ll  longinf = 1LL<<60;
int dx[4]={1,0,-1,0}, dy[4]={0,1,0,-1};

int n,m,r;
int t[9],a,b,c;
int d[201][201];
bool used[201];
int ans;

void dfs(int s,int k,int dist){
  if(k==r)
    ans=min(ans,dist);
  rep(i,r+1)
    if(!used[t[i]]){
      used[t[i]]=true;
      dfs(t[i],k+1,dist+d[s][t[i]]);
      used[t[i]]=false;
      }
  }

int main(){
  cin>>n>>m>>r;
  rep(i,r)
    cin>>t[i+1];
  t[0]=0;
  rep(i,n)rep(j,n)
    d[i+1][j+1]=inf;
  rep(i,n)
    d[i+1][i+1]=0;
  rep(i,n)
    d[0][i+1]=d[i+1][0]=0;
  rep(i,m){
    cin>>a>>b>>c;
    d[a][b]=c;
    d[b][a]=c;
    }
  rep(i,n)rep(j,n)rep(k,n)
    d[j+1][k+1]=min(d[j+1][k+1],d[i+1][j+1]+d[i+1][k+1]);
  rep(i,r)
    used[t[i+1]]=false;
  used[0]=true;
  ans=inf;
  dfs(0,0,0);
  cout<<ans<<endl;
  return 0;
  }

  

Measured memory_bytes: 384
#include <iostream>
#include <vector>

using namespace std;

void solve()
{
	int n, r;
	while(cin >> n >> r, n || r)
	{
		vector<int> Vec(n);
		for(int i = 0; i < n; ++i)
		{
			Vec[i] = n - i;
		}
		while(r--)
		{
			int p, c;
			cin >> p >> c;
			vector<int> VecBuf = Vec;
			int pos = 0;
			for(int i = p - 1; i < p + c - 1; ++i)
			{
				Vec[pos] = VecBuf[i];
				++pos;
			}
			for(int i = 0; i < p - 1; ++i)
			{
				Vec[pos] = VecBuf[i];
				++pos;
			}
			for(int i = p + c - 1; i < n; ++i)
			{
				Vec[pos] = VecBuf[i];
				++pos;
			}
		}
		cout << Vec[0] << endl;
	}
}

int main()
{
	solve();
	return(0);
}

Measured memory_bytes: 1216
#include<stdio.h>
#include<stdlib.h>

#define MAX(A, B) (((A) > (B)) ? (A) : (B))

int main() {
  int a, b, c;
  scanf("%d %d %d", &a, &b, &c);
  
  if ((a == b) && (b == c)) {
    printf("%s\n", "Yes");
  }
  else {
    printf("%s\n", "No");
  }
  return 0;
}

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

int d;

int main() {
    cin >> d;

    if (d == 22)
    {
        cout << "Christmas Eve Eve Eve" << endl;    
    } else if(d == 23){
        cout << "Christmas Eve Eve" << endl;
    } else if(d == 24){
        cout << "Christmas Eve" << endl;
    } else {
        cout << "Christmas" << endl;
    }
}

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

typedef long long ll;

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

      int n; cin >> n;
      int sum = 0;
      vector<int> a(n);
      for (int i = 0; i < n; i++) {
            cin >> a[i];
            sum += a[i];
      }

      int ans = 0;
      for (int i = 1; i < n; i++) {
            if (abs(sum - a[i]*n) < abs(sum - a[ans]*n)) ans = i;
      }
      cout << ans;

      return 0;
}



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

bool cmp(char a,char b){
	return a>b;
}

int main()
{
	string x,y;
	cin >> x >> y;
	sort (x.begin(),x.end());
	sort (y.begin(),y.end(),cmp);
	if (x<y)
		cout << "Yes";
	else
		cout << "No";
	return 0;
}

Measured memory_bytes: 256
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
using namespace std;
#define INF 100000000

typedef long long ll;
typedef pair<int, int> P;

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

int main(void) {
    int N, M, r;
    while (1) {
        cin >> N >> M;
        if (N == 0 && M == 0) break;
        cin >> r;
        vector<P> students[M+1];
        for (int i = 0; i < r; i++) {
            int t, n, m, s;
            cin >> t >> n >> m >> s;
            students[m].push_back(make_pair(t, s));
        }
        for (int i = 1; i <= M; i++) {
            sort(students[i].begin(), students[i].end());
        }
        int q;
        cin >> q;
        for (int i = 0; i < q; i++) {
            int s, e, m;
            cin >> s >> e >> m;
            int time = s, cnt = 0, ans = 0;
            for (int j = 0; j < students[m].size(); j++) {
                P p = students[m][j];
                if (time <= p.first && cnt > 0) {
                    ans += min(p.first, e) - time;
                }
                time = max(s, min(p.first, e));
                cnt += p.second ? 1 : -1;
                if (time == e) break;
            }
            cout << ans << endl;
        }
    }
    return 0;
}

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

using namespace std;

int dp[100000];

int cal(int x, int y, int z) {
	return x * x + y * y + z * z + x * y + y * z + z * x;
}

int main() {
	int n; cin >> n;
	
	int cnt = 0;
	for (int i = 1; cal(i, i, i) <= n; ++i) {
		for (int j = i; cal(i, j, j) <= n; ++j) {
			for (int k = j; cnt <= n; ++k) {
				cnt = cal(i, j, k);
				if (i == j && j == k) ++dp[cnt];
				else if (i == j || j == k) dp[cnt] += 3;
				else dp[cnt] += 6;
			}
			cnt = 0;
		}
	}
	for (int i = 1; i <= n; ++i) {
		cout << dp[i] << endl;
	}
}

Measured memory_bytes: 3672
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner scanner = new Scanner(System.in);
		int N = Integer.parseInt(scanner.next());
		
		ArrayList<Integer> arrayList = new ArrayList<Integer>();
		
		for(int i=0;i<N;i++){
			arrayList.add(Integer.parseInt(scanner.next()));
		}
		
		int max = arrayList.get(0);
		int index = 0;
		for(int i=1;i<arrayList.size();i++){
			if(max < arrayList.get(i)){
				max = arrayList.get(i);
				index = i;
			}
		}
		arrayList.remove(index);
		
		int total = 0;
		for(int i=0;i<arrayList.size();i++){
			total = total + arrayList.get(i);
		}
		String ans = "";
		if(max < total)
			ans = "Yes";
		else
			ans = "No";
		
		System.out.println(ans);
	}
}

Measured memory_bytes: 22484
#include<bits/stdc++.h>
using namespace std;
const int M=2e5+5;
int a[M],b[M];
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n,k,c;
    cin>>n>>k>>c;
    string s;
    cin>>s;
    int nowi=0;
    int tot=0;
    while(nowi<n&&tot<k){
        if(s[nowi]=='x')
            nowi++;
        else{
            a[tot++]=nowi;
            nowi+=c+1;
        }
    }
    nowi=n-1;
    tot=k-1;
    while(nowi>=0&&tot>=0){
        if(s[nowi]=='x')
            nowi--;
        else{
            b[tot--]=nowi;
            nowi-=c+1;
        }
    }
    for(int i=0;i<k;i++)
        if(a[i]==b[i])
            cout<<a[i]+1<<'\n';
    return 0;
}


Measured memory_bytes: 3348
#include <stdio.h>
 
int main()
{
    int x, y, z, a, b, c;
    
    scanf("%d%d%d", &x, &y, &z);
    
    a = z;
    b = x; 
    c = y;
    
    printf("%d %d %d", a, b, c);
    
 
    return 0;
}

Measured memory_bytes: 128
#include<algorithm>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please
 
const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline ll getint() {
	ll A = 0;
	if (ci - cn + 24 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}
 
int dpA[100001], dpB[100001];
int main() {
	//cin.tie(0);
	//ios::sync_with_stdio(false);
 
 
	ll N = getint(), A = getint(), B = getint();
	ll S[100001];
	rep(i, N) S[i] = getint();
	S[N] = 3e18;
 
	const int mod = 1e9 + 7;
 
	int a = 1, b = 1;
	int ka = 0, kb = 0;
	dpA[0] = 1;
	dpB[0] = 1;
	rep(i, N - 1) {	
		while (S[i] + A > S[a]) {
			ka += (S[a - 1] + B > S[a++]);
		}
		while (S[i] + B > S[b]) {
			kb += (S[b - 1] + A > S[b++]);
		};
		ka -= (S[i + 1] - S[i] < B);
		kb -= (S[i + 1] - S[i] < A);
 
		if (S[i + 1] - S[i] >= A) {
			dpA[i + 1] = (dpA[i] + dpA[i + 1]) % mod;
			dpB[i + 1] = (dpA[i] + dpB[i + 1]) % mod;
		}
		else if (ka <= 0) dpB[a - 1] = (dpA[i] + dpB[a - 1]) % mod;
		
		if (S[i + 1] - S[i] >= B) {
			dpA[i + 1] = (dpB[i] + dpA[i + 1]) % mod;
			dpB[i + 1] = (dpB[i] + dpB[i + 1]) % mod;
		}
		else if (kb <= 0) dpA[b - 1] = (dpB[i] + dpA[b - 1]) % mod;
	}
	printf("%d\n", (dpA[N - 1] + dpB[N - 1]) % mod);
 
	Would you please return 0;
}

Measured memory_bytes: 3292
#include "bits/stdc++.h"
using namespace std;

int main() {
	long long A, B, C;
	cin >> A >> B >> C;
	if (C - A - B <= 0) cout << "No" << endl;
	else if (4 * A * B < (C - B - A) * (C - B - A)) cout << "Yes" << endl;
	else cout << "No" << endl;
}

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

int main(){
  int x,y,t;

  cin >> x >> y;

  if (x<y){
    t=x;
    x=y;
    y=t;
  }
  while (x%y){
    t=y;
    y=x%y;
    x=t;
  }

  cout << y << endl;
  
  return 0;
}

Measured memory_bytes: 3108
import sys
import math
from collections import deque
from itertools import permutations

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()
NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()


def main():
    H, W = NMI()
    C = [NLI() for _ in range(10)]
    A = [NLI() for _ in range(H)]

    for i in range(10):
        for perm in permutations("0123456789", 3):
            now = int(perm[0])
            cost = 0
            for p in perm[1:]:
                p = int(p)
                cost += C[now][p]
                now = p
            C[int(perm[0])][now] = min(C[int(perm[0])][now], cost)

    ans = 0
    for h in range(H):
        for w in range(W):
            now = A[h][w]
            if now == -1: continue
            ans += C[now][1]
    print(ans)


if __name__ == "__main__":
    main()

Measured memory_bytes: 3696
n = int(input())
li = [list(map(int,input().split())) for i in range(n)]
 
li.sort(key=lambda x: x[2])
a,b,c = li[-1]
for x in range(101):
    for y in range(101):
        h = abs(x-a) + abs(y-b) + c
        if all(k == max(h-abs(x-i)-abs(y-j),0) for i,j,k in li):
            print(x,y,h)
            exit()

Measured memory_bytes: 3064
import bisect
N,M,K = map(int,input().split())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]

bsum = [0]
for b in B:
    bsum.append(bsum[-1]+b)

ans = bisect.bisect_right(bsum,K) -1
asum = 0
for n,a in enumerate(A):
    asum += a
    if asum > K:
        break
    m = bisect.bisect_right(bsum,K-asum)
    if ans < m+n:
        ans = m+ n
print(ans)

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

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

  int m = 1;
  rep(i, M) m *= 2;

  int ans = 1900 * M + 100 * (N - M);
  ans *= m;
  cout << ans << endl;
}

Measured memory_bytes: 256
def main():
    n = int(input())

    s_dict = {}
    count = 0
    
    for i in range(n):
        s = sorted(input())
        _s = "".join(s)
        
        if not _s in s_dict:
            s_dict[_s] = 1
        else:
            count += s_dict[_s]
            s_dict[_s] += 1
    print(count)


if __name__ == '__main__':
    main()


Measured memory_bytes: 17852
#include<bits/stdc++.h>
using namespace std;
#define int long long
inline int read(){
    int x=0,f=1;char ch =getchar();
    while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}
    while(isdigit(ch))x=x*10+ch-'0',ch=getchar();
    return x*f;
}
int N,K,p,ans,t;
main(){
    N=read();K=read();
    p=N/K;
    if(K&1){printf("%lld\n",p*p*p);return 0;}
    t=(N+K/2)/K;
    printf("%lld\n",p*p*p+t*t*t);return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/range/adaptor/reversed.hpp>
#include <boost/range/algorithm/sort.hpp>
#include <atcoder/lazysegtree>
#include <atcoder/modint>

using namespace std;
using boost::sort;
using boost::adaptors::reversed;
using mint = atcoder::modint998244353;

struct S {
    mint value;
    mint size;
};
using F = long;
const F ID = 8e18;

S op(S a, S b) { return { a.value + b.value, a.size + b.size }; }
S e() { return {0, 0}; }
S mapping(F f, S x){
    if(f != ID) x.value = f * x.size;
    return x;
}
F composition(F f, F g) { return (f == ID ? g : f); }
F id() { return ID; }

int main(){
    int n, q;
    cin >> n >> q;
    std::vector<S> v(n);
    mint p = 1;
    for (int i = n - 1; i >= 0; i--) {
        v[i] = { 1, p };
        p *= 10;
    }
    atcoder::lazy_segtree<S, op, e, F, mapping, composition, id> seg(v);
    seg.apply(0, n, 1);
    for (int i = 0; i < q; i++) {
        int l, r, d;
        cin >> l >> r >> d;
        seg.apply(l - 1, r, d);
        cout << seg.all_prod().value.val() << endl;
    }
}


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

int main(){
    map<int,int>mp;
    for( int i = 0; i < 3; i++ ){
        int a; cin >> a;
        mp[a]++;
    }
    if( mp.size() == 2 ){
        cout << "Yes\n";
    }else{
        cout << "No\n";
    }
}


Measured memory_bytes: 256
#include <iostream>

void insertSort(int n, int *a) {
    int v, j;
    
    for(int i=1; i <= n-1; i++) {
        v = a[i];
        j = i - 1;
        while(j >= 0 && a[j] > v) {
            a[j+1] = a[j];
            j--;
        }
        a[j+1] = v;
        
        for(int i=0; i != n; i++) {
            if(i < n-1) std::cout << a[i] << " ";
            else std::cout << a[i] << "\n";
        }
    }
    
    
}
int main(int argc, const char * argv[]) {
    // insert code here...
    int N;
    std::cin >> N;
    int A[N];
    for(int i=0; i != N; i++) {
        std::cin >> A[i];
    }
    for(int i=0; i != N; i++) {
        if(i < N-1) std::cout << A[i] << " ";
        else std::cout << A[i] << "\n";
    }
    insertSort(N, A);
    
    return 0;
}


Measured memory_bytes: 3088
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll MOD = 1000000007;
const ll INF = 10000000000000000;
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> struct edge { int from, to; T cost;};
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){ 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; }


bool input() {
  return true;
}

void solve(){
}

int main() {
  double a,b,c; cin >>a >>b >>c;
  double S,L,h;
  h = b * sin(c/180*M_PI);
  S = a * h / 2;
  double ac = a - b * cos(c/180*M_PI);
  double cc = sqrt(ac*ac+h*h);
  L = a + b + cc;
  cout <<fixed <<setprecision(12);
  cout <<S <<endl;
  cout <<L <<endl;
  cout <<h <<endl;
}


Measured memory_bytes: 3516
#include<stdio.h>
#include<stdlib.h>
  
typedef struct{
  char mark;
  int value;
} card;
  
#define MAX 36
  
int N;
  
int isStable(card *,card *);
  
int main(){
  int i,j,minj,is;
  card C1[MAX],C2[MAX],temp;
  
  scanf("%d",&N);
  if(N<1 || N>MAX){
    exit(1);
  }
  for(i=0;i<N;i++){
    scanf(" %c%d",&C1[i].mark,&C1[i].value);
  }
  
  for(i=0;i<N;i++){
    C2[i]=C1[i];
  }
  
  //BubbleSort
  for(i=0;i<N;i++){
    for(j=N-1;j>=i+1;j--){
      if(C1[j].value<C1[j-1].value){
    temp=C1[j];
    C1[j]=C1[j-1];
    C1[j-1]=temp;
      }
    }
  }
  
  //SelectionSort
  for(i=0;i<N;i++){
    minj=i;
    for(j=i;j<N;j++){
      if(C2[j].value<C2[minj].value){
    minj=j;
      }
    }
    temp=C2[i];
    C2[i]=C2[minj];
    C2[minj]=temp;
  }
  
  //BubbleSort output
  for(i=0;i<N-1;i++){
    printf("%c%d ",C1[i].mark,C1[i].value);
  }
  printf("%c%d\n",C1[N-1].mark,C1[N-1].value);
  printf("Stable\n");
  
  is=isStable(C1,C2); //SelectionSort isStable
  
  //SelectionSort output
  for(i=0;i<N-1;i++){
    printf("%c%d ",C2[i].mark,C2[i].value);
  }
  printf("%c%d\n",C2[N-1].mark,C2[N-1].value);
  if(is==1){
    printf("Stable\n");
  }else{
    printf("Not stable\n");
  }
  
  return 0;
}
  
int isStable(card *in,card *out){
  int i;
  
  for(i=0;i<N;i++){
    if(in[i].mark!=out[i].mark){
      return 0; //false
    }
  }
  
  return 1; //true
}

Measured memory_bytes: 1808
#include <cstdio>
#include <vector>
#define repeat(i, n) for (int i = 0; (i) < int(n); ++(i))
#define repeat_from(i, m, n) for (int i = (m); (i) < int(n); ++(i))
using namespace std;
template <typename X, typename T> auto vectors(X x, T a) { return vector<T>(x, a); }
template <typename X, typename Y, typename Z, typename... Zs> auto vectors(X x, Y y, Z z, Zs... zs) { auto cont = vectors(y, z, zs...); return vector<decltype(cont)>(x, cont); }

constexpr int max_t = 1260;
int main() {
    while (true) {
        int n, m; scanf("%d%d", &n, &m);
        if (n == 0 and m == 0) break;
        auto login = vectors(m, max_t + 2, int());
        int r; scanf("%d", &r);
        while (r --) {
            int t, i, j, s; scanf("%d%d%d%d", &t, &i, &j, &s); -- i; -- j;
            login[j][t] += s ? +1 : -1;
        }
        repeat (j, m) {
            repeat (t, max_t + 1) {
                login[j][t + 1] += login[j][t];
            }
        }
        int q; scanf("%d", &q);
        while (q --) {
            int l, r, j; scanf("%d%d%d", &l, &r, &j); -- j;
            int result = 0;
            repeat_from (t, l, r) {
                result += bool(login[j][t]);
            }
            printf("%d\n", result);
        }
    }
    return 0;
}

Measured memory_bytes: 50476
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.FilterInputStream;
import java.io.BufferedInputStream;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author khokharnikunj8
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        ScanReader in = new ScanReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        abc082_b solver = new abc082_b();
        solver.solve(1, in, out);
        out.close();
    }

    static class abc082_b {
        public void solve(int testNumber, ScanReader in, PrintWriter out) {
            String s = in.scanString();
            String s1 = in.scanString();
            int array[] = new int[26];
            int array1[] = new int[26];
            int min1 = Integer.MAX_VALUE;
            int max2 = Integer.MIN_VALUE;
            for (int i = 0; i < s.length(); i++) {
                array[(int) s.charAt(i) - 97]++;
                min1 = Math.min(min1, (int) s.charAt(i) - 97);
            }
            for (int i = 0; i < s1.length(); i++) {
                array1[(int) s1.charAt(i) - 97]++;
                max2 = Math.max(max2, (int) s1.charAt(i) - 97);
            }
            if (max2 > min1) out.println("Yes");
            else if (max2 < min1) out.print("No");
            else {
                if (array[min1] != array1[min1]) {
                    if (array[min1] != s.length() || s.length() > s1.length()) out.println("No");
                    else out.println("Yes");
                } else {
                    if (array[min1] == s.length() && s.length() < s1.length()) out.println("Yes");
                    else out.println("No");
                }
            }


        }

    }

    static class ScanReader {
        private byte[] buf = new byte[4 * 1024];
        private int index;
        private BufferedInputStream in;
        private int total;

        public ScanReader(InputStream inputStream) {
            in = new BufferedInputStream(inputStream);
        }

        private int scan() {
            if (index >= total) {
                index = 0;
                try {
                    total = in.read(buf);
                } catch (Exception e) {
                    e.printStackTrace();
                }
                if (total <= 0) return -1;
            }
            return buf[index++];
        }

        public String scanString() {
            int c = scan();
            if (c == -1) return null;
            while (isWhiteSpace(c)) c = scan();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = scan();
            } while (!isWhiteSpace(c));
            return res.toString();
        }

        private boolean isWhiteSpace(int n) {
            if (n == ' ' || n == '\n' || n == '\r' || n == '\t' || n == -1) return true;
            else return false;
        }

    }
}



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

int main() {
  int n,ans=0; cin>>n;
  vector<int> a(n);
  for(int i=0; i<n; i++) cin>>a[i];
  for(int i=0; i<n; i++) {
    if(a[i]==i+1) {
      if(i==n-1) {
        swap(a[i],a[i-1]);
        ans++;
      }
      else {
        swap(a[i],a[i+1]);
        ans++;
      }
    }
  }
  cout<<ans;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define f(i,a,b) for(int i=a;i<=b;i++)
inline ll r() {
	ll x=0,f=1;
	char c=getchar();
	while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
	while(isdigit(c))x=x*10+c-'0',c=getchar();
	return x*f;
}
#define d r()
ll n,ans,now;
ll a[1000010];
int main(){
	n=d;
	f(i,1,n)a[i]=d;
	now=a[1];
	f(i,2,n){
		if(a[i]<=now)ans+=now-a[i];
		else now=a[i];
	}
	printf("%lld",ans);
	return 0;
}


Measured memory_bytes: 5308
//Let's join Kaede Takagaki Fun Club !!
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
#define all(x) x.begin(),x.end()
template<class T>
void dmp(T a){
	rep(i,a.size()) cout << a[i] << " ";
	cout << endl;
}
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;
}
template<class T>
void g(T &a){
	cin >> a;
}
template<class T>
void o(const T &a,bool space=false){
	cout << a << (space?' ':'\n');
}
//ios::sync_with_stdio(false);
const ll mod = 1000000007;//998244353
template<class T>
void add(T&a,T b){
	a+=b;
	if(a >= mod) a-=mod;
}
ll modpow(ll x,ll n){
	ll res=1;
	while(n>0){
		if(n&1) res=res*x%mod;
		x=x*x%mod;
		n>>=1;
	}
	return res;
}
ll F[200005],R[200005];
void make(){
	F[0] = 1;
	for(int i=1;i<200005;i++) F[i] = F[i-1]*i%mod;
	for(int i=0;i<200005;i++) R[i] = modpow(F[i],mod-2);
}
ll C(int a,int b){
	return F[a]*R[b]%mod*R[a-b]%mod;
}
int n, sub[200005];
ll dp[200005];
vector<int>edge[200005];

void dfs(int v,int u){
	dp[v] = 1;
	for(auto to:edge[v]){
		if(to == u) continue;
		dfs(to, v);
		dp[v] = dp[v] * dp[to] % mod * R[sub[to]] % mod;
		sub[v] += sub[to];
	}
	dp[v] = dp[v] * F[sub[v]] % mod;
	//cout << v << " " << sub[v] << " " << dp[v] << endl;
	sub[v]++;
}
ll ans[200005];
void dfs2(int v,int u,ll w,int s){
	int sum = sub[v]-1;
	ll cur = R[s] * w % mod;
	for(auto to:edge[v]){
		if(to == u) continue;
		cur = cur*R[sub[to]]%mod*dp[to]%mod;
	}
	if(v != 1) ans[v] = cur * F[sum+s] % mod;
	for(auto to:edge[v]){
		if(to == u) continue;
		ll way = F[sum-sub[to]+s] * cur % mod * F[sub[to]] % mod * modpow(dp[to],mod-2) % mod;
		dfs2(to, v, way, sum-sub[to]+s+1);
	}
}
int main(){
	make();
	ios::sync_with_stdio(false);
	g(n);
	rep(i,n-1){
		int a,b; g(a); g(b);
		edge[a].pb(b);
		edge[b].pb(a);
	}
	dfs(1, -1);
	ans[1] = dp[1];
	dfs2(1, -1, 1, 0);
	repn(i,n) o(ans[i]);
}

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

namespace Main
{
    class Program
    {
        static void Main(string[] args)
        {
            //ここから
            //string[] str = Console.ReadLine().Split(' ');
            //int n = int.Parse(Console.ReadLine());

            long n = long.Parse(Console.ReadLine());

            long sum = 0;
            for (long i = 1; i <= n; i++)
            {
                if(i%3!=0 && i % 5 != 0) { sum += i; }
            }

            Console.WriteLine(sum);

            //ここまで
        }
    }

}


Measured memory_bytes: 27532
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <numeric>
#include <ctime>
#include <complex>
#include <bitset>
#include <random>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
 
#define int ll
#define double ld
#define loop(i, n) for(int i = 0; i < (int)n; ++i)
#define loop1(i, n) for(int i = 1; i <= (int)n; ++i)
#define F first
#define S second
#define pb push_back
#define pi pair <int, int>
#define all(x) begin(x), end(x)
#define ti tuple <int, int, int>
#define Point Vect
#define no {cout << "No\n"; return;}

const double PI = 3.1415926535;

void solve() {
    double x; cin >> x;
    cout << fixed << setprecision(10) << 2 * PI * x;
}

signed main(){
   ios::sync_with_stdio(false);
   cin.tie(0);
   cout.tie(0);
   //int t; cin >> t; loop(i, t)
   solve();
   return 0;
}

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

int main() {
  const int MAX=1e5+10;
  int n,q;
  cin>>n>>q;
  string str;
  cin>>str;
  str+=' ';
  vector<int> a(MAX,0),s(MAX,0);
  for(int i=0;i<n;i++) {
    if(str[i]=='A'&&str[i+1]=='C') a[i+1]=1;
  }
  for(int i=0;i<MAX;i++) s[i+1]=s[i]+a[i];
  int l,r;
  for(int i=0;i<q;i++) {
    cin>>l>>r;
    cout<<s[r]-s[l]<<endl;
  }
}


Measured memory_bytes: 4204
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.Arrays;

public class Main {
  public static void main(String[] args) throws IOException{
    String[] strs;
    String[] list = null;
    try(BufferedReader br 
        = new BufferedReader(new InputStreamReader(System.in))
    ){
      strs = br.readLine().split(" ");
      int N = Integer.parseInt(strs[0]);
      list = new String[N];
      for (int i = 0; i < N; i++) {
        list[i] = br.readLine();
      }
    }
    
    Arrays.sort(list);
    
    for (String s : list) {
      System.out.print(s);
    }
  }
}

Measured memory_bytes: 21332
N = int(input())
a = list(map(int, input().split()))
color = [0] * 9
for p in a:
    if p >= 3200: color[8] += 1
    else: color[p // 400] += 1
small = len([c for c in color[0:8] if c > 0])
big = small + color[8]
if not small: small += 1
print(small, big)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
typedef long long ll;
#define pb push_back
#define fi first
#define se second
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
template <class T, class U> ostream &operator<<(ostream &os, const pair<T, U> &p){os<<"("<<p.first<<","<< p.second<<")";return os;}
template <class T> ostream &operator<<(ostream &os, const vector<T> &v){os<<"{";REP(i,(int)v.size()){if(i)os<<",";os<<v[i];}os<<"}";return os;}
template <typename T, size_t S> void printArray(const T (&array)[S]){for(auto val : array)std::cout << val << ", ";std::cout << "\n";}
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}
const double PI=acos(-1);
const ll MOD = 1000000007;
using Graph = vector<vector<int>>;
template<class T>inline bool chmax(T& a, T b){if(a < b){a = b; return 1;}return 0;}
template<class T>inline bool chmin(T& a, T b){if(a > b){a = b; return 1;}return 0;}
const ll INF = 1LL<<60;
//const int dx[4] = {1, 0, -1, 0};
//const int dy[4] = {0, 1, 0, -1};
//const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
//const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

void solve(){
    ll n; cin >> n;
    vector<ll> h(n);
    REP(i, n) cin >> h[i];
    ll res = 0;
    while(*max_element(ALL(h)) > 0){
        for(int i=0; i<n; i++){
            if(h[i] != 0){
                res++;
                while(i < n){
                    if(h[i] != 0){
                        h[i]--;
                        i++;
                    }
                    else break;
                }
            }
        }
    }
    cout << res << endl;
}

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

Measured memory_bytes: 256