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

using namespace std;

#define rep(i, x)   for (__typeof(x) i = 0; i < x; i++)
#define mp             make_pair
#define pb             push_back
#define fi             first
#define se             second
#define sz(x)          (int)((x).size())
#define all(x)         (x).begin(), (x).end()
#define sci(x)         int x;       scanf("%d", &x);
#define scii(x, y)     int x, y;    scanf("%d %d", &x, &y);
#define sciii(x, y, z) int x, y, z; scanf("%d %d %d", &x, &y, &z);
#define TC(x)          sci(x); while(x --)
#define eprintf(...)   fprintf(stderr, __VA_ARGS__)
#define debug(x)       { cerr << #x << " = " << x << endl; }
#define repi(i, x)  for (__typeof(x) i = x-1; i >= 0; i --)
#define fore(itr, x)   for (__typeof(x.begin()) itr = x.begin(); itr != x.end(); itr ++)
#define forei(itr, x)  for (__typeof(x.end()) itr = x.end() - 1; itr != x.begin() - 1; itr --)
typedef long long      ll;
typedef pair<int, int> ii;
typedef pair<ii, int>  iii;
typedef vector<int>    vi;
typedef vector<ii>     vii;
typedef vector<iii>    viii;
typedef vector<vector<int> > vvi;
const   int            infi = numeric_limits<int>::max();
const   double         eps = 0;
const   int            ms  = 0;

int main()
{
    ios::sync_with_stdio(false);//endl->"\n"
    cin.tie(0);
    int s;
    cin >> s;
    vi v(10000001, 0);
    v[s] = 1;
    int a = s;
    int b = 0;
    for(int i = 2; i<=10000000; i++){
        if(a % 2==0)
        a = a/2;
        else a = 3*a+1;
        v[a]++;
        if(v[a]==2){
            cout << i << "\n";
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 39296
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define mp make_pair
#define PI pair<int,int>
#define For(i,l,r) for(int i=(int)(l);i<=(int)(r);i++)
#define Rep(i,r,l) for(int i=(int)(r);i>=(int)(l);i--)
#define pb push_back
#define fi first
#define se second
inline char gc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
#define gc getchar
inline ll read(){
	ll x = 0; char ch = gc(); bool positive = 1;
	for (; !isdigit(ch); ch = gc())	if (ch == '-')	positive = 0;
	for (; isdigit(ch); ch = gc())	x = x * 10 + ch - '0';
	return positive ? x : -x;
}
inline void write(ll a){
    if(a<0){
    	a=-a; putchar('-');
	}
    if(a>=10)write(a/10);
    putchar('0'+a%10);
}
inline void writeln(ll a){write(a); puts("");}
inline void wri(ll a){write(a); putchar(' ');}
inline ull rnd(){
	return ((ull)rand()<<30^rand())<<4|rand()%4;
}
const int N=1<<18|2,mod=998244353;
ll a[N],f[N],fd[N],A[N];
ll ksm(ll a,int b){
	int ans=1;
	for(;b;b>>=1){
		if(b&1)ans=ans*a%mod;
		a=a*a%mod;
	}
	return ans;
}
void FWT(ll *a,int n){
	For(i,0,n-1){
		For(j,0,(1<<n)-1)if(j>>i&1){
			ll x=a[j-(1<<i)],y=a[j]; //cout<<j<<" "<<a[j]<<" "<<x<<" "<<y<<endl;
			a[j-(1<<i)]=(x+y)%mod; a[j]=(x-y)%mod;
		}
	}
}
void UFWT(ll *a,int n){
	FWT(a,n);
	ll inv=ksm(1<<n,mod-2);
	//For(i,0,(1<<n)-1)a[i]=a[i]*inv%mod;
}
int main(){
	int n=read(); ll sum=0;
	For(i,0,(1<<n)-1)a[i]=read();
	For(i,0,(1<<n)-1)sum=(sum+a[i])%mod;
	sum=ksm(sum,mod-2); 
	For(i,0,(1<<n)-1)a[i]=a[i]*sum%mod;
	FWT(a,n); //cout<<a[0]<<endl;
	memcpy(A,a,sizeof(A)); UFWT(A,n);
	For(i,0,(1<<n)-1){
		if(i==0){f[i]=1; }
		else f[i]=ksm(a[i]-1,mod-2); 
		//cout<<a[i]<<" "<<A[i]<<" "<<f[i]<<" "<<fd[i]<<endl;
	}
	UFWT(f,n);
	For(i,0,(1<<n)-1){
		//cout<<xs<<" "<<f[0]<<" "<<fd[0]<<" "<<f[i]<<" "<<fd[i]<<endl;
		writeln(((f[i]-f[0])%mod+mod)%mod);
	}
}

Measured memory_bytes: 11008
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
 
const int Nmax=200010;
 
int main() {
	int N,M;
	string s[100],t[100];
	map<string, int> mp;
	cin >> N;
	for(int i=0;i < N;i++){
		cin >> s[i];
		mp[s[i]]++;
	}
	cin >> M;
	for(int i=0;i < M;i++){
		cin >> t[i];
		mp[t[i]]--;
	}
	int mac=0;
	for(int i=0;i < N;i++) mac = max(mac, mp[s[i]]);
	cout << mac << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    int n, q;
    cin >> n >> q;
    vector<int> v(n), v2(n);
    for (auto &&i : v) scanf("%d", &i);
    v2 = v;
    sort(v2.begin(),v2.end());
    map<int, int> m;
    for (int _ = 0; _ < q; ++_) {
        string s; int x;
        cin >> s >> x;
        if(s == "ADD"){
            m[v[x-1]]++;
        }else if(s == "REMOVE"){
            m[v[x-1]]--;
            if(!m[v[x-1]]) m.erase(v[x-1]);
        }else {
            int ng = -1, ok = 1000000001;
            while(ok-ng > 1){
                int mid = (ok+ng)/2;
                int val = 0, r = 0;
                for (auto &&i : m) {
                    int l = lower_bound(v2.begin(),v2.end(), i.first-mid)-v2.begin();
                    int newr = upper_bound(v2.begin(),v2.end(), i.first)-v2.begin();
                    if(r < l) val += l-r;
                    r = newr;
                }
                if(n-r+val <= x) ok = mid;
                else ng = mid;
            }
            if(ok == 1000000001) puts("NA");
            else cout << ok << "\n";
        }
    }
    return 0;
}


Measured memory_bytes: 10708
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <iomanip>
#define ll long long

using namespace std;

long long MOD = 1000000007;
vector<int> primes(0);
void prime_number(int N){
    vector<int> tmp(N+1,1);
    tmp[0]=tmp[1]=0;
    for(int i=2; i<=N; i++){
        if(tmp[i]==1){
            primes.push_back(i);
        }
        for(long long j= (long long) i*i; j<=N; j+=i){
            tmp[j]=0;
        }
    }
}

vector<int> factorize(ll x){
    vector<int> ret(primes.size(),0);
    for(int i=0; i<primes.size(); i++){
        ll p=primes[i];
        while(x%p==0){
            x/=p;
            ret[i]++;
        }
    }
    if(x!=1){
        primes.push_back(x);
        ret.push_back(1);
    }
    return ret;
}

int main(){
    ll N;
    cin >> N;
    if(N==2){
        cout << 1 << endl;
        return 0;
    }

    int ans =2;
    for(ll i=2; i*i<=N; i++){
        if(N%i==1){
            ans++;
            if(i!=N/i){
                ans++;
            }
            //cout << i << endl;
            continue;
        }

        ll tmp=N;
        while(tmp%i==0){
            tmp/=i;
        }
        if(tmp%i==1){
            ans++;
            //cout << i << endl;
        }
    }
    cout << ans << endl;

}

Measured memory_bytes: 384
W, H, N = map(int, input().split())
h = {1: 0, 2: W, 3: 0, 4: H}
for i in range(N):
    x, y, a = map(int, input().split())
    if a == 1:
        h[a] = max(h[a], x)
    elif a == 2:
        h[a] = min(h[a], x)
    elif a == 3:
        h[a] = max(h[a], y)
    else:
        h[a] = min(h[a], y)
ans = W * H
ans -= H * (h[1] + W-h[2])
ans -= max(0, (W - (h[1] + W-h[2]))) * (h[3] + H-h[4])
print(max(ans, 0))


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

#define rep(i,n) for(int i=0;i<(n);++i)
#define loop(i,b,n) for(int i=b;i<(n);++i)
#define each(e,v) for(auto &&e : v)

#define all(v) (v).begin(),(v).end()
#define sz(v) (int)v.size()

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;

const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const double EPS = 1e-9;

template<typename A,typename B> inline void chmin(A &a,B b){ if(a>b) a=b; }
template<typename A,typename B> inline void chmax(A &a,B b){ if(a<b) a=b; }
template <typename T> inline void print(const T& x) { cout << x << endl; }

int main() {
    string s,t;
    cin >> s >> t;
    int count = 0;
    rep(i,s.size()) if(s[i]!=t[i]) ++count;
    print(count);
    return 0;
}


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

int main(){
    int H, W;
    
    while(1){
        cin >> H >> W;
        if (H == 0 && W == 0) break;
        for (int i = 1; i <= H; i++){
            for (int j = 1; j <= W; j++){
                if (1 < i && i < H && 1 < j && j < W){
                    printf(".");
                    
                }
                else {
                    printf("#");
                    
                }
                
            }
            printf("\n");
            
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 3008
'use strict'
function main(inp) {
  inp = inp.trim().split(' ').map(n => Number(n));
  const h = inp[2] / inp[0] / inp [1] * 2
  if (h > inp[0]) {
    let a = 
    console.log(Math.atan2(inp[1] - (inp[2] / inp[0] / inp[0]), (inp[0] / 2)) * 180 / Math.PI)
  } else {
    console.log(90 - (Math.atan2(h, inp[1]) * 180 / Math.PI))
  }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 7372
n=int(input())
AB=[]
for i in range(n):
    a,b=map(int,input().split())
    AB.append([a+b,a,b])
AB.sort(reverse=True,key=lambda x:x[0])
ans=0
for i in range(n):
    if i%2==0:
        ans+=AB[i][1]
    else:
        ans-=AB[i][2]
print(ans)

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

int main(){
    int n;
    cin >> n;
    vector<int> a;
    for(int i=0;i<n;++i){
        int tmp;
        cin >> tmp;
        a.push_back(tmp);
    }
    sort(a.rbegin(), a.rend());
    int alice = 0, bob = 0;
    for(int i=0;i<a.size();++i){
        if(i%2)bob += a[i];
        else alice += a[i];
    }

    cout << alice - bob << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define debug cerr << "-- " << __LINE__ << " --" << endl
#define MOD 1000000007
#define ALL(o) (o).begin(), (o).end()
typedef long long int ll;
typedef unsigned long long int ull;

using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
template <typename T> string to_string(const vector<T> &xs) {string s="["; for(int i=0;i<xs.size();i++) s += (i>0 ? " " : "") + to_string(xs[i]); return s + "]";}
template <typename T> ll argmax(const T &xs) {return distance(xs.begin(), max_element(xs.begin(), xs.end()));}
template <typename T> ll argmin(const T &xs) {return distance(xs.begin(), min_element(xs.begin(), xs.end()));}
ll nextLL(){ll x; scanf("%lld", &x); return x;}
int nextInt(){int x; scanf("%d", &x); return x;}
string nextString(){string s; cin >> s; return s;}


ll extgcd(ll a, ll b, ll &x, ll &y) {
    /* g を返す時点で ax + by == g となる */
    ll g = a; x = 1; y = 0;
    if (b != 0) g = extgcd(b, a % b, y, x), y -= (a / b) * x;
    return g;
}
ll gcd(ll a, ll b) { ll x, y; return extgcd(a, b, x, y); }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

ll remainder(ll x, ll y) {assert(y > 0); ll r = x % y; if (r < 0) r += y; return r;}
ll quotient(ll x, ll y) {assert(y > 0); return (x - remainder(x, y)) / y;}

class llm{
	ll n;
public:
	llm(){n = 0;}
	llm(ll n){this->n = (n >= 0) ? (n % MOD) : (MOD - 1 - (-n-1 % MOD));}
	operator ll() const {return n;}
	llm operator+(const llm &y) const{ return llm((ll)*this + (ll)y);}
	llm operator+=(const llm &y) { *this = *this + y; return *this;}
	llm operator-(const llm &y) const{ return llm((ll)*this - (ll)y);}
	llm operator-=(const llm &y) { *this = *this - y; return *this;}
	llm operator-() const{ return llm(0) - *this;}
	llm operator*(const llm &y) const{ return llm((ll)*this * (ll)y);}
	llm operator*=(const llm &y) { *this = *this * y; return *this;}
	llm operator/(const llm &y) const{ return *this * y.inv();}
	llm operator/=(const llm &y) { *this = *this / y; return *this;}
	llm inv() const{
		ll x, y;
		if (extgcd(n, MOD, x, y) == 1) return llm(x);
  		return llm(0); // unsolvable
	}
	friend istream& operator >> (istream& os, llm& x);
	friend ostream& operator << (ostream& os, const llm& x);
};
istream& operator >> (istream& is, llm& x){ll n; is >> n; x = llm(n); return is;}
ostream& operator << (ostream& os, const llm& x){os << (ll)x; return os;}

template<typename T> T comb(ll n, ll k){
	T ret = 1;
	for(ll i=1;i<=k;i++) ret = ret * T(n - k + i) / T(i);
	return ret;
}



ull x;

int main(void){
	cin >> x;
	ull n = 100LL;
	for(ll i=1;;i++){
		n = (ull)(n * 1.01);
		if (x <= n){
			cout << i << endl;
			return 0;
		}
	}
    return 0;
}




Measured memory_bytes: 3636
#input
N, M, L = map(int, input().split())
A = [0] * M
B = [0] * M
C = [0] * M
for i in range(M):
    A[i], B[i], C[i] = map(int, input().split())
Q = int(input())
s = [0] * Q
t = [0] * Q
for i in range(Q):
    s[i], t[i] = map(int, input().split())

#output
from scipy.sparse.csgraph import floyd_warshall, shortest_path, dijkstra, bellman_ford, johnson
from scipy.sparse import csr_matrix
import numpy as np

#便宜上A, Bを-1する。
for i in range(M):
    A[i] -= 1
    B[i] -= 1

#FW法で各経路の最短距離を計算する。
graph = csr_matrix((C, (A, B)), shape = (N, N))
dist_matrix = floyd_warshall(csgraph = graph, directed = False, return_predecessors = False)

graph2 = np.full((N, N), np.inf)
graph2[dist_matrix  <= L] = 1
graph2 = csr_matrix(graph2)
dist_matrix2 = floyd_warshall(csgraph = graph2, directed = False, return_predecessors = False)

for q in range(Q):
    if dist_matrix2[s[q]-1][t[q]-1] < 10000000:
        print(int(dist_matrix2[s[q]-1][t[q]-1]-1))
    else:
        print(-1)

Measured memory_bytes: 25952
import heapq

n = int(input())
q = []
for i in range(n):
  a, b = map(int, input().split())
  heapq.heappush(q, [b, a])

t = 0
for i in range(n):
  b, a = heapq.heappop(q)
  t += a
  if t > b:
    print('No')
    break
else:
  print('Yes')

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

#define debug(s) cout << s << endl
#define debug1(s, t) cout << s << " " << t << endl
#define debug2(s, t, u) cout << s << " " << t << " " << u << endl
#define printvec(v)       \
    for (auto &&i : v)    \
        cout << i << " "; \
    cout << endl

using namespace std;
using i64 = long long;

int main()
{
    int n;
    cin >> n;
    vector<int> h(n);
    for (size_t i = 0; i < n; i++)
    {
        cin >> h[i];
    }

    int maxlength = 0;
    int length = 0;
    for (size_t i = 0; i < n - 1; i++)
    {
        if (h[i + 1] <= h[i])
        {
            length++;
            if (i == n - 2)
            {
                maxlength = max(maxlength, length);
            }
        }
        else
        {
            maxlength = max(maxlength, length);
            length = 0;
        }
    }

    cout << maxlength << endl;

    return 0;
}

Measured memory_bytes: 640
import numpy as np

N = int(input())
A = np.array([int(a) for a in input().split()])
ans = sum(A)
lst = np.zeros(10**5+1)
for a in A:
    lst[a] += 1
   
for q in range(int(input())):
    B,C = map(int,input().split())
    ans += (C - B) * lst[B]
    print(int(ans))
    lst[C] += lst[B]
    lst[B] = 0


Measured memory_bytes: 38872
#include <iostream>
#include <fstream>
#include <map>

#define MOD 1000000007
#define f cin


using namespace std;

//ifstream f("date.in");
string k;
long long int d;

long long int dp[10010][110][3];

int main() {

    f >> k >> d;
    long long int n = k.size();
    for (long long int i = 0; i < k[0] - '0'; ++i) {
        dp[1][i % d][0] ++;
    }
    dp[1][(k[0] - '0') % d][1] ++;
    for (long long int i = 2; i <= n; ++i) {
        for (long long int j = 0; j < d; ++j) {
            for (long long int k1 = 0; k1 < 10; ++k1) {
                dp[i][j][0] = (dp[i][j][0] + dp[i - 1][(j + 10 * d - k1) % d][0]) % MOD;
            }
            //cout << dp[1][0][0] << "\n";
            for (long long int k1 = 0; k1 < (k[i - 1] - '0'); ++k1) {
                dp[i][j][0] = (dp[i][j][0] + dp[i - 1][(j + 10 * d - k1) % d][1]) % MOD;
            }
            long long int curr_digit = k[i - 1] - '0';
            dp[i][j][1] = (dp[i][j][1] + dp[i - 1][(j + 10 * d - curr_digit) % d][1]) % MOD;
        }
    }

    long long int ans = (dp[n][0][0] + dp[n][0][1]) % MOD;
    // int ans = (dp[n][0][0]) % MOD;

    /*for (long long int i = 1; i <= n; ++i) {
        for (long long int j = 0; j < d; ++j) {
            cout << dp[i][j][0] << " ";
        }
        cout << "\n";
    }*/
    //cout << dp[n - 1][0][0] << "\n";

    ans = (ans + MOD - 1) % MOD;
    cout << ans << " ";
	return 0;
}


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

#define endl '\n'

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

    int n, a,b; cin >> n >> a >> b;
    int ok = 0;
    for (int i=a; i<=b; i++){
        if (i % n == 0){
            ok = 1;
            break;
        }
    }
    if (ok) cout << "OK\n";
    else cout << "NG\n";
}

Measured memory_bytes: 3648
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#define N 100
using namespace std;

int main(){
  int n,s;
  string str[N];
  vector<string> v[N];
  while(1){
    cin>>n;
    if(!n) break;
    for(int i=0;i<n;i++){
      cin>>str[i];
      s=0;
      for(int j=0;j<str[i].size();j++)
	if(str[i][j]==':'||str[i][j]==','||str[i][j]=='.') v[i].push_back(str[i].substr(s,j-s)),s=j+1;
    }
    while(1){
      int flag=1;
      for(int i=0;i<n;i++){
	if(!v[i].size()) continue;
	if(i==0||!v[0].size()) continue;
	for(int j=1;j<v[0].size();j++)
	  if(v[i][0]==v[0][j]){
	    flag=0;
	    v[0].erase(v[0].begin()+j);
	    for(int l=1;l<v[i].size();l++)  v[0].push_back(v[i][l]);
	  }
	sort(v[0].begin()+1,v[0].end());
	for(int j=1;j<v[0].size()-1;j++){
	  if(v[0][j]==v[0][j+1]){
	    v[0].erase(v[0].begin()+j);
	    j--;
	  }
	}
      }
      if(flag) break;
    }
    v[0].erase(v[0].begin());
    cout<<v[0].size()<<endl;
    for(int i=0;i<n;i++) v[i].clear();
  }
  return 0;
}

Measured memory_bytes: 1324
#include <stdlib.h>
#include <assert.h>
#include <iostream>
#include <algorithm>
#include <functional>
#include <queue>
#include <deque>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <cmath>
#include <complex>
#include <iomanip>
#include <bitset>
#include <random>
#include <vector>
#include<string>
#include <limits.h>

using namespace std;

// Used to track farthest node. 
int x;

// Sets maxCount as maximum distance from node. 
void dfsUtil(int node, int count, bool visited[],
	int& maxCount, list<int>* adj)
{
	visited[node] = true;
	count++;
	for (auto i = adj[node].begin(); i != adj[node].end(); ++i) {
		if (!visited[*i]) {
			if (count >= maxCount) {
				maxCount = count;
				x = *i;
			}
			dfsUtil(*i, count, visited, maxCount, adj);
		}
	}
}

// The function to do DFS traversal. It uses recursive 
// dfsUtil() 
void dfs(int node, int n, list<int>* adj, int& maxCount)
{
	bool visited[n + 1];
	int count = 0;

	// Mark all the vertices as not visited 
	for (int i = 1; i <= n; ++i)
		visited[i] = false;

	// Increment count by 1 for visited node 
	dfsUtil(node, count + 1, visited, maxCount, adj);
}

// Returns diameter of binary tree represented 
// as adjacency list. 
int diameter(list<int>* adj, int n)
{
	int maxCount = INT_MIN;

	/* DFS from a random node and then see
	farthest node X from it*/
	dfs(1, n, adj, maxCount);

	/* DFS from X and check the farthest node
	from it */
	dfs(x, n, adj, maxCount);

	return maxCount;
}

int main() {
	int ans = 0, c = 0, i;
	char x[222222];
	cin >> x;
	for (i = 0; x[i] != '\0'; i++) {
		if (x[i] == 'S')
			c++;
		else if (c > 0) {
			ans -= 2;
			c--;
		}
		ans++;
	}
	cout << ans << endl;
}


Measured memory_bytes: 384
#include <iostream>
#include <sstream>
#include <stdio.h>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <cassert>
#include <exception>
#include <numeric>
using namespace std;
typedef long long ll;
typedef string str;
typedef pair<ll, ll> Pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<char> vc;
typedef vector<str> vs;
typedef vector<Pll> vp;
typedef vector<bool> vb;
#define rep(i, a, n) for (ll i = (a); i < (n); ++i)
#define rrep(i, a, n) for (ll i = (a); i > (n); --i)
#define erep(i, a, n) for (ll i = (a); i <= (n); ++i)
#define rerep(i, a, n) for (ll i = (a); i >= (n); --i)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define mp make_pair
#define sz(x) ((int)x.size())
#define vec_max(V) *max_element(all(V))
#define vec_min(V) *min_element(all(V))
#define vec_sum(V) accumulate(all(V), 0LL)
#define print(X) cout << (X) << "\n"
#define _ << " " <<
#define Yes print("Yes")
#define No print("No")
static const int INF = 1e+9+7;

int main(){
  int N,K;
  cin >> N >> K;
  if(N%2 == 0 && N/2 >= K) print("YES");
  else if(N%2 != 0 && int(N/2)+1 >= K) print("YES");
  else print("NO");
  
}


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

int main(){
    long N;
    long A[200002];
    long B[200002];
    long Atmp;

    cin >> N;
    for(long i=0;i<N;i++){
        cin >> Atmp;
        A[i] = Atmp;
        B[i] = Atmp;
    }
    sort(B, B+N, greater<long>());
    long maxA = B[0];
    long nextA = B[1];
    for(long i=0;i<N;i++){
        if(A[i] == maxA){
            cout << nextA << endl;
        }
        else{
            cout << maxA << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 4736
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll a[201000];
int main()
{
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    ll i,j,k,m,n;
    ll minn=0x3f3f3f3f3f;
    cin>>n;
    cin>>a[1];
    for(i=2;i<=n;i++)
    {
        cin>>a[i];
        a[i]+=a[i-1];
    }
    for(i=1;i<n;i++)
        minn=min(minn,abs(a[n]-a[i]-a[i]));
    cout<<minn<<endl;
    return 0;
}


Measured memory_bytes: 1792
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const int MOD = 1000000007;
const char nl = '\n';
const int MX = 100001; //check the limits, dummy
 
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);    
	
    ll N; cin >> N;
    int ans = 0;
    FOR(i, 2, 1000010) {
        int cur = 0;
        while (N % i == 0) {
            cur++;
            N /= i;
        }
        FOR(j, 1, 10000) {
            if (cur < j) break;
            ans++; cur -= j;
        }
    }
    if (N > 1) ans++;
    cout << ans << nl;
	
	return 0;
}
 
// read the question correctly (ll vs int)
// template by bqi343



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

int main()
{

        long long n,m,a,b,c,d,e,f,g,h,p,q,r,fr,sc,tr,sz,tz,i,j,k,mx=LLONG_MIN,mn=LLONG_MAX;
        long long x,y=0,cnt=0,res=0,ttl=0,ans=0,sum=0; long long flg=0,flag=1,na=0,as=1;
        vector<long long>u,v,w; vector< pair<long long,long long> >vct; vector<string>vst;
        set<long long>st,nt,tt; map<long long,long long>mp,nq,qr; string str,ttr,ntr;

        scanf("%lld",&n);

        if(n==2)printf("1\n");
        else
        {
            x=n-1;

            for(i=1;i*i<=x;i++)
            {
                if(x%i==0)
                {
                    fr=i; sc=x/i;

                    if(fr!=1){  mp[fr]=1; cnt++;  }
                    if(sc!=fr){mp[sc]=1; cnt++;}
                }

            }

            cnt++;

            for(i=2;i*i<=n;i++)
            {
                if(n%i==0)
                {
                    fr=i; sc=n/i;

                    if(mp[fr]==0){ v.push_back(fr); }
                    if(sc!=fr){if(mp[sc]==0){ v.push_back(sc);   } }
                }

            }

            sz=v.size();

            for(i=0;i<sz;i++)
            {
                fr=v[i];

                f=n;

                while(1)
                {
                    if(f%fr==0)
                    {
                        f=f/fr; if(f==1){ cnt++; break;  }
                    }
                    else
                    {
                        if(f%fr==1)cnt++;

                        break;
                    }

                }

            }

            printf("%lld\n",cnt);


        }










    return 0;
}





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

    divisors.sort()
    return divisors


n, m = map(int, input().split())

dvs = make_divisors(m)

for item in dvs:
    if item >= n:
        print(m // item)
        exit()


Measured memory_bytes: 39152
#include<iostream>
#include<iomanip>
#include<climits>
#include<vector>
#include<list>
#include<functional>
#include<algorithm>
#include<string>
#include<cmath>
#include<complex>
#include<set>
#include<map>
#include<unordered_map>
#include<stack>
#include<queue>
#include<deque>
#include<tuple>
#define FOR(i, a, b) for(int i = (a);i < (b);++i)
#define FORR(i, b, a) for (int i = (b) - 1;i >= 0;--i)
#define REP(i, n) for(int i = 0;i < (n);++i)
#define REPR(i, n) for(int i = (n) - 1;i >= 0;--i)
#define ITER(itr, v) for(auto itr = v.begin();itr != v.end();++itr)
#define SORT(v) sort(v.begin(), v.end())
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

template<int p = 1000000007>
class Z {
	ll x;
public:
	Z(ll X) :x(X % p) { ; }
	Z() :x(0) { ; }
	Z operator+(ll y) {
		return Z(x + y);
	}
	Z operator-(ll y) {
		return Z(x - y + p);
	}
	Z operator*(ll y) {
		return Z(x * y);
	}
	Z operator/(ll y) {
		return *this * Z(y).pow(p - 2);
	}
	Z operator+(const Z &r) {
		return *this + r.x;
	}
	Z operator-(const Z &r) {
		return *this - r.x;
	}
	Z operator*(const Z &r) {
		return *this * r.x;
	}
	Z operator/(const Z &r) {
		return *this / r.x;
	}
	Z pow(int i) {
		if (i == 0) return Z(1);
		if (i % 2) return *this * pow(i - 1);
		Z tmp = pow(i / 2);
		return tmp * tmp;
	}
	ll get() {
		return x;
	}
};

Z<> C(int n, int r) {
	if (r > n / 2) return C(n, n - r);
	if (r == 0) return 1;
	Z<> res(1);
	while (r) {
		res = res * n / r;
		--n;
		--r;
	}
	return res;
}

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

	ll n, a, b;
	cin >> n >> a >> b;
	Z<> res = Z<>(2).pow(n) - 1 - C(n, a) - C(n, b);
	cout << res.get() << endl;

	return 0;
}

Measured memory_bytes: 256
module Main where

import Control.Monad
import qualified Data.List as L

main :: IO ()
main = do
    line <- getLine
    let n = (read line) :: Int
    forM_ (make n) putStrLn

make :: Int -> [String]
make 1 = ["a"]
make n = L.concat $ fmap (\p -> append p) preList
    where
    preList = make (n - 1)

append :: String -> [String]
append s = fmap (\c -> s ++ [c]) ['a' .. next]
    where
    next = succ $ L.maximum s


Measured memory_bytes: 2428
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
typedef long long ll;
typedef vector<vector<int>> vvi;
typedef vector<int> vi;
typedef vector<vector<char>> vvc;
typedef vector<char> vc;

int main(){
  vi a(5);
  rep(i,5)cin >> a[i];
  int k;
  cin >> k;
  if(a[4]-a[0]<=k)cout <<"Yay!";
  else cout << ":(";
  cout << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define REP(i, n) for(ll i = 0;i < n;i++)
#define ll long long
#define MOD 1000000007
#define llMAX 9223372036854775807
#define llMIN -9223372036854775808
using vi = vector<ll>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける

ll n,k,x,y;


int main(){
  ll ans=0;
  string s;cin>>s;
  int flag=0;
  if (s[0]=='7')flag=1;
  if (s[1]=='7')flag=1;
  if (s[2]=='7')flag=1;
  if (flag==0){
    cout<<"No"<<endl;
    return 0;
  }else{
    cout<<"Yes"<<endl;
    return 0;
  }
  return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#define test(t) int t; cin>>t; while(t--)
#define p1(x) { cout << " [" << #x << ": " << x << "]\n"; }
#define p2(x) { cout << " [" << #x << ": "; for(auto it:x) cout << it << " "; cout << "]\n"; }
#define pb push_back
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
 
 
void solve()
{
	long long int m, sum=0;
	string n, ans;
	vector<int> a;
	cin>>n;
	// F0R(i, n) {
	// 	cin>>x;
	// 	a.pb(x);
	// }
	for(auto i:n) {
		sum+=(i-'0');
	}
	ans = (sum%9)?"No":"Yes";
	cout<<ans<<endl;
}
 
int main() {
	// your code goes here
	// test(t)
		solve();
	return 0;
}
 

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

int main(){
  // 入力
  int D, G;
  cin >> D >> G;

  vector<int> p(D, 0);
  vector<int> c(D, 0);

  for (int i = 0; i < D; i++) {
    cin >> p[i];
    cin >> c[i];
  }

  int ans = 1001; // 問題数は最大10 * 100

  // ビット全探索　2^D
  // ある配点の問題を全問解く
  // 全問解く配点をビット探索　"1":その配点の問題を全問解く
  for (int mask = 0; mask < (1 << D); mask++) {
    int sum = 0;
    int solve_count = 0; // 解いた問題数
    int rest_max = -1;   // 解かない問題で最も配点が高い問題
    for (int i = 0; i < D; i++) {
      if (mask >> i & 1) {
        sum += 100 * (i + 1) * p[i] + c[i]; // 全問解答＋ボーナスの点数
        solve_count += p[i];
      }
      else {
        rest_max = i; // 解かない問題で最も配点が高い問題を保持
      }
    }
    // 合計値が目標値以下の場合
    if (sum < G) {
      int tmp = 100 * (rest_max + 1); // 追加解答する問題の配点
      int shortage = (G - sum + tmp -1) / tmp; // 追加解答する問題数(不足分)
      // 不足分がその配点の問題数以下なら処理を継続
      if (shortage >= p[rest_max]) {
        continue;
      }
      solve_count += shortage; // 解答した問題数を更新
    }
    ans = min(ans, solve_count); // 解答数が過去最小なら更新
  }

  // 出力
  cout << ans << endl;
}

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

int main() {
	string S;
	int N,M;
	char P;
	cin >> N;
	cin >> S;
	for (size_t i = 0; i < S.size(); i++)
	{
		M = (S.at(i)-'A' + N)%26;
		P = M+'A';
		cout << P;
	}
}

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

using namespace std;
using llong = long long;
using ldbl = long double;
using lpair = pair<llong, llong>;

#define ALL(x) x.begin(), x.end()

constexpr llong mod = 1e9+7;
constexpr llong inf = mod * mod;

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

  cout << S << (S.back() == 's' ? "es" : "s") << endl;

  return 0;
}

Measured memory_bytes: 3624
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;

#define FILL(a, n, x) memset((a), (x), sizeof ((a)[0]) * (n))
#define COPY(a, n, b) memcpy((b), (a), sizeof ((a)[0]) * (n))

const int mod = 998244353;
typedef unsigned long long lu;
typedef long long li;

inline int Add(int x) { return x >= mod ? x - mod : x; }
inline void Add(int &x, int y) { x += y; if (x >= mod) x -= mod; }
inline int Sub(int x) { return x < 0 ? x + mod : x; }
inline void Sub(int &x, int y) { x -= y; if (x < 0) x += mod; }
inline int Mul(int x, int y) { return (lu)x * y % mod; }
inline int Mul(int x, int y, int z) { return (lu)x * y % mod * z % mod; }

inline int Pow(int x, int y) {
  int z = 1;
  for (; y; y >>= 1) {
    if (y & 1) z = Mul(z, x);
    x = Mul(x, x);
  }
  return z;
}

// ----------------------------------------

const int maxn = 1e5;

int n, X;
int b[maxn], l[maxn], u[maxn];
pair<li, li> p[maxn];

li Good(int m) {
  sort(p, p + n);
  li ans1 = 0, ans2 = 0;
  for (int i = 0; i < n - m; ++i) {
    ans1 = max(ans1, p[i].second);
  }
  for (int i = n - m; i < n; ++i) {
    ans1 += p[i].first;
  }
  if (m < n) {
    li sum = 0, extra = -1e12;
    for (int i = n - m - 1; i < n; ++i) {
      sum += p[i].first;
      extra = max(extra, p[i].second - p[i].first);
    }
    ans2 = sum + extra;
  }
  return max(ans1, ans2);
}

int main(void) {
  scanf("%d%d", &n, &X);
  li target = 0;
  for (int i = 0; i < n; ++i) {
    scanf("%d%d%d", b + i, l + i, u + i);
    target += (li)l[i] * b[i];
  }
  li low = 0, high = (li)n * X + 1;
  while (high - low > 1) {
    li mid = low + high >> 1;
    int whole = (mid - 1) / X, rest = (mid - 1) % X;
    for (int i = 0; i < n; ++i) {
      li p1 = (li)l[i] * b[i] + (li)u[i] * (X - b[i]);
      li p2 = rest <= b[i] ? (li)l[i] * rest            \
        : (li)l[i] * b[i] + (li)u[i] * (rest - b[i]);
      p[i] = {p1, p2};
    }
    if (Good(whole) >= target) {
      high = mid;
    } else {
      low = mid;
    }
  }
  printf("%lld\n", low);
  return 0;
}


Measured memory_bytes: 2944
#include <bits/stdc++.h>
using namespace std;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
#define ld long double
#define all(a) (a).begin(),(a).end()
#define mk make_pair
ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;


int main() {
  int n;
  cin >> n;
  int f=inf,ans=0;
  rep(i,n){
    int g;
    cin >> g;
    if (g<f) {
      f=g;
      ans++;
    }
  }
  cout << ans << endl;
}


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

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

typedef long long ll;

const int mod = 1e9 + 7;

using namespace std;



int main(void) {
	int N; cin >> N;
	vector<ll> A(N);
	rep(i, N)cin >> A[i];

	ll ans = 0;
	int sign = 0;
	for (int i = 1; i < N; i++) {
		int x = A[i] - A[i - 1];
		if (sign == 0) {
			sign = x;
		}
		else if ((sign > 0 && x < 0) || (sign < 0 && x > 0)) {
			ans++;
			sign = 0;
		}
	}

	cout << ans+1 << endl;

	return 0;
}

Measured memory_bytes: 4032
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    ll n;
    cin >> n;
    ll arr[n];
    for(ll i = 0 ; i < n ; i++) cin >> arr[i];
    ll dp[n];
    dp[0] = 0;
    dp[1] = abs(arr[1] - arr[0]);
    for(ll i =2  ; i < n ; i++){
        dp[i] = dp[i-1] + abs(arr[i] - arr[i-1]);
        dp[i] = min(dp[i], dp[i-2] + abs(arr[i-2] - arr[i]));
    }
    cout << dp[n-1] << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <deque>
#include <map>
const int MOD = 1e9+7;
typedef long long ll;
using namespace std;




int main(){
	string s, t;
	bool flg = true;
	vector<pair<char, char> > vec;
	cin >> s >> t;
	for (int i = 0; i < s.length(); i++){
		bool exist = false;
		for (int j = 0; j < vec.size(); j++){
			if (s[i] == vec[j].first){
				exist = true;
				if (t[i] != vec[j].second){
					flg = false;
				}
			}
		}
		if (!exist){
			for (int j = 0; j < vec.size(); j++){
				if (t[i] == vec[j].second) flg = false;
			}
			vec.push_back(make_pair(s[i], t[i]));
		}
	}
	if (flg) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

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

#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,x,n) for(int i=x; i<(n); i++)
#define rrep(i,n) for(int i=(n)-1; i>=0; i--)
#define all(X) (X).begin(),(X).end()
#define X first
#define Y second
#define pb push_back
#define eb emplace_back

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

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

template<class A, size_t N, class T> void Fill(A (&a)[N], const T &v){ fill( (T*)a, (T*)(a+N), v ); }

const ll INF = 1e9+7;


int main(){
	//ios_base::sync_with_stdio(false);
	int A[2], ans=0;

	cin >> A[1] >> A[0];

	cout << 100 << " " << 100 << endl;

	int cnt[2] = {1,1};
	rep(i,100){
		rep(j,100){
			if( i % 2 || j % 2 ) cout << (i<50 ? '#' : '.');
			else{
				bool f = ( cnt[i<=50]++ < A[i<=50] );
				cout << ((i<50)^f ? '#' : '.');
			}
		}
		cout << endl;
	}

	return 0;
}

Measured memory_bytes: 256
def suite(card)
  card[1]
end
def rank(card)
  case card[0]
    when "2".."9"
      return card[0].to_i
    when "T"
      return 10
    when "J"
      return 11
    when "Q"
      return 12
    when "K"
      return 13
    when "A"
      return 14
  end
end
def less(card1, card2, lead, trump)
  cost1 = rank(card1)
  cost1 += 13 if suite(card1) == lead
  cost1 += 26 if suite(card1) == trump
  cost2 = rank(card2)
  cost2 += 13 if suite(card2) == lead
  cost2 += 26 if suite(card2) == trump
  cost1 < cost2
end

N, E, S, W = (0...4).to_a
while (trump = gets.chomp) != "#" do
  card = Array.new
  4.times do
    card.push(gets.chomp.split)
  end
  point = Array.new(2, 0)
  lead = E
  13.times do |trick|
    winner = lead
    4.times do |i|
      winner = i if less(card[winner][trick], card[i][trick], suite(card[lead][trick]), trump)
    end
    lead = winner
    point[winner&1] += 1
  end
  puts point[0]>point[1] ? "NS #{point[0]-6}" : "EW #{point[1]-6}"
end

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

signed main(){
  int N;
  cin >> N;
  unsigned long long int count=0;
  vector<unsigned long long int>A(N+1);
  vector<int>D(100001);
  for(int i=1;i<=N;i++){
    cin >> A[i];
    count+=A[i];
    D[A[i]]++;
  }
  int Q;
  cin >> Q;
  vector<int>B(Q+1);
  vector<int>C(Q+1);
  for(int i=1;i<=Q;i++){
    cin >> B[i] >> C[i];
    count+=D[B[i]]*(C[i]-B[i]);
    cout << count << endl;
    D[C[i]]+=D[B[i]];
    D[B[i]]=0;
  }
}

Measured memory_bytes: 5104
#include<iostream>
#include<iomanip>
#include<vector>
#include<complex>
#include<map>
#include<cstdlib>
#include<cstdio>

#define EQ(a,b) (abs((a)-(b)) < EPS)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define fs first
#define sc second
#define pb push_back
#define sz size()
#define all(a) (a).begin(),(a).end()
using namespace std;
typedef double D;
typedef complex<D> P;
typedef pair<P,P> L;

const D EPS = 1e-8;
const D PI = acos(-1);

inline pair<P,P> normal(P p){return make_pair(p*P(0,1),p*P(0,-1));}
inline D dot(P x, P y){return real(conj(x)*y);}
inline D cross(P x, P y){return imag(conj(x)*y);}


inline P line_cp(L a,L b){
  return a.fs+(a.sc-a.fs)*cross(b.sc-b.fs,b.fs-a.fs)/cross(b.sc-b.fs,a.sc-a.fs);
}

inline P symmetry(L a, P p){
  L b = L(p, p + normal(a.fs-a.sc).fs);
  P m = line_cp(a,b);
  return 2.0*m - p;
}

vector<P> parse(int l, int r, const string &s){
  int k = 0;
  vector<P> res;

  for(int i=r-1;i>=l;i--){
    if(s[i] == '(')k++;
    if(s[i] == ')')k--;
    
    if(k==0){
      if(s[i] == '@'){
	vector<P> a = parse(l,i,s), b = parse(i+1,r,s);
	if(a.sz==2 && b.sz==2){
	  res.pb( line_cp(L(a[0],a[1]), L(b[0],b[1])) );
	  return res;
	}
	if(a.sz==1 && b.sz==1){
	  res.pb(a[0]); res.pb(b[0]);
	  return res;
	}
	if(a.sz==2){
	  res.pb( symmetry( L(a[0],a[1]), b[0] ) );
	  return res;
	}
	if(a.sz==1){
	  res.pb( symmetry( L(b[0],b[1]), a[0] ) );
	  return res;
	}
      }
    }
  }

  bool exist = false;
  for(int i=l;i<r;i++){
    if(s[i] == '@')exist = true;
  }
  if(exist)return parse(l+1,r-1,s);

  k = 0;
  for(int i=l;i<r;i++){
    if(s[i] == '(')k++;
  }
  if(k>1)return parse(l+k-1,r-k+1,s);

  int pos = 0;
  for(int i=l;i<r;i++){
    if(s[i] == ',')pos = i;
  }
  
  res.pb( P( atoi( s.substr(l+1,pos-l-1).c_str() ),
	     atoi( s.substr(pos+1,r-1-pos-1).c_str() ) ) );
  return res;
}

int main(){
  string s;
  while(cin >> s){
    if(s == "#")return 0;

    vector<P> res = parse(0,s.size(),s);
    cout << fixed << setprecision(10) << res[0].real() << " " << res[0].imag() << endl;
  }
}

Measured memory_bytes: 1284
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
using namespace std;

vector<string> V;
string s;
int alph[26]={};

bool Check(string b)
{
  bool al[26]={};
  for(int i=0;i<b.length();i++){
    if(b[i]!='a' && !al[b[i]-'a']){
      al[b[i]-'a']=true;
      b[i]--;
    }
  }
  if(b==s)return true;
  else return false;
}

void dfs(int a,string b)
{
  if(a==s.length()){
    if(!Check(b))return;
    V.push_back(b);
  }
  else {
    if(alph[b[a]-'a']==1)dfs(a+1,b);
    if(b[a]=='a')dfs(a+1,b);
    if(b[a]!='z')b[a]++;
    if(alph[b[a]-'a']==0){
      alph[b[a]-'a']=1;
      dfs(a+1,b);
      alph[b[a]-'a']=0;
    }
  }
}

int main()
{
  while(1){
    cin>>s;
    if(s[0]=='#')break;

    for(int i=0;i<26;i++)alph[i]=0;
    V.clear();
    dfs(0,s);
    sort(V.begin(),V.end());

    cout<<V.size()<<endl;
    if(V.size()<11)for(int i=0;i<V.size();i++)cout<<V[i]<<endl;
    else {
      for(int i=0;i<5;i++)cout<<V[i]<<endl;
      for(int i=V.size()-5;i<V.size();i++)cout<<V[i]<<endl;
    }
  }
  return 0;
}

Measured memory_bytes: 2348
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
using namespace std;
const double PI = acos(-1);

int main(){
    double a,b,th;
    cin >> a >> b >> th;
    th *= PI/180;
    cout << fixed << setprecision(10);
    cout << 0.5*a*b*sin(th) << endl;
    cout << a +b +sqrt(a*a +b*b -2*a*b*cos(th)) << endl;
    cout << b*sin(th) << endl;
    return 0;
}


Measured memory_bytes: 3652
import java.util.Scanner;

public class Main{
    public static void main(String[] args ){
        Scanner scanner = new Scanner(System.in);
        //int x = scanner.nextInt();
        String s = scanner.next();
        int S = 0;
        while(!s.equals("0")){
            S = 0;
            for(int i = 0; i < s.length(); i++)
                S += Character.getNumericValue((int)s.charAt(i));
            System.out.println(S);
            s = scanner.next();
        }
    }
}



Measured memory_bytes: 26284
#include <algorithm>
#include <cmath>
#include <complex>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
#include <functional>
#include <cstring>
#include <regex>
#include <random>
#include <cassert>
#include <stack>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, s, n) for (int i = (s); i < (int)(n); i++)
#define revrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define revrepr(i, s, n) for (int i = (n) - 1; i >= s; i--)
#define debug(x) cerr << #x << ": " << x << "\n"
#define popcnt(x) __builtin_popcount(x)

const double PI = acos(-1.0);

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

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; }

template<class T>
istream& operator >>(istream &is, vector<T> &v) {
    for (int i = 0; i < (int)v.size(); i++) cin >> v.at(i);
    return is;
}

template<class T, class U>
ostream& operator <<(ostream &os, pair<T, U> p) {
    cout << '(' << p.first << ", " << p.second << ')';
    return os;
}

template<class T>
void print(const vector<T> &v, const string &delimiter) { rep(i, v.size()) cout << (0 < i ? delimiter : "") << v.at(i); cout << endl; }

template<class T>
void print(const vector<vector<T>> &vv, const string &delimiter) { for (const auto &v: vv) print(v, delimiter); }

int main() {
    int a, b;
    cin >> a >> b;
    cout << a * b << endl;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using P = pair<int, int>;
using vec = vector<int>;
using mat = vector<vector<int>>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define endl "\n"

constexpr int MOD = 1000000007;
const int INF = 1 << 30;

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

    map<char, int> m;
    rep(i, 3) m[s[i]]++;
    if (m.size() == 3) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
inf = float('inf')
ninf = -float('inf')
 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？

n=ii()
s=list(ss())

mat=Counter(s)
black=mat["#"]
white=n-black

ans=white

if black==0 or white==0:
    print(0)
    exit()


tmptowhite=0
tmptoblack=white
for i in range(n):
    if s[i]=="#":
        tmptowhite+=1

    else:

        tmptoblack-=1
    
    ans=min(tmptowhite+tmptoblack,ans)

    
print(ans)



Measured memory_bytes: 86788
#include <bits/stdc++.h>
using namespace std;
int main(){
    int N;
    cin>>N;

    vector<int> L(N);

    for(int i=0;i<N;i++){
        cin >> L.at(i);
    }

    int ans=0;

    for(int i=0;i<N;i++){
        for(int j=i+1;j<N;j++){
            for(int k=j+1;k<N;k++){
                bool tf = true;
                if(L.at(i)==L.at(j))tf=false;
                if(L.at(j)==L.at(k))tf=false;
                if(L.at(k)==L.at(i))tf=false;
                if(L.at(i)+L.at(j)<=L.at(k))tf=false;
                if(L.at(k)+L.at(i)<=L.at(j))tf=false;
                if(L.at(j)+L.at(k)<=L.at(i))tf=false;

                if(tf==true){
                    ans++; 
                }
            }
        }
    }

    cout << ans << endl;
    
} 

Measured memory_bytes: 3612
object Main{
	def main(args:Array[String]){
		val s = new java.util.Scanner(System.in)
		val n,m=s.nextInt
		val a=Array.fill(m)(0)
		for(_<-1 to n)
			for(i<-1 to s.nextInt map(_=>s.nextInt()-1))
				a(i)+=1
		println(a.count(n==))
	}
}

Measured memory_bytes: 25672
from collections import deque

S = str(input())
Q = int(input())

d = deque([S[i] for i in range(len(S))])
#print(d)

flg = 0

for i in range(Q):
    query = input()
    if query[0] == '1':
        flg = flg%2 + 1
    else:
        t, f, c = query.split()
        if f == '1':
            if flg % 2 == 0:
                d.appendleft(c)
            else:
                d.append(c)
        else:
            if flg % 2 == 0:
                d.append(c)
            else:
                d.appendleft(c)
if flg % 2 == 0:
    print(''.join(list(d)))
else:
    tmp = ''.join(list(d))
    print(tmp[::-1])

Measured memory_bytes: 8540
#include <stdio.h>

int main(){
	char kata1[108]; //106 huruf	jadi dia [n] n-2
	char kata2[108]; // 106 huruf	ini juga
	
	scanf("%s %s", &kata1, &kata2); //bisa gapake &, sesuai aturan pointer
	printf("%s%s\n", kata2, kata1);
	
	return 0;
}

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

int main() {

    int n, m;

    priority_queue<int> money;

    cin >> n >> m;

    for(int i = 0; i < n; ++i) {
        int a;
        cin >> a;
        money.push(a);
    }

    for(int i = 0; i < m; ++i) {
        int v;
        v = money.top(); money.pop();
        v /= 2;
        money.push(v);
    }

    long long sum = 0;
    while(!money.empty()) {
        sum += money.top(); money.pop();
    }
    
    cout << sum << endl;

    return 0;

}

Measured memory_bytes: 892
import java.util.*;

public class Main{
    
    public static final int MAX = 3501;
    
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        
        long n = Long.parseLong(sc.next());
        
        for(long x=1; x<MAX; x++){
            for(long y=1; y<MAX; y++){
                long u = n*x*y;
                long d = 4L*x*y-n*x-n*y;
                if(d!=0 && u%d==0 && u/d>0){
                    long z = u/d;
                    System.out.println(x+" "+y+" "+z);
                    return;
                }
            }
        }
    }
}


Measured memory_bytes: 23764