akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>

using namespace std;

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

    using vvi = vector<vector<int>>;
    vvi val(n,vector<int>(0));

    for (int i = 0; i < m; i++) {
        int a, b;
        cin >> a >> b;
        // 0-index
        a--;
        b--;
        val.at(a).push_back(b);
        val.at(b).push_back(a);
    }

    vector<int> num(n);
    for (int i = 0; i < n; i++) num.at(i) = i;

    int count = 0;

    do {
        vector<int>::iterator iter = num.begin();
        vector<int> tmp = val.at(*iter);

        if (*iter != 0) continue;
        if (tmp.size() == 0) continue;

        iter++;
        for (iter; iter != num.end();iter++) {
            if (find(tmp.begin(), tmp.end(), *iter) != tmp.end())
                tmp = val.at(*iter);
            else
                break;
        }
        if (iter == num.end()) {
            count++;
        }
    } while (next_permutation(num.begin(), num.end()));

    cout << count << endl;
}



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

#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
typedef long long ll;
const int INF = 1001001001;



int main() {
	int N, M;
	cin >> N >> M;
	vector<pair<int, int>> key;
	rep(i, M) {
		int a, b;
		cin >> a >> b;
		int s = 0;
		rep(j, b) {
			int t;
			cin >> t;
			--t;
			s |= 1 << t;
		}
		key.emplace_back(s,a);
	}
	vector<int> dp(1 << N,INF);
	dp[0] = 0;
	rep(s,1<<N) {
		rep(i,M) {
			int t = s | key[i].first;
			int cost = dp[s] + key[i].second;
			dp[t] = min(dp[t],cost);
		}
	}
	int ans = dp.back();
	if (ans == INF) cout << -1 << endl;
	else cout << ans << endl;
		return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <set>
#include <vector>
#define REP(i, n) for (int i = 0; i < (n); i++)
using namespace std;

void solve(std::string s){
    REP(i, s.size())
        if (i % 2 == 0) cout << s[i];
    cout << '\n';
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    std::string s;
    std::cin >> s;
    solve(s);
    return 0;
}


Measured memory_bytes: 592
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,sse3,sse4,popcnt,abm,mmx")

#include <bits/stdc++.h>   
#include <stdio.h>    
 
using namespace std;
     
#define F first
#define S second
#define lb lower_bound               
#define ub upper_bound
#define pb push_back
#define pf push_front    
#define ppb pop_back
#define mp make_pair
#define bpp __builtin_popcountll                                                                                        
#define sqr(x) ((x) * (x)) 
#define al 0x3F3F3F3F
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define in insert
#define ppf pop_front
#define endl '\n'
//#define int long long
 
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
 
const int mod = (int)1e9 + 7;
const int N = (int)2e5 + 123;
const ll inf = (ll)3e18 + 1;

const double pi = acos (-1.0);
const double eps = 1e-7;
const int dx[] = {0, 0, 1, 0, -1};
const int dy[] = {0, 1, 0, -1, 0};

ll a, b, c, d;

inline void boost () {                    
   ios_base :: sync_with_stdio (NULL);
   cin.tie (NULL), cout.tie (NULL);          
}                                                     

inline void Solve () {
   cin >> a >> b >> c >> d;
   ll lcm = 1ll * c * d / __gcd (c, d);
   ll val = b / lcm - (a - 1) / lcm;
   ll a1 = b / c - (a - 1) / c;
   ll a2 = b / d - (a - 1) / d;
   cout << b - a + 1 - a1 - a2 + val;

}                                     

main () {                                       
// freopen (".in", "r", stdin);    
// freopen (".out", "w", stdout);              
   boost ();
   int tt = 1;
// cin >> tt;   
   while (tt --) {
      Solve ();
   }                                               
   return 0;      
}


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

int main()
{
    string S;
    cin >> S;
    string ans = "Heisei";
    int month = stoi(S.substr(5, 7));
    int day = stoi(S.substr(8, 10));
    if (month > 4)
    {
        ans = "TBD";
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define inf 0x3f3f3f3f
int f[1000];
int main()
{
    int n;
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>f[i];
    }
    int ans=0;
    for(int i=1;i<=n;i++){
            int flag=0;
        for(int j=1;j<i;j++){
            if(f[i]<f[j]){
                flag=1;
                break;
            }
        }
        if(!flag){
                ans++;
        }
    }
    cout<<ans<<endl;
    return 0;
}


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

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

    int i,j;
    long long int n,W;
    cin>>n>>W;
    vector<long long int> w(n),v(n);
    for(i=0;i<n;i++)
        cin>>w[i]>>v[i];
    vector<vector<long long int>> ks(n+1);
    for(i=0;i<=n;i++)
    {
        ks[i]=vector<long long int> (W+1);

        for(j=0;j<=W;j++)
        {
            if(i==0||j==0)
            {
                ks[i][j]=0;
            }
            else
            {
                if(j-w[i-1]>=0)
                {
                    ks[i][j]=max(v[i-1]+ks[i-1][j-w[i-1]] , ks[i-1][j]);
                }
                else
                {
                    ks[i][j]=ks[i-1][j];
                }
                
            }
            
        }
        
    }
    cout<<ks[n][W]<<endl;
}

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

using namespace std;

typedef long long int LL;
typedef int ll;
typedef string str;
typedef pair<ll,ll> pll;
typedef vector<ll> vll;
typedef stringstream strs;

#define X first
#define Y second
#define PB push_back
#define For(i,a,b) for (int i=a;i<b;i++)
#define Ford(i,a,b) for (int i=a;i>=b;i--)
#define smax(a,b) a=max(a,b)
#define smin(a,b) a=min(a,b)
#define SZ(a) ((ll)a.size())
#define ER(a) cout << #a << ' ' << a << endl
#define LB(a,n,x) (lower_bound(a,(a)+(n),x)-(a))

const ll M=2e5+5,LG=19,SM=2000+5,inf=1e9+1;
ll mod=1e9+7;

bool ch[M];
ll ted[M];
ll n,m;

int main()
{
	ios::sync_with_stdio(0);
    cin >> n >> m;
    For(i,0,n) ted[i]=1;
    ch[0]=1;
    while (m--)
    {
        ll x,y;
        cin >> x >> y;
        x--;
        y--;
        if (ch[x]) ch[y]=1;
        ted[x]--;
        ted[y]++;
        ch[x]=ch[x]&&ted[x];
    }
    ll cnt=0;
    For(i,0,n) cnt+=ch[i];
    cout << cnt;
}

Measured memory_bytes: 768
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fo(a,b) for(int a=0;a<b;a++)
#define Sort(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
#define fi first
#define se second
#define co(a) cout<<a<<endl
#define sz size()
#define bgn begin()
#define en end()
#define pb(a) push_back(a)
#define pop pop_back
#define V vector
#define P pair
#define V2(a,b,c) V<V<int>> a(b,V<int>(c))
#define V2a(a,b,c,d) V<V<int>> a(b,V<int>(c,d))
#define incin(a) int a; cin>>a
#define yuko(a) setprecision(a)
//#define min min<int>
//#define max max<int>
template<class T>
 void cou(vector<vector<T>> a){
  int b=a.size();
  int c=a[0].size();
  fo(i,b){
    fo(j,c){
      cout<<a[i][j];
      if(j==c-1)
        cout<<endl;
      else
        cout<<' ';
    }
  }
}
/*template<>
 void cou(vector<vector<char>> a){
  int b=a.size();
  int c=a[0].size();
  fo(i,b){
    fo(j,c){
      cout<<a[i][j];
      if(j==c-1)
        cout<<endl;
      else
        cout<<' ';
    }
  }
}*/
 int wari(int a,int b) {
   if(a%b==0)
     return a/b;
   else
     return a/b+1;
 }
 int keta(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
 }
 int souwa(int a){
  return a*(a+1)/2;
 }
 int lcm(int a,int b){
  int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return d*e/f;
    }
  int gcm(int a,int b){
      int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return f;
  }
 bool prime(int a){
   if(a<2)
     return false;
   else if(a==2)
     return true;
   else if(a%2==0)
     return false;
   double b=sqrt(a);
    for(int i=3;i<=b;i+=2){
      if(a%i==0){
        return false;
      }
    }
   return true;
 }
struct Union{
  vector<int> par;
  Union(int n){
	par= vector<int>(n, -1);
  }
  int find(int x){
    if(par[x]<0)
      return x;
    else
      return par[x]=find(par[x]);
  }
  bool same(int a,int b){
    return find(a)==find(b);
  }
  int Size(int a){
    return -par[find(a)];
  }
  void unite(int a,int b){
    a=find(a);
    b=find(b);
    if(a==b)
      return;
    if(Size(b)>Size(a))
      swap<int>(a,b);
    par[a]+=par[b];
    par[b]=a;
  }
};
int ketas(int a){
  string b=to_string(a);
  int c=0;
  fo(i,keta(a)){
    c+=b[i]-'0';
  }
  return c;
}
/*struct aa{
	vector<int> gt;
  aa(int n){
	gt= vector<int>(n, 1);
  }
	void c(V<int> d,int b){
	if(d[b]==0){
		gt[d[b]-1]++;
		gt[gt.sz-1]++;
	}
	else{
		gt[d[b]-1]++;
		c(d,d[d[b]]-1);
	}
}
void cok(int a){
	cout<<gt[a-1]<<endl;
	fo(i,a-1)
	cout<<gt[i]<<endl;
}
};
*/
signed main(){
	int a;
	cin>>a;
	int b=2,c=1,d;
	fo(i,a){
		d=b+c;
		b=c;
		c=d;
	}
	cout<<b<<endl;
}

Measured memory_bytes: 384
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <numeric>

using namespace std;

using ll = long long;
using ull = unsigned long long;

const ll inf = (ll)1e9;
const ll mod = (ll)1e9 + 7;

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

	int ans = 0;
	for (int i = 1; i <= n; i++)
	{
		if (i % 2 == 1)
		{
			int cnt = 0;
			for (int j = 1; j <= i; j++)
			{
				if (i % j == 0)
				{
					cnt++;
				}
			}

			if (cnt == 8)
			{
				ans++;
			}
		}
	}

	cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

int h, w, s, U;
int u[33][33];
P dp[33][33][33][33];

int get_sum(int ai, int aj, int bi, int bj){
    return u[bi][bj] - u[bi][aj] - u[ai][bj] + u[ai][aj];
}

// 左上(ai,aj),右下(bi,bj)の矩形
P rec(int ai, int aj, int bi, int bj){
    if(dp[ai][aj][bi][bj] != make_pair(-1,-1)){
        return dp[ai][aj][bi][bj];
    }

    P res = {0, 0};
    // そのまま
    if(U - get_sum(ai, aj, bi, bj) <= s){
        res = {1, s - U + get_sum(ai, aj, bi, bj)};
    }
    // 上下に分割
    for(int ni = ai+1; ni<bi; ni++){
        P x, y;
        x = rec(ai, aj, ni, bj);
        y = rec(ni, aj, bi, bj);
        x.first += y.first;
        x.second = min(x.second, y.second);
        res = max(res, x);
    }
    // 左右に分割
    for(int nj = aj+1; nj<bj; nj++){
        P x, y;
        x = rec(ai, aj, bi, nj);
        y = rec(ai, nj, bi, bj);
        x.first += y.first;
        x.second = min(x.second, y.second);
        res = max(res, x);
    }
    return dp[ai][aj][bi][bj] = res;
}

int main() {
    while(cin >> h >> w >> s, h){
        for(int i=0;i<h;i++){
            for(int j=0;j<w;j++){
                cin >> u[i+1][j+1];
                u[i+1][j+1] += u[i][j+1] + u[i+1][j] - u[i][j];
            }
        }
        U = u[h][w];
        for(int i=0;i<h;i++){
            for(int j=0;j<w;j++){
                for(int k=0;k<=h;k++){
                    fill(dp[i][j][k], dp[i][j][k]+w+1, make_pair(-1,-1));
                }
            }
        }
        P ans = rec(0,0,h,w);
        cout << ans.first << " " << ans.second << endl;
    }
    return 0;
}



Measured memory_bytes: 11948
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan=new Scanner(System.in);
        int n=scan.nextInt();
        int d=scan.nextInt();
        int x[][]=new int[n][d];
        int ans=0;
        double c;

        for(int i=0;i<n;i++) {
            for (int k = 0; k < d; k++) {
                x[i][k] = scan.nextInt();
            }
        }

        for(int i=0;i<n;i++) {
            for(int h=i+1;h<n;h++) {
//                if(i==h){continue; }
                c=0;
                for (int k = 0; k < d; k++) {
                    c+=Math.pow(x[i][k]-x[h][k],2);
//                    System.out.println(c);
                }
                c=Math.sqrt(c);
//                System.out.println(c);
                if(c%1.0==0){
                    ans++;
                }
            }
        }

        System.out.println(ans);
    }
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
struct Point {
  double x, y;
};
const long long INF = 1LL << 60;
using pll = pair<long long, long long>;
double deg2rad(double degree) { return degree * PI / 180.0; }
int main() {
  // 標準入力が早くなる。Cスタイルの入出力とC++スタイルの入出力を混合させてはならない。
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);

  int A, B, H, M;
  cin >> A >> B >> H >> M;

  long double radian = PI * 2 * (H / 12.0 + M / 60.0 / 12.0 - M / 60.0);

  long double res = A * A + B * B - 2 * A * B * cosl(radian);

  cout << fixed << setprecision(9) << sqrtl(res) << endl;
  return 0;
}


Measured memory_bytes: 4108
#include <iostream>
#include <string.h>
#include <algorithm>
using namespace std;

long long d[101][100001];

int main() {

	memset(d, 0, sizeof(d));

	int n, wt;
	cin >> n >> wt;

	for(int i = 1; i <= n; i++){
      int w, v;
	  cin >> w >> v;
	
      for(int j = 1; j < w; j++)
        d[i][j] = d[i - 1][j];
      for(int j = w; j <= wt; j++)
        d[i][j] = max(d[i - 1][j], d[i - 1][j - w] + v);
    }
  
  	cout << d[n][wt] << endl;
  
	return 0;
}

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

using namespace std;

#define loop(i, n) for(int i = 0;i < int(n);i++)
#define rloop(i, n) for(int i = int(n);i >= 0;i--)
#define range(i, a, b) for(int i = int(a);i <= int(b);i++)
#define SZ(c) int(c.size())
#define ALL(c) c.begin(), c.end()
#define RALL(c) c.rbegin(), c.rend()
#define PI acos(-1)
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define sfi1(v) scanf("%d",&v)
#define sfi2(v1, v2) scanf("%d %d",&v1,&v2)
#define sfi3(v1, v2, v3) scanf("%d %d %d",&v1,&v2,&v3)
#define sfll1(v) scanf("%I64d",&v);
#define sfll2(v1, v2) scanf("%I64d %I64d",&v1,&v2)
#define sfll3(v1, v2, v3) scanf("%I64d %I64d %I64d",&v1,&v2,&v3)
#define endl '\n'

typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
typedef long long ll;
typedef pair<int, int> pii;


int main() {

#ifndef ONLINE_JUDGE
    //freopen("in.in", "r", stdin);
    //freopen("out.in", "w", stdout);
#endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int arr[3] = {0};
    int n;
    cin >> n;
    vi v(n);
    for (int &x : v) {
        cin >> x;
        arr[0] = x;
        sort(arr, arr + 3);
    }

    loop(i, n) {
        if (v[i] == arr[2]) {
            cout << arr[1] << endl;
        } else {
            cout << arr[2] << endl;
        }
    }
    cout << endl;

    return 0;
}


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

//////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////// ここからコピペ ////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////

// N*M型行列
template<typename T = int64_t>
class Matrix {
private:
	class RowVector {
	private:
		std::vector<T> container_;
	
	public:
		RowVector(const int column_size)
			: container_(column_size){}
		T& operator[](const int c) { return container_[c]; }
	};

	std::vector<RowVector> container_;

public:
	int N, M;
	Matrix(const int row_size, const int column_size)
		: N(row_size), M(column_size), container_(row_size, RowVector(column_size)){}
	RowVector& operator[](const int r) { return container_[r]; }

	Matrix<T> operator+(Matrix<T>& mat)
	{
		Matrix ret{*this};
		for (int r_i{}; r_i < (int)container_.size(); r_i++)
			for (int c_i{}; c_i < (int)container_.front().size(); c_i++)
				ret[r_i][c_i] += mat[r_i][c_i];
		return ret;
	}
	Matrix<T> operator-(Matrix<T>& mat)
	{
		Matrix ret{*this};
		for (int r_i{}; r_i < (int)container_.size(); r_i++)
			for (int c_i{}; c_i < (int)container_.front().size(); c_i++)
				ret[r_i][c_i] -= mat[r_i][c_i];
		return ret;
	}
	Matrix<T> operator*(Matrix<T>& mat)
	{
		Matrix ret(this->N, mat.M);
		for (int r_i{}; r_i < this->N; r_i++)
			for (int c_i{}; c_i < mat.M; c_i++)
				for (int l_i{}; l_i < this->M; l_i++)
					ret[r_i][c_i] += (*this)[r_i][l_i] * mat[l_i][c_i];
		return ret;
	}
};

//////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////// ここまでコピペ ////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=3035
int main()
{
	int n, m, l;
	scanf("%d%d%d", &n, &m, &l);
	Matrix<> A(n, m), B(m, l);
	for (int i{}; i < n; i++)
		for (int j{}; j < m; j++)
			scanf("%lld", &A[i][j]);
	for (int i{}; i < m; i++)
		for (int j{}; j < l; j++)
			scanf("%lld", &B[i][j]);
	Matrix<> C = A * B;
	for (int i{}; i < n; i++)
		for (int j{}; j < l; j++)
			printf("%lld%c", C[i][j], j == l - 1? '\n': ' ');
	return 0;
}


Measured memory_bytes: 3340
#pragma GCC optimize("Ofast")
#pragma GCC target("avx")
//#undef LOCAL
#include <bits/stdc++.h>

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;

#ifdef LOCAL
#define show(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl
#else
#define show(x) true
#endif

template <class T, class U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
    return os << "P(" << p.first << ", " << p.second << ")";
}

template <class T> ostream& operator<<(ostream& os, const V<T>& v) {
    os << "[";
    for (auto d : v) os << d << ", ";
    return os << "]";
}

VV<int> g;

int md, mar;
void dfs(int p, int b, int now = 1) {
    if (md < now) {
        md = now;
        mar = p;
    }
    for (int d : g[p]) {
        if (d == b) continue;
        dfs(d, p, now + 1);
    }
}

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

    int n;
    cin >> n;
    g = VV<int>(n);
    for (int i = 0; i < n -1; i++) {
        int a, b;
        cin >>a >> b;a--; b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }

    md = -1;
    dfs(0, -1);
    md = -1;
    dfs(mar, -1);

    show(md);

    if (md % 3 == 2) cout << "Second" << endl;
    else cout << "First" << endl;
    return 0;
}



Measured memory_bytes: 16768
#include<bits/stdc++.h>
#define neko 400010
#define f(i,a,b) for(int i=(a);i<=(b);++i)
using namespace std;
int book[neko],fa[neko],t,head[neko],vis[neko],n,m,ans;
char s[neko];
struct node
{
	int v,w,nex;
}e[neko<<1];
void add(int x,int y,int z)
{
	e[++t].v=y,e[t].w=z,e[t].nex=head[x],head[x]=t;
	e[++t].v=x,e[t].w=z,e[t].nex=head[y],head[y]=t;
}
void dfs(int u,int col)
{
	int tag=0;
	//printf("%d %d\n",u,col);
	for(register int i=head[u],v=e[i].v;i;i=e[i].nex,v=e[i].v)
	{
		if(!book[i]&&e[i].w^col)
		{
			book[i]=1,vis[i]=1;
			dfs(v,e[i].w);
			book[i]=0;
		}
		else if(book[i]&&e[i].w^col)
		{
			printf("Yes\n");exit(0);
		}
	}
}
int main()
{
	int x,y;
	scanf("%d%d",&n,&m);
	scanf("%s",s+1);
	f(i,1,m)
	{
		scanf("%d%d",&x,&y);
		if(s[x]^s[y])add(x,y,0);
		else add(x,y,1);
	}
	f(i,1,m<<1)if(!vis[i])vis[i]=1,dfs(e[i].v,e[i].w);
	printf("No\n");
	return 0;
}

Measured memory_bytes: 19328
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define ANS cout << ans << endl
#define all(a) a.begin(),a.end()
#define SORT(a) sort(all(a))
#define REVERSE(a) reverse(all(a))
#define int long long
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define VIin(a) for(int i=0; i<a.size(); i++) cin >> a[i]
#define OUT(a) cout << a << endl
typedef vector<int> VI;
typedef vector<VI> VVI;
const int MOD=1e9+7;
const long long INF = 1LL << 60;
/*最大公約数*/int gcd(int x, int y) { return y ? gcd(y,x%y) : x;}
/*最小公倍数*/int lcm(int a, int b) { int g = gcd(a, b); return a / g * b; }
/*素数判定*/int isPrime(int n){if(n<2){return 0;}for(int i=2; i*i<=n; i++){if(n%i==0){return 0;}}return 1;}
/*約数列挙*/vector<int> getDivisor(int n){vector<int> v; for(int i=1; i*i<=n; i++){if(n%i==0){v.push_back(i);if(i!=n/i){v.push_back(n/i);}}}sort(v.begin(),v.end()); return v;}
//----------------------------------------------
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int n; cin >> n;
    int ans = INF;
    for(int i = 1; i*i <= n; i++) if(n%i == 0) ans = min(ans,i+n/i-2);
    ANS;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <climits>
using namespace std;
int main(){
    int n,m;
    int a[50],b[50];
    int c[50],d[50];
    int mdis=0;
    cin >> n >> m;
    for(int i=0;i<n;i++)cin >> a[i] >> b[i];
    for(int i=0;i<m;i++)cin >> c[i] >> d[i];
    for(int i=0;i<n;i++){
        mdis = INT_MAX;
        int ckp = 0;
        for(int j=m-1;j>=0;j--){
            if(mdis >= abs(a[i]-c[j])+abs(b[i]-d[j])){
                mdis = abs(a[i]-c[j])+abs(b[i]-d[j]);
                ckp = j+1;
            }
        }
        cout << ckp << endl;
    }
}


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Pranay2516
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(1, in, out);
        out.close();
    }

    static class Task {
        public void solve(int testNumber, FastReader in, PrintWriter out) {
            long x = in.nextLong();
            long p = 100;
            int n = 0;
            while (p < x) {
                p += p * 0.01;
                n++;
            }
            out.print(n);
        }

    }

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;

        public FastReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {

            if (numChars == -1)
                throw new InputMismatchException();

            if (curChar >= numChars) {

                curChar = 0;

                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (numChars <= 0)
                    return -1;
            }

            return buf[curChar++];
        }

        public long nextLong() {
            long ret = 0;
            int c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

    }
}



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

int N, K;
int dp[100010];
int a[110];

int rec(int k)
{
    if (dp[k] >= 0) return dp[k];
    if (k < a[0]) return 0;

    int res = 0;
    int t = 1;
    for(int i = 0; i < N; i++)
    {
        if(k - a[i] >= 0)
        {
            t *= rec(k - a[i]);
        }
    }
    if(t == 0) res = 1;

    return dp[k] = res;
}


int main ()
{
    cin >> N >> K;
    for(int i = 0; i < N; i++)
    {
        cin >> a[i];
    }
    memset(dp, -1, sizeof(dp));

   if(rec(K) == 1) cout << "First" << endl;
   else cout << "Second" << endl;
}

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

int main() {
    
    int n,k;
    long long int s=0;
    
    cin>>n>>k;
    
    int h[n],i;
    
    
    for(i=0;i<n;i++)
    {
        cin>>h[i];
    }
    sort(h,h+n); 
        
	for(i=0;i<n-k;i++)
	{
	    s=s+h[i];
	}
	  cout<<s;
	
	return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int,int>;
#define rep(i,n) for(int i=0; i<n; i++)
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end()) //sortしてから使う
#define INF 2147483647
#define LLINF 9223372036854775807LL

int main(){
  int n; cin>>n;
  vector<int>A(n);
  ll ans = 0;
  rep(i,n) cin>>A[i];
  for(int i=1; i<n; i++){
    //cout << A[i-1] - A[i] << endl;
    if (A[i-1] > A[i]){
      ans += A[i-1] - A[i];
      A[i] = A[i-1];
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 4048
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define INF 100000000
#define rep(i,s,n) for (int i = (int)(s); i < (int)(n); i++)
#define mp make_pair
ll mod = 10e9+7;
ll mod2 = 998244353;

char change(char a){
    if ('a'<=a && a<='z'){
        return a-0x20;
    }else if('A'<=a && a<='Z'){
        return a+0x20;
    }
    return 0;
}

int main(){
    int n,k;cin>>n>>k;
    string s; cin>>s;
    s[k-1] = change(s[k-1]);
    cout<<s<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int x,a,b;
    cin>>x>>a>>b;
    int bb=a+a;
    int eo=a+b;
    int safe=bb+x;
    
    if(eo<=bb)
    { cout<<"delicious";}
    
    else if(eo<=safe)
    { cout<<"safe";}

  else if(eo>safe)
  { cout<<"dangerous";}
}
    

Measured memory_bytes: 256
l = []
for i in range(3):
  l.append(list(map(int, input().split())))

n = int(input())

for times in range(n):
  b = int(input())
  for cl in range(3):
    for rw in range(3):
      if b == l[cl][rw]:
        l[cl][rw] = 0

for i in range(3):
  if l[i][0] == l[i][1] == l[i][2] or l[0][i] == l[1][i] == l[2][i]:
    print("Yes")
    exit()
if l[0][0] == l[1][1] == l[2][2]:
  print("Yes")
  exit()
elif l[0][2] == l[1][1] == l[2][0]:
  print("Yes")
  exit()
print("No")

Measured memory_bytes: 3064
N = int(input())
S = {}
for n in range(N):
  s = input()
  if s not in S.keys():
    S[s] = 1
  else:
    S[s] += 1
m = max(S.values())
S2 = sorted(S)
for s in S2:
  if S[s] == m:
    print(s)

Measured memory_bytes: 32096
import math

n,d=map(int,input().split())
x=[list(map(int,input().split())) for i in range(n)]
cnt=0
for i in range(n):
    for j in range(i+1,n):
        dis=0
        for k in range(d):
            dis+=(x[i][k]-x[j][k])**2
        if math.sqrt(dis)%1==0:
            cnt+=1
print(cnt)


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

typedef long long LL;
typedef long double LD;
typedef string ST;


struct UinonFindTree {
private:
  vector<LL> UFT;
public:
  UinonFindTree(LL N) {
    UFT.resize(N);
    for (LL i = 0; i < N; i++) {
      UFT[i] = -1; // 
    }
  }

  LL root(LL i) {
    if (UFT[i] < 0) {
      return i;
    }
    else {
      LL j = root(UFT[i]);
      UFT[i] = j;
      return j;
    }
  }

  bool same(LL i, LL j)
  {
    return (root(i) == root(j));
  }

  void unite(LL i, LL j)
  {
    LL root_i = root(i);
    LL root_j = root(j);
    if (root_i != root_j) {
      UFT[root_i] += UFT[root_j];
      UFT[root_j] = root_i;
    }
  }

  LL size(LL i) {
    return - UFT[root(i)];
  }

  void print() {
    for (LL i = 0; i < UFT.size();++i) {
      cerr << root(i) << " ";
    }
    cerr << endl;
  }
};



void func()
{
  LL N, M;
  cin >> N >> M;
  UinonFindTree uft(N);

  vector<LL> A(M);
  vector<LL> B(M);
  for (LL i = 0; i < M; ++i) {
    LL a;
    LL b;
    cin >> a;
    cin >> b;
    A[i] = a - 1;
    B[i] = b - 1;
  }


  LL score = 0;
  vector<LL> C(M);
  for (LL i = M-1; i >= 0; --i) {
    LL a = A[i];
    LL b = B[i];
    if (uft.same(a, b)) {
      score = 0;
    }
    else {
      LL size_a = uft.size(a);
      LL size_b = uft.size(b);
      //cerr << a << " : " << b << endl;
      //cerr << size_a << "   " << size_b << endl;
      uft.unite(a, b);
      score = size_a * size_b;
    }
    C[i] = score;
  }


  for (LL i = 1; i < M; ++i) {
    C[i] = C[i]+C[i-1];
  }
  for (LL i = 0; i < M; ++i) {
    cout << C[i] << endl;
  }


}

#ifdef CALC_TIME 
#include <windows.h>
int main()
{
  LARGE_INTEGER freq;
  QueryPerformanceFrequency(&freq);
  LARGE_INTEGER start, end;
  QueryPerformanceCounter(&start);
  // 何かの処理
  func();
  QueryPerformanceCounter(&end);
  double time = static_cast<double>(end.QuadPart - start.QuadPart) * 1000.0 / freq.QuadPart;
  fprintf(stderr, "%lf[ms]\n", time);
  return 0;
}
#else 
int main()
{
  func();
  return 0;
}
#endif





Measured memory_bytes: 4480
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <bitset>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<pair<int,int>> vpii;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
#define rep(i,n) for(int i=0;i<n;i++)
#define fin(ans) cout<<(ans)<<endl
#define P 1000000007
#define STI(s) atoi(s.c_str())//string to int
#define mp(p,q) make_pair(p,q)
#define Sort(a) sort(a.begin(),a.end())
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;}
const int INF = INT_MAX;
const long long LLINF = 1LL<<60;
//g++ -std=c++1z temp.cpp
//./a.exe


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

int n,a,b;
cin >> n >> a >> b;
if (a*n>=b){
    cout << b << endl;
}else
{
    cout << a*n << endl;
}




//////////////////////////////////////////////////////
return 0;}

Measured memory_bytes: 256
// AOJ 0120: Patisserie
// 2017.9.28 bal4u@uu

#include <stdio.h>
#include <string.h>
#include <math.h>

#define EQ(a,b) (fabs(a-b)<= 1e-7)

int r[13];
double d[13][13];					// ???????????±???????????????????°´????????¢
double dp[13][4100];				// ?°´????????¢, ??´?????????????????±??????????±\??´?????????
char buf[50], *p;

int getint()
{
	int n = 0;
	while (*p >= '0') n = (n<<3) + (n<<1) + (*p++ & 0xf);
	return n;
}

int main()
{
	int w, n, i, j, k, t, s;
	int lim;
	double x;

	for (i = 3; i <= 10; i++) for (j = i; j <= 10; j++)
		d[i][j] = d[j][i] = 2.0 * sqrt(i * j);

	while (fgets(p=buf, 50, stdin) != NULL) {
		w = getint(); p++;
		n = 0, s = 0;
		while (*p >= ' ') {	t = getint(), p++, r[n++] = t, s += t; }
		if (2 * s <= w) { puts("OK"); continue; }

		memset(dp, 0, sizeof(dp));
		for (i = 0; i < n; i++)	dp[i][1<<i] = r[i];

		lim = (1 << n) - 1;
		for (k = 0; k <= lim; k++) {
			for (i = 0; i < n; i++)	{
				for (j = 0; j < n; j++) {
					if (dp[j][k] == 0) continue;
					else {
						int ii;
						x = dp[j][k] + d[r[i]][r[j]];
						ii = k | (1 << i);
						if (dp[i][ii] == 0 || x < dp[i][ii]) dp[i][ii] = x;
					}
				}
			}
		}

		for (x = 10000, i = 0; i < n; i++) {
			if (dp[i][lim] == 0) continue;
			dp[i][lim] += r[i];
			if (dp[i][lim] < x) x = dp[i][lim];
		}
		puts(EQ(x, w) || x <= w ? "OK" : "NA");
	}
	return 0;
}

Measured memory_bytes: 2020
#include <bits/stdc++.h>
using namespace std;
#define     LL              long long int
#define     FOR(I,A,B)      for( int I = A; I < B; ++I )
#define     SFI(X)          scanf("%d",&X)
#define     SFL(X)          scanf("%lld",&X)


int main() {

    int n;
    string s;

    scanf("%d",&n);
    cin >> s;

    for(int i=0;i<s.length();i++){
        s[i] = (s[i] - 'A' + n) % 26 + 'A';
    }

    cout << s << endl;

    return 0;
}


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

int main() {
	int a, b, c, d, e, f; cin >> a >> b >> c >> d >> e >> f;
	cout << (a + b * 5 + c * 10 + d * 50 + e * 100 + f * 500 >= 1000) << endl;
}

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

int main() {
  int n, a;
  cin >> n;
  int is_denied = 0;
  while (cin >> a) {
    if (a % 2 == 0 && ! (a % 3 == 0 || a % 5 == 0)) is_denied = 1;
  }
  if (is_denied == 0) {
    cout << "APPROVED" << endl;
  } else {
    cout << "DENIED" << endl;
  }
}

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

using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
 
#define nl '\n'
 
#define y1 aza_ibagaliev
 
#define f first
#define s second
	
#define ed end()
#define bg begin()
#define rbg rbegin()
 
#define rv reverse
#define mp make_pair
#define pb push_back
#define ppb pop_back
#define ppf pop_front
 
#define sz size()
#define all(x) x.bg, x.ed
 
#define pll pair < ll, ll >
#define pii pair < int, int >
 
#define sqr(x) ((x) * 1ll * (x))
#define sqrd(x) ((x) * 1.0 * (x))
 
#define speed ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
 
#define rnl cout << "----------------------------------------" << nl
 
#define bit __builtin_popcount
 
inline ll bip(ll x, ll n, ll mod){ll res=1;while(n){if(n & 1){res=(res*x)%mod;}x=(x*x)%mod;n>>=1;}return res;}
        	
const int ppr = 257;
const ll INF = 2e18;
const int inf = 2e9;
const int mod = 1e9 + 7;
const int N = 1e5 + 123;
const ld pi = 3.1741592653589793238462643;
 
const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};

int n, dp[3333][3333], p[3333];
string s;

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

//	srand(time(NULL));

	cin >> n >> s;
	s = "##" + s;

	dp[1][1] = 1;
	for(int i = 1; i <= n; i++)
		p[i] = 1;
	for(int i = 2; i <= n; i++) {
		for(int j = 1; j <= i; j++) {
			if(s[i] == '<') {
				dp[i][j] = p[j - 1];
			} else {
				dp[i][j] = (p[i - 1] - p[j - 1] + mod) % mod;
			}
		}
		for(int j = 1; j <= i; j++)
			p[j] = (p[j - 1] + dp[i][j]) % mod;
	}                               

	cout << p[n];
    return 0;                                           	
}

Measured memory_bytes: 39808
#include<cstdio>

#include<ctime>
#include<cstdlib>
#include<cstring>
#include<utility>
#ifdef XS
	#include<De>
#endif
using namespace std;
#define MS(m) memset(m,0,sizeof(m))

typedef unsigned U;
typedef pair<int,int > P;
typedef long long ll;
void inp();
int main(){
#ifdef XS
	freopen("zoj2013.in","r",stdin);
#endif
	try{
		while(1)
		inp();
	}
	catch(... ){
#ifdef XS
		printf("%s","exception");
#endif
	}//for compatibility with cygwin c++ runtime
	return 0;
}
const int N = 1e5;
int tim[N];
void inp(){
	MS(tim);
	int n;scanf("%d",&n);
	if(!n)exit(0);
	time_t raw = time(0);
	tm * be = gmtime(&raw);
	tm * en = new tm;
	memcpy(en, be, sizeof(tm));
	be->tm_hour = be->tm_min = be->tm_sec = 0;
	for(int i = 0;i<n;i++){
		for(int c = 1 ;c>=-1;c-=2){
			scanf("%d:%d:%d", &en->tm_hour,&en->tm_min,&en->tm_sec);
			U d = (U)difftime(mktime(en),mktime(be));
			tim[d] += c;
		}
	}
	int ans = -1;
	for(int i = 1;i<N;i++){
		tim[i]+=tim[i-1];
		if(tim[i]>ans)
			ans = tim[i];
	}
	printf("%d\n",ans);
}
//zoj2013.cc by xsthunder at Tue Jul 25 21:35:55 2017

Measured memory_bytes: 2992
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, _s, n) for(int i = _s, i##_len = (n); i < i##_len; ++i)
#define ALL(x) (x).begin(), (x).end()
using namespace std;

#define repi(itr, ds) for(auto itr = ds.begin(); itr != ds.end(); itr++)
// vector
template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
  for(T &x : vec) is >> x;
  return is;
}
// pair
template <typename T, typename U>
ostream &operator<<(ostream &os, pair<T, U> &pair_var) {
  os << "(" << pair_var.first << ", " << pair_var.second << ")";
  return os;
}
// vector
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  os << "{";
  for(int i = 0; i < vec.size(); i++) {
    os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
  }
  os << "}\n   ";
  return os;
}
// map
template <typename T, typename U>
ostream &operator<<(ostream &os, map<T, U> &map_var) {
  os << "{";
  repi(itr, map_var) {
    os << *itr;
    itr++;
    if(itr != map_var.end()) os << ", ";
    itr--;
  }
  os << "}";
  return os;
}
// set
template <typename T>
ostream &operator<<(ostream &os, set<T> &set_var) {
  os << "{";
  repi(itr, set_var) {
    os << *itr;
    itr++;
    if(itr != set_var.end()) os << ", ";
    itr--;
  }
  os << "}";
  return os;
}

#define DUMPOUT cerr

void dump_func() { DUMPOUT << endl; }
template <class Head, class... Tail>
void dump_func(Head &&head, Tail &&... tail) {
  DUMPOUT << head;
  if(sizeof...(Tail) > 0) {
    DUMPOUT << ", ";
  }
  dump_func(std::move(tail)...);
}
#ifdef DEBUG_
#define DEB
#define dump(...)                                                             \
  DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                             \
          << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]" << endl \
          << "    ",                                                          \
      dump_func(__VA_ARGS__)
#else
#define DEB if(false)
#define dump(...)
#endif

typedef long long int ll;
const int MOD = 1e9 + 7;
const int INF = 1e9;

int main() {
  int N;
  cin >> N;
  int p[N];
  REP(i, N) {
    int n;
    cin >> n;
    n--;
    p[n] = i;
  }

  int a[N], b[N];
  a[0] = 1;
  b[0] = 1000000000;

  REPS(i, 1, N) {
    int d = p[i] - p[i - 1];
    if(d > 0) {
      a[i] = a[i - 1] + d + 1;
      b[i] = b[i - 1] - 1;
    } else {
      a[i] = a[i - 1] + 1;
      b[i] = b[i - 1] + d - 1;
    }
  }

  REP(i, N) { cout << a[i] << " "; }
  cout << endl;
  REP(i, N) { cout << b[i] << " "; }
  cout << endl;
}


Measured memory_bytes: 896
#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<algorithm>
#include<map>
#include<cstdlib>
#include<cmath>
#include<numeric>
#include<iomanip>
#define rep(i,k,n)for(ll i=k;i<(n);i++)
using namespace std;
using ll =long long;
const int mod = 1000000007;
int gcd(ll a, ll b) {

	if (b == 0) {

		return a;
	}
	else {
		a = a%b;
		gcd(b, a);
	}
}
class mint {
	long long x;
public:
	mint(long long x = 0) : x((x% mod + mod) % mod) {}
	mint operator-() const {
		return mint(-x);
	}
	mint& operator+=(const mint & a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint & operator-=(const mint & a) {
		if ((x += mod - a.x) >= mod) x -= mod;
		return *this;
	}
	mint & operator*=(const  mint & a) {
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint & a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint & a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint & a) const {
		mint res(*this);
		return res *= a;
	}
	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}
	// for prime mod
	mint inv() const {
		return pow(mod - 2);
	}
	mint& operator/=(const mint & a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint & a) const {
		mint res(*this);
		return res /= a;
	}

	friend ostream& operator<<(ostream & os, const mint & m) {
		os << m.x;
		return os;
	}
};

int main() {
	ll M, N;
	cin >> M >> N;
	vector<string>A(M), B(N);
	rep(i, 0, M) {
		cin >> A[i];
	}

	rep(i, 0,N) {
		cin >> B[i];
	}
	rep(i, 0, M - N+1) {

		rep(j, 0, M - N+1) {
			rep(k, 0,N) {
				if (A[k + i].substr(j, N) != B[k]) {

					break;
				}
				if (k == N - 1) {

					cout << "Yes";
					return 0;
				}
			}

		}
	}

	cout << "No";
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**9)


def unite(par, i, j):
    j = get_par(par, j)
    par[j] = get_par(par, i)

def get_par(par, p):
    while par[p] != p:
        p = par[p]
    return par[p]

def resolve():
    s = input()
    t = input()
    ans = 100000
    for i in range(len(s) - len(t) + 1):
        tmp = 0
        for j in range(len(t)):
            if s[i+j] != t[j]:
                tmp += 1
        if tmp < ans:
            ans = tmp

    print(ans)

if __name__ == "__main__":
    resolve()


Measured memory_bytes: 9156
N = int(input())
xy = [tuple(map(int, input().split())) for _ in range(N)]

pq = []
for i in range(N):
    for j in range(N):
        if i != j:
            pq.append((xy[i][0] - xy[j][0], xy[i][1] - xy[j][1]))


ans = N
for p,q in pq:
    cost = 0
    for x,y in xy:
        if  (x+p, y+q) not in xy:
            cost += 1

    ans = min(ans, cost)

print(ans)

Measured memory_bytes: 3316
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include <numeric>
#include<cstring>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
#define m0(x) memset(x,0,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))

using namespace std;



int dy[4] = { 0,0,1,-1 };
int dx[4] = { 1,-1,0,0 };
int dxx[8] = { 0,0,1,1,1,-1,-1,-1 };
int dyy[8] = { 1,-1,0,1,-1,0,1,-1 };


ll m = 1000000007;

const int MOD = 1000000007;

ll gcd(ll x, ll y) {
	ll m = max(x, y), n = min(x, y);
	if (m%n == 0)return n;
	else return gcd(m%n, n);
}
ll lcm(ll x, ll y) {
	return x / gcd(x, y)*y;
}

ll myPow(ll x, ll n, ll m) {
	if (n == 0)
		return 1;
	if (n % 2 == 0)
		return myPow(x * x % m, n / 2, m);
	else
		return x * myPow(x, n - 1, m) % m;
}

long long nCr(int n, int r) {
	if (r > n / 2) r = n - r; // because C(n, r) == C(n, n - r)
	long long ans = 1;
	int i;

	for (i = 1; i <= r; i++) {
		ans *= n - r + i;
		ans /= i;
	}

	return ans;
}


const int MAX = 100010;

int par[MAX];//親
int Rank[MAX];//木の深さ

			  //n要素で初期化
void init(int n) {
	REP(i, n) {
		par[i] = i;
		Rank[i] = 0;
	}
}

//木の根を求める
int find(int x) {
	if (par[x] == x) {
		return x;
	}
	else {
		return par[x] = find(par[x]);//経路圧縮(根に直接つなぎなおす)もしつつ
	}
}

//xとyの属する集合を併合
void unite(int x, int y) {
	x = find(x);
	y = find(y);
	if (x == y)return;
	//低いほうを高いほうにつなげる(効率化)
	if (Rank[x] < Rank[y]) {
		par[x] = y;
	}
	else {
		par[y] = x;
		if (Rank[x] == Rank[y])Rank[x]++;
	}
}

//xとyが同じ集合に属するか否か
bool same(int x, int y) {
	return find(x) == find(y);
}

struct edge { int u, v, cost; };
bool comp(const edge& e1, const edge&e2) {
	return e1.cost < e2.cost;
}

edge es[MAX];
int V, E;


int kruskal() {
	sort(es, es + E, comp);
	init(V);
	int res = 0;
	REP(i, E) {
		edge e = es[i];
		if (!same(e.u, e.v)) {
			unite(e.u, e.v);
			res += e.cost;
		}
	}
	return res;
}




int main() {
	cin >> V >> E;

	REP(i, E) {
		int s, t, w;
		cin >> s >> t >> w;
		es[i] = { s,t,w };
	}

	int ans = kruskal();
	cout << ans << endl;
}



Measured memory_bytes: 4348
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    while(1)
    {
        c-=b;
        if(c<=0)
        {
            cout<<"Yes"<<endl;
            return 0;
        }
        a-=d;
        if(a<=0)
        {
            cout<<"No"<<endl;
            return 0;
        }

    }
}


Measured memory_bytes: 3640
local DBG = false
function dbgpr(...)
    if DBG then
        io.write("[dbg]")
        print(...)
    end
end
function dbgpr_t(tbl)
    if DBG then
        dbgpr(tbl)
        io.write("[dbg]")
        for i,v in ipairs(tbl) do
            io.write(i)
            io.write(":")
            io.write(tostring(v))
            io.write(" ")
        end
        print("")
    end
end

function tbl_clone(tbl)
    return {table.unpack(tbl)}
end

function parse_problem()
    local N = io.read("n")
    local goals = {}
    table.insert(goals, io.read("n"))
    table.insert(goals, io.read("n"))
    table.insert(goals, io.read("n"))
    local ingredients = {}
    for i=1,N do
        local l, _ = io.read("n", "l")
        table.insert(ingredients, l)
    end
    return goals, ingredients
end

function main()
    local goals, ingredients = parse_problem()
    local INF = 999999

    local function find_min()
        local function update(cur_lengths, k, x)
            -- Update cur_lengths.
            -- Ingredients k is used for x.
            local t = tbl_clone(cur_lengths)
            t[x] = t[x] + ingredients[k]
            return t
        end
        local function synthesis_cost(cur_lengths, x)
            -- Ingredients is used for x.
            if cur_lengths[x] == 0 then
                return 0
            else
                return 10
            end
        end
        local function find_min_rec(i, cur_lengths, cur_cost)
            -- i (0 <= i <= #ingredients): Number for decided ingredients.
            -- cur_lengths[k] (1 <= k <= 3): Current length for goal k.
            dbgpr(i, cur_cost)
            if i == #ingredients then
                for k=1,#goals do
                    if cur_lengths[k] == 0 then
                        return INF
                    end
                    cur_cost = cur_cost + math.abs(cur_lengths[k] - goals[k])
                end
                return cur_cost
            end
            local next_i = i + 1
            local visit_costs = {
                find_min_rec(next_i, update(cur_lengths, next_i, 1), cur_cost + synthesis_cost(cur_lengths, 1)),
                find_min_rec(next_i, update(cur_lengths, next_i, 2), cur_cost + synthesis_cost(cur_lengths, 2)),
                find_min_rec(next_i, update(cur_lengths, next_i, 3), cur_cost + synthesis_cost(cur_lengths, 3)),
                find_min_rec(next_i, tbl_clone(cur_lengths), cur_cost)
            }
            table.sort(visit_costs)
            return visit_costs[1]
        end
        return find_min_rec(0, {0, 0, 0}, 0)
    end
    local min_used_mp = find_min()
    print(min_used_mp)
end
main()


Measured memory_bytes: 880
a = gets.chomp.to_i
b = gets.chomp.to_i
c = gets.chomp.to_i
x = gets.chomp.to_i

money_sum = 0
count = 0

[*0..a].each do |_a|
  [*0..b].each do |_b|
    [*0..c].each do |_c|
      money_sum = _a*500 + _b*100 + _c*50
      count+=1 if money_sum == x
    end
  end
end
print count


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

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
const int md = (int)1e9+7;
void dbg(){ cerr << "\n"; }  
template <typename T,typename ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }

int main(){
	int n, ans =0;
	string s;
	cin >>n;
	if(n<1000) printf("ABC\n");
	else printf("ABD\n");
	return 0;
}


Measured memory_bytes: 256