akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a,b,c,d,kaia,kaib;
  cin>>a>>b>>c>>d;
  kaia=1+c/b;
  if(c%b==0){
    kaia=kaia-1;
  }
  kaib=1+a/d;
  if(a%d==0){
    kaib=kaib-1;
  }
  string ans;
  ans="Yes";
  if(kaia>kaib){
    ans="No";
  }
  cout<<ans;
}

Measured memory_bytes: 3628
k = int(input())

a = [49 + k // 50] * 50

b = k % 50

if b:
    for i in range(50):
        if i < b:
            a[i] += 50 - (b-1)
        else:
            a[i] -= b

print(50)
print(" ".join(list(map(str, a))))


Measured memory_bytes: 9172
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#define vll vector<ll>
#define vvvl vector<vvl>
#define vvl vector<vector<ll>>
#define VV(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define VVV(a, b, c, d) vector<vvl>(a, vvl(b, vll (c, d)));
#define re(c, b) for(ll c=0;c<b;c++)
#define all(obj) (obj).begin(), (obj).end()
typedef long long int ll;
typedef long double ld;
using namespace std;

#define P 1000000007
#define N_MAX 10000000
typedef long long int ll;
ll fac[N_MAX+1];
ll inv[N_MAX+1];
ll finv[N_MAX+1];

ll comb(ll n, ll k){
  if(n<0||k<0||n<k) return 0;
  return (((fac[n]*finv[n-k])%P)*finv[k])%P;
}

void init(){
  fac[0] = finv[0] = fac[1] = finv[1] = inv[1] = 1;
  for(int i = 2; i <= N_MAX; i++){
    fac[i] = (fac[i-1]*i)%P;
    inv[i] = ((-(P/i)*inv[P%i])%P+P)%P;
    finv[i] = (finv[i-1]*inv[i])%P;
  }
}
ll pp(ll a, ll b){
  return (a * b)%P;
}

ll mpow(ll a, ll b, ll p = -1){
  ll ret = 1, num = a;
  if(p==-1){
    while(b>0){
      if(b%2) ret *= num;
      num = num * num;
      b /= 2;
    }
  }else{
    while(b>0){
      if(b%2) ret = (ret*num)%p;
      num = (num*num)%p;
      b /= 2;
    }
  }
  return ret;
}

ll solve1(vvl dat){
  ll n = dat.size();
  vll dp(n+1, 0);
  dp[0] = 1;
  for(int i=1;i<=n;i++){
    // そのまま
    ll x = (i==1?1:dat[i-1][0]-dat[i-2][0]);
    dp[i] = (dp[i] + (dp[i-1] * x)%P)%P;
    if(i>=3) dp[i] = (dp[i] + dp[i-2])%P;
  }
  return dp[n];
}

ll solve2(vvl dat){
  ll n = dat.size();
  vvl tmp;
  ll ad = 0;
  for(int i=0;i<n;i++){
    ll x = ad + dat[i][0];
    ll y = ad + dat[i][0] + dat[i][1];
    ad += dat[i][1];
    tmp.push_back(vll{x, 1});
    tmp.push_back(vll{y, 1});
  }
  return solve1(tmp);
}


int main(int argc, char const *argv[]) {
  init();
  ll n, x = 0;std::cin >> n;
  vll a(n);
  for(int i=0;i<n;i++){
    std::cin >> a[i];
    x ^= a[i];
  }
  if(x!=0){
    ll now = 0, cnt = 0;
    vvl dat;
    for(int i=0;i<n;i++){
      now ^= a[i];
      if(now==0) cnt++;
      if(now==x){
        dat.push_back(vll{cnt, 1});
        now = 0, cnt++;
      }
    }
    std::cout << solve1(dat) << '\n';
    return 0;
  }
  ll ans = 0;
  ll now = 0, cnt = 0;
  vector<map<ll, ll>> dat(1<<20);

  for(int i=0;i<n;i++){
    now ^= a[i];
    if(now==0) cnt++;
    else{
      auto itr = dat[now].find(cnt);
      if(itr==dat[now].end()) dat[now].emplace(cnt, 1);
      else (*itr).second++;
    }
  }
  ans = mpow(2, cnt-1, P);
  // xor が iになる場合
  for(int i=1;i<(1<<20);i++){
    if(dat[i].size()==0) continue;
    vvl tmp;
    for(auto e:dat[i]) tmp.push_back(vll{e.first, e.second});
    ans = (ans + solve2(tmp))%P;
  }
  std::cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 289712
#include<bits/stdc++.h>
using namespace std;
int main(){
  double R0,W0,C,R;
  while(cin>>R0>>W0>>C>>R,R0+W0+C+R!=0){
    int ans=0;
    while(R0/W0<C){
	R0+=R;
	ans++;
    }
    cout<<ans<<endl;
  }
  return 0;
}

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

bool ask(int a, int b) {
	cout << "? " << a << ' ' << b << endl;
	char verdict; cin >> verdict;
	return verdict == 'Y'; // YES
}

int N, A, B;

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0);
	cin >> A >> B;
	N = A + B;
	if (A <= B) return cout << "Impossible\n", 0;

	int need = B + 1;
	vector<int> path;
	for (int i = 0; i < N; ++i) {
		if (path.size() >= need) break;

		// find a path with all 'Y' and its length is greater than B
		if (path.empty()) {
			path.push_back(i);
		} else {
			bool b = ask(i, path.back());
			if (b == 1) {
				path.push_back(i);
			} else {
				path.pop_back(); // A > B still remains
				--need;
			}
		}
	}
	int honest = path.front();

	string trace = "";
	for (int i = 0; i < N; ++i) trace += '0';
	trace[honest] = '1';
	for (int i = 0; i < N; ++i) if (i != honest) trace[i] += ask(honest, i);

	cout << "! " << trace << endl; 
}

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

int main() {
  string o,e;
  cin >> o >> e;
  if (o.size() == e.size()) {
    for (int i = 0; i < o.size(); i++) {
      cout << o.at(i) << e.at(i);
    }
  }
  else {
    for (int i = 0; i < o.size()-1; i++) {
      cout << o.at(i) << e.at(i);
    }
    cout << o.at(o.size()-1);
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  vector<int> a(3);
  for(int i = 0;i<3;i++){
    int b;
    cin >> b;
    a.at(i) = b;
  }
  sort(a.begin(),a.end());
  cout << a.at(2)*10+a.at(1)+a.at(0) << endl;
  
    
}

Measured memory_bytes: 256
#include <iostream>
#include <string>

using namespace std;

int main()
{
	char alpha[26] = {0};
	string a;
	
	cin >> a;
	
	for (int i = 0; i < a.size(); i++) {
		alpha[a[i] - 'a']++;
	}
	
	for (int i = 0; i < 26; i++) {
		if (alpha[i] % 2 != 0) {
			cout << "No" << endl;
			return (0);
		}
	}
	
	cout << "Yes" << endl;
	
	return (0);
}

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

int calc_accumulate(const vector<vector<vector<int>>> &f, int c, int x, int y, int k)
{
    int ret = 0;
    ret += f[c][x + k - 1][y + k - 1];
    if (x > 0)
    {
        ret -= f[c][x - 1][y + k - 1];
    }
    if (y > 0)
    {
        ret -= f[c][x + k - 1][y - 1];
    }
    if (x > 0 && y > 0)
    {
        ret += f[c][x - 1][y - 1];
    }
    return ret;
}

int main()
{
    int N, K;
    cin >> N >> K;

    long long x, y;
    char c;
    vector<vector<vector<int>>> field(2, vector<vector<int>>(4 * K, vector<int>(4 * K, 0)));
    for (int i = 0; i < N; i++)
    {
        cin >> x >> y >> c;
        x %= 2 * K;
        y %= 2 * K;
        if (c == 'B')
        {
            field[0][x][y]++;
            field[0][x + 2 * K][y]++;
            field[0][x][y + 2 * K]++;
            field[0][x + 2 * K][y + 2 * K]++;
        }
        else
        {
            field[1][x][y]++;
            field[1][x + 2 * K][y]++;
            field[1][x][y + 2 * K]++;
            field[1][x + 2 * K][y + 2 * K]++;
        }
    }

    for (int i = 0; i < 4 * K; i++)
    {
        for (int j = 0; j < 4 * K; j++)
        {
            for (int k = 0; k < 2; k++)
            {
                if (i > 0)
                {
                    field[k][i][j] += field[k][i - 1][j];
                }
                if (j > 0)
                {
                    field[k][i][j] += field[k][i][j - 1];
                }
                if (i > 0 && j > 0)
                {
                    field[k][i][j] -= field[k][i - 1][j - 1];
                }
            }
        }
    }

    int ans = 0;
    int tmp;
    for (int i = 0; i < 2 * K; i++)
    {
        for (int j = 0; j < 2 * K; j++)
        {
            tmp = 0;
            tmp += calc_accumulate(field, 0, i, j, K);
            tmp += calc_accumulate(field, 1, i + K, j, K);
            tmp += calc_accumulate(field, 1, i, j + K, K);
            tmp += calc_accumulate(field, 0, i + K, j + K, K);
            ans = max(ans, tmp);
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 188288
#include <iostream>
#include <vector>

using namespace std;

class DisjointSet{
public:
    vector<int> rank, p;
    
    DisjointSet(){}
    DisjointSet(int size){
        rank.resize(size, 0);
        p.resize(size, 0);
        for(int i=0; i<size; i++){
            makeSet(i);
        }
    }
    void makeSet(int x){
        p[x] = x;
        rank[x] = 0;
    }

    bool same(int x, int y){
        return findSet(x) == findSet(y);
    }
    
    void unite(int x, int y){
        link(findSet(x), findSet(y));
    }
    
    void link(int x, int y){
        if(rank[x] > rank[y]){
            p[y] = x;
        }else{
            p[x] = y;
            if(rank[x]==rank[y]){
                rank[y]++;
            }
        }
    }
    
    int findSet(int x){
        if(x != p[x]){
            p[x] = findSet(p[x]);
        }
        return p[x];
    }
};

int main(){
    int n, a, b, q;
    int t;
    
    cin >> n >> q;
    DisjointSet ds = DisjointSet(n);
    
    for(int i=0; i<q; i++){
        cin >> t >> a >> b;
        if(t==0){
            ds.unite(a,b);
        }else if(ds.same(a,b)){
            cout << 1 << endl;
        }else{
            cout << 0 << endl;
        }
    }
}

Measured memory_bytes: 3184
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>

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

int main(){
	ios_base::sync_with_stdio(false);
	int n, m;
	string s;
	cin >> n >> m >> s;
	vector<pii> qs(m);
	for(int i = 0; i < m; ++i){
		string t, d;
		cin >> t >> d;
		qs[i] = pii(t[0], d[0] == 'L' ? -1 : 1);
	}
	int alive_left = 0, alive_right = n;
	{	// left
		int lo = 0, hi = n;
		while(lo < hi){
			const int mid = lo + (hi - lo) / 2;
			bool alive = true;
			int p = mid;
			for(const auto& q : qs){
				if(s[p] != q.first){ continue; }
				p += q.second;
				if(p <  0){ alive = false; break; }
				if(p >= n){ break; }
			}
			if(alive){
				hi = mid;
			}else{
				lo = mid + 1;
			}
		}
		alive_left = lo;
	}
	{	// right
		int lo = 0, hi = n;
		while(lo < hi){
			const int mid = lo + (hi - lo) / 2;
			bool alive = true;
			int p = mid;
			for(const auto& q : qs){
				if(s[p] != q.first){ continue; }
				p += q.second;
				if(p >= n){ alive = false; break; }
				if(p <  0){ break; }
			}
			if(alive){
				lo = mid + 1;
			}else{
				hi = mid;
			}
		}
		alive_right = lo;
	}
	const int answer = max(0, alive_right - alive_left);
	cout << answer << endl;
	return 0;
}



Measured memory_bytes: 2196
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define INF 1<<30
#define LINF 1LL<<60

const ll MOD = 1e9 + 7;

ll term(int& i,const string& S);
ll term(int& i,const string& S);
ll expr(int& i,const string& S);
void brank(int& i, const string& S){
    while(S[i] == ' ')i++;
}

ll to_num(int& i,const string& S){
    ll res = 0;
    while(true){
        if(S[i] >= '0' && S[i] <= '9'){
            res = res*10 + (S[i] - '0');
            i++;
        }else{
            break;
        }
    }
    return res;
}

ll term(int& i,const string& S){
    ll res = 0;
    if(isdigit(S[i])){
        res = to_num(i,S);
    }else{
        i+=2;
        res = expr(i,S)%MOD;
        (res*=res)%=MOD;
        i++;
    }
    return res;
}

ll expr(int& i,const string& S){
    ll res = term(i,S);
    while(S[i] == 'X' && S[i+1] == 'X'){
        i+=2;
        ll tmp = term(i,S);
        res >>= min(60LL,tmp);
    }
    return res;
}

int main(void) {
    cin.tie(0); ios::sync_with_stdio(false);
    string S;
    while(true){
        getline(cin,S);
        if(S == "#") break;
        
        string tmp;
        for(int i = 0; i < S.length() ;i++){
            if(S[i] == ' ')continue;
            tmp += S[i];
        }
        S = tmp;
        for(int i = (int)S.length()-1; i>= 2; i--){
            if((isdigit(S[i]) || S[i] == 'S') && S[i-1] == '>' && S[i-2] == '>' ){
                S[i-1] = S[i-2] = 'X';
            }
        }
        int i = 0;
        cout << expr(i,S)<< endl;
    }
    return 0;
}

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

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP(i, 0, x);
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;

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

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

int main(void) {
  string s;
  cin >> s;
  replace(all(s), ',', ' ');
  cout << s << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		long N = sc.nextLong();
      	long A = sc.nextLong();
      	long B = sc.nextLong();
      	
      	long blue=N/(A+B);
		long mod=N%(A+B);
      if(mod>=A){
      mod=A;
	}
      System.out.println(blue*A+mod);
      
    }
}


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

class Program
{
    static void Main(string[] args)
    {
        var input = Console.ReadLine().Split(" ");
        var A = int.Parse(input[0]);
        var B = int.Parse(input[1]);
        var H = int.Parse(input[2]);
        var M = int.Parse(input[3]);

        var timeAngle = H * 30 + M * 0.5;
        var minuteAngle = (double)M * 6;
        var radB = (timeAngle - minuteAngle) * Math.PI / 180.0;

        var length = Math.Sqrt(Math.Pow(A, 2) + Math.Pow(B, 2) - 2 * A * B * Math.Cos(radB));

        Console.WriteLine(length);

    }
}


Measured memory_bytes: 27900
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		DataSet d = new DataSet();
		d.input();
		Main m = new Main();
		System.out.println(m.calc(d));
	}
	
	public int calc(DataSet d){
		int min = 100000;
		for(char c='a';c<='z';c++){
			int count =0;
			int max = 0;
			for(int i=0;i<=d.s.length;i++){
				if(i == d.s.length){
					max = Math.max(count, max);
					min = Math.min(min, max);
				}
				else if(d.s[i]==c){
					max = Math.max(count, max);
					count = 0;
				}
				else count++;
			}
		}
		return min;
	}

}

class DataSet{
	
	String S;
	char[] s;
	
	public void input(){
		Scanner sc = new Scanner(System.in);
		S = sc.next();
		s = new char[S.length()];
		for(int i=0;i<S.length();i++)
			s[i] = S.charAt(i);
		
		sc.close();
	}
	
}

Measured memory_bytes: 23252
<?php

$N = trim(fgets(STDIN));
$As = trim(fgets(STDIN));
$A = explode(" ",$As);
rsort($A);

for ($i=0;$i<$N/2;$i++){
    $Al+=$A[$i*2];
    $Bo+=$A[$i*2+1];
}
echo ($Al-$Bo);
?>

Measured memory_bytes: 3576
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = int(a); i < int(b); i++)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep,)(__VA_ARGS__)
#define all(x) (x).begin(), (x).end()
#define INF 10000000000
ll a, b, c, n, m, x, y, z, w, h, ans = 0, cnt = 0, mx = 0, mn = INF;
string s, t;

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

    while(cin >> n >> m){
        ans = m * pow((m - 1), n - 1);
        cout << ans << endl;
    }
}



Measured memory_bytes: 384
import math

list1 = list(map(int, input().strip().split()))
a = list1[0]
b = list1[1]
c = list1[2]
d = list1[3]


k = math.ceil(a/d)
l = math.ceil(c/b)

if k>=l:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 9192
import java.util.Scanner;

public class Main{
	static int c[][];
	static int h,w;
	private static void land(int x, int y){
		c[x][y] = 0;

		for(int i = x-1; i <= x+1; i++){
			if(i < 0 || i >= h) continue;
			for(int j = y-1; j <= y+1; j++){
				if(j < 0 || j >= w) continue;
				if(c[i][j] == 1) land(i, j);
			}
		}
	}
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		while(true){
			int count = 0;
			w = sc.nextInt();
			h = sc.nextInt();
			if(w == 0 && h == 0) break;
			c = new int[h][w];
			for(int i = 0; i < h; i++){
				for(int j = 0; j < w; j++){
					c[i][j] = sc.nextInt();
				}
			}
			for(int i = 0; i < h; i++){
				for(int j = 0; j < w; j++){
					if(c[i][j] == 1){
						land(i, j);
						count++;
					}
				}
			}
			System.out.println(count);
		}
	}
}

Measured memory_bytes: 44508
#include <cstdio>

int main(){
    char str[1001];
    
    while(1){
        scanf("%s",str);
        if(str[0]=='0') break;
        int i=0;
        int sum=0;
        while(str[i]){
            int j=str[i]-'0';
            sum+=j;
            i++;
        }
        printf("%d\n",sum);
        
    }
    
    
    return 0;
}


Measured memory_bytes: 2744
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << endl;
#define CFYN(n) cout << ( (n) ? "YES":"NO") << endl;
using ll = long long;
using ull = unsigned long long;

int main(void)
{
    IOS
    int n; cin >> n;
    map<int,int> e,o;
    REP(i,n) {
        int x; cin >> x;
        if (i % 2 == 0) e[x]++;
        else o[x]++;
    }

    int e1,e2,o1,o2;
    e1=e2=o1=o2 = 0;
    int eidx, oidx;

    for (auto m: e) {
        if (e1 < m.second) {
            e2 = e1;
            e1 = m.second;
            eidx = m.first;
        } else if (e2 < m.second){
            e2 = m.second;
        }
    }
    for (auto m: o) {
        if (o1 < m.second) {
            o2 = o1;
            o1 = m.second;
            oidx = m.first;
        } else if (o2 < m.second){
            o2 = m.second;
        }
    }

    int ans;
    if (eidx == oidx) {
        ans = min(n-o2-e1, n-o1-e2);
    } else ans = n - o1 - e1;

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 4992
import java.util.*;
class Main {
    public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
	int T = sc.nextInt();
	int A = sc.nextInt();
	double[] offset = new double[N];
	double min = Double.MAX_VALUE;
	int minIndex = 0;
	for(int i = 0; i<N; i++) {
	    offset[i] = Math.abs((T - 0.006*sc.nextInt()) - A);
	    if(min> offset[i]) {
		min = offset[i];
		minIndex = i;
	    }
	}
	System.out.println(minIndex+1);
    }
}

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

string N;
int res = 0;

int main(){
    cin >> N;

    int len = N.size();
    for(int i = 0; i < len; i++) res += (int)(N[i]-'0');

    if(res % 9 == 0) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;


}

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

int bubbleSort(int* A, int N)
{
	int flag=1;
	int i,tmp;
	while(flag){
		flag = 0;
		
		for(i=N-1;i>0;i--){
			if(A[i]<A[i-1]){
				tmp = A[i];
				A[i]=A[i-1];
				A[i-1]=tmp;
				flag=1;
			}
		}
	}
	return 0;
}

int main(){

	long int N,cnt=0,tmp=1;
	int L[2010];
	long int i,j,k;
	scanf("%ld",&N);
	
	for(i=0;i<N;i++)scanf("%d",&L[i]);
	
	bubbleSort(L,N);
	#if 1
	// tmp x x x i 
	//           tmp x x x x
	for(i=0;i<N-2;i++){
		
	for(j=i+1;j<N-1;j++){
		
	for(k=j+1;k<N;k++){
		if( (L[i]<L[j]+L[k]) &&(L[j]<L[k]+L[i])&&(L[k]<L[j]+L[i]) ) cnt++;
		else break;
		//printf("%ld,",tmp++);
	}
	}
	}
	#endif
	
	printf("%ld\n",cnt);
	return 0;
 }

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        new Main();
    }

    public Main() {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        int W = Integer.parseInt(sc.next());
        int[] w = new int[N];
        int[] v = new int[N];
        for (int i = 0; i < N; i++) {
            w[i] = Integer.parseInt(sc.next());
            v[i] = Integer.parseInt(sc.next());
        }

        long[][] dp = new long[N + 1][W + 1];
        for (int i = 0; i < N; i++) {
            for (int j = 1; j <= W; j++) {
                if (j < w[i]) {
                    dp[i + 1][j] = dp[i][j];
                    continue;
                }
                long taken = dp[i][j - w[i]] + v[i];
                long notTaken = dp[i][j];
                dp[i + 1][j] = Math.max(taken, notTaken);
            }
        }
        System.out.println(dp[N][W]);
    }
}


Measured memory_bytes: 126804
#include<stdio.h>
int main(void){
  	char s[3];
	scanf("%s",s);
	if(s[0] == 'R'){
    	if(s[1] == 'R'){
        	if(s[2] == 'R'){
            	printf("3");
            }
          	else{
              printf("2");
            }
        }
      	else{
        	printf("1");
        }
    }
  	else{
    	if(s[1] == 'R'){
        	if(s[2] == 'R'){
            	printf("2");
            }
          	else{
            	printf("1");
            }
        }
      	else{
        	if(s[2] == 'R'){
            	printf("1");
            }
          	else printf("0");
        }
    }
    	
    
  	return 0;
}

Measured memory_bytes: 1592
#include<cstdio>
#include<cstring>
#include<stack>
using namespace std;
stack<char>cube;
char s[100005];
int main()
{
    int cnt=0;
    int i;
    scanf("%s",s);
    int len=strlen(s);
    for(i=0;i<=len-1;i++)
    {
        if(cube.empty()||cube.top()==s[i])cube.push(s[i]);
        else
        {
            cube.pop();
            cnt+=2;
        }
    }
    printf("%d",cnt);
    return 0;
}

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

int main() {
  int n, m, i, j, len, minLen, index;
  cin >> n >> m;
  vector<int> a(n), b(n), c(m), d(m);
  for (i = 0; i < n; i++) cin >> a[i] >> b[i];
  for (i = 0; i < m; i++) cin >> c[i] >> d[i];
  for (i = 0; i < n; i++) {
    minLen = INT_MAX;
    for (j = 0; j < m; j++) {
      len = abs(a[i] - c[j]) + abs(b[i] - d[j]);
      if (len < minLen) {
        minLen = len;
        index = j + 1;
      }
    }
    cout << index << endl;
  }
}

Measured memory_bytes: 3636
#include <iostream>
#include <string>

using namespace std;

int main(){
    int N;
    cin >> N;
    string S;
    cin >> S;
    int cnt = 0;
    int m = 0;
    for(int i = 0; i < N; i++){
        if(S[i] == '(') cnt++;
        else cnt--;
        m = min(cnt, m);
    }

    if(m < 0){
        for(int i = 0; i < (-m); i++){
            cout << '(';
        }
        cnt += (-m);
    }
    cout << S;
    for(int i = 0; i < cnt; i++){
        cout << ')';
    }
    cout << endl;
}

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

int main() {
  int sum;
  int i;
  int a;
  int b;
  string s;
  cin>>s;
  while(s != "0") {
         a=s.length( );
         sum=0;
         for(i=0;i<a;i++) {
              string s0(1, s[i]);
              b= stoi(s0);
              sum=b+sum;
         }
        cout<<sum<<endl;
        cin >> s;
  }

}






Measured memory_bytes: 3180
#include <algorithm>
#include <cmath>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <cstdio>
#include <vector>
#define For(i,x,y) for(register int i=(x); i<=(y); i++)
using namespace std;
typedef long long ll;
vector<ll>v(2019);
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    string s;
    cin >> s;
    v[0]=1;
    int len=s.size();
    ll ans=0;
    int cnt=1,temp=0;
    reverse(s.begin(),s.end());
    For(i,0,len-1)
    {
        temp=(temp+(s[i]-'0')*cnt)%2019;
        ans+=v[temp];
        v[temp]++;
        cnt=cnt*10%2019;//模的运算法则（乘法原理）
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3744
#include<bits/stdc++.h>
#define rint register int
#define rep(i,a,b) for (rint i=(a),_E=(b); i<=_E; ++i)
#define per(i,a,b) for (rint i=(a),_E=(b); i>=_E; --i)
#define REP(i,n) for (rint i=0,_E=(n); i<_E; ++i)
#define pb push_back
#define cmin(x,y) (y<x?x=y:0)
#define cmax(x,y) (y>x?x=y:0)
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef long double ld;
typedef long long ll;

const ld pi = acos(-1);
ld x[3], y[3], l, r, mid;
ld a, b, c, A, B;

ld dist(int p, int q) {
	return sqrt((x[p] - x[q]) * (x[p] - x[q])
			  + (y[p] - y[q]) * (y[p] - y[q]));
}

bool check(ld r) {
	ld l = 2 * r;
	l += r / tan(A);
	l += r / tan(B);
	return l <= c;
}

int main() {
	rep (i, 0, 2) cin >> x[i] >> y[i];
	a = dist(0, 1);
	b = dist(1, 2);
	c = dist(2, 0);
	if (a > c) swap(a, c);
	if (b > c) swap(b, c);
	A = 0.5 * acos((a * a + c * c - b * b) / (2 * a * c));
	B = 0.5 * acos((b * b + c * c - a * a) / (2 * b * c));
	//printf("%.10Lf %.10Lf %.10Lf %.10Lf %.10Lf\n", a, b, c, A, B);
	l = 0, r = 1000;
	while (r - l > 1e-11) {
		mid = (l + r) * 0.5;
		if (check(mid)) l = mid;
		else r = mid;
	}
	printf("%.10Lf\n", l);
	return 0;
}

Measured memory_bytes: 512
import java.util.*;
import static java.lang.Integer.*;
//import static java.lang.Long.*;
//import static java.lang.Math.*;
import static java.lang.System.*;

public class Main {
	public static void main(String[] args) {
		int j;
		Scanner sc = new Scanner(in);
		int n = parseInt(sc.next());
		int k = parseInt(sc.next());
		sc.close();
		out.println(n%k==0?0:1);
	}
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
//---------------------------
using namespace std;
//---------------------------
#define REP(i,n) for(int i = 0; i < (n); i++)
#define P(x) cout << (x) << "\n"

#define MOD 1e9+7
#define PI acos(-1.0)
#define ll long long
#define INF 1000000001

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

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

  // ifstream in("input.txt");
  // cin.rdbuf(in.rdbuf());

  int n,a;cin>>n>>a;
  P(n*n-a);
  return 0;
}


Measured memory_bytes: 384
#include <stdio.h>

long long abs(long long A);
int main(void)
{
    long long X,K,D,q,r,ans=0;
    scanf("%lld %lld %lld",&X,&K,&D);
    X=abs(X);
    D=abs(D);
    q=X/D;
    r=X%D;

    if(K-q<=0){
        ans=X-K*D;
        // printf("A");
    } else {
        if((K-q)%2==0){
            ans=X%D;
            // printf("B");
        } else {
            ans=abs(D-X%D);
            // printf("C");
        }
    }
    printf("%lld",ans);
    return 0;
}

long long abs(long long A)
{
    if(A<0) A=(-1)*A;
    return A;
}


Measured memory_bytes: 1712
from functools import reduce
from fractions import gcd
from collections import defaultdict
import math
import bisect
import itertools
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
INF = float("inf")


def cmb(n,r):
    r = min(n-r,r)
    if r < 0: return 0
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

def main():
    N = int(input())
    A = list(map(int, input().split()))
    A.sort()
    
    D = defaultdict(int)
    for a in A:
        D[a] += 1
    
    res = N
    l = 0
    r = N-1
    while r-l >= 2:
        if D[A[l]] <= 1:
            l += 1
        elif D[A[r]] <= 1:
            r -= 1
        else:
            res -= 2
            D[A[l]] -= 1
            D[A[r]] -= 1
            l += 1
            r -= 1
    if D[A[l]] > 1 or D[A[r]] > 1:
        res -= 2
    
    print(res)

if __name__ == '__main__':
    main()

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

int main()
{
  string s;
  cin >> s;
  if (s == "Sunny") {
    cout << "Cloudy" << endl;
  } else if (s == "Cloudy") {
    cout << "Rainy" << endl;
  } else {
    cout << "Sunny" << endl;
  }
  return 0;
}

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

int main(){
    int n;
    cin>>n;
    vector<double> v(n);
    int ones=0, twos=0, threes=0, max_ones, max_twos, max_threes;
    int i,j,k;
    for(int i=0; i<n; i++) cin>>v[i];
    for(int i=0; i<n; i++) {
        if(v[i]==1) ones++;
        else if(v[i]==2) twos++;
        else threes++;
    }
    max_ones = ones+twos+threes;
    max_twos = twos+threes;
    max_threes = threes;
    
    double dp[n+1][n+1][n+1]={0.0};
    
    for(k=0; k<=max_threes; k++){
        for(j=0; j<=max_twos-k; j++){
            for(i=0; i<=max_ones-j-k; i++){
                if(i+j+k==0) continue;
                else{
                    dp[i][j][k]=double(n)/(i+j+k);
                    if(i>0) dp[i][j][k] += (dp[i-1][j][k]*i)/(i+j+k);
                    if(j>0) dp[i][j][k] += (dp[i+1][j-1][k]*j)/(i+j+k);
                    if(k>0) dp[i][j][k] += (dp[i][j+1][k-1]*k)/(i+j+k);
                }
            }
        }
    }
    cout<<setprecision(20)<<dp[i-1][j-1][k-1]<<endl;
    return 0;
}


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

typedef long long ll;

int main() {
    int N = 4;
    string S, ans;
    cin >> S;
    string as, bs;
    int a, b;
    a = atoi(S.substr(0,2).c_str());
    b = atoi(S.substr(2,2).c_str());

    if ((a > 12 || a == 0) && (b > 12 || b == 0))
    {
        ans = "NA";
    } else if ((a > 12 || a == 0) && (b <= 12 && b != 0)) {
        ans = "YYMM";
    } else if ((a <= 12 && a != 0) && (b > 12 || b == 0)){
        ans = "MMYY";
    } else {
        ans = "AMBIGUOUS";
    }
    
    cout << ans << endl;

    return 0;
}


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

int main()
{
	ll int n,i,x;
	cin>>n;
	set<ll int> a;
	for(i=0;i<n;i++)
	{
		cin>>x;
		a.insert(x);
		
	}
	if (a.size()==n)
	cout<<"YES"<<endl;
	else
	cout<<"NO"<<endl;
	
	

		

}


	
  
  

		
		
		
		
		
		
	
	
	 
		
		
	
	
	

	


	
	
	
   



Measured memory_bytes: 9600
def iter( begin, end ):
    x = begin
    while x < end:
        yield x
        x += 1
    raise StopIteration

def valid( val , txt ):
    if val%15 == 0: return txt == 'FizzBuzz'
    if val%3 == 0: return txt == 'Fizz'
    if val%5 == 0: return txt == 'Buzz'
    return str(val) == txt
    
while True:
    m, n = map(int, raw_input().split())
    if m+n == 0: break
    player = [ x for x in iter(1, m+1) ]
    ind = 0
    for a in iter(1, n+1):
        txt = raw_input()
        if len(player) == 1: continue
        if valid( a, txt ):
            ind = (ind+1)%len(player)
        else:
            player.pop(ind)
            ind = ind%len(player)
    for p in player[:-1]:
        print p,
    print player[-1]
    

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

int main(){
  long int N;
  long int sum = 0;
  cin >> N;
  for(int i=1;i<N+1;i++){
    if(i==N) sum += 0;
    else sum += i;
  }
  
  cout << sum << endl;

  return 0;
}

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

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

	deque<char> deq;
	for (int i = 0; i < s.size(); i++) {
		if (s.at(i) == '0') {
			deq.push_back('0');
		}
		else if (s.at(i) == '1') {
			deq.push_back('1');
		}
		else if (s.at(i) == 'B') {
			if (!deq.empty()) {
				deq.pop_back();
			}
		}
	}
	for (const auto& c : deq) {
		cout << c;
	}
	cout << endl;
}


Measured memory_bytes: 256
#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>;

ll x = 1e9 + 7; 

int main() {
  int n;
  cin >> n;
  if ((n-7) % 10 == 0) {
    cout << "Yes" << endl;
    return 0;
  }
  n /= 10;
  if ((n-7) % 10 == 0) {
    cout << "Yes" << endl;
    return 0;
  }
  n /= 10;
  if ((n-7) % 10 == 0) {
    cout << "Yes" << endl;
    return 0;
  }
  cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3636
#include <string>
#include <iostream>
using namespace std;
const int mod = 1000000007;
int main() {
	int N; string S;
	cin >> N >> S;
	string par;
	for (int i = 0; i < 2 * N; ++i) {
		if (i == 0) par += (S[i] == 'B' ? '(' : ')');
		else par += ((S[i] != S[i - 1] ? 1 : 0) ^ (par[i - 1] == '(' ? 0 : 1) ? '(' : ')');
	}
	int depth = 0, ans = 1;
	for (int i = 0; i < 2 * N; ++i) {
		if (par[i] == '(') ++depth, ans = 1LL * ans * depth % mod;
		else --depth;
		if (depth < 0) {
			ans = 0;
			break;
		}
	}
	if (depth != 0) ans = 0;
	for (int i = 1; i <= N; ++i) {
		ans = 1LL * ans * i % mod;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 776
#include <cstdio>
#include <set>

using namespace std;

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

inline int getInt(){ int s; scanf("%d", &s); return s; }

int main(){
  while(const int t = getInt()){
    const int n = getInt();
    int sum = 0;

    REP(i,n){
      const int s = getInt();
      const int f = getInt();

      sum += f - s;
    }

    if(t <= sum) puts("OK");
    else printf("%d\n", t - sum);
  }

  return 0;
}

Measured memory_bytes: 0
package main

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

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

const yes = "Yes"
const no = "No"

const l = int32('L')
const r = int32('R')

//const u = int32('U')
//const d = int32('D')

func solve(s string) bool {
	for i, c := range s {
		if i%2 == 0 {
			if c == l {
				return false
			}
		} else {
			if c == r {
				return false
			}
		}
	}
	return true
}

func main() {
	sc.Split(bufio.ScanWords)
	defer out.Flush()

	s := next()
	if solve(s) {
		fmt.Fprintln(out, yes)
	} else {
		fmt.Fprintln(out, no)
	}
}

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

func nextInt() int64 {
	a, _ := strconv.ParseInt(next(), 10, 64)
	return a
}

func nextFloat() float64 {
	a, _ := strconv.ParseFloat(next(), 64)
	return a
}

func nextInts(n int64) []int64 {
	ret := make([]int64, n)
	for i := int64(0); i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}
func nextFloats(n int64) []float64 {
	ret := make([]float64, n)
	for i := int64(0); i < n; i++ {
		ret[i] = nextFloat()
	}
	return ret
}
func nextStrings(n int64) []string {
	ret := make([]string, n)
	for i := int64(0); i < n; i++ {
		ret[i] = next()
	}
	return ret
}

func containStr(arr []string, target string) bool {
	for _, v := range arr {
		if v == target {
			return true
		}
	}
	return false
}

func PrintOut(src interface{}, joinner string) {
	switch reflect.TypeOf(src).Kind() {
	case reflect.Slice:
		s := reflect.ValueOf(src)
		for idx := 0; idx < s.Len(); idx++ {
			fmt.Fprintf(out, "%v", s.Index(idx))
			if idx < s.Len()-1 {
				fmt.Fprintf(out, "%s", joinner)
			} else {
				fmt.Fprintln(out)
			}
		}
	default:
		fmt.Fprintln(out, "orz")
	}
}

// mapからkeysとvaluesを返す
func splitKeyValue(m map[interface{}]interface{}) (keys, values []interface{}) {
	switch reflect.TypeOf(m).Kind() {
	case reflect.Map:
		s := reflect.ValueOf(m)
		for _, v := range s.MapKeys() {
			keys = append(keys, v)
			values = append(values, s.MapIndex(v))
		}
	default:
		fmt.Fprintln(out, "orz")
	}
	return
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    scanf("%d",&n);
    int a[n];
    int dp[n]; for (int i = 0; i < n; i++) dp[i] = 2000000000;
    dp[0] = 0;
    for (int i = 0; i < n; i++) {
        scanf("%d",&a[i]);
        if (i >= 1) dp[i] = min(dp[i],dp[i-1]+abs(a[i]-a[i-1]));
        if (i >= 2) dp[i] = min(dp[i],dp[i-2]+abs(a[i]-a[i-2]));
    }
    printf("%d",dp[n-1]);

}


Measured memory_bytes: 1024
n, ma, mb = map(int, input().split())
INF = float("inf")
dp = [[[INF for i in range(10*n+1)] for i in range(10*n+1)] for i in range(n+1)]
dp[0][0][0],ans = 0,INF
for i in range(1,n+1):
    a,b,c = (int(l) for l in input().split())
    for j in range(10*(i-1)+1):
        for k in range(10*(i-1)+1):
            if dp[i-1][j][k] != INF:
              dp[i][j][k] = min(dp[i][j][k], dp[i-1][j][k])
              dp[i][j+a][k+b] = min(dp[i][j+a][k+b], dp[i-1][j][k]+c)
for i in range(ma,10*n+1,ma):
	if i*mb//ma<=10*n: ans=min(ans,dp[n][i][i*mb//ma])
if ans==INF: print(-1)
else: print(ans)

Measured memory_bytes: 60020
#include <stdio.h>
#include <string.h>
#include <ctype.h>

int main(){
	char o[123],e[123];

	scanf(" %[^\n]", o);
	scanf(" %[^\n]", e);

	int tam1 = strlen(o);
	int tam2 = strlen(e);

	if (tam1 < tam2){
		for (int i = 0;i < tam2;i++) {
			if (i < tam1){
				printf("%c%c", o[i],e[i]);
			}else{
				printf("%c", e[i]);
			}	
		}
	}else {
		for (int i = 0;i < tam1;i++) {
			if (i < tam2){
				printf("%c%c", o[i],e[i]);
			}else{
				printf("%c", o[i]);
			}	
		}
	}
	puts("");
	return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#define Inf 100000000
#define MAXN 11111111
#define ll long long
using namespace std;

ll gcd(ll a, ll b) {
    while(b!=0) {
        ll t = b;
        b=a%b;
        a=t;
    }
    return a;
}



int main() {
    int N;
    cin>>N;
    ll ans = 1;
    for(int i=1;i<=N;i++) {
        ll x;
        cin>>x;
        ans *= x / gcd(ans, x);
    }
    cout << ans << endl;
}

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

int main()
{
    string words[] = {"dream","dreamer","erase","eraser"};
    string str;
    cin >> str;

    queue<string> que;
    bool result = false;
    for(string w : words)
    {
        if(str == w)
        {
            result = true;
        }
        else if(w == str.substr(0,w.length()))
        {
            que.push(w);
        }
    }
    
    while(!que.empty() && !result)
    {
        string t = que.front();
        que.pop();
        for(int i = 0; i < 4; ++i)
        {
            string w = words[i];
            string tmp = t+w;
            if(tmp == str)
            {
                result = true;
                break;
            }
            else if(tmp.length() >= str.length()
            || tmp != str.substr(0,tmp.length()))
            {
                continue;
            }
            que.push(tmp);
        }
    }

    if(result)
    {
        cout << "YES" << endl;
    }
    else
    {
        cout << "NO" << endl;
    }
}

Measured memory_bytes: 1396
#include<iostream>
#include<algorithm>
using namespace std;
int main(void){
    int n;
    int d[105];
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> d[i];
    }

    sort(d,d+n);
    int ans = 0;
    
    for(int j = 0; j < n; j++){
        if(d[j] != d[j+1]){
            ans++;
        }
    }
    cout << ans <<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(long i = 0; i < n; i++)
#define erep(i, n) for(long i = 1; i <= n; i++)
const long MOD = 1000000007;
#define all(a) a.begin(), a.end()
#define eall(a) a.begin()+1, a.end()
#define show(ans)  cout << ans << endl;


int main(){long x;
cin >> x;
if(x == 3 || x == 5 || x == 7){
    show("YES");
}
else show("NO");


return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
  int n,a[200000],i,j,f,g;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
  }
  f=0;
  g=1;
  for(i=0;i<n;i++){
    if(a[i]!=g){
      f++;
    }
    if(a[i]==g){
      g++;
    }
    
    /*printf("%d %d\n",f,g);*/
  }
  if(g!=1){
  printf("%d\n",f);
  }
  if(g==1){
    printf("-1");
  }
    return 0;
}



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

int main() {
  int A,B;
  cin >> A >> B;
  if(A+B >= A-B){
    if(A+B >= A*B){
      cout << A+B << endl;
    }
    else{
      cout << A*B << endl;
    }
  }
  else if(A-B >= A*B){
    cout << A-B << endl;
  }
  else{
    cout << A*B << endl;
  }
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
// using namespace __gnu_pbds;   
#define ll long long
#define ull unsigned long long
// #define ordered_set tree<pair<ll, ll>, null_type, less<pair<ll, ll>>, rb_tree_tag, tree_order_statistics_node_update> 
ll mod=1e9+7;
#define PI 3.1415926535897932385
#define inf 9e18
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
string char_to_str(char c){string tem(1,c);return tem;}
typedef pair<long long, long long> ii;
#define S second
#define F first
ll max(ll a,ll b){if(a>b){return a;}return b;}
ll min(ll a,ll b){if(a<b){return a;}return b;}
#define MAXN 200005
// Comment this out for interactice problem
// #define endl '\n'
// string to integer stoi() Remember: it takes string not character
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();
 
// To compile--> g++ -std=c++0x -o output one.cpp
// To run--> ./output
double dp[305][305][305];

int main()
{ 
    fastio;
    // freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout);
    
    ll n;
    cin>>n;
    ll a[n];
    ll one=0;
    ll two=0;
    ll three=0;
    for (int i = 0; i < n; ++i)
    {
        cin>>a[i];
        if(a[i]==1){
            one++;
        }
        else if(a[i]==2){
            two++;
        }
        else{
            three++;
        }
    }

    for (int c = 0; c<=n; ++c)
    {
        for (int b = 0; b<=n; ++b)
        {
            for (int a = 0; a<=n; ++a)
            {
                ll k = a+b+c;
                if(k==0){
                    continue;
                }
                if(k>n){
                    continue;
                }
                dp[a][b][c] += (1.0 * n)/k;
                if(a){
                    dp[a][b][c] += (1.0 * a)/k * dp[a - 1][b][c];
                }
                if(b){
                    dp[a][b][c] += (1.0 * b)/k * dp[a + 1][b - 1][c];
                }
                if(c){
                    dp[a][b][c] += (1.0 * c)/k * dp[a][b + 1][c - 1]; 
                }
            }
        }
    }

    cout<<fixed<<setprecision(10)<<dp[one][two][three]<<endl;

    return 0;
}

Measured memory_bytes: 112548
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <stack>
#include <complex>

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
string s;
int x[100010];
int n;
vector<int> tree[100010];
int next_w[100010];

void make_tree(int s, int next_s, int w){  //sは親の名前、wは全体のweight
    for(int i = w-1; i >= 1;){
        if(x[i] == 1){
            tree[s].push_back(next_s);
            make_tree(next_s, next_s+1, i);
            // cout << w << " " << i << endl;
            if(w-i > 1){
                int next_s2 = next_s + i;
                make_tree(s, next_s2, w-i);
            }
            break;
        }
        i = next_w[i];
    }
}


int main(){
    cin >> s;
    n = (int)(s.length());
    // cout << n << endl;
    for(int i = 1; i <= n; i++){
        x[i] = s[i-1] - '0';
    }
    int cur = 1;
    for(int i = 2; i <= n; i++){
        next_w[i] = cur;
        if(x[i] == 1){
            cur = i;
        }
    }

    if(x[1] == 0 || x[n] == 1){
        cout << -1 << endl;
        return 0;
    }
    for(int i = 1; i < n; i++){
        if(x[i] != x[n-i]){
            cout << -1 << endl;
            return 0;
        }
    }

    make_tree(1, 2, n);
    for(int i = 1; i <= n; i++){
        for(int j = 0; j < tree[i].size(); j++){
            cout << i << " " << tree[i][j] << endl;
        }
    }


    return 0;
}



Measured memory_bytes: 12416
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <map>

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

int main(){
    int x,t;
    cin >> x >> t;
    cout << max(x-t,0) << endl;

    return 0;
}

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

int main(){
    int N, K;
    cin >> N >> K;
    vector<int> a(N,0);
    vector<int> buc(N+1,0);
    
    for(int i = 0; i < N; ++i){
        cin >> a[i];
        ++buc[a[i]];
    }
    
    sort(buc.begin(), buc.end(), greater<int>());
    
    int sum = 0;
    for(int i = K; i < N; ++i) sum += buc[i];
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
using namespace std;

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

const int inf = 1e9 + 1;
const double eps = 1e-9;
const int MAXN = 101;

int n;
int a[MAXN];
int k;
int dp[(int)1e5+1];

int main(){

    cin >> n >> k;
    for (int i = 0; i < n; i++) cin >> a[i];

    dp[0] = 0;
    for (int i = 1; i <= k; i++){
        for (int j = 0; j < n; j++){
            if (a[j] <= i && dp[i-a[j]] == 0) dp[i] = 1;
        }
        //cout << dp[i] << '\n';
    }

    if (dp[k]) cout << "First";
    else cout << "Second";

    return 0;

}

Measured memory_bytes: 640
N,D=(int(x) for x in input().split())
xy = [map(int, input().split()) for _ in range(N)]
x, y = [list(i) for i in zip(*xy)]


count=0
for i in range(N) :
 	z=x[i]**2+y[i]**2
 	if z<=D**2 :
		 count+=1
print(count)

Measured memory_bytes: 116636
#include <bits/stdc++.h>
#define BIT(n) (1LL << (n))
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPB(i, n) for (int i = 0; i < BIT(n); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORA(i, n) for (auto &&i : n)
#define FORS(i, m, n) for (int i = m; i <= n; i++)
#define DEBUG(x) cerr << #x << ": " << x << "\n"
#define DEBUG2(x, y) cerr << #x << ": " << x << " " << #y << ": " << y << "\n"
#define DEBUG3(x, y, z) cerr << #x << ": " << x << " " << #y << ": " << y << " " << #z << ": " << z << "\n"
#define PRINTALL(V)    \
  for (auto v : (V)) { \
    cerr << v << " ";  \
  }                    \
  cerr << "\n";
#define ALL(v) v.begin(), v.end()
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
#define epb emplace_back
#define int long long
#define pint pair<int, int>
#define ld long double
using namespace std;
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 (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> using vec = std::vector<T>;
template <class T> void print(const T &x) { cout << x << "\n"; }
const int MOD = 1000000007, INF = 1061109567, INF2 = INF * INF;
const double EPS = 1e-10, PI = acos(-1.0);
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
struct Edge {
  int from, to, cost;
};
signed main() {
  cin.tie(0), ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  int L;
  cin >> L;
  L--;
  int N = floor(log2(L + 1));
  vec<Edge> E;
  REP(i, N) {
    Edge e = {i, i + 1, 0};
    E.pb(e);
    e = {i, i + 1, BIT(i)};
    E.pb(e);
  }  // 最上位ビットが0の場合完成。

  REP(i, N) {
    if ((L + 1) & BIT(i)) {
      Edge e = {i, N, L - L % BIT(i + 1)};
      E.pb(e);
    }
  }

  int sizeE = E.size();
  cout << N + 1 << " " << sizeE << "\n";
  FORA(e, E) cout << 1 + e.from << " " << 1 + e.to << " " << e.cost << "\n";
}

Measured memory_bytes: 512
C=input()
flag=False

lis=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]

for item in lis:
  if flag==True:
    print(item)
    break
  else:
    if item==C:
      flag=True

Measured memory_bytes: 3060