akhauriyash/Code-Regression huggingface dataset:
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower

using namespace std;

int my_abs(int num) {
    if (num > 0)
        return num;
    else
        return -num;
}

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

long long lcm(long long a, long long b) {
    return a * b / gcd(a, b);
}

int main() {
    int N;
    cin >> N;
    vector<int> gu(N);
    for (int i = 0; i < N; i++) {
        cin >> gu.at(i);
    }
    sort(gu.begin(), gu.end());
    double ans = (double)(gu.at(0) + gu.at(1)) / 2;
    for (int j = 2; j < N; j ++) {
        ans = (gu.at(j) + ans) / 2;
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
N = int(input())
A = map(int, input().split())
A = list(A)

stage_hight = []
for i, ai in enumerate(A):
	if i != 0 and ai < A[i-1]:
		stage_hight.append(A[i-1] - ai)
		A[i] = A[i-1]
print(sum(stage_hight))


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

int main(){
    int p, q, r;
    cin >> p >> q >> r;
    cout << p + q + r - max({p, q, r});

    return 0;
}

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

using namespace std;

string x, y;

int dp[3010][3010];

int solve(int i, int j){
    if(i==x.size() or j==y.size()) return 0;

    if(dp[i][j] != -1) return dp[i][j];

    if(x[i] == y[j]) return dp[i][j] = 1 + solve(i+1, j+1);

    return dp[i][j] = max(solve(i,j+1), solve(i+1, j));
}

vector<char> sol;

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

    cin >> x >> y;

    for(int i=0;i<x.size();++i)
        for(int j=0;j<y.size();++j)
            dp[i][j] = -1;

    int i=0, j=0;
    while(i < x.size() and j<y.size()){
        if(!solve(i,j)) break;
        if(x[i] == y[j]){
            sol.push_back(x[i]);
            i++;j++;
        }
        else{
            if(i+1 < x.size() and solve(i+1, j) == solve(i,j))
                i++;
            else if(j+1 < y.size() and solve(i, j+1) == solve(i,j))
                j++;
        }
    }    

    for(int i=0;i<sol.size();++i)
        cout << sol[i];
    cout << '\n';
    
    return 0;
}

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

int main() {
    int n;
    long long a;
    long long minValue = 1000000;
    long long maxValue = -1000000;
    long long sum = 0;
    
    cin >> n;
    for (int i = 0;i < n;i++){
        cin >> a;
        if(a < minValue) minValue = a;
        if(a > maxValue) maxValue = a;
        sum += a;
    }
    
    cout << minValue << " "<< maxValue << " " << sum << endl;
    
    return 0;
}

Measured memory_bytes: 1172
#include <stdio.h>
#include <stdlib.h>

int partition(int *,int,int);

int *A;

int main(){
  int n,i,index;

  scanf("%d",&n);

  A = (int *)malloc(sizeof(int) * n);
  if(A == NULL) exit(0);

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

  index = partition(A,0,n-1);

  /* 出力 */
  for(i = 0;i < n;i++){
    if(i > 0) printf(" ");
    if(i == index) printf("[%d]",A[i]);
    else printf("%d",A[i]);
  }
  printf("\n");
    return 0;
}

int partition(int *A,int p,int r) /* p = 要素の始め、r = 要素の終わり */
{
  int x,i,j,stack;

  x = A[r]; /* xはpartitionの基準 */
  i = p - 1;

  for(j = p;j <= r - 1;j++){
    if(A[j] <= x){
      i = i + 1;
      stack = A[i];
      A[i] = A[j];
      A[j] = stack;
    }
  }
  stack = A[i + 1];
  A[i + 1] = A[r];
  A[r] = stack;

  return i+1; /* 次のpartitionの基準となる値を返す */
}

Measured memory_bytes: 996
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>

using namespace std;

int N, K, d[105], A[105][105];

int used[105];

int main(void) {

	cin >> N >> K;

	for (int i = 1; i <= K; i++) {
		cin >> d[i];
		for (int j = 1; j <= d[i]; j++) {
			cin >> A[i][j]; used[A[i][j]]++;
		}
	}

	int ans = N;
	for (int i = 1; i <= N; i++) {
		if (used[i] > 0) { ans--; }
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3600
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>
#include <random>

using namespace std;

#define int long long

const int MOD = 1e9 + 7;

int add(int a, int b) {
    return (a + b) % MOD;
}

int mul(int a, int b) {
    return (a * b) % MOD;
}

int binpow(int a, int b) {
    int res = 1;
    while (b) {
        if (b & 1) res = mul(res, a);
        a = mul(a, a);
        b >>= 1;
    }
    return res;
}

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

    int n;
    cin >> n;
    vector<int> a(n);
    for (auto &t : a) {
        cin >> t;
    }
    vector<int> ps(n);
    for (int i = 1; i < n; i++) {
        ps[i] = add(ps[i - 1], binpow(i, MOD - 2));
    }
    int ans = 0;
    for (int i = 0; i + 1 < n; i++) {
        int d = (a[i + 1] - a[i]);
        int in = ps[i + 1];
        ans = add(ans, mul(d, in));
    }
    for (int i = 1; i <= n - 1; i++) {
        ans = mul(ans, i);
    }
    cout << ans << endl;
    
}   

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

int main(){
  int N;
  cin >> N;
  int c = 0;
  bool flag = false;
  for(int i = 0; i < N; i++){
    int d1,d2;
    cin >> d1 >> d2;
    if(d1 == d2) c += 1;
    else c = 0;
    if(c == 3) flag = true;
  }
  if(flag) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 3628
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(void){
  int N;
  cin >> N;
  
  vector<vector<int>>F(N,vector<int>(11,0));
  for(int i=0;i<N;i++){
    for(int j=0;j<10;j++){
      cin >> F[i][j];
    }
  }
 
  vector<vector<int>>P(N,vector<int>(11,0));
  for(int i=0;i<N;i++){
    for(int j=0;j<11;j++){
      cin >> P[i][j];
    }
  }
  
  int res = (-1<<30);
  for(int b= 1;b < (1 << 10);b++){
    int cc = 0;
    for(int i=0;i<N;i++){
      int c = 0;
      for(int j=0;j<10;j++){
        if((b >> j&1) && F[i][j])
          c++;
      }
      cc += P[i][c];
    }
    if(res < cc)
      res = cc;
  }
  
  cout << res << endl;
  
  return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"math"
)

func main() {
	var a,b,c,d float64
	fmt.Scan(&a,&b,&c,&d)

	if math.Abs(a-c) <= d || (math.Abs(a-b) <= d && math.Abs(b-c) <= d) {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}

Measured memory_bytes: 512
import java.util.*;

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

        char A = sc.next().charAt(0);
        char B = sc.next().charAt(0);

        if(A<B){
            System.out.println("<");
        }
        else if(A>B){
            System.out.println(">");
        }
        else{
            System.out.println("=");
        }
    }
}

Measured memory_bytes: 23636
S = input()
N = len(S)

cnt1 = 0
for i in range(N):
    if int(S[i]) % 2 == i % 2:
        cnt1 += 1

cnt2 = 0
for i in range(N):
    if int(S[i]) % 2 != i % 2:
        cnt2 += 1

ans = min(cnt1, cnt2)
print(ans)


Measured memory_bytes: 3188
using System;
using System.Text;

namespace ALDS1_6_B_partition
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = getint();
            var input = getsplit();
            int[] A = Array.ConvertAll(input, int.Parse);
            int d = partition(A, 0, n - 1);

            StringBuilder sb = new StringBuilder();
            for (int i = 0; i < d; i++)
            {
                sb.Append(A[i] + " ");
            }
            sb.Append("[" + A[d] + "] ");
            for (int i = d+1; i < n; i++)
            {
                sb.Append(A[i] + " ");
            }
            Console.WriteLine(sb.ToString().Trim());
        }
        static int partition(int[] A, int p, int r)
        {
            int x = A[r];
            int i = p - 1;
            for (int j = p; j < r; j++)
            {
                if (A[j] <= x)
                {
                    i++;
                    int k = A[j];
                    A[j] = A[i];
                    A[i] = k;
                }
            }
            int l = A[i + 1];
            A[i + 1] = A[r];
            A[r] = l;
            return i + 1;
        }
        public static string[] getsplit()
        {
            string[] x = Console.ReadLine().Split(' ');
            return x;
        }
        public static int getint()
        {
                int x = int.Parse(Console.ReadLine());
                return x;
          
        }

    }
}

Measured memory_bytes: 18624
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using u32 = uint32_t;
using vi = vector<int>;    using vvi = vector<vi>;
using vb = vector<bool>;   using vvb = vector<vb>;
using vl = vector<ll>;     using vvl = vector<vl>;
using vd = vector<double>; using vvd = vector<vd>;

#define MAXC(c, x) (c = max(c, x))

#define REP(i,n) for(auto i = 0 * (n), i##_len = (n); i < i##_len; ++i)
#define ALL(c) (c).begin(), (c).end()
#define FOR(i,s,n) for(ll i=s, i##_len=(ll)(n); i<i##_len; ++i)
#define TEN(x) ((ll)1e##x)
const ll mod = TEN(9) + 7;

int main() {
#ifdef INPUT_FROM_FILE
	ifstream cin("sample.in");
	ofstream cout("sample.out");
#endif
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(50);
	ll n; cin >> n;
	vl x(n); REP(i, n) cin >> x[i];
	
	{
		vl add(n * n + 1, 0);
		REP(i, n) add[x[i]] += i + 1;
		FOR(i, 1, n * n + 1) add[i] += add[i - 1];
		FOR(i, 1, n * n + 1) if (i < add[i]) {
			cout << "No" << endl;
			return 0;
		}
	}

	vl add_rev(n * n + 1, 0);
	REP(i, n) add_rev[x[i]] += n - (i + 1);
	for (ll i = n * n - 1; i > 0; --i) add_rev[i] += add_rev[i + 1];
	FOR(i, 1, n * n + 1) if (n * n - i < add_rev[i]) {
		cout << "No" << endl;
		return 0;
	}

	vl y(n * n + 1, -1); REP(i, n) y[x[i]] = i + 1;
	using P = tuple<ll, ll, ll>;
	vb fin(n + 1, false);
	priority_queue<P, vector<P>, greater<P>> que;
	FOR(i, 1, n) que.push(P{ x[i] - (i + 1), i, i + 1}); // x[i] までに i 個消費する必要がある
	FOR(i, 1, n * n + 1) {
		if (y[i] != -1) {
			if (y[i] != n) {
				// n * n以内にn - y[i]個消費する必要がある
				que.push(P{ n * n - (n - y[i]), n - y[i], y[i] });
			}
		} else if (!que.empty()) {
			auto p = que.top(); que.pop();
			y[i] = get<2>(p);
			get<1>(p)--;
			get<0>(p)++;
			if (get<1>(p) != 0) que.push(p);
			else fin[get<2>(p)] = true;
		} else {
			cout << "No" << endl;
			return 0;
		}
	}

	cout << "Yes" << endl;
	FOR(i, 1, n * n + 1) cout << y[i] << " ";
	cout << endl;

	return 0;
}

Measured memory_bytes: 5084
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <vector>
#include <string>
using namespace std;
typedef double  dbl;
typedef long long int lld;
#define PI 3.14159265358979323
#define foi(i,n) for(i = 0; i < n; i+=1)
#define fod(i,n) for(i=n-1; i >=0; i-=1)
#define MAX std::numeric_limits<lld>::max()
#define MIN std::numeric_limits<lld>::min()
#define FastIO  ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
int main ()
{
	FastIO
	lld n, i;
	cin >> n;
	lld B[n];
	foi(i, n)
	{
		lld r;
		cin >> r;
		B[r-1] = i+1;
	}
	foi(i, n)
	{
		cout << B[i] << " ";
	}
	return 0;
}

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

const int inf = 1e9 + 13;

signed main () {
    string s;
    cin >> s;
    int n = s.size();
    if (n == 2) {
        if (s[0] == s[1]) {
            cout << "1 2\n";
            return 0;
        }
    }
    for (int i = 0; i < n - 2; ++i) {
        if (s[i] == s[i + 1] || s[i + 1] == s[i + 2] || s[i + 2] == s[i]) {
            cout << i + 1 << ' ' << i + 3 << '\n';
            return 0;
        }
    }
    cout << "-1 -1\n";
}


Measured memory_bytes: 512
#include<iostream>
using namespace std;
long long gcd(long long a, long long b)
{
    return b ? gcd(b, a % b) : a;
}
int main(){
  long long a,b,c,d,e;
  cin>>a>>b>>c>>d;
  e = (c * d) /gcd(c,d);
  cout<<(b-a+1) - (b/c) - (b/d) + ((a-1)/c) + ((a-1)/d) + (b/e) - ((a-1)/e) <<endl;
}

Measured memory_bytes: 256
/*Lucky_Glass*/
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;

#define cs const int &
#define upd(a,b) a=Add(a,b)
const int N=105,MOD=1e9+7;
inline int Add(cs a,cs b){return a+b>=MOD? a+b-MOD:a+b;}

inline int Ri(){
	register int r=0,c=getchar();
	while(c<'0' || '9'<c) c=getchar();
	while('0'<=c && c<='9') r=(r<<1)+(r<<3)+c-'0',c=getchar();
	return r;
}

int n;
int A[N],f[N][N][N];

int main(){
	n=Ri();
	for(int i=1;i<=2*n-1;i++) A[i]=Ri();
	sort(A+1,A+2*n);
	f[n][0][0]=1;
	for(int i=n-1;i>=1;i--){
		int dl=A[i]!=A[i+1],dr=A[2*n-i]!=A[2*n-i-1];
		for(int L=0;L<2*n;L++)
			for(int R=0;R<2*n;R++){
				upd(f[i][L+dl][R+dr],f[i+1][L][R]);
				for(int k=0;k<L+dl;k++)
					upd(f[i][k][R+dr+1],f[i+1][L][R]);
				for(int k=0;k<R+dr;k++)
					upd(f[i][L+dl+1][k],f[i+1][L][R]);
			}
	}
	int ans=0;
	for(int L=0;L<2*n;L++)
		for(int R=0;R<2*n;R++)
			upd(ans,f[1][L][R]);
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 3708
#include <bits/stdc++.h>
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define reprrev(i,a,b) for(int i=b-1;i>=a;i--) // [a, b)
#define reprev(i,n) reprrev(i,0,n)
typedef long long ll;
typedef unsigned long long ull;
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; }

/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    ごちゃごちゃ場合分けを考える前に全探索は考えましたか？
    詰まった時に、別の分野の問題として考え直す（これdpでは？、グラフとしてみればいいのでは？）
    多くの問題はパターンマッチだが、パターンに落とし込むまでが難しく、そのための訓練としてわからない問題をあれこれ色々な角度から考察してみるのではないか
    cin.tie(0);
    ios::sync_with_stdio(false);<- これら、printfとかと併用しない方が良さそう

*/

const ll mod = 1e9+7;

void chmod(ll &M){
    if(M >= mod) M %= mod;
    else if(M < 0){
        M += (abs(M)/mod + 1)*mod;
        M %= mod;
    }
}

int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };

/* <--------------------------------------------> */


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

    int N, K; cin >> N >> K;
    vector<int> a;
    rep(i, N){
        int t; cin >> t;
        if(t<K) a.push_back(t);
    }
    sort(a.begin(), a.end());
    N=a.size();
    vector<vector<bool>> dpl(N+5, vector<bool>(K+5, false)), dpr(N+5, vector<bool>(K+5, false));
    dpl[0][0]=true;
    rep(i, N) rep(j, K+1){
        dpl[i+1][j] = dpl[i+1][j] | dpl[i][j];
        if(j-a[i]>=0) dpl[i+1][j] = dpl[i+1][j] | dpl[i][j-a[i]];
    }
    dpr[N+1][0]=true;
    reprev(i, N) rep(j, K+1){
        dpr[i+1][j] = dpr[i+1][j] | dpr[i+2][j];
        if(j-a[i]>=0) dpr[i+1][j] = dpr[i+1][j] | dpr[i+2][j-a[i]];
    }

    int ans=0;
    repr(i, 1, N+1){
        vector<int> L, R;
        rep(j, K+1){
            if(dpl[i-1][j]) L.push_back(j);
            if(dpr[i+1][j]) R.push_back(j);
        }
        // rep(j, L.size()) cout << L[j] << ' ';
        // cout << endl;
        // rep(j, R.size()) cout << R[j] << ' ';
        // cout << endl;
        bool flg=true;
        rep(j, (int)L.size()){
            int left=L[j];
            if( lower_bound(R.begin(), R.end(), K-left) - lower_bound(R.begin(), R.end(), K-a[i-1]-left) > 0 ){
                flg=false; break;
                
            }
        }
        if(flg) ++ans;
    }
    cout << ans << endl;

    
    return 0;
}


Measured memory_bytes: 7040
using System;
class p
{
  static void Main()
  {
    string[] ipt = Console.ReadLine().Split(' ');
    int X = int.Parse(ipt[0]);
    int Y = int.Parse(ipt[1]);
    bool result = false;
    for (int i = 0; i <= X; i++) {
      if (((i * 4) + ((X - i) * 2)) == Y) {
        result = true;
        break;
      }
    }
    Console.WriteLine(result ? "Yes" : "No");
  }
}


Measured memory_bytes: 27472
using System;
using System.Linq;

class E
{
	static void Main()
	{
		var h = Console.ReadLine().Split().Select(int.Parse).ToArray();
		int n = h[0], k = h[1];
		Console.WriteLine(Totients(k).Select((x, i) => i == 0 ? 0 : x * ((MInt)(k / i)).Pow(n)).Aggregate((x, y) => x + y));
	}

	static int[] Totients(int n)
	{
		var r = new int[n + 1];
		for (int x = 1; x <= n; ++x) r[x] = x;
		var b = new bool[n + 1];
		for (int p = 2; p <= n; ++p)
			if (!b[p])
				for (int x = p; x <= n; x += p)
				{
					r[x] = r[x] / p * (p - 1);
					b[x] = true;
				}
		return r;
	}
}

struct MInt
{
	const int M = 1000000007;
	public long V;
	public MInt(long v) { V = (v %= M) < 0 ? v + M : v; }

	public static implicit operator MInt(long v) => new MInt(v);
	public static MInt operator +(MInt x, MInt y) => x.V + y.V;
	public static MInt operator *(MInt x, MInt y) => x.V * y.V;

	public MInt Pow(int i) => MPow(V, i);
	public override string ToString() => $"{V}";

	static long MPow(long b, int i)
	{
		for (var r = 1L; ; b = b * b % M)
		{
			if (i % 2 > 0) r = r * b % M;
			if ((i /= 2) < 1) return r;
		}
	}
}


Measured memory_bytes: 28596
#include <cassert>

#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
//#include <boost/foreach.hpp>
//#include <boost/range/algorithm.hpp>
#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define ll long long
#define Sort(v) sort(all(v))
#define INF 1000000000
#define END return 0
#define pb push_back
#define se second
#define fi first
#define pb push_back
#define all(v) (v).begin() , (v).end()
#define MP make_pair
#define MOD 1000000007LL
using namespace std;
int day[12]={31,28,31,30,31,30,31,31,30,31,30,31};

int main (){
    int n,a,b;
    cin>>n>>a>>b;
    int ans=0;
    rep(i,0,n){
        int h,w;
        cin>>h>>w;
        ans+=(a<=h && b<=w);
    }
    cout<<ans<<endl;
}



/*

*/

Measured memory_bytes: 256
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<deque>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>

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

typedef int long long ll;
using namespace std;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const ll MOD = 1e9 + 7;
static const int MAX = 100;
static const int INF = (1 << 23);

int main() {
    int n;
    cin>>n;
    vector<int>v(n);
    vector<pair<int,string>>v1;
    map<string,int> m;

    rep(i,n){
        string s;int a;
        cin>>s>>a;
        v[i]=a;
        v1.push_back({a,s});
        m[s]++;
    }
   // cout<<4<<endl;
    sort(v1.rbegin(),v1.rend());

   /* rep(i,v1.size()){
        cout<<v1[i].first<<v1[i].second<<endl;
    }*/

    for(auto &&p:m){

        string m1=p.first;
       // cout<<m1<<endl;
        int k=p.second;
        int j=0;
        //cout<<k<<endl;
        for(int i=0;i<k;i++){
            while(true){
                //cout<<3<<endl;
                if(v1[j].second==m1){
                    int aa=v1[j].first;
                    //cout<<aa<<endl;
                    for(int h=0;h<v.size();h++){
                        if(v[h]==aa){
                            cout<<h+1<<endl;
                            break;
                        }
                    }
                    j++;
                    break;

                }
                j++;
            }



        }



    }



    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); i++)
#define all(x) (x).begin(), (x).end()
#define bit(x) (1L << (x))
using ll = long long;
using namespace std;

template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
 
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
        return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}

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

        vector<ll> l(n), r(n);
        rep (i, n) {
                cin >> l[i] >> r[i];
        }

        sort(l.begin(), l.end());
        sort(r.begin(), r.end());

        if (n % 2) {
                cout << r[n / 2] - l[n / 2] + 1 << endl; 
        } else {
                ll a = l[n / 2] + l[n / 2 - 1];
                ll b = r[n / 2] + r[n / 2 - 1];
                cout << b - a + 1 << endl;
        }

        return 0;
}


Measured memory_bytes: 6432
//2019.8.17 by ljz
//email 573902690@qq.com
//if you find any bug in my code
//please tell me
#include<bits/stdc++.h>
using namespace std;
#define res register int
#define LL long long
#define inf 0x3f3f3f3f
#define INF 0x3f3f3f3f3f3f3f
#define unl __int128
#define eps 5.6e-8
#define RG register
#define db double
#define pc(x) __builtin_popcount(x)
typedef pair<int,int> Pair;
#define mp make_pair
#define fi first
#define se second
#define pi acos(-1.0)
#define pb push_back
#define ull unsigned LL
#define gc getchar
//inline char gc() {
//    static char buf[100000],*p1,*p2;
//    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
//}
inline int read() {
    res s=0,ch=gc();
    while(ch<'0'||ch>'9')ch=gc();
    while(ch>='0'&&ch<='9')s=s*10+ch-'0',ch=gc();
    return s;
}
//inline int read() {
//    res s=0,ch=gc(),w=1;
//    while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=gc();}
//    while(ch>='0'&&ch<='9')s=s*10+ch-'0',ch=gc();
//    return s*w;
//}
//inline LL Read() {
//    RG LL s=0;
//    res ch=gc();
//    while(ch<'0'||ch>'9')ch=gc();
//    while(ch>='0'&&ch<='9')s=s*10+ch-'0',ch=gc();
//    return s;
//}
//inline LL Read() {
//    RG LL s=0;
//    res ch=gc(),w=1;
//    while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=gc();}
//    while(ch>='0'&&ch<='9')s=s*10+ch-'0',ch=gc();
//    return s*w;
//}
//inline void write(RG unl x){
//    if(x>10)write(x/10);
//    putchar(int(x%10)+'0');
//}
inline void swap(res &x,res &y) {
    x^=y^=x^=y;
}
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
//clock_t start=clock();
//inline void ck(){
//    if(1.0*(clock()-start)/CLOCKS_PER_SEC>0.1)exit(0);
//}
const int N=2e5+10;
namespace MAIN{
    char str[N];
    string las,now,lass;
    int sum;
    inline void MAIN(){
        scanf("%s",str+1);
        res n=int(strlen(str+1));
        for(res i=1;i<=n;){
            res j=i;
            now.clear();
            now.pb(str[j]);
            if(now==las){
                if(j<n)j++,now.pb(str[j]);
                else {printf("%d\n",sum);return;}
            }
            i=j+1,sum++,lass=las,las=now;
        }
        printf("%d\n",sum);
    }
}
int main(){
//    srand(19260817);
//    freopen("signin.in","r",stdin);
//    freopen("signin.out","w",stdout);
    MAIN::MAIN();
    return 0;
}

Measured memory_bytes: 384
import java.util.*;
 
public class Main{

    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        
        int[][] c = new int[3][3];
        for(int i = 0; i < 3; i++) {
            for(int j = 0; j < 3; j++){
                c[i][j] = sc.nextInt();
            }
        }
        sc.close();

        int a1, b1, b2, b3;
        a1 = 0;
        b1 = c[0][0];
        b2 = c[0][1];
        b3 = c[0][2];
        if(c[1][0] - b1 == c[1][1] - b2 && c[1][1] - b2 == c[1][2] - b3){

        } else {
            System.out.println("No");
            return;
        }
        if(c[2][0] - b1 == c[2][1] - b2 && c[2][1] - b2 == c[2][2] - b3){

        } else {
            System.out.println("No");
            return;
        }
        System.out.println("Yes");
    }
}

Measured memory_bytes: 23892
import java.util.*;

 public class Main {

		public static void main(String[] args) {
			// TODO Auto-generated method stub
			Scanner sc = new Scanner(System.in);
			
			int N = sc.nextInt();
			String a = sc.next();
            int b = 0;
            int c;
            int d;
            int e;
            int f;
            int g;
            
            for( c = 0;N > c;c++ ){
                String t = sc.next();
                for( d = 0;t.length() > d;d++ ){
                    for( e = 1;; e++ ){
                        if( t.length() <= d + e*( a.length()-1 )){
                        break;
                        }
                        f = 1;
                        for( g = 0;g < a.length();g++ ){
                            if( a.charAt(g)!= t.charAt( d + e*g )){
                               f = 0;
                            break;
                            }
                        }
                        if( f==1 ){ b = b + 1;d = t.length();
                        break;
                        }
                        }
                    }
                } System.out.println(b);
                }
		}

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

int
main
(
  int argc,
  char ** argv
)
{
  std::size_t n;
  std::cin >> n;

  std::size_t k;
  std::cin >> k;

  if (k == 0)
  {
    std::cout << 0 << std::endl;
    return 0;
  }

  std::size_t r { n % k };
  std::cout << ((r == 0) ? 0 : 1) << std::endl;

  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
	int c, i;
	char str[6];
	for(i=0; (c=getchar()) !='\n'; i++){
		str[i] = c;
	}

	for(int j=0; j<i; j++){
		if(str[j]=='A' && str[j+1]=='C'){
			printf("Yes\n");
			return 0;
		}
	}

	printf("No\n");
	return 0;
}


Measured memory_bytes: 128
#include <cstdio>
#include <algorithm>

using namespace std;
#define MAX 100000

int main(){

  long long n, k;
  pair<int, int> p[MAX];

  scanf("%lld %lld", &n, &k);
  for(int i = 0; i < n; i++)
    scanf("%d %d", &p[i].first, &p[i].second);

  sort(p, p + n);
  long long t = 0;
  for(int i = 0; i < n; i++){
    if(t + p[i].second >= k){
      printf("%d\n", p[i].first);
      break;
    }
    t += p[i].second;
  }

  return 0;
}


Measured memory_bytes: 896
// Ref : https://book.mynavi.jp/ec/products/detail/id=35408

#include <cstdio>
#define NMAX 25
#define NIL -1

struct Node {
	int parent, left, right;
};

struct Node T[NMAX];

void preOrderPrint(int idx) {
	if (idx == NIL) return;
	printf(" %d", idx);
	preOrderPrint(T[idx].left);
	preOrderPrint(T[idx].right);
}

void inOrderPrint(int idx) {
	if (idx == NIL) return;
	inOrderPrint(T[idx].left);
	printf(" %d", idx);
	inOrderPrint(T[idx].right);
}

void postOrderPrint(int idx) {
	if (idx == NIL) return;
	postOrderPrint(T[idx].left);
	postOrderPrint(T[idx].right);
	printf(" %d", idx);
}

int main() {
	int n, idx, left, right, root;
	scanf("%d", &n);
	for (int i = 0; i < n; i++) T[i].parent = NIL;
	for (int i = 0; i < n; i++) {
		scanf("%d %d %d", &idx, &left, &right);
		T[idx].left = left;
		T[idx].right = right;
		T[left].parent = T[right].parent = idx;
	}
	for (int i = 0; i < n; i++) if (T[i].parent == NIL) root = i;

	printf("Preorder\n");
	preOrderPrint(root);

	printf("\nInorder\n");
	inOrderPrint(root);

	printf("\nPostorder\n");
	postOrderPrint(root);
	printf("\n");

	return 0;
}


Measured memory_bytes: 2748
s = input()
c1 = s[0]
if (s[0] == s[1] and s[2] == s[3] and s[0] != s[2]):
  print("Yes")
elif (s[0] == s[2] and s[1] == s[3] and s[0] != s[1]):
  print("Yes")
elif (s[0] == s[3] and s[1] == s[2] and s[0] != s[1]):
  print("Yes")
else:
  print("No")


Measured memory_bytes: 3060
from math import ceil
D,G=map(int,input().split())
P=[]
C=[]
R=[]
for i in range(D):
    p,c=map(int,input().split())
    P.append(p)
    C.append(c)
    R.append((i+1)*100*p+c)
bit=2**D
ans=10**19
for i in range(bit):
    i=bin(i)[2:].zfill(D)
    su=0
    num=0
    k=-1
    for j in range(D):
        k=int(i[j])
        su+=k*R[j]
        num+=k*P[j]
        if k==0:
            t=j
    if G<=su:
        ans=min(ans,num)
        continue
    if k==-1:
        continue
    if  ceil((G-su)/((t+1)*100))<P[t]:
        ans=min(ans,num+ceil((G-su)/((t+1)*100)))
print(ans)


Measured memory_bytes: 41456
#include <iostream>
#include <array>

using namespace std;

static void inputArray(int A[], int num) {
  for (int i = 0; i < num; i++) {
    cin >> A[i]; 
  }
}

static int linearSearch(int A[], int sentinel) {
  int i = 0;
  while (true) {
    if (A[i] == sentinel) {
      return i;
    } else {
      i++;
    }
  }
}

int main() {
  array<int, 10000 + 1> N;
  array<int, 500> Q;
  int s, t;

  cin >> s;
  inputArray(&N[0], s);

  cin >> t;
  inputArray(&Q[0], t);

  int found = 0;
  for (int i = 0; i < t; i++) {
    // set the sentinel
    N[s] = Q[i];
    if (linearSearch(&N[0], Q[i]) != s) {
      found++; 
    }
  }
  cout << found << endl;  

  return 0;
}



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

#define ll long long
#define mx 100005
int n,m;
int ar[mx];
char ch[mx];

int main()
{
   int n;
  cin>>n;
  ll re=0;
  for(int i=1;i<=n;i++)
  {
    if(i%3!=0&&i%5!=0)re+=i;
  }
  cout<<re<<endl;
    
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define rep(i,n) for (ll i = 0; i < n; ++i)
#define ALL(c) (c).begin(), (c).end()
#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 FORV(i, v) for (auto i = v.begin(); i != v.end(); i++)
using namespace std;

typedef long long ll;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const ll INF = 1e9;
const long long INFL = 1LL<<60;

int main() {
  int n;
  cin >> n;
  if (n % 10 == 9 || (n/10) % 10 == 9) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
n = gets.to_i
arr = gets.split.map(&:to_i)
buckets = Hash.new { 0 }

arr.each do |a|
  buckets[a-1] += 1
  buckets[a] += 1
  buckets[a+1] += 1
end

max = -Float::INFINITY
buckets.each_value do |i|
  max = [i,max].max
end
puts max


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

int main()
{
    int d, t, s;
    cin >> d >> t >> s;
    if (s * t >= d)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }

    return 0;
}


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

using int32 = int_fast32_t;
using int64 = int_fast64_t;

const int32 INF = 1e9;
const int32 MOD = 1e9+7;
const int64 LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define POSSIBLE cout << ((n) ? "POSSIBLE\n" : "IMPOSSIBLE\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define pii pair<int32,int32>
#define pll pair<int64,int64>
#define pb(a) push_back(a)

vector<int64> divisors(int64 n){
  vector<int64> ret;
  for(int64 p = 1; p * p <= n; ++p){
    if(n % p == 0){
      ret.pb(p);
      if(p * p != n)ret.pb(n / p);
    }
  }
  return ret;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int64 n;
  cin >> n;
  int64 ans = (int64)divisors(n-1).size() - 1;
  for(auto d : divisors(n)){
    if(d == 1)continue;
    int64 m = n;
    while(m % d == 0)m /= d;
    if(m % d == 1)ans++;
  }
  ANS(ans);
  return 0;
}

Measured memory_bytes: 384
#include <iostream>

using namespace std;

int main()
{
    int i, a, b, c, n;
    cin >> a >> b >> c;
    n = 0;
    for (int i = a; i <=b; i++) 
   {
      if(c%i==0) 
        n++;
        
   }
   
   cout << n << endl;
}


Measured memory_bytes: 3100
<?php
// $n = (int)trim(fgets(STDIN));
$input = explode(' ', trim(fgets(STDIN)));

$a1 = (int)$input[0];
$a2 = (int)$input[1];
$a3 = (int)$input[2];

if ($a1 + $a2 + $a3 >= 22) {
	echo "bust";
}else{
	echo "win";
}

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

bool solve(string S) {
    vector<char> v;
    for (auto c : S) {
        if (c == '(') {
            v.push_back('(');
        }
        if (c == '[') {
            v.push_back('[');
        }
        if (c == ')') {
            if (v.size() == 0) return false;
            if (v[v.size() - 1] != '(') {
                return false;
            }
            v.pop_back();
        }
        if (c == ']') {
            if (v.size() == 0) return false;
            if (v[v.size() - 1] != '[') {
                return false;
            }
            v.pop_back();
        }
    }
    if (v.size()) return false;
    return true;
}

int main() {
    while (true) {
        string S;
        getline(cin, S);
        if (S == ".") return 0;
        cout << (solve(S) ? "yes" : "no") << endl;
    }
}


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

using namespace std;
using ll = long long;

int main() {
  string S;
  cin >> S;
  if (stoi(S.substr(0,4)) < 2019 || stoi(S.substr(5,2)) < 4 || (stoi(S.substr(8,2)) <= 30 && stoi(S.substr(5,2)) == 4))
    cout << "Heisei";
  else
    cout << "TBD";
}


Measured memory_bytes: 256
#include<map>
#include<cmath>
#include<stack>
#include<queue>
#include<cstdio>
#include<vector>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
template<class Read>void in(Read &x){
    x=0;
    int f=0;
    char ch=getchar();
    while(ch<'0'||ch>'9'){
        f|=(ch=='-');
        ch=getchar();
    }
    while(ch>='0'&&ch<='9'){
        x=(x<<1)+(x<<3)+(ch^48);
        ch=getchar();
    }
    x=f?-x:x;
    return;
}
char s[1000005];
int n;
ll f[1000005][2],ans;
int main(){
	scanf("%s",s+1);
    n=strlen(s+1);
    s[0]='0';
	f[n+1][1]=100;
    for(int i=n;i>=0;i--){
        int x=s[i]-'0';
        f[i][0]=min(f[i+1][1]+x+1,f[i+1][0]+x);
        f[i][1]=min(f[i+1][1]-x-1,f[i+1][0]-x)+10;
    }
	printf("%lld\n",f[0][0]);
	return 0;
}


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

#define int long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;
#define fi first
#define se second
template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

const int mod=1000000007;
int dp[1001][1001];

string S,T;

inline void add(int &a,int b){
    a+=b;
    if(a>=mod)a-=mod;
}
signed main(){
    cin>>S>>T;

    dp[0][0]=1;
    int N=S.size();
    int M=T.size();

    for(int i=0;i<=N;i++){
        for(int j=0;j<=M;j++){
            if(i<N)add(dp[i+1][j],dp[i][j]);
            if(i<N&&j<M&&S[i]==T[j]){
                add(dp[i+1][j+1],dp[i][j]);
            }
        }
    }

    cout<<dp[N][M]<<endl;
    return 0;
}

Measured memory_bytes: 10964
#include <iostream>
using namespace std;
 
int main()
{
    int n,a,b,x,y;
    while(cin >> n, n)
    {
        x=0, y=0;
        while(n--)
        {
            cin >> a >> b;
            if(a< b) {y+=a+b;}
            if(a> b) {x+=a+b;}
            if(a==b) {x+=a;y+=b;}
        }
        cout << x << " " << y << endl;
    }
}

Measured memory_bytes: 1160
//高知能系Vtuberの高井茅乃です。
//Twitter: https://twitter.com/takaichino
//YouTube: https://www.youtube.com/channel/UCTOxnI3eOI_o1HRgzq-LEZw

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

#define INTINF 1999999999
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define MODA 1000000007 

int main() {
	ll ans = 0;
	ll tmp;
	ll n, t, a, tt, aa;
	ll rt, ra;
	cin >> n;
	cin >> tt >> aa;
	REP(i, n-1){
		cin >> t >> a;
		rt = (tt+ t - 1)/t;
		ra = (aa+ a - 1)/a;
		if(t * ra >= tt && t * ra >= t){
			tt = t * ra;
			aa = a * ra;
		}
		else if(a * rt >= aa && a * rt >= a){
			tt = t* rt;
			aa= a*rt;
		}
	}
	cout << tt + aa << endl;
}

Measured memory_bytes: 256
import math
import sys

lst=[0 for _ in xrange(999999+1)]

def is_prime(num):
  if num%2==0:
      return 0
  for x in range(3, int(num**0.5)+1,2):
    if num % x==0:
        return 0
  return 1

lst[1]=0
lst[2]=1
for idx in range(3, len(lst)):
  lst[idx] = is_prime(idx) + lst[idx-1]

for line in sys.stdin:
  print lst[int(line)]

Measured memory_bytes: 70368
use std::cmp::*;
use std::io::*;
use std::num::*;
use std::str::*;

mod i {
    use super::*;

    pub fn read<T: FromStr>() -> T {
        stdin()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>()
            .parse::<T>()
            .ok()
            .unwrap()
    }

    pub fn str() -> String {
        read()
    }

    pub fn s() -> Vec<char> {
        str().chars().collect()
    }

    pub fn i() -> i64 {
        read()
    }

    pub fn u() -> usize {
        read()
    }

    pub fn f() -> f64 {
        read()
    }

    pub fn c() -> char {
        read::<String>().pop().unwrap()
    }

    pub fn iv(n: usize) -> Vec<i64> {
        (0..n).map(|_| i()).collect()
    }

    pub fn uv(n: usize) -> Vec<usize> {
        (0..n).map(|_| u()).collect()
    }

    pub fn fv(n: usize) -> Vec<f64> {
        (0..n).map(|_| f()).collect()
    }

    pub fn cmap(h: usize) -> Vec<Vec<char>> {
        (0..h).map(|_| s()).collect()
    }
}

fn main() {
    let n = i::u();
    let d = i::uv(n);

    if d[0] != 0 {
        println!("{}", 0);
        return;
    }

    let mut count = vec![0; n + 1];
    for i in d {
        count[i] += 1;
    }

    if count[0] != 1 {
        println!("{}", 0);
        return;
    }
    let mut ans: u64 = 1;
    let mut before: u64 = 1;
    for i in 1..(n + 1) {
        let current: u64 = count[i];
        for _ in 0..current {
            ans *= before;
            ans %= 998244353;
        }
        before = current;
    }
    println!("{}", ans);
    //dbg!(count);
}


Measured memory_bytes: 6396
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<queue>
using namespace std;
#define int long  long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
typedef pair<int, int>P;
const int INF = 1e15;

signed main() {
	int N;
	cin >> N;
	vector<int>a(N);
	rep(i, N)cin >> a[i];
	vector<int>v(N + 1, 0);
	rep(i, N)v[i + 1] = v[i] + a[i];
	int mn = INF;
	rep(i, N - 1) {
		int a = v[i + 1] - v[0];
		int b = v[N] - v[i + 1];
		mn = min(mn, abs(a - b));
	}
	cout << mn;
}

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

int main(){
    int N;
    cin >> N;
    double x[11];
    for(int i = 0;i < N;++i){
        cin >> x[i];
        string u;
        cin >> u;
        if(u == "BTC"){
            x[i] = x[i]*380000.0;
        }
    }
    double answer = 0;
     for(int i = 0;i < N;++i){
         answer += x[i];
     }
    cout << answer << endl;
}


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

int main(){
  int N;
  cin >> N;
  int x[2*N];
  for(int i=0;i<2*N;i++){
    cin >> x[i];
  }
  sort(x,x+2*N);
  int sum = 0;
  for(int i=0;i<N;i++){
    sum += x[2*i];
  }
cout << sum<<'\n';
 return 0;
}



Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func mainFn() {
	x := getInt()

	ans := "ABC"
	if x >= 1200 {
		ans = "ARC"
	}
	puts(ans)
}

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

var (
	scanner = bufio.NewScanner(os.Stdin)
	writer  = bufio.NewWriter(os.Stdout)
)

func main() {
	// buf := 200001
	// scanner.Buffer(make([]byte, buf), buf)
	scanner.Split(bufio.ScanWords)
	mainFn()
	writer.Flush()
}

func getInt() int {
	scanner.Scan()
	i, err := strconv.Atoi(scanner.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func getIntSlice(n int) []int {
	is := make([]int, n)
	for i := range is {
		is[i] = getInt()
	}
	return is
}

func getString() string {
	scanner.Scan()
	s := scanner.Text()
	return s
}

func puts(a ...interface{}) {
	if _, err := fmt.Fprintln(writer, a...); err != nil {
		panic(err)
	}
}


Measured memory_bytes: 640
n,m=map(int,input().split())
result=[]
count=[]
for i in range(n):
    result.append(i+1)
    count.append(0)
for i in range(m):
    a,b=map(int,input().split())
    count[result.index(a)]+=1
    count[result.index(b)]+=1
for i in range(n):
    print(count[i])

Measured memory_bytes: 3060
a,b,c,x,y=map(int,input().split())
k=min(x,y)
ans=0

AB = 2*c
if 2*c < a+b:
  ans+=AB*k
  d=x-y
  if d>=0:
    ans+=min(a*d,AB*d)
  else:
    ans+=min(b*(-d),AB*(-d))
else:
  ans+=min(a*x,AB*x)+min(b*y,AB*y)
print(ans)

Measured memory_bytes: 9164
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
using namespace std;

int main()
{
    int a,b,c,i,Count=0;
    cin>>a>>b>>c;

    for(i=a; i<=b; i++)
    {
        if(c%i==0)
            Count+=1;
    }
    cout<< Count<<endl;

    return 0;
}



Measured memory_bytes: 3084
#include<bits/stdc++.h>
#define Tp template<typename Ty>
#define Ts template<typename Ty,typename... Ar>
#define Reg register
#define RI Reg int
#define Con const
#define CI Con int&
#define I inline
#define W while
#define N 400
#define X 998244353
using namespace std;
int n,cnt,a[N+5],P2[N+5],C[N+5][N+5],id[N+5][N+5],f[2*N+5][N+5][N+5][2],g[2*N+5];
I int DP(CI l,CI r,CI h)
{
	if(l>r) return 0;RI k=(id[l][r]?id[l][r]:id[l][r]=++cnt);
	RI i,j;for(i=l;i<=r;++i) if(a[i]==h) break;if(i<=r)
	{
		RI x=DP(l,i-1,h),y=DP(i+1,r,h);g[k]=g[x]+g[y]+1;
		for(i=0;i<=g[x];++i) for(j=0;j<=g[y];++j)
			f[k][h][i+j][0]=(1LL*f[x][h][i][0]*f[y][h][j][0]+f[k][h][i+j][0])%X,
			f[k][h][i+j+1][1]=(1LL*f[x][h][i][1]*f[y][h][j][1]+f[k][h][i+j+1][1])%X;
	}
	else
	{
		for(DP(l,r,h+1),i=0;i<=g[k];++i)
			f[k][h][i][0]=f[k][h+1][i][1],f[k][h][i][1]=f[k][h+1][i][1],
			f[k][h][i][0]=(1LL*f[k][h+1][i][0]*(P2[g[k]-i]-1)+f[k][h][i][0])%X,
			f[k][h][i][1]=(1LL*f[k][h+1][i][1]*(P2[g[k]-i]-1)+f[k][h][i][1])%X;
		for(i=1;i<=g[k];++i) for(j=1;j<=i;++j)
			f[k][h][i-j][0]=(1LL*P2[g[k]-i]*C[i][j]%X*f[k][h+1][i][0]+f[k][h][i-j][0])%X,
			f[k][h][i-j][1]=(1LL*P2[g[k]-i]*C[i][j]%X*f[k][h+1][i][1]+f[k][h][i-j][1])%X;
	}return k;
}
int main()
{
	RI i,j,Mx=0;for(scanf("%d",&n),i=1;i<=n;++i) scanf("%d",a+i),Mx<a[i]&&(Mx=a[i]);
	for(i=1;i<=Mx+1;++i) f[0][i][0][0]=f[0][i][0][1]=1;
	for(P2[0]=i=1;i<=n;++i) P2[i]=(P2[i-1]<<1)%X;
	for(C[0][0]=i=1;i<=n;++i) for(C[i][0]=j=1;j<=i;++j) C[i][j]=(C[i-1][j-1]+C[i-1][j])%X;
	return printf("%d",f[DP(1,n,0)][0][0][0]),0;
}

Measured memory_bytes: 517120
#include<bits/stdc++.h>
#define ll long long
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

using namespace std;
int main()
{
    fast_io
    ll i,n;
    string s;
    cin>>n;
    int a[4]={0};
    for(i=1; i<=n; i++)
    {
        cin>>s;
        if(s=="AC")
       a[0]++;
        else if(s=="WA")

       a[1]++;
       else  if(s=="TLE")
       a[2]++;

       else  if(s=="RE")
       a[3]++;
    }



   cout<<"AC x "<<a[0]<<'\n';
   cout<<"WA x "<<a[1]<<'\n';
   cout<<"TLE x "<<a[2]<<'\n';
   cout<<"RE x "<<a[3]<<'\n';





    return 0;
}




Measured memory_bytes: 3656
#include <iostream>
#include <cstdio>
#include <cstring>
#define int long long
using namespace std;
const int maxn = 100000;
const int maxx = 26;
const int oo = 1000000007;
int n;
char s[maxn+1];
int cnt[maxx];
int res;
main()
{
	ios_base::sync_with_stdio(0);
	//freopen("input.txt","r",stdin);
	cin >> n;
	
	for (int i=1; i<=n; i++)
	{
		cin >> s[i];
		cnt[s[i]-'a']++;
	}
	
	res = 1;
	for (int i=0; i<maxx; i++)
		res=(res*(cnt[i]+1))%oo;
	
	cout << (res-1+oo*oo)%oo;
	return 0;
}



Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,s,n) for(int i = (s); i < (n); i++)
#define all(v) v.begin(), v.end()

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  
  vector<int> x(n);
  rep(i, 0, n) cin >> x.at(i);
  
  sort(all(x));
  
  int mini = 2147483647;
  rep(i, 1, 101) {
    int sum = 0;
    rep(j, 0, n) {
      sum += (x.at(j) -i)*(x.at(j) -i);
    }
    mini = min(mini, sum);
  }
  
  cout << mini << "\n";
  
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
ll mod=1e9+7;
ll inv(ll a){
    ll n=mod-2,ans=1;
    while(n>0){
        if(n%2) ans=ans*a%mod;
        n=n/2;
        a=a*a%mod;
    }
    return ans;
}
ll nCr(ll a,ll b){
    if(b<0) return 0;
    ll ans=1;
    rep(i,b) ans=ans*(a-i)%mod*inv(i+1)%mod;
    return ans;
}
int main(){
    ll n,k,ans,r;
    cin>>n>>k;
    r=n-k;
    rep(i,k){
        ll x=i+1;
        ans=nCr(k-1,i);
        ans=ans*nCr(r+1,r-x+1)%mod;
        cout<<ans<<endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#define rep(i,a,b) for(int i = a; i <= b; i++)
#define dep(i,a,b) for(int i = a; i >= b; i--)
using namespace std;
const int N = 110;
char s[N], t[N];
int main() {
	int n; scanf("%d",&n);
	scanf("%s",s + 1); scanf("%s", t + 1);
	dep(i,n,0) {
		bool flag = true;
		rep(j,n - i + 1,n) if (s[j] != t[j - (n - i + 1) + 1]) flag = false;
		if (flag) { printf("%d\n",2 * n - i); return 0; }
	}
	return 0;
}

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

namespace ConsoleApp7
{
    class Program
    {
        static void Main(string[] args)
        {
            var arr = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            var n0 = arr[0] + arr[1];
            var n1 = arr[0] - arr[1];
            var n2 = arr[0] * arr[1];
            Console.WriteLine(Math.Max(n0, Math.Max(n1, n2)));
        }
    }
}


Measured memory_bytes: 13268