akhauriyash/Code-Regression huggingface dataset:
package main

import (
	"bufio"
	"fmt"
	"log"
	"os"
	"strconv"
)

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)

	// N
	scanner.Scan()
	N, err := strconv.Atoi(scanner.Text())
	if err != nil {
		log.Fatal(err)
	}

	// d
	d := make([]int, N)
	for i := 0; i < N; i++ {
		scanner.Scan()
		target, err := strconv.Atoi(scanner.Text())
		if err != nil {
			log.Fatal(err)
		}
		d[i] = target
	}

	all := 0
	for x := 0; x < N; x++ {
		for y := 0; y < N; y++ {
			all += d[x] * d[y]
		}
		all -= d[x] * d[x]
	}

	fmt.Println(all / 2)

}

Measured memory_bytes: 1832
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include<math.h>
#include<iomanip>
using namespace std;

#define ll long long
using vt = int; //ここで数値の型を変えられる
#define rep(i, n) for (vt i = 0; i < (vt)(n); i++)
#define reps(i, s, n) for(vt i = (vt) (s); i < (vt) (n); i++) 
#define MOD 1000000007

int main() {
	int a, b, now = 1, ans = 0;
	cin >> a >> b;
	while(b > now){
		now -= 1;
		now += a;
		ans++;
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mod 1000000007
#define ll long long
#define maxn 100000
using namespace std;

ll dp[2][102][2],d,len;
char str[10123];

void add_self(ll &a,ll b)
{
    a+=b;
    if(a>=mod)
    {
        a-=mod;
    }
}

int main()
{
    cin>>str;
    cin>>d;
    len = strlen(str);
    dp[0][0][0] = 1;
    int fl = 0;
    for(int where=0;where<len;where++)
    {
        fl^=1;
        for(int sum=0;sum<d;sum++)
        {
            for(int isSmaller =0;isSmaller<2;isSmaller++)
            {
                for(int digits=0;digits<10;digits++)
                {
                    if(digits> str[where]-'0' && isSmaller == 0)
                    {
                        break;
                    }
                    add_self(dp[fl][(sum+digits)%d][isSmaller || (digits < str[where]-'0') ],dp[fl^1][sum][isSmaller]);
                }
            }
        }
        for(int i=0;i<=100;i++)
        {
            for(int j=0;j<2;j++) dp[fl^1][i][j] = 0;
        }
    }

    ll ans = (dp[fl][0][1]+dp[fl][0][0])%mod;
    --ans;
    if(ans == -1) {
        ans = mod-1;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
N, K = map(int, input().split())
S = input()
L = []
R = []
maximum = 0
if S[0] == "0":
    L.append(0)
if S[N-1] == "0":
    R.append(N-1)
for n in range(N-1):
    if S[n] == "1" and S[n+1] == "0":
        L.append(n+1)
    if S[-n-1] == "1" and S[-n-2] == "0":
        R.append(N-n-2)
L.append(N)
R.append(-1)
R.reverse()
if len(L) <= K:
    print(N)
else:
    for n in range(len(L)-K):
        maximum = max(maximum, L[n+K]-R[n]-1)
    print(maximum)

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

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author anand.oza
 */
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);
        BPowersOfTwo solver = new BPowersOfTwo();
        solver.solve(1, in, out);
        out.close();
    }

    static class BPowersOfTwo {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();

            Long[] a = new Long[n];
            HashMap<Long, Integer> count = new HashMap<>();
            for (int i = 0; i < n; i++) {
                a[i] = (long) in.nextInt();
                count.put(a[i], count.getOrDefault(a[i], 0) + 1);
            }

            int answer = 0;
            Arrays.sort(a, Comparator.reverseOrder());
            for (int i = 0; i < n; i++) {
                if (count.getOrDefault(a[i], 0) == 0) {
                    continue;
                }
                long powerOfTwo = Long.highestOneBit(a[i]) * 2;
                long remaining = powerOfTwo - a[i];
                if (remaining != a[i]) {
                    if (count.getOrDefault(remaining, 0) > 0) {
                        count.put(remaining, count.get(remaining) - 1);
                        count.put(a[i], count.get(a[i]) - 1);
                        answer++;
                    }
                } else {
                    if (count.get(a[i]) >= 2) {
                        count.put(a[i], count.get(a[i]) - 2);
                        answer++;
                    }
                }
            }

            out.println(answer);
        }

    }

    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: 58920
def main():
    s=input()
    a=0  # 0101...
    b=0  # 1010...
    for i, v in enumerate(s):
        if i % 2 == 0:
            if v == "0":
                a+=1
            else:
                b+=1
        else:
            if v == "0":
                b+=1
            else:
                a+=1
    print(min(a,b))

if __name__ == "__main__":
    main()

Measured memory_bytes: 9224
#include <stdio.h>
     
    int main(void)
    {
     
      int n;
      int i, j, sum=0, ans;
     
      scanf("%d", &n);
     
      int x[n];
     
      for (i = 0; i < n; i++)
        scanf("%d", &x[i]);
     
      for (i = 0; i < n; i++)
        ans += x[i] * x[i];
     
      for (i = 1; i <= 100; i++) {
        sum = 0;
        for (j = 0; j < n; j++)
          sum += (i - x[j]) * (i - x[j]);
        if (ans > sum)
          ans = sum;
      }
     
      printf("%d", ans);
     
     
      return 0;
    }

Measured memory_bytes: 128
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func readLine(sc *bufio.Scanner) string {
	sc.Scan()
	return strings.TrimSpace(sc.Text())
}

func explodeString(delimiter string, inputValue string) []string {
	splittedValue := strings.Split(inputValue, delimiter)

	var trimmedValues []string

	for _, value := range splittedValue {
		if value != "" {
			trimmedValues = append(trimmedValues, value)
		}
	}

	return trimmedValues
}

func explodeInt(delimiter string, inputValue string) []int {
	inputStrings := explodeString(" ", inputValue)

	var splittedInts []int

	for _, inputString := range inputStrings {
		var (
			intValue int
			err      error
		)
		intValue, err = strconv.Atoi(inputString)

		if err != nil {
			panic(err)
		}
		splittedInts = append(splittedInts, intValue)
	}

	return splittedInts
}

func main() {
	var (
		n, m, c, outputValue int
		bValues              []int
	)

	sc := bufio.NewScanner(os.Stdin)

	nmc := explodeInt(" ", readLine(sc))
	n, m, c = nmc[0], nmc[1], nmc[2]

	bValues = explodeInt(" ", readLine(sc))

	for i := 0; i < n; i++ {
		aValues := explodeInt(" ", readLine(sc))

		sum := 0
		for j := 0; j < m; j++ {
			sum += bValues[j] * aValues[j]
		}

		if sum+c > 0 {
			outputValue++
		}
	}

	fmt.Println(outputValue)
}


Measured memory_bytes: 640
import java.math.BigInteger;
import java.util.*;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		long now = Long.parseLong(sc.next());
		long k = Long.parseLong(sc.next());
		long dist = Long.parseLong(sc.next());

		if (now < 0) {
			now = -1 * now;
		}

		// kとdistの積は非常に大きいのでBigIntegerを使ってみる
		BigInteger bigK = BigInteger.ONE.multiply(BigInteger.valueOf(k));
		BigInteger bigSeki = bigK.multiply(BigInteger.valueOf(dist));
		BigInteger bigNow = BigInteger.ONE.multiply(BigInteger.valueOf(now));
		BigInteger bigHoge = bigNow.subtract(bigSeki);
		int piyo = bigHoge.compareTo(BigInteger.ZERO);

		// 0をまたぐところまで到達しないパターン
		if (piyo == 1) {
			System.out.println(now - (k * dist));
			return;
		}

		// ぴったり0にゴールするパターン
		if (piyo == 0) {
			System.out.println(0);
			return;
		}

		// 以下、0をまたぐパターン

		// まず0の直前まで歩く
		k -= now / dist;
		now = now % dist;

		// 残りkが偶数なら、現在地がゴール
		if (k % 2 == 0) {
			System.out.println(now);
			return;
		}

		// 残りkが奇数なら、0を一度だけまたいだところがゴール
		System.out.println(dist - now);

	}
}

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

const int mod = 1000000007;

struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
 
  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};
// combination mod prime
// https://www.youtube.com/watch?v=8uowVvQ_-Mo&feature=youtu.be&t=1619
struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};

int main(){
    ll n, k;
    cin >> n >> k;
    ve<ll> a(n);
    rep(i,n) cin >> a[i];
    sort(a.begin(), a.end());
    ve<ll> s(n+1);
    rep(i,n) s[i+1] = s[i] + a[i];
    mint ans = 0;
    combination c(n+1);
    rep(i,n-k+1){
        mint memo = c(k-2+i,i);
        mint memo1 = (s[n] - s[k+i-1] - (s[n-k+1-i] - s[0]))%mod;
        ans += memo * memo1;
    }
    cout << ans.x << endl;
    return 0;
}

Measured memory_bytes: 3328
fun main(arr:Array<String>) {
    val n = readLine()!!.toInt()
    val numbers = readLine()!!.split(" ").map { it.toInt() }
    val ans = (1 until n-1).filter { numbers[it] == (it-1..it+1).map { a->numbers[a] }.sorted()[1] }.count()
    println(ans)
}



Measured memory_bytes: 37936
#include<cstdio>
#include<algorithm>
using namespace std;
int gr[1005][1005],h,w,a,b,i,j;
int main()
{
	scanf("%d%d%d%d",&h,&w,&a,&b);
	for(i=1;i<=b;i++)for(j=1;j<=a;j++)gr[i][j]=1;
	for(i=b+1;i<=h;i++)for(j=a+1;j<=w;j++)gr[i][j]=1;
	for(i=1;i<=h;i++)
	{
		for(j=1;j<=w;j++)printf("%d",gr[i][j]);
		printf("\n");
	}
	return 0;
} 

Measured memory_bytes: 5120
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

public class Main {
    static int top = 0;
    static int[] S = new int[1000];
    public static void main(String[] args) throws IOException {
        //Scanner sc = new Scanner(System.in);
        //int N = sc.nextInt();
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        //System.out.println(br.readLine());
        String[] inputChar = br.readLine().split(" ");

        String s;
        int a, b;
        for (int i = 0; i < inputChar.length; i++) {
            s = inputChar[i];
            switch (s){
                case "+":
                    a = pop();
                    b = pop();
                    push(a + b);
                    break;

                case "-":
                    a = pop();
                    b = pop();
                    push(b-a);
                    break;

                case "*":
                    a = pop();
                    b = pop();
                    push(a * b);
                    break;

                default:
                    push(Integer.parseInt(s));
            }
        }

        System.out.println(pop());

    }

    static void push(int x) {
        top++;
        S[top] = x;
    }

    static int pop() {
        top--;
        return S[top + 1];
    }
}



Measured memory_bytes: 24244
#include<iostream>
#define MOD 1000000007
using namespace std;
int main()
{
	int n,m;
	cin >> n >> m;
	char arr[n][m];
	int dp[n][m];
	for(int i = 0;i < n;++i)
	{
		for(int j = 0;j < m;++j)
			cin >> arr[i][j];
	}
	for(int i = 0;i < n;++i)
	{
		for(int j = 0;j < m;++j)
		{
			if(arr[i][j] == '#')
				dp[i][j] = 0;
			else if(i==0 && j == 0)
				dp[i][j] = 1;
			else if(j == 0)
				dp[i][j] = dp[i-1][j];
			else if(i == 0)
				dp[i][j] =dp[i][j-1];
			else
				dp[i][j] = (dp[i][j-1]+dp[i-1][j])%MOD;
		}
	}
	cout << dp[n-1][m-1]<<"\n";
	return 0;
}

Measured memory_bytes: 8336
"""
s = input()
output = []
comp_str = ['A','T','G','C']

for i in range(len(s)):
    count = 0
    while (1):
        if (s[i] == 'A'):
            i += 1
            count += 1
        elif (s[i] == 'T'):
            i += 1
            count += 1
        elif (s[i] == 'G'):
            i += 1
            count += 1
        elif (s[i] == 'C'):
            i += 1
            count += 1
        else:
            output.append(count)
            break

max = 0
for i in output:
    if (i >= max):
        max = i

print(max)

"""

s = input()
count = 0

for i in range(len(s)):
    count_tmp = 0
    for j in range(i,len(s)):
        if(s[j] == 'A'):
            count_tmp += 1
        elif(s[j] == 'T'):
            count_tmp += 1
        elif(s[j] == 'G'):
            count_tmp += 1
        elif(s[j] == 'C'):
            count_tmp += 1
        else:
            break
    if(count_tmp > count):
        count = count_tmp

print(count)


Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <stdio.h>
#include <cmath>
#include <cctype>

using namespace std;

int main()
{
    int n,m;
    
    cin >> n >> m;
    vector<int> a(n);
    int sum = 0;

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

    int count = 0;
    for(int i = 0; i < n; i++){
        if(sum <= 4 * m * a[i]){
            count++;
        }
    }

    if(count >= m){
        cout << "Yes" << endl;
    }else {
        cout << "No" << endl;
    }


    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin >> n;
    int l[7] = {1,2,4,8,16,32,64};
    for(int i = 6;i >= 0;--i)
    {
        if(n / l[i] != 0)
        {
            cout << l[i] << '\n';
            return 0;
        }
    }
}

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

int main() {
  long long n;
  cin>>n;
  vector<long long>p(n);
  for(long long i=0;i<n;i++){
    cin>>p.at(i);
  }
  long long B=n+1;
  long long A=0;
  for(long long i=0;i<n;i++){
    if(i>0){
      if(B>p.at(i)){
        A++;
      }
    }
      B=min(B,p.at(i));
   
    if(i==0){
      A++;
    }
  }
  cout<<A<< endl;
}
    
    
    
    


Measured memory_bytes: 1792
#include <iostream>
using namespace std;
void func(int,int);

int H, W;

int main() {
	
	for (;;) {
		cin >> H >> W;
		if (H == 0 && W == 0)break;
		else {
			func(H, W);
		}
	}

}

void func(int H,int W) {
	int i, j;
	for (i = 0;i < H;i++) {
		for (j = 0;j < W;j++)
			cout << '#';
		cout << endl;
	}
	cout << endl;
}


Measured memory_bytes: 3084
//#include <tourist>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <string>
#include <iomanip>
#include <limits>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <list>
#include <queue>
#include <tuple>
#include <deque>
#include <algorithm>
#include <numeric>
#include <iomanip>
#include <utility>
#include <complex>
#include <functional>
using namespace std;
const int MOD = 1000000007;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = (1 << 28);
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
//setprecision(15)有効数字15桁
//-std=c++14
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b)
{
    return a * b / gcd(a, b);
}
struct edge {
    int to, cost;
};
int n;
double t,a;
vector<double> h;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n>>t>>a;

    for (int i = 0; i < n; i++)
    {
        double temp;
        cin >> temp;
        h.push_back(temp);
    }
    int ans = 0;
  	double le=INF;
  	for (int i = 0; i < n; i++)
    {
        if(abs(a-t+0.006*h[i])<le){
        ans=i+1;
        le=abs(a-t+0.006*h[i]);}
    }
    cout << ans << "\n";
}



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

int main(){
  char a,b;
  cin >> a >> b;
  if(a == 'D'){
    if(b == 'D'){
      cout << "H" << endl;
    }else{
      cout << "D" << endl;
    }
  }else{
    if(b == 'D'){
      cout << "D" << endl;
    }else{
      cout << "H" << endl;
    }
  }
}

Measured memory_bytes: 256
S = input()
A = int(S[0:2])
B = int(S[2:4])

if A == 0 or B == 0:
    if A == 0 and B == 0:
        print("NA")
    elif A > 12 or B > 12:
        print("NA")
    elif 0 < A <= 12:
        print("MMYY")
    else:
        print("YYMM")
    exit()

if A > 12 and B > 12:
    print("NA")
elif A <= 12 and B <= 12:
    print("AMBIGUOUS")
elif A <= 12:
    print("MMYY")
else:
    print("YYMM")

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

int main()
{
  int n;
  for(;cin>>n;)
    {
      int a,b,c,d;
      cin>>a>>b>>c>>d;
      int ans=9999;
      a--;b--;c--;d--;
      for(int k=1;k<=n;k++)
	{
	  int ax=a/k;
	  int ay=a%k;
	  int bx=b/k;
	  int by=b%k;
	  int cx=c/k;
	  int cy=c%k;
	  int dx=d/k;
	  int dy=d%k;
	  int tmp=abs(ax-bx)+abs(ay-by)+abs(cx-dx)+abs(cy-dy);
	  /*
	  cout<<"A:"<<ax<<" "<<ay<<endl;
	  cout<<"B:"<<bx<<" "<<by<<endl;
	  cout<<"C:"<<cx<<" "<<cy<<endl;
	  cout<<"D:"<<dx<<" "<<dy<<endl;
	  cout<<tmp<<endl;
	  */
	  ans=min(ans,tmp);
	}
      cout<<ans<<endl;
    }
}

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

int main()
{ 
  int n ;
  cin >> n ;
  vector<int> data(n) ;
  for(int i = 0 ; i < n ; i++)
  {
    cin >> data.at(i) ;
  }

  int button = 0 ;
  int count = 0 ;
  for(int i = 0 ; i <= n; i++)
  {
    if(button == 1)
    {
      break ;
    }
    
    if(i == n)
    {
      cout << -1 << endl ;
      return 0 ;
    }

    button = data.at(button) - 1 ;
    count++ ;
    //cout << button <<endl ;
  }

  cout << count << endl ;
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb emplace_back
#define mp make_pair
#define ff first
#define ss second
#define rev(r) reverse(r.begin(),r.end())
#define SORT(ar) sort(ar.begin(), ar.end())
#define sz(x) (int)(x).size()
#define len(x) (int)x.length()
#define in(a) scanf("%d",&a)
#define pr(x) printf("%d ",x)
#define endl '\n'
#define read(v,n) for(int h=0;h<n;h++) cin>>v[h];
#define fo(i,a,b) for(i=a;i<b;i++)
#define fi(i,a,b) for(i=a;i>=b;i--)
#define mo 1000000007
#define N 200007
vector<int>adj[100005];
int vis[100005],p[100005];

void dfs(int u)
{
    vis[u]=1;
    int i,l=adj[u].size();
    fo(i,0,l)
    {
        if(!vis[adj[u][i]]) dfs(adj[u][i]);
        p[u]=max(p[u],1+p[adj[u][i]]);
    }
}

int main()
{
    int n,m,i,j,k=0,x,y;
    cin>>n>>m;
    fo(i,0,m)
    {
        in(x); in(y);
        adj[x].pb(y);
    }
    fo(i,1,n+1)
    {
        if(!vis[i]) dfs(i);
    }
    fo(i,1,n+1) k=max(k,p[i]);
    cout<<k<<endl;

}


Measured memory_bytes: 8576
#include <iostream>
#include <bits/stdc++.h>
#include<string>
using namespace std;
 
int main() {
    int n;
    cin>>n;
    int ans=0,res=0;
    for(int i=0;i<n;i++)
    {
        int x,y;
        cin>>x>>y;
        if(x==y)
        {
            res++;
            ans = max(ans,res);
        }
        else
        {
            res=0;
        }
    }
    if(ans>=3)
    cout<<"Yes";
    else
    cout<<"No";
	return 0;
}

Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;

int main(){
	int N,counter = 0,ans = 0;
	cin >> N;
	for (int i = 1;i <= N;i += 2){
		counter = 0;
		for(int j = 1;j <= i;j++){
			if (i % j == 0){
				counter++;
			}
		}
		if (counter == 8){
			ans++;
		}
	}
	cout << ans <<endl;
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#define len(X) ((int)(X).size())

#ifdef __LOCAL
#define DBG(X) cout << #X << "=" << (X) << '\n';
#define SAY(X) cout << (X) << '\n';
#else
#define DBG(X)
#define SAY(X)
#endif

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);

const int NIL = -1;
static mt19937 _g(time(nullptr));

std::string pad(int num)
{
    char buffer[4];
    std::snprintf(buffer, sizeof(buffer), "%03d", num);
    return buffer;
}

inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline T fetch() { T ret; cin >> ret; return ret; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

#ifdef _MSC_VER
#  include <intrin.h>
#  define __builtin_popcount __popcnt
#endif

int solve()
{
    int N;

    std::cin >> N;

    unordered_map<ll, ll> um;
    vector<ll> v(N);

    for (int i = 0; i < N; ++i) {
        int value;
        cin >> value;

        v[i] = value;
        um[value]++;
    }

    ll total = 0;

    for (auto &it : um) {
        total += it.second * (it.second - 1) / 2;
    }

    vector<ll> out;
    for (int i = 0; i < N; ++i) {
        ll value = total - um[v[i]] * (um[v[i]] - 1) / 2 + (um[v[i]] - 1) * (um[v[i]] - 2) / 2;
        out.push_back(value);
    }

    for (ll i : out)
        cout << i << endl;

    return 0;
}

int main()
{
//    std::cout << solve() << std::endl;
    solve();

    return 0;
}

Measured memory_bytes: 11716
var  a,b,c,d:longint;
     s:string;
begin
  readln(s);
  a:=ord(s[1])-ord('0');
  b:=ord(s[2])-ord('0');
  c:=ord(s[3])-ord('0');
  d:=ord(s[4])-ord('0');//字符串预处理
  if  a+b+c+d=7  then
    begin  writeln(a,'+',b,'+',c,'+',d,'=7');  exit;  end;//只要找到一种就可以结束输出，下同
  if  a+b+c-d=7  then
    begin  writeln(a,'+',b,'+',c,'-',d,'=7');  exit;  end;
  if  a+b-c+d=7  then
    begin  writeln(a,'+',b,'-',c,'+',d,'=7');  exit;  end;
  if  a-b+c+d=7  then
    begin  writeln(a,'-',b,'+',c,'+',d,'=7');  exit;  end;
  if  a-b-c+d=7  then
    begin  writeln(a,'-',b,'-',c,'+',d,'=7');  exit;  end;
  if  a-b+c-d=7  then
    begin  writeln(a,'-',b,'+',c,'-',d,'=7');  exit;  end;
  if  a+b-c-d=7  then
    begin  writeln(a,'+',b,'-',c,'-',d,'=7');  exit;  end;
  if  a-b-c-d=7  then
    begin  writeln(a,'-',b,'-',c,'-',d,'=7');  exit;  end;
end.

Measured memory_bytes: 128
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>
#include <cstring>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

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

//改造
typedef long long int ll;
using ll = long long int;
using ull = long long unsigned int;
using Int = long long int;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//ここから編集する
class Solve {
public:
    void solve() {
        Int N, K;
        cin >> N >> K;
        vector<Int> A(N);
        for (int i = 0; i < N; ++i) {
            cin >> A[i];
        }

        Int ans = 0;
        for (int i = 0; i < N; ++i) {
            for (int j = 0; j + 1 < N; ++j) {
                if (A[j] > A[j + 1]) {
                    swap(A[j], A[j + 1]);
                    ans++;
                }
            }
        }
        ans *= K;

        for (int i = 0; i < N; ++i) {
            Int base = (K * (K - 1) / 2) % MOD;

            Int cnt = upper_bound(all(A), A[i] - 1) - A.begin();
            Int tmp = cnt * base % MOD;
            ans += tmp % MOD;
            ans %= MOD;
        }

        cout << ans << endl;

    }
};


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

    Solve().solve();


    return 0;
}


Measured memory_bytes: 888
#include<bits/stdc++.h>
using namespace std;
using LL = long long;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	int R, G, B, N, ans = 0;
	cin >> R >> G >> B >> N;
	for(int r = 0; r <= N; r += 1)
		for(int g = 0; g <= N; g += 1)
			if(r * R + g * G <= N and (N - r * R - g * G) % B == 0) ans += 1;
	cout << ans;
	return 0;
}

Measured memory_bytes: 256
/*
         ██╗ ██████╗ ██╗███╗   ██╗    ██╗   ██╗███████╗
         ██║██╔═══██╗██║████╗  ██║    ██║   ██║██╔════╝
         ██║██║   ██║██║██╔██╗ ██║    ██║   ██║███████╗
    ██   ██║██║   ██║██║██║╚██╗██║    ██║   ██║╚════██║
    ╚█████╔╝╚██████╔╝██║██║ ╚████║    ╚██████╔╝███████║
     ╚════╝  ╚═════╝ ╚═╝╚═╝  ╚═══╝     ╚═════╝ ╚══════╝
*/
//password:+BdCHpO8dQvpo5fnV3/u
#include<bits/stdc++.h>

using namespace std;
typedef long long ll;
const int maxn = 5e5 + 5;
const int inf = 0x3f3f3f3f;
char grid1[5050][5050],grid2[5050][5050];
int h,w;
int main() {
    cin>>h>>w;
    for(int i=1;i<=h;i++)
    {
        for(int j=1;j<=w;j++)
        {
            char c;
            cin>>c;
            grid1[i][j]=c;
        }
    }
    for(int i=1;i<=2*h;i++)
    {
        for(int j=1;j<=w;j++)
        {
            grid2[i][j]=grid1[(i+1)/2][j];
        }
    }
    for(int i=1;i<=2*h;i++)
    {
        for(int j=1;j<=w;j++)
        {
            cout<<grid2[i][j];
        }
        cout<<"\n";
    }
    return 0;
}

Measured memory_bytes: 3072
import collections
import itertools
S=[]
N=input()
[S.append(input()) for n in range(int(N))]

S_head=[]

for name in S:
    if name[0] in ['M','A','R','C','H']:
        S_head.append(name[0])
        
S_head_unique = list(set(S_head))
num = collections.Counter(S_head)

if len(S_head_unique) >= 3:
    sum=0
    for comb in list(itertools.combinations(S_head_unique,3)):
        sum = sum+num[comb[0]]*num[comb[1]]*num[comb[2]]
    print(sum)
else:
    print(0)


Measured memory_bytes: 10884
import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Scanner;
import java.util.stream.Collectors;
 
public class Main {
 
 public static void main(String[] args) {
  Scanner sc = new Scanner(System.in);
  List<Integer> list = new ArrayList<>();
  list.add(sc.nextInt());
  list.add(sc.nextInt());
  list.add(sc.nextInt());
  int fi = 0;
  int se = 0;
  for (int i : list) {
   if (i == 5) {
    fi += 1;
   } else if (i == 7) {
    se += 1;
   }
  }
  if (fi == 2 && se == 1) {
   System.out.println("YES");
  }else{
   System.out.println("NO");
  }
 }
 
}

Measured memory_bytes: 23892
#include <iostream>
#include <cstdio>
#include <fstream>
#include <algorithm>
#include <cmath>
#include <deque>
#include <vector>
#include <queue>
#include <string>1
#include <cstring>
#include <map>
#include <stack>
#include <set>
#include <sstream>
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define Mod 1000000007
#define eps 1e-6
#define ll long long
#define INF 0x3f3f3f3f
#define MEM(x,y) memset(x,y,sizeof(x))
#define Maxn 20000+5
#define P pair<int,int>//first最短路径second顶点编号
using namespace std;
int N,M;
struct edge
{
    int to,dis,cost;
    edge(int to,int dis,int cost):to(to),dis(dis),cost(cost) {}
};
vector<edge>G[Maxn];//G[i] 从i到G[i].to的距离为cost
int d[Maxn][Maxn];//d[i][j]从i到j的最短距离
int sum[Maxn];
void Dijk(int s)
{
    priority_queue<P,vector<P>,greater<P> >q;//按first从小到大出队
    for(int i=0; i<=N; i++)
        d[s][i]=INF;
    d[s][s]=0;
    q.push(P(0,s));
    while(!q.empty())
    {
        P p=q.top();
        q.pop();
        int v=p.second;//点v
        if(d[s][v]<p.first)
            continue;
        for(int i=0; i<G[v].size(); i++)
        {
            edge e=G[v][i];//枚举与v相邻的点
            if(d[s][e.to]>=d[s][v]+e.dis)
            {
                if(d[s][e.to]==d[s][v]+e.dis)
                    sum[e.to]=min(sum[e.to],e.cost);
                else
                    sum[e.to]=e.cost;
                d[s][e.to]=d[s][v]+e.dis;
                q.push(P(d[s][e.to],e.to));
            }
        }
    }
}
int main()
{
    IOS;
    while(cin>>N>>M,N+M)
    {
        MEM(sum,0);
        for(int i=1; i<=N; i++)
            G[i].clear();
        for(int i=0; i<M; i++)
        {
            int u,v,d,c;
            cin>>u>>v>>d>>c;
            G[u].push_back(edge(v,d,c));
            G[v].push_back(edge(u,d,c));
        }
        Dijk(1);
        int ans=0;
        for(int i=2; i<=N; i++)
            ans+=sum[i];
        cout<<ans<<endl;
    }
    return 0;
}



Measured memory_bytes: 5484
#include <bits/stdc++.h>
#define FOR(i, m, n) for (ll i = m; i < (n); i++)
#define RFOR(i, m, n) for (ll i = (m - 1); i >= 0; i--)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, n, 0)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
typedef long long ll;
const ll mod = 1e9 + 7;

ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }

ll factorial(ll n) {
  ll answer = 1;
  while (n > 1) {
    answer *= n;
    answer %= mod;
    n--;
  }
  return answer;
}

ll combination(ll n, ll r) {
  return factorial(n) / (factorial(r) * factorial(n - r));
}

ll permutation(ll n, ll r) { return factorial(n) / factorial(n - r); }

template <typename T>
void remove(std::vector<T>& vector, unsigned int index) {
  vector.erase(vector.begin() + index);
}

map<ll, ll> prime_factor(ll n) {
  map<ll, ll> ret;
  for (ll i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if (n != 1) ret[n] = 1;
  return ret;
}
// for (auto p : prime_factor(n)) {
//   while (p.second--) {
//     cout << p.first << endl;
//   }
// }

vector<ll> divisor(ll n) {
  vector<ll> ret;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

int main() {
  ll n;
  cin >> n;
  // ll i = 1, j = 1;
  // vector<ll> d = divisor(n);
  // REP(i, d.size() - 1) {
  //   if (d[i] * d[i + 1] == n) {
  //     cout << d[i] + d[i + 1] - 2 << endl;
  //     return 0;
  //   }
  // }
  ll anser = 1e18;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i != 0) continue;
    ll j = n / i;
    anser = min(anser, i + j - 2);
  }
  cout << anser << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep3(i, s, n, a) for (int i = (s); i < (int)(n); i += a)
#define rep2(i, s, n) rep3(i, s, n, 1)
#define rep(i, n) rep2(i, 0, n)

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;

int main(){
    ll n, m;
    cin >> n >> m;
    if(n==1 || m==1){
      if (n == 1 && m == 1) {
        cout << 1 << endl;
        return 0;
      } else {
        ll maxim = max(n, m);
        cout << maxim - 2 << endl;
        return 0;
      }
    }
    cout << (n-2) * (m-2) << endl;
    return 0;
}

Measured memory_bytes: 3568
import java.util.*
import java.math.*
import java.lang.Math.*

private val readString: ()->String = {readLine()!!}
private val readInt: ()->Int = { readLine()!!.toInt() }
private val readLong: ()->Long = { readLine()!!.toLong() }
private val readListInt: ()->List<Int> = { readLine()!!.split(' ').map(String::toInt) }
private val readListLong: ()->List<Long> = { readLine()!!.split(' ').map(String::toLong) }
private val errPrintln: (String)->Unit = { msg -> System.err.println(msg) }
private val MOD = 1e9.toLong()+7


fun solveC(N: Int, A:Int, B:Int, C:Int, L:List<Int>): Int {
    val INF = Int.MAX_VALUE/2

    tailrec fun dfs(n: Int, a: Int, b: Int, c: Int): Int {
        if (n>=N) {
            if (a == 0 || b == 0 || c == 0) return INF
            return abs(A - a) + abs(B - b) + abs(C - c) - 30
        }

        val r = dfs(n+1, a, b, c)
        val r0 = dfs(n+1, a+L[n], b, c) + 10
        val r1 = dfs(n+1, a, b+L[n], c) + 10
        val r2 = dfs(n+1, a, b, c+L[n]) + 10
        return min(r, min(r0, min(r1, r2)))

    }

    val res = dfs(0, 0, 0, 0)

    return res
}


fun main(args: Array<String>) {
    val (N,A,B,C) = readListInt()
    val L = Array<Int>(N){0}
    for(i in 0 until N) {
        L[i] = readInt()
    }

    val ans = solveC(N, A, B, C, L.toList())

    println(ans)
}


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

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

#define rep(i,n) for(int i=0;i<n;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 mp1(a,b,c) P1(a,P(b,c))
#define get_arsize(a) (sizeof(a)/sizeof(a[0]))

const ll MOD = 1000000007;
const double EPS = 1e-10;
const int MAX = 200000;

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> av;
  ll sum = 0;
  rep(i,n) {
    int a;
    cin >> a;
    av.push_back(a);
    sum += a;
  }
  int cnt = 0;
  double d = (double) sum / (double) (4*m);
  rep(i,n) {
    if (av[i] >= d) cnt++;
  }
  if(cnt >= m) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}


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

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y

using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;

using f32 = float;
using f64 = double;

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) for(i64 i = 1; i <= n; ++i)
#define RREP(i, n) for(i64 i = n - 1; i >= 0 ; --i)
#define RREPS(i, n) for(i64 i = n; i >= 1; --i)

#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define pb push_back
#define mp make_pair
#define F first
#define S second

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

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }

template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }


struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;


int main() {
    f64 R; cin >> R;
    cout << setprecision(3) << 2 * R * 3.14159265 << endl;

    return 0;
}

Measured memory_bytes: 3796
#include<bits/stdc++.h>
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define MOD 1000000007
#define EPS (1e-10)
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
typedef pair<int, int>P;

int main() {
	int n; scanf("%d", &n);
	int d = 1 << n;
	vector<int>v(d);
	rep(i, d)scanf("%d", &v[i]);
	while (v.size() > 1) {
		for (int i = 0; i < v.size(); i += 2) {
			if (v[i] < v[i + 1]) {
				v[i + 1] -= v[i];
				v[i] = -1;
			}
			else if (v[i] > v[i + 1]) {
				v[i] -= v[i + 1];
				v[i + 1] = -1;
			}
			else {
				v[i] = -1;
			}
		}
		v.erase(remove(v.begin(), v.end(), -1), v.end());
	}
	printf("%d\n", v[0]);
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int n;
struct restdata {
    int no; int point;
};
bool cmp(const restdata &aa, const restdata &bb) {
    return aa.point > bb.point;
}

int main() {
    cin >> n;
    vector<int> ans(n, 0);
    map<string, vector<restdata> > mrest;
    for(int i = 0; i < n; ++i) {
        string s; int pp;
        cin >> s >> pp;
        restdata indata;
        indata.no = i+1; indata.point = pp;
        mrest[s].push_back(indata);
    }

    int now = 0;
    for(auto x : mrest) {
        vector<restdata> outdata;
        outdata = x.second;
        sort(outdata.begin(), outdata.end(), cmp);
        for(int j = 0; j < outdata.size(); ++j) {
            ans.at(now) = outdata.at(j).no;
            now++;
        }
    }

    for(int i = 0; i < n; ++i) {
        cout << ans.at(i) << endl;
    }
}

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

signed main(){
  using ll = int64_t;

  ll n,k;
  cin>>n>>k;

  if(n>k){
    cout<<(0)<<endl;
    return 0;
  }

  ll ans = 1;
  ll mod = 1e9+7;
  for(int i=0;i<n&&k>1;++i,--k){
    ans *= k;
    ans %= mod;
  }
  cout<<(ans)<<endl;

}


Measured memory_bytes: 3100
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
//using ProCon.Util;

namespace ProCon
{
    class Program
    {
        static void Main(string[] args)
        {
            AC139B();
        }

        static void AC139B()
        {
            //https://atcoder.jp/contests/abc139/tasks

            var n = int.Parse(Console.ReadLine());
            var listH = Console.ReadLine().Split().Select(int.Parse).ToArray();

            int count = 0, maxCount = 0;
            int prev = 0;

            foreach(var h in listH)
            {
                if(prev >= h)
                {
                    count++;
                    if (count > maxCount)
                    {
                        maxCount = count;
                    }
                }
                else
                {
                    count = 0;
                }
                prev = h;
            }
            
            Console.WriteLine(maxCount);
        }

    }
}


Measured memory_bytes: 28124
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag,tree_order_statistics_node_update> ordered_set;

#define scan(x) do{while((x=getchar())<'0'); for(x-='0'; '0'<=(_=getchar()); x=(x<<3)+(x<<1)+_-'0');}while(0)
char _;
#define complete_unique(a) a.erase(unique(a.begin(),a.end()),a.end())
#define all(a) a.begin(),a.end()
#define println printf("\n");
#define readln(x) getline(cin,x);
#define pb push_back
#define endl "\n"
#define INT_INF 0x3f3f3f3f
#define LL_INF 0x3f3f3f3f3f3f3f3f
#define MOD 1000000007
#define MOD2 1494318097
#define SEED 131
#define mp make_pair
#define fastio cin.tie(0); cin.sync_with_stdio(0);

#define MAXN 500005

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef unordered_map<int,int> umii;
typedef pair<int,int> pii;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef pair<int,pii> triple;
typedef int8_t byte;

mt19937 g1(time(0));

int randint(int a, int b){return uniform_int_distribution<int>(a, b)(g1);}
ll randlong(ll a,ll b){return uniform_int_distribution<long long>(a, b)(g1);}

ll gcd(ll a, ll b){return b == 0 ? a : gcd(b, a % b);}
ll lcm(ll a, ll b){return a*b/gcd(a,b);}
ll fpow(ll  b, ll exp, ll mod){if(exp == 0) return 1;ll t = fpow(b,exp/2,mod);if(exp&1) return t*t%mod*b%mod;return t*t%mod;}
ll divmod(ll i, ll j, ll mod){i%=mod,j%=mod;return i*fpow(j,mod-2,mod)%mod;}

int len,sum[MAXN],lst[MAXN];
char s[MAXN];
vector<pii> v;
ll res;

int main(){
	scanf("%s",s+1); len = (int)strlen(s+1);
	for(int i=1; i<=len; i++){
		if(s[i] == '<') sum[i] = sum[i-1]+1;
		else sum[i] = sum[i-1]-1;
	}
	int tmp = 1;
	for(int i=2; i<=len; i++){
		if(s[i] != s[i-1]){
			if(s[i-1] == '>'){
				for(int k=tmp; k<=i-1; k++)
					lst[k] = i-1;
			}
			tmp = i;
		}
	}
	if(s[len] == '>'){
		for(int k=tmp; k<=len; k++)
			lst[k] = len;
	}
	for(int i=1; i<=len; i++){
		if(s[i] == '>' && (i == 1 || s[i-1] == '<')){
			for(int k=i; k<=lst[i]; k++)
				sum[k] = sum[k-1]-1;
			int mx = 0;
			for(int k=lst[i]; k>=i; k--){
				if(sum[k]+mx >= 0){
					sum[k]+=mx; //res+=mx;
					continue;
				}
				mx = max(mx,-sum[k]);
				sum[k]+=mx;
//				res+=mx;
			}
			sum[i-1]+=mx;// res+=mx;
			mx = INT_MAX;
			for(int k=i-1; k<=lst[i]; k++)
				mx = min(mx,sum[k]);
			for(int k=i-1; k<=lst[i]; k++)
				sum[k]-=mx;
			sum[i-1] = max(sum[i-2]+1,sum[i-1]);
			i = lst[i];
		}else sum[i] = sum[i-1]+1;
//		printf("%d ",sum[i]);
	}
	for(int i=0; i<=len; i++){
		res+=sum[i];
//		printf("%d ",sum[i]);
	}
//	printf("\n");
	printf("%lld\n",res);
}

Measured memory_bytes: 4608
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <climits>
#include<string>
#include<set>
using namespace std;

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

#define INF INT_MAX/3
#define REP(i,n) for(int i=0;i<n;i++)

int main(){
	string str;
	set<int> se;
	cin>>str;

	for(auto& s: str){
		se.insert(s);
	}
	if(se.size() == str.size()){
		cout<<"yes"<<endl;
	}
	else{
		cout<<"no"<<endl;
	}

	return 0;
}


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

int main() {
  int N;cin>>N;
  long long M=1000, S; 
  vector<long long> A(87);
  for(int i=0;i<N;i++) cin>>A.at(i);
  for(int i=0;i<N;i++) {
    if(M>=1000) {
      if(A.at(i)<A.at(i+1)) {
        S = M/A.at(i);
        M %= A.at(i);
      }
    }
    else {
      if(A.at(i)<A.at(i+1)) continue;
      else {
      M += S*A.at(i);
      S =0;
      }
    }
  }
  cout<<M<<endl;
}


Measured memory_bytes: 3628
n, m=gets.split.map(&:to_i)

v=Array.new(n+1){0}
m.times do
  a, b=gets.split.map(&:to_i)
  a, b=b, a if a>b
  v[a]+=1
  v[b]-=1
end
v.size.times do |i|
  if i>0
    v[i]+=v[i-1]
  end
end
ok=true
v.each{|e| ok&=e.even?}

puts ok ? 'YES' : 'NO'


Measured memory_bytes: 2556
#ifdef DEBUG

#else

#    pragma GCC optimize("O3,no-stack-protector")
#    pragma GCC optimize("unroll-loops")

#    if __cplusplus >= 201703L
#        pragma GCC target("avx2")
#    else
#        pragma GCC target("avx")
#    endif

#endif
// 実数の場合
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
typedef int64_t Int;

using namespace std;
using Graph = vector<vector<Int>>;

const double pi = M_PI;
const Int MOD = 1000000007;

void rec(Int d, Int n, vector<Int> &all, bool is7, bool is5, bool is3) {
    if (d < n) {
        return;
    }

    if (is7 && is5 && is3) {
        all.push_back(n);
    }

    n *= 10;
    rec(d, n + 7, all, true, is5, is3);
    rec(d, n + 5, all, is7, true, is3);
    rec(d, n + 3, all, is7, is5, true);
}

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

    Int n;
    cin >> n;

    vector<Int> all;

    rec(n, 7, all, true, false, false);
    rec(n, 5, all, false, true, false);
    rec(n, 3, all, false, false, true);

    cout << all.size() << endl;

    return 0;
}


Measured memory_bytes: 640
O = input()
E = input()

if len(O) == len(E):
    for i in range(len(O)):
        print(O[i], E[i], sep='', end='')
    print()
else:
    for i in range(len(E)):
        print(O[i], E[i], sep='', end='')
    print(O[-1])

Measured memory_bytes: 3060