akhauriyash/Code-Regression huggingface dataset:
import java.io.*;
import java.math.*;
import java.util.*;
import java.util.regex.*;


public class Main {

	final static long MOD = 1000000007;
	public static String[] Ws = null;
	public static int wsIndx = 0;
	public static BufferedReader in = null;
	public static long cnt=0;
	public static PrintWriter pw = new PrintWriter(System.out);
	public static void main(String[] args) throws Exception {
		solutionD(args);
		if(in!=null){
			in.close();
		}
		pw.flush();
		pw.close();
	}

	public static void solutionA(String[] args) throws Exception{

		pw.println(nextInt()*nextInt());
	}
	public static void solutionB(String[] args) throws Exception{
		int N = nextInt();
		long[] a = nextLongs();
		Arrays.sort(a);
		long ans = a[0];
		for(int i=1;i<N;i++) {
			long x = 0;
			try{
				x= Math.multiplyExact(ans, a[i]);
			}catch(Exception e) {
				pw.println(-1);
				return;
			}
			if(x>=1000000000000000001L) {
				pw.println(-1);
				return;
			}
			ans=x;
		}
		pw.println(ans);
	}
	public static void solutionC(String[] args) throws Exception{
		String A = nextString();
		String B = nextString();
		BigDecimal bA = new BigDecimal(A);
		BigDecimal bB = new BigDecimal(B);

		pw.println(bA.multiply(bB).longValue());
	}
	public static void solutionD(String[] args) throws Exception{
		long N=nextLong();
		TreeMap<Long,Long> map = primeFactorize(N);

		long ans = 0;
		long val;
		for(long key:map.keySet()) {
			if(key==1)
				continue;
			val=map.get(key);
			long n = 0;
			while(val>=n) {
				n++;
				val-=n;
				if(val<0) {
					n--;
					break;
				}
			}
			ans+=n;
		}
		pw.println(ans);
	}


	public static TreeMap<Long, Long> primeFactorize(long N) {
		TreeMap<Long, Long> map = new TreeMap<>();
		for (long i = 2; i * i <= N; i++) {
			long k = 0;
			while (N % i == 0) {
				k++;
				N /= i;
			}
			map.put(i, k);
		}
		map.put(N, 1L);
		return map;
	}

	public static void check() throws Exception{
		if(in == null){
			in = new BufferedReader(new InputStreamReader(System.in));
		}
		if(Ws==null || Ws.length<=wsIndx){
			Ws = in.readLine().split(" ");
			wsIndx=0;
		}
	}
	public static int nextInt()throws Exception{
		check();
		return Integer.parseInt(Ws[wsIndx++]);
	}

	public static long nextLong()throws Exception{
		check();
		return Long.parseLong(Ws[wsIndx++]);
	}

	public static String nextString()throws Exception{
		check();
		return Ws[wsIndx++];
	}

	public static int[] nextInts()throws Exception{
		check();
		int[] tmp = new int[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Integer.parseInt(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static long[] nextLongs()throws Exception{
		check();
		long[] tmp = new long[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Long.parseLong(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static String[] nextStrings()throws Exception{
		check();
		wsIndx=Ws.length;
		return Ws;
	}

}



Measured memory_bytes: 120524
#include <stdio.h>
#include <bits/stdc++.h>
using namespace std;
#define REP(i, a, b) for (int i = (a), _end_ = (b); i < _end_; ++i)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define mp make_pair
#define x first
#define y second
#define pb push_back
#define eb emplace_back
#define SZ(x) (int((x).size()))
#define ALL(x) (x).begin(), (x).end()

template<typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }

typedef long long LL;

const int MAX_N = 1e5 + 5;
const int INF = 0x7fffffff;
const double eps = 1e-6;

int a, b, c, x;



int main()
{
#ifdef ANONYM
    freopen("in", "r", stdin);
    freopen("out", "w", stdout);
#endif

    ios::sync_with_stdio(false);
    cin >> a >> b >> c >> x;
    int ans = 0;
    for(int i=0; i<=c; i++) {
        for(int j=0; j<=b; j++) {
            for(int k = 0; k<=a; k++) {
                if(50*i+100*j+500*k==x) ans++;
            }
        }
    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 256
module welcome_to_atcoder;
import std.stdio;
import std.container.rbtree;
import std.algorithm;

void main(string[] args)
{
    int n, m;
    readf("%d %d\n", &n, &m);
    int i;
    string s;
    int[int] penalties;
    auto acs = redBlackTree!int();
    foreach (_; 0 .. m)
    {
        readf("%d %s\n", &i, &s);
        if (s != "AC" && !(i in acs))
        {
            ++penalties[i];
            debug
            {
                writefln("%d %s :%d", i, s, penalties[i]);
            }
        }
        else
        {
            acs.stableInsert(i);
        }
    }
    writefln("%d %d", acs.length, penalties.byKeyValue.filter!(v => v.key in acs).map!"a.value".sum);
}


Measured memory_bytes: 10616
#include <bits/stdc++.h>
 
using namespace std;
 
int D[3005][3005];
 
int main() {
    ios::sync_with_stdio(false);
    
    string a, b;
    cin >> a >> b;
    
    int n = a.length();
    int m = b.length();
    
    string ans;
    
    for (int i = 1; i <= n; ++i) {
        for (int j = 1; j <= m; ++j) {
            if (a[i-1] == b[j-1]) {
                D[i][j] = D[i-1][j-1] + 1;
            }
            else {
                D[i][j] = max(D[i-1][j], D[i][j-1]);
            }
        }
    }
    
    while (n && m) {
        if (a[n-1] == b[m-1]) {
            ans += a[n-1];
            n--; m--;
        }
        else if (D[n-1][m] > D[n][m-1]) {
            n--;
        }
        else {
            m--;
        }
    }
    
    reverse(ans.begin(), ans.end());
    
    cout << ans;
    
    return 0;
}

Measured memory_bytes: 35456
#include <bits/stdc++.h>
#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 all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define vout(x) rep(i,x.size()) cout << x[i] << " "
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;

int main() {
    int n, k; cin >> n >> k;
    vll a(n+1,0);
    REP(i,n+1) cin >> a[i];
    REP(i,n+1) a[i] += a[i-1];
    vll sums;
    for (int i = 1; i <= n; i++) {
        for (int j = i; j <= n; j++) {
            sums.push_back(a[j]-a[i-1]);
        }
    }
    ll ans = 0;
    for (int i = 40; i >= 0; i--) {
        int ct = 0;
        vll tmp;
        rep(j,sums.size()) {
            if (sums[j]>>i&1) {
                ct++;
                tmp.push_back(sums[j]);
            }
        }
        if (ct >= k) {
            ans += 1LL<<i;
            swap(sums,tmp);
        } 
    }
    cout << ans << endl;
}

Measured memory_bytes: 9000
#include <iostream>
#include <stdio.h>
#include <string>
using namespace std;

int main() {
  string S, T;
  cin >> S >> T;
  int cnt = 0;
  for (int i = 0; i < S.size(); ++i) {
    cnt += S[i] != T[i];
  }
  printf("%d\n", cnt);
}

Measured memory_bytes: 3444
K = int(input())

N = 50

bias = K // 50
modn = K % 50

work = N - modn + 1
ans = []
for a in range(50-modn):
  ans.append(str(a+bias))

for a in range(50, 50-modn, -1):
  ans.append(str(a+bias))

print(N)
print(' '.join(ans))


Measured memory_bytes: 3060
// TOPSIC001_0

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;


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

    if(X == 1) {
        cout << "Hello World";
    }else{
        int Y,Z; cin >> Y >> Z;
        cout << Y+Z;
    }


    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	char S[1024 * 2] = "";
	int w;
	int i;
	if (scanf("%1023s", S) != 1) return 1;
	if (scanf("%d", &w) != 1) return 1;
	for (i = 0; S[i] != '\0'; i += w) putchar((unsigned char)S[i]);
	putchar('\n');
	return 0;
}


Measured memory_bytes: 1660
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

public class Main {

  char[] S;
  int N;

  private void solve(Scanner in, PrintWriter out) {
    N = in.nextInt();
    S = in.next().toCharArray();
    int[] sheep = new int[N];
    for (int s0 = 0; s0 <= 1; s0++) {
      for (int s1 = 0; s1 <= 1; s1++) {
        Arrays.fill(sheep, -1);
        sheep[0] = s0;
        sheep[1] = s1;
        if (check(sheep)) {
          for (int i = 0; i < N; i++) {
            out.print(sheep[i] == 1 ? "S" : "W");
          }
          out.println();
          return;
        } else {
          continue;
        }
      }
    }
    out.println(-1);
  }

  boolean check(int[] sheep) {
    for (int i = 2; i < N; i++) {
      int x;
      int prev = sheep[i - 2];
      if (S[i - 1] == 'o') {
        if (sheep[i - 1] == 1) {
          x = prev;
        } else {
          x = prev ^ 1;
        }
      } else {
        if (sheep[i - 1] == 1) {
          x = prev ^ 1;
        } else {
          x = prev;
        }
      }

      if (S[i - 1] == 'o') {
        if (sheep[i - 1] == 1) {
          if (x != prev) {
            return false;
          }
        } else {
          if (x == prev) {
            return false;
          }
        }
      } else {
        if (sheep[i - 1] == 1) {
          if (x == prev) {
            return false;
          }
        } else {
          if (x != prev) {
            return false;
          }
        }
      }
      sheep[i] = x;
    }
    if (S[N - 1] == 'o') {
      if (sheep[N - 1] == 1) {
        if (sheep[0] != sheep[N - 2]) {
          return false;
        }
      } else {
        if (sheep[0] == sheep[N - 2]) {
          return false;
        }
      }
    } else {
      if (sheep[N - 1] == 1) {
        if (sheep[0] == sheep[N - 2]) {
          return false;
        }
      } else {
        if (sheep[0] != sheep[N - 2]) {
          return false;
        }
      }
    }

    if (S[0] == 'o') {
      if (sheep[0] == 1) {
        if (sheep[1] != sheep[N - 1]) {
          return false;
        }
      } else {
        if (sheep[1] == sheep[N - 1]) {
          return false;
        }
      }
    } else {
      if (sheep[0] == 1) {
        if (sheep[1] == sheep[N - 1]) {
          return false;
        }
      } else {
        if (sheep[1] != sheep[N - 1]) {
          return false;
        }
      }
    }
    return true;
  }

  public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
    PrintWriter out = new PrintWriter(System.out);
    new Main().solve(in, out);
    in.close();
    out.close();
  }
}


Measured memory_bytes: 25376
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <vector>
#include <algorithm>
#include <set>
#include <queue>
#include <map>
#include <climits>
#include <complex>
#include <numeric>
using namespace std;

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define RREP(i,n) for(int i=(int)n-1; i>=0; i--)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define RFOR(i,c) for(__typeof((c).rbegin())i=(c).rbegin();i!=(c).rend();++i)
#define ALL(c) (c).begin(), (c).end()

typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<int, pair<int, int> > pipii;
typedef vector<int> vi;

const int INF = 1e9;
const int MOD = 1e9+7;

int main(void){
    int n, d;
    string x, ans;
    cin >> n >> x >> d;
    ans = x;
    REP(i, n){
        if(d && (x[i] == '0')){
            ans[i] = '1';
            d--;
        }
    }
    RREP(i, n){
        if(d && (x[i] == '1')){
            ans[i] = '0';
            d--;
        }
    }
    cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1208
#include <bits/stdc++.h>
using namespace std;
#define PI  3.1415926535
int main()
{
int k,l;
string s;
cin>>k>>s;
l=s.size();
if(l<=k){
    cout<<s<<endl;
    return 0;}
else{
    for(int i=0;i<k;i++)
        cout<<s[i];
}
cout<<"..."<<endl;

return 0;
}


Measured memory_bytes: 3556
import math
N = int(input())
L = []
for i in range(N):
    s = input()
    L.append(sorted(s))
L = sorted(L)
ans = 0
comb = 0
a = 0
b = 1
while b <= N-1:
    if L[a] == L[b] and b-a == 1:
        comb += 2
        b += 1
    elif L[a] == L[b]:
        comb += 1
        b += 1
    elif comb != 0:
        ans += (math.factorial(comb))//((math.factorial(comb-2))*2)
        a = b
        b = a+1
        comb = 0
    else:
        a = b
        b = a + 1
if comb != 0:
    ans += (math.factorial(comb)) // ((math.factorial(comb - 2)) * 2)
print(ans)

Measured memory_bytes: 106328
#include <stdlib.h>
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
using ll=long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
inline constexpr ll gcd(ll a,ll b){if(!a||!b)return 0;while(b){ll c=b;b=a%b;a=c;}return a;}
inline constexpr ll lcm(ll a,ll b){if(!a||!b)return 0;return a*b/gcd(a,b);}
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
const long long INF=1LL << 60;
long long a,b;
long long dp[100200][110];
long long w[110],v[110];


int main(){
   long long a,b;
   cin>>a>>b;
   vector<int> pvec(b);
   vector<string> mvec(b);
   rep(i,b){
       cin>>pvec.at(i);
       cin>>mvec.at(i);
   }
   long long wa=0;
   long long ac=0;
   vector<long long> acheck(a,0);
   vector<long long> bcheck(a,0);
   rep(i,b){
       if(mvec.at(i)=="AC"&&acheck.at(pvec.at(i)-1)==0){
           acheck.at(pvec.at(i)-1)=1;
            wa+=bcheck.at(pvec.at(i)-1);
       }
       else{
           bcheck.at(pvec.at(i)-1)++;
       }
   }
    rep(i,a){
        if(acheck.at(i)==1){
            ac++;
        }
    }
    cout<<ac<<" "<<wa<<endl;
}



Measured memory_bytes: 7680
s = int(input())
data = []
data.append(0)
data.append(s)
i = 0
while True:
    i += 1
    if data[i] % 2 == 0:
        data.append(data[i] // 2)
    else:
        data.append((3 * data[i]) + 1)
    if data[i + 1] in data[:i]:
        print(i + 1)
        exit()

Measured memory_bytes: 3060
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
//typedef tree <int,null_type,less <int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
#define rep(g, i, n) for (ll g = i; g < n; g++)
#define rev(g, n, i) for (ll g = n - 1; g >= i; g--)
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define all(v) v.begin(), v.end()
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define um unordered_multiset
#define us unordered_set
#define mxe(v) *max_element(v.begin(),v.end())
#define mne(v) *min_element(v.begin(),v.end())
#define bs binary_search
#define lb lower_bound
#define ub upper_bound
#define ve vector
#define cc continue
#define bb break
#define rem 1000000007
//fflush(stdin);
int main()
{
    FAST
    // freopen("input1.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    /*ll tests;
    cin>>tests;
    rep (gg,0,tests)
    {}*/
    ll n;
    cin>>n;
    ve <int> arr(n);
    rep (i,0,n)
    {
        cin>>arr[i];
        //arr[i]=-arr[i];
    }
    ll ans=0;
    ll a=0;
    rep (i,0,n-1)
    {
        if (arr[i+1]<=arr[i])
        {
            ans++;
        }
        else
        {
            ans=0;
        }
        a=max(ans,a);
    }
    cout<<a<<endl;

}


Measured memory_bytes: 640
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
 
const int N = 1e5 + 10 , M = 5e5+10 ,  MOD = 1e9+7;
const int OO = 0x3f3f3f3f;
const double EPS = 1e-3;
 
#define clr(arr,val) memset(arr , val , sizeof (arr))
#define loop(i,n) for(int i = 0;i < int(n);i++)
#define rloop(i,n) for(int i = int(n)-1;i >= 0;i--)
#define range(i,a,b) for(int i = int(a);i <= int(b);i++)
#define ALL(v) ((v).begin()) , ((v).end())
#define SZ(v)  ((int)((v).size()))
typedef pair <int,int> pii ;
typedef vector < pii > vii ;
typedef vector < int > vi;
int dx[]={1,0,-1,0};int dy[]={0,1,0,-1}; //4 Direction
//int dx[]={1,1,0,-1,-1,-1,0,1};int dy[]={0,1,1,1,0,-1,-1,-1};//8 direction
//int dx[]={2,1,-1,-2,-2,-1,1,2};int dy[]={1,2,2,1,-1,-2,-2,-1};//Knight Direction
//int dx[6]={2,1,-1,-2,-1,1};int dy[6]={0,1,1,0,-1,-1}; //Hexagonal Direction
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
 



int p , r ,q;


 
int main()
{
    
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);


    
    cin >> p >> q >> r;
    int op1 = p+q+r;
    int op2 = p+q;
    int op3 = q+r;
    int op4 = p +r;
    int ans = min(op1 , min(op2 , op3));
    ans = min(ans , op4);
    printf("%d\n",ans);


    


    

 
    
    return 0;
}


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

#define ll long long
#define vi vector<int>
#define vl vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
// pll pp; -> (pp.first,pp.second)
// vector<vl> pp(n,vl(2)); sort(pp.begin(),pp.end(),[](vl a,vl b){return a[0]<b[0];});

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define RREP(i,n) for(ll (i)=(n)-1;(i)>=0;(i)--)
#define FOR(i,a,b) for(ll (i)=(a);(i)<(b);(i)++)
#define FORR(i,a,b) for(ll (i)=(b)-1;(i)>=(a);(i)--)
#define DEBUG(x) cout << #x << ": " << x << endl
#define CHMAX(a,b) a=max((a),(b))
#define CHMIN(a,b) a=min((a),(b))
/*}}}*/
int main() {
  ll k;
  cin >> k;
  deque<ll> deq;
  vl cost(k,-1);
  cost[1] = 1;
  deq.push_front(1ll);
  while(!deq.empty()){
    ll nx = deq[0];
    if(nx==0){
      break;
    }
    deq.pop_front();
    ll nf;
    nf = (nx* 10ll)%k;
    if(cost[nf]<0){
      deq.push_front(nf);
      cost[nf]=cost[nx];
    }else{
      if(cost[nf]>cost[nx]){
        cost[nf] = cost[nx];
        deq.push_front(nf);
      }
    }
    nf = (nx+ 1ll)%k;
    if(cost[nf]<0){
      deq.push_back(nf);
      cost[nf]=cost[nx]+1;
    }else{
      CHMIN(cost[nf],cost[nx]+1);
    }
  }
  cout << cost[0]<< endl;
  return 0;
}


Measured memory_bytes: 1408
#include <chrono>

#include <iostream>
#include <iomanip>
#include <algorithm>
#include <bitset>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <time.h>
#include <random>
#include <string>
#include <cassert>
#include <vector>
#include <ostream>
#include <istream>
#include <stack>
#include <deque>
#include <queue>
#include <functional>

using namespace std;

#define int long long
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define pii pair<int, int>
#define ld long double

ostream& operator << (ostream &a, const vector<int> &b) {
    for (auto k : b) cout << k << " ";
    return a;
}

#ifdef LOCAL
    #define dbg(x) cout << #x << " : " << (x) << "\n";
//    const int INF = 1e18;
//    const int mod = 2600000069;
//    const int p = 10;
//    const ld PI = 3.1415926535;
#else
    #define dbg(x)
//    const int INF = 1e18;
//    const int mod = 2600000069;
//    const int p = 179;
//    const ld PI = 3.1415926535;
#endif

//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,sse3,sse4")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("fast-math")
//#pragma GCC target("avx2")
//#pragma GCC optimize("section-anchors")
//#pragma GCC optimize("profile-values,profile-reorder-functions,tracer")
//#pragma GCC optimize("vpt")
//#pragma GCC optimize("rename-registers")
//#pragma GCC optimize("move-loop-invariants")
//#pragma GCC optimize("unswitch-loops")
//#pragma GCC optimize("function-sections")
//#pragma GCC optimize("data-sections")

int n;
string s;

const int MAXN = 20e5;

bitset<30> t[MAXN];

void build(int v, int l, int r) {
    if (l + 1 == r) {
        t[v] = 0;
        t[v][s[l] - 'a'] = 1;
        return;
    }
    int m = (l + r) / 2;
    build(2 * v + 1, l, m);
    build(2 * v + 2, m, r);
    t[v] = t[2 * v + 1] | t[2 * v + 2];
}

void update(int v, int l, int r, int pos, char k) {
    if (l + 1 == r) {
        t[v] = 0;
        t[v][k - 'a'] = 1;
        return;
    }
    int m = (l + r) / 2;
    if (m > pos) update(2 * v + 1, l, m, pos, k);
    else update(2 * v + 2, m, r, pos, k);
    t[v] = t[2 * v + 1] | t[2 * v + 2];
}

bitset<30> get(int v, int l, int r, int askl, int askr) {
    if (l >= askr || r <= askl) return bitset<30>(0);
    if (l >= askl && r <= askr) return t[v];
    int m = (l + r) / 2;
    return get(2 * v + 1, l, m, askl, askr) | get(2 * v + 2, m, r, askl, askr);
}

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    #ifdef LOCAL
    #else
//        freopen("capitals.in", "r", stdin);
//        freopen("capitals.out", "w", stdout);
    #endif
    cin >> n >> s;
    build(0, 0, n);
    int q;
    cin >> q;
    int t, l, r;
    char k;
    while (q--) {
        cin >> t;
        if (t == 1) {
            cin >> l >> k;
            l--;
            update(0, 0, n, l, k);
        } else {
            cin >> l >> r;
            cout << get(0, 0, n, l - 1, r).count() << "\n";
        }
    }
}
/*

*/


Measured memory_bytes: 11164
from pprint import pprint as pp
"""
問題文
Atcoder国に、 1 本の東西方向に走る鉄道が完成しました。
この鉄道には N 個の駅があり、西から順に 1,2,…,N の番号がついています。
明日、鉄道の開通式が開かれます。
この鉄道では、1≦i≦N−1 を満たす全ての整数 i に対して、駅 i から駅 i+1 に、Ci 秒で向かう列車が運行されます。
ただし、これら以外の列車は運行されません。
駅 i から駅 i+1 に移動する列車のうち最初の列車は、開通式開始 Si 秒後に駅 i を発車し、その後は 
Fi 秒おきに駅 i を発車する列車があります。
また、Si は Fi で割り切れることが保証されます。
つまり、A%B で A を B で割った余りを表すとき、Si≦t,t%Fi=0 を満たす全ての t に対してのみ、
開通式開始 t 秒後に駅 i を出発し、開通式開始 t+Ci 秒後に駅 i+1 に到着する列車があります。
列車の乗り降りにかかる時間を考えないとき、全ての駅 i に対して、開通式開始時に駅 i にいる場合、
駅 N に到着できるのは最も早くて開通式開始何秒後か、答えてください。
制約
    1≦N≦500
    1≦Ci≦100
    1≦Si≦105
    1≦Fi≦100
    Si%Fi=0
    入力は全て整数
入力
入力は以下の形式で標準入力から与えられる。

N
C1 S1 F1
:
CN−1 SN−1 FN−1

出力
i 行目 (1≦i≦N) に、開通式開始時に駅 i にいる場合、駅 N に到着できるのが最も早くて開通式開始 x 秒後のとき、x を出力せよ。
"""
n=int(input())
csf = []
for _ in range(n-1):
  csf.append(list(map(int, input().split())))

ts = []

for i in range(n-1):
  t = csf[i][1]
  for c,s,f in csf[i:]:
    if t < s:
      t = s
    if (t%f) != 0:
      t += f-(t % f)
    t += c
  ts.append(t)
ts.append(0)

for t in ts:
  print(t)

Measured memory_bytes: 4104
#include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl '\n'
#define rep(i, a, b) for (int i = a; i < b; i++)
#define ff first
#define pii pair<int, int>
#define vii vector< pair<int,int> >
#define vi vector<int>
#define vvi vector< vector< int> >
#define vs vector<string>
#define ss second
#define pb push_back
#define mp make_pair
#define int long long
#define ll long long
#define all(a) a.begin(), a.end()
#define inf (1LL<<61)
#define ull unsigned long long
#define tr1(x)                cout<<#x<<": "<<x<<endl
#define tr2(x, y)             cout<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define tr4(x, y, z, d)          cout<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<" | "<<#d<<": "<<d<<endl
#define tr3(x, y, z)          cout<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define db1(x) cerr << #x << ": " << x <<'\n'
#define db2(x, y) cerr << #x << ": " << x << '\t' << #y << ": " << y <<'\n'
#define db3(x, y, z) cerr << #x << ": " << x << '\t' << #y << ": " << y << '\t' << #z << ": " << z <<'\n'
using namespace std;
int dx[]={1,0,-1, 0};int dy[]={0,1,0, -1}; //4 Direction
//int dx[]={1,1,0,-1,-1,-1,0,1};int dy[]={0,1,1,1,0,-1,-1,-1};//8 direction
bool compare(const pair<pair<string,int>, int> &a,const pair<pair<string,int>, int> &b)
{
    if(a.ff.ff == b.ff.ff) {
        return (a.ff.ss > b.ff.ss);
    }
    return (a.ff.ff<b.ff.ff);
}
int min(int a, int b){
    if(a<b){
        return a;
    }
    else{
        return b;
    }
}
int max(int a, int b){
    if(a>b){
        return a;
    }
    else{
        return b;
    }
}
int max(int a, int b, int c){
    return(max( max(a,b), c ));
}
int min(int a, int b, int c){
    return (min ( min(a,b) , c));
}
int poww(int a, int b)
{
    int res = 1;
    for(int i = 1; i<=b; ++i)
        res *= a;

    return res;
}
int findlcm(int arr[], int n) 
{ 
    // Initialize result 
    int ans = arr[0]; 
  
    // ans contains LCM of arr[0], ..arr[i] 
    // after i'th iteration, 
    for (int i = 1; i < n; i++) 
        ans = (((arr[i] * ans)) / 
                (__gcd(arr[i], ans))); 
  
    return ans; 
}
bool prime[100001];
void SieveOfEratosthenes(int n) 
{
    memset(prime, true, sizeof(prime));

    for (int p=2; p*p<=n; p++)
    {
        if (prime[p] == true)
        {
            for (int i=p*p; i<=n; i += p)
                prime[i] = false;
        }
  }
}

//Define mx for maximum range and MOD for large numbers
#define mx 500005
#define mod 1000000007 

// Declare all the variables and global functions here -

int32_t main(){
    IOS;
    int n,l;
    cin >> n >> l;
    vi fl;
    rep(i, 0, n){
        fl.push_back(l+i);
    }
    int tot = 0;
    rep(i, 0, n){
        tot+= fl[i];
    }
    //cout << tot << endl;
    int mini = 10000000;
    int ans = -1;
    rep(i, 0, n){
        int s = 0;
        rep(j, 0, n){
            if(j!=i){
                s += fl[j];
            }
        }
        //cout << s << endl;
        if(abs(tot - s) < mini){
            mini = abs(tot - s);
            ans = s;
        }
    }

    cout << ans << endl;

}   

Measured memory_bytes: 256
N = int(input())
L = list(map(int, input().split()))

cnt = 0
for i in range(N):
    for j in range(i+1, N):
        for k in range(j+1, N):
            if L[i] == L[j] or L[j] == L[k] or L[k] == L[i]:
                continue
            if abs(L[i]-L[j]) < L[k] and L[k] < L[i]+L[j]:
                cnt += 1
print(cnt)

Measured memory_bytes: 9196
using System;
namespace ABC173.Problems
{
    class B
    {
        static void Main()
        {
            long n = long.Parse(Console.ReadLine());
            int[] cnt = new int[] {0, 0, 0, 0};
            for (int i = 0; i < n; i++)
            {
                string str = Console.ReadLine();
                switch (str)
                {
                    case "AC":
                        cnt[0]++;
                        break;
                    case "WA":
                        cnt[1]++;
                        break;
                    case "TLE":
                        cnt[2]++;
                        break;
                    case "RE":
                        cnt[3]++;
                        break;
                }
            }
            Console.WriteLine("AC x " + cnt[0]);
            Console.WriteLine("WA x " + cnt[1]);
            Console.WriteLine("TLE x " + cnt[2]);
            Console.WriteLine("RE x " + cnt[3]);
        }
    }
}


Measured memory_bytes: 30476
#include<iostream>
#include<vector>
#include<queue>
#include<string>
#include<algorithm>
#include<map>
#include<cmath>
#include<cstring>
#include<iomanip>
#include<set>
using namespace std;

typedef long long ll;
typedef pair<int,int> P;
#define INF 1000000100
#define rep(i,n) for (int i=0;i<n;i++)

int main(){
    int N;
    cin >> N;
    int A[N];
    rep(i,N) cin >> A[i];

    sort(A,A+N);
    ll sum=A[N-1];
    if((N-1)%2==0){
        for(int i=1;i<=(N-3)/2;i++){
            sum += 2*A[N-i-1];
        }
        sum += A[N-(N-1)/2-1];
    }
    else{
        for(int i=1;i<=(N-2)/2;i++){
            sum += 2*A[N-i-1];
        }
    }
    cout << sum << endl;
    return 0;
}



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


def solve(N: int, A: "List[int]", B: "List[int]"):
    sum = 0
    for i in range(N):
        cap = B[i]
        if cap <= A[i]:
            sum += cap
            # A[i] = A[i] - B[i]
        else:
            sum += A[i]
            cap = cap - A[i]

            if cap <= A[i+1]:
                sum += cap
                A[i+1] = A[i+1] - cap
            else:
                sum += A[i+1]
                A[i+1] = 0

    print(sum)
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [ int(next(tokens)) for _ in range(N+1) ]  # type: "List[int]"
    B = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"
    solve(N, A, B)

if __name__ == '__main__':
    main()


Measured memory_bytes: 19504
//بسم الله الرحمن الرحيم
// In the name of Allah.
//Ya ALLAH,  We're nothing and you're everything.

#include <bits/stdc++.h>
#define FF(x,z,y) for(long long x=z;x<y;x++)
#define FB(x,y,z) for(long long x=y;x>z;x--)
#define asc(x) x.begin(),x.end()
#define dsc(x) x.begin(),x.end(),greater<>()
#define all(x) x.begin(),x.end()
#define pb(x) push_back(x)
#define mxll   LONG_LONG_MAX
#define mnll   LONG_LONG_MIN
#define mxi INT_MAX
#define mni  INT_MIN
#define NL cout<<endl;

using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
typedef vector<long long> vll;
typedef vector<int> vin;
typedef vector<vll> vllll;
typedef vector<bool> vebu;
typedef vector<vebu> vebubu;
typedef vector<string> VS;
typedef set <long long> sl;
typedef map<long long,long long> mpl;
typedef map<ll,ll,greater <ll> > mp_des;
//typedef MII::iterator iMII;

//direc     d  u   r  l
int fx4[]={+1,-1,+0,+0};
int fy4[]={+0,+0,+1,-1};
//direc    l  r   d  u  tr br tl bl
int fx8[]={+0,+0,+1,-1,-1,+1,-1,+1};
int fy8[]={-1,+1,+0,+0,+1,+1,-1,-1};
const int mxx = 1e5+1;

void knapSack(){
   ll N,W;
   cin>>N>>W;
   vll wi,pr;
   for(int i=0 ; i<N; i++){
       int a,b;
       cin>>a>>b;
       wi.pb(a);
       pr.pb(b);
   }
   ll dp[N+1][W+1];
   
   for(int i=0 ; i<=N ; i++){
        for(int w=0 ; w<=W ; w++){
            if(i==0 || w==0 ) dp[i][w] = 0;
            else if(wi[i-1]<=w) dp[i][w] = max(pr[i-1]+dp[i-1][w-wi[i-1]],dp[i-1][w]);
            else dp[i][w] = dp[i-1][w];
         }
   } 
   
   
  cout<<dp[N][W]<<endl;
}
void  cal(){
    knapSack();
}
void solve(){
    ll t=1;
  // cin>>t;
    while(t--)cal();
}
//#define ALLAHU_KHALIQ 1
int main(){
  #ifdef ALLAHU_KHALIQ
        clock_t tStart = clock();
        freopen("i.txt", "r", stdin);
        freopen("o.txt", "w", stdout);
    #endif
  solve();
    #ifdef ALLAHU_KHALIQ
        fprintf(stderr, "\nRuntime: %.10fs\n", (double) (clock() - tStart) / CLOCKS_PER_SEC);
    #endif
        return 0;
}

Measured memory_bytes: 82508
N = int(input())
As = list(map(int, input().split()))

# 1が3個、2が５個、、、みたいなものを管理する配列
counter = [0 for i in range(N+1)]
for i in range(N):
    counter[As[i]] += 1

# kC2を求める。（2C2 ~ NC2まで）
k_C_2 = [0 for i in range(N+1)]
k_C_2[2] = 1
for i in range(3, N+1):
    k_C_2[i] = k_C_2[i-1] * i / (i-2)


# 全体を求める
all_case = 0
for i in range(N+1):
    if counter[i] >= 2:
        all_case += k_C_2[counter[i]]

# 除く
for i in range(N):
    if counter[As[i]] == 2:
        print(int(all_case - 1))
    elif counter[As[i]] >= 3:
        print(int(all_case - k_C_2[counter[As[i]]] + k_C_2[counter[As[i]]-1]))
    else:
        print(int(all_case))



Measured memory_bytes: 26140
var obj = init();
Main();
function nextInt(){return myconv(next(),1);}
function nextStrArray(){return myconv(next(),2);}//半角スペース分割
function nextIntArray(){return myconv(next(),4);}//半角スペース + 数値化
function nextCharArray(){return myconv(next(),6);}//1文字分割
function next(){return obj.next();}
function hasNext(){return obj.hasNext();}
function myin(){return require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");}
function init(){
  var inputFile = myin();
  var returnObj = {
    "list" : inputFile, "index" : 0, "max" : inputFile.length,
    "hasNext" : function(){return (this.index < this.max);},
    "next" : function(){if(!this.hasNext()){throw "ArrayIndexOutOfBoundsException これ以上ないよ";}else{var returnInput = this.list[this.index];this.index++;return returnInput;}}
  };
  return returnObj;
}
function myout(t){console.log(t);}//標準出力
function myerr(t){console.error(t);}//標準エラー出力
//[no]要素の扱い。数値型
//不明値、異常時:引数そのまま返す　1:数値へ変換
//2:半角SPで分割 4:半角SPで分割し、数値配列へ
//6:1文字で分割  7:1文字で分割し、数値配列へ
//8:半角SPで結合 9:改行で結合 0:文字なしで結合
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map((a)=>Number(a));case 6:return i.split("");case 7:return i.split("").map((a)=>Number(a));case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}
function Main(){
  var one = nextIntArray();
  myout(one[2] + " " + one[0] + " " + one[1]);
}

Measured memory_bytes: 21064
// Vivek Rai
// Blazer_007

#include<bits/stdc++.h>
using namespace std;

#define fastio    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define endl      '\n'

typedef long long int ll;
const int hell = 1e9 + 7 ;

signed main() {

    fastio

   long double a , b ;
   cin >> a >> b;

   long double ans = a * b ;
   // cout << ans << endl;
   cout << (ll)ans << endl;

    return 0;
}

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

ans = [-1] * (n ** 2)
for i in range(n):
    ans[a[i] - 1] = i + 1


b = sorted([(a[i], i + 1) for i in range(n)], reverse=True)
stack = []
for _, val in b:
    for _ in range(val - 1):
        stack.append(val)

for i in range(n ** 2):
    if ans[i] == -1:
        if not stack:
            continue
        ans[i] = stack.pop()


b = sorted([(a[i], i + 1) for i in range(n)])
stack = []
for _, val in b:
    for _ in range(n - val):
        stack.append(val)

for i in range(n ** 2)[::-1]:
    if ans[i] == -1:
        if not stack:
            continue
        ans[i] = stack.pop()


cnt = [0] * (n + 1)
for i in range(n ** 2):
    cnt[ans[i]] += 1
    if cnt[ans[i]] == ans[i]:
        if a[ans[i] - 1] == i + 1:
            continue
        else:
            print("No")
            exit()     
print("Yes")
print(*ans)

Measured memory_bytes: 59816
# coding:utf-8

import sys
import math
import time
import numpy as np
import collections
from collections import deque
import queue
import copy

# 最大公約数
def gcd(m,n):
  x = max(m,n)
  y = min(m,n)
  if x%y == 0:
    return y
  else:
    while x%y != 0:
      z = x%y
      x = y
      y = z
    else:
      return z

# 幅優先探索(BFS)でスタート座標(x, y)からの最大距離返す
def bfs(SS, x, y, H, W):#入力(座標系(迷路), x, y, xの端, yの端)
  x_next = [0, 0, -1, 1]
  y_next = [1, -1, 0, 0]
  tempx = x
  tempy = y
  mlength = 0
  q = deque()
  xytuple = (x, y, 0)
  q.append(xytuple)


  while q:
    xytuple = q.popleft()
    SS[xytuple[0]][xytuple[1]] = "x" #探索した場所は探索できないようにする
    for i in range(4): #このforで上下左右を調べてる
      tempx = xytuple[0] + x_next[i]
      tempy = xytuple[1] + y_next[i]
      #print(tempx, tempy, xytuple[2])
      #print(S)
      if(0 <= tempx and tempx < H and 0 <= tempy and tempy < W and SS[tempx][tempy] == "."):
        temptuple = (tempx, tempy, xytuple[2]+1)
        SS[temptuple[0]][temptuple[1]] = "x" #探索した場所は探索できないようにする
        mlength = max(mlength, xytuple[2] +1)
        q.append(temptuple)
      #print(q)
  return mlength


#X = str(input()).split()
NM = str(input()).split()
N = int(NM[0])
M = int(NM[1])

# S = [[0 for i in range(W)] for j in range(H)]

if(N==M):
  print("Yes")
else:
  print("No")


Measured memory_bytes: 21756
from sys import stdin
n = int(stdin.readline().rstrip())
a = list(map(int, stdin.readline().rstrip().split()))
b = list(map(int, stdin.readline().rstrip().split()))
c = list(map(int, stdin.readline().rstrip().split()))

res = 0
predish = -999
for dish in a:
    res += b[dish - 1]
    if dish - predish == 1:
        res += c[predish - 1]
    predish = dish

print(res)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i = 0; i < n; i++)
int main(){
    int n; cin >> n;
    vector<int> x(n),y(n);
    vector<ll> h(n);
    rep(i,n) cin >> x[i] >> y[i] >> h[i];
    int cx,cy; //中心座標
    int H; //中心座標の高さ
    int flag; //Hが条件を満たすかの判定
    int cnt; //各座標調査の最初にHに仮の値を入れるための判定
    rep(i,101){
        rep(j,101){
            flag = 1;
            rep(k,n){
                if(h[k] > 0){
                    H = abs(x[k]-i) + abs(y[k]-j) + h[k]; //最初にHの値を決める
                    break;
                }
            }
            rep(k,n){
                if(h[k] != max(H - abs(x[k]-i) - abs(y[k]-j),0)){ //ループ中1つでも条件を満たさないものがあったらアウト
                    flag = 0;
                    break;
                }
            }
            if(flag == 1){ //条件を全部通したらcx,cyに代入してループ終了
                cx = i;
                cy = j;
                break;
            }
        }
        if(flag == 1) break;
    }
    cout << cx << " " << cy << " " << H << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
#define pq_pair_tB priority_queue <pair<ll,ll>, vector<pair<ll,ll> > , greater<pair<ll,ll> > > 
#define pq_pair_ts priority_queue <pair<ll,ll> >
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}
ll gcd(ll a, ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a, ll b){return a/gcd(a,b)*b;}



int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll N ; cin >> N ;
    string S; cin >> S;
    string ans = "";
    string temp = "";
    ll l = 0;
    

    rep(i,S.size()){
        if(S[i] == '('){
            l++;
            ans += "(";
        }
        if(S[i] == ')'){
            if(l>0) {
                l--;
                ans += ")";
            }
            else{
                temp = "(" + ans + ")";
                ans = temp;
            }
        }
    }
    if(l != 0){
        rep(i,l)ans += ")";
        
    }
    cout << ans << endl;
    
    //cout << fixed << setprecision(16) << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using ld  = long double;
using pll = pair<ll, ll> ;
using pld = pair<ld, ld>;
const int INF=1e9+7;
const ll LINF=1LL<<60 ;
const ll MOD=1e9+7 ;
const ld PI=acos(-1);
const ld EPS = 1e-9; //微調整用（EPSより小さいと0と判定など）
 
#define gcd __gcd //llは受け取ってくれない
int lcm(int a, int b){return a / gcd(a, b) * b;}
#define ALL(a) a.begin(),a.end() //sort(ALL(vec));
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define PB push_back
#define SZ(x) ((int)(x).size) //size()がunsignedなのでエラー避けに
 
//最大値、最小値を更新する。aよりbのが大きい（小さい）か等しければaを更新してtrueを返す。そうでなければ何もせずfalseを返す chmax(nowmax,x);
template<typename T>
bool chmax(T& a, T b){return (a = max(a, b)) == b;}
template<typename T>
bool chmin(T& a, T b){return (a = min(a, b)) == b;}
// ----- template end ---- //
 
// ------- library ------- //

//nCk(mod MOD)の計算　n!(mod MOD)とk!^{MOD-2}を前計算して求める
//nの最大値を設定すること
ll maxN = 300000; // n, kの最大値を代入(0 < n <= maxN)
vector<ll> fac(maxN+1); //n!(mod MOD) を格納。
vector<ll> ifac(maxN+1); //k!^{MOD-2} (mod MOD)
//a,bの範囲的にこれだけ配列を用意していけば十分

ll mpow(ll x, ll n){ //x^n(mod MOD) ←普通にpow(x,n)では溢れてしまうため，随時mod計算
    ll ans = 1;
    while(n != 0){
        if(n&1) ans = ans*x % MOD;
        x = x*x % MOD;
        n = n >> 1;
    }
    return ans;
}

ll comb(ll a, ll b){ //aCbをmod計算
    if(a == 0 && b == 0)return 1;
    if(a < b || a < 0)return 0;
    ll tmp = ifac[a-b]* ifac[b] % MOD;
    return tmp * fac[a] % MOD;
}

// ----- library end ----- //



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

  //大した量ではないので，先にfax[i]とifax[i]を全て計算しておく
  fac[0] = 1;
  ifac[0] = 1;
  for(ll i = 0; i<maxN; i++){
      fac[i+1] = fac[i]*(i+1) % MOD; // n!(mod MOD)
      ifac[i+1] = ifac[i]*mpow(i+1, MOD-2) % MOD; // k!^{MOD-2} (mod MOD) ←累乗にmpowを採用
  }

  REP(i, 1, K+1){
    cout << (comb(N-K+1, i) * comb(K-1,i-1)) % MOD << endl;
  }


// -- main() end -- //
}


 

Measured memory_bytes: 4992
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Numerics;

namespace AtCoderWorkspace
{
    public class Solver
    {
        public void Solve()
        {
            var cin = new Scanner();
            var n = cin.nextInt();
            var a = cin.nextInt();
            Console.WriteLine(n*n-a);
        }
    }

    class Scanner
    {
        string[] s;
        int i;

        char[] cs = new char[] { ' ' };

        public Scanner()
        {
            s = new string[0];
            i = 0;
        }

        public string next()
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            if (s.Length == 0) return next();
            i = 0;
            return s[i++];
        }

        public int nextInt()
        {
            return int.Parse(next());
        }
        public int[] ArrayInt(int N, int add = 0)
        {
            int[] Array = new int[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextInt() + add;
            }
            return Array;
        }

        public int[] DPArrayInt(int N, int ex)
        {
            int[] Array = new int[N + ex];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextInt();
            }
            return Array;
        }

        public long nextLong()
        {
            return long.Parse(next());
        }

        public long[] ArrayLong(int N, long add = 0)
        {
            long[] Array = new long[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextLong() + add;
            }
            return Array;
        }

        public long[] DPArrayLong(int N, int ex)
        {
            long[] Array = new long[N + ex];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextLong();
            }
            return Array;
        }

        public double nextDouble()
        {
            return double.Parse(next());
        }


        public double[] ArrayDouble(int N, double add = 0)
        {
            double[] Array = new double[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextDouble() + add;
            }
            return Array;
        }
    }

    class Program
    {
        static void Main(string[] s) => new Solver().Solve();
    }
}


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

int x, y;

int main( int argc, char *argv[] )
{
    int ppp;

    scanf( "%d %d", &x, &y );

    if( y < x*2 ) puts( "No" );
    else if( y > x*4 ) puts( "No" );
    else if( y % 2 )   puts( "No" );
    else puts( "Yes" );
}


Measured memory_bytes: 1660
/*by freesteed*/
#include <bits/stdc++.h>
using namespace std;
#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 fill(x,c) memset(x,c,sizeof(x))
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
typedef double db;
mt19937 mrand(random_device{}());
const ll mod=1000000007;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
// head
const int SIZE = 1e6+10;
ll a[SIZE];
int main() {
	//ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	ll n,t;
	cin>>n>>t;
	cout<<(n/t+(n%t==0?0:1));
  	return 0;
}


Measured memory_bytes: 256
n,m = map(int,input().split())	
ab=[0 for _ in range(n)]
for i in range(n):
    ab[i] = list(map(int,input().split()))	
ab.sort()
price=0
i=0
while m > 0:
    if m >= ab[i][1]:
        price+=ab[i][0]*ab[i][1]
        m-=ab[i][1]
        i+=1
    else:
        price+=ab[i][0]*m
        break
print(price)


Measured memory_bytes: 27820
#include <cstdio>

int main()
{
        float A[2][2], B[2];

        while (scanf("%f %f %f %f %f %f",
                                 &A[0][0], &A[0][1], &B[0],
                                 &A[1][0], &A[1][1], &B[1]) != EOF) {
                float det = A[0][0] * A[1][1] - A[0][1] * A[1][0];
                float invA[2][2];
                invA[0][0] = A[1][1] / det;
                invA[0][1] = -A[0][1] / det;
                invA[1][0] = -A[1][0] / det;
                invA[1][1] = A[0][0] / det;
                float ans[2] = {0, 0};
                for (int i = 0; i < 2; i++) {
                        for (int j = 0; j < 2; j++) {
                                ans[i] += B[j] * invA[i][j];
                        }
                }

                printf("%.3f %.3f\n", ans[0], ans[1]);
        }
        return 0;
}

Measured memory_bytes: 1076
#if __has_include("debug.h")
    #include "debug.h"
#else  
#include <bits/stdc++.h>
using namespace std;
#define track  1;
#define d(...) 2;
#endif

#define int long long int

#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl "\n"      

#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define ff first
#define ss second
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)

#define gcd(a,b)            __gcd((a),(b))
#define lcm(a,b)            ((a*b)/gcd(a,b))

void solve();

int32_t main()
{
    #ifdef DEBUG
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
    #endif 

    fast
    
    int t = 1;
	// cin>>t;
	
	while(t--)
	    solve();
	return 0;  
}

void solve()
{
	int i,j,cnt=0;
	bool flag=0;
	int a,b;
	cin>>a>>b;

	if(a>b)
	{
		cout<<"safe"<<endl;
	}
	else
	{
		cout<<"unsafe"<<endl;
	}

	

}

Measured memory_bytes: 3692
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
using namespace std;

int main(){
        int n;
        cin>>n;
        vector<string>s(n);
        map<string,int> mp;
        for(int i=0;i<n;i++){
                cin>>s[i];
                mp[s[i]]++;
        }
        int Max=0;
        for(const auto& itr: mp){
                int tmp=itr.second;
                if(tmp>Max)Max=tmp;
        }
        for(auto itr=mp.begin();itr!=mp.end();itr++){
                if(Max==itr->second){
                        cout<<itr->first<<endl;
                }
        }
        return 0;
}


Measured memory_bytes: 26752
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;
 
#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define RREP(i,n) for(int (i)=(int)(n)-1;i>=0;i--)
#define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end())

int main() {

	int N,A,B;
	cin >> N >> A >> B;

	cout << min(B, A*N) << endl;

	return 0;
}

Measured memory_bytes: 764
# -*- coding: utf-8 -*-
import sys

A,V,B,W,T = map(int, sys.stdin.buffer.read().split())

Amin = A-T*V
Amax = A+T*V
Bmin = B-T*W
Bmax = B+T*W

if Amin<=Bmin and Amax>=Bmax:
  print('YES')
else:
  print('NO')

Measured memory_bytes: 9176