akhauriyash/Code-Regression huggingface dataset:
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 30;
const int MOD = 1e9 + 7;

const int N = 1e5 + 10;
vector<int> a[N];
int cnt[N];

int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; ++i) {
    int x;
    scanf("%d", &x);
    int u = x % m;
    a[u].push_back(x);
  }
  for (int i = 0; i < m; ++i) {
    sort(a[i].begin(), a[i].end());
    for (int j = 0, k; j < a[i].size(); j = k) {
      for (k = j + 1; k < a[i].size() && a[i][j] == a[i][k]; ++k);
      cnt[i] += (k - j) / 2;
    }
  }
  int ret = 0;
  for (int i = 0; i * 2 <= m; ++i) {
    int j = m - i;
    if (i == 0 || i == j) {
      ret += a[i].size() / 2;
    } else {
      int cur = min(a[i].size(), a[j].size());
      ret += cur;
      ret += min(cnt[i], ((int)a[i].size() - cur) / 2);
      ret += min(cnt[j], ((int)a[j].size() - cur) / 2);
    }
  }
  printf("%d\n", ret);
  return 0;
}


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

int main() {
  vector<int>data(1e5+1,0);
  int n;
  cin >> n;
  rep(i,n){
    int a;
    cin >> a;
    if(a == 0){
      data[0]++;
      data[1]++;
    }
    else if(a == 1e5){
      data[1e5]++;
      data[1e5-1]++;
    }
    else{
      data[a]++;
      data[a+1]++;
      data[a-1]++;
    }
  }
  sort(data.begin(),data.end());
  reverse(data.begin(),data.end());
  cout << data[0] << endl;
}

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

vector<int> KMP(const string& S) {
	int N = S.size();
	vector<int> A(N + 1);
	A[0] = -1;
	for (int i = 0, j = -1; i < N; i++) {
		while (j >= 0 && S[i] != S[j]) {
			j = A[j];
		}
		j++;
		A[i + 1] = (i + 1 == N ? '*' : S[i + 1]) == (j == N ? '*' : S[j]) ? A[j] : j;
	}
	return A;
}

vector<int> StringSearch(const string& S, const string& T) {
	auto A = KMP(T);
	int N = T.size();
	vector<int> res;
	for (int i = 0, j = 0; i < (int)S.size(); i++) {
		while (j >= 0 && S[i] != T[j]) {
			j = A[j];
		}
		j++;
		if (j == N) {
			res.push_back(i - N + 1);
			j = A[j];
		}
	}
	return res;
}

int main()
{
	cin.sync_with_stdio(false);
	string T, P;
	cin >> T >> P;
	for (auto ans : StringSearch(T, P)) {
		printf("%d\n", ans);
	}
	return 0;
}

Measured memory_bytes: 3276
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <iostream>
#include <stdlib.h>
#include <iomanip>

using namespace std;

int main()
{
  int a,b,c;
  cin >> a >> b >> c;
  if(a <= c && c <= b)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
constexpr ll mod = 1e9 + 7;
#define endl '\n'
 
int main() {
  ios::sync_with_stdio(0); cin.tie(0);
 
  ll N,M;
  cin >> N >> M;
  vector<vector<int>> adj(N);
  for (int i = 0; i < M; ++i) {
    int u,v;
    cin >> u >> v;
    --u,--v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  vector<bool> visited(N);
  vector<int> ans(N);
  visited[0] = true;
  queue<array<ll,2>> q;
  q.push({0,-1});
  while (q.size()) {
    for (int iq = q.size()-1; iq >= 0; --iq) {
      auto [from,parent] = q.front(); q.pop();
      for (auto to : adj[from]) {
        if (to == parent) continue;
        if (visited[to]) continue;
        visited[to] = true;
        q.push({to, from});
        ans[to] = from;
      }
    }
  }
  if (accumulate(visited.begin(), visited.end(),0LL) != N) {
    cout << "No" << endl;
    return 0;
  }
  cout << "Yes" << endl;
  for (int i = 1; i < N; ++i) {
    cout << ans[i]+1 << endl;
  }
  

}


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

#define NDEBUG
#ifdef DEBUG
#include "../cout11.h"
#undef NDEBUG
#endif
#include <cassert>

typedef long long ll;
typedef long double Double;
typedef unsigned long long ull;
typedef pair<int,int> ii;
typedef pair<ll,ll> llll;
typedef pair<double,double> dd;

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ii> vii;
typedef vector<vector<ii>> vvii;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<long double> vD;

#define sz(a)  int((a).size())
#define pb  push_back
#define FOR(var,from,to) for(int var=(from);var<=(to);++var)
#define rep(var,n)  for(int var=0;var<(n);++var)
#define rep1(var,n)  for(int var=1;var<=(n);++var)
#define repC2(vari,varj,n)  for(int vari=0;vari<(n)-1;++vari)for(int varj=vari+1;varj<(n);++varj)
#define ALL(c)  (c).begin(),(c).end()
#define RALL(c)  (c).rbegin(),(c).rend()
#define tr(i,c)  for(auto i=(c).begin(); i!=(c).end(); ++i)
#define found(s,e)  ((s).find(e)!=(s).end())
#define mset(arr,val)  memset(arr,val,sizeof(arr))
#define mid(x,y) ((x)+((y)-(x))/2)
#define IN(x,a,b) ((a)<=(x)&&(x)<=(b))

ll gcd(ll a, ll b) { while(a) swap(a, b%=a); return b; }

const ll MOD=1000000007LL;

ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }
// ll comb(ll n, ll k) { ll v=1; for(ll i=1; i<=k; i++) v = DIV(MUL(v, n-i+1),i); return v; }
//

#define INTSPACE 12
char _buf[INTSPACE*1000000 + 3];

int loadint() {
    if (fgets(_buf, INTSPACE+3, stdin)==NULL) return 0;
    return atoi(_buf);
}

int loadvec(vector<int>& v, int N=-1) {
    if (N == -1) {
        N = loadint();
        if (N==0) return 0;
    }
    int bufsize = INTSPACE*N + 3;
    if (fgets(_buf, bufsize, stdin)==NULL) return 0;
    v.resize(N);

    int i=0;
    bool last = false;
    for (char *p=&_buf[0]; ;) {
        char *q = p;
        while (*q > ' ') ++q;
        if (*q == 0x0D || *q == 0x0A) last = true;
        *q = 0;
        v[i++] = atoi(p);
        if (last || i == N) break;
        p = q+1;
    }
    // assert(i <= N);
    return i;
}
void read_cr() {
    fgets(_buf, 256, stdin);
}

void solve(int N, vi& a) {
    vi st(9, 0);
    rep(i,N){
        if (a[i] < 400) st[0]++;
        else if (a[i] < 800) st[1]++;
        else if (a[i] < 1200) st[2]++;
        else if (a[i] < 1600) st[3]++;
        else if (a[i] < 2000) st[4]++;
        else if (a[i] < 2400) st[5]++;
        else if (a[i] < 2800) st[6]++;
        else if (a[i] < 3200) st[7]++;
        else st[8]++;
    }

    int minc = 0;
    rep(i,8) if (st[i]) ++minc;
    int maxc = minc;
    if (st[8]) minc = max(1, minc);
    if (st[8]) maxc += st[8];

    cout << minc << " " << maxc << endl;
}

int main() {
    vi a;
    int N = loadvec(a);
    solve(N,a);
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
ll const INF = 1LL << 60;

int main() {
  ll N;
  map<int, int> m;
  cin >> N;
  ll x;
  for (int i = 0; i < N; i++) {
    cin >> x;
    m[x % 2]++;
  }
  string ans = (m[1] % 2 == 0) ? "YES" : "NO";
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
#include <boost/functional/hash.hpp>

#define debug 0
#define esc(ret) cout << (ret) << endl,quick_exit(0)
#define fcout(d) cout << fixed << setprecision(d)
#define repU(i,s,t) for(int i = (int)(s); i <= (int)(t); ++i)
#define repD(i,s,t) for(int i = (int)(s); i >= (int)(t); --i)
#define rep(i,n) repU(i,0,(n) - 1)
#define rep1(i,n) repU(i,1,(n))
#define all(v) begin(v),end(v)
#define vct vector
#define prique priority_queue
#define l_bnd lower_bound
#define u_bnd upper_bound
#define puf push_front
#define pub push_back
#define pof pop_front
#define pob pop_back
#define mkp make_pair
#define mkt make_tuple
#define ins insert
#define emp emplace
#define era erase
#define fir first
#define sec second

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef pair<int,int> pii;
typedef pair<db,int> pdi;
typedef tuple<int,int,int> tiii;

const int dir[][2] = { {1,0},{0,1},{-1,0},{0,-1},{1,1},{-1,1},{-1,-1},{1,-1} };
const int mod = 1e9 + 7;
const int inf32 = (1 << 30) - 1;
const ll inf64 = (1LL << 62) - 1;

template <class T, class U> T qceil(T x, U y) { return x > 0 ? (x - 1) / y + 1 : x / y; }
template <class T, class U> bool parity(T x, U y) { return x & 1 ^ y & 1 ^ 1; }
template <class T, class U> bool chmax(T &m, U x) { if(m < x) { m = x; return 1; } return 0; }
template <class T, class U> bool chmin(T &m, U x) { if(m > x) { m = x; return 1; } return 0; }
template <class T> bool cmprs(T &v) {
    T tmp = v;
    sort(all(tmp));
    tmp.erase(unique(all(tmp)),end(tmp));
    for(auto it = begin(v); it != end(v); ++it) *it = l_bnd(all(tmp),*it) - begin(tmp) + 1;
    return v.size() > tmp.size();
}

int n,k;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n>> k;
    ll m;
    if(k & 1){
        m = n/k;
        esc(m * m * m);
    }
    ll mm = n/k;
    ll r = n % k;
    if(r >= k/2) m = mm +1;else m = mm;
    esc(m * m * m + mm * mm * mm);
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define int long long
using namespace std;

signed main() {
    int N;
    cin >> N;

    int dp[N + 1][4][4][4] = {};
    dp[0][3][3][3] = 1;

    const int mod = 1e9 + 7;

    for (int len = 0; len < N; len++) {
        for (int i = 0; i < 4; i++) {
            for (int j = 0; j < 4; j++) {
                for (int k = 0; k < 4; k++) {
                    if (!dp[len][i][j][k]) continue;

                    for (int a = 0; a < 4; a++) {
                        if (j == 0 && i == 1 && a == 2) continue;
                        if (j == 1 && i == 0 && a == 2) continue;
                        if (j == 0 && i == 2 && a == 1) continue;
                        if (k == 0 && i == 1 && a == 2) continue;
                        if (k == 0 && j == 1 && a == 2) continue;

                        dp[len + 1][a][i][j] += dp[len][i][j][k];
                        dp[len + 1][a][i][j] %= mod;
                    }
                }
            }
        }
    }

    int ans = 0;
    for (int i = 0; i < 4; i++) {
        for (int j = 0; j < 4; j++) {
            for (int k = 0; k < 4; k++) {
                ans += dp[N][i][j][k];
                ans %= mod;
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
n = int(input())
k = 10
ans = 0


if n%2!=0:
	print(0)
	exit()

def k_change():
	global k
	k = k*5


def func(n):
	global ans,k
	#print(k)
	if n < k:
		print(ans)
		exit()
	ans += n//k
	k_change()
	func(n)

func(n)

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

int main(){
	stack<int> s;
	int a;
	while(cin>>a){
		if(a!=0){
			s.push(a);
		}else{
			cout<<s.top()<<endl;
			s.pop();
		}
	}
	return 0;
}

Measured memory_bytes: 3076
#![allow(unused_mut)]
#![allow(non_snake_case)]
#![allow(unused_imports)]
use std::collections::HashSet;
use std::collections::HashMap;
use std::collections::BTreeSet;
use std::cmp::{max, min};
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

// https://atcoder.jp/contests/agc033/submissions/5257271
fn main() {
    input! {
        h: usize,
        w: usize,
        a: [chars; h],
    }
    let mut tbl=vec![vec![None; w]; h];
    let mut q = std::collections::VecDeque::new();
    for i in 0..h {
        for j in 0..w {
            if a[i][j] == '#' {
                q.push_back((i, j, 0));
            }
        }
    }
    while let Some((i, j, dep)) = q.pop_front() {
        if tbl[i][j].is_some() {
        } else {
            tbl[i][j] = Some(dep);
            for &(di, dj) in [(1, 0), (-1, 0), (0, 1), (0, -1)].iter() {
                let ci = i as i64 + di;
                let cj = j as i64 + dj;
                if !(ci >= 0 && ci < h as _ && cj >= 0 && cj < w as _) {
                } else {
                    let ci = ci as usize;
                    let cj = cj as usize;
                    q.push_back((ci, cj, dep + 1));
                }
            }
        }
    }
    let mut ans = 0;
    for row in tbl {
        for cell in row {
            if let Some(d) = cell {
                ans = std::cmp::max(ans, d);
            }
        }
    }
    println!("{}", ans);
}

Measured memory_bytes: 115252
#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
typedef long double ld;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define mod 1000000007
#define pii pair<ll,ll>
#define inf 1000000000000000000
#define bpc(x) __builtin_popcountll(x)
#define autoit(x,it) for(auto it = x.begin(); it != x.end(); it++)
#define rep(n) for(ll i = 0; i < n; i++)
#define repi(i,n) for(ll i = 0; i < n; i++)

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 

#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 

using namespace std;
mt19937_64 mt(chrono::steady_clock::now().time_since_epoch().count());

ll powa(ll a, ll b, ll c)
{
    a%=c;
    if(a<0)
	a+=c;
    ll res = 1;
    while(b>0)
    {
        if(b&1)
            res*=a, res%=c;
        a*=a, a%=c;
        b>>=1;
    }
    return res;
}
int main()
{
  FAST/**/
   
   ll n;
   cin>>n;
   
   ll arr[n];
   ll sum = 0;
   rep(n)
        cin>>arr[i], sum+=arr[i], sum%=mod;
   
   sum = (sum*sum)%mod;
   
   rep(n)
       sum = (sum-((arr[i]*arr[i])%mod)+mod)%mod;
   sum*=powa(2,mod-2,mod);
   sum%=mod;
   cout<<sum;
   
   return 0;        
}  

  
          
   

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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define vec vector

int main(void)
{
	int m, n;
	cin >> n >> m;
	vec<string> a(n), b(m);
	rep(i, n) cin >> a[i];
	rep(i, m) cin >> b[i];

	rep(i, n - m + 1) rep(j, n - m + 1) {
		int flag = 1;
		rep(x, m) rep(y, m) {
			if (a[i + x][j + y] != b[x][y]) {
				flag = 0;
				break;
			}
		}
		if (flag) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
H,N = map(int,input().split())
magic = [list(map(int,input().split())) for i in range(N)]

INF = 10**10

dp = [INF for i in range(H+1)]
dp[0] = 0

for i in range(1,H+1):
    for j in range(N):
        if magic[j][0] > i:
            dp[i] = min(dp[i],magic[j][1])
        else:
            dp[i] = min(dp[i-magic[j][0]]+magic[j][1],dp[i])
print(dp[H])


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

using namespace std;
using ll = long long;

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0), cout.tie(0);
	int n, k;
	cin >> n >> k;
	vector<int> a(n);
	for (auto &el : a) {
		cin >> el;
	}
	sort(a.begin(), a.end());
	int ans = 0;
	for (int i = 0; i < k; i++) {
		ans += a[i];
	}
	cout << ans;
}

Measured memory_bytes: 3600
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <numeric>
#include <queue>
#include <stack>
#include <map> 
#include <set>
#include <string>
#include <functional>
#include <list>
#include <random>
#include <time.h>
#include <iomanip>
#include <assert.h>
#include <numeric>
#define int long long
#define ll long long
#define double long double
#define mod 1000000007
#define MAXN (int)1e+5 * 2+1
#define LL_MAX 9223372036854775807	//ない環境用
#define LL_HALFMAX 9223372036854775807 / 2	//ない環境用
#define MIN -(9223372036854775807 / 2)
#define INF 9223372036854775807 / 2
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define mp make_pair


using namespace std;

std::mt19937 mt((int)time(0));

int dx[4] = { 0, 1, 0, -1 }; // x軸方向への変位
int dy[4] = { 1, 0, -1, 0 }; // y軸方向への変位

using Weight = int;
using Flow = int;
struct Edge {
	int src, dst;
	Weight weight;
	Flow cap;
	Edge() : src(0), dst(0), weight(0) {}
	Edge(int s, int d, Weight w) : src(s), dst(d), weight(w) {}
};
using Edges = std::vector<Edge>;
using Graph = std::vector<Edges>;
using Array = std::vector<Weight>;
using Matrix = std::vector<Array>;

void add_edge(Graph &g, int a, int b, Weight w = 1) {
	g[a].emplace_back(a, b, w);
	g[b].emplace_back(b, a, w);
}
void add_arc(Graph &g, int a, int b, Weight w = 1) { g[a].emplace_back(a, b, w); }

int zi[5];

signed main() {
	int K, A, B;
	cin >> K >> A >> B;
	if (B - A <= 1) {
		cout << 1 + K << "\n";
		return 0;
	}

	//A枚になるまで叩く
	K -= (A - 1);
	if (K <= 0) {
		cout << 1 + K << "\n";
		return 0;
	}
	int ans = A;
	if (K % 2 == 1) {
		K--;
		ans++;
	}
	ans += (K / 2) * (B - A);
	cout << ans << "\n";



	return 0;
}

Measured memory_bytes: 256
import java.util.*; 

class Main{
public static void main(String[] args){
	Scanner sc=new Scanner(System.in);
     	String s=sc.next();
		String[] a=s.split("");
  		int ans=0;
  		int n=s.length();

		for(int c=0;c<n/2;c++){
    		if(!a[c].equals(a[n-c-1])){
              ans=1;
            }
    	}
  		for(int c=0;c<n/2/2;c++){
    		if(!a[c].equals(a[n/2-1-c])){
              ans=1;
            }
    	}
    for(int c=n/2+1;c<n;c++){
    		if(!a[c].equals(a[n-c-1])){
              ans=1;
            }
    	}
  
 	if(ans==0){
    		System.out.println("Yes");
    	}else{
     		System.out.println("No");
   	 }
 

    	
    }
}


Measured memory_bytes: 22100
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtTest.ABC_178
{
    class C
    {
        static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(OpenStandardOutput()) { AutoFlush = false };
            SetOut(sw);

            Method(args);

            Out.Flush();
        }

        static void Method(string[] args)
        {
            int n = ReadInt();

            long mask = 1000000000 + 7;
            long all = 1;
            long no0or9 = 1;
            long no0and9 = 1;
            for(int i = 0; i < n; i++)
            {
                all *= 10;
                all %= mask;
                no0or9 *= 9;
                no0or9 %= mask;
                no0and9 *= 8;
                no0and9 %= mask;
            }

            long res = all + (mask - no0or9) * 2 + no0and9;
            res %= mask;
            WriteLine(res);
        }

        private static string Read() { return ReadLine(); }
        private static char[] ReadChars() { return Array.ConvertAll(Read().Split(), a => a[0]); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 27460
#include <cstdio>
#include <string>
#include <cmath>
#include <string>
#include <algorithm>
#include <iostream>
#include <map>
#include <vector>
#include <iomanip>
using namespace std;
#define rep(i, a, n) for (int i=a;i<n;++i)
#define repeq(i, a, n) for(int i=a;i<=n;++i)
#define per(i, a, n) for (int i=n-1; i>=a;--i)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
typedef long long ll;

// C - Linear Approximation
ll ans = 0;
int main(){
    ll N;
    cin >> N;

    ll A[200100];
    vector<ll> B;

    rep(i, 0, N){
        cin >> A[i];
        B.push_back(A[i] - (i+1));
    }
    sort(all(B));

    ll b = B[N/2];
    rep(i, 0, N){
        ans += abs(B[i] - b);
    }

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




Measured memory_bytes: 3444
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>

using namespace std;

const int N = 200;

int n, p, a[N];
long long d[N][N];

int main() {

	scanf("%d %d", &n, &p);

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

	memset(d, 0, sizeof d);

	d[0][0] = 1;

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < 2; j++) {
			d[i + 1][j] += d[i][j];
			d[i + 1][j ^ a[i]] += d[i][j];
		}
	}

	printf("%lld\n", d[n][p]);

	return 0;

}

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

using namespace std;

#define eb emplace_back
#define ii pair<int, int>
#define OK (cerr << "OK" << endl)
#define debug(x) cerr << #x " = " << (x) << endl
#define ff first
#define ss second
#define int long long
#define tt tuple<int, int, int>
#define all(x) x.begin(), x.end()
#define Matrix vector<vector<int>>
#define Mat(n, m, v) vector<vector<int>>(n, vector<int>(m, v))
#define endl '\n'

constexpr int INF = 2e18;
constexpr int MOD = 1e9 + 7;
constexpr int MAXN = 2e5 + 3;

// int dp[100][10000];
vector<int> arr;

// int f(int idx, int s /*, int d*/) {

//   if (idx == arr.size())
//     return 0;

//   if (dp.count(ii(idx, s /*, d*/)))
//     return dp[ii(idx, s /*, d*/)];

//   int &ret = dp[idx][s];
//   if(~ret)
//     return ret;

//   // last
//   ret = s * arr[idx];

//   // buy here
//   ret = arr[idx] / s;
//   for(int i = idx + 1; i < n; ++i) {

//   }

//   // buy all
//   ret = f(idx + 1, s + d / arr[idx] /*, d % arr[idx]*/);

//   // sell all
//   ret = max(ret, f(idx + 1, 0 /*, d + s * arr[idx]*/));

//   // do nothing
//   ret = max(ret, f(idx + 1, s /*, d*/));

//   return ret;
// }

// #define MULTIPLE_TEST_CASES
void solve() {
  int n;
  cin >> n;

  arr.resize(n);
  for (int &x : arr)
    cin >> x;

  arr.eb(-INF);
  int ans = 1000;
  for (int j = 0; j < n; ++j) {
    int cur = 1000;
    int s = 0;
    for (int i = j; i < n; ++i) {
      if (arr[i + 1] < arr[i]) {
        // sell
        cur += s * arr[i];
        s = 0;
      } else {
        // buy
        s += cur / arr[i];
        cur = cur % arr[i];
      }
      ans = max(ans, cur);
    }
  }

  cout << ans << endl;
}

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

  int t = 1;
#ifdef MULTIPLE_TEST_CASES
  cin >> t;
#endif
  while (t--)
    solve();
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using std::vector;
using std::pair;
using pii = pair<int, int>;


std::string str;
vector<int> G[30];
int d[200003];

int go(int idx) {
	if (idx == str.size()) return 1;
	if (idx > str.size()) return 0;
	int &ret = d[idx];
	if (ret != -1) return ret;
	ret = 123456789;

	for (int i = 0; i < 26; i++) {
		int pos = *lower_bound(G[i].begin(), G[i].end(), idx);
		ret = std::min(ret, go(pos + 1) + 1);
	}
	return ret;
}
void trace(int idx) {
	if (idx == str.size()) {
		return;
	}
	if (idx > str.size()) return;

	for (int i = 0; i < 26; i++) {
		int pos = *lower_bound(G[i].begin(), G[i].end(), idx);
		if (go(idx) == go(pos + 1) + 1) {
			printf("%c", i + 'a');
			trace(pos + 1);
			return;
		}
	}
}
int main() {
	memset(d, -1, sizeof(d));
	std::cin >> str;
	
	for (int i = 0; i < str.size(); i++) 
		G[str[i] - 'a'].push_back(i);
	
	for (int i = 0; i < 26; i++)G[i].push_back(str.size());
	go(0);
	trace(0);
}

Measured memory_bytes: 2564
N = int(input())
H = list(map(int,input().split()))

obstacle = []
obstacle.append(H[0])

ans = 1
for i in range(1,N):
  for j in obstacle:
    if j > H[i]:
      obstacle.append(H[i])
      break
  else:
    obstacle.append(H[i])
    ans += 1
    
print(ans)

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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
#define debug(x) cerr << #x << ": " << x << endl
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2018/02/23  Problem: 008_agc_b / Link: https://agc008.contest.atcoder.jp/tasks/agc008_b?lang=en ----- */
/* ------問題------

N 個のマスが横一列に並んでいます。 左から i 番目のマスには整数 ai が書かれています。
最初、すべてのマスは白色です。 すぬけ君は次の操作を好きな回数だけ繰り返します。
連続する K 個のマスを選び、それらすべてを白く塗るか、それらすべてを黒く塗る。 このとき、各マスの色は上書きされる。
すぬけ君が操作を終えた後、黒いマスに書かれた整数の総和がスコアになります。 考えられるスコアの最大値を求めてください。

-----問題ここまで----- */
/* -----解説等-----

flipでは長さKの区間以外の部分は任意の色にできる

----解説ここまで---- */

LL N, K;

LL ans = 0LL;

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

	cin >> N >> K;
	VL a(N);
	FOR(i, 0, N) {
		cin >> a[i];
	}
	VL asum(N + 1, 0);
	VL psum(N + 1, 0);
	FOR(i, 0, N) {
		asum[i + 1] += asum[i] + a[i];
		psum[i + 1] += psum[i] + max(0LL, a[i]);
	}


	ans = 0;
	FOR(i, 0, N - K + 1) {
		LL ret = (psum[i] - psum[0]) + (psum[N] - psum[K + i]);
		ans = max(ans, ret);
		ans = max(ans, ret + asum[i+K] - asum[i]);
	}


	cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 2560
#include <cstdio>
#include <climits>
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <stack>
#include <algorithm>
#include <iomanip>
#include <map>
#include <queue>
#include <functional>
#include <numeric>
#include <chrono>
#include <cstdlib>
using ll = long long;
using namespace std;

const ll MOD = 1e9 + 7;
const double pi = acos(-1);
typedef pair<int, int> P;
#define REP(i, n) for (int(i) = 0; (i) < (n); ++(i))
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define EPS 1e-4
#define OUTPUT(i) (cout << (ll)i << endl)

/*unsigned int xor128(void)
{
    static unsigned int x = 123456789, y = 362436069, z = 521288629, w = 88675123;
    unsigned int t = (x ^ (x << 11));
    x = y;
    y = z;
    z = w;
    return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}
unsigned int xor128rnd(unsigned int m)
{
    return xor128() % m;
}*/

bool operator<(const pair<ll, ll> &a, const pair<ll, ll> &b)
{

    if (a.first == b.first)
        return a.second < b.second;

    return a.first < b.first;
}

struct edge
{
    int to, cost;
};

int L[11];
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    int N;
    cin >> N;
    int sum = 0;
    int maxV = 0;
    for (int i = 0; i < N; ++i)
    {
        cin >> L[i];
        maxV = max(maxV, L[i]);
        sum += L[i];
    }

    if (2 * maxV < sum)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 384
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "math.h"
#include "utility"
#include "string"
#include "map"
#include "unordered_map"
#include "iomanip"
#include "random"

using namespace std;
const long long int MOD = 1000000007;

long long int power(long long int x, long long int n, long long int M) {
	long long int tmp = 1;

	if (n > 0) {
		tmp = power(x, n / 2, M);
		if (n % 2 == 0) tmp = (tmp*tmp) % M;
		else tmp = (((tmp*tmp) % M)*x) % M;
	}
	return tmp;
}

long long int N, M, K, Q, W, H, L, R;
long long int ans;

using namespace std;


int main() {
	ios::sync_with_stdio(false);
	cin >> K >> N >> M;
	if (M - N <= 0)cout << "delicious\n";
	else if (M - N <= K)cout << "safe\n";
	else cout << "dangerous\n";
	return 0;
}

Measured memory_bytes: 384
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")

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

#define pb push_back
#define F first
#define S second
#define f(i,a,b)  for(int i = a; i < b; i++)
#define endl '\n'
using ll = long long;
#define int ll
using db = long double;
using ii = pair<int, int>;

const int N = 1e5 + 5, LG = 19, MOD = 998244353;
const int SQ =320;
const long double EPS = 1e-7;
int dp[3005], n, s, x;
int32_t main(){
#ifdef ONLINE_JUDGE
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#endif

  cin >> n >> s;
  int ans = 0;
  f(i,0,n){
    
    cin >> x;
    dp[0]++;
    for(int j = s; j >= x; --j){
      dp[j] += dp[j-x];
      if(dp[j] >= MOD)dp[j]-=MOD;
    }
    ans += dp[s];
    if(ans>=MOD)ans-=MOD;
  }
  cout<<ans<<'\n';

  return 0;
}


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

long long gcd(long long a, long long b) {
  if (b == 0) return a;
  else return gcd(b, a % b);
}

int main() {
  int K; cin >> K;
  int ans = 0;
  for (int i = 1; i <= K; i++) {
    for (int j = 1; j <= K; j++) {
      for (int k = 1; k <= K; k++) {
        ans += gcd(i, gcd(j, k));
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3640
package main

import (
	"fmt"
)

func isReachable(cur, next [3]int) bool {
	curT, curX, curY := cur[0], cur[1], cur[2]
	nextT, nextX, nextY := next[0], next[1], next[2]
	dist := abs(curX-nextX) + abs(curY-nextY)

	if dist > nextT-curT {
		return false
	}

	parity := (nextT - curT) - dist
	return parity%2 == 0
}

func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

func main() {
	var n int
	fmt.Scan(&n)

	ans := "Yes"

	curT, curX, curY := 0, 0, 0
	for i := 0; i < n; i++ {
		var nextT, nextX, nextY int
		fmt.Scan(&nextT, &nextX, &nextY)

		cur := [3]int{curT, curX, curY}
		next := [3]int{nextT, nextX, nextY}
		if !isReachable(cur, next) {
			ans = "No"
		}
		curT, curX, curY = nextT, nextX, nextY
	}

	fmt.Println(ans)
}


Measured memory_bytes: 5504
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <stdbool.h>
typedef long long LL;
typedef long double Lf;
#define Rep(i,a,n)for(LL i=(LL)(a);i<(LL)(n);i++)
#define rep(i,n)Rep(i,0,n)
#define Repp(i,l,r,k)for(LL i=(l);i<(r);i+=(k))
#define Ma(x,y) ((x)>(y)?(x):(y))
#define mi(x,y) ((x)<(y)?(x):(y))
#define MOD 1000000007//998244353,1000000007,1000000009 
int upi(const void* a, const void* b) { return*(int*)a<*(int*)b ? -1 : *(int*)a> * (int*)b ? 1 : 0; }
int downi(const void* a, const void* b) { return*(int*)a<*(int*)b ? 1 : *(int*)a> * (int*)b ? -1 : 0; }
void sortupi(int* a, int n) { qsort(a, n, sizeof(int), upi); } //1,2,3,4,...
void sortdowni(int* a, int n) { qsort(a, n, sizeof(int), downi); }
int upLL(const void* a, const void* b) { return*(LL*)a<*(LL*)b ? -1 : *(LL*)a> * (LL*)b ? 1 : 0; }
int downLL(const void* a, const void* b) { return*(LL*)a<*(LL*)b ? 1 : *(LL*)a> * (LL*)b ? -1 : 0; }
void sortupLL(LL* a, int n) { qsort(a, n, sizeof(LL), upLL); }
void sortdownLL(LL* a, int n) { qsort(a, n, sizeof(LL), downLL); }
int cmp_char(const void* a, const void* b) { return *(char*)a - *(char*)b; } // a,b,c,d
int cmp_str(const void* a, const void* b) { return strcmp(*(const char**)a, *(const char**)b); } // aaa,aab
LL gcd(LL p, LL q) { while (q) { LL t = p % q; p = q; q = t; }return p; }
LL modpow(LL a, LL n, int m) { LL x = 1; for (a %= m; n; n /= 2)n & 1 ? x = x * a % m : 0, a = a * a % m; return x; }
#define invmodpow(b,p)modpow(b,p-2,p)// a/b≡a*b^{-1}(mod p)...return b^{-1}(mod p)
typedef struct fac { LL n, exp; }F;
LL fact(LL n,F*a){LL x,i,j,c=0;x=n;for(i=2;i*i<=x;i++){for(j=1;x%i==0;j++)x/=i;if(j>1){a[c].n=i;a[c++].exp=j-1;}}if(x-1){a[c].n=x;a[c++].exp=1;}return c;}
//snippet

#define N 1009

int main() {
	int a, b, c, ans=0;
	scanf("%d%d%d", &a, &b, &c);
	Rep(i, a, b + 1)if (i % c == 0)ans++;
	printf("%d", ans);
	return 0;
}

Measured memory_bytes: 1736
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i, n) FOR(i,0,n)
const int MOD = 1000000007;
int main(void){
    int N,K;
    ll sum = 0;
    cin >> N >> K;
    for(ll i=K;i <= N+1;i++){
        ll mini = i*(i-1)/2;
        ll maxi = (2*N-i+1)* i / 2;
        ll res = maxi - mini + 1;
        sum = (sum+res)%MOD;
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 3596
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int nodes = sc.nextInt();
		int min = Integer.MAX_VALUE;
		int max = Integer.MIN_VALUE;
		for (int i = 0; i < nodes; i++) {
			int num = sc.nextInt();
			min = Math.min(num, min);
			max = Math.max(num, max);
		}
		System.out.println(max - min);
	}
}

Measured memory_bytes: 21076
import java.util.*

fun main(args:Array<String>){
    val n = readLine()!!.toLong()
    var x = 1L
    var ans = 100000000000000L
    while(x * x <= n){
        if(n % x == 0L) ans = Math.min(ans, x + n / x - 2)
        x++
    }
    println(ans)
}

Measured memory_bytes: 31736
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <iomanip>
using namespace std;
#define int long long

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

    int n,m; cin >> n >> m;
    vector<int> x(m),y(m);
    for(int i = 0;i < m;i ++) cin >> x.at(i) >> y.at(i);

    vector<int> a(n+1);
    a.at(1) = 1;

    vector<int> kosu(n+1,1);
    kosu.at(0) = 0;

    for(int i = 0;i < m;i ++){
        if(kosu.at(x.at(i)) > 1){
            if(a.at(x.at(i)) == 1) a.at(y.at(i)) = 1;
            kosu.at(x.at(i)) --;
            kosu.at(y.at(i)) ++;
        }else{
            kosu.at(x.at(i)) --;
            kosu.at(y.at(i)) ++;
            if(a.at(x.at(i)) == 1){
                a.at(x.at(i)) = 0;
                a.at(y.at(i)) = 1;
            }

        }
    }

    int ans = 0;
    for(int i = 1;i < n+1;i ++) ans += a.at(i);

    cout << ans << endl;
}

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

int main(){
	long long n;
	scanf("%lld", &n);
	if (n == (long long)1000000000000000000){
		printf("0 0 0 1000000000 1000000000 0");
		return 0;
	}
	long long x1 = 1000000000, y1 = 1;
	long long y2 = n / x1 + 1, x2 = x1 - (n % x1);
	printf("%lld %lld %lld %lld 0 0", x1, y1, x2, y2);
	return 0;
}
/*
99999999999999998
*/

Measured memory_bytes: 256
using System;

class Program {
    static void Main( string[] args )
    {
        string[] s = Console.ReadLine().Split();

        int a = int.Parse( s[ 0 ] );
        int b = int.Parse( s[ 1 ] );
        int c = int.Parse( s[ 2 ] );

        Swap( ref a, ref b );
        Swap( ref b, ref c );
        Swap( ref a, ref b );

        Console.WriteLine( "{0} {1} {2}", a, b, c );
    }

    static void Swap( ref int a, ref int b )
    {
        int n = 0;

        if ( a > b ) {
            n = a;
            a = b;
            b = n;
        }
    }
}

Measured memory_bytes: 9120
/*-----------------------------------
                -----------MEHEDI HASAN--------------
                -----CSE,JAHANGIRNAGAR UNIVERSITY----
                -----------------------------------*/
//--------------------------------------------------------------------//
#include<bits/stdc++.h>
#include <cassert>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
//--------------------------------------------------------------------//
#define FAST        ios_base::sync_with_stdio(NULL);cin.tie(NULL);cout.tie(NULL);
#define cc(x)       cout<<#x<<"="<<x<<" ";
#define ccc(x)      cout<<x<<" ";
#define ccp(x)      cout<<#x<<"="<<"("<<x.ff<<" "<<x.ss<<") ";
#define CC(x)       for(auto xx: x) cout<<xx<<" ";
#define CCp(x)      for(auto xx: x) cout<<"("<<xx.ff<<" "<<xx.ss<<") ";
#define ee          cout<<"\n";
#define OK          cout<<"Ok"<<"\n";
//--------------------------------------------------------------------//
#define ff          first
#define ss          second
#define ll          long long
#define ull         unsigned long long
#define pii         pair<int,int>
#define mp          make_pair
#define ps          push
#define psb         push_back
#define psf         push_front
#define pp          pop
#define ppb         pop_back
#define ppf         pop_front
#define all(x)      x.begin(),x.end()
#define TESTS       int t;cin>>t;for(int tcase=1;tcase<=t;tcase++)
#define ordered_set tree< int, null_type, less_equal< int >, rb_tree_tag, tree_order_statistics_node_update>
//--------------------------------------------------------------------//
#define MAX (int)(3e6)
#define MOD (ll)(1e9+7)


int main()
{
    FAST
    int x;
    cin>>x;
    int h=(x/500)*1000;
    x=x%500;
    h+=(x/5)*5;
    cout<<h<<endl;
    return 0;
}
//--------------------------------------------------------------------//
/*
>Check Corner Cases (n==1 or T==1)
>Overflow issues?
>LB / UB !!not found!! check?
*/
//--------------------------------------------------------------------//
/* ---INPUT---
--------(1)------
2
1 2 4

-------(2)-------


-------(3)-------
4
1 2 2
1 3 4
3 4 5

-------(4)-------



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


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

int main(){
  int r,g,b;
  int sum;

  cin >> r >> g >> b;

  sum = 100 * r + 10 * g + b;

  if(sum%4==0) cout << "YES" << endl;
  else         cout << "NO"  << endl;

  return 0;
}


Measured memory_bytes: 256
a, b, c, d, e, f = map(int,input().split( ))
mx = 0
ans = [0,0]
for i in range(f//(a*100)+1):
    sup_b = f-i*a*100
    
    for j in range(sup_b//(b*100)+1):
        wat = i*a*100 + j*b*100
        
        if wat > f or not wat:
            continue
        sup_sug = min(e*(wat/100), f - wat)

        
        for k in range(int(sup_sug//c)+1):
            l = (sup_sug - k*c)//d
            
            if (k*c + l*d)/wat > e/100:
                continue
                
            if mx < (k*c + l*d)/wat:
                mx = (k*c + l*d)/wat
                ans = [(k*c + l*d) + wat, k*c + l*d]
if int(ans[0])==0 and int(ans[1])==0:
    print(100*a,0)
else:
    print(int(ans[0]),int(ans[1]))


Measured memory_bytes: 3064
#include<iostream>


int main(){
    int n,i,x;

    std::cin>>n;
    
    for(i=1;i<=n;i++){
        if(i%3==0){
            std::cout<<" "<<i;
        }else{
            x=i;
            do{
                if(x%10==3){
                    std::cout<<" "<<i;
                    break;
                }
                x=x/10;
            }while(x);
        }
    }
    std::cout<<std::endl;
    return 0;
}


Measured memory_bytes: 3120
#include<bits/stdc++.h>
using namespace std;
signed main(){
  string a;
  int b=0,c=0,d=0;
  cin>>a;
  for(int i=0;i<3;i++){
    if(a[i]=='a'){
      b++;
    }else if(a[i]=='b'){
      c++;
    }else if(a[i]=='c'){
      d++;
    }
  }
    if(b==1 && c==1 && d==1){
      cout<<"Yes\n";
    }else{
      cout<<"No\n";
    }
}

Measured memory_bytes: 256
n, s = list(map(int, input().split()))
a = list(map(int, input().split()))
dp = [[None] * (s+1) for _ in range(n+1)]
M = 998244353


for j in range(s+1):
    dp[0][j] = 0
for i in range(n+1):
    dp[i][0] = i+1

for i in range(1,n+1):
    for j in range(1, s+1):
        dp[i][j] = dp[i-1][j]
        if j-a[i-1]>=0:
            dp[i][j] += dp[i-1][j-a[i-1]]
        dp[i][j] %= M
print(sum((dp[i][s] for i in range(n+1)))%M)

Measured memory_bytes: 236424
#include<bits/stdc++.h>
#define inf 0x7fffffff
#define RG register
#define inf 0x7fffffff
#define maxn 200005
#define maxm 200005
using namespace std;
typedef long long ll;
inline ll read(){
    ll x = 0, f = 1;
    char ch = getchar();
    while(ch > '9' || ch < '0') {if(ch == '-') f = -1;ch = getchar();}
    while(ch >= '0' && ch <= '9'){x = x *10 + ch -'0';ch = getchar();}
    return x * f;
}
int n,m;
int main(){
	int i,j,u,v;
	char ch[10];
	scanf("%s",ch+1);
	int mx=0;
	for(i=1;i<=3;i++) {
		if(ch[i]=='R') mx=1;
	}
	for(i=1;i<=2;i++){
		if(ch[i]=='R'&&ch[i+1]=='R') mx=2;
	}
	if(ch[1]=='R'&&ch[2]=='R'&&ch[3]=='R') mx=3;
	cout<<mx;
	return 0;
}

Measured memory_bytes: 3652
n=int(input())
l9=list(9**i for i in range(1,6))
l6=list(6**j for j in range(1,8))
l=sorted(l9+l6)
dp=[_ for _ in range(100010)]
for k in l:
    for m in range(k,n+1):
        dp[m]=min(dp[m-k]+1,dp[m])
print(dp[n])

Measured memory_bytes: 7064
#include <iostream>
#include <string>
#include <map>

using namespace std;

string s;
map<char, int> mp;

void solve() {
    while(s != ""){
        for(int i = 0; i < s.size(); i++) {
            s[i] = tolower(s[i]);
            mp[s[i]]++; 
        }
        getline(cin, s);
    }
    for(char ch = 'a'; ch <= 'z'; ch++) {
        cout << ch <<" : " << mp[ch] << endl;
    }
}

int main() {
    getline(cin, s);    
    solve();
}


Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N, X;
  cin >> N >> X;
  vector<int> L(N);
  for (auto &i:L) cin >> i;
  int ans = 1;
  int cnt = 0;
  for (int i = 0; i < N; i++){
    cnt += L[i];
    if (cnt > X)
      break;
    ans++;
  }
  cout << ans << endl;
  return 0;
}


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 P = pair<int,int>;
using Graph = vector<vector<int>>;

int main(void) {
    int n ;
    cin >> n;
    string s;
    cin >> s;

    rep(i, s.size()) {
        int a = s[i] - 'A';
        int ans = (a+n) % 26;
        cout << char(ans+ 'A');
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
import sys
x = int(input())
MAX = 2 * x
a = [0]*MAX
for i in range(2, MAX, 2):
  a[i - 1] += 1
for i in range(3, MAX+1):
  for j in range(i, MAX+1, i):
    a[j - 1] += 1

for i in range(x, MAX):
  if a[i - 1] == 1:
    print(i)
    sys.exit()

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

using namespace std;
typedef long long int ll;
typedef pair<int, int> ii;
#define DEBUG freopen("in.txt", "r", stdin);

struct fastio {
    fastio() {
        ios::sync_with_stdio(false);
        cout << setprecision(10) << fixed;
        cin.tie(0);
    }
};

fastio _fast_io;

const int N = 105;
ll ans, sum, n, m, w, v, a, b, c, d;
ll va[N], vb[N], vc[N], vd[N];
ll pa[N], pb[N], pc[N], pd[N];

// w, 1, 2, 3
int main() {
    cin >> n >> m;
    cin >> w >> v;
    ll w0 = w, w1 = w + 1, w2 = w + 2, w3 = w + 3;
    va[a++] = v;
    for (int i = 1; i < n; ++i) {
        cin >> w >> v;
        if (w == w0)
            va[a++] = v;
        else if (w == w1)
            vb[b++] = v;
        else if (w == w2)
            vc[c++] = v;
        else
            vd[d++] = v;
    }
    sort(va, va + N, greater<ll>());
    sort(vb, vb + N, greater<ll>());
    sort(vc, vc + N, greater<ll>());
    sort(vd, vd + N, greater<ll>());
    for (int i = 0; i < a; ++i) {
        pa[i + 1] = pa[i] + va[i];
    }
    for (int i = 0; i < b; ++i) {
        pb[i + 1] = pb[i] + vb[i];
    }
    for (int i = 0; i < c; ++i) {
        pc[i + 1] = pc[i] + vc[i];
    }
    for (int i = 0; i < d; ++i) {
        pd[i + 1] = pd[i] + vd[i];
    }
    for (int h = 0; h <= a; ++h) {
        for (int i = 0; i <= b; ++i) {
            for (int j = 0; j <= c; ++j) {
                for (int k = 0; k <= d; ++k) {
                    if (w0 * h + w1 * i + w2 * j + w3 * k <= m) {
                        ans = max(ans, pa[h] + pb[i] + pc[j] + pd[k]);
                    }
                }
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3500
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int ls,lt,m;
char s[110],t[110],z[110];
int main()
{
	cin>>s;
	cin>>t;
	ls=strlen(s);
	lt=strlen(t);
	sort(s,s+ls);
	sort(t,t+lt);
	for(int i=lt-1;i>=0;i--)
	z[m++]=t[i];
	/*cout<<s<<endl;
	cout<<z<<endl;*/
	if(strcmp(s,z)<0)cout<<"Yes";
	else cout<<"No";
	return 0;
} 

Measured memory_bytes: 256
from collections import defaultdict

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

A.sort(reverse=True)
lengCount = defaultdict(int)
for a in A:
    lengCount[a] += 1

lengList = [[leng, count] for leng, count in lengCount.items()]
lengList.sort(key=lambda A : A[0], reverse=True)

firstLeng = 0
for i in range(len(lengList)):
    if lengList[i][1] >= 2:
        firstLeng = lengList[i][0]
        lengList[i][1] -= 2
        break

secondLeng = 0
for i in range(len(lengList)):
    if lengList[i][1] >= 2:
        secondLeng = lengList[i][0]
        break
print(firstLeng * secondLeng)

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

typedef long long ll;
typedef pair<int,int> pi;
typedef vector<int> vi;

#define f first
#define s second
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define mp make_pair
#define forn(i, n) for(register int i=0; i<n; i++)
#define Forn(i, n) for(register int i=1; i<=n; i++)
#define foreach(it, a) for(__typeof((a).begin()) it=(a).begin(); it!=(a).end(); it++)
#define Foreach(it, a) for(__typeof((a).rbegin()) it=(a).rbegin(); it!=(a).rend(); it++)

inline int in()
{
    char c=getchar();
    int neg=1, x=0;
    while(!isdigit(c)) (c=='-')?neg=-1, c=getchar():c=getchar();
    while(isdigit(c)) x=(x<<3)+(x<<1)+(c^48), c=getchar();
    return neg*x;
}
inline int lcm(int a, int b){return a*b/__gcd(a, b);}

int N;

int main()
{
    cin>>N;
    ll ret=1LL*(N-2)*180;
    cout<<ret<<endl;
    return 0;
}

Measured memory_bytes: 256