akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<typeinfo>
#include<vector>
#include<algorithm>
#include<map>
#include<iomanip>
typedef long long int ll;
using namespace std;
int main()
{
	int a,b;
	cin >> a >> b;
  	cout << a-b+1 << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<list>
#include<vector>
#include<algorithm>
#include<string>
#include<stdio.h>
#include<math.h>
#include<unordered_map>
#include<map>

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using lst = list<ll>;


int main()
{
	ll K;
	cin >> K;

	int N = 50;

	cout << N << endl;

	for (int i = 0; i < N; ++i)
	{
		ll a = N - 1;
		a -= K;
		a += (K / N)*(N + 1);
		if (i < K%N)
		{
			a += N + 1;
		}
		cout << a << " ";
	}

	cout << endl;

	return 0;
}

Measured memory_bytes: 256
n = gets.to_i
a = gets.split.map(&:to_i)
q = gets.to_i
bc = []
q.times do
  bc << gets.split.map(&:to_i)
end
count = Array.new(10**5){0}
allsum = 0
a.size.times do |i|
  count[a[i] - 1] += 1
  allsum += a[i]
end

rsl = []
q.times do |i|
  b = bc[i][0]
  c = bc[i][1]
  allsum += (c - b) * count[b - 1]
  count[c - 1] += count[b - 1]
  count[b - 1] = 0
  rsl << allsum
end
puts rsl

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

int main() {
    int n;
    cin>>n;
    int c=0;
    int x,y;
    while(n--)
    {
        cin>>x>>y;
        if(x==y)
        c++;
        else
        c=0;
        
        if(c>=3)
        {
            cout<<"Yes"<<endl;
            c=-1;
            break;
        }
    }
    if(c!=-1)
    cout<<"No"<<endl;
	return 0;
}


Measured memory_bytes: 3628
#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<queue>
#include<stack>
#include<list>
#include<map>
#include<deque>
#include<math.h>
using namespace std;
#define ll long long
#define MOD 1000000007
int main(){
    ll a,b;
    cin >> a >> b;
    ll i;
    if(abs(a-b)>1)cout << 0;else{
        ll t=1;
        for(i=1;i<=min(a,b);i++){
            t=t*i%MOD;
        }
        if(a==b)cout << 2*t%MOD*t%MOD;else cout << t*t%MOD*max(a,b)%MOD;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
 
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using vpii = vector<pii>;
using vs = vector<string>;
using vd = vector<double>;
using ul = unsigned long;
 
template<class T, class C> void chmax(T& a, C b){ a>b?:a=b; }
template<class T, class C> void chmin(T& a, C b){ a<b?:a=b; }
 

int main()
{
  cin.tie( 0 );
  ios::sync_with_stdio( false );
  
  int n,m,x;cin>>n>>m>>x;
  vi a(m);
  rep(i,m)cin>>a[i];
  int cost=0;
  rep(i,m){
    if(a[i]>x)break;
    cost++;
  }
  if(cost>m-cost)cost=m-cost;
  cout(cost);
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
ll Q=1000000007;

int main(){
  int N;
  cin >> N;
  vector<ll> H(N,0);
  for(int i=0;i<N;i++){
    cin >> H[i];
  }
  vector<ll> C(N+2,0);
  C[0]=0;
  C[1]=abs(H[0]-H[1]);
  for(int i=2;i<N;i++){
    C[i]=min(C[i-1]+abs(H[i]-H[i-1]),C[i-2]+abs(H[i]-H[i-2]));
  }
  cout << C[N-1] << endl;
}

Measured memory_bytes: 1792
N = int(input())
a = list(map(int, input().split()))

ans = 1

for i in range(N):
    ans = ans*3

even = 0
for i in a:
    if i%2==0:
        even += 1

miss = 1
for i in range(even):
    miss = miss*2

print(ans-miss)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>

using namespace std;

#define int long long
#define endl '\n'
#define maxn 100010
const int MOD = 1000000007;
using int32 = __uint32_t;

void solve() {
    string s;
    cin >> s;

    for(int i = 0; i < s.size(); i++){
        int ct= 0;
        for(int j = i; j <= i + 3 - 1 and j < s.size(); j++){
            if(s[i] == s[j])ct++;
        }
        if(ct == 3){
            cout << "Yes";
            return;
        }
    }
cout << "No";
}

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

    int t = 1;
//    cin >> t;

    while (t--)
        solve();
    return 0;
}


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

int main(){
    ll H,W;
    cin >> H >> W;
    vector<vector<char>> A(H,vector<char>(W));
    map<char,ll> mp;
    rep(i,H){
        rep(j,W){
            cin >> A[i][j];
            mp[A[i][j]]++;
        }
    }
    ll cnt4 = 0;
    ll cnt2 = 0;
    ll cnto = 0;
    for(auto& p:mp){
        if(p.second >= 4){
            cnt4 += p.second/4;
            p.second %= 4;
        }
        if(p.second >= 2){
            cnt2 += p.second / 2;
            p.second %= 2;
        }
        if(p.second % 2 == 1){
            cnto++;
        }
    }
    ll four = (H/2) * (W/2);
    ll two = H*(W%2) + W*(H%2);// - (H%2) - (W%2);
    ll odd;
    if(H%2 && W%2)odd = 1;else odd = 0;
    two -= odd;
    two /= 2;

    //cout << cnt4 <<" "<<cnt2 <<" "<< cnto <<endl;
    //cout << four <<" "<<two <<" "<< odd <<endl;

    if(cnt4 >= four){
        cnt2 += (cnt4 - four)*2;
        if(cnt2 >= two){
            cout << "Yes"<<endl;
            return 0;
        }
    }
    cout << "No" << endl;
/*
    if(cnt <= min(H,W)){
        cout << "Yes" << endl;
    }else{
    }
*/
}


Measured memory_bytes: 256
##mod,nについての制約は自分でいかに記入する
mod=10**9+7
def find_power(n,mod):
    # 0!からn!までのびっくりを出してくれる関数(ただし、modで割った値に対してである）
    powlist=[0]*(n+1)
    powlist[0]=1
    powlist[1]=1
    for i in range(2,n+1):
        powlist[i]=powlist[i-1]*i%(mod)
    return powlist
 #あるかずxのn乗をmodで割ったあまりを返す関数pow_cal(x,n,mod)
def pow_cal(x,n,mod):
    if n==0:
         return 1
    elif n==1:
         return x%mod
    elif n>=2:
        if n%2==0:
             return (pow_cal(x,n//2,mod)**2)%mod
        else:
             return (x*pow_cal(x,n//2,mod)**2)%mod

def find_inv_power(n,mod):
    #0!からn!までの逆元を素数modで割ったあまりリストを作る関数
    c=1
    uselist=[0 for i in range(n+1)]
    for i in range(1,n+1):
        c*=i
        c%=mod
    first=pow_cal(c,mod-2,mod)
    uselist[n]=first
    for i in range(n,0,-1):
        uselist[i-1]=(uselist[i]*i)%(mod)
    return uselist
    
A=find_power(4*10**5,mod)
B=find_inv_power(4*10**5,mod)

def combi(n,r,mod):
    if n<r:
        return 0
    elif n>=r:
        return (A[n]*B[r]*B[n-r])%(mod)

    
M,N,K=map(int,input().split())
ans=M*N*(M+N)*(M*N-1)//6

print(ans*combi(M*N-2,K-2,mod)%mod)



Measured memory_bytes: 34776
#ライブラリインポート
from collections import defaultdict

con = 10 ** 9 + 7
#入力受け取り
def getlist():
	return list(map(int, input().split()))

#処理内容
def main():
	S = input()
	N = len(S)
	print("x" * N)


if __name__ == '__main__':
	main()

Measured memory_bytes: 38620
import sys
import math
import collections
import bisect
import copy
import itertools

# import numpy as np

sys.setrecursionlimit(10 ** 7)
INF = 10 ** 16
MOD = 10 ** 9 + 7
# MOD = 998244353

ni = lambda: int(sys.stdin.readline().rstrip())
ns = lambda: map(int, sys.stdin.readline().rstrip().split())
na = lambda: list(map(int, sys.stdin.readline().rstrip().split()))
na1 = lambda: list(map(lambda x: int(x) - 1, sys.stdin.readline().rstrip().split()))


# ===CODE===

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


def main():
    n, m = ns()
    p = na1()

    uf = UnionFind(n)

    for _ in range(m):
        x, y = ns()
        uf.union(x - 1, y - 1)

    ans = 0
    for i, pi in enumerate(p):
        if uf.same(i, pi):
            ans += 1

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 92120
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <string>
#include <utility>
#include <map>
using namespace std;
#define rep(i,n) for(int i=1;i<=(int)(n);i++)
#define Rep(i,n) for(int i=0;i<=(int)(n-1);i++)
typedef long long ll;
int dx[]={-1,0,1,0};
int dy[]={0,-1,0,1};
int inf=2020000000;

int N,D,X;
int A[110];

int main() {
	cin>>N>>D>>X;
	Rep(i,N) cin>>A[i];
	int sum =0;
	Rep(i,N) sum+= (1+(D-1)/A[i]);
	cout<<X+sum<<endl;


	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const double eps = 1e-10;
const int MOD = 1000000007;
const ll LINF = 1ll<<50;
template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}
int main() {
    cin.tie(0);
    cout << fixed << setprecision(10);
    int n; cin >> n;
    vector<vector<int>> v(n, vector<int>(3));
    for(int i=0;i<n;++i) {
      cin >> v[i][0] >> v[i][1] >> v[i][2];
    }
    vector<vector<int>> dp(n+1, vector<int>(3));
    dp[0][0] = dp[0][1] = dp[0][2] = 0;
    for(int i=1;i<n+1;++i) {
      dp[i][0] = v[i-1][0] + max(dp[i-1][1], dp[i-1][2]);
      dp[i][1] = v[i-1][1] + max(dp[i-1][2], dp[i-1][0]);
      dp[i][2] = v[i-1][2] + max(dp[i-1][0], dp[i-1][1]);
    }
    cout << max(dp[n][0], max(dp[n][1], dp[n][2])) << endl;
}


Measured memory_bytes: 11136
#include <iostream>
int main(){
int a, b;
char op = '/';
while(1){
std::cin >> a >> op >> b;
if(op=='?'){
break;
}
switch(op){
case '+':
std::cout<< a+b << std::endl;
break;
case '-':
std::cout<<a-b << std::endl;
break;
case '/':
std::cout<<a/b<<std::endl;
break;
case '*':
std::cout<<a*b<<std::endl;


}
}
return 0;
}

Measured memory_bytes: 3068
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    n=INT()
    res=[]
    ac=0
    wa=0
    tl=0
    re=0
    for i in range(n):
        s=STR()
        if s=='AC':
            ac+=1
        elif s=='WA':
            wa+=1
        elif s=='TLE':
            tl+=1
        else:
            re+=1
    print('AC x '+str(ac))
    print('WA x '+str(wa))
    print('TLE x '+str(tl))
    print('RE x '+str(re))
    
if __name__ == '__main__':
    do()

Measured memory_bytes: 9172
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define debug(x) cerr << #x << " : " << x << '\n'

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef string str;
typedef pair<ll, ll> pll;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

const ll Mod = 1000000007LL;
const int Maxn = 1e3 + 10;
const ll Inf = 2242545357980376863LL;
const ll Log = 30;

char c[Maxn][Maxn];
ll x = 0, y = 0;
void solve3(){
	c[x][y] = 'a';
	c[x][y + 1] = 'a';
	c[x + 1][y + 2] = 'b';
	c[x + 2][y + 2] = 'b';
	x += 3, y += 3;
}
str s4[] = {"aabc",
			"ddbc",
			"efgg",
			"efhh"};
void solve4(){
	for(int i = 0; i < 4; i++){
		for(int j = 0; j < 4; j++)
			c[x + i][y + j] = s4[i][j];
	}
	x += 4; y += 4;
}

str s5[] = {"aabbc",
			"h.iic",
			"hj..d",
			"gj..d",
			"gffee"};
void solve5(){
	for(int i = 0; i < 5; i++){
		for(int j = 0; j < 5; j++)
			c[x + i][y + j] = s5[i][j];
	}
	x += 5;
	y += 5;
}

str s7[] = {"aabb..c",
			".kk..qc",
			"...llqd",
			"h.p...d",
			"hop....",
			"go..tt.",
			"g..eeff"};
void solve7(){
	for(int i = 0; i < 7; i++){
		for(int j = 0; j < 7; j++)
			c[x + i][y + j] = s7[i][j];
	}
	x += 7;
	y += 7;
}

int main(){
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	ll n;
	cin >> n;
	if(n < 3) return cout << -1, 0;
	for(int i = 0; i < n; i++)
	for(int j = 0; j < n; j++) c[i][j] = '.';
	
	if(n % 3 == 0){
		for(int i = 0; i < n/3; i++) solve3();
	} else {
		if(n % 4 == 1) solve5();
		if(n % 4 == 2) solve5(), solve5();
		if(n % 4 == 3) solve7();
		while(x < n) solve4();
	}
	
	for(int i = 0; i < n; i++){
		for(int j = 0; j < n; j++) cout << c[i][j];
		cout << '\n';
	}
	return 0;
}




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

int main(){
    // 制約見て！！！デカかったらlong longにすること！
    ll a;
    double b;
    ll b_;
    cin >> a >> b;
    b_ = round(b *100);
    cout << a*b_/100 <<endl;
}

Measured memory_bytes: 3656
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

fn read_vec2<T: std::str::FromStr>(n: usize) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

fn read_col<T: std::str::FromStr>(n: usize) -> Vec<T> {
    (0..n).map(|_| read()).collect()
}

use std::cmp::min;

fn main() {
    let nk: Vec<usize> = read_vec();
    let n = nk[0];
    let k = nk[1];
    let x: Vec<i32> = read_vec();

    let mut ans: u32 = 1000000000;

    for i in 0..(n - k + 1) {
        let tmp;
        if x[i + k - 1] < 0 {
            tmp = -x[i] as u32;
        } else if 0 < x[i] {
            tmp = x[i + k - 1] as u32;
        } else {
            tmp = (x[i + k - 1] - x[i] + min(x[i + k - 1], -x[i])) as u32;
        }

        if tmp < ans {
            ans = tmp;
        }
    }

    println!("{}", ans);
}


Measured memory_bytes: 6396
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

int N, W[105];

int main(void) {

	cin >> N;

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

	int TOTAL = 0;
	for (int i = 1; i <= N; i++) {
		TOTAL += W[i];
	}

	int ans = TOTAL + 1;

	int sum = 0;
	for (int i = 1; i < N; i++) {
		sum += W[i];

		//cout << sum << "  " << TOTAL - sum << endl;
		ans = min(ans, abs(sum - (TOTAL - sum)));
	}

	cout << ans << endl;

	return 0;
}

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

using namespace std;
 
// macro
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define MOD 1000000007
#define M_PI 3.14159265358979323846
#define ll long long
#define ull unsigned long long
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define SORT(ary) sort(begin(ary), end(ary))
#define VL vector<ll>
#define VVL vector<VL>
#define PL pair<ll, ll>
#define VC vector<char>
#define VVC vector<VC>

// Factorial
// need init
ll factorial_memo[5001];
ll factorial(ll n) {
  factorial_memo[0] = 1;
  if(factorial_memo[n] != -1) return factorial_memo[n];
  factorial_memo[n] = (factorial(n-1) * n) % MOD;
  return factorial_memo[n];
}
 
// Combination(nCr)
// need init
ll nCr_memo[5001][5001];
ll nCr(ll n, ll r) {
  if(r*2 > n) r = n-r;
  if(r == 1) return n;
  if(r == 0) return 1;
  if(nCr_memo[n][r] != -1) return nCr_memo[n][r];
  nCr_memo[n][r] = (nCr(n-1, r) + nCr(n-1, r-1)) % MOD;
  return nCr_memo[n][r];
}

ll bridgeDfs(VVL& g, vector<PL>& res, ll v, ll& count, ll from, VL& low, VL& pre) {
  pre[v] = count++;
  low[v] = pre[v];
  for(auto to:g[v]) {
    if (pre[to] == -1) {
      low[v] = min(low[v], bridgeDfs(g, res, to, count, v, low, pre));
      if(low[to] == pre[to]) res.push_back(make_pair(v, to));
    } else {
      if(from == to) continue;
      low[v] = min(low[v], low[to]);
    }
  }
  return low[v];
}

vector<PL> bridges(VVL& g, ll N) {
  vector<PL> res;
  if (N > 0) {
    VL low(N, -1);
    VL pre(N, -1);
    ll count = 0;
    bridgeDfs(g, res, 0, count, -1, low, pre);
  }
  return res;
}

void solve() {
    int N;
    cin >> N;
    ll dec = 1;
    REP(i, N) {
        ll a;
        cin >> a;
        if(a % 2 == 0) dec *= 2;
    }
    cout << pow(3, N) - dec << "\n";
}



int main() {
  // init
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve();
}


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

int main() {
  int N;
  cin >> N;
  vector<string> judge = { "AC", "WA", "TLE", "RE" };
  vector<int> j_cnt = {0, 0, 0, 0};

  rep(i, N) {
    string S;
    cin >> S;
    if (judge[0] == S) j_cnt[0]++;
    else if(judge[1] == S) j_cnt[1]++;
    else if(judge[2] == S) j_cnt[2]++;
    else if(judge[3] == S) j_cnt[3]++;
  }
  rep(i, judge.size()) cout << judge[i] << " x " << j_cnt[i] << '\n';
}

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

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


inline void solve(){

    int n;
    string s;

    cin >> n >> s;

    int len = 0;

    int l = 0, r = 1;
    while( r <= n ) {
        if(s.find(s.substr(l,r-l),r) < n)
            chmax(len,r-l),r++;
        else
            l++,r++;
    }

    cout << len << endl;

}
struct xyz{ xyz(){ cin.tie(0), ios::sync_with_stdio(false); cout <<fixed<<setprecision(12);};}xyzzy;signed main(){solve();return 0;}


Measured memory_bytes: 256
def main():
    n = input()
    #h = [int(i) for i in input().split()]
    n1 = ""
    n2 = ""
    for i in range(len(n)):
        if i % 2 == 0:
            n1 += n[i]
        else:
            n2 += n[i]

    a0 = n1.count("0")
    a1 = n1.count("1")
    b0 = n2.count("0")
    b1 = n2.count("1")

    print(min ( a1 + b0, a0 + b1))
main()

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	//ll rcnt;
	string s,t,ans;
	cin>>s>>t;
	ll arr[s.length()+1][t.length()+1];
	for(int i=0;i<=s.length();i++)
		arr[i][0]=0;
	for(int i=0;i<=t.length();i++)
		arr[0][i]=0;
	for(int i=1;i<=s.length();i++)
	{
		for(int j=1;j<=t.length();j++)
		{
			if(s[i-1]==t[j-1])
			{
				arr[i][j]=arr[i-1][j-1]+1;
			}
			else
				arr[i][j]=max(arr[i-1][j],arr[i][j-1]);
		}
	}
	ll i=s.length(),j=t.length();
	while(i>0 && j>0)
	{
		if(arr[i][j]==arr[i][j-1])
		{
			j=j-1;
		}
		else if(arr[i][j]==arr[i-1][j])
		{
			i=i-1;
		}
		else if(arr[i][j]==arr[i-1][j-1]+1)
		{
			ans=t[j-1]+ans;
			j=j-1;
			i=i-1;
		}
	}
	//cout<<arr[s.length()][t.length()]<<endl;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 70656
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
	int n;
	scanf("%d",&n);
	int a[n],sum=0,max=0;
	for(int i=0;i<n;i++){
		cin>>a[i];
		sum+=a[i];
		if(a[i]>max){
			max=a[i];
		}
	}
	cout<<sum-max/2<<endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;
class Main
{
  public static void main(String args[])
  {
    Scanner sc=new Scanner(System.in);
		String s=sc.next();
		if(s.contains("RRR")) System.out.println("3");
		else if(s.contains("RR")) System.out.println("2");
		else if(s.contains("R")) System.out.println("1");
		else System.out.println("0");
  }
}


Measured memory_bytes: 26972
/// However long the night,
///     The dawn will break
/// ICPC next year

#include<bits/stdc++.h>
using namespace std ;
const int N = 2e5+5 ;

int n ,m ,x ;
int main(){
    scanf("%d%d",&n,&m);
    priority_queue<int> pq ;
    for(int i=0;i<n;++i){
        scanf("%d",&x);
        pq.push(x);
    }
    while(pq.size() && m){
        x = pq.top()/2 ;
        pq.pop() ;
        --m ;
        if(x) pq.push(x) ;
    }
    long long ans = 0 ;
    while(pq.size()){
        ans += pq.top();
        pq.pop();
    }
    cout << ans ;
    return 0;
}


Measured memory_bytes: 892
#include <bits/stdc++.h>
#define PI 3.14159265358979323846
#define MAXINF (1e18L)
#define INF (1e9L)
#define EPS (1e-9)
#define MOD ((ll)(1e9+7))
#define REP(i, n) for(int i=0;i<int(n);++i)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define ALL(v) v.begin(),v.end()
#define FIND(v,x) (binary_search(ALL(v),(x)))
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v));reverse(ALL(v))
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define pb push_back
#define fi first
#define se second
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
template<class T> inline bool chmin(T& a, T b){return a>b ? a=b, true : false;}
template<class T> inline bool chmax(T& a, T b){return a<b ? a=b, true : false;}
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;

int main(void)
{
    ll H;
    cin >> H;
    ll ans = 1;
    ll tmp = 1;
    while(H != 1){
        ans = tmp*2 + ans;
        tmp *= 2;
        H /= 2;
    }

    pr(ans);
}

Measured memory_bytes: 256
from datetime import datetime

S = input()
former = int(S[:2])
latter = int(S[2:])
YYMM = False
MMYY = False

try:
    datetime(former + 2000, latter, 1)
    YYMM = True
except:
    pass

try:
    datetime(latter + 2000, former, 1)
    MMYY = True
except:
    pass

if YYMM and MMYY:
    print("AMBIGUOUS")
elif YYMM:
    print("YYMM")
elif MMYY:
    print("MMYY")
else:
    print("NA")


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

#define int long long
#define fast_io(); ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define loop(i,a,b) for(int i=a;i<b;i++)
#define all(x) x.begin(),x.end()
#define us unordered_set
#define um unordered_map
#define ms multiset
#define mm multimap
#define pb push_back
#define pf push_front
#define ins insert
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define _max max_element
#define _min min_element
#define tc(T) int T; cin>>T; while(T--)
#define q(q) int q; cin>>q; while(q--)
#define pi 3.1415926535897932384626433832
const int pinf=((int)9e18);
const int ninf=((int)-9e18);
const int mod=1000000007;

using namespace std;

int32_t main()
{
    fast_io();

    //FILE *fptr1=freopen("in.txt","r",stdin);
    //FILE *fptr2=freopen("out.txt","w",stdout);


    int n,k;
    cin>>n>>k;
    
    n=ceil(n/2.0);
    
    if(n>=k)
    {
        cout<< "YES";
    }
    else cout<< "NO";

    return 0;
}


Measured memory_bytes: 3756
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int main()
{
    int a,b,n;
    scanf("%d%d%d",&a,&b,&n);
    a=a>b?a:b;
    printf("%d\n",n/a+(n%a==0?0:1));
    return 0;
}


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

int a[105];

int main(void) {
	int N, cost = 0;
	double ave = 0.0;
	cin >> N;
	for (int i = 0; i < N; i++) cin >> a[i];
	for (int i = 0; i < N; i++) ave += a[i];
	//cout << ave << endl;
	ave /= N;
	//cout << ave << endl;
	if (ave - (int)ave != 0 && ave - (int)ave > 0.5) ave++;
	ave = (int)ave;
	//cout << ave << endl;
	for (int i = 0; i < N; i++) cost += (ave - a[i]) * (ave - a[i]);
	cout << cost << endl;
	return 0;
}


Measured memory_bytes: 256
a_1 = list(map(int,input().split(" ")))
a_2 = list(map(int,input().split(" ")))
a_3 = list(map(int,input().split(" ")))
n = int(input())
open_number =[]
for i in range(3):
  open_number.append([0,0,0])
for i in range(n):
  number = int(input())
  for j in range(3):
    if number == a_1[j]:
      open_number[0][j] = 1
    if number == a_2[j]:
      open_number[1][j] = 1
    if number == a_3[j]:
      open_number[2][j] = 1
bingo = False
line_1 = 0
line_2 = 0
line_3 = 0
cross_1 = 0
cross_2 = 0
for i in range(3):
  if not 0 in open_number[i]:
    bingo = True
  if open_number[i][0] == 1:
    line_1 += 1
  if open_number[i][1] == 1:
    line_2 += 1
  if open_number[i][2] == 1:
    line_3 += 1
  if open_number[i][i] == 1:
    cross_1 += 1
  if open_number[2-i][i] == 1:
    cross_2 += 1
  if line_1 == 3:
    bingo = True
  if line_2 == 3:
    bingo = True
  if line_3 == 3:
    bingo = True
  if cross_1 == 3:
    bingo = True
  if cross_2 == 3:
    bingo = True
if bingo:
  print("Yes")
else:
  print("No")

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

int main(){
    char s[200];

    scanf("%s",s);
    int s_len=strlen(s);
    int flg=0;
    for(int i=0;i<s_len;i+=2){
        if(!(s[i]=='R'||s[i]=='U'||s[i]=='D')){
            printf("No\n");
            return 0;
        }
    }
    for(int i=1;i<s_len;i+=2){
        if(!(s[i]=='L'||s[i]=='U'||s[i]=='D')){
            printf("No\n");
            return 0;
        }
    }
    printf("Yes\n");
    return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<bitset>
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)
typedef long long ll;
typedef pair<ll,int> pint;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
int dx[4]={1,0,-1,0} , dy[4]={0,1,0,-1} ;

int n,m;
vector<pint> v[2][101010];
ll a[2][101010],dist[2][101010];

void bfs(int x,int flag){
    priority_queue<pint,vector<pint>,greater<pint>> q;
    dist[flag][x]=0;
    q.push({0LL,x});
    while(q.size()){
        pint p=q.top();q.pop();
        ll d=p.first,now=p.second;
        if(dist[flag][now]<d)continue;
        for(auto to:v[flag][now]){
            if(dist[flag][to.second]>dist[flag][now]+to.first){
                dist[flag][to.second]=dist[flag][now]+to.first;
                q.push({dist[flag][to.second],to.second});
            }
        }
    }
}

int main(){
    cin>>n>>m;
    int s,t;
    cin>>s>>t;
    rep(i,m){
        int x,y;
        cin>>x>>y;
        ll a,b;
        cin>>a>>b;
        x--;y--;
        v[0][x].push_back({a,y});
        v[1][x].push_back({b,y});
        v[0][y].push_back({a,x});
        v[1][y].push_back({b,x});
    }
    rep(i,n)rep(j,2)dist[j][i]=longinf;
    bfs(s-1,0);
    bfs(t-1,1);
    ll ans[n];
    rep(i,n)ans[i]=dist[0][i]+dist[1][i];
    rep(i,n-1)ans[n-i-2]=min(ans[n-i-1],ans[n-i-2]);
  rep(i,n)ans[i]=(ll)1e15-ans[i];
    rep(i,n)printf("%ld\n",ans[i]);
    return 0;
}


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

using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair

int main()
{
	ios::sync_with_stdio(false);
  	cin.tie(0);
	int a,b;
	cin >> a >> b;
	if(a == b)
		cout << "Draw\n";
	else if(a == 1)
		cout << "Alice\n";
	else if(b == 1)	
		cout << "Bob\n";
	else if(a > b)
		cout << "Alice\n";
	else cout << "Bob\n";
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>

inline bool enough(int n, int a, int b, int *h, int times) {
  int damage = ((long long)b * times > 1e9) ? 1e9: b * times;
  for (int i = 0; i < n; i++) {
    if (h[i] > damage)
      times -= (h[i]-damage) / (a-b) + (((h[i]-damage) % (a-b)) ? 1: 0);
    if (times < 0)
      return false;
  }
  return true;
}

int main(void) {
  int n, a, b;
  int h[100000];

  scanf("%d %d %d", &n, &a, &b);
  for (int i = 0; i < n; i++)
    scanf("%d", h+i);

  int head = 0, tail = 1e9;
  while (head < tail) {
    int mid = (head + tail) / 2;
    if (enough(n, a, b, h, mid))
      tail = mid;
    else
      head = mid + 1;
  }

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

Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <numeric>
#include <cmath>
#include <cassert>

using namespace std;

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

#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const ll INF = 1e9;

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

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

	vector<int> ball(n,0);
	for(int i = n-1; i >= 0; i--){
		if(ball[i]%2!=a[i]){
			ball[i]=1;
			ball[0]++;
			for(int j = 2; j * j <= i+1; j++){
				if ((i+1) % j==0){
					ball[j-1]++;
					if (j != (i+1) / j){
						ball[(i+1)/j-1]++;
					}
				}
			}
		}else{
			ball[i] = 0;
		}
	}
	vector<int> ans;
	for (int i = 0; i < n; i++){
		if(ball[i]>0){
			ans.push_back(i+1);
		}
	}
	// cout<<endl;
	cout<<ans.size()<<endl;
	for(auto x: ans){
		cout<<x<<endl;
	}
	return 0;
}

Measured memory_bytes: 3064
N, M, X = map(int, input().split())
A_list = map(int, input().split())

road_list = [0] * (N + 1)
for i in A_list:
    road_list[i] = 1

right = sum(road_list[X:])
left = sum(road_list[:X])
print(min(right, left))


Measured memory_bytes: 3060
#include <stdio.h>

int main(void){
	
	int n_polygon = 0,
		n, i,
		curX, curY, prevX, prevY, firstX, firstY;
	double s;
	
	while(1){
		
		scanf("%d", &n);
		if(n <= 0) break;
		
		s = 0;
		
		scanf("%d%d", &prevX, &prevY);
		firstX = prevX;
		firstY = prevY;
		for(i=0; i<n-1; i++){
			scanf("%d%d", &curX, &curY);
			s += (prevX - curX) * (prevY + curY);
			prevX = curX;
			prevY = curY;
		}
		s += (prevX - firstX) * (prevY + firstY);
		s /= 2;
		
		printf("%d %.1f\n", ++n_polygon, (s<0?-s:s));
		
	}
	
}

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

int main() {
  int N=0;
  int S=0;
  
  cin >> N;
  if(0<N && N<100){
    for(int i=1; i<10; i++){
      for(int j=1; j<10; j++){
        S=i*j;
        if(N==S){
          cout << "Yes" <<endl;
          return 0;
        }
      }
    }
  }
  cout << "No" << endl;
}

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

long long GCD(long long x, long long y){
    if(x<y)swap(x,y);
    if(x%y==0){
        return y;
    }else{
        return GCD(y,x%y);
    }
}
long long num(long long n,long long c,long long d){
    long long G=GCD(c,d);
    long long L=c/G*d;
    return n-n/c-n/d+n/L;
}

int main(){
    long long a,b,c,d;
    cin>>a>>b>>c>>d;
    cout<<num(b,c,d)-num(a-1,c,d)<<endl;
}

Measured memory_bytes: 3572
#include <bits/stdc++.h>
#define int long long
const int INF = 1e18L + 5;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using namespace std;

signed main() {

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

    int a, b, c, k;
    cin >> a >> b >> c >> k;
    int ans = 0;
    if (k >= a){
        ans += a;
        if (k - (a + b) >= 0) ans -= k - (a + b);
        cout << ans << endl;
    }
    else cout << k << endl;
    return 0;
}

Measured memory_bytes: 3648
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vi;
typedef vector<string> vs;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define REPR(i,n) for(int i=n-1;i>=0;i--)
#define FORR(i,n,m) for(int i=n-1;i>=m;i--)
#define all(in) in.begin(),in.end()
#define ALL(in,K) in,in+K
#define INF 1e18
#define MOD 100000007
#define SIZE 10005
#define PI 	3.14159265358979323846

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    int ans=0;
    REP(i,s.size()){
        if(s[i]=='+')ans++;
        if(s[i]=='-')ans--;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#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; }
//---------------------------------------------------------------------------------------------------
struct UnionFind {
    vector<int> par; // uf(x,y)->y
    UnionFind() {}
    UnionFind(int NV) { init(NV); }
    void init(int NV) { par.clear(); rep(i, 0, NV) par.push_back(i); }
    void reset() { rep(i, 0, par.size()) par[i] = i; }
    int operator[](int x) { return par[x] == x ? x : par[x] = operator[](par[x]); }
    void operator()(int x, int y) { x = operator[](x); y = operator[](y); if (x != y) par[x] = y; }
};
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　  |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/







ll K, A, B;
//---------------------------------------------------------------------------------------------------
ll solve() {
    ll have = 1;

    // A枚までは叩く必要がある
    ll a = min(K, A - 1);
    have += a;
    K -= a;
    if (K == 0) return have;

    // なるべく交換する
    if (A + 2 <= B) {
        ll cnt = K / 2;
        have += cnt * (B - A);
        if (K % 2 == 1) have++;
        return have;
    }
    else {
        return have + K;
    }
}
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> K >> A >> B;
    cout << solve() << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define maxn 100005
using namespace std;
int n,m;
int main()
{
	int x,y,l=0,r=maxn;
	scanf("%d %d",&n,&m);
	for(int i=1;i<=m;i++)
	{
		scanf("%d %d",&x,&y);
		l=max(x,l),r=min(y,r);
	}
	if(l>r)printf("0");
	else printf("%d\n",r-l+1);
	return 0;
}

Measured memory_bytes: 3812
#include <bits/stdc++.h>
using namespace std;;
#define rep(i, n) for(int i = 0;i < n;i++)
#define repr(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define INF 1<<30
#define LINF 1LL<<62
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
const int MOD = 1000000007;
 
typedef long long ll;
typedef vector<ll> vl;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n;cin >> n;
  vector<ll> v(n);
  vector<ll> vv(n);
  rep(i,n){
    cin >> v[i];
    vv[i] = v[i];
  }
  sort(all(vv));
  ll f = vv[n/2-1];
  ll s = vv[n/2];
  rep(i,n){
    if(v[i]<=f){
      cout << s << endl;
    }else{
      cout << f << endl;
    }
  }
}

Measured memory_bytes: 5376
package main

import (
  "fmt"
)

func main() {
  var a, b string 
  fmt.Scan(&a, &b)
  
  var ans string 
  if len(a) > len(b) {
    ans = "GREATER"
  } else if len(a) < len(b) {
    ans = "LESS"
  } else {
    if a > b {
      ans = "GREATER"
    } else if a < b {
      ans = "LESS"
    } else {
      ans = "EQUAL"
    }
  }

  fmt.Println(ans)
}

Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstring>
#include <cstdio>
#define LL long long
#define pb push_back
#define mp make_pair
#define INF 0x3f3f3f3f
#define Inf 1000000000000000000LL
#define F first
#define S second
using namespace std;
typedef pair<int,int>pii;
int x[10];
int main(){
	int ans=0;
	for(int i=1;i<=5;i++){
		cin>>x[i];
		if(x[i]==0)ans=i;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 3160
#include <bits/stdc++.h>
using namespace std;
const int INF = 100005;
void chmin(int &a, int b)
{
  a = min(a, b);
}
int main()
{
  int n;
  cin >> n;
  vector<int> dp(n + 1, INF);
  dp[0] = 0;
  int m6, m9;
  m6 = m9 = 1;
  for(int i = 1; i <= n; ++i) {
    chmin(dp[i], dp[i - 1] + 1);
    if (m6*6 <= i) m6 *= 6;
    if (m9*9 <= i) m9 *= 9;
    chmin(dp[i], dp[i - m6] + 1);
    chmin(dp[i], dp[i - m9] + 1);
  }
  cout << dp.back() << endl;
  return 0;
}

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

ll N,Q;
string s;
vector<char> t,d;
//愚直にシミュレーション
//Xが左に落ちないときtrue
bool checkl(ll X){
    rep(i,Q){
        if(t[i] == s[X]){
            if(d[i] == 'R'){
                X++;
            }
            else{
                X--;
            }
        }
        if(X == -1){
            return false;
        }
    }
    return true;
}
//Xが右に落ちないときtrue
bool checkr(ll X){
    rep(i,Q){
        if(t[i] == s[X]){
            if(d[i] == 'R'){
                X++;
            }
            else{
                X--;
            }
            if(X == N){
                return false;
            }
        }
    }
    return true;
}
int main() {
    cin>>N>>Q>>s;
    t.resize(Q);d.resize(Q);
    rep(i,Q){
        cin>>t[i]>>d[i];
    }
    //左に落ちるとき
    ll ng = -1;ll ok = N;
    while(ok - ng > 1){
        ll mid = (ok+ng)/2;
        if(checkl(mid)){
            ok = mid;
        }
        else{
            ng = mid;
        }
    }
    ll l = ok;
    //右に落ちるとき
    ok = -1; ng = N;
    while(ng - ok > 1){
        ll mid = (ok+ng)/2;
        if(checkr(mid)){
            ok = mid;
        }
        else{
            ng = mid;
        }
    }
    ll r = ok;
    //cerr<<l<<" "<<r<<endl;
    cout<<r-l+1<<endl;
}

Measured memory_bytes: 900
#include <bits/stdc++.h>
#define int long long 
#define float long double 
#define el '\n'
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define all(c) (c).begin(),(c).end()

using namespace std;

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
        enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
        ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
        *this << "[";
        for (auto it = d.b; it != d.e; ++it)
                *this << ", " + 2 * (it == d.b) << *it;
        ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

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

	vector<double>dp(n+1);
	dp[0] = 1;

	for(int i=1;i<=n;i++){
		double p ;
		cin >> p ; 
		for(int j = i ; j >= 0 ; j--){
			dp[j] = (j>0?dp[j-1]:0)*p + dp[j]*(1-p);
		}
	}
	cout << fixed << setprecision(10) << accumulate(dp.begin()+(n+1)/2,dp.end(),0.0) << endl ;
        return 0;
}


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

using namespace std;

const int N = 1e6+10;
long long int a[N], b[N], c[N];

int main () {
    long long int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    long long int ans =0;
    for(int i = 0 ; i < n-1 ; i++ ) {
        if(s[i]==s[i+1])
            ans++;
    }
    cout << min(ans+(k*2),n-1);
}


Measured memory_bytes: 512
S = input()

countx = 0
county = 0

for x in range(0, len(S), 2):
    if S[x] != 'R' and S[x] != 'U' and S[x] != 'D':
        countx += 1
   
for y in range(1, len(S), 2):
    if S[y] != 'L' and S[y] != 'U' and S[y] != 'D':
        county += 1
        
print("Yes") if countx == 0 and county ==0 else print("No")
    

Measured memory_bytes: 3060
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i, s, n) for(int i = (s), i##_len=(n); i < i##_len; ++i)
#define FORS(i, s, n) for(int i = (s), i##_len=(n); i <= i##_len; ++i)
#define VFOR(i, s, n) for(int i = (s); i < (n); ++i)
#define VFORS(i, s, n) for(int i = (s); i <= (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) FORS(i, 0, n)
#define VREP(i, n) VFOR(i, 0, n)
#define VREPS(i, n) VFORS(i, 0, n)
#define RFOR(i, s, n) for(int i = (s), i##_len=(n); i >= i##_len; --i)
#define RFORS(i, s, n) for(int i = (s), i##_len=(n); i > i##_len; --i)
#define RREP(i, n) RFOR(i, n, 0)
#define RREPS(i, n) RFORS(i, n, 0)
#define ALL(v) (v).begin(), (v).end()
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v), greater<decltype(v[0])>())
#define SZ(x) ((int)(x).size())
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define BIT(n) (1LL<<(n))
#define UNIQUE(v) v.erase(unique(ALL(v)), v.end())

using ll = long long;
using PII = pair<int, int>;
using VI = vector<int>;
using VD = vector<double>;
using VLL = vector<ll>;
using VS = vector<string>;
using VC = vector<char>;
using VB = vector<bool>;

const int MOD = 1000000007;
const int INF = 1000000000;

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




int main(){
    int n, k; cin >> n >> k;
    VI a(n);
    REP(i, n) cin >> a[i];
    VB dp(k+1, false);
    FORS(i, 1, k){
        REP(j, n){
            if(i >= a[j]) dp[i] = dp[i] | !dp[i - a[j]];
        }
    }
  //  REP(i, k)cout << (dp[i] ? "First\n" : "Second\n");
    cout << (dp[k] ? "First\n" : "Second\n");
    return 0;
}


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


using namespace std;

#define REP(i, n) for(ll i = 0;i < n;i++)
#define REPR(i, n) for(ll i = n;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define FORR(i, m, n) for(ll i = m;i >= n;i--)
#define REPO(i, n) for(ll i = 1;i <= n;i++)
#define ll long long
#define INF 1999999999
#define MINF -1999999999
#define INF64 1999999999999999999
#define ALL(n) n.begin(),n.end()
#define MOD 1000000007

ll n, s[110000], a, b, ans = 0;
int main() {
	cin >> n >> a >> b;
	REP(i, n)cin >> s[i];
	REP(i, n - 1) {
		if (abs(s[i] - s[i + 1]) * a > b) ans += b;
		else ans += abs(s[i] - s[i + 1]) * a;
	}
	cout << ans << endl;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>

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

    std::vector<std::vector<int>> num(10, std::vector<int>(10));
    for (int i = 1; i <= n; i++) {
        std::string s = std::to_string(i);
        int msb = s[0] - '0', lsb = s.back() - '0';
        if (lsb != 0) {
            num[msb][lsb]++;
        }
    }

    int ans = 0;
    for (int i = 1; i < 10; i++) {
        for (int j = 1; j < 10; j++) {
            ans += num[i][j] * num[j][i];
        }
    }

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


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

using namespace std;

char s[200005];
long long ps[200005], pw[200005];

unordered_map <long long, int> cnt;

int main() {
    int n, p;
    scanf("%d%d", &n, &p);
    scanf("%s", s);

    if (p == 2 || p == 5) {
        long long res = 0;
        int cnt = 0;
        for (int i = n - 1; i >= 0; i--) {
            if ((s[i] - '0') % p == 0) cnt++;
            res += cnt;
        }
        return 0 * printf("%lld\n", res);
    }


    pw[0] = 1LL;
    for (int i = 1; i <= n; i++) pw[i] = pw[i - 1] * 10 % p;

    for (int i = n - 1; i >= 0; i--) {
        ps[i] = (pw[n -  1 - i] * (s[i] - '0') + ps[i + 1]) % p;
    }

    long long res = 0;
    cnt[0] = 1;

    for (int i = n - 1; i >= 0; i--) {
        res += cnt[ps[i]];
        cnt[ps[i]]++;
    }

    printf("%lld\n", res);
}


Measured memory_bytes: 7456
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <fstream>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <stack>
#include <vector>
#include <set>
#include <utility>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

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

	string s = to_string(n);

	int sum = 0;
	for(int i = 0;i < s.size();i++){
		sum += (int)(s[i] - '0');
	}

	if(n % sum == 0)cout << "Yes" << endl;
	else cout << "No" << endl;
}


Measured memory_bytes: 256