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

#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define RFOR(i, a, b) for(int i=(a); i>=(b); i--)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, n, 0)
#define CEIL(n, m) ceil(n/pow(10.0, m))*pow(10.0, m)
#define FLOOR(n, m) floor(n/pow(10.0, m))*pow(10.0, m)
#define ROUND(n, m) round(n/pow(10.0, m))*pow(10.0, m)
#define ALL(x) (x).begin(),(x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define RSORT(x) sort((x).begin(),(x).end(),greater<int>())
#define SZ(x) ((int)(x).size())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) " (L" << __LINE__ << ") " << __FILE__ << endl;

typedef long long ll;
const int mod = 1e9+7;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const int inf = 0x3f3f3f3f;

void solve()
{

  int n; cin>>n;
  vector<int> c(n, 0);
  vector<int> s(n, 0);
  vector<int> f(n, 0);
  vector<int> ans(n, 0);
  for (int i=0; i<n-1; i++) {
    cin >> c[i] >> s[i] >> f[i];
  }

  for (int i=0; i<n; i++) {
    for (int j=0; j<=i; j++) {
      if (ans[j]<s[i]) {
        ans[j] = s[i];
      }
      if (f[i]!=0 && ans[j]%f[i]!=0) {
        ans[j] += f[i]-(ans[j]%f[i]);
      }
      ans[j] += c[i];
    }
  }

  for (int i=0; i<n; i++) {
    cout << ans[i] << endl;
  }
}

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


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

int main(){
    int N;
    cin>>N;
    vector<int> A(N+1),B(N);
    for(auto &a:A) cin>>a;
    for(auto &b:B) cin>>b;
    int64_t ans=0;
    for(int i=0;i<N;i++){
        int k=min(A[i],B[i]);
        ans+=k;
        A[i]-=k;
        B[i]-=k;
        k=min(A[i+1],B[i]);
        ans+=k;
        A[i+1]-=k;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>

int main(){
    int a, b, k, i;

    scanf("%d %d %d", &a, &b, &k);

    for(i=a; i<=b; i++){
        if(i < a+k || b-k < i)
            printf("%d\n", i);
    }

    return 0;
}

Measured memory_bytes: 128
N = int(input())
A = []
B = []
for _ in range(N):
  a,b = [int(i) for i in input().split()]
  A.append(a)
  B.append(b)
A.sort()
B.sort()
if N%2 == 1:
  M = (N-1)//2
  print(B[M]-A[M]+1)
  exit()
M = (N//2)-1
L = (N//2)
print(B[M]+B[L]-A[M]-A[L]+1)

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

using namespace std;

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

  int a[4][3][10] = {0};

  {
    int b, f, r, v;
    for (int i = 0; i < n; ++i) {
      cin >> b >> f >> r >> v;
      a[b-1][f-1][r-1] += v;
    }
  }

  for (int b = 0; b < 4; ++b) {
    if (b > 0) {
      printf("####################\n");
    }
    for (int f = 0; f < 3; ++f) {
      for (int r = 0; r < 10; ++r) {
        printf(" %d", a[b][f][r]);
      }
      printf("\n");
    }
  }
  return 0;
}

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


int main() {

  int n,k,s;
  cin>>n>>k>>s;
  

  vector<int> A(n+1);
  for(int i=1;i<=n;i++){
    if(i<=k)
      A.at(i)=s;
    else if(s==1000000000){
      A.at(i)=1000000000-1;
    }else{
      A.at(i)=1000000000;
    }
  }   


    for(int i=1;i<=n;i++){
      if(i<n)
        cout<<A.at(i)<<" ";
      else
      {
       cout<<A.at(i)<<endl;
      }
    }

    return 0;
}


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

int main(){
	int n,s,min,max,sum;

	while(cin>>n && n>0){
		max=0;
		sum=0;
		for(int i=0;i<n;i++){
			cin>>s;
			sum+=s;
			if(i==0) min=s;
			if(s>max) max=s;
			if(s<min) min=s;
		}
		cout<<(sum-max-min)/(n-2)<<endl;
	}
}

Measured memory_bytes: 1160
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		Integer[] a = new Integer[N];
		for(int i = 0;i<N;i++) {
			a[i]=sc.nextInt();
		}
		Arrays.sort(a,Comparator.reverseOrder());
		int AliceScore = 0;
		int BobScore = 0;
		for(int c=0;c<a.length;c++) {
		if(c%2==0) {
			AliceScore += a[c];
		}
		else {
			BobScore += a[c];
		}
		}
		System.out.println(AliceScore-BobScore);
	}
}

Measured memory_bytes: 23636
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define vv(T) std::vector<std::vector<T>>
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;

int		main(void)
{
	ll n, k;
	cin >> n >> k;

	double ans = 0.0;
	for (ll i = 1; i <= n; ++i)
	{
		ll tmp = i;
		double  rate = 1.0/n;
		while (tmp < k)
		{
			tmp *= 2;
			rate /= 2;
		}
		ans += rate;
	}
	printf("%.12f\n", ans);
}



Measured memory_bytes: 3696
#include <iostream>
#include <cassert>
#include <iomanip>
#include <utility>
#include <cmath>
#include <numeric>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <queue>
#include <string>

using namespace std;

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

#define rep(i, n) for(int i = 0; i < n; i++)
#define repext(i, a, b) for (int i = a; i < b; i++)
#define reprev(i, n) for (int i = n - 1; i >= 0; i--)
#define repextrev(i, a, b) for (int i = b - 1; i >= a; i--)
#define vec_all(vec) vec.begin(), vec.end()

// vectorデバッグ
template<typename T>
void dump_vec(vector<T> vec) {
    rep(i, vec.size()) {
        cout << i << ": " << vec[i] << endl;
    }
}

// --- notice ---
// intの和はllにしろ

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

    vector<char> searched_char;
    searched_char.push_back('M');
    searched_char.push_back('A');
    searched_char.push_back('R');
    searched_char.push_back('C');
    searched_char.push_back('H');

    map<char, int> char_map;
    rep(i, searched_char.size()) {
        char_map.insert(make_pair(searched_char[i], 0));
    }

    string tmp;
    char tmp_char;
    ll valid_count = 0;
    rep(i, n) {
        cin >> tmp;
        rep(i, searched_char.size()) {
            tmp_char = searched_char[i];
            if (tmp[0] == tmp_char) {
                valid_count++;
                char_map[tmp_char]++;
                break;
            }
        }
    }

    ll sup_count = valid_count * (valid_count - 1) * (valid_count - 2) / 6;

    ll char_count;
    rep(i, searched_char.size()) {
        char_count = char_map[searched_char[i]];
        if (char_count >= 3) {
            sup_count -= (char_count * (char_count - 1) * (char_count - 2) / 6);
        }

        if (char_count >= 2) {
            sup_count -= ((valid_count - char_count) * char_count * (char_count - 1) / 2);
        }
    }

    cout << sup_count << endl;

    return 0;
}

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

#define _CRT_SECURE_NO_WARNINGS
#define TLong long long
#define TBMod 1000000007

int main(int argc, char const *argv[]){
	int n,m;
	char a[57][57],b[57][57];
	int f;
	scanf("%d%d",&n,&m);

	for(int i = 0; i < n; ++i){
		scanf("%s",a[i]);
	}
	for(int i = 0; i < m; ++i){
		scanf("%s",b[i]);
	}
	for(int i = 0; i <= n - m; i++){
		for(int l = 0; l <= n - m; l++){
			f = 0;
			for(int j = 0; j < m; j++){
				for(int k = 0; k < m; k++){
					if(a[j + i][k + l] != b[j][k])
					{
						f = 1;
						break;
					}
				}
			}
			if(f == 0)
			{
				puts("Yes");
				return 0;
			}
		}
	}
	puts("No");
	return 0;
}


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

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

  int n; cin >> n;
  vector<int> v(n);
  for (int i = 0; i < n; i++) cin >> v[i];
  sort(v.begin(), v.end());
  double res = v[0];
  for (int i = 1; i < n; i++) {
    res = (res + v[i]) / 2;
  }
  cout << setprecision(6) << res << '\n';
  return 0;
}

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

int main(){
    int n,m;cin>>n>>m;
    map<int, int> hist;
    for (int i=1;i<=n;i++){
        hist[i] = 1;
    }
    set<int> red_ball_hist;
    red_ball_hist.insert(1);
    int x,y;
    for (int i=0;i<m;i++){

        cin >> x >> y;
        hist[x]--;
        hist[y]++;
        if (red_ball_hist.find(x) != red_ball_hist.end()){
            red_ball_hist.insert(y);
        }
        if (hist[x] == 0){
            red_ball_hist.erase(x);
        }
    }
    int acc=0;
    for (auto r : red_ball_hist){
        if (hist[r] > 0){
            acc++;
        }
    }
    cout << acc << endl;
    return 0;
}

Measured memory_bytes: 9600
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
template<class T> bool umin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool umax(T &a, T b) { return a < b ? (a = b, true) : false; }
#define ALL(x) (x).begin(), (x).end()
LL POW(LL a,LL p,LL M){ if(!p) return 1LL;LL T = POW(a,p/2,M);T = T*T%M; if(p&1) T=T*(a%M)%M; return T; }
LL SQRT(LL a) { LL b = (LL)sqrtl(((double)a)+0.5); while(b*b<a) ++b; while(b*b>a) --b; return (b*b==a)?b:-1; }
//endl
//<------------------------edits---------------------------------------------->
const LL MOD = 1e9+7;//998244353
// #define LOCAL LDD
// #define int LL

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.precision(10);cout << fixed;
#ifdef LOCAL
  freopen("input.txt", "rt", stdin);
#endif
  int n;cin >> n;
  map<int,int> mm;
  for(int i=1;i<=n;i++) mm[i] = 0;
  for(int i=2;i<=n;i++){
    int a;cin >> a;
    mm[a]++;
  } 
  for(int i=1;i<=n;i++) cout << mm[i] << endl;
  cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s\n";
  return 0;
}

Measured memory_bytes: 13200
K = gets.to_i
F = lambda{|a|
	return a.flat_map{|x|
		if x[-1] == ?0
			[x+?0, x+?1]
		elsif x[-1] == ?9
			[x+?8, x+?9]
		else
			[x+(x[-1].ord-1).chr, x+x[-1], x+(x[-1].ord+1).chr]
		end
	}
}
k, ルンルン = K, [*?1..?9] # in ascending order
k, ルンルン = k-ルンルン.size, F[ルンルン] until k <= ルンルン.size
puts ルンルン[k-1]


Measured memory_bytes: 15616
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using uint = unsigned int;
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include"rprint2.hpp"
#include"debug_deque.hpp"
#define vector DebugDeque
#else
#define FUNC(name) template <ostream& out = cout, class... T> void name(T&&...){ }
FUNC(prints) FUNC(printe) FUNC(printw) FUNC(printew) FUNC(printb) FUNC(printd) FUNC(printde);
#endif

template <class T>
struct SegTreeT{
    SegTreeT *l, *r;
    int left, right;
    T value = 0, maxi = 0;
    SegTreeT(int size):SegTreeT(0, size - 1){ }
    SegTreeT(int st, int lt): left(st), right(lt){
        if(left == right){
            l = r = nullptr;
        }else{
            int piv = (right + left) / 2;
            l = new SegTreeT(left, piv);
            r = new SegTreeT(piv + 1, right);
        }
    }
    T getMax(int st, int lt){
        if(right < st || lt < left){ return 0; }
        if(st <= left && right <= lt){
            return maxi;
        }else{
            return max(l->getMax(st, lt), r->getMax(st, lt)) + value;
        }
    }
    void add(int st, int lt, T val){
        if(right < st || lt < left){ return; }
        if(st <= left && right <= lt){
            value += val;
            maxi += val;
        }else if(l){
            l -> add(st, lt, val);
            r -> add(st, lt, val);
            maxi = max(l->maxi, r->maxi) + value;
        }
    }
};
using SegTree = SegTreeT<ll>;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, c;
    cin >> n >> c;
    // vector<SegTree> sts(c, 1e5 + 10);
    // SegTree st(1e5 + 10);
    struct STC {
        int s, t, c;
        STC(int s, int t, int c): s(s), t(t), c(c){ }
        bool operator < (const STC& e) const {
            return s != e.s ? s < e.s :
                t != e.t ? t < e.t:
                c < e.c;
        }
    };
    set<STC> st;
    for(int i = 0; i < n; i++){
        int s, t, c;
        cin >> s >> t >> c;
        // c--;
        // sts[c].add(s, t, 1);
        // st.add(s, t, 1);
        st.emplace(s, t, c);
        prints(st);
    }
    // ll ans = 0;
    // for(auto& st : sts){
    //     ans = max(ans, st.getMax(1, 1e5 + 9));
    // }
    // cout << ans << '\n';
    // cout << st.getMax(1, 1e5 + 9) << '\n';
    int ans = 0;
    while(st.size()){
        ans++;
        auto next = st;
        int t = -1, c = -1;
        for(auto& tv : st){
            if(t + (c != tv.c) <= tv.s){
                prints(tv);
                next.erase(tv);
                t = tv.t;
                c = tv.c;
            }
        }
        next.swap(st);
    }
    cout << ans << '\n';
}


Measured memory_bytes: 9600
#include <iostream>
#include <math.h>
using namespace std;

double ansf(double x, double y){
return sqrt(pow(x,2)+pow(y,2));
}

int main(){
 int n,d;
  double x,y;
  cin >> n >> d;
  int ans = 0;
  for(int i =0; i < n;i++){
  cin >> x >> y;
    if(ansf(x,y) <= d)
      ans++;
  
  
  }
  cout << ans << endl;
  
}


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

char H[200][200];

int main() {
	int h, w;
	while (cin >> h >> w, h) {
		rep(i, h)scanf("%s", H[i]);
		int x = 0, y = 0;
		map<P, bool>mp;
		while (1) {
			if (mp[P(x, y)]) {
				puts("LOOP");
				break;
			}
			if (H[x][y] == '.') {
				cout << y << ' ' << x << endl;
				break;
			}
			mp[P(x, y)] = true;
			if (H[x][y] == '>')y++;
			else if (H[x][y] == '<')y--;
			else if (H[x][y] == 'v')x++;
			else x--;
		}
	}
}

Measured memory_bytes: 3228
s = input()
N = s.count('N')
S = s.count('S')
W = s.count('W')
E = s.count('E')
if N==0 and S:
    print('No')
elif S==0 and N:
    print('No')
elif E==0 and W:
    print('No')
elif W==0 and E:
    print('No')
else:
    print('Yes')

Measured memory_bytes: 3060
#根付き木
n = int(input())
tree = []

for i in range(n):
    tree.append({})

for i in range(n):
    t = list(map(int, input().split()))
    node = t[0]
    children = t[2:2+t[1]]

    tree[node]['node'] = node
    tree[node]['parent'] = -1
    tree[node]['depth'] = 0
    tree[node]['children'] = children

#親を計算する
for i in range(n):
    for c in tree[i]['children']:
        tree[c]['parent'] = i

#depthを計算する
for i in range(n):
    depth = 0
    t = i
    isParent = False

    while(not isParent):
        if tree[t]['parent'] == -1:
            isParent = True
        else:
            t = tree[t]['parent']
            depth += 1
    
    tree[i]['depth'] = depth


for i in range(n):
    result = ''
    result += 'node '+str(tree[i]['node'])+': parent = '+str(tree[i]['parent'])+', depth = '+str(tree[i]['depth'])+', '
    if tree[i]['parent'] == -1:
        result += 'root, '
    elif tree[i]['children'] == []:
        result += 'leaf, '
    else:
        result += 'internal node, '

    result += '['
    
    r = ''
    for c in tree[i]['children']:
        r += str(c) + ', '

    result += r[:-2]
    result += ']'
    print(result)


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

using namespace std;
typedef long long ll;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) ll(x.size())
//typedef pair<int, int> P;
typedef pair<ll, ll> P;
//const double INF = 1e10;
//const ll INF = LONG_LONG_MAX;
const ll MINF = LONG_LONG_MIN;
const int INF = INT_MAX;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)

bool contain(set<char> &s, int a) { return s.find(a) != s.end(); }


//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

typedef priority_queue<ll, vector<ll>, greater<ll>> PQ_ASK;
const int mod = 1000000007;

int main() {
    char c;
    cin >> c;
    set<char> cs = {'a', 'i', 'u', 'e', 'o'};
    if (contain(cs, c)) {
        cout << "vowel" << endl;
    } else {
        cout << "consonant" << endl;
    }
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define int long long
using namespace std;
long double l;
signed main(){
	scanf("%Lf",&l);
	l/=3;
	l=l*l*l;
	printf("%.12Lf",l);
	return 0;
} 

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#define max 200000
#define end 2000000000
int L[max/2+2];
int R[max/2+2];
void zhu(int x[],int l,int m,int r)
{	int n1,n2,i,t,j;
	n1=m-l;n2=r-m;
		for(i=0;i<n1;i++)L[i]=x[l+i];
		for(i=0;i<n2;i++)R[i]=x[m+i];
	L[n1]=end;R[n2]=end;
	for(t=l,i=0,j=0;t<r;t++)
	{if(L[i]<R[j])
		x[t]=L[i++];
	else
		x[t]=R[j++];
	}
}
void fen(int x[],int l,int r)
{int m;	
	if(l+1<r)
	{m=(l+r)/2;
	fen(x,l,m);
	fen(x,m,r);
	zhu(x,l,m,r);
	}
}
using namespace std;
int main()
{int x[max],n,i;
scanf("%d",&n);
for(i=0;i<n;i++)
	scanf("%d",&x[i]);
fen(x,0,n);
for(i=1;i<n;i++)
	if(x[i]==x[i-1])
	{printf("NO");return 0;	}
printf("YES");
return 0;
}

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


//=============modinv============================
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;
}
//=================================================

//=============modcom============================
ll modcom(ll n, ll k, ll mod)
{
  k = min(k, n - k);
  ll up = 1;
  for (ll i = n - k + 1; i < n + 1; ++i)
  {
    up = (up * i) % mod;
  }
  ll down = 1;
  for (ll i = 2; i < k + 1; ++i)
  {
    down = (down * modinv(i, mod)) % mod;
  }
  return (up * down) % mod;
}
//=================================================

int main()
{
  ll mod = 1000000007;
  ll N, K;
  cin >> N >> K;
  vector<ll> A(N);
  ll up = 0, down = 0;
  for (ll i = 0; i < N; ++i)
  {
    cin >> A.at(i);
  }
  sort(A.begin(), A.end());
  ll temp;
  for (ll i = 0; i < N; ++i)
  {
    if (N - i - 1 < K - 1)
    {
      break;
    }
    if (i == 0)
    {
      temp = modcom(N - i - 1, K - 1, mod);
    }
    else
    {
      temp =  (temp * ((N - i - K + 1) * modinv(N - i, mod) % mod)) % mod;
    }
    up = up + (A.at(i) * temp) % mod;
    down = (down + (A.at(N - i - 1) * temp) % mod);
    if (up < 0)
    {
      up += mod;
    }
    up = up % mod;
    if (down < 0)
    {
      down += mod;
    }
    down = down % mod;
  }
  // cout << up << down << endl;
  ll ans = down - up;
  if (ans < 0)
  {
    ans += mod;
  }
  ans = ans % mod;
  cout << ans << endl;
}


Measured memory_bytes: 1024
/*
     Author:Raghav Bansal
     IIIT Una
                  */
#include <bits/stdc++.h>
#define int long long int
#define pb push_back
#define mp make_pair
#define all(v) v.begin(),v.end()
#define BOLT ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define X first
#define Y second
#define endl "\n"
using namespace std;
void solve() {
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	int turns = (c - 1) / b + 1;
	int turnsb = (a - 1) / d + 1;
	if (turns <= turnsb) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
}
int32_t main() {
	BOLT;
	solve();
}

Measured memory_bytes: 3652
#include <cstdio>
#include <algorithm>
#define MAXN 1100005
using namespace std;
int a[MAXN];
int fst[MAXN]={0};
int sec[MAXN]={0};
int temp[5];
int f[MAXN];
int main(void){
    int len,n;
    scanf("%d",&len);
    n=1<<len;
    for (int i=0;i<n;i++)
        scanf("%d",a+i);
    for (int i=0;i<n;i++)
        fst[i]=a[i];
    for (int l=0;l<len;l++){
        int tpow=1<<l;
        for (int i=1;i<n;i++){
            if (i&tpow){
                //Use i^tpow;
                int tfore=i^tpow;
                temp[0]=fst[i],temp[1]=sec[i];
                temp[2]=fst[tfore],temp[3]=sec[tfore];
                sort(temp,temp+4);
                fst[i]=temp[3],sec[i]=temp[2];
            }
        }
    }
    f[0]=fst[0];
    for (int i=1;i<n;i++)
        f[i]=max(f[i-1],fst[i]+sec[i]);
    for (int i=1;i<n;i++)
        printf("%d\n",f[i]);
    return 0;
}

Measured memory_bytes: 10112
#include<bits/stdc++.h>
using namespace std;
int h,w,d;
int mp[2005][2005];
void ran()
{
    for(int i=0;i<=2000;i++)
    {
        for(int j=0;j<=2000;j++)
        {
            int tmp=((i/(d))%2)*2+(j/(d))%2;
            mp[i][j]=tmp;
     //      cout<<tmp<<endl;
        }
    }
}
int main()
{
    cin>>h>>w>>d;
    ran();
    for(int i=1;i<=h;i++)
    {
        for(int j=1;j<=w;j++)
        {
            int x=i+j+500,y=i-j+500;
            if(mp[x][y]==0)putchar('R');
            else if(mp[x][y]==1)putchar('Y');
            else if(mp[x][y]==2)putchar('G');
            else putchar('B');
        }
        puts("");
    }
    return 0;
}


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

using namespace std;
using LL = long long;
using VI = vector<int>;
using PI = pair<int, int>;

int gcd(int a, int b) {
	return (b ? gcd(b, a % b) : a);
}

int main() {
	int x, y;
	cin >> x >> y;
	cout << gcd(x, y) << endl;
	return 0;
}



Measured memory_bytes: 3096
import sys

while 1:
	h, w = map(int, raw_input().split())
	if h == 0 and w == 0:
		break
	else:
		for i in xrange(h):
			if i == 0 or i == (h-1):
				for j in xrange(w):
					sys.stdout.write("#")
				print ""
			else:
				sys.stdout.write("#")
				for j in xrange(w-2):
					sys.stdout.write(".")
				print "#"
	print ""

Measured memory_bytes: 6356
N = [int(i) for i in input()]
n = N[::-1]+[0]

for i in range(len(n)-1):
    if n[i] >= 6 or (n[i] == 5 and n[i+1] >= 5):
        n[i] = 10 - n[i]
        n[i+1] += 1

    
print(sum(n))

Measured memory_bytes: 28272
<?php

fscanf(STDIN, "%d", $n);
$A = [];
for ($i = 0; $i < $n; ++$i) {
    fscanf(STDIN, "%d", $a);
    $A[] = $a;
}

$tmp = $A;
sort($tmp);
$max = $tmp[$n - 1];
$max2 = $tmp[$n - 2];

for ($i = 0; $i < $n; ++$i) {
    if ($A[$i] === $max) {
        echo $max2, PHP_EOL;
    } else {
        echo $max, PHP_EOL;
    }
}


Measured memory_bytes: 22388
#include <stdio.h>
#define true 1
#define false 0

int main(void)
{
    int n=0;
    int flag=false;
    scanf("%d",&n);

    for(int i=0;i<3;i++){
        if((n%10)%7==0 && (n%10)!=0){
            flag=true;
            break;
        }
        n=n/10;
    }

    if(flag==true){
        printf("Yes");
    } else {
        printf("No");
    }

    return 0;
}


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

int main(){
  int N;
  std::string S;
  std::cin >> N;
  std::cin >> S;
  
  if (N >= S.length()) std::cout << S;
  else {
    for (int i = 0; i < N ; i++) std::cout << S[i];
    std::cout << "...";
  }
  return 0;
}

Measured memory_bytes: 3112
using namespace std;

#include <cstdio>
#include <cstdint>
#include <cstring>
#include <string>
#include <cmath>
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>

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

    const double PI = 3.141592653589;
    double R;
    cin >> R;

    double ans;
    ans = 2.0 * PI * R;

    printf("%.4lf\n", ans);
    //cout << ans << "\n";
    return 0;
    
}


Measured memory_bytes: 3784
n, m, q = map(int, input().split())
tokutens = [list(input().split()) for i in range(q)]

import itertools
l = range(1, m+1)
sums = [0]
for v in itertools.combinations_with_replacement(l, n):
  v = list(v)
  sum = 0
  for a, b, c, d in tokutens:
    if v[int(b)-1] - v[int(a)-1] == int(c):
      sum+=int(d)
  sums.append(sum)

sums.sort(reverse=True)
print(sums[0])

Measured memory_bytes: 81004
/*************************************************\
           In the name of almighty ALLAH
                 MD.Faysal Hasan
                Comilla Univesity
\*************************************************/

#include<bits/stdc++.h>
using namespace std;

#define     ikarus_101  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef     long long             ll;
typedef     long double           ld;
typedef     unsigned long long    ull;
typedef     vector<ll>            vll;
typedef     pair<ll,ll>           pll;
typedef     vector<pll>           vpl;
typedef     map<ll,ll>            mll;
typedef     multiset<ll>          msl;
typedef     multimap<ll,ll>       Mll;
using pqboro=priority_queue<ll,vll,less<ll>>;
using pqchoto=priority_queue<ll,vll,greater<ll>>;

#define    all(str)       str.begin(),str.end()
#define    sajo(str)      sort(str.begin(),str.end())
#define    rev(str)       reverse(str.begin(),str.end())
#define    usajo(str)     sort(str.rbegin(),str.rend())
#define    vin(a)         for(auto &it : a) cin>>it
#define    vout(a)        for(auto it:a) cout<<it<<' ';cout<<nn
#define    vmax(a)        *max_element(all(a))
#define    vmin(a)        *min_element(all(a))
#define    pb             push_back
#define    eb             emplace_back
#define    mkp(x,y)       make_pair(x,y)
#define    F              first
#define    S              second
#define    yes            cout<<"Yes"<<nn
#define    no             cout<<"No"<<nn
#define    nn             "\n" ///endl
#define    rep(i,n)       for (i=0;i<n;++i )
#define    rep1(i,n)      for (i=1;i<=n;++i )

#define    min3(a,b,c)    min(a,min(b,c))
#define    max3(a,b,c)    max(a,max(b,c))
#define    sqr(x)         ((x)*(x))
#define    pi             2*acos(0.0)
#define    gcd(a,b)       __gcd(a,b)
#define    lcm(a,b)       (a/gcd(a,b))*b
#define    mem(a,b)       memset(a,b,sizeof (a))
#define    dec(x)         cout<<fixed<<setprecision(x)
#define    none(n)         __builtin_popcountll(n)

template < typename T > string toString ( T Number ) { stringstream ss ; ss << Number ; return ss.str() ; }
template < typename T > ll toll ( T str ) { stringstream ss ; ss << str ; ll num ; ss >> num ; return num ; }
ll power(ll n , ll k) { if(k == 0) return 1 ; if(k&1) return n*sqr(power(n,k/2)) ; else return sqr(power(n,k/2)); }

const   int  N   =   2e5+7;
const   int  M   =   1e9+7;
const   ll  inf  =   0x7f7f7f7f7f7f7f7f;
const   int dx[] =   {+1,+2,+2,+1,-1,-2,-2,-1};
const   int dy[] =   {-2,-1,+1,+2,+2,+1,-1,-2};

int main() {ikarus_101

    ll n,m,i,j,k,x;

    cin>>n;
    vll v(n);
    vin(v);
    ll mx = v.front();
    ll ct = 0;
    for(i=1;i<n;i++)
    {
        if(v[i] < mx) {
            ct += mx-v[i];
        }
        mx = max(mx,v[i]);
    }

    cout << ct << nn;










    return 0;
}


Measured memory_bytes: 4776
import java.util.Scanner


object Main {
  def read() = {
    val sc = new Scanner(System.in)
    val n = sc.nextInt()
    val h = for (_ <- 0 until n) yield sc.nextInt()
    (n, h)
  }

  def solve(n: Int, h: IndexedSeq[Int]): Int = {
    def canView(i: Int): Boolean = (0 until i).forall(h(_) <= h(i))
    (0 until n).count(canView)
  }


  def main(args: Array[String]): Unit = {
    val (n, h) = read()
    println(solve(n, h))
  }
}

Measured memory_bytes: 25532
#include <iostream>

int task(int n);

int N;
int main(){
    std::cin >> N;
    int num=0;
    for(int i=1;i<=N;i+=2){
        if(task(i) == 8){
            num++;
            //std::cout << i << std::endl;
        }
    }
    std::cout << num << std::endl;
}

int task(int n){
    int cnt = 0;
    for(int u=1;u<=n;u++){
        if(n%u==0){
            ++cnt;
        }
    }
    return cnt;
}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using ll = long long;
using vec = vector<ll>;
using vec2 = vector<vector<ll>>;
ll inf = pow(2,62);

int main(){
    ll n;cin >> n;
    string s;cin >> s;
    ll ans = 0;
    ll p = s.size();
    for(int i = 0;i < n-2;i++){
        if(s[i] == 'A' && s[i+1] == 'B' && s[i+2] == 'C'){
            ans++;
        }
    }
    cout << ans << endl;
}

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

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

using namespace std;

template <class T>
struct edge {
    size_t to;
    T cost;
    edge(size_t to, T cost = 1) : to(to), cost(cost) {}
};

template <class T>
class graph {
private:
    const size_t count_nodes;
    const bool is_directed;
public:
    vector<edge<T>> *edges;
    graph(size_t count_nodes, bool is_directed = true) : count_nodes(count_nodes), is_directed(is_directed) {
        edges = new vector<edge<T>>[count_nodes];
    }
    ~graph() {
        delete [] edges;
    }
    size_t size() const { return count_nodes; }
    void make_edge(size_t u, size_t v, T cost) {
        edges[u].push_back(edge<T>(v, cost));
        if (!is_directed)
            edges[v].push_back(edge<T>(u, cost));
    }
};

template <class T>
vector<T> dijkstra(const graph<T> &g, const int start) {
    vector<T> dist(g.size());
    bool *used = new bool[g.size()]();
    priority_queue<pair<T, size_t>, vector<pair<T, size_t>>, greater<pair<T, size_t>>> q;
    dist[start] = 0;
    q.push(pair<T, size_t>(dist[start], start));
    used[start] = true;
    while (!q.empty()) {
        T dist_v;
        size_t v;
        tie(dist_v, v) = q.top();
        q.pop();
        if (dist[v] < dist_v)
            continue;
        for (edge<T> e: g.edges[v]) {
            size_t w = e.to;
            T dist_v_w = dist_v + e.cost;
            if (!used[w] || dist[w] > dist_v_w) {
                dist[w] = dist_v_w;
                q.push(pair<T, size_t>(dist[w], w));
                used[w] = true;
            }
        }
    }
    delete [] used;
    return dist;
}

int main() {
    int H, W;
    cin >> H >> W;
    graph<int> g(10);
    REP(i, 10) REP(j, 10) {
        int c;
        cin >> c;
        g.make_edge(j, i, c);
    }
    vector<int> d = dijkstra(g, 1);
    int result = 0;
    REP(i, H) REP(j, W) {
        int A;
        cin >> A;
        if (A != -1) {
            result += d[A];
        }
    }
    cout << result << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

#define MAX 500000
#define INFTY 20000000000

long long L[MAX/2+2],R[MAX/2+2];
int cnt=0;

void merge(int A[],int left, int mid, int right){
  int n1 = mid - left;
  int n2 = right - mid;
  for(int i=0; i < n1; ++i)   L[i] = A[left + i];
  for(int i=0; i < n2; ++i)   R[i] = A[mid + i];
  L[n1] = INFTY;
  R[n2] = INFTY;
  int i = 0, j = 0;
  for(int k = left; k < right; ++k){
    ++cnt;
    if( L[i] <= R[j] ){
      A[k] = L[i++];
    }
    else{ 
      A[k] = R[j++];
    }
  }
}

void mergeSort(int A[],int left, int right){
  if( left+1 < right ){
    int mid = (left + right)/2;
    mergeSort(A, left, mid);
    mergeSort(A, mid, right);
    merge(A, left, mid, right);
  }
  
}

int main(){
  int n,A[MAX];
  cin >> n;
  for(int i=0; i<n; ++i)  cin >> A[i];

  mergeSort(A,0,n);

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


  return 0;
}



Measured memory_bytes: 8956
#include <algorithm>
#include <iostream> //入出力
#include <stdio.h>
#include <map>
#include <string>
#include <math.h>
#include <vector>
#include <cstdlib>
#include <queue>
#include <stack>
#include <list>
#include <iomanip> //小数点以下を表示させる(setprecision())
//#include <bits/stdc++.h>
using namespace std;
typedef long long ll; //64bit型

#define debug(x) cerr << x << " " \
                      << "(L:" << __LINE__ << ")" << '\n'
#define PRINT(V)                                   \
        {                                          \
                for (int i = 0; i < V.size(); i++) \
                {                                  \
                        cout << V[i] << " ";       \
                }                                  \
                cout << endl;                      \
        }

int gcd(int a, int b)
{
        return b ? gcd(b, a % b) : a;
}
int mod = 1000000000 + 7;
int dp[101][4][4][4];
int main()
{
        //input->compute->output//

        int a, b, c, d, e, k;
        cin >> a >> b >> c >> d >> e >> k;
        cout << ((e - a) > k ? ":(" : "Yay!") << endl;

        return 0;
}


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

bool IsPalin(std::string& s, int left, int right)
{
    for (int i = left; i <= (right + left) / 2; ++i)
        if (s[i] != s[right - i])
            return false;
    return true;
}

int main()
{
    std::string input;
    std::cin >> input;

    int n = input.size();
    std::cout << (IsPalin(input, 0, n-1) && IsPalin(input, 0, (n-1)/2 - 1) && IsPalin(input, (n+3)/2 - 1, n-1) ? "Yes" : "No");

    return 0;
}

Measured memory_bytes: 256
H, W = map(int, input().split())

if H == 1 or W == 1:
    print(1)
else:
    # 一般に、正整数 x, y に対し、x/y を切り上げた値は (x + y − 1)//y 
    # (// は整数除算) として実装できる
    # この場合H*W+2-1
    print((H*W+1)//2)

Measured memory_bytes: 9056
#include <set>
#include <map>
#include <queue>
#include <ctime>
#include <cmath>
#include <cstdio>
#include <bitset>
#include <vector>
#include <cstring>
#include <cassert>
#include <iostream>
#include <algorithm>
using namespace std;
typedef double db;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pa;
typedef unsigned int uint;
typedef unsigned long long ull;
#define w1 first
#define ls (x<<1)
#define w2 second
#define ins insert
#define rs (x<<1|1) 
#define mp make_pair
#define pb push_back
#define mid ((l+r)>>1)
#define sqr(x) ((x)*(x))
#define cle(x) ((x).clear())
#define lowbit(x) ((x)&(-x))
#define SZ(x) (int((x).size()))
#define All(x) (x).begin(),(x).end()
#define ms(x,y) memset(x,y,sizeof (x))
#define rep(i,a,b) for(int (i)=(a);(i)<=(b);(i)++)
#define rep2(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define per(i,a,b) for(int (i)=(a);(i)>=(b);(i)--)
#define Rep(p,x) for(int (p)=head[(x)];(p);(p)=nxt[(p)]) 
#define Rep2(p,x) for(int (p)=cur[(x)];(p);(p)=nxt[(p)])
template<class T>inline void read(T&num){
	num=0;T f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9')num=num*10+ch-'0',ch=getchar();
	num*=f;
}
inline int getgcd(int x,int y){if(!x)return y;return getgcd(y%x,x);}
inline int power(int x,int k,int p){int res=1;for(;k;k>>=1,x=(ll)x*x%p)if(k&1)res=(ll)res*x%p;return res;}
const double pi=acos(-1);	
inline void judge(){
	freopen("input.txt","r",stdin);
} 
//********************************head*************************************
const int maxn=3e5+5;
int n,m;
int c[maxn];
vector<int>e[maxn];
void M(int x,int num){
	for(;x<=m;x+=lowbit(x))c[x]+=num;
}
int Q(int x){
	int res=0;
	for(;x;x-=lowbit(x))res+=c[x];
	return res;
}
int main(){
	read(n);read(m);
	rep(i,1,n){
		int l,r;read(l);read(r);
		e[r-l+1].pb(l);
	}
	rep(i,1,m){
		int ans=n;
		for(int j=i;j<=m;j+=i)ans+=Q(j);
		rep2(j,0,SZ(e[i]))M(e[i][j],1),M(e[i][j]+i,-1),n--;
		printf("%d\n",ans);
	}
	return 0;
}


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

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

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

    ll H,A,B; cin >> H >> A >> B;
    ll ans = 0;

    for (int i = A;i <= B;i++){
        if(H%i == 0) ans++;
    }

    cout << ans << endl;

    return 0;

}


Measured memory_bytes: 3160
#pragma GCC optimize ("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge {c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

typedef long long ll;
typedef long double ld;

struct P {
	ll x, y;
	P operator - (P he) { return P{x - he.x, y - he.y}; }
	ll operator * (P he) { return x * he.y - y * he.x; }
	ld angle() { return atan2(y, x); }
	void read() {
		cin >> x >> y;
	}
	ll dot(P he) { return x * he.x + y * he.y; }
	bool operator < (P he) { return *this * he < 0; }
};

int main() {
	int n;
	cin >> n;
	vector<P> in(n);
	for(P & p : in) p.read();
	for(int i = 0; i < n; ++i) {
		vector<P> they;
		for(int j = 0; j < n; ++j) if(j != i) they.push_back(in[j] - in[i]);
		int small = 0, big = 0;
		for(int j = 0; j < (int) they.size(); ++j) {
			if(they[j] < they[small])
				small = j;
			if(they[big] < they[j])
				big = j;
		}
		bool ok = true;
		for(P p : they) {
			if(they[small] < p || (p * they[small] == 0 && p.dot(they[small]) > 0)) {}
			else {
				ok = false;
				break;
			}
		}
		if(!ok) {
			puts("0");
			continue;
		}
		if(they[small] * they[big] == 0) {
			puts("0.5");
			continue;
		}
		they[small].x *= -1;
		they[small].y *= -1;
		ld x = abs(they[small].angle() - they[big].angle());
		x /= 4 * acosl(0);
		x = min(x, 1 - x);
		printf("%.10Lf\n", x);
	}
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
const int maxn=5005,mod=1e9+7;
struct Edge{
	int to,nxt;
}e[2*maxn];
int cnt;
int head[maxn];
int son[maxn];
long long dp1[maxn][maxn],dp2[maxn][maxn],g[maxn];
int read(){
    int x=0,y=1;
    char ch=getchar();
    while(ch<48||ch>57){if(ch==45)y=-1;ch=getchar();}
    while(ch>=48&&ch<=57)x=(x<<3)+(x<<1)+(ch^48),ch=getchar();
    return x*y;
}
void add(int u,int v){
	e[cnt].to=v;
	e[cnt].nxt=head[u];
	head[u]=cnt++;
	return ;
}
void dfs(int x,int fa){
	son[x]=1;
	dp1[x][1]=1;
	for(int i=head[x];i!=-1;i=e[i].nxt){
		int tmp=e[i].to;
		if(tmp==fa)continue;
		dfs(tmp,x);
		for(int j=0;j<=son[x];j++)
			for(int k=0;k<=son[tmp];k++)
				(dp2[x][j+k]+=dp1[x][j]*dp1[tmp][k]%mod)%=mod;
		son[x]+=son[tmp];
		for(int j=0;j<=son[x];j++)dp1[x][j]=dp2[x][j],dp2[x][j]=0;
	}
	for(int j=1;j<=son[x];j++)dp1[x][0]=(dp1[x][0]-dp1[x][j]*g[j]%mod)%mod;
	return ;
}
int main(){
//    freopen("AT4352.in","r",stdin);
//    freopen("AT4352.out","w",stdout);
	int n;
	n=read();
	memset(head,-1,sizeof(head));
	for(int i=1;i<n;i++){
		int u,v;
		u=read();v=read();
		add(u,v);
		add(v,u);
	}
	g[0]=1;
    for(int i=2;i<=n;i+=2)g[i]=g[i-2]*(i-1)%mod;
	dfs(1,0);
	printf("%lld\n",(mod-dp1[1][0])%mod);
    return 0;
}


Measured memory_bytes: 180684
#include<iostream>
#include<string>
#include<algorithm>
#include<math.h>
#include<queue>
#include<vector>
#include<map>
#include<iomanip>
#include<tuple>
#include<bitset>


using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define printfloat(x) cout << fixed << setprecision(7) << (x) << endl;
#define printbit(x) cout << bitset<15>(x) << endl;
using ll = long long int;



long double pi = 3.14159265359;

int t;

int main(){
    cin >> t;
    if(t >= 30){
        cout << "Yes" << endl;
    }
    else cout << "No" << endl;


return 0;
}

Measured memory_bytes: 3592
a,b,c=(int(i) for i in input().split())
k=int(input())
while(k>0 and b<=a):
  b*=2
  k-=1
if(k==0):
  if(c>b and b>a):
    print("Yes")
  else:
    print("No")
else:
  while(k>0):
    c*=2
    k-=1
  if(c>b and b>a):
    print("Yes")
  else:
    print("No")

Measured memory_bytes: 9196
#include <bits/stdc++.h>
using namespace std;
const int MAXN=1e5+7;
const int mo=1e9+7;
#define ll long long
int a[MAXN],n,m,win;
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++) cin>>a[i];
	for(int i=1;i<=n;i++) if(a[i]%2==1) win=1;
	if(win==1) cout<<"first";
	else cout<<"second";
}

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

//ABC126A
int main(void) {
  char a[50];
  int n,k, i, cou=0, tmp;
  scanf("%d %d %s", &n, &k, a);
  for(i=0; i<n; ++i){
    if(i == k - 1){
      if(a[i] == 'A') printf("a");
      else if(a[i] == 'B') printf("b");
      else if(a[i] == 'C') printf("c");
    } else printf("%c", a[i]);
  }
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
const int MX = 200005;
#define RET(ans) {cout<<ans<<endl;return 0;} 

    // 二次元ベクターの基本
    /*
    vector<vector<int>> dp; // 宣言
    dp.resize(n); // 1次元めの要素数決定
    dp[i].push_back(int); // プッシュバック
    rep(i,n){
        sort(dp[i].begin(),dp[i].end()); // 二次元めを昇順ソート
    }
    */

    // 整数スキャン（複数）
    /*
    int x,y,z;
    scanf("%d%d%d",&x,&y,&z);

    // n個の整数のスキャン
    /*
    ll a[n] = {};
    rep(i,n){
        scanf("%lld",&a[i]);
    }
    */

    // 文字列スキャン
    /*
    string s; cin >> s;
    */

    // n個の文字列スキャン
    /*
    vector<string> slist;
    rep(i,n){
        string s; cin >> s;
        slist.push_back(s);
    }
    */

int main() {
    int a,b,c;
    cin >> a >> b >> c;

    if(min(a,b)<c&&c<max(a,b))yn;
    return 0;
}
 
 


Measured memory_bytes: 256
import java.util.*; 
import java.io.*;
 
public class Main {
	public static void main(String[] args) {
		InputReader in = new InputReader(System.in);
	     int t = 1;
	     while(t-- > 0) {
	    	long x = in.readLong();
	    	long y = in.readLong(); 
	    
	    	long ans = 0; 
	    	while(x <= y) {
	    		x *= 2;  
	    		ans++; 
	    	}
	    	System.out.println(ans); 
	     }
	}
}

class InputReader{
	private InputStream stream;
	private byte[] buf = new byte[1024];
	private int curChar;
	private int numChars;
	private SpaceCharFilter filter;

	public InputReader(InputStream stream) {
		this.stream = stream;
	}

	
    public int read() {
		if (numChars == -1)
			throw new InputMismatchException();
		if (curChar >= numChars) {
			curChar = 0;
			try {
				numChars = stream.read(buf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (numChars <= 0)
				return -1;
		}
		return buf[curChar++];
	}

	
    public int readInt() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		int res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	
    public String readString() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		StringBuilder res = new StringBuilder();
		do {
			res.appendCodePoint(c);
			c = read();
		} while (!isSpaceChar(c));
		return res.toString();
	}

	
    public long readLong() {
		int c = read();
		while (isSpaceChar(c)) {
			c = read();
		}
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		long res = 0;
		do {
			if (c < '0' || c > '9') {
				throw new InputMismatchException();
			}
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}
	
	
    public boolean isSpaceChar(int c) {
		if (filter != null)
			return filter.isSpaceChar(c);
		return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	}

	
    public String next() {
		return readString();
	}

	
    public interface SpaceCharFilter {
		public boolean isSpaceChar(int ch);
	}
}


Measured memory_bytes: 24660
#include<bits/stdc++.h>
using namespace std;
int main(){
    double a,b,x;
    cin >> a >> b >> x;
    if(x/(a*b*a) > 1/2.0){
        // a(b+(b-atanθ))/2 == x/a
        cout << setprecision(8) << (180*atan(-2*x/pow(a,3)+2*b/a)/M_PI) << endl;
    }else{
        // b^2tan(90-θ)/2 == x/a
        cout << setprecision(8) << (180*atan(pow(b,2)*a/(2*x))/M_PI) << endl;
    }
}

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

int main() {
    int n, q; std::cin >> n >> q;
    std::string s; std::cin >> s;
    std::vector<int> r(n+1);
    std::vector<int> l(n+1);
    int c = 0;
    int d = 0;
    for (int i = 0; i < n; i++) {
        if (i > 0 && s[i] == 'C' && s[i-1] == 'A') {
            c++;
        }
        r[i+1] = c;
        if (i + 1 < n && s[i] == 'A' && s[i+1] == 'C') {
            d--;
        }
        l[i+1] = d;
    }
    std::vector<std::pair<int, int>> v;
    for (int i = 0; i < q; i++) {
        int ll, rr; std::cin >> ll >> rr;
        v.push_back({ll, rr});
    }

    /*
    for (int i = 0 ; i <= n; i++) {
        std::cout << l[i] << " " << r[i] << std::endl;
    }
    //*/

    for (const auto& vv: v) {
        std::cout << (r[vv.second] + l[vv.first-1]) << std::endl;
    }


    return 0;
}

Measured memory_bytes: 4680
#include<stdio.h>
int main(void)
{
	int b1,b2,b3;
	scanf("%d %d %d",&b1,&b2,&b3);
	if(b1==1 && b2==0 && b3==0) {
		printf("Close\n");
	}
	if(b1==0 && b2==1 && b3==0) {
		printf("Close\n");
	}
	if(b1==1 && b2==1 && b3==0) {
		printf("Open\n");
	}
	if(b1==0 && b2==0 && b3==1) {
		printf("Open\n");
	}
	if(b1==0 && b2==0 && b3==0) {
		printf("Close\n");
	}
	return 0;
}

Measured memory_bytes: 584
def main():
    L, R = map(int, input().split(" "))

    r1 = L // 2019 
    r2 = R // 2019
    
    if r2 - r1 >= 1:
        return 0

    # r2 == r1
    L0 = L % 2019
    R0 = R % 2019
    range_ = range(L0, R0+1)

    out = min([ i * j % 2019 for i in range(L0, R0+1) for j in range(i+1, R0+1)])
    return out

out = main()
print(out)

Measured memory_bytes: 75412
N = int(input())
data = list(map(int,input().split()))
data.sort(reverse=True)
alice = 0
bob = 0
for i in range(len(data)):
    if i%2 == 0:
        alice += data[i]
    elif i%2 == 1:
        bob += data[i]
        
print(alice-bob)


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

int main()
{
    int n, a, c = 0;
    scanf("%d", &n);

    if(n == 1) printf("Hello World\n");

    else if(n == 2)
    {
        for(int i=1; i<=2; i++)
        {
            scanf("%d", &a); c += a;
        }
        printf("%d\n", c);
    }
    return 0;
}


Measured memory_bytes: 384