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

#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define REP(i, n)  FOR(i, 0, n)
#define ASC(c) sort((c).begin(), (c).end())
#define DESC(c) sort((c).begin(), (c).end(), greater<int>())

#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define DEBUG(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

typedef long long ll;
typedef unsigned long long ull;
struct edge { int u, v; ll w; };
 
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

int main() {
  int H, W, h, w; cin >> H >> W >> h >> w;
  cout << (H * W) - ((W * h) + (H * w) - h * w) << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <functional>
#include <set>
#include <sstream>
#include <map>
#include <queue>

using namespace std;

long getMin(long x,int L)
{
	stringstream ss;
	ss<<x;
	string s=ss.str();
	ss.str("");
	ss.clear(stringstream::goodbit);

	while(s.size()!=L) s+='0';

	sort(s.begin(),s.end());
	ss<<s;

	long res;
	ss>>res;
//	cout<<"Min:"<<res<<endl;
	return res;
}

long getMax(long x,int L)
{
	stringstream ss;
	ss<<x;
	string s=ss.str();
	ss.str("");
	ss.clear(stringstream::goodbit);

	while(s.size()!=L) s+='0';

	sort(s.begin(),s.end());
	reverse(s.begin(),s.end());
	ss<<s;

	long res;
	ss>>res;

//	cout<<"Max:"<<res<<endl;
	return res;
}

int main()
{

	int n;
	long long m;
	while(cin>>n>>m,n){
		vector< pair<int,int> > vp(n);
		for(int i=0;i<n;i++){
			cin>>vp[i].second>>vp[i].first;
		}
		sort(vp.begin(),vp.end());
		reverse(vp.begin(),vp.end());

		long res=0;
		for(int i=0;i<n;i++){
			if(vp[i].second<=m){m-=vp[i].second; vp[i].second=0;}
			else {vp[i].second-=m; m=0;}
//			cout<<vp[i].first*vp[i].second<<endl;
			res+=vp[i].first*vp[i].second;
		}
		cout<<res<<endl;

	}

	return 0;
}

Measured memory_bytes: 1292
#include <iostream>

using namespace std;

int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  if ((c-1) / b + 1 <= (a-1) / d + 1) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 3616
#include<stdio.h>


//二次元配列quicksort 参考http://www.math.u-ryukyu.ac.jp/~suga/C/2004/13/node6.html
//http://d.hatena.ne.jp/lagos_on/20090517/1242586942
void qsort(int list1[],int list2[], int left, int right) {
    int l = left;
    int r = right;
    int pivot = list1[(left + right) / 2]; // 中央からピボットを選択
    int temp;

    while (1) {
        while (list1[l] < pivot) l++;
        while (list1[r] > pivot) r--;

        if (l > r) break;

        // pivotより小さい値を左、大きい値を右に入れ替え
        temp = list1[l];
        list1[l] = list1[r];
        list1[r] = temp;
        
        temp = list2[l];
        list2[l] = list2[r];
        list2[r] = temp;


        l++, r--;
    };

    // pivotより小さい領域と大きい領域をそれぞれ再帰的にソート
    if (left < r)  qsort(list1,list2 ,left, r);
    if (l < right) qsort(list1,list2, l, right);
}

void quicksort(long long int list[],int list2[], int left, int right)
{
    int i, last;
    int temp;
    if (left >= right)
        return;

    last = left;
    for (i=left+1; i <= right; i++){
        if (list[i] < list[left] ){
            last++;
            temp=list[last];
            list[last]=list[i];
            list[i]=temp;
            temp=list2[last];
            list2[last]=list2[i];
            list2[i]=temp;
        }
    }

    temp=list[left];
    list[left]=list[last];
    list[last]=temp;

    temp=list2[left];
    list2[left]=list2[last];
    list2[last]=temp;

    quicksort(list,list2, left, last-1);
    quicksort(list,list2, last+1, right);
}
int main(void){
    int N,M;
    scanf("%d %d",&N,&M);
    int A[N];
    int B[N];
    for(int i=0;i<N;i++){
        scanf("%d %d",&A[i],&B[i]);
    }
    long long int money = 0;
    qsort(A,B,0,N-1);
/*
    printf("------------\n");
    for(int i=0;i<N;i++){
        printf("%d %d\n",A[i],B[i]);
    }
//*/
    for(int i=0;i<N;i++){
        if(M>B[i]){
            money += (long long int)A[i]*B[i];
            M -= B[i];
            //printf("money = %lld ,M=%d\n",money,M);
        }else{
            money += (long long int)A[i]*M;
            M -= M;
            break;
        }
    }

    printf("%lld",money);
    return 0;
}

Measured memory_bytes: 896
#include <iostream>
#include<cstring>
#include <string.h>
using namespace std;
int main(void){
    // Your code here!
    int num;

    cin >> num;
    
    int one = num/500;
    
    int remain = num%500;
    
    int five = remain/5;
    
    cout << one*1000+five*5;
    
    
    
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int arr[305];
long long dp[305][305];
int main()
{
	int n,k;
	scanf("%d%d",&n,&k);
	for (int i=1;i<=n+1;i++)
	{
		if (i!=n+1)
		scanf("%d",&arr[i]);
		for (int j=0;j<=n;j++)
		dp[i][j]=1e18;
		for (int j=0;j<i;j++)
		{
			for (int l=0;l<=j;l++)
			dp[i][j]=min(dp[i][j],dp[i-l-1][j-l]+max(arr[i]-arr[i-l-1],0));
		}
	}
	printf("%lld",dp[n+1][k]);
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
int main() {
	ll n,ans=0;
	cin >> n;
	vector<ll>b(n-1);
	for(ll i=0;i<n-1;i++) cin >> b.at(i); 
	ans+=b.at(0);
	for(ll i=1;i<n-1;i++) ans+=min(b.at(i),b.at(i-1));
	ans+=b.at(n-2);
	cout << ans << endl;
}


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

using namespace std;

int N;

void solve() {
    int i = 2;
    for (int j = 0;; j++) {
        if (pow(i, j) > N) {
            printf("%d\n", int(pow(i, j - 1)));
            return;
        }
    }
}

int main() {
    cin >> N;
    solve();
    return 0;
}

Measured memory_bytes: 4164
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
using namespace std;
typedef long long ll;

ll gcd(ll a,ll b){
  if(b==0) return a;
  else return gcd(b,a%b);
}
template <typename X>
struct Number{
  X n;
  vector<bool> prime;
  
  Number(X _n)
  {
    n = _n;
  }
  
  //nの約数を全列挙
  vector<X> divisor()
  {
    vector<X> res(0);
    for(X i=1;i*i<=n;++i){
      if(n%i==0){
	res.push_back(i);
	if(i != n/i) res.push_back(n/i);
      }
    }
    sort(res.begin(), res.end());
    return res;
  }
  
  //nを素因数分解
  map<X,int> prime_factor()
  {
    int nn = n;
    map<X,int> res;
    for(X i=2;i*i<=nn;++i){
      while(nn%i==0){
	res[i]++;
	nn /= i;
      }
    }
    if(nn!=1) res[nn] = 1;
    return res;
  }

  //n以下の素数を全列挙
  vector<X> sieve()
  {
    prime.assign(n+1,true);
    vector<X> res(0);
    if(n<=1) return res;
    prime[0] = prime[1] = false;
    for(X i = 2;i<=n;++i){
      if(prime[i]){
	res.push_back(i);
	X b = i*2;
	while(b<=n){
	  prime[b] = false;
	  b += i;
	}
      }
    }
    return res;
  }
  
};


int main()
{
  ll a,b;
  cin >> a >> b;

  Number<ll> nb(gcd(a,b));

  vector<ll> div = nb.divisor();

  //  rep(i,div.size()) cout << div[i] << "\n";

  int m = div.size();

  int cnt = 1;
  rep1(i,m-1){
    bool f = true;
    rep1(j,i-1){
      if(div[i]%div[j]==0) f = false;
    }
    if(f) cnt++;
  }

  cout << cnt << "\n";
  return 0;
}


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


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

struct edge {int to; ll cost; };

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

 
int main(){
  int n, k;
  cin >> n >> k;
  double ans = 0.0, ex = 0.0;
  vector<double> p(n);
  for(int i=0; i<n; i++){
    cin >> p[i];
  }
  for(int i=0; i<k; i++){
    ex += 1+p[i];
  }
  if(n==k){
    ex /= 2.0;
    cout << ex << endl;
    return 0;
  }
  ans = ex;
  for(int i=k; i<n; i++){
    ex = ex-p[i-k]+p[i];
    ans = max(ans, ex);
  }
  ans /= 2.0;
  printf("%.6lf", ans);
  return 0;
}


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

#define FOR(i, j, k) for (int i = j; i < k; i++)
#define REP(i, j) FOR(i, 0, j)
#define fst first
#define snd second
#define pb push_back
#define eb emplace_back
#define all(obj) (obj).begin(), (obj).end()
#define rall(obj) (obj).rbegin(), (obj).rend()
typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;

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

template <typename T> istream &operator>>(istream &is, vector<T> &vec) {
  for (T &x : vec)
    is >> x;
  return is;
}

int main() {

  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.precision(10);
  cout << fixed;

  int n, k;
  cin >> n >> k;

  cout << n - k + 1 << endl;

  return 0;
}


Measured memory_bytes: 256
/* Isn't passion overrated?*/

#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ll long long
#define mod 1000000007
using namespace std;
ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
ll n,m,k;
ll ans = 100000000001;
vector<vector<ll> >v(13);
vector<ll>cost;
vector<ll>check;
void dfs(ll i, ll c)
{
    if(i == n)
    {
        for(ll j = 0; j < check.size(); j++)
            if(check[j] > 0)
                return;
        ans = min(ans,c);
        return;
    }
        for(ll k = 0; k < m; k++)
            check[k] -= v[i][k];
        dfs(i+1, c+cost[i]);
        for(ll k = 0; k < m; k++)
            check[k] += v[i][k];
        dfs(i+1,c);
}
int main()
{
    ios_base:: sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
    cin>>n>>m>>k;
    for(ll i = 0; i < n; i++)
    {
        ll c;
        cin>>c;
        cost.pb(c);
        for(ll j = 0; j < m; j++)
        {
            ll a;
            cin>>a;
            v[i].pb(a);
        }
    }
    for(ll i = 0; i < m; i++)
        check.pb(k);
    dfs(0ll,0ll);
    if(ans == 100000000001)
        ans = -1;
    cout<<ans;
    return 0;
}


Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int num1,num2,tmp;
    cin>>num1;
    vector <int> a1,a2;
    for(int i=0;i<num1;i++) {cin>>tmp;a1.push_back(tmp);}
    cin >>num2;int b[num2];
    for(int i=0;i<num2;i++)
    {
        cin>>tmp;
        if(find(a1.begin(),a1.end(),tmp)!=a1.end())
            a2.push_back(tmp);
    }
     cout<<a2.size()<<endl;

return 0;
}


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

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

    int a[n+2], sum = 0;
    a[0] = a[n+1] = 0;

    for(int i = 1; i <= n; i++){
        cin >> a[i];
        sum += abs(a[i]-a[i-1]);
    }

    sum += abs(a[n]);

    for(int i = 1; i <= n; i++){
        cout << sum-(abs(a[i-1]-a[i])+abs(a[i]-a[i+1]))+abs(a[i-1]-a[i+1]) << endl;
    }

    return 0;
}

Measured memory_bytes: 1664
#include <stdio.h>
int main(void){
    int a,b;
    char op;
    while(1){
        scanf("%d %c %d",&a,&op,&b);
        if(op=='?'){
            break;
        }else if(op=='+'){
            printf("%d\n",a+b);
        }else if(op=='-'){
            printf("%d\n",a-b);
        }else if(op=='*'){
            printf("%d\n",a*b);
            }else if(op=='/'){
                printf("%d\n",a/b);
            }
    }
    return 0;
}



Measured memory_bytes: 2648
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

func main() {
	sc.Split(bufio.ScanWords)
	n := nextInt()
	d := nextInts(n)
	sort.Sort(sort.IntSlice(d))

	puts(d[(n-1)/2+1] - d[(n-1)/2])
	wt.Flush()
}

var (
	sc  = bufio.NewScanner(os.Stdin)
	rdr = bufio.NewReaderSize(os.Stdin, 1000000)
	wt  = bufio.NewWriter(os.Stdout)
)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	i, _ := strconv.Atoi(next())
	return i
}

func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(next(), 64)
	return f
}

func nextInts(n int) []int {
	slice := make([]int, n)
	for i := 0; i < n; i++ {
		slice[i] = nextInt()
	}
	return slice
}

func nextFloat64s(n int) []float64 {
	slice := make([]float64, n)
	for i := 0; i < n; i++ {
		slice[i] = nextFloat64()
	}
	return slice
}

func nextMega() string {
	buf := make([]byte, 0, 1000000)
	for {
		l, p, _ := rdr.ReadLine()
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}

func putf(format string, a ...interface{}) {
	fmt.Fprintf(wt, format, a...)
}

func puts(a ...interface{}) {
	fmt.Fprintln(wt, a...)
}


Measured memory_bytes: 2048
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <functional>
#include <cassert>
using namespace std;

typedef pair<int, int> Point;

ostream& operator<< (ostream& os, const Point& p) {
  return os << "(" << p.first
	    << "," << p.second << ")";
}

Point operator+ (const Point& p1, const Point& p2) {
  return Point(p1.first+p2.first, p1.second+p2.second);
}

Point operator- (const Point& p1, const Point& p2) {
  return Point(p1.first-p2.first, p1.second-p2.second);
}

const Point dirs[4] = {
  Point(1,0),
  Point(0,-1),
  Point(-1,0),
  Point(0,1)
};

typedef pair<Point, Point> State; // 荷物の位置、人

// const int Nothing = 0;
const int Pillar = 1;
const int Cargo = 2;
const int Goal = 3;
const int Man = 4;

typedef vector<int> Line;
typedef vector<Line> Mat;

typedef pair<int, State> Istate;

struct Problem {
  int width, height;
  Mat mat;
  Point goal;
  State stat;
  
  Problem (istream& is) {
    is >> width >> height;
    Point c, m;
    for (int i=0; i<height; i++) {
      Line l;
      for (int j=0; j<width; j++) {
	int n;
	is >> n;
	if (n == Goal) {
	  goal = Point(i, j);
	} else if (n == Cargo) {
	  c = Point(i, j);
	} else if (n == Man) {
	  m = Point(i, j);
	}
	l.push_back(n);
      }
      mat.push_back(l);
    }
    stat = make_pair(c, m);
  }

  bool isnothing(int x, int y) {
    return (0 <= x && x < height && 0 <= y && y < width 
	    && mat[x][y] != Pillar);
  }
  
  int solve1() {
    priority_queue< Istate, vector<Istate>, greater<Istate> > next;
    next.push(Istate(0, stat));
    set<State> done;
    done.insert(stat);
    while (!next.empty()) {
      Istate next_pair = next.top();
      next.pop();
      int step = next_pair.first;
      State stat = next_pair.second;
      Point cargo = stat.first;
      Point man = stat.second;
      /*cerr << "step: " << step 
	   << " man: " << man 
	   << " cargo: " << cargo << endl;*/
      for (int d=0; d<4; d++) {
	Point to = man+dirs[d];
	if (to == cargo) {
	  Point n_cargo = to + dirs[d];
	  if (n_cargo == goal) {
	    // cerr << "goal" << endl;
	    return step+1;
	  }
	  if (isnothing(n_cargo.first, n_cargo.second)) {
	    State n_stat(n_cargo, to);
	    if (done.find(n_stat) == done.end()) {
	      done.insert(n_stat);
	      next.push(make_pair(step+1, n_stat));
	    }
	  }
	} else if (isnothing(to.first, to.second)) {
	  State n_stat(cargo, to);
	    if (done.find(n_stat) == done.end()) {
	      done.insert(n_stat);
	      next.push(make_pair(step, n_stat));
	    }	  
	} 
      }
    }
    return -1;
  }
};

int main() {
  while (true) {
    Problem p(cin);
    if (p.height == 0) break;
    cout << p.solve1() << endl;
  }
}

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

int main(){
  int n,a,b,c,d;
  string s;
  cin >> n >> a >> b >> c >> d;
  vector<char> S;
  cin >> s;
  for(int i = 0;i < n;i++){
    S.push_back(s.at(i));
  }
  char block = '#';
  for(int i = 0;i < n;i++){
    if(S[i] != block){
      S[i] = 'A';
    }
  }
  bool flag = false;

  for(int i = b-1;i < d-1;i++){
    if(S[i-1] == block && S[i] == block && S[i+1] == block){
      cout << "No" << endl;
      return 0;
    }
    if(S[i-1] != block && S[i] != block && S[i+1] != block){
      cout << "Yes" << endl;
      return 0;
    }
  }
  S[d-1] = block;
  for(int i = a+1;i < c;i++){
    if(S[i-1] == block && S[i] == block){
      cout << "No" << endl;
      return 0;
    }
  }
  
  cout << "Yes" << endl;
}


Measured memory_bytes: 772
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod=1e9+7;

int main(){
    int N;
    cin >> N;
    vector<int> L(N);
    for(int i=0; i<N; i++){
        cin >> L[i];
    }
    sort(L.begin(), L.end());
    if(accumulate(L.begin(), L.end(), 0)-L[N-1] > L[N-1]){
        cout << "Yes";
    }else{
        cout << "No";
    }
}

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


/* エイリアス */
#define ll long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vpi vector<pii>
#define vpll vector<pll>
#define endl '\n'

#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define em emplace


/* 関数マクロ */
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rep2(i, n, m) for (ll i = n; i <= m; ++i)
#define rep3(i, n, m) for (ll i = n; i >= m; --i)
#define all(v) v.begin(), v.end()
#define si(v) int(v.size())
#define UNIQUE(v) sort(all(v)), v.erase(unique(all(v)),v.end())


/* 定数 */
const ll mod = 1e9 + 7;
const ll infll = (1LL << 62) - 1;
const ll inf = (1LL << 30) - 1;


/* その他 */
template<class S, class T> inline bool chmax(S &a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class S, class T> inline bool chmin(S &a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T> using pq = priority_queue<T>;
template<class T> using pqg = priority_queue<T, vector<T>, greater<T>>;


signed main()
{
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cout << fixed << setprecision(15);
  
  ll a, v, b, w; cin >> a >> v >> b >> w;
  ll t; cin >> t;

  if (a < b) {
    if (a + (v * t) >= b + (w * t)) cout << "YES" << endl;
    else cout << "NO" << endl;
  } else {
    if (a - (v * t) <= b - (w * t)) cout << "YES" << endl;
    else cout << "NO" << endl;
  }
  
}

Measured memory_bytes: 3640
N = int(input())
H = list(map(int, input().split()))
ans_l = []
move = 0
for h1, h2 in zip(H[:-1], H[1:]):
    if h2 <= h1:
        move += 1
    else:
        ans_l.append(move)
        move = 0
ans_l.append(move)
print(max(ans_l))

Measured memory_bytes: 63984
#include<stdio.h>
	#include<string.h>
	#include<string>
	#include<map>
	using namespace std;
	int main()
	{
		map<int,int>mmp;
		int N,M;
		scanf("%d",&N);
		while(N--)
		{
			int num;
			scanf("%d",&num);
			mmp[num]++;
		}
		scanf("%d",&M);
		while(M--)
		{
			int num;
			scanf("%d",&num);
			mmp[num]--;
			if(mmp[num]<0)
				break;
		}
		if(M!=-1)
			printf("NO");
		else
			printf("YES");
		return 0;
	}

Measured memory_bytes: 9600
import java.util.*;

public class Main {

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

		while(true){
			int n = sc.nextInt();
			int m = sc.nextInt();
			if(n==0 && m==0)break;
			if(n>m){
				int l = m;
				m=n;
				n=l;
			}
			int count=0;
			while(n!=0){
				int l = n;
				n = m%n;
				m = l;
				count++;
			}
			System.out.println(m + " " + count);
		}
	}
}

Measured memory_bytes: 24420
#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <set>
#include <utility>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>
#include <cstdio>
#include <map>
#include <list>

using namespace std;

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

#define _upgrade ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define rep(i,x) for(ll i = 0; i < (ll)(x); i++)
#define all(x) (x).begin(), (x).end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define pb push_back

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

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

const ll mod = 1e9 + 7;
const ll inf = 1<<29;
const long double pi = 3.14159265358979323846;

// ****************************************CODE***************************************//

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

if((A+B) % 2 == 0){
    cout << (A+B)/2 << endl;
}
else{
    cout << "IMPOSSIBLE" << endl;
}

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string.h>
#include<queue>
#include<utility>
#include<algorithm>
#include<math.h>
using namespace std;
int N,D,x[11][11]={0};
int check(int a,int b){
	int dis=0;
	for(int i=1;i<=D;i++){
		dis=dis+(x[a][i]-x[b][i])*(x[a][i]-x[b][i]);
	}
	double x,y;
	int z;
	x=(double)dis;
	y=sqrt(x);
	z=(int)y;
	//cout<<x<<" "<<y<<" "<<z<<endl;
	if(z*z==dis) return 1;
	return 0;
}
int main(){
	cin>>N>>D;
	for(int i=1;i<=N;i++){
		for(int j=1;j<=D;j++){
			scanf("%d",&x[i][j]);
		}
	}
	int ans=0;
	for(int i=1;i<=N;i++)
		for(int j=i+1;j<=N;j++){
			ans=ans+check(i,j);
		}
	cout<<ans;
	return 0;
}

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

int main(int argc, const char * argv[]) {
    // insert code here...
    int A, B;
    cin >> A >> B;
    
    if (A * B % 2 != 0) cout << "Yes" << endl;
    else cout << "No" << endl;
    
    return 0;
}


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

int main(){
	int n,p,d1,d2,mp,md;
	while(cin >> n,n){
		md = -1;
		for(int i = 0;i < n;i++){
		cin >> p >> d1 >> d2;
		if(d1 + d2 > md){
			mp = p;
			md = d1 + d2;
		}
		}
		cout << mp << " " << md << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include <cstdio>
#include <cstring>
#include <cmath>
#include <string>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <tuple>
#include <numeric>
#include <stdlib.h>
#include <time.h>
#include <chrono>
#define rep(i, s, g) for ((i) = (s); (i) < (g); ++(i))
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll MOD = 1e9 + 7;
const ll INF = (1ll << 60);

ll d;
vector<ll> c(26 + 1, 0);
vector<vector<ll>> s(365 + 1, vector<ll>(26 + 1, 0));

ll scoring(vector<int> t)
{
    ll ans = 0;
    vector<ll> last(26 + 1, 0);

    for (int i = 1; i <= d; i++)
    {
        ans += s[i][t[i]];
        ans -= c[t[i]] * (i - last[t[i]]) * (i - last[t[i]] - 1) / 2;
        last[t[i]] = i;
    }

    for (int i = 1; i <= 26; i++)
    {

        ans -= c[i] * (d - last[i] + 1) * (d - last[i]) / 2;
    }

    return ans;
}

int main(void)
{
    srand(time(NULL));
    cin >> d;

    for (int i = 1; i <= 26; i++)
    {
        cin >> c[i];
    }

    for (int i = 1; i <= d; i++)
    {
        for (int j = 1; j <= 26; j++)
        {
            cin >> s[i][j];
        }
    }

    vector<int> BestT(d + 1, 1);

    for (int i = 1; i <= d; i++)
    {
        BestT[i] = rand() % 26 + 1;
    }

    double BestScore = scoring(BestT);
    double score;

    auto start = chrono::system_clock::now();
    vector<int> t(d + 1, 1);

    double T0 = 1e5;
    double T1 = 1e2;
    double TL = 1980;

    ll count = 0;

    while (1)
    {
        ll msec;

        msec = chrono::duration_cast<chrono::milliseconds>(chrono::system_clock::now() - start).count();

        if (msec >= TL)
        {
            break;
        }

        double T = powf(T0, 1 - msec / TL) * powf(T1, msec / TL);

        t = BestT;

        t[rand() % d + 1] = rand() % 26 + 1;

        score = scoring(t);

        double p = exp((score - BestScore) / T);

        if (p > 0.5)
        {
            BestT = t;
            BestScore = score;
        }

        count++;
    }

    for (int i = 1; i <= d; i++)
    {
        printf("%d\n", BestT[i]);
    }
}


Measured memory_bytes: 4420
import java.util.Arrays;
import java.util.Scanner;
public class Main {
	int d,j,k,l,o,min;
	public void solve() {
	Scanner sc = new Scanner(System.in);
	int date[] =new int[2];
	for(d=0;d<2;d++) {
	date[d] = sc.nextInt();
	}
	int[] dat=new int[date[0]];
	for(int o=0;o<date[0];o++) {
		dat[o]=sc.nextInt();
	}
	Arrays.sort(dat);
	for(int o=0;o<date[1];o++) {
		min=min+dat[o];
		
	}
	System.out.println(min);
	}
	public static void main(String[] args) {
		new Main().solve();
	
	}
}


Measured memory_bytes: 39024
#include <bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define pb push_back
#define mp make_pair
#define INF (int)1e9
#define cBits(x) __builtin_popcount(x)
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) a/gcd(a,b)*b
#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 MAX3(a,b,c) max(a,max(b,c))
#define MIN3(a,b,c) min(a,min(b,c))
#define eachTest int t; cin >> t; while(t--) solve();

using namespace std;

typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<ll,ll> PLL;
typedef pair<int,int> PII;

const int MOD=1000000007;

void solve() {
	;
}

int main() {

	fastio;
	// #ifndef ONLINE_JUDGE
	// 	freopen("input.txt", "r", stdin);
	// 	freopen("output.txt", "w", stdout);
	// #endif

	// eachTest

	int n;
	cin >> n;
	vector <ll> arr(n);
	FOR(i,0,n) {
		cin >> arr[i];
	}
	ll sum[n][n];
	FOR(i,0,n) {
		sum[i][i] = arr[i];
	}
	FOR(i,0,n) {
		FOR(j,i+1,n) {
			sum[i][j] = sum[i][j-1] + arr[j];
		}
	}
	// FOR(i,0,n) {
	// 	FOR(l,2,n+1) {
	// 		int j = i+l-1;
	// 		if (j > n) {
	// 			break;
	// 		}
	// 		sum[i][j] = sum[i][j-1] + arr[j];
	// 	}
	// }
	ll table[n][n];
	FOR(i,0,n) {
		table[i][i] = arr[i];
	}
	FOR(l,2,n+1) {
		FOR(i,0,n) {
			int j = i+l-1;
			if (j >= n) {
				break;
			}
			table[i][j] = max(arr[i] + sum[i+1][j]-table[i+1][j], arr[j] + sum[i][j-1]-table[i][j-1]);
		}
	}

	cout << 2*table[0][n-1] - sum[0][n-1];

	return 0;
}


Measured memory_bytes: 139904
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <numeric>
#include <map>
#include <iomanip>
#include <limits.h>
#include <cmath>
#include <stdio.h>

using namespace std;    
typedef long long ll;
typedef pair<ll, ll> pll;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
const bool DEBAG = false;

int main(){

    ll Area;
    cin >> Area;

    ll route = sqrt(Area);
    if(route * route == Area){
        printf("%d %d %lld %d %d %lld\n", 0, 0, route, 0, 0, route);
        return 0;
    }
    ll x2 = route + 1;
    ll y3 = route + 1;
    ll rem = x2 * y3 - Area;


    for(ll x3 = 1; true; x3++){
        if(rem % x3 == 0){
            if(x3 <= 1000000000 && (rem / x3) <= 1000000000){
                printf("%d %d %lld %lld %lld %lld\n", 0, 0, x2, (rem / x3), x3, y3);
                return 0;
            }
        }
    }

}

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


int main() {
    int N,A;
    cin>>N>>A;
    int a=N%500;
    if(A>=a)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
template <typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
const int INT_INF = 1 << 30;
const double PI = acos(-1.0);
#define MOD 1000000007LL
#define endl "\n"

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  srand((unsigned)time(NULL));
  ll N, K;
  cin >> N >> K;
  vll p(N);
  for(int i = 0; i < N; i++){
    cin >> p.at(i);
  }
  sort(ALL(p));
  ll ans = 0;
  for(int i = 0; i < K; i++){
    ans += p.at(i);
  }
  cout << ans << endl;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
int main()
{
	char s[55];
	int n,cnt=0;
	cin >> n >> s;
	for(int i=0;i<n;i++){
		if(s[i]=='A'){
			if(s[i+1]=='B'&&s[i+2]=='C')
				cnt++;
		}
	}
	cout << cnt << endl;
	return 0;
 } 

Measured memory_bytes: 384
#include<bits/stdc++.h>
#define ll long long int 
#define RD(v,n) for(ll i =0;i<n;i++ ) cin>>v[i]
#define bolt ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
using namespace std;

int main()
{
	bolt;
    ll a,b;
    cin>>a>>b;
    ll lcm = a*b / __gcd(a,b);
    cout<<lcm<<"\n";
	return 0;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.InputStreamReader;
import java.util.TreeSet;
import java.io.InputStream;
 
/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        DDistinctCharactersQueries solver = new DDistinctCharactersQueries();
        solver.solve(1, in, out);
        out.close();
    }
 
    static class DDistinctCharactersQueries {
        public void solve(int testNumber, Scanner sc, PrintWriter pw) {
            TreeSet<Integer>[] sets = new TreeSet[26];
            for (int i = 0; i < 26; i++)
                sets[i] = new TreeSet<>();
          	int length=sc.nextInt();
            char[] arr = sc.next().toCharArray();
            for (int i = 0; i < arr.length; i++) {
                sets[arr[i] - 'a'].add(i);
            }
            int n = sc.nextInt();
            while (n-- > 0) {
                int q = sc.nextInt();
                if (q == 1) {
                    int idx = sc.nextInt() - 1;
                    sets[arr[idx] - 'a'].remove(idx);
                    char c = sc.next().charAt(0);
                    sets[c - 'a'].add(idx);
                    arr[idx] = c;
                } else {
                    int count = 0;
                    int l = sc.nextInt() - 1, r = sc.nextInt() - 1;
                    for (int i = 0; i < 26; i++) {
                        if (sets[i].floor(r) != null && sets[i].floor(r) >= l)
                            count++;
                    }
                    pw.println(count);
                }
            }
        }
 
    }
 
    static class Scanner {
        StringTokenizer st;
        BufferedReader br;
 
        public Scanner(FileReader r) {
            br = new BufferedReader(r);
        }
 
        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }
 
        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }
 
        public int nextInt() {
            return Integer.parseInt(next());
        }
 
    }
}
 

Measured memory_bytes: 93572
N, L = map(int, input().split())

diff = 10**9
min_idx = -1
for i in range(N):
    _diff = abs(L + i)
    if _diff < diff:
        diff = _diff
        min_idx = i

ans = sum([L+i for i in range(N)]) - (L+min_idx)
print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h> 
using namespace std; 
typedef long long int ll;
typedef unsigned long long int ull;
const long long int m=pow(10,9)+7;

int main() 
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,s=0;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        s+=a[i];
    }
    ll m,x,y,p;
    cin>>m;
    while(m--)
    {
        cin>>x>>y;
        p=s-a[--x]+y;
        cout<<p<<endl;
    }
    return 0;
}

Measured memory_bytes: 3648
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    n,m = LI()
    s = input()
    s = s[::-1]
    dp = [float("inf")]*(n+1)
    dp[0] = 0
    q = deque([0])
    ans = []
    f = [0]*(n+1)
    for i in range(n+1):
        if s[i] == "1":
            f[i] = f[i-1]
        else:
            f[i] = i
    while q:
        x = q.popleft()
        r = min(n,x+m)
        y = f[r]
        if x == y:
            break
        dp[y] = dp[x]+1
        q.append(y)
        ans.append(y-x)
    if dp[n] == float("inf"):
        print(-1)
        return
    print(*ans[::-1])
    return

#Solve
if __name__ == "__main__":
    solve()


Measured memory_bytes: 57692
#include <bits/stdc++.h>
#define ss second
#define ff first
#define all(x) x.begin(), x.end()
    
using namespace std;
using ll = long long;
using pii = pair<int, int>;
    
const int oo = 1e9 + 7;
const int mod = 1e9 + 7;
const double PI = acos(-1);

int main(){
    ll h, d = 1, ans = 0;
    cin >> h;

    while(h){
        ans += d;
        d*=2;
        h/=2;
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
/*2019/09/13 */
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#define MOD 1000000007
#define MIN 999999999
#define MAX -999999999
typedef long long int ll;
typedef unsigned long long int ull;
void llswap(ll *x,ll *y){ll tmp;tmp=*x;*x=*y;*y=tmp;}
void swap(int *x,int *y){int tmp;tmp=*x;*x=*y;*y=tmp;}
int rmax(int x,int y){return x>y?x:y;}
int rmin(int x,int y){return x>y?y:x;}
ll llrmax(ll x,ll y){return x>y?x:y;}
ll llrmin(ll x,ll y){return x>y?y:x;}
int asc(const void *a,const void *b){return *(int*)a-*(int*)b;}
int desc(const void *a,const void *b){return *(int*)b-*(int*)a;}
int llasc(const void *a,const void *b){return *(ll*)a-*(ll*)b;}
int lldesc(const void *a,const void *b){return *(ll*)b-*(ll*)a;}
int gcd(int x,int y){if(y==0)return x;return gcd(y,x%y);}

typedef struct group_{
    int num;
    int a;
}group_t;
int asc_t(const void *a,const void *b){return ((group_t*)a)->a - ((group_t*)b)->a;}
//int desc_t(const void *a,const void *b){return ((struct_t*)b)->member - ((struct_t*)a)->member;}

int main(){
    int n;
    group_t group[200000];
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",&group[i].a);
        group[i].num=i+1;
    }
    qsort(group,n,sizeof(group_t),asc_t);
    for(int i=0;i<n;i++){
        printf("%d ",group[i].num);
    }
    printf("\n");
    return 0;
}

Measured memory_bytes: 1788
#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;

int n;
ll a[100005];
ll b[100005];
P p[200005];
int cnt[100005];


int main(void){
	scanf("%d",&n);
	ll ans=0;
	for(int i=0;i<n;i++){
		scanf("%lld%lld",&a[i],&b[i]);
		ans+=b[i];
		p[i]=P(a[i],i);
		p[i+n]=P(b[i],i);
	}
	ll val=0;
	for(int i=0;i<n;i++){
		val+=a[i];
	}
	ans=min(ans,val);
	sort(p,p+2*n);
	bool flag=false;
	for(int i=0;i<n;i++){
		cnt[p[i].second]++;
		if(cnt[p[i].second]>=2){
			flag=true;
		}
	}
	ll sum=0;
	for(int i=0;i<n;i++){
		sum+=p[i].first;
	}
	if(flag){	
		printf("%lld\n",sum);
	}else{
		for(int i=0;i<n;i++){
			if(p[n].second==i){
				ans=min(ans,sum-min(a[i],b[i])+p[n+1].first);
			}else{
				ans=min(ans,sum-min(a[i],b[i])+p[n].first);
			}
		}
		printf("%lld\n",ans);
	}
	return 0;
} 

Measured memory_bytes: 5376
program sample
	implicit none
    integer(8) :: x,y,z,a,b,c,count
    
    read(*,*) x,y,z
    count=0
	if (mod(x,2)==0 .and. mod(y,2)==0 .and. mod(z,2) ==0) then
    	if (x==y .and. y==z) then
    		write(*,*) -1
    	else
        	do while(.true.)
 		   		if (mod(x+y,2) == 0 .and. mod(y+z,2) ==0 .and. mod(x+z,2) ==0) then
    				count = count+1
    			    a=(y+z)/2
    			    b=(x+z)/2
     			    c=(x+y)/2
      	   	 	 	x=a
     	    		y=b
       	    		z=c
    			else
    				write(*,*) count
    	 	    	exit
    			end if
   			end do
         end if
    else
    	write(*,*) count
    end if
    
    stop
end program sample

Measured memory_bytes: 256
#include <iostream>
#include <unordered_map>
#include <iterator>
#include <algorithm>
#include <string>
using namespace std;
#define ALL(a) (a).begin(), (a).end()
const int64_t BIG_PRIME = 1000000007;


int main(){
    int n;
    cin >> n;
    int64_t sum=0;
    for(int i=1; i<=n; i++){
        if(i%3==0 || i%5==0){

        }else{
            sum += i;
        }
    }

    cout << sum << endl;
}

Measured memory_bytes: 3624
#include<iostream>
#include<numeric>
#include<math.h>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<iomanip>
#define fi first
#define se second
#define pb push_back
#define pii pair<int,int>
#define ll long long
#define pll pair<ll,ll>
#define rep(i,from,to) for(int i=from;i<to;i++)
#define repd(i,from,till) for(int i=from;i>=till;i--)
#define waste ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define inf 1e9+1
#define mod 1e9+7
#define inf1 1e18+1
#define pie 3.14159265358979323846
#define N 100005
using namespace std;

void solve(){
	int n;
	cin>>n;
	int h[n];
	rep(i,0,n)cin>>h[i];
	int minc[n];
	minc[n-1]=0;
	minc[n-2]=abs(h[n-1]-h[n-2]);
	repd(i,n-3,0){
		minc[i]=min(abs(h[i]-h[i+1])+minc[i+1],abs(h[i]-h[i+2])+minc[i+2]);
	}
	cout<<minc[0]<<endl;
}
int main()
{
	waste;
	int t;
	//cin>>t;
	t=1;
	while(t--){
		solve();
	}
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
const int N=4010;
int n,a,b,top,stk[N],ans[N];
char s[5];
int qry(int x,int y){
	printf("? %d %d\n",x,y); fflush(stdout);
	scanf("%s",&s); return (s[0]=='Y');
}
int main(){
	scanf("%d%d",&a,&b); n=a+b;
	if(a<=b){ puts("Impossible"); return 0; }
	for(int i=0;i<n;i++){
		if(!top) stk[++top]=i;
		else{
			int pd=qry(stk[top],i);
			if(pd) stk[++top]=i; else --top;
		}
	}
	for(int i=0;i<n;i++) ans[i]=qry(stk[top],i);
	printf("! "); for(int i=0;i<n;i++) printf("%d",ans[i]);
}


Measured memory_bytes: 3816
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define rep(i,n) for (int i=0;i<(n);i++)
typedef long long ll;
using namespace std;
int main()
{
	ios::sync_with_stdio(false);
	int a,b,c;
	cin>>a>>b>>c;
	if ((a==b&&a!=c)||(a==c&&a!=b)||(b==c&&a!=b)) cout<<"Yes";
	else cout<<"No";
	return 0;
}


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

int main(){
    int n;
    cin >> n;
    
    vector<int> a(n);
    for (int i = 0; i < n; i++){
        cin >> a[i];
        a[i]--;
    }
    
    vector<int> idx(n);
    for (int i = 0; i < n; i++) idx[a[i]] = i;

    set<int> s;
    long long ans = 0;
    for (int x = n - 1; x >=0; x--){
        int i = idx[x];
        long long c = 0;
        
        s.insert(i);
        
        auto it1 = s.find(i);
        auto it2 = it1;

        vector<int> l(2, -1);
        for (int j = 0; j < 2; j++){
            if (it1 == s.begin()) break;
            it1--;
            l[j] = *it1;
        }
        
        vector<int> r(2, n);
        for (int j = 0; j < 2; j++){
            it2++;
            if (it2 == s.end()) break;
            r[j] = *it2;
        }
        
        vector<int> ls(2);
        ls[0] = i - l[0];
        ls[1] = l[0] - l[1];
        
        vector<int> rs(2);
        rs[0] = r[0] - i;
        rs[1] = r[1] - r[0];
        
        c = static_cast<long long>(ls[0] * rs[1]) + static_cast<long long>(ls[1] * rs[0]);
        
        ans += c * (x + 1);
    }
    cout << ans << endl;
    return 0;
}

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



int main() {
    set<char> a;
    string s;
    cin >> s ;
    for(char x: s)
    {
        a.insert(x);
    }
    if (size(s) == size(a))
        cout << "yes" << endl;
    else
        cout << "no" << endl;
    
    return 0;
}


Measured memory_bytes: 3600
#include <bits/stdc++.h>
#define WHOLE(v) (v).begin(), (v).end()
#define REV_WHOLE(v) (v).rbegin(), (v).rend()
using i64 = int64_t;
using namespace std;
template<typename T> using rev_priority_queue = priority_queue<T, vector<T>, greater<T>>;
int main() {
    string s, t;
    cin >> s >> t;
    int ans = 0;
    for(int i = 0; i < 3; i++) {
        if(s[i] == t[i]) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>

using namespace std;

int m,n;
int a[1002];
int aa[1002001];

int ans,Max,size;

int main(){
	
	while (1) {
		scanf("%d%d",&n,&m);
		ans=0;
		if (n==0&&m==0) {
			break;
		}
		for (int i=0; i<n; i++) {
			scanf("%d",&a[i]);
		}
		a[n++]=0;
		
		size=0;
		for(int c=0;c<n;c++){
			for (int d=c; d<n; d++) {
				aa[size++]=a[c]+a[d];
			}
		}
		sort(aa,aa+size);
		
		for (int i=0; i<n; i++) {
			for (int j=0; j<n; j++) {
				if (m-a[i]-a[j]>0) {
					int l=0,r=size-1;
					Max=0;
					while (l<=r) {
						if (aa[size-1]+a[i]+a[j]<ans) {
							break;
						}
						int k=(l+r)/2;
						if (aa[k]<(m-a[i]-a[j])&&aa[k]>Max) {
							Max=aa[k];
						}
						if(aa[k]<(m-a[i]-a[j]))l=k+1;
						else r=k-1;
					}
					if (Max+a[i]+a[j]>ans) {
						ans=Max+a[i]+a[j];
					}
				}
			}
		}
		printf("%d\n",ans);
	}
}

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

#define fastio 

#define ll long long
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define ld long double
#define forn(low,high,i) for(i = low; i < high; i++)
#define forrev(high,low,i) for(i = high; i >= low; i--)
#define all(v) v.begin(),v.end()
#define decimal_digits cout << fixed << setprecision(15);

string to_string(string s) { return '"' + s + '"';}
string to_string(char s) { return string(1, s);}
string to_string(const char* s) { return to_string((string) s);}
string to_string(bool b) { return (b ? "true" : "false");}
template <typename A> string to_string(A);
template <typename A, typename B>string to_string(pair<A, B> p) {return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";}
template <typename A> string to_string(A v) {bool f = 1; string r = "{"; for (const auto &x : v) {if (!f)r += ", "; f = 0; r += to_string(x);} return r + "}";}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) {cerr << " " << to_string(H); debug_out(T...);}
#define pr(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

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

const int inf = 1e9;
const long long INF = 1e18;
const int mod = 1e9 + 7;
const int bit32 = log2(inf) + 3;
const int bit64 = log2(INF) + 3;

inline int add(long long a, long long b){a += b; if(a >= mod) a -= mod; return a;}
inline int sub(long long a, long long b){a -= b; if(a < 0) a += mod; return a;}
inline int mul(long long a, long long b){a %= mod; b %= mod; return (int)((long long) a * b % mod);}
inline int modexpo(long long a, long long b){int res = 1; while(b > 0){ if(b & 1) res = mul(res, a); a = mul(a, a); b /= 2;} return res;}
inline int divide(long long a, long long b){return mul(a, modexpo(b, mod - 2));}
inline int inv(long long a){return modexpo(a, mod - 2);}

clock_t time_p = clock();

void ktj(){
  time_p = clock() - time_p;
  cerr << "Time elapsed : " << (float)(time_p)/CLOCKS_PER_SEC << "\n";
}

void pre(){ // Reset each global variable (esp. for graphs)
  
}

long long nCr(long long n, long long r){
  long long ans = 1;
  for(long long i = 1; i <= r; i++){
    ans = mul(ans, n - i + 1);
    ans = divide(ans, i);
  }
  return ans;
}

void solve(){
  long long n, a, b;
  cin >> n >> a >> b;
  long long ans = modexpo(2, n);
  long long w1 = nCr(n, a);
  long long w2 = nCr(n, b);
  ans = sub(ans, w1);
  ans = sub(ans, w2);
  ans = sub(ans, 1);
  cout << ans << '\n';
}

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

  pre();

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

  ktj();
}


Measured memory_bytes: 384
#include <stdio.h>

int main(void){

  int bo, bt, bth;

  scanf("%d%d%d", &bo, &bt, &bth);

  if(bo + bt + bth != 0){
    if(bo == bt){
      printf("Open\n");
      return 0;
    }
  }

  printf("Close\n");
  return 0;
}

Measured memory_bytes: 584
import java.util.Scanner;

public class Main {
  public static void main(String[] args) throws Exception {
    Scanner scanner = new Scanner(System.in);
    int A = scanner.nextInt();
    int B = scanner.nextInt();
    int M = scanner.nextInt();

    int[] a = new int[A];
    for (int i = 0; i < A; i++) {
      a[i] = scanner.nextInt();
    }

    int[] b = new int[B];
    for (int i = 0; i < B; i++) {
      b[i] = scanner.nextInt();
    }

    int mina = 300000;
    for (int i = 0; i < A; i++) {
      if (mina > a[i]) mina = a[i];
    }

    int minb = 300000;
    for (int i = 0; i < B; i++) {
      if (minb > b[i]) minb = b[i];
    }

    int waribiki = 300000;
    for (int i = 0; i < M; i++) {
      int x = scanner.nextInt();
      int y = scanner.nextInt();
      int c = scanner.nextInt();
      x--;
      y--;
      
      int cost = a[x] + b[y] - c;
      if (waribiki > cost) waribiki = cost;
    }

    scanner.close();

    if (mina + minb < waribiki) {
      System.out.println(mina + minb);
    } else {
      System.out.println(waribiki);
    }
  }
}

Measured memory_bytes: 132612
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <string.h>
#include <vector>
#include <functional>
#include <queue>
#include <unordered_set>
#include <climits>
#include <set>
#include <list>
#include <cmath>
#include <map>

using namespace std;
typedef long long ll;

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 998244353;
struct mint {
	ll x; // typedef long long ll;
	mint(ll x=0):x((x%mod+mod)%mod){}
	mint operator-() const { return mint(-x);}
	mint& operator+=(const mint a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator-=(const mint a) {
		if ((x += mod-a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator*=(const mint a) {
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint a) const {
		mint res(*this);
		return res+=a;
	}
	mint operator-(const mint a) const {
		mint res(*this);
		return res-=a;
	}
	mint operator*(const mint a) const {
		mint res(*this);
		return res*=a;
	}
	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t>>1);
		a *= a;
		if (t&1) a *= *this;
		return a;
	}
	
	// for prime mod
	mint inv() const {
		return pow(mod-2);
	}
	mint& operator/=(const mint a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint a) const {
		mint res(*this);
		return res/=a;
	}
};

int main()
{
	ll N, K;
	cin >> N >> K;
	ll L[11];
	ll R[11];
	for(int i = 0; i < K; i++){
		cin >> L[i] >> R[i];
	}
	
	mint sum[200200];
	for(int i = 0; i <= N; i++){
		sum[i] = 0;
	}
	sum[1] = 1;
	for(int i = 2; i<= N; i++){
		mint f = 0;
		for(int k = 0; k < K; k++){
			int ref = i - L[k];
			if(ref >= 1){
				f += sum[ref];
				int refL = i - R[k] - 1;
				if(refL >= 1){
					f -= sum[refL];
				}
			}
		}
		sum[i] = sum[i-1] + f;
	}
	
	mint ans = sum[N] - sum[N-1];

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


Measured memory_bytes: 5192