akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>    
//#include <ext/pb_ds/assoc_container.hpp> 
//#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
//#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//using namespace __gnu_pbds; 
#define fastio() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define pb  push_back
#define show(x) cout<<(#x)<<" : "<<x<<endl;
#define ll  long long
#define ld  long double
#define fill(a,val) memset(a,val,sizeof(a))
#define mp  make_pair
#define ff  first
#define ss  second
#define pii pair<ll,ll>
#define sq(x) ((x)*(x))
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define endl "\n"
#define int long long 
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
const ll MOD     = 1000*1000*1000+7;
const ll INF     = 1ll*1000*1000*1000*1000*1000*1000 + 7;
const ll MOD2    = 998244353;
const ll N       = 1000 * 100 + 10;
const ll N2      = 70;
const ld PI  = 3.141592653589793;
//template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);} 
ll power(ll x,ll y,ll p = LLONG_MAX ){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
ll lcm(ll a , ll b){return (a*b)/gcd(a,b);}

signed main()
{
    fastio();
    //cout<<fixed<<setprecision(20);
    //CHECK for LONG LONG and LONG DOUBLE
    /*comment for all except cc/cf    
    #ifndef ONLINE_JUDGE    
           freopen("input.txt","r",stdin);
           freopen("output.txt","w",stdout);
    #endif//*/
    int x,y,a,b,c;
    cin>>x>>y>>a>>b>>c;
    int p[a] , q[b]  , r[c];
    for (int i = 0; i < a; ++i)
    {
        cin>>p[i];
    }
    for (int i = 0; i < b; ++i)
    {
        cin>>q[i];
    }
    for (int i = 0; i < c; ++i)
    {
        cin>>r[i];
    }
    sort(p,p+a,greater<int>());

    sort(q,q+b,greater<int>());

    sort(r,r+c,greater<int>());

    priority_queue <int, vector<int>, greater<int>> pr,pg;  

    for (int i = 0; i < x; ++i)
    {
        pr.push(p[i]);
    }
    for (int i = 0; i < y; ++i)
    {
        pg.push(q[i]);
    }

    for (int i = 0; i < c; ++i)
    {
        int smallr = pr.top();
        int smallg = pg.top();
        if(r[i]<min(smallg,smallr))
            break;
        if(smallg>smallr)
        {   
            pr.pop();
            pr.push(r[i]);
        }
        else
        {
            pg.pop();
            pg.push(r[i]);
        }
    }

    int ans=0;
    while(!pr.empty())
    {
        ans+=pr.top();
        pr.pop();
    }
    while(!pg.empty())
    {
        ans+=pg.top();
        pg.pop();
    }
    cout<<ans;

    
    printclock;
    return 0;
}


Measured memory_bytes: 4852
da = list(map(int,input().split()))
a = 0
k = 0
for i in range(3):
  if  da[i] == 5:
    a += 1
  elif da[i] == 7:
    k += 1
 
if a == 2 and k == 1:
  print("YES")
else:
  print("NO")

Measured memory_bytes: 3060
import java.io.*;

class Main{
	public static void main(String[] args){
		try{
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			int n = Integer.parseInt(br.readLine());
			Dice d[] = new Dice[n];
			int i, j;
			int flg=0;

			for(i=0; i<n; i++){
				d[i] = new Dice(br.readLine());
			}

			for(i=0; i<n-1; i++){
				for(j=i+1; j<n; j++){
					if(neCheck(d[i],d[j])){
						flg = 1;
						break;
					}
				}
				if(flg==1) break;
			}

			if(flg==0) System.out.println("Yes");
			else       System.out.println("No");
		} catch(IOException e){
			System.out.println("Exception :" + e);
		}
	}
	public static boolean neCheck(Dice d1, Dice d2){
		if(rightCheck(d1,d2)) return true;
		d2.simN();
		if(rightCheck(d1,d2)) return true;
		d2.simN();
		if(rightCheck(d1,d2)) return true;
		d2.simN();
		if(rightCheck(d1,d2)) return true;
		d2.simN();
		d2.simE();
		if(rightCheck(d1,d2)) return true;
		d2.simE();
		if(rightCheck(d1,d2)) return true;
		d2.simE();
		if(rightCheck(d1,d2)) return true;
		return false;
	}
	public static boolean rightCheck(Dice d1, Dice d2){
		if(check(d1,d2)) return true;
		d2.simR();
		if(check(d1,d2)) return true;
		d2.simR();
		if(check(d1,d2)) return true;
		d2.simR();
		if(check(d1,d2)) return true;
		d2.simR();
		return false;
	}
	public static boolean check(Dice d1, Dice d2){
		if((d1.getTop()==d2.getTop())&&(d1.getForth()==d2.getForth())&&
			(d1.getRight()==d2.getRight())&&(d1.getLeft()==d2.getLeft())&&
			(d1.getBack()==d2.getBack())&&(d1.getBottom()==d2.getBottom())){
			return true;
		} else{
			return false;
		}
	}
}
class Dice{
	private int top;
	private int forth;
	private int right;
	private int left;
	private int back;
	private int bottom;
	Dice(String label){
		String lab[] = label.split(" ", 0);
		top    = Integer.parseInt(lab[0]);
		forth  = Integer.parseInt(lab[1]);
		right  = Integer.parseInt(lab[2]);
		left   = Integer.parseInt(lab[3]);
		back   = Integer.parseInt(lab[4]);
		bottom = Integer.parseInt(lab[5]);
	}
	public void simN(){
		int work;
		work   = top;
		top    = forth;
		forth  = bottom;
		bottom = back;
		back   = work;
	}
	public void simE(){
		int work;
		work   = top;
		top    = left;
		left   = bottom;
		bottom = right;
		right  = work;
	}
	public void simW(){
		int work;
		work   = top;
		top    = right;
		right  = bottom;
		bottom = left;
		left   = work;
	}
	public void simS(){
		int work;
		work   = top;
		top    = back;
		back   = bottom;
		bottom = forth;
		forth  = work;
	}
	public void simR(){
		int work;
		work   = forth;
		forth  = right;
		right  = back;
		back   = left;
		left   = work;
	}
	public void simL(){
		int work;
		work   = forth;
		forth  = left;
		left   = back;
		back   = right;
		right  = work;
	}
	public int getTop(){
		return top;
	}
	public int getForth(){
		return forth;
	}
	public int getRight(){
		return right;
	}
	public int getLeft(){
		return left;
	}
	public int getBack(){
		return back;
	}
	public int getBottom(){
		return bottom;
	}
}

Measured memory_bytes: 19560
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
using namespace std;

int main(){
    ll k, x;
    cin>>k>>x;
    ll n=k*2-1;
    for(ll i=0;i<n;++i){
        cout<<x-k+1+i;
        if(i!=n-1){
            cout<<' ';
        }
    }
    cout<<endl;

    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <string>
#include <map>
#include <cmath>
#include <cstring>

#define fi first
#define se second
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for (int i = 1; i < (n); ++i)
#define drep(i,n) for (int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define all(x) (x).begin(), (x).end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define pb push_back
#define sz(x) (int)(x).size()
#define PQ(T) priority_queue<T, v(T), greater<T> >

using namespace std;
typedef long long ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;

const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;

const int mod = 1000000007;

bool win[100500];

int main() {

    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    rep(i,n) cin >> a[i];

    rep(i,k+1)rep(j,n) win[i] |= (i-a[j]>=0) && !win[i-a[j]];
    //rep(i,k+1) {
    //    if (win[i]) cout << "i: " << i << "  o" << endl;
    //    else cout << "i: " << i << "  x" << endl;
    //}

    if (win[k]) puts("First");
    else puts("Second");
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
//in the name of god;;
using namespace std;
////////////////////////////////////////////////////////
typedef long long ll;                                 //
typedef long double ld;                               //
////////////////////////////////////////////////////////
#define pb push_back                                  //
#define vc vector<ll>                                 //
#define vpl vector<pair<ll, ll> >                     //
#define d double                                      //
#define So(v) sort(v.begin(), v.end())                //
#define Y cout << "YES\n"                             //
#define N cout << "NO\n"                              //
#define rep(x, n) for(ll i = x; i <= n; ++i)          //
#define repp(x, n) for(ll i = n; i >= x; --i)         //
////////////////////////////////////////////////////////
const ll MAXN = 1e6;                                 ///
//////////////////////////////////////////////////////// 
 ll n;
 ll a[MAXN], b[MAXN];
 int main(){
    cin >> n;
    for(ll i = 1; i <= n; ++i){
    	cin >> a[i] >> b[i];
	}
	for(ll i = 1; i + 2 <= n; ++i){
		if(a[i] == b[i] && a[i + 1] == b[i + 1] && a[i + 2] == b[i + 2])return cout << "Yes", 0;
	}
	cout << "No";
 }

Measured memory_bytes: 3596
#include<stdio.h>
#include<cstdio>
#include<string>
using namespace std;

int main() {
  int N;
  scanf("%d", &N);
  int i = N;
  while(true) {
    string str = to_string(i);
    if (str[0] == str[1] && str[1] == str[2]) {
      printf("%d\n", i);
      return 0;
    }
    i++;
  }
}

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

int main() {
  int N, A, Sum=0;
  cin >> N;
  rep(i, N){
    cin >> A;
    Sum+=A-1;
  }
  cout << Sum << endl;
}

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

#define int long long
#define uint unsigned int
#define pii pair<int, int>
#define fi first
#define se second

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define FORR(i, a, b) for (int i = (a); i >= (b); --i)
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) FORR(i, n, 0)
#define ALL(a) (a).begin(), (a).end()
#define SZ(a) ((int)(a).size())

#define PF(a) push_front(a)
#define PB(a) push_back(a)
#define EMPF(...) emplace_front(__VA_ARGS__)
#define EMPB(...) emplace_back(__VA_ARGS__)
#define EMP(...) emplace(__VA_ARGS__)
#define MP(a, b) make_pair(a, b)
#define MT(...) make_tuple(__VA_ARGS__)

#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a, -1, sizeof(a))

#define PW(n) (1LL << (n))
#define NUM(x) char(x + '0')
#define ALP(x) char(x + 'a')

using namespace std;

template <class T> inline bool CHMIN(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template <class T> inline bool CHMAX(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> void SORT(vector<T> &a) { sort(a.begin(), a.end()); }
template <class T> void SORTR(vector<T> &a) { sort(a.rbegin(), a.rend()); }
template <class T> void UNIQUE(vector<T> &a) { a.erase(unique(a.begin(), a.end()), a.end()); }

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

const int MOD = 1000000007;
const int INF = 1LL << 30;
const double EPS = 1e-10;

/* ---------------------------------------------------------------------------------------------------- */

int N, A, B, C;
int l[8];

int sum(int ms) {
  int res = 0;
  REP(i, N) if (ms & PW(i)) res += l[i];
  return res;
}

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  cin >> N >> A >> B >> C;
  REP(i, N) cin >> l[i];
  int ans = INF;
  REP(msA, PW(N)) if (msA) {
    REP(msB, PW(N)) if (msB && (msA & msB) == 0) {
      REP(msC, PW(N)) if (msC && (msA & msC) == 0 && (msB & msC) == 0) {
        int cnt = 0;
        REP(i, N) if ((msA | msB | msC) & PW(i)) cnt++;
        CHMIN(ans, 10*(cnt-3)+abs(A-sum(msA))+abs(B-sum(msB))+abs(C-sum(msC)));
      }
    }
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include <stdlib.h>
#include <cmath>
#include <cstdio>
#include <cstdint>
#include <string>
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
using namespace std;
using ll = long long;

int main(){
  int N,M,C;
  cin >> N >> M >> C;
  vector<int> B(M);
  for(int i=0;i<M;i++) cin >> B.at(i);
  vector<vector<int>> A(N,vector<int>(M));
  vector<int> sum(N,C);
  int ans=0;
  for(int i=0;i<N;i++){
    for(int j=0;j<M;j++){
      cin >> A.at(i).at(j);
      sum.at(i)+=A.at(i).at(j)*B.at(j);
    }
    if(0<sum.at(i)) ans++;
  }
  
  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	private static Scanner sc=new Scanner(System.in);
	private static long n=sc.nextLong();
	private static long m=sc.nextLong();
	public static void main(String[] args){
		if(2*n<=m) System.out.println((m-2*n)/4+n);
		if(2*n>=m) System.out.println(m/2);
	}
}

Measured memory_bytes: 20948
def solve(N,M,K):
  for a in xrange(N+1):
    for b in xrange(M+1):
      if a*b + (N-a)*(M-b) == K:
        return True
  return False
N,M,K = map(int,raw_input().split())
if solve(N,M,K):
  print 'Yes'
else:
  print 'No'


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

int main(){
    int n;
    cin >> n;
    string s[n];
    for(int i = 0; i < n; i++){
        cin >> s[i];
    }
    int alph[26];
    for(int i = 0 ; i < 26; i++){
        alph[i] = 10000;
    }
    for(int i = 0; i < n; i++){
        int cnt[26] = {};
        for(int j = 0; j < s[i].size(); j++){
            for(char k = 'a'; k <= 'z'; k++){
                if(s[i][j] == k){
                    cnt[(int)(k-'a')]++;
                }
            }
        }
        for(int j = 0; j < 26; j++){
            alph[j] = min(alph[j],cnt[j]);
        }
    
    }
    string ans = "";
    for(int i = 0; i < 26; i++){
        for(int j = 0; j < alph[i]; j++){
            ans += char(i+'a');
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
suits=['S','H','C','D']

table=[[False]*14 for i in range(4)]

N=int(input())

for loop in range(N):
    mark,num=input().split()
    num=int(num)

    if mark == 'S':
        table[0][num]=True
    elif mark == 'H':
        table[1][num]=True
    elif mark == 'C':
        table[2][num]=True
    elif mark == 'D':
        table[3][num]=True

for i in range(4):
    for j in range(1,14):
        if table[i][j]==False:
            print("%s %d"%(suits[i],j))



Measured memory_bytes: 5604
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const ll mod = 1e18;

//dp[i] = トキがiの体力を減らすための魔力の最小値

int main(){
    int h,n;
    cin >> h >> n;
    vector<pair<int,int>> mg(n);
    int mx = 1;
    ll ans = mod;

    for(int i = 0; i < n; i++){
        int a,b;
        cin >> a >> b;
        mg[i] = {a, b};
        if(mx < a) mx = a;
    }

    vector<ll> dp(h+mx);
    dp[0] = 0;

    for(int i = 1; i < h+mx; i++){
        dp[i] = mod;
        for(int j = 0; j < n; j++){
            if(mg[j].first <= i){
                dp[i] = min(dp[i], dp[i-mg[j].first]+mg[j].second);
            }
            else dp[i] = min(dp[i], dp[i-1]+mg[j].second);
        }
        if(i >= h && ans > dp[i]) ans = dp[i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 512
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<deque>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>

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

typedef int long long ll;
using namespace std;
typedef pair<int, int> P;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const ll MOD = 1e9 + 7;
static const int MAX = 100;
static const int INF = (1 << 23);

int main() {
    int n;
    cin>>n;
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    string s;

    cin>>s;
    if(d>c){
        bool can=true;
        //bからd
        int tb=b-1;

        while(true){
            if(s[tb]=='#'||tb>=s.size()){can=false;break;}
            else if(tb==d-1){break;}
            if(s[tb+1]=='#'){
                tb+=2;
            }else{
                tb++;
            }
        }

        if(can==false){
            cout<<"No"<<endl;return 0;
        }
        tb=a-1;

        while(true){
            if(s[tb]=='#'||tb>=s.size()){can=false;break;}
            else if(tb==c-1){break;}
            if(s[tb+1]=='#'){
                tb+=2;
            }else{
                tb++;
            }
        }

        if(can==false){
            cout<<"No"<<endl;return 0;
        }else{
            cout<<"Yes"<<endl;
        }

    }else{
        bool can=true;
        bool j=false;
        int tb=b-1;
        int ji=0;
        while(true){
            // cout<<tb<<endl;

            if(s[tb]=='#'||tb>=s.size()){can=false;break;}
            else if(tb==d-1){
                if(tb+1<s.size()&&tb-1>=0&&s[tb+1]=='.'&&s[tb-1]=='.'){j=true;ji=tb;}
                break;
            }

            if(tb+1<s.size()&&tb-1>=0&&s[tb+1]=='.'&&s[tb-1]=='.'){j=true;ji=tb;}
            if(s[tb+1]=='#'){
                tb+=2;
            }else{
                tb++;
            }
        }


        if(can==false||j==false){
            cout<<"No"<<endl;
            return 0;
        }
        //cout<<ji<<endl;


        tb=a-1;

        while(true){
            //cout<<tb<<endl;




            if(s[tb]=='#'||tb>=s.size()){can=false;break;}
            else if(tb==c-1){break;}
            if(s[tb+1]=='#'||tb+1==ji){
                tb+=2;
            }else{
                tb++;
            }
        }


        if(can==false){
            cout<<"No"<<endl;return 0;
        }else{
            cout<<"Yes"<<endl;
        }


    }




    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <unordered_map>

using namespace std;
using ll = long long;

void _cin(){} template <class Head, class... Tail> void _cin(Head&& head, Tail&&... tail){ cin >> head; _cin(forward<Tail>(tail)...); }
void _cout(){ cout << "\n"; } template <class Head, class... Tail> void _cout(Head&& head, Tail&&... tail){ cout << head; _cout(forward<Tail>(tail)...); }
int gcd(int a, int b){ return (b == 0) ? a : gcd(b, a % b); }
template<typename S, typename T> ostream& operator<<(ostream &os, const pair<S, T> &p){ cout << "[" << p.first << ", " << p.second << "]"; return os; }

#define Sq(x) (x)*(x)
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Rep(n) For(_, n)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.rbegin(), c.rend()
#define Contains(c, x) (find(Range(c), x) != c.end())
#define Search(rb, re, x) distance(rb, find(rb, re, x))
#define Sort(a) sort(Range(a))
#define DeSort(a) sort(RevRange(a))
#define Reverse(c) reverse(Range(c))
#define Unique(a) a.erase(unique(Range(a)), a.end())
#define Cusum(T, xs, sxs) vector<T> sxs(xs.size()+1); For(i, (int)xs.size()) sxs[i+1] = sxs[i] + xs[i]
#define Cin(T, ...) T __VA_ARGS__; _cin(__VA_ARGS__)
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i]
#define Cins2(T, n, xs, ys) vector<T> xs(n), ys(n); For(i, n) cin >> xs[i] >> ys[i]
#define Cins3(T, n, xs, ys, zs) vector<T> xs(n), ys(n), zs(n); For(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cinss(T, n, m, xs) Vec2(T, n, m, xs); For(i, n) For(j, m) cin >> xs[i][j]
#define Cinm(T, n, map) unordered_map<T, int> map; Rep(n){ Cin(T, x); map[x] ++; }
#define Cout(...) _cout(__VA_ARGS__)
#define Couts(xs) { for(const auto &e : xs) cout << e << " "; cout << "\n"; }
#define Coutyn(cond) Cout((cond) ? "yes" : "no")
#define CoutYn(cond) Cout((cond) ? "Yes" : "No")
#define CoutYN(cond) Cout((cond) ? "YES" : "NO")
#define Return(expr) { Cout(expr); return 0; }
#define vc vector
#define Mini(a, x) a = min(a, x)
#define Maxi(a, x) a = max(a, x)

// constexpr int MOD = 1e9+7;

int main(void){
    Cin(int, n);
    Cin(string, a);
    int ans = 0;
    For(i, n-2){
        if(a[i] == 'A' && a[i+1] == 'B' && a[i+2] == 'C') ans ++;
    }
    Cout(ans);
}


Measured memory_bytes: 256
#include <stdio.h>

#define N 10000
#define Q 500

int linearSearch(int *A, int key, int length) {
	int i = 0;

	A[length] = key;

	while (A[i] != key) {
		i++;
	}

	if (i == length) return 0;
	return 1;
}

int main() {
	int n,q,i;
	int num = 0;
	int s[N], t[Q];

	scanf("%d", &n);
	for (i = 0; i < n; i++) scanf("%d", &s[i]);
	scanf("%d", &q);
	for (i = 0; i < q; i++) scanf("%d", &t[i]);

	for (i = 0; i < q; i++) num += linearSearch(s, t[i], n);

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

	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h> 
using namespace std;
 
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
 
 
//typedef
//------------------------------------------
typedef pair<int, int> PII;
typedef long long LL;
typedef pair<long, long> PLL;
 
//container util
//------------------------------------------
#define PB emplace_back
#define MP make_pair 
#define SZ(a) int((a).size())
//repetition
//------------------------------------------
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
#define ALL(a)  (a).begin(),(a).end()
//constant
//--------------------------------------------
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

const LL MOD=1e9+7;

int main(){
    string S;cin>>S;
    string kami=S.substr(0,2);
    string shimo=S.substr(2);
    int k = std::stoi(kami);
    int s = std::stoi(shimo);
    bool kismm=false,sismm=false;
    if(k>=1&&k<=12){
        kismm=true;
    }
    if(s>=1&&s<=12){
        sismm=true;
    }
    if(kismm&&sismm){
        cout<<"AMBIGUOUS"<<endl;
    }else if(kismm){
        cout<<"MMYY"<<endl;
    }else if(sismm){
        cout<<"YYMM"<<endl;
    }else{
        cout<<"NA"<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
using namespace std;
int main(void) {
  int sum = 0;
  for(int i=0; i<10; i++){
    int tmp;
    cin >> tmp;
    sum += tmp;
  }
  cout << sum << endl;

  return 0;
}






// EOF

Measured memory_bytes: 3080
n = gets.chomp.to_i
count = Array.new(n+1, 0)

for i in 2..n
    nn = i
    j = 2
    while j <= nn
#        printf "%d %d %d\n", i, nn, j
        if nn % j == 0
            nn =  nn / j
            count[j] += 1
        else
            j += 1
        end
    end
    count[i] +=1 if nn != 1
end
#p count
ans = 1
count.each do |i|
    ans = (ans * (i+1)) % (10**9+7)
end
puts ans


Measured memory_bytes: 1788
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int H = in.nextInt();
        int W = in.nextInt();
        String kda = in.nextLine();

        int MOD = 1_000_000_007;
        int[][] memo = new int[H][W];
        for (int i = 0; i < H; i++) {
            char[] line = in.nextLine().toCharArray();
            for (int j = 0; j < W; j++) {
                if (line[j] == '.') {
                    if (i == 0) {
                        if (j == 0) {
                            memo[i][j] = 1;
                        } else {
                            memo[i][j] = memo[i][j - 1];
                        }
                    } else {
                        if (j == 0) {
                            memo[i][j] = memo[i - 1][j];
                        } else {
                            memo[i][j] = (memo[i - 1][j] + memo[i][j - 1]) % MOD;
                        }
                    }
                }
            }
        }
        System.out.println(memo[H - 1][W - 1]);
    }
}

Measured memory_bytes: 44076
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
int main() {
  int n;
  cin >>n;
  vector<int>s(n);
  int sum=0;
  for(int i=0;i<n;i++){
    cin>>s[i];
    sum+=s[i];
  }
  sort(s.begin(),s.end());
  int x=sum;
  int count=0;
  int hikukazu=s[0];
  while(x%10==0){
    while(s[count]%10==0){
      count++;
      if(count==n){
        cout<<0<<endl;
        return 0;
      }
    }
    x-=s[count];
    count++;
    if(x%10!=0)break;
    if(x==0)break;
  }
  cout<<x<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(),v.end()
#define puts(i) cout << i << endl
#define INF INT_MAX;
#define INFL LLONG_MAX;
typedef long long ll;
using namespace std;
int main(){
  int x;
  cin >> x;
  if(x>=30) puts("Yes");
  else puts("No");
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcountll

#define INF 1e18
#define mod 1000000007

ll N,X;
ll b[100010],u[100010],l[100010];
vector<ll> ord;
ll sum=0;

ll f(ll i,ll x){
  if(x<=b[i])return l[i]*x;
  else return l[i]*b[i]+u[i]*(x-b[i]);
}

bool ok(ll M){
  ll mcnt=(M/X);
  if(mcnt>=N)return true;

  ll rest=M-mcnt*X;
  ll crtsum=sum;

  rep(i,mcnt){
    ll x=ord[i];
    crtsum+=f(x,X);
  }

  ll res=sum;
  rep(i,N){
    ll x=ord[i];
    if(i<mcnt){
      ll y=ord[mcnt];
      maxch(res,crtsum-f(x,X)+f(y,X)+f(x,rest));
    }else{
      maxch(res,crtsum+f(x,rest));
    }
  }

  return res>=0;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin>>N>>X;
  rep(i,N){
    cin>>b[i]>>l[i]>>u[i];
    sum+=-b[i]*l[i];
    ord.push_back(i);
  }
  sort(all(ord),[=](const ll& x,const ll& y){
    return f(x,X) > f(y,X);
  });

  ll lb=-1,ub=1e10;
  while(ub-lb>1){
    ll mid=(ub+lb)/2;
    if(ok(mid))ub=mid;
    else lb=mid;
  }

  cout<<ub<<endl;

  return 0;
}


Measured memory_bytes: 3572
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
const ll INF = 1LL << 60;



int main(){
   int n, k;
   cin >> n >> k;
   vector<ll> a(n);
   rep(i,n){
       cin >> a.at(i);
       a[i]--; //各aiをあらかじめ1引いておくと「部分和の余りが0に等しい」に帰着できる
   }

   //累積和のmod kを格納する
   vector<ll> sum(n+1);
   rep(i,n){
       sum.at(i+1) = (sum.at(i) + a.at(i))%k;
    }

    //mapを使って累積和の剰余項ごとの個数を管理
    map<ll,int> C;
    queue<int> q;
    ll ans=0LL;

    rep(i,n+1){
        ans += C[sum.at(i)];
        C[sum[i]]++;    //余りがsum[i]になるものの個数を1増やす
        q.push(sum.at(i));

        //長さk以上隔てたペアはカウントしないようにする
        if(q.size()==k){
            C[q.front()]--;
            q.pop(); //先頭の要素を削除する
        }
    }
    cout << ans << endl;


}

Measured memory_bytes: 19608
#include <iostream>
#define REP(i, a, n) for(int i = a; i < n; i++)
using namespace std;


int S, T, U;

int main(void) {
  S = 0;
  REP(i, 0, 4) {
    cin >> U;
    S += U;
  }

  T = 0;
  REP(i, 0, 4) {
    cin >> U;
    T += U;
  }

  cout << max(S, T) << endl;

  return 0;
}

Measured memory_bytes: 1160
# include<cstdio>
# include<cstring>
int n,t;
int mark[20];
int main(){
	memset(mark,0,sizeof(mark));
	scanf("%d",&n);
	for(int i=1;i<=4;i++){
		mark[i]=n%10;
		n/=10; 
	} 
	if((mark[1]==mark[2]&&mark[1]==mark[3])||mark[2]==mark[4]&mark[2]==mark[3])
	printf("Yes");
	else printf("No");
	return 0;
} 

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

const int N = 2050;
const int mod = 1e9 + 7;

int n;
int a[200050],b[200050];
int dp[N << 1][N << 1];

long long fac[10050];
long long inv[10050];
long long ksm(long long x,int y){
    long long z = 1;
    while(y){
        if(y & 1) z = z * x % mod;
        y >>= 1;
        x = x * x % mod;
    }
    return z;
}
long long C(int n,int m){
    if(n < m || m < 0) return 0;
    if(n == m || m == 0) return 1;
    return fac[n] * inv[m] % mod * inv[n - m] % mod;
}

int main(){
    fac[0] = 1;
    for(int i = 1; i <= 10000; ++ i) fac[i] = fac[i - 1] * i % mod;
    inv[10000] = ksm(fac[10000],mod - 2); 
    for(int i = 9999; i >= 0; -- i) inv[i] = inv[i + 1] * (i + 1) % mod;

    scanf("%d",&n);
    for(int i = 1; i <= n; ++ i) 
    scanf("%d%d",&a[i],&b[i]);
    
    for(int i = 1; i <= n; ++ i)
    dp[2001 - a[i]][2001 - b[i]] += 1;
    
    for(int i = 1; i <= 4005; ++ i)
    for(int j = 1; j <= 4005; ++ j){
        dp[i][j] += (dp[i - 1][j] + dp[i][j - 1]) % mod;
        dp[i][j] %= mod;
    }
   
    long long ans = 0;
    
    /*for(int i = 1998; i <= 2003; ++ i) {
    for(int j = 1999; j <= 2002; ++ j)
    printf("%d ",dp[i][j]);
    puts("");
    }*/
    
    for(int i = 1; i <= n; ++ i){
    	//printf("%d\n",dp[2001 + a[i]][2001 + b[i]]);
    	ans = ans + dp[2001 + a[i]][2001 + b[i]], ans %= mod;
    }
    
    //printf("%lld\n",ans);
    
    for(int i = 1; i <= n; ++ i){
        ans -= C(a[i] + a[i] + b[i] + b[i], a[i] + a[i]);
        ans = (ans + mod) % mod;
    }
    
    ans = ans * ksm(2, mod - 2) % mod;
    
    printf("%lld\n",ans);
    
    return 0;
}

Measured memory_bytes: 69592
N=int(input())
S=input()
T=S
M=len(T)
while(True):
    T=T.replace("()","")
    if len(T)==M:
        break
    else:
        M=len(T)
k=0
for j in T:
    if j==")":
        k+=1
    else:
        break
print("("*k+S+")"*(M-k))


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#ifdef DEBUG
#include "_debug.cpp"
#include "callable.hpp/callable.hpp"
#endif
#define endl '\n'
using namespace std;
using ll = long long;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >> n;
    cout << n / 3 << endl;
    return 0;
}


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

int main() {
    int H, W;
    cin >> H >> W;
    vector<string> S(H);
    for(auto &e : S) cin >> e;
    vector<vector<bool>> visited(H, vector<bool>(W));
    auto dfs = [&](auto &&dfs, int y, int x) -> pair<int, int> {
        int b = 0, w = 0;
        if(S[y][x] == '#') b++;
        else w++;
        for(auto &[dy, dx] : {P(0,1), {1,0}, {0,-1}, {-1,0}}) {
            int ny = y + dy, nx = x + dx;
            if(ny < 0 || ny >= H || nx < 0 || nx >= W) continue;
            if(S[y][x] == S[ny][nx] || visited[ny][nx]) continue;
            visited[ny][nx] = true;
            auto[n, m] = dfs(dfs, ny, nx);
            b += n;
            w += m;
        }
        return P(b, w);
    };
    int64_t ans = 0;
    rep(i, H) rep(j, W) {
        if(visited[i][j]) continue;
        visited[i][j] = true;
        auto[b, w] = dfs(dfs, i, j);
        ans += (int64_t)b * w;
    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 18808
fn read_stdin() -> String {
    use std::io::Read;
    let mut input = String::new();
    std::io::stdin().read_to_string(&mut input).unwrap();
    input
}

fn scan<'a, I: Iterator<Item = &'a str>, T: std::str::FromStr>(tokens: &mut I) -> T {
    tokens.next().unwrap().parse().ok().unwrap()
}

fn main() {
    let input = read_stdin();
    let tokens = &mut input.split_whitespace();
    let n: usize = scan(tokens);
    let k: usize = scan(tokens);
    let r: usize = scan(tokens);
    let s: usize = scan(tokens);
    let p: usize = scan(tokens);
    let t: String = scan(tokens);
    let t = t.as_bytes();
    let score = |b: u8| -> usize {
        match b {
            b'r' => p,
            b's' => r,
            b'p' => s,
            _ => unreachable!(),
        }
    };
    let mut ans = 0;
    for i in 0..k {
        let mut a = score(t[i]);
        let mut b = 0;
        let mut j = i + k;
        while j < n {
            let (next_a, next_b) = if t[j - k] == t[j] {
                (b + score(t[j]), a)
            } else {
                (a + score(t[j]), a)
            };
            a = next_a;
            b = next_b;
            j += k;
        }
        ans += std::cmp::max(a, b);
    }
    println!("{}", ans);
}


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

int main(){
    int n;
    cin >> n;
    int x[n],tmp;
    for(int i = 0;i < n;i++)cin >> x[i];

    for(int i = 0;i < n-1;i++){
        for(int j = 0;j < n-i-1;j++){
            if(x[j] < x[j+1]){
                tmp = x[j];
                x[j] = x[j+1];
                x[j+1] = tmp;
            }
        }
    }

    int cnt1 = 0,cnt2 = 0;
    for(int i = 0;i < n;i++){
        if(i % 2 == 0)cnt1 += x[i];
        else cnt2 += x[i]; 
    }
    cout << cnt1 - cnt2 << endl;
    
}

Measured memory_bytes: 256
#include<stdio.h>

#define MAX 10000
#define NIL -1

struct Node{
	int p,l,r;
};

struct Node T[MAX];

int n;

void preParse(int u){
	if(u==NIL){
		return;
	}
	printf(" %d",u);
	preParse(T[u].l);
	preParse(T[u].r);
}

void inParse(int u){
	if(u==NIL){
		return;
	}
	inParse(T[u].l);
	printf(" %d",u);
	inParse(T[u].r);
}

void postParse(int u){
	if(u==NIL){
		return;
	}
	postParse(T[u].l);
	postParse(T[u].r);
	printf(" %d",u);
}

int main(void){
	int i,v,l,r,root;
	
	scanf("%d",&n);
	
	for(i=0; i<n;i++){
		T[i].p=NIL;
	}
	
	for(i=0; i<n;i++){
		scanf("%d %d %d",&v,&l,&r);
		T[v].l=l;
		T[v].r=r;
		if(l!=NIL){
			T[l].p=v;
		}
		if(r!=NIL){
			T[r].p=v;
		}
	}
	
	for(i=0; i<n;i++){
		if(T[i].p==NIL){
			root=i;
		}
	}	
	printf("Preorder\n");
	preParse(root);
	printf("\n");
	printf("Inorder\n");
	inParse(root);
	printf("\n");
	printf("Postorder\n");
	postParse(root);
	printf("\n");
		
	return 0;
}



Measured memory_bytes: 2108
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
int main()
{
    int N,L;
    cin >> N >> L;
    vector<string>s(N);
    rep(i,N)cin >> s[i];
    sort(s.begin(),s.end());
    string ans="";
    rep(i,N)ans+=s[i];
    cout << ans << endl;
    return 0;
}


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

int main()
{
    int n;
    cin >> n;
    vector<string> card(n),a(n),b(n);
    for(int i=0;i<n;i++){
        cin >> card[i];
        a[i] = card[i];
        b[i] = card[i];
    }

    //Bubble Sort
    bool ok = true;
    while(ok){
        ok = false;
        for(int j=n-1;j>0;j--){
            if(a[j][1] < a[j-1][1]){
                swap(a[j], a[j-1]);
                ok = true;
            }
        }
    }
    for(int i=0;i<n;i++){
        cout << a[i];
        if(i != n-1)cout << " ";
        else cout << endl;
    }
    cout << "Stable" << endl;

    //Selsection Sort
    for(int i=0;i<n;i++){
        int minj = i;
        for(int j=i;j<n;j++)if(b[j][1] < b[minj][1])minj = j;
        swap(b[i], b[minj]);
    }
    bool ans = true;
    for(int i=0;i<n;i++){
        if(a[i] != b[i])ans = false;
        cout << b[i];
        if(i != n-1)cout << " ";
        else cout << endl;
    }
    cout << ((ans)?"Stable":"Not stable") << endl;

    return 0;
}


Measured memory_bytes: 3176
H,W = map(int,input().split())
s = [input() for _ in range(H)]
h = []
w = []
for i in range(H):
    if '#' not in s[i]:
        h.append(i)

for i in range(W):
    ok = True
    for j in range(H):
        if s[j][i] == "#":
            ok = False
    if ok: w.append(i)
for i in range(H):
    if i in h: continue
    for j in range(W):
        if j not in w:
            print(s[i][j],end="")
    print()

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

#define debug(x) cout << '>' << #x << ':' << x << endl;
#define loop0(i,n) for(int i=0; i<(n); i++)
#define loop1(i,n) for(int i=1; i<=(n); i++)
#define fori(a,b,i) for(int i=(a); i<=(b); i++)
#define ford(a,b,i) for(int i=(a); i>=(b); i--)
#define fast_io ios_base::sync_with_stdio(false), cin.tie(NULL)
#define ign cin.ignore(numeric_limits<streamsize>::max(),'\n')

#define INF 0x3f3f3f3f
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define endl "\n"
#define fir first
#define sec second
#define pb push_back
#define mp make_pair

typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef map<int,int> MII;
typedef map<int,int> MCI;
typedef unordered_map<int,int> UMII;
typedef unordered_map<char,int> UMCI;
typedef set<int> SI;
typedef unordered_set<int> USI;
typedef long long int llint;

// Display Map
//~for (auto const& pair: m) {
//~std::cout << "{" << pair.first << ": " << pair.second << "}\n";
//~}

// Extract word(w) from sentence(s)
//~stringstream str(s);
//~string w;
//~while(str >> w){
//~// w is your word
//~}

//Memset Syntax
// memset(array, value,sizeof(array)) val is 0,-1 or bool only

// To get accurate precision
//~cout.precision(20);

// Concatinate Vectors
//~

int main() {
    fast_io;
	int n;
	cin >> n;
	vector<int> v(n);
	for(auto &i : v) cin >> i;
	if(n == 1) cout << 0 << endl;
	else if(n == 2) cout << *max_element(v.begin(),v.end()) << endl;
	else{
		n -= 2;
		int p = 1;
		llint sum = *max_element(v.begin(),v.end()); 
		sort(v.begin(),v.end(), greater <>());
		for(int i = 1; i<=n ; i++){
			sum += v[p];
			if(i % 2 == 0) p++;
		}
		
		cout << sum << endl;
	}
}


Measured memory_bytes: 3928
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

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

    static class TaskA {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            String s = in.next();
            out.println(s.substring(0, s.length() - "FESTIVAL".length()));
        }

    }

    static class FastScanner {
        private BufferedReader in;
        private StringTokenizer st;

        public FastScanner(InputStream stream) {
            in = new BufferedReader(new InputStreamReader(stream));
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(in.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }

    }
}



Measured memory_bytes: 23380
import sys
sys.setrecursionlimit(1000000)
from math import factorial, ceil, floor
from bisect import bisect_right as bsr
from operator import itemgetter as ig
from collections import defaultdict as dd
from collections import deque, Counter as cnt

# お約束
args = None
INF = float("inf")
MOD = int(1e9 + 7)
def input(*ps):
    if type(ps[0]) is list:
        return [input(*ps[0][:-1]) for _ in range(ps[0][-1])]
    elif len(ps) == 1:
        return ps[0](next(args))
    else:
        return [p(next(args)) for p in ps]
def nlist(n, v):
    if not n: return [] if type(v) is list else v
    return [nlist(n[1:], v) for _ in range(n[0])]

# エントリーポイント
def main():
    N = input(int)
    H = input([int, N])

    cur_c, max_c = 0, 0
    for n in range(1, N):
        if H[n] <= H[n - 1]:
            cur_c += 1
            max_c = max(max_c, cur_c)
        else:
            cur_c = 0
    print(max_c)

if __name__ == '__main__':
    args = iter(sys.stdin.read().split())
    main()


Measured memory_bytes: 14448
#include<iostream>
#include <cstring>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
  int H, A; cin >> H >> A;
  if(H%A) cout << H/A + 1 << endl;
  else cout << H/A << endl;
}

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

using namespace std;

long long cnt;
int l;
int A[1000000];
int n;
vector<int> G;

// ??????g ????????????????????\?????????
void insertionSort(int A[],int n,int g) {
	for(int i=g;i<n;i++) {
		int v = A[i];
		int j = i - g;
		while(j>=0 && A[j] >v) {
			A[j+g] = A[j];
			j -= g;
			cnt++;
		}
		A[j+g] = v;
	}
}

void shellSort(int A[], int n) {
	// ??°???G = {1, 4, 13, 40, 121, 364, 1093, ...}?????????
	for(int h=1; ;) {
		if(h>n) break;
		G.push_back(h);
		h = 3*h + 1;
	}
	
	// ?????????G[i] = g?????????
	for(int i=G.size()-1; i>=0; i--) {
		insertionSort(A, n, G[i]);
	}
}

int main(void) {
	cin >> n;
	// ??????????????\???scanf??¢??°????????¨
	for(int i=0; i<n; i++) scanf("%d",&A[i]);
	cnt = 0;

	shellSort(A,n);
	
	cout << G.size() << endl;
	for(int i=G.size()-1; i>=0; i--) {
		printf("%d", G[i]);
		if(i) printf(" ");
	}
	printf("\n");
	printf("%d\n",cnt);
	for(int i=0;i<n;i++) printf("%d\n",A[i]);
	
	return 0;
}

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

const int mod = 1e9 + 7;

int main(){
    int n, m; cin >> n >> m;
    if(abs(n-m) >= 2){
        cout << 0 << endl;
        return 0;
    }
    ll ans = 1;
    for(int i = n; i >= 1; i--){
        ans = ans * i % mod;
    }
    for(int i = m; i >= 1; i--){
        ans = ans * i % mod;
    }
    if(n == m){ans = ans * 2%mod;}
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
from itertools import permutations
from math import sqrt, pow, factorial

n = int(input())
xy = [list(map(int, input().split())) for _ in range(n)]

def calc(a,b):
    [x1, y1] = a
    [x2, y2] = b
    return sqrt(pow(x1 - x2, 2) + pow(y1 - y2, 2))

sum = 0
for i in permutations(range(n)):
    distance = 0
    for j in range(1, n):
        distance = calc(xy[i[j]], xy[i[j-1]])
        sum += distance
print(sum/factorial(n))






Measured memory_bytes: 9232
#include <bits/stdc++.h>
#define rep(i,cc,n) for(int i=cc;i<=n;++i)
#define drep(i,cc,n) for(int i=cc;i>=n;--i)
#define sz(s) (int)(s.size())
#define vecprint(v) rep(i,0,v.size()-1)cout << v[i] << " ";cout << endl;
#define arrprint(v,n) rep(i,0,n-1)cout << v[i] << " ";cout << endl;
#define matprint(v,n,m) rep(i,0,n-1){rep(j,0,m-1){cout << v[i][j] << " ";}cout << endl;}
using namespace std;
const int mod=1000000007;
const int INF=1001001001;
typedef long long ll;
typedef pair<int,int> P;

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

    int ans = 0;
    while(n){
        n /= k;
        ans++;
    }

    cout << ans << endl;
//  printf("%.10f\n",ans);

    return 0;
}

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

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

    static class DDiceInLine {
        PrintWriter out;
        InputReader in;

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            this.out = out;
            this.in = in;
            int n = ni();
            int k = ni();
            long[] arr = new long[n];
            int i = 0;
            long[] pf_sum = new long[n];
            for (i = 0; i < n; i++) {
                arr[i] = nl();
                if (i > 0)
                    pf_sum[i] += pf_sum[i - 1];
                pf_sum[i] += (arr[i] + 1);
            }
            double sum = 0;

            for (i = 0; i <= n - k; i++) {
                double sum1 = 0;
                if (i > 0)
                    sum1 -= pf_sum[i - 1];
                sum1 += pf_sum[i + k - 1];
                sum = Math.max(sum, sum1 / 2.0);
            }
            pn(sum);

        }

        int ni() {
            return in.nextInt();
        }

        long nl() {
            return in.nextLong();
        }

        void pn(Object o) {
            out.println(o);
        }

    }

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

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

        public int read() {
            if (numChars == -1)
                throw new UnknownError();
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new UnknownError();
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public String next() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuffer res = new StringBuffer();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));

            return res.toString();
        }

        private boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

    }
}



Measured memory_bytes: 42908
def make_divisors(n):
    divisors = []
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n // i)
    return divisors


def main():
    n = int(input())
    # 1回も割り算しない場合は n mod k = 1でkは(n-1)の約数
    ans = len(make_divisors(n - 1)) - 1
    # 割り算をする場合
    l = make_divisors(n)[1:]
    for i in l:
        num = n
        while num % i == 0:
            num //= i
        if num % i == 1:
            ans += 1
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3316
import itertools
N = int(input())
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))
p = list(itertools.permutations(range(1,N+1)))
for i in range(len(p)):
    if p[i] == P:
        a = i
    if p[i] == Q:
        b = i
print(abs(a-b))


Measured memory_bytes: 79812
N=int(input())
s=input()
for T in ["SS","SW","WS","WW"]:
    for i in range(1,N-1):
        if T[-1]=="S":
            if s[i]=="o":
                T+=T[-2]
            else:
                if T[-2]=="S":
                    T+="W"
                else:
                    T+="S"
        else:
            if s[i]=="x":
                T+=T[-2]
            else:
                if T[-2]=="S":
                    T+="W"
                else:
                    T+="S"
    F=True
    if s[i+1]=="o":
        if T[-1]=="S" and T[-2]==T[0]:
            F=False
        elif T[-1]=="W" and T[-2]!=T[0]:
            F=False
    else:
        if T[-1]=="S" and T[-2]!=T[0]:
            F=False
        elif T[-1]=="W" and T[-2]==T[0]:
            F=False
    if F:
        continue
    F=True
    if s[0]=="o":
        if T[0]=="S" and T[-1]==T[1]:
            F=False
        elif T[0]=="W" and T[-1]!=T[1]:
            F=False
    else:
        if T[0]=="S" and T[-1]!=T[1]:
            F=False
        elif T[0]=="W" and T[-1]==T[1]:
            F=False
    if F:
        continue
    print(T)
    quit()
print(-1)


Measured memory_bytes: 3444
N = int(input())
K = int(input())

best = int(1e100)
for i in range(2**N):
    v = i
    v2 = 1
    for j in range(N):
        if (v % 2 == 0): v2 *= 2
        else: v2 += K
        v /= 2
    best = min(best, v2)
print(best)


Measured memory_bytes: 2940