akhauriyash/Code-Regression huggingface dataset:
l = [1, 5, 13, 29, 61, 125, 253, 509, 1021, 2045, 4093, 8189, 16381, 32765, 65533, 131069, 262141, 524285, 1048573, 2097149, 4194301, 8388605, 16777213, 33554429, 67108861, 134217725, 268435453, 536870909, 1073741821, 2147483645, 4294967293, 8589934589, 17179869181, 34359738365, 68719476733, 137438953469, 274877906941, 549755813885, 1099511627773, 2199023255549, 4398046511101, 8796093022205, 17592186044413, 35184372088829, 70368744177661, 140737488355325, 281474976710653, 562949953421309, 1125899906842621, 2251799813685245, 4503599627370493]
p = [1, 3, 7, 15, 31, 63, 127, 255, 511, 1023, 2047, 4095, 8191, 16383, 32767, 65535, 131071, 262143, 524287, 1048575, 2097151, 4194303, 8388607, 16777215, 33554431, 67108863, 134217727, 268435455, 536870911, 1073741823, 2147483647, 4294967295, 8589934591, 17179869183, 34359738367, 68719476735, 137438953471, 274877906943, 549755813887, 1099511627775, 2199023255551, 4398046511103, 8796093022207, 17592186044415, 35184372088831, 70368744177663, 140737488355327, 281474976710655, 562949953421311, 1125899906842623, 2251799813685247]

n, x = [int(i) for i in input().split()]
h = l[n]
e = 0
for i in range(n)[::-1]:
    if x >= 1 :
        x -= 1
    else:
        break
    if x >= l[i]:
        x -= l[i]
        e += p[i]
    else:
        continue
    if x >= 1 :
        x -= 1
        e += 1
    else:
        break
    if x >= l[i]:
        x -= l[i]
        e += p[i]
    else:
        continue
print(e)


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

#define ll long long

ll knapSack(int W, vector < int > &wt, vector < int > &val) { 
    int n = wt.size();
    int i, w; 
    ll K[n+1][W+1]; 

    for (i = 0; i <= n; i++)  
        for (w = 0; w <= W; w++) 
            if (i==0 || w==0) 
               K[i][w] = 0; 
            else if (wt[i-1] <= w) 
                 K[i][w] = max(val[i-1] + K[i-1][w-wt[i-1]],  K[i-1][w]); 
            else
                 K[i][w] = K[i-1][w]; 
  
    return K[n][W]; 
}

int main()
{
	ios_base::sync_with_stdio(false);
 	cin.tie(NULL);
	
	int n, w;
	cin >> n >> w;
	vector < int > wt(n), val(n);
	for(int i=0; i<n; i++)
		cin >> wt[i] >> val[i];
	cout << knapSack(w, wt, val) << endl;
	
	return 0;
}

Measured memory_bytes: 79232
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;
template<class T> void chmin(T &a,const T &b){if(a>b) a=b;}
template<class T> void chmax(T &a,const T &b){if(a<b) a=b;}

const ll INF=3e9;

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

  ll A,B,C;
  cin>>A>>B>>C;

  ll rest=C-(A+B);
  if(rest<=0){
    cout<<"No"<<endl;
    return 0;
  }

  ll P=4*A*B;
  rest*=rest;

  if(P<rest) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;

  return 0;
}


Measured memory_bytes: 256
s = gets.chomp
n = s.size
chart = {
  g: { g: 0, p: -1},
  p: { g: 1, p: 0 } 
}

ans = 0
n.times do |i|
  me = i.even? ? :g : :p
  you = s[i].to_sym
  ans += chart[me][you]
end

puts ans

Measured memory_bytes: 1916
#include <cstdio>
#include <cmath>


int main(){
    int D, N;
    scanf("%d %d", &D, &N);

    int ans;
    
    if(D == 0){
        if(N == 100){
            printf("101\n");
        }else{
            printf("%d\n", N);
        }
    }else if(D == 1){
        ans = 100 * N;
        if(N == 100){
            printf("10100\n");
        }else{
            printf("%d\n", ans);
        }
    }else{
        ans = 10000 * N;

        if(N == 100){
            printf("1010000\n");
        }else{
            printf("%d\n", ans);
        }
    }

    return 0;
}


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

/*int main() {
    int n, a;
    cin >> n >> a;
    if (n % 500 > a) cout << "No" << endl;
    else cout << "Yes" << endl;
    return 0;
}*/

/*int main() {
    int n;
    cin >> n;
    priority_queue<int> pq;
    for (int i = 0; i < n; i++) {
        int val;
        cin >> val;
        pq.push(val);
    }
    int alice = 0, bob = 0;
    bool b = 1;
    while (!pq.empty()) {
        if (b) {
            alice += pq.top();
        } else {
            bob += pq.top();
        }
        b = !b;
        pq.pop();
    }
    cout << alice - bob << endl;
    return 0;
}*/

/*int main() {
    int grid[3][3], a[3], b[3], sum = 0;
    memset(a, -1, sizeof a);
    memset(b, -1, sizeof b);
    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
            cin >> grid[i][j];
        }
        a[i] = min(grid[i][0], grid[i][1]);
        a[i] = min(a[i], grid[i][2]);
    }
    for (int i = 0; i < 3; i++) {
        b[i] = min(grid[0][i], grid[1][i]);
        b[i] = min(b[i], grid[2][i]);
    }
    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
            if (grid[i][j] != a[i] + b[j]) {
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
    return 0;
}*/

typedef pair<pair<int, int>, int> iii;

int main() {
    int h, w, blocked, min_dist;
    bool grid[52][52];
    cin >> h >> w;
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            char c;
            cin >> c;
            grid[i][j] = c == '.';
            if (!grid[i][j]) {
                blocked++;
            }
        }
    }
    queue<iii> q;
    q.push(iii(make_pair(0, 0), 0));
    bool vis[52][52];
    int dist[52][52];
    memset(dist, 0, sizeof dist);
    memset(vis, 0, sizeof vis);
    vis[0][0] = 1;
    dist[0][0] = 0;
    while (!q.empty()) {
        iii front = q.front(); q.pop();
        int r = front.first.first, c = front.first.second, d = front.second;
        dist[r][c] = d;
        if (r < 0 || c < 0 || r >= h || c >= w) continue;
        if (r == h - 1 && c == w - 1) {
            min_dist = d;
            break;
        }
        if (r > 0 && !vis[r - 1][c] && grid[r - 1][c]) {
            q.push(iii(make_pair(r - 1, c), d + 1));
            vis[r - 1][c] = 1;
        }
        if (r < h - 1 && !vis[r + 1][c] && grid[r + 1][c]) {
            q.push(iii(make_pair(r + 1, c), d + 1));
            vis[r + 1][c] = 1;
        }
        if (c > 0 && !vis[r][c - 1] && grid[r][c - 1]) {
            q.push(iii(make_pair(r, c - 1), d + 1));
            vis[r][c - 1] = 1;
        }
        if (c < w - 1 && !vis[r][c + 1] && grid[r][c + 1]) {
            q.push(iii(make_pair(r, c + 1), d + 1));
            vis[r][c + 1] = 1;
        }
    }
    if (!vis[h - 1][w - 1]) cout << -1 << endl;
    else cout << h * w - blocked - min_dist - 1 << endl;
    return 0;
}

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

using namespace std;

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

#define N 100010
#define M 200010
#define endl "\n"
#define mod 1000000007 

int main(){
	
	ios_base::sync_with_stdio(0);
	cin.tie(0);cout.tie(NULL);
	
	string s, t;
	
	cin >> s >> t;
	
	for(int i = 0; i < s.size(); i++){
		if(s[i] != t[i]){
			cout << "No" << endl;
			return 0;
		}
	}
	
	cout << "Yes" << endl;
	
	return 0;
}

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

#define mp make_pair
#define pb push_back
#define SZ(x) ((int) (x).size())

using namespace std;
typedef long long LL;

template <typename T, typename TT> ostream & operator << (ostream &out, pair<T, TT> t) { return out << "(" << t.X << "," << t.Y << ")";}
template <typename T> ostream & operator << (ostream &out,vector<T> t) { out << "["; for (auto x:t) out << x << " "; out << "]"; return out;}
template <typename T> inline bool cmin(T & a, const T & b) { return a > b ? a = b, 1 : 0;}
template <typename T> inline bool cmax(T & a, const T & b) { return a < b ? a = b, 1 : 0;}
template <typename T> void read(T & x) 
{
	int f = 1; char ch; x = 0;
	while(!isdigit(ch = getchar())) if(ch == '-') f = -1;
	while(isdigit(ch)) x = x * 10 + ch - '0', ch = getchar(); x *= f;
}

const int NX = 201234;

int n, s_a, s_b, k, dep[NX], par[NX], l[NX], r[NX];
vector<int> e_a[NX], e_b[NX];

void dfs(int x, int fa)
{
	l[x] = ++k;
	for (int y : e_b[x])
	{
		if(y != fa)
		{
			dep[y] = dep[x] + 1;
			par[y] = x;
			dfs(y, x);
		}
	}
	r[x] = k;
}

bool cho[NX], good[NX]; int ans = 0;
void dfs2(int x, int fa, int d)
{
	if(d < dep[x])
	{
		cmax(ans, dep[x] << 1);
		if(good[x])
			puts("-1"), exit(0);
	} else
		return;
	
	for (int y : e_a[x])
	{
		if(y != fa)
			dfs2(y, x, d + 1);
	}
}

int main() 
{
	read(n); read(s_a); read(s_b);
	vector<pair<int, int> > buf;
	for (int i = 1; i < n; i++)
	{
		int u, v; read(u); read(v);
		buf.pb(mp(u, v));
	}
	
	for (int i = 1; i < n; i++)
	{
		int u, v; read(u); read(v);
		e_b[u].pb(v);
		e_b[v].pb(u);
	}
	
	dfs(s_b, 0);
	for (int k = 0; k < SZ(buf); k++)
	{
		int i = buf[k].first;
		int j = buf[k].second;
		
		if(l[i] > l[j]) swap(i, j);
		bool t = r[j] <= r[i] && dep[j] > dep[i] + 2;
		
		if(t || (r[j] > r[i] && par[i] != par[j]))
		{
			good[i] = true;
			good[j] = true;
		}else {
			e_a[i].pb(j);
			e_a[j].pb(i);
		}
	}
	
	dfs2(s_a, 0, 0);	
	
	cout << ans << "\n";
	return 0;
}





Measured memory_bytes: 34928
N = list(map(int, list(input())))[::-1]
dp0 = [float('inf')] * (len(N)+1)
dp1 = [float('inf')] * (len(N)+1)
dp0[0] = 0
dp1[0] = 1
for i in range(len(N)):
    dp0[i+1] = min(dp0[i] + N[i], dp1[i] + 10 - N[i])
    dp1[i+1] = min(dp0[i] + N[i] + 1, dp1[i] + 9 - N[i])
print(dp0[-1])


Measured memory_bytes: 150368
#include <bits/stdc++.h>
using namespace std;
int main(){
   int a,b;
   cin>>a>>b;
   if(a>=13){
     cout<<b<<endl;  
   }
   else if(a>=6){
     cout<<b/2<<endl;  
   }
   else{
     cout<<0<<endl;  
   }
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<queue>
#include<map>
using namespace std;
typedef long long ll;
ll p[200005];
typedef pair<int, int> P;
P f(int x) {
	int a = x % 10;
	int b = 0;
	while (x) {
		b = x;
		x /= 10;
	}
	return P(a, b);
}
int main() {
	int n;
	cin >> n;
	map<P, int>freq;
	for (int i = 1; i <= n; i++) {
		P p = f(i);
		freq[p]++;
	}
	ll ans = 0;
	for (int i = 1; i <= n; i++) {
		P p = f(i);
		P q(p.second, p.first);
		ans += freq[q];
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() 
{
    int w, h, x, y, r;
    cin >> w >> h >> x >> y >> r;
    if(x-r >= 0 && y-r >= 0 && x+r <= h && y+r<=h )
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}


Measured memory_bytes: 3116
n = int(input())
travel_list = [[0, 0, 0]]

for _ in range(n):
    travel_list.append(list(map(int, input().split())))

complete = True
for i in range(n):
    time = travel_list[i+1][0] - travel_list[i][0]
    x_distance =  abs(travel_list[i+1][1] - travel_list[i][1])
    y_distance =  abs(travel_list[i+1][2] - travel_list[i][2])
    xy_distance = x_distance + y_distance

    if time >= xy_distance:
        if time % 2 != xy_distance % 2:
            complete = False
            break
    else:
        complete = False
        break       

print('Yes' if complete else 'No')

Measured memory_bytes: 27300
import java.util.Scanner;

public class Main {
    public static void main(String args[]) {
        try (Scanner in = new Scanner(System.in)) {
            long N = in.nextInt();
            long M = in.nextInt();

            if (Math.min(N, M) <= 2) {
                if (N == 1 && M == 1) {
                    System.out.println(1);
                } else if (N == 2 || M == 2) {
                    System.out.println(0);
                } else {
                    System.out.println(Math.max(N, M) - 2);
                }
            } else {
                System.out.println((N - 2) * (M - 2));
            }
        }
    }
}


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

using namespace std;

int main()
{
    int A, B, C, K, ans = 0;
    cin >> A >> B >> C >> K;

    if (A - K < 0)
    {
        ans += A;
        K -= A;
        if (B - K < 0)
        {
            K -= B;
            if (C - K < 0)
            {
                ans -= C;
                K -= C;
            }
            else
                ans -= K;
        }
    }
    else
        ans += K;

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3636
package main

import (
	"fmt"
	"strings"
)

func main() {
	var n int

	man := make([][][]int, 4)
	for i := range man {
		man[i] = make([][]int, 3)
		for j := range man[i] {
			man[i][j] = make([]int, 10)
		}
	}

	fmt.Scan(&n)
	for i := 0; i < n; i++ {
		var b, f, r, v int
		fmt.Scan(&b, &f, &r, &v)
		man[b-1][f-1][r-1] += v
	}

	for i, x := range man {
		for _, y := range x {
			for _, z := range y {
				fmt.Printf(" %d", z)
			}
			fmt.Println()
		}

		if i < 3 {
			fmt.Println(strings.Repeat("#", 20))
		}
	}
}



Measured memory_bytes: 1144
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
// Welcome to my source code!

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

int main() {
    int n;
    cin >> n;
    int h[n];
    for (int i = 0; i < n; i++) cin >> h[i];
    bool flag = false;
    int ans = 0;
    while (!flag) {
        int cnt = 0;
        for (int i = 0; i < n && (cnt == 0 || h[i] != 0); i++) {
            if (h[i] != 0) {
                cnt++;
                h[i]--;
            }
        }
        if (!cnt) break;
        else ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <stdio.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <set>
#include <sstream>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define FOR(i,a,b) for(int i=a; i<(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort(ALL(x))
#define CLR(a) memset((a), 0 ,sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
const int INF = 1001001001;
const ll LINF = 100100100100100100;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){

    std::fill( (T*)array, (T*)(array+N), val );
}

__attribute__((constructor))
void initial(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

bool IsPrime(ll num){
    if(num < 2) return false;
    else if(num == 2) return true;
    else if(num % 2 == 0) return false;
    double sqrtNum = sqrt(num);
    for(ll i = 3; i <= sqrtNum; i += 2){
        if(num%i==0) return false;
    }
    return true;
}


signed main(){
  int n; cin>>n;
  VI a(n); rep(i,n) cin>>a[i]; sort(ALL(a));
  int cnt = 1;
  reps(i,n-1){
    if(a[i-1]!=a[i]) cnt++;
  }
  if(cnt%2==0) cnt--;
  cout << cnt << endl;

  return 0;
}


Measured memory_bytes: 640
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<cassert>
#include<cassert>
#include<unordered_map>
#include<unordered_set>
#include<functional>
#include<queue>
#include<stack>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<sstream>
#include<iomanip>
#include<cstdio>
#include<cstdlib>
#include<numeric>
#include<random>
#include<chrono>
#include<bitset>
using namespace std;

#define all(x) (x).begin(), (x).end()
#define pb push_back
#define xx first
#define yy second
#define sz(x) (int)(x).size()
#define gc getchar
#define IO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define mp make_pair

#ifndef ONLINE_JUDGE
#  define LOG(x) (cerr << #x << " = " << (x) << endl)
#else
#  define LOG(x) ((void)0)
#endif

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

const double PI=acos(-1);
const ll INF = 1LL<<62;
const ll MINF = -(1LL<<62);

template<typename T> T getint() {
	T val=0;
	char c;
	
	bool neg=false;
	while((c=gc()) && !(c>='0' && c<='9')) {
		neg|=c=='-';
	}

	do {
		val=(val*10)+c-'0';
	} while((c=gc()) && (c>='0' && c<='9'));

	return val*(neg?-1:1);
}

//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); uniform_int_distribution<int>(0, n-1)(rng)


int main() {
	IO;
	ll x;
	cin>>x;
	ll akt=100, ans=0;
	
	while(akt<x) {
		akt+=akt/100;
		ans++;
	}
	
	cout<<ans<<"\n";
	
	

	return 0;
}


Measured memory_bytes: 3652
#include <cstdio>

constexpr int C_SIZE = 10000;

int main(){
  int n;
  int tmp_num;
  int C[C_SIZE];
  for(int i = 0; i < C_SIZE; i++){
    C[i] = 0;
  }
  scanf("%d", &n);
  for(int i = 0; i < n; i++){
    scanf("%d", &tmp_num);
    C[tmp_num]++;
  }
  int p = 0;
  for(int i = 0; i < n; i++){
    for(; p < C_SIZE; p++){
      if(C[p] >0){break;}
    }
    printf("%d", p);
    if(i != n-1) { printf(" "); }
    C[p]--;
  }
  printf("\n");
}

Measured memory_bytes: 1056
#include <stdio.h>

int main(void)
{
	int n;
	int x, y, h, w;
	int i;
	int t;
	int money;
	
	while (1){
		money = 0;
		scanf("%d", &n);
		if (n == 0){
			break;
		}
		for (i = 0; i < n; i++){
			scanf("%d %d %d %d", &x, &y, &h, &w);
			t = x + y + h;
			if (t <= 60 && w <= 2){
				money += 600;
			}
			else if (t <= 80 && w <= 5){
				money += 800;
			}
			else if (t <= 100 && w <= 10){
				money += 1000;
			}
			else if (t <= 120 && w <= 15){
				money += 1200;
			}
			else if (t <= 140 && w <= 20){
				money += 1400;
			}
			else if (t <= 160 && w <= 25){
				money += 1600;
			}
		}
		printf("%d\n", money);
	}
	return (0);
}

Measured memory_bytes: 600
#include<bits/stdc++.h>
using namespace std;
bitset<4000000>f;
main(){
	int n,x,s=0;scanf("%d",&n);f[0]=1;for(int i=1;i<=n;i++)cin>>x,s+=x,f=f|(f<<x);
	for(int i=(s+1)/2;;i++)if(f[i])return cout<<i,0;
}


Measured memory_bytes: 2304
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define rep2(i,a,n) for(int i=(a); i<(n); i++)
#define all(vec) vec.begin(),vec.end()
using ll = long long;
using vi = vector<int>;
using vs = vector<string>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
const int dx[4] = {1, 0,-1, 0};
const int dy[4] = {0, 1, 0,-1};

int main(){
  int H, W; cin >> H >> W;
  vs fld(H);
  rep(i,H) cin >> fld[i];
  
  vvi dist(H, vi(W,-1));
  queue<pii> Q;
  rep(i,H){
    rep(j,W){
      if(fld[i][j]=='#') {Q.push(pii(i,j)); dist[i][j]=0;} 
    }  
  }
  
  while (Q.size()){
    int x = Q.front().first;
    int y = Q.front().second;
    
    rep(i,4){
      int nx = x+dx[i];
      int ny = y+dy[i];
      if(nx<0 || nx >=H || ny<0 || ny>=W) continue;
      if(fld[nx][ny] == '#') continue;
      fld[nx][ny] = '#';
      dist[nx][ny] = dist[x][y]+1;
      Q.push(pii(nx,ny));
    }
    Q.pop();
  }
  
  int ans = 0;
  rep(i,H)rep(j,W) ans = max(ans, dist[i][j]);
  cout << ans << endl;
  return 0;
}

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


int main(){
  int n,i,co;
  co=0;
  cin >> n;
  vector<long long> a(n);
  long long ans=0;
  long long mi=10000000001;
  for(i=0;i<n;++i){
    cin >> a[i];
    ans=ans+abs(a[i]);
    if(a[i]<0){
      co++;
    }
    if(mi>abs(a[i])){
      mi=abs(a[i]);
    }
  }
  if(co%2==1){
    ans=ans-2*mi;
  }
  cout << ans << endl;
  return 0;
}


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

int main(void) {

    int N; 
    cin >> N;
    string S[N];
    for(int i = 0; i < N; i++) {
        cin >> S[i];
    }

    map<string, int> mp;
    for(int i = 0; i < N; i++) {
        mp[S[i]]++; 
    }

    int max_num = -10000000;
    cout << endl;

    for(auto m : mp) {
        max_num = max(max_num, m.second);
    }

    for(auto m : mp ){
        if(m.second == max_num) {
            cout << m.first << endl;
        }
    }
    return 0;

}



Measured memory_bytes: 26752
fn main() {
    let n = read::<usize>();
    let mut a = vec![];
    for i in 0..n {
        let aa = read::<usize>();
        a.push(aa);
    }
    let mut x = a.iter().fold(0, |x, y| x ^ y);
    let mut a = a.iter().map(|&x| x ^ (x - 1)).collect::<Vec<_>>();
    a.sort();
    a.reverse();

    let mut ans = 0;
    for num in a {
        if x ^ num < x {
            x ^= num;
            ans += 1;
        }
    }
    if x == 0 {
        println!("{}", ans);
        return;
    }
    println!("-1");
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}


Measured memory_bytes: 3964
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int m1 = sc.nextInt();
        int d1 = sc.nextInt();
        int m2 = sc.nextInt();
        int d2 = sc.nextInt();
        if (m1 == m2) {
            System.out.println(0);
            return;
        }
        System.out.println(1);
    }

}


Measured memory_bytes: 23124
#include <cstdio>
#include <vector>
static const int MAXN = 100004;

int n;

std::vector<int> a, b, c;

int main()
{
    scanf("%d", &n);
    for (int i = 0, x; i < n; ++i) {
        scanf("%d", &x);
        if (x % 4 == 0) a.push_back(x);
        else if (x % 2 == 0) b.push_back(x);
        else c.push_back(x);
    }

    puts((int)a.size() >= (int)c.size() - 1 && (b.empty() || a.size() >= c.size()) ? "Yes" : "No");

    return 0;
}


Measured memory_bytes: 1012
import itertools

n, m = map(int, input().split())

path = [[False] * n for i in range(n)]
#ｎ行ｎ列のpathリストを生成(中身はすべてFalseにする)
for i in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    path[a][b] = True
    path[b][a] = True
    #頂点aを行、頂点bを列とするようpathリストを更新
    #無向グラフなのでpath[b][a]=Trueも入れる
    
ans = 0
#出力の初期値

# 頂点を並び替える順列を生成してループ
for i in itertools.permutations(range(n), n):
    # 頂点1が始点
    if i[0] == 0:
        # 生成した順列の中をさらにループ
        #生成した順列からすべての頂点を探索する
        for j in range(n):
            # n - 1 まで続いたら全ての頂点を探索したとなるので
            #条件を満たすpathが存在する
            if j == n - 1:
                ans += 1
                break
            # i[j] から i[j + 1] に行くパスがなければ終了
            #ここでpath[a][b] = True or Falseの値を参照している
            #参照した場所の値がTrueでない場合終了
            if not path[i[j]][i[j + 1]]:
                break

print(ans)

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

int main() {
  string S,T;
  cin >> S >> T;
  ll N = S.size();
  vector<ll> v1(26),v2(26);
  
  ll x;
  for (ll i=0;i<N;i++) {
    x = S.at(i)-'a';
    v1.at(x)++;
    x = T.at(i)-'a';
    v2.at(x)++;
  }
  
  sort(v1.begin(),v1.end());
  sort(v2.begin(),v2.end());
  
  ll judge=0;
  for (ll i=0;i<26;i++) {
    if (v1.at(i) != v2.at(i)) {
      judge=1;
      break;
    }
  }
  
  if (judge==1) {
    cout << "No" << endl;
  }
  else {
    cout << "Yes" << endl;
  }
}

Measured memory_bytes: 776
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <algorithm>
#include <cmath>
#define N 3456
template<typename T> inline void read(T &x) {
	x = 0; char c = getchar();
	while (!isdigit(c)) c = getchar();
	while (isdigit(c)) x = (x << 1) + (x << 3) + (c ^ 48), c = getchar();
}
using namespace std;
int n, l;
int t[N];
const double PI = 3.141592653589793238462643383;
int main() {
	read(n), read(l);
	for (int i = 1; i <= n; ++i)	read(t[i]);
	double ansx = 0, ansy = 0;
	for (int i = 1; i <= n; ++i) {
		for (int j = i + 1; j <= n; ++j) {
			double x = cos(PI * (t[i] + t[j]) / l), y = sin(PI * (t[i] + t[j]) / l);
			ansx += x * (n - (j - i + 1));
			ansy += y * (n - (j - i + 1));
			x = cos(PI + PI * (t[i] + t[j]) / l), y = sin(PI + PI * (t[i] + t[j]) / l);
			ansx += x * (j - i - 1);
			ansy += y * (j - i - 1);
		}
	}
	ansx /= (1ll * n * (n - 1) * (n - 2) / 6);
	ansy /= (1ll * n * (n - 1) * (n - 2) / 6);
	printf("%.10lf %.10lf\n", ansx, ansy);
	return 0;
}


Measured memory_bytes: 3624
#pragma GCC optimize("O3")
#include<iostream>
#include<algorithm>
#include<string>
#include<cmath>
#include<cstdlib>
#include<set>
#include<vector>
#include<sstream>
#include<queue>
#include <iomanip>
#include<unordered_set>
#include <unordered_map>
constexpr auto INF = 9223372036854775807;
typedef long long int ll;
typedef unsigned long long int ull;
typedef unsigned long int ul;
#define f(i,a,b) for(ll i=(ll)a;i<(ll)b;i+=1)
#define rf(i,a,b) for(ll i=(ll)a;i>=(ll)b;i-=1)
#define endl '\n'
#define N 1000000007 // prime modulo value 
#define all(x) x.begin(),x.end()
using namespace std;

inline int mex(unordered_set<int> st)
{
	int m = 0;
	while (st.find(m) != st.end())
	{
		m += 1;
	}
	return m;
}
inline int calculateGrundy(int n)
{
	if (n == 1)
		return 0;
	unordered_set<int> mexi;
	for (int i = 1; i <= sqrt(n); i += 1)
	{
		if (n % i == 0)
		{
			if (n / i != n)
				mexi.insert(calculateGrundy(n / i));
			mexi.insert(calculateGrundy(i));
		}
	}
	return mex(mexi);
}
inline ll gcd(ll a, ll b)
{
	if (b == 0)
		return a;
	return gcd(b, a % b);
}
inline ll power(ll base, ll exp)
{
	ll ans = 1;
	while (exp > 0)
	{


		if (exp % 2 != 0)
			ans = (ans * base) % N;

		base = (base * base) % N;
		exp /= 2;
	}
	return ans % N;
}
int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	ll m, k;
	cin >> m >> k;
	ll mul = m / k;
	ll ans = min(abs((mul * k) - m), abs(((mul + 1) * k) - m));
	cout << ans;
	return 0;
}

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

constexpr int INF = 1e9;
void chmin (int &a, int b) {
	if (a > b) a = b;
}

int main() {
	int n, m;
	cin >> n >> m;
	vector<vector<int>> g(n, vector<int>(n, INF));
	for (int i = 0; i < m; i++) {
		int a, b, c;
		cin >> a >> b >> c;
		g[a][b] = c;
	}

	vector<vector<int>> dp(1 << n, vector<int>(n, INF));
	dp[0][0] = 0;
	
	for (int s = 0; s < (1 << n); s++) {
		for (int v = 0; v < n; v++) {
			for (int u = 0; u < n; u++) {
				if (u == v or (s & (1 << u))) continue;
				chmin(dp[s | (1 << u)][u], dp[s][v] + g[v][u]);
			}
		}
	}
	
	int ans = dp[(1 << n) - 1][0];
	if (ans == INF) ans = -1;
	
	cout << ans << '\n';
	
	return 0;
}


Measured memory_bytes: 6232
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);
		int s = scanner.nextInt();
		int h = s/3600;
		s%= 3600;
		int m = s/60;
		s%= 60;
		System.out.println(h + ":" + m + ":" + s);
	}
}

Measured memory_bytes: 17292
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <string>
#include <set>
#include <math.h>
#include <map>
#include <stack>
using namespace std;
static const int INF = 1e9+7;
// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, a, b) for (int i =a; i < b; i++)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define PI 3.14159265359

int main(){
    //int a, b, c; cin >> a >> b >> c;
    vector<int> hairetu(3);
    rep(i, 3) cin >> hairetu[i];
    int k; cin >> k;

    rep(i,k){
        sort(all(hairetu));
        hairetu[2] *= 2;
    }
    int result = 0;
    rep(i,3) result += hairetu[i];

    cout << result << endl;

    return 0;
}


Measured memory_bytes: 3568
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <cctype>
#include <map>
#include <vector>
#include <queue>
#include <list>
#define PI 3.141592653
#define rep(i,a,n) for(int i=a;i<(int)n;++i)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define descSort(a) sort(a.begin(),a.end(),std::greater<int>())

using namespace std;
typedef long long ll;
const ll INF = 1e9 + 7;
long long gcd(long long x, long long y) {
	return y ? gcd(y, x % y) : x;
}

long long lcm(long long x, long long y) {
	return x / gcd(x, y)*y;
}
int main(void){
	ll n, k;
	cin >> n >> k;
	ll total = 0;
	map<ll, ll> mp;
	rep(i, 0, n) {
		int a, b;
		cin >> a >> b;
		mp[a] += b;
	}
	for(auto itr=mp.begin();itr!=mp.end();itr++) {
		k -= itr->second;
		if (k <= 0) {
			cout << itr->first << endl;
			break;
		}
	}
	return 0;
}

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

using namespace std;

int main()
{
    int n;
    int ans=0;
    int low=200000+6;
    cin >> n;
    int p[200000+2];
    for(int i=0;i<n;i++){
        cin >>p[i];
        if(low >=p[i]){
            ans++;
            low=p[i];
        }
    }
    cout << ans;
    
}

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

using namespace std;

typedef long long ll;

ll A[101010], B[101010];
ll n, ans;

int main()
{
	ll i;
	
	scanf("%lld", &n);
	
	for(i=0;i<n;i++){
		scanf("%lld%lld", A+i, B+i);
	}
	
	for(i--;i>=0;i--){
		ans += (B[i] - (A[i] + ans) % B[i]) % B[i];
	}
	
	printf("%lld\n", ans);
	
	return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#include<atcoder/all>

using namespace std;
using namespace atcoder;
using ll = long long;
using ull = unsigned long long;
using P = pair<int,int>;
#define rep(i,n) for(ll i = 0;i < (ll)n;i++)
#define ALL(x) (x).begin(),(x).end()
#define MOD 1000000007



template<typename T>
class Segtree{
  public:
  using F = function<T(T,T)>;
  int n;
  F f;
  T ti;
  vector<T> dat;
  Segtree(){};
  Segtree(F f,T ti): f(f),ti(ti){}
  void init(int N){
    n = 1;
    while(n < N)n <<= 1;
    dat.assign(n << 1,ti);
  }
  void build(const vector<T> &v){
    int N = v.size();
    init(N);
    rep(i,N)dat[n+i] = v[i];
    for(int i = n-1;i >= 0;i--)dat[i] = f(dat[(i << 1)|0],dat[(i << 1)|1]);
  }
  void set(int k,T x){
    k += n;
    dat[k] = max(dat[k],x);
    while(k >>= 1){
      dat[k] = f(dat[(k << 1)|0],dat[(k << 1)|1]);
    }
  }
  T get(int l,int r){
    T vl = ti,vr = ti;
    for(l += n,r += n;l < r;l >>= 1,r >>= 1){
      if(l & 1)vl = f(vl,dat[l++]);
      if(r & 1)vr = f(dat[--r],vr);
    }
    return f(vl,vr);
  }
};

int main(){
  
  int n,k;
  cin >> n >> k;
  vector<int> v(n);
  rep(i,n)cin >> v[i];
  auto f = [](int a,int b){return max(a,b);};
  Segtree<int> seg(f,-1);
  seg.build(vector<int>(300010,0));
  rep(i,n){
    int s = seg.get(max(0,v[i]-k),min(v[i]+k,300000)+1);
    seg.set(v[i],s+1);
  }
  cout << seg.get(0,300001) << "\n";

  



  return 0;
}

Measured memory_bytes: 9528
#include<stdio.h>
int main(void){
  int data[3];
  int size,i;
  scanf("%d", &size);
  for(i=0;i<size;i++){
    scanf("%d %d %d", &data[0], &data[1], &data[2]);
    if((data[0]*data[0] + data[1]*data[1] == data[2]*data[2])||
       (data[1]*data[1] + data[2]*data[2] == data[0]*data[0])||
       (data[2]*data[2] + data[0]*data[0] == data[1]*data[1])){
      printf("YES\n");
    }
    else{
      printf("NO\n");
    }
  }

  return 0;
}

Measured memory_bytes: 1748
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
const double PI=acos(-1);

int main(){
    string s; ll k;
    cin >> s >> k;
    ll cnt = 0, ans = 0;
    char t = s[0];
    rep(i, s.length()){
        if(t == s[i]) cnt++;
        else {
            ans += cnt/2;
            cnt = 1;
            t = s[i];
        }  
    }
    if(t != ' ') ans += cnt/2;
    
    if(cnt == s.length()){
        ans = s.length() * k / 2;
    }else{
        ans *= k;
        if(s[0] == s[s.length()-1]){
            ll a = 0, b = 0;
            for(ll i = s.length()-1; i >= 0; --i){
                if(s[i] == s[s.length()-1]) a++;
                else break;
            }
            rep(i, s.length()){
                if(s[i] == s[0]) b++;
                else break;
            }
            ll c = (a/2 + b/2 - ((a+b)/2))*(k-1);
            ans -= c;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, s, n) for (int i = s; i < n; i++)
#define rp(i,n) for (int i=0;i<n;i++)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define all_acc(x) (x).begin(), (x).end(), 0LL
#define int long long
#define absSort(v) sort(a.begin(), a.end(), [](int i, int j) -> bool { return abs(i) < abs(j); });
using namespace std;
using P = pair<int, int>;
using Graph = vector<vector<int>>;
using ll = long long;
double pi=3.14159265359;

//出力するよ
void output_tate(vector<int> s){
    int n = s.size();
    for (int i = 0; i < n; i++){
        //if (i != 0)
        //    cout << " ";
        cout << s[i]<<endl;
    }
    //cout << endl;
}

void output_yoko(vector<int> s){
    int n = s.size();
    for (int i = 0; i < n; i++){
        if (i != 0)
            cout << " ";
        cout << s[i];//<<endl;
    }
    cout << endl;
}

int MOD = pow(10, 9) + 7;

//xが
int x_mod(string s,int cnt){
    if(cnt==0) return 0;

    int ans=0;
    int n=s.length();

    int p=1;

    for(int i=n-1;i>=0;i--){
        if(s[i]=='1'){
            ans=(ans+p%cnt)%cnt;
        }
        p*=2;
    }

    return ans;
}


const int maxn = 100010;
int dp[2 * maxn][2];
int pre[2];

//整数nが与えられたときに、何回で0になるかを求める関数。cntはこれまでの回数。
int mod_n(int n){
    if(n==0) return 0;
    bitset<32> bit(n);
    return mod_n(n %(bit.count()))+1LL; 
}

signed main() {
    ios_base::sync_with_stdio(false);
	cin.tie(NULL);
    int n; cin>>n;
    string s; cin>>s;
    //vector<vector<int>> dp(200001,vector<int>(2));
    //vector<int> pre(2);//cnt+-1でxを合ったあまりを格納する。

    int cnt=count(s.begin(),s.end(),'1');
    
    int pl=cnt+1,mi=cnt-1;

    if(mi!=0) dp[n-1][0]=1%mi;
    dp[n-1][1]=1%pl;

    //dpは各ケタをcnt+-1で割った値を保持する。
    for(int i=n-2;i>=0;i--){
        if(mi!=0) dp[i][0] = (2*dp[i+1][0]) % mi;
        dp[i][1] = (2*dp[i+1][1]) % pl;
    }

    //cout<<1%0<<endl;
    //割ったあまりを計算する。
    for(int i=0;i<n;i++){
        if(s[i]=='1'){

            if(mi!=0){
                pre[0]+= dp[i][0];
                pre[0] %= mi;
            }

            pre[1] += dp[i][1];
            pre[1] %= pl;
        }
    }

    for(int i=0;i<n;i++){
        int now=0;
        //1を変更する場合
        if(s[i]=='1'){
            now=pre[0]-dp[i][0];//合計値からそのケタだけ引く。
            if(now<0) now+=mi;
        }else{
            now=(pre[1]+dp[i][1])%pl;
        }
        if(s[i]=='1'&&cnt==1) cout<<'0'<<endl;
        else cout<<(mod_n(now)+1)<<endl;
    }
}


Measured memory_bytes: 6864
#include <iostream>
#include <deque>
#include <algorithm>

using namespace std;

double calcValue(double v1, double v2){
    return (v1 + v2)/2.0;
}
int main()
{
    int n;
    cin >> n;

    deque<double> v(n);
    for(int i=0; i<n; i++){
        cin >> v[i];
    }
    sort(v.begin(), v.end());

    double tmp;
    while(v.size()>1){
        tmp = calcValue(v.at(0), v.at(1));
        v.pop_front();
        v.front() = tmp;
    }
    double value = tmp; 
    cout << value << endl;
    return 0;
}

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

int main()
{
    int n; cin >> n;
    vector<string> s(n);
    for (int i = 0; i < n; i++) {
        cin >> s[i];
    }

    const int p = 26;
    vector<int> alphabetNum(p, 0);

    for (char k = 'a'; k <= 'z'; k++) {
        int commonNum = 100;
        for (int i = 0; i < n; i++) {            
            int tmp = 0;
            for (int j = 0; j < s[i].size(); j++) {
                if (s[i][j] == k) tmp++;         
            }
            commonNum = min(commonNum, tmp);
        }
        alphabetNum[k - 'a'] += commonNum;
    }

    for (char i = 'a'; i <= 'z'; i++) {        
        for (int j = 0; j < alphabetNum[ i- 'a']; j++) {
            cout << i;
        }
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.*;


class Main{
    public static void main(String args[]){
        Scanner scan = new Scanner(System.in);
        int a = scan.nextInt();
        int b = scan.nextInt();
        List<String> array = new ArrayList<String>();
        int i = 0;

        while(i<=a){
          String c = scan.nextLine();
          array.add(c);
          i++;  
        }
        Collections.sort(array);
        i = 0;
        while(i<=a){
            System.out.print(array.get(i));
            i++;  
          }
        scan.close();
    }
}

Measured memory_bytes: 22100
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
#include<functional>
using namespace std;
using ll = long long;

int main(){
  int N;
  cin >> N;
  vector<int> A(N+1);
  for( int i=1; i<=N; i++ ) cin >> A.at(i);
  /*cout << "A = { ";
  for( int i=1; i<=N; i++ ) cout << A.at(i) << " ";
  cout << "}" << endl; */
  
  vector<int> ans(N+1);
  int upper_parity;
  for( int i=N/2+1; i<=N; i++ ) ans.at(i) = A.at(i);
  for( int i=N/2; i>0; i-- ){
    upper_parity = 0;
    for( int j=2*i; j<=N; j+=i ){
      upper_parity += ans.at(j);
    }
    ans.at(i) = ( A.at(i) + upper_parity ) %2;
  }
  /*cout << "ans={ ";
  for( int i=1; i<=N; i++ ) cout << ans.at(i) << " ";
  cout << "}" << endl; */
    
  int sum = 0;
  for( int i=1; i<=N; i++ ) sum += ans.at(i);
  cout << sum << endl;
  for( int i=1; i<=N; i++ ){
    if( ans.at(i) == 1 ) cout << i << " ";
  }
  return 0;
}


Measured memory_bytes: 2432
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <queue>
#include <cmath>
#include <cctype>
#include <stack>
#include <map>
#include <cstring>
#include <sstream>
#include <set>
#include <list>
#include <fstream>
#include <iomanip>
#include <assert.h>

#define ll long long
#define ull unsigned long long
#define pii std::pair<int, int>
#define op                            \
    std::ios::sync_with_stdio(false); \
    std::cin.tie(0);

const int INF = 0x3f3f3f3f;
const int maxn = (100000 + 5);
const int mod = (1000000007);

int main()
{
    int a,b;
    bool flag=false;
    scanf("%d %d",&a,&b);
    int x1=floor(a/0.08);
    int y1=ceil(b/0.1);
    int x=std::min(x1,y1);
    int y=std::max(x1,y1);
    for(int i=x-1;i<=y+1;i++)
        if(floor(i*0.08)==a&&floor(i*0.1)==b)
        {
            printf("%d\n",i);
            flag=true;
            break;
        }
    if(!flag) printf("-1\n");
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <functional>
#include <queue>
#include <string>
#include <cstring>
#include <numeric>
#include <cstdlib>
#include <cmath>
#include <map>
#include <unordered_map>
#include <set>
using namespace std;

typedef long long ll;

#define INF 10e17 // 4倍しても(4回足しても)long longを溢れない
#define rep(i,n) for(int i=0; i<n; i++)
#define rep_r(i,n,m) for(int i=m; i<n; i++)
#define END cout << endl
#define MOD 1000000007
#define pb push_back
#define sorti(x) sort(x.begin(), x.end())
#define sortd(x) sort(x.begin(), x.end(), std::greater<int>())
#define debug(x) std::cerr << (x) << std::endl;
#define roll(x) for (auto itr : x) { debug(itr); }

template <class T> inline void chmax(T &ans, T t) { if (t > ans) ans = t;}
template <class T> inline void chmin(T &ans, T t) { if (t < ans) ans = t;}

int main() {
  int n,x;
  cin >> n >> x;
  vector<ll> l(n);
  rep(i, n) cin >> l[i];
  ll now = 0, cnt = 1;
  for (int i = 0; i < n; ++i) {
    now += l[i];
    if (now <= x) {
      cnt += 1;
    } else {
      break;
    }
  }

  cout << cnt << endl;
}


Measured memory_bytes: 256
# import sys; input = sys.stdin.buffer.readline
# sys.setrecursionlimit(10**7)
from collections import defaultdict
con = 10 ** 9 + 7; INF = float("inf")

def getlist():
	return list(map(int, input().split()))

#処理内容
def main():
	N = int(input())
	L = getlist()
	ans = 0
	for i in range(N):
		for j in range(i + 1, N):
			for k in range(j + 1, N):
				x, y, z = list(sorted([L[i], L[j], L[k]])) 
				if x != y and y != z and x + y > z:
					ans += 1

	print(ans)
	
if __name__ == '__main__':
	main()

Measured memory_bytes: 9456
N = int(input())
S = input()

count = 0
for i in range(1000):
    password = '{:03}'.format(i)
    s = S
    for j in range(3):
        index = s.find(password[j])
        if index == -1:
            break
        s = s[index + 1:]
    else:
        count += 1

print(count)


Measured memory_bytes: 3060
#include<stdio.h>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
 
 
using namespace std;
 
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
 
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
 
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
 
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
 
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
 
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
 
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
 
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int digits_sum(int n){
  int ans=0;
  while(n != 0){
    ans+=n%10;
    n/=10;
  }
  return ans;
}

int main(void){
  int n;
  cin>>n;
  int ans = 100000;
  REP(i, n-1){
    int a, b;
    a = i+1;
    b = n-i-1;
    ans = min(ans, digits_sum(a)+digits_sum(b));
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

from math import atan, tan, pi

a, b, x = map(int, readline().split())


def max_v(si):
    si = si / 180 * pi
    if si < atan(b / a):
        area = a * b - a ** 2 * tan(si) / 2
    else:
        area = b * (b / tan(si) / 2)
    return area * a


low = 0
high = 90
while high - low > 1e-7:
    mid = (low + high) / 2
    if max_v(mid) <= x:
        high = mid
    else:
        low = mid
print((high + low) / 2)


Measured memory_bytes: 3316
import Control.Monad

main :: IO ()
main = do
    [n,m] <- map read . words <$> getLine
    ss <- map (map read . words) <$> replicateM m getLine
    let result = solve ss n
    forM_ result $ putStrLn . show

solve :: [[Int]] -> Int -> [Int]
solve e n = map (counter e) [1..n]

counter :: [[Int]] -> Int -> Int
counter e s =
    foldl (+) 0 $ map (length . filter (\x -> x == s)) e

Measured memory_bytes: 892
def main():
    D, N = map(int, input().split())

    c = pow(100, D)

    x = 1
    cnt = 0
    while True:
        if x % 100 != 0:
            cnt += 1
            if cnt == N:
                break
        x += 1
    print(x * c)


if __name__ == '__main__':
    main()

# import sys
# input = sys.stdin.readline
# 
# sys.setrecursionlimit(10 ** 7)
# 
# (int(x)-1 for x in input().split())
# rstrip()


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define loop(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  loop(i,0,n)
#define all(c) c.begin(),c.end()
#define vi vector<int>
#define vl vector<ll>
#define pll pair<ll,ll>
#define vpll vector<pll>

void Acout(int A[],int N){
    rep(i,N){
        if(i)cout<<" ";
        cout<<A[i];
    }
    cout<<endl;
}

int main(){
    int a,b;
    stack<int> c;
    char s[100];

    while(scanf("%s",s)!=EOF){
        if(s[0]=='+'){
            b=c.top();c.pop();
            a=c.top();c.pop();
            c.push(a+b);
        }
        else if(s[0]=='-'){
            b=c.top();c.pop();
            a=c.top();c.pop();
            c.push(a-b);
        }
        else if(s[0]=='*'){
            b=c.top();c.pop();
            a=c.top();c.pop();
            c.push(a*b);
        }
        else c.push(atoi(s));
    }
    cout<<c.top()<<endl;
}


Measured memory_bytes: 3172
N = int(input())
X = list(map(int, input().split()))
num = 0
ans = 10**7 + 10

for p in range(1, 101):
    for i in range(N):
        num += (X[i] - p) ** 2
    if num < ans:
        ans = num
        num = 0

print(ans)

Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;

int main() {

	string a;
	int flagA = false, 
		flagC = 0, 
		flagL = 0;

	cin >> a;

	if(a[0] == 'A')
		flagA = true;

	for(unsigned int i = 2; i <= a.size()-2; i++) {
		if(a[i] == 'C')
			flagC++;
	}

	for(unsigned int i = 0; i <= a.size()-1; i++) {
		if(a[i] != 'C' && a[i] != 'A' && a[i] >= 'A' && a[i] <= 'Z')
			flagL++;
	}

	if(flagA && (flagC == 1) && (flagL == 0))
		cout << "AC" << endl;
	else
		cout << "WA" << endl;

	return 0;
}

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

void main_()
{
    ll N;
    vector<ll> As;
    cin >> N;
    copy_n(istream_iterator<ll>(cin), N, back_inserter(As));
    vector<ll> ball_counts(2 * 100'000 + 1);
    for (auto a : As) {
        ball_counts[a]++;
    }
    auto mc2 = [](ll m) { return (m < 2) ? 0 : m * (m - 1) / 2; };
    auto total = accumulate(begin(ball_counts), end(ball_counts), 0LL,
        [mc2](auto acc, auto n) {
            return acc + mc2(n);
        });

    for (auto a : As) {
        auto count = ball_counts[a];
        auto ans = (count < 2) ? total : total - (count - 1);
        cout << ans << "\n";
    }
}
int main()
{
    //cin.tie(nullptr);
    //cout.tie(nullptr);
    //ios_base::sync_with_stdio(false);
    main_();
    return 0;
}


Measured memory_bytes: 5872
#include <bits/stdc++.h>
#define p(s) cout<<(s)<<endl
#define REP(i,n,N) for(int i=n;i<N;i++)
#define RREP(i,n,N) for(int i=N-1;i>=n;i--)
#define CK(n,a,b) ((a)<=(n)&&(n)<(b))
#define F first
#define S second
typedef long long ll;
using namespace std;
const int inf = 1e9;

string s;
int a,b,c,d,n;
ll ans,tmp;
char ju(int n){
    if(n==0) return '+';
    return '-';
}
int main(void){
    cin>>n;
    a = n/1000;
    b = n/100%10;
    c = n/10%10;
    d = n%10;
    REP(i,0,2){
        REP(j,0,2){
            REP(k,0,2){
                ans=a+b*pow((-1),i)+c*pow((-1),j)+d*pow((-1),k);
                if(ans==7){
                    cout<<a<<ju(i)<<b<<ju(j)<<c<<ju(k)<<d<<"=7"<<endl;
                    return 0;
                }
            }
        }
    }
    return 0;
}


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

int main() {
  string s;
  cin >> s;
  int result = s.length();
  int before_snum = 0;
  int i;
  for (i = 0; i < s.length(); i++) {
    if (s.at(i) == 'S') {
      before_snum++;
    } else if (before_snum && s.at(i) == 'T') {
      result -= 2;
      before_snum--;
    }
  }
  cout << result << endl;
  return 0;
}


Measured memory_bytes: 640