akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<long long> vll;
typedef vector<pair<int,int>> vpi;
typedef vector<pair<long long, long long>> vpl;
typedef pair<int,int> pii;
typedef pair<long long, long long> pll;
#define INF (int)(1e9)
#define MAXX 1.1529215e+18
#define inf 999999
#define EPS (1e-7)
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,n) for(int i=1;i<=(int)(n);i++)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define ALL(a)  a.begin(),a.end()
#define RALL(a) a.begin(),a.end(),greater<int>()
#define ROT(a) a.begin(),a.begin()+1,a.end()
#define RROT(a) a.begin(),a.end()-1,a.end()
#define PB push_back
#define MP make_pair
#define PI acos(-1.0)
#define sz(a) a.size()
const ll MOD = 1e9+7;
const int MAX = 10000000;
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
//cout << 'H' << endl;
/*--------------------------------------------*/
int N;

void func(int n, string t, int ch){
    if(n == N){
        cout << t << endl;
        return;
    }
    

    rep(i,ch+1){
        char tmp = char('a' + i);
        int ind = (i == ch?1:0);
        func(n + 1, t + tmp, ch+ind);
    }
}

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

   
    cin >> N;

    string s = "a";

    func(1, s, 1);
}

Measured memory_bytes: 1536
Sa = input()
Sb = input()
Sc = input()

L = [Sa,Sb,Sc]
ABC = ["A","B","C"]
num = 0
while 1:  
  if len(L[num])==0:
    print(ABC[num])
    break
  S = L[num][0]
  L[num] = L[num][1:]
  if S=='a':  
    num=0
  elif S=='b':
    num=1
  else:
    num=2

Measured memory_bytes: 3064
#include "bits/stdc++.h"
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define BUGAVOID(x) x
#define rep(...) BUGAVOID(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define all(c) c.begin(),c.end()
#define mp make_pair
#define write(x) cout<<(x)<<"\n"
using namespace std; typedef long long ll;
typedef vector<int> vi; typedef vector<ll> vll; template<class T>using vv = vector<vector<T>>;
template<class T>vv<T> vvec(size_t n, size_t m, T v) { return vv<T>(n, vector<T>(m, v)); }
template<class T>bool chmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
template<class T>bool chmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
constexpr int INF = 1 << 28, MOD = 1e9 + 7; constexpr ll LINF = 1ll << 60; constexpr double EPS = 1e-6;
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); }; }aaaa;

struct Factorization {
    vector<pair<ll, int>> factors;
    Factorization(ll n) {
        vector<int> primes;
        int sqrt_n = (int)(sqrt(n) + 1e-6);
        vector<bool> isPrime(sqrt_n + 1, true);
        for (int k = 2; k <= sqrt_n; ++k) {
            if (!isPrime[k]) continue;
            primes.emplace_back(k);
            for (int l = k * 2; l <= sqrt_n; l += k) isPrime[l] = false;
        }
        for (int i = 0; i < primes.size() && n > 1;) {
            if (n % primes[i] == 0) {
                n /= primes[i];
                if (!factors.empty() && factors.back().first == primes[i]) factors.back().second++;
                else factors.emplace_back(primes[i], 1);
            }
            else i++;
        }
        if (n > 1) factors.emplace_back(n, 1);
    }
    pair<ll, int>& operator [](int i) { return factors[i]; }
};

ll mpow(ll x, int n) { ll y = 1; for (; n > 0; n /= 2) { y = n % 2 ? y * x % MOD : y; x = x * x % MOD; } return y; }
struct Combination {
    vector<ll> fact, ifact;
    Combination(int n) : fact(n + 1), ifact(n + 1) {
        fact[0] = 1;
        for (int i = 0; i < n; ++i) fact[i + 1] = fact[i] * (i + 1) % MOD;
        ifact[n] = mpow(fact[n], MOD - 2);
        for (int i = n; i > 0; --i) ifact[i - 1] = ifact[i] * i % MOD;
    }
    ll operator()(int n, int k) { return fact[n] * ifact[n - k] % MOD * ifact[k] % MOD; }
};

int main() {
    int N, M;
    cin >> N >> M;

    if (M == 1) {
        write(1); return 0;
    }

    Factorization f(M);
    int n_factor = 0;
    for (const auto& _f : f.factors) n_factor += _f.second;

    Combination c(N + n_factor);
    ll ans = 1;
    for (const auto& _f : f.factors) {
        ans = ans * c(N - 1 + _f.second, _f.second) % MOD;
    }

    write(ans);
}

Measured memory_bytes: 1920
import collections

mat = [map(int,raw_input().split(' ')) for _ in range(3)]
d = {mat[i][j] : (i,j) for i in range(3) for j in range(3)} 
n = int(raw_input())

cols = collections.Counter()
rows = collections.Counter()
ac = collections.Counter()
cc = collections.Counter()
flag = False
for __ in range(n):
	h = d.get(int(raw_input()), None)
	if h is not None:
		i,j = h
		cols[j]+=1
		rows[i]+=1
		if i == j: cc[0]+=1
		if j == 2- i: ac[0]+=1
		
		if (cols[j] == 3) or (rows[i] == 3) or (cc[0] == 3) or (ac[0] == 3):
			flag = True
			break
print 'Yes' if flag else 'No'


Measured memory_bytes: 28524
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var Arr=(input.trim()).split("\n").map(Number);
for(var i=0;i<Arr.length;i++){
   if(Arr[i]==-1)break;
   var n=Arr[i]-2;
   var c=Math.sqrt(2);
   var r=45*Math.PI/180;
   while(n!=0){
      r+=Math.atan2(1,c);
      c=Math.sqrt(c*c+1);
      n--;
   }
   var x=c*Math.cos(r);
   var y=c*Math.sin(r);
   console.log(x.toFixed(2));
   console.log(y.toFixed(2));
}

Measured memory_bytes: 8692
import java.util.Scanner;

	public class Main {

		public static void main(String[] args) {

			Scanner sc = new Scanner(System.in);
			
			int n = sc.nextInt();
			int m = sc.nextInt();
			int[] a = new int[m];
			int sum = 0;
			
			for(int i=0;i<m;i++) {
				a[i]=sc.nextInt();
				sum+=a[i];
			}
			
			if(sum>n) {
				System.out.println(-1);
			}else {
				System.out.println(n-sum);
			}
			
			
		}
	}

Measured memory_bytes: 46184
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <string>
#include <sstream>
#include <algorithm>
#include <random>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <cassert>
#include <climits>
#include <bitset>

#define FOR_LT(i, beg, end) for (int i = beg; i < end; i++)
#define FOR_LE(i, beg, end) for (int i = beg; i <= end; i++)

using namespace std;

bitset<31624> primes;

void create_primes(int n) {
	primes.flip();

	int u_b = sqrt(n + 1);
	{
		for (int j = 4; j <= n; j += 2) {
			primes.reset(j);
		}
	}
	for (int i = 3; i < u_b; i += 2) {
		if (!primes.test(i)) continue;

		for (int j = i * 2; j <= n; j += i) {
			primes.reset(j);
		}
	}
}

int gcd(int a, int b) {
	if (a % b == 0) return b;
	return gcd(b, a % b);
}

int gcd(vector<int>& elems, int n)
{
	int ans = abs(elems[0]);
	FOR_LT(i, 1, n) {
		int val = abs(elems[i]);
		if (val == 0) continue;

		if (val < ans) ans = gcd(ans, val);
		else           ans = gcd(val, ans);
	}
	return ans;
}

int main()
{
	int n; cin >> n;
	vector<int> ns(n + 1);
	int64_t sum = 0;
	for (auto& elem : ns) {
		cin >> elem;
		sum += elem;
	}

	int u_b = max((int)sqrt(abs(ns[n]) + 1), n + 1);
	create_primes(u_b);


	FOR_LE(i, 2, n) {
		if (!primes.test(i)) continue;

		vector<int64_t> sums(i);
		FOR_LT(k, 0, n) {
			sums[(n - k) % (i - 1) + 1] += ns[k];
		}
		sums[0] = ns[n];

		bool is_ok = true;
		FOR_LT(j, 0, i) {
			if (sums[j] % i != 0) {
				is_ok = false;
				break;
			}
		}

		if (is_ok) {
			cout << i << endl;
		}
	}

	int gcd_val = gcd(ns, n + 1);

	vector<int> factors(u_b + 1);
	int f_n = 0;
	int elem = gcd_val;
	FOR_LE(i, 2, u_b) {
		if (!primes.test(i)) continue;
		if (elem % i != 0) continue;

		factors[f_n] = i;
		f_n++;
		do {
			elem /= i;
		} while (elem % i == 0);

		if (elem == 1) break;
	}
	if (elem != 1) {
		factors[f_n] = elem;
		f_n++;
	}

	FOR_LT(i, 0, f_n) {
		if (factors[i] <= n) continue;

		cout << factors[i] << endl;
	}

	return 0;
}

Measured memory_bytes: 384
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors
N = int(input())

list = make_divisors(N)
M = len(list)
if M % 2 == 1:
    ans = (list[-1]-1)* 2
else:
    ans = (list[-1]-1) + (list[-2]-1)
print(ans) 

Measured memory_bytes: 39280
#include <iostream>


using namespace std;


int main(void)
{
    unsigned long long N, M;
    cin >> N >> M;

    if ((N * 2) > M) {
        cout << M / 2 << endl;
        return 0;
    }

    unsigned long long ans;
    ans = N;
    M -= (N * 2);
    ans += (M / 4);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#define _A_ true
using namespace std;

int main(){
  string s;

  cin >> s;
  if((s[0] == 'o' && s[s.length()-1] == 'x') || (s[0] == 'x' && s[s.length()-1] == 'o')){cout << 'o' << endl;
  }
  else if(s[0] == 'o' && s[s.length()-1] == 'o'){
    cout << 'o' << endl;
  }
  else cout << 'x' << endl;

  return 0;
}

Measured memory_bytes: 0
#include <stdio.h>

int main() {
	int n, i, r=0, b=0;
	char s[102];
	scanf("%d %s", &n, s);
	for (i = 0; i < n; i++) {
		if (s[i] == 'R') { r++; }
		else { b++; }
	}

	if (r > b) { printf("Yes"); }
	else { printf("No"); }
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <stdint.h>
#include <algorithm>
#include <vector>


using namespace std;

int main() {
	int n;
	cin >> n;
	
	vector<int> w(n,0);
	int back = 0;
	
	for (int i = 0; i < n; i++) {
		cin >> w.at(i);
		back += w.at(i);
	}
	
	//std::sort(w.begin(),w.end());
	
	
	int tmp = 0;
	int front = 0;
	int ans = 100000;
	int j = 0;
	
	while(back - front > 0){
		front += w.at(j);
		back -= w.at(j);
		tmp = back - front;
		if(std::abs(tmp) < ans) {
			ans = std::abs(tmp);
		}
		
		//dbg
		//cout << "fronr:" << front << ", back:" << back << ", ans:" << ans << endl;
		
		j++;
	}
	
	cout << ans << endl;

	return 0;
}


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

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

signed main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	const int MOD = 998244353;
	
	int A, B, T;
	cin >> A >> B >> T;
	cout << B * (T / A) << endl;

	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long lint;
typedef vector<lint> LIV;
#define rep(i,n) for(int i=0;i<n;++i)
#define MAXN 100010
#define MAXM 1100000
#define all(v) v.begin(),v.end()
#define inf 2147483647
#define linf 1152921504606846976

lint digs(lint a){//各桁の和
	lint re=0;
	while(a)re+=a%10,a/=10;
	return re;
}

int main(){
	lint n;cin>>n;
	lint m=linf;
	rep(i,n-1)m=min(m,digs(i+1)+digs(n-i-1));
	cout<<m<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <cstdlib>
using namespace std;

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

int main()
{
	int hills[10];
	rep(10) cin>>hills[i];

	sort( hills, hills+10, greater<int>() );

	rep(3) cout<<hills[i]<<endl;

	return 0;
}

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

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

Measured memory_bytes: 3612
import java.util.Scanner;

class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int r = sc.nextInt();
		int c = sc.nextInt();
		int s[][] = new int[r][c];
		int cg[] = new int[c];
		int rg;
		int i,j;
		for( i=0; i<r; i++ ){
			for( j=0; j<c; j++ ){
				s[i][j] = sc.nextInt();
			}
		}
		for( j=0; j<c; j++ ){
			cg[j] = 0;
		}
		for( i=0; i<r; i++ ){
			for( j=0, rg=0; j<c; j++ ){
				System.out.print( s[i][j] + " " );
				cg[j] += s[i][j];
				rg += s[i][j];
			}
			System.out.println( rg );
		}
		for( j=0, rg=0; j<c; j++ ){
			System.out.print( cg[j] + " " );
			rg += cg[j];
		}
		System.out.println( rg );
	}
}

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

#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define repi(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define uniqueV(x)          \
  sort(x.begin(), x.end()); \
  x.erase(unique(x.begin(), x.end()), x.end());
#define debug(x) cerr << #x << ": " << x << '\n'
#define debug2(x, y) cerr << "(" << #x << ", " << #y << ") = " \
                          << "(" << x << ", " << y << ")" << '\n'

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

const long long INF = 3e18 + 12;
const int inf = 1e9;

// ----------------------------------------------

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

  int a, b;
  cin >> a >> b;

  a--;
  b--;

  int ans = (b % a == 0 ? int(b / a) : int(b / a) + 1);

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string>
#include <cmath>
#include <sstream>
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FORD(i, a, b) for(int i = (a); i >=(b); i--)
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
typedef long long int ll;
using namespace std;
ll mod1=1000000007;
ll mod2=67280421310721;
ll mod3=998244353;
ll INF=1e18;

ll binpow1(ll a,ll b){
    ll res=1;
    while (b>0){
        if (b&1)
        res=res*a;
        a=a*a;
        b>>=1;
    }
    return res;
}

ll binpow2(ll a,ll b,ll m){
    a%=m;
    ll res=1;
    while (b>0){
        if (b & 1)
        res=res*a%m;
        a=a*a%m;
        b>>=1;
    }
    return res;
}

ll gcd(ll a,ll b){
    if (b==0)
        return a;
    else
        return gcd(b,a%b);
}

map<ll,ll> fact(ll n) {
    map<ll,ll> factorization;ll c=0;
    while (n % 2 == 0) {
        c++;
        n /= 2;
    }
    if(c>0)
    {
        factorization.insert({2,c});
    }c=0;
    for (ll d = 3; d * d <= n; d += 2) {
        while (n % d == 0) {
            c++;
            n /= d;
        }
        if(c>0)
    {
        factorization.insert({d,c});
    }c=0;
    }
    if (n > 1)
       {
           factorization.insert({n,1});
       }
    return factorization;
}

ll func1(ll n, ll r, ll p)
{
    // Optimization for the cases when r is large
    if (r > n - r)
        {r = n - r;}

    // The array C is going to store last row of
    // pascal triangle at the end. And last entry
    // of last row is nCr
    ll C[r + 1];
    memset(C, 0, sizeof(C));

    C[0] = 1; // Top row of Pascal Triangle

    // One by constructs remaining rows of Pascal
    // Triangle from top to bottom
    for (ll i = 1; i <= n; i++) {

        // Fill entries of current row using previous
        // row values
        for (ll j = min(i, r); j > 0; j--)

            // nCj = (n-1)Cj + (n-1)C(j-1);
           {
               C[j] = (C[j] + C[j - 1]) % p;
           }
    }
    return C[r];
}

ll dp[2001];

ll func(ll n)
{
    if(dp[n]!=-1)
    {
        return dp[n];
    }
    ll ans=0;
    if(n>=3)
    {
        ans=1;
    }
    FOR(i,3,n+1)
    {
        ans=ans+(func(n-i)%mod1);
    }
    dp[n]=ans%mod1;
    return dp[n];
}

int main()
{ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
    ll n;
    cin>>n;
    ll ans=3*mod1+binpow2(10LL,n,mod1)-2*binpow2(9LL,n,mod1)+binpow2(8LL,n,mod1);
    cout<<(ans+mod1)%mod1;



	return 0;
}













Measured memory_bytes: 3648
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <string>

#define rep(i, a, b) for ( int i = (a); i < (b); i++ )
#define per(i, a, b) for ( int i = (b)-1; i >= (a); i--)
#define pb push_back
#define mp make_pair
#define bg begin()
#define en end()

using namespace std;

typedef long long ll;

static const long long MOD = 1000000007;

ll x, a, b;
ll ans;

ll f(ll n) {
  if (n == -1) return 0;
  return n/x + 1;

}

int main(void) {
    
    scanf("%lld %lld %lld", &a, &b, &x);
    
    printf("%lld\n", f(b)-f(a-1));
    return 0;
}

Measured memory_bytes: 256
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


def main():
    N, X, *xn = map(int, open(0).read().split())
    ans = abs(X - xn[0])
    for x in xn:
        div = abs(X - x)
        if div % ans:
            ans = gcd(ans, div)
    print(ans)
    return


main()


Measured memory_bytes: 14052
#include<iostream>
#include<iomanip>
//#include<cstdio>
#include<vector>
#include<map>
#include<queue>
#include<algorithm>
#include<cmath>
#include<cassert>
using namespace std;
typedef long long ll;
const int Nmax = 100;
int A[2][Nmax], N;

int main(){
	cin >> N;
	for(int j=0; j<2; j++){
		for(int i=0; i<N; i++){
			cin >> A[j][i];
		}
	}

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

	int ans = x;
	for(int i=1; i<N; i++){
		x += A[0][i] - A[1][i-1];
		ans = max(x, ans);
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
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 main(){
    ll N, M; cin >> N >> M;
    vector<pair<ll, ll>> p(N);
    for(int i=0; i<N; i++){
        ll a, b; cin >> a >> b;
        p[i] = {a, b};
    }
    sort(p.begin(), p.end());

    ll sum = 0;
    ll ans = 0;


    for(int i=0; i<N; i++){
        if(sum + p[i].second < M){
            ans += (ll)p[i].first * p[i].second;
            sum += p[i].second;
        }
        else{
            ans += (ll)p[i].first * (M - sum);
            cout << ans << endl;
            break;
        }
    }
}

Measured memory_bytes: 1792
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;

int main(){
    long long h, n;
    cin >> h >> n;

    vector<pair<long long, long long> > ab(n);
    
    
    for(long long i = 0; i < n; i++) cin >> ab[i].first >> ab[i].second;
    sort(ab.begin(), ab.end());

    vector<long long> dp(h+1, 1e9);
    dp[0] = 0;

    for(long long i = 0; i <= h; i++){
        for(long long j = 0; j < n; j++){
            if(i <= ab[j].first) dp[i] = min(dp[i], ab[j].second);
            else dp[i] = min(dp[i], dp[i-ab[j].first] + ab[j].second);
        }
    }
    cout << dp[h] << endl;
    return 0;
}

Measured memory_bytes: 3708
#include <iostream>
#include <vector>
#include <array>
#include <deque>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>

using namespace std;
using ll=long long int;
using ull=unsigned long long int;

ull en[64][2];

constexpr ull MAX = 1e12;

int main() {
    ull N, K;
    cin >> N >> K;
    vector<ull> A(N);
    for (auto &e: A) cin >> e;

    for (ull i = 0; 1ULL << i <= MAX; ++i) {
        for (auto &&e: A) {
            int b = (~e & (1ULL << i)) >> i;
            en[i][b] += 1ULL << i;
        }
    }

    ull pm = 0, cm = 0;
    for (ull i = 0; 1ULL << i <= MAX; ++i) {
        if (K & (1ULL << i)) {
            cm = max(en[i][0] + pm, en[i][1] + cm);
        } else {
            cm += en[i][0];
        }
        pm += max(en[i][0], en[i][1]);
    }

    cout << cm << endl;

    return 0;
}


Measured memory_bytes: 1024
#!/usr/bin/env python3
import sys
import math

YES = "Yes"  # type: str
NO = "No"  # type: str


def solve(a: int, b: int):
    total = int(str(a) + str(b))
    for i in range(1, total + 1):
        if i * i == total:
            print(YES)
            return
    print(NO)
    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    a = int(next(tokens))  # type: int
    b = int(next(tokens))  # type: int
    solve(a, b)


if __name__ == "__main__":
    main()


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

ll gcd(ll a, ll b){
	while(a){
		//cout << a << " " << b << "---> ";
		swap(a,b%=a);
		//cout << a << " " << b << "\n";
	}
	return b;
	}

int main(){
	ll n,x; 
	cin >> n >> x;
	cout << 3*(n-gcd(n,x));
	return 0;
	}



Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<set>
#include<queue>
#include<cmath>
//#include<bits/stdc++.h>
#define int long long
#define for0(i, n) for(int i = 0; i < (n); i++)
#define for1(i, n) for(int i = 1; i <= (n);i++)
#define mp make_pair
#define all(x) x.begin(),x.end()
#define puts(x) cout << (x) << "\n"
constexpr int mod = 1000000007;
using namespace std;
int input() { int t; cin >> t; return t; }
vector<int>v1, v2;
signed main() {
	int n, k; cin >> n >> k;
	for1(i, n) {
		int t; cin >> t;
		if (t < 0)v1.push_back(t);//-
		else      v2.push_back(t);//+
	}
	sort(all(v1)); sort(all(v2));
	if (n == k || (v2.size() == 0 && k % 2 == 1)) {
		int ans = 1;
		for0(i, v2.size()) { ans *= v2[i]; if (ans >= mod)ans %= mod; }
		for1(i, min((int)v1.size(), k)) { ans *= v1[v1.size() - i]; ans %= mod; }
		if (ans < 0)ans += mod;
		puts(ans);
		return 0;
	}
	int p = k - v2.size(); if (p < 0)p = 0; if (p % 2 == 1)p++;
	while (1) {
		if (p + 2 > v1.size() || p + 2 > k)break;
		else if (v1[p] * v1[p + 1] >= v2[v2.size() - k + p] * v2[v2.size() - k + p + 1])p += 2;
		else break;
	}
	int ans = 1;
	for1(i, k - p) { ans *= v2[v2.size() - i]; if (ans >= mod)ans %= mod; }
	for0(i, p) { ans *= v1[i]; ans %= mod; }
	if (ans < 0)ans += mod;
	puts(ans);
}

Measured memory_bytes: 5408
#include <iostream>
#include <cstdio>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <stack>
#include <utility>
#include <numeric>
#include <algorithm>
#include <functional>
#include <cctype>
#include <complex>
#include <string>
#include <sstream>
#include <cassert>
using namespace std;

//common
// using i32=int;using i64=long long;using ll =i64;
// using uint=unsigned int;using ull=unsigned long long;
// template<typename T> using matrix=vector<vector<T> >;

#define BR "\n"
#define ALL(c) (c).begin(),(c).end()
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define EACH(it,o) for(auto it = (o).begin(); it != (o).end(); ++it)
#define IN(l,v,r) ((l)<=(v) && (v)<(r))

//config
//#undef NDEBUG
//#define INF 1<<30
//#define EPS 1e-8
//const ll MOD =100000007;

//debug
#ifdef NDEBUG
#define DUMP(x)
#define DUMPLN(x)
#define DEBUG(x)
#define DEBUGLN(x)
#define LINE()
#define LINELN()
#define CHECK(exp,act)
#define STOP(e)
#else
#define DUMP(x)  cerr << #x << " = " << (x)
#define DUMPLN(x)  DUMP(x) <<endl
#define DEBUG(x) DUMP(x) << LINE() << " " << __FILE__
#define DEBUGLN(x) DEBUG(x)<<endl
#define LINE()    cerr<< " (L" << __LINE__ << ")"
#define LINELN()    LINE()<<endl
#define CHECK(exp,act)  if(exp!=act){DUMPLN(exp);DEBUGLN(act);}
#define STOP(e)  CHECK(e,true);if(!(e)) exit(1);
#endif

template<class T> inline string toString(const vector<T>& x) {
	stringstream ss;
	REP(i,x.size()){
		if(i!=0)ss<<" ";
		ss<< x[i];
	}
	return ss.str();
}

template<class T> inline string toString(const vector<vector<T> >& map) {
	stringstream ss;
	REP(i,map.size()){
		if(i!=0)ss<<BR;
		ss<< toString(map[i]);
	}
	return ss.str();
}
template<class K,class V>  string toString(map<K,V>& x) {
	string res;stringstream ss;
	for(auto& p:x)ss<< p.first<<":" << p.second<<" ";
	return ss.str();
}

string BITtoString(int bit){
    stringstream ss;
    while(bit!=0){ss<<(bit%2);bit/=2;}
    string res=ss.str();reverse(ALL(res));
    return res;
}

template<typename T,typename V> inline T mod(T v,V MOD){
	return (v%MOD+MOD)%MOD;
}

class Main{
public:
	void run(){
		string ss;cin >> ss;
		REP(i,ss.size())ss[i]=(ss[i]-'A'-3+26)%26+'A';
		
		cout <<ss<<endl;
	}
};
int main(){
  	Main().run();
  	return 0;
 }

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

using namespace std;

typedef long long LL;

int h[100005];

int main()
{
	LL N;
	cin >> N;
	for (int i = 0; i < N; i++)
	{
		int a;
		cin >> a;
		if(a > 0) h[a - 1]++;
		h[a]++;
		h[a + 1]++;
	}
	int max_ = 0;
	for (int i = 0; i < 100005; i++)
	{
		max_ = max(h[i], max_);
	}
	cout << max_ << endl;
	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define len(v) ll(v.size())
#define fi first
#define se second

template <class T>
void cout_vec(const vector<T> &vec){
  for(auto itr:vec) cout<<itr<<' ';
  cout<<endl;
}

typedef pair<ll,ll> P;
const ll mod=1e9+7;
const ll inf=1e15;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s;
  cin>>s;
  if(s.back()=='F') s.push_back('T');
  int x,y,cnt=0,now=0,a,b;
  cin>>x>>y;
  vector<vector<bool>> dp1(8010,vector<bool>(20010,false));
  vector<vector<bool>> dp2(8010,vector<bool>(20010,false));
  dp1[0][10000]=true;
  dp2[0][10000]=true;
  rep(i,len(s)){
    if(s[i]=='F') now++;
    else if(s[i]=='T'){
      cnt++;
      if(cnt==1){
        dp1[cnt][10000+now]=true;
        a=1;
      }else if(cnt%2==0){
        rep(j,20001) dp2[cnt/2][j]=dp2[cnt/2-1][max(0ll,j-now)]|dp2[cnt/2-1][min(20000ll,j+now)];
        b=cnt/2;
      }else{
        rep(j,20001) dp1[cnt/2+1][j]=dp1[cnt/2][max(0ll,j-now)]|dp1[cnt/2][min(20000ll,j+now)];
        a=cnt/2+1;
      }
      now=0;
    }
  }
  if(dp1[a][10000+x] && dp2[b][10000+y]) cout<<"Yes"<<endl;
  else cout<<"No"<<endl; 
}

Measured memory_bytes: 40320
// #pragma GCC optimize("Ofast")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,avx,avx2")
 
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <cassert>
#include <unordered_set>
#include <unordered_map>
#include <set>
#include <map>
#include <queue>
#include <random>
#include <numeric>
#include <time.h>
#include <stack>
#include <bitset>

#define prev asasddlsa
#define rank aljds

#define rep(i, l, r) for (int i = l; i < r; i++)
#define repb(i, r, l) for (int i = r; i >= l; i++)
 
using namespace std;
 
typedef long long ll;
typedef double dbl;
 
template<typename T>
void print(const vector<T>& s){
    for (auto x : s)
        cout << x << " ";
    cout << endl;
}
 
template<class T>   
void print(const T* s, int n){
    for (int i = 0; i < n; i++)
        cout << s[i] << ' ';
    cout << endl;
}

template<class T>
void print(vector<vector<T>> s){
    for (int i = 0; i < s.size(); i++)
        print(s[i]);
}

const int maxn = 2e5 + 7;

int gcd(int a, int b){
    return b > 0 ? gcd(b, a % b) : a;
}

const int mod = 1e9 + 7;

ll power(ll a, int n){
    ll res = 1;
    while (n){
        if (n & 1)
            res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

int solve(){
    int x;
    cin >> x;
    cout << 360 / gcd(360, x) << endl;
    return 0;    
}

int main(){
    srand(time(NULL));
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.precision(10);
    cout << fixed; 
    int t = 1;
    // cin >> t;
    while (t--)
        solve();
    return 0;
}


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

int main() {
	int A, B, X;
	string res = "NO";
	cin >> A >> B >> X;
	
	for (int i = 0; i < B; ++i) {
		if (A + i == X) res = "YES";
	}
	cout << res << endl;
}

Measured memory_bytes: 256
import sys
import re
import math
import collections
import decimal
import bisect
import itertools
import fractions
import functools
import copy
import heapq
import decimal
import statistics
import queue

# import numpy as np

sys.setrecursionlimit(10 ** 9)
INF = 10 ** 16
MOD = 10 ** 9 + 7
# MOD = 998244353

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===

def main():
    n = ni()
    table = [na() for _ in range(n)]

    dp = [0 for _ in range(2 ** n)]
    dp[2 ** n - 1] = 1

    for i in range(2 ** n - 1, 0, -1):
        j = n - bin(i).count("1")
        for j, val in enumerate(table[j]):
            if val:
                if i & 1 << j:
                    tmp = i ^ 1 << j
                    dp[tmp] += dp[i]
                    dp[tmp] %= MOD

    print(dp[0])


if __name__ == '__main__':
    main()


Measured memory_bytes: 214660
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define mod 1000000007
#define all(v)  v.begin(),v.end()
#define pb push_back
#define size(v)  (int) v.size()
#define fast ios_base:: sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL)
ll power_mod(ll a,ll x){if(x==0) return 1;ll y=power_mod(a,x/2);ll ans=(y*y)%mod; if(x%2) ans=(ans*a)%mod;return ans;}
ll inv(ll a){return power_mod(a,mod-2);}
ll power(ll a, ll x){ if(x==0) return 1; ll y= power(a,x/2); ll ans=(y*y); if(x%2) ans*=a; return ans;}




int main()
{
   

   ll a,b;
   cin>>a>>b;

   cout<<max(max(a+a-1,b+b-1),a+b)<<endl;

}




Measured memory_bytes: 256
anslist = []
 
while(1):
    s = input()
    if s == "-":
        for ans in anslist:
            print(ans)
        break
    m = int(input())
    hlist = []
    for _ in range(m):
        h = int(input())
        hlist.append(h)
 
    for h in hlist:
        s = s[h - len(s):] + s[:h]
    anslist.append(s)


Measured memory_bytes: 5596
//
// Created by kuroneko on 2019-08-04.
//

#include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>

using namespace std;

typedef long long ll;

#define INF 1000000000000009LL
#define MOD 1000000007LL

typedef int Weight;
struct Edge {
    int src, dst;
    Weight weight;
    Edge(int src, int dst, Weight weight):src(src), dst(dst), weight(weight) {}
};

typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

typedef vector<Weight> Array;
typedef vector<Array> Matrix;

int main() {
    string s; cin >> s;

    vector<int> ans(int(s.size()));

    vector<int> ch;
    for (int i = 1; i < s.size(); i++) {
        if (s[i] == 'L' && s[i-1] == 'R') ch.push_back(i);
    }

    int tmp = 0, i = 0;
    while (i != ch.size()) {
        while (tmp != s.size()) {
            if (s[tmp] == 'R' && tmp < ch[i]) {
                if ((ch[i] - tmp) % 2 == 0) ans[ch[i]]++;
                else ans[ch[i]-1]++;
            } else if (s[tmp] == 'L' && tmp >= ch[i]){
                if ((tmp - ch[i]) % 2 == 0) ans[ch[i]]++;
                else ans[ch[i]-1]++;
            } else {
                i++;
                break;
            }
            tmp++;
        }
        if (tmp == int(s.size())) break;
    }


    for (int i = 0; i < s.size(); i++) {
        cout << ans[i];
        if (i != int(s.size())-1) cout << " ";
    }
    cout << endl;
    return 0;
}



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


#define mx 1005
#define ll long long 
#define inf 10000000

void IO()
{
  #ifndef ONLINE_JUDGE
  freopen("in.txt","r",stdin);
  freopen("out.txt","w",stdout);
  #endif
}


int ar[mx];
char ch[mx][mx];
int dis[mx][mx];
int m,n,k,ii;

int xx[]={1,-1,0,0};
int yy[]={0,0,1,-1};
int xxx[]={1,-1,2,-2,0,0,0,0,1,2,-1,-2,1,2,-1,-2,-1,-2,1,2,-1,-2,1,2};
int yyy[]={0,0,0,0,1,-1,2,-2,1,2,-1,-2,-1,-2,1,2,-2,-1,2,1,2,1,-2,-1};


bool chk(int x,int y)
{
  if(x>0 && x<=n && y>0 && y<=m && ch[x][y]=='.')return true;
  return false;
}

void bfs(int x,int y)
{

  dis[x][y]=0;
  priority_queue<pair<int,pair<int,int>>>q;
  q.push({0,{x,y}});
  while(!q.empty())
  {
      int val=q.top().first;
      val*=-1;
      x=q.top().second.first;
      y=q.top().second.second;
      q.pop();
      if(dis[x][y]<val)continue;
      for(int i=0;i<4;i++)
      {
         int temx=x+xx[i];
         int temy=y+yy[i];
         if(chk(temx,temy)==false)continue;
         if(dis[temx][temy]>dis[x][y])
         {
           dis[temx][temy]=dis[x][y];
           q.push({-dis[x][y],{temx,temy}});
         }
      }
      for(int i=0;i<24;i++)
      {
         int temx=x+xxx[i];
         int temy=y+yyy[i];
         if(chk(temx,temy)==false)continue;
         if(dis[temx][temy]>dis[x][y]+1)
         {
           dis[temx][temy]=dis[x][y]+1;
           q.push({-dis[x][y],{temx,temy}});
         }
      }
  }
}


void solve()
{
    scanf("%d%d",&n,&m);
    int x,y,st,en;
    scanf("%d%d%d%d",&x,&y,&st,&en);
    for(int i=1;i<=n;i++)scanf("%s",ch[i]+1);
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=m;j++)dis[i][j]=inf;
    }

    if(ch[x][y]=='.')bfs(x,y);
    if(dis[st][en]==inf)printf("-1\n");
    else printf("%d\n",dis[st][en] );
}

int main()
{
  IO();
  int t=1;
  while(t--)
  {
      solve();

   
  }
  return 0;
}


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

int n, r;
string s;

int main()
{
    cin >> n >> s;
    for (int i = 0; i < n; i++)
        if (s[i] == 'R') r++;
    puts((r > n/2) ? "Yes" : "No");
    return 0;
}


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

int n;
bool graph[60][60];
bool vis[60];

void dfs(int x){
    if(vis[x]) return;
    vis[x] = true;
    for(int i = 0; i < n; i++){
        if(graph[x][i]){
            dfs(i);
        }
    }
}


int main(void){
    int m;
    cin >> n >> m;
    pair<ll, ll> path[m];
    rep(i, m){
        cin >> path[i].first >> path[i].second;
        path[i].first--;
        path[i].second--;
        graph[path[i].first][path[i].second] = true;
        graph[path[i].second][path[i].first] = true;
    }

    ll count = 0;
    rep(i, m){
        graph[path[i].first][path[i].second] = false;
        graph[path[i].second][path[i].first] = false;
        for(ll i = 0; i < n; i++) vis[i] = false;
        dfs(0);

        for(int i = 0; i < n; i++){
            if(!vis[i]){
                count++;
                break;
            }
        }
        graph[path[i].first][path[i].second] = true;
        graph[path[i].second][path[i].first] = true;
    }

    cout << count << endl;
    return 0;
}


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

#define LLINF (1LL<<60)
typedef long long ll;

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

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

template<typename T> inline T divrup(T a, T b) { if (a % b) return a/b+1; else return a/b;}

#define dbg_v1(i,V) do{cout<<"-v1----\n";rep(i,V.size())cout<<" "<<i<<"\t:"<<V[i]<<endl;cout<<endl;}while(0)
#define dbg_v2(i,k,V) do{cout<<"-v2----\n";rep(i,V.size()){rep(k,V[0].size())cout<<" "<<V[i][k];cout<<endl;}}while(0)

//C++14 (GCC 5.4.1)
int main() {
    int N;
    cin >>N;

    vector<int> W(N);
    rep(i,N) cin >> W[i];

    vector<int> WE(N+1);
    WE[0]=0;
    repd(i,1,N+1){
        WE[i]=WE[i-1]+W[i-1];
    }
    //-----------------------------------
    int ans=INT_MAX;
    repd(t,1,N){
        chmin(ans,abs(WE[N]-WE[t]*2));
    }

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

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


int main(){

    int n;
    cin >> n;
    vector<int> ap1(n),a(n),am1(n);

    for(int i = 0; i < n; i++){
        cin >> a.at(i);
        ap1[i] = a[i] + 1;
        am1[i] = a[i] - 1;
    }
    map<int,int> ans;
    for(int i = 0; i < n; i++){
        ans[a[i]]++;
        ans[ap1[i]]++;
        ans[am1[i]]++;
    }

    int answer = 0;
    for(int i = 0; i < n; i++){
        if(ans[a[i]] > answer) answer = ans[a[i]];
        if(ans[ap1[i]] > answer) answer = ans[ap1[i]];
        if(ans[am1[i]] > answer) answer = ans[am1[i]];
    }

    cout << answer << endl;

}

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

#define rep(i, N) for (int i = 0; i < N; i++)
#define pb push_back

typedef long long ll;

int main() {
	int N; cin >> N;
    vector<int> a(N);
    rep(i, N) scanf("%d", &a[i]);
    vector<int> X(N + 1);
    vector<ll> S(N + 1);
    rep(i, N) X[i + 1] = X[i] ^ a[i], S[i + 1] = S[i] + a[i];
    ll ans = 0;
    rep(l, N) {
        int lb = l + 1, ub = N + 1;
        while (ub - lb > 1) {
            int mid = (lb + ub) / 2;
            if ((X[mid] ^ X[l]) == (S[mid] - S[l])) lb = mid;
            else ub = mid;
        }
        ans += lb - l;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
#define arep(i,x,n) for(int i=int(x);i<(int)(n);i++)
#define rep(i,n) for(long long i = 0;i < n;++i)
#define pi 3.141592653589793
#define eps 0.00000001
#define INF 1e9+7  
using ll = long long; 
using P=pair<int,int>;
using lP=pair<ll,ll>;
using fP=pair<double,double>;


int main(){
   int n;
   ll k;
   cin>>n>>k;
   vector<P>ab(n);
   rep(i,n)cin>>ab[i].first>>ab[i].second;
   sort(ab.begin(),ab.end());
   P now;
   rep(i,n){
       now=ab[i];
       if(now.second<k)k-=now.second;
       else if(now.second>=k)break;
   }
   cout<<now.first<<endl;
    return 0;
}

Measured memory_bytes: 1152
S['= r'],m[4]['= r'],z,d[4]={0,-2},k,i;f(i){m[k][i]=S[i]+47?0:m[k][i]?:1+f(d[k]-~i);}main(t){for(scanf("%*d%d",d);S[++i-~*d]=~getchar();d[2]=-*d-2);for(;k--?:(z=z<-t?-t:z,t=k=3,--i);)t-=f(i-~*d);printf("%d",z);}

Measured memory_bytes: 78464
n,m = map(int,input().split())
Low = []
Right = []
for i in range(m):
  l,r = map(int,input().split())
  Low.append(l)
  Right.append(r)
if min(Right) < max(Low):
  print(0)
else:
  print(min(Right)- max(Low) + 1)

Measured memory_bytes: 16896
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int A[][] = new int[2][N];
		for(int i = 0; i < N; i++) {
			A[0][i] = sc.nextInt();
			A[1][i] = sc.nextInt();
		}
		double sum = 0;
		for(int i = 0; i <= N-2; i++) {
			for(int j = i+1; j <= N-1; j++) {
				sum += (double)(Math.sqrt(Math.pow(A[0][i]-A[0][j], 2) + Math.pow(A[1][i]-A[1][j], 2)));	
			}
		}
		System.out.println(2*sum/N);
	}

}


Measured memory_bytes: 21844
N = int(input())
a = list(map(int, input().split()))
k = [b >= c for b, c in zip(a[:-1], a[1:])]
cnt = 0
ans = 0
for i in k:
  if i:
    cnt += 1
    if ans < cnt:
      ans = cnt
  else:
    cnt = 0
print(ans)

Measured memory_bytes: 14252
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int a[] = new int[N+1];
		
		a[0] = sc.nextInt();

		int max = a[0];
		int min = a[0];
		long sum = a[0];
		
		for(int i = 1; i < N; i++) {
			a[i] = sc.nextInt();
			sum = sum + a[i];
			
			if(max < a[i]) {
				max = a[i];
			}if(min > a[i]) {
				min = a[i];
			}
			
		}
		
		System.out.printf("%d %d %d\n",min,max,sum);

	}

}



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

int main() {
  int N, T;
  cin >> N >> T;
  vector<ll> t(N);
  cin >> t[0];
  ll ans = 0;
  rep(i, 1, N) {
    cin >> t[i];
    ll diff = t[i] - t[i - 1];
    if (diff <= T) {
      ans += diff;
    } else {
      ans += T;
    }
  };
  ans += T;

  cout << ans << endl;

  return 0;
}


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

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


#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

int dx4[4] = {1,0,-1,0}, dy4[4] = {0,1,0,-1};

int bitCount(int i) {
  i = i - ((i >> 1) & 0x55555555);
  i = (i & 0x33333333) + ((i >> 2) & 0x33333333);
  i = (i + (i >> 4)) & 0x0f0f0f0f;
  i = i + (i >> 8);
  i = i + (i >> 16);
  return i & 0x3f;
}

int log2ceil(int n) {
  --n;
  n |= n >> 16;
  n |= n >> 8;
  n |= n >> 4;
  n |= n >> 2;
  n |= n >> 1;
  return n + 1;
}

int convertBit(int n)
{
    return (1<<n);
}

int main()
{
    int n,ans=0;
    cin>>n;
    vector<int> a(n);
    vector<vector<pii>> xy(n);
    for (int i = 0; i < n; i++)
    {
        cin>>a[i];
        for (int j = 0; j < a[i]; j++)
        {
            int x,y;
            cin>>x>>y;
            x--;
            xy[i].push_back(make_pair(x,y));
        }
    }
    for (int status = 1; status < (1<<n); status++)
    {
        bool ok=true;
        for (int checkPerson = 0; checkPerson < n; checkPerson++)
        {
            int personBit = convertBit(checkPerson);
            if((status & personBit)==0) continue; //usotsuki no baai
            for (int syogenId = 0; syogenId < a[checkPerson]; syogenId++)
            {
                pii syogen = xy[checkPerson][syogenId];
                int syogenX=syogen.first;
                int syogenY=syogen.second;
                int syogenXBit=convertBit(syogenX);
                int syogenTF=(status & syogenXBit);
                if(syogenTF>0) syogenTF=1;
                if(syogenTF!=syogenY)
                {
                    ok=false;
                    break;
                }
            }
            if(ok==false) break;
        }
        if(ok)
        {
            ans=max(ans, bitCount(status));
        }
    }
    
    
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
typedef long long lint;
typedef unsigned int uint;
typedef pair<int, int> pii;
typedef pair<lint, lint> pll;
typedef unsigned long long ulint; 
#define endl '\n'
#define fst first
#define sed second
#define pb push_back
#define rint register int
#define SZ(x) (int((x).size()))
#define all(x) (x).begin(), (x).end()
#define reveal(x) cerr << #x << " = " << (x) << endl
#define rep(it, f, e) for (rint it = (f); it <= (e); ++it)
#define per(it, f, e) for (rint it = (f); it >= (e); --it)
#define repe(it, x) for (auto it = (x).begin(); it != (x).end(); ++it)
const int MAXN = 2e5 + 20;
int a[MAXN], n;
map<int, int> mp;
inline bool check(int mid) {
	mp.clear();
	int tmp = 0;
	if (mid == 1) {
		rep (i, 2, n) {
			if (a[i - 1] >= a[i]) return false;
		}
		return true;
	}
	rep (i, 2, n) if (a[i - 1] >= a[i]) {
		auto it = mp.lower_bound(a[i]);
		mp.erase(it, mp.end());
		++mp[tmp = a[i] - 1];
		while (tmp >= 0 && mp[tmp] >= mid) {
			mp.erase(tmp), ++mp[--tmp];
		}
		if (tmp < 0) return false;
	}
	return true;
}
int main() {
	ios::sync_with_stdio(false);
	cin.tie(NULL), cout.tie(NULL);
	cin >> n;
	rep (i, 1, n) {
		cin >> a[i];
	}
	int l = 1, r = n;
	while (l <= r) {
		int mid = (l + r) >> 1;
		if (check(mid)) {
			r = mid - 1;
		} else {
			l = mid + 1;
		}
	}
	cout << r + 1 << endl;
	return 0;
}

Measured memory_bytes: 1024
#!/usr/bin/env python3
import sys
from math import *
from itertools import *
from collections import *
from functools import *
from heapq import *
try:
    from math import gcd
except Exception:
    from fractions import gcd


def solve(N: int, K: int, t: "List[int]", d: "List[int]"):
    dt = sorted(zip(d, t), reverse=True)

    q0 = []

    acc = 0
    ts = 0
    p = [-1] * (N+1)
    for dd, tt in dt[:K]:
        acc += dd
        v = min(p[tt], dd)
        p[tt] = max(p[tt], dd)
        if 0 < v:
            heappush(q0, (v, tt))
        else:
            ts += 1

    q1 = []
    for dd, tt in dt[K:]:
        heappush(q1, (-dd, tt))

    mmm = acc + ts * ts
    while 0 < len(q1) and 0 < len(q0):
        d1, t1 = heappop(q1)
        if 0 < p[t1]:
            continue
        acc -= d1
        p[t1] = -d1
        ts += 1

        d0, _ = heappop(q0)
        acc -= d0
        mmm = max(mmm, acc + ts * ts)

    return mmm


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    t = [int()] * (N)  # type: "List[int]" 
    d = [int()] * (N)  # type: "List[int]" 
    for i in range(N):
        t[i] = int(next(tokens))
        d[i] = int(next(tokens))
    result = solve(N, K, t, d)
    print(result)

if __name__ == '__main__':
    main()


Measured memory_bytes: 31184
#include <iostream>
#include <stdio.h>
using namespace std;

int main()
{
	int n;

	while (cin >> n, n)
	{
		int table[11][11] = {};

		for (int y = 0; y < n; y++)
		{
			for (int x = 0; x < n; x++)
			{
				cin >> table[x][y];
			}
		}

		for (int y = 0; y < n; y++)
		{
			for (int x = 0; x < n; x++)
			{
				table[n][y] += table[x][y];
			}
		}
		for (int x = 0; x < n; x++)
		{
			for (int y = 0; y < n; y++)
			{
				table[x][n] += table[x][y];
			}
		}
		for (int x = 0; x < n; x++)
		{
			table[n][n] += table[x][n];
		}

		for (int y = 0; y <= n; y++)
		{
			for (int x = 0; x <= n; x++)
			{
				printf("%5d", table[x][y]);
			}
			cout << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 3104
#include<bits/stdc++.h>
using namespace std;
int arr[105];

int main() {
    int n;
    cin>>n;
    for(int i=0; i<n; ++i) {
        cin>>arr[i];
    }
    int minn = INT_MAX;
    for(int i=-100;i<=100;++i) {
        int s = 0;
        for(int j=0;j<n;++j) {
            s+=(arr[j] - i) * (arr[j] - i);
        }
        minn = min(s, minn);
    }
    cout<<minn<<endl;
    return 0;
}


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

int main() {
	// your code goes here
	char a[5],b[5];
	int ans=0;
	cin >> a >> b;
	if(a[0]==b[0]) ans++;
	if(a[1]==b[1]) ans++;
	if(a[2]==b[2]) ans++;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256