akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = ReadInt();
            var a = ReadInts();


            double tmp = 0.0;
            for (int i = 0; i < n; i++)
            {
                tmp += 1.0 / a[i];
            }
            WriteLine(1.0/tmp);
        }

        private static string Read() { return ReadLine(); }
        private static string[] Reads() { return (Read().Split()); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }

        public static void debuglist(List<int> x)
        {
            foreach (var item in x)
            {
                WriteLine(item);
            }
        }
        public static void debuglist(List<string> x)
        {
            foreach (var item in x)
            {
                WriteLine(item);
            }
        }
        public static void debugarray(int[] x)
        {
            foreach (var item in x)
            {
                WriteLine(item);
            }
        }
        public static void debugarray(string[] x)
        {
            foreach (var item in x)
            {
                WriteLine(item);
            }
        }

        public static bool IsPrime(int num)
        {
            if (num < 2) return false;
            else if (num == 2) return true;
            else if (num % 2 == 0) return false;

            double sqrtNum = Sqrt(num);
            for (int i = 3; i <= sqrtNum; i += 2)
            {
                if (num % i == 0)
                {
                    return false;
                }
            }
            return true;
        }

        //最大公約数
        public static int Gcd(int a, int b)
        {
            if (a < b)
            {
                return Gcd(b, a);
            }
            while (b != 0)
            {
                var reminder = a % b;
                a = b;
                b = reminder;
            }
            return a;
        }

        //最小公倍数
        public static int Lcm(int a, int b)
        {
            return a * b / Gcd(a, b);
        }

        //文字数を数える
        public static int CountChar(string s, char c)
        {
            return s.Length - s.Replace(c.ToString(), "").Length;
        }
    }
}


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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------


string S,T;
int nex[201010][26];
int A,B;

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>S>>T;
	A=S.size();
	B=T.size();
	S=S+S;
	FOR(j,26) nex[2*A][j]=2*A;
	for(i=2*A-1;i>=0;i--) {
		FOR(j,26) nex[i][j]=nex[i+1][j];
		nex[i][S[i]-'a']=i+1;
	}
	
	ll cur=0;
	FORR(c,T) {
		c-='a';
		x=cur%A;
		if(nex[x][c]==2*A) return _P("-1\n");
		cur+=nex[x][c]-x;
	}
	cout<<cur<<endl;
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 20972
#include<bits/stdc++.h>
#define Mx 1000000000005 
#define ll long long  
#define pi 3.141592653
#define vi vector<ll>
#define Mo 1000000007
#define mp make_pair
#define M map<ll,ll>
#define fr(i,a,b) for(ll i=a;i<b;i++)
#define vii vector<pair<ll,ll> > 
#define fi first
#define se second
#define pb push_back
#define ld long double
#define fill(a,x) memset(a,x,sizeof(a))
using namespace std;
bool comp(const pair<ll,ll> &a, const pair<ll,ll> &b)
{
  return a.second<b.second;
}
/*vi b=v;
   sort(b.begin(), b.end());
  b.resize(unique(b.begin(), b.end()) - b.begin());
  ll t; cin>>t; fr(f,0,t){ 
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
 */
vector<vector<ll> > dp(3001, vector<ll>(3001,0));
int main()
{
  string a,b; cin>>a>>b;
  ll n=a.length(),m=b.length();

  fr(i,1,n+1)
  {
    fr(j,1,m+1)
    {
      if(a[i-1]==b[j-1]) dp[i][j]=1+dp[i-1][j-1];
      else dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
    }
  }

  ll l=dp[n][m],i=n,j=m;
  string s="";
  
  while(i>0 && j>0)
  {
    if(a[i-1]==b[j-1])
    {
      s+=a[i-1]; i--; j--;
    }
    else if(dp[i-1][j]>=dp[i][j-1])
      i--;
    else j--;
  }

  reverse(s.begin(),s.end());
  cout<<s;
}

Measured memory_bytes: 73480
#include<iostream>
#include<algorithm>
#include<cstdio>

using namespace std;

int main(){
    int N;
    cin >> N;
    long long a[N];
    int c=0;
    for(int i=0;i<N;i++) {
        scanf("%lld",&a[i]);
        if(a[i]%2) c++;
    }
    cout << (!(c%2)?"YES":"NO")<<endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    double heikin = 0;
    int heikin_a = 0;
    int ans=0;
    rep(i,n){
        cin >> a[i];
        heikin += a[i];
        heikin_a += a[i];
    }
    heikin /= n*1.0;
    if(heikin - heikin_a/n > 0.5){
        heikin_a = heikin_a / n + 1;
    }
    else{
        heikin_a = heikin_a / n;
    }
    
    rep(i,n){
        ans += pow((a[i] - heikin_a),2);
    }
    cout << ans << endl;
    
    
}

Measured memory_bytes: 256
using namespace std;
#include <bits/stdc++.h>
#define frr(i, r, l) for(int i = r; i >= l; --i)
#define fr(i, l, r) for(int i = l; i < r; ++i)
#define forit(it, type, var) for(type::iterator it = var.begin(); it != var.end(); it++)
#define ii pair<int, int>
#define iii pair<int, ii>
#define MEMS(a,b) memset(a,b,sizeof(a))
#define fi first
#define se second
#define m_p make_pair
#define pb push_back
#define ll long long
#define ld long double
typedef pair<ll, ll> iPair; 
priority_queue< ll, vector <ll> , greater<ll>>pq1,pq2;
#define maxN 1000000000000000000
ll power(ll a,ll b){ll res=1;while(b>0){res*=a;b--;}return res;}
ll n,j,done[1000005]={0},st[1000005];
int main()
{
    
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin>>n;
    fr(i,2,1000000)
    {
        if(done[i]==0)
        {
            for(j=i;j<=1000000;j=j+i)
            {
                st[j]=i;
                done[j]++;
            }
        }
    }
    ll ans=0;
    if(n==1)
    {
        cout<<"1"<<endl;
        return 0;
    }
    st[1]=1;
    fr(i,1,n)
    {
        ll st1=n-i,temp=1;
        while(st1>1)
        {
            ll fl=st[st1],cnt=0;
            while(st1%fl==0)
            {
                cnt++;
                st1/=fl;
            }
            temp=temp*(cnt+1);
        }
        ans+=temp;
      //  cout<<ans<<endl;
    }
    cout<<ans<<endl;
    return 0;
}

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

int main() {
  int h, m, s;

  cin >> h;
  s = h % 60;
  h /= 60;
  m = h % 60;
  h /= 60;

  cout << h << ":" << m << ":" << s << endl;

  return 0;
}
  

Measured memory_bytes: 1168
#include <iostream>
#include <vector>
#include<iomanip>
#include <algorithm>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);i++)

int N, A, B;
int main(int argc, const char * argv[]) {
    cin >> N >> A >> B;
    
    cout << min(N*A, B) << endl;
    return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-

import sys

a = int(raw_input().split()[0])
b = int(raw_input().split()[0])
c = int(raw_input().split()[0])
x = int(raw_input().split()[0])
n = 0
for an in range(0, a + 1):
    if 500*an > x:
        break
    for bn in range(0, b + 1):
        if (500*an + 100*bn) > x:
            break
        for cn in range(0, c + 1):
            if (500*an + 100*bn + 50*cn) > x:
                break
            if (500*an + 100*bn + 50*cn) == x:
                n += 1
              
sys.stdout.write('%d\n' % n)
sys.stdout.flush()


Measured memory_bytes: 2568
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner scanner = new Scanner(System.in);
    int number1 = scanner.nextInt();
	long[] number2 = new long[87];
    number2[0] = 2;
    number2[1] = 1;
    
    for(int i = 2; i < 87; i++){
      number2[i] = number2[i-1]+number2[i-2];
    }
    System.out.println(number2[number1]);
    scanner.close();
  }
}

Measured memory_bytes: 22740
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using PLL = pair<ll, ll>;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repn(i,n) for(int i = 0; i <= (int)(n); i++)
#define srep(i,l,n) for(int i = l; i < (int)(n); i++)
#define srepn(i,l,n) for(int i = l; i <= (int)(n); i++)
#define drep(i,n) for(int i = (int)(n-1); i >= 0; i--)
#define drepn(i,n) for(int i = (int)(n); i >= 0; i--)
#define size(s) (int)s.size()
#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }
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; }
template<class T = int> using V = vector<T>;
template<class T = int> using VV = vector<V<T>>;
bool isIn(int i, int j, int h, int w) {return i >= 0 && i < h && j >= 0 && j < w;}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void err() {cout << -1 << endl;}
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
#define ep emplace_back

const int MOD = 1000000007;
const int INF = 1e9;

#define PI acos(-1);
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int ddx[8] = {1,1,1,-1,-1,-1,0,0};
int ddy[8] = {0,1,-1,0,1,-1,1,-1};

const int mxN = 1e5 + 5;
V<> g[mxN];
int dist[mxN] = {0}, ans[mxN] = {0};

void dfs1(int idx, int par) {
    for(auto &to : g[idx]) {
        if(to == par) continue;
        dfs1(to, idx);
        chmax(dist[idx], dist[to] + 1);
    }
}

void dfs2(int idx, int d_par, int par) {
    V<P> d_child;
    d_child.emplace_back(0, -1);
    for(auto &to : g[idx]) {
        if(to == par) d_child.emplace_back(d_par+1, to);
        else d_child.emplace_back(dist[to]+1, to);
    }
    sort(rall(d_child));
    ans[idx] = d_child[0].first;
    for(auto &to : g[idx]) {
        if(par == to) continue;
        dfs2(to, d_child[d_child[0].second == to].first, idx);
    }
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    rep(i, n-1) {
        int a,b;
        cin >> a >> b;
        a--, b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    dfs1(0, -1);
    dfs2(0, 0, -1);
    rep(i, n) {
        cout << 2 * (n - 1) - ans[i] << endl;
    }
}


Measured memory_bytes: 28128
k = int(input())

def listappend(list, length):
    templist = [i for i in list if i >= 10 ** (length - 1)]
    for x in templist:
        if x % 10 != 0: list.append(x * 10 + x % 10 - 1)
        list.append(x * 10 + x % 10)
        if x % 10 != 9 : list.append(x * 10 + x % 10 + 1)
    return list

list = [i + 1 for i in range(9)]
numList = [i + 1 for i in range(9)]
for x in numList:
    list.append(x * 10 + x - 1)
    list.append(x * 10 + x)
    if x != 9 : list.append(x * 10 + x + 1)
for x in range(11):
    if x == 0 or x == 1: continue
    list = listappend(list, x)
list.sort()
print(list[k - 1])

Measured memory_bytes: 30064
N = int(input())
A = [int(x) for x in input().split()]

def solve(A):
    def cost(x):
        return sum((x -a)**2 for a in A)
    l = min(A)
    r = max(A)

    l = -100
    r = 100
    while r - l >= 3:
        d = (r - l) // 3
        m1 = l + d
        m2 = m1 + d
        #print(cost(l), cost(r), "d=%d"%d, (l, m1, m2, r))
        L = [(cost(l), l), (cost(r), r), (cost(m1), m1), (cost(m2), m2)]
        #print(L)
        (_, r), (_, l) = sorted(L)[:2]
        if l > r:
            r, l = l, r
        #print("l=%d, r=%d" % (l,r))
    c, a = sorted([(cost(i), i)for i in range(l, r+1)])[0]
    print(c)


solve(A)


Measured memory_bytes: 3064
def main():
    N, M, X = map(int, input().split())
    C = [0] * N
    A = [[] for _ in range(N)]
    for i in range(N):
        C[i], *A[i] = map(int, input().split())

    ans = float('inf')
    for i in range(1<<N):
        score = [0] * M
        tmp = []
        money = 0
        for j in range(N):
            if (i >> j) & 1:
                tmp.append(j)
                money += C[j]
        
        for t in tmp:
            for k in range(len(A[t])):
                score[k] += A[t][k]
        flag = True
        for s in score:
            if s < X:
                flag = False

        if flag:
            ans = min(ans, money)
    if ans == float('inf'):
        print(-1)
    else:
        print(ans)



if __name__ == "__main__":
    main()

Measured memory_bytes: 74000
def main():
  N, K = [int(n) for n in input().split(" ")]

  mul_K = int(N/K)

  if K % 2 == 1:
    print(mul_K ** 3)
    return 0
  
  mul_K_half = int(2 * N/K)
  mul_K_half_but_K = mul_K_half - mul_K
  print(mul_K ** 3 + mul_K_half_but_K ** 3)
  return 0

main()

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

int rect(int h, int w){
  for (int k = 0; k < h; k++) {
    for (int i = 0; i < w; i++) {
      if (k == 0 or k == h-1 or i == 0 or i == w-1) cout << "#";
      else cout << ".";
    }
    cout << endl;
  }

  cout << endl;
  return 0;
}

int main() {
  int a, b;
  for (;;) {
    cin >> a >> b;
    if (a == 0 && b == 0) break;

    rect(a, b);
  }

  return 0;
}



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

signed main(){
  string s;cin>>s;
  int ans=0;
  int n=s.size();
  for(int i=0;i<n/2;i++){
    if(s[i]!=s[n-i-1])ans++;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <tuple>
#include <sstream>
#include <typeinfo>
#include <fstream>
#include <random>
#include <queue>
#include <deque>
#include <iterator>
#include <map>
#include <functional>
#include <numeric>
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 FORR(i, m, n) for(int i = m;i >= n;i--)
#define pb(a) push_back(a)
#define llong long long
#define INF 1145141919
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
int dy[] = { 1, 0, -1, 0 };
int dx[] = { 0, 1, 0, -1 };
template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }

int main() {
	int n;
	cin >> n;
	vector<int> v(n);
	for (int i = 0; i < n; i++) {
		cin >> v[i];
	}
	auto it = max_element(v.begin(), v.end());
	*it /= 2;
	cout << accumulate(v.begin(), v.end(), 0) << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int cnt=0,a[10001]={0},n;
int mid(int a,int b,int c){
	if(a<b&&a>c){
		return a;
	}
	if(a<c&&a>b){
		return a;
	}
	if(b<c&&b>a){
		return b;
	}
	if(b<a&&b>c){
		return b;
	}
	if(c<a&&c>b){
		return c;
	}
	if(c<b&&c>a){
		return c;
	}
} 
int main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	for(int i=2;i<=n-1;i++){
		if(mid(a[i],a[i-1],a[i+1])==a[i])cnt++;
	}
	cout<<cnt;
	return 0;
} 

Measured memory_bytes: 256
n,a = map(int,input().split())
x = list(map(int,input().split()))

#dp[j][k][s] = (x0...xj からk枚選んでxiの合計をsにするような選び方の総数)
dp = [[[0]*(a*n+1) for k in range(n+1) ] for j in range(n)]

dp[0][0][0] = 1
if x[0]<= a*n:
    dp[0][1][x[0]] = 1
    
for j in range(n-1):
    for k in range(n+1):
        for s in range(a*n+1):
            if k == 0 and s == 0:
                dp[j+1][k][s] = 1
            elif k>j+2:
                dp[j+1][k][s]=0
            elif s>=x[j+1] and k>= 1:
                dp[j+1][k][s]=dp[j][k][s] + dp[j][k-1][s-x[j+1]]
            else:
                dp[j+1][k][s]=dp[j][k][s]

res = 0
for i in range(1,n+1):
    res += dp[n-1][i][a*i]

print(res)

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

using namespace std;
typedef long long ll;
#define tr(container, it) \
	for (auto it = container.begin(); it != container.end(); it++)
#define scontains(c,x) ((c).find(x) != (c).end())   //O(log n) 
#define contains(c,x) (find((c).begin(),(c).end(),x) != (c).end()) //O(n)
#define Ichar(_x) char _x;scanf("%c",&_x);
#define Iint(_x) int _x;scanf("%d",&_x); 
#define Ill(_x)  ll _x;scanf("%lld",&_x);
#define inc(a,b,x)(x)>a && (x)<b	
#define incE(a,b,x)(x)>=a && (x)<=b	
#define max(a,b) (a)>=(b)? (a) : (b) 
#define fileio freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
const double pi = 3.14159265358979323846;

int main()
{
	ll s = 0;
	Iint(a);
	Iint(b);
	Iint(c);
	for (int i = 0; i < pow(10, 12); ++i)
	{
		s += i;
	}
	if(c>=a && c<=a+b)std::cout << "YES";
	else { std::cout << "NO"; }


	
}






Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const int MOD = 1000000007;
const long long INF = 1LL << 60;

ll nCr(ll n, ll r)
{
    ll num = 1;
    for (ll i = 1; i <= r; i++)
    {
        num = num * (n - i + 1) / i;
    }
    return num;
}

int main()
{
    string s;
    cin >> s;
    ll n = s.length();
    reverse(s.begin(), s.end());
    int x = 1;
    int tot = 0;
    vector<int> cnt(2019);
    ll ans = 0;
    rep(i, n)
    {
        cnt[tot]++;
        tot += (s[i] - '0') * x;
        tot %= 2019;
        ans += cnt[tot];
        x = x * 10 % 2019;
    }

    cout << ans << endl;
}

//sunuke

Measured memory_bytes: 3600
n, x, y = map(int, input().split())
ans = [0] * (n-1)
for i in range(1, n):
    for j in range(i+1, n+1):
        # iとjを固定、rangeでi<jを表現
        d = min(j-i, abs(x-i)+abs(j-y)+1, abs(y-i)+abs(x-j)+1)
        # 長さを示すところに+１
        ans[d-1] += 1
print(*ans, sep="\n")

Measured memory_bytes: 3444
#include <bits/stdc++.h>
using namespace std;
#include <iostream>
/*cout <<"Debug"
cout <<x-30<<' '<<y-30<<endl;*/
typedef pair<pair<int ,int>, int> P;
vector<pair<pair<int ,int>, int> > v_ans;
vector<int>v_taro;
vector<int>v_hana;
/*taro tenn,hanako_ten,sum*/

bool cmp(P h, P r){
  return h.second < r.second;
}
int main(){
  string n;
  int s = 0;
  string ans = "Yes";
  cin >>n;
  int N = stoi(n);

  for(int i = 0;i<(int)n.size();i++){
    s += n[i]-'0';
  }
  if(N%s != 0){
    ans = "No";
  }
  cout <<ans<<endl;

  return 0;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;

public class Main {
    public static PrintWriter out;
    public static FastScanner in;

    private void solve(){
        long[][] comb = new long[51][51];

        for(int i=0;i<=50;i++){
            comb[i][0]= 1;
            for(int j=1;j<=i;j++){
                comb[i][j] = comb[i-1][j-1]+comb[i-1][j];
            }
        }

        int n = in.nextInt();
        int a = in.nextInt();
        int b = in.nextInt();

        List<Long> list = new ArrayList<>();
        for(int i=0;i<n;i++){
            list.add(in.nextLong());
        }

        Collections.sort(list,Collections.reverseOrder());
        long sum = 0,last = -1;
        for(int i=0;i<a;i++){
            sum+=list.get(i);
            last = list.get(i);
        }

        out.printf("%.6f\n",sum/(double)a);

        int count = 0,other = 0;
        for(int i=0;i<n;i++){
            if(list.get(i) == last){
                count++;
            }
            if(list.get(i) > last){
                other++;
            }
        }
        long ret = 0;
        if(other == 0){
            for(int i=a;i<=b;i++){
                if(count >=i){
                   ret+=comb[count][i];
                }
            }
        }else{
            ret+= comb[count][a-other];
        }

        out.print(ret);
    }

    private void runIO() {
        in = new FastScanner();
        out = new PrintWriter(new BufferedOutputStream(System.out));
        solve();
        out.close();
    }
    private static class FastScanner {
        BufferedReader bufferedReader;
        StringTokenizer stringTokenizer;

        private FastScanner() {
            bufferedReader = new BufferedReader(new InputStreamReader(System.in));
        }

        private String next() {
            if (stringTokenizer == null || !stringTokenizer.hasMoreElements()) {
                try {
                    stringTokenizer = new StringTokenizer(bufferedReader.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return stringTokenizer.nextToken();
        }

        private int nextInt() {
            return Integer.parseInt(next());
        }

        private long nextLong() {
            return Long.parseLong(next());
        }

        private String nextLine() {
            String ret = "";
            try {
                ret = bufferedReader.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return ret;
        }
    }

    public static void main(String[] args) {
        new Main().runIO();
    }
}


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

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


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

int main(){

  int n;
  cin>>n;
  int p[n];
  for(int i=0;i<n;i++)cin>>p[i];

int cnt=0;

  for(int i=0;i<n-2;i++){
      if(p[i]<p[i+1] && p[i+1]<p[i+2])cnt+=1;
      else if(p[i]>p[i+1] && p[i+1]>p[i+2])cnt+=1;
  }

  cout<<cnt<<endl;

return 0;
}

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

int main(){
  int x = 0;
  cin >> x;
  if(400 <= x && x <= 599) cout << "8" << endl;
  else if(600 <= x && x <= 799) cout << "7" << endl;
  else if(800 <= x && x <= 999) cout << "6" << endl;
  else if(1000 <= x && x <= 1199) cout << "5" << endl;
  else if(1200 <= x && x <= 1399) cout << "4" << endl;
  else if(1400 <= x && x <= 1599) cout << "3" << endl;
  else if(1600 <= x && x <= 1799) cout << "2" << endl;
  else if(1800 <= x && x <= 1999) cout << "1" << endl;
  return 0;
}

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

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

int main() {
  int n;
  cin >> n;
  vector<int> x(n+1);
  for (int i = 0; i < n+1; i++) {
    cin >> x.at(i);
  }
  
  sort(x.begin(),x.end());
  int GCD = x.at(1) - x.at(0);
  for (int i = 1; i < n; i++) {
    GCD = gcd(x.at(i+1) - x.at(i),GCD);
  }

  cout << GCD << endl;
  return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#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, a, b) for (int i = a; i < b; ++i)
#define FORR(i, a, b) for (int i = b - 1; i >= a; --i)
#define SORT(v) sort(v.begin(), v.end())
#define SORTR(v) sort(v.rbegin(), v.rend())
#define REV(v) reverse(v.begin(), v.end())
#define ITER(itr, v) for (auto itr = v.begin(); itr != v.end(); ++itr)
#define LB(v, x) (lower_bound(v.begin(), v.end(), x) - v.begin())
#define UB(v, x) (upper_bound(v.begin(), v.end(), x) - v.begin())
#define SZ(v) (int)v.size()
using namespace std;
using ll = long long;
using P = pair<int, int>;

class Main {
    int N;
    vector<int> A;
    void input() {
        cin >> N;
        A.resize(N);
        REP(i, N) { cin >> A[i]; }
    }
    void output() {
        vector<int> dp(N, INT_MAX);
        REPR(i, N) { *upper_bound(dp.begin(), dp.end(), A[i]) = A[i]; }
        cout << LB(dp, INT_MAX) << endl;
    }

public:
    Main() {
        input();
        output();
    }
};

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

    Main();

    return 0;
}


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

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

  vector<int> A(N,0);
  vector<int> A2(N,0);
  vector<int> B(N,0);
  int x;
  for (int i = 0; i < N; i++) {
    cin >> x;
    A.at(x-1)++;
    A2.at(i) = x;
  }  
  for (int i = 0; i < N; i++) {
    cin >> x;
    B.at(x-1)++;
  }
  
  int m=0;
  int n=0;
  for (int i = 0; i < N; i++) {
    if (m < A.at(i)+B.at(i)) {
      m = A.at(i)+B.at(i);
      n = i;
    }
  }
  
  if (m>N) {
    cout << "No" << endl;
  }
  else {
    cout << "Yes" << endl;
    
    vector<int> B2(N,0);
    
    int x=0;
    for (int i = 0; i <= n; i++) {
      x += A.at(i);
    }
    int x2 = x-1;
    if (x == N) {
      x = 0;
    }
    
    for (int i = 0; i < N; i++) {
      while (B.at(n) == 0) {
        n++;
        if (n == N) {
          n = 0;
        }
      }      
      B2.at(x) = n+1;
      B.at(n)--;
      x++;
      if (x == N) {
        x = 0;
      }
    }
    
    int z;
    bool check = true;
    while (check) {
      check = false;
      for (int i = 0; i < N; i++) {
        if (A2.at(i)==B2.at(i)) {
          if (x2 == -1) {
            x2 = N-1;
          }
          check = true;
          z = B2.at(x2);
          B2.at(x2) = B2.at(i);
          B2.at(i) = z;
          x2--;
        }
      }
    }
    
    
    

    
    for (int i = 0; i < N; i++) {
      cout << B2.at(i);
      if (i < N-1) {
        cout << ' ';
      }
      else {
        cout << endl;
      } 
    }
    
  }

return 0;
}

Measured memory_bytes: 6396
#include<bits/stdc++.h>
using namespace std;
int const nax = 3e5 + 10;

int main () {
    char s[3];
    cin >> s;

    for (int i = 0 ; i < 3 ; ++ i) {
        if (s[i] == '7')
            return !printf("Yes");
    }
    printf("No");
}
/*
    Good Luck
        -Lucina
*/


Measured memory_bytes: 3764
#include<bits/stdc++.h> 
using namespace std;
string s, t;
set<string> S;
void Work()
{
    int lens = s.size();
    int lent = t.size();
    for(int i = 0; i < lens; i++)
    {
        if(s[i] == '?' || s[i] == t[0])
        {
            string tmp = s;
            for(int j = 0; j < i; j++)
                if(tmp[j] == '?')
                    tmp[j] ='a';    
            bool can = false;
            for(int j = 0; j < lent; j++)
            {

                if(tmp[i+j]!= '?' && tmp[i+j] != t[j])
                    break;
                tmp[i+j] = t[j];
                if(j == lent - 1) can = true;
            }
            if(can)
            {
                for(int j = i + lent; j < lens; j++) if(tmp[j] == '?') tmp[j] = 'a';//处理匹配后的字符
                S.insert(tmp);
            }
        }
    }
    if(S.size() == 0) cout << "UNRESTORABLE" << endl;
    else cout << *S.begin() << endl;
}
int main()
{
    cin>>s>>t;
    Work();
}

Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-9;
const double PI=acos(-1.0);
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
double ABS(double a){return max(a,-a);}
 
char in[55];
int main(){
	int a,b;scanf("%d%d",&a,&b);
	scanf("%s",in);
	in[b-1]+=32;
	printf("%s\n",in);
}

Measured memory_bytes: 128
N,M = map(int, input().split())
H = list(map(int, input().split()))
Q = [list(map(int, input().split())) for _ in range(M)]
H_ = [False for i in range(N)]

for q in Q:
  if H[q[0] -1] > H[q[1] -1]:
    H_[q[1]-1] = True
  elif H[q[0] -1] < H[q[1] -1]:
    H_[q[0]-1] = True
  else:
    H_[q[1]-1] = True
    H_[q[0]-1] = True
    
print(N - sum(H_))


Measured memory_bytes: 98776
n, m = map(int, input().split())
mod = 1000000007
a = [True] * (n + 1)
for i in range(m):
    a[int(input())] = False
dp = [0] * (n + 1)
dp[0] = 1

dp[1] = dp[0] if a[1] else 0

for i in range(2, n + 1):
    if a[i]:
        dp[i] = (dp[i - 1] + dp[i - 2]) % mod

print(dp[n])


Measured memory_bytes: 7668
import java.util.*;

public class Main {
	public static void main(String[] args){
			
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		
		ArrayList<String> x = new ArrayList<String>();
		int i;
		long count = 0, countM = 0, countA = 0, countR = 0, countC = 0, countH = 0;
		for(i = 0; i < N; i++){
			String name = sc.next();
			char c = name.charAt(0);
			if(c == 'M'){
				countM++;
				count++;
			}else if(c == 'A'){
				countA++;
				count++;
			}else if(c == 'R'){
				countR++;
				count++;
			}else if(c == 'C'){
				countC++;
				count++;
			}else if(c == 'H'){
				countH++;
				count++;
			}
		}
		
		if(count == 0){
			System.out.println(0);
		}else{
			long ans = countM * (countA *(countR + countC + countH) + countR *(countC + countH) + countC * countH) + countA *(countR * (countC + countH) + countC * countH) + countR * countC * countH; 
			System.out.println(ans);
		}
	}
}


Measured memory_bytes: 46504
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <map>

#define reps(i,s,n) for(int (i) = (s); (i) < (n); (i)++)
#define rep(i,n) reps(i,0,n)
using namespace std;
using ll = long long;

int main(){
    int n;
    cin >> n;
    //vactor<int> H(n);
    int max=0;
    
    int ans = 0,tmp = 0;
    rep(i,n){ 
        cin >> tmp;
        if(max <= tmp){
            max = tmp;
            ans++;
        }
    }
    
    cout << ans << endl;

    return 0;
}

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

using namespace std;

int solve(int x, int y, vector<int> &a, int l, int r, vector<pair<int, int>> &res) {
	for (int i = l; i < r; i++) {
		if (a[i] < 0) {
			res.push_back(make_pair(x, y));
			x -= y;
			y = a[i];
		} else {
			res.push_back(make_pair(y, x));
			y -= x;
			x = a[i];
		}
	}
	res.push_back(make_pair(x, y));
	return x - y;
}

int main() {
	int n;
	cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	sort(a.begin(), a.end());
	vector<pair<int, int>> res;
	int ans;
	if (a[0] * a[n - 1] <= 0) {
		ans = solve(a[n - 1], a[0], a, 1, n - 1, res);
	} else {
		if (a[0] < 0) {
			ans = solve(a[n - 1], a[n - 2], a, 0, n - 2, res);
		} else {
			ans = solve(a[1], a[0], a, 2, n, res);
		}
	}
	cout << ans << endl;
	for (int i = 0; i < res.size(); i++) {
		cout << res[i].first << " " << res[i].second << endl;
	}
	return 0;
}

Measured memory_bytes: 3188
#include <cstdio>
#include <cmath>
#include <cstring>
#include <ctime>
#include <climits>
#include <iostream>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <vector>
#include <sstream>
#include <typeinfo>
#include <fstream>

#define DIV 1000000007

using namespace std;

long long H, W, K;

int erase(vector<vector<int> > ban, int y, int x){

	int ret = 0;

	//first erase
	ban[y][x] = 0;




	int chain = 0;
	while(true){

		//drop to ground
		for(int xpos = 0; xpos < W; xpos++){
			while(true){
				bool update = false;
				int erasepos = -1;
				for(int ypos = H-1; ypos >= 0; ypos--){
					if(ban[ypos][xpos] == 0){
						erasepos = ypos;
						break;
					}
				}
				if(erasepos == -1){
					break;
				}
				for(int ypos = erasepos - 1; ypos >= 0; ypos--){
					if(ban[ypos][xpos] != 0){
						update = true;
						swap(ban[ypos][xpos], ban[erasepos][xpos]);
						break;
					}
				}
				if(update == false){
					break;
				}
			}
		}




		bool update = false;

		//erase
		for(int ypos = 0; ypos < H; ypos++){
			for(int xpos = 0; xpos < W; xpos++){
				if(ban[ypos][xpos] == 0){
					continue;
				}
				int sum = 0;
				int xend;
				for(int xx = xpos; xx < W; xx++){
					if(ban[ypos][xpos] == ban[ypos][xx]){
						sum++;
						xend = xx;
					}else{
						break;
					}
				}
				if(sum >= K){
					update = true;
					ret += pow(2, chain) * sum * ban[ypos][xpos];
					for(int xx = xpos; xx <= xend; xx++){
						ban[ypos][xx] = 0;
					}
				}
			}
		}


		if(update == false){
			break;
		}
		chain++;
	}
	return ret;
}


int main(){
	cin >> H >> W >> K;
	vector<vector<int> > ban;
	for(int i = 0; i < H; i++){
		vector<int> tmp;
		for(int j = 0; j < W; j++){
			int t;
			scanf("%1d", &t);
			tmp.push_back(t);
		}
		ban.push_back(tmp);
	}


	int maxi = 0;

	for(int i = 0; i < H; i++){
		for(int j = 0; j < W; j++){
			maxi = max(maxi, erase(ban, i, j));
		}
	}

	cout << maxi << endl;




}



Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>

int main()
{
	int n;
	std::cin>>n;
	for(int i=1;i<=n;i++)
	{
	    if(i%3==0)
	    {
	        std::cout<<" "<< i;
	        continue;
	    }
	    int a=i;
	    while(a>0)
	    {
	        if(a%10==3)
	        {
	            std::cout<<" "<< i;
	            break;    
	        }
	        a/=10;
	    }
	}
	std::cout<<"\n";
}


Measured memory_bytes: 3092
import sys
input = sys.stdin.readline

N, L = map(int, input().split())
taste = [0]*N
taste2 = [0]*N

for i in range(N):
    taste[i] = L + (i+1) - 1
    taste2[i] = abs(L + (i+1) - 1)
eat = min(taste2)
taste.pop(taste2.index(eat))
print(sum(taste))


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

int main()
{
    int N;
    string S;
    cin >> N >> S;
    vector<bool> is_done(100, false);

    long ans = 0;
    for (int i = 0; i < N; i++)
    {
        for (int j = i + 1; j < N; j++)
        {
            int num100 = S[i] - '0';
            int num10 = S[j] - '0';
            if (!is_done[10 * num100 + num10])
            {
                int count = 0;
                vector<bool> is_count(10, false);
                for (int k = j + 1; k < N; k++)
                {
                    if (!is_count[S[k] - '0'])
                    {
                        is_count[S[k] - '0'] = true;
                        ans++;
                    }
                }
                is_done[10 * num100 + num10] = true;
            }
        }
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define		ll		         long long int
#define		N		         100005
#define		ff 	             first
#define		ss		         second


int main()
{
    ll n;
    cin>>n;
    if(n<1200)
        cout<<"ABC"<<endl;
    else if(n<2800)
        cout<<"ARC"<<endl;
    else
        cout<<"AGC"<<endl;
	return 0;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define RS(X) scanf("%s", (X))
#define CASET int ___T, case_n = 1; scanf("%d ", &___T); while (___T-- > 0)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define PII pair<int,int>
#define VI vector<int>
#define VPII vector<pair<int,int> >
#define PLL pair<long long,long long>
#define VPLL vector<pair<long long,long long> >
#define F first
#define S second
typedef long long LL;
using namespace std;
const int MOD = 1e9+7;
const int SIZE = 1e6+10;
void print_array(vector<int>&arr){
    REP(i,SZ(arr)){
        printf("%d\n",arr[i]);
    }
}
int main(){
    DRI(N);
    VI an;
    int big=1;
    while(big*(big+1)/2<N)big++;
    int now=0,v=big;
    while(now<N){
        an.PB(min(v,N-now));
        now+=min(v,N-now);
        v--;
    }
    reverse(ALL(an));
    print_array(an);
    return 0;
}


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

#define ll long long int
#define ull unsigned long long int
#define db double
#define ld long double
#define MOD 1000000007
#define inf (1LL << 62)
#define pi acos(-1.0)
#define si(a) scanf("%lld",&a)
#define sd(n) scanf("%lf", &n)
#define for1(i, stop) for(ll i = 1; i <= stop; i++)
#define for0(i, stop) for(ll i = 0; i < stop; i++)
#define rep1(i, start) for(ll i = start; i >= 1; i--)
#define rep0(i, start) for(ll i = (start-1); i >= 0; i--)
#define loop(i, start, stop, inc) for(ll i = start; i <= stop; i += inc)
#define pb(v,a) v.push_back(a)
#define pll pair <ll, ll>
#define mp make_pair
#define pbp(v,a,i) v.push_back(make_pair(a,i))
#define srt(v) sort(v.begin(),v.end())
#define rv(v) reverse(v.begin(),v.end())
#define ms(n, i) memset(n, i, sizeof(n))
#define debug printf("Debug\n");
#define en '\n'



#define _fastio  ios_base:: sync_with_stdio(false); cin.tie(0); cout.tie(0);
/*typedef tuple<ll,ll,ll>tpl;

ll bigmod(ll n,ll pow)
{
    if(pow==0)
        return 1;
    if(pow==1)
        return n%MOD;

    ll ans=bigmod(n,pow/2);
    ans=(ans*ans)%MOD;

    if(pow%2==1)
    {
        ans=(ans*n)%MOD;
    }
    return ans%MOD;
}

ll fact[1000005];

ll nCr(ll n,ll r)
{

    ll ans=fact[n];
    ans=(ans*bigmod(fact[r],MOD-2))%MOD;
    ans=(ans*bigmod(fact[n-r],MOD-2))%MOD;
    return ans;
} */

int main()
{
    _fastio
    string s,t;
    cin>>s>>t;
    ll mn=MOD,j,k;

    for(ll i=0;i<=s.size()-t.size();i++)
    {
        ll cn=0;
        for(j=i,k=0;k<t.size();j++,k++)
        {
            if(s[j]!=t[k])
                cn+=1;
        }
        //cout<<i<<" "<<cn<<en;
        mn=min(mn,cn);
    }
    cout<<mn<<en;
}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
#define rep0(i, n) for (int i = 0; i < (n); ++i)
#define rep1(i, n) for (int i = 1; i <= (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef tuple<string,int, int> TU;

int main()
{
    int A,B;
    cin >> A >> B;
    int res = 0;
    if(A<B){
        res+=B;
        B--;
    }else{
        res+=A;
        A--;
    }
    if(A<B){
        res+=B;
        B--;
    }else{
        res+=A;
        A--;
    }
    cout << res;
}


Measured memory_bytes: 3620
/*
confirm 0LL and 1LL
confirm cornercases such as 0
confirm times of cin < 10^6
*/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Pld = pair<ld, ld>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecD = vector<ld>;
using VecS = vector<string>;
using Graph = vector<VecP>;
template <typename T>
using Vec1 = vector<T>;
template <typename T>
using Vec2 = vector<Vec1<T> >;
#define REP(i, m, n) for(ll i = (m); (i) < (n); ++(i))
#define REPN(i, m, n) for(ll i = (m); (i) <= (n); ++(i))
#define REPR(i, m, n) for(ll i = (m)-1; (i) >= (n); --(i))
#define REPNR(i, m, n) for(ll i = (m); (i) >= (n); --(i))
#define rep(i, n) REP(i, 0, n)
#define repn(i, n) REPN(i, 1, n)
#define repr(i, n) REPR(i, n, 0)
#define repnr(i, n) REPNR(i, n, 1)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define fs first
#define sc second
template <typename T>
bool chmax(T &a, const T b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T b){if(a > b){a = b; return true;} return false;}
template <typename T>
ll pow2(const T n){return (1LL << n);}
template <typename T>
void cosp(const T n){cout << n << ' ';}
void co(void){cout << '\n';}
template <typename T>
void co(const T n){cout << n << '\n';}
template <typename T1, typename T2>
void co(pair<T1, T2> p){cout << p.fs << ' ' << p.sc << '\n';}
template <typename T>
void co(const Vec1<T> &v){for(T i : v) cosp(i); co();}
template <typename T>
void co(initializer_list<T> v){for(T i : v) cosp(i); co();}
template <typename T>
void ce(const T n){cerr << n << endl;}
void sonic(){ios::sync_with_stdio(false); cin.tie(0);}
void setp(const ll n){cout << fixed << setprecision(n);}
constexpr int INF = 1e9+1;
constexpr ll LINF = 1e18+1;
constexpr ll MOD = 1e9+7;
//constexpr ll MOD = 998244353;
constexpr ld EPS = 1e-11;
const ld PI = acos(-1);

int main(void){
	ll n;
	cin >> n;
	Vec p(n);
	rep(i, n) cin >> p[i];
	VecP a(n);
	rep(i, n) a[i] = {p[i], i};
	sort(all(a));
	reverse(all(a));

	ll ans = 0;

	set<ll> st;
	st.insert(-1);
	st.insert(n);
	rep(i, n){
		auto r = st.upper_bound(a[i].sc);
		auto l = prev(r, 1);
		if(*r != n) ans += a[i].fs * (a[i].sc - *l) * (*next(r, 1) - *r);
		if(*l != -1) ans += a[i].fs * (*r - a[i].sc) * (*l - *prev(l, 1));
		st.insert(a[i].sc);
	}
	co(ans);

	return 0;
}


Measured memory_bytes: 7296
#include <bits/stdc++.h>
#define F first
#define S second
#define ll long long
#define ld long double
#define pb push_back

using namespace std;

int n,a[200200],mn=1e9,ans;

int main()
{
    cin >> n;
    for (int i=0;i<n;i++)
    {
        cin >> a[i];
    }
    for (int i=0;i<n;i++)
    {
        if (a[i]<=mn)ans++;
        mn=min(mn,a[i]);
    }
    cout << ans << endl;
}



Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<utility>
#include<algorithm>
#include<cstdio>
#include<iomanip>
#include<queue>
#include<stack>

#define ll int64_t
#define Rep(i, n) for (ll i = 0; i < n; i++)

using namespace std;

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

    string S;
    cin >> S;
    ll n = S.size();
    stack<string> divide;
    divide.push(string(1, S[0]));
    for (ll i = 1; i < n; i++) {
        if (string(1, S[i]) == divide.top() && i+1 < n) {
            divide.push(string(1, S[i]) + string(1, S[i+1]));
            i++;
        } else if (string(1, S[i]) != divide.top()) {
            divide.push(string(1, S[i]));
        }
    }

    
    cout << divide.size() << endl; 
    // while (!divide.empty()) {
    //     cout << divide.top() << endl;
    //     divide.pop();
    // }
}

Measured memory_bytes: 11028
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int i,j,n;
  int flag = 0;
  int count = 0;

  cin >> n;
  vector<string> s(n);
  for (i = 0; i < n; i++) {
    cin >> s.at(i);
  }

  sort(s.begin(), s.end());
  s.erase(unique(s.begin(), s.end()), s.end());

  for (i = 0; i < s.size(); i++) {
    count++;
  }

  cout << count << endl;
}


Measured memory_bytes: 9596
#include<bits/stdc++.h>
using namespace std;
const int Max_N=4*1e5;
int N,A[Max_N+10]={},Del[Max_N+10]={};
pair<int,int> B[Max_N+10]={};
inline int lowbit(int x){
	return x & - x;
}
inline void ADD(int x,int k){
	for(;x;x-=lowbit(x)) Del[x]=min(Del[x],k);
}
inline int ASK(int x){
	int Min=Del[x];
	for(;x<=N;x+=lowbit(x)) Min=min(Min,Del[x]);
	return Min;
}
struct kk{
	int l,r,Id1,Id2,Rev;
} T[Max_N*4+10]={};
inline void Build(int x,int l,int r){
	T[x].l=l; T[x].r=r;
	if(l==r){
		if(l%2) T[x].Id1=l;
		else T[x].Id2=l;
		return;
	}
	Build(x<<1,l,(l+r)>>1);
	Build((x<<1)+1,((l+r)>>1)+1,r);
	T[x].Id1=A[T[x<<1].Id1]<A[T[(x<<1)+1].Id1]?T[x].Id1=T[x<<1].Id1:T[x].Id1=T[(x<<1)+1].Id1;
	T[x].Id2=A[T[x<<1].Id2]<A[T[(x<<1)+1].Id2]?T[x].Id2=T[x<<1].Id2:T[x].Id2=T[(x<<1)+1].Id2;
}
inline void DownTag(int x){
	if(T[x].Rev){
		swap(T[x<<1].Id1,T[x<<1].Id2);
		swap(T[(x<<1)+1].Id1,T[(x<<1)+1].Id2);
		T[x<<1].Rev^=1; T[(x<<1)+1].Rev^=1;
		T[x].Rev=0;
	}
}
inline void Add(int x,int k,int Val){
	DownTag(x);
	if(T[x].l==T[x].r){
		A[k]=Val;
		return;
	}
	if(k<=T[x<<1].r) Add(x<<1,k,Val);
	else Add((x<<1)+1,k,Val);
	T[x].Id1=A[T[x<<1].Id1]<A[T[(x<<1)+1].Id1]?T[x].Id1=T[x<<1].Id1:T[x].Id1=T[(x<<1)+1].Id1;
	T[x].Id2=A[T[x<<1].Id2]<A[T[(x<<1)+1].Id2]?T[x].Id2=T[x<<1].Id2:T[x].Id2=T[(x<<1)+1].Id2;
}
inline void Change(int x,int l,int r){
	if(l<=T[x].l&&T[x].r<=r){
		swap(T[x].Id1,T[x].Id2);
		T[x].Rev^=1;
		return;
	}
	DownTag(x);
	if(l<=T[x<<1].r) Change(x<<1,l,r);
	if(r>T[x<<1].r) Change((x<<1)+1,l,r);
	T[x].Id1=A[T[x<<1].Id1]<A[T[(x<<1)+1].Id1]?T[x].Id1=T[x<<1].Id1:T[x].Id1=T[(x<<1)+1].Id1;
	T[x].Id2=A[T[x<<1].Id2]<A[T[(x<<1)+1].Id2]?T[x].Id2=T[x<<1].Id2:T[x].Id2=T[(x<<1)+1].Id2;
}
inline int Ask(int x,int l,int r,int Opt){
    DownTag(x);
	if(l<=T[x].l&&T[x].r<=r) return Opt==1?T[x].Id1:T[x].Id2;
	int Ans=0,Anss=0;
	if(l<=T[x<<1].r) Ans=Ask(x<<1,l,r,Opt);
	if(r>T[x<<1].r) Anss=Ask((x<<1)+1,l,r,Opt);
	if(A[Ans]>A[Anss]) Ans=Anss;
	return Ans;
}
inline void Solv(){
	for(int i=1;i<=N/2;i++){
		int Min=Ask(1,1,N,1);
		int r=ASK(Min);
		int Minn=Ask(1,Min,r,2);
//		cout<<Min<<' '<<Minn<<' '<<r<<endl;
		B[i]=make_pair(A[Min],A[Minn]);
		Add(1,Min,1<<30); Add(1,Minn,1<<30);
		if(Min+1<Minn-1) Change(1,Min+1,Minn-1);
		ADD(Min,Min); ADD(Minn,Minn);
	}
}
int main(){
	scanf("%d",&N); A[0]=1<<30;
	for(int i=1;i<=N;i++) scanf("%d",&A[i]);
	for(int i=0;i<=N;i++) Del[i]=N;
	Build(1,1,N); Solv();
	for(int i=1;i<=N/2;i++) printf("%d %d ",B[i].first,B[i].second); puts("");
	return 0;
} 

Measured memory_bytes: 30208
from itertools import permutations

N,M = map(int, input().split())
AB = set()
for i in range(M):
    A,B = map(int, input().split())
    AB.add((A-1,B-1))

s = ""
for i in range(1,N):
    s = s + str(i)
    
paths = permutations(s,N-1)
paths = list(paths)

ans = 0
for path in paths:
    path = [0] + [int(i) for i in path]

    for i in range(N-1):
        if (not (path[i],path[i+1]) in AB) and (not (path[i+1], path[i]) in AB):
            break
        
        if i == N-2:
            ans += 1
    
print(ans)

Measured memory_bytes: 3572
import math

def main():
    n = int(input())
    p_list = list(map(int, input().split()))
    print(mama(n,p_list))

            
def mama(n,p_list):
    sum = 0
    top = 0
    for p in p_list:
        if sum <= 0:
            sum = sum + 1
            min = p
        else:
            if min >= p:
                sum = sum + 1
                min = p
            else:
                continue
    return sum


if __name__ == "__main__":
    main()

Measured memory_bytes: 24744
def call(n):
    s = ""
    i = 1
    while i <= n:
        x = i
        if x%3 == 0:
            s += " {0}".format(i)
        else:
            while x > 0:
               if x%10 == 3:
                   s += " {0}".format(i)
                   break
               x = x // 10
        i += 1
    print(s)

m = int(input())
call(m)

Measured memory_bytes: 7712
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,M;
  
  cin >> N >> M;
  
  
  const int NMMAX = 50;
  
  int a[NMMAX],b[NMMAX];
   
  for(int i=0; i<M; i++){
    cin >> a[i] >> b[i];
  }
  
  int road[NMMAX];
  
  for(int i=0; i<N; i++){
    road[i] = 0; 
  }
  
  for(int i=0; i<M; i++){
    road[a[i] - 1] += 1;
    road[b[i] - 1] += 1;
  }
  
  for(int i=0; i<N; i++){
    cout << road[i] << endl;
  }
  return 0;
}

Measured memory_bytes: 256
import java.util.*;
 
public class Main {
	
    public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	int H = sc.nextInt();
    	int W = sc.nextInt();
    	List<String> list = new ArrayList<>();
    	for (int i = 0; i < H+2; i++) {
    		StringBuilder sb = new StringBuilder();
    		if (i == 0 || i == H+1) {
        		for (int j = 0; j < W+2; j++) {
        			sb.append("#");
        		}
    		} else {
        		for (int j = 0; j < 3; j++) {
        			if (j != 1) {
        				sb.append("#");
        			} else {
        				sb.append(sc.next());
        			}
        		}
    		}
    		list.add(sb.toString());
    	} 
    	StringBuilder sb = new StringBuilder();
    	for (String s : list) {
    		sb.append(s + "\n");
    	}
    	System.out.println(sb);
    }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string N;
  cin>>N;
  if(N.at(0) == N.at(1)&&N.at(0)==N.at(2)){
    cout <<"No"<<endl;
  }
  else{
    cout<<"Yes"<<endl;
  }
}


Measured memory_bytes: 256