akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

// 提出時にclass Main に書き換え
public class Main {
	public static void main(String[] args)  {
		// 標準入力を受け取る
		Scanner sc = new Scanner(System.in);
		String S = sc.nextLine(); // String Sを受け取る
		sc.close(); // 標準入力を終了



		int r = 0; // 連続した雨の日数
		int rm = 0; // 連続した雨の日数(最大値)

		while(S.length() > 0) {
			if(S.startsWith("R")) {
				r += 1; // 連続した雨の日数を加算
			} else {
				r = 0; // 連続した雨の日数を加算
			}
			// 最大値更新
			if(r > rm) {rm = r;}
			// Sの先頭の文字を消去
			S = removeLeadingZeroes(S);
		}
		System.out.println(rm);
	}

	// 文字列の先頭を削除するメソッド
	static String removeLeadingZeroes(String s) {
	    StringBuilder sb = new StringBuilder(s);
	    if (sb.length() > 0) {
	        sb.deleteCharAt(0);
	    }
	    return sb.toString();
	}

}

Measured memory_bytes: 35724
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define pii pair<int, int>
#define pll pair<long long, long long>
using namespace std;


void yes(){
    cout<<"YES"<<endl;
}

void no(){
    cout<<"NO"<<endl;
}

int main(){
    int n,k;
    cin>>n>>k;
    vector<int> h(n);
    for(int i=0;i<n;i++){
        cin>>h[i];
    }
    vector<ll> dp(n,999999999);
    dp[0] = 0;
    for(int i =0;i<n-1;i++){
        for(int j=i+1;j<min(n,i+k+1);j++){
            dp[j] = min(dp[j],dp[i]+abs(h[i]-h[j]));
        }
    }
    cout<<dp[n-1]<<endl;

    return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <limits>
#include <queue>
#include <iomanip>
#include <set>
//#include <bits/stdc++.h>
template<typename T> bool chmax(T &a,T b){if(a<b){a=b;return true;}return false;}
template<typename T> bool chmin(T &a,T b){if(a>b){a=b;return true;}return false;}
using namespace std;
#define ALL(X) X.begin(),X.end()
using ll = long long int;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vvll> vvvll;
//const int MOD=1000000007;
const int MOD=998244353;
const int INTMAX=2147483647;
const ll LLMAX=9223372036854775807;

ll modadd(ll a,ll b,ll mod=MOD){
    return (a%mod+b%mod)%mod;
}

ll modsub(ll a,ll b,ll mod=MOD){
    a%=mod;
    b%=mod;
    if(a>=b) return a-b;
    else return mod-b+a;
}

ll modmul(ll a,ll b,ll mod=MOD){
    return ((a%mod)*(b%mod))%mod;
}

ll modpow(ll a, ll n,ll mod=MOD) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

ll moddiv(ll a,ll b,ll mod=MOD) {
    return modmul(a, modpow(b, mod-2));
}

vll fac, finv, inv;

void COMinit(ll MAX) {
    if(MAX<1) return;
    fac.resize(MAX);
    finv.resize(MAX);
    inv.resize(MAX);
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

ll COM(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    if(k==0 || n==k) return 1;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}




int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    ll N,M,K;
    cin>>N>>M>>K;
    
    COMinit(N);
    
    vll POW(N);
    POW[0]=1;
    for(ll i=1;i<N;i++){
        POW[i]=modmul(POW[i-1],M-1);
    }
    
    ll ans=0;
    for(ll i=0;i<=K;i++){
        ll tmp=COM(N-1,i);
        tmp=modmul(tmp,M);
        tmp=modmul(tmp,POW[N-1-i]);
        ans=modadd(ans,tmp);
    }
    cout<<ans<<endl;
    
    
    return 0;
}


Measured memory_bytes: 9508
// "include" {{{
#include <deque>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <deque>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <cstring>
#include <utility>
// }}}
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define int long long 
#define pii pair<int,int> 
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const long long mod = 1000000007;

int gcd(int a,int b){return b ? gcd(b,a%b) : a;}
int lcm(int a,int b){return a/gcd(a,b)*b;}

vector<int> t;
vector<int> a;

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int a,b,c;
	cin >> a >> b >> c;
	cout << ((a * c <= b) ? c : b / a )<< '\n';
	return 0;
}


Measured memory_bytes: 256
import bisect

n = int(input())
l = list(map(int, input().split()))

l.sort()

ans = 0

for i in range(n - 2):
    a = l[i]
    for j in range(n - i - 2):
        b = l[i + j + 1]
        index = bisect.bisect_left(l, a + b)
        if index > i + j + 2:
            ans += index - (i + j + 2)

print(ans)


Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
int main(){
  int w,h,n;cin>>w>>h>>n;
  int x[n],y[n],a[n];
  for(int i=0;i<n;i++)cin>>x[i]>>y[i]>>a[i];
  int hu=h,hd=0,wu=w,wd=0;
  for(int i=0;i<n;i++){
    if(a[i]==1){
      wd=max(wd,x[i]);
    }
    if(a[i]==2)wu=min(wu,x[i]);
    if(a[i]==3)hd=max(hd,y[i]);
    if(a[i]==4)hu=min(hu,y[i]);
  }
  cout<<max(0,(wu-wd))*max(0,(hu-hd))<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <tuple>
#include <cstdio>
#include <cassert>
#include <functional>
#define _LIBCPP_DEBUG 0
using namespace std;

int main() {
    string s;
    cin >> s;
    if(s[0]=='R'&&s[1]=='R'&&s[2]=='R'){
        cout << 3 << endl;
    }
    else if((s[0]=='R'&&s[1]=='R') || (s[1]=='R'&&s[2]=='R'))
    {
        cout << 2 << endl;
    }
    else if (s[0]=='R' || s[1] == 'R' || s[2] =='R')
    {
        cout << 1 << endl;
    }
    else
    {
        cout << 0 << endl;
    }
    
    
}


Measured memory_bytes: 3616
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Linq;

namespace contest_Csharp
{

    class Program
    {
        public static (long m, long s)[,] dp;

        static void Main(string[] args)
        {
            checked
            {
                var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
                Console.SetOut(sw);

                /*var vals = Console.ReadLine().Split(' ').
                    Select(x => int.Parse(x)).ToList();


                var D = vals[0];
                var T = vals[1];
                var S = vals[2];*/
                var S= Console.ReadLine();
                var D = Console.ReadLine();
                var ans = D.Length;
                for (int i = 0; i < S.Length-D.Length+1; i++)
                {
                    var na = 0;
                    var sb = S.Substring(i, D.Length);
                    for (int k = 0; k < D.Length; k++)          
                    {
                        if( sb[k] != D[k])
                            na++;
                    }
                    ans = Math.Min(na, ans);
                }
                
                Console.WriteLine(ans);

                Console.Out.Flush();
            }




        }
    }

}




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

// TYPEDEF
// ----------------------------------------
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> Pair;
typedef vector<ll> vll;
typedef vector<vector<ll>> Graph;
typedef vector<string> vs;
typedef vector<pair<ll, ll>> Pll;
typedef queue<ll> qll;

// REPEAT
// ----------------------------------------
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define REPA(i,a) for(ll i=0;i<(ll)(a.size());i++);
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define COUT(a) cout << (a) << endl;
#define ENDL(a) cout << endl;
#define COUTA(i,a) for(ll i=0;i<(ll)(a.size());i++) {cout << (a)[i] << " ";} cout << endl;

// UTIL
// ----------------------------------------
#define pb push_back
#define paired make_pair
#define ALL(a) (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define RSORT(a) sort((a).rbegin(), (a).rend())

// DEBUG
// ----------------------------------------
#ifdef _DEBUG
#define debug(x) cout << "[debug] " << #x << ": " << x << endl
#else
#define debug(x)
#endif

template <typename T>
void debugV(const vector<T> v) {
#ifdef _DEBUG
  rep(i, v.size()) {
    cout << i << ":" << v[i] << " ";
  }
  cout << endl;
#else
  (void)v;
#endif
}

// BIT FLAG
// ----------------------------------------
const unsigned int BIT_FLAG_0 = (1 << 0); // 0000 0000 0000 0001
const unsigned int BIT_FLAG_1 = (1 << 1); // 0000 0000 0000 0010
const unsigned int BIT_FLAG_2 = (1 << 2); // 0000 0000 0000 0100
const unsigned int BIT_FLAG_3 = (1 << 3); // 0000 0000 0000 1000
const unsigned int BIT_FLAG_4 = (1 << 4); // 0000 0000 0001 0000
const unsigned int BIT_FLAG_5 = (1 << 5); // 0000 0000 0010 0000
const unsigned int BIT_FLAG_6 = (1 << 6); // 0000 0000 0100 0000
const unsigned int BIT_FLAG_7 = (1 << 7); // 0000 0000 1000 0000
const unsigned int BIT_FLAG_8 = (1 << 8); // 0000 0001 0000 0000
const unsigned int BIT_FLAG_9 = (1 << 9); // 0000 0010 0000 0000
const unsigned int BIT_FLAG_10 = (1 << 10); // 0000 0100 0000 0000
const unsigned int BIT_FLAG_11 = (1 << 11); // 0000 1000 0000 0000

// CONST
// ----------------------------------------
constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr double PI=3.14159265358979323846; // or M_PI
constexpr int MOD = 1000000007;


void Main() {
  ll n;
  cin >> n;
  priority_queue<ld, vector<ld>, greater<ld>> pq;
  REP(i, n) {
    ll item;
    cin >> item;
    pq.push(item);
  }
  while(pq.size() > 1) {
    ld a = pq.top();
    pq.pop();
    ld b = pq.top();
    pq.pop();
    pq.push((a + b) / 2);
  }
  COUT(pq.top());
}


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

/*
3
500 300 200
*/


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

int main(){
  double a, b;
  cin >> a >> b;
  double c  = a / b;
  cout << c << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
const long mod=(long)1e9+7;
long dp[1<<17][1<<4];
int main(void){
  string S;
  cin>>S;
  int N=S.size();
  dp[0][0]=1;
  for(int i=0;i<N;i++){
    int c;
    c=S[i]=='?'?-1:S[i]-'0';
    for(int j=0;j<10;j++){
      if(c!=-1&&c!=j)continue;
      for(int k=0;k<13;k++){
        dp[i+1][(k*10+j)%13]+=dp[i][k];
      }
    }
    for(int j=0;j<13;j++)dp[i+1][j]%=mod;
  }
  cout<<dp[N][5]<<endl;
  return 0;
}


Measured memory_bytes: 14848
#include <cstdio>

using namespace std;

using int64 = long long;

class Combination {
 public:
  constexpr Combination() { Build(); }
  static constexpr int mod_ = 1000000007;
  static constexpr int n_ = 800000;
  class LookupTable {
   public:
    int64 factorial_[n_];
    int64 inverse_[n_];
    int64 finverse_[n_];
  };
  LookupTable lt{};
  // return nCk
  constexpr int64 Get(int n, int k) const noexcept {
    if (n < k || n < 0 || k < 0) return 0;
    return lt.factorial_[n] * (lt.finverse_[k] * lt.finverse_[n - k] % mod_) %
           mod_;
  }

 private:
  constexpr void Build() noexcept {
    lt.factorial_[0] = 1;
    lt.factorial_[1] = 1;
    lt.finverse_[0] = 1;
    lt.finverse_[1] = 1;
    lt.inverse_[1] = 1;
    for (int i = 2; i < n_; ++i) {
      lt.factorial_[i] = lt.factorial_[i - 1] * i % mod_;
      lt.inverse_[i] = mod_ - lt.inverse_[mod_ % i] * (mod_ / i) % mod_;
      lt.finverse_[i] = lt.finverse_[i - 1] * lt.inverse_[i] % mod_;
    }
  }
};

template<typename T> inline void fastin(T &num) {
  T c;
  num = 0;
  c = getchar_unlocked();
  for (; (c > 47 && c < 58); c = getchar_unlocked()) num = (num << 3) + (num << 1) + c - 48;
}

Combination com;

int main() {
  int x, y; fastin(x); fastin(y);

  if (x * 2 < y || x > 2 * y || (x + y) % 3 != 0) {
    printf("%d", 0);
    return 0;
  }
 
  //int nn = (x + y) / 3;
  //int r = x - nn;
 
  int64 ans = com.Get((x + y) / 3, x - (x + y) / 3);
  printf("%lld", ans);

  return 0;
}


Measured memory_bytes: 128
#include <iostream>
using namespace std;
#define ll long long

const int mod = 1e9+7, maxn = 2000010;
int r1, c1, r2, c2;

ll pre[maxn];
ll inv[maxn];
ll prei[maxn];
void build(int n){
    pre[1] = pre[0] = 1, inv[1] = inv[0] = 1, prei[1] = prei[0] = 1;
    for(int i = 2 ; i <= n ; i++){
        pre[i] = pre[i-1] * i % mod;
        inv[i] = (mod - mod / i * inv[mod % i] % mod) % mod;
        prei[i] = prei[i-1] * inv[i] % mod;
    }
}
ll C(int n, int k){
   return pre[n] * prei[k] % mod * prei[n-k] % mod;
}

ll solve(int x, int y){
    if (x == 0 || y == 0) return 0;
    ll ret = 0;
    for (int i = 1; i <= y; i++){
        ret += C(x+i+1, i+1);
    }
    ret -= y;
    return ret % mod;
}

int main(){
    build(2000005);
    cin >> r1 >> c1 >> r2 >> c2;
    cout << (solve(r2, c2)-solve(r1-1, c2)-solve(r2, c1-1)+solve(r1-1, c1-1)+mod*2)%mod << "\n";
}


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

int a, b, c, k;

int main(){
//	cin.tie(0);
//	ios::sync_with_stdio(false);
	cin >> a >> b >> c;
	if(a > b) swap(a, b);
	if(b > c) swap(b, c);
	cin >> k;
	for(int i=0; i<k; ++i)
		c <<= 1;
	cout << a + b + c << "\n";
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    double r;
    double are,circ,pi;
    scanf("%lf",&r);
    pi=3.141592653589;
    are=r*r*pi;
    circ=2*r*pi;
    printf("%lf %lf\n",are,circ);
    
    return 0;
}



Measured memory_bytes: 2104
#include <cstdio>
#include <iostream>
#include <vector>
#include <list>
#include <cmath>
#include <fstream>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <iterator>
#include <cstdlib>
#include <cstring>
#include <sstream>
#include <stack>

using namespace std;

const double EPS=(1e-10);
typedef long long ll;
typedef pair<int,int> pii;
typedef complex<double> P;
typedef pair<P,P> Rect;

bool EQ(double a,double b){
  return abs((a)-(b))<EPS;
}
void fast_stream(){
  std::ios_base::sync_with_stdio(0);
}

const int INF=1000000000;
int N;

class Event{
public:
  double y;
  bool isIn;
  int id;
  Event(){}
  Event(double y_,bool isIn_,int id_){
    y=y_;
    isIn=isIn_;
    id=id_;
  }
  bool operator<(const Event& e)const{
    return e.y>this->y; 
  }
};
Event evs[1001];
Rect recs[1001];

class UnionFindTree{
public:
  vector<int> par;
  vector<int> rank;
  vector<double> ls,rs;
  int treeSize;
public:
  UnionFindTree(int initTreeSize = 1000){
    treeSize = initTreeSize;
    init();
  }
  void init(){
    for(int i = 0; i < treeSize; i++){
      par.push_back(i);
      rank.push_back(0);
      ls.push_back(0);
      rs.push_back(0);
    }
  }
  int find(int x){  
    if(par[x] == x)return x;
    else return par[x] = find(par[x]);
  }
  void unite(int x,int y,double l,double r){
    x = find(x);
    y = find(y);
    if(x == y)return;
    if(rank[x] < rank[y])par[x] = y;
    else{
      par[y] = x;
      if(rank[y] == rank[x])rank[x]++;
    }
    int p=find(x);
    ls[p]=l;
    rs[p]=r;
  }
  bool same(int x,int y){
    return find(x) == find(y);
  }
};

int main(){
  int cnt=0;
  while(cin>>N&&N){
    int NN=0;
    for(int i=0;i<N;i++){
      double x,y,r;
      cin>>x>>y>>r;
      recs[i].first=P(x-r,y-r);
      recs[i].second=P(x+r,y+r);
      if(EQ(r,0))continue;
      evs[2*NN]=Event(y-r,true,i);
      evs[2*NN+1]=Event(y+r,false,i);
      NN++;
    }
    sort(evs,evs+2*NN);
    double prvy=-INF;
    double sumLen=0;
    double res=0;
    vector<int> v;
    for(int k=0;k<2*NN;k++){
      Event &e=evs[k];
      if(!EQ(prvy,-INF))res+=sumLen*(e.y-prvy);
      prvy=e.y;
      if(e.isIn)v.push_back(e.id);
      else v.erase(find(v.begin(),v.end(),e.id));
      UnionFindTree uft(v.size());
      for(int i=0;i<v.size();i++){
	uft.ls[i]=recs[v[i]].first.real();
	uft.rs[i]=recs[v[i]].second.real();
      }
      for(int i=0;i<v.size();i++){
	for(int j=i+1;j<v.size();j++){
	  int pari=uft.find(i);
	  int parj=uft.find(j);
	  if((EQ(uft.rs[pari],uft.ls[parj])
	      ||(uft.rs[pari]>uft.ls[parj]))
	     &&(EQ(uft.ls[pari],uft.rs[parj])
		||(uft.ls[pari]<uft.rs[parj]))){
	    double minx=min(uft.ls[pari],uft.ls[parj]);
	    double maxx=max(uft.rs[pari],uft.rs[parj]);
	    uft.unite(i,j,minx,maxx);
	  }
	}
      }
      set<int> s;
      for(int i=0;i<v.size();i++)
	s.insert(uft.find(i));
      sumLen=0;
      for(set<int>::iterator it
	    =s.begin();it!=s.end();it++){
	sumLen+=(uft.rs[*it]-uft.ls[*it]);
      }
    }
    cnt++;
    printf("%d %.2f\n",cnt,res);
  }

  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep2(i, m, n) for(int i=int(m); i<int(n); ++i)
#define drep2(i, m, n) for(int i=int(m-1); i>=int(n); --i)
#define rep(i, n) rep2(i, 0, n)
#define drep(i, n) drep2(i, n, 0)
#define all(a) a.begin(), a.end()
using ll = long long;
using ld = long double;
using V = vector<int>;
using Vll = vector<ll>;
using Vld = vector<ld>;
using Vbo = vector<bool>;
using VV = vector<V>;
using VVll = vector<Vll>;
using VVld = vector<Vld>;
using VVbo = vector<Vbo>;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
using Pld = pair<ld, ld>;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
template<typename T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
template<typename T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.first >> p.second; return is; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
template<typename T> istream &operator>>(istream &is, vector<T> &v) { for (auto &e : v) is >> e; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &v) { for (auto &e : v) os << e << endl; return os; }
template<typename T> inline int count_between(vector<T> &a, T l, T r) { return lower_bound(all(a), r) - lower_bound(all(a), l); } // [l, r)
inline int Log2(ll x) { int k; for (k = 0; x > 0; ++k) x >>= 1; return k; } // number of binary digits
const int INF  = 1<<30;
const ll INFll = 1ll<<62;
const ld EPS   = 1e-10;
const int MOD  = int(1e9)+7;

VV G;
V c, dp;
ll s = 0;
Vll ans;

void dfs(int u, int p=-1) {
  ll tmp = dp[c[u]] + s;
  for (auto v : G[u]) {
    if (v == p) continue;
    ll tmp2 = dp[c[u]] + s;
    dfs(v, u);
    ll x = dp[c[u]] + s - tmp2;
    ans[c[u]] -= x*(x+1)/2;
  }
  ++s;
  dp[c[u]] = tmp - s;
}

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

  c.assign(n, 0);
  dp.assign(n, 0);
  ans.assign(n, n*(n+1)/2);

  rep(i, n) {
    cin >> c[i];
    --c[i];
  }

  G.assign(n, V());
  rep(i, n-1) {
    int a, b;
    cin >> a >> b;
    a--; b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }

  dfs(0);
  rep(i, n) {
    ll x = dp[i] + s;
    ans[i] -= x*(x+1)/2;
  }

  cout << ans;
  return 0;
}


Measured memory_bytes: 33016
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    string c;
    cin >> c;

    for (int i = 0; i<c.size(); i++) {
        if (c.at(i) == 'a' || c.at(i) == 'i' || c.at(i) == 'u' || c.at(i) == 'e' || c.at(i) == 'o') {
            cout << "vowel" << endl;
        }
        else {
            cout << "consonant" << endl;
        }
    }
}

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

int main(){
    int a, b, k;
    cin >> a >> b >> k;

    int tmp = 0;
    int ans;
    for(int i=min(a, b); i>0; --i){
        if(a % i == 0 && b % i == 0) tmp++;
        if(tmp == k){
            ans = i;
            break;
        }
    }
    cout << ans << "\n";
}

Measured memory_bytes: 256
macro_rules ! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; input_inner ! { iter , $ ( $ r ) * } } ; ( iter = $ iter : ident , $ ( $ r : tt ) * ) => { let s = { use std :: io :: Read ; let mut s = String :: new ( ) ; std :: io :: stdin ( ) . read_to_string ( & mut s ) . unwrap ( ) ; s } ; let mut $ iter = s . split_whitespace ( ) ; input_inner ! { $ iter , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let s = { use std :: io :: Read ; let mut s = String :: new ( ) ; std :: io :: stdin ( ) . read_to_string ( & mut s ) . unwrap ( ) ; s } ; let mut iter = s . split_whitespace ( ) ; input_inner ! { iter , $ ( $ r ) * } } ; }
macro_rules ! input_inner { ( $ iter : expr ) => { } ; ( $ iter : expr , ) => { } ; ( $ iter : expr , mut $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let mut $ var = read_value ! ( $ iter , $ t ) ; input_inner ! { $ iter $ ( $ r ) * } } ; ( $ iter : expr , mut $ var : ident $ ( $ r : tt ) * ) => { input_inner ! { $ iter , mut $ var : usize $ ( $ r ) * } } ; ( $ iter : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ iter , $ t ) ; input_inner ! { $ iter $ ( $ r ) * } } ; ( $ iter : expr , $ var : ident $ ( $ r : tt ) * ) => { input_inner ! { $ iter , $ var : usize $ ( $ r ) * } } ; }
macro_rules ! read_value { ( $ iter : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ iter , $ t ) ) ,* ) } ; ( $ iter : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ iter , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ iter : expr , { chars : $ base : expr } ) => { read_value ! ( $ iter , String ) . chars ( ) . map ( | c | ( c as u8 - $ base as u8 ) as usize ) . collect ::< Vec < usize >> ( ) } ; ( $ iter : expr , { char : $ base : expr } ) => { read_value ! ( $ iter , { chars : $ base } ) [ 0 ] } ; ( $ iter : expr , chars ) => { read_value ! ( $ iter , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ iter : expr , char ) => { read_value ! ( $ iter , chars ) [ 0 ] } ; ( $ iter : expr , usize1 ) => { read_value ! ( $ iter , usize ) - 1 } ; ( $ iter : expr , $ t : ty ) => { $ iter . next ( ) . unwrap ( ) . parse ::<$ t > ( ) . unwrap ( ) } ; }
use std::collections::VecDeque;
fn main() {
    input! { iter = iter, s: chars, q };
    let mut s = s.into_iter().collect::<VecDeque<_>>();
    let mut rev = false;
    for _ in 0..q {
        input_inner! {iter, x};
        if x == 1 {
            rev = !rev;
        } else {
            input_inner! {iter, f, c: char};
            if ((f != 1) ^ rev) == true {
                s.push_back(c);
            } else {
                s.push_front(c);
            }
        }
    }
    if rev {
        println!("{}", s.into_iter().rev().collect::<String>());
    } else {
        println!("{}", s.into_iter().collect::<String>());
    }
}


Measured memory_bytes: 8444
H,W=map(int,input().split())
L=[]

for i in range(H):
    L1=list(map(int,input().split()))
    L.append(L1)
ans=[]
cnt=0
for a in range(H):
    for b in range(W):
        if a%2==0:
            if b<W-1:
                if L[a][b]%2==1:
                    L[a][b]-=1
                    L[a][b+1]+=1
                    ans.append([a+1,b+1,a+1,b+2])
                    cnt+=1
            if b==W-1:
                if a<H-1:
                    if L[a][b]%2==1:
                        L[a][b]-=1
                        L[a+1][b]+=1
                        ans.append([a+1,b+1,a+2,b+1])
                        cnt+=1
        if a%2==1:
            if b<W-1:
                if L[a][W-1-b]%2==1:
                    L[a][W-1-b]-=1
                    L[a][W-1-b-1]+=1
                    ans.append([a+1,W-b,a+1,W-1-b])
                    cnt+=1
            if b==W-1:
                if a<H-1:
                    if L[a][W-1-b]%2==1:
                        L[a][W-1-b]-=1
                        L[a+1][W-1-b]+=1
                        ans.append([a+1,W-b,a+2,W-b])
                        cnt+=1
print(cnt)
for x in range(len(ans)):
    print(ans[x][0],ans[x][1],ans[x][2],ans[x][3])

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

using namespace std;

int main() {
	int a, b, c, x;
	cin >> a >> b >> c >> x;
	int answer = 0;
	for (int i = 0; i <= a; i++) {
		for (int j = 0; j <= b; j++) {
			for (int k = 0; k <= c; k++) {
				if (500 * i + 100 * j + 50 * k == x) {
					answer++;
				}
			}
		}
	}
	cout << answer << endl;
	return 0;
}


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

#ifdef LOCAL
#define debug(var) cerr << (#var) << " = " << (var) << endl;
#else
#define debug(var)
#endif

void init() {
  ios_base::sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
}

const int N = 2e5+23;

int a[N], b[N];

void solve() {
  int n, k; scanf("%d%d", &n, &k);
  for (int i = 0; i < n; ++i) {
    scanf("%d", a+i);
  }
  for (int i = 0; i < k; ++i) {
    for (int j = 0; j < n; ++j) {
      int l = max(0, j-a[j]),
          r = min(n-1, j+a[j]);
      ++b[l];
      if (r+1 < n) --b[r+1];
    }
    a[0] = b[0];
    bool allsame = true;
    for (int j = 1; j < n; ++j) {
      a[j] = (b[j] += b[j-1]);
      b[j-1] = 0;
      if (a[j] != a[j-1] || a[j] != n) allsame = false;
    }
    if (allsame) break;
    b[n-1] = 0;
  }
  for (int i = 0; i < n; ++i) printf("%d ", a[i]);
}

int main() {
  int t = 1; //scanf("%d", &t);
  while (t--) {
    solve();
  }
  return 0;
}


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

#define pb         push_back

const int INF = 100000000;


int main(void) {
	while(1){
		int n, m;
		cin >> n;
		if(n == 0) break;

		bool ma[22][22];
		memset(ma, 0, sizeof(ma));
		for(int i=0; i<n; i++){
			int x, y;
			cin >> x >> y;
			ma[y][x] = true;
		}

		cin >> m;
		int px = 10;
		int py = 10;
		int col = 0;
		if(ma[py][px] == true) {
			col++;
			ma[py][px] = false;
		}
		for(int i=0; i<m; i++){
			char d;
			int l;
			cin >> d >> l;
			int dx = 0;
			int dy = 0;
			switch(d){
				case 'N':
					dy = 1;
					break;
				case 'E':
					dx = 1;
					break;
				case 'S':
					dy = -1;
					break;
				case 'W':
					dx = -1;
					break;
			}

			for(int i=0; i<l; i++){
				px += dx;
				py += dy;
				if(ma[py][px]){
					col++;
					ma[py][px] = false;
				}
			}
		}
		if(col == n){
			cout << "Yes" << endl;
		}else{
			cout << "No" << endl;
		}
	}
	
	return 0;
}

Measured memory_bytes: 1152
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <string.h>
#include <queue>
#include <vector>
#include <set>
using namespace std;
int main() {
	int A[100]={};
	for(int i=0;i<3;i++)
	{
		int k;
		cin>>k;
		A[k-1]=1;
	}
	int ans=0;
	for(int i=0;i<100;i++)if(A[i])ans++;
	cout<<ans;
}


Measured memory_bytes: 256
// #pragma GCC optimize("Ofast")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
// #pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define mp make_pair
#define pi pair<int,int>
#define pl pair<long long int,long long int>
#define pb push_back
#define fi first
#define se second
#define len(a) (int)(a).length()
#define sz(a) (int)(a).size()

using namespace std;

string s, t;
int dp[3000][3000];
pi c[3000][3000];

int main ()
{
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	memset(dp, 0, sizeof(dp));
	cin >> s >> t;
	bool f = 0;
	for (int i=0; i<len(s); ++i) {
		if (t[0] == s[i]) f = 1;
		if (!f) dp[i][0] = 0;
		else dp[i][0] = 1;
	}
	f = 0;
	for (int i=0; i<len(t); ++i) {
		if (t[i] == s[0]) f = 1;
		if (!f) dp[0][i] = 0;
		else dp[0][i] = 1;
	}
	for (int i=1; i<len(s); ++i)
		for (int j=1; j<len(t); ++j)
			if (s[i] == t[j]) {
				dp[i][j] = 1 + dp[i-1][j-1];
				c[i][j] = pi(i-1,j-1);
			}
			else {
				if (dp[i-1][j] >= dp[i][j-1]) {
					dp[i][j] = dp[i-1][j];
					c[i][j] = pi(i-1,j);
				}
				else {
					dp[i][j] = dp[i][j-1];
					c[i][j] = pi(i,j-1);
				}
			}
	string ans;
	int i = len(s) - 1, j = len(t) - 1;
	while (i && j) {
		if (s[i] == t[j]) {
			ans += s[i];
			i--; j--;
		}
		else {
			int temp = i;
			i = c[i][j].fi;
			j = c[temp][j].se;
		}
	}
	if (len(ans) < dp[len(s)-1][len(t)-1])
		if (!i) ans += s[i];
		else ans += t[j];
	reverse(ans.begin(), ans.end());
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 105728
#include <stdio.h>
#include <string.h>
 
int main(){
  int n;
  int i, j;
  int l;
 
  scanf("%d", &n);
  char w[n][100];
  for (i = 0; i < n; ++i){
  	scanf("%s", w[i]);
  }
  for (i = 0; i < n-1; ++i){
  	l = strlen(w[i]);
    if(w[i][l-1] != w[i+1][0]){
      printf("No");
      return 0;
    }
  }
  for (i = 0; i < n; ++i){
    for (j = i+1; j < n; ++j){
      if(strcmp(w[i],w[j]) == 0){
        printf("No");
        return 0;
      }
    }
  }
  printf("Yes");
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<typename T> using gpp_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T, typename L> using gpp_map = tree<T, L, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T> using gpp_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;*/
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl;
#define mdebug(m) cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;}
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};

const int mod = 1000000007;
//const int mod = 998244353;
//#define Add(x, y) x = (x + (y)) % mod
//#define Mult(x, y) x = (x * (y)) % mod



signed main(){

    string S; cin >> S;
    int N = SZ(S);

    int ans = N;
    REP(i, N - 1) if(S[i] != S[i + 1]){
        Min(ans, max(i + 1, N - 1 - i));
    }
    Out(ans);

    return 0;
}


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

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

//#define int long long
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

typedef long long ll;
//typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector<vector<int>> mat;
typedef unsigned int uint;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

bool isPrime(ll p) {
	if (p == 1)return false;
	for (ll i = 2; i*i <= p; ++i)
		if (p%i == 0)return false;
	return true;
}

int n, m;

ll dfs(int index, char* str)
{
	ll res = -1;

	if (index == n)
	{
		ll t = atoll(str);
		if (isPrime(t))
		{
			return t;
		}
		else
		{
			return -1;
		}
	}
	else
	{
		for (int i = '0'; i <= '9'; i++)
		{
			if (i == 0 && (i - '0') % 2 == 0)continue;
			str[index] = i;
			str[2 * n - index] = i;
			chmax(res, dfs(index + 1, str));
		}
	}
	return res;
}

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

	cin >> n >> m;
	if (m < 0)
	{
		if (n == 1)cout << "11";
		else rep(i, 0, 2 * n)cout << "9";
		cout << endl;
	}
	else
	{
		char str[30];
		str[2 * n + 1] = '\0';
		str[n] = '0' + m;
		cout << dfs(0, str) << endl;
	}

	return 0;
}


Measured memory_bytes: 3156
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <math.h>

#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define rep+(i, a, b) for(int i = a; i < b; i++)
#define rep-(i, a, b) for(int i = a - 1; i >= b; i--)

using namespace std;

int main()
{
  int a = 0 , b = 0, c = 0, d = 0, e = 0, f = 0, i = 0, j = 0;
  int num = 0, count = 0, ans = 0;
  double d1 = 0, d2 = 0, d3 = 0, d4 = 0, d5 = 0, d6 = 0;
  int a1[256], a2[512], a3[1024];
  //char s1[200000], s2[200000], s3[200000];
  //string s1, s2, s3;
  
  cin >> a;
  for(i = 0; i < a; i++){
    cin >> a1[i];
  }
   
 for(i = 0; i < a; i++){
   for(j = i + 1; j < a; j++){
     b = a1[i] * a1[j];
     c += b;
    }
  }
  cout << c << endl;
}
  


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll n,i,t,k,x,a,y,j,b,d,c,sum1,sum2,rmin=INT_MAX,rmax=INT_MIN,cmin=INT_MAX,cmax=INT_MIN;
int main()
{
    cin>>n;
    if(n>=30)
        cout<<"Yes";
    else
        cout<<"No";
}


Measured memory_bytes: 3640
#include "bits/stdc++.h"
using namespace std;

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

	double ans = static_cast<double>(W) * static_cast<double>(H) / 2;
	int num = (x + x == W) && (y + y == H);

	cout << fixed << setprecision(10);
	cout << ans << " " << num << endl;
}

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


#define mems(arr,VAL)           memset(arr,VAL,sizeof(arr))
#define pii                     pair<int,int>
#define mk                      make_pair
#define pb                      push_back
#define ff                      first
#define ss                      second
#define PI                      acos(-1.0)

#define pf                      printf
#define sc                      scanf
//#define Mod                     1000000007
#define hiii                    1e9//1000000000
#define looo                   -1e9//-1000000000
#define NMAX                    100005




int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    ll H ,  A ;
    cin >> H >> A ;
    cout << (double)ceil((double)H/(double)A) << endl ;


//cout << double( clock() - startTime ) / (double)CLOCKS_PER_SEC<< " seconds." << endl;
return 0;
}




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

int main(){
    int n, k;
    cin >> n >> k;
    vector<int> p(n);
    for(int i = 0; i < n; i++) cin >> p[i];
    sort(p.begin(), p.end());
    int sum = 0;
    for(int i = 0; i < k; i++) sum += p[i];
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,k;
  cin >> n >> k;
  
  vector<int64_t> cont(n);
  for(int i = 0 ; i < n ; i++){
    cin >> cont.at(i);
  }
  
  int64_t ans = 10000000009;
  for(int i = 0 ; i < n-k+1 ; i++){
    int64_t a = abs(cont.at(i)) + abs(cont.at(i) -cont.at(i+k-1));
    int64_t b = abs(cont.at(i+k-1)) + abs(cont.at(i) -cont.at(i+k-1));
    
    ans = min(a,ans);
    ans = min(b,ans);
  }
  cout << ans << endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main()
{
  string s;
  cin>>s;
  int flag=0;
  for(int i=1;i<4;++i){
    if(s[i]==s[i-1]){ flag=1; break;}
  }
  if(flag==1) cout<<"Bad";
  else cout<<"Good";
  return 0;
}

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

typedef long long int int64;
int n,k;
int64 m;
int64 coe[303][303];
int64 dp[303][303];

int main()
{
	scanf("%d%d%lld",&n,&k,&m);
	coe[0][0] = 1;
	for(int i = 1;i <= n;++i) {
		coe[i][0] = 1;
		for(int j = 1;j <= i;++j) {
			coe[i][j] = (coe[i-1][j-1]*(i-j+1)+coe[i-1][j])%m;
		}
	}
	for(int j = 0;j <= k;++j) {
		dp[0][j] = 1;
	}
	for(int i = 1;i <= n;++i) {
		for(int j = 1;j <= k;++j) {
			int64 val = 0;
			for(int c = 0;c <= i;++c) {
				val += dp[i-c][j-1] * coe[i][c] % m;
			}
			dp[i][j] = val % m;
		}
	}
	printf("%lld\n", dp[n][k]);
}


Measured memory_bytes: 1664
#include <iostream>
#include <vector>
#include <string>
#include <numeric>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#include <cmath>

using namespace std;
using ll = long long;

int gcd(int a, int b) { return (b == 0) ? a : gcd(b, a % b); }

#define CIN(T, x) T x; cin >> x;
#define CINS(T, x, N) vector<T> x(N); for(int i = 0; i < (N); i++) { cin >> x[i]; }
#define SHOW(x) for(int i = 0; i < x.size(); i++) { cout << x[i] << " "; } cout << "\n";
#define SHOW2(x) for(int j = 0; j < x.size(); j++) { SHOW(x[j]); } cout << "\n";


int main() {

    CIN(ll, N);
    CIN(ll, M);

    cout << min((N * 2 + M) / 4, M / 2) << "\n";
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.math.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String N = sc.next();
    int K = sc.nextInt();
    sc.close();

    int L = N.length();
    int[][] dp0 = new int[L + 1][K + 1];
    int[][] dp1 = new int[L + 1][K + 1];
    dp1[0][0] = 1;

    for (int i = 0; i < L; i++) {
      int d = N.charAt(i) - '0';
      for (int j = 0; j < K + 1; j++) {
        if (d == 0) {
          dp1[i + 1][j] += dp1[i][j];
        } else {
          if (j < K) {
            dp1[i + 1][j + 1] += dp1[i][j];
            dp0[i + 1][j + 1] += dp1[i][j] * (d - 1);
          }
          dp0[i + 1][j] += dp1[i][j];
        }

        if (j < K) {
          dp0[i + 1][j + 1] += dp0[i][j] * 9;
        }
        dp0[i + 1][j] += dp0[i][j];
      }
    }

    long ans = dp0[L][K] + dp1[L][K];
    System.out.println(ans);
  }
}


Measured memory_bytes: 21844
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


N,M = list(map(int,input().split()))
Network = UnionFind(N)

out = 0
for i in range(M):
    a, b = list(map(int,input().split()))
    Network.union(a-1, b-1)
print(-1*min(Network.parents))

Measured memory_bytes: 79620
#include<stdio.h>
int main(void)
{
    int a,b,c;
	scanf ("%d %d %d",&a,&b,&c);
	{
	if (a==1&&b==0&&c==0)
	    printf ("Close\n");
	else if (a==0&&b==1&&c==0)
	    printf ("Close\n");
	else if (a==1&&b==1&&c==0)
	    printf ("Open\n");
	else if (a==0&&b==0&&c==1)
	    printf ("Open\n");
	else if (a==0&&b==0&&c==0)
	    printf ("Close\n");
	}
	return 0;
}
	

Measured memory_bytes: 1012
#define _GLIBCXX_DEBUG
#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()
using llint = long long;
using vint = vector<int>;

int main () {
    int a, b, c, d, e, k;
    bool flag = true;
    cin >> a >> b >> c >> d >> e >> k;
    if (b - a > k) flag = false;
    if (c - a > k) flag = false;
    if (d - a > k) flag = false;
    if (e - a > k) flag = false;
    if (c - b > k) flag = false;
    if (d - b > k) flag = false;
    if (e - b > k) flag = false;
    if (d - c > k) flag = false;
    if (e - c > k) flag = false;
    if (e - d > k) flag = false;

    if (flag == true) cout << "Yay!\n";
    else cout << ":(\n";
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include  <queue>
#include <vector>
#include  <cstdio>
#include <cstring>
#include<map>
#include<set>
//#include<bits/stdc++.h>
#define ll long long int
#define ull unsigned long long int
#define I(a) scanf("%d",&a)
#define I2(a,b) scanf("%d%d",&a,&b)
#define I3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define L(a) scanf("%lld",&a)
#define L2(a,b) scanf("%lld%lld",&a,&b)
#define L3(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define PI(a) printf("%d",a)
#define PL(a) printf("%lld",a)
#define PT(t) printf("Case %d: ",t)
#define PB push_back
#define x first
#define y second
#define xx first.first
#define xy first.second
#define yx second.first
#define yy second.second
#define SC scanf
#define PC printf
#define NL printf("\n")
#define SET(a) memset(a,0,sizeof a)
#define SETR(a) memset(a,-1,sizeof a)
#define SZ(a) ((int)a.size())-1
#define f(i,a,b) for(int i=a;i<=b; i++)
#define fr(i,a,b) for(int i=a;i<=b; i++)
#define frr(i,a,b) for(int i=a;i>=b; i--)
#define frv(i,a)  for(int i=0;i<a.size();i++)
#define pi 2.0*acos(0.0)
#define R(a) freopen(a, "r", stdin);
#define W(a) freopen(a, "w", stdout);
#define CB(x) __builtin_popcount(x)
#define STN(a) stringtonumber<ll>(a)
#define lol printf("BUG\n")
#define Endl "\n"
#define mk make_pair
using namespace std;
template <class T> inline T BM(T p, T e, T M)
{
    ll ret = 1;
    for(; e > 0; e >>= 1)
    {
        if(e & 1) ret = (ret * p) % M;
        p = (p * p) % M;
    }
    return (T)ret;
}
template <class T> inline T mul(T p, T e, T M)
{
    ll ret = 0;
    for(; e > 0; e >>= 1)
    {
        if(e & 1) ret = (ret + p) ;
        p = (p + p) ;
        if(ret>=M)ret-=M;
        if(p>=M)p-=M;
    }
    return (T)ret;
}
template <class T> inline T gcd(T a, T b)
{
    if(b == 0)return a;
    return gcd(b, a % b);
}
template <class T> inline T mdINV(T a, T M)
{
    return BM(a, M - 2, M);
}
template <class T> inline T PW(T p, T e)
{
    ll ret = 1;
    for(; e > 0; e >>= 1)
    {
        if(e & 1) ret = (ret * p);
        p = (p * p);
    }
    return (T)ret;
}
 
 
template <class T>bool ISLEFT(T a, T b, T c)
{
    if(((a.xx - b.xx) * (b.yy - c.yy) - (b.xx - c.xx) * (a.yy - b.yy)) < 0.0)return 1;  //Uporer dike //A,b,c, x okkher ordera sorted
    else return 0;
}
 

#define  mx 200004
#define base 193ll
 
typedef pair<int,int >P;
//////////////////////////
////////////////////////
#define F(i,a,b) for(int i=a;i<b; i++)
#define LL long long
#define MX  200007
#define md 998244353ll
///////////////////////////
///////////////////////////
///

int main(){


    ll a, b, c;
    cin>>a>>b>>c;

    if (a <= b && b <= c){
        cout << (a-1) << endl;
    }
    else {
        ll p  = min(c, b-1);
        ll x = ( a * p) / b;
        ll y = a * (p / b);
        cout << (x-y) << endl;
    }
    // ll ma = 0;
    // int in = 0;
    // for(int i = 1;i<=c;i++){
    //     ll x = (a * i) / b;
    //     ll y = a * (i / b);


    //    // cout<<i<<" "<<(x-y)<<endl;
    //     if(x - y >= ma){
    //         ma = x-y;
    //         in = i;
    //     }
    // }

    // cout<<in<< " "<<ma<<endl;



    return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define int long long
using namespace std;
int dp[4001][4001];
int MOD = 998244353;
signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s;
    cin >> s;
    int n = s.size();
    for (int i=0; i <= 2*n; i++) for (int j=0; j <= 2*n;j++) dp[i][j] = 0;
    dp[0][0] = 1;
    for (int i=0; i < 2*n; i++){
        for (int j=0; j <= 2*n; j++){
            if (dp[i][j] == 0) continue;
            //cout << i << " " << j << " " << dp[i][j] << endl;
            int blue = min(2*i, 2*n) - i - j, red=j;
            if (i < n){
                blue += s[i] - '0';
                red += 2 - (s[i]-'0');
            }
            if (blue > 0){
                dp[i+1][red] += dp[i][j];
                dp[i+1][red]%= MOD;
            }
            if (red>0){
                dp[i+1][red-1] += dp[i][j];
                dp[i+1][red-1] %= MOD;
            }
        }
    }
    cout << dp[2*n][0];


}


Measured memory_bytes: 125312
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
signed main(){
  int rx,ry,N,lx=0,ly=0;
  cin>>rx>>ry>>N;
  rep(i,0,N){
    int X,Y,A;
    cin>>X>>Y>>A;
    if(A==2)
      rx=min(rx,X);
    else if(A==1)
      lx=max(lx,X);
    else if(A==4)
      ry=min(ry,Y);
    else
      ly=max(ly,Y);
  }
  int ans=max(0LL,rx-lx)*max(0LL,ry-ly);
  cout<<ans<<endl;
  }



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define LOOP(n) for (int _i = 0; _i < (n); _i++)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define FOR(i, r, n) for (int i = (r); i < (n); ++i)
#define ALL(obj) begin(obj), end(obj)
using namespace std;
using ll = long long;
using ull = unsigned long long;

const int INF = 2100100100;
const int MOD = 1e9 + 7;

// 多次元 vector 生成
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template <class T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}

string N;
ll dp[1000005][2];
int main() {
    // cin.tie(0);
    // ios::sync_with_stdio(false);

    cin >> N;

    int car = 0;
    ll ans = 0;
    dp[0][1] = 1;
    REP(i, (int)N.size()) {
        int now = (int)(N[i] - '0');
        dp[i + 1][0] = min(dp[i][0] + now, dp[i][1] + (10 - now));
        dp[i + 1][1] = min(dp[i][0] + now + 1, dp[i][1] + (10 - 1 - now));
    }

    cout << dp[N.size()][0] << endl;

    return 0;
}


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

static class Program
{
    static void Main()
    {
        var s = Console.ReadLine();

        string answer;
        if (s.Last() != 's')
        {
            answer = s + "s";
        }
        else
        {
            answer = s + "es";
        }

        Console.WriteLine(answer);
    }
}

Measured memory_bytes: 26168
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define ll long long

int main() {
	ll a,b,ans;
	cin>>a>>b;
	if((a==1 && b==2) || (a==2 && b==1))
	ans=3;
	if((a==2 && b==3) || (a==3 && b==2))
	ans=1;
	if((a==1 && b==3) || (a==3 && b==1))
	ans=2;
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256