akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>

#define MAX_N 20

int A[MAX_N] = { 0 };

bool solve(const int &i, const int &M, const int &n) {
	if (M == 0) {
		return true;
	}
	else if (i >= n) {
		return false;
	}
	bool res = solve(i + 1, M, n) || solve(i + 1, M - A[i], n);
	return res;
}

int main() {
	int n;
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d", &A[i]);
	}
	int q;
	scanf("%d", &q);
	for (int i = 0; i < q; i++) {
		int M;
		scanf("%d", &M);
		if (solve(0,M,n)) {
			printf("yes\n");
		}
		else {
			printf("no\n");
		}
	}
	return 0;
}

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


int main() {
  int n;
  cin >> n;
  vector<pair<ll,ll>> se(n);
  rep(i,n) cin >> se[i].first >> se[i].second;
  map<pair<ll,ll>,int> mp;
  rep(i,n) rep(j,n) {
    if(i==j) continue;
    mp[{se[i].first-se[j].first,se[i].second-se[j].second}]++;
  }
  int ans = n;
  for(auto p : mp) {
    ans = min(ans,n-p.second);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3796
#include<iostream>
#include<algorithm>
#include<string>
#include<cmath>
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: 3560
#include <bits/stdc++.h>
using namespace std;
using ll = long long;


template <typename T>
struct SegmentTree {
    using F = function<T(T, T)>;

    int size;
    vector<T> node;
    const F f;
    const T I;

    SegmentTree(int n, const F f, const T& I) : f(f), I(I) {
        size = 1;
        while (size < n) size <<= 1;
        node.resize(2 * size, I);
    }

    T& operator[](int k) {
        return node[k + size];
    }

    void build() {
        for (int k = size - 1; k > 0; k--) {
            node[k] = f(node[2 * k], node[2 * k + 1]);
        }
    }

    void update(int k, const T& x) {
        k += size;
        node[k] = x;
        while (k >>= 1) {
            node[k] = f(node[2 * k], node[2 * k + 1]);
        }
    }

    T query(int a, int b) {
        T L = I, R = I;
        for (a += size, b += size; a < b; a >>= 1, b >>= 1) {
            if (a & 1) L = f(L, node[a++]);
            if (b & 1) R = f(node[--b], R);
        }
        return f(L, R);
    }
};

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

    int n, q;
    cin >> n >> q;
    SegmentTree<int> segtree(n, [](int a, int b) { return a + b; }, 0);
    while (q--) {
        int com, x, y;
        cin >> com >> x >> y;
        if (com == 0) segtree.update(x, segtree[x] + y);
        else cout << segtree.query(x, y + 1) << '\n';
    }
}


Measured memory_bytes: 3752
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] x = new int[n];
		for (int i = 0; i < n; i++) {
			x[i] = sc.nextInt();
		}
		int sum = 0;
		int min = Integer.MAX_VALUE;
		for (int i = 0; i < 100; i++) {
			for (int j = 0; j < n; j++) {
				sum += (x[j]-i)*(x[j]-i);
			}
			min = Math.min(min,sum);
			sum = 0;
		}
		System.out.println(min);
		sc.close();
	}
}

Measured memory_bytes: 23124
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
void *wmem;
char memarr[96000000];
template<class T> inline void walloc1d(T **arr, int x, void **mem = &wmem){
  static int skip[16] = {0, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1};
  (*mem) = (void*)( ((char*)(*mem)) + skip[((unsigned long long)(*mem)) & 15] );
  (*arr)=(T*)(*mem);
  (*mem)=((*arr)+x);
}
inline int my_getchar_unlocked(){
  static char buf[1048576];
  static int s = 1048576;
  static int e = 1048576;
  if(s == e && e == 1048576){
    e = fread_unlocked(buf, 1, 1048576, stdin);
    s = 0;
  }
  if(s == e){
    return EOF;
  }
  return buf[s++];
}
inline void rd(char &c){
  int i;
  for(;;){
    i = my_getchar_unlocked();
    if(i!=' '&&i!='\n'&&i!='\r'&&i!='\t'&&i!=EOF){
      break;
    }
  }
  c = i;
}
inline int rd(char c[]){
  int i;
  int sz = 0;
  for(;;){
    i = my_getchar_unlocked();
    if(i!=' '&&i!='\n'&&i!='\r'&&i!='\t'&&i!=EOF){
      break;
    }
  }
  c[sz++] = i;
  for(;;){
    i = my_getchar_unlocked();
    if(i==' '||i=='\n'||i=='\r'||i=='\t'||i==EOF){
      break;
    }
    c[sz++] = i;
  }
  c[sz]='\0';
  return sz;
}
struct MY_WRITER{
  char buf[1048576];
  int s;
  int e;
  MY_WRITER(){
    s = 0;
    e = 1048576;
  }
  ~MY_WRITER(){
    if(s){
      fwrite_unlocked(buf, 1, s, stdout);
    }
  }
}
;
MY_WRITER MY_WRITER_VAR;
void my_putchar_unlocked(int a){
  if(MY_WRITER_VAR.s == MY_WRITER_VAR.e){
    fwrite_unlocked(MY_WRITER_VAR.buf, 1, MY_WRITER_VAR.s, stdout);
    MY_WRITER_VAR.s = 0;
  }
  MY_WRITER_VAR.buf[MY_WRITER_VAR.s++] = a;
}
inline void wt_L(char a){
  my_putchar_unlocked(a);
}
inline void wt_L(const char c[]){
  int i=0;
  for(i=0;c[i]!='\0';i++){
    my_putchar_unlocked(c[i]);
  }
}
template<class T> int Distinct(int N, T A[], int sorted=0, void *mem = wmem){
  int i;
  int k;
  int res = 1;
  T *a;
  if(N==0){
    return 0;
  }
  if(sorted){
    for(i=(1);i<(N);i++){
      if(A[i]!=A[i-1]){
        res++;
      }
    }
  }
  else{
    walloc1d(&a,N,&mem);
    for(i=(0);i<(N);i++){
      a[i] = A[i];
    }
    sort(a,a+N);
    for(i=(1);i<(N);i++){
      if(a[i]!=a[i-1]){
        res++;
      }
    }
  }
  return res;
}
char S[5];
int main(){
  wmem = memarr;
  rd(S);
  if(Distinct(3,S)==1){
    wt_L("No");
    wt_L('\n');
  }
  else{
    wt_L("Yes");
    wt_L('\n');
  }
  return 0;
}
// cLay varsion 20200303-1 [beta]

// --- original code ---
// char S[5];
// {
//   rd(S);
//   wt(if[Distinct(3,S)==1, "No", "Yes"]);
// }


Measured memory_bytes: 256
def tax(p,x):
    return p*(100+x)//100
def solve(X,Y,S):
    max = 0
    for a in range(1,S):
        for b in range(1,S):
            sum = tax(a,X)+tax(b,X)
            if sum == S:
                if max < tax(a,Y) + tax(b,Y):
                    max = tax(a,Y) + tax(b,Y)
            if sum > S:
                    break
    return max

while True:
    X,Y,S = map(int,input().split())
    if X == 0:
        break
    print(solve(X,Y,S))




Measured memory_bytes: 5600
#include <iostream>
using namespace std;
int main()
{
	int a;
	int b;
	cin >> a;
	cin >> b;
	if (a > b)
		cout << "a > b" << endl;
	else if (a == b)
		cout << "a == b" << endl;
	else if (a < b)
		cout << "a < b" << endl;
}


Measured memory_bytes: 3096
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();

		if (B % A == 0) {
			System.out.println(A + B);
			
		} else {
			System.out.println(B - A);
		}

	}

}


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

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    int count = 0;
    rep(i,n) count +=a[i];
    cout<< count -n <<endl;
 }

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

using namespace std;

const int MAX = 2e5 + 1;

int N, a[MAX], d[MAX], ans[MAX];
vector<int> v[MAX];

void calc(int p, int q){
	if(ans[p]){
		return;
	}
	int k = lower_bound(d, d + q, a[p]) - d;
	if(k == q){
		q++;
	}
	ans[p] = q;

	int temp = d[k];
	d[k] = a[p];
	for(auto t: v[p]){
		calc(t, q);
	}
	d[k] = temp;
}

int main(){
	cin >> N;
	for (int i = 1; i <= N; i++){
		cin >> a[i];
	}
	for (int i = 0; i < N - 1; i++){
		int tu, tv;
		cin >> tu >> tv;
		v[tu].push_back(tv);
		v[tv].push_back(tu);
	}
	for (int i = 0; i < N; i++){
		d[i] = 1e9;
	}

	calc(1, 0);
	for (int i = 1; i <= N; i++){
		cout << ans[i] << endl;
	}
	return 0;
}


Measured memory_bytes: 28372
#include <bits/stdc++.h>
// #include <boost/multiprecision/cpp_int.hpp>
// using i128 = boost::multiprecision::int128_t;
#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;
using ld = long double;
using V = vector<int>;
using Vll = vector<ll>;
using Vld = vector<ld>;
using Vbo = vector<bool>;
using VV = vector<V>;
using VVll = vector<Vll>;
using VVld = vector<Vld>;
using VVbo = vector<Vbo>;
using VVV = vector<VV>;
using VVVll = vector<VVll>;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
using Pld = pair<ld, ld>;
#define rep2(i, m, n) for(int i=int(m); i<int(n); ++i)
#define drep2(i, m, n) for(int i=int(m)-1; i>=int(n); --i)
#define rep(i, n) rep2(i, 0, n)
#define drep(i, n) drep2(i, n, 0)
#define all(a) a.begin(), a.end()
struct fast_ios { fast_ios(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
template<typename T> inline int sz(T &x) { return x.size(); }
template<typename T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
template<typename T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.first >> p.second; return is; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
template<typename T> istream &operator>>(istream &is, vector<T> &v) { for (auto &e : v) is >> e; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &v) { for (auto &e : v) os << e << " "; return os; }
template<typename T> inline int count_between(vector<T> &a, T l, T r) { return lower_bound(all(a), r) - lower_bound(all(a), l); } // [l, r)
inline int fLog2(const int x) { return 31-__builtin_clz(x); } // floor(log2(x))
inline int fLog2(const ll x) { return 63-__builtin_clzll(x); }
inline int cLog2(const int x) { return (x == 1) ? 0 : 32-__builtin_clz(x-1); } // ceil(log2(x))
inline int cLog2(const ll x) { return (x == 1) ? 0 : 64-__builtin_clzll(x-1); }
inline int popcount(const int x) { return __builtin_popcount(x); }
inline int popcount(const ll x) { return __builtin_popcountll(x); }
const int INF  = 1<<30;
const ll INFll = 1ll<<62;
const ld EPS   = 1e-10;
const ld PI    = acos(-1.0);
const int MOD  = int(1e9)+7;
// const int MOD  = 998244353;


int main() {
  ll n, a; cin >> n >> a;

  auto f = [&] (ll y) {
    ll res = 0;
    rep2(k, 1, 100) rep(l, 100) {
      ll x = y - a*(k+l-1) - l;
      x /= (k+l);
      if (x <= 0) break;
      ll res = 1;
      rep(i, k) {
        if (res > n/x) return true;
        res *= x;
        if (res >= n) return true;
      }
      rep(i, l) {
        if (res > n/(x+1)) return true;
        res *= x+1;
        if (res >= n) return true;
      }
    }
    return false;
  };

  ll ok = n;
  ll ng = 0;
  while (llabs(ok - ng) > 1) {
    ll md = (ok + ng) / 2;
    if (f(md)) ok = md;
    else ng = md;
  }

  ll ans = ok;
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
#include <fstream>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>


typedef  long long ll;
typedef long double ld;
using namespace std;
using namespace __gnu_pbds;


#define endl "\n"
#define FIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ordered_set tree<pair<int,int>, null_type,less<pair<int,int>>, rb_tree_tag,tree_order_statistics_node_update>
const int N=1e7+5, mxN=1e7;
int mod=1000000007 ;
ll mul(ll x, ll y)
{
    x%=mod;
    y%=mod;
    return (x*y)%mod;
}
ll add(ll x, ll y)
{
    x%=mod;
    y%=mod;
    return (x+y+mod)%mod;
}
ll fast_pow(ll b, ll p)
{
    if(!p)return 1;
    ll ans=fast_pow(b,p/2);
    ans=mul(ans,ans);
    if((p&1))ans=mul(ans,b);
    return ans;
}
string s;
bool check(int d)
{
    if(d>s.size()/2)
    return 0;

    string temp;
    for(int i=0;i<d;i++)
        temp.push_back(s[i]);
    map<string,vector<int>>mp;
   mp[temp].push_back(d-1);

    for(int i=d;i<s.size();i++)
    {
        temp.push_back(s[i]);
        temp.erase(0,1);

        mp[temp].push_back(i);
        if(mp[temp].size()>1)
        {
            if(mp[temp].back()-mp[temp].front()>=d)
                return 1;
        }
    }
    return 0;


}
int main()
{


int n;
cin>>n>>s;
int low=1,high=n/2;
int ans=0;
while(low<=high)
{
    int mid=(low+high)/2;
    if(check(mid))
    {
        ans=mid;
        low=mid+1;
    }
    else high=mid-1;


}
cout<<ans;
    return 0;
}


Measured memory_bytes: 6800
#include <bits/stdc++.h>
 
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n)  for(int i=0;i<(n);++i)
#define REPr(i, n) for(int i=(n)-1;i>=0; --i)
#define FORq(i, m, n) for(int i = (m);i <= (n);++i)
#define FORqr(i, m, n) for(int i = (n);i >=(m);--i)
#define PB push_back
#define MP make_pair
#define DEBUG printf("%s\n","debug")
#define fst first
#define snd second
#define SIN(x, S) (S.count(x) != 0)
#define M0(x) memset(x,0,sizeof(x))
#define FILL(x, y) memset(x,y,sizeof(x))
#define MM(x) memset(x,-1,sizeof(x))
#define ALL(x) (x).begin(),(x).end()
using namespace std;
typedef pair<int, int> PII;
typedef pair<long long, long long> PLL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef long long ll;
typedef long long integer;
///////////////////////////////////////////////
/* (๑╹◡╹) */
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll MOD = 1000000007;
template<class T>
inline bool chmin(T &a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
 /* (๑╹◡╹)(๑╹◡╹)(๑╹◡╹)*/
template<class T>
inline bool chmax(T &a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
/* (๑╹◡╹)(๑╹◡╹)(๑╹◡╹)(๑╹◡╹)(๑╹◡╹)(๑╹◡╹) */
///////////////////////////////////////////////
const int MAX = 510000;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 



int main() {
//	COMinit();
	ll ans = 0;
	int N,Q; cin >> N >> Q;
	vector<pair<int, int> > B(N-1);
	for (int i = 0; i < N-1; i++)
	{
		cin >> B[i].first >> B[i].second;
	}
	sort(ALL(B));

	int A[N] = {};
	for (int i = 0; i < Q; i++)
	{
		int p,x; cin >> p >> x;
		A[p-1] += x;
	}
	
	for (int i = 0; i < N-1; i++)
	{
		A[B[i].second-1] += A[B[i].first-1];
	}
	
	for (int i = 0; i < N; i++)
	{
		cout << A[i] << ' ';
	}
	cout << endl;

}


Measured memory_bytes: 4736
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N=3005;
int n,m,k,a[N][N],dp[N][N][4];
void chmax(int &a,int b){if(a<b)a=b;}
signed main()
{
	ios::sync_with_stdio(false);
	cin>>n>>m>>k;
	for(int i=1;i<=k;i++)
	{
		int x,y,v;
		cin>>x>>y>>v;
		a[x][y]=v;
	}
	dp[1][1][1]=a[1][1];
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++)
		{
			for(int k=0;k<=3;k++)
			{
				chmax(dp[i+1][j][0],dp[i][j][k]);
				chmax(dp[i][j+1][k],dp[i][j][k]);
				chmax(dp[i+1][j][1],dp[i][j][k]+a[i+1][j]);
				if(k<3) chmax(dp[i][j+1][k+1],dp[i][j][k]+a[i][j+1]);
			}
		}
	}
	cout<<max(max(dp[n][m][0],dp[n][m][1]),max(dp[n][m][2],dp[n][m][3]))<<endl;
	return 0;
}

Measured memory_bytes: 355776
//C
#include <cassert>
#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>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>

//C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#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>
#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 <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>

//Others
template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
const int dx[8] = { -1, 0, 1, -1, 1, -1, 0, 1 };
const int dy[8] = { 1, 1, 1, 0, 0, -1, -1, -1 };
const int lr[4] = { 0, 1, 0, -1 };
const int ud[4] = { 1, 0, -1, 0 };



//LOVE Ayane Sakura



using namespace std;

long long GCD(long long a, long long b) {
	if (a < b) {
		swap(a, b);
	}
	long long r = -1;
	while (r != 0) {
		r = a % b;
		a = b;
		b = r;
	}
	return a;
}

int main() {
	int N, M;
	cin >> N >> M;
	vector<int>A(M);
	int sum = 0;
	for (int i = 0; i < M; i++) {
		cin >> A[i];
		sum += A[i];
	}
	if (sum <= N) {
		cout << N - sum << endl;
	}
	else {
		cout << -1 << endl;
	}
}

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

using namespace std;

int main(void)
{
	long long a, v, b, w, t;
	cin >> a >> v >> b >> w >> t;
	if ((v-w) * t >= abs(b-a))
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
	return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp> 
//using boost::multiprecision::cpp_int;
using namespace std;
#define ll long long int
#define F first
#define S second
//#define endl "\n"
//#define nl cout<<endl;
#define pb push_back
#define ull unsigned long long 
#define f(i,a,b) for(ll i=a;i<b;i++)
#define Knucklehead ios_base::sync_with_stdio(false);cin.tie(NULL);
//#define mod 100000007
#define mat vector<vector<ll>>
mat cn(ll n, ll m){return vector< vector<ll> >(n, vector<ll>(m));}
bool compare(char &s1,char &s2){return s1 > s2;} 
bool sortmahstyle(const pair<ll,ll> &a,  const pair<ll,ll> &b) 
{ 
    if(a.second > b.second )
        return true;
    if( a.second==b.second && a.first > b.second )
       return true;
    return false;
}
bool cmp(int n, pair<int, int> const& p)
{
    return (p.first < n);
}
//me
ll const mod = 1e9+7;//998244353;
ll const inf = 1e18;
ll const maxn = 1e5+1;


void solve()
{    
     
     ll r,D,x; cin >> r >> D >> x;

     ll ans = x;
     f(i,0,10){
          ans = r*ans - D;
          cout << ans << endl;
     }     

}

int main() {
Knucklehead 
//*
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
/**/ 
        
          ll t;
          /**/t=1;
          /*/cin>>t;/**/
          f(testcases,0,t){
               //cout << "Case #" <<testcases+1<<": ";
               solve();
          }
 
 
    return 0;
}

Measured memory_bytes: 3576
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <numeric>
#include <set>
#include <unordered_set>
#include <queue>
#include <boost/math/constants/constants.hpp>
#include <boost/math/common_factor_rt.hpp>
 
using namespace std;
#define ll long long
#define rep(i, n) for(int i = 0;i < n;i++)
#define FOR(i, n, m) for(int i=n; i<m; ++i)
 
int main() {
  ll X;
  cin >> X;
  
  ll a = 100;
  ll count = 0;
  ll n;
  
  while(1){
    count += 1;
    
    n = a%100;
    a/=100;
    
    a = a*101+(n*101/100);
    
    if(X<=a){
      break;
    }
  }
  
  cout << count << endl;
  
}

Measured memory_bytes: 3600
# dequeでいくわ
from collections import deque
n = int(input())
a = list(input().split())
ans = deque()
for i in range(n):
    if i % 2 == 0:
        ans.append(a[i])
    else:
        ans.appendleft(a[i])
if n % 2 == 1:
    ans = list(ans)[::-1]
print(" ".join(ans))

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

//typedef long long LL;
const int MV=1e5+5;
const int MB=20;

struct Edge
{
	int v,c,d;
	Edge(int v=0,int c=0,int d=0)
		:v(v),c(c),d(d){}
};
vector<Edge> g[MV];

int dfn[MV*2],pos[MV];
int n,q;

vector<int> id[MV];
vector<int> sum[MV];
vector<int> cnt[MV];
int ndfn=0;

void init()
{
	for(int i=0;i<=n;i++)
	{
		id[i].push_back(0);
		sum[i].push_back(0);
		cnt[i].push_back(0);
	}
	ndfn=0;
}

int dis[MV];
void dfs(int u,int fa,int c,int d,int nd)
{
	//cout<<u<<" "<<c<<endl;
	dfn[++ndfn]=u;
	pos[u]=ndfn;
	id[c].push_back(ndfn);
	sum[c].push_back(sum[c].back()+d);
	cnt[c].push_back(cnt[c].back()+1);
	dis[u]=nd;
	//cout<<u<<endl;
	for(Edge e:g[u])
	{
		int v=e.v;
		if(v==fa) continue;
		dfs(v,u,e.c,e.d,nd+e.d);
	}
	id[c].push_back(++ndfn);
	sum[c].push_back(sum[c].back()-d);
	cnt[c].push_back(cnt[c].back()-1);
}

int fa[MV][MB],dep[MV];
void dfs_fa(int u,int f,int depth)
{
	dep[u]=depth;
	for(Edge e:g[u])
	{
		int v=e.v;
		if(v==f) continue;
		if(!fa[v][0])
		{
			fa[v][0]=u;
			dfs_fa(v,u,depth+1);
		}
	}
		
}
void init_lca(int root)
{
	memset(fa,0,sizeof(fa));
	dfs_fa(root,0,0);
	for(int j=1;j<MB;j++)
		for(int i=1;i<=n;i++)
			fa[i][j]=fa[fa[i][j-1]][j-1];
}
int lca(int a,int b)
{
	if(dep[a]>dep[b]) swap(a,b);
	int k=dep[b]-dep[a];
	for(int i=0;(1<<i)<=k;i++)
		if(k&(1<<i)) b=fa[b][i];
	if(a==b) return a;
	for(int i=MB-1;i>=0;i--)
	{
		if(fa[a][i]!=fa[b][i])
		{
			a=fa[a][i];
			b=fa[b][i];
		}
	}
	return fa[a][0];
}

inline int getsum(int u,int c,int d)
{
	int p=upper_bound(id[c].begin(),id[c].end(),pos[u])-id[c].begin()-1;
	//cout<<p<<endl;
	int ans=dis[u]-sum[c][p]+cnt[c][p]*d;
	//cout<<u<<" "<<dis[u]<<" "<<sum[c][p]<<" "<<cnt[c][p]<<" "<<ans<<endl;
	return ans;
}

int main()
{
	//freopen("F_in.txt","r",stdin);
	scanf("%d%d",&n,&q);
	int u,v,c,d;
	for(int i=1;i<n;i++)
	{
		scanf("%d%d%d%d",&u,&v,&c,&d);
		g[u].emplace_back(v,c,d);
		g[v].emplace_back(u,c,d);
	}
	init();
	dfs(1,0,0,0,0);
	// for(int i=1;i<=n;i++)
	// 	cout<<dis[i]<<" ";
	// cout<<endl;
	// for(int i=1;i<=n;i++)
	// 	cout<<pos[i]<<" ";
	// cout<<endl;
	// for(int i=0;i<=n-1;i++)
	// {
	// 	cout<<"id "<<i<<":";
	// 	for(int j:id[i])
	// 		cout<<" "<<j;
	// 	cout<<endl;
	// 	cout<<"sum "<<i<<":";
	// 	for(int j:sum[i])
	// 		cout<<" "<<j;
	// 	cout<<endl;
	// 	cout<<"cnt "<<i<<":";
	// 	for(int j:cnt[i])
	// 		cout<<" "<<j;
	// 	cout<<endl;
	// }
	init_lca(1);
	while(q--)
	{
		scanf("%d%d%d%d",&c,&d,&u,&v);
		int l=lca(u,v);
		//cout<<l<<endl;
		printf("%d\n",getsum(u,c,d)+getsum(v,c,d)-2*getsum(l,c,d));
	}
	return 0;
}

Measured memory_bytes: 42976
#include<iostream>
#include<string>

using namespace std;

int main() {
	int N;
	int Q;
	string S;

	cin >> N >> Q;

	cin >> S;
	int size = S.size();

	int* ans = new int[Q];
	ans[0] = 0;
	for (int i = 1; i < N; i++) {
		ans[i] = ans[i - 1];
		if (S[i] == 'C' && S[i - 1] == 'A') {
			ans[i]++;
		}
	}
	int l, r;
	for (int i = 0; i < Q; i++) {
		cin >> l >> r;
		cout << ans[r - 1] - ans[l - 1] << endl;
	}

}

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

int n,k,a,b;
string s,t;

int main() {
  cin >> n >> s >> k;
  rep(i,n){
    if(s[i]!=s[k-1])
    s[i]='*';   
  }
  cout << s << endl;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;
public class Main {
    public static void main(String[] args){
      Scanner scan = new Scanner(System.in);
        int i,v;
        for(;;){
            int h = scan.nextInt();
            int w = scan.nextInt();
            if(h == 0 && w == 0)
                break;
            for(i = 1; i <= h; i++){
              for(v = 1; v <= w; v++){
                  System.out.print("#");
                }
                  System.out.println("");
                }
                System.out.println("");
              }
  }
}

Measured memory_bytes: 32840
#include <stdio.h>
#include <ctype.h>

int to_i[128];

int mcxi2int(char *s)
{
    int i, d=1, res=0;
    for(i=0;s[i];++i) {
        if (isdigit(s[i])) {
            d=s[i]-'0';
        }
        else {
            res+=to_i[s[i]]*d;
            d=1;
        }
    }
    return res;
}
int main(void)
{
    int n;
    char *s="mcxi";
    scanf("%d", &n);
    to_i['m']=1000, to_i['c']=100, to_i['x']=10, to_i['i']=1;
    while (n--) {
        char a[10], b[10];
        int c, d, i;
        scanf("%s%s", a, b);
        c=mcxi2int(a)+mcxi2int(b);
        d=1000;
        for(i=0;i<4;++i,c%=d,d/=10) {
            int t=c/d;
            if (t) {
                if (t>1) printf("%d", t);
                putchar(s[i]);
            }
        }
        puts("");
    }
    return 0;
}

Measured memory_bytes: 616
from heapq import heappush, heappop
from collections import deque,defaultdict,Counter
import itertools
from itertools import permutations
import sys
import bisect
import string
sys.setrecursionlimit(10**6)
def SI():
    return input().split()
def MI():
    return map(int,input().split())
def I():
    return int(input())
def LI():
    return [int(i) for i in input().split()]
YN=['Yes','No']
mo=10**9+7

n=I()
a=LI()
ans=0
c=0

for i in range(n-1):
    if a[i+1]<=a[i]:
        c+=1
    else:
        ans=max(ans,c)
        c=0
    
ans=max(ans,c)
print(ans)


Measured memory_bytes: 64240
#include<stdio.h>
int main(void)
{
    int a,s,d,f,g,h,j,k,l,q;
    scanf("%d %d %d %d",&a,&s,&d,&f);
    scanf("%d %d %d %d",&g,&h,&j,&k);
    l=a+s+d+f;
    q=g+h+j+k;
    if(l>=q)printf("%d\n",l);
    else printf("%d\n",q);


    return 0;
}

Measured memory_bytes: 1784
#include<stdio.h>

int main(){

	int n;
	
	scanf("%d",&n);
	
	int vetor[n];
	
	for(int i = 0; i<n ; ++i){
		scanf("%d",&vetor[i]);
		}
	int maior = vetor[0];
	int menor = vetor[0];
	
	for(int i = 0; i<n; ++i){
		if(vetor[i]>maior){
			maior = vetor[i];
		}
			
		if(vetor[i]<menor){
			menor = vetor[i];
		}
	}
	
	printf("%d\n",maior-menor);
		
	return 0;
}


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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(a)     (a).begin(),(a).end()
#define VI         vector<int>
#define MOD 1000000007

using ll = long long int;
using P = pair<int,int>;

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

const ll INF=(ll)1e19;
//const int INF=(1<<30);

int main(){
  int a[3];
  REP(i,3)cin >> a[i];
  sort(a,a+3);
  cout << a[0]+a[1]+10*a[2] << endl;
  
}



Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <vector>
#include <cstring>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <utility>
#include <queue>
#include <deque>
#include <stack>
#include <time.h>
#include <stdlib.h>
#include <bitset>
#include <algorithm>

#include <chrono>

#define INF 1e9
#define LL_INF 1e18

#define nmax 200010

#define fst first
#define snd second
#define pb push_back
#define SZ(x) ((int)(x.size()))

#define MOD 1000000007
#define MOD1 998244353
#define MOD2 666013
#define P1 255
#define P2 2059

using namespace std;

typedef long long int ll;

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

int n;
double p[3010], dp[3010][3010]; // dp[i][j] , i'th position, j # of heads

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

    for (int i = 1; i <= n; i++) scanf("%lf", &p[i]);

    dp[0][0] = 1;

    for (int i = 1; i <= n; i++) {

        for (int j = 0; j <= i; j++) {

            dp[i][j] = dp[i][j] + dp[i - 1][j] * (1 - p[i]);
            
            if (j < i) dp[i][j + 1] = dp[i][j + 1] + dp[i - 1][j] * p[i];
        }
    }

    double answer = 0;

    for (int i = n / 2 + 1; i <= n; i++) answer = answer + dp[n][i];
        
    printf("%.10lf", answer);

    // IMPORTANT!!!!!
    // Are you missing something????
    // check limits, int or ll

    return 0;
}

Measured memory_bytes: 69120
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <map>
#include <string>

#define reps(i,s,n) for(int (i) = (s); (i) < (n); (i)++)
#define rep(i,n) reps(i,0,n)
using namespace std;
using ll = long long;

int main(){
    int n;
    string sa,sb,sc;
    cin >> n;
    cin >> sa >> sb >> sc;
    int cnt = 0;
    rep(i,n){
        if(sa[i] != sb[i] && sb[i] != sc[i] && sc[i] != sa[i]){
            cnt += 2;
        }else if(sa[i] == sb[i] && sb[i] == sc[i] && sc[i] == sa[i]){
            cnt += 0;
        }else{
            cnt += 1;
        }
    }

    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
N=int(input())
ls=[int(s) for s in input().split()]
ls2=[0 for s in range(N)]
ls2[0]=ls[0]
for i in range(1,N):
  ls2[i]=min([ls[i],ls2[i-1]])
count=0
for i in range(N):
  if ls[i]==ls2[i]:
    count+=1
print(count)


Measured memory_bytes: 24744
#f
#change the limit of how much depth of recursive func is available. 
import sys
sys.setrecursionlimit(2 * 10 ** 5 + 10)
 

n = int(input())
E = [[] for _ in range(n)]
mod = 10**9 + 7

for i in range(n-1):
    a,b = [int(x) for x in input().split()]
    E[a-1].append((b-1, i)) 
    E[b-1].append((a-1, i)) 
    
X = [0] * n
    
def dfs(u,e):
    num = 1
    for v,c in E[u]:
        if c != e:
            num += dfs(v,c)
    X[e] = num 
    return num

dfs(0, -1)

I = [1]
inv = pow(2, mod-2, mod)
for i in range(n):
    I.append(I[-1] * inv % mod)

ans = 0
for i in range(n):
    x = X[i]
    ans += (1-I[x])*(1-I[n-x]) % mod
    
ans -= n * I[1]
ans += 1 - I[n]
ans %= mod
print(ans)



Measured memory_bytes: 198572
#include <bits/stdc++.h>
using namespace std;
int main() {
  long n, d;
  cin >> n >> d;
  long x[n], y[n];
  for(int i=0; i<n; i++) {
    cin >> x[i] >> y[i];
  }
  long cnt=0;
  for(long i=0; i<n; i++) {
    if(d*d>=x[i]*x[i]+y[i]*y[i]) {
      cnt++;
    }
  }
  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 6756
#include<bits/stdc++.h>
using namespace std;
int main(){
int N,K;
  cin>>N>>K;
  int ans=1;
  for(int i=0;i<N;i++){
  if(ans<=K)
    ans*=2;
    else
      ans+=K;
  
  }cout<<ans<<endl;
   return 0;
  
}

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

int main() {
	int	n;
	int ans;

	cin >> n ;
	if(n>888) ans=999;
	else if(n>777) ans=888;
	else if(n>666) ans=777;
	else if(n>555) ans=666;
	else if(n>444) ans=555;
	else if(n>333) ans=444;
	else if(n>222) ans=333;
	else if(n>111) ans=222;
	else ans=111;
	cout << ans << endl;
	return 0;
}

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

#define pout(n)  printf ("%d\n", n)

#define rep(i,a,n) for (int i = a;i < n;i++)
#define per(i,n,a) for (int i = n-1;i >= a;i--)

typedef long long ll;
using namespace std;
 
int main (){
  int k,s,count = 0;
  cin >> k >> s;

  rep(x,0,k+1){
    rep(y,0,k+1){
      int z = s-x-y;
      if(0 <= z && z <= k) count++;
      }
  }
  
  pout(count);
  return 0;
}

Measured memory_bytes: 384
import math
N, D = map(int,input().split())

X = []
for i in range(N):
    array = list(map(int, input().split()))
    X.append(array)
    
count = 0

for i in range(N):
  for j in range(i+1, N):
    L = []
    for k in range(D):
      L.append((X[i][k] - X[j][k])**2)
    y = sum(L)
    z = math.sqrt(y)
    if z - int(z) == 0:
      count += 1
print(count)

Measured memory_bytes: 3064
#include<iostream>
using namespace std;
int main(){
    int A,B,C,X;
    int i,j,k;
    cin>>A>>B>>C>>X;
    int count=0;
    for(i=0;i<=A;i++ ){
    for(j=0;j<=B;j++ ){
    for(k=0;k<=C;k++ ){
    if(X==500*i+100*j+50*k){
    count++;
    }
    }}}
    cout<<count<<endl;
    }

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
  long long N;
  cin >> N;
  long long a[N], m[N];
  for(int i=0;i<N;++i) m[i] = 0;
  for(int j=0;j<N;++j) {
    cin >> a[j];
    ++m[a[j]-1];
  }
  long long cnt1=0;
  for(int k=0;k<N;++k) if(m[k]>1) cnt1 += m[k] * (m[k]-1) / 2;
  for(int l=0;l<N;++l) {
    if(m[a[l]-1]>1) cout << cnt1 - (m[a[l]-1]-1) << endl;
    if(m[a[l]-1] <=1) cout << cnt1 << endl;
  }
}

Measured memory_bytes: 5760
#include <stdio.h>
#include <limits.h>
#include <math.h>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cstring>
#include <string>
#include <sstream>
#include <algorithm>
#include <iomanip>
#include <iostream>

#define VARIABLE(x) cerr << #x << "=" << x << endl
#define BINARY(x) static_cast<bitset<16> >(x);
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for (int i=m;i<(int)(n);i++)
#define if_range(x, y, w, h) if (0<=(int)(x) && (int)(x)<(int)(w) && 0<=(int)(y) && (int)(y)<(int)(h))

const int INF = 100000000;
typedef double D;
const double EPS = 1e-8;
const double PI = 3.14159;
int dx[4]={-1, 0, 1, 0}, dy[4]={0, -1, 0, 1};
using namespace std;
typedef pair<int, int> P;

/** Problem1124 : When Can We Meet? **/
bool cmp(const P &a, const P &b) {
	if (a.first != b.first) return a.first>b.first;
	else return a.second<b.second;
}

int main()
{
	int N, Q;
	while (cin>>N>>Q, N||Q) {
		int day = 0;
		vector<set<int> > list(N);
		rep(i, N) {
			int a, b; cin>>a;
			
			rep(j, a) {
				cin>>b; day = max(day, b);
				list[i].insert(b);
			}
		}
		vector<P> can;
		can.push_back(P(0, 0));

		REP(i, 1, day+1) {
			int tmp=0;
			rep(j, N) {
				if (list[j].count(i)) {
					tmp++;
				}
			}
			
			if (tmp>=Q) {
				can.push_back(P(tmp, i));
			}
		}

		sort(can.begin(), can.end(), cmp);
		cout << can[0].second << endl;
	}
}

Measured memory_bytes: 1288
#include <iostream>
#include <fstream>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <ctime>
#include <algorithm>
#include <sstream>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <cstdlib>
#include <cstdio>
#include <iterator>
#include <functional>
#include <bitset>

#ifdef LOCAL
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
clock_t __my_start_clock = clock();
#else
#define eprintf(...)
#endif

#define TIMESTAMP(x) eprintf("["#x"] Time : %.3lf s.\n", (clock() - __my_start_clock)*1.0/CLOCKS_PER_SEC)
#define TIMESTAMPf(x,...) eprintf("[" x "] Time : %.3lf s.\n", __VA_ARGS__, (clock() - __my_start_clock)*1.0/CLOCKS_PER_SEC)

using namespace std;

#ifdef LOCAL
static struct __timestamper {
  string what;
  __timestamper(const char* what) : what(what){};
  __timestamper(const string& what) : what(what){};
  ~__timestamper(){
    TIMESTAMPf("%s", what.data());
	}
} __TIMESTAMPER("end");
#else 
struct __timestamper {};
#endif

typedef long long ll;
typedef long double ld;

const int MOD = 1000000007;

void add(int &a, int b) {
  if ((a += b) >= MOD) a -= MOD;
}

void sub(int &a, int b) {
  if ((a -= b) < 0) a += MOD;
}

int mul(int a, int b) {
  return (int) ((a * 1LL * b) % MOD);
}

int mpow(int a, int b) {
  int res = 1;
  while (b) {
    if (b & 1) res = mul(res, a);
    a = mul(a, a);
    b >>= 1;
  }
  return res;
}

int minv(int x) {
  return mpow(x, MOD - 2);
}

const int MAXN = 110000;

int invv[MAXN];
int invvp[MAXN];
int f[MAXN];
int invf[MAXN];
int coef[MAXN];

int cnk(int n, int k) {
  return mul(f[n], mul(invf[k], invf[n - k]));
}


int main() {
#ifdef LOCAL
  freopen("b.in", "r", stdin);
  freopen("b.out", "w", stdout);
#endif

  invv[1] = 1;
  for (int i = 2; i < MAXN; i++) {
    invv[i] = mul(MOD - invv[MOD % i], MOD / i);
    assert(mul(i, invv[i]) == 1);
  }

  f[0] = invf[0] = 1;
  for (int i = 1; i < MAXN; i++) {
    f[i] = mul(f[i-1], i);
    invf[i] = mul(invf[i-1], invv[i]);
  }

  invvp[0] = 0;
  for (int i = 1; i < MAXN; i++) {
    invvp[i] = invvp[i - 1];
    add(invvp[i], invv[i]);
  }

  int n;
  while (scanf("%d", &n) == 1) {
    vector<int> v(n);
    for (int i = 0; i < n; i++) {
      scanf("%d", &v[i]);
    }

    int ans = 0;
    for (int i = 0; i < n; i++) {
      int coef = MOD - 1;
      add(coef, invvp[i + 1]);
      add(coef, invvp[n - i]);
      add(ans, mul(v[i], coef));
    }
    ans = mul(ans, f[n]);

    printf("%d\n", ans);
  }


  return 0;
}


Measured memory_bytes: 2304
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int N;
    string A;
    cin >> N;
    cin >> A;
    vector<char> vec(N);
    int countR=N-1;
    int countW=0;
    int check=0;
    for(int i=0;i<N;i++){
        vec.at(i)=A.at(i);
    }
    while(1){
        while(1){
    if(vec.at(countW)=='R'){countW++;
        if(countW==N)break;
    }else{break;}
        }
        while(1){
    if(vec.at(countR)=='W'){countR--;
        if(countR==-1)break;
    }else{break;}
        }
    if(countW<countR){vec.at(countW)='W'; vec.at(countR)='R';check++;countW++;countR--; }else{break;}
    }
    cout << check << endl;
    }

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

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

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(lol i=0;i<lol(n);i++)
#define REPD(i,n) for(lol i=n-1;i>=0;i--)
#define FOR(i,a,b) for(lol i=a;i<=lol(b);i++)
#define FORD(i,a,b) for(lol i=a;i>=lol(b);i--)
#define VL vector<lol>
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end() //sortなどの引数を省略したい
#define SIZE(x) lol(x.size()) //sizeをsize_tからllに直しておく
//定数
#define PI 3.1415926535897932385 //pi
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//最大値最小値
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main()
{
    lol result{0};
    lol h, a; cin >> h >> a;
    lol n = h/a;
    if(h%a == 0)
        result = n;
    else
        result = n+1;

    cout << result << endl;
    return 0;
}

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

int main() {
  	int N;
  	cin >> N;
  	int count[N + 1];
  	for (int i = 0; i < N + 1; i++) count[i] = 0;
  	for (int x = 1; x <= sqrt(N) + 1; x++){
      	for (int y = 1; y <= sqrt(N) + 1; y++){
          	for (int z = 1; z <= sqrt(N) + 1; z++){
				if (x * x + y * y + z * z + x * y + y * z + z * x <= N){
                  	count[x * x + y * y + z * z + x * y + y * z + z * x]++;
                }
            }
       	}
    }
  	for (int i = 1; i < N + 1; i++){
      	cout << count[i] << endl;
    }
}

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

ll len(ll K) {
	// Kを２進数表記したときの桁数
	int cnt = 1;
	while(K>=2) {
		K /= 2;
		cnt++;
	}
	return cnt;
}

vector<ll> cnt(ll x) {
	// 0-xの各桁1の個数和
	vector<ll> v;
	for (ll i=0; i<len(x); i++) {
		ll a = 1ll<<(i+1);
		ll b = (x/a)*(a/2);
		if (x%a >= a/2) {
			b += x%(a/2) + 1;
		}
		v.push_back(b);
	}
	return v;
}

vector<ll> dif(vector<ll>va, vector<ll>vb) {
	// a<=b
	vector<ll> vans;
	for (ll i=0; i<(ll)vb.size(); i++) {
		ll diff;
		/// gunuuu
		if (i<(ll)va.size()) {
			diff = vb[i] - va[i];
		} else {
			diff = vb[i];
		}
		if (diff%2) {
			vans.push_back(1);
		} else {
			vans.push_back(0);
		}
	}
	return vans;
}

ll cal(vector<ll> vans) {
	ll ans = 0;
	for(ll i=0; i<(ll)vans.size(); i++) {
		if (vans[i]) {
			ans |= 1ll << i;
		}
	}
	return ans;
}

int main(){

	ll a,b;
	cin >> a>>b;

	vector<ll> va;
	if (a==0) {
		va = cnt(a);
	} else {
		va = cnt(a-1);
	}
	vector<ll> vb = cnt(b);

	// rep(i,(int)va.size()) {
	// 	cout << va[i] << " ";
	// }
	// cout << endl;
	// rep(i,(int)vb.size()) {
	// 	cout << vb[i] << " ";
	// }
	// cout << endl;
	vector<ll> vans = dif(va, vb);
	// rep(i,(int)vans.size()) {
	// 	cout << vans[i] << " ";
	// }
	// cout << endl;
	ll ans = cal(vans);

	cout << ans << endl;
}


Measured memory_bytes: 256
S = list(input())
N = len(S)
ans = 0
for i in range(N):
    l = []
    c = 0
    now = pow(2,N-1)
    while c < i:
        now //= 2
        l.append(now)
        c += 1
    l.append(now)
    for j in range(len(l)):
        ans += int(S[N-i-1])*pow(10,j)*l[j]
print(ans)

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

const int MAX = 100000;
int main() {
	static int N, H, a[MAX], b[MAX];
	cin >> N >> H;
	for (int i = 0;i < N;i ++) cin >> a[i] >> b[i];
	sort(a, a+N);
	sort(b, b+N);
	int count = 0;
	for (int i = N - 1;i >= 0;i --) {
		if (a[N - 1] >= b[i]) break;
		count ++;
		H -= b[i];
		if (H <= 0) {
			cout << count;
			return 0;
		}
	}
	cout << count + (H + a[N - 1] - 1) / a[N - 1];
	return 0;
}
/*
31536000のコメント解説欄
ここテンプレで用意してるから、A問題とかだとこの先空欄の危険あり
また、コンテスト後に https://31536000.hatenablog.com/ で解説していると思うので、良かったら読んでねー

最初に振る、以降は投げつける
この順を徹底すると、途中でロストする刀なんて考えなくていい
よって、投げつけるのは振るより強い刀だけなので、一番振ると強い刀以降は投げたことにして計算すればO(NlogN)
*/

Measured memory_bytes: 1024
n = int(input())
F = [[int(i) for i in input().split()] for i in range(n)]
P = [[int(i) for i in input().split()] for i in range(n)]

ans = -10 ** 10
for i in range(1, 2 ** 10):
    tmp = i
    A = []
    while tmp:
        A.append(tmp % 2)
        tmp //= 2
    while len(A) != 10:
        A.append(0)

    temp = 0
    for s in range(n):
        count = 0
        for t in range(10):
            if F[s][t] == 1 and A[t] == 1:
                count += 1
        temp += P[s][count]
    ans = max(ans, temp)
        
print(ans)

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

int main(void){
    int a,b,c,d,e;
    std::deque<int> deq;
    char x;
    while (cin>>a>>x>>b>>x>>c>>x>>d>>x>>e) {
        deq.emplace_back(a);
        deq.emplace_back(b);
        deq.emplace_back(c);
        deq.emplace_back(d);
        deq.emplace_back(e);
        sort(deq.begin(),deq.end());
        if ( (deq[0]==deq[1]&&deq[1]==deq[2]&&deq[2]==deq[3]) || (deq[1]==deq[2]&&deq[2]==deq[3]&&deq[3]==deq[4]) ) {
            cout<<"four card"<<endl;
            deq.clear();
        } else if ( (deq[0]==deq[1]&&deq[1]==deq[2]&&deq[3]==deq[4]) || (deq[0]==deq[1]&&deq[2]==deq[3]&&deq[3]==deq[4]) ) {
            cout<<"full house"<<endl;
            deq.clear();
        } else if ( (deq[0]+1==deq[1]&&deq[1]+1==deq[2]&&deq[2]+1==deq[3]&&deq[3]+1==deq[4]) || (deq[0]==1&&deq[1]==10&&deq[2]==11&&deq[3]==12&&deq[4]==13) ) {
            cout<<"straight"<<endl;
            deq.clear();
        } else if ( (deq[0]==deq[1]&&deq[1]==deq[2]) || (deq[1]==deq[2]&&deq[2]==deq[3]) || (deq[2]==deq[3]&&deq[3]==deq[4]) ) {
            cout<<"three card"<<endl;
            deq.clear();
        } else if ( (deq[1]==deq[2]&&deq[3]==deq[4]) || (deq[0]==deq[1]&&deq[3]==deq[4]) || (deq[0]==deq[1]&&deq[2]==deq[3]) ) {
            cout<<"two pair"<<endl;
            deq.clear();
        } else if ( (deq[0]==deq[1]) || (deq[1]==deq[2]) || (deq[2]==deq[3]) || (deq[3]==deq[4]) ) {
            cout<<"one pair"<<endl;
            deq.clear();
        } else {
            cout<<"null"<<endl;
            deq.clear();
        }
    }
}


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

int main(){
  string s;
  cin >> s;
  bool answer = true;
  for(int i = 0; i < s.size() - 1; i++){
    if(s[i] == s[i + 1]) answer = false;
  }
  if(answer) cout << "Good" << endl;
  else cout << "Bad" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define MOD = 998244353;
#define int long long int
#define double long double
#define inf (int)(1e15)
#define all(x) (x).begin(), (x).end()
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define isYes(x) printf("%s\n", (x) ? "Yes" : "No")
#define isYES(x) printf("%s\n", (x) ? "YES" : "NO")
#define isIn(x, y, h, w) (x >= 0 && x < h && y >= 0 && y < w)
#define pair pair<int, int>
typedef vector<int> vi;   // Vector of long long
typedef vector<vi> vvi;   // Vector of vi
typedef vector<pair> vii; // Vector of pairs
typedef vector<vii> vvii; // Vector of Vector of pairs
typedef vector<bool> vb;  // Vector of bool
#define pq priority_queue // Max heap (To convert to min heap, use negative sign before every value)
#define ff first          // For pairs
#define ss second
const int dx4[] = {1, 0, -1, 0}, dy4[] = {0, -1, 0, 1};
const int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1}, dy8[] = {1, -1, 1, 0, -1, 1, -0, -1};
#define testcases(t) \
    int(t);          \
    cin >> (t);      \
    while ((t)--)
#define range(c, r) (c).begin(), (c).begin() + (r)    // Mainly used in sorting
#define present(c, x) ((c).find(x) != (c).end())      // for sets, maps, multi-maps
#define cpresent(c, x) (find(all(c), x) != (c).end()) // for vectors
#define run(x, c) for ((x) = (c).begin(); (x) != (c).end(); (x)++)
#define fo0 (i, n) for (i = 0; i < n; i++)
#define fo1 (i, n) for (i = 1; i <= n; i++)
#define rfo(i, n) for (i = n - 1; i >= 0; i--)
#define rfor(i, n) for (i = n; i > 0; i--)
signed main()
{
    double x;
    int time = 0;
    cin >> x;
    int ans = 100;
    while (ans < x)
    {
        time++;
        ans = ans + (ans / 100);
    }
    cout << time << endl;
    return 0;
}


Measured memory_bytes: 3736
N = int(input())
res = 0
for a in range (0,N//4 + 1):
    for b in range(0,N//7 + 1):
        total = 4 * a + 7 * b
        if total == N:
            res += 1
if res > 0:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int MOD = pow(10, 9) + 7;
//const int MOD = 998244353;
//const int MOD = ;
int mod(int A, int M) {return (A % M + M) % M;}
const int INF = 1LL << 60;
const string ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const string abc = "abcdefghijklmnopqrstuvwxyz";
template <class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template <class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
int divCeil(int A, int B) {return (A + (B - 1)) / B;}
int myctoi(char C) {return C - 48;}
char myitoc(int N) {return '0' + N;}

int N, K;
vector<vector<int>> G(111111);

vector<bool> visited(111111, false);
int cnt;
int ans = 1;
bool dfs(int V, int D, int P)
{
  if (visited.at(V)) return false;
  visited.at(V) = true;
  
  ans *= max((int)0, K - min((int)2, D) - P);
  ans %= MOD;
    
  for (int i = 0, cnt = 0; i < G.at(V).size(); i++)
  {
    if (dfs(G.at(V).at(i), D + 1, cnt)) cnt++; 
  }
  return true;
}

signed main()
{
  cin >> N >> K;
  for (int i = 0; i < N - 1; i++)
  {
    int a, b;
    cin >> a >> b;
    a--; b--;
    G.at(a).push_back(b);
    G.at(b).push_back(a);
  }
  
  dfs(0, 0, 0);
  cout << ans << endl;
}

Measured memory_bytes: 10624
import Control.Applicative
import Control.Monad
import Data.List
import qualified Data.Map as M
import Text.Printf

readInts :: IO [Int]
readInts = map read . words <$> getLine

main :: IO ()
main = do
  [h, w] <- readInts
  when ((h, w) /= (0, 0)) $ do
    forM_ [1..h] $ \i -> do
      forM_ [1..w] $ \j -> do
        if odd (i + j)
          then putChar '.'
          else putChar '#'
      putChar '\n'
    putChar '\n'
    main



Measured memory_bytes: 4120