akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;

typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
#define rrep(i, m, n) for(int (i)=(m); (i)<(n);  (i)++)
#define erep(i, m, n) for(int (i)=(m); (i)<=(n); (i)++)
#define  rep(i, n)    for(int (i)=0; (i)<(n);  (i)++)
#define rrev(i, m, n) for(int (i)=(n)-1; (i)>=(m); (i)--)
#define erev(i, m, n) for(int (i)=(n); (i)>=(m); (i)--)
#define  rev(i, n)    for(int (i)=(n)-1; (i)>=0; (i)--)
#define vrep(i, c)    for(__typeof((c).begin())i=(c).begin(); i!=(c).end(); i++)
#define  ALL(v)       (v).begin(), (v).end()
#define mp            make_pair
#define pb            push_back
template<class T1, class T2> inline void minup(T1& m, T2 x){ if(m>x) m=static_cast<T2>(x); }
template<class T1, class T2> inline void maxup(T1& m, T2 x){ if(m<x) m=static_cast<T2>(x); }

#define INF 1000000000
#define MOD 1000000007
#define EPS 1E-12

const int MAX_N = 5000;
int n;
int a[MAX_N+2];

int main()
{
  while((cin >> n) && n){
    rep(i, n) cin >> a[i+1];
    rep(i, n) a[i+2] += a[i+1];

    int res = -INF;
    rep(i, n+1) rep(j, i) maxup(res, a[i] - a[j]);

    cout << res << endl;
  }

  return 0;
}

Measured memory_bytes: 1176
#include <iostream>
#include <queue>
#include <stack>
#include <cstdio>
#include <vector>
#include <sstream>
#include <stdio.h>
#include<cstdio>

//#include<string>
//#include<cmath>
//#include<map>
//#include<cstdlib>
//#include<deque>
//#include<queue>
//#include<climits>
#include<cstring>
using namespace std;

const int N_MAX = 1000000;

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

  // table
  int** table = new int*[N];
  for(int i=0; i<N; i++){
    table[i] = new int[N];
    memset(&table[i][0], 0, N*sizeof(table[i][0]));
    // &table[i][0] can be table[i] because it only needs head address.
    
    //[..., [int, int,int], ...]
    // memset(start_addr, 0, delta_arr) fills
    // start_addr to (start_addr + delta_arr) by 0.
    // table[i] refers to the first addr of table[i],
    // for each integer to be filled by 0, size of the element
    // (not table[i]) should be given.
  }
  
  for(int i=0; i<N; i++){
    int row_num, k;
    cin >> row_num >> k;

    row_num--;
    
    for(int j=0; j<k; j++){
      int col_num;
      cin >> col_num;
      col_num--;
      table[row_num][col_num] = 1;
    }
  }

  //print table
  for(int i=0; i<N; i++){
    for(int j=0; j<N; j++){
      cout << table[i][j];
      if(j!=N-1) cout << " ";
      else cout << endl;
    }
  }
  
  for(int i=0; i<N; i++){
    delete[] table[i];
  }
  delete[] table;
  
  return 0;
}



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

int main() {
    ll N;
    cin >> N;
    ll upper = ceil(N / 1.08);
    ll lower = N / 1.08;
    if (ll(upper * 1.08) == N)
        cout << upper << endl;
    else if (ll(lower * 1.08) == N)
        cout << lower << endl;
    else
        cout << ":(" << endl;
    return 0;
}


Measured memory_bytes: 256
///"Bismillahir Rahmanir Raheem"///
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;
typedef vector<pii> vii;
typedef vector<pil> vil;
typedef vector<pli> vli;

#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz size()
#define all(a)  a.begin(), a.end()
#define mem(a, b)     memset(a, b, sizeof(a))
#define f0(i,b) for(int i=0;i<(b);i++)
#define f1(i,b) for(int i=1;i<=(b);i++)
#define f2(i,a,b) for(int i=(a);i<=(b);i++)
#define fr(i,b,a) for(int i=(b);i>=(a);i--)
#define rep(i,a,b,c) for(int i=(a);i!=(b);i+=(c))

int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};

const double PI = acos(-1.0);
const double EPS = 1e-6;
const int MOD = (int)1e9+7;
const int INF = 1e9 + 5;
const int maxn = (int)2e5+5;
const int LOGN = 20;
int main(){
    int n,k;
    cin>>n>>k;
    vector<int> dp(n+5,INF);
    int h[n+5];
    f0(i,n) cin>>h[i];
    dp[0]= 0;
    f0(i,n){
     for(int j =i+1;j<=i+k; j++){
        if(j<n){
            dp[j] = min(dp[j],dp[i]+abs(h[i]-h[j]));
        }
     }
    }
    cout<<dp[n-1]<<endl;


return 0;
}


Measured memory_bytes: 1152
import sys

n, k = map(int, input().split(" "))
d = list(map(int, input().split(" ")))

def f():
    q = []

    for i in filter(lambda x: x not in d, range(10)):
        q.append(i)

    while len(q) != 0:
        x = q.pop(0)

        if x >= n:
            print(x)
            break

        for i in filter(lambda x: x not in d, range(10)):
            q.append(x * 10 + i)

f()

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

int main(){
	long long a,b,a1,b1,x,ans = 0;
	
	cin >> a >> b >> x;
	a1 = a;
	b1 = b;
	
	if(a%x&&b%x){
		a1+=(x-a%x);
		b1-=b%x;
	}
	else if(a%x==0) b1-=b%x;
	else a1+=(x-a%x);
	
	if(a1>=a&&a1<=b&&b1>=a&&b1<=b&&a1<=b1) cout << (b1-a1)/x+1;
	else cout << 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <string>
#include <cmath>
#include <bitset>
using namespace std;
#define MOD 1000000007
#define INF 1<<30
#define LINF (ll)1<<62
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> P;
typedef vector<pair<ll, ll>> vpl;
 
int main(){
    ll n,k; cin >> n >> k;
    vl a(n);
    rep(i,n) cin >> a[i];
    sort(all(a));
    ll ans = n;
    rep(i,n){
        if(a[i]<k) ans--;
        else break;
    }
    cout << ans << endl;
}


Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace template
{
    class Program
    {
        static void Main(string[] args)
        {
            var imp = Console.ReadLine().Split(' ');
            char X = char.Parse(imp[0]);
            char Y = char.Parse(imp[1]);

            if (X < Y)
            {
                Console.Write("<");
            }
            if (X > Y)
            {
                Console.Write(">");
            }
            if (X == Y)
            {
                Console.Write("=");
            }
           
        }
    }
}

Measured memory_bytes: 13140
#include <stdio.h>
#include <math.h>

int main(){
    double x1, y1, x2, y2, distance;
    scanf("%lf %lf %lf %lf", &x1, &y1, &x2, &y2);
    distance=sqrt((pow(x2-x1, 2)+pow(y2-y1, 2)));
    printf("%f\n", distance);

    return 0;
}

Measured memory_bytes: 652
#include<stdio.h>
#include<math.h>
int main(void)
{
  int n,num,ans,i,j,keta=0;

  scanf("%d",&num);
  n = num;
  while(n>0){
    n /= 10;
    keta++;
  }
  for(i=1;i<10;i++){
    ans = 0;
    for(j=0;j<keta;j++){
      ans += i*pow(10,j);
    }
    if(ans>=num)break;
  }
  printf("%d",ans);
  return 0;
}


Measured memory_bytes: 256
<?php
fscanf(STDIN,"%d",$n);

for($i=1;$i<=$n;$i++){
	fscanf(STDIN,"%s %d",$shop,$ten);
	$arr[] = array('No' => $i,'shop' => $shop,'hyouka' => $ten);
}

foreach( $arr as $value) {
    $shop_array[]	= $value['shop'];
    $hyouka_array[]	= $value['hyouka'];
}
//print_r($arr);
array_multisort($shop_array,SORT_ASC,$hyouka_array,SORT_DESC,$arr);

//print_r($arr);
for($i=0;$i<$n;$i++){
	echo $arr[$i]['No']."\r\n";
}
?>

Measured memory_bytes: 3828
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
/*
//#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
*/

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
/*
//#if __cplusplus >= 201103L
#include <array>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
*/
using namespace std;
#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;}
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) > (b) ? (b) : (a))

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;

#define INF INT_MAX/3
#define MAX_N 1000

void solve(){
   cin.tie(0);
  ios::sync_with_stdio(false);
  string s;
  cin>>s;
  if(s[0] == 'Y' && s[1] == 'A' && s[2] == 'K' && s[3] =='I') cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}
int main(){
  solve();
  return 0;
}


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

#define for_(i,a,b) for(int i=(a);i<(b);++i)

int main() {
	int n, m;
	
	while (cin >> n >> m, n) {
		vector< vector< int > > mat(n, vector< int >(n, 0));
		
		for_(i,0,m) {
			int a, b;
			cin >> a >> b;
			--a; --b;
			mat[a][b] = mat[b][a] = 1;
		}
		
		vector< int > ans(n, 0);
		
		for_(i,0,n) {
			if (mat[0][i]) {
				ans[i] = 1;
				for_(j,0,n) if (mat[i][j]) ans[j] = 1;
			}
		}
		
		int c = accumulate(ans.begin(), ans.end(), int());
		cout << (c > 0 ? c - 1 : 0) << endl;
	}
}

Measured memory_bytes: 2124
#include <iostream>
#include <cstdio>
#include <string>
#include <cmath>
#include <algorithm>
#include <cctype>
using namespace std;

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

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <vector>
#include <cmath>
#include <algorithm>

using namespace std;

typedef long long ll;
typedef long double ld;


#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,x) for(int i=1;i<=x;i++)
#define rrep(i,x) for(int i=x-1;i>=0;i--)
#define rrep1(i,x) for(int i=x;i>0;i--)
#define sor(v) sort(v.begin(),v.end())

const ll MAX = 1000000001;

int main() {
	int n, k;
  ll tmp;
	cin >> n >> k;
  vector<ll> h;
  rep(i,n) {
    cin >> tmp;
    h.push_back(tmp);
  }
  sor(h);

  int min = MAX;
  ll diff = 0;
  rep(i, n-k+1) {
    diff = h[i+k-1] - h[i];
    if (min >= diff) min = diff;
  }
	cout << min << endl;
  return 0;
}

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

struct node{
	int num;
	node* next;
	node* prev;
};

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

	int order_num;
	char order[10];
	int val;
	node* p = (node*)malloc(sizeof(node));
	node* origin = p;
	origin->next = NULL;
	origin->prev = NULL;
	origin->num = 0;
	cin >> order_num;
	const int test = order_num;

	for(int i = 0; i < test; i++){
		cin >> order;
		//cout << i << "/" << test << ":" << order << endl;
		if(order[0] == 'i'){
			cin >> val;
			p->num = val;
			p->next = (node*)malloc(sizeof(node)); 
			p->next->prev = p;
			p->next->next = NULL;
			p->next->num = 0;
			p = p->next;
		}else if(order[6] == 'F'){
			if(p->prev == origin){
				free(origin);
				origin = p;
				p->prev = NULL;
			}else{
				p->prev = p->prev->prev;
				free(p->prev->next);
				p->prev->next = p;
			}
		}else if(order[6] == 'L'){
			origin = origin->next;
			free(origin->prev);
			origin->prev = NULL;
		}else{
			cin >> val;
			node* p2 = p;
			do{
				p2 = p2->prev;
				if(p2->num == val){
					if(p2->prev == NULL){
						origin = origin->next;
						free(origin->prev);
						origin -> prev = NULL;
					}else{
						p2->next->prev = p2->prev;
						p2->prev->next = p2->next;
						free(p2);
					}
					break;
				}
			}while(p2->prev != NULL);
		}

		
	
	}


	if(p != origin){
		p = p->prev;
		while(p->prev != NULL){
			free(p->next);
			cout << p->num << " ";
			p = p->prev;
		}
		cout << p->num << endl;
	}
	free(p);
	
	return 0;
}

Measured memory_bytes: 32460
#include <bits/stdc++.h>
using namespace std;
const double pi = 3.141592653589793;
int main(){
  
  int A,B,H,M;
  cin >> A >> B >> H >> M;
  double T;
  T=M;
  T*=11;
  T/=2;
  T+= 330*H;
  double C;
  C=A*A+B*B-2*A*B*cos(T*2*pi/360);
  C=sqrt(C);cout << std::fixed << std::setprecision(15) << C << endl;
  
}

Measured memory_bytes: 4232
import java.util.Scanner;


/* ITP1_1_C
 * class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();

        int area = a*b;
        int around = (a+b)*2;

        System.out.println(area + " " + around);
    }
}*/

/*// ITP1_1_D
class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int S = sc.nextInt();

        int h = S/3600;
        int m = (S%3600)/60;
        int s = S%60;

        System.out.println(h + ":" + m + ":" + s);
    }
}*/


// ITP1_2_A:   Small, Large, or Equal
class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();

        if(a<b){
        	System.out.println("a < b");
        }else if(a>b){
        	System.out.println("a > b");
        }else{
        	System.out.println("a == b");
        }

    }
}


Measured memory_bytes: 26120
using System;

public class Program
{
    private long N, A, B;

    public void Solve()
    {
        var sc = new Scanner();
        N = sc.NextLong();
        A = sc.NextLong();
        B = sc.NextLong();

        if ((B - A) % 2 == 0)
        {
            Console.WriteLine((B - A) / 2);
        }
        else
        {
            // 端に移動 -> 1回勝つ 2人の距離偶数

            long bb = (B - A - 1) / 2;
            if (A - 1 < N - B)
            {
                long aa = A;
                Console.WriteLine(aa + bb);
            }
            else
            {
                // b = N
                // a = A + N-B+1
                long aa = N - B + 1;
                Console.WriteLine(aa + bb);
            }
        }
    }

    public static void Main(string[] args)
    {
        new Program().Solve();
    }
}

class Scanner
{
    public Scanner()
    {
        _pos = 0;
        _line = new string[0];
    }

    const char Separator = ' ';
    private int _pos;
    private string[] _line;

    #region スペース区切りで取得

    public string Next()
    {
        if (_pos >= _line.Length)
        {
            _line = Console.ReadLine().Split(Separator);
            _pos = 0;
        }

        return _line[_pos++];
    }

    public int NextInt()
    {
        return int.Parse(Next());
    }

    public long NextLong()
    {
        return long.Parse(Next());
    }

    public double NextDouble()
    {
        return double.Parse(Next());
    }

    #endregion

    #region 型変換

    private int[] ToIntArray(string[] array)
    {
        var result = new int[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = int.Parse(array[i]);
        }

        return result;
    }

    private long[] ToLongArray(string[] array)
    {
        var result = new long[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = long.Parse(array[i]);
        }

        return result;
    }

    private double[] ToDoubleArray(string[] array)
    {
        var result = new double[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = double.Parse(array[i]);
        }

        return result;
    }

    #endregion

    #region 配列取得

    public string[] Array()
    {
        if (_pos >= _line.Length)
            _line = Console.ReadLine().Split(Separator);

        _pos = _line.Length;
        return _line;
    }

    public int[] IntArray()
    {
        return ToIntArray(Array());
    }

    public long[] LongArray()
    {
        return ToLongArray(Array());
    }

    public double[] DoubleArray()
    {
        return ToDoubleArray(Array());
    }

    #endregion
}

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

using namespace std;

int main() {
	int n;
	cin >> n;
	long long ans = 0;
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= n; j++) {
			for (int k = 1; k <= n; k++) {
				ans += gcd(i, gcd(j, k));
			}
		}
	}
	cout << ans << "\n";
	return 0;
}


Measured memory_bytes: 3640
#include <iostream>
#include <vector>
#include <stack>
using namespace std;
static const int MAX = 100000;
static const int NIL = -1;

vector<int> G[MAX];
int n;
int color[MAX];

void dfs(int v, int id)
{
    stack<int> S;
    S.push(v);
    color[v] = id;
    int u;
    while (!S.empty()) {
        u = S.top();
        S.pop();
        for (int i = 0; i < G[u].size(); i++) {
            int v = G[u][i];
            if (color[v] == NIL) {
                color[v] = id;
                S.push(v);
            }
        }
    }
}

void assign_color()
{
    int id = 1;
    for (int i = 0; i < n; i++) {
        color[i] = NIL;
    }
    for (int i = 0; i < n; i++) {
        if (color[i] == NIL) {
            dfs(i, id++);
        }
    }
}

int main(int argc, char const *argv[])
{
    int s, t, m, q;

    cin >> n >> m;
    
    for (int i = 0; i < m; i++) {
        cin >> s >> t;
        G[s].push_back(t);
        G[t].push_back(s);
    }

    assign_color();

    cin >> q;
    for (int i = 0; i < q; i++) {
        cin >> s >> t;
        if (color[s] == color[t]) {
            cout << "yes" << endl;
        } else {
            cout << "no" << endl;
        }
    }
    return 0;
}



Measured memory_bytes: 8972
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using vc = vector<char>;
using vvc = vector<vc>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define debug(x) cerr << #x << ": " << x << endl;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

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

    deque<char> dq;
    for(auto c : s) dq.emplace_back(c);

    ll q;
    cin >> q;

    ll cnt = 0;
    rep(i, q) {
        ll t;
        cin >> t;
        if(t == 1) cnt = 1 - cnt;
        else {
            ll f;
            char c;
            cin >> f >> c;
            if(f == 1) {
                if(cnt == 0) dq.emplace_front(c);
                else dq.emplace_back(c);
            }
            else {
                if(cnt == 1) dq.emplace_front(c);
                else dq.emplace_back(c);
            }
        }
    }
    if(cnt == 1) {
        while(!dq.empty()) {
            cout << dq.back();
            dq.pop_back();
        }
    }
    else {
        while(!dq.empty()) {
            cout << dq.front();
            dq.pop_front();
        }
    }
}


Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int c,d,e,f=0,i,j,k,l;
    map<string,int>a;
    string b;
    cin>>c;
    for(i=0; i<c; i++)
    {
        cin>>b;
        a[b]++;
    }
    map<string,int>::iterator x;
    for(x=a.begin(); x!=a.end(); x++)
    {
        if(x->second!=0)
            f++;
    }
    printf("%d\n",f);
    return 0;
}


Measured memory_bytes: 19352
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define pb push_back

int main(){
    int x;
    cin >> x;
    int max=1;
    for(int i=1;i<x;i++){
        for(int k=2;k<=x;k++){
            int y=pow(i,k);
            if(y>max&&y<=x){
                max=y;
            }
        }
    }
    cout << max << endl;
    return 0;
}

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

int main() {

    int A, B;
    cin >> A >> B;

    int cnt = 0;

    for (int i = A; i <= B; ++i) {
        if ((i%10 == i/10000) and ((i/10)%10 == (i/1000)%10)) {
            ++cnt;
        }
    }

    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 3600
n = int(input())
q = list(map(int, input().split()))
m = int(input())
d = [list(map(int, input().split())) for _ in range(m)]
#print(n,q,m,d)

for i in range(m):
    x = q[:]
    x.pop((d[i][0])-1)
    x.insert((d[i][0]-1),d[i][1])
    print(sum(x))


Measured memory_bytes: 3060
#include<stdio.h>
#include<string.h>
int m[6][10][10];
int h,w,c,d[]={0,1,0,-1,0};
int C(int x,int y,int s,int f,int t)
{
	int&r=m[s][y][x],i,a=1;
	if(r-f)return 0;
	r=t;
	for(i=0;i<4;++i)a+=C(x+d[i],y+d[i+1],s,f,t);
	return a;
}
int F(int s)
{
	if(s>=5)return C(1,1,s,c,0);
	int r=0,t,i,p=m[s][1][1];
	for(i=1;i<=6;++i)
	{
		if(p==i)continue;
		memcpy(m[s+1],m[s],sizeof(m[0]));
		C(1,1,s+1,p,i);
		t=F(s+1);
		r=(r>t?r:t);
	}
	return r;
}
int main()
{
	int x,y;
	while(scanf("%d%d%d",&h,&w,&c),h)
	{
		memset(m,0,sizeof(m));
		for(y=1;y<=h;++y)for(x=1;x<=w;++x)scanf("%d",&m[0][y][x]);
		printf("%d\n",F(0));
	}
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vpii = vector<pair<int,int>>;
using vpll = vector<pair<ll,ll>>;
using vi = vector<int>;
#define rep(i,n) for(int i=0;i<(int) n;i++)
#define rep1(i,m,n) for(int i=(int) m;i<(int) n;i++)
#define fix(n) cout << fixed << setprecision((int)n)

void absll(ll &x) {
    if(x>=0) return ;
    else x=-x; return;
}

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;
}

const ll INF = 1LL << 60;

int N;

//DPテーブル
vector<ll> dp(100010);

int main() {
    string s;
    cin>>s;
    rep(i,s.size()){
        if(s.at(i)=='?') {
            s.at(i)='D';
        }
    }
    cout<<s<<endl;
}

Measured memory_bytes: 4452
#ABC 060 B,Choose Integers

a, b, c = map(int, input().split())

x = 0

for i in range(b):
    x += a
    if x % b == c:
        print("YES")
        break
else:
    print("NO")
        
#breakでループを抜けなかったときにのみ、elseが実行される

Measured memory_bytes: 3060
N = int(input())
h = list(map(int, input().split()))

ans = 0
i = 0
while i < N:
    while h[i] == 0:
        i += 1
        if i == N: break
    j = i
    if i == N: break
    while h[j] > 0:
        h[j] -= 1
        j += 1
        if j == N: break
    ans += 1

print(ans)


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

const ll mod=1000000007;
const int dx[]={0,1,0,-1};
const int dy[]={1,0,-1,0};

int main(){
    string s;
    cin>>s;
    rep(i,3){
        if(s[i]=='1')s[i]='9';
        else if(s[i]=='9')s[i]='1';
    }
    cout<<s<<endl;
}

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

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

    long long w[N], v[N];
    for(int i = 0; i < N; i++){
        cin >> w[i] >> v[i];
    }

    long long dp[N + 1][W + 1];
    for(int i = 0; i <= N; i++){
        for(int j  = 0; j <= W; j++){
            dp[i][j] = 0;
        }
    }

    for(int i = N - 1; i >= 0; i--){
        for(int j = 0; j <= W; j++){
            if(j < w[i]){
                dp[i][j] = dp[i + 1][j];
            }else{
                dp[i][j] = max(dp[i + 1][j], dp[i + 1][j - w[i]] + v[i]);
            }
        }
    }

    cout << dp[0][W] << endl;
}

Measured memory_bytes: 79104
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<cstring>
#include<map>
#include<vector>
#include<queue>
#include<climits>
#include<set>
#include<utility>
using namespace std;
typedef long long int ll;
const ll MOD=1e9+7;

int main(){

  int a[3];
  cin >> a[0] >> a[1] >> a[2];
  sort(a, a+3);
  cout << a[0]+a[1] << endl;
  

	return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cmath>
#include<bitset>
#include<iostream>
#include<algorithm>
#include<string>
#include<utility>
#include<tuple>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<numeric>
#include<functional>
#include<iomanip>
#include<random>

#define IOS ios::sync_with_stdio(false),cin.tie(0)
#define REP(i,n) for(int i = 0;i < n;i++)
#define FOR(i,a,b) for(int i = a;i < b;i++)
#define MEM(a,b) memset(a,b,sizeof(a))
#define ALL(x) (x).begin(),(x).end()
#define LMAX 9223372036854775807
#define LMIN -9223372036854775808

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ull, ull> UP;
typedef tuple<int, int, int> T;

struct UnionFind {
	vector<int> data;
	UnionFind(int size) : data(size, -1) {}
	void unionSet(int x, int y) {
		x = root(x), y = root(y);
		if (x != y) {
			if (data[y] < data[x])swap(x, y);
			data[x] += data[y]; data[y] = x;
		}
	}
	bool findSet(int x, int y) {
		return root(x) == root(y);
	}
	int root(int x) {
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	int size(int x) {
		return -data[root(x)];
	}
};

ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	int k = a % b;
	if (k == 1)return 1;
	if (k == 0)return b;
	int ans = gcd(b, k);
	return ans;
}
ll digisum(ll a) {
	int sum = 0;
	while (a) {
		sum += a % 10;
		a /= 10;
	}
	return sum;
}
ll countpow(ll a, ll b) {
	int ans = 0;
	if (b == 0)return -1;
	while (1) {
		if (a % b == 0) {
			a /= b;
			ans++;
		}
		else break;
	}
	return ans;
}
int to_num(char c) {
	if (c >= '0' && c <= '9')return (c - '0');
	else return -1;
}

int main() {
	int n;
	string s;
	cin >> n >> s;
	int ans = 0,tmp = 0;

	REP(i,s.size()) {
		if (s[i] == 'I')tmp++;
		else tmp--;
		if (tmp > ans)ans = tmp;
	}
	cout << ans << endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(int (i) = (s);(i) <= (e);(i)++)

int A,B;

int cal(int num){
    string k = to_string(num);
    string s = k;
    reverse(s.begin(),s.end());
    return k == s;
}

int main(){
    cin >> A >> B;
    int ans = 0;
    rep(i,A,B){
        ans += cal(i);
    }

    cout << ans << endl;

}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip> // << fixed << precision(10)
#include <vector>
#include <string>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
using namespace std;

#define FOR(i,s,t) for(int i=s;i<t;i++)
#define REP(i,n) FOR(i,0,n)
#define PRINT(s) cout << s << "\n"
#define SORT(A) sort(A.begin(), A.end())
#define EACHPRINT(A, T) for_each(begin(A), end(A), [&](T i){ cout << i << " "; });cout << "\n"
#define MOD 1000000007

typedef long lint;
typedef pair<lint, lint> P;
bool lessPair(const P& l, const P& r){return l.second < r.second;}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    lint N; cin >> N;
    lint M; cin >> M;
    vector<lint> X(M);
    vector<lint> Y(M-1);

    REP(i, M) {
      lint x; cin >> x;
      X[i] = x;
    }

    SORT(X);

    REP(i, M-1) {
      lint x; cin >> x;
      Y[i] = X[i+1] - X[i];
    }

    SORT(Y);

    lint res = 0;

    REP(i, M-N) {
      res += Y[i];
    }
    cout << res << "\n";

    return 0;
}


Measured memory_bytes: 1792
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<queue>
#include<cmath>
#include<cctype>
#include<stack>
#include<map>
#include<string>
#include<sstream>
#include<set>
#include<list>
#define ll long long
#define ull unsigned long long
#define op std::ios::sync_with_stdio(false); std::cin.tie(0);
const int INF = 0x3f3f3f3f;
const int maxn = (100 + 10);
const int mod = (1e9+7);
int cube[10][5];
int main()
{
    int n;
    scanf("%d",&n);
    printf("%.10f\n",((n+1)/2)*1.0/n);
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
    int a,b,k;
    cin >> a>> b >> k;
    for(int i=1;i<=k;i++){
        if(i%2==1){
            if(a%2==1){
                b+=a/2;
               a=(a-1)/2;
            }
            else{
               
                b+=a/2;
               a/=2;
            }
        }
        else{
            if(b%2==1){
                
                a+=b/2;
              b=(b-1)/2;
            }
            else{
               
                a+=b/2;
              
               b/=2;
            }
        }
  
    }
    cout << a << " " << b << endl;

}

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

vector<vector<int>> G(100000);
vector<int> v(100000, -1);
void dfs(int from, const vector<int> &c, int &p) {
    if (v.at(from) != -1) return;

    v.at(from) = c.at(p);
    p++;
    for (int i = 0; i < (int)G.at(from).size(); i++) {
        dfs(G.at(from).at(i), c, p);
    }
}

int main() {
    int n;
    cin >> n;
    for (int i = 0; i < n - 1; i++) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        G.at(a).push_back(b);
        G.at(b).push_back(a);
    }
    vector<int> c(n);
    for (int i = 0; i < n; i++) {
        cin >> c.at(i);
    }
    sort(c.begin(), c.end());
    reverse(c.begin(), c.end());
    
    int p = 0;
    dfs(0, c, p);

    int sum = 0;
    for (int i = 1; i < n; i++) {
        sum += v.at(i);
    }
    cout << sum << endl;
    for (int i = 0; i < n; i++) {
        cout << v.at(i) << " ";
    }
    cout << endl;
}  

Measured memory_bytes: 3968
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdio>
using namespace std;
 
int main() {
int n,m;
cin >> n >>m;
int arr[m],p=0;
for(int i=0;i<m;i++)
{
    cin >> arr[i];
    p+=arr[i];
}
if(p>n)
{
    cout << -1 << endl;
}
else
{
    p=n-p;
    cout << p<<endl;
}

}

Measured memory_bytes: 3676
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
#define all(x) (x).begin(), (x).end()
ll inf = LLONG_MAX;
long double pi = M_PI;
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}

//繰り返し2乗法 mod p
ll repsq(ll a, ll n, ll p) {
    if (n == 0) return 1;
    if (n % 2 == 0) {
        ll x = repsq(a, n / 2, p);
        return x * x % p;
    }
    return (a % p) * repsq(a, n - 1, p) % p;
}

//二項係数 mod p
ll modinv(ll n, ll p) {
  ll a = p, u = 1, v = 0;
  while (a) {
    ll t = n / a;
    n -= t * a;
    swap(n, a);
    u -= t * v;
    swap(u, v);
  }
  u %= p;
  if (u < 0) u += p;
  return u;
}

ll ncr(ll n, ll r, ll p) {
  r = min(r, n - r);
  ll ans = 1;
  for (ll i = 0; i < r; i++) {
    ans *= (n - i) % p;
    ans %= p;
  }
  for (ll i = 0; i < r; i++) {
    ans *= modinv(i + 1, p);
    ans %= p;
  }
  return ans;
}

int main() {
  ll n, a, b, p = 1000000007;
  cin >> n >> a >> b;

  ll ans = repsq(2, n, p) - 1;
  ll aa = ncr(n, a, p);
  ll bb = ncr(n, b, p);
  ans -= aa;
  if (ans < 0) ans += p;
  ans -= bb;
  if (ans < 0) ans += p;
  cout << ans << endl;
}

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

int main(){
    ll n,x;
    cin >> n >> x;
    ll a[n];
    for(int i=0;i<n;i++){
        cin >> a[i];
    }
    ll ans = 0;
    for(int i=0;i<n-1;i++){
        ll sum = a[i] + a[i+1];
        if(sum <= x){
            continue;
        }
        else{
            if(sum-x <= a[i+1]){
                a[i+1] -= sum-x;
                ans += sum-x;
            }
            else{
                a[i+1] =0;
                a[i] -= sum-x-a[i+1];
                ans += sum-x;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
  int N;
  cin >> N;
  long long sum = 0;
  for(int i = 1; i<= N; i++){
    if(i % 3 == 0 || i % 5 == 0) continue;
    sum += i;
  }
  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 3604
n = gets.to_i
s = gets.chomp.split("")

#p s

ctn = 1
i = 0
while i <= s.length-2
  if s[i] != s[i+1]
    ctn += 1
  end
  #p "#{s[i]}  #{s[i+1]}"
  i += 1
end

puts ctn

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

using namespace std;

typedef long long ll;

const ll MOD = 1e9 + 7;

ll get(ll x, ll y) {
  ll res = 1ll;
  while(y) {
    if(y & 1) {
      res = (res * x) % MOD; 
    }
    y >>= 1;
    x = (x * x) % MOD;
  }
  return res;
}

void solve() {
  int n, k; n = 3; cin >> k;
  vector <ll> cur(k + 1);
  for(int i = 1; i <= k; i++) {
    cur[i] = get((k / i), n);
  }
  for(int i = k; i >= 1; i--) {
    for(int j = i + i; j <= k; j += i) {
      cur[i] -= cur[j];
      cur[i] %= MOD;
      if(cur[i] < 0) cur[i] += MOD;
    }
  }
  ll ans = 0;
  for(ll i = 1; i <= k; i++) {
    //cout << cur[i] << '\n';
    ans = (ans + i * cur[i]) % MOD;
  }
  cout << ans << '\n';
}

int main() {
  int t; t = 1;
  for(int cs = 1; cs <= t; cs++) {
    solve();
  }
}


Measured memory_bytes: 3632
/*
	Code written by Talant I.D.
*/

#include <bits/stdc++.h> 

using namespace std;

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

#define precision(n) fixed << setprecision(n)
#define pb push_back
#define lb lower_bound 
#define ub upper_bound 
#define mp make_pair
#define mt make_tuple
#define mod int(1e9+7)
#define eps double(1e-9)
#define PI 2*acos(0.0)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define do_not_disturb ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define curMod ll(998244353)
#define fr first
#define sc second

inline bool isvowel(char ch){
	ch = tolower(ch);
	return (ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u' || ch == 'y');
}

inline bool isprime(int n){
	if(n < 2 || (n % 2 == 0 && n != 2))
		return false;
	for(int i = 3; i*i <= n; i += 2)
		if(n%i == 0) return false;
	return true;
}

int main(){
	do_not_disturb
	mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	
	double mx = 0;
	int n, k, i;
	cin >> n >> k;
	vector <double> v(n);
	
	for(auto &to : v){
		cin >> to;
		to = (to*(to+1)/2)/to;
	}
	
	double sum = 0;
	for(i = 0; i < k; i++){
		sum += v[i];
	}
	mx = max(mx, sum);
	for(i = k; i < n; i++){
		sum -= v[i-k];
		sum += v[i];
		mx = max(mx, sum);
	}
	cout << precision(10) << mx;
	
	return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <utility>
#include <stdint.h>
#include <queue>
#include <map>

using namespace std;

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

  unsigned c[10][10];
  for (int ii=0; ii<10; ++ii)
    for (int jj=0; jj<10; ++jj)
      cin >> c[ii][jj];

  short A[H][W];
  for (int h=0; h<H; ++h)
    for (int w=0; w<W; ++w)
      cin >> A[h][w];

  unsigned X[10];
  for (auto& x : X)
    x = UINT32_MAX;
  
  multimap<unsigned, unsigned> Q;
  Q.emplace(0,1);
  while(Q.size()) {
    unsigned cost = Q.begin()->first;
    unsigned point = Q.begin()->second;
    Q.erase(Q.begin());
    if (X[point] > cost)
      X[point] = cost;
    else
      continue;
    for (int next=0; next<10; ++next) {
      unsigned cost_next = cost + c[next][point];
      if (X[next] > cost_next)
	Q.emplace(cost_next, next);
    }
  }

  int ans = 0;
  for (int h=0; h<H; ++h)
    for (int w=0; w<W; ++w) {
      if (A[h][w]==-1)
	continue;
      ans += X[A[h][w]];
    }

  cout << ans << endl;

  return 0;
}


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

int main(){
  while(true){
    int n;
    cin >> n;
    if(n == 0)
      break;

    vector<string> w(n);
    for(int i=0; i<n; i++)
      cin >> w[i];
         
    int tanku[5] = {5, 7, 5, 7, 7};
    bool judge = false;
    for(int i=0; i<n; i++){
      int place = i;
      for(int j=0; j<5; j++){
	int sum = 0;
	while(place <= n-1){
	  sum += w[place].size();
	  place++;
	  if(j == 4 && sum == tanku[j]){
	    cout << i+1 << endl;
	    judge = true;
	    break;
	  }
	  if(sum >= tanku[j])
	    break;
	}
	if(sum > tanku[j])
	  break;
      }
      if(judge == true)
	break;
    }
  }
  
  return 0;
}

Measured memory_bytes: 3124
#include <iostream>

int main() {
  char c11;
  char c12;
  char c13;
  char c21;
  char c22;
  char c23;
  char c31;
  char c32;
  char c33;
  
  std::cin >> c11 >> c12 >> c13;
  std::cin >> c21 >> c22 >> c23;
  std::cin >> c31 >> c32 >> c33;
  
  std::cout << c11 << c22 << c33 << std::endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string.h>
#include <set>
#include <map>
#include <unordered_map>
#include <assert.h>
#include <algorithm>
#include <queue>
#include <bitset>
#include <stack>
#include <chrono>
#include <random>
#define all(x) x.begin(),x.end()
#define ff first
#define ss second
#define ll long long
#define INF 1000000000000000000
#define MOD 998244353
#define rnd mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define uid uniform_int_distribution <int>
using namespace std;
// Read the question carefully and see all the given sample tests
// Think about the correctness before implementing

int main() {
	int n;
	cin >> n;
	vector <int> A(n + 1);
	for (int i = 1; i <= n; i++) {
		cin >> A[i];
	}
	//vector <int> pmx(n + 1), smx(n + 1);
	//for (int i = 1; i <= n; i++) {
		//ll sum = 0;
		//for (int j = i; j <= n; j += 2) {
			//pmx[j] = max(A[j], sum + A[j]);
			//sum = pmx[j];
		//}
	//}
	//for (int i = n; i >= 1; i--) {
		//ll sum = 0;
		//for (int j = i; j >= 1; j -= 2) {
			//smx[j] = max(A[j], sum + A[j]);
			//sum = smx[j];
		//}
	//}
	ll mx = -INF;
	int pos = -1;
	vector <int> nxt(n + 1);
	vector <ll> dp(n + 1);
	for (int i = n; i >= 1; i--) {
		dp[i] = A[i];
		nxt[i] = i;
		for (int j = i + 2; j <= n; j += 2) {
			if(dp[i] < A[i] + dp[j]) {
				dp[i] = A[i] + dp[j];
				nxt[i] = j;
			}
		}
		if(mx < dp[i]) {
			mx = dp[i];
			pos = i;
		}
	}
	cout << mx << "\n";
	int sz = n;
	vector <int> mv;
	for (int i = 1; i < pos; i++) {
		mv.push_back(1);
		sz--;
	}
	while(nxt[pos] != pos) {
		int cnt = (nxt[pos] - pos) / 2 - 1;
		while(cnt--) {
			mv.push_back(3);
			sz -= 2;
		}
		mv.push_back(2);
		sz -= 2;
		pos = nxt[pos];
	}
	for (int i = n; i > pos; i--) {
		mv.push_back(sz);
		sz--;
	}
	cout << (int) mv.size() << "\n";
	for (auto g : mv) {
		cout << g << "\n";
	}
}


Measured memory_bytes: 256
import numpy as np

def calculate_num_boss(num_person, boss):
    boss_count = np.zeros([num_person])
    result, num = np.unique(boss, return_counts=True)
    for idx in range(result.shape[0]):
        ids = result[idx]
        boss_count[ids-1] = num[idx]

    return boss_count


if __name__ == "__main__":
    num_person = int(input().split()[0])
    bosses = np.array([int(i) for i in input().split()])
    count = calculate_num_boss(num_person, bosses)
    for i in count:
        print(int(i))

Measured memory_bytes: 50820
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<queue>
#include<vector>
#include<ctime>
#include<map>
#include<bitset>
#include<set>
#define LL long long
#define mp(x,y) make_pair(x,y)
#define pll pair<long long,long long>
#define pii pair<int,int>
using namespace std;
inline LL read()
{
	LL f=1,x=0;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
int stack[20];
inline void write(int x)
{
	if(x<0){putchar('-');x=-x;}
    if(!x){putchar('0');return;}
    int top=0;
    while(x)stack[++top]=x%10,x/=10;
    while(top)putchar(stack[top--]+'0');
}
inline void pr1(int x){write(x);putchar(' ');}
inline void pr2(int x){write(x);putchar('\n');}
const int MAXN=105;
char ch[MAXN];
int r,b;
int main()
{	int len=read();
	scanf("%s",ch+1);
	for(int i=1;i<=len;i++)
	{
		if(ch[i]=='R')r++;
		else b++;
	}
	if(r>b)puts("Yes");
	else puts("No");
}



Measured memory_bytes: 128
N,M,R = map(int,input().split())
rs = list(map(int,input().split()))
ABC = [tuple(map(int,input().split())) for i in range(M)]

INF = float('inf')
d = [[INF]*N for _ in range(N)]
for a,b,c in ABC:
    a,b = a-1,b-1
    d[a][b] = d[b][a] = c
for i in range(N):
    d[i][i] = 0

for k in range(N):
    for i in range(N):
        for j in range(N):
            d[i][j] = min(d[i][j], d[i][k] + d[k][j])

ans = INF
import itertools
for ptn in itertools.permutations(rs):
    tmp = 0
    for a,b in zip(ptn,ptn[1:]):
        a,b = a-1,b-1
        tmp += d[a][b]
    ans = min(ans, tmp)
print(ans)

Measured memory_bytes: 72152
#include <stdio.h>

int main(void)
{
	int n,a[1000],i;
	scanf("%d",&n);
	for(i=0 ; i<n ; i++)
		scanf("%d",&a[i]);
	for(i=n-1 ; i>=0 ; i--){
		printf("%d",a[i]);
		if(i>0)printf(" ");else printf("\n");
	}
	return 0;
}

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

int main(){
    int n; cin >> n;
    int a[n];
    for(int i = 0; i < n; i++) {
        cin >> a[i];
    }
    sort(a, a+n);
    int ans = 0;
    int i = 0;
    while(i < n){
        int c = 1;
        int j;
        for(j = 0; a[i+j] == a[i]; j++){
            if(c > a[i]){
                ans++;
            }
            if(a[i+j] != a[i]) break;
            c++;
        }
        if(c-1 < a[i]) ans += c-1;
        i += j;
    }
    cout << ans << endl;
}

Measured memory_bytes: 640
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    x,a,b=INTM()
    if a>=b:
        print('delicious')
    elif x+a>=b:
        print('safe')
    else:
        print('dangerous')
if __name__ == '__main__':
    do()

Measured memory_bytes: 3064
import java.util.*;
public class Main {
    public static void main(String[] args) throws Exception {
        Scanner stdIn = new Scanner(System.in);
        int N = stdIn.nextInt();
        int M = stdIn.nextInt();

        int[] k = new int[11];
        int[] s = new int[11];
        int[] p = new int[11];
        for(int i = 1; i <= M; i++) {
            k[i] = stdIn.nextInt();
            for(int j = 1; j <= k[i]; j++) {
                // s={1,2}を「11」、s={2}を「10」、s={1,3}を「101」に変換する
                // 2進数表記をフラグに見立てている
                s[i] |= 1 << (stdIn.nextInt() - 1);
                // 「<<」はシフト演算子
                // 「1<<0」は2進数「1」、「1<<1」は2進数「10」、「1<<2」は2進数「100」
                // 「|=」は論理演算子
                // 「001 | 101」は「001」、「111 | 010」は「010」
            }
        }
        for(int i = 1; i <= M; i++) {
            p[i] = stdIn.nextInt();
        }

        int cnt = 0;
        // スイッチのオン・オフの組み合わせは2のN乗個ある
        // すべてについて網羅的に調べる
        for(int i = 0; i < Math.pow(2, N); i++) {
            boolean lightAll = true;
            for(int j = 1; j <= M; j++) {
                // オンのスイッチの個数を2で割った余りがpに等しいかどうか
                lightAll &= Integer.bitCount(i & s[j]) % 2 == p[j];
                // iはスイッチオン・オフの組み合わせを表す
                // i=0(10進数)=00(2進数)、i=1(10)=01(2)、i=2(10)=10(2)、i=3(10)=11(2)
                // s[j]は電球jにつながっているスイッチを表す
                // スイッチ{1,2}がつながっているならs[j]=11(2進数)=3(10進数)
                // 「i & s[j]」は電球jにつながるスイッチのうちオンのものを表す
                // bitCountは2進数表記の「1」の個数、つまりオンのスイッチの個数を返す
            }
            if(lightAll) {
                cnt++;
            }
        }
        System.out.println(cnt);
    }
}

Measured memory_bytes: 23764
#include<bits/stdc++.h>
using namespace std;
int n,m,ans;
vector<int>t[100009];
priority_queue<int>q;
int main() {
	scanf("%d%d",&n,&m);
	for(int i=0;i<n;i++) {
		int a,b;
		scanf("%d%d",&a,&b);
		t[a].push_back(b);
	}
	for(int i=1;i<=m;i++) {
		for(int j=0;j<t[i].size();j++) q.push(t[i][j]);
		if(!q.empty()) {
			ans+=q.top();
			q.pop();
		}
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 5632
from bisect import bisect_left
N,M = map(int,input().split())
PtoY = [[] for n in range(N)]
check = []
for m in range(M):
    P,Y = map(int,input().split())
    PtoY[P-1].append(Y)
    check.append([P,Y])
for n in range(N):
    PtoY[n].sort()
for m in range(M):
    p,y = check[m][0],check[m][1]
    a = bisect_left(PtoY[p-1],y)+1
    string = str(p).zfill(6) + str(a).zfill(6)
    print(string)


Measured memory_bytes: 32804
#include <iostream>
using namespace std;
#define MAX 100000

int parent(int i) { return i / 2; }
int left(int i) { return 2 * i; }
int right(int i) { return 2 * i + 1; }

int main(int argc, char const *argv[])
{
    int H, i, A[MAX + 1];

    cin >> H;
    for (i = 1; i <= H; i++) cin >> A[i];

    for (i = 1; i <= H; i++) {
        cout << "node " << i << ": key = " << A[i] << ", ";
        if (parent(i) >= 1) cout << "parent key = " << A[parent(i)] << ", ";
        if (left(i) <= H) cout << "left key = " << A[left(i)] << ", ";
        if (right(i) <= H) cout << "right key = " << A[right(i)] << ", ";
        cout << endl;
    }

    return 0;
}




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

static const int FLOORS = 3;
static const int BUILDINGS = 4;
static const int ROOMS = 10;

class Building {
public:
    vector< vector<int> > build;
    Building() {
        for(int i=0; i < FLOORS; i++) {
            vector<int> tmp;
            for(int j=0; j < ROOMS; j++) {
                tmp.push_back(0);
            }
            build.push_back(tmp);
        }
    }

    void printMembers() {
        for(int i=0; i < build.size(); i++) {
            for(int j=0; j < build[i].size(); j ++) {
                cout << " " << build[i][j];
            }
            cout << endl;
        }
    }
};

int main(void) {
    int N, b, f, r, v;
    vector<Building> houses;
    for(int i=0; i < BUILDINGS; i++) {
        houses.push_back(Building());
    }

    cin >> N;
    while(N-- > 0) {
        cin >> b >> f >> r >> v;
        houses[b-1].build[f-1][r-1] += v;
    }

    for(int i=0; i<houses.size(); i++) {
        if(i != 0) cout << "####################" << endl;
        houses[i].printMembers();
    }

    return 0;
}

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

int main()
{
    double h,m;
    int s,S;
    cin >> S;
    s=S%60;
    m=((S-s)/60)%60;
    h=((S-((60*m)+s))/3600);
    cout << h << ":" << m << ":" << s << endl;

    return 0;
}



Measured memory_bytes: 3244
#include <iostream>
    using namespace std;
     
     
     
    int main() {
    	string s ;
    	cin >> s ;
    	
    	int N;
    	N = s.size();
     
    	bool hantei1 = true;
    	for (int i = 0; i < N; i++) {
    		if (s[i] != s[N - 1 - i])hantei1 = false;
    	}
     
    	int NN = (N - 1) / 2;
    	bool hantei2 = true;
    	for (int i = 0; i < NN; i++) {
    		if (s[i] != s[NN - 1 - i])hantei2 = false;
    	}
     
    	
     
    	if (hantei1 == true && hantei2 == true )cout << "Yes" << endl;
    	else cout << "No" << endl;
    }

Measured memory_bytes: 256
import java.util.Scanner;
class Main{
    public static void main(String[] args) {
        Scanner scn=new Scanner(System.in);
        String a = scn.next();
        String b = scn.next();
        String answer = "No";
        int num=Integer.parseInt(a+b);
        for(int i=1;i*i<=num;i++){
            if(num==i*i){
                answer = "Yes";
                break;
            }
        }
        System.out.println(answer);
    }
}


Measured memory_bytes: 23124