akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1145141919810893364
const double PI = 3.141592653589;
typedef pair<int,int> PP;
typedef long long ll;
#define int ll
#define setdouble setprecision
#define REP(i,n) for(int i=0;i<(n);++i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define GOODBYE do { cout << "-1" << endl; return 0; } while (false)
#define MM <<" "<<
#define Endl endl

signed main(void){
    int N,L;
    int T[3141];
    cin >> N >> L;
    REP(i,N){
        cin >> T[i];
    }
    double X=0,Y=0;
    for(int j=0;j<N;j++){
        for(int i=0;i<j;i++){
            //内側:j-i-1個
            //外側:N-j+i-1個
            
            //内側
            X+=(j-i-1)*-1*cos(2*PI*((0.0+T[i]+T[j])/2)/L);
            Y+=(j-i-1)*-1*sin(2*PI*((0.0+T[i]+T[j])/2)/L);
            //外側
            X+=(N-j+i-1)*cos(2*PI*((0.0+T[i]+T[j])/2)/L);
            Y+=(N-j+i-1)*sin(2*PI*((0.0+T[i]+T[j])/2)/L);
            
            //cout << i MM j << "   ";
            //cout << (j-i-1) MM (N-j+i-1) << "   ";
            //printf("%.11f %.11f\n",X,Y);
        }
    }
    int M=N*(N-1)*(N-2)/6;
    X/=M;Y/=M;
    printf("%.11f %.11f\n",X,Y);
    return 0;
}



Measured memory_bytes: 256
#include <cmath>
#include <iostream>
#include <string>
#include <stack>
#include <map>
#include <set>
#include <vector>
#include <algorithm>

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

const int MIN = 200001;
const int MOD = 1000000007;
const long long MAX = 1e15 + 9;

using namespace std;

int main() {
	unsigned long long h, r = 1, s = 0;
	
	cin >> h;
	
	while (h > 1) {
		h /= 2;
		r *= 2;
		s += r;
	}
	
	cout << (s + 1) << endl;
	
	return 0;
}

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

void solver() {
  int h, a;
  cin >> h >> a;

  int ans;
  if (h % a == 0) ans = h / a;
  else ans = (h / a) + 1;

  cout << ans << "\n";
}

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


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

int main()
{
		int N;
		int D;
		int possible;
		int men;

		cin >> N >> D;

		possible = 2 * D + 1;

		if (N%possible == 0)
		{
			men = N / possible;

			cout << men << endl;
		}
		else
		{
			men = N / possible + 1;

			cout << men << endl;
		}
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
#define fast_cin ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define pb push_back
#define mp make_pair
#define ll long long int
using namespace std;

vector<ll> dp(100005,0);
int m=1e9+7;
bool cmp(pair<int,int>&a,pair<int,int>&b)
{
    if(a.second==b.second)
        return a.first<b.first;
    else
        return a.second<b.second;
}

bool cmp_(pair<int,pair<int,int> >&a,pair<int,pair<int,int> >&b)
{
   return a.second.first<b.second.first;
}

void factorial()
{
    dp[1]=1;
    for(int i=2;i<=100000;i++)
    {
        dp[i]=((dp[i-1]%m)*(i%m))%m;
    }
}

int main()
{
    fast_cin;
    int t;
    t=1;
    int tc=0;
    while(t--)
    {
      int n,w;
      cin>>n>>w;
      vector<vector<ll> > dp(n+1);
      for(int i=0;i<=n;i++)
      {
          dp[i].assign(w+1,0);
      }
      for(int i=1;i<=n;i++)
      {
          ll u,v;
          cin>>u>>v;
          for(int j=1;j<=w;j++)
          {
              if(j>=u)
              {
                  dp[i][j]=v+dp[i-1][j-u];
              }
              dp[i][j]=max(dp[i][j],dp[i-1][j]);
          }
      }
      cout<<dp[n][w]<<endl;
    }
    return 0;
}
/*#include <iostream>
#include <bits/stdc++.h>
#define fast_cin ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define pb push_back
#define mp make_pair
#define ll long long int
using namespace std;

vector<ll> dp(100005,0);
int m=1e9+7;
bool cmp(pair<int,int>&a,pair<int,int>&b)
{
    if(a.second==b.second)
        return a.first<b.first;
    else
        return a.second<b.second;
}

bool cmp_(pair<int,pair<int,int> >&a,pair<int,pair<int,int> >&b)
{
   return a.second.first<b.second.first;
}

void factorial()
{
    dp[1]=1;
    for(int i=2;i<=100000;i++)
    {
        dp[i]=((dp[i-1]%m)*(i%m))%m;
    }
}
void binary(int n)
{
    // array to store binary number
    int binaryNum[32];

    // counter for binary array
    int i = 0;
    while (n > 0) {

        // storing remainder in binary array
        binaryNum[i] = n % 2;
        n = n / 2;
        i++;
    }

    // printing binary array in reverse order
    for (int j = i - 1; j >= 0; j--)
        cout << binaryNum[j];
}
int main()
{
    fast_cin;
    int t;
    cin>>t;
    int tc=0;
    ll x=10000009;
    while(t--)
    {
       ll p,f,cnts,cntw,s,w;
       cin>>p>>f>>cnts>>cntw>>s>>w;
       ll ans=0;
       ll x1,y1,x2,y2;
       if(s>w)
       {
           swap(s,w);
           swap(cnts,cntw);
       }
       for(ll i=0;i<=cnts;i++)
       {
           x1=min(i,p/s);
           y1=min((p-(x1*s))/w,cntw);
           x2=min((cnts-x1),(f/s));
           y2=min((f-(x2*s))/w,cntw-y1);
           ans=max(ans,x1+y1+x2+y2);
       }
       cout<<ans<<endl;
    }
    return 0;
}*/


Measured memory_bytes: 83104
#include <stdio.h>
#define N 200000
int main()
{
    int i,j,min,n,A[N],max;
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
      scanf("%d",&A[i]);
    }
    max=-2000000000;
    min=A[0];
    for(i=1;i<n;i++)
    {
      if(A[i]-min>max)
      max=A[i]-min;
      if(A[i]<min)
      min=A[i];
    }
    printf("%d\n",max);
    return 0;
}



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

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using dict = map<string,int>;
using pii = pair<int,int> ;

constexpr int imax = ((1<<30)-1)*2+1 ;
constexpr int inf = 100000000;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0};
const int dx[] = {0,-1,0,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

template<typename T>
void Unique(vector<T> &v){
  sort(all(v));
  v.erase(unique(all(v)),v.end());
}

template<typename T>
T ston(string& str, T n){
  istringstream sin(str) ;
  T num ;
  sin >> num ;
  return num ;
}

void Ans(bool f){
  if(f) cout << "YES"<<endl;
  else cout << "NO"<<endl;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  double l,r;
  vary(int,vl,4,0);
  vary(int,vr,4,0);
  while(cin >> l >> r){
    if( l >= 1.1) vl[0]++;
    else if(l >= 0.6) vl[1]++;
    else if(l >= 0.2) vl[2]++;
    else vl[3]++;

    if( r >= 1.1) vr[0]++;
    else if(r >= 0.6) vr[1]++;
    else if(r >= 0.2) vr[2]++;
    else vr[3]++;
  }
  rep(i,4){
    cout << vl[i] << " " << vr[i]<<endl;
  }
  return 0;
}

Measured memory_bytes: 3172
#include <cstdio>
#include <vector>

using namespace std;

using vi=vector<int>;

int main() {
    int N;
    scanf("%d", &N);

    vi a(N);
    for (int i=0; i<N; ++i)
        scanf("%d", &a[i]);

    int res=1<<28;
    for (int i=-100; i<=100; ++i) {
        int cur=0;
        for (int j=0; j<N; ++j)
            cur += (a[j]-i)*(a[j]-i);

        if (res > cur)
            res = cur;
    }

    printf("%d\n", res);
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<string.h>
#include<vector>
#include<map>
#include<math.h>
#include<queue>
#include<algorithm>
using namespace std;
int main() {
	int t;
	cin >> t;
	cout << t + t * t + t * t * t;
	return 0;
}

Measured memory_bytes: 3224
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def debug(*args):
    if debugmode:
        print(*args)
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def FLOAT(): return float(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 0, 1, -1, 1, -1, -1, 1]
dy = [1, -1, 0, 0, 1, -1, 1, -1]
debugmode = False

n, l = MAP()
s = (n - 1) * n // 2 + n * l
arr = []
for i in range(n):
    arr.append([l + i, abs(l + i)])
arr.sort(key=lambda x:x[1])
debug(arr)
debug(s)
print(s - arr[0][0])


Measured memory_bytes: 62700
#include <stdio.h>
#include <math.h>

struct Point {
    double x,y;
};

void makeKochCurve (Point * p1, Point * p2, int n, int maxDepth) {
    if (n > maxDepth) return;
    Point s = { p1->x + (p2->x - p1->x) / 3, p1->y + (p2->y - p1->y) / 3};
    Point t = { p1->x + (p2->x - p1->x) * 2 / 3, p1->y + (p2->y - p1->y) * 2 / 3};

    double th = M_PI * 60 / 180;
    Point u = { (t.x - s.x) * cos(th) - (t.y - s.y) * sin(th) + s.x , (t.x - s.x) * sin(th) + (t.y - s.y) * cos(th) +s.y};

    makeKochCurve(p1, &s, n + 1, maxDepth);
    printf("%.8f %.8f\n", s.x, s.y);
    makeKochCurve(&s, &u, n + 1, maxDepth);
    printf("%.8f %.8f\n", u.x, u.y);
    makeKochCurve(&u, &t, n + 1, maxDepth);
    printf("%.8f %.8f\n", t.x, t.y);
    makeKochCurve(&t, p2, n + 1, maxDepth);

}

int main() {
    Point s = {0,0};
    Point e = {100,0};

    int n;
    scanf("%d", &n);

    printf("%.8f %.8f\n", s.x, s.y);
    makeKochCurve(&s, &e, 1, n);
    printf("%.8f %.8f\n", e.x, e.y);

    return 0;
}

Measured memory_bytes: 2684
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
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; }
typedef long long ll;
const long long INF = 1LL << 60;
typedef pair<int, int> P;
int main()
{
    int D, G;
    cin >> D >> G;
    vector<int> p(D), c(D);

    rep(i, D) cin >> p[i] >> c[i];

    int ans = 1e9;
    rep(bit, 1 << D) {
        int res = 0;
        int cost = 0;
        rep(i, D) {
            if ((bit >> i) & 1) {
                res += ((i + 1) * 100) * p[i] + c[i];
                cost += p[i];
            }
        }
        rep(i, D) {
            if (res >= G) break;
            if ((bit >> (D - i - 1)) & 1) continue;
            rep(j, p[D - i - 1]) {
                res += (D - i) * 100;
                cost++;
                if (res >= G) break;
            }
            if (res >= G) break;
            res += c[D - i - 1];
        }
        chmin(ans, cost);
    }

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

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

int solve() {
  ll N, A, B, C, D; cin >> N >> A >> B >> C >> D;
  if (C == 0 && D == 0) return A == B;
  ll M = N - 1;
  double diff = abs(B - A);
  double big = D;
  double small = C;
  double mid = (big + small) / 2;
  double h = (big - small) / 2;
  ll x = 0;
  if (diff >= M*mid) x = M;
  else {
    if (M % 2 == 0) {
      x = 2 * (ll)floor(0.5 + diff / (2*mid));
    }else {
      x = -1 + 2 * (ll)floor(0.5 + (diff + mid) / (2*mid));
    }
  }
  assert(x <= M);
  if (x * mid - M*h <= diff && diff <= x * mid + M*h) return 1;
  return 0;
}

int main(int argc, char *argv[]) {
  // C-style stdio functions should not be used.
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << setprecision(20);
  if (solve()) {
    cout << "YES" << endl;
  }else {
    cout << "NO" << endl;
  }

  return 0;
}



Measured memory_bytes: 256
n = int(input())

def solve(n):
	for x in range(1, 3501):
		nx = n * x
		for y in range(x, 3501):
			# 4/n = 1/x + 1/y + 1/z
			# 1/z = 4/n - 1/x - 1/y
			# z = 1/(4/n - 1/x - 1/y)
			# z = nxy/(4xy - ny - nx)
			nxy = nx * y
			den = 4*x*y - n*y -nx
			if (den > 0 and nxy % den == 0 and nxy//den > 0):
				print(x, y, nxy//den)
				return

solve(n)		


Measured memory_bytes: 39408
#include<bits/stdc++.h>
 using namespace std;
int main(){
  int N;
  cin >> N;
  double x[20];
  string u[20];

  double total = 0.0;
  for (int i = 0; i < N; i++) {
    cin >> x[i] >> u[i];
    if (u[i] == "JPY") {
      total += x[i];
    } else {
      total += x[i]* 380000.0;
    }
  }


  cout << total << "\n";
}


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

res = 0
for i in range(n):
    tmp = 0
    for j in range(i + 1):
        tmp += a[j]
    for j in range(i, n):
        tmp += b[j]
    res = max(res, tmp)
print(res)


Measured memory_bytes: 3060
#include <stdio.h>

using namespace std;

int main(){
	int a,b;
	while(true){
		scanf("%d %d",&a,&b);
		if(a == 0 && b == 0) break;
		if(a > b) printf("%d %d\n",b,a);
		else{
			printf("%d %d\n",a,b);
		}
	}
}


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

typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<int,P> P1;

#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define rep(i,x) for(int i=0;i<x;i++)
#define rep1(i,x) for(int i=1;i<=x;i++)
#define rrep(i,x) for(int i=x-1;i>=0;i--)
#define rrep1(i,x) for(int i=x;i>0;i--)
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
#define mp1(a,b,c) P1(a,P(b,c))

const int INF=1000000000;
const int dir_4[4][2]={{1,0},{0,1},{-1,0},{0,-1}};
const int dir_8[8][2]={{1,0},{1,1},{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1}};

int main(){
	static ll h,w,n;
	static int a[100010],b[100010];
	scanf("%lld%lld%lld",&h,&w,&n);
	rep(i,n){
		scanf("%d%d",&a[i],&b[i]);
	}
	
	set<P> S,T;
	rep(i,n){
		S.insert(P(a[i],b[i]));
		rep(x,3)rep(y,3){
			if(a[i]-x >= 1 && b[i]-y >= 1){
				T.insert(P(a[i]-x,b[i]-y));
			}
		}
	}
	
	ll ret[10] = {};
	for(set<P>::iterator itr = T.begin() ; itr != T.end() ; itr++){
		P p = *itr;
		if(p.fr >= h-1 || p.sc >= w-1)continue;
		int cnt = 0;
		rep(x,3)rep(y,3){
			if(S.find(P(p.fr+x,p.sc+y)) != S.end()){
				cnt ++;
			}
		}
		ret[cnt] ++;
	}
	
	ret[0] = (h-2)*(w-2);
	rep1(i,9)ret[0] -= ret[i];
	
	rep(i,10){
		cout << ret[i] << endl;
	}
}



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

typedef long long ll;

int main()
{
    ios::sync_with_stdio(0);cin.tie(0);
    //freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);

    ll n;
    cin>>n;

    ll sum=100,i=0;
    while(sum<n){
        sum+=sum/100;i++;
    }
    cout<<i<<endl;

    return 0;
}



Measured memory_bytes: 3612
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, atan, degrees
from itertools import permutations, combinations, product, accumulate
# とけてない
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from bisect import bisect
import heapq

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, K = MAP()
A = LIST()

upper = 10**6  # 必要そうな階乗の限界を入れる
factorial = [1]
for i in range(1, upper):
    factorial.append(factorial[i-1] * i % mod)
def power(x, y):
    if y == 0:
        return 1
    elif y == 1:
        return x % mod
    elif y % 2 == 0:
        return power(x, int(y/2)) ** 2 % mod
    else:
        return power(x, int((y-1)/2)) ** 2 * x % mod

def C(n, r):
    return (((factorial[n] * x_inv[r]) % mod) * x_inv[n-r]) % mod

x_inv = [0] * upper
x_inv[-1] = power(factorial[-1], mod-2)
for i in range(upper-2, -1, -1):
    x_inv[i] = x_inv[i+1] * (i+1) % mod

A.sort()
ma = 0
mi = 0
for i in range(N-K+1):
	ma = (ma + A[-i-1] * C(N-1-i, K-1))
	# print("ma:", A[-i-1], "*", C(N-1-i, K-1))
	mi = (mi + A[i] * C(N-1-i, K-1))
	# print("mi", A[i], "*", C(N-1-i, K-1))

# print(ma, mi)
print((ma-mi)%mod)



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

static const int INF=1e9;
static const int MOD=1000000007;
typedef long long ll;
typedef pair<int,int> P;

int main(){
    ll N; cin >> N;
    char a[28];
    for(int i=0;i<26;i++){
        a[i]=i+'a';
    }
    ll tmp=N-1;
    string ans="";
    while(true){
        ll res=tmp%26;
        tmp=(tmp-res)/26;
        ans+=a[res];
        if(tmp==0) break;
        tmp--;
    }
    reverse(ans.begin(),ans.end());
    cout << ans << endl;
}


Measured memory_bytes: 3620
import java.util.Scanner;

public class Main {
	void run(){
		Scanner s = new Scanner(System.in);
	    double a = s.nextDouble();
	    double b = s.nextDouble();
	    int d = (int)(a / b);
	    int r = (int)(a % b);
	    double f = a / b;
	    System.out.printf(d+" "+ r +" " + "%f", a/b);
	    
	}
	public static void main(String[] args) {
		
		new Main().run();
		
	}
}

Measured memory_bytes: 28012
#define NDEBUG

#include <unordered_map>
#include <functional>
#include <algorithm>
#include <iostream>
#include <cassert>
#include <cstring>
#include <iomanip>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <tuple>
#include <set>
#include <map>

// [0, max)
#define FOR0(var, max) for (sl (var) = 0; (var) < (max); ++(var))
// [min, max)
#define FORi(var, min, max) for (sl (var) = (min); (var) < (max); ++(var))
// [min, max)
#define FORi_INV(var, min, max) for (sl (var) = (max) - 1; (var) + 1 > (min); --(var))
#define FORITER(var, iter) for (auto (iter) = (var).begin(); (iter) != (var).end(); (iter)++)
#define FORITER_INV(var, iter) for (auto (iter) = (var).rbegin(); (iter) != (var).rend(); (iter)++)

// a < b < c
#define LTLT(a, b, c) (((a) < (b)) && ((b) < (c)))
// a <= b < c
#define LELT(a, b, c) (((a) <= (b)) && ((b) < (c)))
// a < b <= c
#define LTLE(a, b, c) (((a) < (b)) && ((b) <= (c)))
// a <= b <= c
#define LELE(a, b, c) (((a) <= (b)) && ((b) <= (c)))

using namespace std;

using uc = unsigned char;
using ui = unsigned int;
using ul = unsigned long long int;

using sc = signed char;
using si = signed int;
using sl = signed long long int;

using ld = long double;

const static sl NMAX = 500000;
static string S;

void solve(void) {
  sl N = S.size();
  vector<sl> res(NMAX);
  vector<sl> zero;
  vector<sl> max_split_point;
  FOR0(i, N - 1) {
    if (S[i] == '>' && S[i + 1] == '<') {
      zero.push_back(i + 1);
    }
    if (S[i] == '<' && S[i + 1] == '>') {
      max_split_point.push_back(i + 1);
    }
  }
  sort(zero.begin(), zero.end());
  sort(max_split_point.begin(), max_split_point.end());
  FORITER(zero, it) {
    sl i = *it;
    res[i] = 0;
    FORi_INV(j, 0, i) {
      // res[j] = 1;
      res[j] = i - j;
      if (j == 0 || S[j - 1] == '<') {
        break;
      }
    }
    FORi(j, i, N + 1) {
      // res[i + 1] = -1;
      res[j + 1] = j - i + 1;
      if (j == N || S[j + 1] == '>') {
        break;
      }
    }
  }

  FORITER(max_split_point, it) {
    // res[*it] = 2;
    sl i = *it;
    sl a = 0, b = 0;
    if (i != 0) {
      a = res[i - 1];
    }
    if (i != N) {
      b = res[i + 1];
    }
    res[i] = (a < b ? b : a) + 1;
  }

  sl sum = 0;
  FORi(i, 1, N) {
    /*
    cout << res[i] << " ";
    if (i != N - 1) {
      cout << S[i] << " ";
    }
    */
    sum += res[i];
  }
  // cout << endl;
  cout << sum << endl;
}

int main(void) {
  cin >> S;
  S = ">" + S + "<";
  solve();
  return 0;
}

Measured memory_bytes: 7444
//04
#include<iostream>
#include<string>

using namespace std;

int main(){
  string s;
  char c;
  while(cin.get(c)){
    s+=c;
    if(s=="apple"){
      s="peach";
    }else if(s=="peach"){
      s="apple";
    }
    if(s.size()>=5){
      cout<<s[0];
      s.erase(0,1);
    }
  }
  cout<<s;
  return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>

using namespace std;

int main()
{
	int a, b;
	cin >> a >> b;
	
	do
	{
		int sum = a + b;
		int count = 0;
	
		for(int i = 10; sum != 0; i *= 10)
		{
			int diff = sum % i;
			sum -= diff;
			count++;
		}
		cout << count << endl;
	
	}while( (cin >> a) && (cin >> b) );
	
	return 0;
}

Measured memory_bytes: 1160
#include <stdio.h>
#include <string.h>
#include <math.h>

int main(void){
  long i;
  long N,K;

  double sum=0;
  double max;

  scanf("%ld %ld", &N,&K);

  int p[N];
  for(i=0;i<N;i++){
    scanf("%d",&p[i]);
  }

  for(i=0;i<K;i++){
    sum+=(double)(p[i]+1)/2;
  }
  max=sum;
  for(i=K;i<N;i++){
    sum+=(double)(p[i]+1)/2;
    sum-=(double)(p[i-K]+1)/2;
    if(max<sum){
      max=sum;
    }
  }

  printf("%.8lf\n",max);

  return 0;
}


Measured memory_bytes: 896
#ABC071C
N=int(input())
A=list(map(int,input().split()))
A_sorted=sorted(A,reverse=True)
long_line=0
lines=1
for i in range(N-1):
    if A_sorted[i]==A_sorted[i+1]:
        lines+=1
    if A_sorted[i]!=A_sorted[i+1] or i==N-2:
        if lines>=4:
            if long_line>0:
                print(long_line*A_sorted[i])
                exit()
            else:
                print(pow(A_sorted[i], 2))
                exit()
        elif lines>=2:
            if long_line>0:
                print(long_line * A_sorted[i])
                exit()
            else:
                long_line=A_sorted[i]
        lines=1
print(0)


Measured memory_bytes: 14672
#include <bits/stdc++.h>//Carefully Crafted by hetp111
using namespace std;
#define int long long
#define double long double
#define all(v) (v).begin(),(v).end()
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int,int>
#define vii vector<pii>
#define MOD 1000000007
#define MOD2 998244353
#define MOD3 1000000009
#define PI acos(-1)
#define eps (1e-8)
#define INF (1e18)
#define FASTER ios_base::sync_with_stdio(0);cin.tie(0)
template<class A,class B>ostream&operator<<(ostream&out,const pair<A,B>&a){return out<<"("<<a.first<<","<<a.second<<")";}
template<class A>ostream&operator<<(ostream&out,const vector<A>&a){for(const A &it:a)out<<it<<" ";return out;}
template<class A,class B>istream&operator>>(istream&in,pair<A,B>&a){return in>>a.first>>a.second;}
template<class A>istream&operator>>(istream&in,vector<A>&a){for(A &i:a)in>>i;return in;}
//ifstream cinn("in.in");ofstream coutt("out.out");
int poww(const int &a,int b,const int &m=MOD){if(b==0)return 1;int x=poww(a,b/2,m);x=x*x%m;if(b&1)x=x*a%m;return x;}
int ceil(const int &a,const int &b){return (a+b-1)/b;}
////Read:
//Check corner cases, n==1;
//
////Some function:
//__builtin_popcountll(), 

int nC2(int n){
    return n*(n-1)/2;
}

bool rem[101][101];

signed main(){
    FASTER;
    int n,k;cin>>n>>k;
    if(k>nC2(n-1)){
        cout<<-1;
        return 0;
    }
    int cnt=nC2(n)-k;
    for(int i=1;i<=n && k;i++){
        for(int j=i+1;j<n && k;j++){
            rem[i][j]=1;
            k--;
        }
    }
    
    cout<<cnt<<"\n";
    for(int i=1;i<=n;i++){
        for(int j=i+1;j<=n;j++){
            if(rem[i][j])continue;
            cout<<i<<" "<<j<<"\n";
        }
    }
    
}


Measured memory_bytes: 3612
#![allow(unused_imports)]

use std::cmp::{max, min, Ordering};
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
use std::io::stdin;
use std::ops::*;
use std::process::exit;
use std::str::FromStr;

fn main() {
    let (a, b): (f64, f64) = input_two();
    for i in 1..10005 {
        if (i as f64 * 0.08).floor() == a && (i as f64 * 0.10).floor() == b {
            println!("{}", i);
            break;
        }
        if i == 10004 {
            println!("-1");
        }
    }

}



pub fn input<T: FromStr>() -> T {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    buf.trim().parse().ok().unwrap()
}

pub fn input_vec<T: FromStr>() -> Vec<T> {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    buf.trim()
        .split_whitespace()
        .map(|x| x.parse().ok().unwrap())
        .collect::<Vec<_>>()
}

pub fn input_lines<T: FromStr>(l: usize) -> Vec<T> {
    let mut res = Vec::new();
    for _i in 0..l {
        res.push(input());
    }
    res
}

pub fn input_lines_two<T: FromStr, U: FromStr>(l: usize) -> Vec<(T, U)> {
    let mut res = Vec::new();
    for _i in 0..l {
        res.push(input_two());
    }
    res
}

pub fn input_lines_three<T: FromStr, U: FromStr, V: FromStr>(l: usize) -> Vec<(T, U, V)> {
    let mut res = Vec::new();
    for _i in 0..l {
        res.push(input_three());
    }
    res
}

pub fn input_two<T: FromStr, U: FromStr>() -> (T, U) {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    let s: Vec<&str> = buf.split_whitespace().collect();
    (
        s[0].parse::<T>().ok().unwrap(),
        s[1].parse::<U>().ok().unwrap(),
    )
}

pub fn input_three<T: FromStr, U: FromStr, V: FromStr>() -> (T, U, V) {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    let s: Vec<&str> = buf.split_whitespace().collect();
    (
        s[0].parse::<T>().ok().unwrap(),
        s[1].parse::<U>().ok().unwrap(),
        s[2].parse::<V>().ok().unwrap(),
    )
}

pub fn input_four<T: FromStr, U: FromStr, V: FromStr, W: FromStr>() -> (T, U, V, W) {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    let s: Vec<&str> = buf.split_whitespace().collect();
    (
        s[0].parse().ok().unwrap(),
        s[1].parse().ok().unwrap(),
        s[2].parse().ok().unwrap(),
        s[3].parse().ok().unwrap(),
    )
}


Measured memory_bytes: 4352
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int H = in.nextInt();
            int W = in.nextInt();

            char[][] grid = new char[H][W];
            for (int i = 0; i < H; i++) {
                grid[i] = in.next().toCharArray();
            }
            char[][] red = new char[H][W];
            char[][] blue = new char[H][W];
            for (int i = 0; i < H; i++) {
                Arrays.fill(red[i], '.');
                Arrays.fill(blue[i], '.');
            }

            for (int i = 0; i < H; i++) {
                red[i][0] = '#';
                blue[i][W - 1] = '#';
            }

            for (int i = 0; i < H; i++) {
                for (int j = 1; j < W - 1; j++) {
                    if (i % 2 == 0) {
                        red[i][j] = '#';
                    } else {
                        blue[i][j] = '#';
                    }
                }
            }

            for (int i = 0; i < H; i++) {
                for (int j = 0; j < W; j++) {
                    if (grid[i][j] == '#') {
                        red[i][j] = blue[i][j] = '#';
                    }
                }
            }

            for (int i = 0; i < H; i++) {
                out.println(new String(red[i]));
            }
            out.println();
            for (int i = 0; i < H; i++) {
                out.println(new String(blue[i]));
            }
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

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

    }
}


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

using namespace std;

#define pb push_back

const int maxi = 1e6+10;
int a[maxi];
string s;
vector<int> v[maxi];
long long l;

int main()
{
    cin>>l;

    double x = l / 3.00;

    printf("%.8f", x*x*x);
    return 0;
}
//volim tvoje oci tamne kao greh


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

vector<vector<int>> v(100010);
bool used[100010];

int dfs(int p){
    used[p] = true;
    int ret = 1;
    for(auto i:v[p]){
        if(!used[i]){
            ret += dfs(i);
        }
    }
    return ret;
}

int main(){
    int n;
    cin>>n;
    bool h[100010]={},w[100010]={};
    for(int i=0;i<n;i++){
        int r,c;
        cin>>r>>c;
        r--,c--;
        if(h[r] || w[c]){
            cout << -1 << endl;
            return 0;
        }
        h[r]=1, w[c]=1;
        v[r].push_back(c);
        v[c].push_back(r);
    }
    int ans = 0;
    for(int i=0;i<n;i++){
        if(!used[i]){
            ans += dfs(i);
            ans--;
        }
    }
    cout << ans << endl;
}


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

typedef long long int ll;


int main()
{
    ll N, W;
    cin >> N>>W;

    ll wt[N] ,V[N];
    for(int i=0; i<N; i++)
    {
        cin >> wt[i]>>V[i];
    }

    ll dp[W+1][N+1];
    // for(int w=0; w<=W; w++)
    // {
    //     for(int i=0; i<=N; i++)
    //     {
    //         dp[w][i] =0;
    //     }
    // }



    for(int w=0; w<=W; w++)
    {
        for(int i=0; i<=N; i++)
        {
            if(w==0 || i ==0) dp[w][i] = 0;
            else 
            {
                if(wt[i-1] <=w)
                {
                    dp[w][i] = max(dp[w][i-1], dp[w-wt[i-1]][i-1]+ V[i-1]);
                }
                else
                {
                    dp[w][i] = dp[w][i-1];
                }
            }
            
        }
    }
    cout << dp[W][N]<<endl;

    return 0;
}

Measured memory_bytes: 79104
n = int(input())
s = list(input())

cnt = 0
for j in range(2, n, 2):
    for i in range(0, n-j):
        k = (2 * i + j) // 2
        if s[i] != s[i+j] and s[i] != s[k] and s[k] != s[i+j]:
            cnt += 1

r, g, b = 0, 0, 0
for i in range(n):
    if s[i] == "R":
        r += 1
    elif s[i] == "G":
        g += 1
    else:
        b += 1

print(r*g*b-cnt)

Measured memory_bytes: 9092
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

//INSERT ABOVE HERE
Int n;
vector<Int> v(10);
Int dfs(Int x){
  if(x==n) return 0;
  if(v[x]==0) return dfs(x+1); 
  Int res=n,d=v[x];
  for(Int i=x;i<n;i++){
    v[i]+=10-d;
    v[i]%=10;
    chmin(res,dfs(x+1)+1);
  }  
  for(Int i=x;i<n;i++){
    v[i]+=d;
    v[i]%=10;
  }
  return res;
}

signed main(){
  while(cin>>n,n){
    string s,t;
    cin>>s>>t;
    for(Int i=0;i<n;i++){
      v[i]=s[i]-t[i];
      v[i]%=10;
      v[i]+=10;
      v[i]%=10;
    }
    cout<<dfs(0)<<endl;
  }
  return 0;
}



Measured memory_bytes: 3128
#include<iostream>
using namespace std;
#include<string>
#include<utility>
#include<algorithm>
#include<vector>

int main(){
    int H,W;
    cin >> H >> W;
    char s[H][W];
    for(int i=0;i<H;++i){
        for(int j=0;j<W;++j){
            cin >> s[i][j];
        }
    }
    bool possib=true;
    for(int i=0;i<H;++i){
        for(int j=0;j<W;++j){
            if(s[i][j]=='#' && s[i+1][j]!='#' && s[i-1][j]!='#' && s[i][j+1]!='#' && s[i][j-1]!='#'){
            possib=false;
            break;           
                   
              }
            }
    }
    if(possib){
        cout << "Yes";
    }  
    else{
        cout << "No";
    }
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
typedef struct{
    char S[201];
    char cin;
    int m;
    int h[200];
}SHUFF;
int main(void)
{
    SHUFF str[10];
    int num=0;
    int dnum=0;
    while(num<10){
        scanf("%s",str[num].S);
        if(str[num].S[0]=='-'){
            break;
        }
        scanf("%d",&str[num].m);
        for(int i=0;i<str[num].m;i++){
            scanf("%d\n",&str[num].h[i]);
        }
        num=num+1;
    }
    num=num-1;
    while(num>=0){
        for(int k=0;k<str[dnum].m;k++){
            for(int j=0;j<str[dnum].h[k];j++){
                for(int i=0;str[dnum].S[i+1];i++){
                    str[dnum].cin=str[dnum].S[i];
                    str[dnum].S[i]=str[dnum].S[i+1];
                    str[dnum].S[i+1]=str[dnum].cin;
                }
            }
        }
        if(str[dnum].S[0]!='-'){
            printf("%s\n",str[dnum].S);
        }
        dnum=dnum+1;
        num=num-1;
    }
    return 0;
}


Measured memory_bytes: 2048
#include <bits/stdc++.h>
using namespace std;
int H, W, N, K;
int query(int xa, int ya, int xb, int yb) {
	cout << "? " << xa << ' ' << ya << ' ' << xb - 1 << ' ' << yb - 1 << endl;
	int ret; cin >> ret;
	return ret;
}
int modpow(int a, int b, int m) {
	int ret = 1;
	while(b) {
		if(b & 1) ret = 1LL * ret * a % m;
		a = 1LL * a * a % m;
		b >>= 1;
	}
	return ret;
}
int main() {
	cin >> H >> W >> N >> K;
	int ret = 0;
	for(int i = 0; i < H; i++) {
		for(int j = 0; j < W; j++) {
			ret += query(i, j, i + 1, j + 1) * modpow(2, i * W + j, K);
			ret %= K;
		}
	}
	cout << "! " << ret << endl;
	return 0;
}

Measured memory_bytes: 724
s=input()
l=len(s)
ans=0
for i in range(1<<( l-1)):
    res=0
    tmp=int(s[0])
    for j in range(l-1):
        if ((i>>j) & 1) == 1:
            res+=tmp
            tmp=int(s[j+1])
        else:
            tmp=tmp*10+int(s[j+1])
    res+=tmp
    ans+=res
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

char conv(int n) {
  return 'a' + n;
}

int main()
{
  ll n;
  cin >> n;
  string s = "";
  while(n) {
    int r = n % 26;
    if (r) {
      s += r + 'a' - 1;  
    } else {
      s += 'z';
      r = 1;
    }
    n = (n - r) / 26;
  }
  reverse(s.begin(), s.end());
  cout << s << endl;
  return 0;
}

Measured memory_bytes: 3620
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <queue>
#include <utility>
#include <map>
#include <bitset>
#include <numeric>
#define ll long long
using namespace std;
using p = pair<ll, ll>;
ll dx[8]={ 0, 1, 0,-1, 1, 1,-1,-1}; // x軸方向への変位
ll dy[8]={ 1, 0,-1, 0, 1,-1, 1,-1}; // y軸方向への変位

int main(void) {
    ll n;
    cin >> n;
    vector<ll> c(n+1, 0);
    map<ll, ll> I{};
    vector<ll> s(n+1);
    for(ll i = 1; i <= n; i++){
        ll a;
        cin >> a;
        s[i] = a+i;
        c[i] = i-a;
        I[i-a]++;
        //cout << c[i] << " " << s[i] << endl;
    }
    ll ans = 0;
    for(ll i = 1; i <= n; i++){
        ll a = s[i];
        ll b = I[a];
        ans += I[a];
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 29100
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0;i < n; ++i)
using namespace std;
const int INF = 2147483647;
using ll = long long;
// cout << typeid('変数').name() << endl;

int main() {
    long double x;
    cin >> x;
    long double sum = 100;
    int i=0;
    while(1){
        sum=ll(sum*1.01);
        i++;
        if(sum>=x) break;
    }
    cout << i << endl;
    return 0;
}



Measured memory_bytes: 3716
def main():
    S = input()

    ans = 0
    for bit in range(1<<(len(S)-1)):
        left = 0
        for i in range(len(S)-1):
            if (bit >> i) & 1:
                ans += int(S[left:i+1])
                left = i + 1
        ans += int(S[left:])
    print(ans)
    
if __name__ == "__main__":
    main()

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

int main(){
  int N; cin>>N;
  ll ans=0;
  rep(i,N){
    int a; cin>>a;
    ans+=a-1;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int w,h,n;
  cin>>w>>h>>n;
  vector<vector<bool>> grid(h,vector<bool>(w,0));
  for(int i=0;i<n;i++){
    int x,y,a;
    cin>>x>>y>>a;
    if(a==1){
      for(int i=0;i<h;i++){
        for(int j=0;j<x;j++){grid.at(i).at(j)=1;}
      }
    }else if(a==2){
      for(int i=0;i<h;i++){
        for(int j=x;j<w;j++){grid.at(i).at(j)=1;}
      }
    }else if(a==3){
      for(int i=0;i<y;i++){
        for(int j=0;j<w;j++){grid.at(i).at(j)=1;}
      }
    }else if(a==4){
      for(int i=y;i<h;i++){
        for(int j=0;j<w;j++){grid.at(i).at(j)=1;}
      }
    }
  }
  int count=h*w;
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      if(grid.at(i).at(j)==1){count--;}
    }
  }
  cout<<count<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cmath>
#include <functional>
#include <algorithm>
#include <numeric>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <deque>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <boost/range/irange.hpp>
#include <boost/container/static_vector.hpp>
#include <boost/utility/string_ref.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/math/common_factor_rt.hpp>

class input
{
    std::istream& cin;

public:
    input() : cin(std::cin)
    {
        std::cin.tie(nullptr);
        std::ios::sync_with_stdio(false);
    }

    template <class T>
    inline input& operator>>(T& var)
    {
        cin >> var;
        return *this;
    }
    template <class T>
    inline input& operator,(T& var)
    {
        cin >> var;
        return *this;
    }

    template <class T>
    inline T read()
    {
        T var;
        cin >> var;
        return var;
    }

    template <class InputIterator>
    inline void read(InputIterator head, std::size_t n)
    {
        for (std::size_t i = 0; i < n; ++i) {
            cin >> *head;
            ++head;
        }
    }

    template <class T>
    inline std::vector<T> read(std::size_t n)
    {
        std::vector<T> res;
        res.reserve(n);

        for (std::size_t i = 0; i < n; ++i) {
            T tmp;
            cin >> tmp;
            res.emplace_back(tmp);
        }
        return res;
    }

    template <class T, class F>
    inline void online(std::size_t n, F&& f)
    {
        T var;
        for (std::size_t i = 0; i < n; ++i) {
            cin >> var;
            f(var);
        }
    }
};
template <class T, std::size_t n>
std::istream& operator>>(std::istream& in, std::array<T, n>& var)
{
    for (std::size_t i = 0; i < n; ++i) {
        in >> var[i];
    }
    return in;
}

class output
{
    std::ostream& cout;

public:
    template <bool nl>
    class proxy
    {
        std::ostream& cout;

    public:
        proxy() : cout(std::cout) {}
        ~proxy() { final(); }
        template <class T>
        proxy& operator,(T&& val)
        {
            cout << ' ' << val;
            return *this;
        }
        template <bool f = nl>
        auto final() -> std::enable_if_t<f> { cout << '\n'; }
        template <bool f = nl>
        auto final() -> std::enable_if_t<!f> {}
    };

public:
    output() : cout(std::cout)
    {
        cout << std::fixed << std::setprecision(15);
    }

    template <class T>
    proxy<true> operator,(T&& val)
    {
        cout << val;
        return {};
    }
    proxy<false> noreturn() { return {}; }

    template <class T>
    void print(const T& container)
    {
        bool first = true;
        for (auto&& x : container) {
            if (!first) {
                cout << ' ';
            }
            cout << x;
            first = false;
        }
    }
};

void prog()
{
    input in;
    output out;

    int r, d, x;
    in >> r, d, x;
    for (int i : boost::irange(0, 10)) {
        x = r * x - d;
        out, x;
    }
}

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


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

// 総数を1000000007（素数）で割った余り
const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

int main(){
    int n;
    cin >> n;
    vi h(n);
    rep(i, n) cin >> h[i];
    int cnt = 0, ans = 0;
    rep(i, n-1) {
        if (h[i+1]<=h[i]) {
            ++cnt;
            ans = max(ans, cnt);
        }
        else {
            cnt = 0;
        }
    }
    cout << ans << endl;
    return 0;
}



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

int main()
{
  int x, n;
  vector<int> p;
  cin >> x >> n;
  for (int i = 0; i < n; i++)
  {
    int tmp;
    cin >> tmp;
    p.push_back(tmp);
  }
  for (int d = 0;; d++)
  {
    if (find(p.begin(), p.end(), x - d) == p.end())
    {
      cout << x - d << endl;
      return 0;
    }
    if (find(p.begin(), p.end(), x + d) == p.end())
    {
      cout << x + d << endl;
      return 0;
    }
  }
}


Measured memory_bytes: 3628
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <stack>
#include <climits>
#include <map>
#include <set>

using namespace std;

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

const ll mod = 1000000007;
const int inf = 1e9;
const long long INF = 1LL << 60;



int main()
{
    int n,m;
    cin >> n >> m;
    int ans = ((n-1) * n )/ 2 + (m * (m-1)) / 2;
    cout << ans ;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int reverse_num(int n)  
{  
  
    int rem=0;
    int reverse=0;  
    int temp=0;  
    temp=n;  
    while(temp!=0)  
    {  
        rem=temp%10;  
        reverse=reverse*10+rem;  
        temp/=10;  
    }  
    return reverse==n ;
}  
int main()
{
	int a,b,i,count=0;
	scanf("%d %d",&a,&b);
	for(i=a;i<=b;i++)
		if(reverse_num(i))
			count++;
	printf("%d",count);
	return 0;
}

Measured memory_bytes: 256
/* aman36 - Aman Raj */
 
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;
 
#define fast_io ios :: sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define AfterDecimal(n) cout << fixed << setprecision(n);
#define pb push_back
#define ll long long
#define ld long double
#define all(a) a.begin(), a.end()
#define pll pair<ll, ll>
#define pii pair<int, int>
#define F first
#define S second
#define bits(x) __builtin_popcount(x)
#define fori(n)  for (ll i = 0; i < n; i++)
#define forj(n)  for (ll j = 0; j < n; j++)
#define fork(n)  for (ll k = 0; k < n; k++)
#define forlp(k,x,n)  for (ll k = x; k <= n; k++)
#define vll vector <ll>
#define mll map <ll, ll>
#define vpll vector <pll>
#define vi vector <int>
#define mem(x, v) memset(x, v, sizeof(x));
#define int ll
#define endl "\n"

// priority_queue<ll, vector<ll>, less<ll>>pq;     // Max Heap
// priority_queue<ll, vector<ll>, greater<ll>>pq;  // Min Heap
 
// template <typename T> using ordered_set =
//  tree<T, null_type, less<T>, rb_tree_tag, 
//  tree_order_statistics_node_update>;
 
#ifdef DEBUG
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
template<typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cout << "# "<< name << " = " << arg1 << '\n';
}
template<typename Arg1, typename... Args>
void __f(const char* names, Arg1 && arg1, Args &&... args){
        const char* comma = strchr(names + 1 ,',');
        cout << "# ";
        cout.write(names, comma - names)<< " = " << arg1 << " | ";
        __f(comma + 1, args...);
}
#else
#define debug(...) 36
#endif
 
ll power(ll x, ll y, ll p) { 
    ll res = 1;
    x = x % p;  
    while (y > 0) {
        if (y & 1) 
            res = (res * x) % p; 
        y = y >> 1;
        x = (x * x) % p; 
    }
    return res;
}

bool isPrime(int n) 
{
    if (n <= 1) return false; 
    if (n <= 3) return true; 
    if (n % 2 == 0 || n % 3 == 0) return false; 
    for (int i = 5; i * i <= n; i = i + 6) 
        if (n % i == 0 || n % (i + 2) == 0) return false; 
    return true; 
}
 
const ll INF = (ll)(8e18);
const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const int M = 3000+5;
const int N = 3e5+5;
const int maxn = 1e5+5;

void solve() {
    int n;
    cin >> n;

    cout << (1000 - (n%1000)) % 1000 << endl;
}
 
signed main() {
    fast_io;
    // #ifndef ONLINE_JUDGE
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    // #endif
 
    int tc = 1;
    // cin >> tc;
 
    for(int i=1; i<=tc; i++) {
        // cout << "Case #" << i << ": " ;
        solve();
    }
 
    #ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
    #endif
 
    return 0;
}
 
// read the question correctly
// read code carefully
// corner cases // int vs ll // cin vs scanf // clear structures // maths
// check if max, min set to INT_MAX instead of INF
// check constraint 

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

int main()
{
    int n;
    cin >> n;
    int ans = 0;
    for (int i = 0; i < n; i++)
    {
        int x;
        cin >> x;
        while (x % 2 == 0)
        {
            x /= 2;
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

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

#define ll long long int
#define pi 3.141592653589793238
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define mod 1000000007
ll dx[4]={0,0,1,-1};
ll dy[4]={-1,1,0,0};


void solve()
{
    ll n;
    cin>>n;
    vector<ll> a(n);
    for(int i=0;i<n;i++)
        cin>>a[i];
    vector<ll> suf(n,0);
    suf[n-1]=a[n-1];
    for(int i=n-2;i>0;i--)
    {
        suf[i]=suf[i+1]+a[i];
        suf[i]%=mod;
    }
    ll ans=0;
    for(ll i=0;i<n-1;i++)
    {
        ans+=(a[i]*suf[i+1]);
        ans%=mod;
    }
    cout<<ans;
    return;
}

int main()
{
	FAST;
    ll q;
    q=1;
    // cin>>q;
    while(q--)
        solve();
	return 0;
}

Measured memory_bytes: 6360