akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <utility>
#include <tuple>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cstring>
#include <cmath>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

const int MAX = 310;
double dp[MAX][MAX][MAX];
double n;
double dfs(int c1, int c2, int c3) {
  if (dp[c1][c2][c3] >= 0)
    return dp[c1][c2][c3];
  double res = 0;
  if (c1)
    res += dfs(c1-1, c2, c3)*c1/n; //寿司が1個の皿を選ぶ期待値
  if (c2)
    res += dfs(c1+1, c2-1, c3)*c2/n; //寿司が2個の皿を選ぶ期待値
  if (c3)
    res += dfs(c1, c2+1, c3-1)*c3/n; //寿司が3個の皿を選ぶ期待値
  res++; //どの皿を選んでも必ず1回操作する
  res /= 1-(n-c1-c2-c3)/n; //寿司が0個の皿を選ぶ期待値はdp[c1][c2][c3]*(n-c1-c2-c3)/n -> 式変形してdp[c1][c2][c3]を消す
  return dp[c1][c2][c3] = res;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  vector<int> a(n);
  int num[3] = {};
  rep(i, n) {
    cin >> a[i];
    num[a[i]-1]++;
  }
  memset(dp, -1, sizeof(dp));
  dp[0][0][0] = 0;
  double ans = dfs(num[0], num[1], num[2]);
  cout << fixed << setprecision(9) << ans << endl;
  return 0;
}

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

#define all(v) (v).begin(), (v).end()
#define sortv(v) sort(all(v))
#define uniqv(v) (v).erase(unique(all(v)), (v).end())
#define pb push_back
#define FI first
#define SE second
#define lb lower_bound
#define ub upper_bound
#define mp make_pair
#define test 1
#define TEST if(test)

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;

const int MOD = 1000000007; // 998244353
const int INF = 2e9;
const ll INFLL = 1e18;
const int MAX_N = 1;

int M, D;

int ans;

int main(){
	cin>>M>>D;
	for(int i=20; i<=D; i++){
		if((i/10)<2 || (i%10)<2)	continue;
		int k = (i/10) * (i%10);
		if(k!=0 && k<=M){
			ans++;
		}
	}
	cout<<ans;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <cmath>
#include <vector>
#define ll long long
#define si(n) scanf("%d",&n)
#define sl(n) scanf("%lld",&n)
#define pi(n) prllf("%d",n)
#define pl(n) prllf("%d",n)
using namespace std;



int main(){
  int n;
  cin>>n;
  int count = 0;
  ll arr[n];
  for(int i=0;i<n;i++){
    ll a;
    cin>>a;
    if(a%2==0){
    a = a>>1;
    count++;
    while(a%2==0){
      count++;
      a = a>>1;
    }
  }
  }
  cout<<count;
}


Measured memory_bytes: 256
o=input()
e=input()
s=""
if len(o)==len(e):
    for i in range(len(o)):
        s+=o[i]
        s+=e[i]
else:
    for j in range(len(e)):
        s+=o[j]
        s+=e[j]
    s+=o[len(e)]
print(s)

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

int main(){
  int n,k,s;
  cin >> n >> k >> s;
  for(int i=0;i<k;i++) cout << s << ' ';
  if(s!=1) s--;
  else s++;
  for(int i=k;i<n;i++) cout << s <<' ';
}


Measured memory_bytes: 1280
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cout<<*i<<" "; cout<<endl; }
inline bool valid(int x, int y, int W, int H){ return (x >= 0 && y >= 0 && x < W && y < H); }

typedef long long ll;
const int INF = 100000000;
const double EPS = 1e-8;
const int MOD = 1000000007;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
struct edge{
  int u, v, d, c;
  edge(int u, int v, int d, int c) : 
    u(u), v(v), d(d), c(c) {}
  bool operator < (const edge& e) const {
    if(d != e.d) return d > e.d;
    else return c > e.c;
  }
};
typedef vector<edge> edges;

int main(){
  int N, M;
  while(cin>>N>>M && N){
    vector<edges> g(N);
    REP(i, M){
      int u, v, d, c;
      cin>>u>>v>>d>>c;
      u--, v--;
      g[u].push_back(edge(u, v, d, c));
      g[v].push_back(edge(v, u, d, c));
    }
    priority_queue<edge> que;
    int ans = 0;
    vector<bool> used(N);
    vector<pair<int, int> > mindist(N, make_pair(INF, INF));
    used[0] = true;
    FORIT(it, g[0]) que.push(*it);
    while(!que.empty()){
      edge e = que.top(); que.pop();
      if(used[e.v]) continue;
      //printf("edge(%d, %d, %d, %d)\n", e.u, e.v, e.d, e.c);
      ans += e.c;
      used[e.v] = true;
      FORIT(it, g[e.v])if(!used[it->v] && mindist[it->v] > make_pair(it->d + e.d, it->c)) {
        que.push(edge(it->u, it->v, it->d + e.d, it->c));
        mindist[it->v] = make_pair(it->d + e.d, it->c);
      }
    }
    cout<<ans<<endl;
  }
  return 0;
}

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

int main(){
  int a, b;

  while(cin >> a >> b){
    if(a + b == 0){
      cout << 1 << endl;
    }
    else{
      cout << (int)floor(log10(a + b)) + 1 << endl;
    }
  }
}

Measured memory_bytes: 1204
point = [0, 0]
n = int(input())
for _ in range(n):
    cards = input().split()
    if cards[0] > cards[1]:
        point[0] += 3
    elif cards[0] < cards[1]:
        point[1] += 3
    else:
        point = [n + 1 for n in point]
print(*point)

Measured memory_bytes: 7696
#include<iostream>
using namespace std;
 
int count(int n,int i,char* str);
 
int main()
{
  int n,ans;
  char str[300000];
  int W[300000];
  int E[300000];
  int tmp;
  cin>>n;
  cin>>str;
 
  ans = n;
  
  tmp=0;
  
  for(int i = 0 ; i <= n ;i++)
  {
    W[i] = tmp;
    if(str[i]=='W')
    {
      tmp++;
    }   
  }

  tmp = 0;

  for(int i = n-1 ; i >= 0 ;i--)
  {
    E[i] = tmp;  
    if(str[i]=='E')
    {
      tmp++;
    }
  }

  for(int i = 0  ; i <= n  ;i++)
  {
    {
      if(ans>(E[i]+W[i]))
      {
        ans = (E[i]+W[i]);
      }  
    }
  }
  
    
  cout<<ans<<endl;
  
  return 0;
}

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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)    FOR (i,0,n)
#define ALL(f,x,...) ([&](decltype((x)) ALL) {                          \
            return (f)(begin(ALL), end(ALL), ## __VA_ARGS__); })(x)

using namespace std;

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

    struct point
    {
        int x;
        int y;
    };

    vector<point> vR(N);

    REP(i, N)
    {
        int x, y;
        cin >> x >> y;
        vR[i] = {x, y};
    }

    vector<point> vB(N);

    REP(i, N)
    {
        int x, y;
        cin >> x >> y;
        vB[i] = {x, y};
    }

    // 赤 x 大きい
    ALL(sort, vR, [](const point& f, const point& s){return s.x < f.x;});

    // 青 y 小さい
    ALL(sort, vB, [](const point& f, const point& s){return f.y < s.y;});

    vector<bool> B(N, false);
    vector<bool> R(N, false);

    int cnt = 0;
    REP(i, N)
    {
        REP(j, N)
        {
            if (R[i] || B[j]) continue;
            if (vB[j].x <= vR[i].x) continue;
            if (vB[j].y <= vR[i].y) continue;

            cnt++;
            R[i] = true;
            B[j] = true;
        }
    }

    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#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##_len=(b);i<i##_len;++i)
#define MSVC_UNKO(x)x
#define rep(...)MSVC_UNKO(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define all(c)c.begin(),c.end()
#define write(x)cout<<(x)<<'\n'
using namespace std; typedef long long ll; template<class T>using vv = vector<vector<T>>;
template<class T>auto vvec(int n, int m, T v) { return vv<T>(n, vector<T>(m, v)); }
template<class T, class U>bool chmax(T& a, U&& b) { return a < b ? a = b, 1 : 0; }
template<class T, class U>bool chmin(T& a, U&& b) { return b < a ? a = b, 1 : 0; }
constexpr int INF = 1 << 29, MOD = int(1e9) + 7; constexpr ll LINF = 1LL << 60;
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10); }; }aaaa;

int main() {
    int A, B;
    cin >> A >> B;
    write(A ^ B);
}

Measured memory_bytes: 256
program main
  implicit none
  integer(8) :: h, monsters, res
  read (*, *) h
  monsters = 1
  res = 0
  do
    res = res + monsters
    if (h == 1) exit
    h = h / 2
    monsters = monsters * 2
  end do
  write (*, "(i0)") res
end program main


Measured memory_bytes: 512
///////////////////////////////////////////////////////////////////////////////

#include <iostream>
#include <vector>
#include <algorithm>
#include <set>

using namespace std;

///////////////////////////////////////////////////////////////////////////////

#define pb push_back

void longin(long &a)
{
        cin >> a;
}

void longinl1(auto &v, long count)
{
        for (long i = 0; i < count ; ++i) {
                long a;
                cin >> a;
                v.push_back(a);
        }
}

void longinl2(auto &v, long count)
{
        for (long i = 0; i < count ; ++i) {
                long a, b;
                cin >> a >> b;
                v.push_back({a, b});
        }
}

void longinl3(auto &v, long count)
{
        for (long i = 0; i < count ; ++i) {
                long a, b, c;
                cin >> a >> b >> c;
                v.push_back({a, b, c});
        }
}

void longina(auto &v, long count)
{
        longinl1(v, count);
}

long min(const vector<long> v)
{
        long ret = (long)numeric_limits<double>::infinity();
        for (auto i : v) ret = min(ret, i);
        return ret;
}

///////////////////////////////////////////////////////////////////////////////

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

        long ans = 0;
        long val = 0;

        for (size_t i = 0; i < s.size(); ++i) {
                if (s[i] == 'A' || s[i] == 'C' || s[i] == 'G' || s[i] == 'T') {
                        val++;
                        ans = max(ans, val);
                }
                else {
                        val = 0;
                }
        }

        cout << ans;

        return 0;
}

///////////////////////////////////////////////////////////////////////////////


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

using namespace std;

int keta(int a, int b) {
  return max(to_string(a).size(), to_string(b).size());
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  uint64_t n;
  cin >> n;
  uint64_t till = sqrt(n) + 1;
  int min_diff = INT_MAX;
  for (uint64_t i = 1; i <= till; ++i) {
    if (n % i == 0) {
      min_diff = min(min_diff, keta(i, n/i));
    }
  }
  cout << min_diff << "\n";
}


Measured memory_bytes: 384
#include <stdio.h>

int main(void){

	int width,height,wcount,hcount;

	while(1){
		scanf("%d",&height);
		scanf("%d",&width);
		
		if(height==0&&width==0){
			break;
		}
			
		for(hcount=0;hcount<height;hcount++){
			for(wcount=0;wcount<width;wcount++){
				if((hcount+wcount)%2==0){
					printf("#");
				}else{
					printf(".");
				}
			}
			printf("\n");
		}
		
		printf("\n");
	}
		
	return 0;
}

Measured memory_bytes: 2556
#include <stdio.h>

int RIGHT(int x[6],int up,int fr){
    if(up == x[0]){
        if(fr == x[1]) return x[2];
        if(fr == x[2]) return x[4];
        if(fr == x[3]) return x[1];
        if(fr == x[4]) return x[3];
    }
    if(up == x[1]){
        if(fr == x[0]) return x[3];
        if(fr == x[2]) return x[0];
        if(fr == x[3]) return x[5];
        if(fr == x[5]) return x[2];
    }
    if(up == x[2]){
        if(fr == x[0]) return x[1];
        if(fr == x[1]) return x[5];
        if(fr == x[4]) return x[0];
        if(fr == x[5]) return x[4];
    }
    if(up == x[3]){
        if(fr == x[0]) return x[4];
        if(fr == x[1]) return x[0];
        if(fr == x[4]) return x[5];
        if(fr == x[5]) return x[1];
    }
    if(up == x[4]){
        if(fr == x[0]) return x[2];
        if(fr == x[2]) return x[5];
        if(fr == x[3]) return x[0];
        if(fr == x[5]) return x[3];
    }
    if(up == x[5]){
        if(fr == x[1]) return x[3];
        if(fr == x[2]) return x[1];
        if(fr == x[3]) return x[4];
        if(fr == x[4]) return x[2];
    }
}

int main(void){
    int x[6],n=6,m,i,j,up,fr,ri;
    for(i =0 ;i < n;i++) scanf("%d",&x[i]);
    scanf("%d",&m);
    for(j=0;j<m;j++){
        scanf("%d %d",&up,&fr);
        ri = RIGHT(x,up,fr);
        printf("%d\n",ri);
    }
}



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

int main()
{
	char s1, s2, s3, t1, t2, t3;
	cin >> s1 >> s2 >> s3 >> t1 >> t2 >> t3;

	int ans = 0;
	if (s1 == t1) {
		ans++;
	}
	if (s2 == t2) {
		ans++;
	}
	if (s3 == t3) {
		ans++;
	}

	cout << ans << endl;
}


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

int main(){
    int n, l;
    scanf("%d%d", &n, &l);
    char str[n][l+1];
    char a[l*n+1];
    int ids[n];
    for(int i=0; i<n; i++){
        scanf("%s", &str[i][0]);
        ids[i] = i;
    }
    for(int i=n-1; i>0; i--){
        for(int j=0; j<i; j++){
            if(strcmp(&str[ids[j]][0], &str[ids[j+1]][0]) > 0){
                int buf = ids[j];
                ids[j]  = ids[j+1];
                ids[j+1]  = buf;
            }
        }
    }
    for(int i=0; i<n; i++){
        printf("%s", &str[ids[i]][0]);
    }

    return 0;
}

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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(),v.end()
#define _GLIBCXX_DEBUG

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vd = vector<double>;
using vvi = vector<vi>;
using vvll = vector<vll>;
using vvd = vector<vd>;
using vvvi = vector<vvi>;
using vvvll = vector<vvll>;
using vvvd = vector<vvd>;

const double pi=3.141592653589793;

int n;
double dp[300+1][300+1][300+1];
int flag[300+1][300+1][300+1];

double ddpp(int x1,int x2,int x3){
    if (flag[x1][x2][x3]){
        return dp[x1][x2][x3];
    }
    else{
        flag[x1][x2][x3]=1;
        double num=double(x1)+double(x2)+double(x3);
        if (num==0){
            dp[x1][x2][x3]=0.0;
            return dp[x1][x2][x3];
        }
        else{
            double ans1=0;
            if (x1>0){
                ans1+=ddpp(x1-1,x2,x3)*double(x1)/num;
            }
            if (x2>0){
                ans1+=ddpp(x1+1,x2-1,x3)*double(x2)/num;
            }
            if (x3>0){
                ans1+=ddpp(x1,x2+1,x3-1)*double(x3)/num;
            }
            ans1+=double(n)/num;
            dp[x1][x2][x3]=ans1;
            return ans1;
        }
    }
}

int main() {
    cin>>n;
    int a1=0,a2=0,a3=0;
    rep(i,n){
        int a;
        cin>>a;
        if (a==1){
            a1+=1;
        }
        if (a==2){
            a2+=1;
        }
        if (a==3){
            a3+=1;
        }
    }
    memset(dp,0,sizeof(dp));
    ddpp(a1,a2,a3);
    cout << fixed << setprecision(10);
    cout<<dp[a1][a2][a3]<<endl;
    

    return 0;
}

Measured memory_bytes: 319872
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
const int maxn = 1e5 + 5;
#define INF 1000000000
const int MOD = 1e9+7;
const double PI = 3.14159265358979323846264338;

int a[maxn];
int cnt[maxn];

int main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	fastio
	int n;
	cin >> n;
	string str;
	set<string> a;
	for(int i=0; i<n; i++){
		cin >> str;
		a.insert(str);
	}
	cout << a.size() << "\n";
}


Measured memory_bytes: 19196
#include <stdio.h>
#define LENGTH 3

int main (void) {
	char c[LENGTH + 1];
	int i = 0, price = 700;
	scanf("%s[^\n]", c);
	while (i < LENGTH) {
		if (c[i] == 'o') price += 100;
		i++;
	}
	printf("%d\n", price);
	return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

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

			if(S.length() <= K) {
				System.out.println(S);
			} else {
				System.out.println(S.substring(0, K) + "...");
			}

		}
	}
}

Measured memory_bytes: 27004
#define M_PI 3.14159265358979323846
#include <stdio.h>
#include <math.h>


int main(void){
    double PI=M_PI;
    double po=PI*2/100000;
    int N;
    scanf("%d",&N);
    double x[N],y[N];
    for(int i=0;i<N;i++)scanf("%lf %lf",&x[i],&y[i]);
    int kakuritu[N];
    for(int i=0;i<N;i++)kakuritu[i]=0;
    for(int i=0;i<1000000;i++){
        double max=cos(i*po)*x[0]+sin(i*po)*y[0];
        int maxj=0;
        for(int j=0;j<N;j++){
            if(max<cos(i*po)*x[j]+sin(i*po)*y[j]){max=cos(i*po)*x[j]+sin(i*po)*y[j];maxj=j;}
        }
        kakuritu[maxj]++;
    }
    for(int i=0;i<N;i++){
        printf("%.10f\n",(double)kakuritu[i]/1000000.0f);
    }
    return 0;
}


Measured memory_bytes: 384
import math,sys,bisect,heapq
from collections import defaultdict,Counter,deque
from itertools import groupby,accumulate
#sys.setrecursionlimit(200000000)
input = iter(sys.stdin.buffer.read().decode().splitlines()).__next__
ilele = lambda: map(int,input().split())
alele = lambda: list(map(int, input().split()))
def list2d(a, b, c): return [[c] * b for i in range(a)]
#def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
MOD = 1000000000 + 7
def Y(c):  print(["NO","YES"][c])
def y(c):  print(["no","yes"][c])
def Yy(c):  print(["No","Yes"][c])

def fun(A,N,k):
    inf = 1e10
    dp = [inf]*N
    for pos in range(N):
        if pos == 0:
            dp[pos] = 0
        elif pos == 1:
            dp[pos]  = abs(A[pos-1] - A[pos])
        else:
            for i in range(1,k+1):
                if pos - i >= 0:
                    dp[pos] = min(dp[pos],abs(A[pos] - A[pos-i]) + dp[pos-i])
                else:
                    break
    return dp[-1]

N,K = ilele()
A = alele()
print(fun(A,N,K))

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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
template<typename T> using v = vector<T>;
template<typename T> using pq = priority_queue<T>;
template<typename T> using minpq = priority_queue<T, vector<T>, greater<T>>;
template<typename T, typename K> using ump = unordered_map<T, K>;
const ll dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll e5 = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = n - 1; i >= 0; i--)
#define repone(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define each(i, mp) for(auto& i:mp)
#define eb emplace_back
#define F first
#define S second
#define all(obj) (obj).begin(), (obj).end()

template<class T>
void dump_debug(T list) {
#ifdef MY_DEBUG
    each(e, list) cout << e << " ";
    printf("\n");
#endif
}

inline ll inl() {
    ll x;
    cin >> x;
    return x;
}

inline string ins() {
    string x;
    cin >> x;
    return x;
}

/* ------------- ANSWER ------------- */
/* ---------------------------------- */

int main() {
#ifdef MY_DEBUG
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wmissing-noreturn"
    while (true) {
#pragma clang diagnostic pop
#endif
        ll n = inl(), l = inl();
        ll ans = 0;
        rep(i, n) {
            ans += l + (i + 1) - 1;
        }
        ll minus = ll_inf;
        ll minus1 = ll_inf;
        rep(i, n) {
            if (abs(l + (i + 1) - 1) < minus) {
                minus = min(abs(l + (i + 1) - 1), minus);
                minus1 = l + (i + 1) - 1;
            }
        }
        cout << ans - minus1 << endl;

#ifdef MY_DEBUG
    }
#endif
    return 0;
}

Measured memory_bytes: 256
n,y=map(int,input().split())
s=y//1000
if s<n:
    print("-1 -1 -1")
else:
    if s==n:
        print("0 0 "+str(s))
    else:
        d=s-n
        for i in range(min(9,d//4+1)):
            if (d-4*i)%9==0:
                if (d-4*i)//9+i<=n:
                    print(str((d-4*i)//9)+" "+str(i)+" "+str(n-i-(d-4*i)//9))
                    break
        else:
             print("-1 -1 -1")

Measured memory_bytes: 3188
N=int(input())
T=list(map(int,input().split()))
M=int(input())
P=[]
X=[]
for k in range(M):
    p,x=map(int,input().split())
    P.append(p)
    X.append(x)

for h in range(M):
    time=sum(T)-T[P[h]-1]+X[h]
    print(time)
    

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

typedef long long ll;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define each(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); ++itr)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second

string solve()
{
    string ok="YES", ng="NO";

    string s;
    cin >>s;

    int S=s.size();
    int now=S-1;

    while(now>3)
    {
        if(s[now]=='r')
        {
            if(now<5) return ng;
            if(s[now-1]!='e') return ng;

            if(s[now-2]=='m')
            {
                if(s.substr(now-6,5)=="dream") now-=7;
                else return ng;
            }
            else if(s[now-2]=='s')
            {
                if(s.substr(now-5,5)=="erase") now-=6;
                else return ng;
            }
            else return ng;
        }
        else if(s[now]=='m')
        {
            if(s.substr(now-4,5)=="dream") now-=5;
            else return ng;
        }
        else if(s[now]=='e')
        {
            if(s.substr(now-4,5)=="erase") now-=5;
            else return ng;
        }
        else return ng;
    }

    return (now==-1)?ok:ng;
}

int main()
{
    cout << solve() << endl;
    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef pair<string , int> s_i;
typedef vector<ll> vel;
typedef vector<int> vei;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> ve_vel;
typedef vector<vector<int>> ve_vei;
typedef vector<vector<char>> ve_vec;
typedef vector<vector<bool>> ve_veb;
typedef vector<vector<string>> ve_ves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pub push_back
#define puf push_front
#define pob pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
//const int64 INF = 1LL << 58;
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<typename T> void remove(T & vector, unsigned int index){vector.erase(vector.begin() + index);}


int N, A, B, C;
vei l;
int rec(int i, int a, int b, int c) {
    if (i == N) {
        if (!a || !b || !c) return INF; 
        return abs(a - A) + abs(b - B) + abs(c - C); 
    }
    int res = rec(i+1, a, b, c);
    
    chmin(res, rec(i+1, a + l[i], b, c) + (a ? 10 : 0));
    chmin(res, rec(i+1, a, b + l[i], c) + (b ? 10 : 0));
    chmin(res, rec(i+1, a, b, c + l[i]) + (c ? 10 : 0));
    
    return res;
}



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

     cin >> N >> A >> B >> C;
     l.resize(N);
     rep(i,N) cin >> l[i];

     int ans = rec(0, 0, 0, 0);

     cout << ans << endl;
     return 0;

}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include<vector>
#include <algorithm>
#include<cstdlib>
#include<math.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i=0;i<n;i++)

int main()
{
    ll a, b, c, k;
    cin >> a >> b >> c >> k;
    if (k <= a) cout << k << "\n";
  else{
    if (k <= a + b) cout << a << "\n";
    else cout << a + a + b - k << "\n";
  }
    return 0;
}

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

int main(){
	string serve;
	int APoint = 0;
	int BPoint = 0;
	while(true){
		cin >> serve;
		if(serve == "0"){
			break;
		}
		int size = serve.size();
		APoint = 0;
		BPoint = 0;
		
		for(int i=1;i<size;i++){
			if(serve[i] == 'A'){
				APoint++;
			}else if(serve[i] == 'B'){
				BPoint++;
			}
		}
		
		if(APoint > BPoint){
			APoint++;
		}else{
			BPoint++;
		}
		
		cout << APoint << ' ' << BPoint << '\n';
	}
	return 0;
}

Measured memory_bytes: 1184
import java.util.*;

public class Main {

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

        if (str.length() <= 1) {
            System.out.print(Integer.parseInt(str));
            return;
        }

        if (str.length() <= 2) {
            System.out.print(9);
            return;
        }

        if (str.length() <= 3) {
            System.out.print(9 + Integer.parseInt(str) - 99);
            return;
        }

        if (str.length() <= 4) {
            System.out.print(909);
            return;
        }

        if (str.length() <= 5) {
            System.out.print(909 + Integer.parseInt(str) - 9999);
            return;
        }

        if (str.length() == 6) {
            System.out.print(90909);
            return;
        }
    }

}

Measured memory_bytes: 21712
import java.util.ArrayDeque

fun main(args: Array<String>) {
    val s = readString()

    var q = ArrayDeque<Char>()
    s.forEach {
        when (it) {
            'B' -> q.pollLast()
            else -> q.addLast(it)
        }
    }
    println(q.joinToString(separator = ""))
}

// Tools
fun readString() = readLine()!!

Measured memory_bytes: 36460
#include <algorithm>
#include <deque>
#include <functional>
#include <iostream>
#include <iterator>
#include <limits>
#include <map>
#include <set>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

using namespace std;

int main()
{
    long N, A, B;
    cin >> N >> A >> B;

    if (A > B) {
        cout << "0\n";
        return 0;
    }

    if (N == 1) {
        if (A != B)
            cout << "0\n";
        else
            cout << "1\n";
        return 0;
    }

    long mn = A + (N - 2) * A + B;
    long mx = A + (N - 2) * B + B;
    cout << mx - mn + 1 << '\n';

    return 0;
}


Measured memory_bytes: 256
import sys
MAX_INT = int(10e12)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

N = I()
data = IL()
a = []
ans = []

for i in range(N):
  a.append([data[i], i+1])

a.sort()
#print(a)
for i in a:
  a,b = i
  ans.append(b)

print(" ".join(map(str,ans)))

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

using namespace std;

using ll = long long int;
using vi = vector<int>;
#define f(n) for(int i = 0; i < n; i++)
#define fj(n) for(int j = 0; j < n; j++)
#define fk(n) for(int k = 0; k < n; k++)
#define ci(n) cin >> n;
#define ic(n) int n; cin >> n;
#define lc(n) int n; cin >> n;
#define all(a) a.begin(), a.end()
#define pri(a, n) for(int i = 0; i < n; i++) cout << a[i] << " "; cout << "\n";
#define scl(a, n) ll a[n] = {0}; for(int i = 0; i < n; i++) cin >> a[i];
#define pb push_back
#define sc second
#define eb emplace_back
#define ft first
//#define int long long
#define pii pair<int, int>
void prip(int a[], int n){f(n) cout << a[i] << ' '; cout << '\n';}


const int mod = 1e9 + 7, inf = 2e9;
bool cmp(int a, int b)
{
    return abs(a) > abs(b);
}
int bp(int a, int n)
{
    if(n == 0) return 1;
    if(n & 1ll) return (a * bp(a, n - 1)) % mod;
    int res = bp(a, n >> 1);
    return (res * res) % mod;
}
main()
{
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    ic(h) ic(w) ic(m)
    int amh[h] = {0}, amv[w] = {0};
    map<pii, int> mp;
    f(m)
    {
        ic(y) ic(x)
        mp[{y, x}] = 1;
        amh[y - 1]++, amv[x - 1]++;
    }
    int mh = 0, mv = 0;
    f(h) mh = max(mh, amh[i]);
    f(w) mv = max(mv, amv[i]);
    vector<int> ys, xs;
    f(h) if(amh[i] == mh) ys.pb(i + 1);
    f(w) if(amv[i] == mv) xs.pb(i + 1);
    for(int cy : ys)
    {
        for(int cx : xs)
        {
            if(mp[{cy, cx}] == 0)
            {
                cout << mh + mv;
                return 0;
            }
        }
    }
    cout << mh + mv - 1;
}


Measured memory_bytes: 28512
#include <iostream>
#include <cstdio>

//#define PI 3.141592653589

using namespace std;



int main()
{
	int H, W;
	
	while (1)
	{
		cin >> H >> W;
		if (H==0 && W==0) return 0;
		
		for (int i=0; i<H; i++)
		{
			for (int j=0; j<W; j++)
			{
				if (i==0 || i==H-1 || j==0 || j==W-1)
					cout << "#";
				else
					cout << ".";
			}
			cout << endl;
		}
		cout << endl;
	}
	
	return 0;
}

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

using namespace std;

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)

using ll = long long;
using P = std::tuple<int,int>;

const int dx[8] = {-1, 1, 0, 0, -1, -1, 1, 1}, dy[8] = {0, 0, -1, 1, -1, 1, -1, 1};

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

    string S;
    std::cin >> S;

    int ren = 0;
    for(int i=0,j=0;i<S.size();){
        while(j < S.size() && S[j] == S[i]){++j;}

        ++ren;
        
        i = j;
    }

    printf("%d\n", ren - 1);
}


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

using namespace std;

#define pb push_back
#define mp make_pair
#define eb emplace_back


typedef long long ll;
typedef long double ld;


const ll inf = 2e9;
const ll base = 998244353;
ll mod = 1e9 + 7;



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


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


int main() {
//    srand(time(NULL));
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(nullptr);
//    std::random_device rd;
//    std::mt19937 g(rd());

    auto start = clock();

    int n; string s; cin >> n >> s;
    if (n & 1) {
        no();
        return 0;
    }
    n /= 2;
    for (int i = 0; i < n; ++i) {
        if (s[i] != s[i + n]) {
            no();
            return 0;
        }
    }
    yes();

    std::cerr << double(clock() - start) / CLOCKS_PER_SEC << std::endl;
    return 0;
}


Measured memory_bytes: 256
a = input().split(' ')
b = input().split(' ')
a = [int(a) for a in a]
b = [int(b) for b in b]

b.sort(reverse=True)

ans = 'Yes'

if b[a[1]-1] / sum(b) < 1 / (4 * a[1]):
    ans = 'No'
            
print(ans)

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

static Graph graph;
static vector<bool> seen;
static queue<pair<int,int>> que;
static int goal;

int bfs() {
  int counter=0;
  while(!que.empty()) {
    auto last = que.front();
    que.pop();
    for (auto candidate: graph[last.first]) {
      if (seen[candidate]) continue;
      if (candidate==goal) return last.second+1;
      seen[candidate]=true;
      que.push({candidate, last.second+1});
    }
  }
  return -3;
}

int main()
{
  // 入力受け取り
  int N, M, u, v, S, T;
  cin >> N >> M;
  graph.assign(3*N, vector<int>());
  seen.assign(3*N, false);
  
  for(int i=0; i<M; i++) {
    cin >> u >> v;
    u--, v--;
    graph[u*3].push_back(v*3+1);
    graph[u*3+1].push_back(v*3+2);
    graph[u*3+2].push_back(v*3);
  }
  
  cin >> S >> T;
  
  // 初期化
  goal = (T-1)*3;
  que.push({(S-1)*3,0});
  
  // bfs & output
  cout << bfs()/3 << endl;
  
  return 0;
}


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

int main() {
int a,b,k,flag=0;
  cin>>k;
  cin>>a>>b;
  int i;
  for(i=a;i<=b;i++)
  {if(i%k==0)
  {flag=1;
   break;
  }
   else
     flag=0;   
  }
  if(flag==1)
    cout<<"OK";
  else
    cout<<"NG";
}


Measured memory_bytes: 3636
road = input()
 
right = 0
left = 0
flag = 0
ans = [0] * len(road)
for i in range(len(road)):
    if road[i] == 'L' and flag == 0:
        left = i
        flag = 1
            
    if road[i] == 'R' and flag == 1 :
        for j in range(right,i):
            if abs(j-left) % 2 == 1:
                ans[left-1] += 1
            else:
                ans[left] += 1
        right = i
        flag = 0
for j in range(right,len(road)):
    if abs(j-left) % 2 == 1:
        ans[left-1] += 1
    else:
        ans[left] += 1
for a in ans:
    print(a,end=' ')

Measured memory_bytes: 4864
#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>;
#define chmax(x,y) x = max(x,y);
#define chmin(x,y) x = min(x,y);
const int di[] = {-1, 0, 1, 0};
const int dj[] = {0, -1, 0, 1};
const int INF = 1001001001;



int main() {
    int a, b, c;
    cin >> a >> b >> c;
    cout << a*b/2 << endl;
    return 0;
}

Measured memory_bytes: 3600
#define D(x) cout << #x " = " << x << endl
#define DD(x, y) cout << "(" #x ", " #y ") = (" << x << ", " << y << ")" << endl
#define DDD(x, y, z) cout << "(" #x ", " #y ", " #z ") = (" << x << ", " << y << ", " << z << ")" << endl
#define DV(v) for (auto __macro_vi : v){ cout << __macro_vi << " ";} cout << endl;
#define DA(a, n) for (int __macro_i = 0; __macro_i < n; ++__macro_i) { cout << a[__macro_i] << " "; } cout << endl;
#define REP(i, n) for (int i = 0; i < n; ++i)
#define ALL(v) (v).begin(), (v).end()
#include<iostream>
#include<vector>
#include<cassert>
#include<cmath>
#include<string>
#include<set>

using namespace std;

string get_name(const string& orig, int k) {
    string ans = "";
    ans += orig[0];
    for (int i = 1; i < orig.size(); ++i) {
        if (ans.size() == k) return ans;
        char c = orig[i - 1];
        if (c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o') {
            ans += orig[i];
        }
    }
    return ans;
}

int main()
{
    while(1) {
        int n;
        cin >> n;
        if (n == 0) break;
        vector<string> v(n);
        int maxk = 0;
        REP(i, n) {
            cin >> v[i];
            maxk = max(maxk, (int)v[i].size());
        }
        int ans = -1;
        for (int k = 1; k <= maxk; ++k) {
            set<string> st;
            REP(i, n) {
                // DD(get_name(v[i], k), k);
                st.insert(get_name(v[i], k));
            }
            if (st.size() == n) {
                ans = k;
                break;
            }
        }
        cout << ans << endl;
    }
}



Measured memory_bytes: 3192
#include <iostream>

using namespace std;

int main(){
  int w, a, b;
  cin >> w >> a >> b;
  
  if(a + w < b) cout << b - a - w << endl;
  else if(b + w < a) cout << a - b - w << endl;
  else cout << 0 << endl;
  
  return 0;
}

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

int main(){
	int n;
	cin >> n;
	int m = n,s = 0;
	while(m > 0){
		s += m % 10;
		m /= 10;
	}
	if(n % s == 0)cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long int power(long long int a,long long int b)
{
  long long int r=1;
  while(b>=1)
  {
    if(b&1)
      r*=a;
    b/=2;
    a*=a;
  }
  return r;
}
long long int loga(long long int n)
{
  return n>1?1+loga(n/2):0;
}
int main()
{
  long long int n;
  cin>>n;
  long long int b=1,c=0;
  while(b<=n) {b*=2; c++;}
  cout<<power(2,c)-1;
}

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

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

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

#define rep(i, begin_i, end_i) for (ll i = (ll)begin_i; i < (ll)end_i; i++)
//試験導入
#define irep(i, end_i, begin_i) for (ll i = (ll)begin_i-1; i >= (ll)end_i; i--)

long long INF = 1LL<<60;
ll dp[55][55][2510];
int main( ){
    int n,a;
    cin>>n>>a;
    vi x(n);
    rep(i,0,n)cin>>x[i];
    dp[0][0][0]=1;
    rep(i,0,n){
        rep(j,0,n){
            rep(k,0,a*n+1){
                dp[i+1][j][k]+=dp[i][j][k];
                dp[i+1][j+1][k+x[i]]+=dp[i][j][k];
            }
        }
    }
    ll sum=0;
    rep(j,1,n+1){
        sum+=dp[n][j][j*a];
    }
    cout<<sum<<endl;
    return 0;
}




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

// types
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;

// macros
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int mod = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  
  string s;
  cin >> s;
  ll n = s.size();
  ll ans = 0;
  REP1(i, n){
    if(s[i] != s[i-1])
      ans++;
  }
  
  cout << ans << endl;
    
    
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repb(i, n) for (int i = (n-1); i >= 0; i--)
#define rea(i, a, b) for (int i = (a); i < (b); i++)
#define reab(i, a, b) for (int i = (a)-1; i >= (b); i--)
#define ALL(a) (a).begin(),(a).end()
#define SZ(x) ((int)(x).size())
#define PRINT(V) for (auto v:(V)) {cerr << v << " ";} cerr << endl
#define dump(x) cerr << #x << " : " << (x) << endl
#define dump2(x, y) cerr << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")" << endl
inline ll GCD(ll a, ll b){return b ? GCD(b, a % b) : a;}
const int MOD = 1000000007;
/* END OF TEMPLATE */

int main(){
    string s;
    cin >> s;
    ll k;
    cin >> k;
    rep(i, SZ(s)){
        if(s[i] == '1'){
            if(i + 1 == k){
                cout << "1" << endl;
                return 0;
            }
        }else{
            cout << s[i] << endl;
            return 0;
        }
    }
}

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

int main(){
  int N,K;
  cin >> N >> K;
  vector<int> h(N);
  for(int i = 0; i < N; i++){
    cin >> h[i];
  }
  
  int count = 0;
  for(int i = 0; i < N; i++){
    if(h[i] >= K){
      count++;
    }
  }
  
  cout << count << endl;
}


Measured memory_bytes: 640
def solve():
    a,b=map(int,input().split())
    if a==2 or b==2:
        print("No")
    elif (a==4 and not(b==6 or b==9 or b==11)) or (a==6 and not(b==9 or b==11)) or (a==9 and not b==11) or a==11:
        print("No")
    else:
        print("Yes")

if __name__ == "__main__":
    solve()

Measured memory_bytes: 3060
#include<stdio.h>
int judgeNumber(int number)
{
	int a, b, c, d;
	d = number % 10;
	number = number / 10;
	c = number % 10;
	number = number / 10;
	number = number / 10;
	b = number % 10;
	number = number / 10;
	a = number % 10;
	if (a == d)
	{
		if (b == c)
			return 1;
	}
	return 0;
}
int main()
{
	int a, b, count,n;
	count = 0;
	scanf("%d", &a);
	scanf("%d",&b);
	for (n = a; n <= b; n++)
	{
		if (judgeNumber(n))
			count++;
	}
	printf("%d",count);
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REP2(i, a, b) for (int i = (a); i < (int)(b); i++)
typedef vector<int> VI;
typedef vector<VI> VVI;

string Main(int N, string s)
{
    int T1 = N/2;
    string t1 = s.substr(0, T1);
    string t2 = s.substr(T1, N-T1);
    return (t1 == t2) ? "Yes" : "No";
}

int main(void){
    int N;
    cin >> N;
    string S;
    cin >> S;
    cout << Main(N, S) << endl;
    return 0;
}

Measured memory_bytes: 256
/*
    Life Before Death, Strength Before Weakness, Journey Before Destination
    ------------------------------------------------------------------------
    You don't become great by trying to be great.
    You become great by wanting to do something,
    and then doing it so hard that you become great in the process.
    */
 
    //#pragma comment(linker, ack:200000000")
    #pragma GCC optimize ("Ofast")
    #pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
    #include <bits/stdc++.h>
    using namespace std;
    
    #define TRACE
    
    #ifdef TRACE
    #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
      cerr << name << " : " << arg1 << std::endl;
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
      const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
    #else
    #define trace(...)
    #endif
    
    #define rep(i, n)    for(ll i = 0; i < (n); ++i)
    #define repA(i, a, n)  for(ll i = a; i <= (n); ++i)
    #define repD(i, a, n)  for(ll i = a; i >= (n); --i)
    #define trav(a, x) for(auto& a : x)
    #define all(x) x.begin(), x.end()
    #define sz(x) (int)(x).size()
    #define fill(a)  memset(a, 0, sizeof (a))
    #define fst first
    #define snd second
    //#define mp make_pair
    #define pb push_back
    #define PI           3.141592653589793238462643383279502884197169399  /* pi */
    // #define te    
    typedef long double ld;
    typedef long long ll;
    typedef pair<ll, ll> pii;
    typedef vector<ll> vi;
    const int maxN = 100100;

    ll c[2010][2010], m = 1000000007;
    
    void bc(){
        ll n = 2008, k = 2008;
        rep(i, n+1) rep(j, min(i, k)+1){
            if(j == 0|| j == i) c[i][j] = 1;
            else c[i][j] = (c[i-1][j-1]%m + c[i-1][j]%m)%m;
            //cout << i << " " << j << " " << c[i][j] << endl;
        }
    }

    void solve() {
        bc();
        ll n, k;
        cin >> n >> k;
        rep(i, k){
            //cout << c[k-1][i] << " " << c[n-k+1][i+1] << endl;
        ll val = (c[k-1][i]*c[n-k+1][i+1])%m;
        cout << val << endl;
        }
    }
 
    int main() {
      cin.sync_with_stdio(0); cin.tie(0);
      cin.exceptions(cin.failbit);
      // ll ti;   cin >> ti;  while(ti--)
      solve();
      return 0;
    } 

Measured memory_bytes: 30336
using System;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            for (int i = 1; i <= 9; i++)
            {
                for (int ii = 1; ii <= 9; ii++)
                {
                    string ans;
                    ans = i+"x"+ii+"="+i*ii;
                    Console.WriteLine(ans);

                }
                
            }
                    Console.ReadLine();        }
    }
}

Measured memory_bytes: 5616
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <limits>
#include <queue>
#include <iomanip>
#include <set>

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

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

using namespace std;
using ll = long long int;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vvll> vvvll;
const int MOD=1000000007;
//const int MOD=998244353;
const int INTMAX=1001001000;
const ll LLMAX=1010010010010010000;

bool comp(vll a,vll b){
    if(a[0]!=b[0]){
        return a[0]<b[0];
    }
    else{
        return a[1]<b[1];
    }
}

bool comp2(vll a,vll b){
    return a[2]<b[2];
}


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    ll N,M;
    cin>>N>>M;
    vvll PY(M,vll(3));
    for(ll i=0;i<M;i++){
        cin>>PY[i][0]>>PY[i][1];
        PY[i][2]=i;
    }
    
    sort(PY.begin(),PY.end(),comp);
    
    for(ll i=0;i<M;i++){
        if(i==0) PY[0][1]=1;
        else{
            if(PY[i][0]==PY[i-1][0])PY[i][1]=PY[i-1][1]+1;
            else PY[i][1]=1;
        }
    }
    
    sort(PY.begin(),PY.end(),comp2);
    
    for(ll i=0;i<M;i++){
        if(PY[i][0]<10)printf("00000%lld",PY[i][0]);
        else if(PY[i][0]<100)printf("0000%lld",PY[i][0]);
        else if(PY[i][0]<1000)printf("000%lld",PY[i][0]);
        else if(PY[i][0]<10000)printf("00%lld",PY[i][0]);
        else if(PY[i][0]<100000)printf("0%lld",PY[i][0]);
        else if(PY[i][0]<1000000)printf("%lld",PY[i][0]);
        if(PY[i][1]<10)printf("00000%lld",PY[i][1]);
        else if(PY[i][1]<100)printf("0000%lld",PY[i][1]);
        else if(PY[i][1]<1000)printf("000%lld",PY[i][1]);
        else if(PY[i][1]<10000)printf("00%lld",PY[i][1]);
        else if(PY[i][1]<100000)printf("0%lld",PY[i][1]);
        else if(PY[i][1]<1000000)printf("%lld",PY[i][1]);
        printf("\n");
    }
    
    return 0;
}


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

int main() {

  int n;
  cin >> n ;
  vector<int> M(n); 

  for (int i=0;i<n;i++){
    cin >> M.at(i) ;
  }

  sort(M.begin(),M.end());
  reverse(M.begin(),M.end());

  int c=0;

  for (int j=0;j+1<n;j++){
    if(M.at(j) > M.at(j+1))
    c++;
  }
  cout << c+1 << endl;
}


Measured memory_bytes: 3612
import sys

num = input()
strings = []
for _ in range(int(num)):
    strings.append(input())

count_up = {}
for str in strings:
    if str in count_up:
        count_up[str] += 1
    else:
        count_up[str] = 1


count_up_sorted = sorted(count_up.items(), key=lambda x:x[1], reverse=True)
a = count_up_sorted[0][1]
# print("a:",a)
greaters = []
for value in count_up_sorted:
    if value[1] != a:
        break
    else:
        greaters.append(value[0])

greaters_sorted = sorted(greaters)
for value in greaters_sorted:
    print(value)
# print(strings)
# print(count_up)
# print(count_up_sorted)
# print(greaters)
# print(greaters_sorted)

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

int main() {
  int N;
  cin >> N;
  vector<string> S(N), C;
  map<string, int> ss;
  for (int i=0; i<N; i++) {
    cin >> S[i];
    ss[S[i]]++;
  }
  int M;
  cin >> M;
  vector<string> T(M);
  for (int i=0; i<M; i++) {
    cin >> T[i];
    ss[T[i]]--;
  }
  int m=0;
  for (auto p:ss) {
    m=max(m, p.second);
  }
  cout << m << endl;
}


Measured memory_bytes: 3612