akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

template <class Abel> struct BIT {
    vector<Abel> dat[2];
    Abel UNITY_SUM = 0;                     // to be set
    
    /* [1, n] */
    BIT(int n) { init(n); }
    void init(int n) { for (int iter = 0; iter < 2; ++iter) dat[iter].assign(n + 1, UNITY_SUM); }
    
    /* a, b are 1-indexed, [a, b) */
    inline void sub_add(int p, int a, Abel x) {
        for (int i = a; i < (int)dat[p].size(); i += i & -i)
            dat[p][i] = dat[p][i] + x;
    }
    inline void add(int a, int b, Abel x) {
        sub_add(0, a, x * -(a - 1)); sub_add(1, a, x); sub_add(0, b, x * (b - 1)); sub_add(1, b, x * (-1));
    }
    
    /* a is 1-indexed, [a, b) */
    inline Abel sub_sum(int p, int a) {
        Abel res = UNITY_SUM;
        for (int i = a; i > 0; i -= i & -i) res = res + dat[p][i];
        return res;
    }
    inline Abel sum(int a, int b) {
        return sub_sum(0, b - 1) + sub_sum(1, b - 1) * (b - 1) - sub_sum(0, a - 1) - sub_sum(1, a - 1) * (a - 1);
    }
    
    /* debug */
    void print() {
        for (int i = 1; i < (int)dat[0].size(); ++i) cout << sum(i, i + 1) << ",";
        cout << endl;
    }
};

int main() {
    int N, Q; 
    cin >> N >> Q;
    vector<int> a(N);
    for (int i = 0; i < N; ++i) cin >> a[i], --a[i];

    vector<int> lefts(Q), rights(Q), ids(Q);
    for (int i = 0; i < Q; ++i) {
        cin >> lefts[i] >> rights[i];
        --lefts[i];
        ids[i] = i;
    }
    sort(ids.begin(), ids.end(), [&](int i, int j) {
            return rights[i] < rights[j];});

    BIT<int> bit(N+5);
    vector<int> prev(N, -1);
    vector<int> res(Q, 0);
    int r = 0;
    for (auto i : ids) {
        for (; r < rights[i]; ++r) {
            bit.add(prev[a[r]]+2, r+2, 1);
            prev[a[r]] = r;
        }
        int tmp = bit.sum(lefts[i]+1, lefts[i]+2);
        res[i] = max(res[i], tmp);
    }
    for (int i = 0; i < Q; ++i) cout << res[i] << endl;
}

Measured memory_bytes: 19324
#include <bits/stdc++.h>
#define mod 998244353
using namespace std;

int A, B, C, D;

int dp[3005][3005]={0};
int rec(int x, int y)
{
   if (dp[x][y] != 0) return dp[x][y];

   long long ans = 0, fac = 0;
   if (x==0 && y==0) return dp[x][y]=1;
   if(x>0)
      ans = ((long long)rec(x-1, y) * (B+y))%mod;
   if(y>0)
      ans = (ans + ((long long)rec(x,y-1)*(A+x))%mod)%mod;
   if(x> 0 && y > 0) {
     fac = rec(x-1,y-1);
     fac = (fac*(A+x-1+mod)%mod)%mod;
     fac = (fac*(B+y-1+mod)%mod)%mod;
     ans = (ans -fac +mod)%mod;
   }
  ans = ans%mod;

  return (dp[x][y]=ans);
}

void solve()
{

  cin >> A>>B>>C>> D;
  rec(C-A, D-B);
  cout<< dp[C-A][D-B]<<endl;
}
int main()
{
  int t;
  t =1;
  while(t--)
  {
    solve();
  }
}


Measured memory_bytes: 39236
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define db double
#define pll pair<ll,ll>
#define pdb pair<db,db>
#define ldb long double
#define clr(x) memset(x,0,sizeof(x))
#define count_bit(x) __builtin_popcount(x)
#define debug(x) cout<<#x<<" :: "<<x<<endl;
#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<endl;
#define debug3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<endl;
const int size1 = 1e5+7;
const int size2 = 1e4;

//ll fact[size1];
 
ll pw(ll x,ll y,ll mod)
{
    if(y==0)return 1;
    ll p =pw(x,y/2,mod);
    p = (p*p)%mod;
    if(y%2==1)p = (p*x)%mod;
    return p;
}
ll gcd(ll a,ll b)
{
	if(b==0)return a;
	a = a%b;
	return gcd(b,a);
}
// ll inverse(ll x,ll mod)
// {
//     return pw(x,mod-2,mod);
// }
// ll ncr(ll n,ll r,ll mod)
// {
//     ll num = fact[n];
//     ll den = (fact[r] * fact[n-r])%mod;
//     den = inverse(den,mod);
 
//     ll ans = (num*den)%mod;
//     return ans;
// }
// vector<ll> adj1[size1];
// vector<ll> adj[size1];
// ll d[size1];
// ll n,m;
// void dikstra(ll s)
// {
//     for(ll i=1;i<=n;i++)d[i]=1e9;
//     d[s] = 0;
//     priority_queue<pll, vector<pll>, greater<pll>> q;
//     q.push({0, s});
//     while(!q.empty())
//     {
//         ll v = q.top().ss;
//         ll d_v = q.top().ff;
//         q.pop();
//         if(d_v!=d[v])continue;
//         for(auto to:adj1[v])
//         {
//             ll len = 1;
//             if(d[v] + len < d[to])
//             {
//                 d[to] = d[v]+len;
//                 q.push({d[to],to});
//             }
//         }
//     }
// }
// vector<ll> adj[size1];
// void dfs(ll v,ll p)
// {
// 	for(auto u:adj[v])
// 	{
// 		if(u!=p)
// 		{
// 			dfs(u,v);
// 		}
// 	}
// }
const ll mod = 1e9+7;
int main()
{
    //cout<<setprecision(12)<<fixed;
    #ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
 	
 	
    ll T;
    //cin>>T;
    T = 1;
    ll cas=1;
    while(T--)
    {
        //cout<<"Case #"<<cas<<": ";cas++;
        ll n;cin>>n;
        ll arr[n+1],sum[n+1];
        sum[0]=0;
        for(ll i=1;i<=n;i++){
            cin>>arr[i];
            sum[i]=(arr[i]+sum[i-1])%mod;
        }
        ll ans = 0;
        for(ll i=1;i<=n-1;i++){
            ll val = (sum[n]-sum[i]+mod)%mod;
            val = (arr[i]*val)%mod;
            ans = (ans+val)%mod;
        }

        cout<<ans<<endl;

    }
}


Measured memory_bytes: 6776
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>
#include <time.h>
#include <tuple>
#include <iomanip>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e12;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1

ll sq(ll num) { return num*num; }
ll mod_pow(ll x, ll n) {
	if (n == 0)return 1;
	if (n == 1)return x%MOD;
	ll res = sq(mod_pow(x, n / 2));
	res %= MOD;
	if (n % 2 == 1) {
		res *= x;
		res %= MOD;
	}
	return res;
}
ll mod_add(ll a, ll b) { return (a + b) % MOD; }
ll mod_sub(ll a, ll b) { return (a - b + MOD) % MOD; }
ll mod_mul(ll a, ll b) { return a*b % MOD; }

int main(){
	ll n;
	cin>>n;
	ll num = n;
	ll s = 0;
	while(num){
		s+=num%10;
		num/=10;
	}
	if(n%s==0)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
int main(void){
    // Your code here!
    long long int N,H,W,x,i,j,k,ans,count,cost,tmp;
    long long int S[200010];
    long long int Ssum[200010];
    string T,U,V,ans2;
    bool flag;
    count=0;
    ans=std::pow(10,18);
    ans=0;
    flag=false;
        cin >> N;
        count=0;
    
    
        for (i=1;i<=N;i=i+2){
            count=0;
            for (j=1;j<=i;j++){
                if (i%j==0){
                    count+=1;
                }
            }
            if (count==8){
                ans+=1;
            }
            //cout << i<<endl;

        }

    
    
    cout << ans<<endl;

    return 0;
    
}


Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using PII = pair<int, int>;
using VI = vector<int>;

const LL MOD = 1e9 + 7;
const LL PHI = MOD - 1;
LL modpow(LL a, LL n) {
  if (n < 0 || n >= PHI) {
    n %= PHI;
    if (n < 0) n += PHI;
  }
  LL res = 1;
  for (; n > 0; n >>= 1) {
    if (n & 1) res = res * a % MOD;
    a = a * a % MOD;
  }
  return res;
}

int main() {
#ifdef LOCAL_EXEC
//	freopen("sample.in", "r", stdin);
//	freopen("sample.out", "w", stdout);
#else
  ios_base::sync_with_stdio(false); cin.tie(NULL);
#endif

  int n; cin >> n;
  vector<LL> c(n);
  for (LL& x: c) cin >> x;
  sort(c.begin(), c.end());

  LL ans = 0;
  for (int i = 0; i < n; i++) {
    ans += c[i] * (n - i + 1) % MOD;
  }
  ans %= MOD;
  ans *= modpow(2, 2 * n - 2);
  ans %= MOD;

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <math.h>
#include <numeric>
#include <vector>
#include <map>
#include <algorithm>
#include <set>
#include <queue>
#include <tuple>
#include <functional>
#include <cstring>

#define PI 3.14159265359
#define INF 1e9
#define LINF 1e18
#define IMOD 1000000007 
#define irep(i,n) for(int  i = 0; i < n; i++)
#define irep2(i,a,n) for(int i = a; i <= n; i++)
#define lrep(i,n) for(long long  i = 0; i < n; i++)
#define lrep2(i,a,n) for(long long i = a; i <= n; i++)

typedef long long ll;
typedef std::vector<int> v_int;
typedef std::vector<std::vector<int> > v2_int;
typedef std::vector<ll> v_ll;
typedef std::vector<std::vector<ll> > v2_ll;
typedef std::vector<std::string> v_string;
typedef std::vector<std::vector<std::string> > v2_string;
typedef std::vector<bool> v_bool;
typedef std::vector<std::vector<bool> > v2_bool;
typedef std::pair<ll, ll> pll;

using namespace std;

int main(void)
{
    int h, a;
    cin >> h >> a;
    
    cout << floor((h+a-1)/a);
	return 0;
}
/** atcodr **/


Measured memory_bytes: 256
//STring

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define int long long
#define rep(i,x,y) for(ll i=x;i<y;i++)
#define nvarep(n,a) ll n;cin>>n;vector<ll>a(n);rep(i,0,n)cin>>a[i]
#define vecrep(n,a,type) vector<type>a(n);rep(i,0,n)cin>>a[i]
#define lcm(a,b) (a/__gcd(a, b)*b)
#define range(a) (a).begin(),(a).end() 
#define pb push_back
#define mp make_pair
#define nnn "\n"
#define spa " "
using p = pair<ll, string>;
using graph = vector<vector<ll>>;
const int inf = 2147483647;//2*10^9
const ll INF = 9223372036854775807;//9*10^18

signed main (){
    string s;cin>>s;
    stack<char>t{};
    rep(i,0,s.size()){
        if(!t.empty()){
            if(t.top()=='S'&&s[i]=='T')t.pop();
            else t.push(s[i]);
        }else{
            t.push(s[i]);
        }
    }
    cout<<t.size()<<nnn;
    return 0;
}

Measured memory_bytes: 3752
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <queue>
#include <deque>
#include <map>
#include <set>
using namespace std;




int main()
{
	int n;
	cin >> n;
	if (n % 2 == 1) {
		cout << n * 2 << endl;
	}
	else {
		cout << n << 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;
using ll = long long;
int mod = 1000000007;

ll dp[101][100001];

void solve();

int main(void){
    int N, W; cin >> N >> W;
    ll weight[N+1] = {}, value[N+1] = {};
    rep(i, N) cin >> weight[i+1] >> value[i+1];

    ll bignum = pow(10, 13);
    rep(i, 101) rep(j, 100001) dp[i][j] = bignum;
    //i番目の品物が重さw, 価値v
    //合計の価値は高々10^5以下
    //dp[i][j]: 商品1-iまでで価値jを達成するうちで最小の重さ(存在しなければbignum)
    rep(i, N+1) dp[i][0] = 0;
    for(int i = 1; i <= N; i++){
        ll w = weight[i], v = value[i];
        for(int j = 1; j <= 100000; j++){
            if(j-v >= 0) dp[i][j] = min(dp[i-1][j-v] + w, dp[i-1][j]);
            else dp[i][j] = dp[i-1][j];
        }
    }
    
    int ans = 0;
    rep(i, 100001) if(dp[N][i] <= W) ans = i;
    cout << ans << endl;
    return 0;
}

void solve(){}

Measured memory_bytes: 79104
#include <bits/stdc++.h>
using namespace std;
int main()
  {int N; cin >> N;
  vector<int> A(N), B(N); for (int i = 0; i < N; ++i) cin >> A[i] >> B[i]; sort(begin(A), end(A)); sort(begin(B), end(B));
  auto m = (N - 1) / 2; cout << (N % 2 ? B[m] - A[m] + 1 : B[m] + B[m + 1] - (A[m] + A[m + 1]) + 1) << endl;}

Measured memory_bytes: 4764
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int answer = -1;

		if (1 <= A && A <= 9 && 1 <= B && B <= 9) answer = A * B;

		System.out.println(answer);
	}
}


Measured memory_bytes: 21844
#include <stdio.h>

int main()
{
        int A = 0;
        int B = 0;

        scanf("%d %d", &A, &B);

        if(A <= 8 && B <= 8)
        {
                printf("Yay!\n");
        }
        else
        {
                printf(":(\n");
        }

        return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    vector<int> t(5);
    int tmin = 10;
    for(int i = 0; i < 5; i++)
    {
        cin >> t[i];
        if(tmin > t[i]%10 && t[i]%10 != 0)
        {
            tmin = t[i]%10;
        }
    }
    int ans = 0;
    for(int i = 0; i < 5; i++)
    {
        if(t[i]%10 == 0)
        {
            ans += t[i];
        }
        else
        {
            ans += (t[i]/10)*10 + 10;
        }
    }
    cout << ans - 10 + tmin << endl;
}

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

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int x, y, z;
    cin >> x >> y >> z;
    int c = y;
    y = x;
    x = c;
    x = z;
    z = c;
    cout << x << " " << y << " " << z;
    return 0;
}


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

#define ll long long
#define endl "\n"

string s1[55],s2[55];
int main()
{
  int  n,m;
  cin>>n>>m;
  for(int i=0;i<n;++i)
   cin>>s1[i];
  for(int i=0;i<m;++i)
   cin>>s2[i];
      for(int c1=0;c1<n-m+1;++c1){
       for(int c2=0;c2<n-m+1;++c2){
        bool f=true;
         for(int i=0;i<m;++i){
          for(int j=0;j<m;++j){
              if(s1[i+c1][j+c2]!=s2[i][j]){
                f=false;
                break;
              }
          if(f==false)
                break;
         }
      }
      if(f){
        cout<<"Yes"<<endl;
        return 0;
      }
      }
    }
      cout<<"No"<<endl;
return 0;
}


Measured memory_bytes: 256
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val spList = mutableListOf<Triple<String,Int,Int>>()
    (1..n).forEach {
        val (s,p) = readLine()!!.split(' ')
        spList.add(Triple(s,p.toInt(),it))
    }
    spList.sortByDescending { it.second }
    spList.sortBy { it.first }
    spList.forEach { println(it.third) }
}


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

int main() {
 string s, t;
  cin >> s >> t;
  
  sort(t.begin(), t.end());
  reverse(t.begin(), t.end());
  
  sort(s.begin(),s.end());
  
  if(s < t) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
  
}

Measured memory_bytes: 256
//1:27
#include <stdio.h>
#include <string.h>
#include <algorithm>

typedef long long ll;
ll max(ll a, ll b){return(a>b)?a:b;}
ll min(ll a, ll b){return(a<b)?a:b;}
ll abs(ll a){return(a<0)?-a:a;}

ll gcd(ll a, ll b){
        if(b > a){
                ll tmp = b;
                b = a;
                a = tmp;
        }
        if(b == 0) return a;
        else return gcd(b, a%b);
}
ll lcm(ll a, ll b){
        ll gcdi = gcd(a,b);
        return a/gcdi*(b);
}

ll a[2*100000];
ll b[2*1000000];
int main(){
        int N;
        scanf("%d",&N);

        for(int i = 0; i < N; i ++){
                scanf("%lld",a+i);
        }
        int l = 1000000, r=1000000+1;
        int dir = 0;

        for(int i = 0; i < N; i++){
                if(dir){
                        b[r++] = a[i];
                }else{
                        b[l--] = a[i];
                }
                dir = !dir;
        }

        if(dir){
                l++; r--;
                while(l < r){
                        printf("%lld ", b[l++]);
                }
                printf("%lld\n", b[l]);
        }else{
                l++; r--;
                while(l < r){
                        printf("%lld ", b[r--]);
                }
                printf("%lld\n", b[r]);
        }

}

Measured memory_bytes: 9088
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

int main() {
    int n, x;
    cin >> n >> x;
    VL w(n), v(n);
    REP(i,n){
        w[i] = in();
        v[i] = in();
    }
    int m = 100010;
    VL dp(m, 1e18);
    dp[0] = 0;
    REP(i,n){
        FORR(j,m-v[i]-1,0){
            dp[j + v[i]] = min(dp[j + v[i]], dp[j] + w[i]);
        }

    }
    int ans = 0;
    REP(i,m){
        if (dp[i] <= x) ans = i;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1024
N = int(input())
a = []
b = []
total_profit = []
for i in range(N):
    a.append(list(map(int, input().split())))
for j in range(N):
    b.append(list(map(int, input().split())))

for k in range(2, 2 ** 10):
    d = bin(k)
    e = "0" * (12 - len(d)) + d[2:]
    profit = 0
    for l in range(N):
        common_open = 0
        for m in range(10):
            if a[l][m] == 1 and int(e[m]) == 1:
                common_open = common_open + 1
        profit = profit + b[l][common_open]
    total_profit.append(profit)

print(max(total_profit))

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
long long dp[101][100005];

int main()
{
    long long n,W;
    cin>>n>>W;
    pair<long long,long long> arr[101];
    for(long long i=0;i<n;i++)
    {
        cin>>arr[i].first>>arr[i].second;
    }
    for(long long i=0;i<=W;i++)
    {
        if(arr[0].first<=i)
        {
            dp[0][i]=arr[0].second;
        }
    }
    for(long long i=1;i<n;i++)
    {
        for(long long j=0;j<=W;j++)
        {   
            if(j<arr[i].first)
            {
                dp[i][j]=dp[i-1][j];
            }
            else
            dp[i][j]=max(dp[i-1][j],dp[i-1][j-arr[i].first]+arr[i].second);
        }
    }
    cout<<dp[n-1][W]<<endl;
    return 0;
}


Measured memory_bytes: 78336
#include<cstdio>
#include<cstring>
#include<iostream>
using namespace std;
int n,p=0,flag,ans[1005],nown;
long long a[1005],sum[2],mx,tmp[1005];
bool use[1005],by[1005];
inline void find(int now){
	ans[0]++;ans[ans[0]]=now+1;
	a[now]=0;
	nown=0;
	memset(by,false,sizeof(by));
	memset(use,false,sizeof(use));
	if(now!=0){
		by[now-1]=true;
		a[now]+=a[now-1];
	}
	if(now!=n-1){
		by[now+1]=true;
		a[now]+=a[now+1];
	}
	for(register int i=0;i<n;i++){
		tmp[i]=a[i];
	}
	for(register int i=0;i<n;i++){
		if(by[i]==0){
			a[nown]=tmp[i];
			nown++;
		}
	}
	for(register int i=0;i<n;i++){
		if(a[i]>0&&i%2==flag){
			use[i]=true;
		}
	}
	n=nown;
}
int main(){
	scanf("%d",&n);
	for(register int i=0;i<n;i++){
		scanf("%lld",&a[i]);
		if(a[i]>0){
			sum[p]+=a[i];
		}
		p=!p;
	}
	if(sum[0]==0&&sum[1]==0){
		for(register int i=0;i<n;i++){
			mx=a[i]>a[mx]?i:mx;
		}
		printf("%lld\n%d\n",a[mx],n-1);
		for(register int i=0;i<mx;i++){
			printf("1\n");
			n--;
		}
		for(register int i=n;i>=2;i--){
			printf("%d\n",i);
		}
		return 0;
	}
	switch(sum[0]>sum[1]){
		case true:flag=0;break;
		case false:flag=1;break;
	}
	for(register int i=0;i<n;i++){
		if(a[i]>0&&i%2==flag){
			use[i]=true;
		}
	}
	while(n>=2){
		for(register int i=0;i<n;i++){
			if(i==0||i==n-1){
				if(use[i]==false){
					if(i==0){
						flag=!flag;
					}
					find(i);
					break;
				}
			}
			else{
				if(use[i-1]==use[i+1]){
					find(i);
					break;
				}
			}
		}
	}
	printf("%lld\n%d\n",a[0],ans[0]);
	for(register int i=1;i<=ans[0];i++){
		printf("%d\n",ans[i]);
	}
	return 0;
}

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

#define Fast ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0)
#define FO freopen("in.txt", "r", stdin)
#define FC freopen("out.txt", "w", stdout)
#define aise cout<<"aise"<<endl
#define pb push_back
#define mp make_pair
#define ll long long
#define mset(v, a) memset(v, a, sizeof(v))
#define pll pair< ll, ll >
#define pdd pair< double, double >
#define ff first
#define ss second
#define pi acos(-1.0)
#define mxN 2097162
#define inf 1e9
#define MOD 1000000007

int main()
{

    ll n, d;
    cin >> n >> d;
    d = 1+2*d;
    if(n%d) cout << n/d+1;
    else cout << n/d;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
typedef long long ll;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#define ios ios_base::sync_with_stdio(0) ; cin.tie(0) ; cout.tie(0)
#define so sizeof
#define pb push_back
#define cl clear() ;
#define vl vector<ll>
#define sz size()
#define len length()
#define el endl;cout.flush()
#define be begin()
#define fi first
#define se second
#define br break
#define en end()
#define ro return 0
#define br break
#define eb emplace_back
#define con continue
#define ms(x) memset(x , 0, so x)
#define all(x) (x).be , (x).en
#define rall(x) (x).rbegin() , (x).rend()
#define acc(x) accumulate((x).be , (x).en , 0ll)
#define forn(i,a,b) for(ll i=a;i<=b;++i)
#define rng_58 mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define vll vector<pair<ll,ll> >
#define pll pair<ll,ll>
#define plll pair<ll,pair<ll,ll>>
#define plvl pair<pair<ll,ll> ,ll>
#define mp make_pair
#define trace2(a,b) cerr <<"a is " << a << " b is " << b << el;
#define trace3(a,b,c) cerr <<"a is " << a << " b is " << b << " c is " << c << el;
#define trace4(a,b,c,d) cerr <<"a is " << a << " b is " << b << " c is " << c <<" d is " << d << el ;
#define trace5(a,b,c,d,e) cerr <<"a is " << a << " b is " << b << " c is " << c <<" d is " << d << " e is " << e << el;
#define trace6(a,b,c,d,e,f) cerr <<"a is " << a << " b is " << b << " c is " << c <<" d is " << d << " e is " << e << " f is " << f << el ;
typedef long double ld ;
int main()
{
    ios;
    cout << fixed ;
    cout << setprecision(15);
    ld n , k ;
    cin >> n >> k ;
    ld ans = 0 ;
    for(long double i = 1 ; i <= n ;++i){
       if(i >= k){
          ld foo = (1 /n) ;
          ans = ans + foo ;
       }
       else if(i < k){
         ld cho = (1 / n) ;
         ld res = i ;
         ld cnt = 0 ;
         while(res < k ){
            res = res * 2 ;
            ++cnt ;
         }
         ld coin = 1 ;
         for(long double kk = 1 ; kk<=cnt ; ++kk){
            coin = coin * 2 ;
         }
         ///cout << "i is " << i << " coin is " << coin << el ;
         ld fiz =  1 / coin ;
         ld rss = cho * fiz ;
         ans = ans + rss ;
       }
    }
    cout << ans << el ;
}


















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

using namespace std;

long long s, n, t;
long long a[200200];

int main () {
    cin >> s >> n;
    for (int i = 1; i <=n; i++) {
        cin >> a[i];
        if ( i > 1 ) {
            t = max(t, a[i] - a[i - 1]);
        }
    }
    t = max(t, s - a[n] + a[1]);
    cout << s - t;
}


Measured memory_bytes: 1792
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] age)throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringBuffer sb = new StringBuffer();

		String input = br.readLine();
		int n = Integer.parseInt(input);
		int i = 0;
		int j = 0;
		int k = 0;

		int room[][][] = new int[4][3][10];
		for( i=0 ; i<4; i++ ){
			for( j=0 ; j<3 ; j++ ){
				for ( k=0 ; k<10 ; k++ ){
					room[i][j][k]=0;
				}
			}
		}

		for( i=0 ; i<n ; i++){
			String[] reinput = br.readLine().split(" ");
			int b = Integer.parseInt(reinput[0])-1;
			int f = Integer.parseInt(reinput[1])-1;
			int r = Integer.parseInt(reinput[2])-1;
			int v = Integer.parseInt(reinput[3]);
			room[b][f][r] = room[b][f][r] + v;
		}

		for( i=0 ; i<4 ; i++ ){
			for( j=0 ; j<3 ; j++ ){
				for( k=0 ; k<10 ; k++ ){
					sb.append(" ").append(Integer.toString(room[i][j][k]));
				}
				sb.append("\n");
			}
			if( i==3 ) break;
			sb.append("####################\n");
		}

		System.out.print(sb);
	}
}

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

using namespace std;

#define sz(x) (int)(x.size())
#define rep(i,a,b) for(int i=a;i<b;++i)
#define pb push_back
typedef long long ll;
/////////////////////////

void solve(){
	int n;
	cin >> n;
	ll f, s;
	f = s = 1LL;
	rep(i, 0, n){
		ll a, b;
		cin >> a >> b;
		ll mini = max(f / a + (f % a != 0 ? 1 : 0), s / b + (s % b != 0 ? 1 : 0));
		f = a * mini;
		s = b * mini;
	}
	
	cout << f + s << endl;
}

int main(){
#ifdef _DEBUG
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
#endif

	solve();

	return 0;
}

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

int main(void){
  string s;
  int k;

  cin >> s >> k;

  for(int i = 0; i < k; i ++){
    if(s.at(i) != '1'){
      cout << s.at(i) << endl;
      return 0;
    }
  }

  cout << "1" << endl;

  return 0;
}


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

public class Main {
    private static Scanner sc;
    public static void main(String[] args) {
        Main instance = new Main();
        sc = instance.new Scanner();
        instance.solve();
    }

    private void solve() {
        try {
            int N = sc.nextInt();
            List<Integer> V = new ArrayList<>();

            for (int i = 0; i < N; i++) {
                V.add(sc.nextInt());
            }

            int sum = 0;
            for (int i = 0; i < N; i++) {
                int tmp = sc.nextInt();
                if (V.get(i) - tmp > 0) {
                    sum += V.get(i) - tmp;
                }
            }

            System.out.println(sum);



        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    private class Scanner {
        String[] s;
        int i;
        BufferedReader br;
        String regex = " ";

        public Scanner() {
            s = new String[0];
            i = 0;
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        @Override
        protected void finalize() throws Throwable {
            try {
                super.finalize();
            } finally {
                destruction();
            }
        }

        private void destruction() throws IOException {
            if (br != null) br.close();
        }

        public String next() throws IOException {
            if (i < s.length) return s[i++];
            String st = br.readLine();
            while (st == "") st = br.readLine();
            s = st.split(regex, 0);
            i = 0;
            return s[i++];
        }

        public int nextInt() throws NumberFormatException, IOException {
            return Integer.parseInt(next());
        }

        public Long nextLong() throws NumberFormatException, IOException {
            return Long.parseLong(next());
        }

        public Double nextDouble() throws NumberFormatException, IOException {
            return Double.parseDouble(next());
        }
    }
}

Measured memory_bytes: 21332
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,k;cin>>n>>k;
    string s;cin>>s;
    int x=0,ans=0;
    for(int i=0;i<n-1;i++){
        if(s[i]!=s[i+1])x++;
        else ans++;
    }
    cout<<min(2*k+ans,n-1)<<endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
    
#define int long long

#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define FORR(i,m,n) for(int i=m;i>=n;i--)
#define pb(x) push_back(x)
#define mp(x, y) make_pair(x, y) 
#define SORT(x) sort((x).begin(),(x).end())
#define INF 99999999999
    
using namespace std;

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

int32_t main(){
    int n;
    cin >> n;
    set<int> s;
    REP(i, n){
        int a;
        cin >> a;
        if(s.find(a)==s.end()) s.insert(a);
        else s.erase(a);
    }
    cout << s.size() << endl;
}

Measured memory_bytes: 4864
#include <bits/stdc++.h>
using namespace std;
int main()
{
  long long int a, b, k;
  cin >> a >> b >> k;
  //cout << a << " "<< b << " " << k << endl;
  if(k>=a)
  {
    k=k-a;
    a=0;
    //cout << k << endl;
  }

  else
  {
    a=a-k;
    k=0;
  }
  //cout << k << endl;
  b=b-k;
  if(b<0)
  {
      b=0;
  }
  cout << a << " " << b << endl;
  return 0;
}



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

int main() {

  // int型の2次元配列(3×3要素の)の宣言
  vector<vector<int>> data(3, vector<int>(3));
  vector<vector<int>> data2 = {
  {0, 0, 0},
  {0, 0, 0},
  {0, 0, 0},
};
  int N;
  string R;
  // 入力 (2重ループを用いる)
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      cin >> data.at(i).at(j);
    }
  }
  cin >> N;
  for(int a = 0; a < N; a++){
    int b;
    cin >> b;
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {

      // 上からi番目、左からj番目の画素が0かを判定
      if (data.at(i).at(j) == b) {
        data2.at(i).at(j) = 1;
      }
    }
  }
  }
  if(data2.at(0).at(0)&&data2.at(0).at(1)&&
    data2.at(0).at(2)){
  R = "Yes";}
   else if(data2.at(1).at(0)&&data2.at(1).at(1)&&
    data2.at(1).at(2)){
  R = "Yes";}
    else if(data2.at(1).at(0)&&data2.at(1).at(1)&&
    data2.at(1).at(2)){
  R = "Yes";}
  else if(data2.at(2).at(0)&&data2.at(2).at(1)&&
    data2.at(2).at(2)){
  R = "Yes";}
  else if(data2.at(0).at(0)&&data2.at(1).at(0)&&
    data2.at(2).at(0)){
  R = "Yes";}
    else if(data2.at(0).at(1)&&data2.at(1).at(1)&&
    data2.at(2).at(1)){
  R = "Yes";}
  else if(data2.at(0).at(2)&&data2.at(1).at(2)&&
    data2.at(2).at(2)){
  R = "Yes";}
  else if(data2.at(0).at(0)&&data2.at(1).at(1)&&
    data2.at(2).at(2)){
  R = "Yes";}
  else if(data2.at(0).at(2)&&data2.at(1).at(1)&&
    data2.at(2).at(0)){
  R = "Yes";}
  else{
  R = "No";}
   cout << R << endl;

}

Measured memory_bytes: 256
s=[len(c) for c in list(input().split("T"))]
x,y=map(int,input().split())
XX=s[::2]
YY=s[1::2]
X=set([XX[0]])
Y=set([0])
XXX=[]
for i in range(1,len(XX)):
    for j in X:
        XXX.append(j+XX[i])
        XXX.append(j-XX[i])
    X=set(XXX)
    XXX=[]

YYY=[]
for i in range(len(YY)):
    for j in Y:
        YYY.append(j+YY[i])
        YYY.append(j-YY[i])
    Y=set(YYY)
    YYY=[]

if x in X and y in Y:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 60764
#include <bits/stdc++.h>
#define rep(i,n) for (ll i=0; i < (n); ++i)
using namespace std;
typedef long long ll;
ll N,X,x[100000],g;

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

int main(void){
    cin >> N >> X;
    rep(i,N)cin >> x[i];
    g = abs(X-x[0]);
    rep(i,N){
        g = gcd(g,abs(X-x[i]));
    }
    cout << g << endl;
}


Measured memory_bytes: 1024
N=int(input())
S=[]
ans=0
for i in range(N):
    s=int(input())
    S.append([s,s%10])
    ans+=s

if ans%10!=0:
    print(ans)
    exit()

S.sort(key=lambda x:x[0])
for i in range(N):
    if S[i][1]!=0:
        ans-=S[i][0]
        print(ans)
        exit()
print(0)

Measured memory_bytes: 3060
#include <iostream>
using namespace std;
int main(){
  int t;
  while(cin >> t,t){
  int ans = 0;
  int t500 = (1000 - t)/500;
  int t100 = (1000 - t)/100 - 5*t500;
  int t50 =  ((1000 - t)%100)/50;
  int t10 = (((1000 - t)%100)%50)/10;
  int t5 = ((1000 - t)%10)/5;
  int t1 = ((1000 - t)%10)%5;
  ans = t500 + t100 + t50 + t10 + t5 + t1;
  cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 1160
fn main() {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();
    let a: usize = iter.next().unwrap().parse().unwrap();
    let b: usize = iter.next().unwrap().parse().unwrap();

    let n = if a < b { b } else { a };
    let p = if a < b { a } else { b };

    for _ in 0..n {
        print!("{}", p);
    }
    println!("");
}


Measured memory_bytes: 4352
import { readFileSync } from 'fs'

const map = {
  'A': 'T',
  'T': 'A',
  'C': 'G',
  'G': 'C',
}

function main(input: string) {
  console.log(map[input as keyof typeof map])
}

main(readFileSync('/dev/stdin', 'utf8').trim())


Measured memory_bytes: 7372
#include <iostream>

using namespace std;

const int MOD = 1000000007;
const int MAX = 1100000;

long long fac[MAX], finv[MAX], inv[MAX];

void comInit() {
	fac[0] = fac[1] = inv[1] = finv[0] = finv[1] = 1;
	for (int 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 nCr(int n, int r) {
	if (n < r || n < 0 || r < 0) return 0;
	return fac[n] * (finv[r] * finv[n - r] % MOD) % MOD;
}

int main() {
	comInit();
	int x, y; cin >> x >> y;
	int xx = -x + 2 * y, yy = 2 * x - y;
	x = xx / 3, y = yy / 3;
	if (xx < 0 || yy < 0 || xx % 3 != 0 || yy % 3 != 0) cout << 0 << endl;
	else cout << nCr(x + y, x) << endl;
	
	return 0;
}
/*
	created: 2019-12-09
	https://atcoder.jp/contests/abc145/tasks/abc145_d
*/

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

#define int long long
#define For(i, a, b) for (int i = (a); i <= static_cast<int>(b); i++)
#define Forr(i, a, b) for (int i = (a); i >= static_cast<int>(b); i--)
#define rep(i, n) For(i, 0, n - 1)
#define repall(i, arr) for (auto& i : (arr))
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define dump(x) cerr << #x << " = " << (x) << '\n'
#define dump2(x, y) \
    cerr << #x << " = " << (x) << " " << #y << " = " << (y) << '\n'

template <typename T>
using pq = priority_queue<T>;
template <typename T>
using pqr = priority_queue<T, vector<T>, greater<T>>;
const int INF = LLONG_MAX / 2;
constexpr int MOD = 1e9 + 7;
using P = pair<int, int>;
using vec = vector<int>;
using mat = vector<vec>;

template <typename T1, typename T2>
ostream& operator<<(ostream& stream, const pair<T1, T2>& p) {
    return stream << p.first << " " << p.second;
}
template <typename T>
void print(const vector<vector<T>> matrix) {
    repall (vec, matrix)
        print(vec);
}
template <typename T>
void print(const vector<T> vec) {
    unsigned int len = vec.size();
    rep (i, len - 1)
        cout << vec[i] << ' ';
    cout << vec[len - 1] << '\n';
}
template <typename Arg>
void print(const Arg arg) {
    cout << arg << '\n';
}
template <typename Head, typename... Args>
void print(const Head head, const Args... args) {
    cout << head << " ";
    print(args...);
}
template <typename T>
T sum_(vector<T> vec, T init = 0) {
    return std::accumulate(all(vec), T(init));
}

void yn(bool tf) { print(tf ? "Yes" : "No"); }
void YN(bool tf) { print(tf ? "YES" : "NO"); }

template <typename T>
void init(vector<T>& v) {
    rep (i, v.size())
        cin >> v[i];
}

template <typename T, typename U>
void init(vector<T>& v, vector<U>& w) {
    assert(v.size() == w.size());
    rep (i, v.size())
        cin >> v[i] >> w[i];
}

int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }

// -------------------------------------------------------------------
// sort 1 2 3 4
// pqr 1 2 3 must impl >
struct Edge {
    int to;
    int weight;
};

void dfs(int n, int c, vector<vector<Edge>>& mat, vec& ans) {
    ans[n] = c;
    repall (e, mat[n]) {
        if (ans[e.to] == -1) {
            if (e.weight % 2 == 0) {
                ans[e.to] = c;
                dfs(e.to, c, mat, ans);
            } else {
                ans[e.to] = 1 - c;
                dfs(e.to, 1 - c, mat, ans);
            }
        }
    }
}

signed main() {
    cin.tie(0), cout.tie(0), ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<vector<Edge>> mat(n + 1);
    vec ans(n + 1, -1);
    int u, v, w;
    rep (i, n - 1) {
        cin >> u >> v >> w;
        mat[u].pb(Edge{v, w});
        mat[v].pb(Edge{u, w});
    }

    dfs(1, 0, mat, ans);

    For(i, 1, n) print(ans[i]);

    return 0;
}


Measured memory_bytes: 10752
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int Nmax = 2e5 + 5;

int T[Nmax];
int pos[Nmax];
int a[Nmax];
int n,ans;

void update(int i, int val)
{
    while (i <= n)
    {
        T[i] = max(T[i], val);
        i += i & -i;
    }
}

int get(int i)
{
    int res = 0;
    while (i)
    {
        res = max(res, T[i]);
        i -= i & -i;
    }
    return res;
}

signed main()
{
    //freopen("file.inp","r",stdin);
    cin >> n;
    for (int i = 1; i <= n; i++)
    {
        cin >> pos[i];
    }
    for (int i = 1; i <= n; i++)
    {
        cin >> a[i];
    }
    for (int i = 1; i <= n; i++)
    {
        int res = get(pos[i]) + a[i];
        update(pos[i], res);
        ans = max(ans, res);
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 8312
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))

sf = 0
for i in range(n):
    sf += b[a[i]-1]
    if i != n - 1:
        if a[i] + 1 == a[i + 1]:
           sf += c[a[i]-1]

print(sf)

Measured memory_bytes: 3064
#include"bits/stdc++.h"
using namespace std;
using ll=long long;
template<typename T=ll>inline T in(istream&is=cin){T ret;is>>ret;return ret;}
template<typename T>inline auto vec2(typename vector<T>::size_type h,typename vector<T>::size_type w,T v=T()){return vector<vector<T>>(h,vector<T>(w,v));}

int main()
{
    ll a=in(),b=in(),c=in(),k=in();
    cout<<(k<=a?k:k<=a+b?a:2*a+b-k)<<endl;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
constexpr int MOD = 1000000007;
constexpr int INF = numeric_limits<int>::max() / 2;
typedef pair<int,int> P;
using Graph = vector<vector<int>>;
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; }
const double PI = acos(-1.0);
// cout << fixed << setprecision(14);
 
signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);

    string S;
    cin >> S;
    int N = S.size();
    int ans = N;
    rep(i,N-1){
        if(S[i] != S[i+1]){
            int ans1 = max(i+1,N-1-i);
            chmin(ans,ans1);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 512
//new.cpp
/*
Author : Hocky Yudhiono
Min 11 Nov 2018 07:01:22  WIB
Current Local Time : 19:01:22

getchar_unlocked > getchar > cin without sync > scanf > cin with sync
bool operator<(const MyStruct& rhs) const
*/

#include <algorithm>
#include <iostream>
#include <stdlib.h>
#include <cassert>
#include <cstring>
#include <iomanip>
#include <limits>
#include <string>
#include <vector>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <map>
#include <set>

using namespace std;

#if 0
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC optimize(3)
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC target("sse3","sse2","sse")
#pragma GCC target("avx","sse4","sse4.1","sse4.2","ssse3")
#pragma GCC target("f16c")
#pragma GCC optimize("inline","fast-math","unroll-loops","no-stack-protector")
#pragma GCC diagnostic error "-fwhole-program"
#pragma GCC diagnostic error "-fcse-skip-blocks"
#pragma GCC diagnostic error "-funsafe-loop-optimizations"
#pragma GCC diagnostic error "-std=c++14"
#pragma GCC target ("string"...)
#pragma GCC push_options
#pragma GCC pop_options
#pragma GCC reset_options
#pragma GCC optimize ("O3")
#endif

typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
//If the time limit is strict, try not to use long double

#define mp make_pair
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define remove erase
//Remember to undefine if the problem is interactive
#define endl '\n'
#define DEBUG(X) cout << ">>> DEBUG(" << __LINE__ << ") " << #X << " = " << (X) << endl

const double eps = 1e-9;
const int INFMEM = 63;
const int INF = 1061109567;
const LL LINF = 4557430888798830399LL;
const double DINF = numeric_limits<double>::infinity();
const LL MOD = 1000000007;
const int dx[8] = {1,0,-1,0,1,1,-1,-1};
const int dy[8] = {0,1,0,-1,1,-1,1,-1};
const double PI = 3.141592653589793;

#ifdef _WIN32
#define getchar_unlocked getchar
#endif
#define GETCHAR getchar_unlocked
inline void fastll(LL &input_number) 
{
    input_number = 0;
    int ch = GETCHAR();
    int sign = 1;
    while(ch < '0' || ch > '9'){
        if(ch == '-') sign=-1;
        ch = GETCHAR();
    }
    while(ch >= '0' && ch <= '9'){
        input_number = (input_number << 3)+(input_number << 1) + ch-'0';
        ch = GETCHAR();
    }
    input_number *= sign;
}

inline void open(string a){
    freopen((a+".in").c_str(),"r",stdin);
    freopen((a+".out").c_str(),"w",stdout);
}

inline void fasterios(){
    //Do not use if interactive
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
}

LL a,b;

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int MOD = 1000000007;

int main() {
  ll N;
  cin >> N;
  ll ans = 1LL;
  for (ll i=0LL; i<N; i++) {
    ans *= i+1;
    ans %= MOD;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//#pragma GCC optimize("Ofast")
#define rep(i,n) for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
#define pi M_PI
#define PQ(T) priority_queue<T>
#define SPQ(T) priority_queue<T,vector<T>,greater<T>>
using ll=long long;
using P=pair<ll,ll>;
using PP=tuple<ll,ll,ll>;
using S=multiset<ll>;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;
const ll inf=1001001001001001;
const int INF=1001001001;
const int mod=1000000007;
const double eps=1e-10;
template<class T> 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;}
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<'\n';}
template<class T> void outvp(T v){rep(i,v.size())cout<<'('<<v[i].fi<<','<<v[i].se<<')';cout<<'\n';}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<'\n';}
template<class T> void outvv(T v){rep(i,v.size())outv(v[i]);}
template<class T> bool isin(T x,T l,T r){return (l)<=(x)&&(x)<=(r);}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
void decimal(int x){cout<<fixed<<setprecision(x);}
//ll GCD(ll a,ll b){if(b==0) return a; return GCD(b,a%b);}
//ll LCM(ll a,ll b){return(a/GCD(a,b))*(b/GCD(a,b))*GCD(a,b);}
ll POW(ll a,ll b){a%=mod;if(b==0)return 1;if(b&1)return a*POW(a,b-1)%mod;ll k=POW(a,b/2);return k*k%mod;}
vi calc(ll x){vi res;while(x>0){res.eb(x%10);x/=10;}reverse(all(res));return res;}

void solve(){
  int n; cin>>n;
  int a=0,b=0,c=0,d=0;
  rep(i,n){
    string s; cin>>s;
    if(s=="AC") a++;
    else if(s=="WA") b++;
    else if(s=="TLE") c++;
    else d++;
  }
  cout<<"AC x "<<a<<'\n';
  cout<<"WA x "<<b<<'\n';
  cout<<"TLE x "<<c<<'\n';
  cout<<"RE x "<<d<<'\n';
}

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


Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
#define FILEIN freopen("input.txt", "r", stdin)
#define endl "\n"
#define ll long long

const ll m = 1e9 + 7;

int main(){
    // FILEIN;
    int n, m, pen = 0, co = 0;cin>>n>>m;
    vector<int> v(m), wa(n+1, 0), ac(n+1, 0);
    string s;
    for(int i = 0; i<m; i++){
        cin>>v[i]>>s;
        if(s == "WA" && !ac[v[i]]){
            wa[v[i]]++;
        }else if(s == "AC" && !ac[v[i]]){
            pen += wa[v[i]];
            ac[v[i]]++;
            co++;
        }
    }
    cout<<co<<" "<<pen<<endl;
    
}

Measured memory_bytes: 1408
/*Function Template*/
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int MAX = 510000;
const int MOD = 1e17;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define Rep(i, n) for(ll i = 1; i < (n); i++)
#define ALL(a)  (a).begin(),(a).end()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll fac[MAX], finv[MAX], inv[MAX];


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;
}
// テーブルを作る前処理
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;
    }

}
ll Len(ll n) {
  ll s=0;
  while(n!=0) s++, n/=10;
  return s;
}


ll Sint(ll n) {
  ll m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(ll i=s-1;i>=0;i--) m+=n/((ll)pow(10,i))-(n/((ll)pow(10,i+1)))*10;
  return m;
}


ll Svec(vector<ll> v){
  ll n=0;
  for(ll i=0;i<v.size();i++) n+=v[i];
  return n;
}


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 Factorial(ll n){
  ll m=1;
  while(n>=1) m*=n,n--;
  return m;
}

void runlength(string s,vector<pair<char,ll>> &p){
  ll x=1;
  if(s.size()==1){
    p.push_back(pair<char,ll>(s[0],1));
  }
  for(ll i=0;i<s.size()-1;i++){
    if(s[i]==s[i+1]){
      x++;
      if(i==s.size()-2){
        p.push_back(pair<char,ll>(s[i],x));
      }
    }else{
      p.push_back(pair<char,ll>(s[i],x));
      x=1;
      if(i==s.size()-2){
        p.push_back(pair<char,ll>(s[s.size()-1],x));
      }
    }
  }
}




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

const int MAX_N=100010;
vector<bool> sieve_of_eratosthenes(){
  vector<bool> isPrime(MAX_N+1,true);
  for(int i=2;i<=MAX_N;i++){
    if(isPrime[i]){
      for(int j=2*i;j<=MAX_N;j+=i){
        isPrime[j]=false;
      }
    }
  }
  return isPrime;
}



/*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/
int main() {
  IOS;
  ll n;
  cin>>n;
  vector<ll> v(n);
  rep(i,n) cin>>v[i];
  ll ans=MOD,tmp=v[0],sum=Svec(v)-v[0];
  rep(i,n-1){
    chmin(ans,abs(tmp-sum));
    tmp+=v[i+1];
    sum-=v[i+1];
  }
  chmin(ans,abs(tmp-sum));
  cout<<ans<<endl;
  
  
}


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

using namespace std;

int main(){
	int n;
	cin>>n;
	bool flag=false;
    vector<int> c(n+1);
    for(int i=0;i<n;i++){
    	cin>>c[i];
	}
	for(int i=0;i<n;i++){
    	if(c[i]%2==0){
    		if(c[i]%3==0 || c[i]%5==0){
    			flag=true;
			}
			else{
				flag=false;
			}
			if(!flag){
				cout<<"DENIED";
				return 0;
			}	
		}   
	
	}
	cout<<"APPROVED";
	return 0;
	
}

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

int main() {
  
  string S;
  cin >> S;
  int counter = 0;
  
  if(S[0]=='o') counter++;
  if(S[1]=='o') counter++;
  if(S[2]=='o') counter++;
  
  cout << 700 + counter*100 << endl;
  
}


Measured memory_bytes: 256