akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define ALL(v) ((v).begin(),(v).end())
#define COUT(x) cout<<(x)<<"\n"

vector<int>prime_number;
 
void prime(ll n){
    ll r = sqrt(n);
    for(ll i=2;i<r+1;i++){
        while(n%i==0){
            n /= i;
            prime_number.push_back(i);
        }
    }
    if(n>1)prime_number.push_back(n);
}

int main(){
    ll n; cin >> n;
    prime(n);
    vector<ll> vec(100);
    vec[0]=1;
    REP(i,99){
        vec[i+1] = vec[i]+1; 
    }
    map<ll,int> map1;
    for(int x:prime_number){
        map1[x]++;
    }
    int count=0;
    for(const auto x:map1){
        int num = x.second;
        int i=0;
        while(1){
            if(num>=vec[i]){
                count++;
                num-=vec[i];
                i++;
            }
            else break;
        }
    }
    COUT(count);
    return 0;
}

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

typedef struct node *link;
struct node{
  int key;
  link le,ri,pa;
};
link head;

void insert(int a);
void inorder(link h);
void preorder(link h);

int main(){
  int m,k;
  char op[10];
  int i;

  head=NULL;
  scanf("%d",&m);
  for(i=0;i<m;i++){
    scanf("%s",op);
    if(strcmp(op,"insert")==0){
      scanf("%d",&k);
      insert(k);
    }else if(strcmp(op,"print")==0){
      inorder(head);
      printf("\n");
      preorder(head);
      printf("\n");
    }
  }

  return 0;
}

void insert(int a){
  link x,y,z;
  z=malloc(sizeof(struct node));
  z->key=a; z->le=NULL; z->ri=NULL;
  y=NULL;  x=head;
  while(x!=NULL){
    y=x;
    if(z->key<x->key)   x=x->le;
    else                x=x->ri;
  }
  z->pa=y;

  if(y==NULL)             head=z;
  else if(z->key<y->key)  y->le=z;
  else                    y->ri=z;
}

void inorder(link h){
  if(h==NULL) return;
  inorder(h->le);
  printf(" %d",h->key);
  inorder(h->ri);
}

void preorder(link h){
  if(h==NULL) return;
  printf(" %d",h->key);
  preorder(h->le);
  preorder(h->ri);
}



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

using namespace std;

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

#define REP(i, n) for(int i=0; i<(n); ++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 DEBUG(x) cout<<#x<<": "<<(x)<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

template<typename T> inline void CHMAX(T& a, const T b) {if(a<b) a=b;}
template<typename T> inline void CHMIN(T& a, const T b) {if(a>b) a=b;}

constexpr ll MOD=1000000007ll;
// constexpr ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-11;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	// cout<<setprecision(10)<<fixed;
	int x, a;
	cin>>x>>a;
	cout<<(x<a ? 0 : 10)<<'\n';
	return 0;
}


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

typedef long ELEM;

#define N 100  //スタックの大きさ

ELEM stack[N]; //スタックの定義
int n;

//スタックの初期化
void init()
{
  n = 0;
}

//スタックにデータをつむ
void push(ELEM x)
{
  stack[n++] = x;
}

//スタックからデータを下す
ELEM pop()
{
  if(n <= 0);
  return stack[--n];
}

//スタックが空かどうかを調べる。
//空なら１、空でなければ０を返す。
int empty()
{
  return n == 0;
}

//逆ポーランド電卓プログラム

main()
{
  int c;
  long x,a,b;

  init();
  while((c = getchar()) != EOF){
    if(isdigit(c)) {
      ungetc(c,stdin);
      scanf("%ld",&x);
      push(x);
    } else {
      switch (c) {
      case '+':
	b = pop(); a = pop();
	push(a + b);
	break;
      case '-':
	b = pop(); a = pop();
	push(a - b);
	break;
      case '*':
	b = pop(); a = pop();
	push(a * b);
	break;
      case '/':
	b = pop(); a = pop();
	push(a / b);
	break;
      case '\n':
	if(! empty())
	  printf("%ld\n",pop());
	init();
	break;
      case ' ':
      case '\t':
	//何もしないで読み飛ばす
	break;
      default:
	printf("不正な文字がありました。\n");
	printf("入力しなおしてください。\n");
	while((c = getchar()) != EOF && c != '\n')
	  ;
	break;
      }
    }
  }
  return 0;
}

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

int main() {
    vector<int> a(9);
    rep(i,9) cin >> a[i];
    int n;
    cin >> n;
    vector<bool> ans(9,false);
    rep(i,n) {
        int b;
        cin >> b;
        rep(i,9) {
            if(b == a[i])  ans[i] = true;
        }
    }
    bool flag = false;
    rep(i,3) {
        if(ans[i] && ans[i+3] && ans[i+6]) flag = true;
        if(ans[i*3] && ans[i*3+1] && ans[i*3+2]) flag = true;
    }
    if(ans[0] && ans[4] && ans[8]) flag = true;
    if(ans[2] && ans[4] && ans[6] ) flag = true;
    if(flag) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

int main() {
  string weather;
  cin >> weather;
  
  if (weather == "RRR") cout << "3" << endl;
  else if (weather == "RRS" || weather == "SRR") cout << "2" << endl;
  else if (weather == "SSS") cout << "0" << endl;
  else cout << "1" << endl;
  
}

Measured memory_bytes: 3556
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define Clear(a) a = decltype(a)();
typedef long long ll;
typedef pair<int,int> p;
typedef pair<ll,ll> pl;
//const ll big=998244353;
const ll big=1000000007;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
ll max(ll x,ll y){
if(x>y)return x;
else return y;
}
ll min(ll x,ll y){
if(x<y)return x;
else return y;
}
ll expm(ll x,ll y){
    if(y==0)return 1;//0^0=1
    if(x==1||x==0)return x;
    if(y%2==1)return (expm(x,y-1)*x)%big;
    ll t=expm(x,y/2);
    return (t*t)%big;
}
ll exp(ll x,ll y){
    if(y==0)return 1;//0^0=1
    if(x==1||y==0)return x;
    if(y%2==1)return exp(x,y-1)*x;
    ll t=exp(x,y/2);
    return t*t;
}
ll inv(ll x){
    return expm(x,big-2);
}

void dfs(vector<ll> &ans,vector<vector<pl>> &graph,int now,int last){
    for(auto t:graph[now]){
        if(t.first==last)continue;
        ans[t.first]=ans[now]+t.second;
        dfs(ans,graph,t.first,now);
    }
    return;
}

int main(){
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    cout << fixed << setprecision(10);
    /*--------------------------------*/
    
    int n;cin >> n;
    vector<vector<pl>> graph(n);
    rep(i,n-1){
        ll a,b,c;cin >> a >> b >> c;a--;b--;
        graph[a].push_back(p(b,c));
        graph[b].push_back(p(a,c));
    }
    int q,k;cin >> q >> k;k--;
    vector<p> in(q);
    rep(i,q){
        int x,y;cin >> x >> y;x--;y--;
        in[i].first=x;in[i].second=y;
    }
    vector<ll> ans(n);
    ans[k]=0;
    dfs(ans,graph,k,-1);
    rep(i,q){
        cout << ans[in[i].first]+ans[in[i].second] << '\n';
    }
}

Measured memory_bytes: 19444
# 入力
N = gets.to_i
S = gets.chomp!
str = []
str = S.split("")

#RGBそれぞれ数える
r,g,b = 0,0,0
str.each do |c|
  if c=='R'
    r = r + 1
  end
  if c=='G'
    g = g + 1
  end
  if c=='B'
    b = b + 1
  end
end

ans = 0
# 1つめの条件を満たす組の数を代入
ans = r*g*b

# 1つめの条件を満たすもののうち、
# 2つめの条件k != 2j-iを満た"さない"ものを求める
# → ans = ans - 2つ目の条件だけ満たさないものの数
k = 0
N.times do |i|
  (i+1).upto(N) do |j|
    k = 2*j - i # これを満たすとき、条件2を満たさない
    if k <= N-1
      if (S[i]!=S[j] && S[j]!=S[k] && S[k]!=S[i]) # これを満たすとき、条件1を満たす
        ans = ans - 1
      end
    end
  end
end

puts ans

Measured memory_bytes: 14648
#include <iostream>
#include <sstream>
#include <algorithm>
#include <cstring>
#include <tuple>
#include <vector>
#include <map>
#include <iterator>
#include <cmath>

using namespace std;
using lint = long long int;

int main() {
	int a, b;
	cin >> a >> b;

	cout << max(max(a + b, a - b), a * b);

	return 0;
}

Measured memory_bytes: 256
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_map>
#include<list>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
typedef pair<double,ll> pdl;
#define F first
#define S second
#define MK make_pair
const ll E=1e18+7;
const ll MOD=1000000007;

ll bit_count(ll a){
    ll ret=0;
    for(ll i=0;i<63;i++){
        if(a>>i&1){ret++;}
    }
    return ret;
}



int main(){
    ll n,k;
    cin>>n>>k;
    ll key=1<<n;
    key--;
    vector<pair<ll,vector<ll>>> v;
    for(;key>=0;key--){
        if(bit_count(key)==k){
            vector<ll> a;
            ll s=0;
            for(int i=0;i<n;i++){
                if(key>>i&1){
                    a.push_back(i);
                    s=s|i;
                }
            }
            v.push_back({key,a});
        }
    }
    sort(v.begin(),v.end());
    for(int i=0;i<v.size();i++){
        cout<<v[i].F<<":";
        for(int t=0;t<v[i].S.size();t++){
            cout<<" "<<v[i].S[t];
        }
        cout<<endl;
    }
    
    
    
    return 0;
}



Measured memory_bytes: 8644
#include<stdio.h>
int main(){
    int n,x,i,j,count=0;
    do{
        scanf("%d%d", &n, &x);
        if((n|x)==0)break;
        for(i=1;i<(double)x/3;i++)for(j=i+1;j<=n;j++){
            if((x-(i+j)<=n)&&(x-(i+2*j)>0)){
                count++;
            }else if(x-(i+j)<j)break;
        }
        printf("%d\n", count);
        count=0;
    }while((n|x)!=0);
    return 0;
}

Measured memory_bytes: 1780
#pragma GCC optimize ("O3")
// #pragma GCC target ("avx")
#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>

#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define NDEBUG
#define eprintf(...) do {} while (0)
#endif
#include<cassert>

using namespace std;

typedef long long LL;
typedef vector<int> VI;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define EACH(i,c) for(__typeof((c).begin()) i=(c).begin(),i##_end=(c).end();i!=i##_end;++i)

template<class T> inline void amin(T &x, const T &y) { if (y<x) x=y; }
template<class T> inline void amax(T &x, const T &y) { if (x<y) x=y; }
template<class Iter> void rprintf(const char *fmt, Iter begin, Iter end) {
    for (bool sp=0; begin!=end; ++begin) { if (sp) putchar(' '); else sp = true; printf(fmt, *begin); }
    putchar('\n');
}

int N;
char S[1000011];
int H[1000011];

int ans;
void solve(int height) {
    int cur = 0;
    int mi = 0;
    int ma = 0;
    REP (i, N) {
	if (S[i] == '0') cur--;
	else if (S[i] == '1') cur++;
	else {
	    if (cur + 1 <= height && cur + 1 + H[i+1] <= height) {
		cur++;
	    } else {
		cur--;
	    }
	}

	amin(mi, cur);
	amax(ma, cur);
    }

    amin(ans, ma - mi);
}

void MAIN() {
    scanf("%s", S);
    N = strlen(S);

    ans = 1<<29;

    solve(0);
    REP (a, 2) {
	REP (b, 2) {
	    int cur = 0;
	    int ma = 0;
	    for (int i=N; i--;) {
		if (S[i] == '1') cur--;
		else cur++;
		amax(ma, cur);
		H[i] = ma - cur;
	    }

	    int height = max(0, *max_element(H, H+N));
	    for (int d=-10; d<=10; d++) {
		if (0 <= height + d) solve(height + d);
	    }

	    reverse(S, S+N);
	}
	REP (i, N) if (S[i] != '?') S[i] ^= 1;
    }

    printf("%d\n", ans);
}

int main() {
    int TC = 1;
//    scanf("%d", &TC);
    REP (tc, TC) MAIN();
    return 0;
}



Measured memory_bytes: 8708
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cstring>
#include<cmath>
#include <numeric>
#include<queue>
#include<climits>
#include<cstdio>


#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
//#define INF ((LLONG_MAX) / (2))
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
typedef long long int ll;
typedef pair<ll,int> LL_IP;
#define INF 1e9+7

int gcd(int x,int y){

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

}


int main(){

    int n,k;
    int maxi = -INF;
    cin >> n >> k;
    vector<int> arr(n);
    REP(i,n){
        cin >> arr[i];
        maxi = max(maxi,arr[i]);
    }
    
   
    int tmp = arr[0];
    for(int i = 0;i < n;i++){
        tmp = gcd(tmp,arr[i]);
    }

    if(k%tmp == 0 && k <= maxi){
        cout << "POSSIBLE" << endl;
    }else{
        cout << "IMPOSSIBLE" << endl;
    }



    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <deque>
#include <map>
const int MOD = 1e9+7;
typedef long long ll;
using namespace std;

ll llmax(ll x, ll y){
	if (x > y) return x;
	return y;
}

int main(){
	ll a, b, n;
	cin >> a >> b >> n;
	if (b == 1){
		cout << 0 << endl;
		return 0;
	}

	ll ans = 0;

	if (b-1 > n){
		cout << a*n/b << endl;
		return 0;
	}

	for (ll i = b-1; i <= n; i+=b){
		ll one = a*i/b;
		ll two = i/b;
		ans = llmax(ans, one - a*two);
	}
	cout << ans << endl;
	return 0;
}

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

using namespace std;

const int N=1e6+3;

const double eps=0.000000001;

#define pb push_back
#define all(x) (x).begin(),(x).end()
typedef long long ll;

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

const int inf=1e9,mod=1e9+7;

int n,m,a[N],b[N],k,q,u,v,x,y,tc,c,l,r,ans;

char s[N];

void IO(){
	ios::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	#ifndef ONLINE_JUDGE
		freopen("test.txt","r",stdin);
	#endif
}

int main(){
	//IO();
	scanf("%d%d",&n,&k);
	for(int i=0;i<n;i++)
		scanf("%d",&a[i]);
	double ans=0;
	double curr=0;
	for(int i=0;i<n;i++){
		for(int j=1;j<=a[i];j++)
			curr+= (double)j/a[i];
		if (i>=k-1){
			if (i>k-1)
				for(int j=1;j<=a[i-k];j++)
					curr-=(double)j/a[i-k];
			ans=max(ans,curr);
		}
	}
	printf("%.9lf\n",ans);
}


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

mod = 998244353
N, S = map(int, input().split())
A = list(map(int, input().split()))
ans = 0
dp = [0] * (S+1)
for i in range(1, N+1):
    a = A[i-1]
    for j in range(a+1, S+1)[::-1]:
        dp[j] += dp[j-a]
    if a <= S:
        dp[a] += i
    ans += dp[S] * (N-i+1)
    ans %= mod
    dp[S] = 0
print(ans)

Measured memory_bytes: 66652
#include <bits/stdc++.h>
#define ll int64_t
#include <cstdlib> 
#include <math.h>
#include<cstdio>
#include<cstring>
#define FOR(I, A, B) for (ll I = (A); I <= (B); I++)
#define fo(i,n) for(ll i=0;i<n;i++)
#define sz(a) ll((a).size())
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define dbg(x) cout << #x << " = " << x << endl
#define dbg2(x,y) cout << #x << " = " << x << ", " << #y << " = " << y << endl
#define dbg3(x,y,z) cout << #x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << endl
#define dbg4(x,y,z,q) cout << #x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << ", " << #q << " = " << q << endl
#define scan(char_array) scanf("%[^\n]s",&char_array)
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;

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


const ll MOD=1e9l+7;

ll Power(ll base , ll e)
{
    if(e == 0) return 1;
    ll ans = base; e--;
    while(e)
  {
        if(e & 1) ans = (((ans%MOD) * (base%MOD)) %MOD+MOD)%MOD;
        base = (((base%MOD) * (base%MOD)) %MOD+MOD)%MOD;
        e >>= 1;
  }
  return (ans+MOD) %MOD;
}

int main(){
	ll n;
	cin>>n;
	ll aa,bb;
	map<pair<ll,ll>,pair<ll,ll>> mp;
	ll zerr=0;
	fo(i,n){
		cin>>aa>>bb;

		//dbg2(aa,bb);
        if(aa==0&&bb==0) zerr++;

        else if(aa==0) mp[{1,0}].first++;

        else if(bb==0) mp[{1,0}].second++;

		else if((aa<0)&&(bb<0)){
			ll h1=abs(bb);
			ll h2=abs(aa);
			ll h3=gcd(h1,h2);
			h1=h1/h3;
			h2=h2/h3;
			mp[{h2,h1}].first++;

		}



		else if((aa<0)||(bb<0)){
			ll h1=abs(bb);
			ll h2=abs(aa);
			ll h3=gcd(h1,h2);
			h1=h1/h3;
			h2=h2/h3;

			mp[{h1,h2}].second++;
			//dbg3(aa,bb,"nee");
		}
		else{
			ll h1=abs(bb);
			ll h2=abs(aa);
			ll h3=gcd(h1,h2);
			h1=h1/h3;
			h2=h2/h3;
			mp[{h2,h1}].first++;
			//dbg2(aa,bb);
		}


	}
	ll aans=1;
	for(auto pp:mp){
		auto t=pp.second;
		aans=((aans%MOD)*(Power(2,t.first)+Power(2,t.second)-1+MOD)%MOD)%MOD;
	}
	aans=(aans+zerr)%MOD;
	aans=(aans-1+MOD)%MOD;
	cout<<aans<<endl;

    

  

}

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

y = 0
L = []
for i in range(10):
    for j in range(10):
        L = []
        # print(i,j,k)
        c = str(i)
        p = 0
        l = 0
        while l < N:
            if p == 0 and S[l] == c:
                c = str(j)
                p = 1
            elif p == 1 and S[l] == c:
                p = 2
            elif p == 2 and S[l] not in L:
                L.append(S[l])
            l += 1
        y += len(L)
print(y)

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

int main() {
	string tmp; bool a = true, b = false, c = false;
	while (cin >> tmp) {
		if ((tmp[0] == 'A'&&tmp[2] == 'B') || (tmp[0] == 'B'&&tmp[2] == 'A')) {
			bool tmp = a;
			a = b;
			b = tmp;
		}
		else if ((tmp[0] == 'A'&&tmp[2] == 'C') || (tmp[0] == 'C'&&tmp[2] == 'A')) {
			bool tmp = a;
			a = c;
			c = tmp;
		}
		else if ((tmp[0] == 'B'&&tmp[2] == 'C') || (tmp[0] == 'C'&&tmp[2] == 'B')) {
			bool tmp = b;
			b = c;
			c = tmp;
		}
	}
	if (a)cout << "A\n";
	else if (b)cout << "B\n";
	else if (c)cout << "C\n";
}


Measured memory_bytes: 3068
l=[int(input())]
flg=True
cnt=1
while flg:
  n=l[-1]
  if n%2==0:
    a=n//2
  else:
    a=n*3+1
  if a in l:
    flg=False
    print(cnt+1)
  else:
    l.append(a)
    cnt+=1

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

using namespace std;

#define INF 100000000
#define YJ 1145141919
#define INF_INT_MAX 2147483647
#define INF_LL_MAX 9223372036854775807
#define EPS 1e-10
#define Pi 1
#define LL long long
#define ULL unsigned long long
#define LD long double

using namespace std;

#define MAX_N 100005

int N;
int A[MAX_N];

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

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

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <iomanip>
#include <stack>
#include <array>
#include <deque>
#include <forward_list>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <algorithm>
#include <iterator>
#include <string>
#include <cstring>
//#include <fstream>
#include <complex>
#define _USE_MATH_DEFINES
#include <cmath>
#include <math.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=n;i>0;i--)
#define arep(a,i,n) for(int i=(a);i<(n);i++)
#define SORT(v) sort((v).begin(),(v).end())
const ll INF = (1LL << 50);
typedef pair<int, int> P;

int main() {

	int n;
	cin >> n;

	vector<pair<string, int>>A(n);

	REP(i, n) {
		cin >> A[i].first >> A[i].second;
	}

	string x;
	cin >> x;

	int time = 0;

	REP(i, n) {
		if (A[i].first == x) {
			for (int j = i+1; j < n; j++) {
				time += A[j].second;
			}
			break;
		}
	}

	cout << time << endl;

	return 0;

}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdint>
#include <algorithm>

int main() {
  intmax_t H, W;
  scanf("%jd %jd", &H, &W);

  if (H % 3 == 0 || W % 3 == 0)
    return !printf("0\n");

  intmax_t res=1e12;
  for (intmax_t i=1; i<H; ++i) {
    intmax_t a=i*W, b=(H-i)*(W/2), c=(H-i)*(W-W/2);
    res = std::min(res, std::max({a, b, c})-std::min({a, b, c}));
  }

  for (intmax_t i=1; i<W; ++i) {
    intmax_t a=i*H, b=(W-i)*(H/2), c=(W-i)*(H-H/2);
    res = std::min(res, std::max({a, b, c})-std::min({a, b, c}));
  }

  res = std::min({res, H, W});
  printf("%jd\n", res);
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

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

    int n;
    cin >> n;

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

    ll r = 0;
    int m = n - 1;
    for (int d = 1; d < m; d++) {
        ll t = 0;
        for (int i = d; i < m - d; i += d) {
            if (m % d == 0 && i >= m - i) break;
            t += s[i] + s[m - i];
            r = max(r, t);
        }
    }

    cout << r << endl;

    return 0;
}

Measured memory_bytes: 640
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AOJ
{
	class Program
	{
		static void Main(string[] args)
		{
			var m = "";
			while ((m = Console.ReadLine()) != null)
			{
				if (m.Length % 2 != 0)
				{
					Console.WriteLine("NA");
				}
				else
				{
					var f = false;
					var r = new char[m.Length / 2];
					for (int i = 0; i < m.Length; i += 2)
					{
						var x = (m[i] - '0');
						var y = (m[i + 1] - '0');
						if (1 <= x && x <= 6 && 1 <= y && y <= 5)
						{
							r[i / 2] = (char)(((x - 1) * 5 + (y - 1) + 'a'));
						}
						else
						{
							f = true;
							break;
						}
					}
					if (f)
						Console.WriteLine("NA");
					else
						Console.WriteLine(new string(r).Replace('{', '.').Replace('|', '?').Replace('}', '!').Replace('~', ' '));
				}
			}
		}
	}
}

Measured memory_bytes: 19616
#include <bits/stdc++.h>
#define rep(i,l,r) for(ll (i)=(l);(i)<(r);(i)++)
#define ll long long
using namespace std;
int main(){
    ll n,x,y;
    cin>>n>>x>>y;
    vector<ll> ans(n,0);
    rep(i,1,n){
        rep(j,i+1,n+1){
            int num=min(abs(i-j),abs(x-i)+abs(y-j)+1);
            ans[num-1]++;
        }
    }
   rep(i,0,n-1) cout<<ans[i]<<endl;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
    int a,b,c,d;
    
    cin >> a;
        
    c = a / 3600 ;//秒を時間に
    b = a % 60 ;
    d = a / 60 % 60;
    
    cout << c << ":" <<  d << ":" << b << endl;
    
    return 0;
       
}

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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

ll powint(int i, int j){
	if(j==1) return i;
	return i*powint(i, j-1);
}

int main(){
	int X;
	cin >> X;
	ll res = 1;
	for(int i=1;i<X;i++){
		for(int j=2;j<=10;j++){
			ll tmp = powint(i, j);
			if (tmp <= X){
				res = max(res, tmp);
			}else{
				break;
			}
		}
	}
	cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cmath>
#include <queue>
#include <vector>
#include <time.h>
#include <string>
#include <stack>
#include <set>
#include <map>
#include <iostream>
#include <algorithm>
using namespace std;
#define MP make_pair
#define PB push_back
typedef long long LL;
typedef pair<int, int> Pii;
const int inf = 0x3f3f3f3f;
const LL INF = (1uLL << 63) - 1;
const LL mod = 1000000007;
const int N = 1e5 + 5;
const double Pi = acos(-1.0);
const int maxn = 4e3 + 5;
int tol , n , k , delt;
struct edge {
    int next;
    int to;
} E[maxn];
int head[maxn];
void add(int u, int v) {
    E[tol].to = v;
    E[tol].next = head[u];
    head[u] = tol++;
}
int u[maxn], v[maxn];
void init() {
    memset(head, -1, sizeof head);
    tol = 0;
    cin >> n >> k;
    for(int i = 0 ; i < n - 1; i++) {
        cin >> u[i] >> v[i];
        add(u[i], v[i]);
        add(v[i], u[i]);
    }
}

void dfs(int u, int fa, int step = 0) {
    if(step > k / 2)delt++;
    for(int i = head[u]; i != -1; i = E[i].next) {
        int to = E[i].to;
        if(to == fa)continue;
        dfs(to, u, step + 1);
    }
    return;
}
void work() {
    int res = n;
    if(k & 1) {
        for(int i = 0 ; i < n - 1; i++) {
            delt = 0;
            dfs(u[i], v[i]);
            dfs(v[i], u[i]);
            res = min(res, delt);
        }
    } else {
        for(int i = 1 ; i <= n; i++) {
            delt = 0;
            dfs(i,-1);
            res = min(res, delt);
        }
    }
    cout<<res<<endl;
}
int main() {
#ifdef local
    freopen("in", "r", stdin);
    //  freopen("w","w",stdout);
#endif
    ios::sync_with_stdio(false);
    cin.tie(0);
    init();
    work();
}


Measured memory_bytes: 384
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int[] a = new int[7];
		
		for(int i = 0 ; i < a.length ; i++){
			int s = sc.nextInt();
			int f = sc.nextInt();
			a[i] = s - (f);
		}
		for (int x : a){
			System.out.println(x);
		}
		
		
		sc.close();
	}

}

Measured memory_bytes: 17172
N, X = map(int, input().split())
L = list(map(int, input().split()))

# 累積和 cumulative sum
ans = 0
cumul = [0]
for i, l in enumerate(L):
  d = cumul[-1] + l
  if d > X:
    #print(i, d)
    ans = i + 1
    break
  cumul.append(d)
else:
  ans = N + 1

#print(cumul)
print(ans)

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

#define ll long long

using namespace std;

int main() {
  ll H, A;
  cin >> H >> A;
  ll sum = 0;
  while (1) {
    sum += A;
    if (sum >= H) {
      cout << sum / A << endl;
      return 0;
    }
  }
}


Measured memory_bytes: 256
console.log((args=>{
  const [N,...A] = args.trim().split('\n').map(v=>v|0);
  if ( A[0] > 0 ) return '-1';
  let m = 0;
  for ( let i = 1; i < N; i++ ) {
    if ( A[i] > i || A[i] > A[i-1]+1) return '-1'
    if ( A[i] === A[i-1]+1 ) m++;
    else if ( A[i] <= A[i-1] ) m += A[i];
  }
  return `${m}`;
})(require('fs').readFileSync('/dev/stdin', 'utf8')));


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

int main(void){
    string S;cin>>S;
    int h = 0;
    bool res=false;
    
    for(int i=0;i<S.size();i++){
        if(h==0 && S[i]=='h'){
            h++;
          res=false;
          continue;
        }
        if(h==1 && S[i]=='i'){
            h--;
            res=true;
          continue;
        }

        res=false;
        break;
    }

    if(res){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
}

Measured memory_bytes: 256
# import sys
# sys.setrecursionlimit(10 ** 6)
# import bisect
from collections import deque
# from decorator import stop_watch
#
#
# @stop_watch
def solve(N):
    dq = deque([(3, [1, 0, 0]), (5, [0, 1, 0]), (7, [0, 0, 1])])
    ans = 0
    while dq:
        num, check = dq.popleft()
        if num > N:
            break
        if sum(check) == 3:
            ans += 1
        for i in (3, 5, 7):
            new_num = num * 10 + i
            if new_num > N:
                break
            new_check = check.copy()
            if i == 3:
                new_check[0] = 1
            elif i == 5:
                new_check[1] = 1
            elif i == 7:
                new_check[2] = 1
            dq.append((new_num, new_check))
    print(ans)


if __name__ == '__main__':
    N = int(input())
    solve(N)

    # # test
    # from random import randint
    # from func import random_str
    # solve()


Measured memory_bytes: 12868
main(x,y,t){
	for(;scanf("%d%d",&x,&y),x;){
		int cnt=0;
		if(x<y)	t=x,x=y,y=t;
		do{
			x%=y;
			t=x,x=y,y=t;
			cnt++;
		}while(y);
		printf("%d %d\n",x,cnt);
	}
	exit(0);
}

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

using namespace std;

#define YES cout << "YES" << endl;
#define NO  cout << "NO"  << endl;
#define Yes cout << "Yes" << endl;
#define No  cout << "No"  << endl;
 
#define INF INT_MAX
#define MOD 1000000007
#define PI  acos(-1)

using ll  = long long;
using ull = unsigned long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

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

ll GCD(ll a, ll b) {
    if (a <= 0 || b <= 0) {
        return -1;
    }
    if (a > b) {
        if (a % b == 0) {
            return b;
        } else {
            GCD(b, a % b);
        }
    } else if (a < b) {
        if (b % a == 0) {
            return a;
        } else {
            GCD(a, b % a);
        }
    } else {
        return a;
    }
}

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

int main(int argc, char *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    ll A, B, C, D;
    cin >> A >> B >> C >> D;

    A -= 1;

    cout << (B-(B/C+B/D-B/LCM(C, D))) - (A-(A/C+A/D-A/LCM(C, D))) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <set>
using namespace std;
#define rep(i,s,n)for(int i = s;i<n;i++)
#define repe(i,s,n)for(int i = s;i<=n;i++)
#define rep_r(i,s,n)for(int i = n;i>s;i--)
#define rep_re(i,s,n)for(int i = n;i>=s;i--)
typedef long long ll;
static const ll MOD = 1e9 + 7;
static const ll INF = (ll)1 << 62;

ll h[100001] = {};
int main() {
	ll n; cin >> n;
	rep(i, 0, n)cin >> h[i];

	rep(i, 0, n-1) {
		if (h[i] == h[i + 1]) {
			continue;
		}
		else if (h[i] < h[i + 1]) {
			h[i + 1]--;
		}

		if (h[i] > h[i + 1]) {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;

	return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define line cout<<"\n"
#define ci std ::cin
#define co std ::cout
#define sf scanf
#define sff(n,m) scanf("%d%d",&n,&m)
#define pf printf
#define p_line printf("\n")
#define cas(n) printf("Case %d: ",n++)
#define task return
#define loop(x,n)  for(int x = 0 ; x < n ; x++)
#define constloop(x,a,n) for(int x = a ; x < n ; x++)
#define revloop(x,a,n)  for(int x = a ; x >= n ; x--)
#define REP(i,a,b) for (int i = a; i <= b; i++)
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define pi acos(-1)
#define mx 10000000
/*ll P[mx+5],cnt=1;
bool nP[mx+5];
void sieve(void)
{
    P[0]=2;
    nP[0]=true;
    nP[1]=true;
    for(ll i=3 ; i<=mx ; i+=2)
    {
        if(nP[i]==true)
            continue;
        for(ll j=i+i ; j<=mx ; j+=i)
            nP[j]=true;
        P[cnt++]=i;
    }
}*/
void solve()
{
    //Code here
 	ll a,b,c,d;
 	ci>>a>>b>>c>>d;
 	co<<max(a*c,max(a*d,max(b*c,b*d)));
 	line;
}
int main()
{
	/*freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);*/
	/*ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);*/
	solve();
	return 0;
}

Measured memory_bytes: 3624
class UnionFind:
    def __init__(self, n: int) -> None:
        #マイナスならルートでその深さを表す。プラスならルートのノードを指す。
        self.nodes = [-1]*n
 
    def find_root(self, x: int) -> int:
        if self.nodes[x] < 0:
            return x
        else:
            self.nodes[x] = self.find_root(self.nodes[x])
            return self.nodes[x]
 
    def unite(self, x: int, y: int) -> None:
        x, y = self.find_root(x), self.find_root(y)
        #浅い方につなぐ
        if (x != y):
            if (x < y):
                self.nodes[y] += self.nodes[x]
                self.nodes[x] = y
            else:
                self.nodes[x] += self.nodes[y]
                self.nodes[y] = x
                
    def get_num(self, x: int) -> int:
        return -(self.nodes[x])

MAX = 10**5+1

N = int(input())
uf = UnionFind(2*MAX)

for i in range(N):
  x,y = map(int, input().split())
  uf.unite(x,y+MAX)

#数え上げ
num_x = [0]*2*MAX
num_y = [0]*2*MAX
for i in range(MAX):
  num_x[uf.find_root(i)] += 1
  num_y[uf.find_root(i+MAX)] += 1
  #print(num_x[uf.find_root(i)], num_y[uf.find_root(i+MAX)])

ans = 0
for i in range(2*MAX):
  ans += num_x[i] * num_y[i]

print(ans - N)


Measured memory_bytes: 9580
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace test
{

    class Program
    {
        static void Main(string[] args)
        {
            int sum = 0;

            string input;
            while ((input = Console.ReadLine()) != null)
            {
                char[] gyaku = input.ToCharArray();
                Array.Reverse(gyaku);
                string rev = new string(gyaku);

                if (input == rev)
                {
                    sum++;
                }
            }

            Console.WriteLine(sum);

        }


        
    }
}

Measured memory_bytes: 5604
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#include<functional>
#include<unordered_set>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 50;

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

void solve(){
    ll n;
    ll p[4];
    rep(i,4){
        cin>>p[i];
        if(i!=3)p[i]*=(ll)pow(2,2-i);
    }
    cin>>n;
    ll ans=numeric_limits<ll>::max();
    rep(i,3)ans=min(ans,p[i]*n);
    rep(i,3)ans=min(ans,p[3]*(n/2)+p[i]*(n%2));
    cout<<ans<<"\n";
}

signed main(){
	std::ios::sync_with_stdio(false);
    std::cin.tie(0);
	solve();
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <tuple>
#include <complex>
#include <cassert>
#include <exception>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<P> vp;
#define rep(i,a,n) for(ll i = (a);i < (n);i++)
#define per(i,a,n) for(ll i = (a);i > (n);i--)
#define lep(i,a,n) for(ll i = (a);i <= (n);i++)
#define pel(i,a,n) for(ll i = (a);i >= (n);i--)
#define clr(a,b) memset((a),(b),sizeof(a))
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define sz size()
#define print(X) cout << (X) << "\n"
static const int INF = 1e+9+7;
static const ll INFL = 1e+18+7;
int n,m,l;
int p;
string s,t;
ll d[200010],dp[300][300];
char field[200][200];

int main(){
  cin >> n >> s;
  int ans = 0;
  rep(i,1,n-1){
    int a[26],b[26];
    int p = 0;
    clr(a,0);
    clr(b,0);
    rep(j,0,i)a[s[j]-'a']++;
    rep(j,i,n)b[s[j]-'a']++;
    rep(j,0,26)if(a[j] > 0 && b[j] > 0)p++;
    ans = max(ans,p);
  }
  print(ans);
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    ll n,k;
    cin>>n>>k;
    if(n>=10)
        cout<<k<<endl;
    else
        cout<<k+100*(10-n)<<endl;
    return 0;
}


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

using ll = int64_t;
#define int ll

#define FOR(i, a, b) for (int i = int(a); i < int(b); i++)
#define REP(i, b) FOR(i, 0, b)
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define ALL(x) x.begin(), x.end()

using pi = pair<int, int>;
using vi = vector<int>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

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

ll read() {
  ll i;
  scanf("%" SCNd64, &i);
  return i;
}

void printSpace() { printf(" "); }

void printEoln() { printf("\n"); }

void print(ll x, int suc = 1) {
  printf("%" PRId64, x);
  if (suc == 1)
    printEoln();
  if (suc == 2)
    printSpace();
}

string readString() {
  static char buf[3341000];
  scanf("%s", buf);
  return string(buf);
}

char *readCharArray() {
  static char buf[3341000];
  static int bufUsed = 0;
  char *ret = buf + bufUsed;
  scanf("%s", ret);
  bufUsed += strlen(ret) + 1;
  return ret;
}

template <class T, class U> void chmax(T &a, U b) {
  if (a < b)
    a = b;
}

template <class T, class U> void chmin(T &a, U b) {
  if (b < a)
    a = b;
}

template <class T> T Sq(const T &t) { return t * t; }

const int mod = 1e9 + 7;

signed main() {
  int a, b;
  std::cin >> a >> b;
  if (a + b < 24)
    print(a + b);
  else
    print((a + b) - 24);
}


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

int main(){
  int N,L,sum;
  cin>>N>>L;
  sum=(L+L+N-1)*N/2;
  if(L>0){
    cout<<sum-L<<endl;
  }else if(L+N-1<0){
    cout<<sum-(L+N-1)<<endl;
  }else{
    cout<<sum<<endl;
  }
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;
typedef long long ll;

const int MAXN = 200010;
ll A[MAXN];
int n;

void solve () {
  ll ans = 0;
  ll prev = 0;
  bool check = false;
  if (A[0]) {
    check = true;
  }

  for (int i=1;i<n;i++) {
    if (A[i] != 1 && A[i-1] + 1 < A[i]) {
      check = true;
      break;
    }
  }
  if (check) {
    cout << -1 << endl;
    return;
  }

  for (int i=0;i<n;i++) {
    if (A[i] <= prev) {
      ans += prev;
    }
    prev = A[i];
  }
  ans += prev;
  cout << ans << endl;
}

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


Measured memory_bytes: 1920
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort(all(x))
#define GSORT(x) sort(all(x), greater<int>())
#define MIN(x) *min_element(all(x))
#define MAX(x) *max_element(all(x))
#define el  cout << endl
#define dump(x)  cout << #x << " = " << (x) << endl
#define pb push_back
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }


int main() {
    int a, b, ans;
    cin >> a >> b;
    ans = a + b / 2;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
/******************************************************************************

            EYENINE,THE ELDER_WAND!!!
            THE ROOT OVER MINUS EIGHTY ONE!!

*******************************************************************************/

#include<bits/stdc++.h>
#define ALL_UP_WITH return 0
#define vi vector<int>
using namespace std;
int main(){

    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin>>n;
    int h[n];
    int count1=0;
    int ans=0;
    for(int i=0;i<n;i++){
        cin>>h[i];}
        for(int i=0;i<n-1;i++){
        if(h[i]>=h[i+1]){
            count1++;
            ans=max(ans,count1);
        }
        else{
            count1=0;
        }
    }
    cout<<ans<<endl;

    ALL_UP_WITH;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define REP(i, a, n) for (int i = (a); i < (int)(n); ++i)
#define REPC(i, a, n) for (int i = (a); i <= (int)(n); ++i)
#define ALL(t) t.begin(), t.end()
#define RALL(t) t.rbegin(), t.rend()
#define MATINIT(type, row, col, init) \
  vector<vector<type>>(row, vector<type>(col, init));
#define Yes(cond) cout << (cond ? "Yes" : "No") << endl;
#define YES(cond) cout << (cond ? "YES" : "NO") << endl;
using namespace std;
using LL = long long;
using ULL = unsigned long long;
template <class T>
using VEC = std::vector<T>;
template <class T>
using MAT = std::vector<std::vector<T>>;
void DUMP() { cerr << endl; }
template <class Head, class... Tail>
void DUMP(Head &&head, Tail &&... tail) {
  cerr << head << ", ";
  DUMP(std::move(tail)...);
}
template <typename T>
ostream &operator<<(ostream &os, vector<T> &vec) {
  os << "{";
  for (auto v : vec) os << v << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, map<T1, T2> &m) {
  os << "{";
  for (auto p : m) os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, pair<T1, T2> p) {
  os << "[" << p.first << " " << p.second << "]";
  return os;
}

int main() {
  int n;
  cin >> n;
  VEC<LL> a(3 * n);
  REP(i, 0, 3 * n) { cin >> a[i]; }
  sort(ALL(a));
  LL sum = 0;
  int ma = 3 * n - 1;
  int mi = 0;
  int mid = ma - 1;
  REP(i, 0, n) {
    sum +=a[mid];
    ma -= 2;
    --mi;
    mid -= 2;
  }
  cout<<sum<<endl;

  return 0;
}


Measured memory_bytes: 2560
#include <stdio.h>
#include <string.h>
 
int
main()
{
    int n;
    scanf("%d", &n);
 
    int i;
    int result;
    int a_score = 0;
    int b_score = 0;
    char a_card[100];
    char b_card[100];
    for (i = 0; i < n; i++)
    {
        scanf("%s %s", a_card, b_card);
        result = strcmp(a_card, b_card);
        if (result == 0)
        {
            a_score += 1;
            b_score += 1;
        }
        if (result > 0)
        {
            a_score += 3;
        }
        if (result < 0)
        {
            b_score += 3;
        }
    }
    printf("%d %d\n", a_score, b_score);
 
    return 0;
}

Measured memory_bytes: 604
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
#define ALL(obj) (obj).begin(), (obj).end()
const double PI = acos(-1);
const double EPS = 1e-15;
long long INF=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;
bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd_(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd_(b,a%b);
  }
}
 
long long lcm_(long long x, long long y){
  return (x/gcd_(x,y))*y;
}

int main(){
  
  int h,w;
  cin>>h>>w;
  vector<string> a(h);
  REP(i,h){
    cin>>a[i];
  }
  
  bool rows[h]={};
  bool columns[w]={};
  int valid_n = 0;
  bool flag;
  REP(i,h){
    flag = true;
    REP(j,w){
      if(a[i][j]=='#'){
        flag = false;
        break;
      }
    }
    rows[i] = flag;
    if(!flag)valid_n++;
  }
  REP(j,w){
    flag = true;
    REP(i,h){
      if(a[i][j]=='#'){
        flag = false;
        break;
      }
    }
    columns[j] = flag;
  }
  
  vector<char> ans[valid_n];
  int now = 0;
  REP(i,h){
    if(rows[i])continue;
    REP(j,w){
      if(columns[j])continue;
      ans[now].push_back(a[i][j]);
    }
    now++;
  }
  
  REP(i,valid_n){
    for(char c:ans[i]){
      cout<<c;
    }
    cout<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
/* 
	Author: ankrypt
*/


#include <bits/stdc++.h>

using namespace std;

#define MOD 1000000007
#define ll long long int
#define u64 unsigned long long int

ll A, B;

int main() {
	scanf("%lld %lld", &A, &B);
	ll ans = max(max(A + B, A * B), A - B);
	printf("%lld\n", ans);
	return 0;
}
/*
	Powered by Buggy Plugin
*/


Measured memory_bytes: 256
read N;tr \  \\n|nl|awk 1,\$1%=2|sort|uniq -c|sort -nr|awk '$2{K[++i]=$3;s+=L[i]=$1}!$2{M[++j]=$3;s+=N[j]=$1}END{print s-(K[1]!=M[1]?L[1]+N[1]:(a=L[1]+N[2])<(b=L[2]+N[1])?b:a)}'

Measured memory_bytes: 32076
import sys
from collections import deque

H, W = map(int, sys.stdin.readline().split())
grid = [["#"] * (W+2)]
for _ in range(H):
    grid.append(list("#" + sys.stdin.readline().strip() + "#"))
grid.append(["#"] * (W+2))
# print(grid)

q = deque()
for j in range(1, H+1):
    for i in range(1, W+1):
        if grid[j][i] == "#":
            q.append((i, j, 0))

ans = 0
while q:
    x, y, count = q.popleft()
    for dx, dy in ((1, 0), (0, 1), (-1, 0), (0, -1)):
        if grid[y+dy][x+dx] != ".":
            continue
        grid[y+dy][x+dx] = count + 1
        ans = count + 1
        q.append((x+dx, y+dy, count + 1))

# print(grid)
print(ans)

Measured memory_bytes: 255220
import scala.io.StdIn

/**
  * AOJ
  */
object Main {

  def main(args: Array[String]): Unit = {

    while(true) {
      val in = StdIn.readLine().split(" ").map(_.toInt)
      val H = in(0)
      val W = in(1)
      if(H == 0 && W == 0) return
      for(i <- 1 to H;j <- 1 to W){
        print(if((i + j) % 2 == 0){"#"}else{"."})
        if(j == W){println()}
      }
      println()
    }
  }
}

Measured memory_bytes: 54976
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,copy,time
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(input())
def inpl(): return list(map(int, input().split()))
def inpl_str(): return list(input().split())

s = input()
t = input()

Ls = len(s)+1
Lt = len(t)+1

dp = [[0]*Lt for _ in range(Ls)]

for i in range(1,Ls):
    for j in range(1,Lt):
        if s[i-1] == t[j-1]:
            dp[i][j] = dp[i-1][j-1]+1
        else:
            dp[i][j] = max(dp[i-1][j],dp[i][j-1])

i,j = Ls-1, Lt-1
ans = ''
while i >= 0 and j >= 0:
    if dp[i-1][j] == dp[i][j]:
        i -= 1
    elif dp[i][j-1] == dp[i][j]:
        j -= 1
    else:
        ans = s[i-1] + ans
        i,j = i-1,j-1

print(ans)


Measured memory_bytes: 115288
*B="[>]\0%p_\0B$`\0jFc";*F=" %d %d %d\n\0 pre-meiji\0  taisho\0 showa\0  heisei";y,m,d;main(e){for(;~scanf(F,&y,&m,&d);e?printf(F,y-B[e-1]/3271+1,m,d,printf(F+e*2+2)):puts(F+3))for(e=0;e<4&&y*3271+m*64+d>B[e];e++);         }

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

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

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

	vector<int> H(N + 1);
	for (int i = 1; i <= N; i++) {  // H[0]は欠番
		scanf("%d", &H[i]);
	}
	// for (int i = 0; i <= N; i++) {
	// 	cout << H[i] << "\n";
	// }

	vector<bool> isGood(N + 1, true);
	isGood[0] = false;

	int A, B;
	for (int i = 0; i < M; i++) {
		scanf("%d %d", &A, &B);
		if (H[A] >= H[B]) {
			isGood[B] = false;
		}
		if (H[B] >= H[A]) {
			isGood[A] = false;
		}
	}

	// for (int i = 0; i <= N; i++) {
	// cout << isGood[i] << "\n";
	// }

	// cout << "\n";
	cout << count(isGood.begin(), isGood.end(), true);
	return 0;
}

Measured memory_bytes: 3812
// 2020-08-04 17:11:07
#include <bits/stdc++.h>
using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  
  int n;
  cin >> n;
  vector<int> f (n);
  for (auto &it : f) cin >> it;

  int ans = 1000000007;
  for (int i = 1; i <= 100; i++) {
    int cc = 0;
    for (auto it : f) cc += (int) pow((it-i), 2);
    ans = min(cc, ans);
  }
  cout << ans << endl;

  return 0;
}

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

int main () {

    ll A, B, N; cin >> A >> B >> N;
    if(N >= B-1) N = B-1;
    cout << (floor(A*N/B)- A*floor(N/B)) << endl;

    return 0;
}

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

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t=1,i,j;
   // cin>>t;
    while(t--)
    {
        int n,m,k,a,b,count=0,sum=0,maxi=0,mini=1e18;
        cin>>k>>a>>b;
        
        for(i=a;i<=b;i++)
        {
            if(i%k==0)
            {
                cout<<"OK";
                return 0;
            }
        }
        cout<<"NG";
        
    }
}

Measured memory_bytes: 3652
int turaras[100000],times[100000],n,l;

int solve(int i){
	if(times[i]!=-1)return times[i];
	int time=0;
	if(turaras[i]<turaras[i-1]&&i>0){
		time=solve(i-1);		
	}
	if(turaras[i]<turaras[i+1]&&i<n-1){
		time=fmax(time,solve(i+1));		
	}	
	return times[i]=time+l-turaras[i];
}

int main(){
	int i;
	scanf("%d%d",&n,&l);
	memset(times,-1,sizeof(times));
	for(i=0;i<n;i++){
		scanf("%d",turaras+i);	
	}
	int max=0;
	for(i=0;i<n;i++){
		max=fmax(max,solve(i));	
	}
	printf("%d\n",max);
return 0;
}

Measured memory_bytes: 0