akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i) 
#define PI acos(-1)
#define pcnt __builtin_popcountll
#define rng(a) a.begin(), a.end()
#define sz(x) (int)(x).size()
#define v(T) vector<T>
#define vv(T) v(v(T))
#define fi first
#define se second

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;

template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) {if (a > b) { a = b; return true; } return false; }

ll INF = 1001001001;
ll LINF = 1001001001001001001ll;

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

    ll t1, t2, a1, a2, b1, b2;
    cin>>t1>>t2>>a1>>a2>>b1>>b2;

    ll da = t1 * a1 + t2 * a2;
    ll db = t1 * b1 + t2 * b2;
    if (da == db) {
        cout<<"infinity"<<endl;
        return 0;
    }
    if (db < da) {
        swap(a1, b1);
        swap(a2, b2);
        swap(da, db);
    }
    if (a1 * t1 < b1 * t1) {
        cout<<0<<endl;
        return 0;
    }

    ll res = db - da;
    ll r = (a1 - b1) * t1;
    ll ans = r / res * 2 + 1;
    if (r % res == 0) ans--;
    cout<<ans<<endl;
}


Measured memory_bytes: 384
#include <bits/stdc++.h> //C++の標準ライブラリを一行で一括でインクルードする
#include <math.h> //数学関数と数学定数を利用する
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}

int main(){
  string s;
  cin >> s;
  map<char,int> mp;
  
  rep(i,s.size()){
    mp[s[i]]++;
  }
  
  for(auto a:mp){
    if(a.second > 1){
      cout << "no";
      return 0;
    }
  }
  
  cout << "yes";
  return 0;
}

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

int main() {
	int w, h, x, y, r;
	cin >> w >> h >> x >> y >> r;
	if (x - r<0 || y - r<0 || x + r>w || y + r>h)cout << "No" << endl;
	else cout << "Yes" << endl;
}


Measured memory_bytes: 3112
#include <iostream>

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

using namespace std;

int main() {
    while (true) {
        int m, f, r;
        cin >> m >> f >> r;

        if (m == -1 && f == -1 && r == -1) break;

        auto sum = m + f;
        if (m == -1 || f == -1) cout << "F\n";
        else if (sum >= 80) cout << "A\n";
        else if (65 <= sum) cout << "B\n";
        else if (50 <= sum) cout << "C\n";
        else if (30 <= sum) {
            if (r >= 50) cout << "C\n";
            else cout << "D\n";
        } else cout << "F\n";
    }
    return 0;
}


Measured memory_bytes: 3052
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pi 3.141592653589793238
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll MOD=1e9+7;

void solve()
{

	ll n;
	cin>>n;
	ll a[5];
	for(ll i=0;i<5;i++)
	{
		cin>>a[i];
	}
	sort(a,a+5);
	ll x;
	if(a[0]>=n)
	{
		cout<<5;
		return;
	}
	// cout<<a[0];
	if(n%a[0]!=0)
		x=(n/a[0])+1;
	else
		x=n/a[0];
	// cout<<x<<endl;
	cout<<x+4;
	return;
}

int main()
{
        fast;
        ll q;
        q=1;
        // cin>>q;
        while(q--)
        	solve();
        
        return 0;
}


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

#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,x,n) for(int i=x; i<(n); i++)
#define rrep(i,n) for(int i=(n)-1; i>=0; i--)
#define all(X) (X).begin(),(X).end()
#define X first
#define Y second
#define pb push_back
#define eb emplace_back

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

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

template<class A, size_t N, class T> void Fill(A (&a)[N], const T &v){ fill( (T*)a, (T*)(a+N), v ); }

const ll INF = 1e9+7;


int main(){
	ios_base::sync_with_stdio(false);
	int N, Q;
	typedef pair<pii,int> ppi;
	priority_queue<ppi,vector<ppi>,greater<ppi>> query;

	cin >> N >> Q;
	rep(i,N){
		int S, T, X;
		cin >> S >> T >> X;
		query.emplace(pii(S-X, T-X), X);
	}
	rep(i,Q){
		int D;
		cin >> D;
		query.emplace(pii(D, INF), i);
	}

	int ans[200005]={};
	priority_queue<pii,vector<pii>,greater<pii>> que;
	while( !query.empty() ){
		auto p = query.top();
		query.pop();
		if( p.X.Y == INF ){
			while( que.size() && que.top().Y <= p.X.X ) que.pop();
			ans[p.Y] = (que.empty() ? -1 : que.top().X);
		}else{
			que.emplace(p.Y, p.X.Y);
		}
	}

	rep(i,Q) cout << ans[i] << endl;

	return 0;
}

Measured memory_bytes: 10476
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
#ifndef FAST_IO
 #define IOS ios_base::sync_with_stdio(false);cin.tie(nullptr);
#endif

#define int long long
#define FILE_IO freopen("input.txt","r",stdin)/#define int long long
#define f first
#define s second
#define endl '\n'
#define all(c) c.begin(),c.end()
#define bp __builtin_popcount
#define debug(x) cerr << #x << " = " << x << endl;

const int MOD = 1e9 + 7;
const int INF = 1000000000;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename T>void print(T t){for(auto &it : t)cout<<it<<" ";}
inline int powerexp(int a, int b, int m = MOD){ int res = 1;while(b){if(b&1)res = res * a % m;a = a * a % m,b >>= 1;}return res % m;}
inline int modinv(int a){ return powerexp(a,MOD-2,MOD);}
inline int lcm(int a, int b){ int g = __gcd(a,b);return a/g*b;}
inline int add(int x, int y){ x += y; if (x >= MOD) x -=  MOD; return x;}
inline int mul(int x, int y){ return (x * 1ll * y) % MOD;}
inline int sub(int x, int y){ x -= y; if (x<0) x += MOD; return x ;}

//-------------------< start here >-------------------------// 

void solve(){
  int n;
  cin >> n;
  vector<int> h;
  for(int i = 0; i < n; i++){
	   int x;
	   cin >> x;
	   h.push_back(x);  
	}
   vector<int> copy = h;
   if ((int)h.size() == 1) cout << "Yes" << endl;
   else{
	  for(int i = 0; i  < n; i++){
		  if (h[i] > h[i - 1]) h[i]--;
		  else continue;
		}   
	bool ok = true;
    for(int i = 0; i + 1 < n; i++){
		  if (h[i] <= h[i + 1]) continue;
		  else {
		   ok = false;
		   break;	  
		}
	   }
	  if (ok) cout << "Yes" << endl;
	  else cout << "No" << endl;
	 }
}

//-----------------------------
//comment from here for TOPCODER 
int32_t main(){
   IOS;
   solve();
   //find();
   #ifdef LOCAL_DEFINE
   cerr << "time elapsed " << (double)clock()/CLOCKS_PER_SEC << endl;
   #endif
}


Measured memory_bytes: 1908
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>

#define FOR(i, a, b) for (int i = (a); i < int(b); ++i)
#define RFOR(i, a, b) for (int i = (b)-1; i >= int(a); --i)
#define REP(i, n) FOR(i, 0, n)
#define REP1(i, n) FOR(i, 1, int(n) + 1)
#define RREP(i, n) RFOR(i, 0, n)
#define RREP1(i, n) RFOR(i, 1, int(n) + 1)
#define ALL(c) begin(c), end(c)

int _ = (
#ifndef LOCAL
    std::cin.tie(nullptr), std::ios::sync_with_stdio(false),
#endif
    std::cout.precision(10), std::cout.setf(std::ios::fixed));

using ll = long long;
using ull = unsigned long long;
using ld = long double;
template <typename T> using vec = std::vector<T>;
using namespace std;

int main() {
  ll N, x;
  cin >> N >> x;
  vec<ll> a(N);
  REP(i, N) cin >> a[i];

  sort(ALL(a));
  for (ll i = 0; i < N; i++) {
    if (x - a[i] == 0) {
      cout << i + 1 << endl;
      return 0;
    } else if (x - a[i] < 0) {
      cout << i << endl;
      return 0;
    } else {
      x = x - a[i];
    }
  }
  cout << N - 1 << endl;
  return 0;
}


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

typedef long long int ll;

ll absl(ll n)
{
	if(n<0)
	{
		return -1*n;
	}
	return n;
}
string cal(string& s1,string &s2)
{
	int i,j;
	int n=s1.size();
	int m=s2.size();
	vector<vector<int > > dp(n+1,vector<int>(m+1,0));
	for(i=1;i<=n;i++)
	{
		for(j=1;j<=m;j++)
		{
			if(s1[i-1]==s2[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=n;
	j=m;
	string res;
	while(i>0 && j>0)
	{
		if(s1[i-1]==s2[j-1])
		{
			res+=s1[i-1];
			i--;
			j--;
		}
		else
		{
			if(dp[i][j-1]<dp[i-1][j])
			{
				i--;
			}
			else
			{
				j--;
			}
		}
	}
	reverse(res.begin(),res.end());
	return res;
}

int main()
{
	string s1,s2;
	cin>>s1>>s2;
	cout<<cal(s1,s2);
	return 0;
}


Measured memory_bytes: 35584
import sys, os, math, bisect, itertools, collections, heapq, queue
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict, deque

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N, M = il()
    A = [iss() for _ in range(N)]
    B = [iss() for _ in range(M)]

    for i in range(N - M + 1):
        for j in range(N - M + 1):
            t = i
            for b in B:
                if A[t][j:j + M] == b:
                    t += 1
                else:
                    break
            else:
                print('Yes')
                exit()
    else:
        print('No')


if __name__ == '__main__':
    main()


Measured memory_bytes: 10012
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define Rep(i,n) for(intl i=0,nn=(intl)(n);i<nn;++i)
#define Rep1(i,n) for(intl i=1,nn=(intl)(n)+1;i<nn;++i)
#define vec vector
#define fi first
#define se second
#define eb emplace_back
#define SortA(v) sort(v.begin(), v.end())
#define SortD(v) sort(v.rbegin(),v.rend())
#define All(a) (a).begin(),(a).end()
#define Input(a) for(intl ii=0,nn=(intl)(a.size());ii<nn;ii++){cin>>(a).at(ii);}
#define Input2(a,b) for(intl ii=0,nn=(intl)(a.size());ii<nn;ii++){cin>>(a).at(ii);cin>>(b).at(ii);}
#define mp make_pair
using li = int64_t;
using intl = int64_t;
using vi = vec<intl>;
using vb = vec<bool>;
using vvi = vec<vi>;
using pi = pair<intl,intl>;
using vpi = vec<pi>;
using si = set<intl>;
using vsi = vec<si>;
using mii = map<intl,intl>;
using vmii = vec<mii>;
vec<intl> dx = {0, 1, 0, -1, 1, 1, -1, -1};
vec<intl> dy = {1, 0, -1, 0, 1, -1, 1, -1};
constexpr intl INF = 9223372036854775807;


intl modpow(intl a, intl n, intl p){
  intl res = 1;
  while (n > 0){
    if (n&1){res = (res * a) % p;}
	a = (a * a) % p;
    n >>= 1;
  }
  return res;
}

intl modinv(intl a, intl p){
  if (a == 0){
    cout << "/0 at modinv"<<endl;
    exit(0);
  }
  if (a < 0){
    cout << "/- at modinv" <<endl;
    exit(0);
  }
  if (a==1){return 1;}
  if (a > p){return modinv(a%p, p);}

  return p - ( modinv(p%a,p) * (p/a) ) % p;
}

intl modcomb(intl n, intl k, intl p){
  if (k > n || k < 0 || n < 0){
    cout << "error at modcomb"<<endl;
    exit(0);
  }
  if (2*k > n){ k = n-k;}
  if (k ==0){return 1;}
  intl c=1;
  for (intl i = 0; i < k; i++){
    c =( c * ( (n-i) % p ) % p ) * modinv(i+1,p) % p;
  }
  return c;
}

int main(){
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  constexpr intl mod = 1000000007;


  li N;
  cin>>N;

  vi A(N);

  Input(A);

  li inv2=modinv(2,mod);
  li sum=0;
  li sumsq=0;



  for(auto a:A){
    sum +=a;
    sum %=mod;
    sumsq += a*a;
    sumsq %= mod;
  }

  sum *=sum;
  sum%=mod;

  sum -= sumsq;
  sum %= mod;
  
  sum *= inv2;

  sum %= mod;

  if(sum<0)sum+=mod;

  cout<<sum;

}

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

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

    int n;
    cin>>n;
    int ans=0;
    for(int i=0;i<n;i++){
        int a;
        cin>>a;
        while(a%2==0){
            ans++;
            a/=2;
        }
    }
    cout<<ans<<endl;

}

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

int main(){

  double a,b;

  scanf("%lf %lf",&a,&b);

  if (a > 100 || b > 100 || a <= 0 || b <= 0){
    return 0;
  }

  if (a <= b){
    printf("unsafe");
    return 0;
  }
  else{
    printf("safe");
    return 0;
  }

  return 0;
}

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

int main() {
  int a = 23, b = 27 ;
  cin >> a >> b ;
  if ( (a*b)% 2 == 0) { 
    cout << "Even" << endl;
  }
  else {
    cout << "Odd" << endl;
  }
}


Measured memory_bytes: 256
#coding:utf-8
#1_7_A 2015.4.5
while True:
    m,f,r = map(int,input().split())
    if m == f == r == -1:
        break
    elif m == -1 or f == -1 or m + f < 30:
        print('F')
    elif m + f >= 80:
        print('A')
    elif 65 <= m + f < 80:
        print('B')
    elif 50 <= m + f < 65:
        print('C')
    elif 30 <= m + f < 50:
        if r >= 50:
            print('C')
        else:
            print('D')

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

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

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

ll D[100005];

int main()
{
    ll N, Q;
    cin >> N >> Q;
    string S;
    cin >> S;
    D[0] = 0;
    REP(i, N)
    {
        D[i + 1] = D[i];
        if (i > 0 && S[i] == 'C' && S[i - 1] == 'A')
        {
            D[i + 1]++;
        }
    }
    REP(i, Q)
    {
        ll l, r;
        cin >> l >> r;
        ll s = D[r] - D[l - 1];
        if (l - 2 >= 0 && S[l - 2] == 'A' && S[l - 1] == 'C')
            s--;
        cout << s << endl;
    }
    return 0;
}

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

int main() {
   int K, A, B;
   LL curr = 1;
   scanf("%d %d %d", &K, &A, &B);
   if (K >= A - 1) {
      K -= A - 1;
      curr = A;
   }//if
   if (B - A >= 2) {
      curr += (K / 2) * LL(B - A);
      if (K & 1)
         curr++;
   }//if
   else
      curr += K;
   printf("%lld\n", curr);
   return 0;
}//main


Measured memory_bytes: 256
n = int(input())
tmp = n // 15
tmp2 = n % 15
d = [(15*(tmp) + i) for i in [0,1,2,0,4,0,0,7,8,0,0,11,0,13,14]]
for i in [0,3,5,6,9,10,12]:
    d[i] = 0
print((tmp **2 * 60) + sum(d[:(tmp2+1)]))

Measured memory_bytes: 9208
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rep3(i, l, n) for (int i = l; i < n; ++i)
#define chmax(a, b) a = (a >= b ? a : b)
#define chmin(a, b) a = (a <= b ? a : b)
#define out(a) cout << a << endl
#define outa(a, n) { rep(_, n) cout << a[_] << " "; cout << endl; }
#define outp(a, n) { cout << endl; rep(_, n) cout << a[_].F << " " << a[_].S << endl; }
#define SZ(v) (int)v.size()
#define inf (int)(1e9+7)
#define abs(x) (x >= 0 ? x : -(x))
#define ceil(a, b) a / b + !!(a % b)
#define FIX(a) fixed << setprecision(a)
#define LB(v, n) (int)(lower_bound(all(v), n) - v.begin())
#define UB(v, n) (int)(upper_bound(all(v), n) - v.begin())
ll pow(ll a, int b) {return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1;}
ll nck(int n, int k) { ll ret = 1; rep(i, k) {ret *= n - i; ret /= i + 1; } return ret; } // n <= 60
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }



int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    
    int q, h, s, d;
    cin >> q >> h >> s >> d;
    ll one, two;
    one = min({4 * q, 2 * h, s}); // 奇数なら最後
    two = min({8 * q, 4 * h, 2 * s, d});
    
    int n;
    cin >> n;
    out(two * (n / 2) + one * (n % 2 != 0));
}



Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#define mod 1000000007 //1e9+7
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 201

void calc(int n){
  int w,h,x,y,s,t;
  int sum[SIZE][SIZE] = {};

  scanf("%d%d",&w,&h);

  for(int i=0;i<n;i++){
    scanf("%d%d",&x,&y);

    sum[y][x]++;
  }

  for(int i=0;i<=h;i++){
    for(int j=0;j<=w;j++){
      sum[i][j+1] += sum[i][j];
    }
  }
  for(int i=0;i<=h;i++){
    for(int j=0;j<=w;j++){
      sum[i+1][j] += sum[i][j];
    }
  }

  scanf("%d%d",&s,&t);

  int ans = 0;

  for(int i=1;i+t-1<=h;i++){
    for(int j=1;j+s-1<=w;j++){
      ans = max(ans, sum[i+t-1][j+s-1] + sum[i-1][j-1] - sum[i-1][j+s-1] - sum[i+t-1][j-1]);
    }
  }
  
  printf("%d\n",ans);
}

int main(){
  int n;
  
  while(1){
    scanf("%d",&n);
    if(n==0) break;
    calc(n);
  }
  
  return 0;
}

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

int main() {
	std::string sst;
	std::cin >> sst;
	int i = 0;
	int count = 16;
	std::string codefest = "CODEFESTIVAL2016";
	for (int i = 0;i < 16;i++)
		count-= (sst.c_str()[i] == codefest.c_str()[i]);
	std::cout << count << std::endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{	int a,b,i;
	char op;
	for(i=1;i>0;i++){
		scanf("%d %c %d",&a,&op,&b);
		if(op=='+')
		{printf("%d\n",a+b);
		}
		else if(op=='-')
		{printf("%d\n",a-b);
		}
		else if(op=='*')
		{printf("%d\n",a*b);
		}
		else if(op=='/'){
			printf("%d\n",a/b);
		}else if(op=='?') {
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 600
h,w,k=map(int,input().split())
c=[]
for i in range(h):
    c.append(list(input()))

ans=0

for i in range(2**h):
    for j in range(2**w):
        temph=format(i, '06b')
        tempw=format(j, '06b')
        temp=0
        for x in range(h):
            for l in range(w):
                #print(temph, temph[-1-x], c[x][l])
                #if c[x][l]=='#':
                if temph[-1-x]=='0' and tempw[-1-l]=='0' and c[x][l]=='#':
                    temp += 1
        #print(temp)
        if temp==k:
            ans+=1

print(ans)

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

using namespace std;

int main(){
  int F; cin >> F;
  //the position after i seconds
  int i=1,p=0;
  if(F == 1) cout << 1 << endl;
  else{
    while(p+2*i+1 < F){
      p=p+i;
      i++;
    }
    if(p+2*i+1 == F) cout << i+1 << endl;
    else{
      cout << i+1 << endl;
    }
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    long long n, x, a[100010], i, ans=0;
    cin >> n >>x;
    for(i=0;i<n;i++){
        cin >> a[i];
    }
    
    for(i=0;i<n-1;i++){
        if((a[i]+a[i+1])>x){
            if(a[i+1]-(a[i+1]+a[i]-x)>=0){
                ans+=a[i+1]+a[i]-x;
                a[i+1]=x-a[i];
            }
            else {
                ans+=a[i+1];
                a[i+1]=0;
                ans+=a[i]-x;
                a[i]=a[i]-(x-a[i+1]);
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<deque>
#include<iterator>
#include<list>
#include<queue>
#include<stack>
#include<vector>
#include<string>
#include<map>
#include<algorithm>
#include<math.h>
#include<utility>
#include<functional>
const int MOD = 1e9 + 7;
typedef long long ll;
using namespace std;
using Graph = vector<vector<int>>;

int main() {
    int m1,d1,m2,d2;
    cin >> m1 >> d1 >> m2 >> d2;
    int s = 0;
    if (d2 == 1 && m1 != m2 && d1 != d2) {
        s = 1;
    }
    cout << s << endl;
}

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

//#define int long long
typedef long long ll;
//const int INF = 2e9;
//const ll INF = 9e18;


signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N;
    cin >> N;
    vector<bool> p(55556,true);
    p[1] = false;
    for (int i=2;i<=55555;i++){
        for (int j=i*2;j<=55555;j+=i){
            p[j] = false;
        }
    }
    vector<int> ans;
    int num = 0;
    for (int i=2;i<=55555;i++){
        if (p[i] && i%5==1) {
            ans.push_back(i);
            num++;
        }
        if (num == N) break;
    }
    for (int i=0;i<ans.size();i++) cout << ans[i] << "\n";
}

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

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

signed main(){

  ll n,x,m;
  cin>>n>>x>>m;

  ll ans = 0;
  set<ll> st;
  for(ll i=0;i<n;++i){
    st.emplace(x);
    ans += x;
    x = x*x%m;

    if(st.find(x)!=st.end()){
      ll val = x;
      ll looplen = 0;
      ll loopgain = 0;
      do{
        loopgain += val;
        val = val*val%m;
        looplen++;
      }while(val!=x);
      ans += (n-i-1)/(looplen)*loopgain;
      ll len = (n-i-1)%looplen;
      rep(j,len){
        ans += x;
        x = x*x%m;
      }
      break;
    }
  }
  cout<<(ans)<<endl;

}

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

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

    if((abs(a - b) <= d && abs(b - c) <= d) || abs(a - c) <= d) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
s=input()
k=int(input())

ck=0
ne=True

if len(set(s))==1:
    print((len(s)*k)//2)
    ne=False
elif s[0]==s[-1]:
    for i in range(len(s)):
       if s[i] != s[0]:
           s=s[i:]+s[:i]
           ck=i
           break

if ne:    
    #print(s)
    ans=0
    
    M=[]
    now=s[0]
    cnt=1
    for c in s[1:]:
        if c==now:
            cnt+=1
        else:
            M.append(cnt)
            #print(M)
            ans+=cnt//2
            cnt=1
            now=c
            
    M.append(cnt)
    ans+=cnt//2
    #print(M)
    
    ans=ans*k
    
    #print(ans)
    
    if ck>0:
       for i in range(1,len(s)):
           if s[-i] != s[-1]:
               ck2=i-1
               break
       ans-=ck2//2
       ans+=(ck2-ck)//2+ck//2
    
    print(ans)

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


class SegmentTree():
    def __init__(self, S):
        self.size = 19
        self.array = [set()] * (2**(self.size + 1) - 1)
        for i, c in enumerate(S):
            self.array[i + 2**self.size - 1] = {c}
        for i in range(2**self.size - 1)[::-1]:
            self.array[i] = self.array[2 * i + 1] | self.array[2 * i + 2]

    def subquery(self, l, r, k, i, j):
        # 区間[i,j)の中で区間[l,r)の文字列の集合を返す
        if j <= l or r <= i:
            return set()
        elif l <= i and j <= r:
            return self.array[k]
        else:
            l_set = self.subquery(l, r, 2 * k + 1, i, (i + j) // 2)
            r_set = self.subquery(l, r, 2 * k + 2, (i + j) // 2, j)
            return l_set | r_set

    def query(self, l, r):
        # [l,r)に含まれる文字の種類数
        return len(self.subquery(l, r, 0, 0, 2**self.size))

    def update(self, i, c):
        tmp = i + 2**self.size - 1
        self.array[tmp] = {c}
        while tmp > 0:
            tmp = (tmp - 1) // 2
            self.array[tmp] = self.array[2 * tmp + 1] | self.array[2 * tmp + 2]


def main():
    N = int(input())
    S = [ord(_) - 97 for _ in list(input())]
    Q = int(input())
    tree = SegmentTree(S)
    for q in range(Q):
        t, i, c = input().split()
        if t == '1':
            i = int(i) - 1
            tree.update(i, ord(c) - 97)
        else:
            l, r = int(i) - 1, int(c)
            print(tree.query(l, r))


if __name__ == '__main__':
    main()

Measured memory_bytes: 471764
#include <stdio.h>
int main () {
    int x;
    scanf("%d", &x);
    int a[x];
    for (int i;i<x;i++) {
        scanf("%d",&a[i]);
    }
    // printf("\n");
    for (int i = x-1; i >= 0; i--)
    {
        printf("%d",a[i]);
        if (i!=0) printf(" ");
    }
    printf("\n");
}


Measured memory_bytes: 2036
#include "bits/stdc++.h"
 
typedef long long ll;
#define int ll
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/2
#define all(x) (x).begin(),(x).end()
#define debug(x) cerr<<#x<<": "<<x<<endl
#define debug_vec(v) cerr<<#v<<":";rep(i,v.size())cerr<<" "<<v[i];cerr<<endl
using namespace std;

// int MOD = 998244353;
int MOD = 1000000007;


signed main(){
    
    ll n;
    string s;
    cin >> n >> s;

    if(s[0] == 'W' || s[2*n-1] == 'W'){
        cout << 0 << endl;
        return 0;
    }

    vector<char> lr(2*n);
    lr[0] = 'L';
    lr[2*n-1] = 'R';

    
    for(int i = 1;i < 2*n-1;i++){
        if(s[i] == s[i-1]){
            if(lr[i-1] == 'L')lr[i] = 'R';
            else lr[i] = 'L';
        }else{
            if(lr[i-1] == 'L')lr[i] = 'L';
            else lr[i] = 'R';
        }
    }
    // rep(i,2*n)cerr << lr[i];
    // cerr << endl;
    ll x=0,y=0;
    rep(i,2*n){
        if(lr[i] == 'L')x++;
        else y++;
    }
    if(x != y){
        cout << 0 << endl;
        return 0;
    }


    if((lr[2*n-1] == lr[2*n-2]) == (s[2*n-1] == s[2*n-2])){
        cout << 0 << endl;
        return 0;
    }

    ll lc = 0;
    ll ans = 1;
    rep(i,2*n){
        if(lr[i] == 'L')lc++;
        else{
            ans *= lc;
            ans %= MOD;
            lc--;
        }
    }
    for(int i = 1;i <= n;i++){
        ans *= i;
        ans %= MOD;
    }
    cout << ans << endl;
    
    return 0;
}

// g++ -std=c++14 code1.cpp
// rm -r -f test;oj dl https://jsc2019-qual.contest.atcoder.jp/tasks/jsc2019_qual_a
// rm -r -f test;oj dl https://cf17-final-open.contest.atcoder.jp/tasks/cf17_final_a
// rm -r -f test;oj dl http://abc125.contest.atcoder.jp/tasks/abc125_a


Measured memory_bytes: 772
import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_tuple(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, read().split())))
    return ret


def read_col(H):
    '''
    H is number of rows
    A列、B列が与えられるようなとき
    ex1)A,B=read_col(H)    ex2) A,=read_col(H) #一列の場合
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return tuple(map(list, zip(*ret)))


def read_matrix(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return ret
    # return [list(map(int, read().split())) for _ in range(H)] # 内包表記はpypyでは遅いため


MOD = 10**9 + 7
INF = 2**31  # 2147483648 > 10**9
# default import
from collections import defaultdict, Counter, deque
from operator import itemgetter
from itertools import product, permutations, combinations, combinations_with_replacement
from bisect import bisect_left, bisect_right  # , insort_left, insort_right

# https://atcoder.jp/contests/abc128/tasks/abc128_d
N, K = read_ints()
V = read_ints()

ans = 0
for i, j in combinations_with_replacement(range(N + 1), r=2):
    # V[0:i]とV[j:]はとったことにしてみる
    k = i + (N - j)
    if k > K:
        continue
    Vsub = V[:i] + V[j:]
    # print(k)
    # print(Vsub)
    Vsub.sort(reverse=True)
    while Vsub and k < K and Vsub[-1] < 0:
        k += 1
        Vsub.pop()
    # print(Vsub)
    ans = max(sum(Vsub), ans)
print(ans)


Measured memory_bytes: 41068
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define forever while (true)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
template<typename A> using V = std::vector<A>;
template<typename A> using F = std::function<A>;
template<typename A, typename B> using P = std::pair<A, B>;
using pii = P<int, int>;
using vi = V<int>;
using vd = V<double>;
using vs = V<std::string>;
using vpii = V<pii>;
using vvi = V<vi>;
using vvpii = V<vpii>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
template<typename T> std::istream &operator>>(std::istream &is, std::vector<T> &v) { for (T &x : v) is >> x; return is; }
using namespace std;
// clang-format on

template<typename InputIterator> constexpr std::string join(InputIterator first, InputIterator last, const std::string &sep) {
  if (first == last) return "";
  std::stringstream ss;
  ss << *(first++);
  for_each(first, last, [&](auto &x) { ss << sep << x; });
  return ss.str();
}

main {
  int r, c;
  cin >> r >> c;
  vvi v(r, vi(c));
  cin >> v;
  v.resize(r + 1);
  for (auto &x : v) {
    x.resize(c + 1);
    x[c] = accumulate(all(x), 0);
  }
  rep(i, c + 1) rep(j, r) v[r][i] += v[j][i];
  for (auto &x : v) cout << join(all(x), " ") << endl;
}

Measured memory_bytes: 3196
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rrep(i,n) for(ll i = 1; i <= (n); ++i)
#define drep(i,n) for(ll i = (n)-1; i >= 0; --i)
#define all(v) v.begin(),v.end()
#define len(x) (ll)(x).length()
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define pb push_back
#define sz(x) (ll)(x).size()
#define v(T) vector<T>
#define vv(T) vector<vector<T>>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
ll gcd(ll a,ll b){if(a%b==0){return b;}else{return(gcd(b,a%b));}}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
const int INF=1e9;
const ll MX = 1e18;
const ll MOD=INF+7;
const int di[] = {-1,0,1,0};
const int dj[] = {0,-1,0,1};
const double PI=acos(-1);
const string tr="abcdefghijklmnopqrstuvwxyz";
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
#define YN {puts("YES");}else{puts("NO");}
const ll MAX = 1000001;
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {fac[0] = fac[1] = 1;finv[0] = finv[1] = 1;inv[1] = 1;for (ll i = 2; i < MAX; i++){fac[i] = fac[i - 1] * i % MOD;inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;finv[i] = finv[i - 1] * inv[i] % MOD;}}
long long COM(ll n, ll k){if (n < k) return 0;if (n < 0 || k < 0) return 0;return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;}
ll llpow(ll n,ll i){ll cnt=n;  for(ll j=0;j<i-1;j++){n*=cnt;}return n;}
bool ip/*is_prime*/(long long N) {if (N == 1) return false;for (long long i = 2; i * i <= N; ++i) {if (N % i == 0) return false;}return true;}
int digit(ll N) {int ans = 0;while (N) {++ans;N /= 10;}return ans;}
vector<pair<ll,ll>> pf/*prime_factorize*/(ll n){vector<pair<ll,ll>> res;for(ll a=2;a*a<=n;a++){if(n%a!=0) continue;ll ex=0;while(n%a==0){ex++;n/=a;}res.pb({a,ex});}if(n!=1) res.pb({n,1});return res;}

int main() {
  ll n,m;
  cin>>n>>m;
  if(n==1){
    cout<<m<<endl;
    return 0;
  }
  ll ans=1;
  auto p=pf(m);
  for(auto x:p){
    if(x.second<n) continue;
    ans*=llpow(x.first,(x.second/n));
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
// #define debug(a) cout << "["; rep(i,a.size()) cout << a[i] << ", "; cout<<"]"<< endl;

const ll mod = 1000000007;

int main() {
    int x; cin >> x;
    if(30 <= x){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 3644
N, T = map(int, input().split())
lst = []
for i in range(N):
  lst.append(list(map(int, input().split())))

ans = 'TLE'

for i in lst:
  if (i[1] <= T):
    if (ans == 'TLE'):
      ans = i[0]
    else:
      if (i[0] < ans):
        ans = i[0]
print(ans)


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

#define TRACE(x) x
#define WATCH(x) TRACE(cout << #x" = " << x << endl)
#define WATCHR(a, b) TRACE(for (auto it=a; it!=b;) cout << *(it++) << " "; cout << endl)
#define WATCHC(V) TRACE({cout << #V" = "; WATCHR(V.begin(), V.end());})

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

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vs = vector<string>;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

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

    int N, A, B;
    cin >> N >> A >> B;
    cout << min(A, B) << " " << max(0, A + B - N) << "\n";

    return 0;
}



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

R,C,K=list(map(int,input().split()))
itemMap = [[0]*(C+1) for _ in range(R+1)]
dp =[[[0]*(C+1) for _ in range(R+1)] for _ in range(4)]

for _ in range(K):
    r,c,v=list(map(int,input().split()))
    itemMap[r-1][c-1]=v

for ir in range(R):
    for ic in range(C):
        for k in range(2,-1,-1):
            #-拾う拾わない遷移-#
            dp[k+1][ir][ic] = max(dp[k+1][ir][ic],dp[k][ir][ic]+itemMap[ir][ic])
        #-位置遷移-#
        for k in range(4):
            dp[0][ir+1][ic] = max(dp[0][ir+1][ic],dp[k][ir][ic])
            dp[k][ir][ic+1] = max(dp[k][ir][ic+1],dp[k][ir][ic])

ans = 0
for k in range(4):
    ans = max(ans,dp[k][R-1][C-1])
print(ans)
                            
                        


Measured memory_bytes: 429564
#include <stdio.h>

void judge_era(int year, int month, int day);

int main(void)
{
    int y, m, d;
    while ((scanf("%d %d %d", &y, &m, &d)) != EOF) {
        judge_era(y, m, d);
    }
    return 0;
}

void judge_era(int year, int month, int day)
{

//年号を比較するため、日付を数に変換する                                        
//具体的には、day + month * 100 + year * 10000                                  
//例として2013 11 20 は　20131120 となる                                        

    int date = day + month * 100 + year * 10000;
    if (date <= 18680907) {
      printf("pre-meiji\n");
    } else if (date <= 19120729) {//前の条件否定　つまり date > 18680908 のとき
      printf("meiji %d %d %d\n", year - 1867, month, day);
    } else if (date <= 19261224) {//以下同様                                    
      printf("taisho %d %d %d\n", year - 1911, month, day);
    } else if (date <= 19890107) {
      printf("showa %d %d %d\n", year - 1925, month, day);
    } else if (date >= 19890108) {
      printf("heisei %d %d %d\n", year- 1988, month, day);
    }
}

Measured memory_bytes: 1036
# -*- coding: utf-8 -*-
# INPUT

num = int(input())

musics = []

for i in range(0,int(num)):
  music = list(map(str, input().split()))
  musics.append(music)

sleep = input()

flg = False

ans = 0
for i in range(0,int(num)):
  if flg:
    ans = ans + int(musics[i][1])

  if musics[i][0] == sleep:
    flg = True
         
print(ans)

Measured memory_bytes: 3064
#include <math.h>

#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
#define PI 3.14159265358979323846264338327950L
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define SIZE_OF_ARRAY(array) (sizeof(array) / sizeof(array[0]))

int main() {
  int A, B;
  cin >> A >> B;

  if (A + B >= 10)
    cout << "error" << endl;
  else
    cout << A + B << endl;
}


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

using namespace std;

int main(void){
	string s;
	int c = 0;
	cin >> s;
	if(s[0] == 'o') ++c;
	if(s[1] == 'o') ++c;
	if(s[2] == 'o') ++c;
	printf("%d\n", 700 + (c*100));
	return 0;
}

Measured memory_bytes: 764
n = int(input())
ans = 0
for m in range(1, int(n**.5) + 1):
    ans += m * (m + (n // m)) * ((n // m) + 1 - m)
k = int(n**.5)
ans -= k * (k + 1) * (2 * k + 1) // 6

print(ans)

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

#define name ""
#define ini freopen(name".inp","r",stdin); freopen(name".out","w",stdout)
#define long long long
#define db double
#define pii pair <int, int>
#define pll pair <long, long>
#define all(c) c.begin(), c.end()
#define fastio ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
template <class T> inline void chmin(T &a, const T& val) { if (a > val) a = val; }
template <class T> inline void chmax(T &a, const T& val) { if (a < val) a = val; }
template <class T> long sqr(T a) { return 1ll * a * a; }
template <class T> void compress(T &a){
  sort(all(a)); a.resize(unique(all(a)) - a.begin());  
}

const db pi = acos(-1.00);
const db eps = 1e-6;
const int INF = 1e9;
const int MOD = 1e9+7;
const int dx[4] = {0, 0, -1, 1};
const int dy[4] = {-1, 1, 0, 0};

const string s[4] = {"AC", "WA", "TLE", "RE"};

int cnt[4];

int main()
{
  fastio;
  int n; cin >> n;
  for (int i = 1; i <= n; i++){
    string cur; cin >> cur;
    for (int j = 0; j < 4; j++){
      if (cur == s[j]) cnt[j]++;
    }
  }
  for (int i = 0; i < 4; i++){
    cout << s[i] << ' ' << 'x' << ' ' << cnt[i] << '\n';
  }
  return 0;
}

Measured memory_bytes: 3564
#include <iostream>
#include <algorithm>
using namespace std;
string s;
int k,ans;
inline void dfs(int pos,int x,int flag)
{
	if(pos==s.size())
	{
		if(!x) ++ans;
		return ;
	}
	if(!x)
	{
		++ans;
		return ;
	}
	for(int i='1';i<='9';i++)
	{
		if(i>s[pos]&&flag) break;
		if(i>=s[pos]) dfs(pos+1,x-1,flag);
		if(i<s[pos]) dfs(pos+1,x-1,0);
	}
	dfs(pos+1,x,flag&(s[pos]=='0'));
}
int main(int argc, char** argv) {
	cin >> s >> k;
	dfs(0,k,1);
	cout << ans;
	return 0;
}

Measured memory_bytes: 3148
#include <cstdio>
using namespace std;

int s[1010][2],n,m,ans;
int f[1010];
int min(int a,int b){
	return a<b?a:b;
}
int main(){
	scanf("%d%d",&n,&m);
	for(int i=0;i<m;i++){
		scanf("%d%d",&s[i][0],&s[i][1]);
		//s[i][0]--;]s[i][1]--;
	}
	for(int i=0;i<m;i++){
		for(int j=i+1;j<m;j++){
			if(s[j][1]<s[i][1]||(s[j][1]==s[i][1]&&s[j][0]<s[i][0])){
				for(int k=0;k<2;k++){
					int c=s[i][k];
					s[i][k]=s[j][k];
					s[j][k]=c;
				}
			}
		}
	}
	for(int i=0;i<m;i++){
		f[i]=100*n*n;
		int minc=s[i][0];
		for(int j=i-1;j>=0;j--){
			f[i]=min(f[i],f[j]+(s[i][1]-s[j][1])+2*(s[i][1]-minc));
			minc=min(minc,s[j][0]);
		}
		f[i]=min(f[i],s[i][1]+2*(s[i][1]-minc));
	}
	printf("%d\n",f[m-1]+(n+1-s[m-1][1]));
}

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

using namespace std;

#define ll long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define pii pair<ll,ll>
#define vpii vector<pair<ll,ll> >
#define F first
#define S second
#define ld long double
#define built __builtin_popcountll
#define mst(a,i) memset(a,i,sizeof(a))
#define all(x) x.begin(),x.end()
#define itit(it,a) for(auto it=(a).begin(); it!=(a).end(); it++)
#define rep(i,a,b) for(ll i=a; i<b; i++)
#define repr(i,a,b) for(ll i=a; i>b; i--)
#define reprr(i,a,b) for(ll i=a; i>=b; i--)
#define pi 3.14159265358979323846264338327950288419716939937510582097494459230
ll max3(ll x,ll y,ll z) {return max(max(x,y),z);}
ll min3(ll x,ll y,ll z) {return min(min(x,y),z);}
const ll M=2e5+10,M2=1e6+10,mod=1e9+7,inf=1e17+10;

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ll n,k;
	cin >> n >> k;
	vector<string> v(n);
	rep(i,0,n) cin >> v[i];
	sort(all(v));
	string t="";
	for(ll i=0; i<v.size(); i++) t+=v[i];
	cout << t;
	return 0;
}
/* The judge is never wrong! Your code is buggy
   Look for:
 * * Read the problem carefully.
 * * Don't forget to sort(), mod, ll!!!!
 * * Initial value = +/- infinity instead of zero!!!
 * * an easier and alternate approach
 * * read the problem statement carefully
 * * if concept is correct and still WA, try with a different implementation
 * * special cases (n=1?)
 * * overflow (ll vs int?)
 * * array bounds
 * * if you have no idea just guess the appropriate well-known algorithm instead of doing nothing :/
 */


Measured memory_bytes: 256
use std::io;

fn procon_read<T: std::str::FromStr>() ->  Vec<T> {
	let mut buf = String::new();
	io::stdin().read_line(&mut buf).expect("");
	let iter = buf.split_whitespace();
	let mut v: Vec<T> = Vec::new();
	for i in iter {
		v.push(i.parse().ok().unwrap());
	}
	v
}

fn main() {
	let v:Vec<i32> = procon_read();
	let n = v[0];
	let v:Vec<f64> = procon_read();
	let t = v[0];
	let a = v[1];
	let v:Vec<f64> = procon_read();
	let mut mini = (a - (t - v[0]*0.006)).abs();
	let mut p = 1;
	for i in 1..n {
		if mini.abs().min((a - (t - v[i as usize]*0.006)).abs()) != mini.abs() {
			mini = mini.abs().min((a - (t - v[i as usize]*0.006)).abs());
			p = i + 1;
		}
	}
	println!("{}", p);
}

Measured memory_bytes: 4476
def examA():
    X, Y = LI()
    ans = X + Y//2
    print(ans)
    return

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

if __name__ == '__main__':
    examA()


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

int main(){
	int c,hs;
	string s;
	while(1){
		cin>>s;
		if(s=="#") break;
		hs=-1;
		c=0;
		for(int i=0;i<s.size();i++){
			if(((s[i]-'a')==20||(s[i]-'a')==24)&&hs!=1){
				hs=1;
				c++;
			}
			else if((s[i]-'a')==25&&hs!=0){
				hs=0;
				c++;
			}
			if((s[i]-'a')<=6&&hs!=0){
				hs=0;
				c++;
			}
			else if((s[i]-'a')>6&&(s[i]-'a')<=15&&hs!=1){
				hs=1;
				c++;
			}
			else if((s[i]-'a')>15&&(s[i]-'a')<=19&&hs!=0){
				hs=0;
				c++;
			}
			else if((s[i]-'a')>20&&(s[i]-'a')<=23&&hs!=0){
				hs=0;
				c++;
			}
		}
		cout<<c-1<<endl;
	}
	return 0;
}


Measured memory_bytes: 3172
#include<stdio.h>
int main(void){
  int i,n,c=0;
  scanf("%d",&n);
  for(i=1;i<=n;i++){
    if((i>0&&i<10)||(i>99&&i<1000)||(i>9999&&i<100000))
    c++;
  }
  printf("%d\n",c);
  return(0);
}


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

int main(){
  string s;
  ll k;
  cin >> s >> k;
  rep(i, s.length()){
    if(s[i] != '1'){
      cout << s[i] << endl;
      return 0;
    }
    if(k == i + 1){
      cout << "1" << endl;
      return 0;
    }
  }
}	

Measured memory_bytes: 256
n,k=map(int,input().split())
l=list(map(int,input().split()))
sl=sorted(l)
ten=0
for i in range(n):
    for j in range(n):
        if l[i]>l[j]and i<j:ten+=1
pre=sl[0]
jiten=0
c=0
for i,x in enumerate(sl):
    if x==pre:jiten+=c
    else:
        jiten+=i
        c=i
        pre=x

print((ten*k+jiten*(k*(k-1))//2)%(10**9+7))

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

int main () {
  int n;
  cin >> n;
  string ans;
  n -= n/100*100;
  n -= n/10*10;
  if (n==2 || n==4 || n==5 || n==7 || n==9) {
    ans = "hon";
  }
  if (n==0 || n==1 || n==6 || n==8) {
    ans = "pon";
  }
  if (n==3) {
    ans = "bon";
  }
  cout << ans << endl;
}

Measured memory_bytes: 3560
// Sightseeing Tour
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int[][] c = new int[n][n];
		for (int i = 0; i < n; i++)
			for (int j = 0; j < n; j++)
				c[i][j] = scanner.nextInt();
		long result = 0;
		for (int i = 0; i < n; i++)
			for (int j = 0; j < i; j++)
				result += Math.min(c[i][j], c[j][i]);
		System.out.println(result);
		scanner.close();
	}
}

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

void solve() {
    string S;
    cin >> S;
    int ans = 0;
    for (int i = 0; i < S.size() / 2; ++i) {
        char f = S[i];
        char s = S[S.size() - 1 - i];
        if (f != s) ans++;
    }
    cout << (ans) << endl;
}

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


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

using namespace std;

int main()
{
    ios_base::sync_with_stdio(0);
    int n, m;
    cin >> n >> m;
    vector<int> st(n, 0);
    for (int i = 0; i < m; ++i)
    {
        int a, b;
        cin >> a >> b;
        --a;
        --b;
        if (a > b)
            swap(a, b);
        if (a == 0)
            ++st[b];
        else
        {
            ++st[a];
            ++st[b];
        }
    }
    bool db = true;
    for (int i = 0; i < n; ++i)
        if (st[i] % 2 == 1)
            db = false;
    if (db)
        cout << "YES";
    else
        cout << "NO";
    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <functional>
#include <climits>
#include <cstring>
#include <unordered_map>

using namespace std;

#define int long long
#define rep(i, n) for (int i=0;i<(int)(n);++i)
#define rep1(i, n) for (int i=1;i<=(int)(n);++i)
#define range(i, l, r) for (int i=l;i<(int)(r);++i)
#define rrange(i, l, r) for (int i=r-1;i>=(int)(l);--i)
#define unless(a) if(!(a))
#define all(a) begin(a),end(a)
#define fst first
#define scd second
#define PB emplace_back
#define PPB pop_back

using vi=vector<int>;
using pii=pair<int, int>;
using ll=long long;

bool chmin(int&a,int b){return a>b?(a=b,true):false;}
bool chmax(int&a,int b){return a<b?(a=b,true):false;}
//int read(){int a;scanf("%lld",&a);return a;}

constexpr int TEN(int n){return n==0?1:10*TEN(n-1);}

const int inf = TEN(18)*3 + 10;
const int mod = TEN(9) + 7;

map<pii, bool> exists;
map<pii, bool> used;

int ans;

void dfs(pii point, int p, int q, int depth = 0)
{
	if (used.count(point) > 0) {
		return;
	}
	if (exists.count(point) == 0) {
		return;
	}
	if (depth == 0) ans++;
	used[point] = true;
	
	dfs(pii(point.fst + p, point.scd + q), p, q, depth + 1);
	dfs(pii(point.fst - p, point.scd - q), p, q, depth + 1);
}

signed main()
{
	string s;cin >> s;
	bool f = (s[0] == 'A');
	int count = 0;

	for (int idx = 2; idx < s.size() - 1; idx++) {
		if (s[idx] == 'C') count++;
	}

	f &= count == 1;

	rep(i, s.size()) {
		if (s[i] == 'A' or s[i] == 'C') continue;
		f &= 'a' <= s[i] and s[i] <= 'z';
	}

	puts(f?"AC":"WA");
}


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

using ll=long long;

int main() {
  string S; cin >>S;
  string ans="No";
  if (S.size()%2==0) {
    string T="";
    rep(i,0,S.size()/2) {
      T+="hi";
    }
    if (S==T) {
      ans="Yes";
    }
  }
  cout <<ans <<endl;
  return 0;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
int read(){
	int x=0;
	char ch=getchar();
	while (!isdigit(ch))
		ch=getchar();
	while (isdigit(ch))
		x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
	return x;
}
const int N=405;
int n,m=401;
int fa[N],in[N],out[N],cnt[N],f[N];
int _(int k){
	if (k<0)
		return 401+k;
	else
		return k;
}
int getf(int x){
	return fa[x]==x?x:fa[x]=getf(fa[x]);
}
int main(){
	for (int i=1;i<=m;i++)
		fa[i]=i;
	n=read();
	read();
	while (n--){
		int a=read(),b=read(),c=read(),d=read();
		int x=c?-c:a;
		int y=d?d:-b;
		x=_(x),y=_(y);
		fa[getf(x)]=getf(y);
		in[y]++,out[x]++;
	}
	for (int i=1;i<=m;i++){
		if (!in[i]&&!out[i])
			continue;
		cnt[getf(i)]++;
		if (in[i]!=out[i])
			f[getf(i)]=1;
	}
	for (int i=1;i<=200;i++)
		if (out[i]<in[i]||in[401-i]<out[401-i])
			return puts("NO"),0;
	for (int i=1;i<=m;i++)
		if (cnt[i]&&!f[i])
			return puts("NO"),0;
	puts("YES");
	return 0;
}

Measured memory_bytes: 256