akhauriyash/Code-Regression huggingface dataset:
def main():
    N,M = map(int,input().split())
    mod = 10**9 + 7
    a = [0]*(N+1)
    a[0] = 1
    banned = [False]*(N+1)
    for x in range(M):
        n = int(input())
        banned[n] = True
    for i in range(1,N+1):
        res = 0
        if not banned[i-1]:
            res += a[i-1]
        if not banned[i-2]:
            res += a[i-2]
        a[i] = res
    print(a[-1]%mod)
    return

main()


Measured memory_bytes: 469276
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <cmath>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i=0;i < (int)(n);i++)
double pi = acos(-1);

int main(){
  long double a,b;
  long double h,m;
  cin >> a >> b >> h >> m;
  long double ans = 0.0;
  long double theta = max(h*60.0*0.5 + m*0.5 ,m*6.0) - min(h*60.0*0.5+ m*0.5,m*6.0);
  if (theta == 180.0){
     ans = a + b ;
     printf("%.10Lf\n",ans);
     return 0;
  }
  else if (theta > 180){
    theta = 360 - theta;
    ans = a*a + b*b - 2.0*a*b*cos(theta*pi/180.0);
    printf("%.10Lf\n",sqrt(ans));
  }
  else{
    ans = a*a + b*b - 2.0*a*b*cos(theta*pi/180.0);
    printf("%.10Lf\n",sqrt(ans));
  }
  return 0;
}

Measured memory_bytes: 4164
#include <bits/stdc++.h>
typedef long long ll;
int main(int argc, char const *argv[]) {
    ll N, A, B;
    std::cin >> N >> A >> B;
    if (N == 1) {
        std::cout << "Hello World" << '\n';
    } else {
        std::cout << A + B << '\n';
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long[] array = new long[n];
		for(int i=0;i<n;i++) {
			array[i]=sc.nextLong();
		}
		sc.close();

		long mod = 1000000000L+7L;

		long sum = 0L;
		for(int i=0;i<n;i++) {
			sum=sum+array[i];
			sum = sum%mod;
		}

		long ans = 0L;
		for(int i=0;i<n-1;i++) {
			long ai = array[i];
			sum = sum-ai;
			if(sum<0L) {
				sum=sum+mod;
			}
			ans = (ai*sum%mod + ans)%mod;
		}

		System.out.println(ans);
	}
}


Measured memory_bytes: 61084
#include <bits/stdc++.h>
#define For(i, begin, end) for(int i=begin;i<end;i++)
#define Rep(i, n) For(i,0,n)
#define Sort(v) sort(v.begin(),v.end())
using namespace std;

int main(){
  int N,A;cin>>N>>A;
  cout<<N*N-A;

  return 0;
}

Measured memory_bytes: 384
import math
import sys
from bisect import bisect_left, bisect_right
from typing import List, Optional, Tuple


class KDTree(object):
    def __init__(self, n: int) -> None:
        self.n = n
        self.root = int(math.sqrt(n))
        self.coordinates = [(0, 0, 0)] * n
        self.low: List[int] = []
        self.high: List[int] = []
        self.coordinates_: List[Tuple[List[int], List[Tuple[int, int, int]]]] = []

    def add(self, x: int, y: int, idx: int) -> None:
        self.coordinates[idx] = (x, y, idx)

    def prepare(self) -> None:
        self.coordinates.sort()
        self.low = [x for x, _, _ in self.coordinates[::self.root]]
        self.high = [x for x, _, _
                     in self.coordinates[self.root - 1::self.root]] + [sys.maxsize]
        tmp = [sorted(self.coordinates[i: i + self.root], key=lambda x: x[1])
               for i in range(0, self.n, self.root)]
        self.coordinates_ = [([y for _, y, _ in xyi], xyi) for xyi in tmp]

    def find_points(self, sx: int, tx: int, sy: int, ty: int) -> Optional[List[int]]:
        ans = []
        for i in range(bisect_left(self.high, sx), bisect_right(self.low, tx)):
            k, v = self.coordinates_[i]
            for j in range(bisect_left(k, sy), bisect_right(k, ty)):
                if sx <= v[j][0] <= tx:
                    ans.append(v[j][2])
        return ans


if __name__ == "__main__":
    n = int(input())
    kdtree = KDTree(n)
    for idx in range(n):
        x, y = map(lambda x: int(x), input().split())
        kdtree.add(x, y, idx)
    kdtree.prepare()

    q = int(input())
    for _ in range(q):
        sx, tx, sy, ty = map(lambda x: int(x), input().split())
        ans = kdtree.find_points(sx, tx, sy, ty)
        if ans:
            ans.sort()
            print("\n".join(map(str, ans)))
        print()



Measured memory_bytes: 98488
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <numeric>
#include <tuple>
#include <stack>

#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) x.begin(),x.end()
#define print(s) cout << s << endl
typedef long long ll;
using namespace std;

int main() {
    int n; cin >> n;
    if (n < 1200){
        print("ABC");
    }else if (n < 2800){
        print("ARC");
    }else{
        print("AGC");
    }
}

Measured memory_bytes: 256
#include <cstdio>
#include <string>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <cassert>
#include <numeric>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF  9223300000000000000
#define LINF2 1223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
//const long long MOD = 998244353;

using namespace std;

void solve()
{
    int n, V, P; ll M;
    scanf("%d%lld%d%d", &n, &M, &V, &P);
    vector<ll> a(n);
    int i;
    for (i = 0; i < n; i++) {
        scanf("%lld", &a[i]);
    }
    sort(a.begin(), a.end());

    int l = -1, r = n;
    while (r - l > 1) {
        int m = (l + r) / 2;
        ll cnt = (ll)M * ((ll)P+m);
        int bad = 0;
        for (i = m + 1; i <= n - P; i++) {
            if(a[m]+M-a[i]<0) bad=1;
            cnt += (a[m] + M - a[i]);
        }
        if (cnt >= (ll)M*V && bad==0) {
            r = m;
        }
        else {
            l = m;
        }
    }
    printf("%d\n", n-r);

    return;
}

int main(int argc, char* argv[])
{
#if 1
    solve();
#else
    int T;
    scanf("%d%d", &T, &B);
    int t;
    for(t=0; t<T; t++) {
        //printf("Case #%d: ", t+1);
        solve();
    }
#endif
    return 0;
}



Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cmath>
#include <iomanip>
#include <functional>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) (int)(x).size()
using namespace std;
using ll = long long;
constexpr int inf = 1000000000;
constexpr ll INF = 1000000000000000000;
template <typename T> bool chmin(T &x, const T &y) {if (x > y) {x = y; return true;} return false;}
template <typename T> bool chmax(T &x, const T &y) {if (x < y) {x = y; return true;} return false;}

struct RollingHash {
    static constexpr int base1 = 1007, base2 = 2009;
    static constexpr int mod1 = 1000000007, mod2 = 1000000009;
    vector<ll> hash1, hash2, pow1, pow2;
    RollingHash (const string &S) {
        int length = SZ(S);
        hash1.assign(length + 1, 0);
        hash2.assign(length + 1, 0);
        pow1.assign(length + 1, 1);
        pow2.assign(length + 1, 1);
        rep(i, length) {
            hash1[i + 1] = (hash1[i] * base1 + S[i]) % mod1;
            hash2[i + 1] = (hash2[i] * base2 + S[i]) % mod2;
            pow1[i + 1] = pow1[i] * base1 % mod1;
            pow2[i + 1] = pow2[i] * base2 % mod2;
        }
    }
    pair<ll, ll> get(int l, int r) const {
        ll res1 = hash1[r] - hash1[l] * pow1[r - l] % mod1;
        if (res1 < 0) res1 += mod1;
        ll res2 = hash2[r] - hash2[l] * pow2[r - l] % mod2;
        if (res2 < 0) res2 += mod2;
        return pair<ll, ll>{res1, res2};
    }
};

int main() {
    int N;
    cin >> N;
    string S;
    cin >> S;
    
    RollingHash RH(S);
    int ans = 0;
    for (int i = 1; i <= N; ++i) {
        set<pair<ll, ll>> st;
        deque<pair<ll, ll>> dq;
        rep(j, N - i + 1) {
            auto x = RH.get(j, j + i);
            dq.push_back(x);
            if (SZ(dq) > i) {
                st.insert(dq.front());
                dq.pop_front();
            }
            if (st.count(x)) ans = max(ans, i);
        }
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 4120
#include <stdio.h>

int main(void)
{
	long int n,a,b,m,ans;
	scanf("%ld %ld %ld", &n, &a, &b);
	if (a > b){
		ans = 0;
		printf("%ld", ans);
	}
	else{
		if((n == 1) && (a == b)){
			ans = 1;
			printf("%ld", ans);
		}
		else if((n == 1) && (a != b)){
			ans = 0;
			printf("%ld", ans);
		}
		else if(n == 2){
			ans = 1;
			printf("%ld", ans);
		}
		else{
			m = n-2;
			ans = b*m - a*m + 1;
			printf("%ld", ans);
		}
	}
	return 0;
}	

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

int main(){
    double N;
    cin >> N;
    vector<double>vec(N);
    double wa = 0;
    for(int i = 0; i < N; i++) {
        cin >> vec[i];
        wa += vec[i];
    }
    wa /=N;
    double a = 777;
    for(int i = 0; i < N; i++) {
        a = min(a,abs(wa-vec[i]));
    }
    for(int i = 0; i < N; i++) {
        if(abs(wa-vec[i]) == a) {
            cout << i << endl;
            return 0;
        }
    }
} 


Measured memory_bytes: 3756
import sys


def main():
    rect = 0
    lozen = 0

    for line in sys.stdin:
        data = line.strip().split(',')
        data = map(int, data)
        a = data[0]
        b = data[1]
        c = data[2]

        if is_rect_angle(a, b, c):
            rect += 1

        if is_lozenges(a, b, c):
            lozen += 1

    print rect
    print lozen


def is_rect_angle(a, b, c):
    return a**2 + b**2 == c**2


def is_lozenges(a, b, c):
    return a == b

main()

Measured memory_bytes: 4216
#include<cstdio>
long long p,ans=1,n;
int main()
{
	scanf("%lld%lld",&n,&p);
	if (n==1)
	{
		printf("%lld\n",p);
		return 0;
	}
	for (long long i=2;i*i<=p;i++)
	{
		long long cnt=0;
		while (p%i==0) ++cnt,p=p/i;
		for (long long j=1;j*n<=cnt;j++) ans=ans*i;
	}
	printf("%lld\n",ans);
}

Measured memory_bytes: 128
///Nahid Hasan Raju
#include <bits/stdc++.h>

#define MS(ARRAY,VALUE) memset(ARRAY,VALUE,sizeof(ARRAY))
#define Fin freopen("input.txt","r",stdin)
#define FAST ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define Fout freopen("output.txt","w",stdout)
#define rep(i,a,b) for(i=a;i<=b;i++)
#define EPS 0.00000001
#define INF INT_MAX
#define PI 2*acos(0.0)
#define P1(XX) cout<<"db1: "<<XX<<endl
#define P2(XX,YY) cout<<"db2: "<<XX<<" "<<YY<<endl
#define P3(XX,YY,ZZ) cout<<"db3: "<<XX<<" "<<YY<<" "<<ZZ<<endl
#define set(XX,POS) XX|=(1<<POS)
#define reset(XX,POS) XX&=(~(1<<POS))
#define check(XX,POS) (bool)(XX&(1<<POS))
#define toggle(XX,POS) (XX^(1<<POS))
#define SORT(v) sort(v.begin(),v.end())
#define REVERSE(V) reverse(v.begin(),v.end())
#define VALID(X,Y,R,C) X>=0 && X<R && Y>=0 && Y<C
#define SIZE(ARRAY) sizeof(ARRAY)/sizeof(ARRAY[0])
#define RT printf("Run Time : %0.3lf seconds\n", clock()/(CLOCKS_PER_SEC*1.0))
#define pla(i,a,n) for(i=0;i<n;i++){printf("%lld%c", a[i],i==n-1[' ','\n']);}
#define ll long long
#define pll pair<ll,ll>
#define pii pair<int,int>


using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;
typedef tree< pair<int,int> , null_type, less< pair<int,int> >, rb_tree_tag, tree_order_statistics_node_update> odrst;

#define MOD 1000000007LL
#define MX 200006


/*------------------------------Graph Moves----------------------------*/
//const int fx[]={+1,-1,+0,+0};
//const int fy[]={+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*---------------------------------------------------------------------*/
ll a[MX];
ll n;
int main()
{
    //Fin;
    int test, tc=0, i, j;
    ll m,t,o,e;
    //scanf("%d", &test);
    test=1;
    while(test--)
    {
        t=0;
        o=e=0;
        cin>>n;
        for(i=0;i<n ; i++)
        {
            scanf("%lld", &a[i]);
            if(i%2==0 && a[i]%2==1)o++;
        }
            cout<<o<<endl;
    }
    return 0;
}



Measured memory_bytes: 3796
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#define int         int64_t
#define ii          pair<int,int>
#define dd          pair<double,double>
#define vi          vector<int>
#define pb          push_back
#define all(x)      (x).begin(), (x).end()
#define checkBit(v, p)      (v&(1LL << p))
#define loop(i,a,b) for(int i = a;i < int(b);i++)
#define x           first
#define y           second
using namespace std;
int inf = 2e9, mod = 1e9 + 7;

int32_t main()
{
    ios_base::sync_with_stdio(false); cout << fixed <<setprecision(0);
    int n,res = 0; cin >> n;
    if(n == 1) return cout << n << endl, 0;
    if(n == 2) return cout << n * n % mod<< endl, 0;
    vi dp(n);
    dp[0] = dp[1] = 1;
    res = (n-1) * (n-1) * 2;
    for(int i = 2, tmp = 1;i < n;i++){
        dp[i] = tmp % mod;
        res = (res + dp[i] * (n-1) % mod * (i == n-1 ? 1 : (n-1)) % mod) % mod;
        tmp = (tmp + dp[i] + dp[i-2] - dp[i-1] + mod) % mod;
    }
    for(int i = 1;i < n;i++ ){
        res = (res + (n-1) * dp[i-1] % mod) % mod;
    }
    cout << (res + 1) % mod << endl;
    return 0;
}


Measured memory_bytes: 8064
#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <utility>
#include <map>
#include <list>
#include <climits>
#include <set>
#include <deque>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <bitset>

// #define cerr if(false)cerr
#define watch(x) cerr << "> " << #x << ": " << x << "\n";

using namespace std;

template <typename T>
std::ostream &operator <<(std::ostream &out, vector<T> &v) {
	for (typename vector<T>::size_type i = 0; i < v.size(); ++i)
		out << v[i] << " ";
	out << "\n";
    return out;
}
template <typename T, typename N>
std::ostream &operator <<(std::ostream &out, vector<pair<T, N> > &v) {
	for (size_t i = 0; i < v.size(); ++i)
		out << "(" << v[i].first << ", " << v[i].second << ") ";
	out << "\n";
    return out;
}
template <typename T>
std::ostream &operator <<(std::ostream &out, vector<vector<T> > &v) {
	for (size_t i = 0; i < v.size(); ++i) {
		for (size_t j = 0; j < v[i].size(); ++j) {
			out << v[i][j] << " ";
		}
		out << "\n";
	}
   	return out;
}

int main() {

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

	int a, b, c;
	cin >> a >> b >> c;

	int actions = 0;
	for (int i = 1; i <= 1000; ++i) {
		if (a & 1 || b & 1 || c & 1) {
			cout << actions << "\n";
			return 0;
		}

		int half_a = a / 2;
		int half_b = b / 2;
		int half_c = c / 2;
		a = half_b + half_c;
		b = half_a + half_c;
		c = half_a + half_b;
		++actions;
	}

	cout << "-1\n";

	return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); i++) 
#define FOR(i, a, b) for(int (i) = a; (i) < (int)b; i++)
#define RREP(i, n) for(int (i)=((int)(n)-1); (i)>=0; i--)
#define RFOR(i, a, b) for(int (i) =((int)(b)-1); (i)>=(int)a; i--)
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
#define NIL -1
#define FI first
#define SE second
#define MP make_pair
#define PB push_back
#define SZ(x)  (int)x.size()
#define SP(x)  setprecision((int)x)


using namespace std ;
typedef long long ll;
typedef vector<int> vint;
typedef vector<vint> vvint;
typedef vector<string> vstr;
typedef pair<int, int> pii;
const int INF = 1e9;
const ll LINF = 1e18;
const double EPS = 1e-9;
ll gcd(ll a, ll b) {return b ? gcd(b, a % b) : a;} //最大公約数
ll lcm(ll a, ll b) {return a / gcd(a, b) * b;} //最小公倍数

//-------------------------------------------------
// 
void yes(){
  cout <<"Yes"<<endl ;
}
void no(){
  cout <<"No"<<endl ;
}


//-------------------------------------------------
// メモ




//-------------------------------------------------


int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  string s ;
  cin >> s ;
  if(s=="hi" || s=="hihi"|| s=="hihihi"|| s=="hihihihi"|| s=="hihihihihi" ){
    cout << "Yes" <<endl ;
  }
  else{
    cout <<"No"<<endl ;
  }
  
  
  
  return 0 ;
}




Measured memory_bytes: 256
#include<iostream>
#include<string>

using namespace std;

int main(){
	int n,m,sum;
	sum=0;
	string S[1000],T;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>S[i];
	}
	cin>>m;
	for(int i=0;i<m;i++){
		cin>>T;
		for(int j=0;j<n;j++){
			if(S[j]==T){
				sum++;
				if(sum%2==0){
					cout<<"Closed by "<<T<<endl;
				}
				else{
					cout<<"Opened by "<<T<<endl;
				}
				goto Exit;
			}
		}
		cout<<"Unknown "<<T<<endl;
Exit:;
	}
	return 0;
}

Measured memory_bytes: 1224
N = gets.to_i
a_list = gets.split.map(&:to_i)
diff_list = a_list.map.with_index do |a, i|
  a - i - 1
end.sort

def calc(diff_list, b)
  diff_list.map do |d|
    (d - b).abs
  end.reduce(&:+)
end

ans = calc(diff_list, diff_list[N / 2])
puts ans


Measured memory_bytes: 20708
#include<iostream>
#include<cstdio>
#include<queue>
#include<vector>
#define FOR(i,a,b) for(int i=a;i<=b;i++)
using namespace std;
const int N=55,INF=1000010000;
int cas,n,u,v,o,cnt,rt;
int a[N][N],b[N][N],c[N],t[N];
queue<int>q;
struct graph{
	int f[N],d[N];
	vector<int>ve[N];
	void clr(){FOR(i,0,N-1) ve[i].clear(),d[i]=f[i]=0;}
	void add(int u,int v){ve[u].push_back(v),d[v]++;}
	void del(int u,int v){ve[u].pop_back();  d[v]--;}
	void dfa(int u){
		for(int v:ve[u])if(v!=f[u] && a[u][v])
			f[v]=u,c[v]=c[u]|!(a[u][v]&b[u][v]),dfa(v);
	}
	void dfb(int u){
		for(int v:ve[u])if(v!=f[u] && b[u][v])
			f[v]=u,c[v]=c[u]|!(a[u][v]&b[u][v]),dfb(v);
	}
	int top(){
		int sum=0;
		FOR(i,1,n)if(c[i] && !d[i]) q.push(i);
		while(q.size()){
			u=q.front();q.pop();sum++;
			for(int v:ve[u])if(!--d[v]) q.push(v);
		}
		return sum;
	}
}A,B,G;
int chk(int r){
	a[rt][o]=a[o][rt]=0;
	a[rt][r]=a[r][rt]=1;
	A.add(rt,r);A.add(r,rt);
	FOR(i,1,n) A.f[i]=B.f[i]=c[i]=0;
	A.dfa(rt);B.dfb(rt);
	cnt=0;G.clr();
	FOR(i,1,n)if(c[i]){
		cnt++;
		if(c[A.f[i]]) G.add(i,A.f[i]);
		if(c[B.f[i]]) G.add(B.f[i],i);
	}
	a[rt][o]=a[o][rt]=1;
	a[rt][r]=a[r][rt]=0;
	A.del(rt,r);A.del(r,rt);
	return G.top()==cnt?cnt:INF;
}
int work(){
	scanf("%d",&n);
	FOR(i,2,n) scanf("%d%d",&u,&v),A.add(u,v),A.add(v,u),a[u][v]=a[v][u]=1,t[u]=v,t[v]=u;
	FOR(i,2,n) scanf("%d%d",&u,&v),B.add(u,v),B.add(v,u),b[u][v]=b[v][u]=1;
	FOR(i,1,n) A.f[i]=B.f[i]=c[i]=0;rt=0;
	A.dfa(1);B.dfb(1);
	int ret=0;
	FOR(i,1,n)if(c[i]) ret=INF;
	FOR(i,1,n)if(A.d[i]==1)FOR(j,1,n)if(j!=i && j!=t[i])
		rt=i,o=t[i],ret=min(ret,chk(j)+1);
	A.clr();B.clr();
	FOR(i,1,n)FOR(j,1,n) a[i][j]=b[i][j]=0;
	return ret==INF?-1:ret;
}
int main(){
	//freopen("1.in","r",stdin);
	scanf("%d",&cas);
	while(cas--) cout<<work()<<'\n';
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef double db;
#define go(u) for(int i = head[u], v = e[i].to; i; i=e[i].lst, v=e[i].to)
#define rep(i, a, b) for(int i = a; i <= b; ++i)
#define pb push_back
#define re(x) memset(x, 0, sizeof x)
inline int gi() {
    int x = 0,f = 1;
    char ch = getchar();
    while(!isdigit(ch)) { if(ch == '-') f = -1; ch = getchar();}
    while(isdigit(ch)) { x = (x << 3) + (x << 1) + ch - 48; ch = getchar();}
    return x * f;
}
template <typename T> inline bool Max(T &a, T b){return a < b ? a = b, 1 : 0;}
template <typename T> inline bool Min(T &a, T b){return a > b ? a = b, 1 : 0;}
const int N = 2e5 + 7, mod = 924844033;
int n, edc, len;
int head[N], son[N];
LL inv[N], fac[N], invfac[N];
vector<int>G[N];
LL Pow(LL a, LL b) {
	LL res = 1;
	for(; b; b >>= 1, a = a * a % mod) if(b & 1) res = res * a % mod;
	return res;
}
typedef vector<LL> py;
py A, B;
void ntt(py &c, int f) {
	int n = c.size();
	for(int i = 0, j = 0; i < n; ++i) {
		if(i > j) swap(c[i], c[j]);
		for(int k = n >> 1; (j ^= k) < k; k >>= 1);
	}
	for(int i = 1; i < n; i <<= 1) {
		LL wn = Pow(5, (mod - 1) / (i << 1));
		if(f == -1) wn = Pow(wn, mod - 2);
		for(int j = 0; j < n; j += i << 1) {
			LL w = 1;
			for(int k = 0; k < i; ++k, w = w * wn % mod) {
				 LL x = c[j + k], y = w * c[j + k + i] % mod;
				 c[j + k] = (x + y) % mod;
				 c[j + k + i] = (x - y + mod) % mod;
			}
		}
	}
	if(f == -1) {
		LL inv = Pow(n, mod - 2);
		for(int i = 0; i < n; ++i) c[i] = c[i] * inv % mod;
	}
}
py operator *(py a, py b) {
	int n = a.size(), m = b.size();
	for(len = 1; len <= n + m - 2; len <<= 1);
	a.resize(len), ntt(a, 1);
	b.resize(len), ntt(b, 1);
	for(int i = 0; i < len; ++i) a[i] = a[i] * b[i] % mod;
	ntt(a, -1);
	return a.resize(n + m - 1), a;
}
void dfs(int u, int fa) {
	son[u] = 1;
	for(auto v:G[u]) if(v ^ fa) {
		dfs(v, u);
		son[u] += son[v];
		++B[son[v]];
		++B[n - son[v]];
	}
}
LL C(int n, int m) {
	return fac[n] * invfac[n - m] % mod * invfac[m] % mod;
}
int main() {
#ifdef fwat
#endif
	inv[1] = fac[0] = invfac[0] = 1;
	rep(i, 1, N - 1) {
		if(i ^ 1) inv[i] = (mod - mod / i) * inv[mod % i] % mod;
		fac[i] = fac[i - 1] * i % mod;
		invfac[i] = invfac[i - 1] * inv[i] % mod;
	}
	n = gi();
	B.resize(n + 1);
	rep(i, 1, n - 1) {
		int x = gi(), y = gi();
		G[x].pb(y);
		G[y].pb(x);
	}
	dfs(1, 0);
	rep(i, 1, n) B[i] = B[i] * fac[i] % mod;
	reverse(B.begin(), B.end());
	rep(i, 0, n) A.pb(invfac[i]);
	A = A * B;
	rep(i, 1, n) {
		printf("%lld\n", (n * C(n, i) % mod - invfac[i] * A[n - i] % mod + mod) % mod);
	}
	return 0;
}

Measured memory_bytes: 41916
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;

#define REP(i,n) for(int (i)=0; (i)<(n); (i)++)
#define For(i,a,b) for(int (i)=(a); (i)<(b); (i)++)

int main() {
    int a, b;
    cin >> a >> b;
    if (a < b) cout << "a < b" << endl;
    else if (b < a) cout << "a > b" << endl;
    else cout << "a == b" << endl;
    return 0;
}

Measured memory_bytes: 1156
#include<iostream>
using namespace std;
int main()
{
	int H, W, i,j;
	while (1)
	{
		cin >> H >> W;
		if (H == 0 && W == 0)break;
		for (i = 0; i < H; i++)
		{
			for (j = 0; j < W; j++)
			{
				if (i == 0 || i == H - 1 || j == 0 || j == W - 1)cout << "#";
				else cout << ".";
			}
			cout << endl;			
		}
		cout << endl;
	}
	return 0;
}


Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n;
		while ((n = sc.nextInt()) != 0) {
			int[] s = new int[n];
			double m = 0, sd = 0;
			
			for (int i=0; i < n; i++) {
				s[i] = sc.nextInt();
				m += s[i];
			}
			m /= n;
			for (int i: s) sd += (i - m) * (i - m);
			System.out.println(Math.sqrt(sd/n));
		}
		sc.close();
	}
}

Measured memory_bytes: 23752
using System;
using System.Collections.Generic;
class Solve{
    int N;
    int[] a;
    public Solve(){}
    public static int Main(){
        new Solve().Calc();
        return 0;
    }
    void Calc(){
        getinput();
        int sum = 0;
        long count = 0;
        int ave;
        for(int i=0;i<N;i++){
            sum += a[i];
        }
        ave = sum/N+(sum%N > N/2 ? 1 : 0);
        for(int i=0;i<N;i++){
            count += (a[i]-ave)*(a[i]-ave);
        }
        Console.WriteLine(count);
    }
    void getinput(){
        N = int.Parse(Console.ReadLine());
        string[] str = Console.ReadLine().Split(' ');
        a = new int[N];
        for(int i=0;i<N;i++){
            a[i] = int.Parse(str[i]);
        }
    }    
}

Measured memory_bytes: 2648
#include<stdio.h>
int main(){
  int w=-1,h,f[110][110],d[110][110],i,j,k,p,b,c,m=1;
  char s[15];
  while(scanf("%d",&h),h){
    int t[110]={0};
    int y[110]={0};
    if(w+1)printf("\n");
    scanf("%d",&w);
    for(i=c=0;i<=h;i++){
      for(j=0;j<=w;j++){
	scanf("%s",s);
	d[i][j]=f[i][j]=0;
	if(s[0]=='?'){
	  y[i]++;
	  t[j]++;
	  f[i][j]=1;
	  c++;
	}
	else{
	  m=1;
	  if(s[k=0]=='-'){
	    m=-1;
	    k++;
	  }
	  for(;s[k];k++)d[i][j]=d[i][j]*10+s[k]-'0';
	  d[i][j]*=m;
	}
      }
    }
    while(c){
      b=1;
      for(j=0;j<w;j++){
	if(t[j]-1)continue;
	for(i=b=t[j]=0;i<h;i++){
	  if(f[i][j]==1)p=i;
	  d[h][j]-=d[i][j];
	}
	d[p][j]=d[h][j];
	y[p]--;
	f[p][j]=2;
	c--;
      }
      for(i=0;i<h;i++){
	if(y[i]-1)continue;
	for(j=b=y[i]=0;j<w;j++){
	  if(f[i][j]==1)p=j;
	  d[i][w]-=d[i][j];
	}
	d[i][p]=d[i][w];
	t[p]--;
	f[i][p]=2;
	c--;
      }
      if(b)break;
    }
    if(c)printf("NO\n");
    else{
      for(i=0;i<h;i++){
	for(j=0;j<w;j++){
	  if(f[i][j])printf("%d\n",d[i][j]);
	}//printf("\n");
      }
    }
  }
  return 0;
}

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


typedef long long ll;
typedef vector<long long> VLL;
typedef vector<pair<int,int>> VP;
#define INF (int)(1e9)
#define MAXX 1.1529215e+18
#define inf 999999
#define EPS (1e-7)
#define MOD (1e9+7)
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,n) for(int i=1;i<=(int)(n);i++)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define ALL(a)  a.begin(),a.end()
#define RALL(a) a.begin(),a.end(),greater<int>()
#define ROT(a) a.begin(),a.begin()+1,a.end()
#define RROT(a) a.begin(),a.end()-1,a.end()
#define PB push_back
#define MP make_pair
#define PI acos(-1.0)
#define sz(a) a.size()
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
/*--------------------------------------------*/


int main(){
  //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
  	cin >> s;
  
  	int N = sz(s);
  
  	int c_s = 0, c_t = 0;
  	
  	rep(i,N){
      if(s[i] == 'S'){
        c_s++;
      }else{
        if(c_s>0)c_s--;
        else c_t++;
      }
    }

	cout << c_s+c_t << endl; 
}


Measured memory_bytes: 720
#include<bits/stdc++.h>
typedef long long ll;
#define rep(i, n) for (int i=0; i < n; i++)
#define repran(i, a,b) for (int i = a; i<b;i++)
#define repd(i, n) for (int i = n-1; i > -1; i--)
#define all(x) (x).begin(), (x).end()
using namespace std;
using LP = pair<ll,ll>;
using P = pair<int,int>;
const ll mod = 1e9+7;

struct L
{
    int a, b, c;
    L(int a = 0, int b = 0, int c = 0): a(a), b(b), c(c) {};
};

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

int main()
{
    int n, m;
    cin >> n >> m;
    map<int, int> mpX, mpY;
    mpX[0] = 0;
    mpY[0] = 0;
    vector<L> lh, lv;
    rep(i, n){
        int a, b, c;
        cin >> a >> b >> c;
        mpX[a] = 0;
        mpX[b] = 0;
        mpY[c] = 0;
        lh.emplace_back(a,b,c);
    }
    rep(i, m){
        int a, b, c;
        cin >> c >> a >> b;
        mpY[a] = 0;
        mpY[b] = 0;
        mpX[c] = 0;
        lv.emplace_back(a,b,c);
    }
    vector<int> xs, ys;
    for (auto& p : mpX){
        p.second = xs.size();
        xs.push_back(p.first);
    }
    for (auto& p : mpY){
        p.second =ys.size();
        ys.push_back(p.first);
    }

    int h = 2*xs.size();
    int w = 2*ys.size();
    vector<vector<int>> d(h, vector<int>(w));
    rep(i, n){
        int a = mpX[lh[i].a]*2;
        int b = mpX[lh[i].b]*2;
        int c = mpY[lh[i].c]*2;
        repran(x, a, b+1) d[x][c] = -1;
    }
    rep(i, m){
        int a = mpY[lv[i].a]*2;
        int b = mpY[lv[i].b]*2;
        int c = mpX[lv[i].c]*2;
        repran(y, a, b+1) d[c][y] = -1;
    }
    queue<P> q;
    int sx = mpX[0]*2;
    int sy = mpY[0]*2;
    q.emplace(sx, sy);
    d[sx][sy] = 1;
    while (!q.empty())
    {
        int x = q.front().first; 
        int y = q.front().second;
        q.pop();
        rep(v, 4){
            int nx = x+dx[v]; 
            int ny = y+dy[v]; 
            if (nx<0 or nx>=h or ny<0 or ny>=w) continue;
            if (d[nx][ny] != 0 ) continue;
            d[nx][ny] = 1;
            q.emplace(nx, ny);
        }
    }
    ll ans = 0;
    rep(x, h) rep(y, w){
        if (d[x][y] != 1) continue;
        if (x==0 or x == h-1 or y == 0 or y == w-1){
            cout << "INF" << endl;
            return 0;
        }
        if (x%2 == 0 or y%2 == 0) continue;
        ll ex = xs[x/2+1]-xs[x/2];
        ll ey = ys[y/2+1]-ys[y/2];
        ans += ex*ey;
    }   
    cout << ans << endl;
    return 0;    
}

Measured memory_bytes: 144416
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
const int MOD = ((int)1e9)+7;
const int INF = (int)(1e9)+(int)(1e7);
const ll INFL = (ll)(1e18)+INF;
const double EPS = 1e-8;
using namespace std;
int main()
{
    string S;
    cin >> S;
    rep(i,S.size()){
        cout << 'x';

    }
    cout << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <stdio.h>
#include <math.h>
#include <cmath>
using namespace std;
#define vsort(vec) sort(vec.begin(), vec.end())
#define vreverse(vec) reverse(vec.begin(), vec.end())
using ll =long long;
const ll INF =1001001001;

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

//素数判定
ll isprime(ll n){
  bool prime=true;
  for(int i=2;i<n;i++){
    if(n%i==0){
      prime=false; break;
    }
  }
if(prime){cout<<n<<" is prime"<<endl;
         }else{cout<<n<<" is not prime"<<endl;}

}
//階乗　20くらいが限界
ll factorial(ll n){
  ll a=1;ll b=n;
  for(int i=0;i<n;i++){
    a*=b;
    b--;
  }
  return a;
}

//組み合わせ　nCr
ll comb(ll a,ll b){
  ll c;
  c=factorial(a)/(factorial(a-b)*factorial(b));
  return c; 
}




/*10億7。　　　100000007
2*2行列 H*W
vector<vector<int>> vec(H,vector<int>(W));
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
cin>>vec[i][j];
  }
}

文字列→数列
string S;int A=atoi(S.c_str());
数列→文字列
int A;string S=to_string(A);
数字判定　isdigit(a)
pair宣言　pair<int,int> p(5,7);
ソート　sort(vec.begin(),vec.end());
キュー　queue<int> q;
   q.push(7);　//７が入る
   cout << q.front() << endl;  // 先頭の値を出力
   q.pop();  // 先頭の値を削除
*/



int main(void){
cout<<fixed<<setprecision(14);
//cin.tie(0); ios::sync_with_stdio(false);

int A,B,C;
  cin>>A>>B>>C;
  int K;
  cin>>K;
  
    
for(int i=0;i<K;i++){
  if(A>=B){
    B=B*2;
    continue;
  }
  if(B>=C){
    C=C*2;
  }
}
  if(A<B&&B<C){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
  
  
}




Measured memory_bytes: 3628
import heapq as hq

X, Y, Z, K = [int(n) for n in input().strip().split(' ')]
A = sorted([int(s) for s in input().strip().split(' ')], reverse=True)
B = sorted([int(s) for s in input().strip().split(' ')], reverse=True)
C = sorted([int(s) for s in input().strip().split(' ')], reverse=True)

q = []
i, j, k = 0, 0, 0
hq.heappush(q, (-(A[0] + B[0] + C[0]), i, j, k))
pushed = {(0, 0, 0)}

for _ in range(K):
    s, *idx = hq.heappop(q)
    idx = tuple(idx)

    print(-s)

    i, j, k = idx
    if i < X - 1 and (i + 1, j, k) not in pushed:
        hq.heappush(q, (-(A[i + 1] + B[j] + C[k]), i + 1, j, k))
        pushed.add((i + 1, j, k))
    if j < Y - 1 and (i, j + 1, k) not in pushed:
        hq.heappush(q, (-(A[i] + B[j + 1] + C[k]), i, j + 1, k))
        pushed.add((i, j + 1, k))
    if k < Z - 1 and (i, j, k + 1) not in pushed:
        hq.heappush(q, (-(A[i] + B[j] + C[k + 1]), i, j, k + 1))
        pushed.add((i, j, k + 1))


Measured memory_bytes: 4852
#include <bits/stdc++.h>
using namespace std;
#define mp(a,b) make_pair(a,b)
#define ff first
#define setp(a) setprecision(a)<<fixed
#define ss second
#define fori(v) for(ll i=0; i<v; i++)
#define forj(v) for(ll j=0; j<v; j++)
#define fork(v) for(ll k=0; k<v; k++)
#define forl(v) for(ll l=0; l<v; l++)
#define fort(v) for(ll t=0; t<v; t++)
#define forz(v) for(ll z=0; z<v; z++)	
#define forx(v) for(ll x=0; x<v; x++)
#define fory(v) for(ll y=0; y<v; y++)
#define ll long long
#define pb(a) push_back(a)
const ll INF = 0x3f3f3f3f;
const ll inf = pow(10,18);
ll modulo = pow(10,9)+7  ;
#define ld long double
#define MAX (int)(330)


void deal(){
	ll n;
	cin>>n;
	vector<ll> arr(n+1);
	vector<ll> sms(n+1,0);
	fori(n)
		cin>>arr[i+1], sms[i+1] = sms[i] + arr[i+1];
	vector<vector<ll> > dp(n+1, vector<ll> (n+1,0));
	for(ll gap = 1; gap < n ; ++gap)
		for(ll i = 1, j = gap+1; j<=n; i++, j++){
			dp[i][j] = inf;
			for(ll k = i; k<j; k++)
				dp[i][j] = min(dp[i][j], dp[i][k] + dp[k+1][j]);
			dp[i][j]+=sms[j] - sms[i-1];
		}
	cout<<dp[1][n];
}
 
int main(){
	cin.tie(0);
	ios_base::sync_with_stdio(0);
	deal();
}
 
/*
 
5 1
1 2 3 4 5


*/

Measured memory_bytes: 1536
#[allow(unused_imports)]
use std::{cmp::Reverse, collections::*};

#[allow(unused_imports)]
use proconio::{
    fastout, input,
    marker::{Chars, Usize1},
};

#[allow(unused_imports)]
use itertools::Itertools;

#[allow(unused_imports)]
use num::Integer;

#[fastout]
pub fn main() {
    input! {
        n: f64, x: f64, t: usize,
    }
    println!("{}", (n / x).ceil() as usize * t);
}


Measured memory_bytes: 2660
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define vll vector<ll>
#define pll pair<ll,ll>
#define vpll vector<pll>
#define ub upper_bound
#define lb lower_bound
#define all(v) ((v).begin()),((v).end())
#define allr(v) ((v).rbegin()),((v).rend())
#define ff first
#define ss second
#define mp make_pair
#define pll pair<ll,ll> 
#define fo(i,n) for(ll i=0;i<n;i++)
#define foa(i,s,e) for(ll i=(s);i<e;i++)
#define fod(i,s,e) for(ll i= (s);i>=(e);i--)
#define max3(a,b,c) max(max(a,b),c)
#define min3(a,b,c) min(min(a,b),c)
#define deb(x) cerr<<#x<<' '<<'='<<' '<<x<<'\n'
#define sz(x) (ll)(x.size())
const ld pi = 3.14159265358979323846;
ll MOD = 1e9 + 7;
//ll MOD = 998244353;
const char nl = '\n';
const ll inf = 1e15;
ll mul(ll x,ll y){
    return (1ll* (x%MOD)*(y%MOD));
}
ll modpow(ll x,ll y){ll z=1;while(y>0){if(y%2)z=mul(z,x);x =mul(x,x) ;y/=2;}return z;}
ll power(ll x,ll y){ll z=1;while(y>0){if(y%2)z=z*x;x =x*x ;y/=2;}return z;}
ll gcd(ll a,ll b){if(a<b) return gcd(b,a);if(b==0) return a;return gcd(b,a%b);} 
ll min(ll a,ll b){if(a<b)return a;return b;}
ll max(ll a,ll b){if(a>b)return a;return b;}
ll sq(ll a){
    ll ans = (1ll*a*a);
    return ans;
}
void solve(){
    ll h,w,k;
    cin>>h>>w>>k;
    string s[h];
    fo(i,h){
        cin>>s[i];
    }
    ll p = (1<<h);
    ll q= (1<<w);
    ll ans = 0;
    fo(x,p){
        fo(y,q){
            //deb(x),deb(y);
            ll su = 0;
            fo(i,h){
                if((x>>i)&1)continue;
                fo(j,w){
                    if((y>>j)&1)continue;
                    if(s[i][j] == '#')su++;
                }
            }
            if(su==k)ans++;
        }
    }
    cout<<ans<<nl;
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0),cout.tie(0);
    #ifndef ONLINE_JUDGE
    freopen("inputf.txt" , "r" , stdin) ;
    freopen("outputf.txt" , "w" , stdout) ;
    freopen("error.txt" , "w" , stderr) ;
    #endif
    ll t = 1;
    //cin>>t;
    while(t--){
        solve();
    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";


}


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

long long N, A, B, P[102], cnt1, cnt2, cnt3;

int main() {
	cin >> N >> A >> B;
	for (int i = 0; i < N; i++) {
		cin >> P[i];
		if (P[i] <= A) cnt1++;
		if (P[i] > A && P[i] <= B) cnt2++;
		if (P[i] > B) cnt3++;
	}
	cout << min({ cnt1, cnt2, cnt3 }) << endl;
	return 0;
}

Measured memory_bytes: 256
N = int(input())
A = input()
B = input()
C = input()
r = 0
for i in range(N):
  a, b, c = A[i], B[i], C[i]
  if a == b == c:
    continue
  elif a == b or b == c or c == a:
    r += 1
  else:
    r += 2
print(r)


Measured memory_bytes: 3060
#include <iostream> 
#include<vector>
#include<algorithm>
#include<map>
#include<iomanip>
#include<set>
#include<queue>
#include<deque>
#include<iomanip>
#include<sstream>
#include<cmath>
#include<bitset>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define req(i,n) for(ll i = 1;i <=  n; i++)
#define rreq(i,n) for(ll i = n;i >= 1;i--)
#define ALL(obj) begin(obj), end(obj)
#define RALL(a) rbegin(a),rend(a)
typedef long long int ll;
typedef long double ld;
const ll INF = 1e18;
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T & val) {
    std::fill((T*)array, (T*)(array + N), val);
}
const int MOD = 1000000007;
int main(void) {
    int n, t; cin >> n >> t;
    vector<int> a(n + 10), b(n + 10);
    req(i, n) cin >> a[i] >> b[i];
    vector<vector<int>> dp1(n+10, vector<int>(t)), dp2(n+10, vector<int>(t));
    req(i, n) {
        rep(j, t) {
            dp1[i][j] = dp1[i - 1][j];
            if (j >= a[i]) dp1[i][j] = max(dp1[i][j], dp1[i - 1][j - a[i]] + b[i]);
        }
    }rreq(i, n) {
        rep(j, t) {
            dp2[i][j] = dp2[i + 1][j];
            if (j >= a[i])dp2[i][j] = max(dp2[i][j], dp2[i + 1][j - a[i]] + b[i]);
        }
    }
    int ans = 0;
    req(i, n) {
        rep(j, t) {
            ans = max(ans, dp1[i - 1][j] + dp2[i + 1][t - 1 - j] + b[i]);
        }
    }cout << ans << endl;
}

Measured memory_bytes: 73980
#include<algorithm>
#include<climits>
#include<cmath>
#include<cstring>
#include<deque>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;

using lint = long long;
using P = pair<int, int>;
using LLP = pair<long long, long long>;

#define REP(i, x, n) for(int i = (x), i##_len = int(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = int(n) ; i < i##_len ; ++i)
#define reps(i, n) for(int i = 1, i##_len = int(n) ; i <= i##_len ; ++i)
#define rrep(i, n) for(int i = int(n) - 1 ; i >= 0 ; --i)
#define rreps(i, n) for(int i = int(n) ; i > 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())
#define TWINS(x) cout << ((x) ? "Yay!" : ":(") << endl

const int IINF = (1 << 30) - 1;
const long long LLINF = 1LL << 61;
const int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};
const double EPS = 1e-8;

const lint MOD = 1000000007LL;

vector<lint> fact, inv;

lint comb(lint n, lint r){
    if(n < 0LL || n < r){
        return 0LL;
    }
    return (fact[n] * inv[r] % MOD) * inv[n - r] % MOD;
}

lint power(lint x, lint n){
    lint res = 1;
    while(n > 0){
        if(n & 1){
            res *= x;
            res %= MOD;
        }
        x *= x;
        x %= MOD;
        n >>= 1;
    }
    return res;
}

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

    int n, k;
    cin >> n >> k;

    fact.resize(n * 2 + 1);
    inv.resize(n * 2 + 1);
    fact[0] = 1;
    inv[0] = 1;
    reps(i, n * 2){
        fact[i] = fact[i - 1] * i % MOD;
        inv[i] = power(fact[i], MOD - 2);
    }

    reps(i, k){
        cout << comb(n - k + 1, i) * comb(k - 1, i - 1) % MOD << endl;
    }

    return 0;
}

Measured memory_bytes: 384
#include <stdio.h>
int main() {
	int a, b, c, p=0, out=0;
	scanf("%d %d %d", &a, &b, &c);
	p=a;
	while (p<=b) {
		if (p) {

			if (c%p==0) out++;
		}
		p++;
	}
	printf("%d\n", out);
	return 0;
}

Measured memory_bytes: 596
N = int(input())
A = list(map(int,input().split()))

s = 0
ans1 = 0
for k in range(N):
    s += A[k]
    if k%2==0:
        if s <= 0:
            ans1 += -s+1
            s = 1
    else:
        if s >= 0:
            ans1 += s+1
            s = -1

s = 0
ans2 = 0
for k in range(N):
    s += A[k]
    if k%2==0:
        if s >= 0:
            ans2 += s+1
            s = -1
    else:
        if s <= 0:
            ans2 += -s+1
            s = 1

print(min(ans1,ans2))

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

using ll = long long;

constexpr ll MOD = 1e9+7;
constexpr ll INF = 1ll<<60;

#define FOR(i,a,b) for (ll i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

int main(int argc, char **argv)
{
	string s; cin >> s;
	ll N = (ll)s.size() - 1;

	ll res{0};
	REP(bits, 1<<N)
	{
		ll l{0};
		vector<ll> tv;
		REP(i, N)
		{
			if (bits & (1<< i))
			{
				string tmp = s.substr(l, i+1-l);
				tv.push_back(stoll(tmp));
				l = i+1;
			}
		}
		tv.push_back(stoll(s.substr(l, N-l+1)));
		res += accumulate(ALL(tv), 0ll);
	}

	std::cout << res << std::endl;
}


Measured memory_bytes: 256
import random
def main():
    D = int(input())
    C = list(map(int, input().split()))
    S = [list(map(int, input().split())) for _ in range(D)]

    score = 0
    last_day = [-1] * 26
    for d in range(D):
        print(random.randint(1, 26))


if __name__ == '__main__':
    main()


Measured memory_bytes: 9884
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#define lol(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
typedef long long ll;
using namespace std;

int main(){
	int n;
	cin>>n;
	int cnt=0,pnt=1;
	while(true){
		if(cnt>=n)break;
		cnt+=pnt;
		pnt++;
	}
	for(int i=1;i<pnt;i++){
		if(cnt-i==n)continue;
		cout<<i<<endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define reg register
#define ll long long
#define inf 0x3f3f3f3f
#define iinf 0x3f3f3f3f3f3f3f3fll
using namespace std;
int n;
char op; 
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0),cout.tie(0);
	cin>>n;
	if((n&1))cout<<(n<<1);
	else cout<<n;
} 

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

#define rep(i,N) repv(i,0,N)
#define reps(i,N) repvs(i,0,N)
#define repv(i,a,b) for(int i=a;i<b;i++)
#define repvs(i,a,b) for(int i=a+1;i<=b;i++)
#define repr(i,N) for(int i=N-1;i>=0;i--)
#define reprs(i,N) for(int i=N;i>0;i--)

#define d(a) if(isDebugMode) cout<<#a<<"="<<a<<","
#define d2(a,b) if(isDebugMode) cout<<#a<<"="<<a<<","<<#b<<"="<<b
#define d3(a,b,c) if(isDebugMode) cout<<#a<<"="<<a<<","<<#b<<"="<<b<<","<<#c<<"="<<c
#define d4(a,b,c,d) if(isDebugMode) cout<<#a<<"="<<a<<","<<#b<<"="<<b<<","<<#c<<"="<<c<<","<<#d<<"="<<d
#define da(arr,N){if(isDebugMode){rep(i,N+1){if(arr[i]==INF)printf("INF ");else cout<<arr[i]<<" ";} cout<<endl;}}
#define da2(arr,N,M){if(isDebugMode)rep(i,N+1){rep(j,M+1){if(arr[i][j]==INF)printf(" INF");else printf(" %3d",arr[i][j]);}cout<<endl;}}
#define pb push_back
#define pob pop_back
#define s(a) cout<<a<<endl;

auto chmax =[](int &a,int b){ a = max(a, b);};
auto chmin =[](int &a,int b){ a = min(a, b);};

typedef long long ll;
typedef pair<int,int> P;
const int INF = 100000000;
const int MOD = 100000007;
const int dx[4] = { 0, 1, 0,-1};
const int dy[4] = { 1, 0,-1, 0};

bool isDebugMode=1;
//--------------------------------------//
ll n,m;
string s,t;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
void solve(){
	ll g=gcd(n,m);
	if(s[0]!=t[0]) cout<<-1<<endl;
	else if(g==1) cout<<n*m<<endl;
	else{
		ll l=n*m/g;
		int a=0;
		for(ll i=0;i<l;i+=(l/n)){
			if(i%(l/m)==0&&s[a]!=t[i/(l/m)]){
				cout<<-1<<endl;
				return;
			}
			a++;
		}
		cout<<l<<endl;
	}
}

int main(){
	cin>>n>>m;
	cin>>s>>t;
	solve();
	return 0;
}


Measured memory_bytes: 512
N,K,Q=map(int,input().split())
A = [0] * N
for _ in range(Q):
  i = int(input())
  A[i-1] += 1 
for i in range(N):
  a = K - (Q - A[i])
  if a >= 1:
    print('Yes')
  else:
    print('No')
    

Measured memory_bytes: 4680
#include <iostream>
//#include <iomanip>
//#include <string>
#include <vector>
//#include <algorithm>
//#include <utility>
//#include <set>
//#include <map>
//#include <queue>
//#include <deque>
//#include <bitset>
//#include <math.h>
using namespace std ;
using ll = long long ;
//using ld = long double ;
using vll = vector<ll> ;
using vvll = vector<vll> ;
//using vc = vector<char> ;
//using vvc = vector<vc> ;
//using vb = vector<bool> ;
//using vvb = vector<vb> ;
//using pll = pair<ll,ll> ;
//#define all(v) v.begin(),v.end()
ll mod = 1000000007 ;
//long double pie = acos(-1) ;
//ll INF = 1000000000000 ;

//void yorn(bool a){if(a) cout << "Yes" << endl ; else cout << "No" << endl ;}
//void YorN(bool a){if(a) cout << "YES" << endl ; else cout << "NO" << endl ;}
//ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
//ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
//ll sa(long long a,long long b){if(a>b) return a-b ; return b-a ;}
//void mysort(vector<long long> &a){sort(a.begin(),a.end()) ;}
//void myrev(vector<long long> &a){reverse(a.begin(),a.end()) ;}
//void fix_cout(){cout << fixed << setprecision(20) ;}

int main(){
	int h,w ;
	cin >> h >> w ;
	vvll dp(h+2,vll(w+2,0)) ;
	vvll g(h+2,vll(w+2,0)) ;
	for(int i=1;i<=h;i++){
		for(int j=1;j<=w;j++){
			char c ; cin >> c ;
			g.at(i).at(j) = (c=='.') ;
		}
	}
	dp.at(1).at(0) = 1 ;
	for(int i=1;i<=h;i++){
		for(int j=1;j<=w;j++){
			if(g.at(i).at(j)){
				dp.at(i).at(j) = (dp.at(i-1).at(j)+dp.at(i).at(j-1))%mod ;
			}
		}
	}
	cout << dp.at(h).at(w) << endl ;
}


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

int sort(const void * a, const void * b) {
  if(*(int *)a < *(int *)b) {
    return 1;
  }
  else
  if(*(int *)a == *(int *)b) {
    return 0;
  }
  return -1;
}

int main() {
    int x = 0;
    int b[200] = {0};

    int N;
    scanf("%d", &N);
    int d[N];
    for (int i = 0; i < N; i++) {
        scanf("%d", &d[i]);
    }

    qsort((void *)d, N, sizeof(d[0]), sort);
    for (int i = 0; i < N; i++) {
        if (!b[d[i]]) {
            x++;
            b[d[i]] = 1;
        }
    }

    printf("%d\n", x);
    return 0;
}

Measured memory_bytes: 128
import math
k = int(input())
total = 0
gcd_ab = 0

for a in range(1,k+1):
  for b in range(1, k+1):
    for c in range(1,k+1):
      gcd_ab = math.gcd(a,b)
      total += math.gcd(gcd_ab, c)

print(total)

Measured memory_bytes: 67652
#include <iostream>
#include <iomanip>
#include <string>
#include <string.h>
#include <math.h>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
#include <deque>
#include <queue>

#define rep(i, n) for(int i = 0; i < n; ++i)
#define REP(i, m, n) for(int i = m; i < n; ++i)
#define rrep(i,n) for(int i = n; i >= 0; --i)
#define RREP(i, m, n) for(int i = n; i >= m; --i)

using ll = long long;
using ull = unsigned long long;
using pii = std::pair<int, int>;
using pll = std::pair<long long, long long>;

using namespace std;


const long long MOD = 1000000007;

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

	int a, b;
	cin >> a >> b;
	if (b%a == 0) cout << a + b << "\n";
	else cout << b - a << "\n";

	return 0;
}


Measured memory_bytes: 256
def isCLKWISE(ph):
    if (ph[-1][0] - ph[-3][0])*(- ph[-3][1] + ph[-2][1]) - (ph[-2][0] - ph[-3][0])*(- ph[-3][1] + ph[-1][1] ) < 0 : return False
    else : return True
     
def ConvexHullScan(P):
    P = sorted(P)
    phU = [P[0],P[1]]
    for p in P[2:]:
        phU.append(p)
        while(True):
            if isCLKWISE(phU) : break
            else :
                del phU[-2]
                if len(phU) == 2 : break
    phL = [P[-1],P[-2]]
    for p in P[-3::-1]:
        phL.append(p)
        while(True):
            if isCLKWISE(phL) : break
            else :
                del phL[-2]
                if len(phL) == 2 : break
    ph = phU + phL[1:-1]
    return ph
 
n = int(input())
P = []
for i in range(n):
    P.append([int(x) for x in input().split()])
     
Q = ConvexHullScan(P)
Q.reverse()
print(len(Q))
idx = min([[x[1][1],x[1][0],x[0]] for x in enumerate(Q)])[2]
R = Q[idx:] + Q[:idx]
for r in R:
    print(r[0],r[1])

Measured memory_bytes: 33468
import functools
N = int(input())
A = [int(x) for x in input().split()]
P = A[0]
Q = A[1]
R = A[2]
S = functools.reduce(lambda x, y: x + y, A[3:])
i = 1
k = 3
SR_pre = abs(S - R)
for m in range(k, N - 1):
  SR_post = abs(S - R - 2 * A[m])
  if SR_post <= SR_pre:
    SR_pre = SR_post
    R += A[m]
    S -= A[m]
    k = m + 1
  else:
    break
ans = max(P, Q, R, S) - min(P, Q, R, S)
for j in range(2, N - 2):
  Q += A[j]
  QP_pre = abs(Q - P)
  for l in range(i, j):
    QP_post = abs(Q - P - 2 * A[l])
    if QP_post <= QP_pre:
      QP_pre = QP_post
      P += A[l]
      Q -= A[l]
      i = l + 1
    else:
      break
  R -= A[j]
  SR_pre = abs(S - R)
  for m in range(k, N - 1):
    SR_post = abs(S - R - 2 * A[m])
    if SR_post <= SR_pre:
      SR_pre = SR_post
      R += A[m]
      S -= A[m]
      k = m + 1
    else:
      break
  ans = min(ans, max(P,Q, R, S) - min(P, Q, R, S))
print(ans)

Measured memory_bytes: 24764