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

using namespace std;
#define inf             0x3f3f3f3f
#define INF             2e18
#define eps             1e-9

#define FastRead        ios_base::sync_with_stdio(0);cin.tie(0)
#define fRead           freopen("input.txt","r",stdin)
#define fWrite          freopen("output.txt","w",stdout)

#define LL              long long
#define ull            unsigned long long
#define PI              acos(-1.0)
#define pb              push_back
#define mk              make_pair
#define pii             pair<int,int>
#define pLL             pair<LL,LL>
#define ff              first
#define ss              second
#define all(a)          a.begin(),a.end()
#define SQR(a)          ((a)*(a))
#define min3(a,b,c)     min(a,min(b,c))
#define max3(a,b,c)     max(a,max(b,c))
#define min4(a,b,c,d)   min(min(a,b),min(c,d))
#define max4(a,b,c,d)   max(max(a,b),max(c,d))
#define max5(a,b,c,d,e) max(max3(a,b,c),max(d,e))
#define min5(a,b,c,d,e) min(min3(a,b,c),min(d,e))
#define vi              vector <int>
#define vL              vector <LL>
#define LB(a,x)         (lower_bound(all(a),x)-a.begin()) //  first element in the range [first,last) which does not compare less than val.
#define UB(a,x)         (upper_bound(all(a),x)-a.begin()) //  first element in the range [first,last) which compares greater than val.
#define prec(n)         fixed << setprecision(n)

#define MEM(a,x)        memset(a,x,sizeof(a))
#define SORT(v)         sort(v.begin(),v.end())
#define REV(v)          reverse(v.begin(),v.end())
#define Unique(a)       sort(all(a)),a.erase(unique(all(a)),a.end())

#define FOR(i,a,b)      for(int i=a;i<=b;i++)
#define ROF(i,a,b)      for(int i=a;i>=b;i--)
#define REP(i,b)        for(int i=0;i<b;i++)
#define IT(it,x)	    for(it=x.begin();it!=x.end();it++)

int main()
{

   LL a,b,n;
   cin>>a>>b>>n;
   LL ans=a*min(n,b-1);
   ans=ans/b;
   cout<<ans;
}


Measured memory_bytes: 3588
#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>
#include <algorithm>
using namespace std;
#define mp  std::make_pair
#define ll long long int
#define abs(n) ((n>0)?(n):((n)*(-1)))
#define CEIL(a,b) (((a) + ((b)-1)) / (b))
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,(n)-1)
#define VREP_ll(v) for(std::vector<ll>::iterator itr = (v).begin(); itr != (v).end();itr++)
#define VREP_int(v) for(std::vector<int>::iterator itr = (v).begin(); itr != (v).end();itr++)
#define VALL(v) ((v).begin(),(v).end())
#define errln(v) cerr << (v) << endl;
#define println(v) cout << (v) << endl;

int main(int argc, const char * argv[]) {
	int r;
	cin >> r;
	printf("%.5f",r*M_PI*2);
	return 0;
}


Measured memory_bytes: 3760
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
using namespace std;

using ll = long long;
ll n,m;
ll p[1001];

void solve(){
    set<ll> st; 
    for(int i=0;i<n;i++){
        scanf("%lld",&p[i]);
    }
    sort(p,p+n);

    for(int i=0;i<n;i++){
        if(p[i]>m) break;
        st.insert(p[i]);
    }
    for(int i=0;i<n;i++){
        if(p[i] > m) break;
        for(int j=i+1;j<n;j++){
            if(p[i] + p[j]> m) break;
            st.insert(p[i]+p[j]);
        }
    }

    ll ans = 0;
    if(st.empty() == false){
        ans = *st.rbegin();
    }

    for(auto& s : st){
        if(s > m/2){
            break;
        }
        auto iter = st.upper_bound(m-s);
        if(iter == st.begin()){
            break;
        }
        iter--;
        ll v = *iter;
        ans = max(ans, s + v);
    }

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

int main(){
    while(1){
        scanf("%lld %lld",&n,&m);
        if(!n && !m) break;
        solve();
    }
}



Measured memory_bytes: 26440
//This code was made by Chinese_zjc_.
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<vector>
#include<map>
#include<queue>
#define int long long
#define INF 0x3fffffffffffffff
using namespace std;
int n;
string a;
signed main()
{
	std::ios::sync_with_stdio(false);
	cin>>n;
	while(n)
	{
		--n;
		a=(char)(n%26+'a')+a;
		n/=26;
	}
	cout<<a;
	return 0;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_int.hpp>
//typedef boost::multiprecision::cpp_int ll;
typedef long double dd;
//#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_7 1000003
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E17;

#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
///////////////////////////////////////

void no(){
    cout<<"No"<<endl;
}
void yes(){
    cout<<"Yes"<<endl;
}

int main(){fastio
    
    ll n,a,b,c,d;cin>>n>>a>>b>>c>>d;
    a--;b--;c--;d--;
    string s;cin>>s;
    if(c<d){
        rep(i,a+1,c-2){
            if(i+1<=n-1&&s[i]=='#'&&s[i+1]=='#'){
                no();
                return 0;
            }
        }
        rep(i,b+1,d-2){
            if(i+1<=n-1&&s[i]=='#'&&s[i+1]=='#'){
                no();
                return 0;
            }
        }
        yes();
        return 0;
    }else{
        rep(i,a+1,c-2){
            if(i+1<=n-1&&s[i]=='#'&&s[i+1]=='#'){
                no();
                return 0;
            }
        }
        rep(i,b+1,d-2){
            if(i+1<=n-1&&s[i]=='#'&&s[i+1]=='#'){
                no();
                return 0;
            }
        }
        rep(i,b-1,d-1){
            if(i+2<=n-1&&s[i]=='.'&&s[i+1]=='.'&&s[i+2]=='.'){
                yes();
                return 0;
            }
        }
        no();
        return 0;
    }
    
    return 0;
}


Measured memory_bytes: 592
S = str(input())

if S == 'SAT':
    print(1)
elif S == 'FRI':
    print(2)
elif S == 'THU':
    print(3)
elif S == 'WED':
    print(4)
elif S == 'TUE':
    print(5)
elif S == 'MON':
    print(6)
elif S == 'SUN':
    print(7)



Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define N 200010 
using namespace std;
int num[N]={};
vector<int> pz;
int main(){
	int n,k,a,i,kd=0,ans=0;
	cin>>n>>k;
	for(i=0;i<n;i++)
	{
		cin>>a;
		num[a]++;
	}
	for(i=1;i<=n;i++)
	{
		if(num[i]!=0)
		{
			kd++;
			pz.push_back(num[i]);
		}
	}
	sort(pz.begin(),pz.end());
	for(i=kd;i>k;i--)
	{
		ans+=pz[kd-i];
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 2168
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<memory>
#include<functional>

using namespace std;

#ifdef LDEBUG
#define debug(x) cout << #x << ":" << x << endl
#else
#define debug(...)
#endif

#define bzero(m)  memset(m,0,sizeof(m))
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

typedef unsigned long long u64;
typedef long long i64;

#define d(x,y) ((x)<(y) ? (y)-(x) : (x)-(y))

u64 dist(u64 x, u64 s, u64 t){
        return min(
                        d(x,s) + d(s,t),
                        d(x,t) + d(t,s)
                        );
}


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

        u64 a,b,q;
        vector<u64> s,t,y;

        cin >> a >> b >> q;
        REP(i, a){
                u64 k;
                cin >> k;
                s.push_back(k);
        }
        REP(i, b){
                u64 k;
                cin >> k;
                t.push_back(k);
        }

        sort(s.begin(), s.end());
        sort(t.begin(), t.end());

        REP(i, q){
                u64 x;
                cin >> x;
                y.push_back(x);
        }



        REP(i, q){
                u64 x = y[i];

                u64 sd[2],td[2],ud[2];
                auto si = lower_bound(s.begin(), s.end(), x);
                auto ti = lower_bound(t.begin(), t.end(), x);

                sd[0] = (si == s.begin()) ? *si : *(si-1);
                sd[1] = (si == s.end())   ? *(si-1) : *si;

                td[0] = (ti == t.begin()) ? *ti : *(ti-1);
                td[1] = (ti == t.end())   ? *(ti-1) : *ti;

                u64 r = 0xffffffffffffffffUL;
                REP(j,2) {
                REP(k,2) {
                        r = min(r, dist(x,sd[j],td[k]));
                }
                }
                cout << r << endl;
        }


        return 0;
}


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

using namespace std;

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


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

using namespace std;

int main(){

  double n;
  double k;
  
  cin >> n >> k;
  
  long double res=0;
 for(int i=1;i<=n;i++){
   long double prob=1/n;
   long double val=i;
    
    while(val<k){
     prob/=2;
     val*=2;
    }
     res+=prob;
   
  }
    
 
    cout << setprecision(12) << res << endl;
 
}

Measured memory_bytes: 256
from itertools import permutations

N,M = map(int,input().split())

edge = [[0 for i in range(N)] for j in range(N)]

for _ in range(M):
    a,b = map(int,input().split())
    edge[a-1][b-1] = 1
    edge[b-1][a-1] = 1

ans = 0
for path in permutations(range(N)):
    flag = True
    if path[0] != 0:
        flag = False
    for i in range(N-1):
        if not edge[path[i+1]][path[i]]:
            flag = False
    
    ans += int(flag)

print(ans)

Measured memory_bytes: 3064
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
const int maxn=510;
int n,m;
int a[maxn][maxn],b[maxn*maxn][5];

int main() {
    int ans=0;
    scanf("%d%d",&n,&m);
    for (int i=1;i<=n;i++)
        for (int j=1;j<=m;j++)
            scanf("%d",&a[i][j]);

    for (int i=1;i<=n;i++)
        for (int j=1;j<=m-1;j++) {
            if (a[i][j]&1) {
                b[ans][1]=i;
                b[ans][2]=j;
                b[ans][3]=i;
                b[ans][4]=j+1;
                ans++;
                a[i][j+1]++;
            }
        }

    for (int i=1;i<=n-1;i++) {
        if (a[i][m]&1) {
            b[ans][1]=i;
            b[ans][2]=m;
            b[ans][3]=i+1;
            b[ans][4]=m;
            ans++;
            a[i+1][m]++;
        }
    }

    printf("%d\n", ans);
    for (int i=0;i<ans;i++) printf("%d %d %d %d\n", b[i][1],b[i][2],b[i][3],b[i][4]);
    return 0;
}


Measured memory_bytes: 7168
import java.util.*;

public class Main {
   public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int h = sc.nextInt();
        int w = sc.nextInt();
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < h; i++) {
            char[] arr = sc.next().toCharArray();
            int result = -1;
            for (int j = 0; j < w; j++) {
                if (j != 0) {
                    sb.append(" ");
                }
                if (arr[j] == 'c') {
                    result = 0;
                } else if (result != -1) {
                    result++;
                }
                sb.append(result);
            }
            sb.append("\n");
        }
        System.out.print(sb);
    }
}


Measured memory_bytes: 29476
import java.util.*;
 
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        
        int a = sc.nextInt();
        int b = sc.nextInt();

        int result = 0;

        for (int i = 0; i < 2; i++) {
            if (a > b) {
                result += a;
                a--;
            } else {
                result += b;
                b--;
            }
        }

        System.out.println(result);
	}
}


Measured memory_bytes: 21844
#include<stdio.h>
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define f(i, x, n) for(int i = x; i < (int)n; ++i)

char s[301][301];
int dp[302][302], c[2][302][302];

int main(){
	int w, h;
	scanf("%d%d", &h, &w);
	f(i, 0, h)scanf("%s", s[i]);
	int an = 0;
	f(i, 1, w){
		f(j, 1, h + 1)f(k, 0, j + 1){
			c[0][j][k] = c[0][j - 1][k] + (k == j ? 0 : (s[j - k - 1][i - 1] == s[j - 1][i]));
			c[1][j][k] = c[1][j - 1][k] + (k == j ? 0 : (s[j - 1][i - 1] == s[j - k - 1][i]));
		}
		for (int j = h; j >= 0; --j)for (int k = h; k >= 0; --k){
			int a = dp[j + 1][k], b = dp[j][k + 1];
			if (j + 1 > k)a += c[1][j + 1][j + 1 - k]; else a += c[0][k][k - (j + 1)];
			if (k + 1 > j)b += c[0][k + 1][k + 1 - j]; else b += c[1][j][j - (k + 1)];
			if (j == h)a = 1e9;
			if (k == h)b = 1e9;
			if (j == h && k == h)a = 0;
			dp[j][k] = min(a, b);
		}
		int r = 1e9;
		f(i, 0, h + 1)r = min(r, min(dp[i][0], dp[0][i]));
		an += r;
	}
	printf("%d\n", an);
}


Measured memory_bytes: 1536
while 1:
 n=int(input())
 if n==0:break
 d={}
 for _ in[0]*n:
  k,v=input().strip().split()
  d[k]=v
 a=''
 for _ in[0]*int(input()):
  e=input().strip()
  a+=d[e]if e in d else e
 print(a)


Measured memory_bytes: 6488
#include <iostream>
#include <fstream>
#include <string> 
#include <cmath>  
#include <cstdlib>
#include <ctime>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <functional>

using namespace std;
using ll = long long;

#define FOR(i, m, n) for(int i = (m);i < (n);i++)
#define REP(i,n) for(int i = 0; i < int(n); i++)
#define VI vector<int>
#define VVI vector<vector<int>>
#define VVVI vector<vector<vector<int>>>
#define VL vector<ll>
#define VVL vector<vector<ll>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define PAIR pair<int,int>
#define MP make_pair
#define VP vector<pair<int,int>>
#define VS vector<string>
#define QUE queue<int>
#define DEQ deque<int>
#define PQUE priority_queue<int> //5,5,4,3,3,2,...
#define REPQUE priority_queue<int, vector<int>, greater<int>> //1,1,2,3,4,4,5,...
#define SUM(obj) accumulate((obj).begin(), (obj).end(), 0)
#define SORT(obj) sort((obj).begin(), (obj).end()) // 1,2,3,4,5...
#define RESORT(obj) sort((obj).begin(), (obj).end(), greater<int>()) // 5,4,3,2,1...
#define UB(obj,n) upper_bound((obj).begin(), (obj).end(), n) //itr > n
#define LB(obj,n) lower_bound((obj).begin(), (obj).end(), n) //itr>= n

const ll MOD = (ll)1e9 + 7;
const ll INF = (ll)1e12;

int main() {
	int N, M;
	cin >> N >> M;
	
	if (M == 0) {
		cout << "Yes" << endl;
		//cin >> N >> M;
		return 0;
	}
	
	vector<vector<pair<int,int>>> LtoR(N + 1);
	VI L(M), R(M), D(M);
	
	REP(i, M) {
		cin >> L[i] >> R[i] >> D[i];
		LtoR[L[i]].push_back(MP(R[i],D[i]));
		LtoR[R[i]].push_back(MP(L[i],-D[i]));
		}

	stack<int> st;
	for (int i = 1; i <= N; i++) st.push(i);
	vector<pair<bool, int>> x(N+1, {false,0});
	
	while(!st.empty()){
		int p = st.top();
		st.pop();
		
		for (int i = 0; i < LtoR[p].size(); i++) {
			if (!x[LtoR[p][i].first].first) {
				x[LtoR[p][i].first].first = true;
				x[LtoR[p][i].first].second = x[p].second + LtoR[p][i].second;
				st.push(LtoR[p][i].first);
			}
		}	
	}
	//for (int i = 1; i <= N; i++) cout << i << " " << x[i].second  << " " <<  LtoR[i].size() << endl;

	REP(i, M) {
		if (x[R[i]].second - x[L[i]].second != D[i]) {
			cout << "No" << endl;
			//cin >> N >> M;
			return 0;
		}
	}
	
	cout << "Yes" << endl;
	//cin >> N >> M;
	return 0;
}


Measured memory_bytes: 12544
n, m = map(int, input().split())
sc = [list(map(int, input().split())) for _ in range(m)]

num = [-1] * n
f = True

for i in range(m):
    s, c  = sc[i][0] - 1, sc[i][1]

    if (num[s] != -1 and num[s] != c) or (s == 0 and n >= 2 and c == 0):
        f = False
    else:
        num[s] = c

if f:
    ans = ''
    for i in range(n):
        if num[i] == -1:
            if (i == 0 and n >= 2):
                ans += '1'
            else:
                ans += '0'
        else:
            ans += str(num[i])
    print(ans)
else:
    print(-1)


Measured memory_bytes: 3064
let cnt = ref 0

let merge a l m r =
  let ni = m - l in
  let nj = r - m in
  let init_ary n p =
    Array.init (n + 1) (fun i -> if i = n then max_int else a.(p + i))
  in
  let ai = init_ary ni l in
  let aj = init_ary nj m in
  let rec doit i j k =
    if k < r then begin
      if ai.(i) <= aj.(j) then (a.(k) <- ai.(i); doit (i + 1) j (k + 1))
      else (a.(k) <- aj.(j); cnt := !cnt + (ni - i); doit i (j + 1) (k + 1))
    end
  in
  doit 0 0 l

let rec merge_sort a l r =
  if (l + 1) < r then begin
    let m = (l + r) / 2 in
    merge_sort a l m;
    merge_sort a m r;
    merge a l m r
  end

let () =
  let n = read_int () in
  let a = Array.init n (fun _ -> Scanf.scanf "%d " (fun i -> i)) in
  merge_sort a 0 n;
  Printf.printf "%d\n" !cnt

Measured memory_bytes: 10604
#include <bits/stdc++.h>
using namespace std;
int main(){
  int length;
  cin >> length ;
  vector<int> number(length);
  for (int i=0;i<length;i++){
    cin >> number.at(i);
  }
  int max=number.at(0),min=number.at(0),result=0;
  for (int i=0;i<length;i++){
    if(i!=0&&number.at(i)<number.at(i-1)){

      if(max-number.at(i)>=2){
        result=1;
      }
    }else if(number.at(i)>max){
      max=number.at(i);
    }
  }
  if (result==0){
    cout << "Yes"<<endl;
  }else {
    cout << "No"<<endl;
  }
}


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

int main() {
  string S;
  cin >> S;

  long long S_size = S.size(), ans = 0;
  for (int bit = 0; bit < 1 << (S_size - 1); ++bit) {
    int si = 0, d = 1, sum = 0;
    for (int i = 0; i < S_size - 1; ++i)
      if (bit & 1 << i)
        sum += stoi(S.substr(si, d)), si = i + 1, d = 1;
      else
        ++d;
    ans += sum + stoll(S.substr(si, d));
  }

  cout << ans << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

#define MOD 1000000007
#define MOD2 998244353
#define int long long
#define EPS 1e-9
//#define PI 3.14159265358979

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

using namespace std;

template < typename T >
ostream &operator<<(ostream &os, const vector< T > &A) {
	for (int i = 0; i < A.size(); i++)
		os << A[i] << " ";
	os << endl;
	return os;
}
template <>
ostream &operator<<(ostream &os, const vector< vector< int > > &A) {
	int N = A.size();
	int M;
	if (N > 0)
		M = A[0].size();
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < M; j++)
			os << A[i][j] << " ";
		os << endl;
	}
	return os;
}

typedef pair< int, int > pii;
typedef long long ll;

struct edge {
	int from, to, d, c;
	edge(int _from = 0, int _to = 0, int _d = 0, int _c = 0) {
		from = _from;
		to = _to;
		d = _d;
		c = _c;
	}
	bool operator<(const edge &rhs) const {
		return (d == rhs.d) ? (c < rhs.c) : (d < rhs.d);
	}
};
struct aabb {
	int x1, y1, x2, y2;
	aabb(int x1, int y1, int x2, int y2) : x1(x1), y1(y1), x2(x2), y2(y2) {}
};

typedef vector< edge > edges;
typedef vector< edges > graph;
struct flow {
	int to, cap, rev, cost;
	flow(int to = 0, int cap = 0, int rev = 0, int cost = 0) : to(to), cap(cap), rev(rev), cost(cost) {}
};
typedef vector< vector< flow > > flows;

const int di[4] = {0, -1, 0, 1};
const int dj[4] = {-1, 0, 1, 0};
const int ci[5] = {0, 0, -1, 0, 1};
const int cj[5] = {0, -1, 0, 1, 0};
const ll LINF = LLONG_MAX / 2;
const int INF = INT_MAX / 2;
const double PI = acos(-1);

int pow2(int n) { return 1LL << n; }
template < typename T, typename U >
bool chmin(T &x, const U &y) {
	if (x > y) {
		x = y;
		return true;
	}
	return false;
}
template < typename T, typename U >
bool chmax(T &x, const U &y) {
	if (x < y) {
		x = y;
		return true;
	}
	return false;
}

struct initializer {
	initializer() {
		cout << fixed << setprecision(20);
	}
};
initializer _____;

int N, M, K, T, Q, H, W;
signed main() {
	string L;
	cin >> L;
	N = L.size();
	vector< int > A(N);
	rep(i, N) A[i] = L[i] - '0';
	vector< vector< int > > dp(N + 1, vector< int >(2, 0));
	dp[0][1] = 1;
	rep(i, N) rep(t, 2) {
		int a = A[i];
		rep(k, 2) {
			int ni = i + 1, nt = t;
			if (t) {
				if (k > a)
					continue;
				if (k < a)
					nt = 0;
			}
			(dp[ni][nt] += dp[i][t] * (1 + k)) %= MOD;
		}
	}
	cout << (dp[N][0] + dp[N][1]) % MOD << endl;

	return 0;
}

Measured memory_bytes: 6656
a,b=map(int,input().split())


from collections import Counter
from operator import mul
from functools import reduce
def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

def factorize(n):
    b = 2
    fct = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            fct.append(b)
        b += 1
    if n > 1:
        fct.append(n)
    return fct
if len(factorize(b))==0:
    print(1)
    exit()

mod=10**9+7
print(reduce(mul,map(lambda x:cmb(a-1+x,a-1),Counter(factorize(b)).values()))%mod)

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

int main() {
	long long n, ans = 1e15;
	cin>>n;
	for(long long i=1;i<=sqrt(n);++i){
	    if(n%i==0){
	        ans = min(ans, i+(n/i)-2);
	    }
	}
	cout<<ans;
}

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

int main(){
  char c;
  cin >> c;
  if(c == 'A'){ cout << "T" << endl; }
  if(c == 'T'){ cout << "A" << endl; }
  if(c == 'G'){ cout << "C" << endl; }
  if(c == 'C'){ cout << "G" << endl; }
  
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define N 100005
#define int long long
using namespace std;
int a[N],n,m;
bool b[N];
char c[N],c1[N];
signed main(){
	scanf("%lld%lld",&n,&m);
	int ans=(n+m-3)/(n-1);
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cctype>
using namespace std;
inline void getch(char& ch)
{
	ch=0;while(!islower(ch))ch=getchar();
}
char a[3][3];
int main()
{
	for(int i=0;i<3;i++)
		for(int j=0;j<3;j++)
			getch(a[i][j]);
	printf("%c%c%c\n",a[0][0],a[1][1],a[2][2]);
	return 0;
}

Measured memory_bytes: 128
#include <stdio.h>

int calculation(int a, int b, int *c){
	int i,x;
	x=1;
	if(1<=a&&a<=100){
		for(i=0;i<b;i++){
			x=x*a;
		}
		*c=x;
		return 0;
	}
	else
	{
		return (-1);
	}
}

int main(){
	int a,b,c,r;
	scanf("%d",&a);
	b=3;
	r=calculation(a,b,&c);
	if(r==0){
	printf("%d\n",c);
	return 0;
	}
	else
	{
		printf("over\n");
		return 1;
	}
}

Measured memory_bytes: 1844
var
    a:array[1..5] of char;
    i,j,k:longint;
    s:string;
begin

j:=1;
    readln(s);//逼我加注释...
    a[1]:='C';//逼我加注释...
    a[2]:='F';//逼我加注释...
    
    for i:=1  to length(s) do//逼我加注释...
        begin//逼我加注释...
            if j=3 then break;//逼我加注释...
            if s[i]=a[j] then j:=j+1;//逼我加注释...
            
            
        end;//逼我加注释...
  if j=3 then writeln('Yes') else writeln('No');//逼我加注释...

readln;//逼我加注释...
readln;//逼我加注释...
end.//逼我加注释...

Measured memory_bytes: 128
//nani?
#include<bits/stdc++.h>
#define pi acos(-1);
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define f(i,a,b) for( int i = a; i < b ; i++ )
#define sor(a) sort( a.begin(), a.end() )
#define rsor(a) sort( a.rbegin(), a.rend() )
#define fastio ios_base::sync_with_stdio(0);cin.tie(0)
//#define inf 1LL<<62
typedef long long ll;
typedef double ld;
using namespace std;
const ll inf=1e10+6;
const ll MOD=1e9+7;
const ll mod=998244353;
// ac cmtr;
const int MAX_N = 2e5+5;
const int LG = 25;

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cout << name << " : " << arg1 << endl;}
 
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cout.write(names, comma - names) << " : " << arg1<<" | ";
  __f(comma+1, args...);}
#else
#define trace(...)
#endif
//---------------------------

//pair <ll,ll> a[MAX_N];

int main(){
    fastio;
  	ll n;
  	cin>>n;
  	vector <ll> v;
  	vector <ll> g;
  	f(i,0,n){
    	ll a,b;
      	cin>>a>>b;
      	v.pb(a);
      	g.pb(b);
    }
    sor(v);
  	sor(g);
  	ll ans = 0;
  	if(n&1){
    	ans = g[n/2]-v[n/2]+1;
    }
  	else{
    	ans = (g[n/2-1]+g[n/2]) - (v[n/2-1]+v[n/2]) + 1;
    }
 	cout<<ans<<endl;
}

Measured memory_bytes: 6648
#include<bits/stdc++.h>
 
using namespace std;
typedef unsigned long long int ll;
const ll hell = 100005; 

bool comp( vector<ll> a, vector<ll> b )
{
    return a[0]<b[0];
}
ll binpow(ll a,ll b) 
{
    ll res = 1;
    while (b > 0)
    {
        if (b & 1)
            res*=a;
        a*=a;
        b >>= 1;
    }
    return res;
}
int main()
{   
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll s;
    cin>>s;
    double l ,b, h;
    l=s*1.0/3;
    b=(s*1.0 -l)/2.0;
    h=s-l-b;
    cout << fixed << setprecision(6) <<l*b*h;
    return 0;
}


Measured memory_bytes: 384
#include<stdio.h>
int N,P,c,t;

int main()
{
	for(;scanf("%d%d",&N,&P),N;)
	{
		int m[50]={0};
		for(t=0,c=P;;t=(t+1)%N)
		{
			if(c==0)
			{
				c+=m[t];
				m[t]=0;
			}
			else
			{
				m[t]++;
				c--;
				if(m[t]==P)
					break;
			}
		}
		printf("%d\n",t);
	}
	return 0;
}

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

int main(){
	string s;
	int m,h;

	while(cin >>s){
		if(s=="-") break;
		cin >>m;
		REP(i,m){
			cin >>h;
			s = s.substr(h) + s.substr(0,h);
		}
		cout <<s << endl;
	}
	return 0;
}

Measured memory_bytes: 3152
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n); i >= 0; i--)
#define REP(i, m, n) for (int i = (int)(m); i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
typedef long long ll;

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;

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

  cout << M_PI * 2 * r << endl;

  return 0;
}


Measured memory_bytes: 3780
#coding: utf-8
from math import tan, pi
eps = 10**(-9)

def binary_search(a, b, x):
    l = pi / 2
    r = 0.0
    if x <= a ** 2 * b / 2:
        while l - r > eps:
            mid = (r + l) / 2
            if a * b**2 / tan(mid) / 2 == x:
                return x
            elif a * b**2 / tan(mid) / 2 > x:
                r = mid
            else:
                l = mid
        return l
        
    else:
        while l - r > eps:
            mid = (r + l) / 2
            if a**2 * b - a**3 * tan(mid) / 2 == x:
                return x
            elif a**2 * b - a**3 * tan(mid) / 2 > x:
                r = mid
            else:
                l = mid
        return l

a, b, x = map(int, input().split())
print("{:.10f}".format(binary_search(a, b, x) * 180 / pi))

Measured memory_bytes: 3188
N = int(input())
s = 0
t = 0
for i in range(1,N+1):
    if (i % 15) == 0 :
        t = 0
    elif (i % 3) == 0:
        t = 0
    elif (i % 5) == 0:
        t = 0
    else:
        t = i
    s = s + t
print(s)

Measured memory_bytes: 65376
#include<iostream>

void swap(int *a, int *b) {
  int temp;

  temp = *a;
  *a = *b;
  *b = temp;
}


void sort(int *a, int *b, int *c) {
  int temp;
  if (*a > *b) {
    swap(a, b);
  }
  if (*a > *c) {
    swap(a, c);
  }
  if (*b > *c) {
    swap(b, c);
  }
}


int main() {
  int a, b, c;
  char delimiter = ' ';

  std::cin >> a >> b >> c;
  sort(&a, &b, &c);
  std::cout << a << delimiter << b << delimiter << c << std::endl;

  return 0;
}



Measured memory_bytes: 3040
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int c, g; //card gate
  cin>>c>>g;
  
  int max=c;
  int min=1;
  int l, r;
  
  
  for(int i=0; i<g; i++){
    cin>>l>>r;
    if(l>min){
      min=l;}
    if(r<max){
      max=r;}
  }
  if(max>=min){
    cout<<max-min+1<<endl;}
  else{
    cout<<0<<endl;}
}
    

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
using ll = long long;
// #define int ll
using PII = pair<int, int>;
 
#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
 
template<typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }
 
template<typename T> vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts) { 
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type
fill_v(T &t, const V &v) { t=v; }
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t, const V &v ) { for(auto &e:t) fill_v(e,v); }
 
template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a){
  out<<'('<<a.first<<','<<a.second<<')'; return out;
}
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
  for(T& x: vec) {is >> x;} return is;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
  out<<'['; for(T i: a) {out<<i<<',';} out<<']'; return out;
}
 
int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0}; // DRUL
const int INF = 1<<30;
const ll LLINF = 1LL<<60;
const int MOD = 1000000007;

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

  string s;
  cin >> s;

  if(s.size() == 2) cout << s << endl;
  else {
    reverse(ALL(s));
    cout << s << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int make_sum(int n) {
    int sum = 0;
    while (n > 0) {
        sum += n % 10;
        n = n / 10;
    }

    return sum;
}

int main() {
    int n;
    cin >> n;
    int sum = make_sum(n);
    cout << (n % sum == 0 ? "Yes" : "No") << endl;
    return EXIT_SUCCESS;
}

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

int main(){
    int H, W, K;
    cin >> H >> W >> K;
    long long MOD = 1000000007;
    long long a[W], b[W], s[W];
    a[0] = 0;
    b[0] = 1;
    s[0] = 1;
    rep(i, W-1){
        a[i+1] = b[i];
        b[i+1] = a[i] + b[i];
        s[i+1] = a[i+1] + b[i+1];
    }
    long long dp[H+1][W+2];
    dp[0][1] = 1;
    rep2(i, 2, W+1){
        dp[0][i] = 0;
    }
    rep(i, H+1){
        dp[i][0] = 0;
        dp[i][W+1] = 0;
    }
    rep(i, H){
        rep2(j, 1, W+1){
            dp[i+1][j]
            = (dp[i][j-1] * s[max(W-j-1, 0)] * s[max(j-3, 0)]
            + dp[i][j] * s[max(W-j-1, 0)] * s[max(j-2, 0)]
            + dp[i][j+1] * s[max(W-j-2, 0)] * s[max(j-2, 0)]) % MOD;
        }
    }
    cout << dp[H][K]<< endl;
}

Measured memory_bytes: 256
#!/usr/bin/env python3


def divisors(x):
    div = []
    for i in range(1, int(x ** 0.5) + 1):
        if x % i == 0:
            div.append(i)
            if x // i != i:
                div.append(x // i)
    return div


n = int(input())
ans = len(divisors(n - 1)) - 1
for k in divisors(n)[1:]:
    t = n
    while t % k == 0:
        t //= k
    if t % k == 1:
        ans += 1
print(ans)


Measured memory_bytes: 3188
N = int(input())
H = list(map(int, input().split()))

ans = 0
while max(H) > 0:
  grp = [[]]
  for i,h in enumerate(H):
    if h == 0:
      if len(grp[-1]) > 0: grp.append([])
    else: grp[-1].append((i,h))
  for g in grp:
    if len(g) == 0: continue
    Min = min([h for _,h in g])
    ans += Min
    for i,_ in g: H[i] -= Min
print(ans)

Measured memory_bytes: 9104
def main():
    N, M = map(int, input().split())
    ans = []
    if N%2:
        for l in range(1, N//2+1):
            r = N-l
            ans.append([l,r])
    else:
        for l in range(1, N//2+1):
            r = N-l+1
            if l>N//4:
                r -= 1
            ans.append([l,r])
    for i in range(M):
        print(ans[i][0], ans[i][1])
    return
main()

Measured memory_bytes: 22736
if __name__ == "__main__":
    n = input()
    n = int(n)

    x = n * (n + 1) / 2

    ny = n // 3
    y = 3 * ny * (ny + 1) / 2

    nz =  n // 5
    z = 5 * nz * (nz + 1) / 2

    nw = n // 15
    w = 15 * nw * (nw + 1) / 2

    ans = x - y - z + w
    ans = int(ans)
    print(ans)

Measured memory_bytes: 9196
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    ll n,i,x;
    cin>>n;
    string str;
    cin>>str;
    for(i=0;i<str.length();i++){
        x = str[i]-'A';
        x = (x+n)%26;
        cout<<char(x+65);
    }
    cout<<endl;
    return 0;
}


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

int main(void){
    long long int a = 0, b = 0, x = 0, ans = 0; 

    scanf("%lld%lld%lld", &a, &b, &x);

    if(a != 0){
        ans = b / x - (a - 1) / x;
    }else{
        ans = b / x + 1;
    }


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

} 


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		double x1, y1, x2, y2;
		Scanner sc = new Scanner(System.in);
		x1 = Double.parseDouble(sc.next());
		y1 = Double.parseDouble(sc.next());
		x2 = Double.parseDouble(sc.next());
		y2 = Double.parseDouble(sc.next()); sc.close();
		double sin = y2 - y1, cos = x2 - x1;
		if (sin != 0) sin *= sin; if (cos != 0) cos *= cos;
		System.out.println(Math.sqrt(sin + cos));
	}
}

Measured memory_bytes: 17200
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int d[] = new int[N];
		for (int i = 0; i < N; i++) {
			d[i] = sc.nextInt();
		}
		Arrays.sort(d);
		int n = 1;
		for (int i = 1; i < N; i++) {
			if (d[i] > d[i - 1]) {
				n++;
			}
		}
		System.out.println(n);
		sc.close();
	}

}


Measured memory_bytes: 21844
s=input()
a=[]
point=0
num=0
for i in range(len(s)):
  if i==0:
    num=1
  elif s[i]!=s[i-1]:
    a.append(num)
    num=1
  else:
    num+=1
else:
  a.append(num)
#print(a)
ans=[0]*len(s)
index=0
for i in range(len(a)//2):
  index += a[2*i]
  ans[index] += a[2*i]//2
  ans[index-1] += a[2*i]//2 + (a[2*i]%2)
  ans[index-1] += a[2*i+1]//2
  ans[index] += a[2*i+1]//2 + (a[2*i+1]%2)
  index += a[2*i+1]

for i in range(len(ans)):
  if i==len(ans)-1:
    print(ans[i])
  else:
    print(ans[i],end=' ')

Measured memory_bytes: 5624
x, y, a, b, c = map(int, input().split())

red = list(map(int, input().split()))
green = list(map(int, input().split()))
colorless = list(map(int, input().split()))

red.sort(reverse = True)
green.sort(reverse = True)
colorless.sort(reverse = True)

ret = red[:x] + green[:y]
ret.sort()

for i in range(len(colorless)):
    if ret[i] < colorless[i]:
        ret[i] = colorless[i]
    else:
        break

print(sum(ret))

Measured memory_bytes: 23328
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; ++i)
#define ALL(v) v.begin(), v.end()
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1000000007;

string dp[20][2];

int sum(string s)
{
   int res = 0;
   rep(i,s.size())
   {
      res+= s[i]-'0';
   }
   return res;
}

int main()
{
   string s;
   cin >> s;
   int n = s.size();
   dp[0][0] = "0";
   rep(i,s.size())
   {
      //みまんでは無いところから回す
      for(char j = '0';j<s[i];j++)
      {
         if(sum(dp[i+1][1])<sum(dp[i][0]+j))
         {
            dp[i+1][1] = dp[i][0]+j;
         }
      }
      //未満を回す
      if(i>0)
      for(char j = '0';j<='9';j++)
      {
         if(sum(dp[i+1][1])<sum(dp[i][1]+j))
         {
            dp[i+1][1] = dp[i][1]+j;
         }
      }
      dp[i+1][0]=dp[i][0]+s[i];
   }
   //cout<<dp[n][0]<<';'<<dp[n][1]<<endl;
   cout<<max(sum(dp[n][0]),sum(dp[n][1]))<<endl;
   return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mp make_pair
#define X first
#define Y second
#define pii pair<ll,ll>
#define x1 dlfjl
#define x2 dkfj
#define x3 dflgkg
#define y1 dskgj
#define y2 dskfj
#define y3 dfhgdh
#define SQ 320
#define PI 3.14159265359
#define MOD 1000000007
typedef int ll;
using namespace std;
ll n,i,j,k,z,m,q,r,timer,v,tot,x,y,xx, yy,INF, sz;
ll a[100500], cnt[100500];
int main() {
    //freopen("input.txt","r",stdin);
    cin >> n >> k;
    for (int i = 0; i < n; i++)
        cin >> a[i];
    for (int i = 1; i <= n - 1; i++) {
        if (a[i - 1] + a[i] >= k) {
            cout << "Possible" << endl;
            for (int j = 0; j < i - 1; j++)
                cout << j+1 << endl;
            for (int j = n-2; j > i - 1; j--)
                cout << j+1 << endl;
            cout << i << endl;
            return 0;
        }
    }
    cout << "Impossible" << endl;
    return 0;
}

Measured memory_bytes: 1152
# -*- coding: utf-8 -*-

def main():
    a, b = map(int, input().split())

    N = (b + 1) * 10
    ans = -1

    for i in range(N):
        if int(i * 0.08) == a and int(i * 0.1) == b:
            ans = i
            break

    print(ans)

if __name__ == "__main__":
    main()


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  ll n,k;cin>>n>>k;
  ll a[n];for(ll i=0;i<n;i++)cin>>a[i];
  ll mod=1000000007;
  ll dp[n][k+1];
  for(ll i=0;i<=k;i++){
    if(i<=a[0])dp[0][i]=1;
    else dp[0][i]=0;
  }
  for(ll i=1;i<n;i++){
    ll sum=0;
    for(ll j=0;j<=a[i];j++){
      sum+=dp[i-1][j];
      dp[i][j]=sum;
      sum%=mod;
      dp[i][j]%=mod;
    }
    for(ll j=a[i]+1;j<=k;j++){
      sum-=dp[i-1][j-a[i]-1];
      sum=(sum+mod)%mod;
      sum+=dp[i-1][j];
      sum%=mod;
      dp[i][j]=sum;
      dp[i][j]%=mod;
    }
  }
  //for(ll i=0;i<n;i++)for(ll j=0;j<=k;j++)cout<<dp[i][j]<<endl;
  cout<<dp[n-1][k]<<endl;
}
           

Measured memory_bytes: 78336
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
#include <cmath>
#include <limits>
#include <iostream>
#include<stack>
#include<tuple>
using namespace std;
#define INF 1100000000000
#define MAX 100000
#define MOD 100000
typedef long long ll;
typedef pair<int,int> P;
typedef pair<pair<int,int>,int> p;
typedef pair< pair<int,int>, int> p; 
#define bit(n,k) ((n>>k)&1) /*nのk bit目*/
#define rad_to_deg(rad) (((rad)/2/M_PI)*360)

ll dp[3100][3100];

int main(){
    string s,t;
    cin>>s>>t;
    int ns=(int)s.size(),nt=(int)t.size();

    for(int i=0;i<ns;i++){
        for(int j=0;j<nt;j++){
            if(i==0 && j==0){
                if(s[i]==t[j]) dp[i][j]=1;
            }else if(i==0 || j==0){
                if(s[i]==t[j]) dp[i][j]=1;
                else if(i>j) dp[i][j]=dp[i-1][j];
                else dp[i][j]=dp[i][j-1];
            }else{
                if(s[i]==t[j]){
                    dp[i][j]=dp[i-1][j-1]+1;
                }else{
                    dp[i][j]=max(dp[i][j-1],dp[i-1][j]);
                }
            }
        }
    }
    int len=dp[ns-1][nt-1];
    char ans[3100];
    len--;
    int i=ns-1,j=nt-1;
    while(len>=0){
        //cout<<i<<" "<<j<<endl;
        if(s[i]==t[j]){
            ans[len]=s[i];
            i--;
            j--;
            len--;
        }else if(i>=1 && dp[i][j]==dp[i-1][j]){
            i--;
        }else j--;
    }
    //cout<<1<<endl;
    for(int i=0;i<dp[ns-1][nt-1];i++){
        //cout<<i<<endl;
        cout<<ans[i];
    }
    cout<<endl;
}



Measured memory_bytes: 73984
n = int(input())
alphabet = list("abcdefghij"[:n])

# DFS
def print_string(string="", depth=1):
    if len(string) == n:
        print(string)
    else:
        for i in range(depth):
            if i+1 == depth:
                print_string(string+alphabet[i], depth=depth+1)
            else:
                print_string(string+alphabet[i], depth=depth)
                
print_string()

Measured memory_bytes: 4340
#include <iostream>
using namespace std;
typedef long long LL;
const int N = 2e5 + 10;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
int n;
LL ans=0;
int main() {
  	ios::sync_with_stdio(false);
  	cin>>n;
  	for(int i=1;i<=n;i++){
  		if(i%3==0||i%5==0)continue;
  		ans+=i;
  	}
  	cout<<ans<<'\n';
 	return 0;
}

Measured memory_bytes: 3200
#include <vector>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>
#include <ctime>
#include <map>
#include <stack>
#include <sstream>

using namespace std;

string s;
long long int res = 0;

void func(int len,string str,int i,char c)
{
	if (i > len)
	{
		if (c == '0')
		{
			int index = 0;
			for (int i = 0; i < str.length(); i++)
			{
				//+
				if (str[i] == '1')
				{
					//cout << s.substr(index, i - index + 1) << " ";
					res += stoll(s.substr(index, i - index + 1));
					index = i + 1;
				}
			}
			//cout << s.substr(index) << endl;
			res += stoll(s.substr(index));
		}
		return;
	}
	str.push_back(c);
	func(len, str, i + 1, '0');
	func(len, str, i + 1, '1');
}
int main(void)
{
	string str;
	int len;
	cin >> s;
	len = s.size() - 1;
	func(len, str, 1, '0');
	func(len, str, 1, '1');


	cout << res << endl;
	return 0;
}

Measured memory_bytes: 256
n = gets.to_i
happy = gets.split.map(&:to_i)
happy.unshift 0 # ダミー

# happyが多い順にインデックスを並び替える
sorted_index = (1..n).sort_by{|i| -happy[i]}
sorted_index.unshift 0 # ダミー

# happyが多い順に左端もしくは右端に入れていく
# 左端にleft人、右端にright人入ってるときの嬉しさを
# happysum[left][right]で表すことにする。
# これは、左端に入れたときの嬉しさ
# happysum[left-1][right] + happy[i] * (i - left).abs
# もしくは右端に入れたときの嬉しさ
# happysum[left][right-1] + happy[i] * (n + 1 - right - i).abs
# の大きい方で更新される。

happysum = (n+1).times.map do |left|  # leftは0, 1, ..., n
  Array.new(n-left, 0) # rightは0, 1, ..., n-left (left+right<=n)
end

# left=0固定
(1..n).each do |right|
  i = sorted_index[right]
  happysum[0][right] = happysum[0][right-1] + happy[i] * (n + 1 - right - i).abs
end

# right=0固定
(1..n).each do |left|
  i = sorted_index[left]
  happysum[left][0] = happysum[left-1][0] + happy[i] * (i - left).abs
end

max = [happysum[0][n], happysum[n][0]].max

(1..n).each do |left|
  (1..(n-left)).each do |right|
    i = sorted_index[left+right]
    to_left = happysum[left-1][right] + happy[i] * (i - left).abs
    to_right = happysum[left][right-1] + happy[i] * (n + 1 - right - i).abs
    happysum[left][right] = [to_left, to_right].max
  end
  max = [max, happysum[left][n-left]].max
end

puts max


Measured memory_bytes: 37252
k = int(input())
a, b = map(int, input().split())

if a == b:
    if a % k == 0:
        print("OK")
        exit()
    else:
        print("NG")
        exit()

for i in range(a, b+1):
    if i % k == 0:
        print("OK")
        exit()
print("NG")

Measured memory_bytes: 9184
#include<iostream>
#include<cstdio>
#include<string>
using namespace std; 

int main(){
	int a,b,c,d,x,y;
	cin>>a>>b>>c>>d;
	x=a*b;y=c*d;
	
	if(x>y)cout<<x;
	else cout<<y;
	return 0;
}

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

#define ll long long
#define ld long double
#define vi vector<int>
#define vl vector<ll>
#define si set<int>
#define ii pair<int,int>
#define f first
#define s second
#define pb push_back
#define endl '\n'
#define yes cout << "YES" << endl
#define no cout << "NO" << endl
#define sz(c) (int) (c).size()
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define db(x) cout << #x << ": " << x << endl
#define _db(c) for (auto x : c) cout << x << " "; cout << endl
#define forc(i,c) for (auto i = (c).begin(); i != (c).end(); ++i)
#define io ios_base::sync_with_stdio(false); cin.tie(nullptr)
#define tc int t; cin >> t; while (t--)

ll MOD = 1000000007;
ll ans = 0;
ll a, b, i, j, m, n, x, y;

int main() { 
	io;
	
	cin >> x >> y;

	if (y%2 || y > 4*x) {
		cout << "No";
		return 0;
	}

	for (int i = y ; i >= 0 ; i -= 2, x--) {
		if (i > 2*x) i -= 2;
		if (x == 0 && i == 0) {
			cout << "Yes"; return 0;
		}
	}

	cout << "No";  

}

Measured memory_bytes: 3656
#!/bin/bash

read in1
a=(`echo $in1 | fold -1`)
p=${#in1}
i=0
n=0
if [ ${in1:0:1} -eq 1 ]; then
  let ++i
fi
for x in ${a[@]}; do
  if [ $((i%2)) -ne $x ]; then
    let ++n
  fi
  let ++i
done
echo $n

Measured memory_bytes: 24020
def main():
    r, c = map(int, input().split())
    cs = [0] * (c + 1)
    t = []
    for _ in range(r):
        s = list(map(int, input().split()))
        s.append(sum(s))
        t.append(s)
        for i in range(c):
            cs[i] += s[i]
    cs[-1] = sum(cs)
    t.append(cs)
    for a in t:
        print(' '.join(map(str, a)))


main()



Measured memory_bytes: 5704
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <stack>
#include <numeric>
#include <algorithm>
#include <bitset>
#include <time.h>
#include <complex>
#include <iomanip>

using namespace std;
typedef long long ll;
typedef long long int llint;
typedef unsigned long long ull;
typedef pair<ll, ll> pa;
#define MM 1000000000
#define INF 1e15
#define MOD MM+7
#define pi pair<int,int>
#define pl pair<ll,ll>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)

const long double PI = acos(-1);
const ll DEP = 1e18;
int dx[4] = {-1,0,1,0};
int dy[4] = {0,-1,0,1};
int GCD(int x,int y){
    return y ? GCD(y,x%y) : x;
}

const ll NMAX = 100001;
const ll MMAX = 100001;
struct edge{ll to,cost;};
typedef pair<ull,ull> P;
const ull base = 1e15;

vector<edge> Gs[MMAX];
vector<edge> Ge[MMAX];

ull ds[MMAX],dt[MMAX];

int V,E;

void dijkstra(int s, ull d[], vector<edge> G[]){
    priority_queue<P,vector<P>,greater<P>> que;
    fill(d,d+V,INF);
    d[s] = 0;
    que.push(P(0,s));

    while(que.size()){
        P p = que.top(); que.pop();
        int v = p.second;
        if(d[v] < p.first) continue;
        for(int i = 0; i < G[v].size(); i++){
            edge e = G[v][i];
            if(d[e.to] > d[v] + e.cost){
                d[e.to] = d[v] + e.cost;
                que.push(P(d[e.to],e.to));
            }
        }
    }
}

pair<ull,int> dsum[MMAX];
int main(){
    ll s,t;
    cin >> V >> E >> s >> t;
    s--; t--;
    for(int i = 0; i < E; i++){
        int u,v;
        ll a,b;
        cin >> u >> v >> a >> b;
        u--; v--;
        Ge[u].push_back((edge){v,a});
        Ge[v].push_back((edge){u,a});
        Gs[u].push_back((edge){v,b});
        Gs[v].push_back((edge){u,b});
    }

    dijkstra(s,ds,Ge);
    dijkstra(t,dt,Gs);

    for(int i = 0; i < V; i++){
        dsum[i] = make_pair(ds[i]+dt[i],i);
    }
    sort(dsum,dsum+V);

    int idx = 0;

    for(int i = 0; i < V; i++){
        ull d;
        while(1){
            auto p = dsum[idx];
            int v = p.second;
            d = p.first;
            if(v < i) idx++;
            else break;
        }
        cout << base-d << endl;
    }
}



Measured memory_bytes: 20728
#include<bits/stdc++.h>
using namespace std;
vector<vector<int>> v;
int n, d;
int check(int a, int b){
	int res=0;
	for(int i=0;i<d;i++)
		res+=pow(abs(v[a][i]-v[b][i]),2);
	for(int i=0;i*i<=res;i++)
		if(res==i*i) return 1;
	return 0;
}
int main(){
	cin>>n>>d;
	for(int i=0;i<n;i++){
		vector<int> t(d);
		for(int j=0;j<d;j++)
			cin>>t[j];
		v.push_back(t);
	}
	int res=0;
	for(int i=0;i<n;i++)
		for(int j=0;j<i;j++)
			res+=check(i,j);
	cout<<res;
}

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

// definition {{{ 1

// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)

#define Scll(x) scanf("%llu", &x)
#define Scll2(x,y) scanf("%llu%llu", &x, &y)
#define Scll3(x,y,z) scanf("%llu%llu%llu", &x, &y, &z)

#define Scc(c) scanf("%c", &c);
#define Scs(s) scanf("%s", s);
#define Scstr(s) scanf("%s", &s);
// }}} 2

// constants {{{ 2
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
// }}} 2

// systems {{{ 2
#define Rep(x,y) for(int x = 0; x < y; x++)
#define Repe(x,y,z) for(int x = z; x < y; x++)
// }}} 2

// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n");
// }}} 2

// }}} 1

int main() {

    ll a = 0;
    Scll(a);

    ll ans = 0;

    ans += a/11 * 2;

    if( a % 11 != 0 ){
        if( a % 11 > 6 )
            ans+=2;
        else
            ans+=1;
    }

    printf ("%llu\n", ans);

    return 0;
}



Measured memory_bytes: 256