akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
#if DEBUG
            ReadLine();
#endif
        }
        
        void Solve(ConsoleInput cin)
        {
            String s = cin.Read;
            String keyence = "keyence";

            if(s.StartsWith(keyence) || s.EndsWith(keyence))
            {
                Console.WriteLine("YES");
                return;
            }

            for(int i = 1; i < 7; i++)
            {
                string start = keyence.Substring(0, i);
                string end = keyence.Substring(i, 7 - i);

                if (s.StartsWith(start) && s.EndsWith(end))
                {
                    Console.WriteLine("YES");
                    return;
                }
            }


            Console.WriteLine("NO");
        }

        class ConsoleInput
        {
            private readonly System.IO.TextReader _stream;
            private char _separator = ' ';
            private Queue<string> inputStream;

            public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
            {
                this._separator = separator;
                this._stream = stream;
                inputStream = new Queue<string>();
            }

            public string Read
            {
                get
                {
                    if (inputStream.Count != 0) return inputStream.Dequeue();
                    string[] tmp = _stream.ReadLine().Split(_separator);
                    for (int i = 0; i < tmp.Length; ++i)
                        inputStream.Enqueue(tmp[i]);
                    return inputStream.Dequeue();
                }
            }

            public string ReadLine { get { return _stream.ReadLine(); } }
            public int ReadInt { get { return int.Parse(Read); } }
            public long ReadLong { get { return long.Parse(Read); } }
            public double ReadDouble { get { return double.Parse(Read); } }
            public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
            public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
            public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
        }
    }
}


Measured memory_bytes: 13524
#define _CRT_SECURE_NO_WARNINGS
#include<cstdio>

using namespace std;

int main(){
	long int N, K, ans = 0, i;
	scanf("%ld %ld", &N, &K);

	for (i = K + 1; i <= N; i++){
		if (N%i >= K){
			ans = ans + (N / i)*(i - K) + ((N%i) - K + 1);
		}
		else{
			ans = ans + (N / i)*(i - K);
		}
	}
	if (K == 0){
		printf("%lu\n", N*N);
	}
	else{
		printf("%ld\n", ans);
	}
	return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;
import java.util.List;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String a = sc.next();
    String b = sc.next();
    String c = b.substring(0,a.length());
    String d = b.substring(a.length());
    if ( a.equals(c) && d.length() == 1) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
  }
}
 

Measured memory_bytes: 35756
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vi2 = vector<vector<int>>;
using vb = vector<bool>;
using vb2 = vector<vector<bool>>;
using vc = vector<char>;
using vc2 = vector<vector<char>>;
using vs = vector<string>;
using si = set<int>;
using vs2 = vector<vector<string>>;
using pii = pair<int, int>;
using mii = map<int, int>;
const int INF = 1e9;
const ll LINF = 1e18;
const long double PI = acos(-1.0);
#define MP(a,b) make_pair((a),(b))
#define MT(...) make_tuple(__VA_ARGS__)
#define sz(x) (int)(x).size()
 
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
 
#define ALL(x) (x).begin(),(x).end()
#define SORT(v) sort(ALL(v));
#define IN(type,a) type a;cin >> a;
#define VIN(type,a,n) vector<type> a(n);cin >> a;
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl;
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl;
#define COUT(x) cout << (x) << endl;
#define DCOUT(x,n) cout << fixed << setprecision(n) << (x) << endl;
#define ENDL cout << endl;
#define DB(s,x) cout << (s) << " : " << x << endl;
 
#define HOGE COUT("HOGE")
 
template<typename T>inline istream& operator>>(istream&i,vector<T>&v)
{REP(j,sz(v))i>>v[j];return i;}
 
template<typename T> bool chmax(T& a, const T& b){if(a<b){a=b;return true;}return false;}
template<typename T> bool chmin(T& a, const T& b){if(a>b){a=b;return true;}return false;}
template<typename T> T gcd(T a,T b){if(b==0){return a;}else{return gcd(b, a%b);}}
 
int main() {
    int h,w,k;
    cin >> h >> w >> k;
    vector<vector<bool>> a(h,vector<bool>(w,false));
    REP(i, h){
        REP(j, w){
            IN(char, aja);
            if (aja == '#') {
                a[i][j] = true;
            }
        }
    }
    int ans = 0;
    for (int b = 0; b<(1<<h); b++) {
        for (int t = 0; t<(1<<w); t++) {
            int c = 0;
            REP(i, h){
                REP(j, w){
                    if ((b&(1<<i))&&(t&(1<<j))) {
                        if (a[i][j]) {
                            c++;
                        }
                    }
                }
            }
            if (c==k) {
                ans++;
            }
        }
    }
    COUT(ans)
}


Measured memory_bytes: 3632
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp13 {
    class Program {
        static void Main(string[] args) {
            int N = int.Parse(Console.ReadLine());

            var X = Console.ReadLine().Split(' ').ToArray();

            string S = X[0];
            string T = X[1];

            string ans = "";

            for (int i = 0; i < N; i++) {
                ans += S[i];
                ans += T[i];
            }

            Console.WriteLine(ans);

        }
    }
}


Measured memory_bytes: 11220
fun main() {
    val A = readLine()!!.toInt()
    val B = readLine()!!.toInt()
    val C = readLine()!!.toInt()

    val X = readLine()!!.toInt()

     (0..A).flatMap { a -> (0..B).flatMap { b -> (0..C).map { c ->
        listOf(500 * a, 100 * b, 50 * c)
    }}}.map { it.sum() }.filter { it == X }.count().let {
        println(it)
    }
}


Measured memory_bytes: 65232
from collections import deque


class TPSort:
    """
    トポロジカルソート
    # https://csacademy.com/lesson/topological_sorting/

    # 入次数0のノードから確定し, そのノードから伸びるエッジを削除. を繰り返すことによって DAGのソートをする
    """

    def __init__(self, N):
        self.N = N
        self.indegree = [0] * N  # 入次数
        self.length = [0] * N
        self.edges = [[] for _ in range(N)]

    def add_edge(self, a, b):
        self.edges[a].append(b)
        self.indegree[b] += 1

    def sort(self):
        que = deque([i for i in range(self.N) if self.indegree[i] == 0])

        res = []
        while que:
            n = que.popleft()
            res.append(n)
            for next_n in self.edges[n]:
                self.length[next_n] = max(self.length[next_n], self.length[n] + 1)
                self.indegree[next_n] = self.indegree[next_n] - 1  # 枝刈り
                if self.indegree[next_n] == 0:  # 入次数0なら queue に追加
                    que.append(next_n)
        return res


if __name__ == '__main__':
    n, m = [int(_) for _ in input().split()]
    tp = TPSort(n + 1)

    for i in range(m):
        tp.add_edge(*[int(_) for _ in input().split()])

    tp.sort()
    print(max(tp.length))


Measured memory_bytes: 23860
k = int(input())

Lunlun = set()
for a in range(0,10):
    now = a
    Lunlun.add(now)
    for b in range(a-1, a+2):
        if b < 0 or b > 9:
            continue
        now = a +b*10
        Lunlun.add(now)
        for c in range(b-1, b+2):
            if c < 0 or c > 9:
                continue
            now = a +b*10 + c*100
            Lunlun.add(now)
            for d in range(c-1, c+2):
                if d < 0 or d > 9:
                    continue
                now = a +b*10 + c*100 + d*1000
                Lunlun.add(now)
                for e in range(d-1, d+2):
                    if e < 0 or e > 9:
                        continue
                    now = a +b*10 + c*100 + d*1000 + e*10000
                    Lunlun.add(now)
                    for f in range(e-1, e+2):
                        if f < 0 or f > 9:
                            continue
                        now = a +b*10 + c*100 + d*1000 + e*10000 + f*100000
                        Lunlun.add(now)
                        for g in range(f-1, f+2):
                            if g < 0 or g > 9:
                                continue
                            now = a +b*10 + c*100 + d*1000 + e*10000 + f*100000 + g*(10**6)
                            Lunlun.add(now)
                            for h in range(g-1, g+2):
                                if h < 0 or h > 9:
                                    continue
                                now = a +b*10 + c*100 + d*1000 + e*10000 + f*100000 + g*(10**6) + h*(10**7)
                                Lunlun.add(now)
                                for i in range(h-1, h+2):
                                    if i < 0 or i > 9:
                                        continue
                                    now = a +b*10 + c*100 + d*1000 + e*10000 + f*100000 + g*(10**6) + h*(10**7) + i*(10**8)
                                    Lunlun.add(now)
                                    for j in range(i-1, i+2):
                                        if j < 0 or j > 9:
                                            continue
                                        now = a +b*10 + c*100 + d*1000 + e*10000 + f*100000 + g*(10**6) + h*(10**7) + i*(10**8) +j*(10**9)
                                        Lunlun.add(now)


Lunlun = sorted(Lunlun)
# print(len(Lunlun))
ans = Lunlun[k]
print(ans)

Measured memory_bytes: 66924
static MOD: u64 = 1000000007;

fn solve(aa: Vec<u64>) -> u64 {
    let n = aa.len();

    let mut ans = 0u64;

    for i in 0..61 {
        let mut cnt1 = 0;

        for a in aa.iter() {
            if ((a >> i) & 1u64) == 1u64 {
                cnt1 += 1;
            }
        }

        ans += ((1u64 << i) % MOD) * ((cnt1 * (n - cnt1)) as u64 % MOD);
        ans %= MOD;
    }

    ans
}

#[test]
fn solve_test() {
    assert_eq!(solve(vec![1, 2, 3]), 6);
    assert_eq!(solve(vec![3, 1, 4, 1, 5, 9, 2, 6, 5, 3]), 237);
}

#[allow(unused_macros)]
macro_rules! parse_line {
    ( $t:ty ) => (
        {
            let mut line = String::new();
            ::std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            iter.next().unwrap().parse::<$t>().unwrap()
        }
    );

    ( $( $t:ty), +) => (
        {
            let mut line = String::new();
            ::std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            ( $(iter.next().unwrap().parse::<$t>().unwrap()),* )
        }
    );
}

#[allow(unused_macros)]
macro_rules! read_line {
    () => {{
        let mut line = String::new();
        ::std::io::stdin().read_line(&mut line).unwrap();
        line.pop();
        line
    }};
}

#[allow(unused_macros)]
macro_rules! parse_vec {
    ( $t:ty ) => {{
        let mut line = String::new();
        ::std::io::stdin().read_line(&mut line).unwrap();
        let iter = line.split_whitespace();
        iter.map(|v| v.parse::<$t>().unwrap()).collect::<Vec<_>>()
    }};
}

fn main() {
    let _n = parse_line!(usize);
    let aa = parse_vec!(u64);
    println!("{}", solve(aa));
}


Measured memory_bytes: 14456
#include <bits/stdc++.h>
#define ALL(obj) begin(obj), end(obj)
using namespace std;
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
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;
}

using ll = long long;
using ull = unsigned long long;
const int INF = 2100100100;
const int MOD = 1e9 + 7;

ll N, M, K, Q;
string S;
using P = pair<ll, ll>;
int main() {
    ll N;
    cin >> N;
    vector<P> p(N);
    for (int i = 0; i < N; i++) {
        cin >> p[i].second >> p[i].first;
    }
    sort(ALL(p));
    ll now = 0;
    for (int i = 0; i < N; i++) {
        now += p[i].second;
        if (now > p[i].first) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}


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

/* ==== declarations ====== */
// functions
void solve();
void getInput();

// global variables
int K;


/* ======================== */

signed main(){
    getInput();
    solve();
    return 0;
}

void getInput() {
    cin>>K;
}

int64_t getNext(int64_t n) {
    if (n <= 11) return n+1;
    int64_t nn = n+1;
    int64_t c = nn%10;
    int64_t cc = (nn/10)%10;
    // cout<<"n: "<<n<<", cc, c"<<cc<<", "<<c<<endl;
    if (abs(cc - c) <= 1 && c!=0){
        return n+1;
    } else {
        int64_t head = getNext(n/10);
        // cout<<"base:"<<n/10<<endl;
        // cout<<"head: "<<head<<endl;
        // cout<<"res: "<<head*10 + max(head%10 - 1, 0)<<endl;
        return head*10 + max((int)(head%10) - 1, 0);
    }
    return n+1;
}


void solve() {
    int64_t cnt=0;
    int64_t prev = 0;
    while(true) {
        cnt+=1;
        if(cnt == K) {
            break;
        }
        prev = getNext(prev);
        // cout<<prev<<endl;
    }
    cout<<getNext(prev)<<endl;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

signed main()
{
    string s,t; cin>>s>>t;
    sort(ALL(s));
    sort(ALL(t),greater<char>());
    cout<<(s<t? "Yes":"No")<<endl;
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
using namespace std;
int main()
{
    long long width,jiange,gap,flag;
    while(~scanf("%lld %lld %lld",&width,&jiange,&gap))
    {
        flag = (width-gap)/(jiange+gap);
        printf("%lld\n",flag);
    }
    return 0;
}


Measured memory_bytes: 128
// lcmとか__builtin_popcountとかはg++ -std=c++17 default.cppみたいなかんじで

#include <bits/stdc++.h>
#define mod 1000000007
#define INF 1001001001
#define ll long long
#define ln cout<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
using namespace std;

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

    long double a,b,c,d,m,n,maxi=0,f=0,mini=INF;
    string str;
    cin>>a>>b;
    ll sum=floor(a*b);
    printf("%lld\n",sum);

    return 0;
}


Measured memory_bytes: 3836
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define EPS (1e-10)
#define equals(a, b) (fabs((a)-(b)) < EPS)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 998244353;

class Combi {
private:
  v(ll) fac, inv, finv;
  void init(int N) {
    fac[0] = fac[1] = 1; inv[1] = 1; finv[0] = finv[1] = 1;
    for (int i = 2; i < N; i++) {
      fac[i] = fac[i - 1] * i % MOD;
      inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
      finv[i] = finv[i - 1] * inv[i] % MOD;
    }
  }
public:
  Combi(int N) : fac(N + 1), inv(N + 1), finv(N + 1) { init(N + 1); }
  ll Cmod(int n, int k) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
  }
  ll Pmod(int n, int k) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * finv[n - k] % MOD;
  }
};

struct mint {
  ll x;
  mint(ll x=0):x((x%MOD+MOD)%MOD){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= MOD) x -= MOD;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += MOD-a.x) >= MOD) x -= MOD;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= MOD; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
      mint a = pow(t>>1);
      a *= a;
    if (t&1) a *= *this;
      return a;
  }
   mint inv() const { return pow(MOD-2);}
   mint& operator/=(const mint a) { return *this *= a.inv();}
   mint operator/(const mint a) const { return mint(*this) /= a;}
};
typedef vector<mint> vm;
typedef vector<vm> vvm;
  
int main() {
  int N,A,B;
  cin >> N >> A >> B;
  ll K;
  cin >> K;
  Combi comb(N);
  mint ans = 0;
  rep(a,N+1) {
    ll red = ll(a)*A;
    ll blue = K-red;
    if(blue<0||blue%B!=0) continue;
    ll b = blue/B;
    if(b>N) continue;
    mint res = comb.Cmod(N,a);
    res *= comb.Cmod(N,b);
    ans += res;
  }
  cout << ans.x << endl;
  return 0;
}

Measured memory_bytes: 10372
#include <stdio.h>
int fib(int );
int fibo[45];
int main(){
    int n,i;
    for(i=0;i<45;i++)fibo[i]=-1;
    scanf("%d",&n);
    printf("%d\n",fib(n));
    return 0;
}
int fib(int n){
    if(n==0||n==1)return fibo[n]=1;
    else if(fibo[n]!=-1)return fibo[n];
    return fibo[n]=fib(n-1)+fib(n-2);
}


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

int main(){
    int N;
    scanf("%d",&N);

    int u[N-1],v[N-1],w[N-1],d[N+1],counter;
    int f[N-1] = {0};
    int p[N+1] = {0};
    counter = 2;

    for (int i = 0;i < N-1;i++){
        scanf("%d%d%d",&u[i],&v[i],&w[i]);
    }

    d[v[0]] = 0;
    d[u[0]] = w[0]%2;
    f[0] = 1;
    p[v[0]] = 1;
    p[u[0]] = 1;

    while(counter < N){
        for(int i = 1;i< N-1;i++){
            if(f[i] == 1)continue;
            if(p[u[i]] == 1){
                d[v[i]] = (d[u[i]] +w[i])%2;
                p[v[i]] = 1;
                f[i] = 1;
                counter++;
            }else if(p[v[i]] == 1){
                d[u[i]] = (d[v[i]]+ w[i])%2;
                p[u[i]] = 1;
                f[i] = 1;
                counter++;
            }
        }
    }

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


    return 0;
}

Measured memory_bytes: 2816
#include<stdio.h>
int main(){
int a[100],s,i=0;
scanf("%d",&s);
while(i<s){
scanf("%d",&a[i]);
i++;
}
i--;
for(;i>-1;i--){
printf("%d",a[i]);
if(i!=0)printf(" ");
}
printf("\n");
}

Measured memory_bytes: 1028
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const int INT_INF = 2147483647;
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; }
typedef pair<int,int> P;

int main(){
  int n;
  cin >> n;
  int a[n];
  rep(i,n)cin >> a[i];
  int o[n];
  rep(i,n)o[a[i]-1]=i+1;
  rep(i,n)cout << o[i] << " ";
  cout << endl;
}


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

int main(){
  int n;
  cin>>n;
  cout<<n/3<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < b; i++)
#define Rep(i, a, b) for(int i = a; i <= b; i++)
#define _GLIBCXX_DEBUG
#define V vector<int>
using namespace std;
using ll = long long;

int main(){
    int n;
    cin>>n;
    V v(n);
    rep(i,0,n) cin>>v[i];
    sort(v.begin(),v.end());
    cout<<v.back()-v.front()<<endl;
}


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

int main()
{
    int x;
    while(1){
        cin >> x;
        if(x == 0) break;
        int max = -1, mini = 10000, sum = 0, score = 0, y = 0;
        for(int i = 0; i < x; i++){
           cin >> score;
          sum += score;
          if(score > max) max = score;
            if(score < mini) mini = score;
        }
        sum -= max + mini;
        y = sum / (x - 2);
        cout << y << endl;
    }
    return 0;
}

Measured memory_bytes: 1160
#include "bits/stdc++.h"
#include <unordered_set>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll > pi;  
typedef pair<pair<ll, ll >, ll > pii;  
vector<ll > vec;
vector<vector<ll > > vec2;
ll MOD = 1000000007;

int main(){

    ll N, H;
    cin >> N >> H;

    vector<ll > A;
    vector<ll > B;

    for(ll i = 0; i < N; i++){
        ll a, b; cin >> a >> b;
        A.push_back(a);
        B.push_back(b);
        //attack.push_back(make_pair(a, b));
    }

    //sort(attack.rbegin(), attack.rend());
    sort(A.rbegin(), A.rend());
    sort(B.rbegin(), B.rend());

    ll ans = 0;
    //逆からさかのぼって求めるイメージ
    //捨ててから斬りつける
    //とりあえず剣を投げつけたほうがダメージが大きく入るので投げつける
    //しかし，切りつけたほうが効率が良いときは斬りつけるほうが最適
    for(ll i = 0; i < N; i++){
        if(H <= 0){
            cout << ans << endl;
            return 0;
        }
        //剣を投げつけるより，切りつけたほうが良い刀があればそっちに切り替える
        /*if(attack[0].first > attack[i].second){
            break;
        }
        */
        if(A[0] > B[i]) break;
        H -= B[i];
        ans++;
    }

    ans += H / A[0];

    if(H % A[0] > 0){
        ans++;
    }

    cout << ans << endl;

}

Measured memory_bytes: 2036
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vel;
typedef vector<int> vei;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> ve_vel;
typedef vector<vector<int>> ve_vei;
typedef vector<vector<char>> ve_vec;
typedef vector<vector<bool>> ve_veb;
typedef vector<vector<string>> ve_ves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pub push_back
#define puf push_front
#define pob pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
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 (a>b) { a=b; return 1; } return 0; }

ll beki(ll a, ll n)
{
    if(n == 0){
        return 1;
    }
    ll ans = beki(a, n / 2);
    ans = ans * ans;
    if(n % 2 == 1){
        ans = ans * a;
    }
    return ans % mod;
}

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

    int N; cin >> N;
    vei A(N); rep(i,N) cin >> A[i];
    sort(all(A));

    vei fact(N); 
    rep(i,N) fact[i] = abs(N - 2*i - 1);
    sort(all(fact));

    rep(i,N) {
        if(A[i] != fact[i]) {cout << 0 << endl; return 0;}
    }

    if(N % 2 == 0) {
        cout << beki(2,N/2) << endl;
        return 0;
    }
    else {
        cout << beki(2, (N-1)/ 2)<< endl;
        return 0;
    }

}


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

using namespace std;
typedef long long ll;

int main() {
  int a,b,c,d;
  string in;
  cin >> in;
  a = in[0] - '0';
  b = in[1] - '0';
  c = in[2] - '0';
  d = in[3] - '0';

  if (a+b+c+d == 7) printf("%d+%d+%d+%d=7\n", a,b,c,d);
  else if (a-b+c+d == 7) printf("%d-%d+%d+%d=7\n", a,b,c,d);
  else if (a+b-c+d == 7) printf("%d+%d-%d+%d=7\n", a,b,c,d);
  else if (a+b+c-d == 7) printf("%d+%d+%d-%d=7\n", a,b,c,d);
  else if (a-b-c+d == 7) printf("%d-%d-%d+%d=7\n", a,b,c,d);
  else if (a-b+c-d == 7) printf("%d-%d+%d-%d=7\n", a,b,c,d);
  else if (a+b-c-d == 7) printf("%d+%d-%d-%d=7\n", a,b,c,d);
  else if (a-b-c-d == 7) printf("%d-%d-%d-%d=7\n", a,b,c,d);
}


Measured memory_bytes: 256
using System;
class Program
{
    static void Main(string[] args)
    {
        string input = Console.ReadLine();
        int lc = input.Length;
        switch(input[lc-1])
        {
            case '2':
            case '4':
            case '5':
            case '7':
            case '9':
                Console.WriteLine("hon");
                break;
            case '0':
            case '6':
            case '1':
            case '8':
                Console.WriteLine("pon");
                break;
            case '3':
                Console.WriteLine("bon");
                break;
        }
    }
}

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

typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007;

ll rui(ll u,ll t){
    if(t==0) return 1;
    else if(t==1) return u;
    else if(t%2==0) return ((rui(u,t/2))*(rui(u,t/2)))%mod;
    else return (rui(u,t-1)*u)%mod;
}

ll comb(ll a,ll b){
    ll ans=1;
    for(ll i=a;i>a-b;i--){
        ans*=i;
        ans=ans%mod;
    }
    for(ll i=1;i<=b;i++){
        ans*=rui(i,mod-2);
        ans=ans%mod;
    }
  ans*=rui(2,mod-2);
  ans=ans%mod;
    return ans;
}

int main(){
    
    ll N,M,K;cin>>N>>M>>K;
    ll sum1=0,sum2=0,sum;
    for(ll i=1;i<M;i++){
        sum1+=(M-i)*2*i;
        sum1=sum1%mod;
    }
    for(ll i=1;i<N;i++){
        sum2+=(N-i)*2*i;
        sum2=sum2%mod;
    }
    sum=((sum1*N*N)%mod+(sum2*M*M)%mod)%mod;
    
    sum*=comb(N*M-2,K-2);
    sum=sum%mod;
    
    cout<<sum<<endl;
}



Measured memory_bytes: 256
#include <iostream>

using namespace std;

typedef long long lint;

int n, m;

int solve(int x) {
    for(int i = (m / (x * n)); i >= 2; i --) {
        if((m - (n * x * i)) % (x * i) == 0) {
            return solve(x * i);
        }
    }
    return x;
}

int main()
{
    //freopen("f.in", "r", stdin);
    //freopen("f.out", "w", stdout);

    scanf("%d%d", &n, &m);
    printf("%d", solve(1));

    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {

    static int gcd (int a, int b) {return b>0?gcd(b,a%b):a;}
    static int mod = 1000000007;

    public static void main(String[] args)  {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int K = sc.nextInt();
        long ans = 0;
        long[] sunNum= new long[N+1];
        for(int i=1;i<N+1;i++){
            sunNum[i] = sunNum[i-1] +i;
        }

        for(int i= K;i <=N;i++){
            //System.out.println((sunNum[N] - sunNum[N-i]) - sunNum[i-1]+ 1);
            ans += (sunNum[N] - sunNum[N-i]) - sunNum[i-1]+ 1;
            ans %= mod;
        }
        ans++;
        ans %= mod;

        System.out.println(ans);


    }

}









Measured memory_bytes: 37372
#include <iostream>

using namespace std;

typedef long long ll;

const int kMaxN = 100000;
const ll kMod = 1000000000 + 7; 

int main () {
    int n;
    ll ans = 1;
    cin >> n;

    for (int i = 1; i <= n; i++) {
        ans = ((ans % kMod) * (i % kMod)) % kMod;
    }

    cout << ans << endl;
}



Measured memory_bytes: 256
#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 <unordered_map>
#include <unordered_set>
#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>
#define _GLIBCXX_DEBUG
#define INF 100000010
using namespace std;
const int mod = 1000000007;
const int tmpMod = 998244353;

int main() {
 
  int64_t N;
  cin>>N;
  //vector<int64_t> A(N);
  //for(int i=0; i<N; i++){cin>>A[i];}
  //vector<vector<int> > A(N,vector<int>(M));
  //for(int i=0; i<N; i++){for(int j=0; j<M; j++){cin>>A[i][j];}}
  //sort(A.begin(),A.end());
  //for (int i = 0; i < N; i++) { maximum = max(maximum , A[i]);}
  //for (int i = 0; i < N; i++) { minimum = min(minimum , A[i]);}
  if(N%10==3)cout<<"bon"<<endl;
  else if(N%10==0||N%10==1||N%10==6||N%10==8)cout<<"pon"<<endl;
  else cout << "hon" << endl;
}


Measured memory_bytes: 3632
#include "bits/stdc++.h"
using namespace std;

/*第二引数で第一引数を割ったときの切り上げの計算*/
long long int maxtime(long long int x, long long int y) {
	return(x + y - 1) / y;

}
/*最大公約数*/
long long int lcm(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;

	if (number2 > number1) {
		m = number2;
		n = number1;
	}
	long long int s = -1;
	while (s != 0) {
		s = m % n;
		m = n;
		n = s;
	}
	return m;
}
/*最大公倍数*/
long long int gcd(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;
	return m / lcm(m, n) * n;
}

int main() {
	int N;
	cin >> N;
	vector<int> c;
	int sum = 0;
	for (int i = 0; i < N; i++) {
		int a ;
		cin >> a;
		sum = sum + a;
		c.push_back(a);
	}
	sort(c.begin(), c.end(),greater<int>());
	if (c[0] < sum - c[0]) {
		cout << "Yes";
	}
	else {
		cout << "No";
	}
}


Measured memory_bytes: 256
count = int(input())
Tpoint = 0
Hpoint = 0
for i in range(count):
    Twrite,Hwrite = map(str,input().split())
    if Twrite == Hwrite:
        Tpoint = Tpoint + 1
        Hpoint = Hpoint + 1
    elif Twrite > Hwrite:
        Tpoint = Tpoint + 3
    else:
        Hpoint = Hpoint + 3
print('{0} {1}'.format(Tpoint,Hpoint))


Measured memory_bytes: 5600
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <list>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <queue>
#define mkp(a, b) make_pair(a, b)
#define pb(t) push_back(t)
#define ft first
#define sc second
#define pt(num) cout << num << "\n"
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
#define max(a, b) ((a)>(b) ? (a):(b))
#define min(a, b) ((a)<(b) ? (a):(b))
#define chmax(a, b) (a<b ? a=b : 0)
#define chmin(a, b) (a>b ? a=b : 0)
#define INF 1000000000000000000
#define MOD 1000000007LL
#define MAX 101010
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef map<ll, ll> Map;




int main(void) {
    ll N, z, w;
    ll i;
    ll a[2222];
    cin >> N >> z >> w;
    for(i=0; i<N; i++) {
        cin >> a[i];
    }
    
    pt(max(abs(a[N-2]-a[N-1]), abs(a[N-1]-w)));
    
}








Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define all(v) v.begin(), v.end()
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define Rep(n) for (ll _ = 0; _ < (ll)(n); _++)

template<class S>S sum(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
ll min(int a,ll b){return min((ll)a,b);} ll min(ll a,int b){return min(a,(ll)b);}
template <class S> void print(vector<S> &v){for(ll i=0; i<(ll)v.size(); i++){cerr << v[i] << ' ';}cerr << endl;}
template <class S> void print(vector<vector<S>> &v) {for (ll i = 0; i < (ll)v.size(); i++) {for (ll j = 0; j < (ll)v[i].size(); j++) {cerr << v[i][j] << ' ';}cerr << endl;}}


int main(){
	int r,d,x; cin>>r>>d>>x;
	Rep(10){
		x = r * x - d;
		cout << x << endl;
	}
}

Measured memory_bytes: 3568
#include <bits/stdc++.h>
using namespace std;
typedef int int__;
#define int long long
#define pb push_back
#define pi pair<int,int>
#define vpi vector<pi>
#define vi vector<int>
#define vvi vector<vi>
#define fi first
#define se second
#define forn(i, n)for(int i=0;i<int__(n);i++) 
#define sz(a)int__(a.size())
template <class A, class B> ostream& operator << (ostream& out, const pair<A, B> &a){return out << "(" << a.first << ", " << a.second << ")";}
template<class A>ostream& operator<<(ostream& out,const vector<A>&v){out<<"[";forn(i,sz(v)){if(i)out<<", ";out<<v[i];}return out<<"]";}
#define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
int Mod(int x){const int mm=1e9 + 7;x%=mm;if(x<0)x+=mm;return x;}
int Pow(int x,int n){if(n==0)return 1;int t=Pow(x,n/2);t=Mod(t*t);if(n&1)t=Mod(t*x);return t;}
#define watch(x) cout << #x << " : " << x << endl;
int gcd(int a,int b){if(b==0)return a;return gcd(b,a%b);}
#define all(x) x.begin(), x.end()

int__ main() {
	fast;

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

	vi cnt(k+1,0);
	int ans = 0;

	for(int i=k;i>=1;i--) {
		int choices = k/i;

		int no = Pow(choices,n);

		for(int j=2*i;j<=k;j += i) {
			no = Mod(no - cnt[j]);
		}

		cnt[i] = no;
		ans = Mod(ans + Mod(i*no));
	}

	cout << ans << endl;
}

Measured memory_bytes: 3952
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
using ul = unsigned long long;
using vec = vector<int>;
using vec2 = vector<vec>;
vec s,t;
int n;
ul ans[510][510];
bool valid(vec x,vec y,vec2 &mp){
    rep(i,n){
        int m = mp[i][0];
        if(s[i])rep(j,n)m|=mp[i][j];
        else rep(j,n)m&=mp[i][j];
        if(m!=x[i])return false;
    }
    rep(j,n){
        int m = mp[0][j];
        if(t[j])rep(i,n)m|=mp[i][j];
        else rep(i,n)m&=mp[i][j];
        if(m!=y[j])return false;
    }
    return true;
}
bool solve(vec x,vec y,ul k){
    auto mp = vec2(n,vec(n,-1));
    rep(i,n)rep(j,n){
        if(x[i]^s[i])mp[i][j]=x[i];
        if(y[j]^t[j]){
            if((mp[i][j]^y[j])==1)return false;
            mp[i][j] = y[j];
        }
    }
    int cx=n,cy = n;
    rep(i,n)cx-=x[i]^s[i];
    rep(i,n)cy-=y[i]^t[i];
    if(cx > 1 and cy > 1){
        int cnt = 0;
        rep(i,n){
            if(!(x[i]^s[i])){
                int p = cnt++;
                rep(j,n)if(!(y[j]^t[j]))mp[i][j] = p++&1;
            }
        }
    }
    int c[2]={};
    if(cx == 1){
        rep(i,n)if(x[i]^s[i])c[x[i]]++;
        if(c[0] and c[1]){
            rep(i,n)rep(j,n)if(mp[i][j]==-1)mp[i][j]=(i+j)&1;
        }
        else{
            rep(i,n)rep(j,n){
                if(mp[i][j]==-1){
                    mp[i][j]=(c[t[j]]?x[i]:t[j]);
                }
            }
        }
    }
    else if(cy == 1){
        rep(i,n) if(y[i]^t[i])c[y[i]]++;
        if(c[0] and c[1]) {
            rep(i,n)rep(j,n)if(mp[i][j]==-1)mp[i][j] = (i+j)&1;
        }
        else{
            rep(i,n)rep(j,n){
                if(mp[i][j]==-1){
                    mp[i][j]=(c[s[i]]?y[j]:s[i]);
                }
            }
        }
    }
    if(!valid(x,y,mp))return false;
    rep(i,n)rep(j,n)ans[i][j] += k*mp[i][j];
    return true;
}
signed main(){
    ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);cout<<fixed<<setprecision(15);
    cin>>n;
    vector<ul> u(n),v(n);
    s.resize(n);t.resize(n);
    rep(i,n)cin>>s[i];rep(i,n)cin>>t[i];rep(i,n)cin>>u[i];rep(i,n)cin>>v[i];
    rep(_,64){
        vec x(n),y(n);
        rep(i,n)x[i]=u[i]&1,y[i]=v[i]&1,u[i]>>=1,v[i]>>=1;
        if(!solve(x,y,1ULL<<_)){
            cout<<-1<<endl;
            return 0;
        }
    }
    rep(i,n)rep(j,n){cout<<ans[i][j]<<" ";}cout<<endl;
}
            


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


int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    if (a == b) {
        if (b != c) cout << "Yes" << endl;
        else cout << "No" << endl;
    } else {
        if (a == c || b == c) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
def yen(x, y, z):
    return x * 10000 + y * 5000 + z * 1000


def otoshidama(N, Y):
    x = y = z = 0
    while x <= N:
        y = 0
        while x + y <= N:
            z = N - y - x
            if yen(x, y, z) == Y:
                return '{} {} {}'.format(x, y, z)
            y += 1
        x += 1
    return '-1 -1 -1'


N, Y = map(int, input().split())
print(otoshidama(N, Y))

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

int main(void){
    
    int a;
    string str;
    cin >> a >> str;

    if(str.size() > a){
        for(int i = 0;i < a; i++){
            cout << str.at(i);
        }
        cout << "..." << endl;
    } else {
        cout << str << endl;
    }


    return 0; 
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
#include<iostream>
#include<vector>
#include<queue>
#include<string>
#include<list>
#include<set>
#include<stack>
using namespace std;
typedef long long ll;
const int maxn = 1e2+10;
const ll mod = 1e9+7;

int main()
{
	int l;
	cin>>l;
	double x = l/3.0;
	printf("%.12lf\n",x*x*x);
	
	return 0;
}
	

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

// #undef DEBUG  // Uncomment this line to forcefully disable debug print.
#if DEBUG
template <typename T>
void debug(T value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define dbg(...)                              \
  do {                                        \
    cerr << #__VA_ARGS__ << ": ";             \
    debug(__VA_ARGS__);                       \
    cerr << " (L" << __LINE__ << ")" << endl; \
  } while (0)
#else
#define dbg(...)
#endif

void read_from_cin() {}
template <typename T, typename... Ts>
void read_from_cin(T& value, Ts&... args) {
  std::cin >> value;
  read_from_cin(args...);
}
#define in(type, ...) \
  type __VA_ARGS__;   \
  read_from_cin(__VA_ARGS__);

template <typename T>
void write_to_cout(const T& value) {
  std::cout << value << std::endl;
}
template <typename T, typename... Ts>
void write_to_cout(const T& value, const Ts&... args) {
  std::cout << value << ' ';
  write_to_cout(args...);
}
#define out(...) write_to_cout(__VA_ARGS__);

#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

using ll = long long;

using namespace std;

int main() {
  in(ll, n);
  vector<ll> p(n + 1);
  ll ans = 0;
  for (ll i = 1; i <= n; ++i) {
    for (ll j = i; j <= n; j += i) {
      ++p[j];
    }
    ans += i * p[i];
  }
  out(ans);
}


Measured memory_bytes: 81364
S = list(input())
K = int(input())

if(len(set(S)) == 1):
    print(len(S) * K//2)
else:
    ans = 0
    cnt = 1
    a = []
    for i in range(len(S)-1):
        if(S[i] == S[i+1]):
            cnt += 1
        else:
            a.append(cnt)
            cnt = 1
    a.append(cnt)

    for i in a:
        ans += (i//2)*K

    if (S[0] == S[-1]):
        ans -= (a[0]//2 + a[-1]//2  - (a[0] + a[-1])//2)*(K-1)

    print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(long long i=0;i<x;i++)
#define repn(i,x) for(long long i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
vector<pair<string,P> >vec;
// vector<vector<int>> data(3, vector<int>(4));

void solve(string S){
	if (S == "MON") cout << "6" << endl;
	if (S == "TUE") cout << "5" << endl;
	if (S == "WED") cout << "4" << endl;
	if (S == "THU") cout << "3" << endl;
	if (S == "FRI") cout << "2" << endl;
	if (S == "SAT") cout << "1" << endl;
	if (S == "SUN") cout << "7" << endl;
}

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



Measured memory_bytes: 256
#include <stdio.h>

#define N 100
#define INF 3000
#define NIL -1

int M[N][N];
int n;
int d[N], pi[N], color[N];
//d:weight of node, pi:list of parents, color:visited or not

int main(){
  int i, j, min, cost = 0;

  scanf("%d", &n);

  for(i = 0; i < n; i++){
    d[i] = INF;
    pi[i] = NIL;
    color[i] = 0;
    for(j = 0; j < n; j++){
      scanf("%d", &M[i][j]);
    }
  }

  d[0] = 0;

  while(1){
    min = INF;
    for(i = 0; i < n; i++){
      if(color[i] != 1 && d[i] < min){
        min = d[i];
        j = i;
      }
    }

    if(min == INF)
      break;

    for(i = 0; i < n; i++){
      if(M[j][i] != -1 && color[i] != 1 && M[j][i] < d[i]){
        pi[i] = j;
        d[i] = M[j][i];
      }
    }
    color[j] = 1;
  }
  for(i = 0; i < n; i++)
    cost += d[i];

  printf("%d\n", cost);
  return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; ++i)
#define REPP(i, n) for(int i = 1; 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 ALL(v) v.begin(), v.end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
const ll MOD = 1000000007;

string lcs(string s, string t) {
    int n = s.length();
    int m = t.length();
    vector<vector<int>> dp(n+1, vector<int>(m+1, 0));
    REP(i,n) {
        REP(j,m) {
            if(s[i]==t[j]) dp[i+1][j+1] = dp[i][j] + 1;
            else dp[i+1][j+1] = max(dp[i+1][j], dp[i][j+1]);
        }
    }
    string ans = "";
    int x = n; int y = m;
    while(x>0 && y>0) {
        if(dp[x][y] == dp[x-1][y]) x--;
        else if(dp[x][y] == dp[x][y-1]) y--;
        else {
            x --; y--;
            ans += s[x];
        }
    }
    reverse(ALL(ans));
    return ans;
}

int main() {
    string s,t; cin >> s >> t;
    cout << lcs(s,t) << endl;
    return 0;
}

Measured memory_bytes: 35584
#include <bits/stdc++.h>
#define endl "\n"
#define ENGZ ios::sync_with_stdio(0);ios_base::sync_with_stdio(0);cin.tie(0) , cout.tie(0) ;
#define mod (ll)(1e9+7)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define F first
#define S second
#define PB push_back
#define pb pop_back()
#define MP make_pair
#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 MAX 500002
#define MOD 1000003
#define EPS 1e-6
#define PI 3.1415926535
using namespace std;

typedef long long ll;
typedef unsigned long long ull ;
typedef vector<int> vi;
typedef pair<int,int> pi;

bool cmp(pair<ll,ll> a, pair<ll,ll> b) {
    return a.S < b.S;
}

int main(){
    ENGZ
    int n ;
    ll a , b ,sum = 0 ;
    cin >> n ;
    vector<pair<ll,ll> > arr;
    REP(i,0,n){
        cin >> a >> b ;
        arr.PB(MP(a,b));
    }
    sort(all(arr), cmp);
    bool flag = true ;
    REP(i,0,n){
        sum += arr[i].F ;
        if(sum > arr[i].S){flag = false; break;}
    }
    cout << (flag?"Yes":"No") << endl;
    return 0;
}


Measured memory_bytes: 6256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define inf 1000000000000000
#define mod 1000000007
typedef pair<int, int> P;

bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}

signed main() {
	string s;
	cin >> s;
	int a = 0;
	rep(i, s.size()) {
		if (s[i] == 'o') a++;
	}
	int d = 15 - s.size();
	if (a + d >= 8) {
		cout << "YES" << endl;
	}
	else cout << "NO" << endl;

	return 0;
}


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

int main()
{
	int a,b;
	
	cin>>a>>b;
	
	if((a+b)%2==0)
	{
		cout<<(a+b)/2<<endl;
	}
	else{
			cout<<(a+b)/2+1<<endl;
	}
	
	
	return 0;
} 

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

const int SIZE = 1 << 17; // 2^17 = 131072
template<typename T>
struct segtree {
    // ?????????????????????
    T node[2*SIZE], I;

    // ????????¬????????§??? (update, query ??? 2 ???????????????)
    T (*upd_f)(T, T), (*qry_f)(T, T);

    // ???????????¨?????????????????????????????¨?????? node ??????????????§?????????
    segtree(T (*op1)(T, T), T (*op2)(T, T), T X) {
        upd_f = op1;
        qry_f = op2;
        I = X;
        fill(node, node+2*SIZE, I);
    }

    // ??´??? idx ?????? val ????????? (upd_f ?????¨?????? update)
    void update(int idx, T val) {
        idx += SIZE - 1;
        node[idx] = upd_f(node[idx], val);
        while(idx > 0) {
            // ????????¨?????? qry_f ??????????????¨?????¨????????????
            idx = (idx - 1) / 2;
            node[idx] = qry_f(node[2*idx+1], node[2*idx+2]);
        }
    }

    // ???????????? [a, b) ?????????????????¨???????????????
    // (qry_f ?????¨????????????)
    T query(int a, int b, int l=0, int r=SIZE, int k=0) {
        if(b <= l || r <= a) return I;
        if(a <= l && r <= b) return node[k];
        int mid = (l + r) / 2;
        T vl = query(a, b, l, mid, 2*k+1);
        T vr = query(a, b, mid, r, 2*k+2);
        return qry_f(vl, vr);
    }
};

int add(int a, int b) {return a+b;}
int main() {
    segtree<int> seg(add, add, 0);
    int N, Q; scanf("%d%d", &N, &Q);
    for(int i=0; i<Q; i++) {
        int c, x, y; scanf("%d%d%d", &c, &x, &y); x--;
        if(c == 0) seg.update(x, y);
        else printf("%d\n", seg.query(x, y));
    }
    return 0;
}

Measured memory_bytes: 3796
#include <iostream>
#include <math.h>
using namespace std;

int main()
{
    int in1, in2;
    int a[200], b[200];
    int count = 0;
    while(cin >> in1 >> in2) {
        a[count] = in1;
        b[count] = in2;
        count++;
    }

    for(int i = 0; i < count; i++) cout << (int)log10(a[i]+b[i])+1 << endl;
    
    return 0;
}

Measured memory_bytes: 1204
n = int(input())
a = list(map(int,input().split()))
c = 0
for i in range(n-1):
    if i%2==0:
        c-=a[i]*2
    else:
        c+=a[i]*2
c+=a[-1]*2
ans = []
ans.append(c//2)
for i in a[::-1][1:]:
    ans.append(i*2-ans[-1])
for i in ans[::-1]:
    print(i,end=' ')
print('')

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

#define mp make_pair
#define pb push_back
#define REP(i,a,n) for(int i = a;i < (n);i++)
#define RREP(i,a) for(int i = a;i >= 0;i--)
#define rep(i,n) for(int i = 0;i < (n);i++)
#define rrep(i,n) for(int i = n - 1;i >= 0;i--)
#define all(s) s.begin(), s.end()
#define rall(s) s.rbegin(), s.rend()
#define range(x,min,max) ((min) <= (x) && (x) <= (max))
#define xyrange(x, minX, maxX, y, minY, maxY) (range(x, minX, maxX) && range(y, minY, maxY))

using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<vector<int> > VVI;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef pair<int,int> PII;
typedef vector<PII> VPII;

const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};
const int INF = 0x3f3f3f3f;

string s;

int solve() {
	int len = s.size();
	for (int i = len;i > 0;i--) {
		s = s.substr(0, s.size() - 1);
		if (s.size() % 2 == 0) {
			int c = s.size() / 2;
			string s1 = s.substr(0, c);
			string s2 = s.substr(c, c);
			if (s1 == s2) {
				return c * 2;
			}
		}
	}
	return -1;
}

int main(){
	cin.tie(0);
   	ios::sync_with_stdio(false);
	cin >> s;
	cout << solve() << endl;

	return 0;
}



Measured memory_bytes: 256