akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
import java.io.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        FastScanner sc = new FastScanner(System.in);
        char c = sc.next().charAt(0);
        System.out.println(c - 'a' >= 0 ? 'a' : 'A');
    }
}

class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;
    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }
    
    public void close() throws Exception{
        this.reader.close();
        return;
    }

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

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken("\n");
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

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

    public double nextDouble() {
         return Double.parseDouble(next());
    }

    public int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = nextInt();
        return a;
    }

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++)
            a[i] = nextLong();
        return a;
    } 
}

Measured memory_bytes: 25312
use std::io;
use std::cmp::Ordering;
use std::str::FromStr;

fn get_line() -> String {
    let mut line = String::new();
    io::stdin().read_line(&mut line).ok();
    line
}

fn get_vector() -> Vec<i32> {
    let line = get_line();
    let vec : Vec<i32> = line.split_whitespace().map(|x| i32::from_str(x).unwrap()).collect();
    return vec;
}

fn main() {
    let vec = get_vector();
    let (W, H, x, y, r) = (vec[0], vec[1], vec[2], vec[3], vec[4]);
    let ans = if (r <= x && r <= y) && (x + r <= W && y + r <= H) { "Yes" } else { "No" };
    println!("{}", ans);
}



Measured memory_bytes: 5024
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using static System.Math;
 
public class Hello{
    public static void Main(){
        string[] input = ReadLine().Split(' ');
        int n = int.Parse(input[0]);
        int m = int.Parse(input[1]);
        int b = int.Parse(input[2]);
//        string temp = ReadLine();
//        int a = int.Parse(ReadLine());
//        int b = int.Parse(ReadLine());
//        string a = ReadLine();
//        string b = ReadLine();
        WriteLine(Min(n*m,b));
    }
}

Measured memory_bytes: 11092
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <numeric>

using namespace std;

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

int main(){
    vector<int> nums(3);
    cin >> nums[0] >> nums[1] >> nums[2];

    cout << *max_element(nums.begin(), nums.end()) - *min_element(nums.begin(), nums.end()) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int n,k; cin >> n >> k;
    vector<int> p(n);
    for (int i = 0; i < n; i++)
    {
        cin >> p[i];
    }
    sort(p.begin(),p.end());
    int ans = 0;
    for (int i = 0; i < k; i++)
    {
        ans = ans + p[i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 3564
N, M = map(int, input().split())
A = list(map(int, input().split()))
K = [1] * N
L = list(zip(K,A))
for i in range(M):
	L.append(list(map(int, input().split())))
S = sorted(L, key = lambda x:x[1], reverse = True)
sum = 0
cnt = 0
for i in range(N):
	if N - cnt <= S[i][0]:
		sum += S[i][1] * (N - cnt)
		break
	else:
		sum += S[i][1] * S[i][0]
		cnt += S[i][0]
print(sum)

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

using namespace std;

using int64 = long long;

bool Solve() {
  string s;
  cin >> s;
  map<char, int> m;
  for (char c : s) m[c] = 1;
  if (m['N'] > 0 && m['S'] == 0) return false;
  if (m['S'] > 0 && m['N'] == 0) return false;
  if (m['E'] > 0 && m['W'] == 0) return false;
  if (m['W'] > 0 && m['E'] == 0) return false;
  return true;
}

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

  if (Solve()) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

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

using namespace std;

int main() {

	int n, m;
	cin >> n >> m;
	vector < vector<int>> G(n + 1);

	//グラフ隣接リスト読み込み
	int a, c;
	for (int i = 1; i <= m; i++) {
		cin >> a >> c;
		G[a].push_back(c);
		G[c].push_back(a);
	}

	//幅優先探索処理
	vector<bool> seen(n + 1, false);	//発見したらtrue
	deque<int> todo;					//行く所のスタック

	int s = 1;							//今いる場所

	bool brkflg;
	vector<long> color(n + 1);
	int colornum = 0;
	for (int j = 0; j < n; j++) {		//全ての頂点を調べる

		if (color[j] == 0) {
			colornum++;
			color[j] = colornum;
			brkflg = false;
			todo.clear();

			//for (int k = 0; k <= n; k++) {
			//	seen[k] = false;//一旦全クリア
			//}

			if (seen[j] == false) {			//訪れてなかったら処理すすめる
				seen[j] = true;
				todo.push_back(j);

				while (todo.empty() != true) {				//キューが空になるまで処理	
					s = todo.front();						//処理番号を指定
					int tugiflg = false;					//次があったらtrueにするフラグ
					for (int i = 0; i < G[s].size(); i++) {

						if (seen[G[s][i]] != true) {
							seen[G[s][i]] = true;
							color[G[s][i]] = colornum;
							todo.push_back(G[s][i]);
							tugiflg = true;
						}
					}
					todo.pop_front(); //次を全部探したので削除する
				}
			}
		}
	}

	int in1, in2;
	cin >> m;
	for (int i = 0; i <m; i++) {
		cin >> in1 >> in2;
		if (color[in1] == color[in2]) {
			cout << "yes" << endl;
		}
		else {
			cout << "no" << endl;
		}
	}

	return 0;

}


Measured memory_bytes: 9212
#include <iostream>
#include <cstdio>
#include <atcoder/all>
#define rep(i,n) for(int i = 0; i < n; ++i)
#define rep1(i,n) for(int i = 1; i <= n; ++i)
#define rep2(i,s,t) for(int i = s; i <= t; ++i)
#define rev(i,n) for(int i = n-1; i >= 0; --i)
#define rev1(i,n) for(int i = n; i > 0; --i)
#define rev2(i,s,t) for(int i = s; i >= t; --i)
#define F first
#define S second
using namespace std;
using namespace atcoder;
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; }
using ll = long long;
using pi = pair<int,int>;
using vi = vector<int>;
using vii = vector<vi>;
int main()
{
  int n,q; scanf("%d %d", &n, &q);

  fenwick_tree<ll> fw(n);
  rep(i,n) {
    ll a; scanf("%lld", &a);
    fw.add(i, a);
  }

  rep(i,q) {
    int t; scanf("%d", &t);
    if(t == 0) {
      ll p, x; scanf("%lld %lld", &p, &x);
      fw.add(p, x);
    }
    else {
      int l, r; cin >> l >> r;
      printf("%lld\n", fw.sum(l, r));
    }
  }
  return 0;
}


Measured memory_bytes: 8252
extern crate proconio;
use proconio::input;

fn main() {
    input! {
        n: f64,
        m: f64,
        d: i64,
    }
    println!(
        "{}",
        if d == 0 {
            1.0 / n * (m - 1.0)
        } else {
            (n - (d as f64)) * 2.0 / n / n * (m - 1.0)
        }
    );
}


Measured memory_bytes: 2212
import sys
def input(): return sys.stdin.readline().rstrip()


from collections import deque
h, w = map(int, input().split())
a, b = map(int, input().split())
c, d = map(int, input().split())
a -= 1
b -= 1
c -= 1
d -= 1
s = [list(input()) for i in range(h)]
now = 0
dd = [(-1, 0), (1, 0), (0, 1), (0, -1)]

for i in range(h):
    for j in range(w):
        if s[i][j] == ".":
            de = deque([(i, j)])
            s[i][j] = now
            while de:
                x, y = de.popleft()
                for p, q in dd:
                    if 0 <= x + p < h and 0 <= y + q < w and s[x + p][y + q] == ".":
                        s[x + p][y + q] = now
                        de.append((x + p, y + q))
            now += 1
st = s[a][b]
en = s[c][d]
es = [set() for i in range(now)]
for i in range(h):
    for j in range(w):
        if s[i][j] != "#":
            for p in range(-2, 3):
                for q in range(-2, 3):
                    if 0 <= i + p < h and 0 <= j + q < w and s[i + p][j + q] != "#":
                        es[s[i][j]].add(s[i + p][j + q])
                        es[s[i + p][j + q]].add(s[i][j])
from heapq import heappush, heapify, heappop


def dijkstra(s):
    INF = 1 << 32
    d = [INF] * now  # 頂点sからの最短距離
    v = -1
    que = [(0, s)]
    heapify(que)
    d[s] = 0
    while que:
        p = heappop(que)
        v = p[1]
        if d[v] < p[0]:
            continue
        for e in es[v]:
            if d[e] > d[v] + 1:
                d[e] = d[v] + 1
                heappush(que, (d[e], e))
    return d[en] if d[en] < INF else -1


print(dijkstra(st))


Measured memory_bytes: 187412
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;
int n,k;
int memo[100105];
int arr[100105];
int main(){
    scanf("%d%d",&n,&k);
    memset(memo,127,sizeof(memo));
    memo[0]=0;
    for (int x=0;x<n;x++){
        scanf("%d",&arr[x]);
    }
    for (int x=0;x<n;x++){
        for (int y=1;y<=k;y++) memo[x+y]=min(memo[x+y],memo[x]+abs(arr[x]-arr[x+y]));
    }
    printf("%d\n",memo[n-1]);
}


Measured memory_bytes: 896
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

n,q = li()
s = lc()

cnt = [0]*(n)

for i in range(1,n):
    if s[i-1] == "A" and s[i] == "C":
        cnt[i] = cnt[i-1] + 1
    else:
        cnt[i] = cnt[i-1]
        
for _ in range(q):
    l,r = li_()
    print(cnt[r]-cnt[l])
    

Measured memory_bytes: 7056
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
#include <array>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <queue>
#include <bitset>
#include <tuple>
#include <cmath>
#include <complex>
#include <algorithm>
#include <utility>
#include <regex>
#include <cstdint>
#include <numeric>
#include <functional>
#include <cassert>

using namespace std;
using ll = int64_t;
using ull = uint64_t;

constexpr ll INF = numeric_limits<ll>::max() / 4;
namespace utils{
    template<class T, class Compare> using p_queue = priority_queue<T, vector<T>, Compare>;
    template<class T> using min_queue = p_queue<T, greater<T>>;
    template<class T> using max_queue = p_queue<T, less<T>>;

    template<class T> bool min_update(T& X, const T& A){ if(X > A) {X = A; return true;} return false; }
    template<class T> bool max_update(T& X, const T& A){ if(X < A) {X = A; return true;} return false; }
    using V_Set = unordered_set<int>;
    using E_Set = unordered_map<int, V_Set>;

#define ALL(x) begin(x), end(x)
#define rALL(x) rbegin(x), rend(x)
}
using namespace utils;


void sub_main(istream &is) {
    ll N;
    is >> N;
    if(!is) return;
    vector<ll> A(N);
    for (auto &&a : A) {
        is >> a;
    } // end a
    vector<int> lscol;
    for (int i = 0; i < N; ++i) {
        auto p = upper_bound(ALL(lscol), A[i], greater<int>());
        if(p == lscol.end()){
            lscol.push_back(A[i]);
        }
        else{
            assert(*p < A[i]);
            *p = A[i];
        }
    } // end i
    cout << lscol.size() << endl;
}

int main(int argc, char *argv[]) {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << setprecision(16) << scientific;
#ifdef DEBUG
    string test_cases = "test_E.txt";
    cerr << "DEBUG MODE" <<  endl;
    cerr << test_cases << " -->" << endl;
    auto fs = fstream(test_cases, fstream::in);
    int lp = 0;
    while(fs) {
        lp++;
        cout << lp <<  "#------\n";
        sub_main(fs);
    }
    cout << "------#" << endl;
    if(lp <= 1) sub_main(cin);
#else
    sub_main(cin);
#endif
    return 0;
}


Measured memory_bytes: 1660
import queue

K = int(input())

q = queue.Queue()

q.put(1)
q.put(2)
q.put(3)
q.put(4)
q.put(5)
q.put(6)
q.put(7)
q.put(8)
q.put(9)
x=0
while K>0:
    x = q.get()
    if x%10 != 0:
        q.put(10*x+x%10-1)
    q.put(10*x+x%10)
    if x%10 !=9:
        q.put(10*x+x%10+1)
    K-=1

print(x)  





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

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

        int n = Integer.parseInt(st.nextToken());

        int paid = n*800;
        int paidBack = 200*(n/15);

        System.out.println(paid-paidBack);

    }


}


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

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<bool> VB;
typedef vector<double> VD;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SQ(a) ((a)*(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define LB lower_bound
#define UB upper_bound

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

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL INF = 1000000000;
const LL MOD = 1000000007;

//other
//-------------------------------------------
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define FI first
#define SE second

int main() {
  int N, M;
  LL ans = 0;
  
  cin >> N >> M;
  
  priority_queue<int> pq;
  
  REP(i,N) {
    int A;
    cin >> A;
    ans += A;
    pq.push(A);
  }
  REP(i,M) {
    int B;
    B = pq.top();
    ans -= B;
    pq.pop();
    pq.push(B/2);
    ans += B/2;
  }
  
  
  cout << ans << endl;
  
  return 0;

}

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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define VIEW(dat) for(auto v : dat){cout<<v<<endl;}

int dat[45];
int count;
int fib(int n){
	if(n<2){
		return 1;
	}else{
		if(dat[n]) return dat[n];
		dat[n]=fib(n-1)+fib(n-2);
		return dat[n];
	}
}

int main(){
	count=0;
	rep(i,45) dat[i]=0;	
	int n;
	cin>>n;
	cout<<fib(n)<<endl;
	return 0;
}

Measured memory_bytes: 1164
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <queue>

using namespace std;

const int nmax = 1e9 + 7;
const long long INF = 1e18;
const double PI = 2 * asin(1);
typedef long long ll;


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

  if (N == 3){
    cout << "2 3 25" << endl;
  }else{
    vector <int> ans;
    int now = 0;
    for (int i = 0; i < (N - N % 8) / 8; i++){
      ans.push_back(12 * i + 2);
      ans.push_back(12 * i + 3);
      ans.push_back(12 * i + 4);
      ans.push_back(12 * i + 6);
      ans.push_back(12 * i + 8);
      ans.push_back(12 * i + 9);
      ans.push_back(12 * i + 10);
      ans.push_back(12 * i + 12);
      now = 12 * i + 12;
    }

    if (N % 8 == 1){
      ans.push_back(now + 6);
    }else if(N % 8 == 2){
      ans.push_back(now + 3);
      ans.push_back(now + 9);
    }else if (N % 8 == 3){
      ans.push_back(now + 3);
      ans.push_back(now + 6);      
      ans.push_back(now + 9);      
    }else if(N % 8 == 4){
      ans.push_back(now + 2);  
      ans.push_back(now + 3);
      ans.push_back(now + 4);      
      ans.push_back(now + 9);       
    }else if (N % 8 == 5){
      ans.push_back(now + 2);
      ans.push_back(now + 4);      
      ans.push_back(now + 6);
      ans.push_back(now + 3);
      ans.push_back(now + 9);
    }else if (N % 8 == 6){
      ans.push_back(now + 2);
      ans.push_back(now + 4);      
      ans.push_back(now + 6);       
      ans.push_back(now + 3);
      ans.push_back(now + 9);      
      ans.push_back(now + 12); 
    }else if (N % 8 == 7){
      ans.push_back(now + 2);
      ans.push_back(now + 4);      
      ans.push_back(now + 6);       
      ans.push_back(now + 3);
      ans.push_back(now + 9);      
      ans.push_back(now + 10); 
      ans.push_back(now + 8);
    }

    for (int i = 0; i < N; i++){
      cout << ans[i];
      if (i != N - 1) cout << " ";
      else cout << endl;
    }
  }
  
  
  return 0;
}


Measured memory_bytes: 512
s = int(input())


#%%
#s = 8
#%%
def f(n):
    if n % 2 == 0:
        return int(n/2)
    else:
        return 3 * n + 1



#%%
a = [s]
ai = 0


#%%
while True:
    # print(a)
    ai = f(a[-1])
    a.append(ai)
    if a.count(ai) == 2:
        break

#%%
print(len(a))

#%%


Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main() {
  string s, t;
  cin >> s >> t;
  sort(s.begin(), s.end());
  sort(t.begin(), t.end());
  reverse(t.begin(), t.end());
  if (s < t) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
from collections import Counter
import sys
from random import randint
from time import time
start = time()
sys.setrecursionlimit(1000000000)
input = sys.stdin.readline


def get_sat():
    sat = 0
    when = [-1] * 26
    for i in range(d):
        sat += s[i][t[i]]
        when[t[i]] = i
        for j in range(26):
            sat -= c[j] * (i - when[j])
    return sat


d = int(input())
c = list(map(int, input().split()))
s = [list(map(int, input().split())) for _ in range(d)]
t = [randint(0, 25) for i in range(d)]
ans = get_sat()
while time() - start < 1.8:
    p, q = randint(0, d - 1), randint(0, 25)
    x = t[p]
    t[p] = q
    y=get_sat()
    if ans >= y:
        t[p] = x
    else:
        ans=y
for i in t:
    print(i + 1)


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

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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repto(i, n) for(int i = 0; i <= (n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007
#define DEBUG(x) cout << #x << ": " << x << endl;
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }

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

  int N, R;
  cin >> N >> R;
  if (N >= 10)
    cout << R << endl;
  else
    cout << R+100*(10-N) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = int64_t;
using P = pair<ll, ll>;
template <class T>
using V = vector<T>;

const int MAX = 100000;

int main() {
  string x;
  cin >> x;
  int n = x.length();

  stack<char> q;
  for (int i = 0; i < n; i++) {
    if (q.size() > 0 && x[i] == 'T' && q.top() == 'S') {
      q.pop();
    } else {
      q.push(x[i]);
    }
  }
  cout << q.size() << endl;
}


Measured memory_bytes: 3696
import sys
readline = sys.stdin.readline
n = int(input())
a = list(map(int, readline().split()))
a.sort(reverse = True)
alice = 0
bob = 0
for i in range(n):
    if i % 2 == 0:
        alice += a[i]
    else:
        bob += a[i]
print(str(alice-bob))

Measured memory_bytes: 3060
import java.util.Scanner;
import java.util.Arrays;

public class Main
{
    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        int num[] = new int[3];
        num[0] = sc.nextInt();
        num[1] = sc.nextInt();
        num[2] = sc.nextInt();

        Arrays.sort(num);

        System.out.println(num[0]+" "+num[1]+" "+num[2]);
        
        sc.close();
    }
}


Measured memory_bytes: 26360
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

int main(){
    int x;
    cin >> x;
    string yes = "YES", no = "NO";
    if(x == 3 or x == 5 or x == 7) cout << yes << endl;
    else cout << no << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int a,b,c,d,m1,m2;
    scanf("%d%d%d%d",&a,&b,&c,&d);
    m1=a*b;
    m2=c*d;
    if(m1>m2 || m1==m2)
        printf("%d\n",m1);
    else if(m1<m2 || m1==m2)
        printf("%d\n",m2);
    return 0;
}


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

using namespace std;

int main() {
  string Ball;
  string p;

  Ball = "A";
  while(cin >> p) {
    if(p[0] == Ball[0]) {
      Ball[0] = p[2];
    }else if(p[2] == Ball[0]) {
      Ball[0] = p[0];
    }
  }

  cout << Ball[0] << endl;

  return 0;
}

Measured memory_bytes: 3168
package main

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

var sc = bufio.NewScanner(os.Stdin)

func Scanner() string {
	sc.Scan()
	return sc.Text()
}

func intScanner() int {
	n, _ := strconv.Atoi(Scanner())
	return n
}

func floatScanner() float64 {
	n, _ := strconv.ParseFloat(Scanner(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func stringSliceScanner(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scanner()
	}
	return a
}
func intSliceScanner(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = intScanner()
	}
	return a
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}

var mod int

func main() {
	mod = 1000000007
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	a := intScanner()
	b := intScanner()
	fmt.Println(max([]int{a + b, a - b, a * b}))
}


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

class E
{
	static void Main()
	{
		var N = int.Parse(Console.ReadLine());
		var S = Console.ReadLine();
		var s = new bool[N];
		for (var i = 0; i < N; i++) s[i] = S[i] == 'o';
		var hoge = new[] { new[] { true, true }, new[] { true, false }, new[] { false, true }, new[] { false, false } };
		var b = new bool[N];
		for (var i = 0; i < 4; i++)
		{
			var answer = Func(hoge[i][0], hoge[i][1], s, N);
			if (answer != "-1")
			{
				Console.WriteLine(answer);
				return;
			}
		}
		Console.WriteLine(-1);
	}
	static string Func(bool r0, bool r1, bool[] s, int N)
	{
		var a = new bool[N];
		a[0] = r0;
		a[1] = r1;
		for (var i = 1; i + 1 < N; i++) a[i + 1] = a[i - 1] == (a[i] == s[i]);
		if ((s[0] == a[0]) == (a[1] == a[N - 1]) && (s[N - 1] == a[N - 1]) == (a[N - 2] == a[0]))
			return string.Join("", a.Select(z => z ? "S" : "W"));
		else return "-1";
	}
}

Measured memory_bytes: 13268
#include<bits/stdc++.h>
using namespace std;
long long a,b,c,d,e;
int main(){
    ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
    cin>>a>>b;
    cout<<(a-1)*a/2+b*(b-1)/2;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
    using namespace std;
    # define ll long long int
     
    int main(){
    	#ifndef ONLINE_JUDGE
    		freopen("input.txt","r",stdin);
    		freopen("output.txt","w",stdout);
    	#endif
        ll a,v;
        cin>>a>>v;
        ll b,w;
        cin>>b>>w;
    	int t;
        cin>>t;
        ll rel=abs(a-b);
        if(v<w){
            cout<<"NO";return 0;
        }
        ll speed=abs(v-w);
        ll dist=t*speed;
        if(dist>=rel){
            cout<<"YES";
        }
        else{
            cout<<"NO";
        }
    }
    


Measured memory_bytes: 3636
import math
import copy
from operator import mul
from functools import reduce
from collections import defaultdict
from collections import Counter
from collections import deque
# 直積 A={a, b, c}, B={d, e}:のとき，A×B={(a,d),(a,e),(b,d),(b,e),(c,d),(c,e)}: product(A, B)
from itertools import product
# 階乗 P!: permutations(seq), 順列 {}_len(seq) P_n: permutations(seq, n)
from itertools import permutations
# 組み合わせ {}_len(seq) C_n: combinations(seq, n)
from itertools import combinations
# 一次元累積和
from itertools import accumulate
from bisect import bisect_left, bisect_right
from heapq import heappush, heappop

import re
# import numpy as np
# from scipy.misc import comb

# 再帰がやばいとき
import sys
sys.setrecursionlimit(10**9)

def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W

# 四方向: 右, 下, 左, 上
dy = [0, -1, 0, 1]
dx = [1, 0, -1, 0]
 
def i_inpl(): return int(input())
def l_inpl(): return list(map(int, input().split()))
def line_inpl(x): return [i_inpl() for _ in range(x)]

INF = int(1e30)
MOD = int(1e9)+7 # 10^9 + 7

# field[H][W]
def create_grid(H, W, value = 0):
    return [[ value for _ in range(W)] for _ in range(H)]

########

def count_inversion(sequence):
    count = 0
    for i in range(1,len(sequence),1):
        for j in range(i,len(sequence),1):
            if sequence[i-1] > sequence[j]:
                count += 1
    return count

def power_func(a,n,p):
  bi=str(format(n,"b"))#2進表現に
  res=1
  for i in range(len(bi)):
    res=(res*res) %p
    if bi[i]=="1":
      res=(res*a) %p
  return res

def main():
    N, K = l_inpl()
    A = l_inpl()
    a1 = count_inversion(A)
    b1 = (count_inversion(A*2) - count_inversion(A))
    b2 =  (count_inversion(A*3) - count_inversion(A*2))
    c1 = b2 - b1
    print((a1*K+c1*(K%MOD)*((K-1)%MOD)//2)%MOD)

if __name__ == "__main__":
    main()


Measured memory_bytes: 43028
# coding: utf-8
n = int(input())
sName = []
sTime = []
for i in range(n):
	m = input().split()
	sName.append(m[0])
	sTime.append(int(m[1]))
lsName = input()
lsInd = sName.index(lsName)
if lsInd == n - 1:
	result = 0
else:
	times = sTime[lsInd + 1:]
	result = sum(times)
print(result)
                 

Measured memory_bytes: 9204
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n int
	fmt.Scanf("%d", &n)

	vote := map[string]int{}
	for i := 0; i < n; i++ {
		var s string
		fmt.Scanf("%s", &s)
		vote[s] = vote[s] + 1
	}

	max := 0
	for _, n := range vote {
		if n > max {
			max = n
		}
	}

	tops := []string{}
	for s, n := range vote {
		if n == max {
			tops = append(tops, s)
		}
	}

	sort.Strings(tops)
	for _, s := range tops {
		fmt.Println(s)
	}
}


Measured memory_bytes: 34560
def main():
    N = int(input())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))
    if sum(A) < sum(B):
        return -1

    d = [0]*N
    ans = 0
    fusoku = 0
    for i in range(N):
        d[i] = A[i] - B[i]
        if d[i] < 0:
            ans += 1
            fusoku -= d[i]
    d.sort()
    for dd in d[::-1]:
        if fusoku <= 0:
            break
        fusoku -= dd
        ans += 1
    return ans
        

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


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

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

Measured memory_bytes: 3620
using System;

class Program
{
    static void Main()
    {
        string[] input = Console.ReadLine().Split(' ');

        int a = int.Parse(input[0]);
        int b = int.Parse(input[1]);

        var erea = a * b;

        var leng = a * 2 + b * 2;

        Console.WriteLine("{0} {1}", erea, leng);
    }
}


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

#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define RFOR(i, a, b) for(int i=(a); i>=(b); i--)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) RFOR(i, n, 0)
#define dump(x)  cout << #x << " = " << (x) << endl;

typedef long long ll;
typedef pair<int, int> ii;
const ll INF = 1e18;
const int inf = 1e8;


void solve()
{
  ll N;
  scanf("%lld",&N);
  ll T;
  scanf("%lld",&T);
  int ans=inf;
  for(int i = 0 ; i < N ; i++){
    int c,t; cin>>c>>t;
    if (t<=T) {
      ans = min(ans, c);
    }
  }
  if (ans==inf) cout << "TLE" << endl;
  else cout << ans << endl;
}

int main()
{
  solve();
  return 0;
}


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

using namespace std;

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

  int n;
  long long x, y;
  cin >> n >> x >> y;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }

  long long res = 0;
  for (int i = 0; i < n - 1; i++) {
    res += min(x * (a[i + 1] - a[i]), y);
  }
  cout << res << '\n';
  return 0;
}

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

int main()
{
  map<string, int> judge;

  judge["AC"] = 0;
  judge["WA"] = 0;
  judge["TLE"] = 0;
  judge["RE"] == 0;

  int N;
  cin >> N;

  for (int i = 0; i < N; i++)
  {
    string tmp;
    cin >> tmp;

    if (tmp == "AC")
    {
      judge["AC"]++;
    }
    else if (tmp == "WA")
    {
      judge["WA"]++;
    }
    else if (tmp == "TLE")
    {
      judge["TLE"]++;
    }
    else if (tmp == "RE")
    {
      judge["RE"]++;
    }
  }

  cout << "AC x " << judge["AC"] << endl;
  cout << "WA x " << judge["WA"] << endl;
  cout << "TLE x " << judge["TLE"] << endl;
  cout << "RE x " << judge["RE"] << endl;
}

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

int main()
{
	int n; cin >> n;	
	string s; cin >> s;

	for (int i = 0; i < s.size(); i++) {
		
		if (s.at(i) + n <= 'Z') {
			s.at(i) = s.at(i) + n;
		}
		else {
			s.at(i) = 'A' + n - ('Z'- s.at(i) + 1) ;
		}	
	}

	cout << s << endl;	

	return 0;
}

Measured memory_bytes: 256
#include <cmath>
#include <iostream>

int main() {
  uint64_t N = 0;
  std::cin >> N;

  uint32_t i = std::sqrt(N);
  while (N % i != 0) i--;
  uint64_t F_raw = N / i;
  uint32_t ans = 0;
  while (F_raw > 0) {
    F_raw /= 10;
    ans++;
  }
  std::cout << ans << std::endl;

  return 0;
}

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

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

typedef long long ll;
using namespace std;
int mod = 1000000007;

int main(void){
    //A[i] + ... + A[j] = 0
    map<ll, int> mp;
    int N; cin >> N;
    ll A[N]; rep(i, N) cin >> A[i];
    ll acc = 0;
    ll ans = 0;
    ll num_zero = 0;
    rep(i, N){
        //if(A[i] == 0) num_zero++;
        acc += A[i];
        if(acc == 0) ans++;
        if(mp.count(acc)){
            ans += mp[acc];
            mp[acc]++;
        }
        else{
            mp[acc] = 1;
        }
    }
    cout << num_zero + ans << endl;
    return 0;
}

Measured memory_bytes: 14336
#include <cstdio>
#include <algorithm>
#include <vector>
#include <set>
#include <queue>
#include <algorithm>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;

#define pb push_back
#define mk make_pair
#define f0(i,b) for(int i=0;i<(b);i++)
#define f1(i,b) for(int i=1;i<=(b);i++)
#define f2(i,a,b) for(int i=(a);i<=(b);i++)
#define sf(a) scanf("%d",&a);
#define sfl(a) scanf("%lld",&a);
#define pf(a) printf("%d\n",a);
#define pfl(a) printf("%lld\n",a);
#define TEST int test; cin >> test;while(test--)
#define ii pair<int,int>
#define iil pair<ll,ll>
#define loop(i,a,b) for(int i = a ; i < b ; i++)
#define INF 2147483647


int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};
int dx4[] = {0, 0, 1, -1};
int dy4[] = {1, -1, 0, 0};
const double pi = acos(-1.0);
ll power(ll x, unsigned long long y)
{
    int res = 1;     // Initialize result

    while (y > 0)
    {
        // If y is odd, multiply x with result
        if (y & 1)
            res = (res*x);

        // y must be even now
        y = y>>1; // y = y/2
        x = (x*x);  // Change x to x^2
    }
    return res;
}

ll n, m, x, k;

void solve()
{
    double a, b, c, h, m;
    cin >> a >> b >> h >> m;

    double hour_angle = 0.5 * (h * 60 + m);
    double minute_angle = 6.0 * m;
    double angle = abs(hour_angle - minute_angle);
    angle = min(360 - angle, angle);
   // cout << angle << " ";
    c = sqrt(a*a + b*b - 2*a*b*cos(angle*pi/180));
    cout << fixed << setprecision(20) << c << endl;

}


int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    solve();
    return 0;
}


Measured memory_bytes: 4184
#include<bits/stdc++.h>
using namespace std;
//Optimisations
#pragma GCC target ("avx2")
#pragma GCC optimization ("unroll-loops")
#pragma GCC optimize("O2")
//shortcuts for functions
#define pb push_back
#define mp make_pair
#define ff first 
#define ss second
#define all(v) v.begin(),v.end()
#define prec(n) fixed<<setprecision(n)
#define n_l '\n'
// make it python 
#define gcd __gcd
#define append push_back
#define str to_string
// utility functions shortcuts
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define sswap(a,b) {a=a^b;b=a^b;a=a^b;}
#define swap(a,b) {auto temp=a; a=b; b=temp;}
#define init(dp) memset(dp,-1,sizeof(dp));
#define set0(dp) memset(dp,0,sizeof(dp));
#define bits(x) __builtin_popcount(x)
#define SORT(v) sort(all(v))
#define endl "\n"
#define forr(i,n) for(ll i=0;i<n;i++)
// declaration shortcuts
typedef long long int ll;
#define int ll
// Constants
constexpr int dx[] = {-1, 0, 1, 0, 1, 1, -1, -1};
constexpr int dy[] = {0, -1, 0, 1, 1, -1, 1, -1};
constexpr ll INF = 1999999999999999997; 
constexpr int inf= INT_MAX;
constexpr int MAXSIZE = int(1e6)+5;
constexpr auto PI  = 3.14159265358979323846L;
constexpr auto oo  = numeric_limits<int>::max() / 2 - 2;
constexpr auto eps = 1e-6;
constexpr auto mod = 1000000007;
constexpr auto MOD = 1000000007;
constexpr auto MOD9 = 1000000009;
constexpr auto maxn = 100006;
//void IOfile(){
//freopen(file_name, reade_mode, stdin);
//freopen(file_name, write_mode, stdout);
//}
void fastio(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
}
int32_t main(){
	fastio();
	int n , a , b;
	cin >> n >> a >> b;
	int ans = (n / (a + b)) * a + min(n%(a + b) , a);
	cout << ans;
}

Measured memory_bytes: 3648
#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 INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int N, A, B, C;
vector<int> kado;
int ans;

ll dfs(int cur, vector<int> comb, vector<int> &vec) {
  ll ans = INF;
  if(cur == N) {
    vector<int> conn(3, 0);
    vector<int> conn_cnt(3, 0);
    ll cost = 0;
    REP(j, N) {
      if (comb[j] > 2) {
        continue;
      }
      conn_cnt[comb[j]]++;
      conn[comb[j]] += vec[j];
    }
    REP(j, 3) {
      if (conn[j] == 0) {
        return INF;
      }
      cost += 10*(conn_cnt[j] - 1);
    }
    cost += abs(A - conn[0]);
    cost += abs(B - conn[1]);
    cost += abs(C - conn[2]);
    
    return cost;
  }
  REP(i, 4) {
    vector<int> c_comb(cur+1);
    REP(j, cur) {
        c_comb[j] = comb[j];
    }
    c_comb[cur] = i;
    ans = min(ans, dfs(cur+1, c_comb, vec));
  }
  return ans;
}

int main()
{
  cin >> N >> A >> B >> C;
  vector<int> vec(N);
  REP(i, N) {
    cin >> vec[i];
  }
  
  kado.push_back(A);
  kado.push_back(B);
  kado.push_back(C);
  kado.push_back(0);
  vector<int> comb(0);
  cout << dfs(0, comb, vec) << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cctype>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <string>
#include <functional>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iomanip>
#include <bitset>
#define pb push_back
#define YES cout<<"YES"<<endl
#define Yes cout<<"Yes"<<endl
#define NO cout<<"NO"<<endl
#define No cout<<"No"<<endl
#define rep(i,n) for(int i=0;i<n;i++)
#define INF (1<<20)
#define LLINF (1LL<<60)
#define MOD 1000000007
typedef long long ll;
using namespace std;

int main(){
    ll x;
    cin>>x;
    ll t=100,count=0;
    while(t<x){
        count++;
        t*=1.01;
    }
    cout<<count;
    return 0;
}


Measured memory_bytes: 3592
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<set>
#include<unordered_set>
#include<cassert>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef unordered_set<ll> uset;
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=0;i<=n;i++)
#define chmin(a,b) a=min(a,b)
#define chmax(a,b) a=max(a,b)
#define all(x) x.begin(),x.end()
#pragma gcc optimize("O3")
#pragma gcc optimize("unroll-loops")
#pragma gcc target("avx2,see4")
#define M 210
int n;
bool thedge(ll a,ll b){//頂点aと頂点bの間に辺があるか
	string s="";
	rep(i,n)s+="0";
	s[a]=s[b]='1';
	cout<<"? "<<s<<"\n"<<flush;
	ll res;
	cin>>res;
	return res==1;
}
bool thedge_set(set<ll> S,ll x){//独立集合Sのいずれかと頂点xの間に辺があるか
	S.insert(x);
	string s="";
	rep(i,n)s+="0";
	for(auto t:S)s[t]='1';
	cout<<"? "<<s<<"\n"<<flush;
	ll res;
	cin>>res;
	return res>=1;
}

vector<ll> FANS_A,FANS_B;//FANS_A[i]とFANS_B[i]の間に辺がある
void dfs(ll x,set<ll> S){//xとSの間の辺を探す(一つはある）
	if(S.size()==1){
		FANS_A.push_back(x);
		FANS_B.push_back(*S.begin());
		return;
	}
	set<ll> L,R;
	bool flag=0;
	for(auto s:S){
		if(flag)L.insert(s);
		else R.insert(s);
		flag=flag^1;
	}
	if(thedge_set(L,x))dfs(x,L);
	if(thedge_set(R,x))dfs(x,R);
}
int main(){
	cin>>n;
	vector<ll> v[M];//v[d]:=0を根として深さdの頂点のidの集合
	{//2000~4500回でv[]を求める
		v[0].push_back(0);
		set<ll> cand;//まだ決まっていないもの
		for(int i=1;i<n;i++)cand.insert(i);
		for(ll d=0;d<M;d++){
			if(cand.size()==0)break;
			set<ll> cur;
			for(auto x:v[d])cur.insert(x);
			for(auto x:cand){
				if(thedge_set(cur,x)){
					v[d+1].push_back(x);
				}
			}
			for(auto x:v[d+1])cand.erase(x);
		}
	}
	{//dとd+1の間の辺を求める
		for(ll d=0;d<M;d++){
			if(v[d+1].size()==0)break;
			set<ll> A,B;
			for(auto x:v[d])A.insert(x);
			for(auto x:v[d+1])B.insert(x);
			if(A>B)swap(A,B);
			//|A|<=|B|、Aの要素に対して、辺がある方を探す
			for(auto x:A){
				if(thedge_set(B,x))dfs(x,B);
			}
			/*for(auto x:A)for(auto y:B){
				if(thedge(x,y)){
					FANS_A.push_back(x);
					FANS_B.push_back(y);
				}
			}*/
		}
	}
	/*if(n-1!=FANS_A.size()){
		ll x=0,y=0;
		while(1){
			if(x%2==0&&y%2==1)break;
			x++,y++;
		}
		cout<<x<<endl;
	}*/
	cout<<"!";
	for(int i=0;i<n-1;i++){
		cout<<" ("<<FANS_A[i]<<","<<FANS_B[i]<<")";
	}
	cout<<"\n"<<flush;
}


Measured memory_bytes: 852
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
        int number[] = new int[n];
        for(int i = 0; i < n; i++){
        	number[i] = sc.nextInt();
        }
        int count = 0;
        for(int i = 0; i < n; i++){
        	if(i + 1 == number[number[i]-1]){
            	count++;
            }
        }
        System.out.println(count / 2);
     }
}

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

int main(){
  int X, A, B;
  cin >> X >> A >> B;
  
  string ans;
  
  if(A >= B){
    ans = "delicious";
  }
  else if(X + A >= B){
    ans = "safe";
  }
  else{
    ans = "dangerous";
  }
  
  cout << ans << endl;
  
}

Measured memory_bytes: 256
from collections import Counter

w = list(input())
if len(w) % 2 == 1:
    print('No')
else:
    res = [0 if e % 2 == 0 else 1 for e in Counter(w).values()]
    if sum(res) == 0:
        print('Yes')
    else:
        print('No')



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

using namespace std;

long long n;
double h[3010], t[3010], memo[3010][3010], ret = 0;

double dp(int idx, int head) {
	if(idx == 0 && head == 0) {
		return (double)1.00;
	}
	else if(idx == 0 && head != 0){
		return (double)0.00;
	}
	if(memo[idx][head] != -1) {
		return memo[idx][head];
	}
	memo[idx][head] = dp(idx - 1, head - 1) * h[idx] + dp(idx - 1, head) * t[idx];
	return memo[idx][head];
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	for(int i = 0; i < 3010; i++) {
		for(int j = 0; j < 3010; j++) {
			memo[i][j] = -1;
		}
	}
	cin >> n;
	for(int i = 1; i <= n; i++) {
		cin >> h[i];
		t[i] = 1 - h[i];
	}
	for(int i = (n + 2) / 2; i <= n; i++) {
		ret = ret + dp(n, i);
	}
	cout << fixed << setprecision(10) << ret << endl;
}



Measured memory_bytes: 71296
#include <bits/stdc++.h>
#define ll long long
#define WEIGHTSUM weight + i
#define VALUESUM maxValue[i] + value
using namespace std;
bitset <100005> foundWeight;
ll maxValue[100005];

int main() {
	ll n, w, weight, value, result = 0;

	cin >> n >> w;
	for (int i = 1; i <= n; i++) {
		cin >> weight >> value;

		for (int i = w; i >= 1; i--)
			if (foundWeight[i] && WEIGHTSUM <= w) {
				maxValue[WEIGHTSUM] = max(maxValue[WEIGHTSUM], VALUESUM);
				foundWeight[WEIGHTSUM] = 1;
				result = max(result, VALUESUM);
			}

		maxValue[weight] = max(maxValue[weight], value);
		foundWeight[weight] = 1;
		result = max(result, value);
	}

    cout << result;

	return 0;
}


Measured memory_bytes: 4376
#include <iostream>
#include <string>
#include <map>
#include <queue>
#include <algorithm>
#include <vector>
#include <math.h>
#include <bitset>
#include <cmath>
#include <set>
#include <queue>
#include <stack>

typedef long long ll;
#define rep(i,s,n)for(ll i = s;i<n;i++)
#define repe(i,s,n)for(ll i = s;i<=n;i++)
#define rep_r(i,s,n)for(ll i = n;i>s;i--)
#define rep_re(i,s,n)for(ll i = n;i>=s;i--)
using namespace std;
static const ll MOD = 1e9 + 7;
static const ll INF = 1e25;
static const ll MAX_N = 100001;

int main()
{
	ll n;
	ll x[8], y[8];

	cin >> n;
	rep(i, 0, n) cin >> x[i] >> y[i];

	vector<int> v;
	rep(i, 0, n) v.push_back(i);

	double ans = 0;
	do {
		double dis = 0;
		rep(i, 0, v.size()-1) {
			ll X1 = x[v[i]];
			ll Y1 = y[v[i]];
			ll X2 = x[v[i+1]];
			ll Y2 = y[v[i+1]];

			dis += sqrt((X1-X2)*(X1-X2) + (Y1-Y2)*(Y1-Y2));
		} 
		//dis /= (n - 1);
		ans += dis;
	} while (next_permutation(v.begin(), v.end()));

	double p = 1; 
	rep(i, 0, n) p *= (i + 1);

	printf("%.10f", ans / p);
}



Measured memory_bytes: 256
#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++)
using namespace std;
using P = pair<int, int>; 
using ll = long long;

int main()
{
  int n, k;
  cin >> n >> k;
  int a[n];
  rep(i, n) cin >> a[i];
  int ans = 0;
  rep(i, n){
    ans += min(a[i] * 2, (k - a[i]) * 2);
  }
  
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
#define tll tuple<ll, ll, ll>
#define all(c) c.begin(),c.end()

#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
 
const ll inf = 1000000001;
const ll INF = 1e18;
const ll MOD = 1000000007;

char albt[26] = {'a','b','c','d','e','f','g','h','i','j','k','l',
                 'm','n','o','p','q','r','s','t','u','v','w','x',
                 'y','z'};

//vector<ll> g[202020];
//fill(score, score+202020, 0);
//vector<ll> v;

int main(){
  ll n, k;
  cin >> n >> k;
  
  ll count = 0;
  for (int i=0;i<n;i++){
    ll tmp;
    cin >> tmp;
    if (tmp >= k) count += 1;
  }
  
  cout << count << endl;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
from collections import deque, defaultdict

def bfs():
    q = deque([(0, 0)])
    visited = [False]*N
    visited[0] = True
    
    while q:
        v, c = q.popleft()
        now = 1
        
        for nv in G[v]:
            if not visited[nv]:
                if now==c:
                    now += 1
                    
                k = 10**6*min(v, nv)+max(v, nv)
                ans[k] = now
                q.append((nv, now))
                visited[nv] = True
                now += 1

N = int(input())
edges = []
G = [[] for _ in range(N)]

for _ in range(N-1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    edges.append((a, b))
    G[a].append(b)
    G[b].append(a)

ans = defaultdict(int)
bfs()
K = max(list(ans.values()))

print(K)

for a, b in edges:
    print(ans[10**6*a+b])


Measured memory_bytes: 83104
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<functional>
#include<vector>
#include<queue>
#include<stack>
#include<set>
using namespace std;
#define MOD 1000000007
#define f(i,n) for(int i=0;i<int(n);i++)
#define N 200000


int main(){
	int n, k;
	int x;
	scanf("%d %d", &n,&k);
	n--;
	k--;
	x = n*k;

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


	return 0;
}

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

#define LL 					long long
#define ULL 				unsigned long long
#define pii 				pair<int,int>
#define fi 					first
#define se 					second
#define vi 					vector<int>
#define psb 				push_back
#define ppb 				pop_back
#define all(x)			 	(x).begin(),(x).end()
#define sz(x)				(int)(x).size()
#define endln 				printf("\n")
#define gc					getchar_unlocked
#define setmin(x)			memset((x), -1, sizeof((x)))
#define setnul(x)			memset((x), 0, sizeof((x)))
#ifndef getchar_unlocked
#define getchar_unlocked 	getchar
#endif
const int inf = 1e9 + 5;
const int mod = 1e9 + 7;

template <typename T>
void gi(T &ret) {
	ret = 0; char inp=gc(); int kl=1;
	while (inp<'0' || inp>'9') {if (inp=='-') kl=-1; inp=gc();}
	while ('0'<=inp && inp<='9') ret=(ret<<3)+(ret<<1)+(inp-'0'), inp=gc();
	if (kl<1) ret=-ret;
}

int tg, lb, k;

bool cek () {
	for (int i=0; i<=tg; i++) 
		for (int j=0; j<=lb; j++) 
			if (((i*j) + ((tg-i)*(lb-j)))==k) return 1;
	return 0;
}

int main() {
	gi(tg); gi(lb); gi(k);
	if (cek()) puts("Yes");
	else puts("No");
	return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,k,x,y,c=1,i,sum=0;
    cin>>n>>k>>x>>y;
    for(i=0;i<n;i++)
    {
        if(c<=k){
           sum+=x;
           c++;
        }
        else
            sum+=y;
    }
    cout<<sum<<endl;
}



Measured memory_bytes: 256