akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main() {
  int N;
  cin >> N;
  vector<int> mochi(N);
  for (int i = 0; i < N; i++) {
    cin >> mochi.at(i);
  }
  
  sort(mochi.begin(), mochi.end());
  reverse(mochi.begin(), mochi.end());
  
  int count = 1; 
  for (int i = 0; i < N - 1; i++) {
    if (mochi.at(i) != mochi.at(i + 1)) {
      count++;
    }
  }
  
  cout << count << endl;
}


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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int INF = 1e9;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

int main() {
  ll n, a, ans = 1;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> a;
    ans = lcm(a, ans);
  }

  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
def start_process(length, q_num, char):
    data = [0 for i in range(length + 1)]
    char = list(char)

    for i in range(1, length):
        if char[i] == 'C' and char[i - 1] == 'A':
            data[i] = data[i - 1] + 1
        else:
            data[i] = data[i - 1]

    for i in range(q_num):
        start_ind, fin_ind = map(int, input().split())
        print(data[fin_ind - 1] - data[start_ind - 1])


def main():
    length, q_num = map(int, input().split())
    char = input()
    start_process(length, q_num, char)

if __name__ == '__main__':
    main()


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

vector<pair<long long, long long>> v;
int N, M;
long long A[100100];
long long B[100100];

int main() {
    cin >> N >> M;
    for (int i=0; i<N; ++i) {
        cin >> A[i] >> B[i];
        v.push_back((pair<long long, long long>){A[i], B[i]});
    }
    sort(v.begin(), v.end());

    int num = 0;
    long long ans = 0;
    for (int i=0; i<N; ++i) {
        if (v[i].second + num >= M) {
            ans += (M - num) * v[i].first;
            break;
        } else {
            ans += v[i].first * v[i].second;
            num += v[i].second;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3568
#include<iostream>
#include<string>
#include<vector>
#include<queue>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<cmath>
using namespace std;
typedef long long ll;
typedef pair<int,int> p;
const int inf=100000000;
#define rep(i,a,n)	for(int i=a;i<n;i++)
#define rrep(i,a,n) for(int i=(a-1);i>=n;i--)
	
int main(){
	int a,b;
	cin>>a>>b;
	if(a%2==0||b%2==0)cout<<"No"<<endl;
	else cout<<"Yes"<<endl;
}

Measured memory_bytes: 764
#include <bits/stdc++.h>
#include <sys/types.h>
#include <unistd.h>

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}

using ll=long long;
using R=long double;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

template<typename T> vector<T> make_vector(size_t sz){
	return vector<T>(sz);
}

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

template<typename T,typename U,typename... V> 
typename enable_if<is_same<T, U>::value!=0>::type 
fill_value(U &u, const V... v){
	u=U(v...);
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_value(U &u, const V... v){
	for(auto &e:u){
		fill_value<T>(e,v...);
	}
}

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

const pid_t pid = getpid();
// Problem Specific Parameter:

// Description: 文字列の接尾辞配列
// TimeComplexity: $\mathcal{O}(|S|\log^2|S|)$
// Verifyed: ARC050 D

auto suffix_array(string s) {
	const int n = s.size();
	vector<int> sa(n + 1), rnk(n + 1, 0), tmp(n + 1, 0);
	rep(i, n + 1) sa[i] = i, rnk[i] = (i < n ? s[i] : -1);
	for (int k = 1; k <= n; k <<= 1) {
		auto cmp = [&](int i, int j) {
			if (rnk[i] != rnk[j]) return rnk[i] < rnk[j];
			int ci = (i + k <= n) ? rnk[i + k] : -1;
			int cj = (j + k <= n) ? rnk[j + k] : -1;
			return ci < cj;
		};
		sort(begin(sa), end(sa), cmp);
		tmp[sa[0]] = 0;
		rep(i, n) tmp[sa[i + 1]] = tmp[sa[i]] + cmp(sa[i], sa[i + 1]);
		rep(i, n + 1) rnk[i] = tmp[i];
	}
	return make_tuple(rnk, sa);
}

int main(void){
	int n, k;
	cin >> n >> k;
	string s;
	cin >> s;
	
	string t = s;
	reverse(begin(t), end(t));
	string z = s + t;

	vector<int> rnk, sa;
	tie(rnk, sa) = suffix_array(z);	

	string base = "";
	
	rep(i, 2 * n + 1){
		if (sa[i] <= n){
			base = z.substr(sa[i], n);
			break;
		}
	}

	chmin(k, 15);
	int head_cnt = 0;
	rep(i, n){
		if(base[i] == base[0]){
			head_cnt++;
		} else {
			break;
		}
	}	

	const int l = head_cnt * ((1 << (k - 1)) - 1);
	string ans = string(l, base[0]) + base;
	ans = ans.substr(0, n);
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 26240
program abc132c
  implicit none

  integer :: n, diff
  integer, allocatable :: d(:)

  read(*,*) n
  allocate( d(n) )
  read(*,*) d(:)

  call heapsort(n, d(:))

  diff =  d(n/2+1) - d(n/2)
  print *, diff
  deallocate( d )
  stop

contains

  subroutine heapsort(n,array)
    implicit none
    integer,intent(in) :: n
    integer,intent(inout) :: array(1:n)

    integer ::i,k,j,l
    integer  :: t

    if(n.le.0)then
       write(6,*)"Error, at heapsort"; stop
    endif
    if(n.eq.1)return

    l=n/2+1
    k=n
    do while(k.ne.1)
       if(l.gt.1)then
          l=l-1
          t=array(L)
       else
          t=array(k)
          array(k)=array(1)
          k=k-1
          if(k.eq.1) then
             array(1)=t
             exit
          endif
       endif
       i=l
       j=l+l
       do while(j.le.k)
          if(j.lt.k)then
             if(array(j).lt.array(j+1))j=j+1
          endif
          if (t.lt.array(j))then
             array(i)=array(j)
             i=j
             j=j+j
          else
             j=k+1
          endif
       enddo
       array(i)=t
    enddo

    return
  end subroutine heapsort

end program abc132c


Measured memory_bytes: 1152
N = int(raw_input())
A = map(int, raw_input().split())
sum = 0
x = 0
for i in range(0, N):
	sum += abs(x-A[i])
	x = A[i]
sum += abs(A[N-1])
print sum - abs(A[0]) - abs(A[1]-A[0])+ abs(A[1])
for i in range(1, N-1):
	print sum - abs(A[i]-A[i-1]) - abs(A[i+1]-A[i]) + abs(A[i+1]-A[i-1])
print sum - abs(A[N-2]-A[N-1]) - abs(A[N-1]) + abs(A[N-2])

Measured memory_bytes: 42220
#include <stdio.h>

int n, S[500001];
int ans = 0;

void merge(int left, int mid, int right)
{
  int n1 = mid - left;
  int n2 = right - mid;
  
  int L[n1+1], R[n2+1];
  
  int i, j, k;
  
  for(i=0; i<n1; i++)
    L[i] = S[left+i];
  
  for(i=0; i<n2; i++)
    R[i] = S[mid+i];
    
  L[n1] = 1000000001;
  R[n2] = 1000000001;
  
  i = 0;
  j = 0;
  
  for(k=left; k<right; k++){
    ans++;
    if(L[i] <= R[j])
      S[k] = L[i++];
    else
      S[k] = R[j++];
  }
}

void mergeSort(int left, int right)
{
  int mid;
  
  if(right -left <= 1)
    return;
    
  mid = (left+right)/2;
  mergeSort(left, mid);
  mergeSort(mid, right);
  
  merge(left, mid, right);
}


int main()
{
  
  int i, left, right;
  
  scanf("%d", &n);
  for(i=0; i<n; i++)
    scanf("%d", &S[i]);
    
  left = 0;
  right = n;
  
  mergeSort(left, right);
  
  for(i=0; i<n; i++){
    if(i>0)
      printf(" ");
    printf("%d", S[i]);
  }
  printf("\n");
  
  printf("%d\n", ans);
  
  return 0;
}

Measured memory_bytes: 6524
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <list>
#include <cmath>
#include <stack>
#include <string>
#include <cstring>
#include <numeric>
#include <iomanip>
#include <fstream>
using namespace std;
int main(){
	long long now=100;
	long long x;
	cin>>x;
	int cnt=0;
	while(now<x){
		now*=1.01;
		cnt++;
	}
	cout<<cnt<<endl;
	return 0;
}

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

#define ll long long
#define ld long double
#define pb push_back
#define eb emplace_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()

#define int long long
using namespace std;
const int INF = 2e16;
const int MOD = 1e9 + 7;
const int MB = 20;
const int K = 500;
const int maxN = 50;

void solve() {
	int k, x;
	cin >> k >> x;
	cout << (k * 500 >= x ? "Yes" : "No");
}

signed main() {
	/*
	freopen("search.in", "r", stdin);
	freopen("search.out", "w", stdout);
	*/
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	cout << fixed;
	cout.precision(12);
	solve();
}

Measured memory_bytes: 256
#include <iostream>
#include <tuple>
#include <sstream>
#include <vector>
#include <cmath>
#include <ctime>
#include <bitset>
#include <cassert>
#include <cstdio>
#include <queue>
#include <set>
#include <map>
#include <fstream>
#include <cstdlib>
#include <string>
#include <cstring>
#include <algorithm>
#include <numeric>

#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef double ld;

template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }

const int maxn = 110000;
int t[maxn];
int p[maxn], sum[maxn];

int root(int x) {
    return x == p[x] ? x : (p[x] = root(p[x]));
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.precision(10);
    cout << fixed;
#ifdef LOCAL_DEFINE
    freopen("input.txt", "rt", stdin);
#endif

    string s;
    cin >> s;
    int n = s.size() + 1;
    s = 'a' + s + 'a';
    forn(i, n) t[i] = (s[i + 1] - s[i] + 26) % 26;
    forn(i, n) p[i] = i;
    forn(i, n) p[root(i)] = root(n - i - 1);

    int m;
    cin >> m;
    forn(i, m) {
        int l, r;
        cin >> l >> r;
        --l;
        p[root(l)] = root(r);
    }

    forn(i, n) (sum[root(i)] += t[i]) %= 26;
    bool ok = true;
    forn(i, n) if (p[i] == i) { 
//        cerr << i << ' ' << sum[i] << '\n';
        ok &= (sum[i] == 0);
    }
    cout << (ok ? "YES" : "NO") << '\n';

#ifdef LOCAL_DEFINE
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
    return 0;
}


Measured memory_bytes: 1388
import sys
import fractions
import numpy as np

def hoge(A,B,g):
    min_r = A//g
    if A%g != 0:
        min_r += 1

    max_r = B//g

    return max_r - min_r + 1

if __name__ == '__main__' :
    A, B, C, D = list(map(int, input().split()))
    
    num_c = hoge(A,B,C)
    num_d = hoge(A,B,D)
    E = (C*D)//fractions.gcd(C,D)
    num_e = hoge(A,B,E)

    print(1+B-A-(num_c + num_d - num_e))


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

using namespace std;

int main(){
    
    int n=0;
    cin>>n;
    int arr[n+1]={0};
    for(int i=1;i<=n;i++){
        cin>>arr[i];
    }
    int dp[n+1]={0};
    dp[0]=10e6;
    
    for(int i=2;i<=n;i++){
        dp[i]=min(dp[i-1]+abs(arr[i-1]-arr[i]),dp[i-2]+abs(arr[i-2]-arr[i]));
    }
    cout<<dp[n]<<endl;
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define pb push_back
#define sz(a) int(a.size())
#define re return
#define all(a) a.begin(),a.end()
#define int long long
using namespace std;
signed main()
{
	int n,m;
	cin>>n>>m;
	int a=n*(n-1)/2;
	int b=m*(m-1)/2;
	cout<<a+b;
	re 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using Graph=vector<vector<int>>;

int main(){
  string s;
  int K;
  cin>>s>>K;
  int n=s.size();
  vector<string> S;
  set<string> st;
  for(int i=0;i<26;i++){
    int num=0;
    char c=(char)('a'+i);
    for(int j=0;j<n;j++){
      if(s.at(j)==c){
        string str="";
        for(int k=j;k<j+K&&k<n;k++){
          str.push_back(s.at(k));
          if(st.count(str)==0){
            S.push_back(str);
            st.insert(str);
          }
        }
      }
    }
    if(S.size()>=K){
      break;
    }
  }
  sort(S.begin(),S.end());
  cout<<S.at(K-1)<<endl;
}


Measured memory_bytes: 256
L = int(input())
dp = [[0]*5 for i in range(L+1)]
for i in range(L):
    x = int(input())
    c = [x, x%2 if x else 2, 1-x%2, x%2 if x else 2, x]
    for j in range(5):
        dp[i+1][j] = 10**18
        for k in range(j+1):
            dp[i+1][j] = min(dp[i+1][j], dp[i][k]+c[j])
print(min(dp[-1]))


Measured memory_bytes: 74980
N,M = map(int, input().split())
S = [list(map(int, input().split())) for i in range(M)]
P = list(map(int, input().split()))

SS = []

for s in S:
  s.pop(0)
  SS.append(s)

count = 0

for bit in range(1 << N):
  flag = True

  for index, s in enumerate(SS):
    on = 0

    for n in range(N):
      if n+1 in s and bit & (1 << n):
        on += 1

    if on % 2 != P[index]:
      flag = False

  if flag:
    count += 1

print(count)

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

int main() {
    string s;
    cin >> s;
    string ans;
    if(s[2] == s[3] && s[4] == s[5]) {
        ans = "Yes";
    } else {
        ans = "No";
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7 # 998244353
input=lambda:sys.stdin.readline().rstrip()
from bisect import bisect_left
def resolve():
    n = int(input())
    A = list(map(int,input().split()))
    E = [[] for _ in range(n)]
    for _ in range(n - 1):
        u, v = map(int,input().split())
        u -= 1; v -= 1
        E[u].append(v)
        E[v].append(u)

    dp = [INF] * (n + 1)
    dp[0] = -INF
    res = 0
    ans = [None] * n
    change = [None] * n
    stack = [(0, -1)]

    while stack:
        v, p = stack.pop()
        if v >= 0:
            idx = bisect_left(dp, A[v])
            change[v] = (idx, dp[idx])
            res = max(res, idx)
            ans[v] = res
            dp[idx] = A[v]
            for nv in E[v]:
                if nv == p:
                    continue
                stack.append((~nv, v))
                stack.append((nv, v))
        else:
            v = ~v
            idx, prev = change[v]
            dp[idx] = prev
            if prev == INF:
                res -= 1

    print(*ans)
resolve()

Measured memory_bytes: 148500
#include<bits/stdc++.h>
#define vi vector<int>
#define pb push_back
using namespace std;
int n,a[2010],x[2010][2010];
bool p[2010];
inline int gcd(int n,int m)
{
    return m?gcd(m,n%m):n;
}
inline vi orz(vi f,vi g)
{
    vi h;
    int n=f.size(),m=g.size();
    int i,j;
    h.pb(f[0]);
    for(i=1,j=0;i<n && j<m;)
      if(f[i]>g[j])
        h.pb(f[i++]);
      else
        h.pb(g[j++]);
    for(;i<n;i++)
      h.pb(f[i]);
    for(;j<m;j++)
      h.pb(g[j]);
    return h;
}
inline vi dfs(int i)
{
    int j;
    vi f;
    f.pb(i);
    p[i]=1;
    for(j=1;j<=n;j++)
      if(!p[j] && x[i][j])
        f=orz(f,dfs(j));
    return f;
}
int main()
{
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	int i,j;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	  scanf("%d",&a[i]);
	sort(a+1,a+n+1);
	for(i=1;i<=n;i++)
	  for(j=1;j<=n;j++)
	    if(i!=j && gcd(a[i],a[j])>1)
	      x[i][j]=1;
	for(i=1;i<=n;i++)
	  x[0][i]=1;
	vi f=dfs(0);
    for(i=1;i<=n;i++)
      printf("%d ",a[f[i]]);
    printf("\n");
	return 0;
}


Measured memory_bytes: 16384
#include<stdio.h>

int main(){

    char str[200000];
    scanf("%s", str);

    long int times = 0;
    long int add = 0;

    for (long int i = 0; i < 200000; i++){

        if(str[i] == 'A'){
            add += 1;
        }

        if(str[i] == 'B'&&str[i+1] == 'C'){
            times += add;
        }

        if(str[i] == 'B'&&str[i+1] == 'B'){
            add = 0;
        }

        if(str[i] == 'C'&&str[i+1] == 'C'){
            add = 0;
        }

        if(str[i] == 'A'&&str[i+1] == 'C'){
            add = 0;
        }

        if(str[i] == 'B'&&str[i+1] == 'A'){
            add = 0;
        }
    }

    printf("%ld", times);

    return 0;
}

Measured memory_bytes: 384
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <vector>
#define MOD 1000000007
using namespace std;
typedef long long ll;
#include <cstring>

int main() {
  string s, t;
  cin >> s >> t;
  cout << t + s << endl;
}

Measured memory_bytes: 3632
#include<stdio.h>
#include<string.h>
#define N 1001

int LCS_Length(char [] ,char []);
char X[N],Y[N];
int c[N][N];
int x,y;
int main(void){
  int i;
  int n;
  scanf("%d",&n);

  for(i=1;i<=n;i++){
    scanf("%s %s",X,Y);

    printf("%d\n",LCS_Length(X,Y));
  
}


  return 0;
}




int LCS_Length(char X[] ,char Y[]){
  int i,j;
  x = strlen(X);
  y = strlen(Y);
  for(i=1;i<=x;i++){
    c[i][0] = 0;
  }
  for(j=0;j<=y;j++){
    c[0][j] = 0;
  }
  
  for(i=1;i<=x;i++){
    for(j=1;j<=y;j++){
      
      if(X[i-1]== Y[j-1]) c[i][j] = c[i-1][j-1] + 1;
      else if(c[i-1][j] >= c[i][j-1]){
	
	c[i][j] = c[i-1][j];
      }	
      else c[i][j] = c[i][j-1];
    }
    
    
    
    
  }
  return c[x][y];
  
}

Measured memory_bytes: 4524
function Main(input) {
    input = input.split("\n");
    var line = input[0].split(" ");
    var num = 100*parseInt(line[0])+10*parseInt(line[1])+parseInt(line[2]);
    

    if(num%4===0){
        console.log("YES");
    } else {
        console.log("NO");
    }
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

using namespace std;

using ll = long long;

const long long MOD_NUMBER = 1000000007;
const double PI = 3.14159265358979323846;

// ベクトル要素の列挙
template <class T> void vector_print(vector<T> vec) {
  for (unsigned int i = 0; i < vec.size(); i++) {
    cout << vec.at(i);
    if (i < vec.size()-1) {
      cout << " ";
    } else if (i == vec.size()-1) {
      cout << endl;
    }
  }
}
// エラトステネスの篩による素数配列の出力
vector<int> Eratosthenes(int N){
  vector<int> p = {2};
  int sqrtN = sqrt(N);
  for(int i = 3; i <= N; i++){
    p.push_back(i);
    for (int j = 0; p.at(j) <= sqrtN; j++) {
      if(i%p.at(j) == 0) {
        p.pop_back();
        break;
      }
    }
  }
  return p;
}
int main() {
  double rad, ans;
  int a, b, h, m;
  cin >> a >> b >> h >> m;
  rad = 5.5*(h*60+m)*PI/180;
  ans = sqrt(a*a+b*b-2*a*b*cos(rad));
  printf("%.10f\n", ans);
  return 0;
}


Measured memory_bytes: 4164
X = int(input())

if 1800 <= X:
    print(1)
elif 1600 <= X:
    print(2)
elif 1400 <= X:
    print(3)
elif 1200 <= X:
    print(4)
elif 1000 <= X:
    print(5)
elif 800 <= X:
    print(6)
elif 600 <= X:
    print(7)
else:
    print(8)

Measured memory_bytes: 9160
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll maxn=1e5+100;
const ll mod=1e9+7;
const ll inf=0x3f3f3f3f3f3f3f3f;
ll t,n,k,a[maxn];
int main(){
    //freopen("in.txt","r",stdin);
    ll n,x,t;
    cin>>n>>x>>t;
    ll res=n%x?(n/x+1):n/x;
    cout<<res*t<<endl;
	return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <algorithm>

using namespace std;

int main (int argc, char *argv[]) 
{
    int N;
    cin >> N;
    vector<int> v(N, 0);
    for (int i = 0; i < N; i++)
    {
        cin >> v[i];
    }

    bool flag = true;
    int prev = v[0] - 1;
    for (int i = 1; i < N; i++) 
    {
        if (prev <= v[i] - 1)
        {
            v[i] -=1;
        }

        if (prev > v[i])
        {
            flag = false;
            break;
        }

        prev = v[i];
    }
    
    if (flag)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }

    return 0;
}

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

using namespace std;

int main(void) {
	int N;
	cin >> N;
	vector<int> A(N+1);
	for (int i = 0; i < N+1; ++i) {
		cin >> A[i];
	}
	int B;
	long long res = 0;
	for (int i = 0; i < N; ++i) {
		cin >> B;
		if (A[i] < B) {
			if (A[i]+A[i+1] < B) {
				res += A[i]+A[i+1];
				A[i+1] = 0;
			}
			else {
				A[i+1] -= B-A[i];
				res += B;
			}
		}
		else {
			res += B;
		}
	}
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 640
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <queue>
using namespace std;
const int Maxn = 200010;
int sta, stb;
vector <int> veca[Maxn], vecb[Maxn];
int n, e[Maxn][2];
int disa[Maxn], disb[Maxn], size[Maxn], dfn[Maxn], id, fa[Maxn];
void dfs(int x) {
	int sz = vecb[x].size();
	size[x] = 1; dfn[x] = ++id;
	for(int i = 0; i < sz; i++){
		int y = vecb[x][i];
		if(y == fa[x]) continue;
		fa[y] = x; disb[y] = disb[x]+1; dfs(y);
		size[x] += size[y];
	}
}
bool v[Maxn], bo[Maxn];
bool check(int x, int y) {
	if(disb[x] < disb[y]) swap(x, y);
	if(disb[x]-disb[y] > 2) return true;
	if(dfn[y] <= dfn[x] && dfn[x] < dfn[y]+size[y]) return false;
	if(fa[x] == fa[y]) return false;
	return true;
}
void bfs() {
	queue <int> q;
	q.push(sta); bo[sta] = true;
	while(!q.empty()){
		int x = q.front(); q.pop();
		int sz = veca[x].size();
		for(int i = 0; i < sz; i++){
			int y = veca[x][i];
			disa[y] = disa[x]+1;
			if(disa[y] < disb[y] && !bo[y]) bo[y] = true, q.push(y);
		}
	}
}
int _max(int x, int y) { return x > y ? x : y; }
int main() {
	int i, j, k;
	scanf("%d%d%d", &n, &sta, &stb);
	for(i = 1; i < n; i++) scanf("%d%d", &e[i][0], &e[i][1]);
	for(i = 1; i < n; i++){
		int x, y;
		scanf("%d%d", &x, &y);
		vecb[x].push_back(y); vecb[y].push_back(x);
	}
	dfs(stb);
	for(i = 1; i < n; i++){
		if(check(e[i][0], e[i][1])) v[e[i][0]] = v[e[i][1]] = true;
		else veca[e[i][0]].push_back(e[i][1]), veca[e[i][1]].push_back(e[i][0]);
	}
	bfs();
	int ans = 0;
	for(i = 1; i <= n; i++){
		if(v[i] && bo[i]){ printf("-1\n"); return 0; }
		if(bo[i]) ans = _max(ans, disb[i]*2);
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 38528
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#ifdef tabr
#include "library/debug.cpp"
#else
#define debug(...)
#endif

template <long long mod>
struct modular {
    long long value;
    modular(long long x = 0) {
        value = x % mod;
        if (value < 0) value += mod;
    }
    modular& operator+=(modular other) {
        if ((value += other.value) >= mod) value -= mod;
        return *this;
    }
    modular& operator-=(modular other) {
        if ((value -= other.value) < 0) value += mod;
        return *this;
    }
    modular& operator*=(modular other) {
        value = value * other.value % mod;
        return *this;
    }
    modular& operator/=(modular other) {
        long long a = 0, b = 1, c = other.value, m = mod;
        while (c != 0) {
            long long t = m / c;
            m -= t * c;
            swap(c, m);
            a -= t * b;
            swap(a, b);
        }
        a %= mod;
        if (a < 0) a += mod;
        value = value * a % mod;
        return *this;
    }
    modular operator-() { return modular(-value); }
    modular operator+(modular rhs) { return modular(*this) += rhs; }
    modular operator-(modular rhs) { return modular(*this) -= rhs; }
    modular operator*(modular rhs) { return modular(*this) *= rhs; }
    modular operator/(modular rhs) { return modular(*this) /= rhs; }
    bool operator==(modular rhs) { return value == rhs.value; }
    bool operator!=(modular rhs) { return value != rhs.value; }
    bool operator<(modular rhs) { return value < rhs.value; }
};
template <long long mod>
string to_string(modular<mod> x) {
    return to_string(x.value);
}
template <long long mod>
ostream& operator<<(ostream& stream, modular<mod> x) {
    x.value %= mod;
    if (x.value < 0) x.value += mod;
    return stream << x.value;
}
template <long long mod>
istream& operator>>(istream& stream, modular<mod>& x) {
    stream >> x.value;
    x.value %= mod;
    if (x.value < 0) x.value += mod;
    return stream;
};
const long long mod = 998244353LL;
using mint = modular<mod>;

inline mint pw(mint a, long long n) {
    mint res = 1;
    while (n > 0) {
        if (n & 1) {
            res *= a;
        }
        a *= a;
        n >>= 1;
    }
    return res;
}
vector<mint> fact, finv;
inline void cinit(int n) {
    fact.resize(n, 1);
    finv.resize(n, 1);
    for (int i = 2; i < n; i++) {
        fact[i] = fact[i - 1] * i;
    }
    finv[n - 1] /= fact[n - 1];
    for (int i = n - 2; i >= 2; i--) {
        finv[i] = finv[i + 1] * (i + 1);
    }
}
inline mint C(int n, int k) {
    if (n < k || k < 0 || n < 0) return 0;
    return fact[n] * finv[k] * finv[n - k];
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, s;
    cin >> n >> s;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    vector<vector<mint>> dp(n + 1, vector<mint>(s + 1));
    dp[0][0] = pw(2, n);
    for (int i = 0; i < n; i++) {
        dp[i + 1] = dp[i];
        for (int j = 0; j + a[i] <= s; j++) {
            dp[i + 1][j + a[i]] += dp[i][j] / 2;
        }
    }
    cout << dp[n][s] << '\n';
    return 0;
}


Measured memory_bytes: 73620
#include "bits/stdc++.h"

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> VI;
typedef vector<VI> VVI;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = numeric_limits<int>::max() / 2;
const int NEG_INF = numeric_limits<int>::min() / 2;
const int MOD = 1e9 + 7;

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

	int n,a,b;cin>>n>>a>>b;
	if((b-a)%2==0) cout<<"Alice"<<endl;
	else cout<<"Borys"<<endl;
}


Measured memory_bytes: 256
S = input()
N = len(S)
if S == S[::-1] and S[:int((N-1)/2)] == S[int((N-1)/2 - N-1)::-1] and S[int((N+3)/2)-1:] == S[:int((N+3)/2 - 1)*(-1):-1]:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3060
import java.util.*;

public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		while(sc.hasNext()){
			int n = sc.nextInt();
			int[] a = new int[n];
			for(int i=0;i<n;i++) a[i] = sc.nextInt();
			Arrays.sort(a);
			for(int i=1;i<n;i++) a[i] = a[i-1] + a[i];
			int sum = 0;
			for(int i=0;i<n;i++) sum+=a[i];
			System.out.println(sum);
		}
	}	
}

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

int Cmp(const void *a, const void *b){
  return *(int *)b - *(int *)a;
}

void Do(int N){
  int a, b, c, C;
  int L[N];
  for(a = 0;a < N;a++) scanf("%d", &L[a]);
  qsort(L, N, sizeof(int), Cmp);
  C = 0;
  for(a = 0;a < N;a++){
    for(b = a + 1;b < N;b++){
      for(c = b + 1;c < N;c++){
	if(L[a] >= L[b] + L[c]) break;
	C++;
      }
      if(c == b + 1) break;
    }
  }
  printf("%d\n", C);
}

int main(void){
  int N;
  scanf("%d", &N);
  Do(N);
  return 0;
}


Measured memory_bytes: 252
import java.util.Scanner;

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

		// 入力値の取得
		String S = sc.next();
		String T = sc.next();
		char[] ScharArray = S.toCharArray();
		char[] TcharArray = T.toCharArray();
		
		// 結果の出力
		int count = T.length();
		for (int i = 0; i <= (S.length() - T.length()); i++) {
			int diff = 0;
			for (int j = 0; j < T.length(); j++) {
				if (TcharArray[j] != ScharArray[i + j]) {
					diff++;
				}
			}
			count = Math.min(count, diff);
		}
		System.out.println(count);
		
		sc.close();
	}
}


Measured memory_bytes: 35488
def gcd(m, n):
    while n:
        m, n = n, m % n
    return m


def prime_factorize(n):
    b = 2
    fct = []
    while n >= b ** 2:
        while n % b == 0:
            n //= b
            fct.append(b)
        b = b + 1
    if n > 1:
        fct.append(n)
    return fct


A, B = map(int, input().split())

print(len(set(prime_factorize(gcd(A, B)))) + 1)


Measured memory_bytes: 3060
#include <algorithm>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
#define DEBUGP(val) cerr << #val << "=" << val << "\n"

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PI;
const ll mod = 1e9 + 7;



int main(void) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll a, b, c;
  cin >> a >> b >> c;
  cout << min(c, a + b + 1) + b << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
 
#define ff first
#define ss second
#define pb push_back

int const lim = 2e5+5;
int n , m ;
vector<int>adj[lim+5];
int vis[lim+5];

int bfs(int s) {
	vis[s] = 1;
	queue<int>q;
	q.push(s) ;
	vector<int>st;
	st.clear();
	while(!q.empty()) {
		int u = q.front();
		q.pop();
		st.pb(u);
		for(auto v : adj[u]) {
			if(vis[v] == -1) {
				vis[v] = 1;
				q.push(v) ;
			}
		}
	}
	int len = st.size() ;
	return len ;
}

void solve() {
	cin >> n >> m;
	for(int i=1;i<=m;i++) {
		int a, b ; cin >> a >> b;
		adj[a].pb(b) , adj[b].pb(a);
	}
	memset(vis, -1, sizeof vis);
	int mx = 0;
	for(int i=1;i<=n;i++) {
		if(vis[i] == -1) {
			mx = max(mx, bfs(i)) ;
		}
	}
	cout<<mx<<endl;
}
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
 
    int t = 1, no = 0;
    // cin >> t;
    while(t--) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 16168
N = int(input())
lst = [[0]*10 for _ in range(12)]
for i in range(N):
    a,b,c,d = map(int,input().split())
    lst[3*(a-1)+b-1][c-1] += d
for j in range(12):
    if j in [3,6,9]:
        print("####################")
    print(" ", end = "")
    print(*lst[j])


Measured memory_bytes: 5620
from fractions import gcd
def factorization(n):
    fac = {}
    count = 0
    while n % 2 == 0:
        n //= 2
        count += 1
    if count > 0:
        fac[2] = count
    for i in range(3, int(n ** .5) + 1, 2):
        count = 0
        while n % i == 0:
            n //= i
            count += 1
        if count > 0:
            fac[i] = count
    if n > 1:
        fac[n] = 1
    return fac

A, B = map(int, input().split())
fac = factorization(gcd(A, B))
print(len(fac) + 1)

Measured memory_bytes: 77972
#include <stdio.h>

int main(void)
{
  int N, D, X, ans;
  scanf("%d%d%d", &N, &D, &X);
  ans = N+X;
  for(int i = 0; i < N; i++){
    int A;
    scanf("%d", &A);
    ans += (D-1)/A;
  }
  printf("%d\n", ans);  
}


Measured memory_bytes: 128
#include <stdio.h>
#include <vector>
#include <algorithm>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define MOD (1000003LL)
typedef long long Int;

int n, mi, cs[60000][2];
vector<int> g[60000];
bool has[60000];
int dp[60000][2][2];

inline int f(int k, int x, int y) { return k == -1 ? x==y : dp[k][x][y]; }

void add(int p, int q) {
    if (p > q) swap(p, q);
    g[p].push_back(q);
}

int pre(int p, int q) {
    if (p+1 == q) return -1;
    const int k = mi++;
    has[k] = false;
    if (g[p].back() == q) {
        has[k] = true;
        g[p].pop_back();
    }
    const int r = g[p].back();
    cs[k][0] = pre(p, r);
    cs[k][1] = pre(r, q);
    return k;
}

int main() {
    for (;;) {
        int m, a, b;
        scanf("%d%d", &n, &m);
        if (n == 0) return 0;
        rep (_, m) {
            scanf("%d%d", &a, &b);
            add(a-1, b-1);
        }
        rep (i, n) add(i, (i+1)%n);
        rep (i, n) sort(g[i].begin(), g[i].end());
        mi = 0;
        pre(0, n-1);
        for (int k = mi-1; k >= 0; k--) rep (x, 2) rep (y, 2) {
            const int p = cs[k][0], q = cs[k][1];
            Int ans = 0;
            ans += (Int)f(p, x, 0) * f(q, 1, y);
            ans += (Int)f(p, x, 1) * f(q, 0, y);
            if (x && y && has[k]) {
                ans += (Int)f(p, 0, 0) * f(q, 1, 0);
                ans += (Int)f(p, 0, 1) * f(q, 0, 0);
            }
            dp[k][x][y] = ans % MOD;
        }
        printf("%d\n", dp[0][1][1]);
    }
}

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

int main(){
  int N, M;
  cin >> N >> M;
  vector<int> A(N);
  int sum=0;
  for(int i=0; i<N; i++){
    cin >> A[i];
    sum+=A[i];
  }
  
  double x=(double)sum/(4*M);
  int item=0;
  for(int i=0; i<N; i++){
    if (A[i]>=x) item++;
  }
  if(item<M) cout<< "No"<<endl;
  else cout << "Yes" <<endl;
}

Measured memory_bytes: 256
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String sdata;
		Map<Integer, Integer> data = new HashMap<Integer, Integer>();
		int[] use = new int[31];
		while (!"0,0".equals(sdata = in.next())) {
			String[] adata = sdata.split(",");
			int point = Integer.parseInt(adata[1]);
			data.put(Integer.parseInt(adata[0]), point);
			if (use[point] == 0) {
				use[point] = 1;
			}
		}
		int rank = 1;
		for (int i = 30; i >= 0; i--) {
			if (use[i] == 1) {
				use[i] = rank++;
			}
		}
		while (in.hasNext()) {
			System.out.println(use[data.get(in.nextInt())]);
		}
	}
}

Measured memory_bytes: 17200
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp15
{
    class Class40
    {
        static void Main()
        {
            var nr = Console.ReadLine().Split().Select(int.Parse).ToArray();
            if (nr[0] < 10)
            {
                nr[1] += 100 * (10 - nr[0]);
            }
            Console.WriteLine(nr[1]);
        }
    }
}


Measured memory_bytes: 13268
#include<bits/stdc++.h>
using namespace std;
//#define int long long
#define fo(a,b) for(int a=0;a<b;a++)
#define Sort(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
#define fi first
#define se second
#define co(a) cout<<a<<endl
#define sz size()
#define bgn begin()
#define en end()
#define pb(a) push_back(a)
#define pop pop_back
#define V vector
#define P pair
#define V2(a,b,c) V<V<int>> a(b,V<int>(c))
#define V2a(a,b,c,d) V<V<int>> a(b,V<int>(c,d))
#define incin(a) int a; cin>>a
//#define min min<int>
//#define max max<int>
template<class T>
 void cou(vector<vector<T>> a){
  int b=a.size();
  int c=a[0].size();
  fo(i,b){
    fo(j,c){
      cout<<a[i][j];
      if(j==c-1)
        cout<<endl;
      else
        cout<<' ';
    }
  }
}
/*template<>
 void cou(vector<vector<char>> a){
  int b=a.size();
  int c=a[0].size();
  fo(i,b){
    fo(j,c){
      cout<<a[i][j];
      if(j==c-1)
        cout<<endl;
      else
        cout<<' ';
    }
  }
}*/
 int wari(int a,int b) {
   if(a%b==0)
     return a/b;
   else
     return a/b+1;
 }
 int keta(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
 }
 int souwa(int a){
  return a*(a+1)/2;
 }
 int lcm(int a,int b){
  int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return d*e/f;
    }
  int gcm(int a,int b){
      int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return f;
  }
 bool prime(int a){
   if(a<2)
     return false;
   else if(a==2)
     return true;
   else if(a%2==0)
     return false;
   double b=sqrt(a);
    for(int i=3;i<=b;i+=2){
      if(a%i==0){
        return false;
      }
    }
   return true;
 }
struct Union{
  vector<int> par;
  Union(int n){
	par= vector<int>(n, -1);
  }
  int find(int x){
    if(par[x]<0)
      return x;
    else
      return par[x]=find(par[x]);
  }
  bool same(int a,int b){
    return find(a)==find(b);
  }
  int Size(int a){
    return -par[find(a)];
  }
  void unite(int a,int b){
    a=find(a);
    b=find(b);
    if(a==b)
      return;
    if(Size(b)>Size(a))
      swap<int>(a,b);
    par[a]+=par[b];
    par[b]=a;
  }
};
int ketas(int a){
  string b=to_string(a);
  int c=0;
  fo(i,keta(a)){
    c+=b[i]-'0';
  }
  return c;
}
/*struct aa{
	vector<int> gt;
  aa(int n){
	gt= vector<int>(n, 1);
  }
	void c(V<int> d,int b){
	if(d[b]==0){
		gt[d[b]-1]++;
		gt[gt.sz-1]++;
	}
	else{
		gt[d[b]-1]++;
		c(d,d[d[b]]-1);
	}
}
void cok(int a){
	cout<<gt[a-1]<<endl;
	fo(i,a-1)
	cout<<gt[i]<<endl;
}
};
*/
signed main(){
	V<int> a(5);
	fo(i,5)
	cin>>a[i];
	int b;
	cin>>b;
	Sort(a);
	if(a[4]-a[0]>b)
		cout<<":("<<endl;
	else
		cout<<"Yay!"<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define all(x) (x).begin(), (x).end()
#define MOD 1000000007
int main() {
    int n;
    cin >> n;
    vector<ll> a(n, 0);
    for(int i = 0; i < n; i++) {
        cin >> a[i];
    }
    vector<ll> rui(n + 1, 0);
    for(int i = 1; i <= n; i++) {
        rui[i] = rui[i - 1] + a[i - 1];
    }

    ll ans = LLONG_MAX;
    for(int i = 0; i <= n; i++) {
        //cout << rui[n] - rui[i] << ":";
        //cout << rui[i] << endl;
        ans = min(ans, abs(rui[n] - rui[i] - rui[i]));
    }
    cout << ans << endl;
}


Measured memory_bytes: 3328
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int count=0;
        while (true) {
            int n = Integer.parseInt(br.readLine());
            if (n == 0) {
                break;
            }else{
                count++;
                System.out.println("Case "+count+": "+n);
            }
            
        }
    }
}

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

int main(){
  string A, B;
  int N;
  cin >> N;
  cin >> A >> B;
  int i=0;
  while(i<N){
    cout << A[i] << B[i];
    i++;
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<numeric>
#include<algorithm>
#include<iomanip>
using namespace std;
#define REP(i,b,n) for(int i=b;i<n;i++)
#define rep(i,n)   REP(i,0,n)

int solve(int *in){
  int ret=0;
  //0
  ret=max(ret,in[0]/3+in[1]/3+in[2]/3);
  //1
  if (in[0] > 0 && in[1] > 0 && in[2] > 0)ret=max(ret,1+(in[0]-1)/3+(in[1]-1)/3+(in[2]-1)/3);
  //2
  if (in[0] > 1 && in[1] > 1 && in[2] > 1)ret=max(ret,2+(in[0]-2)/3+(in[1]-2)/3+(in[2]-2)/3);
  return ret;
}

main(){
  int tmp[6];
  while(true){
    for(int i=0;i<6;i++)cin>>tmp[i];
    if (accumulate(tmp,tmp+6,0) == 0)break;
    int in[3]={tmp[0]+tmp[3],tmp[1]+tmp[4],tmp[2]+tmp[5]};
    cout << solve(in) << endl;
  }
  return false;
}

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

using namespace std;

using ll = long long;

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

    constexpr ll MOD = 1e9 + 7;
    ll n;
    cin >> n;

    ll pw = 1;
    for (ll i = 1; i <= n; ++i) pw = (pw * i) % MOD;

    cout << pw << endl;

    return 0;
}


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

long long n;

bool ck(long long k) {
	long long j = n;

	while (j % k == 0)
		j /= k;

	if (j % k == 1)
		return true;
	else
		return false;
}

int main()
{
	cin >> n;

	long long j = n - 1, p = 2, t = 0, m = 1;

	while (p <= sqrt(j)) {
		while (j % p == 0) {
			t++;
			j /= p;
		}

		if (t > 0) {
			m *= t + 1;
			t = 0;
		}

		p++;
	}

	if (j > 1)
		m *= 2;

	p = 2;

	while (p < sqrt(n)) {
		if (n % p == 0) {
			if (ck(p))
				m++;

			if (ck(n / p))
				m++;
		}

		p++;
	}

	if (p * p == n && ck(p))
		m++;

	cout << m << endl;
}


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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;
string char_to_string(char val) {
  return string(1, val);
}
int char_to_int(char val) {
  return val - '0';
}
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;
}
int vector_finder(std::vector<ll> vec, int number) {
  auto itr = std::find(vec.begin(), vec.end(), number);
  size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return 1;
  }
  else { // 発見できなかったとき
    return 0;
  }
}

int main() {
  int N; cin >> N;
  ll H; cin >> H;
  vector<ll> a(N), b(N); REP(i, N) cin >> a[i] >> b[i];
  ll ans = 0; sort(all(b)); ll max_n = *max_element(all(a));
  for(int i = N - 1; i >= 0; --i) {
    if(b[i] < max_n) break;
    H -= b[i]; ans++;
    if(H <= 0) {
      cout << ans << endl;
      return 0;
    }
  }
  ll p = 0;
  if(H % max_n == 0) p = H / max_n;
  else p = (H / max_n) + 1;
  ans += p;
  cout << ans << endl;
}

Measured memory_bytes: 4752
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define INF 1000000000
#define LLINF 10000000000000000ll
#define MOD 1000000007

bool dbgflag = false;

struct edge {
  int color = -1;
  vector<int> to;
};

void dfs(int i, int col, vector<edge>&edges) {
  edges[i].color = col;
  int c = 1;
  for (int nx: edges[i].to) {
    if (c == col) c++;
    if (edges[nx].color == -1) {
      dfs(nx, c, edges);
      c++;
    }
  }
  return;
}

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

  ll n, k;
  cin >> n >> k;
  vector<ll> a(n+1);
  for (int i = 0; i < n; i++) cin >> a[i+1];
  for (int i = 1; i <= n; i++) a[i] += a[i-1];
  for (int i = 0; i <= n; i++) {
    a[i] -= (i) - k;
    a[i] %= k;
  }
  if (dbgflag) for (int i = 0; i < a.size(); i++) cout << a[i] << " ";
  if (dbgflag) cout << endl;  
  
  map<int, int> aCount;
  int left = 0, right = 0;
  ll cnt = 0;
  while (right - left != min(n+1, k)) {
    cnt += aCount[a[right]];
    aCount[a[right]]++;
    right++;
    if (dbgflag) cout << cnt << endl;
  }
  if (dbgflag) cout << "right: " << right << endl;
  while (right <= n) {
    aCount[a[left]]--;
    cnt += aCount[a[right]];
    aCount[a[right]]++;
    right++;
    left++;
    if (dbgflag) cout << cnt << endl;
  }
  cout << cnt << endl;
}


Measured memory_bytes: 11264
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>

using namespace std;

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

#define forn(i, n) for (int (i) = 0; (i) != (n); (i)++)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define fi first
#define se second

#ifdef LOCAL
#define dbg(x) cerr << __LINE__ << " " << #x << " " << x << endl
#define ln cerr << __LINE__ << endl
#else
#define dbg(x) void(0)
#define ln void(0)
#endif // LOCAL

const int N = 500000;
const int MOD = 1e9 + 7;
int n;
int deg[N];

signed main()
{
    #ifdef ONLINE_JUDGE
        ios_base::sync_with_stdio(false);
        cin.tie(0);
        cout.tie(0);
    #endif // ONLINE_JUDGE
    cin >> n;
    ll ans = 1;
    for (int i = 2; i <= n; i++)
    {
        int t = 1;
        for (int j = 2; j < i; j++) if (i % j == 0) t = 0;
        if (t == 0) continue;
        for (int j = 1; j <= n; j++)
        {
            int k = j;
            while (k % i == 0) k /= i, deg[i]++;
        }
        deg[i]++;
        ans = ans * deg[i] % MOD;
    }
    cout << ans;
}


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

using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

#define REP(i, l, n) for(int i=(l), i##_len=(n); i<i##_len; ++i)
#define ALL(x) (x).begin(),(x).end()
#define pb push_back

ll gcd(ll a,ll b){return b ? gcd(b,a%b) : a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

char alpha[26] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};

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

int main(){
    int s, w; cin >> s >> w;
    if(w >= s){
        cout << "unsafe" << endl;
    }else{
        cout  << "safe" << endl;
    }
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
#define ll long long
const int N=100005;
using namespace std;
int a[5];
string s;
int main(){
	cin>>s;
	for(int i=1;i<=4;i++) a[i]=s[i-1]-48;
	if(a[1]+a[2]+a[3]+a[4]==7)cout<<a[1]<<"+"<<a[2]<<"+"<<a[3]<<"+"<<a[4]<<"=7"<<endl;
	else if(a[1]+a[2]+a[3]-a[4]==7)cout<<a[1]<<"+"<<a[2]<<"+"<<a[3]<<"-"<<a[4]<<"=7"<<endl;
	else if(a[1]+a[2]-a[3]+a[4]==7)cout<<a[1]<<"+"<<a[2]<<"-"<<a[3]<<"+"<<a[4]<<"=7"<<endl;
	else if(a[1]-a[2]+a[3]+a[4]==7)cout<<a[1]<<"-"<<a[2]<<"+"<<a[3]<<"+"<<a[4]<<"=7"<<endl;
	else if(a[1]+a[2]-a[3]-a[4]==7)cout<<a[1]<<"+"<<a[2]<<"-"<<a[3]<<"-"<<a[4]<<"=7"<<endl;
	else if(a[1]-a[2]-a[3]+a[4]==7)cout<<a[1]<<"-"<<a[2]<<"-"<<a[3]<<"+"<<a[4]<<"=7"<<endl;
	else if(a[1]-a[2]+a[3]-a[4]==7)cout<<a[1]<<"-"<<a[2]<<"+"<<a[3]<<"-"<<a[4]<<"=7"<<endl;
	else if(a[1]-a[2]-a[3]-a[4]==7)cout<<a[1]<<"-"<<a[2]<<"-"<<a[3]<<"-"<<a[4]<<"=7"<<endl;
	return 0;
}

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


int main(){
    int n,k; cin>>n>>k;
    vector<int> p(n);
    for(int &x: p) cin>>x;
    sort(p.begin(),p.end());
    long long ans=0;
    for(int i=0;i<k;i++){
        ans+=p[i];
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3632
#include <stdio.h>

int main(void) {
	unsigned long long int n,x,a,b,r;
	scanf("%llu%llu",&n,&x);
	a=n;
	b=x;
	r=a%b;
	while(r!=0){
		a=b;
		b=r;
		r=a%b;
	}
	printf("%llu\n",((n/b)-1)*3*b);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
 
using namespace::std;
 
#define MAX_INPUT = 1000000000000000
 
int main() {
	uint64_t N; cin >> N;
	vector<uint64_t> transport(5); 
	for (int i = 0; i < transport.size(); i++) {
		cin >> transport[i];
	}
 
	auto min_point = min_element(begin(transport), end(transport));
 
	uint64_t ans = 0;
	if (N <= *min_point) ans = 5;
	else {
		ans = N / *min_point + 4;
        if(N%*min_point!=0) ans++;
	}
 
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{int a,b,c;
	scanf("%d %d %d",&a,&b,&c);
	if(a<b)
		{if(b<c)
		printf("%d %d %d\n",a,b,c);
		else if(c<b)
		{if(a<c)
		printf("%d %d %d\n",a,c,b);
		else
		printf("%d %d %d\n",c,a,b);
		}}
	else if(b<a)
		{if(a<c)
			printf("%d %d %d\n",b,a,c);
		else if(c<a)
			{if(c<b)
			printf("%d %d %d\n",c,b,a);
			else
			printf("%d %d %d\n",b,c,a);
			}
		}
	return 0;
}

Measured memory_bytes: 596