akhauriyash/Code-Regression huggingface dataset:
#pragma warning(disable:4996)
#include <bits/stdc++.h>

using namespace std;

//macro
#define FOR(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define EPS (1e-8)
#define equals(a,b)(fabs((a)-(b))<EPS)

using ll = long long;
using ull = unsigned long long;
using vb = vector<bool>;
using vi = vector<int>;
using vll = vector<ll>;
using vs = vector<string>;
using vvb = vector<vb>;
using vvi = vector<vi>;
using vvll = vector<vll>;
//func
template<typename A, typename T>void assign2d(A&arr, ll H, ll W, T t) { arr.resize(H); REP(i, H) arr[i].assign(W, t); }
template<class T> ostream &operator<<(ostream &os, const vector<T> &v) { int n = v.size(); REP(i, n)os << v[i] << (i == n - 1 ? "" : " "); return os; }
template <class T = int> inline T IN() { T x; cin >> x; return x; }
template<class T> inline void OUT(const T &x) { cout << x << "\n"; }
void YESNO(bool c) { OUT(c ? "YES" : "NO"); };
void YesNo(bool c) { OUT(c ? "Yes" : "No"); };
struct pre_ { pre_() { cin.tie(nullptr); ios::sync_with_stdio(false); /*cout << fixed << setprecision(6);*/ } } pre__;

int main() {
	int A, B;
	cin >> A >> B;
	OUT(A*B % 2 ? "Odd" : "Even");
}

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

using namespace std;
using LL = long long int;

const int MAX_N = 300005;

int N;
int D[MAX_N];
bool DUsed[MAX_N];

int main()
{
  cin >> N;
  for(int i = 0; i < N; i++) {
    cin >> D[i];
  }

  int M = 0;
  for(int i = 0; i < N; i++) {
    if(i <= M) {
      M = max(M, i + D[i]/10);
    } else {
      cout << "no" << endl;
      return 0;
    }
  }

  M = N-1;
  for(int i = N-1; 0 <= i; i--) {
    if(i >= M) {
      M = min(M, i-D[i]/10);
    } else {
      cout << "no" << endl;
      return 0;
    }
  }

  cout << "yes" << endl;

  return 0;
}

Measured memory_bytes: 4252
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) debug(x) debug(y);
#define repn(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, a) for(int i = 0; i < (int)(a); i++)
#define all(v) v.begin(), v.end() 
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define sq(x) ((x) * (x))

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

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	//freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
	string s;
	cin >> s;
	int n = s.size();
	if(n & 1){
		cout << "No" << endl;
		return 0;
	}
	int f = 1;
	for(int i = 0; i < n; i += 2){
		if(s[i] != 'h' || s[i + 1] != 'i'){
			f = 0;
			break;
		}
	}
	if(f) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}
/*
Things to look out for:
	- Integer overflows
	- Array bounds
	- Special cases
Be careful!
*/


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

int bubbleSort(int A[], int n){
    bool flag = 1;
    int sw = 0;
    while(flag) {
        flag = 0;
        for(int j = n - 1; j >= 1; j--) {
            if(A[j] < A[j - 1]) {
                int temp = A[j];
                A[j] = A[j - 1];
                A[j - 1] = temp;
                flag = 1;
                sw++;
            }
        }
    }
    return sw;
}

int main() {
    int A[100], n;

    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> A[i];
    }
    int sw = bubbleSort(A, n);

    for(int i = 0; i < n; i++) {
        if(i) cout << " ";
        cout << A[i];
    }
    cout << endl;
    cout << sw << endl;
    return 0;
}

Measured memory_bytes: 1160
import math

k = int(input())
gcd_list = []
for i in range(1, k+1):
    for j in range(1, k+1):
        gcd_list.append(math.gcd(i, j))

sum_num = 0
for i in gcd_list:
    for j in range(1, k+1):
        sum_num += math.gcd(i, j)
print(sum_num)


Measured memory_bytes: 71160
s = input()
k = int(input())


new_s = s + "#"
n = len(new_s)
i = 0
j = 1
cnt = 1
ans = 0
while True:
    if j >= n:
        break
    if new_s[i] == new_s[j]:
        cnt += 1
        j += 1
        continue
    if new_s[i] != new_s[j]:
        ans += cnt // 2
        cnt = 1
        i = j
        j = i + 1
        
ans1 = ans
t = 2*s + "#"
n = len(t)
i = 0
j = 1
cnt = 1
ans2 = 0
while True:
    if j >= n:
        break
    if t[i] == t[j]:
        cnt += 1
        j += 1
        continue
    if t[i] != t[j]:
        ans2 += cnt // 2
        cnt = 1
        i = j
        j = i + 1


t = 3*s + "#"
n = len(t)
i = 0
j = 1
cnt = 1
ans3 = 0
while True:
    if j >= n:
        break
    if t[i] == t[j]:
        cnt += 1
        j += 1
        continue
    if t[i] != t[j]:
        ans3 += cnt // 2
        cnt = 1
        i = j
        j = i + 1

tmp1 = ans2 - ans1
tmp2 = ans3 - ans2
ans = ans1 
k = k - 1
ans = ans + tmp1*(k - k//2) + tmp2*(k//2)
print(ans)


Measured memory_bytes: 38256
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <cmath>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <iostream>
#include <random>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include <fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;

using ll = long long;
using vll = vector<ll>;
using pll = pair<ll, ll>;
using qll = queue<ll>;
using vb = vector<bool>;
using mll = map<ll, ll>;
using sll = stack<ll>;
#define REP(i,n) for(ll i(0);(i)<(n);(i)++)
#define rep(i,n) for(ll i(0);(i)<(n);(i)++)
#define ALL(a) a.begin(), a.end()
#define enld endl //* missspell check
const ll INF = 1LL << 60;


void solve(long long N, long long M, std::vector<long long> p, std::vector<std::string> S){
    ll correct = 0, penaly = 0;
    vll rec(N, 0), pen(N, 0);
    REP(i, M){
        if(rec[p[i]]==1){ //* already correct
            continue;
        }
        else{ //* not correct yet
            if(S[i] == "AC"){
                rec[p[i]]=1;
            }
            else{
                pen[p[i]]++;
            }
        }
    }
    REP(i, N){
        correct += rec[i];
        if(rec[i])
            penaly += pen[i];
    }
    cout << correct << " "<<penaly<<endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    long long M;
    scanf("%lld",&M);
    std::vector<long long> p(M);
    std::vector<std::string> S(M);
    for(int i = 0 ; i < M ; i++){
        scanf("%lld",&p[i]);
        p[i]--;
        std::cin >> S[i];
    }
    solve(N, M, std::move(p), std::move(S));
    return 0;
}


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

using namespace std;

#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define pb emplace_back
#define ll long long
#define ld long double

const int INF = 2e9 + 1;
const ll INFLL = 1e18 + 1;
const int mod = 1e9 + 7;

int check(string s) {
    int n = s.size();
    int dp[n][10][2];
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < 10; j++) {
            dp[i][j][0] = dp[i][j][1] = 0;
        }
    }
    for (int j = 0; j < 10; j++) {
        if (j < s[0] - '0') dp[0][j][1] = 1;
        if (j == s[0] - '0') dp[0][j][0] = 1;
    }
    for (int i = 1; i < n; i++) {
        for (int j = 0; j < 10; j++) {
            if (j == s[i] - '0') {
                dp[i][j][0] = (j > 0 ? dp[i - 1][j - 1][0] : 0) + (j < 9 ? dp[i - 1][j + 1][0] : 0) + dp[i - 1][j][0];
            }
            dp[i][j][1] = (j > 0 ? dp[i - 1][j - 1][1] : 0) + (j < 9 ? dp[i - 1][j + 1][1] : 0) + dp[i - 1][j][1];
            if (j < s[i] - '0') dp[i][j][1] += (j > 0 ? dp[i - 1][j - 1][0] : 0) + (j < 9 ? dp[i - 1][j + 1][0] : 0) + dp[i - 1][j][0];
            if (j > 1) dp[i][j][1]++;
        }
    }
    int ans = 0;
    for (int j = 0; j < 10; j++) ans += dp[n - 1][j][1];
    ans--;
    return ans;
}

bool good(ll x) {
    vector<int> a;
    while (x > 0) {
        a.pb(x % 10);
        x /= 10;
    }
    for (int i = 0; i < (int)a.size() - 1; i++) {
        if (abs(a[i] - a[i + 1]) > 1) return 0;
    }
    return 1;
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int k;
    cin >> k;
    k--;
    ll left = 0, right = 3234566667;
    while (right - left > 1) {
        ll mid = (left + right) / 2;
        int cnt = check(to_string(mid));
        if (cnt > k || (cnt == k && good(mid))) right = mid;
        else left = mid;
    }
    cout << right;
    return 0;
}


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

int main(void){
    int a,b;
    string s,ans="Yes";
    cin>>a>>b>>s;
    for(int i=0; i<a+b+1; i++){
        if( (s[i]=='-' && i!=a)||(s[i]!='-' && i==a)){
            ans = "No";
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<bitset>
#include<deque>
#include<functional>
#include<iterator>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<utility>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define a first
#define b second
#define sz(x) (ll)((x).size())
#define pb push_back
#define mp make_pair
#define bg begin()
#define ed end()
#define all(x) (x).bg,(x).ed
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep1(i,n) for(ll i=1;i<=(n);i++)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(ll i=(n);i>=1;i--)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
const ll MOD=1000000007;
const ll INF=1000000000000000;
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;}
ll maxx(ll x,ll y,ll z){return max(max(x,y),z);}
ll minn(ll x,ll y,ll z){return min(min(x,y),z);}
ll gcd(ll x,ll y){if(x%y==0) return y;else return gcd(y,x%y);}
ll lcm(ll x,ll y){return x*(y/gcd(x,y));}
ll digsz(ll x){if(x==0) return 1;else{ll ans=0;while(x){x/=10;ans++;}return ans;}}
ll digsum(ll x){ll sum=0;while(x){sum+=x%10;x/=10;}return sum;}
vector<ll> pw2(62,1);vector<ll> pw10(19,1);


int main(){
    {rep1(i,61) pw2[i]=2*pw2[i-1];}
    {rep1(i,18) pw10[i]=10*pw10[i-1];}
    
    ll K; cin>>K;
    string s; cin>>s;
    if(sz(s)<=K) cout<<s<<endl;
    else{
        rep(i,K) cout<<s[i];
        cout<<"...";
    }
    
}



Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++) {
     cin >> A.at(i);
  }
  int prev = -1;
  int ans = 0;
  for (int x: A) {
    if (x == prev) {
      ans += 1;
      prev = -1;
    } else {
      prev = x;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
N,M=map(int,input().split())
box=[1 for _ in range(N)]
ans=[0 for _ in range(N)]
ans[0]=1
for i in range(M):
    x,y=map(int,input().split())
    box[x-1]-=1
    box[y-1]+=1
    if ans[x-1]==1:
        ans[y-1]=1
    if box[x-1]==0:
        ans[x-1]=0
print(sum(ans))

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

namespace ConsoleApp10
{
    class Program
    {
        static void Main(string[] args)
        {
            Calc calc = new Calc();

            string week = Console.ReadLine();
            int n, debt;

            n = int.Parse(week);
            debt = 100000;
   

            for (int i = 0; i < n; i++)
            {
                debt = calc.Interest(debt); 
            }

            Console.WriteLine(debt);
        }
    }

    class Calc
    {
        internal int Interest(int debt)
        {
            double interest = 1.05;
            int round_up = 1000;

            int debt2 = (int)(debt * interest);
            decimal ceiling = Math.Ceiling((decimal) debt2 / (decimal)round_up);
            debt = (int)ceiling * round_up;

            return debt;
        }


    }
}


Measured memory_bytes: 15916
#include<bits/stdc++.h>
using namespace std;
using p=pair<int,int>;
#define int long long
#define rep(i,N) for(int i=0;i<N;i++)

signed main(){
  string S;
  cin>>S;
  for(int i=0;i>-1;i++){
    S.pop_back();
    string x=S.substr(0,S.size()/2);
    string y=S.substr(S.size()/2,S.size()-1);
    if(x==y){
      cout<<S.size()<<endl;
      return 0;
    }
  }
}

Measured memory_bytes: 3592
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Math;

class MainClass
{
    static void Main()
    {
        var NK = ReadLine().Split().Select(int.Parse).ToArray();
        int N = NK[0];
        int K = NK[1];
        var A = ReadLine().Split().Select(long.Parse).ToArray();
        Array.Sort(A);

        var max = new Modular();
        var min = new Modular();

        for (int i = 0; i < N-K+1; i++)
        {
            min += Modular.Ncr(N - i - 1, K - 1) * A[i];
        }
        for (int i = K-1; i < N; i++)
        {
            max += Modular.Ncr(i, K - 1) * A[i];
        }
        var ans = max - min;
        WriteLine((int)ans);
    }
}
class Modular  //Modしながら計算するクラス
{
    private const int M = 1000000007;
    private long value;
    public Modular(long value = 0) { this.value = value; }
    public static implicit operator Modular(long a)
    {
        var m = a % M;
        return new Modular((m < 0) ? m + M : m);
    }
    public static Modular operator +(Modular a, Modular b)
    => a.value + b.value;
    public static Modular operator -(Modular a, Modular b)
    => a.value - b.value;
    public static Modular operator *(Modular a, Modular b)
    => a.value * b.value;
    public static Modular Pow(Modular a, int n)
    {
        switch (n)
        {
            case 0:
                return 1;
            case 1:
                return a;
            default:
                var p = Pow(a, n / 2);
                return p * p * Pow(a, n % 2);
        }
    }
    public static Modular operator /(Modular a, Modular b)
    {
        return a * Pow(b, M - 2);
    }
    private static readonly List<int> facs = new List<int> { 1 };
    public static Modular Fac(int n)   //階乗
    {
        for (int i = facs.Count; i <= n; ++i)
        {
            facs.Add((int)(Math.BigMul(facs.Last(), i) % M));
        }
        return facs[n];
    }
    public static Modular Fac(int r, int n)
    {
        int temp = 1;
        for (int i = r; i <= n; i++)
        {
            temp = (int)(Math.BigMul(temp, i) % M);
        }
        return temp;
    }
    public static Modular Ncr(int n, int r) //nCr
    {
        return (n < r) ? 0
             : (n == r) ? 1
                        : (n < 1000000) ? Fac(n) / (Fac(r) * Fac(n - r))
                            : Fac(n - r + 1, n) / Fac(r);
    }
    public static explicit operator int(Modular a)
    {
        return (int)a.value;
    }
}

Measured memory_bytes: 56200
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <cstdlib>
using namespace std;
#define Ma_PI 3.141592653589793
#define eps 0.00000001
#define LONG_INF 3000000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define REP(i,n) for(long long i = 0;i < n;++i)
#define seg_size 524288
int main() {
	long long n;
	cin >> n;
	vector<long long> pew;
	REP(i, n) {
		long long now;
		cin >> now;
		pew.push_back(now);
	}
	long long mini = 2;
	long long maxi = 3;
	if (pew[n - 1] != 2) {
		cout << -1 << endl;
		return 0;
	}
	for (int i = n - 2;i >= 0;--i) {
		long long next_min = ((mini+pew[i]-1)/ pew[i])* pew[i];
		long long next_max = ((maxi) / pew[i])*pew[i] + pew[i] - 1;
		if (next_min > maxi) {
			cout << -1 << endl;
			return 0;
		}
		mini = next_min;
		maxi = next_max;
	}
	cout << mini << " " << maxi << endl;
	return 0;
}

Measured memory_bytes: 1400
#include <algorithm>
#include <functional>
#include <iostream>
#include <set>
#include<iomanip>
#include<queue>
#include <string>

using namespace std;
int64_t gcd(int64_t a,int64_t b){
	if(a==0){
		return b;
	}else if(b==0){
		return a;
	}
	if(a>=b){
		return gcd(a%b,b);
	}else{
		return gcd(b%a,a);
	}
}
int main() {
	int64_t n;
	cin>>n;
	int64_t a1,a2;
	cin>>a1>>a2;
	int64_t ans=gcd(a1,a2);
	for(int64_t i=2;i<n;i++){
		int64_t temp;
		cin>>temp;
		ans = gcd(ans,temp);
	}
	cout<<ans<<endl;

	return 0;

}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <iomanip>
#include <map>
#include <set>
#include <tuple>
#include <unordered_map>
#include <iterator>
#include <string>
#include <limits>

using namespace std;

using i64 = int64_t;
using P = pair<i64, i64>;
//i64 mod = 1000000007;
i64 mod = 998244353;
int int_max = 2147483647;
i64 INF = 1e16;
int max_n = 1e5;

int main(int argc, char **argv) {
    i64 n;
    cin >> n;

    vector<i64> as(n), bs(n);
    for (i64 i=0; i<n; ++i) {
        cin >> as[i] >> bs[i];
    }
    
    std::sort(as.begin(), as.end());
    std::sort(bs.begin(), bs.end(), std::greater<i64>());

    i64 ans{0};

    if (n % 2 == 0) {
        i64 left = as[n/2-1] + as[n/2];
        i64 right = bs[n/2-1] + bs[n/2];
        ans = (right - left) + 1;
    } else {
        i64 left = as[n/2];
        i64 right = bs[n/2];
        ans = right-left+1;
    }

    cout << ans << endl;

    return 0;
}


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

if 0 in a:
    print(0)
else:

    ans = 1
    i = 0
    while (i <= n - 1):
        if ans <= 10 ** 18:
            ans *= a[i]
            i += 1
        else:
            break

    #print(i)
    if ans <= 10 ** 18:
        print(ans)
    else:
        print(-1)


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

int main(){
    ll n;
    ll res = 0;
    cin >> n;
    vector<string> s(n);
  	unordered_map<string,ll> um(n);
    rep(i,n) {
        cin >> s[i];
        sort(s[i].begin(),s[i].end());
    }
    rep(i,n){
    	um[s[i]] += 1;
      	res += um[s[i]] -1;
    }
    cout << res << endl;
}

Measured memory_bytes: 17536
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class T> inline T sqr(T x) {return x*x;}

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;

#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair
#define each(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define exist(s,e) ((s).find(e)!=(s).end())
#define range(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  range(i,0,n)
#define clr(a,b) memset((a), (b) ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

const double eps = 1e-10;
const double pi  = acos(-1.0);
const ll INF =1LL << 62;
const int inf =1 << 30;

int a[110];

int main(void){
	int t;
	cin >> t;
	rep(i,t){
		int n;
		cin >> n;
		rep(j,n) cin >> a[j];
		int up=0,down=0;
		rep(i,n-1){
			if(a[i+1]>a[i])
				up=max(up,a[i+1]-a[i]);
			else
				down=max(down,a[i]-a[i+1]);
		}
		cout << up << " " << down << endl;
	}
	return 0;
}

Measured memory_bytes: 1156
#include<bits/stdc++.h>
#define llong long long
#define mkpr make_pair
#define pii pair<int,int>
#define riterator reverse_iterator
using namespace std;

inline int read()
{
	int x = 0,f = 1; char ch = getchar();
	for(;!isdigit(ch);ch=getchar()) {if(ch=='-') f = -1;}
	for(; isdigit(ch);ch=getchar()) {x = x*10+ch-48;}
	return x*f;
}

const int N = 2e3;
struct Edge
{
	int v,nxt;
} e[(N<<1)+3];
int fe[N+3];
int fa[N+3][N+3];
int f[N+3][N+3];
int n,m,en,ans;

void addedge(int u,int v)
{
	en++; e[en].v = v;
	e[en].nxt = fe[u]; fe[u] = en;
}

void dfs1(int rt,int u)
{
	for(int i=fe[u]; i; i=e[i].nxt)
	{
		int v = e[i].v; if(v==fa[rt][u]) continue;
		fa[rt][v] = u;
		dfs1(rt,v);
	}
}

void addedgeg(int u,int v)
{
	if(f[u][v]==v||f[v][u]==u) {return;}
//	printf("addedgeg %d %d %d %d\n",u,v,f[u][v],f[v][u]);
	if(f[u][v]!=u) {addedgeg(f[u][v],v); return;}
	if(f[v][u]!=v) {addedgeg(u,f[v][u]); return;}
	f[u][v] = v,f[v][u] = u;
	vector<pii> ext; queue<int> que;
	que.push(v);
	while(!que.empty())
	{
		int cu = que.front(); que.pop();
		for(int i=fe[cu]; i; i=e[i].nxt)
		{
			int cv = e[i].v; if(cv==fa[u][cu]) continue;
			if(f[u][cv]==u) {f[u][cv] = v; que.push(cv);}
			else {ext.push_back(mkpr(v,cv));}
		}
	}
	que.push(u);
	while(!que.empty())
	{
		int cu = que.front(); que.pop();
		for(int i=fe[cu]; i; i=e[i].nxt)
		{
			int cv = e[i].v; if(cv==fa[v][cu]) continue;
			if(f[v][cv]==v) {f[v][cv] = u; que.push(cv);}
			else {ext.push_back(mkpr(u,cv));}
		}
	}
	for(int i=0; i<ext.size(); i++)
	{
		addedgeg(ext[i].first,ext[i].second);
	}
}

void dfs2(int rt,int u,int prv)
{
	if(u!=rt && f[prv][u]==u) {ans++; prv = u;}
	for(int i=fe[u]; i; i=e[i].nxt)
	{
		int v = e[i].v; if(v==fa[rt][u]) continue;
		dfs2(rt,v,prv);
	}
}

int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1; i<n; i++) {int u,v; scanf("%d%d",&u,&v); addedge(u,v); addedge(v,u);}
	for(int i=1; i<=n; i++)
	{
		dfs1(i,i);
	}
	for(int i=1; i<=n; i++) for(int j=1; j<=n; j++) f[i][j] = i;
	for(int i=1; i<=m; i++)
	{
		int x,y; scanf("%d%d",&x,&y);
		addedgeg(x,y);
	}
	for(int i=1; i<=n; i++)
	{
		dfs2(i,i,i);
	}
	printf("%d\n",ans>>1);
	return 0;
}

Measured memory_bytes: 32128
#include <cstdio>

int main()
{
    int a, b, c;
    scanf("%d %d %d", &a, &b, &c);
    if ((a + b == c) or (b + c == a) or (c + a == b))
    {
    	printf("Yes");
	}
	else 
	{
		printf("No");
	}
}

Measured memory_bytes: 1728
package main

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

func main() {
	var (
		s string
		w int
	)
	fmt.Scan(&s, &w)

	var wr = bufio.NewWriter(os.Stdout)
	for i := 0; i < len(s); i += w {
		wr.WriteString(string(s[i]))
	}
	wr.WriteString("\n")
	wr.Flush()
}


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


const int maxn = 2e5 + 5;
char s[maxn];
int a[maxn], suf[maxn], n, m[2020];
const int mod = 2019;
int main() {
    cin >> (s + 1);
    int n = strlen(s + 1);
    int cnt = 0;
    int base = 1;
    m[0]++;
    for (int i = n; i >= 1; --i) {
        a[i] = s[i] - '0';
        suf[i] = (suf[i + 1] + a[i] * base) % mod;
        cnt += m[suf[i]];
        m[suf[i]]++;
        base = base * 10 % mod;
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 5336
k,n = map(int, input().split())
lst = list(map(int, input().split()))

maxDis = (k-lst[-1]) + lst[0]
for i in range(n-1):
  if lst[i+1] - lst[i] > maxDis:
    maxDis = lst[i+1] - lst[i]
print(k-maxDis)

Measured memory_bytes: 26100
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin>>N;
  vector<int> a(N+1,0);
  for(int i=1;i<N+1;i++){
    cin>>a.at(i);
  }//代入
  vector<int> b(N+1,0);
  /*for(int i=1;i<N+1;i++){
    for(int j=1;j<N+1;j++){
      if(a.at(j)==i){
        b.at(i)=j;
      }
    }
  }*///ここがO(n^2)でTLE
  for(int i=1;i<N+1;i++){
    b.at(a.at(i))=i;
  }//いつ出席番号何番の生徒が来たか記録
  for(int i=1;i<N+1;i++){
    cout<<b.at(i);
    if(i!=N){
    cout<<" ";
     }
  }
  cout<<endl;
}


Measured memory_bytes: 3932
tanni=("","Man","Oku","Cho","Kei","Gai","Jo","Jou","Ko","Kan","Sei","Sai","Gok","Ggs","Asg","Nyt","Fks","Mts")
while 1:
    m,n=map(int,input().split())
    if m==0:break
    q=m**n
    a=""
    for c in tanni:
        q,m=divmod(q,10000)
        if m:
            a=str(m)+c+a
    print(a)


Measured memory_bytes: 5600
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val aList = readLine()!!.split(' ').map(String::toLong)
    val aSet = aList.toSet()
    if (aList.size == aSet.size) {
        println("YES")
    } else {
        println("NO")
    }
}

Measured memory_bytes: 72344
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i < (int)(n); i++)
using P = pair<int, int>;
int main(){
	int n;
    cin >> n;
    int ans=0, a;
    rep(i,n){
        cin >> a;
        ans += a - 1;
    }
 cout << ans << endl;	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        String n = scan.next();
        for(int i = 0; i < n.length(); i++){
            if(n.charAt(i) == '7'){
                System.out.println("Yes");
                System.exit(0);
            }
        }
        System.out.println("No");
    }
}

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

typedef pair<long long,long long> pii;

long long H,W;
long long ans = 10e10;

pii pro(long long w,long long h)
{
    pii res;
    if(w*h%2==0)
    {
        res.first=res.second=w*h/2;
        return res;
    }
    if(w==1||h==1)
    {
        res.first=w*h/2+1;
        res.second=w*h/2;
        return res;
    }
    long long hh=min(w,h);
    long long ww=max(w,h);
    res.first=(hh*(ww/2+1));
    res.second=(hh*(ww/2));
    return res;
}

void solve()
{
    for(long i = 1; i < W; i++)
    {
        pii res=pro(W-i,H);
        ans=min(ans,max(i*H,res.first)-min(i*H,res.second));
    }
    for(long i = 1; i < H; i++)
    {
        pii res=pro(H-i,W);
        ans=min(ans,max(i*W,res.first)-min(i*W,res.second));
    }
    printf("%ld\n",ans);
    return;
}

int main()
{
    scanf("%ld%ld",&H,&W);
    solve();
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define rng(i, l, r) for (size_t i = (l); i < (r); ++i)
#define rep(i, n) rng(i, 0, n)
#define gnr(i, l, r) for (size_t i = (r)-1; i >= (l); i--)
#define per(i, b) gnr(i, 0, b)
#define ALL(obj) (obj).begin(), (obj).end()    //1,2,3,...
#define rALL(obj) (obj).rbegin(), (obj).rend() //...,3,2,1
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
using namespace std;
const int INF = 1e18;

void solve()
{

    // remove the bottom 3 lines when you submit this code.
    std::ifstream in("sample.txt");
    std::cin.rdbuf(in.rdbuf());

    cin.tie(0);
    ios::sync_with_stdio(false);

    int x;
    cin >> x;
    int ans = 2 * (x / 11);
    int amari = x % 11;

    if (amari == 0)
    {
        //do nothing
    }
    else if (amari <= 6)
        ans++;
    else
        ans += 2;

    cout << ans << endl;
}

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


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cassert>
#include <string>
#include <algorithm>
#include <vector>
#include <valarray>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <iomanip>
#include <map>
#include <set>
#include <list>
#include <limits>
#include <numeric>
#include <utility>
#include <deque>
#include <unordered_set>
#include <unordered_map>
#include <regex>
#include <array>
#include <bitset>
#include <complex>
#include <tuple>
#include <random>

using namespace std;
using ll = long long;
const int INF = 1e9;
const ll MOD = 1e9 + 7;

int main()
{
  int n, a, b;
  cin >> n >> a >> b;
  cout << min(b, n * a) << endl;

  return 0;
}


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


int main() {
int N,M,C;
  cin >> N>>M>>C;
  vector<int> B(M);
  for(int i=0;i<M;i++) cin >>B[i];
  int ans =0;
  for(int i=0;i<N;i++){
	vector<int> A(M);
    for(int j=0;j<M;j++) cin >> A[j];
    int wa = 0;
    for(int j=0;j<M;j++){
     int s = A[j]*B[j];
      wa += s;
    }
    if(wa + C >0) ans++;
  }
  printf("%d\n",ans);
}
  


Measured memory_bytes: 256
/*
これを入れて実行
g++ code.cpp
./a.out
 */
 
#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
#include <bitset>
#include <functional>
 
using namespace std;
typedef long long ll;
typedef long double ld;
 
int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
 
const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;
 
bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}
 
ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a % b);
}
 
ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}
 
ll nCr(ll n, ll r){
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return (nCr(n - 1, r) + nCr(n - 1, r - 1));
}
 
ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}
 
//-----------------------ここから-----------
int main(void){
    int n, m;
    cin >> n >> m;
    int ans = 1;
    if(n == 1){
        cout << m << endl;
        return 0;
    }
    for(int i = 2; i * n <= m; i++){
        if(m % i == 0){
            ans = i;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
int abs(int a,int b){
  int c=max(a,b)-min(a,b);
  return c;
}
int d[1000];
int c[1000];
signed main(){
  cin.tie(NULL);
  ios::sync_with_stdio(false);
  string a,b;
  int z=0,x=0;
  cin>>a>>b;
  for(int i=0;i<a.size()+b.size();i++){
    if(i%2==0){
      cout<<a[z];
      z++;
    }
    else {
      cout<<b[x];
      x++;
    }
  }
  cout<<"\n";
}
    


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

int main() {
  int n;
  string s;
  cin >> n;
  cin >> s;

  string ans;

  for(int i=0; i<s.size(); ++i) {
    unsigned int a = (unsigned int)s[i] + n;
    if(a>90) {
      unsigned int b = a - 26;
      ans.push_back((char)b);
    } else {
      ans.push_back((char)a);
    }
  }
  cout << ans << endl;
  return 0;
}

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

const int mod = 1000000007;

long long power(int a, int b) {
	if (!b) return 1;
	long long tmp = power(a, b >> 1);
	return b & 1 ? tmp * tmp % mod * a % mod : tmp * tmp % mod;
}

int main () {
	int n; cin >> n;
	long long ans = (power(10, n) - power(9, n) - power(9, n) + power(8, n) + mod + mod) % mod;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3616
#include <stdio.h>
#include <string.h>

int main(void)
{
    char line[1025];
    char *p, *q;
    char word[1025];
    char words[200][7];
    int no_words;
    int i;
    
    fgets(line, 2000, stdin);
    
    p = line;
    no_words = 0;
    while (*p != '\0'){
        q = word;
        while (*p != ' ' && *p != '.' && *p != ','){
            *q++ = *p++;
        }
        *q = '\0';
        p++;
        
        if (3 <= strlen(word) && strlen(word) <= 6){
            strcpy(words[no_words++], word);
        }
    }
    
    printf("%s", words[0]);
    for (i = 1; i < no_words; i++){
        printf(" %s", words[i]);
    }
    printf("\n");

    return (0);
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> P;

int main()
{
	int sum = 0;
	string s;
	vector<int> st;
	vector<P> res;
	cin >> s;
	for (int i = 0; i < s.size(); i++) {
		if (s[i] == '/') {
			if (!st.empty()) {
				sum += i - st.back();
				P p(i - st.back(), st.back());
				while (!res.empty() && res.back().second >= p.second) {
					p.first += res.back().first;
					res.pop_back();
				}
				res.push_back(p);
				st.pop_back();
			}
		}
		else if(s[i] == '\\') {
			st.push_back(i);
		}
	}
	cout << sum << endl;
	cout << res.size();
	for (int i = 0; i < res.size(); i++) {
		cout << ' ' << res[i].first;
	}
	cout << endl;
	return 0;
}

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

int main() {

    string s, t;
    cin >> s >> t;

    bool ok = true;
    for (int i = 0; i < s.size(); i++)
        if (s[i] != t[i])
            ok = false;

    if (ok)
        cout << "Yes\n";
    else
        cout << "No\n";

    return 0;
}


Measured memory_bytes: 3632
op = ["+","-","*"]
p = op.product(op,op)

def convp(p, mode)
  st = []
  while p.size > 0
    x = p.shift
    if mode == 0
      case x
      when "+"
        st.push(st.pop+st.pop)
      when "-"
        st.push(-st.pop+st.pop)
      when "*"
        st.push(st.pop*st.pop)
      else #numeric
        st << x
      end
    else
      if x.to_s =~ /[1-9]/
        st.push(x.to_s)
      else
        a,b=st.pop,st.pop
        (x == "*" and b.size != 1) ? st.push("("+b+")"+" "+x+" "+a) : st.push("("+b+" "+x+" "+a+")")
      end
    end
  end
  return st
end

loop do
  e,f,g,h = gets.split.map(&:to_i)
  # puts "#{e},#{f},#{g},#{h}"
  break if e+f+g+h==0
  catch(:exit) do
    [e,f,g,h].permutation(4) do |a,b,c,d|
      p.each do |l|
        ln = Array.new(5){[a,b]}
        5.times do |idx|
          case idx
          when 0
            [ln[0],ln[1],ln[2]].each{|x| x << c}
            [ln[3],ln[4]].each{|x| x << l[0]}
          when 1
            ln[0] << d
            [ln[1],ln[2]].each{|x| x << l[0]}
            [ln[3],ln[4]].each{|x| x << c}
          when 2
            ln[0] << l[0]
            [ln[1],ln[4]].each{|x| x << d}
            [ln[2],ln[3]].each{|x| x << l[1]}
          when 3
            [ln[0],ln[1],ln[4]].each{|x| x << l[1]}
            [ln[2],ln[3]].each{|x| x << d}
          when 4
            ln.each{|x| x << l[2]}
          end
        end
        5.times do |i|
          lnb = Marshal.load(Marshal.dump(ln))
          if convp(ln[i], 0)[0] == 10
            puts convp(lnb[i],1)
            throw(:exit)
          end
        end
      end
    end
    p 0
  end
end

Measured memory_bytes: 9724
#include <bits/stdc++.h>
#define all(vec) vec.begin(), vec.end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
constexpr ll INF = (1LL << 30) - 1LL;
constexpr ll LINF = (1LL << 60) - 1LL;
constexpr ll MOD = 1e9 + 7;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    sort(all(a));
    ll ans = 0;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            if (i == j) {
                continue;
            }
            int lb = max(a[i] - a[j], a[j] - a[i]);
            int ub = a[i] + a[j];
            ll c = lower_bound(all(a), ub) - upper_bound(all(a), lb);
            if (lb < a[i] && a[i] < ub) {
                --c;
            }
            if (lb < a[j] && a[j] < ub) {
                --c;
            }
            ans += c;
        }
    }
    cout << ans / 6LL << endl;
}

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

using namespace std;

int main(){
 string s;
  cin >> s;
 
  int res=0;
  for(int i=0;i<s.length();i++){
   if(s[i]=='p') res--;
  }
   
  res+=(s.length())/2;

  cout << res << endl;
}

Measured memory_bytes: 512
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int a = sc.nextInt();
        int b = sc.nextInt();
        String r = "";
        if(a < b) {
            r = "a < b";
        }
        else if (a > b) {
            r = "a > b";
        }
        else {
            r = "a == b";
        }
        System.out.println(r);

        sc.close();
    }
}


Measured memory_bytes: 26004
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;
int main(void){
    int k, x;
    std::cin >> k >> x;
    if(k * 500 >= x){
        std::cout << "Yes" << std::endl;
    }
    else{
        std::cout << "No" << std::endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
const int mod = 1000000007;
struct mint {
	ll x; // typedef long long ll;
	mint(ll 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;
	}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

int main() {
	string s;
	cin >> s;
	int n = s.size();
	const int m = 13;
	vector<vector<mint>> dp(n+1, vector<mint>(m));
	if(s[0] != '?') {
		int f = (int) (s[0] - '0') % m;
		dp[0][f] = 1;
	} else {
		rep(i, 10) dp[0][i] = 1;
	}
	
	for(int i = 1; i < n; i++) {
		if(s[i] != '?') {
			int now = s[i] - '0';
			rep(j, m) {
				int next = (j * 10 + now) % m;
				dp[i][next] += dp[i-1][j];
			}
		} else {
			rep(now, 10) {
				// k: 0 ~ 9
				rep(j, m) {
					int next = (j * 10 + now) % m;
					dp[i][next] += dp[i-1][j];
				}
			}
		}
	}
	cout << dp[n-1][5] << endl;
	// rep(i, n) {
	// 	rep(j, m) {
	// 		cout << dp[i][j] << " ";
	// 	}
	// 	cout << endl;
	// }
	return 0;
}

Measured memory_bytes: 13696
/******************************************
* AHAM BRAHMASHMI ;) *
******************************************/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define vll vector<ll>
#define pll pair<ll,ll>
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define mod 1000000007


template <class T>
void print(vector<T> arr)
{
	cout << "start printing the vector\n";
	for (auto u : arr)
		cout << u << " ";
	cout << "\n";
}

template <class T>
void print_mat(vector<vector<T>> a)
{
	cout << "start printing the matrix\n";
	for (auto v : a)
	{
		for (auto e : v)
		{
			cout << e << " ";
		}
		cout << "\n";
	}
}

/******************************************
* NUMBER THEORY ;) *
******************************************/



ll powermod(ll x, ll y)
{
	ll res = 1;
	x = x % mod;
	while (y > 0)
	{
		if (y & 1)
			res = (res * x) % mod;
		y = y >> 1;
		x = (x * x) % mod;
	}
	res %= mod;
	return res;
}
ll factmod(ll n)
{
	ll res = 1;
	while (n > 1)
	{
		res = (res * ((n / mod) % 2 ?  mod - 1 : 1)) % mod;
		for (ll i = 2; i <= n % mod; ++i)
			res = (res * i) % mod;
		n /= mod;
	}
	res %= mod;
	return res;
}



void solve()
{
	ll n;
	cin >> n;
	vll white(n + 1, 0);
	vll reds(n + 1, 0);
	string s;
	cin >> s;
	for (ll i = 1; i <= n; i++)
	{
		white[i] += white[i - 1];
		reds[i] += reds[i - 1];
		if (s[i - 1] == 'W')
			white[i]++;
		else
			reds[i]++;
	}
	ll ans = 2000000000;
	for (ll i = 1; i <= n; i++)
	{
		if (white[i] == (reds[n] - reds[i - 1]))
			ans = min(white[i], ans);
		if (white[i - 1] == (reds[n] - reds[i]))
			ans = min(white[i - 1], ans);
	}
	cout << ans << "\n";
}

int main()
{

#ifndef ONLINE_JUDGE
	// for getting input from input.txt
	freopen("input.txt", "r", stdin);
	// for writing output to output.txt
	freopen("output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	// ll t;
	// cin>>t;
	// while(t--)
	// {
	solve();
	// }

	return 0;
}

Measured memory_bytes: 6724
import math

n, m=map(int, input().split())
t = {}
a = int(math.sqrt(m))

s=0

# line = [2, 3] + [i%2*2 + i//2 * 6 + 5 for i in range(a)]
# line = [2] + list(range(3, m+2, 2))

# for i in line:
for i in range(2, a+2):
#     print(i)
    cnt = 0
    while m%i==0:
        m=m//i
        cnt += 1

    if cnt>0:
        t[i]=cnt

    if m==1:
        break

if m!=1:
    t[m]=1

def combi(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r)) 

out=1
for tk in t.keys():
    out *= combi(t[tk]+n-1, n-1)
#     out = out%(1000000007)
print(out%(1000000007))

Measured memory_bytes: 114420
s = input()
n = int(input())
for _ in range(n):
    line = input().split()
    command, args = line[0], line[1:]
    start = int(args[0])
    end = int(args[1]) + 1
    if command == 'replace':
        s = s[:start] + args[2] + s[end:]
    elif command == 'reverse':
        s = s[:start] + str(''.join(list(reversed(s[start:end])))) + s[end:]
    elif command == 'print':
        print(s[start:end])

Measured memory_bytes: 7692
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define inf (ll)1e9
#define mod (ll)(1e9+7)
#define d(x) cerr<<#x<<"="<<x<<endl;
#define p(x) cout<<(x)<<endl
#define ps(x) cout<<(x);
#define pk(x) cout<<(x)<<" ";
#define pfix(d,x) cout << fixed << setprecision(d) << x << endl;
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define minel(v) *min_element(all(v))
#define minind(v) distance((v).begin(), min_element(all(v)))
#define maxel(v) *max_element(all(v))
#define maxind(v) distance((v).begin(), max_element(all(v)))
#define p2d(v,n,m) rep(i,n){rep(j,m){pk(v[i][j]);}p("");}
#define fi first
#define se second
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 a[100001],b[100001],c[100001],d,n,m,x,y,z,h,w,k,mi=inf,ma=-inf,ans,s,t,l,r,res,tmp,itr,p,q;
bool flag;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int dx8[8]={1,1,0,-1,-1,-1,0,1},dy8[8]={0,1,1,1,0,-1,-1,-1};
char cha;
string st;
typedef map<ll, ll> imap;
typedef pair<ll, ll> P;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<pair<ll,ll> > VP;
P pa;

void pyn(bool ans){
    p(ans?"Yes":"No");
}

bool condition(){
    if((a[0]==0 && a[3]==0 && a[6]==0)||
       (a[1]==0 && a[4]==0 && a[7]==0)||
       (a[2]==0 && a[5]==0 && a[8]==0)||
       (a[0]==0 && a[1]==0 && a[2]==0)||
       (a[3]==0 && a[4]==0 && a[5]==0)||
       (a[6]==0 && a[7]==0 && a[8]==0)||
       (a[0]==0 && a[4]==0 && a[8]==0)||
       (a[2]==0 && a[4]==0 && a[6]==0))return 1;
    else return 0;
}


int main(void){
    rep(i,9){
       cin>>a[i];
    }
    cin>>n;
    rep(i,n){
        cin>>b[i];
        rep(j,9){
            if(b[i]==a[j]){
                a[j]=0;
            }    
        }
    }
    //rep(i,9)d(a[i])
    pyn(condition());
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip> // << fixed << setprecision(xxx)
#include <algorithm> // do { } while ( next_permutation(A, A+xxx) ) ;
#include <vector>
#include <string> // to_string(nnn) // substr(m, n) // stoi(nnn)
#include <complex>
#include <tuple> // get<n>(xxx)
#include <queue>
#include <stack>
#include <map> // if (M.find(key) != M.end()) { }
#include <set> // S.insert(M);
// if (S.find(key) != S.end()) { }
// for (auto it=S.begin(); it != S.end(); it++) { }
// auto it = S.lower_bound(M);
#include <random> // random_device rd; mt19937 mt(rd());
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib> // atoi(xxx)
using namespace std;

#define DEBUG 0 // change 0 -> 1 if we need debug.
// insert #if<tab> by my emacs. #if DEBUG == 1 ... #end

typedef long long ll;

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

// const int C = 1e6+10;
// const ll M = 1000000007;

const int MAX_SIZE = 100010;
const long long MOD = 1000000007;

long long inv[MAX_SIZE];
long long fact[MAX_SIZE];
long long factinv[MAX_SIZE];

void init() {
  inv[1] = 1;
  for (int i=2; i<MAX_SIZE; i++) {
    inv[i] = ((MOD - inv[MOD%i]) * (MOD/i))%MOD;
  }
  fact[0] = factinv[0] = 1;
  for (int i=1; i<MAX_SIZE; i++) {
    fact[i] = (i * fact[i-1])%MOD;
    factinv[i] = (inv[i] * factinv[i-1])%MOD;
  }
}

long long C(int n, int k) {
  if (n >=0 && k >= 0 && n-k >= 0) {
    return ((fact[n] * factinv[k])%MOD * factinv[n-k])%MOD;
  }
  return 0;
}

long long power(long long x, long long n) {
  if (n == 0) {
    return 1;
  } else if (n%2 == 1) {
    return (x * power(x, n-1)) % MOD;
  } else {
    long long half = power(x, n/2);
    return (half * half) % MOD;
  }
}

long long gcm(long long a, long long b) {
  if (a < b) {
    return gcm(b, a);
  }
  if (b == 0) return a;
  return gcm(b, a%b);
}

int n;
int a[100010];

int main () {
  init();
  cin >> n;
  for (auto i = 0; i < n+1; ++i) {
    cin >> a[i];
  }
  int cnt[100010];
  fill(cnt, cnt+100010, 0);
  for (auto i = 0; i < n+1; ++i) {
    cnt[a[i]]++;
  }
  int same = 0;
  for (auto i = 0; i < n+1; ++i) {
    if (cnt[i] == 2) {
      same = i;
      break;
    }
  }
  assert(same > 0);
  int X = 0;
  bool does_add = true;
  for (auto i = 0; i < n+1; ++i) {
    if (a[i] == same) {
      does_add = !does_add;
    } else {
      if (does_add) {
        X++;
      }
    }
  }
  for (auto k = 1; k <= n+1; ++k) {
    ll ans = 0;
    ans += C(n-1, k);
    ans += 2 * C(n-1, k-1);
    ans %= MOD;
    ans += MOD - C(X, k-1);
    ans %= MOD;
    ans += C(n-1, k-2);
    ans %= MOD;
    cout << ans << endl;
  }
}


Measured memory_bytes: 4352