akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(n) begin(n), end(n)
using ll = long long;
using namespace std;

void fc(vector<vector<int>> &c, int now){
  int mn = 1001;
  rep(i, 3){
    if(c.at(now).at(i) < mn){
      mn = c.at(now).at(i);
    }
  }
  rep(i, 3) c.at(now).at(i) -= mn;
}

int main(){
  vector<vector<int>> c(3, vector<int>(3));
  rep(i, 3){
    rep(j, 3){
      int a;
      cin >> a;
      c.at(i).at(j) = a;
    }
  }
  rep(i, 3){
    fc(c, i);
  }
  if(c.at(0) == c.at(1) && c.at(1) == c.at(2)){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }

  return 0;
}

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

#define MOD 1000000007
#define mp make_pair
#define pb push_back

using namespace std;

const int N = 1005;
int n;
int T;
int mincost = INT_MAX;
bool found;
int cs,ts;

int main ()
{
	scanf("%d %d",&n,&T);
	for (int i = 1; i <= n; i++)
	{
		scanf("%d %d",&cs,&ts);
		if (ts <= T)
		{
			mincost = min(cs,mincost);
			found = true;
		}
	}
	if (found)
		return printf("%d",mincost),0;
	printf("TLE");
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  string S;
  cin>>S;
  bool ans;
  ans=true;
  while(S.size()!=0){
    if(S.size()<5){
      ans=false;
      break;
    }
    else if(S.substr(S.size()-5,5)=="dream"|| S.substr(S.size()-5,5)=="erase"){
      S=S.substr(0,S.size()-5);
    }
    else if(S.size()>5 && S.substr(S.size()-6,6)=="eraser"){
      S=S.substr(0,S.size()-6);
    }
    else if(S.size()>6 && S.substr(S.size()-7,7)=="dreamer"){
      S=S.substr(0,S.size()-7);
    }
    else{
      ans=false;
      break;
    }  
}
 
  if(ans){
    cout<<"YES"<<endl;
  }
  else{
    cout<<"NO"<<endl;
  }
}

Measured memory_bytes: 512
#include<iostream>

using namespace std;

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

	int h, minute;
	h = sec / 3600;
	int h1 = h * 3600;


	minute = (sec - h1) / 60;
	int minute2 = minute * 60;
	sec = sec - h1 - minute2;

	cout << h << ":" << minute << ":" << sec << endl;
}


Measured memory_bytes: 3108
#include <iostream>

using namespace std;

#define N_MAX 100

int main(){
    int n, x, j;
    int length[N_MAX] = {0};
    int sum[N_MAX] = {0};

    cin >> n >> x;
    for (int i=0;i<n;i++)   cin >> length[i];

    for (int i=1;i<n+1;i++)   sum[i] = sum[i-1] + length[i-1];

    for (j=0;sum[j] <= x;j++){
        if (j != 0 && sum[j] == 0){
            break;
        }
    }

    cout << j;

    return 0;
}

Measured memory_bytes: 256
//
// Created by Ильдар Ялалов on 14.01.2020.
//
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int inf_int = 1e9 + 100;
const ll inf_ll = 1e18;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef long double dbl;
typedef unsigned int uint;
#define pb push_back
#define eb emplace_back
const double pi = 3.1415926535898;
#define dout if(debug) cout
#define fi first
#define se second
#define sp setprecision
#define sz(a) (int(a.size()))
#define mp make_pair
#define all(a) a.begin(),a.end()

#ifdef zxc

#include "debug.h"

#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

bool debug = 0;
const int MAXN = 4e6 + 100;
const int LOG = 21;
const int mod = 1e9 + 7;
const int MX = (1e7 + 100);

int cnt[MAXN];

void solve() {
    int n, m;
    cin >> n >> m;
    set<int> s;
    s.insert(1);
    for (int i = 1; i <= n; ++i) {
        cnt[i] = 1;
    }

    for (int i = 1; i <= m; ++i) {
        int x, y;
        cin >> x >> y;

        if (s.count(x)) {
            s.insert(y);
            if (cnt[x] == 1) {
                s.erase(x);
            }
        }
        debug(s);
        cnt[y]++;
        cnt[x]--;
    }
    cout << sz(s) << "\n";

}


// CHECK LIMITS (n <= 10^5)
// CHECK CORNER CASES ( n==1)
signed main() {
#ifdef zxc
    freopen("../input.txt", "r", stdin);
//    freopen("../output.txt", "w", stdout);
#else
#endif //zxc
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cout.setf(ios::fixed);
    cout.precision(2);

    int t = 1;
    while (t--) {
        solve();
    }
    debug(1.0 * clock() / CLOCKS_PER_SEC);
}

Measured memory_bytes: 5376
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<numeric>
#include<stack>
#include<map>
#include<queue>
#include<unordered_map>
#include<cmath>
#include<utility>

using ULL = unsigned long long;
using LL = long long;
using String = std::string;
using Ints = std::vector<int>;
using Doubles = std::vector<double>;
using Bools = std::vector<bool>;
using Strings = std::vector<std::string>;
using ULLs = std::vector<ULL>;
using LLs = std::vector<LL>;

using namespace std;

// pythonのdictionary相当
template <typename T1, typename T2>
using Dict = std::unordered_map<T1,T2>;



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


    cout << (N==0?1:0) << endl;
}

Measured memory_bytes: 3592
N = int(input())
A = sorted((list(map(int, input().split()))))

if N == 2:
    y, x = A
    print(x-y)
    print(x, y)
    exit()

XY = []

PLUS = 0
MINUS = 0
for a in A:
    if a >= 0:
        PLUS += 1
    else:
        MINUS += 1

XY = []
tmp = A[0]
if PLUS and MINUS:
    while PLUS >= 2:
        x, y = tmp, A.pop()
        XY.append((x, y))
        tmp = x-y
        PLUS -= 1
    x, y = A.pop(), tmp
    XY.append((x, y))
    tmp = x-y
    N = len(A)
    for i in range(1, N):
        a = A[i]
        x, y = tmp, a
        XY.append((x, y))
        tmp = x-y
elif PLUS:
    for i in range(N-1):
        if i < N-2:
            x, y = tmp, A.pop()
            XY.append((x, y))
            tmp = x-y
        if i == N-2:
            x, y = A.pop(), tmp
            XY.append((x, y))
            tmp = x-y
else:
    for i in range(N-1):
        if i == 0:
            x, y = A.pop(), tmp
            XY.append((x, y))
            tmp = x-y
        else:
            x, y = tmp, A.pop()
            XY.append((x, y))
            tmp = x-y       
ans = tmp
print(ans)
for x, y in XY:
    print(x, y)

Measured memory_bytes: 62572
#include<bits/stdc++.h>
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define rep(N) for (int i = 0; i < N; ++i)
#define Rep(a, b) for (int i = a; i < b; ++i)
#define For(i, N) for (int i = 0; i < N; ++i)
#define all(v) v.begin(), v.end()
#define rev(v) v.rbegin(), v.rend()
#define makei(N) int N; cin >> N;
#define makel(N) ll N; cin >> N;
#define makes(s) string s; cin >> s;
#define maked(d) double d; cin >> d;
#define makev(v, N) vi v(N); rep(N)cin >> v[i];
#define mod 1000000007
#define re return 0
#define distance(x1,y1,x2,y2) sqrt((x1 - x2)*(x1 - x2) + (y1 - y2)*(y1 - y2));

using namespace std;
using ll = long long int;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vector<bool>>;
using vs = vector<string>;
using pii = pair<int, int>;
using pis = pair<int, string>;
using msi = map<string, int>;

template<typename T>
void say(T s) {
	cout << s << "\n";
}

template<typename T>
void say(vector<T> s) {
	auto itr = s.begin();
	cout << *(itr++);
	while (itr != s.end()) {
		cout << " " << *(itr++);
	}
	cout << "\n";
}

void yn(bool b) {
	if (b)say("Yes");
	else say("No");
}

void YN(bool b) {
	if (b)say("YES");
	else say("NO");
}

template<typename T>
void maxi(T &a, T b) {
	a = max(a, b);
}

template<typename T>
void mini(T &a, T b) {
	a = min(a, b);
}

void exact_say(double x) {
	cout << setprecision(numeric_limits<double>::max_digits10) << x << endl;
}

int main() {
	int n, h, w;
	cin >> n >> h >> w;
	say((n - h + 1)*(n - w + 1));
}

Measured memory_bytes: 256
import sys
import bisect


def dfs(edge):
    insert = bisect.bisect_left(lis_array, a_array[edge - 1])
    old = lis_array[insert]
    lis_array[insert] = a_array[edge - 1]
    ans = bisect.bisect_left(lis_array, INF)
    ans_array[edge - 1] = ans
    for next_edge in node_dic[edge]:
        if use_array[next_edge - 1] == -1:
            use_array[next_edge - 1] = 1
            dfs(next_edge)
    lis_array[insert] = old


sys.setrecursionlimit(10 ** 9)
N = int(input())
a_array = list(map(int, input().split()))

node_dic = {}
for _ in range(N - 1):
    u, v = map(int, input().split())
    if u in node_dic:
        node_dic[u].append(v)
    else:
        node_dic[u] = [v]

    if v in node_dic:
        node_dic[v].append(u)
    else:
        node_dic[v] = [u]

# print(node_dic)

use_array = [-1] * N
ans_array = [0] * N

INF = 2 * 10 ** 9
lis_array = [INF] * N

use_array[0] = 1
dfs(1)
print("\n".join(map(str, ans_array)))


Measured memory_bytes: 388456
#include <iostream>
#include <cmath>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <bitset>
#include <string>
#include <algorithm>
#include <iterator>
#include <unordered_map>
#include <unordered_set>
#include <sstream>
#include <tuple>
#include <fstream>
#include <numeric>

using namespace std;

#define fori(t) for(int i = 0; i < t; ++i)
#define forj(n) for(int j = 0; j < n; ++j)
#define fork(n) for(int k = 0; k < n; ++k)
#define forai(a) for(auto i : a)
#define foraj(a) for(auto j : a)
#define forak(a) for(auto k : a)
#define forp(s, n, d) for(int p = s; p < n; p += d)
#define fast cin.tie(0); cout.tie(0); std::ios_base::sync_with_stdio(0);
#define pb(a) push_back(a);
#define pob(a) pop_back(a);
#define sorti(a) sort(a.begin(), a.end());
#define sortm(a, n) sort(a, a + n);
#define reversi(a) reverse(a.begin(), a.end());
#define fi first
#define se second
#define yes cout << "YES\n";
#define no cout << "NO\n";
#define ans(a) cout << a << '\n';
#define res(a, n) a.resize(n);
#define read(a, n) a.resize(n); fori(n) cin >> a[i];
//#define int long long
//#define double long double

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef pair<long long, long long> llll;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<pair<int, int>> vii;
typedef vector<pair<int, pair<int, int>>> viii;
typedef pair<int, pair<int, int>> iii;
typedef vector<pair<long long, long long>> vllll;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
typedef pair<char, char> cc;
typedef pair<pair<char, char>, char> ccc;
typedef vector<char> vc;
typedef pair<int, char> ic;
typedef pair<ii, char> iic;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef set<int> si;
typedef set<ii> sii;

const int INF = 2147483647;
const ll LONGINF = 9223372036854775807;
const ll MOD = 998244353;

void solve()
{
    int x;
    cin >> x;
    ans(10 - x / 200)
}

signed main()
{
    fast
    bool mult = false;
    if (mult)
    {
        int t;
        cin >> t;
        while (t--) solve();
    }
    else solve();
}


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


int main() {
	long long int H;
  	cin>>H;
    long long int ans=0;
  	long long int i=1;
  	
  	while(H>0){
     	 H=H/2;
      	 ans+=i;
      	 i*=2;
    }
  	cout<<ans<<endl;
  	
 
}

Measured memory_bytes: 256
//??????????????????????????????????????????????????????????????????????????§???????????±????????????????????£??????
/*
?§£???
?????????????????£???????????????????????????????????????
???????????????????????????????????¨??§??????????????\????????°??????????????§?????????????????§????????\????????????????????°?????¨??????????????????????????°???????????????
????????????????????°??????????????????????????°???????????????????¢????????????°???????????????????????????????????°????????????????°???????????????????????????????
?????£?????????????????°????????\?????????????????\????????°????????????????????´????????\??????????±????????????????????????????????????°????????¨?????????
*/
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <bitset>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<pint> vpint;
#define mp make_pair
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define rep(i,n) for(ll i=0;i<(n);i++)
#define REP(i,n) for (int i=(n)-1;i>=0;i--)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define REPS(i,f,n) for (int i=(f)-1;i>=(n);i--)

const ll mod = 1000000007;

int main(void){
	ll n; ll t;
	cin >> n >> t;
	vector<ll> d(n);
	rep(i, n) scanf("%lld", &d[i]);

	sort(all(d));
	ll ans = 1;
	//????????\????????´????????¢?????????????????????????¢??????????????????¨??????????????????????????§???????????¢?´¢??¨???lower_bound??¢??°(???????????????"??\???"???????´?????????????????????????????????????)
	//i + 1????????§?????\??£???????????°???????????¨??????????°??????°????????\?????????
	//lower_bound????????£???????????¶????????????????????°???????????????????????¶????????????????????°??????????¨?????¨???????????????¨???(i + 1)??????????????°??????????????°???????????????????????????
	rep(i, n){
		ans = ans * (i + 1 - (ll)(lower_bound(d.begin(), d.begin() + i + 1, d[i] - t) - d.begin())) % mod;
	}
        //ans = ans * (i + 1 - (ll)(lower_bound(d.begin(), d.begin() + i + 1, d[i] - t) - d.begin()) % mod;
		//(ans *= i + 1 - (ll)(lower_bound(d.begin(), d.begin() + i + 1, d[i] - t) - d.begin())) %= mod;

    printf("%lld\n", ans % mod);
    return 0;
}

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

using namespace std;
#ifdef _DEBUG
#define _GLIBCXX_DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define ll long long
#define ll1 1ll
#define ONE 1ll
#define DBG 1
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define loop(n) rep(loop, (0), (n))
#define all(c) begin(c), end(c)
const int INF =
sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
const double PI = acos(-1);
const double EPS = 1e-9;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
using pii = pair<int, int>;
// template<class T> ostream &operator<<(ostream &os,T &t){dump(t);return os;}
template <typename T, typename S>
istream &operator>>(istream &is, pair<T, S> &p) {
	is >> p.first >> p.second;
	return is;
}
template <typename T, typename S>
ostream &operator<<(ostream &os, pair<T, S> &p) {
	os << p.first << " " << p.second;
	return os;
}

template <typename T> void printvv(const vector<vector<T>> &v) {
	cerr << endl;
	rep(i, 0, v.size()) rep(j, 0, v[i].size()) {
		if (typeid(v[i][j]).name() == typeid(INF).name() and v[i][j] == INF) {
			cerr << "INF";
		}
		else
			cerr << v[i][j];
		cerr << (j == v[i].size() - 1 ? '\n' : ' ');
	}
	cerr << endl;
}
/*
typedef __int128_t Int;
std::ostream &operator<<(std::ostream &dest, __int128_t value) {
std::ostream::sentry s(dest);
  if (s) {
	__uint128_t tmp = value < 0 ? -value : value;
	char buffer[128];
	char *d = std::end(buffer);
	do {
	  --d;
	  *d = "0123456789"[tmp % 10];
	  tmp /= 10;
	} while (tmp != 0);
	if (value < 0) {
	  --d;
	  *d = '-';
	}
	int len = std::end(buffer) - d;
	if (dest.rdbuf()->sputn(d, len) != len) {
	  dest.setstate(std::ios_base::badbit);
	}
  }
  return dest;
}

__int128 parse(string &s) {
  __int128 ret = 0;
  for (int i = 0; i < s.length(); i++)
	if ('0' <= s[i] && s[i] <= '9')
	  ret = 10 * ret + s[i] - '0';
  return ret;
}
*/

#ifndef _DEBUG
#define printvv(...)
#endif
void YES(bool f) { cout << (f ? "YES" : "NO") << endl; }
void Yes(bool f) { cout << (f ? "Yes" : "No") << endl; }
template <class T> bool chmax(T &a, const T &b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
template <class T> bool chmin(T &a, const T &b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}

signed main(signed argc, char *argv[]) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(12);

	int N, X; cin >> N >> X;
	vector<int>x(2 * N + 1); rrep(i, 1, N + 1) { cin >> x[i]; }
	rep(i, 1, x.size())x[i] += x[i - 1];
	auto E = [&](int i, int l, int r) {
		int c = (i == 1 ? 5 : 1 + 2 * i);
		return c * (x[r] - x[l - 1]);
	};
	int ans = INF;
	rep(k, 1, N + 1) {
		int cost = 0;
		rep(i, 0, (N + k - 1) / k) {
			cost += E(i + 1, i*k+1, (i + 1)*k);
		}
		chmin(ans, (cost<0?INF:cost) + (N + k)*X);
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3456
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
/*
 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;}
 const ll INF = 1LL<<60;
 const ll M = 1000000007;
 ll mpow(ll a,ll b) {ll res=1;while(b!=0){if(b&1)res=res*a%M;a=a*a%M;b=b>>1;}return res;}
 ll mcomb(ll n,ll k){if(k>n/2)return mcomb(n,n-k);ll res=1;for(ll i=0;i<k;i++){res=res*(n-i)%M;res=res*mpow(k-i,M-2)%M;}return res;}
 */

int main(){
    int n;cin>>n;
    cout<<(1000-n%1000)%1000<<endl;
    return 0;
}


Measured memory_bytes: 3668
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <fstream>
#include <list>
using namespace std;
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v;}
template<class T> inline string toStr(T x) { ostringstream sout; sout << x; return sout.str();}
typedef vector<int> vi;
typedef vector<vi>  vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,(n)-1)
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = INT_MAX/10;

#include <complex>
typedef complex<double> P;
typedef vector<P> vp;
typedef vector<double> vd;

#define LT(x,y) ((x)-(y)<=-EPS)
#define LE(x,y) ((x)-(y)<+EPS)

double dot(P a, P b) {
	return a.real()*b.real()+a.imag()*b.imag();
}

double cross(P a, P b) {
	return a.real()*b.imag()-a.imag()*b.real();
}

double dist(P a, P b) {
	return abs(b-a);
}

double distance_ls_p(P a, P b, P c) {
	if(dot(b-a, c-a) < EPS) return abs(c-a);
	if(dot(a-b, c-b) < EPS) return abs(c-b);
	return abs(cross(b-a, c-a))/abs(b-a);
}

bool is_inner_circle_ls(P w, double r, P a, P b) {
	if(LT(dist(w, a), r) && LT(dist(w, b), r)) {
		return true;
	}
	return false;
}

bool is_cross_circle_ls(P w, double r, P a, P b) {
	if(is_inner_circle_ls(w, r, a, b)) {
		return false;
	} else {
		if(LE(distance_ls_p(a, b, w), r)) {
			return true;
		}
	}
	return false;
}

int main() {
	int n;
	while(cin >> n, n) {
		vp w(n);
		vd r(n);
		double x, y;
		REP(i, n) {
			cin >> x >> y >> r[i];
			w[i] = P(x, y);
		}

		int m;
		cin >> m;
		REP(i, m) {
			P t, s;
			cin >> x >> y;
			t = P(x, y);
			cin >> x >> y;
			s = P(x, y);

			bool safe = false;
			REP(i, n) {
				if(is_cross_circle_ls(w[i], r[i], t, s)) {
					safe = true;
					break;
				}
			}

			cout << (safe ? "Safe" : "Danger") << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 1240
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <utility>
#include <cmath>
#include <cstdlib>
#include <cstring>

#define INF_LL 9000000000000000000
#define INF 2000000000

#define REP(i, n) for(int i = 0;i < (n);i++)
#define FOR(i, a, b) for(int i = (a);i < (b);i++)

using namespace std;

typedef long long ll;
typedef pair<int, int> PII;
typedef pair<int, PII> PPII;
typedef pair<int, PPII> PPPII;

class Union_find{
private:
	vector<int> par;
	vector<int> rank;
	int n;

public:
	Union_find(int a){
		n = a;
		for(int i = 0;i < n;i++){
			par.push_back(i);
			rank.push_back(0);
		}
	}

	int find(int x){
		if(par[x] == x){
			return x;
		}else{
			return par[x] = find(par[x]);
		}
	}

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

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

int main(void){
	ll res = 0;
	int A, B;
	int a[5005] = {};
	int b[5005] = {};
	cin >> A >> B;
	REP(i, A){
		cin >> a[i];
	}
	REP(i, B){
		cin >> b[i];
	}
	REP(i, B){
		int Ain = 0;
		ll cnt = 0;
		for(int Bin = i;Bin < B;Bin++){
			while(Ain < A && a[Ain] != b[Bin]){
				Ain++;
			}
			if(a[Ain] == b[Bin]){
				Ain++;
				cnt++;
			}
		}
		res = max(res, cnt);
	}
	cout << res << endl;
}

Measured memory_bytes: 3092
n = gets.to_i
as = gets.split.map(&:to_i)
bs = gets.split.map(&:to_i)

if as.inject(:+) < bs.inject(:+)
  puts -1
  exit
end

ans = 0
short = 0
amari = []
(0..n-1).each do |i|
  if as[i] < bs[i]
    ans += 1
    short += bs[i] - as[i]
  else
    amari << as[i] - bs[i]
  end
end

amari.sort!
while short > 0 do
  short -= amari.pop
  ans += 1
end

puts ans


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


int main() {
#ifdef DEBUG
	freopen("in", "r", stdin);
#endif

	int w, h, a, b;
	scanf("%d%d%d%d", &h, &w, &a, &b);
	for (int i=0; i<b; ++i) {
		for (int j=0; j<a; ++j) printf("1");
		for (int j=a; j<w; ++j) printf("0");
		printf("\n");
	}

	for (int i=b; i<h; ++i) {
		for (int j=0; j<a; ++j) printf("0");
		for (int j=a; j<w; ++j) printf("1");
		printf("\n");
	}



	return 0;
}


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

int main() {
  int k;
  string s;
  cin >> k >> s;
  if (s.size() <= k) {
    cout << s << endl;
  }
  else {
    string ss;
    for(int i = 0; i < k; i++) {
      ss += s.at(i);
    }
    cout << ss << "..." << endl;
  }
}

Measured memory_bytes: 3628
#include<iostream>
#include<string>
#include<vector>
#include<numeric>

using namespace std;

int main(){
    int h,n;
    cin >> h >> n;
    vector<int> v(n);
    for (int i=0;i<n;i++){
        cin >> v[i];
    }
    if (accumulate(v.begin(),v.end(),0) < h){
        cout << "No" << endl;
    } else {
        cout << "Yes" << endl;

    }

    return 0;
}



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

int main(){
	int H,W,i,j;
	while(1){
		cin>> H>> W;
		if(H==0 && W==0){
			break;
		}
		for(i=0;i<H;i++){
			for(j=0;j<W;j++){
				cout<< "#";
			}
			cout<< endl;
		}
		cout<< endl;
	}
	return 0;
}

Measured memory_bytes: 1152
var n:string;
    i:longint;
begin
  readln(n);
  if (n[1]=n[2])and(n[1]=n[3])
  then writeln('Yes')
  else if (n[2]=n[3])and(n[2]=n[4])
       then writeln('Yes')
       else writeln('No');
end.

Measured memory_bytes: 128
def LI():
    return list(map(int, input().split()))


X, Y = LI()
a = 10**18//X
if X == Y:
    ans = -1
elif X % Y == 0:
    ans = -1
else:
    for i in range(2, a+1):
        if X*i % Y == 0:
            continue
        ans = X*i
        break
print(ans)


Measured memory_bytes: 9196
N = int(input())
A = [int(x) for x in input().split()]


A = [0] + A + [0]
sum = 0
for i in range(N+1):
    sum += abs(A[i] - A[i+1])

for i in range(1, N + 1):
    d1 = abs(A[i - 1] - A[i])
    d2 = abs(A[i + 1] - A[i])
    d3 = abs(A[i - 1] - A[i + 1])
    print(sum - d1 - d2 + d3)


Measured memory_bytes: 14048
#include<stdio.h>
int main(){
   int A;
   int B;
   int C;
   int D;
   scanf("%d%d%d%d",&A,&B,&C,&D);
   while(A>0&&C>0){
      C-=B;
      if(C<=0){
         printf("Yes");
         break;
      }
      A-=D;      
      if(A<=0){
         printf("No");
      }
   }
   return 0;
}

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

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

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

struct edge {
	int to,cost;
	edge(int t,ll c):to(t),cost(c) {}
};

int dx[]={1,-1,0,0},dy[]={0,0,1,-1};
int ddx[]={1,1,1,0,-1,-1,-1,0},ddy[]={1,0,-1,-1,-1,0,1,1};

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

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

int n;
int cnt[100000];

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

	int lmt=0;
	cin>>n;
	REP(i,n) {
		int a; cin>>a; a--;
		lmt=max(lmt,a);
		cnt[a]++;
	}
	priority_queue<P> pq;
	REP(i,lmt+1) {
		if(cnt[i]) pq.push(P(cnt[i],i));
	}

	while(!pq.empty()) {
		if(pq.top().fi==1) break;
		P p=pq.top(); pq.pop();
		if(p.fi>=3) {
			pq.push(P(p.fi-2,p.se));
			continue;
		}
		if(p.fi==2) {
			P q=pq.top(); pq.pop();
			pq.push(P(1,p.se));
			if(q.fi!=1) pq.push(P(q.fi-1,q.se));
		}
		if(p.fi==1) {
			P q=pq.top(); pq.pop();
			P r=pq.top(); pq.pop();
			int ma=max(p.se,max(q.se,r.se)),mi=min(p.se,min(q.se,r.se));
			if(p.se!=ma&&p.se!=mi) {
				pq.push(P(1,p.se));
			}
			else if(q.se!=ma&&q.se!=mi) {
				pq.push(P(1,q.se));
			}
			else pq.push(P(1,r.se));
		}
	}
	cout<<pq.size()<<endl;

	return 0;
}


Measured memory_bytes: 1784
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    long n = scan.nextLong();
    if (n%2 == 1){
      System.out.println(0);
      return;
    }
    long target = fast(n);
    long r = 5;
    long sum = 0;
    n = (long) n/2;
    while (r <= target){
      sum += (long) n/r;
      r*=5;
    }
    System.out.println(sum);
  }

  static long fast(long n){
    long ret = 1;
    while (ret <= n){
      ret *= 5;
    }
    return (long) ret/5;
  }

}


Measured memory_bytes: 35356
#include <iostream>
#include <map>
#include <set>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;
using ll = long long;
using ld = long double;

int main() {
    int N;
    set<string> S;

    cin >> N;
    char lastC = '0';
    bool flag = true;
    for (int i = 0; i < N; ++i) {
        string s;
        cin >> s;
        char c = s[0];
        if(lastC != c && lastC != '0'){
            flag =false;
        }
        lastC = s[s.length()-1];

        if(S.find(s) == S.end()) {
            S.insert(s);
        } else{
            flag = false;
       }

    }

    if(flag){
    cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }


    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder.Abc
{
    //https://atcoder.jp/contests/abc141/tasks/abc141_a
    public class QuestionA
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

			string[] str = Console.ReadLine().Split(' ');

			int time = int.Parse(str[0]) + int.Parse(str[1]);

			if (time >= 24) {
				time -= 24;
			}

            Console.WriteLine(time.ToString());

            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 11092
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

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



		for (int i = 0; i < n; i++) {

			p[i] = sc.nextInt();
			a[i] = i + 1;
			b[i] = n - i;

		}




		for (int i = 0; i < n; i++){
			for (int j = 0; j < n; j++){

				if (j > p[i] - 1) {
					a[j] = a[j]  + (n - i);


				}


				if (j < p[i] - 1) {

					b[j] = b[j] + (n - i);
				}



			}
		}

	for (int i = 0; i < n; i++) {
		if (i != 0) System.out.print(" ");
		System.out.print(a[i]);


	}

	System.out.println("");
	for (int i = 0; i < n; i++) {
		if (i != 0) System.out.print(" ");
		System.out.print(b[i]);

	}
	System.out.println("");

		sc.close();
	}


}


Measured memory_bytes: 30944
fn main() {
    let (r, w) = (std::io::stdin(), std::io::stdout());
    let mut sc = IO::new(r.lock(), w.lock());
    let even: usize = sc.read();
    let odd: usize = sc.read();

    let ans = if odd > 0 { odd * (odd - 1) / 2 } else { 0 }
        + if even > 0 { even * (even - 1) / 2 } else { 0 };
    println!("{}", ans);
}

pub struct IO<R, W: std::io::Write>(R, std::io::BufWriter<W>);

impl<R: std::io::Read, W: std::io::Write> IO<R, W> {
    pub fn new(r: R, w: W) -> IO<R, W> {
        IO(r, std::io::BufWriter::new(w))
    }
    pub fn write<S: ToString>(&mut self, s: S) {
        use std::io::Write;
        self.1.write(s.to_string().as_bytes()).unwrap();
    }
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .0
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r' || b == b'\t')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r' && b != b'\t')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 4352
import java.io.IOException;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {

		Scanner sc = new Scanner(System.in);

		int a = sc.nextInt();
		int b = sc.nextInt();

		if (a + b < 10) {

			System.out.print(a + b);
			System.out.print(" ");
		} else

		{
			System.out.print("error");
			System.out.print(" ");
		}

	}

}

Measured memory_bytes: 21972
#include <bits/stdc++.h>
#define eps 1e-9

using namespace std;
typedef double db;
struct P{
    db x, y;
    P(){}
    P(db x, db y) : x(x) , y(y) {}
    P operator - (P a){ return P(x-a.x, y-a.y); }
    db times(P a){ return x*a.y-y*a.x; }
    db dot(P a){ return a.x*x + a.y*y; }
    db len(){ return sqrt(x*x+y*y); }
};
typedef P V;
int sign(db x){ return x<-eps ? -1 : x>eps; }

void cc(V v1, V v2){ //判断v2在v1的哪个方向
    db s = sign( v1.times(v2) );  //利用叉积判顺逆时针
    if(s < 0) printf("CLOCKWISE\n");
    else if(s > 0) printf("COUNTER_CLOCKWISE\n");
    else{
        db d = sign( v1.dot(v2) );  //坑待填：这里是否需要eps？
        if(d<0) printf("ONLINE_BACK\n");
        else{  //用点积判同向异向
            if(v1.len() >= v2.len()) printf("ON_SEGMENT\n");
            else printf("ONLINE_FRONT\n");
        }
    }
}

int main(){
    //freopen("owo.in","r",stdin);
    P p0, p1, p2;
    scanf("%lf%lf%lf%lf", &p0.x, &p0.y, &p1.x, &p1.y);
    V v1 = p1-p0;
    int n;
    cin >> n;
    while(n--){
        scanf("%lf%lf", &p2.x, &p2.y);
        V v2 = p2-p0;
        cc(v1, v2);
    }
    return 0;
}


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

#define MAX(a,b) (a > b ? a : b)
#define MIN(a,b) (a < b ? a : b)
const int inf = 1000000000; // 10^9

int main(){
   int x;scanf("%d",&x);
   int max=0;
   for(int i = 1;i <= x;i++){
      for(int j = 2;j <= 1000;j++){
         if(pow(i,j)<=x&&max<pow(i,j)){
            max=(int)pow(i,j);
         }
      }
   }
   printf("%d",(int)max);
}


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

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

  vector<int> A(N);
  for (int i = 0; i < N; i++) cin >> A.at(i);

  int res = 0;
  while (true) {
    if (*max_element(A.begin(), A.end()) == 0) break;

    int i = 0;
    while (i < N) {
      if (A.at(i) == 0)
        i++;
      else {
        res++;
        while (i < N && A.at(i) > 0) {
          A.at(i)--;
          i++;
        }
      }
    }
  }

  cout << res << endl;
}

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

using namespace std;

int n, ans = 0;

void solve(long long now, int a, int b, int c) {
	if (now > n) return;
	if (a > 0 && b > 0 && c > 0) ans++;
	solve(now * 10 + 3, a + 1, b, c);
	solve(now * 10 + 5, a, b + 1, c);
	solve(now * 10 + 7, a, b, c + 1);
}

int main() {
	cin >> n;
	solve(3, 1, 0, 0);
	solve(5, 0, 1, 0);
	solve(7, 0, 0, 1);

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
s=input()
n=list(map(int,input().split()))

count=0
for i in range(1,len(n)-1):
  if (n[i-1]<n[i] and n[i]<n[i+1]) or (n[i-1]>n[i] and n[i]>n[i+1]):
    count+=1
print(count)


Measured memory_bytes: 3316
//#include <bits/stdc++.h>
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <climits>
#include <iomanip>
#include <stack>
#include <bitset>

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define ROF(i, j, k) for(int i = (int)(j); i >= (int)(k); --i)
#define FORLL(i, n, m) for(long long i = n; i < (long long)(m); i++)
#define SORT(v, n) sort(v, v+n)
#define REVERSE(v) reverse((v).begin(), (v).end())

using namespace std;
using ll = long long;
const ll MOD=1000000007LL;
typedef pair<int, int> P;

ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }

template<class T> bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T> bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}return 0;}

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

  int n;
  cin >> n;
  vector<int> p(n), ans(n);
  REP(i,n) {
    cin >> p[i];
    ans[i] = p[i];
  }

  sort(ans.begin(), ans.end());
  int cnt = 0;
  REP(i,n) {
    if(p[i] != ans[i]) {
      cnt++;
    }
  }

  if(cnt > 2) cout << "NO" << endl;
  else cout << "YES" << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
using namespace std;
int main(){
  float t,a,h,b;
  int n,ans=1;
  scanf("%d",&n);
  scanf("%f %f",&t,&a);
  scanf("%f",&h);
  b=t-0.006*h;
  for(int i=2;i<=n;i++){
    scanf("%f",&h);
    if(fabs(a-b)>fabs(a-(t-0.006*h))){
      ans=i;
      b=t-0.006*h;
    }
  }
  printf("%d\n",ans);
}

Measured memory_bytes: 128
# coding=utf-8
import math

line = input().split(" ")
n = int(line[0])
m = int(line[1])

def perm(x):
    return math.factorial(x)

p = 10**9 + 7

f = 1
if n==m:
    f = 2

if abs(n-m)>1:
    print(0)
else:
    print(f*perm(n)*perm(m)%p)


Measured memory_bytes: 5100
#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 push_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
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef multiset<ll> S;
typedef priority_queue<ll> PQ;
typedef priority_queue<P,vector<P>,greater<P>> SPQ;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;
const ll inf=1001001001001001;
const int INF=1001001001;
const int mod=1000000007;
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())outp(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()){rep(j,v[i].size()){if(j)cout<<' ';cout<<v[i][j];}cout<<'\n';}}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll modpow(ll a,ll b){a%=mod;if(b==0)return 1;if(b&1)return a*modpow(a,b-1)%mod;ll k=modpow(a,b/2);return k*k%mod;}
int main(){
    string s;cin>>s;
    ll k;cin>>k;
    ll n=s.size();
    vvi dp1(n,vi(k+1)),dp2(n,vi(k+1));
    dp1[0][0]=1;
    dp1[0][1]=s[0]-'0'-1;
    dp2[0][1]=1;
    rep(i,n-1){
        rep(j,k+1){
            rep(ne,10){
                int nj=j;
                if(ne!=0)nj++;
                if(nj>k)break;
                dp1[i+1][nj]+=dp1[i][j];
                if(ne<s[i+1]-'0')dp1[i+1][nj]+=dp2[i][j];
                if(ne==s[i+1]-'0')dp2[i+1][nj]+=dp2[i][j];
            }
        }
    }
    out(dp1[n-1][k]+dp2[n-1][k]);
}

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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
//const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

ll p;
typedef vector<ll> poly;

ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

poly mul(const poly& x, ll k){
	poly res(p+1, 0);
	REP(i, p+1){
		if(i == 0) continue;
		res[i] = (x[i-1]-k*x[i]);
		res[i] %= p;
		res[i] += p;
		res[i] %= p;
	}
	res[0] = -k*x[0];
	res[0] %= p;
	res[0] += p;
	res[0] %= p;
	return res;
}

poly div(const poly& x, ll k){
	poly res(p+1, 0);
	for(int i=p-1;i>=0;i--){
		res[i] = (x[i+1] + k*res[i+1])%p;
	}
	return res;
}

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

    
    cin >> p;
    vector<ll> a(p);
    REP(i, p) cin >> a[i];

    poly total(p+1, 0);
    total[0] = 1;
    REP(i, p){
    	total = mul(total, i);
    }
    //cout << total << endl;

    poly res(p+1, 0);
    REP(i, p){
    	auto tmp = div(total, i);
    	ll bai = a[i];
    	REP(j, p){
    		if(j==i) continue;
    		bai *= ((i-j)%p+p)%p;
    		bai %= p;
    	}
    	REP(j, p+1) res[j] += (tmp[j] * bai)%p, res[j] %= p;
    }

    REP(i, p) cout << res[i] << " ";
    cout << endl;
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  bool flag = false;
  int ans = 0;
  for(int i=1; i<100000; i++){
    int x = i*1.08;
    if(x == N){
      ans = i;
      flag = true;
      break;
    }
  }
  
  if(flag){
    cout << ans << endl;
  }
  else{
    cout << ":(" << endl;
  }
}

Measured memory_bytes: 256
from bisect import bisect_left
N, M = map(int, input().split())
S = input()
mass = []
for i, c in enumerate(S):
    if c == '0':
        mass.append(i)

dp = [None] * (N+1)
dp[0] = (0, 0)
for i in range(1, N+1):
    if S[i] == '0':
        x = bisect_left(mass, i - M)
        idx = mass[x]
        if idx >= i:
            print(-1)
            exit()
        dp[i] = (dp[idx][0]+1, i - idx)

now = N
ans = []
while now > 0:
    ans.append(dp[now][1])
    now -= dp[now][1]
print(' '.join(map(str, reversed(ans))))

Measured memory_bytes: 24700
import sys
li  =   lambda : [int(x) for x in sys.stdin.readline().strip().split()]
rw  =   lambda : sys.stdin.readline().strip().split()
ni  =   lambda : int(sys.stdin.readline().strip())
nsi =   lambda : sys.stdin.readline().strip()

from collections import defaultdict as df
from math import *

n=nsi()
count=0
o=0
if(n[0]=='R' and n[1]=='S'):
    print(1)
    o=1
if(n[0]=='R' and n[1]=='R' and n[2]=='S'):
    print(2)
    o=1
if(n[0]=='S'and n[1]=='R' and n[2]=='R'):
    print(2)
    o=1
if(n[0]=='R' and n[1]=='R' and n[2]=='R'):
    print(3)
    o=1

for i in n:
    if(i=='R'):
        count+=1

if(count==0):
    print(0)
if(count==1 and o==0):
    print(1)



Measured memory_bytes: 9268
#include <iostream>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <queue>
#include <stack>
#include <list>
#include <utility>
#include <vector>
#include <set>
#include <algorithm>
#include <cmath>

const int MOD = pow(10,9)+7;
typedef long long ll;

using namespace std;
int in(){
    int temp;
    scanf("%d",&temp);
    return temp;
}

ll lin(){
    ll temp;
    scanf("%lld",&temp);
    return temp;
}



int main() {
  
    ll x = lin();
    
    ll  ans = (x/11)*2;

    ans += (x%11 + 5)/6;
    
    cout << ans << endl;
    
    return 0;
    
}





Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int N;
    cin >> N;
    string ans = "No";
    for(int i = 1; i < 10; i++){
        for(int j = 1; j < 10; j++){
            if(N == i * j) ans = "Yes";
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define all(V) V.begin(),V.end()
using ll = long long;

int dp[44][411][411];

void chmin(int&a, int b, int c) {
	b = min(b, c);
	a = min(a, b);
}

int main(){
	int N, Ma, Mb, a, b, c;
	cin >> N >> Ma >> Mb;
	for (int i = 0;i < 44;i++) {
		for (int j = 0;j < 411;j++) {
			for (int k = 0;k < 411;k++) {
				dp[i][j][k] = INT32_MAX / 4;
			}
		}
		dp[i][0][0] = 0;
	}
	for (int i = 1;i <= N;i++) {
		cin >> a >> b >> c;
		for (int j = 0;j < 401;j++) {
			for (int k = 0;k < 401;k++) {
				chmin(dp[i][j + a][k + b], dp[i - 1][j][k] + c, dp[i - 1][j + a][k + b]);
				chmin(dp[i][j][k], dp[i - 1][j][k], INT32_MAX);
			}
		}
	}
	int ans = INT32_MAX / 4;
	a = Ma, b = Mb;
	while (a < 401 && b < 401) {
		chmin(ans, dp[N][a][b], INT32_MAX);
		a += Ma;b += Mb;
	}
	if (ans == INT32_MAX / 4)ans = -1;
	cout << ans << endl;
}

Measured memory_bytes: 29312
/* 
 * ALDS1_11.cpp
 * ??£??\???????????¨?????§???????????????????????°??????G?????£??\????????¨?????????????????????????????????
 */
#include <iostream>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <cstring>

using namespace std;

using Adjacents = vector<int>;
using Vertexes = vector<Adjacents>;

int main(void) {

    int N;
    scanf("%d", &N);

    Vertexes vs;
    vs.resize(N);
    for (int i = 0, id, num; i < N; ++i) {
        scanf("%d %d", &id, &num);
        for (int j = 0, vert; j < num; ++j) {
            scanf("%d", &vert);
            vs[id-1].push_back(vert);
        }
    }

    int **matrix = new int*[N];
    for (int i = 0; i < N; ++i) {
        matrix[i] = new int[N];
        memset(matrix[i], 0, sizeof(int)*N);
        for (int j = 0; j < vs[i].size(); ++j) {
            matrix[i][vs[i][j] - 1] = 1;
        }
    }

    for (int i = 0; i < N; ++i) {
        for (int j = 0; j < N; ++j) {
            //printf("%2d", matrix[i][j]);
            putchar(matrix[i][j] + '0');
            if (j != N - 1)
                putchar(' ');
        }
        delete[] matrix[i];
        printf("\n");
    }
    delete[] matrix;

    return 0;
}

Measured memory_bytes: 3240
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
ll ans = 0;

int main()
{
ll n ;
cin >> n ;
vector<ll> a(n);
rep(i, n){
  cin >> a[i];
}
rep(i,n-1){
  if(a[i]==a[i+1]){ans++;a[i+1]=-1;}
}

cout << ans << endl;
return 0;
}


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

N = int(input())
dp = [[0]*3 for i in range(N+1)]
arr = [list(map(int, input().split())) for i in range(N)]

# dp roop
for i in range(N):
  for j in range(3):
    for k in range(3):
      if j==k:
        continue
      dp[i+1][k] = max(dp[i+1][k], dp[i][j] + arr[i][k])
print(max(dp[N]))

Measured memory_bytes: 50332
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
using namespace std;
typedef long long ll;

int main(){
    int N;
    cin >> N;
    int a[N];
    for(int i = 0; i < N; i++) cin >> a[i];

    int num = 1;
    int ans = 0;

    for(int i = 0; i < N; i++){
        if(a[i] == num){
            num++;
        } else {
            ans++;
        }
    }

    if(ans == N) ans = -1;
    cout << ans << endl;
    return 0;

}

Measured memory_bytes: 1024
#define _USE_NATH_DEFINES
#include<cstdio>
#include <iostream>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<complex>
#include <string>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<numeric>
#include<limits>
#include<climits>
#include<cfloat>
#include<functional>
#include<iterator>
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
using namespace std;

#define INF 100000000

long sum = 0;

long calculate(string number, int mask) {
	vector<long> numbers;
	int bit_flag;
	string buff;
	for (int i = 0; i < number.length(); ++i) {
		buff.push_back(number[i]);
		if (i == (number.length() - 1)) {
			continue;
		}
		bit_flag = (1 << i);
		if ((mask & bit_flag) != 0) {
			numbers.push_back(stol(buff));
			buff = "";
		}
	}
	numbers.push_back(stol(buff));
	return accumulate(numbers.begin(), numbers.end(), 0L);
}

int main() {
	string number;
	cin >> number;
	for (int i = 0; i < (1 << (number.length() - 1)); ++i) {
		sum += calculate(number, i);
		
	}
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize(2)
#include <bits/stdc++.h>
#include<stdio.h>
#include <string.h>
#include<algorithm>
#include <queue>
typedef long long ll;
const int mod=998244353;
const int maxn=1e6+5;
const ll INF=100000000000000005;
const double eps=1e-11;
using namespace std;
ll n,m,p;
struct node{
    int w,v;
    bool friend operator<(node a,node b)
    {
        return a.w<b.w;
    }
}save[3005];
ll dp[3005][6005];
int main()
{
    scanf("%lld%lld",&n,&m);
    for(int i=1;i<=n;i++)
        scanf("%lld%lld",&save[i].w,&save[i].v);
    sort(save+1,save+1+n);
    for(int i=1;i<=n;i++)
    {
        for(int k=0;k<save[i].w+m;k++)
        {
            if(k>=save[i].w) dp[i][k]=max(dp[i-1][k],dp[i-1][k-save[i].w]+save[i].v);
            else dp[i][k]=dp[i-1][k];
        }
    }
    ll res=0;
    for(int i=1;i<=n;i++) res=max(dp[n][m+save[i].w-1],res);
    printf("%lld\n",res);
    return 0;
}

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

using namespace std;

const int MAXN = 1E5 + 10;

int f[MAXN], g[MAXN];

void build(int a[]){
	static char s[MAXN];
	scanf("%s", s);
	int n = strlen(s);
	for (int i = 0; i < n; ++i)
		a[i + 1] = s[i] == 'A' ? 1 : 2;
	partial_sum(a, a + n + 1, a);
}

int main(){
	build(f);
	build(g);

	int m;
	scanf("%d", &m);
	while (m--){
		int a, b, c, d;
		scanf("%d%d%d%d", &a, &b, &c, &d);
		puts((f[b] - f[a - 1] - g[d] + g[c - 1]) % 3 == 0 ? "YES" : "NO");
	}
	return 0;
}


Measured memory_bytes: 1408
N = int(input())
A = sorted(list(map(int, input().split())), reverse=True)

tmp1 = 0
tmp2 = 0
flg = True

for i in range(N-1):
    if A[i] == A[i+1] and tmp1 == 0 and flg:
        tmp1 = A[i]
        flg = False
    elif A[i] == A[i+1] and tmp2 == 0 and flg:
        tmp2 = A[i]
        break
    else:
        flg = True

print(tmp1 * tmp2)

Measured memory_bytes: 14224
# 090
def getIntList(): return [int(x) for x in input().split()]
def db(x): 
    global debug
    if debug: print(x)
debug = False
def getDigitList(n):
    list = []
    while n>0:
        list.append(n%10)
        n //= 10
    return list

A,B = getIntList()
db((A,B))
cnt = 0
for i in range(A,B+1):
    x = getDigitList(i)
    #db(x)
    for j in range(len(x)//2):
        #db((j,x[j],x[-j-1]))
        if x[j]!=x[-j-1]: break
    else: cnt+=1
print(cnt)

Measured memory_bytes: 3064