akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using p = pair<int, int>;

const int INF = 1001001001;
    
int main(){
    int n, m;
    cin >> n >> m;
    vector<int> to[n];
    rep(i,m){
        int a, b;
        cin >> a >> b;
        a--; b--;
        to[a].push_back(b);
        to[b].push_back(a);
    }

    vector<int> dist(n, INF);
    vector<int> pre(n, -1);
    queue<int> q;
    dist[0] = 0;
    q.push(0);
    while(!q.empty()){
        int v = q.front(); q.pop();
        for (int u : to[v]){
            if (dist[u] != INF) continue;
            dist[u] = dist[v] + 1;
            pre[u] = v;
            q.push(u);
        }
    }
    
    cout << "Yes" << endl;
    rep(i,n){
        if (i==0) continue;
        cout << pre[i]+1 << endl;
    }
    return 0;
}

Measured memory_bytes: 10648
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,ans;
  cin>>n;
  ans=n;
  for(int i=0;i<=n;i++){
    int k=0;
    int t=i;
    while(t){k+=t%6;t/=6;}
    t=n-i;
    while(t){k+=t%9;t/=9;}
    ans=min(ans,k);
  }
  cout<<ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
constexpr int MOD = 1000000007;
constexpr int INF = numeric_limits<int>::max() / 2;
typedef pair<int,int> P;
using Graph = vector<vector<int>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
 
 
signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
 
	string S;
	cin >> S;
	if(S == "ABC") cout << "ARC" <<endl;
	else cout << "ABC" << endl;
}

Measured memory_bytes: 3648
#include<iostream>
#include<vector>
#include<string>
#include<map>
#include<algorithm>
#include<cmath>
#include<stack>
using namespace std;

typedef long long int llint;

int main(){
	llint N;
	cin >> N;

	stack<char> name;
	int minus=0;

	while(N>0){
		N--;
		name.push(N%26+'a');
		N/=26;
	}
	while(!name.empty()){
		cout << name.top();
		name.pop();
	}
	cout << endl;
	return 0;
}


Measured memory_bytes: 3604
#include <stdio.h>
#include <stdlib.h>
int main()
{
    char s[1111];
    scanf("%s", s);
    int i = 0;
    for (; s[i] != '\0'; i++)
    {
        printf("%c", s[i]);
    }
    if (s[i - 1] == 's')
    {
        printf("es");
    }
    else
    {
        printf("s");
    }

    return 0;
}


Measured memory_bytes: 1708
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define all(v) v.begin(),v.end()

using namespace std;
typedef long long ll;


vector<ll> num;
vector<ll> numP;

ll np(ll x, ll n){
    
    if (n == 0) {
        return 1;
    }else{
        
        if (x == 1) {
            return 0;
        }else if(x >= 2 && x <= num[n-1]+1){
            return np(x-1, n-1);
        }else if(x == num[n-1]+2){
            return numP[n-1]+1;
        }else if(x >= num[n-1]+3 && x <= num[n-1]*2+2){
            return np(x-(num[n-1]+1), n) + numP[n-1] + 1;
        }else{
            return numP[n];
        }
        
    }
    
    
    
    
    
    
}



int main()
{
    ll N,X;
    cin >> N >> X;
    ll a = 1;
    ll b = 1;
    num.push_back(a);
    numP.push_back(b);
    for (int i = 1; i < N+1; i++) {
        a = 3 + a*2;
        b = 2*b + 1;
        num.push_back(a);
        numP.push_back(b);
    }
    
    
    cout << np(X,N) << endl;
    
    
    return 0;
}



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

using namespace std;
typedef long long ll;
struct edge{
    ll x,y,z;
}e[maxn*4];
ll ans,pre[maxn],fa[maxn],n,a[maxn],b[maxn],c[maxn],d,p,q;
int l[maxn],r[maxn];

int ffind(int x){
    if (pre[x]==x) return x;
    pre[x]=ffind(pre[x]); return pre[x];
}

void union_(int u,int v){
    pre[v]=u;
    b[u]=min(b[u],b[v]);
    c[u]=min(c[u],c[v]);
}

bool cmp(edge x,edge y){
    return x.z<y.z;
}

ll cost(int u,int v){
    return 1ll*abs(u-v)*d+a[u]+a[v];
}
ll f[maxn],g[maxn];

int main(){
    cin >> n >> d; int cnt=0;
    for (int i=1;i<=n;i++) cin >> a[i];
    for (int i=1;i<=n;i++) fa[i]=pre[i]=i,b[i]=a[i]-d*i,c[i]=a[i]+d*i;
    int tot=n;
    while (tot>1){
        int p=1; ll res=b[fa[1]];
        for (int i=2;i<=tot;i++){
            ll tmp=c[fa[i]];
            f[i]=tmp+res,g[i]=p;
            if (b[fa[i]]<res) res=b[fa[i]],p=i;
        }
        int q=n; res=c[fa[tot]];
        for (int i=tot-1;i;i--){
            ll tmp=b[fa[i]];
            if (i==1||tmp+res<f[i]) f[i]=tmp+res,g[i]=q;
            if (c[fa[i]]<res) res=c[fa[i]],q=i;
        }
        for (int i=1;i<=tot;i++){
            int u=ffind(fa[i]),v=ffind(fa[g[i]]);
            if (u!=v) union_(u,v),ans+=f[i];
        }
        tot=0;
        for (int i=1;i<=n;i++){
            fa[++tot]=ffind(i);
            while (i<n&&ffind(i+1)==fa[tot]) i++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 31488
#include <bits/stdc++.h>
using namespace std;
#define LL long long
#define lsh(i) (1 << (i))
#define lshll(i) (1LL << (i))
#define rep(i, n) for (int (i) = 0; (i) < n; (i)++)
#define until(x) while (!x)
#define fail(s) assert(!s)
#define ULL unsigned long long
const int INF = 0x3f3f3f3f;
const int EPS = 1e-6;
int n;
const int MAXN = 100010;
int a[MAXN];
int dp[MAXN];
int vis[MAXN];
typedef pair <int, int> Edge;
#define v first
#define w second
vector <Edge> G[MAXN];
int DP(int u) {
	if (vis[u])return dp[u];
	vis[u] = 1;
	for (auto e : G[u])dp[u] = min(dp[u], DP(e.v) + e.w);
	return dp[u]; 
}
int main()
{
	memset(dp, INF, sizeof(dp));
	cin >> n;
	rep(i, n)cin >> a[i];
	rep(i, n) {
		if (i >= 1)G[i].push_back(make_pair(i - 1, abs(a[i - 1] - a[i])));
		if (i >= 2)G[i].push_back(make_pair(i - 2, abs(a[i - 2] - a[i])));
	}
	dp[0] = 0;vis[0] = 1;
	cout << DP(n - 1) << endl;
	return 0;
}


Measured memory_bytes: 11520
//C++14 (Clang 3.8.0)

#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <string>
#define rp(i,a,b) for(int (i)=(int)(a);i<(int)(b);++i)

using namespace std;

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



int dx[]={1,-1,4,-4};
string ini="01234567";

map<string,int> maps;
set <string> sets;
int bfs(){
    queue<string> que;
    que.push(ini);
    maps[ini]=0;
    sets.insert(ini);
    while(que.size()){
        string p=que.front();que.pop();
        int zero;
        rp(j,0,8) {if(p[j]=='0') {zero=j;break;}}
        rp(j,0,4){
            int pl=zero+dx[j];
            string ns(p);
            bool flag=true;
            if(zero==3 and j==0) flag=false;
            if(zero==4 and j==1) flag=false;
            if(0<=pl and pl<=7 and flag) {
                ns[zero]=p[pl];
                ns[pl]='0';
            
                if(sets.find(ns)==sets.end()) {
                    que.push(ns);
                    sets.insert(ns);
                    maps[ns]=maps[p]+1;
                }
                
            }
        }
    }
}



int main(){
    bfs();
    string s;
    stringstream ss;
    string c;
    while(getline(cin,s)){
        if (s.size()==0) break;
        string c="01234567";
        rp(i,0,8) c[i]=s[i*2];
        cout<<maps[c]<<endl;

    }
        return 0;
};

Measured memory_bytes: 7200
# from math import factorial,sqrt
# from itertools import permutations as permus
# from fractions import gcd
# from collections import deque,Counter
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

# import numpy as np
# import scipy as scp

# 入力の受け取り
n,k = map(int,input().split())

target = k
ans = 0
for i in range(1,n+1):
    now = i
    temp = 1/n
    while now < target:
        now *= 2
        temp /= 2
    ans += temp

print(ans)
# print("{:.10f}".format(ans))
# print(*ans)   # unpackして出力。間にスペースが入る
# for row in board:
#     print(*row,sep="")    #unpackして間にスペース入れずに出力する



Measured memory_bytes: 2940
import sys
sys.setrecursionlimit(10**8)

N, M = map(int, input().split())
edge = [[] for _ in range(N)]
for i in range(M):
  a,b = map(int, input().split())
  edge[a-1].append(b-1)

def dfs(v):
  if len(edge[v])==0:
    return 0
  ans = 0
  for u in edge[v]:
    if longest[u]==-1:
      longest[u]=dfs(u)
    ans = max(ans,longest[u]+1)
  return ans

longest = [-1]*N
for i in range(N):
  if longest[i]==-1:
    longest[i] = dfs(i)
ans = max(longest)
print(ans)

Measured memory_bytes: 61308
package main

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

func main() {
	N, K := ReadInt(), ReadInt()
	A := ReadInts(N)
	max := -1
	for _, a := range A {
		if a > max {
			max = a
		}
	}
	if K == 0 {
		fmt.Println(max)
		return
	}

	l := 0
	r := max
	for r-l > 1 {
		c := (r + l) / 2
		k := 0
		for _, a := range A {
			if a > c {
				k += ((a + c - 1) / c) - 1
				if k > K {
					break
				}
			}
		}
		if k <= K {
			r = c
		} else {
			l = c
		}
	}
	fmt.Println(r)
}

func Abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

var reader = bufio.NewReader(os.Stdin)

func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}
func ReadInt() (i int)       { Scan(&i); return }
func ReadString() (s string) { Scan(&s); return }
func ReadInts(n int) []int {
	v := make([]int, n)
	for i := 0; i < n; i++ {
		Scan(&v[i])
	}
	return v
}


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

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

    if (b / 100 > 0)
    {
        ans = a * 1000 + b;
    }
    else if (b / 10 > 0)
    {
        ans = a * 100 + b;
    }
    else
    {
        ans = a * 10 + b;
    }
    
    if (ceil(sqrt(ans)) != floor(sqrt(ans)))
    {
        cout << "No" << endl;
    }
    else
    {
        cout << "Yes" << endl;
    }
    
    
}

Measured memory_bytes: 256
# coding : utf-8
import math

X = int(input())

x_sqrt = math.ceil(math.sqrt(X))
ans = 1
calcEnd = False
for i in range(X, 0, -1):
    for j in range(x_sqrt, 1, -1):
        calc = j
        while calc <= i:
            calc *= j

            if calc == i:
                ans = i
                calcEnd = True
                break

        if calcEnd:
            break
    if calcEnd:
        break

print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[])
{
    long x;

    cin >> x;
    long s = 100;
    long y = 0;
    while (true)
    {
        s = (s * 1.01);
        y++;
        if (s >= x)
        {
            break;
        }
    }
    cout << y << endl;
    return 0;
}


Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <algorithm>
#include <list>
#include <iomanip>
#include <string>
#include <cctype>
#include <cstdio>
#include <cmath>

using namespace std;

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


Measured memory_bytes: 3640
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System.Text.RegularExpressions;

class Program
{
    const string Yes = "Yes";
    const string No = "No";
    const char White = '.';
    const char Black = '#';
    const long Mod = 1000000007;

    static void Main(string[] args) {
#if DEBUG
        MyDebugger.Test(process, "../TextFile1.txt");
#else
        object ret = process(new StreamReader(Console.OpenStandardInput()));
        Console.WriteLine(ret);
#endif
    }

    static object process(TextReader input) {
        var n = int.Parse(input.ReadLine());
        var aa = new int[n];
        for(int i=0; i<n; i++) {
            aa[i] = int.Parse(input.ReadLine());
        }

        Array.Sort(aa);

        Func<int, int ,long> sum = (s, e) => {
            long y = 0;
            for(int i=s; i<=e; i++) y+= aa[i];
            return y;
        };

        if(n % 2 == 0) {
            long y = 2 * (sum(n/2,n-1) - sum(0, n/2-1));
            long y1 = y + aa[n/2-1] - aa[n/2];
            return y1;
        } else {
            long y = 2 * (sum(n/2+1, n-1)  - sum(0, n/2));
            long y1 = y + aa[n / 2] + aa[n / 2 - 1];

            long z = 2 * (sum(n / 2, n - 1) - sum(0, n / 2-1));
            long z1 = z - aa[n/2] - aa[n/2+1];

            return Math.Max(y1, z1);
        }
    }

    static int[] ToIntArray(string strs, int n) {
        var ret = new int[n];
        var spl = strs.Split(' ');
        for (int i = 0; i < n; i++)
            ret[i] = int.Parse(spl[i]);
        return ret;
    }
}


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

int n;
int main() {
  int m;
  cin>>n>>m;
  vector<vector<int>>s(m);
  for(int i=0;i<m;i++){
    int x;
    cin>>x;
    for(int j=0;j<x;j++){
      int y;
      cin>>y;
      s[i].push_back(y);
    }
  }
  vector<int>p(m);
  for(int i=0;i<m;i++) cin>>p[i];
  int ans=0;
  for(int tmp=0;tmp<(1<<10);tmp++){
    bitset<10>l(tmp);
    bool check=true;
    for(int i=0;i<m;i++){
      int now=0;
      for(int j=0;j<s[i].size();j++){
        if(l.test(s[i][j]-1)) now++;
      }
      if(!(now%2==p[i])) check=false;
    }
    if(check && tmp<(1<<n)) ans++;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3636
#include <stdio.h>

int main(void)
{
    int a=0,b=0,c=0,d=0,count=0;
    scanf("%d %d %d %d",&a,&b,&c,&d);

    while(count!=100){
        c-=b;
        if(c<=0){
            printf("Yes");
            break;
        }
        a-=d;
        if(a<=0){
            printf("No");
            break;
        }
        count+=1;
    }

    return 0;
}


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

int main(){
  string s;
  cin >> s;
  int sw=0;
  for(int i=0;i<s.size();i++){
    for(int j=i+1;j<s.size();j++){
      if(s[i]==s[j]){
        sw=1;
        break;
      }
    }
  }
  if(sw==0)
    cout << "yes" << "\n";
  else
    cout << "no" << "\n";
  return 0;
}


Measured memory_bytes: 256
import collections
n = int(input())

def function(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
b = function(n)
c = collections.Counter(function(n))
ans = 0
for number in (c.values()):
  iter = 1
  flag = True
  while flag:
    number -= iter
    ans += 1
    iter += 1
    if number < iter:
      flag = False
print(ans)

Measured memory_bytes: 9468
#include <bits/stdc++.h>
// Hey! 僕の提出を見てくれてありがとう.
// ロボ子さん可愛いぞ！！！！！君もV沼にはまろう↓
// https://www.youtube.com/channel/UCDqI2jOz0weumE8s7paEk6g
using namespace std;
using ll = long long;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}//a,bの最大公約数(gcd)を求める
ll lcm(ll a,ll b){return abs(a*b)/gcd(a,b);}//a,bの最小公倍数(lcm)を求める
vector<ll> enum_div(ll n){vector<ll> ret;for(int i=1 ; i*i<=n ; i++){if(n%i == 0){ret.push_back(i);if(i!=1 && i*i!=n)ret.push_back(n/i);}}ret.push_back(n);return ret;}
//↑nの約数を求める
vector<bool> IsPrime; void sieve(size_t max){if(max+1 > IsPrime.size())IsPrime.resize(max+1,true);IsPrime[0] = false;IsPrime[1] = false;for(size_t i=2; i*i<=max; ++i)if(IsPrime[i])for(size_t j=2; i*j<=max; ++j)IsPrime[i*j] = false;}
//↑エラトステネスの篩で素数を求める
#define roundup(divisor,dividend) (divisor + (dividend - 1)) / dividend //切り上げ割り算
#define all(x) (x).begin(),(x).end() //xの初めから終わりまでのポインタ
#define size_t ll //size_tは自動でllに変換される
#define pb(x) push_back(x)
#define pri_queue priority_queue //優先度付きキュー
#define syo(x) fixed << setprecision(x) //iostreamで小数をx桁表示
//sortを降順にする時は greater<型>()
const string YES = "Yes";
const string NO = "No";
void solve(long long N, std::vector<long long> a){
  ll x = 0;
  for (int i = 0; i < N; i++) {
    x ^= a[i];
  }
  cout << (x ? NO : YES) << endl;
}

int main(){
    long long N;
	scanf("%lld",&N);
	std::vector<long long> a(N);
	for(int i = 0 ; i < N ; i++){
		scanf("%lld",&a[i]);
	}
    solve(N, std::move(a));
}


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

using namespace std;

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

    vector<int> A;
    for (int i=0; i<n; i++){
        int a;
        cin >> a;
        A.push_back(a);
    }

    sort(A.begin(), A.end());
    int i=0;
    for (; i<n && x>=0; i++){
        x-=A[i];
    }
    if (x!=0)

        i--;
    cout << i << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>

using namespace std;
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define RREP(i, a) for(int (i) = (a) - 1; (i) >= 0; (i)--)
#define FORR(i, a, b) for(int (i) = (a) - 1; (i) >= (b); (i)--)
#define DEBUG(C) cerr << #C << " = " << C << endl;
using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<LL>;
using VVL = vector<VL>;
using VD = vector<double>;
using VVD = vector<VD>;
using PII = pair<int, int>;
using PDD = pair<double, double>;
using PLL = pair<LL, LL>;
using VPII = vector<PII>;
template<typename T> using VT = vector<T>;
#define ALL(a) begin((a)), end((a))
#define RALL(a) rbegin((a)), rend((a))
#define SORT(a) sort(ALL((a)))
#define RSORT(a) sort(RALL((a)))
#define REVERSE(a) reverse(ALL((a)))
#define MP make_pair
#define FORE(a, b) for (auto &&a : (b))
#define FIND(s, e) ((s).find(e) != (s).end())
#define EB emplace_back
template<typename T> inline bool chmax(T &a, T b){if (a < b){a = b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if (a > b){a = b;return true;}return false;}

const int INF = 1e9;
const int MOD = INF + 7;
const LL LLINF = 1e18;
const double EPS = 1e-18;

//res[i] = n : i???n???
std::map<long long, int> PrimeFactorDecomposition(long long num) {
    std::map<long long, int> res;
    for (long long i = 2; i * i <= num; i++) {
        int cnt = 0;
        while(num % i == 0) cnt++, num /= i;
        if (cnt) res[i] = cnt;
    }
    if (num != 1) res[num] = 1;
    return res;
}

void solve(int p, int q) {
    auto pf = PrimeFactorDecomposition(q / __gcd(p, q));
    long long ans = 1;
    for (auto &&p : pf) ans *= p.first;
    cout << ans << endl;
    return;
}

signed main(void) {
    LL n, m, p, a, b, c, x, y, z, q;
    string s;
    bool f = false;
    while (cin >> n >> m, n) {
        solve(n, m);
        return 0;
    }
}

Measured memory_bytes: 3100
#include<bits/stdc++.h>
#define EM 100000000
using namespace std;
using LL = long long;
using P = pair<LL, LL>;
LL LINF = 1e18;
int INF = 1e9;
LL mod = 1e9+7;
using vint = vector<int>;
using vLL = vector<LL>;
using vvint = vector<vector<int>>;
using vvLL = vector<vector<LL>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
	int N, M;
	cin >> N >> M;
	vint a(M), b(M), cnt(N+1);
	for(int i = 0;i < M;i++){cin >> a[i] >> b[i];cnt[a[i]]++;cnt[b[i]]++;}
	bool f = true;
	for(int i = 1;i <= N;i++){if(cnt[i]&1){f = false;}}
	if(f){cout << "YES" << endl;}else{cout << "NO" << endl;}
}

Measured memory_bytes: 1408
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#define REP(i,a) for (int i = 0;i < (a);++i)
#define FOR(i,a,b) for (int i = (a);i < (b); ++i)
#define FORR(i,a,b) for (int i = (a);i >= (b); --i)
#define ALL(obj) (obj).begin,(obj).end()
#define SORT(list) sort(ALL((list)));
using namespace std;
using ll = long long;
int main(){
    vector <int> a(3);
    int k;
    REP(i,3){
        cin >> k;
        a[i] = k;
    }

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

    cout << a[0]*a[1]/2 << endl;
    

    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
	static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		String str = sc.nextLine();
		int res = 999;
		for (int i = 0; i + 2 < str.length(); i++) {
			int a = str.charAt(i) - '0';
			int b = str.charAt(i + 1) - '0';
			int c = str.charAt(i + 2) - '0';
			res = Math.min(res, Math.abs(a * 100 + b * 10 + c - 753));

		}
		System.out.println(res);

	}

}


Measured memory_bytes: 21716
from sys import setrecursionlimit
setrecursionlimit(1000000) 
N = int(input())
H = list(map(int, input().split()))
dp = [-1] * N

def memoize(i):
    if dp[i] >= 0:    
        return dp[i]
    else:
        ret = jump(i)
        dp[i] = ret
        return ret

def jump(i):
    if i == 0:
        return 0
    a = abs(H[i] - H[i - 1]) + memoize(i - 1)
    if i == 1:
        return a
    b = abs(H[i] - H[i - 2]) + memoize(i - 2)
    return min(a, b)

print(jump(N - 1))

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

int compare(pair<int, int> a, pair<int, int> b) {
  if (a.first == b.first) {
    return a.second < b.second;
  } else {
    return a.first < b.first;
  }
  
}

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

  int n; cin >> n;
  vector<pair<int, int>> arr;

  for (int i = 0; i < n; ++i) {
    int left, right; cin >> left >> right;
    arr.push_back({left, right});
  }

  sort(begin(arr), end(arr), compare);

  int seats = 0;
  pair<int, int> curr_group = arr[0];
  for (int i = 1; i < n + 1; ++i) {
    if (i == n || arr[i].first > curr_group.second) {
      seats += curr_group.second - curr_group.first + 1;
      curr_group = arr[i];
    } else {
      curr_group = {curr_group.first, max(curr_group.second, arr[i].second)};
    }
  }

  cout << seats << "\n";
}


Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main(){
  ll a,b;
  cin>>a>>b;
  vector<ll>vec(a);
  double c=0;
  for(ll i=1;i<=a;i++){
    ll d=i;
    for(ll j=0;d<b;j++){
      d=d*2;
    }
    vec.at(i-1)=d/i;
  }
  sort(vec.begin(),vec.end());
  ll k=0;
  double g=vec.at(a-1);
  
  for(ll i=0;i<a;i++){
    k+=g/vec.at(i);
  }
  
  
    
  cout<<fixed<<setprecision(15);
  cout<<k/(a*g)<<endl;
      
  return 0;
}


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

using namespace std;

const int Mod = 1e9 + 7, Nmax = 2e5 + 5;

int last[Nmax], C[Nmax], dp[Nmax];
int i, n;

int main()
{
 //   freopen("input", "r", stdin);
    cin.sync_with_stdio(false);

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

    dp[0] = 1;

    for(i=1; i<=n; ++i)
    {
        dp[i] = dp[i-1];
        if(last[C[i]] && last[C[i]] < i - 1)
        {
            dp[i] += dp[last[C[i]]];
            if(dp[i] >= Mod) dp[i] -= Mod;
        }
        last[C[i]] = i;
    }

    cout << dp[n] << '\n';

    return 0;
}


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

int main(){
    int N,K;
    cin >> N >> K;
    int cnt = 0;
    for(int i = 0;i < N;++i){
        int h;
        cin >> h;
        if(h >= K) cnt++;
    }
    cout << cnt << endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int d1[6], d2[6];
void _n() {
    int tmp = d2[0]; d2[0] = d2[1]; d2[1] = d2[5]; d2[5] = d2[4]; d2[4] = tmp;
}
void _s() {
    int tmp = d2[0]; d2[0] = d2[4]; d2[4] = d2[5]; d2[5] = d2[1]; d2[1] = tmp;
}
void _e() {
    int tmp = d2[0]; d2[0] = d2[3]; d2[3] = d2[5]; d2[5] = d2[2]; d2[2] = tmp;
}
void _w() {
    int tmp = d2[0]; d2[0] = d2[2]; d2[2] = d2[5]; d2[5] = d2[3]; d2[3] = tmp;
}
int getonemore(int i, int j) {
    if (i < 3 && j < 3)
        if (i < j)
            if (j-i==1)
                return 3-i-j;
            else
                return 5-(3-i-j);
        else
            if (i-j==1)
                return 5-(3-i-j);
            else
                return 3-i-j;
    else if (2 < i && 2 < j)
        if (i < j)
            if (j-i==1)
                return 12-i-j;
            else
                return 5-(12-i-j);
        else
            if (i-j==1)
                return 5-(12-i-j);
            else
                return 12-i-j;
    else if (2 < j) {
        int k = 5-j;
        if (i < k)
            if (k-i==1)
                return 5-(3-i-k);
            else
                return 3-i-k;
        else
            if (i-k==1)
                return 3-i-k;
            else
                return 5-(3-i-k);
    }
    else if (2 < i) {
        int k = 5-i;
        if (k < j)
            if (j-k==1)
                return 5-(3-j-k);
            else
                return 3-j-k;
        else
            if (k-j==1)
                return 3-j-k;
            else
                return 5-(3-j-k);
    }
    return 0;
}
void check() {
    for (int i = 0; i < 6; i++) {
        if (d1[0] == d2[i] && d1[5] == d2[5-i]) {
            for (int j = 0; j < 6; j++) {
                if (i == j || 5-i == j)
                    continue;
                if (d1[1] == d2[j] && d1[4] == d2[5-j]) {
                    int k = getonemore(i,j);
                    if (d1[2] == d2[k] && d1[3] == d2[5-k]) {
                        cout << "Yes\n";
                        return;
                    }
                }
            }
        }
    }
    cout << "No\n";
}
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    for (int i = 0; i < 6; i++)
        cin >> d1[i];
    for (int i = 0; i < 6; i++)
        cin >> d2[i];
    check();
}

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


signed main()
{
	int n;
	cin>>n;
	int wt;
	cin>>wt;
	int w[n],v[n];
	for(int i=0;i<n;i++)
	{
		cin>>w[i];
		cin>>v[i];
	}
	int a[wt+1],b[wt+1];
	//initialization:
	for(int i=0;i<w[0];i++)
	{
		a[i]=0;
	}
	for(int i=w[0];i<=wt;i++)
	{
		a[i]=v[0];
	}
	for(int i=2;i<=n;i++)
	{
		for(int j=0;j<w[i-1];j++)
		{
			b[j]=a[j];
		}
		for(int j=w[i-1];j<=wt;j++)
		{
			b[j]=max(a[j],a[j-w[i-1]]+v[i-1]);
		}
		for(int j=0;j<=wt;j++)
		{
			a[j]=b[j];
		}
	}
	cout<<a[wt]<<endl;
	return 0;
}


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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
#define debug(x) cerr << #x << ": " << x << endl
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2018/02/23  Problem: 005_agc_b / Link: https://agc005.contest.atcoder.jp/tasks/agc005_b?lang=en  ----- */
/* ------問題------

すぬけ君はある日友人から長さ N の順列 a1,a2,…,aN を貰いました。

ΣΣmin(A_l,...,A_r)

を求めてください。

-----問題ここまで----- */
/* -----解説等-----

値iが持ちうる区間を考える。
値iの右側と左側に小さいものがあるとき、どれだけ距離が離れているかがわかればよい。
これは簡易setがあればできる。
setでもできる…

----解説ここまで---- */


template<typename type>
struct BIT0 { // 0-index
	int N;
	int nn;
	vector<type> data;
	//動的はmap<int?,type>data
	BIT0(int n) {
		N = n + 1;
		data = vector<type>(n + 1, 0);
		nn = 1;
		while (nn * 2 <= N)nn *= 2;
	}
	void add(int i, type w) {
		// a[i] += w
		i++;
		for (int x = i; x < N; x += x & -x) {
			data[x] += w;
		}
	}
	type sum(int i) {
		// iまでの和 [0,i)
		type ret = 0;
		for (int x = i; x > 0; x -= x & -x) {
			ret += data[x];
		}
		return ret;
	}
	// [l, r)
	type sum(int l, int r) {
		return sum(r) - sum(l);
	}

	int lower_bound(type w) {
		//  w≦[0,x]以上となる最小のindex,x
		if (w <= 0) return 0;
		int x = 0;
		for (int k = nn; k > 0; k /= 2) {
			if (x + k <= N && data[x + k] < w) {
				w -= data[x + k];
				x += k;
			}
		}
		return x + 1;
	}
};

LL N;

LL ans = 0LL;

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

	cin >> N;
	VI a(N + 10);
	VI ra(N + 10);
	FOR(i, 0, N) {
		cin >> a[i];
		ra[a[i]] = i;
	}
	BIT0<int>bit(N + 10), rbit(N + 10);
	FOR(i, 1, N + 1) {
		int l = bit.lower_bound(bit.sum(ra[i]));
		int r = N-1  - rbit.lower_bound(rbit.sum(N - 1 - ra[i]));
		//cout << l << "," << r << endl;

		ans += i*(LL)(r - ra[i]+1)*(ra[i] - l+ 1 );
		bit.add(ra[i], 1);
		rbit.add(N - 1 - ra[i], 1);
	}
	cout << ans << "\n";

	return 0;
}


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

int main()
{
	int flag = 1, tmp, n, a[100], count = 0;
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> a[i];
	while (flag)
	{
		flag = 0;
		for (int i = n - 1; i > 0; i--)
			if (a[i] < a[i - 1])
			{
				tmp = a[i];
				a[i] = a[i - 1];
				a[i - 1] = tmp;
				count++;
				flag = 1;
			}
	}
	for (int i = 0; i < n; i++)
	{
		if (i)
			cout << " ";
		cout << a[i];
	}
	cout << endl << count << endl;

	return 0;
}


Measured memory_bytes: 3128
#include <stdio.h>
 
int main(){
  int n,x,a,i,j,k;
  
  while(1){
    scanf("%d %d",&n,&x);
    
    if ( n == 0 && x == 0 ){
      break;
    }
    
    for ( i = 1; i <= n; i++){
      for ( j = 1; j <= n; j++){
    for ( k = 1; k <= n; k++){
          
          if ((i + j + k) == x && i != j && j != k && k != i)
          a += 1;
    }
      }
    }
    
    printf("%d\n",a/6);
    a = 0; 
  }
  return 0;
}


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

int main()
{
	int x, q, q1;
	scanf("%d", &x);
	q= x/100;
	q1= (x+104)/105;

	if (q>= q1){
		cout<<1;
	}
	else{
		cout<<0;
	}
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<cctype>
#include<cstring>
#include<cmath>
#include<string>
#include<algorithm>
#include<queue>
#include<stack>
using namespace std;

int main() {
    int x, ans = 0;
    cin >> x;
    long long hen[x];
    for (int i = 0; i < x; i++) {
        cin >> hen[i];
    }
    sort(hen, hen+x);
    for (int i = 0; i < x-2; i++) {
        for (int j = i+1; j < x-1; j++) {
            if (hen[i] == hen[j]) {
                continue;
            }
            for (int k = j+1; k < x; k++) {
                if (hen[j] == hen[k]) {
                    continue;
                }
                if (hen[i] + hen[j] > hen[k]) {
                    ans++;
                }
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3080
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#include<stdbool.h>
typedef long long ll;
typedef long double ld;
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define rrep(i,l,r)for(ll i=(l);i>=(r);i--)
#define INF (1LL<<60)
#define MOD1 1000000007
#define MAX_N (1 << 17)
#define YES printf("Yes\n")
#define NO printf("No\n")


void swap(ll *a, ll *b){ll c;c=*b;*b=*a;*a=c;}
ll max2(ll a,ll b){return a>=b?a:b;}
ll min2(ll a,ll b){return a>=b?b:a;}
ll minn(ll n, ll a[n]){ll b=INF;rep(i,0,n) b=min2(b,a[i]);return b;}
ll maxn(ll n, ll a[n]){ll b=-INF;rep(i,0,n) b=max2(b,a[i]);return b;}
ll ABS(ll a){return a>=0?a:(-a);}
ll POW(ll a, ll b){ll c=1;rep(i,0,b) c*=a;return c;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}

typedef struct{
    ll aa;
    ll bb;
}frequent;

int main(void){
    // char ;
    ll n,k,ans=0;
    scanf("%lld%lld",&n,&k);
    // ll [n];
    if(k%2){
        ans+=POW(n/k,3);
    }else{
        ans+=POW(n/k,3)+POW( (n+k/2)/k ,3 );
    }
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 128
#include <algorithm>
#include <array>
#include <climits> // INT_MAX, LONG_MAX, LLONG_MAX, UINT_MAX, ULONG_MAX, ULLONG_MAX
#include <cmath>
#include <cstdint>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <vector>

#define INF 1e9
#define REP(i,n) for (int i = 0; i < (n); ++i)
#define LOG(x) cerr << #x << " = " << (x) << endl

using namespace std;

int N;
int a[300][300];

int main() {
    cin >> N;

    REP(i, N) REP(j, N) {
        int ai;
        cin >> ai;
        a[i][j] = ai;
    }

    bool check = true;
    long long minDist = 0;

    REP(i, N) REP(j, N) {
        if (!check)
            break;
        
        if (i >= j)
            continue;

        bool shoudSkip = false;
        REP(k, N) {
            if (k == i || k == j)
                continue;
            
            if (a[i][k] + a[k][j] < a[i][j]) {
                check = false;
                break;
            }
            if (a[i][k] + a[k][j] == a[i][j])
                shoudSkip = true;
        }
        if (!shoudSkip)
            minDist += 1ll * a[i][j];
    }

    cout << (long long)(check ? minDist : -1) << endl;
    
    return 0;
}


Measured memory_bytes: 640
import kotlin.math.sqrt
fun main() {
    // 文字列
//    var n = readLine()!!.toInt()
//    val x: String = readLine()!!
    // 数値
//    val int =readLine()!!.toInt()
    // 行
//    val list = readLine()!!.split(" ").map (String::toInt )
    val (n,d) = readLine()!!.split(" ").map(String::toInt)
    val xys = List(n) {
        readLine()!!.split(" ").map(String::toLong)
    }
    var sum=0
    for (xy in xys){
        val moto= sqrt((xy[0]*xy[0]+xy[1]*xy[1]).toDouble())
        if (d>= moto){

            sum++
        }
    }
    print(sum)
//    var k = readLine()!!.toInt()
}

Measured memory_bytes: 83968
#include <math.h>

#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
#define PI 3.14159265359
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define SIZE_OF_ARRAY(array) (sizeof(array) / sizeof(array[0]))

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

  cout << 24 + 24 - M << endl;

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
       int N,i,j,k,c=0;
       cin>>N;
       for(i=1;i<=N;i++)for(j=1;j<=N;j++)for(k=1;k<=N;k++)
       c++;
       cout<<c<<endl;
return 0;
}

Measured memory_bytes: 256
if isfile("mystdin.txt");mystdin=open("mystdin.txt","r");redirect_stdin(mystdin);end
pI(x)=parse(Int,x)
pM(x::Array{SubString{String},1})=map(pI,x)
function main()
  h,w=parse.(Int,split(readline()))
  a=[chomp(readline()) for i = 1:h]
  tate=Bool[false for i=1:h]
  yoko=Bool[false for i=1:w]
  for i=1:h
    for j=1:w
      if a[i][j]=='#'; tate[i]=true; yoko[j]=true; end
    end
  end
  for i=1:h
    flag=false
    for j=1:w
      if tate[i]==true && yoko[j]==true; print(a[i][j]);flag=true; end
    end
    if flag == true; println(); end
  end
end
main()
if isdefined(Base, :mystdin);close(mystdin);end

Measured memory_bytes: 179100
#include<iostream>
#include<algorithm>
#include<bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define int long long
#define pi 3.141592653589793238462643383279502
#define M 1000000007
#define F first
#define S second
#define pii pair<int,int>
#define rep(i,n) for(int i=0;i<n;i++)
bool isPowerOfTwo(int n)
{
   if(n==0)
   return false;

   return (ceil(log2(n)) == floor(log2(n)));
}
int power(int x, unsigned int y)
{
    if (y == 0)
        return 1;
    else if (y % 2 == 0)
        return power(x, y / 2) * power(x, y / 2);
    else
        return x * power(x, y / 2) * power(x, y / 2);
}

signed main()
{
int n;
cin>>n;
int a[n];
int flag=0;
for(int i=0;i<n;i++)
    {cin>>a[i];
    if(a[i]%2==0)
    {
        if(a[i]%3!=0&&a[i]%5!=0)
            flag=1;
    }
    }
if(flag==0)
    cout<<"APPROVED"<<endl;
else
    cout<<"DENIED"<<endl;

}





Measured memory_bytes: 256
import sys
#input = sys.stdin.buffer.readline


#sys.setrecursionlimit(10**9)
#from functools import lru_cache

def RD(): return sys.stdin.read()
def II(): return int(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int,input().split()))
def LF(): return list(map(float,input().split()))
def TI(): return tuple(map(int,input().split()))
# rstrip().decode()

#import numpy as np
from collections import deque

def main():
	n=II()
	G=[]
	for i in range(n):
		G.append(list(map(int,input())))
		#print(G)

	ans=0
	for i in range(n):
		v=[-2]*n
		v[i]=0
		q=deque()
		q.append([i,0])

		while q:
			now,d=q.popleft()
			for j in range(n):
				if G[now][j]==1:
					if v[j]==-2:
						v[j]=d+1
						q.append([j,d+1])
					elif v[j]==d-1 or v[j]==d+1:
						continue
					else:
						print(-1)
						exit(0)
		ans=max(ans,max(v)+1)


	print(ans)

if __name__ == "__main__":
	main()


Measured memory_bytes: 74908
from copy import deepcopy
n, m, q = map(int, input().split())
tuples = [tuple(map(int, input().split())) for i in range(q)]
As = [[1]*n]
def next(A, i):
    if i == 0 and A[i] == m:
        return
    if A[i] == m:
        next(A, i-1)
    elif A[i] < m:
        if (i < n - 1 and A[i] < A[i+1]) or (i == n-1):
            A1 = deepcopy(A)
            A1[i] += 1
            As.append(A1)
            next(A1, i)
        if i > 0 and A[i] > A[i-1]:
            A2 = deepcopy(A)
            next(A2, i-1)
    elif i == 0:
        A1 = deepcopy(A)
        next(A1, n-1)
next([1]*(n), n-1)
def check(A):
    score = 0
    for a, b, c, d in tuples:
        if A[b-1] - A[a-1] == c:
            score += d
    return score
ans = 0
for A in As:
    score = check(A)
    ans = max(ans, score)
print (ans)

Measured memory_bytes: 27836
#include <iostream>
using namespace std;
int main()
{
    int r,g,b;
    cin >> r >> g >> b;
    int x = r*100 + g*10 + b;
    if(x % 4 == 0)
    {
        cout << "YES" << endl;
    }
    else
    {
        cout << "NO" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <fstream>
#include <algorithm>
#include <iterator>
#include <math.h>
#include <cmath>
#include <stdlib.h>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <regex>
#include <stdexcept>
#include <unordered_set>
#include <string>
#include <map>
#include <iomanip>
#include <sstream>
#include <cassert>
#include <time.h>
#include <numeric>
#include <complex>

using namespace std;
using ull = unsigned long long;
using ll = long long;
using ld = long double;
using D = double;
using ii = pair<int, int>;
using vi = vector<int>;
using vii = vector<ii>;

#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(), x.rend()
#define fill(x, y) memset(x, y, sizeof(x))
#define makeunique(x) sort(all(x)), (x).resize(unique(all(x)) - (x).begin())
#define rep(i, x)  for(int i = 0; i < (x); i++)
#define rrep(i, x) for(int i = (x - 1); i >= 0; i--)
#define y1 y1_1234413
#define j1 j1_235
#define y0 y0_235
#define j0 j0_256
#define fi first
#define se second
#define itn int
#define re return
#define prev PREV
#define next NEXT

#define sz(x) ((int)x.size())

const int inf = 2e9;
const ld st = 0.000001;
const ld pi = acos((ld)-1);
const int maxn = 2*1000005;

#define FILENAME ""
 
ll dp[3001][3001];
pair<ll, ll> p[3001][3001];
string s, s1;

void solve (ll i, ll j) {
    if (i == 0 || j == 0) return;
    if (p[i][j] == mp(i - 1, j - 1)) {
        solve (i - 1, j - 1);
        cout << s[i - 1];
    }
    else {
        if (p[i][j] == mp(i - 1, j)) {
            solve(i - 1, j);
        }
        else {
            solve(i, j - 1);
        }
    }
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> s >> s1;
    ll m = s.size();
    ll n = s1.size(); 
    for (int i = 0; i < m; i++) {
        dp[i][0] = 0;
    }
    for (int i = 0; i < n; i++) {
        dp[0][i] = 0;
   }
   for (int i = 1; i <= m; i++) {
        for (int j = 1; j <= n; j++) {
            if (s[i - 1] == s1[j - 1]) {
                dp[i][j] = dp[i - 1][j - 1] + 1;
                p[i][j] = mp(i - 1, j - 1);
            }
            else {
                if (dp[i - 1][j] >= dp[i][j - 1]) {
                    dp[i][j] = dp[i - 1][j];
                    p[i][j] = mp(i - 1, j);
                }
                else {
                    dp[i][j] = dp[i][j - 1];
                    p[i][j] = mp(i, j - 1);
                }
            }
        }
    }
    solve(m, n);
    return 0;
}

Measured memory_bytes: 211456
//BISMILLAH
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,countt,flag=0;
    cin>>n;
    long long sum=0;
    for(int i=0;i<=n;i++)
    {
        if(i%3==0 || i%5==0){

        }

            else
            sum+=i;
    }
    cout<<sum<<endl;
}

Measured memory_bytes: 3628
#include <stdio.h>


int main(void) {

	// 1_5-A Print a Rectangle

	int h,w;
	int i,j;
	
	scanf("%d %d",&h,&w);

	while(h!=0 && w!=0){
		for(i=0; i<h; i++){
			for(j=0; j<w; j++){
				printf("#");
			}
			printf("\n");
		}
		printf("\n");
		scanf("%d %d",&h,&w);
	}
        return 0;
}

Measured memory_bytes: 572
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdlib>
#include <queue>
#include <cstring>
#include <set>
#include <map>

using namespace std;

const int maxN = 310;

#define FORU(i, l, r) for (int i = l; i <= r; ++i)
#define FORD(i, r, l) for (int i = r; i >= l; --i)
#define REPU(i, r) for (int i = 0; i < r; ++i)
#define LL long long
#define F first
#define S second
#define MP make_pair
#define PB push_back
#define PINT pair < ll, int >
#define BIT(x, i) ((x >> i) & 1)
#define NUM_SET_BIT __builtin_popcountll

int n, m, a[maxN][maxN], check[maxN], res, sport[maxN], fav[maxN];
vector < int > participant[maxN];

bool solve(int cap) {
    FORU(i, 1, m) participant[i].clear(), check[i] = 1;
    FORU(i, 1, n) sport[i] = 0, fav[i] = 1;
    while (true) {
        bool ok = true;
        FORU(i, 1, n) {
            if (!sport[i] || !check[sport[i]]) {
                if (fav[i] > m) return false;
                ok = false;
                sport[i] = a[i][fav[i]];
                participant[a[i][fav[i]++]].PB(i);
            }
        }
        if (ok) return true;
        FORU(i, 1, m)
            if (participant[i].size() > cap) check[i] = 0;
    }
    return true;
}

int main() {
    cin >> n >> m;
    FORU(i, 1, n)
        FORU(j, 1, m) cin >> a[i][j];
    int l = 1, r = n;
    while (l <= r) {
        int mid = (l + r) >> 1;
        if (solve(mid)) r = mid - 1, res = mid;
        else l = mid + 1;
    }
    cout << res;
}


Measured memory_bytes: 1280
/****************
 *		*
 *ALDS1_4_C:	*
 *Dictionary	*
 *		*
 *2019/08/17	*
 ****************/

#include<cstdio>
#include<cstring>


#define M 1100000
#define L 15

char array[M][L];

inline long long h1(unsigned int key){
  return (long long)key % M;
}

inline long long h2(unsigned int key){
  return (long long)(3*key) % (M-1);
}

unsigned int getKey(char *str){
  unsigned int key = 0;

  for(int i=0;i<(int)strlen(str);i++){
    if(str[i] == 'A') key += 5*(i+7);
    else if(str[i] == 'C') key += 11*(i+7);
    else if(str[i] == 'G') key += 17*(i+7);
    else if(str[i] == 'T') key += 19*(i+7);
    else key += 0;
  }
  return key;
}


void insert(char *str){
  long long height;
  unsigned int key = getKey(str);

  for(long long i=1; ;i++){
    height = (h1(key) * h2(key) + i )%M;
    if(strcmp(array[height],str) == 0) return;
    else {
      if(strlen(array[height]) == 0){
	strcpy(array[height],str);
	return;
      }
    }
  }
}

bool find(char *str){
  long long height;
  unsigned int key = getKey(str);

  for(long long i=1; ;i++){
    height = (h1(key) * h2(key)+ i)%M;
    if(strcmp(array[height],str) == 0) return true;
    else {
      if(strlen(array[height]) == 0){
	return false;
      }
    }
  }
}

int main(){

  long long n=0;
  char order[10],str[L];

  for(long long i=0;i<M;i++) array[i][0] = '\0';
  
  scanf("%lld",&n);
  for(long long i=0;i<n;i++){
    scanf("%s %s",order,str);
    if(order[0] == 'i') insert(str);
    
    else {
      if(order[0] == 'f') {
	if(find(str))
	  printf("yes\n");
	else
	  printf("no\n");
      }
      else fprintf(stderr,"%s is not order\n",order);
    }
  }
  return 0;
}



Measured memory_bytes: 18856
#include <bits/stdc++.h>
 
#define rep(i, x, n) for (int i = x; i < n; i++)
typedef long long ll;
 
const int INF = 1e9 + 7;
 
using namespace std;
 
int main()
{
	cin.tie(0); ios::sync_with_stdio(false);
 
	int n;
	cin >> n;

	string s;
	map<string, int> ana;
	ll res = 0;

	rep (i, 0, n) {
	    cin >> s;
	    sort(s.begin(), s.end());

	    auto it = ana.find(s);
	    if (it == ana.end()) {
		ana.insert(make_pair(s, 0));
	    } else {
		res++;
		res += (it->second);
		it->second++;
	    }
	}

	cout << res << endl;

	return 0;
}

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

#define int long long
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define Rep(i, n) for( int i = 0; i < (n); i++ )
#define Rrep(i, a, n) for( int i = (a); i < (n); i++ )
#define All(v) v.begin(), v.end()

typedef pair<int, int> Pii;
typedef pair<int, Pii> Pip;
const int INF = 1107110711071107;
int N;
int a[100001], b[100001], c[100001];
int aa[100001], bb[100001];
int ruiseki[100001] = {0};
signed main() {


    cin >> N;
    Rep(i, N) cin >> a[i];
    Rep(i, N) cin >> b[i];
    Rep(i, N) cin >> c[i];

    sort(a, a+N);
    sort(b, b+N);
    sort(c, c+N);

    Rep(i, N) {
        bb[i] = c+N - upper_bound(c, c+N, b[i]);
    }
    ruiseki[N-1] = bb[N-1];
    for ( int i = N-2; i >= 0; i-- ) {
        ruiseki[i] = bb[i] + ruiseki[i+1];
    }

    int ans = 0;
    Rep(i, N) {
        ans += ruiseki[upper_bound(b, b+N, a[i]) - b];
    }

    cout << ans << endl;
}


Measured memory_bytes: 4480
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b,ans=0;
	cin>>a>>b;
	for(int i=a;i<=b;i++){
		string s=to_string(i),rev=s;
		reverse(rev.begin(),rev.end());
		if(s==rev)
			ans++;
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int a = sc.nextInt();
		int b = sc.nextInt();
	    
	    int area = a * b;
	    int Perimeter = a * 2 + b * 2;
		System.out.println(area + " " + Perimeter);
	}
}


Measured memory_bytes: 26304
n,y = (int(num) for num in input().split())
ans = '-1 -1 -1'
for i in range(n+1):
    if ans != '-1 -1 -1':
        break
    for j in range(n+1):
        n_10 = n-i
        n_5 = n-j
        n_1 = (y-10000*n_10-5000*n_5)//1000
        if n_10 + n_5 + n_1 == n and n_1>=0:
            ans = str(n_10) + ' ' + str(n_5) + ' ' + str(n_1)
            break
            
print(ans)

Measured memory_bytes: 3064
/*
ID: Nipun Paul
LANG: C++
PROB: God knows
*/

#include<bits/stdc++.h>
using namespace std;

int main()
{
    char b[4];
    cin>>b;
    sort(b,b+strlen(b));
    if(b[0]==b[1] && b[2]==b[3] && b[0]!=b[3])
    {
        cout<<"Yes"<<endl;
    }
    else
    {
        cout<<"No"<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
N = int(input())
L = [0] * N

for x in range(1, 101):
    for y in range(1, 101):
        for z in range(1, 101):
            calc = x**2 + y**2 + z**2 + x*y + y*z + z*x
            if calc > N:
                break
            else:
                L[calc-1] += 1

for l in L:
    print(l)

Measured memory_bytes: 9432
#include<bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
typedef long long ll;
#define rep(i,a,n) for(int i=a;i<n;i++)
#define rrep(i,n,a) for(int i=n;i>=a;i--)
#define FOR(i,n) for(int i=0;i<n;i++)
#define all(s) s.begin(),s.end()
#define vi vector<int>
#define vvi vector<vector<int>>
#define pcnt(n) __builtin_popcount(n)
const int MOD = 1e9 + 7;
//const int MOD = 998244353;
const int INF = 1e18;
const double PI = acos(-1);

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    string s,t;
    cin>>s>>t;
    t.pop_back();
    cout<<(s==t?"Yes":"No");
}

Measured memory_bytes: 3652