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

int x, y, z, k, cnt;
vector<long long> A, B, C;


int main(void){
    // Your code here!
    cin >> x >> y >> z >> k;
    A.resize(x);
    B.resize(y);
    C.resize(z);
    vector<long long> AB(x*y);
    vector<long long> ABC(k*z);
    
    for(int i = 0; i < x; i++) cin >> A[i];
    for(int i = 0; i < y; i++) cin >> B[i];
    for(int i = 0; i < z; i++) cin >> C[i];
    
    
    sort(A.begin(), A.end(), greater<long long>());
    sort(B.begin(), B.end(),greater<long long>());
    sort(C.begin(), C.end(),greater<long long>());

    cnt = 0;
    for(int i = 0; i < x; i++){
        for(int j = 0; j < y; j++){
            AB[cnt++] = A[i]+B[j];
        }
    }
    
    sort(AB.begin(), AB.end(), greater<long long>());
    
    cnt = 0;
    int smaller = k;
    if(x*y < smaller){
        smaller = x*y;
    }
    
    for(int i = 0; i < smaller; i++){
        for(int j = 0; j < z; j++){
            ABC[cnt++] = AB[i] + C[j];
        }
    }
    
    sort(ABC.begin(), ABC.end(), greater<long long>());
    for(int i = 0; i < k; i++){
        cout << ABC[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 31616
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define FOR(i, a, b) for (int i = a; i < (b + a); i++)
#define W1 while (1)
#define COUT(x) cout << x << endl
using namespace std;
using ll = long long;
using ld = long double;
#define ALL(x) x.begin(),x.end()
#define P pair<int,int>
#define mod 1000000007
#define PB push_back
#define F first
#define S second

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) {
    cin >> a[i];
  }
  string ans = "APPROVED";
  rep(i, n) {
    if (a[i] % 2 == 0 && (a[i] % 3 != 0 && a[i] % 5 != 0)) {
      ans = "DENIED";
      break;
    }
  }
  COUT(ans);

  return 0;
}


Measured memory_bytes: 3612
from collections import deque
import sys
input = sys.stdin.readline

N, D, A = map(int, input().split())
XH = [tuple(map(int, input().split())) for _ in range(N)]
XH.sort()

ans = 0
cnt = 0
que = deque()

for x, h in XH:
    while que and que[0][0] <= x:
        cnt -= que.popleft()[1]

    h -= cnt * A

    if h <= 0:
        continue

    ness = -(-h // A)
    cnt += ness
    ans += ness
    que.append((x + 2 * D + 1, ness))

print(ans)


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

using namespace std;

const int VMAX = 10000;

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

  int n;
  unsigned short *A, *B;
  int C[VMAX + 1] = {};

  cin >> n;
  A = new unsigned short[n + 1];
  B = new unsigned short[n + 1];

  for (int i = 1; i <= n; ++i)
    cin >> A[i];

  for (int i = 1; i <= n; ++i)
    ++C[A[i]];

  for (int i = 1; i <= VMAX; ++i)
    C[i] += C[i - 1];

  for (int i = n; i > 0; --i) {
    B[C[A[i]]] = A[i];
    --C[A[i]];
  }

  for (int i = 1; i <= n; ++i) {
    cout << B[i];
    if (i == n) cout << "\n";
    else cout << " ";
  }

  delete[] A;
  delete[] B;
}




Measured memory_bytes: 10604
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cmath>
using namespace std;
using ll = long long;

constexpr int P = 1000000007;

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

    int n;
    cin >> n;

    int p[60] = {};

    for (int i = 0; i < n; i++) {
        ll a;
        cin >> a;

        for (int k = 0; a > 0; k++) {
            if (a & 1) p[k]++;
            a >>= 1;
        }
    }

    ll r = 0;
    for (int k = 0; k < 60; k++) {
        r += (1LL << k) % P * p[k] % P * (n - p[k]) % P;
    }
    r %= P;

    cout << r << endl;

    return 0;
}

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

using namespace std;

int main(void) {
    int N;
    cin >> N;
    vector<int64_t> v(100001);
    int64_t ans = 0;
    for(int i=0; i<N; i++) {
        int A;
        cin >> A;
        ans += A;
        v[A]++;
    }

    int Q;
    cin >> Q;
    while(Q--) {
        int B, C;
        cin >> B >> C;
        ans += C*v[B] - B*v[B];
        v[C] += v[B];
        v[B] = 0;
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 4052
n = int(input())
t, a = map(int, input().split())
h = list(map(int, input().split()))
gap = float("inf")
for i in range(n):
	if abs(t - h[i] * 0.006 - a) < gap:
		ans = i + 1
		gap = abs(t - h[i] * 0.006 - a)
print(ans)

Measured memory_bytes: 3060
n=int(input())
l=list(map(int,input().split()))
s=[0]*n
s[0]=l[0]
for i in range(1,n):
    s[i]=s[i-1]+l[i]
ans=1e10
su=sum(l)
for i in range(n):
    ans=min(ans,abs((su-s[i])-s[i]))
print(ans)

Measured memory_bytes: 38384
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
template<class T,class U> inline bool chmin(T&x,U y){if(x>y){x=y;return true;}return false;}
template<class T,class U> inline bool chmax(T&x,U y){if(x<y){x=y;return true;}return false;}
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n,ans=INT_MAX;
    cin>>n;
    string s;
    cin>>s;
    vector<int> a(n+1);
    fr(i,n) a[i+1]=a[i]+(s[i]=='W');
    fr(i,n+1){
        chmin(ans,max(a[i],n-i-a[n]+a[i]));
    }
    cout<<ans<<'\n';
}

Measured memory_bytes: 4388
n = int(input())
c = input()

w = 0
r = c.count('R')
i = 0
ans = max(w, r)
while i <= n - 1:
    if c[i] == 'W':
        w += 1
    else:
        r -= 1
    ans = min(ans, max(w, r))
    i += 1
print(ans)

Measured memory_bytes: 9352
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e12;

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    string youbi[7] = {"mon", "tue", "wed", "thu", "fri", "sat", "sun"};
    int d;
    cin >> d;
    cout << youbi[((5 + d - 9) % 7 + 7) % 7] << endl;
}

Measured memory_bytes: 3224
/**
 *      purpose : 
 *      author  : kyomukyomupurin
 *      created : 
**/

// input/output
#include <iostream>
#include <fstream>
#include <sstream>
// container class
#include <array>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
// math, algorithm
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
// etc
#include <bitset>
#include <cctype>
#include <cstring>
#include <chrono>
#include <iomanip>
#include <random>
#include <utility>
// using-directive
using namespace std;
// alias template
using int64 = int64_t;
using pii = pair<int, int>;
using pll = pair<int64_t, int64_t>;
// text macro replacement
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define print(x) cout << (x) << '\n'
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define fi first
#define se second

const int64 INF = 1e18;

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

  int a, b, q; cin >> a >> b >> q;
  int64 s[a + 2], t[b + 2];

  s[0] = -1 * INF; t[0] = -1 * INF; s[a + 1] = INF; t[b + 1] = INF;

  for (int i = 1; i <= a; ++i) cin >> s[i];
  for (int i = 1; i <= b; ++i) cin >> t[i];

  for (int i = 0; i < q; ++i){
    int64 x; cin >> x;
    auto pos1 = lower_bound(s, s + a + 2, x);
    auto pos2 = lower_bound(t, t + b + 2, x);

    // *pos1, *(pos1 - 1), *pos2, *(pos2 - 1)
    int64 ans = min({max(*pos1 - x, *pos2 - x), 
		     max(x - *(pos1 - 1), x - *(pos2 - 1)),
		     2 * (*pos1 - x) + x - *(pos2 - 1),
		     *pos1 - x + 2 * (x - *(pos2 - 1)),
		     2 * (*pos2 - x) + x - *(pos1 - 1),
		     *pos2 - x + 2 * (x - *(pos1 - 1))}); 
    print(ans);
  }

  
  return 0;
}


Measured memory_bytes: 2944
package main

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

var N, K, cnt int

func main() {
	fmt.Scan(&N, &K)
	reader := bufio.NewScanner(os.Stdin)
	reader.Split(bufio.ScanWords)

	x := make(SortBy, N)
	for i := 0; i < N; i++ {
		x[i] = make([]int, 2)
	}

	for i := 0; i < N; i++ {
		reader.Scan()
		a, _ := strconv.Atoi(reader.Text())
		reader.Scan()
		b, _ := strconv.Atoi(reader.Text())

		x[i] = []int{a, b}
	}

	sort.Sort(x)

	var a, b int
	for _, m := range x {
		if K <= cnt {
			fmt.Println(a)
			return
		}
		a, b = m[0], m[1]
		cnt += b
	}

	fmt.Println(x[len(x)-1][0])
}

/*  ----------------------------------------  */

func gcd(x, y uint64) uint64 {
	if x%y == 0 {
		return y
	} else {
		r := x % y
		return gcd(y, r)
	}
}

func combination(x, y int) int {
	return permutation(x, y) / permutation(y, y)
}

func permutation(x, y int) int {
	var ans int = 1
	for i := x - y; 0 < i; i-- {
		ans *= i
	}
	return ans
}

func max(x ...int) int {
	var res int = x[0]
	for i := 1; i < len(x); i++ {
		res = int(math.Max(float64(x[i]), float64(res)))
	}
	return res
}

func min(x ...int) int {
	var res int = x[0]
	for i := 1; i < len(x); i++ {
		res = int(math.Min(float64(x[i]), float64(res)))
	}
	return res
}

func pow(x, y int) uint64 { return uint64(math.Pow(float64(x), float64(y))) }
func abs(x int) int       { return int(math.Abs(float64(x))) }
func floor(x int) int     { return int(math.Floor(float64(x))) }

type si struct {
	s int
	i int
}

type SortBy [][]int

func (a SortBy) Len() int           { return len(a) }
func (a SortBy) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
func (a SortBy) Less(i, j int) bool { return a[i][0] < a[j][0] }


Measured memory_bytes: 7936
import sys
import itertools

sys.setrecursionlimit(10 ** 8)
ni = lambda: int(sys.stdin.readline())
nm = lambda: map(int, sys.stdin.readline().split())
nl = lambda: list(nm())
ns = lambda: sys.stdin.readline().rstrip()

N = ni()
MOD = 10 ** 9 + 7
AGCT3 = ["".join(x) for x in itertools.product("AGCT", repeat=3)]
M = 64
blacklist3 = {"AGC", "ACG", "GAC"}


def solve():
    dp = [[0] * M for _ in range(N + 1)]
    for i in range(M):
        if AGCT3[i] not in blacklist3:
            dp[3][i] = 1
    for i in range(4, N + 1):
        for j in range(M):
            p3 = AGCT3[j]
            if p3 in blacklist3:
                dp[i][j] = 0
                continue
            for k in range(M):
                q3 = AGCT3[k]
                q2 = q3[1:]
                if not p3.startswith(q2):
                    continue
                if p3[1] == "G" and p3[2] == "C" and q3[0] == "A":
                    continue
                if p3[0] == "G" and p3[2] == "C" and q3[0] == "A":
                    continue
                dp[i][j] += dp[i - 1][k]
                dp[i][j] %= MOD
    ans = 0
    for x in dp[N]:
        ans = (ans + x) % MOD
    return ans


print(solve())


Measured memory_bytes: 3304
A=int(input())
B=int(input())
C=int(input())
X=int(input())


result=0

for i in range(0,A+1):
    for j in range(0,B+1):
        for k in range(0,C+1):
            if 500*i+100*j+50*k == X:
                result+=1

print(result)

Measured memory_bytes: 3060
#include<iostream>
#include<iomanip>
#include<cstdlib>
#include<cmath>
#include <algorithm>
#include<string>

using namespace std;

int main(){
    int n=0;
    int k=0;
    cin >> n >> k;
    int p[n];
    int sum=0;
    for(int i=0;i<n;i++){
        cin >> p[i] ;
    }
    sort(p,p+n);
    for(int i=0;i<k;i++){
        sum += p[i];
    }


    cout << sum << endl;

    return 0;
}


Measured memory_bytes: 3588
#include <iostream>
#include <vector>
#include <cstdio>
#include <string>
#include <cmath>
#include <set>
#include <map>
using namespace std;

const int MAX_UF = 210000;
struct UnionFind {
	int size_uf;
	int par[MAX_UF];
	int rank[MAX_UF];
	int size_component[MAX_UF];

	UnionFind(int n = 0) { size_uf = n; for (int i = 0; i < n; ++i) par[i] = i, rank[i] = 0, size_component[i] = 1; }
	void init(int n) { size_uf = n; for (int i = 0; i < n; ++i) par[i] = i, rank[i] = 0, size_component[i] = 1; }
	int root(int x) { return par[x] == x ? x : par[x] = root(par[x]); }
	bool issame(int x, int y) { return root(x) == root(y); }
	int size(int x) { return size_component[root(x)]; }

	void connect(int x, int y) {
		x = root(x), y = root(y);
		int sx = size_component[x], sy = size_component[y];
		if (x == y) return;
		int r;
		if (rank[x] < rank[y]) par[x] = y, r = y;
		else { par[y] = x, r = x; if (rank[x] == rank[y]) ++rank[x]; }
		size_component[r] = sx + sy;
	}
} uf;

int N, M;
vector<int> P;

int main() {
  cin >> N >> M;
  P.resize(N);
  for (int i = 0; i < N; ++i) {
	cin >> P[i];
	--P[i];
  }
  uf.init(N);
  for (int i = 0; i < M; ++i) {
	int x, y;
	cin >> x >> y;
	--x, --y;
	uf.connect(x, y);
  }

  long long res = 0;
  
  map<int,set<int> > perm, index;
  for (int i = 0; i < N; ++i) {
	int r = uf.root(i);
	perm[r].insert(P[i]);
	index[r].insert(i);
  }

  for (map<int,set<int> >::iterator it = perm.begin(); it != perm.end(); ++it) {
	long long tmp = 0;
	int r = it->first;
	set<int> se = it->second;
	for (set<int>::iterator it2 = se.begin(); it2 != se.end(); ++it2) {
	  if (index[r].count(*it2)) ++tmp;
	}
	res += tmp;
  }

  cout << res << endl;
}







  


Measured memory_bytes: 29952
#include <iostream>
using namespace std;
int main(){
  int N;
  cin >> N;
  if(N == 25){
    cout << "Christmas" << endl;
  } else if(N == 24) {
    cout << "Christmas Eve" << endl;
  } else if(N == 23) {
    cout << "Christmas Eve Eve" << endl;
  } else if(N == 22) {
    cout << "Christmas Eve Eve Eve" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
n=input()
lst=map(int,raw_input().split())
minNum=min(lst)
ans=[]
for i in xrange(2,minNum+1):
    for j in lst:
        #print i,j,j%i
        if (j % i) != 0:
            break
    else:
        ans.append(i)

print 1
for i in ans:
    print i

Measured memory_bytes: 4224
#include <cassert>
#include <algorithm>
#include <array>
#include <bitset>
#include <cctype>
#include <cstdint>
#include <cmath>
#include <complex>
#include <chrono>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
#include <random>
#include <memory>
#include <utility>
#include <limits>
#include "limits.h"
 
#define rep(i, a, b) for (long long i = (a); (i) < (b); (i)++)
#define all(i) i.begin(), i.end()
#define debug(...) std::cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

void debug_out(){std::cerr<<std::endl;}

template<typename Head,typename... Tail>
void debug_out(Head h,Tail... t){
  std::cerr<<" "<<h;
  debug_out(t...);
}
 
template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, std::pair<T1, T2> pa) {
  return os << pa.first << " " << pa.second;
}
 
template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (int i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}
 
template<typename T1,typename T2>
inline bool chmax(T1& a,T2 b){return a<b && (a=b,true);}
 
template<typename T1,typename T2>
inline bool chmin(T1& a,T2 b){return a>b && (a=b,true);}
 
long long pow_mod(long long a, long long b, long long mod=-1) {
  if(b==0)return 1;
  if ((a == 0)||(mod!=-1&&(a+mod)%mod==0)) {
    return 0;
  }
  long long x = 1;
  while (b > 0) {
    if (b & 1) {
      x = (mod!=-1)?(x * a) % mod:x*a;
    }
    a = (mod!=-1)?(a * a) % mod:a*a;
    b >>= 1;
  }
  return x;
}

// const long long MOD = 998244353;
const long long MOD = 1e9 + 7;

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

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

  ll n,r;
  std::cin>>n>>r;

  if(n>=10){
    std::cout<<r<<"\n";
  }else{
    std::cout<<r+100*(10-n)<<"\n";
  }

  return 0;
}


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

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

#define rep(i, N) for(int i = 0; i < N; ++i)

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL


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

    int N;
    string s;
    cin >> N >> s;

    vector< vs32 > dp(N + 1, vs32(2, 1e9));
    dp[0][0] = dp[0][1] = 0;

    rep (i, N)
    {
        dp[i + 1][0] = MIN(dp[i][0], dp[i][1]) + (int)(s[i] == '.');
        dp[i + 1][1] = dp[i][1] + (int)(s[i] == '#');
    }

    cout << MIN(dp[N][0], dp[N][1]) << "\n";
    return 0;
}



Measured memory_bytes: 11412
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
#include <vector>
#include <numeric>
#include <map>
#include <cmath>
#include <iomanip>
#include <queue>
using ll =long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vs = vector<string>;

int main() {
    ll N;
    cin >> N;
    vl B(N-1);
    vl A(N);
    for(ll i=0; i<N-1; i++){
        cin >> B.at(i);
    }
    A.at(0) = B.at(0);
    for(int i=1; i<N-1; i++){
        A.at(i) = min(B.at(i-1), B.at(i));
    }
    A.at(N-1) = B.at(N-2);
    ll sum = 0;
    for(int i=0; i<N; i++){
        sum += A.at(i);
    }
    cout << sum << endl;


}

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------


ll A[202020];
vector<vector<int>> V;

ll X,Y;


void out() {
	int i;
	for(i=0;i<=10;i++) cout<<A[i]<<" ";
	cout<<endl;
	cout<<" ";
	for(i=1000;i<=1030;i++) cout<<A[i]<<" ";
	cout<<endl;
	cout<<" ";
	for(i=1100;i<=1130;i++) cout<<A[i]<<" ";
	cout<<endl;
	cout<<" ";
	for(i=1200;i<=1230;i++) cout<<A[i]<<" ";
	cout<<endl;
	cout<<" ";
	for(i=2000;i<=2030;i++) cout<<A[i]<<" ";
	cout<<endl;
	cout<<" ";
	for(i=2100;i<=2130;i++) cout<<A[i]<<" ";
	cout<<endl;
	cout<<" ";
	for(i=2200;i<=2230;i++) cout<<A[i]<<" ";
	cout<<endl;
}


void add(int i,int j,int k) {
	V.push_back({0,i,j,k});
	//cout<<"+ "<<i<<" "<<j<<" "<<k<<endl;
	A[k]=A[i]+A[j];
	//out();
}
void comp(int i,int j,int k) {
	V.push_back({1,i,j,k});
	//cout<<"< "<<i<<" "<<j<<" "<<k<<endl;
	A[k]=(A[i]<A[j]);
	//out();
}

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>X>>Y;
	A[0]=X;
	A[1]=Y;
	// A[3]=X+Y
	add(0,1,3);
	// A[4]=1
	comp(2,3,4);
	// X++,Y++
	add(0,4,0);
	add(1,4,1);
	// A[1000]=1,A[1001]=2,....A[1030]=1<<30
	// A[2000]=1,A[2001]=2,....A[2030]=1<<30
	add(4,1000,1000);
	add(4,2000,2000);
	for(i=1001;i<=1030;i++) add(i-1,i-1,i);
	for(i=2001;i<=2030;i++) add(i-1,i-1,i);
	
	for(x=1000;x<=2000;x+=1000) {
		for(i=x+30;i>=x;i--) {
			// check 2^i<X
			comp(i,x/1000-1,i+100);
			comp(i,x/1000-1,i+200);
			// *2^i
			FOR(j,i-x) add(i+100,i+100,i+100);
			// add
			for(j=x;j<i;j++) add(j,i+100,j);
		}
	}
	
	FOR(x,30) FOR(y,30) {
		add(1200+x,2200+y,5);
		comp(4,5,5);
		FOR(i,x+y) add(5,5,5);
		add(5,2,2);
	}
	
	
	
	assert(A[2]==(X*Y));
	cout<<V.size()<<endl;
	FORR(v,V) {
		cout<<"+<"[v[0]]<<" "<<v[1]<<" "<<v[2]<<" "<<v[3]<<endl;
	}
	
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 5004
package main

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

func main() {
	wscanner := makeWordScanner()
	n := eGetInt(wscanner)
	ds := make([]int, n)
	for i := 0; i < n; i++ {
		ds[i] = eGetInt(wscanner)
	}
	sort.Ints(ds)
	fmt.Println(ds[len(ds)/2] - ds[len(ds)/2-1])
}

////////////////////////////////////////////////////////////////////////////////
// ライブラリ
////////////////////////////////////////////////////////////////////////////////
func makeScanner(maxByte int) *bufio.Scanner {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Buffer(make([]uint8, 0, 8192), maxByte)
	return scanner
}
func makeWordScanner() *bufio.Scanner {
	scanner := makeScanner(8192)
	scanner.Split(bufio.ScanWords)
	return scanner
}
func eGetLine(r *bufio.Scanner) string {
	if r.Scan() {
		return r.Text()
	}
	err := r.Err()
	if err != nil {
		log.Fatal(err)
	}
	// EOF
	return ""
}

func eGetInt(r *bufio.Scanner) int {
	line := eGetLine(r)
	return eAtoi(line)
}
func eGetInt64(r *bufio.Scanner) int64 {
	line := eGetLine(r)
	return eAtoInt64(line)
}
func eGetFields(r *bufio.Scanner) []string {
	line := eGetLine(r)
	return strings.Fields(line)
}
func eGetInts(r *bufio.Scanner) []int {
	fields := eGetFields(r)
	ints := make([]int, len(fields))
	for i := 0; i < len(ints); i++ {
		ints[i] = eAtoi(fields[i])
	}
	return ints
}
func eGetInt64s(r *bufio.Scanner) []int64 {
	fields := eGetFields(r)
	ints := make([]int64, len(fields))
	for i := 0; i < len(ints); i++ {
		ints[i] = eAtoInt64(fields[i])
	}
	return ints
}
func eGetChars(r *bufio.Scanner) []string {
	line := eGetLine(r)
	return strings.Split(line, "")
}
func eAtoi(s string) int {
	n, err := strconv.Atoi(s)
	if err != nil {
		log.Fatal(err)
	}
	return n
}
func eAtoInt64(s string) int64 {
	n, err := strconv.ParseInt(s, 10, 64)
	if err != nil {
		log.Fatal(err)
	}
	return n
}


Measured memory_bytes: 2048
using System;
using System.Collections.Generic;

namespace Project
{
	class MainClass
	{
		public static int n;
		public static int[] A;
		public static void Main(string[] args)
		{
			n = int.Parse(Console.ReadLine());
			string[] s = Console.ReadLine().Split(' ');
			A = new int[n];
			for (int i = 0; i < n; i++)
			{
				A[i] = int.Parse(s[i]);
			}
			int q = int.Parse(Console.ReadLine());
			int[] m = new int[q];
			s = Console.ReadLine().Split(' ');
			for (int i = 0; i < q; i++)
			{
				m[i] = int.Parse(s[i]);
			}
			foreach (int x in m)
			{
				Console.WriteLine(rec(x, 0) ? "yes" : "no");
			}
		}
		public static bool rec(int x, int i)
		{
			if (x == 0)
				return true;
			else if (i > n - 1)
				return false;
			else
			{
				return rec(x, i + 1) || rec(x - A[i], i + 1);
			}
		}
	}
}

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

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

int main() {
  int H, W;
  string S;

  cin >> H >> W;

  char bomb[H][W];

  for(int i=0;i<H;i++){
    cin >> bomb[i];
  }
  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){
      if(bomb[i][j] != '#'){
        int count = 0;
        for(int m = -1; m <= 1; m++){
          for(int n = -1; n <= 1; n++){
            int h = i + m;
            int w = j + n;
            if(0 <= h && h < H && 0 <= w && w < W && bomb[h][w]=='#'){
              count++;
            }
          }
        }
        bomb[i][j] = count + '0';
      }
      cout << bomb[i][j];
    }
    cout << endl;
  }
}



Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f
#include <cstdio>
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>

using namespace std;

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

int tx[] = {0,1,0,-1};
int ty[] = {-1,0,1,0};

static const double EPS = 1e-8;

int main(){
	int n;
	while(~scanf("%d",&n)){
		if(n==0) break;
		int count = 0;
		for(int i=1;i<=n;i++){

			int sum = 0;
			for(int j=i;j<=n;j++){
				sum += j;
				if(sum == n && j!=i) count++;
				if(sum >=n) break;
			}
		}

		printf("%d\n",count);
	}
}

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

typedef long long ll;
typedef unsigned long long ull;

int main()
{
    ll N, K;
    cin >> N >> K;
    ll Ai;
    vector<ll> A;
    for(int i=0;i<N;i++){
        cin >> Ai;
        A.push_back(Ai);
    }
    auto sum = accumulate(A.begin(), A.end(), (ll)0);
    vector<ll> cand;
    for(ll i=1; i*i<=sum; i++){
        if(sum%i==0){
            cand.push_back(i);
            if(i*i!=sum) cand.push_back(sum/i);
        }
    }
    sort(cand.begin(), cand.end(), greater<ll>());

    vector<ll> A2(N, 0);
    vector<ll> A2r(N, 0);
    vector<ll> A2l(N, 0);
    for(auto v : cand){
        for(int i=0;i<N;i++){
            A2[i] = A[i]%v;
        }
        sort(A2.begin(), A2.end());
        A2l[0] = A2[0];
        for(int i=1;i<N;i++){
            A2l[i] = A2l[i-1] + A2[i];
        }
        A2r[N-1] = v - A2[N-1];
        for(int i=N-2;i>=0;i--){
            A2r[i] = A2r[i+1] + (v - A2[i]);
        }
        ll vmin = numeric_limits<ll>::max();
        for(int i=0; i<N-1; i++){
            vmin = min(vmin, max(A2l[i], A2r[i+1]));
        }
        auto count = vmin;

        if(count<=K){
            cout<<v<<endl;
            return 0;
        }
    }

    return 0;
}


Measured memory_bytes: 256
N, K = map(int, input().split())
As = list(map(int, input().split()))

history = {}
cycle = []
pos = 1
isEnd = False
for i in range(2*N):
    if pos in history:
        for j in range(len(cycle)):
            if cycle[j] == pos:
                head = cycle[:j]
                cycle = cycle[j:]
                isEnd = True
                break

    if isEnd:
        break

    history[pos] = 1
    cycle.append(pos)
    pos = As[pos-1]


#print(cycle)

if K < len(head):
    print(head[K])
else:
    mod = (K-len(head)) % len(cycle)
    print(cycle[mod])


Measured memory_bytes: 35528
#include <iostream>
#include <bits/stdc++.h>
#include <string>
#include <math.h>
#include <vector>
using namespace std;
int main(){
    int 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 k; cin>>k;
    for(int i=0;i<50;i++){
      if(i+1==k) cout<<a[i];
    }
    return 0;
}

Measured memory_bytes: 256
function Main(stdin) {
  var inputs = stdin.split(' ');
  var a = inputs[0];
  var b = inputs[1];
  var c = a * b;
  if (c % 2 === 1) {
    console.log('Odd');
  } else {
    console.log('Even');
  }
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7880
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(int)(n); i++)
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
template<class T> inline bool chmin(T& a, T b){if (a>b){a = b; return true;}return false;}
template<class T> inline bool chmax(T& a, T b){if (a<b){a = b; return true;}return false;}

void chmin(int &a, int &b){if (a>b){a = b; return;}return;}
void chmax(int &a, int &b){if (a<b){a = b; return;}return;}


const ll MOD = 1000000007;
const ll INF = 9999999999;

int main() {
  int n,K; cin >>n >>K;
  vector<int> h(n);
  for (int i=0; i<n; i++) cin >>h.at(i);
  vector<int> dp(n+2, 1500000000);
  dp.at(0) = 0;
  for (int i=0; i<n-1; i++){
    for (int j=1; j<=K; j++){
      if (i+j >= n) break;
      chmin(dp.at(i+j), dp.at(i) + abs(h.at(i) - h.at(i+j)));
    }
  }
  cout <<dp.at(n-1) <<endl;
}

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

using namespace std;

typedef long long ll;

int main()
{
	std::ios::sync_with_stdio(false);
    cin.tie(0);
    ll x;
    cin >> x;
    ll ans = 0;
	ans = x/11 * 2;
	if(x%11>0) ans++;
	if(x%11>6) ans++;
    cout << ans << "\n";
    
	return 0;
}


Measured memory_bytes: 256
// In the name of God

#include <bits/stdc++.h>

using namespace std;

const int N = 1005;

int n;
map<pair<int,int>, vector<pair<int,int>> > adj;
map<pair<int,int>, int> indeg;
map<pair<int,int>, int> day;

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0);
	cin >> n;
	pair<int,int> last;
	for(int i=0;i<n;i++) {
		for(int j=0;j<n-1;j++) {
			int x;
			cin >> x;
			x--;
			pair<int,int> now = make_pair(min(i, x), max(i, x));
			if(j) {
				adj[last].push_back(now);
				indeg[now]++;
			}
			last = now;
		}
	}
	int del = 0;
	vector<pair<int,int>> tbr;
	for(int i=0;i<n;i++) {
		for(int j=i+1;j<n;j++) {
			if(indeg[make_pair(i, j)] == 0) tbr.push_back(make_pair(i, j));
		}
	}
	int ans = 0;
	while(tbr.size()) {
		del += tbr.size();
		ans++;
		vector<pair<int,int>> nxttbr;
		for(int i=0;i<tbr.size();i++) {
			pair<int,int> now = tbr[i];
			for(auto &x : adj[now]) {
				indeg[x]--;
				if(indeg[x] == 0) {
					nxttbr.push_back(x);
				}
			}
		}
		tbr = nxttbr;
	}
	if(del != n*(n-1)/2) {
		cout << -1;
		exit(0);
	}
	cout << ans;
	return 0;
}


Measured memory_bytes: 86144
import java.util.*; 
  
public class Main{

    public static int n;

    public static int [] arr = new int[100000];

    public static int [] darr = new int[100000];

    public static int minCostJump(int i){

        if(darr[i] != -1) return darr[i];

        if(i == n-1) return 0;

        if(i > n) return Integer.MAX_VALUE;
        
        if(i+2 < n)
        return darr[i] = Math.min(minCostJump(i + 1) + Math.abs(arr[i] - arr[i+1]), minCostJump(i + 2) + Math.abs(arr[i] - arr[i+2]));

        return darr[i] = minCostJump(i + 1) + Math.abs(arr[i] - arr[i+1]);
    } 

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

        for(int i = 0; i < n; i++){
            arr[i] = in.nextInt();
            darr[i] = -1;
        }

        int jumps = minCostJump(0);

        System.out.println(jumps);
    }

} 

Measured memory_bytes: 63540
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  int b[n];
  int ans = 0;
  for(int i=0;i<n;i++){
    cin >> b[i];
  }
  int min=0;
  for(int i=0;i<n-2;i++){
    if(b[i]>b[i+1]){
      min = b[i+1];
    }else{
      min = b[i];
    }
    ans += min;
  }
  cout << ans+b[0]+b[n-2] << endl;
  return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define MOD 1000000007
#define inf 0x3f3f3f3f
#define pi acos(-1.0)
#define ri register int
#define Max(x, y) (((x) > (y)) ? (x) : (y))
#define Min(x, y) (((x) < (y)) ? (x) : (y))
#define Abs(x) ((x) < 0 ? (-(x)) : (x))
#define int long long
const int maxn = 1e3 + 10;
inline int read()
{
    int f = 1, r = 0;
    char c = getchar();
    while (!isdigit(c)) {
        if (c == '-') {
            f = -1;
        }
        c = getchar();
    }
    while (isdigit(c)) {
        r = 10 * r + c - '0';
        c = getchar();
    }
    return f * r;
}
inline void write(int x)
{
    if (x < 0)
        putchar('-'), x = -x;
    if (x > 9)
        write(x / 10);
    putchar(x % 10 + '0');
}
inline void writesp(int x) { write(x), putchar(' '); }
inline void writeln(int x) { write(x), puts(""); }

signed main()
{
    std::string s;
    std::cin >> s;
    std::vector<int> vec;
    for (ri i = 0; i < s.size(); ++i) {
        if (s[i] == '0') {
            vec.push_back(0);
        } else if (s[i] == '1') {
            vec.push_back(1);
        } else if (!vec.empty()) {
            vec.pop_back();
        }
    }
    for (int i = 0; i < vec.size(); ++i) {
        write(vec[i]);
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef std::pair<int,int> ipair;
bool lessPair(const ipair& l, const ipair& r){return l.second < r.second;}
bool greaterPair(const ipair& l, const ipair& r){return l.second > r.second;}

int main(){
    int n,ans=0;
    cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    
    std::vector<ipair> y;
    for(unsigned int i = 0; i < a.size(); i++){
        y.push_back(ipair(i, a[i]));
    }
    //部分ソート、値の上位2位までは並び替え
    partial_sort(y.begin(), y.end(), y.end(), lessPair);
    //インデックス・値の出力
    for(vector<ipair>::iterator it = y.begin(); it != y.end(); ++it){
        cout << it->first+1<<" ";
    }
    cout<<endl;
    return 0;


}

Measured memory_bytes: 2164
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int r = sc.nextInt();
        double x = r;
        double y = 2;
            double ans = Math.pow(x, y);
            int c = (int)ans*3;
            System.out.println(c);
    }
}

Measured memory_bytes: 23636
#include<stdio.h>

int x[100000];
int i;

int main(void){
	
	for(i=1;i<=100000;i++){
		scanf("%d",&x[i]);
		if(x[i] == 0){
			break;
		}
	}
	
	for(i=1;i<=100000;i++){
		printf("Case %d: %d\n",i,x[i]);
		if(x[i+1] == 0){
			break;
		}
	}
		return 0;
	}
	

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

using namespace std;
using ll =std::int_fast32_t;

#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=ll(b);i--)
#define FORA(i,I) for(const auto& i:I)
map<ll,ll> prime;

void prime_factorize(ll n){
    if(n<=1) return;
    ll l=sqrt(n);
    FOR(i,2,l){
        if(n%i==0){
        prime_factorize(i);prime_factorize(ll(n/i));return;
        }
    }
    prime[n]++;return;
}
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  ll N;
  cin >> N;
  ll count{0};

  for (ll C = N - 1; C >= 1; --C)
  {
    ll i;
    prime_factorize(N - C);
    ll tmp = 1;
    for (const auto f : prime)
    {
      tmp *= f.second + 1;
    }
    prime.clear();
    count += tmp;
  }
  cout << count << endl;

  return 0;
}


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

#define _USE_MATH_DEFINES
#define reb(i,b,n)         for(int i=(int)(b); i<(int)(n); i++)
#define rep(i,n)           reb(i,0,n)
#define each(it,v)         for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define reach(it,v)        for(__typeof((v).rbegin()) it=(v).rbegin();it!=(v).rend();it++)
#define vsort(v)           sort((x).begin(), (x).end()
#define rvsort(v)          sort((x).rbegin(), (x).rend()
#define mp(a, b)           make_pair(a, b)
#define fi                 first
#define se                 second
#define pb                 push_back
#define dbg(x)             cerr<<__LINE__<<": "<<#x<<" = ["<<(x)<<"]"<<endl;
#define dbgArr(table, n)   rep(i,n){cout<<table[i]<<' ';}cout<<'\n';
#define dbg2Arr(table,W,H) rep(y,H){rep(x,W)cout<<table[y][x]<<' ';cout<<'\n';}

using namespace std; using std::stringstream;

typedef long long       ll; typedef unsigned long long ull; typedef long double     ld;
typedef pair <int, int> P;  typedef pair <int, P>      PP;
typedef vector<int>     vi; typedef vector<vi>         vvi; typedef vector<ll>      vl;
typedef vector<P >      vP; typedef vector<char>       vc;  typedef vector<string>  vs;

static const int    INF  = 0x3f3f3f3f;
static const ll     INFL = 0x3f3f3f3f3f3f3f3fLL;
static const double EPS  = 1e-9;
static const ll     MOD  = 1000000007LL;

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

int main(int argc, char *argv[])
{
    string S;
    cin >> S;

    int ans=0;
    int acgt_length = 0;
    rep(i, S.size()) {
        if (S[i] == 'A' || S[i] == 'C' || S[i] == 'G' || S[i] == 'T') {
            acgt_length++;

        } else {
            ans = max(ans, acgt_length);
            acgt_length = 0;
        }
    }

    ans = max(ans, acgt_length);
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cstring>
#include <set>
#include <map>

using namespace std;

#define x first
#define y second
#define mp make_pair
#define pb push_back

typedef long long ll;

const ll MOD = 1e9+7;
const int INF = 1e9;

ll n, x, y;
ll a[100005];

map <ll, int> M;
set <ll> s;

int ok[100005][2];
int nxt[100005][2];

int memo[100005];

int dp(int pos) {
	if (pos == n) return 1;
	if (memo[pos] != -1) return memo[pos];
	int sol = 0;
	if (nxt[pos][0] != INF) sol += dp(nxt[pos][0]);
	if (nxt[pos][1] != INF) sol += dp(nxt[pos][1]);
	return memo[pos] = sol % MOD;
}

int main() {
	memset(memo, -1, sizeof memo);
	scanf("%lld%lld%lld", &n, &x, &y);
	if (x > y) swap(x, y);
	for (int i=0 ; i<n ; i++) {
		scanf("%lld", a+i);
		nxt[i][0] = n;
		nxt[i][1] = n;
		M[a[i]] = i;
		s.insert(a[i]);
	}
	ok[n-1][0] = ok[n-1][1] = 1;
	for (int i=n-2 ; i>=0 ; i--) {
		if (a[i]+x <= a[i+1]) 
			ok[i][0] = ok[i+1][0] + 1;
		else 
			ok[i][0] = 1;
		if (a[i]+y <= a[i+1])
			ok[i][1] = ok[i+1][1] + 1;
		else
			ok[i][1] = 1;
	}
	nxt[n][0] = nxt[n][1] = n;
	for (int i=n-2 ; i>=0 ; i--) {
		// nxt x
		int ind;
		set <ll> :: iterator it = s.lower_bound(a[i] + x);
		if (it == s.end()) ind = n;
		else ind = M[*it];
		int ud = ind - i;
		if (ud == 1) nxt[i][0] = i+1;
		else if (ok[i+1][1] >= ud) nxt[i][0] = ind;
		else if (ok[i+1][1] == ud-1) nxt[i][0] = max(nxt[ind][0], nxt[ind-1][1]);
		else nxt[i][0] = INF;
		// nxt y
		it = s.lower_bound(a[i] + y);
		if (it == s.end()) ind = n;
		else ind = M[*it];
		ud = ind - i;
		/*cout <<"ud = "<<ud<<endl;
		if (it!=s.end()) cout <<"a["<<i<<"] = "<<a[i]<<"   next = "<<*it<<endl;*/
		if (ud == 1) nxt[i][1] = i+1;
		else if (ok[i+1][0] >= ud) nxt[i][1] = ind;
		else if (ok[i+1][0] == ud-1) nxt[i][1] = max(nxt[ind][1], nxt[ind-1][0]);
		else nxt[i][1] = INF;
	}
	/*for (int i=0 ; i<n ; i++) cout <<nxt[i][0]<<' ';
	cout <<"\n";
	for (int i=0 ; i<n ; i++) cout <<nxt[i][1]<<' ';
	cout <<"\n";*/
	printf("%d\n", dp(0));
	return 0;
}

Measured memory_bytes: 17024
#include <bits/stdc++.h>
using namespace std;
#define REP(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) REP(i, 0, n)
#define rrep(i, n) for (int i = (int)(n-1); i >= 0; i--)
#define sz(x) int(x.size())
#define bitsz(x) int(__builtin_popcount(x))
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb(x) push_back(x)
#define INF 1e9
#define LINF 1e18
#define mod 1000000007
template<class T> inline bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b) { if (a > b) { a = b; return 1; } return 0; }
template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); };
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
const int di[4] = {1,0,-1,0};
const int dj[4] = {0,1,0,-1};



int main() {
    string s,t; cin >> s >> t;
    int n = sz(s);
    bool check = true;
    rep(i,n) {
        if (s[i]!=t[i]) check = false;
    }
    if (check) cout << "Yes" << endl;
    else cout << "No" << endl;

}

Measured memory_bytes: 3632
#include<iostream>
#include <cstring>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;


int main(){
  int a, b, c; cin >> a >> b >> c;
  if(a+b+c>=22) cout << "bust" << endl;
  else cout << "win" << endl;
 }

Measured memory_bytes: 256
class UnionFind
  attr :id, :rank

  def initialize(n)
    @id   = (0..n).to_a
    @rank = Array.new(n,0)
  end

  def root(i)
    if @id[i] == i or i == @id[@id[i]]
      i
    else
      @id[i] = root(@id[i])
      @id[i]
    end
  end

  # find, check if p and q has the same root
  def same?(p, q)
    root(p) == root(q)
  end

  # union, to merge components containing p and q
  # set id of p's root to the id of q's root
  def unite(p, q)

    i = root(p)
    j = root(q)

    return if i == j

    if @rank[i] < @rank[j]
      @id[i] = j
    else
      @id[j] = i;
      @rank[i]+=1  if @rank[i] == @rank[j]
    end
  end
end

def get_hash_key(a, b)
  a << 32 | b
end

lines = $stdin.read

array = lines.split("\n")
N,K,L = array[0].split(" ").map(&:to_i)

ufpq = UnionFind.new(N+1)
ufrs = UnionFind.new(N+1)

array[1..K].each do |str|
  pi,qi = str.split(" ").map(&:to_i)
  ufpq.unite(pi,qi)
end

array[K+1..K+L+1].each do |str|
  ri,si = str.split(" ").map(&:to_i)
  ufrs.unite(ri,si)
end

m = {}

(1..N).each do |n|
  rpq = ufpq.root(n)
  rrs = ufrs.root(n)
  key = get_hash_key(rpq,rrs)
  if m.has_key?(key)
    m[key] += 1
  else
    m[key] = 1
  end
end

(1..N).each do |n|
  rpq = ufpq.root(n)
  rrs = ufrs.root(n)
  key = get_hash_key(rpq,rrs)
  puts m[key]
end

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

int main(){
    int n;
    cin>>n;
    vector<int> dp(n+1,0);
    vector<pair<int,int> > A(n);
    string ans="No";
    for(int i=0; i<n; i++){
        cin>>A[i].first>>A[i].second;
    }

    for(int i=1; i<=n; i++){
        if(A[i-1].first == A[i-1].second) {
            dp[i] = dp[i-1]+1;
        }
        else dp[i]=0;
        if(dp[i]>=3) {
            ans = "Yes";
            break;
        }
    }

    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 3628
/*input
1
1

*/
 
/*
                                                    ______________
                                                          |       )
                                                          |   )   /
                                                          |______/
                                                    |     |      \
                                                    |     |   )   \
                                                    |_____|_______)
 
*/
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <iomanip>
#include <fstream>
#include <stack>

using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PII;
typedef pair<ll , ll> PLL;
typedef long double ld;
 
#define pb push_back
#define all(c) c.begin(),c.end()
#define allr(c) c.rbegin(),c.rend()
int mod = 1000000007;
const int inf = 1034567891;
const ll LL_INF = 1234567890123456789ll;
#define PI 3.14159265
#define endl '\n'
#define F first
#define S second
#define debug(x) cout << #x << " = " << x << endl;
#define TRACE
 
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
 
#define out(container) for (auto it : container) cout << it << " "; cout << endl;
 
 
template < typename T > T GCD(T a, T b)            { ll t; while(a) { t = a; a = b % a; b = t; } return b; }
template < typename T > string toString(T a)       { return to_string(a); }
template < typename T > void toInt(string s, T &x) { stringstream str(s); str >> x;}
inline int add(int x, int y){ x += y; if(x >= mod) x -= mod; return x;}
inline int sub(int x, int y){ x -= y; if(x < 0) x += mod; return x;}
inline int mul(int x, int y){ return (x * 1ll * y) % mod;}
inline int powr(int a, ll b){
  int x = 1 % mod;
  while(b){
    if(b & 1) x = mul(x, a);
    a = mul(a, a);
    b >>= 1;
  }
  return x;
}
inline int inv(int a){ return powr(a, mod - 2);}

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  
  int n;
  cin >> n;
  int d = n / 1000;
  int r = n % 1000;
  int ans = (d + (r > 0)) * 1000 - n;
  cout << ans << endl;  

  return 0;
}

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

int main() {
  int A, B;
  cin >> A >> B;
  if(A == 1){
    A=14;
  }
  if(B == 1){
    B=14;
  }
  if(A > B){
    cout << "Alice" << endl;
  }
  else if(A < B){
    cout << "Bob" << endl;
  }
  else {
    cout << "Draw" << endl;
  }
}

Measured memory_bytes: 256
def func(a,b,x):
    return ((a*x)/b)//1-a*((x/b)//1)

a,b,n = map(int,input().split())
x = min(b-1,n)

print(int(func(a,b,x)))

# tp = 0
# for i in range(1,n+1):
#     tpp = func(a,b,i)
#     if tpp > tp:
#         tp = tpp
# print(tp)

Measured memory_bytes: 9172
a, b, c, d = map(int, input().split())

if abs(a-c) <= d:
    print('Yes')
elif abs(a-b) <= d and abs(b-c) <= d:
    print('Yes')
else:
    print('No')

# aとcが直接的もしくはbとcが直接的だと成り立つ
# or構文に変更
# aとbが直接的、かつbとcが直接的の条件が抜けてた


Measured memory_bytes: 9108
#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;

int main(){
    int n;
    cin >> n;
    vector<int> p(n);
    rep(i,n) cin >> p.at(i);
    int ans = 0;
    int min_num = p.at(0);
    rep(i,n){
        if(p.at(i) <= min_num){
            ans++;
            min_num = p.at(i);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3988
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#define all(a) a.begin(),a.end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define pb push_back
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef long double ld;
typedef complex<ld> com;
constexpr int inf = 1000000000;
constexpr ll INF = 1000000000000000000;
constexpr ld EPS = 1e-12;
constexpr ld PI = 3.141592653589793238;
template<class T, class U> inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return true; } return false; }
template<class T, class U> inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return true; } return false; }


signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);
	
	int n;
	cin >> n;
	vector<double> v(n);
	rep(i, n) cin >> v[i];
	priority_queue<double, vector<double>, greater<double>> que;
	rep(i, n) que.push(v[i]);
	while (que.size() > 1) {
		double x = que.top(); que.pop();
		double y = que.top(); que.pop();
		que.push((x + y) / 2);
	}
	cout << que.top() << '\n';
}

Measured memory_bytes: 256
#include <iostream>

int main(){
	using namespace std;
	int i,j=0;
	string s,t ;
	cin >> s >> t;
	for (i = 0; i < 3;i++) {
		if (s[i] == t[i]) {
			j++;
		}
	}
	cout << j << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
const int INF = 2147483647;//int max
const int MOD = 1000000007;
using namespace std;
using ll = long long;
using P = pair<int,int>;


int main() {
    int n;
    cin >> n;
    vector<ll> num;
    rep(i,n+1){
        if(i == 0)num.push_back(2);
        else if(i == 1)num.push_back(1);
        else{
            num.push_back(num[i-1]+num[i-2]);
        }
    }
    cout << num.back() << endl;
    return 0;
}
/*
やっほい！
　　　　　　　やほほい！
　　　　+　　 　*
　　　 ∧∧　　. ∧∞∧　*
*　ヽ(=´ω｀)人(´ω｀*)ﾉ
　.～（ O x.） （ 　 O)～　+
。*　 　∪　　　　∪
*/

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

int32_t main()
{
	int h;
	cin>>h;
	
	int depth=0,o=0;
	while (h>0){
		int hoh = pow(2,o);
		h-=hoh;
		o++;
		depth++;
	}
	
	int ans=0;
	for (int i=0;i<depth;i++){
		ans+=pow(2,i);
	}
	cout<<ans;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s,t,u;
  int a,b;
  
  cin >> s >> t >> a >> b >> u;
  
  if(u==s)
    a = a-1; 
  else
    b = b-1;
  
  cout << a << " " <<  b ;
  
}

Measured memory_bytes: 256