akhauriyash/Code-Regression huggingface dataset:
import java.io.*;
import java.util.*;
 
public class Main {
    public static void main(String[] args) {
        PrintWriter out = new PrintWriter(System.out);
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int x = sc.nextInt();
 
        if (x == 1 || x == 2 * N - 1) {
            out.println("No");
            out.flush();
            return;
        }
 
        out.println("Yes");
        if (N == 2) {
            for (int i = 1, n = 2 * N; i < n; ++i) {
                out.println(i);
            }
        } else {
            if (x > N) {
                for (int i = N; i < N * 2; ++i) {
                    if (i != x) {
                        out.println(i);
                    }
                }
                out.println(x);
                for (int i = 1; i < N; ++i) {
                    if (i != x) {
                        out.println(i);
                    }
                }
            } else {
                for (int i = N + 1; i < N * 2; ++i) {
                    if (i != x) {
                        out.println(i);
                    }
                }
                out.println(x);
                for (int i = 1; i < N + 1; ++i) {
                    if (i != x) {
                        out.println(i);
                    }
                }
            }
        }
        out.flush();
    }
}

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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template < typename T >
void vprint(T &v){
	REP(i, v.size()){
		cout << v[i] << " ";
	}
	cout << endl;
}

int main(){
	ll N, H, W;
	cin >> N >> H >>W;
	cout << (N-H+1)*(N-W+1) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> P;
int H, W;
vector<vector<char>> field;
vector<vector<int>> dist;
const int INF = 1e9;

int bfs(){
  queue<P> que;
  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){
      dist[i][j] = INF;
    }
  }
  que.push(P(0, 0));
  dist[0][0] = 0;
  while(que.size()){
    P p = que.front(); que.pop();
    if(p.first == H - 1 && p.second == W - 1) break;
    vector<int> dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};
    for(int i = 0; i < 4; i++){
      int nx = p.first + dx[i], ny = p.second + dy[i];
      if(0 <= nx && nx < H && 0 <= ny && ny < W && dist[nx][ny] == INF && field[nx][ny] == '.'){
        que.push(P(nx, ny));
        dist[nx][ny] = dist[p.first][p.second] + 1;
      }
    }
  }
  return dist[H - 1][W - 1];
}

int main(){
  cin >> H >> W;
  field.assign(H, vector<char> (W));
  dist.assign(H, vector<int> (W));
  int ans = 0;
  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){
      cin >> field[i][j];
      if(field[i][j] == '.')ans++;
    }
  }
  int count = bfs();
  if(count == INF) cout << -1 << endl;
  else cout << ans - count - 1 << endl;
}

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

using ld = long double;

constexpr ld eps = 1e-8;

using point = complex<ld>;

class segment {
public:
    segment()
        : a(point(0, 0)), b(point(0, 0))
    {}
    segment(point a_, point b_)
        : a(a_), b(b_)
    {}

    point a, b;
};

class circle {
public:
    circle()
        : p(point(0, 0)), r(0)
    {}
    circle(point p_, ld r_)
        : p(p_), r(r_)
    {}

    point p;
    ld r;
};

ld dot(point const& a, point const& b) {
    return std::real(std::conj(a) * b);
}

point proj(segment const& s, point const& p) {
    ld t = dot(p - s.a, s.a - s.b) / std::norm(s.a - s.b);
    return s.a + t * (s.a - s.b);
}

bool isis_sp(segment const& s, point const& p) {
    return (std::abs(s.a - p) + std::abs(s.b - p) - std::abs(s.b - s.a) < eps);
}

ld dist_sc(segment const& s, circle const& c) {
    ld res = 1e18;
    res = min(res, abs(c.p - s.a));
    res = min(res, abs(c.p - s.b));
    auto pp = proj(s, c.p);
    if(isis_sp(s, pp)) {
        res = min(res, abs(c.p - pp));
    }
    return res;
}

int main() {
    int N;
    cin >> N;
    vector<circle> s, t;
    vector<segment> seg;
    for(int i = 0; i < N; ++i) {
        ld r, sx, sy, tx, ty;
        cin >> r >> sx >> sy >> tx >> ty;
        s.emplace_back(point(sx, sy), r);
        t.emplace_back(point(tx, ty), r);
        seg.emplace_back(point(sx, sy), point(tx, ty));
    }

    int res = 0;
    vector<int> dp(1 << N);
    for(int S = 0; S < (1 << N); ++S) {
        if(__builtin_popcount(S) != dp[S]) {
            continue;
        }
        for(int i = 0; i < N; ++i) {
            if(S & (1 << i)) {
                continue;
            }
            if(dp[S | (1 << i)] != 0) { // 計算済み
                continue;
            }
            bool ok = true;
            for(int j = 0; j < N; ++j) {
                if(i == j) {
                    continue;
                }
                circle c;
                c.r = s[j].r;
                if(S & (1 << j)) {
                    c.p = t[j].p;
                } else {
                    c.p = s[j].p;
                }
                ld dist = dist_sc(seg[i], c);
                if(dist <= s[i].r + c.r + eps) {
                    ok = false;
                    break;
                }
            }
            if(ok) {
                dp[S | (1 << i)] = dp[S] + 1;
            }
        }
        res = max(res, dp[S]);
    }
    cout << res << endl;
}



Measured memory_bytes: 3304
/** MIT License Copyright (c) 2018 Vasilyev Daniil **/
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
template<typename T> using v=vector<T>;
#define int long long
typedef string str;
typedef vector<int> vint;
#define rep(a,l,r) for(int a=(l);a<(r);a++)
#define pb push_back
#define sz(a) ((int)(a).size())
const long long inf=4611686018427387903;//2^62-1
#if 0 //FileIO
ifstream fin ("input.txt" );
ofstream fout("output.txt");
#define get fin>>
#define put fout<<
#else
#define get cin>>
#define put cout<<
#endif
#define eol put endl
void read(){}             template<typename Arg,typename... Args> void read (Arg& arg,Args&... args){get   (arg)     ;read(args...) ;}
void print(){}            template<typename Arg,typename... Args> void print(Arg  arg,Args...  args){put   (arg)<<" ";print(args...);}
void debug(){cout<<endl;} template<typename Arg,typename... Args> void debug(Arg  arg,Args...  args){cout<<(arg)<<" ";debug(args...);}
int getInt(){int a; get a; return a;}
//code goes here
void run(){
    int n;get n;
    int p[n+1];rep(i,0,n+1)p[i]=i;
    int pow=6;
    while(pow<n+1){
        for(int i=0;i+pow<n+1;i++){
            p[i+pow]=min(p[i+pow],p[i]+1);
        }
        pow*=6;
    }
    pow=9;
    while(pow<n+1){
        for(int i=0;i+pow<n+1;i++){
            p[i+pow]=min(p[i+pow],p[i]+1);
        }
        pow*=9;
    }
    put p[n];
}
int32_t main() {ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);run();return 0;}


Measured memory_bytes: 1024
program main;
var n, u, t, h : integer;

begin
  readln(n);
  u:= n mod 10;
  t:= (n div 10) mod 10;
  h:= n div 100;
  if (u = 7) or (t = 7) or (h = 7) then
    writeln('Yes')
  else
    writeln('No');
end.


Measured memory_bytes: 1372
/*
TASK: <Task>
LANG: C++
*/
#include <bits/stdc++.h>
using namespace std;
#define X first
#define Y second
#define EPS 1e-9
#define ALL(x) (x).begin(),(x).end()
#define mp(x,y) make_pair((x),(y))
#define pb(x) push_back((x))
#define FOR(i,st,ed) for(int (i)=(st);(i)<(ed);(i)++)
typedef pair<int,int> PII;
typedef vector<int> vi;
typedef vector<pair<int,int> > vii;
typedef long long LL;

int N,M,T;
map<int,int> mm;
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    //freopen("xxx.in","r",stdin);
    //freopen("xxx.out","w",stdout);
    int i,j,k;
    cin >> N;
    for(i=0;i<N;i++)
        cin >> k,mm[-k]++;
    map<int,int>::iterator it;
    long long a=0,b=0;
    for(it=mm.begin();it!=mm.end();it++)
    {
        if((*it).Y>=2)
        {
            a=(*it).X;
            (*it).Y-=2;
            break;
        }
    }
    for(it=mm.begin();it!=mm.end();it++)
    {
        if((*it).Y>=2)
        {
            b=(*it).X;
            (*it).Y-=2;
            break;
        }
    }
    cout << a*b << '\n';
}


Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
#ifdef _DEBUG
#define dlog(str) cout << "====" << str << endl;
#else
#define dlog(str)
#endif
#define INF 999999999
#define MOD 1000000007
#define REP(i, n) for(int i = 0, i##_l = (n); i < i##_l; i++)
#define FOR(i, s, e) for(int i = s, i##_l = (e); i < i##_l; i++)
#define LLI long long int
#define _min(a, b) ((a < b) ? a : b)
#define _max(a, b) ((a < b) ? b : a)
#define chmax(a, b) a = _max(a, b)
#define chmin(a, b) a = _min(a, b)
#define bit(a, shift) ((a>>shift)&1))
#define pm(a) ((a) ? 1 : -1)
#define SORT(v) sort(v.begin(), v.end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
// int 2.14E±9    lli 9.2E±18    double 1.7E±380

int main() {
    cout << fixed << setprecision(10);
    int M1, D1, M2, D2;
    cin >> M1 >> D1 >> M2 >> D2;
    if((M1 + 1) % 12 == M2 % 12 && D2 == 1) {
        cout << 1;
    } else {
        cout << 0;
    }
    return 0;
}

Measured memory_bytes: 256
import java.io.*;
public class Main {

    public static void main(String[] args) throws IOException  {
        
    	// ?¨??????\??????????????????????????????
    	int c;
        int keta = 0;
        // int hairetsu_keta[] = new int[4]; hairetsu_keta[0] = 0;hairetsu_keta[1] = 0;hairetsu_keta[2] = 0;hairetsu_keta[3] = 0;
        int hairetsu_keta[] = {0,0,0,0}; // ???????????¨???????????¨????????£????????????
        int j = 0;
        int deru = 0;         
        // int hairetsu[] = new int[4]; hairetsu[0] = 0; hairetsu[1] = 0; hairetsu[2] = 0; hairetsu[3] = 0;
        int hairetsu[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};//???????????¨???????????¨????????£???????????????????????????????????°????¢????????????????20???
        
        int i= 0;
        while ((c = System.in.read()) != -1  )
        {
        	// System.out.println(c);
        	if ( c > 47 && c < 58) // suuji ga kita
       	    {
        		hairetsu[i] = c-48;
        		i++;
        		keta++;
                 
        		//  System.out.println("Qurege_no_kazu_keta_hantaikara:" + Qurage_no_kazu);
       	    }
        	if ( c == 10) // return ga kita
        	{
        		hairetsu_keta[j] = keta;
        		deru++; //return ga  kitara while wo deru
        	}
        	if ( c == 32) //space ga kita
        	{
            	
        		hairetsu_keta[j] = keta;
        		keta = 0;//space ga kitara tsugi no moji no tame keta ha sokomade
        		j++;
        	}
        	if (deru > 0)
        	{
        		break;
            	}
        }
           // ?¨??????\?????????????????????????????????????????????
        
        // ??°??????????????\??????
        //int hairetsu_suuchi[] = new int[4]; hairetsu_suuchi[0] = 0; hairetsu_suuchi[1] = 0; hairetsu_suuchi[2] = 0; hairetsu_suuchi[3] = 0;
        int hairetsu_suuchi[] = {0,0,0,0};//???????????¨???????????¨????????£????????????
        int k = 0;
        int m = 0;
        int n = 0;
        
        
        while( n < (j + 1))
        {
        while(j > 0 && hairetsu_keta[n] > 0 )
        {
        	hairetsu_suuchi[k] = hairetsu_suuchi[k]*10 + hairetsu[m];
        	hairetsu_keta[n] = hairetsu_keta[n] - 1;
        	m++;
        }
        if (hairetsu_keta[n] == 0)
        {
        	n++;
        	k++;
        }
        }   	

        //??°??????????????\???????????????
        for (int p = 0; p < k ; p++)
        {
       // System.out.println("???????????°??????" + hairetsu_suuchi[p]);     
        }
        
         System.out.println(hairetsu_suuchi[0]*hairetsu_suuchi[1] + " " + (2*(hairetsu_suuchi[0]+hairetsu_suuchi[1])));
            }

}

Measured memory_bytes: 24152
#include <iostream>
#include <string>
#include <stdlib.h>
#include <stdio.h>

int top=0;
int Stack[200];

int pop(){
  top--;
  return Stack[top+1];
}

void push(int x){
  top++;
  Stack[top]=x;
}

int main(){
  int a,b;
  char s[100];
  while(scanf("%s", s)!=EOF){
   
    if(s[0]=='+'){
      a=pop();
      b=pop();
      push(a+b);
    }else if(s[0]=='*'){
      a = pop();
      b = pop();
      push(a * b);
    }else if(s[0]=='-'){
      a=pop();
      b=pop();
      push(b - a);
    }else{
      push(atoi(s));
    }
  }

  std::cout<<Stack[1]<<"\n";
  return 0;
}
  



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

int main()
{
    string s, t;
    cin >> s >> t;
    int a, b;
    cin >> a >> b;
    string u;
    cin >> u;

    if (u == s)
    {
        --a;
    }
    else
    {
        --b;
    }
    cout << a << " " << b << endl;
    return 0;
}

Measured memory_bytes: 256
n=int(input())
x=[]
for i in range(n):
    a,b=map(int, input().split())
    x.append([a+b, a-b])
x.sort()
count=1
last=x[0][0]
for a in x:
    if a[1]>=last:
        count+=1
        last=a[0]
print(count)

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

public class Hello {
  public static void Main() {
    //使わないのはコメントアウトしないとエラー
    var coin500 = NumInput().First();
    var coin100 = NumInput().First();
    var coin50 = NumInput().First();
    var sum = NumInput().First();

    int res = 0;
    for(int i = 0; i <= coin500; i++){
      for(int j = 0; j <= coin100; j++){
        for(int k = 0; k <= coin50; k++){
          if(500 * i + 100 * j + 50 * k == sum) res++;
        }
      }
    }


    Result(res);

  }
  static int[] NumInput(){
    var input_line = Console.ReadLine().Split(' ');
    return input_line.Select(int.Parse).ToArray();
  }
  static string[] StringInput(){
    return Console.ReadLine().Split(' ');
  }

  static void Result(string text){
    Console.WriteLine( text );
  }   
  static void Result(int num){
    Console.WriteLine( num );
  }
  static void Result(float num){
    Console.WriteLine( num );
  }
}

Measured memory_bytes: 13396
N = int(input())
ans = ""
for i in range(1, 99):
    if N <= 26 ** i:
        N -= 1
        for j in range(i):
            ans += chr(ord("a") + N % 26)
            N = N // 26
        break
    else:
        N -= 26 ** i
print(ans[::-1])

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

   typedef long long ll;
   typedef pair<ll, ll> Pii;
   typedef vector<ll> Vi;
   typedef vector<Vi> VVi;

   const double EPS = (1e-7);
   const ll INF =(1e13);
   const double PI = (acos(-1));
   const ll MOD = ll(1e9) + 7;

   #define REP(i, n) for(ll i = 0; i < (ll)(n); i++)
   #define REPR(i, n) for(ll i = n; i > -1; i--)
   #define FOR(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
   #define ALL(x) (x).begin(),(x).end()
   #define SORT(x) sort((x).begin(), (x).end())
   #define RSORT(x) sort((x).rbegin(), (x).rend())
   #define REVERSE(x) reverse((x).begin(), (x).end())
   #define SZ(x) ((ll)(x).size())
   #define pb push_back
   #define mp make_pair

   //chmax(a, b): a>bならaをbで更新　更新したときにtrueを返す
   //chmin(a, b): a<bならaをbで更新　更新したときにtrueを返す
   template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
   template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

   #define dump(x) cerr<< #x << "= " << (x) << endl;

   ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
   ll pow(ll a, ll b){if (b == 0) return 1; else if (b % 2 == 0) return pow(a * a, b / 2); else return pow(a * a, b / 2) * a;}
   ll pow(ll a, ll b, ll m){if (b == 0) return 1; else if (a == 0) return 0; else if (b % 2 == 0) return (pow((a * a) % m, b / 2, m) % m); else return (pow((a * a) % m, b / 2, m) * a) % m;}
   ll residue(ll a, ll m){return ((a % m) + m) % m;};

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

int main(){
  string s; cin >> s;
  ll n = s.size();
  VVi dp(100002, Vi(2, 0));
  dp[0][1] = 1, dp[0][0] = 0;
  REP(i, n){
    if(s[i] == '1'){
      dp[i + 1][1] = (dp[i][1] * 2) % MOD;
      dp[i + 1][0] = (dp[i][1] + dp[i][0] * 3) % MOD;
    }
    else{
      dp[i + 1][1] = dp[i][1];
      dp[i + 1][0] = dp[i][0] * 3 % MOD;
    }
  }
  cout << (dp[n][0] + dp[n][1]) % MOD << endl;
}


Measured memory_bytes: 5760
import sys
sys.setrecursionlimit(10**9)
n, m = map(int, input().split())

INF = float("inf")
# 人iまでの距離
cost = [INF] * (n+1)
# 人iからjまでの距離がd
edges = [[] for _ in range(n+1)]
for _ in range(m):
  l, r, d = map(int, input().split())
  # l->rとr->lの辺を保存
  edges[l].append((r, d))
  edges[r].append((l, -d))
  
  
# ある人、a->bまでの距離が引数、人iまでの距離がcで矛盾がないかを戻す
# dfsだと思うがよくあるif(終了条件)みたいな形ではない
def solve(i, c):
  # ある人までの距離が未決定の場合
  if cost[i] == INF:
    cost[i] = c
    # 「人i-> jがdの距離」の情報を全て見て回り矛盾が生じないか確認
    for j, d in edges[i]:
      if solve(j, c + d) == False:
        return False
  
  return cost[i] == c

ans = "Yes"

for i in range(1, n+1):
  if cost[i] == INF and solve(i, 0) == False:
    ans = "No"
    
    
print(ans)
    

Measured memory_bytes: 128884
#include<bits/stdc++.h>
using namespace std;
int n,k,s=0,a[50];
int main()
{
	cin>>n>>k;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
	}
	for(int i=1;i<=n;i++)
	{
		for(int j=i+1;j<=n;j++)
		{
			if(a[i]<a[j])
			{
				swap(a[i],a[j]);
			}
		}
	}
	for(int i=1;i<=k;i++)
	{
		s=a[i]+s;
	}
	cout<<s<<endl;
	return 0;
}

Measured memory_bytes: 256
/* ex 7_1
   cy_an  */

#include <stdio.h>

int main(void){

    // 構造体の宣言
    typedef struct point{
        int x_elem;
        int y_elem;
    }point;
    point p1, p2, p3, p4, vector12, vector14;

    // 構造体へ代入
    scanf("%d %d %d %d", &p1.x_elem, &p1.y_elem, &p2.x_elem, &p2.y_elem);

    // 計算
    // vector12 = p2 - p1
    vector12.x_elem = p2.x_elem - p1.x_elem;
    vector12.y_elem = p2.y_elem - p1.y_elem;
    // 90degree turn
    vector14.x_elem = -vector12.y_elem;
    vector14.y_elem = vector12.x_elem;
    // p4 = p1 + vector14
    p4.x_elem = p1.x_elem + vector14.x_elem;
    p4.y_elem = p1.y_elem + vector14.y_elem;
    // p3 = p4 + vector43(= vector12)
    p3.x_elem = p4.x_elem + vector12.x_elem;
    p3.y_elem = p4.y_elem + vector12.y_elem;

    // 値の出力
    printf("%d %d %d %d\n", p3.x_elem, p3.y_elem, p4.x_elem, p4.y_elem);

    return 0;
}

Measured memory_bytes: 1728
import sys
sys.setrecursionlimit(10**9)
mod = 10**9+7
from collections import defaultdict
class UnionFind:
    def __init__(self, num):
        self.table = [-1 for _ in range(num)]

    def find(self, x):
        if self.table[x] < 0:
            return x
        else:
            self.table[x] = self.find(self.table[x])
            return self.table[x]

    def union(self, x, y):
        s1 = self.find(x)
        s2 = self.find(y)

        if s1 != s2:
            if self.table[s1] <= self.table[s2]:
                self.table[s1] += self.table[s2]
                self.table[s2] = s1
            else:
                self.table[s2] += self.table[s1]
                self.table[s1] = s2
            return True
        return False

memo = [-1]*5001
memo[0] = 1
def fact(n):
    if memo[n] != -1:
        return memo[n]
    else:
        res = n*fact(n-1)%mod
        memo[n] = res
        return res

N = int(input())
P = list(map(int,input().split()))
K = 0
u = UnionFind(N)
loop = 0
for i in range(N):
    if P[i]==-1:
        K += 1
        continue
    if u.find(i)==u.find(P[i]-1):
        loop += 1
    u.union(i,P[i]-1)

d = defaultdict(lambda:[0,0])
for i in range(N):
    if P[i]==-1:
        d[u.find(i)][0] += 1
    d[u.find(i)][1] += 1

n = []
for k in d:
    n.append(d[k])

dp = [[0]*(len(n)+1) for i in range(len(n))]
for i in range(len(n)):
    dp[i][0] = 1
for i in range(len(n)):
    for j in range(1,i+2):
        if j != i+1:
            dp[i][j] += dp[i-1][j]
        dp[i][j] += dp[i-1][j-1]*n[i][0]*n[i][1]
        dp[i][j] %= mod

ans = 0
for i in range(2,len(n)+1):
    if K-i<0:
        break
    ans += dp[len(n)-1][i]*fact(i-1)*pow(N-1,K-i,mod)
    ans %= mod
for i in range(len(n)):
    if K==0:
        break
    ans += n[i][0]*(n[i][1]-1)*pow(N-1,K-1,mod)
    ans %= mod

ans = pow(N-1,K,mod)*(N-loop)-ans
ans %= mod
print(ans)

Measured memory_bytes: 266044
#include<bits/stdc++.h>
#include<algorithm>
#include<string>

using namespace std;

int main(){
  long long n;
  cin>>n;
  long long xorv=0;
  vector<int> v(n);
  for(int i=0;i<n;i++){
    cin>>v[i];
	xorv^=v[i];
  }
  for(int i=0;i<n;i++){
    v[i]=xorv^v[i];
	cout<<v[i]<<' ';
  }
  
  return 0;
}


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

int main(void){
  int n;
  vector< int > l;
  cin >> n;
  for(int i = 0;i < 2*n;++i){
    int a;
    cin >> a;
    l.push_back(a);
  }
  sort(l.begin(),l.end());
  int res = 0;
  for(int i = 0;i < n;++i){
    res += l[2*i];
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 256
S = list(input())
S = list(map(int, S))
N = len(S)
A = [0,1]*N
B = [1,0]*N
A = A[:N]; B = B[:N]
acnt = 0
bcnt = 0

for s, a, b in zip(S, A, B):
    if s != a:
        acnt += 1
    if s != b:
        bcnt += 1
print(min(acnt, bcnt))

Measured memory_bytes: 7708
H = {}
199.times {|i| H[n=i**5] = i; H[-n] = -i}
X = gets.to_i
F =->(b,y) { a=H[X+y] and puts([a,b]*' ') || exit }
199.times {|b| y = b**5; F[b,y]; F[-b,-y]}

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

int main() {
  int A, B;
  cin >> A >> B;
  int max = -200;
  if (max < A + B)
  max = A + B;
  if (max < A - B)
  max = A - B;
  if (max < A * B)
  max = A * B;

  cout << max << endl;

}

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

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef vector<ll> vll;

#define PI (2*acos(0.0))
#define eps 1e-9
#define pb push_back
#define endl "\n"
#define watch(x) cout << (#x) << " is " << (x) << endl;
#define show(v) for(int fi = 0; fi < v.size(); fi++) cout << v[fi] << " "; cout << endl;
#define showpair(v) for(int fi = 0; fi < v.size(); fi++) cout << v[fi].first << " " << v[fi].second << endl;
#define ff first
#define ss second
#define fu cout << "lol" << endl;
#define precision(n) cout << fixed << setprecision(n);
#define lb lower_bound
#define up upper_bound
#define vscan for(i = 0;i<n;i++){cin>>in; v.pb(in);}
#define all(a) a.begin(), a.end()
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define mem(a,val) memset(a,val,sizeof(a))
#define loop(i,n) for(i = 0; i < n; i++)
#define TC() ull T; cin>>T; while(T--)
#define IN(x) {scanf("%d",&x);}
#define LL(x) {scanf("%lld",&x);}
#define CC(x) {scanf("%c",&x);}
#define pfl(x) printf("%d\n",x)
#define pfll(x) printf("%lld\n",x)
#define newl puts("")
#define space printf(" ")
#define MOD 1000000007
#define speed ios_base::sync_with_stdio(false); cin.tie(NULL);

bool pal(string s){
    string p = s;
    reverse(all(s));
    return p == s;
}

int main()
{
    int i = 0, j = 0, cs = 0, in;
    string s; cin>>s;
    int n = s.size();
    if(pal(s) && pal(s.substr(0,(n-1)/2)) && pal(s.substr((n+2)/2))) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void) {

  int X, A;

  do {
    scanf("%d %d", &X, &A);
  } while (X < 0 || A > 9);

  if (X < A) {
    printf("%d\n", 0);
  } else {
    printf("%d\n", 10);
  }

  return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define endl '\n'

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N, M;
    vector<int> v;
    cin>>N>>M;
    for(int i = 0; i < M; i++) {
        int get = 0;
        cin>>get;
        v.push_back(get);
    }
    int total = accumulate(v.begin(), v.end(), 0);
    int day = N - total;
    if(day < 0) {
        cout<<-1<<endl;
    }
    else{
        cout<<day<<endl;
    }
    return 0;
}



Measured memory_bytes: 3724
n,k=map(int,input().split())
if n<k:
    if k-n<n:
        print(k-n)
    else:
        print(n)

elif n%k==0:
    print(0)
else:

    a = n // k
    b= (a + 1) * k - n
    c = n - a * k
    t=n-k
    p=k//t
    r=k-p*t
    print(min(b,c,r))

Measured memory_bytes: 40536
N = gets.chomp.to_i
inputs = gets.chomp.split(" ").map(&:to_i).sort.reverse
count = 0
inputs.each_with_index do |e,i|
  j = i+1
  k=-1
  while N - j + k >0 do
    if inputs[i] < inputs[j]+inputs[k]
      count += N-j+k
      j += 1
    else
      k -= 1
    end
  end
end
 
puts count


Measured memory_bytes: 1912
import Control.Monad.State
import Control.Arrow
import Data.Maybe
import Data.List

getInts = map read . words <$> getLine :: IO [Int]

dayDream [] = Just ()
dayDream ('m':'a':'e':'r':'d':a) = dayDream a
dayDream ('r':'e':'m':'a':'e':'r':'d':a) = dayDream a
dayDream ('r':'e':'s':'a':'r':'e':a) = dayDream a
dayDream ('e':'s':'a':'r':'e':a) = dayDream a
dayDream _ = Nothing

main = do
    str <- reverse <$> getLine
    if isJust $ dayDream str then putStrLn "YES" else putStrLn "NO"
-- main = undefined


Measured memory_bytes: 7548
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
using namespace std;
#include <math.h>
#include <vector>
#include <queue>

int main() {

	int k;

	queue<long long> que;

	cin >> k;

	que.push(1);
	que.push(2);
	que.push(3);
	que.push(4);
	que.push(5);
	que.push(6);
	que.push(7);
	que.push(8);
	que.push(9);

	long long x;

	for (int i = 0; i < k; i++) {
		x = que.front();
		if (x % 10 != 0) {
			que.push(10 * x + x % 10 - 1);
		}
		que.push(10 * x + x % 10);
		if (x % 10 != 9) {
			que.push(10 * x + x % 10 + 1);
		}
		que.pop();
	}

	cout << x;

	cin >> x;

	return 0;


}

Measured memory_bytes: 5136
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<string>
#include<vector>
#include<set>
#include<cctype>
using namespace std;

int main(void){
	ios::sync_with_stdio(false); cin.tie(0);
	
	int a,b;
	cin>>a>>b;
	if(a+b>=10)cout<<"error"<<endl;
	else cout<<a+b<<endl;
	
	
	return 0;
}

Measured memory_bytes: 256
ls = list(map(int,input().split()))
if ls[1] != ls[2] and ls[2] == ls[0]:
  print(ls[1])
if ls[0] != ls[1] and ls[1] == ls[2]:
  print(ls[0])
if ls[2] != ls[1] and ls[1] == ls[0]:
  print(ls[2])


Measured memory_bytes: 9084
#include<cmath>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
const int mod=1e9+7;
const int maxn=2000;
int n,k;
int f[maxn+8][maxn+8],g[maxn+8][maxn+8];

int read()
{
    int x=0,f=1;char ch=getchar();
    for (;ch<'0'||ch>'9';ch=getchar()) if (ch=='-') f=-1;
    for (;ch>='0'&&ch<='9';ch=getchar()) x=x*10+ch-'0';
    return x*f;
}

int power(int a,int k)
{
    if (k<0) return 1;
    int sum=1;
    for (;k;k>>=1,a=1ll*a*a%mod)
    if (k&1)
        sum=1ll*sum*a%mod;
    return sum;
}

int main()
{
    n=read(),k=read();
    for (int i=0;i<=n+1;i++) g[0][i]=1;
    for (int i=1;i<k;i++)
        for (int j=n-i+1;j;j--)
            g[i][j]=(g[i-1][j]+g[i][j+1])%mod;
    printf("%lld\n",1ll*g[k-1][2]*power(2,n-k-1)%mod);
    return 0;
}


Measured memory_bytes: 16640
#include <bits/stdc++.h>
#define ri register int
#define ll long long
using namespace std;
int read()
{
	int num=0;
	int flg=1;
	char c=getchar();
	while(!isdigit(c))
	{
		if(c=='-')
		{
			flg=-1;
		}
		c=getchar();
	}
	while(isdigit(c))
	{
		num=(num<<1)+(num<<3)+(c^48);
		c=getchar();
	}
	return num*flg;
}
const int maxn=1e6+7;
char str[maxn];
int main()
{
	scanf("%s",str);
	int tot=strlen(str);
	int stone=0;
	for(ri i=0; i<tot;i++)
	{
		if(str[i]=='g')
		{
			stone++;//对面出石头的数量
		}
	}
	int towel=tot>>1;//没法，只能硬核翻译了
	int win=min(towel,stone);
	int lose=min(tot-towel,tot-stone);
	return 0&printf("%d",win-lose);
}

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

int main()
{
  int x,n;
  scanf("%d%d",&x,&n);
  int p[n];
  int i;
  i = 0;
  while (i < n)
  {
    scanf("%d",&p[i]);
    i++;
  }
  if (n == 0)
  {
    printf("%d",x);
    return (0);
  }
  i = -100;
  int j;
  j = 0;
  int ans;
  ans = -300;
  while (i >= -100 && i <= 200)
  {
    j = 0;
    while (j < n)
    {
      //printf("%d",ans);
      if (i == p[j])
      {
        break;
      }
      if (j == n - 1)
      {
        //printf("%d",abs(x - ans));
        if (abs(x - ans) > abs(x - i))
        {
          ans = i;
        }
      }
      j++;
    }
    i++;
  }
  printf("%d",ans);
}

Measured memory_bytes: 1728
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
#define rep(i,n) for (ll i=0;i<n;++i)
#define rep2(i,a,b) for (ll i=a;i<b;++i)
const ll MOD=1000000007;
const ll INF=1e9;
const ll IINF=1e18;
const double EPS=1e-8;
const double pi=acos(-1);

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;
}

template<typename Monoid,typename Operator>
struct SegmentTree{
    private:
    typedef function<Monoid(Monoid,Monoid)> F;
    typedef function<Monoid(Monoid,Operator)> G;
    int n;
    F f;
    G g;
    Monoid id;
    vector<Monoid> dat;
    public:
    SegmentTree(int n_,F f,G g,Monoid id){
        this->f=f;
        this->g=g;
        this->id=id;
        init(n_);
    }
    void init(int n_){
        n=1;
        while(n<n_){
            n*=2;
        }
        dat.resize(2*n-1,id);
    }
    void build(int n_,vector<Monoid> v){
        rep(i,n_){
            dat[i+n-1]=v[i];
        }
        for (int i=n-2;i>=0;i--){
            dat[i]=f(dat[2*i+1],dat[2*i+2]);
        }
    }
    void update(int i,Operator a){
        i+=n-1;
        dat[i]=g(dat[i],a);
        while(i>0){
            i=(i-1)/2;
            dat[i]=f(dat[2*i+1],dat[2*i+2]);
        }
    }
    Monoid query(int a,int b,int k,int l,int r){
        if (r<=a||b<=l){
            return id;
        }
        if (a<=l&&r<=b){
            return dat[k];
        }
        Monoid vl=query(a,b,2*k+1,l,(l+r)/2);
        Monoid vr=query(a,b,2*k+2,(l+r)/2,r);
        return f(vl,vr);
    }
    Monoid query(int a,int b){
        return query(a,b,0,0,n);
    }
};

int main(){
    ll N,M;
    cin >> N >> M;
    vector<vector<ll>> G(M,vector<ll>(3));
    rep(i,M){
        cin >> G[i][0] >> G[i][1] >> G[i][2];
        G[i][0]--,G[i][1]--;
    }
    sort(G.begin(),G.end());
    vector<ll> ans(N,IINF);
    ans[0]=0;
    SegmentTree<ll,ll> seg(N,[](ll a,ll b){return min(a,b);},
                            [](ll a,ll b){return min(a,b);},IINF);
    seg.build(N,ans);
    rep(i,M){
        ll a=G[i][0],b=G[i][1];
        ll c=seg.query(a,N);
        if (c==IINF){
            cout << -1 << endl;
            return 0;
        }
        seg.update(b,c+G[i][2]);
    }
    if (seg.query(N-1,N)==IINF) cout << -1 << endl;
    else cout << seg.query(N-1,N) << endl;
}

Measured memory_bytes: 9216
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
#define rep(i,j,k) for(int i=j;i<k;i++)
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
vector<int>hako;
vector<int>hakoa;
int main(){
  int a;
  cin >> a;
  rep(i,0,a){
    int b;
    cin >> b;
    hako.push_back(b);
    hakoa.push_back(b);
  }
  sort(hako.begin(),hako.end());
  rep(i,0,a){
    int res = hako[a-1];
    cout << (hako[a-1] == hakoa[i] ? hako[a-2] : hako[a-1]) << endl;
  }
	return 0;
}


Measured memory_bytes: 3436
#include <bits/stdc++.h>
#define int long long
using pii=std::pair<int,int>;
using namespace std;

int x;
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> x;
    x -= 400;
    x /= 200;
    cout << 8 - x << "\n";
    return 0;
}

Measured memory_bytes: 3648
#include<cstdio>
using namespace std;
int main(void)
{
	int n,risi,gou,i,x;
	scanf("%d",&n);
	x=100000;
	for(i=0;i<n;i++){
		x=x*1.05;
		if(x%1000!=0){
			x=x+1000-(x%1000);
		}
	}
	printf("%d\n",x);
	return 0;
}

Measured memory_bytes: 1020
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <tuple>
#include <cassert>
#include <exception>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<P> vp;
#define rep(i,a,n) for(ll i = (a);i < (n);i++)
#define per(i,a,n) for(ll i = (a);i > (n);i--)
#define lep(i,a,n) for(ll i = (a);i <= (n);i++)
#define pel(i,a,n) for(ll i = (a);i >= (n);i--)
#define clr(a,b) memset((a),(b),sizeof(a))
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define sz size()
#define print(X) cout << (X) << endl
static const int INF = 1e+9+7;
ll n,m,l;
string s,t;
int d[200010],dp[1010][1010];
double w[1000],v[1000];
double box[200010];
char field[200][200];

bool prime[8000000];

int main(){
  while(1){
    cin >> n >> m;
    if(!n && !m)break;
    clr(prime,0);
    m++;
    while(m){
      if(!prime[n]){
        int i = 0;
        while(i * n < 8000000){
          prime[i * n] = true;
          i++;
        }
        m--;
      }
      n++;
    }
    print(n-1);
  }
  return 0;
}


Measured memory_bytes: 10964
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <string>
#include <utility>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

class Dice {
 private:
  int m[6];

 public:
  void rotate(char c, int *n) {
    rep(j, 6) m[j] = n[j];
    if (c == 'N') {
      m[0] = n[1];
      m[1] = n[5];
      m[4] = n[0];
      m[5] = n[4];
      rep(j, 6) n[j] = m[j];
    } else if (c == 'S') {
      m[0] = n[4];
      m[1] = n[0];
      m[4] = n[5];
      m[5] = n[1];
      rep(j, 6) n[j] = m[j];
    } else if (c == 'W') {
      m[0] = n[2];
      m[2] = n[5];
      m[3] = n[0];
      m[5] = n[3];
      rep(j, 6) n[j] = m[j];
    } else if (c == 'E') {
      m[0] = n[3];
      m[2] = n[0];
      m[3] = n[5];
      m[5] = n[2];
      rep(j, 6) n[j] = m[j];
    } else if (c == 'R') {
      m[1] = n[3];
      m[2] = n[1];
      m[3] = n[4];
      m[4] = n[2];
      rep(j, 6) n[j] = m[j];
    } else {
      m[1] = n[2];
      m[2] = n[4];
      m[3] = n[1];
      m[4] = n[3];
      rep(j, 6) n[j] = m[j];
    }
  }

  void rotate_tf(int t, int f, int *n) {
    if (t == n[5]) {
      rep(i, 2) {
        rotate('N', n);
      }
    } else if (t != n[0]) {
      rep(i, 4) {
        rotate('R', n);
        if (t == n[1]) {
          break;
        }
        if (i == 3) {
          cout << "error" << endl;
        }
      }
      rotate('N', n);
    }
    rep(i, 4) {
      rotate('R', n);
      if (f == n[1]) {
        break;
      }
      if (i == 3) {
        cout << "error" << endl;
      }
    }
  }
};

int main() {
  int n[6];
  rep(i, 6) cin >> n[i];
  int num;
  cin >> num;
  vector<int> t(num), f(num);
  rep(i, num) cin >> t[i] >> f[i];

  Dice d;
  rep(i, num) {
    d.rotate_tf(t[i], f[i], n);
    cout << n[2] << endl;
  }

  return 0;
}


Measured memory_bytes: 3020
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <queue>
#include <cstdio>
using namespace std;
typedef long long ll;

int gcd(int a,int b){
    int t;
    while(b>0){
        t=b;
        b=a%b;
        a=t;
    }
    return a;
}

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

int main(){
    ll a,b,c,d,e,k,l,m,n,o=0,p,q,r,x,y,z,max1=0,ans=0;
    string s,t,u;
    cin>>m>>d;
    for(ll i=1;i<=m;i++){
         for(ll j=1;j<=d;j++){
             if(j%10>=2&&j/10>=2&&(j%10)*(j/10)==i)o++;
         }
    }
    
    
    
    cout<<o<<endl;
}






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

int main() {
    string N; cin >> N;
    int su = 0;
    for (int i = 0; i < N.size(); i++) {
        su += N[i] - '0';
    }
    if (su%9) cout << "No\n";
    else cout << "Yes\n";
}


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

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

  long long x;
  unsigned long long ans = 1;
  unsigned long long big = pow(10,18.0);
  bool zero = false;
  bool large = false;

  for (int i=0; i<N; i++){
    cin >> x;
    if (x == 0){
      zero = true;
      break;
    }else if(big / x < ans){
      large = true;
    }
    ans *= x;
  }

  if (zero){
    cout << 0 << endl;
  }else if (large){
    cout << -1 << endl;
  }else{
    cout << ans << endl;
  }

  return 0;
}


Measured memory_bytes: 3644
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#define _USE_MATH_DEFINES
#include <cmath>
#include <numeric>
#include <iomanip>
#include <deque>
#include <tuple>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <sstream>
#include <stdexcept>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define FOR(i, a, done) for (int i = (a); i < (done); ++i)
#define all(a) (a).begin(), (a).end()
#define x first
#define y second
#define debug(a) cout << (a) << endl
namespace mp = boost::multiprecision;
using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;
template <class T>
bool chmax(T &a, const T &b)
{
	if (a < b)
	{
		a = b;
		return 1;
	}
	return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
	if (a > b)
	{
		a = b;
		return 1;
	}
	return 0;
}

ll M = 1000000007;

void solve()
{
	int x;
	cin>>x;
	if(x>=30){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	solve();
	return 0;
}


Measured memory_bytes: 3632
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
using namespace std;
typedef  long long int lint;
typedef pair<int, int> P;
typedef pair<lint, lint> LLP;
typedef pair<char, char>CP;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
/*
vector<char>al(26);
al = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
vector<char>AL(26);
AL = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
*/

int main() {
	int N, Y;
	cin >> N >> Y;
	for (int i = 0; i <= N; i++) {
		for (int j = 0; j <= N; j++) {
			if (i + j <= N) {
				if (i * 1000 + j * 5000 + (N - i - j) * 10000 == Y) {
					cout << N-i-j << ' ' << j << ' ' <<  i  << endl;
					return 0;
				}
			}
		}
	}
		cout << -1 << ' ' << -1 << ' ' << -1 << endl;
}




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

int main(){
  int N;
  int A[200];
  int count = 0;
  
  cin >> N;
  for(int i = 0 ; i < N; i++){
    cin >> A[i];
  }
  
  bool loop=true;
  while(loop){
    for(int i = 0; i < N; i++){
      if(A[i] % 2 != 0 || A[i] == 0){
        loop = false;
        count--;
        break;
      }else{
        A[i] /= 2;
      }
    }
    count++;
  }
  cout << count << endl;
  return 0;
}

Measured memory_bytes: 256
N ,M = input().split()
N = int(N)
M = int(M)

Mlist = [0]*M
for x in range(N):
    cache = [int(x) for x in input().split()]
    for x in cache[1:]:
        Mlist[x-1] = Mlist[x-1]+1

count = 0
for x in Mlist:
    if x == N:
        count += 1

print(count)



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

#define ll long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))
#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define debug3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;
#define debugB(x, y) cerr<<#x<<": "<<bitset<y>(x) << endl;
#define line() cerr << "---------------" << endl;

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

template<typename T>
void printA(vector<T> &printArray, char between = ' ') {
   int paSize = printArray.size();
   for (int i = 0; i < paSize; i++) { cerr << printArray[i] << between;}
   if (between != '\n') {cerr << endl;}
}

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

int main() {
   int n;
   cin >> n;
   int S[5] = {0};
   string march = "MARCH";
   rep (i, n) {
      string s;
      cin >> s;
      rep (j, 5) {
         if (s[0] == march[j]) {
            S[j]++;
         }
      }
   }

   ll sum = 0;
   rep (i, 5) {
      repp (j, i+1, 5) {
         repp (k, j+1, 5) {
            sum += 1LL * S[i] * S[j] * S[k];
         }
      }
   }
   cout << sum << endl;

   return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string>
#define llint long long

using namespace std;

llint n;

int main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> n;
	string s; llint ans = 0;
	for(int i = 1; i <= n; i++){
		cin >> s;
		if(s == "E869120") ans++;
	}
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 3200
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#include <set>
#include <math.h>
#define pai 3.14159265358979323846264338327950288;
#define keta(n) cout << fixed << setprecision((n));
#define ll long long;
int main()
{
  int n;
  cin >> n;
  int mx = -1000000;
  int mn = 1000000;
  long long sum = 0;
  rep(i, n)
  {
    int s;
    cin >> s;
    mx = max(mx, s);
    mn = min(mn, s);
    sum += s;
  }
  cout << mn << " " << mx << " " << sum << endl;
  return 0;
}


Measured memory_bytes: 3104
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, l, r, x;
  cin >> N;
  x = 0;
  
  for(int i = 0; i < N; i++){
    cin >> l >> r;
    x += (r - l + 1);
  }
  
  cout << x << endl;
}

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

int main() {
	int H, W, K;
	cin>>H>>W>>K;
	vector<string> s;
	string tmpstring;
	map<int, int> arr;
	for(int i=0;i<H;++i){
		cin>>tmpstring;
		s.push_back(tmpstring);
		for(int j=0;j<W;++j){
			if(s[i][j]=='#') arr[i]++;
		}
	}
	int a[H][W];
	int tmp = 1;
	int cake;
	for(int i=0;i<H;++i){
		cake = 0;
		if(arr[i]==0)continue;
		else {
			for(int j=0;j<W;++j){
				if(s[i][j]=='#' & cake>0){
					tmp++;
				}
				else if(s[i][j]=='#' & cake==0) cake++;
				a[i][j] = tmp;
			}
			tmp++;
		}
	}
	/**
	for(int i=0;i<H;++i){
		for(int j=0;j<W;++j){
			cout<<a[i][j]<<" ";
		}
		cout<<endl;
	}
	cout<<endl;
	**/
	for(int i=0;i<H;++i){
		if(arr[i]==0 & i>0 & arr[i-1]!=0){
			arr[i]++;
			for(int j=0;j<W;++j){
				a[i][j] = a[i-1][j];
			}
		}
	}
	for(int i=H-1;i>=0;--i){
		if(arr[i]==0 & i<H){
			arr[i]++;
			for(int j=0;j<W;++j){
				a[i][j] = a[i+1][j];
			}
		}
	}
	for(int i=0;i<H;++i){
		for(int j=0;j<W;++j){
			cout<<a[i][j]<<" ";
		}
		cout<<endl;
	}
	cout<<endl;
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
#define INF 1e18
#define int long long
#define Rep(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) Rep(i, 0, n)
#define all(a) (a).begin(), (a).end()
using namespace std;
typedef pair<int, int> P;
typedef pair<int, P> PP;
const int mod = 1000000007;

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

    double x, t;
    cin >> t >> x;
    printf("%.8lf\n", t / x);
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
	int a, b, c;
	int count = 0;
	int i;
	scanf("%d %d %d" ,&a ,&b ,&c);
	for(i=a; i<=b; i++){
		if(c%i==0)count++;
	}
	printf("%d\n" ,count);
	return 0;
}

Measured memory_bytes: 596
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstdio>
#include <ctime>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <vector>
#include <iostream>
#include <algorithm>
#include <functional>
#include <numeric>
#include <string>

using namespace std;

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define debug(x) cout<<#x<<": "<<x<<endl
#define MOD 1000000007

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;

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

int main(void)
{
    const int MAX_N = 100000;
    int N;
    int A[MAX_N];
    pii B[MAX_N];
    cin >> N;
    REP(i, N) {
        cin >> A[i];
        B[i] = pii(A[i], i);
    }
    sort(B, B + N);
    int x = 0;
    REP(i, N) {
        int j = B[i].second;
        if (abs(j - i) % 2 == 1) {
            x++;
        }
    }
    assert(x % 2 == 0);
    cout << x / 2 << endl;
    return 0;
}


Measured memory_bytes: 1408
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <complex>
#include <string.h>
#include <numeric>
using namespace std;

#define int long long
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define rept(i,n) rep(i,(n)+1)
#define repst(i,s,n) reps(i,s,(n)+1)
#define reprt(i,n,t) for(int (i)=(n);(i)>=(t);--(i))
#define repr(i,n) reprt(i,n,0)
#define each(i,v) for(auto &(i):(v))
#define eachr(i,v) for(auto &(i)=(v).rbegin();(i)!=(v).rend();(i)++)
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define tmax(x,y,z) max(x,max(y,z))
#define tmin(x,y,z) min(x,min(y,z))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln '\n'
#define bln(i,n) (((i)==(n)-1)?'\n':' ')
#define dbg(x) cout<<#x" = "<<(x)<<ln<<flush
#define dbga(x,n) {cout<<#x" : ";for(int (i)=0;i<(n);++i){cout<<((x)[i])<<(i==((n)-1)?'\n':' ')<<flush;}}
#define zero(a) memset(a,0,sizeof(a))
#define unq(a) sort(all(a)),a.erase(unique(all(a)),a.end())
#define endl "\n"

//typedef complex<double> P;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vst;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int> > mat;

const ll inf = (ll)1e9+10;
const ll linf = (ll)1e18+10;
const ll mod = (ll)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;

ll mop(ll a,ll b,ll m=mod) {ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r;}
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b) {return a/gcd(a,b)*b;}
bool ool(int x,int y,int h,int w) {return((x<0)||(h<=x)||(y<0)||(w<=y));}
bool deq(double a,double b) {return abs(a-b)<eps;}

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;



int n, m, a[100100], b[100100], sum;

signed main() {
	cin >> n >> m;
	rep(i,m) cin >> a[i];
	sort(a,a+m);
	rep(i,m-1) b[i] = a[i+1] - a[i];
	sort(b,b+m-1), reverse(b,b+m-1);
	reps(i,n-1,m-1) sum += b[i];
	cout << sum << endl;
}

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

int main() {
  string s, t;
  cin >> s >> t;
  t.pop_back();
  if (s == t) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3604