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

#include <boost/range/adaptors.hpp>
#include <boost/range/irange.hpp>

using namespace std;
using namespace boost;
using namespace boost::adaptors;

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

    string s;
    cin >> s;

    int64_t m = s.size();

    vector a(1, 0L);
    int64_t t = 0;
    for (auto c : s) {
        if (c == '0') {
            a.push_back(t);
        } else {
            ++t;
        }
    }
    a.push_back(t);

    int64_t k;
    cin >> k;
    k = min(k, a.back());

    int64_t n = a.size();

    constexpr auto M = 998244353L;

    vector dp(2, vector(k + 1, vector(a.back() + 1, 0L)));
    int64_t h = 0, mk = 0;
    dp[h][0][0] = 1;
    for (auto i : irange(0L, n - 1)) {
        auto&& prev = dp[h];
        auto&& next = dp[!h];
        h = !h;

        for (auto j : irange(mk, -1L, -1L)) {
            int64_t ss = 0;
            for (auto c : irange(a[i + 1], a.back() + 1)) {
                next[j][c] = ss + prev[j][a[i] + (c - a[i + 1])];
                if (next[j][c] >= M) {
                    next[j][c] -= M;
                }
                ss += prev[j][a[i] + (c - a[i + 1])];
                if (ss >= M) {
                    ss -= M;
                }
            }

            for (auto c : irange(a[i + 1], a.back() + 1)) {
                for (auto b : irange(a[i] + (c - a[i + 1]) + 1, c + 1)) {
                    auto w = j + b - (a[i] + (c - a[i + 1]));
                    if (w > k) {
                        break;
                    }
                    mk = max(mk, w);
                    next[w][c] += prev[j][b];
                    if (next[w][c] >= M) {
                        next[w][c] -= M;
                    }
                }
            }
        }
    }

    int64_t ans = 0;
    for (auto i : irange(0L, k + 1)) {
        ans += dp[h][i][a.back()];
        if (ans >= M) {
            ans -= M;
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 5260
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
ll n,m,k;
ll ans;
const ll MOD=998244353;
ll mod_pow(ll x,ll y,ll mod){
    if(y==0) return 1;
    ll res=mod_pow(x*x%mod,y/2,mod);
    if(y&1) res=res*x%mod;
    return res;
}
const ll MAX=200005;
  ll fac[MAX],finv[MAX],inv[MAX];
  void COMinit(){
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for(int i=2;i < MAX;i++){
      fac[i]=fac[i-1]*i%MOD;
      inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
      finv[i]=finv[i-1]*inv[i]%MOD;
    }
  }
  ll COM(ll i,ll j){
    if(i < j) return 0;
    if(i < 0||j < 0) return 0;
    return fac[i]*(finv[j]*finv[i-j]%MOD)%MOD;
  }
int main(void){
    cin>>n>>m>>k;
    COMinit();
    for(int i=0;i<=k;i++){
        ans=(ans+(COM(n-1,i)*((m*mod_pow(m-1,n-1-i,MOD))%MOD))%MOD)%MOD;
        if(ans<0){
            ans+=MOD;
        }
    }
    cout<<ans<<endl;

}



Measured memory_bytes: 8336
#include<bits/stdc++.h> 
//#define <- プログラムの文字列を置換する
//typedef <- 新しい型に名前を付けるためのキーワード

using namespace std;

#define MAX_N 1

const double pi = 3.141592653589793;
const long long MOD = 1e9 + 7;
const long long INF = 1e15;

int main(){
    int n,k;
    cin >> n >> k;
    int check[n];
    memset(check , 0 ,sizeof check);
    for(int i = 1; i <= k ;i++){
        int d;
        cin >> d;
        for(int j = 1; j <= d;j++){
            int a;
            cin >> a;
            check[--a]++;
        }
    }
    int ans = 0;
    for(int i = 0; i < n;i++){
        if(check[i] == 0) ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3640
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
	string s; cin>>s;
	reverse(s.begin(), s.end());
	ll t[200020]={};
	int n=s.size();
	ll p=1;
	for(int i=0; i<n; i++){
		t[i+1]=(t[i]+(ll)(s[i]-'0')*p)%2019;
		(p*=10)%=2019;
	}
	map<ll, ll> mp;
	for(int i=0; i<=n; i++) mp[t[i]]++;
	ll ans=0;
	for(auto p:mp){
		ll x=p.second;
		ans+=x*(x-1)/2;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 5260
#include <iostream>
#include <string>
#include <algorithm>
#include <fstream>
#include <cmath>

using namespace std;

#define rep(i,n) for(int i=0;i<(int)n;i++)
#define dum(x) cout<<#x<<'='<<x<<endl
#define INF 2000000000

int a[100010];
int b[100010];
long long bc[100010];

int main() {

    int N;
    long long K;
    cin >> N >> K;
    rep(i, N)cin >> a[i] >> b[i];

    for (int i = 0; i < N; i++) {
        bc[a[i]] += b[i];
    }
    for (int i = 0; i < 100010; i++) {
        if (K <= bc[i]) {
            cout << i << endl;
            break;
        }
        K -= bc[i];
    }
}

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

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
const int INF_N = 1e+9;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

//繰り返し二乗法
ll mod_pow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

//逆元(Eucledean algorithm)
ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
using mP = pair<modint, modint>;

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


int N, M;
vec dp(100010, -1);
void solve() {
	cin >> N >> M;
    rep(i, M){
        int a; cin >> a;
        dp[a] = 0;
    }
    if(dp[1] != 0) dp[1] = 1;
    if(dp[2] != 0) dp[2] = dp[1] + 1;
    rep1(i, N){
        if(dp[i+2] != 0){
            dp[i+2] = modint(dp[i+1] + dp[i]);
        }
    }

    cout << dp[N] << endl;
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout << fixed << setprecision(10);
  //init_f();
  //init();
  //int t; cin >> t; rep(i, t)solve();
  solve();
//   stop
    return 0;
}


Measured memory_bytes: 4736
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
#[allow(unused_imports)]
use std::collections::{HashMap, HashSet, BinaryHeap, VecDeque, BTreeSet, BTreeMap};
#[allow(unused_imports)]
use std::iter::FromIterator;
#[allow(unused_imports)]
use std::io::stdin;

mod util {
    use std::io::stdin;
    use std::str::FromStr;
    use std::fmt::Debug;

    #[allow(dead_code)]
    pub fn line() -> String {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.trim().to_string()
    }

    #[allow(dead_code)]
    pub fn gets<T: FromStr>() -> Vec<T>
    where
        <T as FromStr>::Err: Debug,
    {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.split_whitespace()
            .map(|t| t.parse().unwrap())
            .collect()
    }
}

#[allow(unused_macros)]
macro_rules! get {
    ($t:ty) => {
        {
            let mut line: String = String::new();
            stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
                    get!($t)
                   ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
                    get!($($t),*)
                   ).collect::<Vec<_>>()
    };
    ($t:ty ;;) => {
        {
            let mut line: String = String::new();
            stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn main() {
    let ss = util::line();

    let mut t = 0;
    let mut s = 0;

    for c in ss.chars() {
        if c == 'T' {
            if s > 0 {
                s -= 1;
            } else {
                t += 1;
            }
        } else {
            s += 1;
        }
    }

    println!("{}", s + t);
}


Measured memory_bytes: 4352
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <climits>
#include <iomanip>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
int main(){
  ll n = 0;
  cin >> n;
  double res = 0;
  for(int i = 0;i < n;i++){
    double in;
    string t;
    cin >> in >> t;
    if(t[0] == 'J')res += in;
    else res += in * 380000;
  }
  cout << fixed << setprecision(20) << res << endl;
}



Measured memory_bytes: 3812
# -*- coding: utf-8 -*-
import sys
'import math'
while 1:
    n=int(input())
    if n==0: sys.exit()
    arr=[0]*7
    while n:
        a=int(input())
        if a>60: a=61
        arr[int(a/10)]+=1
        n-=1
    for i in range(len(arr)):
        print(arr[i])

Measured memory_bytes: 7600
#include <iostream>
#include <string>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <vector>
#include <map>
#include <list>
#include <cmath>
#include <set>
#define ll long long
using namespace std;
const int INF = 0x7fffffff;
const int maxn = 100000;
int a[50], b[50];
int main()
{
	int n;
	cin >> n;
	for (int i = 1; i <= n; ++i)
		cin >> a[i];
	for (int i = 1; i <= n; ++i)
		cin >> b[i];
	int ans = 0;
	for (int i = 1; i <= n; ++i) {
		if (a[i] > b[i])
			ans += a[i] - b[i];
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;

public class SugorokuAndPieces {
    public static readonly int locationGoal = 2019;
    
    public static void Main(){
        Dictionary<int, int> linearMap = new Dictionary<int, int>();
        
        int N = int.Parse(Console.ReadLine());
        List<int> locations = new List<int>();
        string[] line = Console.ReadLine().Split(' ');
        for (int i=0;i<N;i++)
        {
            // マップを作成
            locations.Add(int.Parse(line[i]));
            linearMap[locations[i]] = (i+1);
        }
        int M = int.Parse(Console.ReadLine());
        List<int> operations = new List<int>();
        line = Console.ReadLine().Split(' ');
        for (int i=0;i<M;i++)
        {
            // 駒を動かす
            operations.Add(int.Parse(line[i]));
            if (UpdateMap(linearMap, locations[operations[i]-1]))
            {
                locations[operations[i]-1]++;
            }
        }
        
        for (int i=1;i<=N;i++)
        {
            Console.WriteLine(locations[i-1]);
        }
    }
    
    private static bool UpdateMap(Dictionary<int, int> map, int operatedObj)
    {
        if (operatedObj == locationGoal) return false;
        if (map.ContainsKey(operatedObj+1)) return false;
        
        map[operatedObj+1] = map[operatedObj];
        map.Remove(operatedObj);
        return true;
    }
}


Measured memory_bytes: 18088
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>

#define L 1000000

#define MIN(a,b) ((a) < (b) ? (a) : (b)) 

int main()
{
    int N, K;

    scanf("%d%d",&N,&K);

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

    dp[0] = 0;
    

    for (int i = 0; i < N; i++) {
        for (int j = 1; j <= K; j++) {
            if (i + j < N) {
                dp[i+j] = MIN(dp[i+j], dp[i] + abs(h[i] - h[i+j]));
            }
        }
    }

    printf("%d", dp[N-1]);

    return 0;
}

Measured memory_bytes: 2944
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <numeric>
#include <iomanip>
#include <map>
#include <stack>
#include <sstream>


using namespace std;
//const int MAX = 1e6;

int main()
{

	int X;
	cin >> X;
	if (X < 30)
	{
		cout << "No";
	}
	else
	{
		cout << "Yes";
	}

	return 0;

}
	


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

using namespace std;

int main(int argc, char* argv[]) {
  vector<int> S(14, false);
  vector<int> H(14, false);
  vector<int> C(14, false);
  vector<int> D(14, false);

  int n; cin >> n;
  for (int i = 0; i < n; i++) {
    char k;
    int num;
    cin >> k >> num;

    if (k == 'S') S[num] = true;
    if (k == 'H') H[num] = true;
    if (k == 'C') C[num] = true;
    if (k == 'D') D[num] = true;
  }

  for (int i = 1; i < 14; i++) {
    if (S[i] == false) cout << "S " << i << endl;
  }
  for (int i = 1; i < 14; i++) {
    if (H[i] == false) cout << "H " << i << endl;
  }
  for (int i = 1; i < 14; i++) {
    if (C[i] == false) cout << "C " << i << endl;
  }
  for (int i = 1; i < 14; i++) {
    if (D[i] == false) cout << "D " << i << endl;
  }

  return 0;
}

Measured memory_bytes: 1196
#include <bits/stdc++.h>
using namespace std;
template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}
#ifdef __LOCAL
#define debug(x) cerr << __LINE__ << ": " << #x << " = " << x << endl
#define debugArray(x, n)                           \
  cerr << __LINE__ << ": " << #x << " = {";        \
  for (long long hoge = 0; (hoge) < (n); ++(hoge)) \
    cerr << ((hoge) ? "," : "") << x[hoge];        \
  cerr << "}" << endl
#else
#define debug(x) (void(0))
#define debugArray(x, n) (void(0))
#endif

template <int mod>
struct ModInt {
  int x;
  ModInt() : x(0) {}
  ModInt(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod)) {}
  ModInt &operator+=(const ModInt &p) {
    if ((x += p.x) >= mod) x -= mod;
    return *this;
  }
  ModInt &operator-=(const ModInt &p) {
    if ((x += mod - p.x) >= mod) x -= mod;
    return *this;
  }
  ModInt &operator*=(const ModInt &p) {
    x = (int)(1LL * x * p.x % mod);
    return *this;
  }
  ModInt &operator/=(const ModInt &p) { return *this *= p.inverse(); }
  ModInt operator-() const { return ModInt() - *this; }
  ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }
  ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }
  ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }
  ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }
  bool operator==(const ModInt &p) const { return x == p.x; }
  bool operator!=(const ModInt &p) const { return x != p.x; }
  ModInt inverse() const {
    int a = x, b = mod, u = 1, v = 0, t;
    while (b) t = a / b, swap(a -= t * b, b), swap(u -= t * v, v);
    return ModInt(u);
  }
  ModInt pow(int64_t e) const {
    ModInt ret(1);
    for (ModInt b = *this; e; e >>= 1, b *= b)
      if (e & 1) ret *= b;
    return ret;
  }
  friend ostream &operator<<(ostream &os, const ModInt &p) { return os << p.x; }
  friend istream &operator>>(istream &is, ModInt &a) {
    int64_t t;
    is >> t;
    a = ModInt<mod>(t);
    return (is);
  }
  static int modulo() { return mod; }
};

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  using Mint = ModInt<int(1e9 + 7)>;
  long long N, K;
  cin >> N >> K;
  Mint ans = 0;
  for (long long k = K; k <= N + 1; k++) {
    ans += (N - k + 1) * k + 1;
  }
  cout << ans << endl;
  return 0;
}


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

using namespace std;
typedef long double lld;
int a[1111];
int main()
{
    int n;
    cin >> n;
    for (int i=0;i<n;i++)
    {
        cin >> a[i];
    }
    int s=accumulate(a,a+n,0);
    int mx=*max_element(a,a+n);
    if (mx*2>=s) 
    {
        cout << "No" << endl;
    }else
    {
        cout<< "Yes" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
def calc(A, B, C):
    da = A // 5
    na = A % 5
    db = B // 4
    nb = B % 4
    dc = C // 3
    nc = C % 3
    return da*1520 + na*380 + db*1870 + nb*550 + dc*2244 + nc*850

def f(a, b, c, g):
    if g == 0:
        return calc(a, b, c)
    if g < 0:
        return 10000000

    return min(f(a+1, b, c, g-2), f(a, b+1, c, g-3), f(a, b, c+1, g-5))

ans = [0,0,0,0,0,850,1100,1230,1400,1610,1520,\
       1950,1870,2070,2250,2244,2620,2624,2794,3004,3040,\
       3344,3390,3590,3740,3764,4120,4114,4314,4494,4488,\
       4864,4868,5038,5248,5284,5588,5634,5834,5984,6008,\
       6364,6358,6558,6738,6732,7108,7112,7282,7492,7528]

while True:
    N = int(input())
    if N == 0:
        break
    print(ans[N//100])


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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  string s;
  cin >> s;
  
  int ans;
  if(s == "SUN") ans = 7;
  if(s == "MON") ans = 6;
  if(s == "TUE") ans = 5;
  if(s == "WED") ans = 4;
  if(s == "THU") ans = 3;
  if(s == "FRI") ans = 2;
  if(s == "SAT") ans = 1;
  
  cout << ans << "\n";
}

Measured memory_bytes: 764
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<vector>
#include<algorithm>
#include<map>
#include<math.h>
using namespace std;
int A[100010];
int main(){
    int i,n;
    cin>>n;
    for(i=1;i<=n;i++) cin>>A[i];
    for(i=n-1;i;i--){
        if(A[i]>A[i+1]+1){
              cout<<"No"<<endl;
              return 0;
        }
        else if(A[i]==A[i+1]+1) A[i]--;
    }
    cout<<"Yes"<<endl;
    return 0;

}


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

using namespace std;
using ll = long long;
constexpr ll mod = 1e9+7;
constexpr ll md = mod;
constexpr ll inf = 1e15;
int main(){
    int n,x;
    cin>>n>>x;
    vector<int> a(n);
    for(auto & b :a ) cin>>b;
    vector<int> s(n+1);
    for(int i=1;i<=n;++i){
        s[i] = s[i-1] + a[i-1];
    }
    int num = 0;
    int g= 0;
    while(s[g] <= x)g++,num++;
    cout << min(n+1,num) << endl;
    return 0;
}



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

#define ll long long
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define pll pair<long long,long long>

#define fastio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"

#define Debug(x) cout<<(#x)<<" >> "<<(x)<<endl

using namespace std;

ll fastpow(ll angka,ll pangkat,ll MOD){
	ll res=1;
	while(pangkat){
		if(pangkat&1) res=(res*angka)%MOD;
		angka=(angka*angka)%MOD;
		pangkat=pangkat>>1;
	}
	return res;
}

ll fastpow(ll angka,ll pangkat){
	ll res=1;
	while(pangkat){
		if(pangkat&1) res=(res*angka);
		angka=(angka*angka);
		pangkat=pangkat>>1;
	}
	return res;
}

ll gcd(ll angka1,ll angka2){
	while(angka2){
		swap(angka1,angka2);
		angka2=angka2%angka1;
	}
	return angka1;
}

ll lcm(ll angka1,ll angka2){
	return (angka1/gcd(angka1,angka2))*angka2;
}

const ll mod=1e9+7;

void solve(){
	
	ll n;
	cin>>n;
	
	ll total=fastpow(10,n,mod);
	ll kurang=(fastpow(9,n,mod)*2 - fastpow(8,n,mod) + mod)%mod;
	
	cout<<(total-kurang+mod)%mod<<endl;
	
}

int main(){
	
	fastio();

//	freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);

	int t=1;
//	cin>>t;
	
	for(int tt=0;tt<t;tt++){
//		cout<<"Case "<<tt+1<<":\n";solve();
		solve();
	}
	
	return 0;
}

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

#define int long long
#define nl '\n'
#define tez ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

using namespace std;

signed main()
{
	tez
    // int i,j,k,n,t;
    int a,b,t,i;
    int count=0;
    cin >> a>>b>>t;
    int time=(int)((t+0.5)/a);
    for(i=0;i<time;i++)
    {
        count+=b;
    }
    cout << count;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <string.h>
#include <stack>
#define Endl endl
#define mp make_pair
#define rep(N) for(int i=0;i<N;i++)
#define repj(N) for(int j=0;j<N;j++)
#define ll long long 
#define pii pair<int,int>
#define pll pair<ll,ll>
#define For(I,N) for(int I=0;I<N;I++)
#define cinone(N) int N;cin>>N;
#define scanfone(N) int N;cin>>N;
#define cinng(N,M) int N[M];for(int yiuytvnm=0;yiuytvnm<M;yiuytvnm++) cin>>N[yiuytvnm];
#define scanfng(N,M) int N[M];for(int qrwuoiq=0;qrwuoiq<M;qrwuoiq++) scanf("%d",&N[qrwuoiq]);
#define over(A) {cout<<A<<endl;exit(0);}
#define all(A) A.begin(),A.end()
typedef unsigned long long ull;
const int inf=1039074182;
using namespace std;
int n;
int a[100005];
int k;
int go[100005][18];
int e[18];

int cal(int x)
{
	int l=0;
	int r=n-1;
	int ans;
	int m;
	while(l<=r)
	{
		m=(l+r+1)>>1;
		if(a[m]-a[x]<=k)
		{
			ans=m;
			l=m+1;
		}
		else
		{
			r=m-1;
		}
	}
	return ans;
}

int main()
{	
//	freopen("input.txt","r",stdin);
	cin>>n;
	for(int i=0;i<n;i++)
	{
		scanf("%d",a+i);
	}
	cin>>k;
	for(int i=0;i<n;i++)
	{
		go[i][0]=cal(i);
	}
	e[0]=1;
	for(int i=1;i<18;i++)
	{
		e[i]=e[i-1]<<1;
	}
	for(int i=1;i<18;i++)
	{
		for(int j=0;j<n;j++)
		{
			go[j][i]=go[go[j][i-1]][i-1];
		}
	}
	int q;
	cin>>q;
	int l,r;
	while(q--)
	{
		scanf("%d%d",&l,&r);
		l--;
		r--;
		if(l>r) swap(l,r);
		int res=0;
		for(int i=17;i>=0;i--)
		{
			if(go[l][i]<r)
			{
//					cout<<i<<' '<<go[l][i]<<endl;
				res+=e[i];
				l=go[l][i];
//				break;
			}
		}
//		cout<<l<<' '<<r<<endl;
		if(l!=r) res++;
		printf("%d\n",res);
	}
//	for(int i=0;i<n;i++)
//	{
//		cout<<go[i][1]<<' ';
//	}
//	cout<<endl;
	return 0;
}

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

int main() {
	int n;
	cin >> n;
	vector<int>a(200);
	for (int i = 0; i < n; i++) {
	cin >> a.at(i);
}
	int count = 0;
	while(1){
		bool odd =false;
		for (int i = 0; i < n; i++) {
			if (a.at(i) % 2 != 0) {
				odd = true;
			}
		}
			if (odd)break;
			count++;
			for (int i = 0; i < n; i++) {
				a.at(i) /= 2;
			}
		}
	cout << count << endl;
}

Measured memory_bytes: 256
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    n,m=INTM()
    a=LIST()
    suma=sum(a)
    ct=0
    for i in a:
        if 4*i*m>=suma:
            ct+=1
    if ct>=m:
        print('Yes')
    else:
        print('No')
if __name__ == '__main__':
    do()

Measured memory_bytes: 3064
#include <stdio.h>
int main(void){
  int x,y,z,temp;
  scanf("%d %d %d",&x,&y,&z);
  temp = x;
  x = y;
  y = temp;
  temp = x;
  x = z;
  z = temp;
  printf("%d %d %d",x,y,z);
  return 0;
}

Measured memory_bytes: 1732
from collections import defaultdict

MOD = 998244353
N,S = map(int,input().split())
A = map(int,input().split())

dp = [0]*(S+1)
dp[0] = 1
for a in A:
    ndp = [0]*(S+1)
    for total,cnt in enumerate(dp):
        ndp[total] += (dp[total]*2)%MOD
        if total+a <= S:
            ndp[total+a] += dp[total]
            ndp[total+a] %= MOD
    dp = ndp

print(dp[-1]%MOD)

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

 int main() {
   int x[4], y[4];
   cin >>x[0] >> y[0] >> x[1] >> y[1];

   x[3] = x[0] + (y[0] - y[1]);
   x[2] = x[1] + (y[0] - y[1]);

   y[3] = y[0] + (x[1] - x[0]);
   y[2] = y[1] + (x[1] - x[0]);


   cout << x[2] <<' '<<  y[2] <<' '<< x[3] <<' '<< y[3] << "\n";
 }


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template < typename T > string tost( const T& n ) { ostringstream stm; stm << n; return stm.str();}
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 const INF = 1001001001;


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

ll n,a,b;
cin >> n >> a >> b;
ll g = n / (a+b);
ll amari = n % (a+b);
ll ans = 0;
ans += g*a;
if(amari <= a) ans += amari;
else ans += a;
cout << ans << endl;

return 0;
}

Measured memory_bytes: 256
s = input()
t = set()
for i in range(len(s)):
  t.add(s[i])
o = list(t)
o.sort()
u = 'qwertyuiopasdfghjklzxcvbnm'
v = []
for i in range(len(u)):
  v.append(u[i])
v.sort()
now = 0
if len(o) == 26:
  print('None')
else:
  for i in range(26):
    if i >= len(t):
      print(v[i])
      break
    elif o[i] == v[i]:
      now += 1
    else:
      print(v[now])
      break

Measured memory_bytes: 3188
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>

#define int long long
#define CONTAINS(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
#define REMOVE(v,a) v.erase(remove(v.begin(), v.end(), a), v.end())
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
using namespace std;

int N;
int p[200000];

struct SegSt
{
public:
	int n;
	int index;
	SegSt() {}
	SegSt(int n, int index)
	{
		this->n = n;
		this->index = index;
	}
};

const int SEG_MAX = (1 << 18);
SegSt seg[2][SEG_MAX * 2];

void Set(int s, int index, SegSt st)
{
	int k = (SEG_MAX - 1) + index; //底
	seg[s][k] = st;
	while (true)
	{
		k = (k - 1) / 2;
		if (st.n < seg[s][k].n)
		{
			seg[s][k] = st;
		}
		if (k == 0) break;
	}
}

SegSt GetMin(int s, int a, int b, int k = 0, int l = 0, int r = SEG_MAX)
{
	if (l >= b || a >= r)
	{
		return SegSt(INT_MAX, INT_MAX);
	}

	if (a <= l && r <= b)
	{
		return seg[s][k];
	}
	else
	{
		SegSt ll = GetMin(s, a, b, k * 2 + 1, l, (l + r) / 2);
		SegSt rr = GetMin(s, a, b, k * 2 + 2, (l + r) / 2, r);
		if (ll.n < rr.n)
		{
			return ll;
		}
		else
		{
			return rr;
		}
	}
}

struct St
{
public:
	int l;
	int r;
	int min;
	St(int l, int r, int min)
	{
		this->l = l;
		this->r = r;
		this->min = min;
	}
	bool operator<(const St& st) const
	{
		return st.min < min;
	}
};

signed main()
{
	cin >> N;
	memset(seg, 1, sizeof(seg));
	REP(i, N)
	{
		cin >> p[i];
		Set(i % 2, i, SegSt(p[i], i));
	}

	priority_queue<St> q;
	q.push(St(0, N, GetMin(0, 0, N).n));

	list<int> ans;

	while (q.size() > 0)
	{
		St st = q.top();
		q.pop();
		int s = st.l % 2;
		SegSt seg_st1 = GetMin(s, st.l, st.r);
		int i = seg_st1.index;
		int ss = (s + 1) % 2;
		SegSt seg_st2 = GetMin(ss, i + 1, st.r);
		int j = seg_st2.index;
		if (i - st.l > 0)
		{
			q.push(St(st.l, i, GetMin(st.l % 2, st.l, i).n));
		}
		if (j - (i + 1) > 0)
		{
			q.push(St(i + 1, j, GetMin((i + 1) % 2, i + 1, j).n));
		}
		if (st.r - (j + 1) > 0)
		{
			q.push(St(j + 1, st.r, GetMin((j + 1) % 2, j + 1, st.r).n));
		}
		ans.push_back(seg_st1.n);
		ans.push_back(seg_st2.n);
	}

	for (int n : ans)
	{
		cout << n << " ";
	}
	cout << endl;
}

Measured memory_bytes: 26676
import java.util.*;

public class Main {
	public static void main(String[] arg) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int X = sc.nextInt();
		int ming = 1000;
		
		for(int i=0;i<N;i++) {
			int m = sc.nextInt();
			X -= m;
			if(m < ming) {
				ming = m;
			}
		}
		System.out.println(N+X/ming);
	}
}


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

#define BR "\n"
#define SP " "
#define SHOW(x) for(int i = 0; i < x.size(); i++) { cout << x[i] << SP; } cout << BR;
#define SHOW2(x) for(int j = 0; j < x.size(); j++) { SHOW(x[j]); } cout << BR;

int main() {
  ll N, M, Q;
  cin >> N >> M >> Q;

  vector<ll> L(M);
  vector<ll> R(M);
  vector<ll> p(Q);
  vector<ll> q(Q);
  vector<vector<ll>> board(N + 1, vector<ll>(N + 1, 0));

  for (int i = 0; i < M; i++) {
    cin >> L[i] >> R[i];
    board[L[i]][R[i]]++;
  }

  for (int j = 1; j <= N; j++) {
    for (int i = N; i > 0; i--) {
      board[i - 1][j] += board[i][j];
    }
  }
  for (int j = 1; j <= N; j++) {
    for (int i = 1; i <= N; i++) {
      board[j][i] += board[j][i - 1];
    }
  }

  for (int i = 0; i < Q; i++) {
    cin >> p[i] >> q[i];
    cout << board[p[i]][q[i]] << BR;
  }

  return 0;
}

Measured memory_bytes: 7552
#include <iostream>

using namespace std;
int n,s,m,x,i,fr[200005];
int main()
{
    cin>>n;
   for(i=1;i<n;i++)
   {
       cin>>x;
      fr[x]++;
   }
    for(i=1;i<=n;i++)
        cout<<fr[i]<<'\n';
    return 0;
}


Measured memory_bytes: 4380
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll h, w;
    cin >> h >> w;
    if( h == 1 || w == 1){
        cout << "1\n";
    }
    else{
        cout << (h*w + 1)/2 << "\n";
    }
    return 0;
}


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


Measured memory_bytes: 3088
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
using namespace std;
 
int main(){
  long long a, b, c;
  cin >> a >> b >> c;
  if(a + b + (2 * sqrtl(a *b)) < c){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

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

int main(){
  int n,m;
  cin >> n >> m;
  vector<P> p(m);
  rep(i,m) cin >> p.at(i).first >> p.at(i).second;
  rep(x,1000){
    int nx = x/10;       
    vector<int> d(1,x%10);
    while(nx){
      d.push_back(nx%10);
      nx /= 10;
    }
    reverse(d.begin(),d.end()); //数字を、桁ごとにアクセス可能な形にした。
    if( d.size() != n ) continue;
    
    bool ok = true;
    rep(i,m){
      if(d.at(p.at(i).first-1) != p.at(i).second) ok = false;
    }
    if( ok ){
      cout << x << endl;
      return 0;
    }
  }
  cout << -1 << endl;
  return 0;
}


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

#define ALL(obj) (obj).begin(),(obj).end()
#define SPEED cin.tie(0);ios::sync_with_stdio(false);

template<class T> using PQ = priority_queue<T>;
template<class T> using PQR = priority_queue<T,vector<T>,greater<T>>;

constexpr long long MOD = (long long)1e9 + 7;
constexpr long long MOD2 = 998244353;
constexpr long long HIGHINF = (long long)1e18;
constexpr long long LOWINF = (long long)1e15;
constexpr long double PI = 3.1415926535897932384626433L;

template <class T> vector<T> multivector(size_t N,T init){return vector<T>(N,init);}
template <class... T> auto multivector(size_t N,T... t){return vector<decltype(multivector(t...))>(N,multivector(t...));}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) {o << "{"; for (auto &x : obj) o << " {" << x.first << " : " << x.second << "}" << ","; o << " }"; return o;}
template <class T>ostream &operator<<(ostream &o, const set<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const multiset<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const vector<T>&obj) {o << "{"; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; o << "}"; return o;}
template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&obj) {o << "{" << obj.first << ", " << obj.second << "}"; return o;}
template <template <class tmp>  class T, class U> ostream &operator<<(ostream &o, const T<U> &obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr)o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
void print(void) {cout << endl;}
template <class Head> void print(Head&& head) {cout << head;print();}
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {cout << head << " ";print(forward<Tail>(tail)...);}
template <class T> void chmax(T& a, const T b){a=max(a,b);}
template <class T> void chmin(T& a, const T b){a=min(a,b);}
void YN(bool flg) {cout << (flg ? "YES" : "NO") << endl;}
void Yn(bool flg) {cout << (flg ? "Yes" : "No") << endl;}
void yn(bool flg) {cout << (flg ? "yes" : "no") << endl;}

int main() {
    int X,Y; cin >> X >> Y;
    vector<int> dp(401,0);
    dp[0]=1;
    for(int i = 0; i < X; ++i) {
        vector<int> tp(401,0);        
        for(int j = 0; j < 401; ++j) {
            if(j+2<401) tp[j+2] |= dp[j];
            if(j+4<401) tp[j+4] |= dp[j];
        }
        dp=tp;
    }    
    Yn(dp[Y]);
    return 0;
}


Measured memory_bytes: 3640
N,M = map(int,input().split())
ls_a = []
ls_b = []
for p in range(M):
    L,R  = map(int,input().split())
    ls_a.append(L)
    ls_b.append(R)
ans = min(ls_b)-max(ls_a)+1
if ans < 0:
    print(0)
else:
    print(ans)

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

int main(void){
  int N,K;
  char str[100],*p;
  
  fgets(str,sizeof(str),stdin);
  p=strtok(str," \n");
  N=atoi(p);
  p=strtok(NULL," \n");
  K=atoi(p);
  
  if(K==1){
    printf("0\n");
    return 0;
  }
  
  printf("%d\n",N-K);
  
  
  return 0;
}

Measured memory_bytes: 128
// Knight
// 所要時間 分
// まじでわからん 2回目だけど解けなかった
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define REP(i, d, n) for(int i=(d); i<(n); ++i)
#define all(v) v.begin(), v.end()
using ll = long long;
using P = pair<int, int>;

const ll mod = 1000000007;

ll fact(ll n){
    ll ret = 1;
    for(ll i=2; i<=n; ++i){
        ret *= i;
        ret %= mod;
    }
    return ret;
}

ll mod_inv(ll a){
    ll b = mod, u = 1, v = 0;
    while(b){
        ll t = a / b;
        a -= t * b;
        swap(a, b);
        u -= t * v;
        swap(u, v);
    }
    u %= mod;
    if (u < 0){
        u += mod;
    }
    return u;
}

int main() {

    int x, y;
    cin >> x >> y;

    if((x + y) % 3 != 0){
        cout << 0 << endl;
        return 0;
    }

    ll n = (2*y-x) / 3;
    ll m = (2*x-y) / 3;
    if(n < 0 || m < 0){
        cout << 0 << endl;
        return 0;
    }

    ll ans = fact(m+n);
    ll a = fact(m);
    ll b = fact(n);
    ans *= mod_inv(a*b);

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

Measured memory_bytes: 256
#include<iostream>
#include<string.h>
using namespace std;
int const maxn = 1e+3 + 10;
char a[maxn] = { '\n' };
int main()
{
	cin >> a;
	if (a[strlen(a) - 1] != 's') cout << a << 's' << endl;
	else cout << a << 'e'<<'s' << endl;
	return 0;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

int main() {
	int n;
	cin >> n;
	vector<int> a(n);
	rep(i, n) cin >> a[i];

	int ans = 0;
	rep(i, n) {
		while (a[i] % 2 == 0) {
			a[i] /= 2;
			ans++;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
/**
 * @brief  : c++ code for AtCoder
 * @author : rk222
 * @created: 2019.07.21 20:55:19
 */

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

typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
typedef pair<int, P> P1;

#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define rep(i, x) for (int i = 0; i < x; i++)
#define rep1(i, x) for (int i = 1; i <= x; i++)
#define rrep(i, x) for (int i = x - 1; i >= 0; i--)
#define rrep1(i, x) for (int i = x; i > 0; i--)
#define sor(v) sort(v.begin(), v.end())
#define rev(s) reverse(s.begin(), s.end())
#define lb(vec, a) lower_bound(vec.begin(), vec.end(), a)
#define ub(vec, a) upper_bound(vec.begin(), vec.end(), a)
#define uniq(vec) vec.erase(unique(vec.begin(), vec.end()), vec.end())
#define mp1(a, b, c) P1(a, P(b, c))

#define disp(x) cout << #x << ": " << x << endl
#define disp_vec(v)                                                                           \
    cout << #v << ":";                                                                        \
    rep(i, v.size()) cout << " " << v[i];                                                     \
    cout << endl

const int INF = 100000000;
const int M = 100000000;
const int dir_4[4][2] = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}};
const int dir_8[8][2] = {{1, 0}, {1, 1}, {0, 1}, {-1, 1}, {-1, 0}, {-1, -1}, {0, -1}, {1, -1}};

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

int main() {
    ll s;
    scanf("%lld", &s);
    ll l = ((ll)sqrt(s - 1LL)) + 1LL;
    // if (s >= 90000000000000000) {
    //     l--;
    // }
    ll n = l * l - s;
    // printf("%lld %lld %lld\n", n, l, s);
    if (s == 1LL) {
        printf("0 0 1 0 0 1\n");
        return 0;
    }
    if (s == 1000000000000000000LL) {
        printf("0 0 1000000000 0  0 1000000000\n");
        return 0;
    }
baaaa:
    ll a = 0LL;
    ll b;
    ll sqn = sqrt(n);
    while (1) {
        if (a > l || a > sqn) {
            break;
        }
        if (a == 0) {
            if (n == 0) {
                b = 0;
                break;
            } else {
                a++;
                continue;
            }
        }

        if (n % a == 0 && n / a <= l) {
            b = n / a;
            break;
        } else {
            a++;
        }
        // printf("%lld\n", a);
    }
    if (l - a < 0 || l - b < 0) {
        l++;
        n = l * l - s;
        goto baaaa;
    }

    printf("%lld %lld %lld %lld %lld %lld\n", l - a, 0LL, 0LL, l - b, l, l);
    // printf("%lld\n", 2LL * l * l - l * (a + b) - (l - a) * (l - b));

    /* --------------------------------- */
    return 0;
}

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

int main(void) {
    long long int n,k,i;
    long long int ans=0,big,small;
    (void)scanf("%lld %lld",&n,&k);
    for(i=k;i<=n+1;i++){
        big=(i*(2*n-i+1))/2;
        small=(i*(i-1))/2;
        ans+=((big-small+1)%1000000007);
        //ans+=(big-small+1);
    }
    ans=ans%1000000007;
    printf("%lld",ans);
    return 0;
}

Measured memory_bytes: 1732
#include <cstdio>
#include <algorithm>
#include <stack>
#include <queue>
#include <deque>
#include <vector>
#include <string>
#include <string.h>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <map>
#include <set>
#include <iostream>
#include <sstream>
#include <numeric>
#include <cctype>
#include <bitset>
#include <cassert>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const int MX = 100005, INF = 1001001001;
const ll LINF = 1e18;
const double eps = 1e-10;

string a, b;

int main()
{
  cin >> a >> b;
  if (a.size() > b.size()) puts("GREATER");
  else if (a.size() < b.size()) puts("LESS");
  else{
    rep(i, a.size()){
      if(a > b){
        cout << "GREATER" << endl;
        return 0;
      }
      if(a < b){
        cout << "LESS" << endl;
        return 0;
      }
    }
    puts("EQUAL");
  }
}


Measured memory_bytes: 256
/*****Here we go again!******/

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

#define pi 3.1415926535
#define endl "\n"
#define yes cout << "YES\n"
#define no cout << "NO\n"
#define ll long long
#define llu unsigned long long
#define pb push_back
#define mp make_pair
#define sz(x) (int)x.size()
#define tc int test_case; cin >> test_case; while(test_case--)
#define f(i,a,n) for(int i = a ; i < n ; i++)
#define rf(i,n,a) for(int i = n-1 ; i >= a ; i--)
#define F first
#define S second
#define all(c) (c).begin(),(c).end()
#define get(a,n) f(i,0,n) cin >> a[i];
#define show(a,n) f(i,0,n) cout << a[i] << " "; cout << endl;
#define fast ios:: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define trace(x) cerr << '>' << #x << ':' << (x) << "\n"
#define trace2(x,y) cerr<< '>' << #x << ':' << (x) << " | " << #y << ':' << (y) << "\n"
#define trace3(a,b,c) cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<"\n"
#define trace4(a,b,c,d) cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<", "<<#d<<"="<<(d)<<"\n"

typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<pii,int> ppi;
typedef vector<pii> vpi;
typedef map<int,int> mii;
typedef map<ll,ll> mll;

const int inf = 1e9;
const ll inf64 = 1e18;
const int mod = inf + 7;
const int N = 1e5 + 10;

int main()
{
    fast;
    int n, w;
    cin >> n >> w;
    vi wt(n), val(n);
    f(i,0,n)
        cin >> wt[i] >> val[i];
    ll dp[n+1][w+1];

    f(i,0,n+1)
        dp[i][0] = 0;
    f(i,0,w+1)
        dp[0][i] = 0;

    f(i,1,n+1)
    {
        f(j,1,w+1)
        {
            if(wt[i-1] <= j)
                dp[i][j] = max(val[i-1] + dp[i-1][j-wt[i-1]], dp[i-1][j]);
            else
                dp[i][j] = dp[i-1][j];
        }
    }
    cout << dp[n][w];
}


Measured memory_bytes: 82556
#include <cstdio>

typedef long long LL;

const int MAXN = 2000;
int n, x, a[MAXN + 5], mn[MAXN + 5];

template<typename Tp>
inline void chkmin ( Tp& a, const Tp b ) { if ( b < a ) a = b; }

int main () {
	scanf ( "%d %d", &n, &x );
	for ( int i = 1; i <= n; ++ i ) scanf ( "%d", &a[i] ), mn[i] = a[i];
	LL ans = 1ll << 60;
	for ( int k = 0; k < n; ++ k ) {
		LL now = 1ll * k * x;
		for ( int i = 1; i <= n; ++ i ) {
			chkmin ( mn[i], a[( i + k - 1 ) % n + 1] );
			now += mn[i];
		}
		chkmin ( ans, now );
	}
	printf ( "%lld\n", ans );
	return 0;
}

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

using namespace std;

const int N = 1e5 + 5;

int a[N], n;

long long solve(long long t) {
  for (int i = 0; i < n; i++) {
    t = t / a[i] * a[i];
  }
  return t;
}  

int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", a + i);
  }
  long long l = 2, r = 1e18;
  while (l < r) {
    long long mid = (l + r) >> 1;
    if (solve(mid) >= 2) {
      r = mid;
    } else {
      l = mid + 1;
    }
  }
  long long lowest = l;
  
  l = 2, r = 1e18;
  while (l < r) {
    long long mid = (l + r + 1) >> 1;
    if (solve(mid) <= 2) {
      l = mid;
    } else {
      r = mid - 1;
    }
  }
  long long biggest = l;
  if (solve(l) != 2) {
    puts("-1");
  } else {
    printf("%lld %lld\n", lowest, biggest);
  }
  return 0;
}


Measured memory_bytes: 640
#include<stdio.h>
#define N 8
#define FREE -1
#define NOT_FREE 1
#define true 1
#define false 0

int row[N],col[N],dpos[2*N - 1],dneg[2*N - 1];

int X[N][N];

void initialize(){
  int i;
  for(i = 0 ; i < N ; i++){
    row[i] = FREE;
    col[i] = FREE;
  }
  for(i = 0 ; i < 2*N - 1 ; i++){
    dpos[i] = FREE;
    dneg[i] = FREE;
  }
}

void printBoard(){
  int i,j;
  for(i = 0 ; i < N ; i++){
    for(j = 0 ; j < N ; j++){
      if(X[i][j]){
	if(row[i] != j)return;
      }
    }
  }
  for(i = 0 ; i < N ; i++){
    for(j = 0 ; j < N ; j++){
      printf("%c",row[i] == j ? 'Q' : '.');
    }
    printf("\n");
  }
}

void recursive(int i){
  int j;
  if(i == N){
    printBoard();
    return;
  }
  for(j = 0 ; j < N ; j++){
    if(NOT_FREE == col[j] || NOT_FREE == dpos[i + j] || NOT_FREE == dneg[i - j + N - 1])continue;
    row[i] = j;
    col[j] = dpos[i + j] = dneg[i - j + N - 1] = NOT_FREE;
    recursive(i + 1);
    row[i] = col[j] = dpos[i + j] = dneg[i - j + N - 1] = FREE;
  }
}

int main(){
  int i,j,k,r,c;
  initialize();

  for(i = 0 ; i < N ; i++){
    for(j = 0 ; j < N ; j++){
      X[i][j] = false;
    }
  }
  scanf("%d",&k);
  for(i = 0 ; i < k ; i++){
    scanf("%d %d",&r,&c);
    X[r][c] = true;
  }
  recursive(0);
  return 0;
}



Measured memory_bytes: 2112
#include<stdio.h>
int main (){
int A,B,priya,purna,nadia;
scanf("%d %d", &A,&B);
priya=A+B;
purna=A-B;
nadia=A*B;
if (priya>=purna&&priya>=nadia)
    printf("%d\n" , priya);
else if(purna>=nadia && purna>=priya)
    printf("%d\n" , purna);
else if(nadia>=priya && nadia>=purna)
    printf("%d\n" , nadia);
return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
namespace mp = boost::multiprecision;

int main(){
	int n = 1;
	cin >> n;
	cout << n*n;

	return 0;
}

Measured memory_bytes: 888
#include<iostream>
#include<vector>
#include <cmath>
#include <map>
#include <algorithm>
using namespace std;
int main(void){
    int N ,M;
    cin >> N >>M;
    if(N==M){
        cout << "Yes"<<endl;
    }else{
        cout<< "No" <<endl;
    }
    return 0;
}

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

using namespace std;

int main(){
    int n;
    long long a;
    long long min = 1000000;
    long long max = -1000000;
    long long sum = 0;
    
    cin >> n;
     for ( int i = 0; i < n; i++ ){
      cin >> a;
      if ( a < min ) min = a;
      if ( a > max ) max = a;
      sum += a;
     }
    cout << min << " " << max << " " << sum << endl;  
   
  return 0;
}


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


//
int main(void){
	//FILE* fp_in = freopen("data.txt", "r", stdin);

	while(1){
		vector<char> conv_from, conv_to;
		int n,m;
		char tmp;
		//変換表を取得する
		cin >> n;
		if(n == 0) break;
		for(int i = 0; i < n; i++) {
			cin >> tmp;
			conv_from.push_back(tmp);
			cin >> tmp;
			conv_to.push_back(tmp);
		}
		//文字列を取得する
		cin >> m;
		for(int i = 0; i < m; i++ ){
			cin >> tmp;
			for(int j = 0; j < n; j++){
				if(tmp == conv_from.at(j)) {
					tmp = conv_to.at(j);
					break;
				}
			}
			cout << tmp;
		}
		cout << endl;
	}

	//while(1){}
	return 0;
}

Measured memory_bytes: 1208