akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <complex>
#include <string.h>
#include <numeric>
using namespace std;

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

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

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

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

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



int n, s;

signed main() {
	while (1) {
		cin >> n >> s;
		if (n==0) break;
		int res = 0;
		rep(i,1<<10) if (__builtin_popcount(i)==n) {
			int sum = 0;
			rep(j,10) if (i>>j&1) sum += j;
			if (sum==s) res++;
		}
		cout << res << endl;
	}
}


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

int main(){
    vector<int>vec(3);
    for(int i = 0; i < 3 ;i++){
	    cin >> vec.at(i);
    }
    sort(vec.begin(), vec.end());
    
    for(int i = 0; i < 2;i++){
        cout << vec.at(i) << " ";
    }
    cout << vec.at(2)<<endl;
}


Measured memory_bytes: 3112
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main() {
   int n;
   cin>>n;
   int *arr=new int[n];
   for(int i=0;i<n;i++)cin>>arr[i];
   vector<ll> dp(n,0);
   if(n>=2)
    dp[1]=abs(arr[1]-arr[0]);
   for(int i=2;i<n;i++)
   {
       dp[i]=min(abs(arr[i]-arr[i-1])+dp[i-1],abs(arr[i-2]-arr[i])+dp[i-2]);
 
   }
  

   cout<<dp[n-1]<<"\n";
 
}
/*
10 30 40 20
0 20 (30+0,10+20) 30  
*/


Measured memory_bytes: 1408
// In the name of God
#include <bits/stdc++.h>

using namespace std;
#define Size(x) ((int)(x).size())
#define pb push_back
typedef long long ll;
typedef long double ld;
typedef pair<int,int>pii;
const int INF = 1e9 + 10;
const int MN = 1e5 + 10;

int n , arr[MN];

int main()
{
	ios_base :: sync_with_stdio(false) ,cin.tie(0) , cout.tie(0);
	cin >> n;
	for(int i=0;i<n;++i) cin >> arr[i];
	bool fl = false;
	if(n == 1){
		if(arr[0]&1) cout << "Second\n";
		else cout << "First\n";
		return 0;
	}
	while(1){
		if(*min_element(arr , arr+n) == 1){
			ll sm = 0;
			for(int i=0;i<n;++i) sm += arr[i];
			if((sm-n)%2){
				if(!fl) cout << "First\n";
				else cout << "Second\n";
			}else{
				if(!fl) cout << "Second\n";
				else cout << "First\n";
			}
			return 0;
		}
		int cnt = 0;
		for(int i=0;i<n;++i) if(arr[i]%2 == 0) ++cnt;
		if(cnt&1){
			if(fl) cout << "Second\n";
			else cout << "First\n";
			return 0;
		}else if(n-cnt > 1){
			if(fl) cout << "First\n";
			else cout << "Second\n";
			return 0;
		}
		if(*max_element(arr , arr+n) == 1){
			if(!fl) cout << "Second\n";
			else cout << "First\n";
			return 0;
		}
		for(int i=0;i<n;++i) if(arr[i]&1) arr[i]--;
		int g = -1;
		for(int i=0;i<n;++i){
			if(g == -1) g = arr[i];
			else g = __gcd(g , arr[i]);
		}
		for(int i=0;i<n;++i) arr[i]/=g;
		fl = !fl;
	}
	return 0;
}


Measured memory_bytes: 640
<?php
//error_reporting(0);
$N = trim(fgets(STDIN));
//list($A,$B,$C) =  explode(" ",trim(fgets(STDIN)));
//$B =  explode(" ",trim(fgets(STDIN)));

//1-0
//100-999
//10000-99999

$cnt=0;
for($i=1;$i<=$N;$i++) {
  $len = strlen($i);
  if (($len % 2) == 1) $cnt++;
}
printf("%d\n",$cnt);


Measured memory_bytes: 4728
arr=[]
for i in range(5):
	t=int(input())
	arr.append(t)
ans=0
arr2=[]
for i in range(5):
	if(arr[i]%10==0):
		ans+=arr[i]
	else:
		ans+=((arr[i]//10)+1)*10
		arr2.append(arr[i]%10)
if(len(arr2)>0):
	ans-=10
	ans+=min(arr2)
print(ans)






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

int main(){
    int a, b; cin >> a >> b;
    int cnt=1;
    int ans=0;

    while(cnt < b){
        cnt--;
        cnt += a;
        ans++;
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.*;

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

        int pura=0;
        for(int i=0; i<4; i++){               
            if(ss[i]=='+'){
             pura++;
}
}
             System.out.print(pura-(4-pura)); 	        
 	    }
}


Measured memory_bytes: 23764
# -*- coding: utf-8 -*-
input_line = input()
S,T = input_line.split(" ")
input_line = input()
tmpA,tmpB = input_line.split(" ")
Sval = int(tmpA)
Tval = int(tmpB)
U = input()

if(U == S):
  Sval = Sval - 1
elif(U == T):
  Tval = Tval - 1
print(Sval,Tval)

Measured memory_bytes: 3060
#define _USE_MATH_DEFINES
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<list>
#include<stack>
#include<queue>
#include<cctype>
#include<iomanip>
#include<functional>
#include<numeric>
#include<map>
#include<set>
#include<complex>
#define EPS 1e-10
using namespace std;
typedef long long llong;

int main() {

	int n;
	while (cin >> n&&n) {
		vector<pair<int, int> >team(n);
		int s, m, id;
		for (int j = 0; j < n; j++) {
			cin >> id;
			team[j].second = id;
			team[j].first = 0;
			for (int i = 0; i < 4; i++) {
				cin >> m >> s;
				team[j].first += 60 * m + s;

			}
		}
		sort(team.begin(), team.end());
		for (int i = 0; i < 2; i++) {
			cout << team[i].second << endl;
		}
		cout << team[n - 2].second << endl;
	}

	return 0;
}

Measured memory_bytes: 3092
using System;
using System.Linq;
using System.Collections.Generic;
class P {
    static void Main() {
        long a = long.Parse(Console.ReadLine());
        var b = new List<long>();
        for (int i = 0;i<a.ToString().Length-2;i++) {
            b.Add(a/(long)Math.Pow(10,i)-(a/(long)Math.Pow(10,i+3)*1000));
        }
        Console.WriteLine(b.Min(x=>Math.Abs(753-x)));
    }
}

Measured memory_bytes: 13396
# -*- coding: utf-8 -*-
H,W = map(int, input().split())

if H==1 or W==1:
  s = 1
elif H%2 == 0 or W%2 == 0:
  s = W*H//2
else:
  s = W*(H-1)//2+(W-1)//2+1

print(s)

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

using namespace std;

typedef long long ll;

int main()
{
#ifdef ONPC
    freopen("a.in", "r", stdin);
    //freopen("a.out", "w", stdout);
#else
    //freopen("a.in", "r", stdin);
    //freopen("a.out", "w", stdout);
#endif
    int n, c, k;
    cin >> n >> c >> k;
    vector <int> a(n);
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    sort(a.begin(), a.end());
    int go = a[0] + k;
    int cur = 1;
    int ans = 1;
    for (int i = 1; i < n; i++)
    {
        if (go < a[i] || cur == c)
        {
            cur = 1;
            go = a[i] + k;
            ans++;
        }
        else
        {
            cur++;
        }
    }
    cout << ans << '\n';
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
typedef long long ll;
long long mod = 2019;
const int iINF = 0x3f3f3f3f;
const long long INF = 1LL << 60;
using namespace std;

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

struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const { return mint(*this) += a; }
  mint operator-(const mint a) const { return mint(*this) -= a; }
  mint operator*(const mint a) const { return mint(*this) *= a; }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod - 2); }
  mint &operator/=(const mint a) { return *this *= a.inv(); }
  mint operator/(const mint a) const { return mint(*this) /= a; }
};

int main()
{
  string s;
  cin >> s;

  ll arr[200100] = {};
  ll count[3000] = {};

  int keta = 0;
  for (int i = s.size() - 1; i >= 0; i--)
  {
    struct mint m(10);
    struct mint tmp(s[i] - '0');
    int val = (tmp * m.pow(keta)).x;
    arr[i] = (arr[i + 1] + val) % 2019;
    count[arr[i]]++;
    keta++;
  }

  ll ans = 0;
  rep(i, 2019)
  {
    if (i == 0)
    {
      if (count[i] == 0)
        continue;
      if (count[i] == 1)
      {
        ans++;
        continue;
      }
      ans += ((count[i] + 1) * count[i]) / 2;
      continue;
    }

    ans += (count[i] * (count[i] - 1)) / 2;
  }

  cout << ans << endl;

  return 0;
}


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

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long int x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define fl long double
#define pb push_back
#define mk make_pair
#define endl "\n"
#define ff first
#define ss second
#define mt make_tuple
#define np next_permutation
#define mod 998244353
#define pi 3.141592653589793238
ll power(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b){if(a<b) return gcd(b,a);if(b==0) return a;return gcd(b,a%b);}

int main()
{
    fastio;
    ll i,j,k,n,m,t;
    fl a,b;
    cin>>a>>b;
    fl ans=0;
    ans=a*b;
    long long an=ans;
    cout<<an<<endl;
    return 0;
}


Measured memory_bytes: 3816
#include <bits/stdc++.h>
using namespace std;
 
#define FAST ios_base::sync_with_stdio(0); cin.tie(); cout.tie();
 
#define MAXX 100005
 
#define PI   3.14159265358979323846264338327950

#define PB push_back 
#define F first
#define S second
 
#define ll 	 long long int

#define mod  1000000007





int main()
{
	FAST;
	ll n;
	cin >> n;
	ll a = n;
	ll sum = 0;
	while(a > 0){
		sum += a% 10;
		a /= 10;
	}
	if(n % sum == 0){
		cout << "Yes";
		return 0;
	}
	cout << "No";
	return 0;
}

Measured memory_bytes: 3672
#include<bits/stdc++.h>
using namespace std;
#define forr(i,a,n)	for(long long int i=a; i<n; i++)
#define loop(i,a,n)	for(long long int i=a; i>=n; i--)
 
int main() 
{	
	ios_base :: sync_with_stdio(false),cin.tie(NULL),cout.tie(0);
 
	string s,t;
	cin>>s;
	forr(i,0,s.size())	cout<<'x';
	
	return 0;	
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//#pragma once
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
typedef long double lb;
#define int long long
#define double long double
typedef pair<double,double> P;
const ll INF = 4*1e18;
const int MOD = 1000000007;
const double EPS = 1e-10;
const double PI = 3.141592653589793;
template<class T> inline bool chmin(T& a, T b){if(a>b){a = b;return 1;}return 0;}
template<class T> inline bool chmax(T& a, T b){if(a<b){a = b;return 1;}return 0;}
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 

bool o(string s){
  int n = s.length();
  bool ret = true;
  rep(i,n/2){
    ret = ret && (s[i] == s[n-i-1]);
  }
  return ret;
}

signed main(){
  string s;
  cin>>s;
  cout << ((o(s) && o(s.substr(0,(s.length()-1)/2)) && o(s.substr((s.length()+3)/2-1, (s.length()-1)/2))) ? "Yes" : "No") << endl;
}


Measured memory_bytes: 384
package main

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

var sc = bufio.NewScanner(os.Stdin)

func swap(a int64, b int64) (int64, int64) {
	return b, a
}

func gcd(a int64, b int64) int64 {
	if b > a {
		a, b = swap(a, b)
	}
	if b == 0 {
		return a
	} else {
		return gcd(a%b, b)
	}
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func min(nums ...int64) int64 {
	if len(nums) == 0 {
		panic("funciton min() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int64(math.Min(float64(res), float64(nums[i])))
	}
	return res
}

func max(nums ...int64) int64 {
	if len(nums) == 0 {
		panic("funciton max() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int64(math.Max(float64(res), float64(nums[i])))
	}
	return res
}

func nextLong() int64 {
	sc.Scan()
	i, e := strconv.ParseInt(sc.Text(), 10, 64)
	if e != nil {
		panic(e)
	}
	return i
}

func nextString() string {
	sc.Scan()
	s := sc.Text()
	return s
}

func nextByte() byte {
	sc.Scan()
	s := sc.Bytes()
	return s[0]
}

func main() {
	sc.Split(bufio.ScanWords)
	//ans := 1
	K := nextLong()
	A := nextLong()
	B := nextLong()
	ans := int64(0)
	if A >= B || (B-A) == 1 {
		ans = 1 + K
	} else {
		K -= (A - int64(1))
		if K%int64(2) == 0 {
			ans = A + (B-A)*(K/int64(2))
		} else {
			ans = A + (B-A)*(K/int64(2))
			ans += int64(1)
		}
	}

	fmt.Printf("%d\n", ans)
}


Measured memory_bytes: 1776
/*
    Author:zeke
    
    pass System Test!
    GET AC!!
*/
#include <iostream>
#include <queue>
#include <vector>
#include <iostream>
#include <vector>
#include <string>
#include <cassert>
#include <algorithm>
#include <functional>
#include <cmath>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <map>
#include <iomanip>
#include <utility>
#include <stack>
using ll = long long;
using ld = long double;
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rep3(var, min, max) for (ll (var) = (min); (var) < (max); ++(var))
#define repi3(var, min, max) for (ll (var) = (max) - 1; (var) + 1 > (min); --(var))
#define Mp(a,b) make_pair((a),(b))
#define F first
#define S second
#define CIN(s) int (s);cin>>(s);
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef vector<V> VV;
typedef vector<P> VP;
ll MOD = 1e9 + 7;
ll INF =1e18;

int n;  //頂点数
int logn;
vector<vector<ll>> g;  //グラフの隣接リスト
VV par;
V depth;

//初期化
void dfs(int now,int parent,int d){
  par[now][0]=parent;
  depth[now]=d;
  for(int i=0;i<g[now].size();++i){
    if(g[now][i]!=parent)dfs(g[now][i],now,d+1);
  }
}

//uとvのlcaを求める
int lca(int u,int v){
  //uとvの深さを揃える
  if(depth[u]>depth[v])swap(u,v);
  for(int k=logn;k>=0;--k){
    if((1<<k) & depth[v]-depth[u]){
      v=par[v][k];
    }
  }
  if(u==v)return u;
  for(int k=logn;k>=0;--k){
    if(par[u][k] != par[v][k]){
      u=par[u][k];
      v=par[v][k];
    }
  }
  return par[u][0];
}

int main() {
    cin>>n;
    g.resize(n);
    logn=floor(log2(n));
    par.resize(n+1,V(logn+2));
    depth.resize(n);
    rep(i,n){
        int k;cin>>k;
        rep(j,k){
            int c;cin>>c;
            g[i].push_back(c);
        }
    }
    dfs(0,-1,0);
    for(int k=0;k<logn;++k){
    for(int i=0;i<n;++i){
      if(par[i][k]==-1){
        par[i][k+1]=-1;
      }else{
        par[i][k+1]=par[par[i][k]][k];
      }
    }
  }
  int q;cin>>q;
  rep(i,q){
      int u,v;cin>>u>>v;
      cout<<lca(u,v)<<endl;
  }
}


Measured memory_bytes: 32104
#include <stdio.h>
#include <math.h>
int koch(double px1,double py1,double px2,double py2,int n);
int main(){
  int n;
  double px1=0.0,py1=0.0;
  double px2=100.0,py2=0.0;
  scanf("%d",&n);
  printf("0.00000000 0.00000000\n");
  koch(px1,py1,px2,py2,n);
  return 0;
}
int koch(double px1,double py1,double px2,double py2,int n){
  if(n==0){
    printf("%f %f\n",px2,py2);
    return 0;
  }
  double Sx,Sy,Tx,Ty,Ux,Uy;
  Sx=(px2-px1)/3+px1;
  Sy=(py2-py1)/3+py1;
  Tx=(px2-px1)*2/3+px1;
  Ty=(py2-py1)*2/3+py1;
  Ux=(cos(M_PI/3)*(Tx-Sx)-sin(M_PI/3)*(Ty-Sy))+Sx;
  Uy=(sin(M_PI/3)*(Tx-Sx)+cos(M_PI/3)*(Ty-Sy))+Sy;
  koch(px1, py1, Sx, Sy, n-1);
  koch(Sx, Sy, Ux, Uy, n-1);
  koch(Ux, Uy, Tx, Ty, n-1);
  koch(Tx, Ty, px2, py2, n-1);
   
}

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

int n,k,GCD,MAX;

int gcd(int a,int b){return b?gcd(b,a%b):a;}

void work()
{
	scanf("%d %d",&n,&k);
	for (int i=1,x; i<=n; i++)
		scanf("%d",&x),GCD=gcd(GCD,x),MAX=max(MAX,x);
	puts((k%GCD==0)&&(k<=MAX)?"POSSIBLE":"IMPOSSIBLE");
}

int main()
{
	work();
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
// type alias
typedef long long LL;
typedef pair<int,int> II;
typedef tuple<int,int,int> III;
typedef vector<int> VI;
typedef vector<string> VS;
typedef unordered_map<int,int> MAPII;
typedef unordered_set<int> SETI;
template<class T> using VV=vector<vector<T>>;
// minmax
template<class T> inline T SMIN(T& a, const T b) { return a=(a>b)?b:a; }
template<class T> inline T SMAX(T& a, const T b) { return a=(a<b)?b:a; }
// repetition
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define REPE(i,n)  for(int i=0;i<=(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORR(x,arr) for(auto& x:arr)
#define SZ(a) int((a).size())
// collection
#define ALL(c) (c).begin(),(c).end()
// DP
#define MINUS(dp) memset(dp, -1, sizeof(dp))
#define ZERO(dp) memset(dp, 0, sizeof(dp))
// stdout
#define println(args...) fprintf(stdout, ##args),putchar('\n');
// debug cerr
template<class Iter> void __kumaerrc(Iter begin, Iter end) { for(; begin!=end; ++begin) { cerr<<*begin<<','; } cerr<<endl; }
void __kumaerr(istream_iterator<string> it) { (void)it; cerr<<endl; }
template<typename T, typename... Args> void __kumaerr(istream_iterator<string> it, T a, Args... args) { cerr<<*it<<"="<<a<<", ",__kumaerr(++it, args...); }
template<typename S, typename T> std::ostream& operator<<(std::ostream& _os, const std::pair<S,T>& _p) { return _os<<"{"<<_p.first<<','<<_p.second<<"}"; }
#define __KUMATRACE__ true
#ifdef __KUMATRACE__
#define dump(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); __kumaerr(_it, args); }
#define dumpc(ar) { cerr<<#ar<<": "; FORR(x,(ar)) { cerr << x << ','; } cerr << endl; }
#define dumpC(beg,end) { cerr<<"~"<<#end<<": "; __kumaerrc(beg,end); }
#else
#define dump(args...)
#define dumpc(ar)
#define dumpC(beg,end)
#endif

// $ cp-batch MaximalValue | diff MaximalValue.out -
// $ g++ -std=c++14 -Wall -O2 -D_GLIBCXX_DEBUG -fsanitize=address MaximalValue.cpp && ./a.out

/*
 
 9/7/2019
 
 5:05-
 
 */

const int MAX_N=1e6+1;
LL B[MAX_N];
int N;

void solve() {
  int M=N-1;
//  dumpC(B,B+M);
  LL res=B[0]+B[M-1];
//  dump(res);
  REP(i,M-1){
//    dump(i,B[i],B[i+1]);
    res+=min(B[i],B[i+1]);
  }
  cout<<res<<endl;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout<<setprecision(12)<<fixed;
  
  cin>>N;
  REP(i,N-1) cin>>B[i];
  solve();
  
  return 0;
}


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

using namespace std;


int main() {
    long long a, b;
    scanf("%lld %lld", &a, &b);
    long long g = __gcd(a, b);
    
    long long cur = 2;
    int cnt = 1;
    while (cur * cur <= g) {
        if (g % cur == 0) {
            cnt++;
            while (g % cur == 0) {
                g /= cur;
            }
        }
        cur++;
    }
    if (g > 1) cnt++;
    printf("%d\n", cnt);
}

Measured memory_bytes: 256
A = int(input())
B = int(input())
C = int(input())
X = int(input())
count = 0

for a in range(A+1):
    if 500 * a > X:
        break
    for b in range(B+1):
        if 500 * a + 100 * b > X:
            break
        for c in range(C+1):
            if 500 * a + 100 * b + 50 * c > X:
                break
            elif 500 * a + 100 * b + 50 * c == X:
                count += 1

print(count)

Measured memory_bytes: 3064
#include <iostream>
#include <cmath>

using namespace std;

int main(){
  int n;
  double xa,ya,ra,xb,yb,rb;
  double d;
  int ans;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>xa>>ya>>ra>>xb>>yb>>rb;
    d=sqrt(pow(xa-xb,2.0)+pow(ya-yb,2.0));
    if(ra>rb){
      if(ra>rb+d){
	ans = 2;
      }
      else if(ra<=rb+d&&ra+rb>=d){
	ans = 1;
      }
      else if(ra+rb<d){
	ans = 0;
      }
    }
    else if(ra<=rb){
      if(rb>ra+d){
	ans=-2;
      }
      else if(rb<=ra+d&&ra+rb>=d){
	ans =1;
      }
      else if(ra+rb<d){
	ans=0;
      }
    }
    cout<<ans<<"\n";
  }
    return 0;
}

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

int main()
{
    long long X;
    cin >> X;
    long long money = 100;
    long long ans = 0;
    double risi = 0.01;
    while (1)
    {
        ans++;
        money += money * risi;
        if (money >= X)
        {
            break;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3624
#include <stdio.h>
int main(void)
{
  int a,b,c,d,e,f;
  double x=0,y=0;

  while(scanf("%d%d%d%d%d%d",&a,&b,&c,&d,&e,&f) != EOF)
    {      
      x = (double)(c*e - b*f) / (a*e - b*d);
      y = (double)(-d*c + a*f) / (a*e - b*d);
      
      if(x == -0) x = 0;
      if(y == -0) y = 0;
      
      printf("%.3f %.3f\n",x,y);
    }
  return 0;
}

Measured memory_bytes: 0
#include <cstdio>
#include <queue>
#include <string>
using namespace std;

int main() {
	char cmd[20];
	priority_queue<int> pq;
	while (true) {
		scanf("%s", cmd);
		if (cmd[0] == 'i') {
			int key;
			scanf("%d", &key);
			pq.push(key);
		}
		else if (cmd[1] == 'x') {
			printf("%d\n", pq.top());
			pq.pop();
		}
		else if (cmd[0] == 'e') {
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 6484
n,x,*a=$<.read.split.map(&:to_i)
s=0
(n-1).times{|i|
  next if a[i]+a[i+1]<=x
  if a[i]>x
    s+=a[i+1]+a[i]-x
    a[i],a[i+1]=x,0
  else
    s+=a[i+1]+a[i]-x
    a[i+1]=x-a[i]
  end
}
p s

Measured memory_bytes: 9340
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.NoSuchElementException;

public class Main {
    public  static void main(String[] args) {
        FastScanner sc = new FastScanner();

        int N = Integer.parseInt(sc.next());
        int K = Integer.parseInt(sc.next());
        List<Integer> a = new ArrayList<Integer>();
        int num;
        int num2;

        for(int i = 1; i <= K; i ++) {
        	num = Integer.parseInt(sc.next());
        	for(int j = 0; j < num; j++) {
        		num2 = Integer.parseInt(sc.next());
        		if(!a.contains(num2)) {
        			a.add(num2);
        		}
        	}
        }
        System.out.print(N - a.size());
    }
}

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
}

Measured memory_bytes: 34796
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<bitset>
#include<stack>
#include<memory>
using namespace std;
using namespace std::chrono;
typedef long long int llint;
typedef double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
/*
cout<<fixed<<setprecision(20);
cin.tie(0);
ios::sync_with_stdio(false);
*/
const llint mod=998244353;
const llint big=2.19e15+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-15;
template <class T,class U>bool mineq(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool maxeq(T& a,U b){if(a<b){a=b;return true;}return false;}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){if(a==0){return b;}return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
template<class T>llint LBI(vector<T>&ar,T in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
template<class T>llint UBI(vector<T>&ar,T in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}
int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n,R,i,j;cin>>n>>R;
	static int dist[1500][1500];
	for(i=0;i<n;i++){
		for(j=0;j<n;j++){dist[i][j]=mod;}
		dist[i][i]=0;
	}
	vector<vector<pair<int,int>>>go(n);
	for(i=0;i<R;i++){
		int s,t,d;cin>>s>>t>>d;
		s--;t--;
		go[s].pub(mp(t,d));
		go[t].pub(mp(s,d));
	}
	priority_queue<pair<int,int>,vector<pair<int,int>>,greater<pair<int,int>>>que;
	for(int sta=0;sta<n;sta++){
		que.push(mp(0,sta));
		while(que.size()){
			int now=que.top().fir;
			int town=que.top().sec;
			que.pop();
			if(dist[sta][town]<now){continue;}
			for(auto it:go[town]){
				if(mineq(dist[sta][it.fir],now+it.sec)){que.push(mp(now+it.sec,it.fir));}
			}
		}
	}
	static bool ans[1500]={0};
	int longest=0;
	for(i=0;i<n;i++){
		for(j=0;j<n;j++){
			//cerr<<dist[i][j]<<" ";
			maxeq(longest,dist[i][j]);}
		//cerr<<endl;
	}
	for(int sta=0;sta<n;sta++){
		//自分からの距離が遠い順にdp
		vector<pair<int,int>>toi(n);
		for(i=0;i<n;i++){toi[i]=mp(dist[sta][i],i);}
		SO(toi);REV(toi);
		if(toi[0].fir<longest){continue;}//ないです
		vector<int>dp(n,mod);
		for(i=0;i<n;i++){
			int town=toi[i].sec;
			if(dist[sta][town]==longest){dp[town]=0;}
			for(auto it:go[town]){mineq(dp[town],dp[it.fir]+it.sec);}
			if(dp[town]+dist[sta][town]==longest){ans[town]=1;}
		}
		//for(i=0;i<n;i++){cerr<<dp[i]<<" ";}cerr<<endl;
	}
	int kazu=0;
		for(i=0;i<n;i++){if(!ans[i]){kazu++;}}
	cout<<kazu<<endl;
	for(i=0;i<n;i++){
		if(!ans[i]){cout<<i+1<<endl;}
	}
	return 0;
}


Measured memory_bytes: 12148
#include <bits/stdc++.h>
#define LL long long
using namespace std;

const int N = 1e5+7;
int dp[N];
int h[N];

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

    for (int i=1; i<=n; i++)    cin>>h[i];

    dp[1] = 0;
    for (int i=2; i<=n; i++)
    {
        dp[i] = 1e9+7;
        for (int j=1; j<=k && i-j>=1; j++)
            dp[i] = min(dp[i-j] + abs(h[i] - h[i-j]), dp[i]);
    }
    cout<<dp[n]<<endl;
}


Measured memory_bytes: 1024
n, k = map(int, input().split())
if (n - 2) * (n-1) // 2 < k:
    print(-1)
else:
    #全部の頂点をつなぐ
    ans = []
    for i in range(2,n+1):
        ans.append([1, i])
    num = (n-2) * (n-1) // 2
    for i in range(2,n+1):
        for j in range(i+1,n+1):
            if num == k:
                print(len(ans))
                for ans_array in ans:
                    print("{} {}".format(*ans_array))
                exit()
            num -= 1
            ans.append([i,j])
    print(len(ans))
    for ans_array in ans:
        print("{} {}".format(*ans_array))


Measured memory_bytes: 68864
solveN :: Int -> [Int] -> Int
solveN x ps
    | not $ x `elem` ps = x
    | otherwise = solveN (x - 1) ps

solveG :: Int -> [Int] -> Int
solveG x ps
    | not $ x `elem` ps = x
    | otherwise = solveG (x + 1) ps

solve :: Int -> [Int] -> Int
solve x ps =
    if x - n <= g - x then n else g
        where n = solveN x ps
              g = solveG x ps

main :: IO ()
main = do
    (x:_) <- map read . words <$> getLine :: IO [Int]
    ps <- map read . words <$> getLine :: IO [Int]
    print $ solve x ps

Measured memory_bytes: 4216
#include <iostream>
#include <vector>
#include <cmath>
#include <queue>
#include <deque>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <unordered_map>
#include <iomanip>
#include <sstream>
#include <numeric>
using namespace std;
#define ll long long int
#define ld long double
#define vi vector<ll>
#define vvi vector<vi>
#define vs vector<string>
#define pi pair<ll,ll>
#define pb push_back
#define pf push_front
#define eb emplace_back
#define mp make_pair
#define fs first
#define se second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL);
int main() {
    ll n,k;
    cin>>n>>k;
    vi v(n);
    for(ll i=0;i<n;i++){
        cin>>v[i];
    }
    vi a(n,1e9);
    a[0] = 0;

    for(ll i=0;i<n;i++){
        for(ll j=(i+1);j<=(i+k) && j<n;j++){
            a[j] = min(a[j],a[i]+abs(v[i]-v[j]));
        }
    }

    cout<<a[n-1]<<endl;

}




Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const double PI=acos(-1);
int f[100];
int main()
{
    string s;
    cin >>s;
    int cnt=0;
    for(int l=0,r=s.length()-1;l<r;l++,r--)
        if(s[l]!=s[r])
        cnt++;
    cout <<cnt<<endl;

    return 0;
}

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

int bubble(int A[],int N){
    int a=0;
    bool flag =1;
    for(int i=0;flag;i++){
        flag =0;
        for(int j=N-1;j>=i+1;j--){
            if(A[j]<A[j-1]){
                swap(A[j],A[j-1]);
                a++;
                flag=1;
            }
        }
    }
    return a;
}

int main(){
    int A[100],N,a;
    cin >> N;
    for(int i=0;i<N;i++) cin >> A[i];
    
    a=bubble(A,N);
    
    for(int i=0;i<N;i++){
        if(i) cout << " ";
        cout << A[i];
    }
    cout << endl;
    cout << a << endl;
    
    return 0;
}


Measured memory_bytes: 3088
H,W = map(int,input().split())

# 1-indexedになるように調整
coin = [None]
for h in range(H):
  coin.append([None]+[int(x) for x in input().split()])

# 各行で右に流して、右端列で下に流せば高々1つを除き完成

moves = []

# row moves
for i in range(1,H+1):
  for j in range(1,W):
    if coin[i][j]%2 == 1:
      coin[i][j] -= 1 # 不要
      coin[i][j+1] += 1
      moves.append((i,j,i,j+1))

# col moves
for i in range(1,H):
  if coin[i][W]%2 == 1:
    coin[i][W] -= 1
    coin[i+1][W] += 1
    moves.append((i,W,i+1,W))

# 出力
N = len(moves)
print(N)
for a,b,c,d in moves:
  print(a,b,c,d)


Measured memory_bytes: 77148
#include <bits/stdc++.h>
#define MAXN 200005

using namespace std;
typedef long long lint;

int fr[MAXN], v[MAXN];
int n, m, i, x, rez, k;

int main()
{
    /*freopen("f.in", "r", stdin);
    freopen("f.out", "w", stdout);*/

    scanf("%d%d", &n, &m);

    for(i = 1; i <= n; i ++)
    {
        scanf("%d", &x);
        if(v[x] == 0)
            v[x] = ++k;
        fr[ v[x] ] ++;
    }

    sort(fr+1, fr+k+1);
    for(i = 1; i <= k - m; i ++)
    {
        rez += fr[i];
    }
    printf("%d", rez);
    return 0;
}


Measured memory_bytes: 1792
#include "bits/stdc++.h"
#include<assert.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define int long long
const int inf = 1e17;
const int mod = 1000000007;
typedef pair<int, int> P;
typedef pair<int, P> PP;
int x[100006];

struct RMQ {
	int n; vector<int>node;
	void init(int N) {
		n = 1;
		while (n < N)n *= 2;
		node.resize(2 * n, inf);
	}

	void update(int x, int a) {
		x += n - 1;
		node[x] = a;
		while (x > 0) {
			x = (x - 1) / 2;
			node[x] = min(node[x * 2 + 1], node[x * 2 + 2]);
		}
	}
	int query(int a, int b, int k, int l, int r) {
		if (r <= a || b <= l)return inf;
		if (a <= l&&r <= b)return node[k];
		int vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
		int vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
		return min(vl, vr);
	}
	int get(int a, int b) {
		return query(a, b, 0, 0, n);
	}
};
RMQ dp1, dp2;
signed main() {
	int n, e, t; cin >> n >> e >> t;
	rep(i, n)cin >> x[i];
	dp1.init(n + 2);
	dp2.init(n + 2);

	x[n] = x[n - 1];
	dp1.update(0, 0);
	dp2.update(0, -2*x[0]);
	rep(i,n){
		int lb = -1, ub = i+1;
		while (ub - lb > 1) {
			int mi = (ub + lb) / 2;
			if (2 * (x[i] - x[mi]) > t)lb = mi;
			else ub = mi;
		}

		//[0,i]を分ける
		//[0,lb]は2(x[i]-x[j]), [ub,i]はt
		int X1, X2;
		X1 = dp1.get(ub, i+1) + t;
		X2 = dp2.get(0, ub) + 2 * x[i];
		dp1.update(i+1, min(X1, X2));
		dp2.update(i+1, min(X1,X2)-2 * x[i+1]);
	}
	cout << dp1.get(n, n+1)+e << endl;
}


Measured memory_bytes: 5248
#include<bits/stdc++.h>
using namespace std;
 
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define int long long
#define rep(i,a,b)    for(int i=a;i<b;i++)
#define repn(i,a,b)   for(int i=a;i>=b;i--)
#define F first
#define S second
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define pb push_back
#define mp  make_pair
#define all(v) (v).begin(), (v).end()
#define mod 1000000007  
#define mod2 998244353 
#define pi 3.14159265358979323846

int solve(){
    string s;
    cin>>s;
    cout<<s.substr(0,3);
    return 0;
}
 
signed main(){
    IOS;
    int t=1;
    //cin>>t;
    //string s;cin>>s;cout<<s.size()<<"*";
    while(t--){
        solve();
        //if(solve()) cout<<"YES";
        //else cout<<"NO";
        cout<<"\n";
    }
    return 0;
}


Measured memory_bytes: 3644
#include <string>
#include <vector>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <map>
#include <list>
#include <set>
#include <numeric>
#include <queue>
#include <stack>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <climits>
#include <cfloat>
#include <ctime>
#include <complex>
#include <cassert>
#include <iomanip>
using namespace std;
typedef long long LL;
typedef pair<int,int> P;
int n;
int p,q,r;
int m;
int x[5000];
int y[5000];
int num(int k, int a, int b)
{
	if(k==m){
		int s=min(b-a, max(q-a,0));
		int t=min(b-a, max(p-1-a,0));
		return s-t;
	}
	if(a<x[k]){
		if(b<=x[k]){
			return num(k+1,a+n-x[k],b+n-x[k]);
		}
		else if(b<=y[k]){
			return num(k+1,a+n-x[k],n)+num(k+1,n-y[k],n-y[k]+b-x[k]);
		}
		else
		{
			return num(k+1,a+n-x[k],n)+num(k+1,n-y[k],n-x[k])+num(k+1,0,b-y[k]);
		}
	}
	else if(a<y[k])
	{
		if(b<=y[k]){
			return num(k+1,n-y[k]-x[k]+a,n-y[k]-x[k]+b);
		}
		else
		{
			return num(k+1,n-y[k]-x[k]+a,n-x[k])+num(k+1,0,b-y[k]);
		}
	}
	else
	{
		return num(k+1,a-y[k],b-y[k]);
	}
}
int main() {
while(1)
{
	cin >> n >> m;
	if(n==0)return 0;
	cin >> p >> q >> r;
	for(int i=0;i<m;i++){
		cin >> x[i] >> y[i];
	}
	cout << num(0,0,r) << endl;
}
}

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

int main()
{
  double n,d;
  cin >> n >> d;
  int cnt = 0;
  for(int i = 0; i < n; i++)
  {
    double x,y;
    cin >> x >> y;
    x = abs(x);
    y = abs(y);
    if(sqrt((x*x )+ (y*y)) <= d)
    {
      cnt++;
    }
  }
  cout<<cnt;
 
  return 0;
}


Measured memory_bytes: 3676
#include <iostream>
#include <string>
using namespace std;
int H,W;
int main(){
	while(cin >> H >> W && H>0){
		string s,t;
		for(int i=0;i<W;i++){
			s += '#';
			if(i!=0 && i!=W-1) t += '.';
			else t += '#';
		}
		for(int i=0;i<H;i++){
			if(i==0 || i==H-1) cout << s << endl;
			else cout << t << endl;
		}
		cout << endl;
	}
}


Measured memory_bytes: 3152
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
 
int main() {
    string S, T;
    cin >> S >> T;
    int x;
    x = 0;
    for (int i = 0; i < S.size(); i++)
    {
        if(S.at(i) != T.at(i) ){
            cout << "No" << endl; break;
        }else{
            x = x + 1;
        }
    }
    if(x == S.size()){
        cout << "Yes" << endl;
    }
}

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

int main() {

int N,k=0; cin>>N;
  vector<char> A(N);
  for(int i=0; i<N; i++){
    cin>>A.at(i);}
    for(int i=0; i<N; i++){
    if(A.at(i)=='Y'){cout<<"Four"<<endl;break;}
      if(i==N-1){cout<<"Three"<<endl;}
}
  

}


Measured memory_bytes: 256
H1, M1, H2, M2, K = map(int, input().split())
v1 = H1 * 60 + M1
v2 = H2 * 60 + M2

if v1 <= v2:
    ans = v2 - v1 - K
else:
    v1 += 24 * 60
    ans = v2 - v1 - K
print(ans)

# 23:00 4:00 30


Measured memory_bytes: 9132
#include <cstring>
#include <sstream>
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <set>
#include <stack>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = n - 1; i >= 0; i--)
#define repone(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define each(i, mp) for(auto i:mp)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll half_inf = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);


vector<string> split(const string &str, char sep) {
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while (getline(ss, buffer, sep)) {
        v.push_back(buffer);
    }
    return v;
}

int main() {
    string s;
    cin >> s;
    vector<string> ans = split(s, ',');
    each(a, ans) cout << a << ' ';
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <tuple>
#include <cassert>
#include <functional>
#include <set>
#include <deque>
#include <list>
using namespace std;
typedef long long ll;
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
const int INF = 1<<29;
#define LNF __LONG_LONG_MAX__
const ll MOD = 1000000007;
const int MAX = 200000;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
// 法mでのaの逆元を計算
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
// a^n mod を計算する
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
//最大公約数
long long gcd(long long x, long long y){
    if(y==0) return x;
    else return gcd(y,x%y);
}
//最小公倍数
long long lcm(long long x, long long y){
    return x / gcd(x, y) * y;
}
// nが大きく,kが10^7程度の時の二項係数
long long com[200005];
void combination(long long n,long long k){
    com[0] = 1;
    for(int i=1;i<=k;i++){
        com[i] = (com[i-1]*(n-i+1)%MOD)*modinv(i,MOD)%MOD;
    }
}

int main(){
    int N; cin >>  N;
    double out=0.0;
    for(int i=0;i<N;i++){
        int A; cin >> A;
        out += 1.0/A;
    }
    printf("%.7lf\n",1.0/out);
    return 0;
}


Measured memory_bytes: 3612
# coding:utf-8
import sys
a = []
for line in sys.stdin:
    a.append(list(line.strip().replace(" ","").lower()))
a = reduce(lambda x,y: x+y,a)
dict = {}
for i in range(26):
    dict[chr(ord('a')+i)] = 0
for i in a:
    for key,value in dict.items():
        if key == i:
            dict[key] += 1
for key,value in sorted(dict.items()):
    print "%s : %d" % (key,value)



Measured memory_bytes: 4704
import java.util.*;

public class Main {
    public static void main (String[] args) {
        Scanner scanner = new Scanner(System.in);
        
        while (scanner.hasNext()) {
            int n =scanner.nextInt();
            int result = 0;

            for (int i = 0; i < 10; i++) {
                for (int j = 0; j < 10; j++) {
                    for(int k = 0; k < 10; k++) {
                        for(int l = 0; l < 10; l++) {
                            if (i+j+k+l == n) {
                                result++;
                            }
                        }
                    }
                }
            }
            System.out.println(result);
        }
    }
}

Measured memory_bytes: 18852
#include <stdio.h>
int main(){	
	long a[30];
	scanf("%li %li %li",&a[1],&a[2],&a[3]);
	for (int i=1;i<=3;i++)
		for (int j=i+1;j<=3;j++)
			if (a[i]>a[j]){
				long z=a[i];
				a[i]=a[j];
				a[j]=z;		
			}
	printf("%li",a[3]-a[1]);
}

Measured memory_bytes: 128
#include<iostream>
#include<queue>
#include<vector>
#include<string.h>
using namespace std;
#define MA 55
const int inf=10e7;
int dx[4]={0,0,-1,1};
int dy[4]={-1,1,0,0};
typedef pair<int,int> P;
int h,w;
char maze[MA][MA];
int l[MA][MA];
int bfs(){
  queue<P> q;
  P now;
  int r,t;
  q.push(P(1,1));
  while (!q.empty())
  {
    now=q.front();q.pop();
    r=now.first;t=now.second;
    for (int ik=0;ik<4;ik++){
      if (maze[r+dx[ik]][t+dy[ik]]=='.'&&l[r+dx[ik]][t+dy[ik]]==inf)
        {q.push(P(r+dx[ik],t+dy[ik]));l[r+dx[ik]][t+dy[ik]]=min(l[r][t]+1,l[r+dx[ik]][t+dy[ik]]);}
      
   }}
  return l[h][w];}



int main(){
    string s;
    cin>>h>>w;
    int kk=0;
  for (int i=0;i<w+2;i++){maze[0][i]='#';maze[h+1][i]='#';}
  for(int i=0;i<h+2;i++){maze[i][0]='#';maze[i][w+1]='#';}
  for (int x=1;x<h+1;x++){
    
    cin>>s;for (int j=1;j<w+1;j++){maze[x][j]=s[j-1];if(s[j-1]=='#'){kk++;}}
}
  for(int x=0;x<h+2;x++){for(int y=0;y<w+2;y++){l[x][y]=inf;}}
  l[1][1]=1;
    int ret=bfs();
    if (ret==inf)cout<<"-1"<<endl;
    else{cout<<h*w-kk-ret<<endl;}
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
// #define DEBUG
#define fi first
#define se second
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)      //repeat n times
#define REP2(i,s,n) for(int (i)=(s);(i)<(n);(i)++) //repeat from s to n 
#define REPD(i,n) for(int (i)=(n);(i)>=0;(i)--)    //repeat from n to 0
#define REPD2(i,s,e) for(int (i)=(s);(i)>=(e);(i)--) //repeat from s to e
#define ASIZE(a) (sizeof(a) / sizeof(a[0]))        //array size
#define SORTD(a) sort(a,a+ASIZE(a),greater<int>()) //sort in descending order for array
#define SORTA(a) sort(a,a+ASIZE(a))                //sort in ascending order for array
#define SORTS(a) sort(a.begin(),a.end())           //sort in ascending order for string type
typedef long long LL;
typedef unsigned int UINT;
typedef pair<int, int> P;
typedef vector<int> Vi;
typedef vector< Vi > VVi;
 
void SCAN(int *a){scanf("%d",a);}                             //scan for type int
void SCAN(int *a,int n){int i;REP(i,n){scanf("%d",&a[i]);}}   //scan for type int array
void SCAN(P *a){scanf("%d",&a->fi);scanf("%d",&a->se);} 
void SCAN(UINT *a){scanf("%u",a);}                            //scan for type unsigned int
void SCAN(UINT *a,int n){int i;REP(i,n){scanf("%u",&a[i]);}}  //scan for type unsigned int array
void SCAN(LL *a){scanf("%lld",a);}                            //scan for type long long int
void SCAN(LL *a,int n){int i;REP(i,n){scanf("%lld",&a[i]);}}  //scan for type long long int array
void SCAN(char *c){scanf(" %c",c);}                           //scan for type char
void SCAN(char *c,int n){int i;REP(i,n){scanf(" %c",&c[i]);}} //scan for type char array
 
const int MOD = 1000000007;
const int INF = 1999999999;
const LL INFLL = 999999999999999;
 
const int DX4[4]= {-1,0,1,0};
const int DY4[4]= {0,-1,0,1};
 
//fill an N-dimensional array with val
template<typename A, size_t N, typename T>
void FILL(A (&array)[N], const T &val){
	fill((T*)array,(T*)(array+N),val);
}
 
long double pascalTri(int n,int r){
	long double tri[n+1][n+1];
	int i,j;
	REP(i,n+1){REP(j,n+1){tri[i][j]=0;}}
	REP(i,n+1){
		REP(j,n+1){
			if(j>i){break;}
			if(j==0||j==i){tri[i][j]=1;}else{tri[i][j]=(tri[i-1][j-1]+tri[i-1][j]);}
		}
	}
	return tri[n][r];
}
 
LL GCD(LL a,LL b){
	LL t;
	if(a<b){t=a;a=b;b=t;}
	if(b==0){return a;}
	LL r;
	while(a%b!=0){
		r=a%b;
		a=b;
		b=r;
	}
	return b;
}
 
LL LCM(LL a,LL b){
	LL ab=(a*b)%MOD;
	return ab/GCD(a%b,b);
}
 
double area(P a,P b,P c){
	return ((b.fi-a.fi)*(c.se-a.se)-(b.se-a.se)*(c.fi-a.fi))/2.;
}
 
int checkCross(P v1,P v2,P a,P b){
	// cout<<area(v1)<<" "<<area(v2)<<endl;
	if(area(a,b,v1)*area(a,b,v2)>=0){return 0;}
	if(area(v1,v2,a)*area(v1,v2,b)>=0){return 0;}
	return 1;
}
 
 
 
int main(){
	// cin.tie(0);
	// ios::sync_with_stdio(false);
	int n;
	int a,b;
	int k;
	int i,j,r;

	SCAN(&n);

	#ifdef DEBUG
		auto start=chrono::system_clock::now();
	#endif
 
	k=n;
	a=0;
	while(k!=0){
		a+=k%10;
		k/=10;
	}
	if(n%a==0){
		printf("Yes\n");
	}else{
		printf("No\n");
	}
 
	
 
	#ifdef DEBUG
		auto end=chrono::system_clock::now();
		cout<<"Elapsed time : "<<chrono::duration_cast<chrono::milliseconds>(end-start).count()<<"ms."<<endl;
	#endif
	return 0;
}

Measured memory_bytes: 256
#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;
    int d[N];
    rep(i, N){
        cin>>d[i];
    }
    int e=0;
    int count=0;
    rep(i, 101){
        e=0;
        rep(j, N){
            if (i==d[j]){
                e=1;
            }
        }
        count+=e;
    }
    cout<<count<<endl;
}
*/

int main(){
    int N;
    cin>>N;
    vector<int> vec(N);
    rep(i, N){
        cin>>vec.at(i);
    }
    sort(vec.begin(), vec.end());
    int count=0;
    rep(i, N){
        if(i==0){
            count++;
            continue;
        }
        if(vec.at(i)!=vec.at(i-1)){
            count++;
        }
    }
    cout<<count<<endl;
}

Measured memory_bytes: 256