akhauriyash/Code-Regression huggingface dataset:
/*
...........__________    							 |										    ___  __
.............|       |     						     |											 |   /
.............|       |     						     |									  		 |  /
.............|       |                               |                         __                | /      _______
.............|_______|  _______            _______   |______   ________   /|  /  |               |/       |      |
.............| \               | |      | |          |      |          | / | /   |               |\       |
.............|  \       _______| |      | |_______   |      |   _______|   |/    |               | \      |
.............|   \      |      | |      |         |  |      |  |       |   |     |               |  \     |
.........  __|    \__|  |______| |______| ________|  |      |_ |_______|   |     |__|           _|   \__ _|        .

*/
#include<bits/stdc++.h>
using namespace std ;
#define int 				long long
#define ull 				unsigned long long int
#define ld 					long double
#define vi 					vector<int>
#define vii 				vector<pair<int,int>>
#define vvi 				vector<vector<int>>
#define pf 					push_front
#define popb 				pop_back
#define pb 					push_back
#define eb 					emplace_back
#define pii 				pair<int,int>
#define prec(x) 			fixed<<setprecision(15)<<x
#define all(x) 				x.begin(),x.end()
#define rall(x) 			x.rbegin(),x.rend()
#define mset(a,b) 			memset(a,b,sizeof(a))
#define mcpy(a,b) 			memcpy(a,b,sizeof(a))
#define fo0(i,n) 			for(int i=0,i##end=n;i<i##end;i++)
#define fo1(i,n) 			for(int i=1,i##end=n;i<=i##end;i++)
#define fo(i,a,b) 			for(int i=a,i##end=b;i<=i##end;i++)
#define foe(i,x)			for(__typeof((x).end())i=(x).begin();i!=(x).end();++i)
#define fre(i,x)			for(__typeof((x).rend())i=(x).rbegin();i!=(x).rend();++i)
#define fast ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0)
#define inf 1e18
const int mod=1e9+7;
const int N=4e5+10;

void raushan_kumar(){
	string s;cin>>s;
	int q;cin>>q;
	int cnt1=0;
	string left,right;
	while(q--){
		int t;cin>>t;
		if(t==1){
			cnt1++;
		}
		else{
			int b;char c;
			cin>>b>>c;
			
			if(b==2 and cnt1%2==0){
				right.push_back(c);
			}
			else if(b==1 and cnt1%2==0){
				left.push_back(c);
			}
			else if(b==1 and cnt1%2==1){
				right.push_back(c);
			}
			else if(b==2 and cnt1%2==1){
				left.push_back(c);
			}
		}
	}
	// cout<<left<<endl;
	// cout<<right<<endl;
	if(cnt1%2==0){
		reverse(all(left));
		cout<<left<<s<<right;
	}
	else{
		reverse(all(s));
		reverse(all(right));
		cout<<right<<s<<left;
	}
	// cout<<s;
}

int32_t main()
{
	
	fast;int t=1;
	//cin>>t;
	while(t--){
		raushan_kumar();
	}

}	

Measured memory_bytes: 1040
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0; i<(int)(n); ++i)
#define REPS(i,n) for(int i=1; i<=(int)(n); ++i)
#define RREP(i,n) for(int i=(int)(n)-1; i>=0; --i)
#define RREPS(i,n) for(int i=(int)(n); i>0; --i)
#define FOR(i,s,e) for(int i=(int)(s); i<(int)(e); ++i)
#define RFOR(i,s,e) for(int i=(int)(e)-1; i>=(int)(s); --i)
#define All(a) (a).begin(),(a).end()
#define dump(x) cerr << #x << " = " << (x) << endl;
//定数
#define INF 1e9
#define MOD (int)(1e9+7)
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
//とりあえず書いておく変数
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-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; }
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s;
  int n;
  cin >> n >> s;
  REP(i,s.length()){
    char d=s[i];
    d-='A';
    d+=n;
    d%='Z'-'A'+1;
    d+='A';
    cout<<d;
  }
  cout<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
using namespace std;
#define MOD 1000000007
#define INF (1<<29)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long Int;
typedef pair<Int, Int> P;



int main(){
    int n;
    cin >> n;
    vector<int> a(n), b(n), hoge(n);
    for(int i = 0;i < n;i++)cin >> a[i];
    for(int i = 0;i < n;i++)cin >> b[i];
    for(int i = 0;i < n;i++)hoge[i] = i+1;
    if(a > b)swap(a, b);
    Int cnt = 0;
    do{
        cnt++;
        if(a == hoge)cnt = 0;
        if(b == hoge)break;
    }while(next_permutation(hoge.begin(), hoge.end()));
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
use std::vec::Vec;

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> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}

fn main() {
    let (h, w): (usize, usize) = {
      let v: Vec<usize> = read_vec();
      (v[0], v[1])
    };

    let mut a: Vec<Vec<bool>> = Vec::new();
    for _ in 0..h {
      let l:Vec<bool>  = read::<String>().chars().map(|c| c == '.').collect();
      a.push(l);
    }

    let mut dp: Vec<Vec<u64>> = vec![vec![0; w]; h];

    for i in 0..h {
      for j in 0..w {
        if i == 0 && j == 0 {
          dp[i][j] = 1;
        }
        else if j == 0 {
          if a[i][j] && a[i-1][j] {
            dp[i][j] += dp[i - 1][j] % (1000000000 + 7);
          }
        }
        else if i == 0 {
          if a[i][j] && a[i][j-1]{
            dp[i][j] += dp[i][j - 1] % (1000000000 + 7);
          }
        }
        else {
          let temp = if a[i-1][j] {
            dp[i-1][j]
          }
          else {
            0
          };

          let hoge = if a[i][j-1] {
            dp[i][j-1]
          }
          else {
            0
          };
          if a[i][j] {
            dp[i][j] += (temp + hoge) % (1000000000 + 7);
          }
        }
      }
    }
    println!("{}", dp[h-1][w-1] % (1000000000 + 7));
}


Measured memory_bytes: 12540
#include<bits/stdc++.h>
using namespace std;
int main(){
	long long int a,b,c,k,ans;
	cin>>a>>b>>c>>k;
	if(a>=k){
		cout<<k;
		return 0;
	}
	else{
		k-=a;
		if(b>=k){
			cout<<a;
			return 0;
		}
		else{
			k-=b;
			cout<<a-k;
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 3568
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) FOR(i,0,n)
#define repr(i,n) for(int i=(n)-1;0<=i;--i)
#define each(e,v) for(auto&& e:(v))
#define all(v) begin(v),end(v)
#define dump(x) cerr<<#x<<": "<<(x)<<endl
using namespace std;
using vint = vector<int>;
using ll = long long;
using vll = vector<ll>;
template <class T> void chmin(T& a, const T& b) { a = min(a, b); }
template <class T> void chmax(T& a, const T& b) { a = max(a, b); }
void yes() { cout << "Yes" << endl; exit(0); }
void no() { cout << "No" << endl; exit(0); }

int main() {
    int n; cin >> n;
    vector<string> s(n);
    rep(i, n) cin >> s[i];
    ll m = 0, a = 0, r = 0, c = 0, h = 0;
    ll cnt[5] = {0, 0, 0, 0, 0};
    rep(i, n) {
        if(s[i][0] == 'M') cnt[0]++;
        if(s[i][0] == 'A') cnt[1]++;
        if(s[i][0] == 'R') cnt[2]++;
        if(s[i][0] == 'C') cnt[3]++;
        if(s[i][0] == 'H') cnt[4]++;
    }
    ll ans = 0;
    rep(i, 5) {
        FOR(j, i+1, 5) {
            FOR(k, j+1, 5) {
                ans += cnt[i] * cnt[j] * cnt[k];
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 6144
s=input()
t=input()
k=0
for i in range(len(s)-len(t)+1):
  a=s[i:len(t)+i]
  kari=0
  for j in range(len(t)):
    if a[j]==t[j]:
      kari+=1
  k=max(kari,k)
print(len(t)-k)

Measured memory_bytes: 67572
N = int(input())
b = []
r = []
all_l = []
for i in range(N):
  tmp = input()
  b.append(tmp)
  all_l.append(tmp)
N = int(input())
for i in range(N):
  tmp = input()
  r.append(tmp)
  all_l.append(tmp)
all_l = list(set(all_l))
ans = 0
for i in all_l:
  ans = max(ans, b.count(i)-r.count(i))
print(ans)



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


int main()
{
//  freopen("in.txt", "r", stdin);
//  freopen("out.txt", "w", stdout);
  int n, z, w;
  cin >> n >> z >> w;
  int arr[n];
  for(int i = 0;i < n;i++)
    cin >> arr[i];
  cout << max(abs(w - arr[n - 1]), (n > 1 ? abs(arr[n - 1] - arr[n - 2]) : 0));
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
int main() {
	int n, x, num ;
	cin >> n >> x;
	num = n;
	vector<int> m(n);
	for(int i = 0; i < n; i++) {
		cin >> m.at(i);
		x -= m.at(i);
	}
	int min=m.at(0);
	for (int i = 1; i < n; i++) {
		if (min > m.at(i))min = m.at(i);
	}
	int y = x / min;
	cout <<  y + n;


}

Measured memory_bytes: 3624
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

type Dish struct {
	A     int
	B     int
	Diff  int
	Index int
}

type Dishes []Dish

func (p Dishes) Len() int {
	return len(p)
}

func (p Dishes) Swap(i, j int) {
	p[i], p[j] = p[j], p[i]
}

func (p Dishes) Less(i, j int) bool {
	return p[i].A+p[i].B > p[j].A+p[j].B
}

var writer = bufio.NewWriter(os.Stdout)

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

	a := make([]int, n)
	b := make([]int, n)
	diff := make([]int, n)
	var dishesA Dishes = make([]Dish, n)
	for i := 0; i < n; i++ {
		var ta, tb int
		fmt.Scan(&ta, &tb)
		a[i] = ta
		b[i] = tb

		diff[i] = a[i] - b[i]
		dishesA[i] = Dish{A: a[i], B: b[i], Diff: diff[i], Index: i}
	}

	sort.Sort(dishesA)

	totalA := 0
	totalB := 0
	for i := 0; i < n; i++ {
		if i%2 == 0 {
			totalA = totalA + dishesA[i].A
		} else {
			totalB = totalB + dishesA[i].B
		}
	}

	fmt.Fprintf(writer, "%d\n", totalA-totalB)
	writer.Flush()
}


Measured memory_bytes: 10880
import math

n, k = map(int, input().split())

def solve():
    if k == 0:
        return n ** 2
    
    ans = 0
    for b in range(k + 1, n + 1):
        mmin = (n - b) // b + 1
        mmax = (n - k) // b
        ans += (b - k) * mmin
        ans += (n - k + 1) * (mmax - mmin + 1) - b * (mmax * (mmax + 1) - (mmin - 1) * mmin) // 2
    return ans

print(solve())

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
using namespace std;

int main()
{
	long i,N,temp,sum=0;
	vector<long> A;
	cin>>N;
	if(N%2==0){
		cout<<N;
	}else{
		cout<<N*2;
	}
}


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

int sum(int n) {
  if (n == 0) {
    return 0;
  }
  int s = sum(n - 1);
  return s + n;
}

int main(){
  int N, L; cin >> N >> L;
  int ohoo=sum(N);
  if (L>=0) cout << N*L-N+ohoo-L << endl;
  if (L-1+N<=0) cout << N*L-N+ohoo-N+1-L << endl;
  if (L<0 && L-1+N>0) cout << N*L-N+ohoo << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
	
		Scanner stdIn = new Scanner(System.in);
		
		int x = stdIn.nextInt();
		int a = stdIn.nextInt();
		int b = stdIn.nextInt();
		
		System.out.println(x - a -(x - a) / b * b);
	
	}
}

Measured memory_bytes: 22996
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //これつけるとA[N]でもいいらしい
//for文のマクロ
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define mp(a,b) make_pair(a,b)
#define big 1000000007
#define all(a) sort((a).begin(),(a).end()) //ソートのマクロ
#define Re(a) reverse((a).begin(),(a).end())
#define YN(a) if(a){cout<<"Yes"<<endl;}else cout<<"No"<<endl;//条件によってYes、Noを出力する
const int MOD=1000000007;
const double pi = 3.141592653589793;
int main(){
    int n;
    cin>>n;
    vector<int> a(n);
    rep(i,n){
        cin>>a[i];
    }
    int ans=0;
    rep(i,n){
        if(i%2==0 && a[i]%2==1)ans++;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3624
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;

public class Main
{

  public static void main(String[] args) throws IOException
  {
    BufferedReader r = new BufferedReader(new InputStreamReader(System.in), 1);

    String s;
    String sl[];
    s = r.readLine();
    sl = s.split(" ");

    int n = Integer.parseInt(sl[0]);
    int m = Integer.parseInt(sl[1]);
    int a = (int)(Math.sqrt((double)m) + (1e-9));
    ArrayList<Integer> v = new ArrayList<>();
    
    
    for(int i = 1; i <= a; i++)
    {
      if(m % i == 0)
      {
        v.add(i);
        v.add(m / i);
      }
    }
    
    Collections.sort(v);
    
    for(int i = 0; i < v.size(); i++)
    {
      if(v.get(i) >= n)
      {
        System.out.println(m / v.get(i));
        System.exit(0);
      }
    }

  }

}

Measured memory_bytes: 21332
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<random>
#include<set>
#include<map>
#include<functional>
using namespace std;
#define int long long
#define inf 1145141919
#define rep(i,n) for(int i=0;i<n;i++)
typedef pair<int, int>P;
struct edge { int u, v, cost; };
int par[114514], rnk[114514];
edge es[114514];
bool comp(const edge&e1, const edge&e2) {
	return e1.cost<e2.cost;
}
void init(int n) {
	for (int i = 0; i<n; i++) {
		par[i] = i;
		rnk[i] = 0;
	}
}
int find(int x) {
	if (par[x] == x)return x;
	return par[x] = find(par[x]);
}
void unite(int x, int y) {
	x = find(x);
	y = find(y);
	if (x == y)return;
	if (rnk[x]<rnk[y])par[x] = y;
	else {
		par[y] = x;
		if (rnk[x] == rnk[y])rnk[x]++;
	}

}

signed main() {
	int a, b; cin >> a >> b; if (a > 8 || b > 8)puts(":("); else puts("Yay!");
}

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



int main(){
  int a,b,c,d,e,f;
  cin >> a >> b >> c >> d >> e >> f;
  double cal=0.0;
  int ans_mizu=100*a;
  int ans_situ=0;
  for(int A=0;A<31;++A){
    for(int B=0;B<31;++B){
      for(int C=0;C<101;++C){
        for(int D=0;D<101;++D){
          if(100*a*A+100*b*B==0)break;
          if(100*a*A+100*b*B+C*c+D*d<=f && (100*a*A+100*b*B)/100*e>=C*c+D*d){
            double noudo=(double)(100*(C*c+D*d))/(double)(100*a*A+100*b*B+C*c+D*d);
            if(cal<noudo){
              ans_mizu=100*a*A+100*b*B+C*c+D*d;
              ans_situ=C*c+D*d;
              cal=noudo;
            }
          }
        }
      }
    }
  }

  cout << ans_mizu << " " << ans_situ << endl;
  return 0;

}


Measured memory_bytes: 3596
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#define ll long long
using namespace std;

const ll mod = 1e9 + 7;

ll C[2005][2005];
ll dp[100005][13];

int main(){
    int K,N,M_dist=0;
    cin >> N;
    vector<string> v(N);
    for (int i = 0; i < N; i++){
        cin >> v[i];
    }
    sort(v.begin(), v.end());
    decltype(v)::iterator result = std::unique(v.begin(), v.end());
    // 不要になった要素を削除
    v.erase(result, v.end());
    cout << v.size() << endl;
}

Measured memory_bytes: 7644
#include <iostream>
#include <cstdio>
#include <stack>
#include <vector>
#include <string.h>
#include <algorithm>
using namespace std;

#define M 1046527
#define NIL (-1)
#define L 14

char H[M][L]; // hash table

int getChar(char ch){
    if (ch == 'A') return 1;
    else if (ch == 'C') return 2;
    else if (ch == 'G') return 3;
    else if (ch == 'T') return 4;
    else return 0;
}

long long getKey(char str[]){
    long long sum = 0, p = 1, i;
    for (i = 0; i < strlen(str); i++){
        sum += p * (getChar(str[i]));
        p *= 5;
    }
    return sum;
}

int h1(int key){return key % M;}
int h2(int key){return 1 + (key % (M - 1));}

int find(char str[]){
    long long key, i, h;
    key = getKey(str);
    for (i = 0;; i++){
        h = (h1(key) + i * h2(key)) % M;
        if (strcmp(H[h], str) == 0) return 1;
        else if (strlen(H[h]) == 0) return 0;
    }
}

int insert(char str[]){
    long long key, i, h;
    key = getKey(str);
    for (i = 0;; i++){
        h = (h1(key) + i * h2(key)) % M;
        if (strcmp(H[h], str) == 0) return 1;
        else if (strlen(H[h]) == 0) {
            strcpy(H[h], str);
            return 0;
        }
    }
}

int main() {
    int i, n, h;
    char str[L], com[9];
    for (i = 0; i < M; i++) H[i][0] = '\0';
    scanf("%d", &n);
    for (i = 0; i < n; i++){
        scanf("%s %s", com, str);

        if (com[0] == 'i'){
            insert(str);
        }
        else {
            if (find(str)){
                printf("yes\n");
            }
            else{
                printf("no\n");
            }
        }
    }

    return 0;

}

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

#ifdef LOCAL
#include "../../dump.hpp"
#else
#define dump(...)
#endif

#define rep(i,n) for(int i=0,i##_cond=(n);i<i##_cond;i++)
#define FOR(i,a,b) for(int i=(a),i##_cond=(b);i<i##_cond;i++)
#define ROF(i,a,b) for(int i=(a)-1,i##_cond=(b);i>=i##_cond;i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend() //sortで大きい順
#define UNIQUE(v) v.erase(unique(all(v)),v.end())
#define SUM(a) accumulate(all(a),0)
#define sz(x) ((int)(x).size())
#define pb push_back
#define fst first
#define snd second
#define mp make_pair

typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<ll,ll> pii;

#define int ll

const int inf = 1ll<<62;
const int mod = 1e9+7;

main()
{
  int n; cin >> n;
  vi a(n); rep(i,n) cin >> a[i];
  sort(all(a));

  // 累積和 = 自分以下のものを全て食べた時の大きさ
  vi b = a;
  rep(i,n-1) b[i+1] += b[i];
  dump(a,b);
  
  int ans = 1; // 最大値のものは必ず生き残る
  ROF(i,n-1,0)
    if(2 * b[i] >= a[i+1]) ans++; // 自分の次に大きい物を食べれる
    else break; // 無理ならそれより小さいものも無理

  cout << ans << endl;
}

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

typedef long long ll;

#define PB push_back
#define MP make_pair

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
    ll n, m; cin >> n >> m;
    vector<pair<ll, ll>> drinks;
    for (ll i = 0; i < n; ++i) {
        ll a, b; cin >> a >> b;
        drinks.PB(MP(a, b));
    }
    sort(drinks.begin(), drinks.end());
    ll ans = 0;
    ll curIdx = 0;
    while (m > 0) {
        if (drinks[curIdx].second <= m) {
            m -= drinks[curIdx].second;
            ans += drinks[curIdx].second * drinks[curIdx].first;
        } else {
            ans += m * drinks[curIdx].first;
            m = 0;
        }
        curIdx++;
    }
    cout << ans << "\n";
}

/* stuff you should look for
	* int overflow, array bounds
	* special cases (n=1?)
	* do smth instead of nothing and stay organized
	* print new lines
*/

Measured memory_bytes: 2420
def wa(x):
    waa = 0
    while(x > 0):
        waa += x % 10
        x //= 10
    return waa

N = int(input())
ans = 1<<30
for i in range(1, N):
    j = N - i
    ans = min(ans, wa(i)+wa(j))
print(ans)

Measured memory_bytes: 3060
#include <iostream>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <ctime>
using namespace std;

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define RFOR(i,b,a) for (int i = (b)-1; i >= (a); i--)
#define ITER(it,a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a,value) memset(a, value, sizeof(a))

#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair

typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;

const double PI = acos(-1.0);
const int INF = 1000 * 1000 * 1000 + 7;
const LL LINF = INF * (LL) INF;
const int MOD = 1000 * 1000 * 1000 + 7;

const int MAX = 3000;
int P[MAX];
int sz = 0;
int A[MAX];


LL f(LL x)
{
    FOR(i, 0, sz)
    {
        LL p = P[i] * 1LL* P[i] * 1LL *P[i];
        while(x % p == 0) x /= p;
    }
    return x;
}

map<LL, int> M;

int main()
{
    for(int i = 2 ; i * i < MAX; ++i)
        if (!A[i])
        {
            P[sz++] = i;
            for(int j = i * i; j < MAX; j += i)
                A[j] = 1;
        }

    
    int n;
    scanf("%d", &n);
    
    FOR(i, 0, n)
    {
        LL x;
        scanf("%lld", &x);
        M[f(x)]++;
    }

    int ans = M.count(1);
    M.erase(1);
    ITER(it, M)
    {
        LL x = it->first;
        LL y = f(x * x);
        ans += max(M[x], M[y]);
        M[x] = M[y] = 0;
    }
    cout << ans << endl;
    
    
}


Measured memory_bytes: 21504
#include<stdio.h>
int main(void){
   int N, r, t, i;
   scanf("%d", &N);
   for ( i = 0; i < N; i++ ) {
       scanf("%d %d", &r, &t);
       if ( r % 100 == 0 ) {
           if ( t % 30 == 0 ) {
               printf("%d\n", 1 + ( t / 30 ) * 5 + ( r / 100 - 1 ));
           } else {
               printf("%d %d\n", 1 + ( t / 30 ) * 5 + ( r / 100 - 1 ), 1 + ( t / 30 ) * 5 + ( r / 100 - 1 ) + 5);
           } 
        } else if ( t % 30 == 0 ) {
            printf("%d %d\n", 1 + ( t / 30 ) * 5 + ( r / 100 - 1 ), 1 + ( t / 30 ) * 5 + ( r / 100 - 1 ) + 1);
        } else {
            printf("%d %d %d %d\n", 1 + ( t / 30 ) * 5 + ( r / 100 - 1 ), 1 + ( t / 30 ) * 5 + ( r / 100 - 1 ) + 1, 1 + ( t / 30 ) * 5 + ( r / 100 - 1 ) + 5, 1 + ( t / 30 ) * 5 + ( r / 100 - 1 ) + 6);
        }
   }
   return 0;
}

Measured memory_bytes: 1808
#include <stdio.h>
int main(void){
    int W,H,x,y,r,a,b,c,d;
    scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
    a=x-r;
    b=y-r;
    c=x+r;
    d=y+r;
    if(a<0){
        puts("No");
    }
    else if(b<0){
        puts("No");
    }
    else if(c>W){
        puts("No");
    }
    else if(d>H){
        puts("No");
    }
    else{
        puts("Yes");
    }
    return 0;
    }



Measured memory_bytes: 2104
#include<bits/stdc++.h>
#define V vector
#define VI vector<int>
#define VVI vector<vector<int>>
#define rep(i,n) for(int i=0;i<(n);i++)
#define MOD 1000000007
using namespace std;
typedef long long ll;

int main(void){
    int s;
    cin>>s;
    printf("%d:%d:%d\n",int(s/3600),int(s%3600/60),s%60);
}





Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back 
#define eb emplace_back
#define fn for(int i =0 ;i <n;i++)
#define fn1 for( int i =1;i<=n;i++)
#define fm for(int j =0 ;j <m;j++)
#define fm1 for(int j =1;j<=m;j++)
#define fi first
#define se second
#define endl '\n'
# define PI  3.14159265358979323846
#define MOD 1000000007
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
const int N = 2e6+5;
const int INF = 1e18L;
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}
int ar[N];
int dp[N];
signed main(){
	// #ifndef ONLINE_JUDGE
	// freopen("input.txt","r",stdin);
	// freopen("output.txt","w",stdout);
	// #endif
	IOS;
	int T=1;
	// cin >> T;
	while(T--){
		int a,b,c;
		cin>>a>>b>>c;
		swap(a,b);
		swap(a,c);
		cout<<a<<" "<<b<<" "<< c;

	
	}
	cerr << "Time Taken : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n";
	return 0;
}

Measured memory_bytes: 256
//inlclude before define 
#define _USE_MATH_DEFINES

//include
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<type_traits>
#include<numeric>
#include<assert.h>
#include<deque>
#include<iomanip>
#include<set>
#include<tuple>
#include<map>

using namespace std;

//typedef
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<char> VC;
typedef pair<int, int> P1;
typedef long long int ll;

//define
#define INF 1e9
#define NUM 1000000007
#define all(x) begin(x),end(x)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,a,b) for(int i=int(a);i<int(b);i++)
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))

//function

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

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

/*int dig(int a) {
	int sum = 0;
	while (a) {
		sum += a % 10;
		a /= 10;
	}
	return sum;
}*/

int mem[10][10] = {};
int ans = 0;
int func (int a,int n,bool visited[]);

int main () {
	int n, m;
	int cnt = 0;
	cin >> n >> m;
	int a, b;
	rep (i, m) {
		cin >> a >> b;
		mem[a-1][b-1]++;
		mem[b-1][a-1]++;
	}
	
	bool visited[8];
	rep (i, n) visited[i] = false;
	visited[0] = true;
	func (0, n, visited);
	cout << ans << endl;
	
}

int func (int a,int n,bool visited[]) {
	bool judge = true;
	rep (i, n) {
		if (visited[i] == false) judge = false;
	}

	if (judge) {
		ans++;
		return 0;
	}

	for (int i = 0; i < n; i++) {
		if (mem[a][i] == 0) continue;
		if (visited[i])continue;

		visited[i] = true;
		func (i, n, visited);
		visited[i] = false;
	}

	return 0;
}

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

int main() {
  int n;
  cin >> n;
  vector<int> h(n);
  rep(i, n) cin >> h[i];

  int ans = 0;
  int tmp = 0;
  for (int i = n - 1; i >= 1; i--) {
    if (h[i - 1] >= h[i]) {
      tmp++;
      ans = max(ans, tmp);
    } else {
      tmp = 0;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 640
using CompLib.Util;
using System;
using System.Linq;

public class Program
{

    public void Solve()
    {
        var sc = new Scanner();
        int n = sc.NextInt();
        int m = sc.NextInt();
        int[] s = new int[m];
        char[] c = new char[m];
        for (int i = 0; i < m; i++)
        {
            s[i] = sc.NextInt();
            c[i] = sc.NextChar();
        }
        for (int i = 0; i <= 999; i++)
        {
            var str = i.ToString();
            if (str.Length != n) continue;
            bool f = true;
            for (int j = 0; j < m; j++)
            {
                f &= str[s[j] - 1] == c[j]; 
            }

            if (f)
            {
                Console.WriteLine(i);
                return;
            }
        }
        Console.WriteLine(-1);
    }

    public static void Main(string[] args) => new Program().Solve();
}

namespace CompLib.Util
{
    using System;
    using System.Linq;
    class Scanner
    {
        private int _index;
        private string[] _line;
        const char separator = ' ';

        public Scanner()
        {
            _index = 0;
            _line = new string[0];
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(separator);
                _index = 0;
            }
            return _line[_index++];
        }
        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(separator);
            _index = _line.Length;
            return _line;
        }
        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
    }
}

Measured memory_bytes: 11220
import sys
import re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits



def input(): return sys.stdin.readline().strip()


def INT(): return int(input())


def MAP(): return map(int, input().split())


def LIST(): return list(map(int, input().split()))


sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

n, k = MAP()

print(n-k+1)

Measured memory_bytes: 4204
#include <iostream>
using namespace std;
int main(void){
  int n;
  cin >> n;
  
  int p = 0;
  int t = 1;
  
  while(1){
    p += t;
    if(p >= n)
      break;
    t++;
  }
  
  cout << t << endl;
  
  return 0;
}

    

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long double ld;
int main() {
	cin.tie(0); ios::sync_with_stdio(false);
	int N; cin >> N;
	vector<ld> r(N), x(N, 0);
	for (int i = 0; i < N;i++) cin >> r[i];
	for (int i = 0;i < N;i++) {
		if (i == 0) { x[i] = r[i]; }
		else {
			ld l = -1;
			for (int j = 0; j < i; j++) {
				l = max(l, x[j] + sqrt((r[i] + r[j])*(r[i] + r[j]) - (r[i] - r[j])*(r[i] - r[j])));
			}
			x[i] = l;
		}
	}
	ld left = 0, right = 0;
	for (int i = 0; i < N;i++) {
		left = min(x[i] - r[i], left);
		right = max(x[i] + r[i], right);
	}
	cout << fixed << setprecision(10) << right - left << endl;
}

Measured memory_bytes: 3296
#include <cstdio>
#include <functional>
#include <algorithm>
#include <vector>
#include <limits>
#include <numeric>
#include <type_traits>
#include <iostream>
#include <queue>
#include <math.h>
#include <bits/stdc++.h>

#define INF (1ll<<60)
#define MOD 1000000007
#define BOUND 27182818284

typedef long long ll;
typedef long long int lli;

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

template<class T>bool umax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool umin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

using namespace std;

// gcd
template<typename T>
T gcd(T a, T b){
    if(a==0)
        return b;
    return gcd(b%a,a);
}
// gcd array
int findGCD(int arr[], int n){
    int result = arr[0];
    for (int i=1; i < n; i++)
        result = gcd(arr[i], result);

    return result;
}
template<typename T>
T lcm( T m, T n )
{
    // 引数に0がある場合は0を返す
    if ( ( 0 == m ) || ( 0 == n ) )
        return 0;

    return ((m/gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}

// sort big to small
// sort(A,A+N, greater<int>());

// v.front() = -BOUND;
// v.back() = BOUND;

// Iterator
// v.begin
// v.end

int main() {
    string S;
    cin >> S;
    long long change=0;

    for(int i=0; i<S.length()-1; i++){
        if(S[i]!=S[i+1])
            change++;
    }

    cout << change << endl;
    return 0;
}



Measured memory_bytes: 512
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor, gcd
from operator import mul
from functools import reduce
from operator import mul
import pprint



sys.setrecursionlimit(2147483647)
INF = 10 ** 20
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod =  998244353


a, b, c, d = LI()
dp = [[0] * (d + 1) for _ in range(c + 1)]
dp[a][b] = 1
for i in range(a, c + 1):
    for j in range(b, d + 1):
        dp[i][j] += dp[i - 1][j] * j
        dp[i][j] += dp[i][j - 1] * i
        dp[i][j] -= dp[i - 1][j - 1] * (i - 1) * (j - 1)
        dp[i][j] %= mod


print(dp[c][d])



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

int main()
{
	char a;
	int s=0;
	while((a=getchar())!='\n')
	{
		s+=(a-'0');
	}
    if(s%9==0)
    {
    	cout << "Yes" ;
	}
	else if(s%9!=0)
	{
		cout << "No";
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 3640
import java.util.*;

public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		long n = sc.nextLong();
		if(n % 2 == 0) {
			System.out.println(n);
		} else {
			System.out.println(2 * n);
		}
	}
}

Measured memory_bytes: 21844
#include <iostream>
#include <cstdio>
#include <vector>
#include <map>
#include <string>
#include <utility>
#include <algorithm>
using namespace std;
int main(){
  string s;
  cin >> s;

  int red=0;
  int blue=0;
  int i;
  for(i=0; i<s.size(); i++){
    if(s[i]=='1'){
      red++;
    }else{
      blue++;
    }
  }

  cout << 2* min(red, blue)<<endl;

  return 0;
}


Measured memory_bytes: 512
using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		string[] str = Console.ReadLine().Split();
		int N = int.Parse(str[0]);
		int K = int.Parse(str[1]);
		int Q = int.Parse(str[2]);
		int[] A = new int[N];
		int[] B = new int[N];
		string[] str2 = Console.ReadLine().Split();
		for(var i=0;i<N;i++){
			A[i] = int.Parse(str2[i]);
			B[i] = A[i];
		}
		Array.Sort(B);
		var list = new List<int>();
		var listm = new List<int>();
		long ans = 999999999999;
		for(var k=0;k<N;k++){
			for(var i=0;i<N;i++){
				if(A[i] >= B[k]){
					list.Add(A[i]);
				}
				if(A[i] < B[k] || i == N-1){
					list.Sort();
					for(var j=0;j<list.Count-K+1;j++){
						listm.Add(list[j]);
					}
					list.Clear();
				}
			}
			listm.Sort();
			if(listm.Count >= Q){
				ans = Math.Min(listm[Q-1]-B[k],ans);
			}
			listm.Clear();
		}
		Console.WriteLine(ans);
	}
}

Measured memory_bytes: 13244
import sys
import re
def line():return sys.stdin.readline().strip()

while True:
    try:
        e = re.findall(r"[0-9X]+",line())

        ans = -1
        for i in range(10):
            a,b,c = [_.replace("X",str(i)) for _ in e]
            if i == 0 \
                and (\
                (a[0] == "0" and len(a) != 1)\
                or (b[0] == "0" and len(b) != 1)\
                or (c[0] == "0" and len(c) != 1)\
                ):
                continue 
            if int(a) + int(b) == int(c) :
                ans = i
                break

        if ans == -1:
            print("NA")
        else:
            print(ans)
    except:
        break

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

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);

        long health = in.nextLong();
        long attacks, div = 0;

        while (health > 1) {
            div++;
            health /= 2;
        }

        attacks = 2 * (long) Math.pow(2, div) - 1;

        System.out.println(attacks);

        in.close();

    }
}


Measured memory_bytes: 23124
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <string>
#include <set>
#include <bitset>
#include <unordered_map>

using namespace std;
using ll = long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;
template <class T>
using Vvec = vector<vector<T> >;

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

    cout << max(0, A-2*B) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define sz(x) ((int)x.size())
#define all(x) (x).begin(), (x).end()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define mset(x,y) memset(x,y,sizeof(x))
#define rep(i,n) for(int i=0;i<int(n);i++)
#define per(i,n) for(int i=int(n)-1;i>=0;i--)
#define rng(i,a,b) for(int i=int(a);i<=int(b);i++)
#define gnr(i,b,a) for(int i=int(b);i>=int(a);i--)
using namespace std;
using namespace __gnu_pbds;
using ordered_set = tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>;
#ifdef LOCAL
#define dmp(...) _dmp(#__VA_ARGS__, __VA_ARGS__)
#else
#define dmp(...) (__VA_ARGS__)
#endif
template<class T> using vt=vector<T>;
template<class T> using vvt=vt<vt<T>>;
template<class TA,class TB> void chmax(TA&a,TB b){if(a<b)a=b;}
template<class TA,class TB> void chmin(TA&a,TB b){if(b<a)a=b;}
template<class TA,class TB>
ostream& operator<<(ostream& os,const pair<TA,TB>& p){
	return os<<"{"<<p.fi<<","<<p.se<<"}";
}
template<class T> ostream& operator<<(ostream& os,const vt<T>& v){
	os<<"{";for(auto& e:v)os<<e<<",";return os<<"}";
}
template<class TH> void _dmp(const char *sdbg, TH h){cout<<sdbg<<"="<<h<<endl;}
template<class TH, class... TA> void _dmp(const char *sdbg, TH h, TA...a){
while(*sdbg!=',')cout<<*sdbg++;cout<<"="<<h<<","; _dmp(sdbg+1, a...);
}
template<class T> void make_unique(vt<T>& v) {
	sort(all(v));v.erase(unique(all(v)),v.end());
}
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
int ri(){int x;cin>>x;return x;}
ll rll(){ll x;cin>>x;return x;}
vi rvi(int n){vi v;rep(i,n)v.pb(ri());return v;}

void MAIN() {
	int h=ri(),w=ri();
	if(h==1||w==1){
		cout<<1;
		return;
	}
	ll a=(ll)h*w/2;
	if(h%2&&w%2)a++;
	cout<<a;
}
int main() {
	ios::sync_with_stdio(false);cin.tie(0);
	int T=1;
	//cin>>T;
	for(int tt=1;tt<=T;tt++) {
		MAIN();
	}
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int N;

  scanf("%d", &N);

  int end_a = 0, start_b = 0, middle_ab = 0, both_ab = 0, i, j;
  int len;

  char s[15];

  for(i = 0; i < N; i++){
    scanf("%s", s);
    len = strlen(s);
    if(s[0] == 66 && s[len-1] == 65) both_ab++;
    else if(s[0] == 66) start_b++;
    else if(s[len-1] == 65) end_a++;
    for(j = 0; j < len; j++){
      if(s[j] == 65 && s[j+1] == 66) middle_ab++;
    }
  }

  int ans = middle_ab + both_ab;

  if(end_a < start_b) ans += end_a;
  else ans += start_b;

  if(both_ab != 0){
    if(end_a == 0 && start_b == 0) ans--;
  }

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

  return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define f(n) for(ll i=0;i<n;i++)
#define fr(n) for(ll i=n-1;i>=0;i--)
int main()
{
	
	
	ll n;
	cin>>n;
	ll a[n+1],b[n+1];
	f(n)
	{
		cin>>a[i];
		b[i]=a[i];
	}
	sort(b,b+n);
	ll c=0;
	f(n)
	{
		if(a[i]!=b[i])
			c++;
	}
	if(c<=2)
	{
		cout<<"YES";
	}
	else
		cout<<"NO";
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<stdio.h>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<string>
#include<algorithm>
#include<functional>
#include<math.h>
#include<unordered_set>
using namespace std;

int main() {
	int A, B, X;

	cin >> A >> B >> X;

	if (A <= X && A + B >= X)cout << "YES" << endl;
	else cout << "NO" << endl;

	return 0;
}

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

/*----------------------------- DEFINES ------------------------------*/

#define eps 1e-9
#define mod 1000000007
#define ump unordered_map // operations take less time compared to map
#define pb push_back
#define pf push_front
#define pof pop_front()
#define pob pop_back()
#define mp make_pair
#define ps(x) push(x) // for stack and queue
#define T top() //  for stack
#define FR front()// for queue
#define BA back()// for queue
#define PP pop()// for queue and stack
#define B begin()
#define E end()
#define F first
#define S second
#define tostr(x) to_string(x)
#define SZ(x) ((int)x.size())
#define ins insert
#define MAE max_element
#define MIE min_element
#define cnt(x) count(x)
#define lb(x) lower_bound(x) // returns an it ptng to the element >=x if no such returns end
#define ub(x) upper_bound(x) // returns an it ptng to the element >x if no such returns end
#define rep(i,x,y) for(int i=x;i<y;i++)
#define per(i,x,y) for(int i=x;i>y;i--)
#define repi(i,x,y) for(int i=x;i<=y;i++)
#define peri(i,x,y) for(int i=x;i>=y;i--)
#define reps(i,x,y,k) for(int i=x;i<y;i+=k)
#define sper(i,x,y,k) for(int i=x;i>y;i-=k) 
#define all(x) ((x.B),(x.E))
#define inf (ll)LLONG_MAX
#define ds1(i,x) for(auto i=x.begin();i!=x.end();i++)
#define ds2(i,x) for(auto i:x) // easy method to iterate through a ds
#define sq(a) (a)*(a)
#define fib(n) ceil(pow((1+sqrt(5),n)-pow((1-sqrt(5),n)/(float)(pow(2,n)*sqrt(5)// compute fib(n) in O(1)
#define FIO {ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);}// fast i/o
#define dig(n) (int)(log10(n)+1) // num of digits
#define ss(x,k) substr(x,k)  // x is the start pos and k is the length of substr.
#define f(x) find(x)
#define set(x,k) memset(x,k,sizeof x)

/*------------------------------ TYPEDEFS-----------------------------*/

typedef long long ll;
typedef long l;
typedef string str;
typedef vector<int> vi;
typedef vector<ll> vlli;
typedef vector<pair<int,int> > vpii;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
typedef ump<int,int> umpii;

/*-----------------------------START FROM HERE -----------------------*/

int main(){
	FIO
	
	int a,b;cin>>a>>b;
	if(a==1){
		if(b!=1)cout<<"Alice";
		else cout<<"Draw";
	}
	else if(b==1){
		if(a!=1)cout<<"Bob";
		else cout<<"Draw";
	}
	else {
		if(a<b)cout<<"Bob";
		else if(a>b)cout<<"Alice";
		else cout<<"Draw";
	}
	return 0;
}


Measured memory_bytes: 256
x = list(map(int,input().split(" ")))
n = x[0]
m = x[1]
a = list(map(int,input().split(" ")))
a.sort(reverse=True)
# print(a)
all_a = sum(a)
# print(all_a)
l = 4 * m

if a[m-1] >= (all_a)/l :
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#include <map>
#include <unordered_map>
#include <set>
#include <fstream>
#include <chrono>
#include <random>
#include <bitset>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(x) ((int)(x).size())
#define pb push_back
using ll = long long;
using namespace std;
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 (b<a) { a=b; return 1; } return 0; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}

int main(){
  int N; cin >> N;
  vector<ll> A(N); rep(i,N) cin >> A[i];
  int ans = 0;
  rep(i,N){
    for(int j=i+1;j<N;j++){
      for(int k=j+1;k<N;k++){
        vector<ll> T = {A[i],A[j],A[k]};
        sort(all(T));
        if(T[0]==T[1]||T[1]==T[2]) continue;
        if(T[0]+T[1]>T[2])ans++;
      }
    }
  }
  cout << ans << endl;
  return 0;
}


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

int main() {
  int n;
  cin >> n;
  
  float ret = ((int)((float)n / 2) + n % 2) / (float)n;
  cout.setf(std::ios_base::showpoint);
  cout << ret;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
int main(){
	
	ios :: sync_with_stdio(false);
	
	int n;
	
	cin>>n;
	
	long long int total = 0;
	
	vector <int> arr(n);
	
	for(int i=0; i<n; i+=1){
		
		cin>>arr[i];
		
		total += arr[i];
	}
	
	long long int dp[n][n];
	
	for(int i=0; i<n; i+=1){
		
		dp[i][i] = arr[i];
	}
	
	for(int i=0; i+1<n; i+=1){
		
		dp[i][i+1] = max(arr[i],arr[i+1]);
	}
	
	for(int i=2; i<n; i+=1){
		
		for(int j=0; j+i<n; j+=1){
			
			long long int x = arr[j] + min(dp[j+2][j+i],dp[j+1][j+i-1]);
			
			long long int y = arr[j+i] + min(dp[j+1][j+i-1],dp[j][i+j-2]);
			
			dp[j][j+i] = max(x,y);
		}
	}
	
	long long int X = dp[0][n-1];
	
	long long int Y = total - dp[0][n-1];
	
	cout<<X-Y<<endl;
}

Measured memory_bytes: 70144
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main()
{
    ll k;
    cin >> k;
    
    if(k == 0)
    {
        cout << 2 << endl;
        cout << "1 1" << endl;
    }
    else if(k == 1)
    {
        cout << 2 << endl;
        cout << "2 0" << endl;
    }
    else if(k <= 50)
    {
        cout << k << endl;
        for(int i = 1; i <= k; i++)
        {
            cout << i << " ";
        }
    }
    else
    {
        cout << 50 << endl;
        ll quo = k / 50;
        ll rem = k % 50;
        for(int i = 0; i < 50-rem; i++)
        {
            cout << quo << " ";
            quo++;
        }
        quo++;
        for(int i = 0; i < rem; i++)
        {
            cout << quo << " ";
            quo++;
        }
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <utility>
#include <set>
#include <stack>
#include <climits>
#include <cmath>

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define rep1(i,n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
#define reps(i,s,n) for(int i=s, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define MEMSET(v, h) memset((v), h, sizeof(v))
typedef long long ll;
const char sp = ' ';
using namespace std;

struct UnionFind{
    vector<ll> par;
    vector<ll> rank;
    vector<ll> sizeth;

    void init(ll N){
        rep(i, N){
            par.push_back(i);
            rank.push_back(0);
            sizeth.push_back(1);
        }
    }

    ll root(ll x) {
        if(par[x]==x) return x;
        else return par[x]=root(par[x]);
    }

    bool isSame(ll x, ll y) {
        return root(x)==root(y);
    }

    bool merge(ll x, ll y) {
        x=root(x);
        y=root(y);
        if(x==y) return false;
        if(rank[x]>rank[y]) swap(x, y);
        sizeth[y] += sizeth[x];
        par[x]=y;
        if(rank[x]==rank[y]) rank[x]++;
        return true;
    }

    ll size(ll x){
        return sizeth[root(x)];
    }
};



int main(void){
    ll N, M, K;
    cin>>N>>M>>K;
    UnionFind u;
    u.init(N);
    ll a, b, c, d;
    vector<ll> bl[100002];
    ll fr[100002];
    MEMSET(fr, 0);
    rep(i, M){
        cin>>a>>b;
        u.merge(a-1, b-1);
        fr[a-1]++;
        fr[b-1]++;
    }
    rep(i, K){
        cin>>c>>d;
        bl[c-1].push_back(d-1);
        bl[d-1].push_back(c-1);
    }
    rep(i, N){
        ll blcount=0;
        rep(j, bl[i].size()){
            if(u.isSame(i, bl[i][j])) blcount++;
        }
        cout<<u.size(i)-1-blcount-fr[i];
        if(i==N-1) cout<<endl;
        else cout<<sp;
    }
    return 0;
}


Measured memory_bytes: 10208
def selection_sort(A, N):
    cnt = 0
    for i in range(N):
        minj = i
        for j in range(i, N):
            if A[j] < A[minj]:
                minj = j
        A[i], A[minj] = A[minj], A[i]
        if i != minj:
            cnt += 1
    return cnt

N = int(input())
A = list(map(int, input().split()))
cnt = selection_sort(A, N)
print(*A)
print(cnt)


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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define MOD 1000000007LL

#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(n);(i)++)
#define repi2(i, s, e) for(ll (i) = (ll)(s);(i) <= (ll)(e);(i)++)
#define per(i, n) for(ll (i) = (ll)(n) - 1LL;(i) >= 0LL;(i)--)
#define per2(i, s, e) for(ll (i) = (ll)(s) - 1LL;(i) >= (ll)(e);(i)--)
#define peri(i, n) for(ll (i) = (ll)(n);(i) >= 0LL;(i)--)
#define peri2(i, s, e) for(ll (i) = (ll)(s);(i) >= (ll)(e);(i)--)
#define iter(i, it) for(auto &(i): (it))

template<typename T, typename U> ostream& operator<<(ostream &s, const pair<T, U> m) {
    cout << "(" << m.first << ", " << m.second << ")";
    return s;
}
template<typename T, typename U> ostream& operator<<(ostream &s, const map<T, U> m) {
    ll c = 0;
    cout << "{ ";
    iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
    cout << "{ ";
    rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const list<T> &v) {
    ll c = 0;
    cout << "{ ";
    iter(i, v) cout << i << (c++ == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}

int main(void) {
    ll N;
    string C;
    cin >> N >> C;
    vector<ll> R;
    ll ans = 0;
    rep(i, C.size()) {
        if(C[i] == 'R') R.push_back(i);
    }
    rep(i, C.size()) {
        if(C[i] == 'W' && !R.empty() && i < R.back()) ans++, R.pop_back();
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 5496
#include<stdio.h>
int main()
{
long long x,y;
scanf("%lld%lld",&x,&y);
if(x==1LL||y==1LL)
{
if(x*y==1) printf("1\n");
else printf("%lld\n",x+y-3);
return 0;
}
printf("%lld",(x-2)*(y-2));
return 0;
}

Measured memory_bytes: 128