akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); ++i)
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return true;
    }
    return false;
}
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}
using namespace std;
using ll = long long;
using P = pair<int, int>;
using Pl = pair<long long, long long>;
using veci = vector<int>;
using vecl = vector<long>;
using vecveci = vector<vector<int>>;
using vecvecl = vector<vector<long long>>;
#define INF 1e+14

const ll MOD = 998244353;

ll modpow(ll n, ll a)
{
    if (a == 0)
        return 0;
    ll ans = 1;
    REP(i, n)
    {
        ans *= a;
        ans %= MOD;
    }
    return ans;
}

ll vec_max(vecl A) {
    sort(A.begin(),A.end());
    return A[A.size() - 1];
}

int main() {
    int N;
    cin >> N;
    vecl D(N);
    REP(i,N) cin >> D[i];
    REP(i, N)
    {
        if (i == 0 && D[i] != 0)
        {
            cout << 0 << endl;
            return 0;
        }
        if (i > 0 && D[i] == 0)
        {
            cout << 0 << endl;
            return 0;
        }
    }
    if(D[0] != 0)
        cout << 0 << endl;
    else {
        ll ma = vec_max(D);
        map<ll,ll> mp;
        REP(i, N)
        if (mp.count(D[i])) mp[D[i]]++;
        else
            mp[D[i]] = 1;
        ll ans = 1;
        for(int i = 0; i < ma; i++) {
            if(!mp.count(i+1)) {
                cout << 0 << endl;
                return 0;
            }
            ans *= modpow(mp[i + 1], mp[i]);
            ans %= MOD;
        }
        cout << ans << endl;
    }
}


Measured memory_bytes: 7280
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e12;

bool check(vector<int> a){
	int g = a[0];
	int n = a.size();
	int sum = a[0];
	rep(i, 1, n){
		g = __gcd(g, a[i]);
		sum += a[i];
	}
	if(g != 1) return false;
	rep(i, 0, n){
		if(__gcd(sum - a[i], a[i]) == 1) return false;
		if(a[i] > 30000) return false;
	}
	return true;
}

signed main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	vector<int> a(n), cand;
	rep(i, 2, 30001){
		if(i % 2 == 0 || i % 3 == 0 || i % 5 == 0 || i % 7 == 0){
			cand.push_back(i);
		}
	}
	int sum = 0;
	rep(i, 0, n - 2){
		a[i] = cand[i];
		sum += a[i];
	}
	int now = 210;
	sum %= now;
	rep(i, n, cand.size()){
		rep(j, i + 1, cand.size()){
			int tmp = cand[i] + cand[j];
			if(tmp % now == (now - sum) % now){
				a[n - 2] = cand[i];
				a[n - 1] = cand[j];
				i = cand.size();
				break;
			}
		}
	}
	if(check(a) == false) cerr << -1 << endl;
	for(int ii = 0; ii < a.size(); ii++){
		if(ii) cout << ' ';
		cout << a[ii];
	}
	cout << endl;
}

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

ARR = [int(s) for s in input().split(" ")]
def calculate(n,arr):
    m1 = 0
    m2 = 0
    m3 = 0
    for ar in arr:
        if ar % 4 == 0:
            m1 = m1 + 1
        elif ar % 2 == 0:
            m2 = m2 + 1
        else:
            m3 = m3 + 1

    if m2 == 0:
        if m3 > m1 + 1:
            print("No")
        else:
            print("Yes")
    else:
        if m3 <= m1:
            print("Yes")
        else:
            print("No")


calculate(N,ARR)


Measured memory_bytes: 14252
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		int x=scan.nextInt(),t=scan.nextInt();
		if(x>t) {
			System.out.println(x-t);
		}
		else if(x<=t) {
			System.out.println("0");
		}

	}

}

Measured memory_bytes: 35604
#pragma region
#pragma GCC target("avx2")
#pragma GCC optimize("03")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std; typedef long double ld; typedef long long ll;
typedef unsigned long long ull;
#define endl "\n"
#define MP make_pair
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORR(x,arr) for(auto& x:arr)
#define PII pair<int, int>
#define PLL pair<ll, ll>
#define VPII vector<PII>
#define VPLL vector<PLL>
#define FI first 
#define SE second
#define ALL(x) (x).begin(), (x).end()
constexpr int INF=1<<30; constexpr ll LINF=1LL<<60; constexpr ll mod=1e9+7; constexpr int NIL = -1;
template<class T>inline bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>inline bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
#pragma endregion
//-------------------
const int MX = 200000+7;
int a[MX];
int n;

template<class T>
vector<T> calc_divisor(T n) {
    vector<T> res;
    for (T i = 1; i*i <= n; ++i) {
        if (n % i == 0) {
            res.push_back(i);
            T j = n / i;
            if (j != i) res.push_back(j);
        }
    }
    sort(res.begin(), res.end()); //大きい順
    return res;
}

int main(){
    cin.tie(0); ios::sync_with_stdio(false); //cout << fixed << setprecision(15);
    cin >> n;
    unordered_map<int, int> mp;
    FOR(i,0,n-1) {
        cin >> a[i];
        mp[a[i]]++;
    }
     
    int ans = 0;
    for(int i = 0; i <= n-1; i++) {
        if(mp[a[i]] > 1) continue;
        bool ok = true;
        for(auto e: calc_divisor(a[i])) {
            if(e == a[i]) continue;
            if(mp[e] > 0) ok = false;
        }
        if(ok) ans++;
    }

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


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

int main(void){
  int n,b=0,count=0,j=0;
  cin >> n;
  vector<int> a(n);
  for(int i=0; i<n; i++){
    cin >> a[i];
  }
/*
  for(int i=1; i<=n; i++){
    for(j=b; j<n; j++){
      if(a[j] == i){
          b = j;
          count++;
          break;
      }
    }
    if(count == 0){
        count = -1;
        break;
    }
    if(j == n+1){
      break;
    }
  }
  if(count == 0){
    cout << -1 << endl;
  }else{
    cout << n-count << endl;
  }
*/
  b = 1;
  for(int i=0; i<n; i++){
    if(a[i] == b){
      b++;
    }else{
      count++;
    }
  }

  if(count == n){
    cout << -1 << endl;
  }else{
    cout << count << endl;
  }
  return 0;
}


Measured memory_bytes: 1152
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
const int mod = 1000000007;
const ll INF = 1001001001;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
  string s,t;
  cin >> s >> t;
  int n = int(s.size());
  int m = int(t.size());
  vector<vector<int>> dic(26);
  rep(i,n) dic[s[i]-'a'].push_back(i);
  rep(i,n) dic[s[i]-'a'].push_back(i+n);
  int p = 0;
  ll ans = 0;
  rep(i,m){
    int a = t[i] - 'a';
    if(dic[a].size()==0){
      puts("-1");
      return 0;
    }
    p = *lower_bound(dic[a].begin(),dic[a].end(),p) + 1;
    if(p>=n){
      ans += n;
      p -= n;
    }
  }
  ans += p;
  cout << ans << endl;
  
}

Measured memory_bytes: 4608
#include<iostream>
#include<cstdio>
using namespace std;
int n;
long long ans=1,k;
int main()
{
    scanf("%d%lld",&n,&k);
    for(int i=1;i<=n;i++)
      ans+=min(ans,k);
    printf("%lld\n",ans);
    return 0;
}

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

void solve(){
  LL h; cin >> h;
  LL t = 1;
  LL ans = 1;
  while (h > 1){
    h /= 2;
    t *= 2;
    ans += t;
  }
  cout << ans << endl;
}

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

  solve();

  return 0;
}


Measured memory_bytes: 256
import std.stdio, std.conv, std.string, std.algorithm,
       std.math, std.array, std.container, std.typecons;

int solve() {
  auto s = readln.chomp;
  int i=0, j=(s.length-1).to!int;
  char x = 'x';
  int res = 0;
  while(i<j) {
    if(s[i]==x&&s[j]==x) { i++; j--; continue; }
    if(s[i]==x&&s[j]!=x) { i++; res++; continue; }
    if(s[i]!=x&&s[j]==x) { j--; res++; continue; }
    if(s[i]!=x&&s[j]!=x) {
      if(s[i]==s[j]) { i++; j--; continue; }
      else return -1;
    }
  }
  return res;
}

void main() {
  solve.writeln;
}


Measured memory_bytes: 2428
s=input()
s_front=int(s[0]+s[1])
s_end=int(s[2]+s[3])

def MM(x):
    if 1<=x<=12:return True
    else:return False

if MM(s_front) and MM(s_end):print("AMBIGUOUS")
elif MM(s_front) and not MM(s_end):print("MMYY")
elif not MM(s_front) and MM(s_end):print("YYMM")
else:print("NA")

Measured memory_bytes: 61772
#include<bits/stdc++.h>
using namespace std;
#define inf 1e9
#define ll long long
#define ull unsigned long long
#define M 1000000007
#define P pair<int,int>
#define PLL pair<ll,ll>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
#define IN(n,a) rep(i,n){ cin>>a[i]; }
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265

ll n,m;
int main(){
  cin>>n>>m;
  ll ans=0;
  while(n<=m){
    ans++;
    n*=2;
  }

  cout<<ans<<endl;
}

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


int main()
{


     ios_base::sync_with_stdio(false);
     cin.tie(NULL);
    
    string first,second;
    cin>>first>>second;
    int length1=first.size();
    int length2=second.size();
    if(length1!=length2-1)
        cout<<"No"<<endl;
    else
    {
        int flag=0;
        for(int i=0;i<length1;i++)
        {
           if(first[i]!=second[i])
           {
            flag=1;
            break;
           }
        }
        if(flag)
            cout<<"No"<<endl;
        else
            cout<<"Yes"<<endl;
    }

  return 0;

}

Measured memory_bytes: 3652
#include <stdio.h>

const int SIDE_MAX = 6;

class DICE {
public:
	DICE(void) {};
	void ReadSide(void);
	void Roll(char dimension);
	int GetSide(int side);
        int CheckSide(int side1, int side2);
        bool CheckSame(DICE& d);
private:
	int m_a_side[SIDE_MAX];
};

void DICE::ReadSide(void) {
	char tmp[2];
	for (int i = 0; i < SIDE_MAX; i++) {
		scanf("%d", &m_a_side[i]);
	}
	scanf("%c", &tmp);
	return;
}

void DICE::Roll(char dimension) {
	int* a_tmp[4 + 1];
	int tmp; a_tmp[0] = &tmp;

	switch (dimension) {
	case 'W':
		a_tmp[1] = &m_a_side[0]; a_tmp[2] = &m_a_side[2];
		a_tmp[3] = &m_a_side[5]; a_tmp[4] = &m_a_side[3];
		break;
	case 'N':
		a_tmp[1] = &m_a_side[0]; a_tmp[2] = &m_a_side[1];
		a_tmp[3] = &m_a_side[5]; a_tmp[4] = &m_a_side[4];
		break;
	case 'E':
		a_tmp[1] = &m_a_side[0]; a_tmp[2] = &m_a_side[3];
		a_tmp[3] = &m_a_side[5]; a_tmp[4] = &m_a_side[2];
		break;
	case 'S':
		a_tmp[1] = &m_a_side[0]; a_tmp[2] = &m_a_side[4];
		a_tmp[3] = &m_a_side[5]; a_tmp[4] = &m_a_side[1];
		break;
	}
	for (int i = 0; i < 4 + 1; i++) {//アドレスを入れ替える
		*a_tmp[i] = *a_tmp[(i + 1) % (1 + 4)];
	}
	return;
}

int DICE::GetSide(int side) {
	return m_a_side[side - 1];
}

int DICE::CheckSide(int side1, int side2){
        for(int i=0;i<=6*4;i++){
                if(m_a_side[0] == side1 && m_a_side[1] == side2) return m_a_side[2];
                Roll(i%4!=3 ? 'S' : ((i+4)/8)%2 ? 'E' : 'W');
        }
        return -1;
}

bool DICE::CheckSame(DICE& d){
        for(int i=0;i<=6*4;i++){
                for(int j=0;j<SIDE_MAX;j++){
                        if(m_a_side[j] != d.GetSide(j+1)) break;
                        if(j == SIDE_MAX-1) return true;
                }
                Roll(i%4!=3 ? 'S' : ((i+4)/8)%2 ? 'E' : 'W');
        }
        return false;
}

int main(void) {
        int n = 0;

        scanf("%d", &n);
	DICE *a_dice = new DICE[n];
        for(int i=0;i<n;i++){
                a_dice[i].ReadSide();
        }
        for(int i=0;i<n;i++){
                for(int j=i+1;j<n;j++){
                        if(a_dice[i].CheckSame(a_dice[j])){
                                printf("No\n");
                                goto fin;
                        }
                }
        }
        printf("Yes\n");
fin:
        delete[] a_dice;
	return 0;
}


Measured memory_bytes: 2684
using System.Collections.Generic;
using static System.Console;
using static System.Linq.Enumerable;

static class Program
{
  static void Main()
  {
    var X = new HashSet<int>();
    var N = int.Parse(ReadLine());
    
    foreach (string a in ReadLine().Split()) {
      if (!X.Add(int.Parse(a))) {
        WriteLine("NO");
        return;
      }
    }
    
    WriteLine("YES");
  }
}

Measured memory_bytes: 38492
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n) ; ++i)
#define drep(i,n) for(int i = (n) -1;i>=0;--i)
#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define emb emplace_back
#define fcout cout << fixed << setprecision(15)


using namespace std;
using ll = long long;
using P = pair<int,int>;

template<typename T> void Yes(T flag) {
  cout << (flag ? "Yes" : "No") << endl;
}

template<typename T> void pv(vector<T> vec) {
  cout << "[";
  for(auto& v : vec) { cout << v << ","; }
  cout << "]" << endl;
}

template<>
void pv(vector<P> vec) {
  cout << "[";
  for(auto& v : vec) {
    cout << "<" << v.fi << ","<< v.se << ">" << ",";
  }
  cout << "]" << endl;
}

int main() {
  int n;
  cin >> n;
  vector<int> a(n,0);
  rep(i,n) cin >> a[i];

  sort(all(a));
  int res=0;
  bool alice=true;
  drep(i,n) {
    if(alice) {
      res+=a[i];
      alice=false;
    } else {
      res-=a[i];
      alice=true;
    }
  }

  cout << res << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
	long long n;
	cin >> n;
	vector<long long> a(n),ans(n);
	for(int i=0;i<n;i++){
		cin >> a[i];
	}
	ans[0]=0;
	for(int i=1;i<n;i++){
		ans[0]^=a[i];
	}
	for(int i=1;i<n;i++){
		ans[i]=ans[i-1]^a[i-1]^a[i];
	}
	for(int i=0;i<n;i++){
		cout << ans[i] << " ";
	}
	cout << endl;
}

Measured memory_bytes: 6368
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using ll = long long;
using VI = vector<int>;
using VVI = vector<vector<int>>;
using P = pair<int, int>;

int main(){
    int n;
    cin >> n;
    set<int> S;
    rep(i,n){
        int a;
        cin >> a;
        if(S.count(a)){
            S.erase(a);
        }else{
            S.insert(a);
        }
    }
    cout << S.size() << endl;
    return 0;
}

Measured memory_bytes: 4864
s = list(input())
flag = True
for i,j in enumerate(s):
    if i % 2 == 0:
        if j == "R" or j =="U" or j == "D":
            flag = True
        else:
            flag = False
            break
    else:
        if j == "L" or j == "U" or j == "D":
            flag = True
        else:
            flag = False
            break
if flag == True:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 9056
#include<stdio.h>
#include<math.h>

struct Point{double x,y;};

void koch(int n,Point a,Point b){
  if(n == 0) return;

  Point s,t,u;

  double th=M_PI * 60.0 /180;

  s.x=(a.x * 2.0 + b.x) / 3.0;
  s.y=(a.y * 2.0 + b.y) / 3.0;
  
  t.x=(a.x + b.x * 2.0) / 3.0;
  t.y=(a.y + b.y * 2.0) / 3.0;

  u.x=((t.x - s.x) * cos(th) - (t.y - s.y) * sin(th)) + s.x;
  u.y=((t.x - s.x) * sin(th) + (t.y - s.y) * cos(th)) + s.y;

  koch(n-1,a,s);
  printf("%.8f %.8f\n",s.x,s.y);
  koch(n-1,s,u);
  printf("%.8f %.8f\n",u.x,u.y);
  koch(n-1,u,t);
  printf("%.8f %.8f\n",t.x,t.y);
  koch(n-1,t,b);  
}

int main(void){
  Point a,b;
  int n;

  a.x=0;
  a.y=0;
  b.x=100;
  b.y=0;
 
  scanf("%d",&n);

  printf("%.8f %.8f\n",a.x,a.y);
  koch(n,a,b);
  printf("%.8f %.8f\n",b.x,b.y);
}

Measured memory_bytes: 2684
/*
Author: Racer5x
 ***************************************   UNAUTHORISED COPYING OF CODE PROHIBITED   **********************************
*/
 
// #pragma GCC optimize("O3")
// #pragma GCC optimize("Ofast")
// #pragma GCC optimize("unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
#include<bits/stdc++.h>
#define int         long long
#define double      long double
#define pb          emplace_back
#define pf          emplace_front
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define rall(a)     (a).rbegin(),(a).rend()
#define x           first
#define y           second
#define endl        '\n'
#define hell        998244353 
#define PI          3.141592653589
#define tezz        ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define MAX         2000000000000000000
#define M           1000000007
using namespace std;
 
signed main()
{
    tezz
    
    string s;
    cin>>s;

    int sum = 0;

    for(int i=0;i<s.length();i++) sum += s[i] - '0';

    if(sum % 9 == 0) cout<<"Yes";
    else cout<<"No";
} 

Measured memory_bytes: 3692
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <queue>
#include <algorithm>
#include<iostream>
#include<vector>
#include<map>
#include<string>
#include <iomanip>
#include<deque>
#include<stack>
#include<set>
#include <numeric>

using namespace std;
typedef unsigned int uint;
typedef long long ll;
//typedef pair<int, int> P;
const int INF = 111111111;
const ll LLINF = 1e17 + 1;
const int DX[9] = { 0,0,1,-1, 1, 1, -1, -1, 0 }; // 4;４近傍
const int DY[9] = { 1,-1,0,0, 1, -1, 1, -1, 0 }; // 8:８近傍 9:(0,0)を含む
const int DIV = 1000000007; //10^9 + 7
const double PI = 3.14159265358979323846264338327950288;




int main() {

	//==================================
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	//==================================

	string S;
	ll K;
	cin >> S >> K;

	if (S.length() == 1) {
		cout << S;
		return 0;
	}

	ll first = -1;
	for (ll i = 0; i < S.length(); i++) {
		if (S[i] != '1') {
			first = i;
			break;
		}
	}

	if (first <= K - 1 && first != -1) {
		cout << S[first];
		return 0;
	}
	else{
		cout << "1";
	}





}


Measured memory_bytes: 256
def main():
    import collections

    N = int(input())
    A_s = list(map(int, input().split()))
    Q = int(input())

    summ = sum(A_s)
    CNT_A = collections.Counter(A_s)


    for i in range(Q):
        before, after = map(int, input().split())
        
        tmp_cnt = CNT_A[before]
        
        if (tmp_cnt > 0):
            tmp_before = CNT_A[before] * (after - before)
            summ += tmp_before

            N_before=CNT_A[before]

            del CNT_A[before]
            N_after = CNT_A[after]
            
            if (N_after > 0):
                CNT_A[after] = N_after + N_before
            else:
                CNT_A[after] = N_before
            
        
        print(summ)


if __name__ == '__main__':
    main()


Measured memory_bytes: 21460
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<cmath>
using namespace std;
#define MAXN 100000
#define LL long long
LL read(){
    LL x=0,F=1;char c=getchar();
    while(c<'0'||c>'9'){if(c=='-')F=-1;c=getchar();}
    while(c>='0'&&c<='9'){x=x*10+c-'0';c=getchar();}
    return x*F;
}
int n,m,a,b;
int main()
{
	//freopen("stone.in","r",stdin);
	//freopen("stone.out","w",stdout);
	n=read(),m=read(),a=read(),b=read();
	for(int i=1;i<=n;i++,puts(""))
		for(int j=1;j<=m;j++)
		printf("%d",(i<=b)^(j<=a));
}

Measured memory_bytes: 1280
#include <iostream>
#include <vector>
using namespace std;
const int M = 1000000007;
class mll {
public:
	long long x;
	mll(long long x = 0) : x((x% M + M) % M) {};
	void operator *= (const mll& a) {
		(x *= a.x) %= M;
	}
	mll operator * (const mll& a) const {
		mll ans = *this;
		ans *= a;
		return ans;
	}
	mll inv() {
		long long a = x, b = M, u = 1, v = 0;
		while (b) {
			long long t = a / b;
			a -= t * b; swap(a, b);
			u -= t * v; swap(u, v);
		}
		u %= M;
		if (u < 0) u += M;
		a = u;
		return mll(a);
	}
};
int main() {
	int N, K;
	cin >> N >> K;
	vector<mll> CombiNK(K + 1);
	vector<mll> CombiK(K);
	CombiNK[0] = 1, CombiK[0] = 1;
	for (int i = 1; i < K + 1; i++) {
		CombiNK[i] = CombiNK[i - 1] * ((long long)N - K + 1 - i + 1);
		CombiNK[i] *= mll(i).inv();
	}
	for (int i = 1; i < K; i++) {
		CombiK[i] = CombiK[i - 1] * ((long long)K - 1 - i + 1);
		CombiK[i] *= mll(i).inv();
	}

	for (int i = 1; i <= K; i++) {
		mll ans = CombiNK[i] * CombiK[i - 1];
		cout << ans.x << endl;
	}
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define mfill(x,y) memset(x,y,sizeof(x))
#define all(v) v.begin(), v.end()
#define in(x,y,h,w) if(0<=x&&x<h&&0<=y&&y<w)
#define y0 y12345
#define y1 y54321

#ifdef LOCAL
#define debug(...) fprintf(stderr,__VA_ARGS__)
#else
#define debug(...) 42
#endif

using ul = unsigned long;
using ll = long long;
using P = pair<int, int>;
using vint = vector<int>;using vvint = vector<vector<int>>;
using vll = vector<ll>;using vvll = vector<vector<ll>>;
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;}
template <class T>void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
	v.assign(a, vector<T>(b, t));
}
vint dx = {-1, 0, 1, 0}, dy = {0, -1, 0, 1};
vint dx8 = {-1, -1, -1, 0, 1, 1, 1, 0}, dy8 = {-1, 0, 1, 1, 1, 0, -1, -1};

int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);
	debug("debug test\n");
   	int n,m;
	cin>>n;
	vint a(n);
	int now = 1;
	int ans = 0;
	rep(i, n){
		int c;cin>>c;
		if(c==now){
			now++;
		}else{
			ans++;
		}
	}
	if(now==1){
		cout << -1 << endl;
	}else{
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 1024
n=int(input())
h=list(map(int,input().split()))
ans=0
down=0
for i in range(n-1):
    if(h[i] >= h[i+1]):
        down+=1
    else:
        if(down > ans):
            ans = down
        down = 0
if(down > ans):
    ans = down
print(ans)

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

#define rep(i,n) for(int i=0;i<(n);i++)
#define dbg(S) { int f=1; for(auto x:S) cerr<<(f?"[":", ")<<x, f=0; cerr<<"]\n"; }

using namespace std;

int main(){
	int a,b; cin>>a>>b;
	cout<<(a<10&&b<10?a*b:-1)<<endl;
	return 0;
}


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

using ll = long long;
using ii = pair<int, int>;
using vi = vector<int>;
using vii = vector<ii>;
using vll = vector<ll>;
using si = set<int>;
using sll = set<ll>;


ll dp[3005][3005];


int main(){
	int n; cin >> n;
	vi a(n + 2);
	for (int i = 1; i <= n; i++) cin >> a[i];
	
	for (int i = 1; i <= n; i++){
		for (int j = 1; j + i - 1 <= n; j++){
			int l = j, r = j + i - 1;
			if (l == r){
				dp[l][r] = a[l];
			}
			else{
				dp[l][r] = max(a[r] - dp[l][r - 1], a[l] - dp[l + 1][r]);
			}
		}
	}
	cout << dp[1][n] << endl;
	return 0;
}


Measured memory_bytes: 70016
N,Y=map(int,input().split())
answer=-1,-1,-1
for x in range(N+1):
    for y in range(N-x+1):
        z=N-x-y
        if 0<=z<=2000 and 10000*x+5000*y+1000*z==Y:
            answer=x,y,z
            break
    else:
        continue
    
print(*answer)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define all(x) x.begin(),x.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
template<class T> inline bool chmax(T&a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T&a,T b){if(a>b){a=b;return 1;}return 0;}
typedef long long ll;

int n,k,h,w;
string s,t;
string m[30];
vector<vector<int>> d;
int dx[]={0,-1,1,0} ,dy[]={1,0,0,-1};

int bfs(int x,int y){
  vector<vector<int>> d(h,vector<int>(w,-1));
  queue<pair<int,int>> q;
  int cnt=0;
  q.push({x,y});
  d[y][x]=0;
  while(!q.empty()){
    int x=q.front().first, y=q.front().second;
    chmax(cnt,d[y][x]);
    q.pop();
    rep(i,4){
      int nx=x+dx[i], ny=y+dy[i];
      if(nx<0 || ny<0 || nx>=w || ny>=h) continue;
      if(m[ny][nx]=='#') continue;
      if(d[ny][nx]==-1){
        d[ny][nx]=d[y][x]+1;
        q.push({nx,ny});
      }
    }
  }
  return cnt;
}

int main() {
  cin >> h >> w;
  rep(i,h) cin >> m[i];
  int ans=0;
  rep(i,h)rep(j,w){
    if(m[i][j]=='#') continue;
    chmax(ans,bfs(j,i));
  } 
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <cstdio>

int main() {
    int N, sum;
    scanf("%d", &N);
    sum = N%2 ? N : N+1;
    printf("%d\n", (N * (N-2) + 1) / 2);
    for (int i=1; i<N; i++) {
        int pair = sum - i;
        for (int j=i+1; j<=N; j++) {
            if (j != pair) printf("%d %d\n", i, j);
        }
    }
    return 0;
}

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

int main() {
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    int l = a+b;
    int r = c+d;
    if(l > r) cout << "Left" << endl;
    else if(l == r) cout << "Balanced" << endl;
    else cout << "Right" << endl;
}

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

#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define ALL(v) v.begin(), v.end()
#define SZ(x) ((int)(x).size())

const double PI  = acos(-1.0);
const double EPS = 1e-9;
const ll INF = 1e9+10;
const ll mod = 1e9+7;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
#define print(x) cerr << #x << " is " << x << endl;
//#define print(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl; 

int A[200];

ll g(int n, int k){
    if (k == 0)
        return 1;
    if (k == 1)
        return n * 9;
    if (k == 2)
        return n * (n - 1)/2 * 9 * 9;
    if (k == 3)
        return n * (n - 1) * (n - 2)/6 * 9 * 9 * 9;
    assert(0);
}
 
ll f(int now, int n, int k){
    ll ans = 0;
    if (n < k){
        return 0;
    }
        
    if (k == 0){
        return 1;
    }

    reps(i, 0, A[now] + 1){
        //if (now == 0 && i == 0)continue;
        if (i == A[now]){
            if (i == 0){
                ans += f(now + 1, n - 1, k);
            } else {
                ans += f(now + 1, n - 1, k - 1);
            }

        } else {
            if (i == 0){
                ans += g(n - 1, k);
            } else {
                ans += g(n - 1, k - 1);
            }
        }
    }
    return ans;
}
    
//
int main() {
    string S;
    cin >> S;
    int N = S.size(), K;
    rep(i, N){
        A[i] = S[i] - '0';
        //cout << A[i];
    }
    //cout << endl;
    ll ans = 0;
    cin >> K;
#if 0
    // N - 1 ���ȉ�  n-1 C k 9^k  
    if (K == 3){
        ans = (N - 1) * (N - 2) * (N - 3) / 6 * 9 * 9 * 9;
    } else if (K == 2){
        ans = (N - 1) * (N - 2) / 2 * 9 * 9;
    } else if (K == 1){
        ans = (N - 1) * 9;
    }
#endif
    //cout << ans << endl;
    ans += f(0, N, K);
    cout << ans;
    return 0;
}


Measured memory_bytes: 256
function Main(input) {
	const A = input.split("\n");
	
	const B = parseInt(A[0].split(" ")[0]) + parseInt(A[0].split(" ")[1]) + parseInt(A[0].split(" ")[2]);
	
	if (B >= 22) {
		console.log("bust");
	} else {
		console.log("win");
	}
}
 
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>
#include <numeric>
#include <queue>
#include <stack>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9) + 7;

int main(void) {
	int n;
	cin >> n;
	
	vector<int> w(n);
	int s2 = 0;
	for(int i = 0; i < n; ++i) {
		cin >> w[i];
		
		s2 += w[i];
	}
	
	int s1 = 0;
	int ans = 1e9;
	for(int i = 0; i < n; ++i) {
		s1 += w[i];
		s2 -= w[i];
		ans = min(ans, abs(s2 - s1));
	}
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
 
int main(void){
 
int a,b;
scanf("%d %d",&a,&b);
if(a<b){
printf("a < b\n");
}
else{
if(a>b){
printf("a > b\n");
}
else{
printf("a == b\n");
}
 
}
 
return 0;
}

Measured memory_bytes: 580
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define all(v) v.begin(), v.end() 
#define mp make_pair
#define pb push_back
#define f first
#define s second

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	//freopen("input.in", "r", stdin);
        //freopen("output.out", "w", stdout);
	string a, b;
	cin >> a >> b;
	vector<vector<pair<int, pair<int, int>>>> dp(a.size() + 1,
		vector<pair<int, pair<int, int>>> (b.size() + 1, mp(-1, mp(0, 0))));
	dp[0][0] = {0, {0, 0}};
	for(int i = 0; i < a.size(); i++){
		for(int j = 0; j < b.size(); j++){
			if(a[i] == b[j]){
				dp[i + 1][j + 1] = max(dp[i + 1][j + 1], mp(dp[i][j].f + 1, mp(i, j)));
			}
			dp[i + 1][j] = max(dp[i + 1][j], mp(dp[i][j].f, mp(i, j)));
			dp[i][j + 1] = max(dp[i][j + 1], mp(dp[i][j].f, mp(i, j)));
		}
	}
	pair<int, pair<int, int>> ans = mp(0, mp(0, 0));
	for(int i = 0; i <= a.size(); i++){
		for(int j = 0; j <= b.size(); j++){
			ans = max(ans, mp(dp[i][j].f, mp(i, j)));
		}
	}
	pi cur = ans.s;
	string answer = "";
	while(!(cur.f == 0 || cur.s == 0)){
		int i = cur.f;
		int j = cur.s;
		pi prev = dp[i][j].s;
		if(prev == mp(i - 1, j - 1)){
			answer += a[i - 1];
		}
		cur = prev;
	}
	reverse(all(answer));
	cout << answer << endl;
	return 0;
}
/*
Things to look out for:
	- Integer overflows
	- Array bounds
	- Special cases
Be careful!
*/


Measured memory_bytes: 105984
#include <cassert>

#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
//#include <boost/foreach.hpp>
//#include <boost/range/algorithm.hpp>
#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define ll long long
#define Sort(v) sort(all(v))
#define INF 1000000000
#define END return 0
#define pb push_back
#define se second
#define fi first
#define pb push_back
#define all(v) (v).begin() , (v).end()
#define MP make_pair
#define MOD 1000000007LL
using namespace std;
int day[12]={31,28,31,30,31,30,31,31,30,31,30,31};

int main()
{
    int a, b;
    scanf("%d%d", &a, &b);
    string s;
    cin >> s;

    rep(i, 0, a){
        if(s[i]=='-'){
            cout << "No" << endl;
            return 0;
        }
    }
    if(s[a]!='-'){
        cout << "No" << endl;
        return 0;
    }
    rep(i, a+1, a+b){
        if(s[i]=='-'){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

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

using namespace std;

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

int main(){
    int n;cin>>n;
    int a[100005]={};
    REP(i,n){
        int temp;cin>>temp;
        if(temp>0)a[temp-1]++;
        a[temp]++;
        if(temp<100000)a[temp+1]++;
    }
    int nMax=0;
    int nMaxNum=0;
    REP(i,100005){
        if(a[i]>nMax){
            nMax=a[i];
            nMaxNum=i;
        }
    }
    REP(i,10){
        cerr<<a[i]<<endl;
    }
    cerr<<nMaxNum<<endl;
    cout<<a[nMaxNum]<<endl;
    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define int long long int
#define ld long double
#define pb push_back
#define pf push_front
#define ft first
#define sc second
#define all(v) v.begin(), v.end()
using namespace std;
const int maxn = 201001;
signed main() {
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    int n, x, y;
    cin >> n >> x >> y;
    vector<int> ans(n, 0);
//    for (int k = 1; k < n; k++) {
//        int n1 = n - (y - x - 1);
//        ans[k] += max(0ll, n1 - k);
//    }
    for (int d = 1; d <= n; d++) {
        for (int i = d + 1; i <= n; i++) {
            int dst = min(abs(d - i), min(abs(d - x) + 1 + abs(i - y), abs(d - y) + 1 + abs(i - x)));
            //cout << d << " " << i << " " << dst << "\n";
            ans[dst]++;
        }
    }
    for (int d = 1; d < n; d++) {
        cout << ans[d] << "\n";
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <map>
using namespace std;
int main() {
    while (1) {
        int n;
        cin >> n;
        if (n == 0) {
            break;
        }

        map<char, char> conversion;
        char c1, c2;
        for (int i=0; i<n; ++i) {
            cin >> c1 >> c2;
            conversion.insert(make_pair(c1, c2));
        }

        string result = "";
        cin >> n;
        char c;
        for (int i=0; i<n; ++i) {
            cin >> c;
            if (conversion.count(c)) {
                result += conversion[c];
            } else {
                result += c;
            }
        }

        cout << result << endl;
    }
    return 0;
}

Measured memory_bytes: 1340
import itertools
N, M = map(int, input().split())
edge = [[False]*N for _ in range(N)]
ans = 0
for _ in range(M):
  a, b = map(int, input().split())
  a -= 1
  b -= 1
  edge[a][b] = True
  edge[b][a] = True
for i in itertools.permutations(range(N), N):
  if i[0] == 0:
    for j in range(N):
      if j == N-1:
        ans += 1
        break
      if not edge[i[j]][i[j+1]]:
        break
print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define ll long long int
#define trace(x) cerr<<#x<<" : "<<x<<endl;
#define jaldi ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;

// PMAMP :)
// INL , IIWOIL

int main()
{
    jaldi
    int n,x;
    cin>>n>>x;
    (n*500>=x) ? cout<<"Yes":cout<<"No";
    return 0;
}

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

using namespace std;

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define ll long long int
//#define mod 1000000007
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define prec(n) fixed << setprecision(n)
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int>>
#define PI 3.1415926535897932384626
#define INF 1000000000
#define bits(n) __builtin_popcount(n)

const int M = 1e9 + 7;
long long mod(long long x)
{
    return ((x % M + M) % M);
}
long long add(long long a, long long b)
{
    return mod(mod(a) + mod(b));
}
long long mul(long long a, long long b)
{
    return mod(mod(a) * mod(b));
}
void solve()
{
    ll n;
    cin>>n;
    ll a[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    ll pref[n];
    pref[0]=a[0];
    for(int i=1;i<n;i++)
    {
        pref[i]=pref[i-1]+a[i];
    }
    ll res=0;
    for(int i=0;i<n-1;i++)
    {
        res=add(res,mul(a[i],pref[n-1]-pref[i]));
    }
    cout<<res;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
#ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input1.txt", "r", stdin);
    // for writing output to output.txt
    freopen("output1.txt", "w", stdout);
#endif

    int t = 1;
    //cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}


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

using namespace std;

long long inf=1000000007;

int main(){
	long long n;
	cin>>n;
	vector<long long> snuke(n);
	long long comp=0;

	for(long long i=0;i<n;i++){
		cin>>snuke.at(i);
		comp^=snuke.at(i);
	}

	for(long long i=0;i<n;i++){
		cout<<(comp^snuke.at(i));
		if(i<n-1) cout<<" ";
		else cout<<endl;
	}

	return 0;
}


Measured memory_bytes: 4696
s = input()
assert all(c in '123456789' for c in s)

def dfs(i, s1):
    if i == len(s):
        yield eval(s1)
        return
    yield from dfs(i+1, s1+s[i])
    yield from dfs(i+1, s1+'+'+s[i])

print(sum(dfs(1, s[0])))

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
int main () {
  long N, K;
  cin >> N >> K;
  vector<long> data(N);
  for(int i = 0; i < N; i++)cin >> data.at(i);
  vector<pair<long, long>> sub(N);
  long ans = 0;
  for(int i = 0; i < N; i++){
    for(int j = 0; j < N; j++){
      if(j < i){
        if(data.at(j) < data.at(i))sub.at(i).first++;
      } else if(j > i){
        if(data.at(j) < data.at(i))sub.at(i).second++;
      }
    }
    ans += sub.at(i).first * ((K - 1) * K / 2 % 1000000007);
    ans %= 1000000007;
    ans += sub.at(i).second *(K * (K + 1) / 2 % 1000000007);
    ans %= 1000000007;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#define REP(i, start, n) for(int i = start; i < n; ++i)
#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
#define debug2d(var)  do{std::cout << #var << " : \n";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }

using namespace std;
using ll = long long;
using P = pair<int, int>;

int H, W;
vector<string> grid;
vector<vector<ll> > dp;
const ll MOD = 1e9 + 7;

ll rec(int x, int y) {
    if (dp[y][x] != -1) return dp[y][x] % MOD;

    int nx = x - 1;
    int ny = y - 1;
    ll sum = 0;

    if (ny >= 0 && grid[ny][x] == '.') sum += rec(x, ny);
    if (nx >= 0 && grid[y][nx] == '.') sum += rec(nx, y);
    
    return dp[y][x] = (sum % MOD);
}

int main() {
    cin >> H >> W;

    grid.assign(H, "");
    dp.assign(H, vector<ll>(W, -1));

    REP(i, 0, H) {
        cin >> grid[i];
    }

    dp[0][0] = 1;

    cout << rec(W-1, H-1) << endl;

    return 0;
}

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

int b[1000000];
int main()
{
	int a;
	cin>>a;
	b[a]++;
	int ans=1;
	while(1)
	{
		if(a%2==0)
		{
			a/=2;
		}
		else
		{
			a*=3;
			a++;
		}
		b[a]++;
		ans++;
		if(b[a]>=2)
		{
			cout<<ans<<endl;
			return 0;
		}
	}
	return 0;
 }

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int a[12];
string solve() {
	for (int i = 0; i < 12; i += 4) {
		for (int j = i; j < i + 4; j++) {
			for (int k = j; k < i + 4; k++) {
				if (a[j] != a[k])return "no";
			}
		}
	}
	return "yes";
}
int main() {
	for (int i = 0; i < 12; i++)cin >> a[i];
	sort(a, a + 12);
	cout << solve() << endl;
	return 0;
}

Measured memory_bytes: 3168
#include<stdio.h>
#define M 250
int main(void){
  int n,i,A[M];
  scanf("%d",&n);
  for(i=1;i<=n;i++)
    scanf("%d",&A[i]);
  for(i=1;i<=n;i++){
    printf("node %d: key = %d, ",i,A[i]);
    if(i>1)
      printf("parent key = %d, ",A[i/2]);
    if(2*i<=n)
      printf("left key = %d, ",A[2*i]);
    if(2*i+1<=n)
      printf("right key = %d, ",A[2*i+1]);
    printf("\n");
  }
  return 0;
}

Measured memory_bytes: 600
#ABC 070B

a,b,c,d = map(int,input().split())

if a < c:
    if min(b,d)-min(b,c) < 0:
        print(0)
    else:
        print(min(b,d)-min(b,c))
else:
    if min(b,d)-min(a,d) < 0:
        print(0)
    else:
        print(min(b,d)-min(a,d))



Measured memory_bytes: 3060
import java.io.BufferedReader;
//import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
//import java.util.Arrays;

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		//System.setIn(new FileInputStream("./ALDS1_4_D-in35.txt"));
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		//int[] t = Arrays.stream(br.readLine().split(" ")).mapToInt(Integer::parseInt).toArray();
		String[] t = br.readLine().split(" ");
		int n = Integer.parseInt(t[0]);
		int k = Integer.parseInt(t[1]); // max no of dump truck
		int[] w = new int[n];
		int left = 0;
		int right = 0;
		for(int i = 0; i < n; ++i) {
			w[i] = Integer.parseInt(br.readLine());
			right += w[i];
			if(left < w[i]){
				left = w[i];
			}
		}
		int mid = 0;
		while(left < right) {
			mid = (left + right)/2;
			int l = 1;// number of dump truck
			int s = mid;
			for(int i = 0; i < n && l <= k; ++i) {
				s -= w[i];
				if(s < 0){
					l += 1;
					s = mid - w[i];
				}
			}
			if(l <= k){
				right = mid;
			}else{
				left = mid + 1;
			}
		}
		System.out.println(right);

	}

}

Measured memory_bytes: 35508
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; ++i)
#define all(x) (x).begin(),(x).end()
#define allr(x) (x).rbegin(),(x).rend()
#define f first
#define s second
#define pb push_back
#define mp make_pair 
using namespace std;
typedef unsigned long ul;
typedef long long ll;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<vector<int>> vii;
typedef vector<vector<int>> Graph;
typedef pair<int, int> pi;
const ll INF = 1LL << 60;
const unsigned int MOD = 1000000007;
const int dx4[4] = { 1, 0, -1, 0 };
const int dy4[4] = { 0, 1, 0, -1 };
const int dx8[8] = { 0, 1, 1, 1, 0, -1, -1, -1 };
const int dy8[8] = { 1, 1, 0, -1, -1, -1, 0, 1 }; 

bool is_prime(int n) { for (int i = 2; i*i <= n; ++i) { if (n % i == 0) return false; } return true; }
long long mod(long long val, long long m) { long long res = val % m; if (res < 0) res += m; return res; }
template<class T> inline void chmin(T& a, T b) { if (a > b) { a = b; } }
template<class T> inline void chmax(T& a, T b) { if (a < b) { a = b; } }

void dfs() {
}

ll dp[110000] = {};
ll nums[110000] = {};
int N;

int main() {
    cin >> N;
    rep(i, N) cin >> nums[i];
    dp[0] = nums[0];
    int len = 1;
    
    for(int i = 1; i < N; ++i) {
        if(dp[len - 1] < nums[i]) {
            dp[len++] = nums[i];
        }
        else {
           *lower_bound(dp, dp + len, nums[i]) = nums[i]; 
        }
    }
    
    cout << len << endl;;
}


Measured memory_bytes: 4604
#include <string>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
	string s, t;
	cin >> s >> t;
	int lenS = s.size(), cnt = 0;
	bool flag = false;
	while (cnt < lenS) {
		++cnt;
		reverse(s.begin(), s.begin() + lenS - 1);
		reverse(s.begin() + lenS - 1, s.end());
		reverse(s.begin(), s.end());
		if (s == t) {
			flag = true;
			break;
		}
	}
	if (flag == true) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<vector>
using namespace std;
int n, D[201000];
vector<int>E[201000];
void DFS(int a, int pp) {
	for (auto &x : E[a]) {
		if (x != pp) {
			D[x] = D[a] + 1;
			DFS(x, a);
		}
	}
}
int main() {
	int i, a, b;
	scanf("%d", &n);
	for (i = 1; i < n; i++) {
		scanf("%d%d", &a, &b);
		E[a].push_back(b);
		E[b].push_back(a);
	}
	D[1] = 0;
	DFS(1, 0);
	int Mx = -1, pv = -1;
	for (i = 1; i <= n; i++) {
		if (D[i] > Mx)Mx = D[i], pv = i;
	}
	D[pv] = 0;
	DFS(pv, 0);
	Mx = -1;
	for (i = 1; i <= n; i++) {
		Mx = max(Mx, D[i]);
	}
	if (Mx % 3 == 1)puts("Second");
	else puts("First");
}

Measured memory_bytes: 21376
import java.util.*;

public class Main{
  public static void main(String[]args){
    Scanner sc = new Scanner(System.in);
    long A = sc.nextLong();
    long B = sc.nextLong();
    long g = gcd(A,B);

    int ans = 1;
    long f = (long)Math.sqrt(g);
    for(int i = 2; i <= f; i++){
      if(g%i == 0){
        ans++;
        while(g%i == 0){
          g /= i;
        }
      }
    }
    if(g > 1){
      ans++;
    }
    System.out.println(ans);
  }
  public static long gcd(long a, long b){
    if(b == 0){
      return a;
    }
    return gcd(b, a%b);
  }
}


Measured memory_bytes: 23764
(let* ((h (read))
       (w (read))
       (m (read))
       (pos nil)
       (h-num (make-array (list (1+ h)) :initial-element 0))
       (w-num (make-array (list (1+ w)) :initial-element 0))
       (h-max 0)
       (w-max 0)
       (h-max-num 0)
       (w-max-num 0)
       (m-max 0))
  (loop :for k :from 1 :to m
        :for i := (read)
        :for j := (read)
        :do (incf (aref h-num i))
        :do (incf (aref w-num j))
        :do (push (cons i j) pos))
  ;
  (loop :for i :from 1 :to h
        :do (setf h-max (max h-max (aref h-num i))))
  (loop :for j :from 1 :to w
        :do (setf w-max (max w-max (aref w-num j))))
  (loop :for i :from 1 :to h
        :if (= h-max (aref h-num i))
        :do (incf h-max-num))
  (loop :for j :from 1 :to w
        :if (= w-max (aref w-num j))
        :do (incf w-max-num))
  ;
  (loop :named main
        :for p :in pos
        :if (and (= (aref h-num (car p)) h-max) (= (aref w-num (cdr p)) w-max))
        :do (incf m-max))
  (if (< m-max (* h-max-num w-max-num))
      (format t "~A~%" (+ h-max w-max))
      (format t "~A~%" (+ h-max w-max -1))))


Measured memory_bytes: 90664
module.exports=function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)r.d(n,i,function(e){return t[e]}.bind(null,i));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=0)}([function(t,e,r){"use strict";var n=r(1);r(2)(n.readFileSync("/dev/stdin","utf8"))},function(t,e){t.exports=require("fs")},function(t,e,r){"use strict";var n=r(3),i=r(5);t.exports=function(t){var e=new n(t);i(e)}},function(t,e,r){"use strict";var n=r(4);t.exports=class{constructor(t){var e=t.trim().split(/\s+/g);this.inp=new n(e)}inr(){return this.inp.deq()}in(){return parseInt(this.inp.deq(),10)}fin(){this.inp.clear()}}},function(t,e,r){"use strict";t.exports=class{constructor(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.size=t.length,this.items=t,this.ind=0}enq(t){this.size+=1,this.items.push(t)}deq(){var t=this.items[this.ind];return this.size-=1,this.ind+=1,t}clear(){this.items=[],this.size=0,this.ind=0}}},function(t,e,r){"use strict";t.exports=function(t){for(var e=t.in(),r=new Array(e),n=new Array(e),i=0;i<e;i++){n[i]=t.in();for(var o=new Array(n[i]),s=0;s<n[i];s++){var u=t.in()-1,a=t.in();o[s]={x:u,y:a}}r[i]=o}for(var c=0,f=0;f<1<<e;f++){for(var l=!0,p=0,d=0;d<e;d++)if((f>>d)%2==1){p++;for(var v=n[d],h=0;h<v;h++){if((f>>r[d][h].x)%2!=r[d][h].y){l=!1;break}}if(!l)break}l&&(c=Math.max(p,c))}console.log(c)}}]);

Measured memory_bytes: 7500