akhauriyash/Code-Regression huggingface dataset:
package main

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

// 解説みた
// memo化で解く

func ok(last4 string) bool {
	for i := range last4 {
		var t string
		if i >= 1 {
			t = swap(last4, i-1, i)
		} else {
			t = last4
		}
		if strings.Contains(t, "AGC") {
			return false
		}
	}
	return true
}

func swap(last4 string, i, j int) string {
	ret := ""
	for k := range last4 {
		if k == i {
			ret = strings.Join([]string{ret, string(last4[j])}, "")
		} else if k == j {
			ret = strings.Join([]string{ret, string(last4[i])}, "")
		} else {
			ret = strings.Join([]string{ret, string(last4[k])}, "")
		}
	}
	return ret
}

var memo = make(map[int]map[string]int)
var N int

func dfs(cur int, last3 string) int {
	if memo[cur] == nil {
		memo[cur] = make(map[string]int)
	}
	if v, ok := memo[cur][last3]; ok {
		return v
	}
	if cur == N {
		return 1
	}
	ret := 0
	for _, c := range "ACGT" {
		if ok(last3 + string(c)) {
			ret = (ret + dfs(cur+1, last3[1:]+string(c))) % 1000000007
		}
	}
	memo[cur][last3] = ret
	return ret
}

func main() {
	sc := NewScanner(os.Stdin)
	N = sc.NextInt()
	fmt.Println(dfs(0, "TTT"))
}

func vmin(v []int) int {
	mn := math.MaxInt32
	for i := 0; i < len(v); i++ {
		mn = min(mn, v[i])
	}
	return mn
}

func lcm(x, y int) int {
	x, y = max(x, y), min(x, y)
	if y == 0 {
		return x
	}
	return lcm(y, x%y)
}

func max64(x, y int64) int64 {
	if x > y {
		return x
	}
	return y
}

func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

// scanner
type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner(r io.Reader) *Scanner {
	rdr := bufio.NewReaderSize(r, 1024)
	return &Scanner{r: rdr}
}

func (s *Scanner) ReadLine() {
	s.buf = make([]byte, 0)
	for {
		line, isp, err := s.r.ReadLine()
		if err != nil {
			os.Exit(1)
		}
		s.buf = append(s.buf, line...)
		if !isp {
			break
		}
	}
}

func (s *Scanner) NextInt64() int64 {
	i, err := strconv.ParseInt(s.Next(), 10, 64)
	if err != nil {
		os.Exit(1)
	}
	return i
}

func (s *Scanner) NextInt() int {
	i, err := strconv.Atoi(s.Next())
	if err != nil {
		os.Exit(1)
	}
	return i
}

func (s *Scanner) NextFloat64() float64 {
	i, err := strconv.ParseFloat(s.Next(), 64)
	if err != nil {
		os.Exit(1)
	}
	return i
}

func (s *Scanner) Next() string {
	s.Pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	next := string(s.buf[start:s.p])
	s.p++
	return next
}

func (s *Scanner) Pre() {
	if s.p >= len(s.buf) {
		s.ReadLine()
		s.p = 0
	}
}


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

int main() {
  int H,W; cin >> H >> W;
  vector<string> s(H);
  for (int i = 0; i < H; i++) cin >> s[i];
  
  bool can = true;
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      if (s[i][j] == '.') continue;
      
      const vector<int> dy = {1,0,0,-1};
      const vector<int> dx = {0,-1,1,0};
      bool can2 = false;
      
      for (int k = 0; k < 4; k++) {
        const int ii = i + dy[k];
        const int jj = j + dx[k];
        if (ii < 0 || ii >= H) continue;
        if (jj < 0 || jj >= W) continue;
        if (s[ii][jj] == '#') can2 = true;
      }
      
      if (!can2) can = false;
    }
  }
  
  if (can) cout << "Yes" << endl;
  else if (H == 1 && W == 1) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF ((1LL<<62)-(1LL<<31))
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define bit(n,m)(((n)>>(m))&1)
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}
ll pom(ll a,ll n,int m){ll x=1;for(a%=m;n;n/=2)n&1?x=x*a%m:0,a=a*a%m;return x;}
//#define MOD 998244353
#define MOD 1000000007
#define invp(a,p)pom(a,p-2,p)


ll n;
ll a[200010];
ll p[200010],m[200010];
//p[i]=(0<=a[i]<=...<=a[n-1]となるために必要な操作の回数)/2
//m[i]=(a[0]>=...>=a[i]>=0となるために必要な操作の回数)/2
ll sti[200010],stc[200010],stcnt;

void f(ll *p){
	//pを構成する
	stcnt=0;
	for(int i=n-2;i>=0;i--){
		if(a[i]<=a[i+1]){
			p[i]=p[i+1];
			ll temp=a[i],cnt=0;
			while(temp*4<=a[i+1])temp*=4,cnt++;
			if(cnt){
				sti[stcnt]=i+1;
				stc[stcnt]=cnt;
				stcnt++;
			}
		}else{
			ll temp=a[i+1],cnt=0;
			while(a[i]>temp)temp*=4,cnt++;
			//本当はi+1～n-1までをcnt回やりたいけど、マイナスがあったらそこで軽減される
			ll t=(n-1-i)*cnt;
			while(stcnt&&cnt){
				ll k=min(cnt,stc[stcnt-1]);
				t-=k*(n-sti[stcnt-1]);
				cnt-=k;
				stc[stcnt-1]-=k;
				if(!stc[stcnt-1])stcnt--;
			}
			p[i]=p[i+1]+t;
		}
//		rep(x,0,stcnt)printf("%d:%d ",sti[x],stc[x]);puts("");
	}
}


int main(){
	scanf("%lld",&n);
	rep(i,0,n)scanf("%lld",a+i);
	f(p);
	rep(i,0,n){
		if(i>=n-1-i)break;
		ll t=a[i];
		a[i]=a[n-1-i];
		a[n-1-i]=t;
	}
	f(m);

//	rep(i,0,n)printf("%2lld ",p[i]);puts("");
//	rep(i,0,n)printf("%2lld ",m[n-i]);puts("");
	//0がどこに入るか全探索
	ll ans=INF;
	rep(i,0,n+1)ans=min(ans,p[i]*2+m[n-i]*2+i);
	printf("%lld",ans);
}

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

int main()
{
  int n;
  cin >> n;
  string ans = "No";
  if (n % 10 == 7) ans = "Yes";
  n /= 10;
  if (n % 10 == 7) ans = "Yes";
  n /= 10;
  if (n % 10 == 7) ans = "Yes";
  cout << ans << endl;
}


Measured memory_bytes: 3628
import sys
import numpy as np
sys.setrecursionlimit(20000000)
input = sys.stdin.readline
s = input()
s = s[0]
if s == "A":
        print("T")
if s == "T":
        print("A")
if s == "G":
        print("C")
if s == "C":
        print("G")

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

using i64 = long long;
using P = pair<i64, i64>;



int main(){
    i64 n;
    cin >> n;
    vector<vector<i64>> x, y;
    for(int i = 0; i < n; ++i){
        i64 q;
        cin >> q;
        vector<i64> tx(q), ty(q);
        for(int j = 0; j < q; ++j){
            cin >> tx[j] >> ty[j];
            --tx[j];
        }
        x.push_back(tx); y.push_back(ty);
    }
    i64 ans = 0;
    for(int i = 0; i < (1LL<<n); ++i){
        bool flag = true;
        i64 cnt = 0;
        for(int j = 0; j < n; ++j){
            if(i & (1LL<<j)){
                ++cnt;
                for(int k = 0; k < x[j].size(); ++k){
                    i64 nx = x[j][k], ny = y[j][k];
                    if(i & (1LL<<nx)){
                        if(ny == 0) flag = false;
                    }else{
                        if(ny == 1) flag = false;
                    }
                }
            }
        }
        if(flag) ans = max(ans, cnt);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
int main(){
    int a,b,r=100,a2,b2,i,cnt=0,s=1;
    long int yaku[1000]={0},bai[1000];
    while(scanf("%d %d",&a,&b)!=EOF){
        a2=a;
        b2=b;
        if(a>b){
            r=a-b;
        }else{
            r=b-a;
        }
        while(r!=0){//ユーグリッドの公約数
            if(a2>b2){
                r=a2-b2;
                a2=b2;
                b2=r;
                s=1;
            }else{
                r=b2-a2;
                b2=a2;
                a2=r;
                s=2;
            }
        }
        if(s==1){
            yaku[cnt]=a2;
        }else{
            yaku[cnt]=b2;
        }
        bai[cnt]=1;
        for(i=100;i>1;i--){
            if(a%i==0&&b%i==0){
                while(1){
                    a=a/i;
                    b=b/i;
                    bai[cnt]*=i;
                    if(a%i!=0||b%i!=0) break;
                }
            }
        }
        
        bai[cnt]*=a*b;
        cnt++;
        r=100;
    }
    for(i=0;i<cnt;i++){
        printf("%ld %ld\n",yaku[i],bai[i]);
    }
    return 0;
}

Measured memory_bytes: 608
#include <iostream>

using namespace std;

main(){
  int a,b,c,d;
  cin >> a>> b>> c>> d ;
  if(a+b == c+d){
  cout << "Balanced"<<endl;}
  else if(a+b > c+d){
  cout << "Left"<<endl;}
  else if(a+b < c+d){
  cout <<"Right" <<endl;}
  return 0;
}

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


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

map< int64_t, int > prime_factor(int64_t n) {
    map< int64_t, int > ret;
    for(int64_t i = 2; i * i <= n; i++) {
        while(n % i == 0) {
        ret[i]++;
        n /= i;
        }
    }
    if(n != 1) ret[n] = 1;
    return ret;
}


int main(){
    ll n,p;
    cin >> n >> p;
    ll ans=1;
    for(auto pp : prime_factor(p)){
        if(pp.second >= n){
            rep(i,pp.second/n){
                ans *= pp.first;
            }
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define MAXN (1 << 18)
#define ll long long
 
int n, q, A, B;
int x[MAXN];
ll seg1[MAXN << 1], seg2[MAXN << 1];
 
ll query(ll *seg, int u, int l, int r, int ql, int qr){
	if(ql <= l && r <= qr) return seg[u];
	int m = l + r >> 1, ls = u << 1, rs = ls | 1;
	ll ret = LLONG_MAX;
	if(!(m < ql)) ret = std::min(ret, query(seg, ls, l, m, ql, qr));
	if(!(qr < m + 1)) ret = std::min(ret, query(seg, rs, m + 1, r, ql, qr));
	return ret;
}
 
void insert(ll *seg, int u, int l, int r, int pos, ll val){
	if(l == r){
		seg[u] = val;
		return;
	}
	int m = l + r >> 1, ls = u << 1, rs = ls | 1;
	if(pos <= m) insert(seg, ls, l, m, pos, val);
	else insert(seg, rs, m + 1, r, pos, val);
	seg[u] = std::min(seg[ls], seg[rs]);
}
 
int main(){
	scanf("%d%d%d%d", &n, &q, &A, &B);
	memset(seg1, 0x7f, sizeof seg1);
	memset(seg2, 0x7f, sizeof seg2);
	x[0] = B;
	insert(seg1, 1, 1, n, A, A);
	insert(seg2, 1, 1, n, A, -A);
	ll delta = 0;
	for(int i = 1; i <= q; ++ i){
		scanf("%d", x + i);
		
		ll tmp1 = query(seg1, 1, 1, n, x[i] + 1, n) - x[i];
		ll tmp2 = query(seg2, 1, 1, n, 1, x[i]) + x[i];
		tmp1 = std::min(tmp1, tmp2);
		
//		ll now = query(seg1, 1, 1, n, x[i - 1], x[i - 1]) - x[i - 1] + delta;
//		if(tmp1 < now){
			insert(seg1, 1, 1, n, x[i - 1], tmp1 + x[i - 1] - std::abs(x[i] - x[i - 1]));
			insert(seg2, 1, 1, n, x[i - 1], tmp1 - x[i - 1] - std::abs(x[i] - x[i - 1]));
//		}
		
		delta += std::abs(x[i] - x[i - 1]);
	}
	ll ans = LLONG_MAX;
	for(int i = 1; i <= n; ++ i){
		ans = std::min(ans, query(seg1, 1, 1, n, i, i) - i + delta);
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 9216
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define debug(x) cerr << "[(" << __LINE__ << ") " << (#x) << "]: " << x << endl;

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

    ll n, k;
    cin >> n >> k;

    int a[n];
    for (int& e: a) cin >> e;

    vector<int> m(n);

    int cur = 0, cnt = 1;
    while (!m[cur]) {
        m[cur] = cnt;
        cur = a[cur]-1;
        cnt++;
        k--;
        if (k == 0) break;
    }
    k %= cnt - m[cur];

    for (int i=0; i<k; i++) {
        cur = a[cur]-1;
    }
    cout << cur+1 << "\n";
}


Measured memory_bytes: 4764
#include <iostream>
#include<algorithm>
#include<string>
#include<cmath>
using namespace std;
const int maxn =1e5+10;
long long gcd(long long x,long long y)
{
    if(y==0)return x;
    return gcd(y,x%y);
}//最大公约数
int main()
{
    long long x,y;
    cin >> x >> y;
    long long g=gcd(x,y);
    long long ans=0;
    for(long long i=2;i<=sqrt(g); i++) //对gcd(a,b)作质因数分解
    {
        if(g%i==0)
        {
            ans++;
            while(g%i==0)g/=i;
        }
    }
    if(g>2) ans++;
    cout << ans +1 <<endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#define ll int 
using namespace std;
ll read()
{
	ll s=0,t=1;
	char c=getchar();
	while(c<'0'||c>'9')
	{
		c=getchar();
	}
	while(c>='0'&&c<='9')
	{
		s=s*10+c-'0';
		c=getchar();
	}
	return s;
}
string s;
ll leng,bj=0;
int main()
{
	cin>>s;
	leng=s.size();
	for(ll i=0;i<leng;i++)
	{
		if(s[i]=='F')
		{
			if(bj==1)
			{
				cout<<"Yes";
				return 0;
			}
		}
		if(s[i]=='C')
		bj=1;
	}
	cout<<"No";
}

Measured memory_bytes: 256
# D
from collections import deque
s = deque(str(input()))
q_count = int(input())
rev = False
for i in range(q_count):
    q = list(input().split())
    if q[0] == '1':
        rev = not(rev)
    else:
        if q[1] == '1':
            if rev:
                # 末尾にq[2]追加
                s.append(q[2])
            else:
                # 先頭にq[2]追加
                s.appendleft(q[2])
        else:
            if rev:
                # 先頭にq[2]追加
                s.appendleft(q[2])
            else:
                # 末尾にq[2]追加
                s.append(q[2])
if rev:
    s.reverse()
print(*s, sep='')

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

int main() {
	int a,b,k;cin>>a>>b>>k;
	for(int i=0;i<k;++i){
		if(a%2==1)--a;
		b += a/2;
		a =  a/2;
		swap(a,b);
	}
	if(k%2==1)swap(a,b);
	cout << a << " " << b << endl; 
}

Measured memory_bytes: 256
import std.stdio, std.array, std.conv;

void main() {
  while (true) {
    string[] input = split(readln());
    int H = to!int(input[0]);
    int W = to!int(input[1]);

    if (H == 0 && W == 0) return;

    for (int i = 0; i < H; ++i) {
      for (int j= 0; j < W; ++j) {
        write(is_side(i, j, H, W) ? "#" : ".");
      }
      writeln("");
    }
    writeln("");
  }
}

bool is_side(int y, int x, int H, int W) {
  return (y == 0 || x == 0 || y == (H - 1) || x == (W - 1));
}

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

using namespace std;
typedef long long ll;

const ll INF = 1LL<<60;

int h, w;

string a[501];
string r[501];
string b[501];


int main(){
    cin >> h >> w;
    for (int y = 0; y < h; y++){
        cin >> a[y];
    }

    string sharp(w-1, '#');
    string period(w-1, '.');
    string s;
    for (int y = 0; y < h; y++){
        if (y % 2 == 0) {
            s = sharp;
            r[y] = '.' + s;

            s = '#' + period;
            b[y] = s;
        } else {
            s = sharp;
            b[y] = s + '.';

            s = period + '#';
            r[y] = s;
        }
    }
    for (int y = 0; y < h; y++){
        for (int x = 0; x < w; x++){
            if (a[y][x] == '#'){
                r[y][x] = '#';
                b[y][x] = '#';
            }
        }
    }


    for (int y = 0; y < h; y++){
        cout << r[y] << endl;
    }
    cout << endl;
    for (int y = 0; y < h; y++){
        cout << b[y] << endl;
    }
/*
    for (int y = 0; y< h; y++){
        for (int x = 0; x < w; x++){
            if (r[y][x] == b[y][x]){
                cout << '#' ;
            } else {
                cout << '.';
            }
        }
        cout << endl;
    }
    */

}


Measured memory_bytes: 1792
using System;
using System.Linq;

class Program
{
    static void Main()
    {
        var N = int.Parse(Console.ReadLine());
        var L = Console.ReadLine().Split().Select(int.Parse).ToArray();
        Array.Sort(L);

        var result = 0;
        for (int i = 0; i < N; i++)
        {
            for (int j = i + 1; j < N; j++)
            {
                for (int k = j + 1; k < N; k++)
                {
                    if (L[i] != L[j] && L[j] != L[k] && L[k] != L[i])
                    {
                        if (L[k] < L[i] + L[j])
                        {
                            result++;
                        }
                    }
                }
            }
        }
        Console.WriteLine(result);
    }
}


Measured memory_bytes: 28260
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
// #include <atcoder/all>
using namespace std;
// using namespace atcoder;

#define int long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define REP(i, n) for (int i = 0; i < n; ++i)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x) cout << #x << " = " << (x) << endl;
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define SP << " " <<

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
typedef vector<int> vec;
typedef vector<P> pvec;
typedef vector<vector<int>> vvec;
typedef vector<vector<P>> pvvec;
typedef priority_queue<int> PQI;
typedef priority_queue<P> PQP;
typedef priority_queue<int,vector<int>,greater<int>> PQIG;
typedef priority_queue<P,vector<P>,greater<P>> PQPG;

const vector<int> DX = {0, -1, 0, 1, 1, 1, -1, -1};
const vector<int> DY = {1, 0, -1, 0, 1, -1, 1, -1};
constexpr int MOD = (1000000007);
// const int MOD = (998244353);
// const int INF = (1 << 30); // 1073741824
const ll INF = (1LL << 60); // 1152921504606846976
const double PI = (3.141592653589794);
const double EPS = (0.0000000001); // 10^(-10)

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return 1;} return 0;}
template<class T> inline T ceil(T a, T b) {return T((a + b - 1) / b);}
template<class T> inline T round(T a, T b) {return T(a / b);}
template< typename T1, typename T2 > istream &operator>>(istream &is, pair< T1, T2 > &p) { is >> p.first >> p.second; return is; }
template <class T> inline void out(T &a) { bool flag=true; for(auto&x:a){if(flag) {flag=false;} else{ cout << ' '; } cout<<x; } cout << endl; }



//----------------------------------------------------------------
int nmax=200000; // 2*(10^5)
vvec G(nmax);





void solve4ts()
{
  
  
  vector<int> a(2);
  rep(i,2) cin >> a[i];
  vector<int> b(2);
  rep(i,2) cin >> b[i];
  if(a[0]<=0 && 0<=a[1]) a.pb(0);
  if(b[0]<=0 && 0<=b[1]) b.pb(0);
  vec c;
  for(auto x:a){
    for(auto y:b){
      c.pb(x*y);
    }
  }
  sort(rall(c));
  cout<<c[0]<<endl;
  
}
//-----------------------------------------------------------------

signed main(){ ios::sync_with_stdio(false); cin.tie(0); cout << fixed << setprecision(15);
  int repeat = 1;
  // cin >> repeat;
  while(repeat--) solve4ts();
}

/*

g++ -std=c++1z code.cpp

./a.out

python3 expander.py code.cpp

*/

Measured memory_bytes: 7816
#include <bits/stdc++.h>
using namespace std;
int main(){
	int d;
	cin>>d;
	if(d==25){
		cout<<"Christmas"<<endl;
	}else if(d==24){
		cout<<"Christmas Eve"<<endl;
	}else if(d==23){
		cout<<"Christmas Eve Eve"<<endl;
	}else{
		cout<<"Christmas Eve Eve Eve"<<endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
               
#define pb push_back        
#define PII pair<int,int>   
               
#define VS vector<string>   
#define VI vector<int>      
#define ll long long int    
#define debug(x) cout << x << " :" <<#x << endl  
int main(void) {            
    int n;     
    cin >> n;  
    vector<int> x(n), xcp(n);
    REP(i,n) { 
      cin >> x[i];          
      xcp[i] = x[i];        
    }          
               
    sort(xcp.begin(), xcp.end());     
    int l = xcp[n/2 - 1];
    int r = xcp[n/2];                                                                                
               
    REP(i,n) { 
      if(x[i] <= l) cout << r << endl;
      else cout << l << endl;
    }          
}

Measured memory_bytes: 3712
#include <iostream>
#include <fstream>
#include <vector>
#include <stack>
#include <queue>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <cstdio>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <map>
#include <set>

using namespace std;

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

/*
    freopen("input","r",stdin);
    freopen("output","w",stdout);
*/

int main() {
    ios::sync_with_stdio(false);
    int N, M, Q;
    cin >> N >> M >> Q;
    unordered_map<int, int> X;
    vector<int> order;
    vector<int> num;
    stack<int> S;
    unordered_set<int> us;
    int a, b, c;
    for (int q = 0;q < Q;q++) {
    	cin >> a;
    	S.push(a);
    }
    while (S.size() > 0) {
    	a = S.top();
    	S.pop();
    	if (X.find(a) == X.end()) {
    		b = X.size();
    		X[a] = b;
    	}
    	b = X[a];
    	if (b >= order.size()) {
    		order.push_back(a);
    		us.insert(a);
    	}
    	if (b >= num.size()) num.push_back(0);
    	if (b == 0 && num[0] < N) num[0]++;
    	else {
    		if (num[b - 1] > num[b]) num[b]++;
    	}
    }
    vector<int> rem;
    for (int i = 0;i < order.size();i++) {
    	if (num[i] != N) rem.push_back(order[i]);
    }
    for (int i = 1;i <= M;i++) {
    	if (us.find(i) == us.end()) rem.push_back(i);
    }
    vector<int> g = rem;
    sort(g.begin(), g.end());
    if (g == rem) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 10172
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const ll inf = 2e5+9;
ll n,k,h[inf],dp[inf];

// this code to get maximum
// to get minimum use -m , -p , -query

bool Q ;
struct Line {
	mutable ll k, m, p;
	bool operator<(const Line& o) const {
		return Q ? p < o.p : k < o.k;
	}
};

struct LineContainer : multiset<Line> {
	// (for doubles, use inf = 1/.0, div(a,b) = a/b)
	const ll inf = LLONG_MAX;
	ll div(ll a, ll b) { // floored division
		return a / b - ((a ^ b) < 0 && a % b); }
	bool isect(iterator x, iterator y) {
		if (y == end()) { x->p = inf; return false; }
		if (x->k == y->k) x->p = x->m > y->m ? inf : -inf;
		else x->p = div(y->m - x->m, x->k - y->k);
		return x->p >= y->p;
	}
	void add(ll k, ll m) {
		auto z = insert({k, m, 0}), y = z++, x = y;
		while (isect(y, z)) z = erase(z);
		if (x != begin() && isect(--x, y)) isect(x, y = erase(y));
		while ((y = x) != begin() && (--x)->p >= y->p)
			isect(x, erase(y));
	}
	ll query(ll x) {
		assert(!empty());
		Q = 1; auto l = *lower_bound({0,0,x}); Q = 0;
		return l.k * x + l.m;
	}
}lc;

int main(){

    cin>>n>>k;
    for(ll i=1;i<=n;i++)
        cin>>h[i];

    ll m = -2*h[1],p =h[1]*h[1],add,x;
    dp[1] = 0;
    lc.add(-m,-p);
    for(ll i=2;i<=n;i++){
        x = h[i];
        add = h[i]*h[i]+k;
        dp[i] = -lc.query(x) + add;

        m = -2*h[i];
        p = h[i]*h[i]+dp[i];
        lc.add(-m,-p);
    }
    cout<<dp[n]<<endl;
}


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

typedef pair<int, int> P;
P start;
P goal;

bool check(int x, int y, int H, int W){
  return 0 <= x && x < W && 0 <= y && y < H;
}

int main(void){
  int H, W;
  char s, t;
  cin >> H >> W;
  cin >> s >> t;
  vector< vector<char> > graph(H, vector<char>(W));
  for(int i = 0; i < H; i++){
    string str;
    cin >> str;
    for(int j = 0; j < W; j++){
      graph[i][j] = str[j];
      if(graph[i][j] == s){
        start.first = j;
        start.second = i;
      }
      if(graph[i][j] == t){
        goal.first = j;
        goal.second = i;
      }
    }
  }

  // bfs
  int INF = 1000000;
  vector< vector<int> > d(H, vector<int>(W, INF));
  queue<P> que;
  que.push(make_pair(start.first, start.second));
  d[start.second][start.first] = 0;
  while(!que.empty()){
    P p = que.front(); que.pop();
    if(p == goal) break;

    int dx[] = {1, -1, 0, 0};
    int dy[] = {0, 0,  1, -1};
    for(int i = 0; i < 4; i++){
      int nx = p.first + dx[i]*2, ny = p.second + dy[i]*2;
      if( check(nx, ny, H, W) == false ) continue;
      if((graph[ny][nx] == '|' && abs(dy[i]) != 0) || (graph[ny][nx] == '-' && abs(dx[i]) != 0)){
        while(!('A' <= graph[ny][nx] && graph[ny][nx] <= 'Z')){
          nx += dx[i]; ny += dy[i];
          assert(check(nx, ny, H, W));
        }
        if(d[ny][nx] == INF){
          d[ny][nx] = d[p.second][p.first] + 1;
          que.push(make_pair(nx, ny));
        }
      }
    }
  }
  cout << d[goal.second][goal.first] << endl;;
}



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

int main() {
    ll x, ans, cnt = 0;
    cin >> x;
    ans = 100;
    for (int i = 100; ans < x; i++)
    {
        ans *= 1.01;
        cnt++;
    }
    cout << cnt << endl;
    return 0;
}

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


int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    std::cout << std::setprecision(9) << std::endl;

    double N, X, T;
    cin >> N >> X >> T;

    std::cout << ceil(N/X)*T << "\n";

	return 0;
}

Measured memory_bytes: 3788
#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <algorithm>
using namespace std;
#define INF 0x7FFFFFFF
#define ll long long

ll get_num();

string s;
vector<ll> a;
int t;

//[   -2
//]   -1

int main(){
  int n;
  cin >> n;
  while(n){
    n--;
    t=0;
    a.assign(0,0);
    cin >> s;
    int j=0;
    for(int i=0;i<(int)s.size();i++){
      if(s[i]== '['){
        a.push_back(-2);
        j=0;
      }
      else if(s[i]== ']'){
        a.push_back(-1);
        j=0;
      }
      else if('0'<=s[i]&&s[i]<='9'){
        if(j==0){
          a.push_back(s[i]-'0');
          j++;
        }
        else{
          a[a.size()-1]*=10;
          a[a.size()-1]+=(s[i]-'0');
          j++;
        }
      }
    }
    for(int i=0;i<(int)a.size();i++){
      if(a[i]>0){
        a[i]=(a[i]+1)/2;
      }
    }
    ll ans=get_num();
    cout << ans << endl;
  }
}

ll get_num(){
  vector<ll> b;
  ll re=0;
  t++;
  while(a[t]!=-1){
    if(a[t]>0){
      b.push_back(a[t]);
    }
    else if(a[t]==-2){
      b.push_back(get_num());
    }
    t++;
  }
  sort(b.begin(),b.end());
  for(int i=0;i<((int)b.size()+1)/2;i++){
    re+=b[i];
  }
  return re;
}



Measured memory_bytes: 3224
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(int i=n; i>-1; --i)
#define ALL(a) (a).begin(),(a).end()
#define INIT(a,n,x); REP(i,(n)){ (a)[i]=(x); }
#define CINA(a,n); REP(i,(n)){ cin >> (a)[i]; }
#define INIT2(a,n,m,x); REP(i,(n)){ REP(j,(m)){(a)[i][j]=(x);} }
#define CINA2(a,n,m); REP(i,(n)){ REP(j,(m)){cin >> (a)[i][j];} }
#define Liny "Yes\n"
#define Linn "No\n"
#define LINY "YES\n"
#define LINN "NO\n"

#define umap unordered_map
//cout << setfill('0') << right << setw(4) << 12; // "0012"
int keta(ll x){ if(x<10){return 1;} else{return keta(x/10) + 1;}}
int keta_wa(ll x){ if(x<10){return x;} else{return keta_wa(x/10) + x%10;} }
int ctoi(char c){ return ( (c>='0' && c<='9')? c - '0': 0 );}
ll sum(ll a[],ll N){ return accumulate(a,a+N,0LL);}
ll gcd(ll a,ll b){if(a<b)swap(a,b); return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){if(a<b){swap(a,b);} return a/gcd(a,b)*b;}

int main(){
  int X; cin>>X;
  int r;
  if(X==2){ r = 2;}
  else{
    vector<int> v = {2};
    r = 3;
    while(1){
      bool prime = true;
      for(int p:v){
        if(r%p==0){prime=false; break;}
      }
      if(prime){
        if(r>=X) break;
        else{ v.push_back(r);}
      }
      r+=2;
    }
  }
  cout << r;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#define lli long long
#define all(i) i.begin(),i.end()
#define rall(i) i.rbegin(),i.rend()
#define rep0(i,j) for(int i=0;i<j;i++)
#define rep1(i,j) for(int i=1;i<=j;i++)
#define rep0d(i,j) for(int i=j-1;i>=0;i--)
#define MOD 1000000007

using namespace std;

bool cmp(const pair<lli, lli> left, const pair<lli, lli> right) {
  	return left.second < right.second;
}

lli f[1000000], rf[1000000];
lli inv(lli x) {
    lli res = 1;
    lli k = MOD - 2;
    lli y = x;
    while (k) {
        if (k & 1) res = (res * y) % MOD;
        y = (y * y) % MOD;
        k /= 2;
    }
    return res;
}
void init() {
    f[0] = 1;
    rep1(i, 1000000) f[i] = (f[i - 1] * i) % MOD;
    rep0(i, 1000001) rf[i] = inv(f[i]);
}
lli C(lli n, lli k) {
    lli a = f[n]; // = n!
    lli b = rf[n-k]; // = (n-k)!
    lli c = rf[k]; // = k!

    lli bc = (b * c) % MOD;

    return (a * bc) % MOD;
}

void dfs(lli ed, lli num, vector<map<lli,lli>>& vec){
    lli n=1;
    for(auto e: vec[num]){
        if(n == ed)n++;
        if(e.second != -1)continue;
        vec[num][e.first] = n;
        vec[e.first][num] = n;   
        dfs(n, e.first, vec);
        n++;
    }
}

lli gcd(lli a, lli b){
    if(a < b)return gcd(b, a);
    lli temp;
    while((temp = a%b)){
        a=b;
        b=temp;
    }
    return b;
}

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

    if(a + b < k)printf("0 0");
    else if(a < k){
        printf("0 %lld", b - k + a);
    }
    else printf("%lld %lld", a-k, b);

}

Measured memory_bytes: 256
'use strict';

function Main(input) {
    const tmp = input.split("\n")[0].split(" ");

    if (tmp[1] - tmp[0] == tmp[2] - tmp[1]) {
        console.log("YES");
    } else {
        console.log("NO");
    }
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7372
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner s = new Scanner(System.in);
    int h = s.nextInt();
    int w = s.nextInt();
    while (h != 0 && w != 0) {
      for (int i = 0; i < h; i++) {
        String st = "";
        for (int j = 0; j < w; j++) {
          st += "#";
        }
        System.out.println(st);
      }
      System.out.println();
      h = s.nextInt();
      w = s.nextInt();
    }
    s.close();
  }
}



Measured memory_bytes: 55416
while(True):
    m,f,r = [int(i) for i in input().split()]
    if(m == -1 and f == -1 and r == -1):
        break
    if(m == -1 or f == -1):
        print('F')
    elif(m + f >= 80):
        print('A')
    elif(65 <= m + f <= 80):
        print('B')
    elif(50 <= m + f <= 65):
        print('C')
    elif(30 <= m + f <= 50 and r < 50):
        print('D')
    elif(r >= 50):
        print('C')
    else:
        print('F')

Measured memory_bytes: 7728
void main() {
    int[] abc = readln.split.to!(int[]);
    writeln(abc.count(5) == 2 && abc.count(7) == 1 ? "YES" : "NO");
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.container;
import std.typecons;
import std.ascii;
import std.uni;

Measured memory_bytes: 256
N=int(input())
A=list(map(int,input().split()))
ans=1
flag=0
sum_=0
for i in range(N+1):
  sum_+=A[i]
node=2
if A[0]>0:
  flag=1
  if A==[1] and N==0:
    flag=2
if N!=0:
  sum_-=A[1]
for i in range(1,N+1):
  if i!=N and node-A[i]<=0:
    flag=1
  elif i!=N:
    sum_-=A[i+1]
    ans+=node
    if 2*(node-A[i])-A[i+1]<=sum_:
      node=2*(node-A[i])
    else:
      node=sum_+A[i+1]   
  else:
    if node-A[i]<0:
      flag=1
    else:
      ans+=A[i]
if N==0 and A==[0]:
  flag=1

if flag==1:
  print("-1")
elif flag==2:
  print("1")
else:
  print(ans)

Measured memory_bytes: 20176
#include<iostream>
using namespace std;
int main(){
    int n,m;
    cin>>n>>m;
    int A[n][m];
    int b[m];
    int c;
    for(int d=0;d<n;d++){
        for(int a=0;a<m;a++){
            cin>>c;
            A[d][a]=c;
        }    
    }for(int e=0;e<m;e++){
        cin>>c;
        b[e]=c;
    }
    int sum=0;
    for(int d=0;d<n;d++){
        for(int a=0;a<m;a++){
            sum=sum+A[d][a]*b[a];
        }cout<<sum<<endl;
        sum=0;
    }
    return 0;
}


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

#define REP(i,n) for(int i=0; i<int(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()
using namespace std;

int main() {
	string s;
	cin >> s;
	string a = "abcdefghijklmnopqrstuvwxyz";
	REP(i, 26) {
		if (count(ALL(s), a[i]) == 0) {
			cout << a[i] << endl;
			return 0;
		}
	}
	cout << "None" << endl;
	return 0;
}

Measured memory_bytes: 512
#include <stdio.h>
int main(void){
	
	int h,w,i,j;
	while(1){
		scanf("%d %d",&h,&w);
		if(h==0 && w==0)break;
		for(i=0;i<h;i++){
			for(j=0;j<w;j++){
				if(i%2==0 && j%2==0 || i%2==1 && j%2==1){
					printf("#");
				}else{
					printf(".");
				}
			}
			printf("\n");
		}
		printf("\n");
	}
	
	return 0;
}


Measured memory_bytes: 2136
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <iomanip>
#include <set>
using namespace std;

vector<int> Adj[606];

int N, M;

int s[360005], t[360005];

int C[605];

vector<int > V;

int used[605];


long long int val[605];

int num[605];

long double p[605];



long double E[605];

vector<int> c_Adj[605];

long double a[605], b[605], x[605];

long double tot[605];

long double dp[605][2];

long double INF = 999999.9;

int main(void) {

	cin >> N >> M;

	for (int i = 1; i <= M; i++) {
		cin >> s[i] >> t[i];
		Adj[s[i]].push_back(t[i]);
		num[t[i]]++;
		c_Adj[t[i]].push_back(s[i]);
	}

	long double ans = 999999999999999.9;

/*	for (int i = 1; i <= N; i++) {
		for (int j = 0; j <= 1; j++) {
			dp[i][j] = INF;
		}
	}

	dp[N][0] = 0.0; dp[N][1] = 0.0;

	Adj[8].erase(9);

	for(int i = N - 1; i >= 1; i--) {
		long double tmp = 0.0;

		for (auto y : Adj[i]) {
			tmp += dp[y][0];
		}

		dp[i][0] = tmp / Adj[i].size() + 1.0L; // 0

		dp[i][1] = dp[i][0];

		long double val = 0.0;

		for (auto y : Adj[i]) {
			val = max(dp[y][0] - dp[y][1], val);
		}

			dp[i][1] = min(dp[i][1], (tmp - val) /Adj[i].size()+1.0L); // 
	
			long double max_val = 0.0;
			for (auto y : Adj[i]) {
				max_val = max(max_val, dp[y][0]);
			}

			if (Adj[i].size() > 1) {
				//dp[i][1] = min(dp[i][1], (tmp - max_val) / (1.0L*Adj[i].size() - 1.0L)+1.0L);//
			}
		
	}

	ans = min(dp[1][0], dp[1][1]);

	cout << dp[1][0] << " " << dp[1][1] << endl;
	*/
	//==================================
	vector<int> W;

	for (int i = 1; i <= N; i++) {
		W.push_back(i);
	}

	s[0] = 0; t[0] = 0;


	//============================

	//for (int i = 1; i <= N; i++) { E[i] = -1.0L; }

	E[N] = 0.0;

	for (int i = W.size() - 1; i >= 0; i--) {

		int Y = W[i];
		int cnt = 0;
		long double total = 0.0L;
		for (auto z : Adj[Y]) {
			if (E[z] < 0.0L) {
			}
			else {
				cnt++;
				total += E[z];
			}
		}

		if (cnt > 0) { E[Y] = total / cnt + 1.0L; }
	}

	ans = min(ans, E[1]);


	long double sum = E[1];

	for (int i = 1; i <= N; i++) { x[i] = E[i]; }

	//==========================
	//  b
	//=======================
	for (int k = 1; k <= N; k++) {

		for (int i = 1; i <= N; i++) { E[i] = -1.0L; }

		E[N] = 0.0;

		for (int i = W.size() - 1; i >= 0; i--) {

			int Y = W[i];
			int cnt = 0;
			long double total = 0.0L;
			for (auto z : Adj[Y]) {
					cnt++;
					total += E[z];
			}

			if (cnt > 0) { E[Y] = total / cnt + 1.0L; }

			if (Y == k) { E[k] += 1.0L; }
		}

		a[k] = E[1] - sum;
		b[k] = sum - a[k] * x[k];

	}// k-fin

	


	for (int i = 1; i <= N; i++) {
		for (auto y : Adj[i]) {
			tot[i] += x[y];
		}
	}

	//===========================

	for (int k = 1; k <= M; k++) {
		if (Adj[s[k]].size() <= 1) { continue; }

		int cnt = Adj[s[k]].size()-1;
		long double tmp = 0.0;
		tmp = tot[s[k]] - x[t[k]];
		
		long double value = a[s[k]]*(tmp/cnt+1.0L) + b[s[k]];
		//cout << s[k] << " " << t[k] << " " << value << endl;
		ans = min(ans, value);
	}
	

	cout << setprecision(12)<<fixed<<ans << endl;
	return 0;
}

Measured memory_bytes: 4096
#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
long long n, k, a[N], b[N];

bool check(long long val) {
	long long op = 0;
	for (int i = 0; i < n; i++) {
		if (b[i] == 0) continue;
		op += max(0LL, (long long) a[i] - (long long) val / b[i]);
	}

	return op <= k;
}

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> n >> k;

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

	sort(a, a + n);
	sort(b, b + n, greater<int>());

	long long l = 0;
	long long r = 1e13;
	
	long long ans = LLONG_MAX;
	while (l <= r) {
		long long m = (l + r) / 2;
		if (check(m)) {
			ans = m;
			r = m - 1;
		}
		else {
			l = m + 1;
		}
	}

	cout << ans << '\n';

	return 0;
}


Measured memory_bytes: 6704
#include<bits/stdc++.h>
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define rep(N) for (int i = 0; i < N; ++i)
#define Rep(a, b) for (int i = a; i < b; ++i)
#define For(i, N) for (int i = 0; i < N; ++i)
#define all(v) v.begin(), v.end()
#define rev(v) v.rbegin(), v.rend()
#define makei(N) int N; cin >> N;
#define makel(N) ll N; cin >> N;
#define makes(s) string s; cin >> s;
#define maked(d) double d; cin >> d;
#define makev(v, N) vi v(N); rep(N)cin >> v[i];
#define mod 1000000007
#define distance(x1,y1,x2,y2) sqrt((x1 - x2)*(x1 - x2) + (y1 - y2)*(y1 - y2));

using namespace std;
using ll = long long int;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vector<bool>>;
using vs = vector<string>;
using pii = pair<int, int>;
using pis = pair<int, string>;
using msi = map<string, int>;

template<typename T>
void say(T s) {
	cout << s << "\n";
}

template<typename T>
void say(vector<T> s) {
	auto itr = s.begin();
	cout << *(itr++);
	while (itr != s.end()) {
		cout << " " << *(itr++);
	}
	cout << "\n";
}

void yn(bool b) {
	if (b)say("yes");
	else say("no");
}

void Yn(bool b) {
	if (b)say("Yes");
	else say("No");
}

void YN(bool b) {
	if (b)say("YES");
	else say("NO");
}

template<typename T>
void maxi(T & a, T b) {
	a = max(a, b);
}

template<typename T>
void mini(T & a, T b) {
	a = min(a, b);
}

void exact_say(double x) {
	cout << setprecision(numeric_limits<double>::max_digits10) << x << endl;
}

template<class T> void getVector(vector<T> & v) {
	for (int i = 0; i < v.size(); ++i)
		cin >> v[i];
}

int main() {
	makei(x);
	say(x * x * x);
}


Measured memory_bytes: 3048
#include<iostream>
#include<cmath>
#include<algorithm>
#include<vector>

using namespace std;

int main(){

    int n;
    string s;

    cin >> n;
    cin >> s;

    vector<int> r,b,g;

    for(int i=0;i<n;i++){
        if(s[i] == 'R')r.push_back(i+1);
        else if(s[i]=='B')b.push_back(i+1);
        else g.push_back(i+1);
    }

    int o[30000]={};

    for(int i=0;i<n;i++){
        if(s[i]=='G') o[15000+i+1]++;
    }

    int x,y,z;

    x=r.size();
    y=b.size();
    z=g.size();

    long long int l=0;

    for(int i=0;i<x;i++){
        for(int j=0;j<y;j++){
            l+=z;
            if((r[i]+b[j])%2 == 0 && (o[15000+(r[i]+b[j])/2])==1)l--;
            if(o[15000+2*r[i]-b[j]]==1)l--;
            if(o[15000+2*b[j]-r[i]]==1)l--;
        }
    }

    cout << l << endl;

}

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

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl

template<typename T>
void trace(T *a, int s, int n) {
    for (int i=s; i<n; i++) {
	cout<<a[i]<<" ";
    }
    cout<<endl;
}



typedef long long ll;
const ll mod = 1e9+7;
const int maxn = 1e6 + 5;



ll a,b,c;

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

    cin>>a>>b>>c;

    ll rhs = c - a - b;
    bool gt = rhs>=0;
    rhs = rhs*rhs;

    //watch(rhs);
    
    if (4LL*a*b < rhs && gt) out("Yes");


    out("No");

    return 0;
}


Measured memory_bytes: 256
using System;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;
using Debug = System.Diagnostics.Debug;


static class P
{
    static void Main()
    {
        var nm = Console.ReadLine().Split().Select(int.Parse).ToArray();
        var n = nm[0];
        var m = nm[1];
        var ub = m / n;
        int max = 1;
        var sqrtm = (int)Ceiling(Sqrt(m));
        for (int i = 1; i <= sqrtm; i++)
        {
            if (m % i != 0) continue;
            if (i <= ub) max = Max(max, i);
            if (m / i <= ub) max = Max(max, m / i);
        }
        Console.WriteLine(max);
    }
}


Measured memory_bytes: 13396
N = int(input())
A = list(map(int,input().split()))
dic = {}
for i in A:
    if i in dic:
        dic[i] = dic[i]+1
    else :
        dic[i] = 1
s = sum(A)

Q = int(input())
B=[]
C=[]
for i in range(Q):
    b,c=map(int,input().split())
    B.append(b)
    C.append(c)

for b,c in zip(B,C):
    if b in dic:
        temp = dic[b]
        s = s + (c-b)*temp
        del dic[b]
        if c in dic:
            dic[c] = dic[c]+temp
        else :
            dic[c] = temp
    print(s)

Measured memory_bytes: 26600
#include <stdio.h>
int main(void){
    int S;
    scanf("%d",&S);
    int h,m,s;
    h=S/3600;
    m=(S-3600*h)/60;
    s=S-3600*h-60*m;
    printf("%d:%d:%d\n",h,m,s);
    return 0;
}


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

int main(void){
    long long n,r,g,b;
    string s;
    cin >> n >> s;
    r = count(s.cbegin(), s.cend(), 'R');
    g = count(s.cbegin(), s.cend(), 'G');
    b = count(s.cbegin(), s.cend(), 'B');
    
    long long count = 0;
    for (long long i = 0; i < n; i++){
        for (long long j = i + 1; j <= (n+i-1)/2; j++){
            vector<char> se ={s.at(i), s.at(j), s.at(2*j-i)};
             int coun = 0;
            if(se.at(0)=='R'||se.at(1)=='R'||se.at(2)=='R') coun++;
            if(se.at(0)=='G'||se.at(1)=='G'||se.at(2)=='G') coun++;
            if(se.at(0)=='B'||se.at(1)=='B'||se.at(2)=='B') coun++;
            if(coun == 3) count++;
        }
    }
    long long ans;
    ans = r * g * b - count;
    printf("%lld\n",ans);
}

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

using namespace std;

const int N = 5e5 + 7;
const int LOG = 20;
const int C = 26;

char s[N];
int n;
int finish[N], go[N][C], jump[N][LOG];

int main() {
	scanf("%s", s + 1);
	n = strlen(s + 1);
	for (int c = 0; c < C; c++) {
		go[n + 1][c] = -1;
	}
	for (int i = 0; i < LOG; i++) {
		jump[n + 1][i] = -1;
	}
	for (int i = n; i >= 1; i--) {
		finish[i] = -1;
		for (int c = 0; c < C; c++) {
			go[i][c] = -1;
		}
		char cur = s[i];
		go[i][cur - 'a'] = i + 1;
		for (int j = go[i + 1][cur - 'a']; j != -1; ) {
			cur++;
			if (cur > 'z') {
				finish[i] = j;
				break;
			} else {
				go[i][cur - 'a'] = j;
			}
			j = go[j][cur - 'a'];
		}
		if (finish[i] != -1) {
			// cout << i << " " << finish[i] << endl;
			for (int c = 0; c < C; c++) {
				if (go[i][c] == -1) {
					go[i][c] = go[finish[i]][c];
				}
			}
			jump[i][0] = finish[i];
			for (int j = 0; j + 1 < LOG; j++) {
				if (jump[i][j] != -1) {
					jump[i][j + 1] = jump[jump[i][j]][j];
				} else {
					jump[i][j + 1] = -1;
				}
			}
		} else {
			for (int j = 0; j < LOG; j++) jump[i][j] = -1;
		}
	}
	// cout << go[2][0] << " " << go[3][1] << endl;
	int q;
	scanf("%d", &q);
	for (int i = 0; i < q; i++) {
		int l, r;
		scanf("%d %d", &l, &r);
		++r;
		for (int j = LOG - 1; j >= 0; j--) {
			if (jump[l][j] != -1 && jump[l][j] <= r) {
				l = jump[l][j];
				// cout << "go" << l << endl;
			}
		}
		if (l == r) {
			printf("Yes\n");
		} else {
			printf("No\n");
		}
	}

	return 0;
}


Measured memory_bytes: 92928
#include <bits/stdc++.h>
#include <map>
#include <algorithm>
#include <vector>
#include <string.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <chrono>
#include <thread>
#include <string.h>
 
#define rep(i,n)    for(ll i=0;i<n;i++)
#define repu(i,k,n) for(ll i=k;i<=n;i++)
#define repd(i,k,n) for(ll i=k;i>=n;i--)
#define se second
#define fi first
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define endl "\n"
#define INF (ll)ll_MAX
 
typedef long long ll;
typedef long double ld;
typedef std::pair<ll, ll> pii;
typedef std::vector< ll > vi;
typedef std::vector< pii > vii;
typedef std::vector< ll > vll;
typedef std::vector< std::pair < pii, ll > > vpp;
 
const ll N = 3*1e5 +5 ;
const long long MOD = 1000000007;
const long long MOD2 = 998244353;
const long long inf = 1e18;
 
using namespace std;



void solve()
{	

    ll n;
    cin>>n;
    if(n<600){
        cout<<8;
    }
    else if(n<800){
        cout<<7;
    }
    else if(n<1000){
        cout<<6;
    }
    else if(n<1200){
        cout<<5;
    }
    else if(n<1400){
        cout<<4;
    }
    else if(n<1600){
        cout<<3;
    }
    else if(n<1800){
        cout<<2;
    }
    else if(n<2000){
        cout<<1;
    }


    
}

int main() {

    // #ifndef ONLINE_JUDGE
    //     // for getting input from input.txt
    //     freopen("input.txt", "r", stdin);
    //     // for writing output to output.txt
    //     freopen("output.txt", "w", stdout);
    // #endif


    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    ll t = 1;
    // cin>>t;
    ll ctr=0;
    while(t--)
    {   
        ctr++;
        // cout<<"Case #"<<ctr<<": ";
        solve();    
    } 
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
 
}

Measured memory_bytes: 3796
#include <iostream>
#include <vector>
#include <set>
#include <string>
#include <utility>
#include <functional>
#include <queue>
#include <cmath>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>      // std::setprecision
#include <bitset>
#include <boost/optional.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/bimap/bimap.hpp>
#include <boost/bimap/multiset_of.hpp>
#include <boost/multi_array.hpp>
#include <boost/math/common_factor_ct.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/pending/disjoint_sets.hpp>
#include <boost/icl/interval_map.hpp>
#include <boost/graph/graph_traits.hpp>
#include <boost/graph/strong_components.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/dijkstra_shortest_paths.hpp>
#include <boost/graph/kruskal_min_spanning_tree.hpp>
#include <boost/graph/graph_utility.hpp>
#include <boost/numeric/ublas/vector.hpp>

#define REP(i, N) for(int i=0; i<(N); i++)
#define REC(f, ...) const auto f = [&](const auto f, __VA_ARGS__)
using namespace std;
using namespace boost::math;
using namespace boost::numeric;
namespace bst = boost;
template<class T> void fill(T& v) { for (auto& i : v) cin >> i; }

int main() {
  int N, M;

  cin >> N >> M;
  
  unordered_map<bitset<12>, long long> dp;
  
  dp[bitset<12>()] = 0;
  REP(i,M) {
    long long a;
    int b;
    
    cin >> a >> b;
    
    bitset<12> bitm;
    
    REP(j, b) {
      int c;
      
      cin >> c;
      
      bitm[c - 1] = true;
    }
    
    unordered_map<bitset<12>, long long> newdp;
    for (auto i : dp) {
      auto newbit = i.first | bitm;
      if (!dp.count(newbit) || i.second + a < dp[newbit])
        if (!newdp.count(newbit) || i.second + a < newdp[newbit])
        	newdp[newbit] = i.second + a;
    }
    for (auto i : newdp) {
      dp[i.first] = i.second;
    }
  }

  const bitset<12> full((1 << N) - 1);
  cout << (dp.count(full) ? dp[full] : -1LL) << endl;

  return 0;
}


Measured memory_bytes: 512
from heapq import heappush as hpush
from heapq import heappop as hpop

class Descending_HeapQueue:
    def __init__(self, hq=[]):
        self.hq = []
        for i in hq:
            self.push(i)
    def push(self, n):
        hpush(self.hq, -n)
    def pop(self):
        return -hpop(self.hq)
    def sum(self):
        return -sum(self.hq)
    def __str__(self):
        return [-i for i in self.hq].__str__()

def main():
    N, M = map(int, input().split())
    A = list(map(int, input().split()))
    dhq = Descending_HeapQueue(A)
    for _ in range(M):
        dhq.push(dhq.pop() // 2)
    print(dhq.sum())
main()

Measured memory_bytes: 20660
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+5;
vector<int>g[N];
int dis[N][3],n,m,s,t,u,v;
int main()
{
	memset(dis,-1,sizeof(dis));
	scanf("%d%d",&n,&m);
	for(int i=0;i<m;i++)
	{
		scanf("%d%d",&u,&v);
		g[u].push_back(v);
	}
	scanf("%d%d",&s,&t);
	queue<pair<int,int> >Q;
	Q.push(make_pair(s,0));
	dis[s][0]=0;
	while(!Q.empty())
	{
		int v=Q.front().first;
		int l=Q.front().second;
		Q.pop();
		for(int i=0;i<g[v].size();i++)
		{
			int k=(l+1)%3;
			if(dis[g[v][i]][k]>=0)continue;
			dis[g[v][i]][k]=dis[v][l]+1;
			Q.push(make_pair(g[v][i],k));
		}
	}
	if(dis[t][0]>=0)dis[t][0]/=3;
	printf("%d\n",dis[t][0]);
}

Measured memory_bytes: 6912