akhauriyash/Code-Regression huggingface dataset:
package main

import (
    "fmt"
)

var n, k int
var ps [][]int
var que []int
var v map[int]bool
var sum = 1

const mod = int(1e9 + 7)

func main() {
    fmt.Scan(&n, &k)
    ps = make([][]int, n)
    for i := 0; i < n-1; i++ {
        var a, b int
        fmt.Scan(&a, &b)
        a--
        b--
        ps[a] = append(ps[a], b)
        ps[b] = append(ps[b], a)
    }
    v = make(map[int]bool)
    search()
    fmt.Println(sum)
}

func search() {
    v[0] = true
    sum *= k
    for i, q := range ps[0] {
        v[q] = true
        sum *= k - i - 1
        sum %= mod
        for _, nq := range ps[q] {
            if b, ok := v[nq]; ok && b {
                continue
            }
            que = append(que, nq)
        }
        que = append(que, 0)
    }
    for len(que) > 0 {
        bl := len(que)
        var c int
        for _, q := range que {
            if q == 0 {
                c = 0
                continue
            }
            v[q] = true
            sum *= k - c - 2
            sum %= mod
            c++
            for _, nq := range ps[q] {
                if b, ok := v[nq]; ok && b {
                    continue
                }
                que = append(que, nq)
            }
            que = append(que, 0)
        }
        que = que[bl:]
    }
}


Measured memory_bytes: 18048
from collections import deque


def solve(string):
    n, *ab = map(int, string.split())
    next_ = [dict([]) for _ in range(n + 1)]
    # color = [set([]) for _ in range(n + 1)]
    queue = deque([1])
    for a, b in zip(*[iter(ab)] * 2):
        next_[a][b] = 0
        next_[b][a] = 0
    while len(queue) > 0:
        c = queue.popleft()
        _next = next_[c].items()
        # use = set(range(1, len(_next) + 1)) - color[c]
        use = set(range(1, len(_next) + 1)) - set(next_[c].values())
        _next = (k for k, v in _next if v == 0)
        for _n, u in zip(_next, use):
            queue.append(_n)
            next_[c][_n] = u
            next_[_n][c] = u
            # color[c].add(u)
            # color[_n].add(u)
    return str("{}\n{}".format(max(map(lambda x: len(x.keys()), next_)),
                               "\n".join(str(next_[a][b]) for a, b in zip(*[iter(ab)] * 2))))


if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read().strip()))


Measured memory_bytes: 50544
N,T=list(map(int,input().split()))
l=list(map(int,input().split()))
a_l=[]
ans=0
for i in range(N-1):
   a_l.append(l[i+1]-l[i])
for i in range(N-1):
   ans+=min(T,a_l[i])
ans+=T
print(ans)

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

int n, k;
double x[60], y[60], c[60], r[60];
double EPS = 1e-9;

double dist(pair<double, double> p, pair<double, double> q) {
	double xx = (p.first - q.first)*(p.first - q.first);
	double yy = (p.second - q.second)*(p.second - q.second);

	return sqrt(xx + yy);
}

vector<pair<double, double>> circle_circle_intersection(double x1, double y1, double r1, double x2, double y2, double r2) {
	vector<pair<double, double>> ans;
	double d = dist(make_pair(x1, y1), make_pair(x2, y2));
	if (d > r1 + r2) {
		return ans;
	}
	if (x1 == x2 && y1 == y2) {
		ans.emplace_back(x1, y1); return ans;
	}
	if (d < abs(r1 - r2)) {
		ans.emplace_back(x1, y1); return ans;
	}

	double a = (r1*r1 - r2*r2 + d*d)/(2*d);
	double h = sqrt(r1*r1 - a*a);

	//cout << d << ' ' << a << ' ' << h << '\n';

	double x3 = (x2 - x1)*(a/d) + x1;
	double y3 = (y2 - y1)*(a/d) + y1;

	ans.emplace_back(x3 + h*(y2 - y1)/d, y3 - h*(x2 - x1)/d);
	ans.emplace_back(x3 - h*(y2 - y1)/d, y3 + h*(x2 - x1)/d);

	return ans;
}

int check(double t) {
	int ans = 0;
	for (int i = 0; i < n; i++) {
		r[i] = t/c[i];
	}

	/*for (int i = 0; i < n; i++) {
		int cnt = 0;
		pair<double, double> p(x[i], y[i]);
		for (int k = 0; k < n; k++) {
			if (dist(p, make_pair(x[k], y[k])) <= r[k] ) cnt++;
		}
		ans = max(ans, cnt);
	}*/
//cout<<ans<<" ";
//ans=0;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			vector<pair<double, double>> pts = circle_circle_intersection(x[i], y[i], r[i], x[j], y[j], r[j]);
			for (auto p: pts) {
				int cnt = 0;
				//cout << i << ' ' << j << ' ' << p.first << ' ' << p.second << '\n';
				//cout << x[i] << ' ' << y[i] << ' ' << r[i] << '\n';
				//cout << x[j] << ' ' << y[j] << ' ' << r[j] << '\n';
				for (int k = 0; k < n; k++) {
					if (dist(p, make_pair(x[k], y[k])) <= r[k] + EPS) cnt++;
				}
				ans = max(ans, cnt);
			}
		}
	}
	
	//cout<<ans<<endl;
	return ans;
}

signed main() {
	ios::sync_with_stdio(0); cin.tie(0);
	//feenableexcept(29);
//freopen("input.txt","r",stdin);
	cin >> n >> k;
	if (k == 1) {
		cout << "0\n"; exit(0);
	}
	for (int i = 0; i < n; i++) {
		cin >> x[i] >> y[i] >> c[i];
	}

	double lo = 0, hi = 100000000;
	while(hi-lo>=1e-7)
	{
		double mid = (lo + hi)/2;

		if (check(mid) >= k) {
			hi = mid;
		} else {
			lo = mid;
		}
		//cout<<check(mid)<<endl;
	}
	cout << fixed << setprecision(9) << hi << '\n'; 

	return 0;
}


Measured memory_bytes: 384
from math import sqrt
n, m = map(int, input().split())
ans = 1
for i in range(int(sqrt(m))):
    if m%(i+1)==0:
        if n <= m//(i+1) : ans= max(ans, i+1)
        if n <= i+1 : ans = max(ans,m//(i+1))
print(ans)

Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <functional>
#include <utility>
#include <cctype>
#include <fstream>

using namespace std;

#define ll long long
#define INF 2000000000
#define LINF 9000000000000000000
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define du(x) cout<<#x<<'='<<x<<endl
#define du2(x,y) cout<<#x<<'='<<x<<' '<<#y<<'='<<y<<'\n'<<endl
#define du3(x,y,z) cout<<#x<<'='<<x<<' '<<#y<<'='<<y<<' '<<#z<<'='<<z<<'\n'<<endl
#define darr(arr,n) rep(i,(n-arr)){cout<<*(arr+i)<<' ';}cout<<endl
#define ddarr(arr,a,b) rep(i,a){rep(j,b){cout<<*(arr+i*b+j)<<' ';}cout<<endl;}
#define ddd ifstream in("Text.txt");cin.rdbuf(in.rdbuf());

int Amat[101][101];
ll Bmat[101];
ll Cmat[101];


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

    rep(i, N)rep(j, M)cin >> Amat[i][j];
    rep(i, M)cin >> Bmat[i];

    rep(i, N)rep(j, M)Cmat[i] += Amat[i][j] * Bmat[j];

    rep(i, N)cout << Cmat[i] << endl;
}


Measured memory_bytes: 3176
#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>
#include <cmath>
#include <map>
#include <set>
#include "boost/multiprecision/cpp_int.hpp"
using ll = long long;
using ull = unsigned long long;
namespace mp = boost::multiprecision;

int main() {

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

	std::set<ull> set;

	int N; std::cin >> N;

	for (int i = 0; i < N; i++) {
		int A; std::cin >> A;
		if (set.find(A) == set.end())set.insert(A);
		else set.erase(A);
	}

	std::cout << set.size();

	return 0;

}

Measured memory_bytes: 4992
N,K=map(int,input().split())

a=0
b=0
c=0
if N<K:
        c+=1
        print(c)
        exit()
for _ in range(36): #log2 10^9=9log2 10<36
    a=N//K
    b=N%K
    N=a
    c+=1
    if a<K:
        c+=1
        print(c)
        exit()




Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int a[] = new int[n];

		for(int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
		}


		int count = 0;
		//配列の要素の1つでも奇数なら2で割らない

		while(true) {
			Boolean b = true;
			for (int i = 0; i < a.length; i++) {
				if(a[i] % 2 != 0) {
					b = false;		//奇数
				}
			}

			if (!b) {
				break;
			}

			for (int j = 0; j < a.length; j++) {
				a[j] = a[j] / 2;
			}
			count++;
		}



		System.out.println(count);
	}

}


Measured memory_bytes: 21972
N, M = map(int, input().split())
t = [-1] * N
import sys
sys.setrecursionlimit(10 ** 9)

root = [-1] * N

def parent(x):
    if root[x] < 0:
        return x
    root[x] = parent(root[x])
    return root[x]


def union(x, y):
    x_parent = parent(x)
    y_parent = parent(y)
    if x_parent == y_parent:
        return
    root[x_parent] += root[y_parent]
    root[y_parent] = x



for i in range(M):
    a,b = map(int, input().split())
    union(a-1,b-1)
ans = -1
for i in root:
    if i < 0:
        ans += 1
print(ans)

Measured memory_bytes: 11840
#include <bits/stdc++.h>
using namespace std;
int main () {
	string s;
	cin >> s;
	int a,b,c,d;
	a = (int)(s[0] - '0');
	b = (int)(s[1] - '0');
	c = (int)(s[2] - '0');
	d = (int)(s[3] - '0');
	bool signb[3];
	for (int i = 0; i < 2; ++i)
	{
		for (int j = 0; j < 2; ++j)
		{
			for (int k = 0; k < 2; ++k)
			{
				int tmp = a;
				if(i == 0){
					tmp += b;
				}else{
					tmp -= b;
				}
				if(j == 0){
					tmp += c;
				}else{
					tmp -= c;
				}
				if(k == 0){
					tmp += d;
				}else{
					tmp -= d;
				}
				if(tmp == 7){
					signb[0] = (i == 0);
					signb[1] = (j == 0);
					signb[2] = (k == 0);
					break;
				}
			}
		}
	}
	cout << a;
	if(signb[0])cout << "+";
	else cout << "-";
	cout << b;
	if(signb[1])cout << "+";
	else cout << "-";
	cout << c;
	if(signb[2])cout << "+";
	else cout << "-";
	cout << d << "=7"<<endl;

}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
	long long int n,count=0;
	string s;
	cin>>s;
	for(n=0;s[n]!='\0';n++)
		count+=((s[n])-48);
	if(count%9==0)
		cout<<"Yes"<<endl;
	else 
		cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 3736
#include <vector>
#include <tuple>

#include <utility>
#include <algorithm>
#include <iostream>

// Graph template (start)
template <class... Args>
struct Edge
{
    int from, to;
    std::tuple<Args...> values;
    Edge(int from, int to, Args... values)
        : from(from), to(to), values(values...) {}
};

template <class E>
auto operator<(const E &e, const E &f)
{
    return e.values > f.values;
}

template <class... Args>
class Graph
{
    using Edges = std::vector<Edge<Args...>>;
    std::vector<Edges> graph_;

  public:
    Graph(int n) : graph_(n) {}
    std::size_t size() { return graph_.size(); };
    std::size_t size() const { return graph_.size(); };
    auto &operator[](unsigned int x) { return graph_[x]; }
    const auto &operator[](unsigned int x) const { return graph_[x]; }
    void AddEdge(int s, int t, Args... v) { graph_[s].emplace_back(s, t, v...); }
    void AddEdge(Edge<Args...> e) { graph_[e.from].push_back(e); }
};
// Graph template (end)

//再帰ラムダ用テンプレート
template <typename F>
class FixPoint : F
{
  public:
    explicit constexpr FixPoint(F &&f) noexcept
        : F(std::forward<F>(f))
    {
    }

    template <typename... Args>
    constexpr decltype(auto)
    operator()(Args &&... args) const
    {
        return F::operator()(*this, std::forward<Args>(args)...);
    }
};

template <typename F>
static inline constexpr decltype(auto)
makeFixPoint(F &&f) noexcept
{
    return FixPoint<F>{std::forward<F>(f)};
}

//トポロジカル順序でソートされた、頂点集合の配列を返す
template <typename G>
auto TopologicalSort(const G &g)
{
    const int kSize = g.size();
    std::vector<int> sorted;
    sorted.reserve(kSize);
    std::vector<bool> visited(kSize, false);
    auto topo_dfs = makeFixPoint([&](auto f, int n) -> void {
        if (!visited[n])
        {
            visited[n] = true;
            for (const auto &e : g[n])
            {
                f(e.to);
            }
            sorted.push_back(n);
        }
    });
    for (int i = 0; i < kSize; ++i)
    {
        topo_dfs(i);
    }
    std::reverse(sorted.begin(), sorted.end());
    return sorted;
}

int main()
{
    int n, m;
    std::cin >> n >> m;
    Graph<> g(n);
    for (int i = 0; i < m; ++i)
    {
        int u, v;
        std::cin >> u >> v;
        g.AddEdge(u, v);
    }
    auto ans = TopologicalSort(g);
    for (auto x : ans)
    {
        std::cout << x << std::endl;
    }
}
// be checked by AOJ(GRL-4-B).


Measured memory_bytes: 3972
import math
A,B,C,D=map(int,input().split())

c=((B-B%C)-(A-1+C-(A-1)%C))//C+1
d=((B-B%D)-(A-1+D-(A-1)%D))//D+1
lcm=C*D//math.gcd(C,D)
candd=((B-B%lcm)-(A-1+lcm-(A-1)%lcm))//lcm+1
print(int(B-A+1-c-d+candd))

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

int main(){

  int n;
  cin>>n;
  int matrix[n][3];
  for(int i=0;i<n;i++){
    for(int j=0;j<3;j++){
      cin>>matrix[i][j];
    }
  }

  int dp[n][3];
  // base case
  for(int j=0;j<3;j++){
    dp[0][j]=matrix[0][j];
  }

  //fill dp array
  for(int i=1;i<n;i++){
    for(int j=0;j<3;j++){

      int best=INT_MIN;
      for(int k=0;k<3;k++){
        if(k==j){
          continue;
        }
        best=max(best,dp[i-1][k]);
      }

      dp[i][j]=best+matrix[i][j];
    }
  }

  int ans=INT_MIN;
  for(int j=0;j<3;j++){
    ans=max(ans,dp[n-1][j]);
  }
  cout<<ans<<endl;
  return 0;
}


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

void Main()
{
  const ll Q = 1e9+7;
  ll N, M;
  cin >> N >> M;
  ll diff = abs(N-M);
  if (diff > 1) {cout << 0 << endl; return;}
  ll ans = 1;
  for(int i = 1; i <= N; i++) ans = (ans * i) % Q;
  for(int i = 1; i <= M; i++) ans = (ans * i) % Q;
  if (diff == 0) cout << (ans*(ll)2)%Q << endl;
  else cout << ans << endl;
}

int main()
{
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  Main();
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,k;
int a[51];
int sum=0;

int main(){
  cin>>n>>k;
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  sort(a,a+n);
  reverse(a,a+n);
  for(int i=0;i<k;i++){
    sum+=a[i];
  }
  cout<<sum<<endl;
  return(0);
}


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

int main(void){
    
    int n;
    cin>>n;
    vector<int> v(n);
    
    for(int i=0; i<n; i++){
        cin>>v[i];
    }
    
    int minw=100000000;
    for(int i=0; i<n; i++){
        int sum1=0, sum2=0;
        
        for(int j=0; j<=i; j++){
            sum1+=v[j];
        }
        for(int j=i+1; j<n; j++){
            sum2+=v[j];
        }
        
        
        minw=min(minw, (int)fabs(sum1-sum2));
        
    }
    
    cout<<minw<<endl;
}


Measured memory_bytes: 256
//For higher stack size use g++ -O2 -std=c++11 -Wall -Wl,--stack=268435456 a.cpp -o a.exe in cmd
    #include <bits/stdc++.h>
    #include <cstdio>
    #include <cstring>
    #include <cmath>
    #include <cstring>
    #include <chrono>
    #include <complex>
    #define ll long long
    #define ld long double
    #define vi vector<int>
    #define vll vector<ll>
    #define vvi vector < vi >
    #define pii pair<int,int>
    #define pll pair<long long, long long>
    #define mod 1000000007
    #define inf 1000000000000000001;
    #define all(c) c.begin(),c.end()
    #define mp(x,y) make_pair(x,y)
    #define mem(a,val) memset(a,val,sizeof(a))
    #define eb emplace_back
    #define pb push_back
    #define f first
    #define s second
    
    using namespace std;

    ll dp[1001][5];
    string s;

    void reset()
    {
        int i,j;
        for(i=0;i<=150;++i)
            for(j=0;j<=3;++j)
                dp[i][j]=-1;
    }

    ll calc(ll n,ll k)
    {
        if(k<0)
            return 0;
        if(n==0)
        {
            if(k==0)
                return 1;
            return 0;
        }
        if(k>n)
            return 0;
        if(k==0)
            return 1;
        else if(k==1)
            return n*9;
        else if(k==2)
            return n*(n-1)/2*9*9;
        else
            return n*(n-1)*(n-2)/6*9*9*9;
    }

    ll func(int i,int k)
    {
        if(k<0)
            return 0;
        if(i==s.length())
        {
            if(k==0)
                return dp[i][k]=1;
            return dp[i][k]=0;
        }
        if(dp[i][k]!=-1)
            return dp[i][k];
        if(s[i]!='0')
        {
            dp[i][k]=calc((int)(s.length())-i-1,k);
        }
        else
            dp[i][k]=0;
        for(int j=1;j<(s[i]-'0');++j)
        {
            dp[i][k]=dp[i][k]+calc(s.length()-i-1,k-1);
        }
        if(s[i]=='0')
            dp[i][k]=dp[i][k]+func(i+1,k);
        else
            dp[i][k]=dp[i][k]+func(i+1,k-1);
        return dp[i][k];
    }

    int main()
    {
        std::ios::sync_with_stdio(false);
        int T;
        T=1;
        // cin.ignore(); must be there when using getline(cin, s)
        while(T--)
        {
            
            cin>>s;
            int n,i,j,k;
            cin>>k;
            reset();
            ll ans=0;
            ans=func(0,k);
            cout<<ans<<endl;
        }
        return 0;
    }


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

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

Measured memory_bytes: 19228
#include <cstdio>

int main()
{
  int w, h, x, y, r, top, bottom, left, right;
  scanf("%d %d %d %d %d", &w, &h, &x, &y, &r);

  top = y + r;
  bottom = y - r;
  left = x - r;
  right = x + r;

  if (left < 0 || right > w || bottom < 0 || top > h)
  {
    printf("No\n");
    return 0;
  }
  printf("Yes\n");

  return 0;
}


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

int main()
{
	int i, j, k, count=0, r, g, b, n;
	cin >> r >> g >> b >> n;
	int total=n;
	for(i=0; i<=n/r; i+=1)
	{
		for(j=0; j<=n/g; j+=1)
		{
			total=n-i*r-g*j;
			//cout << j << " " << total << endl;
			if(total%b==0 && total>=0)
			{
				count+=1;
				//cout << i << " " << j << " " << total/b << endl;
			}
		}
	}
	cout << count << endl;
}

Measured memory_bytes: 256
A=int(input())
B=int(input())
C=int(input())
D=int(input())
E=int(input())

a=10-(A%10)
b=10-(B%10)
c=10-(C%10)
d=10-(D%10)
e=10-(E%10)
if a==10:
  a=0
if b==10:
  b=0
if c==10:
  c=0
if d==10:
  d=0
if e==10:
  e=0
SUM=max(a,b,c,d,e)
print(A+B+C+D+E+a+b+c+d+e-SUM)


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
typedef  long long ll;
using vll=vector<ll>;
using vi=vector<int>;

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

//pow(llpow,modpow)
template<class T> ll llpow(T x,T n){ll ans=1;if(x==0)ans=0;while(n){if(n&1)ans*=x;x*=x;n>>=1;}return ans;}
long long modpow(long long a, long long n, long long mod) {long long res = 1;while (n > 0) {if (n & 1) res = res * a % mod;a = a * a % mod;n >>= 1;}return res;}
//最大公約数
template<class T> inline T gcd(T x,T y){if(y==0)return x; else {return gcd(y,x%y);}}
//最小公倍数
template<class T> inline T lcm(T x,T y){return x/gcd(x,y)*y;}
//逆元
long long modinv(long long a, long long m) {long long b = m, u = 1, v = 0;while (b) {long long t = a / b;a -= t * b; swap(a, b);u -= t * v; swap(u, v);}u %= m;if (u < 0) u += m;return u;}

#define rep(i,n) for(ll i=0;i<(ll)n;i++)
#define rep2(i, begin_i, end_i) for (ll i = (ll)begin_i; i < (ll)end_i; i++)



ll solve(int n,int k){
    int reserve;
    int sep=2;
    ll res=0;
    if(k%2==1){ll full=n/k;return llpow(full,3LL);}
    else {
        ll full =n/k; ll half=n/(k/2)-full;
        return llpow(full,3LL)+llpow(half,3LL);
    }
    }
long long INF = 1LL<<60;
int main(){
    int n,k;
    cin>>n>>k;
    ll res=solve(n,k);
    cout<<res<<endl;
    return 0;
}




Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
using namespace std;
int main(){
  int a;
  cin>>a;
  while(a){
    if(a%10==7){
      cout<<"Yes"<<endl;
      return 0;
    }
    a/=10;
  }
  cout<<"No"<<endl;
  return 0;
}

Measured memory_bytes: 3672
m,i,j,k,t[16],c[16],p,d;
main(n){
	for(*t=1;++i<16;)t[i]=n*=3;
	for(;scanf("%d%d",&n,&m),n;printf("%d\n",j>m?-1:j)){
		for(k=3;k--;)
			for(scanf("%d",&i);i--;c[j]=k)scanf("%d",&j);
		for(p=j=k=0;k++<n;)
			j+=t[n-k]*abs(i=p-c[k]),p=i%2*2+p&3;
		j=fmin(j,t[n]+~j);
	}
	return 0;
}

Measured memory_bytes: 0
#include <stdio.h>
#include<string.h>

int main(void)
{
	char s[6], t[3]="AC";
	int i,lon;
	
	scanf("%s",s);
	
	if(strstr(s,t)!=NULL){
		printf("Yes\n");
	} else{
		printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <iostream>
#include <ctime>
using namespace std;
#define _LL long long
#define rep(i, n) for (_LL i = 0; i < (_LL)(n); i++)
#define vecrep(itr, v) for (auto itr = (v).begin(); itr != (v).end(); itr++)

int g_bm = 998244353;

int modl(_LL a)
{
    a %= g_bm;
    if( a < 0 ) a += g_bm * ( 1 - (a + 1) / g_bm );
    return a;
}

int modadd(_LL a, _LL b)
{
    return modl(a + b);
}

int modminus(_LL a, _LL b)
{
    return modl(a - b);
}

int modmul(_LL a, _LL b)
{
    return modl(a * b);    
}


int main()
{
    int n, s;
    cin >> n >> s;
    int *cnt = new int[s];
    int *next = new int[s];
    int *a = new int[n];
    rep(i, n) cin >> a[i];

    int ans = 0;

    rep(i, n)
    {
        if( a[i] > s ) continue;
        if( a[i] == s )
        {
            ans = modadd( ans, modmul(i + 1, n - i));
            continue;
        }
        ans = modadd(ans, modmul(cnt[s - a[i]], n - i));

        int ruiseki = 0;
    
        rep(j, s - a[i])
        {
            if( j == 0 ) 
            {
                next[a[i] + j] = i + 1;
            }
            else
            {
                next[a[i] + j] = cnt[j];
            }
        }
        rep(j, s - a[i]) cnt[a[i] + j] = modadd(cnt[a[i] + j], next[a[i] + j]);
    }

    cout << ans;
}

Measured memory_bytes: 3640
import Control.Monad (replicateM_)
import Data.Char (ord,chr)
import Data.Array (array,bounds,inRange,(!))
import Data.List (isInfixOf)

main = do
    n <- readLn
    replicateM_ n (getLine >>= return . solve >>= putStrLn)

solve :: String -> String
solve s = head $ filter match $ map (\k -> decipher k s) keys
    where
    match s = ("this" `isInfixOf` s) || ("that" `isInfixOf` s)

keys :: [(Int,Int)]
keys = [(a,b)|a<-[1..25], gcd a 26 == 1, b<-[0..25]]

decipher :: (Int,Int) -> String -> String
decipher (a,b) = map decode
    where
    decode c
        | inRange (bounds table) c = table!c
        | otherwise = c

    table = array ('a','z') [(cipherLetter (a,b) c, c)|c<-['a'..'z']]

    cipherLetter (a,b) c = chr ((ord 'a') + (a * x + b) `mod` 26)
        where
        x = (ord c) - (ord 'a')

Measured memory_bytes: 4204
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long[] count_right = new long[n], count_left = new long[n];
		for(int i=0;i<n;i++) {
			int temp = sc.nextInt();
			if(i-temp>=0) count_left[i-temp]++;
			if(i+temp<n) count_right[i+temp]++;
		}
		sc.close();
		long ans=0;
		for(int i=0;i<n;i++) ans += count_left[i]*count_right[i];
		System.out.println(ans);
	}
}

Measured memory_bytes: 62448
#include <stdio.h>

int n, q, x1[10000], y1[10000], x2[10000], y2[10000], imos[10001];

int main()
{
    while(true)
    {
        scanf("%d", &n);
        scanf("%d", &q);
        
        if(n == 0 && q == 0) break;
    
        for(int i = 0; i < n; i++)
        {
            scanf("%d", &x1[i]);
            scanf("%d", &y1[i]);
            scanf("%d", &x2[i]);
            scanf("%d", &y2[i]);
        }
    
        int ret1 = 0;
        int ret2 = 0;
    
        // tate
    
        for(int i = 0; i < 10000; i++)
        {
            for(int j = 0; j < n; j++)
            {
                if(y1[j] <= i && i < y2[j])
                {
                    imos[x1[j]]++;
                    imos[x2[j]]--;
                }
            }
            
            int sum = 0;
            
            for(int j = 0; j <= 10000; j++)
            {
                if((sum == 0 && sum + imos[j] > 0) || (sum > 0 && sum + imos[j] == 0)) ret2++;
                
                sum += imos[j]; imos[j] = 0;
                
                if(sum > 0) ret1++;
            }   
        }   
            
        // yoko
        
        for(int i = 0; i < 10000; i++)
        {
            for(int j = 0; j < n; j++)
            {
                if(x1[j] <= i && i < x2[j])
                {
                    imos[y1[j]]++;
                    imos[y2[j]]--;
                }
            }
            
            int sum = 0;
            
            for(int j = 0; j <= 10000; j++)
            {
                if((sum == 0 && sum + imos[j] > 0) || (sum > 0 && sum + imos[j] == 0)) ret2++;
                
                sum += imos[j]; imos[j] = 0;
            }
        }
        
        if(q == 1)
        {
            printf("%d\n", ret1);
        }
        else
        {
            printf("%d\n", ret1);
            printf("%d\n", ret2);
        }
    }
    
    return 0;
}

Measured memory_bytes: 2756
#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 <cstring>
using namespace std;
int a[200005],b[200005],c[200005],n;
long long l[200005],r[200005];
int main(){
	cin>>n;
	for(int i=1;i<=n;i++)
		cin>>a[i];
	for(int i=1;i<=n;i++)
		l[i]=l[i-1]+a[i];
	for(int i=n;i>=1;i--)
		r[i]=r[i+1]+a[i];
	b[2]=1;
	for(int i=3;i<=n;i++){
		long long rt=l[i]-l[b[i-1]];
		long long lf=l[b[i-1]];
		int j=b[i-1],k=j;
		while(j<i&&rt>=lf){
			rt-=a[j+1];
			lf+=a[j+1];
			k=j;
			j++;
		}
		if(j<i){
			if(abs(rt-lf)<abs(rt+a[j]-lf+a[j])){
				k=j;
			}
		}
		b[i]=k;
	}
	c[n-1]=n;
	for(int i=n-2;i>=1;i--){
		long long rt=r[i]-r[c[i+1]];
		long long lf=r[c[i+1]];
		int j=c[i+1],k=j;
		while(j>i&&rt>=lf){
			rt-=a[j-1];
			lf+=a[j-1];
			k=j;
			j--;
		}
		if(j>i){
			if(abs(rt-lf)<abs(rt+a[j]-lf+a[j])){
				k=j;
			}
		}
		c[i]=k;
	}
	long long ans=1e18;
	for(int i=2;i<=n-2;i++){
		long long l1=l[b[i]];
		long long r1=l[i]-l1;
		long long l2=r[c[i+1]];
		long long r2=r[i+1]-l2;
		//cout<<l1<<" "<<r1<<" "<<l2<<" "<<r2<<endl;
		long long tmp=0;
		tmp=max(abs(l1-r1),abs(l1-l2));
		tmp=max(tmp,abs(l1-r2));
		tmp=max(tmp,abs(r1-l2));
		tmp=max(tmp,abs(r1-r2));
		tmp=max(tmp,abs(l2-r2));
		ans=min(ans,tmp);
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 5760
#include <stdio.h>
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>

using ll = long long int;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

int main(void){
	int n,m,i,d,ans=INF,tmp;
	std::string s,t;
	std::cin >> s >> t;
	n = s.l_ength();
	m = t.l_ength();
	for(d=0; d<n; ++d){
		if(d+m>n){
			break;
		}
		tmp = 0;
		for(i=0; i<m; ++i){
			if(s[i+d]!=t[i]){
				++tmp;
			}
		}
		ans = std::min(ans,tmp);
	}
	std::cout << ans << std::endl;
	return 0;
}


Measured memory_bytes: 3600
use std::io::{BufRead, Write};
use std::io;
use std::collections::HashSet;
use std::iter;

fn pop(remaining: &mut HashSet<usize>, adjacency: &Vec<Vec<usize>>, current: usize) -> Vec<usize> {
    for i in &adjacency[current] {
        if remaining.remove(i) {
            let mut result = pop(remaining, adjacency, *i);
            result.push(*i);
            return result;
        }
    }
    return Vec::new();
}

fn solve<R: BufRead, W: Write>(mut input: R, mut output: W) {
    let mut s = String::new();
    input.read_line(&mut s).unwrap();
    let mut split = s.split_whitespace();
    let n = split.next().unwrap().parse::<usize>().unwrap();
    let m = split.next().unwrap().parse::<usize>().unwrap();
    let mut adjacency = vec![Vec::<usize>::new();n];
    for _ in 0..m {
        let mut s = String::new();
        input.read_line(&mut s).unwrap();
        let mut split = s.split_whitespace();
        let a = split.next().unwrap().parse::<usize>().unwrap() - 1;
        let b = split.next().unwrap().parse::<usize>().unwrap() - 1;
        adjacency[a].push(b);
        adjacency[b].push(a);
    }
    let mut remaining = (0..n).collect::<HashSet<_>>();
    remaining.remove(&0);
    let after = pop(&mut remaining, &adjacency, 0);
    let before = pop(&mut remaining, &adjacency, 0);
    let result = before
        .into_iter()
        .chain(iter::once(0))
        .chain(after.into_iter().rev())
        .map(|x| (x + 1).to_string())
        .collect::<Vec<_>>();
    writeln!(output, "{}\n{}", result.len(), result.join(" ")).unwrap();
}

fn main() {
    let stdin = io::stdin();
    let stdout = io::stdout();
    solve(stdin.lock(), stdout.lock());
}

#[cfg(test)]
mod tests {
    fn test(input: &str, output: &str) {
        let mut v = Vec::<u8>::new();
        ::solve(input.as_bytes(), &mut v);
        assert_eq!(String::from_utf8(v).unwrap(), output);
    }
    #[test]
    fn case1() {
        test("5 6
1 3
1 4
2 3
1 5
3 5
2 4\n",
             "4
2 3 1 4\n");
    }
    #[test]
    fn case2() {
        test("7 8
1 2
2 3
3 4
4 5
5 6
6 7
3 5
2 6\n",
             "7
1 2 3 4 5 6 7\n");
    }
    #[test]
    fn case3() {
        test("12 18
3 5
4 12
9 11
1 10
2 5
6 10
8 11
1 3
4 10
2 4
3 7
2 10
3 12
3 9
1 7
2 3
2 11
10 11\n",
             "8
12 4 2 5 3 9 11 8\n");
    }
}


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

ll dp[3010][3010][4];

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);

	int r, c, k;
	cin >> r >> c >> k;
	vector<vector<ll>> val(r, vector<ll>(c));
	rep(i, k) {
		int x, y, v;
		cin >> x >> y >> v;
		x--; y--;
		val[x][y] = v;
	}
	rep(i, r) {
		rep(j, c) {
			rep(d, 4) {
				chmax(dp[i + 1][j + 1][d], dp[i + 1][j][d]);
				chmax(dp[i + 1][j + 1][0], dp[i][j + 1][d]);
			}
			if (val[i][j]) {
				rep(d, 4) {
					chmax(dp[i + 1][j + 1][1], dp[i][j + 1][d] + val[i][j]);
					if (d) chmax(dp[i + 1][j + 1][d], dp[i + 1][j][d - 1] + val[i][j]);
				}
			}
		}
	}
	ll ans = 0;
	rep(d, 4) chmax(ans, dp[r][c][d]);
	cout << ans << '\n';
}

Measured memory_bytes: 355336
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_ll.hpp>
//typedef boost::multiprecision::cpp_ll ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E18;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
//#define endl "\n"
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);


int main(){fastio
    string s;cin>>s;
    rep(i,0,s.size()-1){
        if(s[i]=='?'){
            cout<<'D';
        }else{
            cout<<s[i];
        }
    }
    cout<<endl;
    
    return 0;
}





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

int main()
{
long long int n,ans=-200000000000,mn;
cin >> n >> mn;
    for(int i=0;i<n-1;i++)
    {
    long long int a;
    cin >> a;
    ans =max(a-mn,ans);
    mn = min(a,mn);
    }
cout << ans<<endl;
return 0;
}


Measured memory_bytes: 3068
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define     ll          long long int
#define     REP(i,x,n)    for(ll i=x;i<n;i++)
#define     SZ(v)       (ll)v.size()
#define     endl        "\n"
#define     ff          first
#define     ss          second
#define     PQ_MIN      priority_queue <ll, vector<ll>, greater<ll> >
#define     PQ          priority_queue <int>
#define     pbds        tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define     setbit(x)   __builtin_popcount(x)
#define     prec(n)     fixed<<setprecision(n)
#define     pb(n)       push_back(n)
#define     clr(n)      memset(n,0,sizeof(n))
#define     reset(n)    memset(n,-1,sizeof(n))
#define     ii          pair<ll,ll>
#define     vll         vector<ll>

using namespace std;
using namespace __gnu_pbds;
bool comp(pair<ll,ll> a,pair<ll,ll> b) {       }
const ll INF=1e16;
const ll MOD=5;
const ll nxm=1e6+5;
vector<ll> allprime;
bool isprime[nxm];
void sieve()
{
    memset(isprime,1,sizeof(isprime));
    for(ll i=2;i<nxm;i++)
    {
        if(isprime[i])
        for(ll j=i*i;j<nxm;j+=i)
        {
            isprime[j]=0;
        }
    }
    for(ll i=2;i<nxm;i++)
        if(isprime[i])
        allprime.push_back(i);
}
void print(vector<vector<ll> >&v)
{
    ll n=v.size();
    ll m=v[0].size();
    cout<<"\n";
    for(ll i=0;i<n;i++)
    {
        for(ll j=0;j<m;j++)
            cout<<v[i][j]<<" ";
        cout<<"\n";
    }
}
void print(vector<ll>&v)
{
    ll n=v.size();
    cout<<"\n";
    for(ll i=0;i<n;i++)
    {
            cout<<v[i]<<" ";
    }
        cout<<"\n";

}
void print(set<ll>&s)
{

cout<<endl;

set<ll>::iterator it;
for(it=s.begin();it!=s.end();it++)
    cout<<*it<<" ";
cout<<endl;
}

ll power(ll a,ll p)
{
    ll res=1;
    while(p>0)
    {
        if(p&1){
            res=(res*a)%MOD;
            p--;
        }
            a=(a*a)%MOD;
            p/=2;
    }

    return res%MOD;


}
ll __lcm(ll a,ll b)
{
    return ((a*b)/__gcd(a,b));
}
ll fact(ll a)
{
    ll res=1;
    for(ll i=1;i<=a;i++)
        res*=i;
    return res;
}
ll sqroot[nxm];
ll perfect_square()
{
    memset(sqroot,-1,sizeof(sqroot));
    for(ll i=1;i*i<=nxm;i++)
    {
        sqroot[(i*i)]=i;
    }
}
bool is_prime(ll n)
{
    for(ll i=2;i*i<=n;i++)
        if(n%i==0)
        return false;
    return true;
}
const ll ind=1e4+5;
ll a[ind];
void solve(){
ll n;cin>>n;
for(ll i=1;i<n;i++)
    for(ll j=1;j<n;j++)
        for(ll k=1;k<n;k++)
{
    ll val=i*i+j*j+k*k+i*j+j*k+k*i;
    if(val<ind)
        a[val]++;
    else
        break;
}
REP(i,1,n+1)
cout<<a[i]<<endl;
}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	ll t=1;
//	cin >> t;
	while(t--){
		solve();
	}
	return 0;
}


Measured memory_bytes: 3576
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<string,int>;
using T = tuple<string,int,int>;

char g[2000][2000];
int H,W;

int dfs(int x, int y){
  int cnt = 1;
  for(int i = y-1; i >= 0; i--){
    if(g[x][i] == '#') break;
    cnt++;
  }
  for(int i = y+1; i < W; i++){
    if(g[x][i] == '#') break;
    cnt++;
  }
  for(int i = x-1; i >= 0; i--){
    if(g[i][y] == '#') break;
    cnt++;
  }
  for(int i = x+1; i < H; i++){
    if(g[i][y] == '#') break;
    cnt++;
  }
  return cnt;
}

int main(){
  cin >> H >> W;
  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){
      cin >> g[i][j];
    }
  }
  int ma = H+W-1;
  int ans = 0;
  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){
      if(g[i][j] == '#') continue;
      int temp = dfs(i,j);
      ans = max(ans, temp);
      if(ans == ma) break;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 4096
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float("INF")

#A
def A():
    return

#B
def B():
    return

#C
def C():
    s = stdin.readline().rstrip()
    K = II() - 1
    ans = []
    for i in range(len(s)):
        for k in range(K+1):
            b = s[i:i + k + 1]
            ans.append(b)
    ans = list(set(ans))
    ans.sort()
    print(ans[K])
    return

#D
def D():
    n, m = LI()
    p = LI_()
    xy = LIR_(m)
    size = [1 for _ in range(n)]
    height = [1 for _ in range(n)]
    par = [i for i in range(n)]
    def find(x):
        if par[x] == x:
            return x
        else:
            par[x] = find(par[x])
            return par[x]
    def union(x, y):
        s1 = find(x)
        s2 = find(y)
        if s1 != s2:
            if height[s1] < height[s2]:
                par[s1] = s2
                size[s2] += size[s1]
                size[s1] = 0
            else:
                par[s2] = s1
                size[s1] += size[s2]
                size[s2] = 0
                if height[s1] == height[s2]:
                    height[s1] += 1

    for x,y in xy:
        union(x, y)
    ans = 0
    for i in range(n):
        if find(p[i]) == find(i):
            ans += 1
    
    print(ans)
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == '__main__':
    C()


Measured memory_bytes: 41328
#include<iostream>
#include<cstdio>
#include<vector>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm>
#include<queue>
#include<map>
#include<set>
#define  endl '\n'
#define all(s) s.begin(),s.end()
#define lowbit(x) (x&-x)
#define rep(i,a,n) for (int i=a;i<=n;i++)
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define mem(a,b) memset(a,b,sizeof(a))
#define fi first
#define se second
#define pb push_back
#define pi acos(-1.0)
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int mod=1e9+7;
const double eps=1e-8;
const int inf=0x3f3f3f3f;
const int N=2e5+10;
ll a[N];
int main()
{
	int n,m,q,k;
	long double a,b;
	cin>>a>>b;
	a=a*b;
	string s=to_string((a));
	for(int i=0;i<s.length();i++){
		if(s[i]=='.') break;
		cout<<s[i];
	}
}


Measured memory_bytes: 3824
#include <bits/stdc++.h>
#include <limits.h>
#include <algorithm>  
#include <numeric>
 
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
 
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define endl '\n'
using ll = long long;
 
const int precision = 3;
const int modulo =  1000000007; // 10^9 + 7
const ll lmodulo =  1000000007; // 10^9 + 7
 
const double EPS = 1e-9;
const ll inf = 1e18;


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

	vector<vector<int>> dp(s.size() + 1, vector<int> (t.size() + 1, 1e9));
	
	iota(dp[0].begin(), dp[0].end(), 0);
	for (auto i = 0; i < dp.size(); ++i) {
		dp[i][0] = i;
	}

	for (auto r = 1; r < dp.size(); ++r) {
		for (auto c = 1; c < dp[0].size(); ++c) {
			if(s[r - 1] == t[c - 1]) {
				dp[r][c] = dp[r- 1][c - 1];
			} else {
				dp[r][c] = min(dp[r - 1][c], dp[r][c - 1]) + 1;
				dp[r][c] = min(dp[r][c], 1000000000);
			}
		}
	}

	string ret = "";

	int r = s.size();
	int c = t.size();

	while (r > 0 and c > 0) {
		if (s[r - 1] == t[c - 1]) {
			ret += s[r - 1];
			r--;
			c--;
		} else {
			if (dp[r - 1][c] < dp[r][c - 1]) {
				r--;
			} else {
				c--;
			}
		}
	}

	reverse(ret.begin(), ret.end());
	cout << ret << endl;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  cout.precision(precision);
  cout.setf(ios_base::fixed);
  solve();
  return 0;
}



Measured memory_bytes: 35584
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <complex>
#define rep(i, n) for (i = 0; i < n; i++)
using namespace std;
typedef complex<double> Point;
 
const double PI = 3.14159265358979;
 
double cross(Point a, Point b) {
	return a.real() * b.imag() - a.imag() * b.real();
}
 
double dot(Point a, Point b) {
	return a.real() * b.real() + a.imag() * b.imag();
}
 
bool isOn(Point s, Point e, Point p) {
	if (cross(e - s, p - s) != 0) return false;
	return dot(p - s, p - e) <= 0;
}
 
int n;
Point p[100];
 
bool isInTriangle(int id) {
	int i, j, k;
	for (i = 0; i < n; i++) {
		if (i == id) continue;
		for (j = i + 1; j < n; j++) {
			if (j == id) continue;
			for (k = j + 1; k < n; k++) {
				if (k == id) continue;
				if (cross(p[j] - p[i], p[k] - p[i]) == 0) continue;
				if (isOn(p[i], p[j], p[id])) return true;
				if (isOn(p[j], p[k], p[id])) return true;
				if (isOn(p[k], p[i], p[id])) return true;
				double a = cross(p[j] - p[i], p[id] - p[i]);
				double b = cross(p[k] - p[j], p[id] - p[j]);
				double c = cross(p[i] - p[k], p[id] - p[k]);
				if (a < 0 && b < 0 && c < 0) return true;
				if (a > 0 && b > 0 && c > 0) return true;
			}
		}
	}
	return false;
}
 
signed main() {
	int i, j, k;
	
	cin >> n;
	rep(i, n) {
		int x, y;
		cin >> x >> y;
		p[i] = Point((double)x, (double)y);
	}
	
	rep(i, n) {
		if (isInTriangle(i)) { cout << 0 << endl; continue; }
		
		vector<Point> vs;
		rep(j, n) {
			if (j == i) continue;
			//p[i] -- p[j]の垂直2等分線の向きを考える.
			Point mul = (p[j] - p[i]) * Point(0, 1);
			Point mid = (p[i] + p[j]) * 0.5;
			if (cross(mul, p[i] - mid) < 0) {
				mul *= (-1);
			}
			//単位化しておく
			mul /= abs(mul);
			vs.push_back(mul);
		}
		
		double minDot = 1;
		for (j = 0; j < (int)vs.size(); j++) {
			for (k = j + 1; k < (int)vs.size(); k++) {
				double score = dot(vs[j], vs[k]);
				minDot = min(minDot, score);
			}
		}
		//内積から角度を出す -> ここで内積を逆転させて、argcosする
		if (minDot < -1) minDot = 1;
		double rad = acos(-minDot);
		double ans = rad / (2.0 * PI);
		
		printf("%.14f\n", ans);
	}
	return 0;
}

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

int main() {
  int A,B;
  cin >> A >> B;

  if (A == B) {
    cout << "Draw" << endl;
  }
  else if (A!=1 && B!=1 && A>B) {
    cout <<"Alice" << endl;
  }
  else if (A!=1 && B!=1 && A<B) {
    cout <<"Bob" << endl;
  }
  else if (A == 1) {
    cout << "Alice" << endl;
  }
  else {
    cout << "Bob" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb emplace_back
#define fi first
#define se second
#define int long long
using namespace std;
mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
int rng(int l) { uniform_int_distribution<int> uid(0, l - 1); return uid(rang); }

std::vector<std::vector<int> > matrix_mult(std::vector<std::vector<int> >& a, std::vector<std::vector<int> >& b, int mod)
{
	std::vector<std::vector<int> > gr(a.size(), std::vector<int> (a.size(), 0));
	for (int i = 0; i < a.size(); ++i)
		for (int j = 0; j < a.size(); ++j)
			for (int k = 0; k < a.size(); ++k)
				gr[i][j] = (gr[i][j] + a[i][k] * b[k][j]) % mod;
	return gr;
}

std::vector<std::vector<int> > matrix_expo(std::vector<std::vector<int> >& a, int n, int mod)
{
	std::vector<std::vector<int> > res(a.size(), std::vector<int> (a.size(), 0));
	for (int i = 0; i < a.size(); ++i)
		res[i][i] = 1;
	while (n) {
		if (n & 1ll)
			res = matrix_mult(res, a, mod);
		a = matrix_mult(a, a, mod);
		n >>= 1;
	}
	return res;
}

int32_t main() {
	ios::sync_with_stdio(false); cin.tie(NULL); cout.precision(10); srand(chrono::high_resolution_clock::now().time_since_epoch().count());
	int n; cin >> n;
	int k; cin >> k;
	int mod = 1e9 + 7;
	std::vector<std::vector<int> > gr(n, std::vector<int> (n));
	for (int i = 0; i < n; ++i) for (int j = 0; j < n; ++j) cin >> gr[i][j];
	gr = matrix_expo(gr, k, mod);
	int u = 0;
	for (int i = 0; i < n; ++i) for (int j = 0; j < n; ++j) u = (u + gr[i][j]) % mod;
	cout << u;
}

Measured memory_bytes: 384
#include<iostream>
#include<string>
using namespace std;
int main() {
	string S;
	cin >> S;
	for (int i = 1; i < S.size(); ++i) {
		if ((S.size() - i) % 2 == 0) {
			if (S.substr(0, (S.size() - i) / 2) == S.substr((S.size() - i)/2, (S.size() - i) / 2)) {
				cout << S.size() - i;
				break;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <numeric>
#define ll long long
using namespace std;

int main() {
    ll n, k;
    cin >> n >> k;
    int arr[n];
    for (int i; i < n; i++) {
        cin >> arr[i];
    }
    sort(arr, arr + n, greater<int>());

    ll count = 0;
    if (k >= n) {
        cout << 0;
        return 0;
    }
    cout << accumulate(arr + k, arr + n, count);
    return 0;
}


Measured memory_bytes: 1024
a = gets.to_i

if a >= 400 && a <= 599
   puts 8
end

if a >= 600 && a <= 799
  puts 7
end

if a >= 800 && a <= 999
  puts 6
end

if a >= 1000 && a <= 1199
  puts 5
end

if a >= 1200 && a <= 1399
  puts 4
end

if a >= 1400 && a <= 1599
  puts 3
end

if a >= 1600 && a <= 1799
  puts 2
end

if a >= 1800 && a <= 1999
  puts 1
end

Measured memory_bytes: 14368
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int maxn=1e5+10;
int a[maxn];
int cmp(const int a,const int b){
    return a>b;
}
int n,m,v,p;
int b[maxn];
bool judge(int mid){
    //printf("hello %lld\n",mid);
    if(mid<=p)return true;
    if(a[mid]+m<a[p])return false;
    if(v<=p-1&&a[mid]+m>=a[p])return true;
    for(int i=1;i<=n;i++)b[i]=a[i];
    int temp=0;
    for(int i=1;i<=p-1;i++){
        b[i]+=m;
        temp+=m;
    }
    //给开头的p-1个元素加值
    int inx=n,cnt=v-p+1;
    //给后面的元素加值
    while(inx>mid&&cnt>1){
        temp+=m;
        inx--;
        cnt--;
        b[inx]+=m;
    }
    temp+=m;
    int now=a[mid]+m;
    int res=m*v-temp;
    //中间还能被填多少
    for(int i=p;i<mid;i++){
        int add=min(m,max(now-a[i],0ll));
        if(add>res)add=res;
        res-=add;
        b[i]+=add;
    }
    return now>=b[p]&&res<=0;
}
signed main(){
    cin>>n>>m>>v>>p;
    for(int i=1;i<=n;i++){
        cin>>a[i];
    }
    sort(a+1,a+n+1,cmp);
    int low=1,high=n;
    int ans=0;
    while(low<=high){
        int mid=(low+high)>>1;
        if(judge(mid)){
            low=mid+1;
            ans=mid;
        }
        else{
            high=mid-1;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1792
#include <iostream>

using namespace std;

long long divisors_cnt[int(1e7) + 5];
bool is_prime[int(1e7) + 5];

int main(void)
{
    int n;

    cin >> n;

    for(int i = 1; i <= int(1e7) + 5; i++){
        divisors_cnt[i] = 1;
        is_prime[i] = true;
    }

    int div = 2;
    while(div <= n){
        is_prime[div] = false;
        int mul = 1;
        while(div * mul <= n){
            int num = div * mul;
            int index = 0;
            while(num % div == 0){
                num /= div;
                index += 1;
            }

            is_prime[div * mul] = false;
            divisors_cnt[div * mul] *= index + 1;

            mul += 1;
        }

        while(!is_prime[div]){
            div += 1;
        }
    }

    long long sum = 0;
    for(int i = 1; i <= n; i++){
        sum += i * divisors_cnt[i];
    }

    cout << sum << endl;

    return 0;
}

Measured memory_bytes: 91560