akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>
#include <numeric>
#include <queue>
#include <stack>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9 + 7);

int main(void) {
	int n, x;
	cin >> n >> x;
	
	vector<int> m(n);
	int sum = 0;
	for(int i = 0; i < n; ++i) {
		cin >> m[i];
		sum += m[i];
	}
	
	x -= sum;
	int ans = n;
	int minM = *min_element(m.begin(), m.end());
	
	ans += x / minM;
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 3580
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define MOD 1000000007
template <typename Type>
istream &operator>>(istream &in, vector<Type> &vec) {
    ll n = vec.size();
    for (ll i = 0; i < n; i++)
        in >> vec[i];
    return in;
}
template <typename Type>
ostream &operator<<(ostream &out, vector<Type> &vec) {
    for (auto val : vec)
        out << val << " ";
    return out;
}
#define PI 3.14159265

int main()
{
   ll n,k;
   cin>>n>>k;
   vector<ll>a(n);
   cin>>a;
   ll dp[n];
   for(ll i=0;i<n;i++)
   dp[i]=INT_MAX;

   dp[0] = 0;
   dp[1] = abs(a[1]-a[0]);
   for(ll i=2;i<n;i++)
   {
       for(ll j=1;j<=k;j++)
       {
           if(i-j<0)
            break;
           else
            dp[i] = min(dp[i],dp[i-j]+abs(a[i]-a[i-j]));
       }
   }
   cout<<dp[n-1]<<endl;

   
   return 0;
}
    


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

#define ll long long
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define ld long double
#define forn(low,high,i) for(i = low; i < high; i++)
#define forrev(high,low,i) for(i = high; i >= low; i--)
#define all(v) v.begin(),v.end()
#define decimal_digits cout << fixed << setprecision(15);

string to_string(string s) { return '"' + s + '"';}
string to_string(char s) { return string(1, s);}
string to_string(const char* s) { return to_string((string) s);}
string to_string(bool b) { return (b ? "true" : "false");}
template <typename A> string to_string(A);
template <typename A, typename B>string to_string(pair<A, B> p) {return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";}
template <typename A> string to_string(A v) {bool f = 1; string r = "{"; for (const auto &x : v) {if (!f)r += ", "; f = 0; r += to_string(x);} return r + "}";}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) {cerr << " " << to_string(H); debug_out(T...);}
#define pr(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

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

const int inf = 1e9;
const long long INF = 1e18;
const int mod = 1e9 + 7;
const int bit32 = log2(inf) + 3;
const int bit64 = log2(INF) + 3;

inline int add(long long a, long long b){a += b; if(a >= mod) a -= mod; return a;}
inline int sub(long long a, long long b){a -= b; if(a < 0) a += mod; return a;}
inline int mul(long long a, long long b){a %= mod; b %= mod; return (int)((long long) a * b % mod);}
inline int modexpo(long long a, long long b){int res = 1; while(b > 0){ if(b & 1) res = mul(res, a); a = mul(a, a); b /= 2;} return res;}
inline int divide(long long a, long long b){return mul(a, modexpo(b, mod - 2));}
inline int inv(long long a){return modexpo(a, mod - 2);}

clock_t time_p = clock();

void ktj(){
  time_p = clock() - time_p;
  cerr << "Time elapsed : " << (float)(time_p)/CLOCKS_PER_SEC << "\n";
}

void pre(){ // Reset each global variable (esp. for graphs)
  
}

void solve(){
  int n, k, i, j;
  cin >> n >> k;
  vector<int> a(n);
  for(i = 0; i < n; i++){
    cin >> a[i];
  }
  sort(all(a));
  int ans = 0;
  for(i = 0; i < k; i++){
    ans += a[i];
  }
  cout << ans << '\n';
}


#define GOOGLE 0
#define MULTIPLE_TC 0

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

  pre();

  int t = 1, T;
  if(MULTIPLE_TC)
    cin >> t;

  for(T = 1; T <= t; T++){
    if(GOOGLE)
      cout << "Case #" << T << ": ";
    solve();
  }

  ktj();
}

Measured memory_bytes: 3852
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#ifdef __GXX_EXPERIMENTAL_CXX0X__
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#ifdef __GXX_EXPERIMENTAL_CXX0X__
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif


using namespace std;

int main ()
{
	int N;
	while( cin >> N , N )
	{
		map < char , char > data;
		char a , b;
		for( size_t i = 0; i < N; i++ )
		{
			cin >> a >> b;
			data[a] = b;
		}
		cin >> N;
		for( size_t i = 0; i < N; i++ )
		{
			cin >> a;
			if( data[a] )
			{
				a = data[a];
			}
			cout << a;
		}
		cout << endl;
	}
}

Measured memory_bytes: 1184
#include<iostream>
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<math.h>
#include<algorithm>
#include<iomanip>

using namespace std;

class Counting {
	unsigned long long p, n;
	vector<long long> invMemo, facMemo, facInvMemo;
public:
	Counting(unsigned long long nn, unsigned long long np) {
		p = np;
		n = nn;
		invMemo.resize(n + 1);
		facMemo.resize(n + 1);
		facInvMemo.resize(n + 1);
		facMemo[0] = 1;
		facMemo[1] = 1;
		facInvMemo[0] = 1;
		facInvMemo[1] = 1;
		invMemo[0] = 0;
		invMemo[1] = 1;
		for (unsigned long long i = 2; i <= n; i++) {
			invMemo[i] = p - (p / i)*invMemo[p%i] % p;
			facMemo[i] = (facMemo[i - 1] * i) % p;
			facInvMemo[i] = (facInvMemo[i - 1] * invMemo[i]) % p;
		}
	}
	unsigned long long fac(unsigned long long k) {
		return facMemo[k];
	}
	unsigned long long facInv(unsigned long long k) {
		return facInvMemo[k];
	}
	unsigned long long choose(unsigned long long n, unsigned long long k) {
		if (!(0 <= k && k <= n))
			return 0;
		return (((facMemo[n] * facInvMemo[k]) % p)*facMemo[n - k]) % p;
	}
	unsigned long long divide(unsigned long long a, unsigned long long b) {
		return (a * invMemo[b]) % p;
	}
	unsigned long long mod(unsigned long long a) {
		a %= p;
		if (a < 0) a += p;
		return a;
	}
	unsigned long long power(unsigned long long a, unsigned long long e) {
		unsigned long long ans = 1;
		for (; e > 0; e /= 2) {
			if (e % 2 != 0)
				ans = ans * a % p;
			a = a*a%p;
		}
		return ans;
	}
};

int n;
vector<int> a;
vector<int> dp;
vector<vector<int>> ed;
int b = 0;

int solve(int id) {
	if (dp[id] > -1) {
		return dp[id];
	}
	int ans = 0;
	int res = 0;
	int max = 0;
	int be = -1;
	vector<int> vec;
	for (int i = 0; i < ed[id].size(); i++) {
		vec.push_back(solve(ed[id][i]));
	}
	sort(vec.begin(), vec.end());
	for (int i = 0; i < vec.size(); i++) {
		if (be == vec[i]) {
			res++;
		}
		else {
			if (be != -1) {
				if (res >= vec[i] - be - 1) {
					res -= (vec[i] - be - 1);
				}
				else {
					res = 0;
				}
			}
		}
		be = vec[i];
	}
	ans = be + res + 1;
	dp[id] = ans;
	return ans;
}

int main() {
	cin >> n;
	a.resize(n - 1);
	dp.resize(n);
	ed.resize(n);
	for (int i = 0; i < n - 1; i++) {
		cin >> a[i];
		ed[a[i] - 1].push_back(i + 1);
	}
	for (int i = 0; i < n; i++) {
		dp[i] = -1;
		if (ed[i].size() == 0) {
			dp[i] = 0;
		}
	}
	cout << solve(0) << endl;
	//cin >> n;
	return 0;
}

Measured memory_bytes: 17408
#[allow(unused_imports)]
use proconio::{
    fastout, input,
    marker::{Bytes, Chars, Isize1, Usize1},
};

fn main() {
    input! {
        d:usize,t:usize,s:usize
    }
    if (d + t - 1) / t <= s {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 2176
#include<cstdio>
#include<algorithm>

using namespace std;

int main(){
	int n, T; scanf("%d %d", &n, &T);
	int res = 10000;
	for(int i = 0; i < n; i++){
		int c, t; scanf("%d %d", &c ,&t);
		if(t <= T) res = min(res, c);
	}
	if(res > 1000) puts("TLE");
	else printf("%d\n", res);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// #include <ext/pb_ds/detail/standard_policies.hpp>
// using namespace __gnu_pbds;
using namespace std;
// template <typename T>
// using ordered_set = tree<T, null_type, less<T>, rb_tree_tag,
//     tree_order_statistics_node_update>;
 
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
typedef long long int ll;
typedef long double ld;
const ll N = 1e5+9;
// const ll m = 1e9 + 7;
// const ll inf= 1e14;
const ll mod =998244353;
#define x first
#define y second
#define pb push_back
#define mp make_pair
#define pii pair<ll,ll>
#define pld pair<ld,ld>
ll powm(ll a, ll b) { a = a%mod;ll res = 1; while (b) { if (b & 1) res = (res * a) % mod; a = (a * a) % mod; b >>= 1; } return res; }

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout); 
    #endif  
    int q = 1;
    // cin>>t;
    while(q--){
        ll n,T;cin>>n>>T;
        ll t[n];
        for(int i = 0;i<n;i++){
            cin>>t[i];
        }
        ll ans  = 0;
        for(int i = 0;i<n-1;i++){
            ans+=min(t[i+1]-t[i],T);
        }
        ans+=T;
        cout<<ans<<'\n';


    }
}

Measured memory_bytes: 5060
#include <stdio.h>
#include <string.h>
//#include "algorithm.h"

int main()
{
	long int i,l=0,time_count=0;
	long int n;
	scanf("%ld",&n);
	char s[n][120],x[120];
	long int t[n];
	for(i=1;i<=n;i++)	scanf("%s %ld",s[i],&t[i]);
	scanf("%s",x);
	i=1;
	while(strcmp(s[i],x)!=0)	i++;
	l = i+1;
	while(l<=n)
	{
		time_count += t[l];
		l++;
	}
	printf("%ld",time_count);
	return 0;
}

Measured memory_bytes: 128
from collections import deque
import sys
sys.setrecursionlimit(1000000)
h, w = map(int, input().split())
field = []
for _ in range(h):
    field.append(list(input()))

dy = [1, -1, 0, 0]
dx = [0, 0, 1, -1]
distance = [[-1] * w for i in range(h)]

que = deque([])
for y in range(h):
    for x in range(w):
        if field[y][x] == '.':
            continue
        que.append([y, x])
        distance[y][x] = 0

while que:
    q = que.popleft()
    for i in range(4):
        now_y = q[0] + dy[i]
        now_x = q[1] + dx[i]
        if now_y < 0 or now_y >= h or now_x < 0 or now_x >= w or field[now_y][now_x] == '#':
            continue
        if distance[now_y][now_x] != -1:
            continue
        que.append([now_y, now_x])
        distance[now_y][now_x] = distance[q[0]][q[1]] + 1

draw_count = 0
for y in range(h):
    for x in range(w):
        draw_count = max(draw_count, distance[y][x])
print(draw_count)

Measured memory_bytes: 176604
#include<bits/stdc++.h>
#define maxn 110
using namespace std;
int sq[maxn][maxn];
int color[10100];
int n,h,w;
int main(){
	cin>>h>>w;
	cin>>n;
	for(int i=1;i<=n;i++){
		scanf("%d",&color[i]);
	}
	getchar();
	int k=1;
	for(int i=0;i<h;i++){
		if(i%2==0){
			for(int j=0;j<w;j++){
				if(color[k]!=0){
					sq[i][j]=k;
					color[k]--;
				}
				if(color[k]==0){
					k++;
				}
			}
		}
		if(i%2==1){
			for(int j=w-1;j>=0;j--){
				if(color[k]!=0){
					sq[i][j]=k;
					color[k]--;
				}
				if(color[k]==0){
					k++;
				}				
			}
		}
	}
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			cout<<sq[i][j];
			if(j!=w-1){
				cout<<" ";
			}
		}
		cout<<endl;
	}
}

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

using namespace std;
using ll=long long;
const ll mod = 1e9 + 7;

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

int main() {
    int N;
    cin>>N;
    int sum=0;
    int ans=0;
    for(int i=1;i<=N;i++){
        sum+=i;
        if(sum>=N) {
            ans=i;
            break;
        }
    }
    int exclude=sum-N;
    for(int i=1;i<=ans;i++){
        if(i==exclude) continue;
        cout<<i<<endl;
    }
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <algorithm>
#include <string>
#include <vector> 
#include <numeric>
#include <cmath>
#include <queue>
#include <iomanip>
#include <functional>


#define CHMAX(a,b) a = std::max(a,b)
#define CHMIN(a,b) a = std::min(a,b)
#define MAXMIN(a,b,c) std::max(a,min(b,c))
#define CHABS(a) a = std::abs(a) 
#define COUT(a) std::cout << a << std::endl
#define CERR(a) std::cerr << a << std::endl
#define FOR(n) for(lli i = 0; i < n; i++)

using namespace std;
using lli = long long int;
using pll = pair<lli, lli>;
using tlll = tuple<lli, lli, lli>;
using vll = vector<lli>;

lli mod197 = 1000000007LL;
lli INF = 10000000000000;

// ax + by = gcd(a,b) 最大公約数
template< typename T >
T extgcd(T a, T b, T& x, T& y) {
	T d = a;
	if (b != 0) {
		d = extgcd(b, a % b, y, x);
		y -= (a / b) * x;
	}
	else {
		x = 1;
		y = 0;
	}

	return d;
}

int main(void) {


	lli a, b, n;
	cin >> a >> b >> n;

	//x = B - 1 + B * i
	lli x = min(b - 1,n);
	cout << (a * x / b) - a * (x / b);


	return 0;
}

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

int main()
{
    int n, m;
    string A = "";
    string B = "";
    cin >> n >> m;
    for( int i = 0; i < n; i++ ){
        A.push_back(m+'0');
    }
    for( int j = 0; j < m; j++ ){
        B.push_back(n+'0');
    }
    ///cout << A << " " << B;
    if( A <= B ){
        cout << A;
    }
    else{
        cout << B;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
const int mod = 1e9+7;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
int main(){
    int n;
    cin>>n;
    vector<int> v(n);
    vector<int> dp(100100,inf);
    rep(i,n) cin>>v[i];
    rep(i,n){
        int id = lower_bound(dp.begin(),dp.end(),v[i]) - dp.begin();
        dp[id]=v[i];
    }
    //rep(i,6) cout<<dp[i]<<" ";
    //cout<<endl;
    int  ans = lower_bound(dp.begin(),dp.end(),inf) - dp.begin();
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,s,n) for(int i=(s); i<(n); i++)
#define all(v) v.begin(),v.end()
#define res(n) resize(n)
#define rev(v) reverse(v.begin(),v.end())
#define sor(v) sort(v.begin(),v.end())
#define outve(v) for(auto i : v) cout << i << " ";cout << endl
#define in(n,v) for(int i=0; i<(n); i++){cin >> v[i];}
#define out(n) cout << (n) << endl
#define fi first
#define se second
#define ve vector
#define pq priority_queue
#define vi vector<int>
#define vl vector<long long>
#define vii vector<vector<int>>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll mod = 1000000007;



template <typename T> T gcd(T a, T b) {if(b == 0) return a;return gcd(b,a%b);}
template <typename T> T extgcd(T a, T b, T& x, T& y){
    T d = a;
    if(b != 0){d = extgcd(b,a%b,y,x); y-=(a/b)*x;}
    else x=1,y=0;
    return d;
}
template <typename T> T modpow(T x, T n, T m) {
    if(n==0) return 1;
    T resp = modpow(x*x%m,n/2,mod);
    if(n&1) resp = resp*x%m;
    return resp;
}
template <typename T> T modinverse(T a, T m) {
    T x,y;
    extgcd(a,m,x,y);
    return (m+x%m)%m;
}
struct combination {
    ll M = mod;
    vector<ll> fact;vector<ll> ifact;
    combination(ll n):fact(n+1),ifact(n+1){
        fact[0]=1;ifact[0]=1;
        for (ll i = 0; i<n; i++) {fact[i+1] = fact[i]*(i+1) % M;ifact[i+1] = ifact[i]*modpow(i+1, M-2, M) % M;}
    }
    ll com(ll a, ll b){
        if(a == 0 && b == 0)return 1;if(a < b || a < 0)return 0;
        ll tmp = ifact[a-b]* ifact[b] % M;
        return tmp * fact[a] % M;
    }
};

ll twe(ll aa){
    ll k = 0;
    while (aa % 2 == 0) {
        aa /= 2;
        k++;
    }
    
    return k;
    
}


int main()
{
    int N;ll M;
    cin >> N >> M;
    vl a(N);in(N,a);
    

    ll A = 1;
    ll ans = 1;
    rep(i,N){
        A = gcd(a[i]/2,ans);
        ans = ans*a[i]/2/A;
    }

    ll mm = twe(a[0]);
    rep(i,N){
        if(mm != twe(a[i])){
            out(0);
            return 0;
        }
    }
    
    A = ans*2;

    
    if(ans > M){
        out(0);
        return 0;
    }
       //out(ans);
    ll an = M/(ans);
    an = (an+1)/2;
    
    out(an);
       
       
    

    return 0;
}


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

using namespace std;
using ll = long long;

int K;

template<class T>
struct Vector {
  vector<T> v;
  Vector(int sz) : v(sz, 0) {}
  Vector() : v(0) {}
  Vector(vector<T> t) : v(t) {}
  auto& operator[](size_t pos) {
    return v[pos];
  }
  inline auto begin() {
    return v.begin();
  }
  inline auto end() {
    return v.end();
  }
  inline auto size() {
    return v.size();
  }
  inline auto push_back(T t) {
    v.push_back(t);
  }
  inline auto pop_back() {
    v.pop_back();
  }
  inline auto& back() {
    return v.back();
  }
  friend auto& operator>>(istream& lhs, Vector& rhs) {
    for (int i = 0; i < rhs.size(); i++) lhs >> rhs[i];
    return lhs;
  }
  friend auto& operator<<(ostream& lhs, Vector& rhs) {
    for (int i = 0; i + 1 < rhs.size(); i++) lhs << rhs[i] << endl;
    if (rhs.size()) lhs << rhs.back();
    return lhs;
  }
};

Vector<ll> calc(Vector<ll>& x, Vector<ll>& y)
{
  Vector<ll> res;
  for (ll X : x) {
    for (ll Y : y) {
      res.push_back(X + Y);
    }
  }
  sort(res.begin(), res.end(), greater<ll>());
  while (res.size() > K) res.pop_back();
  return res;
}

int main()
{
  int x, y, z;
  cin >> x >> y >> z >> K;
  Vector<ll> a(x), b(y), c(z);
  cin >> a >> b >> c;
  auto v = calc(a, b);
  v = calc(v, c);
  cout << v << endl;
}


Measured memory_bytes: 42984
#include <cstdio>
#include <map>
#include <cstring>
#include <iostream>
using namespace std;

map<string,int> pi;

int main()
{
	pi["SUN"]=7; pi["MON"]=6; pi["TUE"]=5;
	pi["WED"]=4; pi["THU"]=3; pi["FRI"]=2; pi["SAT"]=1;
	string s; cin >> s;
	cout << pi[s];
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<algorithm>
#include<iostream>
#include<queue>
#include<map>
#include<cmath>
#include<set>
#include<stack>
#define ll long long
#define max(x,y) ((x)>(y)?(x):(y))
#define min(x,y) ((x)>(y)?(y):(x))
#define cls(name,x) memset(name,x,sizeof(name))
using namespace std;
const int inf=1<<28;
const int maxn=1e5+10;
const int maxm=110;
const int mod=1e9+7;
const double pi=acos(-1.0);
ll n,A,B;
ll num[maxn];
int main()
{
    //freopen("in.txt","r",stdin);
    while(~scanf("%lld %lld %lld",&n,&A,&B))
    {
        for(int i=0;i<n;i++)
        {
            scanf("%lld",&num[i]);
        }
        ll l=1,r=1e9;
        ll ans=1e9;
        while(l<r)
        {
            ll mid=(l+r)/2;
            ll t=mid;
            for(int i=0;i<n;i++)
            {
                if(num[i]>mid*B)
                {
                    if((num[i]-mid*B)%(A-B)==0)
                        t-=(num[i]-mid*B)/(A-B);
                    else
                        t-=(num[i]-mid*B)/(A-B)+1;
                }
            }
            if(t<0)
                l=mid+1;
            else
            {
                ans=min(ans,mid);
                r=mid;
            }
        }
        printf("%lld\n",ans);
    }
    return 0;
}


Measured memory_bytes: 1024
mod = 998244353
n = int(input())
l = list(map(int, input().split()))
m = [0]*(max(l)+1)
for x in l:
    m[x] += 1
if l[0] != 0 or not all(l[1:]) or not all(m):
    print(0)
    exit()
t = 1
r = 1
for x in m:
    t = t * pow(r,x,mod) % mod
    r = x

print(t)

Measured memory_bytes: 14396
#include "bits/stdc++.h"
#define PRECISION(x) cout << fixed << setprecision(x)
#define FAST_IO ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define ALLR(X) (X).rbegin(), (X).rend()
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define F first
#define S second

using namespace std;
 
template<class T> void max_self(T & a, const T & b) { if(a < b) a = b; }
template<class T> void min_self(T & a, const T & b) { if(a > b) a = b; }
typedef long long LL;
const int INF = 1e9 + 7;
const double PI = acos(-1.0);
const double EPS = (1e-9);



int main(){
  FAST_IO  
  const int nax = 1e4 + 7;
  string s; cin >> s;
  int x, y; cin >> x >> y;
  vector<int> disp[2];
  vector<vector<bool>> hori, verti;

  for(int ins = 0, cons = 0, turn = 1, fst = true; ins <= SZ(s); ++ins){
    if(ins == SZ(s) || s[ins] == 'T'){
      if(fst){
        x -= cons;
        fst = false;
        cons = 0;
        continue;
      }
      disp[turn].PB(cons);
      turn = !turn;
      cons = 0;
    }else cons++;
  }

  if(abs(x) > 8000 || abs(y) > 8000){
    cout << "No\n";
    return 0;
  }


  int X = SZ(disp[0]), Y = SZ(disp[1]);
  hori.resize(X + 1); verti.resize(Y + 1);

  for(int pos = 0; pos <= X; ++pos) hori[pos].resize(2 * nax, false);
  for(int pos = 0; pos <= Y; ++pos) verti[pos].resize(2 * nax, false);

  hori[0][0 + nax] = true;
  verti[0][0 + nax] = true;

  for(int pos = 0; pos < X; ++pos){
    for(int t = -8000; t <= 8000; ++t){
      if(hori[pos][t + nax]){
        hori[pos + 1][t - disp[0][pos] + nax] = true;
        hori[pos + 1][t + disp[0][pos] + nax] = true;
      }
    }
  }

  for(int pos = 0; pos < Y; ++pos){
    for(int t = -8000; t <= 8000; ++t){
      if(verti[pos][t + nax]){
        verti[pos + 1][t - disp[1][pos] + nax] = true;
        verti[pos + 1][t + disp[1][pos] + nax] = true;
      }
    }
  }
  
  if(hori[X][x + nax] && verti[Y][y + nax]) cout << "Yes\n";
  else cout << "No\n";

  return 0;
}

Measured memory_bytes: 20096
#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>  
#include <chrono>
#include <random>
#include <time.h>
#include <fstream>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define endl "\n"
#define all(c) begin(c),end(c)
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}

#define INF 1e9+7
#define LLINF 1e18+7
#define N 250000
ll MOD=1e9+7;



main(){
    int n=in();
    int a[N];
    rep(i,n)cin>>a[i];
    vector<int> v(N,-1);
    rep(i,n){
        int r=i,l=-1;
        while(r>l+1){
            int mid=(r+l)/2;
            if(v[mid]<a[i])r=mid;
            else l=mid;
        }
        v[r]=a[i];
        /*rep(j,i+1)cout<<v[j]<<" ";
        cout<<endl;
        */
    }
    rep(i,n+1){
        if(v[i]==-1){
            cout<<i;
            return 0;
        }
    }
}



Measured memory_bytes: 1664
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include <numeric>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999

using namespace std;



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


ll m = 1000000007;

ll gcd(ll x, ll y) {
	ll m = max(x, y), n = min(x, y);
	if (m%n == 0)return n;
	else return gcd(m%n, n);
}
ll lcm(ll x, ll y) {
	return x / gcd(x, y)*y;
}

ll myPow(ll x, ll n, ll m) {
	if (n == 0)
		return 1;
	if (n % 2 == 0)
		return myPow(x * x % m, n / 2, m);
	else
		return x * myPow(x, n - 1, m) % m;
}
int a[10010];
int main() {
	int H, W, N;
	cin >> H >> W;
	cin >> N;
	REP(i, N) {
		cin >> a[i];
	}
	int x = 0;
	int y = 0;
	int ans[100][100];
	bool migi = true;
	REP(i, N) {
		REP(j, a[i]) {
			ans[x][y] = i+1;
			if (migi) {
				if (x + 1 <= H - 1)x++;
				else {
					y++;
					migi = false;
				}
			}
			else {
				if (x - 1 >= 0)x--;
				else {
					y++;
					migi = true;
				}
			}
		}
	}
	REP(i, H) {
		REP(j, W) {
			cout << ans[i][j];
			if (j == W - 1)continue;
			cout << " ";
		}
		cout << endl;
	}
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
char a[109][109];
int main()
{
    for(int i=0;i<2;i++)
        for(int j=0;j<3;j++)
        cin>>a[i][j];
    if(a[0][0]==a[1][2]&&a[0][1]==a[1][1]&&a[0][2]==a[1][0])
        cout<<"YES";
    else
        cout<<"NO";
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
using namespace std;
using ll=long long;
constexpr ll mod=1000000007;
constexpr int inf=1000000000;
constexpr ll linf=1000000000000000000;

struct UnionFind{
private:
    vector<int> data;
public:
    UnionFind(int n){
        data.assign(n,-1);
    }
    int root(int x){
        if(data[x]<0)return x;
        else return data[x]=root(data[x]);
    }
    bool issame(int x,int y){
        return root(x)==root(y);
    }
    bool merge(int x,int y){
        x=root(x),y=root(y);
        if(x==y)return false;
        if(data[x]>data[y])swap(x,y);
        data[x]+=data[y];
        data[y]=x;
        return true;
    }
    int size(int x){
        return -data[root(x)];
    }
};

int main(){
    int n,m;
    cin>>n>>m;
    int a[m],b[m];
    rep(i,m){
        cin>>a[i]>>b[i];
        --a[i],--b[i];
    }
    int ans=m;
    rep(i,m){
        UnionFind uf(n);
        rep(j,m){
            if(i==j)continue;
            uf.merge(a[j],b[j]);
        }
        if(uf.size(0)==n){
            --ans;
        }
    }
    cout<<ans<<endl;
}


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

int main()
{
	int N,M,S = 0; 										
	cin >> N;
	int T[N+1];
	for(int i = 0; i < N; i++)
	{
		cin >> T[i]; 
		S += T[i];
	}
	cin >> M;
	int X[M+1], P[M+1];
	for(int i = 0; i < M; i++)
	{
		cin >> P[i] >> X[i];
		cout << S+X[i]-T[P[i]-1] << endl;
	}

}

Measured memory_bytes: 256
#!/usr/bin/env/ python

H,W=map(int,raw_input().split())
arr=[['#']*W]*H
for i in range(H):
    line=map(str,raw_input())
    line.insert(0,'#')
    line.append('#')
    arr[i]=line

print '#'*(W+2)
for i in range(H):
    print "".join(arr[i])
print '#'*(W+2)

Measured memory_bytes: 2692
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int n;
		int k0, k10, k20, k30, k40, k50, k60;

		while (true) {
			n = sc.nextInt();
			if (n == 0) {
				break;
			}
			k0 = k10 = k20 = k30 = k40 = k50 = k60 = 0;
			for (int i = 0; i < n; i++) {
				int k = sc.nextInt();
				if (k < 10) {
					k0++;
				} else if (k < 20) {
					k10++;
				} else if (k < 30) {
					k20++;
				} else if (k < 40) {
					k30++;
				} else if (k < 50) {
					k40++;
				} else if (k < 60) {
					k50++;
				} else {
					k60++;
				}
			}
			System.out.println(k0);
			System.out.println(k10);
			System.out.println(k20);
			System.out.println(k30);
			System.out.println(k40);
			System.out.println(k50);
			System.out.println(k60);
		}
	}
}

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

int N, A[10010];
int min() {
   long long minnum = A[0];
   for(int i=0; i<N; ++i){
     if (minnum > A[i]) minnum = A[i];
   }
return minnum;
}
int max() {
   long long maxnum = A[0];
   for(int i=0; i<N; ++i){
     if (maxnum < A[i]) maxnum = A[i];
   }
return maxnum;
}
long long sum() {
   long long sumnum = 0;
   for(int i=0; i<N; ++i){
     sumnum += A[i];
   }
return sumnum;
}
int main() {
cin >> N;
for (int i=0; i<N; ++i)
cin >> A[i];
cout << min() << " " << max() << " " << sum() << endl;
}

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

int main(){

    int k, s;
    scanf("%d%d", &k, &s);

    int cnt=0;
    for(int x=0; x<=k; ++x){
        for(int y=0; y<=k; ++y){
            int z=s-(x+y);
            if(z>=0&&z<=k)
                ++cnt;
        }
    }


    printf("%d\n", cnt);




    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const long long INF=1e18,MOD=1e9+7;
int main(){
	int n,q;
	cin>>n>>q;
	string s,check="AC";
	cin>>s;
	vector<int>ans(s.length());
	ans[0]=0;
	for(int i=1;i<s.length();i++){
		ans[i]=ans[i-1];
		if(s.substr(i-1,2)==check)ans[i]++;
	}

	//クエリ処理

	for(int i=0;i<q;i++){
		int l,r;
		cin>>l>>r;
		l--;r--;
		cout<<ans[r]-ans[l]<<endl;
	}

}


Measured memory_bytes: 1408
c = []
for i in range(3):
    c.append(list(map(int, input().split())))
x = [0] * 3
y = [0] * 3
# print(c)
for i in range(3):
    y[i] = c[0][i]
for i in range(3):
    x[i] = c[i][0] - y[0]

answer = 'Yes'
for i in range(3):
    for j in range(3):
        if c[i][j] != x[i] + y[j]:
            answer = 'No'

print(answer)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
const char m = 'o';
const char b = 'x';
int main(){
  int n;
  string s;
  cin >> n >> s;
  string ans;
  string st[4];
  st[0] = "SS";
  st[1] = "SW";
  st[2] = "WS";
  st[3] = "WW";
  for(int j = 0;j < 4;j++){
    ans = st[j];
    for(int i = 0;i < n;i++){
      if(ans[i+1] == 'S'){
        if(s[(i+1)%n] == m) ans += ans[i];
      	else if(ans[i]== 'S')ans += "W";
      	else ans += "S";
   	  }else{
      	if(s[(i+1)%n] == b)ans += ans[i];
      	else if(ans[i]== 'S')ans += "W";
      	else ans += "S";
      }
  	}
    if(ans[n] == ans[0] && ans[n+1] == ans[1]){     
      cout << ans.substr(0,n) << endl;
      break;
    }
    else if(j == 3)cout << -1 << endl;
  }
}

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

int main(){
    long long n;
    cin >> n;
    vector<long long> z(n);
    vector<long long> w(n);

    for(long long i = 0; i < n; i++) {
        long long x, y;
        cin >> x >> y;
        z[i] = x + y;
        w[i] = x - y;
    }

    sort(z.begin(), z.end());
    sort(w.begin(), w.end());

    long long maxz = z[n-1];
    long long minz = z[0];
    long long maxw = w[n-1];
    long long minw = w[0];

    long long ans = max(maxz - minz, maxw - minw);

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

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

int main()
{
    int a, b;
    cin >> a >>b;
    if(a%3 == 0 || b%3==0 || (a+b)%3==0)
        cout << "Possible" << endl;
    else
        cout << "Impossible" << endl;
    return 0;
}

Measured memory_bytes: 256
import sys
from collections import deque


input = iter(sys.stdin.readlines()).__next__

R, C, K = [int(x) for x in input().split()]
X1, Y1, X2, Y2 = [int(x) - 1 for x in input().split()]  # 0 indexed

grid = [input().rstrip() for r in range(R)]

source = (X1, Y1)
q = deque([source])
dist = {source: 0}


def getNbr(node, currDist):
    r, c = node
    ret = []
    for dr, dc in [(0, 0), (-1, 0), (0, -1), (0, 1), (1, 0)]:
        for k in range(1, K + 1):
            nr = r + dr * k
            nc = c + dc * k
            if not (0 <= nr < R and 0 <= nc < C):
                break
            if grid[nr][nc] == "@" or ((nr, nc) in dist and dist[(nr, nc)] <= d):
                break
            ret.append((nr, nc))
    return ret


while q:
    node = q.popleft()
    d = dist[node]
    for nbr in getNbr(node, d):
        if nbr not in dist:
            q.append(nbr)
            dist[nbr] = d + 1


if False:
    for row in grid:
        print(row)
    print()
    for r in range(R):
        for c in range(C):
            print(dist.get((r, c), "?"), end=" ")
        print()


if (X2, Y2) in dist:
    print(dist[(X2, Y2)])
else:
    print(-1)


Measured memory_bytes: 187536
s = input()


def is_odd(num):
    if num % 2 == 0:
        return False
    else:
        return True


is_easy = True

for idx, s_i in enumerate(s):
    if is_odd(idx+1) and s_i == 'L':
        is_easy = False
        break
    elif not is_odd(idx+1) and s_i == 'R':
        is_easy = False
        break

if is_easy:
    print('Yes')
else:
    print('No')


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

int main() {
    string str;
    getline(cin, str);

    for (string::iterator it = str.begin(); it != str.end(); ++it) {
        if (0x41 <= *it && *it <= 0x5a) {
            cout << char(*it + 0x20);
            continue;
        }
        if (0x61 <= *it && *it <= 0x7a) {
            cout << char(*it - 0x20);
            continue;
        }
        cout << *it;
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 1172
h, w = map(int, input().split())
ma = []
s = 0
for i in range(h):
    k = []
    k += input()
    if k.count("#") != 0:
        ma.append(k)
        s += 1
q = []
for i in range(w):
    for j in range(s):
        if ma[j][i] == "#":
            break
    else:
        q.append(i)
for i in range(len(q)):
    for j in range(s):
        del ma[j][q[-(i+1)]]
for i in range(s):
    print("".join(ma[i]))

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int i = (int)(n); i >= 0; i--)
#define all(v) v.begin(),v.end()
typedef long long ll;

double fromradian(double x){
    return x * 180 / M_PI;
}

int main(){
    double a,b,x;
    cin >> a >> b >> x;
    if (a * a * b / 2 >= x){
        cout << setprecision(10) << fromradian(atan(a * b * b / (2 * x))) << endl;
    }
    else{
        cout << setprecision(10) << fromradian(atan((2 * (a * a * b - x)) / (a * a * a))) << endl;
    }
}


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

int main() {
	// your code goes here
	long long r,d,x,t;
	cin >> r >> d >> x;//2 10 20
	 t = r*x -d;
	cout << t << endl;
	for(int i = 2 ; i <= 10 ; i++)
	{
		t = t*r-d;
		cout << t << endl;
	}
	return 0;
}

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

using namespace std;
using ll = long long;
#define int ll
using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define PB push_back

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const int MOD = 1000000007;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template <typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }
template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a){
  out<<'('<<a.first<<','<<a.second<<')';
  return out;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
  out<<'[';
  REP(i, a.size()) {out<<a[i];if(i!=a.size()-1)out<<',';}
  out<<']';
  return out;
}

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

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

  int n;
  cin >> n;
  VI l(n), r(n);
  vector<VI> v1(n), v2(n);
  REP(i, n) {
    cin >> l[i] >> r[i];
    v1[i] = {l[i], r[i], i};
    v2[i] = {r[i], l[i], i};
  }

  sort(ALL(v1));
  sort(ALL(v2));

  VI used(n, 0);
  int now = 0;
  int idx1 = n-1, idx2 = 0;
  int ret = 0;
  while(idx1 > 0 && idx2 < n) {
    // idx1に移動
    while(idx1 > 0 && used[v1[idx1][2]]) idx1--;
    if(idx1 == 0) break;
    if(v1[idx1][0] > now || now > v1[idx1][1]) {
      ret += max(0LL, v1[idx1][0] - now);
      now = v1[idx1][0];
    }
    used[v1[idx1][2]] = true;
    // idx2に移動
    while(idx2 < n && used[v2[idx2][2]]) idx2++;
    if(idx2 == n) break;
    if(v2[idx2][1] > now || now > v2[idx2][0]) {
      ret += max(0LL, now - v2[idx2][0]);
      now = v2[idx2][0];
    }
    used[v2[idx2][2]] = true;
    // cout << idx1 << " " << idx2 << " " << now << endl;
    // cout << used << endl;
    // cout << ret << endl;
  }
  // cout << ret << endl;
  ret += abs(now);

  used.assign(n, 0);
  now = 0;
  idx1 = n-1, idx2 = 0;
  int ans = ret;
  ret = 0;
  while(idx1 > 0 && idx2 < n) {
    // idx2に移動
    while(idx2 < n && used[v2[idx2][2]]) idx2++;
    if(idx2 == n) break;
    if(v2[idx2][1] > now || now > v2[idx2][0]) {
      ret += max(0LL, now - v2[idx2][0]);
      now = v2[idx2][0];
    }
    used[v2[idx2][2]] = true;
    // idx1に移動
    while(idx1 > 0 && used[v1[idx1][2]]) idx1--;
    if(idx1 == 0) break;
    if(v1[idx1][0] > now || now > v1[idx1][1]) {
      ret += max(0LL, v1[idx1][0] - now);
      now = v1[idx1][0];
    }
    used[v1[idx1][2]] = true;
    // cout << idx1 << " " << idx2 << endl;
    // cout << used << endl;
  }
  ret += abs(now);
  // cout << ret << endl;
  chmax(ans, ret);

  cout << ans << endl;

  return 0;
}


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

#define int long long

#define all(v) (v).begin(),(v).end()
#define pb push_back
#define fi first
#define se second
#define rep(i,s,n) for(int i = s;i<n;i++)
#define repe(i,s,n) for(int i = s;i<=n;i++)
#define rrep(i,s,n) for(int i = (n)-1;i>=(s);i--)
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))
#define low(a,b) lower_bound(all(a),(b))
#define upp(a,b) upper_bound(all(a),(b))
#define fill(i,n) memset(i,n,sizeof(i)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0)
typedef long long ll;
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
typedef pair<pint,int> P1;
typedef pair<int,pint> P2;
typedef pair<pint,pint> PP;
static const ll maxLL = (ll)1 << 62;
const ll MOD=1000000007;
const ll INF=1e18;

string s;
int ans=INF;


signed main() {
    //IOS();
    /*シフト演算は(1ll<<x)*/
    cin>>s;
    rep(i,0,s.size()-2){
        int x=(s[i]-'0')*100+(s[i+1]-'0')*10+(s[i+2]-'0');
        chmin(ans,abs(753-x));
    }
    
    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 ;
typedef long long ll;
typedef pair <int , int >pi;
typedef vector <int> vi ;
typedef vector <string> si;

// void solve(){
	
// }

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

	cin >> t ;
	int as = t^0^1;

	// if (t == 0) cout << 1;
	// else cout << 0 ;
	cout << as;

	return 0 ;
}

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

int main(){
  long long X;
  cin >> X;
  long long money = 100;
  long long year = 0;
  while(true){
    money += floor(money/100);
    year += 1;
    if(money >= X){
      break;
    }
  }
  cout << year << endl;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define mem(i,a) memset(i,a,sizeof(i))
#define PI acos(-1.0)
#define DMAX 100000+5
#define MOD 998244353
#define eps 1e-8
#define mp make_pair
#define INF 1000000000+9
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
template<class T> inline void read(T &x){
    x=0; 
    T f=1;
    char ch=getchar();
    while(ch<'0' || ch>'9'){
        if(ch=='-'){
            f=-1;
        }
        ch=getchar();
    }
    while(ch<='9' && ch>='0'){
        x=x*10+(ch-'0');
        ch=getchar();
    }
    x*=f;
}
int n;
int f[DMAX];
int main(){
    read(n);
    for(int i=1;i<=100;i++){
        for(int j=1;j<=100;j++){
            for(int k=1;k<=100;k++){
                int pol=i*i+j*j+k*k+i*j+i*k+j*k;
                f[pol]++;
            }
        }
    }
    for(int i=1;i<=n;i++){
        cout<<f[i]<<endl;
    }
    return 0;
}


Measured memory_bytes: 3908
#include <bits/stdc++.h>
#include <algorithm>
#include<string>
using namespace std;
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    long long N, K; 
    cin >> N >> K;
    vector<pair<int, int>> a;
 
    a.resize(N);
    for (int n = 0; n < N; ++n) {
        cin >> a[n].first;
        cin >> a[n].second;
    }
    sort(a.begin(), a.end());
  
    for (int n = 0; n < N; ++n) {
     	K = K - a[n].second;
        if (K <= 0) {
          	cout << a[n].first;
            break;
        }
    }
 
    return 0;
}

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

int N;
int A[100000];

signed main() {
  cin >> N;
  for(int i=0; i<N; i++) cin >> A[i];

  int color = 1;
  set<pair<int,int>> s;
  s.insert(make_pair(A[0], 0));

  for(int i=1; i<N; i++) {
    int a = A[i];
    auto lb = s.lower_bound(make_pair(a,0));
    if(lb == s.end()) {
      auto rb = s.rbegin();
      int c = (*rb).second;
      s.erase(prev(s.end()));
      s.insert(make_pair(a, c));
    }
    else if(lb == s.begin()) {
      s.insert(make_pair(a, color));
      color++;
    }
    else {
      auto p = prev(lb);
      int c = (*p).second;
      s.erase(p);
      s.insert(make_pair(a, c));
    }
  }
  cout << color << endl;
}



Measured memory_bytes: 5376
#include<iostream>
using namespace std;
int main(){
    int n;
    cin>>n;
    int A[200000],B[200000];
    for(int i=0;i<n;i++) cin>>A[i]>>B[i];
    long long x=0;
    int m=1000000001;
    for(int i=0;i<n;i++){
        x+=B[i];
        if(A[i]>B[i]&&B[i]<m) m=B[i];
    }
    if(m==1000000001) cout<<0;
    else cout<<x-m;
}

Measured memory_bytes: 384
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
using namespace std;
//typedef __int64 LL;
//typedef long long int LL;
typedef pair<int,int> P;
//typedef pair<LL,LL> PL;

const int MOD=1000000007;

int kosuu[100010][2];
int ma[2],ma2[2];
int x[2];
int po=0;
	
int main()
{
	int n;cin>>n;
	for(int i=0;i<n;i++)
	{
		int x;
		cin>>x;kosuu[x][i%2]++;
	}
	
	for(int i=0;i<2;i++)
	{
		for(int j=1;j<=100000;j++)
		{
			if(ma[i]<kosuu[j][i])ma2[i]=ma[i],ma[i]=kosuu[j][i],x[i]=j;
			else if(ma2[i]<kosuu[j][i])ma2[i]=kosuu[j][i];
		}
	}
	if(x[0]!=x[1])po=ma[0]+ma[1];
	else
	{
		po=max(ma[0]+ma2[1],ma2[0]+ma[1]);
	}
	cout<<n-po<<"\n";
	return 0;
}

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

int N,A[200000][61];
ll K;

int main(){
	cin>>N>>K;
	for(int i=0;i<N;i++){
		cin>>A[i][0];
		A[i][0]--;
	}
	for(int i=0;i<60;i++){
		for(int j=0;j<N;j++){
			A[j][i+1]=A[A[j][i]][i];
		}
	}
	int p=0;
	for(int i=0;i<60;i++){
		if((K>>i)&1){
			p=A[p][i];
		}
	}
	cout<<p+1<<endl;
}


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

using namespace std;

//10 2 1
int a[4], w[4] = {0, 10, 2, 1}, x;
long long dp[5005] = {1};

int main() {
	scanf("%d%d%d%d", &a[1], &a[2], &a[3], &x);
	x /= 50;
	for(int i = 1; i <= 3; i++)
		for(int j = x; j >= 0; j--)
			if(dp[j])
				for(int k = 1; k <= a[i]; k++)
					if(j + k * w[i] <= x)
						dp[j + k * w[i]] += dp[j];
	printf("%lld\n", dp[x]);
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

#define TRUE (1)
#define FALSE (0)

int is_in_numlist (
    int *numlist,
    int list_elem_num,
    int target)
{
    int i;
    for (i = 1; i < list_elem_num; i++) {
        if ( numlist[i] == target ) {
            return TRUE;
        }
    }
    return FALSE;
}

int main (void) {
    int s;
    scanf("%d", &s);

    int numlist[1000001];
    numlist[1] = s;
    int i = 1;

    do {
        i++;
        if ( s % 2 == 0 ) {
            s /= 2;
        }
        else {
            s = 3 * s + 1;
        }
        numlist[i] = s;
    }  while ( is_in_numlist(numlist, i, s) == FALSE );

    printf("%d\n", i);
    return 0;
}

Measured memory_bytes: 2176
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <string>
#include <cmath>
using namespace std;
#define MOD 1000000007
#define INF 1<<30
#define LINF (ll)1<<62
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> P;
typedef vector<pair<ll, ll>> vpl;

ll h,w;
ll c[10][10];
ll a[205][205];
ll p[10][10];
ll cost[10];
bool visit[10];

ll d(ll start, ll dest){
    rep(i,10){
        cost[i] = INF;
        visit[i] = false;
    }
    cost[start] = 0;
    ll mn,t;
    while(1){
        mn = INF;
        rep(i,10){
            if(!visit[i] && mn > cost[i]){
                mn = cost[i];
                t = i;
            }
        }
        if(t == dest) return cost[dest];
        rep(i,10){
            cost[i] = min(cost[i],c[t][i]+cost[t]);
        }
        visit[t] = true;
    }
}

int main(){
    cin >> h >> w;
    rep(i,10){
        rep(j,10) cin >> c[i][j]; 
    }
    rep(i,h){
        rep(j,w) cin >> a[i][j];
    }
    rep(i,10){
        rep(j,10){
            p[i][j] = d(i,j);
        }
    }
    ll ans = 0;
    rep(i,h){
        rep(j,w){
            if(a[i][j] != -1 && a[i][j] != 1){
                ans += p[a[i][j]][1];
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 512
import numpy as np
h,w=map(int,input().split())
n = int(input())
a = list(map(int,input().split()))
d = [i+1 for i,x in enumerate(a) for _ in range(x)]
d = np.array(d).reshape((h,w))
for i,x in enumerate(d):
  if i%2==0:
    print(*x,sep=" ")
  else:
    print(*x[::-1],sep=" ")

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

int main(){
    int N, count = 0;
    string S;
    char c;

    std::cin >> N >> S;

    for(int i = 0; i < N-2; i++){
        c = S.at(i);
        if(c == 'A'){
            if(S.at(i+1) == 'B'){
                if(S.at(i+2) == 'C'){
                    count++;
                }
            }
        }
    }

    std::cout << count;

}


Measured memory_bytes: 3624
#include <stdio.h>

int search(int a[], int n, int key) {
  int i = 0;
  a[n] = key;

  while (a[i] != key) i++;

  return i != n;
}

int main() {
  int i;
  int count = 0;
  int key;
  int n, q;
  scanf("%d", &n);
  int a[n];
  for (i = 0; i < n; i++)
    scanf("%d", &a[i]);

  scanf("%d", &q);
  for (i = 0; i < q; i++) {
    scanf("%d", &key);
    if (search(a, n, key)) ++count;
  }

  printf("%d\n",count);

  return 0;
}



Measured memory_bytes: 1992