akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#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 pi M_PI
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int main() {
    int n, m;
    while (cin >> n && n){
        int d[21][21] = {};
        REP(i,n){
            int a,b;
            cin >> a >> b;
            d[a][b] = 1;
        }
        cin >> m;
        int x = 10, y = 10;
        d[x][y] = 0;
        while (m--){
            char c;
            int a;
            cin >> c >> a;
            int dx = 0, dy = 0;
            if (c == 'E') dx = 1;
            if (c == 'W') dx = -1;
            if (c == 'N') dy = 1;
            if (c == 'S') dy = -1;
            while (a--){
                x += dx;
                y += dy;
                d[x][y] = 0;
            }
        }
        int f = 0;
        REP(i,21) REP(j,21) f += d[i][j];
        cout << (f == 0 ? "Yes" : "No") << endl;
    }


    return 0;
}

Measured memory_bytes: 2988
#include<bits/stdc++.h>
using namespace std;
#define FAST ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#define ll long long int

void findAns()
{


    int n;
    cin >> n;

    int rem = n % 1000;


    int ans = 1000 - rem;
    if (ans == 1000) ans = 0;
    cout << ans;

}
int main()
{
// #ifndef ONLINE_JUDGE
//     freopen("in.txt", "r", stdin);
//     freopen("test.txt", "w", stdout);
//     cout << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s" << "\n";
// #endif

    FAST;
    ll  t = 1;
    //cin >> t;

    while (t--) findAns();
}


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

#define mod 1000000007

int n,m,cnt,flag1,flag2,s1,s2;
long long k;
char s[2001][2001];

long long quickpow(long long base,long long to)
{
	if(to<=0)return 1;
	if(to==1)return base;
	long long mid=quickpow(base,to>>1);
	if(to&1)return mid*mid%mod*base%mod;
	else return mid*mid%mod;
}

struct Matrix{
	long long a[3][3];
	Matrix(){memset(a,0,sizeof(a));}
	Matrix operator*(Matrix &m)
	{
		Matrix ans;
		for(int i=1;i<=2;++i)
			for(int j=1;j<=2;++j)
				for(int k=1;k<=2;++k)
					ans.a[i][j]=(ans.a[i][j]+a[i][k]*m.a[k][j]%mod)%mod;
		return ans;
	}
};

int main()
{
	scanf("%d%d%lld",&n,&m,&k);
	for(int i=1; i<=n; ++i)
		scanf("%s",s[i]+1);
	for(int i=1; i<=n; ++i)
	{
		for(int j=1; j<=m; ++j)
			if(s[i][j]=='#')
			{
				++cnt;
				s1+=s[i][j-1]=='#';
				s2+=s[i-1][j]=='#';
			}
		if(s[i][1]=='#' && s[i][m]=='#')++flag1;
	}
	for(int i=1;i<=m;++i)if(s[1][i]=='#' && s[n][i]=='#')++flag2;
	if(flag1 && flag2)
	{
		puts("1");
		return 0;
	}
	if(!flag1 && !flag2)
	{
		printf("%lld\n",quickpow(cnt,k-1));
		return 0;
	}
	if(!flag1)swap(flag1,flag2),swap(s1,s2);
	Matrix A;
	A.a[1][1]=cnt;
	A.a[2][1]=s1;
	A.a[2][2]=flag1;
	--k;
	Matrix ANS;
	ANS.a[1][1]=ANS.a[2][2]=1;
	while(k)
	{
		if(k&1)ANS=ANS*A;
		A=A*A;
		k>>=1;
	}
	printf("%lld\n",(ANS.a[1][1]-ANS.a[2][1]+mod)%mod);
}


Measured memory_bytes: 2176
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
template<class T,class U> inline bool chmin(T&x,U y){if(x>y){x=y;return true;}return false;}
template<class T,class U> inline bool chmax(T&x,U y){if(x<y){x=y;return true;}return false;}
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)
int main(){
 cin.tie(nullptr);
 ios::sync_with_stdio(false);
 string s;
 cin>>s;
 if(s == "ABC"){
     cout<<"ARC";
 }
 else{
     cout<<"ABC";
 }
}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
  string s;
  cin>>s;
  ll l=s.length();
  ll sum=0;
  for(ll i=0;i<l;i++)
  {
    sum+=(int)s[i]-'0';
  }
  if(sum%9==0)
    cout<<"Yes";
  else
    cout<<"No";
    
  return 0;
}
  


Measured memory_bytes: 3756
#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
using namespace std;

// #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define ll long long int
#define ld long double
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>

vector <ll> v;

ll fep(ll x, ll y, ll mod)
{ll res=1;while(y>0){if(y&1)res=(res*x)%mod;
    y=y>>1;x=(x*x)%mod;}return res%mod;}

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

	ll n,i,m,j,k,x,y,a,b,t;
	string s;
	set <ll> st;
	
	cin >> n;
	if(n==2)
	{
		cout << 1;
		return 0;
	}
	st.insert(n);
	for(i=2;i*i<=n;i++)
	{
		x=n;
		while(x%i==0)
			x/=i;
		if(x%i==1)
			st.insert(i);
	}
	n--;
	st.insert(n);
	for(i=2;i*i<=n;i++)
		if(n%i==0)
			st.insert(i),st.insert(n/i);
	cout << st.size();

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <math.h>


int main()
{
  int n;
  int i;
  int score[1000];
  double stdib;
  double medi;
  double sum;
  double sum2;

   for (i=0; i<1000; i++) {
   score[i]=0;
   }



  while(1){
    scanf("%d",&n);
    if(n==0)break;

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

   sum = 1.0*0;


  for (i = 0; i < n; i++) {
  sum =sum+score[i];
  }
  //printf("%lf\n",sum);

  medi =sum/n;


  for (i = 0; i < n; i++) {
  sum = 1.0*sum+1.0*score[i];
  }

   sum2 = 1.0*0;

  for (i = 0; i < n; i++) {
  sum2 = pow((score[i]-medi),2)+1.0*sum2;
  }

  stdib = sqrt(sum2/n);

  printf("%lf\n",stdib);

 }

  return(0);

}

Measured memory_bytes: 636
#include<bits/stdc++.h>
using namespace std;
int main(){
  int h,n,sum;
  sum=0;
  cin >> h >> n;
  vector<int>a(n);
  for(int i=0;i<n;i++){
    cin >> a.at(i);
    sum+=a.at(i);
  }
  if(sum<h){
    cout << "No" << endl;
  }else{
    cout << "Yes" << endl;
  }
}

Measured memory_bytes: 640
#m = imt(imput())
#L = list(map(imt, imput().split()))
import math
import sys

N = int(input())
AB = [list(map(int, input().split())) for i in range(N)]
AB.sort(key=lambda x: x[1])

def aa(N,AB):
    clk = 0
    flg = True
    for i in range(N):
        clk += AB[i][0]
        if clk > AB[i][1]:
            flg = False
            break
    if flg:
        return "Yes"
    else:
        return "No"
print(aa(N,AB))


Measured memory_bytes: 53712
n = int(input())
s = list(input())
li_c =[]
li = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"]
for x in s:
  c = li.index(x)
  c += n
  if c > 25:
    c -= 26
  print(li[c], end = "")

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

typedef long long ll;

int main() {
  ll n;
  cin >> n;
  vector<ll> a(n);

  bool flag = false;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    if (a[i] == 0) flag = true;
  }

  if (flag) {
    cout << 0 << endl;
    return 0;
  }

  ll prod = 1;
  for (int i = 0; i < n; ++i) {
    if (prod >  (1000000000000000000 / a[i])) {
      cout << -1 << endl;
      return 0;
    } else {
      prod *= a[i];
    }
  }
  cout << prod << endl;
}

Measured memory_bytes: 3976
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const string ln = "\n";
constexpr int INF = 1001001001;
constexpr int MOD = 1000000007;

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);

  int x;
  cin >> x;
  int ans = pow(x, 3);
  cout << ans << ln;

  return 0;
}


Measured memory_bytes: 3360
from math import ceil
S = [ord(s) for s in input().strip()]
stack = []
L = []
pre = 0
for s in S:
    if s == pre:
        stack.append(s)
    else:
        L.append(len(stack))
        stack = [s]
        pre = s
if stack:
    L.append(len(stack))
L = L[1:]

Lm = [l for l in L if l%3 != 0] 
Lm = [1 if l%3 == 2 else 0 for l in Lm]
print
ans = 0
pre = 0
for lm in Lm:
    if pre and lm:
        pre = 0
        ans += 1
    else:
        pre = lm
ans += sum(2*ceil(l/3)-1 + (l%3 == 0) for l in L)
print(ans)


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

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

int main(){
    ll n;
    double m;
    cin >> n >> m;
    vector<ll> a(n);

    ll sum = 0;
    for(ll i = 0; i < n ; i++){
        cin >> a[i];
        sum += a[i];
    }
    sort(a.begin(), a.end(), greater<ll>());

    int ans = 0;
    while(a[ans]>=sum/(4*m)){
        ans++;
    }

    if(ans >= m){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }



    return 0;
}  


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	float M500;
	float M1000;
	
	while (scanf("%f %f" , &M500 , &M1000) != EOF){
		
	
		if ((M500 < 35.50) && (M1000 < 71.0)){
			printf("AAA\n");
		}
		
		else if ((M500 < 37.50) && (M1000 < 77.0)){
			printf("AA\n");
		}
		
		else if ((M500 < 40.0) && (M1000 < 83.0)){
			printf("A\n");
		}
		
		else if ((M500 < 43.0) && (M1000 < 89.0)){
			printf("B\n");
		}
		
		else if ((M500 < 50.0) && (M1000 < 105.0)){
			printf("C\n");
		}
		
		else if ((M500 < 55.0) && (M1000 < 116.0)){
			printf("D\n");
		}
		
		else if ((M500 < 70.0) && (M1000 < 148.0)){
			printf("E\n");
		}
		
		else {
			printf("NA\n");
		}
		
	}
	
	return (0);
}

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

int main() {
  string v;
  cin >> v[0] >> v[1] >> v[2];

  if(v[0] == '7' || v[1] == '7' || v[2] == '7') {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

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

int main(){
    int a,b,c;
    cin >> a >> b >> c;
    if(a+b+c<=21){
        cout << "win" << "\n";    
    }else{
        cout << "bust" << "\n";    
    }
    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys


def solve(a: int, s: str):
    if a >= 3200:
        print(s)
    else:
        print('red')
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    a = int(next(tokens))  # type: int
    s = next(tokens)  # type: str
    solve(a, s)

if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
import sys
sys.setrecursionlimit(10 ** 8)

def Z(): return int(input())
def ZZ(): return [int(_) for _ in input().split()]

def main():
    N = Z()
    ans = [0] * (10**4 + 1)

    for i in range(1, 101):
        for j in range(1, 101):
            for k in range(1, 101):
                w = i*i + j*j + k*k + i*j + j*k + k*i
                if 1 <= w < 10 ** 4 + 1:
                    ans[w] += 1
    for i in range(1, N+1):
        print(ans[i])

    return

if __name__ == '__main__':
    main()


Measured memory_bytes: 74224
#include <iostream>
#include <fstream>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <unordered_set>
#include <bitset>
#include <limits>
#include <algorithm>

#define MOD_BIG 1000000007
#define MOD_BIG2 998244353
using std::string;
using std::cin;
using std::cout;
using std::cerr;
using std::endl;
using ll = long long;
using pint = std::pair<int, int>;
using pll = std::pair<ll, ll>;
using std::vector;

#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)

//////////////////////////////////////


//////////////////////////////////////

int main() {
    
    int N, K, R, S, P;
    string T;
    cin >> N >> K >> R >> S >> P >> T;
    
    ll ans = 0;
    for(int i = 0; i < K; i++) {
        int ind = i;
        char b = '!';
        while (ind < T.length()) {
            if (T[ind] != b) {
                if (T[ind] == 'r') ans += P;
                if (T[ind] == 's') ans += R;
                if (T[ind] == 'p') ans += S;
                b = T[ind];
            } else {
                b = '!';
            }
            ind += K;
        }
    }
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 512
#include <iostream>
using namespace std;
int main()
{
    int n,m,i,j;
    char x[1000],y[1000];
    cin>>n>>m;
    for(i=0;i<n;i++)
    {
        x[i]=m+48;
    }
    x[n]='\0';
    for(j=0;j<m;j++)
    {
        y[j]=n+48;
    }
    y[m]='\0';
    if(n>m)
        cout<<x<<endl;
    else
        cout<<y<<endl;
    return 0;
}

Measured memory_bytes: 256
import std;

alias sread = () => readln.chomp();
alias lread = () => readln.chomp.to!long();
alias aryread(T = long) = () => readln.split.to!(T[]);
//aryread!string();
//auto PS = new Tuple!(long,string)[](M);
//x[]=1;でlong[]全要素1に初期化
void main()
{
    auto a = readln.chomp.to!BigInt();
    auto b = readln.chomp.to!BigInt();
    if (a > b)
    {
        writeln("GREATER");
    }
    else if (a < b)
    {
        writeln("LESS");
    }
    else if (a == b)
    {
        writeln("EQUAL");
    }

}

void scan(L...)(ref L A)
{
    auto l = readln.split;
    foreach (i, T; L)
    {
        A[i] = l[i].to!T;
    }
}

void arywrite(T)(T a)
{
    a.map!text.join(' ').writeln;
}


Measured memory_bytes: 3804
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <string>
#include <utility>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int INF=1<<29;
ll mod=1000000007;

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

	int A,B;
	cin>>A>>B;
	int Ans=max(A+B,max(A-B,A*B));
	cout<<Ans<<endl;
	return 0;
}

Measured memory_bytes: 256
A,B,N = map(int, input().split())
#ans = 0
#for x in range(N+1):
    #print(x,(A*x)//B - A*(x//B))
    #if ans < (A*x)//B - A*(x//B):
    #    ans = (A*x)//B - A*(x//B)
if B-1 > N:
    x = N
else:
    x = B -1

print((A*x)//B - A*(x//B))

Measured memory_bytes: 9168
r,g,b,n = map(int,input().split())
R = int(n/r)
G = int(n/g)
ans = 0
for i in range(0,R+1):
    for j in range(0,G+1):
        temp = i*r+j*g
        if (n-temp)%b==0 and n>=temp:
            ans += 1
print(ans)

Measured memory_bytes: 40684
#include<iostream>
#include<cstdio>
using namespace std;
typedef long long ll;
const int MAXN=1e6+10;
ll n;
struct DVD{
    static const int MAXN=1e6+10;
    ll arr[MAXN],cnt;
    void get_dvd(ll len){
        cnt=0;
        for(ll i=1;i*i<=len;i++){
            if(i*i==len){
                arr[++cnt]=i;
                break;
            }else if(len%i==0){
                arr[++cnt]=i;
                arr[++cnt]=len/i;
            }
        }
    }
}dvd;
int main(){
    scanf("%lld",&n);
    dvd.get_dvd(n-1);
    int res=dvd.cnt-1;
    dvd.get_dvd(n);
    for(int i=2;i<=dvd.cnt;i++){
        ll tmp=n;
        while(tmp%dvd.arr[i]==0) tmp/=dvd.arr[i];
        if(tmp%dvd.arr[i]==1) res++;
    }
    printf("%d",res);
    return 0;
}


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

using ll = long long;
using ld = long double;
constexpr ll inf = static_cast<ll>(1e17);
constexpr int iinf = static_cast<int>(1e9);
constexpr ll mod = static_cast<ll>(1e9 + 7);

std::string s;
int num[100005];
int main()
{
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);

    std::cin >> s;

    const auto n = (int)s.size();
    int cnt = 0;
    for (int i = 0; i < n; ++i) {
        if (s[i] == 'R')
            ++cnt;
        else {
            num[i] += cnt / 2;
            num[i - 1] += cnt - cnt / 2;
            cnt = 0;
        }
    }

    cnt = 0;
    for (int i = n - 1; i >= 0; --i) {
        if (s[i] == 'L')
            ++cnt;
        else {
            num[i] += cnt / 2;
            num[i + 1] += cnt - cnt / 2;
            cnt = 0;
        }
    }

    for (int i = 0; i < n; ++i) {
        std::cout << num[i];
        if (i != n - 1)
            std::cout << " ";
        else
            std::cout << std::endl;
    }

    return 0;
}


Measured memory_bytes: 1104
# -*- coding: utf-8 -*-

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

N, H = MAP()
A = [0] * N
B = [0] * N
for i in range(N):
    a, b = MAP()
    A[i] = a
    B[i] = b

A.sort(reverse=1)
B.sort(reverse=1)

mxa = A[0]
cnt = 0
for b in B:
    if H <= 0 or b <= mxa:
        break
    H = max(0, H-b)
    cnt += 1
cnt += ceil(H, mxa)
print(cnt)


Measured memory_bytes: 11312
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int> >;
#define rep(i, n)         for(int i = 0; i < (int)(n); i++)
#define brep(n)           for(int bit=0;bit<(1<<n);bit++)
#define erep(i,container) for (auto i : container)
#define irep(i, n)        for(int i = n-1; i >= (int)0; i--)
#define rrep(i,m,n) for(int i = m; i < (int)(n); i++)
#define reprep(i,j,h,w) rep(i,h)rep(j,w)
#define all(x) (x).begin(),(x).end()
#define aall(x,n) (x).begin(),(x).begin()+(n)
#define VEC(type,name,n) std::vector<type> name(n);rep(i,n)std::cin >> name[i];
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define itn int
#define mp make_pair
#define sum accumulate
#define keta fixed<<setprecision
#define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a))
#define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<t>(n,a)));
#define vvvvector(name,t,k,l,m,n,a) vector<vector<vector<vector<t> > > > name(k,vector<vector<vector<t> > >(l, vector<vector<t> >(m, vector<t>(n,a)) ));
typedef long long ll;
const int INF = 2000000000;
const ll INF64 = 9223372036854775806ll;
const int mod = 1000000007ll;
const ll  MOD = 1000000007LL;
/*メモ 
*/

    
int main(){
    int a,b,x;
    std::cin >> a>>b>>x;
    if(a<=x&&x<=a+b)std::cout << "YES" << std::endl;
    else std::cout << "NO" << std::endl;
}

Measured memory_bytes: 256
#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()
{
    ll N,K;
    cin >> N >> K;
    ll ans = K;
    repi(i,N,1){
        ans *= K-1;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define INS(x) x.begin(),x.end()
    
int a[105];
    
int main()
{
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int n;
    cin>>n;

    for (int i=0;i<n;i++)
        cin>>a[i];
    sort(a,a+n);

    int minn=INT_MAX;
    for (int i=a[0];i<=a[n-1];i++)
    {
        int dis=0;
        for (int j=0;j<n;j++)
            dis+=(a[j]-i)*(a[j]-i);
        minn=min(minn,dis);
    }

    cout<<minn<<'\n';
    return 0;
}

Measured memory_bytes: 256
# k=0
# a b c
# a-b

# k=1
# b+c c+a a+b
# b-a

# k=2
# 2a+b+c a+2b+c a+b+2c
# a-b
# equivalent to a,b,c

# k=3

import sys
#sys.stdin=open("data.txt")
input=sys.stdin.readline

a,b,c,k=map(int,input().split())

if k%2==0: print(a-b)
else: print(b-a)


Measured memory_bytes: 38384
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<iomanip>
#include<set>
#include<queue>

using namespace std;

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

	vector<vector<bool>> flag(n,vector<bool>(n,false));

	for(int k=0;k<n;k++)
		for(int i=0;i<n;i++)
		{
			for(int j=0;j<n;j++)
			{
				if(a[i][j]>a[i][k]+a[k][j])
				{
					cout << -1 << endl;
					return 0;
				}
				if(a[i][j]==a[i][k]+a[k][j] and k!=i and k!=j)
				{
					flag[i][j]=true;
				}
			}
		}
	
	long long ans=0;
	for(int i=0;i<n;i++)
		for(int j=i+1;j<n;j++)
			if(flag[i][j]==false)
				ans+=a[i][j];


	cout << ans << endl;


}


Measured memory_bytes: 640
#include <stdio.h>

int main()
{
    int a, b, flag = 0;
    char s[15];
    scanf("%d %d", &a, &b);
    scanf("%s", s);

    if(s[a]=='-')
    {
    	int i;
    	for(i=0;i<a;i++)
    		if(s[i]<'0'||s[i]>'9')
    			break;
    	if(i==a)
    	{
    		for(i=a+1;i<a+b+1;i++)
	    		if(s[i]<'0'||s[i]>'9')
	    			break;
	    	if(i==a+b+1)
	    		flag = 1;
    	}
    }
    

    if(flag)
    	printf("Yes\n");
    else
    	printf("No\n");

    return 0;
}


Measured memory_bytes: 128
#include <cstdio>
#include <algorithm>
#include <utility>
using namespace std;

pair<int,int> bars[100000];
// a-1 Æ a ðñÅ¢éÆðß
int x[1000], y[1000];

int main(){
	int n, m, h, k, a, b, i;
	
	for(;scanf("%d%d%d%d", &n, &m, &h, &k), n;){
		for( i = 0; i < n; scanf("%d", y + i++ ) )
			x[i] = i;
			
		for( i = m; i--; bars[i] = make_pair( b, a ) )
			scanf("%d%d", &a, &b );
		sort( bars, bars + m );
//x: º©çÉ©½Æ«Ì³ÌÔ
//y: _

//		for( i = 0; i < m; i++ ){
		for( i = m ; i--; )
			swap( x[ bars[i].second - 1], x[ bars[i].second ] );

		for( i = 0; i < n; i++ ){
			a = y[ x[i] ];
			y[ x[i] ] = i;
			x[i] = a;
		}
//x: »ÌÔÉÎ·é_
//y: º©çÉ©½Æ«ÌAÅÌÔ

		b = 0;
		for( i = m; i--; ){
			a = bars[i].second;
			if( ( y[a-1] < k ) != ( y[a] < k ) ){
				b = max( b,
					y[a] < k ?	x[y[a]] - x[y[a-1]]
							 :	x[y[a-1]] - x[y[a]] );
			}
			swap( y[a-1], y[a] );
		}
		
		a = 0;
		for(; k--; ) a += x[k];
		
		printf("%d\n", a - b );
	}
}

Measured memory_bytes: 1544
#include <bits/stdc++.h>
using namespace std;
int main()
{
 long long int x, y;
 cin >> x >> y;
 for(int i = 1;;++i)
 {
 	x *= 2;
 	if(x > y)
 	{
 		cout << i << endl;
 		break;
 	}
 }
 return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pp pair<pair<ll, ll>,pair<ll, ll>>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define vii vector<int>
#define vll vector<ll>
#define mat vector<vector<ll>>
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define fi first
#define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (ll) (x).size()
#define pq priority_queue<ll>
#define pqg priority_queue<ll,vector<ll>,greater<ll>>
#define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
#define ERASE(v) sort(v.begin(),v.end());v.erase(unique(v.begin(),v.end()),v.end())
#define int ll
using namespace std;
const ll INF = (1 << 30 ) - 1;
const ll LLINF = (1LL << 60LL);
const ll MOD = 1000000007;
const ll mod = 998244353;
const ll MAX = 1100000;
const double pi = acos(-1);
const double eps = 1e-10;
ll dx[4] ={1,0,-1,0} , dy[4] ={0,1,0,-1};

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

struct Timer{
    chrono::system_clock::time_point start, end;
    Timer(){ start = chrono::system_clock::now(); }
    ~Timer(){
        end = chrono::system_clock::now();
        auto msec = chrono::duration_cast<chrono::milliseconds>(end - start).count();
        cerr<<"time : "<<msec<<" ms"<<endl;
    }
};



signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    // Timer TM;
    
    ll n;
    cin>>n;
    map<string,ll> mp;
    string s[110];
    rep(i,n){
        cin>>s[i];
    }
    mp[s[0]]++;
    char k=s[0][s[0].size()-1];
    rep2(i,1,n){
        if(s[i][0]!=k||mp[s[i]]>0){
            cout<<"No"<<endl;
            return 0;
        }
        mp[s[i]]++;
        k=s[i][s[i].size()-1];
    }
    cout<<"Yes"<<endl;

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
int main(){
	int stack[100],top = 0;
	char s[100];
	while (scanf("%s", s) != EOF) {
		if (s[0] == '+') {
			if (top<=1) {
				exit(1);
			}
			stack[top - 2] += stack[top - 1];
			top--;
		}
		else if (s[0] == '-') {
			if (top<=1) {
				exit(1);
			}
			stack[top - 2] -= stack[top -1];
			top--;
		}
		else if (s[0] == '*') {
			if (top<=1) {
				exit(1);
			}
			stack[top - 2] *= stack[top -1];
			top--;
		}
		else {
			if (top==100) {
				exit(1);
			}
			stack[top] = atoi(s);
			top++;
		}
	}
	printf("%d\n", stack[top-1]);
	return 0;
}



Measured memory_bytes: 2108
//おまじない
#include <iostream>
#include<iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#define INF 1e9+7
#define rep(i,n) for(int i=0;i<n;i++)
#define NO cout<<"NO"<<endl;
#define YES cout << "YES"<<endl;
#define No cout << "No"<<endl;
#define Yes cout << "Yes"<<endl;
#define all(a) a.begin(),a.end()
#define P pair<int,int>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
//(int)'a'は97 (int)'A'は65 (int)'1'は49
//おまじない

const int maxn = 100000;

//ans=nとして、つなげるたび、連結の最初の部分を見つけるたびにans--をする

int n,m;
int ans;
vector<vector<int>> v(maxn);
bool used[maxn];

void dfs(int s){
    queue<int> que;
    que.push(s);
    
    while(!que.empty()){
        int argv = que.front();
        que.pop();
        used[argv]=true;
        rep(j,v[argv].size()){
            if(!used[v[argv][j]]){
                //cout << argv << ' '<<v[argv][j]<<endl;
                que.push(v[argv][j]);
                used[v[argv][j]]=true;
                ans--;
            }
        }
    }
    return;
}

int main(){
    
    cin >> n>>m;
    ans=n;
    fill(used,used+n,false);
    rep(i,m){
        int x,y,z;
        cin >>x>>y>>z;
        x--;y--;
        v[x].push_back(y);
        v[y].push_back(x);
    }
    
    rep(i,n){
        if(!used[i]&&v[i].size()>0){
            dfs(i);
        }
    }
    
    cout << ans<<endl;
    
    return 0;
}


Measured memory_bytes: 6648
n = int(input())
xs = [int(i) for i in input().split()]
if n == 1:
    print(xs[0])
else:
    output1 = [None] * (n // 2)
    output2 = [None] * (n // 2)
    suf = 1
    if n % 2 == 1:
        suf = 2
    for i in range(n // 2):
        output1[i] = xs[i*2]
        if -(-2 * i - suf) <= n:
            output2[i] = xs[-2 * i - suf]
    if n % 2 == 1:
        output1.append(xs[n - 1])
        output1.reverse()
        output2.reverse()
        print(" ".join([str(i) for i in (output1 + output2)]))
    else:
        print(" ".join([str(i) for i in (output2 + output1)]))



Measured memory_bytes: 31760
#include<bits/stdc++.h>
#define vll vector<ll>
#define vi vector<int>
#define vpll vector<pair<ll,ll>>
#define pii pair<int,int>
#define REP(i,a) for(int (i)=0; (i)<(a); (i)++)
#define RREP(i,a) for(int (i)=a-1; (i)>=(0); (i)--)
#define REP2(i,a,b) for(int (i)=(a); (i)<(b); (i)++)
#define MOD 1000000007
#define ALL(v) v.begin(), v.end()
#define m0(x) memset(x,0,sizeof(x))
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 (a>b) { a=b; return 1; } return 0; }
typedef long long ll;

using namespace std;

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int N;
  cin >> N;
  string S;
  cin >> S;
  ll ans = 0;
  int pin[1000] = {};
  bool fi,se,th;

  REP(i,10)REP(j,10)REP(k,10){
    int now_checking = 0;
    fi = false; se = false; th = false;
    REP(s,N){
      if(S[s] == '0'+i && now_checking == 0){
        fi = true;
        now_checking++;
      }else if(S[s] == '0'+j && now_checking == 1){
        se = true;
        now_checking++;
      }else if(S[s] == '0'+k && now_checking == 2){
        th = true;
        now_checking++;
      }
      if(now_checking == 3){
        ans++;
        break;
      }
    }
  }
  cout << ans;
  return 0;
}


Measured memory_bytes: 384
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

// {{{
// source: https://github.com/raahii/algo
func MaxInts(nums ...int) int {
	var maxVal int
	for i, e := range nums {
		if i == 0 || e > maxVal {
			maxVal = e
		}
	}
	return maxVal
}

func MaxIntsWithIdx(nums ...int) (int, int) {
	var maxIdx, maxVal int
	for i, e := range nums {
		if i == 0 || e > maxVal {
			maxIdx = i
			maxVal = e
		}
	}
	return maxVal, maxIdx
}

func MinInts(nums ...int) int {
	var minVal int
	for i, e := range nums {
		if i == 0 || e < minVal {
			minVal = e
		}
	}
	return minVal
}

func MinIntsWithIdx(nums ...int) (int, int) {
	var minIdx, minVal int
	for i, e := range nums {
		if i == 0 || e < minVal {
			minIdx = i
			minVal = e
		}
	}
	return minVal, minIdx
}

func SumInts(nums []int) int {
	s := 0
	for _, v := range nums {
		s += v
	}
	return s
}

func ReverseInts(nums []int) []int {
	rnums := make([]int, len(nums))
	for i := 0; i < len(nums); i++ {
		rnums[len(nums)-1-i] = nums[i]
	}
	return rnums
}

func ExtendInts(nums1 []int, nums2 []int) []int {
	for _, v := range nums2 {
		nums1 = append(nums1, v)
	}
	return nums1
}

func Ints2d(n_rows, n_cols int) [][]int {
	ints := make([][]int, n_rows)
	for i := 0; i < n_rows; i++ {
		ints[i] = make([]int, n_cols)
	}
	return ints
}

func MemsetInts1d(nums []int, val int) {
	for i := range nums {
		nums[i] = val
	}
}

func MemsetInts2d(nums [][]int, val int) {
	for i := range nums {
		for j := range nums[i] {
			nums[i][j] = val
		}
	}
}

func ContainsInt(nums []int, num int) bool {
	sort.Ints(nums)

	s, e := 0, len(nums)
	for {
		if s >= e {
			break
		}

		m := (e + s) / 2
		if nums[m] == num {
			return true
		} else if num > nums[m] {
			s = m + 1
		} else {
			e = m
		}
	}

	return false
}

func ReadInt(f *os.File) int {
	var n int
	fmt.Fscanf(f, "%d", &n)
	return n
}

func ReadInts(f *os.File, n int) []int {
	nums := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Fscanf(f, "%d", &nums[i])
	}
	return nums
}

func ScanInts(f *os.File, vars ...*int) {
	for i := 0; i < len(vars); i++ {
		fmt.Fscanf(f, "%d", vars[i])
	}
}

func ReadLines(f *os.File, n int) []string {
	var lines []string
	reader := bufio.NewReader(f)
	for i := 0; i < n; i++ {
		bytes, _, err := reader.ReadLine()
		if err != nil {
			break
		}
		lines = append(lines, string(bytes))
	}

	return lines
}

func ReadWords(f *os.File, n int) []string {
	strs := make([]string, n)
	for i := 0; i < n; i++ {
		fmt.Fscanf(f, "%s", &strs[i])
	}
	return strs
}

func Pow(a, n int) int {
	c := 1
	for i := 0; i < n; i++ {
		c *= a
	}
	return c
}

func Abs(n int) int {
	if n < 0 {
		return -n
	}

	return n
}

// }}}

func main() {
	a := ReadInt(os.Stdin)
	b := ReadInt(os.Stdin)
	k := ReadInt(os.Stdin)

	d := []int{}
	for i := 1; i <= MinInts([]int{a, b}...); i++ {
		if a%i == 0 && b%i == 0 {
			d = append(d, i)
		}
	}

	fmt.Println(d[len(d)-k])
}

Measured memory_bytes: 640
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

// inf
constexpr ll infl = 10000000000000000LL;
constexpr int inf = 1000000000;

int main() {
    int ans = 0;
    int n;
    cin >> n;
    vector<int> h(n);
    for (int i = 0; i < n; ++i) {
        cin >> h[i];
    }
    int temp = 0;
    for (int i = 0; i < n - 1; ++i) {
        if (h[i] >= h[i + 1])
            ++temp;
        else {
            ans = max(ans, temp);
            temp = 0;
        }
    }
    cout << max(ans, temp) << endl;
    return 0;
}

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

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

 int main() {
   vector<int> NUM(4);
   char tmp;
   rep(i, 4) {
     cin >> tmp;
     NUM.at(i) = (int)(tmp - '0');
   }

   if (NUM.at(0) + NUM.at(1) + NUM.at(2) + NUM.at(3) == 7) cout << NUM.at(0) << "+" << NUM.at(1) << "+" << NUM.at(2) << "+" << NUM.at(3) << "=7" << endl;
   else if (NUM.at(0) - NUM.at(1) + NUM.at(2) + NUM.at(3) == 7) cout << NUM.at(0) << "-" << NUM.at(1) << "+" << NUM.at(2) << "+" << NUM.at(3) << "=7" << endl;
   else if (NUM.at(0) + NUM.at(1) - NUM.at(2) + NUM.at(3) == 7) cout << NUM.at(0) << "+" << NUM.at(1) << "-" << NUM.at(2) << "+" << NUM.at(3) << "=7" << endl;
   else if (NUM.at(0) + NUM.at(1) + NUM.at(2) - NUM.at(3) == 7) cout << NUM.at(0) << "+" << NUM.at(1) << "+" << NUM.at(2) << "-" << NUM.at(3) << "=7" << endl;
   else if (NUM.at(0) - NUM.at(1) - NUM.at(2) + NUM.at(3) == 7) cout << NUM.at(0) << "-" << NUM.at(1) << "-" << NUM.at(2) << "+" << NUM.at(3) << "=7" << endl;
   else if (NUM.at(0) - NUM.at(1) + NUM.at(2) - NUM.at(3) == 7) cout << NUM.at(0) << "-" << NUM.at(1) << "+" << NUM.at(2) << "-" << NUM.at(3) << "=7" << endl;
   else if (NUM.at(0) + NUM.at(1) - NUM.at(2) - NUM.at(3) == 7) cout << NUM.at(0) << "+" << NUM.at(1) << "-" << NUM.at(2) << "-" << NUM.at(3) << "=7" << endl;
   else if (NUM.at(0) - NUM.at(1) - NUM.at(2) - NUM.at(3) == 7) cout << NUM.at(0) << "-" << NUM.at(1) << "-" << NUM.at(2) << "-" << NUM.at(3) << "=7" << endl;
 }


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int n, m, p, x, s[100], sum = 0;
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> s[i];
        sum += s[i];
    }
    cin >> m;
    for (int i = 0; i < m; i++) {
        cin >> p >> x;
        cout << sum - s[p - 1] + x << endl;
    }
}


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

using namespace std;
 
int main(){
    int n, d, x, count=0;
    cin >> n >> d >> x;
    vector<int> a(n);
    for(int i = 0;i < n;i++)
        cin >> a[i];

    for(int i = 0;i < n;i++){
        for(int j =0;1;j++){
            if(j * a[i] + 1 <= d)
                count++;
            else
                break;
        }
    }
    cout << count + x << endl;
    
}

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

int main(){
  int a,b;
  cin >> a >> b;
  int d=a/b,r=a%b;
  double f=(double)a/b;
  cout << d << " " << r << " " << fixed << setprecision(10) << f << endl;
}
  


Measured memory_bytes: 3260
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
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;}

const ll MOD = 1000000007;
const ll HIGHINF = (ll)1e18;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s; cin >> s;
    if (s == "Sunny") cout << "Cloudy\n";
    else if (s == "Cloudy") cout << "Rainy\n";
    else cout << "Sunny\n";
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
typedef long long ll;
typedef std::vector<long long> vll;
typedef std::vector<std::vector<long long>> vvll;
typedef long double ld;
typedef std::vector<long double> vld;
typedef std::vector<std::vector<long double>> vvld;
using namespace std;
void yesno(bool state);

string alphabets = {'z','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};

void Main(){
    ll N;
    cin >> N;
    // ll memo = N;
    vector<char> ans;
    ll i = 1;
    while(i > 0){
        ans.push_back(alphabets[N%26]);
        if(N%26==0)
            N-=26;
        else
            N -= (N%26);
        if(N==0){break;}
        N /= 26;
        i++;
    }

    std::reverse_iterator<decltype(ans)::iterator> first(ans.end());
    std::reverse_iterator<decltype(ans)::iterator> last(ans.begin());

    std::for_each(first, last, [](char x) {
        cout << x;
    });
    
    std::cout << endl;
}

int main(int argc, char const *argv[])
{
    Main();
    return 0;
}

void yesno(bool state){
    if(state)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

Measured memory_bytes: 3628
#pragma GCC target ("avx2")
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize ("O3")
#include "bits/stdc++.h"
#include <unordered_set>
#include <unordered_map>
#include <random>
using namespace std;
typedef long long ll;
const ll MOD = 1'000'000'007LL; /*998'244'353LL;*/
#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)++)
const int dx[4]={ 1,0,-1,0 };
const int dy[4]={ 0,1,0,-1 };

int X, Y;

signed main(){
    cin >> X >> Y;
    cout << max(0, (4-X))*100000 + max(0, (4-Y))*100000 + (X == 1 && Y == 1 ? 400000 : 0) << endl;
}

Measured memory_bytes: 3568
#include <bits/stdc++.h>
#define REP(i, a, n) for(ll i = ((ll) a); i < ((ll) n); i++)
using namespace std;
typedef long long ll;

ll N;
ll memo[100];

ll lucas(ll n) {
  if(memo[n] >= 0) return memo[n];
  if(n == 0) return memo[n] = 2;
  if(n == 1) return memo[n] = 1;
  return memo[n] = lucas(n - 1) + lucas(n - 2);
}

int main(void) {
  cin >> N;

  REP(i, 0, 100) memo[i] = -1;
  cout << lucas(N) << endl;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

# sys.setrecursionlimit(100000)
input = sys.stdin.buffer.readline
INF = 2**62-1

def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(X):
    T = 100
    for i in range(INF):
        T *= 1.01
        T = int(T)
        if X <= T:
            return i + 1


def main():
    X = read_int()
    print(slv(X))


if __name__ == '__main__':
    main()


Measured memory_bytes: 78456
//AUTHOR: RAVAN_2070
//PUNE INSTITUTE OF COMPUTER TECHNOLOGY
/*
    I LOVE CLARICE STARLING

     ♥LOVE♥        ♥LOVE♥
  ♥LOVE♥♥LOVE♥  ♥LOVE♥♥LOVE♥
♥LOVE♥♥LOVE♥♥LOVE♥♥LOVE♥♥LOVE♥
   ♥LOVE♥♥LOVE♥♥LOVE♥♥LOVE♥
      ♥LOVE♥♥LOVE♥♥LOVE♥
         ♥LOVE♥♥LOVE♥
            ♥LOVE♥
               ♥


    EXPLAINATION BELOW->
    Game+dp
   
*/
//
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vi;
typedef vector<pair<ll,ll>> vii;
typedef pair<ll,ll> pii;
typedef map<ll,ll> mii;
#define MOD7 1000000007
#define MOD9 1000000009
#define pi 3.1415926535
#define Test_cases ll TC;cin>>TC;while(TC--)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(), x.rend()
#define sp(x) fixed<<setprecision(x)
#define sz(x) (ll)(x.size())
#define fo(i,a,b) for(i=a;i<b;i++)
#define foe(i,a,b) for(i=a;i<=b;i++)
int n,k;
int A[101];
int dp_first[100005],dp_second[100005];
void solve()
{
    int i,j;cin>>n>>k;
    fo(i,0,n)cin>>A[i],dp_first[A[i]]=dp_second[A[i]]=1;

    for(i=1;i<=k;i++)
    {
        for(j=0;j<n;j++)
        {
           if(i-A[j]<0)break;
           dp_first[i]=max(dp_first[i],1^dp_second[i-A[j]]);
        }
        
        for(j=0;j<n;j++)
        {
           if(i-A[j]<0)break;
           dp_second[i]=max(dp_second[i],1^dp_first[i-A[j]]);
        }
        
    }
    if(dp_first[k])cout<<"First\n";
    else cout<<"Second\n";
    
}
int main()
{
   fastio
   solve();
  return 0;
}
//map<ll,ll,greater<int>> to sort in descending order ,in iterator declaration no greater<int>
//if you want to apply lowerbound on set use s.lower_bound(key),not the one used for vector
/* TIPS FOR DEBUGGING
 * Check if values are not overflowing (use long long where required)
 * Check if ranges are inclusive or not.
 * Check properly if greedy will work or not before using it.
 * Check EDGE CASES!! Seriously, even in 2B, saving 8 points by being
 * 2 minutes faster will bite you in the ass if you don't make sure
 * it works on edge cases.
 * Keep adding to this list.
*/


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define For(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define sz(x) ((int)(x).size())
#define int ll
using namespace std;
using ll=long long;
using pii=pair<int,int>;

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

int32_t main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int n; cin>>n;
	int ans=0;
	bool neg=false,zero=false;
	int mn=-1e12;
	int t;
	while(n--)
	{
		cin>>t;
		mn=max(mn,-abs(t));
		if(t==0) zero=true;
		else if(t<0) neg=!neg;
		ans+=abs(t);
	}
	if(!zero && neg) ans+=mn*2;
	cout<<ans<<"\n";
	return 0;
}









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

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

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

Measured memory_bytes: 256
n=int(input())
l=[*map(int,input().split())]
f=lambda p: exit(print(['pairwise','setwise','not'][p]+' coprime'))
from math import *
g=l[0]
for x in l: g=gcd(g,x)
if g>1: f(2)
from collections import *
C=Counter()
for x in l:
  for i in range(2,int(x**0.5)+1):
    if x%i<1:
      if C[i]: f(1)
      C[i]=1
    while x%i<1: x//=i
    if x<2: break
  if x>1:
    if C[x]: f(1)
    C[x]=1
f(0)

Measured memory_bytes: 197708
#include<iostream>
#include <stdio.h>
#include <string>
#include <string.h>
#include <algorithm>
#include <functional>
#include <vector>
#include <math.h>

using namespace std;
int main()
{
	int N, K, Ans, a, b, c;

	cin >> N >> K;

	if (N%K == 0) {
		cout << 0;
	}
	else {
		cout << 1;
	}

	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class GFG
{

    public static void Main()
    {
        var ii = Console.ReadLine().Split(' ');

        var n = int.Parse(ii[0]);
        var k = int.Parse(ii[1]);

        var arr = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();

        Array.Sort(arr);

        var ans = arr.Take(k).Sum();

        Console.Write(ans);
      

    }
    
}




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


int main()
{
	ll n;
	cin>>n;
	vector<ll> freq(n+1,1);
	for(ll i=2;i<=n;i++)
	{
		for(ll j=i;j<=n;j+=i)
		{
			freq[j]++;
		}
	}
	ll cnt=0;
	for(ll i=1;i<=n;i++)
	{
		cnt += i*freq[i];;
	}
	cout<<cnt<<endl;
}


Measured memory_bytes: 81396
#include <stdio.h>

int main(void)
{
    int x, y, z;
    scanf("%d %d %d", &x, &y, &z);

    int c = 1;
    x = x - y - z * 2;

    while (x >= y + z) {
        c++;
        x = x - y - z;
    }

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

Measured memory_bytes: 128
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <functional>
#include <algorithm>
#include <string>
#include <vector>
#include <limits>
#include <numeric>
#include <queue>
#include <cmath>
#include <set>
#include <map>
#include <stack>

using namespace std;

#define INFint (1<<30)
#define BOUND 27182818284
#define MAT 2

typedef long long ll;
typedef long long int lli;
typedef pair<ll, ll> P;

ll MOD = 1000000007;
const ll INF = (1ll<<60);
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i, a, b) for(int i=int(a);i<int(b);++i)

template<class T>
bool umax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
bool umin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

// gcd
template<typename T>
T gcd(T a, T b) {
    if (a == 0)
        return b;
    return gcd(b % a, a);
}

int findGCD(int arr[], int n) {
    int result = arr[0];
    for (int i = 1; i < n; i++)
        result = gcd(arr[i], result);
    return result;
}

template<typename T>
T lcm(T m, T n) {
    // 引数に0がある場合は0を返す
    if ((0 == m) || (0 == n))
        return 0;
    return ((m / gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
    fill((T *) array, (T *) (array + N), val);
}


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

// v.front() = -BOUND;
// v.back() = BOUND;

//struct edge{
//    int cost, to;
//
//    edge(int in_cost, int in_to){
//        cost=in_cost;
//        to=in_to;
//    }
//    bool operator<(const edge &a) const
//    {
//        return cost > a.cost;
//    }
//};
int main() {
    int H,W,A,B; cin >> H >> W >> A >> B;
    int a[1010][1010];
    Fill(a,0);

    for(int i=0; i<H; i++){
        for(int j=0; j<W; j++){
            if( (i<B && j<A)||(i>=B && j>=A) ){
                a[i][j]=1;
            }
        }
    }

    for(int i=0; i<H; i++){
        for(int j=0; j<W; j++){
            cout << a[i][j];
        }
        cout << endl;
    }
    return 0;
}

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

using namespace std;

int main(){
	char c1[2], c2[2];
	scanf("%s %s", c1, c2);
	if (c1[0] > c2[0])
		puts(">");
	else if (c1[0] < c2[0])
		puts("<");
	else 
		puts("=");
	return 0;
}

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

const int N = 110;

int main() {
    int n, b[N];
    cin >> n;

    for (int i = 0; i < n - 1; i++) {
        cin >> b[i];
    }
    b[n - 1] = 110000;

    int sum_a = b[0];
    for (int i = 0; i < n - 1; i++) {
        if (b[i] < b[i + 1]) {
            sum_a += b[i];
        } else {
            sum_a += b[i + 1];
        }
    }

    cout << sum_a << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;



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

	int a;
	cin >> a;
	cout << a + a * a + a * a * a << "\n";


	return 0;
}


Measured memory_bytes: 3172