akhauriyash/Code-Regression huggingface dataset:
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub


import sys
# sys.setrecursionlimit(10**6)
# buff_readline = sys.stdin.buffer.readline
buff_readline = sys.stdin.readline
readline = sys.stdin.readline

INF = 2**62-1


def read_int():
    return int(buff_readline())


def read_int_n():
    return list(map(int, buff_readline().split()))


def read_float():
    return float(buff_readline())


def read_float_n():
    return list(map(float, buff_readline().split()))


def read_str():
    return readline().strip()


def read_str_n():
    return readline().strip().split()

def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(L, R, D):
    ans = 0
    for i in range(L, R+1):
        if i % D == 0:
            ans += 1
    return ans


def main():
    L, R, D = read_int_n()
    print(slv(L, R, D))


if __name__ == '__main__':
    main()


Measured memory_bytes: 76720
#include <stdio.h>
long long a [100010];
int main (){
int n;
scanf("%d",&n);
for(int i=0;i<n;i++) scanf("%lld",&a[i]);
int zero =0;
for(int i=0;i<n;i++)if(a[i]==0) zero ++;
if(zero >0){
// a[i] contains 0
printf("0\n");
return 0;
}
long long prod =1;
for(int i=0;i<n;i++){
if(a[i ] <=1000000000000000000/ prod ){
// This condition is equivalent to prod*a[i] <=10ˆ18
prod *=a[i];
}else{
printf("-1\n");
return 0;
}
}
printf("%lld\n",prod );
}

Measured memory_bytes: 2516
#include<bits/stdc++.h>
using namespace std;
using P = pair<int, int>;

const int INF = 1e9;

template<typename T>
class Dijk{
    private:
        int n;
        vector<vector<pair<int, T>>> v;
    public:
        T INF;
        
        Dijk(const vector<vector<pair<int, T>>> &v, T INF){
            this->n = v.size();
            this->v = v;
            this->INF = INF;
        }
        
        vector<int> dijk(int start){
            vector<int> d(n, INF);
            d[start] = 0;
            priority_queue<pair<int, T>, vector<pair<int, T>>, function<bool(pair<int, T>, pair<int, T>)>> q([&](pair<int, T> a, pair<int, T> b){return a.second > b.second;});
            q.push(pair<int, T>(start, 0));
            while(q.size()){
                pair<int, T> now = q.top();
                q.pop();
                if(d[now.first] < now.second){
                    continue;
                }
                for(auto next : v[now.first]){
                    if(d[next.first] == INF || d[now.first] + next.second < d[next.first]){
                        d[next.first] = d[now.first] + next.second;
                        q.push(pair<int, T>(next.first, d[now.first] + next.second));
                    }
                }
            }
            return d;
        }
};

vector<vector<P>> edges;
vector<P> idv = {P(-1, -1)};

int get_id(int n, int c){
    auto ite = lower_bound(idv.begin(), idv.end(), P(n, c));
    return ite - idv.begin();
}

int main(){
    int N, M;
    cin >> N >> M;
    vector<pair<P, int>> etmp;
    vector<vector<int>> company(N);

    for(int i = 0; i < M; i++){
        int p, q, c;
        cin >> p >> q >> c;
        p--;
        q--;
        c--;
        company[p].push_back(c);
        company[q].push_back(c);
        etmp.push_back(make_pair(P(p, q), c));
    }

    for(int i = 0; i < N; i++){
        auto &v = company[i];
        sort(v.begin(), v.end());
        auto ite = unique(v.begin(), v.end());
        v.erase(ite, v.end());
        for(int c : v) idv.push_back(P(i, c));
        idv.push_back(P(i, INF));
    }

    edges.resize(idv.size());
    edges[0].push_back(P(get_id(0, INF), 1));
    for(int i = 0; i < N; i++){
        int hub = get_id(i, INF);
        for(int c : company[i]){
            int id = get_id(i, c);
            edges[id].push_back(P(hub, 1));
            edges[hub].push_back(P(id, 0));
        }
    }
    for(const auto &e : etmp){
        int n1, n2;
        tie(n1, n2) = e.first;
        int id1 = get_id(n1, e.second);
        int id2 = get_id(n2, e.second);
        edges[id1].push_back(P(id2, 0));
        edges[id2].push_back(P(id1, 0));
    }

    Dijk<int> dijk(edges, INF);
    const auto dist = move(dijk.dijk(0));
    int ans = INF;
    for(int c : company[N - 1]){
        int id = get_id(N - 1, c);
        ans = min(ans, dist[id]);
    }
    if(ans == INF) ans = -1;
    cout << ans << endl;
    return 0;
}


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

# define REP(i,n) for (int i=0;i<(n);++i)
# define rep(i,a,b) for(int i=a;i<(b);++i)
# define p(s) std::cout << s ;
# define pl(s)  std::cout << s << endl;
# define printIf(j,s1,s2) cout << (j ? s1 : s2) << endl;
# define YES(j) cout << (j ? "YES" : "NO") << endl;
# define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
# define yes(j) std::cout << (j ? "yes" : "no") << endl;
# define all(v) v.begin(),v.end()
# define showVector(v) REP(i,v.size()){p(v[i]);p(" ")} pl("")
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;}
typedef long long int ll;
typedef pair<ll,ll> P_ii;
typedef pair<double,double> P_dd;

template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}

template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
  for(auto &e:t) fill_v(e,v);
}


const int MOD = 1000000007;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;

void addM(long long &a, long long b) {
    a += b;
    if (a >= MOD) a -= MOD;
}

void mulM(long long &a, long long b) {
    a = ((a%MOD)*(b%MOD))%MOD ;
}

// a^b mod M
long myPow(long a,long b,int M) {
    long ret = 1;
    long tmp = a;
    while(b>0) {
        if((b&1)==1) ret = (ret * tmp) % M;
        tmp = (tmp * tmp) % M;
        b = b>>1;
    }
    return ret;
}

 // nCk mod M
int nCk(int n,int k,int M) {
    long ret = 1;
    int mi = min(k, n-k);
    for(int i=1;i<=mi;i++) {
        ret = (ret * myPow(i,M-2,M)) % M;
    }
    for(int i=n-mi+1;i<=n;i++) {
        ret = (ret * i) % M;
    }
    return (int)ret;
};

vector<pair<long long, long long> > prime_factorize(long long n) {
    vector<pair<long long, long long> > res;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p != 0) continue;
        int num = 0;
        while (n % p == 0) { ++num; n /= p; }
        res.push_back(make_pair(p, num));
    }
    if (n != 1) res.push_back(make_pair(n, 1));
    return res;
}


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

    vector<int> v(N);

    REP(i,N) {
        cin >> v[i],v[i]--;
    }

    int ans = 0;
    REP(i,N) if(i == v[v[i]]) ans++;

    pl(ans / 2)
    
    return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define int long long
#define REP(i,a,n) for(int i=a;i<(n);i++)
using namespace std;
signed main()
{
	ios::sync_with_stdio(0);
    cin.tie(0);
	int a[5],n,mini=(int)(1E16);
	cin>>n;
	REP(i,0,5){
		cin>>a[i];
		mini=min(mini,a[i]);
	}
	int ans;
	if(mini<n){
		ans=4+n/mini;
		if(n%mini)ans++;
	}else ans=5;
	cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3624
#include <stdio.h>
#include <stdlib.h>

int main()
{
    int w, a, b, ans;
    scanf("%d%d%d",&w, &a, &b);
    if (abs(a-b) <= w) {
        ans = 0;
    } else {
        ans = abs(a-b) - w;
    }
    printf("%d\n", ans);
}


Measured memory_bytes: 128
# coding: utf-8
from collections import defaultdict
import math

def nCr(n,r):
    f = math.factorial
    return f(n) // f(r) // f(n - r)


def main():
    A = str(input())
    d_ind = defaultdict(list)
    for ind, a in enumerate(A):
        d_ind[a].append(ind)
    ans = 1 + sum(range(len(A)))
    for ind in d_ind.values():
        if len(ind) == 1:
            continue
        ans -= nCr(len(ind), 2)
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 14320
//#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <string>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define inf 1e+9
#define rep(i, n) REP(i, 0, n)
#define all(v) v.begin(), v.end()
#define msg(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
#define pri(a) cout << a << endl;

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

  // ll n,ans=0;
  // cin >> n;
  ll n,k,ans=0;
  cin >> n >> k;
  // stirng s;
  // cin >> s;

  //昇順
  // vector<double> v(n);
	// rep(i,n){
	// 	cin >> v[i];
	// }

	// rep(i,n-1){
  //   	std::sort(v.begin(),v.end());
	// }

  // for(int i=1;i<=n;i++){
  //   for(int j=1;j<=k;j++){
  //     if(i==(j%10)*(j/10)){
  //       ans++;
  //     }
  //   }
  // }

  rep(i,n){
    rep(j,k){
      if(((j+1)%10)*((j+1)/10)==(i+1) && (j+1)%10>1 && (j+1)/10>1){
        ans++;
      }
    }
  }

  cout << ans << endl;

}

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

using namespace std;

#define JAM(x) cout << #x << " = " << x << "\n"
#define II() ({ int a ; read(a) ; a; })
#define LL() ({ ll a ; read(a) ; a; })
#define DD() ({double a; scanf("%lf", &a); a; })

//Fast Reader
template <class T>
inline bool read(T &x)
{
    int c = getchar();
    int sgn = 1;
    while (~c && c < '0' || c > '9')
    {
        if (c == '-')
            sgn = -1;
        c = getchar();
    }
    for (x = 0; ~c && '0' <= c && c <= '9'; c = getchar())
        x = x * 10 + c - '0';
    x *= sgn;
    return ~c;
}

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef pair<int, int> PII;
typedef vector<PII> VPI;

const int INF = 2e9;
const int MX = 100005;
const int MOD = 1000000007;
const double PI = acos(-1.0);



long long int power(long long int a, long long int b)
{
    a %= MOD;
    long long int res = 1;
    while (b > 0)
    {
        if (b & 1)
            res = res * a % MOD;
        a = a * a % MOD;
        b >>= 1;
    }
    return res;
}
bool isprime(int n)
{
    if (n == 1)
        return false;
    for (int i = 2; i * i <= n; i++)
    {
        if (n % i == 0)
            return false;
    }
    return true;
}



/*_______________________________________________*/



int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    long long int a,b,c,d;
    cin>>a>>b>>c>>d;
    cout<<max(max(a*c,a*d),max(b*c,b*d));
}

Measured memory_bytes: 3688
import math
N=int(input())
x=[0]*N
y=[0]*N
for i in range(N):
    x[i],y[i]=map(int,input().split())
ans_sum=0
for i in range(N):
    for j in range(N):
            ans_sum+=math.sqrt((x[j]-x[i])**2+(y[j]-y[i])**2)
print(ans_sum/N)

Measured memory_bytes: 3064
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author champon
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for(ll i=0; i<n; i++)
#define repr(i, s, e) for(ll i=s; i>=e; i--)
#define reps(i, s, e) for(ll i=s; i<=e; i++)
#define inf 1e18
#define all(v) v.begin(),v.end()
#define ceill(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
#define sp << " " <<
void ans(bool b){ cout << (b ? "Yes" : "No") << endl; }
void ans2(bool b){ cout << (b ? "YES" : "NO") << endl; }
template<typename T> inline bool chmax(T &a, T b){ if(a<b) a=b; return a<b; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a) a=b; return b<a; }
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    fill((T*)array, (T*)(array+N), val);
}
template<typename T> void vdeb(T v){
    cout << "#vector set debug" << endl;
    for(auto vv : v) cout << vv << " ";
    cout << endl;
}
template<typename T1, typename T2> void adeb(T1 arr[], T2 n){
    cout << "#adebug" << endl;
    for(int i=0; i<=n; i++) cout << arr[i] << " ";
    cout << endl;
}
template<typename T1> void mdeb(T1 mp){
    cout << "#map pair debug" << endl;
    for(auto const& m : mp) cout << m.first sp m.second << endl;
}
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};


class ABlackjack {
public:
	void solve(std::istream& in, std::ostream& out) {
        int a1, a2, a3;
        in >> a1 >> a2 >> a3;
        int sum = a1 + a2 + a3;
        if(sum >= 22) out << "bust" << endl;
        else out << "win" << endl;
	}
};


int main() {
	ABlackjack solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
const int mod = 998244353;
typedef pair<int,int> ii;
typedef long long ll;
ii a[N];
int r[N];
ll mem[N];
int fw[N];
int n;
ll dp(int x){
    if (x == n+1) return 1;
    if (mem[x] != -1) return mem[x];
    else return mem[x] = (dp(x+1) + dp(r[x]+1))%mod;
}
void up(int x, int v){
    x++;
    while (x < N){
        fw[x] = max(fw[x],v);
        //printf("update %d %d\n",x,fw[x]);
        x += x&(-x);
    }
}
int qu(int x){
    x++;
    int res= 0 ;
    while (x){
        //printf("%d %d\n",x,fw[x]);
        res = max(res,fw[x]);
        x -= x&(-x);
    }
    return res;
}
int main(){
    scanf("%d",&n);
    for (int i = 0; i < n; i++){
        scanf("%d%d",&a[i].first,&a[i].second);
    }
    a[n] = ii(-1000000001,2000000005);
    sort(a,a+n+1);
    int last = -1;
    ll ans = 1;
    up(n,n);
    for (int i = n; i >= 0; i--){
        r[i] = lower_bound(a,a+n+1,ii(a[i].first+a[i].second,-1))-a-1;
        //printf("%d -> %d\n",i,r[i]);
        if (r[i] != i && r[i] != n){
            //printf("will extend from %d to %d\n",i,r[i]);
            int cur = qu(r[i]);
            r[i] = cur;
        }
        //printf("updating %d with %d\n",i,r[i]);
        up(i,r[i]);
        //assert(qu(i) == r[i]);
       // printf("%d -> %d\n",i,r[i]);
        /*for (int i = 0; i <= n; i++){
            printf("%d ",qu(i));
        }
        printf("\n");*/
    }
    memset(mem,-1,sizeof(mem));
    printf("%lld",dp(0)-1);

}


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

void search(void);

int time1[100000];
int time2[100000];
int n,k,sub;
int ans;

int main(void){
	
	cin>>n>>k;
	for(int i=0;i<n;i++){
		cin>>time1[i];
	}
	
	ans=n;
	sub=n-k;
	
	search();
	
	sort(time2,time2+n-1);
	
	for(int i=0;i<sub;i++){
		ans+=time2[i];
	}
	
	cout<<ans<<endl;
	return 0;

}
void search(void){
	
	for(int i=0;i<n-1;i++){
		time2[i]=time1[i+1]-time1[i]-1;
	}

}


Measured memory_bytes: 3940
import numpy

N = int(input())
X = numpy.array(list(map(int, input().split())))

X2 = X ** 2

S1 = numpy.sum(X)
S2 = numpy.sum(X2)

ans = []
for i in range(-3, 3):
    P = round(S1 / N) + i
    ans.append(S2 - 2 * S1 * P + N * P ** 2)

print(int(min(ans)))

Measured memory_bytes: 27136
n = gets.to_i
s = gets.chomp
min = n
w = s.scan(/W/).size
e = n - w
l = 0
(0...n).each do |x|
  if s[x] == 'W'
    l += 1
    w -= 1
  else
    e -= 1
  end
  m = (s[x] == 'W') ? l+e-1 : l+e  
  min = m if min > m
end
puts min

Measured memory_bytes: 27396
import math
line = input().split(" ")
H = int(line[0])
W = int(line[1])
A = [[0 for i in range(W)] for j in range(H)]
for i in range(H):
    line = input().split(" ")
    #print(line)
    for j in range(W):
        A[i][j] = int(line[j])

minVal =  1000000
for y in range(H):
    for x in range(W):
        # (x,y)で解を評価
        sumVal = 0
        for j in range(H):
            for i in range(W):
                #print(min(abs(i-x), abs(j-y)), end=" ")
                sumVal += A[j][i]*min(abs(i-x), abs(j-y))
        if sumVal < minVal:
            minVal = sumVal
print(minVal)


Measured memory_bytes: 5664
use std::cmp::*;
use std::io::*;
fn main() {
    let mut s: String = String::new();
    std::io::stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();
    let n: usize = itr.next().unwrap().parse().unwrap();
    let p: Vec<usize> = (0..n)
        .map(|_| itr.next().unwrap().parse().unwrap())
        .collect();

    let mut ans = 0;
    let mut mn = p[0];
    for i in 0..n {
        if mn >= p[i] {
            ans += 1;
        }
        mn = min(mn, p[i]);
    }
    println!("{}", ans);
}


Measured memory_bytes: 4784
def resolve():
    N, x = map(int, input().split())
    a = list(map(int, input().split()))
    a.sort()
    okashi = 0
    for i in range(N):
        okashi += a[i]
        if okashi > x:
            ans = i
            break
        elif okashi == x:
            ans = i+1
            break
    else:
        ans = N-1
    print(ans)
resolve()

Measured memory_bytes: 3060
#include<stdio.h>

int main()
{
	int year;
	char name;
	scanf("%d", &year);
	if ((1<=year)&&(year <= 999))
	{
		name = 'C';
	}
	else if((1000 <= year) && (year <= 1998))
	{
		name = 'D';
	}
	printf("AB%C", name);
}

Measured memory_bytes: 128
N = int(input())
red = [list(map(int, input().split())) for i in range(N)]
blue = [list(map(int, input().split())) for i in range(N)]
a = [0] * N
for x,y in sorted(blue,key=lambda x: x[0]):
    k = []
    for i,[x2,y2] in enumerate(red):
        if x2 < x and y2 < y and not a[i]:
            k.append((x2,y2,i))
    if len(k):
        x,y,i=sorted(k,key=lambda x:-1*x[1])[0]
        a[i] = 1
print(sum(a))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

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

int		main(void)
{
	string s, t;
	cin >> s >> t;
	cout << t << s << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <vector>
#include <iomanip>
#include <map>
#include <queue>

using namespace std;

#define fori(x) for (int i = 0; i < x; ++i)
#define forj(x) for (int j = 0; j < x; ++j)

typedef long long ll;

const int INF = 2e9 + 5;
const int alength=100100;

int main() {
	int n;int a[110];
	cin>>n;
	int ave=0;
	fori(n){cin>>a[i];ave+=a[i];}
	ave/=n;
	ll sa=0,sb=0;
	fori(n){
		sa+=(ave-a[i])*(ave-a[i]);
	}
	ave+=1;
	fori(n){
		sb+=(ave-a[i])*(ave-a[i]);
	}
	cout<<min(sa,sb);
}

Measured memory_bytes: 256
n = int(input())						# 5
s = input()		# 文字列の入力  abcdefg...


S = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

ans=""

for c in s:
	#print(c)
	i = ord(c) + n
	if i>90: i-=26
	
	ans = ans + chr(i)

print(ans)


Measured memory_bytes: 3060
N,M = map(int, input().split())
AB = []
for n in range(N):
    a,b = map(int,input().split())
    AB.append((a,b))

AB = sorted(AB)

kosu = 0
kane = 0
for a,b in AB:
    if kosu + b < M:
        kosu += b
        kane += b*a
    else:
        tmp = M - kosu
        kane += tmp*a
        break

print(kane)


Measured memory_bytes: 17788
from collections import deque
s = deque()
l = input()
for i in range(len(l)):
	s.append(l[i:i+1])
g = 0
q = int(input())
for i in range(q):
	d = input().split(" ")
	if d[0] == "1":
		if g == 0:
			g = 1
		else:
			g = 0
	if d[0] == "2":
		f = d[1]
		if g == 0:
			if f == "1":
				s.appendleft(d[2])
			else:
				s.append(d[2])
		else:
			if f == "1":
				s.append(d[2])
			else:
				s.appendleft(d[2])
if g == 1:
	s.reverse()
	ans = "".join(s)
	print(ans)
else:
	ans = "".join(s)
	print(ans)			


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

using namespace std;

typedef long long int 	ll;
typedef pair<int,int>   ii;
typedef vector< ii >   vii;
typedef vector<int>     vi;
typedef vector< vi >   vvi;

#define mm 100005
#define nn 1005
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define sz(a) (int)(a.size())
#define all(a) a.begin(),a.end()
#define forn(i, n) for(int i = 0; i < int(n); ++i)
#define rep(i, a, b) for(int i = int(a); i <= int(b); ++i)
#define cases int t;  cin>>t;   while(t--)
#define check(a,n) forn(iiii,int(n)) cout<<int(a[iiii])<<" "; cout<<endl
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
vi g[mm],v;
int par[mm],siz[mm];

void dfs(int v,int p)
{
    par[v]=p;
    siz[v]++;
    for(auto i:g[v])
        if(i!=p)
            dfs(i,v),siz[v]+=siz[i];
}

int main()
{
    int n,v1,u;
    cin>>n;
    forn(i,n-1)
        cin>>v1>>u,g[u].pb(v1),g[v1].pb(u);
    dfs(1,0);
    int m=n;
    while(m!=0)
    {
        v.pb(m);
        m=par[m];
    }
    int ans1=siz[v[sz(v)/2-1]];
    int ans2=n-ans1;
    if(ans2>ans1)
        cout<<"Fennec";
    else
        cout<<"Snuke";
    return 0;
}


Measured memory_bytes: 13436
// g++ -std=c++11 temp.cpp
#include <bits/stdc++.h>
using namespace std;

#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) FOR(i,0,n)
#define EACH(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;

#define INF INT_MAX/3

#define MAX_N 1000

string s;

int main(){
	cin>>s;
	if(s.length()==2){
		if(s[0]==s[1])cout<<1<<" "<<2<<endl;
		else cout<<-1<<" "<<-1<<endl;

		return 0;
	}
	REP(i,s.length()-2){
		if(s[i]==s[i+1]||s[i+1]==s[i+2]||s[i]==s[i+2]){
			cout<<i+1<<" "<<i+3<<endl;
			return 0;
		}
	}
	cout<<-1<<" "<<-1<<endl;
	return 0;
}




Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<iomanip>
#define sqr(x) (x)*(x)
#define llx(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
#define rdst(st,len) {char ss[len];scanf("%s",ss);(st)=ss;}
using namespace std;
long long n,m,i,j,num[200005],ans;
int main()
{
	scanf("%lld",&n);
	for (i=1;i<=n;i++)
	{
		scanf("%lld",&num[i]);
		num[i]-=i;
	}
	sort(num+1,num+n+1);
	for (i=1;i<=n;i++)
	{
		ans+=abs(num[i]-num[(n+1)/2]);
	}
	cout<<ans<<endl;
	return 0;
}

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

class UnionFind
{
    vector<int> to;
    vector<int> cnt;
    vector<int> rank;

public:
    UnionFind(int N)
    {
        to = vector<int>(N);
        for (int i = 0; i < N; ++i)
            to[i] = i;
        cnt = vector<int>(N, 1);
        rank = vector<int>(N, 1);
    }

    size_t size()
    {
        return to.size();
    }

    int root(int node)
    {
        if (node == to[node])
        {
            return node;
        }
        to[node] = root(to[node]);
        return to[node];
    }

    int count(int node)
    {
        return cnt[root(node)];
    }

    // 同じグループにいるかどうか
    int same(int a, int b)
    {
        return root(a) == root(b);
    }

    void unite(int a, int b)
    {
        if (same(a, b))
            return;
        if (rank[a] < rank[b])
            swap(a, b);
        int rootb = root(b), roota = root(a);
        to[rootb] = roota;
        cnt[roota] += cnt[rootb];
        if (rank[a] == rank[b])
            ++rank[a];
    }
};

int main(void)
{
    int n, m, k;
    cin >> n >> m >> k;
    UnionFind ufm(n), ufk(n);
    vector<vector<int>> vm(n), vk(n);
    vector<int> ans(n, 0);
    for (int i = 0; i < m; ++i)
    {
        int a, b;
        cin >> a >> b;
        --a, --b;
        vm.at(a).push_back(b);
        vm.at(b).push_back(a);
        ufm.unite(a, b);
    }
    for (int i = 0; i < k; i++)
    {
        int c, d;
        cin >> c >> d;
        --c, --d;
        vk.at(c).push_back(d);
        vk.at(d).push_back(c);
        ufk.unite(c, d);
    }
    // uf.same
    // uf.count
    // vm(友達関係)、vk(ブロック関係)
    for (int i = 0; i < n; i++)
    {
        ans.at(i) = ufm.count(i) - 1 - (vk.at(i).size() + vm.at(i).size());
        for (auto j : vk.at(i))
        {
            if (!ufm.same(i, j))
            {
                ans.at(i)++;
            }
        }
    }

    for (auto x : ans)
    {
        cout << x << " ";
    }
    cout << endl;
}

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

//ライブラリコピペ
int gcd(ll a, ll b)
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}

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


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


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

int main() {

	int n, k; cin >> n >> k;
	vector<int> l(n);
	for (int i = 0; i < n; i++) {
		cin >> l[i];
	}
	sort(l.rbegin(), l.rend());
	int ans = 0;
	for (int i = 0; i < k; i++) {
		ans += l[i];
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3576
/**
*
* Author: Mouhanad
* Lang: GNU C++14
*
**/
#include<bits/stdc++.h>
using namespace std;

#define F first
#define S second
#define ii pair < int , int >
#define LS pair < ll , string >
typedef long long ll;
const int inf = 1<<30;
const int N =100100;
int n , a[N] , L ;
vector < pair < ii , int > > edges ;
int main ( ){
  scanf("%d",&L);
  for  (int i = 20 ; i > 2 ; --i ){
     edges.push_back({{i-1,i},0});
     edges.push_back({{i-1,i},1<<(20-i)});
  }
  int   last = 0 ;

   while ( L > (1<<18)){
 edges.push_back({{1,2},last});
 last += (1<<18);
 L -= (1<<18);
   }
     //   cerr << L <<" " << last <<endl;
   for ( int i = 22 ; i >= 0 ; --i ){
      if ( L&(1<<i)){
         edges.push_back({{1,20-i},last});
         last += (1<<i);
      }
   }
//   cerr << last <<endl;
   printf("20 %d\n",(int)edges.size());
   for ( auto x : edges )
    printf("%d %d %d\n",x.F.F,x.F.S,x.S);
return 0 ;
}


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

using namespace std;

int main()
{
    int check[3][3], bingo[3][3];
    for (int i=0;i<3;i++)
    {
        for (int j=0;j<3;j++)
        {
            cin>>bingo[i][j];
            check[i][j]=0;
        }
    }

    int n;
    cin>>n;
    for (int k=1;k<=n;k++)
    {
        int x;
        cin>>x;
        for (int i=0;i<3;i++)
        {
            for (int j=0;j<3;j++)
            {
                if (bingo[i][j]==x)
                    check[i][j] = 1;
            }
        }

        int t = 0;

        for (int i=0;i<3;i++)
        {
            int chk = 0;
            for (int j=0;j<3;j++)
            {
                if (check[i][j] == 1) chk++;
            }
            if (chk == 3) t=1;
        }

        for (int j=0;j<3;j++)
        {
            int chk = 0;
            for (int i=0;i<3;i++)
            {
                if (check[i][j] == 1) chk++;
            }
            if (chk == 3) t=1;
        }

        if ((check[0][0] == 1)&&(check[1][1] == 1)&&(check[2][2] == 1))
        {
            cout<<"Yes";
            return 0;
        }

        if ((check[2][0] == 1)&&(check[1][1] == 1)&&(check[0][2] == 1))
        {
            cout<<"Yes";
            return 0;
        }

        if (t==1)
        {
            cout<<"Yes";
            return 0;
        }
    }

    cout<<"No";
    return 0;
}


Measured memory_bytes: 256
import bisect,collections,copy,itertools,math,string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def main():
    n = I()
    a = LI()
    a.sort(reverse=True)
    ans = a[0]
    n -= 1
    for i in range(n-1):
        index = i//2 + 1
        ans += a[index]
    print(ans)
main()

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

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

int main(){
    ll n, x; cin >> n >> x;
    vector<ll> a(n); rep(i,n) cin >> a[i];
    sort(all(a));

    ll ans = abs(x-a[0]);
    rep(i,n-1){
        ans = gcd(ans,a[i+1]-a[i]);
    }

    cout << ans << endl;
}

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

long long N,K,Q,A[100010],B[100010];
using namespace std;

int main(){
  cin>>N>>K>>Q;
  for(int i=0;i<Q;i++){
    cin>>A[i];
  }
  for(int i=0;i<N;i++){
    B[i]=0;
  }
  for(int i=0;i<Q;i++){
    B[A[i]-1]=B[A[i]-1]+1;
  }
  for(int i=0;i<N;i++){
    if(K<=(Q-B[i])){
      cout<<"No"<<endl;
    }else{
      cout<<"Yes"<<endl;
    }
  }

 return 0;
}


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

int main()
{
    int N, M; cin >> N >> M;
    int a, b, c, d;
    a = 1;
    b = (M+1)/2*2;
    c = b + 1;
    d = c + M/2*2;
    for (int i = 0; i < (M+1)/2; i++) {
        cout << a << " " << b << endl;
        a++; b--;
    }
    for (int i = 0; i < M/2; i++) {
        cout << c << " " << d << endl;
        c++; d--;
    }
}


Measured memory_bytes: 3588
#include <stdio.h>

#define MOD 1000000007

int n;
char s[5001];

int dp[2][2501][5001];

int main() {
	scanf("%d%s", &n, s);
	
	int len = 0;
	while(s[len] != '\0') { len++; }
	
	dp[0][0][0] = 1;
	
	for(int i = 0; i < 2500; i++) {
	for(int j = 0; j < 5000; j++) {
	for(int k = 0; k <    2; k++) {
		if(i > j) { continue; }
		
		dp[k][i][j + 1] += dp[k][i][j];
		dp[k][i][j + 1] %= MOD;
		
		dp[k][i + 1][j] += (dp[k][i][j] * 2) % MOD;
		dp[k][i + 1][j] %= MOD;
		
		if(i == j) {
			if(k == 0) {
				dp[1][i][j] += dp[k][i][j];
				dp[1][i][j] %= MOD;
			} else {
				dp[0][i + 1][j + 1] += dp[k][i][j];
				dp[0][i + 1][j + 1] %= MOD;
			}
		}
	}
	}
	}
	
	int m = (n - len) % 2;
	int x = (n + len) / 2;
	int y = (n - len) / 2;
	
	printf("%d\n", dp[m][y][x]);
	
	return 0;
}


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

using namespace std;

struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}init;

typedef long long LL;
#define fin "\n"
template<typename T>void chmin(T &a,T b){a=min(a,b);}
template<typename T>void chmax(T &a,T b){a=max(a,b);}
template<typename T>
istream& operator>>(istream &is,vector<T> &v){
    for(auto &it:v)is>>it;
    return is;
}
#define NO "Impossible"
#define YES "Possible"
int main(){
    int N;cin>>N;
    vector<int> l(N,0);
    int l_max=0,l_min=N;
    for(int i=0;i<N;i++){
        int a;cin>>a;
        l[a]++;
        chmin(l_min,a);
        chmax(l_max,a);  
    }
    if(l_max==1){
        if(N==2)cout<<YES<<endl;
        else
        cout<<NO<<endl;
        return 0;
    }
    if(l_max%2==0){
        int bg=l_max/2;
        if(l_min<bg){cout<<NO<<endl;return 0;}
        if(l[bg]!=1){cout<<NO<<endl;return 0;}
        bg++;
        for(;bg<=l_max;bg++)if(l[bg]<2){cout<<NO<<endl;return 0;}
        {cout<<YES<<endl;return 0;}
    }
    else{
        int bg=(l_max+1)/2;
        if(l_min<bg){cout<<NO<<endl;return 0;}
        if(l[bg]!=2){cout<<NO<<endl;return 0;}
        bg++;
        for(;bg<=l_max;bg++)if(l[bg]<2){cout<<NO<<endl;return 0;}
        {cout<<YES<<endl;return 0;}
    }


    return 0;
}


Measured memory_bytes: 384
#include <stdlib.h>
#include <string.h>
#include <stdio.h>

unsigned long M = 1000000007;

int main(void){
	unsigned char* buffer = malloc(100010);
	fgets(buffer, 100010, stdin);
	
	unsigned int* q_list = malloc(sizeof(int) * 100000);
	unsigned int q_count = 0;
	unsigned int num = 0;
	unsigned int d = 1;
	
	unsigned int len = strlen(buffer);
	while(1){
		unsigned char c = buffer[len - 1];
		if((c >= '0' && c <= '9') || c == '?'){
			break;
		}
		len --;
	}
	for(int i = len - 1; i >= 0; i --){
		unsigned char c = buffer[i];
		if(c == '?'){
			q_list[q_count ++] = d;
		}else{
			num = (num + (c - '0') * d) % 13;
		}
		d = (d * 10) % 13;
	}
	free(buffer);
	
	unsigned long counts_buffer[2][13];
	unsigned int b = 0;
	unsigned long *counts = counts_buffer[b];
	for(int i = 0; i < 13; i ++){
		counts[i] = 0;
	}
	counts[0] = 1;
	
	for(int j = 0; j < q_count; j ++){
		unsigned int d = q_list[j];
		unsigned long *new_counts = counts_buffer[1 - b];
		for(int i = 0; i < 13; i ++){
			new_counts[i] = 0;
		}
		for(int n = 0; n < 10; n ++){
			unsigned int r = (d * n) % 13;
			for(int m = 0; m < 13; m ++){
				unsigned int k = (r + m) % 13;
				new_counts[k] = (new_counts[k] + counts[m]) % M;
			}
		}
		b = 1 - b;
		counts = counts_buffer[b];
	}
	printf("%ld\n", counts[(13 + 5 - num) % 13]);
	return 0;
}
/*

M = 10 ** 9 + 7
s = input().strip()

num = 0
q_list = []
d = 1
l = len(s)
for i in range(l - 1, -1, -1):
	c = s[i]
	if c != "?":
		num = (num + int(c) * d) % 13
	else:
		q_list.append(d)
	d = (d * 10) % 13

counts = [0] * 13
counts[0] = 1
for d in q_list:
	new_counts = [0] * 13
	for n in range(10):
		r = (d * n) % 13
		for m in range(13):
			k = (r + m) % 13
			new_counts[k] = (new_counts[k] + counts[m]) % M
	counts = new_counts
print(counts[(13 + 5 - num) % 13])
*/

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ll long long

ll w[101];
ll v[101];
ll n,W;

ll dp[101][100001];

ll knapsack(ll idx ,ll curr_weight){
	if(curr_weight< 0) return INT_MIN;
	if(idx==n)return 0;
	ll &ans = dp[idx][curr_weight];
	if(ans!=-1)return ans;
	ans = max(v[idx] + knapsack(idx+1 , curr_weight-w[idx]), knapsack(idx+1,curr_weight));
	return ans;
}

int main(){
	IOS;
	memset(dp,0,sizeof(dp));
	cin >> n >> W;
	for(int i=1 ;i <=n ; ++i){
		cin >> w[i] >> v[i];
	}
	//cout << knapsack(0,W) << endl;

	
	for(int i=1; i<= n ; ++i){
		for(int j = 0 ; j <= W ; ++j){
			dp[i][j] = dp[i-1][j];
			if(j-w[i]>=0){
				dp[i][j] = max(dp[i][j],v[i] + dp[i-1][j-w[i]]);
			}
		}
	}
	cout << dp[n][W] << endl;

}	

Measured memory_bytes: 79232
#!/mnt/c/Users/moiki/bash/env/bin/python
N = int(input())
# info = [ tuple(zip(tuple(map(int, input().split())), ("a","b","c"))) for i in range(N)]
info = [list(map(int, input().split())) for i in range(N)]
dp = [[0,0,0] for i in range(N+1)]
dp[1] = info[0]
for i in range(N):
    for j in range(3):
        for k in [x for x in range(3) if x != j]:
            if dp[i][k] + info[i][j] > dp[i+1][j]: # dp[i+1][j]?
                dp[i+1][j] = dp[i][k] + info[i][j]

# print(dp)
print(max(dp[N]))

Measured memory_bytes: 47328
#include <iostream>
#include <cstdlib>
#include <cstdio>
using namespace std;
inline int read()
{
	int f = 1, x = 0;
	char ch;

	do{
		ch = getchar();
		if (ch == '-')
			f = -1;
	}while(ch < '0' || ch > '9');
	do{
		x = x * 10 + ch - '0';
		ch = getchar();
	}while(ch >= '0' && ch <= '9');
	return f * x;
}
const int N = 600;
const int mod = 1e9 + 7;

int n, k;
int to[N + 1];
int f[N + 1][N + 1], g[N + 1];
int ans;

inline void dp()
{
	for (int i = 1; i <= n; i++) {
		for (int j = i + 1; j <= n; j += 2) {
			int sum1 = j - i + 1, sum2;
			bool flag = true;
			for (int k = i; k <= j; k++) {
				if (to[k]) {
					sum1--;
					if (to[k] < i || to[k] > j) {
						flag = false;
						break;
					}
				}
			}
			if (flag) {
				f[i][j] = g[sum1];
				sum2 = !to[j];
				for (int k = j - 1; k >= i; k--) {
					f[i][j] = (f[i][j] - 1ll * f[i][k] * g[sum2] + 1ll * mod) % mod;
					sum2 += !to[k];
				}
				ans = (ans + 1ll * f[i][j] * g[n - (k << 1) - sum1]) % mod;
			}
		}
	}
	return;
}
int main()
{
	n = read() << 1;
	k = read();
	for (int i = 1; i <= k; i++) {
		int x = read(), y = read();
		to[x] = y;
		to[y] = x;
	}
	g[0] = 1;
	for (int i = 2; i <= n; i += 2)
		g[i] = 1ll * g[i - 2] * (i - 1) % mod;

	dp();

	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 5160
/**
 *
 * Contest - Problem X: Nome (link)
 *
 * Abridge version.
 *
 * Solution: text
 */
#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using ii = pair<ll, ll>;

#define REP(i, a, b) for (int (i) = (a); (i) <= (b); (i)++)
#define REPN(i, N) for (int (i) = 0; (i) < N; (i)++)
#define DEC(i, b, a) for (int (i) = (b); (i) >= (a); (i)--)
#define DECN(i, N) for (int (i) = N - 1; (i) >= 0; (i)--)

#define LOG(var, sep) (cerr << #var << " = " << (var) << (sep))
#define LOGM(msg) (cerr << (msg))
#define LOGV(vec, sep) { cerr << #vec << " ="; for (const auto& v : (vec)) cerr << " " << v; cerr << (sep); }
#define LOGA(arr, N, sep) { cerr << #arr << " ="; for (int i = 0; i < N; ++i) cerr << " " << (arr)[i]; cerr << (sep); }
#define LOGA2(arr, N, M, sep) { cerr << #arr << " =\n"; for (int i = 0; i < N; ++i) { for (int j = 0; j < M; ++j) cerr << (arr)[i][j] << " "; cerr << endl; } cerr << (sep); }

ostream& operator<<(ostream& os, const ii& p)
{
    os << "(" << p.first << ", " << p.second << ")";
    return os;
}

const int MAX { 2010 };
const ll oo { 1LL << 62 };
const int MOD { 1000000007 };

string words[MAX];

void solve(ll N)
{
    auto c = words[0].back();
    set<string> S;

    S.insert(words[0]);

    REP(i, 1, N - 1)
    {
        if (S.count(words[i]) or words[i].front() != c)
        {
            cout << "No\n";
            return;
        }

        c = words[i].back();
        S.insert(words[i]);
    }

    cout << "Yes" << endl;
}

int main()
{
    ios::sync_with_stdio(false);

    ll N;
    cin >> N;

    REPN(i, N)
        cin >> words[i];

    solve(N);

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdlib>
#include<cstdio>
#include<cstring>
#include<iomanip>
#include<string>
#include<set>
#include<map>
#include<vector>
#include<queue>
#include<stack>
#include<utility>
#define PI acos(-1.0)
using namespace std;
int a[5];
int vis[5];
int main() {
	int n,m,s,c;
	cin >> n >> m;
	int flag = 1;
	while(m--) {
		cin >> s >> c;
		if(!vis[s-1]) {
			a[s-1] = c;
			vis[s-1] = 1;
		} else {
			if(c != a[s-1])
			flag = 0;
		}
	}
	for(int i = 0;i < n;i++){
		if(!vis[i]){
			if(n == 1){
				//只哟以为
				a[i] = 0; 
			}else{
				if(i == 0) a[i] = 1;
				else a[i] = 0;
			}
		}
		else{
			if(n != 1 && a[0] == 0){
				flag = 0;
				break;
			}
		}
	}
	if(flag)
	for(int i = 0;i < n;i++) cout << a[i];
	else cout << -1 << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include<algorithm>
#include<iomanip>
#include<queue>
#include<deque>
#include<map>
#include<bitset>
#include<math.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for(int i=m;i<(int)(n);i++)
typedef pair<int,long long> pint;
typedef long long ll;
const ll mod= 1e9+7;
const ll  longinf = 1LL<<60;
const int inf=1e9+7;
int dx[4]={1,0,-1,0}, dy[4]={0,1,0,-1};


int main(){
  int a,b;cin>>a>>b;
  if((a*b*(a+b))%3==0)cout<<"Possible"<<endl;
  else cout<<"Impossible"<<endl;
  return 0;
  }

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <iomanip>

using namespace std;


int main(){
   string S;
   cin >> S;
   int size = S.size();
   int ans=0;
   for(int i=0; i<size; i++){
      for(int j=i+1; j<=size; j++){
         int score =0;
         for(int k=i; k<j; k++){
            if(S[k]=='A'||S[k]=='C'||S[k]=='G'||S[k]=='T'){
               score+=1;
            }
            else{
               score=0;
               break;
            }
         }
         ans = max(ans,score);
      }
   }
   cout << ans << endl;

}


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

#define all(x)        (x).begin(),(x).end()
#define mp            make_pair
#define pb            push_back
#define fi            first
#define se            second
#define sz(x)         ((int)(x).size())
#define rep(x,y,z)    for(int x=y;x<z;x++)
#define per(x,z,y)    for(int x=z-1;x>=y;x--)
#define trav(y,x)     for(auto& y:x)
#define pii           pair<int,int>
#define vi            vector<int>

int dbg = 0;
#define cri           if(0)
#define shame         cri cerr<<(++dbg)<<"\n\n";

// aaaaaaaaaaaaaaaa
const int N = 2e5 + 1;
const int lg = 20;
const ll mod = 0xfffff;


void solve() {
  ll a, b, c;
  cin >> a >> b >> c;
  ll del = c - (a + b);
  if (del <= 0)
    cout << "No" << "\n";
  else {
    ll pd = 4 * a * b;
    del *= del;
    if (pd < del)
      cout << "Yes" << "\n";
    else
      cout << "No" << "\n";
  }
}

int main() {
  // freopen("input.in", "r", stdin);
  // freopen("input.out", "w", stdout);
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	// cout<<setprecision(15);
	// int t; cin>>t; while(t--)
	solve();
	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#define rep(i, n)   for(int i = 0; i < (n); ++i)
using namespace std;

int main(){
    string s;   cin >> s;
    if(s == "MON") cout << 6 << endl;
    if(s == "TUE") cout << 5 << endl;
    if(s == "WED") cout << 4 << endl;
    if(s == "THU") cout << 3 << endl;
    if(s == "FRI") cout << 2 << endl;
    if(s == "SAT") cout << 1 << endl;
    if(s == "SUN") cout << 7 << endl;
}


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

#define int long long
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define all(v) (v).begin(),(v).end()
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define pb push_back
#define fi first
#define se second
template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

int N,M;
vector<int>G[100000];

int col[100000];
pint dfs(int v,int c){
    pint ret(0,0);
    col[v]=c;
    if(c==1)ret.fi++;
    else ret.se++;
    for(auto u:G[v]){
        if(col[u]==c){
            return pint(-1001001001,0);
        }
        if(col[u]==-c)continue;
        pint p=dfs(u,-c);
        ret.fi+=p.fi;
        ret.se+=p.se;
    }
    return ret;
}

signed main(){
    scanf("%lld%lld",&N,&M);
    rep(i,M){
        int a,b;
        scanf("%lld %lld",&a,&b);
        a--;b--;
        G[a].pb(b);G[b].pb(a);
    }

    vector<pint>vec;
    rep(i,N)if(col[i]==0){
        pint p=dfs(i,1);
        if(p.fi<0){
            puts("-1");
            return 0;
        }
        vec.pb(p);
    }

    bitset<100000>bs;
    bs[0]=1;
    rep(i,vec.size()){
        bs=(bs<<vec[i].fi)|(bs<<vec[i].se);
    }

    int ma=0;
    rep(i,N)if(bs[i])chmax(ma,i*(N-i)-M);
    printf("%lld\n",ma);
    return 0;
}

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

int main()
{
    long n, s=0, m;
    cin>>n;
    m=n;
    while(n>0)
    {
        s+=(n%10);
        n/=10;
    }
    if(m%s==0)
    cout<<"Yes"<<endl;
    else
    cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;

#define MOD 1000000007

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> p(m);
  vector<string> s(m);
  for (int i = 0; i < m; ++i) {
    cin >> p[i] >> s[i];
    p[i]--;
  }
  int ac_cnt = 0;
  int wa_cnt = 0;
  vector<int> ac(n), wa(n);
  for (int i = 0; i < m; ++i) {
    if (s[i] == "WA") {
      if (ac[p[i]] == 0) wa[p[i]]++;
    } else {
      ac[p[i]]++;
    }
  }
  for (int i = 0; i < n; ++i) {
    if (0 < ac[i]) {
      ac_cnt++;
      wa_cnt += wa[i];
    }
  }
  cout << ac_cnt << " " << wa_cnt << endl;
  return 0;
}

Measured memory_bytes: 6912
/* Arunava Chakraborty [ @iArunava ] */

/* Kagami Mochi - AtCoder */

#include <bits/stdc++.h>

using namespace std;

int main() {
    int n = 0, di = 0, i = 0;
    set < int > s;

    scanf ("%d", &n);
    for (i = 0; i < n; ++i) {
        scanf ("%d", &di);
        s.insert(di);
    }

    printf ("%d\n", (int)s.size());
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
using namespace std;
int n;
int t[100050],x[100050],y[100050];
int dis,times;
bool flag;
int read()
{
	int s=0,t=1; char c;
	while (c<'0'||c>'9') {if (c=='-') t=-1; c=getchar();}
	while (c>='0'&&c<='9') {s=s*10+c-'0'; c=getchar();}
    return s*t;
}
int main()
{
	n=read(); flag=true;
	for (int i=1;i<=n;i++) 
	{
	  t[i]=read(),x[i]=read(),y[i]=read();
      dis=x[i]-x[i-1]+y[i]-y[i-1]; times=t[i]-t[i-1];
      if (times<dis) flag=false;
      else 
	  {
	  	times-=dis; 
	  	if (times%2!=0) flag=false;
      }
      if (not flag) break;
  }
  if (flag) puts("Yes");
  else puts("No");
  return 0;
}

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

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

	c = a % 2;
	d = b % 2;

	if (c * d == 0)
		cout << "Even" << endl;
	else {
		cout << "Odd" << endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define filename "slimes"
#define int long long
#define oo 1e18
#define N 405 

using namespace std ;

int n , a[N] ;
int f[N][N] ;
bool chk[N][N] ;

void open()
{
    //freopen(filename".inp","r",stdin) ;
    //freopen(filename".out","w",stdout) ;
    ios_base::sync_with_stdio(0) ;
    cin.tie(0) ;
    cout.tie(0) ;
}
void readin() 
{
    cin >> n ;
    for (int i =1 ; i <= n ; i++)
    {
        cin >> a[i] ;
        a[i] += a[i-1] ;
    }
}
int calc(int i , int j)
{
    if (chk[i][j]) return f[i][j] ;
    if(i==j) return 0 ;
    chk[i][j] = 1 ;
    int &ans = f[i][j] ;
    int res = a[j] - a[i-1] ;
    int Min = oo ;
    for(int x = i ; x < j ; x++)
    {
        Min = min(Min , calc(i , x) + calc(x+1 , j)) ;
    }
    return ans = res + Min;
}
signed main()
{
    open() ;
    readin() ;
    cout << calc(1 , n) ;
}

Measured memory_bytes: 5112
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll big=1e18;
const double PI=2*asin(1);

ll DP[55][55];

ll comb(int A, int B) {
  if(DP[A][B]>0) return DP[A][B];
  if(A<B) return 0;
  if(B==0) return DP[A][B] = 1;
  return DP[A][B] = comb(A-1, B-1) + comb(A-1, B);
}

int main() {
  ll N;
  double A, B;
  cin>>N>>A>>B;
  vector<double> arr(N);
  for(ll i=0;i<N;++i) cin>>arr[i];
  sort(arr.begin(), arr.end(), greater<ll>());
  if(arr[0]==arr[A-1]) {
    ll num = 0;
    double ans = 0;
    for(ll i=0;i<A;++i) {
      ans += arr[i];
    }
    for(ll i=0;i<N;++i) {
      if(arr[i]==arr[0]) num++;
    }
    ll ans1 = 0;
    for(ll i=A;i<=B;++i) {
      ans1 += comb(num, i);
    }
    cout<<setprecision(20)<<ans/A<<endl;
    cout<<ans1<<endl;
  }
  else {
    double ans = 0;
    ll num1 = 0, num2 = 0;
    for(ll i=0;i<A;++i) ans += arr[i];
    for(ll i=0;i<N;++i) {
      if(arr[i]==arr[A-1]) num1++;
      if(arr[i]==arr[A-1] && i<A) num2++;
    }
    cout<<setprecision(20)<<ans/A<<endl;
    cout<<comb(num1, num2)<<endl;
  }
}



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

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

int main() {
    string s;
    cin >> s;
    int n = s.size();

    lint res = 0;
    lint c = 0;

    rep(i, n) {
        char ch = s[i];

        if (ch == 'A') {
            c++;
        }
        else if (ch == 'B') {
            if (i+1 < n && s[i+1] == 'C') {
                res += c;
                i++;
            }
            else {
                c = 0;
            }
        }
        else {
            c = 0;
        }
    }

    cout << res << endl;
    return 0;
}

Measured memory_bytes: 640