akhauriyash/Code-Regression huggingface dataset:
import sys

N = int(sys.stdin.readline())
A = map(int, sys.stdin.readline().split())

ans = 0
pre = 0
for a_i in A:
    # print("pre", pre, "a_i", a_i)
    if a_i < pre:
        diff = pre - a_i
        a_i += diff
        ans += diff
    pre = a_i

print(ans)

Measured memory_bytes: 25132
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#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,n) for(int i = 1; i <= (n); ++i)
#define rrep2(i,n) for(int i = (n); i > 0; --i)
#define srep(i,s,n) for(int i = s; i < (n); ++i)
#define rsrep(i,s,n) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<x<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define show_pair(...) cout<<#__VA_ARGS__<<" = "<<endl; for (const auto& x : (__VA_ARGS__)) { cout<<"  "<<x.fi<<" : "<<x.se<<endl; }
#define out_ary(...) { int n = (__VA_ARGS__).size(); rep(i, n) printf("%d%s", (__VA_ARGS__)[i], i != n-1 ? " " : "\n"); }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<P> vpair;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vll> vvll;
typedef vector<vstr> vvstr;
typedef vector<vbool> vvbool;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;


int main() {
    int h, w;
    cin >> h >> w;
    vstr a(h);
    rep(i, h) cin >> a[i];

    vvbool c(h, vbool(w, false));
    int nx = 0, ny = 0;
    c[nx][ny] = true;
    while (nx != h-1 || ny != w-1) {
        if (nx == h-1) {
            if (a[nx][ny+1] != '#') {
                puts("Impossible");
                return 0;
            }
            ny++;
        }
        else if (ny == w-1) {
            if (a[nx+1][ny] != '#') {
                puts("Impossible");
                return 0;
            }
            nx++;
        }
        else if (a[nx+1][ny] == a[nx][ny+1]) {
            puts("Impossible");
            return 0;
        }
        else if (a[nx+1][ny] == '#') nx++;
        else ny++;
        c[nx][ny] = true;
    }

    rep(i, h) rep(j, w) {
        if ((a[i][j] == '#') == c[i][j]) continue;
        puts("Impossible");
        return 0;
    }
    puts("Possible");
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-6;
const double PI=acos(-1.0);
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
char in[120];
int main(){
	long long a,b,c;scanf("%lld%lld%lld",&b,&a,&c);
	if(b==0)printf("%lld\n",a/c+1);
	else printf("%lld\n",a/c-(b-1)/c);
}

Measured memory_bytes: 128
#include <iostream>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;
int main(){
        string s;
        bool bac['z'-'a'+1] = {};
        cin >> s;
        rep(i,s.size()) bac[s[i]-'a']=true;
        rep(i,'z'-'a'+1) if(!bac[i]) {
                cout << (char)('a'+ i) << endl;
                return 0;
        }
        cout << "None" << endl;
        return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
#include<string.h>
using namespace std;
typedef long long int lli;
int main()
{
  ios_base::sync_with_stdio(false);
   cin.tie(NULL);
   cout.tie(NULL);
  lli a,b,c,k,sum,v;
  cin>>a>>b>>c>>k;
  v=min(a,k);
  k=k-v;
  k=k-min(b,k);
  sum=v-k;
  cout<<sum<<"\n";
}

Measured memory_bytes: 3584
#include <cstdio>
#include <vector>
#include <stack>
#include <iostream>
#include <string>
#include <tuple>
#include <random>
#include <map>
#include <queue>
#include <set>
#include <complex>
#include <algorithm>
#include <cassert>
#include <iterator>
#include <numeric>

using namespace std;

typedef long double ld;
typedef long long ll;
typedef pair<ll, ll> P;

const ll INF = 1e15;
const double eps = 1e-6;
const ll MOD = 1000000007;

int main() {
	ll N, A, B;
	cin >> N >> A >> B;
	if (abs(A - B) % 2)
		cout << "Borys" << endl;
	else
		cout << "Alice" << endl;
	return 0;
}


Measured memory_bytes: 256
n = 0
student = []
while True:
  m,f,r = map(int, input().split())

  if m == f == r == -1:
    break
  
  if m == -1 or f == -1:
    student.append("F")
  elif m + f >= 80:
    student.append("A")
  elif m + f >= 65:
    student.append("B")
  elif m + f >= 50:
    student.append("C")
  elif m + f >= 30:
    if r >= 50:
      student.append("C")
    else:
      student.append("D")
  else:
    student.append("F")
  
  n += 1

for i in range(n):
  print(str(student[i]))



Measured memory_bytes: 5600
#include <bits/stdc++.h>
using namespace std;  
using ll = long long;
#define rep(i, a, b) for(ll i = a; i < b; i++)
#define Rep(i, a, b) for(ll i = a; i <= b; i++)
#define repr(i, a, b) for(ll i = b-1; i >= a; i--)
// #define _GLIBCXX_DEBUG
template <class T> using V = vector<T>;
#define ALL(v) (v).begin(),(v).end()
#define endl "\n"
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define sz(v) ((ll)(v).size())
const double pi = acos(-1.0);
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
// #define fi first
// #define se second
const int dy[] = {1, 0, -1, 0};
const int dx[] = {0, 1, 0, -1};
const int dy2[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int dx2[] = {1, 1, 0, -1, -1, -1, 0, 1};
// ios::sync_with_stdio(false);
// cin.tie(nullptr);
 
/*--------------------------------------------------------------------------------
--------------------------------------------------------------------------------*/

int main() {
	string s = "ACL";
	ll k;
	cin >> k;
	rep(i, 0, k) cout << s;
	cout << endl;
}

Measured memory_bytes: 3628
while True:
  n, m = map(int, input().split())
  if not n:
    break

  lst = [i for i in range(1, n + 1)]
  ind = n - 1

  while len(lst) > 1:
    ind = (ind + m) % len(lst)
    lst.pop(ind)
    ind -= 1

  print(lst[0])


Measured memory_bytes: 5604
io = STDIN
a,b=io.gets.split.map(&:to_i)
def check(a,b)
  ans=[]
  (1..1250).each do |i|
    ans << i if (i*0.08).floor==a  && (i*0.1).floor==b
  end
  ans==[] ? -1 : ans.min
end
puts check(a,b)


Measured memory_bytes: 1788
n, m = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
a.sort()

bc = []

for i in range(m):
    bc.append([int(i) for i in input().split()])
bc.sort(key=lambda x:x[1], reverse=True)

dist = 0
for i in range(m):
    for j in range(bc[i][0]):
        if dist < n:
            num = bc[i][1]
            if num > a[dist]:
                a[dist] = num
            dist += 1
        else:
            print(sum(a))
            exit()

print(sum(a))


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

string S;

vector<int> ans(100001, 0);

void solve(){
    int i = 1;
    while(i <= S.size()){
        int j = i;
        int rn = 0;
        while(S[j - 1] != 'L') { rn++; j++; }
        int er = j - 1;
        int sl = j;
        int ln = 0;
        while(j <= S.size() && S[j - 1] != 'R'){ ln++; j++; }
        ans[er - 1] = (rn + 1) / 2 + ln / 2;
        ans[sl - 1] = (ln + 1) / 2 + rn / 2;
        i = j;
    }
    for(int i = 1; i <= S.size(); ++i){
        cout << ans[i - 1] << " ";
    }
}
int main(){
    cin >> S;
    solve();
    return 0;
}

Measured memory_bytes: 1024
program main
    implicit none
    integer n,k,i,d,l,a
    integer,allocatable::c(:),b(:)
    read(*,*) n,k
    allocate(b(n))
    b=0
    do i=1,k
        read(*,*) d
        allocate(c(d))
        read(*,*) c(1:d)
        b(c(1:d))=b(c(1:d))+1
        deallocate(c)
    end do
    a=0
    do l=1,n
        if(b(l)==0) a=a+1
    end do
    write(*,*) a
end program main


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

typedef long long ll;
char M[105][105];
int dp[105][105];
int main() {
    int n,m;cin>>n>>m;
    for(int i=1;i<=n;i++){
        scanf("%s",M[i]+1);
    }
    dp[1][1]=(M[1][1]=='#');
    for(int i=2;i<=m;i++){
        if(M[1][i]=='#'){
            dp[1][i]=dp[1][i-1]+(M[1][i-1]=='.');
        }else{
            dp[1][i]=dp[1][i-1];
        }
    }
    for(int i=2;i<=n;i++){
        if(M[i][1]=='#'){
            dp[i][1]=dp[i-1][1]+(M[i-1][1]=='.');
        }else{
            dp[i][1]=dp[i-1][1];
        }
    }
    for(int i=2;i<=n;i++){
        for(int j=2;j<=m;j++){
            if(M[i][j]=='#'){
                dp[i][j]=min(dp[i][j-1]+(M[i][j-1]=='.'),dp[i-1][j]+(M[i-1][j]=='.'));
            }else{
                dp[i][j]=min(dp[i][j-1],dp[i-1][j]);
            }
        }
    }
    cout<<dp[n][m]<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>
#include<chrono>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define repr(i, n, x) for(int i=(n); i>(x); i--)
#define FOR(i,x,n) for(int i=x; i<(n); i++)
#define vint(a,n) vint a(n); rep(i, n) cin >> a[i];
#define vll(a,n) vll a(n); rep(i, n) cin >> a[i];
#define ALL(n) begin(n),end(n)
#define RALL(n) rbegin(n),rend(n)
#define MOD (1000000007)
#define INF (2e9)
#define INFL (2e18)

typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
using vint=vector<int>;
using vll=vector<ll>;
using vbool=vector<bool>;
template<class T>using arr=vector<vector<T>>;
template<class T>int popcount(T &a){int c=0; rep(i, 8*(int)sizeof(a)){if((a>>i)&1) c++;} return c;}
template<class T>void pr(T x){cout << x << endl;}
template<class T>void prvec(vector<T>& a){rep(i, a.size()-1){cout << a[i] << " ";} pr(a[a.size()-1]);}
template<class T>void prarr(arr<T>& a){rep(i, a.size()) if(a[i].empty()) pr(""); else prvec(a[i]);}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main()
{
    int n; cin >> n;
    string s; cin >> s;
    string ans;
    string back;

    int right=0, left=0;
    int cnt = 0;
    rep(i, n){
        if(s[i]=='(') break;
        cnt++;
    }
    left = cnt;
    rep(i, cnt) ans.push_back('(');

    cnt = 0;
    repr(i, n-1, -1){
        if(s[i]==')') break;
        cnt++;
    }
    right=cnt;
    rep(i, cnt) back.push_back(')');
    ans = ans + s + back;
    // pr(ans);

    cnt = 0;
    string t;
    rep(i, ans.size()){
        if(ans[i]==')') cnt++;
        else cnt--;
        if(cnt>0) {
            t.push_back('(');
            cnt = 0;
        }
    }
    ans = t + ans;
    // pr(ans);

    string u;
    cnt = 0;
    repr(i, ans.size()-1, -1){
        if(ans[i]=='(') cnt++;
        else cnt--;
        if(cnt>0){
            u.push_back(')');
            cnt = 0;
        }
    }
    ans += u;
    pr(ans);
    return 0;}

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

using namespace std;

typedef long double ld;
typedef long long ll;

#define sz(x) (int)(x).size()
#define pb push_back
#define mp make_pair
#define f first
#define s second

template<typename T, typename U> bool ckmin(T &a, U b){ return b < a ? a = b, true : false; }
template<typename T, typename U> bool ckmax(T &a, U b){ return b > a ? a = b, true : false; }

int n;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> n;
    int y = n - 400;
    cout << 8 - (y/200);
    return 0;
}

Measured memory_bytes: 3636
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner scan = new Scanner(System.in);
        int X = scan.nextInt();
        int t = scan.nextInt();
        int answer = X - t;
        if(answer < 0) answer = 0;
        
        System.out.println(answer);
    }
}


Measured memory_bytes: 20688
S = input()
T = input()

len_S = len(S)
len_T = len(T)

ans = len_T
for i in range(0, len_S - len_T + 1):
    match = 0
    for s, t in zip(S[i:i + len_T], T):
        if s == t:
            match += 1
    change = len_T - match
    ans = min(ans, change)

print(ans)

Measured memory_bytes: 9128
#include <stdio.h>

int main(void){
	int sum, book;
	int i;
	
	while (scanf("%d", &sum), sum){
		for (i = 0; i < 9; i++){
			scanf("%d", &book);
			sum -= book;
		}
		
		printf("%d\n", sum);
	}
	
	return 0;
}

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

using namespace std;

int main() {
	int r, c; cin >> r >> c;
	vector<int> csum(c, 0);
	for (int i = 0; i < r; ++i) {
		int rsum = 0;
		for (int j = 0; j < c; ++j) {
			int a;
			cin >> a; rsum += a; csum[j] += a;
			if (j) cout << " ";
			cout << a;
		}
		cout << " " << rsum << endl;
	}
	int rsum = 0;
	for (int i = 0; i < c; ++i) {
		rsum += csum[i];
		if (i) cout << " ";
		cout << csum[i];
	}
	cout << " " << rsum << endl;

	return 0;
}


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

#define task "A"
#define all(v) (v).begin(), (v).end()
#define rep(i, l, r) for (int i = (l); i <= (r); ++i)
#define Rep(i, r, l) for (int i = (r); i >= (l); --i)
#define DB(X) { cerr << #X << " = " << (X) << '\n'; }
#define DB1(A, _) { cerr << #A << "[" << _ << "] = " << (A[_]) << '\n'; }
#define DB2(A, _, __) { cerr << #A << "[" << _ << "][" << __ << "] = " << (A[_][__]) << '\n'; }
#define DB3(A, _, __, ___) { cerr << #A << "[" << _ << "][" << __ << "][" << ___ << "] = " << (A[_][__][___]) << '\n'; }
#define PR(A, l, r) { cerr << '\n'; rep(_, l, r) DB1(A, _); cerr << '\n';}
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back
#define pf push_front
#define F first
#define S second
#define by(x) [](const auto& a, const auto& b) { return a.x < b.x; } // sort(arr, arr + N, by(a));
#define next ___next
#define prev ___prev
#define y1 ___y1
#define left ___left
#define right ___right
#define y0 ___y0
#define div ___div
#define j0 ___j0
#define jn ___jn

using ll = long long;
using ld = long double;
using ull = unsigned long long;
using namespace std;
typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<ll> vl;

int main()
{
#ifdef HynDuf
    freopen(task".in", "r", stdin);
    //freopen(task".out", "w", stdout);
#else
    ios_base::sync_with_stdio(false); cin.tie(nullptr);
#endif
    int x;
    cin >> x;
    cout << (x ? 0 : 1);
    return 0;
}


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

int main() {
  int n;
  cin >> n;
  n /= 100;
  cout << (21-n) / 2 << endl;
  return 0;
}


Measured memory_bytes: 3632
#include<stdio.h>
#define MAX 10000000
#define NIL -1

typedef struct{
  int parent,left,right;
}Node;

Node T[MAX];
int n,D[MAX],H[MAX];

void setDepth(int u,int d){
    if(u == NIL)return;
    D[u]=d;
    setDepth(T[u].left,d+1);
    setDepth(T[u].right,d+1);
}

int setHeight(int u){
  int h1=0,h2=0;
  if(T[u].left != NIL)
    h1=setHeight(T[u].left)+1;

  if(T[u].right != NIL)
    h2=setHeight(T[u].right)+1;

  return H[u]=(h1>h2 ? h1:h2);
}

int getSibling(int u){
  if(T[u].parent == NIL)
    return NIL;

  if(T[T[u].parent].left != u && T[T[u].parent].left != NIL)
    return T[T[u].parent].left;

  if(T[T[u].parent].right != u && T[T[u].parent].right != NIL)
    return T[T[u].parent].right;

  return NIL;
}

void printer(int u){
  printf("node %d: ",u);
  printf("parent = %d, ",T[u].parent);
  printf("sibling = %d, ",getSibling(u));
  int deg=0;
  if(T[u].left != NIL)deg++;
  if(T[u].right != NIL)deg++;
  printf("degree = %d, ",deg);
  printf("depth = %d, ",D[u]);
  printf("height = %d, ",H[u]);

  if(T[u].parent == NIL){
    printf("root\n");
  }
  else if(T[u].left == NIL && T[u].right == NIL){
    printf("leaf\n");
  }
  else {
    printf("internal node\n");
  }
}

int main(){
  int i,v,l,r,root = 0;
  scanf("%d",&n);

  for(i=0;i<n;i++)
    T[i].parent = NIL;
  
  for(i=0;i<n;i++){
    scanf("%d%d%d",&v,&l,&r);
    T[v].left=l;
    T[v].right=r;

    if(l!=NIL)
	T[l].parent=v;
    if(r!=NIL)
	T[r].parent=v;
  }
  for(i=0;i<n;i++)
    if(T[i].parent==NIL)
	root=i;

  setDepth(root,0);
  setHeight(root);

  for(i=0;i<n;i++)
	printer(i);
  return 0;
}



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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int  ,int > pii;

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

const ll maxn  = 3e6;
const ll mod =1e9+7;
const ld PI = acos((ld)-1);

#define pb(x) push_back(x);
#define endl '\n'
#define dokme(x) cout << x ;  return(0);
#define migmig ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ms(x , y) memset(x , y , sizeof x);
#define file_init freopen("input.txt", "r+", stdin); freopen("output.txt", "w+", stdout);
ll pw(ll a, ll b, ll md = mod){ll res = 1;while(b){if(b&1){res=(a*res)%md;}a=(a*a)%md;b>>=1;}return(res);}

ll n , k;

int main(){
    migmig
    cin >> n >> k;
    cout << min(n , min(n%k , (k - (n%k))%k ));

    return(0);
}

//When we hit our lowest point, we are open to the greatest change.
//If I try, I fail. If I don't try, I'm NEVER GOING TO GET IT.
//Sometimes, life is like this dark tunnel. You can't always see the light at the end of the tunnel. But if you just keep moving... you will come to a better place.
//It is important to draw wisdom from diffrent places. If you take it from only one place it becomes rigid and stale.
//kuxtal jach uts chuchul u u páajtal máak jach táaj meyajilo'ob le castigadas tumen ch'aik descansos.


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repe(i, n) for (int i = 0; i <= (int)(n); i++)
#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define ANS cout << ans << endl
#define all(a) a.begin(),a.end()
#define SORT(a) sort(all(a))
#define REVERSE(a) reverse(all(a))
#define KOZYUN(a) sort(all(a),greater<int>())
#define int ll
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORe(i, m, n) for(int i = m;i <= n;i++)
#define VIin(a) for(int i=0; i<a.size(); i++) cin >> a[i]
#define OUT(a) cout << a << endl
#define IN(a) cin >> a
#define INT(a) int a; cin >> a
typedef vector<int> VI;
typedef vector<VI> VVI;
const int MOD=1e9+7;
const long long INF = 1LL << 60;
/*最大公約数*/int gcd(int x, int y) { return y ? gcd(y,x%y) : x;}
/*最小公倍数*/int lcm(int a, int b) { int g = gcd(a, b); return a / g * b; }
/*素数判定*/int isPrime(int n){if(n<2){return 0;}for(int i=2; i*i<=n; i++){if(n%i==0){return 0;}}return 1;}
/*約数列挙*/vector<int> getDivisor(int n){vector<int> v; for(int i=1; i*i<=n; i++){if(n%i==0){v.push_back(i);if(i!=n/i){v.push_back(n/i);}}}sort(v.begin(),v.end()); return v;}
//----------------------------------------------
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    INT(n);
    string s,t; cin >> s >> t;
    rep(i,n) cout << s[i] << t[i];

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <string>
using namespace std;
typedef pair<int,int> P;
int main()
{
	string s;
	pair<string,int> mode=make_pair("",0),mlen=make_pair("",0);
	map<string,P> m;
	while(cin>>s){
		int d=++m[s].first;
		m[s].second=s.length();
		if(mode.second<d){mode=make_pair(s,d);}
		if(mlen.second<s.length()){mlen=make_pair(s,s.length());}
	}
	cout<<mode.first<<" "<<mlen.first<<endl;
	return 0;
}

Measured memory_bytes: 1196
#include <bits/stdc++.h>
#define ft first
#define sc second
#define pt(sth) cout << sth << "\n"
#define moca(a, s, b) a=((a)s(b)+MOD)%MOD
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
template<class T>bool chmax(T &a, const T &b) {if(a<b) {a=b; return 1;} return 0;}
template<class T>bool chmin(T &a, const T &b) {if(b<a) {a=b; return 1;} return 0;}
static const ll INF=1e18;
static const ll MAX=101010;
static const ll MOD=1e9+7;


//for(i=0; i<N; i++) cin >> a[i];


int main(void) {
  ll i, j, k, l;
  
  ll N;
  cin >> N;
  ll a[MAX*2];
  ll cnt[22][22]={};
  
  map<double, ll> mp;
  for(i=0; i<N; i++) {
    double tt;
    cin >> tt;
    a[i]=tt*1e9+0.5;
    
    ll t=a[i];
    ll c2=0, c5=0;
    while(t%2==0) {c2++; t/=2;}
    while(t%5==0) {c5++; t/=5;}
    cnt[min(18LL, c2)][min(18LL, c5)]++;
    
  }
  
  
  ll ans=0;
  for(i=0; i<22; i++) {
    for(j=0; j<22; j++) {
      for(k=0; k<22; k++) {
        for(l=0; l<22; l++) {
          if(i==k && j==l) continue;
          
          if(i+k>=18 && j+l>=18) {
            ans+=cnt[i][j]*cnt[k][l];
          }
        }
      }
    }
  }
  ans/=2;
  
  for(i=9; i<22; i++) {
    for(j=9; j<22; j++) {
      ans+=cnt[i][j]*(cnt[i][j]-1)/2;
    }
  }
  pt(ans);
  
}


Measured memory_bytes: 3772
#include<bits/stdc++.h>
#include<iostream>
using namespace std;
const int MAX=1e9+7;
const int mod=1e9+7;

int a[105];
int main()
{
	long long n,sum=0;
	double p=0;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
		p+=a[i];
	}
	p=round(p/n);
	for(int i=0;i<n;i++)
	{
		sum=sum+(a[i]-p)*(a[i]-p);
	}
	cout<<sum;
}

Measured memory_bytes: 384
#include<iostream>
using namespace std;
int main()
{
    long x;
    cin >> x;

    long i = x % 11;
    long j = ((x-i) / 11) * 2;
    long ans;

    if(i == 0){
        ans = j;
    }else if(i <= 6){
        ans = j + 1;
    }else{
        ans = j + 2;
    }

    cout << ans << endl;

    return 0;
}

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

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    vector<int> b(n);
    vector<int> c(n - 1);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    for (int i = 0; i < n; i++) {
        cin >> b[i];
    }
    for (int i = 0; i < n - 1; i++) {
        cin >> c[i];
    }
    int prev;
    int ans = 0;
    for (int i = 0; i < n; i++) {
        if (i) {
            if (prev + 1 == a[i] - 1) {
                ans += c[prev];
            }
        }
        ans += b[a[i] - 1];
        prev = a[i] - 1;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
from collections import Counter

N,K = map(int,input().split())

lis = list(map(str,input().split()))

counter = Counter(lis)

num = len(counter)

a =  sorted(counter.values())

Ans = 0

for i in a:
	if num <= K:
		break
	Ans += i
	num -= 1
	
print(Ans)
	

Measured memory_bytes: 35996
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

const int maxn = 500010;

int n;
vector<int> adj[maxn];
int dp[maxn];

int dfs(int u) {
	if (dp[u] != -1) {
		return dp[u];
	}
	dp[u] = 0;
	for (int v : adj[u]) {
		dp[u] = max(dp[u], dfs(v) + 1);
	}
	return dp[u];
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	string s;
	cin >> s;
	n = s.length() + 1;
	for (int i = 0; i < n-1; ++i) {
		if (s[i] == '<') {
			adj[i+1].push_back(i);
		} else {
			adj[i].push_back(i+1);
		}
	}
	for (int i = 0; i < n; ++i) {
		dp[i] = -1;
	}
	ll ans = 0;
	for (int i = 0; i < n; ++i) {
		ans += dfs(i);
	}
	cout << ans << endl;
}

Measured memory_bytes: 45724
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <sstream>
#include <set>
#include <map>
#include <iostream>
#include <utility>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <unordered_set>
#include <unordered_map>
#include <limits.h>
#include <cstring>
#include <tuple>
#include <cassert>
#include <numeric>
using namespace std;
// type alias
typedef long long LL;
typedef vector < int > VI;
typedef unordered_map < int, int > MAPII;
typedef unordered_set < int > SETI;
typedef pair< int , int > II;
typedef tuple< int, int, int > III;
// repetition
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define REPE(i,n)  for(int i=0;i<=(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORR(x,arr) for(auto& x:arr)
#define SZ(a) int((a).size())
// DP
#define MINUS(dp) memset(dp, -1, sizeof(dp))
#define ZERO(dp) memset(dp, 0, sizeof(dp))
// minmax
#define SMAX(a,b) a = max(a,b)
#define SMIN(a,b) a = min(a,b)
// debug cerr
#define TRACE true
#define dump(x) if(TRACE) { cerr << #x << " = " << (x) << endl; }
#define dump2(x,y) if(TRACE) { cerr << #x << " = " << (x) << ", " << #y << " = " << (y) << endl; }
#define dump3(x,y,z) if(TRACE) { cerr << #x << " = " << (x) << ", " << #y << " = " << (y) << ", " << #z << " = " << (z) << endl; }
#define dump4(x,y,z,a) if(TRACE) { cerr << #x << " = " << (x) << ", " << #y << " = " << (y) << ", " << #z << " = " << (z) << ", " << #a << " = " << (a) << endl; }
#define dumpAR(ar) if(TRACE) { FORR(x,(ar)) { cerr << x << ','; } cerr << endl; }

/*
 
 8/1/2018
 
 17:40-
 
 */

// $ g++ -std=c++14 -Wall -O2 -D_GLIBCXX_DEBUG x.cpp && ./a.out
const int MAX_N=1e5+1;
LL A[MAX_N];
int N;

void solve_wrong() {
  sort(A,A+N);
  int l=0,r=N-1;
  auto movel=[&]() {
    while(l<N-1&&A[l]!=A[l+1]) ++l;
  };
  auto mover=[&]() {
    while(r>0&&A[r]!=A[r-1]) --r;
  };
  movel(),mover();
  while(l<r&&A[l]!=A[r]) {
    if(A[l]!=A[l+1]) {
      dump3(l,A[l],A[l+1]);
//      dumpAR(A);
    }
    if(A[r]!=A[r-1]) {
      dump3(r,A[r-1],A[r]);
//      dumpAR(A);
    }

    assert(A[l]==A[l+1]&&A[r]==A[r-1]);
    ++l,--r;
    movel(),mover();
    dump2(l,r);
  }
  MAPII M;
  REP(i,N) M[A[i]]++;
  
  dump4(l,A[l],r,A[r]);
  int res=SZ(M);
  if(A[l]==A[r]&&M[A[l]]%2==0) res--;
  cout<<res<<endl;
}

void solve() {
  sort(A,A+N);
  MAPII M; set<int> S;
  REP(i,N) M[A[i]]++,S.emplace(A[i]);
  VI X(S.begin(),S.end());
  int NN=SZ(X);
//  dump(NN);
//  REP(i,NN) dump3(i,X[i],M[X[i]]);
  
  int l=0,r=NN-1;
  auto movel=[&]() {
    while(l<NN&&M[X[l]]==1) ++l;
  };
  auto mover=[&]() {
    while(r>=0&&M[X[r]]==1) --r;
  };
  movel(),mover();
  while(l<r) {
    assert(M[X[l]]>1&&M[X[r]]>1);
    M[X[l]]--,M[X[r]]--;
    movel(),mover();
  }
//  dump4(l,r,X[l],M[X[l]]);
  int res=NN;
  if(l==r&&(M[X[l]]%2==0)) --res;
  cout<<res<<endl;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  
  cin>>N;
  REP(i,N) cin>>A[i];
  solve();
  
  return 0;
}


Measured memory_bytes: 10016
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define invrepr(i,a,b) for(int i=b-1;i>=a;i--)
#define invrep(i,n) invrepr(i,0,n)
#define repitr(itr,a) for(auto itr=a.begin();itr!=a.end();++itr)
const int MOD=1e9+7;


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

    int n;
    cin >> n;
    vector<int> a(n);
    int s=0;
    rep(i,n) {
        cin >> a[i];
        s+=a[i];
    } 
    int m=s/n;
    if (s%n>n/2) ++m;
    ll ans=0;
    rep(i,n) ans+=(a[i]-m)*(a[i]-m);
    cout << ans << endl;
    return 0;   
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
vector<int> num(3);
for(int i = 0; i < 3; i++){
cin >> num.at(i);
}
sort(num.begin(), num.end());
cout << num.at(0) << " " << num.at(1) <<  " " << num.at(2) << endl;;


}


Measured memory_bytes: 3076
using namespace std;
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#define rep(i,n) for (int i=0; i<n;++i)
typedef long long ll;
int H, W;
char S[401][401];
struct node {int h,w;};
int dh[4] = {1,0,-1,0}, dw[4]={0,1,0,-1};
bool serched[401][401];

ll bfs(int h, int w) {
  queue<node> que;
  ll black=0;
  ll white=0; 
  que.push(node{h,w});
  while(!que.empty()) {
    node no = que.front(); que.pop();
    if (serched[no.h][no.w]) continue;
    if (S[no.h][no.w]=='#') black++;
    if (S[no.h][no.w]=='.') white++;
    serched[no.h][no.w] =true;
    rep(i, 4) {
      int nh = no.h+dh[i];
      int nw = no.w+dw[i];
      if (nh < 0 || nh > H || nw<0 || nw>W) continue;
      if (S[nh][nw]==S[no.h][no.w] || serched[nh][nw]) continue;
      que.push(node{nh,nw});
    }
  }
  return black * white;
}

int main() {
  cin >> H >> W;
  rep(i, H) rep(j, W) cin >> S[i][j];

  ll sm=0ll;
  rep(i, H) {
    rep(j, W) {
      if (!serched[i][j]) {
        sm+=bfs(i,j);
      }
    }
  }
  cout << sm << endl;
}


Measured memory_bytes: 3924
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <cmath>
#include <iomanip>
#include <algorithm>
using namespace std;

int main(){
    int n;
    cin >> n;
    long long a_max = -1;
    long long a_min = 1000000001;    
    for(int i = 0; i < n; i++){
        long long a;
        cin >> a;
        a_max = max(a, a_max);
        a_min = min(a, a_min);
    }
    cout << a_max - a_min << endl;
    return 0;
}


Measured memory_bytes: 256
n = int(input())
ans=n
for i in range(n+1):
  cnt=0
  t=i
  while t>0:
    cnt+=t%6
    t//=6
  s=n-i
  while s>0:
    cnt+=s%9
    s//=9
  ans = min(ans,cnt)
print(ans)

Measured memory_bytes: 67460
// --------------
// Tejas Pandey  |
// 25 - 07 - 20  |
// ABC M-Solution|
// --------------

#include <bits/stdc++.h>
using namespace std;
     
#define mod 1000000007
#define vi vector<int>
typedef long long int ll;
     
int main (void){
  //freopen("in.txt","r",stdin);
  //freopen("out.txt","w",stdout);
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n;
  int a[n];
  for(int i = 0;i < n;i++) cin >> a[i];
  ll ans = 1000,last = 201,cur = 0,rem = 0;
  for(int i = 0;i < n;i++){
	if(last > a[i]){
		cur = ans/a[i];
		rem = ans%a[i];
		last = a[i];
	}
	else{
		last = a[i];
		ans = max(ans,cur*a[i] + rem);
		cur = ans/a[i];
		rem = ans%a[i];
	}
  }
  cout << ans << "\n";  
  return 0;
}


Measured memory_bytes: 3644
import sys
from collections import defaultdict, deque
import bisect
from heapq import *
from math import factorial
sys.setrecursionlimit(200000)
input = sys.stdin.readline

X, A, B = map(int, input().split())
# N = int(input())
# L = [int(v) for v in input().split()]
# L = [[int(v) for v in input().split()] for _ in range(N)]
# L = [int(input()) for _ in range(N)]
# L = [list(input().strip())  for _ in range(N)]
# S = input().strip()

a = abs(X - A)
b = abs(X - B)

if a < b:
    print("A")
else:
    print("B")

Measured memory_bytes: 3316
#include <iostream>
#include <set>
#include <queue>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
#include <numeric>
#include <functional>

using namespace std;
#define ALL(x)              (x).begin(),(x).end()
#define REP(i, n)           for (int (i) = 0 ; (i) < (ll)(n) ; ++(i))
#define REPN(i, m, n)       for (int (i) = m ; (i) < (ll)(n) ; ++(i))
#define INF                 (int)2e9
#define MOD                 (1000 * 1000 * 1000 + 7)
#define Ceil(x, n)          (((((x))+((n)-1))/n))
#define CeilN(x, n)         (((((x))+((n)-1))/n)*n)
#define FloorN(x, n)        ((x)-(x)%(n))
#define IsOdd(x)            (((x)&0x01UL) == 0x01UL)
#define IsEven(x)           (!IsOdd((x)))
#define M_PI                3.14159265358979323846
typedef long long           ll;
typedef pair<ll, ll>        P;

/*-----------------------------------------------------------------------------
　処理
 -----------------------------------------------------------------------------*/
ll N, A, B;
vector<ll> h;
bool compExec(ll cnt, vector<ll> h)
{
	REP(i, N) {
		h[i] -= B * cnt;
	}

	ll diff = A - B;
	ll nokoriCnt = 0;
	REP(i, N) {
		if (0 < h[i]) {
			nokoriCnt += Ceil(h[i], diff);
		} else {
			break;
		}
	}
	return nokoriCnt <= cnt;
}

int main()
{
	vector<ll> h;
	cin >> N >> A >> B;
	h.resize(N);
	REP(i, N) cin >> h[i];
	sort(h.rbegin(), h.rend());

	ll lb = 0;
	ll lu = (ll)1e9;
	ll mid = 0;
	while ((lb + 1) != lu) {
		mid = (lb + lu) / 2;
		if (!compExec(mid, h)) {
			lb = mid;
		} else {
			lu = mid;
		}
	}

	cout << lu << endl;
	return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <queue>
#include <cstdio>
#include <cstdlib>
#include <functional>
#include <algorithm>
using namespace std;

typedef long long ll;


int main()
{
    int N, ans, len;
    string str, ring, tmp;

    cin >> str >> N;
    
    ans = 0; len = str.size();
    for(int i = 0; i < N; i++) {
        cin >> ring; 
        for(int j = 0; j < ring.size(); j++) {
            string tmp = "";
            for(int k = 0; k < len; k++) {
                tmp += string(1, ring[(k + j) % ring.size()]);
            }
            if(tmp == str) {
                ans++;
                break;
            }
        }

    }
    cout << ans << endl;
}

Measured memory_bytes: 0
#include<iostream>
#include<algorithm>
using namespace std;
long long a[3000000], mod = 1000000007, cnt;
int main() {
	int n; cin >> n;
	a[0] = 0; a[1] = 1; a[2] = 1; a[3] = 1;
	for (int i = 4; i <= 2000000; i++) { a[i] = a[i - 1] + a[i - 2] + a[i - 4]; a[i] %= mod; }
	for (int i = 1; i < n; i++) { cnt += (a[i] * (n - 1)); cnt %= mod; }
	for (int i = 1; i < n; i++) { cnt += (((a[i] * (n - 2)) + a[i + 1]) % mod)*(n - 1); cnt %= mod; }
	cout << (cnt + n) % mod << endl;
	return 0;
}

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

int main(){

  string a, b, c, t = "a";
  char ans;
  cin >> a >> b >> c;
  
  while(1){
    if(t=="a" && a.empty()==1) break;
    if(t=="b" && b.empty()==1) break;
    if(t=="c" && c.empty()==1) break;
    if(t=="a"){
      t=a[0];
      a=a.substr(1);
    } else if(t=="b"){
      t=b[0];
      b=b.substr(1);
    } else if(t=="c"){
      t=c[0];
      c=c.substr(1);
    }
  }

  if(t=="a"){
    ans = 'A';
  } else if(t=="b"){
    ans = 'B';
  } else {
    ans = 'C';
  }

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define chmin(a,b) if(a>b)a=b
#define LL long long
const int N=1e5+5;

int n,m;
int w[N],v[N];
int dp[N];

int main()
{
	
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++)
		scanf("%d%d",w+i,v+i);
	for(int i=1;i<N;i++)
		dp[i]=m+1;
	for(int i=1;i<=n;i++)
	for(int j=N-1;j>=0;j--)
		if(j+v[i]<N) chmin(dp[j+v[i]],dp[j]+w[i]);
	for(int i=N-1;i>=0;i--)
		if(dp[i]!=m+1) return printf("%d\n",i),0;
	
	return 0;
}

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

int main() {
	int W,H,x,y,r;
	cin>>W>>H>>x>>y>>r;
	if (x>=r && y>=r && (x+r)<=W && (y+r)<=H){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}
}

Measured memory_bytes: 3092
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define all(x) (x).begin(), (x).end()
#define MOD 1000000007
int main() {
    int n;
    cin >> n;
    vector<string> s(n);
    vector<int> t(n);
    for(int i = 0; i < n; i++) {
        cin >> s[i] >> t[i];
    }
    string x;
    cin >> x;
    int flag = 0;
    int ans = 0;
    for(int i = 0; i < n; i++) {
        if(s[i] == x) {
            flag = 1;
            continue;
        }
        ans += flag * t[i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
N, A, B = map(int, input().split())
h = []
for i in range(N):
  h += [int(input())]

Th = 2*max(h)//B
Tl = 0
while Tl+1<Th:
  t = (Th+Tl)//2
  d = []
  for i in range(N):
    c = h[i]
    d += [c-B*t]
  for i in range(N):
    c = d[i]
    if c<=0:
      continue
    t -= c//(A-B) if c%(A-B)==0 else c//(A-B)+1
    if t<0:
      Tl = (Th+Tl)//2
      break
  else:
    Th = (Th+Tl)//2
print(Th)

Measured memory_bytes: 83928
open Printf
open Scanf

let id x = x

let () =
  let n = scanf "%d " id in
  let rec read ls x =
    if x = 0 then ls
    else let p = scanf "%d %d " (fun i j -> (i, j)) in
         read (p::ls) (x-1)
  in
  let ps = read [] n in
  let rec loop i j ls =
    if i = 8 then ls
    else
      if List.mem i (List.map fst ls) then loop (i+1) 0 ls
      else
        if j = 8 then let p = List.hd ls in loop (fst p) ((snd p) + 1) (List.tl ls)
        else if List.mem j (List.map snd ls) ||
                  List.exists (fun (x, y) -> x + y = i + j) ls ||
                    List.exists (fun (x, y) -> x - y = i - j) ls then loop i (j+1) ls
        else loop (i+1) 0 ((i, j) :: ls)
  in
  let bd = Array.init 8 (fun _ -> "........") in
  List.iter (fun (r, c) -> let s = String.mapi (fun i x -> if i = c then 'Q' else x) bd.(r) in bd.(r) <- s) (loop 0 0 ps);
  Array.iter (fun s -> printf "%s\n" s) bd

Measured memory_bytes: 2384
/*  -*- coding: utf-8 -*-
 *
 * g.cc: G - Longest Path
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>

using namespace std;

/* constant */

const int MAX_N = 100000;

/* typedef */

typedef vector<int> vi;
typedef queue<int> qi;

/* global variables */

vi nbrs[MAX_N];
int ies[MAX_N], dists[MAX_N];

/* subroutines */

/* main */

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

  for (int i = 0; i < m; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    x--, y--;
    nbrs[x].push_back(y);
    ies[y]++;
  }

  qi q;
  for (int i = 0; i < n; i++)
    if (ies[i] == 0) q.push(i);

  while (! q.empty()) {
    int u = q.front(); q.pop();
    int vd = dists[u] + 1;
    vi &nbru = nbrs[u];

    for (vi::iterator vit = nbru.begin(); vit != nbru.end(); vit++) {
      int &v = *vit;
      if (dists[v] < vd) dists[v] = vd;
      if (--ies[v] == 0) q.push(v);
    }
  }

  int maxd = 0;
  for (int i = 0; i < n; i++)
    if (maxd < dists[i]) maxd = dists[i];

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


Measured memory_bytes: 6528
#include<bits/stdc++.h>
using namespace std;
int n,ans;
int main() {
	
	scanf("%d",&n);
	
	int maxx=0;
	for(int i=1;i<=n;i++) {
		int x;
		scanf("%d",&x);
		if (x>=maxx) ans++,maxx=x;
	}
	
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
#define all(x) (x).begin(),(x).end()


int main() {
  int field[3][3];
  for(int i=0; i<3; i++){
    for(int j=0; j<3; j++){
      cin >> field[i][j];
    }
  }
  int a[3], b[3];
  a[0] = 0;
  b[0] = field[0][0]; b[1] = field[1][0]; b[2] = field[2][0];
  a[1] = field[0][1] - b[0]; a[2] = field[0][2] - b[0];

  bool flag = true;
  if(a[1]+b[1] != field[1][1]) flag = false;
  if(a[1]+b[2] != field[2][1]) flag = false; 
  if(a[2]+b[1] != field[1][2]) flag = false;
  if(a[2]+b[2] != field[2][2]) flag = false;

  if(flag) cout << "Yes" << ln;
  else cout << "No" << ln;
 }


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N=100005;
int n,m,u,v,cnt,tot,ans,head[N],ck[N],c[3],to[N*2],nxt[N*2],dd[N*2];
bool flag;
void adde(int u,int v,int d){
	to[++cnt]=v;
	nxt[cnt]=head[u];
	dd[cnt]=d;
	head[u]=cnt;
}
void dfs(int u){
	c[ck[u]]++;
	for(int i=head[u];i;i=nxt[i]){
		if(dd[i]==1){
			tot++;
		}
		int v=to[i];
		if(ck[v]!=-1){
			if((ck[u]+dd[i])%3!=ck[v]){
				flag=true;
			}
		}else{
			ck[v]=(ck[u]+dd[i])%3;
			dfs(v);
		}
	}
}
signed main(){
	scanf("%lld%lld",&n,&m);
	for(int i=1;i<=m;i++){
		scanf("%lld%lld",&u,&v);
		adde(u,v,1);
		adde(v,u,2);
	}
	memset(ck,-1,sizeof(ck));
	for(int i=1;i<=n;i++){
		if(ck[i]==-1){
			ck[i]=tot=c[0]=c[1]=c[2]=flag=0;
			dfs(i);
			if(flag){
				ans+=(c[0]+c[1]+c[2])*(c[0]+c[1]+c[2]);
			}else if(!c[0]||!c[1]||!c[2]){
				ans+=tot;
			}else{
				ans+=c[0]*c[1]+c[1]*c[2]+c[2]*c[0];
			}
		}
	}
	printf("%lld\n",ans);
	return 0;
}

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

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

	int ans = 0;
	int aji = 500;
	rep(i, n){
		int d = l+i;
		if(abs(d) < abs(aji)) aji = d;
		ans += d;
	}

	cout << ans-aji << endl;

	return 0;
}


Measured memory_bytes: 256
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
     .      '                    Udit Gupta @luctivud         ,              
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                            ##     ##  #######  # #  ######
                            ##     ##  ##   ##  ###    ##
                            ##     ##  ##    #  # #    ##
                            #########  #######  # #    ##
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/

#include <bits/stdc++.h>
using namespace std;

const long long int MODPRIME {1000000007};
const long int MAXN = (long int) 1e6;

#define LIGHTNING_FASTIO()         ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define TESTCASES()                long long int TestCases; cin>>TestCases; while(TestCases--)
#define mems(arr,val)              memset((arr), val, sizeof((arr)))
#define endl                       "\n"

// ///////////////////////////////////////////////////////////////////////////////////////////////
//                         : ALL THE HELPER FUNCTIONS USED IN THE PROGRAM :                     //
// ///////////////////////////////////////////////////////////////////////////////////////////////


// ///////////////////////////////////////////////////////////////////////////////////////////////
//                                     : MAIN STARTS HERE :                                     //
// ///////////////////////////////////////////////////////////////////////////////////////////////

void solve() {
    long double x;
    long double udd = 0.00995033085;
    cin >> x;
    unsigned long long int amount = 100;
    unsigned long long int ans = 0;
    while(amount < x) {
        amount += (amount * 0.01);
        ans += 1;
    }
    cout << ans << endl;
    return;
}

signed main() {
    LIGHTNING_FASTIO();
    // TESTCASES()
        solve();
    return 0;
}
/*
THE LOGIC AND APPROACH IS BY ME @luctivud.
SOME PARTS OF THE CODE HAS BEEN TAKEN FROM WEBSITES LIKE::
(I Own the code if no link is provided here or I may have missed mentioning it)
: DO NOT PLAGIARISE.
*/

Measured memory_bytes: 3740
inp = []
i = 0
j = 0
k = 0
l = 0

while True:
    inp.append(list(map(int, input().split())))
    if inp[i][0] == 0 and inp[i][1] == 0:
        del inp[i]
        break
    i += 1

for j in range(len(inp)):
    for k in range(inp[j][0]):
        for l in range(inp[j][1]):
            if l == 0 or l+1 == inp[j][1]:
                print(end="#")
            else:
                if k == 0 or k+1 == inp[j][0]:
                    print(end="#")
                else:
                    print(end=".")
        print("")
    print("")
        




Measured memory_bytes: 6312
s = gets.chomp.split('')
t = gets.chomp.split('')

sLen = s.size
tLen = t.size

best = 0
0.upto(sLen - tLen) do |si|
    cnt = 0
    tLen.times do |ti|
        cnt += 1 if s[si + ti] == t[ti]
    end
    best = [best, cnt].max
end

puts (tLen - best)

Measured memory_bytes: 14380
#include <iostream>
#include <vector>
#include <cstdio>
#include <queue>
#include <algorithm>
#include <functional>
#include <string>
#include <queue>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#define ll long long
#define fr(i,k,N) for(ll i=k; i<N;i++)
#define rep(i,N) for(ll i=0; i<N;i++)
#define ALL(v) v.begin(),v.end()
#define mp make_pair
using namespace std;
template <class X> void pr(X test){cout<<test<<endl;}
template <class X> void prr(X test){for(auto it:test){cout<<it<<endl;}}
template <class X> void prrr(X test){int f=0;for(auto it:test){cout<<(f++!=0?" ":"")<<it;}cout<<endl;}
template<typename X>
istream&operator>>(istream&i,vector<X>&v){for(X&x:v)i>>x;return i;}

class UF { // union find from https://github.com/kartikkukreja/blog-codes (MIT)
    // [usage]
    // auto uf = new UF(n);
    // uf->merge(l, r); // 0 <= l, r <= n-1
    // ...
public:
    int *id; // inner id
    int cnt; // number of all vartices
    int *sz; // sz[i] means size of i's set
    UF(int N)   {
        cnt = N;
        id = new int[N];
        sz = new int[N];
        for(int i=0; i<N; i++) {
            id[i] = i;
            sz[i] = 1;
        }
    }
    ~UF() {
        delete [] id;
        delete [] sz;
    }
    int find(int p) {
        int root = p;
        while (root != id[root]) root = id[root];
        while (p != root) {
            int newp = id[p];
            id[p] = root;
            p = newp;
        }
        return root;
    }
    void merge(int x, int y) {
        int i = find(x);
        int j = find(y);
        if (i == j) return;
        
        if (sz[i] < sz[j]) {
            id[i] = j;
            sz[j] += sz[i];
        } else {
            id[j] = i;
            sz[i] += sz[j];
        }
        cnt--;
    }
    bool connected(int x, int y) {
        return find(x) == find(y);
    }
    int count() {
        return cnt;
    }
};

// return sorted 約数list 1 <= x <= n
vector<ll> divv(ll n) {
  vector<ll> v;
  for(ll i = 1; i*i <= n; i++) {
    if(n%i == 0) {
      v.push_back(i);
      if(i*i != n) v.push_back(n/i);
    }
  }
  sort(ALL(v));
  return v;
}


int main() {
    ll n,k;
    cin>>n>>k;
    ll sum = 0;
    rep(i, n){
        ll u;
        cin>>u;
        if(u>=k) sum++;
    }
    
    pr(sum);
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
    int h,w;
    scanf("%d%d",&h,&w);
    char field[h][w];
    int checkh[h],checkw[w];
    for (int i=0;i<h;i++){
        scanf("%c",&field[i][0]);
        for (int j=0;j<w;j++){
            scanf("%c",&field[i][j]);
        }
    }
    for (int i=0;i<h;i++){
        checkh[i]=0;
        for (int j=0;j<w;j++){
            if (field[i][j]=='#'){
                checkh[i]=1;
                break;
            }
        }
        if (checkh[i]==1){
            continue;
        }
    }
    for (int j=0;j<w;j++){
        checkw[j]=0;
        for (int i=0;i<h;i++){
            if (field[i][j]=='#'){
                checkw[j]=1;
                break;
            }
        }
        if (checkw[j]==1){
            continue;
        }
    }
    for (int i=0;i<h;i++){
        if (checkh[i]){
            for (int j=0;j<w;j++){
                if (checkw[j]){
                    printf("%c",field[i][j]);
                }
            }
            printf("\n");
        }
    }
    return 0;
}


Measured memory_bytes: 128