akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

#define ALL(x) (x).begin(), (x).end()
#define DUMP(xs) for (auto x:xs) cout<<x<<' ';cout<<endl
#define DUMPP(xs) for (auto x:xs) cout<<'('<<x.first<<','<<x.second<<')'<<' ';cout<<endl
#define FOR(i,a,b) for (ll i=(ll)(a);i<(ll)(b);++i)
#define OUT(x) cout<<x<<endl
#define OUTP(x) cout<<'('<<x.first<<','<<x.second<<')'<<endl;
#define REP(i,n) FOR(i,0,n)
#define YES(cond) cond ? OUT("YES") : OUT("NO")
#define Yes(cond) cond ? OUT("Yes") : OUT("No")

template<class T> T gcd(const T x,const T y){if(!y){return x;}return gcd(y,x%y);}
template<class T> T lcm(const T x,const T y){return x/gcd(x,y)*y;};
template<class T> T modpow(T x,T n,const T mod) {
  T res=1;while(n>0){if(n%2)res=res*x%mod;x=x*x%mod;n/=2;};return res;
}
template<class T> T modinv(T x,const T mod){return modpow(x,mod-2,mod);}
template<class T> bool alltrue(const T &a){return all_of(ALL(a),[](bool x){return x;});}
template<class T> bool anytrue(const T &a){return any_of(ALL(a),[](bool x){return x;});}
template<class T> bool contain(const T &a,const T &b){for(auto x:b){if (a.find(x)==a.end()){return false;}}return true;}
template<class T> bool mmax(T &m,const T q){ if (m < q) {m = q; return true;} else return false; }
template<class T> bool mmin(T &m,const T q){ if (m > q) {m = q; return true;} else return false; }
template<class T> int siz(const T &a) {return (int)a.size();}
template<class T> set<T> devisers(T n) {
  set<T> res;for(T i=1;i<(T)sqrt(n)+1;i++){if(n%i==0){res.insert(i);res.insert(n/i);}}return res;
}
template<class T> void concat(T &a, const T &b){a.insert(a.end(),ALL(b));}
template<class T> void getand(const T &a,const T &b,T &c) {
  set_intersection(ALL(a),ALL(b),inserter(c,c.end()));
}
template<class T> void getor(const T &a,const T &b,T &c) {
  set_union(ALL(a),ALL(b),inserter(c,c.end()));
}
template<class T> void getdiff(const T &a,const T &b,T &c) {
  set_difference(ALL(a),ALL(b),inserter(c,c.end()));
}
template<class T> T deg2rad(T deg) {return deg*2*M_PI/360;}
template<class T> T rad2deg(T rad) {return rad*360/(2*M_PI);}

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

const ll MOD=1e9+7;
const ll MAX=5e6;

int main() {
  ll N,K;cin>>N>>K;
  vector<ll> AS(N);
  vector<ll> sumAS(N+1,0);
  REP(i,N) cin>>AS[i];
  REP(i,N) sumAS[i+1] = sumAS[i]+AS[i];
  REP(i,N+1) {
    sumAS[i] -= i;
    sumAS[i] %= K;
  }

  ll ans = 0;
  map<ll,ll> mp;
  REP(i,N+1) {
    ans += mp[sumAS[i]];
    mp[sumAS[i]]++;
    if (i>=K-1) mp[sumAS[i-K+1]]--;
  }
  OUT(ans);

  return 0;
}

Measured memory_bytes: 15872
X,N = map(int,input().split())
p = list(map(int,input().split()))
min = 100
pp = list(map(lambda x: x-X, p))
i = 0
f = 0
while f == 0:
    if not i in pp:
        res = X + i
        break
    if i >= 0:
        i = -1 * (i +1)
    else:
        i = -1 * i
print(res)




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

#define ll                 long long
#define ull                unsigned long long
#define ld                 long double
#define fastio             ios_base::sync_with_stdio(false);cin.tie(NULL);
#define NO                 cout << "NO" << endl
#define YES                cout << "YES" << endl
#define vec                vector<ll>
#define pi                 pair<ll, ll>
#define intarr(arr, n)     ll arr[n]; for (ll i = 0; i < n; i++) cin >> arr[i]
#define intvec(v, n)       for (ll i = 0; i < n; i++) { ll x;cin >> x; v.pb(x);}
#define loop(i, a, b, c)   for (ll i = a; i < b; i += c)
#define pb                 push_back
#define mkp                make_pair
#define print(a, n, m)     for (ll i = n; i < m; i++) {  cout << a[i] << " "; }  cout << endl
#define endl               "\n"
#define mod2               998244353
#define mod                1000000007
#define mem(dp, a)         memset(dp, a, sizeof(dp));
#define all(v)             v.begin(), v.end()
#define ump                unordered_map<ll, ll>
#define ff                 first
#define ss                 second
#define PI                 3.14159265358979
#define minh               priority_queue<ll>
#define maxh               priority_queue<ll,vector<ll>,greater<ll>>
#define flush              cout<<flush


ll Ceil(ll a, ll b)
{
  if (a % b == 0)
    return a / b;
  else
    return a / b + 1;
}

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

ll inv(ll a)
{
  ll p = mod;
  ll b = p - 2, ans = 1;
  for (; b > 0; a = a * a % p, b >>= 1)
    if (b & 1)
      ans = ans * a % p;
  return ans;
}

ll ncrmod(ll n, ll m)
{
  ll p = mod;
  if (m > n)
    return 0;
  ll up = 1, down = 1;
  for (ll i = n - m + 1; i < n + 1; i++)
    up *= i, up %= p;
  for (ll i = 1; i < m + 1; i++)
    down *= i, down %= p;
  return up * inv(down) % p;
}

ll powmod(ll a, ll n)
{
  if (!n)
    return 1;
  ll pt = powmod(a, n / 2);
  pt *= pt, pt %= mod;
  if (n & 1)
    pt *= a, pt %= mod;
  return pt;
}

// void factorize(long long int n)
// {
//   ll count = 0;

//   while (!(n % 2)) {
//     n >>= 1;
//     count++;
//   }

//   if (count)
//   {
//     sum2 += count;
//   }

//   for (long long i = 3; i <= sqrt(n); i += 2) {
//     count = 0;
//     while (n % i == 0) {
//       count++;
//       n = n / i;
//     }
//     if (count)
//     {
//       if (i & 1)sum += count;
//     }
//   }
//   if (n > 2)
//   {
//     sum++;
//   }
// }

void solve()
{
  char a;
  cin >> a;
  if (a >= 'a' and a <= 'z') cout << 'a';
  else cout << 'A';
}
int main()
{
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif

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

  cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";

  return 0;
}

Measured memory_bytes: 3612
#pragma once
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
using P = pair<ll, ll>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
#define ALL(obj) (obj).begin(), (obj).end()

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

	ll N, K;
	ll ans = 0;

	cin >> N >> K;
	vector<ll> h(N);
	rep(i, N) cin >> h[i];
	
	rep(i, N) {
		if (h[i] >= K) ans++;
	}

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

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

#define REP(i, n) for(ll i = 0;i < n;i++)
#define REP1(i, n) for(ll i = 1;i < n;i++)
#define REPR(i, n) for(ll i = n-1;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)

#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())

#define ll long long
#define ALL(a)  (a).begin(),(a).end()

#define pb(a) push_back(a)

int now,n,k;


int main(){
  int ans=0;
  cin >> n >> k;
  k--;
  string s;cin>>s;
  
  s[k]=s[k]+32;



  cout<<s<<endl;
  return 0;
}

Measured memory_bytes: 764
#![allow(unused_imports, unused_variables, dead_code)]
use std::io::*;
use std::fmt::*;
use std::str::*;
use std::cmp::*;
use std::collections::*;

trait InputValue {
    fn parse(s: &str) -> Self;
}

fn read<T: InputValue>() -> T {
    let mut buf = String::new();
    let _ = stdin().read_line(&mut buf);
    T::parse(&buf.trim())
}

fn readnc<T: InputValue>() -> Vec<T> {
    let mut vec = vec![];
    let line: String = read();
    for token in line.split_whitespace() {
        vec.push(T::parse(token));
    }
    vec
}

fn readn<T: InputValue>(n: usize) -> Vec<T> {
    let mut vec = vec![];
    for _ in 0..n {
        vec.push(read());
    }
    vec
}

macro_rules! parse_single_value {
    ($($t:ty),*) => {
        $(
            impl InputValue for $t {
                fn parse(s: &str) -> $t { s.parse().unwrap() }
            }
        )*
	}
}
parse_single_value!(i32, i64, f32, f64, usize, String);

macro_rules! parse_tuple {
	($($t:ident),*) => {
		impl<$($t),*> InputValue for ($($t),*) where $($t: InputValue),* {
			fn parse(s: &str) -> ($($t),*) {
				let mut tokens = s.split_whitespace();
				let t = ($($t::parse(tokens.next().unwrap())),*);
				t
			}
		}
	}
}
parse_tuple!(A, B);
parse_tuple!(A, B, C);

// ===

fn dfs(now: usize, par: usize, depth: usize, graph: &Vec<Vec<usize>>) -> usize {
    if depth == 0 {
        return 1;
    }
    let mut ret = 1;
    for &to in &graph[now] {
        if to == par {
            continue
        }
        ret += dfs(to, now, depth-1, graph);
    }
    ret
}

fn main() {
    let (n, k): (usize, usize) = read();
    let mut graph: Vec<Vec<usize>> = vec![vec![]; n];
    for i in 0..n-1 {
        let (a, b): (usize, usize) = read();
        graph[a-1].push(b-1);
        graph[b-1].push(a-1);
    }

    let mut best = 0;
    if k % 2 == 1 {
        let half = (k-1)/2;
        for i in 0..n {
            for &j in &graph[i] {
                if i < j {
                    best = max(best, dfs(i, j, half, &graph) + dfs(j, i, half, &graph))
                }
            }
        }
    } else {
        let half = k/2;
        for i in 0..n {
            best = max(best, dfs(i, n, half, &graph));
        }
    }

    println!("{}", n-best);
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
int main() {
	// #ifndef ONLINE_JUDGE
	// 	// for getting input from input.txt
	// 	freopen("input.txt", "r", stdin);
	// 	// for writing output to output.txt
	// 	freopen("output.txt", "w", stdout);
	// #endif
	string s,t;
	cin>>s;
	t = s;
	sort(t.begin(), t.end());
	t.erase(unique(t.begin(), t.end()), t.end());
	if(s.size() == t.size()) cout<<"yes"<<endl;
	else cout<<"no"<<endl;
	return 0;
    }
	

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
const ll MOD=1000000007;
const long double PI=3.14159265358979;
const ll MAX=0;

int main() {
  ll N;
  cin>>N;
  ll a[100000];
  rep(i,100000){
    a[i]=0;
  }
  for(int i=1;i<100;i++){
    for(int j=1;j<100;j++){
      for(int k=1;k<100;k++){
        a[i*i+j*j+k*k+i*j+j*k+k*i]++;
      }
    }
  }
  rep(i,N){
    cout<<a[i+1]<<endl;
  }
}



Measured memory_bytes: 4400
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<cstdio>
#include<sstream>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double EPS=1e-8;
const int inf=1e9;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
int main(){
	int n,m;
	while(cin>>n>>m,n+m){
		vector<pair<int,pii> >in(m);
		rep(i,m){
			cin>>in[i].second.first>>in[i].second.second>>in[i].first;
		}
		vvi dp(n+1,vi(101,inf));//sum kei=cost
		dp[0][0]=0;
		rep(i,n)rep(j,101)rep(k,m){
			if(j<in[k].first)continue;
			int a=min(n,i+in[k].second.first);
			int b=min(100,j+in[k].second.second);
			dp[a][b]=min(dp[a][b],dp[i][j]+1);
		}
		int mi=inf;
		rep(i,101)mi=min(dp[n][i],mi);
		if(mi!=inf)cout<<mi<<endl;
		else cout<<"NA"<<endl;
	}
}

Measured memory_bytes: 1268
let n, k = Scanf.scanf " %d %d" @@ fun a b -> a, b
let ab_s = Array.init n @@ fun _ -> Scanf.scanf " %d %d" @@ fun a b -> a, b
let cs, r = Array.make 100001 0, ref 0
let _ = Array.(iter (fun (a, b) -> cs.(a) <- cs.(a) + b) ab_s; iteri (fun i c -> r := !r + c; if !r >= k then (Printf.printf "%d\n" i; exit 0)) cs)

Measured memory_bytes: 6912
n,m=map(int,input().split())
a=[0]*(n+1)
r= []
for i in range(m):
    r.append(list(map(int, input().split())))
    for j in range(2):
        a[r[i][j]]+=1
for i in range(1,n+1):
    print(a[i])

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

int main() {
  int a, b;
  cin >> a >> b;
  if ((a+b)%2==0) cout << (a+b)/2 << endl;
  else cout << "IMPOSSIBLE" << endl;
}

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

int main()
{
  string S ;
  cin>>S ;
  int ans=0 ;
  for(int i=0;i<S.size();i++){
    if(S.at(i)=='+') ans++ ;
    else ans-- ;
  }
  cout<<ans<<endl ;
  
  return 0 ;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <iostream>
using namespace std;
int main()
{
	int d,n;
	cin >> d >> n;
	int dp[205][105];
	for(int i=0;i<205;i++) for(int j=0;j<105;j++) dp[i][j]=-1e7;
	int temp[205];
	int a[205],b[205],c[205];
	for(int i=1;i<=d;i++)
	{
		cin >> temp[i];
	}
	for(int i=1;i<=n;i++)
	{
		cin >> a[i]>> b[i] >> c[i];
		if(a[i] <= temp[1] && temp[1] <= b[i])
		{
			dp[1][c[i]]=max(dp[1][c[i]],0);
		}
	}
	for(int i=2;i<=d;i++)
	{
		for(int j=1;j<=n;j++)
		{
			if(a[j] <= temp[i] && temp[i] <= b[j])
			{
				for(int k=0;k<=100;k++) dp[i][c[j]]=max(dp[i][c[j]],dp[i-1][k]+abs(k-c[j]));
			}
		}
	}
	int val=-1e7;
	for(int k=0;k<=100;k++) val=max(val,dp[d][k]);
	cout << val << endl;
}

Measured memory_bytes: 1248
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mk make_pair
#define mod 1000000007
#define ll long long
#define lb lower_bound
#define ub upper_bound
#define endl "\n"
#define ff first
#define ss second
#define prec(y,x) fixed<<setprecision(y)<<x
#define inf 1e18
#define pi 3.1415926535

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	string s, t;
	cin >> s >> t; int c = 0;
	for (int i = 0; i < s.size(); i++)
	{
		if (s[i] != t[i])
			c++;
	}
	cout << c;
	return 0;
}


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

int main(){
    ll n,k,s;
    cin >> n >> k >> s;
    for(ll i=0;i<n;i++){
        if(i!=0) cout << " ";
        if(i<k) cout << s; 
        else cout << (s+1)%H;
    }
    
    cout << endl;

    return 0;
}

Measured memory_bytes: 1280
N=int(input())
S=input()
a=list(S)
alpha=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]
SS2=[]
for i in range(len(a)):
    x=alpha.index(a[i])
    SS2.append(x)
 
for j in range(len(SS2)):
    SS2[j]+=N
 
SS3=[]
for k in range(len(SS2)):
    y=alpha[SS2[k]]
    SS3.append(y)
 
moji="".join(SS3)
print(moji)

Measured memory_bytes: 3316
N = int(input())
A = list(map(int, input().split()))
B = [0]
for i in range(N):
  B += [B[-1]+A[i]]
B.sort()
ans = 0
curr = B[0]
count = 1
for i in range(1,N+1):
  if curr != B[i]:
    ans += (count*(count-1))//2
    curr = B[i]
    count =1
  else:
    count += 1
else:
  ans += (count*(count-1))//2
  
print(ans)

Measured memory_bytes: 26716
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<=int(b);++i)
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
int INF=numeric_limits<int>::max();
// for(int j=0;j<N;++j) {

int main(void) {
  int r;cin>>r;
  pr(r*2*3.1415926535);
  return 0;
}


Measured memory_bytes: 3788
#include<iostream>
#include<math.h>

using namespace std;

int main()
{
	int n;
	int* a;
	cin >> n;
	a = new int[n];
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	int* b = new int[n];
	for (int i = 0; i < n; i++) {
		cin >> b[i];
	}
	int* c = new int[n - 1];
	for (int i = 0; i < n - 1; i++) {
		cin >> c[i];
	}
	int count = 0;
	for (int i = 0; i < n; i++) {
		count += b[a[i]-1];
		if (a[i + 1] - a[i] == 1) {
			count += c[a[i]-1];
		}
	}
	cout << count << endl;
	return 0;
}



Measured memory_bytes: 256
#include "bits/stdc++.h"
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)
#define INF 100000000
typedef long long ll;

using namespace std;

int main()
{
    int a, b;
    cin >> a >> b;
    cout << ((a*b)%2?"Odd":"Even") << endl;
    return 0;
}

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

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
typedef long double ld;

const int INF = 1e9;
const ld EPS = 1e-8;

int main(){
  string s;
  int K;
  cin >> s >> K;
  int n = s.length();

  REP(i,n) {
    int tmp = 26 - (s[i] - 'a');
    if(tmp == 26) continue;
    if(tmp <= K) {
      K -= tmp;
      s[i] = 'a';
    }
  }
  s[n - 1] = (s[n - 1] - 'a' + K) % 26 + 'a';
  cout << s << endl;
  return 0;
}



Measured memory_bytes: 512
#include "stdio.h"

int main(void){
	char s[4];
  scanf("%s",s);
  int i;
  int a = 0;
  int b = 0;
  for (i = 0; s[i] != 0; i++) {
    if (s[i] == 'A') a++;
    if (s[i] == 'B') b++;
  }
  if(a > 0 && b > 0) 
  	printf("Yes\n");
  else
    printf("No\n");
}

Measured memory_bytes: 128
def resolve():
    from collections import deque
    d=deque()
    s=list(input())
    d.extend(s)
    #print(d)
    q=int(input())
    Q=[list(map(str,input().split())) for i in range(q)]

    reverse= False
    for i in range(q):
        if int(Q[i][0])==1:
            reverse=not reverse
        elif int(Q[i][0])==2:
            if int(Q[i][1])==1:
                if reverse:
                    d.append(Q[i][2])
                else:
                    d.appendleft(Q[i][2])
                #print(s)
            else:
                if reverse:
                    d.appendleft(Q[i][2])
                else:
                    d.append(Q[i][2])
                #print(s)

    if reverse:
        print(''.join(list(reversed(d))))
    else:
        print(''.join(list(d)))






resolve()

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

using namespace std;
typedef long long  ll; 
int main(){
    ll n,a,b;
    cin >> n >> a >> b;
    b+=a;
    ll ans = a*(n/b);
    ans += min(n%b, a);
    cout << ans <<endl;
    
    
    return 0;
}

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

int ret_number(int x){
    if(x > 1){
        return x - 13;
    }else{
        return x;
    }
}

int main(){
    int a, b;
    cin >> a >> b;
    a = ret_number(a);
    b = ret_number(b);
    if(a > b){
        cout << "Alice" << endl;
    }else if(a < b){
        cout << "Bob" << endl;
    }else if(a == b){
        cout << "Draw" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end() 
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define INF 1000000000
using namespace std;
typedef long long ll;

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

    int W[N], S[N], temp = 0;
    REP(i, N){
        cin >> W[i];
        temp += W[i];
        S[i] = temp;
    }

    int ans = 1e+9;
    REP(i, N){
        ans = min(ans, abs(S[N-1] - 2*S[i]));
    }

    cout << ans << endl;

    return 0;
}

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

int main(){
int a;
  cin >>a;
  vector<int> h(a);
  rep(i,a) cin >>h.at(i);
  int ans =0;
  int zan =0;
  
  for(int i =0;i<a-1;i++){
   if(h.at(i)<h.at(i+1)){
      ans = max(zan,ans);
      zan =0;
    }
    else zan++;
    
  }
  ans = max(zan,ans);
  cout << ans;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
 
#define pb push_back
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define ll long long
#define ii pair<int,int>
#define vi vector<int>
#define vll vector<ll>
#define vii vector<ii>
#define debug cout << "Ok" << endl;

using namespace std;

int solve(int n){
	int qtd=0;

	if(n==0) return 1;

	while(n){
		qtd++;
		n/=10;
	}
	return qtd;
}
 
int vs[4];
int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	for(int i=0;i<4;i++){
		vs[i]=-1;
	}

	int n,m,aux,d;
	bool t=true,o=false;
	cin >> n >> m;

	while(m--){
		cin >> aux >> d;
		if(vs[aux-1]!=-1 and vs[aux-1]!=d) t=false;
		else vs[aux-1]=d;
	}

	if(vs[0]==-1 and n==1){
		cout << "0" << endl;
		return 0 ;
	}

	if(t){
		aux=1;
		d=0;
		if(vs[0]==-1) vs[0]=1;
		
		for(int i=n-1;i>-1;i--){
			if(vs[i]!=-1)
				d+=aux*vs[i];
			else{
				d+=aux*0;
			}
			aux*=10;
		}

		if(n!=solve(d)) d=-1;
	}
	else{
		d = -1;
	}

	cout << d << endl;

	return 0;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
    
#define FAST ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree<pair<int,int>, null_type,less<pair<int,int>>, rb_tree_tag,tree_order_statistics_node_update>
    
#define int long long
#define double long double
    
#define all(a)      (a).begin(),(a).end()
#define sz(x)       (int)x.size()
    
#define ff first
#define ss second
#define mp make_pair
         
#define pb push_back
#define endl "\n" 
         
#define f(i,l,r) for(int i=l;i<=r;i++)
#define rf(i,r,l) for(int i=r;i>=l;i--)    

#define bp __builtin_popcountll
#define inf 1e18
    
const int N=1e5+5;
const int M=1e9+7;
void solve()
{
	int n,m,x;
	cin>>n>>m>>x;
	int a[n+1][m+1];
	int money=inf;
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<=m;j++)
		{
			cin>>a[i][j];
		}
	}
	for(int i=0;i<(1<<n);i++)
	{
		int X[m+1]={0};
		int tt=0;
		for(int j=0;j<n;j++)
		{
			if(!(i&(1<<j)))
			{
				tt+=a[j][0];
				for(int k=1;k<=m;k++)
				{
					X[k]+=a[j][k];
				}
			}
		}
		bool flag=true;
		for(int i=1;i<=m;i++)
		{
			if(X[i]<x)
			{
				flag=false;
				break;
			}
		}
		if(flag && tt<money)
		{
			money=tt;
		}
	}
	if(money==inf)
	{
		cout<<-1;
	}
	else
	cout<<money;
}

signed main()  
{
	FAST
    int t=1;
    // cin>>t;
    for(int tc=1;tc<=t;tc++)
    {
    	// cout<<"Case #"<<tc<<": ";
    	solve();
    }
}




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

#define ll long long int
#define MOD 2019
#define vll vector<ll>

int main() {

    int N;
    cin >> N;

    vll A, B;
    ll a, b;

    for (int i = 0; i < N; i++) {
        cin >> a;
        A.push_back(a);
    }
    for (int i = 0; i < N; i++) {
        cin >> b;
        B.push_back(b);
    }

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

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

    // for (int i = 0; i < N; i++) {
    //     cout << A[i] << " ";
    // }
    // cout << endl;

    int count = 0;
    int lim = -1;
    ll sum = 0;


    for (int i = 0; i < N; i++) {
        if (A[i] < 0) {
            sum += A[i];
            count++;
        }
        else {
            lim = i-1;
            break;
        }
    }

    for (int i = N-1; i < N; i--) {
        if (sum < 0) {
            sum += A[i];
            count++;
            if (i == lim) {
                count = -1;
                break;
            }
        }
        else {
            break;
        }
    }

    cout << count << endl;

    return 0;
}


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

# import numpy as np

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

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


# ===CODE===

def main():
    x, y, z, w = ns()
    a = na()
    b = na()
    c = na()

    a.sort(reverse=True)
    b.sort(reverse=True)
    c.sort(reverse=True)

    ans = []
    for ai in a:
        for bi in b:
            ans.append(ai + bi)

    ans.sort(reverse=True)
    ans = ans[:3010]

    res = []
    for ci in c:
        for i in range(len(ans)):
            res.append(ci + ans[i])
    res.sort(reverse=True)

    for i in range(w):
        print(res[i])


if __name__ == '__main__':
    main()


Measured memory_bytes: 226320
S=input().strip()
a=int(S[:2])
b=int(S[2:])
aa = a < 13 and a != 0
bb = b < 13 and b != 0

if aa and bb:
    ans = 'AMBIGUOUS'
elif aa and not bb:
    ans = 'MMYY'
elif bb and not aa:
    ans = 'YYMM'
else:
    ans = 'NA'
print(ans)


Measured memory_bytes: 9180
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e4+10;
 
ll d,n,a[N],x,b[N],k;
vector<ll>res;
bool prime(ll x) {
    ll k = sqrt(x);
    for (ll i = 2; i <= k; i++) {
        if (x % i == 0) {
            return 0;
        }
    }
    return 1;
}
 
bool ok(ll p) {
    if (a[0] % p) {
        return 0;
    }
    for (ll i = 0; i <= n; i++) {
        b[i] = a[i];
    }
    for (ll i = n; i >= p - 1; i--) {
        b[i - (p - 1)] = (b[i - (p - 1)] + b[i]) % p;
        b[i] = 0;
    }
    for (ll i = 0; i <= n; i++) {
        if (b[i] % p) {
            return 0;
        }
    }
    return 1;
}
 
int main() {
    scanf("%lld", &n);
    for (int i = n; i >= 0; i--) {
        scanf("%lld", &a[i]);
        d = __gcd(d,abs(a[i]));
    }
    for (ll i = 2; i * i <= d; i++) {
        if (d % i == 0) {
            while (d % i == 0) {
                d /= i;
            }
            res.push_back(i);
        }
    }
    if (d > 1) {
        res.push_back(d);
    }
    for (int i = 2; i <= n; i++) {
        if (prime(i) && ok(i)) {
            res.push_back(i);
        }
    }
    sort(res.begin(), res.end());
    res.erase(unique(res.begin(), res.end()), res.end());
    for (int i=0;i<res.size();i++) {
        printf("%lld\n", res[i]);
    }
}

Measured memory_bytes: 384
from math import ceil
N, H = map(int, input().split())
A, B = 0, []
for i in range(N):
    a, b = map(int, input().split())
    A = max(A, a)
    B.append(b)

B = [b for b in B if b > A]
B.sort()

ans = 0
while H > 0 and B:
    ans += 1
    H -= B.pop()

H = max(0, H)
ans += ceil(H / A)
print(ans)


Measured memory_bytes: 7900
#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <functional>

using namespace std;
typedef pair<int, int> P;
static const int INF = 1e9;
static const int SIZE = 100001;
struct edge
{
	int to;
	int cost;
};

vector<edge> G[SIZE];
int d[SIZE];

void solve()
{
	int V, E, start;
	cin >> V >> E >> start;
	for (int i = 0; i < E; ++i)
	{
		int from, to, cost;
		scanf("%d %d %d", &from, &to, &cost);
//		cin >> from >> to >> cost;
		edge e;
		e.to = to;
		e.cost = cost;
		G[from].push_back(e);
	}
	for (int i = 0; i < SIZE; ++i)
	{
		d[i] = INF;
	}
	d[start] = 0;
	priority_queue<P, vector<P>, greater<P> > pque;
	pque.push(P(0, start));
	while (!pque.empty())
	{
		P p = pque.top();
		pque.pop();
		int v = p.second;
		for (int i = 0; i < G[v].size(); ++i)
		{
			edge e = G[v][i];
			if (d[e.to] > d[v] + e.cost)
			{
				d[e.to] = d[v] + e.cost;
				pque.push(P(d[e.to], e.to));
			}
		}
	}
	for (int i = 0; i < V; ++i)
	{
		if (d[i] == INF)
		{
			cout << "INF" << endl;
		}
		else
		{
			cout << d[i] << endl;
		}
	}
}

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

Measured memory_bytes: 11388
#include <iostream>

using namespace std;
int main() {
    int N;
    cin >> N;
    int a[100000];
    for (int i=0; i<N; i++) cin >> a[i];

    int G = 0;
    for (int i=0; i<N; i++) {
        if (a[i] % 2 == 1) G = 1;
    }
    if (G == 0) cout << "second" << endl;
    else cout << "first" << endl;
    return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<set>
#include<string>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

using namespace std;

int main(){
    int n,i;
    string input;
    set<string> s;
    cin>>n;
    rep(i,n){
        cin>>input;
        s.insert(input);
    }
    cout<<s.size()<<endl;


}

Measured memory_bytes: 19212
#include <stdio.h>

int main(){
	int W,H,x,y,r;
	scanf("%d%d%d%d%d",&W,&H,&x,&y,&r);
	if(r > x || r > y || W < x+r || H < y+r){
		printf("No");
	}
	else {
		printf("Yes");
	}
	printf("\n");
	return 0;
}

Measured memory_bytes: 588
#include  <iostream>
#include  <stdio.h>
#include <algorithm>
using namespace std;
#include <vector>
#define rep(i,n) for (int i = 0; i < (n) ; i++)
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define ll long long
#define ull unsigned long long
#define vint vector<int>
#define vll vector<ll>

//#include <stack>
//#include <queue>

/*
#include <math.h>
int standerd = int(pow(10.0,9.0)) + 7;
*/
string ans_Yes = "Yes"; 
string ans_No = "No"; 
string ans_yes = "yes"; 
string ans_no = "no"; 

#define Nmax 100010
int N,M;
int start,goal;

int visited[Nmax][4]={};
int ans = Nmax;
vector<int> path[Nmax];

void walking(int step,vector<int> current_location){
    step++;
    bool flag = false;

    vector<int> next1;
    vector<int> next2;
    vector<int> target;
    int stage;

    stage = 1;
    for(int location :current_location){
        for(int next :path[location] ){
            if(visited[next][stage]==0){
                visited[next][stage]=1;
                next1.push_back(next);
                //cout << step << ":" <<stage << ":" << next<< endl;
            }
        }
    }
    stage = 2;
    for(int location :next1){
        for(int next :path[location] ){
            if(visited[next][stage]==0){
                visited[next][stage]=1;
                next2.push_back(next);
                //cout << step << ":" <<stage << ":" << next<< endl;
            }
        }
    }
    stage = 3;
    for(int location :next2){
        for(int next :path[location] ){
            if(next==goal){
                visited[goal][stage]=step;
            }
            else if(visited[next][stage]==0){
                flag = true;
                visited[next][stage]=1;
                target.push_back(next);
                //cout << step << ":" <<stage << ":" << next<< endl;
            }
        }
    }
    if(flag){
        if(visited[goal][3]==0){
            sort(target.begin(), target.end());
            unique(target.begin(), target.end()), target.end();
            walking(step,target);
        }
    }


}
int main(){

    cin >> N >> M;

    int source,dest;
    rep(mi,M){
        cin >> source >> dest;
        path[source].push_back(dest);
    }
    cin >> start >> goal;

    int step = 0;
    vector<int> starting;
    starting.push_back(start);
    walking(step,starting);
    if(visited[goal][3]==0) cout << -1 << endl;
    else cout << visited[goal][3] << endl;
}

Measured memory_bytes: 38528
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const int INF = 1 << 30;
const ll MOD = 1000000007;

int main() {
    int r;
    cin >> r;

    cout << r * r << endl;
    return 0;
}

Measured memory_bytes: 256
#include <string>
#include <vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<functional>
#include<list>
#include<deque>
#include<bitset>
#include<set>
#include<map>
#include<cstring>
#include<sstream>
#include<complex>
#define X first
#define Y second
#define pb push_back
#define rep(X,Y) for (int (X) = 0;(X) < int(Y);++(X))
#define rrep(X,Y) for (int (X) = int(Y-1);(X) >=0;--(X))
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

int n,m,c[10];

int check(int num){
  int sum=0;
  rep(i,n){
    sum+=c[num%10];
    num/=10;
  }
  return sum<=m;
}

int main(){
  int i,j,k,pow[]={1,10,100,1000,10000,100000};;
  cin>>n>>m;
  rep(i,10)
    cin>>c[i];
  rep(i,pow[n])
    if(check(i)){
      rrep(j,n)
        cout<<i/pow[j]%10;
      cout<<endl;
      return 0;
    }
  cout<<"NA"<<endl;
  return 0;
}


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

int main()
{

    int n,x,y; cin>>n>>x>>y;
    int arr[n];
    memset(arr,0,sizeof(arr));
    for(int i=1;i<n;i++){
        for(int j=i+1;j<=n;j++)
        {

            int d = j-i;
            d= min(d,1+abs(i-x)+abs(j-y));
            d= min(d,1+abs(j-x)+abs(i-y));
            arr[d]++;
        }
    }
    for(int i=1;i<=n-1;i++)cout<<arr[i]<<endl;
}


Measured memory_bytes: 256
/*Lucky_Glass*/
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;

const int N=1e5;

int n;
char str[N+5];

int main(){
	scanf("%d%s",&n,str+1);
	int Vans=0;
	for(int i=1;i<=n;i++)
		if(str[i]!=str[i-1])
			Vans++;
	printf("%d\n",Vans);
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define mem(a) memset(a,0,sizeof(a))
#define ll long long
int main()
{
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	while(1)
	{
		c-=b;
		if(c<=0){cout<<"Yes";return 0;}
		a-=d;
		if(a<=0){cout<<"No";return 0;}
		//printf("a=%d,b=%dmc=%d,d=%d\n",a,b,c,d);//*********************
	}
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define F first
#define S second
#define ll long long
#define ld long double
#define pb push_back
#define sz size

using namespace std;

const int N=1e5+5;

ll x,n,k,ans=2e18,pos[N],neg[N],inp=1,inn=1;

int main()
{
    cin >> n >> k;
    for (int i=0;i<n;i++)
    {
        cin >> x;
        if (x>=0)pos[inp++]=x;
        else neg[inn++]=x;
    }
    reverse(neg+1,neg+inn);
    for (int i=0;i<=k;i++)
    {
        if (i<inn&&(k-i)<inp)
        {
            ll tmp=((k-i)>0?2*(abs(neg[i])):abs(neg[i]))+pos[k-i];
            ll emp=((i)>0?2*((pos[k-i])):(pos[k-i]))+abs(neg[i]);
            ans=min(ans,min(tmp,emp));
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1024
from math import pi, cos, sqrt

A,B,H,M = map(int, input().split())

angleL = 2 * pi * (H*60+M) / (12*60)
angleS = 2 * pi * M / 60
angle = max(angleL, angleS) - min(angleL, angleS)


ans = sqrt(A*A + B*B - 2*A*B*cos(angle))
print(ans)


Measured memory_bytes: 9484
#include <algorithm>
#include <boost/optional.hpp>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iostream>
#include <limits>
#include <list>
#include <numeric>
#include <queue>
#include <sstream>
#include <string>
#include <tuple>
#include <type_traits>
#include <utility>
#include <vector>

#define REP(i, n) for(int i = 0, i##_MACRO = (n); i < i##_MACRO; i++)
#define RANGE(i, a, b) for(int i = (a), i##_MACRO = (b); i < i##_MACRO; i++)
#define EACH(e, a) for(auto&& e : a)
#define ALL(a) (a).begin(), (a).end()
#define AALL(a, n) (a), ((a) + (n))
#define FILL(a, n) memset((a), n, sizeof(a))
#define FILLZ(a) FILL(a, 0)
#define INT(x) (static_cast<int>(x))
#define MODNUM (INT(1e9 + 7))
#define MOD(x) ((x) % MODNUM)

using namespace std;

using ll = long long;
using VI = vector<int>;
using VI2D = vector<vector<int>>;

const int INF = 2e9;
const double EPS = 1e-10;
const double PI = acos(-1.0);

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

template <typename T>
int sign(T x) {
	return x < 0 ? -1 : x > 0 ? 1 : 0;
}

template <>
int sign(double x) {
	return x < -EPS ? -1 : x > EPS ? 1 : 0;
}

template <typename T>
void chmax(T& m, T x) {
	m = max(m, x);
}

template <typename T>
void chmin(T& m, T x) {
	m = min(m, x);
}

template <typename T>
T square(T x) {
	return x * x;
}

inline int toInt(string s) {
	int v;
	istringstream sin(s);
	sin >> v;
	return v;
}

int main() {
	int n, m;
	scanf("%d %d", &n, &m);
	puts(n == m ? "Yes" : "No");
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

// c++11
#include <array>
#include <tuple>
#include <unordered_map>
#include <unordered_set>

#define mp make_pair
#define mt make_tuple
#define rep(i, n) for (int i = 0; i < (n); i++)

using namespace std;

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

const int INF = 1 << 29;
const double EPS = 1e-9;
const ll MOD = 1000000007;

const int dx[] = {1, 0, -1, 0}, dy[] = {0, -1, 0, 1};
int N,C,K;
vector<int> T;
int main() {
  cin >> N >> C >> K;
  T.resize(N);
  for (auto &val : T){
    cin >> val;
  }
  sort(T.begin(), T.end());
  int pos = 0;
  int res = 0;
  for (int i = 1; i < T.size(); i++){
    int tmp = T[i] - T[pos];
    if ((i - pos + 1) > C or tmp > K){
      res++;
      pos = i;
    }
  }
  res++;
  cout << res << endl;
  return 0;
}


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

#define int long long

void solve(int tt)
{
    int n;
    cin>>n;
    int ans=0;
    int a[n+5];
    int suff[n+5]={0};
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
        int idx=i-a[i]+1;
        if(idx>=1 && idx<=n)
            suff[idx]+=1;
    }
    for(int i=1;i<=n;i++)
    {
        int idx=i+a[i]+1;
        if(idx<=n)
            ans+=suff[idx];
    }
    cout<<ans;
}

int32_t main()
{
    int t=1;
    //cin>>t;
    for(int i=1;i<=t;i++)
        solve(i);
}

Measured memory_bytes: 6756
#include <bits/stdc++.h>
using namespace std;
int a[200000];
int main()
{
    int n, k;
    cin >> n >> k;
    long long sum = 0;
    for (int i = 0; i < n; ++i)
    {
        cin >> a[i];
        sum += a[i];
    }
    long long l = 1, r = sum;
    while (l < r)
    {
        long long m = l + (r - l) / 2;
        bool valid = true;
        long long cuts = 0;
        for (int i = 0; i < n; ++i)
        {
            cuts += ceil(a[i] / (long double)m) - 1;
            if (cuts > k)
            {
                valid = false;
                break;
            }
        }
        if (valid)
        {
            r = m;
        }
        else
        {
            l = m+1;
        }
    }
    cout << r;
}

Measured memory_bytes: 4276
import sys
def I(): return int(sys.stdin.readline().rstrip())

N = I()
P = [0] + [I() for _ in range(N)]

Q = [0]*(N+1)
for i in range(1,N+1):
    Q[P[i]] = i

# Qの最大連続増加部分列の長さを求める

a = 1
b = 1
for i in range(2,N+1):
    if Q[i] > Q[i-1]:
        b += 1
    else:
        a = max(a,b)
        b = 1
a = max(a,b)

print(N-a)


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

void solve(long long N, std::string S)
{
    string T(S.length(), 'A');
    int A = static_cast<int>('A');
    for (size_t i = 0; i < S.length(); i++)
    {
        T[i] = static_cast<char>((static_cast<int>(S[i]) - A + N) % 26 + A);
    }

    cout << T << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main()
{
    long long N;
    scanf("%lld", &N);
    std::string S;
    std::cin >> S;
    solve(N, S);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}

int main(){

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

  ll ans = (a+b)/2;
  ans += (a+b)%2;
  cout <<ans << endl;
  
  //cout << fixed << setprecision(16) << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#define N 500
using namespace std;
struct info {
  int tid[N];
  int pid[N];
  int time[N];
  string message[N];
};
int main(){
  struct info data;
  int t,p,r,i,j,tcorrect[51][11],tp[51],twrong[51][11],tcsum[51],tnum[51];
  while(1){
    cin >> t >> p >> r;
    if(t==0&&p==0&&r==0) break;
    for(i=0;i<r;i++){
      cin >> data.tid[i] >> data.pid[i] >> data.time[i] >> data.message[i];
    }
    for(i=1;i<=t;i++){
      for(j=1;j<=p;j++){
    tcorrect[i][j]=twrong[i][j]=0;
      }
        tp[i]=0;
    }
    for(i=0;i<r;i++){
      if(data.message[i]=="CORRECT"){
    tcorrect[data.tid[i]][data.pid[i]]++;
    tp[data.tid[i]]=tp[data.tid[i]]+twrong[data.tid[i]][data.pid[i]]*1200+data.time[i];
      }
      else if(data.message[i]=="WRONG"){
    twrong[data.tid[i]][data.pid[i]]++;
      }
    }
    for(i=1;i<=t;i++){
      tcsum[i]=0;
      for(j=1;j<=p;j++){
    tcsum[i]+=tcorrect[i][j];
      }
      tnum[i]=i;
    }
    for(i=1;i<=t;i++){
      for(j=2;j<=t;j++){
    if(tnum[j]<tnum[j-1]){
      swap(tp[j],tp[j-1]);
      swap(tcsum[j],tcsum[j-1]);
      swap(tnum[j],tnum[j-1]);
    }
      }
    }
    for(i=1;i<=t;i++){
      for(j=2;j<=t;j++){
    if(tp[j]<tp[j-1]){
      swap(tp[j],tp[j-1]);
      swap(tcsum[j],tcsum[j-1]);
      swap(tnum[j],tnum[j-1]);
    }
      }
    }
    for(i=1;i<=t;i++){
      for(j=2;j<=t;j++){
    if(tcsum[j]>tcsum[j-1]){
      swap(tp[j],tp[j-1]);
      swap(tcsum[j],tcsum[j-1]);
      swap(tnum[j],tnum[j-1]);
    }
      }
    }
    for(i=1;i<=t;i++){
      cout << tnum[i] << ' ' << tcsum[i] << ' ' << tp[i] << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 1252
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] sa = br.readLine().split(" ");
		int n = Integer.parseInt(sa[0]);
		int x = Integer.parseInt(sa[1]);
		br.close();

		if (x == 1 || x == 2 * n - 1) {
			System.out.println("No");
			return;
		}
		System.out.println("Yes");

		if (n == 2) {
			System.out.println("1");
			System.out.println("2");
			System.out.println("3");
			return;
		}

		PrintWriter pw = new PrintWriter(System.out);
		int[] center = {x - 2, x + 1, x, x - 1};
		int min = x - 2;
		if (x == 2) {
			center[0] = x + 2;
			center[1] = x - 1;
			center[3] = x + 1;
			min = x - 1;
		}
		int num = 0;
		for (int i = 0; i < n - 3; i++) {
			num++;
			if (num == min) {
				num += 4;
			}
			pw.println(num);
		}
		for (int i = 0; i < 4; i++) {
			pw.println(center[i]);
		}
		for (int i = 0; i < n - 2; i++) {
			num++;
			if (num == min) {
				num += 4;
			}
			pw.println(num);
		}
		pw.flush();
		pw.close();
	}
}


Measured memory_bytes: 37216
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define forin(in, n) for(int i=0; i<n; i++) cin>>in[i]
#define forout(out, n) for(int i=0; i<n; i++) cout<<out[i]<<endl
#define rep(i, n) for(int i=0; i<(n); i++)

int main(){
    int n, x, t; cin>> n >> x >> t;
    if(n % x == 0) cout<< n/x *t << endl;
    else cout<< (n/x +1)*t << endl;
}


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

int main() {
  int n;
  string s;
  cin >> n >> s;
  int d[1000];
  memset(d,0,sizeof(d));
  map<int,int> m;
  for(int i=0; i<n; i+=2) {
    m[s[i]-'a']++;
  }
  for(map<int,int>::iterator it=m.begin();it!=m.end();it++) {
    d[it->second]++;
  }
  int ans=0,c=0;
  for(int i=0; i<1000; i++) {
    if(d[i]==0) continue;
    c++;
    int x=d[i];
    if(i==1) ans+=x+(x-1);
    else {
      ans+=x+(x-1)+1+1;
      if(x>1) ans+=2;
    }
  }
  cout << ans+c-1 << endl;
  return 0;
}


Measured memory_bytes: 3212
import java.util.Scanner;
import java.util.HashSet;

public class Main{
    public static void main(String[]argc){
        Scanner sc = new Scanner(System.in);
        HashSet<String> set = new HashSet<String>();
        int n = sc.nextInt();    
        for(int i=0;i<n;i++){
            String s1 = sc.next();
            if(s1.equals("insert")){
                String s2 = sc.next();
                set.add(s2);
            }else if(s1.equals("find")){
                String s2 = sc.next();
                if(set.contains(s2)) System.out.println("yes");
                else System.out.println("no");
            }           
        }
    }
}


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

#define rep(i, a, b) for (ll i = (a); i < (b); i++)
typedef uint64_t ull;
typedef int64_t ll;
typedef std::pair<ll, ll> PLL;

using namespace std;

ll up(ll x){
  return 10 * ((x+9)/10);
}

signed main() {
  vector<ll> v(5);
  rep(i,0,5)
    cin>>v[i];
  ll mi = 0;
  rep(i,1,5)
    if (up(v[i])-v[i] > up(v[mi])-v[mi])
      mi=i;

  ll ans = 0;
  rep(i,0,5) {
    if (i==mi)
      ans += v[i];
    else
      ans += up(v[i]);
  }
  cout<<ans<<endl;
  return 0;
}


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

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
#define dump(val) cerr << __LINE__ << ":\t" << #val << " = " << (val) << endl

using namespace std;

typedef long long int lli;

template<typename T>
vector<T> make_v(size_t a, T b) {
    return vector<T>(a, b);
}

template<typename... Ts>
auto make_v(size_t a, Ts... ts) {
    return vector<decltype(make_v(ts...))>(a, make_v(ts...));
}

int main() {
    lli n;
    cin >> n;
    int bef = -1;
    if (n == 0) {
        cout << 0 << endl;
        return 0;
    }
    while (n != 0) {
        int digit = 1;
        lli r = 0, h = 1;
        lli bs = 1;
        while (!(r <= n && n <= h)) {
            bs *= -2;
            if (digit % 2) {
                r += bs;
            } else {
                h += bs;
            }
            digit++;
        }
        if (bef == -1) {
            cout << 1;
        } else {
            REP(j, 1, bef - digit) {
                cout << 0;
            }
            cout << 1;
        }
        n -= bs;
        bef = digit;
    }
    REP(i, 1, bef) {
        cout << 0;
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,x,n) for(int (i) = x; (i) < (n); (i)++)
#define MAX 100

int H,W;

vector<vector<int>> wall(10,vector<int>(10));
// // vector<vector<int>> checked(10,vector<int>(10));
// int checked[10];

// int search(int s) {
    
//     return 0;
// }

int solve(void) {
    REP(k,0,10) {
        REP(i,0,10) {
            REP(j,0,10) {
                if (wall[i][j] > wall[i][k] + wall[k][j]) wall[i][j] = wall[i][k] + wall[k][j];
            }}}
    return 0;
}


int main(void){
    cin >> H >> W;
    // REP(i,0,n) {
    
    // }
    // cout << wall[0][0];
    REP(i,0,10) {
        REP(j,0,10) {
            cin >> wall[i][j];
        }
    }
    
    int a[H][W];
    REP(i,0,H) {
        REP(j,0,W) {
            cin >> a[i][j];
        }
    }
    
    solve();
    
    int ans = 0;
    REP(i,0,H) {
        REP(j,0,W) {
            if (a[i][j] == -1 || a[i][j] == 1) continue;
            ans += wall[a[i][j]][1];
            // int mx = wall[a[i][j]][1];
            // cout << wall[a[i][j]][1] << endl;
            // cout << a[i][j] << endl;
        }
    }
    
    cout << ans << endl;

}

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

int main(void){
    int K, leng;
    string T;
    cin >> T;

    leng = (int)(T.length());
    /*
    if(leng<=K){
        cout << S << endl;
    }else{
        S.erase(K);
        S.insert(K,"...");
        cout << S << endl;
    }
    */
   int i;
   for(i=0;i<leng;i++){
       if(T[i]=='?'){
           if((i>0)&&(T[i-1]=='P')){
               T[i] = 'D';
           }else if((i<leng-1) && (T[i+1] == 'D')){
               T[i] = 'P';
           }else{
               T[i] = 'D';
           }
       }
   }
   cout << T << endl;
    
    return 0;
}

/*
7
nikoandsolstice
*/

Measured memory_bytes: 3756
#include<stdio.h>
int x,y,z,r;
int t(int t){return t*t*t;}
int main()
{
	for(;scanf("%d",&z),z;)
	{
		z=t(z);
		r=1000000000;
		for(x=1;t(x)<=z;x++)
			for(y=1;t(x)+t(y)<=z;y++)
			{
				r=r>z-(t(x)+t(y))?z-(t(x)+t(y)):r;
			}
		printf("%d\n",r);
	}
	return 0;
}

Measured memory_bytes: 600