akhauriyash/Code-Regression huggingface dataset:
/*
auth - @sportykush
*/

#include <bits/stdc++.h>
using namespace std;
// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
// typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set; 
// using namespace __gnu_pbds;

typedef long long int ll;
typedef long double ld;

//#define mp make_pair
#define bug(v)                    cerr<<#v<<" = "<<(v)<<endl;
#define ERASE(x)                  x.erase(unique(x.begin(),x.end()),x.end())
#define pb                        emplace_back
#define vii                       vector<int>
#define vll                       vector<ll>
#define vpll                      vector< pair <ll,ll> >
#define pll                       pair <ll,ll>
#define pii                       pair <int,int>
#define pq                        priority_queue< int >
#define khtm                      "\n"
#define F                         first
#define S                         second
#define fr(i,a,n)                 for(i=a;i<n;i++)
#define mem(arr,l)                memset(arr,l,sizeof arr)
#define ALL(x)                    x.begin(), x.end()
#define frr(i,a,n)                for(i=n-1;i>=a;i--)
#define fast                      ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define testcase                  ll T; cin>>T; while(T--)


const double pi = 3.14159265359;
const int MAX = 1e6 +2;
const ll inf =  1e18;
const int N = 1010;
//const ll mod = 998244353 ;
const ll mod = 100000007;
inline ll add(ll a,ll b){a+=b;if(a>=mod)a-=mod;return a;}
inline ll mul(ll a,ll b){return (((a+mod)%mod)*(b+mod)%mod)%mod;}
inline ll power(ll a,ll b){ll rt=1;while(b>0){if(b&1)rt=mul(rt,a);a=mul(a,a);b>>=1;}return rt;}
inline ll modInverse(ll n, ll p){ return power(n, p-2)%p; }

/*
important builtin functions
__gcd(value1, value2)
__builtin_ffs(x)
  Number of leading zeroes: __builtin_clz(x)
  Number of trailing zeroes : __builtin_ctz(x)
  Number of set bits: __builtin_popcount(x)
*/
 
void stArt()
{
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif
}
void eNd()
{
	#ifndef ONLINE_JUDGE
  	cout<<"\nTime Elapsed : " << 1.0*clock() / CLOCKS_PER_SEC << " s";
  	#endif
}

//////////////////// start /////////////////////////////////
 

ll i,j,k,l,m,r,n;
ll a[MAX],b[MAX];


int main()
{
 
stArt();
fast
//cout << setprecision(15) << fixed;

cin >> n;
fr(i,0,n)
{
	string s;
	cin >> s;
	if(s == "AC")
		a[0]++;
	else if(s == "WA")
		a[1]++;
	else if(s == "TLE")
		a[2]++;
	else
		a[3]++;

}

	cout << "AC x " << a[0] << "\nWA x " << a[1] << "\nTLE x " << a[2] << "\nRE x " << a[3] ;

 eNd();
  return 0;
 
}


Measured memory_bytes: 3668
N,M=map(int,input().split())
PS=[list(input().split()) for i in range(M)]
chk=[0]*N
Pena=[0]*N
seito=0
pena=0
for p,s in PS:
  p=int(p)
  if chk[p-1]==0:
    if s=='WA':
      Pena[p-1]+=1
    elif s=='AC':
      seito+=1
      chk[p-1]=1
      pena+=Pena[p-1]
  else:
    pass
print(seito,pena)

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

/* typedef */
/* long系 */
typedef long long ll;   // long long
typedef long double ld; // long double
/* vector系 */
typedef vector<int> vi;                    // intのvector
typedef vector<double> vd;                 // doubleのvector
typedef vector<ll> vll;                    // llのvector
typedef vector<ld> vld;                    // ldのvector
typedef vector<vector<int>> vvi;           // intの2次元vector
typedef vector<vector<double>> vvd;        // doubleの2次元vector
typedef vector<vector<ll>> vvll;           // llの2次元vector
typedef vector<vector<ld>> vvld;           // ldの2次元vector
typedef vector<pair<int, int>> vi_i;       // i_iのvector
typedef vector<pair<double, double>> vd_d; // d_dのvector
typedef vector<pair<ll, ll>> vl_l;         // l_lのvector
typedef vector<pair<ld, ld>> vld_ld;       // ld_ldのvector
typedef vector<string> vs;                 // stringのvector
/* pair系 */
typedef pair<int, int> i_i;       // int同士のpair
typedef pair<double, double> d_d; // double同士のpair
typedef pair<ll, ll> l_l;         // ll同士のpair
typedef pair<ld, ld> ld_ld;       // ld同士のpair

/* define */
#define all(v) v.begin(), v.end() // コンテナ全体
#define PI (acos(-1))             // 円周率pi

/* stringstream */
stringstream ss;
stringstream init_ss; // save default formatting

/* upper, lower */
struct ToUpper
{
    char operator()(char c)
    {
        return toupper(c);
    }
};
struct ToLower
{
    char operator()(char c)
    {
        return tolower(c);
    }
};

/* main */
void Main(void)
{
    double x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    cout << sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)) << endl;
}

int main(int argc, char const *argv[])
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();

    return 0;
}



Measured memory_bytes: 3288
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    int ans = 0;
    for(int i=1; i<=n; i++){
        for(int j=1; i*j<n; j++){
            ans++;
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3632
#include<cstdlib>
#include<cstdio>
#include<algorithm>
using namespace std;
const int MAXN = (int)1e5 + 10;

int n;
int min_factor[MAXN];
int prime[MAXN],pcnt;

void Init(){
    int N=100000;
    for(int i=2;i<=N;i++){
        if(!min_factor[i]){
            min_factor[i]=i;
            prime[++pcnt]=i;
        }
        for(int k=1;k<=pcnt&&prime[k]*i<=N;k++){
            int x=prime[k]*i;
            min_factor[x]=prime[k];
        }
    }
}

bool is_judge(int x){
    for(int i=1;prime[i]*prime[i]<=x&&i<=pcnt;i++){
        if(x%prime[i]==0) return false;
    }
    return true;
}

void work(){
    Init();
    scanf("%d",&n);
    int ans=0;
    for(int i=1;i<=n;i++){
        int x; scanf("%d",&x);
        if(is_judge(x)){
            ans++;
        }
    }
    printf("%d\n",ans);
}

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




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

using namespace std;

using int64 = long long;
const int mod = 1e9 + 7;
// const int mod = 998244353;

const int64 infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;


template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 > &p) {
  os << p.first << " " << p.second;
  return os;
}

template< typename T1, typename T2 >
istream &operator>>(istream &is, pair< T1, T2 > &p) {
  is >> p.first >> p.second;
  return is;
}

template< typename T >
ostream &operator<<(ostream &os, const vector< T > &v) {
  for(int i = 0; i < (int) v.size(); i++) {
    os << v[i] << (i + 1 != v.size() ? " " : "");
  }
  return os;
}

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

template< typename T = int64 >
vector< T > make_v(size_t a) {
  return vector< T >(a);
}

template< typename T, typename... Ts >
auto make_v(size_t a, Ts... ts) {
  return vector< decltype(make_v< T >(ts...)) >(a, make_v< T >(ts...));
}

template< typename T, typename V >
typename enable_if< is_class< T >::value == 0 >::type fill_v(T &t, const V &v) {
  t = v;
}

template< typename T, typename V >
typename enable_if< is_class< T >::value != 0 >::type fill_v(T &t, const V &v) {
  for(auto &e : t) fill_v(e, v);
}

template< typename F >
struct FixPoint : F {
  FixPoint(F &&f) : F(forward< F >(f)) {}

  template< typename... Args >
  decltype(auto) operator()(Args &&... args) const {
    return F::operator()(*this, forward< Args >(args)...);
  }
};

template< typename F >
inline decltype(auto) MFP(F &&f) {
  return FixPoint< F >{forward< F >(f)};
}

int main() {
  int N, M, Q;
  cin >> N >> M >> Q;
  vector< int > A(Q), B(Q), C(Q), D(Q);
  for(int i = 0; i < Q; i++) {
    cin >> A[i] >> B[i] >> C[i] >> D[i];
    --A[i];
    --B[i];
  }
  int ret = 0;
  vector< int > T;
  auto dfs = MFP([&](auto dfs, int idx) -> void {
    if(idx == N) {
      int add = 0;
      for(int j = 0; j < Q; j++) {
        if(T[B[j]] - T[A[j]] == C[j]) add += D[j];
      }
      chmax(ret, add);
      return;
    }
    for(int i = T.back(); i <= M; i++) {
      T.emplace_back(i);
      dfs(idx + 1);
      T.pop_back();
    }
  });
  T.emplace_back(1);
  dfs(0);
  cout << ret << endl;
}

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

def BinaryIndexSearch_floor(p, SL):
	"""
	search the minimum number among the larger numbers than the ginven nymber "n". 
	return the index of it under the list sorted.
	"""
	#SL = sorted(L)
	l = 0
	r = len(SL) - 1

	while True:
		if l == r:
			if SL[l] > p:
				return l
			else:
				return -1
		elif r-l == 1:
			if SL[l] > p:
				return l
			elif SL[r] > p:
				return r
			else:
				return -1

		center = l + ((r-l) // 2)

		if SL[center] <= p:
			l = center + 1
			continue

		else:
			r = center
			continue

def BinaryIndexSearch_ceil(p, SL):
	#SL = sorted(L)
	l = 0
	r = len(SL) - 1

	while True:
		if l == r:
			if SL[l] < p:
				return l
			else:
				return -1
		elif r-l == 1:
			if SL[r] < p:
				return r
			elif SL[l] < p:
				return l
			else:
				return -1
		center = l + ((r-l) // 2)

		if SL[center] < p:
			l = center 
			continue

		else:
			r = center - 1
			continue
ans = 0
for i in range(N-1):
	for j in range(i+1,N):
		wa = L[i] + L[j]
		sa = abs(L[i]-L[j])

		l = BinaryIndexSearch_ceil(wa,L)
		s = BinaryIndexSearch_floor(sa,L)

		oc = 0
		if s <= i <= l:
			oc += 1
		if s <= j <= l:
			oc += 1
		if l >= s:
			ans += max(0, l-s+1-oc)

print(ans//3)

Measured memory_bytes: 50904
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
#define show(x) for(auto i: x){cout << i << " ";}
#define showm(m) for(auto i: m){cout << m.x << " ";}
typedef long long ll;

template<class X> void divisor(X input, vector<X>& Dnumber){
    for (X i = 2; i*i <= input; i++)
    {
        if (input % i == 0){
            Dnumber.push_back(i);
            if (i * i  != input) Dnumber.push_back(input / i);
        }
    }
    Dnumber.push_back(input);
    Dnumber.push_back(1);
    sort(Dnumber.begin(), Dnumber.end(), greater<X>());
}



int process(int num, vector<int>& a){
    vector<int> sorted_div;

    rep(i, a.size()) sorted_div.push_back(a[i]%num);
    sort(sorted_div.begin(), sorted_div.end());

    ll sum_to_next = 0;
    rep(i, a.size()) sum_to_next += num - sorted_div[i];
    int ans = 0;
    rep(i, (sum_to_next / num)) ans += sorted_div[i];
    return ans; 
}

int main()
{
    int n, k;
    cin >> n >> k;
    vector<int> a;
    rep(i, n) {int tmp; cin >> tmp; a.push_back(tmp);}

    int sum = 0;
    rep(i, n) sum += a[i];

    vector<int> div;
    divisor(sum, div);

    //show(div);    

    int ans = 0;
    rep(i, div.size()){
        int num = div[i];
        if(process(num, a) <= k){
            ans = num;
            break;
        }
    }

    cout << ans << endl;
}



Measured memory_bytes: 256
(defun f (p q r &optional (ans 0))
  (if (> (+ (* (1+ ans) r) (* ans q)) p)
    (1- ans)
    (f p q r (1+ ans))))


(let ((x (read))
      (y (read))
      (z (read)))

  (format t "~A~%"
          (f x y z)))


Measured memory_bytes: 24240
from collections import deque
import sys
sys.setrecursionlimit(10**6)
n,m = map(int,input().split())
e = [[] for i in range(n+1)]
for i in range(m):
    a,b = map(int,input().split())
    e[a].append(b)
    e[b].append(a)
qv = int(input())
Q = [list(map(int,input().split())) for i in range(qv)]

color = [0]*(n+1)
used = [-1]*(n+1)

for v,d,c in Q[::-1]:
    if used[v] > d:
        continue
    
    q = deque([[v,d]])
    while q:
        now, dis = q.popleft()
        if dis < 0:
            continue
        if color[now] == 0:
            color[now] = c
        for nex in e[now]:
            if used[nex] < dis-1:
                used[nex] = dis-1
                q.append([nex,dis-1])
    
for i in color[1:]:
    print(i)

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

using namespace std;

mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
typedef long long ll;
typedef long double ld;

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

  map<int, int> f;
  int n;
  ll sol = 0;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int h;
    cin >> h;
    sol += f[i - h];
    f[i + h]++;
  }
  cout << sol << "\n";

  return 0;
}


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

using namespace std;

int solve(std::vector<int>& hs, int n, int k) {
  std::sort(hs.begin(), hs.end());
  int ret = INT_MAX;
  for (int i = 0; i + k - 1 < n; ++i) {
    ret = std::min(ret, hs[i + k - 1] - hs[i]);
  }
  return ret;
}

int main() {
  std::cin.tie(nullptr);
  std::ios::sync_with_stdio(false);
  int n, k;
  std::cin >> n >> k;
  std::vector<int> hs(n);
  for (auto& h : hs) {
    std::cin >> h;
  }
  std::cout << solve(hs, n, k) << std::endl;
  return 0;
}


Measured memory_bytes: 640
#include<iostream>
#include<vector>
#include<string>
using namespace std;
typedef long long ll;
#define For(i,n,k) for(int i=(n);i<(k);i++)
#define ALL(a)  (a).begin(),(a).end()
ll ans=0;
vector<vector<int>> dp(2,vector<int> (2020,0));
const int m = 2019;
int S;
void Main(){
    string s;cin>>s;
    int n=s.size();
    For(i,0,n){
        S=s[i]-'0';
        ans+=dp[i%2][0];
        For(j,0,m){
            dp[(i+1)%2][(j*10+S)%m]=dp[i%2][j];
        }
        dp[(i+1)%2][S]+=1;
    }
    ans+=dp[n%2][0];
    cout<<ans<<endl;
}
int main(){
    Main();
    /*
    東方風神録は神が出てくるので当然神ゲー
    */
    return 0;
}

Measured memory_bytes: 3360
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
    
		// 整数の入力
		int n = sc.nextInt();
      
		// 出力
		System.out.println(check(n) ? "Yes" : "No");
	}
    public static boolean check(int target) {
      if (target % 4 == 0) {
        return true;
      }
      int i = 0;
      while(true) {
        int value = target - i * 4;
        if (value % 7 == 0) {
          return true;
        }
        if (value < 7) {
          return false;
        }
        i++;
      }
    }
}

Measured memory_bytes: 24148
let () = Scanf.scanf "%d" @@ fun x ->
  let cache = Array.make 5000 0 in
  cache.(0) <- 100;
  for i = 0 to 4998 do
    cache.(i + 1) <- cache.(i) + cache.(i) / 100
  done;
  Printf.printf "%d\n" @@
  List.find (fun i -> x <= cache.(i)) @@
  List.init 5000 Fun.id



Measured memory_bytes: 4236
#include<bits/stdc++.h>
using namespace std;
int main(){
  int cost_min=2048;
  int n,x;
  cin>>n>>x;
  for (int i=0;i<n;i++){
    int s;
    cin>>s;
    x-=s;
    if (s<cost_min) cost_min=s;
  }
  cout<<x/cost_min+n<<endl;
  return 0;
}


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

using namespace std;

typedef long long ll;
const ll INF = 1LL<<60;

ll gcd(ll a, ll b) {
  if(b == 0) return a;
  return gcd(b, 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; }

ll modpow(ll a, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}

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

  int Q;
  cin >> Q;

  ll q, a, b;
  
  priority_queue<ll> ql;
  priority_queue<ll, vector<ll>, greater<ll>> qr;

  ql.push(-INF);
  qr.push(INF);

  ll suma = 0;
  ll sumb = 0;

  vector<pair<ll, ll>> ans;
  
  for(int i = 0; i < Q; i++){
    cin >> q;
    if(q == 1){
      cin >> a >> b;
      sumb += b;

      if(ql.size() == qr.size()){
        if(ql.top() <= a && a <= qr.top()){
          suma += 0;
        } else{
          suma += min(abs(ql.top() - a), abs(a - qr.top()));
        }

      }else{
        suma += abs(ql.top() - a);
      }

      if(qr.top() <= a){
        qr.push(a);
      }else{
        ql.push(a);
      }

      if(qr.size() > ql.size()){
        ql.push(qr.top());
        qr.pop();
      }else if(ql.size() > qr.size() + 1){
        qr.push(ql.top());
        ql.pop();
      }

    }else{
      ans.push_back(make_pair(ql.top(), suma + sumb));
    }
  }

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

  return 0;
}


Measured memory_bytes: 5620
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(long long i = 0;i < n;i++)
#define repr(i, n) for(int i = n;i >= 0;i--)
#define Sort(v, n) sort(v, v+n);
#define VSort(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
#define cY cout<<"Yes";
#define cN cout<<"No";
#define cA(a) cout<<a;
const ll MOD = 1000000007;

int main() {
    int n;string s;
    cin >> n >> s;
    if(n % 2 == 1) {
        cN
    } else {
        bool f = true;
        rep(i,n/2) {
            if(s[i] != s[n/2+i]) f = false;
        }
        if(f == true) {
            cY
        } else {
            cN
        }
    }
}

Measured memory_bytes: 256
# https://kyopro-friends.hatenablog.com/entry/2019/01/12/231035


def div_cost(left, right):
    # 区間[left, right]が一匹にまとまっているとき、それを分解するために必要な最小コスト
    if bl_calculated[left][right]:
        return memo[left][right]
    bl_calculated[left][right] = True
    if left == right:
        memo[left][right] = 0
        return memo[left][right]
    divided_to_alone_cost = INF
    # divided_to_alone_cost: 区間[left, right]を分解してできた2つの区間それぞれをaの各要素まで分解し切るのに必要なコスト
    for mid in range(left, right):
        divided_to_alone_cost = min(divided_to_alone_cost, div_cost(left, mid) + div_cost(mid + 1, right))
    memo[left][right] = divided_to_alone_cost + (c_sum[right] - c_sum[left - 1])
    # (c_sum[right] - c_sum[left - 1]): 区間[left, right]を分解するのにかかるコスト
    return memo[left][right]


INF = float('inf')

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

c_sum = [0]
for aa in a:
    c_sum.append(c_sum[-1] + aa)
# 累積和c_sum

memo = [[0 for _ in range(N + 1)] for _ in range(N + 1)]
# memo[left][right] = (区間[left, right]に相当するスライムが一匹にまとまっているとき、それを分解するために必要な最小コスト)

bl_calculated = [[False for _ in range(N + 1)] for _ in range(N + 1)]
# memo[left][right]に最小コストが代入済かどうかのBoolean

print(div_cost(1, N))


Measured memory_bytes: 45224
n, k = map(int, input().split())
mod = 998244353
S = []
for _ in range(k):
    l, r = map(int, input().split())
    S.append([l, r])


dp = [0]*(n+1)
dp_s = [0]*(n+1)
dp[1] = 1
dp_s[1] = 1
for i in range(2, n+1):
    for l, r in S:
        li = max(i - r, 1)
        ri = max(i - l, 0)
        dp[i] = (dp[i] + (dp_s[ri] - dp_s[li-1])%mod) % mod
    dp_s[i] = (dp_s[i-1] + dp[i])%mod
print(dp[n]%mod)

Measured memory_bytes: 77156
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int mod = (int)1e9 + 7;
        String v = scan.next();
        int[] dp = new int[13];
        int[] nx = new int[13];

        dp[0]= 1;
        for (int i = 0; i < v.length(); i++) {
            Arrays.fill(nx,0);
            for (int j = 0; j < 13; j++) {
                for (int k = 0; k < 10; k++) {
                    if(k == v.charAt(i)-'0' || v.charAt(i) == '?') {
                        nx[(j * 10 + k) % 13] = (nx[(j * 10 + k) % 13] + dp[j])%mod;
                    }
                }
            }

            for (int j = 0; j < 13; j++) {
                dp[j] = nx[j];
            }
        }

        System.out.println(dp[5]);

    }
}


Measured memory_bytes: 24252
/*Flamenco Sketches*/
#include<bits/stdc++.h>
using namespace std;
 
#define NL '\n'
#define xx first
#define yy second
#define ll long long
#define pii pair<int, int>
#define mp make_pair
#define pb push_back
#define sz(x) x.size()
#define all(x) (x).begin(), (x).end()
#define mem(a, b) memset(a, b, sizeof(a))
#define rep(i,a,b) for(ll i=(ll)a;i<(ll)b;++i)
#define async() ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
 
//#define FayeValentine 
void dbg(){cerr<<NL;}template<typename H,typename... T> void dbg(H h,T... t){cerr<<' '<<h;dbg(t... );}
#ifdef  FayeValentine
#define debug(...) cerr<<"("<<#__VA_ARGS__<<"):",dbg(__VA_ARGS__)
#else
#define debug(...) 
#endif

//bitwise sieve && segmented sieve
const int M = 1e6+9; //limit of seive and max range of segment 
int marked[(M>>6)+9]; //prime flags
vector<int>primes; //primes are stored here
#define ifc(z, n) (z[n>>6]&(1<<((n>>1)&31))) //checks if composite
#define isc(z, n) (z[n>>6]|=(1<<((n>>1)&31))) //marks as composite
void sieve(int n = M){ memset(marked, 0, sizeof marked);//memset "marked" to zero
  for(int i = 3; i*i <= n; i+=2) if(!ifc(marked, i)) 
    for(int j = i * i; j <= n; j += (i + i)) isc(marked, j); 
  primes.pb(2); for(int i = 3; i <= n; i+=2) if(!ifc(marked, i)) primes.push_back(i); 
}

void absinthe() {
	sieve();
	int n, f = 1; cin >> n;
	const int MOD = 1e9+7;
	for(auto i : primes) {
		ll p = i, cnt = 0;
		while(p <= n){
			cnt += n/p;
			p *= i;
		}
		f = ((f%MOD) * ((cnt+1)%MOD)) % MOD;
	}
	cout << f << NL;
}
 
 
int main(){
  //freopen("input.txt", "r", stdin);
  async();
  int __t = 1; //cin >> __t;
  for(int __c = 1; __c <=__t; __c++) {
    //cout << "Case #" << __c << ": "; 
    absinthe();
  }
}  

Measured memory_bytes: 1020
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1001001001LL;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define rept(i, j, n) for(int i=(j); i<(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


int main(){ 
    int n; cin >> n;
    vector<ll> A(n), S(n+1); 
    rep(i, n){cin >> A[i]; S[i+1] = S[i] + A[i];}

    ll res = 0;
    rep(i, n){
        ll num = (S[n]- S[i+1]) % MOD;
        ll add = (A[i] * num) % MOD;
        res = (res + add) % MOD;
    }
    cout << res << ln;
}



Measured memory_bytes: 6404
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
#define Priq priority_queue<int,vi,greater<int>>
#define pb push_back
#define mp make_pair
#define INF (1ll<<60)
void fin(){cout<<"Impossible"<<endl;}
signed main(){
  int N; cin>>N;
  vi A(N);
  rep(i,0,N) cin>>A[i];
  sort(ALL(A),greater<int>());
  if(A[0]!=A[1]){
    fin();
    return 0;
  }
  vi B(N);
  rep(i,0,N) B[A[i]]++;
  int mem=(A[0]+1)/2;
  rep(i,0,mem){
    if(B[i]>0){
      fin();
      return 0;
    }
  }
  if(A[0]%2==0){
    if(B[mem]!=1){
      fin();
      return 0;
    }
  }
  else{
    if(B[mem]!=2){
      fin();
      return 0;
    }
  }
  rep(i,mem+1,A[0]){
    if(B[i]<2){
      fin();
      return 0;
    }
  }
  cout<<"Possible"<<endl;
  }



Measured memory_bytes: 256
n , k = map(int,input().split())
a = list(map(int,input().split()))
ans = float("inf") 
for i in range(2**n):
    kar = a[:]
    b = format(i, 'b').rjust(n,"0")
    if b.count("1") != k:
        continue
    now = 0
    cou = 0
    for j in range(n):
        if b[j] == "1":
            cou += max(0,now - kar[j] + 1)
            kar[j] += max(0,now - kar[j] + 1)
        now = max(now,kar[j])
    ans = min(ans,cou)
print(ans)

        

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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N;
  string S;
  cin >> N >> S;
  int countw = 0, counte = 0;
  for (auto s : S) {
    if (s == 'E') counte++;
  }
  int ans = 300000;
  for (auto s : S) {
    if (s == 'W') {
      ans = min(ans, counte + countw);
      countw++;
    } else if (s == 'E') {
      counte--;
      ans = min(ans, counte + countw);
    }
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 720
#include <bits/stdc++.h>
#include <cmath>
#include <numeric>
using namespace std;
#define rep(i,a,b) for(int64_t i=(a);i<(b);++i) // a ≦ i < b 
#define Rrep(i,a,b) for(int64_t i=(a);i>=(b);--i) // reverse repeat. a から b まで減少．
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend() //逆イテレータ
#define RANGE(a,b,c) (a).begin()+(b),(a).begin()+(c) // [b,c) イテレータ
#define INF 1000000000000000
#define MOD 1000000007
using PII = pair<int64_t, int64_t>;
using VI = vector<int64_t>;
using VVI = vector<VI>;
using VS = vector<string>;
using VP = vector<PII>;
using i64 = int64_t;
template<typename T> void invec(vector<T> &A){for(T& a : A) cin >> a;} // input vector

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

i64 N, M; cin >> N >> M;
VI A(N); invec(A);

VI s(N+1, 0); partial_sum(ALL(A), s.begin() + 1);
map<i64, i64> m;
rep(i, 0, N+1){
    ++m[s[i] % M];
}
i64 cnt = 0;
for (PII p : m){
    cnt += p.second * (p.second - 1) / 2;
}

cout << cnt << "\n";

return 0;
}
// 書いて考える．場合分け．情報整理．
// 単純に分かる量から．
// 境界，出力文字列 チェック．行末にスペース入れない．
// 可読性優先．高速化次点．
// まずは全探索，分割，次にDP
// 制限を見る．境界に注意．求めたい量の変域．動かせる量．
// 偶奇，逆から，ソート，出現回数，出現位置，DP， 余事象，包除
// データ構造． 問題の特徴量．単調性，二分探索
// 存在判定：構成方法，入力の特徴
// gcd, lcm ,素因数分解．
// 例外を十分に含む一般化．想像力の限界
// 小さい系から例示
// 代数的処理．前処理によるクエリ高速化．
// 始めは過剰に例示・場合分けしてもいい．各場合を確実に対処．
// 自明な例から処理，除外．
// 小数のときは，精度の設定する．doubel 変数に数値を入力するときは 123. とする．
// テストケース作成は数表あり
// 実行エラー：vector添え字超え．0割り．



Measured memory_bytes: 5760
#include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define pb push_back
#define MOD 1000000007
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n = 0, k = 0, r = 0, s = 0, p = 0, sum = 0; string t;
	cin >> n >> k;
	cin >> r >> s >> p;
	cin >> t;
	char ch = 'a';
	for (int i = 0; i < n; ++i)
	{
		if (i >= k)
			ch = t[i - k];
		if (t[i] != ch)
		{
			if (t[i] == 'r')
				sum += p;
			else if (t[i] == 's')
				sum += r;
			else
				sum += s;
		}
		else
			t[i] = 'q';
	}
	cout << sum;
}

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

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
//#define int ll
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef vector< vvi > vvvi;
typedef vector<short> vs;
typedef vector<vs> vvs;
typedef vector<vvs> vvvs;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<ld> vld;
typedef vector<vld> vvld;
typedef vector<vvld> vvvld;
typedef vector<string> vst;
typedef vector<vst> vvst;
typedef pair<ld, ld> pld;
typedef complex<double> base;

#define inmin(a, b) a = min(a, (b))
#define inmax(a, b) a = max(a, (b))
#define mp(a,b) make_pair(a,b)
#define modsum(a, b) ((a) + (b) >= M ? (a) + (b) - M : (a) + (b))
#define modsubtract(a, b) ((a) - (b) < 0 ? (a) - (b) + M : (a) - (b))
#define modmultiply(a, b) (((a) * (b)) % M)
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define sqr(x) ((x) * (x))
#define fori(i, n) for(int i = 0; i < int(n); ++i)
#define cint const int &
#define SZ(a) ((int)((a).size()))
#define watch(x) cout << (#x) << " = " << (x) << endl;

const double PI = 2 * acos(0.0);

const string DIGITS = "0123456789";
const string ALPH = "abcdefghijklmnopqrstuvwxyz";


template<class T>
inline ostream & operator << (ostream &out, vector<T> &a) {
    out << "{";
    fori (i, SZ(a))
        out << a[i] << vector<string>{", ", "}"}[i + 1 == SZ(a)];
    return out;
}

void smain();

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


#ifdef MAX_HOME
    freopen("input.txt", "r", stdin);
    clock_t start = clock();
#define cerr cout
#else
#define cerr if (0) cerr
#endif
    cout << setprecision(12) << fixed;
    smain();
#ifdef MAX_HOME
    cout << "\n\n\n\n";
    cout << "TOTAL EXECUTION TIME: " << float( clock () - start ) /  CLOCKS_PER_SEC << endl;
#endif
}

const int N = 10009;
const int D = 109;
const int T = 10;
const ll M = 1e9 + 7;

int dp[N][D][T + 1];

vi a;

int d;

ll dfs(int ind, int rem) {
    if (ind == -1) return 0;
    ll ret = 0;
    for (int dig = 0; dig < a[ind]; ++dig) {
        ret += dp[ind][rem][dig];
    }
    rem = (rem - a[ind] % d + d) % d;
    return ret + dfs(ind - 1, rem);
}

void smain() {

    string s;
    cin >> s;
    a.resize(s.size());
    fori (i, a.size()) a[i] = s[i] - '0';
    reverse(ALL(a));
    int r = 1;
    for (int i = 0; r; ++i) {
        if (i == a.size()) a.push_back(0);
        a[i] += r;
        r = a[i] / 10;
        a[i] %= 10;
    }
    cin >> d;
    int n = a.size();
    fori (dig, T) {
        dp[0][dig % d][dig] = 1;
        dp[0][dig % d][T] = (dp[0][dig % d][T] + 1) % M;
    }
    for (int i = 1; i < n; ++i) {
        for (int j = 0; j < d; ++j) {
            for (int dig = 0; dig < T; ++dig) {
                dp[i][j][dig] = dp[i - 1][(d + j - dig % d) % d][T];
                dp[i][j][T] = (dp[i][j][T] + dp[i][j][dig]) % M;
            }
        }
    }
    cout << (dfs(n - 1, 0)  + M - 1) % M;
}

Measured memory_bytes: 47232
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#define int long long
#define gmax(x,y) x=max(x,y)
#define gmin(x,y) x=min(x,y)
#define F first
#define S second
#define P pair
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define V vector
#define RE return
#define ALL(a) a.begin(),a.end()
#define MP make_pair
#define PB emplace_back
#define PF emplace_front
#define FILL(a,b) memset(a,b,sizeof(a))
#define lwb lower_bound
#define upb upper_bound
using namespace std;
char c[500005];
int n;
struct hashstr{
	int p[500005],g[500005],mod,u=1e4+7;
	void init(){
		p[0]=1;
		FOR(i,1,n){
			p[i]=p[i-1]*u%mod;
			g[i]=(g[i-1]*u+c[i])%mod;
		}
	}
	int get(int x,int y){
		RE (g[x+y]-g[x]*p[y]%mod+mod)%mod;
	}
};
hashstr a,b;
V<int> v[500005];
int l[500005];
bool check(int l,int r){
	int len=r-l+1,t;
	if(len==1)RE 1;
	for(auto u:v[len]){
		t=len/u;
		int j;
		for(j=1;j*2<=u;j*=2){
			if(a.get(l-1,t*j)!=a.get(l+t*j-1,t*j)||
			b.get(l-1,t*j)!=b.get(l+t*j-1,t*j))break;
		}
		if(j*2<=u)continue;
		if(a.get(l-1,t*j)!=a.get(r-t*j,t*j)||
		a.get(l-1,t*j)!=a.get(r-t*j,t*j))continue;
		RE 0;
	}
	RE 1; 
}
signed main(){
	scanf("%s",c+1);
	n=strlen(c+1);
	bool f=1;
	a.mod=1e9+7;
	b.mod=1e9+9;
	a.init();b.init();
	FOR(i,2,n){
		if(c[i]!=c[1]){
			f=0;break;
		}
	}
	if(f){
		cout<<n<<"\n1\n";RE 0;
	}
	FOR(i,2,n){
		if(!l[i]){
			l[i]=i;
			for(int j=i*i;j<=n;j+=i)l[j]=i;
		}
	}
	int t;
	FOR(i,1,n){
		t=i;
		while(t>1){
			if(!v[i].size()||v[i].back()!=l[t])v[i].PB(l[t]);
			t/=l[t];
		}
	}
	if(check(1,n)){
		cout<<"1\n1\n";RE 0;
	}
	int ans=0;
	rep(i,1,n){
		ans+=check(1,i)&check(i+1,n);
	}
	cout<<"2\n"<<ans<<'\n';
	RE 0;
}




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

using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<int> h(n);

    for (int i = 0; i < n; i++)
        cin >> h[i];

    int ans = 0;
    int max = 0;
    for (int j = 0; j < n; j++)
    {
        if (j == 0)
        {
            ans++;
            max = h[j];
        }
        else if (h[j] >= h[j - 1] && h[j] >= max)
        {
            ans++;
            max = h[j];
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<chrono>
#include<iomanip>
#include<map>
#include<set>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
void init_io(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(10);
}
vector<ll> a(110000,0);
ll n;
string s;
ll next_i(ll i){
  ll res=a[i-1];
  bool say_same = (s[i]=='o')? true:false;
  return res^!say_same^a[i];
}
bool check_i(ll i){
  bool same = (a[(i+1)%n]==a[(i+n-1)%n]);
  bool is_sheep = (a[i]==0);
  bool say_same = (s[i]=='o') ? true:false;
  return (is_sheep^same^say_same);
}
signed main(){
  init_io();
  cin >> n >> s;
  for(int x=0;x<2;x++){
    for(int y=0;y<2;y++){
      a[0] = x;
      a[1] = y;
      for(int i=1;i<n-1;i++){
        a[i+1] = next_i(i);
      }
      bool is_ans=true;
      is_ans &= check_i(0);
      is_ans &= check_i(n-1);
      if(is_ans){
        for(int i=0;i<n;i++){
          if(a[i]==0) cout <<"S";
          else cout <<"W";
        }
        cout << endl;
        return 0;
      }
    }
  }
  cout << "-1\n";
}


Measured memory_bytes: 1488
# -*- coding: utf-8 -*-
def inpl(): return map(int, input().split())

N, Ma, Mb = inpl()
INF = 4001

DP = [[INF]*(411) for _ in range(411)]
DP[0][0] = 0

for n in range(N):
    DP2 = [[INF]*(411) for _ in range(411)]
    a, b, c = inpl()
    for i in range(10*(n+1) + 1):
        for j in range(10*(n+1) + 1):
            if DP[i][j] == INF:
                continue
            DP2[i][j] = min(DP[i][j], DP2[i][j])
            DP2[i+a][j+b] = min(DP[i+a][j+b], DP[i][j] + c)
    DP = DP2

x = 1
ans = INF
while Ma*x <= 400 and Mb*x <= 400:
    ans = min(ans, DP[Ma*x][Mb*x])
    
    x += 1

if ans < INF:
    print(ans)
else:
    print(-1)

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

using namespace std;

typedef double db;
typedef long long ll;
typedef long double ld;
typedef unsigned int ui;
typedef unsigned long long ull;

typedef pair < db, db > pdd;
typedef pair < db, ld > pdl;
typedef pair < ld, db > pld;
typedef pair < ld, ld > ldp;

typedef pair < ll, ll > pll;
typedef pair < int, ll > pil;
typedef pair < ll, int > pli;
typedef pair < int, int > pii;

#define F first
#define S second

#define en end()
#define bg begin()

#define rev reverse
#define mp make_pair
#define pb push_back

#define y1 y1234567890
#define um unordered_map

#define all(x) x.bg, x.en
#define sz(x) (int)x.size()
#define len(x) (int)strlen(x)

#define sqr(x) ((x + 0ll) * (x))
#define sqrd(x) ((x + 0.0) * (x))

#define forn(i, n) for (int i = 1; i <= n; i++)

const ll inf = (ll)1e18;
const ll mod = (ll)1e9 + 7;

const db eps = (db)1e-9;
const db pi = acos(-1.0);

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

const int N = 3005;

string s;
int n, pref[2][N];

int main() {
	//freopen(".in", "r", stdin);
	//freopen(".out", "w", stdout);
	//freopen(".err", "w", stderr);

	//srand(time(NULL));

	//cin.tie(NULL);
	//cout.tie(NULL);
	//ios_base::sync_with_stdio(false);

	//cout << setprecision(10) << fixed;
	
	cin >> n >> s;

	pref[1][1] = 1;

	for (int i = 2, ptr = 0; i <= n; i++, ptr ^= 1) {
		for (int j = 1; j <= i; j++) {
			int cur;
			if (s[i - 2] == '>') {
				cur = pref[ptr ^ 1][i - 1] - pref[ptr ^ 1][j - 1];
				if (cur < 0) cur += mod;
			}
			else
				cur = pref[ptr ^ 1][j - 1];
			pref[ptr][j] = pref[ptr][j - 1] + cur;
			if (pref[ptr][j] >= mod)
				pref[ptr][j] -= mod;
		}
	}

	cout << pref[n & 1][n];
	
	//cerr << (clock() + 0.0) / CLOCKS_PER_SEC;

	return 0;
}


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

int main(){

    int N;
    scanf("%d", & N );
    list<int> V;
    for(int i=0;i<N;i++){
        char S[20];scanf("%s", S);
        if(S[6]=='F'){
            V.pop_front();
        }
        else if(S[6]=='L'){
            V.pop_back();
        }
        else if(S[0]=='i'){
            int x;cin>>x;
            V.push_front(x);
        }
        else if(S[0]=='d'){
            int x;scanf("%d",&x);
            for(list<int>::iterator it=V.begin();it != V.end();it++){
                if(*it==x){
                    V.erase(it);
                    break;
                }
            }
        }
    }
    int i=0;
    for(list<int> ::iterator it = V.begin(); it!=V.end();it++){
        if(i++) printf(" ");
        printf("%d",*it);
    }
    printf("\n");
    
}



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

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef complex<double> point;
#define xx real()
#define yy imag()

#define REP(i, a, b) for(int i = (a); i < (int)(b); i++)
#define REPN(i, a, b) for(int i = (a); i <= (int)(b); i++)
#define FA(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define SZ(x) (int)(x).size()
#define BE(x) (x).begin(), (x).end()
#define SORT(x) sort(BE(x))
#define _1 first
#define _2 second

#define x1 gray_cat_x1
#define y1 gray_cat_y1

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

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

#define file "I1"

const double EPS = 1e-9;
const double PI = acos(-1.);
const int INF = 1e9;
const ll MOD = 1e9 + 7;

const int MAXN = 17;

int v[MAXN];
ll dp[MAXN][1 << MAXN];

ll f[1 << MAXN];
ll f_inv[1 << MAXN];

ll pow_mod(ll a, ll st) {
	ll ans = 1ll;
	for(; st; st >>= 1) {
		if (st & 1) {
			ans = (ans * a) % MOD;
		}
		a = (a * a) % MOD;
	}
	return ans;
}

ll get_c(int i, int j) {
	if (j > i || j < 0) {
		return 0ll;
	}
	ll ans = (f[i] * f_inv[j]) % MOD;
	return (ans * f_inv[i - j]) % MOD;
}

void solve(){
	int n, m;
	cin >> n >> m;
	REP(i, 0, m) {
		cin >> v[i];
	}
	
	f[0] = 1ll;
	REPN(i, 1, 1 << n) {
		f[i] = (f[i - 1] * i) % MOD;
	}
	f_inv[1 << n] = pow_mod(f[1 << n], MOD - 2);
	for(int i = (1 << n) - 1; i >= 0; i--) {
		f_inv[i] = (f_inv[i + 1] * (i + 1)) % MOD;
	}
	
	dp[m][0] = 1ll;
	for(int i = m - 1; i >= 0; i--) {
		REP(mask, 0, 1 << n) {
			dp[i][mask] = dp[i + 1][mask];
			REP(k, 0, n) {
				if (mask & (1 << k)) {
					ll v1 = f[1 << k];
					ll v2 = get_c((1 << n) - v[i] - (mask ^ (1 << k)), (1 << k) - 1);
					ll v3 = (v1 * v2) % MOD;
					dp[i][mask] = (dp[i][mask] + dp[i + 1][mask ^ (1 << k)] * v3) % MOD;
				}
			}
		}
	}
	
	ll ans = 0ll;
	
	REP(mask, 0, 1 << n) {
		int sgn = 1;
		REP(i, 0, n) {
			if (mask & (1 << i)) {
				sgn *= -1;
			}
		}
		
		//printf("%d %lld\n", mask, (dp[0][mask] * f[(1 << n) - 1 - mask]) % MOD);
		
		ll add = (dp[0][mask] * f[(1 << n) - 1 - mask]) % MOD;
		ans = (ans + MOD + sgn * add) % MOD;
	}
	
	ans = (ans * (1 << n)) % MOD;
	cout << ans << endl;
}   

int main(){

    //freopen(file".in", "r", stdin); freopen(file".out", "w", stdout);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();    
    }
}


Measured memory_bytes: 17664
#include <bits/stdc++.h>
#define fst first
#define snd second
#define rep(n) for(lint I = 0; (I) < (lint)(n); ++(I))
#define repeat(i, n) for(lint i = 0; (i) < (lint)(n); ++(i))
#define repeat_to(i, n) for(lint i = 0; (i) <= (lint)(n); ++(i))
#define repeat_from(i, m, n) for(lint i = (m); (i) < (lint)(n); ++(i))
#define repeat_from_to(i, m, n) for(lint i = (m); (i) <= (lint)(n); ++(i))
#define repeat_reverse_from_to(i, m, n) for(lint i = (m); (i) >= (lint)(n); --(i))
#define el cout<<endl
#define dump(x) cout<<" "<<#x<<"="<<x
#define vdump(v) for(size_t I=0; I<v.size(); ++I){cout<<" "<<#v<<"["<<I<<"]="<<v[I];} cout<<endl
using namespace std;
using lint = long long;
using ld = long double;

int main(void) {
    int n, y; cin >> n >> y;
    y /= 1000;
    
    repeat_from_to (a, 0, n) {
        repeat_from_to (b, 0, n - a) {
            int c = n - a - b;
            if (y == a + b*5 + c*10) {
                cout << c << " " << b << " " << a << endl;
                return 0;
            }
        }
    }
    cout << "-1 -1 -1" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>

const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;
const int dy[] = { 0, 0, 1, -1 };
const int dx[] = { 1, -1, 0, 0 };
const long double PI = 3.141592653589793238462643383279502884197;

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

	int N; cin >> N;

	cout << (N % 1000 == 0 ? 0 : 1000) - N % 1000;

	return 0;
}

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

void prime_factrize(int n,map<int,int> &mp){
    for(ll a=2;a*a<=n;a++){
        if(n%a!=0) continue;
        while(n%a==0){
            n/=a;
        }
        mp[a]++;
    }
    if(n!=1) mp[n]++;
    return;
}

int main(){
    int n;
    cin >> n;
    vi a(n);
    for(int i=0;i<n;i++) cin >> a[i];
    map<int,int> save;
    for(auto x:a){
        map<int,int> mp;
        prime_factrize(x,mp);
        for(auto x:mp){
            save[x.first]++;
        }
    }
    bool flag=false;
    bool flag2=false;
    for(auto x:save){
        //cout << x.first << " " << x.second << endl;
        if(x.second!=1) flag=true;
        if(x.second==n) flag2=true;
    }
    if(!flag) cout << "pairwise coprime" << endl;
    else if(flag&!flag2) cout << "setwise coprime" << endl;
    else cout << "not coprime" << endl;

    return 0;
}

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

using namespace std;

int main() {
    string s, t;

    cin >> s;
    cin >> t;

    int n = s.size();
    int m = t.size();

    vector<vector<int>> F = vector<vector<int>>(n + 1, vector<int>(m + 1, 0));

    F[0][0] = 0;

    for (int i = 1; i <= n; ++i) {
        for (int j = 1; j <= m; ++j) {
            int ii = i - 1;
            int jj = j - 1;

            if (s[ii] == t[jj]) {
                F[i][j] = F[i - 1][j - 1] + 1;
                //from[{i, j}] = {i - 1, j - 1};
            } else {
                int a = F[i - 1][j];
                int b = F[i][j - 1];

                if (a > b) {
                    F[i][j] = a;
                } else {
                    F[i][j] = b;
                }
            }
        }
    }

    int i = n;
    int j = m;
    string ans;

    while (i > 0 && j > 0) {
        int ii = i - 1;
        int jj = j - 1;

        if (s[ii] == t[jj]) {
            ans.push_back(s[ii]);
            i = i - 1;
            j = j - 1;
        } else {
            int a = F[i - 1][j];
            int b = F[i][j - 1];

            if (a > b) {
                i = i - 1;
            } else {
                j = j - 1;
            }
        }
    }

    reverse(ans.begin(), ans.end());

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 35584
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double lf;
typedef pair<int,int> ii;
typedef pair<ii,int> iii;
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define RST(i,n) memset(i,n,sizeof i)
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(),a.end()
#define X first
#define Y second
#define eb emplace_back
#ifdef cold66
#define debug(...) do{\
    fprintf(stderr,"LINE %d: (%s) = ",__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<", ";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#endif // cold66
//}
template<class T> inline bool chkmax(T &a, const T &b) { return b > a ? a = b, true : false; }
template<class T> inline bool chkmin(T &a, const T &b) { return b < a ? a = b, true : false; }

const ll MAXn=1e5+5,MAXlg=__lg(MAXn)+2;
const ll MOD=1000000007;
const ll INF=0x3f3f3f3f;

bool ok[MAXn],ok1[MAXn];
ll s[2];
ll d[MAXn];
ll ans[MAXn],op[MAXn];
int main(){
    IOS();
    ll n;
    cin >> n;
    ll mx = 1;
    REP1 (i,n) {
        cin >> d[i];
        s[i&1] += max(0LL,d[i]);
        if (d[i] > d[mx]) mx = i;
    }
    ll idx = 0, cnt = 0;
    for (ll i=s[1]>s[0];i<=n;i+=2) {
        if (d[i] > 0) {
            ans[++idx] = i;
            if (idx > 1) {
                op[idx-1] = (ans[idx] - ans[idx-1]) / 2;
                cnt += op[idx-1];
            }
        }
    }

    debug(cnt);
    ll tt = 0;
    if (idx) {
        tt = max(s[0],s[1]);
        cnt += ans[1]-1 + n-ans[idx];
    }
    else {
        tt = d[mx];
        cnt += n-1;
        ans[++idx] = mx;
    }

    cout << tt << endl;
    cout << cnt << endl;
    for (ll i=n;i>ans[idx];i--) cout << i << endl;
    for (ll i=1;i<ans[1];i++) cout << 1 << endl;
    for (ll i=1;i<idx;i++) {
        for (ll j=op[i];j;j--) cout << j+1 << endl;
    }
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int w;
	
	while (scanf("%d", &w) + w != 0){
		int money = 1150;
		
		if (w > 30){
			money += (w - 30) * 160;
			w = 30;
		}
		if (w > 20){
			money += (w - 20) * 140;
			w = 20;
		}
		if (w > 10){
			money += (w - 10) * 125;
		}
		printf("%d\n", 4280 - money);
	}
	
	return 0;
}

Measured memory_bytes: 600
package main

import (
    "fmt"
    "math"
)

func main() {
    
    var (a int; b int; aveint int; ave float64)
//    a = 7
//    b = 4
    fmt.Scan(&a, &b)
    
    ave = (float64(a) + float64(b))/2
    aveint = int(math.Ceil(ave))

  //  fmt.Println(a, b, ave, aveint)
    fmt.Println(aveint)
}

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

int main() {
  int n,k,x,y;
  cin>>n>>k>>x>>y;
  long long kotae=0;
  if(n<=k){
   kotae=n*x;
  }else{
    kotae=k*x+(n-k)*y;
  }
  cout<<kotae<<endl;
  return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
int main() {
  int S;
  string s;
  string x;
  cin >> S;
  for (int i = 0;i < S;i++) {
    cin >> s;
    if (s == "Y") {
      x = "Four";
      break;
    }
    else if (s != "Y") {
      x = "Three";
    }
  }
  cout << x << endl;
}

Measured memory_bytes: 256
while True:
       (H, W) = [int(x) for x in input().split()]
       if H == W == 0:
           break
       
       for hc in range(H):
             if hc == 0 or hc == H - 1:
                  print('#' * W)
             else:
                  print('#' + '.' * (W - 2) + '#')                                             
       print()

Measured memory_bytes: 6724
#include "bits/stdc++.h"
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/pb_ds/tree_policy.hpp"

using namespace std;
using namespace __gnu_pbds;


#define ll long long int
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(a) a.begin(),a.end()

typedef tree <ll, null_type, less <ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
// order_of_key(val): returns the number of values less than val
// find_by_order(k): returns an iterator to the kth largest element (0-based)

int main(void)
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n, k, c, i = 0, done;
    cin>>n>>k>>c;
    string s;
    cin>>s;
    vector<ll> v1, v2, f;
    done = 0;
    for(; i < n; i++) {
    	if(s[i] == 'o') {
    		v1.pb(i);
    		ll temp = c;
    		while(temp--) {
    			i++;
    		}
    		done++;
    		if(done == k) {
    			break;
    		}
    	}
    }
    i = n - 1;
    done = 0;
    for(; i >= 0; i--) {
    	if(s[i] == 'o') {
    		v2.pb(i);
    		ll temp = c;
    		while(temp--) {
    			i--;
    		}
    		done++;
    		if(done == k) {
    			break;
    		}
    	}
    }
    // for(auto u: v1) {
    // 	f.pb(u);
    // }
    // for(auto u: v2) {
    // 	f.pb(u);
    // }
    // sort(all(f));
    // for(i = 1; i < f.size(); i++) {
    // 	if(f[i] == f[i-1]) {
    // 		cout<<f[i] + 1<<"\n";
    // 	}
    // }
    reverse(all(v2));
    for(i = 0; i < v1.size(); i++) {
    	if(v1[i] == v2[i]) {
    		cout<<v1[i] + 1<<"\n";
    	}
    }
}

Measured memory_bytes: 5128