akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define inf 0x7fffffff
#define ll long long
#define REP(i,a,b) for(int i=a;i<=b;i++)
using namespace std;

int main() {
        ios_base::sync_with_stdio(false); 
        cin.tie(NULL);
        // Code Starts...
        ll n;
        cin>>n;
        vector<ll > v(n);
        for (int i=0;i<n;i++)
            cin>>v[i];
        vector<ll > dp(n,inf); // it stores the min cost incurred so far...
        dp[0] = 0; // cost at stone 1 is 0...
        for (int i=1;i<n;i++)
        {
            dp[i] = min(dp[i-1]+abs(v[i]-v[i-1]),dp[i-2]+abs(v[i]-v[i-2]));
        }
        cout<<dp[n-1]<<endl;
        // Code Ends...
        return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define rep(i,a,b) for (int i=(a),_E=(b); i<=_E; ++i)
#define per(i,a,b) for (int i=(a),_E=(b); i>=_E; --i)
#define REP(i,n) for (int i=(0),_E=(n); i<_E; ++i)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef long long ll;

const int N = 100005;
int sum[N], c[N], a[N], pa[N], n, Q, L, R;
char s[N];

inline int getpa(int x) {
	return pa[x] == x ? x : pa[x] = getpa(pa[x]);
}

int main() {
	scanf("%s%d", s + 1, &Q);
	n = strlen(s + 1);
	rep (i, 1, n) {
		a[i] = s[i] - 'a';
	}
	rep (i, 1, n + 1) {
		c[i] = (a[i] - a[i-1] + 26) % 26;
		pa[i] = min(i, n + 2 - i);
	}
	rep (i, 1, Q) {
		scanf("%d%d", &L, &R);
		pa[getpa(L)] = getpa(R+1);
	}
	rep (i, 1, n + 1) {
		sum[getpa(i)] += c[i];
	}
	rep (i, 1, n + 1) {
		if (pa[i] == i && sum[i] % 26) {
			return puts("NO"), 0;
		}
	}
	puts("YES");
	return 0;
}

Measured memory_bytes: 1664
#include<iostream>
#include<cstdio>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<cstring>
#include<string>
#include<sstream>
#include<cmath>
#include<ctime>
#include<algorithm>
#define LL long long
#define PII pair<int,int>
#define PLL pair<LL,LL>
#define pi acos(-1.0)
#define eps 1e-6
#define lowbit(x) x&(-x)
using namespace std;

const int maxn=1010;
int w,h,n;
int X1[maxn],Y1[maxn],X2[maxn],Y2[maxn];
int dx[4]={1,-1,0,0},dy[4]={0,0,1,-1};
int fld[2*maxn][2*maxn];

int compress(int *s1,int *s2,int w){
    vector<int> xs;
    for(int i=0;i<n;i++){
        int tx1=s1[i];
        int tx2=s2[i];
        if(tx1>=1 && tx1<w) xs.push_back(tx1);
        if(tx2>=1 && tx2<w) xs.push_back(tx2);
    }
    xs.push_back(0);
    xs.push_back(w);
    sort(xs.begin(),xs.end());
    xs.erase(unique(xs.begin(),xs.end()),xs.end());
    for(int i=0;i<n;i++){
        s1[i]=find(xs.begin(),xs.end(),s1[i])-xs.begin();
        s2[i]=find(xs.begin(),xs.end(),s2[i])-xs.begin();
    }
    return xs.size()-1;
}

int bfs(){
    int ans=0;
    for(int y=0;y<h;y++){
        for(int x=0;x<w;x++){
            if(fld[y][x]) continue;
            ans++;
            queue<PII> q;
            q.push(make_pair(x,y));
            while(!q.empty()){
                int sx=q.front().first;
                int sy=q.front().second;
                q.pop();
                for(int i=0;i<4;i++){
                    int tx=sx+dx[i];
                    int ty=sy+dy[i];
                    if(tx<0 || tx>w || ty<0 || ty>h) continue;
                    if(fld[ty][tx]>0) continue;
                    q.push(make_pair(tx,ty));
                    fld[ty][tx]=1;
                }
            }
        }
    }
    return ans;
}

void solve(){
    memset(fld,0,sizeof(fld));
    w=compress(X1,X2,w);
    h=compress(Y1,Y2,h);
    for(int i=0;i<n;i++){
        fld[Y1[i]][X1[i]]++;
        fld[Y1[i]][X2[i]]--;
        fld[Y2[i]][X1[i]]--;
        fld[Y2[i]][X2[i]]++;
    }
    for(int i=0;i<h;i++){
        for(int j=1;j<w;j++){
            fld[i][j]+=fld[i][j-1];
        }
    }
    for(int i=1;i<h;i++){
        for(int j=0;j<w;j++){
            fld[i][j]+=fld[i-1][j];
        }
    }
    printf("%d\n",bfs());
}

int main(){
    while(scanf("%d %d",&w,&h)!=EOF && (w || h)){
        scanf("%d",&n);
        for(int i=0;i<n;i++) scanf("%d %d %d %d",&X1[i],&Y1[i],&X2[i],&Y2[i]);
        solve();
    }
    return 0;
}







Measured memory_bytes: 19172
l,r = list(map(int,input().split()))
a = 201900000
if r-l > 2018:
    a= 0

l %= 2019
r %= 2019

L = min(l,r)
R = max(l,r)

# print(L,R)
for i in range(L,R+1):
    for j in range(i+1,R+1):
        a = min(a,(i*j)%2019)

print(a)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rrep(i,n) for (int i = n-1; i >= 0; i--)
#define rep2(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 tmax(a,b,c) max(a,max(b,c))
#define tmin(a,b,c) min(a,min(b,c))
#define pb push_back
#define eb emplace_back
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vs vector<string>
#define vc vector<char>
#define vb vector<bool>
#define vp vector<P>
using namespace std;
using ll = long long;
using P = pair<int,int>;
using LP = pair<ll,ll>;
template<class T> istream& operator>>(istream& is,vector<T>& v) { for(T& t:v){is>>t;} return is; }
template<class T> ostream& operator<<(ostream& os,const vector<T>& v) { for(T t:v){os<<t<<" ";} os<<"\n"; return os; }
void Yes(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YES(bool b) { cout << (b ? "YES" : "NO") << endl; }
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 inf = 1001001001;
const ll linf = 1001001001001001001;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    int s,w;
    cin >> s >> w;
    cout << (w >= s ? "unsafe" : "safe") << endl;
}


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

const int MAX = 10000;

int parent(int uft[], int child) {
	if (uft[child] == -1)return child;
	return uft[child] = parent(uft, uft[child]);
}

int main() {
	int uft[MAX];
	int n;
	int q;

	cin >> n >> q;

	for (int i = 0; i < n; i++)uft[i] = -1;
	for (int i = 0; i < q; i++) {
		int com, x, y;
		cin >> com >> x >> y;
		
		if (com == 0) {
			int xp = parent(uft, x);
			int yp = parent(uft, y);
			if (xp != yp) {
				uft[xp] = yp;
			}
		}
		else {
			if (parent(uft, x) == parent(uft, y)) {
				cout << 1 << endl;
			}
			else {
				cout << 0 << endl;
			}
		}
	}

	return 0;
}

Measured memory_bytes: 3244
n=int(input())
c=[1]
i=1
while (6**i)<=100000:
    c.append(6**i)
    i+=1
i=1
while (9**i)<=100000:
    c.append(9**i)
    i+=1
c.sort(reverse=True)
dp=[[0]*(n+1) for _ in range(len(c)+1)]
dp[0]=[i for i in range(n+1)]

for i in range(len(c)):
    for j in range(n+1):
        if 0<=j-c[i]<=n:
            dp[i+1][j]=min(dp[i][j], dp[i+1][j-c[i]]+1)
        else:
            dp[i+1][j]=dp[i][j]

print(dp[-1][-1])

Measured memory_bytes: 55024
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  while(cin >> n, n){
    vector<string> s(n);
    for(int i=0;i<n;i++)
      cin >> s[i];
    set<string> st;
    int ans=1000;
    for(int k=1;k<60;k++){
      st.clear();
      for(int i=0;i<n;i++){
	string get=string(1,s[i][0]);
	for(int p=1;p<s[i].size();p++)
	  if(s[i][p-1]=='a' || s[i][p-1]=='i' || s[i][p-1]=='u' || s[i][p-1]=='e' || s[i][p-1]=='o')
	    get+=s[i][p];
	if(get.size()>k)
	  get=get.substr(0,k);
	st.insert(get);
      }
      if(st.size()==n){
	ans=k;
	break;
      }
    }
    if(ans<=55)
      cout << ans << endl;
    else
      cout << -1 << endl;
  }
  return 0;
}

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

using namespace std;

int dp[100007];
int stones[1000];
int main(){

    int N, K;
    cin >> N >> K;

    for(int i = 1; i <= N; i++) cin >> stones[i];

    for(int i = 1; i <= K; i++){
        for(int j = 1; j <= N; j++){
            if(i - stones[j] >= 0 and not dp[i - stones[j]]){
                dp[i] = 1;
                break;
            }
        }
    }

    if(dp[K])
        cout << "First";
    else
        cout << "Second";
}


Measured memory_bytes: 640
#define _USE_MATH_DEFINES //M_PI, M_E
#include<bits/stdc++.h>
#define mod 1000000007
#define ll long long int
#define ar array
#define pb push_back
ll power(ll a,ll b){ll r=1;for(;b;b>>=1){if(b&1)r=r*a%mod;a=a*a%mod;}return r;}
using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int a,b;
	cin>>a>>b;
	a *=b;
	if(a&1) cout<<"Odd"<<endl;
	else cout<<"Even"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define pb push_back
#define N 300000
#define ll long long
#define int ll 
#define pi pair<int , int>
#define pip pair<pair ,int>
#define mp make_pair 
#define f first
#define s second
#define mod 998244353
ll Mod(ll x, ll y, int p) 
{ll res = 1; x = x % p;
while (y > 0) 
{if(y & 1) res = (res*x) % p; 
y = y>>1;x = (x*x) % p; 
}return res; 
}
int* getlps(string pattern){
 int len = pattern.length();
 int * lps = new int[len];
 lps[0] = 0;
 int i = 1 , j = 0;
 while(i < len){
  if(pattern[i] == pattern[j]){
	  lps[i] = j+1;
   i++;
   j++;
  }
  else{
		if(j != 0){
		 j = lps[j-1];
		}
		else{
		 lps[i] = 0;
		 i++;
		}
  }
 }
 return lps;
}
class Triplet{
 public:
 int x ;
 int y ;
 int gcd;
};
Triplet extendedEuclid(int a , int b){
 if(b == 0){Triplet ans; ans.gcd = a;ans.x = 1;ans.y = 0;return ans;}
 Triplet smallAns = extendedEuclid(b , a%b);
 Triplet ans;
 ans.gcd = smallAns.gcd;
 ans.x = smallAns.y;
 ans.y = smallAns.x - (a/b)*smallAns.y;
 return ans;
}
int mmInverse(int a , int m){
 Triplet ans = extendedEuclid(a , m);
 return ans.x;
}
int n;
int arr[N];
map<pi , int> dp;
const int MIN = -1e18;
int fun(int idx , int k){
   //if(idx >= n && k > 0)return MIN;
   if(k ==0 && idx >= n)return 0;
   if(idx >= n)return MIN;
    if(n-idx < 2*k - 1)return MIN;
   if(dp.count({idx , k}) > 0)return dp[{idx , k}];
   //if(v[idx])return dp[idx];
  // v[idx] = true;
   int sum = 0;
   if(k > 0){
     sum = arr[idx]+fun(idx+2 , k-1);
 }
   int op2 = fun(idx+1 , k);
   return dp[{idx , k}] = max(sum , op2);
}
int32_t main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin>>n;
for(int i = 0 ; i < n ; i++){
		cin>>arr[i];
}
//memset(v , false , sizeof(v));
cout<<fun(0 , n/2)<<endl;
}


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

int main(){
  string s;
  cin >> s;
  string S="";
  for(int i=0;i<s.size();i++){
    if(s.at(i)=='0'){
      S+='0';
    }else if(s.at(i)=='1'){
      S+='1';
    }else if(s.at(i)=='B'){
      if(S.size()!=0){
        S.pop_back();
      }
    }
  }
  cout << S << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int const p=1e9+7;
int f[5005][2],g[5005][2];
int mod(int x){return x>=p?x-p:x;}
int main()
{
    int n,a,b;
    scanf("%d%d%d",&n,&a,&b);
    if(a>b)swap(a,b);
    g[1][1]=1;
    for(int i=2;i<b;i++)
    {
        for(int j=1;j<=i-a;j++)
            g[i][0]=mod(g[i][0]+g[j][1]);
        g[i][1]=mod(g[i-1][0]+g[i-1][1]);
    }
    f[0][0]=f[0][1]=1;
    for(int i=1;i<=n;i++)
    {
        for(int j=max(i-a+1,0);j<i;j++)f[i][0]=mod(f[i][0]+f[j][1]);
        for(int j=max(i-b+1,0);j<i;j++)
        {
            if(i==n)f[i][0]=(f[i][0]+1ll*f[j][0]*g[i-j][0])%p;
            if(j==0)f[i][1]=(1ll*f[i][1]+g[i][0]+g[i][1])%p;
            else f[i][1]=(f[i][1]+1ll*f[j][0]*g[i-j][1])%p;
        }
    }
    int pw=1;
    for(int i=1;i<=n;i++)pw=mod(pw+pw);
    printf("%lld",(1ll*pw+p+p-f[n][0]-f[n][1])%p);
    return 0;
}

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

int main(int argc, char *argv[])
{
    char S[3][128];
    int idx[3] = {0}, c, last = 'a';
    fgets(S[0], sizeof(S[0]), stdin);
    fgets(S[1], sizeof(S[1]), stdin);
    fgets(S[2], sizeof(S[2]), stdin);
    for (c = 'a'; c != '\n'; ){
        int n = S[c-'a'][idx[c-'a']];
        idx[c-'a']++;
        last = c;
        c = n;
    }
    printf("%c\n", toupper(last));
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <stdlib.h>
#include <map>
using namespace std;
typedef long long LL;
const int N = 2e5 + 10;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
int n,a[N];
const LL inf=1e18;
map<int,LL>dp[N];
int main() {
  	ios::sync_with_stdio(false);
  	cin>>n;LL s=0;
  	//
  	for(int i=1;i<=n;i++)cin>>a[i];
  	for(int i=0;i<=n;i++){
  		for(int j=i/2-1;j<=i/2+1;j++){
  			dp[i][j]=-inf;
  		}
  		dp[i][0]=0;
  	}
  	for(int i=1;i<=n;i++){
  		if(i&1 && i<=i/2+1)dp[i][i]=a[i];
  		for(int j=i-2;j>=0&&i-j<=3;j--){
  			for(int k=j/2-1;k<=j/2+1;k++){
  				if(k>=i/2-2 && k<=i/2){
  					dp[i][k+1]=max(dp[i][k+1],dp[j][k]+a[i]);
  				}
  			}
  		}
  		//if(i%2==0)cout<<i<<' '<<dp[i][i/2+1]<<endl;
  	}
  	LL ans=-inf;
  	for(int i=1;i<=n;i++){
  		if(dp[i].count(n/2)){
  			ans=max(ans,dp[i][n/2]);
  			//cout<<i<<' '<<dp[i][n/2]<<endl;
  		}
  	}
  	cout<<ans<<'\n';
 	return 0;
}

Measured memory_bytes: 58608
N = int(input())

name = []
time = []
for i in range(N):
    a,b=input().split()
    name.append(a)
    time.append(int(b))
X = input()
for i in range(N):
    if X == name[i]:
        break
ans = sum(time[i+1:])
print(ans)



Measured memory_bytes: 3060
#include<stdio.h>
#include<string.h>
#include<iostream>
#include<math.h>
#include<string>
#include<vector>
#include<map>
#include<queue>
#include<cmath>
using namespace std;
using ll = long long int;
//typedef pair<int,int> P;

int main(void){
	char N[12],M[12];
	scanf("%s",N);
	scanf("%s",M);
	int lenA=strlen(N)+1;
	int lenB=strlen(M);
	if(lenA==lenB){
		for(int n=0;n<strlen(N);n++){
			if(N[n]!=M[n]){
				cout << "No";
				return 0;
			}
		}
	}else{
		cout << "No";
		return 0;
	}
	cout << "Yes";
	return 0;
}


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

int main(){
int a,b,c,d;
cin>>a>>b>>c>>d;
int x=fabs(a-b);
int y=fabs(b-c);
int z=fabs(a-c);
if(z<=d||(x<=d&&y<=d))cout<<"Yes"<<endl;
else cout<<"No"<<endl;
return 0;
}

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

//point
typedef complex<double> P;
namespace std {
	bool operator < (const P& a, const P& b) {
		return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
	}
	bool cmp_y(const P &a, const P &b){
		return a.imag() != b.imag() ? a.imag() < b.imag() : a.real() < b.real();
	}
}
double cross(const P& a, const P& b) {
	return imag(conj(a)*b);
}
double dot(const P& a, const P& b) {
	return real(conj(a)*b);
}

// line
struct L : public vector<P> {
	L(const P& a, const P& b) {
		push_back(a); push_back(b);
	}
};

P projection(const L &l, const P &p) {
	double t = dot(p-l[0], l[0]-l[1]) / norm(l[0]-l[1]);
	return l[0] + t*(l[0]-l[1]);
}
double distanceLP(const L &l, const P &p) {
	return abs(p - projection(l, p));
}

// circle
struct C {
	P p; double r;
	C(const P& p, double r) : p(p), r(r) {}
};

int intersectCC(const C& a, const C& b) {
	double dist = sqrt(norm(a.p-b.p)), r1 = a.r + b.r, r2 = abs(a.r - b.r);
	if(r1 < dist) return 4;		//??\?????????
	if(dist == r1) return 3;	//?????\
	if(r2 < dist && dist < r1) return 2; //?????????
	if(dist == r2) return 1; //?????\
	return 0;	//??????
}

vector<P> crossPointCL(C c, L l) {
	double d = distanceLP(l, c.p), r = c.r;
	P m = projection(l, c.p);
	P x = sqrt(r*r-d*d)/abs(l[1]-l[0])*(l[1]-l[0]);
	vector<P> ret(2,m);
	ret[0] -= x;
	ret[1] += x;
	return ret;
}

int main() {
	double x1, y1, r1;
	cin >> x1 >> y1 >> r1;
	C c1(P{x1, y1}, r1);
	int q;
	cin >> q;
	for(int i=0; i<q; ++i) {
		double x1, y1, x2, y2;
		cin >> x1 >> y1 >> x2 >> y2;
		L l(P{x1, y1}, P{x2, y2});
		vector<P> ans = crossPointCL(c1, l);
		sort(ans.begin(), ans.end());
		cout << fixed << setprecision(15) << ans[0].real() << " " << ans[0].imag() << " " << ans[1].real() << " " << ans[1].imag() << endl;
	}
	
}

Measured memory_bytes: 3320
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>
#include <time.h>
#include <tuple>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = (1LL << 60) - 1;
const ll MOD = 1000000007;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1
#define MAX_N 100100 * 3

int n;
ll ans = 1;
string s[2];
int pre = -1;

int main() {
	cin >> n;
	cin >> s[0] >> s[1];
	rep(i, n) {
		if (pre == -1) {
			if (s[0][i] == s[1][i]) {
				ans *= 3;
				pre = 0;
			}
			else {
				ans *= 6;
				i++;
				pre = 1;
			}
		}
		else {
			if (pre == 0) {
				if (s[0][i] == s[1][i]) {
					ans *= 2;
				}
				else {
					ans *= 2;
					i++;
					pre = 1;
				}
			}
			else {
				if (s[0][i] == s[1][i]) {
					pre = 0;
				}
				else {
					ans *= 3;
					i++;
				}
			}
		}
		ans %= MOD;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
N,A,B=map(int,input().split());M=998244353;P=N+1;f=1;F=[1]*P;I=[1]*P;z=0;R=range
for n in R(1,P):F[n]=f=f*n%M
I[N]=i=pow(f,M-2,M)
for n in R(N,1,-1):I[n-1]=i=i*n%M
for k in R(min(A+1,N-B)if N-B-A else A+1):Q=N-B-k-1;z=(z+(B-k)*F[B+k-1]*I[B]*I[k]*F[Q+A-k]*I[Q]*I[A-k])%M
print(z if B else 1)

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

#define	mod 			1000000007
#define	inf 			1000000000000000
#define infty			1000000000000000000LL
#define	md				998244353
#define	PI				acos(-1.0)
#define	endl 			"\n"
#define	rr				return
#define	br				cout<<"\n";
long long prime[1000000];

void sieve()
{
	prime[0]=0;
	prime[1]=0;
	for(int i=2;i<1000000;i++)
		prime[i]=1;

	for(int i=2;i*i<1000000;i++)
		if(prime[i]==1)
			for(int j=i*i;j<1000000;j+=i)
				prime[j]=0;
}

bool isPrime(int n)
{
    if (n <= 1)
        return false;
    for (ll i = 2; i <= floor(sqrt(n)); i++)
        if (n % i == 0)
            return false;

    return true;
}

int factorial(int n)
{
    int f=1;
    for(int i = 1;i<=n ; i++)
        f = (f*i)%mod;
    return f;
}

int gcd(int a, int b)
{
	return !b ? a : gcd(b, a % b);
}

int lcm(int a, int b)
{
	return (a / gcd(a, b)) * b;
}

int fastExponentiation(int n, int x, int modulo)
{
	int res = 1;
	while(x > 0)
       {
          if(x & 1)
          res = (res*n) % modulo;
          x = x >> 1;
          n = (n * n) % modulo;
       }
       return res;
}

int power(int n , int p )
{
	if(p==0)
	   return 1;

	 int res = power((n*n)%mod,p/2);
	 if(p%2==1)
	   res = (n*res)%mod;

	   	 return res;
}

bool isPowerOfTwo(int n)
{
   	return n && (!(n&(n-1)));
}

bool isSet(int n,int i)
{
	// To check if ith bit is set or not in binary representation of n
   	return n & (1 << i);
}

bool valid_coordinate(ll x,ll y,ll n,ll m)
{
    if(x<0 || y<0)
       return false;

   	else if(x>=n || y>=m)
       return false;

   	else
   		return true;
}

int sod(int n)
{
	int sum=0;
	while(n)
	{
		sum+=(n%10);
		n/=10;
	}
	return sum;
}



void solve()
{
	ll n,k,ans=0;
	cin>>n;
	k=100;
	while(true){
		k*=1.01;
		ans++;
		if(k>=n)
			break;
	}
	cout<<ans<<endl;
}
/*
103
3
*/
int32_t main()
{

	//int t; cin>>t; while(t--)
	solve();

	return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
#include <boost/math/constants/constants.hpp>
using namespace std;
typedef long long ll;
long double e = boost::math::constants::e<long double>();
long double pi = boost::math::constants::pi<long double>();
// 条件を見落としていませんか？
int main () {
    long double L;
    cin >> L;
    L /= 3;
    printf("%.20Lf\n", L*L*L);
}

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

#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()

using ll = long long;
using ull = unsigned long long;
using namespace std;

int main() {
  int H, N, i;
  bool can = false;
  cin >> H >> N;
  vector<int> A(N);
  REP(i, N) {
    cin >> A[i];
  }
  sort(ALL(A), greater<ll>());
  REP(i, N) {
    H -= A[i];
    if (H <= 0) {
      can = true;
      break;
    }
  }
  if (can == true) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 640
#include<iostream>
#include<cstring>
#include<cmath>
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
const int mod=1e9+7,maxn=200010;
ll ni[maxn],f[maxn],h,w,a,b,ans,fx[maxn],tmp;
int main(){
	f[0]=1;ni[0]=ni[1]=1;fx[0]=1;
	for(int i=1;i<=200000;++i)f[i]=f[i-1]*i%mod;
	for(int i=2;i<=200000;++i)ni[i]=(mod-mod/i)*ni[mod%i]%mod;
	for(int i=1;i<=200000;++i)fx[i]=fx[i-1]*ni[i]%mod;
	cin>>h>>w>>a>>b;
    int s1=b,s2=h-a-1,s=s1+s2;
	tmp=f[s]*fx[s1]%mod*fx[s2]%mod;
	int t2=a,t1=w-1-s1,t=t1+t2;
	tmp=tmp*f[t]%mod*fx[t1]%mod*fx[t2]%mod;
	ans+=tmp;
	while(s1<w-1&&s2>0){
		s1++;s2--;t1--;t2++;tmp=0;
		tmp=f[s]*fx[s1]%mod*fx[s2]%mod;
		tmp=tmp*f[t]%mod*fx[t1]%mod*fx[t2]%mod;
		ans=(ans+tmp)%mod;
	}
	cout<<ans;
	system("pause");
	return 0;
}


Measured memory_bytes: 5120
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
ll GetDigit(ll num){ return log10(num)+1; } //numの桁数を求める

int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    int ans = min(b+c,min(a+b,a+c));
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3632
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
using namespace std;

int a[10][10];
int rem, n;
bool big(int x, int y, int r){
    bool res = true;
    if(x - 2 < 0 || x + 2 >= 10 || y - 2 < 0 || y + 2 >= 10)return false;
    for(int i = x - 2;i <= x + 2;i++)
	for(int j = y - 2;j <= y + 2;j++)
	    if(abs(x - i) + abs(y - j) <= 2){		
		a[i][j] += r;
		rem += r;
		if(a[i][j] < 0)res = false;
	    }
    if(!res)big(x, y, -r);
    return res;
}

bool small(int x, int y, int r){
    bool res = true;
    if(x - 1 < 0 || x + 1 >= 10 || y - 1 < 0 || y + 1 >= 10)return false;
    for(int i = x - 1;i <= x + 1;i++)
	for(int j = y - 1;j <= y + 1;j++)
	    if(abs(x - i) + abs(y - j) <= 1){
		a[i][j] += r;
		rem += r;
		if(a[i][j] < 0)res = false;
	    }
    if(!res)small(x, y, -r);
    return res;
}

bool middle(int x, int y, int r){
    bool res = true;
    if(x - 1 < 0 || x + 1 >= 10 || y - 1 < 0 || y + 1 >= 10)return false;
    for(int i = x - 1;i <= x + 1;i++)
	for(int j = y - 1;j <= y + 1;j++){
	    a[i][j] += r;
	    rem += r;
	    if(a[i][j] < 0)res = false;
	}
    if(!res)middle(x, y, -r);
    return res;
}

typedef pair<int, int> P;
typedef pair<P, int> T;

vector<T> ans;

bool solve(int n,int p = 0, int q = 0){
    if(rem > 13 * n)return false;
    if(p - 2 >= 0 && q - 2 >= 0 && a[p - 2][q - 2])return false;
    for(int i = p;i < 10;i++){
	for(int j = 0;j < 10;j++){
	    if(a[i][j] == 0)continue;
	    if(big(i, j, -1)){
		ans.push_back(T(P(i, j), 3));
		if(solve(n - 1, i, j))return true;
		ans.pop_back();
		big(i, j, 1);
	    }
	    if(middle(i, j, -1)){
		ans.push_back(T(P(i, j), 2));
		if(solve(n - 1, i, j))return true;
		ans.pop_back();
		middle(i, j, 1);
	    }
	    if(small(i, j, -1)){
		ans.push_back(T(P(i, j), 1));
		if(solve(n - 1, i, j))return true;
		ans.pop_back();
		small(i, j, 1);
	    }
	}
    }
    return (n == 0);
}

int main(){
    cin >> n;
    for(int i = 0;i < 10;i++)
	for(int j = 0;j < 10;j++){
	    cin >> a[i][j];
	    rem += a[i][j];
	}
    
    solve(n);
    for(int i = 0;i < ans.size();i++){
	cout << ans[i].first.second << " "<< ans[i].first.first << " "<<ans[i].second << endl;
    }
    return 0;
}

Measured memory_bytes: 1204
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

// Arithmetic
func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

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

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

// Sort
type RuneSlice []rune

func (a RuneSlice) Len() int           { return len(a) }
func (a RuneSlice) Less(i, j int) bool { return a[i] < a[j] }
func (a RuneSlice) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	N, x := sc.nextInt(), sc.nextInt()
	A := sc.nextIntSlice(N)
	ans := 0
	for i := 1; i < N; i++ {
		sum := A[i] + A[i-1]
		if sum > x {
			A[i] = max(A[i]-sum+x, 0)
			ans += sum - x
		}
	}

	fmt.Fprintln(wtr, ans)
	wtr.Flush()
}


Measured memory_bytes: 3072
#include <bits/stdc++.h>
#define FOR(i, m, n) for (ll i = m; i < (n); i++)
#define RFOR(i, m, n) for (ll i = (m - 1); i >= 0; i--)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, n, 0)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
//#define print(ele) cout << (ele) << "\n"
#define print10(ele) cout << fixed << setprecision(10) << (ele) << "\n"

using namespace std;
typedef long long ll;
typedef vector<int> ivec;
typedef vector<string> svec;
typedef vector<ll> lvec;

const int mod = 1e9 + 7;
const ll INF = 1000000000000000000LL;

void print() { cout << endl; }

template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
  cout << head;
  if (sizeof...(tail) != 0) cout << " ";
  print(forward<Tail>(tail)...);
}

int main() {
  int a, b;
  cin >> a >> b;
  int x = (a + b + 1) / 2;
  print(x);
  return 0;
}

Measured memory_bytes: 256
N = int(input())
a = [ [str=="#" for str in input()]for _ in range(N)]
#all_source = [(i,j) for j in range(N) for i in range(N)]

n =0
ans =9999999999999
all_black_row = sum(all(a[i][j] for i in range(N)) for j in range(N))
black_count_line  = [(sum(a[i][j] for j in range(N))) for i in range(N)]
black_count_row = [(sum(a[i][j] for i in range(N))) for j in range(N)]
for line_no,blacks in enumerate(black_count_line):
    tmp_ans = N -  all_black_row
    if black_count_row[line_no] ==0:
        tmp_ans +=1
    tmp_ans += N-blacks
    ans = min(ans,tmp_ans)

if not any(black_count_line) and not any(black_count_row):
    ans = -1
print(ans)





Measured memory_bytes: 44124
#include <cstdio>
#include <cstring>
#include <iostream>
#include <vector>

using namespace std;
#define DEBUG(X) cerr<<__LINE__<<" "<<#X<<": "<<X<<endl;
#define sci(x) int x;scanf("%d",&x);
#define scii(x, y) int x,y;scanf("%d%d",&x,&y);
#define REP(i,y) for(int i=0;i<(int)(y);i++)
#define REPP(i,y) for(int i=1;i<=(int)(y);i++)
#define FOR(i,x,y) for(int i=(x);i<(int)(y);i++)
#define DUMP(A) for (auto x=begin(A); x != end(A);){cout <<*x++<< ' ';} cout<<endl;
typedef long long ll;
template<typename T> T inf;
template<> constexpr int inf<int> = 1e9;
template<> constexpr ll inf<ll> = 1e18;

struct edge {
    int from, to, cost;
    edge(int f, int t, int c) { from = f; to = t; cost = c; }
};
vector<edge> G;

const int MAX_V = 2100;

ll d[MAX_V];
int V,E;

ll shortest_path(int s) {
  for (int i=0;i<=V;i++) {
    d[i] = inf<ll>;
  }
  d[s] = 0;

  int LUP = -1;
  REP(loop,V) {
    bool update = false;
    REP(i,E) {
      edge e = G[i];
      if (d[e.from] != inf<ll> && d[e.to] > d[e.from] + e.cost) {
        d[e.to] = d[e.from] + e.cost;
        update =true;
        if (e.to==V) LUP=loop;
//        if (c == V-1) return -1;  // negative closed path
      }
    }
    if (!update) break;
  }
  //DUMP(d);
  return LUP>=V-1?-1:-d[V];
}

int main() {
  scanf("%d%d",&V,&E);
  REP(_,E) {
    scii(a,b) sci(c)
    G.push_back(edge(a,b,-c));
  }
  ll ans = shortest_path(1);
  if (ans==-1) printf("inf\n");
  else printf("%lld\n",ans);
}

Measured memory_bytes: 256
#include<iostream>
#include<complex>
using namespace std;
typedef complex<double> xy_t;
double x[4],y[4];
xy_t d[4];
double a[3]; 
double cross_product(xy_t a,xy_t b){
  return (conj(a)*b).imag();
}
int main(){
  while(1){
    for(int i=0;i<4;i++)cin>>x[i]>>y[i];
    if(!cin)break;
    for(int i=0;i<4;i++)d[i]=xy_t(x[i],y[i]);
    for(int i=0;i<3;i++){
      a[i]=cross_product(d[3]-d[i],d[3]-d[(i+1)%3]);
    }
    if(a[0]<0&&a[1]<0&&a[2]<0){
      cout<<"YES"<<endl;
    }else if(a[0]>0&&a[1]>0&&a[2]>0){
      cout<<"YES"<<endl;
    }else{
      cout<<"NO"<<endl;
    }
  }
}

Measured memory_bytes: 1224
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
//using namespace std;
#define MAX 1000
int top;
int S[MAX];
void initialize(){
    top=0;
}
bool isEmpty(){
    return top==0;
}
bool isFull(){
    return top>=MAX-1;
}
void push(int x){
    //if (isFull()){
    //    cout << "Error" <<endl;
    //    exit(-1);
    //}
    top++;
    S[top] = x;
}
int pop(){
    //if (isEmpty()){
    //    cout << "Error" <<endl;
    //    exit(-1);
    //}

    top--;
    return S[top+1];
}

int main(){
    int a, b;
    initialize();
    char s[MAX];
    while(scanf("%s", s) != EOF){
        if(s[0] == '+'){
            a = pop();
            b = pop();
            push(a+b);
        }else if (s[0]=='-'){
            b = pop();
            a = pop();
            push(a-b);
        }else if (s[0]=='*'){
            a = pop();
            b = pop();
            push(a*b);
        }else{
            push(atoi(s));
        }
    }

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

    return 0;
}



Measured memory_bytes: 2752
#include <set>
#include <array>
#include <iostream>

int main()
{
  std::array<int,8> hitting;
  std::set<int> blowing;
  while(std::cin >> hitting[0]){
    blowing.insert(hitting[0]);
    for(int i=1;i<8;++i){
      std::cin >> hitting[i];
      blowing.insert(hitting[i]);
    }
    int num=0;
    for(int j=0;j<4;++j){
      if(hitting[j]==hitting[j+4]){
        ++num;
     }
    }
    std::cout << num << " " << 8-(int)(blowing.size())-num << std::endl;
    blowing.clear();
  }
return 0;
}

Measured memory_bytes: 3056
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iostream>
#include <iostream>
#include <fstream>
#include <numeric>
#include <cstring>
#include <cassert>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <cmath>
#include <set>
#include <map>
#include <functional>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
using namespace std;
#define ll           long long
#define all(v)       (v).begin() , (v).end()
#define vi           vector <ll>
#define vii          vector <pair<ll,ll>>
#define ii           pair<ll,ll>
#define sz(v)	     ((int)((v).size()))
#define lp(i,a,b)    for(int i=a;i<b;i++)
#define pb           push_back
#define pf           push_front
#define F            first
#define S            second
#define endl         "\n"
#define IOS          ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const double PI = 3.14159265358979323846;
const ll inf=2e9,MOD=998244353,MAX=1e2+2;

int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    IOS;
    int n,d,x;
    cin>>n>>d>>x;
    int a[n],cnt=0;
    lp(i,0,n){
        cin>>a[i];
        int y=1;
        while(y<=d){
            cnt++;
            y+=a[i];
        }
    }
    cout<<cnt+x;
}

Measured memory_bytes: 3524
from sys import stdin, stdout
from itertools import repeat
def pr(a):
    a = [x + 1 for x in a]
    stdout.write(' '.join(map(str, a)))
def main():
    n, k = map(int, stdin.readline().split())
    p = map(int, stdin.readline().split(), repeat(10, n))
    q = map(int, stdin.readline().split(), repeat(10, n))
    p = [x - 1 for x in p]
    q = [x - 1 for x in q]
    if k == 1:
        pr(p)
        return
    if k == 2:
        pr(q)
        return
    def inv(a):
        r = a[:]
        for i, x in enumerate(a):
            r[x] = i
        return r
    def comp(a, b):
        return [a[x] for x in b]
    pinv = inv(p)
    qinv = inv(q)
    b = q
    a = comp(q, pinv)
    if k == 3:
        pr(a)
        return
    w = [b, a]
    for i in xrange(4, 8):
        a, b = comp(a, inv(b)), a
        if k == i:
            pr(a)
            return
        w.append(a)
    y = range(n)
    x = comp(q, comp(pinv, comp(qinv, p)))
    r = (k - 8) / 6 + 1
    while r:
        if r & 1:
            y = comp(x, y)
        x = comp(x, x)
        r >>= 1
    t = comp(y, comp(w[(k - 8) % 6], inv(y)))
    pr(t)
main()


Measured memory_bytes: 30960
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>

#define int long long
#define MOD 1000000007

#define rep(i, n) for (int i = 0; i < (n); i++)
#define REP(i, a, n) for (int i = (a); i <= (n); i++)
#define all(a) (a).begin(), (a).end()
#define mp(a, b) make_pair((a), (b))

using namespace std;

int dx[4] = { 1, 0, -1, 0 };
int dy[4] = { 0, -1, 0, 1 };
 
signed main() {
	int N;
	cin >> N;

	vector<int> p(N);
	rep(i, N) cin >> p[i];

	vector<int> a(N), b(N);
	rep(i, N) a[i] = 30000 * (i + 1);

	int sum = 30000 * (N + 2);
	rep(i, N) {
		int idx = p[i] - 1;
		b[idx] = sum - a[idx];
		sum++;
	}

	rep(i, N) cout << a[i] << " ";
	cout << endl;
	rep(i, N) cout << b[i] << " ";
	cout << endl;

}


Measured memory_bytes: 1152
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;

int main() {

    int n;
    vector< int > a;
    map< int, int > used;
    cin >> n;
    a.resize(n);
    for(int i = 0; i < n; i++) {
        cin >> a[i]; used[a[i]]++;
    }
    sort(a.begin(), a.end(), greater< int >());
    a.erase(unique(a.begin(), a.end()), a.end());

    int prev = 0, cnt = 0;
    for(int i = 0; i < a.size(); i++) {
        if(!cnt) prev = a[i];
        if(used[a[i]] / 2) {
            cnt += used[a[i]] / 2;
            if(cnt >= 2) {
                cout << (long long)prev * a[i] << endl;
                exit(0);
            }
        }
    }
    cout << 0 << endl;
}


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

#define for_(i,a,b) for(int i=a;i<b;i++)
#define minit(a,b) memset(a,b,sizeof(a));

int N, T, L, B;
bool lose[110], back[110];

double rate = 1.0 / 6.0;
double dp[110][110];

void solve() {
	minit(dp, 0);
	dp[0][0] = 1.0;
	
	for_(i,0,T) {
		for_(j,0,N) {
			if (dp[i][j] == 0.0) continue;
			
			for_(d,1,7) {
				int nxj = j + d;
				if (nxj > N) {
					int sub = nxj % N;
					nxj = N - sub;
				}
				
				if (back[nxj]) {
					dp[i + 1][0] += dp[i][j] * rate;
				} else if (lose[nxj]) {
					dp[i + 2][nxj] += dp[i][j] * rate;
				} else {
					dp[i + 1][nxj] += dp[i][j] * rate;
				}
			}
		}
	}
	
	double ans = 0.0;
	for_(i,0,T+1) ans += dp[i][N];
	printf("%lf\n", ans);
}

int main() {
	while (cin >> N >> T >> L >> B, N) {
		minit(lose, 0); minit(back, 0);
		for_(i,0,L) {
			int p; cin >> p;
			lose[p] = true;
		}
		for_(i,0,B) {
			int p; cin >> p;
			back[p] = true;
		}
		solve();
	}
	
	return 0;
}

Measured memory_bytes: 1280
#include <iostream>

using namespace std;

int main()
{
   int a,b;
   cin >> a >> b;
   int count = 0;
   for(int i = a; i <= b; i++){
       int j,k,l;
       j = i;
       k = i;
       l = i;
       j /= 10000;
       j %= 10;
       k /= 1000;
       k %= 10;
       l /= 10;
       l %= 10;
       if(i%10==j&&k==l)
        count++;
   }
   cout << count;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <bitset>
using namespace std;

typedef pair<int, int> P;
#define rep(i, n) for (int i=0; i<(n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007

int N, M;
vector<P> G[1500];
int D[1500][1500];
bool used[1500], marked[1500];

void dijkstra(int s) {
  int *dist = D[s];
  priority_queue<P, vector<P>, greater<P> > q;
  dist[s] = 0;
  q.push(P(0, s));
  while (!q.empty()) {
    int x = q.top()._2,
        r = q.top()._1;
    q.pop();
    if (dist[x] < r) continue;

    for (P p : G[x]) {
      int t = p._1, l = p._2;
      if (dist[t] > r+l) {
        dist[t] = r+l;
        q.push(P(r+l, t));
      }
    }
  }
}

signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> N >> M;
  rep(i, M) {
    int s, t, d;
    cin >> s >> t >> d;
    s--, t--;
    G[s].pb(P(t, d));
    G[t].pb(P(s, d));
  }
  rep(i, N) rep(j, N) D[i][j] = INF;
  rep(i, N) dijkstra(i);
  int R = 0;
  rep(i, N) rep(j, N) R = max(R, D[i][j]);

  rep(s, N) {
    int *dist = D[s];
    queue<int> q;
    rep(i, N) used[i] = false;
    rep(i, N) {
      if (dist[i] == R) q.push(i), used[i] = true;
    }
    while (!q.empty()) {
      int x = q.front();
      q.pop();

      for (P p : G[x]) {
        int t = p._1, r = p._2;
        if (dist[t]+r == dist[x]) {
          if (!used[t]) {
            used[t] = true;
            q.push(t);
          }
        }
      }
    }
    rep(i, N) marked[i] |= used[i];
  }
  vector<int> ans;
  rep(i, N) if (!marked[i]) ans.pb(i);
  cout << ans.size() << "\n";
  for (int x : ans) cout << x+1 << "\n";
  return 0;
}

Measured memory_bytes: 12084
#include <algorithm>
#include <iostream>
#include <vector>

int main() {
  const int N = 100000;
  std::vector<int> is_prime(N + 1, true);
  is_prime[0] = is_prime[1]  = false;
  for (int p = 2; p <= N; ++p) {
    if (not is_prime[p]) continue;
    for (int k = 2; p * k <= N; ++k) is_prime[p * k] = false;
  }
  std::vector<int> counter(N + 1, 0);
  for (int k = 1; k <= N; ++k) {
    counter[k] = counter[k - 1];
    if (k % 2 == 1 and is_prime[k] and is_prime[(k + 1) / 2]) ++counter[k];
  }
  int q, l, r;
  std::cin >> q;
  for (int qi = 0; qi < q; ++qi) {
    std::cin >> l >> r;
    std::cout << counter[r] - counter[l - 1] << std::endl;
  }
  return 0;
}

Measured memory_bytes: 2040
#include<stdio.h>

int main(){
int W,H,x,y,r;

scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);

if(x+r <= H && y+r <= H && x-r >= 0 && y-r >= 0){

printf("Yes\n");
}else{
printf("No\n");
}

return 0;

}


Measured memory_bytes: 2044
fun main(args: Array<String>) {
  val (h, w) = readLine()!!.split(" ").map { it.toInt() }
  val board = Array(h, { readLine()!! })
  val oneCount = if (h % 2 == 1 && w % 2 == 1) 1 else 0
  val twoCount = (if (h % 2 == 1) w / 2 else 0) + (if (w % 2 == 1) h / 2 else 0)
  val fourCount = h / 2 * w / 2

  val charCounts = IntArray(26)
  for (row in board) {
    for (c in row) {
      charCounts[c - 'a']++
    }
  }

  val oddCount = charCounts.filter { it % 2 == 1 }.size
  if (oddCount > oneCount) {
    println("No")
    return
  }

  val oddIndex = charCounts.indexOfFirst { it % 2 == 1 }
  if (oddIndex >= 0) {
    charCounts[oddIndex]--
  }

  val twoModFourCount = charCounts.filter { it % 4 == 2 }.size
  if (twoModFourCount > twoCount) {
    println("No")
    return
  }

  println("Yes")
}


Measured memory_bytes: 37860
H, W = map(int, input().split())
sh, sw = map(int, input().split())
gh, gw = map(int, input().split())

sh += 1
sw += 1
gh += 1
gw += 1

S = [0]*(H+4)
S[0] = '*'*(W+4)
S[1] = '*'*(W+4)
S[-2] = '*'*(W+4)
S[-1] = '*'*(W+4)
for h in range(2,H+2):
  S[h] = '**' + input() + '**'

visited = [[float('inf')]*(W+4) for _ in range(H+4)]
dh1 = [0,1,0,-1]
dw1 = [1,0,-1,0]
dh2 = [2,2,2,2,2,1,1,1,1,0,0,-1,-1,-1,-1,-2,-2,-2,-2,-2]
dw2 = [-2,-1,0,1,2,-2,-1,1,2,-2,2,-2,-1,1,2,-2,-1,0,1,2]

from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
d = []
heapify(d)
heappush(d,(0,sh,sw))
ans = float('inf')
while len(d)>0:
  cnt,h,w = heappop(d)
  if cnt>=ans:
    break
  visited[h][w] = cnt
  for i in range(4):
    h1 = h+dh1[i]
    w1 = w+dw1[i]
    if (h1,w1)==(gh,gw):
      ans = min(ans,cnt)
    if S[h1][w1]=='.':
      if visited[h1][w1]>cnt:
        visited[h1][w1]=cnt
        heappush(d,(cnt,h1,w1))
  for i in range(20):
    h2 = h+dh2[i]
    w2 = w+dw2[i]
    if (h2,w2)==(gh,gw):
      ans = min(ans,cnt+1)
    if S[h2][w2]=='.':
      if visited[h2][w2]>cnt+1:
        visited[h2][w2]=cnt+1
        heappush(d,(cnt+1,h2,w2))
ans = ans if ans<float('inf') else -1
print(ans)


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

#define endl            "\n"
#define ll              long long
#define ld              long double 
#define ull             unsigned long long int
#define MOD             (ll)(1e9 + 7)
#define vll             vector<ll>
#define pll             pair<ll,ll>
#define mll             map<ll,ll>
#define vpll            vector<pair<ll,ll>>
#define mpll            map<pair<ll,ll>,ll>
#define len(x)          x.length()
#define all(x)          x.begin(),x.end()
#define deb1(x)         cout<<#x<<" "<<x<<endl;
#define deb2(x,y)       cout<<#x<<" "<<x<<"\t"<<#y<<" "<<y<<endl;
#define deb3(x,y,z)     cout<<#x<<" "<<x<<"\t"<<#y<<" "<<y<<"\t"<<#z<<" "<<z<<endl;
#define debug1(x)       cerr<<#x<<" "<<x<<endl;
#define debug2(x,y)     cerr<<#x<<" "<<x<<"\t"<<#y<<" "<<y<<endl;
#define debug3(x,y,z)   cerr<<#x<<" "<<x<<"\t"<<#y<<" "<<y<<"\t"<<#z<<" "<<z<<endl;
#define fr(a,b,c)       for(auto a=b;a<c;a++)
#define frc(a,b,c)      for(auto a=b;a!=c;a++)
#define pb(x)           push_back(x)
#define lb(v,x)         lower_bound(v.begin(), v.end(), x)
#define ub(v,x)         upper_bound(v.begin(), v.end(), x)
#define GR              (double)(1 + sqrt(5)) / 2
#define fib(n)          (ll)round(pow(GR,n) / sqrt(5))
#define FIO             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define out1(x)         cout<<x<<" "<<endl
#define out2(x,y)       cout<<x<<" "<<y<<endl
#define SORT(a)         sort(all(a));
#define ARRAY(a,n)      vll a; fr(i,0,n) { ll temp; cin>>temp; a.pb(temp); }  
#define PRINT(a)        for(auto x:a)cout<<x<<" ";cout<<endl
#define MAX             100050

template<typename T>
void output_vector(const vector<T> &v, bool debug_print=false,bool add_one = false,int start = -1, int end = -1) {
    if (start < 0) start = 0;
    if (end < 0) end = int(v.size());
 
    for (int i = start; i < end; i++)
        (debug_print)?(cerr << v[i] + (add_one ? 1 : 0) << (i < end - 1 ? ' ' : '\n')):(cout << v[i] + (add_one ? 1 : 0) << (i < end - 1 ? ' ' : '\n'));
}


int n,w;

// int knapsack(int *wt,int *val,int w,int n){
//     if(n==0||w==0)
//         return 0;
//     if(wt[n-1]<=w)
//         return max(val[n-1]+knapsack(wt,val,w-wt[n-1],n-1),knapsack(wt,val,w,n-1));
//     return knapsack(wt,val,w,n-1);
// }


long knapsack(long *wt,long *val,long w,long n){
    long t[n+1][w+1];
    memset(t,0,sizeof(t));
    for(long i=1;i<n+1;i++)
    for(long j=1;j<w+1;j++)
    {
        if(wt[i-1]<=j)
            t[i][j]=max(val[i-1]+t[i-1][j-wt[i-1]],t[i-1][j]);
        else t[i][j]=t[i-1][j];
    }

    // for(long i=0;i<n+1;i++)
    // {    
    //     for(long j=0;j<w+1;j++)
    //     cout<<t[i][j]<<" ";cout<<endl;
    // }

    return t[n][w];
}


void solve(){
    cin>>n>>w;
    long wt[MAX],val[MAX];
    for(long i=0;i<n;i++)
    cin>>wt[i]>>val[i];
    cout<<knapsack(wt,val,w,n)<<endl;
}   

int main()
{   

    FIO;
    // ll test;cin>>test;
    // while(test--)
    solve();
    return 0;
}


Measured memory_bytes: 79232
#include <bits/stdc++.h>
using namespace std;
bool isMult=0;

void solve()
{
	int a,b;
	cin>>a>>b;
	int curr=1,counter=0;
	while(curr<b) 
	{
		curr--;
		curr+=a;
		counter++;
	}
	cout << counter << '\n';
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	int t=1;
	if(isMult) cin>>t;
	while(t--) solve();
	return 0;
}

Measured memory_bytes: 3672
def is_prime(n):
    if n == 1:
        return False
    for i in range(2,int(n**0.5)+1):
        if n % i == 0:
            return False
    return True

x = int(input())
while 0<1:
  if is_prime(x):
    print(x)
    break
  else:
    x+=1

Measured memory_bytes: 3188
#include<bits/stdc++.h>
#define ll long long int
#define ld long double
using namespace std;
int main(){
	ll n;
	cin >> n;
	ll p[n];
	for(ll i = 0; i < n; i++){
		cin >> p[i];
	}
	ll cnt = 0;
	ll min = p[0];
	for(ll i = 0; i < n; i++){
		min = min < p[i] ? min : p[i];
		if(p[i] <= min){
			cnt++;
		}
	}
	cout << cnt;
	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    map <string,int> m;
    string s;
    for(int i=0;i<n;i++)
    {
        cin>>s;
        m[s]+=1;
    }
    int maxi=0;
    for(auto i=m.begin();i!=m.end();i++)
    {
        maxi=max(i->second,maxi);
    }
    for(auto i=m.begin();i!=m.end();i++)
    {
        if(i->second==maxi)
            cout<<i->first<<endl;
    }
}

Measured memory_bytes: 25216
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
using namespace std;
#define INF 0x3f3f3f3f
//#define INF 1100000000000000000LL
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pint;
typedef tuple<int,int,int> tint;
typedef vector<int> vint;
typedef vector<ll> vll;
int dx[8]={0,0,-1,1,1,1,-1,-1};
int dy[8]={-1,1,0,0,1,-1,1,-1};
const int SIZE=2050;
//ここまでテンプレ
int main(){
	ll L[SIZE]={2,1,0};
	for(int i=2;i<1000;i++){
		L[i]=L[i-1]+L[i-2];
	}
	int N;
	cin>>N;
	cout<<L[N]<<endl;
	return 0;
}

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

using namespace std;

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
    ~debug() { cerr << endl; }
    eni(!=) cerr << boolalpha << i; ris; }
    eni(==) ris << range(begin(i), end(i)); }
    sim, class b dor(pair < b, c > d) {
    ris << "(" << d.first << ", " << d.second << ")";
    }
    sim dor(rge<c> d) {
    *this << "[";
    for (auto it = d.b; it != d.e; ++it)
	*this << ", " + 2 * (it == d.b) << *it;
    ris << "]";
    }
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

# define forn(i, n) for (ll i = 0; i < int(n); i++)
# define rfor(n, i) for (ll i = (n - 1); i >= 0; --i)
# define all(V) V.begin(), V.end()
# define rall(V) V.rbegin(), V.rend()
# define len(V) (int)V.size()
# define ll long long
# define ld long double
# define ff first
# define ss second
# define pb push_back
# define mp make_pair
# define endl '\n'
# define M_PI 3.14159265358979323846

void solve()
{
    int n; cin >> n;
    ll res = 0;
    for(int i = 1; i <= n; ++i)
    {
        for(int j = 1; j <= n; ++j)
        {
            for(int k = 1; k <=n; ++k)
            {
                res += __gcd(__gcd(i, j), k);
            }
        }
    }
    cout << res;
}

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
    solve();
}


Measured memory_bytes: 3652