akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <string>

using namespace std;

using ll = long long;
using ull = unsigned long long;
template<class T> using v = vector<T>;
template<class T, class U> using p = pair<T, U>;

#define REP(i, n) for(ll i = 0; i < n; ++i)
#define REP1(i, n) for(ll i = 1; i <= n; ++i)
#define REP2(i, B, E) for(ll i = B; i <= E; ++i)

template<class T> T read() { T x{}; cin >> x; return x; }
template<class T> v<T> read(int N){ v<T> x(N); REP(i, N) cin >> x[i]; return x; }

template<class T>
void write(const T &x){ cout << x << endl; }
void write(double x){ printf("%.15f\n", x); }

template<class T> T& chmin(T &obj, T val){ return obj = min(obj, val); }
template<class T> T& chmax(T &obj, T val){ return obj = max(obj, val); }

// 二分探索 : [low, high) の範囲で述語 pred がtrue を返す最大の値を返す
template<class Pred>
ll bsearch(ll low, ll high, Pred pred){
    while(low + 1 < high){
        const ll mid = low + (high - low) / 2;
        if(pred(mid)){ low = mid; }
        else{ high = mid; }
    }
    return low;
}


const ll MOD = (ll)1e9 + 7;


int main() {
    ll N, M;
    cin >> N >> M;
    v<ll> p(M);
    v<string> S(M);
    REP(i, M) cin >> p[i] >> S[i];
    v<ll> ac(N+1), wa(N+1);
    
    REP(i, M){
        if(S[i] == "AC"){
            ac[p[i]] = 1;
        }
        if(S[i] == "WA" && ac[p[i]] == 0){
            wa[p[i]] += 1;
        }
    }
    ll nac = 0, nwa = 0;
    REP1(i, N){
        nac += ac[i];
        if(ac[i] > 0){
            nwa += wa[i];
        }
    }
    cout << nac << " " << nwa << endl;
}



Measured memory_bytes: 8064
// 1192_TaxRateChanged.cpp
//
#include <bits/stdc++.h>
using namespace std;
const int MAX_S = 1010;
int x, y, s;
int p[MAX_S];
void solve() {
  memset(p, 0, sizeof(p));
  for(int i = 1; i < s; ++i)
    for(int j = 1; j < s; ++j)
      if(i*(100+x)/100 + j*(100+x)/100 == s) p[i] = i*(100+y)/100 + j*(100+y)/100;

  cout << *max_element(p, p + s) << endl;
}
int main() {
  while(cin >> x >> y >> s) {
    if(x == 0 && y == 0 && s == 0) break;
    solve();
  }
  return 0;
}



Measured memory_bytes: 3076
n, x = map(int, input().split())
a = [0] + list(map(int, input().split()))
cnt = 0
for i in range(n) :
  if(a[i] + a[i+1] > x) :
    cnt += (a[i] + a[i+1]) - x
    a[i+1] -= (a[i] + a[i+1]) - x
print(cnt)

Measured memory_bytes: 14252
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<cstdio>
#include<unordered_map>
using namespace std;
//---------------------------------------------------
//ライブラリゾーン！！！！
typedef long long ll;
typedef long double ld;
#define str string
#define rep(i,j) for(ll i=0;i<(long long)(j);i++)
const ll Mod = 1000000007;
const ll gosenchou = 5000000000000000;
short gh[2][4] = { { 0,0,-1,1 },{ -1,1,0,0 } };
struct P {
	ll pos, cost;
};
bool operator<(P a, P b) { return a.cost < b.cost; }
bool operator>(P a, P b) { return a.cost > b.cost; }
struct B {//隣接リスト表現
	ll to;
	ld cost;
};
struct E {//辺の情報を入れる変数
	ll from, to, cost;
};
bool operator<(E a, E b) {
	return a.cost < b.cost;
}
struct H {
	ll x, y;
};
bool operator<(H a, H b) {
	if (a.x != b.x) return a.x < b.x;
	return a.y < b.y;
}
bool operator>(H a, H b) {
	if (a.x != b.x) return a.x > b.x;
	return a.y > b.y;
}
bool operator==(H a, H b) {
	return a.x == b.x&&a.y == b.y;
}
bool operator!=(H a, H b) {
	return a.x != b.x || a.y != b.y;
}
ll gcm(ll i, ll j) {//最大公約数
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcm(j%i, i);
}
ld rad(H a, H b) {
	return sqrt(pow(a.x - b.x, 2.0) + pow(a.y - b.y, 2.0));
}//rad＝座標上の2点間の距離
ll ari(ll a, ll b, ll c) {
	return (a + b)*c / 2;
}//等差数列の和
bool suf(ld a, ld b, ld c, ld d) {
	if (b <= c || d <= a) return 0;
	return 1;
}//[a,b),[c,d)
ll fact(ll x, ll k,ll p) {//最大値、個数
	ll sum = 1;
	for (int i = 0; i < k; i++) {
		sum *= (x--);
		sum %= p;
	}
	return sum;
}//階乗(正）
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res*x%p;
		x = x*x%p;
		n >>= 1;
	}
	return res;
}//x^n%p
#define int long long
const long long inf = 4523372036854775807;
const int iinf = 1500000000;
//----------------------------------------------------
//++++++++++++++++++++++++++++++++++++++++++++++++++++
int n;
int a[1000];
signed main() {
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> a[i];
	int ans = -1;
	for (int i = 0; i < n; i++) {
		for (int j = i + 1; j < n; j++) {
			int k = a[i] * a[j];
			string s = to_string(k);
			int z = 1;
			while (z < s.size() && s[z] == s[z - 1] + 1)
				z++;
			if (z == s.size())
				ans = max(ans, k);
		}
	}
	cout << ans << endl;
	getchar(); getchar();
}


Measured memory_bytes: 3312
#include<iostream>
#include<iomanip>
#include<string>
#include<cmath>
using namespace std;

int main(){
    long N,K;
    double p = 0.0;
    long c;

    cin >> N >> K;

    for(long n=1;n<=N;n++){
        if(n >= K){
            c = 0;
        }
        else{
            c = ceil(log2((double)K/(double)n));
        }
        p += pow(0.5, c) / N;
    }
    cout << setprecision(12) << p << endl;

    return 0;
}

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

//?¬????(n)????????§???
#define N 100

double p1(int x[], int y[], int n);
double p2(int x[], int y[], int n);
double p3(int x[], int y[], int n);
double pInfinity(int x[], int y[], int n);
double getMax(double d[], int n);

int main() {
	
	//n?¬????????????????
	int n;
	
	int x[N];
	int y[N];
	
	int p;
	
	int i;
	
	//----------------------------------------------------------
	//---------------------?????°??£?¨????????????§---------------------
	//----------------------------------------------------------
	
	scanf("%d", &n);
	
	for (i = 0; i < n; i++) {
		scanf("%d", &x[i]);
	}
	
	for (i = 0; i < n; i++) {
		scanf("%d", &y[i]);
	}
	
	printf("%.6f\n", p1(x, y, n));
	printf("%.6f\n", p2(x, y, n));
	printf("%.6f\n", p3(x, y, n));
	printf("%.6f\n", pInfinity(x, y, n));
	
	return 0;
}

double p1(int x[], int y[], int n) {
	
	double d = 0;
	int i;
	
	for (i = 0; i < n; i++)	d += abs(x[i] - y[i]);
	
	return d;
	
}

double p2(int x[], int y[], int n) {
	
	double d = 0;
	int i;
	
	for (i = 0; i < n; i++) {
		d += pow(abs(x[i] - y[i]), 2);
	}
	
	d = sqrt(d);
	
	return d;
}

double p3(int x[], int y[], int n) {
	
	double d = 0;
	int i;
	
	for (i = 0; i < n; i++) {
		d += pow(abs(x[i] - y[i]), 3);
	}
	
	//???3???????????????3??????1????????¨?¨??????????????????¨?????§?????????
		//pow(double x, double y)??????????¨??????????????????????
	d = pow(d, 1.0 / 3.0);
	
	return d;
}

double pInfinity(int x[], int y[], int n) {
	
	double d[N] = {0};
	int i;
	
	for (i = 0; i < n; i++) {
		d[i] = abs(x[i] - y[i]);
	}
	
	return getMax(d, n);
}

double getMax(double d[], int n) {
	
	double max = -2100000000;
	int i;
	
	for (i = 0; i < n; i++) {
		max = max < d[i] ? d[i] : max;
	}
	
	return max;
	
}

Measured memory_bytes: 700
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;

class Program
{
    internal static void Main(string[] args)
    {
        var N = int.Parse(ReadLine());
        var C = new List<int>();
        var S = new List<int>();
        var F = new List<int>();
        for (int i = 0; i < N - 1; i++) {
            var inp = ReadLine().Split(' ').Select(s => int.Parse(s)).ToList();
            C.Add(inp[0]);
            S.Add(inp[1]);
            F.Add(inp[2]);
        }

        var ans = new List<int>();
        for (int i = 0; i < N; i++) {
            if (i == N - 1) {
                ans.Add(0);
            } else {
                ans.Add(C[i] + S[i]);
            }
        }

        for (int i = 0; i < N - 2; i++) {
            for (int j = 1; j < N - (i + 1); j++) {
                if (ans[i] > S[i + j]) {
                    int hoge = S[i + j];
                    while (ans[i] > hoge) {
                        hoge += F[i + j];
                    }
                    ans[i] = hoge + C[i + j];
                } else if (ans[i] < S[i + j]) {
                    ans[i] = S[i + j] + C[i + j];
                } else {
                    ans[i] += C[i + j];
                }
            }
        }

        foreach (int i in ans) {
            WriteLine(i);
        }
    }
}


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

int main() {
  int n;
  int ans=0;
  cin>>n;
  vector<int>p(n);
  for(int i=0;i<n;i++){
    cin>>p.at(i);
  }
  for(int i=1;i<n-1;i++){
    if(p.at(i-1)<p.at(i) && p.at(i)<p.at(i+1)){
      ans+=1;
    }
    if(p.at(i-1)>p.at(i) && p.at(i)>p.at(i+1)){
      ans+=1;
    }
  }
  cout<<ans<<endl;
}





Measured memory_bytes: 256
#include <assert.h>
#include <math.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define REP(i, n) FOR(i, 0, n - 1, 1)
#define REP1(i, n) FOR(i, 1, n, 1)
#define RREP(i, n) RFOR(i, n - 1, 0, 1)
#define RREP1(i, n) RFOR(i, n, 1, 1)
#define FOR(i, a, b, c) for (ll i = a; i <= (ll)b; i += c)
#define RFOR(i, a, b, c) for (ll i = a; i >= (ll)b; i -= c)
#define MAX(a, b) (a > b ? a : b)
#define MIN(a, b) (a < b ? a : b)
#define MAX3(a, b, c) MAX(MAX(a, b), c)
#define MIN3(a, b, c) MIN(MIN(a, b), c)
#define SWAP(a, b) do { typeof(a) _t; _t = a; a = b; b = _t; } while (0)
#define SORT(a, n) qsort(a, n, sizeof(typeof(a)), ({ int _f (const void *_a, const void *_b) { return *(typeof(a) *)_a - *(typeof(a) *)_b; } _f; }))
#define RSORT(a, n) qsort(a, n, sizeof(typeof(a)), ({ int _f (const void *_a, const void *_b) { return *(typeof(a) *)_b - *(typeof(a) *)_a; } _f; }))
#define SUM(a, n) ({ typeof(*(a)) _s = 0; REP(_i, n) _s += (a)[_i]; _s; })
#define PROD(a, n) ({ typeof(*(a)) _p = 1; REP(_i, n) _p *= (a)[_i]; _p; })
#define CNT(x, a, n) ({ int _c = 0; REP(_i, n) if ((a)[_i] == x) _c++; _c; })
#define MAXI(a, n) ({ int _m = 0; REP(_i, n) if ((a)[_i] > (a)[_m]) _m = _i; _m; })
#define MAXM(a, n) a[MAXI(a, n)]
#define MINI(a, n) ({ int _m = 0; REP(_i, n) if ((a)[_i] < (a)[_m]) _m = _i; _m; })
#define MINM(a, n) a[MINI(a, n)]
#define INF 1073709056
#define LLINF 4611686016279904256LL
typedef long long ll;

int main() {
    int x, a, b;
    scanf("%d %d %d", &x, &a, &b);
    if (a >= b) puts("delicious");
    else if (b - a <= x) puts("safe");
    else puts("dangerous");
    return 0;
}

Measured memory_bytes: 128
import java.util.*;
import java.lang.*;
import java.io.*;

public class Main{
	public static void main (String[] args){
		Scanner sc = new Scanner(System.in);
		int a = Integer.parseInt(sc.next());
		int b = Integer.parseInt(sc.next());
		System.out.println((b-a)%2 == 0 ? (b+a)/2 : "IMPOSSIBLE");
	}
}


Measured memory_bytes: 21716
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int gcd(int x, int y) {
    if (x < y) swap(x, y);
    int r = x%y;
    if (r == 0) {
        return y;
    }
    return gcd(y, r);
}

int main(){
    int N;
    ll K;
    cin >> N >> K;
    vector<int> A(N);
    for (int i=0; i<N; i++) {
        cin >> A[i];
        A[i]--;
    }
    vector<int> tele(0);
    tele.emplace_back(0);
    ll k = 0;
    map<int, int> hist;
    while(k < K) {
        if (hist.count(tele[k])) {
            break;
        }
        else {
            hist[tele[k]] = 1;
        }
        tele.emplace_back(A[tele[k]]);
        k++;
    }
    int search = tele[tele.size()-1];
    vector<int> loop(0);
    loop.emplace_back(search);
    for (int i=tele.size()-2; i>=0; i--) {
        if (tele[i] == search) break;
        else {
            loop.emplace_back(tele[i]);
        }
    }
    reverse(loop.begin(), loop.end());
    ll teleSize = tele.size();
    ll loopSize = loop.size();
    ll firstTeleSize = teleSize - loopSize;
    int r = (K - firstTeleSize)%loopSize;
    cout << loop[r] + 1 << endl;
}

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

using namespace std;

#define int long long

signed main(){
	int C[101][101];
	C[0][0]=1;
	for(int i=1;i<=100;i++){
		C[i][0]=1;
		for(int j=1;j<i+1;j++){
			C[i][j]=C[i-1][j]+C[i-1][j-1];
		}
	}
	int n,m;
	cin >> n >> m;
	//cout << C[n][2] << endl;
	//cout << C[m][2] << endl;
	if(n>=2&&m>=2)
		cout << C[n][2]+C[m][2] << endl;
	else if(n>=2)
		cout << C[n][2] << endl;
	else if(m>=2)
		cout << C[m][2] << endl;
	else
		cout << 0 << endl;
}

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

typedef long long ll;

#define PB push_back
#define MP make_pair

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
    int n; cin >> n;
    vector<int> a(100001, 0), b(100001, 0);
    int v;
    for (int i = 0; i < n; ++i) {
        cin >> v;
        if (i & 1) a[v]++;
        else b[v]++;
    }

    int ans;
    int am = max_element(a.begin(), a.end()) - a.begin();
    int bm = max_element(b.begin(), b.end()) - b.begin();
    if (am != bm) ans = n - a[am] - b[bm];
    else {
        sort(a.rbegin(), a.rend());
        sort(b.rbegin(), b.rend());
        ans = min(n - a[0] - b[1], n - a[1] - b[0]);
    }
    cout << ans << "\n";
}

Measured memory_bytes: 3964
#include <stdio.h>

int main()
{int k,arr[]={0,1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
scanf("%d",&k);
printf("%d",arr[k]);
    return 0;
}


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

#define FI(i,a,b) for(int i=(a);i<=(b);i++)
#define FD(i,a,b) for(int i=(a);i>=(b);i--)

#define LL long long
#define Ldouble long double
#define PI 3.14159265358979323846264338327950288419

#define PII pair<int,int>
#define PLL pair<LL,LL>
#define mp make_pair
#define fi first
#define se second

using namespace std;

int ans, fail;

int n, in;

int main(){
	scanf("%d", &n);
	ans = fail = 1;
	FI(i, 1, n){
		scanf("%d", &in);
		ans *= 3;
		if(in % 2 == 0) fail *= 2;
	}
	printf("%d\n", ans - fail);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rrep(i, n) for(int i = 0; i <= (n); i++)
using namespace std;
typedef long long ll;
 
const ll INF = 1LL<<60;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using Graph = vector<vector<int>>;

typedef pair<int, int> P;
typedef priority_queue<int, vector<int>, greater<int>> PQ;
const int MOD = 1000000007;

int main(){
    int N, M; cin >> N >> M;
    vector<int> A(N);
    rep(i,N) cin >> A[i];

    vector<int> cum(N+1,0);
    rep(i,N){
        cum[i+1] = (cum[i] + A[i]) % M;
    }

    map<int, int> counter;
    ll ans = 0;
    rep(i,N+1){
        ans += counter[cum[i]];
        counter[cum[i]]++;
    }

    cout << ans << endl;
}

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

#define ll long long
#define ld long double
#define ull unsigned long long

#define db(x) cerr << #x << " = " << x << endl
#define db2(x, y) cerr << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")\n"
#define db3(x, y, z) cerr << "(" << #x << ", " << #y << ", " << #z << ") = (" << x << ", " << y << ", " << z << ")\n"

using namespace std;

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

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

    vector<int> v(n);
    for (int &x : v)
        cin >> x;

    sort(v.begin(), v.end());
    ll sum = 0;
    int res = n;
    for (int i = n - 1; i >= 0; --i)
    {
        if (sum + v[i] < k)
            sum += v[i];
        else
            res = min(res, i);
    }

    cout << res << '\n';

    return 0;
}

Measured memory_bytes: 256
SA = input()
SB = input()
SC = input()

turn = 'a'

while True:
    if turn == 'a':
        if len(SA) == 0:
            res = 'A'
            break
        turn = SA[0]
        SA = SA[1:]
    elif turn == 'b':
        if len(SB) == 0:
            res = 'B'
            break
        turn = SB[0]
        SB = SB[1:]
    elif turn == 'c':
        if len(SC) == 0:
            res = 'C'
            break
        turn = SC[0]
        SC = SC[1:]

print(res)

Measured memory_bytes: 3064
#include <iostream>

using namespace std;

int main(int argc, char const *argv[])
{
    int X;
    cin >> X;

    int mod = X % 100;
    int cnt = X / 100;
    
    if ((mod + 5 - 1) / 5 <= cnt)
    {
        cout << 1 << endl;
    }else
    {
        cout << 0 << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <set>
typedef long long ll;
typedef unsigned int uint;
using namespace std;

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

    string s;
    int k;
    cin >> s >> k;

    int len = s.length();
    for (int i = 0; i < len; i++) {
        if (s[i] == 'a') continue;
        if ('z' - s[i] < k) {
            k  = k - ('z' - s[i]) - 1;
            s[i] = 'a';
        }
    }

    k %= 26;
    s[len-1] = (char)(s[len-1] + k);

    cout << s << "\n";
    return 0;
}

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

typedef long long i64;
const int MAXN = 1e5 + 10;

i64 answer;
int N, tmp;
int A[MAXN], B[MAXN];

multiset<int> a, b;

namespace disjointSet_map		// A disjoint set implemented by Red-Black Tree
{
map<int, int> fa;

void clear()
{
	fa.clear();
}

void setCircle(int x)
{
	fa[x] = x;
}

int find(int x)
{
	if (fa[x] == x)
		return x;
	return fa[x] = find(fa[x]);
}

void merge(int x, int y)
{
	fa[find(x)] = find(y);
}
}

int main()
{
	cin >> N;

	for (int i = 1; i <= N; i++)
		cin >> A[i], A[0] ^= A[i];
	for (int i = 0; i <= N; i++)
		a.insert(A[i]);

	for (int i = 1; i <= N; i++)
		cin >> B[i], B[0] ^= B[i];
	for (int i = 0; i <= N; i++)
		b.insert(B[i]);

	if (a != b)
		return cout << "-1" << endl, 0;

	disjointSet_map::setCircle(A[0]);
	for (int i = 1; i <= N; i++)
		if (A[i] != B[i])
			disjointSet_map::setCircle(A[i]);

	for (int i = 1; i <= N; i++)
		if (A[i] != B[i])
			disjointSet_map::merge(A[i], B[i]), answer++;

	for_each(disjointSet_map::fa.begin(), disjointSet_map::fa.end(),
			[] (pair<int, int> x )
			{	answer += (x.first == x.second);});

	cout << answer - 1 << endl;

	return 0;
}


Measured memory_bytes: 24448
#include <iostream>
#include <vector>
#include <stack>
#include <cmath>
#include <algorithm>
using namespace std;

class node{
public:
  int v;
  node *p, *l, *r;
};

node *nil, *root;

void pr(node *c){
  if(c == nil) return;
  cout << " " << c->v;
  pr(c->l);
  pr(c->r);
  return;
}
void in(node *c){
  if(c == nil) return;
  in(c->l);
  cout << " " << c->v;
  in(c->r);
  return;
}
void printx(){
  in(root);
  cout << endl;
  pr(root);
  cout << endl;
}
bool findx(int x){
  node *c = root;
  while(c != nil){
    if(x == c->v) break;
    else if(x < c->v) c = c->l;
    else c = c->r;
  }
  if(c != nil) return true;
  else return false;
}
void insertx(int x){
  node *c = root;
  node *p = nil;
  while(c != nil){
    p = c;
    if(x < c->v) c = c->l;
    else c = c->r;
  }
  node *y = new node;
  y->p = p;
  y->l = nil;
  y->r = nil;
  y->v = x;
  if(p == nil){
    root = y;
  }
  else if(p->v > x) p->l = y;
  else p->r = y;
}
void deletex(int x){
  if(findx(x) == false) return;
  node *c = root, *p = nil;
  while(c != nil){
    if(x == c->v) break;
    p = c;
    if(x < c->v) c = c->l;
    else c = c->r;
  }
  node *z, *y;
  if(c->l == nil || c->r == nil){
    z = c;
  }
  else{
    node *d = c->r, *dp;
    while(d != nil){
      dp = d;
      d = d->l;
    }
    z = dp;
  }
  if(z->l != nil) y = z->l;
  else y = z->r;

  if(y != nil) y->p = z->p;

  if(z == root){
    root = y;
  }
  else if(z->v < z->p->v){
    z->p->l = y;
  }
  else{
    z->p->r = y;
  }
  if(z != c) c->v = z->v;
}

void solve(){
  int m; cin >> m;
  vector<string> s(m);
  vector<int> a(m);
  for(int i = 0; i < m; i++){
    cin >> s[i];
    if(s[i] != "print"){
      cin >> a[i];
    }
  }
  root = nil;
  for(int i = 0; i < m; i++){
    if(s[i] == "insert") insertx(a[i]);
    else if(s[i] == "find"){
      if(findx(a[i]) == true) cout << "yes\n";
      else cout << "no\n";
    }
    else if(s[i] == "delete") deletex(a[i]);
    else printx();
  }
}

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



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

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

using namespace std;

using pii = pair<int, int>;

int main() {
    int N;
    cin >> N;
    unordered_map<int, int> m;
    REP(i, N) {
        int A;
        cin >> A;
        ++m[A];
    }
    int result = 0;
    for (const pii p: m) {
        result += p.second & 1;
    }
    cout << result << endl;

    return 0;
}

Measured memory_bytes: 4388
#include <iostream>
#include <vector>
#include <bitset>
#include <algorithm>
#include <utility>
#include <map>
#include <functional>
#include <initializer_list>
#include <string>
#include <cmath>
#include <iomanip>
using namespace std;

typedef long int ll;

long double getRadian(long double x, long double y, long double x2, long double y2) {
    long double radian = atan2(y2 - y,x2 - x);
    return radian;
}
int main(){
    const long double PI=3.14159265358979323846;
    long double a, b, x, xh;
    cin >> a >> b >> x;
    xh = x/(a*a);
    long double degree;
    if(2*xh > b){
        long double predeg = getRadian(0, 0, 2*b - 2*xh, a);

        degree = predeg * 180 / PI;
    }
    else{
        long double predeg = getRadian(0, 0, b, (2*a*xh)/b);

        degree = predeg * 180 / PI;

        }
    cout << setprecision(10) << 90 - degree;
}

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

int main(void) {
    priority_queue<int> que;
    for(int r = 0; r < 10; r++) {
        int input; cin >> input;
        que.push(input);
    }
    for(int r = 0; r < 3; r++) {
        cout << que.top() << endl; que.pop();
    }
    return(0);
}

Measured memory_bytes: 1220
#include<iostream>
#include<string>
using namespace std;
int main() {
  unsigned long long a;
  string s;
  cin>>a>>s; s.erase(1,1);
  unsigned long long bb=stoi(s);
  unsigned long long c=a*bb;
  cout<<(unsigned long long)(c/100)<<endl;
  return 0;
}


Measured memory_bytes: 3608
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<queue>
#define REP(i,a) for (int i = 0;i < (a);++i)
#define FOR(i,a,b) for (int i = (a);i < (b); ++i)
#define FORR(i,a,b) for (int i = (a);i >= (b); --i)
#define ALL(obj) (obj).begin,(obj).end()
#define SORT(list) sort(ALL((list)));
#define MOD 1000000007
using namespace std;
using ll = long long;
int main(){
    string s,t;
    cin >> s >> t;
    map<char,char> changeTtoS;
    map<char,char> changeStoT;
    
    REP(i,s.length()){
        if(changeTtoS.find(t[i]) != changeTtoS.end() && changeTtoS[t[i]] != s[i]){
            cout << "No" << endl;
            return 0;
        }
        changeTtoS[t[i]] = s[i];
    }
    REP(i,s.length()){
        if(changeStoT.find(s[i]) != changeStoT.end() && changeStoT[s[i]] != t[i]){
            cout << "No" << endl;
            return 0;
        }
        changeStoT[s[i]] = t[i];
    }
    
    cout << "Yes" << endl;
    
    return 0;
}

Measured memory_bytes: 776
n = int(input())
table = list('abcdefghijklmnopqrstuvwxyz')


def base10to(a, b):
    if (int(a / b)):
        return base10to(int(a / b)-1, b) + table[(a % b)]

    return table[(a % b)]


x2 = base10to(n-1, 26)
print(x2)


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

vector<vector<pair<int, int>>> g;
vector<vector<int>> gInv;
vector<int> onRoute;

void dfs(int p)
{
  if (onRoute[p])
    return;
  onRoute[p]++;
  for (auto& nxt : g[p])
    dfs(nxt.first);
}

void dfsInv(int p)
{
  if (onRoute[p] == 0 || onRoute[p] == 2)
    return;
  onRoute[p]++;
  for (auto& nxt : gInv[p])
    dfsInv(nxt);
}

int main()
{
  int n, m;
  cin >> n >> m;
  g.resize(n);
  gInv.resize(n);
  rep(i, m)
  {
    int a, b, c;
    cin >> a >> b >> c;
    a--;
    b--;
    c = -c;
    g[a].emplace_back(b, c);
    gInv[b].push_back(a);
  }
  onRoute.resize(n);
  fill(onRoute.begin(), onRoute.end(), 0);
  dfs(0);
  dfsInv(n - 1);
  vector<ll> score(n, LONG_LONG_MAX);
  score[0] = 0;
  rep(i, n)
    rep(j, n)
    {
      if (onRoute[j] != 2 || score[j] == LONG_LONG_MAX)
        continue;
      for (auto& k : g[j])
      {
        if (onRoute[k.first] != 2)
          continue;
        if (score[k.first] > score[j] + k.second)
        {
          score[k.first] = score[j] + k.second;
          if (i == n - 1)
          {
            cout << "inf\n";
            return 0;
          }
        }
      }
    }
  cout << -score[n - 1] << endl;
  return 0;
}

Measured memory_bytes: 384
def main():
    a, b = map(str, input().split())
    a = int(a)
    x = int(b[0])
    y = int(b[2])
    z = int(b[3])
    ans = a*x*100 + a*y*10 + a*z
    print(ans//100)

if __name__ == "__main__":
    main()

Measured memory_bytes: 9192
s=str(input())
S=int()
G=int()

#Sに最初のAのインデックスを取得
for i in range(len(s)):
  if s[i]=='A':
    S=s.index(s[i])
    break
    
ss=s[::-1]

#Gに最後のZのインデックスを取得
for j in range(len(ss)):
  if ss[j]=='Z':
    G=len(ss)-j-1
    break
print(G-S+1)

Measured memory_bytes: 3512
import sys
input=sys.stdin.readline

N = int(input())
B = list(map(int, input().split()))

ans = []
while len(B) > 0:
    tmp = []
    for i,b in enumerate(B):
        if i+1 == b:
            tmp.append(b)
    if tmp == []:
        print(-1)
        exit()
    else:
        x = max(tmp)
        ans.append(x)
        B.remove(x)
ans.reverse()
for i in ans:
    print(i)


Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define F first
#define S second
#define MP make_pair
#define pb push_back

using namespace std;

typedef pair< int, int > P;
typedef pair< int, P > iP;
typedef long long LL;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const int MOD = (10^9 + 7);

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int a, b, c;
    cin >> a >> b >> c;
    cout << a * b / 2 << endl;


    return 0;
}


Measured memory_bytes: 256
from math import ceil
N=int(input())
A=[int(i) for i in input().split()]
dp=1
for i in range(N):
  dp|=dp<<A[i]
S=sum(A)
hS=S//2
for i in range(hS+1)[::-1]:
  if dp&(1<<i):
    ans=i
    break
print(S-i)

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

int gcd(int a, int b)
{
    int c;

    if (a < b) {
        a+=b; b=a-b; a-=b;
    }

    while (b != 0) {
        c = a % b;
        a = b;
        b = c;
    }

    return a;
}

int main(void){
    int a, b;
    cin >> a >> b;
    if (a % b == 0) cout << "0" << endl;
    else cout << "1" << endl;

}

Measured memory_bytes: 256
#pragma GCC optimize "-O3"
#pragma GCC target ("avx")
#define _USE_MATH_DEFINES
#include<bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define inf (1ll<<60)
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v),greater<int>())
#define SPEED ios::sync_with_stdio(false);cin.tie(0);cout<<fixed<<setprecision(12)
signed gcd(int a, int b){return b?gcd(b,a%b):a;}
signed lcm(int a, int b){return a*b/gcd(a,b);}
//priority_queue<int, vi, greater<int> > que;//昇順

using namespace std;

const int mod=1e9+7;

signed main(){
    SPEED;
    int x,t;
    cin >> x >> t;
    if(x<=t)
    {
        cout << 0 << endl;
    }
    else
    {
        cout << x-t << endl;
    }

}


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

using namespace std;

int main(void) {
	int N,Q;
	cin >> N >> Q;
	bool finda = false;
	vector<int> memo(N,0);
	for (int i = 0; i < N; ++i) {
		char c;
		cin >> c;
		if (c == 'A') {
			finda = true;
		}
		else {
			if (finda && c == 'C') {
				memo[i] = 1;
			}
			finda = false;
		}
	}

	int now = 0;
	for (int i = 0; i < N; ++i) {
		if (memo[N-i-1] == 1) {
			memo[N-i-1] = now;
			++now;
		}
		else {
			memo[N-i-1] = now;
		}
	}

	for (int q = 0; q < Q; ++q) {
		int l,r;
		cin >> l >> r;
		cout << memo[l-1]-memo[r-1] << endl;
	}
	return 0;
}




Measured memory_bytes: 1280
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
int main(){
  int n,d;
  cin>>n>>d;
  int set=2*d+1;
  int cnt=0;
  while(n>0){
    n-=set;
    cnt++;
  }
  cout<<cnt<<endl;    
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long a[2000001]; 
int main()
{
	long long n,times,sum=0; 
	cin>>n>>times;
	for(int i=0;i<n;i++)
	cin>>a[i];
	sort(a,a+n);
	for(int i=0;i<n-times;i++)
	sum+=a[i];
	cout<<sum;
	return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<queue>
using namespace std;
int main()
{
    string s;

    int n;
    cin>>n;
    cin>>s;
    for(int i=0;i<s.size();i++)
    {
        if(s[i]+n<='Z')
            s[i]+=n;
        else
        {
            s[i]+=n-26;
        }
    }
    cout<<s;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define ll long long
using namespace std;
//typedef vector<unsigned int>vec;
//typedef vector<ll>vec;
//typedef vector<vec> mat;
typedef pair<int, int> P;
typedef pair<ll,ll> LP;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int INF = 1000000000;
const ll LINF = 1000000000000000000;//1e18
const ll  MOD = 1000000007;
const double PI = acos(-1.0);
const double EPS = 1e-10;

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; }
//template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, K;
    cin >> N >> K;
    vector<ll> left(N+1), right(N+1);
    REP(i, N+1){
        left[i] = i;
        right[i] = N - i;
        if(i > 0) left[i] += left[i-1], right[i] += right[i-1];
    }
    ll ans = 0;
    for(int i=K;i<=N+1;i++){
        ans += right[i-1] - left[i-1] + 1;
        ans %= MOD;
    }
    cout << ans << endl;
}


Measured memory_bytes: 6364
using System;
using static System.Console;
using static System.Math;

public class Hello{
    public static void Main(){
        int kazu = int.Parse(ReadLine());
//        string[] input = ReadLine().Split(' ');
//        int[] suji = new int[team*3];
        int r = 0;
        int[] kosuu = new int[200];
        for(int i=0;i<kazu;i++){
            r = int.Parse(ReadLine());
            kosuu[r]++;
        }

        int count = 0;
        for(int i=0;i<200;i++){
            if(kosuu[i]>0){
                count++;
            }
        }
        WriteLine(count);
    }
}

Measured memory_bytes: 13140
n, _, c = gets.chomp.split.map(&:to_i)
b = gets.chomp.split.map(&:to_i)
res = 0
n.times do |_|
  a = gets.chomp.split.map(&:to_i)
  res += 1 if a.zip(b).map {|i, j| i * j }.inject(:+) + c > 0
end
puts res

Measured memory_bytes: 1788
package main

import "fmt"

func main() {
	var h, w, n int
	fmt.Scan(&h, &w, &n)

	res := 0
	black := 0
	plus := 0
	if h > w {
		plus = h
	} else {
		plus = w
	}

	// 割るのが良さそう…
	for black < n {
		black += plus
		res++
	}

	fmt.Println(res)
}


Measured memory_bytes: 512
#include <iostream>

int A[200000 + 10];

int main()
{
  int N;
  std::cin >> N;
  for (int i = 0; i < N; ++i)
  {
    std::cin >> A[i];
  }

  int next = 1;
  for (int i = 0; i < N; ++i)
  {
    if (A[i] == next) ++next;
  }

  if (next == 1)
  {
    std::cout << -1 << std::endl;
  }
  else
  {
    std::cout << (N - next + 1) << std::endl;
  }

  return 0;
}


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

int my_comp(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
}

int main(int argc, void **arg)
{
    int n;
    int p[50], q[50];
    int i, j;

    scanf("%d", &n);

    for (i = 0; i < n; i++)
    {
        scanf("%d", &p[i]);
        q[i] = p[i];
    }

    qsort(q, n, sizeof(int), my_comp);

    for (i = 0; i < n - 1; i++)
    {
        if( i + 1 != p[i] ) {
            for (j = i + 1; j < n; j++)
            {
                if( i + 1 == p[j] ) {
                    int t = p[i];
                    p[i] = p[j];
                    p[j] = t;
                    break;
                }
            }
            if( j < n ) {
                break;
            }
        }
    }

    if( memcmp(p, q, n) == 0 ) {
        printf("YES\n");
    } else {
        printf("NO\n");
    }

    return 0;
}


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

using namespace std;

int main() {
  
  int n, m;
  cin >> n >> m;
  vector<int> aa(m,0);
  for (int i = 0; i < n; i++) {
    int b;
    cin >> b;
    for (int j = 0; j < b; j++) {
      int c;
      cin >> c;
      aa[c-1]++;
    }
  }
  int ans = 0;
  for (int i = 0; i < m; i++) {
    if (aa[i] == n) {
      ans++;
    }
  }
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define INF 1000000000000 //10^12
#define MOD 10000007 //10^9+7
#define PB push_back

template<typename T, typename U, typename Comp=less<>>
bool chmax(T& xmax, const U& x, Comp comp={}) {
    if(comp(xmax, x)) {
        xmax = x;
        return true;
    }
    return false;
}

template<typename T, typename U, typename Comp=less<>>
bool chmin(T& xmin, const U& x, Comp comp={}) {
    if(comp(x, xmin)) {
        xmin = x;
        return true;
    }
    return false;
}

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

//scanf("%lld", &);
//cin >> ;
//cout << ans << endl;

ll N, M, K, i, j, k, l, ans, cnt = 0;
ll sum;
string s;
string RGB = {"RGB"};
vector<ll> a;
int main(){
    //cin >> ;
    //cout << ans << endl;

    scanf("%lld", &N);
    scanf("%lld", &M);
    REP(i, N){
        ll tmp;
        scanf("%lld", &tmp);
        a.push_back(tmp);
        sum += tmp;
    }
    sort(ALL(a), greater<ll>());

    if(a.at(M - 1) * 4 * M >= sum){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }


    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define fo(i,l,r) for(int i=l;i<=r;i++)
#define of(i,l,r) for(int i=l;i>=r;i--)
#define fe(i,u) for(int i=head[u];i;i=e[i].next)
using namespace std;
typedef long long ll;
inline void open(const char *s)
{
	#ifndef ONLINE_JUDGE
	char str[20];
	sprintf(str,"in%s.txt",s);
	freopen(str,"r",stdin);
//	sprintf(str,"out%s.txt",s);
//	freopen(str,"w",stdout);
	#endif
}
inline ll rd()
{
	static ll x,f;
	x=0;f=1ll;
	char ch=getchar();
	for(;ch<'0'||ch>'9';ch=getchar())if(ch=='-')f=-1ll;
	for(;ch>='0'&&ch<='9';ch=getchar())x=x*10ll+ch-'0';
	return f>0?x:-x;
}
const int N=50;
ll n,bin[N];
int m,a[N],t1=0,t2=0,s[N],t[N];

int main()
{
	bin[0]=1;fo(i,1,40)bin[i]=bin[i-1]<<1ll;
	n=rd();
	fo(i,0,40)if(n&bin[i])a[i]=1;
	int m=0;
	n++;
	while(n>1){
		if(n&1)s[++t1]=++m,n--;
		else t[++t2]=++m,n>>=1;
	}
	printf("%d\n",(t1+t2)<<1);
	fo(i,1,t1)cout<<101-s[i]<<' ';
	of(i,t2,1)cout<<101-t[i]<<' ';
	fo(i,101-t1-t2,100)cout<<i<<' ';cout<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void){
  int w[30];
  int n,t,c1,c2,data;
  int i;
  
  scanf("%d",&t);
  scanf("%d",&n);
  for(i=0;i<t;i++)
    w[i]=i+1;
  for(i=0;i<n;i++){
    scanf("%d,%d",&c1,&c2);
    data=w[c1-1];
    w[c1-1]=w[c2-1];
    w[c2-1]=data;
  }
  for(i=0;i<t;i++)
    printf("%d\n",w[i]);
  
  return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<cctype>
#include<queue>
#include<cstring>
#include<string>
#include<cmath>
#include<map>
#define maxn 307
#define maxx 20007
#define SDOI2020 RP++ 
using namespace std;
int n;
map<int,int> m;
inline int read()
{
	int x=0;
	int flag=0;
	char ch;
	ch=getchar();
	while(!isdigit(ch)) 
	{
		if(ch=='-') flag=1;
	ch=getchar();	
	}
	while(isdigit(ch))
	{
		x=(x<<3)+(x<<1)+ch-48;
		ch=getchar();
		}
		if(flag==1) x=-x;	
		return x;
}


int main()
{
	n = read();
	for(register int i = 1;i <= n;i++)
	{
		int x = read();
		if(m[x] == 0)
		{
			m[x] = 1;
			continue;
		}
		else 
		{
			printf("NO\n");
			return 0;
		}
	}
	printf("YES\n");
	return 0;
}

Measured memory_bytes: 9600
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll MOD = 1e9+7;

#define vec     vector<int>
#define vecll   vector<ll>
#define vec2    vector<vector<int>>
#define vec2ll  vector<vector<ll>>
#define vpair   vector<pair<int, int>>
#define vpairll vector<pair<ll, ll>>

#define rep(i,n)         for(int i=(int)0; i<(int)n; i++)
#define REP(i,m,n)       for(int i=(int)m; i<(int)n; i++)
#define arr(var, n)      vec var(n); rep(i,n){cin >> var[i];}
#define arrll(var, n)    vecll var(n); rep(i,n){cin >> var[i];}
#define all(var)         (var).begin(), (var).end()
#define sortall(var)     sort(all(var))
#define prt(var)         cout << var << "\n"
#define prtd(n, var)     cout << fixed << setprecision(n) << var << "\n"
#define prt2(v1, v2)     cout << v1 << " " << v2 << "\n"
#define prt3(v1, v2, v3) cout << v1 << " " << v2 << " " << v3 << "\n"
#define prtall(var)      rep(i,var.size()){cout << var[i] << " ";} cout << "\n"

//----------------------------------------------------------------

int main(void) {
  int n, q;
  cin >> n >> q;
  string s;
  cin >> s;

  vec l(q), r(q);
  rep(i,q){
    cin >> l[i] >> r[i];
    l[i]; r[i];
  }

  vec num_ac(n+1);
  rep(i,n+1){
    num_ac[i]=0;
  }
  REP(i,1,n){
    if(s[i-1]=='A' && s[i]=='C'){
      num_ac[i+1]=num_ac[i]+1;
    } else {
      num_ac[i+1]=num_ac[i];
    }
  }
  //prtall(num_ac);

  rep(i,q){
    prt(num_ac[r[i]]-num_ac[l[i]]);
  }

}


Measured memory_bytes: 2176
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue> 
#include <stack>
#include <set>

using namespace std;
typedef long long ll;
#define rep(i, s, e) for (int(i) = (s); (i) <= (e); ++(i))
#define all(x) x.begin(),x.end()


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

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		int tarou_point = 0,hanako_point = 0;

		Scanner in = new Scanner(System.in);

		int game_num =in.nextInt();

		for(int i = 0; i < game_num; i++){

			String tarou_card = in.next();
			String hanako_card = in.next();

			// System.out.println(tarou_card.compareToIgnoreCase(hanako_card));
			if(tarou_card.compareToIgnoreCase(hanako_card) == 0){

				tarou_point += 1;
				hanako_point += 1;

			}else if(tarou_card.compareToIgnoreCase(hanako_card) > 0){

				tarou_point += 3;

			}else if(tarou_card.compareToIgnoreCase(hanako_card) < 0){

				hanako_point += 3;

			}

		}

		System.out.println(tarou_point + " " + hanako_point);

	}
}

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

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
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; }
typedef long long ll;

const long long INF = 1LL << 60;

int main()
{
    int X, A;
    cin >> X >> A;

    if (X >= A) {
        cout << 10 << endl;
    }
    else {
        cout << 0 << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void _main()
{
    int N;
    ll K;
    cin >> N >> K;
    vector<ll> A(N);
    rep(i, 0, N) cin >> A[i];

    ll ans = 0;

    rrep(d, 60, -1)
    {
        if (d != -1 && !(K & (1LL << d))) continue;

        ll tmp = 0;
        rrep(e, 60, 0)
        {
            ll mask = 1LL << e;
            int num = 0;
            rep(i, 0, N) if (A[i] & mask) ++num;

            if (e > d)
            {
                if (K & mask) tmp += mask * (N - num);
                else tmp += mask * num;
            }
            else if (e == d)
            {
                tmp += mask * num;
            }
            else
            {
                tmp += mask * max(num, N - num);
            }
        }
        ans = max(ans, tmp);
    }

    cout << ans << endl;
}


Measured memory_bytes: 1152
N=int(input())

b=list(map(int,input().split()))

b
c=[i+1 for i in range(N)]

ans=[]

for i in range(len(b)):
    ans.append([b[i],c[i]])
    
ans1=sorted(ans)
ans2=[i[1] for i in ans1]

print(*ans2)

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

int main(){

  string s,t;
  cin >> s >> t;

  int s_len=s.length();
  int t_len=t.length();

  vector<vector<int>> dp(s_len+1,vector<int>(t_len+1,0));
  string ans="";

  for(int s_index=0;s_index<s_len;s_index++){
    for(int t_index=0;t_index<t_len;t_index++){
      if(s[s_index]==t[t_index]){
        dp[s_index+1][t_index+1]=max(dp[s_index+1][t_index+1],dp[s_index][t_index]+1);
        //dp[s_index+1][t_index+1]=dp[s_index][t_index]+1;
      }
      dp[s_index+1][t_index+1]=max(dp[s_index+1][t_index+1],dp[s_index+1][t_index]);
      dp[s_index+1][t_index+1]=max(dp[s_index+1][t_index+1],dp[s_index][t_index+1]);
    }
  }

  /*for(int i=1;i<=s_len;i++){
    for(int j=1;j<=t_len;j++){
      cout << dp[i][j];
    }
    cout << endl;
  }*/


  int s_index=s.length();
  int t_index=t.length();
  while(s_index>0 && t_index>0){
    if(dp[s_index-1][t_index]==dp[s_index][t_index]){
      s_index--;
    }else if(dp[s_index][t_index-1]==dp[s_index][t_index]){
      t_index--;
    }else{
      ans = s[s_index-1] + ans;
      s_index--;
      t_index--;
    }
  }

  //cout << dp[s_len][t_len] << endl;
  cout << ans << endl;
}

Measured memory_bytes: 35584
s = int(input())
tar = s
used = [s]
for i in range(2,int(1e8)):
    if tar % 2 == 0:
        tar = tar//2
    else:
        tar = tar*3+1
    if tar in used:
        print(i)
        exit()
    else:
        used.append(tar)

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

int main(){
    ll n;
    cin >> n;
    vector<ll> num(n);
    repl(i,n){
        cin >> num[i];
    }
    vector<ll> mi(n);
    mi[0] = 2001001007;
    reppl(j,n,1){
        mi[j] = min(mi[j-1], num[j-1]);
    }
    ll ans = num[0] - mi[0];
    reppl(k,n,1){
        ans = max(ans, num[k] - mi[k]);
    }
    cout << ans << endl;
}


Measured memory_bytes: 5956
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
using namespace std;

int main() {
  int n;cin>>n;
  int t,a;cin>>t>>a;
  vector<int> h(n);
  for(int i=0;i<n;++i){
    cin>>h[i];
    h[i] = t*1000 - h[i]*6 - a*1000;
    h[i] = abs(h[i]);
  }
  int ans = *min_element(h.begin(),h.end());
  for(int i=0;i<n;++i){
    if(ans==h[i]) cout<<i+1<<endl;
  }

  return 0;
}

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

int main() {
    map<string, int> m;
    int q; cin >> q;
    while (q--) {
        int com; cin >> com;
        if (com == 0) {
            string key; int x;
            cin >> key >> x;
            m[key] = x;
        } else if (com == 1) {
            string key; cin >> key;
            cout << (m.count(key) ? m[key] : 0) << endl;
        } else if (com == 2) {
            string key; cin >> key;
            m.erase(key);
        } else if (com == 3) {
            string l, r; cin >> l >> r;
            auto it = m.lower_bound(l);
            while (it != m.end() && it->first <= r) {
                cout << it->first << " " << it->second << endl;
                it++;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 27688
import sys
input = sys.stdin.readline


def print_ans(S):
    """Test Case
    >>> print_ans("RRS")
    2
    >>> print_ans("SSS")
    0
    >>> print_ans("RSR")
    1
    """
    count = 0
    maximum = 0
    for a in S:
        if a == "R":
            count += 1
        else:
            count = 0
        maximum = max(count, maximum)
    print(maximum)


if __name__ == '__main__':
    S = input().rstrip()
    print_ans(S)


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

using namespace std;
#define ll long long
#define sz(a) (int)(a).size()
#define rep(i, a, b) for (int i = (a), _b = (b); i < _b; ++i)
#define frep(i, a, b) for (int i = (a), _b = (b); i <= _b; ++i)
#define _all(a) a.begin(), a.end()

typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef vector<ii> vii;

const int inf = 1e9 + 7;
const ll linf  = 1ll * inf * inf;
const int N = 1e5 + 7;
const int M = 51;
const int multipleTest = 0;

int cnt[N];
string s;

void solve() {
	cin >> s;
	for (char c : s) cnt[c]++;
	
	if (s.size() < 26) {
		cout << s;
		for (char c = 'a'; c <= 'z'; ++c) {
			if (!cnt[c]) {
				cout << c;
				return;
			}
		}
	} else {
		for (int i = sz(s) - 1; i >= 0; --i) {
			cnt[s[i]]--;
			for (char c = s[i] + 1; c <= 'z'; ++c) {
				if (!cnt[c]) {
					cout << s.substr(0, i) << c;
					return;
				}
			}
		}
		cout << -1;
	}
	
}

int main() {
#ifdef _LOCAL_
	freopen("in.txt", "r", stdin);
	//    freopen("out.txt", "w", stdout);
#endif
	int Test = 1;
	if (multipleTest) {
		cin >> Test;
	}
	for(int i = 0; i < Test; ++i) {
//		printf("Case #%d: ", i + 1);
		solve();
	}
#ifdef _LOCAL_
		cout << "\n" << 1.0 * clock() / CLOCKS_PER_SEC << "\n";
#endif
}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <list>
#include <cmath>
#include <limits>

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

int main() {
    int n, k, x, y;
    cin >> n >> k >> x >> y;
    ll ans = 0;
    rep(i, n) {
        if(i < k) ans += x;
        else ans += y;
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
N, K, Q = map(int, input().split())
A = []
for i in range(Q):
  A.append(int(input()))

default = K - Q
person = [default for n in range(N)]

for a in A:
  person[a-1] += 1

for p in person:
  if p > 0:
    print('Yes')
  else:
    print('No')

Measured memory_bytes: 10456