akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace atcoder172
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = long.Parse(Console.ReadLine());

            var ans = n % 1000;
            if (ans == 0)
            {
                Console.WriteLine(ans);
            }
            else
            {
                Console.WriteLine(1000 - ans);
            }
        }
    }
}

Measured memory_bytes: 27484
N, W = map(int, input().split())

dp = [0] * (W + 1)
for i in range(N):
    w, v = map(int, input().split())

    for j in range(W, w-1, -1):
        dp[j] = max(dp[j-w] + v, dp[j])
print(dp[-1])

Measured memory_bytes: 67784
N, K = map(int, input().split())
d = []
A = []
for i in range(K):
  d.append(int(input()))
  lis = list(map(int, input().split()))
  for j in range(d[-1]):
    if lis[j] not in A:
      A.append(lis[j])
A = set(A)
print(N-len(A))


Measured memory_bytes: 9192
#include <stdio.h>

int main(){

    int i,j,a,b,c;
     
 	  scanf("%d",&a);
	  scanf("%d",&b);
	  scanf("%d",&c);	      
     
    j=0;
     
    for(i=a;i<=b;++i){
	   if(c%i==0){
		   j++;
	   }
    }

 	printf("%d\n",j);

	return 0;
}

Measured memory_bytes: 596
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cctype>
#include <vector>

#define ll long long

using namespace std;

inline int read() {
	int x=0,f=1;
	char ch=getchar();
	while (!isdigit(ch)) {if (ch=='-') f=-1;ch=getchar();}
	while (isdigit(ch)) x=x*10+ch-'0',ch=getchar();
	return x*f;
}

const ll p=1e9+7;

inline ll pow(ll a,ll b) {
	ll ans=1,base=a;
	while (b>0) {
		if (b&1) {
			ans=(ans*base)%p;
		}
		b>>=1;
		base=(base*base)%p;
	}
	return ans;
}

void write(ll x) {
	if (x<0) x=-x,putchar('-');
	if (x>9) write(x/10);
	putchar(x%10+'0');
}

int main() {
	int n=read(),a=read(),b=read();
	ll ans=0;
	ans=pow(2,n)%p;
	ans--;
	//cout<<ans<<endl;
	ll fa=1,fb=1;
	for (int i=1;i<=a;i++) {
		fa=fa*(ll)i%p;
	}
	for (int i=1;i<=b;i++) {
		fb=fb*(ll)i%p;
	}
	ll inva=pow(fa,p-2),invb=pow(fb,p-2);
	//cout<<inva<<" "<<invb<<endl;
	ll diva=1,divb=1;
	for (int i=n-a+1;i<=n;i++) {
		diva=diva*(ll)i%p;
	}
	for (int i=n-b+1;i<=n;i++) {
		divb=divb*(ll)i%p;
	}
	int ma=diva*inva%p;
	int mb=divb*invb%p;
	ans=(ans-ma-mb)%p;
	cout<<(ans+p)%p<<endl;;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
using ll = long long; using ld = long double; const char nl = '\n';
/* -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- */

#include <bits/extc++.h>
namespace pbds =  __gnu_pbds;
template <typename key, typename val=pbds::null_type, typename comp=less<key>>
using ostree=pbds::tree<key,val,comp,pbds::rb_tree_tag,pbds::tree_order_statistics_node_update>;
using vi = vector< int >; using vll = vector< ll >;
#define all(x) std::begin(x), std::end(x)
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename...Args, template<typename...> typename T> string to_string(T<Args...> const&);
string to_string(string const&s){return '"'+s+'"';}
string to_string(char const &c) {return to_string(string(1,c));}
string to_string(char const *c) {return to_string(string(c));}
string to_string(bool const &b) {return (b ? "1" : "0");}
template<typename... Args> string to_string(pair<Args...> const&p)
{return "("+to_string(p.first)+", "+to_string(p.second)+")";}
template <typename...Args, template<typename...> typename T> string to_string(T<Args...> const&S)
{string s = "{"; for(auto const& e: S)s+=" "+to_string(e);s+=" }"; return s;}
template<typename Tail> void debug_out(Tail t) {cerr<<" "<<to_string(t)<<" ]"<<endl;}
template<typename Head, typename... Tail> void debug_out(Head h, Tail... t)
{cerr << " " << to_string(h) << ","; debug_out(t...);}
#define pr(...) cerr<<"["<<(#__VA_ARGS__)<<"] : [", debug_out(__VA_ARGS__)
template <typename T> void dbr(T lb, T ub)
{cerr<<'{';for(auto it=lb; it!=ub; it++)cerr<<' '<<to_string(*it); cerr<<" }"<<endl;}
template<typename T, typename Comp=less<T>> bool smin(T &mem, T const&v, Comp const&cmp=Comp())
{return cmp(v, mem) ? mem = v, true : false;}
template<typename T, typename Comp=less<T>> bool smax(T &mem, T const&v, Comp const&cmp=Comp())
{return cmp(mem, v) ? mem = v, true : false;}
/* -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- */



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

  int n; cin >> n;
  int a[1+n];
  for(int i=1; i<=n; i++) cin >> a[i];
  int c = 0;
  for(int i=2; i<n; i++) {
    if( a[i-1] < a[i] and a[i] < a[i+1] ) c++;
    if( a[i-1] > a[i] and a[i] > a[i+1] ) c++;
  }
  cout << c << endl;

}
/* -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- */


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

using namespace std;

int a[2100];
int n;

int main(){
    cin >> n;
    for(int i = 0; i < n; i++) cin >> a[i];
    sort(a, a + n);
    int res = 0;
    for(int i = 0; i < n - 2; i++){
        for(int j = i + 1; j < n - 1; j++){
            for(int k = n - 1; k > j; k--){
                if(a[k] < a[i] + a[j]){
                    res += (k - j);
                    break;
                }
            }
        }
    }
    cout << res << endl;
}

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

int main() {
  long int h;
  long int n;
  long int a;
  long int sum_a = 0;
  cin >> h >> n ;
  // cout << h << " " << n << " " << sum_a << " ";
  for ( int i=0 ; i < n ; ++i ) {
    cin >> a ;
    sum_a = sum_a + a; 
  }
  // cout << a << " " << sum_a ;
  if (sum_a >= h){
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cmath>
using namespace std;
typedef long long LL;
const int inf = 1 << 30;
const LL INF = 1LL << 60;
const int MaxN = 2000;

int N, Z, W;
int a[MaxN + 5];

int main() 
{
	while(scanf("%d %d %d", &N, &Z, &W) != EOF)
	{
		for(int i = 1; i <= N; i++) scanf("%d", &a[i]);
		int ans = -inf;
		if(N == 1) ans = abs(a[N] - W);
		else ans = max(abs(a[N] - W), abs(a[N] - a[N - 1]));
		printf("%d\n", ans);
	}
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ll  long long
#define FASTINOUT ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const int N=2e5+9;
bool a[59][59];
bool visited[59];
int l[59],r[59];
int x,m;
void dfs(int y){
    visited[y]=1;
    for (int i=1;i<=x;i++){
        if (a[y][i]&&!visited[i])
            dfs(i);
    }
}
int main()
{
    FASTINOUT;
    cin>>x>>m;
    for (int i=0;i<m;i++){
        cin>>l[i]>>r[i];
        a[l[i]][r[i]]=a[r[i]][l[i]]=1;
    }
    int ans=0;
    for (int i=0;i<m;i++){
        a[l[i]][r[i]]=a[r[i]][l[i]]=0;
        memset(visited,false,sizeof visited);
        dfs(1);
        bool v=0;
        for (int j=1;j<=x;j++){
            if (!visited[j]){
                v=1;
                break;
            }
        }
        if (v)
            ans++;
        a[l[i]][r[i]]=a[r[i]][l[i]]=1;
    }
    cout<<ans<<"\n";
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int A,B;
    cin >> A >> B;
    A = (A == 1)? 14 : A;
    B = (B == 1)? 14 : B;    
    if(A == B) cout << "Draw" << endl;
    else if(A > B) cout << "Alice" << endl;
    else cout << "Bob" << endl;;
}


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

#define INF 1 << 29
#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)

using namespace std;

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

void gen_sosuu(int sosuu[]){
  REP(i,100010){
    sosuu[i] = true;
  }
  sosuu[0] = false;
  sosuu[1] = false;
  sosuu[2] = true;
  FOR(i,2,sqrt(100000)+1){
    if(sosuu[i] == false) continue;
    for(int j = 2; i*j<=100000;j++){
      //printf("%d %d %d\n",i*j,i,j);
      sosuu[i*j] =false;
    }
  }
}

/*
0 6 7 6 7 0
0
6 0
7 0 6
6 6 0 7
7 7 0 6 6
0 6 6 0 7 7
*/

int n;
int a;
vector<int> vec;

int main(){
  scanf("%d",&n);
  REP(i,n){
    scanf("%d",&a);
    if(i%2==1){
      vec.insert(vec.begin(),a);
    }else{
      vec.push_back(a);
    }
  }
  if(n%2==1){
    reverse(vec.begin(),vec.end());
  }
  REP(i,n){
    printf("%d ",vec[i]);
  }
  printf("\n");
}


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

using namespace std;

const double PI = 3.14159265358979323846;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

double equal(double a, double b) {
    return fabs(a - b) < DBL_EPSILON;
}

std::istream &operator>>(std::istream &in, set<string> &o) {
    string a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

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

    vector<int> speeds = [&] {
        vector<int> _times(n), _speeds(n);
        rep(i, n) cin >> _times[i];
        rep(i, n) cin >> _speeds[i];

        vector<int> speeds;
        rep(i, n) {
            rep(j, _times[i]) {
                speeds.push_back(_speeds[i]);
            }
        }

        vector<int> speeds2;
        rep(i, speeds.size()) {
            if (i == 0) {
                speeds2.push_back(0);
                speeds2.push_back(speeds[i]);
            } else {
                int p = speeds[i - 1];
                int c = speeds[i];
                speeds2.push_back(min(p, c));
                speeds2.push_back(c);
            }
        }
        speeds2.push_back(0);
        return speeds2;
    }();

    vector<double> dp(speeds.size());
    rep(i, speeds.size()) dp[i] = speeds[i];
    rep(i, speeds.size()) if (i != 0) cmin(dp[i], dp[i - 1] + 0.5);
    rep(i, speeds.size()) if (i != 0) {
            int j = speeds.size() - i - 1;
            cmin(dp[j], dp[j + 1] + 0.5);
        }

    double sum = 0;
    rep(i, speeds.size()) {
        if (i == 0) continue;
        double a = dp[i - 1], b = dp[i];
        double now = (a + b) / 2 * 0.5;
        sum += now;
    }
    printf("%.20f\n", sum);
}



Measured memory_bytes: 892
#include <bits/stdc++.h>
#include <cstdlib>
#include <cmath>
#include <algorithm>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using Graph= vector<vector<ll>>;
struct edge{ll to ; ll cost ;} ;
using graph =vector<vector<edge>> ;
#define rep(i,n) for (ll i=0; i < (n); ++i)
#define rep2(i,n,m) for(ll i=n;i<=m;i++)
#define rep3(i,n,m) for(ll i=n;i>=m;i--)
#define pb push_back
#define eb emplace_back
#define ppb pop_back
#define mpa make_pair
#define fi first
#define se second 
#define set20 cout<<fixed<<setprecision(20) ;
const ll INF=1e18 ;
inline void chmax(ll& a,ll b){a=max(a,b);}
inline void chmin(ll& a,ll b){a=min(a,b);}
double pi=acos(-1) ;
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;}
 

 int main(){
  string s ; cin>>s ;
  ll k= s.size() ;
  vector<ll> A ;

  rep(i,k-1){
  if(s[i]!=s[i+1]) A.pb(i+1);
 
  }
  ll w= A.size() ;
  ll ans=INF ;
  rep(i,w) chmin(ans,max(A[i],k-A[i])) ;
  if(w==0) ans=k ;
 
  cout<<ans<<endl ;


  
   return 0 ;
}



Measured memory_bytes: 4024
#![allow(clippy::needless_range_loop)]
#![allow(unused_macros)]
#![allow(dead_code)]
#![allow(unused_imports)]

use itertools::Itertools;
use proconio::input;
use proconio::marker::*;

fn main() {
    input! {
        a: isize,
        b: isize,
        c: isize,
        d: isize,
    }

    let v = [a * d, a * c, b * d, b * c];
    let ans = v.iter().max().unwrap();

    println!("{}", ans);
}


Measured memory_bytes: 2168
n=gets.to_i
a=gets.split.map &:to_i
a.sort!
c=0
31.downto(1){|s|
  i=0
  j=a.size-1
  while i<j
    if !a[i]
      i+=1
    elsif !a[j]
      j-=1
    else
      k=a[i]+a[j]-2**s
      if k<0
        i+=1
      elsif k>0
        j-=1
      else
        c+=1
        a[i]=a[j]=nil
        i+=1
        j-=1
      end
    end
  end
}
p c


Measured memory_bytes: 17528
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;

//// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt"
int main() {
	while(1){
	int N; cin >> N;
	if (!N)break;
		bool ok = false;
		int type = 0;
		for (int i = 0; i < N; ++i) {
			int k; cin >> k;
			if (k)type++;
			if (k >= 2)ok = true;
		}
		if (ok) {
			cout << type + 1 << endl;
		}
		else {
			cout << "NA" << endl;
		}
	}
	
	return 0;
}

Measured memory_bytes: 3080
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::*;
use proconio::{input, fastout, marker::*};

#[fastout]
fn main() {
  input!{
    n:usize,
    a:[u64;n]
  }
  let mut m = a[0];
  let mut ans = 0;
  for i in 1..n {
      if a[i] < m {
        ans += m-a[i];
      } else {
        m = a[i];
      }
  }
  println!("{}",ans);
}


Measured memory_bytes: 5604
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
//constexpr int MOD=1000000007;
constexpr int MOD=998244353;
#define INF (1<<30)
#define LINF (lint)(1LL<<56)
#define endl "\n"
#define rep(i,n) for(lint (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(lint (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
#define plint pair<lint,lint>
#define fi first
#define se second
typedef long long lint;
int dx[8]={1,1,0,-1,-1,-1,0,1};
int dy[8]={0,1,1,1,0,-1,-1,-1};
const int MAX_N=2e5+5;

int main(void){
    char C;
    cin >> C;
    int num=C-'A';
    if(num>=0 && num<=25) cout << "A" << endl;
    else cout << "a" << endl;
}

Measured memory_bytes: 3644
#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_C main
#include "bits/stdc++.h" 
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LONG_MAX/2)
const int MGN = 8;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
// functions
bool second_greater(const pii& left, const pii& right) {
    return left.second > right.second;
}
#endif


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

    int N;  cin >> N;
    vi C(N - 1), S(N - 1), F(N - 1);
    REP(i, N - 1) cin >> C[i] >> S[i] >> F[i];

    REP(i, N-1) {
        int t = S[i] + C[i];
        FOR(j, i+1, N-1) {
            int next = S[j];
            while(true) {
                if (t <= next) break;
                next += F[j];
            }
            t = next + C[j];
        }
        cout << t << endl;
    }

    cout << 0 << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cmath>
#include<math.h>
#include<array>
#include<algorithm>
#include<queue>
//#include<deque>
#include<vector>
//#include<utility>
//#include<set>
#include<map>
//#include<list>
#include<bitset>
#include<iomanip>

using namespace std;
using LLI = long long int;
LLI N;

//array<int, 8>dir_x = { 0,0,1,1,1,-1,-1,-1 };
//array<int, 8>dir_y = { 1,-1,1,0,-1,1,0,-1 };
//array<int, 4>dir_x2 = { 0,0,1,-1 };
//array<int, 4>dir_y2 = { 1,-1,0,0 };
//char alp[] = { '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' };

//class UnionFind {
//public:
//	vector<int>data;
//	UnionFind(int size) :data(size, -1) {};
//	bool unionset(int x, int y) {
//		x = root(x), y = root(y);
//		if (x != y) {
//			if (data[y] < data[x]) {
//				swap(x, y);
//			}
//			data[x] += data[y];
//			data[y] = x;
//		}
//		return x != y;
//	}
//	bool findset(int x, int y) {
//		return root(x) == root(y);
//	}
//	int root(int x) {
//		return data[x] < 0 ? x : data[x] = root(data[x]);
//	}
//	int size(int x) {
//		return -data[root(x)];
//	}
//};

//LLI gcd(LLI x, LLI y) {
//	LLI  r;
//	if (x < y) {
//		swap(x, y);
//	}
//	r = x % y;
//	while (r != 0) {
//		x = y;
//		y = r;
//		r = x % y;
//	}
//	return y;
//}
//LLI lcm(LLI x, LLI y) {
//	return x / gcd(x, y) * y;
//}

//long nCr(int n, int r) {
//	long ans = 1;
//	for (int i = n; i > n - r; i--) {
//		ans = ans * i;
//	}
//	for (int i = 1; i < r + 1; i++) {
//		ans = ans / i;
//	}
//	return ans;
//}
//long nHr(int n,int r) {
//	n = n + r - 1;
//	return nCr(n,r);
//}

//const int n_max = 8;
//array<array<bool, n_max>, n_max>graph;
//int dfs(int v,int N,array<bool,n_max>visited) {
//	int ret = 0;
//	bool all_visited = true;
//	for (int i = 0; i < N;i++) {
//		if (visited[i] == false) {
//			all_visited = false;
//		}
//	}	
//	if (all_visited) {
//		return 1;
//	}
//	for (int i = 0; i < N;i++) {
//		if (graph[v][i] == false) {
//			continue;
//		}
//		if (visited[i] == true) {
//			continue;
//		}
//		visited[i] = true;
//		ret += dfs(i,N,visited);
//		visited[i] = false;
//	}
//	return ret;
//}

//vector<vector<int>>sub;
//int dfs(int id) {
//	if (sub[id].size() == 0) {
//		return 1;
//	}
//	int minP = (int)1e9;
//	int maxP = 0;
//	for (int i : sub[id]) {
//		int P = dfs(i);
//		minP = min(minP, P);
//		maxP = max(maxP, P);
//	}
//	return minP + maxP + 1;
//}

//#define debug(x) cerr << #x << " : " << x << endl
//#define debugv(x) cerr << #x << " : "; for(auto i:x) cerr << i << ", "; cerr<<endl

int main(void) {
	LLI N, le = 0, ri = 0, cnt = 0;
	bool res = true;
	cin >> N;
	vector<LLI>vec(N);
	for (int i = 0; i < N; i++) {
		cin >> vec[i];
	}
	for (int i = 0; i < N - 1; i++) {
		if (vec[i] > vec[i + 1] && cnt == 1) {
			ri = i + 1;
		}
		if (vec[i] > vec[i + 1] && cnt == 0) {
			le = i;
			cnt++;
		}
	}
	swap(vec[le], vec[ri]);
	for (int i = 0; i < N - 1;i++) {
		if (vec[i] > vec[i + 1]) {
			res = false;
		}
	}
	if (res) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
}

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

d = {}
for i in range(N):
  if(A[i] not in d):
    d[A[i]] = 1
  else:
    d[A[i]] += 1
cnt = 0
for k, v in d.items():
  if(k != v):
    if(k > v):
      cnt += v
    else:
      cnt += v - k
print(cnt)

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

int main() {
  int n;
  //string s;
  cin >> n;
  vector<int> p(n);
  //cout << n << endl;
  for(int i = 0; i < n; i++) {
    cin >> p.at(i);
  }
  //cout << p.at(0) << endl;

  int count = 0;
  for(int i = 0; i < n-2; i++) {
    if(p.at(i+1) > p.at(i) && p.at(i+1) < p.at(i+2))
      count++;
    else if(p.at(i+1) < p.at(i) && p.at(i+1) > p.at(i+2))
      count++;
  }

    cout << count << endl;
  //else
    //cout << "No" << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int a[16384];
int md[8192];
void fft()
{
	int k=0;
	for(int i=1;i<16384;i<<=1)
	{
		for(int j=0;j<16384;j++)
		{
			if(j&i)
			{
				int t=(long long)a[j]*md[(j&(i-1))<<(13-k)]%998244353;
				a[j]=(a[j-i]-t+998244353)%998244353;
				a[j-i]=(a[j-i]+t)%998244353;
			}
		}
		k++;
	}
}
int tmp[16384];
int rv[16384];
int jc[16384],injc[16384];
int dp[16384];
int main()
{
	md[0]=1;
	for(int i=1;i<8192;i++)
	{
		md[i]=(long long)md[i-1]*666702199%998244353;
	}
	rv[0]=0;
	for(int i=1;i<16384;i++)
	{
		rv[i]=rv[i>>1]>>1;
		if(i&1)
		{
			rv[i]+=8192;
		}
	}
	int n,m;
	scanf("%d%d",&n,&m);
	injc[1]=1;
	for(int i=2;i<=n+2;i++)
	{
		injc[i]=(long long)998244353/i*injc[998244353%i]%998244353;
		injc[i]=998244353-injc[i];
	}
	jc[0]=1;
	injc[0]=1;
	for(int i=1;i<=n+2;i++)
	{
		jc[i]=(long long)jc[i-1]*i%998244353;
		injc[i]=(long long)injc[i-1]*injc[i]%998244353;
	}
	dp[0]=1;
	while(m--)
	{
		for(int i=0;i<16384;i++)
		{
			if(rv[i]>n)
			{
				a[i]=0;
			}
			else
			{
				a[i]=(long long)dp[rv[i]]*injc[rv[i]]%998244353;
			}
		}
		fft();
		for(int i=0;i<16384;i++)
		{
			tmp[i]=a[i];
			if(rv[i]>n||rv[i]==0)
			{
				a[i]=0;
			}
			else
			{
				a[i]=injc[rv[i]+2];
			}
		}
		fft();
		for(int i=0;i<16384;i++)
		{
			tmp[i]=(long long)tmp[i]*a[i]%998244353;
		}
		for(int i=0;i<16384;i++)
		{
			a[i]=tmp[rv[i]];
		}
		fft();
		for(int i=0;i<=n;i++)
		{
			dp[i]=(long long)dp[i]*(i*(i+1)/2+1)%998244353;
			int inc=(long long)a[(16384-i)&16383]*998183425%998244353;
			dp[i]+=(long long)inc*jc[i+2]%998244353;
			if(dp[i]>=998244353)
			{
				dp[i]-=998244353;
			}
		}
	}
	int answer=0;
	for(int i=0;i<=n;i++)
	{
		int inc=(long long)dp[i]*jc[n]%998244353;
		inc=(long long)inc*injc[i]%998244353;
		inc=(long long)inc*injc[n-i]%998244353;
		answer+=inc;
		if(answer>=998244353)
		{
			answer-=998244353;
		}
	}
	printf("%d\n",answer);
	return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
    ll i,j,k,l,m,n,o,p,q,r,t,a[100001]={0};
    cin>>n;
    string ans="";
    while(n!=0)
    {
        k=(n-1)%26;
        ans+=(char)(k+97);
        n=(n-1)/26;
    }
    reverse(ans.begin(),ans.end());
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3628
/*
int j = n-1;
        while(j > i)
        {
            if(a[j-1] > a[j])
                {
                    swap(a[j-1], a[j]);
                    cnt++;
                }
            j--;
        }
 For(k,0,n)
        if(k)
            cout<<" "<<a[k];
        else
            cout<<a[k];
        Prs("");
        int key=a[i];
        int j=i-1;
        while(j>=0&&key<a[j])
        {
            a[j+1]=a[j];
            j--;
        }
        a[j+1]=key;

    }
    For(k,0,n)
    if(k)
        cout<<" "<<a[k];
    else
        cout<<a[k];
    Prs("");
int minn=-1;
    int maxx=-INF;
    For(i,0,n)
    Sci(a[i]);
    minn=a[0];
    For(i,1,n)
    {
        //int tmp;
        //Sci(tmp);
        if(a[i]-minn>maxx)
        {
            maxx=a[i]-minn;
        }
        minn=min(minn,a[i]);
    }
    Pri(maxx);
*/
#include <map>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <cmath>
#include <ctime>
#include <string>
#include <limits>
#include <cstdio>
#include <vector>
#include <iomanip>
#include <cstdlib>
#include <cstring>
#include <istream>
#include <iostream>
#include <algorithm>
#define ci cin
#define co cout
#define el endl
#define Scc(c) scanf("%c",&c)
#define Scs(s) scanf("%s",s)
#define Sci(x) scanf("%d",&x)
#define Sci2(x, y) scanf("%d%d",&x,&y)
#define Sci3(x, y, z) scanf("%d%d%d",&x,&y,&z)
#define Scl(x) scanf("%I64d",&x)
#define Scl2(x, y) scanf("%I64d%I64d",&x,&y)
#define Scl3(x, y, z) scanf("%I64d%I64d%I64d",&x,&y,&z)
#define Pri(x) printf("%d\n",x)
#define Prl(x) printf("%I64d\n",x)
#define Prc(c) printf("%c\n",c)
#define Prs(s) printf("%s\n",s)
#define For(i,x,y) for(int i=x;i<y;i++)
#define For_(i,x,y) for(int i=x;i<=y;i++)
#define FFor(i,x,y) for(int i=x;i>y;i--)
#define FFor_(i,x,y) for(int i=x;i>=y;i--)
#define Mem(f, x) memset(f,x,sizeof(f))
#define LL long long
#define ULL unsigned long long
#define MAXSIZE 200005
#define INF 0x3f3f3f3f

const int mod=1e9+7;
const double PI = acos(-1.0);

using namespace std;

int main()
{
    int a[MAXSIZE];
    int n;
    Sci(n);
    For(i,0,n)
    Sci(a[i]);
    int cnt = 0;
    For(i, 0, n)
    {
        int minn = i;
        For(j, i + 1, n)
        if(a[minn] > a[j])
            minn = j;
        if(minn != i)
        {
            swap(a[i], a[minn]);
            cnt++;
        }
    }
    For(i, 0, n)
    i==0?cout<<a[i]:cout<<" "<<a[i];
    Prs("");
    Pri(cnt);
    return 0;
}



Measured memory_bytes: 3224
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
inline int read()
{
	int x = 0 , f = 1; char ch = getchar();
	while(ch < '0' || ch > '9')	{if(ch == '-')	f = -1; ch = getchar();}
	while(ch >= '0' && ch <= '9') {x = (x << 3) + (x << 1) + (ch ^ 48); ch = getchar();}
	return x * f;
}
const int N = 2e5 + 5;
int n , top;
int a[N];
struct node
{
	int v , c;
	node(int v = 0,int c = 0) : v(v) , c(c) {}
} st[N];
void insert(int v,int x)
{
	while(st[top].v > v) top --;
	if(st[top].v == v) st[top].c ++;
	else st[++ top] = node(v,1);
	if(top > 1 && st[top].c == x) top -- , insert(v - 1,x);
}
inline bool check(int mid)
{
	st[top = 1] = node();
	for(int i = 2;i <= n;i ++) if(a[i] <= a[i - 1]) insert(a[i],mid);
	return st[1].c == 0;
}
int main()
{
	n = read(); a[1] = read(); int cnt = 0;
	for(int i = 2;i <= n;i ++) a[i] = read() , cnt += a[i] <= a[i - 1];
	if(!cnt) return puts("1") , 0;
	int l = 2 , r = n , ans = 0;
	while(l <= r)
	{
		int mid = (l + r) >> 1;
		if(check(mid)) ans = mid , r = mid - 1;
		else l = mid + 1;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 2688
import sys

def main():
    sinputl = sys.stdin.readline

    num_skewer = int(sinputl().strip())
    input = [int(x) for x in sinputl().split()]
    input.sort()

    count = 0

    for i in range(num_skewer):
        count += input[i * 2]

    print(count)


if __name__ == "__main__":
    main()

Measured memory_bytes: 3060
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#include<set>
#include<complex>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define CC puts("-------ok--------");
#define all(in) in.begin(), in.end()
#define bv vector<bool>
using namespace std;
typedef pair<int, int>PA;
using namespace std;
#define MAX 1000
int main(){
    int n; cin>>n;
    PA hoge; hoge.second=-INF;
    int a,b;
    rep(i,n){cin>>a>>b;if(b>hoge.second){hoge.second=b;hoge.first=a;}
            else if(hoge.second==b&&hoge.first>a)hoge.first=a;};
    cout<<hoge.first<<" "<<hoge.second<<endl;
}

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

using namespace std;

class Segment { 
public:
	int u, v, distance; 
};


int point[101];
int height[101];
Segment arr[10001];

int find(int root) {
	while (root != point[root]) {
		root = point[root];
	}
	return root;
}

bool unit(int x, int y) {
	x = find(x);
	y = find(y);
	if (x == y) {
		return false;
	}

	if (height[x]<height[y]) {
		point[x] = y;
	}
	else {
		point[y] = x;
		if (height[x] == height[y]) {
			height[x]++;
		}
	}
	return true;
}


bool comp(const Segment& e1, const Segment& e2) {
	return e1.distance < e2.distance;
}

int kruskal(int n, int m) {
	sort(arr, arr + m, comp);
	for (int i = 0; i < n; i++) {
		point[i] = i;
		height[i] = 1;
	}

	int sum = 0, cnt = 0;
	for (int i = 0; i < m; i++) {
		if (cnt == n - 1) {
			break;
		}
		if (unit(arr[i].u, arr[i].v)) {
			sum += arr[i].distance;
			cnt++;
		}
	}
	return sum / 100 - cnt;
}

int main(void) {
	int n, m;
	while (cin >> n, n) {
		cin >> m;
		for (int i = 0; i < m; i++)
			scanf("%d,%d,%d", &arr[i].u, &arr[i].v, &arr[i].distance);
		cout << kruskal(n,m) << endl;
	}
	return 0;
}


Measured memory_bytes: 3224
#include<bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp> 
//using namespace boost::multiprecision; 
using namespace std;
#define ll long long int
#define ld long long double
#define vi vector<int>
#define vl vector<ll>
#define pi pair<int, int>
#define pl pair<ll, ll>
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define nl '\n'
#define mp make_pair
#define debug1(x) cout <<#x<<" "<<x<<'\n';
#define debug2(x,y) cout <<#x<<" "<<x <<" "<<#y<<" "<<y <<'\n';
#define debug3(x,y,z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<'\n';
#define fi first
#define se second
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define inf 1e18
const int mod = (int)1e9+7;
pair<ll,ll>s4[4]={{-1,0},{1,0},{0,-1},{0,1}};
pair<ll,ll>s8[8]={{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,1},{1,0},{1,-1}};

void solve() {
	double s;
	cin >> s;
	double x = s/3;
	double vol = x*x*x;
	cout << fixed << setprecision(12) <<vol <<endl;
}

signed main() {
	boost;
	solve();
}

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

int main() {
  int s,s1, s2, s3;
  cin >> s;
  s1 = s/100;
  s2 = (s- s1 * 100)/10;
  s3 = s- s1 *100 - s2 *10;
  cout << s1 + s2 + s3 << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int maxn=1e5+10;
string p;
int main() {
	long long n,ans=0;
	ios::sync_with_stdio;
	cin.tie(0),cout.tie(0);
	cin>>n;
	map<string,int>q;
	for(int i=1; i<=n; i++) {
		cin>>p;
		sort(p.begin(),p.end());
		ans+=q[p];
		q[p]++;
	}
	cout<<ans<<"\n";
	return 0;
}

Measured memory_bytes: 11136
#include<iostream>
using namespace std;
int main()
{
	long long i,j,ans=11,k,n,p;
	cin>>n;	
	for(i=1;i*i<=n;i++)
	{
		if(n%i==0)
		{
			j=n/i;
			p=j;
			k=0;
			while(p>0)
			{
				p=p/10;
				k++;
			}
			if(k<ans)
			{
				ans=k;
			}
		}
	}
	cout<<ans<<endl;
	return 0;
} 

Measured memory_bytes: 256
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)

typedef int long long ll;
const static int N=1000;
ll tt[200002];
ll sm[200002];
int main(){
    ll n;
    ll c;
    cin>>n>>c;
    ll s[n],t[n],cc[n];
    for(ll i=0;i<n;i++){
        cin>>s[i]>>t[i]>>cc[i];
        
    }
    
    
    for(int j=1;j<=c;j++){
        
        rep(i,200002)tt[i]=0;
        for(int i=0;i<n;i++){
            if(cc[i]==j){
                tt[2*s[i]-1]++;
                tt[2*t[i]]--;
            }
        }
        for(int i=1;i<200002;i++){
            tt[i]+=tt[i-1];
        }
        for(int j=0;j<200002;j++){
            if(tt[j]>0)sm[j]++;
        }
    }
    int ans=max_element(sm,sm+200002)-sm;
    cout<<sm[ans]<<endl;
    
    
    return 0;
}


Measured memory_bytes: 5760
#include<stdio.h>

int main(void)
{
	int a,b;
	
	scanf("%d %d",&a,&b);
	
	if(a>b)
	{
		printf("a > b\n");
	}
	else if(a<b)
	{
		printf("a < b\n");
	}
	else printf("a == b\n");
		
	return 0;
		
}
	

Measured memory_bytes: 2592
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int ans = 0;
		int color = 0;
		int cnt = 1;
		for (int i = 0; i < n; i++) {
			int a = sc.nextInt();
			if (color == a) {
				cnt++;
			} else {
				ans += cnt / 2;
				cnt = 1;
			}
			color = a;
			if (i == n - 1)
				ans += cnt / 2;
		}

		System.out.println(ans);

		sc.close();
	}

}


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

int main() {
	int n;
    cin >> n;
    vector<ll> sums(n), diffs(n);;
    for (int i = 0; i < n; ++i) {
        ll xi, yi;
        cin >> xi >> yi;
        sums[i] = xi + yi;
        diffs[i] = xi - yi;
    }
    sort(sums.begin(), sums.end());
    sort(diffs.begin(), diffs.end());
    ll ans = sums[n-1] - sums[0];
    ans = max(ans, diffs[n-1] - diffs[0]);
    
    cout << ans << endl;
}


Measured memory_bytes: 6424
// Break Number
#include <iostream>
#include <algorithm>
using namespace std;

int main() {
    int N;
    int ma = 1;
    int max_mod = 0;
    cin >> N;
    for (int i = 1; i <= N; i++) {
        int n = i;
        int n_mod = 0;
        while (n / 2 != 0) {
            n = n / 2;
            n_mod++;
        }
        if (max_mod < n_mod) {
            max_mod = n_mod;
            ma = i;
        }
    }
    cout << ma << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		System.out.print(a/b+" "+a%b+" ");
		System.out.println(String.format("%.5f",1.00000*a/b));
	}	
}


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

#include <stack>
#include <queue>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <numeric>
#include <string>
#include <array>

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(x) x.begin(), x.end()

using namespace std;
typedef long long int ll;

int main() {
  ll n;
  cin >> n;
  vector<ll> a(n), b(n), ansv;
  rep(i, n) cin >> a.at(i);
  size_t leng = a.size();

  sort(all(a));
  b=a;
  b.erase(unique(all(b)), b.end());
  map<ll,ll> cnt;
  for (auto i: b) cnt[i]=0;

  rep(i, n) ++cnt[a.at(i)];
  for (auto i :b)
    if(cnt[i]>=i) ansv.push_back(i);


  ll sum=0;
  for (auto i: ansv) sum += i;
  cout << leng - sum << endl;
  return 0;
}

Measured memory_bytes: 7808
#include <iostream>
#define MAX 100001

using namespace std;
typedef long long ll;

ll k,a[MAX],st,dr,m,r;
ll ver(ll ch){
  for(ll i=1;i<=k;i++){
    if(ch<a[i])return 1;
    ch-=ch%a[i];
  }
  if(ch>2)return 2;
  if(ch<2)return 1;
  return 0;
}

int main()
{
    cin>>k;
    for(ll i=1;i<=k;i++)cin>>a[i];
    st=1,dr=100000000000000000LL;
    while(st<dr){
      m=(st+dr)/2;
      r=ver(m);
      if(r==0)dr=m;
      else if(r==1)st=m+1;
      else dr=m-1;
    }
    if(ver(st)!=0){
      cout<<-1;
      return 0;
    }
    cout<<st<<" ";
    st=1,dr=100000000000000000LL;
    while(st<dr){
      m=(st+dr+1)/2;
      r=ver(m);
      if(r==0)st=m;
      else if(r==1)st=m+1;
      else dr=m-1;
    }
    cout<<st;
    return 0;
}


Measured memory_bytes: 1024
n = int(input())
lis = list(map(int,input().split()))
#print(n,lis)  

num = 0
for i in range(n):
  for j in range(n):
    for k in range(n):
      a = lis[i]
      b = lis[j]
      c = lis[k]
      if a == b or b ==c or c==a:
        continue
      else:
        if a >= b + c or b >= a + c or c >= b + a:
          continue
        else:
          num += 1
print(int(num/6))
       
      

Measured memory_bytes: 9196
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = (int)(a); i <= (int)(n); ++i)
#define rrep(i, a, n) for (int i = (int)(a); i >= (int)(n); --i)
#define debug(x) cerr << #x << " = " << x << "\n"
#define debugv(x) \
  rep(f, 0, (x.size() - 1)) cerr << x[f] << (f == (x.size() - 1) ? "\n" : " ")
#define all(x) x.begin(), x.end()
#define int long long
using namespace std;
typedef pair<int, int> pii;
typedef vector<int> vi;
const int MX = 1e5 + 5, INF = 5 << 28, MOD = 1e9 + 7;

int N, C;
typedef tuple<int, int, int> ti;

vector<ti> V;

void input() {
  int x, y, z;
  cin >> N >> C;
  V.resize(N);
  rep(i, 0, N - 1) {
    cin >> x >> y >> z;
    V[i] = tie(x, y, z);
  };
}
void solve() {

  vector<ti> vv = V;
  sort(vv.begin(), vv.end(), [](const ti &a, const ti &b) {
    return (get<2>(a) == get<2>(b) ? get<1>(a) < get<1>(b)
                                   : get<2>(a) < get<2>(b));
  });
  // for (auto X : vv) {
  //   int x, y, z;
  //   tie(x, y, z) = X;
  //    cout << x << " " << y << " " << z << endl;
  // };

  rep(i,0,N-2){
    int a,b,c;
    tie(a,b,c) = vv[i];
    int aa,bb,cc;
    tie(aa,bb,cc) = vv[i+1];
    if (c==cc && b==aa){
      get<0>(vv[i+1])=a;
      vv[i] = make_tuple(INF,INF,INF);
    }
  }
  // for (auto X : vv) {
  //   int x, y, z;
  //   tie(x, y, z) = X;
  //    cout << x << " " << y << " " << z << endl;
  // };
  vector<ti> V2 = vv;
  V = vv;
  sort(V2.begin(), V2.end(),
       [](const ti &a, const ti &b) { return get<0>(a) < get<0>(b); });
  sort(V.begin(), V.end(),
       [](const ti &a, const ti &b) { return get<1>(a) < get<1>(b); });



  // for (auto p : vv) {
  //   int x, y, z;
  //   tie(x, y, z) = p;
  //   cout << x << " " << y << " " << z << endl;
  // }

  auto itstart = V2.begin();
  auto itend = V.begin();

  int ans = 0, cnt = 0;
  rep(i, 0, MX ) {
    while (get<0>(*itstart) == i) {
      cnt++;
      itstart++;
    }
    while (get<1>(*itend) == i - 1) {
      cnt--;
      itend++;
    }
    ans = max(cnt, ans);
  }

  cout << ans << endl;

  ;
}
signed main() {
  input();
  solve();
  return 0;
}

Measured memory_bytes: 7296
//#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<set>
#include<map>

/*
#include<boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/rational.hpp>
namespace mp = boost::multiprecision;
using Real = mp::number<mp::cpp_dec_float<1024>>;
using Bint = mp::cpp_int;
*/

using namespace std;

#define int long long
#define REP(i,s,e) for((i)=(s);(i)<(e);(i)++)
#define RREP(i,s,e) for((i)=((s)-1);(i)>=(e);(i)--)
#define FOR(i,n) for((i)=(0);(i)<(n);(i)++)
#define RFOR(i,n) for((i)=((n)-1);(i)>=(0);(i)--)
#define MOD 1000000007


signed main(){
    int A,B,C;
    cin>>A>>B>>C;
    swap(A,B);
    swap(A,C);
    cout<<A<<" "<<B<<" "<<C<<endl;
}


Measured memory_bytes: 3596
#include <stdio.h>
int main(void) {
	int a, b, c, d ,goukei, x, y;
	scanf("%d %d %d %d",&a,&b,&c,&d);
	goukei = a+b+c+d;
	x = goukei / 60;
	y = goukei % 60;
	printf("%d\n%d\n",x,y);
	
	
	
	return 0;
}

Measured memory_bytes: 596
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstring>
#include <climits>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

constexpr ll INF = 1e18;
constexpr ll MOD = 1e9 + 7;
constexpr double PI = 3.14159265358979323846;
constexpr int di[] = {0, 0, 1, -1};
constexpr int dj[] = {1, -1, 0, 0};

void outYesOrNo(bool res)
{
    cout << (res ? "Yay!" : ":(") << endl;
}

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

    int n;
    string s;

    cin >> n >> s;

    int res = 0;

    for (char a = '0'; a <= '9'; a++)
        for (char b = '0'; b <= '9'; b++)
            for (char c = '0'; c <= '9'; c++)
            {
                int y = 0;
                for (int i = 0; i < n; i++)
                {
                    if (y == 0 && (char)s[i] == a)
                        y++;
                    else if (y == 1 && (char)s[i] == b)
                        y++;
                    else if (y == 2 && (char)s[i] == c)
                        y++;
                }

                res += (y == 3);
            }

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 384
[<AutoOpen>]
module Program

open System

let read f = stdin.ReadLine() |> f
let reada f = stdin.ReadLine().Split() |> Array.map f
let reads f = stdin.ReadLine().Split() |> Array.toList |> List.map f

let inline gcd x y =
    let zero = LanguagePrimitives.GenericZero
    let rec loop x y = if y = zero then x else loop y (x % y)
    loop (abs x) (abs y)

#nowarn "40"
let rec primes =
    let rec loop n = seq {
        yield! List.filter isPrime [6L * n - 1L; 6L * n + 1L]
        yield! loop (n + 1L)
    }
    seq {
        yield! [2L; 3L]
        yield! loop 1L
    }
    |> Seq.cache
and isPrime n =
    let ps = Seq.takeWhile (fun x -> x * x <= n) primes
    Seq.forall (fun x -> n % x <> 0L) ps

let factorize n =
    let mutable m = n
    seq {
        for p in Seq.takeWhile (fun x -> x * x <= n) primes do
            while m % p = 0L do
                m <- m / p
                yield p
        if m > 1L then yield m
    }

[<EntryPoint>]
let main _ =
    let [a;b] = reads int64
    let g = gcd a b
    factorize g
    |> Set.ofSeq
    |> Set.count
    |> (+) 1
    |> printfn "%i"
    0

Measured memory_bytes: 20904
#include <bits/stdc++.h>
using namespace std;
const int NMAX = 1e5+7;
int a,b,c,res;
int get (int _a, int _b, int _c){
  int ret= max(_a*10+_b+_c, _a+_b*10+_c);
  // printf("get(%d,%d,%d) = %d\n", _a, _b, _c, ret);
  return ret;
}
int main(){
  std::cin >> a >> b >> c;
  res = get(a,b,c);
  res = max(res, get(a,c,b));
  res = max(res, get(b,a,c));
  res = max(res, get(b,c,a));
  res = max(res, get(c,a,b));
  res = max(res, get(c,b,a));
  std::cout << res << '\n';
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define MAX_N 40
#define INF 100000000
#define MOD 1000000007
#define RANK 1000000000
#define EPS 1e-10
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<double> vec;
typedef vector<vec> mat;

vec gauss_jordan(const mat& A, const vec& b){
    int n = A.size();
    mat B(n, vec(n+1));
    rep(i,n) rep(j,n) B[i][j] = A[i][j];
    rep(i,n) B[i][n] = b[i];
    rep(i,n){
        int pivot = i;
        for(int j = i; j < n; j++){
            if(abs(B[j][i]) > abs(B[pivot][i])) pivot = j;
        }
        swap(B[i],B[pivot]);
        if(abs(B[i][i]) < EPS) return vec();
        for(int j = i+1; j <= n; j++) B[i][j] /= B[i][i];
        rep(j,n){
            if(i != j){
                for(int k = i+1; k <= n; k++) B[j][k] -= B[j][i]*B[i][k];
            }
        }
    }
    vec x(n);
    rep(i,n) x[i] = B[i][n];
    return x;
}

int n, s, t;
bool q[100];
int e[100][100];
int dist[100];

void solve(){
    s--; t--;
    rep(i,n) cin >> q[i];
    rep(i,n) rep(j,n) cin >> e[i][j];
    rep(i,n) dist[i] = INF;
    dist[t] = 0;
    priority_queue<P, vector<P>, greater<P> > que;
    que.push(P(0,t));
    while(!que.empty()){
        P p = que.top();
        que.pop();
        if(dist[p.second] < p.first) continue;
        rep(i,n){
            if(e[i][p.second] == 0) continue;
            if(dist[i] > dist[p.second]+e[i][p.second]){
                dist[i] = dist[p.second]+e[i][p.second];
                que.push(P(dist[i],i));
            }
        }
    }
    if(dist[s] == INF){
        cout << "impossible" << endl;
        return;
    }
    rep(i,n){
        if(!q[i]) continue;
        if(i == t) continue;
        int mi = INF;
        rep(j,n){
            if(e[i][j] == 0) continue;
            mi = min(mi,dist[j]+e[i][j]);
        }
        rep(j,n){
            if(e[i][j] == 0) continue;
            if(dist[j]+e[i][j] != mi) e[i][j] = 0;
        }
    }
    mat A(n,vec(n,0));
    vec b(n,0);
    rep(i,n){
        int cnt = 0;
        int sum = 0;
        if(i == t){
            A[i][i] = 1.0;
            continue;
        }
        rep(j,n){
            if(e[i][j] == 0) continue;
            cnt++;
            sum += e[i][j];
            A[i][j] = -1.0;
        }
        A[i][i] += cnt; b[i] = sum;
    }
    /*
    rep(i,n){
        rep(j,n) cout << A[i][j] << " ";
        cout << endl;
    }
    rep(i,n) cout << b[i] << " ";
    cout << endl;
    */
    vec ans = gauss_jordan(A,b);
    printf("%.10f\n",ans[s]);
}

int main(){
    while(cin >> n >> s >> t){
        if(n == 0 && s == 0 && t == 0) break;
        solve();
    }
}

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

int main(){
    string o, e;
    cin >> o >> e;

    for(int i=0; i<e.length(); i++){
        cout << o[i] << e[i];
    }
    if(o.length() != e.length()) cout << o[o.length()-1];
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Diagnostics;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        HashSet<int> hsTable = new HashSet<int>();
        for (int i = 0; i < n; i++)
        {
            hsTable.Add(int.Parse(Console.ReadLine()));
        }
        Console.WriteLine(hsTable.Count);
    }
}

Measured memory_bytes: 13396
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <bitset>
#include <cassert>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define srep(i,n,m) for(int i=n;i<m;i++)
#define elif else if
#define INF 1000000007
#define pi 3.141592653589793
using namespace std;
int sdkys(int a,int b){
    if(b==0) return a;
    return sdkys(b,a%b);
}
int sskbs(int a,int b){
    return a*b/sdkys(a,b);
}
int n,m,cnt=0,aa[220000],ans=0,ab[220000];
pair<int,int> pp[220000];
string s,sa[220000];
char ca[220000];
queue<int> que;
signed main(){
    cin>>n>>m;
    while(1){
        cnt++;
        n*=2;
        if(n>m){
            cout<<cnt<<endl;
            return 0;
        }
    }
}

Measured memory_bytes: 10464
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <complex>
#include <queue>
#include <cmath>
#define FILL(a, n, x) memset((a), (x), sizeof ((a)[0]) * (n))
#define COPY(a, n, b) memcpy((b), (a), sizeof ((a)[0]) * (n))
using namespace std;

// const int mod = 1e9 + 7;
typedef long long li;

// inline int Add(int x) { return x >= mod ? x - mod : x; }
// inline void Add(int &x, int y) { x += y; if (x >= mod) x -= mod; }
// inline int Sub(int x) { return x < 0 ? x + mod : x; }
// inline void Sub(int &x, int y) { x -= y; if (x < 0) x += mod; }
// inline int Mul(int x, int y) { return (int)((li)x * y % mod); }
// inline int Mul(int x, int y, int z) { return Mul(x, Mul(y, z)); }

// int Pow(int x, int y) {
//   int z = 1;
//   for (; y; y >>= 1) {
//     if (y & 1) z = Mul(z, x);
//     x = Mul(x, x);
//   }
//   return z;
// }

// int Inv(int x) {
//   return Pow(x, mod - 2);
// }

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

typedef complex<double> Comp;

const int maxn = 3000;
const double pi = acos(-1);

int n, L;
Comp p[maxn];

int main(void) {
  scanf("%d%d", &n, &L);
  for (int i = 0; i < n; ++i) {
    int x;
    scanf("%d", &x);
    p[i] = {cos(pi * x / L), sin(pi * x / L)};
  }
  Comp ans = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = i + 1; j < n; ++j) {
      ans += p[i] * p[j] * (double)(n - j - 1);
      ans += p[i] * p[j] * (double)(i);
      ans -= p[i] * p[j] * (double)(j - i - 1);
    }
  }
  
  li way = (li)n * (n - 1) * (n - 2) / 6;
  ans /= way;
  printf("%.10lf %.10lf\n", ans.real(), ans.imag());
  return 0;
}


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

int main(){
    int N;
    cin >> N;
    double v[N];
    for(int i = 0; i < N; i++){
        cin >> v[i];   
    }
    sort(v, v + N);
    double ans = (v[0] + v[1]) / 2;
    for(int i = 2; i < N; i++){
        ans = (ans + v[i]) / 2;
    }
    cout << ans << endl;
}


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

//関数
//main関数
int main() {
    
    
    //入力
    long N;
    string S;
    cin>>N>>S;
    //計算
    
    long tempans=0,ans=0;
    for(int i=0;i<N;i++){
        if(S.at(i)=='.')tempans++;
    }
    
    ans=tempans;
    //cout<<tempans<<endl;
    for(int i=0;i<N;i++){
        if(S.at(i)=='.'){
            tempans--;
        }else{
            tempans++;
        }
        
        //cout<<tempans<<endl;
        
        ans=min(ans,tempans);
    }
    
    //出力
    cout<<ans<<endl;
}




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

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

    n %= 10;


    if (n == 3) {
        cout << "bon" << endl;
    }
    else if (n == 0 || n == 1 || n == 6 || n == 8) {
        cout << "pon" << endl;
    }
    else {
        cout << "hon" << endl;
    }
}

Measured memory_bytes: 3632
from collections import Counter
A1=list(map(int,input().split()))
A2=list(map(int,input().split()))
A3=list(map(int,input().split()))
A=[A1,A2,A3]
N=int(input())
for _ in range(N):
  b=int(input())
  #穴をあける
  for tmpA in A:
    if b in tmpA:
      index=tmpA.index(b)
      tmpA[index]=-1
      break
  
#bingoチェック
  
#たて
if A[0][0]==A[1][0] and A[1][0]==A[2][0] or A[0][1]==A[1][1] and A[1][1]==A[2][1] or A[0][2]==A[1][2]and A[1][2]==A[2][2]:
  print("Yes")
#よこ
elif len(Counter(A[0]))==1 or len(Counter(A[1]))==1 or len(Counter(A[2]))==1:
  print("Yes")
#ななめ
elif A[1][1]==-1 and (A[0][0] == A[2][2] or A[0][2]==A[2][0]):
  print("Yes")
#ダメ
else:
  print("No")

Measured memory_bytes: 3316