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


int main(){
    ll x;
    cin>>x;
    ll tt=100;
    for(ll i = 1 ; i ; i ++  ){
        tt += tt/100;
        if(tt>=x){
            cout<<i<<endl;
            return 0;
        }
       // cout<<tt<<endl;
    }
}


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

using namespace std;
#ifdef _DEBUG
#define _GLIBCXX_DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define ll long long
#define DBG 1
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define loop(n) rep(loop, (0), (n))
#define all(c) begin(c), end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
using pii = pair<int, int>;
// template<class T> ostream &operator<<(ostream &os,T &t){dump(t);return os;}
template <typename T, typename S>istream &operator>>(istream &is, pair<T, S> &p) { is >> p.first >> p.second; return is; }
//template <typename T, typename S>ostream &operator<<(ostream &os, pair<T, S> &p) {os << p.first << " " << p.second;return os;}

template <typename T> void printvv(const vector<vector<T>> &v) {
	cerr << endl;
	rep(i, 0, v.size()) rep(j, 0, v[i].size()) {
		if (typeid(v[i][j]).name() == typeid(INF).name() and v[i][j] == INF) {
			cerr << "INF";
		}
		else
			cerr << v[i][j];
		cerr << (j == v[i].size() - 1 ? '\n' : ' ');
	}
	cerr << endl;
}

#ifndef _DEBUG
#define printvv(...)
#endif
void YES(bool f) { cout << (f ? "YES" : "NO") << endl; }
void Yes(bool f) { cout << (f ? "Yes" : "No") << endl; }
template <class T, class U>bool chmin(T& a, U b) { if (a > b) { a = b; return true; }return false; }
template <class T, class U>bool chmax(T& a, U b) { if (a < b) { a = b; return true; }return false; }
int gcd(int x, int y) { return (y == 0 ? x : gcd(y, x%y)); }
int gcd(vector<int>&v) {
	int ret = v[0];
	for (int i = 1; i < v.size(); i++) {
		ret = gcd(ret, v[i]);
	}
	return ret;
}
int lcm(int x, int y) { return x / gcd(x, y) * y; }
int lcm(const vector<int> &v) {
	int ret = v[0];
	for (int i = 1; i < v.size(); i++)
		ret = lcm(ret, v[i]);
	return ret;
}

signed main(signed argc, char *argv[]) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(12);

	int A, B; cin >> A >> B;

	rep(k, 1, A + 1) {
		int i = A * k;
		int x = i / A + i % A;
		int y = i / B + (i%B) / A + (i%B) % A;
		if (x < y) {
			cout << i << endl;
			return 0;
		}
	}
	cout << -1 << endl;


	/*int n = (B - 1 + A - 1) / (A - 1);
	dump(n);
	assert((A*n) / B + (A*n) % B > n);
	cout << A * n << endl;*/

	return 0;
}



Measured memory_bytes: 3240
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner scan = new Scanner(System.in);
		int ninz = scan.nextInt(), syuru = scan.nextInt();
		int hito[] = new int[ninz];
		
		for(int i = 0; i < syuru; i++) {
			int ha = scan.nextInt();
			for(int j = 0; j < ha; j++) {
				hito[scan.nextInt() - 1]++;
				
			}
			
			
		}
		
		syuru = 0;
		
		for(int i = 0; i < ninz; i++) {
			if(hito[i] == 0) {
				syuru++;
			}
			
		}
		
		System.out.println(syuru);
		
		
	}
		
		
		
}


Measured memory_bytes: 46504
def resolve():
    from collections import deque
    n = int(input())
    que = deque()
    for _ in range(n):
        cv = input().split()
        if cv[0] == "insert":
            x = int(cv[1])
            que.appendleft(x)
        elif cv[0] == "delete":
            x = int(cv[1])
            if x in que:
                que.remove(x)
        elif cv[0] == "deleteFirst":
            que.popleft()
        elif cv[0] == "deleteLast":
            que.pop()
    ans = list(que)
    print(*ans)


resolve()



Measured memory_bytes: 46052
S = gets.chomp
ans = 0
S.size.times do |i|
  i.upto(S.size - 1) do |j|
    if S[i..j].split('').all?{|s| ['A', 'C', 'G', 'T'].include?(s)}
      ans = [ans, j-i+1].max
    end
  end
end

puts ans

Measured memory_bytes: 1788
#include <stdio.h>

int main() {

 int a, b, c;
 
 scanf("%d %d %d", &a, &b, &c);

 if (a < b) {
   if (b < c) {
     printf("Yes\n");
   }
   else {
     printf("No\n");
   }
 }
 else {
   printf("No\n");
 }

 return 0;
}

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

using namespace std;

const int N = 1005;
int ara[N];
int main()
{
    int n;
    cin >> n;
    for(int i = 1;i <= n;i++){
        cin >> ara[i];
    }
    bool ok = 1;
    for(int i = 1;i <= n;i++){
        if(ara[i] % 2 == 0){
            if(ara[i] % 3 == 0 or ara[i] % 5 == 0);
            else ok = 0;
        }
    }
    if(ok)cout << "APPROVED\n";
    else cout << "DENIED\n";


}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int N,X,p[101],i,a,min;
	for(i=1;i<=100;i++)p[i]=0;
	scanf("%d",&X);
	scanf("%d",&N);
	for(i=0;i<N;i++){
		scanf("%d",&a);
		p[a]=1;
	}
	for(i=0;i<=100;i++){
		if(X-i==0){
			min=0;
			printf("0");
			return 0;
		}else{
			if(p[X-i]==0){
				min=X-i;
				printf("%d",min);
				return 0;
			}
		}
		if(X+i<=100){
			if(p[X+i]==0){
				min=X+i;
				printf("%d",min);
				return 0;
			}
		}else{
			min=101;
			printf("%d",min);
			return 0;
		}
	}
}

Measured memory_bytes: 1680
#include <iostream>
#include <algorithm>

int count[26];

int main(){
    std::string S;
    std::cin >> S;

    for(const auto& c : S){
        if(std::islower(c)){continue;}
        ++count[c&63];
    }

    printf("%d\n", std::min({count['K'&63], count['U'&63], count['P'&63], count['C'&63]}));
}

Measured memory_bytes: 1184
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;
#define all(v) v.begin(), v.end()
#define repi(i, n, init) for (ll i = init; i < (n); i++)
#define repd(i, n, init) for (ll i = (n); i >= init; i--)
#define repm(i, m) for (auto i = m.begin(); i != m.end(); i++)

int main()
{
    string s;
    cin >> s;
    s.at(5) = ' ';
    s.at(13) = ' ';
    cout << s << endl;
    return 0;
}

Measured memory_bytes: 256
import sys

read = sys.stdin.buffer.read
input = sys.stdin.buffer.readline
inputs = sys.stdin.buffer.readlines


# rstrip().decode('utf-8')
# INF=float("inf")
#MOD=10**9+7
# sys.setrecursionlimit(2147483647)
# import math
#import numpy as np
# import operator
#import bisect
# from heapq import heapify,heappop,heappush
#from math import gcd
# from fractions import gcd
#from collections import deque
#from collections import defaultdict
# from collections import Counter
#from itertools import accumulate
# from itertools import groupby
# from itertools import permutations
# from itertools import combinations
# from scipy.sparse import csr_matrix
# from scipy.sparse.csgraph import floyd_warshall
# from scipy.sparse.csgraph import csgraph_from_dense
# from scipy.sparse.csgraph import dijkstra
# map(int,input().split())


def main():
	a,b=map(int,input().split())
	c,d=map(int,input().split())
	
	ans=0
	if a<c:
		ans=1
	print(ans)
	
	
	
if __name__ == "__main__":
		main()


Measured memory_bytes: 3316
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<cmath>
#include<map>
#include<list>
#include<set>
using namespace std;

int main(){
  int d,c;
  cin >> d >>c;
  cout << d*c << endl;
  return 0;
}




Measured memory_bytes: 3112
/*
author: Apoorv Singh
*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 

using namespace std;
using namespace __gnu_pbds;

typedef vector <int> vi;
typedef vector <long long> vl;
typedef pair <int, int> pii;
typedef pair <long long, long long> pll;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

#define ll long long
#define pb push_back   
#define all(c) c.begin(), c.end()
#define watch(x) cout << (#x) << " " << (x) << endl;
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define FORR(i, a, b) for (int i = a; i > b; --i)
#define um unordered_map
#define F first
#define S second

ll modulo = 1e9 + 7;

template <class X>

void printarr(X arr[], int n)
{
    for (int i = 0; i < n; ++i)
        cout << arr[i] << " ";
    cout << endl;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n,x;
    cin >> n >> x;
    int arr[n+1];
    FOR(i,0,n)
    {
        int y;
        cin >> y;
        arr[i] = y;
    }
    arr[n] = x;
    ++n;
    sort(arr, arr+n);
    int ans;
    FOR(i,0,n-1)
    {
        int y = arr[i+1]-arr[i];
        if (i == 0)
            ans = y;
        ans = __gcd(ans, y);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
#include<set>
#include<map>
#include<cmath>
#include<queue>
#include<cctype>
#include<vector>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using std::min;
using std::max;
using std::swap;
using std::vector;
const int N=1e5+5;
typedef double db;
typedef long long ll;
#define pb(A) push_back(A)
#define pii std::pair<ll,int>
#define mp(A,B) std::make_pair(A,B)

pii val[N];
int n,m,used[N];
int cnt,head[N],vis[N];

struct Edge{
    int to,nxt;
}edge[N<<1];

void add(int x,int y){
    edge[++cnt].to=y;
    edge[cnt].nxt=head[x];
    head[x]=cnt;
}

ll getint(){
    ll X=0,w=0;char ch=0;
    while(!isdigit(ch))w|=ch=='-',ch=getchar();
    while( isdigit(ch))X=X*10+ch-48,ch=getchar();
    if(w) return -X;return X;
}
std::priority_queue< pii > pq[N];
void dfs(int now,int tot){
    vis[now]=tot;
    pq[tot].push(mp(-val[now].first,now));
    for(int i=head[now];i;i=edge[i].nxt){
        int to=edge[i].to;
        if(vis[to]) continue;
        dfs(to,tot);
    }
}

signed main(){
    n=getint(),m=getint();
    for(int i=1;i<=n;i++) val[i].first=getint(),val[i].second=i;
    for(int i=1;i<=m;i++){
        int x=getint()+1,y=getint()+1;
        add(x,y);add(y,x);
    } int tot=0;
    for(int i=1;i<=n;i++) if(!vis[i]) dfs(i,++tot);
    if(tot==1) return printf("0"),0;
    if(2*tot-2>n) return printf("Impossible"),0;
    ll ans=0;
    for(int i=1;i<=tot;i++){
        ans+=-pq[i].top().first;
        used[pq[i].top().second]=1;
    } std::sort(val+1,val+1+n);
    int cnts=0;
    for(int i=1;i<=n;i++){
        if(cnts==tot-2) break;
        while(i<=n and used[val[i].second]) i++;
        ans+=val[i].first;cnts++;
    } printf("%lld\n",ans);
    return 0;
}

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

ll func(ll a, ll b, ll x){
    ll out = floor((a * x)/b) - a * floor(x/b);
    return out;
}

int main(){
    ll a, b, n;
    cin >> a >> b >> n;
    ll mx = 0;
    ll left = 0;
    ll right = n+1;
    while (left < right){
        ll mid = (left+right)/2;
        ll out = func(a, b, mid);
        if (out < mx){
            right = mid;
        }
        else left = mid + 1;
        mx = max(mx, out);            
    }
    cout << mx << endl;
    return 0;
}

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

using namespace std;

int main() {
    int n;
    cin >> n;
    map<string,long long> count;
    string s[n];
    for (int i = 0; i < n; i++) {
        cin >> s[i];
        sort(s[i].begin(), s[i].end());
        count[s[i]]++;
    }

    long long ans = 0;
    for (auto x : count) {
        ans += x.second * (x.second - 1) / 2;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 18176
#include<iostream>
#include<cstdio>
#include<vector>
#include<queue>
#include<map>
#include<string>
#include<algorithm>
#include<functional>
#define ll long long
#define inf  999999999
#define pa pair<int,int>
 
using namespace std;
 
int n;
vector<pa> a[100100];
vector<pa> ed;
int d[100100];
 
void dfs(int u,int moto,int kyori){
if(d[u]==-1){
if(moto==-1) d[u]=0;
else d[u]=d[moto]+kyori;
    for(int i=0;i<a[u].size();i++){
        dfs(a[u][i].first,u,a[u][i].second);
    }
}
}
 
 
 
void tyo(){
 
for(int i=0;i<n;i++) d[i]=-1;
int u=0;
 
dfs(u,-1,-1);
int max=-1,maxd=-1;
for(int i=0;i<n;i++){
    if(d[i]>max) {
        max=d[i];
        maxd=i;
        }
    d[i]=-1;
    }
//cout<<maxd<<endl;
dfs(maxd,-1,-1);
int max2=-1,maxd2=-1;
for(int i=0;i<n;i++){
    if(d[i]>max2) {
        max2=d[i];
        maxd2=i;
        }
    d[i]=-1;
    }
cout<<max2<<endl;
//maxd とmaxd2が両端の点　
 
}
 
 
int main(){
    int s,t,w;
    cin>>n;
    for(int i=0;i<n-1;i++){
    cin>>s>>t>>w;
    a[s].push_back(make_pair(t,w));
    a[t].push_back(make_pair(s,w));
    }
    tyo();
    return 0;
}

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

#define int        long long
// #define mp      make_pair
#define eb         emplace_back
#define pb         push_back
#define ss         second
#define ff         first
#define IOS        ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define mod        998244353
#define MOD        (1000*1000*1000+7)
#define MN         LLONG_MIN
#define MX         LLONG_MAX
#define v1d        vector<int>
#define v2d        vector<vector<int>>
#define vip        vector<pair<int,int> >
#define v1s        vector<string>
#define pa         pair<int,int>
#define mxpq(T)    priority_queue <T>
#define mnpq(T)    priority_queue<T,vector<T>,greater<T>>
#define print(v)   for(auto i:v)cout<<i<<" ";cout<<"\n";
#define p2d(v)     for(auto a:v){for(auto b:a)cout<<b<<" ";cout<<endl;}
#define p1d(v)     for(auto a:v)cout<<a<<" ";cout<<endl;
#define ppd(v)     for(auto a:v)cout<<a.ff<<" "<<a.ss<<endl;
#define endl       "\n"
#define input(b,n) for(int i=0;i<n;i++)cin>>b[i];
#define Sort(v)    sort(v.begin(),v.end())
#define RSort(v)   sort(v.rbegin(),v.rend())
#define all(v)     v.begin(),v.end()
int gcd(int a,int b){return b?gcd(b,a%b):a;}
//string s = bitset<64>(a).to_string();

void azmuth(int n=12){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cout<<setprecision(n)<<fixed;
   
}
int lb = 10000000;

//____________________________________________________________________________________


void solve(){
    int n,m;cin>>n>>m;
    v1s v(n);
    input(v,n);
    v2d dp(n,v1d(m,0));
    for(int j=0;j<m;j++){
        if(v[0][j] == '#')break;
        dp[0][j] = 1;
    }
    for(int i=0;i<n;i++){
        if(v[i][0] == '#')break;
        dp[i][0] = 1;
    }
    for(int i=1;i<n;i++){
        for(int j=1;j<m;j++){
            if(v[i][j] == '#')continue;
            if(v[i-1][j] != '#')dp[i][j] += dp[i-1][j];
            dp[i][j] %= MOD;
            if(v[i][j-1] != '#')dp[i][j] += dp[i][j-1];
            dp[i][j] %= MOD;
        }
    }
    // p2d(dp);
    cout<<dp[n-1][m-1];
}

int32_t main(){
    azmuth();
    int t = 1;
    // cin>>t;
    while(t--){
        solve();
    }
    


    return 0;
}

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

struct UnionFind {
  vector<int> data;
  UnionFind(int size) : data(size, -1) { }
  bool unionSet(int x, int y) {
    x = root(x); y = root(y);
    if(x == y) return false;
    if (x != y) {
      if (data[y] < data[x]) swap(x, y);
      data[x] += data[y]; data[y] = x;
    }
    return true;
  }
  bool findSet(int x, int y) {
    return root(x) == root(y);
  }
  int root(int x) {
    return data[x] < 0 ? x : data[x] = root(data[x]);
  }
  int size(int x) {
    return -data[root(x)];
  }
};

int main(){
    int n,m;
    cin >> n >> m;
    vector<int> x(m),y(m);
    vector<long long>ans(m);
    UnionFind tree(n);
    for(int i=0;i<m;i++){
        cin >> x[i] >> y[i];
        x[i]--;
        y[i]--;
    }
    ans[m-1] = (long long)n*(n-1)/2;
    for(int i=m-1;i>=1;i--){
      ans[i-1] = ans[i];
      if(tree.root(x[i]) != tree.root(y[i])){
        ans[i-1] -= (long long)tree.size(x[i])*tree.size(y[i]);
        tree.unionSet(x[i], y[i]);
      }
    }
    for(int i=0;i<m;i++){
      cout << ans[i] << endl;
    }
}

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

#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define lg long long
#define db double
#define lb(x) ((x)&-(x))
#define ft first
#define sd second

#define HII cerr<<"HI"<<endl
#define LLLINE cerr<<"@@@@@@@@@@@@@@@@@@@@"<<endl

template <class _T_>
void read(_T_& d){
	d=0;int f=1;char c=getchar();
	for(;c<'0'||c>'9';c=getchar())if(c=='-')f*=-1;
	for(;c>='0'&&c<='9';c=getchar())d=d*10+c-'0';
	d*=f;
}

/************************************************/
#define MN 300005
int n;
lg p[MN];
lg a[MN];
int id[MN];
int tot=0;
void solve(int l,int r){
	if(l>r)return;
	if(a[0]<a[l]){
		id[tot--]=r;
		solve(l,r-1);
		return;
	}
	if(a[0]>a[r]){
		id[tot--]=l;
		solve(l+1,r);
		return;
	}
	if(p[l]>=p[r]){
		p[l]+=p[r];
		id[tot--]=r;
		solve(l,r-1);
	}else{
		p[r]+=p[l];
		id[tot--]=l;
		solve(l+1,r);
	}
}
int main(){
	read(n);tot=n;read(a[0]);
	for(int i=1;i<=n;++i)read(a[i]),read(p[i]);
	solve(1,n);
	lg res=0;
	for(int i=1;i<=n;++i){
		res+=abs(a[id[i]]-a[id[i-1]]);
	}
	cout<<res;
	return 0;
}


Measured memory_bytes: 3712
#include<bits/stdc++.h>
#define ll long long
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define dump(a) (cerr << #a << "=" << (a) << endl)
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }


using namespace std;

int main(){
    ll N, H;
    cin >> N >> H;
    ll a[N], b[N];
    rep(i, N){
        cin >> a[i] >> b[i];
    }


    sort(a, a+N);
    ll ans;
    if (H % a[N-1] == 0) {
         ans = H / a[N-1];
    } else {
         ans = H / a[N-1] + 1;
    }


    sort(b, b+N);
    reverse(b, b+N);

    ll sum = 0;
    rep(i, N+1){
        ll rep = H;
        ll tmp;
        rep -= sum;
        if (rep > 0) {
            if (rep % a[N-1] == 0) {
                tmp = rep / a[N-1];
            } else {
                tmp = rep / a[N-1] + 1;
            }
            chmin(ans, tmp+i);
        } else {
            ans = min(ans, (ll)i);
        }

        if (i < N) sum += b[i];
    }

    cout << ans << endl;
}

Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		//????????£?????????????????????
		Scanner sc = new Scanner(System.in);
		//a???????????????
		int a = sc.nextInt();
		//b???????????????
		int b = sc.nextInt();
		//c???????????????
		int c = sc.nextInt();
		
		//?????¶??? a < b < c????????°Yes
		if(a < b && b < c){
			System.out.println("Yes");
		}else{
		//???????????°No
			System.out.println("No");
		}
	}
}

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

int rt = 1, sz = 1;
int st[2000006], ls[32000000], rs[32000000], sum[32000000];
 
int cpy (int v, int &u) {
	ls[sz] = ls[v];
	rs[sz] = rs[v];
	sum[sz] = sum[v];
	return u = sz++;
}
 
void root_add () {
	cpy(st[rt - 1], st[rt]);
	rt++;
}
 
void add_point (int pos, int x, int v = st[rt - 1], int l = 0, int r = 2000006) {
	sum[v] += x;
	if (r - l == 1)
		return;
	int m = (l + r) / 2;
	if (pos < m)
		add_point(pos, x, cpy(ls[v], ls[v]), l, m);
	else
		add_point(pos, x, cpy(rs[v], rs[v]), m, r);
}
 
int query_diff (int a, int b, int v, int l = 0, int r = 2000006) {
	if (a <= l && r <= b)
		return sum[v];
	if (r <= a || b <= l)
		return 0;
	int m = (l + r) / 2;
	return query_diff(a, b, ls[v], l, m) + query_diff(a, b, rs[v], m, r);
}

signed main () {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	int n, q;
	cin >> n >> q;
	vector < int > c(n), pos(n + 1, n);
	for (int i = 0; i < n; ++i) {
		cin >> c[i];
		root_add();
		if (pos[c[i]] != n)
			add_point(pos[c[i]], -1);
        pos[c[i]] = i;
        add_point(pos[c[i]], 1);
	}
	for (int i = 0; i < q; ++i) {
		int l, r;
		cin >> l >> r;
		cout << query_diff(l - 1, r, st[r]) << '\n';
	}
}


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

using namespace std;
#define inf 1000000000
#define unvisited -1
#define visited 1
#define eps 1e-9
#define mp make_pair
#define pb push_back
#define pi acos(-1.0)
#define uint64 unsigned long long
#define FastSlowInput ios_base::sync_with_stdio(false); cin.tie(NULL);
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;

int main(){
	int a[6];
	int i,j,k;
	for(i=0;i<5;i++){
		scanf("%d",&a[i]);
	}
	scanf("%d",&k);
	for(i=0;i<5;i++){
		for(j=i+1;j<5;j++){
			if(abs(a[i] - a[j]) > k){printf(":(\n"); return 0;}
		}
	}
	printf("Yay!\n");
	return 0;
};

Measured memory_bytes: 256
#include <stdio.h>
#define MAX 100
#define INFTY 1<<21
#define WHITE 0
#define GRAY 1
#define BLACK 2

int n,M[MAX][MAX];
void dijkstra(){
  int u,minv;
  int d[MAX],color[MAX];
  int i;
  for(i=0;i<n;i++){
    d[i]=INFTY;

    color[i]=WHITE;
  }
  d[0]=0;
  color[0]=GRAY;
  while(1){
    minv=INFTY;
    u=-1;
    for(i=0;i<n;i++){
      if(minv>d[i]&&color[i]!=BLACK){
	u=i;
	minv=d[i];
      }
    }
    if(u==-1) break;
    color[u]=BLACK;
    for(i=0;i<n;i++){
      if(color[i]!=BLACK&&M[u][i]!=INFTY){
	if(d[i]>d[u]+M[u][i]){
	  d[i]=M[u][i]+d[u];
	  color[i]=GRAY;
	}
      }
    }
  }
  for(i=0;i<n;i++){
    //d[i]==INFTY?-1:d[i];
    if(d[i]==INFTY) d[i]=-1;
    printf("%d %d\n",i,d[i]);
  }
}
int main(void){
  int i,j;
  int k,c,u,v;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      M[i][j]=INFTY;
    }
  }
  for(i=0;i<n;i++){
    scanf("%d %d",&u,&k);
    for(j=0;j<k;j++){
      scanf("%d %d",&v,&c);
      M[u][v]=c;
    }
  }
  dijkstra();
  return 0;
}



Measured memory_bytes: 2108
import java.util.Scanner;

class Solver {
	static final Solver INSTANCE = new Solver();

	void solve(Scanner sc) {
		int i = sc.nextInt();
		double v = i / 1.08;
		double ceil = Math.ceil(v);
		double floor = Math.floor(v);
		if (Math.floor(ceil * 1.08) == i) {
			System.out.println((int) ceil);
		} else if (Math.floor(floor * 1.08) == i) {
			System.out.println((int) floor);
		} else {
			System.out.println(":(");
		}
	}
}

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

		Solver.INSTANCE.solve(in);

		in.close();
	}
}

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

using namespace std;
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
constexpr int MOD = 1000000007;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
constexpr int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
constexpr int dy[] = {0, -1, 0, 1, 1, -1, -1, 1};

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){os << "["; for (const auto &v : vec) {os << v << ","; } os << "]"; return os; }
template <typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &p){os << "(" << p.first << ", " << p.second << ")"; return os;}

ll N, P;

ll mypow(ll x, ll n) {
    ll res = 1;
    while(n > 0) {
        if (n & 1) res = res * x;
        if (res > P) return -1;
        x = x * x;
        n >>= 1;
    }
    if (res > P) return -1;
    return res;
}


void solve() {
    cin >> N >> P;

    ll ans = 0;
    for(ll i = 1; i * i <= P; i++) {
        if (P % i == 0) {
            ll j = P / i;
            if (N == 1) {
                ans = max(ans, i);
                if (P % j == 0) ans = max(ans, j);
            } else {
                ll P_ = P;
                bool ok1 = true, ok2 = true;
                if (i != 1) {
                    for(ll k = 0; k < N; k++) {
                        if (P_ % i == 0) {
                            P_ /= i;
                        } else {
                            ok1 = false;
                            break;
                        }
                        if (P_ == 0) {
                            ok1 = false;
                            break;
                        }
                    }
                }
                P_ = P;
                for(ll k = 0; k < N; k++) {
                    if (P_ % j == 0) {
                        P_ /= j;
                    } else {
                        ok2 = false;
                        break;
                    }
                    if (P_ == 0) {
                        ok2 = false;
                        break;
                    }
                }

                if (ok1) ans = max(ans, i);
                if (ok2) ans = max(ans, j);
            }
        }
    }
    cout << ans << endl;
}

int main() {
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    solve();
    return 0;
}

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

using namespace std;

#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n)　for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
#define Eunique(v) v.erace(unique(all(v)),v.end())
#define pvec(v)　rep(i,v.size()){cout << v[i] << " ";}
#define INF 0x3f3f3f3f
#define mset(m,v) memset(m,v,sezeof(m))
#define mod 1e9 +7;

const double pi = acos(-1.0);

typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef deque<ll> dll;
typedef pair<ll,ll> P;
ll dx[4] = {1,0,-1,0},dy[4] = {0,1,0,-1};

ll gcd(ll x,ll y)
{
    ll r;
    while((r = x % y) != 0)
    {
        x = y;
        y = r;
    }
    return y;
}

ll lcm(ll x,ll y)
{
    x /= gcd(x,y);
    y /= gcd(x,y);
    return (x*y);
}

int main()
{
    ll n,k,x,y,ans;
    cin >> n >> k >> x >> y;
    if(n <= k)ans = x*n;
    else ans = x*k + y*(n-k);
    cout << ans << endl;
    return 0;
}

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

int main() {
  vector<char> a(3);
  int b=0;
  for(int i;i<3;i++){
    cin>>a.at(i);
    if(a.at(i)=='1'){
      b++;
    }
  }
  cout<<b<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=1000000007;
const double PI=3.14159265358979;
const ll INF= pow(10,18);
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";

int main() {
  vl a(5);
  rep(i,5){
    cin >> a[i];
  }
  ll n=INF;
  ll sum=0;
  rep(i,5){
    if(a[i]%10!=0){
      n=min(n,a[i]%10);
      while(a[i]%10!=0){
        a[i]++;
      }
    }
    sum +=a[i];
  }
  if(n!=INF){
    cout << sum-10+n << endl;
  }
  else
    cout << sum << endl;
}

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

using namespace std;



int main() {
  int N, K;
  cin >> N >> K;
  vector<int> H(N);
  for (int i = 0; i < N; ++i) {
    cin >> H[i];
  }

  //
  const long long INF = 1LL << 60;
  vector<long long> C(N, INF);
  C[0] = 0;
  for (int i = 1; i < N; ++i) {

    long long min_cost = INF;
    for (int j = 1; j <= K; ++j) {
      if(i - j >= 0) min_cost = min(min_cost, abs(H[i]-H[i-j]) + C[i-j]);
    }
    C[i] = min_cost;
  }

  cout << C[N-1] << endl;


  return 0;
    return 0;
}




Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
typedef long long int uli;
const int mxn=5e3+10;
const int mxm=200+10;
uli x[mxn];
uli b[mxn][mxm];
int n,m;
int f[mxm];
bool can[mxm];
uli maxi[mxm];
int main(){
  scanf("%d %d",&n,&m);
  for(int i=1;i<n;i++){
    scanf("%lld",x+i);
    x[i]+=x[i-1];
  }
  for(int i=0;i<n;i++)
    for(int j=0;j<m;j++)
      scanf("%lld",&b[i][j]);

  uli best=0;
  for(int i=0;i<n;i++){
    uli bet=0;
    for(int k=0;k<m;k++){
      bet+=b[i][k];
      can[k]=true;
      maxi[k]=b[i][k];
    }
    best=max(best,bet);
    bool ok=true;
    for(int j=i+1;j<n && ok;j++){
      ok=false;
      bet=0;
      for(int k=0;k<m;k++){
        if(can[k] && b[i][k]>b[j][k]){
          ok=true;
        }
        else can[k]=false;
        maxi[k]=max(maxi[k],b[j][k]);
        bet+=maxi[k];
      }
      if(ok){
        bet-=(x[j]-x[i]);
        best=max(best,bet);
      }
    }
  }
  printf("%lld\n",best);
  return 0;
}


Measured memory_bytes: 8576
# include <iostream>
# include <cmath>
# include <algorithm>
# include <stdio.h>
# include <cstdint>
# include <cstring>
# include <string>
# include <cstdlib>
# include <vector>
# include <bitset>
# include <map>
# include <queue>
# include <ctime>
# include <stack>
# include <set>
# include <list>
# include <random>
# include <deque>
# include <functional>
# include <iomanip>
# include <sstream>
# include <fstream>
# include <complex>
# include <numeric>
# include <immintrin.h>
# include <cassert>
# include <array>
# include <tuple>
# include <unordered_set>
# include <unordered_map>
using namespace std;

const int mx = 5000 * 5000;


long long n, ga, sa, ba, gb, sb, bb;
long long dp[mx + 15];

int main(int argc, const char * argv[]) {
#ifdef __APPLE__
    freopen("/Users/danya.smelskiy/Documents/Danya/Resources/input.txt","r",stdin);
    //freopen("/Users/danya.smelskiy/Documents/Danya/Danya/output.out", "w", stdout);
#endif
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    cin >> n >> ga >> sa >> ba >> gb >> sb >> bb;
    long long cur = 0, cur2, ans = 0;
    for (int i = 1; i <= n; ++i) {
        cur = i;
        if (i >= ga) {
            cur2 = dp[i - ga] + gb;
            if (cur2 > cur) cur = cur2;
        }
        if (i >= sa) {
            cur2 = dp[i - sa] + sb;
            if (cur2 > cur) cur = cur2;
        }
        if (i >= ba) {
            cur2 = dp[i - ba] + bb;
            if (cur2 > cur) cur = cur2;
        }
        dp[i] = cur;
    }
    ans = cur;
    memset(dp, 0, sizeof(dp));
    for (int i = 1; i <= ans; ++i) {
        cur = i;
        if (i >= gb) {
            cur2 = dp[i - gb] + ga;
            if (cur2 > cur) cur = cur2;
        }
        if (i >= sb) {
            cur2 = dp[i - sb] + sa;
            if (cur2 > cur) cur = cur2;
        }
        if (i >= bb) {
            cur2 = dp[i - bb] + ba;
            if (cur2 > cur) cur = cur2;
        }
        dp[i] = cur;
    }
    cout << cur << '\n';
    return 0;
}



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

int main() {
  int n;
  cin >> n;

  bool can99 = false;
  rep (i, 10) {
    rep (j, 10) {
      if (i * j == n) {
        can99 = true;
        exit;
      }
    }
    if (can99) {
      exit;
    }
  }

  if (can99) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;    
  }
  
  return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;

class Program {
    static void Main(string[] args) {
        int N = Cin.Ni();
        int M = Cin.Ni();
        char[,] A = new char[N, N];
        char[,] B = new char[M, M];
        int diff = N - M;

        for (int i = 0; i < N; i++) {
            string s = Cin.Next();
            for (int j = 0; j < N; j++) {
                A[i, j] = s[j];
            }
        }
        for (int i = 0; i < M; i++) {
            string s = Cin.Next();
            for (int j = 0; j < M; j++) {
                B[i, j] = s[j];
            }
        }
        for (int i = 0; i <= diff; i++) {
            for (int j = 0; j <= diff; j++) {
                if (IsExist(A, B, i, j)) {
                    Console.WriteLine("Yes");
                    return;
                }
            }
        }
        Console.WriteLine("No");
    }
    public static bool IsExist(char[,] a, char[,] b, int startX, int startY) {
        for (int i = 0; i < b.GetLength(0); i++) {
            for (int j = 0; j < b.GetLength(0); j++) {
                if (a[i + startX, j + startY] != b[i, j]) return false;
            }
        }
        return true;
    }

}


public class Cin {
    private static string[] s = new string[0];
    private static int i = 0;

    private static char[] cs = new char[] { ' ' };

    public static string Next() {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        i = 0;
        return Next();
    }

    public static int Ni() {
        return int.Parse(Next());
    }

    public static long NextLong() {
        return long.Parse(Next());
    }

    public static double NextDouble() {
        return double.Parse(Next());
    }

}


Measured memory_bytes: 2648
#include <cstdio>
#include <cmath>
using  namespace std;

int A=10,B=11,C=12,D=13,E=14,F=15;

int main()
{
	char X,Y;
	scanf("%c %c",&X,&Y);
	if(X > Y) printf(">\n");
	if(X < Y) printf("<\n");
	if(X == Y) printf("=\n");
	return 0;
}

Measured memory_bytes: 128
n = int(input())
A = [n]
B = []
for i in range(2, int(n**0.5)+1):
    # if n%i==0:
    t = n
    u = n
    f = 0
    g = 0
    while t%i==0:
        t //= i
        f = 1
    while u%(n//i) == 0:
        u //= (n//i)
        g = 1
    if (t - 1) % i == 0 and f==1:
        B.append(i)
    if (u - 1) % (n//i) == 0 and g==1:
        B.append(n//i)

for i in range(1, int((n-1)**0.5) + 1):
    if (n-1)%i == 0:
        B.append(i)
        B.append((n-1)//i)
# AA = A
# # AA = list(set(A))
# A = [[AA[i], n//AA[i]] for i in range(len(AA))]
# print(A)
# B = []
# for i in range(len(A)):
#     a = A[i][0] - 1
#     # for i in range(1, int(a**0.5)+1):
#     #     if a%i==0 and a//i != 1:
#     #         B.append(a//i)
#     if a % A[i][1] == 0:
#         B.append(A[i][0])
# print(B)
print(len(set(B)))

Measured memory_bytes: 40880
#include <bits/stdc++.h>
using namespace std;
using PP = pair<long, long>;
const int INF = 1e9;
template <class T> T Next() { T buf; cin >> buf; return buf; }

char str_in[1 << 16];
long input_pre() {
  char* head = str_in;
  while (fgets(head, 1 << 16, stdin)) {
    while (*head) {
      ++head;
    }
  }
}

long input() {
  static const char* head = str_in;
  while (!isdigit(*head)) {
    ++head;
  }
  
  long ret = 0;
  char c;
  while (isdigit(*head)) {
    ret *= 10;
    ret += *head - '0';
    ++head;
  }
  return ret;
}

static char str_out[1 << 16];
void output(long val) {
  static char* head = str_out;
  static char buf[20];
  
  char* buf_head = buf;
  while (val > 0) {
    *buf_head = '0' + val % 10;
    ++buf_head;
    val /= 10;
  }
  
  for (char* p = buf_head - 1; p >= buf; --p) {
    *head = *p;
    ++head;
  }
  
  *head = '\n';
  ++head;
}

void post() {
  puts(str_out);
}

const long INFLL = 1e18;
long s[1001];
long t[1001];
long u[1001];
long ds[1000];
long dt[1000];
long du[1000];
int main() {
  input_pre();
  int a = input();
  int b = input();
  int c = input();
  int z = input();
  
  for (int i = 0; i < a; ++i) s[i] = input();
  for (int i = 0; i < b; ++i) t[i] = input();
  for (int i = 0; i < c; ++i) u[i] = input();
  sort(s, s + a, greater<long>());
  sort(t, t + b, greater<long>());
  sort(u, u + c, greater<long>());
  s[a] = -INFLL;
  t[b] = -INFLL;
  u[c] = -INFLL;
  
  for (int i = 0; i < a; ++i) ds[i] = s[i] - s[i + 1];
  for (int i = 0; i < b; ++i) dt[i] = t[i] - t[i + 1];
  for (int i = 0; i < c; ++i) du[i] = u[i] - u[i + 1];
  
  using Pair = pair<long, int>;
  
  unordered_set<int> st;
  st.reserve(z + 1);
  
  vector<Pair> mem;
  mem.reserve(2 * z + 1);
  priority_queue<Pair> Q(less<Pair>(), move(mem));
  Q.push(make_pair(s[0] + t[0] + u[0], 0));
  
  int cnt = 0;
  while (cnt < z) {
    auto q = Q.top(); Q.pop();
    long sc = q.first;
    int pos = q.second;
    if (st.count(pos)) continue;
    st.insert(pos);
    
    int i =  pos        & 0x3ff;
    int j = (pos >> 10) & 0x3ff;
    int k = (pos >> 20) & 0x3ff;
    
    output(sc);
    Q.push(make_pair(sc - ds[i], pos +  1       ));
    Q.push(make_pair(sc - dt[j], pos + (1 << 10)));
    Q.push(make_pair(sc - du[k], pos + (1 << 20)));
    ++cnt;
  }
  post();
}


Measured memory_bytes: 512
# AGC033A

import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


h,w = map(int, input().split())
s = [None] * h
for i in range(h):
    s[i] = input()

r = h
c = w
ds = [[10**15]*c for _ in range(r)]
for i in range(r):
    prev = -1
    for j in range(c):
        if s[i][j]=="#":
            prev = j
        if prev>=0:
            ds[i][j] = j-prev
    prev = -1
    for j in range(c-1,-1,-1):
        if s[i][j]=="#":
            prev = j
        if prev>=0:
            ds[i][j] = min(ds[i][j], prev-j)
for j in range(c):
    prev = -1
    prevind = -1
    for i in range(r):
        if prev<0 or ds[i][j]<prev+(i-prevind):
            prev = ds[i][j]
            prevind = i
        if prev>=0:
            ds[i][j] = min(ds[i][j], prev+(i-prevind))
    prev = -1
    prevind = -1
    for i in range(r-1, -1, -1):
        if prev<0 or ds[i][j]<prev+(prevind-i):
            prev = ds[i][j]
            prevind = i
        if prev>=0:
            ds[i][j] = min(ds[i][j], prev+(prevind-i))
print(max(max(item) for item in ds))

Measured memory_bytes: 57180
#pragma gcc optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V)) //小さい方からソート
#define REV(V) reverse(ALL(V)) //リバース
#define RSORT(V) SORT(V);REV(V) //大きい方からソート
#define NPN(V) next_permutation(ALL(V)) //順列
#define pb(n) push_back(n)
#define endl '\n'
#define Endl '\n'
#define DUMP(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define Yay(n) cout << ((n) ? "Yay!": ":(") << endl
#define RAPID cin.tie(0);ios::sync_with_stdio(false)
#define VSUM(V) accumulate(ALL(V), 0)
#define MID(a,b,c) (a) < (b) && (b) < (c)
#define MIDe(a,b,c) (a) <= (b) && (b) <= (c)
#define IN(n) cin >> n
#define IN2(a,b) cin >> a >> b
#define IN3(a,b,c) cin >> a >> b >> c 
#define IN4(a,b,c,d) cin >> a >> b >> c >> d
#define VIN(V) for(int i = 0; i < (V).size(); i++) {cin >> (V).at(i);}
#define OUT(n) cout << n << endl
#define VOUT(V) REP(i, (V).size()) {cout << (V)[i] << endl;}
#define VOUT2(V) REP(i, (V).size()) {cout << (V)[i] << " ";} cout<<endl;

// 型マクロ定義
#define int long long
#define P pair<ll,ll>
#define Vi vector<ll>
#define Vd vector<double>
#define Vs vector<string>
#define Vc vector<char>
#define M map<ll,ll>
#define S set<ll>
#define PQ priority_queue<ll>
#define PQG priority_queue<ll,V,greater<ll>
//

const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int gcd(int a,int b){return b != 0 ? gcd(b, a % b) : a;} //最大公約数
int lcm(int a, int b){return a * b / gcd(a, b);}
string toStrUp(string str){char diff = 'A'-'a';REP(i,str.size()) str[i] += diff;return str;}
string gCh(string str, int key){return str.substr(key,1);}

signed main() {
  RAPID;
  // デフォルト変数定義
  int n=0,m=0,a=0,b=0,c=0,d=0,x=0,y=0,z=0;
  string s="",t="";
  //

  // ここから
  IN2(n,m);
  Vs BOARD(n);
  VIN(BOARD)

  Vi dx(8);
  Vi dy(8);
  dx = {1, 0, -1, 0, 1, -1, -1, 1};
  dy = {0, 1, 0, -1, 1, 1, -1, -1};

  REP(i,n){
    REP(j,m){
      if(BOARD[i][j] == '#') continue;
      int num = 0;
      REP(k,8){
        const int ni = i + dy[k];
        const int nj = j + dx[k];

        if(ni < 0 || n <= ni) continue;
        if(nj < 0 || m <= nj) continue;
        if(BOARD[ni][nj] == '#') num++;
      }
      BOARD[i][j] = char(num + '0');
    }
  }

  VOUT(BOARD)
}

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


#define ll long long
#define pb push_back

#define loop(i, a, b) for(int i = (a); i < (b); i++)
#define loopb(i, a, b) for(int i = (a); i > (b); --i)

typedef pair <int,int> ii;
typedef vector <int> vi;
typedef vector <ii> vii;
typedef vector <ll> vl;

const int mod = 1e9+7;
const ll inf = 2e18+5;


int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    
    ll r,d,x,y;
    cin>>r>>d>>x;
    loop(i,0,10){
        y=r*x-d;
        cout<<y<<endl;
        x=y;
    }
   
    return 0;
}   

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std ;
int main() {
  int N,X;
  cin >> N >> X;
  
  vector<int> vec(N);
  for(int i=0; i<N; i++) {
    cin >> vec.at(i);
  }
  
  sort(vec.begin(),vec.end());
  for(int i=0; i<N; i++) {
    X -= vec.at(i);
  }
  
  int a = 0;
  
  while(X>=vec.at(0)) {
    X -= vec.at(0);
    a++;
  }
  
  cout << N + a << endl;
}

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

using lli = int64_t;
using vi = vector<lli>;

lli M = 1e9 + 7;
lli U = 2e5;

vi fact(U + 1);

void init_fact()
{
    fact[0] = 1;

    for(lli i = 1; i <= U; i++)
        fact[i] = (fact[i - 1] * i) % M;
}

lli powmod(lli b, lli e)
{
    lli ans = 1;

    for(lli i = 0; i < 32; i++, b = (b * b) % M) if(e & (lli(1) << i))
        ans = (ans * b) % M;

    return ans;
}

lli invmod(lli a)
{
    return powmod(a, M - 2);
}

lli divmod(lli a, lli b)
{
    return (a * invmod(b)) % M;
}

lli binc(lli n, lli k)
{
    if(k > n) return 0;

    return divmod(fact[n], (fact[n - k] * fact[k]) % M);
}

lli count_paths(lli h, lli w)
{
    return binc(h + w - 2, h - 1);
}

int main()
{
    ios_base::sync_with_stdio(0);

    init_fact();

    lli h, w, a, b; cin >> h >> w >> a >> b;

    lli ans = 0;

    for(lli i = b + 1; i <= w; i++)
    {
        lli x = count_paths(h - a, i);
        lli y = count_paths(a, w - i + 1);

        lli total = (x * y) % M;

        ans = (ans + total) % M;
    }

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

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

using namespace std;

void let_rotate(string &n, deque<char> (&n1))
{
    n1.push_front(n[n.size() - 1]);
    n1.pop_back();
    n.erase(n.size()-1);
}

bool let_check(deque<char> n1, deque<char> m1)
{
    for (int i = 0; i < n1.size(); i++)
    {
        if (n1[i] != m1[i])
            return false;
    }
    return true;
}

int main()
{
    string n, m;
    cin >> n >> m;
    deque<char> n1;
    deque<char> m1;
    for (char i : n)
        n1.push_back(i);
    for (char i : m)
        m1.push_back(i);
    for (int i = 0; i < n1.size(); i++)
    {
        if (let_check(n1, m1))
        {
            cout<<"Yes";
            return 0;
        } else
        {
            let_rotate(n, n1);
        }
    }
    cout<<"No";
    return 0;
}
//kyoto
//tokyo

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <cmath>
#include <limits.h>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
#include <algorithm>
#include <functional>
#include <stdio.h>
using namespace std;

long long MOD = 1000000007;

int main() {
    
    int N,K;
    cin >> N >> K;
    vector<int> A(N);
    for ( int i = 0; i < N; i++ ) {
        cin >> A[i];
    }

    cout << ( (N-K)/(K-1) + ( ( (N-K)%(K-1) == 0 ) ? 0 : 1 ) ) + 1 << endl;



    return 0;
}

Measured memory_bytes: 640
#define _USE_MATH_DEFINES
#include <iostream>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>
#include <map>
#include <set>
#include <array>
#include <stdio.h>
#include <string.h>
using ll = long long;
using ull = unsigned long long;
using namespace std;
#define int long long
#define CONTAINS_VEC(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v) (reverse((v).begin(), (v).end()))
#define ARY_REVERSE(v,a) (reverse((v), (v)+(a)))
#define REP(i, n) for (int (i)=0; (i) < (n); (i)++)
#define CONTAINS_MAP(m, a) (m).find((a)) != m.end()
#define CONTAINS_SET(m, a) (m).find((a)) != m.end()
void YesNo(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YESNO(bool b) { cout << (b ? "YES" : "NO") << endl; }


int N, X;
int M[1001];

signed main()
{
	cin >> N >> X;
	REP(i, N) cin >> M[i];

	int ans = N;

	int rest = X;
	for (int i = 0; i < N; i++) rest -= M[i];

	ARY_SORT(M, N);

	ans += rest / M[0];

	cout << ans << endl;
}



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

   typedef long long ll;
   typedef pair<ll, ll> Pii;
   typedef vector<ll> Vi;
   typedef vector<Vi> VVi;

   const double EPS = (1e-7);
   const ll INF =(1e13);
   const double PI = (acos(-1));
   const ll MOD = ll(1e9) + 7;

   #define REP(i, n) for(ll i = 0; i < (ll)(n); i++)
   #define REPR(i, n) for(ll i = n; i > -1; i--)
   #define FOR(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
   #define ALL(x) (x).begin(),(x).end()
   #define SORT(x) sort((x).begin(), (x).end())
   #define RSORT(x) sort((x).rbegin(), (x).rend())
   #define REVERSE(x) reverse((x).begin(), (x).end())
   #define SZ(x) ((ll)(x).size())
   #define pb push_back
   #define mp make_pair

   //chmax(a, b): a>bならaをbで更新　更新したときにtrueを返す
   //chmin(a, b): a<bならaをbで更新　更新したときにtrueを返す
   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; }

   #define dump(x) cerr<< #x << "= " << (x) << endl;

   ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
   ll pow(ll a, ll b){if (b == 0) return 1; else if (b % 2 == 0) return pow(a * a, b / 2); else return pow(a * a, b / 2) * a;}
   ll pow(ll a, ll b, ll m){if (b == 0) return 1; else if (b % 2 == 0) return (pow(a * a, b / 2, m) % m); else return (pow(a * a, b / 2) * a) % m;}
   ll residue(ll a, ll m){return ((a % m) + m) % m;};

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

ll N;
int main(){
  cin >> N;
  ll ans;
  if (N % 11 == 0) ans = 2 * (N / 11);
  else if (N % 11 <= 6) ans = 2 * (N / 11) + 1;
  else ans = 2 * (N / 11) + 2;
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<iomanip>
#include<list>
#include<deque>
#include <boost/multiprecision/cpp_int.hpp>
namespace mp = boost::multiprecision;
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define DEB2(X) cout<<X<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define DEB2(X) {}
#define END {}
#endif
typedef unsigned long long ll;
#define int ll
#define uset unordered_set
#define umap unordered_map
//typedef std::pair<int,int> P;
struct edge{int to,cost;};
const int INF=100000000000000000;
const int INF2=9223372036854775807;
const int MOD=1000000007;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define min(X,Y) (((int)(X)<(int)(Y))?(X):(Y))
#define max(X,Y) (((int)(X)>(int)(Y))?(X):(Y))
#define NP(X,Y) next_permutation(X,Y)
#define setdouble(X,Y) cout<<fixed<<setprecision(X)<<Y
int ceil2(int a,int b){if(a%b==0){return a/b;}else{return a/b+1;}}
int pow2(int a,int b){int r=1;for(int i=1;i<=b;i++){r*=a;}return r;}
int Log2(int a){int t=0;while(1){if(a==0||a==1){break;}a/=2;t++;}return t;}

mp::cpp_int N;
mp::cpp_int A[100010];

signed main(){
	cin>>N;
	REP(i,N){
		cin>>A[i];
      	if(A[i]==0){
        	cout<<0<<endl;
          return 0;
        }
	}
	mp::cpp_int ans=1;
	mp::cpp_int t=1000000000000000000;
	REP(i,N){
		ans*=A[i];
		if(ans>t){
			cout<<-1<<endl;
			return 0;
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 6836