akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define int long long
#define vec(a,n) vector<int> (a)((n))
#define Vec(a,n) vector<string> (a)((n))
#define twovec(a,n,m) vector<vector<int>> a(n,vector<int>(m,0))
#define Twovec(a,n,m) vector<vector<double>> a(n,vector<double>(m,0))
#define P pair<int,int>
#define All(a) (a).begin(),(a).end()
#define Sort(a) sort(All(a))
#define Reverse(a) reverse(All(a))
#define PQ(n) priority_queue<P,vector<P>,greater<P>> (n)
#define pq(n) priority_queue<int> (n)
#define Lower(a,t) lower_bound(All(a),t)
using namespace std;
void Debug(auto a);


signed main(){
    int n;
    cin >> n;
    vec(a,n);
    REP(i,n){
        cin >> a[i];
        if(a[i] > i+1){
            cout << "-1" << endl;
            return 0;
        }
    }
    vec(b,n);
    int in_b = 0;
    REP(j,n){
        REP(i,a.size()){
            if(a[i] == i+1){
                in_b = a[i];
            }
        }
        if(in_b == 0){
            cout << "-1" << endl;
            return 0;
        }
        a.erase(a.begin() + in_b - 1);
        b[j] = in_b;
        in_b = 0;
    }
    Reverse(b);
    REP(i,n){
        cout << b[i] << endl;
    }
    

    return 0;
}



void Debug(auto a){
    cout << "{ ";
    for(auto b: a){
        cout << b << " ";
    }
    cout << "}" << endl;
}


Measured memory_bytes: 256
while True:
	H,W = map(int,raw_input().split())
	if H == 0 and W == 0:
		break
	
	tiles = []
	visit = []
	for i in xrange(H):
		tiles.append(list(raw_input()))
		visit.append(list("?" * W))
	
	x = 0
	y = 0
	judge = False
	while True:
		if tiles[y][x] == ".":
			break
		elif tiles[y][x] == ">":
			x += 1
		elif tiles[y][x] == "<":
			x -= 1
		elif tiles[y][x] == "v":
			y += 1
		elif tiles[y][x] == "^":
			y -= 1
		if visit[y][x] == "$":
			judge = True
			break
		visit[y][x] = "$"
		
	if judge:
		print "LOOP"
	else:
		print x,y

Measured memory_bytes: 6444
#include <stdio.h>

int main(void) {
  int i, j, k, a, b, p[5] = {0, 6000, 4000, 3000, 2000};
  for(i = 0; i < 4; ++i) {
    scanf("%d%d", &a, &b);
    printf("%d\n", p[a] * b);
  }
  return 0;
}


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

int main() {
	string s;
	cin >> s;
	int max = 0;
	int tmp ;
	for(int i = 0; i < s.size(); i++) {
		int j = 0;
		tmp = 0;
		while(i + j < s.size()) {
			if(s.at(i + j) != 'A' && s.at(i + j) != 'G' && s.at(i + j) != 'C' && s.at(i + j) != 'T') {
				break;
			}
			j++;
			tmp++;
		}
		if(tmp > max) max =tmp;
	}
	cout << max << endl;
}

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

using namespace std;
using ll =long long;
typedef pair<int,int> P;
#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cerr << #x << " = " << (x) << endl;
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; }
//Write From this Line

int main()
{
	int n;
	cin >> n;
	int ans = 0;
	while(n != 0){
		if(n % 10 == 2) ans++;
		n /= 10;
	}
	cout << ans << endl;
}


Measured memory_bytes: 3644
#include<bits/stdc++.h>							
typedef long long ll;
#define pb push_back
#define mod 1000000007ll
const ll maxn = 9e18;
using namespace std;
const ll maxsize = 100000009;


void solve() {	
	int n, x, t;
	cin >> n >> x >> t;
	int ans = 0;
	ans = n / x;
	if(n % x) ans++;
	cout << ans * t << endl;
}
	

int main() {
	ios_base :: sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cout.precision(35);
	int t;
	solve();
	return 0;
}
 
 
 
 


Measured memory_bytes: 3632
#define _CRT_SECURE_NO_WARNINGS

#include<iostream>
#include<string>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<map>
#include<tuple>
#include<algorithm>
#include<numeric>
#include<math.h>

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

using namespace std;

using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;

const int mod = 1e9 + 7;
const long double pi = 3.141592653589793238462643383279502884197;
const long double eps = 1e-7;

ll num[87];

int main() {
	int N;
	cin >> N;
	REP(i, N + 1) num[i] = 0;
	num[0] = 2;
	num[1] = 1;

	REPS(i, 2, N + 1) {
		num[i] = num[i - 1] + num[i - 2];
	}
	cout << num[N];

	system("pause");
	return 0;
}

Measured memory_bytes: 504
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define Rep(i,s,n) for(int i=s;i<n;i++)
#define per(i,s,n) for(int i=n-1;i>=s;i--)
#define fi first
#define se second
#define all(c) c.begin(),c.end()
typedef long long int ll;
typedef pair<int, int> P;
typedef long double ld;
void Ans(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}

const ll INF=1001001001;
const ll mod=1000000007;

int main(){
  string s;
  cin>>s;
  int n=s.size();
  int ans=0;
  rep(i,n){
    if(i%2==0){
      if(s[i]=='0') ans++;
    }
    if(i%2==1){
      if(s[i]=='1') ans++;
    }
  }
  //cout<<ans<<endl;
  cout<<min(ans,n-ans)<<endl;
}



Measured memory_bytes: 3720
#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <iomanip>
using namespace std;
using P = pair<int,int>;
typedef long long ll;


#define rep(i,n) for (int i=0; i<(n); i++)
//const int INF =1001001001;
const ll BIG = 1e9+7;
const double PI = 3.141592653589793;

int main(){
    int x, n;
    cin >> x >> n;
    if(n==0) {
        cout << x << endl;
        return 0;
    }
    vector<int> p(103, 0);
    int a;
    rep(i, n) {
        cin >> a; a++;
        p[a] = 1;
    }
    rep(i, 103){
        int right, left;
        right = (x+1)+i;
        left = (x+1)-i;
        if(left>=0){
            if(p[left]==0) {
                cout << left-1 << endl;
                return 0;
            }
        }
        if(right<=102) {
            if(p[right]==0){
                cout << right-1 << endl;
                return 0;
            }
        }
    }
}

Measured memory_bytes: 3624
#include <atcoder/segtree>
#include <cstdio>
#include <vector>

using namespace std;
using namespace atcoder;

int op(int a, int b) { return max(a, b); }

int e() { return -1; }

int target;

bool f(int v) { return v < target; }

int main() {
    int n, q;
    scanf("%d %d", &n, &q);
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        scanf("%d", &(a[i]));
    }

    segtree<int, op, e> seg(a);

    for (int i = 0; i < q; i++) {
        int t;
        scanf("%d", &t);
        if (t == 1) {
            int x, v;
            scanf("%d %d", &x, &v);
            x--;
            seg.set(x, v);
        } else if (t == 2) {
            int l, r;
            scanf("%d %d", &l, &r);
            l--;
            printf("%d\n", seg.prod(l, r));
        } else if (t == 3) {
            int p;
            scanf("%d %d", &p, &target);
            p--;
            printf("%d\n", seg.max_right<f>(p) + 1);
        }
    }
}


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

#define cc(x) cout << (x) << endl
#define rep(i,n) for(int i = 0; i < int(n); i++)
#define repi(i,a,b) for(int i = int(a); i < int(b); ++i)
typedef long long ll;

template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }

const ll inf = 1LL<<58;
const int iinf = 1<<30;

int main(){
    ll n, m;
    cin >> n >> m;
    vector<ll> a(n), b(n);
    rep(i,n){
        cin >> a[i] >> b[i];
    }
    vector<pair<ll, ll>> pair(n);
    rep(i,n){
        pair[i] = make_pair(a[i], b[i]);
    }
    sort(pair.begin(), pair.end());
    ll katta=0;
    ll kingaku=0;
    rep(i,n){
        if(pair[i].second+katta>=m){
            kingaku+=(m-katta)*pair[i].first;
            break;
        }
        katta+= pair[i].second;
        kingaku+= pair[i].first*pair[i].second;
    }
    cc(kingaku);
}

Measured memory_bytes: 3328
#include<stdio.h>

int main()
{
	int i, n, left, right, m_id = 0;
    
	scanf("%d", &n);
	
	int l[n];
	
	for(i = 0; i < n; i++){
		scanf("%d", &l[i]);
		if(l[i] > l[m_id]){
			m_id = i;
		}
	}
	
	left = l[m_id];
	l[m_id] = 0;
	
	right = 0;
	for(i = 0; i < n; i++){
		right += l[i];
	}
	
	if(left < right){
		printf("Yes");
	}else{
		printf("No");
	}
	
	return 0;
}

Measured memory_bytes: 128
n = int(input())
abl = [list(map(int,input().split())) for nesya in range(n)]
c = 0
abl = abl[::-1]
for ab in abl:
  a = ab[0] + c
  b = ab[1]
  if a%b == 0:
    continue
  c += (b - a%b)
print(c)


Measured memory_bytes: 28148
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i = 0;i<((ll)(n));i++)
#define reg(i,a,b) for(ll i = ((ll)(a));i<=((ll)(b));i++)
#define irep(i,n) for(ll i = ((ll)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(ll i = ((ll)(b));i>=((ll)(a));i--)
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;

/*
*/

ll n,dp[2],dp2[2];
string s;

void init(){
	cin>>s;
	n=s.size();
}

int main(void){
	init();
	dp[0]=0;
	dp[1]=1e9;
	irep(i,n){
		ll d=s[i]-'0';
		dp2[0]=min(dp[0]+d,dp[1]+d+1);
		dp2[1]=min(dp[0]+10-d,dp[1]+10-d-1);
		rep(i,2)dp[i]=dp2[i];
		// cerr<<dp[0]<<","<<dp[1]<<endl;
	}
	cout<<min(dp[0],dp[1]+1)<<endl;
	return 0;
}

Measured memory_bytes: 1412
S = list((map(lambda x: int(x=='R'), input().rstrip())))
n = len(S)

loops, switches = [], []
i, state = 0, 1
while i < n:
    if state ^ S[i]:
        if state:
            loops.append((i-1, i))
        else:
            switches.append(i)
        state = int(not state)
    i += 1
switches.append(n)

childs = [0]*n
prev_j = 0
for (i1, i2), j in zip(loops, switches):
    if i2 % 2 == j % 2:
        childs[i1] = (j+1 - prev_j) // 2
        childs[i2] = (j - prev_j) // 2
    else:
        childs[i1] = (j - prev_j) // 2
        childs[i2] = (j+1 - prev_j) // 2
    prev_j = j
print(*childs)

Measured memory_bytes: 15836
package main

import (
	"fmt"
	"strconv"
	"strings"
)

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

	ans := 0
	for i := 1; i <= n; i++ {
		sn := strconv.Itoa(i)
		sliceN := strings.Split(sn, "")
		if len(sliceN)%2 != 0 {
			ans++
		}
	}

	fmt.Print(ans)
}


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

typedef long lint;
typedef long long llint;

// static const int MAX = 1e6;
// static const int NIL = -1;
// static const ll INF = 1<<21;
// static const ll MOD = 1e9 + 7;

bool compPair(const pair<int, int>& arg1, const pair<int, int>& arg2) { return arg1.first > arg2.first; }
template<class T> void chmax(T& a, T b) { if (a < b) { a = b; } }
template<class T> void chmin(T& a, T b) { if (a > b) { a = b; } }


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

    if(k%2==1) {
        llint kbai, ans;
        kbai = n/k;
        ans = kbai*kbai*kbai;
        cout << ans << endl;
    }
    else {
        llint kbai, ans, kmod;
        kbai = n/k;
        ans = kbai*kbai*kbai;

        kmod=0;
        for(llint in=1;in<=n;in++) {
            if(in%k==(k/2)) kmod++;
        }
        ans += kmod*kmod*kmod;
        cout << ans << endl;
    }

    
    return 0;
}


Measured memory_bytes: 256
N = int(input())
T = 1
A = 1


for i in range(N):
    t,a = map(int, input().split())

    if max(t,a)%min(t,a) == 0:
        if t > a:
            t = t//a
            a = a
        else:
            t = t
            a = a//t

    j = max(T//t,A//a)
    while T > t*j or A > a*j:
        j += 1

    T = t*j
    A = a*j

print(T+A)


Measured memory_bytes: 3064
def main():
    w = input()
    wards = []
    while True:
        wards.extend(ward for ward in input().split())
        if wards[-1] == 'END_OF_TEXT':
            break
    num = 0
    for ward in map(lambda ward: ward.lower(), wards):
        if ward == w:
            num += 1
    print(num)


if __name__ == '__main__':
    main()



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

#define    ll    long long int

int main( )
{
    int a, b;
    cin >> a >> b;
    if (2*b < a) {
        cout << (a - 2 * b) << '\n';
    }
    else {
        cout << "0\n";
    }
    return 0;
}


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

/* define*/
#define Yes(X) puts ( X ? "Yes" : "No")
#define YES(X) puts ( X ? "YES" : "NO")
#define FOR(i, a, b) for ( i = a, i < b ; i++)
#define REP(i, n) for ( i = 0; i < n ; i++)
#define DER(i, n) for ( i = 0; n ; i--)
#define max(a, b) (((a) > (b)) ? (a) : (b))
#define min(a, b) (((a) < (b)) ? (a) : (b))
#define max3(a, b, c) ((max((a), (b)) > (c)) ? max((a), (b)) : (c))
#define min3(a, b, c) ((min((a), (b)) < (c)) ? min((a), (b)) : (c))

/* const */
const int MOD = 1e9 + 7;

/* alias */
typedef long long ll;

/* function */
int cmp(const int *a, const int *b) {
	return *a - *b;
}
int cmp2(const int *a, const int *b) {
	return *b - *a;
}

//* main */

int main() {
	int n, a, b, i, p, x = 0, y = 0, z = 0;
	scanf("%d%d%d", &n, &a, &b);
	REP(i, n) {
		scanf("%d", &p);
		if (p <= a)x++;
		else if (p <= b)y++;
		else z++;
	}
	printf("%d", min3(x, y, z));
	return 0;
}

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

#define sz(a) ((int)a.size())
#define rep(i, a, b) for (int i = (a); i < (b); ++i)
#define trav(i, a) for (auto &i : (a))
#define all(v) v.begin(), v.end()
#define mp(a, b) make_pair(a, b)

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vl> vvvl;
typedef double T;
typedef vector<T> vt;
typedef vector<vt> vvt;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vpi;
typedef tuple<ll, int, int> tlii;

const int MOD = 1e9+7; // 998244353;
const int INF = 1e9+1;

struct DayWeights {
  int a;
  int b;
  int c;
};

int main() {
  cin.sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<DayWeights> weights(n);
  for (int i = 0; i < n; ++i) {
    cin >> weights[i].a >> weights[i].b >> weights[i].c;
  }
  vector<vector<int>> dp (n, vector<int>(3, INF));
  dp[0][0] = weights[0].a;
  dp[0][1] = weights[0].b;
  dp[0][2] = weights[0].c;

  for(int i = 1; i < n; ++i) { 
    int max_a = -INF;
    int max_b = -INF;
    int max_c = -INF;
    max_a = max(dp[i - 1][1], dp[i - 1][2]);
    max_b = max(dp[i - 1][0], dp[i - 1][2]);
    max_c = max(dp[i - 1][0], dp[i - 1][1]);
    auto v = {max_a, max_b, max_c};
    dp[i][0] = max_a + weights[i].a;
    dp[i][1] = max_b + weights[i].b;
    dp[i][2] = max_c + weights[i].c;
  }
  cout << *max_element(dp.back().begin(), dp.back().end()) << endl;
}


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

int main() {
	cout<<fixed<<setprecision(10);
	int n;
	cin>>n;
	double  a[n];
	f(i,n)cin>>a[i];
	vector<vector<double>> dp(3010,vector<double>(3010,0.0));
	// memset(dp,0,sizeof dp);
	// std::fill(dp.begin(),dp.end(),0.0);
	// f(i,n+1){
	// 	f(j,n+1){
	// 		cout<<dp[i][j]<<" ";
	// 	}
	// 	cout<<"\n";
	// }
	dp[0][0]=1.0;
	for(int j=1;j<=n;j++)dp[j][0]=dp[j-1][0]*(1-a[j-1]);
	for(int i=1;i<=n;i++){
		for(int j=1;j<=i;j++){
			dp[i][j]=dp[i-1][j-1]*a[i-1]+(1-a[i-1])*dp[i-1][j];
		}
	}
	double ans=0;
	// f(i,n+1){
	// 	f(j,n+1){
	// 		cout<<dp[i][j]<<" ";
	// 	}
	// 	cout<<"\n";
	// }
	for(int j=ceil(n/2.0);j<=n;j++){
		ans+=dp[n][j];
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 74324
#include<stdio.h>
#include<iostream>
using namespace std;
int main(void)
{
	int a[101]={0},i,n,s=0;
	while(cin>>n){
	a[n]++;
		if(a[n]>s){
			s=a[n];
		}
	}
	for(i=1;i<=100;i++){
		if(s==a[i]){
		cout<<i<<endl;
		}
	}
	return 0;
}

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

int main(){
    int s;
    cin >> s;
    int count = 1;
    int count_2 = 0;
    vector<int> container(0);
    for (int i = 0; i < 1000000; i++){
        container.push_back(s);
        count++;
        if (s % 2 == 0){
            s = s/2;
        }
        else if(s % 2 == 1){
            s = 3 * s + 1;
        }
        for (int j = 0; j < i; j++){
            if(container.at(j) == s){
                count_2++;
            }
        }
        if (count_2 >= 1){
            cout << count << endl;
            break;
        }
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define inti(i) int i; cin >> i
 
int main(){
    inti(N);
    long long a=0;
    rep(i,N-1) a+=i+1;
    cout << a;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
using str = string;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
const double PI = 3.141592653589793238;
const ll mod = 1000000007;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define REP(i, m, n) for (int i = m; i < (int)n; i++)
#define all(a) (a).begin(), (a).end()
#define allg(a) (a).begin(), (a).end(), greator<>()
#define d20 std::setprecision(20)
#define veci vector<int>
#define vecll vector<long long int>
#define vecb vector<bool>
#define vecd vector<double>
template <typename T>
T lcm(T a, T b)
{
	return a / __gcd(a, b) * b;
}
void comb(vector<vector<long long int>> &v)
{
	for (size_t i = 0; i < v.size(); i++)
	{
		v[i][0] = 1;
		v[i][i] = 1;
	}
	for (size_t k = 1; k < v.size(); k++)
	{
		for (size_t j = 1; j < k; j++)
		{
			v[k][j] = (v[k - 1][j - 1] + v[k - 1][j]);
		}
	}
}
ll repeat_squaring(ll n, ll p, ll m)
{
	if (p == 0)
		return 1;
	if (p % 2 == 0)
	{
		ll t = repeat_squaring(n, p / 2, m);
		return t * t % m;
	}
	return n * repeat_squaring(n, p - 1, m);
}

int main()
{
	int n, x;
	cin >> n >> x;
	ll now = 0;
	ll fre = 1;
	rep(i, n)
	{
		int tmp;
		cin >> tmp;
		now += tmp;
		if (now > x)
		{
			cout << fre << endl;
			return 0;
		}
		else
		{
			fre++;
		}
	}
	cout << fre << endl;
	return 0;
}

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

int main()
{
	int a, b;
	int temp;
	while (cin >> a >> b)
	{
		if (a < b)
		{
			temp = a;
			a = b;
			b = temp;
		}
		int a_ = a, b_ = b;
		while (a_ % b_ != 0)
		{
			temp = a_ % b_;
			a_ = b_;
			b_ = temp;
		}
		cout << b_ << " " << b / b_ * a << endl;
	}

	return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
typedef long long int lli;
typedef long long int ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef vector<pll> vop;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<int> vi;
typedef pair<int, int> pii;
#define REP(i,a,b) for( long long i=a;i<b;i++)
#define REPR(i,a,b) for(int i=a;i>=b;i--)
#define adb(a) for(auto ii:a) cout << ii << " "; cout << endl
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define all(x) (x).begin(),(x).end()
#define endl "\n"
#define mem(a,b) memset(a,b,sizeof(a))
#define mod 1000000007
#define PI 3.14159265358979323846
const ll MAXN = 100007;
const ll p = 1000000007;

struct LessSecond
{
    template<typename T, typename U>
    bool operator()(const std::pair<T, U> &x, const std::pair<T, U> &y) const
    {
        return x.second < y.second;
    }
};

ll power(ll a, ll b, ll m) { ll ans = 1; a = a % m; while (b) { if (b & 1) ans = (ans * a) % m; b /= 2; a = (a * a) % m; } return ans; }

ll lcm(ll a, ll b) { return (a * b) / __gcd(a, b); }

ll modInverse(ll a, ll m) { ll g = __gcd(a, m); return power(a, m - 2, m); }


int main()
{


    fastIO;
    int test = 1;
    //cin >> test;
    while (test--)
    {
        int n, ans = 0;
        cin >> n;
        REP(i, 1, n + 1)
        {
            int a;
            cin >> a;
            if (i & 1 && a & 1)
                ans++;
        }
        cout << ans << endl;
    }
    return 0;
}



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

int main() {
  int N, K, X, Y;
  cin >> N >> K >> X >> Y;
  
  if (K < N) {
    cout << K * X + (N - K) * Y << endl;
  }
  else {
    cout << N * X << endl;
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
using namespace std;
int tot,mn=0x3f3f3f3f;
int main(){
    int n; scanf("%d",&n);
    for(int i=1;i<=n;i++){
        int x; scanf("%d",&x);
        if(x<=mn) tot++,mn=x;
    }
    printf("%d",tot);
}

Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))

d={}
for i in range(len(a)):
      d.update([(i,a[i])])
new_d = sorted(d.items(),key=lambda x:x[1])

p=[]
for i in range(len(a)):
      p.append(new_d[i][0]+1)
print(' '.join(map(str,p)))

Measured memory_bytes: 34288
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;
import java.util.TreeSet;

import javax.swing.*;

import static java.util.Arrays.binarySearch;
import static java.util.Arrays.copyOfRange;

public class Main {

    public static void main(String[] args) throws Exception {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;

        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);

        Task solver = new Task();
        solver.solve(1, in, out);
        out.close();
    }
}

class Task {

    private static int mod = 1000000007;


    public void solve(int testNumber, InputReader in, PrintWriter out) {
        int n = in.nextInt();
        int m = in.nextInt();
        String s = in.next();
        List<Integer> ans = new ArrayList<>();
        boolean[] vis = new boolean[n + 1];
        int i, j;
        for (i = n; i > 0; i--) {
            for (j = Math.max(0, i - m); j < i; j++) {
                if (vis[j]) {
                    break;
                }
                vis[j] = true;
                if (s.charAt(j) == '0') {
                    ans.add(i - j);
                    i = j + 1;
                    break;
                }
            }
            if (i == j) {
                break;
            }
        }
        if (i != 0) {
            out.println(-1);
        } else {
            for (i = ans.size() - 1; i >= 0; i--) {
                out.print(ans.get(i) + " ");
            }
            out.println();
        }

    }

}

class InputReader {

    private final BufferedReader reader;
    private StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream));
        tokenizer = null;
    }

    public String nextLine() {
        try {
            return reader.readLine();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(nextLine());
        }
        return tokenizer.nextToken();
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }

}


Measured memory_bytes: 38508
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
int main()
{
   int n;
   cin >> n;
   vector<int>a(n);
   rep(i,n)cin >> a[i];
   vector<int>ex(9,0);
   for(int i=1;i<=8;i++){
      for(int j=0;j<n;j++){
         if(400*(i-1)<=a[j]&&a[j]<400*i){
            ex[i-1]++;
         }
      }
   }
   for(int i=0;i<n;i++){
      if(a[i]>=3200)ex[8]++;
   }
   vector<int>ans(2,0);
   rep(i,9){
      if(ex[i]>0){
         if(i==8){
            ans[0]+=ex[i];
            ans[1]=max(1,ans[1]);
         }
         else{
            ans[0]++;
            ans[1]++;
         }
      }
   }
   cout << ans[1] << " " << ans[0] << endl;


   return 0;
}

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

int main(){
    int n,a1[100],a2[100];
    cin >> n;
    for(int i=0; i!=n; i++){
        cin >> a1[i];
    }
    for(int i=0; i!=n; i++){
        cin >> a2[i];
    }
    int p = 0;
    int maxp = -1;
    for(int i=0; i!=n; i++){
        for(int j=0; j!=n+1; j++){
            if(j < n-i){
                p = p + a1[j];
            }else{
                p = p + a2[j-1];
            }
        }
        if(maxp < p){
            maxp = p;
        }
        p = 0;
    }
    cout << maxp << '\n';
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<LL,LL> P;
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; }
template<typename T> T gcd(T a,T b){return b?gcd(b,a%b):a;}
const LL mod=1000000007;
const LL LINF=1LL<<62;
const int INF=1<<30;
int dx[]={1,0,-1,0,1,-1,1,-1};
int dy[]={0,1,0,-1,1,-1,-1,1};


int main(){
    int x,n;cin >> x >> n;
    set<int> s;
    for (int i = 0; i < n; i++) {
        int p;cin >> p;
        s.insert(p);
    }
    int ans = 0, mi = INF;
    for (int i = 0; i <= 200; i++) {
        if(s.find(x - i) == s.end()){
            if(chmin(mi, i)) ans = x -  i;
        }
        if(s.find(i + x) == s.end()){
            if(chmin(mi, i)) ans = i + x;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3608
#include<stdio.h>
int a,b,c,d,i,j,k,l,p,r,s,ar1[100005][5],arr1[100005][5],u;
int abss(int o,int R)
{
	if(o-R<0)
	return(R-o);
	else
	return(o-R);
}
int maxx(int K,int L)
{
	if(K<L)
	return(L);
	else
	return(K);
}
int dp(int g,int h)
{
	if(g>a)
	return 0;
	if(arr1[g][h]!=-1)
	return(arr1[g][h]);
for(int J=1;J<=3;J++) {
	if(J!=h){
		arr1[g][h]=maxx(arr1[g][h],dp(g+1,J)+ar1[g][h]);
	}
}
//printf("%d\n",u);
//printf("%d %d\n",c,d);
	return(arr1[g][h]);
}
int main ()
{
	scanf("%d",&a);
	for(i=1;i<=a;i++)
	{
		for(j=1;j<=3;j++){
		scanf("%d",&ar1[i][j]);
		arr1[i][j]=-1;
		}
	}
	p=0;
	u=-1;
	for(i=1;i<=3;i++)
	p=maxx(p,dp(1,i));
	printf("%d\n",p);
	return 0;
}

Measured memory_bytes: 10368
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
  int N;
  int Alice = 0, Bob = 0;
  cin >> N;
  vector<int> a(N);
  for(int i = 0; i < N; i++){
    cin >> a.at(i);
  }
  sort(a.begin(), a.end(), greater<int>());
  for(int i = 0; i < N; i++){
    if(i % 2 == 0){
      Alice += a.at(i);
    }else{
      Bob += a.at(i);
    }
  }
  cout << Alice - Bob << endl;
}


Measured memory_bytes: 256
#include <cstdio>
    #include <algorithm>
    using namespace std;
     
    int A, B, X;
     
    int main()
    {
    	scanf("%d%d%d", &A, &B, &X);
     
    	bool isok = X >= A && X <= A + B;
     
    	if (isok) {
    		puts("YES");
    	} else {
    		puts("NO");
    	}
    	return 0;
    }

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


int main(void) {
	int k, n, i, a[2000003], dmax = 0;

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

	a[n] = k + a[0];

	for (i = 1; i <= n; i++) {
		dmax = max(dmax, a[i] - a[i - 1]);
	}

	cout << k - dmax << endl;

	return 0;
}

Measured memory_bytes: 2944
#include<stdio.h>

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


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

#define FOR(i,a,b) for(int i= (a); i<((int)b); ++i)
#define RFOR(i,a) for(int i=(a); i >= 0; --i)
#define FOE(i,a) for(auto i : a)
#define ALL(c) (c).begin(), (c).end()
#define RALL(c) (c).rbegin(), (c).rend()
#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v,x) (std::find(v.begin(), v.end(), x) != v.end())
#define BIT_ON(bit, i) (bit & (1LL << i))

typedef long long LL;
template<typename T> using V = std::vector<T>;
template<typename T> using VV = std::vector<std::vector<T>>;
template<typename T> using VVV = std::vector<std::vector<std::vector<T>>>;
template<typename T> using VVVV = std::vector<std::vector<std::vector<std::vector<T>>>>;

template<class T> inline T ceil(T a, T b) { return (a + b - 1) / b; }
template<class T> inline void print(T x) { std::cout << x << std::endl; }
template<class T> inline void print_vec(const std::vector<T> &v) { for (int i = 0; i < v.size(); ++i) {  if (i != 0) {std::cout << " ";} std::cout << v[i];} std::cout << "\n"; }
template<class T> inline bool inside(T y, T x, T H, T W) {return 0 <= y and y < H and 0 <= x and x < W; }
template<class T> inline double euclidean_distance(T y1, T x1, T y2, T x2) { return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)); }
template<class T> inline double manhattan_distance(T y1, T x1, T y2, T x2) { return abs(x1 - x2) + abs(y1 - y2); }
template<typename T> T &chmin(T &a, const T &b) { return a = std::min(a, b); }
template<typename T> T &chmax(T &a, const T &b) { return a = std::max(a, b); }
template<class T> inline std::vector<T> unique(std::vector<T> v) {
    sort(v.begin(), v.end());
    v.erase(unique(v.begin(), v.end()), v.end());
    return v;
}
// 初項s, 交差dのn個の数列の和
long long sum_of_arithmetic_progression(long long s, long long d, long long n) {
    return n * (2 * s + (n - 1) * d) / 2;
}

const int INF = 1 << 30;
const double EPS = 1e-9;
const std::string YES = "YES", Yes = "Yes", NO = "NO", No = "No";
const std::vector<int> dy4 = {0, -1, 0, 1}, dx4 = {1, 0, -1, 0};
const std::vector<int> dy8 = { 0, -1, 0, 1, 1, -1, -1, 1 }, dx8 = { 1, 0, -1, 0, 1, 1, -1, -1 };

using namespace std;


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

	int N;
	cin >> N;
	V<double> P(N);
	FOR(i, 0, N) {
	    cin >> P[i];
	}

    VV<double> dp(N + 1, V<double>(N + 1));
	dp[0][0] = 1;
	FOR(i, 0, N) {
	    FOR(j, 0, N) {
	        // 表
	        dp[i + 1][j + 1] += dp[i][j] * P[i];

	        // 裏
            dp[i + 1][j] += dp[i][j] * (1 - P[i]);
	    }
	}

	double ans = 0;
    FOR(h, 0, N + 1) {
        int t = N - h;
        if (h > t) {
            ans += dp[N][h];
        }
    }
    cout << fixed << setprecision(10) << ans << endl;

	return 0;
}

Measured memory_bytes: 70784
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <algorithm>
using namespace std;

int n;
int a[100010];

int main() {
	ios::sync_with_stdio(false);
	cin >> n;
	long long ans = 0;
	for (int i = 1; i <= 2 * n; i ++)
		cin >> a[i];
	sort (a + 1, a + 2 * n + 1);
	for (int i = 1; i <= 2 * n; i += 2)
		ans += a[i];
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <string>
#include <array>
#include <deque>
#include <forward_list>
#include <list>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <iterator>
#include <algorithm>
#include <iostream>

#include <regex>
#include <atomic>
#include <thread>

using namespace std;
void Swap(vector<int>& v, int first, int second) {
    if(static_cast<int>(v.size()) > max(first, second)) {
        int tmp = v[first];
        v[first] = v[second];
        v[second] = tmp;
    }
}

int main() {
    static const int input_num = 3;
    vector<int> v = {};

    for(int i = 0; i < input_num; ++i) {
        int val = 0;
        cin >> val;
        v.push_back(val);
    }

    Swap(v, 0, 1);
    Swap(v, 0, 2);
    
    for(int value : v) {
        cout << value << " ";
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>	// require sort next_permutation count __gcd reverse etc.
#include <cstdlib>	// require abs exit atof atoi 
#include <cstdio>		// require scanf printf
#include <functional>
#include <numeric>	// require accumulate
#include <cmath>		// require fabs
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip>	// require setw
#include <sstream>	// require stringstream 
#include <cstring>	// require memset
#include <cctype>		// require tolower, toupper
#include <fstream>	// require freopen
#include <ctime>		// require srand
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()

using namespace std;

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

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

int in[10][10];
int cnt[10][10];
int ans[10][10];

int color(int y, int x )
{
	int tmp = in[y][x];
	rep (k, 5 ){
		int nx = x + dx[k];
		int ny = y + dy[k];
		if (nx < 0 || nx >= 10 || ny < 0 || ny >= 10 ) continue;
		tmp += cnt[ny][nx];
	} // end rep
	
	return tmp%2;
}

int solve()
{
	for (int i = 1; i < 10; i++ ) rep (j, 10 ) if (color(i-1, j ) ) cnt[i][j] = 1;
	rep (i, 10 ) if (color(9, i ) ) return -1;
	
	int ret = 0;
	rep (i, 10 ) rep (j, 10 ) ret += cnt[i][j];

	return ret;	
}

void dfs ()
{
	int res = -1;
	rep (i, 1<<10 ){
		memset (cnt, 0, sizeof (cnt ) );
		rep (j, 10 ) cnt[0][j] = (i>>j) & 1;
		int t = solve();
		if (t >= 0 && (res < 0 || res > t ) ){
			res = t;
			memcpy (ans, cnt, sizeof (cnt ) );
		} // end if
	} // end rep
}

int main()
{
	int T; cin >> T;
	while (T--){
		memset (in, 0, sizeof (in ) );
		memset (ans, 0, sizeof (ans ) );
		rep (i, 10 ) rep (j, 10 ) cin >> in[i][j];
		dfs ();
		rep (i, 10 ) rep (j, 10 ) cout << ans[i][j] << ( j < 9 ? ' ' : '\n' );
	} // end while
		
	return 0;
}

Measured memory_bytes: 1160
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);

    String pat = "";
    for (int i = 0; i < 50001; i++) {
      pat += "01";
    }

    String s = sc.next();
    int n01 = 0;
    int n10 = 0;

    for (int i = 0; i < s.length(); i++) {
      if (pat.charAt(i) != s.charAt(i)) {
        n01++;
      }
    }

    for (int i = 0; i < s.length(); i++) {
      if (pat.charAt(i + 1) != s.charAt(i)) {
        n10++;
      }
    }

    System.out.println(Math.min(n01, n10));

  }
}

Measured memory_bytes: 57612
#include <stdio.h>

int main(void)
{
	int num[10];
	int in;
	int ord[10];
	int i;
	
	for (i = 0; i < 10; i++){
		num[i] = 0;
	}
	while (scanf("%d", &in) == 1){
		if (in != 0){
			for (i = 0; i < 10; i++){
				if (!num[i]){
					num[i] = in;
					break;
				}
			}
		}
		else {
			for (i = 9; i >= 0; i--){
				if (num[i] != 0){
					printf("%d\n", num[i]);
					num[i] = 0;
					break;
				}
			}
		}
	}
	
	return (0);
}

Measured memory_bytes: 1028
#include <bits/stdc++.h>
#include <variant>
#define FOR(i,k,n)  for(int i = (k);i < (n);++i)
#define REP(i,n)    FOR(i,0,n)
#define ALL(x) begin(x),end(x)

using namespace std;
using namespace std::string_literals;
using ll = int64_t;
using vecint = vector<int>;
using vecll = vector<ll>;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll n,k;
  cin>>n>>k;
  vector<tuple<ll,ll>> vt;
  REP(i,n) {
    ll t,d;
    cin>>t>>d;
    --t;
    vt.emplace_back(d,t);
  }
  sort(ALL(vt));
  reverse(ALL(vt));
  vector<vecll> vv(n);
  ll val = 0;
  ll sum = 0;
  REP(i,k) {
    auto&&[d,t] = vt[i];
    sum += d;
    if (vv[t].empty()) ++val;
    vv[t].push_back(d);
  }
  ll ans = sum + val*val;
  int j = k-1;
  FOR(i,k,n) {
    auto&&[d,t] = vt[i];
    if (vv[t].size() > 0) continue;
    sum += d;
    ++val;
    vv[t].push_back(d);
    while (j >= 0) {
      auto&&[dj,tj] = vt[j];
      --j;
      if (vv[tj].size() > 1) {
        sum -= vv[tj].back();
        vv[tj].pop_back();
        break;
      }
    }
    if (j >= 0) {
      ans = max(ans, sum + val*val);
    }
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 10304
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b;
string e;
cin >> a >> b;
if(a > b){
e = ">";
}
else if (a < b){
e = "<";
}
else if (a == b){
e = "==";
}

cout << "a" << " " << e << " " << "b" << endl;
}


Measured memory_bytes: 3152
A = int(input())
B = int(input())
C = int(input())
X = int(input())
count = 0
for i in range(A + 1):
    for j in range(B + 1):
        for k in range(C + 1):
            if i * 500 + j * 100 + k * 50 == X:
                count += 1
print(count)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main(){
	string s;
	cin>>s;
	int maxn=0,sum=0;
	for(int i=0;i<s.length();i++){
		if(s[i]=='R')sum++,maxn=max(maxn,sum);
		else sum=0;
	}
	cout<<maxn;
	return 0;
} 

Measured memory_bytes: 3624
// AUTHOR - SANDEEP PRADHAN
#pragma GCC optimize("O3")
#define _CRT_SECURE_NO_WARNINGS
#include <fstream>
#include <iostream>
#include <string>
#include <complex>
#include <math.h>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <stdio.h>
#include <stack>
#include <algorithm>
#include <list>
#include <ctime>
#include <memory.h>
#include <assert.h>
#include<limits.h>


#define eps 1e-8
#define PI 3.141592653589793
#define bsize 512

#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<vector<int>>
#define pb push_back
#define bs 1000000007

using namespace std;


int main()
{
    ios_base::sync_with_stdio(false) ;
    cin.tie(NULL) ;
    cout.tie(NULL) ;
    
    int h, w;
    cin >> h >> w;
    vector< string > a(h);
    vector< vector<int> > dp(h+1, vector<int> (w+1, 0));
    for(int i=0; i<h; i++)
            cin >> a[i];

    dp[1][1]=1;
    for(int i=1; i<=h; i++)
    {
        for(int j=1; j<=w; j++)
        {
            if(a[i-1][j-1] == '.')
                dp[i][j] = max(dp[i][j], dp[i-1][j] + dp[i][j-1]) % bs;
            else
                dp[i][j] = 0;
        }
    }
 
    cout << dp[h][w] << endl;

    return 0;
}


Measured memory_bytes: 5248
import java.util.*;

public class Main {
    public static void main(String[] args) {
        try(Scanner scn = new Scanner(System.in)) {
            int n;
            while((n = scn.nextInt()) != 0) {
                int sum = 0;
                for(int m = scn.nextInt(); n <= m; n++) {
                    if(isHamming(n)) {
                        sum++;
                    }
                }
                System.out.println(sum);
            }
        }
    }

    private static boolean isHamming(int num) {
        while(num % 5 == 0) {
            num /= 5;
        }
        while(num % 3 == 0) {
            num /= 3;
        }
        while(num % 2 == 0) {
            num /= 2;
        }
        return num == 1;
    }
}

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

namespace AGC029D
{
    class Program
    {

        static void Main()
        {
            int H, W, N;
            {
                var HWN = Console.ReadLine().Split().Select(int.Parse).ToArray();
                H = HWN[0];
                W = HWN[1];
                N = HWN[2];
            }

            int[] minY = new int[H + 2];
            {
                for (int i = 0; i < H + 2; i++) minY[i] = W + 1;
                for (int i = 0; i < N; i++)
                {
                    int[] XY = Console.ReadLine().Split().Select(int.Parse).ToArray();
                    minY[XY[0]] = Math.Min(minY[XY[0]], XY[1]);
                }
            }

            int count = 1;
            int width = 1;
            for (int i = 2; i < H + 1; i++)
            {
                if (minY[i] <= width) break;
                else if (minY[i] == width +1)
                {
                    count++;
                }
                else if (minY[i] > width +1)
                {
                    width++;
                    count++;
                }
            }

            Console.WriteLine(count);
            Console.ReadKey();
        }
    }
}


Measured memory_bytes: 18016
// B - Guidebook

#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define rep(i, m, n) for (lli i = m; i < (n); i++)
#define repe(i, m, n) for (lli i = m; i <= (n); i++)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((lli)(x).size())
#define MAX(x) *max_element(ALL(x))
#define _GLIBCXX_DEBUG
const lli INF = 2147483647;
const lli MINF = -2147483648;
const lli LINF = 9223372036854775807;
const lli MOD = 1000000007; //10^9+7
const long double PI = acos(-1);
#define SORT(n) sort(n.begin(), n.end())
#define SORTR(n) sort(n.begin(), n.end(), greater<int>())
#define REV(n) reverse(n.begin(), n.end())
#define Vec(K, L, N, S) vector<L> K(N, S)
#define rt sqrt
#define pb push_back
#pragma GCC optimize("Ofast")
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vlli = vector<lli>;
using P = pair<lli, lli>;
// vector<P> vp;
// vp.emplace_back(a[i], b[i]);
using vs = vector<string>;
using ll = long long;
// vector入力
template <typename T>
istream &operator>>(istream &is, vector<T> &vec)
{
  for (T &x : vec)
    is >> x;
  return is;
}
// vector出力
template <typename T>
ostream &operator<<(ostream &os, vector<T> &vec)
{
  // os << '{';
  for (int i = 0; i < vec.size(); i++)
  {
    os << vec[i] << (i + 1 == vec.size() ? "" : "");
  }
  // os << '}';
  return os;
}
// aよりもbが大きいならばaをbで更新する(更新されたならばtrueを返す)
template <typename T>
bool chmax(T &a, const T &b)
{
  if (a < b)
  {
    a = b; // aをbで更新
    return true;
  }
  return false;
}
// aよりもbが小さいならばaをbで更新する(更新されたならばtrueを返す)
template <typename T>
bool chmin(T &a, const T &b)
{
  if (a > b)
  {
    a = b; // aをbで更新
    return true;
  }
  return false;
}

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  lli a, b, c, h, k, n, w, ans = 0, count = 1;
  string s, t;
  cin >> n;
  // pair<string, lli> d;
  using P = pair<string, lli>;
  vector<P> vp, vx;

  rep(i, 0, n)
  {
    cin >> s >> a;
    a *= -1;
    // d.emplace_back(s, a);
    vp.emplace_back(s, a);
  }
  vx = vp;
  SORT(vp);

  for (auto &v : vp)
  {
    string city = v.first;
    lli num = v.second;
    num *= -1;
    // cout << city << ": " << num << endl;
    for (auto &vv : vx)
    {
      lli num2 = vv.second;
      num2 *= -1;
      if (num2 == num)
      {
        cout << count << endl;
        count++;
      }
      else
      {
        count++;
      }
      // cout << num2 << endl;
    }
    count = 1;
  }
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String input = sc.next();
        sc.close();
        String result = "None";
        String c;
        for(int i = 0; i < 26; i++){
            c = String.valueOf((char)(97 + i));
            if(!input.contains(c)){
                result = c;
                break;
            }
        }
        System.out.println(result);
    }

}

Measured memory_bytes: 24916
/*input
ABC
*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 

#define rep(i,j,n) for(i=j;i<n;i++)
#define repi(i,j,n) for(i=j;i>n;i--)
#define inf 100001
#define M 1000000007
#define ll long long
#define ld long double
#define vll vector<long long>
#define vi vector<int>
#define pll pair<long long,long long>
#define pii pair<int,int>
#define vpii vector<pair<int,int> >
#define vpll vector<pair<long long,long long> >
#define pb push_back
#define pf pop_front
#define F first
#define S second
#define endl '\n'

using namespace std;
using namespace __gnu_pbds; 

template<typename T>
using ordered_set=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;


ll power(ll a,ll m,ll mod){
    ll ans=1;
    while(m){
        if(m%2){
            ans*=a;
            ans%=(mod);
        }
        a=(a*a)%(mod);
        m>>=1;
    }
    return ans;
}


void init(ll* a,ll n,ll val){
    for(ll i=0;i<n;i++)
        a[i]=val;
}



int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL); 
    ll t=1,i,j;
    string s;
    cin>>s;
    if(s[1]=='B')s[1]='R';
    else s[1]='B';
    cout<<s<<endl;
    return 0;
}




Measured memory_bytes: 3560
#include<stdio.h>

int main(){
  int flag=1,i,j,a,count=0;
  int N,A[100];
  scanf("%d",&N);
  for(i=0;i<N;i++){
    scanf("%d",&A[i]);

  }
  while(flag){
    flag=0;
    for(j=N-1;j>=1;j--){
      if(A[j]<A[j-1]){
	a=A[j];
	A[j]=A[j-1];
	A[j-1]=a;
	flag=1;
	count++;
      }
    }

  }
  for(i=0;i<N-1;i++){
    printf("%d ",A[i]);
  }
  printf("%d\n",A[N-1]);
  printf("%d\n",count);
  return 0;
}

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

#include<cstdio>
#define r(i,n) for(int i=0;i<n;i++)


int main(void){
  string n;
  cin>>n;
  r(i,n.size()){
    if(n.at(i)=='1')cout<<9;
    else if(n.at(i)=='9')cout<<1;
    else cout<<n.at(i);
  }
  cout<<endl;





return 0;}


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

using namespace std;

const int N = 105;
int n, a[N], b[N];

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

    cin >> n;
    for(int i = 1; i <= n; i++){
        cin >> a[i] >> b[i];
    }
    bool can = 0;
    for(int i = 2; i <= n - 1; i++){
        if(a[i] == b[i] && a[i - 1] == b[i - 1] && a[i + 1] == b[i + 1]){
            can = 1;
        }
    }
    cout << ((can) ? "Yes\n" : "No\n");
    return 0;
}

Measured memory_bytes: 3648
N = int(input())
A = [0]*N
for I in range(0,N):
    A[I] = int(input())
    
Disp = [max(A)]*N
Sort = sorted(A,reverse=True)[:2]
if Sort[0]==Sort[1]:
    print('\n'.join(map(str,Disp)))
else:
    Disp[A.index(max(A))] = Sort[1]
    print('\n'.join(map(str,Disp)))

Measured memory_bytes: 35024
#include<iostream>
using namespace std;
struct node{
	int p;
	int left;
	int right;
};
struct node tree[30];

void Preorder(int n)
{
	if(n==-1)
		return;
	cout<<" "<<n;
	Preorder(tree[n].left);
	Preorder(tree[n].right);
}

void Inorder(int n)
{
	if(n==-1)
		return;
	Inorder(tree[n].left);
	cout<<" "<<n;
	Inorder(tree[n].right); 
	
}

void Postorder(int n)
{
	if(n==-1)
		return;
	Postorder(tree[n].left);
	Postorder(tree[n].right); 
	cout<<" "<<n;
}

int main()
{
	int n;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		tree[i].p=tree[i].left=tree[i].right=-1;
	}
	for(int i=0;i<n;i++)
	{
		int p,l,r;
		cin>>p>>l>>r;
		tree[p].left=l;
		tree[p].right=r;
		if(l!=-1)
		{
			tree[l].p=p;	
		}
		if(r!=-1)
		{
			tree[r].p=p;
		}
	}
	int root=0;
	for(int i=0;i<n;i++)
	{
		if(tree[i].p==-1)
		{
			root=i;
			break;
		}
	}
	cout<<"Preorder"<<endl;
	Preorder(root);
	cout<<endl;
	cout<<"Inorder"<<endl;
	Inorder(root);
	cout<<endl;
	cout<<"Postorder"<<endl;
	Postorder(root);
	cout<<endl;
	
	return 0;
} 


Measured memory_bytes: 3100
#include<bits/stdc++.h>
using namespace std;
int main()
{
bool prime[1000001];
for(int i=2;i<1000001;i++)prime[i]=0;
for(int i=2;i<=sqrt(1000000);i++){
if(prime[i]==0){
for(int j=i+i;j<1000001;j+=i)prime[j]=1;
}
}
int n,cou=0;
while(cin>>n&&n!=0){
for(int i=2;i<=n/2;i++)if(prime[i]==0&&prime[n-i]==0)cou++;
cout<<cou<<endl;
cou=0;
}
}

Measured memory_bytes: 2136