akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#ifdef ONLINE_JUDGE
#define LLD "%I64d"
#else
#define LLD "%lld"
#endif
#define fu(a,b,c) for(int a=b;a<=(int)c;++a)
#define fd(a,b,c) for(int a=b;a>=(int)c;--a)
#define cu(a,b,c) for(int a=b;a<(int)c;++a)
#define cd(a,b,c) for(int a=(b)-1;a>=(int)c;--a)
#define gcd(a,b) __gcd(a,b) 
#define pii pair<int,int>
#define pll pair<long long,long long>
#define all(a) a.begin(),a.end()
#define F first
#define S second
#define pb push_back
#define pf push_front
#define MOD 1000000007
#define MAXN 205
#define MAXH 20
#define MAXM 52
#define INF 1LL << 30
#define ll long long
#define ull unsigned long long
#define RNG rng mt19937(time(NULL))
#define udist(a,b) uniform_int_distribution<uint32_t> distribution(a,b)
#define max3(a,b,c) max(a, max(b, c))
#define min3(a,b,c) min(a, min(b, c))
#define gmax(a,b) a = max(a, b)
#define gmin(a,b) a = min(a, b)
#define whatis(x) cerr << #x << " is " << x << endl;
#define fast_io() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define PI 3.1415926535897932384626433
using namespace std;

int main(){
	ll c,s;
	cin >> s >> c;
	ll x = max((c - 2*s)/4, 0LL);
	cout << max(min(s + x, (c - 2 * x)/2), min(s + x + 1, (c - 2 * x - 2)/2)) << '\n';
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fast_I_O ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const int mod = 1e9+7 , INF = 1e9 ,  mx = 100005 ;
main()
{
    fast_I_O;
    int i,j,n,m,x,y,sum=0,p=0,l,k;
    cin>>n>>m>>k;
    int a[n+1],b[m+1];
    a[0] =0 , b[0]=0;
    for(i=1;i<=n;i++) cin>>a[i];
    for(i=1;i<=m;i++) cin>>b[i];

    for(i=1;i<=n;i++) a[i]=a[i-1]+a[i];
    for(i=1;i<=m;i++) b[i]=b[i-1]+b[i];

    //for(i=0;i<=n;i++) cout<<a[i]<<' ';
    //for(i=0;i<=m;i++) cout<<b[i]<<' ';

    for(i=0;i<=n;i++)
    {
        x=k-a[i];
        if(x<0) j=0;
        else j=i;
        y=upper_bound(b,b+m+1,x)-b;
        --y;
        p=max(j+y,p);
    }
    
    cout<<p;
    return 0;
}

Measured memory_bytes: 6672
#include <bits/stdc++.h>
using namespace std;
#define watch(x) cout << (#x) << " is " << (x) << '\n'
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef double db;
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a; }
//head

void solve(){
    string s, t;
    cin >> s >> t;
    cout << t + s << '\n';
}

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

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

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

int main(){
  int n;
  int *A;
  int i;
  
  scanf("%d",&n);

  A = (int *)malloc((n+1) * sizeof(int));

  for(i=1; i<=n; i++){
    scanf("%d",&A[i]);
  }

  for(i=1; i<=n; i++){
    printf("node %d: key = %d, ",i ,A[i]);

    if(i>1)
      printf("parent key = %d, ",A[i/2]);

    if(i*2 <= n)
      printf("left key = %d, ",A[2*i]);

    if(i*2 + 1 <= n)
      printf("right key = %d, ",A[2*i + 1]);

    printf("\n");
  }
  
  free(A);
  return 0;
}



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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int n;
	cin>>n;
	vector<int>a(n);
	unordered_map<int,int>m;
	for(auto&i:a){
		cin>>i;
		++m[i];
	}
	int64_t ans=0,tmp,tmp2;
	for(auto&i:m)ans+=(int64_t)i.second*(i.second-1)/2;
	for(auto&i:a){
		tmp=m.at(i);
		tmp=tmp*(tmp-1)/2;
		tmp2=m.at(i)-1;
		tmp2=tmp2*(tmp2-1)/2;
		cout<<ans-tmp+tmp2<<"\n"s;
	}
}

Measured memory_bytes: 8392
#include<bits/stdc++.h>
    using namespace std;
    #define se second
    #define fi first
    #define ll long long
    #define ld long double
    #define pll pair<ll ,ll >
    #define ppll pair<ll, pll>
    #define pii pair<int, int> 
    #define mod 1000000007
    #define pb push_back
    ll power(ll a,ll b){
        ll res=1;
        while(b>0){
            if(b%2!=0) res=(res*a);
            a=(a*a);
            b/=2;
        }
        return res;
    }
    ll ncr(ll n,ll k){
        if(k==0||k==n) return 1ll;
        if(k>n-k) k=n-k;
        ll pro=1;
        for(ll i=0;i<k;i++){
            pro=(pro*(n-i))%mod;
            pro/=(i+1);
        }
        return (pro%mod);
    }
    int main(void){
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        ll n;
        cin>>n;
        for(int i=1;i*i<=n;i++){
            if(n%i==0){
                ll a=n/i;
                ll b=i;
                if(a>=1 && a<=9 && b>=1 && b<=9){
                    cout<<"Yes";
                    return 0;
                }
            }
        }
        cout<<"No";
        return 0;
    }


Measured memory_bytes: 256
#include<bits/stdc++.h>
int V[10000001];
using namespace std;
int main()
{
	long long s=0,r,n,i,j;
	cin>>n;
	for(i=0;i<=n;i++)
	V[i]=1;
	for(i=2;i<=n;i++)
	{
		for(j=i;j<=n;j+=i)
		++V[j];
	}
	for(i=1;i<=n;i++)
	{
		//cout<<V[i]<<endl;
		r=V[i]*i;
		s+=r;
	}
	cout<<s;
}

Measured memory_bytes: 42692
N, A, B, C, D = map(int, input().split())
S = input()


def dfs(start, end):
    q = [start-1]
    while q:
        s = q.pop()
        if s==end-1:
            return True
        if s+2<N and S[s+2]==".":
            q.append(s+2)
        if s+1<N and S[s+1]==".":
            q.append(s+1)
    return False


res = dfs(A, C) and dfs(B, D)

if C<D:
    print("Yes" if res else "No")
else:
    #A<B<D<C
    for i in range(B-1, D):
        if S[i-1]=="." and S[i]=="." and S[i+1]==".":
            print("Yes" if res else "No")
            break
    else:
        print("No")


Measured memory_bytes: 3572
#include <bits/stdc++.h>
using namespace std;
#define ll int64_t
#include <cstdlib> 
#include <math.h>
#include<cstdio>
#include<cstring>
#define dbg(x) cout << #x << " = " << x << endl
#define dbg2(x,y) cout << #x << " = " << x << ", " << #y << " = " << y << endl
#define dbg3(x,y,z) cout << #x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << endl
#define dbg4(x,y,z,q) cout << #x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << ", " << #q << " = " << q << endl

#define FOR(I, A, B) for (int I = (A); I <= (B); I++)
typedef vector< int > vi;
typedef vector< vi > vvi;
typedef pair< int,int > ii;
#define gap cout<<endl;
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fo(i,n) for(int i=0;i<n;i++)
#define sz(a) int((a).size())
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(typeof((c)).begin() i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())

int main(){
	int n;
	cin>>n;
	map<string,int> mp;
	string tmp;
	int maax=0;
	fo(i,n){
		cin>>tmp;
		if(mp.count(tmp)){
			mp[tmp]++;
			maax=max(maax,mp[tmp]);
		}
		else{
			mp[tmp]=1;
			maax=max(maax,mp[tmp]);
		}

	}

	for(auto k:mp){
		if(k.second==maax) cout<<k.first<<endl;
	}
}

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

int main() {
  int a,b;
  int ans=0;
  cin >> a >> b;
  if (a>=b) {
    ans += a;
    a -= 1;
  } else {
    ans += b;
    b -= 1;
  }
  ans += max (a, b);
  cout << ans <<endl;
  return 0;
}

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

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#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 SORT(c) sort((c).begin(),(c).end())

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int MOD = 1000000007;
const int INF = 2147483647;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//myfuncs
//素数判定
template<class T> inline T isPrime(T x) {
	bool ret = true;
	if (x < 2) {
		ret = false;
	}
	for (LL i = 2; i <= sqrt(x); i++) {
		if (x%i == 0) {
			ret = false;
		}
	}
	return ret;
}

//Union FInd
struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

// main code
// bit全探索で全部解く問題の組み合わせを列挙する
// まだ目標を達成していなければ、残ってる問題のうち一番配点が大きいものを目標達成まで解く
// max-1まで達成できなければその組み合わせは不適だから考えなくていい

int main(int argc, char const* argv[])
{
    int d,g;
    cin >> d >> g;
    VI p(d,0),c(d,0),sum(d,0);
    for (int i = 0; i < d; i++) {
        cin >> p[i] >> c[i];
        sum[i] = (i+1) * 100 * p[i] + c[i];
    }
    int ans = INF;
    // ここからbit全探索
    for (int i = 0; i < (1<<d); i++) {
        int sum_score = 0;
        int sum_prob = 0;
        int no_use_max = 0;
        for (int j = 0; j < d; j++) {
            if ((1<<j) & i) {
                sum_score += sum[j];
                sum_prob += p[j];
            }
            else {
                no_use_max = j;
            }
        }
        if (sum_score >= g) {
            ans = min(ans,sum_prob);
        }
        else if (sum_score + (no_use_max + 1) * 100 * (p[no_use_max]-1) < g) {
            continue;
        }
        else {
            ans = min(ans,sum_prob + ((g - sum_score + (100*(no_use_max + 1) - 1))/(100*(no_use_max + 1))));
        }  
    }
    cout << ans << endl;
    return 0;
}


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

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<=(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define Eunique(v) v.erase(unique(all(v)),v.end())
#define Eback(s) s.erase(s.end()-1,s.end())
#define rev(v) reverse(all(v))
#define minvec(v) *min_element(all(v))
#define maxvec(v) *max_element(all(v))
#define pb push_back
#define pf push_front
#define mod 1000000007
#define m_p make_pair
#define DOUBLE fixed << setprecision(15)
#define OK puts("OK")
#define OK1 puts("OK1")
#define OK2 puts("OK2")
#define SIZE(s) (int)s.size()
#define INF ((1LL<<62)-(1LL<<31))
#define zero(x,n) setw(x) << setfill('0') << n

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef vector<pair<int,int>> vpii;
typedef vector<pair<ll,ll>> vpll;
typedef vector<string> vs;
const double pi = acos(-1.0);

template<class A, class B>
ostream& operator<<(ostream& ost, const pair<A, B>&p) {
	ost << "{" << p.first << ", " << p.second << "} ";
	return ost;
}

template<class T>
ostream& operator<<(ostream& ost, const vector<T>&v) {
	ost << "{";
	for (int i = 0; i<(int)v.size(); i++) {
		if (i)ost << " ";
		ost << v[i];
	}
	ost << "} \n";
	return ost;
}

template<class A, class B>
ostream& operator<<(ostream& ost, const map<A, B>&v) {
	ost << "{";
	for (auto p:v) {
		ost << "{" << p.first << ", " << p.second << "} ";
	}
	ost << "} ";
	return ost;
}

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

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

ll gcd(ll x, ll y) {return __gcd(x,y);}
ll lcm(ll x, ll y) {return x/__gcd(x,y)*y;}

int main()
{
	ll x,y;
	cin >> x >> y;
	cout << gcd(x,y) << endl;
	return 0;
}


Measured memory_bytes: 3104
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
 
 
void swap (int *x, int *y) {
  int temp;    
 
  temp = *x;
  *x = *y;
  *y = temp;
}
 
int gcd(int a,int b){
  if(a<b){
    swap(&a,&b);
  }
 
  if(b==0){
    return a;
  }
 
  int r=a%b;
  while(r!=0){
    a = b;
    b = r;
    r = (a%b);
  }
 
  return b;
}
 
/* クイックソート */
int dn(const void*a,const void*b){return*(int*)b-*(int*)a;}
 
 
int modpow(int a,int n,int mod){
  int ans=1;
  while(n>0){
    if(n & 1){
      ans=ans*a%mod;
    }
    a=a*a%mod;
    n/=2;
  }
  return ans;
}
 
int max(int a,int b){
  if(a<b){
    return b;
  }
  else{
    return a;
  }
}
 
int min(int a,int b){
  if(a<b){
    return a;
  }
  else{
    return b;
  }
}
 
void chmax(int *a,int b){
  if(*a < b){
    *a = b;
  }
 
  return;
}
 
void chmin(int *a,int b){
  if(*a > b){
    *a =b;
  }
 
  return;
}
 

int main(void){
  int x;
  scanf("%d", &x);
  if(x<1200){
    printf("ABC\n");
  }else{
    printf("ARC\n");
  }
  return 0;
}

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

#define pb push_back
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define REP(i,n) for(int _n=n, i=0;i<_n;++i)
#define FOR(i,a,b) for(int i=(a),_b=(b);i<=_b;++i)
#define FORD(i,a,b) for(int i=(a),_b=(b);i>=_b;--i)
#define trav(a, x) for (auto& a : x)
using ull = uint64_t;
using ll = int64_t;
using PII = pair<int, int>;
using VI = vector<int>;

string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string) s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B> string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; }
template <typename A> string to_string(A v) {
bool first = true; string res = "{";
for (const auto &x : v) { if (!first) { res += ", "; } first = false; res += to_string(x); }
res += "}"; return res; }
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H); debug_out(T...); }
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)


int main() {
    ios::sync_with_stdio(false), cin.tie(0);
    int N;
    cin >> N;
    VI A(N);
    REP(i, N) cin >> A[i];
    sort(all(A));
    int mx = 0;
    int ans = A[0];
    FOR(i, 0, N - 2) {
        int k = A[i];
        if (A[i] > A[N - 1] / 2) {
            k = A[N - 1] - A[i];
        }
        if (k > mx) {
            mx = k;
            ans = A[i];
        }

    }
    cout << A[N - 1] << " " << ans << endl;


}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
                     
#define int             long long
#define ld              long double
#define mp              make_pair
#define ff              first
#define ss              second
#define pb              push_back
#define fo(i,n)         for(i=0;i<n;i++)
#define fo1(i,n)        for(i=1;i<=n;i++)
#define FO(i,k,n)       for(i=k;k<=n?i<=n:i>=n;k<=n?i++:i--)
#define all(c)          c.begin(),c.end()
#define rall(c)         c.rbegin(),c.rend()
#define si              set<int>
#define vi              vector<int>
#define mii             map<int,int>
#define pii             pair<int,int>
#define vpii            vector<pii>
#define vvi             vector<vi>
#define usi             unordered_set<int>
#define umii            unordered_map<int,int>
#define pqmx            priority_queue<int>
#define pqmn            priority_queue<int,vi,greater<int> >
#define sp(x)           cout<<setprecision(x)<<fixed;
#define setbits(x)      __builtin_popcountll(x)
#define zerobits(x)     __builtin_ctzll(x)
#define in(a,n)         vi a(n);fo(i,n)cin>>a[i];
#define in1(a,n)        vi a(n+1);fo1(i,n)cin>>a[i];
#define w(t)            int t;cin>>t;while(t--)
#define sz(v)           (int)v.size()
#define gcd             __gcd
#define lcm(x,y)        x*(y/gcd(x,y))
#define endl            '\n'
#define PI              3.14159265358979323846
const int inf =         1e18;
const int mod =         1e9+7;
void __p(int x) {cout<<x;}
void __p(int32_t x){cout<<x;}
void __p(float x){cout<<x;}
void __p(double x){cout<<x;}
void __p(ld x) {cout<<x;}
void __p(char x){cout <<'\''<<x<<'\'';}
void __p(const char *x){cout <<'\"' <<x<<'\"';}
void __p(const string &x) {cout<<'\"'<<x<<'\"';}
void __p(bool x) {cout<<(x?"true":"false");}
void _p() {cout << "]\n";}
template<typename T,typename V>     void __p(const pair<T,V> &x) {cout<<'{';__p(x.first);cout<<',';__p(x.second);cout<<'}';}
template<typename T>                void __p(const T &x) {int f = 0; cout << '{'; for (auto &i: x) cout << (f++ ? "," : ""), __p(i); cout << "}";}
template <typename T,typename... V> void _p(T t, V... v) {__p(t);if(sizeof...(v))cout<<", ";_p(v...);}
int po(int x,int p,int m = inf) {int ans=1;x%=m;while(p>0){if(p&1)ans=(ans*x)%m;p=p>>1;x=(x*x)%m;}return ans;}
int inv(int x,int m=mod){return po(x,m-2,m)%m;}
#ifndef ONLINE_JUDGE
#define dbg(x...) cout<<"["<<#x<<"]=[";_p(x)
#else 
#define dbg(x...)
#endif
//=================================================================================




const int N=1e6+6;
int n,m,k,x,y,z,a,b,c,d,i,j,l,r,f;








void sol()
{   
    cin>>n>>m;
    string a,b;
    fo(i,n)a+=char(m+'0');
    fo(i,m)b+=char(n+'0');
    
    
    
    cout<< ((a<b)?a:b) <<endl;
}





int32_t main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    //sp(10);
    // w(t)/
    sol();
    return 0;
}

Measured memory_bytes: 3580
use std::io;
use std::cmp;


fn main() {
    let (h, _w) = {
        let i = read::<usize>();
        (i[0], i[1])
    };

    let mut cost = Vec::new();
    for _ in 0..10 {
        cost.push(read::<usize>());
    }

    for k in 0..10 { for i in 0..10 { for j in 0..10 {
        cost[i][j] = cmp::min(cost[i][j], cost[i][k] + cost[k][j]);
    }}}

    let mut ans = 0;
    for _ in 0..h {
        let aw = read::<isize>();
        for &a in aw.iter() {
            if a != -1 { ans += cost[a as usize][1]; }
        }
    }
    println!("{}", ans);
}


#[allow(dead_code)]
fn read<T>() -> Vec<T>
where T:
std::str::FromStr,
T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.split_whitespace()
        .map(|s| s.trim().parse().unwrap())
        .collect()
}

#[allow(dead_code)]
fn read_one<T>() -> T
where T:
std::str::FromStr,
T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.trim().parse().unwrap()
}

Measured memory_bytes: 4352
s = input()
k = int(input())
ans = []
for i in range(1,k+1):
  for j in range(len(s)):
    if j+i > len(s): break

    ans.append(s[j:j+i])


ans = list(sorted(set(ans))) #setはsortedではソートできる。リストでソートしてsetにすると順序は保証されない

if k != 1:
  print((ans[k-1]))
else:
  print(min(list(s)))

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

int main(void){
    int a,b,c;
    cin >> a >> b >> c;
    int j = 0;
    for(int i = max(max(a,b),c);;i++){
        int a2 = i - a;
        int b2 = i - b;
        int c2 = i - c;
        if((a2 + b2 + c2) % 2 == 0){
            j = (a2+b2+c2)/2;
            break;
        }
    }
    cout << j << endl;
}

Measured memory_bytes: 384
N = [int(i) for i in list(input())]

# コーナーケース
if len(N) == 1:
    print(N[0])
    exit()
elif set(N[1:]) == set([9]):
    print(N[0] + (len(N) - 1) * 9)
    exit()

ans = 0
s = 0
for i in range(len(N)):
    if N[i] == 0:
        continue
    ans = max(ans, s + (N[i] - 1) + 9 * (len(N) - 1 - i))
    s += N[i]

print(ans)

Measured memory_bytes: 3064
s=input()
n=len(s)
a=["A","G","C","T"]
f=0
m=0
ans=0
for i in range(n):
    if f==0:
        if s[i] in a:
            ans+=1
            f=1
    elif f==1:
        if s[i] in a:
            ans+=1
        else:
            m=max(ans,m)
            f=0
            ans=0
m=max(ans,m)
print(m)
            
    


Measured memory_bytes: 9080
def f(x):
    return int((2*x+1) // 2)

def get_input():
    while True:
        try:
            yield ''.join(input())
        except EOFError:
            break

N = list(get_input())
S = 0
T = 0
for l in range(len(N)):
    n = [int(i) for i in N[l].split(",")]
    S += n[0]*n[1]
    T += n[1]
print(S)
print(f(T/len(N)))



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

int main(){
    string s, t;
    cin >> s >> t;
    int n = s.size();
    int cnt = 0;
    for(int i = 0; i < n; i++){
        if(s[i] != t[i]){
            cnt++;
        }
    }
    cout << cnt << endl;
}

Measured memory_bytes: 3916
import java.util.*;
import java.io.*;

class Main {
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int n = stdIn.nextInt();
		int[] fib = new int[n+1];
		fib[0] = 1;
		fib[1] = 1;
		for (int i=2; i<=n; i++) {
			fib[i] = fib[i-1] + fib[i-2]; 
		}
		System.out.println(fib[n]);
	}
}



Measured memory_bytes: 26360
<?php
    list($strNum, $strLen) = explode(" ", trim(fgets(STDIN)));
    for($i = 0; $i < $strNum; $i++) $arr[] = trim(fgets(STDIN));
    sort($arr);
    $ans = "";
    for($i = 0; $i < $strNum; $i++) $ans = $ans.$arr[$i];
    echo $ans;
?>

Measured memory_bytes: 4728
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int INF = 1e9 + 7, MOD = 1e9 + 7;
const long long LINF = 1e18;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
int k;

int Get_Number(int x) {
	return x * 3 + (x + 7) * 3 + (x + 14) * 3;
}

bool Mod_Check(int x) {
	return x % 11 == k;
}

signed main() {
	int n, ans = 0;
	cin >> n >> k;
	int TmpA = (n - 2) / 11;
	int TmpB = (n - 2) % 11;
	for (int i = 0; i < 11; i++) {
		for (int j = 1; j < 6; j++) {
			ans += Mod_Check(Get_Number(i * 7 + j + 1)) * TmpA;
		}
	}
	for (int i = 0; i < TmpB; i++) {
		for (int j = 1; j < 6; j++) {
			ans += (Mod_Check(Get_Number(i * 7 + j + 1)) ? 1 : 0);
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <string>    
#include <vector>
#include <queue>
#include <map>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;
ll n, m;

int main(){
	string s;
	cin >> s;
	int a = stoi(s.substr(0, 2));
    int b = stoi(s.substr(2, 2));
	if(1 <= a && a <= 12){
		if(1 <= b && b <= 12){cout << "AMBIGUOUS" << endl;}
		else{cout << "MMYY" << endl;}
	}
	else{
		if(1 <= b && b <= 12){cout << "YYMM" << endl;}
		else{cout << "NA" << endl;}
	}
	
	
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include<string.h>
int main(void){
   char chr[20];
   scanf("%s",chr);
   int l;
   l = strlen( chr );
   for(int i=l-1;i>=0;i--){
       printf("%c",chr[i]);
   }
    printf("\n");
    return 0;
}



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

int top,S[1000];

void push(int x){
  S[++top] = x;
}

int pop(){
  top--;
  return S[top+1];
}

int main(){
  int a,b;
  top = 0;
  char s[100];

  while(scanf("%s",s) != EOF){
    if(s[0] == '+'){
      a=pop();
      b=pop();
      push(a+b);
    }

    else if(s[0] == '-'){
      b=pop();
      a=pop();
      push(a-b);
    }
    else if(s[0] == '*'){
      a=pop();
      b=pop();
      push(a*b);
    }else{
      push(atoi(s));
  }
}

printf("%d\n",pop());

return 0;

}

Measured memory_bytes: 548
package main

import (
	"fmt"
)

func main() {
	var a string
	fmt.Scan(&a)
	l := "abcdefghijklmnopqrstuvwxyz"
	u := "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
	for _, s := range l {
		if a == string(s) {
			fmt.Println("a")
			return
		}
	}
	for _, s := range u {
		if a == string(s) {
			fmt.Println("A")
			return
		}
	}
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}


Measured memory_bytes: 1772
#include<bits/stdc++.h>
using namespace std;
const int INF=1e8;
int d[12][12];
int V;
void warshall_floyd()
{
	for(int k=0;k<12;k++)
	for(int i=0;i<12;i++)
	for(int j=0;j<12;j++)
	d[i][j]=min(d[i][j],d[i][k]+d[k][j]);
}
int main()
{
	while(cin>>V)
	{
		if(V==0) break;
		for(int i=0;i<12;i++)
		for(int j=0;j<12;j++)
		{
			if(i==j) d[i][j]=0;
			else d[i][j]=INF;
		}
		for(int i=0;i<V;i++)
		{
			int a,b,c;
			cin>>a>>b>>c;
			d[a][b]=c; d[b][a]=c;
		}
		warshall_floyd();
		int k,s[12]={0},min=INF;
		for(int i=0;i<12;i++)
		{
			for(int j=0;j<12;j++)
			if(d[i][j]!=INF) s[i]+=d[i][j];
			if(s[i]!=0&&s[i]<min) {min=s[i];k=i;}
		}
		cout<<k<<' '<<min<<endl;
	}
	return 0;
}



Measured memory_bytes: 3084
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  int N;
  cin>>N;
  for(int i=0;i<=N;++i) {
    if(i*1000>=N) {
      cout<<i*1000-N<<endl;
      return 0;
    }
  }
}



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

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) begin(r),end(r)
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)
#define vvl(v,w,h,init) vector<vector<ll>> v(w,vector<ll>(h,init))
#define mp(a,b) make_pair(a,b)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using pii = pair<int,int> ;
using pll = pair<ll,ll> ;

const int mod = 1000000007;
constexpr int inf = ((1<<30)-1)*2+1 ;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0,1,-1,1,-1};
const int dx[] = {0,-1,0,1,1,-1,-1,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n,m;
  while(cin >> n && n){
    cin >> m;
    vector<ll> v;
    string s;
    cin >> s;
    ll cnt = 0;
    rep(i,s.size()){
      if(cnt){
        if(s[i] == 'I' && cnt % 2 == 0){
          ++cnt;
        }
        else if(s[i] == 'O' && cnt % 2){
          ++cnt;
        }
        else{
          v.push_back((cnt-1) / 2);
          cnt =0;
          if(s[i] == 'I') --i;
        }
      }
      else if(s[i] == 'I'){
        cnt = 1;
      }
    }
    cnt = 0;
    rep(i,v.size()){
      if(v[i] - n + 1 > 0){
        cnt += v[i] - n + 1;
      }
    }
    cout << cnt << endl;
  }
  return 0;
}

Measured memory_bytes: 4572
#!/usr/bin/env python3
import sys

input = sys.stdin.readline


def S():
    return input().rstrip()


def I():
    return int(input())


def MI():
    return map(int, input().split())


s = S()
t = S()
n = len(s)

c = 0
for i in range(n):
    if s[i] != t[i]:
        c += 1

print(c)


Measured memory_bytes: 67972
package main

import "fmt"

func pf(n int) map[int]int {
	t := n
	r := make(map[int]int, 0)
	for i := 2; i*i <= n; i++ {
		for t%i == 0 {
			r[i]++
			t /= i
		}
	}
	if t > 1 {
		r[t]++
	}
	return r
}

const mod = int(1e9) + 7

func main() {
	var N int
	fmt.Scan(&N)
	set := make(map[int]int, 0)
	for i := 1; i <= N; i++ {
		for k, v := range pf(i) {
			set[k] += v
		}
	}
	// fmt.Printf("pf(%d!) => %v\n", N, set)
	ans := 1
	for _, v := range set {
		ans = ans * (v + 1)
		ans %= mod
	}
	fmt.Println(ans)
}


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

#define F first
#define S second
typedef pair<int, int> pii;

const int MAX_N = 200 * 1000 + 5;
int n;
vector<int> adj[MAX_N];

void read_input()
{
    cin >> n;
    for (int i = 0; i < n - 1; i++)
    {
        int u, v;
        cin >> u >> v;
        u--, v--;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }
}

pii dfs(int v, int par = -1, int h = 0)
{
    pii res = {h, v};
    for (int u : adj[v])
        if (u != par)
            res = max(res, dfs(u, v, h + 1));
    return res;
}

void solve()
{
    int x = dfs(dfs(0).S).F;
    if (x % 3 == 1)
        cout << "Second";
    else
        cout << "First";
}

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

Measured memory_bytes: 26880
import sys
input = sys.stdin.buffer.readline
from itertools import accumulate
from bisect import bisect_left

INF = 10 ** 18
MOD = 10 ** 9 + 7

N = int(input())
A = list(map(int, input().split()))

Acum = [0] + list(accumulate(A))
answer = INF

for i in range(2, N - 1):
  bpq = bisect_left(Acum,  (Acum[i] - Acum[0]) // 2)
  brs = bisect_left(Acum,  (Acum[N] - Acum[i]) // 2 + Acum[i])
  
  P1, Q1 = Acum[bpq] - Acum[0], Acum[i] - Acum[bpq]
  P2, Q2 = Acum[bpq - 1] - Acum[0], Acum[i] - Acum[bpq - 1]
  R1, S1 = Acum[brs] - Acum[i], Acum[N] - Acum[brs]
  R2, S2 = Acum[brs - 1] - Acum[i], Acum[N] - Acum[brs - 1]  
  
  tmp = INF
  tmp = min(tmp, max(P1, Q1, R1, S1) - min(P1, Q1, R1, S1))
  tmp = min(tmp, max(P1, Q1, R2, S2) - min(P1, Q1, R2, S2))
  tmp = min(tmp, max(P2, Q2, R1, S1) - min(P2, Q2, R1, S1))
  tmp = min(tmp, max(P2, Q2, R2, S2) - min(P2, Q2, R2, S2))
  
  answer = min(answer, tmp)
  
print(answer)

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

int main()
{
    int n, m;
    cin >> n >> m;
    int l_max = 0;
    int r_min = n;

    for (size_t i = 0; i < m; i++)
    {
        int l_i, r_i;
        cin >> l_i >> r_i;

        l_max = max(l_max, l_i);
        r_min = min(r_min, r_i);
    }
    cout << max(r_min - l_max + 1, 0) << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <queue>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using namespace std;

template<class T>
constexpr T INF = ::numeric_limits<T>::max() / 2 - 170;

int main() {
    int n, a = 0, b = 0;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        int x;
        scanf("%d", &x);
        if(x&1) a++;
        else b++;
    }
    while(a>1 || b>1){
        if(a >= 2) {
            b += a/2;
            a = a&1;
        }
        if(b >= 2) b = b/2 + (b&1);
    }
    cout << (a+b==1 ? "YES" : "NO") << "\n";
    return 0;
}


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


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

    vector<int> v(N+1, 0);
    for(int i = 0; i < M; i++){
        int A;
        cin >> A;
        v[A]++;
    }
    int l = accumulate(v.begin(), v.begin()+X, 0);
    int r = accumulate(v.begin()+X, v.end(), 0);
    cout << min(l, r) << endl;
}

Measured memory_bytes: 256
n,k=map(int,input().split())
v=list(map(int,input().split()))
ans=0
for l in range(n):
	for r in range(l,n+1):
		toru = l+n-r
		if toru > k:
			continue
		li = v[:l]
		li.extend(v[r:])
		li.sort()
		s=sum(li)
		cnt=0
		while toru < k and len(li) > cnt:
			if li[cnt]>=0:
				break
			toru+=1
			s-=li[cnt]
			cnt+=1
		ans=max(ans,s)
		if s==19:
			print(l,r)
print(ans)

Measured memory_bytes: 40732
#include <iostream>

int main() {
  int num, train, taxi;
  
  std::cin >> num >> train >> taxi;
  
  int expense_one = num * train;
  int expense_two = taxi;
  
  if(expense_one <= expense_two) {
    std::cout << expense_one;
  }
  else {
    std::cout << expense_two;
  }
     
  return 0;
}

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

int main(){
    string s;
    cin >> s;
    int i = 0;
    while(s[i] != 'A') i++;
    int j = s.size()-1;
    while(s[j] != 'Z') j--;
    cout << j-i+1 << endl;
}


Measured memory_bytes: 640
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
#include<iomanip>
#include<list>
#include<deque>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define END {}
#endif
typedef long long ll;
#define int ll
#define uset unordered_set
#define umap unordered_map
typedef std::pair<int,int> P;
struct edge{int to,cost;};
const int INF=100000000000000000;
const int INF2=9223372036854775807;
const int MOD=1000000007;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define min(X,Y) (((int)(X)<(int)(Y))?(X):(Y))
#define max(X,Y) (((int)(X)>(int)(Y))?(X):(Y))
#define MAX(X,Y) (*max_element(X,Y))
#define MIN(X,Y) (*min_element(X,Y))
#define NP(X,Y) next_permutation(X,Y)
#define setp(X,Y) cout<<fixed<<setprecision(Y)<<X;
int ceil2(int a,int b){if(a%b==0){return a/b;}else{return a/b+1;}}
int pow2(int a,int b){int r=1;for(int i=1;i<=b;i++){r*=a;}return r;}
int Log2(int a){int t=0;while(1){if(a==0||a==1){break;}a/=2;t++;}return t;}

signed main(){
	int X,A;
	cin>>X>>A;
	if(X<A){
		cout<<0<<endl;
	}
	else{
		cout<<10<<endl;
	}
	return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static MyUtil;

class MyUtil
{
    public static int[] ReadIntArray()
    {
        return ReadLine().Split().Select(x => int.Parse(x)).ToArray();
    }
}

class Program
{
    public static void Main()
    {
        var tmp = ReadIntArray();
        int n = tmp[0], k = tmp[1];

        long n0 = 0;
        for (int i = 1; i <= n; i++)
        {
            if (i % k == 0){ n0++; }
        }

        long n1 = 0;
        if (k%2 == 0)
        {
            for (int i = 1; i <= n; i++)
            {
                if (i % k == k/2){ n1++; }
            }
        }

        long ans = n0*n0*n0 + n1*n1*n1;
        WriteLine(ans);
    }
}



Measured memory_bytes: 13396
#include <stdio.h>

int main(void) {
	int hanafuda[50];
	int buffer[50];
	int maisuu,s_kaisuu,s_now;
	int i;
	int p,c;
	while(1) {
		scanf("%d%d",&maisuu,&s_kaisuu);
		if(maisuu==0 && s_kaisuu==0)break;
		for(i=0;i<maisuu;i++)hanafuda[i]=maisuu-i;
		for(s_now=0;s_now<s_kaisuu;s_now++) {
			scanf("%d%d",&p,&c);
			for(i=0;i<c;i++)buffer[i]=hanafuda[i+p-1];
			for(i=0;i<p-1;i++)buffer[i+c]=hanafuda[i];
			for(i=0;i<p+c-1;i++)hanafuda[i]=buffer[i];
		}
		printf("%d\n",hanafuda[0]);
	}
	return 0;
}

Measured memory_bytes: 0
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;

ll n, a[100010], sum;

bool check(ll x) { // [t0, t1) [t1, t2)
  ll t0 = 0, t1 = 0, t2 = 0, s1 = 0, s2 = 0;
  while (t1 < n && s1 < x) s1 += a[t1++];
  t2 = t1;
  while (t2 < n && s2 < x) s2 += a[t2++];
  if (t2 == n) return false;
  if (sum - s1 - s2 >= x) return true;
  for (ll i = 1; i < n; i++) {
    s1 -= a[t0++];
    while (s1 < x) s1 += a[t1], s2 -= a[t1], t1 = (t1 == n-1) ? 0 : (t1 + 1);
    while (s2 < x) s2 += a[t2], t2 = (t2 == n-1) ? 0 : (t2 + 1);
    if (sum - s1 - s2 >= x) return true;
  }
  return false;
}

int main() {
  scanf("%lld", &n);
  for (ll i = 0; i < n; i++) scanf("%lld", &a[i]), sum += a[i];
  ll lb = 1, ub = (sum / 3) + 1;
  while (lb + 1 < ub) {
    ll mid = (lb + ub) / 2;
    if (check(mid)) lb = mid;
    else ub = mid;
  }
  printf("%lld\n", lb);
}



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


void solve(long long N, std::vector<long long> X){
    sort(X.begin(), X.end());
    ll ans = numeric_limits<ll>::max();
    for(ll p = X.front(); p <= X.back(); ++p){
        ll tmp = 0;
        for(ll v : X){
            tmp += (v - p) * (v - p);
        }
        ans = min(ans, tmp);
    }
    cout << ans << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools
int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> X(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&X[i]);
    }
    solve(N, std::move(X));
    return 0;
}


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

int main(){
  int H,W,A,B;
  cin>>H>>W>>A>>B;
  for(int i(0);i<H;i++){
    for(int j(0);j<W;j++){
      if (i<B){
        if (j<A){
          cout << 1;
        }else{
          cout << 0;
        }
      }else{
        if (j<A){
          cout << 0;
        }else{
          cout << 1;
        }
      }
    }
    cout << endl;
  }
  return 0;
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define int long long
#define vi vector<int>
#define pii pair<int,int>
#define vpii vector<pii>
#define endl '\n'
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define in insert
#define pi 3.14159265358979323846
#define rep(i,a,b) for(int i = a ; i < b ; i++)
#define repr(i,a,b) for(int i = b ; i > a ; i--)
  
long long fact(long long a, long long b){
    int r= max(a, b);
    int v= min(a, b);
    int l=1;
    // if(v==0)
    for(int i=r+1; i<=a+b; i++){
        l*=i;
    }
    for(int i=v; i>=2; i--){
        l/=i;
    }
    return l;
}

int gcd(int a, int b) { 
    if (b == 0) 
        return a; 
    return gcd(b, a % b);  
}

int powr(int a) { 
    int var=1;
    for(int i=0; i<a; i++){
        var*=2;
    }
    return var;
}

signed main(){   
    fast;
    int k , num = 0 , pw = 1 , ans = 0;
    cin >> k;
    rep(i,0,k)
    {
        ans++;
        num = (num+7*pw)%k;
        pw = pw*10%k;
        if(!num){
            cout << ans;
            return 0;
        }
    }
    cout << -1;
}

Measured memory_bytes: 3624
#define _CRT_SECURE_NO_WARNINGS

#define N (1<<17)
#define MODULO (1000000007)

#include <cstdio>
#include <iostream>
#include <fstream>
#include <sstream>
#include <queue>
#include <map>
#include <set>
#include <deque>
#include <vector>
#include <stack>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <string>
using namespace std;

int n;
int a[N], b[N];
long long fact[N], inv[N];
int mk1, mk2;

long long kiss(long long xx, int yy)
{
	if (yy == 0)
	{
		return 1LL;
	}
	else if (yy == 1)
	{
		return (xx % (long long)(MODULO));
	}
	else
	{
		long long Ans = kiss((xx*xx) % (long long)MODULO, yy >> 1);
		if (yy & 1)
		{
			Ans *= xx;
		}
		Ans %= (long long)MODULO;
		return Ans;
	}
}

int main()
{
	fact[0] = fact[1] = 1;
	for (int i = 2;i < N - 7;i++)
	{
		fact[i] = fact[i - 1] * i;
		fact[i] %= (long long)MODULO;
	}
	inv[N - 8] = kiss(N - 8, MODULO - 2);
	for (int i = N - 9;i >= 0;i--)
	{
		//inv[i] = inv[i + 1] * (long long)(i + 1);
		//inv[i] %= (long long)MODULO;
		inv[i] = kiss(i, MODULO - 2);
	}
	
	scanf("%d", &n);
	memset(b, -1, sizeof(b));
	for (int i = 0;i < n + 1;i++)
	{
		scanf("%d", &a[i]);
		if (b[a[i]] != -1)
		{
			mk1 = b[a[i]], mk2 = i;
		}
		else
		{
			b[a[i]] = i;
		}
	}

	int alpha = mk1, beta = n - mk2;
	int r1 = n + 1, r2 = ((alpha + beta) != 0);
	int fc = n, ft = alpha + beta;
	printf("%d\n", n);
	for (int k = 2;k <= n + 1;k++)
	{
		long long tmp = (long long)r1;
		tmp *= fc--;
		tmp %= (long long)MODULO;
		tmp *= inv[k];
		tmp %= (long long)MODULO;
		r1 = (int)tmp;
		tmp = (long long)r2;
		if (k - 1 > alpha + beta)
		{
			tmp = 0;
		}
		else
		{
			tmp *= ft--;
			tmp %= (long long)MODULO;
			tmp *= inv[k - 1];
			tmp %= (long long)MODULO;
		}
		r2 = (int)tmp;
		printf("%d\n", ((r1 - r2) % MODULO + MODULO) % MODULO);
	}
	//system("pause");
	return 0;
}



Measured memory_bytes: 4224
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <limits>

using namespace std;

//conversion
//------------------------------------------
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(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#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 EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

string days[] = { "SUN","MON","TUE","WED","THU","FRI","SAT" };

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

	for (int i = 0; i < 7; i++) {
		if (s == days[i])cout << 7 - i << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#ifndef err
#define err(...)(void)0
#endif
using namespace std;
using ll = long long;
using ull = decltype(1ull);
template<class T>int size(T&&a) { return a.size(); }
#define REP(t,a)for(typename make_signed<decltype(a.second)>::type t=a.first,_l##t=a.second;t<_l##t;t++)
#define RREP(t,a)for(typename make_signed<decltype(a.second)>::type t=a.second-1,_l##t=a.first;t>=_l##t;t--)
template<class B>pair<int, B>make_pair(B b) { return{ 0,b }; }
#define rep(t,...)REP(t,make_pair(__VA_ARGS__))
#define rrep(t,...)RREP(t,make_pair(__VA_ARGS__))
#define all(a)begin(a),end(a)
#define rall(a)a.rbegin(),a.rend()
#define var(t, ...) t __VA_ARGS__;in,__VA_ARGS__;

void Calc();
int main() {
  ios::sync_with_stdio(false); cin.tie(nullptr);
  cin.exceptions(istream::failbit | istream::badbit);
  cout << fixed << setprecision(15); Calc(); cout.flush(); return 0;
}
template<class A>void amax(A&a, A b) { a = max(a, b); }
template<class A>void amin(A&a, A b) { a = min(a, b); }
template<class A>int comp(A a, A b) { return a < b ? 1 : b < a ? -1 : 0; }
struct Scanner {
  template<class A = string>A Next() { A a; cin >> a; return a; }
  template<class A = int>vector<A>Array(int n) { vector<A>a(n); for (A&i : a) cin >> i; return a; }
  string Line() const { string s; getline(cin, s); return s; }
  template<class A>Scanner&operator,(A&a) { a = Next<A>(); return *this; }
  template<class A>operator A() { return Next<A>(); }
}in;

/*---------------------------------------------------------------------*/


void Calc() {

  string s = in;
  if (s.find("AC") != -1) {
    cout << ("Yes") << endl;


  }
  else cout << ("No") << endl;



}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin>>s;
  vector<int>ans(s.size(),0);
  int cnt=0;
  //まず左から見る
  for(int i=0;i<s.size()-1;i++){
    if(s.at(i)=='R'&&s.at(i+1)=='L'){
      ans[i]++;
      int tmp=cnt/2;
      //cout<<cnt<<endl;
      ans[i]+=tmp;
      ans[i+1]+=cnt-tmp;
      cnt=0;
    }
    else if(s.at(i)=='R'&&s.at(i)!='L'){
      ans[i]=0;
      cnt++;
    }
  }
  
  for(int i=s.size()-1;i>=1;i--){
    if(s.at(i-1)=='R'&&s.at(i)=='L'){
      ans[i]++;
      int tmp=cnt/2;
      ans[i]+=tmp;
      ans[i-1]+=cnt-tmp;
      cnt=0;
    }
    else if(s.at(i-1)!='R'&&s.at(i)=='L'){
      cnt++;
    }
  }

  for(int i=0;i<ans.size();i++){
    cout<<ans[i]<<" ";
  }
}

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

int main() {
  int n;
  cin >> n;
  vector<int> l(n);
  rep(i,n) cin >> l[i];
  int ans = 0;

  rep(i,n)rep(j,n)rep(k,n) {
    if (i < j && j < k) {
      if (l[i] == l[j]) continue;
      if (l[i] == l[k]) continue;
      if (l[k] == l[j]) continue;
      if ((ll)l[i]+l[j]+l[k] <= max({l[i],l[j],l[k]})*2) continue;
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3604
mod = 1000000007
n = int(input())
a = list(map(int,input().split()))
ans = 0
ans += (sum(a)*sum(a))%mod
for i in range(n):
    ans -= (a[i]*a[i])%mod
    if ans < 0:
        ans += mod
ans *= (mod + 1) // 2
ans %= mod
print(int(ans))

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

#define int long long

const int N = 1e7 + 5;

vector<int> dp(N, 2);

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

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

	int n, res = 0;
	cin >> n;

	dp[0] = 0, dp[1] = 1;

	for (int i = 2; i <= n; ++i)
			for (int j = 2 * i; j <= n; j += i)
				++dp[j];

	// for (int i = 0; i <= n; ++i)
	// 	cout << dp[i] << ' ';
	// cout << '\n';

	for (int i = 1; i <= n; ++i)
		res += i * dp[i];

	cout << res;

	return 0;
}

Measured memory_bytes: 81232
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#define llong long long
#define ldouble long double
#define uint unsigned int
#define ullong unsigned long long
#define udouble unsigned double
#define uldouble unsigned long double
#define modinc(x) {if(x>=P) x-=P;}
#define pii pair<int,int>
#define piii pair<pair<int,int>,int>
#define piiii pair<pair<int,int>,pair<int,int> >
#define pli pair<llong,int>
#define pll pair<llong,llong>
#define Memset(a,x) {memset(a,x,sizeof(a));}
using namespace std;

const int N = 1e5;
int a[N+2];
int n;

void output(int x)
{
	if(x==1) printf("Yes\n");
	else printf("No\n");
}

int main()
{
	scanf("%d",&n);
	for(int i=1; i<=n; i++) scanf("%d",&a[i]);
	sort(a+1,a+n+1);
	if(a[n]-a[1]>1) {output(0); return 0;}
	else if(a[n]==a[1])
	{
		output(a[1]==n-1 || n>=a[1]+a[1]);
	}
	else
	{
		int x = 0; for(int i=1; i<=n; i++) if(a[i]==a[1]) x++;
		output(a[1]+1-x>0 && n-x>=2*(a[1]+1-x));
	}
	return 0;
}

Measured memory_bytes: 640