akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i,n) for(ll i=0;i<n;i++)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define fi first
#define se second
#define endl "\n"

template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){int len=d.size();rep(i,len){s<<d[i];if(i<len-1) s<<" ";}return s;}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){int len=d.size();rep(i,len){s<<d[i]<<endl;}return s;}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T> ostream& operator<<(ostream& s,const multiset<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){s<<"{"<<endl;for(auto itr=m.begin();itr!=m.end();++itr){s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;}s<<"}"<<endl;return s;}

const ll mod=1e9+7;
const ll inf=1e17;
const int INF=1e9;
const double EPS=1e-10;
const double PI=acos(-1);

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    ll h,w;
    cin>>h>>w;
    ll ans=inf;
    FOR(i,1,h){
        vector<ll> sum(3);

        sum[0]=i*w;
        sum[1]=(h-i)*(w/2);
        sum[2]=(h-i)*(w-w/2);
        sort(begin(sum),end(sum));
        chmin(ans,sum[2]-sum[0]);

        sum[0]=i*w;
        sum[1]=w*((h-i)/2);
        sum[2]=w*((h-i)-(h-i)/2);
        sort(begin(sum),end(sum));
        chmin(ans,sum[2]-sum[0]);
    }
    FOR(i,1,w){
        vector<ll> sum(3);

        sum[0]=i*h;
        sum[1]=(w-i)*(h/2);
        sum[2]=(w-i)*(h-h/2);
        sort(begin(sum),end(sum));
        chmin(ans,sum[2]-sum[0]);

        sum[0]=i*h;
        sum[1]=h*((w-i)/2);
        sum[2]=h*((w-i)-(w-i)/2);
        sort(begin(sum),end(sum));
        chmin(ans,sum[2]-sum[0]);
    }
    cout<<ans<<endl;
}

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

int main(){
    int w,h,n;
    cin >> w >> h >> n;
    int l,r,u,d;
    l=d=0;
    r=w;
    u=h;

    int x,y,a;
    while (cin >> x >> y >> a)
    {
        if (a==1)
        {
            l = max(l,x);
        }
        else if (a==2)
        {
            r = min(r,x);
        }
        else if (a==3)
        {
            d = max(d,y);
        }
        else
        {
            u = min(u,y);
        }
    }
    int ver,hori;
    ver = max(0,u-d);
    hori = max(0,r-l);
    cout << ver*hori << endl;
}

Measured memory_bytes: 256
N, M = map(int, input().split())
AB = [tuple(map(int, input().split())) for _ in range(M)]

AB.sort(key=lambda ab: ab[1])
removed = list()
for a, b in AB:
    if len(removed) == 0:
        removed.append(b - 1)
    elif a <= removed[-1] < b:
        continue
    else:
        removed.append(b - 1)
print(len(removed))

Measured memory_bytes: 18256
N, Y = map(int, input().split())
Y //= 1000
for a in range(Y//10 + 1):
    for b in range((Y - 10 * a) // 5 + 1):
        c = (Y - 10 * a - 5 * b)
        if a + b + c == N:
            print(a, b, c)
            exit()
print(-1, -1, -1)

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

namespace ARC074
{
    public class C
    {
        private long Value(long x, long y, long z)
        {
            var arr = new[] { x, y, z }.OrderBy(_ => _).ToArray();
            return arr[2] - arr[0];
        }
        private long F(long x, long y)
        {
            var y1 = y / 3;
            var y2 = (y - y1) / 2;
            var y3 = y - (y1 + y2);
            return Value(x * y1, x * y2, x * y3);
        }
        private long G(long x, long y, bool b)
        {
            var x1 = x / 3 + (b ? 1 : 0);
            var y1 = y / 2;
            return Value(x1 * y, (x - x1) * y1, (x - x1) * (y - y1));
        }

        private void Run()
        {
            var input = Console.ReadLine().Trim().Split();
            var H = int.Parse(input[0]);
            var W = int.Parse(input[1]);

            Console.WriteLine(
                new[]{
                    F(H,W),
                    F(W,H),
                    G(H,W,true),
                    G(H,W,false),
                    G(W,H,true),
                    G(W,H,false),
                }.Min());
        }

        public static void Main()
        {
            var old = Console.Out;
            using (var writer = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false })
            {
                Console.SetOut(writer);
                new C().Run();
                Console.Out.Flush();
                Console.SetOut(old);
            }
        }
    }
}


Measured memory_bytes: 13396
// https://atcoder.jp/contests/abc124/tasks/abc124_b
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) FOR(i, 0, n)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()
#define CEIL(a, b) ((a - 1) / b + 1)

void solve() {
    int N;
    cin >> N;
    vector<int> H(N);
    REP(i, N) { cin >> H[i]; }
    int ans = 1, maxv = H[0];
    FOR(i, 1, N) {
        if (H[i] >= maxv) {
            ans++;
        }
        maxv = max(maxv, H[i]);
    }
    cout << ans << endl;
}

signed main() {
    cin.tie(nullptr)->sync_with_stdio(false);
    solve();
}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())
using namespace std;

typedef long long ll;

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; }
const int INF = 1e9;
const long long INFL = 1LL<<60;

int main() {
  int n;
  cin >> n;
  vector<pair<int, int>> a(n);
  rep(i, n) {
    int tmp;
    cin >> tmp;
    a[i] = make_pair(tmp, i);
  }

  sort(a.begin(), a.end());

  rep(i, n) {
    cout << a[i].second + 1 << " ";
  }
  cout << endl;

  return 0;
}


Measured memory_bytes: 1664
Scanf.(Array.(let s,q,a,c,f,d=(fun f->Scanf.scanf" %d"f),(fun _->make 100005(0,0)),(fun a i->a.(i)<-fst a.(i)+1,i),(fun u v->compare v u),fst,snd in s@@fun n->let e,o=init n(fun i->s@@fun v->i,v)|>fold_left(fun(e,o)(i,v)->(if i mod 2=0 then a e v else a o v);e,o)(q 0,q 0)in sort c e;sort c o;print_int@@n-(if d e.(0)=d o.(0)then max(f e.(0)+f o.(1))(f e.(1)+f o.(0))else(f e.(0)+f o.(0)));0,0))

Measured memory_bytes: 10496
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod = 1e9+7;
int main()
{
	ios::sync_with_stdio(false),cin.tie(0);
	int a,b,c,k;
	cin >> a >> b >> c >> k;
	if(k<=a) cout << k << endl;
	else if(k<=a+b&&k>a) cout << a << endl;
	else if(k<=a+b+c&&k>a+b) cout << a-(k-a-b) << endl;
	return 0;	
}


Measured memory_bytes: 3668
#include <iostream>
#include <cmath>
typedef long long ll;
using namespace std;
  
ll calcGcd(ll a, ll b){
  if (a%b == 0){
    return(b);
  }else{
    return(calcGcd(b, a%b));
  }
}

int main() {
  ll a, b;
  cin >> a >> b;
  ll gcd = calcGcd(a, b);
  int count = 1;
  for(ll i=2; i*i<=gcd; i++){
    if(gcd % i == 0) count++;
    while(gcd % i == 0) gcd /= i;
  }
  if(gcd != 1) count++;
  cout << count << endl;
  return 0;
}
  

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;
public class Main { //A

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] A = new int[3];
		int ans = 0;

		for(int i=0; i<3; i++) {
			A[i] = sc.nextInt();
		}Arrays.sort(A);
		ans += A[2]-A[1];
		ans += A[1]-A[0];

		System.out.println(ans);
	}

}


Measured memory_bytes: 22996
#include <iostream>

using namespace std;

int main(int argc, char* argv[])
{
  int t; cin >> t;
  int h, m, s;

  s = t%60;
  m = t/60;
  h = m/60;
  m = m%60;

  cout << h << ':' << m << ':' << s << endl;
}

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

int main()
{
    int N;
    int count=0;
    string s;
    cin >> N >> s;

    for(int i=0; i<N-2; i++) {
        if(s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C') count++;
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 768
import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class Main {
    public static final long mod = (long)1e9+7;
    public static final long INF = Long.MAX_VALUE/2;
    public static final int inf = Integer.MAX_VALUE/2;

    static void solve(InputReader in, PrintWriter out){
        int n = in.ni();
        long[] a = in.nl(n);
        Arrays.sort(a);
        if(a[0]==0){
            out.println(0);
        }else{
            BigInteger max = new BigInteger("1000000000000000000");
            BigInteger b = new BigInteger("1");
            for(long i: a){
                b = b.multiply(new BigInteger(Long.toString(i)));
                if(b.compareTo(max)==1){
                    b = new BigInteger("-1");
                    break;
                }
            }
            out.println(b.toString());
        }
    }

    public static void main(String[] args){
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);
        solve(in, out);
        out.close();
    }
    public static class InputReader{
        private BufferedReader br;
        private StringTokenizer st;
        public InputReader(InputStream is){
            br = new BufferedReader(new InputStreamReader(is));
            st = null;
        }
        public String ns(){
            if(st == null || !st.hasMoreTokens()){
                try{
                    st = new StringTokenizer(br.readLine());
                }catch (Exception e){
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }
        public int ni(){
            return Integer.parseInt(ns());
        }
        public long nl(){
            return Long.parseLong(ns());
        }
        public double nd(){
            return Double.parseDouble(ns());
        }
        public char nc(){
            return ns().toCharArray()[0];
        }
        public int[] ni(int n){
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        }
        public long[] nl(int n){
            long[] a = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = nl();
            }
            return a;
        }
        public double[] nd(int n){
            double[] a = new double[n];
            for (int i = 0; i < n; i++) {
                a[i] = nd();
            }
            return a;
        }
    }
}

Measured memory_bytes: 53704
#pragma GCC optimize("O3")
#pragma GCC target("sse4")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const double PI=acos(-1.0);
#define t1(x)             cerr<<#x<<"="<<x<<endl
#define t2(x, y)          cerr<<#x<<"="<<x<<" "<<#y<<"="<<y<<endl
#define t3(x, y, z)       cerr<<#x<<"=" <<x<<" "<<#y<<"="<<y<<" "<<#z<<"="<<z<<endl
#define t4(a,b,c,d)       cerr<<#a<<"="<<a<<" "<<#b<<"="<<b<<" "<<#c<<"="<<c<<" "<<#d<<"="<<d<<endl
#define t5(a,b,c,d,e)     cerr<<#a<<"="<<a<<" "<<#b<<"="<<b<<" "<<#c<<"="<<c<<" "<<#d<<"="<<d<<" "<<#e<<"="<<e<<endl
#define t6(a,b,c,d,e,f)   cerr<<#a<<"="<<a<<" "<<#b<<"="<<b<<" "<<#c<<"="<<c<<" "<<#d<<"="<<d<<" "<<#e<<"="<<e<<" "<<#f<<"="<<f<<endl
#define GET_MACRO(_1,_2,_3,_4,_5,_6,NAME,...) NAME
#define tr(...) GET_MACRO(__VA_ARGS__,t6,t5, t4, t3, t2, t1)(__VA_ARGS__)
#define __ freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define fastio() ios::sync_with_stdio(0);cin.tie(0)
#define MEMS(x,t) memset(x,t,sizeof(x));
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
/*-------------------------------------------------------------------------------------------------------------------------------------*/
#define MOD 1000000007
#define endl "\n" 
#define int long long
#define inf 1e18
#define ld long double
/*-------------------------------------------------------------------------------------------------------------------------------------*/
 ll poww(long long a, long long n, long long m)
{
        long long ans = 1;
        long long mul = a;
        while (n != 0)
        {
                if (n % 2)
                {
                        ans = (ans * mul) % m;
                }
                mul = (mul * mul) % m;
                n /= 2;
        }
        return ans;
}
/* 
Fermat's little theorem: 
1) (a/b)%mod= (a*(poww(b,mod-2,mod)))%mod iff a%b==0
2) (a^b)%mod= (a^(b%(mod-1)))%mod iff mod is prime
*/
const int SZ=2e6+100;
ll factorial[SZ];
ll iv[SZ];
void precompute()
{
	factorial[0]=1;
    iv[0]=1;
	for(int i=1;i<SZ;i++)
	{
		factorial[i]=(factorial[i-1]*i)%MOD;
	    iv[i]=poww(factorial[i],MOD-2,MOD);
    }
}
ll InverseEuler(ll n, ll m)
{
    return poww(n, m - 2, m);
}
ll C(ll n, ll r, ll m)
{
	if(r>n || r<0)return 0;
    return (factorial[n] * ((iv[r] * iv[n-r]) % m)) % m;
}
int32_t main()
{
	fastio();
	precompute();
	int k;
	cin>>k;
	string s;
	cin>>s;
	int sz=s.length();
	int ans=0;
	int pow1[k+1];
	int pow2[k+1];
	pow1[0]=1;pow2[0]=1;
	for(int i=1;i<=k;i++)
	{
		pow1[i]=(pow1[i-1]*26)%MOD;
		pow2[i]=(pow2[i-1]*25)%MOD;
	}
	for(int i=0;i<=k;i++)
	{
		int cur=pow1[i];
		cur*=C(k-i+sz-1,sz-1,MOD);
		cur%=MOD;
		cur*=pow2[k-i];
		cur%=MOD;
		ans+=cur;
		// ans%=MOD;
		if(ans>=MOD)ans-=MOD;
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 51112
#include <bits/stdc++.h>
#define int long long
#define debug(x) cerr << "\n" \
                      << #x << ": " << x << "\n"
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define INF (1LL << 30)
#define pii pair<int, int>
#define MOD 1000000007
#define print(x) cout<<(x)<<endl
using namespace std;


signed main()
{
    int N,M;
    cin>>N>>M;
    vector<int> A(N);
    rep(i,N){cin>>A[i];}

    vector<pii> cb(M);
    rep(i,M){
        int b,c;
        cin>>b>>c;
        cb[i] = make_pair(c,b);
    }

    // 降順
    sort(cb.rbegin(),cb.rend());
    sort(A.begin(),A.end());

    int add = 0;
    for (auto x : cb){
        for (int i = 0; i < x.second; ++i){
            A.push_back(x.first);
            ++add;
            if (add > N) break;
        }
        if (add > N) break;
    }

    sort(A.rbegin(),A.rend());
    int ans = 0;
    rep(i,N){ans+=A[i];}

    print(ans);

    

    

    return 0;
}

Measured memory_bytes: 6128
n,m=map(int,input().split())
max_ = 0
min_ = n+1
for i in range(m):
  a,b=map(int, input().split())
  max_ = max(max_, a)
  min_ = min(min_, b)
#print(max_, min_)
if(min_ < max_):print(0)
else:print(min_-max_+1)

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

using namespace std;
using ll = long long;

int main() {
  int n, a;
  cin >> n;
  vector<int> as(n);
  rep(i, n) {
    cin >> a;
    a--;
    as[i] = a;
  }
  int id = 0;
  int ans = 0;
  rep(i, n) {
    if (as[i] != id) {
      ans++;
    } else {
      id++;
    }
  }
  if (ans == n) {
    cout << -1 << endl;
  } else {
    cout << ans << endl;
  }
  return 0;
}


Measured memory_bytes: 4044
import java.util.*;

public class Main {
  public static void main(String args[]) {
    Scanner sc = new Scanner(System.in);

    int N = sc.nextInt();
    int[] A = new int[N+2];
    int sum = 0;

    for (int i = 1; i <= N; i++) {
      A[i] = sc.nextInt();
      sum += Math.abs(A[i] - A[i-1]);
    }

    sum += Math.abs(A[N]);

    for (int i = 1; i <= N; i++) {
      int ans = sum;
      ans = ans - Math.abs(A[i] - A[i-1]) - Math.abs(A[i] - A[i+1]) + Math.abs(A[i+1] - A[i-1]);
      System.out.println(ans);
    }
  }
}


Measured memory_bytes: 65248
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <numeric>
#include <iomanip>
#include <map>
#include <stack>
#include <sstream>

using namespace std;
int main()
{
	string s;
	string s1;
	cin >> s >> s1;
	int qanak = 0;
	int d = s.length();
	//cout << d << endl;
	s.append(s1);
	//cout<<s.size();
	for (int i = 0; i < d; i++)
	{
		if (s[i] != s1[i])
		{
			qanak++;
		}
	}
	cout << qanak;



	return 0;

}

Measured memory_bytes: 3732
#include<iostream>
#include<cstdio>
#include<map>
#include<string>
using namespace std;
int main(){
	string s;
	bool month = false;
	map<int,pair<int,int> > com;
	for(;;){
		getline(cin,s);
		if(s == ""){
			if(!month){month = true;continue;}
			else{break;}
		}
		int a = 0;
		sscanf(s.c_str(),"%d,%*d",&a);
		if(!month){com[a].first |= 1;}
		if(month){com[a].first |= 2;}
		com[a].second++;
	}
	for(__typeof(com.begin()) i = com.begin(); i!=com.end(); i++){
		if(i->second.first == 3){cout << i->first << " " << i->second.second << endl;}
	}
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <deque>
#include <cctype>
#include <cstdio>
#include <math.h>
#include <set>
using namespace std;
int main(void){
    string w;
    cin >> w;
    int str[26]={};
    for(int i=0;i<w.length();i++){
        str[w[i]-'a']++;
    }
    string ans = "Yes";
    for(int i=0;i<26;i++){
        if(str[i]%2!=0){
            ans = "No";
        }
    }
    cout << ans << endl;
}

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

using namespace std;

long long n,x,ans,kiri,kanan,sum,i,pos;
long long a[300007],dua[300007];

int main() {
    scanf("%lld",&n);
    
    ans = 9999999999999999LL;
    for (i=1 ; i<=n ; i++) scanf("%lld",&a[i]), sum += a[i];
    for (i=1 ; i<n ; i++) {
        x += a[i];
        sum -= a[i];
        ans = min(ans,abs(x-sum));
    }
    printf("%lld\n",ans);
}

Measured memory_bytes: 2304
N,H = map(int,input().split())
ken = []
for i in range(N):
    a,b = map(int,input().split())
    ken.append((a,b))
ken.sort()
A,B = ken.pop()
ans = 0
for i in range(N-1):
    a,b = ken[i]
    ken[i] = (b,a)
ken.sort()
for i in range(N-1):
    b,a = ken[-i-1]
    if b >= A:
        if b >= B:
            ans += 1
            H -= b
        else:
            ans += 1
            H -= B
            B = 0
            if H > 0:
                ans += 1
                H -= b
    if H <= 0:
        print(ans)
        quit()
if B != 0:
    H -= B
    ans += 1
if H <= 0:
    print(ans)
    quit()
ans += H//A 
if H % A >= 1:
    ans += 1
print(ans)

Measured memory_bytes: 16920
#include <bits/stdc++.h>
#include <string>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define pii pair<int, int>
#define ordered_set tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update>
//#define ordered_multiset tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update>
#define int long long
#define jai_shree_ram  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define rep(i, a, b, d) for (int i = a; i <= b; i += d)
#define brep(i, a, b, d) for (int i = a; i >= b; i -= d)
#define pb push_back
#define all(x) x.begin(), x.end()
#define endl '\n'
int MAX = 1e5 + 5;
int MOD = 1e9 + 7;
////////////////////////////////

int n, k;
int a[105], pre[105][100005];
int dp[105][100005];


int32_t main(){
    jai_shree_ram
    cin >> n >> k;
    rep(i,1,n,1) cin >> a[i];
    int L, R;
    
    rep(i,1,n,1){
        if(i == 1){
            rep(j,0,a[i],1) dp[i][j] = 1;
        }

        else rep(j,0,k,1){
            R = j;
            L = max(0LL, j - a[i]);
            if(!L) dp[i][j] = pre[i-1][R];
            else {
                dp[i][j] = pre[i-1][R] - pre[i-1][L-1];
                if(dp[i][j] < 0) dp[i][j] += MOD;
            }
        }

        rep(j,0,k,1) pre[i][j] = dp[i][j];
        rep(j,1,k,1) pre[i][j] += pre[i][j-1], pre[i][j]%=MOD;
    }

    cout << dp[n][k] << endl;
    return 0; 
}

Measured memory_bytes: 159232
#include<bits/stdc++.h>
using namespace std;
int main()
{
  char A[3];
  int i,j;
  cin>>A[0]>>A[1]>>A[2];
  if(A[0]!=A[2]) cout<<"No"<<endl;
  else cout<<"Yes"<<endl;

  return 0;
}


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

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

int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    for (int i = 0; i < N; i++)
        cin >> A[i];

    vector<int> L(N + 1), R(N + 1);
    L[0] = 0, R[N] = 0;
    for (int i = 0; i < N; i++) {
        L[i + 1] = gcd(L[i], A[i]);
    }
    for (int i = N - 1; i >= 0; i--) {
        R[i] = gcd(R[i + 1], A[i]);
    }

    int res = 0;
    for (int i = 0; i < N; i++){
        int l = L[i];
        int r = R[i + 1];

        res = max(res, gcd(l, r));
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 1408
#include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;
typedef pair<int, int> PII;

static const int NMAX = 100000;
static const int QMAX = 100000;
static const int DMAX = 10;

static int N, Q;
static vector<int> E[NMAX];
static int C[1 + QMAX];
static vector<PII> V[NMAX];
static int DP[NMAX][1 + DMAX];

static void solve() {
	for(int d = DMAX; d >= 0; d--) {
		for(int u = 0; u < N; u++) {
			for(const auto &p : V[u]) {
				if(d <= p.second) {
					DP[u][d] = p.first;
					break;
				}
			}
			if(d == DMAX) continue;
			for(auto v : E[u]) {
				auto q = DP[v][d + 1];
				if(DP[u][d] == 0 || DP[u][d] < q) DP[u][d] = q;
			}
		}
	}
	for(int u = 0; u < N; u++) printf("%d\n", C[DP[u][0]]);
}

static void input() {
	int m;
	for(scanf("%d%d", &N, &m); m > 0; m--) {
		int a, b;
		scanf("%d%d", &a, &b); a--; b--;
		E[a].push_back(b);
		E[b].push_back(a);
	}
	scanf("%d", &Q);
	for(int q = 1; q <= Q; q++) {
		int u, d;
		scanf("%d%d%d", &u, &d, C + q); u--;
		auto &v = V[u];
		while(!v.empty() && v.back().second <= d) v.pop_back();
		v.emplace_back(q, d);
	}
	for(int u = 0; u < N; u++) reverse(begin(V[u]), end(V[u]));
}

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

Measured memory_bytes: 15480
A, B, C = map(int, input().split())
K = int(input())

while A >= B or B >= C:
  while A >= B:
    B *= 2
    K -= 1
  while B >= C:
    C *= 2
    K -= 1
if K >= 0:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 9172
#include <iostream>
#include <queue>
#include <string>
using namespace std;
int main(void){
  queue< pair<string,int> > a;
  int n,q,t,c=0;
  string name;
  cin>>n>>q;
  for(int i=0;i<n;i++){
    cin>>name>>t;
    a.push(make_pair(name,t));
  }
  while(!a.empty()){
    pair<string,int> p=a.front();
    a.pop();
    if(p.second>q){
      p.second-=q;
      c+=q;
      a.push(p);
    }
    else{
      c+=p.second;
      cout<<p.first<<" "<<c<<endl;
    }
  }
  return 0;
}

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

int main(){
  int N;
  cin >> N;
  vector<string> S(N);
  for (int i=0 ; i<N ; i++)
    cin >> S.at(i);
  
  int AC = 0;
  int WA = 0;
  int TLE = 0;
  int RE = 0;
  for (int i=0 ; i<N ; i++){
    if (S.at(i) == "AC")
      AC++;
    else if (S.at(i) == "WA")
      WA++;
    else if (S.at(i) == "TLE")
      TLE++;
    else
      RE++;
  }
  cout << "AC x " << AC << endl;
  cout << "WA x " << WA << endl;
  cout << "TLE x " << TLE << endl;
  cout << "RE x " << RE << endl;
}

Measured memory_bytes: 6420
#include <iostream>

int main()
{
	int N, K = 0;
	std::cin >> N >> K;

	int answer = 0;
	for (int i = 0; i < N; ++i)
	{
		int temp = 0;
		std::cin >> temp;
		
		if (temp >= K)
		{
			answer++;
		}
	}

	std::cout << answer << "\n";

	return 0;
}

Measured memory_bytes: 256
import std.stdio, std.string, std.conv;
import std.array, std.algorithm, std.range;
import std.math;

void main()
{
    auto ps = stdin.byLine().map!(s=>s.split(",").map!(to!real).array()).array();
    real s=0;
    foreach(i;2..ps.length)
        s += abs(ps[0][0]*(ps[i-1][1]-ps[i][1])+ps[i-1][0]*(ps[i][1]-ps[0][1])+ps[i][0]*(ps[0][1]-ps[i-1][1]))/2;
    writefln("%.6f",s);
}

Measured memory_bytes: 1156
import math
from itertools import permutations
A = [int(input()) for _ in range(5)]

ans = float("inf")
for a in permutations(A, 5):
    m = 0
    for i in a:
        m = math.ceil(m/10)*10
        m += i
    ans = min(ans, m)
print(ans)


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

int main(){
  int k,s,counter=0;
  std::cin >> k>>s;
  for (int i = 0; i <= k; i++) {
    /* code */
    for (int j = 0; j <=k; j++) {
      /* code */
      if(i+j<=s&&i+j>=s-k)counter++;
    }
  }
  std::cout << counter << std::endl;
}

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

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

int main()
{
    double R, pie=3.14159265358979323846;

    cin >> R;

    cout << fixed <<setprecision(10)<<endl;

    cout << 2*R*pie <<endl;



    return 0;
}

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

int main() {
  int n, l;
  cin >> n >> l;
  vector<int> a(n);
  for (int i = 0; i < n; i++) 
    a.at(i) = l + i;
  int sum = 0;
  for (int i = 0; i < n; i++) {
    sum += a.at(i);
  }
  if (l <= 0 && l + n - 1 >= 0) {
    cout << sum << endl;
  } else if (l > 0) {
    cout << sum - a.at(0) << endl;
  } else if (l <= 0 && l + n - 1 < 0) {
    cout << sum - a.at(n - 1) << endl;
  }
} 

Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
using namespace std;
int n,i,j,a[100000],g,k,w=0;
int main(void)
{
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&a[i]);
	}
	for(i=0;i<n;i++){
		if(a[i]%2==0) g++;
		else k++;
	}
	g+=k/2;
	k=k%2;
	while(1){
		if(g<=1) break;
		w=g/2;
		g=g%2;
		g+=w;
	}
	w=k+g;
	if(w==1) printf("YES\n");
	else printf("NO\n");
	return 0;
}

Measured memory_bytes: 512
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner as = new Scanner(System.in);
		String c = as.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: 9680
/*
[yahoo-procon2019-qual] E - Odd Subrectangles
*/

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;

typedef int Number;
typedef vector<Number> Array;
typedef vector<Array> Matrix;
const Number eps = 0;

int mat_rank(Matrix A) {
    const int n = A.size(), m = A[0].size();
    int r = 0;
    for (int i = 0; r < n && i < m; ++i) {
        int pivot = r;
        for (int j = r + 1; j < n; ++j) {
            if (A[j][i]) {
                pivot = j;
                break;
            }
        }
        swap(A[pivot], A[r]);
        if (A[r][i] <= eps) {
            continue;
        }
        for (int j = r + 1; j < n; ++j) {
            if (A[j][i]) {
                for (int k = i; k < m; ++k) {
                    A[j][k] ^= A[r][k];
                }
            }
        }
        ++r;
    }
    return r;
}

const ll MOD = 998244353;

int N, M;
Matrix a;

ll pow2(int n) {
    ll ret = 1;
    for (int i = 0; i < n; i++) {
        ret = (ret << 1) % MOD;
    }
    return ret;
}

ll solve() {
    int r = mat_rank(a);
    return (pow2(N + M - 1) + MOD - pow2(N + M - r - 1)) % MOD;
}

int main() {
    cin >> N >> M;

    a.resize(N);
    for (int i = 0; i < N; i++) {
        a[i].resize(M);
        for (int j = 0; j < M; j++) {
            cin >> a[i][j];
        }
    }
    cout << solve() << endl;

    return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>
int main(void){
	int f[26],ans,i;
	char s[33];
	for(i=0;i<7;i++)
		f[i]=0;
	for(i=7;i<16;i++)
		f[i]=1;
	for(i=16;i<20;i++)
		f[i]=0;
	for(i=21;i<26;i++)
		f[i]=0;
	f[20]=f[24]=1;
	while(1){
		scanf("%s",s);
		if(s[0]=='#')
			break;
		ans=0;
		for(i=0;s[i+1];i++){
			if(f[s[i]-'a']!=f[s[i+1]-'a'])
				ans++;
		}
		printf("%d\n",ans);
	}
	return 0;
}

Measured memory_bytes: 540
# include <bits/stdc++.h>
# define sz(x) (int)((x).size())
# define F first
# define S second
# define pb push_back
# define all(x) x.begin(), x.end()

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;

const int N = 5e5+5;

void solve(){
	int n;
	cin>>n;
	string s;
	cin>>s;
	set<int>pos[10];
	for(int i=0;i<n;++i){
		pos[s[i]-'0'].insert(i);
	}
	ll ans=0;
	for(int i=0;i<=9;++i){
		int cur=-1;
		if(!sz(pos[i]))continue;
		cur=*pos[i].upper_bound(cur);
		for(int j=0;j<=9;j++){
			if(!sz(pos[j]))continue;
			if(pos[j].upper_bound(cur)==pos[j].end())continue;
			int d=*pos[j].upper_bound(cur);		
			for(int k=0;k<=9;k++){
				if(!sz(pos[k]))continue;
				if(pos[k].upper_bound(d)==pos[k].end())continue;
				ans++;
			}
		}
	}
	cout<<ans;
}

int main(){
	ios_base :: sync_with_stdio(false);
	int test = 1; 
	//cin >> test;	
	while (test--){
		solve();
	}
	return 0;
}

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

int main()
{
  	string s;
  
 	getline(cin,s);
  	
    for(int i = 0;i < s.length();i++){
      if(isalpha(s.at(i))){
        if(islower(s.at(i)))
          s.at(i) = toupper(s.at(i));
        else
          s.at(i) = tolower(s.at(i));
      }
      cout << s.at(i);
    }
  	cout << endl;

}


Measured memory_bytes: 3164
#include <stdio.h>

int main(int argc, const char * argv[]) {
    int h,m,s,x;
    scanf("%d",&x);
    h = x /3600;
    m = (x % 3600) / 60;
    s = (x % 3600) % 60;
    printf("%d:%d:%d\n", h, m, s);
    return 0;
}

Measured memory_bytes: 592
a,b,c,d= map(int,input().split())
def gcd(c,d):
    while d!=0:
        c,d=d,c%d
    return c


def lcm(c,d):
    return c*d//gcd(c,d)

a1=0
a2=0
b1=0
b2=0
e1=0
e2=0


e=int((c*d)/gcd(c,d))

if(a-1>=c):
    a1=(a-1)//c
else:
    a1=0

if(b>=c):
    b1=b//c
else:
    b1=0

if(a-1>=d):
    a2=(a-1)//d
else:
    a2=0

if(b>=d):
    b2=b//d
else:
    b2=0

if(a-1>=e):
    e1=(a-1)//e
else:
    e1=0

if(b>=e):
    e2=b//e
else:
    e2=0
        
ans=b-a+1-(b1-a1)-(b2-a2)+(e2-e1)

print(ans)

Measured memory_bytes: 3064
a = 400
b = 199
L1= []
L2 = []
for i in range(8):
    L1.append(a+200*(i))
    L2.append(a+200*(i)+b)


n = int(input())
for i in range(8):
    if L1[i] <= n <= L2[i]:
        print(8-i)

Measured memory_bytes: 9144
import java.util.Scanner;

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();
        int d = sc.nextInt();
        sc.close();
        if ((Math.abs(b - a) <=d && Math.abs(c - b) <= d) || Math.abs(c - a) <= d) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 19924
#include <bits/stdc++.h>
using namespace std;
int main(){
  int A,B;
  cin>>A>>B;
  
  if((A+B)>=(A-B) && (A-B)>=(A*B)){
    cout<<A+B<<endl;
  }
  
  else if((A+B)>=(A*B) && (A*B)>=(A-B)){
    cout<<A+B<<endl;
  }
  
  else if((A-B)>=(A+B) && (A+B)>=(A*B)){
    cout<<A-B<<endl;
  }
  
  else if((A-B)>=(A*B) && (A*B)>=(A-B)){
    cout<<A-B<<endl;
  }
  
  else if((A*B)>=(A+B) && (A+B)>=(A-B)){
    cout<<A*B<<endl;
  }
  
  else if((A*B)>=(A-B) && (A-B)>=(A+B)){
    cout<<A*B<<endl;
  }
  
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){

    int a,b,sum;
    int x = 10;
    while(scanf("%d%d",&a,&b) != EOF){

        int count;
        count = 1;

        if(a+b < 10)printf("1\n");

        else{
            sum = a+b;
            for(;;){

               sum = sum / x;
               count++;

               if(sum < 10)break;

            }
            printf("%d\n",count);
        }

    }
    return 0;
}

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

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

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

// 4近傍、8近傍
int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};

int main() {
  string s;
  cin >> s;

  cout << (s == "ABC" ? "ARC" : "ABC") << endl;
  return 0;
}

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

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

  set<string> r;
  string s;
  auto dfs = [&](auto&& dfs) {
    if (s.size() == n) {
      r.insert(s);
      return;
    }
    if (s.empty()) {
      s.push_back('a');
      dfs(dfs);
      s.pop_back();
    } else {
      char m = *max_element(s.begin(), s.end()) + 1;
      for (char e = 'a'; e <= m; e++) {
        s.push_back(e);
        dfs(dfs);
        s.pop_back();
      }
    }
  };
  dfs(dfs);

  for (const auto& e : r) cout << e << '\n';
  cout << flush;
}


Measured memory_bytes: 14208
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cmath>
#include <algorithm>
#include <utility>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const double EPS = 1e-9;


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

  int m;
  cin>>m;
  cout << 48 - m << endl;

  return 0;
}


Measured memory_bytes: 256
n = int(input())
saw = {}
for _ in range(n):
    s = ''.join(sorted(input()))
    if s in saw:
        saw[s] += 1
    else:
        saw[s] = 1

ans = 0
for v in saw.values():
    ans += v * (v - 1) // 2

print(ans)

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

using namespace std;
typedef unsigned long long ll;

int main(){
    ll a, b, c; cin >> a >> b >> c;
    ll k; cin >> k;
    ll M = max({a,b,c});
    int sum = a + b + c - M;
    
    while(k > 0){
        M = M * 2;
        k--;
    }
    cout << sum + M << endl;
}


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

int main (void)
{
        int i, n, k;
        double m, x[100];
        char u[100][5];

        scanf("%d",&n);
        for(i=0;i<n;i++){
                scanf("%lf",&x[i]);
                scanf("%s",&u[i]);
        }
        k=0;
        for(i=0;i<n;i++){
                if(strcmp(u[i], "JPY")==0)
                        m=m+x[i];
                else if(strcmp(u[i], "BTC")==0)
                        m=m+x[i]*380000.0;
        }

        printf("%lf\n",m);
        return 0;
}

Measured memory_bytes: 128
#include <stdio.h>

int main(void){
	int a[3][10][4] = {0};
	int i, j, k;
	int n, p;
	int b, f, r, v; /* b?£?f???r???????????¨?±????v??? [???][??¨?±?][?£?] */
	
	scanf("%d", &n);
	for(i=0; i<n; i++){
		scanf("%d%d%d%d", &b, &f, &r, &v);
		
		a[f-1][r-1][b-1] += v;
	}
	
	for(k=0; k<4; k++){
		for(i=0; i<3; i++){
			for(j=0; j<10; j++){
				if(a[i][j][k] == 0){
					printf(" 0");
				}else{
					printf(" %d", a[i][j][k]);
				}
			}
			printf("\n");
		}
		if(k != 3){
			printf("####################\n");
		}
	}
	
	return 0;
}

Measured memory_bytes: 612
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	n := scanInt(sc)
	found := make(map[int]int, n)
	candidates := make([]int, 0)

	for i := 0; i < n; i++ {
		l := scanInt(sc)
		if found[l] >= 0 {
			found[l] += 1
			if found[l] == 2 || found[l] == 4 {
				candidates = append(candidates, l)
			}
			if found[l] == 4 {
				found[l] = -1
			}
		}
	}

	if len(candidates) < 2 {
		fmt.Println(0)
		return
	}

	sort.Ints(candidates)
	a := candidates[len(candidates)-1]
	b := candidates[len(candidates)-2]
	fmt.Println(a * b)
}

func scanInt(sc *bufio.Scanner) int {
	sc.Scan()
	val, _ := strconv.Atoi(sc.Text())
	return val
}

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

int main(){
  string s,a;
  cin>>s;
 int K,u,c,N;
  N=s.size();
  cin>>K;
  u=0;
  c=0;
  vector<string>S(200000);
    for(int i=0;i<N-4;i++){
      a=s[i];
      a+=s[i+1];
      a+=s[i+2];
      a+=s[i+3];
      a+=s[i+4];
        S[i]=a;
      u=i+1;
    }
  
      for(int i=u;i<u+N-3;i++){
        a=s[i-u];
        a+=s[i-u+1];
        a+=s[i-u+2];
        a+=s[i-u+3];
      S[i]=a;
      c=i+1;
    }
        for(int i=c;i<c+N-2;i++){
          a=s[i-c];
          a+=s[i-c+1];
          a+=s[i-c+2];
      S[i]=a;
      u=i+1;
    }
        for(int i=u;i<u+N-1;i++){
          a=s[i-u];
            a+=s[i-u+1];
      S[i]=a;
      c=i+1;
    }
          for(int i=c;i<c+N;i++){
      S[i]=s[i-c];
    }
  c=1;

if(N!=1){
  sort(S.begin(),S.end());
}
  else{
    cout<<S[0]<<endl;
    return 0;
  }
  for(int i=0;i<200000;i++){
    if(S[i]==""){
      continue;
    }
    if(S[i]==S[i-1]){
      continue;
    }
    else{
      if(K==c){
        cout<<S[i]<<endl;
        return 0;
      }
      else{
        c++;
          continue;
      }
    }
  }
}


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

#define foreach(i, v) for(__typeof((v).begin()) i = (v).begin(); i != (v).end(); ++ i)
#define BETWEEN(a, x, b) (a<=x&&x<b)

using namespace std;
typedef long long ll;

int main(int argc, char *argv[]) {
  ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);

  map<char, ll> mp;

  int n;cin>>n;
  for(int i=0;i<n;i++){
    string s;
    cin>>s;
    mp[s[0]]++;
  }
  string march="MARCH";
  ll res = 0;
  for(int i=0;i<5;i++){
    for(int j=i+1;j<5;j++){
      for(int k=j+1;k<5;k++){
        res += mp[march[i]]*mp[march[j]]*mp[march[k]];
      }
    }
  }
  cout<<res<<endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll a,b,p[5];
int main(){
	scanf("%lld%lld",&a,&b);
	p[a]=1;p[b]=1;
	for(ll i=1;i<=3;i++)
	if(p[i]==0) cout<<i; 
	return 0;
} 

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

int main()
{
  string S, T;
  int correct = 0;
  
  cin >> S >> T;
  for (int i = 0; i < 3; i++) {
    if (S[i] == T[i]) {
      correct++;
    }
  }
  cout << correct << endl;
  return 0;
}

Measured memory_bytes: 256
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

template <typename T>
void print(T x) {
    cout << x << "\n";
}

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REVFOR(i, m, n) for (int i = (n - 1); i >= (m); --i)
#define REP(i, n) FOR(i, 0, n)
#define REVREP(i, n) REVFOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    
    string s;
    cin >> s;

    int ans = 0;
    int cnt = 0;
    REP(i, s.size()) {
        if (s[i] == 'R') {
            cnt++;
            ans = max(ans, cnt);
        } else {
            cnt = 0;
        }
    }

    print(ans);
}


Measured memory_bytes: 3652
import sys

def comb(n,r,mod):
	'''
	return nCr
	O(min{n-r, r})
	'''
	a=1
	b=1
	r = min(r,n-r)
	for i in range(r):
		a = a*(n-i)%mod
		b = b*(i+1)%mod
	return a*pow(b,mod-2,mod)%mod



X,Y=map(int,input().split())

X,Y = min(X,Y), max(X,Y)
d = Y-X

if X-d != Y-2*d or (X-d)%3!=0 or  X-d<0:
    print(0)
    sys.exit()

a = (X-d)//3
b = a + d
print(comb(a+b, b, 10**9+7))


Measured memory_bytes: 3064
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b, c;
    cin >> a >> b >> c;
    set<int> st;
    st.insert(a);
    st.insert(b);
    st.insert(c);
    cout << st.size() << endl;
    return 0;
}

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

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

	for (;;) {
		scanf("%d%d", &x, &y);
		if (x == 0 && y == 0) break;
		if (x > y) t = x, x = y, y = t;
		printf("%d %d\n", x, y);
	}
	return 0;
}



Measured memory_bytes: 2096
#include <iostream>
#include <vector>
#include <sstream>

using namespace std;

class C {
	int n;
public:
	void solve()
	{
		vector<int> a(n);
		vector<int> ans;

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

		if (n & 1)
		{
			// odd items
			// id even -> 0 1 -> odd

			for (int i{ n - 1 }; i >= 0; i -= 2)
				ans.push_back(a[i]);
			for (int i{ 1 }; i < n; i += 2)
				ans.push_back(a[i]);
		}

		else
		{
			// even items
			// id odd -> 1 0 ->even

			for (int i{ n - 1 }; i >= 1; i -= 2)
				ans.push_back(a[i]);
			for (int i{ 0 }; i < n; i += 2)
				ans.push_back(a[i]);
		}

		for (int i{ 0 }; i < n; i++)
		{
			cout << ans[i];
			if (i != n - 1) cout << " ";
			else cout << endl;
		}

	}

	C() { cin >> n; }
};


int main()
{
	C solution;
	solution.solve();

	return 0;
}

Measured memory_bytes: 3828
#include<bits/stdc++.h>
using namespace std;
typedef long long int llint;
typedef long int lint;
typedef vector<char> vchar;
typedef vector<int> vint;
typedef vector<vector<int>> vvint;
typedef vector<vector<char>> vvchar;
#define vsort(v) sort((v).begin(), (v).end())
#define vreverse(v) reverse((v).begin(), (v).end())
#define pb(a) push_back(a)
#define INF 1000000007
#define MOD 1e9+7
int main(){
  //input
vvint c(3,vint(3));
  for(int i=0;i<3;i++){
   for(int j=0;j<3;j++){
     cin>>c[i][j];
   }
  }
vint a(3);vint b(3);
  //caricurate
for(a[0]=0;a[0]<=100;a[0]++){
  b[0]=c[0][0]-a[0];
  a[1]=c[1][0]-b[0];
  a[2]=c[2][0]-b[0];
  b[1]=c[0][1]-a[0];
  b[2]=c[0][2]-a[0];
  if((c[1][1]==a[1]+b[1])&&(c[2][2]==a[2]+b[2])&&(c[1][2]==a[1]+b[2])&&(c[2][1]==a[2]+b[1])){
  cout<<"Yes"<<endl;return 0;
  }
}
  //output
cout<<"No"<<endl;return 0;

}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int a, b, c;
	scanf("%d %d %d%*c", &a, &b, &c);
	if((a < c && c < b) || (b < c && c < a))
		printf("Yes");
	else
		printf("No");
	
	return 0;
}


Measured memory_bytes: 128
#include <stdio.h>
#include <algorithm>

using namespace std;

//FILE *in = freopen("input.txt", "r", stdin);

int n, m;
int data1[100];
int data2[100];
int sum1, sum2;

void input(){
	sum1 = sum2 = 0;
	for(int i = 0 ; i < n; i++){
		scanf("%d", &data1[i]);
		sum1+= data1[i];
	}
	for(int i = 0; i < m; i++){
		scanf("%d", &data2[i]);
		sum2+= data2[i];
	}
	sort(data1, data1+n);
	sort(data2,data2+m);
}

void process() {
	int Max = 0x7fffffff, N = -1, M = -1;
	for(int i = 0; i < n; i++){
		int x = sum2 - sum1 + data1[i]*2;
		if(x & 1) continue;
		x>>=1;
		if(binary_search(data2,data2+m, x)){
			if(Max > data1[i] + x) {
				Max = data1[i] + x;
				N = data1[i];
				M = x;
			}
		}
	}
	if(Max == 0x7fffffff) {
		printf("-1\n");
	}
	else {
		printf("%d %d\n", N, M);
	}
}

int main() {
	while(true){
		scanf("%d%d", &n, &m);
		if (n == 0) break;
		input();
		process();
	}
	return 0;
}

Measured memory_bytes: 1036
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using System.Numerics;

namespace nomura2020
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
            if (File.Exists("input.txt"))
            {
                Console.SetIn(new StreamReader("input.txt"));
            }
            solve_nomura2020A();
            Console.Out.Flush();
        }

        public static void solve_nomura2020B()
        {
        }

        public static void solve_nomura2020A()
        {
            int[] t = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
            Console.WriteLine(Math.Abs(Math.Abs(t[0] * 60 + t[1] - (t[2] * 60 + t[3])) - t[4]));
        }
    }
}

Measured memory_bytes: 28500
#include <algorithm>
#include <cassert>
#include <chrono>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <queue>
#include <string>
#include <vector>
using namespace std;
using ll = int64_t;
#define rep(i, j, n) for (int i = j; i < (int)n; ++i)
#define rrep(i, j, n) for (int i = (int)n - 1; j <= i; --i)

int main() {
  int n;
  cin >> n;
  vector<ll> a(n);
  for (ll& x : a) cin >> x;

  ll kane = 1000;
  ll kabu = 0;
  rep(i, 0, n - 1) {
    if (a[i] < a[i + 1]) {
      kabu += kane / a[i];
      kane = kane % a[i];
    }
    if (a[i] > a[i + 1]) {
      kane += kabu * a[i];
      kabu = 0;
    }
  }
  kane += kabu * a[n - 1];
  cout << kane << endl;
  return 0;
}


Measured memory_bytes: 3504
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int maxn=2e5+5;
int cur,k[maxn];
ll l[maxn],r[maxn];
vector<int> L,R;
bool Less_L(int x,int y)
{
	return k[x]<k[y];
}
bool Less_R(int x,int y)
{
	return k[x]>k[y];
} 
multiset<ll> all;
void fl()
{
	freopen(".in","r",stdin);
	freopen(".out","w",stdout);
}
int main()
{
//    fl();
	int t;
	scanf("%d",&t);
	while(t--)
	{
		int n;
		scanf("%d",&n);
		for(int i=1;i<=n;i++)
			scanf("%d%lld%lld",&k[i],&l[i],&r[i]);
		ll ans=0;
		L.clear(); R.clear();
		for(int i=1;i<=n;i++)
		{
			if(l[i]>r[i]) L.push_back(i);
			if(l[i]<r[i]) R.push_back(i);
			ans+=min(l[i],r[i]);
		}
		sort(L.begin(),L.end(),Less_L);
		cur=1; all.clear();
		for(int i=0;i<(int)L.size();i++)
		{
			int id=L[i];
			ll now=l[id]-r[id];
			if(cur>k[id]) 
			{
				if(all.empty()) continue;
				ll last=*all.begin();
				if(last<now)
				{
					ans=ans-last+now;
					all.erase(all.begin());
					all.insert(now);
				}
			}
			else 
			{
				ans=ans+now;
				all.insert(now);
				cur++;
			}
		}
		sort(R.begin(),R.end(),Less_R);
		cur=n; all.clear();
		for(int i=0;i<(int)R.size();i++)
		{
			int id=R[i];
			ll now=r[id]-l[id];
			if(cur<=k[id])
			{
				if(all.empty()) continue;
				ll last=*all.begin();
				if(last<now)
				{
					ans=ans-last+now;
					all.erase(all.begin());
					all.insert(now); 
				}
			}
			else 
			{
				ans=ans+now;
				all.insert(now);
				cur--;
			}
		}
		printf("%lld\n",ans);
	}
	return 0;
}


Measured memory_bytes: 12720
ltstr = "a < b"
eqstr = "a == b"
gtstr = "a > b"
orderToStr LT = ltstr
orderToStr EQ = eqstr
orderToStr GT = gtstr
main = do
       ln <- getLine
       let [a,b] = map read . words $ ln :: [Int]
       putStrLn $ orderToStr $ compare a b

Measured memory_bytes: 3612