akhauriyash/Code-Regression huggingface dataset:
from sys import stdin
def input():
    return stdin.readline().strip()

import heapq

def main():
    h, w, k = map(int, input().split())
    x1, y1, x2, y2 = map(int, input().split())

    # surround the square with '@'
    c = [['@'] * (w+2)]
    for _ in range(h):
        i = list('@' + input() + '@')
        c.append(i)
    c.append(['@'] * (w+2))


    from random import randrange
    if randrange(0, 3) == 0:
        # BFS
        # 直線を進めるだけ進む
        from collections import deque
        seen = [[0] * (w+2) for _ in range(h+2)]
        seen[x1][y1] = 1
        todo = deque([(x1, y1)])
 
        dx = [1, 0, -1, 0]
        dy = [0, 1, 0, -1]
 
        while len(todo) > 0:
            ix, iy = todo.popleft()
            s = seen[ix][iy] + 1
 
            for j in range(4):
                jx, jy = ix, iy
                dxj, dyj = dx[j], dy[j]
 
                for _ in range(k):
                    jx, jy = jx + dxj, jy + dyj
 
                    if c[jx][jy] == '@':
                        break
 
                    if jx == x2 and jy == y2:
                        print(s - 1)
                        exit()
            
                    if seen[jx][jy] == 0:
                        seen[jx][jy] = s
                        todo.append((jx, jy))



    # Dijkstra
    seen = [[-1] * (w+2) for _ in range(h+2)]
    # todo[i] == (cost, x, y, direction)
    todo = [(0, x1, y1, 0)]
    heapq.heapify(todo)

    dx = [-1, 0, 1, 0]
    dy = [0, 1, 0, -1]

    while len(todo) > 0:
        cost, xi, yi, direction = heapq.heappop(todo)

        # special case
        if seen[xi][yi] == cost:
            xj, yj = xi + dx[direction], yi + dy[direction]
            if c[xj][yj] == '.' and seen[xj][yj] == -1:
                heapq.heappush(todo, (cost+1, xj, yj, direction))
            continue

        if seen[xi][yi] != -1:
            continue
        seen[xi][yi] = cost

        # goal
        if xi == x2 and yi == y2:
            print((cost-1)//k + 1)
            exit()
        
        # add
        for j in range(4):
            xj, yj= xi + dx[j], yi + dy[j]

            if c[xj][yj] == '@':
                continue

            if seen[xj][yj] == -1:
                if j == direction:
                    heapq.heappush(todo, (cost+1, xj, yj, j))
                else:
                    heapq.heappush(todo, (((cost-1)//k + 1)*k + 1, xj, yj, j))

    print(-1)

main()

Measured memory_bytes: 193852
#define CIN_ONLY 0
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
const double PI = 3.14159265358979323846;

int main()
{
	if (CIN_ONLY) {
		ios::sync_with_stdio(0);
		cin.tie(0);
	}
	string s;
	cin >> s;
	int ans = 1e9;
	for (int i = 'a'; i <= 'z'; ++i) {
		int dif = -1;
		int prev = -1;
		for (int j = 0; j < s.size(); ++j) {
			if (s[j] == i) {
				dif = max(dif, j - prev - 1);
				prev = j;
			}
		}
		dif = max(dif, int(s.size()) - prev - 1);
		if (dif >= 0) {
			ans = min(ans, dif);
		}
	}
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 256
from collections import Counter,defaultdict,deque
from heapq import heapify,heappop,heappush
import sys,bisect,math,itertools,string,queue
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

n,x = inpl()
a = inpl()
a.sort()
if a[0] > x:
    print(0)
elif sum(a) == x:
    print(n)
elif sum(a) < x:
    print(n-1)
else:
    s = 0
    for i,y in enumerate(a):
        # print(i,y)
        if s + y < x:
            s += y
        elif s + y == x:
            print(i+1)
            break
        else:
            print(i)
            break
    else:
        print(n-1)

Measured memory_bytes: 38512
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define all(x) x.begin(),x.end()
#define ln '\n'
const long long MOD = 1000000007LL;
//const long long MOD = 998244353LL;
typedef long long ll;
typedef unsigned long long ull; 
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
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; }
///////////////////////////////////////////////////////////////////////////////////////////////////

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int N; cin >> N;
    vector<int> A(N),B(N);
    rep(i,N) cin >> A[i];
    rep(i,N) cin >> B[i];

    int T = 1;
    rep(i,28) T *= 2;
    int ans = 0;
    for (int bit = 28; bit >= 0; --bit) {
        rep(i,N) A[i] %= 2*T;
        rep(i,N) B[i] %= 2*T;
        sort(all(B));

        ll cnt = 0;
        rep(i,N) {
            int p = lower_bound(all(B),2*T-A[i]) - lower_bound(all(B),T-A[i]);
            int q = lower_bound(all(B),4*T-A[i]) - lower_bound(all(B),3*T-A[i]);
            cnt += p+q;
        }
        if (cnt&1) ans += 1<<bit;
        T >>= 1;
    }

    cout << ans << ln;
}


Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iomanip>
#include <numeric>
#include <queue>
#include <cmath>
using namespace std;


int main() {
    int n;
    cin >> n;
    int res = 0;
    for (int i = 0; i < n; i++) {
        int l, r;
        cin >> l >> r;
        res += r - l + 1;
    }
    cout << res << endl;
}




Measured memory_bytes: 3564
N, K = map(int, input().split())
H = [int(input()) for _ in range(N)]
H_sort = sorted(H)
ans = H_sort[K-1] - H_sort[0]
for j in range(K, N):
    h_diff = H_sort[j] - H_sort[j + 1 -K]
    ans = min(ans, h_diff)
print(ans)

Measured memory_bytes: 8280
#include<bits/stdc++.h>
using namespace std;
using i64 = int_fast64_t;
#define rep(i, N) for(int (i) = 0; (i) < (N); (i)++)
#define all(v) (v).begin(), (v).end()
#define eb emplace_back

int main(){
	int A, B;
	cin >> A >> B;
	int ans = -1;
	for(int i = 1; i <= 1000; i++){
		if(i*8/100 == A && i*10/100 == B){
			ans = i;
			break;
		}
	}

	cout << ans << endl;
}


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

using ll = long long;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)

#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  rep(i, (int)v.size()) {
    if (i)
      os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

template <typename T, size_t S> void printArray(const T (&array)[S]) {
  for (auto val : array)
    std::cout << val << ", ";
  std::cout << "\n";
}

const int mod = 1e9 + 7;
const int inf = 1e9 + 5;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << std::setprecision(10);

  int n; std::cin >> n;
  int x = n * 800, y = n / 15 * 200;
  std::cout << x - y << "\n";
}


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

class Problem {
    public static void Main() {
        var dat = Console.ReadLine().Split().Select(double.Parse).ToArray();
        Console.WriteLine(Math.Sqrt((dat[2] - dat[0]) * (dat[2] - dat[0]) + (dat[3] - dat[1]) * (dat[3] - dat[1])));
    }
}


Measured memory_bytes: 9592
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define ALL(A) A.begin(), A.end()

using namespace std;

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

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

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

	sort(ALL(a));

	int res = a[N-1] - a[0];
	cout << res << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<queue>
#include<stack>
#include<string>
#include<map>
#include<sstream>
#include<vector>
#include<ctime>
#include<unordered_map>
using namespace std;
typedef long long ll;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0);
const int inf=0x3f3f3f3f;
int main()
{
	IOS;
	int h,w,n;
	cin>>h>>w>>n;
	int ma=max(h,w);
	if(n%ma==0) cout<<n/ma<<endl;
	else cout<<n/ma+1<<endl;
	return 0;
}


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

#define rep(i, a, b) for ( int i = (a); i < (b); i++ )
#define per(i, a, b) for ( int i = (b)-1; i >= (a); i--)
#define pb push_back
#define mp make_pair
#define bg begin()
#define en end()


using namespace std;

typedef long long ll;

static const long long MOD = 1000000007;

int ans;

int main(void) {
    string s;
    cin >> s;
    if (s[2]==s[3] && s[4]==s[5]) puts("Yes");
    else puts("No");
    


	return 0;
}


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

const int maxn=1e5+5;

int n,tot;
int now[maxn],pre[maxn<<1],son[maxn<<1];

int read() {
	int x=0,f=1;char ch=getchar();
	for(;ch<'0'||ch>'9';ch=getchar())if(ch=='-')f=-1;
	for(;ch>='0'&&ch<='9';ch=getchar())x=x*10+ch-'0';
	return x*f;
}

void add(int a,int b) {
	pre[++tot]=now[a];
	now[a]=tot,son[tot]=b;
}

int dfs(int fa,int u) {
	int res=0;
	for(int p=now[u],v=son[p];p;p=pre[p],v=son[p])
		if(v!=fa)res+=dfs(u,v);
	if(res>=2)return res;
	else return res^1;
}

int main() {
	n=read();
	for(int i=1;i<n;i++) {
		int a=read(),b=read();
		add(a,b),add(b,a);
	}
	if(dfs(0,1))puts("First");
	else puts("Second");
	return 0;
}


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

int main() {
  int A,B,C,D;
  cin>>A>>B>>C>>D;
  int64_t Q=998244353;
  vector<vector<int64_t>> dp(C+1,vector<int64_t>(D+1));
  dp[A][B]=1;
  for(int i=A;i<=C;i++){
    for(int j=B;j<=D;j++){
      if(i*j==A*B){
        continue;
      }
      dp[i][j]=(dp[i-1][j]*(j)+dp[i][j-1]*(i)-dp[i-1][j-1]*(i-1)*(j-1)+Q*i*j)%Q;
    }
  }
  cout<<dp[C][D]<<endl;    
}



Measured memory_bytes: 73624
def solve(string):
    n, m = map(int, string.split())
    if n == 1 and m == 1:
        return "1"
    elif n == 1 or m == 1:
        return str(max(n - 2, m - 2))
    elif n == 2 or m == 2:
        return "0"
    else:
        return str((n - 2) * (m - 2))


if __name__ == '__main__':
    print(solve(input()))


Measured memory_bytes: 3060
#pragma GCC optimize("O3")
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

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

template <class T> inline T chmax(T &a, const T b) {return a = (a < b) ? b : a;}
template <class T> inline T chmin(T &a, const T b) {return a = (a > b) ? b : a;}

constexpr int MOD = 1e9 + 7;
constexpr int inf = 1e9;
constexpr long long INF = 1e18;
constexpr double pi = acos(-1);
constexpr double EPS = 1e-10;

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

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

    ll n; cin>>n;
    ll ga, sa, ba; cin>>ga>>sa>>ba;
    ll gb, sb, bb; cin>>gb>>sb>>bb;

    // dp[i] := 前のドングリ数が i のとき、今のドングリ数の最大値

    // A -> B
    vector<ll> dp1(n+1);
    iota(dp1.begin(), dp1.end(), 0LL);
    for(int i=0; i<=n; i++){
        if(i - ga >= 0) chmax(dp1[i], dp1[i - ga] + gb);
        if(i - sa >= 0) chmax(dp1[i], dp1[i - sa] + sb);
        if(i - ba >= 0) chmax(dp1[i], dp1[i - ba] + bb);
    }

    // B -> A
    n = dp1[n];
    vector<ll> dp2(n+1);
    iota(dp2.begin(), dp2.end(), 0LL);
    for(int i=0; i<=n; i++){
        if(i - gb >= 0) chmax(dp2[i], dp2[i - gb] + ga);
        if(i - sb >= 0) chmax(dp2[i], dp2[i - sb] + sa);
        if(i - bb >= 0) chmax(dp2[i], dp2[i - bb] + ba);
    }

    cout << dp2[n] << endl;

    return 0;
}

Measured memory_bytes: 195584
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repl(i,n) for(int64_t i=0;i<(int64_t)(n);i++)
#define ll int64_t
#define all(v) (v).begin(),(v).end()
#define P pair<int,int>
using namespace std;

int main() {
    int n; cin>>n;
    vector<char> s(n);
    rep(i,n) cin>>s[i];
    int ans=n;

    rep(i,n-1) {
        if(s[i]==s[i+1]) {
            ans--;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 384
//#include <boost/multiprecision/cpp_dec_float.hpp>
//#include <boost/multiprecision/cpp_int.hpp>
#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <math.h>
#include <algorithm>
#include <bitset>
using namespace std;
//namespace mp = boost::multiprecision;
//using llll = mp::cpp_int;
// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)
//using Real = mp::number<mp::cpp_dec_float<1024>>;
using ll = long long;
const double EPS = 1e-10;
const ll MOD = 7+(1e+9);

int main(){
  ll ans=0;
  string s,t;
  cin>>s>>t;
  vector<set<ll> >v(26,set<ll>());
  for(ll i=0;i<(ll)s.size();i++){
    v[s[i]-'a'].insert(i);
    v[s[i]-'a'].insert(i+(ll)s.size());
  }
  for(ll i=0;i<(ll)t.size();i++){
    if((ll)v[t[i]-'a'].size()==0)ans=-1;
  }
  if(ans==-1){
    cout<<ans<<endl;
    return 0;
  }
  ans=0;
  ll tmp=0;
  for(ll i=0;i<(ll)t.size();i++){
    auto it=v[t[i]-'a'].lower_bound(tmp);
    tmp=*it;
    tmp++;
    if(tmp>=(ll)s.size()){
      tmp-=(ll)s.size();
      ans++;
    }
  }
  ans=ans*(ll)s.size()+tmp;
  cout<<ans<<endl;
}


Measured memory_bytes: 9856
#pragma region template
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vld = vector<ld>;
using vvld = vector<vld>;
using vvvld = vector<vvld>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
template <typename T>
using pqrev = priority_queue<T, vector<T>, greater<T>>;
#define rep(i, n) for (ll i = 0, i##_end = (n); i < i##_end; i++)
#define repb(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repr(i, a, b) for (ll i = (a), i##_end = (b); i < i##_end; i++)
#define reprb(i, a, b) for (ll i = (b)-1, i##_end = (a); i >= i##_end; i--)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((ll)(x).size())
//*
constexpr ll MOD = 1e9 + 7;
/*/
constexpr ll MOD = 998244353;
//*/
constexpr ll INF = 1e+18;
constexpr ld EPS = 1e-12L;
constexpr ld PI = 3.14159265358979323846L;
constexpr ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
constexpr ll LCM(ll a, ll b) { return a / GCD(a, b) * b; }
template <typename S, typename T>
inline bool chmax(S &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename S, typename T>
inline bool chmin(S &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
#ifdef OJ_LOCAL
#include "dump.hpp"
#else
#define dump(...) ((void)0)
#endif
template <typename T>
bool print_(const T &a) {
  cout << a;
  return true;
}
template <typename T>
bool print_(const vector<T> &vec) {
  for (auto &a : vec) {
    cout << a;
    if (&a != &vec.back()) {
      cout << " ";
    }
  }
  return false;
}
template <typename T>
bool print_(const vector<vector<T>> &vv) {
  for (auto &v : vv) {
    for (auto &a : v) {
      cout << a;
      if (&a != &v.back()) {
        cout << " ";
      }
    }
    if (&v != &vv.back()) {
      cout << "\n";
    }
  }
  return false;
}
void print() { cout << "\n"; }
template <typename Head, typename... Tail>
void print(Head &&head, Tail &&... tail) {
  bool f = print_(head);
  if (sizeof...(tail) != 0) {
    cout << (f ? " " : "\n");
  }
  print(forward<Tail>(tail)...);
}
#pragma endregion

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  ll n, x, t;
  cin >> n >> x >> t;
  print((n+x-1)/x*t);
}


Measured memory_bytes: 3652
#include<cstdio>
#include<sstream>
#include<cstdlib>
#include<cctype>
#include<cmath>
#include<algorithm>
#include<set>
#include<queue>
#include<stack>
#include<list>
#include<iostream>
#include<fstream>
#include<numeric>
#include<string>
#include<vector>
#include<cstring>
#include<map>
#include<iterator>
#include<bitset>
typedef long long ll;
double pi=3.1415926535897931159979635;
int val[100001];

using namespace std;
int main()
{
ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll n,sum=0,a,b,c,t;
    cin>>n;
    
    for(int i=0; i<n; i++){
    cin>>a; val[a]++;
    sum+=a;
    }
    cin>>t;
    while(t--){
    cin>>b>>c;
    sum-=val[b]*b; sum+=c*val[b];
    val[c]+=val[b];
    val[b]=0;
    cout<<sum<<"\n";
    }
    
    
    
return 0;

}

Measured memory_bytes: 3928
#include <bits/stdc++.h>
using namespace std;
int main(void){
  string S;
  cin >> S;
  int N = S.size();
  int const R = 13;
  int dp[N+1][R];
  // dp[i][r]: i桁目まで見たときの余りがrとなる場合の数
  // dp[0][r] は0桁見たときの値、初期値として利用
  // dp[i+1][(S[i]*10^i%MOD + r%MOD)%MOD] = sigma dp[i][r]
  for(int i=0; i<N+1; i++) for(int j=0; j<R; j++) dp[i][j] = 0;
  dp[0][0] = 1;
  int const MOD = 1e9+7;
  
  int keta = 1;
  for(int i=0; i<N; i++){
    char c = S[N-1-i];
    if(c == '?'){
      for(int k=0; k<10; k++){
        for(int j=0; j<R; j++){
          dp[i+1][(k*keta + j)%R] += dp[i][j];
          dp[i+1][(k*keta + j)%R] %= MOD;
        }
      }
    }else{
      int k = c - '0';
//      cout << k << endl;
      for(int j=0; j<R; j++){
        dp[i+1][(k*keta + j)%R] += dp[i][j];
        dp[i+1][(k*keta + j)%R] %= MOD;
      }
    }
    keta *= 10;
    keta %= R;
  }
/*
  for(int i=0; i<N+1; i++) {
    for(int j=0; j<R; j++){
      cout << dp[i][j] << " ";
    }
    cout << endl;
  }
*/
  cout << dp[N][5] << endl;
  return 0;
}

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

YES = "YES"  # type: str
NO = "NO"  # type: str


def solve(N: int, A: "List[int]"):
    print(YES if len(A)==len(set(A)) else NO)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A)

if __name__ == '__main__':
    main()


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

using namespace std;

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n,k;
	cin >> n >> k;
	int ans=0;
	vector <int> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];	
	}
	sort(a.begin(), a.end());
	for (int i=0; i<k; i++) {
		ans+=a[i];
	}
	cout << ans;
	return 0;	
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define pll pair<ll,ll>
#define all(v) v.begin(),v.end()
#define mod 1000000007
#define mx 2000005
mt19937 myrand(time(0));

ll fact[mx],inv[mx];

ll bigmod(ll a, ll p, ll m){
    ll res=1,x=a;
    while(p){
        if(p&1) res=(res*x)%m;
        x=(x*x)%m;
        p=p>>1;
    }
    return res;
}

void precalc(){
    fact[0]=1;
    for(int i=1;i<mx;i++) fact[i]=(i*fact[i-1])%mod;
    inv[mx-1]=bigmod(fact[mx-1],mod-2,mod);
    for(int i=mx-2;i>=0;i--) inv[i]=((i+1)*inv[i+1])%mod;
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(),cout.tie();
    precalc();
    ll k,n;
    string str;
    cin>>k;
    cin>>str;
    n=str.size();
    ll ans=bigmod(26,n+k,mod);
    debug()<<imie(ans);
    for(int i=0;i<n;i++){
        ll tmp=(((fact[n+k]*inv[n+k-i])%mod)*inv[i])%mod;
        tmp=(tmp*bigmod(25,n+k-i,mod))%mod;
        ans=(ans-tmp)%mod;
        (ans+=mod)%=mod;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 35532
N,M,P = list(map(int,input().split()))

e_list = []
for i in range(M):
    A,B,C = list(map(int,input().split()))
    A,B = A-1,B-1
    e_list.append((A,B,P-C))
    

#ベルマンフォード法
#e_listの用意
vi=0
min_dis_list = [10**27 for i in range(N)]
min_dis_list[vi] = 0
prev_list = [-1 for i in range(N)]

for i in range(N-1):
    for e in e_list:
        u,v,d = e
        if min_dis_list[v]>min_dis_list[u]+d:
            min_dis_list[v]=min_dis_list[u]+d
            prev_list[v]=u

neg_loop_flag=[False for i in range(N)]

for i in range(N):
    for e in e_list:
        u,v,d = e
        if min_dis_list[u] < 10**26:
            if min_dis_list[u] + d < min_dis_list[v]:
                neg_loop_flag[v]=True
                min_dis_list[v] = min_dis_list[u] + d
            if neg_loop_flag[u]:
                neg_loop_flag[v]=True


if neg_loop_flag[N-1]:
    print(-1)
else:
    print(max(0,-min_dis_list[N-1]))

Measured memory_bytes: 75608
A,B=map(int,input().split())

def larger(x,y):
  if x>y:
    return x
  else:
    return y

L=larger(A,B)
S=A+B-L

#rが最大公約数
r=L%S
while r!=0:
  L=S
  S=r
  r=L%S
  
#最小公倍数求める
p=(A*B)//S
print(p)

Measured memory_bytes: 9172
#include <bits/stdc++.h>
using namespace std;
 
int main() {
int N;
cin >> N;
int M = N;
int fx = 0;
int d = 10;

for (int i = 0; i < 8; i++) {
    fx += N % 10;
    N /= 10;
}

if (M % fx == 0 ) {
    cout << "Yes" << endl;
}
else {
    cout << "No" << endl;
}

}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main() {
	int a, b;
		cin >> a >> b;
		int time = 0;
		if (a < b)++time;
	while (a != 0 && b != 0) {
		if (time%2 == 0) {
			a %= b;
		}
		else {
			b %= a;
		}
		++time;
	}
	cout << a + b << endl;
	return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
#define int long long
int MOD = 1000000007;
int solve(int A) {
	if (A == -1)return 0;
	if (A % 4 == 1) {
		return 1;
	}
	else if (A % 4 == 3) {
		return 0;
	}
	else if(A % 4 == 0){
		return A;
	}
	else {
		return A ^ 1;
	}
}
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int A, B;
	cin >> A >> B;
	cout << (solve(B) ^ solve(A - 1)) << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define dd double

using namespace std;


int main(){
    int N,K;
    int count = 0;
    cin >> N >> K;
    vector<int> h(N);
    for(int i = 0; i < N; i++){
        cin >> h[i];
        if(h[i] >= K) count++;
    }
    cout << count << endl;
}

Measured memory_bytes: 768
import sys

N,A,B,C = map(int,input().split())
s = [0]*N

for i in range(N):
    s[i] = input()

ans = [0]*N
for i in range(N):
    if s[i] == "AB":
        if A == 0 and B == 0:
            print("No")
            sys.exit()
        elif A == 0:
            ans[i] = "A"
            A += 1
            B -= 1
        elif B == 0:
            ans[i] = "B"
            B += 1
            A -= 1
        elif i < N-1 and s[i+1] == "BC":
            ans[i] = "B"
            B += 1
            A -= 1
        elif i < N-1 and s[i+1] == "AC":
            ans[i] = "A"
            A += 1
            B -= 1
        else:
            ans[i] = "A"
            A += 1
            B -= 1
    elif s[i] == "BC":
        if B == 0 and C == 0:
            print("No")
            sys.exit()
        elif B == 0:
            ans[i] = "B"
            B += 1
            C -= 1
        elif C == 0:
            ans[i] = "C"
            C += 1
            B -= 1
        elif i < N-1 and s[i+1] == "AB":
            ans[i] = "B"
            B += 1
            C -= 1
        elif i < N-1 and s[i+1] == "AC":
            ans[i] = "C"
            C += 1
            B -= 1
        else:
            ans[i] = "B"
            B += 1
            C -= 1
    elif s[i] == "AC":
        if A == 0 and C == 0:
            print("No")
            sys.exit()
        elif C == 0:
            ans[i] = "C"
            C += 1
            A -= 1
        elif A == 0:
            ans[i] = "A"
            A += 1
            C -= 1
        elif i < N-1 and s[i+1] == "AB":
            ans[i] = "A"
            A += 1
            C -= 1
        elif i < N-1 and s[i+1] == "BC":
            ans[i] = "C"
            C += 1
            A -= 1
        else:
            ans[i] = "C"
            C += 1
            A -= 1

print("Yes")
for i in range(N):
    print(ans[i])

            

Measured memory_bytes: 16932
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace AtCoder
{
	public class ABC
	{
		static void Main(string[] args)
		{
			Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });


			int[] vs = Console.ReadLine().Split().Select(int.Parse).ToArray();
			int x = vs[0], y = vs[1], z = vs[2], n = vs[3];

			long[] a = Console.ReadLine().Split().Select(long.Parse).OrderByDescending(p => p).ToArray();
			long[] b = Console.ReadLine().Split().Select(long.Parse).OrderByDescending(p => p).ToArray();
			long[] c = Console.ReadLine().Split().Select(long.Parse).OrderByDescending(p => p).ToArray();

			List<long> ans = new List<long>();
			for (int i = 0; i < x; i++) {
				for (int j = 0; j < y; j++) {
					for (int k = 0; k < z; k++) {
						if ((i + 1) * (j + 1) * (k + 1) <= n) {
							ans.Add(a[i] + b[j] + c[k]);
						} else {
							break;
						}
					}
				}
			}
			foreach (var item in ans.OrderByDescending(p => p).Take(n)) {
				Console.WriteLine(item);
			}


			Console.Out.Flush();
		}
	}
}


Measured memory_bytes: 17760
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
#define rep(i, begin, n) for (int i = begin; i < n; i++)
#define repe(i, begin, n) for (int i = begin; i <= n; i++)
#define repr(i, begin, n) for (int i = begin; i > begin - n; i--)
#define repre(i, begin, end) for (int i = begin; i >= end; i--)

const int inf = 1000000007;
const int MOD = 1000000007;
const long long INF = 1000000000000000007;

int N, K;
int H[201010];

int main()
{
    cin >> N >> K;
    rep(i, 0, N)
    {
        cin >> H[i];
    }
    sort(H, H + N);
    if (K >= N)
    {
        cout << 0 << endl;
        return 0;
    }
    ll ans = 0;
    rep(i, 0, N - K)
    {
        ans += H[i];
    }
    cout << ans << endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

int a[200010], b[200010], ans = 0;

int main() {
    ios_base::sync_with_stdio(0);
    int n, m, k; cin >> n >> m >> k;
    for (int i=0;i<n;i++) cin >> a[i];
    for (int i=0;i<m;i++) cin >> b[i];

    int p = 0, sum = 0;
    while (p<n&&sum+a[p]<=k) {
        sum += a[p];
        p++;
    }

    int q = 0;
    for (int i=p;i>=0;i--) {
        while (q<m&&sum+b[q]<=k) {
            sum += b[q];
            q++;
        }
        ans = max(ans, i+q);
        if (i>0) sum -= a[i-1];
    }

    cout << ans << endl;
}


Measured memory_bytes: 5188
#include<bits/stdc++.h>
using namespace std;
constexpr int64_t mod=1e9+7;

int main()
{
  string s;
  cin>>s;
  vector<char> t={s[0]};
  for (int i = 1; i < s.size(); ++i)
  {
    if(s[i-1]=='B' && s[i]=='C'){
      t.pop_back();
      t.push_back('D');
    }
    else{
      t.push_back(s[i]);
    }
  }

  int64_t cnt=0,ans=0;
  for (int i = 0; i < t.size(); ++i)
  {
    if(t[i]=='A') cnt++;
    else if(t[i]=='D') ans+=cnt;
    else cnt=0;
  }
  cout<<ans;
}

Measured memory_bytes: 772
#!/usr/bin/env python
# coding: utf-8

# In[5]:


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


# In[7]:


x = c-(a+b)
y = 4*a*b
if x > 0 and x**2 > y:
    print("Yes")
else:
    print("No")


# In[ ]:






Measured memory_bytes: 61956
package main

import "fmt"

func main() {
	var N int
	fmt.Scan(&N)

	for h := 1; h <= 3500; h++ {
		for n := h; n <= 3500; n++ {
			x := N * h * n
			y := 4*h*n - N*n - N*h
			if !(y > 0) {
				continue
			}
			if x%y == 0 {
				w := x / y
				fmt.Println(h, n, w)
				return
			}
		}
	}

	// fmt.Println("Error")
}


Measured memory_bytes: 512
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		long X;
		X = sc.nextLong();
		int i=0;
		long p=100;
			while(p<X) {
				p*=1.01;
				i++;
			}
		System.out.println(i);
	}
}

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

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;


#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

int dx4[4] = {1,0,-1,0}, dy4[4] = {0,1,0,-1};


int main()
{   
    ll ans=0;
    string s;
    cin>>s;
    int inc=0;
    for (int i = s.size()-1; i >= 0; i--)
    {
        int n=s[i]-'0';
        int n10;
        n+=inc;
        inc=n/10;
        n=n%10;
        int inc2=inc;
        if(i>0) inc2+=s[i-1]-'0';
        if(n<5 || (n==5 && inc2<5))
        {
            ans+=n;
        }
        else
        {
            ans+=max(0,10-n);
            inc+=1;
        }
        
    }
    cout<<ans+inc<<endl;
    

    return 0;
}

Measured memory_bytes: 1412
#include<iostream>
using namespace std;
int gcd(int a, int b) {
   if (a%b == 0) {
       return(b);
   } else {
       return(gcd(b, a%b));
   }
}
int main() {
    int K; cin>>K;
    long long int cnt=0;
    for (int i=1; i<=K; i++)
        for (int j=1; j<=K; j++)
            for (int k=1; k<=K; k++)
                cnt += gcd(gcd(i,j),k);
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 3632
n=int(input())

ds=[i for i in range(n)]
def root(x):
  path_to_root = []
  while ds[x] != x:
    path_to_root.append(x)
    x = ds[x]
  for i in path_to_root:
    ds[i] = x
  return x
def same(x,y):
  return root(x) == root(y)
def unite(x,y):
  ds[root(x)] = root(y)

p=[] #[a,i,j]:i<j
for i in range(n):
  a=list(map(int,input().split()))
  for j in range(i+1,n):
    if a[j]!=-1: p.append([a[j],i,j])
p.sort(key=lambda x:x[0])
ans=0
for i in p:
  if same(i[1],i[2]): continue
  unite(i[1],i[2])
  ans+=i[0]
print(ans)


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


#define fir first
#define sec second
using namespace std;
using ll = long long;


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

    vector<vector<vector<ll>>> dp(n + 1,vector<vector<ll>>(n + 1, vector<ll>(3000)));
    dp[0][0][0] = 1;



    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            for(int k = 0; k <= 2600; k++){
                dp[i + 1][j][k] += dp[i][j][k];
                dp[i + 1][j + 1][k + a[i]] += dp[i][j][k];
            }
        }    
    }

    ll ans = 0;
    for(int i = 1; i <= n; i++){
        ans += dp[n][i][i * A];
    }
    cout << ans << endl;
}

Measured memory_bytes: 62592
#include<iostream>
#include<string>
using namespace std;
int main() {
	int n;
	int c0,c1, c2, c3;
	c0 = c1 = c2 = c3 = 0;
	cin >> n;
	for (int i = 0;i < n;i++) {
		string a;
		cin >> a;
		if (a == "AC")c0++;
		else if (a == "WA")c1++;
		else if (a == "TLE")c2++;
		else c3++;
	}
	cout << "AC x " << c0 << endl;
	cout << "WA x " << c1 << endl;
	cout << "TLE x " << c2 << endl;
	cout << "RE x " << c3 << endl;

	return 0;
}

Measured memory_bytes: 3604
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <vector>
#include <cstring>
#include <queue>
#include <map>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
const int INF = 1e6;
using namespace std;
const int dx[4] = {0,1,0,-1};
const int dy[4] = {1,0,-1,0};
template<class T> inline bool chmax(T &a,T& b){if(a < b){a = b; return true;} else return false;}
template<class T> inline bool chmin(T &a,T& b){if(a > b){a = b; return true;} else return false;}
int main(){
    int a,b,c;
    cin >> a >> b >> c;
    cout << (a < b && b < c ? "Yes" : "No") << endl;
}


Measured memory_bytes: 3088
#include<cstdio>
#include<iostream>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<map>
#include<algorithm>

using namespace std;

typedef struct {
    int x;
    int y;
    long long h;
} XYH;

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

    XYH xyh_ref;
    vector<XYH> xyh;
    for (int i = 0; i < N; i++) {
        int x, y;
        long long h;
        cin >> x >> y >> h;
        XYH xyh_i = {x, y, h};
        xyh.push_back(xyh_i);
        if (h > 0) {
            xyh_ref = xyh_i;
        }
    }

    int Cx, Cy;
    long long H;
    for (Cx = 0; Cx <= 100; Cx++) {
        for (Cy = 0; Cy <= 100; Cy++) {
            H = abs(xyh_ref.x - Cx) + abs(xyh_ref.y - Cy) + xyh_ref.h;
            bool flag = true;

            for (int i = 0; i < xyh.size(); i++) {
                long long h = max(H - abs(xyh[i].x - Cx) - abs(xyh[i].y - Cy), 0LL);
                
                if (h != xyh[i].h) {
                    flag = false;
                }
            }

            if (flag) {
                cout << Cx << " " << Cy << " " << H << endl;
            }
        }
    }


    return 0;
}


Measured memory_bytes: 256
X = int(input())
answer = (1001,1001)
for A in range(-1000, 1000):
    for B in range(-1000, 1000):
        if A ** 5 - B ** 5 == X:
            answer = (A, B)
            break
    if answer[0] != 1001:
        break
print(' '.join(map(str, answer)))

Measured memory_bytes: 9028
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <iomanip>
#include <algorithm>
#include <sstream>
#include <string>
#include <math.h>
#include <set>
#include <deque>
#include <queue>
#include <list>
using namespace std;
typedef long long ll;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    int i = 0;
  	while (i < n) {
    	string c;
    	cin >> c;
    	if(c == "W") {
    	  i++;
    	}
    	if(c == "P") { 
    	  i++;
    	}
    	if(c == "G") {
    	  i++;
    	}
    	if(c == "Y") {
    	  cout << "Four" << endl;
    	  break;
    	}
    	if(i == n - 1) {
    	  cout << "Three" << endl;
    	}
  	}
}


Measured memory_bytes: 3556
from operator import itemgetter

N, M = list(map(int, input().split()))
AB = [list(map(int, input().split())) for i in range(N)]
money = 0
AB = sorted(AB, key=itemgetter(0,1))

for a, b in AB:
    n = min(M, b)
    money += a * n
    M -= n
    if M <= 0:
        break
print(money)

Measured memory_bytes: 36136
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int n = stdIn.nextInt();
		int[][][] data = new int[4][3][10];

		for (int i = 0; i < n; i++) {
			int b = stdIn.nextInt();
			int f = stdIn.nextInt();
			int r = stdIn.nextInt();
			int v = stdIn.nextInt();

			data[b - 1][f - 1][r - 1] += v;

		}
		for (int i = 0; i < 4; i++) {
			for (int j = 0; j < 3; j++) {
				for (int k = 0; k < 10; k++) {
					System.out.print(" " + data[i][j][k]);
				}
				System.out.println();
			}
			if (i != 3) {
				System.out.println("####################");
			}
		}
	}
}



Measured memory_bytes: 29724
import java.util.*;
class Main{
    public static void main(String args[]){
	Scanner scan = new Scanner(System.in);
	int a,b;
	a=scan.nextInt();
	b=scan.nextInt();
	if(a>b)System.out.println("a > b");
	if(a<b)System.out.println("a < b");
	if(a==b)System.out.println("a == b");
    }
}

Measured memory_bytes: 26224
#include <bits/stdc++.h>
#define fst first
#define snd second
#define rep(n) for(lint I = 0; (I) < (lint)(n); ++(I))
#define repeat(i, n) for(lint i = 0; (i) < (lint)(n); ++(i))
#define repeat_to(i, n) for(lint i = 0; (i) <= (lint)(n); ++(i))
#define repeat_from(i, m, n) for(lint i = (m); (i) < (lint)(n); ++(i))
#define repeat_from_to(i, m, n) for(lint i = (m); (i) <= (lint)(n); ++(i))
#define repeat_reverse_from_to(i, m, n) for(lint i = (m); (i) >= (lint)(n); --(i))
#define el cout<<endl
#define dump(x) cout<<" "<<#x<<"="<<x
#define pdump(p) cout<<" "<<#p<<"=("<<p.fst<<","<<p.snd<<")"
#define vdump(v) for(size_t I=0; I<v.size(); ++I){cout<<" "<<#v<<"["<<I<<"]="<<v[I];} cout<<endl
using namespace std; using lint = long long; using ld = long double;
using pii = pair<int, int>; using pll = pair<lint, lint>;

// エラトステネスの篩[2,n]を列挙 O(nloglogn)
vector<lint> sieve_of_eratosthenes(lint n) {
    vector<bool> is_prime(n+1, true);
    is_prime[0] = is_prime[1] = false;
    for (lint i = 2; i*i <= n; ++i)
        if (is_prime[i])
            for (lint k = i+i; k <= n; k += i)
                is_prime[k] = false;
    vector<lint> primes;
    for (lint i = 2; i <= n; ++i)
        if (is_prime[i])
            primes.push_back(i);
    return primes;
}

// 素因数分解
map<lint,lint> factorization(lint n, vector<lint> const & primes) { 
    map<lint,lint> result;
    for (lint p : primes) {
        if (n < p * p) break;
        while (n % p == 0) {
            result[p] += 1;
            n /= p;
        }
    }
    if (n != 1) result[n] += 1;
    return result;
}

int main(void) {
    lint n; cin >> n;
    if (n < 10) {
        cout << 0 << endl;
        return 0;
    }
    
    auto primes = sieve_of_eratosthenes(100);
    
    map<lint, lint> mp;
    repeat_from_to (i, 2, n) {
        auto tmp = factorization(i, primes);
        for (auto e: tmp) {
            mp[e.fst] += e.snd;
        }
    }
    
    lint ans = 0;
    // 74 乗
    for (auto e: mp) {
        if (e.snd >= 74) {
            ++ans; //cout << "(" << e.fst << ")" << endl;
        }
    }
    
    // 24 乗と 2 乗
    for (auto e: mp) {
        for (auto f: mp) {
            if (e.fst != f.fst) {
                if (e.snd >= 24 and f.snd >= 2) {
                    ++ans; //cout << "(" << e.fst << "," << f.fst << ")" << endl;
                }
            }
        }
    }
    
    // 14 乗と 4 乗
    for (auto e: mp) {
        for (auto f: mp) {
            if (e.fst != f.fst) {
                if (e.snd >= 14 and f.snd >= 4) {
                    ++ans; //cout << "(" << e.fst << "," << f.fst << ")" << endl;
                }
            }
        }
    }
     
    // 4 乗と 4 乗 と 2 乗
    for (auto e: mp) {
        for (auto f: mp) {
            for (auto g: mp) {
                if (e.fst != f.fst and f.fst != g.fst and g.fst != e.fst and e.fst < f.fst) {
                    if (e.snd >= 4 and f.snd >= 4 and g.snd >= 2) {
                        ++ans; //cout << "(" << e.fst << "," << f.fst << "," << g.fst << ")" << endl;
                    }
                }
            }
        }
    }
    
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define pb push_back
typedef long long ll;
typedef unsigned long long ull;
const ll mod = 1e9 + 7;
const ll inf = 922337203685477;
const ll mininf = -922337203685477;
const ll nax = 0;

ll x;

int main(){
	ios_base::sync_with_stdio(0); cin.tie(); cout.tie();
	
	ll sum = 100;
	ll cnt = 0;
	cin >> x;
	while(sum < x){
		sum += sum / 100;
		cnt++;
	}
	cout << cnt << '\n';
}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define FORq(i, m, n) for(int i = m;i <= n;i++)
#define SCD(n) scanf("%d",&n)
#define SCD2(m,n) scanf("%d%d",&m,&n)
#define SCD3(m,n,k) scanf("%d%d%d",&m,&n,&k)
#define PB push_back
#define MP make_pair
#define ARSCD(A,N) REP(i,N){SCD(A[i]);}
#define ARSCD1(A,N) FORq(i,1,N){SCD(A[i]);}
#define PRINTD(n) printf("%d\n",n)
#define PRINTLLD(n) printf("%lld\n",n)
#define DEBUG printf("%s\n","debug")
#define fst first
#define snd second
using namespace std;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef long long ll;
//////////////////////////////////////////////////////
int main(){
	static char grid[52][52] = {};
	int dx[4] = {0,1,0,-1};
	int dy[4] = {1,0,-1,0};
	int H,W; SCD2(H,W);
	
	FORq(i,1,H){
		FORq(j,1,W){
			cin >> grid[i][j];
		}

	}
	
	bool ans = true;
	
	FORq(i,1,H){
		FORq(j,1,W){
			int adj = 2;
			if (grid[i][j] == '#'){
				adj = 0;
				REP(k,4){
					if (grid[i+dx[k]][j+dy[k]] == '#'){
						
						adj = 1;
					}
				}
			
			}
			
			
			if (adj == 0) ans = false;
		}
	}
	

	if (ans) printf("Yes");
	else printf("No");
	
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <cmath>
#include <iomanip>
#include <complex>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);++i)
#define rep(i,a,b) for(int i=a;i<(b);++i)
template<class T> inline bool chmin(T &a, T b){ if(a > b) { a = b; return true;} return false;}
template<class T> inline bool chmax(T &a, T b){ if(a < b) { a = b; return true;} return false;}
using ll = long long;
constexpr long long INF = 1LL << 62;
constexpr int MOD = 1e9 + 7;


int dp[101010];

int main() {
    cin.tie(0); ios_base::sync_with_stdio(false);
    int N,W,v,w,m; cin >> N >> W;

    for(int i=0; i < N;++i) {
        cin >> v >> w >> m;
        for(int a=0; a < w; ++a) {
            deque<int> deqi, deqv;
            for(int j=0; j * w + a <= W; ++j) {
                int val = dp[j * w + a] - j * v;
                while(deqv.size() && deqv.back() <= val) deqv.pop_back(), deqi.pop_back();
                deqi.push_back(j);
                deqv.push_back(val);

                dp[j * w + a] = deqv.front() + j * v;
                if(deqi.front() == j - m) {
                    deqi.pop_front();
                    deqv.pop_front();
                }
            }
        }
    }

    cout << dp[W] << endl;
    return 0;
}



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

int main(){
    int a, b, h, m;
    cin >> a >> b >> h >> m;

    double arc_a = 30*h + 0.5*m;
    double arc_b = 6*m;
    double x = 0;

    if(0 <= abs(arc_b - arc_a) && abs(arc_b - arc_a) <= 180){
        double rad;
        rad = M_PI*(arc_b - arc_a) / 180;
        x = pow(a, 2.0) + pow(b, 2.0) - 2*a*b*cos(rad);
        x = sqrt(x);
    }else{
        double rad;
        rad = M_PI*(360-abs(arc_b - arc_a)) / 180;
        x = pow(a, 2.0) + pow(b, 2.0) - 2*a*b*cos(rad);
        x = sqrt(x);
    }
 
   
  
    cout << fixed << setprecision(20) << x << endl;
    return 0;
}

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

#define F first
#define S second
#define PB push_back

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;
typedef priority_queue<int> HEAP;
typedef priority_queue<int, vector<int>, greater<int> > RHEAP;

const int N = 100010, M = 1010;

int n, m, k;
PII res[N];

int main()
{
	cin >> n >> k;
	
	int tot = (n - 2) * (n - 1) / 2;
	if (tot < k)
	{
		puts("-1");
		return 0;
	}
	
	for (int i = 2; i <= n; i ++ ) res[m ++ ] = {i, 1};
	for (int i = 2; i <= n; i ++ )
		for (int j = i + 1; j <= n && tot > k; j ++ , tot -- )
			res[m ++ ] = {i, j};
		
	cout << m << endl;
	for (int i = 0; i < m; i ++ )
		cout << res[i].F << ' ' << res[i].S << endl;
	return 0;
}

Measured memory_bytes: 384
//              +-- -- --++-- +-In the name of ALLAH-+ --++-- -- --+              \\

#include <bits/stdc++.h>

#define F first
#define S second
#define _sz(x) (int)x.size()
#define pb push_back

#define error(x) cout << #x << " = " << x << endl

using namespace std ;
using ll = long long ;
using ld = long double ;
using pii = pair <int , int> ;

const int N = 1e5 + 20;
int n, l, t, x[N], w[N];
vector <int> vec;

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

	cin >> n >> l >> t;

	int val = 0;

	for (int i = 0; i < n; i++)
	{
		cin >> x[i] >> w[i];

		if (w[i] == 1)
		{
			vec.pb((x[i] + t) % l);
			
			if (t >= l - x[i]) val += (t - (l - x[i])) / l + 1;
		}
		else 
		{
			vec.pb(((x[i] - t) % l + l) % l);	
			
			if (t > x[i]) val -= (t - x[i] - 1) / l + 1;
		}
	}

	sort(vec.begin(), vec.end());

	val = (val % n + n) % n;

	for (int i = val; i < n; i++) cout << vec[i] << '\n';
	for (int i = 0; i < val; i++) cout << vec[i] << '\n';
}


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

#define FILE
#define fr first
#define se second

using namespace std;

const long long N = 2e5 + 7;
const long long inf = 1e9 + 7;
const long long mod = 1e9 + 7;

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

    string s;
    cin >> s;
    for(int i = 0; i < 3; i ++){
        if(s[i] == '7'){
            cout << "Yes\n";
            return 0;
        }
    }
    cout << "No\n";
}



Measured memory_bytes: 3612
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

void scan(T...)(ref T a) {
    string[] ss = readln.split;
    foreach (i, t; T) a[i] = ss[i].to!t;
}
T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

int calc(int a, int b) {
    if (a <= 5) return 0;
    if (6 <= a && a <= 12) return b / 2;
    return b;
}

void main() {
    int a, b; scan(a, b);
    writeln(calc(a, b));
}



Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
  int R, G, B;
  cin >> R >> G >> B;
  int RGB = R * 100 + G * 10 + B;
  if(RGB % 4 == 0){
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize(2)
#include<bits/stdc++.h>
#include<ext/rope>
using namespace std;
using namespace __gnu_cxx;
#define LL long long
const int MAXN = 500+50;
const int MAXM = 8*15+50;
const int MOD = 1e9+7;
const double PI = acos(-1);
inline char getc(){
    static char buf[1000000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,1000000,stdin),p1==p2)?EOF:*p1++;
}
inline int read(){
    int x=0,f=1; char ch=getc();
    while(!isdigit(ch)){ if(ch=='-') f=-1; ch=getc(); }
    while(isdigit(ch)) x=x*10+ch-48,ch=getc();
    return x*f;
}
int a[5];
signed main(){
#ifndef ONLINE_JUDGE
    //freopen("C:\\Users\\Administrator\\Desktop\\in.txt","r",stdin);
#endif // ONLINE_JUDGE
    a[1]=read(),a[2]=read(),a[3]=read();
    sort(a+1,a+3+1);
    if(a[1]==a[3] || (a[1]!=a[2] && a[2]!=a[3])) puts("No");
    else puts("Yes");
    return 0;
}


Measured memory_bytes: 256