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

using namespace std;

template<long long sz = 1000000007LL>
struct mint{
private:
	long long value;
	inline mint<sz> mpow(mint<sz> a, long long b){
		if (b == 0) return mint<sz>(1);
		mint<sz> tmp = mpow(a, b / 2);
		if (b % 2) return tmp * tmp * a;
		return tmp * tmp;
	}
public:
	mint(long long value) : value((value % sz + sz) % sz) {}
	mint() : value(0) {}
	long long get(void) { return this->value; }
	constexpr mint<sz> operator+ (mint<sz> obj){
		return mint<sz>(this->value + obj.get());
	}
	constexpr mint<sz> operator+ (long long obj){ return (*this) + mint<sz>(obj); }
	constexpr mint<sz> operator- (mint<sz> obj){
		return mint<sz>((this->value - obj.get() + sz) % sz);
	}
	constexpr mint<sz> operator- (long long obj){ return (*this) - mint<sz>(obj); }
	constexpr mint<sz> operator* (mint<sz> obj){
		return mint<sz>(this->value * obj.get() % sz);
	}
	constexpr mint<sz> operator* (long long obj){ return (*this) * mint<sz>(obj); }
	constexpr mint<sz> operator/ (mint<sz> obj){
		return (*this) * mpow(obj, sz - 2);
	}
	constexpr mint<sz> operator/ (long long obj){ return (*this) / mint<sz>(obj); }
	constexpr mint<sz>& operator+= (mint<sz> obj){
		return *this = (*this) + obj;
	}
	constexpr mint<sz>& operator+= (long long obj){
		return *this = (*this) + obj;
	}
	constexpr mint<sz>& operator-= (mint<sz> obj){
		return *this = (*this) - obj;
	}
	constexpr mint<sz>& operator-= (long long obj){
		return *this = (*this) - obj;
	}
	constexpr mint<sz>& operator*= (mint<sz> obj){
		return *this = (*this) * obj;
	}
	constexpr mint<sz>& operator*= (long long obj){
		return *this = (*this) * obj;
	}
	constexpr mint<sz>& operator/= (mint<sz> obj){
		return *this = (*this) / obj;
	}
	constexpr mint<sz>& operator/= (long long obj){
		return *this = (*this) / obj;
	}
	friend constexpr ostream& operator<< (ostream& os, const mint<sz>& data){
		return os << data.value;
	}
};

int main(void){
	int N, S; cin >> N >> S;
	vector<int> A(N);
	for (auto& ai : A) cin >> ai;
	vector<vector<mint<998244353LL>>> dp(N + 1, vector<mint<998244353LL>>(S + 1));
	dp[0][0] = mint<998244353LL>(1);
	for (int i = 1; i <= N; ++i){
		for (int j = 0; j <= S; ++j){
			dp[i][j] += dp[i - 1][j] * 2;
			if (j >= A[i - 1])
				dp[i][j] += dp[i - 1][j - A[i - 1]];
		}
	}
	cout << dp[N][S] << endl;
	return 0;
}

Measured memory_bytes: 73736
#include <iostream>
#include <cstring>
#include <string>    
#include <vector>
#include <queue>
#include <map>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;
ll n, m;
string s;

int main(){
	cin >> s;
	n = s.size();
	
	ll ansl = 0;
	for(ll i = 0; i < n; i++){
		if(i%2 && s[i] == '0'){ansl++;}
		if(!(i%2) && s[i] == '1'){ansl++;}
	}
	ll ansr = 0;
	for(ll i = 0; i < n; i++){
		if(i%2 && s[i] == '1'){ansr++;}
		if(!(i%2) && s[i] == '0'){ansr++;}
	}
	cout << min(ansl, ansr) <<endl;
	return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int n;
int a[1000001];
char s[1000001];
signed main()
{
	int k,res=999999999;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]);
	for(int i=1;i<=100;i++)
	{
		int ans=0;
		for(int j=1;j<=n;j++)
			ans+=(a[j]-i)*(a[j]-i);
		res=min(res,ans);
	}
	printf("%d",res);
	return 0;
}


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

template<typename T>
istream& operator >> (istream& istr, vector<T>& v){
    for(T& x: v) istr >> x;
    return istr;
}

template<typename T, typename U>
istream& operator >> (istream& istr, pair<T,U>& p){
    istr >> p.first >> p.second;
    return istr;
}

template<typename T>
ostream& operator << (ostream& ostr, vector<T>& v){
    if(!v.empty()){
        ostr << v.front();
        for(auto itr = ++v.begin(); itr != v.end(); itr++)
            // ostr << *itr;
            ostr << " " << *itr;
    }
    return ostr;
}

template<typename T, typename U>
ostream& operator << (ostream& ostr, pair<T,U>& p){
    // ostr << p.first << p.second;
    ostr << p.first << ", " << p.second;
    return ostr;
}

template<typename T>
ostream& operator << (ostream& ostr, vector<vector<T>>& vv){
    if(!vv.empty()){
        ostr << vv.front();
        for(auto itr = ++vv.begin(); itr != vv.end(); itr++)
            ostr << endl << *itr;
    }
    return ostr;
}

template<typename T, typename U>
ostream& operator << (ostream& ostr, vector<pair<T,U>>& vp){
    if(!vp.empty()){
        ostr << vp.front();
        for(auto itr = ++vp.begin(); itr != vp.end(); itr++)
            ostr << endl << *itr;
    }
    return ostr;
}

typedef long long ll;
typedef vector<ll> vll;
typedef vector<char> vc;
typedef vector<double> vd;
// vll x(n); x[i]=a;
typedef vector<vll> vvll;
typedef vector<vc> vvc;
typedef vector<vd> vvd;
// vvll x(m,vi(n)); x[i][j]=a;
typedef pair<ll,ll> pll;
typedef pair<double,double> pd;
typedef vector<pll> vpll;
typedef vector<pd> vpd;
// vpll x(n); x[i]={a,b}; x[i].first/second;

#define PI 3.1415926535897932
#define EPS 1e-12
#define INF (ll)1e12
#define REP(i,n) for(ll i=0; i<(n); i++)
#define RREP(i,n) for(ll i=(n)-1; i>=0; i--)
#define FOR(i,a,b) for(ll i=(a); i<(b); i++)
#define FORR(i,a,b) for(ll i=(b)-1; i>=(a); i--)
#define fix(x) cout << fixed << setprecision(x)
#define dump(x) cout << #x << " = " << (x) << endl
#define all(x) (x).begin(),(x).end()

template<typename T> T sum(vector<T> &v) {return accumulate(all(v), (T)0LL);}
template<typename T> void sort(vector<T> &v){sort(all(v));}
template<typename T> void rsort(vector<T> &v){sort(all(v), greater<T>());}

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

int main(){
    ll n, k = 0;
    cin >> n >> k;
    vll h(n), dp(n, INF);
    cin >> h;

    dp[0]=0;
    dp[1]=abs(h[1]-h[0]);

    FOR(i,2,n){
        ll m = min(k, i);
        REP(j,m) chmin(dp[i], dp[i-j-1]+abs(h[i]-h[i-j-1]));
    }
    cout << dp[n-1] << endl;

    return 0;
}


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

def maxAbsIndex(arr):
  return max(range(len(arr)), key=lambda x: abs(arr[x]))

def p(x, y):
  print(str(x+1) + " " + str(y+1))

# align sign
idx = maxAbsIndex(A)
print(2*N)

for i in range(N):
  if i != idx:
    p(idx, i)
    A[i] += A[idx]
p(idx, idx)
A[idx] += A[idx]

#
sign = A[0] >= 0
for i in range(N):
  idx = maxAbsIndex(A)
  if sign:
    p(idx, i)
    A[i] += A[idx]
  else:
    p(idx, N-i-1)
    A[N-i-1] += A[idx]

Measured memory_bytes: 3064
import itertools
A, B, C, D = [int(_) for _ in input()]
B = [-B, B]
C = [-C, C]
D = [-D, D]
for i, j, k in itertools.product(range(2), repeat=3):
    if A + B[i] + C[j] + D[k] == 7:
        print('+'.join(map(str, [A, B[i], C[j], D[k]])).replace('+-', '-') + '=7')
        exit()

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define repz(i, z, n) for (decltype(n) i = (z); i < (n); i++)
#define rep(i, n) for (decltype(n) i = 0; i < (n); i++)

#define REPZ(i, z, n) for (decltype(n) i = (z); i <= (n); i++)
#define REP(i, n) for (decltype(n) i = 0; i <= (n); i++)
#define ALL(v) v.begin(), v.end()
#define len(v) ((ll)(v).size())
#define MAX(v) (*max_element(ALL(v)))
#define MIN(v) (*min_element(ALL(v)))
#define INF 1000000000000  // 1E+12

// 略
#define PB push_back
#define F first
#define S second
#define MP make_pair
#define READ cin >>
#define PRINT cout <<
#define PYES cout << "YES" << endl
#define pyes cout << "Yes" << endl
#define POK cout << "OK" << endl
#define PNO cout << "NO" << endl
#define pno cout << "No" << endl
#define PNG cout << "NG" << endl
#define ret return 0

using namespace std;

// デバッグ用
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}

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

#ifdef _DEBUG
#define debug(...) debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

// typedef
typedef long long ll;
typedef unsigned long long ul;
typedef long double ld;
typedef pair<ll, ll> pl;

// const
// 円周率
const ld pi = acos(-1);
// mod用
// 1E+9 +7
const ll mod = (int)1e+9 + 7;
// 1s間で可能なループ回数2E+8回
// int        最大値2147483647         〜2E+9
// long long  最大値9223372036854775807〜9E+18
// 総和accumulate
// 単純リストvector<type> push_back
// 連想配列map<key,value> insert,
// 集合set<type>
// pair キーとバリューを格納 firstとsecondでアクセス
// 小数点指定 cout << fixed << setprecision(15) << endl;
// to_string<->stoi
// stoll(longlong)
// stod(double)
// deep copy v1->v2 copy(v1.begin(), v1.end(), back_inserter(v2) );
// 大文字65-90(-32)
// 小文字97-122(+32)
//  priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>>

signed main() {
  // faster
  // C言語流の入出力は使用できない
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  int n;
  cin >> n;
  int m = (n+1000-1)/1000;
  cout << m*1000-n << endl;
  ret;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define int long long
#define endl '\n'
using namespace std;

typedef long long ll;
#define READ(a) int a; cin >> a;
#define READARR(a, n) int a[(n) + 1] = {}; FOR(i, 1, (n)) {cin >> a[i];}
#define READMAT(a, n, m) int a[n + 1][m + 1] = {}; FOR(i, 1, n) {FOR(j, 1, m) cin >> a[i][j];}
#define print(a, n) FOR (i, 1, n) cout << a[i] << " "; cout << endl;
#define printmat(a, n, m) FOR (i, 1, n) {FOR (j, 1, m) cout << a[i][j] << " "; cout << endl;} cout << endl;
#define pb push_back
#define fi first
#define se second
#define vi vector <int>
#define pi pair <int, int>
#define vpi vector <pi>
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FORD(i, a, b) for (int i = (a); i >= (b); i--)
const ll inf = 1e18;
const ll mod = 1e9 + 7;

signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	READ(n);
	string s[n + 1];
	int t[n + 1];
	FOR (i, 1, n) cin >> s[i] >> t[i];
	
	string x;
	cin >> x;
	bool p = 0;
	int tim = 0;
	FOR (i, 1, n)
	{
	    if (p) tim += t[i];
	    if (s[i] == x) p = 1;
	}
	cout << tim;
}

Measured memory_bytes: 256
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . ___
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         ·ð×æ±£ÓÓ       ÓÀÎÞBUG
*/
//use readint!
#pragma GCC optimize(1)
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#pragma GCC optimize(4)
#pragma GCC optimize(5)
#pragma GCC optimize(6)
#pragma GCC optimize(7)
#pragma GCC optimize(8)
#pragma GCC optimize(9)
#include<map>
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<set>
#include<cmath>
#include<stdio.h>
#include<fstream>
#include<assert.h>
#include<time.h>
#include<queue>
#include<deque>
#include<stack>
#include<list>
#include<string.h>
#define mp make_pair
#define ll long long
#define all(v) v.begin(),v.end()
#define memset(a,b) memset(a,b,sizeof(a))
using namespace std;
const int INF=1e9;
inline int pt(int a[],int l,int r){
	int p,i,j;
	p=a[l];
	i=l;
	j=r+1;
	for(;;){
		while(a[++i]<p) if(i>=r) break;
		while(a[--j]>p) if(j<=l) break;
		if(i>=j) break;
		else swap(a[i],a[j]);
	}
	if(j==l) return j;
	swap(a[l],a[j]);
	return j;
}
inline void q_sort(int a[],int l,int r){
	int q;
	if(r>l){
		q=pt(a,l,r);
		q_sort(a,l,q-1);
		q_sort(a,q+1,r);
	}
}
inline int readint(){
    int x=0;
    int f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9') ch=getchar();
	if(ch=='-'){
		f=-1;
		ch=getchar();
	}
    while(ch>='0'&&ch<='9'){
        x=x*10+ch-'0';
        ch=getchar();
    }
    return x*f;
}
ll a,b,c,k;
int main(){
	cin>>a>>b>>c>>k;
	k%=2;
	if(k==1) cout<<b-a<<endl;
	else cout<<a-b<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>

#define REP(i,a,b) for(int i=int(a);i<int(b);i++)

using namespace std;

typedef long long int lli;

int main () {
    lli K;
    cin >> K;
    const int size = 50;
    vector<lli> res(size, 0);
    REP (i, 0, size) res[i] = i + K / size;
    K %= size;
    REP (i, 0, size) {
        if (i < K) {
            res[i] += size - K + 1;
        } else {
            res[i] -= K;
        }
    }

    cout << size << endl;
    REP (i, 0, res.size()) {
        if (i != 0) cout << ' ';
        cout << res[i];
    }
    cout << endl;
    return 0;
}


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>;
using Graph = vector<vector<int>>;

// header area

int main(){
    char C; cin >> C;

    if (C >= 'A' && C <= 'Z') cout << 'A' << endl;
    else cout << 'a' << endl;

    return 0;
}

Measured memory_bytes: 3632
#include <algorithm>
#include <iostream>
#include <map>
#include <string>
#include <vector>

using ll = long long;
#define rep(inc, bgn, end) for (int inc = bgn; inc < end; ++inc)
#define repe(inc, bgn, end) for (int inc = bgn; inc <= end; ++inc)

using namespace std;

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

    vector<int> inp(n);
    int centerIdx = n / 2 - 1;
    // n
    rep(i, 0, n) {
        cin >> inp[i];
    }

    vector<int> vec;
    // n
    copy(inp.begin(), inp.end(), back_inserter(vec));
    sort(vec.begin(), vec.end());
    int centerVal = vec[centerIdx];
    rep(i, 0, n) {
        if (inp[i] > centerVal) {
            cout << centerVal << endl;
            // } else if (inp[i] == centerVal) {
            // do
        } else {
            cout << vec[centerIdx + 1] << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 3828
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
using ll=long long;
using vec=vector<ll>;
using vect=vector<double>;
using Graph = vector<vector<ll>>;
#define loop(i,n) for(ll i=0;i<n;i++)
#define Loop(i, m, n) for(ll i = m;i < n;i++)
#define pool(i,n) for(ll i=n;i>=0;i--)
#define Pool(i, m, n) for(ll i=n;i>=m;i--)
#define MAX 99999999999ll
#define MIN -99999999999ll
#define setbit bitset<8>
#define flagcount __builtin_popcount
#define flag(x) (1<<x)
#define flagadd(bit,x) bit|=flag(x)
#define flagpop(bit,x) bit&=~flag(x) 
#define flagon(bit,i) bit&flag(i)
#define flagoff(bit,i) !(bit & (1<<i))
#define all(v) v.begin(),v.end()
#define low2way(v,x) lower_bound(all(v),x)
#define high2way(v,x) upper_bound(all(v),x)
#define count2way(v,x) high2way(v,x)-low2way(v,x)
#define lower(v,x) low2way(v,x)-v.begin() //1番左が0、もし見つから無いならｎを出力
#define higher(v,x) high2way(v,x)-v.begin()-1 //1番左が0、もし見つからないならn-1を出力（注意）
#define putout(a) cout<<a<<endl
#define putout2(a,b) putout(a);putout(b)
#define putout3(a,b,c) putout(a);putout(b);putout(c)
#define putout4(a,b,c,d) putout(a);putout(b);putout(c);putout(d)
#define putout5(a,b,c,d,e) putout(a);putout(b);putout(c);putout(d);putout(e)
#define Gput(a,b) G[a].push_back(b)
#define cin1(a) cin>>a
#define cin2(a,b) cin>>a>>b
#define cin3(a,b,c) cin>>a>>b>>c
#define cin4(a,b,c,d) cin>>a>>b>>c>>d
#define cin5(a,b,c,d,e) cin>>a>>b>>c>>d>>e
#define sum(v) accumulate(all(v), 0ll)
#define gcd(x,y) __gcd(x,y)
#define erase(s) s.erase(s.end()-1) //文字列sの末尾削除

ll ctoi(char c){
	if(c>='0'&&c<='9'){
		return c-'0';
	}
	return 0;
}
ll lcm(ll x,ll y){
  ll z=gcd(x,y);
  return x*y/z;
}
ll primejudge(ll n){
  if(n<2)return 0;
  else if(n==2)return 1;
  else if(n%2==0)return 0;
  double sqrtn=sqrt(n);
  Loop(i,3,sqrtn+1){
     if(n%i==0){
        return 0;
     }
     i++;
  }
  return 1;
}
string RLE(string s){
  ll n=s.size();
  char now='.';
  ll count=1;
  string press;
  loop(i,n){
    if(s[i]!=now){
      if(i){
        press+=now;
        press+=to_string(count);
      }
      now=s[i];
      count=1;
      continue;
    }
    else count++;
  }
  press+=now;
  press+=to_string(count);
  return press;
}
int main() {
  cout << fixed << setprecision(30);
  while(true){
    ll n,x;
    cin>>n>>x;
    if(n==0)return 0;
    ll ans=0;
    Loop(i,1,n+1){
      Loop(j,i+1,n+1){
        Loop(k,j+1,n+1){
          if(i+j+k==x)ans++;
        }
      }
    }
    putout(ans);
  }
}


Measured memory_bytes: 3100
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#include<string.h>
#define max(x,y)(x>y?x:y)
#define min(x,y)(x>y?y:x)
typedef long long int ll;
typedef unsigned long long int ull;
ll gcd(ll x,ll y){if(!y)return x;return gcd(y,x%y);}
ll lcm(ll x,ll y){return x/gcd(x,y)*y;}
void swap(ll *x,ll *y){ll tmp=*x;*x=*y;*y=tmp;}
int asc_cmp(const void* X,const void* Y){ll x=*(int*)X,y=*(int*)Y;if(x<y)return -1;else if(x==y)return 0;else return 1;}
int desc_cmp(const void* X,const void* Y){ll x=*(int*)X,y=*(int*)Y;if(x<y)return 1;else if(x==y)return 0;else return -1;}

int main(){
    int n,r;scanf("%d %d",&n,&r);
    if(n<=10){
        printf("%d\n",100*(10-n)+r);
    }else{
        printf("%d\n",r);
    }
}

Measured memory_bytes: 128
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {

        static void Main(string[] args)
        {

           // Console.SetIn(new StreamReader("input.txt"));

            var ints = In.Ints().ToArray();
            var N = ints[0];
            var K = ints[1];

            var DS = In.Line().Split().Select(i => char.Parse(i) ).ToArray();

            for(int i = 0; ;i++)
            {
                var value = N + i;
                var aaa = value.ToString().ToList();
                var inters = aaa.Intersect(DS);
                var count = inters.Count();
                if (count == 0)
                {
                    Console.WriteLine(value);
                    break;
                }
            }

            
            return;
        }
    }

    public class S : System.IComparable
    {
        public char[] data;
        public S(char[] data)
        {
            this.data = data;
        }

        public String Tostring()
        {
            return new String(this.data);
        }
        public int CompareTo(object obj)
        {
            S other = (S)obj;
            if (this.GetType() != obj.GetType())
            {
                throw new ArgumentException("別の型とは比較できません。", "obj");
            }

            for(int i = 0; i < this.data.Length; i++)
            {
                if( this.data[i] == other.data[i])
                {
                    continue;
                }
                if(this.data[i] > other.data[i])
                {
                    return 1;
                }else
                {
                    return -1;
                }
                
            }
            return 0;

        }

    }



    class In
    {
        public static int Int()
        {
            return int.Parse(Console.ReadLine());
        }

        public static IEnumerable<int> Ints()
        {
            return Console.ReadLine().Split(' ').Select(i => int.Parse(i));
        }

        public static String Line()
        {
            return Console.ReadLine();
        }
    }
}


Measured memory_bytes: 7224
import java.util.Scanner;

public class Main implements Runnable {

    private static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        new Thread(null, new Main(), "", 128 * 1024 * 1024).start();
    }

    public void run() {
        int a = sc.nextInt(), b = sc.nextInt(), c = sc.nextInt();
        int x = sc.nextInt(), y = sc.nextInt();
        long cost = 0;
        if (a + b >= c * 2) {
            cost += c * 2 * Math.min(x, y);
            int min = Math.min(x, y);
            x -= min;
            y -= min;
            if (x > 0) {
                if (a < c * 2) {
                    cost += a * x;
                } else {
                    cost += (c * 2) * x;
                }
            } else {
                if (b < c * 2) {
                    cost += b * y;
                } else {
                    cost += (c * 2) * y;
                }
            }
        } else {
            cost += a * x + b * y;
        }
        System.out.println(cost);
    }
}


Measured memory_bytes: 23892
#include<map>
#include<iostream>
#include<deque>
#include<algorithm>
#include<string>
#include<cctype>
#include<iomanip>
#include<vector>
#include<queue>
#include<math.h>
#include<bitset>
#include<random>
#include<set>
#include <cstdint>
#include<tuple>
using namespace std;
using ll = __int64_t;
using lll = __int128_t;
typedef pair<ll,ll> P;
#define REP(i,b,e) for(ll i=(ll)b;i<(ll)e;i++)
#define rep0(i,n) REP(i,0ll,n)
#define rep1(i,n) REP(i,1ll,n+1)
const ll longinf=1ll<<60;
const int inf=(1<<30)-1;
const ll mod=1e9+7;

vector<tuple<ll,ll,ll>> adj[100001];

ll mintime[100001];
bool kakutei[100001];

int main(void){
  string s;
  cin>>s;
  int n=s.size();
  bool ok=true;
  rep0(i,n){
    if(i&1){
      if(s[i]=='R') ok=false;
    }
    else if(s[i]=='L') ok=false;
  }
  if(ok) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}


Measured memory_bytes: 2560
#include "bits/stdc++.h"
using namespace std;
#ifndef LOCAL
#define endl '\n'
#endif

#define fr(i, a, b) for(int i = a; i <= b; i++)
#define rf(i, a, b) for(int i = a; i >= b; i--)
#define pf push_front
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(x) (int)x.size()
#define lb lower_bound
#define ub upper_bound

typedef long long ll;
typedef long double f80;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

int pct(int x) { return __builtin_popcount(x); }
int pct(ll x) { return __builtin_popcountll(x); }
int bt(int x) { return 31 - __builtin_clz(x); } // floor(log2(x))
int bt(ll x) { return 63 - __builtin_clzll(x); } // floor(log2(x))
int cdiv(int a, int b) { return a / b + !(a < 0 || a % b == 0); }
ll cdiv(ll a, ll b) { return a / b + !(a < 0 || a % b == 0); }
int nxt_C(int x) { int c = x & -x, r = x + c; return (((r ^ x) >> 2) / c) | r; }
ll nxt_C(ll x) { ll c = x & -x, r = x + c; return (((r ^ x) >> 2) / c) | r; }

vector<int> get_bits(int mask) {
	vector<int> bb;
	while(mask) { int b = bt(mask); bb.pb(b); mask ^= (1 << b); }
	reverse(all(bb));
	return bb;
}

int get_mask(vector<int> v) {
	int mask = 0;
	for(int x : v) { mask ^= (1 << x); }
	return mask;
}

template<typename T>
void uniq(vector<T> &v) { sort(all(v)); v.resize(unique(all(v)) - v.begin()); }

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

ll rand(ll l, ll r){
	uniform_int_distribution<ll> uid(l, r);
	return uid(rng);
}

void sc() {}

template <typename Head, typename... Tail>
void sc(Head &H, Tail &... T) { cin >> H; sc(T...); }

#ifdef LOCAL
#define debug(...) cerr << "[L:" << __LINE__ << "][" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

// #ifndef LOCAL
// string to_string(__int128 x) {
// 	string s = "";
// 	bool neg = 0;
// 	if(x < 0) { s += "-"; neg = 1; x = -x; }
// 	if(!x) s += '0';
// 	while(x) {
// 		int rem = x % 10;
// 		s += to_string(rem);
// 		x /= 10;
// 	}
// 	reverse(s.begin() + neg, s.end());
// 	return s;
// }
// #endif

const int mod = 1e9 + 7; // 998244353;

int pwr(int a,ll b) {
	int ans = 1;
	while(b) {
		if(b & 1) ans = (ans * 1LL * a) % mod;
		a = (a * 1LL * a) % mod;
		b >>= 1;
	}
	return ans;
}

/*
	Lookout for overflows!!
	Check array sizes!!
	Clear before test cases!!
	Use the correct modulo!!
	Check for corner cases!!
	Are you forgetting something?!
	Read problem statement carefully!!!
*/

const int N = 1e5 + 5;
int a[N];

void solve() {
	int n;
    sc(n);
    vector<int> v;
    fr(i, 1, n) {
        sc(a[i]);
        v.pb(a[i]);
    }
    uniq(v);
    fr(i, 1, n) {
        a[i] = upper_bound(all(v), a[i]) - v.begin();
    }
    int ans = 0;
    fr(i, 1, n) {
        if((a[i] % 2) != (i % 2)) ans++;
    }
    cout << ans / 2 << endl;
}

int main() {
	ios :: sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int t = 1;
	// cin >> t;
	for(int tt = 1; tt <= t; tt++) {
		solve();
	}
	return 0;
}

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

template<typename T> class BellmanFord {
public:
  struct edge {
    int from, to; T cost;
  };
  int V;
  T inf;
  vector<T> dist;
  vector<edge> es;
  BellmanFord(int node_size) : V(node_size), inf(numeric_limits<T>::max() / 2), dist(V, inf) {}
  void add(int from, int to, T cost) {
    es.push_back((edge) {from, to, cost});
  }
  bool is_inf(int s, int t) {
    dist.at(s) = 0;
    for (int i = 0; i < 2 * V - 1; i++) {
      for (auto &e : es) {
        if (dist.at(e.from) != inf && dist.at(e.to) > dist.at(e.from) + e.cost) {
          dist.at(e.to) = dist.at(e.from) + e.cost;
          if (i >= V - 1) {
            if (e.to == t) return true;
            dist.at(e.to) = -inf;
          }
        }
      }
    }
    return false;
  }
};

int main() {
  int N, M, C;
  cin >> N >> M >> C;
  BellmanFord<long> BF(N);
  for (int i = 0; i < M; i++) {
    int a, b, c;
    cin >> a >> b >> c;
    BF.add(--a, --b, C - c);
  }
  if (BF.is_inf(0, N - 1)) return cout << -1 << "\n", 0;
  cout << max(0L, -BF.dist.at(N - 1)) << "\n";
}

Measured memory_bytes: 512
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <queue>

typedef unsigned long long ULLONG;
typedef long long LLONG;
static const LLONG MOD_NUM = 1000000007;

template<class _T> static void getint(_T& a) {
	const char* fmt = " %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld";
	}

	if (scanf(fmt, &a) < 0) {
		printf("g1int Error\n");
	}
}
template<class _T> static void getint(_T& a, _T& b) {
	const char* fmt = " %d %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld %lld";
	}

	if (scanf(fmt, &a, &b) < 0) {
		printf("g2int Error\n");
	}
}
template<class _T> static void getint(_T& a, _T& b, _T& c) {
	const char* fmt = " %d %d %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld %lld %lld";
	}

	if (scanf(fmt, &a, &b, &c) < 0) {
		printf("g3int Error\n");
	}
}

static void APetrC001B();

#if 1
int main()
{
	APetrC001B();
	fflush(stdout);
	return 0;
}
#endif

static void APetrC001B()
{
	int N;
	getint(N);

	std::vector<LLONG> an(N), bn(N);

	for (int i = 0; i < N; i++) {
		getint(an[i]);
	}
	for (int i = 0; i < N; i++) {
		getint(bn[i]);
	}

	LLONG plusCount = 0, minusCount = 0;
	for (int i = 0; i < N; i++) {
		LLONG diff = bn[i] - an[i];
		if (diff >= 0) {
			plusCount += diff / 2;
		}
		else {
			minusCount -= diff;
		}
	}
	printf("%s\n", (plusCount >= minusCount) ? "Yes" : "No");
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
struct node
{
	long long a,b,c;
}
g[2000];
int n,m;
long long s[2000],ans=-1e9,sum1;	
bool cmp(long long a,long long b)
{
	return a>b;
}
int main()
{
	cin>>n>>m;
	memset(s,0,sizeof(s));

	for(int i=1;i<=n;i++)
		cin>>g[i].a>>g[i].b>>g[i].c;
	for(int l=-1;l<=1;l+=2)
		for(int j=-1;j<=1;j+=2)
			for(int k=-1;k<=1;k+=2)
			{
				for(int i=1;i<=n;i++)
				{
					long long sum=0;
					if(l==1)
						sum+=g[i].a;
					else 
						sum-=g[i].a;
					if(j==1)
						sum+=g[i].b;
					else 
						sum-=g[i].b;
					if(k==1) 
						sum+=g[i].c;
					else 
						sum-=g[i].c;
					s[i]=sum;
				}
				sort(s+1,s+n+1,cmp);
				sum1=0;
				for(int i=1;i<=m;i++)
					sum1+=s[i];
				ans=max(ans,sum1);
			}
			cout<<ans;
			return 0;
}

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

//素数判定
inline bool IsPrime(int p) {
	if (p == 1) return false;
	for (int i = 2; i <= sqrt(p); i++) {
		if (p%i == 0) return false;
	}
	return true;
}

//10進数の自然数の桁数を返す
inline int GetDigit(int num) {
	return (int)log10(num) + 1;
}

//各位の和を返す
int GetDigitsSum(int num) {
	int N = 0;
	while (num > 0) {
		N += num % 10;
		num /= 10;
	}
	return N;
}



//異なるn個からr個の整数を取り出す組合せの数を求める
int combination(int n, int r) {
	if (r == 0 || n == r) {
		return 1;
	}
	else if (r == 1) {
		return n;
	}
	else {
		return combination(n - 1, r - 1) + combination(n - 1, r);
	}

}

int main() {
	int a[3];
	for (int i = 0; i < 3; i++)
	{
		cin >> a[i];
	}
	sort(a, a + 3);

	cout << (a[2] - a[1]) + (a[1] - a[0]) << endl;

	return 0;
}


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

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

int main(){
	int n;
	string s;
	cin >> n >> s;
	for(int i=0; i<s.length(); i++){
		cout << (char)('A'+(s[i]-'A'+n+26)%26);
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
template<class T> void read(T &x)
{
	x=0;int f=0;char ch=getchar();
	while(ch<'0'||ch>'9')	f=ch=='-',ch=getchar();
	while(ch>='0'&&ch<='9')	x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
	x=f?-x:x;
}
const int N=3e5+5;
struct node{
	int l,r,len;
	bool operator < (const node &A) const {return len<A.len;}
}a[N];
int tree[N<<1],n,m;
inline void add(int x,int v)
{
	for(;x<=m;x+=x&-x)	tree[x]+=v;
}
inline int query(int x)
{
	int res=0;
	for(;x>0;x-=x&-x)	res+=tree[x];
	return res;
}
int main()
{
	read(n),read(m);
	for(int i=1;i<=n;i++)
		read(a[i].l),read(a[i].r),a[i].len=a[i].r-a[i].l+1;
	sort(a+1,a+n+1);
	int k=1;
	for(int i=1;i<=m;i++)
	{
		int ans=0;
		while(k<=n&&a[k].len<=i)
			add(a[k].l,1),add(a[k].r+1,-1),k++;
		for(int j=i;j<=m;j+=i)
			ans+=query(j);
		printf("%d\n",ans+n-k+1);
	}
	return 0;
}

Measured memory_bytes: 5120
#include<bits/stdc++.h>
#define ll long long
#define pll pair<ll,ll>
#define pii pair<int,int>
#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 mem0(x) memset(x,0,sizeof(x))
#define meminf(x) memset(x,0x3f,sizeof(x))
#define VI vector<int>
#define VL vector<ll>
using namespace  std;

int main(){
    ios::sync_with_stdio(0);
    int k;cin>>k;
    if(k%2==0||k%5==0){
        cout<<-1<<'\n';
    }else{
        ll num = 7;
        ll cnt = 1;
        while(1){
            if(num%k!=0){
                num = (num*10+7)%k;
                ++cnt;
            }else{
                break;
            }
        }
        cout<<cnt<<'\n';
    }
}


Measured memory_bytes: 3552
#include <stdio.h>
#include <stdlib.h>

int main()
{
    char a[3],b[3];
    int i,count=0;
    //for(i=0;i<3;i++)
        scanf("%s",a);
    //for(i=0;i<3;i++)
        scanf("%s",b);

    for(i=0;i<3;i++)
    {
        if(a[i]==b[2-i])
        {
            count++;
        }
    }
    if(count==3)
        printf("YES");
    else
        printf("NO");

}


Measured memory_bytes: 128
# nCk 前処理メモ化
MOD = 10 ** 9 + 7
N = 200_000
@fac = [1, 1]
@inv = [1, 1]
@finv = [1, 1]

(2..N).each do |i|
  @fac[i] = @fac[i - 1] * i % MOD
  @inv[i] = MOD - @inv[MOD % i] * (MOD / i) % MOD
  @finv[i] = @finv[i - 1] * @inv[i] % MOD
end

def nCk(n, k)
  return 0 if n < k || n < 0 || k < 0
  @fac[n] * (@finv[k] * @finv[n - k] % MOD) % MOD
end

n, k = gets.split.map(&:to_i)
ans = 0
(0..[k, n].min).each do |zero|
  # 0 となる部屋の組み合わせ * 重複組合せ
  ans += nCk(n, zero) * nCk(n - 1, zero)
  ans %= MOD
end
puts ans


Measured memory_bytes: 6700
import java.util.*;

public class Main {

    public static void main(String[] args) {
        //Compute c1 = new Compute();//calc

        long count = 0;
        boolean sw = false;
        int max = Integer.MIN_VALUE;
        int min = Integer.MAX_VALUE;
        double dMax = Double.MIN_VALUE;
        double dMin = Double.MAX_VALUE;
        //StringBuilder answer=new StringBuilder();

        //input
        Scanner sc = new Scanner(System.in);
        int n=sc.nextInt();
        long h[] = new long[n];
        for (int i=0;i<n;++i) h[i]=sc.nextLong();

        String ans[]={"Yes","No"};
        int ansInd=0;

        for (int i=n-1;i>0;--i)
        {
            long h1=h[i];
            long h2=h[i-1];

            if (h1>=h2) continue;

            long h3=h2-1;
            if (h1<h3)
            {
                ansInd=1;
                break;
            }else
            {
                h[i-1]=h3;
                continue;
            }
        }
        System.out.println(ans[ansInd]);
        //output
        //System.out.println(String.format("%.0f",answer));
    }
}

Measured memory_bytes: 50648
n = int(input())
a = list(int(i) for i in input().split())
def costcalc(x):
  a2 = 0
  for i in range(n):
    a2 += (a[i]-x)**2
  return a2

cost = 10**15
for i in range(201):
  check = i-100
  cost = min(cost,costcalc(check))
  
print(cost)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
long long t,a[1000020],k,l;
int main(){
	cin>>t;
	for(long long i=1;i<10;i++){
		a[k++]=i;
	}
	while(1){
		long long x=a[l],o=x%10;
		l++;
		if(o!=0)a[k++]=x*10+o-1;
		a[k++]=x*10+o;
		if(o!=9)a[k++]=x*10+o+1;
		if(k>=t){
			cout<<a[t-1]<<endl;break;
		}
	}
	return 0;
}
/* SO EASY UH */

Measured memory_bytes: 4320
#include <iostream>
#include <cmath>
#include <iomanip>

using namespace std;

#define out(v) cout<<v<<"\n"

int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  double a, b, x;
  cin >> a >> b >> x;

  cout << fixed << setprecision(15);
  if (x / a > a * b / 2) {
    double c = 2 * (a * b - x / a) / a;
    out(90 - atan2(a, c) / (2 * M_PI) * 360);
  } else {
    double c = 2.0*x / (a * b);
    out(90 - atan2(c, b) / (2 * M_PI) * 360);
  }
  return 0;
}


Measured memory_bytes: 256
/* ＵＴＦ－８ */
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <array>
#include <queue>
#include <stack>
#include <algorithm>
#include <tuple>
#include <numeric>
#include <type_traits>
#include <limits>

long N;
long Q;
std::vector<std::vector<long>> tree;
std::vector<long> value;
std::vector<long> total;
std::vector<int> arrived;

void rec(long curnode, long curval) {
	curval += value[curnode];
	total[curnode] = curval;
	arrived[curnode] = 1;

	for (auto child : tree[curnode]) {
		if (!arrived[child])
			rec(child, curval);
	}
}

int main()
{
	std::cin >> N >> Q;
	tree.resize(N);
	value.resize(N);
	total.resize(N);
	arrived.resize(N);
	for (long i = 0; i < N-1; ++i) {
		long a, b;
		std::cin >> a >> b;
		tree[a-1].push_back(b-1);
		tree[b-1].push_back(a-1);
	}
	for (long i = 0; i < Q; ++i) {
		long p, x;
		std::cin >> p >> x;
		value[p-1] += x;
	}

	rec(0, 0);

	for (long i = 0; i < total.size(); ++i) {
		if (i != 0)
			std::cout << " ";
		std::cout << total[i];
	}
	std::cout << "\n";
}


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

int f(int* a,int n){
  if(n==0)return 0;
  if(n==1)return a[0];
  int i,mi=INT_MAX,cnt=0;
  for(i=0;i<n;i++){
    if(mi>a[i]){
      cnt=i;
      mi=a[i];
    }
  }
  int b[cnt],c[n-cnt-1];
  for(i=0;i<cnt;i++)b[i]=a[i]-mi;
  for(i=cnt+1;i<n;i++)c[i-cnt-1]=a[i]-mi;
  return f(b,cnt)+f(c,n-cnt-1)+mi;
}

int main(){
  int i,j,cnt=0;
  int n;
  cin>>n;
  int h[n];
  for(i=0;i<n;i++)cin>>h[i];
  cout<<f(h,n);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)
#define FORL(i,x) for(int i=head[x];i;i=nxt[i])
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define PB push_back
#define MP make_pair
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


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

  int cnt = 0;
  int limit;
  int ans = 0;

  int t[n];
  FOR(i,0,n-1) cin >> t[i];

  sort(t,t+n);

  FOR(i,0,n-1){

    if(cnt==0){
      limit = t[i] + k;
      ++cnt;
    }
    else if(t[i]>limit){
      ++ans;
      cnt = 1;
      limit = t[i] + k;
    }
    else{
      ++cnt;
    }

    if(cnt==c){
      ++ans;
      cnt = 0;
    }

    // cout << cnt << " " << limit << endl;
  }

  if(cnt>0) ++ans;

  cout << ans << endl;



}



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

int main() {
  int A, B;
  
  cin >> A >> B;
  
  if(A != 1 && B != 1){
    cout << 1 << endl;
  } else if(A != 2 && B != 2){
    cout << 2 << endl;
  } else if(A != 3 && B != 3){
    cout << 3 << endl;
  }
}

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

namespace My
{
template <typename ArrayT>
static void DumpArray(const ArrayT &arr)
{
#if defined(HOME)
	for (auto it = std::begin(arr); it != std::end(arr); ++it) {
		cerr << *it << " ";
	}
	cerr << endl;
#endif
}
template <typename T>
static void DumpGrid(const vector<vector<T>> &grid)
{
#if defined(HOME)
	REP (i, grid.size()) {
		REP (j, grid[i].size()) {
			cerr << grid[i][j] << " ";
		}
		cerr << endl;
	}
#endif
}
template <class ArrayT, typename T>
static void InitArray(ArrayT &arr, T initValue)
{
	for (auto &v : arr) {
		v = initValue;
	}
}
template <typename T>
static bool ReplaceIfSmaller(T &target, T value)
{
	if (value < target) {
		target = value;
		return true;
	} else {
		return false;
	}
}
template <typename T>
static bool ReplaceIfBigger(T &target, T value)
{
	if (target < value) {
		target = value;
		return true;
	} else {
		return false;
	}
}

class Solver
{
  public:
	Solver() {}

	// [row][col]
	int dist[200][200];
	void Solve(istream &cin, ostream &cout)
	{
		int N, M, R;
		cin >> N >> M >> R;

		vector<int> r;
		REP (i, R) {
			int c;
			cin >> c;
			r.emplace_back(c - 1);
		}

		REP(i, N){
			REP(j, N){
				// 辺が存在しないところには十分大きな値を入れておく
				// ただし、INT_MAXみたな大きすぎるのはだめ。（オーバーフローするため）
				// おそらく10億くらいが適切かと。
				dist[i][j] = 1'000'000'000;
			}
		}

		REP(m, M){
			int A, B, C;
			cin >> A >> B >> C;
			if (C < dist[--A][--B]){
				dist[A][B] = dist[B][A] = C;

			}
		}
		// REP(i, N){
		// 	DumpArray(dist[i]);
		// }

		// 最短経路問題
		// ワーシャル・フロイドで最小コストを求める
		REP(k, N){
			REP(i, N){
				REP(j, N){
					dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
				}
			}
		}
		// REP(i, N){
		// 	DumpArray(dist[i]);
		// }

		// R[]の順列を求めて
		sort(std::begin(r), std::end(r));
		ll ans = 100000000;
		do {
			ll d = 0;
			REP (i, R - 1) {
				d += dist[r[i]][r[i + 1]];
			}
			ReplaceIfSmaller(ans, d);

		} while (std::next_permutation(std::begin(r), std::end(r)));

		cout << ans << endl;
	}
};
} // namespace My

#if !defined(BOOST_TEST_MODULE)
#if !defined(GTEST_INCLUDE_GTEST_GTEST_H_)
int main()
{
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);

	My::Solver solver;
	solver.Solve(std::cin, std::cout);

	return 0;
}
#endif
#endif


Measured memory_bytes: 384
import math


def read_int():
    return int(input().strip())


def read_ints():
    return list(map(int, input().strip().split(' ')))


def solve():
    N = read_int()
    P = read_ints()
    min_so_far = math.inf
    count = 0
    for p in P:
        min_so_far = min(min_so_far, p)
        if min_so_far >= p:
            count += 1
    return count


if __name__ == '__main__':
    print(solve())


Measured memory_bytes: 91332
#include <iostream>
#include <sstream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <string>
#include <cstring>
#include <bitset>
#include <functional>
#include <random>
#include <iomanip>
#define REP(_i,_a,_n) for(int _i=_a;_i<=_n;++_i)
#define PER(_i,_a,_n) for(int _i=_n;_i>=_a;--_i)
#define hr putchar(10)
#define pb push_back
#define lc (o<<1)
#define rc (lc|1)
#define mid ((l+r)>>1)
#define ls lc,l,mid
#define rs rc,mid+1,r
#define x first
#define y second
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int P = 1e9+7, INF = 0x3f3f3f3f;
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll qpow(ll a,ll n) {ll r=1%P;for (a%=P;n;a=a*a%P,n>>=1)if(n&1)r=r*a%P;return r;}
ll inv(ll x){return x<=1?1:inv(P%x)*(P-P/x)%P;}
inline int rd() {int x=0;char p=getchar();while(p<'0'||p>'9')p=getchar();while(p>='0'&&p<='9')x=x*10+p-'0',p=getchar();return x;}
//head



#ifdef __APPLE__
const int N = 1e2+50;
#else
const int N = 1e6+50;
#endif


int n,a[N];
char s[N];
int f[100][100];

int main() {
	scanf("%d", &n);
	REP(i,1,n) {
		scanf("%s", s+1);
		int m = strlen(s+1), tp = 0;
		ll x = 0, y = 1000000000;
		REP(i,1,m) {
			if (!tp) {
				if (isdigit(s[i])) x = x*10+s[i]-'0';
				else if (s[i]=='.') tp = 1;
			}
			else {
				if (isdigit(s[i])) x = x*10+s[i]-'0', y /= 10;
			}
		}
		int cnt2 = 0, cnt5 = 0;
		while (x%2==0) x/=2,++cnt2;
		while (x%5==0) x/=5,++cnt5;
		while (y%2==0) y/=2,++cnt2;
		while (y%5==0) y/=5,++cnt5;
		cnt2 = min(cnt2, 18);
		cnt5 = min(cnt5, 18);
		++f[cnt2][cnt5];
	}
	ll ans = 0;
	REP(i,0,18) REP(j,0,18) if (f[i][j]) { 
		REP(ii,0,18) REP(jj,0,18) if (f[ii][jj]) {
			if (i+ii>=18&&j+jj>=18) { 
				if (i==ii&&j==jj) ans += (ll)f[i][j]*(f[i][j]-1);
				else ans += (ll)f[i][j]*f[ii][jj];
			}
		}
	}
	printf("%lld\n", ans/2);
}







Measured memory_bytes: 3848
#include <bits/stdc++.h>
using namespace std;using ll=int_fast64_t;using ld=long double;using pll=pair<ll,ll>;using pld=pair<ld,ld>;
const ll INF=1LL<<60;void solve();int main(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(10);solve();}
#define foreach(i,a) for(auto &i:a)
#define SELECTOR(_1,_2,_3,_4,SELECT,...) SELECT
#define rep(...) SELECTOR(__VA_ARGS__,_rep2,_rep1,_rep0)(__VA_ARGS__)
#define _rep0(i,n) for(ll i=0;i<n;++i)
#define _rep1(i,k,n) for(ll i=k;i<n;++i)
#define _rep2(i,k,n,d) for(ll i=k;d!=0&&d>0?i<n:i>n;i+=d)
template<class T> vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
template<class... Ts> auto make_v(size_t a,Ts... ts){return vector<decltype(make_v(ts...))>(a,make_v(ts...));}
template<class T> inline bool chmax(T &a,const T &b){if(a<b){a=b; return 1;} return 0;}
template<class T> inline bool chmin(T &a,const T &b){if(a>b){a=b; return 1;} return 0;}

using ull=unsigned long long;
using M=vector<vector<ull>>;
ull m;

ull modpow(ull a,ull p){
  ull res=1;
  ull power = a;
  while(p){
    if(p&1) (res*=power)%=m;
    (power*=power)%=m;
    p>>=1;
  }
  return res;
}

M mat_mul(const M& A, const M& B){
  M C{{0,0,0},{0,0,0},{0,0,0}};
  rep(i,3)rep(j,3)rep(k,3) {
    (C[i][j]+=A[i][k]*B[k][j])%=m;
  }
  return C;
}

void solve(){
  ull l,a,b; cin>>l>>a>>b>>m;
  vector<ull> C(19,0);
  rep(d,1,19){
    if((ll)pow(10,d)-1-(ll)a>=0){
      C[d]=((ll)pow(10,d)-1-(ll)a)/b+1;
    } else {
      C[d]=0;
    }
  }
  rep(d,18,0,-1) C[d]-=C[d-1];
  rep(d,1,19){
    C[d]=min(l,C[d]);
    l-=min(l,C[d]);
  }

  M A{{1,0,0},{0,1,0},{0,0,1}};
  rep(d,1,19){
    M res{{1,0,0},{0,1,0},{0,0,1}};
    M power{{modpow(10,d),1,0},{0,1,b%m},{0,0,1}};
    ull p=C[d];
    while(p){
      if(p&1) res=mat_mul(res,power);
      power=mat_mul(power,power);
      p>>=1;
    }
    A=mat_mul(res,A);
  }
  ull ans=0;
  ans+=(a%m)*(A[0][1])%m;
  ans+=A[0][2];
  cout<<ans%m<<"\n";
}

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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var x = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
            string s = Console.ReadLine();
            string ans = "Yes";
            for (int i = 0; i < x[0]; i++)
            {
                if (s[i] == '-') ans = "No";
            }
            if (s[x[0]] != '-') ans = "No";
            for (int i = x[0] + 1; i < s.Length; i++)
            {
                if (s[i] == '-') ans = "No";
            }
            Console.WriteLine(ans);
        }
    }
}

Measured memory_bytes: 13140
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(a,b) for(int a=0;a<(b);++a)
#define REP1(i,n) for(int i=1;i<=(n);++i)
#define debug(x) cerr<<#x<<": "<<x<<'\n'
#define all(x) (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define isYES(x) printf("%s\n",(x) ? "YES" : "NO")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define isYes(x) printf("%s\n",(x) ? "Yes" : "No")
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair
#define INF (1<<29)
#define Sp(p) cout<<setprecision(25)<< fixed<<p<<endl
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
#define X first
#define Y second
#define pie 3.14159265358979323846
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;


template<class T=int>
T in(){T x;cin>>x;return (x);}
template<class T>
void print(T& x){cout<<x<<'\n';}

const int MOD =(int)1e9+7;
const int mod =(int)1e9+7;
const int MAX =510000;
ll fac[MAX],finv[MAX],inv[MAX];
void COMint(){
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for(int i=2;i<MAX;i++){
        fac[i]=fac[i-1]*i%MOD;
        inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
        finv[i]=finv[i-1]*inv[i]%MOD;
    }
}
ll COM(int n,int k){
    if(n<k) return 0;
    if(n<0||k<0)return 0;
    return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}
ll gcd(ll a,ll b){
    if(b==0)return a;
    if(a==0)return b;
    if(a>b){
        swap(a,b);
    }
    return gcd(a,b%a);
}
ll lcm(ll a,ll b){
    ll g;g=gcd(a,b);
    return a*b/g;
}
bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}

bool compare_by_a(pair<int, int> a, pair<int, int> b) {
    if(a.first != b.first){
        return a.first < b.first;
    }else{
        return a.second < b.second;
    }
}
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

ll RS(ll N,ll P,ll M){
    if(P==0){
        return 1;
    }else{
        if(P%2==0){
            ll t=RS(N,P/2,M);
            return t*t%M;
        }else{
            return N*RS(N,P-1,M)%M;
        }
    }
}
bool greater_pair(pair<ll,ll> a,pair<ll,ll> b){
    if(a.first!=b.first){
        return a.first>b.first;
    }else{
        return a.second>b.second;
    }
}
int main() {
    ios::sync_with_stdio(false);
    int N=in();
    int X=in();
    vector<int> x(N+1);
    REP(i,N)cin>>x[i];
    x[N]=X;
    sort(all(x));
    vector<ll> dif_x(N,0);
    REP(i,N){
        dif_x[i]=x[i+1]-x[i];
    }
    ll ans=0;
    REP(i,N){
        ans=gcd(ans,dif_x[i]);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 1408
#include "bits/stdc++.h"
using namespace std;
#define REP(i, n) for(ll i = 0;i < n;i++)
#define ll long long
#define MOD 1000000007
#define llMAX 9223372036854775807
#define llMIN -9223372036854775808
using vi = vector<ll>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける

ll n,k,x,y;

int main(){
  ll ans=0;
  cin >> n >> k;

  vi d(k);
  vi sunu(n);
  ll a;

  REP(i,k){
    cin>>d[i];
    REP(j,d[i]){
      cin>>a;
      sunu[a-1]++;
    }
  }
  

  REP(i,n){
    ans+=(sunu[i]==0);
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 3632
n, m = map(int, input().split())
dat = []
res = []
for i in range(m):
    res.append(None)

for i in range(m):
    p, y = map(int, input().split())
    dat.append( ( i,p,y ))

dat.sort(key=lambda x: x[2])

city = [1] * (n + 1)
for i in range(m):
    (i, c, y) = dat[i]
    r = city[c]
    city[c] += 1
    res[i] = "%06d%06d" % (c, r)

for i in range(m):
    print(res[i])

Measured memory_bytes: 81696