akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String s = br.readLine();
		br.close();

		String key = "keyence";
		boolean flg = false;
		for (int i = 0; i <= 7; i++) {
			String a = key.substring(0, i);
			String b = key.substring(i, 7);
			if (s.startsWith(a) && s.endsWith(b)) {
				System.out.println("YES");
				flg = true;
				break;
			}
		}

		if (!flg) {
			System.out.println("NO");
		}
	}
}


Measured memory_bytes: 23124
N = int(input())
H = list(map(int, input().split()))
res = 'Yes'

for i in range(N - 2, -1, -1):
    if H[i] - H[i + 1] >= 2:
        res = 'No'
        break
    if H[i] - H[i + 1] == 1:
        H[i] -= 1

print(res)

Measured memory_bytes: 63984
#include <bits/stdc++.h>
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
 //Compiler version g++ 6.3.0

 int main()
 {
 	int n;
 	cin >> n;
 	float ans=0;
 	for (int i = 0; i < n; i++){
 		string x;
 		float y;
 		cin >> y>>x;
 		if(x=="BTC"){
 			ans+=y*380000;
 		}else{
 			ans+=y;
 		}
 	}
 	cout << ans << endl;
 }

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

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

using namespace std;

int main() {
	int s, tmp, last, i;
	vector<int> data;
	vector<int>::iterator itr;

	cin >> s;

	for (i = 1;; i++) {
		if (i == 1) {
			last = s;
			data.push_back(s);
		}
		if (last % 2 == 0) { //偶数
			tmp = last / 2;
		}
		else {	//奇数
			tmp = (3 * last) + 1;
		}
		itr = find(data.begin(), data.end(), tmp);

		if (itr != data.end()) {
			break;
		}

		last = tmp;
		data.push_back(tmp);
	}

	cout << i+1;

	return 0;
}

Measured memory_bytes: 256
from sys import stdin
def main():
    #入力
    readline=stdin.readline
    n=int(readline())
    a=[int(readline()) for _ in range(n)]

    s=set()
    for i in range(n):
        if a[i] in s:
            s.remove(a[i])
        else:
            s.add(a[i])

    print(len(s))
    
if __name__=="__main__":
    main()

Measured memory_bytes: 13204
#include <iostream>

using namespace std;

int main()
{
int alice_card , bob_card;
cin>>alice_card>>bob_card;
//inr arr[13]={1,13,12,11,10,9,8,7,6,5,4,3,2};
if(alice_card==bob_card){
    cout<<"Draw";
}else if(alice_card==1 &&alice_card!=bob_card ){
cout<<"Alice";
}else if (bob_card==1 &&alice_card!=bob_card ){
cout<<"Bob";
}else if(alice_card>bob_card){
cout<<"Alice";
}else{
cout<<"Bob";
}

    return 0;
}

Measured memory_bytes: 888
def solve():
    def beat(hp, memo):
        if hp in memo:
            return memo[hp]
        if hp == 1:
            return 1
        else:
            child_hp = hp // 2
            cnt = 1 + beat(child_hp, memo) + beat(child_hp, memo)
            memo[hp] = cnt
            return cnt

    H = int(input())
    print(beat(H, {}))

if __name__ == "__main__":
    solve()

Measured memory_bytes: 9092
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>

const int MOD = 1000000007, INF = 1111111111;
using namespace std;
using lint = long long;

template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
	for (int i = 0; i < (int)vec.size(); i++) {
		os << vec[i] << (i + 1 == vec.size() ? "" : " ");
	}
	return os;
}

#ifdef _DEBUG
template <class Head>
void dump(const char* str, Head &&h) { cerr << str << " = " << h << "\n"; };
template <class Head, class... Tail>
void dump(const char* str, Head &&h, Tail &&... t) {
	while (*str != ',') cerr << *str++; cerr << " = " << h << "\n";
	dump(str + 1, t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int A, B;
	cin >> A >> B;

	if (A + B >= 10) cout << "error" << "\n";
	else cout << A + B << "\n";

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
    vector<int> data(101);
    int n;
    while (cin >> n && n) {
        data[n] ++;
    }

    int maxn = *max_element(data.begin(), data.end());
    for (int i=0; i<101; ++i) {
        if (data[i] == maxn) {
            cout << i << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 1196
#include <bits/stdc++.h>
 
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pii;
typedef tuple<ll, ll, ll> ti;
ll mod=1E9+7;
 
#define REP(a,b,c) for(ll a=b;a<(c);a++)
#define PER(a,b,c) for(ll a=b;a>=(c);a--)

ll ii(){ ll x; cin >> x; return x; }
string is(){ string x; cin >> x; return x; }
ld id(){ ld x; cin >> x; return x; }
void oi(ll x){ cout << x; }
void od(ld x){ cout << fixed << setprecision(10) << x; }
void os(string x){ cout << x; }
void oe(){ cout << endl; }
void oie(ll x){ oi(x); oe(); }
void ode(ld x){ od(x); oe(); }
void ose(string x){ os(x); oe(); }

int main(){
    ll N=ii(),K=ii();
    vector<ll> A;
    REP(i,0,N){
       A.push_back(ii()-1); 
    }
    vector<ll> X(N,-1);
    ll c=0;
    while(K>0){
        if(K==0) break;
        X[c]=K;
        if(X[A[c]]>=0){
            K=K%(X[A[c]]-K+1);
            break;
        }
        c=A[c];
        K--;
    }
    REP(i,0,K){
        c=A[c];
    }
    oie(c+1);

    return 0;
}


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

int main()
{
    int a;
    string b,d;
    
    

    cin >> a >> b;

    if(a%2==1){
    d="No";
    }

    else{
        for(int i=0;i<(a/2);i++){
            if(b.at(i)!= b.at(i+(a/2))){
                d="No";
                break;  
            }
        }
    }
    

    if(d!="No"){
        d="Yes";
    }
cout<< d <<endl;

}

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

int main(void){
	int n;
	std::cin >> n;
	int endmax = 0;

	int* pn = new int[100000];
	memset(pn, 0, 100000 * sizeof(int));

	for(int i=0; i<n; i++){
		int beg, end;
		std::cin >> beg >> end;
		for(int i = beg; i <= end; i++) pn[i]++;
		if(end > endmax) endmax = end;
	}

	int mps = 1;
	for(int i=1; i<=endmax; i++){\
		if(pn[i]+1 >= i)mps = i;
	}

	std::cout << (mps-1) << '\n';
	return 0;
}

Measured memory_bytes: 3472
#include<stdio.h>
int main(){
  int n, d[50], i, k, sum = 0;
  scanf("%d", &n);
  for(i = 0; i < n; ++i) scanf("%d", &d[i]);
  for(i = 0; i < n - 1; ++i){
    for(k = i + 1; k < n; ++k){
      sum += d[i] * d[k];
    }
  }
  printf("%d\n", sum);
  return 0;
}

Measured memory_bytes: 128
#include <utility>
#include <iostream>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <vector>
#include <algorithm>
#define INTINF 2147483647
#define LLINF 9223372036854775807
#define MAX 100005
#define NIL -1
typedef long long ll;
using namespace std;

struct TreeNode { int parent, left_child, right_sibling; };
TreeNode T[MAX];
int n, D[MAX];


void initTree(){
  for (size_t i = 0; i < n; i++) {
    T[i].parent = T[i].left_child = T[i].right_sibling = NIL;
  }
}


void makeTree(){
  int id, deg, child_id, child;
  for (size_t i = 0; i < n; i++) {  //各idの子
    std::cin >> id >> deg;
    for (size_t j = 0; j < deg; j++) {
      std::cin >> child_id;
      if (j==0) T[id].left_child = child_id;  //初回はこれ,
      else T[child].right_sibling = child_id;  //2回目以降
      child = child_id;  //これで一番上の兄弟からたどる
      T[child].parent = id;
    }
  }
}


void recDepth(int id, int depth){
  D[id]=depth;
  if (T[id].right_sibling != NIL) {
    recDepth(T[id].right_sibling, depth);
  }
  if (T[id].left_child != NIL) {
    recDepth(T[id].left_child, depth+1);
  }
}

void printTreeNode(int id){
  printf("node %d: parent = %d, depth = %d, ",
                                  id, T[id].parent, D[id]);

  if (T[id].parent==NIL) {
    std::cout << "root, [";
  }else if(T[id].left_child==NIL){
    std::cout << "leaf, [";
  }else{
    std::cout << "internal node, [";
  }
  int leaf =  T[id].left_child;

  while (leaf!=NIL) {
    std::cout << leaf;
    leaf = T[leaf].right_sibling;
    if (leaf!=NIL) std::cout << ", ";
  }

  std::cout << "]" << '\n';
}


int main(int argc, char const *argv[]) {
  int root=0;
  cin >> n;

  initTree();
  makeTree();

  for (size_t i = 0; i < n; i++) {
    if (T[i].parent==NIL) root=i;
  }

  recDepth(root, 0);

  for (size_t i = 0; i < n; i++) {
    printTreeNode(i);
  }

  return 0;
}



Measured memory_bytes: 7780
import java.util.*;
import java.io.*;

public class Main {
    static class Reader {
        BufferedReader in;

        Reader() throws IOException {
            in = new BufferedReader(new InputStreamReader(System.in));
        }

        Reader(String name) throws IOException {
            in = new BufferedReader(new FileReader(name));
        }

        StringTokenizer tokin = new StringTokenizer("");

        String next() throws IOException {
            if (!tokin.hasMoreTokens()) {
                tokin = new StringTokenizer(in.readLine());
            }
            return tokin.nextToken();
        }

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

    }
    static class Writer {
        PrintWriter cout;

        Writer() throws IOException {
            cout = new PrintWriter(System.out);
        }

        Writer(String name) throws IOException {
            cout = new PrintWriter(new FileWriter(name));
        }

        StringBuilder out = new StringBuilder();

        void print(Object a) {
            out.append(a);
        }

        void println(Object a) {
            out.append(a + "\n");
        }

        void close() {
            cout.print(out.toString());
            cout.close();
        }
    }

    public static void main(String args[]) throws IOException {
        Reader in = new Reader();
        Writer out = new Writer();
        int a = in.nextInt();
        int b = in.nextInt();
        if(a % 2 == 0 || b % 2 == 0){
            out.println("No");
        } else {
            out.println("Yes");
        }
        out.close();
    }
}

Measured memory_bytes: 21460
# coding: utf-8
import sys

N = int(input())
Xi = list(map(int, input().split()))
Xi.sort()
min = Xi[0]
max = Xi[N-1]
tmp = 0
result = sys.maxsize
for i in range(min,max+1):
    for j in range(0,N):
        tmp += (Xi[j] - i)**2
    if tmp <= result:
        result = tmp
    tmp = 0

print(result)

Measured memory_bytes: 3064
a,b,m = map(int,input().split())
a_s = list(map(int,input().split()))
b_s = list(map(int,input().split()))
xyc = [list(map(int,input().split())) for _ in range(m)]

ans = min(a_s) + min(b_s)
for tmp in xyc:
    x,y,c = tmp
    ans = min(ans, a_s[x-1] + b_s[y-1] - c)

print(ans)

Measured memory_bytes: 82156
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
const int MAX=1e5+5;
const int INF=1e9;
int n,m;
int edge[20][20];
int total;
int cost[1<<16][16],dp[1<<16][16];//dp[s][x]记录达到某点集s,最后“末端”（继续连接其余点的唯一点）为x时余下权值和最大的边的情况
int inner[1<<16];//内部的边
int main()
{
    scanf("%d%d",&n,&m);
    for(int i=1;i<=m;i++)//读入数据
    {
        int x,y,price;
        scanf("%d%d%d",&x,&y,&price);
        --x;--y;
        edge[x][y]=edge[y][x]=price;
    }
    total=1<<n;
    for(int i=0;i<total;i++)//计算某点集内部所有边权值之和
        for(int a=0;a<n;a++)
            if(i&(1<<a))
                for(int b=0;b<a;b++)
                    if(i&(1<<b))
                        if(edge[a][b])
                            inner[i]+=edge[a][b];
    for(int i=0;i<total;i++)//计算某点集到点集外某点所有边的权值之和
        for(int a=0;a<n;a++)
            if(!(i&(1<<a)))
                for(int b=0;b<n;b++)
                    if((i&(1<<b))&&edge[a][b])
                        cost[i][a]+=edge[a][b];
    memset(dp,-1,sizeof(dp));
    dp[1][0]=0;//只有1个点的集合dp值显然为0
    for(int i=0;i<total;i++)
    {

        for(int a=0;a<n;a++)
        {
            if((i&(1<<a))&&dp[i][a]!=-1)
            {
                for(int b=0;b<n;b++)
                    if(!(i&(1<<b)))/*只加入一个点*/
                        if(edge[a][b])
                            dp[i|(1<<b)][b]=max(dp[i|(1<<b)][b],dp[i][a]+edge[a][b]);
                /*加入一个点集*/
                int left=total-1-i;
                for(int now=left;now!=0;now=(now-1)&left)//用此循环得到所有
                {
                    int num=inner[now]+cost[now][a];
                    dp[i|now][a]=max(dp[i|now][a],dp[i][a]+num);
                }
            }
        }
    }
    printf("%d\n",inner[total-1]-dp[total-1][n-1]);
    return 0;
}


Measured memory_bytes: 8320
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())

const int MAX_V = 202;
int V;//頂点数
vector<int> G[MAX_V];
int match[MAX_V];
bool used[MAX_V];

void add_edge(int u, int v) {
	G[u].push_back(v);
	G[v].push_back(u);
}
bool dfs(int v) {
	used[v] = true;
	for (int i = 0; i<G[v].size(); i++) {
		int u = G[v][i], w = match[u];
		if (w<0 || !used[w] && dfs(w)) {
			match[v] = u;
			match[u] = v;
			return true;
		}
	}
	return false;
}
int bipartite_matching() {
	int res = 0;
	memset(match, -1, sizeof(match));
	for (int v = 0; v<V; v++) {
		if (match[v]<0) {
			memset(used, 0, sizeof(used));
			if (dfs(v))res++;
		}
	}
	return res;
}

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

	int n;
	int a[100], b[100], c[100], d[100];

	cin >> n;
	V = n * 2;
	rep(i, n)cin >> a[i] >> b[i];
	rep(i, n)cin >> c[i] >> d[i];

	rep(i,n)rep(j,n) {
		if (a[i] < c[j] && b[i] < d[j]) {
			add_edge(i + 1, 100 + j + 1);
		}
	}
	cout << bipartite_matching() << endl;


	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
const int N=2e5+2;
using namespace std;
vector<int> adj[N];
int max1=0,opt[N];
void dfs(int x,int p){
	int j=0;
	for(int i=0;i<adj[x].size();i++){
		if(adj[x][i]!=p){
			dfs(adj[x][i],x);
			if(opt[adj[x][i]]+1>=opt[x]){
				j=opt[x];
				opt[x]=opt[adj[x][i]]+1;
			}
			else{
				if(opt[adj[x][i]]+1>j){
					j=opt[adj[x][i]]+1;
				}
			}
		}
	}
	max1=max(max1,j+opt[x]);
}
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n,i,j,k,l;
	cin>>n;
	for(i=1;i<n;i++){
		cin>>j>>k;
		adj[j].push_back(k);
		adj[k].push_back(j);
	}
	dfs(1,1);
	//cout<<max1<<endl;
	if(max1%3==1){
		cout<<"Second";
	}
	else{
		cout<<"First";
	}
}

Measured memory_bytes: 27008
// 標準入力から一行を読み取り、指定の型に変換する
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

// 標準入力から一行を読み取り、空白文字で分割し、各要素を指定の型に変換する関数
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}

use std::cmp::*;

fn main() {
    let n: usize = read();
    // 証言の配列
    let mut testimonies= vec![vec![]; n];
    for index in 0..n
    {
        // 各人の証言を入力
        let a_n: usize = read();
        for _ in 0..a_n
        {
            let testimony: Vec<u32> = read_vec();
            testimonies[index].push((testimony[0] - 1, testimony[1]));
        }
    }

    // 正直者の最大人数
    let mut honest_count_max: u32 = 0;
    // 証言の検証 bit全探索
    'outer: for bp in 0..1 << n
    {
        // 正直者である人物の証言を調べ、矛盾を確かめる.
        for index in 0..n
        {
            if bp >> index & 1 == 1
            {
                for t_index in 0..testimonies[index].len()
                {
                    // 矛盾の発見
                    if bp >> testimonies[index][t_index].0 & 1 != testimonies[index][t_index].1
                    {
                        continue 'outer;
                    }
                }
            }
        }

        // count_ones()はビット列中の'1'の数を返す
        honest_count_max = max(honest_count_max, bp.count_ones());
    }

    println!("{}", honest_count_max);
}


Measured memory_bytes: 4352
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
#include <bitset>

using namespace std;
#define int long long int
const int INF = 1001001001001001LL;
const int MOD = 1000000007;

int di[] = {-1, 0, 1, 0, -1, 1, 1, -1};
int dj[] = {0, 1, 0, -1, 1, 1, -1, -1};

template<typename T>
vector<T> bellman_ford(vector<vector<pair<int, T>>> g, int s, int hoge){

    int n = (int)g.size();
    // ここで怒られる場合は inf を自分で定義する
    const auto inf = numeric_limits<T>::max();
    vector<T> dist(n, inf);
    dist[s] = 0;
    for(int i = 0; i < hoge * (n - 1); i++){
        for(int u = 0; u < n; u++){
            for(auto &e : g[u]){
                if(dist[u] == inf) continue;
                dist[e.first] = min(dist[e.first], dist[u] + e.second);
            }
        }
    }

    for(int u = 0; u < n; u++){
        for(auto &e : g[u]){
            if(dist[u] == inf) continue;
            //if(dist[u] + e.second < dist[e.first]) return vector<T>();
        }
    }
    return dist;
}

signed main(){
  
  int n, m, p; cin >> n >> m >> p;
  vector<vector<pair<int, int>>> g(n);
  for(int i = 0; i < m; i++){
    int a, b, c; cin >> a >> b >> c;
    a--;
    b--;
    g[a].push_back({b, p - c});
  }
  
  

  auto dist1 = bellman_ford<int>(g, 0, 1);
  auto dist2 = bellman_ford<int>(g, 0, 2);
  if(dist1[n - 1] != dist2[n - 1]) cout << -1 << endl;
  else cout << max(0LL, -dist1[n - 1]) << endl;
  
  return 0;
}


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

using namespace std;

#define int long long

#define PB	push_back
#define ALL(x)	(x).begin(), (x).end()
#define ALLR(x)	(x).rbegin(), (x).rend()
#define MP	make_pair

#define debug(args...) { string _s = #args; replace(ALL(_s), ',', ' '); stringstream ss(_s); cerr << endl;_debug(ss, args); }
#define _rg auto it = next(v.begin()); it != v.end(); it++
#define _input ostream& operator <<(ostream& out

template<typename T, typename U>
_input, const pair<T, U>& p) {
	out << "(" << p.first << ", " << p.second << ")";
	return out;
}

#define cont(c) template<typename T> _input, const c<T>& v) { \
					if (v.empty()) return out; \
					out << "[" << *v.begin(); \
					for (_rg) out << ", " << *it; \
					out << "]"; return out; \
				}
				
#define cont2(c) template<typename T, typename U> _input, const c<T, U>& v) { \
					if (v.empty()) return out; \
					out << "[" << *v.begin(); \
					for (_rg) out << ", " << *it; \
					out << "]"; return out; \
				}

cont(vector) cont(set) cont(multiset) cont(queue) cont2(map)

template<typename T, size_t n, typename= enable_if_t<!is_same<T, char>::value>>
_input, const T(&v)[n]) {
	if (n == 0) return out;
	out << "[" << v[0];
	for (int i = 1; i < (int)n; i++) out << ", " << v[i];
	out  << "]"; return out;
}

template<typename T, typename... Ts>
void _debug(stringstream& ss, const T &arg) {
	string name; ss >> name;
	cerr << name << " = " << arg << endl;
}

template<typename T, typename... Ts>
void _debug(stringstream& ss, const T& arg, const Ts&... args) {
	string name; ss >> name; 
	cerr << name << " = " << arg << ", ";
	if (is_class<T>::value || is_array<T>::value) cerr << endl;
	_debug(ss, args...);
}

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

typedef pair<int, int> ii;
typedef pair<pair<int, int>, int> iii;
typedef vector<int> vi;
typedef vector<iii> viii;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef unsigned long long ull;

const int INF = LONG_LONG_MAX/2;
const int NINF = LONG_LONG_MIN/2;
const double PI = 3.141592653589793238;

int32_t main() {
	FAST_IO;
	
	int x, y;
	cin >> x >> y;
	
	// 4*a + 2*(x-a) = y
	// 2*a = y - 2*x

	if (y <= 4*x && y-2*x >= 0 && (y-2*x)%2 == 0) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
}
// g++ -Wall -Wextra -Wshadow -fsanitize=undefined -std=c++17


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

#define REP(i, n) for (ll (i) = 0 ; (i) < (ll)(n) ; ++(i))
#define REPN(i, m, n) for (ll (i) = m ; (i) < (ll)(n) ; ++(i))
#define REP_REV(i, n) for (ll (i) = (ll)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (ll (i) = (ll)(n) - 1 ; (i) >= m ; --(i))

#define INF 2e9
#define INF_LL 1LL<<60
#define ll long long

#define MAX_V 105

int main(){
    int x, y, z;
    cin >> x >> y >> z;
    swap(x, y);
    swap(x, z);
    cout << x << " " << y << " " << z << endl;


    return 0;
}


Measured memory_bytes: 764
#include <bits/stdc++.h>
#define ll long long
using namespace std;
//dp[i][j] represents score till now of the playing player
int main() {
    int n;
    cin >> n;
    ll A[n];
    for(ll &x : A) cin >> x;
    ll dp[n][n];
    memset(dp, 0, sizeof(dp));
    for(int l = n - 1; l >= 0; --l){
        for(int j = l; j < n; ++j){
            if(l == j){
                dp[l][j] = A[l];
                continue;
            }
            dp[l][j] = max(A[l] - dp[l + 1][j], A[j] - dp[l][j - 1]);
        }
    }
    cout << dp[0][n - 1] << endl;
    return 0;
}

Measured memory_bytes: 70528
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <queue>
#include <string>
#include <algorithm>
#include <cstdio>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <ctime>
#include <cmath>
#include <bits/stdc++.h>
#include <string.h>
#define inf 0x7fffffff
using namespace std;
struct P
{
    int x,y,z;

    bool operator<(const P &a)const{
       // if(y!=a.y)
       // return y>a.y;
       return x>a.x;
//        return z>a.z;
    }
};

vector<int> v;
int a,b,c,n,m,i,o[1<<26],k,d,e,dy[15]={0,0,-1,1,-1,1,-1,1},dx[15]={-1,1,0,0,1,1,-1,-1};
int l[201][115];
//long long x,y,z[10055];
P u[200];
int j[44];
//queue<int> q,q1;
//stack<int> s;
queue<int> q;
long long x,y=0,z[99];

//deque<int> d;
//'1'==49;
//'A'==65;
//'a'==97;
//unordered_map<int, int > p[100010];
set<int> s;
string r,r1;
//char r1[555],r2[555];

bool as(int a,int b)
{
     return a>b;

}

int f(int a)
{
    return a%10+a/10;
}

//2147483647
int main()
{
    cin>>r;
    for(int t=1;t<1<<26;t++) o[t]=987654321;
    for(int t=0;t<r.size();t++)
    {
        i^=(1<<(r[t]-'a'));
        for(int h='a';h<='z';h++)
        {
            o[i]=min(o[i],o[i^(1<<(h-1))]+1);
        }
    }
    if(i==0) puts("1");
    else printf("%d",o[i]);
}




Measured memory_bytes: 262660
package main

import "fmt"

const inf = 1e15

// Edge .
type Edge struct {
	to, cost int
}

func main() {
	var n, m int
	fmt.Scan(&n, &m)

	edges := make(map[int][]Edge)
	var a, b, c int
	for i := 0; i < m; i++ {
		fmt.Scan(&a, &b, &c)
		a, b = a-1, b-1
		e := Edge{to: b, cost: -c}
		edges[a] = append(edges[a], e)
	}

	d := make([]int, n)
	for k := range d {
		d[k] = inf
	}
	d[0] = 0

	loop := false
	for i := 0; i <= n*2; i++ {
		for v := 0; v < n; v++ {
			if d[v] == inf {
				continue
			}
			for _, e := range edges[v] {
				if d[v]+e.cost < d[e.to] {
					d[e.to] = d[v] + e.cost
					if e.to == n-1 && i == n*2 {
						loop = true
					}
				}
			}
		}
	}

	if loop {
		fmt.Println("inf")
	} else {
		fmt.Println(-d[n-1])
	}
}


Measured memory_bytes: 896
#include <stdio.h>
#include <math.h>
#define PI 3.1415926535L

int main(){
	int a, b, h, m;
	long double cs, cosab;
	scanf("%d %d %d %d\n", &a, &b, &h, &m);
	cs = a*a + b*b -2.0L*a*b*(cosl((2.0L*PI*(h+m/60.0L)/12.0L)-(2.0L*PI*m/60.0L)));
	printf("%.16Lf\n", sqrtl(cs));
	return 0;
}


Measured memory_bytes: 2576
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define endl "\n"
#define se second
#define ll long long
//priority_queue<int, vector<int>, greater<int> > pq;
const int N = 100030;
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
const ll mod =    1e9+7;
vector< int > v[N];
bool b[N];
int n,m;
void dfs(int curr)
{
	b[curr]=1;
	for(auto u :  v[curr])
	{
		if(!b[u]) dfs(u);
	}
}
int main()
{
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cin>>n>>m;
rep(i,0,m)
{
	int a,b,c;
	cin>>a>>b>>c;
	v[a].emplace_back(b);
	v[b].emplace_back(a);
	
}
int ans=0;
for(int i=1;i<=n;i++)
if(!b[i]) {ans++,dfs(i);}
rep(i,1,n+1)
{
	if(!b[i])
	ans++;
}
cout<<ans<<endl;

}







Measured memory_bytes: 8960
#include <iostream>
#include <vector>
#include <cassert>
#include <algorithm>
#include <functional>
#include <set>
#include <cmath>
#include <limits>
#include <iostream>
using namespace std;

int main(){
   int n,d;
   cin >> n >>d;
   vector<vector<int>> vec(n,vector<int>(d,0));
   for(int i=0;i<n;i++){
       for(int j=0;j<d;j++){
           int x;
           cin >> x;
           vec[i][j]=x;
       }
   }
   int count=0;
   for(int i=0;i<n-1;i++){
       for(int j=i+1;j<n;j++){
           int x=0;
           for(int k=0;k<d;k++){
               x += pow((vec[j][k]-vec[i][k]),2);
           }
           int y=sqrt(x);
           if(pow(y,2)==x){
               count++;
           }
       }
   }
   cout<<count<<endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <limits>
#include <numeric>
#include <vector>

#define rep(i, x, n) for(int i = x; i < n; i++)
using namespace std;
const long long INF = 1LL << 60;
bool compare_by_b(pair<int, long long> a, pair<int, long long> b) {
    if(a.second != b.second) {
        return a.second > b.second;
    } else {
        return a.first > b.first;
    }
}
int main() {
    int N, K;
    cin >> N >> K;
    int V[55];
    long long L[55];
    long long R[55];
    long long max = -INF;
    rep(i, 0, N) { cin >> V[i]; }
    rep(i, 0, N + 1) {

        if(K < i) {
            break;
        }
        rep(l, 0, i + 1) {
            vector<int> get;
            rep(a, 0, l) { get.push_back(V[a]); }
            rep(b, 0, i - l) { get.push_back(V[N - b-1]); }
            sort(get.begin(), get.end());
            int ret = 0;
            int sum = 0;
            rep(c, 0, get.size()) {
                sum += get[c];
                if(ret + i < K) {
                    if(get[c] < 0) {
                        sum -= get[c];
                        ret++;
                    }
                }
            }
            // cout << "i:" << i << ",l:s" << l << ",ret:" << ret << ",sum:" << sum
                //  << endl;
            if(max < sum) {
                max = sum;
            }
        }
    }
    cout << max << endl;
}

Measured memory_bytes: 256
A,B,C,X,Y=gets.chomp.split.map(&:to_i)

a1=A*X+B*Y

a2=[X,Y].max*2*C

a3_1= (X-[X,Y].min)*A>0 ? (X-[X,Y].min)*A : 0
a3_2= (Y-[X,Y].min)*B>0 ? (Y-[X,Y].min)*B : 0
a3=[X,Y].min*2*C + a3_1 + a3_2

puts [a1, a2, a3].min


Measured memory_bytes: 1788
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <map>
#include <queue>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>

using namespace std;

int main() {
    int n, k ;
    cin >> n >> k;
    double rate = .0;
    int coin = 1;
    int coin2 = 2;
    for (int i=n;i>=1;i--) {
        if (i >= k) {
            rate += 1.0;
        } else {
            for (;k>coin2*i;) {
                coin ++;
                coin2 <<= 1;
            }
            // cerr << "i=" << i << " coin2=" << coin2 << endl;
            rate += 1.0 / coin2; 
        }
    }
    cout << setiosflags(ios::fixed)
         << setprecision(13)
         << (rate / n) << endl;
    return 0;
}


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

using namespace std;

long long MOD=1000000007;

long long Pow(long long a, long long k)
{
    long long S=a, R=1, t=1;
    while (k > 0)
    {
        if (k % (2*t) != 0)
        {
            k -= t;
            R *= S;
            R %= MOD;
        }
        S *= S;
        S %= MOD;
        t *= 2;
    }
    return R;
}

int main()
{
    long long n, m, k, S=0, s, Sd, Su=0, D=1;
    cin >> n >> m >> k;
    for (int i = 0; i < n; i++)
    {
        for (int y = 0; y < m; y++)
        {
            S += i+y;
        }
    }
    s = S;
    for (int i = 0; i < n; i++)
    {
        if (i != 0)
        {
            s += i*m;
            s -= (n-i)*m;
        }
        Sd = s;
        for (int y = 0; y < m; y++)
        {
            if (y == 0)
            {
                Su += Sd;
                continue;
            }
            Sd += y*n;
            Sd -= (m-y)*n;
            Su += Sd;
        }
    }
    Su /= 2;
    Su %= MOD;
    for (int i = 0; i < k-2; i++)
    {
        Su *= (m*n-i-2);
        Su %= MOD;
    }
    for (int i = 1; i <= k-2; i++)
    {
        D *= i;
        D %= MOD;
    }
    Su *= Pow(D, MOD-2);
    Su %= MOD;
    cout << Su;
    return 0;
}


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

using namespace std;

int main(void) {
    int e, o;
    int even, odd;
    cin >> e >> o;
    
    if(e > 1){
        even = e * (e - 1) / 2;
    }
    if(o > 1){
        odd = o * (o - 1) / 2;
    }

    if(e <= 1){
        even = 0;
    }
    if(o <= 1){
        odd = 0;
    }

    cout << even + odd << endl;

    return 0;
}


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

using ll = int64_t;
using ii = pair<int, int>;

int main() {
	ios::sync_with_stdio(true);cin.tie(nullptr);
	int K, A, B; cin >> K >> A >> B;
	bool can = false;
	for (int i = A; i <= B; ++i) {
		can |= (i % K == 0);
	}

	cout << (can ? "OK" : "NG");
}

 


Measured memory_bytes: 3620
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner in = new Scanner(System.in);

		/*int num1 = in.nextInt();
		int num2 = in.nextInt();
		int num3 = in.nextInt();
		int num4 = in.nextInt();
		int num5 = in.nextInt();
		int num6 = in.nextInt();*/
		int[] dice_number = new int[6];


		for(int side_number = 0; side_number < 6; side_number++) {

			dice_number[side_number] = in.nextInt();

		}

		dice dice = new dice(dice_number);

		String roll = in.next();

		for(int roll_count = 0; roll_count < roll.length(); roll_count++) {

			switch(roll.charAt(roll_count)) {

				case 'S':

					dice_number = dice.roll_s(dice_number);

					break;
				case 'N':

					dice_number = dice.roll_n(dice_number);

					break;
				case 'W':

					dice_number = dice.roll_w(dice_number);

					break;
				case 'E':

					dice_number = dice.roll_e(dice_number);

					break;
			}
	}

		System.out.println(dice_number[0]);

	}
}


class dice{

	/*int num1 = 0;
	int num2 = 0;
	int num3 = 0;
	int num4 = 0;
	int num5 = 0;
	int num6 = 0;*/
	int[] dice_number = new int[6];

	dice(int[] dice_number){

		this.dice_number = dice_number;

	}

	int[] roll_s(int[] dice_number){

		int[] change_number = new int[6];

		change_number[0] = dice_number[4];
		change_number[1] = dice_number[0];
		change_number[2] = dice_number[2];
		change_number[3] = dice_number[3];
		change_number[4] = dice_number[5];
		change_number[5] = dice_number[1];

		return change_number;

	}

	int[] roll_n(int[] dice_number){

		int[] change_number = new int[6];;

		change_number[0] = dice_number[1];
		change_number[1] = dice_number[5];
		change_number[2] = dice_number[2];
		change_number[3] = dice_number[3];
		change_number[4] = dice_number[0];
		change_number[5] = dice_number[4];

		return change_number;

	}

	int[] roll_w(int[] dice_number){

		int[] change_number = new int[6];;

		change_number[0] = dice_number[2];
		change_number[1] = dice_number[1];
		change_number[2] = dice_number[5];
		change_number[3] = dice_number[0];
		change_number[4] = dice_number[4];
		change_number[5] = dice_number[3];

		return change_number;

	}

	int[] roll_e(int[] dice_number){

		int[] change_number = new int[6];;

		change_number[0] = dice_number[3];
		change_number[1] = dice_number[1];
		change_number[2] = dice_number[0];
		change_number[3] = dice_number[5];
		change_number[4] = dice_number[4];
		change_number[5] = dice_number[2];

		return change_number;

	}

}

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

using namespace std;

int main()
{
  int par[] = {-1, 1, 2, 1, 4, 1, 4, 1, 1, 4, 1, 4, 1};
  int x, y;
  cin >> x >> y;

  if (par[x] == par[y]) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 256
use proconio::{fastout, input};
use proconio::marker::Chars;

#[fastout]
fn main() {
    input! {
        s: Chars,
        t: Chars,
    }

    let n = s.len();
    let m = t.len();
    let mut ans = std::i64::MAX;
    for i in 0..n {
        if i + m > n {
            break;
        }

        let mut cnt = 0i64;
        for j in 0..m {
            if s[i + j] != t[j] {
                cnt += 1;
            }
        }
        ans = std::cmp::min(ans, cnt);
    }

    println!("{}", ans);
}


Measured memory_bytes: 2152
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <sstream>
using namespace std;

int INF = 100000000;

int main() {
	int M, D;

	cin >> M >> D;

	int d01, d10;
	string MM, DD;
	
	int count = 0;
	
	for(int i = 1; i <= M; i++){
		for(int j = 22; j <= D; j++){
			DD = to_string(j);
			d01 = (int)(DD[1] - '0');
			d10 = (int)(DD[0] - '0');
			
			if(d01 >= 2 && d10 >= 2){
				if(i == d01*d10) {
					count++;
				}
			}			
		}	
	}
	
	cout << count << endl;
	


	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define trace(it,mp) for(auto it = (mp).begin(); it != (mp).end(); it++)
#define fr(i,n) for(ll i=0;i<n;i++)
#define mod 1000000000
using namespace std;

// covert number to string to_string(x);
ll h(ll a[][3],ll n)
{
	ll dp[n][3];

	for(ll i=0;i<3;i++)
		dp[n-1][i]=a[n-1][i];

	for(ll i=n-2;i>=0;i--)
	{
		dp[i][0]=a[i][0]+max(dp[i+1][1],dp[i+1][2]);
		dp[i][1]=a[i][1]+max(dp[i+1][0],dp[i+1][2]);
		dp[i][2]=a[i][2]+max(dp[i+1][0],dp[i+1][1]);
	}

	return max({dp[0][0],dp[0][1],dp[0][2]});
}


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

    ll t,a,b,c,x,y,z,n,m,k,ans;
    cin >> n;

    ll arr[n][3];

    fr(i,n){
    	cin >> arr[i][0] >> arr[i][1] >> arr[i][2];
    }

    cout << h(arr,n);

    cerr<< '\n' << "Time elapsed :" << clock() * 1000.0 / CLOCKS_PER_SEC << " ms\n" ;
}

Measured memory_bytes: 8400
#include <iostream>
#include<algorithm>
#include <string>
#include<vector>

using namespace std;

int main()
{
	int A, B, M;
	cin >> A >> B >> M;

	vector<int> a(A), b(B);

	for (int i = 0; i < A; i++) {
		cin >> a[i];
	}
	for (int i = 0; i < B; i++) {
		cin >> b[i];
	}
	int minA = *min_element(a.begin(), a.end());
	int minB = *min_element(b.begin(), b.end());
	int ans = minA + minB;
	
	for (int i = 0; i < M; i++) {
		int x, y, c;
		cin >> x >> y >> c;
		x--;
		y--;
		ans = min(ans, a[x] + b[y] - c);
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int i,cou=0,index,n;
    string s;
    cin>>s;
    n=s.length();
    if(s[i]!='A')
    {
        cout<<"WA";
        return 0;
    }
    for(i=2;i<n-1;i++)
    {
        if(s[i]=='C')
        {
            cou++;
            index=i;
        }
    }
    if(cou!=1)
    {
        cout<<"WA";
        return 0;
    }
    for(i=1;i<n;i++)
    {
        if(i!=index)
        {
            if(!islower(s[i]))
            {
                cout<<"WA";
                return 0;
            }
        }
    }
    cout<<"AC";
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
//using namespace std;
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define rep(i,j,n) for(ll i=(ll)(j);i<(ll)(n);i++)
#define REP(i,j,n) for(ll i=(ll)(j);i<=(ll)(n);i++)
#define per(i,j,n) for(ll i=(ll)(j);(ll)(n)<=i;i--)
#define ll long long
#define ALL(a) (a).begin(),(a).end()
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(ll)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(ll)(key)))
#define pb emplace_back
#define mp std::make_pair
//
#define endl "\n"
//using std::endl;
using std::cin;
using std::cout;
using std::vector;
using std::string;
using std::upper_bound;
using std::lower_bound;
using vi=vector<ll>;
using vii=vector<vi>;
using pii=std::pair<ll,ll>;
//
constexpr ll MOD=1e9+7;
//constexpr ll MOD=998244353;
//constexpr ll MOD=10000000;
//constexpr ll MOD=1e5;
constexpr ll MAX=1e7;
constexpr ll INF=(1ll<<62);
template<class T>
class prique :public std::priority_queue<T, std::vector<T>, std::greater<T>> {};
const ll N=26;
ll solve(ll D,vii &A,vi &C,vi &S){
    vi last(N,-1);
    ll a=0;
    rep(i,0,D){
        ll memo; memo=S[i];
        ll X=i-last[memo]-1;
        a-=X*(X+1)/2*C[memo];
        last[memo]=i;
        a+=A[i][memo];
    }
    rep(i,0,N){
        ll X=D-last[i]-1;
        a-=X*(X+1)/2*C[i];
    }
    return a;
}
int main(){
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    srand((unsigned)time(NULL));
    ll D; cin>>D;
    rep(i,0,100) rand();
    vi C(N);
    rep(i,0,N) cin>>C[i];
    vii A(D,vi(N));
    rep(i,0,D){
        rep(j,0,N) cin>>A[i][j];
    }
    vi last(N,-1);
    vi ans(D);
    rep(i,0,D){
        ll max=0,memo=0;
        rep(j,0,N){
            if(max<A[i][j]+(i-last[j])*C[j]){
                max=A[i][j]+(i-last[j])*C[j];
                memo=j;
            }
        }
        last[memo]=i;
        ans[i]=memo;
    }
    ll max=solve(D,A,C,ans);
    ll cnt=0;
    while(cnt<=1200000000){
        ll X=rand()%D,Y=rand()%N;
        ll old=ans[X];
        ans[X]=Y;
        ll sum=solve(D,A,C,ans);
        if(max+100<sum){
            max=sum;
        }
        else{
            ans[X]=old;
        }
        cnt+=D+N;
    }
    rep(i,0,D) cout<<ans[i]+1<<endl;
}


Measured memory_bytes: 3752
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef pair<ll, ll> pll;
typedef vector<ll> vl;
#define inf 1000000000
#define mod 1000000007
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define rep1(i, a, b) for(int i =a; i >=b; i--)
#define f first
#define ss second
#define pb push_back
//#define mp make_pair

ll a[4];


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

//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);
int k;
cin >> a[0] >> a[1] >> a[2] >> k;
sort(a, a+3);
ll ans = a[2];
rep(i, 1, k){
ans = 1LL*ans*2;

}

cout << a[1] + a[0] + ans << endl;

return 0;}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <queue>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <bitset>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);++i)
#define all(i,n) (i),(i+n)

int dx4[4]={1,0,-1,0};
int dy4[4]={0,-1,0,1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};

typedef pair<int, int> P;
typedef pair<string, int> SP;
typedef long long ll;

const int INF = 1e9;
const int MAX_V = 1e6+1;
const ll mod = 1000000007;

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

int i;

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

  cin >> i;

  if(i % 2) cout <<  (i / 2 + 1) * (i / 2) << endl;
  else cout << (i / 2) * (i / 2) << endl;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    # YY は 00から99
    # MM は 01から12
    S=input()
    u=int(S)//100
    d=int(S[2:])
    if(1<=u<=12 and 1<=d<=12):
        print('AMBIGUOUS')
    elif(1<=u<=12 and (d==0 or d>12)):
        print('MMYY')
    elif((not 1<=u<=12) and 1<=d<=12):
        print('YYMM')
    else:
        print('NA')
resolve()

Measured memory_bytes: 38256
import bisect
import cmath
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353

*A, K = [int(sys.stdin.buffer.readline()) for _ in range(6)]
ok = A[-1] - A[0] <= K
if ok:
    print('Yay!')
else:
    print(':(')



Measured memory_bytes: 13660
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#define REP(i, m, n) for(int i=int(m);i<int(n);i++)
#define EACH(i, c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s, e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

//#define LOCAL 1
#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR
#endif


//改造
typedef long long int ll;
using namespace std;


//ここから編集する


int main() {
    int H, W;
    cin >> H >> W;
    vector<int> ch(26, 0);
    REP(i, 0, H * W) {
        char tmp;
        cin >> tmp;
        ch[tmp - 'a']++;
    }

    int kagami = ((H / 2) * (W / 2)) * 4;
    int kyokai = H * W - kagami;

    int cnt_kagami = 0;
    REP(i,0,26){
        while(ch[i] >= 4 && cnt_kagami < kagami){
            ch[i] -= 4;
            cnt_kagami += 4;
        }
    }
    int cnt_kyokai = 0;
    REP(i,0,26){
        while(ch[i] >= 2 && cnt_kyokai < kyokai){
            ch[i] -= 2;
            cnt_kyokai += 2;
        }
    }

    if(cnt_kagami == kagami && kyokai - cnt_kyokai <= 1){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

    return 0;
}


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

int main(){
    long long pre = 100;
    long long x;
    cin >> x;
    int ans = 0;
    while(pre < x){
        pre = pre * 1.01;
        ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3632
// Template
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <functional>
#include <numeric>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>

using namespace std;
typedef long long ll;

#define REP(i, n) for(int i = 0;i < n;i++)
#define INF 1 << 30


int main(){
    std::ios_base::sync_with_stdio(false);
    int N,H,W; cin >> N >> H >> W;

    cout << (N-H+1)*(N-W+1) << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>

int main() {
  unsigned int row_num, col_num;
  std::cin >> row_num >> col_num;
  unsigned int h, w;
  std::cin >> h >> w;

  std::cout << row_num * col_num - (h * col_num + w * row_num - h * w) << std::endl;

  return 0;
}


Measured memory_bytes: 256
if __name__ == "__main__":
    n, a, b = map(int, input().split())
    s = input()

    kaigainum = 0
    totalnum = 0
    for i in range(n):
        if s[i] == 'a':
            if totalnum < a + b:
                print('Yes')
                totalnum += 1
            else:
                print('No')
        elif s[i] == 'b':
            if totalnum < a + b and kaigainum < b:
                print('Yes')
                totalnum += 1
                kaigainum += 1
            else:
                print('No')
        else:
            print('No')


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

#define ll long long
#define ld long double

#define rep(i,a,b) for(ll i=a;i<b;i++)
#define repb(i,a,b) for(ll i=a;i>=b;i--)
#define repA(i,A)   for(auto i:A)

#define err() cout<<"=================================="<<endl;
#define errA(A) for(auto i:A)   cout<<i<<" ";cout<<endl;
#define err1(a) cout<<#a<<" "<<a<<endl
#define err2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl
#define err3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl
#define err4(a,b,c,d) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<" "<<#d<<" "<<d<<endl

#define mp make_pair
#define pb push_back
#define all(A)  A.begin(),A.end()
#define allr(A)	A.rbegin(),A.rend()
#define ft first
#define sd second

#define pll pair<ll,ll>
#define V vector<ll>
#define S set<ll>
#define VV vector<V> 
#define Vpll vector<pll>

#define endl "\n"

const ll logN = 20;
const ll M = 1000000007;
const ll INF = 1e12;
#define PI 3.14159265

const ll N = 100005;

int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    ll n;
    cin>>n;
    cout<<n*n*n<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <numeric>
#include <cstdio>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
using namespace std;
#define MOD 1000000007
#define endl "\n" 
#define rep(i,n) for(int i = 0; i < (n); ++i)
typedef long long ll;


int main(void) {
    cin.tie(0);
    ios::sync_with_stdio(false);
  
    ll h, w; cin >> h >> w;
    ll hw = h*w;
    ll ans = 0;
    if(hw % 2 == 0) ans = hw / 2;
    else ans = (hw+1) / 2;

    if(h == 1 || w == 1) ans = 1;

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const ll mod = 1000000007;
//const ll mod = 998244353;
const int inf = 1e9 + 10;
const ll INF = 1e18;
const ld EPS = 1e-10;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

vector<int> G[200200];
vector<int> d(200200, -1);

void dfs(int v = 0, int p = -1) {
  for (int u: G[v]) {
    if (u == p) continue;
    d[u] = d[v] + 1;
    dfs(u, v);
  }
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(25);

  int n;
  cin >> n;
  rep(i, n - 1) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }

  d[0] = 0;
  dfs();
  int idx = 0, res = 0;
  rep(i, n) {
    if (chmax(res, d[i])) {
      idx = i;
    }
  }
  rep(i, n) d[i] = -1;
  d[idx] = 0;
  dfs(idx);
  res = 0;
  rep(i, n) {
    chmax(res, d[i]);
  }
  cout << (res % 3 != 1 ? "First" : "Second") << '\n';




  
  return 0;
}

Measured memory_bytes: 21376