akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<sstream>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<algorithm>
#include<numeric>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>

#define rep(i,n) for(int i=0;i<n;i++)
#define all(c) (c).begin(),(c).end()
#define mp make_pair
#define pb push_back
#define rp(i,c) rep(i,(c).size())
#define fr(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define dbg(x) cerr<<#x<<" = "<<(x)<<endl

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
const int inf=1<<28;
const double INF=1e12,EPS=1e-9;

int cake,land,calo,edge;
int n,node;
int gain[6],d[7000];
vector<vector<pi> > e;

int id(char *s)
{
	if(s[0]=='H')return n-2;
	if(s[0]=='D')return n-1;
	
	int num=atoi(s+1);
	if(s[0]=='C')return num-1;
	return num-1+cake;
}
int main()
{
	while(scanf("%d%d%d%d",&cake,&land,&calo,&edge),calo)
	{
		n=cake+land+2; node=n*(1<<cake);
		e.clear(); e.resize(node);
		rep(i,cake)scanf("%d",gain+i);
		rep(i,edge)
		{
			char s1[9],s2[9]; int t;
			scanf("%s%s%d",s1,s2,&t);
			int t1=id(s1),t2=id(s2); t*=calo;
			e[t1].pb(mp(t2,t)); e[t2].pb(mp(t1,t));
		}
		
		rep(i,node)d[i]=inf; d[(n-2)*(1<<cake)]=0;
		priority_queue<pi> Q; Q.push(mp(0,(n-2)*(1<<cake)));
		int ans=inf;
		while(!Q.empty())
		{
			int cc=-Q.top().first,cnode=Q.top().second; Q.pop();
			int bit=cnode%(1<<cake),cur=cnode/(1<<cake);
			
			if(cur==n-1)ans=min(ans,cc);
			if(d[cnode]>cc)continue;
			
			fr(i,e[cur])
			{
				int nc=cc+i->second,nxt=i->first,nbit=bit;
				if(0<=nxt&&nxt<cake)
				{
					if(1<<nxt&bit)continue;
					nc-=gain[nxt]; nbit^=1<<nxt;
				}
				nxt=nxt*(1<<cake)+nbit;
				if(d[nxt]>nc)Q.push(mp(-nc,nxt)),d[nxt]=nc;
			}
		}
		printf("%d\n",ans);
	}
	
	return 0;
}

Measured memory_bytes: 1112
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define pai 3.14159265358979323846
const int INF = 1001001001;
typedef long long ll;
int A[3][3], N;
bool punched[3][3];
bool ok[3][3];
int a[3][3],n;
using Graph = vector<vector<int>>;
vector<vector<int>> field;
vector<bool> seen;

const int MOD = 1000000007;
typedef pair<int,int> P;

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

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







int main() {
 long double n;
 cin >> n;
 ll ans;
  for (ll i = n;i > 0;i--){
    //cout << sqrt(i) <<  " " << floor(i) << endl;
    if (sqrt(i)-floor(sqrt(i))==0){
      ans = i;
      break;
    }
  }
cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.*;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int a[][] = new int[3][3];
    for(int i=0; i<3; i++){
      for(int j=0; j<3; j++){
        a[i][j] = Integer.parseInt(sc.next());
      }
    }
    int n = Integer.parseInt(sc.next());
    int b = 0;
    
    for(int i=0; i<n; i++){
      b = Integer.parseInt(sc.next());
      
      for(int ii=0; ii<3; ii++){
        for(int jj=0; jj<3; jj++){
          if(a[ii][jj] == b){
            a[ii][jj] = -1;
          }
        }
      }
      
    }

    if(   (a[0][0] == -1 && a[0][1] == -1 && a[0][2] == -1)
       || (a[1][0] == -1 && a[1][1] == -1 && a[1][2] == -1)
       || (a[2][0] == -1 && a[2][1] == -1 && a[2][2] == -1)
       || (a[0][0] == -1 && a[1][0] == -1 && a[2][0] == -1)
       || (a[0][1] == -1 && a[1][1] == -1 && a[2][1] == -1)
       || (a[0][2] == -1 && a[1][2] == -1 && a[2][2] == -1)
       || (a[0][0] == -1 && a[1][1] == -1 && a[2][2] == -1)
       || (a[2][0] == -1 && a[1][1] == -1 && a[0][2] == -1)
      ) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
    
  }
  
}


Measured memory_bytes: 23508
parseInt(x) = parse(Int,x)

function main()
  N = parseInt(readline())
  V = map(parseInt,split(readline()))
  C = map(parseInt,split(readline()))
  r = 0
  for i = 1:N
    if V[i]-C[i] > 0
      r = r+V[i]-C[i]
    end
  end
  println(r)
end

main()
      
  


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

using namespace std;

using int64 = long long;

string s;
string dp[50][50];

bool cmp(const string &x, const string &y) {
  return (x.size() < y.size() || (x.size() == y.size() && x < y));
}

string rec(int x, int y) {
  if(dp[x][y] != "~") return dp[x][y];
  string ret = "";

  bool valid = true;
  for(int i = x; i <= y; i++) {
    if(isdigit(s[i]) || s[i] == '?') {}
    else valid = false;
  }
  if(s[x] == '0' && x < y) valid = false;
  if(valid) {
    for(int i = x; i <= y; i++) {
      if(s[i] == '?') ret += "9";
      else ret += s[i];
    }
  }
  if(y - x + 1 >= 6) {
    if(s[x] == 'L' || s[x] == '?') {
      if(s[y] == ')' || s[y] == '?') {
        if(s[x + 1] == '(' || s[x + 1] == '?') {
          for(int m = x + 3; m < y - 1; m++) {
            if(s[m] == ',' || s[m] == '?') {
              string latte = rec(x + 2, m - 1);
              string malta = rec(m + 1, y - 1);
              if(latte.empty() || malta.empty()) continue;
              ret = max(ret, latte, cmp);
            }
          }
        }
      }
    }
    if(s[x] == 'R' || s[x] == '?') {
      if(s[y] == ')' || s[y] == '?') {
        if(s[x + 1] == '(' || s[x + 1] == '?') {
          for(int m = x + 3; m < y - 1; m++) {
            if(s[m] == ',' || s[m] == '?') {
              string latte = rec(x + 2, m - 1);
              string malta = rec(m + 1, y - 1);
              if(latte.empty() || malta.empty()) continue;
              ret = max(ret, malta, cmp);
            }
          }
        }
      }
    }
  }
  return dp[x][y] = ret;
}

int main() {
  cin >> s;
  fill_n(*dp, 50 * 50, "~");
  auto ret = rec(0, s.size() - 1);
  if(ret.empty()) cout << "invalid\n";
  else cout << ret << endl;
}



Measured memory_bytes: 3352
integers = list(map(int, input().rstrip().split(" ")))

integera = integers[0]
integerb = integers[1]

if integera > integerb:
    print("a", "b", sep=" > ")
elif integera < integerb:
    print("a", "b", sep=" < ")
else:
    print("a", "b", sep=" == ")


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

#define fi first
#define se second
#define pb push_back
#define sz(a) (int)(a).size()
#define mp(a, b) make_pair((a), (b))
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;

const ll MOD = 1e9 + 7;
const ll INF = 1e18;
const ll IINF = INT_MAX;

const int N = 1e5 + 5;

vi fac[N];
ll cnt[N];

ll fpow(ll a, ll b) {
    if (b == 0) return 1;
    if (b == 1) return a % MOD;
    ll ret = fpow(a, b / 2);
    ret = (ret * ret) % MOD;
    if (b & 1) ret = (ret * a) % MOD;
    return ret;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n, k;
    cin >> n >> k;

    for (int i = 1; i <= k; i++) {
        for (ll j = 1; j * j <= 1ll * i; j++) {
            if (i % j == 0) {
                fac[i].pb(j);
                if (j != i / j && j != 1) fac[i].pb(i / j);
            }
        }
    }
    
    ll ans = 0;
    for (int i = k; i >= 1; i--) {
        int banyak = k / i;
        cnt[i] = (cnt[i] + fpow(banyak, n)) % MOD; 
        ans = (ans + 1ll * i * cnt[i]) % MOD;
        // cout << i << ": ";
        for (int fa: fac[i]) {
            // cout << fa << ' ' << cnt[fa] << " | ";
            cnt[fa] = (cnt[fa] - cnt[i] + MOD) % MOD;
            // cout << cnt[fa] << ' ';
        }
        // cout << '\n';
    }
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 13796
#include<bits/stdc++.h>
using namespace std;
#ifdef LOCAL_DEBUG
  #include "LOCAL_DEBUG.hpp"
#endif
#define int long long

struct edge{ int to,cost; };

signed main(){

  using P = pair<int,int>;
  map<P,int> mp;

  int n,t,s,e; cin >> n >> t >> s >> e;
  s--,e--;
  vector<vector<edge>> G(n);
  for(int i = 0; i < n-1; i++){
    int a,b,w; cin >> a >> b >> w;
    a--,b--;
    G[a].push_back({b,w});
    G[b].push_back({a,w});
    mp[P(minmax(a,b))] = w;
  }

  vector<int> V;
  function< bool(int,int) > dfs =
  [&](int u,int pre){
    V.push_back(u);
    if(u == e) return true;
    for(auto v : G[u]){
      if(v.to == pre) continue;
      if(dfs(v.to,u)) return true;
    }
    V.pop_back();
    return false;
  };
  dfs(s,-1);
  vector<bool> vs(n,false);
  for(int i = 0; i < V.size(); i++){
    vs[V[i]]=true;
  }

  bool ok=true;
  function< void(int,int,int) > dfs2 =
  [&](int u,int pre,int prew){
    int g=G[u].size();
    for(auto v : G[u]){
      if(v.to == pre) continue;

      dfs2(v.to,u,v.cost);
    }
    if(pre!=-1){
      if(vs[u]){
        if(prew-t*(g-1)<=0)ok=false;
      }else{
        if(prew-t*g<=0)ok=false;
      }
    }
  };
  dfs2(e,-1,-1);
  if(ok) cout << "Yes" << endl;
  else cout << "No" <<endl;

  return 0;
}



Measured memory_bytes: 24920
#include<bits/stdc++.h>
#include<iostream>
using namespace std;
int main(){
  int n,W;
  cin>>n>>W;
  std::vector<int> weight(n) ;
  vector<int> value(n);
  for(int i=0;i<n;i++){
      cin>>weight[i]>>value[i];
  }
  vector<vector<long long int> > op(W+1,vector<long long int>(n+1));
  for(int i =0;i<op.size();i++){
      op[i][0] = 0;
  }
  for(int i =0;i<op[0].size();i++){
      op[0][i] = 0;
  }
  for(int j =1;j<=n;j++){
      for(int i = 1;i<=W;i++){
          op[i][j] = op[i][j-1];
          if(i>=weight[j-1]){
              op[i][j] = max(op[i][j],op[i-weight[j-1]][j-1] + value[j-1]);
          }
      }
  }
  std::cout << op[W][n] << std::endl;
  return 0;
}

Measured memory_bytes: 85204
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Created: Jul, 14, 2020 11:34:55 by Nobody
# $Author$
# $Date$
# $URL$
__giturl__ = "$URL$"


from sys import stdin
input = stdin.readline


def main():
  N = int(input())

  print((N-1)*N//2)


if(__name__ == '__main__'):
  main()


Measured memory_bytes: 61880
package main

import (
	"fmt"
)

func main() {
	var n, y int
	fmt.Scan(&n, &y)
	for i := 0; i <= n; i++ {
		for j := 0; j <= n-i; j++ {
			k := n - i - j
			if i*10000+j*5000+k*1000 == y {
				fmt.Println(i, j, k)
				return
			}
		}
	}
	fmt.Println(-1, -1, -1)
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define ll long long
#define pi pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define mod 1000000007
// #define mod 998244353
using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	string s;
	cin >> s;
	int cur = 0, score = 0;
	for (char c : s)
	{
		if (c == 'g')
		{
			if (cur)
			{
				cur--;
				score++;
			}
			else
			{
				cur++;
			}
		}
		else
		{
			if (cur)
			{
				cur--;
			}
			else
			{
				cur++;
				score--;
			}
		}
	}
	cout << score << endl;
	return 0;
}

Measured memory_bytes: 3740
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <stdbool.h>
#define LL long long
#define INF 1<<31-1
#define LLINF 1<<63-1
#define MIN(x,y) ((x)<(y)?(x):(y))
#define MAX(x,y) ((x)<(y)?(y):(x))
#define MOD 1000000007
#define NUM 100001
void swap(int* x,int* y){
  int tmp=*x;*x=*y;*y=tmp;
}

typedef struct{int B;int C;}P;
int cmp(const void *x,const void *y){
  return *(int*)x-*(int*)y;
}
int Scmp(const void *x,const void *y){
  return ((P*)y)->C-((P*)x)->C;
}

int main() {
  int i,j,k=0,N,M;LL ans=0;
  scanf("%d%d",&N,&M);
  int A[N];P bc[M];
  for(i=0;i<N;i++)scanf("%d",&A[i]);
  for(i=0;i<M;i++)scanf("%d%d",&bc[i].B,&bc[i].C);
  qsort(A,N,4,cmp);qsort(bc,M,sizeof(P),Scmp);
  for(i=0;i<M;i++){
    if(A[k]>=bc[i].C)while(A[k]>=bc[i].C&&k<N)k++;
    if(k==N)break;
    for(j=0;j<bc[i].B;j++)if(A[k]<bc[i].C)A[k++]=bc[i].C;
  }
  for(i=0;i<N;i++)ans+=A[i];

  printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 2164
using System;
using System.Linq;

namespace AtCoder.Question
{
    public class QuestionA
    {
        public static void Main(string[] args)
        {
            var input = Console.ReadLine();
            switch (input.Last())
            {
                case '2':
                case '4':
                case '5':
                case '7':
                case '9':
                    Console.WriteLine("hon");
                    break;
                case '0':
                case '1':
                case '6':
                case '8':
                    Console.WriteLine("pon");
                    break;
                case '3':
                    Console.WriteLine("bon");
                    break;
                default:
                    break;
            }
        }
    }
}


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

int main() {
  int a, b;
  cin >> a >> b;
  if (a + b == 15) cout << "+" << endl;
  else if (a * b == 15) cout << "*" << endl;
  else cout << "x" << endl;
  return 0;
}

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

int main(){
  int h,w,a,b;
  cin>>h>>w>>a>>b;
  int x[h][w];
  int i,j;
  for(i=0;i<h;i++){
    for(j=0;j<w;j++){
      if(i<b&&j<a)x[i][j]=0;
      else if(i>=b&&j>=a)x[i][j]=0;
      else x[i][j]=1;
    }
  }
  for(i=0;i<h;i++){
    for(j=0;j<w;j++){
      cout<<x[i][j];
    }
    cout<<endl;
  }

  return 0;
}


Measured memory_bytes: 5120
#include<iostream>
#include<algorithm>
#include<bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define int long long
#define pi 3.141592653589793238462643383279502
#define M 1000000007
int day(string t)
{
   if(t=="SUN")
        return 0;
        else if(t=="MON")
        return 1;
    else if(t=="TUE")
        return 2;
       else  if(t=="WED")
        return 3;
        else if(t=="THU")
        return 4;
       else  if(t=="FRI")
        return 5;
        else if(t=="SAT")
        return 6;
}
signed main()
{
string s;
cin>>s;
int x=day(s);
cout<<(7-x);
return 0;
}


Measured memory_bytes: 256
def main():
    N = int(input())
    A = list(map(int,input().split()))
    boxes = [0] * N

    count = 0
    printlist = []
    for i in range(N//2,N):
        boxes[i] = A[i]
        if A[i] == 1:
            count += 1
            printlist.append(i)
            #print('append i:',i)
    for i in range(N//2-1,-1,-1):
        s = A[i]
        #print('i=',i)
        for j in range(2,N//(i+1)+1):
            #print('idx=',(i+1)*j - 1)
            s ^= boxes[(i+1)*j - 1]
        boxes[i] = s
        if s == 1:
            count += 1
            printlist.append(i)
            #print('append i:',i)

    import sys
    print(count)
    for i in printlist:
        sys.stdout.write(str(i+1))
        sys.stdout.write(' ')
    print()

if __name__ == '__main__':
    main()


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


void loop(int wp, int ch, int cw, vector<vector<int> >& s, set<pair<int, int> > &p) {
	s[ch][cw] = wp;
//	printf("ch = %d, cw = %d, wp = %d\n", ch-1, cw-1, wp);
	for (int i = -2; i <= 2; i++) {
		for (int j = -2; j <= 2; j++) {
			if (abs(i) + abs(j) >= 2) {
				if (s[ch + i][cw + j] == 0) {
					p.insert(pair<int,int>(ch + i, cw + j));
				}
			}
		}
	}
	if (s[ch + 1][cw] == 0) { loop(wp, ch + 1, cw, s, p); }
	if (s[ch - 1][cw] == 0) { loop(wp, ch - 1, cw, s, p); }
	if (s[ch][cw + 1] == 0) { loop(wp, ch, cw + 1, s, p); }
	if (s[ch][cw - 1] == 0) { loop(wp, ch, cw - 1, s, p); }
}

int main() {
	set<pair<int, int> > P;
	int H, W;
	cin >> H >> W;
	int Ch, Cw, Dh, Dw;
	cin >> Ch >> Cw >> Dh >> Dw;
	Ch++;
	Cw++;
	Dh++;
	Dw++;
	vector<vector<int> > S(H+4, vector<int>(W+4, -1));
	char* s = new char[W + 1];
	for (int i = 2; i <= H+1; i++) {
		cin >> s;
		for (int j = 2; j <= W+1; j++) {
			if (*(s + j - 2) == '.') {
				S[i][j] = 0;
			}
		}
	}
	int wp = 1;
	
//	for (int i = 0; i < H + 4; i++) {
//		for (int j = 0; j < W + 4; j++) {
//			cout << S[i][j]+1;
//		}
//		cout << endl;
//	}


	loop(wp, Ch, Cw, S, P);
//	printf("wp = %d\n", wp);
	while (P.size() > 0) {
		auto it = P.begin();
		while (it != P.end()){
			if (S[it->first][it->second] != 0) {
				it = P.erase(it);
			}
			else {
				it++;
			}
		}
		wp++;
//		printf("wp = %d\n", wp);
		set<pair<int, int> > PP = P;
		P.clear();
		if (PP.size() > 0) {
			for (auto it = PP.begin(); it != PP.end(); it++) {
				if (S[it->first][it->second] == 0) {
					loop(wp, it->first, it->second, S, P);
				}
			}
		}
	}
	cout << S[Dh][Dw] - 1 << endl;

	/*
	for (int i = 0; i < H + 4; i++) {
		for (int j = 0; j < W + 4; j++) {
			if (S[i][j] == -1) {
				printf("##");
			}
			else {
				printf("%02d", S[i][j]);

			}
		}
		printf("\n");
	}
	*/


	return(0);
}


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

int main() {
    int n, d, x, a;
    cin >> n >> d >> x;

    for (int i = 0; i < n; i++) {
        cin >> a;
        x += 1 + (d - 1) / a;
    }

    cout << x << endl;
    
    return 0;
}

Measured memory_bytes: 256
// Mahesh Sharma
// Beauty is in the struggle!
#include<bits/stdc++.h>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cctype>
#include <cstring>
#include <memory.h>
#include <cassert>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>

using namespace std;
// using namespace __gnu_pbds;

#define ford(i, a, b, c)        for(int i=(a); i<(b); i+=(c))
#define fori(i, a, b)           ford(i,a,b,1)
#define rep(i, n)               fori(i,0,n)
#define ifor(i, a, b)           for(int i=(a); i>=(b); i--)
#define si(x)                   ((int)x.size())
#define SS                      ({int x;scanf("%d",&x);x;})
#define pb                      push_back
#define mp                      make_pair
#define all(a)                  a.begin(),a.end()
#define inf                     (int)1e9
#define linf                    (long long)1e18
#define V                       vector
#define S                       string
#define XX                      first
#define YY                      second
#define PVI(v)                  rep(i, si(v)) cout<<v[i]<<" "; puts("")
#define PPI(p)                  cout<<"("<<p.first<<", "<<p.second<<")\n"
#define PVPI(v)                 rep(i, si(v)) cout<<"("<<v[i].first<<", "<<v[i].second<<")"<<(i==si(v)-1?"":", ");puts("")
#define PA(arr1, arr2)          for(auto it = arr1; it != arr2; it++) cout<<*it<<" "; puts("");

typedef V<int> vi;
typedef V<S> vs;
typedef long long ll;
typedef pair<int,int> pii;
const int MOD7 = 1000000000+7;
const int MOD9 = 1000000000+9;
/* ################### Program Body starts here ################ */


int main() {
    ll n = SS, d = SS, delta = SS;
    V<pair<ll, ll> > a(n);
    rep(i, n) {
        a[i].XX = SS;
        a[i].YY = SS;
    }
    sort(all(a));
    
    deque<pair<ll, ll> > attacks;
    ll numAttacks = 0;
    ll ans = 0;
    rep(i, n) {
        while(!attacks.empty() && attacks.back().XX + 2*d < a[i].XX) {
            pii p = attacks.back();
            attacks.pop_back();
            numAttacks -= p.YY;
        }
        ll remain = a[i].YY - numAttacks * delta;
//        cout<<remain<<" ";
        if (remain > 0) {
            ll newAttacks = 1+(remain-1)/delta;
            attacks.push_front({a[i].XX, newAttacks});
            ans += newAttacks;
            numAttacks += newAttacks;
        }
    }
    cout<<ans<<"\n";
}


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

using namespace std;

int main() {
    string alphabet = "abcdefghijklmnopqrstuvwsyz";
    char C;
    cin >> C;

    for (int i = 0; i < alphabet.size(); ++i) {
        char targetChar = alphabet[i];
        if (targetChar == C) {
            cout << alphabet[i + 1] << endl;
            break;
        }
    }
}

Measured memory_bytes: 256
#include <iostream>/*{{{*/
#include <bits/stdc++.h>
#define REP(i, x) for(int i = 0; i < (int)(x); i++)
#define REPS(i,x) for(int i = 1; i <= (int)(x); i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define RFOR(i, m, n) for(int i = m;i >= n;i--)
#define ALL(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define FILL(x,y) memset(x,y,sizeof(x))
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define PB(a) push_back(a)
#define debug(x) cerr << __LINE__ << ": " << #x << " -> " << x << '\n'
#define INF 999999999
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};/*}}}*/

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a,b,x;
  cin >>a >>b;
  x=a+b;
  cout << (x+2-1)/2 << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>
using namespace std;

#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)

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; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }

int a[2], k;
int main() {
    while (cin >> a[0] >> a[1] >> k) {
        for (int i = 0; i < k; ++i) {
            a[(i+1)%2] += a[i%2]/2;
            a[i%2] /= 2;
        }
        cout << a[0] << " " << a[1] << endl;
    }
}










Measured memory_bytes: 256
import math
def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def main():
    N, M = map(int, input().split())
    ans = 0
    if N > 1:
        ans+=comb(N, 2)
    if M > 1:
        ans += comb(M, 2)
    print(ans)


    return 0


if __name__ == '__main__':
    main()

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

int main() {
	int N;
	cin >> N;
	vector<double> A(N);
	for (double& i : A) cin >> i;
	cout << 1.0 / accumulate(A.begin(), A.end(), 0.0, [](double& a, double& b) { return 1.0 / b + a; });
}

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

using namespace std;
typedef long long ll;

#define FAST ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define mp make_pair
#define pb push_back
#define lp(i,s,f) for(ll i = s; i < ll(f); i++)
#define inF freopen("input.in", "r", stdin);
#define outF freopen("output.in", "w", stdout);
#define endl '\n'
#define MOD 1000000007
#define mm(arr) memset(arr, 0, sizeof(arr))
#define F first
#define S second
#define int ll

int32_t main(){
    FAST
    int has = 100;
    int x; cin >> x;
    int ans = 0;
    while(has < x){
        has = has + has/100;
        ans++;
    }
    cout << ans;

    return 0;
}


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

int main(){
	long long N,T; cin>>N>>T;
	vector<int>t(N);
	for(int i=0;i<N;i++){
		cin>>t[i];
	}
	long long ans=0;
	for(int i=1;i<N;i++){
		if(t[i]<=T){
			ans=t[i];
		}
		else if(t[i]>T){
			if(t[i-1]+T<=t[i]){
				ans+=T;
			}
			else{
				ans+=t[i]-t[i-1];
			}
		}
	}
		cout<<ans+T<<endl;
}

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

int subString(deque<char>d, string t)
{   
    int common=0;
    int i=0;
   while(!d.empty())
   {
      if(t[i]==d.front())
      {
          common++;
      }
      i++;
      d.pop_front();
   }
   return common;
}

int main()
{
    string s, t;
    cin>>s>>t;
    int ans=0;
    int l1=s.length();
    int l2=t.length();
    deque<char>d;
    int i=0;
    while(i<l2)
    {
        d.push_back(s[i]);
         i++;
    }
    int mn=0;
    for(;i<l1;i++)
    {
        ans=subString(d, t);
        mn=max(ans, mn);
        d.push_back(s[i]);
        d.pop_front();
    }
    ans=subString(d, t);
    mn=max(ans, mn);
    cout<<l2-mn<<endl;



    return 0;
}

Measured memory_bytes: 3560
#include <bits/stdc++.h>
#define LL long long
using namespace std ;
template <class T> void Read ( T &x, char c = getchar(), bool f = 0 ) {
	for ( x = 0 ; !isdigit(c) ; c = getchar() ) f |= c == '-' ;
	for ( ; isdigit(c) ; c = getchar() ) x = 10*x + c - '0' ;
	if (f) x = -x ;
}
template <class T> void chkmin ( T &a, T b ) { a = a<b?a:b ; }
template <class T> void chkmax ( T &a, T b ) { a = a>b?a:b ; }
const LL maxn = 2e5+5, inf = 1e15 ;
LL n, m, a[maxn], s[maxn], pos, B, Min, Max ;
int main() {
	int i ;
	Read(n) ;
	for ( i = 1 ; i <= n ; i ++ )
		Read(a[i]), s[i] = s[i - 1] + a[i] ;
	LL l, r, mid, rec = 0 ;
	LL ans = inf ;
	for ( i = 2 ; i < n-1 ; i ++ ) {
		l = 1, r = i-1 ;
		rec = l ;
		while (l <= r) {
			mid = (l+r)>>1 ;
			if (s[mid]*2 <= s[i]) rec = mid, l = mid+1 ;
			else r = mid-1 ;
		}
		if (rec+1 < i && abs(s[i]-s[rec]*2) > abs(s[i]-s[rec+1]*2))
			rec ++ ;
		Min = Max = s[rec] ;
		chkmin(Min, s[i]-s[rec]) ;
		chkmax(Max, s[i]-s[rec]) ;

		l = i+1, r = n-1 ;
		rec = l ;
		while (l <= r) {
			mid = (l+r)>>1 ;
			if ((s[mid]-s[i])*2 <= s[n]-s[i])
				rec = mid, l = mid+1 ;
			else r = mid-1 ;
		}
		if (rec+1 < n && abs(s[n]-s[rec]*2+s[i]) > abs(s[n]-s[rec+1]*2+s[i]))
			++ rec ;
		chkmin(Min, s[rec]-s[i]) ;
		chkmax(Max, s[rec]-s[i]) ;
		chkmin(Min, s[n]-s[rec]) ;
		chkmax(Max, s[n]-s[rec]) ;
		chkmin(ans, Max-Min) ;
	}
	cout << ans << endl ;
	return 0 ;
}

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

int main (){
  int64_t n, a, b, c;
  cin >> n >> a >> b;
  c = a+b;
  int64_t ans = (n/c*a) + min(n%c, a);
  cout << ans << endl;  

  return 0;
}

Measured memory_bytes: 256
//   __________________
//  | ________________ |
//  ||          ____  ||
//  ||   /\    |      ||
//  ||  /__\   |      ||
//  || /    \  |____  ||
//  ||________________||
//  |__________________|
//  \\#################\\
//   \\#################\\
//    \        ____       \
//     \_______\___\_______\
// An AC a day keeps the doctor away.

#pragma GCC optimize("Ofast")
#pragma loop_opt(on)
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define debug(x) 0//(cerr<<#x<<" = "<<(x)<<'\n')
#define all(v) begin(v),end(v)
#define siz(v) (ll(v.size()))
#define get_pos(v,x) (lower_bound(all(v),x)-begin(v))
#define pb emplace_back
#define ff first
#define ss second
#define mid (l+(r-l>>1))
#define rep(i,n) for(int i = 0; i < (n); i++)
#define REP(i,n) for(int i = 1; i <= (n); i++)

using namespace std;
using namespace __gnu_pbds;
typedef int64_t ll;
typedef uint64_t ull;
typedef long double ld;
typedef pair<ll,ll> pll;
template <typename T> using rkt = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
constexpr ld PI = acos(-1), eps = 1e-8;
constexpr ll N = 50, INF = 1e18, MOD = 1000000007, K = 2;
constexpr inline ll cdiv(ll x, ll m) { return (x+m-1)/m; } // ceiling divide, x/m for flooring divide
template <typename T> void M(T &x, ll m = MOD){x%=m; if(x<0) x+=m;}

ll n,v;
multiset<ll> tails;
signed main(){
    ios_base::sync_with_stdio(0), cin.tie(0);
    cin >> n;
    for(int i = 0; i < n; i++) {
        cin >> v;
        auto it = tails.lower_bound(v);
        if(it == tails.begin()) { // smallest, becomes a new head
            tails.insert(v);
        }else { // the best choice is to put it behind the nearest tail
            tails.erase(prev(it));
            tails.insert(v);
        }
    }
    cout << tails.size() << '\n';
}


Measured memory_bytes: 4992
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
using namespace std;

int main() {
    int N;
    cin >> N;
    vector<float> x(N);
    vector<string> u(N);
    for (int i=0; i<N; i++) {
        cin >> x[i];
        cin >> u[i];
    }
    
    float ans=0;
    for (int i=0; i<N; i++) {
        if(u[i]=="BTC"){
            ans += x[i] * 380000.0;
        }
        else{
            ans += x[i];
        }
    }
    cout << ans << endl;
}


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

#ifndef LOCAL_
#define fprintf if( false ) fprintf
#endif // LOCAL_
#define dump() fprintf(stderr, "#%s.%d\n", __func__, __LINE__);
#define dumpl(x1) fprintf(stderr, "#%s.%d (%s) = (%ld)\n", __func__, __LINE__, #x1, x1);
#define dumpll(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%ld, %ld)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define dumplll(x1, x2, x3) fprintf(stderr, "#%s.%d (%s, %s, %s) = (%ld, %ld, %ld)\n", __func__, __LINE__, #x1, #x2, #x3, x1, x2, x3);
#define dumpd(x1) fprintf(stderr, "#%s.%d (%s) = (%lf)\n", __func__, __LINE__, #x1, x1);
#define dumpdd(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%lf, %lf)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define loop for(;;)
#define guard(x) if( not ( x ) ) continue;
typedef int64_t Int;
typedef std::vector<Int> LI;
const double pi = 3.14159265358979323846264338;
const Int mod = 1000000007;

template<typename T> void scan1(T& x) { fprintf(stderr, "unknown type\n"); }
template<> void scan1(Int& x) { if( scanf("%" PRId64, &x) < 0 ) exit(0); }
template<> void scan1(std::string& x) { if( not ( std::cin >> x ) ) exit(0); }
template<> void scan1(LI& xs) { for(Int &x : xs) scan1(x); }
void scan() {}
template<typename Head, typename... Tail>
void scan(Head& x, Tail&... xs) {
  scan1(x); scan(xs...);
}

template<typename T>
struct Maybe {
   T x;
   bool valid;
   Maybe() : valid(false) {}
   Maybe(T x_) : x(x_), valid(true) {}
   operator T() const {
      assert( valid );
      return x;
   }
};

struct Solver {
   Solver() { fprintf(stderr, "--------Solver begin--------\n"); }
   ~Solver() { fprintf(stderr, "--------Solver end--------\n"); }
   void solve() {
      std::string ss; scan(ss);
      puts((ss[0] == ss[1] and ss[1] == ss[2]) or (ss[1] == ss[2] and ss[2] == ss[3]) ? "Yes" : "No");
   }
};

int main() {
   loop std::unique_ptr<Solver>(new Solver())->solve();
}




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

using namespace std;

#define pb push_back
#define mp make_pair
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
typedef long long LL;
typedef pair<int, int> PII;

int n, q, len;
char s[100005];
int from[100005], to[100005];
int a[100005];

set<int> se[100005];
int best[100005];

int par[100005];

void dsuInit() {
    forn(i, len + 1) par[i] = i;
}

int dsuParent(int v) {
    if (v == par[v]) return v;
    return par[v] = dsuParent(par[v]);
}

void dsuMerge(int u, int v) {
    u = dsuParent(u);
    v = dsuParent(v);
    if (u == v) return;
    if (se[u].size() < se[v].size()) swap(u, v);
    for (int x : se[v]) {
        se[u].insert(x);
    }
    par[v] = u;
}

int main() {
    scanf("%s", s);
    n = strlen(s);
    scanf("%d", &q);
    len = n / 2;
    int ri = len + n % 2;
    forn(i, q) {
        scanf("%d%d", from + i, to + i);
        --from[i], --to[i];
        if (to[i] < ri) {
            to[i] = min(to[i], len - 1);
            ++to[i];
        } else if (from[i] >= len) {
            from[i] = max(from[i], ri);
            from[i] = n - 1 - from[i];
            to[i] = n - 1 - to[i];
            swap(from[i], to[i]);
            ++to[i];
        } else {
            to[i] = n - 1 - to[i];
            if (from[i] == to[i]) {
                from[i] = to[i] = len;
            } else {
                if (from[i] > to[i]) {
                    swap(from[i], to[i]);
                }
            }
        }
    }
    a[len] = 0;
    forn(i, len) {
        a[i] = int(s[i]) - int(s[n - 1 - i]);
        if (a[i] < 0) {
            a[i] += 26;
        }
    }
//    cerr << "!!" << endl;
//    forn(i, len) cerr << a[i] << ' ';
//    cerr << endl;
//    forn(i, q) cerr << from[i] << ' ' << to[i] << endl;
//    cerr << "!!" << endl;
    for (int i = len - 1; i >= 0; --i) {
        a[i + 1] -= a[i];
        if (a[i + 1] < 0) {
            a[i + 1] += 26;
        }
    }
    forn(i, q) {
        se[from[i]].insert(to[i]);
    }
    dsuInit();
    forn(i, len) {
        int si = dsuParent(i);
        while (!se[si].empty() && *se[si].begin() == i) {
            se[si].erase(se[si].begin());
        }
        if (!se[si].empty()) {
            int ind = *se[si].begin();
            se[si].erase(se[si].begin());
            if (!se[si].empty()) {
                dsuMerge(si, ind);
            }
            a[ind] += a[i];
            a[i] = 0;
            if (a[ind] >= 26) {
                a[ind] -= 26;
            }
        }
        if (a[i] != 0) {
            cout << "NO" << endl;
            return 0;
        }
    }
    if (a[len] != 0) {
        cout << "NO" << endl;
        return 0;
    }
    cout << "YES" << endl;
    return 0;
}


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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

int H,W;
string S[222];

int dp[2][1<<16];
int pc[1<<16];
signed main(){
    for(int i=0;i<1<<16;i++)pc[i]=__builtin_popcount(i);
    cin>>H>>W;
    S[0]="";
    rep(i,H)cin>>S[i+1];

    fill_n(*dp,2*(1<<16),INT_MIN);
    dp[0][0]=0;

    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            for(int k=0;k<(1<<W);k++){
                if(dp[(i*W+j)&1][k]==INT_MIN)continue;
                chmax(dp[(i*W+j+1)&1][(k<<1)&((1<<W)-1)],dp[(i*W+j)&1][k]);

                int l=pc[k&((1<<j)-1)];
                if(l<S[i+1].size()){
                    int po=0;
                    if(j&&(k&1)&&S[i+1][l]==S[i+1][l-1])po++;
                    if(k>>(W-1)&1){
                        int m=pc[k]-l;
                        m=S[i].size()-m;
                        if(S[i][m]==S[i+1][l])po++;
                    }
                    chmax(dp[(i*W+j+1)&1][((k<<1)&((1<<W)-1))+1],dp[(i*W+j)&1][k]+po*2);
                }

                dp[(i*W+j)&1][k]=INT_MIN;
            }
        }
        for(int j=0;j<1<<W;j++)if(pc[j]!=S[i+1].size())dp[(i*W+W)&1][j]=INT_MIN;
    }

    int ans=INT_MIN;
    rep(i,1<<W)chmax(ans,dp[(H*W)&1][i]);
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 4704
#!/usr/bin/env python3
import sys


def solve(A: int, B: int):
    add = A + B
    sub = A - B
    mul = A * B

    result = max(max(add, sub), mul)

    print(result)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    solve(A, B)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <tuple>
#include <map>
typedef long long ll;
using namespace std;
#define rep(i,n) for (int i = 0; i <= int(n); i++)
#define mod 1000000007

int main() {
	int A, B;
	cin >> A >> B;
	int t = A + B;
	int h = A - B;
	int k = A * B;
	int m = max({t,h,k});
	cout << m << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#define rep(i,n) for (int i = 0; i < n; ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

int x[15][15];
int y[15][15];

int main() {
  int N; cin >> N;
  vector<int> A(N);
  rep(i,N) {
    cin >> A[i];
    rep(j,A[i]) {
      cin >> x[i][j] >> y[i][j];
    }
  }
  int ans = 0;
  rep(i,1<<N) { // 1 is honest, 0 is unkind.
    // cout << " " << i << " ";
    bool ok = true;
    int honest = 0;
    rep(j,N) {
      // cout << (i>>j&1);
      if (i>>j&1) { // if j is honest.
        // cout << j << " ";
        rep(k,A[j]) {
      //     cout << (i>>x[j][k]&1) << "HIUD";
          if (y[j][k] != (i>>(x[j][k]-1)&1)) {
            ok = false;
            break;
          }
        }
      if (ok) ++honest;
      else break;
      }
    }
    // cout << endl;
    if (ok) ans = max(ans, honest);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3140
#include <iostream>
#include <sstream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <numeric>
#include <cmath>
#include <cassert>

using namespace std;

int main(int argc, char* argv[]) {
#ifdef _MSC_VER
	while (true)
#endif
	{
		int n = -1, x = 0;
		cin >> n;
		if (n < 0) return 0;
		vector<int> a(n);

		for (int i = 0; i < n; ++i) {
			cin >> a[i];
			x ^= a[i];
		}
		for (int i = 0; i < n; ++i) {
			cout << " " << (x ^ a[i]);
		}
		cout << endl;

		

	}
	return 0;
}


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

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

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

    int n, w;
    cin >> n >> w;
    ll we[n];
    int va[n];
    for (int i = 0; i < n; ++i) {
      cin >> we[i] >> va[i];
    }

    const int maxv = 100001;
    ll dp[maxv];
    memset(dp, 255, sizeof dp);
    dp[0] = 0;
    int res = 0;
    for (int i = 0; i < n; ++i) {
      ll wi = we[i];
      int vi = va[i];
      for (int i = maxv; i >= 0; --i) {
        if (dp[i] != -1) {
          if (i + vi <= maxv && dp[i] + wi <= w &&
            (dp[i + vi] == -1 || dp[i] + wi <= dp[i + vi])) {
            dp[i + vi] = dp[i] + wi;
            res = max(res, i + vi);
          }
        }
      }
    }
    cout << res << endl;

    return 0;
}


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

#define ll long long int

int main()
{
    int x,y;
    cin>>x>>y;

    int r=4*x;
    if(r>=y && y%2==0 && x<=y/2)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;

}


Measured memory_bytes: 3616
x, y = map(int, input().split())
ret = 0
if x == 1: ret += 300000
if x == 2: ret += 200000
if x == 3: ret += 100000
if y == 1: ret += 300000
if y == 2: ret += 200000
if y == 3: ret += 100000
if x == 1 and y == 1: ret += 400000
print(ret)


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

template<typename T> struct BIT{
    private:
        int n;
        vector<T> a;
    public:
        BIT(int _n):n(_n),a(_n+1,0){};
        void add(int i,T x=1){
            for(i;i<=n;i+=i&-i)a[i]+=x;
        }
        T sum(int i){
            T x=0;
            for(i;i;i-=i&-i)x+=a[i];
            return x;
        }
        T sum(int i,int j){
            return sum(j)-sum(i-1);
        }
};

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n,q;cin>>n>>q;
  BIT<int> bit(n);
  rep(i,q){
      int c,x,y; cin>>c>>x>>y;
      if(c==0)bit.add(x,y);
      else {
          cout<<bit.sum(x,y)<<endl;
      }
  }
  return 0;
  }



Measured memory_bytes: 3296
inputs = input()

length = len(inputs) - 1
for i in range(2 ** length):
    formula = ''
    operator = format(i, 'b').zfill(length)
    for index in range(length):
        formula += inputs[index] + ('+' if operator[index] == '0' else '-')
    formula += inputs[-1]
    if eval(formula) == 7:
        print(formula + '=7')
        break

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

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

  int i;
  long long even, odd;
  for (i = 0; i <= N; i++) {
    if (i % 2 == 0) {
      if (i  == 0) {
        even = 2;
      } else {
        even += odd;
      }
    } else {
      if (i  == 1) {
        odd = 1;
      } else {
        odd += even;
      }
    }
  }
  i--;
  if (i >= 2) {
    if (even > odd) {
      cout << even << endl;
    } else {
      cout << odd << endl;
    }
  } else {
    if (i == 0) {
      cout << even << endl;
    } else {
      cout << odd << endl;
    }
  }
}


Measured memory_bytes: 256
#include<string>
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<map>
using namespace std;
typedef long long int llint;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
const int mod=1000000007;
const llint big=1e18+10;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-9;
template <class T,class U>void mineq(T& a,U b){if(a>b){a=b;}}
template <class T,class U>void maxeq(T& a,U b){if(a<b){a=b;}}
int gcd(int a,int b){if(a%b==0){return b;}else return gcd(b,a%b);}//a>b
int main(void){
	int h,w,n,i,j;cin>>h>>w>>n;
	vector<vector<int>>ans(h);
	for(i=0;i<h;i++){ans[i].res(w);}
	int y=0,x=0;
	for(i=0;i<n;i++){
		int q;cin>>q;
		for(j=0;j<q;j++){
			ans[y][x]=i+1;
			if(y%2==0){
				if(x<w-1){x++;}
				else{y++;}
			}else{
				if(x!=0){x--;}
				else{y++;}
			}
			
		}
	}
	for(i=0;i<h;i++){
		for(j=0;j<w;j++){
			cout<<ans[i][j]<<" ";
		}cout<<endl;
	}
	return 0;
}

Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n);i++)
#define sz(x) int(x.size())
typedef long long ll;
typedef pair<int,int> P;
constexpr ll INF = (1LL << 55);
int main(){
  int n, W;
  cin >> n >> W;
  vector<int> v(n), w(n);
  rep(i,n) cin >> w[i] >> v[i];
  vector<ll> dp(100001, INF);
  dp[0] = 0;
  for (int i = 0; i < n; i++) {
    vector<ll> dp2(100001, INF);
    for (int j = 0; j <= 100000; j++) {
      if (j - v[i] >= 0) dp2[j] = min(dp[j], dp[j - v[i]] + w[i]);
      else dp2[j] = dp[j];
    }
    dp = dp2;
  }
  
  for (int i = 100000; i > 0; i--) {
    if (dp[i] <= W) {
      cout << i << endl;
      return 0;
    }
  }
  
}

Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <math.h>
#include <cassert>
#define rep(i,n) for(int i = 0; i < n; ++i )
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n-1) {
    cin >> a[i+1];
    a[i+1]--;
  }
  vector<int> ans(n);
  for(int i = n-1; i>0; --i){
    ans[a[i]] += 1; 
  }
  rep(i,n) printf("%d\n",ans[i]);
}


Measured memory_bytes: 4844
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/range/adaptor/reversed.hpp>

using namespace std;
typedef long long int ll;

#define PI (acos(-1))
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define dumparr(x) cerr << #x ; for(auto elem: x){cerr << " " << elem;} cerr << endl;
#define dumppairs(x) cerr << #x ; for(auto elem: x){cerr << "(" << elem.first << " " << elem.second << ") ";} cerr << endl;
#define dumpline cerr << "**********************" << endl;
#define dumpwline(x) cerr << "******** " << #x << "=" << (x) << " ********" << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

int main(void){
    ll n; cin >> n;
    vector <double> xs;
    vector <double> ys;
    REP(i, n){
        double x; cin >> x;
        double y; cin >> y;
        xs.push_back(x);
        ys.push_back(y);
    }
    double sum_dis = 0;
    double dis;
    REP(i, n){
        REP(j, i){
            dis = pow(pow((xs[i] - xs[j]), 2) + pow((ys[i] - ys[j]), 2), 0.5);
            sum_dis += dis;
        }
    }
    double ans = sum_dis / double(n / 2.0);
    printf("%f\n", ans);
    return 0;
}

Measured memory_bytes: 640
#include<iostream>

using namespace std;

int main(void)
{
  int a,b;  cin>>a>>b;
  int r1=a+b,r2=a-b,r3=a*b;
  
  if((r1>=r2)&&(r1>=r3)){cout<<r1<<endl;}
  else if((r2>=r1)&&(r2>=r3)){cout<<r2<<endl;}
  else if((r3>=r1)&&(r3>=r2)){cout<<r3<<endl;}
  //if((r1==r2)&&(r2==r3)){cout<<r2<<endl;}
  
  return 0;
}


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

int main() {
  int n;
  int ans=0,cnt=0;

  cin >> n;

  for(int i=1;i<=n;i+=2) {
    cnt = 0;
    for(int j=1;j<=n;j++) {
      if(i%j==0) {cnt++;}
    }
    if(cnt==8) {ans++;}
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
  int A;
  int B;
  int c;
  scanf("%d",&A);
  scanf("%d",&B);
  c=(A+B)/2;
  if((A+B)%2==0){
    printf("%d",c);
  }else{
    printf("IMPOSSIBLE");
  }
}

Measured memory_bytes: 128
#include <iostream>

using namespace std;

int main(void) {
	ios::sync_with_stdio(false);
	cin.tie(0);
	string str1;
	cin >> str1;
	int len = str1.length(), cnt = 0;
	for (int i = 0; i < len/2; i++) {
		if (str1[i] != str1[len-1-i]) {
			cnt++;
		}
	}
	cout << cnt << endl;
	return 0;
}

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

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

        int ans = s.length();
        if(ans <= k)
        {
                cout << s<< endl;
        }
        else if(ans > k)
        {
                for(int i = 0; i< ans; i++)
                {
                        if(i < k)
                        cout << s[i];

                        
                }
                cout << "..."<<endl;
        }
}


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

using namespace std;

typedef long long ll;

const ll MOD = 1000000007;
//const ll INF = 1LL<<60;
int INF = numeric_limits<int>::max();

int main(int, char**) {
	int n; cin >> n;
	int premin = INF;
	int ret = 0;
	for (int i=0; i<n; i++) {
		int now; cin >> now;
		if (premin > now) ret++;
		premin = min(premin, now);
	}
	cout << ret << endl;
	return 0;
}

Measured memory_bytes: 256
#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, INF=mod*mod*3LL;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    int a, b, c;
    cin >> a >> b >> c;
    bool maki = false;
    for(int i=1;i<=b;i++){
    	if((i*a)%b == c)maki = true;
    }
    if(maki) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>

int main(){
        int a;
        scanf("%d",&a);
        int a1,a2,a3,a4;
        a1 = a / 1000;
        a2 = a / 100 - a1 * 10;
        a3 = a / 10 - a1 * 100 - a2 * 10;
        a4 = a - a1 * 1000 - a2 * 100 - a3 * 10;

        if ((a1 == a2 && a2 == a3) || (a2 == a3 && a3 == a4))
        printf("Yes\n");
        else
        printf("No\n");
        return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <algorithm>

using namespace std;

int main() {
	const int MAX_N=1000000;
	char s[MAX_N]; 
	for (int i = 0; i < MAX_N; i++)s[i] = '2';
	cin >> s;
	int n = 0;
	for (int i = 0; i >= 0; i++) {
		if (s[i] != '2')n++;
		else break;
	}
	n = n - 1; //文字数 配列は文字数-1がMAX

	int ans = 0;

	for (int i = 1; i < n; i++) {
		if (s[i - 1] == s[i]) {
			if (s[i] == '0')s[i] = '1';
			else if (s[i] == '1')s[i] = '0';
			ans++;
		}
	}

	cout << ans;
}

Measured memory_bytes: 1280