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

int main()
{
    string S;
    while (cin >> S)
    {
        if (S == ".")
            return 0;
        int n = S.size();
        string T = "";
        int cnt = 0;
        for (int i = 0; i < n; i++)
        {
            if ('A' <= S[i] && S[i] <= 'Z')
            {
                if (cnt < 0)
                    cnt = (104 + cnt) % 26;
                S[i] = (S[i] - 'A' + cnt) % 26 + 'A';

                T += S[i];
                cnt = 0;
            }
            else if (S[i] == '+')
                cnt++;
            else if (S[i] == '-')
                cnt--;
            else if (S[i] == '?')
            {
                T += 'A';
                cnt = 0;
            }
            else
            {
                T += S[i];
                cnt = 0;
            }
        }
        n = T.size();
        stack<int> st;
        vector<pair<int, int>> v;
        for (int i = 0; i < n; i++)
        {
            if (T[i] == '[')
                st.push(i);
            else if (T[i] == ']')
            {
                v.push_back({st.top(), i});
                st.pop();
            }
        }
        for (auto p : v)
        {
            reverse(T.begin() + p.first + 1, T.begin() + p.second);
        }
        S = "";
        for (char c : T)
        {
            if (c == '[' || c == ']')
                continue;
            S += c;
        }
        cout << S << endl;
    }
}


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

int gcd(int a, int b, vector<vector<int>> &GCD){
  if(GCD.at(a).at(b)!=0) return GCD.at(a).at(b);
  if(a < b) return gcd(b, a, GCD);
  int r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  GCD.at(a).at(b) = b;
  return b;
}

int main() {
  int N;
  cin >> N;
  vector<vector<int>> GCD(N+1,vector<int>(N+1));
  int sum_1 = 0, sum_2 = 0, sum_3 = 0;
  rep(i, N){
    sum_1 += i+1;
  }
  int tmp = N-1;
  rep(i, N-1){
    rep(j, tmp){
      sum_2 += gcd(i+1,j+i+2,GCD)*6;
    }
    tmp--;
  }
  tmp = N-2;
  int tmp2;
  rep(i, N-2){
    tmp2 = tmp;
    rep(j, tmp){
      rep(k, tmp2){
        sum_3 += gcd(gcd(i+1,j+i+2,GCD),k+i+j+3,GCD)*6;
      }
      tmp2--;
    }
    tmp--;
  }
  cout << sum_1 + sum_2 + sum_3 << endl;
}


Measured memory_bytes: 3752
#include<cstdio>
#include<cmath>
#include<string>
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
#include<map>
#include<set>
#include<limits>
#include<bitset>
#include<array>
#include<numeric>
#include<iomanip>

using namespace std;
typedef long long int ll;

int n,a;
string s;

int main(){
    scanf("%d\n%d",&n,&a);
    cout<<(n%500<=a ? "Yes":"No")<<endl;
}

Measured memory_bytes: 764
#include <stdio.h>

int cnt[200005];

int main() {
    int n; scanf("%d", &n);
    for (int i = 1; i < n; i++) {
        int tt; scanf("%d", &tt);
        cnt[tt]++;
    }
    for (int i = 1; i <= n; i++)
        printf("%d\n", cnt[i]);
}

Measured memory_bytes: 2508
#include<bits/stdc++.h>
using namespace std;
int ws(long long x)
{
    int sum=0;
    while(x)
      sum+=x%10,x/=10;
    return sum;
}
unsigned long long sum;
long long n,a,b,l;
int main()
{
    cin>>n>>a>>b;
    for(int i=1;i<=n;i++)
    {
        l=ws(i);
        if(l>=a&&l<=b)sum+=i;
    }
    cout<<sum<<endl;
    return 0;
}

Measured memory_bytes: 256
//package atcoder.dpContest;

import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) {
//        try {
//            FastScanner in = new FastScanner(new FileInputStream("src/input.in"));
//            PrintWriter out = new PrintWriter(new FileOutputStream("src/output.out"));

        FastScanner in = new FastScanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        solve(1, in, out);

//        } catch (IOException e) {
//            e.printStackTrace();
//        }
    }

    private static void solve(int q, FastScanner in, PrintWriter out) {
        for (int qq = 0; qq < q; qq++) {
            int N = in.nextInt();
            double[] p = new double[N];
            for(int i = 0; i < N; i++) {
                p[i] = in.nextDouble();
            }

            double[][] dp = new double[N + 1][N + 1];   //dp[i][j]: the probability of getting j heads with i coins tossed
            dp[0][0] = 1.0;
            dp[0][1] = 0.0;

            for(int i = 1; i <= N; i++) {
                dp[i][0] = dp[i - 1][0] * (1 - p[i - 1]);
                for(int j = 1; j <= i; j++) {
                    dp[i][j] = dp[i - 1][j - 1] * p[i - 1] + dp[i - 1][j] * (1 - p[i - 1]);
                }
            }

            double ans = 0.0;

            for(int i =  (N - 1) / 2 + 1; i <= N; i++) {
                ans += dp[N][i];
            }
            out.println(ans);
        }
        out.close();
    }

    static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        FastScanner(InputStream stream) {
            try {
                br = new BufferedReader(new InputStreamReader(stream));
            } catch (Exception e) {
                e.printStackTrace();
            }
        }

        String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}




Measured memory_bytes: 130516
//#define LOCAL_DEBUG

#include <fstream>
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;


int main() {
#ifdef LOCAL_DEBUG
	freopen("input.txt","r", stdin);
#endif

	string s; cin >> s;
	int a, z;
	for (int i = 0; i < s.length(); i++)
		if (s[i] == 'A') {
			a = i;
			break;
		}
	for (int i = s.length() - 1; i >= 0; i--)
		if (s[i] == 'Z') {
			z = i;
			break;
		}

	cout << (z - a + 1) << endl;
	return 0;
}


Measured memory_bytes: 640
import bisect
n = int(input().strip())
S = list(input().strip())
L=[[] for _ in range(26)]
for i,s in enumerate(S):
    L[ord(s)-ord("a")].append(i)

q = int(input().strip())
for _ in range(q):
    query=input().strip().split()
    if query[0]=="1":
        i=int(query[1])
        i-=1
        c=query[2]
        if S[i]!=c:
            delInd=bisect.bisect_left(L[ord(S[i])-ord("a")],i)
            del L[ord(S[i])-ord("a")][delInd]
            bisect.insort(L[ord(c)-ord("a")], i)
            S[i]=c
    else:
        l,r=map(int,[query[1],query[2]])
        l-=1; r-=1
        ans=0
        for j in range(26):
            ind=bisect.bisect_left(L[j],l)
            if ind<len(L[j]) and L[j][ind]<=r:
                ans+=1
        print(ans)

Measured memory_bytes: 28808
N = int(input())
judge = ['AC', 'WA', 'TLE', 'RE']
C = [[], [], [], []]
for i in range(N):
  S = str(input())
  j = judge.index(S)
  C[j].append(i)

Cn = [len(j) for j in C]
for i in range(4):
  print(judge[i], 'x', Cn[i])

Measured memory_bytes: 12916
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<map>
#include<cmath>
#define N 1009
using namespace std;
const int INF = 0x3f3f3f3f;
typedef unsigned long long LL;
const int mod = 1e9 + 7;

int main()
{
    LL ans = 1;
    int n;
    scanf("%d", &n);
    for(LL i = 1; i <= n; i++) ans = (ans % mod) * (i % mod) % mod;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>
#include <cmath>
#include <vector>
#include <queue>
typedef long long ll;
using namespace std;

int main(void){
  int n,i,t;
  pair<int,int> student[100000];//time,ID
  cin>>n;
  for(i=0;i<n;i++){
    cin>>t;
    student[i]={t,i+1};
  }
  sort(student,student+n);

  for(i=0;i<n;i++){
    cout<<student[i].second<<" ";
  }

  return 0;
}


Measured memory_bytes: 1536
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
#include <array>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <queue>
#include <bitset>
#include <tuple>
#include <cmath>
#include <complex>
#include <algorithm>
#include <utility>
#include <regex>
#include <cstdint>
#include <numeric>
#include <functional>
#include <cassert>

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

constexpr ll INF = 1'000'000'000'000'000'000;
namespace utils{
#define ALL(x) begin(x), end(x)
#define rALL(x) rbegin(x), rend(x)
    template<class T, class Compare> using p_queue = priority_queue<T, vector<T>, Compare>;
    template<class T> using min_queue = p_queue<T, greater<T>>;
    template<class T> using max_queue = p_queue<T, less<T>>;

    template<class T> bool min_update(T& X, const T& A){ if(X > A) {X = A; return true;} return false; }
    template<class T> bool max_update(T& X, const T& A){ if(X < A) {X = A; return true;} return false; }
    using V_Set = unordered_set<int>;
    using E_Set = unordered_map<int, V_Set>;

    ll operator"" _64(unsigned long long x){ return ll(x); }
    ull operator"" _64u(unsigned long long x){ return ull(x); }

    template<class T>
    vector<T> make_vector(int n, T t){
        return vector<T>(n, t);
    }
    template<class ...Ts>
    auto make_vector(int n, Ts ... ts){
        return vector<decltype(make_vector(ts...))>(n, make_vector(ts...));
    }

    template<class T>
    ostream& operator<<(ostream& os, const vector<T>& v){
        for (auto &&x : v) { os << x << ' '; } cout << endl; return os ;
    }
}
using namespace utils;

class solver{
    istream& is;
    ostream& os;

public:
    solver(istream& I, ostream& O) :is(I), os(O) {}
    void run(){
        ll N;
        is >> N;
        if(!is) return;
        ll sum = 0;
        vector<int> A(N);
        for (auto &&a : A) {
            is >> a; a--;
        } // end a
        vector<int> B(N);
        for (auto &&b : B) {
            is >> b;
        } // end b
        vector<int> C(N-1);
        for (auto &&c : C) {
            is >> c;
        } // end c
        int last = -2;
        for (int i = 0; i < N; ++i) {
            int eat = A[i];
            sum += B[eat];
            sum += (last +1 == eat) ? C[last] : 0;
            last = eat;
        } // end i
        os << sum  << endl;

    }
};

int main(int argc, char *argv[]) {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << setprecision(16) << scientific;
#ifdef DEBUG
    string test_cases = "test_B.txt";
    cerr << test_cases << " -->" << endl;
    auto fs = fstream(test_cases, fstream::in);
    int loop = 0;
    while(fs) {
        loop++;
        cout << '#' << loop << "#------\n";
        solver(fs, cout).run();
    }
    if(loop <= 1) {
        cout << "===" << endl;
        while(cin) solver(cin, cout).run();
    }
#else
    solver(cin, cout).run();
#endif
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main()
{
	string a,b,c,d;
	int e,f;
	cin>>a;
	e=a.size() ;
	b=a.substr(0,1);
	c=a.substr(1,e-2);
	d=a.substr(e-1,1); 
	f=c.size();  
	cout<<b<<f<<d<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <stdlib.h>
#include <string.h>
#include <queue>
#define rep(i,n) for(int i = 0; i < n; ++i)
#define rrep(i,n) for(int i = 1; i <= n; ++i)
using namespace std;
typedef pair<int,int> P;
const int INF = 1000000000;

int f(int x,int y,int s,int t){
	int X,Y,asd;
	X = s-x;
	Y = t-y;
	if(X*Y>=0){
		X = abs(X);
		Y = abs(Y);
		asd = min(X,Y);
		return X + Y - asd;
	}
	if(X*Y<0){
		X = abs(X);
		Y = abs(Y);
		return X + Y;
	}
}

int main(){
	int w,h,n,a=0,x0,y0,x,y;
	scanf("%d%d%d",&w,&h,&n);
	scanf("%d%d",&x0,&y0);
	rep(i,n-1){
		scanf("%d%d",&x,&y);
		a+=f(x0,y0,x,y);
		x0=x,y0=y;
	}
	
	printf("%d\n",a);
	
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
using namespace std;
int main() {
    int n;
    string s;
    vector<string> ss;
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> s;
        ss.push_back(s);
    }
    sort(ss.begin(), ss.end());
    ss.erase(unique(ss.begin(), ss.end()), ss.end());
    cout << ss.size() << endl;
}


Measured memory_bytes: 11632
#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/stack:16777216")
#include <string>
#include <vector>
#include <map>
#include <list>
#include <iterator>
#include <set>
#include <queue>
#include <iostream>
#include <sstream>
#include <stack>
#include <deque>
#include <cmath>  
#include <memory.h>
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <algorithm>
#include <utility>
#include <time.h>
#include <bitset>
using namespace std;

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define RFOR(i, b, a) for(int i = (b) - 1; i >= (a); --i)
#define ITER(it, a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(A,value) memset(A,value,sizeof(A))

#define ALL(V) V.begin(), V.end()
#define SZ(V) (int)V.size()
#define PB push_back
#define MP make_pair
const double PI=acos(-1.0);

typedef long long Int;
typedef long long LL;
typedef unsigned long long UINT;
typedef vector <int> VI;
typedef pair <int, int> PII;
typedef pair <double, double> PDD;

const int INF = 1000 * 1000 * 1000 + 7;
const LL LINF = INF * (LL) INF;

const int MAX = 500000;
const int MAX2 = 20007;
const int IT = 18;
const int BASE = 1000000000;
const int CNT = 300;
const int MOD = 1000000007;

int n, a, b, c, d;
char S[MAX];

bool check(int l, int r)
{
  for (int i = l; i+1 <= r; ++i)
  {
    if (S[i] == '#' && S[i+1] == '#') return 0;
  }

  return 1;
}

bool check3(int l, int r)
{
  for (int i = l-1; i+2 <= r+1; ++i)
  {
    if (i >= 0 && i+2 < n && S[i] == '.' && S[i+1] == '.' && S[i+2] == '.') return 1;
  }

  return 0;
}

int main()
{
    //freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);


    cin >> n >> a >> b >> c >> d;
    -- a;
    -- b;
    -- c;
    -- d;

    scanf("%s", S);

    bool res = check(a, b) && check(c, d);

    if (c > d)
    {
      if (!check3(b, d))
        res = 0;
    }

    cout << (res ? "Yes" : "No") << endl;

 
    return 0;
}



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

int main()
{
    int k, a, b;
    cin >> k;
    cin >> a >> b;
    
    int adiv, amod, bdiv, bmod;
    adiv = a / k;
    amod = a % k;
    bdiv = b / k;
    bmod = b % k;
    if (bdiv-adiv>0) {
        cout << "OK" << endl;
    } else if (amod == 0) {
        cout << "OK" << endl;
    } else if (bmod == 0) {
        cout << "OK" << endl;
    } else {
        cout << "NG" << endl;
    }

    return 0;
}

Measured memory_bytes: 3632
#include <iostream>

int main(int argc, char const *argv[]) {
  int a=0,b=0;
  std::cin >> a >> b;

  if(a < b){
    std::cout << "a < b" << std::endl;
  }else if(a > b){
    std::cout << "a > b" << std::endl;
  }else{
    std::cout << "a == b" << std::endl;
  }
  return 0;
}

Measured memory_bytes: 3096
<?php
list($n, $m) = explode(" ", trim(fgets(STDIN)));

for($i = 0 ; $i < $m; $i++){
    $link[] = explode(" ", trim(fgets(STDIN)));
}

$count = 0;
for($i = 0 ; $i < $m; $i++){
    $uft = new UFT($n);
    for($j = 0 ; $j < $m; $j++){
        if($i != $j){
            $uft->unite($link[$j][0], $link[$j][1]);
        }
    }
    if($uft->getRoot($link[$i][0]) <> $uft->getRoot($link[$i][1])){
        $count++;
    }
}
echo $count;

class UFT{
    public $parent;
    public $size;
    public $rank;
    public function __construct($size){
        for($i = 1; $i <= $size; $i++){
            $this->size[$i] = 1;
            $this->rank[$i] = 1;
            $this->parent[$i] = 0;
        }
    }
    public function dump(){
        o("--------------");
        o($this->parent);
        o($this->size);
        o($this->rank);
    }
    public function getRoot($i){
        if($this->parent[$i] == 0){
            return $i;
        }else{
            return $this->getRoot($this->parent[$i]);
        }
    }
    public function unite($i, $j){
        $rootI = $this->getRoot($j);
        $rootJ = $this->getRoot($i);
        if($rootJ == $rootI)return false;//元から同じグループ
        if($this->rank[$rootI] > $this->rank[$rootJ])list($rootI, $rootJ) = [$rootJ, $rootI];//Rank(J)>Rank(I)に揃えておく
        $this->parent[$rootI] = $rootJ;
        if($this->rank[$rootI] == $this->rank[$rootJ]){
            $this->rank[$rootJ]++;
        }
        $this->size[$rootJ]+=$this->size[$rootI];
        $this->size[$rootI] = '*';//不要な情報となるので潰す/デバッグ出力向けに*を入れている
        $this->rank[$rootI] = '*';//同上
    }
    public function size($i){return $this->size[$this->getRoot($i)];}
    public function isUnion($i, $j){return $this->getRoot($i) == $this->getRoot($j);}
}

Measured memory_bytes: 4984
#[allow(unused_imports)]
use std::cmp::{max, min};

#[allow(unused_imports)]
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::{Bytes, Chars};

#[allow(non_snake_case)]
#[allow(unused)]
fn main() {
    input! {
        N:usize,
        mut L:[i32;N],
    }

    L.sort_unstable();
    let mut ans = 0;
    for i in 0..N {
        for j in i + 1..N {
            for k in j + 1..N {
                ans += if L[i] + L[j] > L[k] && L[i] != L[j] && L[j] != L[k] {
                    1
                } else {
                    0
                };
            }
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 2164
#include <iostream>
using namespace std;
 
typedef long long ll;
 
int main() {
    string s; cin >> s;
    int n = s.size();
    int nn = n-1;
 
    ll ans = 0;
    for(int mask=0; mask<(1<<nn); mask++) {
        ll sum=0, cur=0;
        for(int i=0; i<n; i++) {
            if(mask & (1<<(i-1))) {
                sum += cur;
                cur = 0;
            }
            cur = cur*10 + (s[i] - '0');
        }
        sum += cur;
        ans += sum;
    }
    
    cout << ans << "\n";
 
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ll h,w;
    cin>>h>>w;
    ll r=h*w;
    if(w==1||h==1)
        cout<<1;
    else if(r%2==0)
        cout<<r/2;
    else
        cout<<r/2+1;
    return 0;
}


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

int main(){
	int n, x;
  	cin >> n >> x;
  	vector<int> in(n);
  	for(int i = 0;i < n;i++)cin >> in[i];
  	sort(begin(in), end(in));
	int ans = 0;
	for(int i = 0;i < n;i++){
    	if (x >= in[i]){
			ans++;
          	x -= in[i];
        }
    }
  	if (x != 0 && ans == n)ans--;
	cout << ans << endl;  
  
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
char a,b,c,d;
cin>>a>>b>>c>>d;
int A[128];
A[0]=a-'0';
A[1]=b-'0';
A[2]=c-'0';
A[3]=d-'0';
//cout<<A[0]<<A[1]<<A[2]<<A[3]<<endl;
for(int a=0;a<2;a++)
{
    for(int b=0;b<2;b++)
    {
        for(int c=0;c<2;c++)
        {
            int res= A[0];
            if(a==0)
                res+=A[1];
            else
                res+=-A[1];

            if(b==0)
                res+=A[2];
            else
                res+=-A[2];

            if(c==0)
                res+=A[3];
            else
                res+=-A[3];

            if(res==7)
            {
                cout<<A[0];
                if(a==0) cout<<"+";
                else cout<<"-";
                cout<<A[1];
                if(b==0) cout<<"+";
                else cout<<"-";
                cout<<A[2];
                if(c==0) cout<<"+";
                else cout<<"-";
                cout<<A[3]<<"=7\n";
                return 0;
            }
        }
    }
}

return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define USE_LLONG_AS_INT
#ifdef USE_LLONG_AS_INT
#define int long long
#define inf (1ll<<60)
#else
#define inf (1<<30)
#endif
#define rep(i,n) for(int i=0;i<(n);i++)
#define Rep(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a,b) for(int i=(a);i<=(b);i++)
#define rev(i,n) for(int i=(n)-1;i>=0;i--)
#define vi vector<int>
#define vvi vector<vi>
#define vs vector<string>
#define pb push_back
#define eb emplace_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define Yes(f) cout<<(f?"Yes":"No")<<endl
#define yes(f) cout<<(f?"yes":"no")<<endl
#define YES(f) cout<<(f?"YES":"NO")<<endl
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())

using namespace std;

const int mod=1e9+7;
// const int mod=998244353;
const string sp=" ";

void run();

void init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(12);
}

signed main(){
    init();
    run();
    return 0;
}

void run(){
    int n,m;
    cin>>n>>m;
    cout<<n*(n-1)/2+m*(m-1)/2<<endl;
}

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

int main()
{
	int64_t x;
	cin >> x;

	int64_t y=0;
	int64_t current=100;
	while (current<x)
	{
		current+=(current/100);
		++y;
	}
	cout << y << endl;
}






Measured memory_bytes: 3636
from functools import lru_cache
from collections import Counter

N = int(input())

@lru_cache()
def factor(n):
    fact = []
    i = 2
    while n >= i * i:
        while n%i == 0:
            fact.append(i)
            n //= i
        i += 1
    if n > 1:
        fact.append(n)
    
    return fact

fact = []
for i in range(2,N+1):
    fact.extend(factor(i))


cf = Counter(fact)

ans = 1
for f,n in cf.items():
    ans = ans *(n+1) % (10**9+7)

print(ans)


Measured memory_bytes: 9604
#include<bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (int)n; i++)
#define REPvec(itr, mp) for(auto itr = mp.begin();itr != mp.end(); itr ++)
#define all(x) x.begin(), x.end()
#define MOD 1000000007//1e9+7
using namespace std;
typedef long long ll;
typedef vector<int >    vecint;
typedef vector<string > vecstr;
int main()
{
  int n;
  cin >> n;
  map<string, int> mp;
  string tmp;
  REP(i,n){
    cin >> tmp;
    mp[tmp] ++;
  }
  auto itr = mp.end(); itr--;
  int m = 0;
  vecstr ans;
  REPvec(itr2, mp){
    m = max(m, itr2->second);
  }
  REPvec(itr2, mp){
    if(itr2->second == m){
      cout << itr2->first << endl;
    }
  }
}


Measured memory_bytes: 25216
#include <iostream>

using namespace std;

int main() {
    int N;
    cin >> N;
    int cnt = 0;;
    for(int i = 1; i <= N; i++) {
        if(i % 2 == 1) {
            int w = 0;
            for(int j = 1; j <= N; j++) {
                if(i % j == 0) ++w;
            }
            if(w == 8) cnt++;
        }
    }
    cout << cnt << endl;
}


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

int main(){
    long long ans(0),x;

    cin >> x;

    ans = ans + x/500*1000;
    x -= x/500*500;
    ans += x/5*5;

    cout << ans << endl;

    return 0;
}   

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
using ll = long long; using ld = long double; const char nl = '\n';
/* -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- */

#include <bits/extc++.h>
namespace pbds =  __gnu_pbds;
template <typename key, typename val=pbds::null_type, typename comp=less<key>>
using ostree=pbds::tree<key,val,comp,pbds::rb_tree_tag,pbds::tree_order_statistics_node_update>;
using vi = vector< int >; using vll = vector< ll >;
#define all(x) std::begin(x), std::end(x)
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename...Args, template<typename...> typename T> string to_string(T<Args...> const&);
string to_string(string const&s){return '"'+s+'"';}
string to_string(char const &c) {return to_string(string(1,c));}
string to_string(char const *c) {return to_string(string(c));}
string to_string(bool const &b) {return (b ? "1" : "0");}
template<typename... Args> string to_string(pair<Args...> const&p)
{return "("+to_string(p.first)+", "+to_string(p.second)+")";}
template <typename...Args, template<typename...> typename T> string to_string(T<Args...> const&S)
{string s = "{"; for(auto const& e: S)s+=" "+to_string(e);s+=" }"; return s;}
template<typename Tail> void debug_out(Tail t) {cerr<<" "<<to_string(t)<<" ]"<<endl;}
template<typename Head, typename... Tail> void debug_out(Head h, Tail... t)
{cerr << " " << to_string(h) << ","; debug_out(t...);}
#define pr(...) cerr<<"["<<(#__VA_ARGS__)<<"] : [", debug_out(__VA_ARGS__)
template <typename T> void dbr(T lb, T ub)
{cerr<<'{'; for(auto it=lb; it!=ub; it++) cerr<<' '<<to_string(*it); cerr<<" }"<<endl;}
template<typename T, typename Comp=less<T>> bool smin(T &mem, T const&v, Comp const&cmp=Comp())
{return cmp(v, mem) ? mem = v, true : false;}
template<typename T, typename Comp=less<T>> bool smax(T &mem, T const&v, Comp const&cmp=Comp())
{return cmp(mem, v) ? mem = v, true : false;}
/* -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- */



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

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

  int L = 0;
  for(int i=0; i<n; i++) {
    int lo = 0, hi = L+1;
    while( lo < hi ) {
      int mid = (lo+hi)>>1;
      if( a[i] < lis[mid] ) hi = mid;
      else lo = mid + 1;
    }
    lis[lo] = a[i];
    smax(L, lo);
  }

  cout << L << endl;

}
/* -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- */


Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
#include<list>
#include<set>
using namespace std;
int mod = 1e9 + 7;
template <class T>
void inputV(vector<T> &x, int n){
  for(int i=0; i<n; i++) cin >> x[i];
}

int func(string s, char c) {
  int cnt = 0;
  while(true){
    int n = s.size();
    if( s == string(n, s[0]) ) return cnt;

    string t;
    for(int i=0; i<n-1; i++){
      if( s[i] == c || s[i+1] == c ) t += c;
      else t += s[i];
    }
    cerr << s << " " << t << endl;
    s = t;
    cnt++;
  }
  return cnt;
}

int main() {
  string s;
  cin >> s;
  int n = s.size();
  int ans = 1e9;
  for(int i=0; i<n; i++){
    ans = min(ans, func(s, s[i]));
    cerr << func(s, s[i]) << endl;
  }
  cout << ans << endl;
  return 0;
}




//


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * Built using CHelper plug-in Actual solution is at the top
 */

public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		Task solver = new Task();
		solver.solve(1, in, out);
		out.close();
	}

	static class Task {
		public void solve(int testNumber, InputReader in, PrintWriter out) {
			int N = in.nextInt();
			String[] s = new String[N];
			for(int i = 0; i < N; i++) {
				s[i] = in.next();	
			}
			int M = in.nextInt();
			String[] t = new String[M];
			for(int i = 0; i < M; i++) {
				t[i] = in.next();
			}
			int ans = 0;
			for(int i = 0; i < N; i++) {
				int count = 0;
				for(int j = 0; j < N; j++) {
					if(s[i].equals(s[j])) {
						count++;
					}
				}
				for(int j = 0; j < M; j++) {
					if(s[i].equals(t[j])) {
						count--;
					}
				}
				ans = Math.max(ans, count);
			}
			out.println(ans);
		}
	}

	static class InputReader {
		public BufferedReader reader;
		public StringTokenizer tokenizer;

		public InputReader(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream), 32768);
			tokenizer = null;
		}

		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}

	}
}


Measured memory_bytes: 23380
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i,n) for(int i=0;i<(n);++i)
#define ll long long
const long long INF = 1LL<<60;
const long long mod = 1e9 + 7;

int main(){
    int N;
    string S;
    cin >> N >> S;
    int ans = 0;
    for(int i = 0; i < N-2; ++i){
        if(S[i] == 'A'){
            if(S[i+1]=='B'){
                if(S[i+2]=='C') ans++;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3596
n = int(input())
t = list(map(int, input().split()))
v = list(map(int, input().split()))
runtime = sum(t)
speed = [0] * (runtime*2+1)
now_t, now_v = 0,0
for ti,vi in zip(t,v):
  for i in range(now_t*2+1,now_t*2+ti*2+1):
    next_v = min(now_v+0.5, vi)
    speed[i] = next_v
    now_v = next_v
  now_t += ti
speed[-1] = 0
now_t, now_v = runtime,0
for ti,vi in zip(t[::-1],v[::-1]):
  for i in range(now_t*2-1,now_t*2-ti*2-1,-1):
    next_v = min([now_v+0.5, speed[i],vi])
    speed[i] = next_v
    now_v = next_v
  now_t -= ti
ans = 0
for i in range(runtime*2):
  ans += speed[i]+speed[i+1]
ans /= 4
print(ans)

Measured memory_bytes: 3444
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <functional>
#include <utility>
using namespace std;

int main(){
  vector<long long> v(3, 0);
  cin >> v[0] >> v[1] >> v[2];
  int k;
  cin >> k;
  sort(v.begin(), v.end());
  v[2] = pow(2, k) * v[2];
  cout << v[0] + v[1] + v[2] << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define bug(x) cerr<<#x<<"="<<x<<endl;
#define el printf("\n");
const ll mod = 1e7;




inline ll nxt() {
	ll x;
	scanf("%lld\n",&x);
	return x;
}

ll nCr(ll n ,ll k){
    if( k==n || k==0 )return 1;
    return (nCr(n-1,k-1)%mod+nCr(n-1,k)%mod)%mod;
}

int main(){
    //ios_base::sync_with_stdio(0);
    int n;
    scanf("%d",&n);
    n++;
    printf("%d\n",n/2);


}


Measured memory_bytes: 256
n,w=map(int,input().split())


dp=[0]*(w+1)

for i in range(n):
    nextdp=[]
    x=[int(i) for i in input().split()]
    for j in range(w+1):
        if x[0] > j:
            nextdp.append(dp[j])
        else:
            nextdp.append(max(dp[j],dp[j-x[0]]+x[1]))
    dp=nextdp

print(max(dp))


Measured memory_bytes: 155196
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}

//二次元累積和を用いた解法
vector<vector<int>> sum;
int N,M,Q;

void buildSumTable(vector<int>L, vector<int> R){
  sum = vector<vector<int>>(N+1,vector<int>(N+1,0));
  for(int i = 0; i < M; i++){
    sum[L[i]][R[i]] ++;
  }
  for(int i = 1; i <= N ; i++){
    for(int j = 1; j <= N; j++){
      sum[i][j] += sum[i-1][j];
      sum[i][j] += sum[i][j-1];
      sum[i][j] -= sum[i-1][j-1];
    }
  }
}

int getSumLange(int L, int R){
  return sum[R][R] - sum[R][L-1] - sum[L-1][R] + sum[L-1][L-1];
}


int main(){

  cin >> N >> M >> Q;
  vector<int> L(M);
  vector<int> R(M);
  for(int i = 0; i < M; i++){
    scanf("%d %d",&L[i], &R[i]);
  }
  vector<int> p(Q);
  vector<int> q(Q);

  for(int i = 0; i < Q; i++){
    scanf("%d %d",&p[i], &q[i]);
  }
  buildSumTable(L,R);
  for(int i = 0; i < Q; i++){
    printf("%d\n",getSumLange(p[i],q[i]));
  }
  return 0;
}


Measured memory_bytes: 5120
#include <iostream>
#include <map>
#include <utility>

using namespace std;

int inf = 99999;

int vals[] = {10, 50, 100, 500};

int minuses[4];

void solve(int total, int n[4], int i, int uses[4], int* mincost) {
    if (i == 4) {
        int paysum = 0;
        int cost = 0;
        for (int j = 0; j < 4; ++j) {
            paysum += uses[j] * vals[j];
            cost -= uses[j];
        }
        int returns = paysum - total;
        if (returns < 0) return;

        for (int k = 3; k >= 0; --k) {
            int nret = returns / vals[k];
            returns %= vals[k];
            cost += nret;
        }

        if (cost < *mincost) {
            *mincost = cost;
            for (int k = 0; k < 4; ++k) {
                minuses[k] = uses[k];
            }
        }

        return;
    }

    for (int k = 0; k <= n[i]; ++k) {
        uses[i] = k;
        solve(total, n, i+1, uses, mincost);
    }
}

int main() {
    bool found = false;
    while (1) {
        int total;
        int n[4];

        cin >> total;
        if (total == 0) break;

        cin >> n[0] >> n[1] >> n[2] >> n[3];

        int uses[4] = {0,0,0,0};

        for (int i = 0; i < 4; ++i) {
            minuses[i] = 0;
        }
        int mincost = 9999;

        solve(total, n, 0, uses, &mincost);

        if (found) {
            cout << endl;
        }
        for (int i = 0; i < 4; ++i) {
            if (minuses[i]) {
                cout << vals[i] << " " << minuses[i] << endl;
            }
        }
        found = true;
    }
}

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

#define int long long

#define override_rep(i, l, r, mes, ...) mes
#define rep1(i, n) for (int i = 0; i < n; i++)
#define rep2(i, l, r) for (int i = l; i < r; i++)
#define rep(...) override_rep(__VA_ARGS__, rep2, rep1)(__VA_ARGS__)

using namespace std;
using P = pair<int, int>;
using ll=long long;

template<typename T, typename U>
istream& operator>>(istream& in, pair<T, U>& p) {
    in >> p.first >> p.second;
    return in;
}

// https://twitter.com/vane11ope ←フォローしましょう
// (ノ)>◡<(ヾ)ﾓﾁﾓﾁ
signed main(signed argc, char* argv[]) {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    const int MOD = 1e9+7;

    string s;
    cin>>s;
    cout<<s.substr(0,3)<<endl;
}

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

using namespace std;

#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define endl '\n'
#define f first
#define s second

typedef long long ll;

const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fll;

const int MAX = 2e5+10;

namespace seg {
	ll seg[4*MAX], lazy[4*MAX];
	int n;

	void build(int n2) {
		memset(seg,INF,sizeof seg);
		n = n2;
	}
	void prop(int p, int l, int r) {
		if (!lazy[p]) return;
		seg[2*p] += lazy[p];
		seg[2*p+1] += lazy[p];
		lazy[2*p] += lazy[p], lazy[2*p+1] += lazy[p];
		lazy[p] = 0;
	}
	ll query(int a, int b, int p=1, int l=0, int r=n-1) {
		if (b < l or r < a) return LINF;
		if (a <= l and r <= b) return seg[p];
		prop(p, l, r);
		int m = (l+r)/2;
		return min(query(a, b, 2*p, l, m), query(a, b, 2*p+1, m+1, r));
	}
	ll upd(int a, int b, ll x, int p=1, int l=0, int r=n-1) {
		if (b < l or r < a) return seg[p];
		if (a <= l and r <= b) {
			seg[p] += x;
			lazy[p] += x;
			return seg[p];
		}
		prop(p, l, r);
		int m = (l+r)/2;
		return seg[p] = min(upd(a, b, x, 2*p, l, m), upd(a, b, x, 2*p+1, m+1, r));
	}
};


ll memo[MAX], suf[MAX];

int main(){ _

	int n, m; cin >> n >> m;
	ll sum = 0;
	vector<vector<pair<int,int>>> inter(n);
	for(int i=0; i<m; i++) {
		int l, r, a; cin >> l >> r >> a; l--, r--;
		inter[r].push_back({l,a});
		sum += a;
		suf[l] += a;
	}
	
	for(int i=n-1; i>=0; i--) suf[i] += suf[i+1];

	seg::build(n);

	ll part = 0;
	for(int i=0; i<n; i++) {
		memo[i] = part;
		memo[i] = min(memo[i], seg::query(0,i-1));
		
		seg::upd(i,i,memo[i]-LINF);
		
		for(auto p : inter[i]) {
			seg::upd(0,p.f-1,p.s);
			part += p.s;
		}
	}

	ll ans = sum;
	for(int i=0; i<n; i++) ans = min(ans, memo[i] + suf[i+1]);
	ans = sum-ans;

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 27560
//Mahir Ratanpara (DA-IICT)
#include<bits/stdc++.h>
using namespace std;
#define Ff(i,a,n) for(i=a;i<n;i++)
#define Fr(i,a,n) for(i=a;i>n;i--)
#define ll long long
#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
typedef pair<ll, ll>	pa;
typedef vector<ll>		vc;
typedef vector<pa>		vp;
typedef vector<vc>		vvc;
int mpow(int base, int exp); 
void ipgraph(int m);
void dfs(int u, int par);
const int mod = 1000000007;
const int N = 3e5, M = N;
//=======================

vc g[N];
ll a[N];

int main() {
    FAST;
    ll t, i, j, k, p, q, r, x, y, u, v, n, m;
    cin>>k;
    ll ans=0;
    Ff(i,1,k+1)
    {
      Ff(j,1,k+1)
      {
        Ff(p,1,k+1)
        {
          ans+=__gcd(i,__gcd(j,p));
        }
      }
    }
    cout<<ans;
    return 0;
}

int mpow(int base, int exp) {
  base %= mod;
  int result = 1;
  while (exp > 0) {
    if (exp & 1) result = ((ll)result * base) % mod;
    base = ((ll)base * base) % mod;
    exp >>= 1;
  }
  return result;
}

void ipgraph(int n, int m){
	int i, u, v;
	while(m--){
		cin>>u>>v;
		g[u-1].pb(v-1);
		g[v-1].pb(u-1);
	}
}

void dfs(int u, int par){
	for(int v:g[u]){
		if (v == par) continue;
		dfs(v, u);
	}
}

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


def solve(N: int, a: "List[int]"):
    alice = 0
    bob = 0
    loop = 0
    while(a):
        loop = loop + 1
        get = max(a)
        a.remove(get)
        if loop % 2:
            alice = alice + get
        else:
            bob = bob + get
    return(alice - bob)


# Generated by 1.1.7.1 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]"
    print(solve(N, a))

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   for(int i=0;i<(n);++i)
#define SORT(c)    sort((c).begin(),(c).end())
#define CLR(a)     memset((&a), 0 ,sizeof(a))//clear memory
#define dump(x)    cerr << #x << " = " << (x) << endl;//debug
#define debug(x)   cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define EPS        1e-10//sample:if((double)>=(double)+EPS)
//cin,cout release
//std::cin.tie(0);
//ios::sync_with_stdio(false);

using namespace std;
#define MAX 100000


int main(){
  int n,A[MAX]={};
  cin>>n;
  for(int i=1;i<=n;i++)cin>>A[i];
  for(int i=1;i<=n;i++){
    cout<<"node "<<i<<": key = "<<A[i];
    if(i/2>=1)cout<<", parent key = "<<A[i/2];
    if(2*i<=n)cout<<", left key = "<<A[2*i];
    if(2*i+1<=n)cout<<", right key = "<<A[2*i+1];
    cout<<", "<<endl;
  }
  return 0;
}


Measured memory_bytes: 3516
###
### atcorder test program
###

### math class
class math:
    ### GCD
    def gcd(self, a, b):
        if b == 0:
            return a
        return self.gcd(b, a%b)

### input num
i = input()
A, B = [int(x) for x in i.split()]
#N = int(input())
#A = [int(x) for x in input().split()]

print("{0} {1} {2:.5f}".format(A//B, A%B, A/B))




Measured memory_bytes: 5620
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int N;
    int i;

    cin >> N;
    vector<int>A(N);

    for (i = 0; i < N; i++){
      cin >> A.at(i);
    }

    sort(A.begin(), A.end());
 
    for (i = 0; i < N - 1; i++){
      if (A.at(i) == A.at(i + 1)){
         cout << "NO" << endl;
         return 0;
      }
    }
    cout << "YES" << endl;
}

Measured memory_bytes: 1024
// https://www.geeksforgeeks.org/sum-xor-pairs-array/
// An efficient C++ program to compute 
// sum of bitwise OR of all pairs 
#include <bits/stdc++.h> 


using namespace std; 

#define int long long
const int mod = 1e9 + 7;

// Returns sum of bitwise OR 
// of all pairs 
int sumXOR(int arr[], int n) 
{ 
   int sum = 0; 
   for (int i = 0; i < 61; i++) 
   { 
      // Count of zeros and ones 
      int zc = 0, oc = 0; 
      
      // Individual sum at each bit position 
      int idsum = 0; 
      for (int j = 0; j < n; j++) 
      { 
         if (arr[j] % 2 == 0) 
            zc++; 
         else
            oc++; 
         arr[j] /= 2; 
      } 
      
      // calculating individual bit sum 
      idsum = ((oc * zc % mod) * ((1LL << i) % mod)) % mod; 

      // final sum    
      sum += idsum; 
      sum %= mod;
   } 
   return sum; 
} 

int32_t main() 
{ 

   int n;
   cin >> n;

   int arr[n];

   int sum = 0; 
   for (int i = 0; i < n; ++i)
   {
      cin >> arr[i];
   }

   sum = sumXOR(arr, n); 
   cout << sum; 
   return 0; 
} 


Measured memory_bytes: 2560
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <array>
using namespace std;
typedef long long unsigned int llui_t;
typedef long long int lli_t;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

/* inputs */
llui_t N;
vector<llui_t> C, S, F;

llui_t solve(llui_t n, llui_t t) {
    if (n == N-1) {
        return t;
    } else {
        llui_t tt;
        if (t <= S[n]) {
            tt = S[n] + C[n];
        } else {
            tt = (t / F[n] + (t % F[n] == 0 ? 0 : 1)) * F[n] + C[n];
        }
        return solve(n+1, tt);
    }
}


int main() {
    cin >> N;

	for(llui_t i=0; i<N-1; i++) {
		llui_t c, s, f;
		cin >> c >> s >> f;
		C.push_back(c);
        S.push_back(s);
        F.push_back(f);
	}

	for(llui_t i=0; i<N; i++) {
        cout << solve(i, 0) << endl;
	}
}


Measured memory_bytes: 512
/* ＵＴＦ－８ */
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <array>
#include <queue>
#include <stack>
#include <algorithm>
#include <tuple>
#include <numeric>
#include <type_traits>
#include <limits>

#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>

#define USE_COLORED 1

#ifdef USE_COLORED
static const char stdout_pre[]  = "\033[1m"; // bold black
static const char stderr_pre[]  = "\033[31;1m"; // bold red
static const char stdxxx_post[] = "\033[m";

// 当然ながら GCC(g++)/libstdc++ 依存
#include <ext/stdio_filebuf.h>
using stdio_filebuf = __gnu_cxx::stdio_filebuf<char>;
class colored_stdio_filebuf : public stdio_filebuf {
private:
	const char* const pre_;
	const char* const post_;

public:
	colored_stdio_filebuf(FILE* fp, const char* pre, const char* post) : stdio_filebuf(fp, std::ios_base::out), pre_(pre), post_(post)
	{
	}

protected:
	std::streamsize xsputn(const char* s, std::streamsize count) override
	{
		stdio_filebuf::xsputn(pre_, strlen(pre_));
		auto ret = stdio_filebuf::xsputn(s, count);
		stdio_filebuf::xsputn(post_, strlen(post_));
		return ret;
	}
};
#endif

int main()
{
#ifdef USE_COLORED
	if (getenv("DEBUG")) {
		std::cout.rdbuf(new colored_stdio_filebuf(stdout, stdout_pre, stdxxx_post));
		std::cerr.rdbuf(new colored_stdio_filebuf(stderr, stderr_pre, stdxxx_post));
	} else
#endif
	{
		int fd = open("/dev/null", O_WRONLY);
		dup2(fd, 2);
		close(fd);
	}
	
	int N;
	std::string S, T;
	std::cin >> N >> S >> T;
	
	std::string result;
	for (int i = 0; i < N; ++i) {
		result += S[i];
		result += T[i];
	}
	std::cout << result << "\n";
}


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

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

int main(int argc, const char * argv[]) {
    
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n;
    cin >> n;
    
    vector<double> a(n);
    
    double divisor=0;
    rep(i, n)
    {
        cin >>a[i];
        divisor += 1/a[i];
    }
    
    cout << 1/divisor << endl;
    
    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <stdlib.h>

int main(){
  int x, y;
  std::cin >> x;
  std::cin >> y;
  
  int s = x * y;
  int l = 2 * x + 2 * y;
  std::cout << s << " " << l << std::endl;
  
  return 0;
}

Measured memory_bytes: 3056
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    set<int> s;
    int n;
    cin>>n;
    char c;
    for(int i=0;i<n;i++){
    	cin>>c;
    	s.insert(c-'A');
    }
    if(s.size()==4){
    	cout << "Four"<<endl;
    }else{
    	cout <<"Three" <<endl;
    }
    return 0;
}


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

int main(){
	int H,W;
	cin >> H >> W;

	vector< vector< char >  > A = vector< vector< char >  >(H, vector< char >(W) );
	
	for(int i = 0; i < H; i++)
	{
		
		for(int j = 0; j < W; j++)
		{
			cin >> A[i][j];
		}
		
	}

	
	vector<int> kaigyou(H);
	for(int i = 0; i < H; i++)
	{
		
		bool flag = false;
		for(int j = 0; j < W; j++)
		{
			if(A[i][j] == '#'){
				flag = true;
			}
		}

		if(flag==false){
			kaigyou[i] = 0;
			for(int j = 0; j < W; j++)
			{
				A[i][j] = '*';
			}
		}else{
			kaigyou[i] = 1;
		}
	}
	
	for(int i = 0; i < W; i++)
	{
		
		bool flag = false;
		for(int j = 0; j < H; j++)
		{
			if(A[j][i] == '#'){
				flag = true;
			}
		}

		if(flag==false){
			for(int j = 0; j < H; j++)
			{
				A[j][i] = '*';
			}
		}
	}

	
	for(int i = 0; i < H; i++)
	{

		for(int j = 0; j < W; j++)
		{
			if(A[i][j] != '*'){
				cout << A[i][j];
			}
		}
		if(kaigyou[i]==1){
			cout << endl;
		}
		
	}
	

	return 0;

}



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

/* 大文字を小文字に変換 */
char tolowr(char c) {
  if ((c >= 'A') && (c <= 'Z')) {
    return (c + 0x20);
  } else {
    return (0);
  }
}

/* 小文字を大文字に変換 */
char toupr(char c) {
  if ((c >= 'a') && (c <= 'z')) {
    return (c - 0x20);
  } else {
    return (0);
  }
}

int main(){
  int i=0;
  char str[1200];

  fgets(str, sizeof str, stdin);
  
  for(i=0 ; i<=strlen(str) ; ++i){
    if ((str[i] >= 'A') && (str[i] <= 'Z'))      str[i] = tolowr(str[i]);
    else if ((str[i] >= 'a') && (str[i] <= 'z')) str[i] = toupr(str[i]);
  }

  printf("%s",str);
  
  return 0;
}



Measured memory_bytes: 2680
N = int(input())
*A, = map(int, input().split())
c = 1000
i = 0

while i < N:
    # 単調減少
    while i < (N-1) and A[i] > A[i+1]:
        i += 1
    if i == (N-1):
        break
    s = i
    # 単調増加
    while i < (N-1) and A[i] <= A[i+1]:
        i += 1
    if (i-s) > 0:
        c += (A[i]-A[s]) * (c//A[s])
        i += 1
print(c)


Measured memory_bytes: 61972
#include<stdio.h>
int main(){
  int a;
  int n=0;
  int t=0;
  int b;
  scanf("%d",&a);
  while(a!=n){
    scanf("%d",&b);
     if(b%2==0){
      if(b%3!=0){ 
        if(b%5!=0){
        t=1;
      }
    }
     }
    n=n+1;
  }
  if(t==1){
    printf("DENIED");
  }else{
    printf("APPROVED");
  }
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>

using namespace std;

int main() {
    string s;
    cin >> s;
    cout << ((s.find('N') == string::npos ^ s.find('S') == string::npos) || (s.find('E') == string::npos ^ s.find('W') == string::npos) ? "No" : "Yes") << endl;
    return 0;
}


Measured memory_bytes: 256