akhauriyash/Code-Regression huggingface dataset:
//g++ -std=c++14 test.cpp -o test.out
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <iomanip>
#include <vector>
#include <queue>
#include <map> 
#include <utility>
#include <limits.h>
using namespace std;

int N,K;
string S;

int ans = 0;
 
void solve(){
	int score = 0;
	for(int i=1;i<N;i++){
		if(S[i-1]==S[i]) score++;
	}
	ans = min(score+2*K,N-1);
}
 
int main(){
	cin>>N>>K;
	cin>>S;

	solve();

	cout<<ans;
	return 0;
}

Measured memory_bytes: 512
/*
title:

url:D - Five, Five Everywhere

すべての素数が、５であった時の余りが１であればいい
*/

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <functional>
#include <queue>
#include <limits>
#include <string>
#include <utility>
#include <cstring>
#include <map>
#include <cmath>

using namespace std;

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

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

int main()
{
    int n;
    cin >> n;
    int nmax = 55556;
    bool is_prime[nmax];
    for (int i = 2; i < nmax; i++)
    {
        is_prime[i] = true;
    }
    int count = 0;
    for (int i = 2; i < nmax; i++)
    {
        if (is_prime[i])
        {
            if (i % 5 == 1)
            {
                cout << i << endl;
                count++;
            }
            for (int j = i; j < nmax; j += i)
            {
                is_prime[j] = false;
            }
        }
        if (count == n)
        {
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 256
// codeforces.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <bits/stdc++.h>
using namespace std;
using ll =long long int;
constexpr ll mod = 1e12;
int main()
{
	int n; cin >> n;
	string s, t; cin >> s >> t;
	for (int i = 0; i < n; ++i) {
		cout << s[i] << t[i];
	}
	return 0;
}

// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
// Debug program: F5 or Debug > Start Debugging menu

// Tips for Getting Started: 
//   1. Use the Solution Explorer window to add/manage files
//   2. Use the Team Explorer window to connect to source control
//   3. Use the Output window to see build output and other messages
//   4. Use the Error List window to view errors
//   5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
//   6. In the future, to open this project again, go to File > Open > Project and select the .sln file


Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
int main()
{
	int h, w, white;
	char c;
	bool wb[100][100];
	int notout[100] = {0};
	cin >> h >> w;
	for(int i = 0; i < h; i++){
		white = 0;
		for(int j = 0; j < w; j++){
			cin >> c;
			wb[i][j] = (c == '.' ? 1 : 0);
			white += wb[i][j];
			notout[j] += wb[i][j];
		}
		if(white == w){
			i -= 1;
			h -= 1;
			for(int j = 0; j < w; j++){
				notout[j] -= 1;
			}
		}
	}
	for(int i = 0; i < h; i++){
		
		for(int j = 0; j < w; j++){
			if(notout[j] != h) cout << (wb[i][j] == 1 ? '.' : '#');
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
int main(){
    //input
    int n, m;
    cin >> n >> m;
    vector<int> a;
    for(int i = 0; i < n; ++i){
        int tmp_a;
        cin >> tmp_a;
        a.push_back(tmp_a);
    }
    sort(a.begin(), a.end());
    map<int, int> bc;
    for(int i = 0; i < m; ++i){
        int tmp_b, tmp_c;
        cin >> tmp_b >> tmp_c;
        auto itr = bc.find(tmp_c);
        if(itr == bc.end()){
            bc[tmp_c] = tmp_b;
        }else{
            itr->second += tmp_b;
        }
    }
    bool flag = true;
    int pt = 0;
    for(auto itr = bc.rbegin(); itr != bc.rend(); ++itr){
        int b = itr->second;
        int c = itr->first;
        for(int i = 0; i < b; i++){
            if(a[pt] < c){
                a[pt] = c;
                pt++;
                if(pt == a.size()){
                    flag = false;
                    break;
                }
            }else{
                flag = false;
                break;
            }
        }
        if(!flag){
            break;
        }
    }
    long long sum = 0;
    for(int i = 0; i < n; ++i){
        sum += a[i];
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 5368
#include <stdio.h>
using namespace std;
typedef long long ll;

int main(void) {
  ll i, j, k, n, max = 0, a, b, c, d, ans = 0;
  scanf("%lld", &n);
  for(i = 0; i < n; ++i) {
    scanf("%lld", &a);
    if(max <= a) max = a, ans++;
  }
  printf("%lld", ans);
  return 0;
}

Measured memory_bytes: 128
#include <iostream>

using namespace std;

int main(){
    string S;
    cin >> S;
    for(int i = 0; i < 4; i++){
        int count = 0;
        for(int j = 0; j < 4; j++){
            if(S[i] == S[j]){
                count ++;
            }
        }
        if(count != 2){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

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

typedef long long ll;
const ll INF = 1e9;
const ll INFF = 1e18;
const ll MOD = 1e9 + 7;
const ll MAXN = 1e3;
const double EPS = 1e-9;

bool can[100010];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    can[100] = can[101] = can[102] = can[103] = can[104] = can[105] = 1;
    vector< int > tab = {100,101,102,103,104,105};
    for (int i = 106 ; i <= 100000 ; i++) {
        for (int j = 0 ; j < 6 ; j++)
            can[i] |= can[i - tab[j]];
    }
    int n;
    cin >> n;
    cout << can[n] << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#ifdef DEBUG
  #include "debug.hpp"
#else
  #define DUMP(var)
#endif

using namespace std;
template< class T1, class T2 > inline istream &
operator>>( istream & fin, pair< T1, T2 > & pr )
{ fin >> pr.first >> pr.second; return fin; }
template< class T0, class T1, class T2 > inline istream &
operator>>( istream & fin, tuple< T0, T1, T2 > & t )
{ fin >> get<0>(t) >> get<1>(t) >> get<2>(t); return fin; }
template< class T > inline istream &
operator>>( istream & fin, vector< T > & a ) {
for(auto & u: a) fin >> u; return fin; }
template<class T, size_t n> inline istream &
operator>>( istream & fin, array<T, n> & a ) {
for(auto & u: a) fin >> u; return fin; }
template<class FwdIter> inline auto
dump(FwdIter first, FwdIter last, const char * dlm = " ") -> void {
using value_type = typename iterator_traits<FwdIter>::value_type;
copy(first, last, ostream_iterator<value_type>(cout, dlm)); }
template<typename T> vector<T> & operator--(vector<T> & a)
{ for(auto & i: a) --i; return a; }
/* @@@ ----------------------------------- */


int main(const int /*argc*/, char ** /*argv*/) {
  ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);

  size_t n;
  cin >> n;
  vector<size_t> a(n);
  cin >> a;
  --a;
  vector<size_t> rev(n);
  for (size_t i = 0; i < n; ++i) {
    rev[a[i]] = i;
  }
  reverse(rev.begin(), rev.end());

  set<int> idx;
  idx.insert(-1);
  idx.insert(-2);
  idx.insert(n);
  idx.insert(n + 1);
  int64_t out = 0, val = n;
  for (const int k: rev) {
    auto i = idx.lower_bound(k);
    array<int, 4> xs =
      {*std::prev(i, 2), *std::prev(i, 1), *i, *std::next(i, 1)};
    if (xs[0] == -2) xs[0] = -1;
    if (xs[3] == n + 1) xs[3] = n;

    out += val * (xs[1] - xs[0]) * (xs[2] - k);
    out += val * (k - xs[1]) * (xs[3] - xs[2]);
    idx.insert(k);
    --val;
  }
  cout << out;


  return EXIT_SUCCESS;
}


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

ll max(ll a, ll b, ll c, ll d){
    return max(max(a,b),max(c,d));
}

ll min(ll a, ll b, ll c, ll d){
    return min(min(a,b),min(c,d));
}

ll getmin(ll *Asum, int b, int c, int d, int e){
    return min(Asum[b],Asum[c]-Asum[b],Asum[d]-Asum[c],Asum[e]-Asum[d]);
}
ll getmax(ll *Asum, int b, int c, int d, int e){
    return max(Asum[b],Asum[c]-Asum[b],Asum[d]-Asum[c],Asum[e]-Asum[d]);
}

int main(){
    ll Asum[200001];
    Asum[0]=0;

    int N;
    cin >> N;
    for(int i=1;i<=N;i++){
        ll A;
        cin >> A;
        Asum[i]=Asum[i-1]+A;
    }

    ll ans=INT64_MAX;
    int b[N],d[N];
    
    int e=N;

    int b_cur=1;
    for(int c=2;c<=N-2;c++){
        for(;;b_cur++){
            if(b_cur+1==c || abs(2*Asum[b_cur]-Asum[c])<abs(2*Asum[b_cur+1]-Asum[c])){
                b[c]=b_cur;
                break;
            }
        }
    }

    int d_cur=3;
    for(int c=2;c<=N-2;c++){
        for(d_cur=max(d_cur,c+1);;d_cur++){
            if(d_cur+1==e || abs(Asum[e]-2*Asum[d_cur]+Asum[c])<abs(Asum[e]-2*Asum[d_cur+1]+Asum[c])){
                d[c]=d_cur;
                break;
            }
        }
    }

    for(int c=2;c<=N-2;c++){
        ans=min(ans,getmax(Asum,b[c],c,d[c],e)-getmin(Asum,b[c],c,d[c],e));
    }

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

Measured memory_bytes: 3328
A=int(input())
s=list(range(1,14))
h=list(range(1,14))
c=list(range(1,14))
d=list(range(1,14))

for i in range(A):
    M,N=map(str,input().split())
    N=int(N)
    
    if M=='S':
        s[N-1]=0
    
    if M=='H':
        h[N-1]=0
        
    if M=='C':
        c[N-1]=0
        
    if M=='D':
        d[N-1]=0
        
for j in range(13):
    if s[j]==0:
        pass
    else:
        print('S',s[j])
        
for k in range(13):
    if h[k]==0:
        pass
    else:
        print('H',h[k])
        
for l in range(13):
    if c[l]==0:
        pass
    else:
        print('C',c[l])

for m in range(13):
    if d[m]==0:
        pass
    else:
        print('D',d[m])        


Measured memory_bytes: 5616
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
constexpr int mod=1000000007;
constexpr int mod1=998244353;
vector<int> dx={0,1,0,-1},dy={-1,0,1,0};
bool inside(int y,int x,int h,int w){
	if(y<h && y>=0 && x<w && x>=0) return true;
	return false;
}





int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;cin >> n;
	cout << (n % 2 == 0 ? n : 2 * n) << endl;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
 int H, W;
 for(;;)
 {
  cin >> H >> W;
  if (H == 0 && W == 0) break;
   
  for(int i = 0; i<H; ++i)
  {
    if(i == 0 || i == H-1)
      for(int j=0; j<W; ++j)
        cout << "#";
    else
    {
      cout << "#";
      for(int j=0; j<W-2; ++j)
        cout << ".";
      cout << "#";
    }
    cout << endl;
  }
  cout << endl;
 }
 return 0;
}

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

int dfs(int n,int x[20],int count,int N,int sum){
  if(n==N){
    return abs(sum-(count-sum));
  }else{
    return min(dfs(n,x,count,N+1,sum+x[N]),dfs(n,x,count,N+1,sum));
  }
}

int main(){
  int n;
  int x[20];
  while(1){
    cin >> n;
    if(n==0){
      return 0;
    }
    int count=0;
    for(int i=0;i<n;i++){
      cin >> x[i];
      count += x[i];
    }
    cout << dfs(n,x,count,0,0) <<endl;
  }
}

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

int main()
{
    long long n, k, i, j, h[100009], dp[100009];
    cin >> n >> k;
    for(i = 1; i <= n; i++)
        cin >> h[i];

    dp[1] = 0;
    for(i = 2; i <= n; i++)
    {
        dp[i] = INT_MAX;
        for(j = 1; j <= k && i-j > 0; j++)
            dp[i] = min(dp[i], dp[i-j] + abs(h[i] - h[i-j]));
    }

    cout << dp[n];
}


Measured memory_bytes: 1792
n,d,a = gets.to_s.split.map{|i|i.to_i}
monsters = Array.new(n){ gets.to_s.split.map{|i|i.to_i} } 

monsters.map!{ |xh| xh[1] = (xh[1]+a-1)/a; xh }.sort_by!{ |x,h| x }

deq = []
acc_damage = 0
ans = 0
monsters.each do |x,h|
  
  while deq.size > 0 && deq[0][0] < x do
    acc_damage -= deq[0][1]
    deq.shift
  end
  
  need = h - acc_damage
  
  if need > 0
    acc_damage += need
    ans += need
    deq.push( [x + d*2, need] )
  end
end

puts ans

Measured memory_bytes: 22520
#define _USE_NATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <random>
#include <tuple>


using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
#define EPS 1e-9
const int INF = 1050000000;
const long long LINF = 1LL << 60;
const ll MOD = 1e9 + 7;
const int MINF = -1050000000;

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() {
	
	int n;
	cin >> n;
	vector<int> a(n), b(n);
	rep(i, n) cin >> a[i];
	rep(i, n) cin >> b[i];
	int tmp = 0;
	vector<int> sum(n), down(n);
	vector<int> res;
	sum[0] = a[0];
	for(int i = 1; i < n; i++) {
		sum[i] = a[i] + sum[i - 1];
		
	}
	down[0] = a[0]+b[0];
	for (int i = 1; i < n; i++) {
		down[i] = max(b[i] + down[i - 1], sum[i]+b[i]);
		
	}
	
	cout << down[n - 1] << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

#define N 100000
#define Q 50000

int func(int,int [N],int);
  
int main()
{
  int i,j,n,q;
  int S[N],T[Q];
  int count=0;
  
  scanf("%d",&n);
  for(i=0;i<n;i++)
    {   
      scanf(" %d",&S[i]);
    }
  
  scanf("%d",&q);
  for(i=0;i<q;i++)
    {   
      scanf(" %d",&T[i]);
    }

  for(i=0;i<q;i++)
    {
      count += func(n,S,T[i]);
      //printf("%d:",i);
      //printf("%d\n",count);
    }
  printf("%d\n",count);
  
  return 0;
}

int func(int n,int S[N],int key)
{
  int left=0,mid,right=n;
  while(left<right)
    {
      mid = (left + right)/2;
      if(key>S[n-1]||key<S[0])return 0;
      if(key == S[mid])return 1;
      if(key>S[mid])
	{
	  left = mid+1;
	}
      else if(key<S[mid])
	{
	  right = mid;
	}
    }
  return 0;
}



Measured memory_bytes: 2288
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int N, M;
const ll DIV = 1000000007;
int as[100100];
ll dp[100100];

ll rec(int n) {
    if (0 <= dp[n]) return dp[n];
    if (as[n] == 1) {
        dp[n] = 0;
        return dp[n];
    }
    if (n <= 1) return 1;
    dp[n] = rec(n - 1) + rec(n - 2);
    dp[n] %= DIV;
    return dp[n];
}

void solve() {
    cin >> N >> M;
    for (int i = 0; i < M; ++i) {
        int ai;
        cin >> ai;
        as[ai] = 1;
    }
    for (int i = 0; i < 100100; ++i) dp[i] = -1;
    cout << rec(N) << endl;
}

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


Measured memory_bytes: 4480
/*   _/                _/                 _/_/_/   _/
  _/_/_/_/   _/_/   _/_/_/_/   _/_/    _/       _/_/
   _/     _/    _/   _/     _/    _/  _/_/_/     _/
  _/     _/    _/   _/     _/    _/  _/    _/   _/
   _/_/   _/_/       _/_/   _/_/      _/_/     _/ */
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;
using ll=long long;
const int MOD=1e9+7;
const double pi=3.14159265358979323846;
const int inf=2e9;
const ll INF=1e18;
using P=pair<int,int>;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int main() {
  cin.tie(0),cout.tie(0);
  ios::sync_with_stdio(false);
  int n,ans=0;
  cin >> n;
  for(int i=1; i<=n; i++) {
    if(to_string(i).size()%2) {
      ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 384
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include <cmath>
#include <limits>
#include <utility>
#include <map>
#include <iomanip>
#include <queue>
#include <cctype>
#include <stack>
#include <random>
#include <list>
#include <numeric>
#include <chrono>
#include <set>


#define rep(i,p,q) for(ll i = p;i < q;i++)
#define ll long long

using namespace std;

vector<vector<ll>> graph;
vector<ll> query;
vector<ll> ans;
vector<ll> visited;


const long long MAX_N = 1 << 17;
const long long MOD = 1000000007;

long long dat[2 * MAX_N - 1];

ll fact(ll n) {
	if (n == 1) return 1;
	return n * fact(n - 1);
}

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

//C
int main(void) {
	ll n, k, s;
	cin >> n >> k >> s;
	
	 if (n == k) {
		rep(i, 0, n) {
			if (i < n - 1) cout << s << " ";
			else cout << s << endl;
		}
	 }
	 else if (s == 1) {
		 rep(i, 0, n) {
			 if (i < k) {
				 if (i < n - 1) cout << s << " ";
			 }
			 else {
				 if (i < n - 1) {
					 if (i < n - 1) cout << s+1 << " ";
				 }
				 else cout << s + 1 << endl;
			 }
		 }
	 }
	else {
		ll a, b;
		a = s / 2;
		b = s % 2 == 0 ? a : a + 1;
		swap(a, b);
		rep(i, 0, n) {
			if (i <= k) {
				if(i < n -1)
					cout << (i % 2 == 0 ? a : b) << " ";
				else
					cout << (i % 2 == 0 ? a : b) << endl;
			}
			else if (i < n - 1) {
				if (s < 1e9) cout << s + 1 << " ";
				else cout << s - 1 << " ";
			}
			//i == n-1
			else {
				if (s < 1e9) cout << s + 1 << endl;
				else cout << s - 1 << endl;
			}
		}
	}
}

Measured memory_bytes: 1280
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;

namespace MyProject
{
    class Program
    {
        static void Main(string[] args)
        {
#if Local
            var sw = new Stopwatch();
            sw.Start();
            Console.SetIn(new StreamReader("input.in"));
#endif

            var solver = new Solver();
            solver.Solve();
#if Local
            Console.WriteLine($"{sw.ElapsedMilliseconds}ms");
#endif
        }
    }

    class Solver
    {
        public void Solve()
        {
            var r = int.Parse(Console.ReadLine());
            var answer = Math.Pow(r, 2);

            Console.WriteLine(answer);
        }
    }
}


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

int main() {
  int a1, a2, a3;

  cin >> a1 >> a2 >> a3;

  int sum = a1 + a2 + a3;
  if (sum <= 21) {
    cout << "win" << endl;
  } else {
    cout << "bust" << endl;
  }
  return 0;
}


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

#define fr(i,b,e) for(int i=(b); i<(e); ++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long int li;
typedef long long ll;
const int INF=1000000;


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


    cout << (n*(n-1)+m*(m-1))/2 << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <tuple>
#include <vector>

using namespace std;
typedef long long int ll;
typedef vector<int> vi;
typedef vector<vi> vvi;

#define INF (1e9)

int N, K, Q;

int main() {
    cin >> N >> K >> Q;

    vi A(N, K - Q);
    int a;
    for (int i = 0; i < Q; i++) {
        cin >> a;
        A[a - 1]++;
    }

    for (int i = 0; i < N; i++) {
        if (A[i] > 0)
            cout << "Yes" << endl;
        else
            cout << "No" << endl;
    }
    return 0;
}


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

int main() {
  int64_t Q;
  cin >> Q;
  for (int64_t i = 1; i <= Q; ++i) {
    int64_t A, B, worst;
    cin >> A >> B;
    if (A > B) swap(A, B);
    int64_t takahashi = A * B;
    int64_t C = floor(sqrt(takahashi));
    if (C * C == takahashi) {
      if (A == B) {
        worst = 2 * (C - 1);
      } else {
        worst = 2 * (C - 1) - 1;
      }
    } else {
      if (C * (C + 1) >= takahashi) {
        worst = 2 * (C - 1) + 1 - 1;
      } else {
        worst = 2 * C - 1;
      }
    }
    cout << worst << endl;
  }
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner(System.in);
		int k = sc.nextInt(), a = sc.nextInt(), b= sc.nextInt();
		if((b/k - a/k >= 1 || a%k == 0 || b%k == 0 )&&(b >= k)) {
			System.out.println("OK");
		}else {
			System.out.println("NG");
		}
	}

	static class FastScanner {
		private BufferedReader reader = null;
	    private StringTokenizer tokenizer = null;
	    public FastScanner(InputStream in) {
	        reader = new BufferedReader(new InputStreamReader(in));
	        tokenizer = null;
	    }

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

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

	        return tokenizer.nextToken("\n");
	    }

	    public long nextLong() {
	        return Long.parseLong(next());
	    }

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

	    public double nextDouble() {
	         return Double.parseDouble(next());
	     }

	    public int[] nextIntArray(int n) {
	        int[] a = new int[n];
	        for (int i = 0; i < n; i++)
	            a[i] = nextInt();
	        return a;
	    }

	    public long[] nextLongArray(int n) {
	        long[] a = new long[n];
	        for (int i = 0; i < n; i++)
	            a[i] = nextLong();
	        return a;
	    }
	}
}


Measured memory_bytes: 32724
n = int(input())
t,a= map(int,input().split())
h = list(map(int,input().split()))
tp = 1
near = abs(t-h[0]*0.006 - a)
for i in range(1,n):
    if abs(t-h[i] * 0.006 - a) < near:
        near = abs(t-h[i] * 0.006 - a)
        tp = i+1
print(tp)
    


Measured memory_bytes: 9128
# Enter your code here. Read input from STDIN. Print output to STDOUT

import numpy as np
from sys import stdin


def get_result(data):
    cnt = 0
    quotient = data
    while quotient > 1:
        quotient = quotient // 2
        cnt += 1
    return 2**(cnt+1) - 1

if __name__ == '__main__':
    data = int(stdin.readline())
    result = get_result(data)
    print(result)


Measured memory_bytes: 21396
def div(arr, n):
    s = dict()


    max_ele = -10 ** 9
    for i in range(n):
        s[arr[i]] = 1

        max_ele = max(max_ele, arr[i])

    res = dict()
    for i in range(n):

        if (arr[i] != 0):

            for j in range(arr[i] * 2,max_ele + 1, arr[i]):

                if (j in s.keys()):
                    res[j] = 1
    return res


n = int(input())
a = list(map(int, input().split()))

b=[]
t=0
c=div(a,n)
for i in range(len(a)):
        if a[i] not in c:
            b.append(a[i])
d={}
for i in b:
        if i in d:
            d[i]+=1
        else:
            d[i]=1
for key,val in d.items():
        if val==1:
            t+=1
print(t)

Measured memory_bytes: 156624
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#include<cmath>

#define REP(i,n) for (int i = 0; (i) < (n); ++ (i))
#define FOR(i,n) for (int i = 1; (i) <= (n); ++ (i))
#define dump(x)  cout << #x << " = " << (x) << endl;
#define pb push_back
#define int long long

const int INF = 1e18;
const int MOD = 1e9+7;
//const lint LINF = 1e18;
const double eps = 0.000000001;//もとの値の10^(-16)まで

using namespace std;

//typedef pair<int, int> P;
//priority_queue< P, vector<P>, greater<P> > q;//ダイクストラの時、greaterで小さい順
//cout << fixed << setprecision(10) << ans << endl;
//int gcd(int a,int b){return b?gcd(b,a%b):a;}

signed main(){
    string s;
    cin >> s;
    char k = s[s.size()-1];
    if(k=='3'){
        cout << "bon" << endl;
    }
    else if(k=='0' || k=='1' ||k=='6' ||k=='8' ){
        cout << "pon" << endl;
    }
    else{
         cout << "hon" << endl;
    }
    
    return 0;
}

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

int main(){
    int he;
    int wi;
    
    while(1){
        cin >> he >> wi;
    if(he == 0 && wi == 0) break;
        for (int j = 0; j < he; j++){
            for (int i = 0; i < wi; i++){
                if (0 < i && i < (wi - 1) && 0 < j && j < (he - 1)){
                    cout << "." ;
                } else {
                cout << "#" ;
                }
            }
            cout << endl;
        }
        cout << endl;
    }
}


Measured memory_bytes: 3100
#include <iostream>
#include <string>
#include <vector>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <stack>
#include <map>
#include <set>
#include <ios>
#include <cctype>
#include <cstdio>

#define REP(i,a) for(int i = 0;i < (a);++i)
#define FOR(i,a,b) for(int i = (a);i < (b); ++i)
#define FORR(i,a,b) for(int i = (b) - 1;i >=a;--i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SIZE(obj) (int)(obj).size()
#define MAX(list) std::max(list)
#define MIN(list) std::min(list)
#define YESNO(cond,yes,no){cout <<((cond)?(yes):(no))<<endl; }
#define SORT(list) sort(ALL((list)));
#define RSORT(list) sort((list).rbegin(),(list).rend())

using namespace std;

template<typename T>
T round_up(const T& a, const T& b) {
    return (a + (b - 1)) / b;
}

template <typename T1, typename T2>
istream& operator>>(istream& is, pair<T1, T2>& p) {
    is >> p.first >> p.second;
    return is;
}

template <typename T1, typename T2>
ostream& operator<<(ostream& os, pair<T1, T2>& p) {
    os << p.first << p.second;
    return os;
}

template <typename T>
istream& operator>>(istream& is, vector<T>& v) {
    REP(i, (int)v.size())is >> v[i];
    return is;
}

template <typename T>
ostream& operator<<(ostream& os, vector<T>& v) {
    REP(i, (int)v.size())os << v[i] << endl;
    return os;
}


using ll = long long;
ll mod = 1'000'000'007;

const int INF = 1'050'000'000;

int clamp(int n, int a, int b) {
    if (n < a)n = a;
    if (n > b)n = b;
    return n;
}

ll gcd(ll a, ll b) {
    ll v0 = a, v1 = b, v2 = a % b;
    while (v2 != 0) {
        v0 = v1;
        v1 = v2;
        v2 = v0 % v1;
    };
    return v1;
}

ll lcm(ll a, ll b) {
    return a * b / gcd(a, b);
}


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

    ll W, H;
    ll X, Y;
    cin >> W >> H >> X >> Y;
    cout << W / 2.0 * H << endl;
    if (X * 2 == W && Y * 2 == H) {
        cout << 1 << endl;
    }
    else {
        cout << 0 << endl;
    }

    return 0;

}

Measured memory_bytes: 256
n,k = map(int,input().split())

L = n
res = 0
while(1):
    if(L == 0):
        if(k==(n+1)):
            res += 1
        break
    bar = (n-L) + (((1<<(L+2))-3)>>1) + 1
#    print(str(L)+" "+str(k)+" "+str(bar)+" "+str(res))
    if k < bar:
        L -= 1  
    elif k == bar:
        res += (1<<L)
        break 
    else:
        res += (1<<L)
        
        k -= ((1<<(L+1)) -2)
        if(k == bar):
            k -= 1
        L -= 1
print(res)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,m,n) for(int i=m;i<n;i++)
ll mod=1e9+7;


int main(){
  int n;
  cin>>n;
  int a[n];
  rep(i,0,n){
    cin>>a[i];
  }
  int b[n];
  rep(i,0,n){
    b[i]=a[i]+i+1;
  }
  int c[n];
  rep(i,0,n){
    c[i]=-a[i]+i+1;
  }
  map<int,int> m;
  ll ans=0;
  rep(i,0,n-1){
    ans+=m[b[n-2-i]];
    m[c[n-1-i]]++;
  }
  cout<<ans<<endl;
}

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

using namespace std;

using ll = long long;
using ld = long double;

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

    int n, m;
    cin >> n >> m;

    vector<vector<int>> s(m);
    for (int i = 0, k; i < m; ++i) {
        cin >> k;
        s[i].resize(k);
        for (int j = 0; j < k; ++j) {
            cin >> s[i][j];
            --s[i][j];
        }
    }

    vector<int> p(m);
    for (int i = 0; i < m; ++i) cin >> p[i];

    ll sum = 0;
    for (int x = 0; x < 1 << n; ++x) {
        int num = 0;
        for (int i = 0; i < m; ++i) {
            int sum_m = 0;
            for (size_t j = 0; j < s[i].size(); ++j) {
                if (x >> s[i][j] & 1) ++sum_m;
            }
            if (sum_m % 2 == p[i]) ++num;
        }
        if (num == m) ++sum;
    }

    cout << sum << endl;

    return 0;
}


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

#ifndef LOCAL_
#define fprintf if( false ) fprintf
#endif // LOCAL_
#define dump() fprintf(stderr, "#%s.%d\n", __func__, __LINE__);
#define dumpl(x1) fprintf(stderr, "#%s.%d (%s) = (%ld)\n", __func__, __LINE__, #x1, x1);
#define dumpll(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%ld, %ld)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define dumplll(x1, x2, x3) fprintf(stderr, "#%s.%d (%s, %s, %s) = (%ld, %ld, %ld)\n", __func__, __LINE__, #x1, #x2, #x3, x1, x2, x3);
#define dumpd(x1) fprintf(stderr, "#%s.%d (%s) = (%lf)\n", __func__, __LINE__, #x1, x1);
#define dumpdd(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%lf, %lf)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define loop for(;;)
typedef int64_t Int;
typedef std::vector<Int> LI;
const double pi = 3.14159265358979323846264338;
const Int mod = 1000000007;

template<typename T> void scan1(T& x) { fprintf(stderr, "unknown type\n"); }
template<> void scan1(Int& x) { if( scanf("%" PRId64, &x) < 0 ) exit(0); }
template<> void scan1(std::string& x) { if( not ( std::cin >> x ) ) exit(0); }
template<> void scan1(LI& xs) { for(Int &x : xs) scan1(x); }
void scan() {}
template<typename Head, typename... Tail>
void scan(Head& x, Tail&... xs) {
  scan1(x); scan(xs...);
}

template<typename T>
struct Maybe {
   T x;
   bool valid;
   Maybe() : valid(false) {}
   Maybe(T x_) : x(x_), valid(true) {}
   operator T() const {
      assert( valid );
      return x;
   }
};

struct Solver {
   Solver() { fprintf(stderr, "--------Solver begin--------\n"); }
   ~Solver() { fprintf(stderr, "--------Solver end--------\n"); }
   void solve() {
      Int n, k; scan(n, k);
      Int xs[16];
      xs[0] = 1;
      for(Int i = 1; i < 16; ++i) {
         xs[i] = std::min(xs[i-1] * 2, xs[i-1] + k);
      }
      printf("%ld\n", xs[n]);
   }
};

int main() {
   loop std::unique_ptr<Solver>(new Solver())->solve();
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
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; }
const long long INF = 1LL << 60;
const int INT_INF = 1LL << 30;

int tosec(string S){
  int h = stoi(S.substr(0, 2));
  int m = stoi(S.substr(3, 2));
  int s = stoi(S.substr(6, 2));
  return h * 3600 + m * 60 + s;
}

int main(){
while(true){
  int n;
  cin >> n;
  if(n == 0) break;
  map<int, int> ma;
  vector<P> imos(0);
  for(int i = 0; i < n; i++){
    string s1, s2;
    cin >> s1 >> s2;
    int start = tosec(s1), goal = tosec(s2);

    if(!ma.count(start)){
      ma[start] = imos.size();
      imos.push_back(P(start, 1));
    }
    else imos.at(ma.at(start)).second++;

    if(!ma.count(goal)){
      ma[goal] = imos.size();
      imos.push_back(P(goal, -1));
    }
    else imos.at(ma.at(goal)).second--;
  }

  sort(ALL(imos));
  
  int ans = 0;
  for(int i = 1; i < imos.size(); i++){
    imos.at(i).second += imos.at(i-1).second;
    chmax(ans, imos.at(i).second);
  }
  cout << ans << endl;
}
}


Measured memory_bytes: 3960
#include <iostream>
using namespace std;
#define ll long long
#define fastio ios_base::sync_with_stdio(0); cin.tie(0), cout.tie(0)
const ll mod = 10e9 + 7;
int main()
{
    fastio;
    string S,T; cin>>S>>T;
	int ans=T.size();
	for(int i=0; i+T.size()<=S.size(); i++) {
		int c=0;
		for (int j=0; j<T.size(); j++) c += S[i+j] != T[j];
		if (ans>c) ans=c;
	}
	cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3644
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <functional>

struct State {
	int y, x;
	int cost;

	bool operator > (const State& rhs) const {
		return cost > rhs.cost;
	}
};

int main() {
	int h, w;
	std::cin >> h >> w;

	std::vector<std::string> field(h);
	for (auto&& s : field)
		std::cin >> s;

	std::priority_queue<State, std::vector<State>, std::greater<>> pq;
	std::vector<std::vector<int>> costs(h, std::vector<int>(w, -1));

	pq.push({ 0, 0, (field[0][0] == '.' ? 0 : 1) });
	while (!pq.empty()) {
		auto t = pq.top();
		pq.pop();

		if (costs[t.y][t.x] != -1)
			continue;

		costs[t.y][t.x] = t.cost;
		if (t.y == h - 1 && t.x == w - 1)
			break;

		constexpr int delta[] = {0, 1, 0};
		for (int i = 0; i < 2; ++i) {
			int ny = t.y + delta[i], nx = t.x + delta[i + 1];

			if (ny >= h || nx >= w)
				continue;

			if (costs[ny][nx] == -1) {
				char c = field[ny][nx];
				pq.push({ ny, nx, t.cost + (c != field[t.y][t.x] && c != '.' ? 1 : 0) });
			}
		}
	}

	std::cout << costs[h - 1][w - 1] << std::endl;
}

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(reverse=True)
    return divisors


N, M = map(int, input().split())
for d in make_divisors(M):
    if d * N <= M:
        break
print(d)

Measured memory_bytes: 3064
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

const ll INF = 1000000000000000000LL;

int n;
vector<ll> a;
vector<ll> prefSums;

ll getPrefSum(int l, int r)
{
	ll valL = l == 0 ? 0 : prefSums[l - 1];
	ll valR = prefSums[r];
	return valR - valL;
}

ll calcDiff(int l, int m, int r)
{
	return abs(getPrefSum(l, m) - getPrefSum(m + 1, r));
}

int ternarySearch(int l_, int r_)
{
	int l = l_, r = r_ - 1;
	while (r - l >= 3)
	{
		int m1 = l + (r - l) / 3;
		int m2 = r - (r - l) / 3;
		if (calcDiff(l_, m1, r_) > calcDiff(l_, m2, r_))
			l = m1;
		else
			r = m2;
	}
	ll minRes = 2 * INF;
	int minI = 0;
	for (int i = l; i <= r; i++)
	{
		ll res = calcDiff(l_, i, r_);
		if (res < minRes)
		{
			minRes = res;
			minI = i;
		}
	}
	return minI;
}

int main()
{
	ios::sync_with_stdio(false);
	cin >> n;
	a.resize(n);
	prefSums.resize(n);
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
		if (i != 0)
			prefSums[i] = prefSums[i - 1];
		prefSums[i] += a[i];
	}
	ll result = INF;
	for (int i = 2; i < n - 1; i++)
	{
		int t1 = ternarySearch(0, i - 1);
		int t2 = ternarySearch(i, n - 1);
		ll sum1 = getPrefSum(0, t1), sum2 = getPrefSum(t1 + 1, i - 1);
		ll sum3 = getPrefSum(i, t2), sum4 = getPrefSum(t2 + 1, n - 1);
		ll maxSum = max(max(sum1, sum2), max(sum3, sum4));
		ll minSum = min(min(sum1, sum2), min(sum3, sum4));
		result = min(result, maxSum - minSum);
	}
	cout << result << endl;
}

Measured memory_bytes: 3456
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAX = 1e5 + 5;
ll N, A[MAX];

bool check(int x){
    unordered_map<ll, ll> mp;
    ll piv = 0, sum = 1, ret = 0;
    mp[0] = 1;
    for(int i = 0; i < N; i++){
        if(A[i] >= x){
            piv++;
            sum += mp[piv];
        }
        else{
            sum -= mp[piv];
            piv--;
        }
        ret += sum;
        mp[piv]++;  sum++;
    }
    return (2LL * ret < N * (N + 1) / 2);
}

int main(){
    scanf("%lld", &N);
    for(int i = 0; i < N; i++){
        scanf("%lld", A + i);
    }
    if(N == 1){
        cout <<A[0] <<endl;
        return 0;
    }
    //sort(vt.begin(), vt.end());
    //vt.erase(unique(vt.begin(), vt.end()), vt.end());
    ll l = 0, r = 1e10 + 5;
    while(l < r){
        int mid = (l + r) / 2;
        if(check(mid)){
            r = mid;
        }
        else{
            l = mid + 1;
        }
    }
    cout << l - 1<< endl;
    return 0;
}


Measured memory_bytes: 5192
#include <stdio.h>

int main(void){
  char s1[11],s2[11],s3[11];
  
  scanf("%s %s %s",s1,s2,s3);
  
  printf("%c%c%c\n",s1[0]-32,s2[0]-32,s3[0]-32);
  
  return 0;
}


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

using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using LL = long long;
using VL = vector<LL>;
using VVL = vector<VL>;
using PLL = pair<LL, LL>;
using VS = vector<string>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

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

#define FF first
#define SS second

#define DUMP(x) cout<<#x<<":"<<(x)<<endl
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class T>
istream& operator>>(istream& is, vector<T>& xs){
  for(auto& x: xs)
	is >> x;
  return is;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
ostream& operator<<(ostream& os, const vector<T>& xs){
  for(unsigned int i=0;i<xs.size();++i)
	os << (i?" ":"") << xs[i];
  return os;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}


const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;

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

  string s;
  cin >> s;

  if(SZ(s) < 26){
	cout << s;
	REP(c,26)
	  if(!count(ALL(s), 'a'+c)){
		cout << (char)(c+'a');
		break;
	  }
	cout << endl;
  }
  else{
	if(s == "zyxwvutsrqponmlkjihgfedcba"){
	  cout << -1 << endl;
	}
	else{
	  for(int i=25;i>=0;--i){
		++s[i];
		if(s[i] == 'z'+1){
		  ;
		}
		else if(!count(begin(s), begin(s)+i, s[i])){
		  cout << s.substr(0, i+1) << endl;
		  break;
		}
		else
		  ++i;
	  }
	}
  }

  return 0;
}


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

void price(){
  int sum = 700;
  string s;
  cin >> s;
  if (s[0]=='o') sum += 100;
  if (s[1]=='o') sum += 100;
  if (s[2]=='o') sum += 100;
  cout << sum << endl;
}

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

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
    // AtCoder Beginner Contest 124
	// https://atcoder.jp/contests/abc124/tasks
  public static void main(String[] args) {
    FastReader sc = new FastReader();
	int n = sc.nextInt();
	long[] clocks = new long[n];
	long res = 1;

	for (int i = 0; i < n; i++) {
	  clocks[i] = sc.nextLong();
	}
		
	if (n == 1) {
	  System.out.println(clocks[0]);
	  System.exit(0);
	}
	res = clocks[0]/gcd(clocks[0], clocks[1])*clocks[1];
	for (int i = 2; i < n; i++) {
		res = res/gcd(res, clocks[i])*clocks[i];
	}
	
	System.out.println(res);
	
  }
  private static long gcd(long m, long n) {
	  if (m < n) { return gcd(n, m); }
	  if (n == 0) { return m; }
	  return gcd(n, m % n);
  }
  
  static class FastReader {
    BufferedReader br;
    StringTokenizer st;

    public FastReader() {
      br = new BufferedReader(new InputStreamReader(System.in));
    }
  
    String next() { 
      while (st == null || !st.hasMoreElements()) {
        try {
          st = new StringTokenizer(br.readLine());
        } catch (IOException  e) {
          e.printStackTrace();
        }
      }
      return st.nextToken();
    }

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

    long nextLong() {
      return Long.parseLong(next());
    }

    double nextDouble() { 
      return Double.parseDouble(next());
    }

    String nextLine() {
      String str = "";
        try{
            str = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return str;
      }
  }
}


Measured memory_bytes: 22740
#include<iostream>
using namespace std;
int main(){
	int n,i,max,a[100000],p,q,pre;
	while(cin>>n,n){
		i=0;
		max=-1000000000;
		while(i!=n)
			cin>>a[i++];
		for(p=0;p<n;p++){
			pre=0;
			for(q=p;q<n;q++){
				pre+=a[q];
				if(pre>max)
					max=pre;
			}
		}
		cout<<max<<endl;
	}
	return 0;
}

Measured memory_bytes: 0
//For higher stack size use g++ -O2 -std=c++11 -Wall -Wl,--stack=268435456 a.cpp -o a.exe in cmd
    #include <bits/stdc++.h>
    #include <cstdio>
    #include <cstring>
    #include <cmath>
    #include <cstring>
    #include <chrono>
    #include <complex>
    #define ll long long
    #define ld long double
    #define vi vector<int>
    #define vll vector<ll>
    #define vvi vector < vi >
    #define pii pair<int,int>
    #define pll pair<long long, long long>
    #define mod 1000000007
    #define inf 1000000000000000001;
    #define all(c) c.begin(),c.end()
    #define mp(x,y) make_pair(x,y)
    #define mem(a,val) memset(a,val,sizeof(a))
    #define eb emplace_back
    #define pb push_back
    #define f first
    #define s second
    
    using namespace std;
    int main()
    {
        std::ios::sync_with_stdio(false);
        int T;
        T=1;
        // cin.ignore(); must be there when using getline(cin, s)
        while(T--)
        {
            int n,i,j,ans=0;
            cin>>n;
            ll ar[n+1];
            for(i=1;i<=n;++i)
                cin>>ar[i];
            int st=1;
            for(i=2;i<=n;++i)
            {
                if(ar[i]>ar[i-1])
                {

                    ans=max(ans,i-st);
                    st=i;
                }
            }
            //cout<<i<<" "<<st<<endl;
            ans=max(ans,i-st);
            st=i;
            cout<<ans-1<<endl;
        }
        return 0;
    }


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

#define int long long

#define ii pair<int,int>
#define fi first
#define sc second

#define all(x) (x).begin(),(x).end()

signed main() {
#ifdef _DEBUG
  // freopen("in" , "r", stdin );
#endif
  ios::sync_with_stdio(0); cin.tie(0);
  int n, d, x;
  cin >> n >> d >> x;
  int ans = 0;
  for (int i = 0; i < n; i++) {
    int t; cin >> t;
    ans += (d - 1) / t + 1;
  }
  cout << ans + x << '\n';
}


Measured memory_bytes: 3652
import sys
L = []
bingo = set()
Numbers = []
testor = 0
for i in range(3):
  a,b,c = map(int,input().split())
  L.append((a,b,c)) #00 10 20/ 01 11 21/ 02 12 22/00 11 22/ 20 11 02/
N = int(input())
for i in range(3):
  a = L[0][i] 
  b = L[1][i]
  c = L[2][i]
  L.append((a,b,c))
a = L[0][0]
b = L[1][1]
c = L[2][2]
L.append((a,b,c))
a = L[2][0] 
b = L[1][1]
c = L[0][2]
L.append((a,b,c))
for i in range(N):
  Numbers.append(int(input()))
for i in range(8): #8 bingos pattern
  bingo = L[i]
  for k in range(N):
    if Numbers[k] in bingo:
      testor += 1
    if testor == 3:
        print('Yes')
        sys.exit(0)
  testor = 0
print('No')

Measured memory_bytes: 3064
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();
      
      System.out.println((n * (n - 1) + m * (m - 1)) / 2);
    }
}

Measured memory_bytes: 21332
#include<iostream> 
#include<vector> 
#include<algorithm> 
using namespace std; 
#define lld long long int
#define X 1000000007
#define fast();  ios_base::sync_with_stdio(false); cin.tie(0);
# define rec(i,n) for(int i=0;i<n;i++) 
#define w(t) int t; cin>>t; while(t--)
int h,w; 
char a[1000][1000]; 
lld dp[1000][1000]; 
lld count(int i,int j) 
{ 
  if( j==w || i==h) 
   return 0; 
  if(i==(h-1) && j==(w-1))
    return 1; 
  if(a[i][j]=='#')
    return 0; 
 if(dp[i][j]!=-1) 
    return dp[i][j]; 
  dp[i][j]=( count(i+1,j)+count(i,j+1))%X; 
    return dp[i][j]; 
}
int main()
{
    fast(); 
     cin>>h>>w; 
     rec(i,h) 
       rec(j,w) 
          { dp[i][j]=-1; 
          cin>>a[i][j]; 
          }
      lld ans=count(0,0); 
      cout<<ans<<endl; 
	return 0;
}

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

int n, pos;
vector<int> pre, in, post;

void rec(int l, int r) {
	if(l == r) return;
	int root = pre[pos++];
	int m = distance(in.begin(), find(in.begin(), in.end(), root));
	rec(l, m);
	rec(m+1, r);
	post.push_back(root);
}

void solve() {
	pos = 0;
	rec(0, pre.size());
	for(int i = 0; i < n; i++) {
		if(i) cout << " ";
		cout << post[i]; 
	}
	cout << endl;
}

int main() {
	int k;
	cin >> n;
	
	for(int i = 0; i < n; i++) {
		cin >> k;
		pre.push_back(k);
	}
	
	for(int i = 0; i < n; i++) {
		cin >> k;
		in.push_back(k);
	}
	
	solve();
    
	return 0;	
}

Measured memory_bytes: 3144
package main

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

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

// Arithmetic
func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

func ceil(a, b int) int {
	if a%b == 0 {
		return a / b
	} else {
		return a/b + 1
	}
}

// Sort
type RuneSlice []rune

func (a RuneSlice) Len() int           { return len(a) }
func (a RuneSlice) Less(i, j int) bool { return a[i] < a[j] }
func (a RuneSlice) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

// Main
func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	c := sc.nextStr()

	fmt.Fprintln(wtr, string(rune(c[0]+1)))
	wtr.Flush()
}


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

const int N=2e5+20;

int n,x,y;
vector <int> v1,v2;

int main()
{
	scanf("%d",&n);
	while(n--)
	{
		scanf("%d%d",&x,&y);
		v1.push_back(x+y);
		v2.push_back(x-y);
	}

	sort(v1.begin(),v1.end());
	sort(v2.begin(),v2.end());
	printf("%d",max(v1.back()-v1.front(),v2.back()-v2.front()));
}

Measured memory_bytes: 5064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const long long INF = 1LL<<60;

ll GCD(ll x,ll y){
    if(y == 0) return x;
    else return GCD(y,x%y);
}

ll LCM(ll a,ll b){
    return a / GCD(a,b) * b;
}

const int MOD = 1000000007;



int main() {
    ll n,a,b; cin >> n >> a >> b;
    ll ans1 = n/(a+b) * a;
    if(n%(a+b) <= a) {
        ans1 += n%(a+b);
    }else{
        ans1 += a;
    }
    cout << ans1;
}


Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;

int main(){
  string s;
  cin >> s;
  int N = s.size() + 1;
  vector<ll> right(N, 0), left(N, 0);
  for(int i = 0; i < N; i++){
    if(s[i] == '<'){
      right[i + 1] = right[i] + 1;
    }
  }
  for(int i = N - 1; i >= 0; i--){
    if(s[i] == '>'){
      left[i] = left[i + 1] + 1;
    }
  }
  ll ans = 0;
  for(int i = 0; i < N; i++){
    ans += max(left[i], right[i]);
  }
  cout << ans << endl;
}
  

Measured memory_bytes: 8708