akhauriyash/Code-Regression huggingface dataset:
package main

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

func main() {
	io := NewIo(os.Stdin, os.Stdout)
	defer io.Flush()
	n, a, b := io.NextInt(), io.NextInt(), io.NextInt()
	cnt := 0
	q := n / (a + b)
	cnt += q * a
	r := n % (a + b)
	cnt += Min(r, a)
	io.Println(cnt)
}

// Min returns minimum value of inputs
func Min(a ...int) (min int) {
	for i, ai := range a {
		if i == 0 || ai < min {
			min = ai
		}
	}
	return min
}

// Io is I/O object
type Io struct {
	reader    *bufio.Reader
	writer    *bufio.Writer
	tokens    []string
	nextToken int
}

// NewIo returns a new Io instance
func NewIo(r io.Reader, w io.Writer) *Io {
	return &Io{
		reader: bufio.NewReader(r),
		writer: bufio.NewWriter(w),
	}
}

// Flush flushes writer
func (io *Io) Flush() {
	err := io.writer.Flush()
	if err != nil {
		panic(err)
	}
}

// NextLine scans a line from stdin
func (io *Io) NextLine() string {
	var buffer []byte
	for {
		line, isPrefix, err := io.reader.ReadLine()
		if err != nil {
			panic(err)
		}
		buffer = append(buffer, line...)
		if !isPrefix {
			break
		}
	}
	return string(buffer)
}

// Next return a word from stdin
func (io *Io) Next() string {
	for io.nextToken >= len(io.tokens) {
		line := io.NextLine()
		io.tokens = strings.Fields(line)
		io.nextToken = 0
	}
	r := io.tokens[io.nextToken]
	io.nextToken++
	return r
}

// NextInt returns an integer from stdin
func (io *Io) NextInt() int {
	i, err := strconv.Atoi(io.Next())
	if err != nil {
		panic(err)
	}
	return i
}

// Println is a wrapper of fmt.Fprintln
func (io *Io) Println(a ...interface{}) {
	fmt.Fprintln(io.writer, a...)
}


Measured memory_bytes: 1780
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N,M,K,x=0,a;cin>>N>>M;
  vector<vector<bool>>p(N,vector<bool>(M,false));
  for(int i=0;i<N;i++){
    cin>>K;
    for(int j=0;j<K;j++){
      cin>>a;
      p.at(i).at(a-1)=true;
    }
  }
  for(int i=0;i<M;i++){
    bool g=true;
    for(int j=0;j<N;j++){
      g=g&&p.at(j).at(i);
    }
    if(g)x++;
  }
  cout<<x<<endl;
}

Measured memory_bytes: 256
from itertools import accumulate
import bisect
n = int(input())
A = [n for n in range(1,5*10**3)]
B = list(accumulate(A))
i = bisect.bisect_right(B, n)
if B[i-1] == n:
    for j in range(i):
        print(A[j])
else:
    k = B[i] - n
    for j in range(i+1):
        if A[j] == k:
            continue
        print(A[j])

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

int main() {
    int h1,m1,h2,m2,k;
    cin >> h1 >> m1 >> h2 >> m2 >> k;
    if(m2 < k) {
        m2 += 60;
        h2--;
    }
    m2 -= k;
    if(m2 < m1) {
        m2 += 60;
        h2--;
    }
    int ans = 60 * (h2 - h1) + (m2 - m1);
    if(ans < 0) {
        cout << 0 << "\n";
    } else {
        cout << ans << "\n";
    }
    return 0;
}

Measured memory_bytes: 3624
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	as := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&as[i])
	}

	m := make(map[int]int, n)
	for i := range as {
		m[as[i]]++
	}

	cost := 0
	for k, v := range m {
		if k == v {
			continue
		}

		if v < k {
			cost += v
			} else {
			cost += v - k
		}
	}
	fmt.Println(cost)
}

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



int main() {
    int n, q;
    scanf("%d %d", &n, &q);
    dsu d(n);
    for (int i = 0; i < q; i++) {
        int t, u, v;
        scanf("%d %d %d", &t, &u, &v);
        if (t == 0) {
            d.merge(u, v);
        } else {
            if (d.same(u, v)) {
                printf("1\n");
            } else {
                printf("0\n");
            }
        }
    }
    
    
    return 0;
}




Measured memory_bytes: 3948
package main

import (
	"fmt"
)

func main() {
	var n, tmp int
	fmt.Scan(&n)
	v := make([]int, n)

	for i:=0; i< n; i++ {
		fmt.Scan(&tmp)
		v[i] = tmp
	}
	cnt := 0
	for i:=1; i< n-1; i++ {
		if v[i] > v[i-1] && v[i] < v[i+1] {
			cnt += 1
		} else if v[i-1] > v[i] && v[i] > v[i+1] {
			cnt += 1
		}
	}
	fmt.Println(cnt)
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> l_l;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<l_l> vpl;
#define pb push_back
#define sz(x) (int)(x).size()
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=1;i<=(n);i++)
const int INF=1001001000;
const int mINF=-1001001000;
const ll LINF=10100100100100100;
template<class T> inline bool chmin(T& a,T b){
if(a>b){
a=b;
return true;
}
return false;
}
template<class T> inline bool chmax(T& a,T b){
if(a<b){
a=b;
return true;
}
return false;
}
int main(){
    ll n,W;cin>>n>>W;
    ll sumv=0;
    vl w(n),v(n);rep(i,n){
        cin>>w[i]>>v[i];
        sumv+=v[i];
    }
    vector<vl> dp(n+1,vl(sumv+1,LINF));
    dp[0][0]=0;
    rep(i,n){
        rep(j,sumv+1){
            if(j-v[i]>=0)dp[i+1][j]=min(dp[i][j],dp[i][j-v[i]]+w[i]);
            else dp[i+1][j]=dp[i][j];
        }
    }
    ll ans=0;
    rep(i,sumv+1){
        if(dp[n][i]<=W)ans=i;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 80256
#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define ld long double
#define mk make_pair
#define fi first
#define se second
#define vll vector<ll>
#define pii pair<ll,ll>
#define vvll vector< vector<ll> >
#define pb push_back
#define sz(v) (v).size()
#define inf 1e18
#define md 1000000007
#define all(v) (v).begin(),(v).end()
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define tel(a){cout<<a<<"\n";}
#define tell(a,b){cout<<a<<" | "<<b<<"\n";}
#define telll(a,b,c){cout<<a<<" | "<<b<<" | "<<c<<"\n";}
#define teln(v,n){cout<<"v- ";rep(i,0,n)cout<<v[i]<<" ";cout<<"\n";}
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define tihs if(fopen("inp.txt","r"))freopen("inp.txt", "r", stdin),freopen("out.txt", "w", stdout);
using namespace std;
#define TRACE
 
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
 


#define M 100010


int main(){
	IOS;
	tihs;

	
	ll n,k;cin>>n>>k;
	ll ans=0;
	rep(i,k,n+1){
		ll mn = i*(i-1)/2;
		mn%=md;
		ll mx = 2*n-i+1;
		mx*=(i);
		mx/=2;
		mx%=md;
		(ans+=(mx-mn+1+md)%md)%=md;
	}
	cout<<(ans+1)%md;
	return 0;
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define dunk(a) cout << (a) << endl
using namespace std;
typedef long long ll;
const int inf = 1001001001;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	vector<string> S(n);
	rep(i, n) cin >> S[i];

	sort(all(S));
	//rep(i, n) dunk(S[i]);

	vector<pair<int, string>> ans;

	int a = 1;
	rrep(i, n) {
		if (S[i] != S[i - 1]) {
			ans.push_back(make_pair(a, S[i - 1]));
			a = 1;
		}
		else a++;
	}

	ans.push_back(make_pair(a, S[n - 1]));

	sort(ans.rbegin(),ans.rend());

	vector<string> ans1;
	rep(i, ans.size()) {
		if (i != 0) {
			if (ans[i].first != ans[i - 1].first) break;
		}
		ans1.push_back(ans[i].second);
	}
	sort(all(ans1));

	rep(i, ans1.size()) dunk(ans1[i]);

	return 0;
}

Measured memory_bytes: 20588
from fractions import gcd
N = int(input())
A = list(map(int, input().split()))

#def gcd(a,b):
#    if b==0:return a
#    return gcd(b, a%b)

L = A.copy()
R = A.copy()
for i in range(1, N):
    L[i] = gcd(L[i-1], L[i])

for i in reversed(range(0, N-1)):
    R[i] = gcd(R[i+1], R[i])

# 端っこをぬかした条件
# A[0  ]ぬかした場合, R[ 1]
# A[N-1]ぬかした場合, L[-2]
result = max(R[1],L[-2])

# 端っこ以外をfor文で
for i in range(1, N-1):
    result = max(result, gcd(L[i-1],R[i+1]))

print(result)


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

using namespace std;

const double PI = 3.141592653589;
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define pb push_back
#define mp make_pair
#define int long long
#define all(c) (c).begin(),(c).end()
#define M 1000000007
#define INF LLONG_MAX
#define pr(...) dbs(#__VA_ARGS__, __VA_ARGS__)
template <class T> void dbs(string str, T t) {cerr << str << " : " << t << "\n";}
template <class T, class... S> void dbs(string str, T t, S... s) {int idx = str.find(','); cerr << str.substr(0, idx) << " : " << t << ", "; dbs(str.substr(idx + 1), s...);}
template <class S, class T>ostream& operator <<(ostream& os, const pair<S, T>& p) {return os << "(" << p.first << ", " << p.second << ")";}
template <class T>ostream& operator <<(ostream& os, const vector<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class T>ostream& operator <<(ostream& os, const set<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class S, class T>ostream& operator <<(ostream& os, const map<S, T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class T> void prc(T a, T b) {cerr << "["; for (T i = a; i != b; ++i) {if (i != a) cerr << ", "; cerr << *i;} cerr << "]\n";}
// Use pr(a,b,c,d,e) or cerr<<anything or prc(v.begin(),v.end()) or prc(v,v+n)
//  


int32_t main()
{
    fastio;
    //freopen("file.in", "r", stdin);
    //freopen("file.out", "w", stdout);
    int n;
    cin >> n;
    vector<int> a(n);
    int count[(int)2e5 + 1];
    memset(count, 0, sizeof(count));
    for(int i=0;i<n;i++)
    {
        cin >> a[i];
        count[a[i]]++;
    }
    int total = 0;
    for(int i=0;i<(int)2e5 + 1;i++)
    {
        total += (count[i] * (count[i]-1))/2;
    }
    for(int i=0;i<n;i++)
    {
        int z = count[a[i]];
        cout << total - (z-1) << "\n";
    }
    return 0;
}



Measured memory_bytes: 5760
#include <iostream>

using namespace std;

int main()
{int x;
    cin>>x;
    if(x>=1800 && x<2000)
        cout<<"1";
    else if (x>=1600 && x <1800)
        cout<<"2";
     else if (x>=1400 && x <1600)
        cout<<"3";
         else if (x>=600 && x <800)
        cout<<"7";
         else if (x>=1200 && x <1400)
        cout<<"4";
         else if (x>=1000 && x <1200)
        cout<<"5";
         else if (x>=800 && x <1000)
        cout<<"6";
         else if (x>=400 && x <600)
        cout<<"8";
}


Measured memory_bytes: 3620
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <map>
#include <cmath>
using namespace std;

int main(int argc, const char * argv[]) {
    
    // cinを高速にするためのおまじない
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    /////////////////////
    // Write code below /
    /////////////////////
    
    // 入力
    int N;
    cin >> N;
    vector<int>A(N), B(N-1);
    for (int i = 0; i < N - 1; i++) {
        cin >> B.at(i);
    }

    // 両端の処理
    A.at(0) = B.at(0);
    A.at(N-1) = B.at(N-2);
    
    // i=1~N-1の処理
    for (int i = 1; i < N - 1; i++) {
        A.at(i) = min(B.at(i - 1), B.at(i));
    }
    
    // 出力
    int sum = 0;
    for (int i = 0; i < N; i++) {
        sum += A.at(i);
    }
    cout << sum << endl;
    
    return 0;
}


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

class RMQ{
public:
  typedef long long ll;
  ll INF = 1LL<<55;
  int n,n_;
  vector<ll> dat;
  int toMax;

  //初期化
  RMQ(){n=-1;}
  RMQ(int n_,int toMax = 0):n_(n_),toMax(toMax){
    n=1;
    while(n<n_)n*=2;
    dat.resize(2*n-1,INF);
  }
  
  //k番目の値をaに変更
  void update(int k,ll a){
    if(toMax) a *= -1;
    k+=n-1;
    dat[k]=a;
    while(k>0){
      k=(k-1)/2;
      dat[k]=min(dat[k*2+1],dat[k*2+2]);
    }
  }
  
  //[a,b)の最小値を求める query(a,b,0,0,n)
  ll find(int a,int b,int k,int l,int r){
    if(r<=a||b<=l)return INF;
    if(a<=l&&r<=b)return dat[k];
    ll vl = find(a,b,k*2+1,l,(l+r)/2);
    ll vr = find(a,b,k*2+2,(l+r)/2,r);
    return min(vl,vr);
  }

  ll find(int a,int b){
    assert(a <= b), assert(a <= n_ && b <= n_), assert(a >= 0 && a >= 0);
    return (toMax? -1:1) * find(a,b,0,0,n);
  }
};

int main(){
  int n,q;
  cin>>n>>q;
  RMQ A(n);
  for(int i=0;i<n;i++) A.update(i,((1LL<<31)-1));

  while(q--){
    int com,x,y;
    cin>>com>>x>>y;
    if(com == 0) A.update(x,y);
    if(com == 1) cout<<A.find(x,y+1)<<endl;
  }

  return 0;
}




Measured memory_bytes: 4924
#include <bits/stdc++.h>
using namespace std;
// type alias
typedef long long LL;
typedef pair<int,int> II;
typedef tuple<int,int,int> III;
typedef vector<int> VI;
typedef vector<string> VS;
typedef unordered_map<int,int> MAPII;
typedef unordered_set<int> SETI;
template<class T> using VV=vector<vector<T>>;
// minmax
template<class T> inline T SMIN(T& a, const T b) { return a=(a>b)?b:a; }
template<class T> inline T SMAX(T& a, const T b) { return a=(a<b)?b:a; }
// repetition
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define REPE(i,n)  for(int i=0;i<=(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORR(x,arr) for(auto& x:arr)
#define SZ(a) int((a).size())
// collection
#define ALL(c) (c).begin(),(c).end()
// DP
#define MINUS(dp) memset(dp, -1, sizeof(dp))
#define ZERO(dp) memset(dp, 0, sizeof(dp))
// stdout
#define println(args...) fprintf(stdout, ##args),putchar('\n');
// debug cerr
template<class Iter> void __kumaerrc(Iter begin, Iter end) { for(; begin!=end; ++begin) { cerr<<*begin<<','; } cerr<<endl; }
void __kumaerr(istream_iterator<string> it) { (void)it; cerr<<endl; }
template<typename T, typename... Args> void __kumaerr(istream_iterator<string> it, T a, Args... args) { cerr<<*it<<"="<<a<<", ",__kumaerr(++it, args...); }
template<typename S, typename T> std::ostream& operator<<(std::ostream& _os, const std::pair<S,T>& _p) { return _os<<"{"<<_p.first<<','<<_p.second<<"}"; }
#define __KUMATRACE__ true
#ifdef __KUMATRACE__
#define dump(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); __kumaerr(_it, args); }
#define dumpc(ar) { cerr<<#ar<<": "; FORR(x,(ar)) { cerr << x << ','; } cerr << endl; }
#define dumpC(beg,end) { cerr<<"~"<<#end<<": "; __kumaerrc(beg,end); }
#else
#define dump(args...)
#define dumpc(ar)
#define dumpC(beg,end)
#endif

// $ cp-batch ChristmasEveEveEve | diff ChristmasEveEveEve.out -
// $ g++ -std=c++14 -Wall -O2 -D_GLIBCXX_DEBUG -fsanitize=address ChristmasEveEveEve.cpp && ./a.out

/*
 
 2/3/2019
 
 10:27-
 
 */

int N;

void solve() {
  string res="Christmas";
  while(25-N>0) {
    res+=" Eve";
    ++N;
  }
  cout<<res<<endl;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout<<setprecision(12)<<fixed;
  
  cin>>N;
  solve();
  
  return 0;
}


Measured memory_bytes: 256
//http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0500
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
	cin.tie(0); ios::sync_with_stdio(false);
	while (true) {
		int n; cin >> n;
		if (!n) break;
		int ans[2] = { 0 };
		for (int i = 0; i < n;i++) {
			int a, b; cin >> a >> b;
			if (a == b) { ans[0] += a, ans[1] += b; continue; }
			ans[a < b] += (a + b);
		}
		cout << ans[0] << " " << ans[1] << endl;
	}
}

Measured memory_bytes: 3116
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>

using namespace std;

int main() {
    int N;
    cin >> N;
    vector<int> a(N);
    for (int i = 0; i < N; ++i) {
        cin >> a[i];
    }

    sort(a.begin(),a.end(),greater<int>());
    int turn = 0;
    int alice = 0;
    int bob = 0;
    for(auto it : a){
        if(turn == 0)  alice += it;
        if(turn == 1)  bob   += it;
        turn = 1 - turn;
     }

    cout << alice - bob;

}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define pi pair<int, int>
#define l first
#define r second
#define all(x) x.begin(), x.end()
#define fori(a, b, step) for (int i = a; i < b; i += step)
#define forj(a, b, step) for (int j = a; j < b; j += step)

const int maxn = 5e5 + 1, mod = 1e9 + 7;

using namespace std;

int a[maxn];
int cnt[32];

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        for (int j = 0, x = a[i]; j < 32; j++, x /= 2)
            cnt[j] += x % 2;
    }
    vector<bool> reg(32, 0);
    int cc = 0;
    for (int j = 31; j >= 0; j--) {
        if (cnt[j] && (n % 3 || cnt[j] != 2 * n / 3)) {
            cout << "No";
            return 0;
        }
        reg[j] = (cnt[j] > 0);
        cc += reg[j];
    }
    if (cc == 0) {
        cout << "Yes";
        return 0;
    }
    map<int, int> mp;
    for (int i = 0; i < n; i++)
        mp[a[i]]++;
    if (mp.size() > 3 || mp.size() == 1) {
        cout << "No";
        return 0;
    }
    vector<pi> cv;
    for (auto gg : mp)
        cv.pb(gg);
    if (cv.size() == 2) {
        if (cv[0].r != n / 3 &&
            cv[1].r != n / 3) {
            cout << "No";
            return 0;
        }
        int x = (cv[0].r == n / 3 ? cv[1].l : cv[0].l);
        int y = (cv[0].l == x ? cv[1].l : cv[0].l);
        int cx = x;
        for (int i = 0; i < 32; i++, cx /= 2) {
            if (!reg[i]) continue;
            if (cx % 2 == 0) {
                cout << "No";
                return 0;
            }
        }
        if (y) {
            cout << "No";
            return 0;
        }
    } else {
        if (cv[0].r != n / 3 ||
            cv[1].r != n / 3) {
                cout << "No";
                return 0;
            }
        int x = cv[0].l, y = cv[1].l, z = cv[2].l;
        bool fg = 1;
        for (int i = 0; i < 32; i++, x /= 2, y /= 2, z /= 2) {
            if (!reg[i]) continue;
            if ((x % 2 == 0) + (y % 2 == 0) + (z % 2 == 0) != 1) {
                cout << "No";
                return 0;
            }
        }
    }
    cout << "Yes";
    return 0;
}


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

int main(){
    int N, K;  cin >> N >> K;
    int R, S, P;  cin >> R >> S >> P;
    string T;  cin >> T;
    vector<vector<char>> hands(K);
    for(int i=0; i<N; i++){
        if(T[i] == 'r'){
            hands[i%K].push_back('p');
        }else if(T[i] == 's'){
            hands[i%K].push_back('r');
        }else if(T[i] == 'p'){
            hands[i%K].push_back('s');
        }
    }

    int ans = 0;
    for(int k=0; k<K; k++) {
        for(int i=0; i<hands[k].size(); i++){
            if(hands[k][i] == 'p') ans += P;
            if(hands[k][i] == 'r') ans += R;
            if(hands[k][i] == 's') ans += S;

            if (i + 1 < hands[k].size() && hands[k][i] == hands[k][i+1]){
                i++;
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 5120
(let* ((lst (read-line))
       (year (parse-integer (subseq lst 0 4)))
       (month (parse-integer (subseq lst 5 7)))
       (day (parse-integer (subseq lst 8 10)))
       )
  (if (and (<= year 2019) (<= month 4) (<= day 30))
      (princ "Heisei")
      (princ "TBD")))

Measured memory_bytes: 9696
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
int main() {
    ll a, b, c; cin >> a >> b >> c;
    bool ok = false;
    if((-a-b+c) <= 0) {
        cout << "No";
        return 0;
    }
    ll left = (ll)(-a-b+c) * (-a-b+c);
    ll right = (ll)4LL*a*b;
    if(left > right) ok = true;
    if(ok) cout << "Yes";
    else cout << "No";
}


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

int main(void){
    string s;
    long long k,l=1;
    cin >> s;
    cin >> k;
    for(int i=0;i<s.length();i++){
        if(s[i]=='1'){
            if(k==i+1){
                i=100;
                cout<<1<<endl;
            }
        }else{
            cout<<s[i]<<endl;
            i=100;
        }
        
    }
    
}


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

const int MOD = 1e9+7;
int add(int a, int b){return ((ll)a + (ll)b)%MOD;}
int mul(int a, int b){return ((ll)a * (ll)b)%MOD;}

void solve(){
    ll x;
    cin >> x;
    ll m = 100;
    int ans = 0;
    while(m < x){
        m = floor(m * 101.0/100.0);
        ans++;
    }
    cout << ans << endl;
}

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


Measured memory_bytes: 3756
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define popCnt(x) (__builtin_popcountll(x))
typedef unsigned long long Long;

int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#ifdef Local
  freopen("test.in", "r", stdin);
#else
#define endl '\n'
#endif

  int n;
  cin >> n;

  vector<pair<int, int>> edges;
  for (int i = 1; i < n; ++i) {
    for (int j = i + 1; j <= n - (n & 1); ++j) {
      if (i + j == n + 1 - (n & 1)) continue;
      edges.emplace_back(i, j);
    }
    if (n % 2 == 1) {
      edges.emplace_back(i, n);
    }
  }

  cout << edges.size() << endl;

  for (auto& edge : edges) {
    cout << edge.first << " " << edge.second << endl;
  }

}



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

int main(){
  string ans = "No";
  vector<char> s(4);
  vector<int> s1(4);
  for(int i = 0;i < 4;i++){
  cin >> s.at(i);
  s1.at(i) = s.at(i) - 'A'+1;
  }
  sort(s1.begin(),s1.end());
  
  if(s1.at(1) != s1.at(2)){
    if(s1.at(0) == s1.at(1) && s1.at(2) == s1.at(3)){
      ans = "Yes";
    }
  }
    
  cout << ans << endl;
    
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);

		String[] tempList = scanner.nextLine().split(" ");
		int A = Integer.parseInt(tempList[0]);
		int B = Integer.parseInt(tempList[1]);
		int C = Integer.parseInt(tempList[2]);
		int D = Integer.parseInt(tempList[3]);
		int result = 0;
			if(A >= C) {
				if(B >= D) {
					result = D - A;
				}else {
					result = B - A;
				}
			}else {
				if(B >= D) {
					result = D - C;
				}else {
					result = B - C;
				}
		}
		if(result < 0) {result = 0;}
		System.out.println(result);
	}
}

Measured memory_bytes: 21712
import java.util.*;
 
public class Main {
	public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	int a = sc.nextInt();
        int b = sc.nextInt();
        int k = sc.nextInt();
        for(int i = 1; i <= k; i++){
            if(i % 2 == 1){
        		if(a % 2 == 1){
            		a = (a - 1) / 2;
                	b += a; 
            	}else{
            		a = a / 2;
                	b += a;
            	}
            }else{
            	if(b % 2 == 1){
            		b = (b - 1) / 2;
                	a += b; 
            	}else{
            		b = b / 2;
                	a += b;
                }
            }
        }
        System.out.println(a + " " + b);
    }
}

Measured memory_bytes: 38628
import sys

def insertionSort(A, n, g):
    global cnt
    for i in range(g, n):
        v = A[i]
        j = i - g
        while (j >= 0) and (A[j] > v):
            A[j + g] = A[j]
            j = j - g
            cnt += 1
        A[j + g] = v

def shellSort(A, n):
    G = [i for i in [262913, 65921, 16577, 4193, 1073, 281, 77, 23, 8, 1] if i <= n]
    m = len(G)
    for k in range(m):
        insertionSort(A, n, G[k])
    return m, G

A = list(map(int, sys.stdin))
n = A[0]
del A[0]

cnt = 0

m, G = shellSort(A, n)

print(m)
print(*G)
print(cnt)
print("\n".join(map(str, A)))

Measured memory_bytes: 127944
#include<stdio.h>
int main(){
  int x, y, temp;

  while (1) {
    scanf("%d %d", &x, &y);
    if (x == 0 && y == 0) {
      break;
    }

    if (x > y) {
      temp = x;
      x = y;
      y = temp;
    }
    printf ("%d %d\n", x, y);
  }
    
  return 0;
}


Measured memory_bytes: 1908
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (ll i = 0; i < n; i++)
#define Rep(i, r, n) for (ll i = r; i < n; i++)
#define pb push_back
//#define MOD 1000000007
//#define MOD 998244353
#define MOD 998244353000000
#define INF 1000000000000
#define EPS 0.00000000001
typedef long long ll;

ll bigmod(string s) // ll型に収まらないMOD
{
    ll n = s.size();
    ll ans = 0;
    for (int i = 0; i < n; i++)
    {
        ans = ((ans * 10) + (s[i] - '0')) % MOD;
    }
    return ans;
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    //---------------------------------------------
    ll ans=0;
    string s;
    cin >> s;
    int n = s.size();
    for (int tmp = 0; tmp < (1 << (n - 1)); tmp++)
    {
        vector<string> x(n,"0");
        bitset<12> se(tmp);
        int c=0;
        x.at(0)+=s.at(0);
        rep(i,n-1){
            if(se.test(i)){
                c++;
                x.at(c)+=s.at(i+1);
            }
            else{
                x.at(c)+=s.at(i+1);
            }
        }

        rep(i,n){
            ans+=bigmod(x[i]);
        }
        rep(i,n){
            //cout<<x[i]<<endl;
        }
        //cout<<tmp<<endl;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std; 
#define mod 1000000007
#define INF 0x3f3f3f3f
#define all(x) (x).begin(),(x).end()
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define endl "\n" 
#define pb push_back
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define mp make_pair
#define print(v); for(auto x:v) cout<<x<<" "; cout<<endl;
typedef long long int ll;
int main()
{
    fast;
    ll k;
    cin >> k;
    ll a, b;
    cin >> a >> b; 
    for(ll i = a; i <= b; i++){
        if(i % k == 0){
            cout << "OK" << endl;
            return 0;
        }
    }
    cout << "NG" << endl;
    


    return 0;
}

Measured memory_bytes: 3640
import sys,collections
sys.setrecursionlimit(10**7)
def Is(): return [int(x) for x in sys.stdin.readline().split()]
def Ss(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

x = S() 
ans = "No"
for i in range(2):
    c = 0
    for j in range(i+1,i+3):
        if x[i] == x[j]:
            c += 1
        else:
            break
    if c == 2:
        ans = "Yes"
print(ans)

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

int main(){
	int height = 0;
	int rank[3] = {0,0,0};
	
	while(cin >> height){	
		if (height > rank[0]) {
			rank[2] = rank[1];
			rank[1] = rank[0];
			rank[0] = height;
		}else if (height > rank[1]) {
			rank[2] = rank[1];
			rank[1] = height;
		}else if(height > rank[2]){
			rank[2] = height;
		}
	}
	
	cout << rank[0] << endl;
	cout << rank[1] << endl;
	cout << rank[2] << endl;

	return 0;
}

Measured memory_bytes: 0
#include <iostream>
using namespace std;
#define MAX 100000
typedef long long ll;

int n,k;
ll T[MAX];
int check(ll p)
{
	int i = 0;
	for (int j = 0; j < k; ++j)
	{
		ll s = 0;
		while(s+T[i] <= p)
		{
			s+=T[i];
			i++;
			if(i==n) return i;
		}
	}
	return i;
}
int slove()
{
	ll left = 0;
	ll right = 100000 * 10000;
	while(left+1< right)
	{
		ll mid = left+(right-left)/2;
		int v = check(mid);
		if(v >= n) right = mid;
		else left = mid;
	}
	return right;
}

int main(int argc, char const *argv[])
{
	cin>>n>>k;
	for (int i = 0; i < n; ++i)
	{
		cin>>T[i];
	}
	ll ans = slove();
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3808
import sys
readline = sys.stdin.readline

def main():
    S = list(map(int, list(readline().rstrip())))
    K = int(readline())

    if S[0] != 1 or len(S) == 1:
        print(S[0])
        return

    idx = min(len(S), K)
    if sum(S[:idx]) == len(S[:idx]):
        print(1)
    else:
        for e in S:
            if e != 1:
                print(e)
                return


if __name__ == '__main__':
    main()

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

signed main(){
	int N; cin>>N;
	map<char,int> dict;
	string S; cin>>S;
	for(int i=0;i<S.size();i++){
		dict[S[i]]++;
	}
	for(int i=0;i<N-1;i++){
		cin>>S;
		map<char,int> tmp;
		for(int j=0;j<S.size();j++){
			tmp[S[j]]++;
		}
		for(auto p : dict){
			dict[p.first]=min(p.second,(tmp.count(p.first) ? tmp[p.first] : 0LL));
		}
	}
	string ans="";
	for(auto p : dict){
		for(int j=0;j<p.second;j++){
			ans+=p.first;
		}
	}
	sort(ans.begin(),ans.end());
	cout<<ans<<endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int num;
        int max = -10000000, min = 1000000;
        long sum = 0;

        num = Integer.parseInt(scan.next());

        for (int i = 0; i < num; i++) {
            int buf;
            buf = Integer.parseInt(scan.next());
            if (buf > max) {
                max = buf;
            }
            if (buf < min) {
                min = buf;
            }
            sum += (long)buf;
        }

        System.out.println(min + " " + max + " " + sum);
    }
}



Measured memory_bytes: 41640
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#define Mod 1000000007
typedef long long int ll;
int main()
{
  int n;
  cin>>n;
  int i;
  double a[n];
  for(i=0;i<n;i++)
  {
      cin>>a[i];
  }
  double ans=0.0;
  sort(a,a+n);
  double r;
  for(i=0;i<n-1;i++)
  {
      r=(a[i]+a[i+1])/2;
      a[i+1]=r;


  }
  cout<<setprecision(10)<<fixed<<r;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
inline void rd(int &x){
  int k, m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(int x){
  char f[10];
  int m=0, s=0;
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
int N;
int A[200000];
int B[200000];
int main(){
  int i, x, y;
  rd(N);
  {
    int Lj4PdHRW;
    for(Lj4PdHRW=0;Lj4PdHRW<N;Lj4PdHRW++){
      rd(A[Lj4PdHRW]);
    }
  }
  i = N-1;
  x = 0;
  y = N-1;
  for(;;){
    B[x++] = A[i--];
    if(x > y){
      break;
    }
    B[y--] = A[i--];
    if(x > y){
      break;
    }
  }
  {
    int KL2GvlyY;
    if(N==0){
      putchar_unlocked('\n');
    }
    else{
      for(KL2GvlyY=0;KL2GvlyY<N-1;KL2GvlyY++){
        wt_L(B[KL2GvlyY]);
        wt_L(' ');
      }
      wt_L(B[KL2GvlyY]);
      wt_L('\n');
    }
  }
  return 0;
}
// cLay varsion 20190721-1

// --- original code ---
// int N, A[2d5], B[2d5];
// {
//   int i, x, y;
// 
//   rd(N,A(N));
// 
//   i = N-1;
//   x = 0; y = N-1;
//   for(;;){
//     B[x++] = A[i--];
//     if(x > y) break;
//     B[y--] = A[i--];
//     if(x > y) break;
//   }
// 
//   wt(B(N));
// }


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

int main(){
  int inp1, inp2, inp3, inp4;
  cin >> inp1 >> inp2 >> inp3 >> inp4;
  if(inp1 + inp2 > inp3 + inp4)
    cout << "Left" << endl;
  else if(inp1 + inp2 < inp3 + inp4)
    cout << "Right" << endl;
  else
    cout << "Balanced" << endl;
}

Measured memory_bytes: 256
/// Code By t_bone_289 (Tushar Singh)
/// An Immature Programmer.... I'm still developing !!
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/trie_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define pll pair<ll,ll>
#define fi first
#define se second
#define mp make_pair
#define pb emplace_back
#define endl '\n'
#define M 1000000007
#define error(x) cout << #x << " = " << x << endl;
#define pi 3.14159265358979323846
typedef long long ll;
typedef long double ld;
template <typename T>
void ContainerError(T &v){cout<<"{";for(auto &x:v){cout<<x<<',';}cout<<"}"<<endl;return;}
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
ll powmod(ll base,ll exp,ll MOD){ll res=1;while(exp>0){if(exp%2==1) res=(res*base)%MOD;base=(base*base)%MOD;exp/=2;}return (res%MOD);}
ll mpow(ll base,ll exp){ll res=1;while(exp>0){if(exp%2==1) res=(res*base);base=(base*base);exp/=2;}return (res);}
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll n;
    cin>>n;
    vector<ll> v(n);
    for(auto &x:v)
    {
        cin>>x;
    }
    ll ans=0;
    for(ll i=0;i<n;i++)
    {
        for(ll j=i+1;j<n;j++)
        {
            ans += (v[i]*v[j]);
        }
    }
    cout<<ans;
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cstdlib>
using namespace std;
 
int main() {
  int A, B, H, M;
  cin >> A >> B >> H >> M;
  long double ans;
  long double angle_h, angle_m, angle;
  angle_h = (long double)H + (long double)M/60;
  //angle_h = 30 * (long double)H + 0.5*(long double)M;
  //angle_m = 6 * (long double)M;
  angle_m = (long double)M;
  angle = 2*M_PI*abs(angle_h/12 - angle_m/60);
  //angle = angle >= 180 ? angle - 180 : angle;
  
  ans = (long double)(A*A + B*B) - (long double)(2*A*B)*cosl(angle);
  
  //cout << ans << endl;
  printf("%20.20Lf\n", sqrt(ans));
  return 0;
}

Measured memory_bytes: 4144
#include <bits/stdc++.h>
using namespace std;
using ll =long long;
#define all(v) v.begin(),v.end()
 
int main() {
    ll X,Y,Z;
    cin>>X>>Y>>Z;
    ll ans=1;
    X-=(Y+2*Z);
    ans+=X/(Y+Z);
    cout<<ans<<endl;
}


Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i) = 0; (i) < (n); ++(i))
#define rrep(i,n) for(int (i) = (n) - 1; (i) >= 0; --(i)) //Reversi rep
#define nfor(i,a,b) for(int (i) = (a); (i) < (b); ++(i)) //Natural for
#define rfor(i,a,b) for(int (i) = (b); (i) >= (a); --(i)) //Reversi for
#define mod (1000000007)
#define YES cout << "YES" << endl;
#define Yes cout << "Yes" << endl;
#define NO cout << "NO" << endl;
#define No cout << "No" << endl;

int asc(const void *a, const void *b) {
    return *(int *)a - *(int *)b;
}

int desc(const void *a, const void *b) {
    return *(int *)b - *(int *)a;
}

int main()
{
    int a,b,ans = 0;
    cin >> a >> b;
    if (a > b) {
        ans += a;
        --a;
    }else{
        ans += b;
        --b;
    }
    if (a > b) {
        ans += a;
        --a;
    }else{
        ans += b;
        --b;
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

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

int main()
{
	char w[3];
	cin >> w[0] >> w[1] >> w[2];
	int cnt = 0;
	int max = 0;
	for (int i = 0; i < 3; i++) {
		if (w[i] == 'R') {
			cnt++;
			chmax(max, cnt);
		} else {
			cnt = 0;
		}
	}
	
	cout << max << endl;
	return 0;
}


Measured memory_bytes: 3632
#include<iostream>
#include<iomanip>
#include<cmath>
using namespace std;
int a,b[10000000];
double sum=0,sum2=0,avg=0;
int main(){
    while(true){
        cin>>a;
        sum=0;
        sum2=0;
        if(a==0){
            break;
        }
        for(int i=0;i<a;i++){
            cin>>b[i];
            sum += b[i];
        }
        avg=sum/a;
        for(int i=0;i<a;i++){
            sum2 += pow(avg-b[i],2);
        }
        sum2 /= a;
        cout<<fixed<<setprecision(30)<<sqrt(sum2)<<endl;
    }
    return 0;
}

Measured memory_bytes: 1244
//AcFreak

#include<bits/stdc++.h>
#define lint long long int 
#define mp make_pair
#define pb push_back
#define f first
#define INF (lint )(1e9)
#define __ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define s second
#define endl '\n'
#define pii pair<int,int >
using namespace std;
struct pair_hash {
    template <class T1, class T2>
    std::size_t operator () (const std::pair<T1,T2> &p) const {
        auto h1 = std::hash<T1>{}(p.first);
        auto h2 = std::hash<T2>{}(p.second);
        
        return h1 ^ h2;  
    }
};
int main()
{__

	int n;
	cin>>n;
	
	if(n == 0)
	{
	      cout<<0<<endl;
	      return 0;
	}

	vector<int >res;
	int term=0;
	while(n!=0)
	{
		int k=abs(n);
		k %= 2;

		if(k == 1){
			if(term %2 ==0)
				n-=1;
			else
				n+=1;
			res.pb(1);
			n/=2;
		}
		else
		{
			res.pb(0);
			n/=2;
		}
		term++;
	}
	reverse(res.begin(),res.end());
	for(int i=0;i<res.size();i++)
		cout<<res[i];

	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>

#define N (1000 + 10)
#define max(a,b)(a<b?b:a)

int dp[N][N];
char a[N],b[N];

int lcs(void)
{
  const int a_size=strlen(a)-1;
  const int b_size=strlen(b)-1;

  int i,j;

  memset(dp,0,sizeof(dp));

  for(i=1;i<a_size+1;++i)
    {
      for(j=1;j<b_size+1;++j)
	{
	  int mx =max(dp[i][j-1],dp[i-1][j]);
	  if(a[i-1]==b[j-1])
	    {
	      mx=max(mx,dp[i-1][j-1]+1);
	    }
	  dp[i][j]=mx;
	}
    }
  return dp[a_size][b_size];
}

int main()
{
  int n,i;
  scanf("%d\n",&n);

  for(i=0;i<n;i++)
    {
      fgets(a,N,stdin);
      fgets(b,N,stdin);
      printf("%d\n",lcs());
    }

  return 0;
}



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

int main(){
    int n;
    string s,t;
    cin >> n;
    cin >> s >> t;
    string ans = "";
    for(int i=0;i<n;i++){
        ans.push_back(s[i]);
        ans.push_back(t[i]);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
from scipy.misc import comb
def solve(i,k,smaller):
    if i == len(S):
        if k == 0:
            #0以外の個数がkと等しいので答えとしてカウントできる
            return 1
        else:
            #0以外の個数がkと等しくないので答えとしてカウント不可
            return 0 
    
    if k ==0:
        #kの個数を使い切りこれ以上下の桁は0で埋まり1通りの為
        return 1
    
    if smaller :
        return comb(len(S)-i,k)*pow(9,k)
    else:
        if S[i] =="0":
            return solve(i+1,k,False)
        else:
            zero = solve(i+1,k,True)
            aida = solve(i+1,k-1,True)*(int(S[i])-1)
            ici  = solve(i+1,k-1,False)
            
            return zero+aida+ici
            
N = int(input())
S = str(N)
K = int(input())

ans = round(solve(0,K,False))

print(int(ans))

Measured memory_bytes: 15540
#include <bits/stdc++.h>
#define MOD 10000007
using namespace std;

int main() {
  	int k,a,b; cin >> k >> a >> b;
  
  	string result = "NG";
  	for(int i = a;i <= b;i++) {
    	if(i % k == 0) {
        	result = "OK";
          	break;
        }
    }
	cout << result << "\n";
}

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

int main() {
    string s;
    char ch;
    while (1) {
        scanf("%c", &ch);
        if (ch == '\n') break;
        if (ch >= 'A' && ch <= 'Z') {
            ch += 32;
        } else if (ch >= 'a' && ch <= 'z') {
            ch -= 32;
        }
        s += ch;
    }
    printf("%s\n", s.c_str());
}


Measured memory_bytes: 3200
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <string>
#include <bitset>
#include <list>
using namespace std;
#define rep(i,a,n) for(ll i=a;i<n;i++)
#define rrep(i,a,n) for(ll i=n;i>=a;i--)
#define elif else if
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF = 1e+17;
const ll MODcdf = 998244353;
bool pairCompare(const P& firstElof,const P& secondElof){
    return firstElof.first<secondElof.first;
}
int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    string s,n;cin>>s>>n;
    if(s[0]!=n[2])cout<<"NO"<<endl;
    elif(s[1]!=n[1])cout<<"NO"<<endl;
    elif(s[2]!=n[0])cout<<"NO"<<endl;
    else cout<<"YES"<<endl;
}


Measured memory_bytes: 384
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            var intN = cin.ReadInt;
          	var aryCard = cin.ReadIntArray(intN);
          
          	var ansA = 0 ;
          	var ansB = 0 ;
          
          	Array.Sort(aryCard);
          	Array.Reverse(aryCard);
          
          	for(var i = 0 ; i < intN ; i ++ )
            {
            	if(i % 2 == 0)
                {
                	ansA += aryCard[i] ;
                }
             	else
                {
					ansB += aryCard[i] ;                
                }
            }
          
         	WriteLine(ansA - ansB);
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); }}
        public int ReadInt { get { return int.Parse(Read); }}
        public long ReadLong { get { return long.Parse(Read); }}
        public double ReadDouble { get { return double.Parse(Read); }}
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret;}
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret;}
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret;}
    }
}

Measured memory_bytes: 27796
ele_and_tar = []
rs = []
flag1 = 1
flag2 = 0
while flag1:
    data = [int(x) for x in input().split()]
    if data == [0,0]:
        flag1 = 0
    else:
        ele_and_tar.append(data)
        
for i in range(len(ele_and_tar)):
    rs.append(0)
for math in ele_and_tar:
    for i in range(1,math[0]+1):
        for j in range(i+1,math[0]+1):
            for k in range(j+1,math[0]+1):
                if (i + j + k) == math[1]:
                    rs[flag2] = rs[flag2] + 1
    flag2 = flag2 + 1
    
for out in rs:
    print(out)



Measured memory_bytes: 5600
x1, y1, x2, y2 = map(int, input().split())
dx = x2 - x1
dy = y2 - y1
x3 = x2 - dy
y3 = y2 + dx
x4 = x3 - dx
y4 = y3 - dy
print(x3, y3, x4, y4)


Measured memory_bytes: 3060
#include<iostream>
using namespace std;
char s[4010];
long long n,a,b,c,ans;
int main()
{
    int i,j;
    cin>>n;
    for(i=1;i<=n;i++) 
    {
        cin>>s[i];
        if(s[i]=='R') a++;
        if(s[i]=='G') b++;
        if(s[i]=='B') c++;
    }
    ans=a*b*c;
    for(i=1;i<=n;i++)
     for(j=1;i-j>0&&i+j<=n;j++)
      if(s[i]!=s[i-j]&&s[i-j]!=s[i+j]&&s[i]!=s[i+j]) 
       ans--;
    cout<<ans;
    cin>>i;
    return 0;
}
        
    


Measured memory_bytes: 3624
#include <stdio.h>
int a[100010];
int main(){
    int i,n;
    long long s=0,t=0,m;
    scanf("%d",&n);
    for(i=1;i<=n;++i)scanf("%d",a+i),s+=a[i];
    m=(long long)n*(n+1)/2;
    if(s%m){puts("NO");return 0;}
    m=s/m;
    a[n+1]=a[1];
    for(i=1;i<=n;++i){
        s=a[i+1]-a[i];
        s+=m*(n-1);
        if(s%n||m<s/n){puts("NO");return 0;}
        t+=m-s/n;
    }
    if(t!=m)puts("NO");
    else puts("YES");
    return 0;
}


Measured memory_bytes: 512
import collections
import functools
DIVISOR = 10 ** 9 + 7
n = int(input())

if n == 1:
    print(1)
else:
    prime_factor = collections.defaultdict(int)
    for i in range(1, n + 1):
        tmp = i
        for j in range(2, int(n ** 0.5) + 1):
            while tmp % j == 0:
                prime_factor[j] += 1
                tmp //= j

        if tmp > 1:
            prime_factor[tmp] += 1

    # print(prime_factor)
    prime_factor_num = [prime_factor[key] + 1 for key in prime_factor]

    print((functools.reduce(lambda x, y: (x % DIVISOR) * y, prime_factor_num)) % DIVISOR)

Measured memory_bytes: 3572
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const int MOD2 = 998244353;


int main(){
    ll a, b, c;
    cin >> a >> b >> c;
    int k; cin >> k;

    bool flag = 0;

    rep(i, k+1){
        ll B = b * ll(pow(2, i));
        ll C = c * ll(pow(2, k - i));
        if (a < B && B < C) flag = 1;
    }

    if(flag) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}


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

int main(){
  int n;
  string s;
  cin >> n >> s;
  vector<int> a(n);
  for(int i = 0; i < n; i++){
    if(s[i] == 'R') a[i] = 0;
    if(s[i] == 'G') a[i] = 1;
    if(s[i] == 'B') a[i] = 2;
  }
  vector<ll> cnt(3);
  for(int i = 0; i < n; i++){
    cnt[a[i]]++;
  }
  ll ans = 1;
  for(int i = 0; i < 3; i++){
    ans *= cnt[i];
  }
  for(int j = 0; j < n; j++){
    for(int i = 0; i < j; i++){
      int k = j + (j - i);
      if(k < n){
        if(a[i] == a[j]) continue;
       	if(a[i] == a[k]) continue;
        if(a[k] == a[j]) continue;
        ans--;
      }
    }
  }
  cout << ans << endl;
  return 0;
}

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

int main(){
    long long X;
    cin >> X;
    long long i = 100;
    int year = 0;

    while(true){
        i += i * 0.01;
        year++;
        if(i >= X){
            cout << year;
            return 0;
        }
    }
}

Measured memory_bytes: 3636
object Main extends App {
  val in = new java.util.Scanner(System.in)
  val n  = in.nextInt
  val d  = Seq.fill(n)(in.nextInt)

  val half   = d.length / 2
  val sorted = d.sorted

  val answer = sorted(half) - sorted(half - 1)

  println(answer)
}


Measured memory_bytes: 59008
#include <stdio.h>

char str[200010];

int check(int s, int e) {
  int flag = 1;
  for (int i = s; i < e-1; i++) {
    if (str[i] == '#' && str[i+1] == '#') flag = 0;
  }
  return flag;
}

int main(void) {
  int n, a, b, c, d, tof = 0;
  scanf("%d %d %d %d %d", &n, &a ,&b ,&c, &d);
  scanf("%s", str);
  if (check(a, c) == 0 || check(b, d) == 0) {
    printf("No\n");
    return 0;
  }

  if (c > d) {
    for (int i = b-1; i < d; i++) {
      if (str[i-1] == '.' && str[i] == '.' && str[i+1] == '.') tof = 1;
    }
  }
  if (tof == 1 || c < d) printf("Yes\n");
  else printf("No\n");
  
  return 0;
}

Measured memory_bytes: 384
/** author: __nishad__ **/

#include<bits/stdc++.h>
using namespace std;


typedef long long ll ;
typedef vector<ll> vll ;

#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define all(v) (v).begin(),(v).end()
#define precision(k) cout<<setprecision(k)<<fixed;
#define loop(i,a) for(int i=0; i<a;i++)
#define loop2(i,a,b) for(int i=(a);i<=(b);++i)
#define minv(v) *min_element(all(v))
#define maxv(v) *max_element(all(v))
#define getpos(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define unq(v) sort(all(v)),(v).erase(unique((v).begin(),(v).end()),(v).end())
#define pb push_back
#define pi 3.14159265358979323
#define endl "\n"

int main()
{
    IOS;

    int n, m, x, val, less=0, more=0;
    cin>>n>>m>>x;

    while(m--){
        cin>>val;
        if(val<x)
            less++;
        else
            more++;

    }

    cout<<min(less, more);

}







Measured memory_bytes: 256