akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define ll long long
#define MOD 1000000007
#define INF 0x7fffffff
#define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace __gnu_pbds;
typedef tree<int,null_type,std::less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
using namespace std;
/*
ordered_set X;
X.insert(1);
cout<<*X.find_by_order(1)<<endl; Kth largest element
cout<<X.order_of_key(-5)<<endl;  number of elemets less than K
*/


int main(){
    //freopen(".txt", "w", stdout
    //IO;
    ll a,b,t;
    cin>>a>>b>>t;
    ll z = t / a;
    cout<<z*b;
    return 0;
}


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

using namespace std;

#define pb push_back
#define SZ(x) int((x).size())
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef pair<int,int> PII;

//const LL mod=1e9+7;
const double PI=acos(-1);
const double EPS=1e-6;
const int INF=0x3f3f3f3f;
inline int readint(){int sum=0;char c=getchar();bool f=0;while(c<'0'||c>'9'){if(c=='-') f=1;c=getchar();}while(c>='0'&&c<='9'){sum=sum*10+c-'0';c=getchar();}if(f) return -sum;return sum;}
inline LL readLL(){LL sum=0;char c=getchar();bool f=0;while(c<'0'||c>'9'){if(c=='-') f=1;c=getchar();}while(c>='0'&&c<='9'){sum=sum*10+c-'0';c=getchar();}if(f) return -sum;return sum;}

int has[26];
char s[200005];

int main(){//ios_base::sync_with_stdio(0);cin.tie(0);
    scanf("%s",s);
    int l=strlen(s);
    LL ans=1;
    for(int i=l-1;i>=0;i--) ans+=l-1-i-(has[s[i]-'a']++);
    printf("%lld\n",ans);
    return 0;
}

//cout.setf(ios::fixed);
//cout<<fixed<<setprecision(10)<<s<<endl;


Measured memory_bytes: 384
s=input()
flag=0
for i in range(len(s)):
    if i%2!=0:
        if s[i]!='L' and s[i]!='U' and s[i]!='D':
            flag+=1
    else:
        if s[i]!='R' and s[i]!='U' and s[i]!='D':
            flag+=1
if flag!=0:
    print("No")
else:
    print("Yes")


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

void func146b() {
  //シーザー暗号
  int n;
  string before, after;
  cin >> n >> before;
  for (int i = 0; i < before.length(); i++) {
    after = 'A' + (before[i] + 'A' + n) % 26;
    cout << after;
  }
  cout << "\n";
}

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

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main() 
{
 int a,b,c,x,y,ans,p;
 cin>>a>>b>>c>>x>>y;
 if (x<y) p=x;
 else p=y;
 ans=0;
 if (a+b>c*2)
 {
  ans+=c*2*p;
  x-=p;
  y-=p;
 }
 if (x>0&&c*2<a)
 {
  ans+=c*2*x;
  y-=x;
  if (y<0) y=0;
  x=0;
 }
 if (y>0&&c*2<b)
 {
  ans+=c*2*y;
  x-=y;
  if (x<0) x=0;
  y=0;
 }
 ans+=a*x+b*y;
 cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<tuple>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-15
#define mp(a1,a2) make_pair(a1,a2)
typedef long long ll;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
ll max3(ll a,ll b,ll c){
	if(a>b&&a>c) return a;
	else if(b>c) return b;
	else return c;
}
ll min3(ll a,ll b,ll c){
	if(a<b&&a<c) return a;
	else if(b<c) return b;
	else return c;
}
int main(){
	ll H,W;
	scan(H);scan(W);
	ll minabsS=INFl;
	if(H%3==0||W%3==0) minabsS=0;
	else minabsS=min(H,W);
	for(int leftwidth=max(1,(int)W/3-1);leftwidth<=min((int)W-1,(int)W/3+3);leftwidth++){
		ll leftS=H*leftwidth;
		ll rightupS=(H/2)*(W-leftwidth);
		ll rightdownS=H*W-leftS-rightupS;
		minabsS=min(minabsS,max3(leftS,rightupS,rightdownS)-min3(leftS,rightupS,rightdownS));
	}
	for(int upheight=max(1,(int)H/3-1);upheight<=min((int)H-1,(int)H/3+3);upheight++){
		ll upS=W*upheight;
		ll downleftS=(W/2)*(H-upheight);
		ll downrightS=H*W-upS-downleftS;
		minabsS=min(minabsS,max3(upS,downleftS,downrightS)-min3(upS,downleftS,downrightS));
	}
	prin(minabsS);
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main()
{
    int input, hour, min, sec;

    scanf("%d", &input);
    sec = input % 60;
    min = ((input - sec) % 3600) / 60;
    hour = (input - sec - min * 60) / 3600;
    printf("%d:%d:%d\n", hour, min, sec);

    return 0;
}

Measured memory_bytes: 592
N = int(input())
S = list(input())
e = S.count('E')
left = 0
right = e - (1 if S[0] == 'E' else 0)
ans = left + right

for i in range(N-1):
    if S[i+1] == 'E':
        right -= 1
    if S[i] == 'W':
        left += 1
    ans = min(ans, left+right)
            
print(ans)

Measured memory_bytes: 5800
#define _USE_MATH_DEFINES
#define MAX_N 1000000
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>

using namespace std;

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

static const double eps = 1e-8;

const static double r = 6378.1;

int main(){
	double f1,g1,f2,g2;
	//ido,kedo
	while(~scanf("%lf %lf %lf %lf",&f1,&g1,&f2,&g2)){
		if(f1==g1 && g1==f2 && f2==g2 && g2 == -1) break;

		f1 = (90.0-f1) * M_PI / 180.0;
		g1 = g1 * M_PI / 180.0;

		f2 = (90.0-f2) * M_PI / 180.0;
		g2 = g2 * M_PI / 180.0;

		double x1 = r * sin(f1) * cos(g1);
		double y1 = r * sin(f1) * sin(g1);
		double z1 = r*cos(f1);

		double x2 = r * sin(f2) * cos(g2);
		double y2 = r * sin(f2) * sin(g2);
		double z2 = r*cos(f2);

		double dist = (x1-x2)*(x1-x2) + (y1-y2)*(y1-y2) + (z1-z2)*(z1-z2);

		int res = r*acos(1-dist/(2*r*r))+0.50+eps;
		printf("%d\n",res);
	}
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
#define IO ios_base::sync_with_stdio(false)
#define ll long long
ll a[200000], dp[200005][101], b[200000];

ll f(ll w, ll i)
{
    ll k, l;
    if(w < 0) return -1e15;
    if(i == 0 || w==0) return 0;
    if(dp[w][i]!=-1) return dp[w][i];
    dp[w][i]=max(f(w,i-1),f(w-a[i],i-1)+b[i]);
    return dp[w][i];
}
int main()
{
    IO;

    ll j, n, m, k, m1, m2, a1, a2, l, t, cnt=0, mn, h=0, mod=1e7+7, ans=0; int tc=0; ll i;
    //cin>>t;
   // while(t--){
        tc++;
        cin>>n>>m;
        for(i = 1;i<=m; i++)
            for(j=1; j<=n; j++) dp[i][j]=-1;
        //cout<<"Case "<<tc<<": "<<dp[n]<<endl;

        for(i=1; i<=n; i++) cin>>a[i]>>b[i];
        j =  f(m,n); cout<<j<<endl;
   // }
    return 0;
}


Measured memory_bytes: 82688
import java.util.Scanner;
import java.util.Arrays;
import java.util.List;

public class Main {
	public static void main(String[] args) {
	    Scanner sc = new Scanner(System.in);
		String[] array = sc.nextLine().split(" ");
		int target = Integer.parseInt(array[0]);
		int speed = Integer.parseInt(array[1]);
		int time = Integer.parseInt(array[2]);
		int calc = target / speed;
		int amari = target % speed;
		String result = "";
		if (amari > 0) {
			result = calc < time ? "Yes" : "No";
		} else {
			result = calc <= time ? "Yes" : "No";
		}
	    System.out.println(result);
	}
}


Measured memory_bytes: 35668
def divisors(num):
    array = []
    limit = int(num ** 0.5) + 1
    for i in range(1, limit):
        if num % i == 0:
            div1 = i
            div2 = num//i
            array.append(div1+div2-2)
    array.sort()
    return array

n = int(input())
ans = min(divisors(n))
print(ans)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const auto INF = (ll)1e9;
using v = vector<ll>;
using p = pair<ll,ll>;
using m = map<ll,ll>;
using vv = vector<v>;
int gcd(int a,int b){
    return a==0? b :gcd(a,a%b);
}


int main(){
    double a,b;
    cin >> a >> b;
    cout <<(a>b?"GREATER":a==b?"EQUAL":"LESS");
}


Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip> // setprecision
#include <complex> // complex
#include <math.h> 
#include <climits> 
#include <assert.h>
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[8] = {1, 0, -1, 0,1,1,-1,-1};
const int dy[8] = {0, 1, 0, -1,1,-1,1,-1};
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(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N,K;
    cin >> N >> K;
    vector<vector<int>> G(K*2,vector<int> (K*2,0));
    for(int i=0; i<N; i++){
        int x,y;
        cin >> x >> y;
        char c;
        cin >> c;
        if(c == 'W'){
            x += K;
        }
        x %= K*2;
        y %= K*2;
        G[y][x]++;
    }
    vector<vector<int>> dp(2*K+1,vector<int>(2*K+1,0));
    for(int i=0; i<2*K; i++){
        for(int j=0; j<2*K; j++){
            dp[i+1][j+1] = dp[i+1][j] + dp[i][j+1] - dp[i][j] + G[i][j];
        }
    }
    auto getsum = [&](int y,int x){
        int uy = min(2*K,y+K);
        int ux = min(2*K,x+K);
        int ly = max(0,min(2*K,y));
        int lx = max(0,min(2*K,x));
        // cout << uy << " " << ux << " " << ly << " " << lx << "\n";
        // return 0;
        return dp[uy][ux] - dp[ly][ux] - dp[uy][lx] + dp[ly][lx];
    };
    int ans = 0;
    for(int i=0; i<=2*K; i++){
        for(int j=0; j<=2*K; j++){
            int res = 0;            
            res += getsum(i,j);
            res += getsum(i-K,j-K);
            res += getsum(i+K,j-K);
            res += getsum(i-K,j+K);
            res += getsum(i+K,j+K);
            chmax(ans,res);
            res = 0;
            res += getsum(i-K,j);
            res += getsum(i,j-K);
            res += getsum(i+K,j);
            res += getsum(i,j+K);
            chmax(ans,res);
        }
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 34616
# coding: utf-8
import heapq

N, M = [int(x) for x in input().split(" ")]

prices = [-int(x) for x in input().split(" ")]

heapq.heapify(prices)

for i in range(M):
    maxp = heapq.heappop(prices)
    heapq.heappush(prices, -((-maxp) // 2))

total = 0
for x in prices:
    total += -x

print(total)

Measured memory_bytes: 14180
#include <bits/stdc++.h>
typedef long long ll;
#define pb push_back
using namespace std;
typedef pair<ll,ll> pll;



ll n;
ll a[505][505];
ll col[5005];
void dfs(ll s, ll c)
{
        if(col[s]>=0) return;
        col[s] = c;
        for(ll i=1;i<=n;i++) {
                if(a[s][i]) {
                        if(col[i] == -1) {
                                dfs(i,1-c);
                        }else if(col[i]==c) {
                                cout << "-1\n"; exit(0);
                        }
                }
        }
}
int main()
{
        cin >> n;
        for(ll i=1;i<=n;i++) {
                for(ll j=1;j<=n;j++) {
                        char x;
                        cin >> x;
                        a[i][j] = (x=='1');
                }
        }
        memset(col,-1,sizeof col);
        dfs(1 , 0);
        for(ll i=1;i<=n;i++) {
                for(ll j=1;j<=n;j++) {
                        if(a[i][j]==0 && i != j) a[i][j] = 1e16;
                }
        }
        for(ll k=1;k<=n;k++) {
                for(ll i=1;i<=n;i++) {
                        for(ll j=1;j<=n;j++) {
                                assert(a[i][i]==0);
                                //if(i==j) continue;

                                if(a[i][j] > a[i][k] + a[k][j]) {
                                        a[i][j] = a[i][k] + a[k][j];
                                }
                        }
                }
        }
        ll ans = 0;
        for(ll i=1;i<=n;i++) {
                for(ll j=1;j<=n;j++) {
                        ans = max(ans , a[i][j]+1);
                }
        }
        cout << ans << endl;
        return 0;
}


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

using namespace std;

#define ALL(x) x.begin(), x.end()
#define RALL(x) x.rbegin(), x.rend()
#define MP make_pair
#define PB push_back
#define X first
#define Y second

typedef long long int lld;
typedef pair<int, int> pii;
typedef pair<lld, lld> pll;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int n, m;
    cin >> n >> m;

    vector<int> h(n);
    vector<bool> ok(n, true);

    for (int i = 0; i < n; i++) {
        cin >> h[i];
    }

    for (int i = 0; i < m; i++) {
        int x, y;
        cin >> x >> y;
        x--, y--;

        if (h[y] >= h[x])
            ok[x] = false;
        if (h[x] >= h[y])
            ok[y] = false;
    }

    cout << count(ALL(ok), true) << '\n';



    return 0;
}

// g++ sol.cpp -o sol.out -Wall -Wextra -Wshadow -fsanitize=undefined -std=c++17

Measured memory_bytes: 3736
/*
for (int i = 0; i < N; ++i){}

// 各桁の和を計算する関数
int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) { // n が 0 になるまで
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

sort(a, a + N, greater<int>());  // a[0:N] を大きい順にソート

int num[110] = {0};  // バケット
for (int i = 0; i < N; ++i) {
    num[d[i]]++;  // d[i] が 1 個増える
}

map<string, int> mp; // 連想配列 map<キー型, 値型> オブジェクト名
for (int i = 0; i < N; ++i) {
    auto itr = mp.find(s[i]);        // s[i] が設定されているか？
    if(itr != mp.end() ) {
         mp[s[i]] += 1;
    }
    else {
         mp[s[i]] += 1 ;
    }
}
stack<int> s;	//intをデータとするスタックを用意
s.push(1);		//{} -> {1}
printf("%d\n", s.top());	// 3
s.pop();

queue<int> que;	//intをデータとするキューを用意
que.push(1);		//{} -> {1}
printf("%d\n", que.front());	// 1
que.pop();
*/
#include <iostream>
#include <set>
#include <map>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>

using namespace std;

// #define for(i,a,b) for (int i=(a);i<(b);++i)
typedef long long ll;
typedef pair<int,int> point;
#define rep(i,n) for(i,0,n)
 
int main() {
	// 入力
	int N, M, X;
	cin >> N >> M >> X;
	long A[M];
	for (int i = 0; i < N; ++i) cin >> A[i];
 
	// 解法
	int sep = 0;
	for (int i = 0; i < M; ++i) {
		if (X<A[i]){
			break;
		}
		else ++sep;
	}
	int ans = min(sep, M - sep);
	
	//出力
	printf("%d\n", ans);
}
 


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int a[3], b[3];

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

    vector<int> perm(3);
    iota(perm.begin(), perm.end(), 0);
    bool yes = false;
    do{
        do {
            bool visit[4] = {};
            visit[a[perm[0]]] = true;
            int cur = b[perm[0]];
            visit[b[perm[0]]] = true;
            if(cur == a[perm[1]]) {cur = b[perm[1]]; visit[b[perm[1]]] = true;}
            else if(cur == b[perm[1]]) {cur = a[perm[1]]; visit[a[perm[1]]] = true;}
            else break;
            if(cur == a[perm[2]]) {cur = b[perm[2]]; visit[b[perm[2]]] = true;}
            else if(cur == b[perm[2]]) {cur = a[perm[2]]; visit[a[perm[2]]] = true;}
            else break;
            if(visit[0] && visit[1] && visit[2] && visit[3]) yes = true;
        } while(false);

        do {
            bool visit[4] = {};
            visit[b[perm[0]]] = true;
            int cur = a[perm[0]];
            visit[a[perm[0]]] = true;
            if(cur == a[perm[1]]) {cur = b[perm[1]]; visit[b[perm[1]]] = true;}
            else if(cur == b[perm[1]]) {cur = a[perm[1]]; visit[a[perm[1]]] = true;}
            else break;
            if(cur == a[perm[2]]) {cur = b[perm[2]]; visit[b[perm[2]]] = true;}
            else if(cur == b[perm[2]]) {cur = a[perm[2]]; visit[a[perm[2]]] = true;}
            else break;
            if(visit[0] && visit[1] && visit[2] && visit[3]) yes = true;
        } while(false);

        if(yes) break;

    }while(next_permutation(perm.begin(), perm.end()));

    if(yes) cout << "YES" << endl;
    else cout << "NO" << endl;
}

Measured memory_bytes: 256
#include <functional>
#include <algorithm>
#include <iostream>
#include <numeric>
#include <iomanip>
#include <utility>
#include <cstdlib>
#include <sstream>
#include <bitset>
#include <vector>
#include <cstdio>
#include <ctime>
#include <queue>
#include <deque>
#include <cmath>
#include <stack>
#include <list>
#include <map>
#include <set>

using namespace std;

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

#define dump(x)  cerr << #x << " = " << (x) << endl
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back
#define sz size()

const double EPS = 1e-10;
const int INF = 100000000;

int main(){
    int a,b;
    while(cin>>a>>b){
        cout<<a+b<<endl;
    }

    
    return 0;
}

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

int main() {
    long long int a, b;
    cin>>a>>b;
    long long int ans = INT_MAX;
    long long int a1 = -1 * a;
    long long int b1 = -1 * b;
    if(a1 <= b){
        ans = min(ans, 1 +(b-a1));
    } 
    if( a <= b1){
        ans = min(ans, 1 + (b1 - a));
    } 
    if(a <= b){
        ans = min(ans, b - a);
    } 
    if(a1 <= b1){
        ans = min(ans, 2 + (b1 - a1));
    }
    cout<<ans<<endl;
    return 0;
}


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

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

	queue<unsigned long> que;
	for (int i=1; i< 10;i++) {
		que.push(i);
	}

	unsigned long lln=0;
	for (int i=0; i<k; i++) {
		lln = que.front(); que.pop();
		if (lln%10 != 0) {
			que.push(10*lln+lln%10+-1);
		}
		que.push(10*lln+lln%10);
		if (lln%10 != 9) {
			que.push(10*lln+lln%10+1);
		}
	}
	cout << lln << endl;
}

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

int main() {
  int h,w,max = 0;
  cin >> h >> w;
  vector<string>maze(h);
  vector<int>nx = {1,0,-1,0};
  vector<int>ny = {0,1,0,-1};
  for(int i = 0;i < h;i++) cin >> maze[i];
  for(int i = 0;i < h;i++){
    for(int j = 0;j < w;j++){
      if(maze[i][j] == '#') continue;
      vector<vector<int>>dist(h,vector<int>(w,-1));
      queue<pair<int,int>>que;
      dist[i][j] = 0;
      que.push(pair<int,int>(i,j));
      while(!que.empty()){
        pair<int,int>v = que.front();
        que.pop();
        for(int k = 0;k < 4;k++) {
          if(v.first == 0 && k == 2) continue;
          if(v.first == h-1 && k == 0) continue;
          if(v.second == 0 && k == 3) continue;
          if(v.second == w-1 && k == 1) continue;
          if (dist[v.first+nx[k]][v.second+ny[k]] != -1 || maze[v.first+nx[k]][v.second+ny[k]] == '#') continue;
          dist[v.first+nx[k]][v.second+ny[k]] = dist[v.first][v.second] + 1;
          if(max < dist[v.first+nx[k]][v.second+ny[k]]) max = dist[v.first+nx[k]][v.second+ny[k]];
          que.push(pair<int,int>(v.first+nx[k],v.second+ny[k]));
        }
      }
    }
  }
  cout << max << endl;
}


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

using namespace std;
typedef long long ll;

template<typename T>
void vecprint(vector<T> v) {
    for(auto x : v) {
        cout << x << " ";
    }
    cout << endl;
}

template<typename T>
void qprint(priority_queue<T> q) {
    while(!q.empty()) {
        cout << q.top() << " ";
        q.pop();
    }
    cout << endl;
}

int main(void) {
    int n;
    cin >> n;
    
    vector<int> h;
    for(int i = 0; i < n; i++) {
        int tmp;
        cin >> tmp;
        h.push_back(tmp);
    }
    
    priority_queue<int> ans;
    int idx = 0, tmp = 0;
    while(idx < n-1) {
        while(h[idx] >= h[idx+1] && idx < n-1) {
            idx++;
            tmp++;
        }
        ans.push(tmp);
        idx++;
        tmp = 0;
    }
    
    ans.push(tmp);
    //qprint(ans);
    cout << ans.top() << endl;
}

Measured memory_bytes: 1400
import sys
## io ##
def IS(): return sys.stdin.readline().rstrip()
def II(): return int(IS())
def MII(): return list(map(int, IS().split()))
from bisect import bisect_left
from collections import deque
#======================================================#
def main():
    n = II()
    cc = list(IS())
    cc_rev = cc[::-1]
    cnt = 0
    indexs = []
    for i, c in enumerate(cc):
        if c == 'W':
            indexs.append(i)
    indexs = deque(indexs)
    if cc.count('W') == 0:
        print(0)
        return 0
    # print(indexs)
    for i, c in enumerate(cc_rev):
        if c == 'R':
            if indexs:
                idx = indexs.popleft()
                if idx < (n-i-1):
                    cc[idx] = 'R'
                    cnt += 1
    print(cnt)

if __name__ == '__main__':
    main()

Measured memory_bytes: 22004
#include<iostream>
#include<vector>
using namespace std;
int  main(){
  int k;
  cin>>k;
  vector<string> v;
  v.insert(v.begin(), k, "ACL");
  for(auto it=v.begin();it!=v.end();it++){
		  cout<<*it;
  }
  return 0;
}

Measured memory_bytes: 3624
def main():

    K = int(input())
    A = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
    return A[K-1]

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


Measured memory_bytes: 38384
import fractions

A,B,C,D = map(int,input().split())
m2 = B//C - (A-1)//C
m3 = B//D - (A-1)//D
m6 = B//(C*D//fractions.gcd(C,D)) - (A-1)//(C*D//fractions.gcd(C,D))
print(B-A+1-(m2+m3-m6))

Measured memory_bytes: 5048
#include <bits/stdc++.h>
using namespace std;
long long m=1e9+7;
long long fact[1000001],inv[1000001];

long long modRecursive(long long a,long long b,long long c)
{
	if(b == 0) return 1;
	if(b%2 ==0) return modRecursive((a*a)%c,b/2,c);
	else return ((a%c)*(modRecursive((a*a)%c,b/2,c)))%c;
}

int main()
{
    string s;
    cin>>s;
    map<char,int> x; int d=0;
    for(int i=0; i<s.size(); i++)
        x[s[i]]++;
    for(auto i:x)
        if(i.second%2==1) d=1;
    if(d) cout<<"No\n";
    else cout<<"Yes\n";
}


Measured memory_bytes: 256
var
	n,m,x,y,i,max,min,a:longint;
begin
	read(n,m,x,y);
	min:=1000; max:=-1000;
	for i:=1 to n do
	begin	
		read(a);
		if max<a then max:=a;
	end;
	for i:=1 to m do
	begin
		read(a);
		if min>a then min:=a;
	end;
	for i:=x+1 to y do
		if (i>max) and (i<=min) then
		begin
			writeln('No War');
			halt;
		end;
	writeln('War');
end.

Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<cmath>
using namespace std;
char s[5];
int main()
{
	scanf("%s",s+1);
	for(int i=1;i<4;i++)
	if(s[i]==s[i+1]){printf("Bad\n");return 0;}
	printf("Good\n");
}

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

int d[110];

int main() {
    int n;
    cin >> n;
    for(int i = 0; i < n; ++i){
        cin >> d[i];
    }

    int ans = 0;
    for(int i = 0; i < n; ++i){
        for(int j = i + 1; j < n; ++j){
            if(i == j) continue;
            ans += d[i] * d[j];
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
def examC():
    N = LI(); N.sort()
    if N[0]==1:
        if N[1]==1:
            ans = 1
        else:
            ans = max(0,N[1]-2)
    else:
        ans = (N[1]-2)*(N[0]-2)
    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
alphabet = [chr(ord('a') + i) for i in range(26)]

if __name__ == '__main__':
    examC()

"""

"""

Measured memory_bytes: 3444
#include <stdio.h>

int main(void){
  int n, s[1001], i, sum=0;
  double ave, a=0;

  while(1){
    scanf("%d", &n);
    if(n == 0)
      break;
    for(i = 0; i < n; i++){
      scanf("%d", &s[i]);
      sum += s[i];
    }
    ave = (double)sum / n;
    for(i = 0; i < n; i++){
      a += ((s[i] - ave) * (s[i] - ave));
    }
    printf("%f\n", sqrt((double)a / n));
    sum = 0; a = 0;
  }
  return 0;
}




Measured memory_bytes: 2044
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <cstdio>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
using namespace std;
#define MOD 1000000007
#define rep(i,n) for(int i = 0; i < (n); ++i)
typedef long long ll;


int main(void) {
  int n, k;
  cin >> n >> k;
  vector<int> teki(n);
  rep(i, n) {
    cin >> teki[i];
  }
  sort(teki.rbegin(), teki.rend());
  ll ans = 0;
  for(int i = k; i < n; ++i) {
    ans += (ll)teki[i];
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0; i<(n); i++)
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; cin>>n;
    map<string,ll> cnt;
    vector<string> s(n);
    rep(i,n){
        cin>>s[i];
        cnt[s[i]]++;
    }
    vector<string> res={};
    ll maximum=0;
    rep(i,n){
        if(maximum<cnt[s[i]]) {maximum=cnt[s[i]]; res={}; res={s[i]};}
        else if(maximum==cnt[s[i]]) res.push_back(s[i]);
        cnt[s[i]]=0;
    }
  	sort(res.begin(),res.end());
    rep(i,res.size())cout<<res[i]<<endl;
    return 0;
}

Measured memory_bytes: 28404
#include <iostream>
#include <set>
#include <queue>
#include <vector>
#include <algorithm>
#include <math.h>
#include <cmath>
#include <string>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
#include <tuple>
#include <numeric>
#include <functional>

using namespace std;

/*-----------------------------------------------------------------------------
　定義
 -----------------------------------------------------------------------*/
#define ALL(a)				(a).begin(),(a).end()
#define REP(i, n)			for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n)		for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define INF					(1000 * 1000 * 1000 * 2)
#define MOD					(1000 * 1000 * 1000 + 7)
#define Ceil(x, n)			(((((x))+((n)-1))/n))	/* Nの倍数に切り上げ割り算 */
#define CeilN(x, n)			(((((x))+((n)-1))/n)*n)	/* Nの倍数に切り上げ */
#define FloorN(x, n)		((x)-(x)%(n))			/* Nの倍数に切り下げ */
#define IsOdd(x)			(((x)&0x01UL) == 0x01UL)			
#define IsEven(x)			(!IsOdd((x)))						
#define	BitSetV(Val,Bit)	((Val) |= (Bit))			
#define	BitTstV(Val,Bit)	((Val) & (Bit))				
#define M_PI				3.14159265358979323846
typedef long long			ll;
typedef pair<ll, ll>		P;

/*-----------------------------------------------------------------------------
　処理
 -----------------------------------------------------------------------------*/
// メイン
int main()
{
	string S, T;
	cin >> S >> T;
	cout << T  << S << endl;
	return 0;
}



Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);

		int d = sc.nextInt();
		String result = "";

		switch(d){
		case 22:
			result += " Eve";
		case 23:
			result += " Eve";
		case 24:
			result += " Eve";
		case 25:
			result = "Christmas" + result;

		}

		System.out.println(result);

	}

}


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

struct UnionFind {
  map<int, int> parent, siz;
  UnionFind(int n) {
    for (int i = 0; i < n; i++) {
      parent[i]=i;
      siz[i]=1;
    }
  }
  int find (int x){
    if (parent[x]==x) return x;
    return find(parent[x]);
  }
  void unite(int x, int y){
    int routeX = find(x);
    int routeY = find(y);
    if (routeX == routeY) return;
    
    if (siz[routeX] < siz[routeY]) swap(routeX,routeY);
    parent[routeY] = routeX;
    siz[routeX] += siz[routeY];
  }
  int size(int x) {return siz[find(x)];}
  bool same(int x, int y) {return find(x)==find(y);}
};

int main(){
  int N, M, K;
  cin >> N >> M >> K;
  
  UnionFind uf(N);
  map<int, int> friendsOrBlocks;
  for (int i = 0; i < M; i++) {
    int A, B;
    cin >> A >> B;
    A--;
    B--;
    uf.unite(A, B);
    friendsOrBlocks[A]++;
    friendsOrBlocks[B]++;
  }
  
  for (int i = 0; i < K; i++) {
    int C, D;
    cin >> C >> D;
    C--;
    D--;
    
    if (uf.same(C,D)) {
      friendsOrBlocks[C]++;
      friendsOrBlocks[D]++;
    }
  }
    
  for (int i = 0; i < N; i++) {
    cout << uf.size(i) - friendsOrBlocks[i] - 1 << " ";
  }
  cout << endl;
  
  return 0;
}

Measured memory_bytes: 14976
n,m= map(int, input().split())
par = [i for i in range(n)]

def find(x):
  if par[x] == x:
    return x
  else:
    par[x] = find(par[x])
    return par[x]

def unite(x, y):
  x = find(x)
  y = find(y)
  if x > y:
    par[x] = y
    find(x)
  else:
    par[y] = x
    find(y)

if m > 0:  
  for i in range(m):
    a, b = map(int, input().split())
    unite(a - 1, b - 1)
  
  ans = [0] * n
  Max = 0
  for i in range(n):
    find(i)
  for i in par:
    ans[i] += 1
  for i in ans:
    if i > Max:
      Max = i
  
  print(Max)
else:
  print(1)

Measured memory_bytes: 18404
#include<stdio.h>
int main(){
  int a, b, d, r;
  double f;
  scanf("%d %d", &a, &b);
d=a/b;
 r=a-b*d;
 f=(double)a/b;
   printf("%d %d %f\n", d, r, f);
  return 0;
}

Measured memory_bytes: 1852
#include <iostream>
#include <queue>
#include <vector>
#include <algorithm>
#include <vector>
#include <limits>

constexpr int MAX_N = 1000000;
constexpr auto INF = std::numeric_limits<int>::max();

using Pair = std::pair<int, int>;

struct segtree {
    int N;
    std::vector<Pair> dat{2*MAX_N};
    segtree() {}
    segtree(int n) {
        N = 1;
        while(N < n) N *= 2;
        for(int i = 0; i < 2*N-1; i++)
            dat[i] = {INF, INF};
    }

    void update(int k, int score) {
        Pair a{-score, k};
        k += N-1;
        dat[k] = a;
        while(k > 0) {
            k = (k - 1) / 2;
            dat[k] = min(dat[k*2+1], dat[k*2+2]);
        }
    }

    Pair query(int a, int b) { return query(a, b, 0, 0, N); }
    Pair query(int a, int b, int k, int l, int r) {
        if(r <= a or b <= l) return Pair{INF, INF};
        if(a <= l and r <= b) return dat[k];
        auto m = (l + r) / 2;
        return min(query(a, b, k*2+1, l, m), query(a, b, k*2+2, m, r));
    }
};

int n, r, l;
int scores[MAX_N];
int time_[MAX_N];

int main() {
    std::cin >> n >> r >> l;

    segtree st(n);

    for(int i = 0; i < n; ++i) {
        st.update(i, 0);
    }

    std::fill(scores, scores + n, 0);
    std::fill(time_, time_ + n, 0);

    int d, t, x;
    int prevTime = 0;
    for(int i = 0; i < r; ++i) {
        std::cin >> d >> t >> x;

        auto m = st.query(0, n);

        time_[m.second] += t - prevTime;

        --d;

        scores[d] += x;

        st.update(d, scores[d]);

        prevTime = t;
    }

    auto m = st.query(0, n);

    time_[m.second] += l - prevTime;

    /*for(int i = 0; i < n; ++i) {
        std::cout << scores[i] << " ";
    }
    std::cout << std::endl;

    for(int i = 0; i < n; ++i) {
        std::cout << time_[i] << " ";
    }
    std::cout << std::endl;
*/
    std::cout << (std::max_element(time_, time_ + n) - time_ + 1) << std::endl;
}

Measured memory_bytes: 19228
use std::io::*;
use std::str::FromStr;
//portable utility
#[allow(dead_code)]
fn switch<T>(flag: bool, true_value: T, false_value: T) -> T {
    if flag {
        true_value
    } else {
        false_value
    }
}

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

#[allow(dead_code)]
fn read_string() -> Vec<char> {
    read::<String>().chars().collect()
}

//main program
fn main() {
    let number: i32 = read();
    let (high, low) = (number / 500, number % 500);
    let score = high * 1000 + (low / 5) * 5;
    println!("{}", score);
}


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

int n,res=1e9,a[105];

int main()
{
    cin>>n;
    for(int i=1;i<=n;i++)
        cin>>a[i];
    sort(a+1,a+n+1);
    cout<<a[n]-a[1];
}


Measured memory_bytes: 256
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007

#A
def A():
    n = I()
    s = S()
    d = defaultdict(int)
    for i in s:
        d[i] += 1
    ans = 1
    for i in d.keys():
        ans *= d[i]+1
        ans %= mod
    print(ans-1)
#B
def B():
    n = I()
    c = IR(n)
    v = [[i+1] for i in range(n-1)]
    v.append([])
    d = defaultdict(deque)
    for i in range(n):
        d[c[i]].append(i)
    for i in d.keys():
        x = None
        while d[i]:
            y = d[i].popleft()
            if x != None and y != x+1:
                v[x].append(y)
            x = y
    path = [0]*(n)
    path[0] = 1
    q = [0]
    for x in range(n-1):
        for y in v[x]:
            path[y] += path[x]
            path[y] %= mod
    print(path[-1])
#C
def C():
    def dfs(ans,l,r,d):
        if r != l+1:
            i = n-1
            c = ans[l]^ans[r]
            while not c&po2[i]:i -= 1
            d[i] = 1
            j = 0
            while d[j] or i == j:j += 1;j %= n
            m = (l+r)//2
            ans[m] = ans[l]^po2[j]
            ans[m+1] = ans[m]^po2[i]
            dfs(ans,l,m,d[:i]+[1]+d[i+1:])
            dfs(ans,m+1,r,d[:i]+[1]+d[i+1:])
    n,a,b = LI()
    po2 = [1]*(n+1)
    for i in range(1,n+1):
        po2[i] = po2[i-1]*2
    k = b^a
    c = 0
    bi = []
    i = 0
    g = [0]*n
    while k > 0:
        if k%2:
            bi.append(i)
            g[i] = 1
        c += k%2
        k//= 2
        i += 1
    f = c
    bi = bi[::-1]
    if not f%2:
        print("NO")
        quit()
    ans = [0]*po2[n]
    ans[0] = a
    ans[po2[n]-1] = b
    d = [0]*n
    dfs(ans,0,po2[n]-1,d)
    print("YES")
    print(*ans)
#D
def D():
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == "__main__":
    C()


Measured memory_bytes: 53340
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <numeric>
#include <stack>
#include <set>
#include <queue>
#include <list>
using namespace std;
typedef long long ll;

void solve() {
	int l, r, d; cin >> l >> r >> d;
	cout << r / d - (l - 1) / d;
}

int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	// int t; cin >> t;
	// while (t--)
	solve();

}

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

using namespace std;

#define INF 100000000
#define YJ 1145141919
#define INF_INT_MAX 2147483647
#define INF_LL 9223372036854775
#define INF_LL_MAX 9223372036854775807
#define EPS 1e-10
#define MOD 1000000007
#define MOD9 998244353
#define Pi acos(-1)
#define LL long long
#define ULL unsigned long long
#define LD long double

#define int long long

using II = pair<int, int>;

int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a * b / gcd(a, b); }
int extgcd(int a, int b, int &x, int &y) { int g = a; x = 1; y = 0; if (b != 0) g = extgcd(b, a % b, y, x), y -= (a / b) * x; return g; }

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(a)  begin((a)), end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())

const int MAX_N = 200005;
int N;
int A[MAX_N];

int K[MAX_N];

signed main()
{
  cin >> N;
  REP(n,N) {
    cin >> A[n];
    K[A[n]]++;
  }

  int ans = 0;
  FOR(i,1,N+1) {
    ans += K[i] * (K[i]-1) / 2;
  }

  REP(n,N) {
    int i = A[n];
    cout << ans - ( K[i] * (K[i]-1) / 2) + ( (K[i]-1) * (K[i]-2) / 2) << endl;
  }

  return 0;
}


Measured memory_bytes: 4736
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <cassert>
#include <queue>
#include <set>
#include <map>
#include <valarray>
#include <bitset>
#include <stack>
#include <iomanip>
#include <fstream>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define chmax(a,b) (a<b?(a=b,1):0)
#define chmin(a,b) (a>b?(a=b,1):0)
#define valid(y,x,h,w) (0<=y&&y<h&&0<=x&&x<w)
const int INF = 1<<29;
const double EPS = 1e-8;
const double PI = acos(-1);
typedef long long ll;
typedef pair<int,int> pii;

int main() {
  int n;
  while(cin >> n) {
    stack<int> S;
    int ans = 0;
    REP(i,n) {
      int a;
      cin >> a;
      while(S.size()&&S.top()>a) {
        ans++;
        S.pop();
      }
      if (S.size()==0||S.top()!=a)S.push(a);
    }
    ans += S.size();
    cout << ans << endl;
  }
}

Measured memory_bytes: 1804
typedef long long ll;
#include <bits/stdc++.h>
using namespace std;
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int main(){
    ll n,x;
    ll l[110];
    std::cin >> n>>x;
    for (int i = 0; i < n; i++) {
        std::cin >> l[i];
    }
    ll now = 0;
    ll result = 0;
    result++;
    
    for (int i = 0; i < n; i++) {
        now += l[i];
        if(now<=x){
            result++;
        }
    }
    std::cout << result << std::endl;
    
}


Measured memory_bytes: 256
//
//	Created by shamim_nik
//

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef tree<int,null_type,less<int>,rb_tree_tag,
		tree_order_statistics_node_update> indexed_set;

#define br printf("\n")
#define pi acos(-1)

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

//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);

	int num;
    cin >> num;
    vector<int> arr(num + 1);
    for (int i = 1; i < num; ++i){
        int val;
        cin >> val;
        arr[val]++;
    }
    for (int i = 1; i < arr.size(); i++) {
        cout << arr[i] << endl;
    }
	return 0;
}

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

int main()
{
  int n, a;
  cin >> n >> a;
  cout << (n * n) - a << endl;
  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
const int N=5e5+4;
char ss[N];
int a[N],b[N],n;
ll sum;
int main() {
	scanf("%s",ss+1);
	n=strlen(ss+1)+1;
	for (register int i=2;i<=n;++i)
		if (ss[i-1]=='<')
			a[i]=a[i-1]+1;
	for (register int i=n-1;i;--i)
		if (ss[i]=='>')
			b[i]=b[i+1]+1;
	for (register int i=1;i<=n;++i)
		sum+=max(a[i],b[i]);
	printf("%lld\n",sum);
	return 0;
}

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

using ll = long long;
using vi = vector<int>;
using vll = vector<long long>;

int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

constexpr long long mod = 1000000007;

long long int mod_pow(long long int x, long long int n, long long int p) {
    long long int res = 1;
    while (n > 0) {
        if (n & 1)
            res = res * x % mod;
        x = x * x % mod;
        n >>= 1;
    }
    return res;
}

#define rep(i, n) for (int i = 0; i < n; i++)

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

    ll n, k;
    cin >> n >> k;
    vll a(n);
    rep(i, n) cin >> a[i];

    if (n == 1) {
        cout << 0 << endl;
    } else {
        ll cnt = 0, cnt2 = 0;
        for (int i = 0; i < n - 1; i++) {
            for (int j = i; j < n; j++) {
                if (a[i] > a[j]) {
                    cnt++;
                }
            }
        }

        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                if (a[i] < a[j]) {
                    cnt2++;
                }
            }
        }

        ll ans = 0;

        cnt *= k;
        cnt %= mod;
        ll t = k * (k - 1);
        t %= mod;
        t *= mod_pow(2, mod - 2, mod);
        t %= mod;
        cnt2 *= t;
        cnt2 %= mod;
        ans = cnt + cnt2;
        ans %= mod;
        cout << ans << endl;
    }
}

Measured memory_bytes: 256
#include<iostream>                                         
using namespace  std;                                      
                                                           
int main(){                                                
  int n;                                                   
  cin >> n;                                                
  int a[n];                                                
  int i;                                                   
                                                           
  for(i=0;i<n;i++){                                        
    cin >> a[i];                                           
  }                                                        
                                                           
                                                           
  for(i=n-1;i>=0;i--){                                     
    cout << a[i];                                          
    if(i==0) break;                                        
    cout << " ";                                           
  }                                                        
  cout << endl;                                            
  return 0;                                                
} 

Measured memory_bytes: 3096
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
int main() {
  ll N;
  string S;
  cin >> N >> S;
  ll A = S.size();
  if(A <= N) {
    cout << S << endl;
  }
  else {
    rep(i, N) {
      cout << S.at(i);
    }
    cout << "..." << endl;
  }
}

Measured memory_bytes: 3588
// ABC141-D
#include <bits/stdc++.h>
#define endl "\n"
#define rep(i,n) for(int i=0;i<int(n);i++)
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
namespace you {
    std::string to_string(char val) {
        return std::string(1, val);
        // return std::string{val};
        // you::to_string(char)
    }
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(12);

    int n,m;
    cin>>n>>m;
    priority_queue<int> p;
    rep(i,n){
        int aa;
        cin>>aa;
        p.push(aa);
    }
    ll ans=0;
    rep(i,m){
        int bb=p.top();
        p.pop();
        bb=bb/2;
        p.push(bb);
    }
    rep(i,n){
        ans+=p.top();
        p.pop();
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 892
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
void READ() {
#define R READ();
#define INFI 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define MEMX(x,num) memset(x,num,sizeof(x))
#define prln(x) cout<<#x<<"="<<x<<endl
#define sz(x) int(x.size())
#define PB(x) push_back(x)
#define LINK(x,y) G[x].PB(y),G[y].PB(x)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=a;i>=b;i--)
#ifndef ONLINE_JUDGE
    freopen ( "A.in", "r", stdin );
#endif
    std::ios::sync_with_stdio ( 0 );
    cin.tie ( 0 );
    cout << fixed << setprecision ( 8 );
}
//////////////////////////////////////////
const int N = 5 + 1e5;
const LL M=1e15;
struct Edge {
    int from, to;
    LL dist;
    Edge (int u, int v, LL d): from(u), to(v), dist(d) {}
};
struct HeapNode {
    LL d;
    int u;
    bool operator< (const HeapNode& rhs)const {return d > rhs.d;}
};
struct Dijkstra {
    vector<Edge>edges;
    vector<int>G[N];
    bool done[N];
    LL d[N];
    int n, p[N];
    void init(int n) {
        this->n = n;
        for(int i = 0; i < n; i++)G[i].clear();
        edges.clear();
    }
    void AddEdge(int from, int to, LL dist) {
        G[from].push_back(edges.size());
        edges.push_back(Edge(from, to, dist));
    }
    void dijkstra(int s) {
        priority_queue<HeapNode>pq;
        MEMX(done, 0);
        if(typeid(d[0]).name()==typeid(int).name())
        MEMX(d,0x3f);
        else MEMX(d,0x43);
        d[s] = 0;
        pq.push((HeapNode) {0, s});
        HeapNode x;
        while(!pq.empty()) {
            x = pq.top();
            pq.pop();
            int u = x.u;
            if(done[u])continue;
            done[u] = true;
            for(int i = 0; i < G[u].size(); i++) {
                Edge& e = edges[G[u][i]];
                if(d[e.to] > d[u] + e.dist) {
                    d[e.to] = d[u] + e.dist;
                    //  p[e.to] = G[u][i];
                    pq.push((HeapNode) {d[e.to], e.to});
                }
            }
        }
    }
//    void prtpath(int st, int en) {//调用dijkstra(en),反向输出
//        for(int i = st; i != en; i = edges[p[i]].from) {
//            cout << i << " ";
//        }
//        cout << en << endl;
//    }
} dij[2];
int n, m, st, en;
LL d[N];
int main() {
    std::ios::sync_with_stdio ( 0 );
    cin.tie ( 0 );
    cin >> n >> m >> st >> en;
    dij[0].init(n);
    dij[1].init(n);
    for(int i = 0, u, v, d,d2; i < m; i++) {
        cin >> u >> v >> d>>d2;
        dij[0].AddEdge(u, v, d);
        dij[0].AddEdge(v, u, d);
        dij[1].AddEdge(u, v, d2);
        dij[1].AddEdge(v, u, d2);
    }
    dij[0].dijkstra(st);
    dij[1].dijkstra(en);
    per(i,n,1)d[i]=max(d[i+1],M-dij[0].d[i]-dij[1].d[i]);
    rep(i,1,n)cout<<d[i]<<endl;

    return 0;
}



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

int main(){
    string s; cin >> s;
    ll k; cin >> k;
    ll res = 1;
    char x;
    rep(i,s.size()){
        if(s[i]!='1'){
            x = s[i];
            break;
        }
        ++res;
    }
    cout << (k<res?'1':x) << endl;
}


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

using namespace std;

int main(){
    
    string S, T;
    cin >> S >> T;
    
    bool ans = true;
    for(int i = 0; i < S.size(); i++){
        if(S[i] != T[i]) ans = false;
    }
    
    
    if(ans){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}


Measured memory_bytes: 3128