akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<cmath>
const int MaxN=3010;
const double PI=acos(-1);
int N,L,T[MaxN];
struct comp{
	double re,im;
	comp operator+(const comp&a)const{return(comp){re+a.re,im+a.im};}
	comp operator-(const comp&a)const{return(comp){re-a.re,im-a.im};}
	comp operator*(const comp&a)const{return(comp){re*a.re-im*a.im,re*a.im+im*a.re};}
	comp operator*(double a)const{return(comp){re*a,im*a};}
	double len(){return sqrt(re*re+im*im);}
}sum[MaxN];
comp uni(double t){
	return(comp){cos(2*PI*t/L),sin(2*PI*t/L)};
}
int main(){
	scanf("%d%d",&N,&L);
	for(int i=0;i<N;i++)scanf("%d",T+i);
	comp ans=(comp){0,0};
	for(int i=0;i<N;i++){
		sum[i+1]=sum[i]+uni(T[i]*0.5);
		//printf("uni[%d]=%lf+%lfi\n",i,(sum[i+1]-sum[i]).re,(sum[i+1]-sum[i]).im);
	}
	for(int i=0;i<N;i++){
		comp oi=uni(T[i]);
		for(int j=i+1;j<N;j++){
			comp o=uni((T[i]+T[j])*0.5);
			double r=(o-oi).len();
			/*
			printf("i=%d j=%d o=%lf+%lfi oi=%lf+%lfi r=%lf sum=%lf+%lfi uni=%lf+%lfi add=%lf+%lfi\n",i,j,o.re,o.im,oi.re,oi.im,r,
				(sum[N]-sum[j+1]).re,(sum[N]-sum[j+1]).im,
				(uni(L*0.25+(T[i]+T[j])*0.25)).re,
				uni(L*0.25+(T[i]+T[j])*0.25).im,
				((sum[N]-sum[j+1])*uni(L*0.25+(T[i]+T[j])*0.25)*r).re,
				((sum[N]-sum[j+1])*uni(L*0.25+(T[i]+T[j])*0.25)*r).im);*/
			ans=ans+o*(N-j-1.0)+(sum[N]-sum[j+1])*uni(L*0.25+(T[i]+T[j])*0.25)*r;
		}
	}
	ans=ans*(1.0/(N*(N-1ll)*(N-2ll)/6));
	printf("%.12lf %.12lf\n",ans.re,ans.im);
}

Measured memory_bytes: 512
def wczytaj_liste(): 
    wczytana_lista = input()
    lista_znakow = wczytana_lista.split()
    ostateczna_lista = []
    for element in lista_znakow:
        ostateczna_lista.append(int(element))
    return ostateczna_lista 

def NWD(A,B): 
    if B == 0: 
        return A
    else: 
        return NWD(B, A%B)  

def nww(x, y): 
    return x*y // NWD(x,y)

def pol_wielokrotnosci(): 
    N, M = wczytaj_liste()
    A = wczytaj_liste()
    potega_2 = A[0]&-A[0]
    for liczba in A:
        if liczba&-liczba != potega_2:
            print(0)
            return
    najmiejsza_wspolna_listy = A[0]
    for i in range(1,len(A)):
        najmiejsza_wspolna_listy = nww(najmiejsza_wspolna_listy, A[i])
        if najmiejsza_wspolna_listy//2 > M:
            print(0)
            return     
    odp = (M - najmiejsza_wspolna_listy//2) // najmiejsza_wspolna_listy + 1
    print(odp)

pol_wielokrotnosci()

Measured memory_bytes: 63984
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  a,b,h,m=LI()

  x=30*h+m/2
  y=360*(m/60)
  sita=abs(x-y)
  if sita>180:
    sita=360-sita

  z=a*a+b*b-(2*a*b*math.cos(sita*math.pi/180))
  return math.sqrt(z)

# main()
print(main())


Measured memory_bytes: 11072
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<math.h>
#include<map>
#include<iomanip>
#include<functional>

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

#define rep(i,n,m) for(long long int i=n;i<(long long int)(m);i++)


int main() {


	signed long long int n;
	cin >> n;
	vector <signed long long int> num(n);
	signed long long int x = 0;
	signed long long int y = 0;
	signed long long int tmp, sub;

	rep(i, 0, n) {
		cin >> num[i];
		y += num[i];
	}

	x += num[0];
	y -= num[0];

	sub = abs(x-y);
	

	if (n == 2) {
		cout << abs(num[0] - num[1]) << endl;
		return 0;
	}

	signed long long int k = 1;
	while (k<n-1){

		x += num[k];
		y -= num[k];
		tmp = abs(x - y);
		if (tmp < sub)sub = tmp;
		k++;
	}

	cout << sub << endl;


	return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
    string a,b;
    cin>>a>>b;
    vector<char> chA(a.size());
    vector<char> chB(b.size());
    REP(i,a.size())chA[i]=a[i];
    REP(i,b.size())chB[i]=b[i];

    sort(chA.begin(),chA.end());
    sort(chB.begin(),chB.end());
    bool is=false;
    REP(i,a.size()){
        is=false;
        int index;
        REP(y,chB.size()){
            if(chA[i]<chB[y]){
                printf("Yes\n");
                return 0;
            }
            if(chA[i]==chB[y]){
                index=y;
                is=true;
            }
        }
        if(is)chB.erase(chB.begin()+index);
    }
    if(is&&a.size()!=b.size()) printf("Yes\n");
    else printf("No\n");
}

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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// グラフの辺表現
using Edge = map<pair<int,int>,int>;

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

// 最大公約数
ll gcd(ll a,ll b){
   if (a%b == 0) return(b);
   else return(gcd(b, a%b));
}

// 最小公倍数
ll lcm(ll a, ll b){
    return a/gcd(a, b) * b;
}

int main()
{
    cout << fixed << setprecision(15);

    ll N, M;
    cin >> N >> M;
    dsu d(N);

    for (ll i = 0; i < M; i++) {
        ll a, b;
        cin >> a >> b;
        a--;
        b--;
        d.merge(a, b);
    }
    vector<vector<int>> ans = d.groups();

    cout << ans.size() - 1 << endl;
    return 0;
}

Measured memory_bytes: 8864
#include<bits/stdc++.h>
#define ll long long
#define inf 1000000000
#define mp make_pair
#define pii pair<int,int>
#define pb push_back
#define r1 rt<<1
#define r2 rt<<1|1
#define ri register int
#define rep(i,a,b) for(ri i=(a);i<=(b);++i)
#define rep2(i,a,b,c) for(ri i=(a);i<=(b);i+=(c))
#define REP(i,a,b) for(ri i=(a);i>=(b);--i)
#define REP2(i,a,b,c) for(ri i=(a);i>=(b);i-=(c))
using namespace std;

inline int read(){
	ri x=0,f=1;char c=getchar();
	while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
	while(c>='0'&&c<='9') x=(x<<1)+(x<<3)+(c^'0'),c=getchar();
	return x*f;
}
inline void write(ri x){
	if(x<0) putchar('-'),x=-x;
	if(x>9) write(x/10);
	putchar(x%10+'0');
}

const int N=1005;
int a[N][N],b[N];
bool g[N][N],vis[N];
int main()
{
	ri n=read();
	rep(i,1,n)
		rep(j,1,n-1)
			a[i][j]=read();
	vector<pii> v,v2;
	rep(i,1,n){
		ri x=a[i][1];
		g[i][x]=1,b[i]=1;
		if(vis[i]||vis[x]) continue;
		if(g[x][i]) v.pb(mp(i,x)),vis[i]=1,vis[x]=1;
	}
	ri tot=0,ti=0,sz;bool ok=1;
	while(1){
		++ti;bool f=0;
		sz=v.size();
		rep(i,0,sz-1) vis[v[i].first]=vis[v[i].second]=0;
		rep(i,0,sz-1){
			ri x=v[i].first,y=v[i].second,z;
			g[x][y]=g[y][x]=0;
			++b[x];++b[y];
			if(b[x]==n) ++tot;
			else{
				z=a[x][b[x]];
				g[x][z]=1;
				if(!vis[x]&&!vis[z]){
					if(g[z][x]){
						f=1;
						v2.pb(mp(x,z));
						vis[x]=vis[z]=1;
					}
				}
			}
			if(b[y]==n) ++tot;
			else{
				z=a[y][b[y]];
				g[y][z]=1;
				if(!vis[y]&&!vis[z]){
					if(g[z][y]){
						f=1;
						v2.pb(mp(y,z));
						vis[y]=vis[z]=1;
					}
				}
			}
		}
		if(tot==n) break;
		if(!f){
			ok=0;break;
		}
		v.clear();
		v=v2;v2.clear();
	}
	if(ok)write(ti);
	else puts("-1");
	return 0; 
}

Measured memory_bytes: 5120
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define ff first
#define ss second
#define pii pair <int,int>
#define pll pair <ll,ll>
#define testcase() int t; cin>>t; while(t--)
#define forn(i,n) for(int i=0;i<n;i++)
#define forn1(i,n) for(int i=1;i<=n;i++)
#define vll vector <ll>
#define all(v) v.begin(),v.end()

ll M = 1e9 + 7;
double pi = acos(-1.0);
ll powerm(ll x,ll y){ ll res=1; while(y){ if(y&1) res=(res*x)%M; y=y>>1; x=(x*x)%M;} return res%M; }
ll power(ll x,ll y){ ll res=1; while(y){ if(y&1) res=(res*x); y=y>>1; x=(x*x);} return res; }
ll max3(ll a,ll b,ll c){ return max( max(a,b),c ); }
ll gcd(ll a,ll b){if(b>a)return gcd(b,a); if(b==0)return a; return gcd(b,a%b);}

int main() {
	
	//ifstream cin("input.txt");
	//ofstream cout("output.txt");
	ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
	
	int n; cin>>n;
	ll h[n+1]; forn1(i,n) cin>>h[i];
	ll dp[n+1]; dp[0] = 0;
	dp[1] = 0; dp[2] = abs(h[2]-h[1]);
	for(int i=3;i<=n;i++)
	{
	    dp[i] = min( dp[i-1] + abs(h[i]-h[i-1]) , dp[i-2] + abs(h[i]-h[i-2]) );
	}
	cout<<dp[n];
	
	return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define f(i, n) for (int i = 0; i < n; i++)
#define ff first
#define ss second
#define int long long int
#define mii map<int, int>
#define vi vector<int>
#define fi(i, a, n)             \
    for (int i = 0; i < n; i++) \
    {                           \
        cin >> a[i];            \
    }
#define fo(i, a, n)             \
    for (int i = 0; i < n; i++) \
    {                           \
        cout << a[i] << " ";    \
    }
#define pqb priority_queue<int>
#define pqs priority_queue<int, vi, greater<int>>
#define setbits(x) __builtin_popcountll(x)
#define zrobits(x) __builtin_ctzll(x)
#define mod 1000000007
#define inf 1e18
#define mk(arr, n, type) type *arr = new type[n];
#define pw(b, p) pow(b, p) + 0.1
#define w(x)  \
    int x;    \
    cin >> x; \
    while (x--)
#define lbrk printf("\n")

using namespace std; //_S_A_R_T_H_A_k_//
/// JAI SHREE RAM!!! ;{'*' <_l_> '*' };
/// Saare jahan se acha hindustan humara .....
/// JAI HIND DOSTON //-__ -//
void lcsBU(string s1,string s2,int n,int m){
    int dp[n+1][m+1] = {0};
    for (int  i = 0; i <= n; i++)
    {
        for (int  j = 0; j <= m; j++)
        {
             if(i==0 || j == 0)
            {
                dp[i][j] = 0;
                continue;
            }
 
           if(s1[i-1]==s2[j-1]){
              /// v.push_back(s1[i-1]);
               dp[i][j] = 1 + dp[i-1][j-1];
           }
           else
           {
               dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
           }
        }        
        }
    //    return dp[s1.size()][s2.size()];
    int i = n;
    int j = m;
    string res;
    while (i>0 and j>0)
    {
        if(s1[i-1]==s2[j-1]){
            res = s1[i-1] + res;
        i--;j--;
        }
        else if (dp[i-1][j]>dp[i][j-1]){
        i--;
        }
        else{
        j--;
        }
    }
    cout<<res<<endl;
}
int32_t main()
{
    ios_base::sync_with_stdio(0);
    string s1, s2;
    cin>>s1>>s2;
 int n =s1.length();
 int m = s2.length();
   lcsBU(s1,s2,n,m);
}

Measured memory_bytes: 70656
#include<stdio.h>
int main(){
  int l,i,cnt=0;
  scanf("%d",&l);
  char str[l];
  scanf("%s",str);
  for(i=0;i<l;i++){
    if(str[i]=='A'){
      if(str[i+1]=='B'&&str[i+2]=='C'){
        cnt++;
        i+=2;
      }
    }
  }
  printf("%d",cnt);
  return 0;
}


Measured memory_bytes: 128
N, X = map(int, input().split())
dp_layer = [1] * (N + 1)
dp_numP = [1] * (N + 1)

for i in range(1, N + 1):
	dp_layer[i] = 3 + 2 * dp_layer[i - 1]
	dp_numP[i] = 1 + 2 * dp_numP[i - 1]
	
x = X
countP = 0
i = N

while x > 0:
	if x >= dp_layer[i]:
		x -= dp_layer[i]
		countP += dp_numP[i]
		if x > 0:
			x -= 1
			countP += 1
	else:
		i -= 1
		x -= 1
		
print(countP)

Measured memory_bytes: 38384
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,b,a) for(int i=b;i>=a;i--)
#define fori(a) for(auto i : a )
#define all(a) begin(a), end(a)
#define set(a,b) memset(a,b,sizeof(a))
#define sz(a) a.size()
#define pi 3.14159
#define ll long long
#define ull unsigned long long
#define pb push_back
#define PF push_front //deque
#define mp make_pair
#define pq priority_queue
#define mod 1000000007
#define f first
#define s second
#define pii pair< int, int >
#define vi vector<int>
#define vpii vector<pii>
#define debug(v) for(auto i:v) cout<<i<<" ";
#define tc int t; cin >> t; while(t--)

using namespace std;
string repeat(string s, int n) {
    string s1 = "";
    for (int i=0; i<n;i++)
        s1+=s;
    return s1;
}
string getString(char x) {
    string s(1, x);
    return s;
}

void optimizeIO(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}
int gcd(int a, int b){
    if (a == 0)  return b;
    return gcd(b % a, a);
}
void solve(){
  int n;
  cin>>n;
  int a[n];
  rep(i,0,n) cin>>a[i];
  int mx=0;
  ll ans=0;
  rep(i,0,n){
    if(a[i]>=mx){
      mx=max(mx,a[i]);
    }
    else{
      // cout<<mx<<" "<<a[i]<<endl;
      ans+= mx-a[i];
      mx=max(mx,a[i]);
    }
  }
  cout<<ans<<endl;
}
int main(){
    optimizeIO();
    // tc
    { solve();
    }
}


Measured memory_bytes: 4424
#include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;
 
int n,dp[100005][5],a[100005][5],k; 
int main(){
	scanf("%d",&n);
	for (int i=1;i<=n;i++){
		scanf("%d %d %d",&a[i][1],&a[i][2],&a[i][3]);
	}
	dp[1][1]=a[1][1]; dp[1][2]=a[1][2]; dp[1][3]=a[1][3];
	for (int i=2;i<=n;i++){
		dp[i][1]=max(dp[i-1][2]+a[i][1],dp[i-1][3]+a[i][1]);
		dp[i][2]=max(dp[i-1][1]+a[i][2],dp[i-1][3]+a[i][2]);
		dp[i][3]=max(dp[i-1][1]+a[i][3],dp[i-1][2]+a[i][3]);
	}
	printf("%d\n",max(max(dp[n][1],dp[n][2]),dp[n][3]));
	return 0;
} 

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

#ifndef LOCAL_
#define fprintf if( false ) fprintf
#endif // LOCAL_
#define dump() fprintf(stderr, "#%s.%d\n", __func__, __LINE__);
#define dumpl(x1) fprintf(stderr, "#%s.%d (%s) = (%ld)\n", __func__, __LINE__, #x1, x1);
#define dumpll(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%ld, %ld)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define dumplll(x1, x2, x3) fprintf(stderr, "#%s.%d (%s, %s, %s) = (%ld, %ld, %ld)\n", __func__, __LINE__, #x1, #x2, #x3, x1, x2, x3);
#define dumpd(x1) fprintf(stderr, "#%s.%d (%s) = (%lf)\n", __func__, __LINE__, #x1, x1);
#define dumpdd(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%lf, %lf)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define loop for(;;)
typedef int64_t Int;
typedef std::vector<Int> LI;
typedef std::queue<Int> QI;
#define rep(i,n) for(Int i = 0; i < (Int)n; ++i)
const double pi = 3.14159265358979323846264338;
const Int mod = 1000000007;

template<typename T> void scan1(T& x) { fprintf(stderr, "unknown type\n"); }
template<> void scan1(Int& x) { if( scanf("%" PRId64, &x) < 0 ) exit(0); }
template<> void scan1(std::string& x) { if( not ( std::cin >> x ) ) exit(0); }
template<> void scan1(LI& xs) { for(Int &x : xs) scan1(x); }
void scan() {}
template<typename Head, typename... Tail>
void scan(Head& x, Tail&... xs) {
  scan1(x); scan(xs...);
}

struct Solver {
   Solver() { fprintf(stderr, "--------Solver begin--------\n"); }
   ~Solver() { fprintf(stderr, "--------Solver end--------\n"); }
   void solve() {
      std::string ss; scan(ss);
      for(Int i = 0; i < (Int)ss.size(); i+=2) {
         putchar(ss[i]);
      }
      putchar('\n');
   }
};

int main() {
   loop std::unique_ptr<Solver>(new Solver())->solve();
}




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

int main() {
    using vi = vector<int>;
    
    int x;
    cin >> x;
    int a = x/500;
    int b = x%500/5;
    cout << a * 1000 + b * 5 << endl;
}

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

int main() {
	int n,ans;
	long long k,sum=0;
	vector<pair<int,int>> a;
	cin >> n >> k;
	a.resize(n);
	REP(i,n){
		cin >> a[i].first >> a[i].second;
	}
	sort(a.begin(),a.end());
	REP(i,n){
		sum += a[i].second;
		ans = i;
		if(k <= sum)break;
	}
	cout << a[ans].first;
	return(0);
}

Measured memory_bytes: 1024
N, M = map(int, input().split())
shops = [list(map(int, input().split())) for _ in range(N)]
shops.sort(key=lambda x: x[0])
cost = 0
for shop in shops:
	cost += shop[0] * shop[1] if M >= shop[1] else shop[0] * M
	M -= shop[1]
	if not M > 0:
		break
print(cost)


Measured memory_bytes: 29020
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <bitset>
#include <set>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define all(i,n) (i),(i+n)

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

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

const int INF = 1e9;
const ll LLINF = 1e18;
const int MAX_V = 1e6+1;
const ll mod = 1000000007;

// --------------------------------------
int n;

int counter(int a) {
  int count = 0;
  REP(i, n) {
    if(a & (1 << i)) count++;
  }
  return count;
}

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

  cin >> n;
  vector<vector<int>> v(n + 1, vector<int>(n, -1));

  REP(i, n) {
    int a;
    cin >> a;
    REP(j, a) {
      int b, c;
      cin >> b >> c;
      b--;
      v[i][b] = c;
    }
  }

  int ans = 0;
  FOR(i, 1, 1 << n) {
    vector<int> s(n);
    REP(j, n) s[j] = (i>>j & 1);
    bool f = true;

    REP(j, n) {
      if(s[j]) {
        REP(k, n) {
          if(v[j][k] == -1) continue;
          else if(v[j][k] != s[k]) f = false;
        }
      }
    }

    if(f) ans = max(ans, counter(i));
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define FASTIO std::ios::sync_with_stdio(false);
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define inf 1e18
#define g(x) cout<<x<<" "<<endl;
#define gg(x,y) cout<<x<<" & "<<y<<" "<<endl
#define jam(t) cout<<"Case #"<<t<<": "
#define ggg(x,y,z) cout<<x<<" & "<<y<<" & "<<z<<" "<<endl
#define all(x) x.begin(),x.end()
#define input_from_file  freopen("input.txt", "r", stdin);
#define mod 1000000007ll
#define sz 400005
#define bitcnt(x) __builtin_popcountll(x)
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}



void solve(){
    ll tar;
    cin >> tar;
    ll now = 100;
    ll an = 0;
    while(now < tar){
        now = now + now/100;
        an++;
    }
    g(an);
}
int main()
{
#ifndef ONLINE_JUDGE
input_from_file
#endif
 
    FASTIO
    cin.tie(NULL);
    fflush(stdout);
    ll t = 1;
   // cin >> t;
    for(ll tcase = 1;tcase <= t;tcase++){
        solve();
        
    }
return 0;
}

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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repr(i, n) for(int i = (int)(n); i >= 0; i--)
#define repm(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define repmr(i, m, n) for(int i = (int)(n); i >= (int)(m); i--)
#define all(x) (x).begin(),(x).end()
#define inf 2e9
#define MOD 1000000007

using namespace std;
typedef long long ll;

int main(){
  int h,w,k; cin >> h >> w >> k;
  vector<vector<bool>> isBerry(w, vector<bool>(h, false));
  rep(i,h){
    rep(j,w){
      char s; cin >> s;
      if(s == '#') isBerry[j][i] = true;
    }
  }

  int cnt = 0;
  vector<vector<int>> ans(w, vector<int>(h));
  bool all_foundBerry = false;
  stack<vector<int>> white_s;
  rep(i,w){
    queue<vector<int>> q;
    bool foundBerry = false;
    rep(j,h){
      if(isBerry[i][j]){
        foundBerry = true;
        all_foundBerry = true;
        cnt++;
        ans[i][j] = cnt;
        while(!q.empty()){
          vector<int> now = q.front();
          q.pop();
          ans[now[0]][now[1]] = cnt;
        }
      }
      else if(foundBerry){
        ans[i][j] = cnt;
      }
      else{
        q.push({i,j});
      }
    }
    
    while(!q.empty() && all_foundBerry){
      vector<int> now = q.front();
      q.pop();
      ans[now[0]][now[1]] = ans[now[0]-1][now[1]];
    }
    while(!q.empty() && !all_foundBerry){
      white_s.push(q.front());
      q.pop();
    }
    while(!white_s.empty() && all_foundBerry){
      vector<int> now = white_s.top();
      white_s.pop();
      ans[now[0]][now[1]] = ans[now[0]+1][now[1]];
    }
  }

  rep(i,h){
    rep(j,w){
      cout << ans[j][i] << " ";
    }
    cout << endl;
  }


}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long ll;
template<class T>inline bool chmax(T &a, const T &b){if(a < b){a = b; return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if(a > b){a = b; return 1;}return 0;}
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  // ABC114B - 754
  // 1, 2, …, 9からなる文字列S、連続する3個の数字を取り出す、753の差の絶対値の最小
  // 上から順に3個の数字を見て、753の差の絶対値の最小を更新する
  string S; cin >> S;
  int N = S.size();
  int tmp, ans = 1e6;
  REP(i, N-2){
    tmp = (S[i] - '0')*100 + (S[i+1] - '0')*10 + (S[i+2] - '0');
    ans = min(ans, abs(753-tmp));
  }
  cout << ans << endl;
}




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

#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define REP(i,n) FOR(i,0,n)
using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vvvi = vector<vector<vector<int>>>;
using mii = map<int, int>;
using msi = map<string, int>;
using pii = pair<int, int>;

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

    int n, x;
    cin >> n >> x;
    vi a(n);
    REP(i, n) cin >> a[i];

    ll ans = 0;
    REP(i, n - 1) {
        int s = a[i] + a[i + 1];
        if(s > x) {
            ans += s - x;
            a[i + 1] = max(0, a[i + 1] - (s - x)); 
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <math.h>

using namespace std;

int main()
{

    char S[10];
    cin >>S;
    int mojisuu =0;
    int csuu = 0;
    int i=0;
    int cbasho=0;
    int omojihantei=0;
    for(i=0;S[i]!='\0';i++){
        mojisuu = mojisuu +1;
    }
    
    for(i=2;i<mojisuu-1;i++)
        {
            if(S[i]=='C'){
                cbasho = i;
                csuu++;
            }
        }
    for(i=1;i<cbasho;i++)
    {
        if((S[i]>='A')&&(S[i]<='Z')){
            omojihantei++;
        }
    }
    for(i=cbasho+1;i<mojisuu;i++)
    {
        if((S[i]>='A')&&(S[i]<='Z')){
            omojihantei++;
        }
    }
    if(S[0]!='A')
    {
        cout <<"WA"<<endl;
    }
    else if(csuu!=1)
    {
        cout <<"WA"<<endl;
    }
    else if(omojihantei!=0)
    {
         cout <<"WA"<<endl;
    }
    else{
        cout <<"AC"<<endl;
    }
   // cout << csuu<<"   "<<omojihantei<<endl;
    
    return 0;
}

Measured memory_bytes: 256
/* C++ Program to Find the Frequency of Characters in a String */

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

int main()
{
    string s;
    int i;
    int fre[365] = {0};
    cin>>s;
    for(i=0;s[i]!='\0';i++)
    {
        fre[s[i]]++;
    }

    int cnt = 0;
    for(i=0;i<365;i++)
    {
        if(fre[i]%2!=0)
        {
            cnt = 1;
            break;
        }
    }

    if(cnt==1)
        cout<<"No"<<endl;
    else
        cout<<"Yes"<<endl;
}


Measured memory_bytes: 3564
#include <iostream>
using namespace std;
int main(void){
    int b,c,d,e,t,kooricount,a,C;
    cin>>a;
    cin>>b;
    cin>>c;
    cin>>d;
    cin>>e;
    t=0;
    C=a;
    kooricount=0;
    while(1){
        if(C>=b){
            break;
        }
        if(C<0){
            t+=c;
            C++;
        }else if(C==0&&kooricount==0){
            t+=d;
            kooricount++;
        }else{
            t+=e;
            C++;
        }
    }
    cout<<t<<endl;
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef double dd;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;

const int mx=1e6+11;
const double PI = acos(-1);
#define MOD 1000000007


#define nl '\n'
#define pb push_back
#define F first
#define S second
#define I insert
#define mp make_pair

#define sz(x) x.size()
#define tt int t; cin>>t; while(t--)
#define lo(i,a,b) for(int i=a;i<b;i++)
#define rlo(i,n) for(int i=n-1;i>=0;i--)
#define be(a) (a).begin(),(a).end()
#define rbe(a) (a).rbegin(),(a).rend()
#define mem(a,b) memset(a,b,sizeof(a))
#define pr(a) {for(auto x:a)cout<<x<<" ";cout<<nl;}

#define su ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define frac cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);

#define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0)
void faltu () {            cerr << endl;}
template < typename T, typename ... hello>void faltu( T arg, const hello &... rest) {cerr << arg << ' ';faltu(rest...);}

void f()
{
  int a,b;
  cin>>a>>b;
  if(a==2||b==2)
    cout<<"No\n";
  else
    cout<<"Yes\n";
}

int main()
{
    su;
    f();
    return 0;
}


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

using namespace std;

typedef long double ld;
typedef long long ll;

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

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

int n, res = 0;
vector<int> v;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> n; v.assign(n, 0);
    for(int i = 0; i < n; ++i){
        cin >> v[i];
    }
    for(int i = 0; i < n; ++i){
        for(int j = i + 1; j < n; ++j){
            for(int k = j + 1; k < n; ++k){
                if(v[i] != v[j] && v[j] != v[k] && v[i] != v[k]){
                    res += (v[i] < v[j] + v[k]) && (v[j] < v[i] + v[k]) && (v[k] < v[i] + v[j]);
                }
            }
        }
    }
    cout << res;
    return 0;
}

Measured memory_bytes: 3668
// A.cpp
#include <bits/stdc++.h>

using namespace std;

const int MAX_N = 2e5 + 200;

int n, A, B, C, D;
char S[MAX_N];

int main()
{
	scanf("%d%d%d%d%d%s", &n, &A, &B, &C, &D, S + 1);
	// judge the blocks;
	bool ans = true;
	ans &= (S[A] == '.' && S[B] == '.' && S[C] == '.' && S[D] == '.');
	int cnt = 0;
	for (int i = A; i <= C; i++)
		cnt += S[i] == '#', cnt = (S[i] == '.' ? 0 : cnt), ans &= cnt <= 1;
	cnt = 0;
	for (int i = B; i <= D; i++)
		cnt += S[i] == '#', cnt = (S[i] == '.' ? 0 : cnt), ans &= cnt <= 1;
	// if intersect;
	int l = max(A, B), r = min(C, D);
	if (A <= B && D <= C)
	{
		bool verdict = false;
		if (A < B && S[l - 1] == '.')
			cnt++;
		for (int i = l; i <= r; i++)
			cnt += S[i] == '.', cnt = (S[i] == '#' ? 0 : cnt), verdict |= cnt >= 3;
		if (cnt == 2 && D < C && S[r + 1] == '.')
			verdict |= true;
		ans &= verdict;
	}
	puts(ans ? "Yes" : "No");
	return 0;
}

Measured memory_bytes: 3932
#include <bits/stdc++.h>
#define N 101
#define prob "E"
#define pb push_back
#define ll long long
#define io freopen(prob".inp","r",stdin); freopen(prob".out","w",stdout);
#define fast ios_base::sync_with_stdio(1); cin.tie(nullptr); cout.tie(nullptr);
using namespace std;
int n,w[N],v[N],W,sum;
ll f[100001][N],ans=0;
int main()
{
    fast
//    io
    cin>>n>>W;
    for(int i=1; i<=100000; i++)
        for(int j=0; j<=n; j++)
            f[i][j]=W+1;
    for(int i=1; i<=n; i++)
        cin>>w[i]>>v[i],sum+=v[i];
    f[0][0]=0;
    for(ll i=1; i<=sum; i++)
    {
        for(int j=1; j<=n; j++)
        {
            f[i][j]=f[i][j-1];
            if(v[j]<=i)
                f[i][j]=min(f[i][j],(ll)f[i-v[j]][j-1]+w[j]);
            if(f[i][j]<=W)
                ans=max(ans,i);
         //   cout<<f[i][j]<<' ';
        }
        //cout<<endl;
    }
    cout<<ans;
}


Measured memory_bytes: 79104
#include <stdio.h>


int main(void)
{
	int i, buf, a=0, b=0;

	for(i=0; i<4; i++){
		scanf("%d", &buf);
		a += buf;
	}
	for(i=0; i<4; i++){
		scanf("%d", &buf);
		b += buf;
	}

	printf("%d\n", a>=b?a:b);

	return 0;
}

Measured memory_bytes: 592
K,N=map(int, input().split())
A=list(map(int, input().split()))

count = A[-1]-A[0]
def double(n):
     return n+K

B = map(double, A)
B = list(B)

i=0
while i<N-1:
    if B[i]-A[i+1] < count:
        count = B[i]-A[i+1]
    i+=1

print(count)

Measured memory_bytes: 26420
#include <stdio.h>
#include <math.h>
#define N 101

void MatrixChainOrder(int *);
int x = 0;

int main(){
  int p[N];
  int i;

  scanf("%d",&x);
  for(i = 0; i < x;i++){
  scanf("%d",&p[i]);
  scanf("%d",&p[i + 1]);
  }
  
  MatrixChainOrder(p);

  return 0;
}

void MatrixChainOrder(int *p){
  int m[N][N];
  int i, j, k, l, n, q;
  
  n = x;
  for(i = 1; i < n + 1; i++) m[i][i] = 0;
  for(l = 2; l < n + 1; l++){
    for(i = 1; i < n - l + 2; i++){
      j = i + l - 1;
      m[i][j] = pow(2, 31) - 1;
      for(k = i; k < j; k++){
	q = m[i][k] + m[k+1][j] + p[i-1]*p[k]*p[j];
	if(k == i || m[i][j] > q) m[i][j] = q;
      }
    }
  }
  printf("%d\n",m[1][n]);
}

Measured memory_bytes: 636
#include<bits/stdc++.h>
#define ll int
#define ld long double
#define fs first
#define sc second
#define task "tet"
using namespace std;
const ll N = 1e6 + 9;
const ll inf = 1e9 + 7;
typedef pair<ll,ll> LL;

ll n;

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    if (fopen(task".inp", "r")){
        freopen(task".inp", "r", stdin);
        //freopen(task".out", "w", stdout);
    }
    cin>>n;
    ll p = n%10;
    char c = p + '0';
    if (c == '2'||c == '4'||c == '5'||c == '7'||c == '9') cout<<"hon";
    if (c == '0'||c == '1'||c == '6'||c == '8') cout<<"pon";
    if (c == '3') cout<<"bon";
}


Measured memory_bytes: 3616
#include<iostream>
#include<string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <math.h>
#include<iomanip>
using namespace std;

int main()
{
    int N;
    cin >> N;
    vector<int> a;
    int temp;
    for (int i = 0; i < N; i++)
    {
        cin >> temp;
        a.push_back(temp);
    }
    int count_1=0;
    int count_2=0;
    int count_3=0;
    int flag = 0;
    if(N%3!=0){
        for (int i = 0; i < N; i++)
        {
            if(a[i]!=0)flag = 1;
        }
        if(flag ==1)cout << "No" << endl;
        else cout << "Yes" << endl;
        return 0;
    }
    else
    {
        sort(a.begin(),a.end());
    }
    /*for (int i = 0; i < N; i++)
    {
        cout << a[i] ;
    }
    cout<<endl;*/
    int num[3];
    if(a[0]!=0)
    {
        for (int i = 0; i < N; i++)
        {
            
            if(i>0){
                if(a[i]!=a[i-1])flag = flag+1;
            }

            if (flag==0)
            {
                num[0] = a[i];
                count_1 = count_1 + 1;
            }else if(flag==1){
                num[1] = a[i];
                count_2 = count_2 + 1;
            }else{
                num[2] = a[i];
                count_3 = count_3 + 1;
            }
            

        }

        if(count_1==count_2 && count_2 == count_3){
            if(num[0]==(num[1] ^ num[2]) && num[1] == (num[0] ^ num[2]) && num[2] == (num[0] ^ num[1])){
                cout << "Yes" << endl;
            }else{
                cout << "No" << endl;
            }
        }
        else cout << "No" << endl;
        
    }else
    {
        for (int i = 0; i < N; i++)
        {
            if(i>0){
                if(a[i]!=a[i-1]) flag = flag+1;
            }

            if (flag==0)
            {
                count_1 = count_1 + 1;
            }else if(flag==1)
            {
                count_2 = count_2 + 1;
            }
        }
        //cout << count_1 << count_2 <<flag << endl;
        if(count_2==2*count_1){
            cout <<"Yes" << endl;
            
        }else if(count_1 == N){
            cout <<"Yes" << endl;
        }
        else cout << "No" << endl; 
    }
    return 0;

    //cout << count_1 << cou
    
}

Measured memory_bytes: 892
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <utility>
#include <functional>
#include <iomanip>
#include <typeinfo>
#include <iterator>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <tuple>
#include <map>
#include <set>
#include <numeric>
using namespace std;


typedef long long       ll;
struct edge { ll to; ll cost; };
typedef vector<int>     vi;
typedef vector<ll>      vll;
typedef vector<double>  vd;
typedef vector<bool>    vb;
typedef vector<string>  vs;
typedef vector<char>    vc;
typedef vector<edge>    ve;
typedef pair<int, int>  pii;
typedef pair<ll, ll>    pll;
typedef vector<pii>     vpii;
typedef vector<pll>     vpll;
typedef vector<vll>		vvll;
typedef vector<vi>		vvi;
typedef vector<ve>      vve;
typedef vector<vc>		vvc;

#define repr(itr, bgn, end) for (ll itr = (ll)bgn; itr < (ll)end; ++itr)
#define rep(itr, end) repr(itr, 0, end)
#define reprrev(itr, bgn, end) for (ll itr = (ll)end - 1; itr >= (ll)bgn; --i)
#define reprev(itr, end) reprrev(itr, 0, end)
#define all(container) container.begin(), container.end()
#define sortall(container) sort(all(container))
#define yn(cond) cond ? (cout << "Yes" << endl) : (cout << "No" << endl)
#define YN(cond) cond ? (cout << "YES" << endl) : (cout << "NO" << endl)

// 定数
#define LLONG_MAX numeric_limits<ll>::max()
#define INT_MAX numeric_limits<int>::max()
constexpr double PI = 3.14159265358979323846;
constexpr ll INF = 1 << 15;
constexpr ll MOD = (ll)1e9 + 7;
constexpr double EPS = 1e-7;

// よく使うもの
constexpr int dy[4] = { 0, 1, 0, -1 };
constexpr int dx[4] = { 1, 0, -1, 0 };


// vector入力
template<typename T>
istream& operator >> (istream& is, vector<T>& vec) {
	for (T& x : vec) is >> x;
	return is;
}

// vector出力
template<typename T>
ostream& operator << (ostream& os, vector<T>& vec) {
	for (T& x : vec) os << x << " ";
	return os;
}



int main()
{
	int N, T;
	cin >> N >> T;
	vi c, t;
	rep(i, N) {
		int cc, tt;
		cin >> cc >> tt;
		if (tt <= T) {
			c.push_back(cc);
			t.push_back(tt);
		}
	}

	if (c.size() > 0) {
		sortall(c);
		cout << c[0] << endl;
	}
	else {
		cout << "TLE" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <stdio.h>
using namespace std;

double recurse(int N, int ones, int twos, int threes);
static double dp[301][301][301];

int main() {
    /*
    for (int i = 0; i < 903; i++) {
        for (int j = 0; j < 903; j++) {
            for (int k = 0; k < 903; k++) {
                dp[i][j][k] = -1.0;
            }
        }
    }

    printf("Done filling array\n");
    */
    int N;

    cin >> N;
    

    int ones = 0;
    int twos = 0;
    int threes = 0;

    for (int i = 0; i < N; i++) {
        int tmp;

        cin >> tmp;

        if (tmp == 1) {
            ones++;
        }
        else if (tmp == 2) {
            twos++;
        }
        else {
            threes++;
        }
    }

    cout << setprecision(15);
    cout << ones + twos * 2 + threes * 3 + recurse(N, ones, twos, threes) << endl;
}

double recurse(int N, int ones, int twos, int threes) {
    //Base case:
    if (ones == 0 && twos == 0 && threes == 0) {
        return 0.0;
    }

    if (dp[ones][twos][threes] != 0.0) {
        //printf("Used value here!\n");
        return dp[ones][twos][threes];
    }
    //Find probability of wasting a move
    int nonEmptyPlates = ones + twos + threes;
    double p_wasted = 1.0 - (double)nonEmptyPlates / N;

    double p1 = 0.0;
    double p2 = 0.0;
    double p3 = 0.0;

    //printf("State: ones = %d, twos = %d, threes = %d, p_wasted = %f\n", ones, twos, threes, p_wasted);

    if (ones > 0) {
        p1 = (double)ones / nonEmptyPlates * recurse(N, ones - 1, twos, threes);
    }

    if (twos > 0) {
        p2 = (double)twos / nonEmptyPlates * recurse(N, ones + 1, twos - 1, threes);
    }

    if (threes > 0) {
        p3 = (double)threes / nonEmptyPlates * recurse(N, ones, twos + 1, threes - 1);
    }

    dp[ones][twos][threes] =  p1 + p2 + p3 + p_wasted / (1 - p_wasted);
    return dp[ones][twos][threes];
    //return p1 + p2 + p3 + p_wasted / ((1 - p_wasted) * (1 - p_wasted)) * prob;
}

Measured memory_bytes: 111196
import java.io.PrintWriter;
import java.util.Scanner;

public class Main {
    static private Scanner scan = new Scanner(System.in);
    public static void main(String args[]) {
        int int1 = Integer.parseInt(scan.next());
//        int int2 = Integer.parseInt(scan.next());
//        int int3 = Integer.parseInt(scan.next());
//        String temp_str1 = "";
//        String temp_str2 = "";
        int temp_int1 = 0;
//        String str1 = scan.next();
        int ans_int = 0;
        String ans = "";
//        double ans_dob = 0;
        ans = "ABC" + int1;

        PrintWriter out = new PrintWriter(System.out);
        out.println(ans);
        out.flush();
        scan.close();
    }
}


Measured memory_bytes: 21844
A,B,M=map(int,input().split())
C=list(map(int,input().split()))
D=list(map(int,input().split()))
a=10**5
b=10**5
for i in range(A):
    if(C[i]<a):
        a=C[i]
for i in range(B):
    if(D[i]<b):
        b=D[i]
k=a+b
for i in range(M):
    x,y,c=map(int,input().split())
    if((C[x-1]+D[y-1]-c)<k):
        k=C[x-1]+D[y-1]-c
print(k)


Measured memory_bytes: 18688
object Main extends App {
  val scanner = new java.util.Scanner(System.in)
  val tempList: Seq[Seq[String]] = {
    for(line <- io.Source.stdin.getLines()) yield {
      line.split(' ').toSeq
    }
  }.toSeq

  val numList: Seq[Int] = tempList(0).map(_.toInt)
  //最初の3要素を抽出
  val zeroIndex: Int = numList.indexOf(0)

  println(zeroIndex + 1)
}

Measured memory_bytes: 55336
H,W = map(int,input().split())
N = int(input())
M = []
for _ in range(H):
  M.append([0]*W)
cr = 0
cc = 0
d = 1
for i,n in enumerate(map(int,input().split())):
  color = i+1
  for _ in range(n):
    M[cr][cc] = color
    if d == 1:
      if cc == W-1:
        cr += 1
        d = -d
      else:
        cc += 1
    else:
      if cc == 0:
        cr += 1
        d = -d
      else:
        cc -= 1
for i in range(H):
  print(' '.join(map(str,M[i])))

Measured memory_bytes: 3568
#include <bits/stdc++.h>
using namespace std;
signed gcd(long long x, long long y) {
    if (y == 0)return x;
    return gcd(y, x % y);
}
int main(){
  int N; cin>>N;
  long long ans=0;
  for(int i=0;i<N;i++){
    long long a; cin>>a;
    ans=gcd(a,ans);
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3644
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>
#include <time.h>
#include <tuple>
#include <limits.h>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e12;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE 100100
#define NIL -1
#define MAX_N 100100

double sq(double num) { return num*num; }
ll mod_pow(ll x, ll n) {
	if (n == 0)return 1;
	if (n == 1)return x%MOD;
	ll res = sq(mod_pow(x, n / 2));
	res %= MOD;
	if (n % 2 == 1) {
		res *= x;
		res %= MOD;
	}
	return res;
}
ll mod_add(ll a, ll b) { return (a + b) % MOD; }
ll mod_sub(ll a, ll b) { return (a - b + MOD) % MOD; }
ll mod_mul(ll a, ll b) { return a*b % MOD; }

int sum[5010][5010][2];
int n, k;

int main() {
	cin >> n >> k;
	rep(i, n) {
		int x, y;
		string s;
		cin >> x >> y >> s;
		sum[y % (2 * k)][x % (2 * k)][s == "B"]++;
		sum[y % (2 * k) + (2 * k)][x % (2 * k)][s == "B"]++;
		sum[y % (2 * k)][x % (2 * k) + (2 * k)][s == "B"]++;
		//sum[y % (2 * k) + k][x % (2 * k) + k][s == "B"]++;
		sum[y % (2 * k) + (2 * k)][x % (2 * k) + (2 * k)][s == "B"]++;
	}
	rep(i, 4 * k) {
		rep(j, 4 * k - 1) {
			sum[i][j + 1][0] += sum[i][j][0];
			sum[i][j + 1][1] += sum[i][j][1];
		}
	}
	rep(i, 4 * k) {
		rep(j, 4 * k - 1) {
			sum[j + 1][i][0] += sum[j][i][0];
			sum[j + 1][i][1] += sum[j][i][1];
		}
	}
	//rep(i, 4 * k) {
	//	rep(j, 4 * k) {
	//		cout << sum[i][j][0] << " ";
	//	}
	//	cout << endl;
	//}
	//cout << endl;
	//rep(i, 4 * k) {
	//	rep(j, 4 * k) {
	//		cout << sum[i][j][1] << " ";
	//	}
	//	cout << endl;
	//}
	ll ans = 0;
	rep(i, 2 * k) {
		rep(j, 2 * k) {
			ll ss = 0;
			ss += sum[i + k - 1][j + k - 1][0];
			if (j - 1 >= 0)ss -= sum[i + k - 1][j - 1][0];
			if (i - 1 >= 0)ss -= sum[i - 1][j + k - 1][0];
			if (j - 1 >= 0 && i - 1 >= 0)ss += sum[i - 1][j - 1][0];

			ss += sum[i + 2 * k - 1][j + k - 1][1];
			if (j - 1 >= 0)ss -= sum[i + 2 * k - 1][j - 1][1];
			ss -= sum[i + k - 1][j + k - 1][1];
			if (j - 1 >= 0)ss += sum[i + k - 1][j - 1][1];

			ss += sum[i + k - 1][j + 2 * k - 1][1];
			ss -= sum[i + k - 1][j + k - 1][1];
			if (i - 1 >= 0)ss -= sum[i - 1][j + 2 * k - 1][1];
			if (i - 1 >= 0)ss += sum[i - 1][j + k - 1][1];

			ss += sum[i + 2 * k - 1][j + 2 * k - 1][0];
			ss -= sum[i + k - 1][j + 2 * k - 1][0];
			ss -= sum[i + 2 * k - 1][j + k - 1][0];
			ss += sum[i + k - 1][j + k - 1][0];
			ans = max(ss, ans);
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 157696
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, i, cnt=0;
  bool f = true;
  cin >> N;
  int A[202];
  for(i = 0;i < N; i++){
  	cin >> A[i];
  }
  
  while(true){
    for( i=0; i<N; i++){
      if(A[i] % 2 == 1){
        f = false;
        break;
      }
    }
  	if(f == true){
      for( i=0; i<N; i++){
        A[i] /= 2;
      }
      cnt++;
    }else{
    	break;
    }
  }
  cout << cnt << endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main 
{
	public static void main(String args[])
	{
		Scanner sc = new Scanner(System.in);
		int n,m,x,y;
		n=sc.nextInt();
		m=sc.nextInt();
		x=sc.nextInt();
		y=sc.nextInt();
		int arr_x[] = new int[n];
		int arr_y[] = new int[m];
		for(int i=0;i<n;i++)
			arr_x[i]=sc.nextInt();
		for(int i=0;i<m;i++)
			arr_y[i]=sc.nextInt();
		Arrays.sort(arr_x);
		Arrays.sort(arr_y);
		int z=arr_y[0];
		int flag=0;
		if(z>x&&z<=y)
		{
			if(z>arr_x[n-1])
				flag=1;
		}
		if(flag==0)
			System.out.println("War");
		else
			System.out.println("No War");
	}
}


Measured memory_bytes: 23124
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(),(x).end())
#define ALL(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < n; i++)
#define reps(i, m, n) for(int i = m; i < n; i++)
#define repr(i, m, n) for(int i = m; i >= n; i--)
template<class T>bool maxi(T &a,const T &b){if(a<b){ a=b; return 1;} return 0;}
template<class T>bool mini(T &a,const T &b){if(b<a){ a=b; return 1;} return 0;}
#define y0 y3487465 //j0
#define y1 y1347829 //j1
#define INF2 4000000000000000037
#define INF 1000000007
#define PI (acos(-1))
#define MOD 1000000007
using namespace std;
typedef long long ll;


void Main(){

  int N; cin>>N;
  map<string,int> mp;
  rep(i,N){
    string s; cin>>s;
    mp[s]++;
  }
  int M; cin>>M;
  rep(i,M){
    string s; cin>>s;
    mp[s]--;
  }
  int ans=0;
  for(auto x: mp){
    maxi(ans,x.second);
  }

  cout<< ans<<"\n";
}

//-----------------------------------
int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  Main();
}
//-----------------------------------


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

template<typename T, typename U>
using pv=vector<pair<T,U>>;
template<typename T>
using matrix=vector<vector<T>>;
template<typename T>
using pque=priority_queue<T>;
template<typename T>
using lpque=priority_queue<T,vector<T>,greater<T>>;

using ll=long long;
using intpair=pair<int,int>;
using llpair=pair<ll,ll>;
using ilpair=pair<int,ll>;
using lipair=pair<ll,int>;
using intvec=vector<int>;
using llvec=vector<ll>;
using intq=queue<int>;
using llq=queue<ll>;
using intmat=vector<intvec>;
using llmat=vector<llvec>;

#define PI 3.141592653589793
#define INTINF ((1<<30)-1)
#define LLINF ((1LL<<62)-1)
#define MPRIME 1000000007
#define MPRIME9 998244353
#define MMPRIME ((1ll<<61)-1)

#define len length()
#define pushb push_back
#define fi first
#define se second

#define setpr fixed<<setprecision(15)
#define all(name) name.begin(),name.end()
#define rall(name) name.rbegin(),name.rend()
#define gsort(vbeg,vend) sort(vbeg,vend,greater<>())

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

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

template<class T>
inline void init(T& v) {
	for(auto &a: v) cin>>a;
}
template<class T, class U>
inline void init(vector<pair<T,U>>& v) {
	for(auto &a: v) cin>>a.first>>a.second;
}
template<class T, class N>
inline void init(T& v, N n) {
	v.resize(n);
	for(auto &a: v) cin>>a;
}
template<class T, class U, class N>
inline void init(vector<pair<T,U>>& v, N n) {
	v.resize(n);
	for(auto &a: v) cin>>a.first>>a.second;
}

inline void out() {
	cout<<endl;
}
template<class T, class... U>
inline void out(T a, U... alist) {
	cout<<a<<" ";
	out(forward<U>(alist)...);
}

template<class N>
void resiz(N n) {
	//empty
}
template<class N, class T, class... U>
void resiz(N n, T&& hd, U&&... tl) {
	hd.resize(n);
	resiz(n,forward<U>(tl)...);
}

bool isout(int h, int w, int H, int W) {
	return ( h<0 || h>=H || w<0 || w>=W );
}

ll binpow(ll a, ll ex, ll p) {
	ll result=1;
	while(ex>0) {
		if(ex&1) result=result*a%p;
		ex>>=1;
		a=a*a%p;
	}
	return result;
}


string S;

void input() {
	cin>>S;
}

void solve() {
	if(S=="RRR") cout<<3<<endl;
	else if(S=="RRS" || S=="SRR") cout<<2<<endl;
	else if(S=="RSS" || S=="SRS" || S=="SSR" || S=="RSR") cout<<1<<endl;
	else cout<<0<<endl;
}

int main() {
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout<<fixed<<setprecision(15);
	int t=1;
	while(t) {
		input();
		solve();
		t--;
	}
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())//vectorの降順ソート
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
#define LINF 1e18
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;
//typedef tuple<ll, ll, ll> T;

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


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


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll r,D,X;
    cin>>r>>D>>X;
    vector<ll> x(11);
    x[0] = X;
    for(int i=1;i<=10;i++){
        x[i] = x[i-1]*r-D;
    }
    for(int i=1;i<=10;i++){
        cout<<x[i]<<endl;
    }
}


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

 
int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i=0;i<n;i++) cin >> a[i];
    sort(a.begin(),a.end());
    int ans=0;
    ll s=a[0];
    for (int i=1;i<n;i++) {
        if (a[i]>2*s) ans=i;
        s+=a[i];
    }
    cout << n-ans << endl;
}

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

typedef long long ll; 

int main(){
        string s; cin>>s; 
        int ans=0; 
        int g=0,p=0; 
        for(int i=0;i<s.size();i++){
                if(g==p) { g++; if(s[i]=='p') ans--; }
                else { p++; if(s[i]=='g') ans++; }
        }
        cout<<ans; 

	return 0; 
}



Measured memory_bytes: 512