akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef double dd;
#define all(v) v.begin(),v.end()
#define endl "\n"
#define clr(n, r) memset(n,r,sizeof(n));

void fast() {

    cin.tie(0);
    cin.sync_with_stdio(0);
}


int main() {
    fast();
    vector<ll> divi(1e3+8);
    vector<bool> prime(1e3+9);
    for (ll i = 2; i <= 1e3; ++i) {
        if (!prime[i]) {
            prime[i] = 1;
            for (ll j = i * i; j <= 1e3; j+=i) {
                if (!divi[j])divi[j] = i;
                prime[j]=1;
            }
        }
    }
    map<ll, ll> ans;
    ll n;
    cin >> n;
    for (ll k = n; k >= 2; --k) {
        ll tmp = k;
        while (divi[tmp]) {
            ans[divi[tmp]]++;
            tmp /= divi[tmp];
        }
        if (tmp > 1)ans[tmp]++;
    }
    ll res=1;
    ll mod=1e9+7;
    for(auto it:ans){
        res=((res%mod)*(it.second+1)%mod)%mod;
    }
    cout<<res;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int INF=10000000;
const int mod=1e9+7;

int main()
{
    stack<int> S1;
    stack<pair<int,int> >S2;
    char ch;
    int sum=0;
    for(int i=0;cin>>ch;i++)
    {
        if(ch=='\\')
            S1.push(i);
        else if(ch=='/'&&S1.size()>0)
        {
            int j=S1.top();
            S1.pop();
            sum+=i-j;
            int a=i-j;
            while(S2.size()>0&&S2.top().first>j)
            {
                a+=S2.top().second;
                S2.pop();
            }
            S2.push(make_pair(j,a));
        }
    }
    vector<int> ans;
    while(S2.size()>0)
    {
        ans.push_back(S2.top().second);
        S2.pop();
    }
    reverse(ans.begin(),ans.end());
    cout<<sum<<endl;
    cout<<ans.size();
    for(int i=0;i<ans.size();i++)
    {
        cout<<" ";
        cout<<ans[i];
    }
    cout<<endl;
    return 0;
}



Measured memory_bytes: 3200
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
/*
//#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
*/

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
/*
//#if __cplusplus >= 201103L
#include <array>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
*/
using namespace std;
#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl

#define uni(x) x.erase(unique(all(x)),x.end())
template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;}
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) > (b) ? (b) : (a))

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;

#define INF INT_MAX/3
#define MAX_N 1000
#define M_INF 1000000000
int n,m,v,i;
void solve(){
   cin.tie(0);
  ios::sync_with_stdio(false);
  cin>>n;
  ll cnt[100005] = {0};
  rep(i,n){
    cin>>m;
    cnt[m-1]++;cnt[m]++;cnt[m+1]++;
  }
  ll ans = 0;
  rep(i,100005){
    if(cnt[i] > ans) ans = cnt[i];
  }
  cout<<ans<<endl;


}

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


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)

ll mod = 1e09 + 7;

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

  ll n;
  cin >> n;

  ll ans = 1;

  REP(i, n) ans = ans * (i + 1) % mod;

  cout << ans << endl;

}


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

int main()
{
    int a, b;
    cin >> a >> b;
    rep(yen, 1001)
    {
        int e = yen * 0.08;
        int t = yen * 0.1;
        if (e == a && t == b)
        {
            cout << yen << endl;
            return 0;
        }
    }
    cout << -1 << endl;
    return 0;
}

Measured memory_bytes: 3640
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate, product # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
import math

#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入g
#
# インデックス系
# int min_y = max(0, i - 2), max_y = min(h - 1, i + 2);
# int min_x = max(0, j - 2), max_x = min(w - 1, j + 2);
#
#
import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
#mod = 998244353
from sys import stdin
readline = stdin.readline
def readInts():
  return list(map(int,readline().split()))
def readTuples():
    return tuple(map(int,readline().split()))
def I():
  return int(readline())
n = I()
def yaku(m):
    ans = []
    i = 1
    while i*i <= m:
        if m % i == 0:
            j = m // i
            ans.append(i)
            if j != i:
                ans.append(j)
        i += 1
    ans = sorted(ans)
    return ans
dic = yaku(n)
dic = Counter(dic[1:])
ans = 0
for k,v in dic.items():
    m = k-1
    if n//m == n%m:
        ans += m
print(ans)


Measured memory_bytes: 11032
S = list(input())
N = len(S)
for i in range(N):
    S[i] = ord(S[i]) - ord('0')

S.append(0)

ans = 0
for i in range(1<<(N-1)):
    prev = 0
    for k in range(N):
        prev = prev * 10 + S[k]
        if (i & (1<<k)) > 0:
            ans += prev
            prev = 0
    ans += prev
print(ans)


Measured memory_bytes: 65688
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //GCC5.4.1で配列の範囲外アクセスをエラーにする

//cmdで g++ test.cpp とするとコンパイルできる
//制限1秒なら10^6は余裕 10^7は多分間に合う 10^8はよほど単純でないと厳しい

#define ALL(x) x.begin(),x.end()
typedef long long ll; //long long
typedef pair<int,int> pii; //pair<int,int>
typedef vector<int> vi; //vector<int>
typedef vector<vector<int>> vvi; //vector<vector<int>>
typedef vector<ll> vll; //vector<long long>
typedef vector<vector<ll>> vvll; //vector<vector<long long>>
typedef priority_queue<int, vector<int>, greater<int> > gpq; //逆順priority_queue
typedef priority_queue<int> pq;

//const int MOD=998244353;
const int MOD=1000000007; //10^9+7
const double PI=3.1415926535;

ll gcd(ll x,ll y){
    ll b=max(x,y),s=min(x,y);
    if(s<=0)return b;
    return gcd(s,b%s);
}


int main(){    
    int N,a;
    cin>>N;
    vi buka(N,0);
    for(int i=1;i<N;i++){
        cin>>a;
        a--;
        buka.at(a)=buka.at(a)+1;
    }
    for(int i=0;i<N;i++){
        cout<<buka[i]<<endl;
    }
}


Measured memory_bytes: 4048
# -*- coding: utf-8 -*-
import sys 
import heapq
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 

def main():
    
    class BIT:
        def __init__(self,len_A):
            self.N = len_A + 10
            self.bit = [0]*(len_A+10)
        # sum(A0 ~ Ai)
        # O(log N)
        def query(self,i):
            res = 0
            idx = i+1
            while idx:
                res += self.bit[idx]
                idx -= idx&(-idx)
            return res
        # Ai += x
        # O(log N)
        def update(self,i,x):
            idx = i+1
            while idx < self.N:
                self.bit[idx] += x
                idx += idx&(-idx)
        # min_i satisfying {sum(A0 ~ Ai) >= w} (Ai >= 0)
        # O(log N)
        def lower_left(self,w):
            if (w < 0):
                return -1
            x = 0
            k = 1<<(self.N.bit_length()-1)
            while k > 0:
                if x+k < self.N and self.bit[x+k] < w:
                    w -= self.bit[x+k]
                    x += k
                k //= 2
            return x
 
    h,w = map(int,readline().split())
    #dp[i] : iの時の最小右移動回数
    dp = [0]*(w+1)
    #解候補
    res = [0]*w
    #解候補から消されるもの
    anti = []
    C = BIT(w)
    for i in range(1,w+1):
        C.update(i,1)
    for i in range(1,h+1):
        a,b = map(int,readline().split())
        #a-1,b+1の値を計算
        x = a-1
        if x != 0 and x != w+1 and dp[x] == -1:
            #x以下のvalidな個数
            k = C.query(x-1)
            #k番目のvalidな位置okからXに行く
            if k != 0:
                ok = C.lower_left(k)
                #xをvalidにする
                dp[x] = dp[ok] + (x-ok)
                C.update(x,1)
                heapq.heappush(res,dp[x])
                
        x = b+1
        if x != 0 and x != w+1 and dp[x] == -1:
            #x以下のvalidな個数
            k = C.query(x-1)
            #k番目のvalidな位置okからXに行く
            if k != 0:
                ok = C.lower_left(k)
                #xをvalidにする
                dp[x] = dp[ok] + (x-ok)
                C.update(x,1)
                heapq.heappush(res,dp[x])
        k = C.query(a-1)+1
 
        while True:
            ok = C.lower_left(k)
            if ok > b or dp[ok] == -1:
                break
            heapq.heappush(anti,dp[ok])
            dp[ok] = -1
            C.update(ok,-1)
        while anti and res and anti[0] == res[0]:
            heapq.heappop(anti)
            heapq.heappop(res)
        if res:
            print(res[0]+i)
        else:
            print(-1)
if __name__ == '__main__':
    main()

Measured memory_bytes: 126832
from collections import defaultdict

dx = defaultdict(list)
dy = defaultdict(list)
dxpy = [defaultdict(list), defaultdict(list)] # (up, right), (down, left)
dxmy = [defaultdict(list), defaultdict(list)] # (up, left), (down, right)

N = int(input())
for i in range(N):
    x, y, u = input().split()
    x = int(x); y = int(y)
    # print(x+y, x-y)
    if u == 'U':
        dx[x].append((y, u))
        dxpy[0][x+y].append((y, u))
        dxmy[0][x-y].append((y, u))
    if u == 'R':
        dy[y].append((x, u))
        dxpy[0][x+y].append((y, u))
        dxmy[1][x-y].append((y, u))
    if u == 'D':
        dx[x].append((y, u))
        dxpy[1][x+y].append((y, u))
        dxmy[1][x-y].append((y, u))
    if u == 'L':
        dy[y].append((x, u))
        dxpy[1][x+y].append((y, u))
        dxmy[0][x-y].append((y, u))


INF = 10**12
def calc1(zs, m1, m2):
    temp = INF
    pre_z = -1; pre_u = m2
    for z, u in zs:
        if pre_u == m1:
            if u == m1:
                pre_z = z
            else:
                pre_u = m2
                temp = min(temp, (z-pre_z)*10//2)
        elif u == m1:
            pre_z = z
            pre_u = m1    
    return temp

def calc2(zs, m1, m2):
    temp = INF
    pre_z = -1; pre_u = m2
    for z, u in zs:
        if pre_u == m1:
            if u == m1:
                pre_z = z
            else:
                pre_u = m2
                temp = min(temp, (z-pre_z)*10)
        elif u == m1:
            pre_z = z
            pre_u = m1    
    return temp



time = []
# up, down
for x in dx:
    dx[x].sort()
    t = calc1(dx[x], 'U', 'D')
    if t < INF:
        time.append(t)

# right, left
for y in dy:
    dy[y].sort()
    t = calc1(dy[y], 'R', 'L')
    if t < INF:
        time.append(t)

m12 = [['U', 'R'], ['L', 'D']]
for i in range(2):
    for xpy in dxpy[i]:
        dxpy[i][xpy].sort()
        t = calc2(dxpy[i][xpy], m12[i][0], m12[i][1])
        if t < INF:
            time.append(t)

m12 = [['U', 'L'], ['R', 'D']]
for i in range(2):
    for xmy in dxmy[i]:
        dxmy[i][xmy].sort()
        t  = calc2(dxmy[i][xmy], m12[i][0], m12[i][1])
        if t < INF:
            time.append(t)

if time:
    print(min(time))
else:
    print('SAFE')


Measured memory_bytes: 159316
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 1e5+10;
ll a[maxn];
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);

	ll n;
	cin >> n;
	ll  mi = 0x3f3f3f3f;
	int co =0;
	ll sum =0;
	for(int i=1;i<=n;i++){
		cin >> a[i];
		if(a[i] < 0) co++;
		ll cc = abs(a[i]);
		sum += cc;
		mi = min(mi,cc);
	}
	if(co&1)
	cout << sum - mi*2<<endl;
	else 
	cout << sum <<endl;
} 

Measured memory_bytes: 1024
//====================== Author Info ===================
//    Khaled Alam (Ninjo)   ~   khaledalam.net@gmail.com
//======================================================

#include <bits/stdc++.h>
using namespace std;
#define  sz           size()
#define  fi           first
#define  se           second
#define  mp           make_pair
#define  pb           push_back
#define  ll           long long int
#define  ones         __builtin_popcount
#define  all(a)       (a).begin(), (a).end()
#define  iFile(a)     freopen(#a, "r", stdin)
#define  oFile(a)     freopen(#a, "w", stdout)
#define  rep(i,a,z)   for(auto i=(a);i<(z);i++)
#define  ios          ios_base::sync_with_stdio(false)
#define  tm           fprintf(stderr,"%.3f s\n",(float)clock()/1000);

int main() {
	//iFile(input.txt);
	string x, s;
	cin >> x;

	rep(i,0,x.sz)
	{

		if (i > 0 && s.back() == 'S' && x[i] == 'T') {
			s.pop_back();
		} else
			s.pb(x[i]);

		//cout << s << endl;
	}

	cout << s.sz;
}



Measured memory_bytes: 776
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<map>
#include<iomanip>
#include<queue>
#include<stack>
#include<time.h>
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define ggr getchar(); getchar();return 0;
using namespace std;
signed main() {
	char a;
	cin >> a;
	if (a == 'A')puts("T");
	else if (a == 'C')puts("G");
	else if (a == 'G')puts("C");
	else puts("A");
	ggr
}

Measured memory_bytes: 256
//cwystc <--> 陈威宇是天才  --by cwy
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pi;
const double PI=acos(-1);
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i,a,b) for (int i=(a);i<=(b);i++)
#define per(i,a,b) for (int i=(a);i>=(b);i--)
#define Rep(i,a,b) for (int i=(a);i<(b);i++)
#define Per(i,a,b) for (int i=(a);i>(b);i--)
#define travel_set(it,a) for (set<int>::iterator (it)=(a).begin();(it)!=(a).end();(it)++)
#define travel_map(it,a) for (map<int>::iterator (it)=(a).begin();(it)!=(a).end();(it)++)
#define travel_vec(it,a) for (vector<int>::iterator (it)=(a).begin();(it)!=(a).end();(it)++)
#define p(x) cout << x << endl;
#define def cout << "find" << endl;
#define what_is(x) cout << #x << " is " << x << endl;
template <class T>T sqr(T x){return x*x;}
template <class T>T alex(T x){return (x>0)?x:-x;}
template <class T>void read(T&x){
	x=0;T f=1;char ch=getchar();
	while ((ch<48||ch>57)&&ch!=45)ch=getchar();
	if (ch==45)f=-1,ch=getchar();
	while (ch>=48&&ch<=57)x=x*10+ch-48,ch=getchar();
	x*=f;
}

//-------------------------------------------------head-------------------------------------------------

#define maxn 300005
#define mod 1000000007
char s[maxn];int l;
int f[maxn][3][3];int c[maxn];
int main(){
	scanf("%s",s+1);int l=strlen(s+1);
	f[0][0][0]=1;int ans=0;
	c[l+1]=1;per(i,l,1){c[i]=c[i+1];if (s[i]=='?')c[i]=c[i]*2%mod;}
	// rep(i,1,l+1)printf("%d ",c[i]);puts("");
	rep(i,1,l)Rep(j,0,3)Rep(k,0,3)if (f[i-1][j][k]){
		// printf("%d %d %d %d\n",i-1,j,k,f[i-1][j][k]);
		if (s[i]=='1'||s[i]=='?'){
			if (k!=0)(f[i][j][k-1]+=f[i-1][j][k])%=mod;
			else {
				if (j==2)ans=((ll)f[i-1][j][k]*c[i+1]+ans)%mod;
				else (f[i][j+1][k]+=f[i-1][j][k])%=mod;
			}
		}
		if (s[i]=='0'||s[i]=='?'){
			if (k==2){(f[i][j][1]+=f[i-1][j][k])%=mod;}
			else (f[i][j][k+1]+=f[i-1][j][k])%=mod;
		}
	}
	(ans+=f[l][1][0])%=mod;	
	(ans+=f[l][2][1])%=mod;
	printf("%d\n",ans);
}

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

int main() {
  string S;
  cin >> S;
  int N = S.size();
  
  bool kaibun = true;
  bool k, strong1, strong2;
  if (N == 3) {
    if (!(S.at(0) == S.at(2))) {
      kaibun = false;
    }
  }
  
  else {
    for (int i = 0; i < (N - 1) / 2; i++) {
      k = (S.at(i) == S.at(N - i - 1));
      strong1 = (S.at(i) == S.at((N - 1) / 2 - i - 1));
      strong2 = (S.at((N + 3) / 2 + i - 1) == S.at(N - 1 - i));
      if (!(k && strong1 && strong2)) {
        kaibun = false;
        break;
      }
    }
  }
  if (kaibun) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }  
}

Measured memory_bytes: 256
#pragma target("avx")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef unordered_map<ll, ll> U_MAP;
typedef priority_queue<ll> pq;
typedef priority_queue<ll, vector<ll>, greater<ll>> rpq;
const int INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
const ll LINF = 1e18;

#define rep(i, n) for (ll(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrrep(i, a, b) for (ll i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl
#define doublecout(a) cout << fixed << setprecision(15) << a << endl;
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back

//------ Believe yourself as a genius!!!!!! ------

int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
// int dy[]={-1,0,1,-1,1,-1,0,1};int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
ll n, cnt, ans, a[10], b[10], c, d, tmp, m, h, w, x, y, sum, k, q;
ll dp[ohara], dp2[5000 * 5000 + 1];

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

  cin >> n;
  rep(i, 3) cin >> a[i];
  rep(i, 3) cin >> b[i];

  rrep(i, 1, n + 1) {
    rep(j, 3) {
      if (i >= a[j]) dp[i] = max({dp[i], dp[i - a[j]] + b[j], i});
      dp[i] = max({dp[i], dp[i - 1], i});
    }
  }
  ans = dp[n];

  rrep(i, 1, ans + 1) {
    rep(j, 3) {
      if (i >= b[j]) dp2[i] = max({dp2[i], dp2[i - b[j]] + a[j], i});
      dp2[i] = max({dp2[i], dp2[i - 1], i});
    }
  }
  Cout(dp2[ans]);
  return 0;
}

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

using namespace std;

int n, m;
vector<vector<int>> G;
int ans[101010];

int main() {
  cin >> n >> m;
  G.assign(n, vector<int>());
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    G[a].emplace_back(b);
    G[b].emplace_back(a);
  }
  for (int i = 0; i <= n; i++) ans[i] = -1;
  queue<int> que;
  que.emplace(0);
  while (!que.empty()) {
    int v = que.front();
    que.pop();
    for (auto nv : G[v]) {
      if (ans[nv] != -1) continue;
      ans[nv] = v;
      que.emplace(nv);
    }
  }

  for (int i = 1; i < n; i++) {
    if (ans[i] == -1) {
      cout << -1 << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  for (int i = 1; i < n; i++) {
    cout << ans[i] + 1 << endl;
  }

  return 0;
}

Measured memory_bytes: 10032
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int s = in.nextInt();
		int num1 = s/100;
		int num2 = s%100;
		boolean month1 = false;
		boolean month2 = false;
		if(num1>=1 && num1<=12) month1 = true;
		if(num2>=1 && num2<=12) month2 = true;
		if(month1&&month2) System.out.println("AMBIGUOUS");
		else if(month1) System.out.println("MMYY");
		else if(month2) System.out.println("YYMM");
		else System.out.println("NA");
		in.close();
	}

}


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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define VIN(v) for(auto&elem_: (v) )cin>>elem_
#define VOUT(v, sep) for(_loop_int idx=0; idx<(_loop_int)v.size(); idx++) {cout<<v[idx]; if(idx<(_loop_int)v.size()-1) cout<<sep;} cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG2(x,y) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(debugidx,v.size())cout<<" "<<v[debugidx];cout<<endl
#define DEBUG_ARR(v,n) cout<<#v<<":";REP(debugidx,n)cout<<" "<<v[debugidx];cout<<endl

const ll MOD = 1000000007ll;
const int IINF = numeric_limits<int>::max()/2-1;
const ll LINF = numeric_limits<ll>::max()/2-1;

template<class T> inline bool chmin(T& a, const T b) { if (a>b) { a=b; return true; } return false; }
template<class T> inline bool chmax(T& a, const T b) { if (a<b) { a=b; return true; } return false; }



int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    int n;
    cin>>n;//偶数

    vi x(n);
    REP(i,n){
        cin>>x[i];
    }
    vi a;
    a=x;

    sort(ALL(a));

    int l = a[max(0, n/2-1)];
    int r = a[min(n-1, n/2)];
    
    REP(i,n){
        if(x[i] <= l) cout<< r << endl;
        else cout<< l << endl;
    }
    return 0;
}

Measured memory_bytes: 4756
import java.util.*;
public class Main{
    public static void main(String[] args){
	new Main().run();
    }
    Scanner sc = new Scanner(System.in);

    String s;
    String[] w;
    int[] n;

    void run(){
	while(sc.hasNext()){
	    s = sc.nextLine();
	    if(s.equals("END OF INPUT")) break;

	    w = s.split(" ");
	    n = new int[w.length];
	    for(int i=0; i<w.length; i++)
		n[i] = w[i].length();

	    for(int i=0; i<n.length; i++)
		System.out.print(n[i]);
	    System.out.println();
	}
    }
}

Measured memory_bytes: 17188
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define itrfor(itr,A) for(auto itr = A.begin(); itr !=A.end();itr++)
typedef int64_t llong;
char moji[26]={'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'};
char moji2[26]={'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'};
char moji3[10]={'0','1','2','3','4','5','6','7','8','9'};
#define Sort(a) sort(a.begin(),a.end());
#define Reverse(a) reverse(a.begin(),a.end());
#define ld PRId64
#define n_max 200000

int main(){
    int n;
    cin >> n;
    vector<int> A;
    int tmp;
    REP(i,n){
        scanf("%d",&tmp);
        if(i%2==0) A.push_back(tmp);
        else A.insert(A.begin(),tmp);
    }
    if(n%2==1)  Reverse(A);
    itrfor(itr,A) printf("%d ",*itr);
}

Measured memory_bytes: 3060
#include<stdio.h>
int main(void){
	int a[100][100],b[100],c[100]={0},n,m,i,j,k;
	scanf("%d %d",&n,&m);
	for(i=0;i<n;i++){
		for(j=0;j<m;j++){
			scanf("%d",&a[i][j]);
		}
	}
	for(k=0;k<m;k++){
		scanf("%d",&b[k]);
	}
	for(i=0;i<n;i++){
		for(j=0;j<m;j++){
			c[i]+=a[i][j]*b[j];
		}
	}
	for(k=0;k<n;k++){
		printf("%d\n",c[k]);
	}
return 0;
}

Measured memory_bytes: 636
#define _GLIBCXX_DEBUG
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <sstream>
#include <random>
#include <utility>
#include <map>
#include <vector>
#include <queue>
#include <bitset>
#include <sstream>

using namespace std;

#define REP(i,x) for(int i=0; i<(x); i++)
#define all(x) (x).begin(),(x).end()
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
using vi = vector<int>;
using vvi = vector<vi>;
using ll = long long;


int main(int argc, const char * argv[]) {
    int n, x, y;
    cin >> n >> x >> y;

    vi answers(n);

    for(int i=1; i<n; i++){
        for(int j=i+1; j<=n; j++){
            answers.at(min(j-i, abs(j-y)+1+abs(i-x)))++;
        }   
    }
    for(int k=1; k<n; k++){
        cout << answers.at(k) << endl;
    }
    
    return 0;
}


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

int main(){
while(1){
	int n,m,r[502],a[10002],b[10002],ans=0;
	scanf("%d%d",&n,&m);
	if(n==0)break;
	for(int i=0;i<=n;i++)r[i]=100;
	for(int i=0;i<m;i++){
		scanf("%d%d",&a[i],&b[i]);
		if(a[i]==1)r[b[i]]=1;
		if(b[i]==1)r[a[i]]=1;
	}
	for(int i=0;i<m;i++){
		if(r[a[i]]==1&&r[b[i]]!=1)r[b[i]]=2;
		if(r[b[i]]==1&&r[a[i]]!=1)r[a[i]]=2;
	}
	for(int i=2;i<=n;i++){
		if(r[i]==1||r[i]==2)ans++;
	}
	printf("%d\n",ans);
}
}

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

int main()
{
    long long int n, m, a, sum1 = 0, sum2 = 0;
    
    cin >> n >> m;

    for( int i = 0; i < n; i++ )
    {
        cin >> a;
        sum1 += a;
    }

    for( int i = 0; i < m; i++ )
    {
        cin >> a;
        sum2 += a;
    }

    cout << sum1 * sum2 << endl;

    return 0;
}


Measured memory_bytes: 3088
#include <stdio.h>
int main ()
{
	int X, A, B;
	scanf ("%d %d %d", &X, &A, &B);
	if (B <= A) {
		puts ("delicious");
	} else if (B <= A + X) {
		puts ("safe");
	} else puts ("dangerous");
	return 0;
}

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

int main(){
    int n;
    int a=0;
    int b=0;
    string T,H;
    
    cin >> n;
    for(int i=0; i<n; i++){
        cin >> T >> H;
        if(T > H) a+=3;
        else if(T < H) b+=3;
        else if (T==H) {
            a++; b++;
        }
    }
    
    cout << a << " " << b << endl;
}

Measured memory_bytes: 3152
#include <stdio.h>

const int MAX_VAL = 200000;
const int MAX_N = 3000;
const int MOD = 1e9 + 7;

struct Block {
  int r;
  int c;
};

struct Z {
  int v;
  
  Z(long long l = 0) {
    v = l;
  }

  operator int() {
    return v;
  }
};

Z operator *(Z a, Z b) {
  return (long long)a.v * b.v % MOD;
}

void operator *=(Z &a, Z b) {
  a.v = (long long)a.v * b.v % MOD;
}

void operator -=(Z &a, Z b) {
  a.v -= b.v;
  if (a.v < 0)
    a.v += MOD;
}

int n;
Block blocks[MAX_N + 1];
Z Count[MAX_N + 1];

Z fact[1 + MAX_VAL];
Z invFact[1 + MAX_VAL];

Z pow(Z base, int exp) {
  Z answer = 1;
  while (exp > 0) {
    if (exp % 2 == 1)
      answer *= base;
    base *= base;
    exp /= 2;
  }
  return answer;
}

Z choose(int n, int k) {
  return fact[n] * invFact[k] * invFact[n - k];
}

Z allRoads(int x, int y) {
  return choose(x + y, x);
}

Z count(int i) {
  if (Count[i] == 0) {
    Count[i] = allRoads(blocks[i].r - 1, blocks[i].c - 1);
    for (int j = 0; j <= n; j++) {
      if (i != j && blocks[j].r <= blocks[i].r && blocks[j].c <= blocks[i].c) {
        Count[i] -= count(j) * allRoads(blocks[i].r - blocks[j].r, blocks[i].c - blocks[j].c);
      }
    }
  }
  return Count[i];
}

int main() {
  fact[0] = 1;
  for (int i = 1; i <= MAX_VAL; i++)
    fact[i] = fact[i - 1] * Z(i);
  invFact[MAX_VAL] = pow(fact[MAX_VAL], MOD - 2);
  for (int i = MAX_VAL - 1; i >= 0; i--)
    invFact[i] = invFact[i + 1] * Z(i + 1);

  int h, w;
  scanf("%d%d%d", &h, &w, &n);
  for (int i = 0; i < n; i++) {
    scanf("%d%d", &blocks[i].r, &blocks[i].c);
  }
  blocks[n].r = h;
  blocks[n].c = w;
  count(n);
  /*
  for (int i = 0; i <= n; i++)
    printf("%d ", (int)fact[i]);
  printf("\n");
  for (int i = 0; i <= n; i++)
    printf("%d ", (int)invFact[i]);
  printf("\n");
  for (int i = 0; i <= n; i++)
    printf("%d ", (int)count(i));
  printf("\n");//*/
  printf("%d\n", (int)count(n));
  return 0;
}


Measured memory_bytes: 1792
#include <stdio.h>
#include <algorithm>
#include <string.h>
#define INF 1234567890123

long long int N, M;
long long int far[1234];
long long int weather[1234];
long long int memo[1234][1234];

long long int dp(long long int now, long long int now_date){
	if (memo[now][now_date] != -1) return memo[now][now_date];
	if (now > N) return memo[now][now_date] = 0;
	if (now_date > M) return INF;
	return memo[now][now_date] = std::min(
		((far[now + 1] * weather[now_date + 1]) + dp(now + 1, now_date + 1)),
		dp(now, now_date + 1)
		);
}

int main(){
	memset(memo, 255, sizeof(memo));
	scanf("%lld%lld", &N, &M);
	for (long long int a = 1; a <= N; a++){
		scanf("%lld", &far[a]);
	}
	for (long long int a = 1; a <= M; a++){
		scanf("%lld", &weather[a]);
	}
	printf("%lld\n", dp(0, 0));
	return 0;
}

Measured memory_bytes: 14680
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    int a,b;
    cin>>a>>b;
    if(abs(a-b)%2==0){
        cout<<min(a,b)+abs(a-b)/2<<endl;
        return 0;
    }
    else{
        cout<<"IMPOSSIBLE"<<endl;
        return 0;
    }
}

Measured memory_bytes: 256
#include<vector>
#include <iostream>
#include<string>
#include <complex>

using namespace std;

int main(){
    float a, b, t;
    cin >> a;
    cin >> b;
    cin >> t;
    int cnt = 0;
    for(int i= 1; a*i < t+0.5; i++){
        cnt += b;
    }

    cout << cnt << endl;
}

Measured memory_bytes: 256
# -*- coding:utf-8 -*-
from math import *
n = input()
xli=map(float,raw_input().split())
yli=map(float,raw_input().split())
md1 = 0 #minkowski distance p=1
md2 = 0 #p=2
md3 = 0 #p=3
mdinf = 0 #p=???(infinity)
for i in xrange(n):
    d = fabs(xli[i]-yli[i])
    md1 += d
    md2 += d**2
    md3 += d**3
    if d>mdinf:
        mdinf = d
md2 = md2**(1/2.0)
md3 = md3**(1/3.0)
print md1
print md2
print md3
print mdinf

Measured memory_bytes: 6692
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = ll(1e12);
const ll mod = ll(1e9) + 1;
#define rep0(i,n) for(ll (i) = 0; (i) < (n); ++(i))
#define rrep0(i,n) for(ll (i) = (n) - 1; (i) >= 0; --(i))
#define rep1(i,n) for(ll (i) = 1; (i) <= (n); ++(i))
#define rrep1(i,n) for(ll (i) = (n); (i) >= 1; --(i))
#define nfor(i,a,b) for(ll (i) = (a); (i) < (b); ++(i))
#define pf(x) cout << (x) << endl
#define all(x) (x).begin(),(x).end()

ll gcd(ll a,ll b){
    if(a < b)swap(a, b);
    if(b == 0) return a;
    return gcd(b,a%b);
}

ll lcm(ll a,ll b){
    ll g = gcd(a,b);
    return a / g * b;
}

ll factorial(ll n){
    ll t = 1;
    rep1(i, n){
        t *= i;
        t %= mod;
    }
    return t;
}

ll power(ll a, ll b){
    a %= mod;
    if(b == 0){
        return 1;
    }
    ll ans = power(a, b / 2);
    ans = ans * ans % mod;
    if(b % 2 == 1){
        ans = ans * a % mod;
    }
    return ans;
}

ll combination(ll a, ll b){
    if((a == b) || (b == 0)){
        return 1;
    }
    if(a < b) return 0;
    ll ans = 1;
    for(ll i = 0; i < b; i++) {
        ans *= (a - i);
        ans %= mod;
        ans *= power(i + 1, mod - 2);
        ans %= mod;
    }
    return ans;
}

int main(){
    ll a,b;
    cin >> a >> b;
    pf(a * (a - 1) / 2 + b * (b - 1) / 2);
    return 0;
}


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

int main() {
  int n;
  cin>>n;
  int ans=0,ma=0;
  rep(i,n){
    int p;
    cin>>p;
    ma=max(p,ma);
    ans+=p;
  }
  cout<<ans-ma/2<<endl;
  return 0;
}

Measured memory_bytes: 256
A = int(input())
B = int(input())
C = int(input())
X = int(input())
count = 0
for a in range(A+1):
    for b in range(B+1):
        for c in range(C+1):
            total = 500 * a + 100 * b + 50 * c
            if total == X:
                count += 1
print(count)

Measured memory_bytes: 3060
// 20190427A.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <iostream>
using namespace std;
#include <vector>
#include <numeric>
#include <cmath>
#include <limits>

int main()
{
	/*int A, B, T;             A問題

	cin >> A >> B >> T;

	cout << T / A * B;*/

	//int N, i, v, c, max = 0;           //B問題
	//vector<int>V, C;

	//cin >> N;

	//for (i = 1; i <= N; i++) {
	//	cin >> v;
	//	V.push_back(v);
	//}

	//for (i = 1; i <= N; i++) {
	//	cin >> c;
	//	C.push_back(c);
	//}

	//for (i = 0; i < N; i++) {
	//	if (V[i] > C[i]) {
	//		max = max + V[i] - C[i];
	//	}
	//}

	//cout << max;


	/*int N, i, a;
	vector<int>A;

	cin >> N;

	for (i = 0; i < N; i++) {
		cin >> a;
		A.push_back(a);
	}

	int b, c;*/                 //C



	long long N, i, a;


	cin >> N;
	long long min, minus = 0;
	long long n = 0;
	for (i = 0; i < N; i++) {
		cin >> a;

		if (i == 0) {
			min = abs(a);
		}
		if (abs(a) < min) {
			min = abs(a);
		}
		if (a < 0) {
			minus++;
		}
		n += abs(a);
	}

	if (minus % 2 == 0) {

		cout << n;
	}
	else {

		cout << n - 2 * min;
	}
}

// プログラムの実行: Ctrl + F5 または [デバッグ] > [デバッグなしで開始] メニュー
// プログラムのデバッグ: F5 または [デバッグ] > [デバッグの開始] メニュー

// 作業を開始するためのヒント: 
//    1. ソリューション エクスプローラー ウィンドウを使用してファイルを追加/管理します 
//   2. チーム エクスプローラー ウィンドウを使用してソース管理に接続します
//   3. 出力ウィンドウを使用して、ビルド出力とその他のメッセージを表示します
//   4. エラー一覧ウィンドウを使用してエラーを表示します
//   5. [プロジェクト] > [新しい項目の追加] と移動して新しいコード ファイルを作成するか、[プロジェクト] > [既存の項目の追加] と移動して既存のコード ファイルをプロジェクトに追加します
//   6. 後ほどこのプロジェクトを再び開く場合、[ファイル] > [開く] > [プロジェクト] と移動して .sln ファイルを選択します


Measured memory_bytes: 256
N,M = map(int,input().split())
li = list(map(int,input().split()))
distance = []
li.sort()
for i in range(M-1) :
    d = abs(li[i+1] - li[i])
    distance.append(d)
sum = 0
distance.sort()
distance.reverse()
for i in range(N-1,M-1) :
    sum += distance[i]
print(sum)

Measured memory_bytes: 13964
import Control.Applicative ((<$>), (<*>))
import Control.Monad
import Data.List

main :: IO ()
main = do
  rs <- getLine
  unless (rs == "-") $ do
    solve rs <$> getLine <*> getLine >>= putStrLn
    main

solve :: String -> String -> String -> String
solve rs gs ds = f rs (tail gs) (head gs) [] ds
  where
    f :: String -> String -> Char -> String -> String -> String
    f xs ys c zs ps
      | null xs && null ys = reverse (c:zs)
      | null ps = f xs (tail ys) (head ys) (c:zs) ps
      | c == head ps = f (tail xs) ys (head xs) zs (tail ps)
      | otherwise = f xs (tail ys) (head ys) (c:zs) ps

Measured memory_bytes: 3752
N = int(input())
A = []
for i in range(N):
  A.append(int(input()))

visited = [0]
steps = 0

while steps<N:
  curr_i = visited[-1]
  curr_val = A[curr_i]
  if curr_i == 1:
    print(steps)
    exit()
  else:
    steps+=1
    visited.append(curr_val -1)
print(-1)

Measured memory_bytes: 11056
#include<iostream>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
using namespace std;
int read(){
	int f=1,x=0; char c=getchar();
	while (c>'9' || c<'0') {if (c=='-') f=-1; c=getchar();}
	while (c>='0'&&c<='9') {x=x*10+c-'0'; c=getchar();}
	return f*x;
}
long long a,b,c;
int k;
int main(){
	cin>>a>>b>>c>>k;
	if (b>a){
		int t=b;
		b=a;
		a=t;
	}
	if(c>a){
		int t=c;
		c=a;
		a=t;
	}
	for(int i=1;i<=k;i++)a*=2;
	cout<<a+b+c<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void _main()
{
    string n;
    cin >> n;
    for (const char c : n)
    {
        if (c == '1') cout << 9;
        else if (c == '9') cout << 1;
        else cout << c;
    }
    cout << endl;
}


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

int main(){
  int A,B,C,X,Y;
  cin >> A >> B >> C >> X >> Y;
  if(A + B > C*2){
    if(Y < X){
      swap(A,B);
      swap(X,Y);
    }
    int res = C * 2 * X;
    Y -= X;
    if(B > C*2){
      res += C * 2 * Y;
    }
    else {
      res += B * Y;
    }
    cout << res << endl;
  }
  else {
    cout << X*A + Y*B << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <utility>
#include <iomanip>
#include <functional>
#include <queue>
#include <stack>
#include <cmath>
#define ll long long
#define INF 10000000000000000
#define MOD 998244353
using namespace std;

int main(){
    int n;
    while(true){
        cin >> n;
        if(n==0){break;}
        int s[n];
        for(int i=0; i<n; i++){
            cin >> s[i];
        }
        sort(s,s+n);
        int S=0;
        for(int i=1; i<n-1; i++){
            S+=s[i];
        }
        cout<<S/(n-2)<<endl;
    }
    return 0;
}



Measured memory_bytes: 3160
using System;
using System.Collections.Generic;
using System.IO;
class Program
{
	static void Main(string[] args)
	{
		string[] str = Console.ReadLine().Split();
		int N = int.Parse(str[0]);
		int M = int.Parse(str[1]);
		int[][]A = new int[N+M-1][];
		for(var i=0;i<N+M-1;i++){
			string[] str2 = Console.ReadLine().Split();
			A[i] = new int[2]{int.Parse(str2[0]),int.Parse(str2[1])};
		}
		var list = new HashSet<int>[N];
		for(var i=0;i<N;i++){
			list[i] = new HashSet<int>();
		}
		int[]Nct = new int[N];
		for(var i=0;i<N+M-1;i++){
			list[A[i][0]-1].Add(A[i][1]-1);
			Nct[A[i][1]-1]++;
		}
		int D1 = -1;
		for(var i=0;i<N;i++){
			if(Nct[i]==0){
				D1 = i;
				break;
			}
		}
		int[]ans = new int[N];
		ans[D1] = 0;
		int ct = 1;
		int[]Lct = new int[N];
		var listA = new Queue<int>();
		listA.Enqueue(D1);
		while(listA.Count > 0){
			D1 = listA.Dequeue();
          	int d2 = -1;
			foreach(var hs in list[D1]){
				Lct[hs]++;
				if(Nct[hs]==Lct[hs]){
					ans[hs] = D1+1;
					d2 = hs;
					ct++;
					listA.Enqueue(hs);
				}
			}
			//if(d2!=-1){
			//	D1 = d2;
			//}
		}
		var sw = new StreamWriter(Console.OpenStandardOutput()){AutoFlush = false};
		Console.SetOut(sw);
		
		for(var i=0;i<N;i++){
			Console.WriteLine(ans[i]);
		}
		
		Console.Out.Flush();

	}
}

Measured memory_bytes: 43264
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <bitset>
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;

using ll = long long;
using P = pair<int, int>;

const int INF = 1e9;
const int MOD = 1e9 + 7;

// 4近傍、8近傍
int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};

int main() {
  // 入力
  int N;
  cin >> N;
  int d[N];
  for (int i = 0; i < N; i++) cin >> d[i];

  set<int> st;
  for (int i = 0; i < N; i++) st.insert(d[i]);

  // 解答
  cout << st.size() << endl;

  return 0;
}


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

for i in range(N):
  if B[N-1-i] > A[N-i]:
    B[N-1-i] -= A[N-i]
    A[N-i] = 0
  else:
    A[N-i] -= B[N-1-i]
    B[N-1-i] = 0
  if B[N-1-i] > A[N-1-i]:
    B[N-1-i] -= A[N-1-i]
    A[N-1-i] = 0
  else:
    A[N-1-i] -= B[N-1-i]
    B[N-1-i] = 0
print(monsters -sum(A))
    
    
  


Measured memory_bytes: 82148
#include<stdio.h>
#include<bits/stdc++.h>
using namespace std;
long long int a[1000007];
int main()
{
	int m;
	scanf("%d",&m);
	int i,j;
	for(i=0;i<3*m;i++)
		scanf("%lld",a+i);
	sort(a,a+3*m);
	i=0;j=3*m-1;
	long long int ans=0;
	while(i<j)
	{
		ans=ans+a[j-1];
		i++,j=j-2;
	}
	printf("%lld\n",ans);
	return 0;
}


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

int main(){
    int N, Z, W;
    cin >> N >> Z >> W;
    int nums[N];
    for(int i = 0; i < N; i++){
        cin >> nums[i];
    }
    if(N == 1){
        cout << abs(nums[N - 1] - W) << endl;
    }else{
        cout << max(abs(nums[N - 2] - nums[N - 1]), abs(nums[N - 1] - W)) << endl;
    }
}

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

using namespace std;
typedef long long ll;
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
    REP(i,v.size()){if(i)os<<" ";os<<v[i];}return os;}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
    REP(i,v.size()){if(i)os<<endl;os<<v[i];}return os;}
#define vi vector<int>
#define vii vector<vector<int>>
#define mii map<int,int>
#define Sort(v) sort(v.begin(),v.end())
#define Reverse(v) reverse(v.begin(),v.end())
#define ALL(a)  (a).begin(),(a).end()
#define pb push_back
#define mp make_pair
//#define int ll

const int md = 1000000007;
const int INF = 1<<30;

int main(){
    int n; cin >> n;
    double pi = acos(-1);

    printf("%.4lf\n", 2*n*pi);
}


Measured memory_bytes: 3716
n = gets.to_i
tree = gets.split.map { |i| i.to_i }
(1..n).each do |i|
  parent = (tree[i/2-1] && i/2-1 != -1) ? "parent key = #{tree[i/2-1]}, " : ""
  left = tree[i*2-1] ? "left key = #{tree[i*2-1]}, " : ""
  right = tree[i*2] ? "right key = #{tree[i*2]}, " : ""
  puts "node #{i}: key = #{tree[i-1]}, #{parent}#{left}#{right}"
end

Measured memory_bytes: 8720
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pli = pair<ll, int>;
using Graph = vector<vector<pii>>;
const int MOD = 1e9 + 7;

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

    int N, K;
    cin >> N >> K;

    ll ans = 0;
    for (int i = K + 1; i <= N; ++i) {
        ans += N / i * (i - K);
        ans += max(N % i - K + 1, 0);
        if (K == 0)
            ans--;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) FOR(i,0,n)
#define repr(i,n) for(int i=(n)-1;0<=i;--i)
#define each(e,v) for(auto&& e:(v))
#define all(v) begin(v),end(v)
#define dump(x) cerr<<#x<<": "<<(x)<<endl
using namespace std;
using vint = vector<int>;
using ll = long long;
using vll = vector<ll>;
template <class T> void chmin(T& a, const T& b) { a = min(a, b); }
template <class T> void chmax(T& a, const T& b) { a = max(a, b); }
void yes() { cout << "Yes" << endl; exit(0); }
void no() { cout << "No" << endl; exit(0); }

int main() {
    string s, t; cin >> s >> t;
    int l = s.size();
    rep(i, l) {
        bool y = true;
        rep(j, l) {
            if(s[(i + j) % l] != t[j]) { y = false; break; }
        }
        if(y) yes();
    }
    no();
    return 0;
}


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

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

Measured memory_bytes: 3616
<?php
    /*
        Problem URL : http://abc057.contest.atcoder.jp/tasks/abc057_a

        Score  :
        Result :
        Time   : ms
        Memory : KB
     */

    ini_set('error_reporting', E_ALL & ~E_NOTICE);

    // define('DEBUG', true);
    define('DEBUG', false);

    if (DEBUG) {
        $start = microtime(true);
    }
    echo solve() . PHP_EOL;
    if (DEBUG) {
        $t = microtime(true) - $start;
        printf ("Elapsed time: %7.3f sec\n", $t);
    }


    function solve() {
        fscanf(STDIN, "%d %d\n", $A, $B);
        return (($A + $B) % 24);
    }


Measured memory_bytes: 4728
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(), (v).end()
#define siz(v) (ll)(v).size()
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repi(i, x, n) for (ll i = x; i < (ll)(n); i++)
#define lb lower_bound
#define ub upper_bound
typedef pair<ll, ll> P;
typedef pair<ll, ll> PL;
const ll mod = 1000000007;
const ll INF = 1000000099;
vector<ll> dx = {-1, 1, 0, 0}, dy = {0, 0, -1, 1};
//cin.tie(0);ios::sync_with_stdio(false);

signed main()
{
int n;cin>>n;
cout<<n*n*n<<endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<queue>
#include<utility>
#include<cstring>
#include<stack>
#include<algorithm>
#include<cmath>
#include<iostream>
#include<vector>
using namespace std;
#define MAX_N 100001
#define INF 1000000000000000
#define REP(i,COUNT) for(int i=0;i<(int)(COUNT);i++)
struct edge{
  long long int to, cost;
};
typedef vector<vector<edge> > AdjList;
AdjList graph;
typedef pair<long long int, long long int> P;
void init(int n);
int find(int n);
void unite(int x,int y);
bool same(int x, int y);
int dx[4] = {1,0,0,-1};
int dy[4] = {0,1,-1,0};
vector<long long int> dist;
void dijkstra(int n,int s){
  dist = vector<long long int>(n,INF);
  dist[s] = 0;
  priority_queue<P, vector<P> , greater<P> > que;
  que.push(P(0,s));

  while(!que.empty()){
    P p = que.top();
    que.pop();
    int v = p.second;
    if(dist[v] < p.first)
      continue;
    REP(i,graph[v].size()){
      edge e = graph[v][i];
      if(dist[e.to] > dist[v] + e.cost){
        dist[e.to] = dist[v] + e.cost;
        que.push(P(dist[e.to],e.to));
      }

    }

  }
}

int main()
{
  long long int x,y,N,a,b,c,Q,K;
  
  cin >> N;
  graph = vector<vector<edge> >(N+1,vector<edge>(0));
  
  REP(i,N-1){
    cin >> a >> b >> c;
    graph[a].push_back((edge){b,c});
    graph[b].push_back((edge){a,c});
   
  }
  cin >> Q >>  K;
  dijkstra(N+1,K);
  REP(i,Q){
    cin >> x >> y;
    cout << (long long int)(dist[x]) + (long long int)(dist[y]) << endl;
  }
  return 0;
}

int par[MAX_N];
int ranks[MAX_N];

//n要素で初期化
void init(int n){
  REP(i,n){
    par[i] = i;
    ranks[i] = 0;
  }

}

//木の根を求める
int find(int x){
  if(par[x] == x){
    return x;
  }else{
    return par[x] = find(par[x]);
  }
}

void unite(int x,int y){
  x = find(x);
  y = find(y);
  if(x == y) return ;
  if(ranks[x] < ranks[y]){
    par[x] = y;
  }else{
    par[y] = x;
    if(ranks[x] == ranks[y]) ranks[x]++;
  }
}

bool same(int x, int y){
  return find(x) == find(y);
}


Measured memory_bytes: 11120