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

typedef vector<int > vi;
typedef vector< vi > vvi;
typedef pair< int, int > ii;
#define sz(a)  int((a).size())
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(typeof((c).begin() i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define forn(i,n) for(int i=0;i<n;++i)
#define foru(i,n) for(int i=1;i<=n;++i)
#define fortr(i,v) for(auto &i:v)
#define set(n) __builtin_popcount(n)
#define ll long long

int main()
{
	int M[101];
	foru(i,100)
	{
		M[i]=0;
	}
	int m,d;
	cin>>m>>d;
	
	int p=d%10;
	int q=(d/10)%10;

	for(int i=2;i<=q;++i)
	{
		for(int j=2;j<=(i==q?p:9);++j)
		{
			++M[i*j];
		}
	}
	int sum=0;
	foru(i,m)
	{
		sum+=M[i];
	}
	cout<<sum<<endl;



}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using ll = long long;
using namespace std;

int main() {
    int a,b,c;
    int flag=0;
    cin>>a>>b>>c;
    if(a==b)flag++;
    if(a==c)flag++;
    if(b==c)flag++;
    if(flag==1)cout<<"Yes";
    else cout<<"No";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a,b,c;
    scanf("%d%d%d",&a,&b,&c);
    if(a==b&&a!=c||b==c&&a!=c||a==c&&a!=b) printf("Yes");
    else printf("No");
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#include<string.h>
using namespace std;
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define endl "\n"
#define Max(x,y,z) max(x,max(y,z))
#define Min(x,y,z) min(x,min(y,z))
#define fr(i,s,e) for(i=s;i<e;i++)
#define rf(i,s,e) for(i=s-1;i>=e;i--)
#define pb push_back
#define eb emblace_back
#define mp make_pair
#define ff first
#define ss second
//#define int   long long
#define ll   long long
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
#define vl vector<long long>
#define inf (1LL<<61)
#define vi vector<int>
#define vii vector< vector<int> >
#define vll vector< vector<long long> >
#define vpi vector< pair<int,int> >
#define vpl vector< pair<ll,ll> >
#define viii vector< vector<vector<int> > >
typedef pair<pair<int, int>,int> P;
#define cd complex<double>
#define PI 4*atan(1)
#define mod %1000000007
#define pi 3.14159265358979323846//20 decimals
#define ld long double

int main()
{
	FAST;
	ll n,tw,i,j;
	cin >> n >> tw;
	ll v[n], w[n];
	fr(i,0,n)
		cin >> w[i] >> v[i];
	ll k[n+1][tw+1];
	fr(i,0,n+1)
	{
		fr(j,0,tw+1)
		{
			if((i == 0)||(j == 0))
				k[i][j] = 0;
			else if(w[i-1] > j)
				k[i][j] = k[i-1][j];
			else
				k[i][j] = max(k[i-1][j-w[i-1]] + v[i-1], k[i-1][j]);
		}
	}
	cout << k[n][tw];
}


Measured memory_bytes: 79232
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <map>
#include <set>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <vector>
#include <algorithm>
#include <functional>
#include <cstring>
#include <string>
#include <sstream>
#include <bitset>
using namespace std;
#define INF	100000000
#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define fi first
#define sec second
#define lb lower_bound
#define ub upper_bound
#define SS stringstream
#define rep(i,n) for(int i = 0; i < n; i++)
#define SORT(x) sort((x).begin(), (x).end())
#define clr(a,b) memset((a),(b),sizeof(a))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<int> Vi;
typedef vector<ll> Vll;
typedef vector<P> Vp;
typedef priority_queue<P, vector<P>, greater<P> > PQ;

bool num[10000];

int main(){
	int n,k,m;
	while(scanf("%d%d%d", &n, &k, &m),n||k||m){
		rep(i,10000) num[i] = true;
		m--;
		num[m] = false;
		int cnt = n-1;
		rep(i,n-2){
			int tk = k%cnt;
			if(tk == 0) tk = cnt;
			int tmp = 0;
			for(int j = 1;;j++){
				if(num[(m+j)%n]) tmp++;
				if(tmp == tk){
					m = (m+j)%n;
					num[m] = false;
					break;
				}
			}
			cnt--;
		}
		rep(i,n){
			if(num[i]){
				printf("%d\n", i+1);
				break;
			}
		}
	}
}

Measured memory_bytes: 1196
# include <bits/stdc++.h>
# define IL inline
# define RG register
# define Fill(a, b) memset(a, b, sizeof(a))
using namespace std;
typedef long long ll;

IL int Input(){
    RG char c = getchar(); RG int x = 0, z = 1;
    for(; c < '0' || c > '9'; c = getchar()) z = c == '-' ? -1 : 1;
    for(; c >= '0' && c <= '9'; c = getchar()) x = (x << 1) + (x << 3) + (c ^ 48);
    return x * z;
}

const int maxn(1e6 + 5);
const int mod(1e9 + 7);

int n, fac[maxn], ifac[maxn], ans, f[maxn];

IL int Pow(RG ll x, RG int y){
	RG ll ret = 1;
	for(; y; x = x * x % mod, y >>= 1)
		if(y & 1) ret = ret * x % mod;
	return ret;
}

IL int C(RG int x, RG int y){
	if(y > x) return 0;
	return 1LL * fac[x] * ifac[y] % mod * ifac[x - y] % mod;
}

IL void Upd(RG int &x, RG int y){
	x += y;
	if(x >= mod) x -= mod;
}

int main(RG int argc, RG char* argv[]){
	n = Input(), fac[0] = ifac[0] = 1;
	for(RG int i = 1; i <= n; ++i) fac[i] = 1LL * fac[i - 1] * i % mod;
	ifac[n] = Pow(fac[n], mod - 2);
	for(RG int i = n - 1; i; --i) ifac[i] = 1LL * ifac[i + 1] * (i + 1) % mod;
	for(RG int i = (n + 1) >> 1; i < n; ++i) f[i] = 1LL * C(i - 1, n - i - 1) * fac[i] % mod * fac[n - i - 1] % mod;
	for(RG int i = n - 2, l =(n + 1) >> 1; i >= l; --i) Upd(f[i + 1], mod - f[i]);
	for(RG int i = (n + 1) >> 1; i < n; ++i) Upd(ans, 1LL * f[i] * i % mod);
	printf("%d\n", ans);
    return 0;
}

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


int main()
{
  string S;
  cin>>S;
  if(S=="SUN")cout<<7<<endl;
  if(S=="MON")cout<<6<<endl;
  if(S=="TUE")cout<<5<<endl;
  if(S=="WED")cout<<4<<endl;
  if(S=="THU")cout<<3<<endl;
  if(S=="FRI")cout<<2<<endl;
  if(S=="SAT")cout<<1<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define FOR(i,start,end) for(int i=start;i<=end;i++)
const int INF = 1001001001;
typedef long long ll;
const ll MOD=1000000007;
using namespace std;
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; }
template<class T>auto MAX(const T& a) { return *max_element(a.begin(),a.end()); }
template<class T>auto MIN(const T& a) { return *min_element(a.begin(),a.end()); }
template<class T, class U>U SUM(const T& a, const U& v) { return accumulate(a.begin(),a.end(), v); }
template<class T, class U>U COUNT(const T& a, const U& v) { return count(a.begin(),a.end(), v); }
template<class T, class U>int LOWER(const T& a, const U& v) { return lower_bound(a.begin(),a.end(), v) - a.begin(); }
template<class T, class U>int UPPER(const T& a, const U& v) { return upper_bound(a.begin(),a.end(), v) - a.begin(); }
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { int g = GCD(a, b); return a / g * b; }

int main(void){
    // Your code here!
    ll n,a,b; cin >> n >> a >> b;
    ll br = 0;
    ll res = n /(a+b);
    ll m = n%(a+b);
    br = res*a + min(m,a);
    cout << br << endl;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

typedef struct {
	string color;
	int val;
} Card;

void merge(Card *arr,int left,int m,int right) {
	int n1 = m - left;
	int n2 = right - m;
	int index1 = 0,index2 = 0;
	Card * L = new Card[n1];
	Card * R = new Card[n2];
	for (int i = left;i<right;i++) {
		if (i < m) {
			L[index1++] = arr[i];
		} else {
			R[index2++] = arr[i];
		}
	}
	index1 = 0;
	index2 = 0;
	for (int i = left;i<right;i++) {
		if (index1 >= n1) {
			arr[i] = R[index2++];
		} else if (index2 >= n2) {
			arr[i] = L[index1++];
		} else {
			if (L[index1].val <= R[index2].val) {
				arr[i] = L[index1++];
			} else {
				arr[i] = R[index2++];
			}
		} 
	}
	delete[] L;
	delete[] R;
	
}

void mergeSort(Card *arr,int left,int right) {
	if (right - left > 1) {
		int m = (left + right) / 2;
		mergeSort(arr,left,m);
		mergeSort(arr,m,right);
		merge(arr,left,m,right); 
	} 
}

//包括p但不包括r 
int partition(Card *arr,int p,int r) {
	int x = arr[r-1].val;
	int i,j;
	for (j = p,i = p;j<r;j++) {
		if (arr[j].val <= x) {
			Card t = arr[i];
			arr[i] = arr[j];
			arr[j] = t;
			i++;
		}
	}
	return i-1;
}

void quickSort(Card *arr,int l,int r) {
	if (r - l > 1) {
	  int q = partition(arr,l,r);
	  quickSort(arr,l,q);
	  quickSort(arr,q,r);
    }
}

int main() {
	int n;
	cin >> n;
	Card *arr = new Card[n];
	Card *arr2 = new Card[n];
	for (int i=0;i<n;i++) {
		cin >> arr[i].color >> arr[i].val;
		arr2[i].color = arr[i].color;
		arr2[i].val = arr[i].val;
	}
	quickSort(arr,0,n);
	mergeSort(arr2,0,n);
	int i;
	for (i = 0;i<n;i++) {
		if (arr[i].color != arr2[i].color) {
			cout << "Not stable" << endl;
			break;
		}
	}
	if (i == n) {
		cout << "Stable" << endl;
	}
	for (int i=0;i<n;i++) {
		cout << arr[i].color << " " << arr[i].val << endl;
	}
}


Measured memory_bytes: 12188
using System;
using System.Linq;

class E
{
	static void Main()
	{
		Func<long[]> read = () => Console.ReadLine().Split().Select(long.Parse).ToArray();
		var h = read();
		var a = read();
		var f = read();
		Array.Sort(a);
		Array.Reverse(a);
		Array.Sort(f);

		long l = 0, r = a[0] * f.Last(), m;
		while (l < r)
		{
			m = (l + r) / 2;
			if (Enumerable.Range(0, (int)h[0]).Sum(i => Math.Max(0, a[i] - m / f[i])) <= h[1]) r = m;
			else l = m + 1;
		}
		Console.WriteLine(r);
	}
}


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

def main():
    N = int(input())
    t = list(map(int, input().split()))
    M = int(input())
    px = [list(map(int, input().split())) for i in range(M)]

    sum_ = sum(t)

    for i in range(M):
        p, x = px[i]
        print(sum_ - (t[p-1] - x))


if __name__ == "__main__":
    main()

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


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

    int n=s.size();
    int ans=0;
    rep(i,n){
        rep(j,n-i+1){
            string t=s.substr(i,j);
            int m=t.size();
            bool ok=true;
            rep(k,m){
                if(t[k]=='A' || t[k]=='C' || t[k]=='G' || t[k]=='T') continue;
                ok=false;
            }
            if(ok) ans=max(ans,m);
        }
    }

    cout<<ans<<endl;
}


Measured memory_bytes: 256
N = gets.to_i
hash = {}
N.times do |i|
	str = gets.chomp.to_s
	if hash[str]
		hash[str] += 1
	else
		hash[str] = 1
	end
end

best = hash.values.max
hash = hash.select{|k,v| v == best}.sort
hash.map{|k,v| puts k}

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

typedef long long ll;
typedef pair<ll, ll> P;

int N, p[11];

int main(){
    cin >> N;
    for(int i=0;i<N;i++)    cin >> p[i];

    int ans = 0, maxi = 0;
    for(int i=0;i<N;i++){
        ans += p[i];
        maxi = max(maxi, p[i]);
    }

    cout << ans - maxi / 2 << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define li long int
#define ll long long int
#define vec(x) vector<x> 
#define st(x) set<x> 
#define mpp(x,y) map<x,y>
#define qq(x) queue<x>
#define pqq(x) priority_queue<x> 
#define pi(x,y) pair<x,y>
#define forf(i,x,y) for(ll i=x;i<y;i++)
#define forl(i,x) for(ll i=x-1;i>=0;i--)
#define rev(x) reverse(x.begin(),x.end())
#define mem(x,a) memset(x,a,sizeof(x))
#define mod 1000000007
#define nxt_per(x) next_permutation(x.begin(),x.end())
#define pb push_back
#define pob pop_back
#define pp push
#define po pop
#define ub upper_bound
#define lb lower_bound
#define mp make_pair
#define vp(x,y) vec(pi(x,y) )
#define vv(x) vector<vector<x> >
#define all(x) x.begin(),x.end()

using namespace std;

int prime[301];

void seive()
{	
	mem(prime,-1);
	prime[0]=1;prime[1]=1;
	for(int p=2;p*p<=300;p++)
	{	if(prime[p]==-1)
		{	prime[p]=p;
			for(int i=p*2;i<=300;i+=p)
			{	if(prime[i]==-1)
					prime[i]=p;
			}
		}	
	}
	for(int p=2;p<=300;p++) 
    {	if(prime[p]==-1)
        	    prime[p]=p;   
    }
}

int main()
{
	fastio;
	/*#ifndef ONLINE_JUDGE
    	freopen("input.txt","r",stdin);
    	freopen("output.txt","w",stdout);
	#endif*/
	
	seive();
	int n;
	cin>>n;
	if(n<105)
	{	cout<<0;
		return 0;
	}
	int count=0,ans=0;
	forf(i,105,n+1)
	{	if(i%2==0)
			continue;
		int ele=i;
		count=0;
		mpp(int,int) m;
		while(ele>1)
		{	int div=prime[ele];
			ele/=div;
			if(div==2)
				continue;
			m[div]++;
			count++;
		}
		if(count+2+m.size()==8)
			ans++;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>
using namespace std;

#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)

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; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }

long long GCD(long long a, long long b) {
    if (b == 0) return a;
    else return GCD(b, a % b);
}

long long A, B, C;

int main() {
    while (cin >> A >> B >> C) {
        long long g = GCD(B, C);
        B /= g;
        A /= GCD(A, g);
        if (GCD(A, B) > 1) puts("NO");
        else puts("YES");
    }
}

Measured memory_bytes: 256
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

def gcd(a, b): #最大公約数
    while b:
        a, b = b, a%b
    return a

A, B, C, D = lr()
cnt_divided_C = B // C - (A-1) // C
cnt_divided_D = B // D - (A-1) // D
x = C * D // gcd(C, D)
cnt_divided_CD = B // x - (A-1) // x
answer = B - (A-1) - (cnt_divided_C + cnt_divided_D - cnt_divided_CD)
print(answer)

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

int main(){
    int a ,b;
    cin >> a >> b;
    if(b >= a){
        cout << a  << endl;
    }else{
        cout << a -1 << endl;
    }
    
}
  

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

int main(){

    long long N, Y;
    cin >> N >> Y;

    for(int left = 0; left < N+1; left++){
        for(int right = left; right < N+1; right++){
            long long sum = 10000 * left + 5000 * (right-left) + 1000 * (N - right);
            if(sum == Y){
                cout << left << " " << right - left << " " << N -right << endl;
                return 0;
            }
        }
    }

    cout << "-1 -1 -1"  << endl;

}

Measured memory_bytes: 256
#include<iostream>
int main(){
	int n;
	std::cin>>n;
	int a=1;
	if(n<=12){
		for(int i=1;i<=n;i++){
			a*=i;
		}
		std::cout<<a<<std::endl;
	}
	else if(n==13)std::cout<<355687428096000/16/15/14/13<<std::endl;
	else if(n==14)std::cout<<355687428096000/16/15/14<<std::endl;
	else if(n==15)std::cout<<355687428096000/16/15<<std::endl;
	else if(n==16)std::cout<<355687428096000/16<<std::endl;
	else if(n==17)std::cout<<355687428096000<<std::endl;
	else if(n==18)std::cout<<355687428096000*18<<std::endl;
	else if(n==19)std::cout<<355687428096000*18*19<<std::endl;
	else if(n==20)std::cout<<355687428096000*18*19*20<<std::endl;
	

	return 0;
}

Measured memory_bytes: 1160
#include <algorithm>
#include <cmath>
#include <iostream>
#include <queue>
#include <map>
#include <vector>

using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
template <class T>
using vv = vector<vector<T>>;

#define in(v) \
  v;          \
  cin >> v;
// #define rep(i,n) for(int i=0,_i=(n);i<_i;++i)
#define all(f, c, ...)                                 \
  (([&](decltype((c)) cccc) {                          \
    return (f)(begin(cccc), end(cccc), ##__VA_ARGS__); \
  })(c))
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) for (int i = 0, _i = (n); i < _i; ++i)
#define repi(i, a, b) for (int i = (a), _i = (b); i < _i; ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)

#define rrep(i, n) for (int i = (n); i >= 0; --i)
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
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;
}

// debug
template <class T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
  os << "{";
  for (size_t i = 0; i < vec.size(); ++i) os << (i ? ", " : "") << vec[i];
  os << "}";
  return os;
}
ostream& operator<<(ostream& os, const vector<char>& v) {
  for (size_t i = 0; i < v.size(); ++i) os << v[i];
  return os;
}
template <class T1, class T2>
ostream& operator<<(ostream& os, const pair<T1, T2>& rhs) {
  os << "(" << rhs.first << ", " << rhs.second << ")";
  return os;
}

#ifdef LOCAL
void debug() { cerr << "\n"; }
template <class First>
void debug(const First& first) {
  cerr << first << "\n";
}
template <class First, class... Rest>
void debug(const First& first, const Rest&... rest) {
  cerr << first << ",";
  debug(rest...);
}
#else
#define debug(...) 42
#endif

int main() {
  int in(N);

  vi A(N);
  map<int, int> m;
  rep(i, N) {
    cin >> A[i];
    ++m[A[i]];
  }
  all(sort, A);

  int ans = 0;
  rrep(i, N - 1) {
    if (m[A[i]] == 0) continue;
    --m[A[i]];
    int pow = 1;
    while (2 * pow <= A[i]) pow *= 2;
    debug(A[i], 2 * pow);
    if (m[2 * pow - A[i]] > 0) {
      ++ans;
      --m[2 * pow - A[i]];
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 19712
#include<bits/stdc++.h>
using namespace std;
int n,k,ansn=2147483647,a[100010];
int main(){
	scanf("%d %d",&n,&k);
	for (int i=1;i<=n;i++) scanf("%d",&a[i]);
	for (int i=1,j;i+k-1<=n;i++){
		j=i+k-1;
		ansn=min(ansn,min(abs(a[j]),abs(a[i]))+abs(a[i]-a[j]));
	}
	cout<<ansn<<endl;
	return 0;
}

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

#define ALL(a) (a).begin(),(a).end()
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);i--)
#define rrep(i,n) RFOR(i,n,0)
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define vint vector<int>
#define vdbl vector<double>
#define vstr vector<string>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

ll n;
vector<ll> bit;

ll bit_sum(int i){
	ll s = 0;
	while(i > 0){
		s += bit[i];
		i -= i & (-i);
	}
	return s;
}

void bit_add(int i, ll x){
	while(i <= n){
		bit[i] += x;
		i += i & (-i);
	}
}

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

	ll k;
	cin >> n >> k;

	vector<ll> s(n+1);
	s[0] = 0;
	rep(i,n){
		ll a;
		cin >> a;
		s[i+1] = s[i] + a - k;
	}

	vector<ll> ss(s);
	sort(ss.begin(),ss.end());

	rep(i,n+1){
		s[i] = distance(ss.begin(),lower_bound(ss.begin(), ss.end(), s[i])) + 1;
	}

	bit = vector<ll>(n+2,0);

	ll c = 0;
	rrep(i,n+1){
		c += bit_sum(s[i] - 1);
		bit_add(s[i],1); 
	}

	cout << n * (n + 1) / 2 - c << endl;
}

Measured memory_bytes: 4992
<?php

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

$m = array_pad(array(), 200, 0);
$ans = 0;

fscanf(STDIN, "%d %d %d %d", $A, $B, $C, $D);

for ($i = $A; $i < $B; $i++) {
    $m[$i] = 1;
}

for ($i = $C; $i < $D; $i++) {
    $ans += $m[$i];
}

echo $ans . PHP_EOL;


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

using namespace std;

#ifdef SG
	#include <debug.h>
#else
	#define show(...)
	#define debug(...)
	#define deepen(...)
	#define timer(...)
#endif

#define ARG4(_1,_2,_3,_4,...) _4

#define forn3(i,l,r) for (int i = int(l); i < int(r); ++i)
#define forn2(i,n) forn3 (i, 0, n)
#define forn(...) ARG4(__VA_ARGS__, forn3, forn2) (__VA_ARGS__)

#define ford3(i,l,r) for (int i = int(r) - 1; i >= int(l); --i)
#define ford2(i,n) ford3 (i, 0, n)
#define ford(...) ARG4(__VA_ARGS__, ford3, ford2) (__VA_ARGS__)

#define ve vector
#define pa pair
#define tu tuple
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define fs first
#define sc second
#define all(a) (a).begin(), (a).end()
#define sz(a) ((int)(a).size())

typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef unsigned char uc;
typedef pa<int, int> pii;
typedef pa<int, ll> pil;
typedef pa<ll, int> pli;
typedef pa<ll, ll> pll;
typedef ve<int> vi;

const ld pi = 3.1415926535897932384626433832795l;

template<typename T> inline auto sqr (T x) -> decltype(x * x) {return x * x;}
template<typename T1, typename T2> inline bool umx (T1& a, T2 b) {if (a < b) {a = b; return 1;} return 0;}
template<typename T1, typename T2> inline bool umn (T1& a, T2 b) {if (b < a) {a = b; return 1;} return 0;}

int main () {
	//std::ios::sync_with_stdio(false);
	cout.setf(ios::showpoint | ios::fixed);
	cout.precision(20);
#ifdef SG
	freopen((problemname + ".in").c_str(), "r", stdin);
//	freopen((problemname + ".out").c_str(), "w", stdout);
#endif
    ll a, b, c;
    ll x, y;
    cin >> a >> b >> c;
    cin >> x >> y;
    int minn = min(x, y);
    ll ans = 0;
    umn(a, 2 * c);
    umn(b, 2 * c);
    if (2 * c < a + b) {
        ans = 2 * c * minn + (x - minn) * a + (y - minn) * b;
    } else {
        ans = x * a + y * b;
    }
    cout << ans<< endl;


	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<unordered_map>
#define ll long long
using namespace std;
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	ll n, W,w,v;
	cin >> n >> W;
	vector<ll>dp(W+1,0);//dp[i] stores max value for weight i 
	for (ll i = 0; i < n; i++) {
		cin >>w >>v;
	//	for (ll weight_alredy = 0; weight_alredy < W - weight_alredy; weight_alredy++) 
		for (ll weight_alredy =W-w; weight_alredy >= 0; --weight_alredy){
		dp[weight_alredy + w]=	max(dp[weight_alredy + w], dp[weight_alredy] + v);
		}
	}
	ll ans=(*max_element(dp.begin(),dp.end()));
	cout<<ans;
	return 0;
}





Measured memory_bytes: 1024
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Stream;
 
public class Main {    
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String a = sc.next();
        String b = a.toLowerCase();
        if(a.equals(b)){
            System.out.println("a");
        }else{
            System.out.println("A");
        }
    } 
}

Measured memory_bytes: 35620
#include <stdio.h>
#include <stdlib.h>
typedef struct dat{
	int num,p,y;
}Data;
int cmp(const void *a, const void *b) {
  return ((Data *)a)->y-((Data *)b)->y;
}
int main(){
  int n,m,i;
  scanf("%d%d",&n,&m);
  Data c[m];
  int pr[m],id[m],pc[1000001];
  for(i=0;i<m;i++){
    scanf("%d%d",&c[i].p,&c[i].y);
	c[i].num=i;
	pr[i]=c[i].p;
  }
  qsort(c,m,sizeof(Data),cmp);
  for(i=0;i<m;i++) id[c[i].num]=++pc[c[i].p];
  for(i=0;i<m;i++) printf("%06d%06d\n",pr[i],id[i]);
}


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

using namespace std;

using int64 = long long;
const int mod = 1e9 + 7;

string S;

int main() {
  cin >> S;

  int64 mul = 1;
  vector< int64 > latte(S.size()), malta(S.size());

  for(int i = 0; i < S.size(); i++) {
    if(S[i] == '?' || S[i] == 'A') {
      latte[i] = mul;
    }
    if(S[i] == '?') {
      mul *= 3;
      mul %= mod;
    }
  }
  mul = 1;

  for(int i = (int) S.size() - 1; i >= 0; i--) {
    if(S[i] == '?' || S[i] == 'C') {
      malta[i] = mul;
    }
    if(S[i] == '?') {
      mul *= 3;
      mul %= mod;
    }
  }
  for(int i = 1; i < S.size(); i++) {
    latte[i] += latte[i - 1] * (S[i] == '?' ? 3 : 1) % mod;
    latte[i] %= mod;
  }
  for(int i = (int) S.size() - 2; i >= 0; i--) {
    malta[i] += malta[i + 1] * (S[i] == '?' ? 3 : 1) % mod;
    malta[i] %= mod;
  }
  int64 ret = 0;
  for(int i = 1; i + 1 < S.size(); i++) {
    int64 pre = latte[i - 1];
    int64 nxt = malta[i + 1];
    if(S[i] == '?' || S[i] == 'B') {
      ret += pre * nxt % mod;
      ret %= mod;
    }
  }
  cout << ret << endl;
}

Measured memory_bytes: 2048
#include <stdio.h>

int main(void) 
{
	int pasta, pasta_min;
	int juice, juice_min;
	int i;

	scanf("%d", &pasta_min);
	scanf("%d", &pasta);
	pasta_min = (pasta < pasta_min) ? pasta : pasta_min;
	scanf("%d", &pasta);
	pasta_min = (pasta < pasta_min) ? pasta : pasta_min;
	scanf("%d", &juice_min);
	scanf("%d", &juice);
	juice_min = (juice < juice_min) ? juice : juice_min;

	printf("%d\n", pasta_min + juice_min - 50);
	return 0;
}

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

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

if(x==1){
  cout<<"Yes"<<endl;
}
else {
  cout<<"No"<<endl;
}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
// Hey! 僕の提出を見てくれてありがとう.
// ロボ子さん可愛いぞ！！！！！君もV沼にはまろう↓
// https://www.youtube.com/channel/UCDqI2jOz0weumE8s7paEk6g
using namespace std;
using ll = long long;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}//a,bの最大公約数(gcd)を求める
ll lcm(ll a,ll b){return abs(a*b)/gcd(a,b);}//a,bの最小公倍数(lcm)を求める
vector<ll> enum_div(ll n){vector<ll> ret;for(int i=1 ; i*i<=n ; i++){if(n%i == 0){ret.push_back(i);if(i!=1 && i*i!=n)ret.push_back(n/i);}}ret.push_back(n);return ret;}
//↑nの約数を求める
vector<bool> IsPrime; void sieve(size_t max){if(max+1 > IsPrime.size())IsPrime.resize(max+1,true);IsPrime[0] = false;IsPrime[1] = false;for(size_t i=2; i*i<=max; ++i)if(IsPrime[i])for(size_t j=2; i*j<=max; ++j)IsPrime[i*j] = false;}
//↑エラトステネスの篩で素数を求める
#define roundup(divisor,dividend) (divisor + (dividend - 1)) / dividend //切り上げ割り算
#define all(x) (x).begin(),(x).end() //xの初めから終わりまでのポインタ
#define size_t ll //size_tは自動でllに変換される
#define pb(x) push_back(x)
#define pri_queue priority_queue //優先度付きキュー
#define syo(x) fixed << setprecision(x) //iostreamで小数をx桁表示
//sortを降順にする時は greater<型>()
void solve(long long A, long long B, long long N){
  cout << (N < B ? floor(A*N/B)-A * floor(N/B) : floor(A*(B-1) / (B))-A * floor((B-1)/B)) << endl;
}

int main(){
    long long A;
	scanf("%lld",&A);
	long long B;
	scanf("%lld",&B);
	long long N;
	scanf("%lld",&N);
    solve(A, B, N);
}


Measured memory_bytes: 3832
#include <iostream>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#define endl "\n"
using namespace std;

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

    vector <int> v(n);

    for(int i = 0; i < n; i ++)
    {
    	cin >> v[i];
    }
    int ans = 0;
    int minAns = 999999999;
    for(int i = -100; i <= 100; i ++)
    {
    	ans = 0;
    	for(int j = 0; j < n; j ++)
    	{
    		ans = ans + (v[j] - i) * (v[j] - i); 
    	}
    	minAns = min(minAns, ans);
    }

    cout << minAns << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a) for(int i=0; i<(a); i++)
typedef long long ll;
template<typename T>
struct edge {
  int src, to;
  T cost;
  edge(int to, T cost) : src(-1), to(to), cost(cost) {}
  edge(int src, int to, T cost) : src(src), to(to), cost(cost) {}
  edge &operator=(const int &x) {
    to = x;
    return *this;
  }
  operator int() const { return to; }
};
template<typename T>
using Edges = vector<edge<T>>;
template<typename T>
using WeightedGraph = vector<Edges<T>>;
using UnWeightedGraph = vector<vector<int>>;
template<typename T>
using Matrix = vector<vector<T>>;

/////////////////////////////////////////////////////////////////////

const ll inf = 1LL<<60;

int main()
{
  ll n;
  cin >> n;
  n--;
  deque<char> d;
  while (n>=0) {
    ll t = n%26;
    d.push_front('a'+t);
    n /= 26;
    n--;
  }
  for (auto c:d) cout << c;
  cout << endl;

  return 0;
}


Measured memory_bytes: 3632
N = int(input())
S = list(input())
stack = []
ans = S[::1]
add = 0
r, l = 0, 0
for i in range(N):
    c = S[i+add]
    if c == "(":
        r += 1
    if c == ")":
        if r > 0:
            r -= 1
        else:
            ans.insert(0, "(")
for _ in range(r):
    ans.append(")")
print("".join(ans))


Measured memory_bytes: 3060
#define _USE_MATH_DEFINES
#include<iostream>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<string>
#include<set>
#include<map>
#include<stdbool.h>
#include<math.h>
#include<sstream>
#include<math.h>
#include<vector>
#include<functional>
#include<queue>
#include<utility>
#include<bitset>
typedef long long ll;
#define N (1000000000+7)
#define INF 1e10
using namespace std;
typedef pair<ll, ll> P;

ll sum[100010];
int main(void) {
	ll n, a, b, c, d, e;
	cin >> n >> a >> b >> c >> d >> e;
	ll mi = min(a, min(b, min(c, min(d, e))));
	if (mi >= n)cout << 5 << endl;
	else {
		ll ans = 0;
		if (n%mi == 0)ans = n / mi;
		else ans = n / mi + 1;
		cout << ans + 4 << endl;
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <limits>
#include <map>
#include <stack>
#include <map>
#include <unordered_map>
#define REP(i,n) for(long (i)=0;(i)<(n);(i)++)
#define REPI(i,a,b) for(long (i)=(a);(i)<(b);(i)++)
#define INF numeric_limits<double>::infinity()
constexpr long MOD = 1e9 + 7;
using namespace std;
using P = pair<long, long>;
using VI = vector<long>;

long we[4];
VI gs[4];
VI gas[4];

int main() {
    int n;
    cin >> n;
    long W;
    cin >> W;
    long w, v;
    REP(i,n) {
        cin >> w >> v;
        int j = w % 4;
        we[j] = w;
        gs[j].push_back(v);
    }
    REP(i,4) {
        sort(gs[i].begin(), gs[i].end(), greater<long>());
    }
    
    REP(i,4) {
        long s = 0;
        gas[i].push_back(s);
        for (long v: gs[i]) {
            s += v;
            gas[i].push_back(s);
        }
    }
    
    long ans = 0;
    REP(i,100) {
        REP(j,100) {
            REP(k,100) {
                for (long l = n - i - j - k; l >= 0; l--) {
                    if (i > gs[0].size() || j > gs[1].size() || k > gs[2].size() || l > gs[3].size()) {
                        continue;
                    }
                    long crt = gas[0][i] + gas[1][j] + gas[2][k] + gas[3][l];
                    if (i == 1 && j == 0 && k == 1 && l == 0) {
                        
                    }
                    if (we[0]*i+we[1]*j+we[2]*k+we[3]*l <= W) {
                        if (crt > ans) {
//                            cout << i << " " << j << " " << k << " " << l << ": " << crt << endl;
                            ans = crt;
                        }
                    }
                }
            }
        }
    }
    cout << ans << endl;
}


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

int main() {
    ll s;
    cin >> s;
    vector<bool> appear(1e6 + 1, false);
    appear[s] = true;
    for (ll i = 2; ; i++) {
        s = (s % 2 == 0 ? s / 2 : 3 * s + 1);
        if (appear[s]) {
            cout << i << endl;
            return 0;
        }
        appear[s] = true;
    }
}

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

using namespace std;
using ll = long long;
using P = pair<ll, ll>;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define M 1000000007

ll powll(ll x, ll y) {
    ll re=1;
    rep(i, y) {
        re = re * x % M;
    }
    return re;
}


int main() {

    int s;
    cin >> s;

    vector<ll> a(2000, 0);
    a[0] = 1;

    for (int i = 3; i <= s; i++) {
        a[i] = (a[i - 1] + a[i - 3])%M;
    }
    
    cout << a[s];

    return 0;
}

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

typedef long long ll;

int main(){
    int N;
    cin >> N;
    vector<int> H(N);
    for (int i=0;i<N;i++){
        cin >> H[i];
    }
    int ma = 0;
    int ans = 0;
    for (int i=0;i<N;i++){
        if (i==0){
            ans += 1;
            ma = H[0];
        } else {
            if (ma <= H[i]){
                ans += 1;
                ma = H[i];
            }
        }
    }
    cout << ans << endl;
}

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

int main()
{
	string str;
	cin>>str;
	char ch[11];
	int count=0;
	for(int i=0;i<str.length();i++){
		if(str[i]=='0') {
			count++;
			ch[count]=str[i];
		}
		if(str[i]=='1'){
			count++;
			ch[count]=str[i];
		} 
		if(str[i]=='B') {
			if(count==0) continue;
			else count--;
		}
		
	}
	for(int i=1;i<=count;i++){
		cout<<ch[i];
	}
}

Measured memory_bytes: 256
import fractions
import math
from functools import reduce

def gcd(*numbers):
    return reduce(fractions.gcd(), numbers)

def gcd_list(numbers):
    return reduce(fractions.gcd(), numbers)

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)


n=int(input())
a=list(map(int,input().split()))

l=lcm_list(a)
s=[]
m=1
for i in a:
    li=l//i
    s.append(li)
su=sum(s)
ans=l/su
print('{:.9f}'.format(ans))

Measured memory_bytes: 5716
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iomanip>
using namespace std;
typedef long long ll;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;

#define EPS (1e-7)
#define INF (1e15)
#define PI (acos(-1))
#define MOD 1000000007

#define REP(i,n) for(int i=0;i<n;i++)
#define REPS(i,f,n) for(int i=(f);i<(n);i++)
#define EACH(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)

#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define arrdump(n,a) for(int i=0;i<n;i++) {cout<<((i>0)? " ":"")<<a[i];}cout<<"\n";


typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

int dy4[]={0, 0, 1, -1};
int dx4[]={1, -1, 0, 0};
int dx8[]={0, 0, 1, -1, 1, 1, -1, -1};
int dy8[]={1, -1, 0, 0, 1, -1, -1, 1};

// https://atcoder.jp/contests/abc076/tasks/abc076_c

int main() {
    string S; cin >> S;
    string T; cin >> T;

    if (S.length() < T.length()) {
        cout << "UNRESTORABLE" << "\n";
        return 0;
    }

    string ans = "~";
    REP(i, S.length()-T.length()+1) {
        string sub = S.substr(i, T.length());
        bool can = true;
        REP(j, T.length()) {
            if (sub[j] != T[j] && sub[j] != '?') can = false;
        }
        if (can) {
            string P = S;
            REP(j, T.length()) {
                P[i+j] = T[j];
            }
            REP(j, P.length()) {
                if (P[j] == '?') P[j] = 'a';
            }
            ans = min(ans, P);
        }
    }

    if (ans == "~") {
        cout << "UNRESTORABLE" << "\n";
    } else {
        cout << ans << "\n";
    }

    return 0;
}

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

bool is_prime[1000001];
int prime[1000001];
int main() {
	memset(is_prime, 1, sizeof(is_prime));
	is_prime[0] = is_prime[1] = false;
	int p = 0;
	for (int i = 2; i <= 1000000; i++) {
		if (is_prime[i]) {
			prime[p++] = i;
			for (int j = i * 2; j <= 1000000; j += i)is_prime[j] = false;
		}
	}
	int n;
	while (scanf("%d", &n), n) {
		int cnt = 0;
		for (int i = 0; prime[i] <= n / 2; i++) {
			if (is_prime[n - prime[i]])cnt++;
		}
		printf("%d\n", cnt);
	}
}

Measured memory_bytes: 4508
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        PrintWriter out = new PrintWriter(System.out);
        InputStreamScanner in = new InputStreamScanner(System.in);
        new Main().solve(in, out);
        out.flush();
    }

    private void solve(InputStreamScanner in, PrintWriter out) {
        int n = in.nextInt();
        Set<Integer> s = new HashSet<>();
        for (int i = 0; i < n ; i++) {
            s.add(in.nextInt());
        }
        out.println(s.size());
    }

    static class InputStreamScanner {

        private InputStream in;

        private byte[] buf = new byte[1024];
        private int len = 0;
        private int off = 0;

        InputStreamScanner(InputStream in)	{
            this.in = in;
        }

        String next() {
            StringBuilder sb = new StringBuilder();
            for (int b = skip(); !isSpace(b);){
                sb.appendCodePoint(b);
                b = read();
            }
            return sb.toString();
        }

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

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

        double nextDouble() {
            return Double.parseDouble(next());
        }

        char nextChar() {
            return (char)skip();
        }

        int skip() {
            for (int b; (b = read()) != -1;) {
                if (!isSpace(b)) {
                    return b;
                }
            }
            return -1;
        }

        private boolean isSpace(int c) {
            return c < 33 || c > 126;
        }

        private int read() {
            if (len == -1) {
                throw new InputMismatchException("End of Input");
            }
            if (off >= len){
                off = 0;
                try {
                    len = in.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException(e.getMessage());
                }
                if (len <= 0) {
                    return -1;
                }
            }
            return buf[off++];
        }
    }
}

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

def main():
	n = int(input().strip())
	v = list(map(int, input().strip().split()))
	mini = 10**10
	for i in reversed(range(n)):
		mini = min(mini, v[i])
		if v[i] - mini > 1:
			print('No')
			return
	print('Yes')

if __name__ == '__main__':
	main()


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

int main() {
  int N, a=0, cnt=1;
  cin >> N;
  vector<int> H(N);
  rep(i, N){
    cin >> H.at(i);
    if(i==0) continue;
    rep(j, i){
      if(H.at(j)>H.at(i)){
        a=1;
        break;
      }
    }
    if(a==0) cnt++;
    a=0;
  }
  cout << cnt << endl;
}

Measured memory_bytes: 256
public class Main {

	public void run(java.io.InputStream in, java.io.PrintStream out) {
		final java.util.Scanner sc = new java.util.Scanner(in);
		long min, max, sum;
		int n;
		
		n = sc.nextInt();
		min = Long.MAX_VALUE;
		max = Long.MIN_VALUE;
		sum = 0;
		for (int i = 0; i < n; ++i) {
			final long a = sc.nextLong();
			
			if (a < min) min = a;
			if (max < a) max = a;
			sum += a;
		}
		out.println(min + " " + max + " " + sum);
		
		sc.close();
	}
	
	public static void main(String[] args) {
		(new Main()).run(System.in, System.out);
	}

}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i < (int)(n); i++)
#define INF 1000000000000
using ll = long long;


int main(){
  int n;
  cin >> n;
  vector<ll> h(n);
  rep(i,n)cin >> h.at(i);
  int m = 0;
  rep(i,n){
    if(m<=h.at(i)-1)m=h.at(i)-1;
    else if(m==h.at(i))m=h.at(i);
    else{
      cout<<"No"<<endl;
      return 0;
    }
  }
  cout<<"Yes"<<endl;
  return 0;

}


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

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

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

const ll INF = 1e9;
const ll MOD = 1e9+7;
const ll LINF = 1e18;



signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll n,m; cin>>n>>m;
  vll a(n);
  if(n!=1) a[0]=1;
  vb check(n);
  bool ok=true;
  rep(i,m){
    ll s,c; cin>>s>>c; s--;
    if(check[s]){
      if(a[s]!=c) ok=false;
    }else{
      check[s]=true;
      a[s]=c;
    }
  }
  if(!ok || n!=1&&a[0]==0){
    cout<<-1<<endl;
    return 0;
  }
  
  rep(i,n) cout<<a[i];
  cout<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<int,int> P;

void Main() {
  ll n;
  R n;
  ll a[n];
  rep(i,n) R a[i];
  ll ans=0;
  rep(i,n) ans+=a[i]-1;
  pr(ans);
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}


Measured memory_bytes: 256
x,k,d=gets.split.map &:to_i
r=x.abs/d
if r>=k
  p (x.abs-k*d).abs
else
  if (k-r).even?
    p (x.abs%d).abs
  else
    p [((x.abs%d)-d).abs,((x.abs%d)+d).abs].min
  end
end

Measured memory_bytes: 14368
#include <bits/stdc++.h>
#define INF 1e18
#define int long long
#define Rep(i, a, n) for (int i = (a); i < (n); i++)
#define Repr(i, n, a) for (int i = (n); i >= (a); i--)
#define rep(i, n) Rep(i, 0, n)
#define repr(i, n) Repr(i, n, 0)
#define all(a) (a).begin(), (a).end()
using namespace std;
typedef pair<int, int> P;
typedef pair<int, P> PP;
const int mod = 1000000007;
signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n;
    cin >> n;
    double ans = 0;
    rep(i, n)
    {
        double x;
        string u;
        cin >> x >> u;
        if (u == "BTC")
            x *= 380000.0;
        ans += x;
    }
    printf("%.8lf", ans);
}

Measured memory_bytes: 256
object Main extends App {
  val sc = new java.util.Scanner(System.in) 
  var s = sc.nextInt()
  var a = Seq[Int]()
  while (!a.contains(s)) {    
    a ++= Seq(s)
    s = calc(s)
  }
  println(a.length + 1)

  def calc(n: Int): Int = if (n % 2 == 0) n / 2 else 3 * n + 1
}

Measured memory_bytes: 55192
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
	int a,b,c,t=0;
	cin>>a>>b>>c;
	if(a<b) {t=a;a=b;b=t;}
	if(a<c) {t=a;a=c;c=t;} 
	if(b<c) {t=b;b=c;c=t;}
	cout<<a*10+b+c<<endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>

constexpr int N = 10000000;

class D
{
	public:
	D() : data()
	{
		for (int i = 1; i <= N; ++i)
		{
			data[i] = 1;
		}
		for (int i = 2; i <= N; ++i)
		{
			if (data[i] == 1)
			{
				for (int j = i; j <= N; j += i)
				{
					int e = 0;
					int n = j;
					while (n % i == 0)
					{
						n /= i;
						e += 1;
					}
					data[j] *= e + 1;
				}
			}
		}
		for (int i = 2; i <= N; ++i)
		{
			data[i] = data[i] * i + data[i - 1];
		}
	}
	long long data[N + 1];
};

D d;

int main()
{
	int n;
	scanf("%d", &n);
	printf("%lld\n", d.data[n]);
	return 0;
}


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

typedef vector<vector<long>> matrix;

void read_matrix(matrix &a, int n, int m);
void matrix_mult(matrix &a, matrix &b, matrix &c);
void print_matrix(matrix &a);

int main(){
    int n, m, l;
    cin >> n >> m >> l;
    matrix a, b, c;

    read_matrix(a, n, m);
    read_matrix(b, m, l);
    matrix_mult(a, b, c);
    print_matrix(c);
}

void read_matrix(matrix &a, int n, int m){
    for(int row=0; row!=n; ++row){
        vector<long> vec;
        a.push_back(vec);
        for(int col=0; col!=m; ++col){
            int i;
            cin >> i;
            a[row].push_back(i);
        }
    }
}

void matrix_mult(matrix &a, matrix &b, matrix &c){
    auto n = a.size();
    auto m = a[0].size();
    auto l = b[0].size();
    for(int col=0; col!=n; ++col){
        vector<long> vec;
        c.push_back(vec);
        for(int row=0; row!=l; ++row){
            c[col].push_back(0);
            for(int i=0; i!=m; ++i){
                c[col][row] += a[col][i] *b[i][row];
            }
        }
    }
}

void print_matrix(matrix &a){
    for(auto row: a){
        auto n = row.size();
        int i = 0;
        for(auto aij:row){
            cout << aij;
            if(++i!=n) cout << ' ';
        }
        cout << endl;
    }
}

Measured memory_bytes: 1528
#include<bits/stdc++.h>
const int N=5005;
using namespace std;
typedef long long ll;
const ll inf=1e18;
int n,a,b,p[N],x;
ll f[N],g[N],ans=inf;
int main(){
	scanf("%d%d%d",&n,&a,&b);
	for(int i=0;i<n;i++)
	scanf("%d",&x),p[x-1]=i;
	for(int i=0;i<n;i++){
		for(int j=0;j<=n;j++)
		g[j]=f[j],f[j]=inf;
		for(int j=0;j<=n;j++)
		if(p[i]<j)
		f[j]=min(f[j],g[j]+a);
		else{
			if(p[i]>j)f[j]=min(f[j],g[j]+b);
			f[p[i]+1]=min(f[p[i]+1],g[j]);
		}
	}
	for(int i=0;i<=n;i++)
	ans=min(ans,f[i]);
	printf("%lld",ans);
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	n%=10;
	if(n==2||n==4||n==5||n==7||n==9)cout<<"h";
	else if(n==0||n==1||n==6||n==8)cout<<"p";
	else cout<<"b";
	cout<<"on"<<endl;
	return 0;
}

Measured memory_bytes: 3552