akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <string>
#include <stdlib.h>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <climits>
#include <iomanip>

using namespace std;

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

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

const int64_t N_MAX = 1e5 + 5;
const int64_t MOD = 1e9 + 7;
int64_t fac[N_MAX] = {1, 1};
int64_t inv[N_MAX] = {1, 1};
int64_t finv[N_MAX] = {1, 1};

// combinationを計算
int64_t comb(int n, int r)
{
  if (n < r) return 0;
  return fac[n] * finv[n - r] % MOD * finv[r] % MOD;
}

// combinationを求めるためのテーブル初期化
void comb_init()
{
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < N_MAX; i++) {
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = inv[MOD % i] * (MOD - MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}

const int MARK = 200;

int A[3][3];

int main()
{
  int N;

  for (int i = 0; i < 3; i++) {
    cin >>
        A[i][0] >>
        A[i][1] >>
        A[i][2];
  }

  cin >> N;

  for (int i = 0; i < N; i++) {
    int b;
    cin >> b;

    for (int column_i = 0; column_i < 3; column_i++) {
      for (int row_i = 0; row_i < 3; row_i++) {
        if (A[column_i][row_i] == b) {
          A[column_i][row_i] = MARK;
        }
      }
    }
  }

  bool bingo_flag = false;

  for (int row_i = 0; row_i < 3; row_i++) {
    bool column_flag = true;
    for (int column_i = 0; column_i < 3; column_i++) {
      if (A[column_i][row_i] != MARK) {
        column_flag = false;
        break;
      }
    }
    if (column_flag == true) {
      bingo_flag = true;
      break;
    }
  }

  for (int column_i = 0; column_i < 3; column_i++) {
    bool row_flag = true;
    for (int row_i = 0; row_i < 3; row_i++) {
      if (A[column_i][row_i] != MARK) {
        row_flag = false;
        break;
      }
    }
    if (row_flag == true) {
      bingo_flag = true;
      break;
    }
  }

  bool diagonal_flag = true;
  for (int i = 0; i < 3; i++) {
    if (A[i][2 - i] != MARK) {
      diagonal_flag = false;
      break;
    }
  }
  if (diagonal_flag == true) {
    bingo_flag = true;
  }

  diagonal_flag = true;
  for (int i = 0; i < 3; i++) {
    if (A[i][i] != MARK) {
      diagonal_flag = false;
      break;
    }
  }
  if (diagonal_flag == true) {
    bingo_flag = true;
  }

  if (bingo_flag == true)
  {
    cout << "Yes" << endl;
  }else
  {
    cout << "No" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
"""
Created on Fri Sep 18 07:10:00 2020

@author: liang
"""


# -*- coding: utf-8 -*-
"""
Created on Fri Sep 18 00:26:07 2020

@author: liang
"""

"""
コーナーケース１:
    重複があるとき　not coprime
    ただし、1の重複は除く
"""
import math
C = 10**6
N = int(input())
judge = [False]*(C+1)
A = [int(x) for x in input().split()]

f = True
for a in A:
    if judge[a] == True and a != 1:
        f = False
    judge[int(a)]=True


#print(judge[:10])
def solve(f):
    
    ans = A[0]
    #線形探索 O(N)
    for i in range(N):
        ans = math.gcd(ans,A[i])
    #print("ans",a)
    if ans != 1:
        return "not coprime"
    
    flag = True
    #エラトステネスの篩 O(N log N)
    for i in range(2,C+1):
        count = 0
       #if d[i] == True:
        for j in range(i,C+1,i):
            if judge[j] == True:
                count += 1
            if count == 2:
                flag = False
                break
        #        d[j] = False
        if not flag:
            break
    
    if flag == True and f == True:
        return "pairwise coprime"
    
    return "setwise coprime"

print(solve(f))
#print(len(A))

Measured memory_bytes: 141692
#include<bits/stdc++.h>
#define int long long
using namespace std;
using P=pair<int,int>;
const int mod=1000000007;
P a(vector<vector<int>> &A,vector<bool> &B,int n){
  int w=1,b=1;
  for(int i:A[n])
    if(B[i]){
      B[i]=false;
      P p=a(A,B,i);
      w=w*((p.first+p.second)%mod)%mod;
      b=b*p.first%mod;
    }
  return {w,b};
}
signed main(){
  int N;
  cin>>N;
  vector<vector<int>> A(N);
  for(int i=1;i<N;i++){
    int a,b;
    cin>>a>>b;
    A[a-1].push_back(b-1);
    A[b-1].push_back(a-1);
  }
  vector<bool> B(N,true);
  B[0]=false;
  P C=a(A,B,0);
  cout<<(C.first+C.second)%mod<<endl;
}

Measured memory_bytes: 15572
#include <bits/stdc++.h>
#define pb push_back
#define all(a) a.begin(),a.end()
#define forn(i,n) for(int i=0;i<int(n);i++)
#define forr(i,n) for(int i=int(n-1);i>=0;i--)
#define fora(i,a,b) for(int i=int(a);i<=int(b);i++)
#define forb(i,a,b) for(int i=int(a);i>=int(b);i--)
#define mod 1000000007
using namespace std;
using ll=long long int;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<ll> vii;
typedef pair<ll ,ll> pii;
template<typename T>
string ts(T v)
{
	string res="{";
	bool r=true;
	for(const auto &x:v)
	{
		if(!r)res+=",";
		r=false;
		res+=to_string(x);
	}
	res+="}";
	return res;
}
void solve()
{
	int n;
	cin>>n;
	map<string,int> m;
	forn(i,n)
	{
		string s;
		cin>>s;
		m[s]++;
	}
	cout<<"AC x "<<m["AC"]<<endl;
	cout<<"WA x "<<m["WA"]<<endl;
	cout<<"TLE x "<<m["TLE"]<<endl;
	cout<<"RE x "<<m["RE"]<<endl;
}
int main()
{
    ios::sync_with_stdio(0); 
    cin.tie(0); 
    cout.tie(0);
    int t=1;
    //cin>>t;
    while(t--)
   	solve();
}


Measured memory_bytes: 3660
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    ll h,w,k;
    cin>>h>>w>>k;
    string s[h];
    for(int i=0;i<h;i++){
    	cin>>s[i];
    }
    ll a[h+1][w+1];
    memset(a,0,sizeof(a));
    for(int i=0;i<h;i++){
    	for(int j=0;j<w;j++){
    		a[i+1][j+1]=(s[i][j]-'0');
    	}
    }
    for(int i=1;i<=h;i++){
    	for(int j=1;j<=w;j++){
    		a[i][j]+=a[i][j-1];
    	}
    }
    for(int i=1;i<=h;i++){
    	for(int j=1;j<=w;j++){
    		a[i][j]+=a[i-1][j];
    	}
    }
    ///////
    ll ans=1e18;
    ll maki=(1LL<<(h-1));
    for(ll bit=0;bit<maki;bit++){
    	bool eri=false;
    	vector<ll> v;
    	v.pb(0);
    	for(int i=0;i<h-1;i++){
    		if(bit>>i&1){
    			v.pb(i+1);
    		}
    	}
    	v.pb(h);
    	ll num=v.size()-2;
    	ll index=0;
        while(index<w){
        	ll mi=1e9;
        	for(int i=1;i<v.size();i++){
        		ll le=index,ri=w+1,mid;
        		while(le+1<ri){
        			mid=(le+ri)/2;
        			if(a[v[i]][mid]-a[v[i]][index]-a[v[i-1]][mid]+a[v[i-1]][index]<=k)le=mid;
        			else ri=mid;
        		}
        		if(le==index){
        			i=v.size();
        			eri=true;
        		}
        		mi=min(mi,le);
        	}
        	if(eri)break;
        	index=mi;
        	num++;
        }
        if(eri)continue;
        ans=min(ans,num);
    }
    cout << ans-1<<endl;
    return 0;
}


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

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

    int n;

    while(cin>>n){
        double t, a;
        cin>>t>>a;

        double mn = 1000000000;
        int ans = 0;

        for(int i=0; i<n; i++){
            double val;
            cin>>val;

            double temp = t - (val*0.006);

            if(abs(temp-a) < mn){
                mn = abs(temp-a);
                ans = i;
            }
        }

        cout<<(ans+1)<<endl;
    }
}


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

#define LL long long
#define pii pair<LL, LL>
#define mp make_pair

const int maxN = 2e5 + 10, mod = 1e9 + 7;

int n, pw[maxN + 1];

map<pii, int> f;

inline LL gcd(LL x, LL y)
{
	LL r = x % y;
	while(r) { x = y; y = r; r = x % y; }
	return y;
}

int main()
{
	scanf("%d", &n);

	pw[0] = 1;
	for(int i = 1; i <= n; i++) pw[i] = 2ll * pw[i - 1] % mod;
	
	int ans = 1, res = 0;
	for(int i = 1; i <= n; i++)
	{
		LL x, y;
		scanf("%lld %lld", &x, &y);
		if(!x && !y) { res ++; continue; }
		if(!x) { f[ mp(0, 1) ] ++; continue; }
		if(!y) { f[ mp(1, 0) ] ++; continue; }
		LL g = gcd(abs(x), abs(y));
		x /= g; y /= g;
		if(x < 0) x = -x, y = -y;
		f[ mp(x, y) ] ++;
	}

	for(map<pii, int>::iterator it = f.begin(); it != f.end(); it++)
	{
		LL x = (it -> first).first, y = (it -> first).second;
		if((it -> second) == -1) continue;
		LL nx = -y, ny = x;
		if(nx < 0) nx = -nx, ny = -ny;
		int t = (1ll * pw[it -> second] + pw[ f[ mp(nx, ny) ] ] - 1) % mod;
		ans = 1ll * ans * t % mod;
		it -> second = f[ mp(nx, ny) ] = -1;
	}

	ans = ((ans + res - 1) % mod + mod) % mod;
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 29596
//おまじない
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#define INF 1e9+7
#define roop(i,m,n) for(int i=m;i<n;i++)
#define mroop(i,m,n) for(int i=m;i<n;i--)
#define NO cout<<"NO"<<endl;
#define YES cout << "YES"<<endl;
#define No cout << "No"<<endl;
#define Yes cout << "Yes"<<endl;
using namespace std;
typedef long long int ll;


//(int)'a'は97 (int)'A'は65
//おまじない



int main() {

	int p;
	int range = 0;
	cin >> p;

	for (int t=0;t>=0;t++){
		range += t;
		if (range >= p && range-p<=t) {
			cout << t << endl;
			return 0;
		}
	}
	
	return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <cmath>
#include <string>
#include <cstring>
#include <iostream>
#include <iomanip>
#include <limits>
#include <vector>
#include <algorithm>
#include <functional>
#include <cctype>
#include <sstream>
#include <numeric>

typedef long long lint;
typedef long double ldouble;
using namespace std;
#define rep(i, n) for(lint i = 0; i < (lint)(n); i++)
#define repi(i,a,b) for(lint i=lint(a);i<lint(b);++i)
#define all(x) (x).begin(),(x).end()
#define sl(c) (('a')<=(c)&&(c)<=('z'))
#define ll(c) (('A')<=(c)&&(c)<=('Z'))
#define PI 3.141592653589793
#define cout (cout<<fixed<<setprecision(15))
#define makeupper(t) (transform(all(t),t.begin(),::toupper))
#define makelower(t) (transform(all(t),t.begin(),::tolower))
#define dist(x1,y1,x2,y2) (pow(pow(x2-x1,2)+pow(y2-y1,2),0.5))
#define sum(a) accumulate(all(a),0)
#define NEXT_LINE string junk; getline(cin, junk);
inline lint* arr1(lint x) {
	lint *array = new lint[x];
	rep(i, x)array[i] = 0;
	return array;
}
inline lint** arr2(lint x, lint y) {
	lint **array = new lint*[x];
	rep(i, x)array[i] = new lint[y];
	rep(i, x)rep(j, y)array[i][j] = 0;
	return array;
}
inline vector<string> split(const string &s, char delim) {
	vector<string> elems;
	stringstream ss(s);
	string item;
	while (getline(ss, item, delim)) {
		if (!item.empty()) {
			elems.push_back(item);
		}
	}
	return elems;
}
inline ldouble max(vector<ldouble> a) {
	ldouble M = a[0];
	rep(i, a.size())if (M < a[i])M = a[i];
	return M;
}
inline ldouble min(vector<ldouble> a) {
	ldouble m = a[0];
	rep(i, a.size())if (m > a[i])m = a[i];
	return m;
}
inline lint max(vector<lint> a) {
	lint M = a[0];
	rep(i, a.size())if (M < a[i])M = a[i];
	return M;
}
inline lint min(vector<lint> a) {
	lint m = a[0];
	rep(i, a.size())if (m > a[i])m = a[i];
	return m;
}
inline ldouble sum2(vector<ldouble> a, int n) {
	vector<ldouble> b;
	b.resize(a.size());
	rep(i, a.size())b[i] = powl(a[i], n);
	return sum(b);
}
inline lint sum2(vector<lint> a, int n) {
	lint sum=0;
	rep(i, a.size())sum += powl(a[i], n);
	return sum;
}
inline ldouble dist2(vector<ldouble> a, vector<ldouble> b,int num) {
	if (a.size() != b.size())return -1;
	vector<ldouble> c;
	c.resize(a.size());
	rep(i, a.size())c[i] = abs(b[i] - a[i]);
	if (num == 0)return max(c);
	else return pow(sum2(c, num), 1. / num);
}
inline ldouble dist2(vector<lint> a, vector<lint> b, int num) {
	if (a.size() != b.size())return -1;
	vector<lint> c;
	c.resize(a.size());
	rep(i, a.size())c[i] = abs(b[i] - a[i]);
	if (num == 0)return max(c);
	else return pow(sum2(c, num),1./num);
}
inline vector<int> cross(vector<int> a, vector<int> b) {
	return { a[1] * b[2] - a[2] * b[1],a[2] * b[0] - a[0] * b[2],a[0] * b[1] - a[1] * b[0] };
}
int main() {
	vector<int> a(6);
	rep(i,6)cin >> a[i];
	vector<vector<int> >v = { {0,0,1},{1,0,0} ,{0,1,0} ,{0,-1,0} ,{-1,0,0} ,{0,0,-1} };
	int n;
	cin >> n;
	int  b, c, d, e;
	rep(i, n) {
		cin >> b>> c;
		rep(i, 6)if (a[i] == b)d = i;
		rep(i, 6)if (a[i] == c)e = i;
		vector<int> v2 = cross(v[d], v[e]);
		rep(i, 6)if (v2 == v[i])cout << a[i] << "\n";
	}
}


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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int q; cin>>q;
	for(int i=0;i<q;++i){
		string x,y; cin>>x>>y;
		vector<vector<int>>dp(y.size()+1,vector<int>(x.size()+1));
		for(auto&j:dp)j.at(0)=0; for(auto&j:dp.at(0))j=0;
		for(int j=0;j<y.size();++j){
			for(int k=0;k<x.size();++k){
				if(y.at(j)==x.at(k))dp.at(j+1).at(k+1)=dp.at(j).at(k)+1;
				else dp.at(j+1).at(k+1)=max({dp.at(j).at(k),dp.at(j).at(k+1),dp.at(j+1).at(k)});
			}
		}
		cout<<dp.back().back()<<"\n"s;
	}
}


Measured memory_bytes: 6712
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	
	const int mod = 1e9 + 7;
	
	int n; string s; cin >> n >> s;
	int depth = 0;
	ll ans = 1;
	rep(i, 2 * n){
		if((s[i] == 'B') ^ (depth & 1)) depth++;
		else{
			ans *= depth--;
			ans %= mod;
		}
	}
	if(depth) ans = 0;
	
	for(int i = n; i > 1; i--) ans = ans * i % mod;
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 720
def main():
  s = input()
  x, y = map(int, input().split())
  lens = len(s)
  ind = 0
  if "T" in s:
    ind = s.index("T")
    x -= ind
  else:
    ind = lens
    x -= lens
  x_lst = []
  y_lst = []
  direct = 0
  while ind < lens:
    acc = 0
    if s[ind] == "F":
      while ind < lens and s[ind] == "F":
        ind += 1
        acc += 1
      if direct == 0:
        x_lst.append(acc)
      else:
        y_lst.append(acc)
  
    elif s[ind] == "T":
      while ind < lens and s[ind] == "T":
        ind += 1
        acc += 1
      direct = (direct + acc) % 2
  x = abs(x)
  y = abs(y)  
  sumx = sum(x_lst)
  sumy = sum(y_lst)
  if sumx < x or (sumx - x) % 2 or sumy < y or (sumy - y) % 2:
    print("No")
  else:
    target_x = (sumx - x) // 2
    target_y = (sumy - y) // 2
    canx = [False] * (target_x + 1)
    canx[0] = True
    cany = [False] * (target_y + 1)
    cany[0] = True
  
    break_flag = False
    for v in x_lst:
      for i in range(target_x - v + 1):
        if canx[i]:
          canx[i + v] = True
          if i + v == target_x:
            break_flag = True
            break
      if break_flag:
        break
    
    break_flag = False
    for v in y_lst:
      for i in range(target_y - v + 1):
        if cany[i]:
          cany[i + v] = True
          if i + v == target_y:
            break_flag = True
            break
      if break_flag:
        break
  
    if canx[target_x] and cany[target_y]:
      print("Yes")
    else:
      print("No")

main()

Measured memory_bytes: 3316
#include<stdio.h>
int main(){
    int a,b;
    scanf("%d %d",&a,&b);
    if((a+b)%2==0){
      printf("%d\n",(a+b)/2);
    }else{
      printf("%d\n",(a+b)/2+1);
    }
    return 0;
}

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

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

    int diff = 1000;
    rep(i, s.length()-2) {
        diff = min(diff, abs(753 - ((s[i] - '0') * 100 + (s[i+1] - '0') * 10 + (s[i+2] - '0'))));
    }

    cout << diff << endl;

    return 0;
}

Measured memory_bytes: 256
//by yjz
#include<bits/stdc++.h>
using namespace std;
#define FF first
#define SS second
#define PB push_back
#define MP make_pair
#define bged(v) (v).begin(),(v).end()
#define foreach(it,s) for(__typeof((s).begin()) it=(s).begin();it!=(s).end();it++)
typedef long long ll;
const int Imx=2147483647;
const ll Lbig=2e18;
const int mod=1e9+7;
//My i/o stream
struct fastio
{
	char s[100000];
	int it,len;
	fastio(){it=len=0;}
	inline char get()
	{
		if(it<len)return s[it++];it=0;
		len=fread(s,1,100000,stdin);
		if(len==0)return EOF;else return s[it++];
	}
	bool notend()
	{
		char c=get();
		while(c==' '||c=='\n')c=get();
		if(it>0)it--;
		return c!=EOF;
	}
}_buff;
#define geti(x) x=getnum()
#define getii(x,y) geti(x),geti(y)
#define getiii(x,y,z) getii(x,y),geti(z)
#define puti(x) putnum(x),putchar(' ')
#define putii(x,y) puti(x),puti(y)
#define putiii(x,y,z) putii(x,y),puti(z)
#define putsi(x) putnum(x),putchar('\n')
#define putsii(x,y) puti(x),putsi(y)
#define putsiii(x,y,z) putii(x,y),putsi(z)
inline ll getnum()
{
	ll r=0;bool ng=0;char c;c=_buff.get();
	while(c!='-'&&(c<'0'||c>'9'))c=_buff.get();
	if(c=='-')ng=1,c=_buff.get();
	while(c>='0'&&c<='9')r=r*10+c-'0',c=_buff.get();
	return ng?-r:r;
}
template<class T> inline void putnum(T x)
{
	if(x<0)putchar('-'),x=-x;
	register short a[20]={},sz=0;
	while(x)a[sz++]=x%10,x/=10;
	if(sz==0)putchar('0');
	for(int i=sz-1;i>=0;i--)putchar('0'+a[i]);
}
inline char getreal(){char c=_buff.get();while(c==' '||c=='\n')c=_buff.get();return c;}
int n,a[100111];
int main()
{
	geti(n);
	ll sum=0;
	for(int i=1;i<=n;i++)
	{
		geti(a[i]);
		sum+=a[i];
	}
	ll sum1=1ll*n*(n+1)/2;
	if(sum%sum1==0)
	{
		ll tot=sum/sum1;
		a[n+1]=a[1];
		for(int i=1;i<=n;i++)
		{
			if(a[i]+tot<a[i+1]||(a[i]+tot-a[i+1])%n!=0)
			{
				puts("NO");
				return 0;
			}
		}
		puts("YES");
	}
	else puts("NO");
	return 0;
}

Measured memory_bytes: 768
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <random>
#include <cstdio>
#include <cstring>
#include <cmath>

using namespace std;
using ll = long long;
using P = pair<ll, ll>;

ll X, Y;

void input() {
    cin >> X >> Y;
}

ll solve() {
    return X + Y / 2;
}


int main() {
    input();
    
    cout << solve() << endl;
    
    return 0;
}



Measured memory_bytes: 888
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		 Scanner s = new Scanner(System.in);

		 int n = s.nextInt();
		 int result = 0;

		 for(int i = 1; i <= n; i++) {
			 if(s.nextInt() % 2 == 1 &&  i % 2 == 1) {
				 result++;
			 }
		 }
		 System.out.println(result);
	}
}

Measured memory_bytes: 27136
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX 1000

int top,new_num[MAX];
int isEmpty(void){
return top==0;
}
int isFUll(){
	return top >=MAX -1;
}


void push(int x){
	if(isFUll()){
		printf("overflow\n");
		exit(1);
	}
	top++;
	new_num[top]=x;
}
int pop(){
	if(isEmpty()){
		printf("underflow");
		exit(1);
	}
	top--;
	return new_num[top+1];
}
int main(void){
	int x,y,X;
	char num[MAX];

	top=0;
	while(scanf("%s",num) != EOF){
		if(num[0] == '+'){
			x=pop();
			y=pop();
			push(x+y);
		}
		else if(num[0] == '-'){
			x=pop();
			y=pop();
			push(y-x);
		}
		else if(num[0] == '*'){
			x=pop();
			y=pop();
			push(x*y);
		}
		else{
			X=atoi(num);
			push(X);
		}
	}
	printf("%d\n",pop());
	return 0;
}



Measured memory_bytes: 2144
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=(ll)1e9+7;
//const ll MOD=(ll)998244353;
const ll INF=(ll)1e18+10;
const double PI = 2.0*acos(0);

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; }
int dy[]={-1,1,0,0};
int dx[]={0,0,-1,1};

void solve(int ca){
    int N; cin>>N;
    vector<int> a(N+1);
    vector<ll> ruiseki(N+2,0);
    for (int i = 0; i < N + 1; ++i) {
        cin>>a[i];
        ruiseki[i+1]=ruiseki[i]+(ll)a[i];
    }
    ll nodes=1;
    ll ans=0;
    for (int i = 0; i < N + 1; ++i) {
        ans+=nodes;
        nodes-=(ll)a[i];
        if(nodes<0){
            cout<<-1<<endl;
            return;
        }
        if(i==N) break;
        ll total=ruiseki[N+1]-ruiseki[i+1];
        if(nodes>total){
            cout<<-1<<endl;
            return;
        }
        if(2*nodes>=total){
            nodes=total;
        }else{
            nodes*=2;
        }
    }
    cout<<ans<<endl;
}

//#define MULTI
int main() {
#ifdef MULTI
    int N; cin>>N;
    for (int i = 0; i < N; ++i) {
        solve(i+1);
    }
#else
    solve(0);
#endif
    return 0;
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define range(a) a.begin(), a.end()
#define endl "\n"
#define Yes() cout << "Yes" << endl
#define No() cout << "No" << endl
const unsigned long long mod = 1e9 + 7;
const long long INF = 1LL<<60;
void chmin(long long &a, long long b) { if (a > b) a = b; }
void chmax(long long &a, long long b) { if (a < b) a = b; }

unsigned long long  gcd(ull a, ull b){
	if (a%b == 0)		return(b);
   else	return(gcd(b, a%b));
}

unsigned long long int lcm(ull a, ull b){
   return a * b / gcd(a, b);
}

int main(void){
	ios::sync_with_stdio(0);
	cin.tie(0);
	ull A,B;		cin>>A>>B;
  	ull ans=lcm(A,B);
	cout<<ans<<endl;

    return 0;
}




Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <stack>
#include <complex>
#include <stdlib.h>
#include <stdio.h>
#include <functional>
#include <cfloat>
#include <math.h>


#define fs first
#define sc second

using namespace std;


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


const ll mod = 1000000007;
ll fact[200200];
ll invfact[200200];

inline ll take_mod(ll a){
    return (a % mod + mod) % mod;
}

inline ll add(ll a, ll b){
    return take_mod(a+b);
}

inline ll sub(ll a, ll b){
    return take_mod(a-b);
}


inline ll mul(ll a, ll b){
    return take_mod(a * b);
}

inline ll pow(ll x, ll n){
    ll res = 1LL;
    while(n > 0){
        if(n & 1) res = mul(res, x);
        x = mul(x, x);
        n >>= 1;
    }
    return res;
}

ll mod_inv(ll x){
    return pow(x, mod-2);
}

// nは上限
void make_fact(ll n){
    fact[0] = 1;
    ll res = 1;
    for(int i = 1; i <= n; i++){
        fact[i] = res;
        res = mul(res, i+1);
    }
}

// nは上限
void make_invfact(ll n){
    invfact[0] = 1;
    invfact[n] = mod_inv(fact[n]);
    for(int i = n-1; i >= 1; i--){
        invfact[i] = mul(invfact[i + 1], i + 1);
    }
}

ll perm(ll n, ll k){
    return mul(fact[n], invfact[n-k]);
}

ll comb(ll n, ll k){
    return mul(mul(fact[n], invfact[n-k]), invfact[k]);
}

int main(){
    ll N, K;
    ll a[2100];
    ll b[2100], c[2100];
    cin >> N >> K;
    for(int i = 0; i < N; i++){
        cin >> a[i];
    }

    ll res = 0;
    for(int i = 0; i < N; i++){
        for(int j = i+1; j < N; j++){
            if(a[i] > a[j]){
                res++;
            }
        }
    }

    fill(b, b+2100, 0);
    fill(c, c+2100, 0);
    for(int i = 0; i < N; i++){
        for(int j = 0; j < N; j++){
            if(a[i] < a[j]){
                b[i]++;
            }
            if(a[i] > a[j]){
                c[i]++;
            }
        }
    }

    res = mul(res, K);

    for(int i = 0; i < N; i++){
        res = add(res, mul(mul(mul(b[i] + c[i], K), K-1), mod_inv(4)));
    }

    cout << res << endl;



    return 0;
}


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

using namespace std;

typedef long long ll;

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; }

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

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

}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ll long long
#define ull unsigned long long
#define ld long double
#define pii pair <int, int>
#define pll pair <ll, ll>
#define pci pair <char, int>
#define ppll pair <pll, pll>
#define vll vector <ll>
#define vvll vector <vll>
#define vpll vector <pll>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define mll map <ll, ll>
#define fastmap gp_hash_table
#define cd complex <double>
#define vcd vector <cd>
#define PI 3.14159265358979
#pragma 03
using namespace std;
using namespace __gnu_pbds;
ll inv[3000005], fact[3000005], invfact[3000005]; 
ll mod = 1e9 + 7;
ll nck(ll n, ll k){
	return fact[n] * invfact[k] % mod * invfact[n - k] % mod;
}
ll binpow(ll a, ll b){
	if (b == 0) return 1;
	ll x = binpow(a, b/2);
	x *= x; x %= mod;
	if (b % 2) return (a * x) % mod;
	else return x;
}
ll bindiv(ll a, ll b){
	return a * binpow(b, mod - 2) % mod;
}
int main(){
  	inv[1] = 1;
  	for (ll i = 2; i<3000005; i++) inv[i] = mod - mod / i * inv[mod % i] % mod;
  	fact[0] = invfact[0] = 1;
  	for (ll i = 1; i<3000005; i++){
  		fact[i] = fact[i - 1] * i % mod;
  		invfact[i] = invfact[i - 1] * inv[i] % mod;
	}
	ll r1, r2, c1, c2; cin >> r1 >> c1 >> r2 >> c2;
	cout << ((nck(r2 + c2 + 2, c2 + 1) - nck(r1 + c2 + 1, c2 + 1) - nck(r2 + c1 + 1, c1) + nck(r1 + c1, c1)) % mod + mod) % mod;
  	return 0;
}

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

vector<bool> known;
vector<vector<int>> XY;

void judge(int v, int parent){
    known[v] = true;
    for(int child: XY[v]){
        if(child == parent)continue;
        if(known[child])continue;
        judge(child, v);
    }
}

int main(void){
    int N, M;
    int Xbuf, Ybuf, Zbuf;
    vector<int> Z;

    cin >> N >> M;

    XY.assign(N, vector<int>());
    known.assign(N, false);

    for(int i=0; i<M; i++){
        cin >> Xbuf >> Ybuf >> Zbuf;
        Xbuf--;
        Ybuf--;
        XY[Xbuf].push_back(Ybuf);
        XY[Ybuf].push_back(Xbuf);
        Z.push_back(Zbuf % 2);
    }

    int magic = 0;

    for(int i=0; i<N; i++){
        if(known[i])continue;
        magic++;
        judge(i, 0);
    }

    cout << magic << endl;

    return 0;
}

Measured memory_bytes: 10744
#line 2 "/home/defineprogram/Desktop/Library/template/template.cpp"
#include<bits/stdc++.h>
#pragma GCC optimization ("Ofast")
#pragma GCC optimization ("unroll-loops")
using namespace std;
#define ll long long
#define rep(i,n) for(ll i=0;i<n;i++)
#define REP(i,n) for(ll i=1;i<n;i++)
#define rev(i,n) for(ll i=n-1;i>=0;i--)
#define all(v) v.begin(),v.end()
#define P pair<ll,ll>
#define len(s) (ll)s.size()
 
template<class T> inline bool chmin(T &a, T b){
	if(a>b){a=b;return true;}
	return false;
}
template<class T> inline bool chmax(T &a, T b){
	if(a<b){a=b;return true;}
	return false;
}
constexpr ll inf = 3e18;
#line 3 "/home/defineprogram/Desktop/Library/structure/UnionFind.cpp"

class UnionFind{
	using size_type=int32_t;
	size_type N;
	vector<size_type>par,siz;
public:
	size_type find(size_type x){
		assert(x<N);
		return (par[x]==x?x:par[x]=find(par[x]));
	}
	void merge(size_type x,size_type y){
		assert(x<N&&y<N);
		x=find(x);y=find(y);
		if(x==y)return;
		if(siz[x]>siz[y])swap(x,y);
		par[x]=y;siz[y]+=siz[x];
	}
	bool same(size_type x,size_type y){
		return find(x)==find(y);
	}
	size_type size(size_type x){
		return siz[find(x)];
	}
	UnionFind(size_type N):N(N),siz(N,1),par(N){
		iota(all(par),0);
	}
};

/*
@brief Union Find
@docs docs/UnionFind.md
*/
#line 3 "main.cpp"

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    int N,M;cin>>N>>M;
    UnionFind uf(N);
    rep(i,M){
        int a,b;cin>>a>>b;a--;b--;
        uf.merge(a,b);
    }
    int ans=0;
    rep(i,N){
        if(uf.find(i)==i)ans++;
    }
    cout<<ans-1<<"\n";
}


Measured memory_bytes: 3992
#include <bits/stdc++.h>
using namespace std;
#define int                     long long   
#define double                  long double
#define endl                    "\n"
#define pb                      push_back
#define PI                      3.1415926535897932384626433832795l
#define F                       first
#define S                       second
#define mp                      make_pair
#define f(i,n)                  for(int i=0;i<n;i++)
#define fastio                  ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define all(v)                  (v).begin(),(v).end()
#define rall(v)                 (v).rbegin(),(v).rend()
#define gcd(a,b)                __gcd((a),(b))
#define fill(a,value)           memset(a,value,sizeof(a));
#define minn(v)                 *min_element(v.begin(), v.end());
#define maxx(v)                 *max_element(v.begin(), v.end());
#define print(x)                cout<<(x)<<endl;
#define sum(v)+x                accumulate(v.begin(), v.end(),x);
#define debug(x)                cout<<#x<<'='<<(x)<<endl;
typedef pair<int,int>           pii;
typedef vector<int>             vi;
signed main() 
{
    fastio;
    cout << fixed << setprecision(12);
    int n;
    cin>>n;
    vi a(n);
    f(i,n)cin>>a[i];
    int maxx=0;
    int cur=1;
    for(int i=1;i<n;i++)
    {
        if(a[i]>a[i-1])
        {
            maxx=max(maxx,cur);
            cur=1;
        }
        else
        {
            cur++;
        }
    }
    maxx=max(maxx,cur);
    print(maxx-1)
    
    
    
    
    
    
    
    
    return 0;
}

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

//And I just Can't keep Living this way
//So starting today I'm breaking out of this cage




deque<int>q1;
vector<int>v1[(int)1e5+1000];
map<int , int>status;

bool check()
{
    int u  = q1.front();
    int v = q1.back();
    for(auto itr : v1[u])
    {
        if(status[itr]==false)
            return false;
    }
    for (auto itr : v1[v]) {
        if(status[itr]==false)
            return false;
    }
    return true;
}
int main()
{
    
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    
    int n,m;
    cin>>n>>m;
    for (int i = 1; i<=m; i+=1) {
        int u,v;
        cin>>u>>v;
        if(i==1)
        {
            q1.push_back(u);
            q1.push_back(v);
            status[u]  = true;
            status[v] = true;
        }
        
        v1[v].push_back(u);
        v1[u].push_back(v);
    }
    
    for (int i = 0 ; i<n; i+=1)
    {
        if(check())
        {
            cout<<q1.size()<<endl;
            for (int i = 0 ;i<q1.size(); i+=1) {
                cout<<q1[i]<<" ";
            }
            cout<<endl;
            return 0;
        }
        for(auto itr : v1[q1.front()])
        {
            if(status[itr]==false)
            {
                status[itr] = true;
                q1.push_front(itr);
                break;
            }
        }
        for(auto itr : v1[q1.back()])
        {
            if(status[itr]==false)
            {
                status[itr] = true;
                q1.push_back(itr);
                break;
            }
        }
        
    }
    return 0;
}

Measured memory_bytes: 11392
s = input()
t = input()
mapping_s = {}
mapping_t = {}
count_s = 0
count_t = 0
code_s = []
code_t = []
for cs, ct in zip(s, t):
    if cs not in mapping_s:
        mapping_s[cs] = count_s
        count_s += 1
    if ct not in mapping_t:
        mapping_t[ct] = count_t
        count_t += 1
    code_s.append(mapping_s[cs])
    code_t.append(mapping_t[ct])
if code_s == code_t:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 6712
//  main.cpp
//  CppTest

#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;

int main(int argc, const char * argv[]) {

    /////////////////////
    // Write code below /
    /////////////////////
    int sumOfDistance = 0;
    int N, K;
    cin >> N >> K;
    for (int i = 0; i < N; i++) {
        int x_i;
        cin >> x_i;
        int distanceOfRobotA = x_i;
        int distanceOfRobotB = K - x_i;
        sumOfDistance += min(distanceOfRobotA, distanceOfRobotB);
    }
    
    cout << sumOfDistance * 2 << endl;
    
    return 0;
}


Measured memory_bytes: 256
import string
from sys import stdin
N = int(stdin.readline().rstrip())
S = list(stdin.readline().rstrip())
alpha = list(string.ascii_uppercase)
dic = {c:i for i, c in enumerate(alpha)}
ans = []
for c in S:
  idx = dic[c]+N
  if idx >= 26:
    idx -= 26
  ans.append(alpha[idx])
print(''.join(ans))

Measured memory_bytes: 3832
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
	int N, M, X, Y, a;
	vector<int> x, y;

	cin >> N;
	cin >> M;
	cin >> X;
	cin >> Y;
	for (int i = 0; i < N; i++)
	{
		cin >> a;
		x.push_back(a);
	}
	for (int i = 0; i < M; i++)
	{
		cin >> a;
		y.push_back(a);
	}

	sort(x.begin(), x.end());
	sort(y.begin(), y.end());

	if (x.back() < y.front() && X < y.front() && x.back() < Y)
		cout << "No War" << endl;
	else
		cout << "War" << endl;
}

Measured memory_bytes: 256
//ABC070 - C
#include <iostream>
#include <algorithm>
using namespace std;
using ll = long long;

int N;

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

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

int main() {
    cin >> N;
    ll T;
    ll x = 1;
    for(int i=0;i<N;i++){
        cin >> T;
        x = lcm(x,T);
    }
    cout << x <<"\n";
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <math.h>
int main(void){
int N;
int P[200000];
int count = 1;
    scanf("%d",&N);
    for(int i = 0;i<N;i++)scanf("%d",&P[i]);
    int min = P[0];
    for(int i = 1; i< N; i++){
        if(P[i] <= min){
            min = P[i];
            count++;
    }
    }
    printf("%d",count);
return 0;
}


Measured memory_bytes: 896
#include<iostream>
using namespace std;
int main() {
	int a, b;
	cin >> a >> b;
	int w[16] = { 16,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 };
	if (w[a - 1] > w[b - 1])cout << "Alice" << endl;
	else if (w[a - 1] < w[b - 1])cout << "Bob" << endl;
	else cout << "Draw" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int h,w;
  cin >> h >> w;
  char data[h][w];
  int count=0;
  for (int i=0;i<h;i++){
    for (int j=0;j<w;j++){
      cin >> data[i][j];
    }
  }
  //i行目の調査
  for (int i=0;i<h;i++){
    count=0;
    for (int j=0;j<w;j++){
      if (data[i][j] == '.') count++;
    }
    //i行目を調査して全部空白ならその行をxにする
    if (count == w){
      for (int k=0;k<w;k++){
        data[i][k] = 'x';
      }
    }
  }
  //j列目の調査
  for (int j=0;j<w;j++){
    count=0;
    for (int i=0;i<h;i++){
      if (data[i][j] == '.' || data[i][j] == 'x') count++;
    }
    //j列目を調査して全部空白ならその行をxにする
    if (count == h){
      for (int k=0;k<h;k++){
        data[k][j] = 'x';
      }
    }
  }
  for (int i=0;i<h;i++){
    for (int j=0;j<w;j++){
      if (data[i][j] != 'x') cout << data[i][j]; 
    }
    cout << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MAXN=2e5+10;
ll N,A[MAXN];
queue<ll> q;
int main(){
    cin>>N;
    for(int i=1;i<=N;i++) cin>>A[i];
    sort(A+1,A+1+N,[](const int &a,const int &b){
        return a>b;
    });
    ll Ans=0;
    q.push(A[1]);
    for(int i=2;i<=N;i++){
        Ans+=q.front();
        q.pop();
        q.push(A[i]);
        q.push(A[i]);
    }
    cout<<Ans;
    return 0;
}

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

int main()
{
  int d, m;
  cin >> d;
  vector<vector<int>> c;
  vector<int> t;
  vector<int> e;
  vector<int> q;

  int weight[26];
  for (int k = 0; k < 26; k++)
  {
    weight[k] = 1;
  }
  for (int i = 0; i < d + 1; i++)
  {
    c.push_back(vector<int>());

    for (int j = 0; j < 26; j++)
    {
      int v;
      cin >> v;
      c[i].push_back(v);
    }
  }

  for (int i = 0; i < d; i++)
  {
    int v;
    cin >> v;
    t.push_back(v);
  }
  cin >> m;
  for (int i = 0; i < m; i++)
  {
    int v;
    cin >> v;
    e.push_back(v);
    cin >> v;
    q.push_back(v);
  }

  for (int h = 0; h < m; h++)
  {
    for (int k = 0; k < 26; k++)
    {
      weight[k] = 1;
    }
    int sum(0);

    t[e[h] - 1] = q[h];

    for (int i = 0; i < d; i++)
    {
      int j = t[i] - 1;
      sum += c[i + 1][j];
      int penalty = 0;
      for (int k = 0; k < 26; k++)
      {
        if (j != k)
        {
          penalty += c[0][k] * weight[k];
          weight[k]++;
        }
        else
        {
          weight[k] = 1;
        }
      }
      sum -= penalty;
    }
    std::cout << sum << std::endl;
  }
  return 0;
}

Measured memory_bytes: 4376
package main

import "fmt"

func main() {
	var h, w int
	fmt.Scan(&h, &w)

	grid := make([][]string, h)
	for i := range grid {
		grid[i] = make([]string, w)
		tmp := ""
		fmt.Scan(&tmp)
		for j := range tmp {
			grid[i][j] = string(tmp[j])
		}
	}

	for i := 0; i < w; i++ {
		flagWhiteColumn := true
		for j := range grid {
			if grid[j][i] == "#" {
				flagWhiteColumn = false
			}
		}
		if flagWhiteColumn == true {
			for j := range grid {
				grid[j][i] = ""
			}
		}
	}

	for i := range grid {
		flagWhiteLine := true
		for j := range grid[i] {
			if grid[i][j] == "#" {
				flagWhiteLine = false
			}
		}
		if flagWhiteLine == true {
			grid[i] = nil
		}
	}

	for i := range grid {
		if grid[i] == nil {
			continue
		}
		for j := range grid[i] {
			fmt.Printf("%s", grid[i][j])
		}
		fmt.Println()
	}
}


Measured memory_bytes: 896
import math
 
N = int(input())
 
cnt = 0
 
if N == 2:
  print(1)
  exit()
 
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
 
    # divisors.sort()
    return divisors
res1 = sorted(make_divisors(N))
res1 = res1[1:math.ceil(len(res1)/2)]
 
for num in res1:
  kensa = N
  while True:
    if kensa % num == 0:
      kensa = kensa // num
      continue
    break
  if kensa % num == 1:
    cnt += 1
 
res2 = sorted(make_divisors(N-1))
cnt += len(res2[1:])+1
 
print(cnt)

Measured memory_bytes: 3444
//{{{
#include <bits/stdc++.h>
using namespace std;
#define repX(a,b,c,x,...) x
#define repN(a) repX a
#define rep(...) repN((__VA_ARGS__,rep3,rep2,loop))(__VA_ARGS__)
#define rrep(...) repN((__VA_ARGS__,rrep3,rrep2))(__VA_ARGS__)
#define loop(n) rep2(i_,n)
#define rep2(i,n) rep3(i,0,n)
#define rep3(i,begin,end) for(int i=(int)(begin),i##_end=(int)(end);i<i##_end;++i)
#define rrep2(i,n) rrep3(i,n,0)
#define rrep3(i,begin,end) for(int i=(int)(begin-1),i##_end=(int)(end);i>=i##_end;--i)
#define foreach(x,a) for(auto&x:a)
using ll=long long;
const ll MOD=(ll)1e9+7;
//}}}

ll a[10000];
ll b[10000];
int main(){
  int N;
  cin >> N;
  rep(i, N) cin >> a[i];
  rep(i, N) cin >> b[i];
  ll sumA = 0;
  ll sumB = 0;
  ll count = 0;
  rep(i, N){
    sumA += a[i];
    sumB += b[i];
    if(a[i] < b[i]) count += (b[i] - a[i] + 1) / 2;
  }
  bool ans = (count <= sumB - sumA);
  puts(ans ? "Yes" : "No");
  return 0;
}


Measured memory_bytes: 384
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
const int INF=1e9;
const long double eps=1e-9;
inline ll read(){
	ll x=0,flag=1;
	char ch=getchar();
	while(!isdigit(ch) && ch!='-')ch=getchar();
	if(ch=='-')flag=-1,ch=getchar();
	while(isdigit(ch))x=(x<<3)+(x<<1)+ch-'0',ch=getchar();
	return x*flag;
}
int main(){
	ll i,j,k,m,n,ans=0;
	n=read();k=read();
	for(i=1;i<=n;i++)ans+=(n/i)*(max(0ll,i-k))+max(0ll,n%i-k+1);
	if(k==0)ans-=n;
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 256
A,B,C,X = [int(input()) for i in range(4)]

count = 0

for a in (range(A+1)):
    for b in (range(B+1)):
        for c in (range(C+1)):
            if a*500 + b*100 + c*50 == X:
                count += 1
                
print(count)

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

int main(){
	int n;
	cin >> n;
	int ans = 0;
	for(int i=0; i<n; i++){
		int a;
		cin >> a;
		ans += a-1;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#include <unordered_map>
#include <iomanip>
//#pragma GCC optimize("Ofast")  //デバッグ時にoptimized-outされて邪魔だった
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef pair<int,int> pii;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define floatprec(dig) fixed << setprecision(dig)
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
#define invar(typ, var) typ var; cin >> var;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX / 2;
const ll LLINF = 1LL<<60;
constexpr ll MOD = 1000000007;
const double EPS = 1e-9;

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

ll waru2(ll a) {
  ll c=0;
  while(a%2==0) { a/=2LL; c++; }
  return c;
}

signed main(void) {
  cin.tie(0); ios::sync_with_stdio(false);
  
  ll N, M; cin >> N >> M;
  vll a(N);
  rep(i, N) cin >> a[i];
  
  ll prev;
  if(N>=2) {
    prev = lcm(a[0] / 2, a[1] / 2);
    for(int i=2; i<N; ++i) {
      prev = lcm(prev, a[i] / 2);
    }
  } else {
    prev = a[0] / 2;
  }
  
  ll lw2 = waru2(prev);
  rep(i, N) {
    if(waru2(a[i] / 2) != lw2) {
      fin(0);
      return 0;
    }
  }
  
  fin((M / prev + 1) / 2);
}

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

int main() {
  int N, X, ans=0, cnt=1;
  cin >> N >> X;
  vector<int> list(N);
  
  for (int i = 0; i < N; i++) cin >> list.at(i);
  for (int j = 0; j < N; j++) {
    ans = ans + list.at(j);
    if (ans <= X) cnt++;
  }
  
  cout << cnt << endl;
}

Measured memory_bytes: 3636
import sys

# sys.stdin = open('c1.in')


def read_int_list():
    return list(map(int, input().split()))


def read_str_list():
    return input().split()


def read_int():
    return int(input())


def read_str():
    return input()


def main():
    a, b, c, d, e, f = read_int_list()
    best_water = 100 * a
    best_sugar = 0
    i = 0
    while 100 * i * a <= f:
        j = 0
        while 100 * i * a + 100 * j * b <= f:

            water = 100 * i * a + 100 * j * b
            k = 0
            while water + k * c <= f and k * c <= e * (i * a + j * b):

                l1 = int((f - water - k * c) / d)
                l2 = int((e * (i * a + j * b) - k * c) / d)
                l = min(l1, l2)
                if (i, j, k, l) != (0, 0, 0, 0):
                    if True:
                        # rapide
                        sugar = k * c + l * d
                        total = water + sugar
                        density = sugar / total
                        best_total = best_sugar + best_water
                        best_density = best_sugar / best_total
                        if density > best_density:
                            best_sugar = sugar
                            best_water = water
                    else:
                        # trop lent
                        l = 0
                        while water + k * c + l * d <= f and k * c + l * d <= e * (i * a + j * b):
                            if (i, j, k, l) == (0, 0, 0, 0):
                                continue
                            sugar = k * c + l * d
                            total = water + sugar
                            density = sugar / total
                            best_total = best_sugar + best_water
                            best_density = best_sugar / best_total
                            if density > best_density:
                                best_sugar = sugar
                                best_water = water
                            l += 1
                k += 1
            j += 1
        i += 1

    print(best_water + best_sugar, best_sugar)


main()


Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define ll long long int
#define M 1000000007
#define mod 998244353
#define mp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define pi pair<ll,ll>
#define endl "\n"
using namespace std;
const ll N=500010;

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

    ll a;
    cin>>a;
    ll ans= a+a*a+a*a*a;
    cout<<ans<<endl;

    return (0);
}


Measured memory_bytes: 3544
#include<iostream>
using namespace std;
long long f(long long n){return n*(n+1)/2;}
int main(){
  int n;
  cin>>n;
  long long ans=0;
  for(int i=1;i<=n;i++){
    long long r=n/i;
    ans+=f(r)*i;
  }cout<<ans<<endl;
  return 0;
}
  


Measured memory_bytes: 3620
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>

 
using namespace std;
 
#define INF 1000000000
#define EPS 1e-9
#define PI acos(-1)
 
typedef long long ll;

#define MAX_M 100

int m;
vector<ll> ans_list;

int main(){

  cin >> m;
  while(m > 0){
    m--;
    int n;
    ll money;
    ll year;
    ll ans = 0;
    cin >> money;
    cin >> year;
    cin >> n;
    while(n > 0){
      n--;
      ll mMoney = money;
      int num;
      double r;
      int mai;
      int t = 0;
      cin >> num >> r >> mai;
      if(num == 0){
	for(int i = 0; i < year; i++){
	  int B = mMoney*r/10*10;
	  t += B;
	  mMoney -= mai;
	}
	ans = max(ans, mMoney+t);
      }
      else{
	for(int i = 0; i < year; i++){
	  mMoney += -mai + mMoney*r/10*10;
	}
	ans = max(ans, mMoney);
      }
      
    }
  
    ans_list.push_back(ans);

  }

  for(int i = 0; i < ans_list.size(); i++){
    cout << ans_list[i] << endl;
  }

  return 0;

}

Measured memory_bytes: 1264