akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
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; }
const long long INF = 1LL << 60;
 
typedef pair<ll,ll> pairs;
vector<pairs> p;
bool pairCompare(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.first < secondElof.first;
}
#define MAX_N 1000100
bool x[MAX_N];
ll num[MAX_N];
ll fibl[MAX_N]={0};
 
ll fib(ll a){
    if (fibl[a]!=0)return fibl[a];
    if (a==0){
        return 0;
    }else if (a==1){
        return 1;
    }
    return fibl[a]=fib(a-1)+fib(a-2);
}
 
ll eratosthenes(ll n) {
    int p = 0;
    for (ll i=0; i<=n; ++i) x[i] = true;
    x[0] = x[1] = false;
    for(int i=2; i<=n; ++i) {
        if(x[i]) {
            p++;
            for(int j=2*i; j<=n; j+=i) x[j] = false;
        }
        
        num[i] = p;
    }
    return p;
}
 
ll gcd(ll a,ll b){
    if (a%b==0)return(b);
    else return(gcd(b,a%b));
}
 
ll keta(ll N){
    int tmp{};
    while( N > 0 ){
        tmp += ( N % 10 );
        N /= 10;
    }
    N = tmp;
    return N;
}

int main(){
    string s,t;
    cin >> s >> t;
    ll ans = 0;
    if (s[0] == t[0]) ans++;
    if (s[1] == t [1]) ans++;
    if (s[2] ==  t[2]) ans++;
    
    cout << ans << endl;
    
    
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
int n,x,y,i,j,a[2001];main(){std::cin>>n>>x>>y;for(;++i<=n;)for(j=i;++j<=n;)a[std::min(j-i,abs(x-i)+1+abs(y-j))]++;for(i=0;++i<n;)printf("%d\n",a[i]);}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using i64 = long long;
using std::cout;
using std::endl;
using std::cin;

int main() {
	int a, b; scanf("%d%d", &a, &b);
	
	if(a <= b) printf("%d\n", a);
	if(b < a) printf("%d\n", a - 1);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using pii=pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
#define all(c) begin(c),end(c)
#define rall(c) rbegin(c),rend(c)
#define fore(x,c) for(auto &&x:c)
#define rep(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define rrep(i, a, n) for(int i=(int)(n-1);i>=a;--i)
#define sz(c) ((int)c.size())
#define contains(c,x) (c.find(x)!=end(c))
#define inseg(l,x,r) ((l)<=(x)&&(x)<(r))
#define dump(...)
#define pb push_back
#define _ 0
const signed INF_=1001001001; const long long INF=1001001001001001001LL;
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) {
    for (auto i = begin(v); i != end(v); i++) os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is,vector<T> &v) {
    for (auto i = begin(v); i != end(v); i++) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
    is>>p.first>>p.second;return is;}
template<class T, class U> bool chmax(T &a,const U &b){return a<b?a=b,1:0;}
template<class T, class U> bool chmin(T &a,const U &b){return a>b?a=b,1:0;}
template <class T> void psum(T& c) {partial_sum(begin(c), end(c), begin(c));}
template<class T> using heap=priority_queue<T,vector<T>,greater<T>>;
struct before_main_function {
    before_main_function() {
        cin.tie(nullptr); ios::sync_with_stdio(0);
        cout << setprecision(15) << fixed;
        // #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

signed main() {
    int H, W;
    cin >> H >> W;
    vector<string> S(H);
    cin >> S;

    vvi U(H, vi(W, 0)), L(H, vi(W, 0));
    vvi D(H, vi(W, 0)), R(H, vi(W, 0));
    rep(i, 0, H) {
        int tmp = 0;
        rep(j, 0, W) {
            if (S[i][j] == '#') tmp = 0;
            if (S[i][j] == '.') tmp++;
            L[i][j] = tmp;
        }
        tmp = 0;
        rrep(j, 0, W) {
            if (S[i][j] == '#') tmp = 0;
            if (S[i][j] == '.') tmp++;
            R[i][j] = tmp;
        }
    }
    rep(j, 0, W) {
        int tmp = 0;
        rep(i, 0, H) {
            if (S[i][j] == '#') tmp = 0;
            if (S[i][j] == '.') tmp++;
            U[i][j] = tmp;
        }
        tmp = 0;
        rrep(i, 0, H) {
            if (S[i][j] == '#') tmp = 0;
            if (S[i][j] == '.') tmp++;
            D[i][j] = tmp;
        }
    }

    int ans = 0;
    rep(i, 0, H) {
        rep(j, 0, W) {
            if (S[i][j] == '.') {
                chmax(ans, U[i][j] + D[i][j] + L[i][j] + R[i][j] - 3);
            }
        }
    }
    cout << ans << endl;
    return (0^_^0);
}



Measured memory_bytes: 129920
/**
     **author : _KMS_
     **created : 05-03-2020
**/
#include<bits/stdc++.h>
using namespace std;
const long long M =6e5,MOD=1e9+7;
typedef long long ll;
int arr[M];
int res;
int mx=M;
vector<int>v,v2,v3;
int in,in2,a;
int main() {
      
   ios::sync_with_stdio(false);
   cin.tie(0);
   int n;
   cin>>n;
   for(int i=0;i<n;i++){cin>>a;
   v.push_back(a);
   }
   for(int i=0;i<n;i++)
   {
         cin>>a;
         v2.push_back(a);
   }
   for(int i=1;i<=n;i++)v3.push_back(i);
   if(v==v3)in=1;
   if(v2==v3)in2=1;
   int cnt=2;
   while(next_permutation(v3.begin(),v3.end()))
   {
         if(v==v3)in=cnt;
         if(v2==v3)in2=cnt;
         cnt++;
         if(in&&in2)break;
   }
   cout<<abs(in-in2)<<"\n";
  
   
   return 0;
}

Measured memory_bytes: 256
#include<algorithm>
#include<iostream>
#include<map>
#include<vector>
int main(void) {
	std::ios_base::sync_with_stdio(false);
	int n, input;
	std::cin >> n;
	std::map<int, int>w;
	std::vector<int>vector(n+1,0);	
	for (int i = 1; i <= n; ++i) {
		std::cin >> input;
		vector[i] = input;
	}
	std::vector<int>vector_min= vector;
	std::sort(vector_min.begin(), vector_min.end());
	for (int i = 1; i <= n; ++i) {
		w[vector[i]] = vector_min[i];
	}
	std::map<int, int>w_1(w);
	int cnt = 0;
	for (int i = 1; i <= n; ++i) {
		int temp =0;
		while (vector_min[i] != w[vector_min[i]]) {
			temp += vector_min[i] + w[vector_min[i]] ;
			std::swap(w[vector_min[i]],w[w[vector_min[i]]] );
		}
		int temp_1 = static_cast<int>(1e5);
		if (i>1&&vector_min[i] != w_1[vector_min[i]]) {
			temp_1 =  vector_min[i]+ vector_min[1] ;

			std::swap(w_1[vector_min[i]], w_1[vector_min[1]]);
			while (vector_min[1] !=w_1[vector_min[1]]) {
				temp_1 += vector_min[1]+ w_1[vector_min[1]] ;
				std::swap(w_1[vector_min[1]], w_1[w_1[vector_min[1]]]); }
		}
		else if (i == 1 ) {
			while (vector_min[1] != w_1[vector_min[1]]) {
				temp_1 += vector_min[i] + w_1[vector_min[i]];
				std::swap(w_1[vector_min[i]], w_1[w_1[vector_min[i]]]);
			}			
		}
		cnt += std::min(temp, temp_1);
	}
	std::cout << cnt << std::endl;
	//system("pause");
	return 0;
}

Measured memory_bytes: 3200
import sys
sys.setrecursionlimit(10**9)
INF=10**18
def input():
    return sys.stdin.readline().rstrip()

def main():
    N=int(input())
    S=list(input())
    if N%2==0:
        for i in range(N//2):
            if S[i]!=S[N//2+i]:
                print('No')
                break
        else:
            print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()


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

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

constexpr int atcoder_mod = 1e9+7;

using namespace std;
using ll = long long;

template<typename T=int>
T in(){T x; cin >> x; return (x);}

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

	int a=in(),b=in(),c=in(),d=in();
	
	cout <<((abs(a-c)<=d || ((abs(a-b)<=d)&&(abs(b-c)<=d))) ? "Yes" : "No") << endl;
	return 0;
}


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

Measured memory_bytes: 128
n = int(input())
h = list(map(int,input().split()))
ans = 0
cnt = 0
before = h[0] - 1
for H in h:
    if H <= before:
        cnt += 1
    else:
        ans = max(cnt,ans)
        cnt = 0
    before = H
ans = max(cnt,ans)
print(ans)

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

using namespace std;

const int max_n = 5555, inf = 1000111222;

int n, k;
string s;

string getr(const string &s, int pos) {
    return {s.rbegin() + s.length() - 1 - pos, s.rbegin() + s.length() - 1 - pos + n};
}

string one_step(const string &s) {
    string rs = s;
    reverse(rs.begin(), rs.end());
    string t = s + rs;
    string res = s;
    for (int i = 1; i <= n; ++i) {
        res = min(res, t.substr(i, n));
    }
    return res;
}

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    cin >> n >> k >> s;
    --k;
    char mn = s[0];
    for (char c : s) {
        mn = min(mn, c);
    }
    if (k) {
        string rs = s;
        reverse(rs.begin(), rs.end());
        int mx = 0, pos = 0;
        string t = s + rs;
        for (int i = 0; i < t.length(); ++i) {
            int st = i;
            while (i < t.length() && t[i] == mn) {
                ++i;
            }
            int cnt = i - st;
            if (cnt == 0) {
                continue;
            }
            if (i >= n && (mx < cnt || mx == cnt && getr(t, pos) > getr(t, i - 1))) {
                pos = i - 1;
                mx = cnt;
            }
        }
        //cout << t << endl;
        //cout << mx << " " << pos << " " << getr(t, pos) << endl;
        s = getr(t, pos);
        reverse(s.begin(), s.end());
        --k;
        //cout << "$" << s << " " << k << endl;
        mx = min(mx, n);
        while (k--) {
            string rs = s;
            reverse(rs.begin(), rs.end());
            string t = s + rs;
            s = getr(t, s.length() + mx - 1);
            reverse(s.begin(), s.end());
            mx *= 2;
            mx = min(mx, n);
            if (mx == n) {
                break;
            }
        }
        //cout << s << endl;
    }
    cout << one_step(s) << endl;
    return 0;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var a, b, c string
	fmt.Scan(&a, &b, &c)

	if a[len(a)-1:len(a)] == b[0:1] && b[len(b)-1:len(b)] == c[0:1] {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}


Measured memory_bytes: 512
import sys
# import re
import math
import collections
# import decimal
import bisect
import itertools
import fractions
# import functools
import copy
# import heapq
import decimal
# import statistics
import queue

# import numpy as np

sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7
# MOD = 998244353

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===

def main():
    n, m, k = ns()
    a = na()
    b = na()

    perm_a = [0 for _ in range(n + 1)]
    perm_b = [0 for _ in range(m + 1)]

    for i, ai in enumerate(a):
        perm_a[i + 1] = perm_a[i] + ai

    for i, bi in enumerate(b):
        perm_b[i + 1] = perm_b[i] + bi

    perm_a.append(INF)
    perm_b.append(INF)

    ans = 0
    for i, pa in enumerate(perm_a):
        bserch = k - pa
        if bserch < 0:
            continue
        if bserch == 0:
            ans = max(ans, i)
            continue

        idx = bisect.bisect_left(perm_b, bserch)
        tmp_ans = i + idx - 1
        if perm_b[idx] == bserch:
            tmp_ans += 1
        ans = max(ans, tmp_ans)

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 49292
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <map>

#define debug_value(x) cerr << "line" << __LINE__ << ":<" << __func__ << ">:" << #x << "=" << x << endl;
#define debug(x) cerr << "line" << __LINE__ << ":<" << __func__ << ">:" << x << endl;

using namespace std;
typedef long long ll;
const ll MOD = 1000000007;


template <typename T>
T pow(T a, ll n) {
	T ans = 1;
	T tmp = a;
	for (int i = 0; i <= 60; i++) {
		ll m = (ll)1 << i;
		if (m & n) {
		ans *= tmp;
		ans %= MOD;
		}
		tmp *= tmp;
		tmp %= MOD;
	}
	return ans;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setprecision(10) << fixed;
    int N;
    cin >> N;
    ll ans = pow<ll>(10, N)-2*pow<ll>(9, N)+pow<ll>(8, N);
    ans %= MOD; ans += MOD; ans %= MOD;
    cout << ans << endl;
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 110;
ll n, k;
int main()
{
    //freopen("/Users/zhangkanqi/Desktop/11.txt","r",stdin);
    cin >> n >> k;
    if(n%k==0) printf("0\n");
    else
    {
        n = n%k;
        printf("%lld\n", min(n, abs(k-n)));
    }
    return 0;
}

Measured memory_bytes: 256
/*author: hyperion_1724
  date: 
*/

//Required Libraries

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>

//Required namespaces

using namespace std;
using namespace __gnu_pbds;

//Required defines

#define endl '\n'

#define READ(X) cin>>X;
#define READV(X) long long X; cin>>X;
#define READAR(A,N) long long A[N]; for(long long i=0;i<N;i++) {cin>>A[i];}
#define rz(A,N) A.resize(N);
#define sz(X) (long long)(X.size())
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define trav(x,A) for(auto &x:A)
#define veci vector<int>
#define vecl vector<long long>
#define FORI(a,b,c) for(long long a=b;a<c;a++)
#define FORD(a,b,c) for(long long a=b;a>c;a--)

//Required typedefs

typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef tree<long long,null_type,greater<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set1;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<long,long> pll;

//Required Constants

const long long inf=(long long)1e18;
const long long MOD=(long long)(1e9+7);
const long long INIT=(long long)(1e6+1);

//Required Functions

ll power(ll x,ll y) 
{ 
	if (y == 0) 
		return 1; 
	ll p = power(x, y/2) % MOD; 
	p = (p * p) % MOD; 
  
	return (y%2 == 0)? p : (x * p) % MOD; 
}
ll modInverse(ll a) 
{ 
   return power(a,MOD-2); 
   
}

//Work

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

	READV(N);
	map<string,ll> F;
	FORI(i,0,N)
	{
		string S;
		READ(S);
		sort(S.begin(),S.end());
		F[S]++;
	}
	ll ans=0;
	trav(x,F)
	{
		ans+=(x.se*(x.se-1)/2);
	}
	cout<<ans<<endl;

	return 0;
}

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

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i <= n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(),(v).end()

using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;

const string YES = "Yes";
const string NO = "No";
const ll mod = 1e9+7;


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

    ll n, m; cin >> n >> m;
    vector<double> a(n);
    double sm = 0.0;
    REP(i,n) {cin >> a[i]; sm += a[i];}
    VSORTR(a);
    if (a[m-1] < sm / (4*m)) {
        cout << "No";
        return 0;
    }

    cout << "Yes";
    return 0;
    
}



Measured memory_bytes: 256
// _______  _____  _______  _____  _______ _______ _____ _______ _____ _    _ _______ 
// |       |     | |  |  | |_____] |______    |      |      |      |    \  /  |______ 
// |_____  |_____| |  |  | |       |______    |    __|__    |    __|__   \/   |______ 
//
//  _____   ______  _____   ______  ______ _______ _______ _______ _____ __   _  ______   /
// |_____] |_____/ |     | |  ____ |_____/ |_____| |  |  | |  |  |   |   | \  | |  ____  / 
// |       |    \_ |_____| |_____| |    \_ |     | |  |  | |  |  | __|__ |  \_| |_____| .  
//
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define FOR(I,A,B) for(int I = int(A); I < int(B); ++I)
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //ai>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //ai>v  x is sorted
ll gcd(ll a,ll b){if(a<b)swap(a,b);if(a%b==0)return b;return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}//saisyo kobaisu
const ll INF=1e18+7;
const ll MOD=1e9+7;

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

	ll N,K,ans=0;
	cin >> N >> K;
	if(K==0){
		cout << N*N << endl;
		return 0;
	}
	FOR(b,K+1,N+1){
		ll n = N/b;
		ans += n*(b-K);
		if(N>=b*n+K){
			ans += N-b*n-K+1;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    K, N = [int(x) for x in input().split()]
    A = [int(x) for x in input().split()]
    m = 0

    for a, b in zip(A, A[1:]):
        m = max(m, abs(a - b))

    m = max(m, A[0] + (K - A[-1]))

    print(K - m)



if __name__ == '__main__':
    main()


Measured memory_bytes: 24908
#include <iostream>
using namespace std;
int main(){
    long long X;
    cin >> X;
    long long A, B;
    for(int i=-120; i<120; i++){
        for(int j=-120; j<120; j++){
            if(i*i*i*i*i - j*j*j*j*j == X){
                A=i;
                B=j;
                break;
            }
        }
    }
    cout << A <<" "<< B << endl;
      
    
}

Measured memory_bytes: 3616
var
  n, i, answer, old: Integer;
  d: array [1 .. 100 + 1] of Integer;

procedure BubbleSort();
var
  i, j, temp: Integer;
begin
  for i := 1 to n - 1 do
  begin
    for j := i + 1 to n do
    begin
      if (d[j] < d[i]) then
      begin
        temp := d[i];
        d[i] := d[j];
        d[j] := temp;
      end;
    end;
  end;
end;

begin
  // Nを教えてもらう
  readln(n);

  // N枚読み込む
  for i := 1 to n do
  begin
    readln(d[i]);
  end;

  // ソート
  BubbleSort();

  answer := 0;
  old := -1; // 最初のd[i]が新発見になるように、d[i]に出てこない値を覚えておく

  // 数値の種類数を調べる
  for i := 1 to n do
  begin
    if (d[i] <> old) then
    begin
      // 知らない数値だったのでカウントアップ
      Inc(answer);
      // 次の比較のために今の値を覚えておく
      old := d[i];
    end;
  end;

  // 回答する
  writeln(answer);

end.


Measured memory_bytes: 128
import java.math.BigInteger;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        Main m = new Main();
        m.resolve(scan);
        scan.close();
    }

    final private void resolve(Scanner scan) {
        long a = scan.nextLong(), b = scan.nextLong(), n = scan.nextLong();
        long x = Math.min(b - 1, n);
        System.out.println(a * x / b - a * (x / b));
    }
}

Measured memory_bytes: 35696
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define all(x) (x).begin(), (x).end()
#define PI 3.14159265358979323846264338327950L
using namespace std;
typedef long long ll;
typedef long double ld;
int main() {
    int n;
    cin>>n;
    pair<pair<string,int>,int> pair[n];
    string s; int p;
    rep(i,n){
        cin>>s>>p;
        pair[i]=make_pair(make_pair(s,-p),i);//-1倍
    }
    sort(pair,pair+n);//辞書順かつ得点が高い順
    rep(i,n) cout<<pair[i].second+1<<endl;
}

Measured memory_bytes: 3616
#include<iostream>

int main(){
    char s[4];
    int a;
    int b = 0;

    for(a = 0; a < 4; a++){
        std::cin >> s[a];
    }

    for(a = 0; a < 3; a++){
        if(s[a] == s[a + 1]){
            b++;
        }
    }

    if(b > 0){
        std::cout << "Bad" << std::endl;
    }else{
        std::cout << "Good" << std::endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const double PI = acos(-1);
int32_t main() {

    ios_base::sync_with_stdio(0); cin.tie(0);
    cout.precision(2); cout << fixed;

    int R; cin >> R;

    cout << PI*(2*R) << "\n";

}


Measured memory_bytes: 3752
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define fi first
#define se second
#define pb push_back
signed main(){
    ll r,g,b,n,ans=0;
    cin >> r>>g>>b>>n;
    for(int i=0;r*i<=n;i++)
    {
        for(int j=0;r*i+g*j<=n;j++)
        {
            if((n-r*i-g*j)%b==0){
                ans++;
            }
        }
    }
    cout << ans << endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i = 0; i < (N); i++)
#define repo(i,N) for(int i = 1; i < (N); i++)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
//#define num 1000000007
#define pi acos(-1.0)
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//#define int long long

int main() {
  int a;
  cin >>a;
  
  if(a==1) puts("Hello World");
  else {
  int b,c;
  cin >> b>>c;
  cout << b+c << endl;
  }
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
 int n,i,j,k,num,kou=0,min;
 int A[101];

/*????´??????°?????\???*/
 scanf("%d",&n);

/*??????????????\???*/
 for(i=0;i<n;i++){
  
 if(i==n-1){
    scanf("%d",&A[n-1]);
   }else{
    scanf("%d ",&A[i]);
   }

 }




/*?????????*/
 for(i=0;i<n-1;i++){
min=101;
 for(j=i;j<n;j++){
  if(A[j]<min){
   min=A[j];
   num=j;
   }
 }

 if(num!=i){
  A[num]=A[i];
  A[i]=min;
  kou+=1;
 }

 }






/*??¨???*/
 for(k=0;k<n-1;k++){
  printf("%d ",A[k]);
 }
  printf("%d\n",A[n-1]);
  printf("%d\n",kou);


return 0;
}

Measured memory_bytes: 1836
n, m = map(int,input().split())

if abs(n-m) <= 1:
  sumN = 1
  sumM = 1 
  for i in range(2,n+1):
    sumN = sumN*i % (10**9+7) 
  for i in range(2,m+1):
    sumM = sumM*i % (10**9+7) 
  if n==m:
    print(2*sumM*sumN % (10**9+7))
  else:
    print(sumM*sumN % (10**9+7))
else:
  print(0)


Measured memory_bytes: 3060
#pragma comment (linker, "/STACK:526000000")
#define  _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"

using namespace std;
typedef string::const_iterator State;
#define eps 1e-11L
#define MAX_MOD 1000000007LL
#define GYAKU 500000004LL

#define MOD 998244353LL
#define seg_size 262144
#define pb push_back
#define mp make_pair
typedef long long ll;
#define REP(a,b) for(long long (a) = 0;(a) < (b);++(a))
#define ALL(x) (x).begin(),(x).end()

void init() {
	iostream::sync_with_stdio(false);
	cout << fixed << setprecision(100);
}

#define int ll
ll comb(int a, int b) {
	if (a < b) return 0;
	ll ans = 1;
	REP(i, b) {
		ans *= a - i;
		ans /= i + 1LL;
	}
	return ans;
}

void solve(){
	string n;
	int k;
	cin >> n >> k;
	ll ans = 0;
	for (int i = 0; i < n.length(); ++i) {
		if (n[i] != '0') {
			//n[i] = '0'の場合
			ans += comb(n.length() - i - 1, k) * pow(9LL, k);
			//not 0
			k--;
			if (k == -1) {
				break;
			}
			ans += comb(n.length() - i - 1, k) * pow(9LL, k) * (long long)(n[i] - '1');
		}
	}
	if (k == 0) {
		ans++;
	}
	cout << ans << endl;
}
#undef int
int main() {
	init();
	solve();
}

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

int main(){
  
  int n;
  string s;
  cin >> n >> s;
  int t=0;
  for(int i=0;i<n;){
    int j=i;
    while(j<n && s[i]==s[j]) j++;
    t++;
    i=j;
  }
  
  cout<<t;
  
}


Measured memory_bytes: 512
#include <stdio.h>
#include <algorithm>
#include <bitset>
using namespace std;

bitset<6400> D[80][80];
int N, M, X[80][80];

int main()
{
	scanf ("%d %d", &N, &M);
	for (int i = 0; i < N; i++) for (int j = 0; j < M; j++) scanf ("%d", &X[i][j]);
	for (int i = 0; i < N; i++) for (int j = 0, x; j < M; j++) scanf ("%d", &x), X[i][j] = abs(X[i][j] - x);

	for (int i = 0; i < N; i++) for (int j = 0; j < M; j++){
		bitset<6400> t;
		if (i == 0 && j == 0) t[0] = 1;
		if (i) t |= D[i - 1][j];
		if (j) t |= D[i][j - 1];
		D[i][j] |= (t << X[i][j]);
		D[i][j] |= (t >> X[i][j]);
		for (int k = 0; k <= X[i][j]; k++) if (t[k]) D[i][j][X[i][j] - k] = 1;
	}

	for (int i = 0;; i++) if (D[N - 1][M - 1][i]){
		printf ("%d\n", i);
		break;
	}
	return 0;
}

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

int main(){
	int a,b,t;
	cin >> a >> b >> t;
	int res = 0;
	for(int i = 1; i <= t; i++){
		if(i % a == 0)res += b;
	}
	cout << res << endl;
}

Measured memory_bytes: 256
import sys
def t(A,p,r):
 x=A[r][1];i=p-1
 for j in range(p,r):
  if A[j][1]<=x:i+=1;A[i],A[j]=A[j],A[i]
 A[i+1],A[r]=A[r],A[i+1]
 return i+1
def k(A,p,r):
 if p<r:q=t(A,p,r);k(A,p,q-1);k(A,q+1,r)
def s(A):
 for i in range(n-1):
  if A[i][1]==A[i+1][1]and A[i][2]>A[i+1][2]:return'Not s'
 return'S'
n=int(input())
A=[(e[0],int(e[2:]),i)for i,e in enumerate(sys.stdin)]
k(A,0,n-1)
print(s(A)+'table')
print('\n'.join(f'{a} {b}'for a,b,_ in A))


Measured memory_bytes: 26988
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(int)(a); (i)<(int)(b); ++(i))
#define rFor(i, a, b) for(int (i)=(int)(a)-1; (i)>=(int)(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> pii;
typedef pair<lint, lint> pll;
template<class T> bool chmax(T &a, const T &b){if(a<b){a=b; return true;} return false;}
template<class T> bool chmin(T &a, const T &b){if(a>b){a=b; return true;} return false;}
template<class T> T div_floor(T a, T b){
    if(b < 0) a *= -1, b *= -1;
    return a>=0 ? a/b : (a+1)/b-1;
}
template<class T> T div_ceil(T a, T b){
    if(b < 0) a *= -1, b *= -1;
    return a>0 ? (a-1)/b+1 : a/b;
}

constexpr lint mod = 1e9+7;
constexpr lint INF = mod * mod;
constexpr int MAX = 200010;

int main(){
    int n;
    scanf("%d", &n);
    if(n == 1) printf("%d\n%d\n", 1, 0);
    else if(n == 2) printf("%d\n%d\n%d\n", 2, 0, 11);
    else{
        printf("%d\n", n-1);
        For(i, 2, n+1){
            printf("%d", 1);
            rep(j, i-2) printf("%d", 0);
            printf("%d\n", 1);
        }
    }
}


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



signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);
    
    
    ll n;
    cin>>n;
    ll p[n];
    ll a[n+1]={},b[n+1]={};
    for(int i=0;i<n;i++){
        cin>>p[i];
    }
    reverse(p,p+n);
    for(int i=0;i<n;i++){
        a[p[i]]+=i+1;
        b[0]+=i+1,b[p[i]-1]-=i+1;
    }
    for(int i=0;i<n;i++){
        a[i+1] += a[i];
        b[i+1] += b[i];
        //cout << a[i] << " ";
    }
    // cout << endl;
    // for(int i=0;i<n;i++){
    //     cout << b[i] << " ";
    // }
    //cout << endl;
    for(int i=0;i<n;i++){
        a[i] += i+1;
        b[i] += n-i;
    }
    
    for(int i=0;i<n;i++){
        cout << a[i] << " ";
    }
    cout << endl;
    for(int i=0;i<n;i++){
        cout << b[i] << " ";
    }
    cout << endl;


}

Measured memory_bytes: 1152
# coding: utf-8
# Your code here!
import math
K = int(input())
Ln = [[]]
Ln[0] = [1 for i in range(10)]
for i in range(1,10):
    tmp =[Ln[i-1][0] + Ln[i-1][1]] + [Ln[i-1][j-1] + Ln[i-1][j] + Ln[i-1][j+1] for j in range(1,9)] +[Ln[i-1][8] + Ln[i-1][9] ]
    Ln.append(tmp)


X = K
Y = 0
fin =(-1,-1)
flag = 1
for i in range(10):
    for j in range(1,10):
        Y = X
        X -= Ln[i][j]

        if X<=0 : 
            fin = (i,j)
            flag = 0
            break
        
    if flag == 0:
        break

ans = 10**i * j 

p=i

for i in range(p-1,-1,-1):
    X = Y
    flag = 1

    if j==0 :
        lis = [0,1]
    elif j==9:
        lis = [8,9]
    else:
        lis = [j-1,j,j+1]
    for j in lis:
        Y = X
        X -= Ln[i][j]

        if X<=0:
            ans += 10**i * j

            flag = 0
        if flag == 0:
            break
print(ans)
        
        

    

Measured memory_bytes: 3064
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cstring>
#include<string>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<map>
#include<set>
using namespace std;
const int inf=1e9,dx[]={-1,0,1,0},dy[]={0,-1,0,1};
const long long llinf=1e18;
string s;
long long num,ans;
int l;
int main(){
	cin>>s;
	l=s.size();
	for(int i=0;i<(1<<(l-1));i++)
	{
		num=s[0]-'0';
		for(int j=0;j<(l-1);j++)
		{
			if(i&(1<<j))
			{
				ans+=num;
				num=0;
			}
			num=num*10+(s[j+1]-'0');
		}
		ans+=num;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int a,b,i,j,n;

int main(){
	while(scanf("%d",&n)!=EOF){
		a=b=n;
		while(a--){
			j=0;
			for(i=2;i<a;i++)if(a%i==0)j=1,i=a;
			if(j==0)break;
		}
		while(b++){
			j=0;
			for(i=2;i<b;i++)if(b%i==0)j=1,i=b;
			if(j==0)break;
		}
		printf("%d %d\n",a,b);
	}
	
	return 0;
}

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

int main(){
  string S;
  cin >> S;
  if (S == "SUN"){
    cout << 7 << endl;
  }
  else if (S == "MON"){
    cout << 6 << endl;
  }
  else if (S == "TUE"){
    cout << 5 << endl;
  }
  else if (S == "WED"){
    cout << 4 << endl;
  }
  else if (S == "THU"){
    cout << 3 << endl;
  }
  else if (S == "FRI"){
    cout << 2 << endl;
  }
  else if (S == "SAT"){
    cout << 1 << endl;
  }
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"io"
	"log"
	"os"
	"strconv"
)

// algorithm: bfs
func main() {
	n, m := readInt(), readInt()

	mat := make([][]int, n)
	for i := range mat {
		mat[i] = make([]int, 0)
	}

	for i := 0; i < m; i++ {
		a, b := readInt()-1, readInt()-1
		mat[a] = append(mat[a], b)
		mat[b] = append(mat[b], a)
	}

	q := make([]int, 0, n)
	q = append(q, 0)
	ans := make([]int, n)
	ans[0] = -1
	for len(q) > 0 {
		cur := q[0]
		q = q[1:]
		for _, next := range mat[cur] {
			if ans[next] != 0 {
				continue
			}
			ans[next] = cur + 1
			q = append(q, next)
		}
	}

	fmt.Println("Yes")
	for i := range ans[1:] {
		fmt.Println(ans[i+1])
	}
}

func main0() {
	n, m := readInt(), readInt()

	mat := make(map[int][]int)
	for i := 0; i < m; i++ {
		a, b := readInt(), readInt()
		if _, ok := mat[a]; !ok {
			mat[a] = make([]int, 0)
		}
		mat[a] = append(mat[a], b)
		if _, ok := mat[b]; !ok {
			mat[b] = make([]int, 0)
		}
		mat[b] = append(mat[b], a)
	}

	nexts := make([]move, len(mat[1]))
	for i := range mat[1] {
		nexts[i] = move{mat[1][i], 1}
	}

	visited := map[int]bool{1: true}
	ans := make([]int, n)
	for len(nexts) > 0 && len(visited) < n {
		tmpNexts := make([]move, 0)
		// fmt.Println(nexts)
		for i := range nexts {
			if visited[nexts[i].cur] {
				continue
			}
			visited[nexts[i].cur] = true

			ans[nexts[i].cur-1] = nexts[i].pre

			if _, ok := mat[nexts[i].cur]; !ok {
				continue
			}
			for j := range mat[nexts[i].cur] {
				tmpNexts = append(tmpNexts, move{mat[nexts[i].cur][j], nexts[i].cur})
			}
		}
		nexts = tmpNexts
	}

	fmt.Println("Yes")
	for i := range ans[1:] {
		fmt.Println(ans[i+1])
	}
}

type move struct {
	cur int
	pre int
}

var (
	readString func() string
	readBytes  func() []byte
)

func init() {
	log.SetFlags(log.Lshortfile)
	readString, readBytes = newReadString(os.Stdin)
}

func newReadString(ior io.Reader) (func() string, func() []byte) {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	f1 := func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
	f2 := func() []byte {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Bytes()
	}
	return f1, f2
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readInt() int {
	return int(readInt64())
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(readString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func sum(a []int) int {
	var ret int
	for i := range a {
		ret += a[i]
	}
	return ret
}

func sumFloat64(a []float64) float64 {
	var ret float64
	for i := range a {
		ret += a[i]
	}
	return ret
}

func gcd(m, n int) int {
	for m%n != 0 {
		m, n = n, m%n
	}
	return n
}

func lcm(m, n int) int {
	return m / gcd(m, n) * n
}


Measured memory_bytes: 15664
import java.util.*;
public class Main {
	static Scanner sc = new Scanner(System.in); 
	static int n;
	public static void main(String[] args) {
		while(read()){
			solve();
		}
	}
	
	static boolean read(){
		if(!sc.hasNext())return false;
		n = sc.nextInt();
		return true;
	}
	
	static void solve(){
		int res = 0;
		for(int a = 0; a < 10; a++){
			for(int b = 0; b < 10; b++){
				for(int c = 0; c < 10; c++){
					for(int d = 0; d < 10; d++){
						if(a+b+c+d == n)res++;
					}
				}
			}
		}
		System.out.println(res);
	}
}

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

void query(deque<char> &l, deque<char> &r, bool &reversed, bool &l_reversed, bool &r_reversed)
{
  int T;
  cin >> T;
  if (T == 1)
  {
    reversed = !reversed;
    swap(l, r);
    swap(l_reversed, r_reversed);
    if (l.size() > 1)
    {
      l_reversed = !l_reversed;
    }
    if (r.size() > 1)
    {
      r_reversed = !r_reversed;
    }
  }
  else
  {
    int F;
    cin >> F;
    char c;
    cin >> c;
    if (F == 1)
    {
      if (l_reversed)
      {
        l.push_back(c);
      }
      else
      {
        l.push_front(c);
      }
    }
    else
    {
      if (r_reversed)
      {
        r.push_front(c);
      }
      else
      {
        r.push_back(c);
      }
    }
  }
}

void show_ans(deque<char> &l, deque<char> &r, string &S, bool reversed, bool l_reversed, bool r_reversed)
{
  if (l_reversed)
  {
    for (int i = 0; i < l.size(); i++)
    {
      cout << l.at(l.size() - i - 1);
    }
  }
  else
  {
    for (int i = 0; i < l.size(); i++)
    {
      cout << l.at(i);
    }
  }
  if (reversed)
  {
    reverse(S.begin(), S.end());
  }
  cout << S;
  if (r_reversed)
  {
    for (int i = 0; i < r.size(); i++)
    {
      cout << r.at(r.size() - i - 1);
    }
  }
  else
  {
    for (int i = 0; i < r.size(); i++)
    {
      cout << r.at(i);
    }
  }
  cout << endl;
}

int main()
{
  string S;
  int Q;
  cin >> S >> Q;
  bool reversed = false;
  bool l_reversed = false;
  bool r_reversed = false;
  deque<char> l, r;
  for (int i = 0; i < Q; i++)
  {
    query(l, r, reversed, l_reversed, r_reversed);
  }
  show_ans(l, r, S, reversed, l_reversed, r_reversed);
}

Measured memory_bytes: 896
#include <iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int main()
{
    string s, t, u;
    int snum, tnum;
    cin >> s >> t;
    cin >> snum >> tnum;
    cin >> u;
    if(s == u) snum--;
    if(t == u) tnum--;
    cout << snum << " " << tnum << endl;
    return 0;
}

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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

//#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

int gcd(int x, int y)
{
	int a = x, b = y, t = a%b;
	while (t > 0)
	{
		a = b;
		b = t;
		t = a%b;
	}
	return b;
}

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

	int x, y;
	cin >> x >> y;

	int r0 = x, r1 = y, a0 = 1, a1 = 0, b0 = 0, b1 = 1;
	while (r1 > 0)
	{
		int q1 = r0 / r1;
		int r2 = r0%r1;
		int a2 = a0 - q1*a1;
		int b2 = b0 - q1*b1;
		r0 = r1, r1 = r2, a0 = a1, a1 = a2, b0 = b1, b1 = b2;
	}
	cout << a0 <<" "<< b0 << endl;
	return 0;
}


Measured memory_bytes: 3236
def main():
    n, k = map(int, input().split())
    num_list = list(map(int, input().split()))

    ans = 10**19

    for bit in range(2**n):
        if bin(bit).count('1') != k:
            continue
        tmp = 0
        max_hight = 0
        for i in range(n):
            if bit & (1 << i) == 0:
                if max_hight < num_list[i]:
                    max_hight = num_list[i]
                # max_hight = max(max_hight, num_list[i])
                continue
            if max_hight >= num_list[i]:
                tmp += max_hight - num_list[i] + 1
                max_hight += 1
            else:
                max_hight = num_list[i]
            
        if ans > tmp:
            ans = tmp
        # ans = min(ans, tmp)
    
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 40924
using System;
using static System.Console;
using static System.Math;

public class Hello{
    public static void Main(){
        string[] num = ReadLine().Split(' ');
        int[] check = new int[100];
        for(int i = 0;i<num.Length;i++){
            int a = int.Parse(num[i]);
            check[a-1]++;
        }
        int ans = 0;
        for(int i=0;i<100;i++){
            if(check[i] > 0){
                ans++;
            }
        }
        WriteLine(ans);
    }
}


Measured memory_bytes: 13140
#include<bits/stdc++.h>
using namespace std;
int main(){
   long long N, A, B;
  cin >> N >> A >> B;
  
  if(N%(A+B) >= A){
 cout << (N/(A+B))*A+A <<endl;
  }
  else{
  cout << (N/(A+B))*A+(N%(A+B)) << endl;
  }
}


Measured memory_bytes: 256
import sys
from collections import Counter
N,K,Q=map(int, raw_input().split())
A=[ int(sys.stdin.readline().strip()) for _ in range(Q) ]


C=Counter(A)


L=[ K-Q for _ in range(N) ]

for i,v in C.items():
	L[i-1]+=v

for x in L:
	if 0<x:
		print "Yes"
	else:
		print "No"


Measured memory_bytes: 48284
parse_input(type=String, x=readline()) = begin
  type == String && return x
  parse(type, x)
end
parse_inputs(type=String) = parse_input.(type, split(readline()))

function solve()
  S = parse_input()
  T = parse_input()
  smax = 0
  for i in 1:length(S)-length(T)+1
    s = 0
    for j in 1:length(T)
      if S[i+j-1] == T[j]
        s += 1
      end
    end
    if smax < s
      smax = s
    end
  end
  length(T) - smax
end

println(solve())


Measured memory_bytes: 158292
// 基本のinclude
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <math.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define invrep(i,n) for(int i = (int)(n); i > 0; i++)
using ll = long long;

int main() {
    string n;
    cin >> n;
    ll ans = 0;
    rep(i, n.size()) ans += n[i] - '0';
    if (ans % 9 == 0) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3720
inp = require('fs').readFileSync('/dev/stdin', 'utf8').trim().split('\n')
l = inp.shift().split(" ")
N = l.shift() * 1
M = l.shift() * 1
X = l.shift() * 1

for(i=0;i<N;i++) {
    inp[i] = inp[i].split(" ").map(x => +x)
}


a = [[0], [1]]
c = []

while(a.length > 0) {
    b = a.pop()
    if (b.length == N) {
        d = 0
        e = []
        for(i=0;i<N;i++) {
            if (b[i]) {
                d += inp[i][0]
                for(j=0;j<M;j++) {
                    e[j] = (e[j] || 0) + inp[i][j+1]
                }
            }
        }
        f = 1
        for(j=0;j<M;j++) {
            if (e[j] >= X) {
                f = f && 1
            } else {
                f = f && 0
            }
        }
        if (f) {
            c.push(d)
        }
    } else {
        a.push(b.concat(0))
        a.push(b.concat(1))
    }
}
c = c.sort((a,b) => a - b)
console.log(c.length === 0 ? -1 : c[0])

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

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
const int INF = 1<<29;

int main() {
  int n;
  while(scanf("%d",&n), n) {
    vector<pair<int,int> > v;
    REP(i,n) {
      REP(k,2) {
        int h,m,s;
        scanf("%d:%d:%d ", &h,&m,&s);
        v.push_back(make_pair(h*3600+m*60+s, 1-k));
      }
    }
    sort(ALL(v));
    int res = 0;
    int cnt = 0;
    REP(i,v.size()) {
      int t = v[i].first;
      int k = v[i].second;

      if (k) {
        cnt++;
      } else
        cnt--;
      res = max(res, cnt);
    }
    cout << res << endl;
  }
}

Measured memory_bytes: 1132
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int T = scan.nextInt();
		long []A = new long[T];
		long []B = new long[T];
		long []C = new long[T];
		long []D = new long[T];

		for(int i = 0; i < T; i++) {
			A[i] = scan.nextLong();
			B[i] = scan.nextLong();
			C[i] = scan.nextLong();
			D[i] = scan.nextLong();
		}
		scan.close();
		StringBuilder sb = new StringBuilder();
		for(int i = 0; i < T; i++) {
			if(B[i] > A[i] || B[i] > D[i]) {
				sb.append("No");
			}else if(C[i] >= B[i] - 1) {
				sb.append("Yes");
			}else {
				long g = gcd(B[i], D[i]);
				long l = A[i] - B[i] + 1;
				long r = A[i] - C[i] - 1;
				long q = 0;
				long k = (r - q + g) / g - (l - q + g - 1) / g;
				if(k > 0) {
					sb.append("No");
				}else {
					sb.append("Yes");
				}
			}
			sb.append("\n");
		}
		System.out.print(sb.toString());
	}
	static long gcd(long m, long n) {
		if(m < n) return gcd(n, m);
		if(n == 0) return m;
		return gcd(n, m % n);
	}
}

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

//ABC117A
int main(void) {
  int n, k, i,t,x, cou=0, tmp;
  scanf("%d %d", &t,&x);
  printf("%lf",(double)t/x);
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
// Welcome to my source code!

const int INF = 1e9;

struct UnionFind {
    vector<int> d;
    UnionFind(int n): d(n, -1) {}
    int root(int x) {
        if (d[x] < 0) return x;
        return d[x] = root(d[x]);
    }
    bool unite(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (d[x] > d[y]) swap(x, y);
        d[x] += d[y];
        d[y] = x;
        return true;
    }
    bool same(int x, int y) { return root(x) == root(y); }
    int size(int x) { return -d[root(x)]; }
};

int main() {
    int n, m, k;
    cin >> n >> m >> k;
    UnionFind uf(n);
    int g[n];
    fill(g, g + n, INF);
    bool flag = false;
    int ans = 0;
    for (int i = 0, r, a, b, c, x; i < k; i++) {
        cin >> r;
        if (r == 1) {
            cin >> a >> b;
            if (flag) continue;
            a--; b--;
            int t1 = uf.root(a), t2 = uf.root(b);
            if (t1 != t2) {
                uf.unite(a, b);
                int t3 = uf.root(a);
                if (g[t1] != g[t2]) {
                    if (g[t1] == INF) g[t3] = g[t2];
                    else if (g[t2] == INF) g[t3] = g[t1];
                    else {
                        ans = i + 1;
                        flag = true;
                    }
                }
            }
        } else {
            cin >> c >> x;
            if (flag) continue;
            c--; x--;
            int t = uf.root(c);
            if (g[t] == INF) g[t] = x;
            else if (g[t] != x) {
                ans = i + 1;
                flag = true;
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3552
import sys
import math
from collections import deque

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()
NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()


def make_grid(h, w, num): return [[int(num)] * w for _ in range(h)]


def main():
	A, B, C, D, E, F = NMI()
	W = []
	for i in range(31):
		for j in range(16):
			if 0 < (A*i + B*j) * 100 <= F:
				W.append(A*i + B*j)
	W = set(W)
	S = set()
	for i in range(3001):
		if C*i > 30 * E:
			break
		for j in range(1501):
			if 0 < C*i + D*j <= 30 * E:
				S.add(C*i + D*j)
	con = 0
	ans = [100*A, 0]
	for w in W:
		for s in S:
			if s <= F - 100 * w and s <= w * E and 100 * s / w >= con:
				con = 100 * s / w
				ans = [100*w + s, s]
	print(ans[0], ans[1])



if __name__ == "__main__":
	main()

Measured memory_bytes: 3552
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, n) for(int i = 0; i < n; i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define fi first
#define se second
#define pb push_back
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; }
const int INF = (1<<30) - 1;
const ll LINF = (1LL<<60) - 1;

void solve() {
    int n, x, y;
    cin >> n >> x >> y;
    x--; y--;
    int cnt[2020] = {0};
    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            int d = min({j - i, abs(x-i) + 1 + abs(y-j)});
            cnt[d]++;
        }
    }
    for(int i = 1; i < n; i++) {
        cout << cnt[i] << endl;
    }
}

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

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

typedef long long int ll;
int main(){
    ll a, b; ll v,w;
    cin>>a>>v;
    cin>>b>>w;
    ll t; cin>>t;
    ll t1 = abs(a-b);
    ll t2 = (v-w)*t;
    if(t1<=t2){
        cout<<"YES";
    }
    else{
        cout<<"NO";
    }
    return 0;
}

Measured memory_bytes: 3632
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
//#include <chrono> //1e+9で割る auto end= chrono::system_clock::now()-st;  cout<<end.count()%1e+9<<endl;
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> LP;
typedef long double db;

#define fr first
#define sc second
#define pb push_back
#define rep(i,x) for(int i=0;i<x;i++)
#define rep1(i,x) for(int i=1;i<=x;i++)
#define rrep(i,x) for(int i=x-1;i>=0;i--)
#define rrep1(i,x) for(int i=x;i>0;i--)

int N,M;
int s[100000],t[100000],c[100000];
bool b[30][300000];
vector<int> v;

int main()
{
	cin>>N>>M;
	rep(i,N){
		cin>>s[i]>>t[i]>>c[i];
		c[i]--;
		v.pb(s[i]-1);
		v.pb(s[i]);
		v.pb(s[i]+1);
		v.pb(t[i]-1);
		v.pb(t[i]);
		v.pb(t[i]+1);
	}
	sort(v.begin(),v.end());
	v.erase(unique(v.begin(),v.end()),v.end());
	rep(i,N){
		s[i]=lower_bound(v.begin(),v.end(),s[i])-v.begin();
		t[i]=lower_bound(v.begin(),v.end(),t[i])-v.begin();
		for(int j=s[i];j<=t[i];j++) b[c[i]][j]=1;
	}
	int ans=0,cnt;
	rep(i,v.size()){
		cnt=0;
		rep(j,30) if(b[j][i]) cnt++;
		ans=max(ans,cnt);
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 12652