akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>  //sort,二分探索,など
#include <array>
#include <bitset>         //固定長bit集合
#include <cmath>          //pow,logなど
#include <complex>        //複素数
#include <deque>          //両端アクセスのキュー
#include <functional>     //sortのgreater
#include <iomanip>        //setprecision(浮動小数点の出力の誤差)
#include <iostream>       //入出力
#include <map>            //map(辞書)s
#include <numeric>        //iota(整数列の生成),gcdとlcm(c++17)
#include <queue>          //キュー
#include <set>            //集合
#include <stack>          //スタック
#include <string>         //文字列
#include <unordered_map>  //イテレータあるけど順序保持しないmap
#include <unordered_set>  //イテレータあるけど順序保持しないset
#include <utility>        //pair
#include <vector>         //可変長配列

using namespace std;
typedef long long ll;

#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = (ll)(n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define FORD(i, a, b) for (ll i = (a); i >= (b); i--)
#define ALL(x) (x).begin(), (x).end()  // sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size())  // sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000
#define MOD 10000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

int main() {
  long double l;
  cin >> l;
  cout << setprecision(15) << l * l * l / 27 << endl;
}

Measured memory_bytes: 256
<?php
$N =trim(fgets(STDIN));
$K = trim(fgets(STDIN));
$X = trim(fgets(STDIN));
$Y = trim(fgets(STDIN));
if ($N<=$K){
   echo $N*$X;
}else{
   echo $K*$X+$Y*($N-$K);
}



Measured memory_bytes: 3576
//おまじない
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#define INF 1e9+7
#define roop(i,m,n) for(int i=m;i<n;i++)
#define mroop(i,m,n) for(int i=m;i<n;i--)
#define NO cout<<"NO"<<endl;
#define YES cout << "YES"<<endl;
#define No cout << "No"<<endl;
#define Yes cout << "Yes"<<endl;
using namespace std;
typedef long long int ll;

//(int)'a'は97 (int)'A'は65
//おまじない



int main() {

	char a[101],b[101],c[101];
	int na = 0, nb = 0, nc = 0;

	cin >> a >> b >> c;

	for (int i = 0; a[i] != '\0'; i++) {
		na++;
	}

	for (int i = 0; b[i] != '\0'; i++) {
		nb++;
	}

	for (int i = 0; c[i] != '\0'; i++) {
		nc++;
	}

	
	int turn = 0;
	int ta = 0, tb = 0, tc = 0;
	char win[2];
	win[1] = '\0';
	int k = 0;

	while (k==0) {
		if (na == ta&&turn==0) {
			win[0] = 'A';
			break;
		}
	    if (nb == tb && turn== 1) {
			win[0] = 'B';
			break;
		}
		if (nc == tc && turn == 2) {
			win[0] = 'C';
			break;
		}

		if (turn == 0) {
			turn = (int)a[ta] - 97;
			ta += 1;
		}
		else if (turn == 1) {
			turn = (int)b[tb] - 97;
			tb += 1;
		}
		else if(turn==2){
			turn = (int)c[tc] - 97;
			tc+=1;
		}
	}



	cout << win << endl;


	return 0;
}


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

int main() {
    string S;
    cin >> S;
    int n1 = stoi(S.substr(0, 2));
    int n2 = stoi(S.substr(2, 2));
    int m1, m2;
    if (n1 >= 1 && n1 <= 12) {
        m1 = 1;
    } else {
        m1 = 0;
    }
    if (n2 >= 1 && n2 <= 12) {
        m2 = 1;
    } else {
        m2 = 0;
    }
    if (m1 && m2) {
        cout << "AMBIGUOUS" << endl;
    } else if (m1 && !m2) {
        cout << "MMYY" << endl;
    } else if (!m1 && m2) {
        cout << "YYMM" << endl;
    } else {
        cout << "NA" << endl;
    }


    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define dunk(a) cout << (a) << endl
using namespace std;
typedef long long ll;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	vector<char> s(n);
	rep(i, n) cin >> s[i];

	set<char> st;

	rep(i, n) {
		st.insert(s[i]);
	}

	if (st.size() == 4) puts("Four");
	else puts("Three");

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
  int n,i,c=0;
  long S[10001],q;
  scanf("%d\n",&n);
  for(i=0;i<n;i++) scanf("%ld",&S[i]);
  scanf("\n"); scanf("%ld\n",&q);
  for(i=0;i<q;i++) {
    long t;
    scanf("%ld",&t);
    int j=0;
    S[n]=t;
    while (S[j]!=t) j++;
    if(j<n) c++;
  }
  printf("%d\n",c);
  return 0;
}

Measured memory_bytes: 676
import sys
import heapq
from operator import itemgetter
from collections import deque, defaultdict
from bisect import bisect_left, bisect_right
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

def sol():
    N = int(input())
    A = [int(input()) for _ in range(N)] + [0]

    partialSum = 0
    ans = 0
    for a in A:
        if a == 0:
            ans += partialSum // 2
            partialSum = 0
        else:
            partialSum += a

    print(ans)

sol()

Measured memory_bytes: 8180
N, M = map(int,input().split())
state = []
for _ in range(M):
  lst = list(map(int, input().split()))
  state.append(lst[1:])#switch numbers each denkyu
p = list(map(int, input().split()))#numbers switches on %2 == pi 
ans = 0
for i in range(2**N):
  total = 0
  for j in range(M):
    cnt = 0
    for s in state[j]:
      s -= 1
      if (i >> s) & 1:#全スイッチのパターン一つ一つについて、各電球の各スイッチがオンになっているか
        cnt += 1
    cnt %= 2
    if cnt == p[j]:
      total += 1
  if total == M:
    ans += 1
print(ans)

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

using namespace std;

#define PI 3.1415926535897932

//typedef long long ll;


int lcm(int a,int b) { return a*b/__gcd(a,b); }
//ll lcm(ll a,ll b) { return a*b/__gcd(a,b); }

/**
 * vector<int>ar(3);
 * for(auto&e:ar){
 *     scanf("%d",&e);
 * }
 * sort(ar.begin(),ar.end())
 * int sum=accumulate(ar.begin(),ar.end(),0);
 **/


int main(){
    int mod=1000000007;
    int n,m;
    scanf("%d",&n);
    printf("%s\n",n>999?"ABD":"ABC");

    return 0;
}

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


int main() {
    int K, S;
    cin >> K >> S;
    ll num_triples = 0;
    for (int X = 0; X <= K; X++) {
        for (int Y = 0; Y <= K; Y++) {
            int Z = S - X - Y;
            if (Z >= 0 && Z <= K) num_triples += 1;
        }
    }
    cout << num_triples << "\n";
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define del(a,i) memset(a,i,sizeof(a))
#define ll long long
#define inl inline
#define il inl void
#define it inl int
#define ill inl ll
#define re register
#define ri re int
#define rl re ll
#define INF 0x3f3f3f3f
#define lowbit(x) (x&(-x))
#define mid ((l+r)>>1)
using namespace std;
template<class T>il read(T &x){
	x=0;int f=1;char k=getchar();
	for(;k>'9'||k<'0';k=getchar()) if(k=='-') f=-1;
	for(;k>='0'&&k<='9';k=getchar()) x=x*10+k-'0';
	x*=f;
}
template<class T>il _print(T x){
	if(x>9) _print(x/10);
	putchar(x%10+'0');
}
template<class T>il print(T x){
	if(x<0) putchar('-'),x=-x;
	_print(x);
}
const int N = 1e2+5;
int n,k,bit[N],cnt;
char s[N];
double dp[N][N];
double DFS(int pos,int pre,int limit,int num){
	if(!pos) return num==k;
	if(!limit&&pre&&dp[pos][num]!=-1)
		return dp[pos][num];
	int up=limit?bit[pos]:9;
	double ans=0;
	for(ri i=0;i<=up;++i)
		ans+=DFS(pos-1,pre||i,limit&&(i==up),num+(i!=0));
	if(pre&&!limit) dp[pos][num]=ans;
	return ans;
}
int main(){
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	scanf("%s",s+1),read(k);
	n=strlen(s+1);
	for(ri i=0;i<=n;++i)
		for(ri j=0;j<=n;++j)
			dp[i][j]=-1;
	for(ri i=n;i;--i)
		bit[++cnt]=s[i]-'0';
	printf("%.0f",DFS(cnt,0,1,0));
	return 0;
}

Measured memory_bytes: 384
import numpy as np

H, N = map(int, input().split())
AB = np.array([list(map(int, input().split())) for i in range(N)])
A = AB[:, 0]
B = AB[:, 1]

# インデックスはライフ 値はそれを以下にする最小MP
dp = np.array([0 for i in range(H+1)])

for i in range(1, H+1):
    dp[i] = np.min(dp[np.maximum(i - A, 0)] + B)

print(dp[-1])

Measured memory_bytes: 14692
#include<stdio.h>
#include<iostream>
#include<cmath>
using namespace std;

int main(){
    int n;
    cin >> n;
    while(n!=0){
        double s[1000]={},sum=0,a=0;
        for(int i=0; i<n; i++){
            cin >> s[i];
            sum += s[i];
        }
        for(int i=0; i<n; i++){
            a+=(((sum/n)-s[i])*((sum/n)-s[i]))/n;
        }
        printf("%.5f\n", sqrt(a));
        cin >> n;
    }
    return 0;
}



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

int main() {
  int N;
  cin >> N;
  string s;

  for (int i = 0; i < N; i++) {
    cin >> s;
    if (s == "Y") {
      cout << "Four" << endl;
      break;
    }
    if (i == (N - 1)) {
      cout << "Three" << endl;
    }
  }
}


Measured memory_bytes: 256
//Code is like humor. When you have to explain it, it’s bad.
#define fastio ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#include <bits/stdc++.h>
#define MOD 1000000007
#define int long long
using namespace std;
#define ss second
#define ff first
int32_t main()
{
    fastio;
    int T,n,m,i,j,k,a,b,c;
    T=1;
    string str;
    while(T --> 0)
    {
        cin>>n>>str;
        vector<int> R,G;
        unordered_map<int,bool> B;
        for(i=0;i<n;i++)
        if( str[i] == 'R')
            R.emplace_back(i);
        else if( str[i] == 'G')
            G.emplace_back(i);
        else
            B[i]=true;

        m=B.size();
        int ans=R.size()*G.size()*m;
        for(auto a:R)
        for(auto b:G)
        {
            if( (a+b)%2==0 and B[(a+b)/2] )
                ans--;
            if( B[2*a-b])
                ans--;
            if( B[2*b-a])
                ans--;
        }
        cout<<ans;
    }
    return 0;
}

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

int main()
{
   int N;
   cin >> N;
   int sum = 0;

   for (int i=0;i<8;i++)
   {  
      int a,b;
      a = N / pow(10,i);
      b = N / pow(10,i+1);
      sum += a - b*10 ;
   }

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

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <queue>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
struct edge{int from, to, cost;};
#define INF 1000000001

int V,E,d[1005];
edge es[2005];

bool find_negative_loop(int s){
	int cnt=0;
	for(int i=0;i<V;i++)d[i]=INF;
	d[s]=0;
	while(1){
		bool update=false;
		cnt++;
		for(int i=0;i<E;i++){
			edge e=es[i];
			if(d[e.from]!=INF&&d[e.to]>d[e.from]+e.cost){
				d[e.to]=d[e.from]+e.cost;
				if(cnt==V)return true;
				update=true;
			}
		}
		if(!update)break;
	}
	return false;
}

int main(void){
	int r;
	cin>>V>>E>>r;
	for(int i=0;i<E;i++){
		cin>>es[i].from>>es[i].to>>es[i].cost;
	}
	if(find_negative_loop(r)){
		cout<<"NEGATIVE CYCLE\n";
	}else{
		for(int i=0;i<V;i++){
			if(d[i]==INF)cout<<"INF\n";
			else cout<<d[i]<<endl;
		}
	}
	return 0;
}



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

int main() {
  int A, B, T;
  int cookies = 0;
  
  cin >> A >> B >> T;
  
  while (T > 0) {
    if (T >= A) {
      cookies += B;
    }
    T -= A;
  }

  cout << cookies;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#pragma GCC diagnostic ignored "-Wmissing-declarations"

#define FINAL_OUT(x) {cout << (x) << '\n'; exit(0);}

#define SHOW(x) std::cout << #x << " = " << x << std::endl;


int main()
{
//    freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    ios_base::sync_with_stdio(false);

    int n, k;
    cin >> n >> k;
    int d = 0;
    vector<int> a(n);
    for(int& x : a)
    {
        cin >> x;
        d = __gcd(d, x);
    }

    for(int x : a)
    {
        if (x >= k && (x - k) % d == 0)
            FINAL_OUT("POSSIBLE");
    }

    FINAL_OUT("IMPOSSIBLE");
}


Measured memory_bytes: 640
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(System.out);
        String[] arr = br.readLine().split(" ");
        int R = Integer.parseInt(arr[0]);
        int G = Integer.parseInt(arr[1]);
        int B = Integer.parseInt(arr[2]);
        int N = Integer.parseInt(arr[3]);
        int ans = 0;

        int[] arr2 = new int[] { R, G, B };
        Arrays.sort(arr2);

        int n1 = arr2[2];
        int n2 = arr2[1];
        int n3 = arr2[0];

        for (int i = 0; i * n1 <= N; i++) {
            int rest1 = N - i * n1;
            for (int j = 0; j * n2 <= rest1; j++) {
                int rest2 = rest1 - j * n2;
                if (rest2 % n3 == 0) {
                    ans++;
                }
            }
        }

        out.println(ans);
        out.close();
    }
}


Measured memory_bytes: 22356
import sys
input = sys.stdin.readline
from operator import itemgetter

N, T = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(N)]

AB.sort(key=itemgetter(0))

dp = [[0 for _ in range(N+1)] for _ in range(T+1)]
# 重さwまで品物nまででで最大になる価値
C = []

for n in range(N): # 品物nまでの世界で決めていく
    a, b = AB[n]
    for w in range(T):
        if a > w: # カバンに入りきらないなら入れられない
            dp[w][n+1] = dp[w][n]
        else: #カバンに入れられる可能性があるなら
            if b+dp[w-a][n] >= dp[w][n]:
                dp[w][n+1] = dp[w-a][n] + b
            else:
                dp[w][n+1] = dp[w][n]
    C.append(dp[T-1][n]+b)

ans = max(C)
print(ans)

Measured memory_bytes: 121052
#include <iostream>
#include <string>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cmath>
#include <array>
#include <queue>
#include <map>
#include <stack>
#include <cstdint>
typedef long long int llint;

llint count10(llint cnt){
  llint ret = 0;
  for(int i=0; i<cnt; i++){
    ret*=10;
    ret++;
  }
  std::cout << ret << std::endl;
  return ret;
}

llint pow(llint x, llint y){
  llint ret = 1;
  while(y){
    if(y%2) ret*=x;
    x*=x;
    y/=2;
  }
  return ret;
}

llint solve(llint n){
  llint ret2 = 0;
  llint ret10 = 0;

  llint n2 = n;
  while(n2 >= 2){
    llint tmp = 1;
    llint cnt2 = 0;
    while(n2 >= tmp*2){
      tmp*=2;
      cnt2++;
    }
    ret2 += pow(2, cnt2)-1;
    n2 -= tmp;
  }


  llint cnt5 = 0;
  cnt5 += n/10;
  llint hoge = 50;
  while(hoge <= n){
    cnt5 += n / hoge;
    hoge*=5;
  }
  
  return std::min(ret2, cnt5);
}

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

  if(n%2) std::cout << 0 << std::endl;
  else    std::cout << solve(n) << std::endl;

  return 0;
}


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

int main()
{
 int l,a,b,c,d,x,y;
 cin >>l>>a>>b>>c>>d;
 if(a%c>0){
     x=a/c+1;}
 else{
      x=a/c;}
 if(b%d>0){
     y=b/d+1;}
 else{
      y=b/d;}
 if(x>y)
    cout<<l-x<<'\n';
 else
    cout<<l-y<<'\n';
 return 0;
}

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

const ll mod=998244353;

int n;

ll fac[maxn],ans;

struct node{
	int x,y;
}a[maxn];

ll qpow(ll base,ll K){
	ll res=1;
	while(K){
		if(K&1) res=(res*base)%mod;
		base=(base*base)%mod;
		K>>=1;
	}
	return res;
}

int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%d%d",&a[i].x,&a[i].y);
	fac[0]=1;
	for(int i=1;i<=n;i++) fac[i]=(fac[i-1]*2)%mod;
	ans=(fac[n]-n-1+mod)%mod;
	for(int i=1;i<=n;i++){
		for(int j=1;j<i;j++){
			int sum=0;
			for(int k=1;k<j;k++) if(1ll*(a[i].x-a[j].x)*(a[j].y-a[k].y)==1ll*(a[i].y-a[j].y)*(a[j].x-a[k].x)) sum++;
			ans=(ans-fac[sum]+mod)%mod;
		}
	}
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 384
using System;
using System.Collections.Generic;
using System.Linq;

namespace ABC123_D
{
    class Program
    {
        static void Main(string[] args)
        {
            var line = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var x = line[0];
            var y = line[1];
            var z = line[2];
            var k = line[3];
            var a = Console.ReadLine().Split().Select(long.Parse).ToArray();
            var b = Console.ReadLine().Split().Select(long.Parse).ToArray();
            var c = Console.ReadLine().Split().Select(long.Parse).ToArray();

            Array.Sort(a);
            Array.Sort(b);
            Array.Sort(c);

            Array.Reverse(a);
            Array.Reverse(b);
            Array.Reverse(c);

            var ans = new List<long>();
            for (int i = 0; i < x; i++)
                for (int j = 0; j < y; j++)
                    for (int l = 0; l < z; l++)
                    {
                        if ((i + 1) * (j + 1) * (l + 1) <= k)
                            ans.Add(a[i] + b[j] + c[l]);
                        else
                            break;
                    }

            ans.Sort();
            ans.Reverse();
            for (int i = 0; i < k; i++)
                Console.WriteLine(ans[i]);
        }
    }
}


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

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define BIT(x,n) bitset<n>(x)
#define PI 3.14159265358979323846

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

//-----------------------------------------------------------------------------

typedef pair<int,int> Pii;
typedef vector< vector<int> > Graph;

struct StronglyConnectedComponents {
	Graph G,rG;
	vector<int> comp,order,used;

	StronglyConnectedComponents(size_t v):G(v),rG(v),comp(v,-1),used(v,0) {}

	void add_edge(int x,int y) {
		G[x].push_back(y);
		rG[y].push_back(x);
	}

	void input(int m,int offset=0) {
		int a,b;
		for(int i=0;i<m;i++) {
			cin>>a>>b;
			add_edge(a,b);
		}
	}

	int operator[](int k) {
		return (comp[k]);
	}

	void dfs(int v) {
		if(used[v]) return;
		used[v]=1;
		for(auto u:G[v]) dfs(u);
		order.push_back(v);
	}

	void rdfs(int v,int cnt) {
		if(comp[v]!=-1) return;
		comp[v]=cnt;
		for(auto u:rG[v]) rdfs(u,cnt);
	}

	void build() {
		for(int i=0;i<(int)G.size();i++) dfs(i);
		reverse(order.begin(),order.end());
		int cnt=0;
		for(auto idx:order) if(comp[idx]==-1) rdfs(idx,cnt),cnt++;
	}

	bool same(int a,int b) {
		return comp[a]==comp[b];
	}
};

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

	int V,E,Q;
	cin>>V>>E;
	StronglyConnectedComponents g(V);
	g.input(E);
	g.build();
	cin>>Q;
	while(Q--) {
		int a,b;cin>>a>>b;
		if(g.same(a,b)) cout<<1<<endl;
		else cout<<0<<endl;
	}

	return 0;
}



Measured memory_bytes: 4580
#include<bits/stdc++.h>
using namespace std; 
typedef long long ll;
typedef long double ld;
#define fi first
#define se second
const ll mod = 1e9+7;
const int N = 1e5+5;
void solve(){
	string s; 
	cin>>s; 
	sort(s.begin(),s.end());
	if(s[0]==s[1] and s[2]==s[3] and s[1]!=s[2])cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}
int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int t=1; 
//	cin>>t; 
	while(t--){
		solve();
	}
	return 0;
}


Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
void LCS(string s,string t,int n,int m)
{
    int L[n+1][m+1];
    for(int i=0;i<=n;i++){
        for(int j=0;j<=m;j++){
            if(i==0 || j==0)L[i][j] = 0;
            else if(s[i-1]==t[j-1])
                L[i][j] = 1+L[i-1][j-1];
            else 
                L[i][j] = max(L[i-1][j],L[i][j-1]);
        }
    }
    string ans;
    int i=n,j=m;
    while(i>0 && j>0){
        if(s[i-1]==t[j-1]){
            ans+=s[i-1];
            i--;
            j--;
        }
        else if(L[i-1][j]>L[i][j-1])i--;
        else j--;
    }
    reverse(ans.begin(),ans.end());
    cout<<ans;
}
int main()
{
    string s,t;
    cin>>s>>t;
    int n = s.length();
    int m = t.length();
    LCS(s,t,n,m);
}

Measured memory_bytes: 35456
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <limits>
#include <cmath>
#include <cassert>

using namespace std;
using ll = long long;

const int INF = 1<<30;
const int MOD = (int)1e9 + 7;
const int MAX_N = (int)1e5 + 5;
#define debug(x) cout << #x << ": " << x << endl

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n, k; cin >> n >> k;
    ll ans = 1;
    for(int i = 0; i < n; i++)
    {
        ans = (ans * (k - i)) % MOD;
    }
    cout << ans << endl;
    return 0;
}




Measured memory_bytes: 3204
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cinttypes>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;

int main() {
//  freopen("../Console/1.txt", "rb", stdin);
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);

  int N, A, B;
  cin >> N >> A >> B;

  if (abs(A - B) % 2 == 0) {
    cout << "Alice" << '\n';
  } else {
    cout << "Borys" << '\n';
  }

  return 0;
}


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

int main() {
	set<string> good;
	int n = 0;
	string str;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> str;
		good.insert(str);
	}
	cout << good.size() << endl;
	return 0;
}

Measured memory_bytes: 19164
n = gets.chomp.to_i

ret = 0
10.times do |a|
  ["7", "5", "3"].repeated_permutation(a) do |x|
    if x.include?("7") && x.include?("5") && x.include?("3")
      b = x.join("").to_i
      if b <= n
        ret += 1
      end
    end
  end
end

puts ret

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

using namespace std;

int main()
{
	string A, B, C;
	cin >> A >> B >> C;
	if (A[A.length() - 1] == B[0] && B[B.length() - 1] == C[0]) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstring>
using namespace std;
string S, T; int n, x[10000], a[10000], b[10000], cnt; char U[11] = "0123456789";
int main() {
	cin >> n;
	for (int times = 0; times < n; times++) {
		cin >> S >> T;
		memset(x, 0, sizeof(x));
		memset(a, 0, sizeof(a));
		memset(b, 0, sizeof(b));
		for (int i = 0; i < S.size(); i++) {
			for (int j = 0; j < 10; j++) {
				if (U[j] == S[i]) {
					a[S.size() - 1 - i] = j;
				}
			}
		}
		for (int i = 0; i < T.size(); i++) {
			for (int j = 0; j < 10; j++) {
				if (U[j] == T[i]) {
					b[T.size() - 1 - i] = j;
				}
			}
		}
		if (S.size() > 80 || T.size() > 80) {
			cout << "overflow" << endl; goto E;
		}
		for (int i = 0; i < 80; i++) {
			x[i] += (a[i] + b[i]) % 10;
			x[i + 1] += (a[i] + b[i]) / 10;
			if (x[i] >= 10) {
				x[i + 1] += x[i] / 10;
				x[i] %= 10;
			}
			if (x[i + 1] >= 10) {
				x[i + 2]++;
				x[i + 1] %= 10;
			}
		}
		cnt = 0;
		if (x[80] > 0) {
			cout << "overflow" << endl;
		}
		else {
			for (int i = 79; i >= 0; i--) {
				if (x[i] > 0 || i == 0) { cnt++; }
				if (cnt) { cout << x[i]; }
			}
			cout << endl;
		}
	E:;
	}
}

Measured memory_bytes: 1328
N = int(input())
X = [int(i) for i in input().split()]
sX = sorted(X)

mid = N // 2 - 1
l = sX[mid]
r = sX[mid+1]
for i in range(N):
    if X[i] <= l:
        print(r)
    else:
        print(l)

Measured memory_bytes: 25220
#include<iostream>

using namespace std;

int main(){
        int n; cin >> n;
        string taro,hanako;
        int tp=0;
        int hp=0;
    
        for (int i = 0;i < n; i++){
                cin >> taro >> hanako;
                if (taro > hanako ){
                        tp += 3;
                }else if(hanako > taro){
                        hp += 3;
                }else{
                        hp++;
                        tp++;
                }   
        }   
        cout << tp << " " << hp << endl;    

return 0;
}

Measured memory_bytes: 3160
/**
 * Contest : AtCoder Beginner Contest 163
 * Contest URL : https://atcoder.jp/contests/abc163/tasks
 * Problem : C - management
 * Problem URL : https://atcoder.jp/contests/abc163/tasks/abc163_c
 */

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

// This section is for Policy Based Data Structure, more precisely Ordered Set.
// All Functions of set works here, in addition we have order_of_key() and find_by_order() function. find_by_order() returns iterator
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<functional>
using namespace __gnu_pbds;

// 1. Custom Set
template < class T, class COMP >
using custom_set = tree < T, null_type, COMP, rb_tree_tag, tree_order_statistics_node_update >;

// 2. Ordered Set
template < class T >
using ordered_set = tree < T, null_type, less < T >, rb_tree_tag, tree_order_statistics_node_update >;

// 3. Ordered Multi Set
// For storing multiple occurance of same value we need to use pair. In pair first value is our key and second is useless count variable.
// order_of_key(make_pair(key, 0)) returns first occurance of a value, order_of_key(make_pair(key, INT_MAX)) returns last occurance.
template < class T >
using ordered_multiset = tree < pair < T, int >, null_type, less < pair < T, int > >, rb_tree_tag, tree_order_statistics_node_update >;

// 4. Ordered Map
template < class T, class U >
using ordered_map = tree < T, U, less < T >, rb_tree_tag, tree_order_statistics_node_update >;
// Policy End

void solve() {
	int n; cin >> n;
	vector < int > count (n + 5);
	for (int i = 1; i < n; i++) {
		int x; cin >> x;
		count[x]++;
	}
	for (int i = 1; i <= n; i++) {
		cout << count[i] << endl;
	}
}

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


Measured memory_bytes: 4000
using System;
using System.Linq;
public class Hello
{
    public static void Main()
    {
        int[] s = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
        int A = s[0];
        int B = s[1];
        int C = s[2];
        bool can = false;
        for(int i = 1; i <= B; i++)
        {
            if(i * A % B == C) can = true;
        }
        
        if(can) Console.WriteLine("YES");
        else Console.WriteLine("NO");
    }
}

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

ll ara[55];
ll dp[51][53];
ll ncr(ll n,ll r)
{
    if(r>n)return 0;
    if(r==1)return n;
    if(n==r)return 1;
    if(dp[n][r]!=-1)return dp[n][r];
    return dp[n][r]=ncr(n-1,r-1)+ncr(n-1,r);
}
int main()
{
    memset(dp,-1,sizeof dp);
//    cout<<ncr(1,2)<<endl;
    cout<<setprecision(10);
    ll n,a,b;cin>>n>>a>>b;
    for(ll i=0;i<n;i++)
    {
        cin>>ara[i];
        mp[ara[i]]++;
    }
    sort(ara,ara+n);
    ll sum=0;
    ll cnt=0;
    ll last=ara[n-a];
//    cout<<"last = "<<last<<endl;
    for(ll i=n-1;i>=n-a;i--)
    {
        if(ara[i]==last)cnt++;
        sum+=ara[i];
    }
    double avg=sum/double(a);
    ll ans=0;
    if(sum==last*a)         ///same
    {
        for(ll i=a;i<=b;i++)
        {
            ans+=ncr(mp[last],i);
        }
    }
    else
    {
        ans=ncr(mp[last],cnt);
    }
    cout<<avg<<endl<<ans<<endl;
}
/*

    5 2 3
5 5 5 5 5

*/


Measured memory_bytes: 256
from fractions import gcd

def inpl(): return list(map(int, input().split()))
N, A, B, C = inpl()

MOD = 10**9 + 7
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

size = 2*100000 + 1
g1, g2, inverse = [0]*size, [0]*size, [0]*size

g1[:2] = [1, 1] # 元テーブル
g2[:2] = [1, 1] #逆元テーブル
inverse[:2] = [0, 1] #逆元テーブル計算用テーブル
 
for i in range(2, size):
    g1[i] =  ( g1[i-1] * i ) % MOD 
    inverse[i] = (-inverse[MOD % i] * (MOD//i) ) % MOD 
    g2[i] =  (g2[i-1] * inverse[i]) % MOD

P = 0
Q = pow(100-C, 2*N, MOD)*(100-C)%MOD

for x in range(N):
    P = (P + cmb(N+x-1, x, MOD) * (N+x) * pow(100-C, N-x, MOD) * (pow(inverse[A], N-x, MOD) + pow(inverse[B], N-x, MOD)))%MOD
P = P*100*pow(A, N, MOD)*pow(B, N, MOD)%MOD

gcd_ = gcd(P, Q)
P = P//gcd_
Q = Q//gcd_

if A*B == 0:
    print(N*100*pow(100-C, MOD-2, MOD)%MOD)
else:
    print(P*pow(Q, MOD-2, MOD)%MOD)

Measured memory_bytes: 30800
//minamoto
#include<bits/stdc++.h>
#define R register
#define fp(i,a,b) for(R int i=(a),I=(b)+1;i<I;++i)
#define fd(i,a,b) for(R int i=(a),I=(b)-1;i>I;--i)
#define go(u) for(int i=head[u],v=e[i].v;i;i=e[i].nx,v=e[i].v)
template<class T>inline bool cmax(T&a,const T&b){return a<b?a=b,1:0;}
template<class T>inline bool cmin(T&a,const T&b){return a>b?a=b,1:0;}
using namespace std;
int n,m,k;
int main(){
	scanf("%d%d%d",&n,&m,&k);
	fp(i,0,n)fp(j,0,m)if(k==i*m+j*n-(i*j<<1))return puts("Yes"),0;
	puts("No");
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
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; }
typedef long long int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define MOD (1000000007)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

char s;

void input(){
    cin >> s;
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    input();
    char ans;
    if(s == 'A') ans = 'T';
    else if(s == 'T') ans = 'A';
    else if(s == 'G') ans = 'C';
    else ans = 'G';
    cout << ans << endl;
}

Measured memory_bytes: 256
/* 
chirag11032000
Chirag Thakur
*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

using ll = long long;
using db = double;
using pii = pair < int, int >;
using pll = pair < ll, ll >;

template < typename T > using OrderedSet = tree < T, null_type, less < T >, rb_tree_tag, tree_order_statistics_node_update >;
template < typename T > using MinPriorityQueue = priority_queue < T, vector < T >, greater < T > >;

#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template < typename Arg1 >
void __f(const char* name, Arg1&& arg1) {
	cerr << name << " : " << arg1 << std::endl;
}
template < typename Arg1, typename... Args >
void __f(const char* names, Arg1&& arg1, Args&&... args) {
	const char* comma = strchr(names + 1, ',');
	cerr.write(names, comma - names) << " : " << arg1 << " | ";
	__f(comma + 1, args...);
}
#else
#define trace(...)
#endif

#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define unique_sort(x) sort(all(x)), x.resize(distance(x.begin(), unique(all(x))))

const db PI = acos(-1);
const ll LINF = LLONG_MAX;
const int INF = INT_MAX, MOD = 1e9 + 7, N = 1e5 + 10;

void test_case();

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	test_case();
	cerr << "Time taken: " << int((clock() * 1000.) / CLOCKS_PER_SEC) << "ms\n";
	return 0;
}

void test_case() {
	int n;
	ll k;
	cin >> n >> k;
	vector < ll > a(n);
	for (auto &el: a) {
		cin >> el;
	}
	ll ans = 0;
	bool less = false;
	for (int bit = 63; bit >= 0; --bit) {
		int one = 0;
		for (int i = 0; i < n; ++i) {
			if (a[i] & (1ll << bit)) {
				++one;
			}
		}
		if (one >= n - one) {
			ans += one * (1ll << bit);
			if (k & (1ll << bit)) {
				less = true;
			}
		} else if ((k & (1ll << bit)) || less) {
			ans += (n - one) * (1ll << bit);
		} else {
			ans += one * (1ll << bit);
		}
	}
	cout << ans << "\n";
}

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

using namespace std;

#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define FOR(i, a, b) for(int i=(a);i<(b);i++)
#define REP(i, n) FOR(i, 0, n)
#define RFOR(i, a, b) for(int i=(a);i>=(b);i--)
#define RREP(i, n) RFOR(i, n, 0)
#define MFOR(i, m) for(auto i=(m).begin();i!=(m).end();i++)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((int)(x).size())

typedef long long int ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;

const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1 << 30;

template<typename T>
void printv(vector<T> const& s) {
  REP(i, SZ(s)) {
    cout << s[i] << " ";
  }
  cout << endl;
}

int main () {
  cin.tie(0);
  cout << setprecision(10);
  
  ll n, k; cin >> n >> k;
  vll a(n);
  REP(i, n) cin >> a[i];
  vll x;
  REP(l, n) {
    FOR(r, l+1, n+1) {
      ll su = 0;
      FOR(i, l, r) {
        su += a[i];
      }
      x.pb(su);
    }
  }

  sort(ALL(x));
  // printv(x);

  ll sz = SZ(x);
  /*
   * 二進数で表したときの上の桁から、辞書順ソート
   * i番目の桁で、1となるものがk個あるなら1となるものを、そうでないなら1とならないものを選ぶ　にぶたん
   * これだとどちらもk個ないときに詰む（最悪でO(n^2logn))
   * 例えばn=16, k = n(n+1)/2で0000,0001,0010,0011,0100,0101,0110,0111,1000,1001,1010,1011,1100,1101,1110,1111とか
   * 要素が二値のソートだからO(n)でできひん？→でもO(n^2)になっておそい
   * 桁数やんけ！！！ 20くらい
   * 範囲l, r 
   * 桁iについて1と0の境目がaのとき、
   * 1となるものがk個ある→l, i;
   * 1となるものがk個ない→l, r;
   * この範囲を20ケタ分絞っていく
   */
  
  ll l = 0;
  ll ans = 0;
  vll mask(51);
  mask[0] = 0;
  FOR(i, 1, 51) {
    mask[i] = (mask[i-1] << 1) + 1;
  }
  //printv(mask);
  RREP(i, 49) {
    vll bi(sz);
    REP(j, sz) {
      //cout << (x[j] & mask[i+1]) << ":" << (x[j] & mask[i]) << endl;
      bi[j] = (x[j] & mask[i+1]) - (x[j] & (mask[i]));
    }
    // printv(bi);
    ll pos = lower_bound(ALL(bi), 1) - bi.begin();
    REP(j, sz) {
      x[j] -= x[j] & (1ll << i);
    }
    if(sz - pos >= k) {
      ans += 1ll << i;
      l = pos;
      sz -= l;
      x.erase(x.begin(), x.begin()+l);
    } else {
      sort(ALL(x));
    }
    // cout << ans << endl;
  }
  cout << ans << endl;
  
}


Measured memory_bytes: 8176
n = int(input())
mx = 0
ans = 0
def mod(i, count=0):
    if i%2!=0:
        return count
    else:
        return mod(i//2, count+1)
for i in range(1,n+1):
    if mx <= mod(i):
        mx = mod(i)
        ans = i
print(ans)

Measured memory_bytes: 3060
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
using namespace std;
#define Ma_PI 3.141592653589793
#define eps 0.00000001
#define LONG_INF 3000000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define MOD 998244353
#define REP(i,n) for(long long i = 0;i < n;++i)    
#define seg_size 524288
double dot(complex<double> a, complex<double> b) {
	return a.real() * b.real() + a.imag() * b.imag();
}
double gyaku_dot(complex<double> a, complex<double> b) {
	return a.real() * b.imag() - a.imag() * b.real();
}
double leng(complex<double> a) {
	return sqrt(a.real()*a.real() + a.imag()*a.imag());
}
double angles(complex<double> a, complex<double> b) {
	double cosine = dot(a, b) / (leng(a) * leng(b));
	double sine = gyaku_dot(a, b) / (leng(a) * leng(b));
	double kaku = acos(cosine);
	if (sine <= 0) {
		kaku = 2 * Ma_PI - kaku;
	}
	return kaku;
}
vector<int> convex_hull(vector<complex<double>> a) {
	vector<int> ans;
	double now_minnest = a[0].real();
	int now_itr = 0;
	REP(i, a.size()) {
		if (now_minnest > a[i].real()) {
			now_minnest = a[i].real();
			now_itr = i;
		}
	}
	ans.push_back(now_itr);
	complex<double> ba(0, 1);
	while (true) {
		int now_go = 0;
		double now_min = 0;
		int starter = ans[ans.size() - 1];
		for (int i = 0; i < a.size(); ++i) {
			if (i != starter) {
				double goa = angles(ba, a[i] - a[starter]);
				if (goa > now_min) {
					now_min = goa;
					now_go = i;
				}
			}
		}
		if (now_go == ans[0]) break;
		ans.push_back(now_go);
		ba = complex<double>(a[now_go] - a[starter]);
	}
	return ans;
}
long long size_of_beaf[2000] = {};
long long size_of_all[2000] = {};
long long calc(long long a, long long b) {
	if (a == 0) {
		assert(b == 0 || b == 1);
		if (b == 0) return 0;
		return 1;
	}
	if (b <= 1) return 0;
	b--;
	if (b <= size_of_all[a - 1]) {
		return calc(a - 1, b);
	}
	long long ans = size_of_beaf[a - 1];
	b -= size_of_all[a - 1];
	b--;
	ans++;
	if (b <= size_of_all[a - 1]) {
		return calc(a - 1, b) + size_of_beaf[a-1] + 1LL;
	}
	ans += size_of_beaf[a - 1];
	b -= size_of_all[a - 1];
	b--;
	assert(b == 0);
	return ans;
}
int main(){
#define int long long
	long long n, x;
	cin >> n >> x;
	size_of_beaf[0] = 1;
	size_of_all[0] = 1;
	for (int i = 0; i < n+1; ++i) {
		size_of_beaf[i + 1] = size_of_beaf[i] * 2LL + 1LL;
		size_of_all[i + 1] = size_of_all[i] * 2LL + 3LL;
	}
	cout << calc(n, x) << endl;
	return 0;
}

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

int main() {
  int sss,s1,s2,s3 ;
  cin >> sss;
  s1=sss/100;
  s2=(sss-s1*100)/10;
  s3=sss-s1*100-s2*10;
  //cout <<s1<<endl<<s2<<endl<<s3<<endl;
  cout << s1+s2+s3 <<endl;
}


Measured memory_bytes: 3600
N = int(input())
if N < 10:
    N += 10

length = len(str(N))
result = 0
hon = [2,4,5,7,9]
pon = [0,1,6,8]
bon = [3]


for _ in range(length-1):
    result = N % 10
if result in hon:
    print("hon")
elif result in pon:
    print("pon")
elif result in bon:
    print("bon")
else:
    print("")

Measured memory_bytes: 9208
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String[] s = new String[n];
        for (int i = 0; i < n; i++) {
            s[i] = sc.next();
        }
        int m = sc.nextInt();
        String[] t = new String[m];
        for (int i = 0; i < m; i++) {
            t[i] = sc.next();
        }
        int max = 0;
        for (int i = 0; i < n; i++) {
            int count = 0;
            for (int j = 0; j < n; j++) {
                if (s[i].equals(s[j]))
                    count++;
            }
            for (int j = 0; j < m; j++) {
                if (s[i].equals(t[j]))
                    count--;
            }
            max = Math.max(max, count);
        }
        System.out.println(max);
    }
}

Measured memory_bytes: 21588
X = int(input())
a_fifth = {i ** 5 : i for i in range(700)}
b_fifth = {i ** 5: i for i in range(-1000, 1001, 1)}
for bf in b_fifth:
    if X + bf in a_fifth and bf < X + bf:
        print(a_fifth[X + bf], b_fifth[bf])
        exit()
    
        


Measured memory_bytes: 64736
#include <iostream>
#include <cstdio>
#include <queue>
#include <string>
using namespace std;


int main(void)
{
	//freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
	int n, m, time;
	string name;
	cin >> n >> m;
	queue<pair<string, int>> q;
	while (n--)
	{
		cin >> name >> time;
		q.push(make_pair(name, time));
	}
	int ans = 0;
	pair<string, int> t;
	while (!q.empty())
	{
		t = q.front();
		q.pop();
		if (t.second > m)
		{
			ans += m;
			t.second -= m;
			q.push(t);
		}
		else
		{
			ans += t.second;
			printf("%s %d\n", t.first.c_str(), ans);
		}
	}
	return 0;
}

Measured memory_bytes: 6424
struct Rin{}
impl Rin{
    fn input(&self)->String{
        let mut x=String::new();
        std::io::stdin().read_line(&mut x).ok();
        x
    }
    fn inputs(&self)->String{
        let s=self.input().trim().to_string();
        s
    }
    fn inputn(&self)->i32{
        let n:i32=self.input().trim().parse().unwrap();
        n
    }
    fn inputvs(&self)->Vec<String>{
        let vs=self.input().trim().split(' ').map(|x|x.to_string()).collect();
        vs
    }
    fn inputvn(&self)->Vec<i32>{
        let vn=self.input().trim().split(' ').map(|x|x.to_string().parse().unwrap()).collect();
        vn
    }
}

fn main(){
    let rin=Rin{};
    let n=rin.inputn() as i64;
    let mut ans:i64=0;
    for i in 0..n+1{
        if i%3==0{
            continue;
        }
        else if i%5==0{
            continue;
        }
        else{
            ans+=i;
        }
    }
    println!("{}",ans);
}

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

int ctoi(char c) {
  return (int)c - (int)'0';
}

int n;
std::vector<int> vec;

int main() {
  std::cin >> n;
  for (int i = 1; i < n; i++) {
    std::string s1 = std::to_string(i);
    std::string s2 = std::to_string(n-i);
    int sum = 0;
    for (int j = 0; j < s1.size(); j++) {
      sum += ctoi(s1[j]);
    }
    for (int p = 0; p < s2.size(); p++) {
      sum += ctoi(s2[p]);
    }
    vec.push_back(sum);
  }
  std::sort(vec.begin(), vec.end());
  std::cout << vec[0] << std::endl;
  
}


Measured memory_bytes: 892
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let v = read_vec::<usize>();
    let (h, w) = (v[0], v[1]);
    let mut grid = vec![vec![]; h];
    for i in 0..h {
        grid[i] = read::<String>().chars().collect::<Vec<_>>();
    }

    let mut from_left = vec![vec![0; w]; h];
    for y in 0..h {
        if grid[y][0] == '.' {
            from_left[y][0] = 1;
        }
        for x in 1..w {
            if grid[y][x] == '#' {
                continue;
            }
            from_left[y][x] = from_left[y][x - 1] + 1;
        }
    }

    let mut from_right = vec![vec![0; w]; h];
    for y in 0..h {
        if grid[y][w - 1] == '.' {
            from_right[y][w - 1] = 1;
        }
        for x in (0..w - 1).rev() {
            if grid[y][x] == '#' {
                continue;
            }
            from_right[y][x] = from_right[y][x + 1] + 1;
        }
    }

    let mut from_upper = vec![vec![0; w]; h];
    for x in 0..w {
        if grid[0][x] == '.' {
            from_upper[0][x] = 1;
        }
        for y in 1..h {
            if grid[y][x] == '#' {
                continue;
            }
            from_upper[y][x] = from_upper[y - 1][x] + 1;
        }
    }

    let mut from_lower = vec![vec![0; w]; h];
    for x in 0..w {
        if grid[h - 1][x] == '.' {
            from_lower[h - 1][x] = 1;
        }
        for y in (0..h - 1).rev() {
            if grid[y][x] == '#' {
                continue;
            }
            from_lower[y][x] = from_lower[y + 1][x] + 1;
        }
    }
    let mut ans = 0;
    for y in 0..h {
        for x in 0..w {
            if grid[y][x] == '#' {
                continue;
            }
            ans = max(
                ans,
                from_left[y][x] + from_right[y][x] + from_upper[y][x] + from_lower[y][x] - 3,
            );
            if x == 1 && y == 1 {
                debug!(
                    from_left[y][x],
                    from_right[y][x], from_upper[y][x], from_lower[y][x]
                );
            }
        }
    }
    println!("{}", ans);
}

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

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


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

constexpr int MAX = 1010;

int main() {
    string s, t;
	cin >> s >> t;
	
	const int n = s.length();
	const int m = t.length();
	
	int dp[MAX][MAX] = {};
	for (int i = 0; i < MAX; i++) {
		dp[i][0] = dp[0][i] = i;
	}
	
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			if (s[i] == t[j]) {
				dp[i + 1][j + 1] = min({dp[i][j], dp[i + 1][j] + 1, dp[i][j + 1] + 1});
			} else {
				dp[i + 1][j + 1] = min({dp[i][j] + 1, dp[i + 1][j] + 1, dp[i][j + 1] + 1});
			}
		}
	}
	
	cout << dp[n][m] << '\n';
	
	return 0;
}


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

bool solve(int n) {
  int total = 0;
  for (int i = 0;; ++i) {
    total = 0;
    for (int j = 0; total <= n; ++j) {
      total = 4 * i + 7 * j;
      if (total == n) return true;
    }
    if (i + 4 > n) break;
  }
  return false;
}

int main() {
  int N;
  cin >> N;
  if(solve(N)==true) cout << "Yes" <<endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3620
n=int(input())
c=str(input())
c=list(c)
t1=[0]*n
t2=[0]*n
for i in range(len(c)):
  if c[i]=="R":
    t1[i]=1
  else:
    t2[i]=1
if sum(t1)==len(c) or sum(t2)==len(c):
  print(0)
else:
  ans=0
  t=sum(t1)
  for i in range(n):
    if t2[i]==1:
      ans=ans+1
      t=t-1
    if t1[i]==1:
      t=t-1
    if t==0:
      break
  print(ans)

Measured memory_bytes: 13684
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define vi vector<int>
#define pb push_back
#define pii pair<int , int>
#define fast ios_base::sync_with_stdio(0)
#define mx 100005
#define inf 1000000000000000008LL
#define mod 1000000007
char grid[1002][1002];
ll dp[1002][1002];
int main()
{
    int n,m;
    scanf("%d%d",&n,&m);
    for(int i=0; i<n; i++) scanf("%s",grid[i]);
    dp[0][0] = 1;
    for(int i=1; i<m; i++){
        if(grid[0][i]=='#') dp[0][i] = 0;
        else dp[0][i] = dp[0][i-1];
    }
    for(int i=1; i<n; i++){
        if(grid[i][0]=='#') dp[i][0] = 0;
        else dp[i][0] = dp[i-1][0];
    }
    for(int i=1; i<n; i++){
        for(int j=1; j<m; j++){
            if(grid[i][j]=='#') dp[i][j] = 0;
            else dp[i][j] = (dp[i-1][j] + dp[i][j-1])%mod;
        }
    }
    printf("%lld\n", dp[n-1][m-1]);
}



Measured memory_bytes: 9088