akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <set>
#include <deque>
#include <bitset>

long long mod = 1e9+7;
class Mint {
public:
  long long x;
  Mint(){}; // 引数なしでも定義できるように引数なしコンストラクタも用意しておく
  Mint(long long a){
    x = a%mod;
    while(x<0){
      x += mod;
    }
  };
  Mint& operator += (const Mint &a){
    x+=a.x;
    x%=mod;
    return *this;
  }
  Mint& operator -= (const Mint &a){
    x += (mod - a.x);
    x%=mod;
    return *this;
  }
  Mint& operator *= (const Mint &a){
    x*=a.x;
    x%=mod;
    return *this;
  }

  // a^n mod を計算する
  // Useaeg: Mint z = Mint(2).pow(n);
  Mint pow(long long n) const {
    if (n==0) return Mint(1);
    Mint y = pow(n>>1); // pow(n/2)を計算する
    y *= y;
    if (n%2==1) y *= *this;
    return y;
  }

  // a^{-1} mod を計算する
  Mint modinv(const Mint &a) const {
    return a.pow(mod-2);
  }

  Mint& operator /= (const Mint &a) {
    x *= modinv(a).x;
    x %= mod;
    return *this;
  }

  Mint operator + (Mint &a) const {
    Mint y(*this);
    y += a;
    return y;
  }

  Mint operator - (Mint &a) const {
    Mint y(*this);
    y -= a;
    return y;
  }

  Mint operator * (Mint &a) const {
    Mint y(*this);
    y *= a;
    return y;
  }

  Mint operator / (Mint &a) const {
    Mint y(*this);
    y/=a;
    return y.x;
  }

  // nCk @mod を計算する
  Mint nCk(Mint &n, const long long k) const {
    Mint y = Mint(1);
    Mint one = Mint(1);
    for (Mint i(0); (i.x)<k; i.x++){
      y *= (n-i);
      y /= (i + one);
    }
    return y;
  }

  // nPk @mod を計算する
  Mint nPk(Mint &n, long long k) const {
    Mint y(1);
    for (Mint i(0); (i.x)<k; i.x++){
      y *= (n-i);
    }
    return y;
  }
};

int main() {
  int N, A, B;
  std::cin >> N >> A >> B;
  long long K;
  std::cin >> K;
  mod = 998244353;
  std::vector<Mint > nCk(N+4);
  nCk[0].x = 1;
  for (int i=1; i<=N; i++) {
    if (i>N/2) {
      nCk[i] = nCk[N-i];
    } else {
      nCk[i] = nCk[i-1];
      nCk[i] *= Mint(N-i+1);
      nCk[i] /= Mint(i);
    }
    // printf("nCk[%d]=%lld\n",i,nCk[i].x);
  }
  Mint ans = 0;
  for (long long Anum=0; Anum<=N; Anum++) {
    long long amari = K - Anum * (long long)A;
    if (amari%B!=0) continue;
    long long Bnum = amari / B;
    if (Bnum<0 || Bnum>N) continue;
    // printf("(%lld, %lld)\n", Anum, Bnum);
    ans += nCk[Anum] * nCk[Bnum];
  }
  std::cout << ans.x << std::endl;
  return 0;
}

Measured memory_bytes: 5228
#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>
void WarshallFloyd(vector<vector<T>> &G, T inf) {
    
    int N = G.size();
    for (int k = 0; k < N; ++k) {
        for (int i = 0; i < N; ++i) {
            if (G[i][k] == inf) continue;
            for (int j = 0; j < N; ++j) {
                if (G[k][j] == inf) continue;
                G[i][j] = min(G[i][j],G[i][k]+G[k][j]);
            }
        }
    }
}

///////////////////////////////////////////////////////////////////////

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int N,M; cin >> N >> M;
    vector<vector<ll>> G(N, vector<ll>(N,1e18));
    rep(i,N) G[i][i] = 0;
    rep(i,M) {
        ll s,t,d; cin >> s >> t >> d;
        G[s][t] = d;
    }

    WarshallFloyd<ll>(G,1e18);
    rep(i,N) {
        if (G[i][i] < 0) {
            cout << "NEGATIVE CYCLE" << endl;
            return 0;
        }
    }
    rep(i,N) {
        rep(j,N) {
            if (j > 0) cout << " ";
            if (G[i][j] == 1e18) cout << "INF";
            else cout << G[i][j];
        }
        cout << endl;
    }
}

/*
  verified on 2020/02/09
  http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_1_C&lang=jp
*/


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

using namespace std;

int
main(void){
	int n, w; cin >> n >> w;
	vector<pair<int, int> > vec(n);
	for(int i = 0; i < n; i++) cin >> vec[i].first >> vec[i].second;
	
	vector<long long> dp(n*1000 + 1, 1e9 + 10); // dp[i] contains the minimum weight of objects with value exactly i.
	dp[0] = 0;
	for(int i = 0; i < n; i++){
		for(int j = n*1000; j >= vec[i].second; j--){
			dp[j] = min(dp[j], dp[j - vec[i].second] + vec[i].first);
		}
	}
	//cout << "hell";
	int ans = INT_MIN;
	for(int i = 0; i <= n*1000; i++){
		if(dp[i] <= w) ans = max(ans, i);
	}
	
	cout << ans;
	
		
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define hell 998244353
#define PI 3.14159265358979323846
using namespace std;

int main()
{
   ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t=1;
    //cin>>t;
    //int c=0;
    while(t--) {

       ll n,i,j,k,ans=0,l,r;
       cin>>n>>k;
       vector<pair<ll,ll> >v;
       for(i=0;i<k;i++)
       {
           cin>>l>>r;
           v.pb({l,r});
       }
       sort(v.begin(),v.end());
       ll dp[n+5]={0},suf[n+5]={0};
       dp[n]=1;
       suf[n]=1;
       for(i=n-1;i>0;i--)
       {
           suf[i]=suf[i+1];
           for(j=0;j<k;j++)
           {
                l=v[j].first;
                r=v[j].second;
                if(i+l>n)
                    break;
                l+=i;
                r=min(n,i+r);
                dp[i]=(dp[i]+suf[l]-suf[r+1]+hell)%hell;
           }
           suf[i]=(suf[i]+dp[i])%hell;
       }
       cout<<dp[1];
    }

}


Measured memory_bytes: 6752
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define cinn(a) for(auto &_k:(a)) cin >> _k
#define coutt(a) for(auto &_k:(a)) cout << _k << ' '
inline int cint() { int temp; cin>>temp; return temp; }
int c[5002][5002];
int main(){
    int i(0), n, mx(0); string s; cin >> n >> s;
    for (int j=i+1; j<n; j++)   if (s[i]==s[j]) c[i][j]=1;
    for (int i=1; i<n; i++){
        for (int j=i+1; j<n; j++) {
            if (s[i] == s[j] && j - i > c[i - 1][j - 1])
                c[i][j] = c[i - 1][j - 1] + 1;
            mx=max(mx,c[i][j]);
        }
    }
    cout << mx;
}

Measured memory_bytes: 96768
N, M = map(int, input().split(' '))
lis = [-1 for _ in range(N)]
not_exist = False
for _ in range(M):
    s, c = map(int, input().split(' '))
    if lis[s-1] == -1:
        lis[s-1] = c
    elif lis[s-1] > -1 and lis[s-1] != c:
        not_exist = True
if N > 1 and lis[0] == 0:
    print(-1)
elif not_exist:
    print(-1)
elif N == 1 and M == 0:
    print(0)
else:
    ans = 0
    dig = N-1
    for i in range(N):
        if lis[i] == -1 and i == 0:
            num = 1
        elif lis[i] == -1:
            num = 0
        else:
            num = lis[i]
        ans += (num * (10 ** dig))
        dig -= 1
    print(ans)

Measured memory_bytes: 3444
// ------------------------------------
// Date:2018/ 3/ 6
// Problem:ABC 080 ShoppingStreet c.cpp
//
// ------------------------------------

#include <bits/stdc++.h>

using namespace std;

#define EACH(i,a) for (auto&& i : a)
#define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RFOR(i,a,b) for(int i=(int)b-1;i>=(int)a;--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define debug(x) cerr << #x << ":" << x << endl

typedef long long ll;

//static const int MOD = 1000000007;
static const int INF = 1e9 + 1;

// F[店舗番号][曜日*時間帯]
int F[101][10];
// P[店舗番号][曜日*時間帯]
int P[101][11];
// C[店舗番号]
int C[101];


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

  memset(F, 0, sizeof(F));
  memset(P, 0, sizeof(P));
  
  int N;
  cin >> N;
  REP(i, N) {
    REP(j, 10) {
      cin >> F[i][j];
    }
  }
  REP(i, N) {
    REP(j, 11) {
      cin >> P[i][j];
    }
  }
  ll ans = -INF;
  ll tmp;
  FOR(i, 1, (1 << 10)) {
    tmp = 0ll;
    memset(C, 0, sizeof(C));
    REP(j, 10) {
      if (i >> j & 1) {
	REP(k, N) {
	  if (F[k][j] == 1) C[k]++;
	}
      }
    }
    REP(j, N) {
      tmp += P[j][C[j]];
    }
    ans = max(ans, tmp);
  }

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



Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
#include<stdio.h>
#include<string.h>
#include<iomanip>
using namespace std;
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define REP(i, n) FOR(i, 0, n - 1)
#define NREP(i, n) FOR(i, 1, n)
using ll = long long;
using pii = pair<int, int>;
using piii = pair<pii, pii>;
const int dx[4] = { 0, -1, 1, 0 };
const int dy[4] = { -1, 0, 0, 1 };
const int INF = 1e9 + 7;
int gcd(int x, int y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return gcd(y, x%y);
}

template<class T1, class T2> void chmin(T1 &a, T2 b) { if (a>b)a = b; }

template<class T1, class T2> void chmax(T1 &a, T2 b) { if (a<b)a = b; }
template<class T>
void Add(T &a, const T &b, const T &mod = 1000000007) {
	int val = ((a % mod) + (b % mod)) % mod;
	if (val < 0) { val += mod; }
	a = val;
}
////////////////////////////////////////

int main() {
	int a, b, c, d, e, k;
	cin >> a >> b >> c >> d >> e >> k;
	int key1 = min(a, min(b, min(c, min(d, e))));
	int key2 = max(a, max(b, max(c, max(d, e))));
	if (key2 - key1 <= k)cout << "Yay!" << endl;
	else cout << ":(" << endl;
	return 0;
}


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

#define	mp	make_pair
#define	pb	push_back

using namespace std;

typedef	pair<int,int>	pii;
typedef	vector<pii>		vpii;

vector<vpii> rect;
int w,h,n,land[50][50],test[50][50],ans[50][50];

bool search(int i0,int j0){
//printf("i0=%d, j0=%d\n",i0,j0);
//for(int a=0;a<h;a++){for(int b=0;b<w;b++)printf("%d ",test[a][b]);puts("");}puts("");

	for(int i=i0;i<h;i++){
		for(int j=(i==i0?j0:0);j<w;j++){
if(i<0 || h<=i || j<0 || w<=j)	while(1);
			int id=land[i][j];
			if(id==0)	continue;
if(id<0 || n<id)	continue;
			// try to put a rectangle
			int cnt=0;
			for(int k=0;k<rect[id].size();k++){
				int rh=rect[id][k].first,rw=rect[id][k].second;
				for(int y=i-rh+1;y<=i;y++){
					for(int x=j-rw+1;x<=j;x++){
						if(!(0<=y && y+rh<=h && 0<=x && x+rw<=w))	continue;
						bool canput=true;
						for(int yy=y;yy<y+rh;yy++)for(int xx=x;xx<x+rw;xx++){
if(yy<0 || h<=yy || xx<0 || w<=xx)	while(1);
							if(test[yy][xx]!=0
							||(land[yy][xx]!=0 && land[yy][xx]!=id))	canput=false;
						}
						if(!canput)	continue;
						for(int yy=y;yy<y+rh;yy++)for(int xx=x;xx<x+rw;xx++){
if(yy<0 || h<=yy || xx<0 || w<=xx)	while(1);
							test[yy][xx]=id;
						}
						cnt+=search(i,j+1);
						for(int yy=y;yy<y+rh;yy++)for(int xx=x;xx<x+rw;xx++){
if(yy<0 || h<=yy || xx<0 || w<=xx)	while(1);
							test[yy][xx]=0;
						}
						if(cnt>=2)	return false;
					}
				}
			}

			return (cnt==1)?true:false;
		}
	}

	bool suc=true;
	for(int i=0;i<h;i++){for(int j=0;j<w;j++){
		if(test[i][j]==0)	suc=false;
	}}
	if(suc){
		for(int i=0;i<h;i++){for(int j=0;j<w;j++)	ans[i][j]=test[i][j];}
		return true;
	}
	return false;
}

int main(){
	for(;scanf("%d%d%d",&w,&h,&n),w;){
		rect=vector<vpii>(n+1);

		for(int i=0;i<n;i++){
			int id,area;	scanf("%d%d",&id,&area);
			for(int j=1;j<=area;j++){
				if(area%j==0)	rect[id].pb(mp(j,area/j));
			}
		}
		for(int i=0;i<h;i++){for(int j=0;j<w;j++)	scanf("%d",&land[i][j]);}

		if(search(0,0)){
			for(int i=0;i<h;i++){
				for(int j=0;j<w;j++){	printf("%s%d",(j?" ":""),ans[i][j]);}
				putchar('\n');
			}
		}
		else	puts("NA");
	}

	return 0;
}

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

#define rep(i,N) repv(i,0,N)
#define reps(i,N) repvs(i,0,N)
#define repv(i,a,b) for(int i=a;i<b;i++)
#define repvs(i,a,b) for(int i=a+1;i<=b;i++)
#define repr(i,N) for(int i=N-1;i>=0;i--)
#define reprs(i,N) for(int i=N;i>0;i--)

#define d(a) if(isDebugMode) cout<<#a<<"="<<a<<","
#define d2(a,b) if(isDebugMode) cout<<#a<<"="<<a<<","<<#b<<"="<<b
#define d3(a,b,c) if(isDebugMode) cout<<#a<<"="<<a<<","<<#b<<"="<<b<<","<<#c<<"="<<c
#define d4(a,b,c,d) if(isDebugMode) cout<<#a<<"="<<a<<","<<#b<<"="<<b<<","<<#c<<"="<<c<<","<<#d<<"="<<d
#define da(arr,N){if(isDebugMode){rep(i,N+1){if(arr[i]==INF)printf("INF ");else cout<<arr[i]<<" ";} cout<<endl;}}
#define da2(arr,N,M){if(isDebugMode)rep(i,N+1){rep(j,M+1){if(arr[i][j]==INF)printf(" INF");else printf(" %3d",arr[i][j]);}cout<<endl;}}
#define pb push_back
#define pob pop_back
#define s(a) cout<<a<<endl;

auto chmax =[](int &a,int b){ a = max(a, b);};
auto chmin =[](int &a,int b){ a = min(a, b);};

typedef long long ll;
typedef pair<int,int> P;
const int INF = 100000000;
const int MOD = 100000007;
const int dx[4] = { 0, 1, 0,-1};
const int dy[4] = { 1, 0,-1, 0};

bool isDebugMode=1;
//--------------------------------------//
string s;

void solve(){
	int size=s.size();

	rep(i,size-1){
		if(s[i]==s[i+1]){
			cout<<i+1<<" "<<i+2<<endl;
			return;
		}
		if(i!=size-2&&s[i]==s[i+2]){
			cout<<i+1<<" "<<i+3<<endl;
			return;
		}
	}
	cout<<-1<<" "<<-1<<endl;
}

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


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

int main() {
    int n;
    int k;
    int numShow = 1;
    int minNumber = 9999999;
    cin >> n >> k;

    for (int i = 0; i < n; i++) {
        // 操作Aの処理
        for (int a = i; a < n; a++) {
            numShow *= 2;
            if (numShow > minNumber) {
                break;
            }
        }

        // 操作Bの処理
        for (int b = n - i; b < n; b++) {
            numShow += k;
            if (numShow > minNumber) {
                break;
            }
        }

        if (numShow < minNumber) {
            minNumber = numShow;
        }

        numShow = 1;
    }
    
    cout << minNumber << endl;
}

Measured memory_bytes: 3592
import sys
import collections
lines = [s.rstrip("\n") for s in sys.stdin.readlines()]
n, m = [int(num) for num in lines.pop(0).split(" ")]
def iter_a_set():
    for line in lines:
        fs = [int(num) for num in line.split(" ")]
        k = fs.pop(0)
        yield set(fs)
foods = set(range(1, m + 1))
for a_set in iter_a_set():
    foods &= a_set
print(len(foods))


Measured memory_bytes: 9448
#include <cassert>
#include <cstdint>
#include <cstdio>
#include <iostream>
#include <vector>

using namespace std;

struct UnionFind {
  UnionFind(int n) : v_(n, -1) {}

  int size(int x) { return -v_[find(x)]; }

  int find(int x) {
    assert(x < v_.size());
    if (v_[x] < 0) return x;
    return v_[x] = find(v_[x]);
  }

  bool is_same(int x, int y) { return find(x) == find(y); }

  void merge(int x, int y) {
    assert(x < v_.size());
    assert(y < v_.size());

    x = find(x);
    y = find(y);
    if (x == y) return;
    if (-v_[x] <= -v_[y]) swap(x, y);
    v_[x] += v_[y];
    v_[y] = x;
  }

 private:
  vector<int> v_;
};

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> a(m);
  vector<int> b(m);
  for (int i = 0; i < m; i++) {
    cin >> a[i] >> b[i];
    a[i]--;
    b[i]--;
  }
  UnionFind uf(n);
  vector<int64_t> ans(m);
  ans[m - 1] = (int64_t)n * (n - 1) / 2;
  for (int i = m - 1; i > 0; i--) {
    if (uf.is_same(a[i], b[i])) {
      ans[i - 1] = ans[i];
      continue;
    }
    int64_t conv = (int64_t)uf.size(a[i]) * uf.size(b[i]);
    ans[i - 1] = ans[i] - conv;
    uf.merge(a[i], b[i]);
  }
  for (auto e : ans) printf("%lld\n", e);
  return 0;
}


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

int main() {
    int num[3], sub1, sub2, count = 0;
    for (int i = 0; i < 3; i++) cin >> num[i];
    int idx1, idx2, idx3;
    int max_num = -1;
    for (int i = 0; i < 3; i++) {
        if (num[i] > max_num) {
            idx1 = i;
            max_num = num[i];
        }
    }
    max_num = -1;
    for (int i = 0; i < 3; i++) {
        if (num[i] > max_num && i != idx1) {
            idx2 = i;
            max_num = num[i];
        }
    }
    idx3 = 3 - (idx1 + idx2);
    sub1 = num[idx1] - num[idx2];
    sub2 = num[idx1] - num[idx3];
    count += sub1;
    int sub3 = sub2 - sub1;
    count += int(sub3 / 2);
    if (sub3 % 2 == 1) count += 2; 
    cout << count << endl;
}

Measured memory_bytes: 256
from scipy.spatial.distance import cityblock

N,M = [int(i) for i in input().split()]
S = [[int(i) for i in input().split()] for _ in range(N)]
C = [[int(i) for i in input().split()] for _ in range(M)]
d = [0]*M

for i in range(N):
    for j in range(M):
        d[j] = cityblock(S[i],C[j])
    print(d.index(min(d))+1)


Measured memory_bytes: 44376
import java.util.*; 
	public class Main {
	public static void main( String[] args) {			
					
					Scanner in = new Scanner(System.in);
					long a[] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
					int a1 = in.nextInt();
					System.out.println(a[a1-1]);
					
			}}

Measured memory_bytes: 21076
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
using namespace std;

const ll infll=9223372036854775806;
const int inf=2147483646;

int main()
{
	//freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
	ios_base::sync_with_stdio(false); cin.tie(0);
	int h,w,a,b;
	cin>>h>>w>>a>>b;
	cout<<(h-a)*(w-b);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
#include <stdio.h>
#include <ctype.h>
#include <string.h>
using namespace std;
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define INF 100000000000000000
#define int long long
#define all(vec) vec.begin(),vec.end()
#define P pair<int,int>
#define S second
#define F first

int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
bool prime(int x) {
	for (int i = 2; i <= sqrt(x); i++) {
		if (x%i == 0)return false;
	}
	return true;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}

int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}

int ka[400010];

int c(int x, int y) {
	if (y > x)return 0;
	return ka[x] * mod_pow(ka[x - y], mod - 2, mod) % mod*mod_pow(ka[y], mod - 2, mod) % mod;
}

int n, k;
int ans;

signed main() {
	cin >> n >> k;
	ka[0] = 1;
	for (int i = 1; i <= 400000; i++)ka[i] = ka[i - 1] * i%mod;
	for (int i = 0; i <= min(k, n - 1); i++) {
		ans += c(n, i)*c(n - 1, n - i - 1);
		ans %= mod;
	}
	cout << ans << endl;
}

Measured memory_bytes: 3328
#define _USE_MATH_DEFINES
#include <iostream>
#include <vector>
#include <map>
#include <string>
#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;
int main()
{ 
	int n,k;
	cin>>n>>k;
	
	long long int sum=0;
	int a;
	for(int i=1;i<=n;i++){
		cin>>a;
		sum+=min(abs(a)*2,abs(k-a)*2);
	}
	
	cout<<sum<<endl;
	
	

}

Measured memory_bytes: 256
S = input()
T = input()

flag = False
for i in range(len(S)-len(T)+1):
    for j in range(len(T)):
        if S[i+j] != T[j] and S[i+j] != '?':
            break
        if j == len(T) - 1:
            flag = True
            index = i

if flag:
    s = ''
    k = 0
    for i in range(len(S)):
        if index <= i <= index + len(T) - 1:
            s += T[k]
            k += 1
            continue
        if S[i] == '?':
            s += 'a'
        else:
            s += S[i]
else:
    s = 'UNRESTORABLE'

print(s)


Measured memory_bytes: 3064
from bisect import bisect_left
N = int(input())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]

def solve() :
    sA, tB = zip(*sorted(zip(A, B)))
    sB = sorted(B)
    
    for i in range(N) :
        if sA[i] > sB[i] :
            return 'No'
            
    for i in range(1, N) :
        if sA[i] <= sB[i-1] :
            return 'Yes'
    
    tB = [bisect_left(sB, tB[i]) for i in range(N)]
    pos = [0] * N
    for k, v in enumerate(tB) :
        pos[v] = k
    # print(tB)
    # print(pos)
    # vの位置はpos[v]
    count = 0
    for i in range(N) :
        if pos[i] == i :
            continue
        x = pos[i]
        y = tB[i]
        pos[i], pos[y] = pos[y], pos[i]
        tB[i], tB[x] = tB[x], tB[i]
        
        count += 1
        # print(pos, tB)
    # print('swap', count)
    if count <= N - 2 :
        return 'Yes'
    else :
        return 'No'
    
print(solve())

Measured memory_bytes: 96580
# -*- coding: utf-8 -*-

N = int(input())
A = []
B = []
for i in range(N):
    a,b = map(int, input().split())
    A.append(a)
    B.append(b)

max_order = max(A)
i = A.index(max_order)
score = B[i]
print(max_order+score)

Measured memory_bytes: 11052
import java.util.*;

class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		double ans = 0;
		for(int i = 1; i <= n; i++){
			int tmp = i;
			int cou = 0;
			while(tmp < k){
				tmp = tmp*2;
				cou++;
			}
			ans += (double)1/n*Math.pow(0.5,cou);
		}
		System.out.print(ans);
	}
}


Measured memory_bytes: 21844
package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}

func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}

func main() {
	fp := os.Stdin
	wfp := os.Stdout

	if os.Getenv("MASPY") == "ますピ" {
		fp, _ = os.Open(os.Getenv("BEET_THE_HARMONY_OF_PERFECT"))
	}
	if os.Getenv("MASPYPY") == "ますピッピ" {
		wfp, _ = os.Create(os.Getenv("NGTKANA_IS_GENIUS10"))
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(wfp)

	n := getNextInt(scanner)
	k := getNextInt(scanner)

	// a=bi+j
	var ans int64
	for i := k + 1; i < n+1; i++ {
		ans += int64(i-k) * int64(n/i)
		if n%i >= k {
			ans += int64(maxint(n%i-k+1, 0))
			if k == 0 {
				ans--
			}
		}
	}

	fmt.Fprintln(writer, ans)
	writer.Flush()
}
func maxint(a int, b int) int {
	if a > b {
		return a
	}
	return b
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
const long long LINF=8931145141919364364,LMOD=998244353;
inline long long mod(long long n,long long m){return(n%m+m)%m;}
// const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};

int main(){
    long long n; cin>>n;
    long long a[n]; rep(i,n) cin>>a[i];
    long long b[n]; rep(i,n) cin>>b[i];
    long long aa=0,bb=0;
    rep(i,n){
        if(a[i]>b[i]) bb+=a[i]-b[i];
        if(a[i]<b[i]) aa+=(b[i]-a[i])/2;
    }
    if(aa>=bb) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}


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

using namespace std;

typedef long long int ll;

const int N = 3e5 + 5;
const int mod = 998244353;

vector < ll > fact(N);

ll pwr (ll a, ll b) {
  ll res = 1;
  while (b > 0) {
    if (b & 1) res = (res * a) % mod;
    a = (a * a) % mod;
    b >>= 1;
  }
  return res;
}

ll inv (ll a) {
  return pwr(a, mod - 2);
}

ll comb (int n, int r) {
  if (r > n) return 0;
  return ((((fact[n] * inv(fact[n - r])) % mod) * inv(fact[r])) % mod);
}

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

  fact[0] = 1;
  for (int i = 1; i < N; i++) fact[i] = (i * fact[i - 1]) % mod;

  ll n, a, b, k;
  cin >> n >> a >> b >> k;

  ll ans = 0;
  for (int x = 0; x <= n; x++) {
    ll y = (k - a * x) / b;
    if (y < 0) continue;
    if (a * x + b * y == k) {
      ans = (ans + ((comb(n, x) * comb(n, y)) % mod)) % mod;
    }
  }

  cout << ans << '\n';
}


Measured memory_bytes: 2560
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;

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

    double ans = 0.0;
    for (int i = 1; i <= n; i++) {
        long long point = i;
        double cnt = 0.0;
        while (point < k) {
            point *= 2;
            cnt += 1.0;
        }
        ans += (1 / (double)n) * pow(1 / 2.0, cnt);
    }

    cout << fixed << setprecision(15) << ans << endl;
    return 0;
}

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

/* 
 * g++ -std=c++17 main.cpp -o main
 */
int main() {
  ios::sync_with_stdio(false);
  int n;
  cin>>n;
  cout<<n*2*M_PI;
  cout<<endl;
}


Measured memory_bytes: 3812
# include <iostream>
# include <sstream>
# include <cstdio>
# include <cstdlib>
# include <algorithm>
# include <string>
# include <cstring>
# include <cmath>
# include <stack>
# include <queue>
# include <vector>
# include <list>
# include <map>
# include <set>
# include <deque>
# include <iterator>
# include <functional>
# include <bitset>
# include <climits>
# include <ctime>
#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define odd(x) (x&1)
typedef long long ll;
typedef long double ld;
const ll oo = /*2 * 1000 * 1000 * 1000*/0x3f3f3f3f;
const int _cnt = 1000 * 1000;
const int _p = 1000 * 1000 * 1000 + 7;
//const int _p = 1007;
ll o(ll x) { return x%_p; }
int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }
//ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
int lcm(int a, int b) { return a / gcd(a, b)*b; }
using namespace std;

void file_put() {
    freopen("filename.in", "r", stdin);
    freopen("filename.out", "w", stdout);
}

int x,y;

int _find(int k){
	if (k==2) return 2;
	if (k==4 || k==6 || k==9 || k==11) return 3;
	return 1;
} 

int main() {
    //file_put();
    
    scanf("%d%d",&x,&y);
    if (_find(x)==_find(y)) printf("Yes\n"); else printf("No\n"); 

    return 0;
}


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

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

void init(){
  for(int i=0;i<55;i++)for(int j=0;j<55;j++)d[i][j]=0;
}

void Delete(int sx,int sy,int h,int w){
  queue<int>que;
  que.push(sx);que.push(sy);
  while(que.size()){
    int x=que.front();que.pop();
    int y=que.front();que.pop();
    for(int i=0;i<8;i++){
      if(d[y+dy[i]][x+dx[i]]==1&&0<=y+dy[i]&&y+dy[i]<h&&0<=x+dx[i]&&x+dx[i]<w){
	d[y+dy[i]][x+dx[i]]=0;
	que.push(x+dx[i]);
	que.push(y+dy[i]);
      }
    }
  }
}

int solve(int w,int h){
  int cnt=0;
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      if(d[i][j]==1){
	Delete(j,i,h,w);
	cnt++;
      }
    }
  }
  return cnt;
}

int main(){
  int w,h;
  while(1){
    cin>>w>>h;
    if(w==0&&h==0)break;
    init();
    for(int i=0;i<h;i++)for(int j=0;j<w;j++)cin>>d[i][j];
    cout<<solve(w,h)<<endl;
  }
}

Measured memory_bytes: 3116
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>
#include<stack>

using namespace std;

typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<string> vstring;

template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
int in() { int x; scanf("%d", &x); return x; }

#define rep(i,n) for(int i=0;i<(n);++i)
#define rep0(i,n) for(i=0;i<(n);++i)
#define repn(i,m,n) for(int i=(m);i<=(n);++i)
#define all(n) n.begin(),n.end()
#define mp make_pair
#define PUTLINE cout<<"LINE:"<<__LINE__<<endl;

const int INF = 2147483647;
const double EPS = 1e-10;
const double PI = acos(-1.0);

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

int cost[11][11];
struct Edge{int to,from,cost;};

vector<Edge> edge;
vector<int> town;

int main() {
	int n;
	while(n=in()){
		edge.clear();
		town.clear();
		rep(i,n){
			Edge e;
			cin>>e.from>>e.to>>e.cost;
			edge.push_back(e);
			swap(e.from,e.to);
			edge.push_back(e);
		}
		rep(i,edge.size()){
			int j;
			rep0(j,town.size())if(town[j]==edge[i].from)break;
			if(j==town.size())town.push_back(edge[i].from);
		}
		rep(j,edge.size()){
			rep(i,town.size()){
				if(edge[j].from==town[i]){
					edge[j].from=i;
					break;
				}
			}
			rep(i,town.size()){
				if(edge[j].to==town[i]){
					edge[j].to=i;
					break;
				}
			}
		}
		rep(i,town.size())rep(j,town.size())cost[i][j]=INF/3;
		rep(i,town.size())cost[i][i]=0;
		rep(i,edge.size())cost[edge[i].from][edge[i].to]=edge[i].cost;
		rep(k,town.size())rep(i,town.size())rep(j,town.size()){
			chmin(cost[i][j],cost[i][k]+cost[k][j]);
		}
		int res=INF/3,rest;
		rep(i,town.size()){
			int r=0;
			rep(j,town.size()){
				r+=cost[i][j];
			}
			if(res>r){
				res=r;
				rest=i;
			}
		}
		cout<<town[rest]<<" "<<res<<endl;
	}
	return 0;
}

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

#A
def A():
    a,b = LI()
    print(math.ceil((a+b)/2))

#B
def B():
    s = S()
    t = S()
    s.sort()
    t.sort()
    t = t[::-1]
    l = [s,t]
    l.sort()
    if s == t:
        print("No")
    elif l[0] == s:
        print("Yes")
    else:
        print("No")
#C
def C():
    return

#D
def D():
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

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


Measured memory_bytes: 39024
//--https://kenkoooo.com/atcoder/#/table/soma62jp


#include <iostream>
#include <string>
#include <cmath>
#include <sstream>
#include <iomanip>

using namespace std;

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

	string S[2];

	cin >> S[0];
	cin >> S[1];

	cout << ((S[0][2]==S[1][0] && S[0][1]==S[1][1] && S[0][0]==S[1][2]) ? "YES" : "NO" ) << endl;

	return 0;

}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <numeric>
#include <iomanip>
#include <tuple>

using namespace std;
string s[2005];
int l[2005][2005];
int r[2005][2005];
int u[2005][2005];
int d[2005][2005];

int main(){
   int h,w;
   cin>>h>>w;
   for(int i=0;i<h;i++)cin>>s[i];

   for(int i=0;i<h;i++){
      if(s[i][0]=='.')l[i][0]=1;
      for(int j=1;j<w;j++){
         if(s[i][j]=='.')l[i][j]=l[i][j-1]+1;
         else l[i][j]=0;
      }
   }
   
   for(int i=0;i<h;i++){
      if(s[i][w-1]=='.')r[i][w-1]=1;
      for(int j=w-2;j>=0;j--){
         if(s[i][j]=='.')r[i][j]=r[i][j+1]+1;
         else r[i][j]=0;
      }
   }
   
   for(int i=0;i<w;i++){
      if(s[0][i]=='.')u[0][i]=1;
      for(int j=1;j<h;j++){
         if(s[j][i]=='.')u[j][i]=u[j-1][i]+1;
         else u[j][i]=0;
      }
   }
   
   for(int i=0;i<w;i++){
      if(s[h-1][i]=='.')d[h-1][i]=1;
      for(int j=h-2;j>=0;j--){
         if(s[j][i]=='.')d[j][i]=d[j+1][i]+1;
         else d[j][i]=0;
      }
   }
   
   int ans=0;
   for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){
         int sum=0;
         sum+=l[i][j]+r[i][j]+u[i][j]+d[i][j];
         ans=max(ans,sum-3);
      }
   }
   
   cout<<ans<<endl;
   
   
}

   


Measured memory_bytes: 69120
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <tuple>
#include <queue>
#include <bitset>
#include <unordered_map>
#include <tuple>
#include <utility>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <sys/time.h>

using namespace std;

void solve(string s){
  long long n = s.size();
  if (s[n-1] == '1') {
    std::cout << -1 << std::endl;
    return;
  }
  if (s[0] == '0') {
    std::cout << -1 << std::endl;
    return;
  }
  for (int i = 0; i < n-1; i++) {
    if (s[i] != s[n-2-i]) {
      std::cout << -1 << std::endl;
      return;
    }
  }
  long long u = 1;
  long long v = 2;
  for (int i = 0; i < n-1; i++) {
    if (s[i] == '0') {
      std::cout << u << " " << v << std::endl;
      v++;
    } else {
      std::cout << u << " " << v << std::endl;
      u = v;
      v++;
    }
  }
}

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


Measured memory_bytes: 1664
#include<cstdio>
#include<vector>
#include<algorithm>

using namespace std;

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


int main(void)
{
	int n;

	while(scanf("%d", &n)==1)
	{
		vi v(n);

		for(int i=0;i<n;i++) scanf("%d", &v[i]);

		sort(v.begin(), v.end());

		double ans=v[0];

		for(int i=1;i<n;i++)
		{
			ans=(ans+v[i])*0.5;
		}
		printf("%.8f\n", ans);
	}
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    char s[4];
    char t[4];
	int count = 0;
	
	scanf("%s", s);
	scanf("%s", t);
	
	if(s[0] == t[0]){
			count++;
	}
	if(s[1] == t[1]){
			count++;
	}
	if(s[2] == t[2]){
			count++;
	}
	
	
	printf("%d" , count);
  
    return 0;
}

Measured memory_bytes: 128
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
#define INF 9223372036854775807
#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define RFOR(i,a,b) for(long long i = (b-1);i>=a;i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<P> Graph;

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

  int n;
  cin >> n;
  ll fsum[n+1],bsum[n+1];
  ll sum = 0;
  
  priority_queue <int,vector<int>,greater<int>>f;
  priority_queue <int>b;
  vector <int>a(3*n);
  REP(i,3*n){
    cin >> a[i];
  }
  
  REP(i,n){
    f.push(a[i]);
    sum += a[i];
  }
  fsum[0] = sum;
  
  REP(i,n){
    f.push(a[n+i]);
    sum += a[n+i]-f.top();
    fsum[i+1] = sum;
    f.pop();
  }
  
  sum = 0;
  
  FOR(i,2*n,3*n){
    b.push(a[i]);
    sum += a[i];
  }
  bsum[n] = sum;
  
  REP(i,n){
    b.push(a[2*n-1-i]);
    sum += a[2*n-1-i]-b.top();
    bsum[n-i-1] = sum;
    b.pop();
  }

  ll ans = -INF;
  REP(i,n+1){
    ans = max(ans,fsum[i]-bsum[i]);
 //   cout << fsum[i] << " " << bsum[i] << endl;
  }
  
  cout << ans << endl;

  return 0;
}

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

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int,int>;
#define rep(i,n) for(ll i = 0;i < (ll)n;i++)
#define ALL(x) (x).begin(),(x).end()
#define MOD 1000000007



int main(){
  
  int n,k;
  cin >> n >> k;
  vector<ll> a(n);
  rep(i,n)cin >> a[i];
  vector<ll> s(n+1,0);
  rep(i,n)s[i+1] = s[i]+a[i];
  vector<ll> v;
  rep(i,n)for(int j = i;j < n;j++)v.push_back(s[j+1]-s[i]);
  ll res = 0;
  for(ll i = 60;i >= 0;i--){
    vector<ll> u;
    rep(j,v.size())if(v[j] >> i & 1)u.push_back(v[j]);
    if(u.size() >= k){
      res += (1ll << i);
      v = u;
    }
  }
  cout << res << endl;






  return 0;
}

Measured memory_bytes: 6388
abcd=input()
a=int(abcd[0])
b=int(abcd[1])
c=int(abcd[2])
d=int(abcd[3])
ans=0

if a+b+c+d==7:
  print(a,"+",b,"+",c,"+",d,"=7",sep="")
elif a+b+c-d==7:
  print(a,"+",b,"+",c,"-",d,"=7",sep="")
elif a+b-c+d==7:
  print(a,"+",b,"-",c,"+",d,"=7",sep="")
elif a+b-c-d==7:
  print(a,"+",b,"-",c,"-",d,"=7",sep="")
elif a-b+c+d==7:
  print(a,"-",b,"+",c,"+",d,"=7",sep="")
elif a-b+c-d==7:
  print(a,"-",b,"+",c,"-",d,"=7",sep="")
elif a-b-c+d==7:
  print(a,"-",b,"-",c,"+",d,"=7",sep="")
elif a-b-c-d==7:
  print(a,"-",b,"-",c,"-",d,"=7",sep="")


Measured memory_bytes: 3192
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
 
int main(){
    int n;
    cin>>n;
    int ans=0;
    for (int i = 1; i < n+1; i++)
    {
        if(i%2!=0){
            int count=0;
            for (int j = 1; j < n+1; j++)
            {
                if(i%j==0)count+=1;
            }
            if(count==8)ans+=1;
        }
    }
    cout<<ans;
    return 0;
}

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

const int MAX = 1000010;
const int MOD = 1000000007;

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

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}


int main() {
    COMinit();
    long long X, Y; cin >> X >> Y;

    if ((X + Y) % 3 != 0) {
        cout << 0 << endl;
        return 0;
    }

    // i => (2, 1), j => (1, 2)
    long long sum = 0;
    for (int i = 0; i <= X / 2; i++) {
        int j = X - i * 2;
        if (j * 2 + i == Y) sum += COM(i + j, i);
    }

    cout << sum << endl;
}



Measured memory_bytes: 23808
#include<stdio.h>
int main()
{
  int r,g,b;
    
    scanf("%d %d %d",&r,&g,&b);
      
    if((r*100+g*10+b)%4==0){
      printf("YES");
    }
    else{
      printf("NO");
    }
  return 0;
}
    

Measured memory_bytes: 128
n=int(input())
s=input()
count=0
if n%2==1:
    print("No")
else:
    for i in range(int(n/2)):
        if s[i]!=s[i+int(n/2)]:
            print("No")
            break
        count+=1
    if count==int(n/2):
        print("Yes")

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

int main(){
    int n,l;
    cin >> n >> l;
    vector<int> v(n);
    int total = 0;
    rep(i,n) {
        v.at(i) = i + l;
        total += v.at(i);
    }
    int d = INF;
    rep(i,n) d = min(d,abs(v.at(i)));
    int ans = total >= 0 ? total - d : total + d;
    cout << ans << endl; 
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
bool IsEvenString(const string& s, int len)
{
    if (len % 2 != 0)
    {
        return false;
    }

    const int halfLen = len / 2;
    rep(i, 0, halfLen)
    {
        if (s[i] != s[halfLen + i])
        {
            return false;
        }
    }
    return true;
}

void _main()
{
    string S;
    cin >> S;
    rrep(len, S.length() - 1, 0)
    {
        if (IsEvenString(S, len))
        {
            cout << len << endl;
            return;
        }
    }
}


Measured memory_bytes: 256
/*
power code taken from geeks for geeks
*/

#include <bits/stdc++.h>
#define MODD 1000000007LL
#define MAX 1000000000LL
#define MAX_N 100001
using namespace std;
typedef long long ll;
typedef long double ld;
ll max(ll a,ll b){return a>b?a:b;}
ll min(ll a,ll b){return a<b?a:b;}
double max(double a,double b){return a>b?a:b;}
double min(double a,double b){return a<b?a:b;}

ll modd(ll a){if(a<0LL) return a*-1LL;return a;}
double modd(double a){if(a<0.0) return a*-1.0;return a;}

ll modulo(ll a){return a % MODD; }

ll power(ll k, ll p){
    if (p == 0)
        return 1LL;
 
    ll P = power(k, p/2LL);
    P = (P * P) % MODD;
 
    if (p % 2 == 1)
        P = (P * k) % MODD;
 
    return P;
}

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

bool comp(ll a, ll b){
    return a>b;
}


void solve(){
    ll k;
    cin>>k;
    bool visited[MAX_N]={0};
    priority_queue<ll, vector<ll>, greater<ll>> pq;
    for(ll i=1;i<=9;i++){
        pq.push(i);
        visited[i]=1;
    }
    ll cnt=k;
    ll no=1;
    while(cnt>0){
        
        cnt--;
        no=pq.top();
        pq.pop();
        if(cnt==0){
            break;
        }
        // cout<<"no "<<no<<endl;

        ll lastDig=no%10;

        // cout<<"ld "<<lastDig<<endl;
        
        ll l=(no*10)+lastDig+1;
        if(lastDig!=9){
            pq.push(l);
        }

        l=(no*10)+lastDig;
        pq.push(l);
        
        ll r=(no*10)+lastDig-1;
        if(lastDig!=0){
            pq.push(r);
        }
    }
    cout<<no<<endl;

}
int main(){



    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

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

    return 0;
}


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

int n,ac,wa,tle,re;
string s;

int main()
{
    scanf("%d",&n);
    while(n--) {
        cin>>s;
        if(s=="AC") ac++;
        else if(s=="WA") wa++;
        else if(s=="TLE") tle++;
        else re++;
    }
    printf("AC x %d\n",ac);
    printf("WA x %d\n",wa);
    printf("TLE x %d\n",tle);
    printf("RE x %d\n",re);
}

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

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

#define INF 1 << 29
#define REP(i,n) for(ll i=0; i<(int)(n); i++)
#define FOR(i,k,n) for(ll i=(k);i<(int)(n);i++)



vector<bool> gen_sosuu(vector<bool> sosuu){
  int size = sosuu.size();
  REP(i,size){
    sosuu[i] = true;
  }
  sosuu[0] = false;
  sosuu[1] = false;
  sosuu[2] = true;
  FOR(i,2,sqrt(size)+1){
    if(sosuu[i] == false) continue;
    for(int j = 2; i*j<size;j++){
      sosuu[i*j] =false;
    }
  }
  return sosuu;
}

int a,b,c,d;

int main(){
  cin >> a>> b>>c>>d;
  cout << min(a,b) + min(c,d) <<endl;
}


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

int main(){
  int n,k,tmp, total = 0;
  cin >> n >> k;
  int l[n];
  for(int i=0;i<n;i++){
    cin >> l[i];
  }

  for (int i=0; i<n; i++) {
    for (int j=i+1; j<n; j++) {
      if (l[i] < l[j]) {
        tmp =  l[i];
        l[i] = l[j];
        l[j] = tmp;
      }
    }
  }

  for(int i=0;i<k;i++){
     total += l[i];
  }

  cout << total << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
const int INF=1e9,MOD=1e9+7;
const long long LINF=1e18;
using namespace std;
#define int long long
//template
int f(int a,int b){
  int res=0;
  if(a>b)swap(a,b);
  res+=b/a*a;
  if(b%a)res+=f(b%a,a);
  return res;
}
//main
signed main(){
  int N,X;cin>>N>>X;
  int a=X,b=N-X;
  cout<<f(a,b)*3<<endl;
}


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

#define rep(a,b) for(int a = 0;a < b;a++)
#define REP(i, x, n) for(int i = x; i < n; i++)
#define P(a) cout << a << endl
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define ssort(v) sort(v.begin(),v.end())
#define rev(v) reverse(v.begin(),v.end())
#define vP(v) for(int i = 0;i < v.size();i++){cout << v[i];if(i != v.size()-1)cout << endl;}
#define vcin(v,n) rep(i,n){int a;cin >> a;v.pb(a);}

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
int dx[] = { 1, -1 , 0 , 0 };
int dy[] = { 0,  0,  1, -1 };
ll MOD = 1000000007;

void solve(){
	int a,b,c;
	cin >> a >> b >> c;
	if(a <= c and c <= b){
		P("Yes");
	}else{
		P("No");
	}

}

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


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

using namespace std;

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

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

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

ll n, q, s, t;

struct RSQ
{
	ll gt;
	ll seg[201000 * 2];
	void init(int n) {
		gt = 1;
		while (gt < n)gt *= 2;
		rep(i, n * 2)seg[i] = 0;
	}
	void update(int k, int x) {
		k += gt - 1;
		seg[k] += x;
		while (k) {
			k = (k - 1) / 2;
			seg[k] += x;
		}
	}
	void update_2(ll k, ll x) {
		k += gt - 1;
		ll tt = seg[k];
		ll h;
		if (seg[k] < 0)h = seg[k] / (-s);
		else h = seg[k] / (-t);
		h += x;
		if (h < 0)seg[k] = h*(-t);
		else seg[k] = h*(-s);
		tt = seg[k] - tt;
		while (k) {
			k = (k - 1) / 2;//???????????????
			seg[k] += x;
		}
	}
	ll query(int a, int b) {
		return query(a, b, 0, 0, gt);
	}
	ll query(int a, int b, int k, int l, int r) {//[a,b)???????????????,k=0,l=0,r=gt
		if (r <= a || b <= l)return 0;
		if (a <= l&&r <= b) {
			return seg[k];
		}
		else return query(a, b, k * 2 + 1, l, (l + r) / 2)
			+ query(a, b, k * 2 + 2, (l + r) / 2, r);
	}
	void print() {
		rep(i, 2 * gt)cout << "!" << i << " " << seg[i] << endl;
	}
};

RSQ rsq;

int main() {
	cin >> n >> q;
	rsq.init(n + 1);
	rep(i, q) {
		int a, b, c;
		cin >> a >> b >> c;
		b--;
		if (a == 0) {
			rsq.update(b, c);
		}
		else {
			cout << rsq.query(b, c) << endl;
		}
	}
}

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

int main() {
  int N;
  cin >> N;
  
  if ((N / 1000) == ((N % 1000) / 100) && (N / 1000) == (((N % 1000) % 100) / 10)) {
    cout << "Yes" << endl;
  }
  
  else if (((N % 1000) / 100) == (((N % 1000) % 100) / 10) && ((N % 1000) / 100) == ((((N % 1000) % 100) % 10))) {
    cout << "Yes" << endl;
  }
  
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>

using namespace std;
typedef long long ll;
int T,a[15],dp[15];
int main(){
	scanf("%d",&T);
	while(T--){
		memset(dp,0,sizeof(dp));
		for(int i=1;i<=10;i++) scanf("%d",&a[i]);
		for(int i=1;i<=10;i++){
			*lower_bound(dp+1,dp+11,a[i],greater<int>()) = a[i];
		}
		if(dp[3] != 0) puts("NO");
		else puts("YES");
	}
	return 0;
}


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

int main() {
    long long int a,b,c,k;
    std::cin >> a >> b >> c;
    std::cin >> k;
    long long int m = std::max({a,b,c});
    long long int m2 = m;
    for (int i = 0; i < k; i++) {
        m *= 2;
    }
    std::cout << a + b + c - m2 + m << std::endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
class Main {
	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			String exp = sc.next();
			String real = sc.next();
			int count = 0;
			for (int i = 0; i < 3; i++) {
				if (exp.charAt(i) == real.charAt(i)) {
					count++;
				}
			}
			System.out.println(count);
		}
	}
}

Measured memory_bytes: 23124