akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;

class union_find {
public:
	union_find(int n)
		: par_(n, -1)
	{}
	void init(int n)
	{
		par_.assign(n, -1);
	}

	int root(int x)
	{
		return par_[x] < 0 ? x : par_[x] = root(par_[x]);
	}

	bool unite(int x, int y)
	{
		x = root(x); y = root(y);
		if (x == y)
		{
			return false;
		} else
		{
			if (par_[x] < par_[y])
			{
				par_[x] += par_[y];
				par_[y] = x;
			} else
			{
				par_[y] += par_[x];
				par_[x] = y;
			}
			return true;
		}
	}

	bool same(int x, int y)
	{
		return root(x) == root(y);
	}

	int size(int x)
	{
		return -par_[root(x)];
	}

private:
	std::vector<int> par_;
};

int main() {
	int n, q;
	cin >> n >> q;
	union_find uni(n+5);
	for (int i = 0; i < q; ++i)
	{
		int com, x, y;
		cin >> com >> x >> y;
		if (com == 0)
		{
			uni.unite(x, y);
		}
		else
		{
			if (uni.same(x, y))
			{
				cout << 1 << endl;
			}
			else
			{
				cout << 0 << endl;
			}
		}
	}
}

Measured memory_bytes: 3132
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int MOD = 1e9+7;

bool chk(vector<ll> &a, vector<ll> &f, ll t, ll k){
	int n = a.size();
	if(t<0) return false;
	for(int i=0; i<n; i++){
		if(a.at(i)*f.at(i)>t){
			ll c=(a.at(i)*f.at(i)-t+f.at(i)-1)/f.at(i);
			if(k<c) return false;
			k-=c;
		} 
	}
	return true;
}

int main(){
	
	int n; ll k; cin>>n>>k;
	vector<ll>a(n),f(n);
	for(int i=0; i<n; i++) cin>>a.at(i);
	for(int i=0; i<n; i++) cin>>f.at(i);
	sort(a.rbegin(),a.rend());
	sort(f.begin(),f.end());
	ll ok=1e12,ng=-1, mid;
	while(abs(ok-ng)>1){
		mid = (ok+ng)/2;
		(chk(a,f,mid,k)?ok:ng)=mid;
	}
	cout << ok << endl;
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
#define whlie while
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define rep(i,N) for(int i = 0; i < (N); i++)
#define repr(i,N) for(auto i = (N) - 1; i >= 0; i -= 1)
#define each(x,v) for(auto& x : v)
#define all(v) (v).begin(),(v).end()
#define sz(v) ((int)(v).size())
#define vrep(v,it) for(auto it = v.begin(); it != v.end(); it++)
#define vrepr(v,it) for(auto it = v.rbegin(); it!= v.rend(); it++)
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) ll __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
#define rand mtrand
#ifdef NyaanDebug
  #include "NyaanDebug.h"
  #define trc(...) do { cout << #__VA_ARGS__ << " = "; dbg_out(__VA_ARGS__);} while(0)
  #define trca(v,...) do { cout << #v << " = "; array_out(v , ##__VA_ARGS__);cout << endl;} while(0)
#else
  #define trc(...)
  #define trca(...)
#endif
using namespace std;
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector< vector<int> >;
constexpr int inf = 1001001001;
constexpr ll infLL = 0x1FFFFFFFFFFFFFFFLL;
struct IoSetupNya {IoSetupNya() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); cerr << fixed << setprecision(15);} } iosetupnya;
template<typename T, typename U> inline bool amin(T &x, U y) { return (y < x) ? (x = y, true) : false; }
template<typename T, typename U> inline bool amax(T &x, U y) { return (x < y) ? (x = y, true) : false; }
template<typename T, typename U> ostream& operator <<(ostream& os, const pair<T, U> &p) { os << p.first << " " << p.second; return os; }
template<typename T, typename U> istream& operator >>(istream& is, pair<T, U> &p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator <<(ostream& os, const vector<T> &v) { int s = (int)v.size(); rep(i,s) os << (i ? " " : "") << v[i]; return os; }
template<typename T> istream& operator >>(istream& is, vector<T> &v) { for(auto &x : v) is >> x; return is; }
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
template<typename T>void die(T x){out(x); exit(0);}

random_device seed_gen; mt19937_64 mtrand(seed_gen());
#define MOD 1000000007
//////////////////////////////////////////

int main(){
  ins(S);
  out(S.substr(0 , sz(S) - 8) );
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  long x,y;
  cin >> x >> y;
  long ans = 0;
  int tmp;
  while(x!=y){
    tmp = 0;
    if(x == -y){
      ans+=1;
      x = -x;
    }else if(x==0){
      x++;
      ans ++;
    }else{
      if(x>0)tmp += 1;
      if(y>0)tmp += 2;
      if(abs(x)>abs(y))tmp += 4;

      switch (tmp) {
        case 1:
        case 3:
        case 4:
        case 6:
          ans += abs(abs(x)-abs(y));
          x += abs(abs(x)-abs(y));
          break;
        case 0:
        case 2:
        case 5:
        case 7:
          ans++;
          x = -x;
        break;
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
import sys

n=int(input())
l=[int(x) for x in input().rstrip().split()]
l.sort()


ans=0
for i in range(n):
  for j in range(i+1,n):
    for s in range(j+1,n):
      if l[i]!=l[j] and l[j]!=l[s] and l[i]!=l[s]:
        if l[i]<l[j]+l[s] and l[j]<l[i]+l[s] and l[s]<l[i]+l[j]:
          ans+=1
print(ans)




Measured memory_bytes: 9196
function main(input) {
  if (input == 2 || input == 3) {
    console.log(input);
    return;
  }

  var base = Math.floor(
    (parseInt(input.trim()) + 1) / 6
  ) * 6;
  while (true) {
    if (isPrime(base - 1) && base - 1 >= input) {
      console.log(base - 1)
      break;
    }

    if (isPrime(base + 1) && base + 1 >= input) {
      console.log(base + 1)
      break;
    }
    base += 6;
  }
}
function isPrime(n) {
  for (var i = Math.floor(Math.sqrt(n)); i <= Math.floor(n / 2); i++) {
    if (n % i == 0) return false;
  }
  return true;
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));



Measured memory_bytes: 7628
#include <iostream>
#include <vector>

using namespace std;

int main() {
    int h, w;
    cin >> h;
    cin >> w;

    vector<vector<int>> c(10);
    for (int i = 0; i < 10; i++) c[i].resize(10);

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

    vector<vector<int>> wall(h);
    for (int i = 0; i < h; i++) wall[i].resize(w);

    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            int n;
            cin >> n;
            wall[i][j] = n;
        }
    }

    for (int k = 0; k < 10; k++) {
        for (int i = 0; i < 10; i++) {
            for (int j = 0; j < 10; j++) {
                int cost = c[i][k] + c[k][j];
                if (cost < c[i][j])
                    c[i][j] = cost;
            }
        }
    }

    int res = 0;
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            if (wall[i][j] == -1) continue;
            res += c[wall[i][j]][1];
        }
    }

    cout << res << "\n";
}

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

#define taskname ""
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define for0(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

using namespace std;

typedef long long ll;
typedef long double ld;
typedef complex <ld> cd;
typedef vector <cd> vcd;
typedef vector <int> vi;

template<class T> using v2d = vector <vector <T> >;
template<class T> bool uin(T &a, T b)
{
    return a > b ? (a = b, true) : false;
}
template<class T> bool uax(T &a, T b)
{
    return a < b ? (a = b, true) : false;
}

mt19937 rng(chrono::system_clock::now().time_since_epoch().count());

const int maxN = 1e5 + 10;

int n;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> n;
    for (auto d: {1, 10, 100})
    {
        if ((n / d) % 10 == 7)
        {
            cout << "Yes";
            return 0;
        }
    }
    cout << "No";
    return 0;
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)  for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define pb emplace_back
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
#define pi M_PI
#define PQ(T) priority_queue<T>
#define SPQ(T) priority_queue<T,vector<T>,greater<T>>
#define dame(a) {out(a);return 0;}
#define decimal cout<<fixed<<setprecision(15);
#define dupli(a) a.erase(unique(all(a)),a.end())
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef tuple<ll,ll,ll,ll> PPP;
typedef multiset<ll> S;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;
using vvvvi=vector<vvvi>;
using vp=vector<P>;
using vvp=vector<vp>;
using vb=vector<bool>;
using vvb=vector<vb>;
const ll inf=1001001001001001001;
const ll INF=1001001001;
const ll mod=1000000007;
const double eps=1e-10;
template<class T> bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<'\n';}
template<class T> void outvp(T v){rep(i,v.size())cout<<'('<<v[i].fi<<','<<v[i].se<<')';cout<<'\n';}
template<class T> void outvvp(T v){rep(i,v.size())outvp(v[i]);}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<'\n';}
template<class T> void outvv(T v){rep(i,v.size())outv(v[i]);}
template<class T> bool isin(T x,T l,T r){return (l)<=(x)&&(x)<=(r);}
template<class T> void yesno(T b){if(b)out("yes");else out("no");}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
template<class T> void YESNO(T b){if(b)out("YES");else out("NO");}
template<class T> void noyes(T b){if(b)out("no");else out("yes");}
template<class T> void NoYes(T b){if(b)out("No");else out("Yes");}
template<class T> void NOYES(T b){if(b)out("NO");else out("YES");}
void outs(ll a,ll b){if(a>=inf-100)out(b);else out(a);}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll modpow(ll a,ll b){ll res=1;a%=mod;while(b){if(b&1)res=res*a%mod;a=a*a%mod;b>>=1;}return res;}
int main(){
    ll n,t;cin>>n>>t;
    long double res=0;
    rep(i,n){
        long double x,h;cin>>x>>h;
        chmax(res,h/x);
    }
    decimal;
    out(t*res);
}


Measured memory_bytes: 3292
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
typedef vector<int> vec1;
typedef vector<string> vec2;
typedef vector<double> vec3;

int main() {

  int n;
  cin >> n;
  string s;
  cin >> s;
  vec2 tmp(1);
  tmp.at(0) = s;
  char t = s.at(s.size()-1);
  for(int i = 1; i < n; i++) {
    cin >> s;
    if(t == s.at(0)) {
      for(int j = 0; j < tmp.size(); j++) {
        if(tmp.at(j) == s) {
          cout << "No" << endl;
          return 0;
        }
      }
      tmp.push_back(s);
      t = s.at(s.size()-1);
    } else {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl; 
}

Measured memory_bytes: 256
'use strict'
const Main = (arg) => {
  let input = arg.trim().split('\n');
  let N = input[0].split(' ').map(Number)[0];
  let L = input[0].split(' ').map(Number)[1];
  let apple = [...Array(N).keys()].map(i => i + L);
  let eat = 0;
  let Ans = apple.reduce((ttl, data) => { return ttl + data });
  if (apple.indexOf(0) === -1) {
    if (apple[0] > 0) {
      eat = Math.min(...apple);
    } else if (apple[0] < 0) {
      eat = Math.max(...apple);
    }
  }
  Ans -= eat;
  console.log(Ans);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7372
def main():
    N = int(input())
    A_l = [int(i) for i in input().split()]
    order = [-1 for _ in range(N)]

    for index, A in enumerate(A_l):
        order[A-1] = index+1
    print(" ".join([str(i) for i in order]))


if __name__ == "__main__":
    main()

Measured memory_bytes: 18376
def resolve():
    N = int(input())
    A = list(map(int, input().split()))

    ans = [0] * N
    ans[0] = sum(A)

    for i in range(1, N, 2):
        ans[0] -= 2 * A[i]

    for i in range(N - 1):
        ans[i + 1] = 2 * A[i] - ans[i]

    print(*ans)


if __name__ == "__main__":
    resolve()

Measured memory_bytes: 20564
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>

#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 };


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;
}



int main() {
	int N, A, B; cin >> N >> A >> B;
	int dif = B - A;
	if (dif % 2 == 0) {
		cout << "Alice" << endl;
	}
	else if (dif % 2 == 1) {
		cout << "Borys" << endl;
	}
	return 0;
}




Measured memory_bytes: 256
//AUTHOR - NAVEEN KUMAR(@naveen19991124)
#include<bits/stdc++.h>
//#include<boost/multiprecision/cpp_int.hpp>
//#inlcude<boost/multiprecision/cpp_dec_float.hpp>
#define ll long long
#define pb push_back
#define f(a) for(ll i = 0;i<a;i++)
#define rep(i,a,b) for(ll i = a;i<b;i++)
#define rrep(i,a,b) for(ll i = a;i>b;i--)
#define v vector<ll>
#define mp make_pair
#define fir first
#define sec second
#define _fast_ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
//using boost :: multiprecision :: cpp_int;
//using boost :: multiprecision :: cpp_dec_float_50;
//using boost :: multiprecision :: cpp_dec_float_100;
ll power(ll a, ll n) {ll p = 1;while (n > 0) {if(n%2) {p = p * a;} n >>= 1; a *= a;} return p;}

ll power(ll a, ll n, ll mod) {ll p = 1;while (n > 0) {if(n%2) {p = p * a; p %= mod;} n >>= 1;
a *= a; a %= mod;} return p % mod;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a * (b / gcd(a, b)); }
int main()
{
    _fast_
    ll t = 1;
 //   cin>>t;
    while(t--){
    string s;
    cin>>s;
    if(s[2] == s[3] && s[4] ==  s[5])
    {
        cout<<"Yes\n";
    }
    else
    {
        cout<<"No\n";
    }
    
    }
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main ()
{	
	int p,q,r;
	
	scanf("%d %d %d", &p, &q, &r);
	
	if(p + q + r >= 22)
{
	printf("bust\n");
}	
	else
{
	printf("win\n");
}
	return 0;


}
	

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

int main(){
    int c=0, k, a[5];
    for(int i=0;i<5;i++) scanf("%d", &a[i]);
    scanf("%d", &k);

    for(int i=0;i<5;i++){
        for(int j=1;j<5;j++){
            if(k<a[j]-a[i]){
              printf(":(\n");
               return 0;
            }
        }
    }
    printf("Yay!\n");
    return 0;
}





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

using namespace std;
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (int i = 0; i < (n); i++)
#define chmin(x, y) (x) = min((x), (y))
#define chmax(x, y) (x) = max((x), (y))
#define endl "\n"
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec) {os << "["; for (const auto &v : vec) {os << v << ","; } os << "]"; return os;}
template <typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &p) {os << "(" << p.first << ", " << p.second << ")"; return os;}

void solve() {
    ll a;
    cin >> a;
    cout << 3 * a * a << endl;
}

int main() {
    #ifdef LOCAL_ENV
    cin.exceptions(ios::failbit);
    #endif
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    
    solve();
}

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

int n,m,X,Y,x,y,mn=101, mx=-101;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	cin>>n>>m>>X>>Y;
	// if(x>mx)
	// 	mx=x;
	// if(y<mn)
	// 	mn=y;
	for(int i=0;i<n;i++){
		cin>>x;
		if(x>mx)
			mx=x;
	}

	for(int i=0;i<m;i++){
		cin>>y;
		if(y<mn)
			mn=y;
	}

	if(mn>mx && X < mn && Y >= mn)
		cout<<"No War";
	else
		cout<<"War";

	return 0;
}

Measured memory_bytes: 256
function Main(input) {

	// 1行目がinput[0], 2行目がinput[1], …に入る
	input = input.split("\n");
    
    let x = parseInt(input[0].split(" ")[0]);
    let y = parseInt(input[0].split(" ")[1]);
    
    let flag = false;
    
    for (let i = 0; i <= x; i++){
        
        if (i * 2 + (x - i) * 4 == y) flag = true;
        
    }
    
    if (flag) console.log("Yes");
    else console.log("No");
    
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 29628
N,K=map(int,input().split())
*p,= map(int, input().split())

s=[(p[n]+1)/2 for n in range(N)]
S=[0]*(N+1)

def make_S(n):
    S=[0]*(n+1)
    S[0]=0
    for i in range(n):
        S[i+1]=S[i]+s[i]
    return S
S=make_S(N)

def max_delta(n,k):
    max=-1000000
    for i in range(n-k+1):
        delta = S[i+k]-S[i]
        if delta>max:
            max=delta
    return max

print(max_delta(N,K))

Measured memory_bytes: 25912
#include<stdio.h>

int main(){
  int N, i, sum;
  sum = 0;
  int max = 0;
  scanf("%d", &N);
  int p[N];
  for(i = 0; i < N; i++){
    scanf("%d", &p[i]);
    sum += p[i];
    if(p[i] > max){
      max = p[i];
    }
  }
  sum -= max/2;

  printf("%d\n", sum);

  return 0;
}             

Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
using namespace std;


int main() {
	int n;
	cin >> n;
	vector<int>p = { 2 };
	for (int i = 3; i <=55555 ; i+=2) {
		if (!n) {
			return 0;
		}
		for (auto &itr : p) {
			if (i%itr == 0) {
				break;
			}
			if (itr*itr >= i) {
			//	cout << i << " ";
				if ((i % 5) == 1) {
					cout << i << " ";
					n--;
				}
				p.push_back(i);
				break;
			}
		}
	}
	//int cnt = 0;
	//cout << p.size() << " p"<<endl;
	//for (int i = 60; i < p.size() - 4; i++) {
	//	//cout << cnt << endl;
	//	for (int j = i + 1; j < p.size() - 3; j++) {
	//		for (int k = j + 1; k < p.size() - 2; k++) {
	//			for (int l = k + 1; l < p.size() - 1; l++) {
	//				for (int m = l + 1; m < p.size(); m++) {
	//					int s = p[i] + p[j] + p[k] + p[l] + p[m];
	//					if (binary_search(p.begin(), p.end(), s)) {
	//						cnt++;
	//						cout << p[i] << " " << p[j] << " " << p[k] << " " << p[l] << " " << p[m] << " " << s <<" prime"<< endl;
	//					}
	//					else {
	//						cout << p[i] << " " << p[j] << " " << p[k] << " " << p[l] << " " << p[m] << " " << s << endl;
	//					}
	//				}
	//			}
	//		}
	//	}
	//}
	//cout << cnt<<endl;
	//vector<int>p1;
	//for (auto &itr : p) {
	//	if (itr % 5 == 1) {
	//		p1.push_back(itr);
	//	}
	//}
	//cout << p1.size() << endl;
	return 0;
}
// 解説ac

Measured memory_bytes: 256
#include <map>
#include <algorithm>
#include <cassert>
#include <climits>
#include <complex>
#include <cstdio>
#include <string>
#include <iostream>
#include <queue>
#include <string>
#include <tuple>
#include <vector>
using namespace std;
using ll = long long;
using ld = long double;

template<class T> bool chmin(T &a, T b) { return a>b?(a=b,true):false; }
template<class T> bool chmax(T &a,T  b) { return a<b?(a=b,true):false; }
#define forn(i,x,y) for(int i=(x);i<(int)(y);i++)
#define rep(i,y) for(int i=0;i<(int)(y);i++)
#define repb(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define all(a) (a).begin(), (a).end()
#define uni(a) (a).erase(unique(all(a)), (a).end())
#define bit(n, i) (((n) >> (i)) & 1)
#define bitcount(n) __builtin_popcountll(n)

template<class T> ostream &operator<<(ostream &os, vector<T> &v) {
  for (auto it = v.begin(); it != v.end(); ++it) {
    if (it != v.begin()) os << " ";
    os << *it;
  }
  return os;
}

int main() {
    int N; cin >> N;
    int mn1=2*1e9+10, mx1=-2*1e9-10;
    int mn2=mn1, mx2=mx1;
    rep(i,N) {
        int x,y; cin >> x >> y;
        chmin(mn1, x+y);
        chmax(mx1, x+y);
        chmin(mn2, x-y);
        chmax(mx2, x-y);
    }
    cout << max(mx1-mn1, mx2-mn2) << endl;

}

Measured memory_bytes: 3180
#include <iostream>
#include <assert.h>
#include <algorithm>
#include <vector>

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

    int32_t A,B,C;
    std::cin >> A >> B >> C;
    int32_t big = std::max(A,B);
    big = std::max(big,C);
    int32_t small = std::min(A,B);
    small = std::min(small, C);
    int32_t mid = A + B + C - big - small; 

    int32_t first_step = big - mid;
    int32_t diff = big - (small + first_step);
    int32_t res = first_step;
    if(diff % 2 == 0){
        res += diff / 2;
    }
    else{
        res += (diff / 2 + 2);
    }

    std::cout << res << std::endl;
    return 0;
}


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

int main() 
{
	int num1, num2;

	cin >> num1 >> num2;

	if(num1>num2){
		cout << "a > b\n";
	}
	else if(num1<num2) {
		cout << "a < b\n";
	}
	else {
		cout << "a == b\n";
	}


	return 0;

}

Measured memory_bytes: 3104
n = int(input())
h = [int(_) for _ in input().split()]
flg = True
for i in range(n-1):
    j = n-1-i
    if h[j]-h[j-1]>=0:
        continue
    if h[j]-h[j-1]<=-2:
        flg = False
        break
    if h[j]-h[j-1]==-1:
        h[j-1]-=1
        continue
if flg:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 14396
#include <stdio.h>

typedef struct {
  char mark;
  int num;
} card_t;


void BubbleSort(int n, card_t cards[]) {
  int i, j;

  for (i = 0; i < n-1; i++) {
    for (j = n-1; j >= i+1; j-- ) {
      if (cards[j-1].num > cards[j].num) {
	card_t tmp;
	tmp = cards[j-1];
	cards[j-1] = cards[j];
	cards[j] = tmp;
      }
    }
  }
  
}

void SelectSort(int n, card_t cards[]) {
  int i, j;
  int min;

  for (i = 0; i < n-1; i++) {
    min = i;
    for (j = i+1; j < n; j++) {
      if (cards[j].num < cards[min].num) {
	min = j;
      }
    }
    if (min != i) {
      card_t tmp;
      tmp = cards[i];
      cards[i] = cards[min];
      cards[min] = tmp;
    }
  }
    
}

int StableJudge(card_t A[], card_t B[], int n) {
  int i;

  for (i = 0; i < n; i++) {
    if (A[i].mark != B[i].mark) return 0;
  }

  return 1;
  
}

int main() {
  int n;
  card_t cards[36], cardsA[36], cardsB[36];
  int i;
  int judge;
  
  scanf("%d", &n);
  getchar();

  for (i = 0; i < n; i++) {
    scanf("%c%d", &(cards[i].mark), &(cards[i].num));
    getchar();
    cardsA[i] = cardsB[i] = cards[i];
  }
  
  BubbleSort(n, cardsA);
  SelectSort(n, cardsB);
  judge = StableJudge(cardsA, cardsB, n);

  for (i = 0; i < n; i++) {
    printf("%c%d", cardsA[i].mark, cardsA[i].num);
    if (i == n-1) break;
    putchar(' ');
  }
  putchar('\n');
  puts("Stable");

  for (i = 0; i < n; i++) {
    printf("%c%d", cardsB[i].mark, cardsB[i].num);
    if (i == n-1) break;
    putchar(' ');
  }
  putchar('\n');

  if (judge) {
    puts("Stable");
  }
  else {
    puts("Not stable");
  }
  
  return 0;
}



Measured memory_bytes: 2056
import java.util.*; import java.io.*; import java.math.*;
public class Main{
	static void solve(){//Here is the main function
		ArrayList<Long> one = nextLongArray();
		long H = Math.max(one.get(0), one.get(1));
		long W = Math.min(one.get(0), one.get(1));
		if(H == 1 || W == 1){
			myout(1);
			return;
		}
		if(H % 2 == 1 && W % 2 == 1){
			myout(H * W / 2 + 1);
		}else{
			myout(H * W / 2);
		}
	}
	//Method addition frame start



	//Method addition frame end

	//Don't have to see. start------------------------------------------
	static class InputIterator{
		ArrayList<String> inputLine = new ArrayList<String>(1024);
		int index = 0; int max; String read;
		InputIterator(){
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			try{
				while((read = br.readLine()) != null){
					inputLine.add(read);
				}
			}catch(IOException e){}
			max = inputLine.size();
		}
		boolean hasNext(){return (index < max);}
		String next(){
			if(hasNext()){
				return inputLine.get(index++);
			}else{
				throw new IndexOutOfBoundsException("There is no more input");
			}
		}
	}
	static HashMap<Integer, String> CONVSTR = new HashMap<Integer, String>();
	static InputIterator ii = new InputIterator();//This class cannot be used in reactive problem.
	static PrintWriter out = new PrintWriter(System.out);
	static void flush(){out.flush();}
	static void myout(Object t){out.println(t);}
	static void myerr(Object t){System.err.print("debug:");System.err.println(t);}
	static String next(){return ii.next();}
	static boolean hasNext(){return ii.hasNext();}
	static int nextInt(){return Integer.parseInt(next());}
	static long nextLong(){return Long.parseLong(next());}
	static double nextDouble(){return Double.parseDouble(next());}
	static ArrayList<String> nextStrArray(){return myconv(next(), 8);}
	static ArrayList<String> nextCharArray(){return myconv(next(), 0);}
	static ArrayList<Integer> nextIntArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Integer> ret = new ArrayList<Integer>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Integer.parseInt(input.get(i)));
		}
		return ret;
	}
	static ArrayList<Long> nextLongArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Long> ret = new ArrayList<Long>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Long.parseLong(input.get(i)));
		}
		return ret;
	}
	@SuppressWarnings("unchecked")
	static String myconv(Object list, int no){//only join
		String joinString = CONVSTR.get(no);
		if(list instanceof String[]){
			return String.join(joinString, (String[])list);
		}else if(list instanceof ArrayList){
			return String.join(joinString, (ArrayList)list);
		}else{
			throw new ClassCastException("Don't join");
		}
	}
	static ArrayList<String> myconv(String str, int no){//only split
		String splitString = CONVSTR.get(no);
		return new ArrayList<String>(Arrays.asList(str.split(splitString)));
	}
	public static void main(String[] args){
		CONVSTR.put(8, " "); CONVSTR.put(9, "\n"); CONVSTR.put(0, "");
		solve();flush();
	}
	//Don't have to see. end------------------------------------------
}


Measured memory_bytes: 32988
import java.io.*;
import java.util.Scanner;

class Main
{
	public static void main(String[] args) throws IOException
	{
		Scanner stdIn = new Scanner(System.in);
		int a, b;
		
		while (true){
			try {
				a = stdIn.nextInt();
			} catch (Exception e){
				return;
			}
			b = stdIn.nextInt();
			
			int sum = a + b;
			int count = 0;
			while (sum > 0){
				sum /= 10;
				count++;
			}
			System.out.println(count);
		}
	}
}

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

#define mod 1000000007

using namespace std;
 
int main(void){
	
	int A, B, K, count = 0;
	
	cin >> A >> B >> K;

	for(int i=100; i>=1; i--){
		if(A%i == 0 && B%i == 0){
			count++;
			if(count == K){
				cout << i;
				break;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    int N;
    bool ok = false;
    string result;
    cin >> N;

    if (N > 81) {
        ok = false;
    } else if (N < 10) {
        ok = true;
    } else {
        for (int i=9; i>1; --i) {
            if ((N % i == 0) && ((N / i) < 10)) {
                ok = true;
                break;
            } else {
                continue;
            }
        }

    }
  
    result = (ok) ? "Yes" : "No";
    cout << result << endl;

    return 0;
}


Measured memory_bytes: 256
n = int(input())
h = list(map(int,input().split()))
inf = float("inf")
dp =[inf for i in range(n)]
dp[0] = 0
dp[1] = abs(h[1]-h[0])
for i in range(2,n):
  dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]))
  
print(dp[-1])

Measured memory_bytes: 20544
//#define NDEBUG
#include <cstddef>
#include <cstdint>
#include <vector>

namespace n91 {

using i8 = std::int_fast8_t;
using i32 = std::int_fast32_t;
using i64 = std::int_fast64_t;
using u8 = std::uint_fast8_t;
using u32 = std::uint_fast32_t;
using u64 = std::uint_fast64_t;
using isize = std::ptrdiff_t;
using usize = std::size_t;

constexpr usize operator"" _z(unsigned long long x) noexcept {
  return static_cast<usize>(x);
}

class rep {
  const usize f, l;

public:
  class itr {
    friend rep;
    usize i;
    constexpr itr(const usize x) noexcept : i(x) {}

  public:
    void operator++() noexcept { ++i; }
    constexpr usize operator*() const noexcept { return i; }
    constexpr bool operator!=(const itr x) const noexcept { return i != x.i; }
  };
  constexpr rep(const usize first, const usize last) noexcept
      : f(first), l(last) {}
  constexpr itr begin() const noexcept { return itr(f); }
  constexpr itr end() const noexcept { return itr(l); }
};
class revrep {
  const usize f, l;

public:
  class itr {
    friend revrep;
    usize i;
    constexpr itr(usize x) noexcept : i(x) {}

  public:
    void operator++() noexcept { --i; }
    constexpr usize operator*() const noexcept { return i; }
    constexpr bool operator!=(const itr x) const noexcept { return i != x.i; }
  };
  constexpr revrep(usize first, usize last) noexcept : f(--first), l(--last) {}
  constexpr itr begin() const noexcept { return itr(l); }
  constexpr itr end() const noexcept { return itr(f); }
};
template <class T> using vec_alias = std::vector<T>;
template <class T> auto md_vec(const usize n, const T &value) {
  return std::vector<T>(n, value);
}
template <class... Args> auto md_vec(const usize n, Args... args) {
  return std::vector<decltype(md_vec(args...))>(n, md_vec(args...));
}
template <class T> constexpr T difference(const T &a, const T &b) {
  return a < b ? b - a : a - b;
}

} // namespace n91

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

namespace n91 {

void main_() {
  static constexpr u32 mod = static_cast<u32>(2019);
  u32 l, r;
  std::cin >> l >> r;
  ++r;
  u32 min = mod;
  if (r - l >= mod) {
    min = static_cast<u32>(0);
  } else {
    for (u32 j = l; j != r; ++j) {
      for (u32 i = l; i != j; ++i) {
        min = std::min(min, i * j % mod);
      }
    }
  }
  std::cout << min << std::endl;
}

} // namespace n91

int main() {
  n91::main_();
  return 0;
}


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

#define ll long long
#define vecll vector<long long>
#define vec2ll vector<vector<long long>>
#define vecbool vector<bool>
#define vecpairll vector<pair<long long,long long>>
#define forll(s,a,b) for(long long s = a;s < b;s++)
#define forllde(s,a) for(long long s = a;s > 0;s--)


int main()
{
  ll n, m, c=0;
  string tmp;
  cin >> n;
  map <string, int> s;
  forll(i, 0, n){
	cin >> tmp;
	s[tmp]++;
  }

  cin >> m;
  forll(i, 0, m){
	cin >> tmp;
	s[tmp]--;
  }

  for (auto x : s){
	if (x.second > 0)
	  c = max(c, (ll)x.second);
  }
  cout << c << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<math.h>


int main()
{
int i,j,l,m,a,b,c;
double n,k,x;
double p[100010];

scanf("%lf %lf",&n,&k);

for(i=0;i<100010;i++)
{
    p[i] = 0;
}

j = 0; 
c = 1;

while(1)
{
    if(k<c)
        break;
    j++;
  	c *= 2;
}


if(n<k)
{
    for(i=1;i<=n;i++)
    {
        a = k;
        for(l=1;l<=j;l++)
        {
            if(i>=(a-1)/2 + 1)
            {
                m = l;
                break;
            }
            a = (a-1)/2 + 1;
        }
        p[i] = 1/n * pow(0.5,m);
    }
}else
{
    p[0] = (n-k+1)/n;
    for(i=1;i<=k-1;i++)
    {
        a = k;
        for(l=1;l<=j;l++)
        {
            if(i>=(a-1)/2 + 1)
            {
                m = l;
                break;
            }
            a = (a-1)/2 + 1;
        }
        p[i] = 1/n * pow(0.5,m);
    }
}

for(i=0;i<=n;i++)
{
    x = x + p[i];
}

printf("%.9lf",x);
return 0;
}

Measured memory_bytes: 1024
#include<stdio.h>
int MIN(int a,int b){return a<b?a:b;}
int ta[100010],to[100010],co[100010],nt[100010],it[100010],l[100010];
void mklsb(int v,int e,int *a,int *b,int *c){
  int i;
  for(i=0;i<v;i++)ta[i]=-1;
  for(i=0;i<e;i++){
    nt[i  ]=ta[to[i+e]=a[i]];
    nt[i+e]=ta[to[i  ]=b[i]];
    co[ta[a[i]]=i  ]=c[i];      
    co[ta[b[i]]=i+e]=0;
  }
}
int MF(int e,int s,int t,int min){
  if(s==t)return min;
  int i,r;
  for(;it[s]+1;it[s]=nt[it[s]]){
    if(co[it[s]]==0||l[s]>=l[to[it[s]]])continue;
    r=MF(e,to[it[s]],t,MIN(min,co[it[s]]));
    co[it[s]]-=r;
    co[(it[s]+e)%(2*e)]+=r;
    if(r)return r;
  }
  return 0;
}
int maxf(int v,int e,int s,int g){
  int i,a=0,q[100010],t,r,c=3;
  while(1){
    q[0]=s;
    for(i=t=0;i<v;i++)l[i]=-1;
    l[q[0]]=0;
    for(r=1;r-t;t++){
      for(i=ta[q[t]];i+1;i=nt[i]){
	if(co[i]==0||l[to[i]]+1)continue;
	l[to[i]]=l[q[t]]+1;
	q[r++]=to[i];
      }
    }
    if(l[g]<0)return a;
    for(i=0;i<v;i++)it[i]=ta[i];
    for(;(r=MF(e,s,g,1e9))>0;a+=r);
  }
  return a;
}
int main(){
  int n,m,i,a[100010],b[100010],c[1000010],m1,m2;
  scanf("%d %d",&n,&m);
  for(i=0;i<m;i++)scanf("%d %d %d",&a[i],&b[i],&c[i]);
  mklsb(n,m,a,b,c);//prls(n);
  m1=maxf (n,m,0,n-1);
  printf("%d\n",m1);
  return 0;
}
  

Measured memory_bytes: 2708
#include <iostream>
#include <string>

using namespace std;

int main() {
    string s;

    cin >> s;

    if (s.substr(0, 7) == "keyence") {
        cout << "YES" << endl;
        return 0;
    }
    else if (s.substr(0, 6) == "keyenc") {
        if (s.substr(s.length() - 1, 1) == "e") {
            cout << "YES" << endl;
            return 0;
        }
        else {
            cout << "NO" << endl;
            return 0;
        }
    }
    else if (s.substr(0, 5) == "keyen") {
        if (s.substr(s.length() - 2, 2) == "ce") {
            cout << "YES" << endl;
            return 0;
        }
        else {
            cout << "NO" << endl;
            return 0;
        }
    }
    else if (s.substr(0, 4) == "keye") {
        if (s.substr(s.length() - 3, 3) == "nce") {
            cout << "YES" << endl;
            return 0;
        }
        else {
            cout << "NO" << endl;
            return 0;
        }
    }
    else if (s.substr(0, 3) == "key") {
        if (s.substr(s.length() - 4, 4) == "ence") {
            cout << "YES" << endl;
            return 0;
        }
        else {
            cout << "NO" << endl;
            return 0;
        }
    }
    else if (s.substr(0, 2) == "ke") {
        if (s.substr(s.length() - 5, 5) == "yence") {
            cout << "YES" << endl;
            return 0;
        }
        else {
            cout << "NO" << endl;
            return 0;
        }
    }
    else if (s.substr(0, 1) == "k") {
        if (s.substr(s.length() - 6, 6) == "eyence") {
            cout << "YES" << endl;
            return 0;
        }
        else {
            cout << "NO" << endl;
            return 0;
        }
    }
    else {
        cout << "NO" << endl;
        return 0;
    }
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <vector>
#include <cassert>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <math.h>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <bitset>
#include <tuple>
#include <climits>
#include <sstream>
using namespace std;

int main()
{
    int res = 0;
    int now = 0;
    string s;
    cin >> s;

    for (auto c : s)
    {
        if (c == 'A' || c == 'T' || c == 'C' || c == 'G')
        {
            now++;
            res = max(now, res);
        }
        else
        {
            now = 0;
        }
        
    }

    cout << res;

    return 0;
}

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

using namespace std;

int main(void)
{
	int n, m;
	cin >> n >> m;
	int wacount[n];
	fill(wacount, wacount+n, 0);
	bool d[n];
	fill(d, d+n, false);

	//long long wacount = 0;
	long long account = 0;
	for (int i = 0; i < m; i++) {
		int p;
		string s;
		cin >> p >> s;
		if (d[p-1] == true) {
			continue;
		}

		if (s == "WA") {
			wacount[p-1]++;
		} else {
			d[p-1] = true;
			account++;
		}
	}
	long long ans = 0;
	for (int i = 0; i < n; i++) {
		if (d[i])
			ans += wacount[i];
	}
	cout << account << " " << ans << endl;
	return 0;
}

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

using namespace std;

typedef short sho;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef double db;
typedef string str; 
 
typedef pair<int,int> pii;
typedef pair<ll,ll> pll; 
typedef pair<ld,ld> pld;
 
typedef vector<int> vi; 
typedef vector<ll> vl; 
typedef vector<ld> vd;
typedef vector<str> vs;
typedef vector<pii> vpi;
typedef vector<pll> vpl;
typedef vector<pld> vpd;

#define LOCAL
#define MP make_pair 
#define FF first
#define SS second
#define sz(x) (int)x.size()
#define begin(x) (x).begin() 
#define end(x) (x).end()
#define rbegin(x) (x).rbegin()
#define rend(x) (x).rend()
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define rsz resize
#define ins insert
#define ft front()
#define bk back()
#define PF push_front 
#define PB push_back
#define PP push
#define lb lower_bound 
#define ub upper_bound
#define lowbit(x) x&(-x)
#define testbit(x,i) x&(1<<i)

inline void checkmin(int &x,int y){x=min(x,y);}
inline void checkmax(int &x,int y){x=max(x,y);}

int n;
ll ans = 0;

int main() 
{
	#ifndef LOCAL
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif
	ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    /* start code */
    cin>>n;
    for(int i = 1; i <= n; i++) if(i % 3 && i % 5) ans += i;
    cout<<ans<<endl;
    /* end code */
	return 0;
}

Measured memory_bytes: 3612
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
//#define int ll
typedef vector<vector<pair<int, int> > > vvp;
typedef vector<pair<int, int> > vp;
typedef vector<vector<int> > vvi;
typedef vector<int> vi;
typedef vector<vector<ll> > vvl;
typedef vector<ll> vl;
typedef vector<vector<bool> > vvb;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef pair<string, int> psi;
typedef pair<int, int> pii;

struct node {
	int x;
	int y;
};
typedef vector<node> vn;

#define rep(i,s,n) for(int i = (s); i < (n); i++)
#define all(x) (x).begin(), (x).end()
#define yn(f) (f?"yes":"no")
#define YN(f) (f?"YES":"NO")
#define Yn(f) (f?"Yes":"No")
#define puts(s) cout<<(s)<<endl
#define len(x) int(x.size())
#define inf (1000000007)
#define ll_inf (1000000000000000007)
#define nil -1

class disjoint_set {
public:
	vi p, rank;
	disjoint_set(int size) {
		p.resize(size, 0);
		rank.resize(size, 0);
		for (int i = 0; i < size; i++)makeSet(i);
	}
	void makeSet(int x) {
		p[x] = x;
		rank[x] = 0;
	}
	bool same(int x, int y) {
		return findSet(x) == findSet(y);
	}
	void unite(int x, int y) {
		link(findSet(x), findSet(y));
	}
	void link(int x, int y) {
		if (rank[x] < rank[y]) {
			p[x] = y;
		}
		else {
			p[y] = x;
			if (rank[x] == rank[y]) {
				rank[x]++;
			}
		}
	}
	int findSet(int x) {
		if (x != p[x]) {
			p[x] = findSet(p[x]);
		}
		return p[x];
	}
};
void space_endl(int i,int n) {
	if (i==n) {
		cout << endl;
	}
	else {
		cout << " ";
	}
}
int gcd(int a,int b) {
	return (b==0) ? a:gcd(b ,a%b );
}
int lcm(int a,int b) {
	return (a * b) / gcd(a,b);
}
int extgcd(int a,int b,int& x,int& y) {
	int d = a;
	if (b == 0) {
		x = 1;
		y = 0;
	}
	else {
		d = extgcd(b,a%b,y,x);
		y -= (a/b) * x;
	}
	return d;
}
vi get_primes(int limit) {
	vb A(limit + 1, true);
	for (int i = 2; i < A.size(); i++){
		if (!A[i])continue;
		for (int j = i * 2; j < A.size(); j += i)A[j] = false;
	}
	vi B;
	for (int i = 2; i < A.size(); i++)
	{
		if(A[i])B.push_back(i);
	}
	return B;
}
bool is_prime(int num) {
	if (num < 2)return false;
	for (int i = 2; i <= sqrt(num); i++)
	{
		if (num % i == 0) {
			return false;
		}
	}
	return true;
}

signed main() {
	int M, D;
	cin >> M >> D;
	int count = 0;
	for (int i = 1; i <= M; i++)
	{
		for (int j = 1; j <=D; j++)
		{
			int d10 = j / 10;
			int d2 = j % 10;
			if (d10>=2&&d2>=2) {
				if (d10 * d2 == i) { count++; }
			}
		}
	}
	puts(count);
}


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

#define F first
#define S second
#define MP make_pair
#define PB push_back

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair < int, int > pii;
typedef pair < ll, ll > pll;
typedef vector < ll > vl;

const int MAXN = 22;
const int BITMASK = (1 << MAXN);
const int INF = 0x3f3f3f3f;
const int MOD = 1e9 + 7;
const int LOG = 18;
const double EPS = 1e-9;
const double PI = 3.1415926535;

int pairing[MAXN][MAXN];
int dp[BITMASK];

// stanje je samo koja su mjesta zauzeta
// broj znamenaka maske kaze nan na kojen smo muskarcu
// maska nan kaze koje smo zene zauzeli

int add(int a, int b) {
    if(a + b >= MOD)
        return (a + b - MOD);
    return (a + b);
}

int main() {
    int N, MASK;

    scanf("%d", &N);
    MASK = (1 << N);
    for(int i = 0; i < N; i++)
        for(int j = 0; j < N; j++)
            scanf("%d", &pairing[i][j]);

    dp[0] = 1;
    for(int mask = 1; mask < MASK; mask++) {
        int i = __builtin_popcount(mask) - 1;
        for(int j = 0; j < N; j++)
            if((mask & (1 << j)) && pairing[i][j])
                dp[mask] = add(dp[mask], dp[mask ^ (1 << j)]);
    }

    printf("%d\n", dp[MASK - 1]);

    return 0;
}



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

int main() {
  int N;
  cin >> N;
  
  vector<string> blueCard(N);
  
  for (int i = 0; i < N; i++) cin >> blueCard.at(i);

  int M;
  cin >> M;
  
  vector<string> redCard(M);
  for (int i = 0; i < M; i++) cin >> redCard.at(i);

  vector<int> total(N, 0);

  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      if (blueCard.at(i) == blueCard.at(j)) total.at(i)++;
    }
    
    for (int j = 0; j < M; j++) {
      if (blueCard.at(i) == redCard.at(j)) total.at(i)--;
    }
  }

  int answer = *max_element(total.begin(), total.end());
  
  if (answer < 0) answer = 0;
  
  cout << answer << endl;
}


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

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define LOOP(i) while(i--)
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

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

	int N=in();
	auto V=vecin(N);
	map<int,int> C;
	REP(i,N){
		C[V[i]]++;
	}
	int M=C.size();
	out(M%2?M:M-1);
	return 0;
}


Measured memory_bytes: 5376
#include <bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl;
#define endl "\n";
using namespace std;


int main() {
    cin.sync_with_stdio(0);
    cin.tie(0);
    int rows, cols;
    cin >> rows >> cols;

    char a[rows+1][cols+1];
    int dist[rows+1][cols+1];
    for(int i = 1; i <= rows; i++)
        for(int j = 1; j <= cols; j++)
            dist[i][j] = numeric_limits<int>::max();


    queue<int> rQ;
    queue<int> cQ;
    for(int i = 1; i <= rows; i++)
        for(int j = 1; j <= cols; j++) {
            cin >> a[i][j];
            if(a[i][j] == '#') {
                rQ.push(i);
                cQ.push(j);
                dist[i][j] = 0;
            }
        }
    

    while(!rQ.empty()) {
        int r = rQ.front(); rQ.pop();
        int c = cQ.front(); cQ.pop();

        // top
        if(r-1 >= 1)
            if(dist[r][c]+1 < dist[r-1][c]) {
                dist[r-1][c] = dist[r][c]+1;
                rQ.push(r-1);
                cQ.push(c);
            }
        
        // right
        if(c+1 <= cols) 
            if(dist[r][c]+1 < dist[r][c+1]) {             
                dist[r][c+1] = dist[r][c]+1;
                rQ.push(r);
                cQ.push(c+1);
            }
        
        // down
        if(r+1 <= rows)
            if(dist[r][c]+1 < dist[r+1][c]) {
                dist[r+1][c] = dist[r][c]+1;
                rQ.push(r+1);
                cQ.push(c);
            }

        // left
        if(c-1 >= 1) {
            if(dist[r][c]+1 < dist[r][c-1]) {
                dist[r][c-1] = dist[r][c]+1;
                rQ.push(r);
                cQ.push(c-1);
            }
        }
    }

    int ans = 0;
    for(int i = 1; i <= rows; i++) {
        for(int j = 1; j <= cols; j++)  {
            ans = max(ans, dist[i][j]);
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 13312
#include<stdio.h>
int main(void){

  int x,y;
  while(1){
    scanf("%d%d",&x,&y);
    if(x == 0 && y == 0) break;
    if(x >= y)
      printf("%d %d\n",y,x);
    else if(y >= x)
      printf("%d %d\n",x,y);  
  }
  return 0;
}

Measured memory_bytes: 600
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int a,b,k;
    int min=0,c[110]={},j=1;
    
    cin>>a>>b>>k;
    
    if(a<b) min=a;
    else min=b;
    
    for(int i=1;i<=min;i++){
        if(a%i==0 && b%i==0){
            c[j]=i;
            j++;
        } 
    }
    cout<<c[j-k]<<endl;
    return 0;
}


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

using namespace std;

#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define pii pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< pii >
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; cin >> x;
#define int2(x, y) Int(x); Int(y);
#define int3(x, y, z) Int(x); int2(y, z);
#define in(x, a, b) ((a) <= (x) && (x) < (b))
#define fir first
#define sec second
#define ffir first.first
#define fsec first.second
#define sfir second.first
#define ssec second.second
#define Decimal fixed << setprecision(10)

//int dxy[5] = {0, 1, 0, -1, 0};
// cmd

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

    Int(s);
    int left = s / 1000000000 + !!(s % 1000000000);
    int right = (1000000000 - (s % 1000000000)) % 1000000000;

    cout << 0 << " " << 0 << " " << 1000000000 << " " << 
        1 << " " << right << " " << left << endl;


    return 0;
}


Measured memory_bytes: 256
from sys import stdin
n, k = [int(i) for i in stdin.readline().split(' ')]
h = [int(i) for i in stdin.readline().split(' ')]

minCosts = [0, abs(h[1]-h[0])]
for i in range(2, len(h)):
    minCosts.append(min([abs(h[i]-h[i-j])+minCosts[i-j] for j in range(1, min(i, k)+1)]))

print(minCosts[-1])

Measured memory_bytes: 57820