akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>

#define ll long long
#define pb push_back
#define sz(x) (int)(x).size()
#define mp make_pair
#define f first
#define s second
#define all(x) x.begin(), x.end()

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

template<class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>; ///find_by_order(),order_of_key()
template<class T1, class T2> ostream& operator<<(ostream& os, const pair<T1,T2>& a) { os << '{' << a.f << ", " << a.s << '}'; return os; }
template<class T> ostream& operator<<(ostream& os, const vector<T>& a) {
	os << '{';
	for(int i=0;i<sz(a);i++)
	{
		if(i>0&&i<sz(a)-1)
			os << ", ";
		os << a[i];
	}
	os << '}';
    return os;
}
const int N=21;
vector<vector<int> > graf(N);
const int mod=1e9+7;
int add(int a,int b)
{
    a+=b;
    if(a>=mod)
        a-=mod;
    return a;
}
int dp[(1<<N)];
int calc(int tr)
{
    if(dp[tr]!=-1)
        return dp[tr];
    int n=__builtin_popcount(tr);
    if(n==0)
        return dp[tr]=1;
    n--;
    dp[tr]=0;
    for(auto p:graf[n])
    {
        if(tr&(1<<p))
        {
            int nx=tr^(1<<p);
            dp[tr]=add(dp[tr],calc(nx));
        }
    }
    return dp[tr];
}
int main()
{
    for(int i=0;i<(1<<N);i++)
        dp[i]=-1;
    int n;
    scanf("%i",&n);
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<n;j++)
        {
            int a;
            scanf("%i",&a);
            if(a==1)
                graf[i].pb(j);
        }
    }
    printf("%i\n",calc((1<<n)-1));
    return 0;
}


Measured memory_bytes: 8448
#include <bits/stdc++.h>
#define ll long long int
#define MOD 1000000007
#define INF 1e18
#define PI 3.14159265358979

using namespace std;

int main(void){
  string s[3];
  cin >> s[0] >> s[1] >> s[2];
  
  int a[3] = {};
  int turn = 0;
  while (a[turn] < s[turn].size()){
    a[turn]++;
    turn = s[turn][a[turn]-1] - 'a';
  }

  cout << (char)(turn + 'A') << endl;


  return 0;
}


Measured memory_bytes: 256
import numpy as np

'''実はarctanは実装されていた...
def search_arctan(tan):
    low = 0
    high = np.radians(90)
    while (high-low>=10**(-12)):
        mid = (low+high)/2 
        if np.tan(mid)<=tan:
            low = mid
        else:
            high = mid
    return np.rad2deg(mid)
'''
a,b,x = list(map(int,input().split()))


l = x/(a*a)

if l<=b/2.0:
    ans = np.rad2deg(np.arctan(b**2.0/(2.0*a*l)))
else:
    ans = np.rad2deg(np.arctan(2.0*(b-l)/a))

print(ans)

Measured memory_bytes: 21352
use std::io::stdin;

fn main() {
    let mut input_string = String::new();
    stdin().read_line(&mut input_string).ok();
    let mut itr = input_string.trim().split_whitespace();
    let a1: usize = itr.next().unwrap().parse().unwrap();
    let a2: usize = itr.next().unwrap().parse().unwrap();
    let a3: usize = itr.next().unwrap().parse().unwrap();
    if a1 + a2 + a3 <= 21 {
        println!("{}", "win");
    } else {
        println!("{}", "bust");
    }
}

Measured memory_bytes: 2084
def main():
    a, b, k = map(int, input().split())
    result_a = 0
    result_b = 0
    if k >= a:
        result_a = 0
        if (k - a) >= b:
            result_b = 0
        else:
            result_b = b - (k - a)
    else:
        result_a = a - k
        result_b = b

    print(str(result_a) + " " + str(result_b))


if __name__ == "__main__":
    main()


Measured memory_bytes: 3188
x = input()
for op1 in ['+', '-']:
    for op2 in ['+', '-']:
        for op3 in ['+', '-']:
            eq = x[0] + op1 + x[1] + op2 + x[2] + op3 + x[3]
            if eval(eq) == 7:
                print(eq + '=7')
                exit()

Measured memory_bytes: 3060
from math import ceil
from fractions import Fraction
N=int(input())
a=1
b=1
for i in range(N):
    x,y=map(int,input().split())
    n=max(ceil(Fraction(a,x)),ceil(Fraction(b,y)))
    a,b=n*x,n*y
print(a+b)   

Measured memory_bytes: 5300
#include <iostream>
#include <string>

using namespace std;

int main()
{

    int a, b, k;
    cin >> a >> b >> k;

    for (int i = a; i <= b; i++)
    {
        if (i < (a + k) || (b - k) < i)
        {
            cout << i << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;
#define RENT 100000
int main(){
	int n, ans;
	int counter = 0;
	while (cin >> n){
		counter = 0;
		for (int i = 0; i < 10; i++){
			for (int q = 0; q < 10; q++){
				for (int w = 0; w < 10; w++){
					for (int e = 0; e < 10; e++){
						ans = i + q + w + e;
						if (ans == n){
							counter += 1;
						}
					}
				}
			}
		}
		cout << counter << endl;
	}
}

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

int main()
{
	int64_t n, k, switch_num = 0, min;
	bool mode = true;
	cin >> n >> k;
	min = n;
	if (n % k == 0 || k == 1)
	{
		cout << 0 << endl;
		return 0;
	}
	n -= (n / k) * k;
	min = n;
	while(switch_num <= 2)
	{
		if (mode)
		{
			n -= k;
			if (min > abs(n))
			{
				min = abs(n);
			}
			if (n < 0)
			{
				mode = false;
				switch_num++;
			}
		}
		else
		{
			n += k;
			if (min > abs(n))
			{
				min = abs(n);
			}
			if (n > 0)
			{
				mode = false;
				switch_num++;
			}
		}
	}
	cout << min << endl;
	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
 
////////////// Prewritten code follows. Look down for solution. ////////////////

#define fs first
#define sc second
#define pb push_back
#define mp(a, b) make_pair(a, b)
#define len(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long long ll;
typedef pair<ll, ll> pll;

template<typename T>
const T INF = (is_same<T, int>::value ? 1e9 : 1e18);
template<typename T>
inline T mod(T n, T mod){ T res = n%mod; if(res < 0) res += mod; return res; }
 
////////////////////////// Solution starts below. //////////////////////////////

const int N = 1e5+5;

int main(){
  fastio;
  int n, m;
  cin >> n >> m;
  vector<ll> v(n);
  priority_queue<ll> pq;
  for(int i = 0; i < n; i++) cin >> v[i], pq.push(v[i]);
  while(m--){
    ll aux = pq.top();
    pq.pop();
    aux /= 2;
    pq.push(aux);
  }
  ll sum = 0;
  while(!pq.empty()){
    sum += pq.top();
    pq.pop();
  }
  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 2296
# n=int(input())
n, k = map(int, input().split())
xl = list(map(int, input().split()))
#l=[list(input()) for i in range(h)]

if 0 in xl:
    k -= 1
else:
    xl.append(0)
    xl.sort()
if k == 0:
    ans = 0
else:
    ans = 10**9
    zeropoint = xl.index(0)
    endpoint = len(xl)-1
    startpoint = max(0, zeropoint-k)
    cur = startpoint
    while cur+k <= endpoint and cur <= zeropoint:
        # print(cur)
        # もし折り返すなら
        if cur < zeropoint < cur+k:
            tempdis = abs(xl[cur]-xl[cur+k])
            tempdis += min(abs(xl[cur]), xl[cur+k])
            ans = min(ans, tempdis)
        else:
            ans = min(ans, abs(xl[cur]-xl[cur+k]))
        cur += 1
print(ans)


Measured memory_bytes: 19880
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 1000000010
#define EPS 1e-9
#define fst first
#define scd second

#define debug(x) cout<<x<<endl;
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define lp(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
#define int long long
#define endl "\n"


signed main(){
  cin.tie(0);	
  ios::sync_with_stdio(false);
  int n,a,b;
  cin>>n>>a>>b;
  int cnt[3]={0};
  rep(i,n){
    int p;
    cin>>p;
    if(p<=a) cnt[0]++;
    if(p>a && p<=b) cnt[1]++;
    if(p>b) cnt[2]++;
  }
  int ans=500000;
  rep(i,3) ans=min(ans,cnt[i]);
  cout<<ans<<endl;
  

  return 0;
}



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

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

#define rep(i, N) for (ll i = 0; i < (N); i++)
#define For(i, a, b) for (ll i = (a); i < (b); i++)
#define all(A) (A).begin(), (A).end()

const ll MOD = 1000000007;

ll modpow(ll n, ll r) {
    ll p = n;
    ll ret = 1;
    while (r > 0) {
        if (r & 1) ret = (ret * p) % MOD;
        p = (p * p) % MOD;
        r >>= 1;
    }
    return ret;
}



int main(){
    ll ans = 0;

    ll N, K;
    cin >> N >> K;

    ll lst[K + 1];
    rep(i, K + 1) lst[i] = 0;

    for (ll k = K; k > 0; --k) {
        ll a = K / k;
        ll tmp = modpow(a, N);
        for (ll j = k; j <= K; j += k) {
            tmp = (MOD + tmp - lst[j]) % MOD;
        }
        ans = (ans + k * tmp) % MOD;
        lst[k] = tmp;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 4328
#include <iostream>
using namespace std;
int main()
{
  int n;
  cin>>n;
  int a[n-1],ans[n]={0};
  for(int i=0;i<n-1;i++){
    cin>>a[i];
    ans[a[i]-1]+=1;
  }
  for(int i=0;i<n;i++){
    cout<<ans[i]<<endl;
  }
  return 0;
}

Measured memory_bytes: 5188
//
//  main.cpp
//  Look for the Winner!
//
//  Created by x15071xx on 2017/06/19.
//  Copyright ?? 2017??´ AIT. All rights reserved.
//

#include <iostream>
#include <vector>

using namespace std;

int main(int argc, const char * argv[]) {
    
    
    
    
    while (1) {
        
        int n;
        vector<char> c;
        
        cin >> n;
        
        if (n == 0) {
            break;
        }
        
        //c??\???
        for (int i = 0; i < n; i++) {
            char tmp;
            cin >> tmp;
            c.push_back(tmp);
        }
        
        //?¨????
        //[0] = ????\¨??° [1] = ????£????
        int max[2] = {0}, max2[2] = {-1};
        bool flag = false;
        int abc[26]={0};
        for (int i = 0; i < n; i++) {
            
            abc[c[i]-'A']++;
            
            //??????????\¨??°????????????, ????????????????\¨??°????????????
            if (max[0] < abc[c[i]-'A']) {
                max[0] = abc[c[i]-'A'];
                max[1] = c[i]-'A';
            }
            for (int j = 0; j < 26; j++) {
                if (j != max[1] && max2[0] < abc[j]) {
                    max2[0] = abc[j];
                    max2[1] = j;
                }
            }
            
            //?¢????????
            if (max[0] > max2[0]+((n-1)-i)) {
                char tmp = max[1] + 'A';
                cout << tmp << " " << i+1 <<endl;
                flag = true;
                break;
            }
            if (flag) {
                break;
            }
        }
        //???????????¨????????????????\¨??°??????????????£??????????????????
        if (max[0] == max2[0]) {
            cout << "TIE" << endl;
        }
        
    }
    return 0;
}

Measured memory_bytes: 3116
N = int(input())
s = [list(map(str, input().split())) for _ in range(N)]
X = input()
ans = 0
sleepf = False
for i in range(N):
    if sleepf == False:
        if s[i][0] == X:
            sleepf = True
            continue

    if sleepf:
        ans += int(s[i][1])

print(ans)

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

int main(){
  int n;
  cin>>n;
  int a[n];
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  if(n%2==0){
    int x=n-1,y=0;
     for(int i=0;i<n/2;i++){
       cout<<a[x]<<" ";
       x-=2;
     }
     for(int i=0;i<n/2;i++){
       cout<<a[y]<<" ";
       y+=2;
     }
  }else{
    int x=n-1,y=1;
    for(int i=0;i<n/2+1;i++){
      cout<<a[x]<<" ";
      x-=2;
    }
    for(int i=0;i<n/2;i++){
      cout<<a[y]<<" ";
      y+=2;
    }
  }
  cout<<endl;
  return 0;
}


Measured memory_bytes: 2944
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 1000000000



int main(){
	
	string S;
	cin>>S;
	
	deque<char> D;
	for(int i=0;i<S.size();i++){
		D.push_back(S[i]);
	}
	
	int Q;
	cin>>Q;
	int C = 0;
	for(int i=0;i<Q;i++){
		int x;
		cin>>x;
		
		if(x==1){
			C++;
			C%=2;
			continue;
		}
		else{
			int F;
			cin>>F;
			
			char c;
			cin>>c;
			
			F %= 2;
			
			if(F==C){
				D.push_back(c);
			}
			else{
				D.push_front(c);
			}
		}
	}
	
	if(C==1)reverse(D.begin(),D.end());
	
	for(int i=0;i<D.size();i++){
		cout<<D[i];
	}
	cout<<endl;
	
    return 0;
}



Measured memory_bytes: 896
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define all(v) v.begin(),v.end()

using namespace std;
typedef long long ll;




int main()
{
    
    int N,M;
    cin >> N >> M;
    vector<ll> A(N);
    vector <pair<ll,int>> BC(M);
    rep(i,N) cin >> A[i];
    rep(i,M) cin >> BC[i].second >> BC[i].first;
    sort(all(A));
    sort(all(BC));
    reverse(all(BC));
    
    int k = 0;
    bool aa = false;
    rep(i,M){
        if(aa) break;
        rep(j,BC[i].second){
            if(A[k] < BC[i].first){
                A[k] = BC[i].first;
                k++;
                if(k > N) break;
            }else{
                aa = true;
                break;
            }
                
        }
    }
    
    ll ans = 0;
    rep(i,N) ans += A[i];
    cout << ans << endl;
    
    return 0;
}



Measured memory_bytes: 2560
#include<stdio.h>

int main(){
    int a,b,c;
    int aa[110],bb[110];
    int ans = 0;
    int i,j;
    int sums;

    scanf("%d %d %d", &a,&b,&c);
    for(i=0; i<b; i++){
        scanf("%d", &bb[i]);
    }
    for(j=0; j<a; j++){
        sums = c;
        for(i=0; i<b; i++){
            scanf("%d", &aa[i]);
            sums += aa[i]* bb[i];
        }
        if(sums > 0){
            ans += 1;
        }
    }
    printf("%d", ans);

    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>

using namespace std;

template <class It> string join(It i1, It i2)
{
    ostringstream ss;
    for (auto it = i1; it != i2; ++it)
        ss << ((it == i1) ? "" : ", ") << (*it);
    return ss.str();
}

#ifdef DEBUG
#define Dump(x) cerr << #x << " = " << x << endl;
#define Dumps(x) cerr << #x << " : { " << join(x.begin(), x.end()) << " }" << endl;
#else
#define Dump(x)
#define Dumps(x)
#endif


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

    auto judge = [&]() -> bool
    {
        if (S == T) return true;
        
        constexpr int N = 1 + 'z' - 'a';
        unordered_map<char, char> m1, m2;
        
        for (size_t i = 0; i < S.size(); ++i)
        {
            auto r1 = m1.insert({ S[i], T[i] });
            auto r2 = m2.insert({ T[i], S[i] });
            if (r1.first->second != T[i])
                return false;
            if (r2.first->second != S[i])
                return false;
        }
        return true;
    };

    cout << (judge() ? "Yes" : "No") << endl;
}


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

int main() {
	int a, b, c;
	cin >> a >> b >> c;
	if (b - a == c - b) cout << "YES";
	else cout << "NO";
	return 0;
}
/*
31536000のコメント解説欄
ここテンプレで用意してるから、A問題とかだとこの先空欄の危険あり

問題文に条件式まで書いてくれているので、やるだけ
*/

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

int n,a[200200],ans;

set<int> s;

int main(){
  	cin >> n;
  	for(int i = 0; i < n; i++){
    	cin >> a[i];
    }
    s.insert(a[0]);
  	for(int i = 1; i < n; i++){
        if(*s.begin() >= a[i]) ans++;
        s.insert(a[i]);
  	}
  	cout << ans + 1;
	return 0;  
}

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

using namespace std;

////typedef
////------------------------------------------
//typedef vector<int> vi;
//typedef vector<vi> vii;
//typedef vector<string> vs;
//typedef vector<bool> vb;
//typedef vector<vb> vbb;
//typedef pair<int, int> pii;
//typedef long long ll;
//typedef unsigned long long ull;
//
////container util
////------------------------------------------
//#define all(a)  (a).begin(),(a).end()
//#define rall(a) (a).rbegin(), (a).rend()
//#define pb push_back
//#define mp make_pair
//#define iter(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i)
//
////repetition
////------------------------------------------
//#define loop(i,a,b) for(int i=(a);i<(b);++i)
//#define rep(i,n)  loop(i,0,n)
//
////constant
////--------------------------------------------
//const double eps = 1e-10;
//const double pi  = acos(-1.0);
//const double inf = (int)1e8;
//
//// output vector
//// ------------------------------------------
//namespace std {
//    template<typename T> ostream & operator<<(ostream& os, vector<T> const& v){
//        for(auto it=v.begin(); it!=v.end(); ++it){
//            os << *it << (it+1==v.end() ? "" : ",");
//        }
//        return os;
//    }
//}
//
////clear memory
//#define clr(a) memset((a), 0 ,sizeof(a))

string IntToString(int number) {
    stringstream ss;
    ss << number;
    return ss.str();
}

int main(){
    int n;
    cin >> n;
    for(int p=0; p < n; p++){
        string ans;
        string s, t;
        cin >> s >> t;
        if(s.size() > t.size()) swap(s, t);


        int q = t.size()-s.size();
        for(int i=0; i < q; i++) s = "0" + s;

        int up = 0;
        for(int i=s.size()-1; 0 <= i; i--){
            int d = atoi(s.substr(i, 1).c_str());
            int f = atoi(t.substr(i, 1).c_str());
            ans = IntToString((d+f+up)%10) + ans;

            if(0 <= d+f+up-10) up = 1;
            else up = 0;
        }
        if(up == 1) ans = IntToString(1) + ans;

        if(80 < ans.size()) cout << "overflow" << endl;
        else cout << ans << endl;
     }
}

Measured memory_bytes: 1240
#include<stdio.h>
#include<cmath>
using namespace std;
typedef long long ll;
ll n,ans,i;
int main ()
{
	scanf("%lld",&n);
	for(i=sqrt(n);i>0;i--)
	{
		if(n%i==0)
		{
			ans=n/i;
			break;
		}
	}
	ll k=0;
	while(ans)
	{
		k++;
		ans/=10;
	}
	printf("%lld\n",k);
	return 0;
}

Measured memory_bytes: 128
//#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <stack>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <string>
#include <map>
using namespace std;
typedef long long ll;
#define free  freopen ("input.txt", "r", stdin);freopen ("output.txt", "w", stdout);
#define Fast  ios::sync_with_stdio(false); cin.tie(0);
#define pb push_back
#define mp make_pair
#define F first
#define S second

bool vowel(char che)
{
    if (che == 'A' || che == 'E' || che == 'I' || che == 'O' || che == 'U' || che == 'Y')
        return true;
    else
        return false;
}

const int N = 3e5+5;
const int mod = 1e9+7;
ll a[N], b[N], c[N], d, dp1, dis;
char o;
bool mark[N], h;
string s;
//set <ll> st1, st2;
//deque <int> dq;
//vector <ll> vm, vp, vt[N];
//int a1[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};


int main()
{
    Fast
    ll t, n, m, k = 0, f = 0, sum = 0, ans = 0;
    cin >> n >> m >> k >> f;
    ans = max (m*f, k*n);
    sum = max (m*k, n*f);
    cout << max(ans, sum)  << endl;
}


Measured memory_bytes: 3648
def digitsum(n):
    s = str(n)
    array = list(map(int, s))
    return sum(array)

def list_to_num(l):
    s = 0
    for i in range(len(l)):
        s += l[i]*pow(10,i)
    return s

k = int(input())

def func(a):
    n = a+1
    if a == 0:
        return 1
    elif n/digitsum(n)==1:
        return n
    else:
        s = str(n)
        array = list(map(int, s))[::-1]
        if len(list(set(array)))==1 and list(set(array))[0]==9:
            n =list_to_num(array)+1
            s = str(n)
            array = list(map(int, s))[::-1]
        min = pow(10,15)
        ans = 0
        for i in range(len(array)):
            for j in range(array[i]+1,10):
                array[i] = j
                temp = list_to_num(array)/digitsum(list_to_num(array))
                if temp < min:
                    min = temp
                    ans = list_to_num(array)
        return ans


n = 0
for i in range(k):
    print(func(n))
    n = func(n)


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

int main(void) {
    string n;
    cin >> n;
    int max = 0;
    int temp = 0;
    for(int i = 0; i < n.length(); i++){
        if(n[i] == 'A' || n[i] == 'G' || n[i] == 'T' || n[i] == 'C'){
            temp++;
        }else{
            if(temp > max){
                max = temp;
            }
            temp = 0;
        }
    }
    if(temp > max){
        max = temp;
    }
    cout << max << endl;
    return 0;
}

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

using namespace std;

int main(int argc, char const *argv[])
{
	int n=100000;
	map<int,int> m;
	map<int,int>::iterator it;
	map<int,int>::reverse_iterator rit;
	int sum;

	while(1){
		
		cin>>n;
		if(n==0) break;
		if(!m.empty()) cout<<endl;

		cin>>m[10]>>m[50]>>m[100]>>m[500];

		sum=0;
		for(it=m.begin();it!=m.end();it++){
			sum+=((*it).first*(*it).second);
		}
		sum=sum-n;

		for(rit=m.rbegin();rit!=m.rend();rit++){
			(*rit).second-=sum/(*rit).first;
			sum=sum%(*rit).first;
		}

		for(it=m.begin();it!=m.end();it++){
			if((*it).second>0) cout<<(*it).first<<" "<<(*it).second<<endl;
		}

		

	}
	return 0;
}

Measured memory_bytes: 1196
#include<iostream>

using namespace std;

int main(){
    int N; cin >> N;
    int flag = 0;
    
    for(int i = 1;i < 10;i++){
        if((N % i == 0) and (N / i < 10)) flag = 1;
    }
    
    if(flag) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
package main

import (
  "bufio"
  "fmt"
  "os"
  "strconv"
  "strings"
)

const size = 1000000
var reader = bufio.NewReaderSize(os.Stdin,size)
func NextLine() string {
  var line,buffer []byte
  var isPrefix bool = true
  var err error
  for ;isPrefix; {
    line,isPrefix,err = reader.ReadLine()
    if err != nil { panic(err) }
    buffer = append(buffer,line...)
  }
  return string(buffer)
}
func NextInt64() int64 {
  var n int
  n,_ = strconv.Atoi(NextLine())
  return int64(n)
}
func NextInt64Array() []int64 {
  var s []string = strings.Split(NextLine()," ")
  var n int = len(s)
  var k int
  var a []int64 = make([]int64,n)
  for i:=0;i<n;i++ {
    k,_ = strconv.Atoi(s[i])
    a[i] = int64(k)
  }
  return a
}

func main() {
  var n int64
  var a []int64
  var x,y,s,t,i int64
  n = NextInt64()
  a = NextInt64Array()
  x = 0
  y = sum(a)
  s = 9223372036854775806
  for i=0;i<n-1;i++ {
    x += a[i]
    y -= a[i]
    t = abs(x-y)
    if s > t { s = t }
  }
  fmt.Println(s)
}
func sum(a []int64) int64 {
  var s int64 = 0
  for i:=0;i<len(a);i++ { s += a[i] }
  return s
}
func abs(n int64) int64 {
  if n < 0 { return -n }
  return n
}

Measured memory_bytes: 10368
#include <bits/stdc++.h>
using namespace std;
#define ALL(obj) obj.begin(),obj.end()
#define pb(obj) push_back(obj)
#define REP(i,N) for(ll i=0;i<N;i++)
const int MOD = 1000000007;
typedef long long ll;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N,M;
    cin>>N>>M;
    vector<int>div1;
    vector<int>div2;
    for(int i=1;i<=sqrt(M);i++){
        if (M%i==0){
            div1.pb(i);
            if(i!=sqrt(M)){
                div2.pb(M/i);
            }
        }
    }
    for(int i=0;i<div1.size();i++){
    }
    auto itr=lower_bound(ALL(div1),N);
    if(itr!=div1.end()){
        cout<<M/(*itr)<<endl;
        exit(0);
    }
    reverse(ALL(div2));
    itr=lower_bound(ALL(div2),N);
    if(itr!=div2.end()){
        cout<<M/(*itr)<<endl;
        exit(0);
    }
}

Measured memory_bytes: 256
def main():
    h, w = [int(x) for x in input().rstrip("\n").split(" ")]

    from collections import defaultdict
    blacks = []
    board_bw = defaultdict(str)
    board_count = defaultdict(int)
    grouped = {}
    for r in range(h):
        line = input().rstrip("\n")
        for c in range(w):
            board_bw[r,c] = line[c]
            if line[c] == '#':
                blacks.append((r,c))
    offsets = [(1,0), (-1, 0), (0, 1), (0, -1)]
    
    groups = []
    group_no = 0
    total = 0
    for (r,c) in blacks:
        if not (r, c) in grouped:
            group_no += 1
            group_black = 1
            group_white = 0
            black_nexts = [(r, c)]
            grouped[(r,c)] = 1
            while black_nexts:
                white_nexts = []
                for black_r, black_c in black_nexts:
                    for offset_r, offset_c in offsets:
                        white_next = (black_r + offset_r),(black_c + offset_c)
                        if board_bw[white_next] == "." and not white_next in grouped:
                            group_white += 1
                            grouped[white_next] = group_no
                            white_nexts.append(white_next)
                black_nexts = []
                for white_r, white_c in white_nexts:
                    for offset_r, offset_c in offsets:
                        black_next = (white_r + offset_r),(white_c + offset_c)
                        if board_bw[black_next] == "#" and not black_next in grouped:
                            group_black += 1
                            grouped[black_next] = group_no
                            black_nexts.append(black_next)
            total += group_black * group_white
    print(total)
if __name__ == '__main__':
    main()
    

Measured memory_bytes: 49768
#include <bits/stdc++.h>
using namespace std;
#define long long long
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	long n; cin >> n;
	long mons[n + 1], hero[n];
	for (long i = 0; i <= n; i++) cin >> mons[i];
	for (long i = 0; i < n; i++) cin >> hero[i];
	long ans = 0;
	for (long i = 0; i < n; i++){
		if (hero[i] <= mons[i]) ans += hero[i];
		else{
			ans += mons[i], hero[i] -= mons[i];
			if (hero[i] <= mons[i + 1]){
				mons[i + 1] -= hero[i], ans += hero[i];
			}
			else ans += mons[i + 1], mons[i + 1] = 0;
		}
	}
	cout << ans;
}

Measured memory_bytes: 1792
#include"bits/stdc++.h"
#include<boost/multi_array.hpp>
#include<boost/optional.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#include<boost/range/adaptors.hpp>
using namespace std;
namespace adaptor = boost::adaptors;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define cy cout << "Yes" << endl
#define cn cout << "No" << endl
typedef long long ll;

void Main()
{
	int a1, a2, a3;
  	cin >> a1 >> a2 >> a3;
  	if(a1+a2+a3>=22){puts("bust");}
	else{puts("win");}
  return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
	return 0;
}


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

#define endl "\n"

int vis[200005];


void hk()
{
    long long int x=0, y=0, ans=0, n, m;
    cin>>n>>m;

    vector<int> arr(n+1), con;

    for(int i=1;i<=n;i++)
        cin>>arr[i];

    int idx = 1, start, idx1;
    while(vis[idx] != 1)
    {
        vis[idx] = 1;
        con.push_back(idx);
        idx = arr[idx];
        start = idx;
    }
    for(int i=0;i<con.size();i++)
        if(con[i] == start)
        {
            idx1 = i;
            break;
        }

    x = con.size() - idx1;
    if(m <= idx1)
    {
        y = m;
    }
    else
    {
        m -= idx1;
        y = m % x;
        y += idx1;
    }

    cout<<con[y]<<endl;

    return;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

 	int t;
 	t = 1;

 	for(int i=1;i<=t;i++)
    {
        hk();
    }
 	return 0;
}


Measured memory_bytes: 5844
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int  A,B,C,D;
  cin >> A >> B >> C >> D;
  if ( (A+B) == (C+D) ){
    cout << "Balanced"<<endl;
  }
  
  else if( (A+B) <= (C+D) ){
    cout << "Right" << endl;
  }
  
  else {
    cout << "Left" << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<cmath>
using namespace std;
#define int long long int
#define pb push_back
#define ub upper_bound
#define lb lower_bound
#define mp make_pair
#define pii pair<int,int>
#define piii pair< int,pair<int,int> >
#define F first
#define S second
#define all(a) a.begin(),a.end()
#define endl '\n'
#define boost ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define file freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define N 2005
#define mod 1000000007
#define inf 1e17
#define pf push_front
#define pob pop_back
#define pof pop_front
#define debug1(x) cout<<#x<<" "<<x<<endl;
#define debug2(x,y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<endl;
#define debug3(x,y,z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<endl;

int32_t main()
{
   // boost
    int t=1;
    //cin>>t;
    while(t--)
    {
        int n;
        cin>>n;
        int a[n][3];
        for(int i=0;i<n;i++)
        {
            cin>>a[i][0]>>a[i][1]>>a[i][2];
        }
        int res[n][3];
        res[0][0]=a[0][0];
        res[0][1]=a[0][1];
        res[0][2]=a[0][2];
        for(int i=1;i<n;i++)
        {
            res[i][0]=max(res[i-1][1]+a[i][0],res[i-1][2]+a[i][0]);
             res[i][1]=max(res[i-1][0]+a[i][1],res[i-1][2]+a[i][1]);
             res[i][2]=max(res[i-1][1]+a[i][2],res[i-1][0]+a[i][2]);



        }
        cout<<max(res[n-1][0],max(res[n-1][1],res[n-1][2]));
            }


    

}

Measured memory_bytes: 4992
#include <stdio.h>

int main(void) {
	char s[9];
	scanf("%s",s);
	if(s[0]=='S'){
		printf("Cloudy");
	}
	if(s[0]=='C'){
		printf("Rainy");
	}
	if(s[0]=='R'){
		printf("Sunny");
	}
	return 0;
}

Measured memory_bytes: 128
l, r,d = map(int,input().split())
count=0
if r<d:
    print(count)
else:
    if l<d:
        l=d
        count+=1
    elif l%d==0:
        count+=1
    elif l%d!=0:
        l += d-(l%d) 
        count+=1
    count+=((r-l)//d)
    print(count)


Measured memory_bytes: 9176
#include <bits/stdc++.h>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long int;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF = 1e9;
const ll MOD = 1000000007;
typedef pair<ll,ll> P;
int main(){
    int n,y;
    int a,b,c;
    bool out = false;
    cin >> n >> y;
    rep(i,n+1){
        rep(j,n+1-i){
            if (i*10000+j*5000+(n-i-j)*1000 == y){
                a = i;
                b = j;
                c = n-i-j;
                out = true;
            }
            if (out) break;
            if (i == n){
                a = -1;
                b = -1;
                c = -1;
                break;
            }
        }
    }
    PRINT(a << " " << b << " " << c);
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
	int n;
	long long int ans=0;
	cin >> n;
	vector<int>v(100000,0);
	for (size_t i = 0; i < n; i++)
	{
		int h;
		cin >> h;
		v[h]++;
		ans += h;
	}
	cin >> n;
	for (size_t i = 0; i < n; i++)
	{
		int hoge,fuge;
		cin >> hoge >> fuge;
		ans += v[hoge] * (fuge - hoge);
		cout << ans <<endl;
		v[fuge] += v[hoge];
		v[hoge] = 0;
	}
}

Measured memory_bytes: 3796
#include <iostream>
#include <vector>

using namespace std;
typedef long long ll;
#define REP(i,n) for (ll i = 0; i < (n); ++i)

ll gcd(ll a, ll b) {
    if(a < b){
        return gcd(b, a);
    }
    ll r;
    while ((r=a%b)) {
        a = b;
        b = r;
    }
    return b;
}

ll lcm(ll a, ll b){
    return a * (b / gcd(a, b));
}

int main(){
    ll n, m;
    cin >> n >> m;
    string s, t;
    cin >> s >> t;
    ll ans = lcm(s.size(), t.size());
    REP(i, s.size()){
        if(i * m % n == 0 && s[i] != t[i * m / n]){
            cout << -1 << endl;
            return 0;
        }
    }
    REP(i, t.size()){
        if(i * n % m == 0 && t[i] != s[i * n / m]){
            cout << -1 << endl;
            return 0;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 512
//#include"bits/stdc++.h"
 
#include "iostream"
#include "algorithm"
#include "set"
#include "unordered_map"
#include "numeric"
#include "limits"
#include "queue"
#include "stack"
#include "math.h"
#include "cstring"
#include "map"

// NOTE TO SELF // try to simplyfy the problem

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

#define ll long long int

//const int mod=1000000007;

using namespace std;




int main()
{

    int n;
    cin>>n;
    
    vector<int> dp(3,0);
    
    for(int day=0;day<n;day++)
    {
        vector<int> new_dp(3);
        vector<int> c(3);
        
        for(int i=0;i<3;i++)
            cin>>c[i];
        
        for(int i=0;i<3;i++)
        {
            for(int j=0;j<3;j++)
            {
                if(i!=j)
                    new_dp[j]=max(new_dp[j],dp[i]+c[j]);
                
            }
        }
        
        dp=new_dp;
        
        
        
    }
    
    cout<<max(dp[0],max(dp[1],dp[2]))<<endl;
    
    
}


Measured memory_bytes: 3616
public class Main{
  public void run(java.io.InputStream in, java.io.PrintStream out){
    java.util.Scanner sc = new java.util.Scanner(in);
    int n, m;
    int[] c, d, count;
    int i, j, ans;

    n = sc.nextInt(); m = sc.nextInt();
    c = new int[m]; d = new int[m]; count = new int[n];

    for(i = 0;i < m;i++){
      c[i] = sc.nextInt(); d[i] = sc.nextInt();
      for(j = c[i];j < d[i];j++)count[j]++;
    }

    ans = n + 1;
    for(i = 0;i < n;i++)if(count[i] > 0)ans+=2;

    out.println(ans);

    sc.close();
  }
  public static void main(String[] args){
    (new Main()).run(System.in, System.out);
  }
}

Measured memory_bytes: 22188
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#include <functional> 
#define ff first 
#define endl "\n"
#define ss second 
#define li list<int>
#define vi vector<int>
#define ll long long int
#define pii pair<int,int>
#define vii vector<pair<int,int> >
#define mp make_pair
#define pb push_back
#define setbits(x) __builtin_popcountll(x)
#define custom  pair<int,pair<int,int> >
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag,tree_order_statistics_node_update> pbds; 
#define mod 1000000007
double dp[301][301][301];
double solve(int x,int y,int z,int n){
    if(x<0 || y<0 || z<0){
        return 0;
    }
    if(x==0 && y==0 && z==0)
    return 0;
    if(dp[x][y][z]>-0.5){
        return dp[x][y][z];
    }
    double exp=n+x*solve(x-1,y,z,n)+y*solve(x+1,y-1,z,n)+z*solve(x,y+1,z-1,n);
    return dp[x][y][z]=exp/(x+y+z);
}
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    int n;
    cin>>n;
    int one=0;int two=0;int three=0;
    int ex;
    for(int i=0;i<n;i++){
        cin>>ex;
        if(ex==1){
            one++;
        }
        else if(ex==2){
            two++;
        }
        else{
            three++;
        }
    }
    memset(dp,-1,sizeof dp);
    cout<<fixed<<setprecision(9)<<solve(one,two,three,n);
    return 0;
}

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

// {U}{INT,LONG,LLONG}_{MAX,MIN}
#define INF         INT_MAX/3
#define LLINF       LLONG_MAX/3
#define MOD         (1000000007LL)
#define MODA(a, b)  a=((a)+(b))%MOD
#define MODP(a, b)  a=((a)*(b))%MOD
#define inc(i, l, r)   for(int i=(l);i<(r);i++)
#define dec(i, l, r)   for(int i=(r)-1;i>=(l);i--)
#define pb          push_back
#define se          second
#define fi          first
#define mset(a, b)  memset(a, b, sizeof(a))

using LL  = long long;
using G   = vector<vector<int>>;

int di[] = {0, -1, 0, 1};
int dj[] = {1, 0, -1, 0};
// }}}

int main() {
    cin.tie(0);ios::sync_with_stdio(false);
    int n, k;cin >> n >> k;
    string s;cin >> s;
    char b = '1';
    int cnt = 0;
    int p = 0;
    vector<int> v;
    inc(i, 0, n){
        if(s[i] != b){
            v.pb(cnt);
            p = 1-p;
            cnt = 1;
        }else{
            cnt++;
        }
        b = s[i];
    }
    v.pb(cnt);
    if(v.size()%2 == 0){
        v.pb(0);
    }
    int m = v.size();
    
    int l = 0;
    int r = min(2*k, m-1);
    int ans = 0;
    inc(i, 0, r+1){
        ans += v[i];
    }
    int now = ans;
    while(true){
        l += 2;
        r += 2;
        if(r >= m) break;
        now -= v[l-2];
        now -= v[l-1];
        now += v[r-1];
        now += v[r];
        ans = max(ans, now);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1020
import copy
n = int(input())
ls = []
for i in range(n):
    a = int(input())
    ls.append(a) 
ls2 = copy.copy(ls)
ls.sort()
max1 = ls[-1]
max2 = ls[-2]


for i in ls2:
    if i != max1:
        print(max1)
    else:
        print(max2)

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

string s;
int len,o;

int main(){
    cin>>s;
    len=s.length();
    for(int i=0;i<len;i++){
        if(s[i]=='C'){
            for(int j=i;j<len;j++){
            	if(s[j]=='F'){
            		printf("Yes\n");
            		return 0;
				}
			}
        }
    }
    printf("No\n");
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
int main(){
    string w;
    cin >> w;
    vector<int> a(26,0);
    for(int i=0; i<w.size(); i++){
        char c; c = w[i];
        a[c-'a']++;
    }
    for(int i=0; i<a.size(); i++){
        if(a[i]%2){
            cout<<"No";
            break;
        }
        if(i==a.size()-1&&!(a[i]%2)) cout<<"Yes";
    }
    cout << "\n";
    return 0;
    
}

Measured memory_bytes: 256
main = interact $ unlines . map (class_ . read) . lines
class_ n
 |             n <= 48.0 = "light fly"
 | 48.0 < n && n <= 51.0 = "fly"
 | 51.0 < n && n <= 54.0 = "bantam"
 | 54.0 < n && n <= 57.0 = "feather"
 | 57.0 < n && n <= 60.0 = "light"
 | 60.0 < n && n <= 64.0 = "light welter"
 | 64.0 < n && n <= 69.0 = "welter"
 | 69.0 < n && n <= 75.0 = "light middle"
 | 75.0 < n && n <= 81.0 = "middle"
 | 81.0 < n && n <= 91.0 = "light heavy"
 | 91.0 < n              = "heavy"

Measured memory_bytes: 4068
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef pair<int, int> P;
int main(){
  int N, K;
  cin >> N >> K;
  vector<double> p(N);
  vector<double> e(N);
  rep(i, N) cin >> p[i];
  rep(i, N){
    e[i] = (1 + p[i])/2.0;
  }
  double sum;
  double max = 0;
  vector<double> s(N+1);
  s[0] = 0.0;
  for(int i = 0; i < N; i++){
    s[i+1] += s[i] + e[i];
  }
  for(int i = 0; i + K <= N; i++){
    if(s[i+K] - s[i] > max){
      max = s[i+K] -s[i];
    }
  }
  cout <<setprecision(18)<< max << endl;
  return 0;
}


Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
using ld = long double;
using P = complex<ld>;
const ld eps = 1e-6;

int main()
{
	int N;
	while (cin >> N, N) {
		vector<ld> x(N), y(N);
		vector<P> p(N);
		for (int i = 0; i < N; i++) {
			cin >> x[i] >> y[i];
			p[i] = P(x[i], y[i]);
		}
		vector<P> ko;
		for (int i = 0; i < N; i++) {
			for (int j = i + 1; j < N; j++) {
				if (norm(p[i] - p[j]) < 4.0 + eps) {
					auto d = p[i] - p[j];
					ko.push_back(p[j] + (d * (ld)0.5) + d * P(0, 1) / abs(d) * sqrtl(1 - norm(d * (ld)0.5)));
					ko.push_back(p[j] + (d * (ld)0.5) - d * P(0, 1) / abs(d) * sqrtl(1 - norm(d * (ld)0.5)));
				}
			}
		}
		int res = 1;
		for (auto c : ko) {
			int cnt = 0;
			for (int i = 0; i < N; i++) {
				if (norm(c - p[i]) < 1.0001) {
					cnt++;
				}
			}
			res = max(res, cnt);
		}
		cout << res << endl;
	}
	return 0;
}

Measured memory_bytes: 4720
import sys
sys.setrecursionlimit(10**7)

def f(b,n):
    if b<2 :return -1
    if n<b :return n
    return n%b + f(b,n//b)

n,s = [int(input()) for _ in [0]*2]
b = -1
if n==s:b=n+1
else:
    for i in range(2,int(n**0.5)+1):
        if f(i,n)==s:
            b = i
            break
    else:
        for i in range(int(n**0.5),0,-1):
            j = (n-s)//i + 1
            if f(j,n)==s:
                b = j
                break
print(b)

Measured memory_bytes: 3316
#include <bits/stdc++.h>
#define ll long long int
#define MOD 1000000007
#define INF 1e18
#define PI 3.14159265358979

using namespace std;

ll power(ll n, ll k);
ll inv(ll n);
ll genfact(ll n, ll k);
ll fact(ll n);
ll nck(ll n, ll k);

int main(void){
  
  int n;
  cin >> n;
  vector<int> p(n);
  for (int i = 0; i < n; i++)
    cin >> p[i];

  int t = 0;
  for (int i = 1; i < n - 1; i++){
    if ((p[i-1] < p[i] && p[i] < p[i+1]) || (p[i-1] > p[i] && p[i] > p[i+1]))
      t++;
  }

  cout << t << endl;

  return 0;
}


ll power(ll n, ll k){
  ll res = 1;
  while(k > 0){
    if (k & 1) 
      res = res * n % MOD;
    n = n * n % MOD;
    k >>= 1;
  }
  return res;
}

ll genfact(ll n, ll k){

  ll res = 1;
  while (k >= 0){
    res = (res * (n - k)) % MOD;
    k--;
  }

  return res;
}

ll inv(ll n){
  return power(n, MOD - 2);
}

ll fact(ll n){
  return genfact(n, n - 1);
}

ll nck(ll n, ll k){
  if (k == 0)
    return 1;

  return ((genfact(n, k) % MOD) * inv(fact(k))) % MOD;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n,l;
    cin >> n >> l;
    string s[n];
    for(int i=0;i<n;i++){
        cin >> s[i];
    }
    sort(s,s+n);
    for(int i=0;i<n;i++){
        cout << s[i];
    }
}


Measured memory_bytes: 256
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

n = int(input())
if n == 1:
    print(0)
else:
    l = prime_factorize(n)
    # print(l)
    cnt = 2

    tem = l[0]
    for i in range(1, len(l)):
        if l[i] == tem:
            l[i] = tem ** cnt
            cnt += 1
        else:
            tem = l[i]
            cnt = 2

    l.sort()
    # print(l)

    cnt = 0
    i = 0
    while n != 1 and i < len(l):
        if n % l[i] == 0:
            n /= l[i]
            cnt += 1
        i += 1

    print(cnt)

Measured memory_bytes: 9308
#define George_Plover
#include <queue>
#include <map>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#define LL long long
#define MAXN 1000002
#define MAXM
#define INF
using namespace std;
char s[MAXN];
int dp[MAXN][2];
int n;
int main()
{
    scanf("%s",s+1);
    n=strlen(s+1);
    s[0]='0';
    dp[n][0]=s[n]-'0';
    dp[n][1]=1+10-(s[n]-'0');
    for(int i=strlen(s+1)-1;i>=1;i--)
    {
        dp[i][0]=min(dp[i+1][0]+s[i]-'0',dp[i+1][1]+s[i]-'0');
        dp[i][1]=min(dp[i+1][0]+1+10-(s[i]-'0'),dp[i+1][1]+11-(s[i]-'0')-2);
    }
    cout<<min(dp[1][0],dp[1][1])<<endl;
    
    return 0;
}


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

int main()
{
  int D;
  cin >> D;
  
  string ans;
  if (D == 25) ans = "Christmas";
  else if (D == 24) ans = "Christmas Eve";
  else if (D == 23) ans = "Christmas Eve Eve";
  else ans = "Christmas Eve Eve Eve";
  
  cout << ans << endl;
}

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

int main(){
	string s;
	cin>>s;
	int n=s.size();
	int ans[n];
	for(int i=0;i<n;i++) ans[i]=0;
	int l;
	for(int i=n-1;i>=0;i--){
		if(s[i]=='L') l=i;
		else{
			if((l-i)&1) ans[l-1]++;
			else ans[l]++;
		}
	}
	int r;
	for(int i=0;i<n;i++){
		if(s[i]=='R') r=i;
		else{
			if((i-r)&1) ans[r+1]++;
			else ans[r]++;
		}
	}
	for(int i=0;i<n;i++){
		cout<<ans[i]<<" ";
	}
	cout<<"\n";
	return 0;
}

Measured memory_bytes: 1024
import std.stdio;
import std.string;
import std.conv;
import std.algorithm;
import std.array;
import std.range;
import std.math;

void main(){
	auto A=readln.split.to!(int[]),x=A[0],a=A[1],b=A[2];
	if(a>=b)writeln("delicious");
	else if(a<b&&b-a<=x)writeln("safe");
	else if(a<b&&b-a>x)writeln("dangerous");
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
int table[310][310];
int H, W, K;
vector<string> V;
bool check(int num,int h1, int h2, int w1, int w2){
    if(h1 < 0 || h2 >= H || w1 < 0 || w2 >= W)return false;
    rep(i,h1,h2+1)rep(j,w1,w2+1){
        if(table[i][j] != 0 && table[i][j] != num){
            return false;
        }
    }
    return true;
}
void fill(int num, int h1, int h2, int w1, int w2){
    rep(i,h1,h2+1)rep(j,w1,w2+1){
        table[i][j] = num;
    }
}
void dump(){
    rep(i,0,H)rep(j,0,W){
        cout << table[i][j] << " \n"[j==W-1];
    }
}
main(){
    
    cin >> H >> W >> K;
    
    V.resize(H);
    
    rep(i,0,H)cin >> V[i];

    int num = 1;
    rep(i,0,H)rep(j,0,W){
        if(V[i][j] == '.')continue;
        table[i][j] = num;
        num++;
    }
    //dump();
    num = 1;
    /*
    rep(i,0,H)rep(j,0,W){
        if(V[i][j] == '.')continue;
        
        int up = i, down = i, left = j, right = j;
        bool flag = 0;
        do{
            flag = 0;
            //up
            if(check(num, up-1, up, left, right)){
                fill(num, up-1, up, left, right);
                up--;
                flag = 1;
            }
            //left
            if(check(num, up, down, left-1, left)){
                fill(num, up, down, left-1, left);
                left--;
                flag = 1;
            }
            //down
            if(check(num, down, down+1, left, right)){
                fill(num, down, down+1, left, right);
                down++;
                flag = 1;
            }
            //right
            if(check(num, up, down, right, right+1)){
                fill(num, up, down, right, right+1);
                right++;
                flag = 1;
            }
        }while(flag);
                 
        num++;
    }
    */
    int fh = -1, first = INF;
    rep(i,0,H){
        int prev = -1;
        rep(j,0,W){
            if(V[i][j] == '.')continue;
            else rep(k,prev+1,j)table[i][k] = num;
            if(first == INF)first = i;
            fh = i;
            prev = j;
            num++;
        }
        for(int j = W-1;j >= 0;j--){
            if(table[i][j] == 0)continue;
            rep(k,j,W)table[i][k] = num-1;
            break;
        }
        if(prev != -1 || i == 0)continue;
        rep(j,0,W)table[i][j] = table[i-1][j];
    }
    rep(i,0,first)rep(j, 0, W) table[i][j] = table[first][j];
    /*
    rep(j,0,W){
        rep(i,fh,H){
            table[i][j] = table[fh][j];
        }
    }
    */
    dump();
    
    
}

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

using namespace std;
typedef long long int lli;
typedef pair<int,int> pii;

int main()
{
	int s;
	scanf("%d",&s);

	double ans = s;
	ans *= s;
	ans *= s;

	ans /= 27;

	printf("%.10f\n",ans);
}

Measured memory_bytes: 256
import fractions
from functools import reduce

N = int(input())
A = list(map(int, input().split()))

p = 10**9+7
ans = 0

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

lcm = lcm_list(A)

for i in A:
    ans += lcm // i

print(ans%p)

Measured memory_bytes: 6112
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
ll dp[55][3000], x[55];
int main(){
	int n, a;
	cin >> n >> a;
	for(int i = 0; i < n; i ++){
		cin >> x[i];
	}
	dp[0][0] = 1;
	for(int i = 0; i < n; i ++){
		for(int cnt = n; cnt >= 0; cnt --){
			for(int sum = 3000; sum >= 0; sum --){
				if(!dp[cnt][sum]) continue;
				dp[cnt + 1][sum + x[i]] += dp[cnt][sum];
			}
		}
	}
	ll ans = 0;
	for(int i = 1; i <= n; i ++) ans += dp[i][i * a];
	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 640
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<utility>
#include<algorithm>
#include<cstdio>
#include<iomanip>
#include<queue>
#include<stack>

#define ll int64_t
#define Rep(i, n) for (ll i = 0; i < n; i++)

using namespace std;

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

    ll N, H, W;
    cin >> N >> H >> W;
    ll ans = 0;
    Rep (i, N) {
        ll a, b;
        cin >> a >> b;
        if (a >= H && b >= W) {
            ans++;
            // cout << i << "\n";
        }
    }

    cout << ans << "\n";
}

Measured memory_bytes: 256