akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <stdio.h>

using namespace std;
#define inputInt(a) int a; cin >> a; 
#define inputInt2(a,b) int a; int b; cin >> a >> b; 
#define inputInt3(a,b,c) int a; int b; int c; cin >> a >> b >> c;
#define inputLong(a) long a;cin >> a; 
#define inputIntArray(a,N) int a[N];for(int i=0;i<N;i++){cin >> a[i];}
#define inputLongArray(a,N) long a[N];for(int i=0;i<N;i++){cin >> a[i];}
#define inputIntArray2(a,b,N) int a[N]; int b[N]; for(int i=0;i<N;i++){cin >> a[i] >> b[i];}
#define output(answer) cout << answer << endl;
#define fN(i,N)    for(int i=0; i<N; i++)
#define fSE(i,s,e) for(int i=s; i<=e; i++)
#define ll long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define FOR(i,N) for(int i=0; i<N; i++)
#define cinv(v,N) vector<int> v(N); for(int i=0; i<N; i++){ cin >> v[i]; }
#define mt make_tuple
#define vll vector<long long int>
#define vvll vector<vector<long long int>>
#define all(v) (v).begin(),(v).end()
const ll MOD2 = 998244353;
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; }

//繰り返し2乗法
ll power(ll x, ll y){//繰り返し2乗法
  if(y < 0){
    return 0;
  }else if(y == 0){
    return 1LL;
  }else if(y%2 == 0){//偶数
    return power(x,y/2)*power(x,y/2);
  }else{//奇数
    return power(x,y-1)*x;
  }
}

int main()
{
  //input
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  ll H, W, K; cin >> H >> W >> K; 
  vector<string> str(H); FOR(i,H){ cin >> str[i]; }
  
  //二次元累積和
  vvll sum(H+1,vll(W+1,0));
  FOR(i,H){ FOR(j,W){ sum[i+1][j+1] = str[i][j]-'0'; } }
  FOR(i,H+1){ FOR(j,W){ sum[i][j+1] += sum[i][j]; } }
  FOR(j,W+1){ FOR(i,H){ sum[i+1][j] += sum[i][j]; } }
  
  //main
  ll ans = 1e18;
  for(int bit=0; bit<power(2,H-1); bit++){ //H-1桁目は絶対に1にならない。
    set<ll> st; st.insert(0); st.insert(H);
    for(int i=0; i<H; i++){
      if((bit>>i)%2){ st.insert(i+1); }//どこが切れているかを記憶。
    }
    
    ll tmp = 0;
    ll last = 0;
    
    for(int j=1; j<=W; j++){
      for(auto itr=st.begin(); itr != prev(st.end()); itr++){//*(prev(st.end()))はH。
        if((sum[*(next(itr))][j]-sum[*itr][j]-sum[*(next(itr))][last]+sum[*itr][last])>K){
          if(j-1 == last){
            goto ENDLOOP;
          }else{
            tmp ++; last = j-1;
            break;
          }
        }
      }
      if(j==W){
        for(auto itr=st.begin(); itr != prev(st.end()); itr++){
          if((sum[*(next(itr))][j]-sum[*itr][j]-sum[*(next(itr))][last]+sum[*itr][last])>K){
            goto ENDLOOP;
          }
        }
      }
    }
    tmp += st.size()-2;
    ans = min(ans, tmp);
    
    ENDLOOP:{}
  }
  
  // output
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
//using namespace __gnu_pbds;

#define ll    long long
#define PR    pair<ll, ll>

const int N = 3e5 + 5;
const int MOD = 1e9 + 7;
const double PI = 2 * acos(0.0);
//template<typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

int main() {
//    ios::sync_with_stdio(false);
//    cin.tie(0);
    string s;
    cin >> s;
    cout << (s == "ARC" ? "ABC" : "ARC") << '\n';
    return 0;
}


Measured memory_bytes: 3564
def main():
    l, r= map(int, input().split())
    if l+1 == r:
        return (l*r) % 2019
    ls = []
    for i in range(l,r+1):
        if i %673 ==0:
            return 0
        ls.append(i%2019)
        
    #print(ls)
    ans =2018
    for a in range(len(ls)):
        for b in range(1,len(ls)-a):
            ans = min(ans, (ls[a]*ls[a+b])%2019) 
    return ans
                

if __name__=='__main__':
    print(main())

Measured memory_bytes: 9204
#include<iostream>
#include<algorithm>
#define in(a) scanf("%d",&a)
#define ll long long 
using namespace std;

int main()
{
	int N; in(N); int k; in(k);
	ll sum = 0;
	for (int a = 1; a <= N; a++)
	{
		if ((2 * a) % k == 0)
		{
			int L = (a+1 + (k - 1)) / k;
			int R = (N + a) / k;
			
			ll S = R - L + 1;
			sum += S * S;
		}
	}
	printf("%lld", sum);
	return 0;
}

Measured memory_bytes: 256
// (ง •̀_•́)ง (ง •̀_•́)ง  (ง •̀_•́)ง
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <vector>
using namespace std;

const int INF = 1e9;
int main() {
	int n;
	scanf("%d", &n);
	vector<int> v(n, INF);
	for(int &x : v)
		scanf("%d", & x);
	vector<int> dp(n, INF);
	dp[0] = 0;
	for(int i = 0; i < n; ++i) {
		for(int j : { i + 1, i + 2}) {
			if(i < n) {
				dp[j] = min(dp[j], dp[i] + abs(v[i] - v[j]));
			}
		}
	}
	cout << dp[n - 1];
}


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

int compare(const void *a, const void *b){
	int *A = (int *)a;
	int *B = (int *)b;
	if (*A > *B) return 1;
	if (*A < *B) return -1;
	return 0;
}

int max(int x,int y){
	if(x>y)return x;
	return y;
}

int min(int x,int y){
	if(x<y)return x;
	return y;
}

int main(){
	int N,M,X,Y;
	scanf("%d%d%d%d",&N,&M,&X,&Y);
	int x[N],y[M];
	for(int i=0;i<N;i++)scanf("%d",&x[i]);
	for(int i=0;i<M;i++)scanf("%d",&y[i]);
	qsort(x,N,sizeof(int),compare);
	qsort(y,M,sizeof(int),compare);
	X=max(X,x[N-1]);
	Y=min(Y,y[0]);
	if(X<Y)printf("No War\n");
	else printf("War\n");
	return 0;
}

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

#define _p(...) (void)printf(__VA_ARGS__)
#define forr(x,arr) for(auto&& x:arr)
#define _overload3(_1,_2,_3,name,...) name
#define _rep2(i,n) _rep3(i,0,n)
#define _rep3(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,_rep3,_rep2,)(__VA_ARGS__)
#define _rrep2(i,n) _rrep3(i,0,n)
#define _rrep3(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define rrep(...) _overload3(__VA_ARGS__,_rrep3,_rrep2,)(__VA_ARGS__)
#define all(x) (x).begin(), (x).end()
#define bit(n) (1LL<<(n))
#define sz(x) ((int)(x).size())
#define fst first
#define snd second
using ll=long long;using pii=pair<int,int>;using vb=vector<bool>;
using vi=vector<int>;using vvi=vector<vi>;using vvvi=vector<vvi>;
using vl=vector<ll>;using vvl=vector<vl>;using vvvl=vector<vvl>;
using vd=vector<double>;using vvd=vector<vd>;using vvvd=vector<vvd>;
using vpii=vector<pii>;using vvpii=vector<vpii>;using vvvpii=vector<vvpii>;
template <typename T> T read() {T t; cin >> t; return t;}

void Main() {
  int h = read<int>();
  int w = read<int>();

  vector<string> B(h);
  rep(i, h) B[i] = read<string>();

  int cnt = 0;

  rep(y, h) rep(x, w) {
    if (B[y][x] == '#') cnt++;
  }

  if (cnt == h + w - 1) {
    cout << "Possible" << endl;
  }
  else {
    cout << "Impossible" << endl;
  }

}
int main() { cin.tie(nullptr); ios::sync_with_stdio(false); Main(); return 0; }


Measured memory_bytes: 764
import java.util.*;

public class Main {

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

    if (b-a == c-b) {
      System.out.println("YES");
    } else {
      System.out.println("NO");
    }
  }

}


Measured memory_bytes: 23252
#include <iostream>
#include <algorithm>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <utility>
#include <string.h>
#include <map>
#include <stack>
#include <iomanip>
#include <chrono>
#include <random>
#include <math.h>
#include <time.h>
#include <assert.h>
#define rnd mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define ll long long
#define pb push_back 
#define mp make_pair
#define ff first
#define ss second
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define all(x) x.begin(),x.end() 
#define PII pair <ll,ll>
#define N 55
#define MOD 1000000007
#define INF 1000000000000000000
using namespace std;

int n;
void matrix_mul(ll x[][N], ll y[][N])
{
	ll c[N][N];
	memset(c, 0, sizeof(c));
	for (int i = 1; i <= n; ++i)
	{
		for (int j = 1; j <= n; ++j)
		{
			for (int k = 1; k <= n; ++k)
			{
				c[i][j] += x[i][k] * y[k][j];
				c[i][j] %= MOD;
			}
		}
	}
	for (int i = 1; i <= n; ++i)
		for (int j = 1; j <= n; ++j)
			x[i][j] = c[i][j];
}
ll power(ll A[][N], ll b)
{
	ll res[N][N], cnt = 0;
	memset(res, 0, sizeof(res));
	for (int i = 0; i <= n; ++i)
		res[i][i] = 1;
	while(b != 0)
	{
		if(b & 1)
			matrix_mul(res, A);
		matrix_mul(A, A);
		b /= 2;
	}
	for (int i = 1; i <= n; ++i)
	{
		for (int j = 1; j <= n; ++j)
		{
			cnt += res[i][j];
			cnt %= MOD;
		}
	}
	return cnt;
}
int main()
{
	ll k, A[N][N];
	cin >> n >> k;
	for (int i = 1; i <= n; ++i)
	{
		for (int j = 1; j <= n; ++j)
		{
			cin >> A[i][j];
		}
	}
	cout << power(A, k);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define HAIRETU(N,A) for(int i=0;i<N;i++) cin >>A[i]
using namespace std;

int main(){
    int N;
    cin >> N;
    
    int V[100],C[100];
    
    HAIRETU(N, V);
    HAIRETU(N, C);
    
    int sum=0;
    
    int KAI[100];
    for (int i=0; i<N; i++) {
        KAI[i]=V[i]-C[i];
        if (KAI[i]>=0) {
            sum+= KAI[i];
            
        }
    }
    cout << sum << endl;

    return 0;
}



Measured memory_bytes: 256
/*
* @Author: 王文宇
* @Date:   2017-11-18 22:35:29
* @Last Modified by:   王文宇
* @Last Modified time: 2017-11-18 22:51:06
*/
#include <iostream>
using namespace std;
int a[11][11];
int n,m;
int main(int argc, char const *argv[])
{
	ios::sync_with_stdio(false);
	cin>>n>>m;
	for(int i=0;i<10;i++)
	{
		for(int j=0;j<10;j++)
		{
			cin>>a[i][j];
		}
	}
	for(int i=0;i<10;i++)
	{
		for(int j=0;j<10;j++)
		{
			for(int k=0;k<10;k++)
			{
				a[j][k]=min(a[j][k],a[j][i]+a[i][k]);
			}
		}
	}
	int sum=0;
	for(int i=1;i<=n;i++)
	{
		for(int k=1;k<=m;k++)
		{
			int x;
			cin>>x;
			if(x!=-1&&x!=1)sum+=a[x][1];
		}
	}
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define ll long long
using namespace std;
//typedef vector<unsigned int>vec;
//typedef vector<ll>vec;
//typedef vector<vec> mat;
typedef pair<int, int> P;
typedef pair<ll,ll> LP;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int INF = 1000000000;
const ll LINF = 1000000000000000000;//1e18
const ll  MOD = 1000000007;
const double PI = acos(-1.0);
const double EPS = 1e-10;

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; }
//template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    ll sum = 0;
    for(int i=1;i<=N;i++){
        if(i % 3 == 0 || i % 5 == 0) continue;
        sum += i;
    }
    cout << sum << endl;
}

Measured memory_bytes: 3692
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;
typedef long long ll;
using namespace std;
const ll mod=1000000007,mod9=1000000009;
template <class T>inline T lcm(T a,T b){return (a*b/__gcd(a,b));}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,a,b[100005]={0};
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a;
        if(a)b[a-1]++;
        b[a]++;
        b[a+1]++;
    }
    int ans=0;
    for(int i=0;i<100004;i++){
        ans=max(ans,b[i]);
    }
    cout << ans<<endl;
    return 0;
}



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

#define int long long

int n, c;
int a[40] = {};
int b[40] = {};

int memo[32][70010];

int dp(int idx, int bit){
    if(idx == n){
        return 0;
    }

    if(memo[idx][bit] != -1) return memo[idx][bit];

    int ttt = bit;
    bit |= a[idx];

    int ans = dp(idx+1, bit);

    for(int i = 0;i < c;i++){
        int tmp = (bit & b[i]);

        int cnt = 0;
        while(tmp > 0){
            cnt += (tmp & 1);
            tmp >>= 1;
        }

        ans = max(ans, dp(idx+1, bit & (~b[i])) + cnt);
    }

    return memo[idx][ttt] = ans;
}

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

    while(cin >> n >> c, n != 0 && c != 0){
        for(int i = 0;i < n;i++){
            a[i] = 0;
            for(int j = 0;j < 16;j++){
                int tmp;
                cin >> tmp;
                a[i] |= (tmp << j);
            }
        }

        for(int i = 0;i < c;i++){
            b[i] = 0;
            for(int j = 0;j < 16;j++){
                int tmp;
                cin >> tmp;
                b[i] |= (tmp << j);
            }
        }

        memset(memo, -1, sizeof(memo));

        cout << dp(0, 0) << endl;
    }
    return 0;
}




Measured memory_bytes: 20632
#include<bits/stdc++.h>
using namespace std;
int x,y,z=1;
int main(){
    ios::sync_with_stdio(0);
    cin>>x>>y;
    for(int i=1;i<=x;i++)
    {
        if(z>y)z+=y;
        else z+=z;
    }
    cout<<z<<endl;
    return 0;
}

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

struct P {
    double x, y;
};

void kock(int n, P a, P b) {
    if (n == 0) return;
    
    P s, t, u;
    double th = M_PI * 60 / 180;
    
    s.x = (2 * a.x + b.x) / 3;
    s.y = (2 * a.y + b.y) / 3;
    t.x = (a.x + 2 * b.x) / 3;
    t.y = (a.y + 2 * b.y) / 3;
    u.x = (t.x - s.x) * cos(th) - (t.y - s.y) * sin(th) + s.x;
    u.y = (t.x - s.x) * sin(th) + (t.y - s.y) * cos(th) + s.y;
    
    kock(n - 1, a, s);
    printf("%.8f %.8f\n", s.x, s.y);
    kock(n - 1, s, u);
    printf("%.8f %.8f\n", u.x, u.y);
    kock(n - 1, u, t);
    printf("%.8f %.8f\n", t.x, t.y);
    kock(n - 1, t, b);
}

int main() {
    int n;
    scanf("%d", &n);
    P p1, p2;
    p1.x=0;
	p1.y=0;
	p2.x=100;
	p2.y=0;
	printf("%.8f %.8f\n", p1.x, p1.y);
	kock(n, p1, p2);
	printf("%.8f %.8f\n", p2.x, p2.y);
	
	return 0;
}


Measured memory_bytes: 2676
#include <iostream>
#include <algorithm>
#include <queue>

using namespace std;

int main(){
    int X, Y, A, B, C;
    cin >> X >> Y >> A >> B >> C;
    int red[A], green[B], tra[C];
    for(int i=0; i<A; i++) cin >> red[i];
    for(int i=0; i<B; i++) cin >> green[i];
    for(int i=0; i<C; i++) cin >> tra[i];
    sort(red, red + A, greater<int>());
    sort(green, green + B, greater<int>());
    
    priority_queue<int> q;
    for(int i=0; i<X; i++) q.push(red[i]);
    for(int i=0; i<Y; i++) q.push(green[i]);
    for(int i=0; i<C; i++){
        q.push(tra[i]);
    }
    long ans = 0;
    for(int i=0; i<X + Y; i++){
        ans += q.top(); q.pop();
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4596
"use strict"
function Main(input) {
    input = input.split("\n");
    var tmp = input[0].split(" ")
    var H   = parseInt(tmp[0], 10);
    var W   = parseInt(tmp[1], 10);

    //初期化
    var tbl = new Array(H + 2);
    for(let i = 0; i < H+2; i++) {
        tbl[i] = new Array(W+2).fill(0)
    }

    for(let i = 0; i < H; i++) {    
        for (let j = 0; j < W; j++){
            for(let r=0; r<3; r++){
                for(let c=0; c<3; c++){ 
                    tbl[i+r][j+c] += input[i+1][j] == "." ? 0 : 1
                }
            }
        } 
    }

    //出力
    for(let i = 0; i < H; i++) { 
        var hoge = '' 
        for (let j = 0; j < W; j++){
            if(input[i+1][j]=="#"){
                hoge += "#"
            }else{
                hoge += tbl[i+1][j+1]
            }
        }
        console.log(hoge)
    }
}


//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

int main() {
    ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
    int n;
    cin >> n;
    set<string> st;
    for (int i = 0; i < n; ++i) {
        string s;
        cin >> s;
        st.insert(s);
    }
    cout << st.size() << "\n";
    return 0;
}

Measured memory_bytes: 19200
// marked ancester
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2170
// 正解してないのであとでまた提出

#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
using namespace std;

const int C = 100010;
const int UFSIZE = 100010;
int P[UFSIZE]; // 親
int T[UFSIZE]; // 木

void init() {
  for (auto i=0; i<UFSIZE; i++) {
    P[i] = i;
  }
}

int root(int a) {
  if (a == P[a]) return a;
  return (P[a] = root(P[a]));
}

bool issame(int a, int b) {
  return root(a) == root(b);
}

void unite(int a, int b) {
  P[root(a)] = root(b);
}

bool isroot(int a) {
  return root(a) == a;
}

int main() {
  int N, Q;
  while (cin >> N >> Q && N) {
    T[0] = 0;
    for (auto i=1; i<N; i++) {
      cin >> T[i];
      T[i]--;
    }
    vector< pair<bool, int> > V;
    bool marked[C];
    fill(marked, marked+C, false);
    for (auto i=0; i<Q; i++) {
      char op;
      int v;
      cin >> op >> v;
      v--;
      if (op == 'M' && marked[v]) continue;
      if (op == 'M') marked[v] = true;
      V.push_back(make_pair((op == 'M'), v));
    }
    for (auto i=0; i<N; i++) {
      P[i] = T[i];
    }
    Q = (int) V.size();
    for (auto i=0; i<Q; i++) {
      if (V[i].first) {
	P[V[i].second] = V[i].second;
      }
    }
    reverse(V.begin(), V.end());
    long long ans = 0;
    for (auto i=0; i<Q; i++) {
      if (V[i].first) {
	unite(V[i].second, T[V[i].second]);
      } else {
	ans += root(V[i].second)+1;
      }
    }
    cout << ans << endl;
  }
}

Measured memory_bytes: 3772
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#include <set>
#include <iterator>
using namespace std;
using namespace __gnu_pbds;


#define ft first
#define sd second
#define pb push_back
#define all(x) x.begin(),x.end()

#define ll long long int
#define vi vector<int>
#define vii vector<pair<int,int> >
#define pii pair<int,int>
#define plii pair<pair<ll, int>, int>
#define piii pair<pii, int>
#define viii vector<pair<pii, int> >
#define vl vector<ll>
#define vll vector<pair<ll,ll> >
#define pll pair<ll,ll>
#define pli pair<ll,int>
#define mp make_pair
#define ms(x, v) memset(x, v, sizeof x)
#define pr_vec(v) for(int i=0;i<v.size();i++) cout << v[i] << " " ;

#define f_in(st) freopen(st,"r",stdin)
#define f_out(st) freopen(st,"w",stdout)

#define INF INT_MAX
#define matrix vector<vector<ll> >

#define fr(i, a, b) for(i=a; i<=b; i++)
#define fb(i, a, b) for(i=a; i>=b; i--)
#define ASST(x, l, r) assert( x <= r && x >= l )

typedef tree<pll, null_type, less<pll>, rb_tree_tag,
             tree_order_statistics_node_update>
    new_data_set;
const int N=1e5+10, M=(ll)1e9+1 ;
const int mod = 1e9+7  ;
ll f(ll x,ll a,ll b){
    if(a==b){
        if(a%x==0)
            return 1;
    }
    return b/x-(a-1)/x;
}

void work(){
   ll a,b,c,d;
   cin >> a >> b >> c >> d;
   ll l=c*d/(__gcd(c,d));
   ll ans=(b-a+1)-(f(c,a,b)+f(d,a,b)-f(l,a,b));
   cout << ans;
}
int main(){
 ios_base::sync_with_stdio(0);

    ll t,z;
    // cin >> t;
    // z=t;
    t=1;
    while(t--){
            // cout << "Case #" << z-t << ": ";
            work();
    }
   return 0;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define FAST_IO ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

#define ll long long
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define pii pair<int,int>
#define pll pair<ll,ll>

#define forn(i,n) for(int i=0;i<(int)n;i++)
#define forab(i,a,b) for(int i=a;i<=b;i++)
#define all(x) x.begin(),x.end()
#define trav(i,x) for(auto& i:x)
#define endl cout<<"\n";

int main()
{

    FAST_IO;
    ll n,m,i,j;
    string s;
    cin>>s;
    int real=0;
    for(i=0;i<s.size();i++){
       
       int ans=0;
       while(i<s.size()&&s[i]=='R'){
           i++;
           ans++;
       }
       real = max(ans,real);
    }
    cout<<real<<"\n";
	return 0;
}


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

int main(void){
  int n;
  int cnt[100010];
  fill(cnt,cnt+100010,0);
  cin >> n;
  for(int i = 0;i < n;++i){
    int tmp;
    cin >> tmp;
    ++cnt[tmp];
  }
  int res = cnt[0] + cnt[1];
  for(int i = 1;i+1 < 100010;++i){
    res = max(res,cnt[i-1]+cnt[i]+cnt[i+1]);
  }
  cout << res << endl;
  return 0;
}


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


using namespace std;

vector<bool> Bad;

int main() {
    int num;
    cin >> num;
    long long output = 1;
    num;
    Bad.resize(1000002);
    Bad[1] = true;
    Bad[2] = true;
    int k_num = 2;
    while (k_num<num) {
        
        
        int i = 2;
        int temp = k_num;
        int count = 1;
        int k = sqrt(temp);
        while (i<=k) {
            int Tcount = 1;
            while (temp % i == 0) {
                Tcount++;
                temp = temp / i;
            }
            count *= Tcount;
            if (Bad[temp] == 1) {
                
                break;
            }
            i++;
        }
        if (temp != 1) {
            Bad[temp] = true;
            count *= 2;
        }
        output += count;
        k_num++;
    }
    cout << output;

    return 0;
}

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

int main(){
  int N,K,X,Y;
  cin>>N>>K>>X>>Y;
  int total=0;
  if(N>K){
    for(int i=0;i<K;i++)
      total=total+X;
    for(int i=0;i<N-K;i++)
      total=total+Y;
  }
  else
    total=X*N;
  cout<<total<<endl;
  return 0;
}

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

using namespace std;

#define IOS                       \
    ios_base::sync_with_stdio(0); \
    cin.tie(NULL);                \
    cout.tie(NULL);
#define pb push_back
#define mp make_pair
#define Debug(x) cout << #x " = " << (x) << endl
#define SORT(a) sort(a.begin(), a.end())
#define SORTR(a) sort(a.rbegin(), a.rend())

int main()
{
    IOS;

    int x, y;
    cin >> x >> y;

    int A = ((4 * x) - y);
    int B = (y - (2 * x));

    if (A >= 0 && B >= 0 && A % 2 == 0 && B % 2 == 0)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;

    return 0;
}
/*
X total 
y Legs

crane 2 legs    a        2*a
turtle 4 legs   b        4*b


a+b = X;
(2*a)+(4*b) = Y

(2*a)+(4*(X-a)) = Y:

-2a + 4X = Y;
4X-Y)/2 = a:

X - (4X-y)/2
-2x+y/2 = b

A = (4*X - Y)/2
B = (Y - 2*X)/2



*/

Measured memory_bytes: 3608
import heapq

n, m = map(int, input().split())
a_lst = list(map(int, input().split()))
a_lst = sorted(a_lst)

hpq = list(map(lambda x: -1 * x, a_lst))
heapq.heapify(hpq)
for i in range(m):
    x = heapq.heappop(hpq)
    heapq.heappush(hpq, x / 2)
 
print(sum(map(lambda x: int(-1 * x), hpq)))

Measured memory_bytes: 14180
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <bitset>

using std::ios_base;
using std::cin;
using std::cout;
using std::cerr;
using std::endl;
using std::fixed;

using std::vector;
using std::string;
using std::stack;
using std::queue;
using std::deque;
using std::map;
using std::set;
using std::unordered_map;
using std::unordered_set;
using std::bitset;

using std::tuple;
using std::make_tuple;
using std::pair;
using std::make_pair;

using std::sort;
using std::reverse;
using std::nth_element;

#define pb push_back
#define mp make_pair
#define all(x) x.begin(), x.end()

const int MAXN = 100000;
const int INF = 1e9;
const int MOD = 1e9+7;
const int64_t L_INF = 4e18;

int n, ans = 0;
string a, b, c;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.precision(10);
    cout << fixed;

    cin >> n >> a >> b >> c;
    for (int i = 0; i < n; i++) {
        if (a[i] == b[i] && b[i] == c[i]) {
            continue;
        }
        if (a[i] == b[i] || b[i] == c[i] || a[i] == c[i]) {
            ans += 1;
        } else {
            ans += 2;
        }
    }

    cout << ans << '\n';

    #ifdef LOCAL
        cerr << "\n== " << 1.0 * clock() / CLOCKS_PER_SEC << " sec.\n";
    #endif
    return 0;
}


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

routes = []
cost = 1000

for i in range(n):
    array = list(map(int, input().split()))
    if array[1] <= t:
        routes.append(array)
        cost = min(array[0], cost)

if not routes:
    print('TLE')
    exit()

print(cost)

Measured memory_bytes: 3060
n, m = map(int, input().split())
A = set([int(input()) for _ in range(m)])
MOD = 10 ** 9 + 7

dp = [0] * (n + 1)
dp[0] = 1

for i in range(n + 1):
  if i > 1:
    if i not in A:
      dp[i] += dp[i - 2]
  if i > 0:
    if i not in A:
      dp[i] += dp[i - 1]
  dp[i] %= MOD

print(dp[-1])

Measured memory_bytes: 18960
#include <bits/stdc++.h>
using namespace std;
int ar[100003];
int main() {
	int i=1,j=-1,k,l,n;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&ar[i]);
	}
	k=0;
	for(i=0;i+1<n;i++){
		if(ar[i+1]<=ar[i]){
			k++;
		}
		else{
			if(k>j){
				j=k;
			}
			k=0;
		}
	}
	if(k>j){
		j=k;
	}
	cout<<j<<'\n';
	return 0;
}

Measured memory_bytes: 640
#!/usr/bin/env python3

import sys
sys.setrecursionlimit(300000)


def solve(C: str):
    ret = chr(ord(C) + 1)
    print(ret)
    return

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    C = next(tokens)  # type: str
    solve(C)

if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include <iostream>

using namespace std;
typedef long long int ll;
ll dp[100010];
ll arr[100010];

int main(){
    ll n,k;
    scanf("%lld %lld",&n,&k);

    for(ll i = 1; i <= n; i++){
        scanf("%lld",arr+i);
    }

    for(ll i = 2; i <= n; i++){
        dp[i] = 10000000000000;
        for(ll j = 1; j <= k; j++){
            if(i-j >= 1){
                dp[i] = min(dp[i],dp[i-j] + llabs(arr[i]-arr[i-j]));
            }
        }
    }


    printf("%lld\n",dp[n]);
}


Measured memory_bytes: 1792
s = input()
str = ""
count = 0
for i in range(len(s)):
    #print("count",count)
    if s[i] == "0":
        str += s[i]
        count += 1
    elif s[i] == "1":
        str += s[i]
        count += 1
    elif s[i] == "B":
        if count > 0:
            str = str[:-1]
            count -= 1
#print("str",str)


print(str)


Measured memory_bytes: 3060
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>

using namespace std;


#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int (i)=(n); (i)>=(0); (i)--)
#define SIZE(x) ((int)(x).size())
#define GCD(a, b) int gcd(int a,int b){return b?gcd(b,a%b):a;}
#define QP(a, b) int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define all(v) (v).begin(),(v).end()


template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
template<typename A, size_t N, typename T>
void FILL(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

typedef vector<int, int> vint;
typedef pair<int,int> pint;
typedef vector<pint>vpint;
typedef long long ll;

int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1LL << 60;
const ll MOD = 1000000007LL;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s, t; cin >> s >> t;
    int cnt = 0;
    for(int i=0; i<s.length(); i++){
        if(s[i] != t[i]) cnt++;
    }
    cout << cnt;
    cout << endl;
    return 0;
}

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

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

    if(n==0) cout<<1<<endl;
    else cout<<0<<endl;
    return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std::literals::string_literals;
using i64 = long long;
using std::cout;
using std::endl;
using std::cin;

template<typename T>
std::vector<T> make_v(size_t a){return std::vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return std::vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

int main() {
	int n; scanf("%d", &n);
	
	int ans = 1, a; scanf("%d", &a);
	for(int i = 0; i < n - 1; i++) {
		int b; scanf("%d", &b);
		
		ans += (a <= b);
		a = std::max(a, b);
	}

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


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

//g++ -g -o yourexe yourfile.cpp
//./yourexe < yourinput.in > youroutput.out

#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

#define M 1000000007

#define ll long long
#define ld long double
#define vi vector<ll>
#define pi pair<ll, ll>
#define vii vector<pi>
#define vvi vector<vi>
#define pb push_back
#define endl "\n"

#define REP(i, s, e) for (ll i = s; i < e; i++)
#define RREP(i, s, e) for (ll i = s; i > e; i--)

#define all(v) v.begin(), v.end()
#define part(v, s, e) v.begin() + s, v.begin() + e
#define print(v) for (auto i: v) cout << i << " ";

int main() {
    fast
    ll n;
    cin >> n;
    map<pi, ll> mp;
    ll c = 1;
    REP(i, 1, n+1)
        REP(j, i+1, n+1)
            mp[{i, j}] = c++;
    vvi ed(c);
    ll x, p;
    vi vis(c, 0), ind(c, 0);
    REP(i, 1, n+1) {
        cin >> x;
        p = x;
        REP(j, 1, n-1) {
            cin >> x;
            ed[mp[{min(i, p), max(i, p)}]].pb(mp[{min(i, x), max(i, x)}]);
            ind[mp[{min(i, x), max(i, x)}]]++;
            p = x;
        }
    }
    /*REP(i, 0, c) {
        REP(j, 0, ed[i].size())
            cout << ed[i][j] << " ";
        cout << endl;
    }*/
    queue<ll> q;
    REP(i, 1, c) {
        if (ind[i] == 0) {
            q.push(i);
            vis[i] = 1;
        }
    }
    while (!q.empty()) {
        auto cur = q.front();
        q.pop();
        REP(i, 0, ed[cur].size()) {
            ind[ed[cur][i]]--;
            if (ind[ed[cur][i]] == 0 && vis[ed[cur][i]] == 0) {
                vis[ed[cur][i]] = vis[cur] + 1;
                q.push(ed[cur][i]);
            }
        }
    }
    ll ans = -1;
    REP(i, 1, c) {
        if (vis[i] == 0) {
            ans = -1;
            break;
        }
        ans = max(ans, vis[i]);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 66560
#include <stdio.h>
#include <string.h>
#include <math.h>

int main(void){
   int N,F[101][10],P[100][11],tmp,neko;
  long long int max=-500000000000,now;
  scanf("%d",&N);
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < 10; j++) {
      scanf("%d\n",&F[i][j] );
    }
  }
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < 11; j++) {
      scanf("%d\n",&P[i][j] );
    }
  }
  for (int i = 1; i < 1024; i++) {
    now=0;
    for (int j = 0; j < N; j++) {
      neko=i;
      tmp=0;
      for (int k = 0; k < 10; k++) {
        tmp+=(neko%2)*F[j][k];
        neko/=2;
      }
      //printf("t+%lld\n", tmp);
      now+=P[j][tmp];
      //printf("n+%lld\n", now);
    }
    //printf("a+%lld\n", max);
    if (now>max) {
      max=now;
      //printf("a+%lld\n", max);
    }
  }
  printf("%lld\n", max);
  return 0;
}


Measured memory_bytes: 128
#include<stdio.h>

int main(void)
{

    int a,b,c;
    int temp;

    scanf("%d %d %d",&a,&b,&c);

    if(a > b)
    {
      temp = a;
      a = b;
      b = temp;
    }
    if(a > c)
    {
      temp = a;
      a = c;
      c = temp;
    }
    if(b > c)
    {
      temp = b;
      b = c;
      c = temp;
    }

    printf("%d %d %d\n",a,b,c);

    return 0;
}


Measured memory_bytes: 2764
#include <cstdio>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <iterator>
#define loop(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define debug(x)  cout << #x << " = " << (x) << endl;

using namespace std;
using LL = long long;
using ULL = unsigned long long;

int main() {
    int n, m; cin >> n >> m;
    vector<LL> mini(1 << n, (1LL << 60)), dp(1 << n, (1LL << 60));

    rep(i, m) {
        int mask = 0;
        int x, y; cin >> x >> y;
        rep(j, y) {
            int r; cin >> r;
            mask |= 1 << (r - 1);
        }
        mini[mask] = min(mini[mask], (LL)x);
    }
    dp[0] = 0;
    rep(x, 1 << n) rep(y, 1 << n) {
        dp[x | y] = min(dp[x | y], dp[x] + mini[y]);
    }
    if (dp[(1 << n) - 1] == (1LL << 60)) {
        cout << -1 << endl;
    } else {
        cout << dp[(1 << n) - 1] << endl;
    }
}


Measured memory_bytes: 384
#include<iostream>
#include<cstring>
#include<string>
using namespace std;
string s;
int p;
bool check(int n,int i)
{
	if(n==0&&s[i]=='C'||n==1&&s[i]=='F') return true;
	return false;
}
int main()
{
	cin>>s;
	for(int i=0;i<s.size();i++)
	{
		if(check(p,i)) p++;
	}
	if(p==2) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
N = int(input())

numbers_list = []

for i in range(1, int(N**(1/2))+1):
    if N % i == 0:
        numbers_list.append((i, N//i))

ans = 1e11
for n, m in numbers_list:
    ans = min(ans, max(len(str(n)), len(str(m))))

print(ans)


Measured memory_bytes: 3060
while True:
    try:
        lst = list(map(float, input().split()))
        xa1, ya1 = lst[0], lst[1]
        xa2, ya2 = lst[2], lst[3]
        xb1, yb1 = lst[4], lst[5]
        xb2, yb2 = lst[6], lst[7]
        
        if xb2 < xa1 or yb2 < ya1 or xa2 < xb1 or ya2 < yb1:
            print("NO")

        else:
            print("YES")

    except EOFError:
        break


Measured memory_bytes: 5580
#include <bits/stdc++.h>
#define ll long long
#define rep(i, a) for(ll i=0; i<a; i++)
#define rep1(i, a, b) for(ll i=a; i<b; i++)
using namespace std;
typedef vector<ll> vi;
typedef vector<vi> vvi;

int main(){
    int n, k;
    cin>>n>>k;
    vi v(n);
    vector<bool> dp(k+1, 0);
    rep(i, n)
        cin>>v[i];
    
    dp[0] = 0;
    rep(i, k+1)
        rep(j, n)
            if(i>=v[j])
                dp[i] =  (dp[i] || (!dp[i-v[j]]));
    // rep(i, k+1) cout<<dp[i]<<" ";cout<<endl;
    if(dp[k])
        cout<<"First";
    else
        cout<<"Second";
}

Measured memory_bytes: 384
/*
	Name:
	Author: xiaruize
	Date:
*/

#include<bits/stdc++.h>
using namespace std;
#define forn(i, n) ;for(int i = 0; i < int(n); i++)
#define LL long long

int main()
{
 	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	int n;
	cin>>n;
	int a[n];
	bool flag=true
	forn(i,n)
	{
		cin>>a[i];
		if(a[i]==1)
		{
			flag=false;
		}
	}
	if(flag)
	{
		cout<<"-1"<<endl;
		return 0;
	}
	int ans=0;
	int j=0;
	forn(i,n)
	{
		if(a[i]!=j+1)
		{
			ans++;
			continue;
		}
		else
		{
			j++;
		}
	}
	cout<<ans<<endl;
	return 0;
}

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

using namespace std;

#define int         long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define hell        1000000007
#define rep(i,a,b)  for(int i=a;i<b;i++)



void solve()
{
	int n, k, i, j, totalCapacity = 0, people, coins;
	cin>>n>>k;
	vector<int> A(n);
	for(i = 0; i + j < n; i++)
	{
		cin>>A[i];
		totalCapacity += A[i];
	}
	if(totalCapacity<=k)
		cout<<(totalCapacity==k)<<endl;
	else
	{
		vector< vector<int> > dp(2, vector<int> (k+1));
			dp[1][0] = dp[0][0] = 1;
		for(i = 0; i <= A[0]; i++)
			dp[0][i] = 1;
		for(; i <= k; i++)
			dp[0][i] = 0;
		bool person = true;
		for(people = 1; people < n; people++)
		{
			for(coins = 1; coins <= k; coins++)
				dp[person][coins] = (dp[!person][coins] + dp[person][coins-1])%hell;
			for(coins = k; coins - A[people]-1 >= 0; coins--)
				dp[person][coins] = (dp[person][coins] - dp[person][coins-A[people]-1] + hell)%hell;
			person = !person;
		}
		cout<<dp[!person][k]<<endl;
	}
}


signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int tc;
	tc = 1;
    // cin>>tc;
    while(tc--)
        solve();

    return 0;
}


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

using namespace std;
typedef long long ll;
const int nax = 401;
ll dp[nax][nax];

int main(){
	int n; cin >> n;
	vector<int> v(n);
	vector<ll> pref(n+1, 0);
	for (int i = 0; i < n; ++i) cin >> v[i], pref[i+1] = pref[i] + v[i];
	for(int l = n-1; l >= 0; --l){
		for (int r = l; r < n; ++r)
		{
			if(l != r){
				ll t = dp[l][l] + dp[l+1][r];
				for(int i = l+1; i < r; ++i){
					t = min(t, dp[l][i] + dp[i+1][r]);
				}
				dp[l][r] = t - pref[l] + pref[r+1];
			}
		}
	}
	cout << dp[0][n-1];
}

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

using namespace std;
typedef pair<int, int> pii;

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

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

int main(void) {
  int t, n;
  while (cin >> t >> n, t) {
    map<pii, int> mp;
    for (int i = 0; i < n; i++) {
      int x, y;
      cin >> x >> y;
      mp[pii(x, y)] = -1;
    }

    int sx, sy;
    cin >> sx >> sy;

    queue<pii> que;
    que.push(pii(sx, sy));
    while (!que.empty()) {
      pii v = que.front(); que.pop();
      if (mp[v] == t) continue;
      for (int i = 0; i < 6; i++) {
        int nx = v.first + dx[i], ny = v.second + dy[i];
        if ((nx == sx && ny == sy) || mp[pii(nx, ny)] != 0) continue;
        mp[pii(nx, ny)] = mp[v] + 1;
        que.push(pii(nx, ny));
      }
    }

    int ans = 1;
    for (int i = -100; i <= 100; i++) {
      for (int j = -100; j <= 100; j++) {
        ans += mp[pii(i, j)] > 0;
      }
    }

    cout << ans << endl;
  }

  return 0;
}


Measured memory_bytes: 5592
import java.util.*;
public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
        Scanner sc = new Scanner(System.in);
        String c =sc.next();
        if(c.equals("a") ||c.equals("e") ||c.equals("i") ||
        		c.equals("o") ||c.equals("u")) {
        	System.out.println("vowel");
        }
        else System.out.println("consonant");
	}

}

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

int main() {
  int N;
  cin >> N ;
  vector<int> mochi(N);
  int maxSize = 0;
  int firstMochi;
  for (int i = 0; i < N; i++) {
    int d;
    cin >> d;
    mochi.at(i) = d;
    if (maxSize < d) {
      maxSize = d;
      firstMochi = i;
    }
  }
  int nowMochi = maxSize;
  maxSize = 0;
  int mochiCnt = 1;
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      if (mochi.at(j) < nowMochi && maxSize < mochi.at(j)) {
        maxSize = mochi.at(j); 
      } 
    }
    if (maxSize == 0) break;
    mochiCnt ++;
    if (maxSize == nowMochi) {
      break;
    }
    nowMochi = maxSize;
    maxSize = 0;
  }
  cout << mochiCnt << endl;
}


Measured memory_bytes: 256
/*** keep hungry and calm CoolGuang!***/
#include <bits/stdc++.h>
#define debug(x) cout<<#x<<" :"<<x<<" "<<endl;
#pragma GCC optimize(2)
using namespace std;
typedef long long ll;
const ll INF=1000000000000007;
const ll maxn=1e6+5;
const int mod=1e9+7;
ll n,m;
ll num[maxn];
string s[maxn];
string save[maxn];
map<string,int>mp;
map<string,int>mp1;
int main()
{
    int cnt=0;
    scanf("%lld",&n);
    for(int i=1;i<=n;i++) cin>>s[i];
    ll maxl=0;
    for(int i=1;i<=n;i++){
        mp[s[i]]++;
        maxl=max(maxl,(ll)mp[s[i]]);
    }
    for(int i=1;i<=n;i++){
        if(maxl==mp[s[i]]&&mp1[s[i]]==0){
            mp1[s[i]]=1;
            save[++cnt]=s[i];
        }
    }
    sort(save+1,save+1+cnt);
    for(int i=1;i<=cnt;i++) cout<<save[i]<<endl;
   /* scanf("%lld%lld",&n,&m);
    for(int i=1;i<=n;i++) scanf("%lld",&num[i]);
    sort(num+1,num+1+n);
    for(int i=1;i<=n;i++){
        if(m>(i-1))
            m-=(i-1);
        else{
            printf("%lld\n",num[i]*num[m]);
            break;
        }
    }*/
    return 0;
}


Measured memory_bytes: 54016
from sys import stdin
from itertools import accumulate, dropwhile, takewhile, groupby
import bisect
import copy
import math

# 入力 =stdin.readline().rstrip()
# 分割 = stdin.readline().rstrip().split()

'''
条件に合うものを絞り込む
data = [1, 2, 3]
s = [x for x in data if x % 3 == 0]
'''

'''
文字配列を数値に
l_si = ['-10', '0', '100']

l_si_i = [int(s) for s in l_si]
'''

'''
a = [2, 4, 6, 8]
b = [3, 6, 9]

print(list(set(a) | set(b)))  # 和集合
print(list(set(a) & set(b)))  # 積集合
'''

'''
N = int(stdin.readline().rstrip())
A = [int(x) for x in stdin.readline().rstrip().split()]
count = 0
while len([x for x in A if x % 2 == 0]) == N:
    A = list(map(lambda y: y / 2, A))
    count += 1
print(count)
'''

'''
.append(要素)
.extend(要素)
.insert(場所,要素)
del 配列名[場所]
-1で末尾で末尾から一つ前
'''
'''
間に空白追加
' '.join(lis)
'''
'''
copy.copy(配列名)
'''
'''
sort()50
sorted(reverse=true)
'''
'''
2分探索
bisect.bisect_left(リスト, 要素)
'''
data = stdin.readline().rstrip().split()
a = float(data[0])
b = float(data[1])
x = float(data[2])
if (b * a * a >= 2 * x):
    print(90.0 - math.degrees(math.atan(2 * x / (a * b * b))))
elif (not a * a * b == x):
    print(90.0 - math.degrees(math.atan(a * a * a / (2 * a * a * b - 2 * x))))
else:
    print(0.0)


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

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

#define fr first
#define sc second
#define chmax(a,b) a=max(a,b)
#define chmin(a,b) a=min(a,b)
#define mp1(a,b,c) P1(a,P(b,c))

const ll MOD=998244353;

ll C[4002][4002];
void init(){
	for(int i=0;i<4002;i++){
		C[i][0]=C[i][i]=1;
		for(int j=1;j<=i-1;j++){
			C[i][j]=C[i-1][j]+C[i-1][j-1];
			if(C[i][j]>=MOD)C[i][j]-=MOD;
		}
	}
}

int main(){
	init();
	ll k,n;
	cin>>k>>n;
	
	static ll dp[1002][2002]={};
	dp[0][0]=1;
	for(int i=1;i<=1000;i++){
		dp[i][0]=dp[i-1][0];
		for(int j=1;j<2002;j++){
			dp[i][j]=dp[i-1][j]+dp[i][j-1];
			if(dp[i][j]>=MOD)dp[i][j]-=MOD;
		}
		for(int j=0;j<2002;j++){
			dp[i][j]*=2;
			dp[i][j]+=MOD-dp[i-1][j];
			dp[i][j]%=MOD;
		}
	}
	
	for(int i=2;i<=2*k;i++){
		int a,b,c=0;
		if(i%2==0)c=1;
		if(i<=k+1)b=(i-1-c)/2;
		else b=(k-(i-k)+1-c)/2;
		a=k-2*b-c;
		ll ret=0;
		if(1){
			if(a==0){
				ret+=dp[b][n];
			}
			else {
				for(int j=n;j>=0;j--){
					ret+=dp[b][j]*C[n-j+a-1][n-j]; ret%=MOD;
				}
			}
		}
		if(c){
			if(a==0){
				ret+=dp[b][n-1]; ret%=MOD;
			}
			else {
				for(int j=n-1;j>=0;j--){
					ret+=dp[b][j]*C[n-1-j+a-1][n-1-j]; ret%=MOD;
				}
			}
		}
		//cerr<<i<<" "<<a<<" "<<b<<" "<<c<<endl;
		printf("%lld\n",ret);
	}
}



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

int main(){
	int n;
	cin>>n;
	for(int x=0;x<100;x++){
		for(int y=0;y<100;y++){
			if(4*x+7*y==n){
				cout<<"Yes"<<endl;
				return 0;
			}
		}
	}
	cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <math.h> 
#include <algorithm>
#include <numeric>
#include <functional>
#include <vector>
#include <string>
#include <numeric>
#include <bitset>

using namespace std;

int main() {

	long long n, k;
	cin >> n >> k;

	long long cnt_kisu = 0;
	if (k % 2 == 1) {
		for (long long i = 1; i <= n; ++i) {
			if (i % k == 0) {
				cnt_kisu++;
			}
		}
		cout << cnt_kisu * cnt_kisu * cnt_kisu << endl;
		return 0;
	}

	long long cnt_gusu_1 = 0;
	long long cnt_gusu_2 = 0;
	if (k % 2 == 0) {
		for (long long i = 1; i <= n; ++i) {
			if (i % k == 0) {
				cnt_gusu_1++;
				//cout << "k:" << i << endl;
			}
			if (i % k == k / 2) {
				cnt_gusu_2++;
				//cout << "k/2:" << i << endl;
			}
		}
		cout << cnt_gusu_1 * cnt_gusu_1 * cnt_gusu_1 + cnt_gusu_2 * cnt_gusu_2 * cnt_gusu_2 << endl;
		return 0;
	
	}

	return 0;
}

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

using namespace std;

typedef long long ll;

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n,w;
  cin>>n>>w;
  ll x,v;
  pair<bool,ll> dp[100001];
  for(ll i=0;i<=100000;i++)
  {
  dp[i].first=false;
  dp[i].second=INT_MAX;
  }
  dp[0].first=true;
  dp[0].second=0;
  for(ll i=0;i<n;i++)
  {
  cin>>x>>v;
  for(ll j=100000;j>=v;j--)
  {
  if(dp[j-v].first)
  {
  dp[j].first=true;
  dp[j].second=min(dp[j].second,dp[j-v].second+x);
  }
  }
  }
  ll ans=0;
  for(ll i=1;i<=100000;i++)
  {
  if(dp[i].first&&dp[i].second<=w) ans=max(ans,i);
  }
  cout<<ans;
}


Measured memory_bytes: 5200
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(){
	int N,m=0,num[200001]={0};
	string S[200001];
	cin>>N;
	for(int i=0;i<N;i++)cin>>S[i];
	sort(S,S+N);
	for(int i=1;i<N;i++){
		if(S[i-1]==S[i]){
			num[i]=num[i-1]+1;
			m=max(m,num[i]);
		}
	}
	for(int i=0;i<N;i++){
		if(num[i]==m)cout<<S[i]<<endl;
	}
	return 0;
}


Measured memory_bytes: 15104
#include<cstdio>
using namespace std;
int n,now,max;
char s[100010];
int main()
{
    scanf("%d%s",&n,s);
    for(int _=0;_<n;_++)
    {
        if(s[_]=='I')now++;
        else now--;
        if(now>max)max=now;
    }
    printf("%d",max);
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>
#include <chrono>
#include <random>
#include <functional>

using namespace std;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
typedef long long ll;

using ipair = pair<int, int>;

ll INF = 1e16+7;

bool operator>(const ipair a,const ipair b){return a.first > b.first;}


int main(){
  string S, T;
  cin >> S >> T;

  if(S.size() != T.size()){
    cout << "No" << endl;
    return 0;
  }

  rep(i, S.size()+1){
    if(S==T){
      cout << "Yes" << endl;
      return 0;
    }
    char c = S.back();
    S.pop_back();
    S = c + S;
  }

  cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < n; i++)
unsigned long long gcd(unsigned long long a, unsigned long long b) {
	if (a % b == 0)
		return b;
	else
		return gcd(b, a % b);
}
unsigned long long lcm(unsigned long long a, unsigned long long b) {
	return a * b / gcd(a, b);
}
signed main(signed argc, char* argv[]) {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	long long n;
	cin>>n;
	if(n%2){
	    cout<<0<<endl;
	    return 0;
	}
	long long cnt=10,ans=0;
	while(cnt<=n){
	    ans+=n/cnt;
	    cnt*=5;
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include <cmath>
#include <limits>
#include<set>
#include <iomanip>
#include <queue>
#include <map>
#include <string>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long long ll;
const long long INF=200000000000000;
const double inf=pow(10,10);
double pi=3.141592653589793;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const ll MOD = 1000000007;
void init(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout<<fixed;
}
	
int main(){
	init();
	ll N,M;
	cin>>N>>M;
	vector<ll>G[N+1];
	for(int i=0;i<M;i++){
		ll a,b;
		cin>>a>>b;
		G[a].push_back(b);
		G[b].push_back(a);
	}
	for(int i=1;i<=N;i++){
		cout<<G[i].size()<<endl;
	}
}


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

using namespace std;
#define int long long
const int INF = 200000000007;


  
signed main(){
    int r,g,b,n,ans=0;
    cin>>r>>g>>b>>n;
    for(int i=0;i*r<=n;i++){
        for(int j=0;i*r+g*j<=n;j++){
            if((n-i*r-g*j)%b==0)ans++;
            //cerr<<n-i*r-g*j;
        }
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 256