akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
 
 
using namespace std;
 
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
 
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
 
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
 
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
 
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
 
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
 
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
 
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

bool compare_by_b(pair<LL, LL> a, pair<LL, LL> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}
void solve(long long N, std::vector<long long> X, std::vector<long long> L){
    VI arr(100000);
    vector <pair<LL, LL> > bot(N);
    REP(i, N){
        cin>>X[i]>>L[i];
        // bot.PB(make_pair(X[i]-L[i], X[i]+L[i]));
        bot[i] = make_pair(X[i]-L[i], X[i]+L[i]);
    }
    sort(ALL(bot), compare_by_b);
    int next;
    int ans = 1;
    next = bot[0].second;
    for(int i=1; i<N; i++){
        if(next <= bot[i].first){
            // debug(bot[i].first);
            ans++;
            next = bot[i].second;
        }
    }
    cout<<ans<<endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> X(N);
    std::vector<long long> L(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&X[i]);
        scanf("%lld",&L[i]);
    }
    solve(N, std::move(X), std::move(L));
    return 0;
}


Measured memory_bytes: 3712
/*bismillah ->                                                                                                         << Suirkhanov Meyirlan >>
  GL HF


                                                                                                                      42

    bless my code =)
                                                                                                            NEVER FOLLOW YOUR RULES :D HAHAHAHA
*/


///scanf ("%d%d", &x, &y);
///printf("%d", &a)

#include <bits/stdc++.h>

#define fast ios_base::sync_with_stdio();   cin.tie(0);   cout.tie(0);
#define randoperation srand(time(0));
#define pii pair < int , int >
#define pll pair < ll, ll >
#define pb push_back
#define pf psuh_front
#define mp make_pair
#define fi first
#define se second
#define fast ios_base::sync_with_stdio();   cin.tie(0);   cout.tie(0);
#define randoperation srand(time(0));
#define eb emplace_back

using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

const ll N = 2 * 1e3 + 7;
const ld pi = 3.14159265359;
const int INF = 1e20 + 7;
const double eps = 1e-9;

const int xi[4] = {-1, 0, +1, 0};
const int yj[4] = {0, +1, 0, -1};
const int xxi[4] = {+1, 0, -1, 0};
const int yyj[4] = {0, -1, 0, +1};

string s, ans;

int k;

char c;

bool u[N];

bool checks(string str){

  for(int i = 0; i < str.size(); i++){
    if(u[s[i]]){
      return 0;
    }
  }

  return 1;
}

bool check(ll x){
  while(x){
    if(u[x % 10]){
      return 0;
    }
    x /= 10;
  }
  return 1;
}

int main(){

  //freopen("bridge.in", "r", stdin);
  //freopen("bridge.out", "w", stdout);

  fast
  randoperation;

  ///           ||
  ///start here \/

  ll n;

  cin >> n >> k;

  for(int i = 1; i <= k; i++){
    ll x;
    cin >> x;
    u[x] = 1;
  }

  if(check(n)){
    cout << n;
    return 0;
  }

  while(n++){
    if(check(n)){
      cout << n;
      return 0;
    }
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, s, n;
  string num;
  cin >> N;
  s = 0;
  n = N;
  for(int i = 0; i < 9 ; i++){
    int a;
    a = n / pow(10,(8-i));
    s += a;
    n -= a * pow(10,(8-i));
    //cout << a << ":" << s << ":" << n << endl;
  }
  if(N % s == 0){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

  

Measured memory_bytes: 4008
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;


class Main
{	
	
	
	public static void main(String args[]) throws IOException
	{
		FastScanner fs = new FastScanner();
		
		int a = fs.nextInt(),b = fs.nextInt(),c = fs.nextInt();
		int k = fs.nextInt();
		
		while(a>=b)
		{
			b *= 2;
			k--;
		}
		while(b>=c)
		{
			c *= 2;
			k--;
		}
		System.out.println((k<0)?"No":"Yes");
			
	}


	
}
class FastScanner
{
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	StringTokenizer str = new StringTokenizer("");
	
	String next() throws IOException
	{
		while(!str.hasMoreTokens())
			str = new StringTokenizer(br.readLine());
		
		return str.nextToken();
	}
	
	int nextInt() throws IOException
	{
		return Integer.parseInt(next());
	}
	
	float nextfloat() throws IOException
	{
		return Float.parseFloat(next());
	}
	
	double nextDouble() throws IOException
	{
		return Double.parseDouble(next());
	}
	long nextLong() throws IOException
	{
		return Long.parseLong(next());
	}
	int[] arrayIn(int n) throws IOException
	{
		int arr[] = new int[n];
		for(int i=0; i<n; i++)
		{
			arr[i] = nextInt();
		}
		return arr;
	}
}



	

Measured memory_bytes: 32668
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define ll long long
const int MX=200011;
int N, M, k;
ll pref[MX];
int arr[MX];
int main()
{
    int D, x, an=0;
    cin>>N>>D>>x;
    for(int i=0;i<N;i++)
    {
        cin>>arr[i];
        int cur=0;
        while(1)
        {
            if(cur*arr[i]+1 > D) break;
            pref[cur*arr[i]+1]++;
            cur++;
        }
    }
    for(int i=1;i<=D;i++) an+=pref[i];
    an+=x;
    cout<<an;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <random>
#include <chrono>
 
using namespace std;
using namespace __gnu_pbds;
 
#define endl '\n'
 
typedef long long ll;
typedef pair<int, int> pii;
typedef tree<int, null_type,less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
template<typename T>
static T randint(T lo, T hi){
	return uniform_int_distribution<T>(lo, hi)(rng);
}



int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
 
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);

	vector<int> a(5);
	for(int i = 0; i < 5; i++){
		int x;
		cin >> x;
		if(x == 0){
			cout << i + 1 << endl;
			return 0;
		}
	}


	return 0;
}

Measured memory_bytes: 3628
import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
  int a = sc.nextInt();
  int b = sc.nextInt();
  int c = sc.nextInt();
  int x = sc.nextInt();
  int y = sc.nextInt();
  if(a+b <= 2*c){
    System.out.println(a*x + b*y);
  }
  else{
    if(x > y){
      System.out.println(a <= 2*c ? 2*c*y + a*(x-y) : 2*c*x);
    }
    else if(x < y){
      System.out.println(b <= 2*c ? 2*c*x + b*(y-x) : 2*c*y);
    }
    else if(x == y){
      System.out.println(2*x*c);
    }
  }
}}

Measured memory_bytes: 21972
#include <iostream>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <numeric>
#include <string>
#include <cmath>

#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
	int n, m, c;
	cin >> n >> m >> c;
	vector<int> b(m);
	vector<vector<int>> a(n, vector<int>(m));
	int count = 0;

	for (int i = 0; i < m; i++) {
		cin >> b[i];
	}
	for (int i = 0; i < n; i++) {
		int sum = 0;
		for (int j = 0; j < m; j++) {
			cin >> a[i][j];
			sum += a[i][j] * b[j];
		}
		if (sum + c > 0)count++;
	}

	cout << count << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define pb push_back
#define COUT(x) cout << (x) << endl
#define COUTF(x) cout << setprecision(15) << (x) << endl
#define ENDL cout << endl
#define DF(x) x.erase(x.begin())  // 先頭文字削除
#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define REVERSE(x) reverse(ALL(x))
#define init() \
  cin.tie(0);  \
  ios::sync_with_stdio(false)
#define debug(x) cerr << "[debug] " << #x << ": " << x << endl;
#define debugV(v)                       \
  cerr << "[debugV] " << #v << ":";     \
  rep(i, v.size()) cerr << " " << v[i]; \
  cerr << endl;
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using P = pair<ll, ll>;
constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr double PI = 3.141592653589793238462643383279;
ll getDigit(ll x) {
  return x == 0 ? 1 : log10(x) + 1;
}

ll gcd(ll x, ll y) {
  return y ? gcd(y, x % y) : x;
}

ll lcm(ll a, ll b) {
  return a / gcd(a, b) * b;
}

vector<P> factorize(ll n) {
  vector<P> result;
  for (ll i = 2; i * i <= n; ++i) {
    if (n % i == 0) {
      result.pb({i, 0});
      while (n % i == 0) {
        n /= i;
        result.back().second++;
      }
    }
  }
  if (n != 1) {
    result.pb({n, 1});
  }
  return result;
}

vll divisor(ll n) {
  vll ret;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n) ret.push_back(n / i);
    }
  }
  SORT(ret);
  return (ret);
}

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

signed main() {
  init();
  ll N, M, X, Y;
  cin >> N >> M >> X >> Y;

  vll x(N);
  rep(i, N) {
    cin >> x[i];
  }

  vll y(M);
  rep(i, M) {
    cin >> y[i];
  }

  rep2(i, X + 1, Y + 1) {
    bool flag = true;
    rep(j, N) {
      if (x[j] < i) {
      } else {
        flag = false;
      }
    }
    rep(j, M) {
      if (i <= y[j]) {
      } else {
        flag = false;
      }
    }
    if (flag) {
      COUT("No War");
      return 0;
    }
  }

  COUT("War");
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000000000000
#define MOD 1000000007
#define all(v) v.begin(),v.end()
#define pb push_back
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int kaijo[2000010];
struct edge{int to,cost;};
int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
bool prime(int a){
    if(a==1)return false;
    for(int i=2;i*i<=a;i++){
        if(a%i==0)return false;
    }
    return true;
}
void init_fact(){
    kaijo[0]=1;
    for(int i=1;i<=2000000;i++){
        kaijo[i]=kaijo[i-1]*i;
        kaijo[i]%=MOD;
    }
}
int modpow(int a,int b){
    if(b==0)return 1;
    if(b%2)return modpow(a,b-1)*a%MOD;
    int memo=modpow(a,b/2);
    return memo*memo%MOD;
}
int comb(int a,int b){
    if(!kaijo[0])init_fact();
    return kaijo[a]*modpow(kaijo[a-b],MOD-2)%MOD*modpow(kaijo[b],MOD-2)%MOD;
}
int inv(int x){
    x=modpow(x,MOD-2);
    return x;
}
bool kosa(double ax,double ay,double bx,double by,double cx,double cy,double dx,double dy){
    double ta=(cx-dx)*(ay-cy)+(cy-dy)*(cx-ax);
    double tb=(cx-dx)*(by-cy)+(cy-dy)*(cx-bx);
    double tc=(ax-bx)*(cy-ay)+(ay-by)*(ax-cx);
    double td=(ax-bx)*(dy-ay)+(ay-by)*(ax-dx);
    return tc*td<0&&ta*tb<0;
}
double dist(double ax,double ay,double bx,double by){
    return sqrt((bx-ax)*(bx-ax)+(ay-by)*(ay-by));
}
int n,u,v;
vector<int>V[100010];
int d[100010],d2[100010];
void dfs(int x){
    for(int i:V[x]){
        if(d[i]>d[x]+1){
            d[i]=d[x]+1;
            dfs(i);
        }
    }
}
void dfs2(int x){
    for(int i:V[x]){
        if(d2[i]>d2[x]+1){
            d2[i]=d2[x]+1;
            dfs2(i);
        }
    }
}
signed main(){
    cin>>n>>u>>v;
    u--,v--;
    rep(i,n-1){
        int a,b;
        cin>>a>>b;
        a--,b--;
        V[a].pb(b);
        V[b].pb(a);   
    }
    fill(d,d+n,INF);
    fill(d2,d2+n,INF);
    d[v]=0;
    d2[u]=0;
    dfs(v);
    dfs2(u);
    int ans=0;
    rep(i,n){
        if(d[i]>d2[i]){
            ans=max(ans,d[i]-1);
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 10240
#include<stdio.h>
#include<string.h>
int main(void){
    int n, k, i, a[100000], max, sum;
    scanf("%d %d", &n, &k);
    while ( 1 ) {
        max = sum = 0;
        for ( i = 0; i < n; i++ ) {
            scanf("%d", &a[i]);
            if ( i >= k ) {
                sum = sum - a[i - k] + a[i];
                if ( sum > max ) {
                    max = sum;
                }
            } else if ( i < k ) {
                max += a[i];
                sum += a[i];
            }
        }
        printf("%d\n", max);
        scanf("%d %d", &n, &k);
        if (n == 0 && k == 0) break;
    }
    return 0;
}

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

using namespace std;

int main(int argc, const char *argv[]) {
  int n;
  cin >> n;
  int max_v = 100000;
  vector<int> va(n), cnt1(max_v + 1, 0), cnt2(max_v + 1, 0);
  for (int i = 0; i < n; ++i) {
    cin >> va[i];
    if (i % 2 == 0) {
      cnt1[va[i]]++;
    } else {
      cnt2[va[i]]++;
    }
  }

  auto max2 = [](vector<int> &cnt) {
    array<int, 2> res{0, 0};
    for (int i = 0; i < cnt.size(); i++) {
      if (cnt[res[0]] < cnt[i]) {
        res[1] = res[0];
        res[0] = i;
      } else if (cnt[res[1]] < cnt[i]) {
        res[1] = i;
      }
    }

    return res;
  };

  auto max2_even = max2(cnt1), max2_odd = max2(cnt2);
  int ans;
  if (max2_even[0] != max2_odd[0]) {
    ans = n - cnt1[max2_even[0]] - cnt2[max2_odd[0]];
  } else {
    ans = n - max(cnt1[max2_even[0]] + cnt2[max2_odd[1]],
                  cnt1[max2_even[1]] + cnt2[max2_odd[0]]);
  }

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


Measured memory_bytes: 1408
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int min=0;
		int max=0;
		for(int i=0; i<m; i++) {
			if(i==0) {
				min= sc.nextInt();
				max = sc.nextInt();
			}else {
				int min0 = sc.nextInt();
				int max0 = sc.nextInt();
				if(min0 > min) {min = min0;}
				if(max0 < max) {max = max0;}
			}
		}
		if(max >= min) {
			System.out.println(max-min+1);
		}else {
			System.out.println(0);
		}
	}
}

Measured memory_bytes: 63516
#include <bits/stdc++.h>
#include <math.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rrep(i, n) for(int i = (n-1); i >= 0; i--)
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
const ll INF = 1LL<<60;
const int IINF = 1000000000;
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(){

    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    
    string S; cin >> S;
    int n; cin >> n;

    int index = 0;
    string ans = "";
    while(index < S.size()){
        ans += S[index];
        index += n;
    }

    cout << ans << endl;
}

Measured memory_bytes: 3648
#include<iostream>
using namespace std;
int main()
{
	int n;
	int h[1000];
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>h[i];
	}
	int sum=h[0],ans=1;
	//cout<<sum;
	for(int i=0;i<n;i++)
	{
		if(sum<=h[i])
		{
			sum=h[i];
			ans++;
		}
		else
		{
		}
	}
	cout<<ans-1;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
  int x,y,z,k,t=0;
  cin>>x>>y>>z;
  cin>>k;
  while(x>=y)
  {
  	y=y*2;
  	t++;
  }
  while(y>=z)
  {
  	z=z*2;
  	t++;
  }
  if(t<=k)
  cout<<"Yes";
  else
  cout<<"No";
  return 0;
}

Measured memory_bytes: 3652
#include <iostream>
#include <string>
using namespace std;
int main() {
  string s;
  bool a=false;
  cin>>s;
  if(s[0]!=s[1])
    a=true;
  if(s[0]!=s[2])
    a=true;
  if(s[1]!=s[2])
    a=true;
  if(a){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <utility>
#include <queue>
#include <cmath>

const int INF = 1000000;
using namespace std;

void sub(vector<vector<double> >edge,int s,int g){
    vector<double> kyori(edge.size());
    for(int i=0;i<kyori.size();i++)kyori[i]=INF;
    kyori[s] = 0;
    priority_queue<pair<int,int>,vector<pair<int,int> >,greater<pair<int,int> > > q;
    q.push(make_pair(s,0));
    while(!q.empty()){
        pair<int,int> p = q.top();q.pop();

        if(kyori[p.first] < p.second) continue;
        for(int i=0;i<edge.size();i++){
            if(kyori[i] > kyori[p.first]+edge[p.first][i]){
                kyori[i] = kyori[p.first]+edge[p.first][i];
                q.push(make_pair(i,kyori[i]));
            }
        }
    }
    if(kyori[g] == INF){
        cout << "NA" << endl;
        return ;
    }else{
        int u = g;
        vector<int> prev;
        prev.push_back(u);
        while(u!=s){
            for(int i=0;i<edge.size();i++){
                if(i==u)continue;
                if(abs(kyori[u]-(kyori[i]+edge[i][u])) < 1){
                    u = i;
                    prev.push_back(u);
                    break;
                }
            }
        }
        for(int i=prev.size()-1;i>-1;i--){
            if(i!=prev.size()-1) cout << " ";
            cout << prev[i];
        }
        cout << endl;

    }
}
void solve(int n){
    vector<pair<int,int> > v(1001);
    vector<vector<double> > edge(v.size(),vector<double>(v.size()));
    for(int i=0;i<v.size();i++){
        v[i] = make_pair(INF,INF);
    }
    for(int i=0;i<n;i++){
        int b,x,y;
        cin >> b >> x >> y;
        v[b] = make_pair(x,y);
    }
    for(int i=0;i<v.size();i++){
        for(int j=0;j<v.size();j++){
            if((v[i].first == INF && v[i].second==INF) ||
               (v[j].first == INF && v[j].second==INF)){
                edge[i][j] = INF;
            }else{
                double len = sqrt((v[i].first-v[j].first)*(v[i].first-v[j].first)+
                                  (v[i].second-v[j].second)*(v[i].second-v[j].second));
                if(len > 50){
                    edge[i][j] = INF;
                }else{
                    edge[i][j] = len;
                }
            }
        }
    }
    int m;
    cin >> m;
    for(int i=0;i<m;i++){
        int s,g;
        cin >> s >> g;
        sub(edge,s,g);
    }
}
int main(){
    while(true){
        int n;
        cin >> n;
        if(n==0)break;
        solve(n);
    }
    return 0;
}

Measured memory_bytes: 16000
function main (input) {
  const A = parseInt(input.split(' ')[0]);
  const B = parseInt(input.split(' ')[1]);
  const C = parseInt(input.split(' ')[2]);

  if (A === B) {
    console.log(C);
  } else if (B === C) {
    console.log(A);
  } else {
    console.log(B);
  }
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7496
using System;
using System.Collections;

    class Program
    {
        static void Main()
        {
            bool[,] card = new bool[4,13];
            HashTable types = new HashTable();
            types.setKeyValue("S", 0);
            types.setKeyValue("H", 1);
            types.setKeyValue("C", 2);
            types.setKeyValue("D", 3);

            int cardnum = int.Parse(Console.ReadLine());
            for (int i = 0; i < cardnum; i++)
            {
                string[] line = Console.ReadLine().Split(' ');
                card[types.getValue(line[0]), int.Parse(line[1]) - 1] = true;
            }

            for (int i = 0; i < 4; i++)
            {
                for (int j = 0; j < 13; j++)
                {
                    if (!card[i, j]) Console.WriteLine(types.getKey(i) + " " + (j + 1).ToString());
                }
            }
        }
    }

    class HashTable
    {
        Hashtable keyValue = new Hashtable();
        Hashtable valueKey = new Hashtable();

        public void setKeyValue(string key, int value)
        {
            keyValue[key] = value;
            valueKey[value] = key;
        }

        public string getKey(int value)
        {
            return valueKey[value].ToString();
        }
        public int getValue(string key)
        {
            return (int)keyValue[key];
        }

    }

Measured memory_bytes: 5656
fun main(array: Array<String>) {
    val n = readLine()!!.toInt()
    val list = mutableMapOf<String, Int>()
    var max = 1
    repeat(n) {
        val s = readLine()!!
        if(list.containsKey(s)) {
            list[s] = list[s]!!.plus(1)
            if(max < list[s]!!) max = list[s]!!
        }
        else {
            list += s to 1
        }
    }
    list.filter { it.value == max }.toSortedMap().forEach{ println(it.key)}
}

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

#ifndef ONLINE_JUDGE
#  define LOG(x) (cerr <<">>>>>>"<< #x << " = " << (x) << endl)
#else
#  define LOG(x) ((void)0)
#endif


int main()
{
	
	long long s,k,an=0;
	cin>>k>>s;
	for(int i=0;i<=k;i++)
	for(int j=0;j<=k;j++)
	if((s-i-j)<=k&&(s-i-j)>=0)an++;
	cout<<an<<endl;
}



Measured memory_bytes: 3552
#include <iostream>
#include <vector>
#include <algorithm>


using namespace std;

#define REP(i,n) for (int i=0; i<n; i++)

int main(){
	long long n, m, c, d, ans=0, x=0;
	vector<pair<int, int> > vec;
	pair<int, int> po;
	
	cin >> n >> m;
	
	REP(i,m){
		cin >> c >> d;
		vec.push_back(make_pair(c, d));
	}
	
	sort(vec.begin(), vec.end());
	
	/*
	REP(i,vec.size()){
		printf("(%d, %d), ", vec[i].first, vec[i].second);
	}
	cout << endl;
	//*/
	
	int l, r, i;
	while(i<m){
		// cout << i << endl;
		l = vec[i].first;
		r = vec[i].second;
		i++;
		// printf("i: %d, l: %d, r: %d\n",i,  l, r);
		ans += l - x;
		while(i<m && vec[i].first <= r){
			r = max(r, vec[i].second);
			i++;
		}
		// printf("i: %d, l: %d, r: %d\n",i,  l, r);
		ans += 3*(r-l);
		x = r;
	}
	ans += n+1-x;
	
	cout << ans << endl;
	
}


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

main(){
  int M, N;
  cin >> M >> N;
  int maxv = 0;
  for ( int i= 0; i < M; i++ ){
    int x, k = 0;
    for (int j = 0; j < N; j++ ){
      cin >> x;
      if ( x ) k++;
    }
    maxv = max(maxv, k);
  }
  cout << maxv << endl;
}

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

int main(){
  int h1, m1, h2, m2, k;
  cin >> h1 >> m1 >> h2 >> m2 >> k;
  
  int s, t;
  s = h1*60 + m1;
  t = h2*60 + m2;
  cout << t - s - k << endl;
}

Measured memory_bytes: 3632
from collections import Counter

n = int(input())
a = list(map(int, input().split())) #カウンター使うときは文字列で行ったほうがいい？

A = Counter(a)
# print(a)
num = len(set(a))
count = 0
# print(A.most_common())
D = A.most_common()
for i in range(num):
    if D[i][0] > D[i][1]:
        count += D[i][1]
    else:
        count += D[i][1] - D[i][0]

print(count)

Measured memory_bytes: 22124
import fractions
a,b,c,d = map(int,input().split())
def ans():
    e = b-a+1
    f = b//c + b//d - b//(c*d//fractions.gcd(c,d))
    g = (a-1)//c + (a-1)//d - (a-1)//(c*d//fractions.gcd(c,d))
    print(e-(f-g))
ans()

Measured memory_bytes: 5560
#include<stdio.h>
int main(void){
  int N,i,ans;
  ans=0;
  scanf("%d",&N);
  int C[N],V[N];
  for(i=0;i<N;i++){
    scanf("%d",&V[i]);
  }
  for(i=0;i<N;i++){
    scanf("%d",&C[i]);
  }
  for(i=0;i<N;i++){
    if(V[i]>C[i]){ans=ans+(V[i]-C[i]);}
  }
  printf("%d",ans);
  return 0;
}


Measured memory_bytes: 128
#include "iostream"
#include <stdio.h>
#include <algorithm>
#include <stdlib.h>
#include <string>
#include <cctype>
#include <stack>
#include <vector>
#include <list>
#include <queue>
using namespace std;
using ll=long long;
#define mod  1000000007

int main(int argc, char const *argv[]) {
  string s,t,u;
  std::cin >> s >> t >> u;
  std::cout << s[0] << t[1] << u[2] << '\n';
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define all(n) begin(n), end(n)
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int>> vvint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef unsigned long long ull;
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }

template <typename T, typename... Ts>
auto make_v(size_t a, Ts... ts)
{
    return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T &t, const V &v) { t = v; }

template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T &t, const V &v)
{
    for (auto &e : t)
        fill_v(e, v);
}
int main()
{
    ll N,T;
    cin>>N>>T;
    vll A(N),mins(N),maxs(N);
    ll val = 0;

    for (size_t i = 0; i < N; i++)
    {
        cin>>A[i];
        if(i==0)
        mins[0]=A[0];
        else
        mins[i]=min(mins[i-1],A[i]);
    }
    maxs.back()=A.back();
    for (int i = N - 2; i >= 0; i--)
    {
        maxs[i]=max(maxs[i+1],A[i]);
    }
    for (size_t i = 0; i < N; i++)
    {
        chmax(val,(T/2)*(maxs[i]-mins[i]));
    }
    int ans=0;
    for (size_t i = 0; i < N; i++)
    {
        if(val == (T/2)*(maxs[i]-mins[i]) and (i == 0 or (maxs[i] != maxs[i-1] or mins[i] != mins[i-1])))
        ans++;
    }
    
    cout<<ans;
    return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define fi first
#define se second
long long mo = 1e9 + 7;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<class A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}cout << "\n";}
ld PI=3.14159265358979323846;

int main(){
    ll N,M,K;
    cin >> N >> M >> K;
    vector<ll> A(N), B(M), AS(N+1), BS(M+1);
    rep(i,N){
        cin >> A[i];
        //AS[i+1] = AS[i] + A[i];
    }
    rep(i,M){
        cin >> B[i];
        //BS[i+1] = BS[i] + B[i];
    }
    ll sum = 0;
    ll id = 0;
    while(id < N && sum + A[id] <= K){
        sum += A[id];
        id++;
    }
    ll r = 0;
    ll ans = 0;
    for(ll l=id-1;l>=-1;l--){
        while(r < M && sum + B[r] <= K){
            sum += B[r];
            r++;
        }
        if(sum <= K){
            cmax(ans, l+1+r);
        }
        sum -= A[l];
    }
    cout << ans << endl;
}

Measured memory_bytes: 9576
N,A,B = map(int,input().split())
count = 0
for n in range(1,N+1):
  n = str(n)
  l = []
  for i in range(len(n)):
    l.append(int(n[i]))
  if A <= sum(l) <= B:
    count += int(n)

print(count)

Measured memory_bytes: 3060
#define ll long long
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#include <bits/stdc++.h>
 
using namespace std;
 
ll gcd2(ll x, ll y, ll z){
    return gcd(gcd(x, y), z);
}
int main(void) {
    ll t, ans = 0;
    cin >> t;
    rep2(i, 1, t){
        rep2(j, 1, t){
            rep2(k, 1, t){
                ans += gcd2(i, j, k);
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define ll long long
#define F first
#define S second
#define mp make_pair
#define All(v) v.begin(),v.end()
#define mod 1000000007

using namespace std;
int n;
string s[2];
/**
1 = red
2 = cyan
3 = green
*/
ll dp[55][55][4][4];

ll solve(int i,int j,int u,int d)
{
    //  cout << i << " " << j << " " << u << " " << d << endl;
    if(i == n && j == n)
        return 1;

    ll &ret = dp[i][j][u][d];

    if(ret != -1)
        return ret;
    ret = 0;
    if(i == j)
    {
        if(i == 0)
        {
            if(s[0][i] == s[1][j])
            {
                ret += solve(i+1,j+1,1,1);
                ret %= mod;
                ret += solve(i+1,j+1,2,2);
                ret %= mod;
                ret += solve(i+1,j+1,3,3);
                ret %= mod;
            }
            else
            {
                ret += solve(i+2,j,1,d);
                ret %= mod;
                ret += solve(i+2,j,2,d);
                ret %= mod;
                ret += solve(i+2,j,3,d);
                ret %= mod;
            }
        }
        else
        {
            if(s[0][i] == s[1][j])
            {
                if(u != 1 && d != 1)
                {
                    ret += solve(i+1,j+1,1,1);
                    ret %= mod;
                }
                if(u != 2 && d != 2)
                {
                    ret += solve(i+1,j+1,2,2);
                    ret %= mod;
                }
                if(u != 3 && d != 3)
                {
                    ret += solve(i+1,j+1,3,3);
                    ret %= mod;
                }
            }
            else
            {
                if(u != 1)
                {
                    ret += solve(i+2,j,1,d);
                    ret %= mod;
                }
                if(u != 2)
                {
                    ret += solve(i+2,j,2,d);
                    ret %= mod;
                }
                if(u != 3)
                {
                    ret += solve(i+2,j,3,d);
                    ret %= mod;
                }
            }
        }
    }
    else
    {
        if(u != 1 && d != 1)
        {
            ret += solve(i,j+2,u,1);
            ret %= mod;
        }
        if(u != 2 && d != 2)
        {
            ret += solve(i,j+2,u,2);
            ret %= mod;
        }
        if(u != 3 && d != 3)
        {
            ret += solve(i,j+2,u,3);
            ret %= mod;
        }
    }
    return ret;
}

int main()
{
    memset(dp,-1,sizeof(dp));
    cin >> n;
    cin >> s[0] >> s[1];

    cout << solve(0,0,0,0);


    return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define con continue
#define bk break
#define LL long long
#define db double
#define pt cout<<'\n'
#define ms(a, b) memset((a), (b), sizeof(a))
#define mp make_pair
#define endl '\n'
int inf=2147483647;const long long ll =9223372036854775807,ninf=1000000000;const double eps = 1e-6; const long long nll =223372036854775807;
#define sz size()
#define len(X) strlen(X)
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define ULL unsigned long long
#define de cout<<"test"<<endl;
#define st system("pause");
#define M_PI 3.1415926
int main()
{
    LL mod=1000000007;
    LL a,b;
    while(cin>>a>>b){
        if(a<b){
            swap(a,b);
        }
        LL sum=1;
        LL r=b,l=a;
while(1){
    sum*=l;
    sum%=mod;
    l--;
    if(l==0)
        bk;
    sum*=r;
    r--;
    sum%=mod;
    if(r==0)
        bk;
}
        if( (r==1&&l==0) ||(l==1&&r==0) ){
                if(a==b)
                sum*=2;

        sum%=mod;
            cout<<sum<<endl;
        }
        else{
            cout<<0<<endl;
        }





    }

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<queue>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstring>
#define INF 2147483647
#define llINF 9223372036854775807
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long

using namespace std;
int main(){
  ll N,T;
  cin>>N>>T;
  ll t[N+10]={};
  ll ans=0;
  ll pointer=0;
  for(int i=0;i<N;i++){
    cin>>t[i];
    if(i==0)
      continue;
    if(t[i]-t[i-1]<T){
      ;
    }else{
      ans+=T+t[i-1]-t[pointer];
      pointer=i;
    }
  }
  cout<<ans+T+t[N-1]-t[pointer]<<endl;
  return 0;
}


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


int main(){
    vector<int> x(5);
    rep(i,5){
        cin >> x[i];
        if(x[i] == 0) cout << i+1 << endl;
    }
    return 0;
}


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

int main(void) {
	char tmp[1000];
	//??\????????°?????\????????????
	fgets(tmp, sizeof(tmp), stdin);
	int loop = atoi(tmp);
	
	//??????????????????????????\???
	fgets(tmp, sizeof(tmp), stdin);
	int num[1000];
	
	//??\???????????????????????????
	num[0]=atoi(strtok(tmp," "));
	
	int i;
    for(i = 1;i<loop;i++){
        num[i]=atoi(strtok(NULL," "));
    }
	
	for (i = loop-1; i >=0;i--) {
	    if(i == 0) {
	        printf("%d\n",num[i]);
            break;
        }
		printf("%d ",num[i]);
	}
	//???????????????
	

	return 0;
}

Measured memory_bytes: 532
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define bg begin()
#define ed end()
#define rbg rbegin()
#define red rend()
#define all(x) x.bg,x.ed
#define rall(x) x.rbg,x.red
#define pb push_back
#define pf push_front
#define eb emplace_back
using namespace std;
typedef long long ll;
template<class t,class u> bool chmax(t&a,u b){if(a<b){a=b; return true;} return false;}
template<class t,class u> bool chmin(t&a,u b){if(a>b){a=b; return true;} return false;}
template<class t,class u> t MAX(t a,u b){if(a>=b) return a; return b;}
template<class t,class u> t MIN(t a,u b){if(a<=b) return a; return b;}
template<class t> int SIZE(t s){return (int)s.size();}
template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;
using vvi=vc<vc<int>>;
using pi=pair<int,int>;
using vi=vc<int>;
void yes(){ cout << "Yes" << endl; }
void no(){ cout << "No" << endl; }
const long long INF = 1LL << 60;

int main(){
    cout << fixed << setprecision(20);
    int n; cin >> n;
    vc<double> a(n);
    rep(i,n) cin >> a[i];
    sort(all(a));
    rep(i,n-1){
        a[i+1] = (a[i]+a[i+1])/2;
    }
    cout << a[n-1] << endl;
    return 0;
}


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

int main() {
    int N, cnt = 0;
    cin >> N;
    string S[N];

    for(int i = 0; i < N; i++) cin >> S[i];

    for(int i = 0; i < N; i++) {
        if (S[i] == "Y") {
            cout << "Four" << endl;
            return 0;
        }
    }

    cout << "Three" << endl;
    
    return 0;
}

Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

func main() {
	buf := make([]byte, 1024*1024)
	sc.Buffer(buf, bufio.MaxScanTokenSize)
	sc.Split(bufio.ScanWords)
	defer out.Flush()

	var a, b []int
	n := nextInt()
	for i := 0; i < n; i++ {
		tmpA, tmpB := nextInt(), nextInt()
		a = append(a, tmpA)
		b = append(b, tmpB)
	}
	sort.Sort(sort.IntSlice(a))
	sort.Sort(sort.Reverse(sort.IntSlice(b)))
	if n%2 == 0 {
		medianBDouble := (b[n/2] + b[n/2-1])
		medianADouble := (a[n/2] + a[n/2-1])
		fmt.Fprintln(out, medianBDouble - medianADouble + 1)
	} else {
		medianB := b[n/2]
		medianA := a[n/2]
		fmt.Fprintln(out, medianB - medianA + 1)
	}
}


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

using namespace std;

int n,a,b,i,j;
map <long long, int> cnt;
long long v[55],ncr[55][55];

int main(){

	scanf("%d%d%d", &n, &a, &b);
	
	for(i = 0; i < n; i++){
		scanf("%lld", &v[i]);
		cnt[v[i]]++;
	}
	
	ncr[0][0] = 1;
	for(i = 1; i <= n; i++){
		ncr[i][0] = 1;
		for(j = 1; j <= n; j++)
		ncr[i][j] = ncr[i - 1][j] + ncr[i - 1][j - 1];
	}
	
	sort(v, v + n);
	reverse(v, v + n);
	
	long long pre = -1;
	int now = 0;
	long long cur = 0;
	pair <long long, int> res = {1, 1};
	long long ways = 0;
	
	for(i = 0; i < n; i++){
		if(v[i] != pre)
		now = 0;
		
		now++;
		cur += v[i];
		
		if(i + 1 >= a && i + 1 <= b){
			if(cur * res.second > res.first * (i + 1)){
				res = {cur, i + 1};
				ways = ncr[cnt[v[i]]][now];
			}
			else if(cur * res.second == res.first * (i + 1))
			ways += ncr[cnt[v[i]]][now];
		}
		
		pre = v[i];
	}	
	
	printf("%.12lf\n%lld\n", res.first * 1.0 / res.second, ways);		
}


Measured memory_bytes: 256
#include"bits/stdc++.h"
using namespace std;
int main(){
    long long N, K;
    cin >> N >> K;
    double answer = 0;
    for(int i=0; i<N; i++){
        long long score = i+1;
        double tmp = 1.0/N;
        while(score < K){
            tmp /= 2;
            score *= 2;
        }
        answer += tmp;
    }
    cout << setprecision(16) << answer << endl;
}

Measured memory_bytes: 256
S = str(input())
T = str(input())

ans=1000
for i in range(len(S)-len(T)+1):
	subS=S[i:(i+len(T))]
	ans_tmp=0
	for j in range(len(subS)):
		if subS[j]!=T[j]:
			ans_tmp+=1
	
	ans=min(ans,ans_tmp)

print(ans)

# 2darray [[0] * 4 for i in range(3)]
# import itertools

Measured memory_bytes: 9120
#include <bits/stdc++.h>
using namespace std;
#define EXCEPTERROR cout << "-1" << endl;
#define rep(k,nu)    for(int i=k; i<nu;  i++)
#define rep2(k,n)   for(int j=k; j<n;  j++)
#define size_a(array) sizeof(array) / sizeof(array[0])
#define INF 1000000000000 //1e+12
#define MOD 10000007 //1e9+7
#define ll long long
#define pb pop_back
template<typename T> inline void chMin(T* a, T* b) {if(*a>*b) *a=*b;}
template<typename T> inline void chMax(T* a, T* b) {if(*a<*b) *a=*b;}
template<typename T> inline int  divUp(T a, T b)   {return ((a+b-1)/b);}
const double PI = acos(-1);


int main(){
    int n, m; cin >> n >> m;
    vector<int> a(n);
    rep(0,n) cin >> a[i];
    int AllBote=0;
    rep(0,n) AllBote += a[i];

    sort(a.begin(),a.end());
    cout << (a[n-m]>= divUp(AllBote,4*m)? "Yes" : "No") << endl;
    return 0;
}
/*

*/


Measured memory_bytes: 3600
#include<bits/stdc++.h>
 
using namespace std;
 
int main(){
	string a, b; cin >> a >> b;
	string temp = "";
	for(int i = 2; i >= 0; --i){
		temp += b[i];
	}
	bool cek = 1;
	for(int i = 0; i < 3; ++i){
		if(a[i] != temp[i]){
			cek = 0;
			break;
		}
	}	
	if(cek) printf("YES\n");
	else printf("NO\n");
}

Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <tuple>
#include <bitset>
using namespace std;

typedef long long ll;

ll N;
ll ans = 0;

ll rec(ll n, ll m) {

  if (n <= N) {
    if ( (m & (1<<0)) && (m & (1<<1)) && (m & (1<<2)) ) ans++;
  }
  else {
    return 0;
  }
  
  rec(n*10 + 3, m | 1);
  rec(n*10 + 5, m | 2);
  rec(n*10 + 7, m | 4);

  return 0;
  
}

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

  cin >> N;

  rec(3, 1<<0);
  rec(5, 1<<1);
  rec(7, 1<<2);

  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3624
# util functions

# debug
$debugFlag = ( ARGV[0] != nil )
p "==== DEBUG MODE ====" if $debugFlag

def pd(str)
  p str if $debugFlag
end

def printd(str)
  print str if $debugFlag
end

# input
inputs = []
lc = 0
while l = $stdin.gets do
  if true
    inputs << l.chomp.split(" ").map(&:to_s)
  else
    inputs << l.chomp.split(" ").map(&:to_i)
  end
  lc += 1
end

str = inputs[0][0]

# input check
if $debugFlag
  p "--- INPUT (begin) ---"
  inputs.each do |l_i|
    p l_i
  end
  p "--- INPUT (end) ---"
  print "\n"
end

# body
if $debugFlag
  p str
end

state = 0 # 0 -> R, 1 -> L
arr = []
cntr = 0
cntl = 0
str.length.times do |i|
  if str[i..i] == 'R'
    if state == 0
      cntr += 1
    else
      arr << [cntr-1, cntr, cntl]
      state = 0
      cntr = 1
    end
  else
    if state == 0
      state = 1
      cntl = 1
    else
      cntl += 1
    end
    if i == str.length - 1
      arr << [cntr - 1, cntr, cntl]
    end
  end
end

pd arr

arr.each do |arr_i|
  (arr_i[1]-1).times do
    print "0 "
  end
  if arr_i[1] % 2 == 1
    lnum = (arr_i[1] + arr_i[2])/2
    rnum = arr_i[1] + arr_i[2] - lnum
  else
    rnum = (arr_i[1] + arr_i[2])/2
    lnum = arr_i[1] + arr_i[2] - rnum    
  end
  print "#{rnum} #{lnum} "
  (arr_i[2]-1).times do
    print "0 "
  end  
end

print "\n"


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

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef pair<int,int> pii;
template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define error(x) cerr << #x << " = " << x << endl
#define sz(x) (int)(x).size()
#define eb emplace_back
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound

const int MOD = 1e9 + 7;

int a, b;
int main(void) {
    ios_base::sync_with_stdio(0), cin.tie(nullptr);
    cin >> a >> b;
    cout << (a+b)%24 << endl;
    return 0;
}


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

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

    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        a[i] -= i + 1;
    }
    sort(a.begin(), a.end());
    int b = a[(n - 1) / 2];

    long long ans = 0;
    for (int i = 0; i < n; i++) ans += abs(a[i] - b);
    cout << ans << endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef  long long ll;
using vll=vector<ll>;
using vvll=vector<vll>;
using vi=vector<int>;
using vvi=vector<vector<int>>;
using vb=vector<bool>;
using pii=pair<int,int>;
using vpii=vector<pair<int,int>>;
using plli=pair<ll,int>;
using vplli=vector<pair<ll,int>>;
using pllll=pair<ll,ll>;
using vpllll=vector<pair<ll,ll>>;

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

//pow(llpow,modpow)
template<class T> ll llpow(ll x,T n){ll ans=1;if(x==0)ans=0;while(n){if(n&1)ans*=x;x*=x;n>>=1;}return ans;}
long long modpow(long long a, long long n, long long mod) {long long res = 1;while (n > 0) {if (n & 1) res = res * a % mod;a = a * a % mod;n >>= 1;}return res;}
//最大公約数
template<class T> inline T gcd(T x,T y){if(y==0)return x; else {return gcd(y,x%y);}}
//最小公倍数
template<class T> inline T lcm(T x,T y){return x/gcd(x,y)*y;}
//逆元
long long modinv(long long a, long long m) {long long b = m, u = 1, v = 0;while (b) {long long t = a / b;a -= t * b; swap(a, b);u -= t * v; swap(u, v);}u %= m;if (u < 0) u += m;return u;}

#define rep(i, begin_i, end_i) for (ll i = (ll)begin_i; i < (ll)end_i; i++)
//試験導入
#define irep(i, end_i, begin_i) for (ll i = (ll)begin_i-1; i >= (ll)end_i; i--)
template <class T> bool is_prime(T IN) { if (IN <= 1) return false; for (long long i = 2; i * i <= IN; i++) { if (IN % i == 0) { return false; } } return true; } template <class T> vector<pair<long long, long long>> primefact(T x) { vector<pair<long long, long long>> ret; ll cpyx=x; for (long long i = 1; i * i <= x; i++) { if (x % i == 0) { vector<long long> alt = {i, x / i}; if (alt[0] == alt[1]) alt[1] = 1; for (long long j = 0; j < alt.size(); j++) { if (is_prime(alt[j])) { pair<long long, long long> t = make_pair(alt[j], 0); while (cpyx % alt[j] == 0) { cpyx /= alt[j]; t.second++; } ret.push_back(t); } } } } return ret; }
long long INF = 1LL<<60;
//最初に設定する.
//modcinit()呼び出し．
const int MAX = 510000; const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];  void modcinit() { 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; } } long long modc(int n, int k){ if (n < k) return 0; if (n < 0 || k < 0) return 0; return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD; }
int main( ){
    ll n,m;
    cin>>n>>m;
    vpllll pf=primefact(m);
    ll ans=1;
    ll mod=1e9+7;
    modcinit();
    for(auto e:pf){
        ans*=modc(e.second+n-1,n-1);
        ans=((ans%mod)+mod)%mod;
    }
    cout<<ans<<endl;
    return 0;
}




Measured memory_bytes: 12288
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;cin>>n;
  vector<int >nos(n,0);
  for(int i=0;i<n;i++)cin>>nos[i];
  vector<long long >pos(n+1,0);
  for(int i=0;i<n;i++)pos[nos[i]]++;
  //sum up everyone remove mine and then add with -1 
  long long sumofc2 = 0;
  for(int i=1;i<=n;i++){
  if(pos[i]>1)sumofc2+=((pos[i])*(pos[i]-1))/2;
  }
  long long tot;
  for(int i=0;i<n;i++){
  	tot=0;
    if(pos[nos[i]]>1){
      tot=sumofc2 - (pos[nos[i]]*(pos[nos[i]]-1))/2 + ((pos[nos[i]]-1)*(pos[nos[i]]-2))/2;
      cout<<tot<<'\n';
    }
    else cout<<sumofc2<<'\n';
  }
}

Measured memory_bytes: 5540
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <iostream>
#include <sstream>
#include <climits>
#include <cfloat>
#include <complex>

using namespace std;

int main()
{
	int n;
	while (scanf("%d", &n), n)
	{
		int arr[100];
		for (int i = 0; i < n; ++i)
			scanf("%d", arr+i);

		int ans = 0;
		for (int i = n-1; i > 0; --i)
		{
			for (int j = 0; j < i; ++j)
			{
				if (arr[j] > arr[j+1])
				{
					swap(arr[j], arr[j+1]);
					++ans;
				}
			}
		}
		printf("%d\n", ans);
	}

	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = ((int)(n)-1); i >= 0; i--)
#define all(x) (x).begin(),(x).end()
 
using namespace std;
using ll = long long;
 
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; }

struct edge { int to; int cost; };
 
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> P;
 
const int INF = 1e9;
const int MOD = 1e9+7;
const double EPS = 1.0e-10;
const double PI = acos(-1.0);
 
const int mx4[] = {0,1,0,-1};
const int my4[] = {1,0,-1,0};
const int mx8[] = {0,1,1,1,0,-1,-1,-1};
const int my8[] = {1,1,0,-1,-1,-1,0,1};

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

	int ok = 0;
	for(int i = (int)(s.size()-t.size()); i >= 0 ; i--){
		int flag = 1;
		for(int j = 0; j < t.size(); j++){
			if(s[i+j] != t[j] && s[i+j] != '?') flag = 0;
		}	
		if(flag) {
			ok = 1;
			for(int j = 0; j < t.size(); j++){
				s[i+j] = t[j];
			}
			break;
		}
	}
	for(int i = 0; i < s.size(); i++) if(s[i] == '?') s[i] = 'a';

	if(ok) cout << s << endl;
	else cout << "UNRESTORABLE" << endl;

	return 0;
}

Measured memory_bytes: 256