akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>

using namespace std;

#define LL long long
#define FAST() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

int main()
{
    FAST();
    LL x;
    long double y;
    cin >> x >> y;
    cout << (LL)(x*y);
    return 0;
}


Measured memory_bytes: 3724
def solve(A, N):
    ret = 0
    while max(A) > N-1:
        for i in range(N):
            if A[i] > N-1:
                t = A[i]//N
                for j in range(N):
                    if j == i:
                        A[j] -= t*N
                        continue
                    A[j] += t
                ret += t
    return ret
N = int( input())
A = list( map( int, input().split()))
ans = 0
for i in range(N):
    if A[i] > N-1:
        t = A[i]//N
        for j in range(N):
            if j == i:
                A[j] -= t*N
                continue
            A[j] += t
        ans += t
for i in range(N):
    if A[i] > N+1:
        t = A[i]//(N+1)
        if A[i] - t*(N+1) <= N-1:
            t -= 1
        A[i] -= t*(N+1)
        ans += t*(N+1)
print( ans + solve(A,N))


Measured memory_bytes: 40688
require 'prime'
require 'set'
require 'tsort'
include Math
def max(a,b);              a > b ? a : b                              end
def min(a,b);              a < b ?  a : b                             end
def swap(a,b);             a, b = b, a                                end
def gif;                   gets.to_i                                  end
def gff;                   gets.to_f                                  end
def gsf;                   gets.chomp                                 end
def gi;                    gets.split.map(&:to_i)                     end
def gf;                    gets.split.map(&:to_f)                     end
def gs;                    gets.chomp.split.map(&:to_s)               end
def gc;                    gets.chomp.split('')                       end
def pr(num);               num.prime_division                         end
def digit(num);            num.to_s.length                            end
def array(s,ini=nil);      Array.new(s){ini}                          end
def darray(s1,s2,ini=nil); Array.new(s1){Array.new(s2){ini}}          end
def rep(num);              num.times{|i|yield(i)}                     end
def repl(st,en,n=1);       st.step(en,n){|i|yield(i)}                 end

n = gif
m = array 10**5+2,0
rep n do
  l,r = gi
  m[l-1] += 1
  m[r] -= 1
end

repl 1, 10**5+1 do |i|
  m[i] += m[i-1]
end
max = 0
repl 0,10**5+1 do |i|
max = i if m[i] >= i && max < m[i]
end

puts max

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

long long r, d, s;

int main(){		
	scanf("%lld%lld%lld", &r, &d, &s);
	for(int i = 0; i < 10; i++) s = r * s - d, printf("%lld\n", s); 
	return 0;
}


Measured memory_bytes: 256
import std.stdio,std.conv, std.algorithm, std.container,std.array,std.range,std.string,std.typecons;
const dx = [1,0,-1,0];
const dy = [0,1,0,-1];
void read(T...)(auto ref T args){ 
	auto line = readln().split(); 
	foreach(i,ref arg; args) arg = line[i].to!(typeof(arg));
}
int sum(int n){return n * (n + 1)/ 2;}

void main(){
	int x,y,s;
	while(read(x,y,s),x|y|s){
		int ans ;
		auto taxed= iota(s).map!(i => tax(x,i)).assumeSorted;
		foreach(i;1..s){			
			foreach(j;i..s){
				if (taxed[i] + taxed[j] == s ){
					ans = max(ans,tax(y,i) + tax(y,j));break;
				}
			}
		}
		ans.writeln;
	}
}
int tax(int per,int yen) {return yen * (100 +per) / 100;}

Measured memory_bytes: 2432
#include <iostream>
#include <cmath>
using namespace std;
typedef long long ll;

const int MOD = 2019;

ll modint(ll n, ll m, ll& d) {
  d = n / m;
  return n % m;
}

int main(void) {

  ll L, R, l, r, id, jd;
  cin >> L >> R;

  l = modint(L, MOD, id);
  r = modint(R, MOD, jd);
  if (id != jd) {
    cout << 0 << endl;
  } else {
    ll min = MOD-1;
    for (ll i=l; i<r; i++) {
      for (ll j=i+1; j<=r; j++) {
        ll res = modint(i*j, MOD, id);
        if (min > res) {
          min = res;
        }
      }
    }
    cout << min << endl;
  }


  return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
///////////////////////////////////////////
const long long int INF = 1LL<<60;
const long long int Mod = 1000000007;
using ll = long long int; using ci = const int;
using vi = vector<int>;  using Vi = vector<long long int>;
using P = pair<int, int>;  using PLL = pair<ll, ll>;
using matrix = vector<vector<ll>>;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define rep(i,N) for(ll i = 0; i < (ll)N; i++)
#define repi(i,a,b) for(ll i = ll(a); i < ll(b); ++i)
template<class T>bool chmax(T &former, const T &b) { if (former<b) { former=b; return true; } return false; }
template<class T>bool chmin(T &former, const T &b) { if (b<former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
template<class T> inline void princ(T x){cout<<x<<" ";}; 
template<class T> inline void print(T x){cout<<x<<"\n";};
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
///////////////////////////////////////////////////////////////////////////////////

ll n;
Vi a;
vi p;


int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    std::cout<<std::fixed<<std::setprecision(30);
    cin>>n; a.resize(n);
    rep(i,n)cin>>a[i];
    ll ans = 1;
    ll ct = 0,tp;
    bool flg = true;
    rep(i,n){
        ct = 0;
        rep(j,p.size()){
            if(p[j]+1 == a[i]){
                tp = j;
                ct++;
            }
        }
        if(ct!=0){
            p[tp] = a[i];
            ans *= ct;
            ans %= Mod;
        }else{
            p.pb(a[i]);
            if(p.size()>=4  || a[i]!=0){
                flg = false;
                break;
            }
        }

    }
    if(p.size()==1 && flg){
        ans *= 3;
    }else if(p.size()<=3 && flg){
        ans *= 6;
    }else{
        ans = 0;
    }
    ans %= Mod;
    print(ans);
    //print(p.size());
    return 0;
}

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

using namespace std;

#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(a)  (a).begin(),(a).end()
using ll = long long;
using Pair = pair<int, int>;
const ll mod = 1e9 + 7;


template<class T>
T gcd(T a, T b)
{
  if(a && b) {
    return gcd(min(a, b), max(a, b) % min(a, b));
  } else {
    return a;
  }
}

template<class T>
T lcm(T a, T b)
{
  return a / gcd(a, b) * b;
}

ll power(ll base, ll exponent, ll module)
{
  if(exponent % 2) {
    return power(base, exponent - 1, module) * base % module;
  } else if(exponent) {
    ll root_ans = power(base, exponent / 2, module);
    return root_ans * root_ans % module;
  } else {
    return 1;
  }
}

struct combination
{
  vector<ll> fact, inv;
  combination(int sz) : fact(sz + 1), inv(sz + 1)
  {
    fact[0] = 1;
    for(int i = 1; i <= sz; i++) {
      fact[i] = fact[i - 1] * i % mod;
    }
    inv[sz] = power(fact[sz], mod - 2, mod);
    for(int i = sz - 1; i >= 0; i--) {
      inv[i] = inv[i + 1] * (i + 1) % mod;
    }
  }
  ll Pair(int n, int r)
  {
    if(r < 0 || n < r) return 0;
    return (fact[n] * inv[n - r] % mod);
  }
  ll C(int p, int q)
  {
    if(q < 0 || p < q) return 0;
    return (fact[p] * inv[q] % mod * inv[p - q] % mod);
  }
};

template<typename T>
void print_vec(vector<T>& v)
{
  for(const auto& e: v) {
    cout << e << " ";
  }
  cout << endl;
}
template<typename T>
void print_2dvec(vector<vector<T>>& m)
{
  for(const auto& v: m) {
    for(const auto& e: v) {
      cout << e << " ";
    }
    cout << endl;
  }
}


int main(int argc, char const* argv[])
{
  ll n, k;

  cin >> n >> k;

  vector<ll> hs;
  for (ll i = 0; i < n; i++) {
    ll h;
    cin >> h;
    hs.push_back(h);
  }
  sort(ALL(hs), greater<ll>());

  if (k >= hs.size()) cout << 0 << endl;
  else {
    ll ans = 0;
    for (ll i = k; i < hs.size(); i++) {
      ans += hs.at(i);
    }

    cout << ans << endl;
  }

  return 0;
}


Measured memory_bytes: 2420
A, B, M = map(int, input().split())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
price_off = [dict(zip(["x", "y", "c"], map(int, input().split()))) for _ in range(M)]
result = [min(a) + min(b)]
result += [a[d["x"]-1] + b[d["y"]-1] - d["c"] for d in price_off]
print(min(result))

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

#define pb push_back
#define fst first
#define snd second
#define INF 0x7fffffff
#define INFLL 0x7FFFFFFFFFFFFFFF
#define lenA(ar) sizeof(ar)/sizeof(*ar)
#define fill(a,c) memset(&a, c, sizeof(a))
#define fore(i,x,y) for(ll i=x;i<y;i++)
#define foreI(i,x,y) for(ll i=x-1;i>=y;i--)
#define max3(a,b,c) max(max(a,b),c)
#define min3(a,b,c) min(min(a,b),c)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define FIN ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

typedef long long ll;
typedef unsigned long long ull;

using namespace std;
int n;
const int MAXN= 105;
ll dp[MAXN][100005];
ll val[MAXN];
ll we[MAXN];
ll solve(int pos,int w){
    if(pos==n-1){
        if(we[pos]<=w)
            return val[n-1];
    }

    if(pos>=n)return 0;
    ll &r = dp[pos][w];
    if(r)return r;
    ll a = 0; ll b=0;
    if(we[pos]<=w)
         a =solve(pos+1,w-we[pos])+val[pos];
    b = solve(pos+1,w);
    r = max(a,b);
   /*  cout<<pos<<" "<<w<<"::"<<"\n";
    cout<<"a: "<<a<<" b: "<<b<<"\n"<<"\n";*/
    return r;
}
int main() {FIN;
   
    cin>>n;
    ll weight;cin>>weight;
    fill(dp,0);
    fore(i,0,n){
       cin>>we[i]; cin>>val[i];
    }
    cout<<solve(0,weight)<<"\n";
    return 0;
}





Measured memory_bytes: 82304
import numpy as np
n, k = map(int, input().split())
sunuke = np.zeros(n, dtype=int)

for i in range(k):
    d = input()
    l = np.array(list(map(int, input().split())))
    for j in l:
        sunuke[j-1] += 1

print(sunuke.shape[0] - np.count_nonzero(sunuke))

Measured memory_bytes: 27152
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;


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

    int a, b;
    cin >> a >> b;
    if (a == 1) {
        a = 14;
    }
    if (b == 1) {
        b = 14;
    }

    if (a > b)  {
        cout << "Alice\n";
    } else if (a == b) {
        cout << "Draw\n";
    } else {
        cout << "Bob\n";
    }


    return 0;
}

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


#define M_MAX 20
#define N_MAX 50000
#define INFTY 1 << 29

int main(){
string s;
cin >> s;
int f1=0;
int f2=0;
string mae="  ";
string usi="  ";
mae[0]=s[0];
mae[1]=s[1];
usi[0]=s[2];
usi[1]=s[3];

if(stoi(mae)<=12 && stoi(mae)>=1){
f1=1;
}
if(stoi(usi)<=12 && stoi(usi)>=1){
f2=1;
}
if(f1+f2==2){
cout << "AMBIGUOUS" <<"\n";
}else if(f1==0 && f2==1){
cout << "YYMM" <<"\n";
}else if(f1==1 && f2==0){
cout << "MMYY" <<"\n";
}else{
cout << "NA" <<"\n";
}

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
bool vis[105][105];
char s[105][105];
int main(){
	int n, m;
	scanf("%d%d", &n, &m);
	for(int i=1;i<=n;i++){
		scanf("%s", s[i]+1);
	}

	for(int i=1;i<=n;i++){
		bool ok = 1;
		for(int j=1;j<=m;j++){
			if(s[i][j] == '#') ok = 0;
		}
		if(!ok) continue;
		for(int j=1;j<=m;j++){
			vis[i][j] = 1;
		}
	}

	for(int i=1;i<=m;i++){
		bool ok = 1;
		for(int j=1;j<=n;j++){
			if(s[j][i] == '#') ok = 0;
		}
		if(!ok) continue;
		for(int j=1;j<=n;j++){
			vis[j][i] = 1;
		}
	}

	for(int i=1;i<=n;i++){
		bool ok = 0;
		for(int j=1;j<=m;j++){
			if(!vis[i][j]) printf("%c", s[i][j]), ok = 1;
		}
		if(ok) printf("\n");
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fo(i,a,b) for(int i=(a);i<=(b);++i)
#define fd(i,a,b) for(int i=(a);i>=(b);--i)
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define LL long long
#define ii pair<int,int>
#define st first
#define nd second
#define TASK "D - Knapsack 1"
using namespace std;
///---------------------------------------------------
LL n, M, F[105][100005], m[105], v[105], oo, res = -1e9;
///---------------------------------------------------
void nhap(){
    cin>>n>>M;
    fo(i,1,n) cin>>m[i]>>v[i];
}
///---------------------------------------------------
void solve(){
    memset(F,-0x3f,sizeof(F));
    F[0][0] = 0;
    fo(i,1,n) fo(j,0,M){
        F[i][j] = F[i-1][j];
        if (j>=m[i]) F[i][j] = max(F[i][j], F[i-1][j-m[i]] + v[i]);
    }
    fo(i,0,M) res = max(res,F[n][i]);
    cout<<res;
}
///---------------------------------------------------
int main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    nhap();
    solve();
}


Measured memory_bytes: 82304
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll MOD = 1e9 + 7/*998244353*/;
const ll INF = 1LL << 60;
ll mod_pow(ll, ll, ll); ll mod_fact(ll, ll); ll mod_inv(ll, ll); ll gcd(ll, ll); ll lcm(ll, ll);
//
void fun(vector<ll>& vec, int a){
    for(int i = 1; i <= sqrt(a); i++){
        if(a % i == 0) {vec.push_back(i); vec.push_back(a / i);}
    }
}
int main(){
    int n;
    cin >> n;
    set<ll> nums;
    vector<ll> in(n);
    vector<bool> flag(1e6 + 1, false);
    vector<vector<ll>> divisor(n, vector<ll>());
    for(int i = 0; i < n; i++){
        int x; cin >> x;
        in[i] = x;
        if(flag[x]) nums.insert(x);
        flag[x] = true;
        fun(divisor[i], x);
    }
    ll ans = 0;
    for(int i = 0; i < n; i++){
        if(nums.count(in[i])) continue;
        bool bl = true;
        for(auto itr : divisor[i]){
            if(in[i] == itr) continue;
            if(flag[itr]) bl = false;
        }
        if(bl) ans++;
    }
    cout << ans;
}

Measured memory_bytes: 112728
N = int(input())

ans = 0

for i in range(N+1):
    if i % 15 == 0:
        ans += 0
    elif i % 3 == 0:
        ans += 0
    elif i % 5 == 0:
        ans += 0
    else:
        ans += i
        
print(ans)

Measured memory_bytes: 9172
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <string>
#include <cstring>
#include <cstdlib>
using namespace std;

#define REP(i,n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef pair<int, int> pint;
template <class T> inline void chmax(T &a, const T b) { a = max(a, b); }
template <class T> inline void chmin(T &a, const T b) { a = min(a, b); }
template <class T> void pp(T v, int n) { REP(i,n) cout<<v[i]<< ' '; cout << endl; }

void inline TorF(bool tf, const string &trueMessage, const string &falseMessage) { 
  cout << (tf ? trueMessage : falseMessage) << endl;
}
void inline YESNO(bool tf) { TorF(tf, "YES", "NO"); }
void inline YesNo(bool tf) { TorF(tf, "Yes", "No"); }

const int SIZE = 128;
int H, W; 
int A[SIZE][SIZE], B[SIZE][SIZE];
int cand[128][128][SIZE*SIZE];

void dfs(const int hpos, const int wpos, const int v) {
  //  cout << hpos << wpos << v << endl;
  if(hpos < 0) return;
  if(wpos < 0) return;
  if(hpos >= H) return;
  if(wpos >= W) return;
  int d = abs(A[hpos][wpos] - B[hpos][wpos]);
  int nv = abs(v + d);
  if(cand[hpos][wpos][nv] == 0) {
    cand[hpos][wpos][nv] = 1;
    dfs(hpos+1, wpos, nv);
    dfs(hpos, wpos+1, nv);
  }
  nv = abs(v - d);
  if(cand[hpos][wpos][nv] == 0) {
    cand[hpos][wpos][nv] = 1;
    dfs(hpos+1, wpos, nv);
    dfs(hpos, wpos+1, nv);
  }

}

int main() {
  cin>>H>>W;
  REP(h,H) REP(w,W) cin>>A[h][w];
  REP(h,H) REP(w,W) cin>>B[h][w];
  dfs(0, 0, 0);
  REP(i,SIZE*SIZE) {
    if(cand[H-1][W-1][i]) {
      cout << i << endl;
      break;
    }
  }
  return 0;
}


Measured memory_bytes: 490240
#include "bits/stdc++.h"
using namespace std;
#define repr(i,a,b) for(long long i=(long long)(a);i<(long long)(b);i++)
#define rep(i,n) repr(i,0,n)
#define reprrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) reprrev(i,0,n)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define mp make_pair
#define mt make_tuple
#define MOD 1000000007
#define PI 3.1415926535
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<Pi> vPi;
typedef vector<Pll> vPll;
typedef vector<vector<int>> vvi;
typedef vector<vector<bool>> vvb;
typedef vector<vector<ll>> vvll;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
typedef vector<vector<double>> vvd;
typedef vector<vector<Pi>> vvPi;
typedef priority_queue<int, vector<int>, greater<int>> pqli;
typedef priority_queue<ll, vector<ll>, greater<ll>> pqlll;
typedef priority_queue<Pi, vector<Pi>, greater<Pi>> pqlP;
string YN(bool y) { return (y?"YES":"NO"); }
string yn(bool y) { return (y?"Yes":"No"); }
string ON(bool y) { return (y?"OK":"NG"); }
int main(void)
{
	ll n, k;

	double ans=0;

	cin>>n>>k;

	repr(i, 1, n+1){
		if(i<k){
			ans+=1.0/pow(2.0, ceil(log2((double)k/(double)i)));
		} else{
			ans+=1;
		}
	}
	cout<<setprecision(18)<<ans/(double)n<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#define REP(i,n) for(int i=0;i<(n);++i)
using namespace std;
typedef long long LL;
typedef vector<int> VI;

int main() {
  int N, K;
  cin >> N >> K;
  VI v;
  REP(i, N) {
    int H;
    cin >> H;
    v.push_back(H);
  }
  sort(v.begin(), v.end());
  LL ret = 0;
  REP(i, N-K) {
    ret += v[i];
  }
  cout << ret << endl;
}

Measured memory_bytes: 1528
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;

void main()
{
	foreach (line; stdin.byLine) {
		auto str = line.chomp;
		if (str == "#") break;
		char[][] pat;

		void solve(char c, char[] dec) {
			if (c == 'a') {
				pat ~= dec;
				return;
			}

			foreach (i, s; dec) {
				if (s == c) return;
				if (s == c-1) {
					auto temp = dec.dup;
					temp[i] = c;
					solve((c -1).to!char, temp);
				}
			}
			solve((c -1).to!char, dec);
		}

		solve('z', str);

		pat = pat.sort;
		pat.length.writeln;
		if (pat.length < 10) {
			foreach (e; pat) {
				e.writeln;
			}
		} else {
			foreach (e; pat[0..5]) {
				e.writeln;
			}
			foreach (e; pat[pat.length-5..pat.length]) {
				e.writeln;
			}
		}
	}
}

Measured memory_bytes: 5104
#include<bits/stdc++.h>
using namespace std;
#define ll long long
typedef pair<ll,ll> P;
#define M 1000000007
int main(){
  int n,m=0,c=0;
  cin>>n;
  vector<int> a(n);
  for(int i=0;i<n;i++){
    cin>>a[i];
    if(i!=0){
      if(a[i-1]>=a[i]){
        c++;
      }else{
        m=max(m,c);
        c=0;
      }
    }
  }
  cout<<max(m,c);
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define faster ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
#define ll long long int
#define FO(n) for (ll i = 0; i < n; i++)
#define endl "\n"
const long long int M = 10e9 + 7;
void solve()
{
    string n;
    ll sum = 0;
    cin >> n;
    for (auto it : n)
    {
        sum += (it - '0');
    }
    if (sum % 9 == 0)
    {
        cout << "Yes" << endl;
    }
    else
        cout << "No" << endl;
}

int main()
{
    faster;
    //int t;
    //cin >> t;
    //while (t--)
    solve();
    return 0;
}

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



int main(void){
    string s;
    cin >> s;
    bool check=0;
    rep(i,s.size()){
        if(s[i] == s[i+1]){
            check = 1;
        }
    }
    if(check==1){
        cout << "Bad";
    }
    else{
        cout << "Good";
    }
    
    return 0;
}

















Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.*;
//import java.lang.*;
import java.util.regex.*;
 class Main{
     public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        List<Integer> l=new ArrayList<>();
        int N=sc.nextInt();
        int K=sc.nextInt();
        for(int i=0;i<N;i++){
            l.add(sc.nextInt());
        }
        Collections.sort(l);
        int sum=0;
        for(int i=0;i<K;i++){
            sum+=l.get(i);
        }
        System.out.println(sum);
    }
}

Measured memory_bytes: 39060
#include <iostream>
#include <complex>
#include <vector>
#include <set>
#include <cstring>
using namespace std;

#define REP(i,n,m) for(int i=n;i<m;i++)
#define rep(i,n) REP(i,0,n)

typedef complex<double> P;

P p[3001];
char flg[5001][5001];

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

double area(vector<P> v){
	int n = v.size();
	double res = 0.0;
	rep(i,n) res += cross(v[i],v[(i+1)%n]);
	return fabs(res/2);
}

int main(void){
	int n;

	while(cin>>n,n){
		memset(flg,0,sizeof(flg));

		rep(i,n){
			int x,y;
			cin>>x>>y;
			p[i] = P(x,y);
			flg[x][y] = 1;
		}

		double ans = 0.0;

		//2_Çê©ðIÔ
		rep(i,n) REP(j,i+1,n) {
			P ab = p[i] - p[j];
			P un = (ab * P(0, +1)) / abs(ab); //abÌPÊ@üxNg
			P c = p[i] + un * abs(ab);
			P d = p[j] + un * abs(ab);

			if(c.real() - (int)c.real() != 0.0 ||
				 c.imag() - (int)c.imag() != 0.0 ||
				 d.real() - (int)d.real() != 0.0 ||
				 d.imag() - (int)d.imag() != 0.0 ||
				 c.real() < 0 || c.imag() < 0 ||
				 d.real() < 0 || d.imag() < 0 ||
				 c.real() > 5000 || c.imag() > 5000 ||
				 d.real() > 5000 || d.imag() > 5000) continue;

			if(flg[(int)c.real()][(int)c.imag()] && flg[(int)d.real()][(int)d.imag()]){
				vector<P> v;
				v.push_back(p[i]);
				v.push_back(p[j]);
				v.push_back(d);
				v.push_back(c);
				double cal = area(v);
				if(ans < cal) ans = cal;
			}
		}


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

	return 0;
}

Measured memory_bytes: 24000
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
 
int main() {
  int a, b, c;
  cin >> a >> b >> c;
  for(int i=1; i<=b; i++) {
    if(i*a%b==c) {
      cout << "YES" << endl;
      break;
    }
    if(i==b) {
      cout << "NO" << endl;
      break;
    }
  }
  return 0;
}

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

int main()
{
	int64_t n, k;
	cin >> n >> k;
	vector<int64_t> as(n), fs(n);
	for (auto &&a : as)
	{
		cin >> a;
	}
	for (auto &&f : fs)
	{
		cin >> f;
	}

	sort(as.begin(), as.end());
	sort(fs.begin(), fs.end());
	reverse(fs.begin(), fs.end());

	int64_t ok = (1LL << 60), ng = -1;

	while (1 < abs(ok - ng))
	{
		int64_t mid = (ok + ng) / 2;

		int64_t cnt = 0;
		for (int64_t i = 0; i < n; i++)
		{
			cnt += max(int64_t(0), as[i] - mid / fs[i]);
		}

		((cnt <= k) ? ok : ng) = mid;
	}

	cout << ok << endl;

	return 0;
}

Measured memory_bytes: 3328
def start():
    n, m = input().split()
    n = int(n)
    m = int(m)
    hs = list(map(int, input().split()))
    bs = [0 for i in range(n)]
    for i in range(m):
        a, b = input().split()
        a = int(a) - 1
        b = int(b) - 1
        if hs[a] > hs[b]:
            bs[b] = -1
        elif hs[a] < hs[b]:
            bs[a] = -1
        else:
            bs[a] = -1
            bs[b] = -1
    n = bs.count(0)
    print(n)


if __name__ == '__main__':
    start()


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

const int INF = 1e9-1, MAXN = 505;

int n, m, a, b;

int main()
{
	ios::sync_with_stdio(false);
	cin >> n >> m >> a >> b;
	if (n%a == 0 && m%b == 0) {
		cout << "No" << endl;
	} else {
		cout << "Yes" << endl;
		static int s[MAXN][MAXN];
		if (n%a != 0) {
			for (int i = 1; i <= n; i += a)
				for (int j = 1; j <= m; j++)
					s[i][j] = INF;
			for (int i = a; i <= n; i += a)
				for (int j = 1; j <= m; j++)
					s[i][j] = -INF-1;
		} else {
			for (int i = 1; i <= m; i += b)
				for (int j = 1; j <= n; j++)
					s[j][i] = INF;
			for (int i = b; i <= m; i += b)
				for (int j = 1; j <= n; j++)
					s[j][i] = -INF-1;
		}
		for (int i = 1; i <= n; i++) {
			for (int j = 1; j <= m; j++)
				cout << s[i][j] << " ";
			cout << endl;
		}
	}
	return 0;
}


Measured memory_bytes: 3968
#include <bits/stdc++.h>
#pragma GCC optimize ("O3")
#pragma GCC target ("avx2") 
#pragma GCC optimization ("unroll-loops")

using namespace std;
using ll = long long;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
#define ff first
#define ss second
#define Ceil(x, y) ((x+y-1)/y)
#define pb(x) push_back(x)
#define eb(x) emplace_back(x);
const int mod = (int) 1000000007;

void solve()
{
    string str1, str2;
    cin>>str1>>str2;
    int ans = str2.length();
    for(int i=0; i<str1.length()-str2.length()+1; i++)
    {
        int cnt = 0;
        for(int j=0; j<str2.length(); j++)
            cnt += (str1[i+j] != str2[j]);
        ans = min(ans, cnt);
    }
    cout<<ans;
}
 

int main(int argc, char *argv[])
{
    clock_t clk_start = clock();
    fast;
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
 
    int cases = 1;
    // cin>>cases;
    for(int i=1; i<=cases; i++)
    {
        // cout<<"Case #"<<i<<": ";
        solve();
    }
    cerr<<"Execution Time: "<<fixed<<double(clock() - clk_start)/double(CLOCKS_PER_SEC)<<setprecision(6)<<" sec\n"; 
}

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

using namespace std;

typedef long long llint;
const long long INF = 1e18;

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

llint dp[1010101][2];

int main() {
  string s;
  cin >> s;
  s = '0' + s;
  int n = s.size();
  for (int i = 0; i < 1010101; i++) {
    for (int j = 0; j < 2; j++) {
      dp[i][j] = INF;
    }
  }
  dp[0][0] = 0;
  for (int i = 0; i < n; i++) {
    int a = s[i] - '0';
    chmin(dp[i + 1][0], dp[i][0] + a);
    chmin(dp[i + 1][1], dp[i][0] + a + 1);
    chmin(dp[i + 1][0], dp[i][1] + 10 - a);
    chmin(dp[i + 1][1], dp[i][1] + 9 - a);
  }
  cout << dp[n][0] << endl;

  return 0;
}

Measured memory_bytes: 17072
S = int(input())

minabs = 10**10

nagasa = len(str(S))

for i in range(nagasa - 2):
    subnum = int(str(S)[i]) *100 + int(str(S)[i + 1]) * 10 + int(str(S)[i + 2])
    if abs(753 - subnum) < minabs:
        minabs = abs(753 - subnum)

print(minabs)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#pragma GCC optimize(3,"Ofast","inline")
using namespace std;
int n,dp[2003][2003],a[6003],ans,tg,MX[2003],cur;
int A[100004],B[100004],C[100004],t;
int num[2003];
void add(int x,int y,int z){if(dp[x][y]<z)A[t]=x,B[t]=y,C[t++]=z;}
int main(){
	cin>>n;
	for(int i=1;i<=3*n;i++)scanf("%d",&a[i]);
	memset(dp,-1,sizeof(dp));
	memset(MX,-1,sizeof(MX));
	dp[a[1]][a[2]]=dp[a[2]][a[1]]=MX[a[1]]=MX[a[2]]=cur=0;
	num[a[1]]=num[a[2]]=1;
	for(int i=3;i<3*n;i+=3){
		if(a[i]==a[i+1]&&a[i]==a[i+2]){tg++;continue;}
		t=0;
		if(a[i]>a[i+1])swap(a[i],a[i+1]);
		if(a[i+1]>a[i+2])swap(a[i+1],a[i+2]);
		if(a[i]>a[i+1])swap(a[i],a[i+1]);
		if((a[i]==a[i+1]&&num[a[i]]>0)||(a[i+1]==a[i+2]&&num[a[i+1]]>0))for(int j=1;j<=n;j++){
			if(a[i]==a[i+1]){
				if(dp[j][a[i]]>=0)add(j,a[i+2],dp[j][a[i]]+1);
			}else if(dp[j][a[i+1]]>=0)add(j,a[i],dp[j][a[i+1]]+1);
		}
		if(dp[a[i]][a[i]]>=0)add(a[i+1],a[i+2],dp[a[i]][a[i]]+1);
		if(dp[a[i+1]][a[i+1]]>=0)add(a[i],a[i+2],dp[a[i+1]][a[i+1]]+1);
		if(dp[a[i+2]][a[i+2]]>=0)add(a[i],a[i+1],dp[a[i+2]][a[i+2]]+1);
		add(a[i],a[i+1],cur),add(a[i+1],a[i+2],cur),add(a[i],a[i+2],cur);
		for(int k=1;k<=n;k++)if(MX[k]>=0)add(a[i],k,MX[k]),add(a[i+1],k,MX[k]),add(a[i+2],k,MX[k]);
		for(int j=0;j<t;j++)if(dp[A[j]][B[j]]<C[j]){
			dp[A[j]][B[j]]=dp[B[j]][A[j]]=C[j];
			if(MX[A[j]]<C[j])MX[A[j]]=C[j];
			if(MX[B[j]]<C[j])MX[B[j]]=C[j];
			if(cur<C[j])cur=C[j];
		}
		num[a[i]]++,num[a[i+1]]++,num[a[i+2]]++;
	}
	for(int i=1;i<=n;i++){
		for(int j=i+1;j<=n;j++)ans=max(ans,dp[i][j]);
		if(dp[i][i]>=0)if(i==a[3*n])ans=max(ans,dp[i][i]+1);
	}
	printf("%d",ans+tg);
}

Measured memory_bytes: 19616
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>

#define REP(i,n) for(auto i=0;i<n;++i)
#define REPR(i,n) for(auto i=n;i>=0;--i)
#define REPI(itr,v) for(auto itr=v.begin();itr!=v.end();++itr)
#define REPIR(itr,v) for(auto itr=v.rbegin();itr!=v.rend();++itr)
#define FOR(i,a,b) for(auto i=a;i<b;++i)
#define SORT(v,n) sort(v, v+n)
#define SORTV(v) sort(v.begin(), v.end())
#define ALL(v) v.begin(),v.end()
#define llong long long
#define ll long long
#define INF 999999999
#define MOD 1000000007
#define pb push_back
#define pf push_front
#define MP make_pair
#define SV(n,v) {int tmp;for(int i=0;i<n;++i){scanf("%d",&tmp);v.push_back(tmp);}}

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

using namespace std;

typedef pair<llong, llong> pii;

int main(){

  int n, m;
  cin >> n >> m;

  vector<llong> a(n), b(m), c(m);
  map<llong, llong> mp;
  REP(i,n){
      cin >> a[i];
      mp[a[i]]++;
  }

  REP(i,m){
      cin >> b[i] >> c[i];
      mp[c[i]] += b[i];
  }

  vector<pii> v;
  REPI(itr, mp){
      v.pb(MP(itr->first, itr->second));
  }
  sort(ALL(v), greater<pii>());

  llong ans = 0;
  REPI(itr, v){
    //cout << itr->first << " " << itr->second << endl;
    if(itr->second >= n){
      ans += itr->first * n;
      break;
    }else{
      ans += itr->first * itr->second;
      n -= itr->second;
    }
  }

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



Measured memory_bytes: 21360
#include<bits/stdc++.h>
using namespace std;
#define ll long long int 
#define pii pair<int,int> 
#define pb push_back
#define INF INT_MAX 
#define mod 1000000007ll
#define fi first
#define se second
#define f(i,p,q) for(int i=p;i<q;i++)
#define si(a) scanf("%d",&a)
#define sii(a,b) scanf("%d %d",&a,&b)
#define siii(a,b,c) scanf("%d %d %d",&a,&b,&c)
#define pi(a) printf("%d\n",a)
#define psi(a) printf(" %d",a)
#define poi(a) printf("%d",a)
#define sl(a) scanf("%lld",&a)
#define pl(a) printf("%lld\n",a)
#define Nline() printf("\n")
#define sstr(str) scanf("%s",str)
#define pstr(str) printf("%s\n",str)
#define SET(a) memset(a,-1,sizeof(a))
#define CLR(a) memset(a,0,sizeof(a))
#define vi vector<int>
#define vvi vector<vi>
#define all(v) (v).begin(),(v).end()
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())
#define VI(a,n) vi a(n); rep(i,n)cin>>a[i];
#define sq(n) (n)*(n)
#define iso ios::sync_with_stdio(false); cin.tie(0);cout.tie(NULL);
map<int,int>mp;
int main()
{
    iso;
    int r,g,b,n;
    cin>>r>>g>>b>>n; int count=0;
    for(int i=0;i<=n;i++)
    { if(r*i>n)
        break;
        mp[r*i]++;
    }
     for(int j=0;j<=n;j++)
    {  for(int k=0;k<=n;k++)
       {
        if(n-j*g-k*b<0)
            break;
         if(mp[n-j*g-k*b]==1)
            count++;
         }
     }
        
    
    cout<<count;
	 
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
int main()
{
	int n ,i ,pre ,ans ,j ,k ,sum=0;
	scanf("%d",&n);
	int a[n];
	scanf("%d",&sum);
	a[0] = sum;
	sum = abs(sum);
	for(i = 1; i < n; i++)
	{
		scanf("%d",&a[i]);
		sum = sum + abs(a[i]-a[i-1]);
	}
	sum += abs(a[n-1]);
	for(j = 1, pre = ans = 0; j < n; j++)
	{
		ans = ans+abs(pre-a[j]);
		pre = a[j];
	}
	printf("%d\n",ans+abs(pre));
	pre = n-1;
	for(i=1 , j=0 , k=2; i < pre; i++,j++,k++)
	{
		if(a[i]>=a[j] && a[i]<=a[k])
			printf("%d\n",sum);
		else if(a[i]>=a[k] && a[i]<=a[j])
			printf("%d\n",sum);
		else if((a[i]>=a[k] && a[i]>=a[j]))
		{
			if(a[k] >= a[j])
				printf("%d\n",sum - 2*abs(a[i]-a[k]));
			else printf("%d\n",sum - 2*abs(a[i]-a[j]));
		}
		else if(a[i]<=a[k] && a[i]<=a[j])
		{
			if(a[k] <= a[j])
				printf("%d\n",sum - 2*abs(a[i]-a[k]));
			else printf("%d\n",sum - 2*abs(a[i]-a[j]));
		}
	}
	n--;
	for(j = pre = ans = 0; j < n; j++)
	{
		ans = ans+abs(pre-a[j]);
		pre = a[j];
	}
	printf("%d\n",ans+abs(pre));
	return 0;
 } 

Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std;
using ll =long long;
#define all(v) v.begin(),v.end()
 
int main() {
  string S;
  cin>>S;
  reverse(all(S));
  if(S[0]=='3') {
cout<<"bon"<<endl;
  }
  else if(S[0]=='0'||S[0]=='1'||S[0]=='6'||S[0]=='8') {
cout<<"pon"<<endl;
  }
  else {
cout<<"hon"<<endl;
  }
}
  

Measured memory_bytes: 3604
from math import ceil,floor,comb,factorial,gcd,pow,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heapify,heappop,heappush
from copy import deepcopy
from time import time
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

n = INT()

i = 1
while i * i <= n:
    if n % i == 0:
        ans = len(str(n//i))
    i += 1
print(ans)

Measured memory_bytes: 9968
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <sstream>
#include <iterator>

using namespace std;

int main(){
    unsigned int N;
    cin >> N;
    vector<int> p1(N), p2(N);

    for(int i = 0; i < N; ++i) cin >> p1[i];
    copy(p1.begin(), p1.end(), p2.begin());

    sort(p2.begin(), p2.end());

    unsigned int sum = 0;
    for(int i = 0; i < N; ++i){
        if(p1[i] != p2[i]) sum++;
    }

    if(sum <= 2) cout << "YES" << endl;
    else         cout << "NO"  << endl;

    return 0;
}

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

using namespace std;
using LL = long long;

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

#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

const int INF = (int)1e9;
const LL INFL = (LL)1e19;
const int MOD = (int)1e9 + 7;

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

    string s;
    cin >> s;

    if(s[5] == '1') {
        cout << "TBD" << endl;
        return 0;
    }
    
    if(s[6] - '0' >= 5){
        cout << "TBD" << endl;
        return 0;
    }
    
    if(s[6] - '0' <= 4){
        cout << "Heisei" << endl;
        return 0;
    }
    
}

Measured memory_bytes: 256
# https://onlinejudge.u-aizu.ac.jp/courses/library/4/CGL/all/CGL_6_A


from bisect import bisect_left, bisect_right, insort_left
from collections import deque


class BinarySearchTree:
    def __init__(self, ls: list=[]):
        '''
        C++でいうsetを実装する。二分探索木をガチで実装しようとすると大変なので、ここでは配列二分法を用いる。
        pythonの標準ライブラリがヨイショに抱っこしてくれるおかげで楽に実装できる。
        https://docs.python.org/ja/3/library/bisect.html


        ls ... 渡す初期配列
        '''
        self.bst = deque(sorted(ls))  # insertをO(1)にするためにlistの代わりにdequeを用います

    def __repr__(self):
        return f'BST:{self.bst}'

    def __len__(self):
        return len(self.bst)

    def __getitem__(self, idx):
        return self.bst[idx]

    def size(self):
        return len(self.bst)

    def insert(self, x):
        insort_left(self.bst, x)

    def remove(self, x):
        '''
        xを取り除く。xがself.bstに存在することを保証してください。
        同一のものが存在した場合は左から消していく
        '''
        del self.bst[self.find(x)]

    def bisect_left(self, x):
        '''
        ソートされた順序を保ったまま x を self.bst に挿入できる点を探し当てます。
        lower_bound in C++
        '''
        return bisect_left(self.bst, x)

    def bisect_right(self, x):
        '''
        bisect_left() と似ていますが、 self.bst に含まれる x のうち、どのエントリーよりも後ろ(右)にくるような挿入点を返します。
        upper_bound in C++
        '''
        return bisect_right(self.bst, x)

    def find(self, x):
        '''
        xのidxを探索
        '''
        idx = bisect_left(self.bst, x)
        if idx != len(self.bst) and self.bst[idx] == x:
            return idx
        raise ValueError



    # load data
N = int(input())
lines = []
for _ in range(N):
    x1, y1, x2, y2 = list(map(int, input().split()))
    # 前処理として、x1,y1を必ず下端点or左端点にする
    if y1 == y2:  # 平行線の場合
        if x1 > x2:
            x1, x2 = x2, x1
    else:  # 垂直線の場合
        if y1 > y2:
            y1, y2 = y2, y1
    lines.append((x1, y1, x2, y2))

# P409の下の方に書いてあるが、交差を判定する前に削除してしまったり、追加するまえに判定してしまったりすることを防ぐために
# うまい感じにソートするためにendpointsを導入する
# 各要素は(y,端点の種類,xで定義される)
BOTTOM = 0
LEFT = 1
RIGHT = 2
TOP = 3
# 線分の端点を必ず左下始まりにする
endpoints = []
for x1, y1, x2, y2 in lines:
    if y1 == y2:  # 平行線の場合
        endpoints.append((y1, LEFT, x1, x2))  # 左端点の追加
        endpoints.append((y2, RIGHT, x2, -1))  # 右端点の追加
    else:  # 垂直線の場合
        endpoints.append((y1, BOTTOM, x1, -1))  # 下端点の追加
        endpoints.append((y2, TOP, x2, -1))  # 下端点の追加

# yを下から走査するためにソート
endpoints.sort()

bst = BinarySearchTree()
ans = 0
for y, p_type, x, x_t in endpoints:
    # if p_type == RIGHT:
    #     continue  # 後述しますが、右端点は左端点とセットで処理するためスキップしても問題ないです

    # 以下端点の種類ごとに操作を実装
    if p_type == TOP:
        bst.remove(x)  # 上端点の場合はbstに登録してあるxを削除
    elif p_type == BOTTOM:
        bst.insert(x)  # 下端点の場合はbstにxを登録
    elif p_type == LEFT:
        s = bst.bisect_left(x)  # bstにおいて、水平線の左は何番目に大きいか
        t = bst.bisect_right(x_t)  # bstにおいて、水平線の右は何番目に大きいか(同じ値も含めて)
        ans += t - s

print(ans)



Measured memory_bytes: 41276
#define NDEBUG
#include <bits/stdc++.h>
#define mset(a,b) memset(a,b,sizeof a)
#define mcpy(a,b) memcpy(a,b,sizeof b)
#define xx first
#define yy second
#define pb push_back
#define mp make_pair
#define pii pair<int,int> 
#define lb(x) ((x)&(-(x)))
#define dalao 998244353
#define _dalao 1000000007
#define inf 0x3f3f3f3f
#define N 2001
using namespace std;
typedef long long ll;
int n,x,tot;
bitset<2000001> s;
int main(){
	cin>>n;
	s[0]=1;
	for(int i=1;i<=n;i++)cin>>x,tot+=x,s|=s<<x;
	for(int i=tot+1>>1;;i++)if(s[i])return cout<<i,0;
	return 0;
}

Measured memory_bytes: 1024
#include<cstdio>
using namespace std;
const long long md=998244353;
const int maxn=600000;
char str1[maxn+100],str2[maxn+100];
char str3[maxn+100],str4[maxn+100];
long long fac[maxn+100],inv[maxn+100];
long long f[maxn+100],g[maxn+100];
long long C(int n,int m){
	if(n<0&&m==0)
		return 1;
	if(m<0||m>n) return 0;
	return fac[n]*inv[m]%md*inv[n-m];
}
long long powd(long long x,long long y){
	long long res=1;
	while(y){
		if(y&1) res=res*x%md;
		x=x*x%md;
		y>>=1;
	}
	return res;
}
int main(){
//	freopen("E.in","r",stdin);
	int n,m;
	scanf("%d%d",&n,&m);
	scanf("%s",str1+1),scanf("%s",str2+1);
	scanf("%s",str3+1),scanf("%s",str4+1);
	bool bo1=1,bo2=1;
	for(int i=1;i<=n;i++)
	{
		if(str1[i]=='1'||str2[i]=='1'){
			bo1=0;
			break;
		}
	}
	for(int i=1;i<=m;i++)
	{
		if(str3[i]=='1'||str4[i]=='1'){
			bo2=0;
			break;
		}
	}
	if(bo1||bo2){
		long long ans=1;
		for(int i=1;i<=n;i++)
			if(str1[i]=='1'&&str2[i]=='1')
				ans=ans*2%md;
		for(int i=1;i<=m;i++)
			if(str3[i]=='1'&&str4[i]=='1')
				ans=ans*2%md;
		printf("%lld\n",ans);
		return 0;
	}
	fac[0]=1;
	for(int i=1;i<=maxn;i++)
		fac[i]=fac[i-1]*i%md;
	inv[maxn]=powd(fac[maxn],md-2);
	for(int i=maxn;i>=1;i--)
		inv[i-1]=inv[i]*i%md;
	int cnt1=0,cnt2=0;
	for(int i=1;i<=m;i++)
		if(str3[i]=='1')
			cnt1++;
	for(int i=1;i<=n;i++){
		f[i]=C(cnt1+cnt2-1,cnt2)*((str1[i]-'0')||(str2[i]-'0'))%md;
		cnt2=cnt2+str1[i]-'0'+str2[i]-'0';
	}
	cnt1=0,cnt2=0;
	for(int i=1;i<=m;i++)
		if(str4[i]=='1')
			cnt1++;
	for(int i=n;i>=1;i--){
		g[i]=C(cnt1+cnt2-1,cnt2)*((str1[i]-'0')||(str2[i]-'0'))%md;
		cnt2=cnt2+str1[i]-'0'+str2[i]-'0';
	}
	long long ans=0,sum=0;
	for(int i=1;i<=n;i++)
	{
		sum=(sum+f[i])%md;
		if((str1[i]-'0')&&(str2[i]-'0'))
			sum=sum*2%md;
		ans=(ans+g[i]*sum)%md;
	}
	sum=0;
	cnt1=0,cnt2=0;
	for(int i=1;i<=n;i++)
		if(str1[i]=='1')
			cnt1++;
	for(int i=1;i<=m;i++){
		f[i]=C(cnt1+cnt2-1,cnt2)*((str3[i]-'0')||(str4[i]-'0'))%md;
		cnt2=cnt2+str3[i]-'0'+str4[i]-'0';
	}
	cnt1=0,cnt2=0;
	for(int i=1;i<=n;i++)
		if(str2[i]=='1')
			cnt1++;
	for(int i=m;i>=1;i--){
		g[i]=C(cnt1+cnt2-1,cnt2)*((str3[i]-'0')||(str4[i]-'0'))%md;
		cnt2=cnt2+str3[i]-'0'+str4[i]-'0';
	}
	for(int i=1;i<=m;i++)
	{
		sum=(sum+f[i])%md;
		if((str3[i]-'0')&&(str4[i]-'0'))
			sum=sum*2%md;
		ans=(ans+g[i]*sum)%md;
	}
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 15360
N=int(input())
A=list(map(int,input().split()))
ANS=[]
ANS2=[]
for i in range(N):
  ANS+=[[A[i],i+1]]
ANS.sort()
for i in range(N):
  ANS2+=[str(ANS[i][1])]
ans=" ".join(ANS2)
print(ans)

Measured memory_bytes: 28416
import java.io.*;
import java.util.StringTokenizer;


public class Main {

    public static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(String s) {
            try {
                br = new BufferedReader(new FileReader(s));
            } catch (FileNotFoundException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }

        public FastScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String nextToken() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(nextToken());
        }

        long nextLong() {
            return Long.parseLong(nextToken());
        }

        double nextDouble() {
            return Double.parseDouble(nextToken());
        }
    }

    public static void main(String[] args) {
        FastScanner fs = new FastScanner();

        int k = fs.nextInt();
        int a = fs.nextInt();
        int b = fs.nextInt();

        for (int i = a; i <= b; ++i) {
            if (i % k == 0) {
                System.out.println("OK");
                return;
            }
        }

        System.out.println("NG");
    }

}


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

int main(void) {
    int n, m, total=0;
    cin >> n >> m;
    vector<int> a(m);
    for (int i=0; i<m; i++) {
        cin >> a.at(i);
        total += a.at(i);
    }
    if (total > n) {
        cout << -1 << endl;
    }
    else {
        cout << n - total << endl;
    }
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
template<typename tn> void read(tn &a){
    tn x=0,f=1;char c=' ';
    for(;!isdigit(c);c=getchar()) if(c=='-') f=-1;
    for(;isdigit(c);c=getchar() ) x=x*10+c-'0';
    a=x*f;
}
int n;
int main(){
	read(n);
	printf("%d\n",n*n*n);
	return 0;
} 

Measured memory_bytes: 256
s = gets.chomp
(2 ** 3).times do |i|
  array = [s[0], "op", s[1], "op", s[2], "op", s[3]]
  op = ["op", "op", "op"]
  ops = []
  bit = i
  op.each_with_index do |o, j|
    if bit[j] == 1
      o = "+"
    elsif bit[j] == 0
      o = "-"
    end
    ops << o
  end
  array[1] = ops[0]
  array[3] = ops[1]
  array[5] = ops[2]
#   puts eval(array.join)
  if eval(array.join) == 7
    puts array.join + "=7"
    exit
  end
end  

Measured memory_bytes: 1788
input = gets.chomp.split
n = input[0].to_i
k = input[1].to_i
s = gets.chomp.split("")

for i in 1..n do
    if (i==k) 
        tar = s[i-1]
        if tar == "A"
            print "a"
        elsif tar == "B"
            print "b"
        elsif tar == "C"
            print "c"
        end
    else
        print s[i-1]
    end
end

Measured memory_bytes: 1788
#include<bits/stdc++.h>
#define fr(i,x,y) for(int i=x;i<=y;++i)
#define rf(i,x,y) for(int i=x;i>=y;--i)
#define LL long long
using namespace std;
const int N=1e5+10;
int yz[N];

int main(){
	int n,k;scanf("%d%d",&n,&k);
	LL ans=0;
	LL gg=n/k;
	ans=gg*gg*gg;
	if(k%2==0){
		LL pos=n/k;
		if(pos*k+(k/2)<=n) pos++;
		ans+=pos*pos*pos;
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 256
var input = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");
var obj = {
  "list" : input,
  "index" : 0,
  "max" : input.length,
  "next" : function(){
    if(!this.hasNext()){throw "NoSuchElementException:次に要素は無いよ";}
    var returnObj = this.list[this.index];
    this.index++;
    return returnObj;
  },
  "hasNext" : function(){return (this.index < this.max);}
}

function next(){return obj.next();}
function hasNext(){return obj.hasNext();}
function myout(t){console.log(t);}//standard output
function myerr(t){console.error(t);}//standard error
//[no]要素の扱い。数値型
//不明値、異常時:引数そのまま返す　1:数値へ変換
//2:半角SPで分割 4:半角SPで分割し、数値配列へ
//6:1文字で分割  7:1文字で分割し、数値配列へ
//8:半角SPで結合 9:改行で結合 0:文字なしで結合
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map((a)=>Number(a));case 6:return i.split("");case 7:return i.split("").map((a)=>Number(a));case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}
function Main(){
  var one = myconv(next(),4);
  var N = one[0];
  var M = one[1];
  
  var list = new Array(N);
  while(hasNext()){
    var tmp = myconv(next(),4);
    if(list[tmp[0] - 1] == null){
       list[tmp[0] - 1] = tmp[1];
    }else{
      if(list[tmp[0] - 1] == tmp[1]){
         continue;
      }else{
         myout(-1);
         return;
      }
       
    }
  }
  if(N != 1 && list[0] == 0){
     myout(-1);
    return;
  }else{
    if(N == 1 && list[0] == null){
       list[0] = 0;
    }else if(N >= 2 && list[0] == null){
      list[0] = 1;
    }
    if(N >= 2 && list[1] == null){
       list[1] = 0;
    }
    if(N == 3 && list[2] == null){
       list[2] = 0;
    }
  }
  
  myout(myconv(list,0));
}
Main();

Measured memory_bytes: 7372
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define ll long long
#define pb push_back
#define pf push_front
#define Mid ((l+r)/2)
#define pi pair<int,int>
#define pii pair<int,pi>
#define deb(x) cout<<#x<<"="<<x<<endl;
#define go ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
int x,n,mn=1e9;
map <int,int> cnt;
int main()
{
    go;
    cin>>x>>n;
    while(n--)
    {
        int y;
        cin>>y;
        cnt[y]++;
    }
    int ans=-1;
    for(int i=-200;i<=200;i++)
    {
        if(cnt[i]) continue;
        if(abs(i-x)<mn)
        {
            mn=abs(i-x);
            ans=i;
        }
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 3676
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<int> v;
int main(){
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    ios_base::sync_with_stdio(false);
    int N;
    cin>>N;
    int ma=0;
    for(int i=0;i<N;i++){
      int a;
      cin>>a;
      v.push_back(a);
    }
    for(int i=0;i<N;i++){
      ma=max(ma,v[i]);
      if(ma-v[i]>1){
        cout<<"No";
        return 0;
      }
    }
    cout<<"Yes";
    return 0;
}


Measured memory_bytes: 892
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
inline ll read(){
    ll res=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-f;ch=getchar();}
    while(ch>='0'&&ch<='9'){res=(res<<3)+(res<<1)+ch-'0';ch=getchar();}
    return res*f;
}
void write(ll x){
    if(x<0) putchar('-'),x=-x;
    if(x>9) write(x/10);
    putchar(x%10|'0');
}
signed main(){
    int a=read();
    for(int i=sqrt(a);i>=1;i--){
        if(a%i==0){
            cout<<(i-1+a/i-1)<<endl;
            return 0;
        }
    }
}


Measured memory_bytes: 256