akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = ll(A); I < ll(B); ++I)
#define FORR(I,A,B) for(ll I = ll((B)-1); I >= ll(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //xi>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //xi>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd(ll a,ll b){if(a%b==0)return b;return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=ll(1e18)+ll(7);
const ll MOD=1000000007LL;
#define out(a) cout<<fixed<<setprecision((a))

class vec{
public:
	int x,y;
	vec(int x_=0,int y_=0):x(x_),y(y_){}
	void make(int x_,int y_){
		x = x_; y = y_;
	}
	vec operator + (vec A){
		vec ans(this->x+A.x,this->y+A.y);
		return ans;
	}
	vec operator - (vec A){
		vec ans(this->x-A.x,this->y-A.y);
		return ans;
	}
	int operator * (vec A){
		return this->x*A.x+this->y*A.y;
	}
	bool operator == (vec A){
		return (this->x==A.x && this->y==A.y);
	}
	double r(){
		return sqrt((double)x*x+(double)y*y);
	}
	double sita(){
		double ans = atan2(y,x);
		return (ans<0.000?ans+2.0*M_PI:ans);
	}
};
double sin_sita(vec v1,vec v2){ // v2 basis
	return double(v2.x*v1.y-v2.y*v1.x)/v1.r()/v2.r();
}
double cos_sita(vec v1,vec v2){ // v2 basis
	return double(v2.x*v1.x+v2.y*v1.y)/v1.r()/v2.r();
}


int main(){
	int x0,y0,x1,y1,x2,y2,q;
	cin >> x0 >> y0 >> x1 >> y1;
	cin >> q;
	vec v1(x1-x0,y1-y0),v2;
	double EPS = 1e-8;
	FOR(i,0,q){
		cin >> x2 >> y2;
		if(x0==x2&&y0==y2){
			cout << "ON_SEGMENT" << endl;
			continue;
		}
		v2.make(x2-x0,y2-y0);
		double cs = cos_sita(v2,v1);
		double ss = sin_sita(v2,v1);
		if(ss<=EPS && ss>=-EPS){
			if(cs<-0.5){
				cout << "ONLINE_BACK" << endl;
			}else if(v1.r() >= v2.r()){
				cout << "ON_SEGMENT" << endl;
			}else{
				cout << "ONLINE_FRONT" << endl;
			}
		}else if(ss>=0.0){
			cout << "COUNTER_CLOCKWISE" << endl;
		}else{
			cout << "CLOCKWISE" << endl;
		}
	}

}


Measured memory_bytes: 3116
package main

import (
  "fmt"
  // "math"
  // "os"
)

var N,L int
// var taste[]

func abs(a int)int {
  if a < 0{
    return -a
  }
  return a
}

func main(){
  fmt.Scan(&N, &L)
  // fmt.Scan(&L)

  sum := 0
  min_apple := 1000000007
  for i := 1; i < N+1; i++ {
    sum += L + i - 1
    if abs(min_apple) > abs(L+i-1){
      min_apple = L+i-1
    }
  }

  fmt.Println(sum-min_apple)

 }


Measured memory_bytes: 512
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        int[] H = new int[N];
        for (int i = 0; i < N; i++) {
            H[i] = sc.nextInt();
        }
        List<List<Integer>> g = new ArrayList<>();
        for (int i = 0; i < N; i++) {
            g.add(new ArrayList<>());
        }
        for (int i = 0; i < M; i++) {
            int A = sc.nextInt()-1;
            int B = sc.nextInt()-1;
            g.get(A).add(B);
            g.get(B).add(A);
        }

        int ans = 0;
        for (int i = 0; i < N; i++) {
            List<Integer> next = g.get(i);
            boolean ok = true;
            for (int n : next) {
                if (H[i] <= H[n]) {
                    ok = false;
                    break;
                }
            }
            if (ok) ans++;
        }

        System.out.println(ans);
    }
}



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

/*                          :)
---------------------------------------------------------------
fuUcCkKk.. ratings/ranks . I'm doing it for funnn...
 I don't give a fuck about my rating/ranks and anything :)
---------------------------------------------------------------
*/

#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define ins insert
#define mp make_pair
#define len(s) s.length()
#define forp(i, a, b) for (i = a; i <= b; i++)
#define rep(i, n) for (i = 0; i < n; i++)
#define ren(i, n) for (i = n - 1; i >= 0; i--)
#define forn(i, a, b) for (i = a; i >= b; i--)
#define on cout << endl
#define o2(a, b) cout << a << " " << b
#define os cout << " "
#define all(v) v.begin(), v.end()
#define mem(n, m) memset(n, m, sizeof(n))
#define pii pair<int, int>
#define pll pair<long long, long long>
#define sii set<int>
#define sll set<long long>
#define vii vector<int>
#define vll vector<long long>
#define mll map<long long, long long>
#define lob lower_bound
#define upb upper_bound
#define ret return 0
#define present(s, x) (s.find(x) != s.end())
#define cpresent(s, x) (find(all(s), x) != s.end())
#define ford(container, it) for (__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
#define fors(container, it, a, b) for (__typeof(container.begin()) it = a; it != b; it++)

#define boost ios_base::sync_with_stdio(0)
#define MOD 1000000007
#define EPSILON 1e-9
#define PI 3.14159265358979323846
#define inf 999999999999999999
#define siz 100001
#define SIZ 1000001
#define SIZE 200001

typedef long long ll;
typedef long double ldo;
typedef double db;
using namespace std;
#define pqb priority_queue<int>
#define pqs priority_queue<int, vi, greater<int>>
#define setbits(x) __builtin_popcountll(x)
#define zrobits(x) __builtin_ctzll(x)
#define w(x)  \
    int x;    \
    cin >> x; \
    while (x--)

void c_p_c()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}
int main()
{
    c_p_c();

    int x;
    cin >> x;
    if (x >= 30)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }

    return 0;
}

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

typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1e9+7,inf=mod*mod*3ll;;
#define rep(i,N) for(ll i=0; i<(N); i++)
#define rep1(i,N) for(ll i=1; i<(N); i++)
#define pb push_back

ll A,B,H,M;
int main(){

cin.tie(0);
ios::sync_with_stdio(false);

cin>>A>>B>>H>>M;
long double x=abs(6*M-30*H-0.5*M);
long double C=sqrt(A*A+B*B-2.0*A*B*cos(M_PI*x/180.0));
cout<<fixed<<setprecision(20)<<C<<endl;

}
	


Measured memory_bytes: 4176
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <iomanip>


using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;

#define rep(i, a, b) for (int i=a; i<(b); i++)
#define rp(i, a) for (int i=0; i<(a); i++)
#define repd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define rpd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define shandom_ruffle random_shuffle

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy


int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cout << std::setprecision(9);
    cout << std::fixed;

    ll n,k;
    cin >> n >> k;
    ll x[n];
    ll ans = 0;
    rp(i,n) {cin >> x[i];
      ans += min(x[i],k-x[i]);
    }
    cout << 2*ans << endl;
    return 0;
}

// read the question correctly (ll vs int)
// template by super1 derived from bqi343


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
INF = float("inf")


def solve(A: int, B: int, C: int, D: int):
    print(max(A*B, C*D))
    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    D = int(next(tokens))  # type: int
    solve(A, B, C, D)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
def main():
    n,k=map(int,input().split())
    a=[0]*n
    for i in range(k):
        d=int(input())
        if d==1:
            a[int(input())-1]+=1
        else:
            tmp=list(map(int,input().split()))
            for j in tmp:
                a[j-1]+=1
    ans=0
    for i in range(n):
        if a[i]==0:
            ans+=1
    print(ans)

if __name__ =='__main__':
    main()

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

string s;

void solve() {
    if (s.size() == 1) return;
//    cout << s << endl;
    string t = s;
    int a, b;
    for (int i = 0; i < s.size()-1; i++) {
        a = s[i] - '0';
        b = s[i+1] - '0';
//        cout << a << ' ' << b << endl;
        if (a+b >= 10) {
            t[i] = a + b - 10 + '0';
        } else {
            t[i] = a + b + '0';
        }
//        cout << t[i] << endl;
    }
    copy(t.begin(), t.end(), s.begin());
    s.erase(s.end()-1);
    solve();
}

int main() {
    while (cin >> s) {
        solve();
        cout << s << endl;
    }
    return 0;
}

Measured memory_bytes: 0
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <utility>

using namespace std;

int main() {

	int N, W;
	scanf("%d %d", &N, &W);

	pair<int, int> items[N + 1];
	for (int i = 1; i <= N; ++i) {
		int v, w;
		scanf("%d %d", &v, &w);
		items[i] = make_pair(v, w);
	}

	int V[N + 1][W + 1];
	for (int i = 0; i <= N; ++i) {
		V[i][0] = 0;
	}
	for (int i = 0; i <= W; ++i) {
		V[0][i] = 0;
	}

	for (int i = 1; i <= N; ++i) {
		for (int j = 1; j <= W; ++j) {
			if (items[i].second <= j) {
				V[i][j] = max(V[i - 1][j], V[i - 1][j - items[i].second] + items[i].first);
			} else {
				V[i][j] = V[i - 1][j];
			}
		}
	}

	cout << V[N][W] << endl;

	return 0;
}

Measured memory_bytes: 7072
def main():
    n = int(input())
    ls1 = list(input())
    ls2 = list(input())

    if ls1[0]==ls2[0]:
        ans = 3
        i =1
        flg = "b"
    else:
        ans = 6
        flg = "a"
        i =2

    while 1:

        if i >= n:
            break

        if ls1[i]==ls2[i]:
            if flg == "a":
                flg = "b"
            else:
                ans = (ans*2)%(10**9+7)

            i += 1

        else:
            if flg == "a":
                ans = (ans*3)%(10**9+7)
            else:
                ans = (ans*2)%(10**9+7)
                flg = "a"

            i += 2
        if i >= n:
            break

    print(ans)

if __name__ == "__main__":
    main()

Measured memory_bytes: 38384
package main

import "fmt"

func main() {
	var s string
	fmt.Scan(&s)

	ans := ""
	for _, v := range s {
		if v == 'B' {
			if len(ans) != 0 {
				ans = ans[:len(ans)-1]
			}
		} else {
			ans += string(v)
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 512
#include <iostream>
#include <math.h> 
#include <vector> 

using namespace std;

int main()
{
   int N,i,num,min,tmp;
   int MB = -2147483648;
   vector<int> v;
   cin >> N;
   cin >> min;
   for(i=1;i<N;i++)
   {
    cin >> num;
    tmp = num-min;
    
    if(MB<tmp)
        MB=tmp;
       
    if(num<min)
        min=num;
   }
   cout<<MB<<endl;
}


Measured memory_bytes: 3112
#include<cstdio>
#include<cstring>
#define fo(x,a,b) for(int x=(a),e_=(b);x<=e_;x++)
#define Min(a,b) ((a)<(b)?(a):(b))

using namespace std;
typedef long long ll;
const int N=50005;
struct node{int x,y,w;}a[N],b[N];
int go[N],nx[N],len[N],fee[N],hd[N],flow[N],q[N],pre[N];
ll dis[N],ans;
int n,tot,tl=1,mid1,mid2,mid3,mid4,S,T;
bool bz[N];

void In(int& a){
	a=0;char c=getchar();for(;c<48||c>57;c=getchar());
	for(;c>47&&c<58;c=getchar()) a=(a<<1)+(a<<3)+c-48;
}
void add(int u,int v,int w,int c){
	go[++tl]=v, nx[tl]=hd[u], hd[u]=tl; len[tl]=w, fee[tl]=c;
	go[++tl]=u, nx[tl]=hd[v], hd[v]=tl; len[tl]=0, fee[tl]=-c;
}
void init(){
	int u,v;
	In(n);
	fo(i,1,n) {
		In(u), In(v), In(a[i].w);
		a[i].x=u+v, a[i].y=u-v;
	}
	fo(i,1,n) {
		In(u), In(v), In(b[i].w);
		b[i].x=u+v, b[i].y=u-v;
	}

	mid1=n+1, mid2=n+2, mid3=n+3, mid4=n+4;
	S=n+4+n+1, T=S+1;
//	printf("S:%d T:%d mid1:%d mid2:%d mid3:%d mid4:%d\n",S,T,mid1,mid2,mid3,mid4);

	fo(i,1,n) {
		add(S, i, a[i].w, 0);
		add(mid4+i, T, b[i].w,0);
		
		add(i,mid1,a[i].w,a[i].x);
		add(i,mid2,a[i].w,-a[i].x);
		add(i,mid3,a[i].w,a[i].y);
		add(i,mid4,a[i].w,-a[i].y);

		add(mid1, mid4+i, b[i].w, -b[i].x);
		add(mid2, mid4+i, b[i].w, b[i].x);
		add(mid3, mid4+i, b[i].w, -b[i].y);
		add(mid4, mid4+i, b[i].w, b[i].y);
	}
}
bool spfa(){
	fo(i,1,T) dis[i]=-1e18, bz[i]=pre[i]=0; 
	dis[S]=0, flow[S]=1e9, pre[S]=0;
	int l=0, r=1, x; q[1]=S;
	while(l<r) {
		x=q[++l];
		for(int i=hd[x]; i; i=nx[i]) 
			if(len[i]>0 && dis[go[i]]<dis[x]+fee[i]) {
				dis[go[i]]=dis[x]+fee[i];
				flow[go[i]]=Min(flow[x],len[i]);
				pre[go[i]]=i^1;
				if(!bz[go[i]]) q[++r]=go[i], bz[go[i]]=true;
			}
		bz[x]=false;
	}
	return dis[T]>-1e18;
}
int main(){
	init();
	while(spfa()) {
		ans+=dis[T]*flow[T];
//		printf("got %lld\n",dis[T]*flow[T]);
		for(int x=T; x!=S; x=go[pre[x]]) 
			len[pre[x]]+=flow[T], len[pre[x]^1]-=flow[T];//, printf("-->%d\n",x);
	}
	printf("%lld",ans);
	return 0;
}


Measured memory_bytes: 2020
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
typedef vector<int> VI;
ll mm=1000000000;ll MM=mm+7;
#define rep(i, n) for(int i=0;i<n;i++)
#define PI 3.141592653589793

int main(){
    int  n;
    cin >> n ;
    VI l(n);
    rep(i,n)cin >> l[i];
    sort(l.begin(),l.end());
    int cnt=0;
    rep(i,n-2){
        for(int j=i+1;j<n-1;j++){
           for(int k=j+1;k<n;k++){
               if(l.at(i)+l.at(j)>l.at(k))cnt++;
               else break;
               
           } 
        }
    }
    
    cout << cnt << endl;
   
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#define MAX_N 100000
#define MAX_M 100000
const int INF = 1e9;

int A[MAX_N];
int n;
bool solve_sum(int i,int m){
  if(m==0) return true;
  if(i>=n) return false;
  return solve_sum(i+1,m) || solve_sum(i+1,m-A[i]);
}


int main (){
  int q;
  cin>>n;
  for(int i=0;i<n;i++) cin>>A[i];
  cin>>q;
  for(int i=0;i<q;i++){
    int x;
    cin>>x;
    if(solve_sum(0,x)){
      cout<<"yes"<<endl;
    }
    else{
      cout<<"no"<<endl;
    }
  }
}


Measured memory_bytes: 3064
def ord(N,n):#N,nは正の整数、Nで割り切れる回数、許容はN^1000
    if n%N!=0:
        return 0
    else:
        return 1+ord(N,n//N)

def get_sieve_of_eratosthenes_new(n):
    import math
    if not isinstance(n, int):
        raise TypeError('n is int type.')
    if n < 2:
        raise ValueError('n is more than 2')
    prime = []
    limit = math.sqrt(n)
    data = [i + 1 for i in range(1, n)]
    while True:
        p = data[0]
        if limit <= p:
            return prime + data
        prime.append(p)
        data = [e for e in data if e % p != 0]

primelist=get_sieve_of_eratosthenes_new(1000)

import sys

input=sys.stdin.readline

N=int(input())

factorize=[0 for i in range(0,len(primelist))]

for i in range(1,N+1):
    for j in range(0,len(primelist)):
        factorize[j]+=ord(primelist[j],i)
        i=i//primelist[j]**ord(primelist[j],i)

ans=1
for i in range(0,len(primelist)):
    ans=ans*(factorize[i]+1)
print(ans%(10**9+7))


Measured memory_bytes: 42608
// 20:47 - 20:51
// debug: 20:51 - 21:03
#include<bits/stdc++.h>
using namespace std;

#define fi first
#define se second
#define lch (o << 1)
#define rch (o << 1 | 1)

typedef double db;
typedef long long ll;
typedef unsigned int ui;
typedef pair<int,int> pint;

const int N = (1 << 18) + 5;
const int INF = 0x3f3f3f3f;
const ll INF_LL = 0x3f3f3f3f3f3f3f3f;

int a[N];
pint b[N][2];
int ans[N];

int main(){
	ios::sync_with_stdio(0);

	int n; cin >> n;
	int m = 1 << n;
	
	for(int i=0; i<m; i++){
		cin >> a[i];
		b[i][0] = make_pair(a[i], i);
		b[i][1] = make_pair(0, -1);
		
		for(int k=0; k<n; k++){
			if(((i >> k) & 1) == 0) continue;
			int j = i ^ (1 << k);

			auto Add = [&](int v, int id){
				if(id == b[i][0].se || id == b[i][1].se) return;
				if(v >= b[i][0].fi){
					b[i][1] = b[i][0];
					b[i][0] = make_pair(v, id);
				}else if(v >= b[i][1].fi)
					b[i][1] = make_pair(v, id);
			};

			Add(b[j][0].fi, b[j][0].se);
			Add(b[j][1].fi, b[j][1].se);
		}
	}
	
	for(int i=1; i<m; i++){
		ans[i] = ans[i-1];
		if(b[i][0].se != b[i][0].se)
			ans[i] = max(ans[i], b[i][0].fi + b[i][0].fi);
		if(b[i][0].se != b[i][1].se)
			ans[i] = max(ans[i], b[i][0].fi + b[i][1].fi);
		if(b[i][1].se != b[i][0].se)
			ans[i] = max(ans[i], b[i][1].fi + b[i][0].fi);
		cout << ans[i] << endl;
	}

	return 0;
}

Measured memory_bytes: 9216
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int MAX_N = 100005;
int F[MAX_N],B[MAX_N],par[MAX_N],sizes[MAX_N],ran[MAX_N];

void init()
{
	rep(i,MAX_N)
	{
		par[i] = i;
		sizes[i] = 1;
		ran[i] = 0; 
	}
}

int find(int x)
{
	if (par[x] == x)
	{
		return x;
	}
	else
	{
		return par[x] = find(par[x]);
	}
}

void unite(int x, int y)
{
	x = find(x);
	y = find(y);
	if (x == y) return;
	if (ran[x] < ran[y])
	{
		par[x] = y;
		sizes[y] += sizes[x];
	}
	else
	{
		par[y] = x;
		sizes[x] += sizes[y];
		if (ran[x] == ran[y]) ran[x]++;
	}
}

int getsize(int x)
{
	return sizes[find(x)];
}

bool same(int x, int y)
{
	return find(x) == find(y);
}

int main()
{
	init();
	int N,M,K;
	cin >> N >> M >> K;
	int s,t;
	rep(i,M)
	{
		cin >> s >> t;
		s--;t--;
		F[s]++; F[t]++;
		unite(s,t);
	}
	rep(i,K)
	{
		cin >> s >> t;
		s--;t--;
		if (same(s,t))
		{
			B[s]++; B[t]++;
		}
	}

	/*
	rep(i,N)
	{
		cout << getsize(i) << endl;
	}
	*/

	rep(i,N)
	{
		if (i != 0) cout << " ";
		cout << getsize(i) - F[i] - B[i] - 1;
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 2816
import java.util.*;
import java.text.*;

public class Main {
	
	public static void main(String args[]){
		Scanner in = new Scanner(System.in);
		TreeSet<String> set = new TreeSet<String>();
		int n = in.nextInt();
		for(int q=0; q<n; q++){
			String str = in.next();
			char[] ch = str.toCharArray();
			for(int i=1; i<str.length(); i++){
				char[] frag1 = new char[i];
				char[] frag2 = new char[i];
				char[] frag3 = new char[str.length()-i];
				char[] frag4 = new char[str.length()-i];
				for(int j=0; j<i; j++){
					frag1[j] = ch[j];
					frag2[j] = ch[i-1-j];
				}
				for(int j=0; j<str.length()-i; j++){
					frag3[j] = ch[i+j];
					frag4[j] = ch[str.length()-1-j];
				}
				String str1 = String.valueOf(frag1);
				String str2 = String.valueOf(frag2);
				String str3 = String.valueOf(frag3);
				String str4 = String.valueOf(frag4);
				set.add(str1+str3);
				set.add(str1+str4);
				set.add(str2+str3);
				set.add(str2+str4);
				set.add(str3+str1);
				set.add(str3+str2);
				set.add(str4+str1);
				set.add(str4+str2);
			}
			System.out.println(set.size());
			set.clear();
		}
	}
}

Measured memory_bytes: 13000
import java.util.*;


import java.io.*;

public class Main {
	private static void solve(){
		//Implement solution here.
		int n  = ni();
		int[] h = na(n);
		int result = 0;
		int tmpr = 0;
		for(int i = 1; i < n; i++) {			
			if(h[i] <= h[i - 1]) {
				tmpr++;
			}else {
				tmpr = 0;
			}			
			result = Math.max(tmpr, result);
		}
		System.out.println(result);
	}

	//Switch input source (stdin/file)
	private static BufferedReader br  = new BufferedReader(new InputStreamReader(System.in));
	public static void main(String[] args){
		String debugDataPath = System.getenv("DD_PATH");        
		if(debugDataPath != null){
			try{
				br = new BufferedReader(new InputStreamReader(new FileInputStream(new File(debugDataPath))));
			}catch(Exception e){
				throw new RuntimeException(e);
			}
		} 
		solve();
	}

	//Input read utility
	private static StringTokenizer tokenizer = null;
	public static String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(br.readLine());
			} catch (Exception e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}
	//Get next single int
	private static int ni() {
		return Integer.parseInt(next());
	}
	//Get next single long
	private static long nl() {
		return Long.parseLong(next());
	}
	//Get next single double
	private static double nd() {
		return Double.parseDouble(next());
	}
	//Get next int array from one line
	private static int[] na(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = ni();
		return a;
	}
	//Get next char array from one line
	private static char[] ns() {
		return next().toCharArray();
	}
	//Get next long array from one line
	private static long[] nal(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nl();
		return a;
	}
}

Measured memory_bytes: 41992
n = int(input())
a_list = list(map(int, input().split()))
MOD = 1000000007
gid = 1
for i in a_list:
    gid_temp = gid
    i_temp = i
    while i_temp > 0:
        gid_temp, i_temp = i_temp, gid_temp % i_temp
    gid = gid * i // gid_temp

sum = 0
for i in a_list:
    sum += gid // i
print(sum % MOD)


Measured memory_bytes: 4084
#include <bits/stdc++.h>
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <random>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repp(i,n,m) for (int i = m; i < (n); ++i)
#define repl(i,n) for (long long i = 0; i < (n); ++i)
#define reppl(i,n,m) for (long long i = m; i < (n); ++i)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using PL = pair<long long, long long>;
using Pxy = pair<double, double>;
using T = tuple<int, int, bool>;
const int INF = 1001001007;
const int mod = 1000000007;
const int MOD = 998244353;
const ll inf = 1e18;
template <typename AT>
void printvec(vector<AT> &ar){
    rep(i,ar.size()-1) cout << ar[i] << " ";
    cout << ar[ar.size()-1] << endl;
}
template <typename Q>
void printvvec(vector<vector<Q>> &ar){
    rep(i,ar.size()){
        rep(j,ar[0].size()-1) cout << ar[i][j] << " ";
        cout << ar[i][ar[0].size()-1] << endl;
    }
}
template <typename S>
bool range(S a, S b, S x){
    return (a <= x && x < b);
}

void yes(){
    cout << "Yes" << endl;
}

void no (){
    cout << "No" << endl;
}

ll cel (ll a, ll b){
    if (a % b == 0) return a / b;
    else return a / b + 1;
}

ll gcds(ll a, ll b){
    ll c = a % b;
    while (c != 0){
        a = b;
        b = c;
        c = a % b;
    }
    return b;
}

int main() {
    double t, x; cin >> t >> x;
    cout << setprecision(20) << t / x << endl;
}

Measured memory_bytes: 3688
n = int(input())
ans = ''
a = {'a': 100001, 'b': 100001, 'c': 100001, 'd': 100001, 'e': 100001, 'f': 100001, 'g': 100001, 'h': 100001, 'i': 100001, 'j': 100001, 'k': 100001, 'l': 100001, 'm': 100001,
     'n': 100001, 'o': 100001, 'p': 100001, 'q': 100001, 'r': 100001, 's': 100001, 't': 100001, 'u': 100001, 'v': 100001, 'w': 100001, 'x': 100001, 'y': 100001, 'z': 100001}
for i in range(n):
    s = input()
    for j in a:
        a[j] = min(s.count(j), a[j])
for k in a:
    ans += k*a[k]
print(ans)

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

using ll = long long;
using pii = pair<int, int>;
template <class T>
using v = vector<T>;
template <class T>
using vv = v<v<T>>;
#define ALL(c) (c).begin(), (c).end()

int digit(ll i)
{
    ll r = i;
    int ret = 0;
    while (r != 0)
    {
        r /= 10;
        ret++;
    }
    return ret;
}

int main()
{
    ll N;
    cin >> N;
    int ans = INT32_MAX;
    for (ll i = 1; i <= sqrt(N); i++)
    {
        int f = INT32_MAX;
        if (N == N / i * i)
        {
            f = max(digit(i), digit(N / i));
        }
        ans = min(ans, f);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3576
#include <algorithm>
#include <array>
#include <vector>
#include <iostream>
#include <fstream>
#include <string>
#include <cmath>
#include <functional>
#include <queue>

using namespace std;

void Show(vector<vector<bool>> S) {
	for (int i = 0; i < S.size(); i++) {
		for (int j = 0; j < S[i].size(); j++) {
			if ((S[i][j])) {
				cout << '.';
			} else {
				cout << '#';
			}
		}
		cout << endl;
	}
}

int main() {
	int H, W;
	cin >> H >> W;
	vector<vector<bool>> Grid;
	vector<vector<bool>> Answer;
	char  current;
	for (int i = 0; i < H; i++) {
		vector<bool> Row;
		bool Same = true;
		Row.resize(W);
		for (int j = 0; j < W; j++) {
			cin >> current;
			if (current != '.')Same = false;
			Row[j] = current == '.';
		}
		if (!Same)Grid.push_back(Row);
	}
	H = Grid.size();
	for (int j = 0; j < W; j++) {
		vector<bool> Col;
		Col.resize(H);
		bool Same = true;
		bool  current;
		for (int i = 0; i < H; i++) {
			current = Grid[i][j];
			if (!current)Same = false;
			Col[i] = current;
		}
		if (!Same)Answer.push_back(Col);
	}
	W = Answer.size();
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			if (Answer[j][i]) {
				cout << '.';
			} else {
				cout << '#';
			}
		}
		cout << endl;
	}
//	Show(Grid);
}

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

int main() {
	LL N, M, K;
	cin >> N >> M >> K;
	vector<LL> A(N+1), B(M+1), sumA(N+1, 0), sumB(M+1, 0);
	LL overK = -1;
	for (LL m = 1; m <= N; m++) {
		cin >> A[m];
		sumA[m] = sumA[m - 1] + A[m];
		if (sumA[m] > K && overK == -1) {
			overK = m - 1;
		}
	}
	if (overK == -1) {
		overK = N;
	}
	for (int m = 1; m <= M; m++) {
		cin >> B[m];
		sumB[m] = sumB[m - 1] + B[m];
	}
	int  ans = 0;
	LL overK_b = 0;
	LL zenkai = overK;
	int j = M;
	for (int i = 0; i <= N; i++) {
		if (sumA[i] > K) {
			break;
		}
		LL temp = K - sumA[i];
		LL t = sumB[j];
		while (sumB[j] > K - sumA[i]) {
			j--;
		}
		ans = max(ans, i+j);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 9564
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
        final Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int min = n+1;
        int ans = 0;
        for (int i = 0; i < n; i++) {
            int p = sc.nextInt();
            min = Math.min(min, p);
            if (p <= min) {
                ans++;
            }
        }
        System.out.println(ans);
    }
}


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

#define MAXN (3010)
#define mod (1000000007)

int n, m;
int sumOne[MAXN], dp[MAXN][MAXN], right[MAXN];  //dp[i][j] means [0, i) has j ones
char str[MAXN];

int main(){
	scanf("%d%d", &n, &m);
	scanf("%s", str);
	for(int i = 0; i < n; ++ i){
		sumOne[i] = (i ? sumOne[i - 1] : 0) + str[i] - '0';
		right[i] = i;
	}
	for(int i = 1; i <= m; ++ i){
		int l, r;
		scanf("%d%d", &l, &r);
		-- l; -- r;
		for(int j = l; j <= r; ++ j){
			right[j] = std::max(right[j], r);
		}
	}
	dp[0][0] = 1;
	for(int i = 0; i < n; ++ i){
		for(int usedOne = 0; usedOne < i + 1; ++ usedOne){
			int r = right[i];
			int restOne = sumOne[r] - usedOne;
			if(restOne < 0) continue;
			
			if(restOne > 0){   //fill str[i] with '1'
				(dp[i + 1][usedOne + 1] += dp[i][usedOne]) %= mod;
			}
			
			if(r - i + 1 != restOne){  //fill str[i] with '0'
			    (dp[i + 1][usedOne] += dp[i][usedOne]) %= mod;
			}
		}
	}
	printf("%d\n", dp[n][sumOne[n - 1]]);
	return 0;
}

Measured memory_bytes: 21504
#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<iomanip>
#include<set>
#include "bits/stdc++.h"
#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-7
#define mp(a1,a2) make_pair(a1,a2)
typedef long long ll;
typedef long double ld;
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;
int main(){
	int N,K;
	scan(N>>K);
	ld ans=0;
	rep1(i,N){
		ll now=i;
		ll bunbo=1;
		while(now<K){
			now*=2;
			bunbo*=2;
		}
		ans+=(ld)1.0/bunbo;
	}
	ans/=N;
	if(ans<1e-10) prin(0);
	else prin(setprecision(20)<<ans);
	return 0;
}


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

typedef long long ll;

int main()
{
    int N;
    cin >> N;
    vector<int> a(N), b(N), c(N);
    for (int i = 0; i < N; i++)
    {
        cin >> a[i];
    }
    for (int i = 0; i < N; i++)
    {
        cin >> b[i];
    }
    for (int i = 0; i < N; i++)
    {
        cin >> c[i];
    }
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    sort(c.begin(), c.end());

    ll ans = 0;
    for (int i = 0; i < N; i++)
    {
        int x = b[i];
        ll ai, ci;
        {
            int ok = -1;
            int ng = N;
            while (abs(ok - ng) > 1)
            {
                int mid = (ok + ng) / 2;
                if (a[mid] < x)
                {
                    ok = mid;
                }
                else
                {
                    ng = mid;
                }
            }
            ai = ok;
        }
        {
            int ok = N;
            int ng = -1;
            while (abs(ok - ng) > 1)
            {
                int mid = (ok + ng) / 2;
                if (x < c[mid])
                {
                    ok = mid;
                }
                else
                {
                    ng = mid;
                }
            }
            ci = ok;
        }
        if (0 <= ai && ci < N)
        {
            ans += (ai + 1) * (N - ci);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 1408
for a in iter(input,'0 0'):
 m=[input()for _ in[0]*int(a.split()[0])]
 y=x=0;s={(0,0)}
 while 1:
  u,v=x,y
  c=m[y][x]
  if c=='>':x+=1;
  if c=='v':y+=1;
  if c=='<':x-=1;
  if c=='^':y-=1;
  if c=='.':print(x,y);break
  if (x,y)in s:print('LOOP');break
  else:s|={(x,y)}


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


#include "boost/multiprecision/cpp_int.hpp"
#include "boost/multiprecision/cpp_dec_float.hpp"
namespace mp = boost::multiprecision;
typedef mp::cpp_int LL;
typedef mp::number<mp::cpp_dec_float<1024>> DD;// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)


typedef long double dd;
//#define i_7 (ll)(1E9+7)
#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
typedef pair<dd,dd> d_d;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fi first
#define se second
#define endl "\n"
#define SORT(v) sort(v.begin(),v.end())
#define ERASE(v) v.erase(unique(v.begin(),v.end()),v.end())
#define POSL(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define POSU(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
template<class T,class S>
inline bool chmax(T &a, S b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
template<class T,class S>
inline bool chmin(T &a, S b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

void mod_print(ll k){
    ll P=1000;
    rep(y,1,P){
        ll x=mod(y*k);
        if(x+P>=i_7){
            x-=i_7;
        }
        if(abs(x)<=P){
            cout<<x<<"/"<<y<<endl;
            return;
        }
    }
    cout<<"nun"<<endl;
}
#define all(c) c.begin(),c.end()
//////////////////////////





int main(){fastio
    ll n,s;cin>>n>>s;
    vector<ll>ans(s+1);
    ans[0]=1;
    rep(i,0,n-1){
        ll t;cin>>t;
        vector<ll>nxt(s+1);
        rep(j,0,s){
            Add(nxt[j],ans[j]*2);
            if(j+t<=s)Add(nxt[j+t],ans[j]);
        }
        ans=nxt;
    }
    //for(auto x:ans)cout<<x<<" ";cout<<endl;
    cout<<mod(ans[s])<<endl;
    
    return 0;
}





Measured memory_bytes: 3616
import sys
from sys import exit
from collections import deque
from bisect import bisect_left, bisect_right, insort_left, insort_right #func(リスト,値)
from heapq import heapify, heappop, heappush
from itertools import product, permutations, combinations, combinations_with_replacement
from functools import reduce
from math import gcd, sin, cos, tan, asin, acos, atan, degrees, radians

sys.setrecursionlimit(10**6)
INF = 10**20
eps = 1.0e-20
MOD = 10**9+7

def lcm(x,y):
    return x*y//gcd(x,y)
def lgcd(l):
    return reduce(gcd,l)
def llcm(l):
    return reduce(lcm,l)
def powmod(n,i,mod):
    return pow(n,mod-1+i,mod) if i<0 else pow(n,i,mod)
def div2(x):
    return x.bit_length()
def div10(x):
    return len(str(x))-(x==0)
def perm(n,mod=None):
    ans = 1
    for i in range(1,n+1):
        ans *= i
        if mod!=None:
            ans %= mod
    return ans
def intput():
    return int(input())
def mint():
    return map(int,input().split())
def lint():
    return list(map(int,input().split()))
def ilint():
    return int(input()), list(map(int,input().split()))
def judge(x, l=['Yes', 'No']):
    print(l[0] if x else l[1])
def lprint(l, sep='\n'):
    for x in l:
        print(x, end=sep)
def ston(c, c0='a'):
    return ord(c)-ord(c0)
def ntos(x, c0='a'):
    return chr(x+ord(c0))
class counter(dict):
    def __init__(self, *args):
        super().__init__(args)
    def add(self,x,d=1):
        self.setdefault(x,0)
        self[x] += d
    def list(self):
        l = []
        for k in self:
            l.extend([k]*self[k])
        return l
class comb():
    def __init__(self, n, mod=None):
        self.l = [1]
        self.n = n
        self.mod = mod
    def get(self,k):
        l,n,mod = self.l, self.n, self.mod
        k = n-k if k>n//2 else k
        while len(l)<=k:
            i = len(l)
            l.append(l[i-1]*(n+1-i)//i if mod==None else (l[i-1]*(n+1-i)*powmod(i,-1,mod))%mod)
        return l[k]
def pf(x):
    C = counter()
    p = 2
    while x>1:
        k = 0
        while x%p==0:
            x //= p
            k += 1
        if k>0:
            C.add(p,k)
        p = p+2-(p==2) if p*p<x else x
    return C

def f(a,b):
    return max(div10(a),div10(b))

N=intput()
L=pf(N)
S=set([(1,N)])
for k in L:
    T=set()
    for i in range(1,L[k]+1):
        for s in S:
            T.add((s[0]*(k**i), s[1]//(k**i)))
    S=S|T
ans=INF
for a,b in S:
    ans=min(ans,f(a,b))
print(ans)

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

import sys

rectangle = []
h,w = 1,1

while not(h == 0 and w == 0):
    h,w = map(int, input().split())
    if not(h == 0 and w == 0):
        rectangle.append([h-2,w-2])

for rec in rectangle:

    display = []

    for col in range(rec[1] + 2):
        display.append('#')
    
    display.append('\n')
    
    for row in range(rec[0]):
        
        display.append('#')
        for col in range(rec[1]):
            display.append('.')
        display.append('#')
        display.append('\n')
    
    for col in range(rec[1] + 2):
        display.append('#')
    display.append('\n')
    print(''.join(display))

Measured memory_bytes: 7820
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from itertools import permutations, accumulate, combinations, combinations_with_replacement
from math import sqrt, ceil, floor, factorial
from bisect import bisect_left, bisect_right, insort_left, insort_right
from copy import deepcopy
from operator import itemgetter
from functools import reduce
from fractions import gcd
import sys
def input(): return sys.stdin.readline().rstrip()
def I(): return int(input())
def Is(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def TI(): return tuple(map(int, input().split()))
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()
def LS(): return list(input())
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(10**6)
MOD = 10**9+7
INF = 10**18
# ----------------------------------------------------------- #

n = I()
A = LI()
ans = 0
for a in A:
    while a % 2 == 0:
        a //= 2
        ans += 1
print(ans)

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

struct Line {
  int a, b, c;
  Line(int a, int b, int c):a(a), b(b), c(c) {}
};

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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  int n, m;
  cin >> n >> m;
  map<int, int> mx, my;
  vector<Line> lv, lh;
  mx[0]=0;
  my[0]=0;
  rep(i, n) {
    int a, b, c;
    cin >> a >> b >> c;
    mx[a] = 0;
    mx[b] = 0;
    my[c] = 0;
    lv.emplace_back(a, b, c);
  }
  rep(j, m) {
    int d, e, f;
    cin >> d >> e >> f;
    mx[d] = 0;
    my[e] = 0;
    my[f] = 0;
    lh.emplace_back(d, e, f);
  }
  vector<int> xv, yv;
  for (auto &p : mx) {
    p.second = xv.size();
    xv.push_back(p.first);
  }
  for (auto &p : my) {
    p.second = yv.size();
    yv.push_back(p.first);
  }
  int h = xv.size()*2;
  int w = yv.size()*2;

  vector<vector<int>> g(h, vector<int>(w));
  rep(i, n) {
    int a = mx[lv[i].a]*2;
    int b = mx[lv[i].b]*2;
    int c = my[lv[i].c]*2;
    for (int x = a; x <= b; ++x) g[x][c]=-1;
  }
  rep(j, m) {
    int d = mx[lh[j].a]*2;
    int e = my[lh[j].b]*2;
    int f = my[lh[j].c]*2;
    for (int y = e; y <= f; ++y) g[d][y]=-1;
  }
  queue<P> q;
  int sx = mx[0]*2;
  int sy = my[0]*2;
  g[sx][sy]=1;
  q.emplace(sx, sy);
  while (!q.empty()) {
    int x=q.front().first;
    int y=q.front().second;
    q.pop();
    rep(v, 4) {
      int nx = x+dx[v];
      int ny = y+dy[v];
      if (nx < 0 || nx >= h) continue;
      if (ny < 0 || ny >= w) continue;
      if (g[nx][ny] != 0) continue;
      g[nx][ny] = 1;
      q.emplace(nx, ny);
    }
  }
  ll ans = 0;
  rep(x, h) rep(y, w) {
    if (g[x][y] != 1) continue;
    if (x == 0 || x == h-1 || y == 0 || y == w-1) {
      cout << "INF\n";
      return 0;
    }
    if (x%2 == 0 || y%2 == 0) continue;
    ll ex = xv[x/2+1]-xv[x/2];
    ll ey = yv[y/2+1]-yv[y/2];
    ans += ex*ey;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 144440
import java.util.Scanner;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int numA = sc.nextInt();
        int numB = sc.nextInt();
        int numC = sc.nextInt();
        if(numA < numB && numB < numC)
        System.out.println("Yes");
        else
        System.out.println("No");
    }
}



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

int main() {
  int N;
  int sum = 0;
  cin >> N;
  
  int tmp = N;
  while(tmp > 0){
    sum = sum + tmp % 10;
    tmp = tmp / 10;
  }
  
  cout << (N % sum == 0 ? "Yes":"No") << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> VI;
typedef vector<VI> VVI;
typedef pair<ll, ll> P;
#define INF (1LL << 31)
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define PRINT(V) for (auto v : (V)) cout << v << " "

int main()
{
    double a, b, h, m; cin >> a >> b >> h >> m;
    double aw = -((h/12 + m/720)*2*M_PI), bw = -((m/60)*2*M_PI);
    double ans;
    ans = sqrt(pow(a*cos(aw) - b*cos(bw), 2) + pow(a*sin(aw) - b*sin(bw), 2));
    
    cout << scientific << setprecision(12) << ans << endl;
    return 0;
}


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

using namespace std;

typedef long long lli;
typedef vector<lli> vll;
typedef vector<bool> vbl;
typedef vector<vector<lli>> mat;
typedef unordered_map<lli,unordered_set<lli>> graph;

lli n,k;
graph tree;
mat d;
set<lli> used;
lli ans = 0;

void dfs(lli x,lli s,lli c){
  d[s][x] = c;
  used.insert(x);
  for(auto& itr : tree[x]){
    if(used.count(itr) == 0) dfs(itr,s,c+1);
  }
}

int main(){
  cin >> n >> k;
  for(lli i = 0;i < n-1;i++){
    lli a,b;
    cin >> a >> b;
    tree[a].insert(b);
    tree[b].insert(a);
  }
  d = mat(n+1,vll(n+1));
  for(lli i = 1;i <= n;i++){
    used = set<lli>();
    dfs(i,i,0);
  }
  if(k%2 == 0){
    for(lli i = 1;i <= n;i++){
      lli mem = 0;
      for(lli j = 1;j <= n;j++){
        if(d[i][j] <= k/2) mem++;
      }
      ans = max(ans,mem);
    }
  }else{
    for(auto& itr : tree){
      for(auto& jtr : itr.second){
        lli mem = 0;
        for(lli j = 1;j <= n;j++){
          if(min(d[itr.first][j],d[jtr][j]) <= (k-1)/2) mem++;
        }
        ans = max(ans,mem);
      }
    }
  }
  cout << n-ans << endl;
  return 0;

}


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

typedef long long ll;
const int maxn=1e5+10;
int n,m,a[maxn],b[maxn],c[maxn],x[maxn],dsu[maxn];
ll sum[maxn],f[maxn];
vector<int> g[maxn];
bool vis[maxn];

inline bool cmp(int a,int b){
	return c[a]<c[b];
}
int find(int x){
	return dsu[x]==x?x:dsu[x]=find(dsu[x]);
}

int main(){
	cin>>n>>m;
	for(int i=1;i<=n;++i){
		cin>>a[i]>>b[i];
		c[i]=max(a[i]-b[i],0);
		x[i]=i;
		dsu[i]=i;
	}
	for(int i=1,u,v;i<=m;++i){
		cin>>u>>v;
		g[u].push_back(v);
		g[v].push_back(u);
	}
	sort(x+1,x+n+1,cmp);
	for(int i=1;i<=n;++i){
		int pos=x[i];
		sum[pos]=b[pos];
		f[pos]=c[pos];
		vis[pos]=true;
		for(int j=0,v;j<g[pos].size();++j)
			if(vis[v=find(g[pos][j])]&&v!=find(pos)){
				dsu[v]=pos;
				sum[pos]+=sum[v];
				f[pos]=min(f[pos],max(f[v],c[pos]-sum[v]));
			}
	}
	cout<<sum[find(1)]+f[find(1)]<<endl;
	return 0;
}

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

def solve():
    N = int(input())
    LRs = []
    Ls, Rs = [], []
    for _ in range(N):
        L, R = map(int, input().split())
        LRs.append((L, R))
        Ls.append(L)
        Rs.append(R)

    Ls.sort(reverse=True)
    Rs.sort()

    maxL, maxL2 = Ls[:2]
    minR, minR2 = Rs[:2]

    # 1個にする要素を全探索
    ans = 0
    for L, R in LRs:
        num = R-L+1
        A, B = maxL, minR
        if L == maxL:
            A = maxL2
        if R == minR:
            B = minR2
        num += max(0, B-A+1)
        ans = max(ans, num)

    # 区切りを全探索
    LRs.sort(key=lambda x: x[0])

    minR = LRs[0][1]
    accMinRs = [minR]
    for L, R in LRs[1:]:
        minR = min(minR, R)
        accMinRs.append(minR)
    minR = LRs[-1][1]
    accMinRRevs = [minR]
    for L, R in reversed(LRs[:-1]):
        minR = min(minR, R)
        accMinRRevs.append(minR)
    accMinRRevs = accMinRRevs[::-1]

    for i in range(N-1):
        num = max(0, accMinRs[i] - LRs[i][0] + 1)
        num += max(0, accMinRRevs[i+1] - LRs[-1][0] + 1)
        ans = max(ans, num)

    # 区切りを全探索
    LRs.sort(key=lambda x: x[1])

    maxL = LRs[0][0]
    accMaxLs = [maxL]
    for L, R in LRs[1:]:
        maxL = max(maxL, L)
        accMaxLs.append(maxL)
    maxL = LRs[-1][0]
    accMaxLRevs = [maxL]
    for L, R in reversed(LRs[:-1]):
        maxL = max(maxL, L)
        accMaxLRevs.append(maxL)
    accMaxLRevs = accMaxLRevs[::-1]

    for i in range(N-1):
        num = max(0, LRs[0][1] - accMaxLs[i] + 1)
        num += max(0, LRs[i+1][1] - accMaxLRevs[i+1] + 1)
        ans = max(ans, num)

    print(ans)


solve()


Measured memory_bytes: 82652
#include <iostream>
#include <cmath>
#include <algorithm>
#include<string>
using namespace std;

string S;

long long ans(long long first,long long second,int depth){
        if(depth==S.length()){
            return first+second;
        }
        else{
            return ans(first,second*10+(long long)S[depth]-48,depth+1)+ans(first+second,(long long)S[depth]-48,depth+1);
        } 
}

int main(){
    cin>>S;
    cout<<ans(0,(long long)S[0]-48,1)<<endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main{
	
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
  	int n=sc.nextInt();
    long t=sc.nextLong(),f=0;
    long[] a=new long[n];
    for(int i=0;i<n;i++){
      a[i]=sc.nextLong();
      if(i==0){
        f+=t;
      }else{
        if(a[i]-a[i-1]>t){
          f+=t;
        }else{
          f+=(a[i]-a[i-1]);
        }
      }
    }
    System.out.println(f);
  }
}


Measured memory_bytes: 87368
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include<algorithm>
#include<string>
#include <map>
#include <queue>
#include <stack>
#include<set>
#include<tuple>
#include<time.h>

#define DIV 998244353
using namespace std;
using ll = long long;
using ldb = long double;

int main() {
	ll N, K; cin >> N >> K;
	vector<pair<ll, ll>> ran(N);
	for (int i = 0; i < K; i++) {
		cin >> ran[i].first >> ran[i].second;
	}
	
	vector<ll> dp(N + 1), tot(N + 1);
	dp[1] = 1, tot[1] = 1;
	for (int i = 2; i <= N; i++) {
		for (int j = 0; j < K; j++) {
			dp[i] += (i - ran[j].first >= 0 ? tot[i - ran[j].first] : 0) 
				- (i - ran[j].second - 1 >= 0 ? tot[i - ran[j].second - 1] : 0);
			dp[i] += DIV;
			dp[i] %= DIV;
		}
		tot[i] = tot[i - 1] + dp[i];
		tot[i] %= DIV;
	}

	cout << dp[N] << endl;
}

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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(a)     (a).begin(),(a).end()
#define VI         vector<int>
#define MOD 1000000007

using ll = long long int;
using P = pair<int,int>;

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

const ll INF=(ll)1e19;
//const int INF=(1<<30);

class UnionFindTree{
  public:
    vector<ll> rank,p,count;
    ll ans;

    UnionFindTree() {}

    UnionFindTree(ll size){
      rank.assign(size, 0);
      p.assign(size, 0);
      count.assign(size,1);
      REP(i,size)makeSet(i);
      ans = size * (size-1) / 2;
    }

    void makeSet(int x){
      p[x] = x;
      rank[x] = 0;
    }

    bool same(int x, int y){
      return findSet(x) == findSet(y);
    }

    void unite(int x, int y){
      if(findSet(x) == findSet(y))return;

      x = findSet(x);
      y = findSet(y);
      
      if(rank[x] > rank[y]){
        p[y] = x;
      }else{
        p[x] = y;
        if(rank[x] == rank[y]){
          rank[y]++;
        }
      }

      ans -= count[x] * count[y];
      ll tmp = count[x] + count[y];
      count[x] = tmp;
      count[y] = tmp;
    }

    int findSet(int x){
      if(x != p[x]){
        p[x] = findSet(p[x]);
      }
      return p[x];
    }

    void print(){
      REP(i,p.size()){
        cout << p[i] << " ";
      }
      cout << endl;
      REP(i,p.size()){
        cout << rank[i] << " ";
      }
      cout << endl;
    }

};



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

  VI a(m),b(m);
  REP(i,m){
    cin>>a[i];
    cin>>b[i];
    a[i]--; b[i]--;
  }

  UnionFindTree tree(n);
  vector<ll> ans;
  for(int i = m-1; i >= 0; i--){
    ans.emplace_back(tree.ans);
    tree.unite(a[i], b[i]);
  }
  for(int i = m-1; i >= 0; i--){
    cout << ans[i] << endl;
  }
}



Measured memory_bytes: 5364