akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
//#define ll long long
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 (a>b) { a=b; return 1; } return 0; }
#define rep(i, n) REP(i, 0, n)
#define rep_rev(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
#define all(x) (x).begin(),(x).end()
ll t1,t2,t3;
const ll mod = 1000000007;
const int INF = 1e9;
const ll INFLONG = 1e18;

int main(){
//  ll n;
//  cin >> n;
//  vector<pair<ll,ll>> vec;
//  vector<ll> ch(n,0);
//  ll sum1 = 0;
//  ll sum2 = 0;
//  ll sum3 = 0;
//  vector<ll> arr(n+1);
//  ll p = 1;
//  arr[0] = 1;
//  rep(i,n){
//    arr[i+1] = arr[i] * 2;
//    arr[i+1] %= mod;
//  }
//  ll ans = 0;
//  map<pair<ll,ll>,ll> mp;
//  ll cou = 0;
//  pair<ll,ll> pa1,pa2,pa3;
//  rep(i,n){
//    cin >> t1 >> t2;
//    if(t1 < 0){
//      t1 *= -1;
//      t2 *= -1;
//    }
//
//    if(t1 != 0 && t2 != 0){
//      t3 = gcd(t1,t2);
//      t1 /= t3;
//      t2 /= t3;
//    }
//    pa1 = make_pair(t1,t2);
//    mp[pa1]++;
//  }
//  for(auto itr:mp){
//    t1 = itr.first.first;
//    t2 = itr.first.second;
//    pa2 = make_pair(t2,-t1);
//    pa3 = make_pair(-t2,t1);
//    ans += (arr[itr.second]-1) * arr[n - itr.second - mp[pa2] + mp[pa3]];
//    ans %= mod;
//    cout << t1 << " " << t2 << " " << arr[itr.second] << "  " << arr[mp[pa2] + mp[pa3]] << endl;
//  }
//  cout << ans << endl;

  ll n;
  cin >> n;
  map<pair<ll,ll>,pair<ll,ll>> M;
  vector<ll> p2(n+1);
  p2[0] = 1;
  rep(i,n){
    p2[i+1] = p2[i] * 2;
    p2[i+1] %= mod;
  }
  int Z=0;


  rep(i,n) {
    ll X,Y;
    cin>>X>>Y;
    if(X == 0 && Y == 0){
      Z++;
    }else if(X==0){
      M[{0,0}].first++;
    }else if(Y==0){
      M[{0,0}].second++;
    }else{
      if(Y < 0){
        X *= -1;
        Y *= -1;
      }
      ll g = gcd(abs(X),abs(Y));
      X /= g;
      Y /= g;
      if(X < 0){
        M[{Y,-X}].first++;// first:片方マイナスなので反転させたもの
      }else{
        M[{X,Y}].second++;
      }
    }
  }
  ll ret = 1;
  for(auto itr:M){
    //cout << itr.first.first << " " << itr.first.second << " ";
    //cout << itr.second.first << " " << itr.second.second << endl;
    ll a = p2[itr.second.first] + p2[itr.second.second]-1;
    ret = (ret*a)%mod;
    //cout << ret << endl;
  }
  cout << (ret+Z+mod-1)%mod << endl;
}


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

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<=(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define Eunique(v) v.erase(unique(all(v)),v.end())
#define Eback(s) s.erase(s.end()-1,s.end())
#define rev(v) reverse(all(v))
#define minvec(v) *min_element(all(v))
#define maxvec(v) *max_element(all(v))
#define pb push_back
#define pf push_front
#define mod 1000000007
#define m_p make_pair
#define DOUBLE fixed << setprecision(15)
#define OK puts("OK")
#define OK1 puts("OK1")
#define OK2 puts("OK2")
#define SIZE(s) (int)s.size()
#define INF ((1LL<<62)-(1LL<<31))
#define zero(x,n) setw(x) << setfill('0') << n

typedef long long ll;

typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<double> vd;
typedef vector<char> vc;
typedef vector<string> vs;

typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef vector<pair<int,int>> vpii;
typedef vector<pair<ll,ll>> vpll;

const double pi = acos(-1.0);

template<class A, class B>
ostream& operator<<(ostream& ost, const pair<A, B>&p) {
	ost << "{" << p.first << ", " << p.second << "} ";
	return ost;
}

template<class T>
ostream& operator<<(ostream& ost, const vector<T>&v) {
	ost << "{";
	for (int i = 0; i<(int)v.size(); i++) {
		if (i)ost << " ";
		ost << v[i];
	}
	ost << "} \n";
	return ost;
}

template<class A, class B>
ostream& operator<<(ostream& ost, const map<A, B>&v) {
	ost << "{";
	for (auto p:v) {
		ost << "{" << p.first << ", " << p.second << "} ";
	}
	ost << "} ";
	return ost;
}

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

ll gcd(ll x, ll y) {return __gcd(x,y);}
ll lcm(ll x, ll y) {return x/__gcd(x,y)*y;}

int main()
{
	ll n,k,d;
	map<ll,ll> m;
	cin >> n >> k;
	rep(i,k){
		cin >> d;
		m[d]=1;
	}
	for(ll i=n;i<=10*n;i++){
		bool b=true;
		string s=to_string(i);
		rep(j,SIZE(s)){
			if(m[s[j]-'0']==1) b=false;
		}
		if(b){
			cout << i << endl;
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 256
import collections
n = int(input())
a = map(int, input().split())
li = []
for i in a:
    li.append(i)
collections.Counter(li)
m = 0
dic = collections.Counter(li)
for i in dic.values():
    m += int(i*(i-1)*0.5)
for k in range(n):
      print(m-dic[li[k]]+1)

Measured memory_bytes: 26780
#include <iostream>
#include <algorithm>
#include <cmath>
#include <climits>
#include <vector>

typedef long long ll;

using namespace std;

int main(void) {
  ll X; cin >> X;
  ll ans = 0;
  for (int t = 1; t <= X; t++) {
    if (t * (t + 1) / 2 >= X) {
      ans = t;
      break;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define pf push_front

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

#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)

int main()
{ int H,W,h,w;
 cin >> H >> W >> h >> w;
 
 int s;
 s = (H-h)*(W-w);
 
 cout << s << endl;
 
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int MAXN=1010;
int h,w,k,cnt,ans,a[MAXN][MAXN],s[MAXN][MAXN],cur[MAXN],dp[MAXN];
char c[MAXN];
int solve () {
	for (int i=1;i<=w;i++) {
		dp[i]=0;
		int tmp=0;
		for (int j=1;j<=cnt;j++) {
			while (s[j][i]-s[j][cur[j]]>k) {cur[j]++;}
			tmp=max(tmp,cur[j]);
		}
		if (tmp==i) {return 1e9;}
		dp[i]=dp[tmp]+1;
	}
	return dp[w]-1;
}
int main () {
	scanf("%d%d%d",&h,&w,&k);
	for (int i=1;i<=h;i++) {
		scanf("%s",c+1);
		for (int j=1;j<=w;j++) {a[i][j]=c[j]-'0';}
	}
	ans=1e9;
	for (int i=0;i<(1<<(h-1));i++) {
		cnt=1;
		for (int j=1;j<=h;j++) {
			for (int k=1;k<=w;k++) {s[j][k]=0;}
		}
		for (int j=1;j<=h;j++) {
			for (int k=1;k<=w;k++) {s[cnt][k]+=a[j][k];}
			if ((i>>(j-1))&1) {cnt++;}
		}
		for (int k=1;k<=cnt;k++) {
			cur[k]=0;
			for (int j=1;j<=w;j++) {s[k][j]+=s[k][j-1];}
		}
		ans=min(ans,solve()+cnt-1);
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 2304
#include<iostream>
#include<algorithm>
#include<string>
#include<map>
#include<cstdio>
#include<cstring>
#include<vector>
using namespace std;
#define mp(a,b) make_pair(a,b)
#define fr first
#define sc second
typedef pair<string,int> Pi;
int main(){
  int d[4],n,r;
  while(cin >> d[0] >> d[1] >> d[2] , d[0]){
    cin >> n;
    sort(d,d+3);
    int ans = d[0] * d[0] + d[1] * d[1];
    while(n--){
      cin >> r;
      cout << (r * r * 4 > ans ? "OK" : "NA") << endl;
    }
  }
}

Measured memory_bytes: 1168
open System

[<AutoOpen>]
module Cin =
    let read f = stdin.ReadLine() |> f
    let reada f = stdin.ReadLine().Split() |> Array.map f

[<EntryPoint>]
let main _ =
    let s = read string
    let mutable ans = 0
    for c in s do
        if c = '1' then ans <- ans + 1
    printfn "%d" ans
    0


Measured memory_bytes: 11984
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>
#include <stack>



#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define all(x) (x).begin(),(x).end()

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

typedef long long ll;

using namespace std;


int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n,x;cin>>n>>x;
  ll res=0;
  vector<int>a(n);
  rep(i,n){
    cin>>a[i];
  }
  rep(i,n-1){
    if(a[i]+a[i+1]>x){
      int d=a[i]+a[i+1]-x;
      res+=d;
      a[i+1]=max(0,a[i+1]-d);
      a[i]=min(a[i],a[i]+a[i+1]-d);
    }
  }
  cout<<res<<endl;
  return 0;

}


Measured memory_bytes: 640
#include <iostream>

int main() {
    long long N, D;
    std::cin >> N >> D;
    int count{0};
    long long dd = D * D;
    for (int i = 0; i < N; ++i) {
        long long x, y;
        std::cin >> x >> y;
        if (dd >= (x * x + y * y)) {
            count++;
        }
    }
    std::cout << count << std::endl;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long ;
int main(){
    int a,b;
    cin >> a >> b;
    int ans=0;
    if(a>b) cout << 2*a-1 << endl;
    else if(a<b) cout << 2*b-1 << endl;
    else cout << 2*a << endl;
}

Measured memory_bytes: 3548
N = int(input())
S = input()

def kAlgo(S, N):
    szS = N
    Z = [0]*szS
    Z[0] = szS
    i = 1 #current pos
    j = 0 #伸ばす幅
    while i < szS:
        while (i + j < szS) and (S[j] == S[i+j]): j += 1
        #set Z[i]
        Z[i] = j

        if j == 0:
            i += 1
            continue

        #optimize
        k = 1
        while (k < j) and (k + Z[k] < j):
            Z[i+k] = Z[k]
            k += 1

        i += k
        j -= k

    ans = 0
    for i in range(N):
        if Z[i] > i: Z[i] = i
    return max(Z[1:])

ans = 0
for i in range(N-1):
    lenz = kAlgo(S[i:], N-i)
    if ans < lenz:
        ans = lenz

print(ans)


Measured memory_bytes: 76736
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int n = scanner.nextInt();
			Map<Integer, Integer> oddMap = new HashMap<>(), evenMap = new HashMap<>();
			IntStream.range(0, n).forEach(i -> {
				int v = scanner.nextInt();
				if (0 == (i & 1)) {
					evenMap.put(v, evenMap.getOrDefault(v, 0) + 1);
				} else {
					oddMap.put(v, oddMap.getOrDefault(v, 0) + 1);
				}
			});
			Entry<Integer, Integer> evenMax = evenMap.entrySet().stream()
					.max((x, y) -> Integer.compare(x.getValue(), y.getValue())).get();
			Entry<Integer, Integer> oddMax = oddMap.entrySet().stream()
					.max((x, y) -> Integer.compare(x.getValue(), y.getValue())).get();
			// System.out.println("evenMax=" + evenMax + ", oddMax=" + oddMax);
			if (evenMax.getKey().equals(oddMax.getKey())) {
				// 最大値の数字が同じ場合、どちらかを削除する
				int evenSecond = evenMap.values().stream().sorted((x, y) -> Integer.compare(y, x))
						.mapToInt(Integer::intValue).skip(1).limit(1).sum();
				int oddSecond = oddMap.values().stream().sorted((x, y) -> Integer.compare(y, x))
						.mapToInt(Integer::intValue).skip(1).limit(1).sum();
				// System.out.println("evenSecond=" + evenSecond + ", oddSecond=" + oddSecond);
				System.out.println(n - Math.max(evenMax.getValue() + oddSecond, oddMax.getValue() + evenSecond));
			} else {
				System.out.println(n - evenMax.getValue() - oddMax.getValue());
			}
		}
	}
}


Measured memory_bytes: 63224
#include<iostream>
#define MAX 100001
using namespace std;

int main(){
  int data[MAX],n,k,kari,max,frag;
  while(1){
    cin >> n >> k;
    if(n == 0&& k == 0)break;
    for(int i = 0;i <= n;i++)
      data[i] = 0;
    for(int i = 0;i < k;i++){
      cin >> kari;
      data[kari] = 1;
    }
    for(int i = 1;i <= n;i++){
      if(data[i] != 0)
        data[i] = data[i-1]+1;
    }
    kari = 0;
    for(int i = n;i >0;i--){
      if(data[i] == 0) kari = 0;
      else{
        if(kari <  data[i])
          kari = data[i];
      data[i] = kari;
      }
    }
    frag = 0;
    max = 0;
    if(data[0] == 1){
      for(int i = 0;i <= n-2;i++){
        if(data[i]!=0&&data[i+1]==0&&data[i+2]!=0){
          kari = data[i]+data[i+2]+1;
          if(kari > max)
            max = kari;
          frag = 1;
        }
      }
      if(frag == 0){
        for(int i = 0; i <= n;i++){
          if(data[i] > max)max = data[i];
        }
          if(max != n)max++;
      }
      cout << max << endl;
    }else{
      for(int i = 0;i <=n;i++){
        if(data[i]>max)
          max = data[i];
      }
      cout<< max << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 1256
#include<iostream>
using namespace std;
#include <string>
#include<algorithm>
int main()
{
	int a[3];
	for (int i = 0; i < 3; i++)
	{
		cin >> a[i];
	}
	sort(a, a + 3);
	if (a[0] == 5 && a[1] == 5 && a[2] == 7)
	{
		cout << "YES" << endl;
	}
	else
	{
		cout << "NO" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
n = int(input())
s = input()
r = 0
g = 0
b = 0
for i in s:
    if i == 'R':
        r += 1
    elif i == 'G':
        g += 1
    else:
        b += 1
rgb = r*g*b
minus = 0
for i in range(n):
    dis = 1
    while i+dis*2 < n:
        if s[i] != s[i+dis] and s[i] != s[i+dis*2] and s[i+dis] != s[i+dis*2]:
            minus += 1
        dis += 1
print(rgb-minus)


Measured memory_bytes: 73608
N = int(input())
A = list(map(int, input().split()))
mod = 10**9 + 7
a = max(A)
prime_num = [2]
sgn = [0 for _ in range(max(int(a**0.5)+1, 4))]
sgn[2] = 1
for k in range(3, len(sgn), 2):
  if sgn[k] == 0:
    prime_num.append(k)
    for j in range(k, a+1, k**2):
      sgn[k] = 1
baisu = []
count = [0 for _ in range(a+1)]
for k in range(N):
  b = 0 + A[k]
  for p in prime_num:
    if p**2 <= b:
      if b%p == 0:
        if count[p] == 0:
          baisu.append(p)
        c = 0
        while b % p == 0:
          b //= p 
          c += 1 
        if c > count[p]:
          count[p] = c
    else:
      break
  if b != 1:
    if count[b] == 0:
      count[b] = 1
      baisu.append(b)

product = 1
for item in baisu:
  product *= pow(item, count[item], mod)
  product %= mod

b = mod-2
blis = []
c = 0
while b >0:
  if b & 1 == 1:
    blis.append(c)
  c += 1
  b >>= 1

def modinv(a):
  if a == 1:
    return 1
  else:
    res = 1
    li = []
    for _ in range(c):
      li.append(a%mod)
      a = a*a%mod
    for item in blis:
      res = res *li[item] %mod
    return res

ans = 0
for k in range(N):
  ans += product*modinv(A[k])
  ans %= mod

print(ans)


Measured memory_bytes: 149104
a = [1, 3, 5, 7, 8, 10, 12]
b = [4, 6, 9, 11]
ans = [0, 0]
x = list(map(int, input().split()))
for i, xi in enumerate(x):
    if xi in a:
        ans[i] = 1
    elif xi in b:
        ans[i] = 2
if ans[0] == ans[1]:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 3060
package main

import (
	"fmt"
)

func main() {
	var n, m int
	fmt.Scan(&n, &m)
	x := 1
	p := 0
	q := 0
  if n-m <= 1 && n-m >= -1 {
		for i := 1; i <= 100000; i++ {
			x *= i
			x %= 1000000007
			if i == n {
				p = x
			}
			if i == m {
				q = x
			}
		}
	}
	ans := p * q
	if n == m {
		ans *= 2
	}
	fmt.Println(ans%1000000007)
}

Measured memory_bytes: 512
#include<iostream>
#include<string>
#include<algorithm>	
#include<cmath>
using namespace std;
int main() {
	int a, b, c, d, e;
	cin >> a;
	int S[11][4] = { 0 };
	int H[11][4] = { 0 };
	int C[11][4] = { 0 };
	int D[11][4] = { 0 };
	for (int h = 1; h <= a; h++) {
		cin >> b >> c >> d >> e;
		if (b == 1) { S[d][c] += e; }
		if (b == 2) { H[d][c] += e; }
		if (b == 3) { C[d][c] += e; }
		if (b == 4) { D[d][c] += e; }
	}
	for (int h = 1; h <= 3; h++) {
		for (int i = 1; i <= 10; i++) { cout << ' ' << S[i][h]; }
		cout << endl;
	}
	for (int h = 1; h <= 20; h++) { cout << '#'; } cout << endl;
	for (int h = 1; h <= 3; h++) {
		for (int i = 1; i <= 10; i++) { cout << ' ' << H[i][h]; }
		cout << endl;
	}
	for (int h = 1; h <= 20; h++) { cout << '#'; } cout << endl;
	for (int h = 1; h <= 3; h++) {
		for (int i = 1; i <= 10; i++) { cout << ' ' << C[i][h]; }
		cout << endl;
	}
	for (int h = 1; h <= 20; h++) { cout << '#'; } cout << endl;
	for (int h = 1; h <= 3; h++) {
		for (int i = 1; i <= 10; i++) { cout << ' ' << D[i][h]; }
		cout << endl;
	}
}


Measured memory_bytes: 3076
#include <cstdio>

typedef long long i64;

const int N = 100000 + 10, MOD = 1000000007;

int n, m, x[N], y[N];

int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; ++i) scanf("%d", &x[i]);
  for (int i = 1; i <= m; ++i) scanf("%d", &y[i]);
  int a = 0, b = 0;
  for (int i = 2; i <= n; ++i) a = (a + (x[i] - x[i - 1]) * (n - i + 1LL) % MOD * (i - 1LL)) % MOD;
  for (int i = 2; i <= m; ++i) b = (b + (y[i] - y[i - 1]) * (m - i + 1LL) % MOD * (i - 1LL)) % MOD;
  int ans = (i64)a * b % MOD;
  printf("%d\n", (ans + MOD) % MOD);
  return 0;
}


Measured memory_bytes: 896
//84104971101048411497 - Can you guess what does this mean?
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef complex<double> point;
#define mapii map<int, int>
#define debug(a) cout << #a << ": " << a << endl
#define debuga1(a, l, r) fto(i, l, r) cout << a[i] << " "; cout << endl
#define fdto(i,  r, l) for(int i = (r); i >= (l); --i)
#define fto(i, l, r) for(int i = (l); i <= (r); ++i)
#define forit(it, var) for(__typeof(var.begin()) it = var.begin(); it != var.end(); it++)
#define forrit(rit, var) for(__typeof(var.rbegin()) rit = var.rbegin(); rit != var.rend(); rit++)
#define ii pair<int, int>
#define iii pair<int, ii>
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define X real()
#define Y imag()
#define maxN 100005
#define maxX 2154
#define oo 2000000007
#define sz(a) (int)a.size()

const double PI = acos(-1.0);

double fRand(double fMin, double fMax)
{
    double f = (double)rand() / RAND_MAX;
    return fMin + f * (fMax - fMin);
}

template <class T>
T min(T a, T b, T c) {
    return min(a, min(b, c));
}

template <class T>
T max(T a, T b, T c) {
    return max(a, max(b, c));
}

int n, cntCube;
map<pair<ll, ll>, int> m;
set<pair<ll, ll> > s;

int Count(const pair<ll, ll> &x) {
    map<pair<ll, ll>, int>::iterator it = m.find(x);
    int cntRev = (it == m.end()) ? 0 : it->ss;
    return cntRev;
}

int main () {
    scanf("%d", &n);
    fto(i, 1, n) {
        ll x, p1 = 1, p2 = 1;
        scanf("%lld", &x);

        fto(j, 2, maxX) {
            int cnt = 0;
            while (x%j == 0) {
                ++cnt;
                x /= j;
            }
            if (cnt%3 == 1) p1 *= j;
            else if (cnt%3 == 2) p2 *= j;
        }

        ll t = sqrtl(x);
        if (t*t == x) p2 *= t;
        else p1 *= x;

        if (p1 == p2) cntCube++;
        else {
            m[mp(p1, p2)]++;
            if (p1 > p2) swap(p1, p2);
            s.insert(mp(p1, p2));
        }
    }

    int ans = (cntCube > 0);
    forit(it, s) {
        ll p1 = it->ff, p2 = it->ss;
        ans += max(Count(mp(p1, p2)), Count(mp(p2, p1)));
    }

    printf("%d", ans);

    return 0;
}


Measured memory_bytes: 12800
# bitDP(集合を数に変換して状態(=添字)として持つようなDPのこと)
# dp[i][S]=(男性はi人目までで、既にペアになった女性の集合がSであるような場合の数)
# 「既にペアになった女性の集合がS」なら「bitpopcount(S)人目までをチェックした」ってことになるから、iを状態として持つ必要は無いことがわかる
import sys
input = sys.stdin.readline
mod=10**9+7
n=int(input())
a=[list(map(int,input().split())) for i in range(n)]
dp=[0]*(1<<n)
dp[0]=1
for i in range(1,1<<n):
    k=bin(i).count("1")
    # k-1人目までは確定
    for j in range(n):
        if i>>j&1 and a[k-1][j]:
            dp[i]+=dp[i^(1<<j)]
    dp[i]%=mod
print(dp[(1<<n)-1])


Measured memory_bytes: 59100
#include <iostream>
#include <cstdio>
using namespace std;
const int INF = 100000000;

int K[25][25];

void init()
{
	for (int i = 0; i < 25; ++i)
	{
		for (int j = 0; j < 25; ++j)
		{
			K[i][j] = INF;
		}
	}
}

void show(int N)
{
	for (int i = 1; i <= N; ++i)
	{
		for (int j = 1; j <= N; ++j)
		{
			if (K[i][j] == INF)
			{
				cout << "INF" << " ";
			}
			else
			{
				cout << K[i][j] << " ";
			}
		}
		cout << endl;
	}
	cout << endl;
}

int main()
{
	init();
	int N,M,A,B,C,D,S,G,V,P;
	scanf("%d%d", &N, &M);
	for (int i = 0; i < M; ++i)
	{
		scanf("%d,%d,%d,%d", &A, &B, &C, &D);
		//cerr << "read " << A << " " << B << " " << C << " " << D << endl;
		K[A][B] = C;
		K[B][A] = D;
	}
	scanf("%d,%d,%d,%d", &S, &G, &V, &P);

	//show(N);

	for (int k = 1; k <= N; ++k)
	{
		for (int i = 1; i <= N; ++i)
		{
			for (int j = 1; j <= N; ++j)
			{
				if (K[i][j] > K[i][k] + K[k][j])
				{
					K[i][j] = K[i][k] + K[k][j];
				}
			}
		}

		//show(N);
	}

	cout << V - P - K[S][G] -K[G][S] << endl;

	return 0;
}


Measured memory_bytes: 3132
#include<bits/stdc++.h>
using namespace std;
#define Mod(n) n % 1000000007
int main()
{
    string s,t;
    cin >> s >> t;
    s += t;
    int N = stoi(s);
    cout << (sqrt(N) == (int)sqrt(N) ? "Yes\n" : "No\n");
}


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

using namespace std;

int stand[4];
int side[4];
int ans;

void serch(string s_str)
{
	
	if(s_str=="North")
	{
		int num;
		num=stand[0];
		stand[0]=stand[1];
		stand[1]=stand[2];
		stand[2]=stand[3];
		stand[3]=num;
		side[0]=stand[1];
		side[2]=stand[3];
	}
	else if(s_str=="South")
	{
		int num;
		num=stand[3];
		stand[3]=stand[2];
		stand[2]=stand[1];
		stand[1]=stand[0];
		stand[0]=num;
		side[0]=stand[1];
		side[2]=stand[3];
	}
	else if(s_str=="East")
	{
		int num;
		num=side[1];
		side[1]=stand[0];
		stand[0]=side[3];
		side[3]=stand[2];
		stand[2]=num;
	}
	else if(s_str=="West")
	{
		int num;
		num=side[1];
		side[1]=stand[2];
		stand[2]=side[3];
		side[3]=stand[0];
		stand[0]=num;
	}
	else if(s_str=="Right")
	{
		int num;
		num=side[0];
		side[0]=side[1];
		side[1]=side[2];
		side[2]=side[3];
		side[3]=num;
		stand[1]=side[0];
		stand[3]=side[2];
	}
	else if(s_str=="Left")
	{
		int num;
		num=side[0];
		side[0]=side[3];
		side[3]=side[2];
		side[2]=side[1];
		side[1]=num;
		stand[1]=side[0];
		stand[3]=side[2];
	}
/*	
	cout << "stand:" ;
	for(int i=0;i<4;i++)
		cout << stand[i] <<" " ;
	cout << endl;
	
	cout << "side :" ;
	for(int i=0;i<4;i++)
		cout << side[i] <<" " ;
	cout << endl;
*/	
	ans+=stand[0];
	
	
	return ;
}

int main()
{
	int n;
	string str;
	
	for(;;)
	{
		cin >> n;
		if(n==0)
			break;
		
		stand[0]=1;
		stand[1]=2;
		stand[2]=6;
		stand[3]=5;
		side[0]=2;
		side[1]=3;
		side[2]=5;
		side[3]=4;
		ans=1;
		
//		cout << "now_top:" << stand[0] << endl;
		for(int i=0;i<n;i++)
		{
			cin >> str ;
			serch(str);
//			cout << "now_ans:" << ans << endl;
		}
		
		cout << ans << endl;
	}
}

Measured memory_bytes: 0
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>

int n;
float f;
int main(void){
  scanf("%d", &n);
  if (n == 1) f = 1.0;
  else f = (n/2 + n%2)/(float)n;
  printf("%f", f);
  return 0*printf("\n");
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi=vector<int>;using vvi=vector<vi>;using vl=vector<ll>;
using P=pair<int,int>;using PL=pair<ll,ll>;using vp=vector<P>;
const int INF=1<<30,MOD=1000000007;const ll LINF=1ll<<60;
#define _ol3(_1,_2,_3,name,...) name
#define _rep(i,n) _repi(i,0,n)
#define _repi(i,a,b) for(int i=a,i##_l=(b);i<i##_l;++i)
#define REP(...) _ol3(__VA_ARGS__,_repi,_rep,)(__VA_ARGS__)
#define REPR(i,n) for(int i=n-1;i>=0;--i)
#define REPA(i,v) REP(i,v.size())
#define all(v) (v).begin(),(v).end()
#define bit(n) (1ll<<(n))
#define clamp(n,mi,ma) max(min(n,ma),mi)
#define uniq(v) sort(all(v));v.erase(unique(all(v)),v.end())
#define pb push_back
#define F first
#define S second
#define endl '\n'
#ifndef LOCAL
struct ostdmy{template<class T>ostdmy&operator<<(const T&t){return*this;}};ostdmy cer_;
#define cerr cer_
#endif
#define cho(n,a,b) cout<<((n)?a:b)<<endl
#define YES(n) cho(n,"YES","NO")
#define Yes(n) cho(n,"Yes","No")
#define Poss(n) cho(n,"Possible","Impossible")
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(a>b){a=b;return 1;}return 0;}
template<class T>ostream&operator<<(ostream&o,const vector<T>&v){for(const T&i:v)o<<i<<' ';return o;}
template<class T>istream&operator>>(istream&i,vector<T>&v){for(T&j:v)i>>j;return i;}
template<class T,class U>ostream&operator<<(ostream&o,const pair<T,U>&p){return o<<p.F<<' '<<p.S;}
template<class T,class U>istream&operator>>(istream&i,pair<T,U>&p){return i>>p.F>>p.S;}
template<class T>ostream&operator<<(ostream&o,const set<T>&v){for(const T&i:v)o<<i<<' ';return o;}
int main(){
    cin.tie(0);ios::sync_with_stdio(0);
    string s;cin>>s;
    int mi=INF;
    REP(i,s.size()-2){
        int a=stoi(s.substr(i,3));
        chmin(mi,abs(a-753));
    }
    cout<<mi<<endl;
    return 0;
}


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

int main(void) {
	int N;
	int* a;
	int count = 0;
	cin >> N;
	a = new int[N];
	for (int i = 0; i < N; i++)
		cin >> a[i];

	for (int i = 1; i < N-1; i++) {
		if (a[i - 1] == a[i]) {
			a[i] = a[i + 1] + 1;
			count++;
		}
	}
	if (a[N - 2] == a[N - 1]) {
		a[N - 1] = a[N - 2] + 1;
		count++;
	}
	cout << count << endl;

	return 0;
}

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

using namespace std;
typedef long long int ll;
typedef pair<ll, ll > pi;  
typedef pair<pair<ll, ll >, ll > pii;  
vector<ll > vec;
vector<vector<ll > > vec2;
ll MOD = 1000000007;
ll INF = 11451419194545;

int main(){
    ll A, B; 
    cin >> A >> B;
    ll ans = A * B;

    if(A > 9 || B > 9){
        cout << -1 << endl;
    }else{
        cout << ans << endl;
    }

}

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

signed main() {
  int n,k;
  cin>>n>>k;
  double ans=0;
  for(int i=1;i<=n;i++){
    double d=1.0/n;
    for(int c=i;c<k;c*=2) d*=0.5;
    ans+=d;
  }
  cout<<fixed<<setprecision(10)<<ans<<endl;
}

Measured memory_bytes: 3720
#include <iostream>
#include <vector>
#include <string>
#define input std::cin

using lint = long long int;
using namespace std;

class segtree {
  public:
	vector<int> tree;
	int n;
	segtree (int n) : tree (4*n+1, 0), n (n) {}

	int query (int l, int r, int tl, int tr, int t) {
	  if (l > r)
		return 0;
	  if (l == tl && r == tr)
		return tree[t];
	  int mid = (tl+tr)/2;
	  int left = query (l, min(mid, r), tl, mid, 2*t+1);
	  int right = query (max(mid+1,l), r, mid+1, tr, 2*t+2);
	  return max (left, right);
	}

	int query (int l, int r) {
	  return query (l, r, 0, n-1, 0);
	}

	void set (int i, int v, int tl, int tr, int t) {
	  if (i < tl || i > tr)
		return;
	  if (tl == tr) {
		tree[t] = max(tree[t], v);
		return;
	  }
	  int mid = (tl+tr)/2;
	  set (i, v, tl, mid, 2*t+1);
	  set (i, v, mid+1, tr, 2*t+2);
	  tree[t] = max(tree[2*t+1], tree[2*t+2]);
	}

	void set (int i, int v) {
	  set (i, v, 0, n-1, 0);
	}
};

int main() {
  std::ios_base::sync_with_stdio(0);
  int n, k; input >> n >> k;
  segtree dp (300001);
  for (int i=0; i<n; i++) {
	int num; input >> num;
	int l = max(num-k, 0);
	int r = min(num+k, 300000);
	int q = dp.query (l, r);
	dp.set(num, q+1);
  }
  std::cout << dp.query(0, 300000) << std::endl;
}




Measured memory_bytes: 8020
#include <bits/stdc++.h>
#define ll long long
#define llu unsigned long long
#define ld long double
#define pb push_back
#define mp make_pair
#define MOD 1000000007
#define PI 3.14159265
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define deb(x) cerr << ">> " << #x << " : " << x << "\n"
#define endl '\n'
#define ff first
#define ss second
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) (a * b) / __gcd(a, b)
#define DESYNC ios::sync_with_stdio(0); cin.tie(0);
#define print(a) for(auto x : a) cout << x << " "; cout << endl;

using namespace std;

const ll inf = 1e18 + 42;

const ll M = 998244353;

ll power(ll x, ll y) {
	if (y == 0) return 1;
	if (y & 1) return (x * power(x, y - 1));
	ll t = power(x, y / 2);
	return (t * t);
}

const ll MAX = 1e3 + 5;

// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

void ahShitHereWeGoAgain()
{
	ll a;
	ld b;
	cin >> a >> b;
	cout << (ll)(a * b) << endl;
}

int main()
{
	DESYNC	
	ll t = 1;
	// cin >> t;
	while (t--)
		ahShitHereWeGoAgain();
	return 0;
}



Measured memory_bytes: 3744
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
vector<ll> prime;
void seive(ll n){
    ll i,j;
    bool p[n+5];
    memset(p,true,sizeof(p));
    for(i=2;i*i<=n;i++){
        if(p[i]){
            for(j=i*i;j<=n;j+=i)
                p[j]=false;
        }
    }
    for(i=2;i<=n;i++){
        if(p[i])
            prime.push_back(i);
    }
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    seive(100500);
    ll n;
    cin>>n;
    vector<ll>::iterator it;
    it=lower_bound(prime.begin(),prime.end(),n);
    ll j=it-prime.begin();
    cout<<prime[j]<<endl;
    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)    for(int i=0; i<(n); ++i)
#define REP(i, d, n) for(int i=(d); i<(n); ++i)
#define rrep(i, n)   for(int i=(n-1); i>=0; --i)
#define all(v)       v.begin(), v.end()
#define rall(v)      v.rbegin(), v.rend()
#define int          long long
template<typename T>
using vv  = vector<vector<T>>;
using vi  = vector<int>;
using vvi = vector<vector<int>>;
using P   = pair<int, int>;
using ll  = long long;
constexpr ll INF = 1LL << 60;

signed main(){

    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    rep(i, n){
        cin >> a[i];
    }

    vector<int> b(n+1);
    rep(i, k){
        if(i >= 50){
            break;
        }
        b.assign(n+1, 0);
        rep(j, n){
            int l = max(0LL, j - a[j]);
            int r = min(n, j + a[j] + 1);
            b[l]++;
            b[r]--;
        }
        
        rep(i, n){
            b[i + 1] += b[i];
            a[i] = b[i];
        }
    }

    rep(i, n){
        cout << b[i] << " ";
    }
    cout << endl;

    return 0;
}



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

int main() {
  string S, T, U;
  int A, B;
  cin >> S >> T >> A >> B >> U;
  if (S == U) return cout << A - 1 << " " << B << "\n", 0;
  cout << A << " " << B - 1 << "\n";
}

Measured memory_bytes: 3592
#!/usr/bin/env python3
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


def sum_of_arithmetic_progression(s, d, n):
    return n * (2 * s + (n - 1) * d) // 2


def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


def lcm(a, b):
    g = gcd(a, b)
    return a / g * b


def solve(N):
    o, e = 0, 0
    for i in range(1, N + 1):
        e += i % 2 == 0
        o += i % 2 == 1

    return o / (e + o)


def main():
    N = int(input())
    print(solve(N))


if __name__ == '__main__':
    main()


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

using namespace std;

bool check(string n){
	for(int i = 0; i < 3; ++i){
		if(n[0] != n[i]) return false;
	}
	return true;
}

int main(){
	int N; cin >> N;
	for(int i = N; i <= 999; ++i){
		if(check(to_string(i))){
			cout << i << endl;
			return 0;
		}
	}
}

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

using namespace std;

#define ll long long
int main()
{
    int n,k;
    int p[1005];
    cin >> n >> k;
    for(int i=0; i<n; i++) {
        cin >> p[i];
    }
    
    int ans = 0;
    sort(p,p+n);
    for(int i=0; i<k; i++) ans += p[i];
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3576
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <functional>
#include <array>
#include <map>
#include <queue>
#include <limits.h>
#include <set>
#include <stack>
#include <random>
#include <complex>
#include <unordered_map>
#define rep(i,s,n) for(int i = (s); (n) > i; i++)
#define REP(i,n) rep(i,0,n)
#define RANGE(x,a,b) ((a) <= (x) && (x) < (b))
#define DUPLE(a,b,c,d) (RANGE(a,c,d) || RANGE(b,c,d) || RANGE(c,a,b) || RANGE(d,a,b))
#define INCLU(a,b,c,d) (RANGE(a,c,d) && (b,c,d))
#define PW(x) ((x)*(x))
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MODU 1000000007LL
#define bitcheck(a,b)   ((a >> b) & 1)
#define bitset(a,b)      ( a |= (1 << b))
#define bitunset(a,b)    (a &= ~(1 << b))
#define MP(a,b) make_pair((a),(b))
#define Manh(a,b) (abs((a).first-(b).first) + abs((a).second - ((b).second))
#define pritnf printf
#define scnaf scanf
#define itn int
#define PI 3.141592653589


#define izryt bool
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T &val) {
	std::fill((T*)array, (T*)(array + N), val);
}
pll Dir[8] = { //移動
	{ 0 ,1 },{ -1 ,0 },{ 1 ,0 },{ 0 ,-1 },
	{ 1 ,1 },{ 1 ,-1 },{ -1 ,1 },{ -1 ,-1 }
};

//[a, b)
#define Getsum(ar, a,b) (ar[b] - ar[a])
#define INF 10000000000000000LL

struct Edge {
	ll from, to;
	ll w;
};
typedef vector<vector<Edge>> Graph;

ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}
ll lcm(ll m, ll n)
{
	return m * n / gcd(m, n);
}


signed main(void) {
	string a;
	cin >> a;
	int nex[200021][26] = {};

	Fill(nex, -1);

	int dp[200021] = {}, fr[200021] = {};
	Fill(dp, INT_MAX/2);
	Fill(fr, -1);
	for (int i = a.length() - 2; -1 <= i; i--) {
		memcpy(nex[i], nex[i + 1], sizeof(int)*26);
		nex[i][a[i + 1] - 'a'] = i + 1;
	}
	for (int i = a.length() - 1; 0 <= i; i--) {
		REP(j, 26) {
			if (nex[i][j] != -1) {
				if (dp[i] > dp[nex[i][j]] + 1) {
					dp[i] = dp[nex[i][j]] + 1;
					fr[i] = nex[i][j];
				}
			}
			else if (dp[i] > 1) {
				dp[i] =  1;
				fr[i] = -1;
			}

		}
	}
	int nx[200021];
	memcpy(nx, nex[0], sizeof(int) * 26);

	nx[a[0] - 'a'] = 0;
	int cur, bef = -1,Min = INT_MAX;
	REP(j, 26) {
		if (nx[j] != -1) {
			if (Min > dp[nx[j]] + 1) {
				Min = dp[nx[j]] + 1;
				cur = nx[j];
			}
		}
		else if (Min > 1) {
			Min = 1;
			cur = -1;
		}
	}
	while (cur != -1) {
		printf("%c", a[cur]);
		bef = cur;
		cur = fr[cur];
	}
	REP(i, 26) {
		if (bef >= 0) {
			if (nex[bef][i] == -1) {
				printf("%c",i + 'a');
				break;
			}
		}
		else {
			if (nx[i] == -1) {
				printf("%c", i + 'a');
				break;
			}
		}
	}
	cout << endl;

	return 0;
}



Measured memory_bytes: 23160
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        char[] s = new char[n];
        long[] count = new long[5];
        for (int i = 0; i < n; i++) {
            s[i] = sc.next().charAt(0);
            if (s[i] == 'M') count[0]++;
            if (s[i] == 'A') count[1]++;
            if (s[i] == 'R') count[2]++;
            if (s[i] == 'C') count[3]++;
            if (s[i] == 'H') count[4]++;
        }
        long ans = 0l;
        for (int i = 0; i < 3; i++) {
            for (int j = i + 1; j < 4; j++) {
                for (int k = j + 1; k < 5; k++) {
                    ans += count[i] * count[j] * count[k];
                }
            }
        }
        System.out.println(ans);
    }
}

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

int main() {
	int n, l; cin >> n >> l;
	vector<string> s(n);
	for (int i = 0; i < n; i++) {
		cin >> s[i];
	}

	sort(s.begin(), s.end());

	for (int i = 0; i < n; i++) {
		cout << s[i];
	}
	
	cout << endl;

	return 0;
}

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();
        int bit = 0;
        for(int i=0; i<n; i++){
            bit |= sc.nextInt();
        }
        System.out.println(Integer.numberOfTrailingZeros(bit));
    }
    
}

Measured memory_bytes: 21332
#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>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
using namespace std;
#define FAST_IO                       \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define watch(x) cout << (#x) << " is: " << (x) << endl
#define vw(v)                        \
    cout << (#v) << " is: " << endl; \
    for (long long B : (v))                \
    {                                \
        cout << B << " ";            \
    }                                \
    cout << endl
#define check(x) cout << "here " << (x) << "?" << endl
#define rep(i, a, b) for (long long i = (a); i < (b); i++)
#define per(i, a) for (long long i = (a - 1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define rv(x) (x).rbegin(), (x).rend()
#define pb push_back
long long const MAX = 2147483647, REALMAX = 9223372036854775806;
int main()
{
	FAST_IO
		long long a, b , k , maxi = 0,sum = 0;
	cin >> a >> b;
	k = b;
	rep(i, 0, a - 1) {
		cin >> b;
		if (k >= b) {
			sum++;
		}
		else {
			sum = 0;
		}
		k = b;
		maxi = max(maxi, sum);
	}
	
	cout << maxi;

}

Measured memory_bytes: 256
#include <iostream>
#include <utility>
#include <tuple>
#include <vector>
#include <string>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <algorithm>
#include <functional>
#include <climits>
#include <numeric>
#include <queue>
#include <cmath>
#include <iomanip>
#include <array>
#include <string>
#include <stack>
#include <cassert>
#include <memory>
#include <random>

int main() {
	int n, m, k; std::cin >> n >> m >> k;
	std::vector<long long int> a_books(n), b_books(m);
	for (auto& a : a_books) std::cin >> a;
	for (auto& b : b_books) std::cin >> b;
	a_books.insert(a_books.begin(), 0);
	b_books.insert(b_books.begin(), 0);
	for (auto i = 1; i < a_books.size(); ++i) {
		a_books[i] += a_books[i - 1];
	}
	for (auto i = 1; i < b_books.size(); ++i) {
		b_books[i] += b_books[i - 1];
	}
	int max_count{ 0 };
	for (auto i = 0; i < a_books.size(); ++i) {
		if (a_books[i] > k) break;
		const auto j = std::distance(b_books.begin(), std::prev(std::upper_bound(b_books.begin(), b_books.end(), k - a_books[i])));
		max_count = std::max<long long int>(max_count, i + j);
	}
	std::cout << max_count << '\n';
}

Measured memory_bytes: 8008
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int[] data = new int[10];
		for (int i = 0; i < data.length; i++)
			data[i] = sc.nextInt();

		Arrays.sort(data);
		System.out.println(data[data.length - 1]);
		System.out.println(data[data.length - 2]);
		System.out.println(data[data.length - 3]);

	}

}

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

int main(){

    int n;

    cin >> n;

    int h[n];

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

    int r = 0;
    int flag;



    for(int i=0; i<n;i++){
        flag = 1;
        for(int j=0;j<i;j++){
            if(h[j] > h[i]){
                flag = -1;
            }
        }
        if(flag == 1){
            r++;
        }
    }

    cout << r << endl;




}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

int main(void){
	int n, i, j, f[86400], time[3] = {3600,60,1}, h, m, s, c1, c2, max;
	while(1){
		scanf("%d%*c",&n);
		if(!n)
			break;
		memset(f,0,sizeof(f));
		for(i = 0;i < n;i++){
			scanf("%d%*c%d%*c%d",&h,&m,&s);
			c1 = h * time[0] + m * time[1] + s * time[2];
			scanf("%d%*c%d%*c%d",&h,&m,&s);
			c2 = h * time[0] + m * time[1] + s * time[2];
			for(j = c1;j < c2;j++) f[j]++;
		}
		max = -1;
		for(i = 0;i < 86400;i++)
			if(max < f[i]) max = f[i];
		printf("%d\n",max);
	}
	return 0;
}

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

#define INF 100001

#define MAX 510000
#define MOD 1000000007

typedef long long ll;

int main(void){
  int i,j,n;
  std::cin >> n;
  int a[n];
  for(i=0;i<n;i++){
    std::cin >> a[i];
  }
  int next = 1,ans = 0;
  for(i=0;i<n;i++){
    if(next == a[i]){
      next += 1;
    } else {
      ans += 1;
    }
  }
  if(ans==n){
    std::cout << -1 << std::endl;
    return 0;
  }
  std::cout << ans << std::endl;
  return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <stack>

#define MAX 100
#define WHITE 0
#define GRAY 1
#define BLACK 2

using namespace std;


int adjacencyList[MAX + 1][MAX + 1];
int color[MAX + 1];
int d[MAX + 1];
int f[MAX + 1];
int n;
int timer;



int minWhiteNode(int v)
{

	for (int i = 1; i <= n; i++) {
		if (color[i] == WHITE && adjacencyList[v][i] == 1) {
			return i;
		}
	}
	return 	MAX + 1;
}


void dfs(int o)
{
	stack<int> S;
	int cr;


	S.push(o);
	color[o] = GRAY;
	d[o] = ++timer;

	while (S.size() > 0) 
	{
		cr = minWhiteNode(S.top());
		timer++;

		if (cr != MAX + 1) {
			S.push(cr);
			color[cr] = GRAY;
			d[cr] = timer;
		}
		else {
			int poped = S.top();
			S.pop();
			color[poped] = BLACK;
			f[poped] = timer;
		}
	}
}

int main(void)
{

	int u;
	int k;
	int v;


	cin >> n;

	for (int i = 0; i < n; i++) {
		cin >> u >> k;

		for (int j = 0; j < k; j++) {
			cin >> v;
			adjacencyList[u][v] = 1;
		}

	}

	for (int i = 1; i <= n; i++) {
		if (color[i] == WHITE) {
			dfs(i);
		}
	}

	for (int i = 1; i <= n; i++) {
		cout << i << " " <<d[i] << " " << f[i] << endl;
	}

	return 0;
}

Measured memory_bytes: 3136
#include<bits/stdc++.h>
using namespace std;
int main(){
    int D, N;
    cin >> D >> N;
    if(D == 0){
        if(N == 100){
            cout << N + 1 << endl;
        }
        else{
            cout << N << endl;
        }
    }
    else if(D == 1){
        if(N == 100){
            cout << (N + 1) * 100 << endl;
        }
        else{
            cout << N * 100 << endl;
        }
    }
    else{
        if(N == 100){
            cout << (N + 1) * 10000 << endl;
        }
        else{
            cout << N * 10000 << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 256
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;

void main()
{
    auto ny = readln.split.to!(int[]);
    auto N = ny[0];
    auto Y = ny[1] / 1000;
    foreach (x; 0..N+1) {
        foreach (y; 0..N+1) {
            auto z = N - x - y;
            if (z < 0) break;
            if (10*x + 5*y + z == Y) {
                writefln("%d %d %d", x, y, z);
                return;
            }
        }
    }
    writeln("-1 -1 -1");
}

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

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

using namespace std;

struct UnionFind {
  vector<int> par, rank;

  UnionFind(int n){
    par.resize(n+1);
    fill(par.begin(), par.end(), -1);
    rank.resize(n+1);
  }

  int root(int x){
    if(par[x] < 0){
      return x;
    }

    par[x] = root(par[x]);

    return par[x];
  }

  void unite(int x, int y){
    int rx=root(x);
    int ry=root(y);

    if(rx!=ry){
      if(rank[rx] >= rank[ry]){
        par[ry]=rx;

        if(rank[rx]==rank[ry]){
          rank[rx] += 1;          
        }
      }else{
        par[rx] = ry;
      }
    }
  }

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

int main(){
  int n, m;
  cin>>n>>m;
  vector<int> p;
  rep(i, n){
    int t;
    cin>>t;
    p.push_back(t);
  }
  UnionFind uf(n);

  rep(i, m){
    int x,y;
    cin>>x>>y;
    
    uf.unite(x,y);
  }
  
  int result=0;
  rep(i, n){
    if(uf.same(p[i], i+1))result++;
  }
  
  cout<<result;
  
  return 0;
}


Measured memory_bytes: 1528
#include<stdio.h>
int main(){
  int n,m[10000],i,sum;
  while(1){
    sum=0;
    scanf("%d",&n);
    if(n==0)break;
    for(i=0;i<n/4;i++){
      scanf("%d",&m[i]);
      sum+=m[i];
    }
    printf("%d\n",sum);
  }
  return 0;
}

Measured memory_bytes: 1032
#include <bits/stdc++.h>
 
using namespace std;
 
int dp[105][4][2];
 
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);                                  
  int n, m;
  cin >> n >> m;
  if (n == m) {
    cout << "Yes\n";
  } else {
    cout << "No\n";
  }
  return 0;
}

Measured memory_bytes: 256
// =====================================================
//   File    :   main.cpp
//   Author  :   eezyl
//   Synopsis:   codeforces/atcoder template v2
//   Address :
//   Date    :   2020/09/12
// =====================================================
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef double db;

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

typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<ll> vll;
typedef vector<db> vdb;
typedef vector<string> vs;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<pd> vpd;
typedef vector<vi> vvi;

#define mp make_pair
#define fi first
#define se second
#define sz(x) (int)(x).size()
#define all(x) begin(x), end(x)
#define rall(x) (x).rbegin(), (x).rend()
#define sor(x) sort(all(x))
#define rsz resize
#define ins insert
#define ft front()
#define bk back()
#define pf push_front
#define pb push_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)

const ll INF = 1e18;
const ld PI = acos((ld)-1);
const int d4i[4]={-1, 0, 1, 0}, d4j[4]={0, 1, 0, -1};
const int d8i[8]={-1, -1, 0, 1, 1, 1, 0, -1}, d8j[8]={0, 1, 1, 1, 0, -1, -1, -1};

// TO_STRING
#define ts to_string
string ts(char c) { return string(1,c); }
string ts(const char* s) { return (string)s; }
string ts(string s) { return s; }
string ts(bool b) { return b ? "true" : "false"; }
string ts(vector<bool> v) { string res; F0R(i,sz(v)) res += char('0'+v[i]); return res; }
template<size_t SZ> string ts(bitset<SZ> b) { string res; F0R(i,SZ) res += char('0'+b[i]); return res; }

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
constexpr int pct(int x) { return __builtin_popcount(x); }
constexpr int bits(int x) { return 31-__builtin_clz(x); } // floor(log2(x))

const ll MOD = 1e9+7; // 998244353;
const int MX = 1e5+5;

// BIT
int tree[1];
int sum(int k, int a = 0) {
    while (k >= 1) { a += tree[k]; k -= k&-k; }
    return a; }
void add(int k, int x) {
    while (k <= MX) { tree[k] += x; k += k&-k; }
}

int find(vi& ds, int i) {
    return ds[i] < 0 ? i : ds[i] = find(ds, ds[i]);
}


void solve()
{
    int n;
    cin >> n;
    cout << !n << endl;

}


int main()
{
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//#define LOCAL
#ifdef LOCAL
freopen("data.in", "r", stdin);
while (!feof(stdin)) {
#endif // LOCAL

    int t = 1;
    // cin >> t;
    while (t--) {
        solve();
    }

#ifdef LOCAL
}
printf("Time used = %.2lf\n", (double)clock() / CLOCKS_PER_SEC);
#endif // LOCAL
    return 0;
}


Measured memory_bytes: 3636