akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define ff first
#define ss second
#define vll vector<ll>
#define pll pair<ll,ll>
#define vpll vector<pll>
#define vvll vector<vll>
#define all(v) v.begin(),v.end()
#define itr(r,v) for(auto r=v.begin();r!=v.end();r++)
#define W while
#define FOR(i,n) for(ll i=0;i<n;i++)
#define ffor(i,a,b) for(ll i=a;i<=b;i++)
#define rfor(i,a,b) for(ll i=a;i>=b;i--)
#define space cout<<"\n\n";
#define endl "\n"
#define pqmx priority_queue<ll>
#define pqmn priority_queue<ll,vll,greater<ll>>
#define fps(x,y) fixed<<setprecision(y)<<x
#define merg(a,b,c) set_union(a.begin(),a.end(),b.begin(),b.end(),inserter(c,c.begin()))
#define set_ar(arr,v) memset(arr,v,sizeof(arr))
#define ctime auto start = high_resolution_clock::now()
#define etime auto stop = high_resolution_clock::now()
#define ptime auto z1z = duration_cast<microseconds>(stop-start); cout<<"Time elapsed : "<<z1z.count()<<" microseconds\n"
#define go_t ll testcases; cin>>testcases; while(testcases--)
#define dbg1(x)             cout <<#x<<": "<<x<<'\n';
#define dbg2(x, y)          cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<<'\n';
#define dbg3(x, y, z)       cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<'\n';
#define dbg4(a, b, c, d)    cout <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<'\n';
#define dbg5(a, b, c, d, e) cout <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<<": "<<e<<'\n';
using namespace std;
using namespace std::chrono;

const ll MOD = 1e9 + 7;
const ll N = 2005;
const ll maxN = 1e5 + 5;
const ll MAX_SIZE = 1e8 + 8;

ll power(ll x, ll y, ll M = MOD) // default argument
{ll v = 1; x = x % M; while (y > 0) {if (y & 1)v = (v * x) % M; y = y >> 1; x = (x * x) % M;} return v;}

int main()
{

#ifndef ONLINE_JUDGE
	freopen("input1.txt", "r", stdin);
	freopen("output1.txt", "w", stdout);
#endif
	// WHILE(!(SUCCEED == TRY()));
	// BEFORE WRITING MAKE SURE YOU HAVE ANALYSED THE CONSTRAINTS
	// AND THINK THROUGH THE LOGIC ONCE MORE
	FIO
	ll maxx = 1000000000000001;
	vll ar;
	ar.pb(26);
	vll pow26;
	ll q1 = 26;
	ll i = 0;
	while (ar[i] <= maxx) {
		pow26.pb(q1);
		q1 *= 26;
		ar.pb(ar[i] + q1); i++;
	}
	pow26.pb(26 * q1);
	// FOR(i, pow26.size()) cout << pow26[i] << endl;
	// FOR(i, ar.size()) cout << ar[i] << endl;
	ll n; cin >> n;
	ll leng = (lower_bound(all(ar), n) - ar.begin()) + 1;
	ll val = *(lower_bound(all(ar), n));
	// dbg2(leng, val);
	ll m = n;
	char ans[leng] = {};
	for (ll i = leng - 1; i >= 0; i--) {
		ll kk = m % 26;
		if (kk != 0)
			ans[i] = char(kk + 96);
		else {
			ans[i] = 'z';
			kk = 26;
		}
		//
		m -= kk;
		m /= 26;
	}
	FOR(i, leng) cout << ans[i];
	return 0;
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
#define ALL(a)  (a).begin(),(a).end()
typedef long long ll;

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

int main(){
    int n; cin >> n;
    vector <ll> A(n);
    vector <ll> sum_of_A(n);

    rep(i, n){
        cin >> A.at(i);
    }
    sort(A.begin(), A.end());

    rep(i, n){
        sum_of_A.at(i) = A.at(i);
        if (i == 0) continue;
        sum_of_A.at(i) += sum_of_A.at(i - 1);
    }

    int b, e, m;
    b = 0;
    e = n - 1;
    while (abs(e - b) > 1){
        m = (e + b) / 2;
        ll num = sum_of_A.at(m);

        bool flag = true;
        for (int i = m + 1; i < n; i ++){
            if (num * 2 < A.at(i)) {
                flag = false;
                break;
            }
            num += A.at(i);
        }

        if (flag) e = m;
        else b = m;

    }

    ll num = sum_of_A.at(b);
    bool flag = true;
    for (int i = b + 1; i < n; i ++){
        if (num * 2 < A.at(i)) {
            flag = false;
            break;
        }
        num += A.at(i);
    }

    auto ans_itr = A.begin();
    if (flag) ans_itr = lower_bound(ALL(A), A.at(b));
    else ans_itr = lower_bound(ALL(A), A.at(e));
    cout << A.end() - ans_itr << endl;
}

Measured memory_bytes: 4788
#include <iostream>
#include <cstdio>

using namespace std;

const int P=998244353;
const int L=1000000;

int fact[L+5],invf[L+5];
int n,K,ans;

inline int quick_power(int x,int y)
{
	int ret=1;
	for (;y;y>>=1,x=1ll*x*x%P) if (y&1) ret=1ll*ret*x%P;
	return ret;
}

void pre()
{
	fact[0]=1;
	for (int i=1;i<=L;++i) fact[i]=1ll*fact[i-1]*i%P;
	invf[L]=quick_power(fact[L],P-2);
	for (int i=L;i>=1;--i) invf[i-1]=1ll*invf[i]*i%P;
}

inline int C(int n,int m){return n>=m?1ll*fact[n]*invf[m]%P*invf[n-m]%P:0;}

inline int calc(int n,int m,int t)
{
	if (m-n>=t||t<=0) return 0;
	return (C(n+m,m)-C(n+m,n+t)+P)%P;
}

int main()
{
	//freopen("chameleons.in","r",stdin),freopen("chameleons.out","w",stdout);
	pre(),scanf("%d%d",&n,&K),ans=0;
	for (int R=K,B;R>=K-R&&R>=0;--R)
	{
		B=K-R;
		if (R==B) (ans+=calc(R,B-1,R-n+1))%=P;
		else (ans+=calc(R,B,R-n+1))%=P;
	}
	printf("%d\n",ans);
	//fclose(stdin),fclose(stdout);
	return 0;
}

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

class DisjointSet {
public:
    vector<int> rank;
    vector<int> p; // parent
    DisjointSet(int size) {
        rank.assign(size, 0);
        p.assign(size, 0);
        for (int i = 0; i < size; ++i) {
            makeSet(i);
        }
    }

    void makeSet(int x) {
        p[x] = x;
        rank[x] = 0;
    }

    bool same(int x, int y) {
        return findSet(x) == findSet(y);
    }

    void unite(int x, int y) {
        link(findSet(x), findSet(y));
    }

    void link(int x, int y) {
        if (rank[x] > rank[y]) {
            p[y] = x;
        } else if (rank[x] <= rank[y]) {
            p[x] = y;
            if (rank[x] == rank[y]) {
                ++rank[y];
            }
        }
    }

    int findSet(int x) {
        if (p[x] != x) {
            p[x] = findSet(p[x]);
        }
        return p[x];
    }
};

int main()
{
    int n, q;
    cin >> n >> q;
    DisjointSet dset(n);
    int query, x, y;
    for (int i = 0; i < q; ++i) {
        cin >> query >> x >> y;
        if (query == 0) {
            dset.unite(x, y);
        } else if (query == 1) {
            cout << dset.same(x, y) << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3204
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}

fn read_vec_raw<>() -> Vec<String> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace().map(|e| e.to_string()).collect::<Vec<String>>().clone()
}

fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    let mut v2 = Vec::new();
    for _ in 0..n {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).ok();
        let v = s.trim().split_whitespace()
            .map(|e| e.parse().ok().unwrap()).collect();
        v2.push(v);
    }
    v2
}

fn solve_a(){

    /*let mut str1 = read_vec_raw()[0].clone();
    let str2 = read_vec_raw()[0].clone();
    str1.push_str(&str2);*/

    let vec : Vec<Vec<i32>> = read_vec2(4);
    let n1 = vec[0][0].clone();
    let n2 = vec[1][0].clone();
    let n3 = vec[2][0].clone();
    let target = vec[3][0].clone();

    let mut result = 0;

    for i in 0..(n1 + 1) {
        for j in 0..(n2 + 1) {
            for k in 0..(n3 + 1) {
                let rest = target - (i * 500 + j * 100);
                if rest == k * 50 {
                    result += 1;
                }
            }
        }
    }

    println!("{}",result);

}

fn main (){

    solve_a();
}

Measured memory_bytes: 4352
#include<bits/stdc++.h>
#define ll long long
#define lld long double
using namespace std;
template<typename tn> void read(tn &a){
	tn x=0,f=1; char c=' ';
	for(;!isdigit(c);c=getchar()) if(c=='-') f=-1;
	for(;isdigit(c);c=getchar()) x=x*10+c-'0';
	a=x*f;
}
const int N = 101000,mod = 1e9+7;
int n,K;
ll fac[10000010],ifac[10000010];
ll fp(ll a,ll k){
	ll ans=1;
	for(;k;k>>=1,a=a*a%mod)
		if(k&1) ans=a*ans%mod;
	return ans;
}
ll UP(int n,int m){
	if(n==0) return 0;
	return fac[n+m-1]*ifac[n-1]%mod;
}
ll C(int n,int m){
	return fac[n]*ifac[m]%mod*ifac[n-m]%mod;
}
int main(){
	read(n);read(K);
	fac[0]=1;
	for(int i=1;i<=n;i++) fac[i]=fac[i-1]*i%mod;
	ifac[n]=fp(fac[n],mod-2);
	for(int i=n;i;i--) ifac[i-1]=ifac[i]*i%mod;
	ll ans=0;
	for(int i=1;i<=K;i++){
		for(int j=0;j<i;j++)
			ans=(ans+(j&1?-1:1)*C(i-1,j)*fac[i-1-j]%mod*UP(i-1-j,n-K)%mod*UP(i-j-K+n,K-i))%mod;
	}
	for(int i=0;i<=K;i++){
		ans=(ans+(i&1?-1:1)*C(K,i)*fac[K-i]%mod*UP(K-i,n-K))%mod;
	}
	cout<<(ans+mod)%mod<<'\n';
	return 0;
}



Measured memory_bytes: 159880
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

using namespace std;
#define ll long long
#define rep(i,n) for (int i = 0; i < n; i++)
#define rrep(i,n) for (int i = n-1; i >= 0; i--)
#define MOD (1000000007)
#define vi vector<int>
#define vl vector<ll>
#define vb vector<bool>
#define vvi vector<vi>
#define vvl vector<vl>
#define pii pair<int, int>
#define pli pair<ll, int>a
#define pb push_back

#define mp make_pair
#define all(a) (a).begin(),(a).end()

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

ll gcd(ll a, ll b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}

ll keta(ll n){
  string s = to_string(n);
  ll num = s.size();
  return num;
}

const ll INF = 1LL << 60;

const int dh[4] = {1,0,-1,0};
const int dw[4] = {0,1,0,-1};

struct Edge{
  int to;
  int weight;
  Edge(int t, int w) : to(t), weight(w){}
};
using Graph = vector<vector<Edge>>;
using P = pair<ll, int>;

class UnionFind{
public:
  vi Parent;
  UnionFind(int n){
    Parent = vi(n,-1);
  }

  int root(int a){
    if(Parent[a] < 0) return a;
    else return Parent[a] = root(Parent[a]);
  }

  int size(int a){
    return -Parent[root(a)];
  }

  bool merge(int a, int b){
    a = root(a);
    b = root(b);
    if(a == b) return false;

    if(size(a) < size(b)) swap(a,b);
    Parent[a] += Parent[b];
    Parent[b] = a;

    return true;
  }

};


int main(){
  int n; cin >> n;
  vi p(n);
  rep(i,n){
    cin >> p[i];
    p[i]--;
  }
  vi q(n);
  rep(i,n) q[p[i]] = i;

  int cnt = 1;
  int res = 0;
  rep(i,n-1) {
    if(q[i] < q[i+1]) cnt++;
    else{
      chmax(res, cnt);
      cnt = 1;
    }
  }
  chmax(res,cnt);

  cout << n-res << endl;
  
}


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

const long long maxint = 1000000000000000000;

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

  long long ans = 1;
  for (int i = 1; i <= N; i++) {
    long long tmp;
    cin >> tmp;

    if (tmp == 0) {
      ans = 0;
      break;
    }
    if (tmp > maxint / ans) {
      ans = -1;
    }
    if (ans != -1) {
      ans *= tmp;
    }
  }

  cout << ans << endl;

  return 0;
}

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

int main()
{
	string s;
	getline(cin, s);
	for (int i = 0; i < s.size(); i++) {
		if (s[i] >= 'a' && s[i] <= 'z') {
			s[i] += 'A' - 'a';
		}
		else if (s[i] >= 'A' && s[i] <= 'Z') {
			s[i] += 'a' - 'A';
		}
	}
	cout << s << endl;
	return 0;
}

Measured memory_bytes: 3152
#include <bits/stdc++.h>
#include <iostream>
#include <functional>
#include <vector>
#include <stdio.h>
#include <queue>
#include <string.h>
#include <math.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<=n;i++)
#define rep1(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=a;i>=n;i--)
#define per1(i,a,n) for (int i=a;i>n;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define endl "\n"
#define pi 3.14159265358979323846264338327950288419716939937510
#define IOS cin.sync_with_stdio(false);cin.tie(0);cout.tie(0);
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll mod=1000000007;
const int inf=0x3f3f3f3f;
const ll INF=0x3f3f3f3f3f3f3f3f;
ll qpow(ll a,ll b){ll s=1;while(b>0){if(b%2==1){s=s*a;}a=a*a;b=b>>1;}return s;}
ll qpowmod(ll a, ll b, ll c){ll res, t;res=1;t=a%c;while(b){if(b & 1){res=res*t%c;}t=t*t%c;b>>=1;}return res;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
inline long long read(){long long k=0,f=1;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){k=k*10+ch-'0';ch=getchar();}return k*f;}
inline void write(long long x){if(x<0)x=-x,putchar('-');if(x>9)write(x/10);putchar(x%10+'0');}
// head
ll n,a;
int main()
{
    //IOS;
    cin>>n>>a;
    if(2*a>n)
    {
        cout<<0<<endl;
    }
    else
    {
        cout<<n-2*a<<endl;
    }
    return 0;
}
/*

*/


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>

int main(){
    int n;
    std::cin >> n;
    std::string S;
    std::cin >> S;

    int cnt = 1;
    for(int i = 1; i < n; i++){
        if(S[i - 1] != S[i]){
            cnt++;
        }
    }

    std::cout << cnt << std::endl;
    return 0;
}


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

void set(int top, int* index) {
	if (top == 1) {
		// frontは2354
		index[0] = 2; index[1] = 3; index[2] = 5; index[3] = 4;
	}
	else if (top == 6) {
		// frontは2354
		index[0] = 4; index[1] = 5; index[2] = 3; index[3] = 2;
	}
	else if (top == 4) {
		// frontは6215
		index[0] = 6; index[1] = 2; index[2] = 1; index[3] = 5;
	}
	else if (top == 3) {
		// frontは6215
		index[0] = 5; index[1] = 1; index[2] = 2; index[3] = 6;
	}
	else if (top == 2) {
		// frontは6314
		index[0] = 6; index[1] = 3; index[2] = 1; index[3] = 4;
	}
	else if (top == 5) {
		// frontは6314
		index[0] = 4; index[1] = 1; index[2] = 3; index[3] = 6;
	}
}

int getAns(int front, int* index) {
	for (int i = 0; i < 4; i++) {
		if (index[i] == front ) {
			if (i == 3) {
				return index[0];
			}
			else {
				return index[++i];
			}
		}
	}
	cout << "FAIL" << endl;
	return 0;
}

int convDiceIndex(int x, int* set) {
	for (int i = 0; i < 6; i++) {
		if (set[i] == x) {
			return i+1;
		}
	}
	cout << "FAIL" << endl;
	return 0;
}

int main()
{
	int d[6];
	int x1, x2;
	int count = 0;
	for (int i = 0; i < 6; i++) {
		cin >> d[i];
	}
	cin >> count;
	int indexSet[4];
	while ( count-- > 0) {
		// Top, Front
		cin >> x1 >> x2;
		// Solution
		set(convDiceIndex(x1, d), indexSet);
		cout << d[( getAns(convDiceIndex(x2,d),indexSet))-1] << endl;
	}
    return 0;
}




Measured memory_bytes: 3092
l=input().split()
l = [int(s) for s in l]
a = l[0]
b = l[1]
while (b != 0 and a != 0):
    if(a < b):
        b = b % a
    else:
        a = a % b
if(a == 0):
    print(b)
else:
    print(a)


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

using namespace std;

#define debug(x) '[' << #x << " is: " << x << "] "
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

const int nax = 1e5 + 100;
const int mod = 1e9 + 7;

ll dp[nax][15],p[nax];
int n;
string s;

ll calc(int idx,int rem){
	if(idx == -1){
		return (rem == 5);
	}
	ll &ret = dp[idx][rem];
	if(ret != -1)return ret;
	ret = 0;
	if(s[idx] != '?'){
		ll cur = p[n-idx-1]*(s[idx]-'0');
		cur%=13;
		ret = calc(idx-1,(rem + cur)%13);
	}else{
		for(int i=0;i<10;i++){
			ret = (ret + calc(idx-1,(rem + (i*p[n-idx-1])%13)%13))%mod;
		}
	}
	return ret%mod;
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.precision(10);
	cout << fixed;
	cin>>s;
	n = s.size();
	p[0] = 1;
	for(int i=1;i<=n;i++){
		p[i] = (p[i-1] * 10)%13;
	}
	memset(dp,-1,sizeof(dp));
	cout << calc(n-1,0) << endl;
}

Measured memory_bytes: 20816
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

using namespace std;
#define ll long long
#define rep(i,n) for (int i = 0; i < n; i++)
#define MOD (1000000007)
#define vi vector<int>
#define vvi vector<vi>
#define all(a)  (a).begin(),(a).end()

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

int gcd(int a, int b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}

const ll INF = 1LL << 60;

int main(){
  vi a(3); cin >> a[0] >> a[1] >> a[2];
  sort(all(a));
  std::cout << a[2] - a[0] << '\n';
}


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

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

long long MOD = 1000000000 + 7;
long long MAX = 1000000000000000000;

int main(){
  ll ans = 1;
  int N;
  ll K;
  cin >> N >> K;
  ans *= K;
  for(int i = 0; i < N-1; i++){
    ans *= K-1;
  }
  cout << ans << endl;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <utility>
#include <map>
#include <set>
#include <functional>
#include <deque>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int MOD = 1000000007;

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

    int cnt = 0;
    int sum = 0;
    vector<int> a(n);
    for(int i = 0;i < n;i++){
        cin >> a[i];
        sum += a[i];
    }

    for(int i = 0;i < n;i++){
        if(sum <= 4 * m * a[i])cnt++;
    }

    if(cnt >= m)cout << "Yes" << endl;
    else cout << "No" << endl;


}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n;
int c[50],v[50];
int main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	cin>>n;
	int res=0;
	for(int i=1;i<=n;i++){
		cin>>v[i];
	}
	for(int i=1;i<=n;i++){
		cin>>c[i];
	}
	for(int i=1;i<=n;i++){
		if(v[i]>c[i]){
			res+=(v[i]-c[i]);
		}
	}
	cout<<res<<endl;
	return 0;
}


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

int64_t pow(int64_t n) {
  if (n == 0) return 1;
  if (n % 2 == 1) return 2*pow(n-1);
  return pow(n/2)*pow(n/2);
}

int main() {
  int64_t H;
  cin >> H;
  
  int64_t i = 0;
  int64_t count = 0;
  
  while (H > 0) {
    H /= 2;
    count += pow(i);
    i++;
  }
  
  cout << count << endl;
  
  return 0;
}


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

b = input().split()
kotae = 0
for i in range(n):
    c = input().split()
    ans = 0
    for j in range(m):
        ans += int(b[j]) * int(c[j])
    if ans+k > 0:
        kotae += 1
print(kotae)

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>

using namespace std;
int main() {
	int a,b,c;

	cin >> a >> b >> c;
	int ans1 = a * 10 + b + c;
	int ans2 = a + b * 10 + c;
	int ans3 = a + b + c * 10;
	cout << max(max(ans1, ans2), ans3) << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>

int main(){
    int n;
    std::string str;
    std::string fr = "Hoshino";
    std::string to = "Hoshina";
    std::string::size_type pos;
    std::cin >> n;
    std::cin.get();
    
  
        //文字列の読み込み
    while(n > 0 && std::getline(std::cin, str)){
        //"Hoshino"を"Hoshina"に変換
        pos = str.find(fr);
        while(pos != std::string::npos){
            str.replace(pos, fr.size(), to);
            pos = str.find(fr, pos+to.size());
        }
        //表示
        std::cout << str << std::endl;
        str = "";
        std::cin.clear();
        --n;
    }
}



Measured memory_bytes: 3128
#include<iostream>
#include<ctime>
#include<cstdlib>
#include<cstdio>
#include<cmath>
#include<climits>
#include<cstring>
#include<iomanip>
#include<string>
#include<bitset>
#include<set>
#include<vector>
#include<map>
#include<queue>
#include<stack>
#include<deque>
#include<algorithm>
#include<functional>
#include<chrono>
#include<random>

#define y0 asdahsdlkahsdad
#define y1 aasdfasdfasdf
#define yn askfhwqriuperikldjk
#define j1 assdgsdgasghsf
#define taskname "B"
#define BeztDonkey

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

using namespace std;

const int max4K = 1000 << 2;

static int s[max4K][max4K], n, k, k2, k4, x, y;
char c;

inline int Sum(int x, int y, int u, int v)
{
    int res = s[u][v];
    if (x > 0) res -= s[x - 1][v];
    if (y > 0) res -= s[u][y - 1];
    if (x > 0 && y > 0) res += s[x - 1][y - 1];
    return res;
}

int main()
{
    #ifdef BeztDonkey
    auto start = chrono::steady_clock::now();
    #endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    //freopen(taskname".inp", "r", stdin);
    //freopen(taskname".out", "w", stdout);

    cin >> n >> k;
    k2 = k << 1; k4 = k << 2;
    while (n--)
    {
        cin >> x >> y >> c;
        if (c == 'W') y += k;
        ++s[x % k2][y % k2];
    }
    int ans = 0;
    for (int i = 0; i < k4; ++i)
        for (int j = 0; j < k4; ++j) s[i][j] = s[i % k2][j % k2];
    for (int i = 0; i < k4; ++i)
        for (int j = 0; j < k4; ++j)
        {
            auto &sij = s[i][j];
            if (i > 0) sij += s[i - 1][j];
            if (j > 0) sij += s[i][j - 1];
            if (i > 0 && j > 0) sij -= s[i - 1][j - 1];
        }
    for (int i = 0; i < k2; ++i)
        for (int j = 0; j < k2; ++j)
            ans = max(ans, Sum(i, j, i + k - 1, j + k - 1)
                         + Sum(i + k, j + k, i + k2 - 1, j + k2 - 1));
    cout << ans;

    #ifdef BeztDonkey
    auto end = chrono::steady_clock::now();
    cerr << "In milliseconds : "
         << chrono::duration_cast<chrono::milliseconds>(end - start).count();
    cerr << '\n' << "In seconds : "
         << chrono::duration_cast<chrono::seconds>(end - start).count() << '\n';
    #endif
    return 0;

}


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

typedef long long LL;
//dp[x][y][z] : used x numbers from 0 to y and the sum is z
LL dp[10][101][1001];
int n, s;

void set_dp(){
    for(int x = 0; x < 10; x++){
        for(int y = 0; y <= 100; y++){
            fill(dp[x][y], dp[x][y]+1001, 0);
        }
    }
    for(int x = 0; x <= 100; x++){
        for(int y = x; y <= 100; y++){
            dp[1][y][x] = 1;
        }
    }
    for(int x = 2; x < 10; x++){
        for(int y = 1; y <= 100; y++){
            for(int z = 0; z <= 1000; z++){
                dp[x][y][z] = dp[x][y-1][z];
                if(z >= y){
                    dp[x][y][z] += dp[x-1][y-1][z-y];
                }
            }
        }
    }
}

int main(){
    set_dp();
    while(scanf("%d%d", &n, &s) && (n||s)){
        printf("%lld\n", dp[n][100][s]);
    }
    return 0;
}

Measured memory_bytes: 9084
# 問題文
# A駅とB駅を結ぶ鉄道があり、運賃はX円です。
# また、B駅とC駅を結ぶバスがあり、運賃は Y円です。
# joisinoお姉ちゃんは、A駅から B駅まで鉄道で移動し、B駅からC駅までバスで移動すると、バスの運賃が半額になる特別券を手に入れました。
# この特別券を用いたとき、A駅からC駅まで移動するのにいくらかかるか求めてください。
#
# 制約
# 1≤X,Y≤100
# Yは偶数
# 入力は全て整数

x,y=map(int,input().split())

print(int(x+y/2))


Measured memory_bytes: 2940
#include<iostream>
#include<cstdio>
using namespace std;
int main(){
	int a,b;
	cin>>a>>b;
	if(a%3==0){
		cout<<"Possible"<<endl;
	}
	else if(b%3==0){
		cout<<"Possible"<<endl;
	}
	else if((a+b)%3==0){
		cout<<"Possible"<<endl;
	}
	else{
		cout<<"Impossible"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**9)


S = input()
N = len(S)
P = 2019

if P == 2 or P == 5:
    ans = 0
    for i in range(N):
        if int(S[i]) % P == 0:
            ans += i + 1
    print(ans)
    sys.exit()

num = [0] * P
num[0] = 1
now, ans = 0, 0
_10 = 1
for i in range(N-1, -1, -1):
    now = (now + int(S[i]) * _10) % P
    _10 *= 10
    _10 %= P
    ans += num[now]
    num[now] += 1

print(ans)


Measured memory_bytes: 9340
N=int(input())
S=input()
count=0
R=0
G=0
B=0
for i in range(N):
  if S[i]=="R":
    R+=1
  if S[i]=="G":
    G+=1
  if S[i]=="B":
    B+=1
count=0
for i in range(N-2):
  for j in range(i,N-1):
    k=j+j-i
    try:
      if S[i]!=S[j] and S[j]!=S[k] and S[k]!=S[i]:
        count+=1
    except:
      pass
    
print(R*G*B-count)

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

#define ll long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue

using namespace std;
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
const int inf = 1e9;
const ll linf = 1LL << 50;

int main(int argc, char const* argv[])
{
  int n;
  cin >> n;
  vector<int> a;
  for(int i = 0; i < n; i++){
    int x;
    cin >> x;
    a.pb(x);
  }
  sort(a.begin(), a.end());
  int num = 0;
  int res = 0;
  for(int i = 0; i < n - 1; i++){
    num++;
    if(a[i] != a[i + 1]){
      if(num < a[i])res += num;
      else res += num - a[i];
      num = 0;
    }
  }
  num++;
  if(num < a[n - 1])res += num;
  else res += num - a[n - 1];
  cout << res << endl;
	return 0;
}


Measured memory_bytes: 892
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <ctype.h>
#include <string.h>
#define ll long long 
#define MOD 10000007

int main(void){
int N;
int min=1001,max=-1;
int a[100];
scanf("%d",&N);
int i;
for(i=0;i<N;i++){
 scanf("%d",&a[i]);
 if(a[i]>max) max=a[i];
 if(a[i]<min) min=a[i];
}
printf("%d\n",max-min);

return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<queue>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<complex>
#define INF 2147483647
#define llINF 9223372036854775807
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long

using namespace std;
int main(){
  int d;
  double e;
  while(cin>>d>>e,d+e){
    double ans=1e5;
    for(int i=0;i<=d;i++){
      ans=min(ans,abs(sqrt(i*i+(d-i)*(d-i))-e));
    }
    printf("%.6f\n",ans);
  }
  return 0;
}



Measured memory_bytes: 3152
#include<stdio.h>


int binarySearch(int n,int *A,int key){
  int left=0,right=n,mid;

  while(left<right){
    mid=(left+right)/2;
    
    if(A[mid]==key) return 1;
    
    else if(key<A[mid]) right = mid;
    
    else left = mid+1;

  }
  return 0;
}

int main(){
  int i,n,q,A[100000],B,count=0;
  
  scanf("%d",&n);

  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }

  scanf("%d",&q);

  for(i=0;i<q;i++){
    scanf("%d",&B);
    if(binarySearch(n,A,B)==1) count++;
  }

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

  return 0;
}



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

int main()
{
    long long N;
    cin >> N;

    long long minCnt = LLONG_MAX;
    long long j;
    for (long long i = 1; i <= N / i; i++) {
        if (N % i == 0) {
            j = N / i;
            if (minCnt > (i + j - 2)) {
                minCnt = i + j - 2;
            }
        }
    }

    cout << minCnt << endl;

    return 0;
}

Measured memory_bytes: 384
#include <iostream>

using namespace std;

int main()
{
    int a, b, c, k;
    cin >> a >> b >> c >> k;
    while(b <= a && k > 0)
    {
        b *= 2;
        k--;
    }
    while(c <= b && k > 0)
    {
        c *= 2;
        k--;
    }
    if(b > a && c > b)
    {
        cout << "Yes";
    }
    else
    {
        cout << "No";
    }
    return 0;
}


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

std::vector<int> array;

int main() {
	array = std::vector<int>(3);
	for(int line = 0;line < 3;line++) {
		std::cin >> array[line];
	}

	for(int line = 0;line < 3;line++) {
		for(int n = 0;n < 2;n++) {
			if(array[n] < array[n+1]) {
				int a = array[n];
				array[n] = array[n+1];
				array[n+1] = a;;
			}
		}
	}
	int answer;
	answer += array[0] - array[1];
	answer += array[1] - array[2];
	std::cout << answer << "\n";
}


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

int main() {
	// your code goes here
	int n;
	cin>>n;
	int val =7%n;
	for(int i=1;i<=n;i++){
		if(!val){
			cout<<i;
			return 0;
		}
		val=(val*10 +7)%n;
	}
	cout<<"-1";
	return 0;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　 |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/





string N;
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> N;
    rep(i, 0, N.length()) {
        if (N[i] == '1') N[i] = '9';
        else N[i] = '1';
    }
    cout << N << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
string s;
int main()
{
	cin>>s;
	if(s[s.size()-1]=='2'||s[s.size()-1]=='4'||s[s.size()-1]=='5'||s[s.size()-1]=='7'||s[s.size()-1]=='9')
	{
		cout<<"hon";
		exit(0);
	}
	if(s[s.size()-1]=='0'||s[s.size()-1]=='1'||s[s.size()-1]=='6'||s[s.size()-1]=='8')
	{
		cout<<"pon";
		exit(0);
	}
	cout<<"bon";
}


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

int main() {
  ll h; cin >> h;
  ll ans = 0;
  int count = 0;
  while (h != 1) {
    h /= 2;
    count++;
    ans += pow(2,(count-1));
    //cout << "count=" << count << endl;
    //cout << "ans=" << ans << endl;
  }
  ans += pow(2, count);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int n;
int minx=100000;
int chg(int s)
{
	if(s<10)
	    return s;
	if(s>=10&&s<=99)
	    return (s/10)+(s%10);
	if(s>=100&&s<=999)
	    return (s/100)+(s/10%10)+(s%10);
	if(s>=1000&&s<=9999)
	    return (s/1000)+(s/100%10)+(s/10%10)+(s%10);
	if(s>=10000&&s<=99999)
	    return (s/10000)+(s/1000%10)+(s/100%10)+(s/10%10)+(s%10);
}
int main()
{
	ios::sync_with_stdio(false);
	cin>>n;
	for(int i=1;i<=n-1;i++)
	{
		int c=chg(i)+chg(n-i);
		if(c<minx) minx=c;
	} 
	cout<<minx<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cstdio>
#include <string>
#include <stack>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <numeric>
using namespace std;


#include <bits/stdc++.h>

using namespace std;

int a[100001], l[100001], r[100001];

int gcd(int a, int b) {
    return a == 0 ? b : gcd(b % a, a);
}

int main() {
    int n;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    l[0] = a[0];
    r[n - 1] = a[n - 1];
    for (int i = 0; i < n - 1; ++i) {
        l[i + 1] = gcd(l[i], a[i + 1]);
        r[n - 1 - i - 1] = gcd(r[n - 1 - i], a[n - 1 - i - 1]);
    }
    int answer = 0;
    for (int i = 0; i < n; ++i) {
        if (i == 0) {
            answer = max(answer, r[1]);
        } else if (i == n - 1) {
            answer = max(answer, l[n - 2]);
        } else {
            answer = max(answer, gcd(l[i - 1], r[i + 1]));
        }
    }
    cout << answer << endl;
}


Measured memory_bytes: 1408
#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(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

using namespace std;
using ll = long long;
using P = pair<int,int>;
constexpr int INF = 1001001001;

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

int main() {
    int h, w;
    cin >> h >> w;
    vector<vector<char>> a(h, vector<char>(w));
    rep (i, h) {
        string s;
        cin >> s;
        rep (j, w) a[i][j] = s[j];
    }
    
    vector<vector<int>> dh(h, vector<int>(w, -INF));
    rep (i, h) rep (j, w) {
        if (dh[i][j] != -INF || a[i][j] == '#')
            continue;
        int l = j, r = j;
        while (0 < l && a[i][l-1] == '.') l--;
        while (r+1 < w && a[i][r+1] == '.') r++;
        rep (k, l, r+1) dh[i][k] = r-l+1;          
    }
    vector<vector<int>> dw(h, vector<int>(w, -INF));
    rep (i, w) rep (j, h) {
        if (dw[j][i] != -INF || a[j][i] == '#')
            continue;
        int u = j, d = j;
        while (0 < u && a[u-1][i] == '.') u--;
        while (d+1 < h && a[d+1][i] == '.') d++;
        rep (k, u, d+1) dw[k][i] = d-u+1;
    }
    
    int ans = 0;
    rep (i, h) rep (j, w) chmax(ans, dh[i][j] + dw[i][j] - 1);
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 38560
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;
int n,a[101],dp[100001];
int solve(int i){
	if (dp[i]!=-1)return dp[i];
    int res=0;
	for(int k=0;k<n;k++){
		if (a[k]<=i){
			if (!solve(i-a[k])){
				res=1;
				break;
			}
		}
	}
	return dp[i]=res;
}

int main(){
	int k;
	cin>>n>>k;
	for(int i=0;i<n;i++)cin>>a[i];
    memset(dp,-1,sizeof(dp));
	cout <<(solve(k)?"First":"Second")<<std::endl;
	return 0;
}


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

int main(){
    ll n;
    cin >> n;
    string ans = "";
    while(n){
        n--;
        ans += 'a' + n%26;
        n/=26;
    }
    reverse(ans.begin(), ans.end());
    cout << ans;
	return 0;
}


Measured memory_bytes: 3596
n = int(input())
c_lst = [0] + list(map(int, input().split()))
edges = [[] for _ in range(n)]
for _ in range(n - 1):
  u, v, p = map(int, input().split())
  edges[u].append((v, p))
  edges[v].append((u, p))

INF = 10 ** 20
used = [False] * n
def cost(x):
  used[x] = True
  ret = 0
  pre_cost = 0 if x != 0 else INF
  for to, p in edges[x]:
    if used[to]:pre_cost = p
    else:
      ret += cost(to)
  if c_lst[x] == 0:return min(ret, pre_cost)
  else:return pre_cost

print(cost(0))


Measured memory_bytes: 5884
import Debug.Trace

main = do
  n <- readLn :: IO Int
  dat <- map (map read . words) . lines <$> getContents :: IO [[Int]]

  let (ds,ans) = solve dat

  if ans == [] then
    print $ -1
    else do
    print $ length ds
    putStrLn $ unwords . map show $ ds
    mapM_ putStrLn ans
  

solve dat
  | all (\[x,y] -> odd (abs x + abs y)) dat = let ds = reverse $ map (2^) [0..30] in (ds, f ds)
  | all (\[x,y] -> even (abs x + abs y)) dat = let ds = reverse $ 1 : map (2^) [0..30] in (ds, f ds)
  | otherwise = ([], [])
  where f ds = map (\[x,y] -> aux (x,y) ds (0,0)) dat
    

aux _ [] p = []
aux t@(tx,ty) (d:ds) (x,y)
  | abs (tx-x) > abs (ty-y) = if tx > x then 'R' : aux t ds (x+d,y) else 'L' : aux t ds (x-d,y)
  | otherwise = if ty > y then 'U' : aux t ds (x,y+d) else 'D' : aux t ds (x,y-d)



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

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

    static class GLongestPath {
        ArrayList<Integer>[] g;
        int[] dp;
        int ans = 0;

        public int dfs(int u) {
            if (dp[u] != -1) return dp[u];
            dp[u] = 0;
            for (int v : g[u]) {
                dp[u] = Math.max(dp[u], 1 + dfs(v));
            }
            return dp[u];
        }

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int m = in.nextInt();

            g = new ArrayList[n + 1];
            dp = new int[n + 1];
            for (int i = 0; i <= n; i++) {
                g[i] = new ArrayList<Integer>();
                dp[i] = -1;
            }

            for (int i = 0; i < m; i++) {
                int u = in.nextInt();
                int v = in.nextInt();
                g[u].add(v);
            }

            for (int i = 1; i <= n; i++) {
                ans = Math.max(ans, dfs(i));
            }

            out.println(ans);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

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

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

    }
}



Measured memory_bytes: 61620
#pragma region include
#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <tuple>
#include <bitset>

#include <queue>
#include <complex>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <fstream>
#include <random>
//#include <time.h>
#include <ctime>
#pragma endregion //#include
/////////
#define REP(i, x, n) for(int i = x; i < n; ++i)
#define rep(i,n) REP(i,0,n)
/////////
#pragma region typedef
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
#pragma endregion //typedef
////定数
const int INF = (int)1e9;
const LL MOD = (LL)1e9+7;
const LL LINF = (LL)1e18;
const double PI = acos(-1.0);
const double EPS = 1e-9;
/////////
using namespace::std;

void solve(){
	int N,K;
	cin >> N >> K;
	vector<int> D(K);
	for(int i=0;i<K;++i){
		cin >> D[i];
	}
	for(int ans=N;ans;++ans){
		int temp = ans;
		bool flag = true;
		while(temp){
			int ter = temp%10;
			for(int i=0;i<K;++i){
				if( ter == D[i] ){
					flag = false;
					break;
				}
			}
			if( flag == false ) break;
			temp /= 10;
		}
		if( flag ){
			cout << ans << endl;
			return;
		}
	}
}

#pragma region main
signed main(void){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	
	
	solve();
}
#pragma endregion //main()


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    float x1,y1,x2,y2,x3,y3,x4,y4,s1,s2;
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        scanf("%f %f %f %f",&x1,&y1,&x2,&y2);
        scanf("%f %f %f %f",&x3,&y3,&x4,&y4);
        s1=(y2-y1)/(x2-x1);
        s2=(y4-y3)/(x4-x3);
        if(s1==s2)
            printf("YES\n");
        else
            printf("NO\n");
    }
}



Measured memory_bytes: 1992
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
const ll LL_MAX=LLONG_MAX;

struct In{
    template<typename T>
    operator T(){
        T x;
        cin >> x;
        return x;
    }
};
In in;

template <typename T,typename U>
void forin(T* x,U n){
    for (U i=0;i<n;i++) cin >> x[i];
}

template <typename T>
int div1(T x) {
    return x%1000000007;
}

template <typename T>
void out(T x){
    cout << x << endl;
}

template <typename T>
T gcd(T x,T y){
    if (y == 0) return x;
    return gcd(y,x%y);
}

template <typename T>
T lcm(T x,T y){
    return x*y/gcd(x,y);
}

int main(){
    int a=in,b=in;
    if (a<b) swap(a,b);
    int ans=0;
    for (int i=0;i<a;i++){
        ans+=b;
        ans*=10;
    }
    out(ans/10);
}

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

using namespace std;

int main()
{
    int n,m;
    cin >> n >> m;
    
    int h[n+1];
    for(int i=1; i<=n; i++){
        int tmp;
        cin >> tmp;
        h[i] = tmp;
    }
    std::vector<int> v[n+1];
    for(int i=0; i<m; i++){
        int a,b;
        cin >> a >> b;
        v[a].push_back(b);
        v[b].push_back(a);
        //cout << a << "," << b << endl;
    }
    std::vector<int> ans;
    for(int i=1; i<=n; i++){
        //cout << "--" << i << endl;
        if(v[i].size() == 0){
            //cout << i << " is ok " << endl;
            ans.push_back(i); 
            continue;
        }
        std::vector<int>::iterator itr = v[i].begin();
        bool flag = true;
        
        while(itr != v[i].end()){
            int index = *itr;
            //cout << index << "," <<  h[index] << endl;
            if(h[index] >= h[i]){
                flag = false;
                break;
            }
            ++itr;
        }
        if(flag == true){
            //out << i << " is ok " << endl;
            ans.push_back(i); 
        }
    }
    cout << ans.size() << endl;
}

Measured memory_bytes: 9328
#include <algorithm>
#include <bitset>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define MOD (1000000007l)
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)

using namespace std;

double dp[310][310][310];
ll N;

double rec(ll one, ll two, ll three) {
  if (dp[one][two][three] != -1)  return dp[one][two][three];
  double sum = 0;
  sum += one;
  sum += two;
  sum += three;

  double ans = N;
  ans /= sum;
  if (one > 0)  ans += rec(one-1, two, three) * one / sum;
  if (two > 0)  ans += rec(one+1, two-1, three)  * two / sum;
  if (three > 0)  ans += rec(one, two+1, three-1) * three / sum;

  dp[one][two][three] = ans;
  return ans;
}

void solve() {
  rep (i, 310) rep (j, 310)  rep (k, 310) dp[i][j][k] = -1;
  dp[0][0][0] = 0;

  cin >> N;
  vector<ll> input(4);
  rep (i, N) {
    ll a;
    cin >> a;
    input[a]++;
  }

  cout << rec(input[1], input[2], input[3]) << endl;
}

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout.precision(12);
  cout << fixed;
  solve();
  return 0;
}


Measured memory_bytes: 233216
#include<cstdio>
int getPattern(int);

int main(){

  int n;
  while(1){
    scanf("%d",&n);
    if(n==0) break;
    printf("%d\n",getPattern(n)/3650);
  }
  return 0;
}

int getPattern(int n){

  int dp[n];
  dp[0]=1;
  dp[1]=2;
  dp[2]=4;

  for(int i=3;i<n;i++)
    dp[i]=dp[i-1]+dp[i-2]+dp[i-3];

  return ((dp[n-1]%3650)!=0) ? dp[n-1]+3650 : dp[n-1];
}

Measured memory_bytes: 1028
import math

A, B, H, M = map(int, input().split())

rad_A =  (360 * H/12 + 30 * M/60) % 360
rad_B = 360 * M/60
rad_diff = max(rad_A, rad_B) - min(rad_A, rad_B)
rad_diff = min(rad_diff, 360 - rad_diff)

ans = math.sqrt(A**2 + B**2 - 2*A*B*math.cos(math.radians(rad_diff)))
# print('rad', rad_A, rad_B, rad_diff)
# print('val', A**2, B**2, A*B*math.cos(math.radians(rad_diff)))
print(ans)


Measured memory_bytes: 9508
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <set>
#include <queue>
#include <deque>
#include <vector>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;

int main()
{
	int N;
	cin >> N;
	vector<int> A(N);
	vector<int> B(N);
	vector<int> C(N);
	for (auto i = 0; i < N; ++i)
	{
		cin >> A[i];
	}
	for (auto i = 0; i < N; ++i)
	{
		cin >> B[i];
	}
	for (auto i = 0; i < N; ++i)
	{
		cin >> C[i];
	}
	sort(B.begin(), B.end());
	sort(C.begin(), C.end());

	vector<ll> num;
	auto ans = 0ll;
	for (auto i = 0; i < N; ++i)
	{
		auto temp = (int)(upper_bound(C.begin(), C.end(), B[i]) - C.begin());
		num.push_back(N - temp);
	}
	for (auto i = N - 1; i > 0; --i)
	{
		num[i - 1] += num[i];
	}
	for (auto i = 0; i < N; ++i)
	{
		auto temp = (int)(upper_bound(B.begin(), B.end(), A[i]) - B.begin());
		if (temp >= N)
		{
			continue;
		}
		ans += num[temp];
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 2552
#include <bits/stdc++.h>
using namespace std;
int main() {
    
    string s;
    cin>>s;
    int c[26] ={0};

    for(auto i:s)
        c[i-'a']++;

    int ok = true;
    for(int i = 0; i < 26; i++)
        if(c[i]%2)
            ok = false;

    if(ok)
        cout<<"Yes\n";
    else
        cout<<"No\n";
    return 0;
}


Measured memory_bytes: 256
// see https://gist.github.com/LumaKernel/ff55d49ee1af69b7388f15b707e75c15
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <complex>
#include <random>
#include <iomanip>

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> VI;
typedef vector<P> VP;

#define omajinai ios::sync_with_stdio(false);cin.tie(0)

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define RFOR(i,b,a) for(int i=(b)-1;i>=(a);--i)
#define RREP(i,n) RFOR(i,n,0)

#define LFOR(i,a,b) for(ll i=(a);i<(b);++i)
#define RLFOR(i,b,a) for(ll i=(b)-1;i>=(a);--i)

#define ALL(a) (a).begin(),(a).end()
#define UNIQUE(a) (a).erase(unique((a).begin(),(a).end()),(a).end())
#define MP make_pair
#define PB push_back
#define EACH(i,c) REP(i,(int)(c).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

#define dump(x) cerr << "[L " << __LINE__ << "] " << #x << " = " << (x) << "\n";
#define dump2(x,y) cerr << "[L " << __LINE__ << "] " << #x << " = " << (x)\
			<< " , " << #y << " = " << (y) << "\n";

const int INF = 1e9;
const double EPS = 1e-10;

int n,k;
int x[50],y[50];
P ps[50];

bool cmpX(P a, P b){
	return a.first < b.first;
}

bool cmpY(P a, P b){
	return a.second < b.second;
}

ll ans=(ll)INF*INF*4;

void solve(int i, int j, int m, int f){
	int x1 = min(min(x[i], x[f]), min(x[j], x[m])),
			x2 = max(min(x[i], x[f]), max(x[j], x[m]));
	int y1 = min(min(y[i], y[f]), min(y[j], y[m])),
			y2 = max(max(y[i], y[f]), max(y[j], y[m]));
	int c = 0;
	REP(l, n){
		if(x1<=x[l] && x[l]<=x2 && y1<=y[l] && y[l]<=y2)
			c++;
	}
	if(c>=k){
		ans = min(ans, (ll)(x2-x1)*(y2-y1));
	}
}

// O(N^2)
int main() {
	cin >> n >> k;
	REP(i, n){cin>>x[i]>>y[i];}
	REP(i, n)REP(j, n)REP(m, n)REP(f, n){
		solve(i,j,m,f);
	}
	cout << ans << endl;
}


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

using namespace std;

int main(){
    int n;
    int c;
    cin >> n >> c;
    vector<int> p(c);
    int sum = 0;
    for(int i = 0; i < c; i++){
        cin >> p[i];
        sum += p[i];
    }
    int result = (sum + n) / (n + 1);
    cout << result << endl;
    return 0;
}


Measured memory_bytes: 3104
#include <bits/stdc++.h>
#include <algorithm>
#include <functional>

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

int main() {
  int count = 0;
  string S;
  cin>>S;
  
  for(int i=0; i<S.size()/2;i++){
  	if (S[i] != S[S.size()-i-1]){
      S[i] = S[S.size()-i-1];
      count ++;
    }
  }
  cout<<count<<endl;
  
  return 0;
}

Measured memory_bytes: 256