akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
const int N=1e6+10;
int A,B,C,D,E,F;
int water[3005],sugar[3005];
int main(){
	cin>>A>>B>>C>>D>>E>>F;
	water[0]=sugar[0]=1;
	for(int i=1;i<=F;i++){
		if(i>=100*A)water[i]=water[i-100*A];
		if(i>=100*B)water[i]=(water[i] | water[i-100*B]);
		if(i>=C)sugar[i]=sugar[i-C];
		if(i>=D)sugar[i]=(sugar[i] | sugar[i-D]);
	}
	int ansx=100*A,ansy=0;
	for(int x=1;x<=F;x++){
		if(water[x]==1){
			for(int y=0;y<=F-x;y++){
				if(sugar[y]==1){
					double s=y*1.0/x;
					double t=E*1.0/100;
					double u=ansy*1.0/ansx;
					if(s<=t&&s>u){
						ansx=x;
						ansy=y;
					}
				}
			}
		}
	}
	cout<<ansx+ansy<<" "<<ansy;
	return 0;
}


Measured memory_bytes: 256
package main
 
import(
  "fmt"
)
 
func main() {
  var x, y, b1, b2, total int
  fmt.Scanf("%d", &x)
  fmt.Scanf("%d", &y)
  if (x == 1) {
    b1 = 300000
  } else if (x == 2) {
  	b1 = 200000
  } else if (x == 3) {
    b1 = 100000
  } else {
    b1 = 0
  }
  if (y == 1) {
    b2 = 300000
  } else if (y == 2) {
  	b2 = 200000
  } else if (y == 3) {
    b2 = 100000
  } else {
    b2 = 0
  }
  if (x == 1 && y == 1) {
    total = b1 + b2 + 400000
  } else {
    total = b1 + b2
  }
  fmt.Println(total)
}

Measured memory_bytes: 512
def main():
  import sys
  from collections import deque
  from operator import itemgetter
  
  b = sys.stdin.buffer
  N,D,A = map(int, b.readline().split())
  m = map(int, b.read().split())
  ans = 0
  Q = deque()
  d = 0
  for x,h in sorted(zip(m,m), key=itemgetter(0)):
    while Q and Q[0][0] < x:
      _,d_ = Q.popleft()
      d += d_
    h = h+d
    if h <= 0: continue
    n = -(-h // A)
    d -= n * A
    ans += n
    Q.append((x+2*D,n * A))

  print(ans)
  
main()

Measured memory_bytes: 55880
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.PriorityQueue;
import java.util.Scanner;

class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);			//文字の入力
		int n = sc.nextInt();
		int k = sc.nextInt();
		int[] t = new int[n];
		int[] d = new int[n];

		ArrayList<Pair> pairs = new ArrayList<Pair>();
		for(int i = 0;i < n;i++){
			t[i] = sc.nextInt();
			d[i] = sc.nextInt();
			Pair pair = new Pair();
			pair.from = t[i];
			pair.end = d[i];
			pairs.add(pair);
		}

		Collections.sort(pairs,Comparator.reverseOrder());

		int[] cc = new int[100001];			



		ArrayList<Integer> one = new ArrayList<Integer>();
		ArrayList<Integer> zero = new ArrayList<Integer>();

		cc[pairs.get(0).from]++;			//各寿司について出てきているか判定
		pairs.get(0).from = 1;
		one.add(pairs.get(0).end);

		for(int i = 1;i < n;i++){
			if(cc[ pairs.get(i).from ] > 0){			//すでに最高値がある時
				pairs.get(i).from = 0;
				zero.add(pairs.get(i).end);
			}else{
				cc[pairs.get(i).from]++;				//新しい寿司の中で最高値
				pairs.get(i).from = 1;
				one.add(pairs.get(i).end);
			}

		}
		int	syuruimax = one.size();

		long ans = 0l;
		int syurui = 0;
		PriorityQueue<Integer> queue = new PriorityQueue<Integer>();

		for(int i = 0;i < k;i++){
			ans += pairs.get(i).end;
			if(pairs.get(i).from == 0){			//最大値じゃない時,
				queue.add(pairs.get(i).end);
				zero.remove(0);
			}else{
				syurui++;
				one.remove(0);
			}
		}	


		long[] maxans = new long[n+1];
		maxans[syurui] = ans;

		while(syurui < k && syurui < syuruimax){
			ans += (long)one.get(0);
			one.remove(0);
			long del =	(long)queue.poll();
			ans -= del;
			syurui++;
			maxans[syurui] = ans;
			if(queue.isEmpty() || one.isEmpty()){
				break;
			}
		}

		for(int i = 0;i <= n;i++){
			if(maxans[i] > 0){
				ans = (long)Math.max(ans, maxans[i] + (long)i*i);
			}
		}

		System.out.println(ans);








	}


}

class Pair implements Comparable{
	int from;		//p
	int end;		//y
	int num;
	int bango;
	@Override
	public int compareTo(Object other) {
		Pair otherpair = (Pair)other;

		return end - otherpair.end;
	}
}



Measured memory_bytes: 97784
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();

		int d = n % 10;
		int c = (n - d) % 100/10;
		int b = (n - d - c * 10) % 1000/100;
		int a = n / 1000;
		
		int answer;
		
		for(int i =0; i < 2; i++) {
			
			for(int j = 0; j < 2; j++) {
				
				for(int k = 0; k < 2; k++) {
					answer = a;
					if(i == 0) {
						answer += b;
					} else {
						answer -= b;
					}
					if(j == 0) {
						answer += c;
					} else {
						answer -= c;
					}
					if(k == 0) {
						answer += d;
					} else {
						answer -= d;
					}
					if(answer == 7) {
						System.out.println(a + (i==0?"+":"-")
								+b + (j==0?"+":"-")
								+c + (k==0?"+":"-")+d + "=7");
						System.exit(0);
					}
				}
			}
			
		}
		
		

	}

}


Measured memory_bytes: 21972
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

public class Main {

	void run() {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] A = new int[N];
		int[] xor = new int[N];
		int[] sum = new int[N];
		for (int i = 0; i < N; ++i) {
			A[i] = sc.nextInt();
			xor[i] = A[i] ^ (i > 0 ? xor[i - 1] : 0);
			sum[i] = A[i] + (i > 0 ? sum[i - 1] : 0);
		}
		long ans = 0;
		int t = -1;
		for (int i = 0; i < N; ++i) {
			while (t < i && sum[i] - (t >= 0 ? sum[t] : 0) != (xor[i] ^ (t >= 0 ? xor[t] : 0)))
				++t;
			ans += i - t;
		}
		System.out.println(ans);
	}

	public static void main(String[] args) {
		new Main().run();
	}

	void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}
}


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

#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define pf printf
#define sc scanf
#define sf(n) scanf("%d",&n)
#define sff(n1,n2) scanf("%d %d",&n1,&n2)
#define sfff(n1,n2,n3) scanf("%d %d %d",&n1,&n2,&n3)
#define sl(n) scanf("%lld",&n)
#define sll(n1,n2) scanf("%lld %lld",&n1,&n2)
#define slll(n1,n2,n3) scanf("%lld %lld %lld",&n1,&n2,&n3)
#define rep0(i,n) for(i=0;i<n;i++)
#define rep(i,n) for(i=1;i<=n;i++)
#define reps(i,a,n) for(i=a;i<=n;i++)
#define nl puts("");
#define pb push_back
#define MOD 1000000007
#define fi first
#define se second
#define N 100005
#define mem(ara,n) memset(ara,n,sizeof(ara))
#define memb(ara) memset(ara,false,sizeof(ara))
#define all(x) (x).begin(),(x).end()
#define sq(x) ((x)*(x))
#define sz(x) x.size()
#define pi pair<int,int>
#define pii pair<pair<int,int>,pair<int,int> >
#define line puts("-------");
#define db(x) cout<<#x<<" :: "<<x<<"\n";
#define dbb(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\n";
#define fr freopen("input.txt","r",stdin);
#define fw freopen("output.txt","w",stdout);
typedef long long int ll;
using namespace std;
int main()
{
    int i,n;
    string a;
    cin>>n>>a;
    rep0(i,sz(a))
    {
        int k=((a[i]-'A')+n)%26;
        cout<<char(k+65);
    }
}


Measured memory_bytes: 256
package main

import (
	"fmt"
	"strings"
)

func main() {
	var s string
	fmt.Scan(&s)

	arr := strings.Split(s, "")

	if arr[0] == "R" && arr[1] == "R" && arr[2] == "R" {
		fmt.Println(3)
	}
	if (arr[0] == "R" && arr[1] == "R" && arr[2] == "S") || arr[0] == "S" && arr[1] == "R" && arr[2] == "R" {
		fmt.Println(2)
	}
	if (arr[0] == "R" && arr[1] == "S" && arr[2] == "S") || arr[0] == "R" && arr[1] == "S" && arr[2] == "R" || arr[0] == "S" && arr[1] == "S" && arr[2] == "R" || arr[0] == "S" && arr[1] == "R" && arr[2] == "S" {
		fmt.Println(1)
	}
	if arr[0] == "S" && arr[1] == "S" && arr[2] == "S" {
		fmt.Println(0)
	}
}


Measured memory_bytes: 1836
while True:
    h = int(input())
    if h == 0:
        break
    arr = [[-1 for i in range(h)], [-1 for i in range(h)], [-1 for i in range(h)], [-1 for i in range(h)], [-1 for i in range(h)]]
    midlen = h
    for i in range(h - 1, -1, -1):
        inp = list(map(int, input().split()))
        for j, e in enumerate(inp):
            arr[j][i] = e
    
    score = 0
    za = True
    while za:
        za = False
        for i, e in list(enumerate(arr[2]))[::-1]:
            for j in range(3):
                ge = 0
                for h in range(j, 5):
                    if len(arr[h]) > i:
                        if arr[h][i] == e:
                            ge += 1
                            continue
                    break
                if ge > 2:
                    za = True
                    for h in range(j, j + ge):
                        score += arr[h].pop(i)
    print(score)



Measured memory_bytes: 5632
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

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

int main()
{
    ll n;
    cin>>n;
    ll i=n%10;
    if(i== 2 || i== 4 || i== 5 || i== 7 || i== 9)
    cout<<"hon"<<endl;
    else if(i==3)
    cout<<"bon"<<endl;
    else 
    cout<<"pon";
    return 0;
}


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

int main(){
int b;
string a;
cin>>a;

if(a=="SAT"){
    cout<<1<<endl;
}
if(a=="SUN"){
    cout<<7<<endl;
}
if(a=="MON"){
    cout<<6<<endl;
}
if(a=="TUE"){
    cout<<5<<endl;
}
if(a=="WED"){
    cout<<4<<endl;
}
if(a=="THU"){
    cout<<3<<endl;
}
if(a=="FRI"){
    cout<<2<<endl;
}


}


Measured memory_bytes: 256
#![allow(unused_macros)]
#![allow(dead_code)]
#![allow(unused_imports)]

use proconio::*;
use text_io::*;

const U_INF: usize = 1 << 60;
const I_INF: isize = 1 << 60;

fn main() {
    input! {
        n:usize,
        a:[usize;n],
    }

    let &max_num = a.iter().max().unwrap();
    let is_set_wise = a.iter().fold(0, |acc, ai| acc.gcd(ai)) == 1;

    let era = Eratosthenes::new(max_num);
    let mut divisor_counter = vec![0; max_num + 1];

    for ai in a {
        let hm = era.factorization(ai);

        for (k, _v) in hm {
            divisor_counter[k] += 1;
            if divisor_counter[k] >= 2 {
                break;
            }
        }
    }

    let is_pair_wise = *divisor_counter.iter().max().unwrap() <= 1;

    let ans = if is_pair_wise {
        "pairwise coprime"
    } else if is_set_wise {
        "setwise coprime"
    } else {
        "not coprime"
    };

    println!("{}", ans);
}

use itertools::Itertools;
use num::Integer;
use rustc_hash::FxHashMap;
use smallvec::alloc::collections::BTreeMap;
use std::collections::HashMap;
use std::mem::swap;

/// 二分累乗法
pub fn pow(x: isize, n: usize) -> isize {
    if n == 0 {
        1
    } else if n == 1 {
        x
    } else if n % 2 == 1 {
        x * pow(x, n - 1)
    } else {
        pow(x * x, n / 2)
    }
}

/// エラトステネスの篩
/// 構築 O(N log log N)
/// 素因数分解 O(log N)
/// 素数判定 O(log N)
pub struct Eratosthenes {
    smallest_prime_factors: Vec<usize>,
}

impl Eratosthenes {
    pub fn new(n: usize) -> Self {
        let mut smallest_prime_factors = (0..=n).collect_vec();

        for i in 2..n {
            if i * i > n {
                break;
            }

            if smallest_prime_factors[i] != i {
                continue;
            }

            let mut j = i * i;
            while j <= n {
                if smallest_prime_factors[j] == j {
                    smallest_prime_factors[j] = i;
                }

                j += i;
            }
        }

        Self {
            smallest_prime_factors,
        }
    }

    pub fn factorization(&self, mut i: usize) -> BTreeMap<usize, usize> {
        assert_ne!(i, 0);

        let mut factors = BTreeMap::new();

        while i != 1 {
            let divisor = self.smallest_prime_factors[i];
            *factors.entry(divisor).or_insert(0) += 1;

            i /= divisor;
        }

        factors
    }

    pub fn is_prime(&self, i: usize) -> bool {
        i >= 2 && self.smallest_prime_factors[i] == i
    }
}


Measured memory_bytes: 28292
import itertools
n=int(input())
l=[int(i) for i in input().split()]
ans=0
for i,j,k in itertools.combinations(l,3):
  if i!=j!=k and k!=i:
    if i==max(i,j,k):
      if i<j+k:
        ans+=1
    elif j==max(i,j,k):
      if j<i+k:
        ans+=1
    elif k==max(i,j,k):
      if k<j+i:
        ans+=1
print(ans)

Measured memory_bytes: 9200
#include<bits/stdc++.h>
using namespace std;
int main() {
  int n, l;
  cin >> n >> l;
  cout
      << n * (n + 1) / 2 + n * (l - 1)
          - (l < 0 ? n - 1 + l < 0 ? n - 1 + l : 0:l);
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<math.h>
#include<cmath>
#include<vector>
#include<stack>
#include<queue>
#include<functional>
#include<map>
#include<set>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)

map<string, int> mp;

int main() {
    int n, k;
    int ans = 1;
    cin >> n >> k;
    rep(i, n) {
        int a = ans * 2;
        int b = ans += k;
        ans = min(a, b);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
#define int long long int
using namespace std;

void desperate_optimization(bool submitting=true,int precision=10)
{
  if(!submitting) return;
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout.setf(ios::fixed);
  cout.setf(ios::showpoint);
  cout.precision(precision);
}
int memo[23][(1<<21)+5];
int n;
const int mod=1e9+7;
int grid[22][22];
int ways(int done,int mask)
{
  if(memo[done][mask]!=-1) return memo[done][mask];
  if(done==n) return memo[done][mask]=1;
  int women[22];
  for(int i=0;i<n;i++)
    women[i]=(mask&(1<<i));
  int answer=0;
  for(int i=0;i<n;i++)
    if(women[i]&&grid[i][done]) 
      {answer+=ways(done+1,mask^(1<<i)); if(answer>=mod) answer-=mod;}
  return memo[done][mask]=answer;
}
int32_t main()
{
  desperate_optimization(true);
 // freopen("input.txt","r",stdin);
  cin>>n;
  for(int i=0;i<n;i++) for(int j=0;j<n;j++) cin>>grid[i][j];
  memset(memo,-1,sizeof(memo));
  cout<<ways(0,(1<<n)-1);


  return 0;
}


Measured memory_bytes: 377088
local read = setmetatable({}, {__index = function(t, k) local a = {} for i=1,#k do table.insert(a, '*'..string.sub(k, i, i)) end local r = io.read local u = table.unpack or unpack return function() return r(u(a)) end end})
read.N = function(N) local t={} for i=1,N do t[i]=read.n() end return t end
string.totable = function(s) local t={} local u=string.sub for i=1,#s do t[i] = u(s, i, i) end return t end
string.split = function(s) local t={} for w in string.gmatch(s, "[^%s]+") do table.insert(t, w) end return (table.unpack or unpack)(t) end
local function array(dimensi0n, default_val) assert(type(default_val) ~= 'table') local n=dimensi0n local m={}if default_val~=nil then m[1]={__index=function()return default_val end}end for i=2,n do m[i]={__index=function(p, k)local c=setmetatable({},m[i-1])rawset(p,k,c)return c end}end return setmetatable({},m[n])end
--
local R, G, B = read.nnn()
local K = read.n()
while K > 0 do
    if G <= R then
        G = G * 2
    elseif B <= G then
        B = B * 2
    end
    K = K - 1
end
if G > R and B > G then
    print("Yes")
else
    print("No")
end

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

int main() {
  int a,b,c,k;
  cin >> a >> b >> c >> k;
  if(k <= a)
    cout << k << endl;
  else if(k <= a+b)
    cout << a << endl;
  else
    cout << a + (k-a-b)*(-1) << endl;
}

Measured memory_bytes: 3632
#include <iostream>
#include<string>
#include<cstring>
#include <cstdio>
#include<utility>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<bitset>
#include<queue>
#include<stack>
#include<set>
#include <limits>
#include <climits>
#include <numeric>
#include<cassert>
using namespace std;
typedef long long ll;
typedef vector<ll>VI;
typedef vector<bool>VB;
typedef pair<ll,ll>P;
typedef pair<double,double>P_D;
#define VV(T) vector<vector<T>>
#define PI 3.1415926535897932384626433832795
#define rep(i, n) for (ll i = 0; i < (ll)n; i++)
#define reprev(i, n) for (ll i = (ll)n - 1; i >= 0; i--)
#define bitrep(bit,A) for(int bit=A; ;bit=(bit-1)&A)
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) (ll)((a).size())
#define c_max(a, b) (((ll)a)>((ll)b)?(a):(b))
#define c_min(a,b) (((ll)a)<((ll)b)?(a):(b))
#define chmax(x,a) x=c_max(x,a)
#define chmin(x,a) x=c_min(x,a)
#define vmax(v) *max_element(ALL(v))
#define vmin(v) *min_element(ALL(v))
#define SORT(c) stable_sort(ALL(c))
#define $(x) {cout<<#x<<" = " <<(x)<<endl;}
#define fi first
#define se second
#define MAX 100100//5
#define MAX2 200100
#define MAX_6 1001001//6
#define MAX_7 10010010//7
#define SENTINEL 2000000000//9
#define NIL -1
#define MOD 1000000007
#define INF 1<<30
#define INFTY 1000000000000000001LL
#define MAX_INT INT_MAX
#define Endl '\n'
#define mian() main()
#define greater greater<int>()
VI findAll(string S,string pattern){VI P;ll pos=(ll)S.find(pattern);
while(pos!=string::npos){P.push_back(pos);pos=(ll)S.find(pattern,pos+1);}return P;}
inline ll GCD(ll a,ll b){return b?GCD(b,a%b):a;}
inline ll lcm(ll a,ll b){return a*b/GCD(a,b);}
bool is_prime(ll n){if(n<2)return 0;for(int i=2;i*i<n;i++)if(n%i==0)return 0;return 1;}
inline void eratosthenes(VB& p){rep(i,SZ(p))p[i]=1;p[0]=p[1]=0;
rep(i,SZ(p)/2+1){if(p[i])for(ll j=i+i;j<SZ(p);j+=i)p[j]=0;}}
inline ll mod_add(ll a,ll b){return (a+b)%MOD;}
inline ll mod_sub(ll a,ll b){return (a+MOD-b)%MOD;}
inline ll mod_mul(ll a,ll b){return ((a%MOD)*(b%MOD))%MOD;}
inline ll mod_pow(ll x,ll n,ll mod=(ll)MOD){ll res=1;while(n>0){
if(n&1)res=res*x%mod;x=x*x%mod;n>>=1;}return res;}
inline ll mod_inv(ll x){return mod_pow(x,MOD-2);}
inline ll mod_div(ll a, ll b){return mod_mul(a,mod_inv(b));}
using Graph=vector<vector<P> >;
ll a,b,x;
int main(){
    cin>>a>>b>>x;
    if(a)cout<<b/x-(a-1)/x<<endl;
    else cout<<b/x+1<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
using Int = long long;


int main() {

	Int N, C, K;
	std::cin >> N >> C >> K;

	std::vector<Int> T(N);
	for (Int i = 0; i < N; i++)std::cin >> T[i];
	std::sort(T.begin(), T.end());

	Int ans = 0;
	Int i = 0;
	while(i<N){
		ans++;
		Int temp = i;
        Int temp_T = T[i];
		for (Int j = temp; j < temp + C; j++) {
			if (j == N)break;
			if (T[j] <= temp_T + K)i++;
		}
	}

	std::cout << ans << std::endl;

}

Measured memory_bytes: 1024
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

int main(int argc, char* argv[]){
    int n;
    int tmp;
    cin >> n;
    vector<int> v;
    rep(i, n){
        cin >> tmp;
        v.push_back(tmp - (i+1));
    }

    sort(v.begin(), v.end(), greater<int>());
    int b = v[n/2];
    int c = v[n/2+1];
    ll mna = 0, mnb = 0;
    
    rep(i, v.size()){
        mna += abs(v[i] - b);
        mnb += abs(v[i] - c);
    }
    cout << min(mna, mnb) << endl;
}



Measured memory_bytes: 1400
#include<bits/stdc++.h>
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);    
#define f(i,j,k)  for(int i=j;i<k;i++)
#define fr(i,j,k) for(int i<=k-1;i>=j;i--)
#define ll long long
#define ld long double
#define pb push_back
#define all(x) x.begin(),x.end()

struct myhash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = std::chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};


using namespace std;

int main()
{
	fio
	int TC;
	//cin>>TC;
	TC=1;
	while(TC--)
	{
		ll x;
		cin>>x;
		ll p=100;
		int n=0;
		while(p<x)
		{
			p+=p/100;
			n++;
		}
		cout<<n<<endl;
		
	}
	return 0;
}


Measured memory_bytes: 3612
#include<stdio.h>
#include<stdlib.h>

#define MAX 20

// ????????¨?????¨ ?§???????
typedef struct {
  int row;               // ?????????
  int col;               // ?????????
} Coord;

// ??????????????¨ ?§???????
typedef struct _stack {
  struct _stack *next;
  Coord point;
} *stack, stackelem;

char M[MAX+2][MAX+2];    // ?????¢?????°??????????????§???

// ????????????????????£?¨?
int solve (int W, int H);
int search_df (int W, int H, Coord start);

// ??????????????¨
stack  new_stack (void);
int is_empty (stack);
int push (stack, Coord);
Coord top (stack);
Coord pop (stack);

// main ??¢??°
int main () {
  while (1) {
    int W, H;
    scanf("%d%d", &W, &H);
    if (W==0 && H==0) break;
    printf("%d\n", solve(W,H));
  }

  return 0;
}

// ?????£?????¢?´¢ 
int solve (int W, int H) {
  Coord start;             // ??????????????°???
  int i, j;

  //  ?£?????????????????¨???? 
  for (i=0; i<=W+1; i++) { M[0][i] = '#'; M[H+1][i] = '#'; }
  for (i=1; i<=H; i++) { M[i][0] = '#'; M[i][W+1] = '#'; }
  // ??????????????\??? 
  for (i=1; i<=H; i++) {
    for (j=1; j<=W; j++) {
      scanf(" %c", &M[i][j]);
      if (M[i][j]=='@') {
	start.row = i;
	start.col = j;
      }
    }
  }

  return search_df(W, H, start);
}

int search_df (int W, int H, Coord start) {
  stack S = new_stack ();  // ?¨?????????????????????????????????????
  int c = 1;               // ????????????????????????????????°???????????? 1 ??§?????????
  // ??????????????°???????¨????
  push(S,start);                               // ??????????????°?????? push
  // ??¢?´¢
  while (!is_empty(S)) {
    Coord current = pop(S);                    // pop ???????????????
    int d;                                     // ??????
    int D1[]={1,0,-1,0}; int D2[]={0,-1,0,1};  // ????????¢?????¶?????¨
    for (d=0; d<4; d++) {
      Coord nc = current;                      // Next Cell
      nc.row += D1[d];  nc.col += D2[d]; 
      if (M[nc.row][nc.col] == '.') {
	M[nc.row][nc.col] = '*';               // ?????°???????????°?????????
	c++;                                   // ???????????????????????????????????????
	push(S,nc);
      } // nc ????????¢?´¢?????? (*) ????£? (#) ?????´?????????????????????
    } 
  }
  return c;  // ??°??????????????????????????°?????????
}

/* ??°??????????????????????¢?????????????????????? */
stack new_stack (void) {
  stack s;
  s = (stack) malloc (sizeof (stackelem));
  if (s == NULL) return NULL;
  s->next = NULL;
  return s;
}
    
/* ???????????????????????????????????? */
int is_empty (stack s) {
  return (s && s->next == NULL);
}

/* ??°??????????´???????????????\ */
int push (stack s, Coord v) {
  stack p;
  if (s == NULL) return 0;
  p = (stack) malloc (sizeof (stackelem));
  if (p == NULL) return 0;
  p->point = v;
  p->next = s->next;
  s->next =  p;
  return 1;
}

/* ?????????????´?????????? */
Coord top (stack s) {
  if (s && s->next) 
    return s->next->point;
  exit (1);
}

/* ????????? */
Coord pop (stack s) {
  stack p;
  Coord v = top (s);
  p = s->next;
  s->next = p->next;
  free (p);
  return v;
}

Measured memory_bytes: 616
// ref. https://www.youtube.com/watch?v=aDDV_WBwzTM

#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <unordered_map>
#include <vector>
#include <string.h>
#include <set>

using namespace std;

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

template<class T> void printvec(const vector<T>& v) {
  for (auto x : v) { cout << x << " "; }
  cout << endl;
}
template<class T> void printtree(const vector< vector<T> >& tree) {
  for (long long i = 0; i < tree.size(); ++i) {
    cout << i + 1 << ": "; printvec(tree[i]);
  }
}
template<class T, class U> void printmap(const map<T, U>& mp) {
  for (auto x : mp) { cout << x.first << "=>" << x.second << endl; }
}

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; }

#define rep(i, n) for(ll i = 0; i < n; ++i)
#define all(s) s.begin(), s.end()
#define fr first
#define sc second
#define mp make_pair
#define pb push_back

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> triple;
typedef double D;

const ll INF = 1e12;
const ll MOD = 1000000007;  // 1e9 + 7

int main(int argc, char** argv) {
  cin.tie(NULL);
  cout.tie(NULL);
  ios_base::sync_with_stdio(false);
  //cout << setprecision(10) << fixed;

  ll n, k;
  cin >> n >> k;
  ll m = n-k; // remaining count

  vector<ll> h(n+1); // h[0] = 0
  rep(i, n) {
    cin >> h[i+1];
  }

  // dp[i][j] .. min cost to remain i as last and remaining count is j
  vector<vector<ll>> dp(n+1, vector<ll>(m+1, INF));
  dp[0][0] = 0;

  for (int i = 1; i <= n; ++i) {
    // calculate in [0, m)
    rep(j, m) {
      ll now = INF;
      rep(k, i) { // [0, i)
        now = min(now, dp[k][j] + max(0ll, h[i]-h[k]));
      }
      dp[i][j+1] = now;
    }
  }
  ll ans = INF;
  rep(i, n+1) {
    ans = min(ans, dp[i][m]);
  }
  cout << ans << endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = unsigned long long;

string s;

void input() {
    cin >> s;
}

void solve() {
    string r;
    int count = 0;
    for(int i = 0; i < s.length(); i++) {
        r.push_back(s.at(s.length()-1-i));
        if(s.at(i) != r.at(i)) {
            count++;
        }
    }
    cout << count/ 2 << endl;
}

int main() {
    input();
    solve();
}


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

#define fs first
#define sc second
#define pb emplace_back
#define mp make_pair
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

const int32_t inf = 1001001001;
const int64_t infll = 1001001001001001001ll;
const int dx[] = {0, -1, 1, 0, -1, 1, -1, 1}, dy[] = {-1, 0, 0, 1, -1, -1, 1, 1};

template <typename T> using vector2d = vector<vector<T>>;

// clang-format off
template <typename T> void sort(vector<T> &v) { sort(all(v)); }
// ostream &operator<<(ostream &os, __int128_t value) { if (ostream::sentry(os)) { __uint128_t tmp = value < 0 ? -value : value; char buffer[64]; char *d = end(buffer); do { --d; *d = "0123456789"[tmp % 10]; tmp /= 10; } while (tmp != 0); if (value < 0) { --d; *d = '-'; } int len = end(buffer) - d; if (os.rdbuf()->sputn(d, len) != len) { os.setstate(ios_base::badbit); }} return os; }
// istream &operator>>(istream &is, __int128_t &value) { string in; is >> in; value = 0; for (const char &c : in) { if ('0' <= c && c <= '9') value = 10 * value + (c - '0'); } if (in[0] == '-') value *= -1; return is; }
// ostream &operator<<(ostream &os, __uint128_t value) { if (ostream::sentry(os)) { char buffer[64]; char *d = end(buffer); do { --d; *d = "0123456789"[value % 10]; value /= 10; } while (value != 0); int len = end(buffer) - d; if (os.rdbuf()->sputn(d, len) != len) { os.setstate(ios_base::badbit); }} return os; }
// istream &operator>>(istream &is, __uint128_t &value) { string in; is >> in; value = 0; for (const char &c : in) { if ('0' <= c && c <= '9') value = 10 * value + (c - '0'); } return is; }
template <typename T> ostream &operator<<(ostream &os, vector<T> &v) { os << v[0]; for (int i = 1; i < v.size(); ++i) os << " " << v[i]; return os; }
template <typename T> istream &operator>>(istream &is, vector<T> &v) { for (T &in : v) is >> in; return is; }
template <typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p) { os << p.fs << " " << p.sc; return os; }
template <typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.fs >> p.sc; return is; }

struct IoSetup { IoSetup(){ cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10); cerr << fixed << setprecision(10); } } iosetup;

inline int64_t in() { int64_t x = 0; cin >> x; return x; }
template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
// clang-format on

const int mod = 1e9 + 7;

signed main(int argc, char *argv[]) {
  int n = in();

  vector<pair<int, int>> v;
  for (int i = 0; i < n; ++i) {
    v.pb(in(), 0);
  }
  for (int i = 0; i < n; ++i) {
    v.pb(in(), 1);
  }

  v.pb(inf, 1);

  sort(v);

  int64_t ans = 1, a = 0, b = 0;
  for (int i = 0; i < v.size(); ++i) {
    if (v[i].sc) {
      if (a) {
        ans *= a;
        ans %= mod;
        a--;
      } else {
        b++;
      }
    } else {
      if (b) {
        ans *= b;
        ans %= mod;
        b--;
      } else {
        a++;
      }
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 2420
defmodule Main do
  def main do
    k=IO.gets("") |> String.trim |> String.to_integer
    s=IO.gets("") |> String.trim
    if String.length(s)>k do
      IO.puts(String.slice(s, 0,k)<>"...")
    else
      IO.puts(s)
    end
  end
end


Measured memory_bytes: 31176
#include <cstdio>
#include <functional>
#include <vector>
#include <tuple>
#include <algorithm>
#include <deque>
#include <memory>

using namespace std;

using ll = long long;
int n, m;
int digits[9];
int sticks_for_digits[10] = {-1,2,5,5,4,5,6,3,7,6};
bool called[10000];
bool reachable[10000];

struct Node {
  int value;
  shared_ptr<Node> next;
  Node(int v, shared_ptr<Node> n) : value(v), next(n) {};
};
struct LinkedList {
  shared_ptr<Node> root;
  int length;
  LinkedList() : length(0) {};
  LinkedList(int v, LinkedList& tail) : length(tail.length+1), root(make_shared<Node>(v, tail.root)) {};
  bool empty()
  {
    return length == 0;
  }
  int size()
  {
    return length;
  }
};
LinkedList nil;
LinkedList cons(int value, LinkedList& list)
{
  return LinkedList(value, list);
}
LinkedList dp[10000];

bool is_left_ge(LinkedList& left, LinkedList& right)
{
  if (left.length > right.length) return true;
  if (left.length < right.length) return false;
  shared_ptr<Node> l = left.root;
  shared_ptr<Node> r = right.root;
  while (!((l == nullptr) && (r == nullptr))) {
    if (l->value > r->value) return true;
    if (l->value < r->value) return false;
    l = l->next;
    r = r->next;
  }
  return true;
}

void solve(int sticks)
{
  if (called[sticks]) return;
  called[sticks] = true;
  LinkedList cur;
  //printf("entering solve(%d)\n", sticks);
  //cur.push_back(0);
  for (int i = 0; i < m; i++) {
    int to_consume = sticks_for_digits[digits[i]];
    if (sticks < to_consume) continue;
    solve(sticks-to_consume);
    /*printf("solve(%d) =", sticks-to_consume);
    Node *ptr = dp[sticks-to_consume];
    while (ptr) {
      printf("%d", ptr->value);
      ptr = ptr->next;
    }
    printf("\n");*/
    if (!reachable[sticks-to_consume]) continue;
    LinkedList newlist = cons(digits[i], dp[sticks-to_consume]);
    if (is_left_ge(newlist, cur)) {
      cur = newlist;
    }
  }
  if (cur.length == 0) {
    int c = 0;
    for (int i = 0; i < m; i++) {
      if (sticks_for_digits[digits[i]] == sticks) {
        c = max(c, digits[i]);
      }
    }
    if (c != 0) {
      cur = cons(c, cur);
    }
  }
  else if (cur.length == 1) {
    for (int i = 0; i < m; i++) {
      if (sticks_for_digits[digits[i]] == sticks) {
        cur.root->value = max(cur.root->value, digits[i]);
      }
    }
  }
  if (cur.length != 0) {
    dp[sticks] = cur;
    reachable[sticks] = true;
  }
}

int main()
{
  scanf("%d %d", &n, &m);
  for (int i = 0; i < m; i++) {
    scanf("%d", &(digits[i]));
    //int sticks = sticks_for_digits[digits[i]];
    //digits_for_sticks[sticks] = max(digits_for_sticks[sticks], digits[i]);
  }
  reachable[0] = true;
  called[0] = true;
  dp[0] = LinkedList();
  solve(n);
  shared_ptr<Node> ptr = dp[n].root;
  vector<int> ds;
  while (ptr) {
    ds.push_back(ptr->value);
    ptr = ptr->next;
  }
  for (auto d : ds) {
    printf("%d", d);
  }
  printf("\n");
  return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define vi vector<int>
#define ll long long
#define pb push_back
#define fi first
#define se second
#define ii pair<int,int>
#define ll long long
const int MOD = 998244353;
const int INF  = 2e9 + 5;
const int LEN = 2e5 + 5;
typedef tree<
int, null_type,
less<int>, rb_tree_tag, tree_order_statistics_node_update>
ordered_set;
ordered_set s;
int p[10];

bool cek(char a, char b, char c) {
	return a != b && b != c && c != a;
}

//prefix sum
int suf[5000][3];
char ar[] = {'R','G','B'};

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    
    int n;
    string s;
    long long ans =0;

    cin>>n>>s;

    for(int i =n-1;i>0;i--) {
		if(s[i]=='R') suf[i][0]++;
		if(s[i]=='G') suf[i][1]++;
		if(s[i]=='B') suf[i][2]++;

		suf[i-1][0] += suf[i][0];
		suf[i-1][1] += suf[i][1];
		suf[i-1][2] += suf[i][2];
    }


    for(int i = 0; i +2 < n; i++) {
    	for(int j = i+1; j + 1 < n; j++) {
    		if(s[i] == s[j]) continue;
    		if(j + j - i < n && cek(s[j],s[i],s[j+j-i])) {
    			ans--;
    		}

    		for(int k = 0; k < 3;k++) {
    			if(s[i] != ar[k] && s[j] != ar[k]) {
    				ans += suf[j+1][k];
    				//cout<<k<<" "<<i<<" "<<j<<endl;
    			}
    		}

    	}
    }


    cout<<ans<<"\n";

    return 0;       
}

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

bool JudgePrime(int X){
    for(int i=2; i<X; i++){
        // 割り切れるものがあったとき
        if((X % i) == 0) return true;
    }
    // 割り切れるものがなかったとき
    return false;
}

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

    for(int i=X; i<100000000; ++i){
        if(!JudgePrime(i)){
            cout << i << endl;
            break;
        }
    }
}

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

template<typename F, typename T>
struct swag {
        F func;
        vector<T> front, back, front_acc, back_acc;
        swag(F _func) : func(_func) {}
        T fold_all() {
                assert(not front.empty() || not back.empty());
                if (front.empty()) {
                        return back_acc.back();
                } else if (back.empty()) {
                        return front_acc.back();
                } else {
                        return func(front_acc.back(), back_acc.back());
                }
        }
        void push(T x) {
                if (not back_acc.empty()) {
                        back_acc.push_back(func(back_acc.back(), x));
                } else {
                        back_acc.push_back(x);
                }
                back.push_back(x);
        }
        void pop() {
                if (front_acc.empty()) {
                        assert(not back.empty());
                        while (not back.empty()) {
                                T v = back.back();
                                back.pop_back();
                                back_acc.pop_back();
                                if (not front_acc.empty()) {
                                        front_acc.push_back(func(front_acc.back(), v));
                                } else {
                                        front_acc.push_back(v);
                                }
                                front.push_back(v);
                        }
                }
                front_acc.pop_back();
                front.pop_back();
        }
};

int main() {
        int n, m;
        cin >> n >> m;
        string s;
        cin >> s;
        vector<int> dist(n + 1, 1e9);
        dist[n] = 0;
        auto f = [&](int a, int b) { return min(a, b); };
        swag<decltype(f), int> sw(f);
        for (int i = n - 1; i >= max(0, n - m); i --) {
                if (s[i] != '1') {
                        dist[i] = 1;
                }
                sw.push(dist[i]);
        }
        for (int i = n - m - 1; i >= 0; i --) {
                if (s[i] == '0') {
                        dist[i] = sw.fold_all() + 1;
                }
                sw.pop();
                sw.push(dist[i]);
        }

        int prev = 0;
        set<int> used;
        used.insert(dist[0]);
        vector<int> ans;
        rep(i, n + 1) if (i) {
                if (dist[i] < 1e9 && used.count(dist[i]) == 0) {
                        ans.push_back(i - prev);
                        prev = i;
                        used.insert(dist[i]);
                }
        }
        rep(i, ans.size()) {
                if (ans[i] > m) {
                        puts("-1");
                        return 0;
                }
        }
        rep(i, ans.size()) printf("%d ", ans[i]);
        puts("");
        return 0;
}


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

int main() {
  int width, height, N;
  std::cin >> width >> height >> N;
  std::vector<std::vector<int>> data(height,std::vector<int>(width));
  for (int i=0; i<N; i++) {
    int temp_x,temp_y,flag;
    std::cin >> temp_x >> temp_y >> flag;
    if (flag == 1) {
      for (int y = 0; y < height; y++) {
        for (int x = 0; x < temp_x; x++) {
          data.at(y).at(x) = 1;
        }
      }
    }
    else if (flag == 2) {
      for (int y = 0; y < height; y++) {
        for (int x = temp_x; x < width; x++) {
          data.at(y).at(x) = 1;
        }
      }
    }
    else if (flag == 3) {
      for (int y = 0; y < temp_y; y++) {
        for (int x = 0; x < width; x++) {
          data.at(y).at(x) = 1;
        }
      }
    }
    else if (flag == 4) {
      for (int y = temp_y; y < height; y++) {
        for (int x = 0; x < width; x++) {
          data.at(y).at(x) = 1;
        }
      }
    }
  }
  int sum = 0;
  for (int y=0; y < height; y++) {
    for (int x=0; x < width; x++) {
      if (data.at(y).at(x) == 0) {
        sum++;
      }
    }
  }
  std::cout << sum << std::endl;
}
      

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

bool used[100000],lused[100000];
vector<int> ls[100000],lang[100000];

void dfs(int v){
	used[v] = true;
	for(int i = 0;i < ls[v].size();i++){
		int l = ls[v][i];
		if(!lused[l]){
			lused[l] = true;
			for(int j = 0;j < lang[l].size();j++){
				int to = lang[l][j];
				if(!used[to]) dfs(to);
			}
		}
	}
}

int main(){
	int n,m;
	cin >> n >> m;
	for(int i = 0;i < n;i++){
		int k;
		cin >> k;
		for(int j = 0;j < k;j++){
			int l;
			cin >> l; l--;
			ls[i].push_back(l);
			lang[l].push_back(i);
		}
	}
	dfs(0);
	for(int i = 0;i < n;i++) {
		if(!used[i]){
			cout << "NO" << endl;
			return 0;
		}
	}
	cout << "YES" << endl;
	return 0;
}

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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<P> VP;
typedef vector<vector<ll>> VV;
typedef vector<vector<int>> VVi;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
const ll INF=1e18+18;
const ll MAX=100005;
const ll MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define ALL(v) v.begin(), v.end()
#define rALL(v) v.rbegin(), v.rend()
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define REPM(i, mp) for (auto i = mp.begin(); i != mp.end(); ++i)
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbgmap(mp) cerr << #mp << ":"<<endl; for (auto i = mp.begin(); i != mp.end(); ++i) { cerr << i->first <<":"<<i->second << endl;}
#define dbgarr(n,m,arr) rep(i,n){rep(j,m){cerr<<arr[i][j]<<" ";}cerr<<endl;}
#define dbgdp(n,arr) rep(i,n){cerr<<arr[i]<<" ";}cerr<<endl;
#define Uniq(v) v.erase(unique(v.begin(), v.end()), v.end())
#define fi first
#define se second

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

template<typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &p) { return s<<"("<<p.first<<", "<<p.second<<")"; }

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<"	";
    }
    return s;
}

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}

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

    VV g(3,Vec(3));
    rep(i,3){
        rep(j,3){
            cin>>g[i][j];
        }
    }

    bool ok = true;
    if(g[0][1] -g[0][0] != g[1][1]-g[1][0]) ok = false;
    if(g[1][1] -g[1][0] != g[2][1]-g[2][0]) ok = false;
    if(g[0][2] -g[0][1] != g[1][2]-g[1][1]) ok = false;
    if(g[1][2] -g[1][1] != g[2][2]-g[2][1]) ok = false;
    Yes(ok);
    return  0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
using namespace std;
int main(int argc, char *argv[])
{
	char s[100];
	int f=0,g;
	scanf("%s",s);
	for(int i=2;i<=strlen(s)-2;i++)
	{
		if(s[i]=='C'){f=1;g=i;}
	}
	if(s[0]=='A')f++;
	for(int i=1;i<strlen(s);i++)
	{
		if(i!=g)
		{
			if(s[i]>='A'&&s[i]<='Z')f=0;
		}
	}
	if(f==2)printf("AC\n");
	else printf("WA\n");
	return 0;
}

Measured memory_bytes: 256
//https://atcoder.jp/contests/abc145/tasks/abc145_d
//D - Knight
#include <bits/stdc++.h>
#if LOCAL
#include "dump.hpp"
#else
#define dump(...)
#endif
using namespace std;
using ll=long long;
const ll LINF = 0x1fffffffffffffff;
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
template<class T>bool chmax(T &a, const T &b) {if (a<b) { a=b; return 1; } return 0;}
template<class T>bool chmin(T &a, const T &b) {if (b<a) { a=b; return 1; } return 0;}

template<uint32_t M = 1000000007>
struct modint{
    using u64 = std::uint_fast64_t;
    u64 val;
    modint(): val(0){}
    template<typename T>
    modint(T t){t %= (T)M; if(t < 0) t += (T)M; val = t;}

    modint pow(ll k) const {
        modint res(1), x(val);
        while(k){
            if(k&1) res *= x;
            x *= x;
            k >>= 1;
        }
        return res;
    }
    template<typename T>
    modint& operator=(T t){t %= (T)M; if(t < 0) t += (T)M; val = t; return *this;}
    modint inv() const {return pow(M-2);}
    modint& operator+=(modint a){val += a.val; if(val >= M) val -= M; return *this;}
    modint& operator-=(modint a){if(val < a.val) val += M-a.val; else val -= a.val; return *this;}
    modint& operator*=(modint a){val = (u64)val*a.val%M; return *this;}
    modint& operator/=(modint a){return (*this) *= a.inv();}
    modint operator+(modint a) const {return modint(val) +=a;}
    modint operator-(modint a) const {return modint(val) -=a;}
    modint operator*(modint a) const {return modint(val) *=a;}
    modint operator/(modint a) const {return modint(val) /=a;}
    modint operator-(){return modint(M-val);}
    bool operator==(const modint a) const {return val == a.val;}
    bool operator!=(const modint a) const {return val != a.val;}
    bool operator<(const modint a) const {return val < a.val;}
    constexpr u64 &value() noexcept { return val; }
    constexpr const u64 &value() const noexcept { return val; }
    friend ostream& operator<<(ostream& os, const modint& dt){
        os<<dt.val;
        return os;
    }
};
constexpr ll MOD=1e9+7;
using mint = modint<MOD>;

int main() {
#if LOCAL&0
  std::ifstream in("./test/sample-1.in");
  //std::ifstream in("./input.txt");
  std::cin.rdbuf(in.rdbuf());
#else
  cin.tie(0);
  ios::sync_with_stdio(false);
#endif
  ll X,Y; cin>>X>>Y;
  ll bb=(2*X-Y)/3;
  ll aa=X-2*bb;
  ll ab=aa+bb;
  dump(aa,bb,ab);

  if (X!=aa+2*bb || Y!=2*aa+bb || aa<0 || bb<0){
    cout<<0<<endl;
    return 0;
  }

  auto ncr = [](ll n,ll r)->mint{
    mint a=1,b=1;
    REP(i,r){
      a *=(n-i);
    }
    REP(i,r){
      b *=(i+1);
    }
    return a/b;
  };

  auto ans=ncr(ab,aa);
  cout<<ans<<endl;
  return 0;
}

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

long long dp[110][100100];

int main(){
  long long n,w;
  cin >> n >> w;
  vector<long long> weight(n),value(n);
  long long v=100100;
  for(long long i=0;i<n;++i){
    cin >> weight[i] >> value[i];
  }
  for(long long i=0;i<110;++i){
    for(long long j=0;j<100100;++j){
      dp[i][j]=1LL<<60;
    }
  }
  dp[0][0]=0;
  for(long long i=0;i<n;++i){
    for(long long j=0;j<v;++j){
      if(j>=value[i])dp[i+1][j]=min(dp[i+1][j],dp[i][j-value[i]]+weight[i]);

      dp[i+1][j]=min(dp[i+1][j],dp[i][j]);
    }
  }
  long long cal=0;
  for(long long i=0;i<v;++i){
    if(dp[n][i]<=w) cal=i;
  }
  cout << cal << endl;
  return 0;
}


Measured memory_bytes: 86272
#include <bits/stdc++.h>
using namespace std;
using Int = long long;

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

    int n; cin>>n; int a[n]; Int a1=0,s1=0,a2=0,s2=0;
    for (int i = 0; i < n; i++){
        cin>>a[i]; 
        s1+=a[i]; s2+=a[i];
        if(i%2){
            if(s1>=0){a1+=1+s1; s1=-1;}
            if(s2<=0){a2+=1-s2; s2=1;}
        }else{
            if(s1<=0){a1+=1-s1; s1=1;}
            if(s2>=0){a2+=1+s2; s2=-1;}
        }
    }
    cout<<min(a1,a2)<<'\n';
}

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

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define MX              200005
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define pw(b,p)         pow(b,p) + 0.1
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

void c_p_c()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
}

int _mergeSort(int arr[], int temp[], int left, int right);  
int merge(int arr[], int temp[], int left, int mid, int right);  
  

int mergeSort(int arr[], int array_size)  
{  
    int temp[array_size];  
    return _mergeSort(arr, temp, 0, array_size - 1);  
}  
  

int _mergeSort(int arr[], int temp[], int left, int right)  
{  
    int mid, inv_count = 0;  
    if (right > left)  
    {  
        
        mid = (right + left) / 2;  
  
        
        
        inv_count = _mergeSort(arr, temp, left, mid);  
        inv_count += _mergeSort(arr, temp, mid + 1, right);  
  
        
        inv_count += merge(arr, temp, left, mid + 1, right);  
    }  
    return inv_count;  
}  
  

int merge(int arr[], int temp[], int left,  
                        int mid, int right)  
{  
    int i, j, k;  
    int inv_count = 0;  
  
    i = left; 
    j = mid; 
    k = left; 
    while ((i <= mid - 1) && (j <= right))  
    {  
        if (arr[i] <= arr[j]) 
        {  
            temp[k++] = arr[i++];  
        }  
        else 
        {  
            temp[k++] = arr[j++];  
  
            
            inv_count = inv_count + (mid - i);  
        }  
    }  
  
    
    while (i <= mid - 1)  
        temp[k++] = arr[i++];  
  
    
    while (j <= right)  
        temp[k++] = arr[j++];  
  
    
    for (i = left; i <= right; i++)  
        arr[i] = temp[i];  
  
    return inv_count;  
}  

int32_t main()
{
    //c_p_c();
    int n,k; cin>>n>>k;
    mk(arr,n,int);

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

    int ans = mergeSort(arr,n);

    ans %= mod;
    ans *= k;
    ans %= mod;

    int lesser=0;
    int last_freq=1;
    int cur=0;

    for(int i=1;i<n;++i)
    {
    	if(arr[i-1]<arr[i])
    		lesser+=last_freq,last_freq=1;
    	else
    		last_freq++;

    	cur += lesser;
    }

    int times = k*(k-1);
    times/=2;
    times %= mod;
    cur *= times;
    cur %= mod;
    ans += cur;
    ans %= mod;

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

Measured memory_bytes: 256