akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <iomanip>
#include <math.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define PI 3.14159265359
using namespace std;
using ll = long long;
using P = pair<int, int>;

const int mod = 998244353;
struct mint {
  ll x;
  mint(ll x=0):x(x%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
  
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

mint ctop[200000];
mint cbot[200000];
mint ms[200000];

int main() {
  int n, m, k;
  cin >> n >> m >> k;

  if (k == 0) {
    mint ans = mint(m) * mint(m-1).pow(n-1);
    cout << ans.x << endl; return 0;
  }
  
  ctop[0] = n-1;
  cbot[0] = 1;
  ms[0] = mint(m) * mint(m-1).pow(n-k-1);
  for (int i=1; i<k; i++) {
    ctop[i] = ctop[i-1] * (n-1-i);
    cbot[i] = cbot[i-1] * (i+1);
    ms[i] = ms[i-1] * (m-1);
  }

  mint ans = 0;
  rep(i, k) {
    ans += ctop[i] * cbot[i].pow(mod-2) * ms[k-1-i];
  }
  ans += ms[k-1] * (m-1);

  cout << ans.x << endl;
  
  return 0;
}

/*
6
1 2
4 -2
-3 6
8 4
5 10
-5 10

9
3 4
6 1
2 4
5 3
4 6
1 5
6 2
4 5
5 6
*/

Measured memory_bytes: 8320
import math
# N, K = map(int, input().split())
# line = list(map(int, input().split()))
# line = input()
N = int(input())
# print(N)
trans = [0] * 5
for i in range(5):
    trans[i] = int(input())

mini = min(trans)
ans = math.ceil((N / mini) + 4)
if N <= trans[0] and N <= trans[1] and N <= trans[2] and N <= trans[3] and N <= trans[4]:
    print(5)
else:
    print(ans)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;
using namespace std;
 
#define ff                  first
#define ss                  second
#define endl                "\n"
#define loop(i,s,e)         for(int i=s;i<e;i++)
#define int                 long long
#define vi                  vector<int> 
#define S(v)                sort(v.begin(),v.end())
#define RS(v)               sort(v.rbegin(),v.rend())
#define R(v)                reverse(v.begin(),v.end())
#define mxpq(T)             priority_queue <T>
#define mnpq(T)             priority_queue<T,vector<T>,greater<T>>
#define prv(v)              for(auto &x : v)cout << x << " ";
#define piirv(v)            for(auto &x : v)cout << x.ff << " " << x.ss << endl;
#define prvv(v)             for(auto &x : v)for(auto &y : x.ss)cout << y << " ";
#define mp                  make_pair
#define pii                 pair<int,int>
#define mset(a,f)           memset(a , f , sizeof(a))
#define pb                  push_back
#define inf                 INT_MAX
#define INF                 LLONG_MAX
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> oset;

const int N = 2e6 + 6;
int A[N];
int n;

void solve()
{
	string s;
	cin >> s;

  	if(s == "ABC")cout << "ARC";
  	else cout << "ABC";
}
 
int32_t main()
{
 
cout<<fixed<<setprecision(16);

ios_base:: sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
 	

 	int t = 1;
 	// cin >> t;
 	while(t--)solve();
  
}

Measured memory_bytes: 3608
parseInt(x) = parse(Int, x)
parseBigInt(x) = parse(BigInt, x)
parseFloat(x) = parse(Float64, x)
parseBigFloat(x) = parse(BigFloat, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
    n=parseInt(readline())
    a=map(x->parseInt(x)%2,split(readline()))
    if sum(a)%2==0
        println("YES")
    else
        println("NO")
    end
end
main()

Measured memory_bytes: 174792
#include <bits/stdc++.h>
using namespace std;
#define int long long 
#define f(i,x,n) for(int i=x;i<n;i++) 
#define all(c) c.begin(),c.end()
const int MOD = 1e9 + 7, N = 5e5 + 10;
const int LINF = LLONG_MAX;

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,x;
    cin >> x >> n;
    vector<int>q(n);
    map<int,int>maps;
    f(i,0,n){
        cin >> q[i]; 
        maps[q[i]] = 1; 
    }
    int ans = INT_MAX,diff = INT_MAX;
    f(i,-200,200){
        if(maps[i] == 0){
            if(abs(i - x) < diff){
                diff = abs(i-x);
                ans = i;
            }
        }
    }
    cout << ans << "\n";
    
    return 0;
}
 


Measured memory_bytes: 3640
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>
#include <assert.h>
#include <unordered_set>
#include <random>


using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e18;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(ll i = 0; i < n; i++)
















int main(){
    ll n;
    cin >> n;
    vector<ll> x(n);
    REP(i, n){
        cin >> x[i];
    }
    ll ans = INF;
    for(ll i = 1; i <= 100; i++){
        ll s = 0;
        REP(j, n){
            s += (i - x[j]) * (i - x[j]);
        }
        ans = min(ans, s);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int i,j = 1;
		while ((i =stdIn.nextInt()) != 0) {
		      System.out.println("Case " + j + ":" + " " + i);
		      j++;
		}
        stdIn.close();
	}
}



Measured memory_bytes: 42596
package main

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

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

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

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

func main() {
	sc.Split(bufio.ScanWords)
	A, B, C, N := getInt(), getInt(), getInt(), getInt()

	ans := 0
	for a := 0; a <= N; a += A {
		for b := 0; b <= N; b += B {
			c := N - a - b
			if c%C != 0 || c < 0 {
				continue
			}
			// out(a, b, c)
			ans++
		}
	}
	out(ans)
}


Measured memory_bytes: 640
#include <stdio.h>

int main(void) {
	int card[4][14] = {0};
	int j,k,n;
	char c;
	
	scanf("%d",&n);
	
	for(k=0;k<n;k++){
		scanf(" %c %d",&c,&j);
		if     (c == 'S') card[0][j] = 1;
		else if(c == 'H') card[1][j] = 1;
		else if(c == 'C') card[2][j] = 1;
		else if(c == 'D') card[3][j] = 1;
		else{}
	}
	
	for(k=0;k<4;k++){
		for(j=1;j<=13;j++){
			if     (k == 0 && card[k][j] == 0) printf("S %d\n",j);
			else if(k == 1 && card[k][j] == 0) printf("H %d\n",j);
			else if(k == 2 && card[k][j] == 0) printf("C %d\n",j);
			else if(k == 3 && card[k][j] == 0) printf("D %d\n",j);
			else{}
		}
	}
	return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
using namespace std;
 
int main() {
 
  int n,k;
  k = 0;
  cin >> n;
    for (int i = 1; i < n; i++) {
      k = k + (n-1) / i;
      }
  
cout << k;
  return 0;
}

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


int main(){
	
	string a,b;
	cin>>a>>b;
	int flag=0;
	for(int i = 0 ; i <= a.size() - b.size() ; i++){
		int t=1;
		for(int j = 0 ; j < b.size() ; j++){
			if(b[j]!='_'&&b[j]!=a[i+j]){
				t=0;
			}
		}
		flag+=t;
	}
	
	
	if(flag)cout<<"Yes\n";
	else cout<<"No\n";
	
	return 0;
}


Measured memory_bytes: 1172
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define ll long long
#define fr(i,n,m) for(ll i=n;i<m;i++)
int main()
{
    ll a,b,c;
    scanf("%lli %lli %lli",&a,&b,&c);
    if (a+b == c || a+c == b || b+c == a)
    {
        puts("Yes");
    } else {
        puts("No");
    }
    return 0;
}

Measured memory_bytes: 1596
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define pb push_back
const int maxn = 10000;
const int INF32 = 1'050'000'000;
const long long INF64 = 4'000'000'000'000'000'000;
const int MOD7 = 1'000'000'007;
const int MOD9 = 1'000'000'009;

void ERROR(int num) { printf("ERROR%d!\n",num); }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
int dx[8]={-1,0,1,0,1,1,-1,-1};
int dy[8]={0,-1,0,1,1,-1,1,-1};

int n;
vector<int> a;

int LIS(){
	int N = a.size();
	vector<int> dp(N,INF32);
	rep(i,N){
		auto it = lower_bound(dp.begin(),dp.end(),a[i]);
		*it = a[i];
	}
	return lower_bound(dp.begin(),dp.end(),INF32) - dp.begin();
}

int main(){
	cin >> n;
	a.resize(n);
	rep(i,n){
		cin >> a[i];
	}

	int ans = LIS();
	cout << ans << endl;
}


Measured memory_bytes: 3600
#include <iostream>
#include <cstdio>
#include <vector>
#include <cstring>
#include <bitset>
#include <cmath>
#include <iomanip>
#include <stack>
#include <set>
#include <queue>
#include <algorithm>
#include <deque>
#include <map>
#include <cmath>
#include <iomanip>
using namespace std;

#define INF 1e18
#define int long long

template<typename T> void printVec(vector<T>& v) {
    for(int i = 0; i < v.size(); i++) {
        cout << v[i] << " ";
     }
     cout << endl;
}

signed main() {
    int n, k, q; cin >> n >> k >> q;
    vector<int> a(q);
    for(int i = 0; i < q; i++) cin >> a[i];

    vector<int> p(n, k);
    for(int i = 0; i < q; i++) {
        p[a[i] - 1]++;
    }

    for(int i = 0; i < n; i++) {
        if(p[i] - q <= 0) cout << "No" << endl;
        else cout << "Yes" << endl;
    }

    return 0;
}


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

int main() {
    ll n,m,x;
    std::cin >> n>>m>>x;
    vector<ll> c(n);
    vector<vector<ll>> a(n,vector<ll>(m,0));
    for (int i = 0; i < n; i++) {
        std::cin >> c[i];
        for (int j = 0; j < m; j++) {
            std::cin >> a[i][j];
        }
    }
    ll ans = 1e15;
    
    for (int i = 0; i < (1<<n); i++) {
        vector<ll> b(m,0);
        ll mo = 0;
        for (int j = 0; j < n; j++) {
            if(i&(1<<j)){
                mo += c[j];
                for (int k = 0; k < m; k++) {
                    b[k] += a[j][k];
                }
            }
        }
        bool ok = true;
        for (int j = 0; j < m; j++) {
            if(b[j]<x){
                ok = false;
                break;
            }
        }
        
        if(ok){
            ans = min(ans,mo);
        }
    }
    if(ans==1e15){
        std::cout << -1 << std::endl;
    }else{
        std::cout << ans << std::endl;
    }
}


Measured memory_bytes: 3636
class UnionFind
  attr_accessor :parent, :size
  
  def initialize(n)
    @parent = []
    @size = []
    n.times do |i|
      @parent[i] = i
      @size[i] = 1
    end
  end

  def root(x)
    if @parent[x] == x
      return x
    else
      return @parent[x] = root(@parent[x])
    end
  end

  def merge(x,y)
    x,y = root(x),root(y)
    return if x==y

    x,y = y,x if @size[x] < @size[y]
    @size[x] += @size[y]
    @parent[y] = x
  end
  
  def same(x,y)
    return root(x) == root(y)
  end
  
  def size(x)
    return @size[root(x)]
  end
end

n,m,k = gets.split.map(&:to_i)
uf = UnionFind.new(n+1)
friendCnt = [0]*(n+1)
blockCnt = [0]*(n+1)
m.times do
  a,b = gets.split.map(&:to_i) 
  uf.merge(a,b)
  friendCnt[a] += 1
  friendCnt[b] += 1
end
k.times do
  c,d = gets.split.map(&:to_i)
  if uf.same(c,d)
    blockCnt[c] += 1
    blockCnt[d] += 1
  end
end

1.upto(n) do |i|
  print uf.size(i) - friendCnt[i] - blockCnt[i] - 1
  print i == n ? "\n" : " "
end

Measured memory_bytes: 6128
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair< ll, ll > Pi;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
const ll INF = 1LL << 60;
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;}
#define all(x) x.begin(), x.end()
#define mp make_pair
bool compare(Pi a, Pi b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}

int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}
bool In_map(ll y,ll x,ll h,ll w){
    if(y<0 || x<0 || y>=h || x>=w){
        return 0;
    }else{
        return 1;
    }
}
const vector<ll> dx{1,0,-1,0};
const vector<ll> dy{0,1,0,-1};



int main() {
    ll A,B,K;
    cin>>A>>B>>K;
    ll ansa,ansb;
    ansa = max(A-K,ll(0));
    if(A<K){
        ansb = max(A+B-K,ll(0));
    }else{
        ansb = B;
    }
    
    cout << ansa<<" "<<ansb<<endl;
    
    return 0;
    

}


Measured memory_bytes: 3596
import java.util.*;
public class Main {

    public static void main(String[] args) {
        Scanner yomi = new Scanner(System.in);
        int n = yomi.nextInt();
        n = n-(yomi.nextInt()*2);
        if (n>=0) System.out.println(n);
        else System.out.println(0);
    }
}

Measured memory_bytes: 23252
/* HARE KRSNA HARE KRSNA KRSNA KRSNA HARE HARE
    HARE RAMA HARE RAMA RAMA RAMA HARE HARE  */

#include <bits/stdc++.h>
using namespace std;

#define nl "\n"
#define ff first
#define ss second
#define pp pop_back
#define pf pop_front
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define all(x) x.begin(),x.end()
#define test ll t; cin>>t; while(t--)
#define loop(i,s,n) for(ll i=s;i<n;i++)
#define rloop(i,s,n) for(ll i=s;i>=n;i--)
#define fill(a,value) memset(a,value,sizeof(a))

#define debug2(a)  for(auto x : a)  cout<<x<<" ";  cout<<nl;
#define debug4(a)  for(auto x : a)  cout<<x.ff<<" "<<x.ss<<nl;
#define debug1(a,n) loop(i,0,n)  cout<<a[i]<<" ";  cout<<nl;
#define debug3(a,n,m)  loop(i,0,n){ loop(j,0,m)	cout<<a[i][j]<<" ";	cout<<nl; }

typedef long long ll;
typedef long double ld;

typedef stack<ll> sll;
typedef queue<ll> qll;
typedef vector<ll> vll;
typedef vector<char> vc;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef pair<ll, pll> ppll;
typedef vector<vector<ll>> vvll;
typedef priority_queue<ll> pqll;

const ll mod = 1000000007;	//998244353;
const ld pi =  acos((ld) - 1);	//3.1415926535;

ll num_generator()		{   return rand() % 1000;	}
void array_generator(ll a[], ll n)		{   loop(i, 0, n)	a[i] = rand() % 100;	}

const ll mxn = 10000001;
bool prime[mxn];
ll spf[mxn];

void seive()
{
	prime[1] = true;
	loop(i, 2, mxn)
	{
		if (!prime[i])
		{
			spf[i] = i;
			for (ll j = i * i; j < mxn; j += i)
			{
				if (!prime[j])
				{
					prime[j] = true;
					spf[j] = i;
				}
			}
		}
	}
}

void solve()
{
	ll n;	cin >> n;
	ll ans = 0;
	seive();
	loop(i, 1, n + 1)
	{
		if (i == 1)	ans++;
		else
		{
			ll div = 1, d = spf[i], num = i;
			map<ll, ll> M;
			while (num != 1)
			{
				num /= d;
				M[d]++;
				d = spf[num];
			}
			for (auto m : M)
			{
				div *= (m.ss + 1);
			}
			ans += i * div;
		}
	}
	cout << ans;
}

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

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	// test
	solve();
	return 0;
}

Measured memory_bytes: 91520
# frozen_string_literal: true

# induce sort (internal routine)
def sa_is_induce(s, ls, sum_l, sum_s, lms)
  n = s.size
  sa = [-1]*n

  buf = [*sum_s] # deep copy
  lms.each{ |lms|
    if lms != n then
      sa[buf[s[lms]]] = lms
      buf[s[lms]] += 1
    end
  }

  buf = [*sum_l] # deep copy
  sa[buf[s[-1]]] = n-1
  buf[s[-1]] += 1
  sa.each{ |v|
    if v>=1 && !ls[v-1] then
      sa[buf[s[v-1]]] = v-1
      buf[s[v-1]] += 1
    end
  }

  buf = [*sum_l] # deep copy
  sa.reverse_each{ |v|
    if v>=1 && ls[v-1] then
      buf[s[v-1]+1] -= 1
      sa[buf[s[v-1]+1]] = v-1
    end
  }

  return sa
end

# SA-IS (internal routine)
def sa_is(s, upper)
  n = s.size

  return [] if n == 0
  return [0] if n == 1

  ls = [false]*n
  (n-2).downto(0){ |i|
    ls[i] = s[i]==s[i+1] ? ls[i+1] : s[i]<s[i+1]
  }

  sum_l = [0]*(upper+1)
  sum_s = [0]*(upper+1)
  n.times{ |i|
    if ls[i] then
      sum_l[s[i]+1] += 1
    else
      sum_s[s[i]] += 1
    end
  }
  0.upto(upper){ |i|
    sum_s[i] += sum_l[i]
    sum_l[i+1] += sum_s[i] if i<upper
  }

  lms = (1 ... n).select{ |i| !ls[i-1] && ls[i] }
  m=lms.size
  lms_map = [-1]*(n+1)
  lms.each_with_index{ |lms, id| lms_map[lms] = id }

  sa = sa_is_induce(s, ls, sum_l, sum_s, lms)

  return sa if m == 0

  sorted_lms = sa.select{ |sa| lms_map[sa] != -1 }
  rec_s = [0]*m
  rec_upper = 0
  rec_s[lms_map[sorted_lms[0]]] = 0
  1.upto(m-1){ |i|
    l, r = sorted_lms[i-1, 2]
    end_l = lms[lms_map[l]+1]||n
    end_r = lms[lms_map[r]+1]||n
    same = true
    if end_l-l != end_r-r then
      same = false
    else
      while l < end_l do
        break if s[l] != s[r]
        l+=1
        r+=1
      end
      same = false if l==n || s[l]!=s[r]
    end
    rec_upper += 1 if not same
    rec_s[lms_map[sorted_lms[i]]] = rec_upper
  }

  sa_is(rec_s, rec_upper).each_with_index{ |rec_sa, id|
    sorted_lms[id] = lms[rec_sa]
  }

  return sa_is_induce(s, ls, sum_l, sum_s, sorted_lms)
end

# suffix array for array of integers or string
def suffix_array(s, upper = nil)
  if not upper then
    case s
    when Array
      # compression
      n = s.size
      idx = (0 ... n).sort_by{ |i| s[i] }
      t = [0]*n
      upper = 0
      t[idx[0]] = 0
      1.upto(n-1){ |i|
        upper += 1 if s[idx[i-1]] != s[idx[i]]
        t[idx[i]] = upper
      }
      s = t
    when String
      upper = 255
      s = s.bytes
    end
  else
    s.each{ |s|
      raise ArgumentError if s<0 || upper<s
    }
  end
  return sa_is(s, upper)
end

# frozen_string_literal: true

# lcp array for array of integers or string
def lcp_array(s, sa)
  s = s.bytes if s === String

  n = s.size
  rnk = [0]*n
  sa.each_with_index{ |sa, id|
    rnk[sa] = id
  }

  lcp = [0]*(n-1)
  h = 0
  n.times{ |i|
    h -= 1 if h > 0
    next if rnk[i] == 0
    j = sa[rnk[i]-1]
    h += 1 while j+h<n && i+h<n && s[j+h]==s[i+h]
    lcp[rnk[i]-1] = h
  }
  return lcp
end

s = gets.chomp
lcp = lcp_array(s, suffix_array(s))
ans = s.size*(s.size+1)/2
lcp.each{ |lcp| ans -= lcp }
puts ans

Measured memory_bytes: 63612
#include<bits/stdc++.h>
#define ll long long
#define MAX 1000005
#define MOD (ll)(1e9+7)
using namespace std;

int main()	
{
	int n;
	cin >> n;
	ll a[n];
	for(int i=0; i<n; i++)	cin >> a[i];
	ll ans=0;
	for(int i=0; i<n-1; i++)	{
		for(int j=i+1; j<n; j++)	ans+=a[i]*a[j];
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3464
#include <deque>
#include <iostream>

using namespace std;

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

    bool forward = n % 2 == 0;
    deque<unsigned long long> b;
    for (int i = 0; i < n; i++) {
        unsigned long long ai;
        cin >> ai;
        if (i % 2 == 0) {
            b.push_back(ai);
        } else {
            b.push_front(ai);
        }
    }

    if (forward) {
        for (auto b_ptr = b.begin(); b_ptr != b.end(); b_ptr++) {
            cout << *b_ptr << " ";
        }
    } else {
        for (auto b_ptr = b.rbegin(); b_ptr != b.rend(); b_ptr++) {
            cout << *b_ptr << " ";
        }
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 3840
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
 
using namespace std;
 
static const double PI = acos(-1.0);
 
class Vec2
{
public:
    Vec2( double _x, double _y ) : x(_x), y(_y) {}
 
    double length() const { return sqrt(x*x + y*y); }
    double arg() const {
        if ( length() == 0 ) return 0.0;
        return atan2(y, x);
    }
    Vec2 normalize() const {
        if ( length() == 0 ) return *this;
        return Vec2(x/length(), y/length());
    }
 
    Vec2 operator+( const Vec2& rhs ) const { return Vec2(x+rhs.x, y+rhs.y); }
    Vec2 operator-( const Vec2& rhs ) const { return Vec2(x-rhs.x, y-rhs.y); }
    Vec2 operator*( double s ) const { return Vec2(x*s, y*s); }
    double dot( const Vec2& rhs ) const { return x*rhs.x + y*rhs.y; }
    double cross( const Vec2& rhs ) const { return x*rhs.y - y*rhs.x; }
 
private:
    double x;
    double y;
};
 
double DiffAngle( const Vec2& A, const Vec2& B )
{
    double d = fabs(A.arg()-B.arg());
    if ( d > PI ) d = 2*PI-d;
    return d;
}
 
vector<Vec2> IntSegCircle( const Vec2& A, const Vec2& B, double r )
{
    vector<Vec2> IntPoint;
    Vec2 D = B - A;
    Vec2 DU = D.normalize();
    Vec2 H = A - DU*(A.dot(DU));
    double h = H.length();
    if ( h >= r )
        return vector<Vec2>();
 
    double l = sqrt(r*r - h*h);
    double pa = (A-H).dot(DU), pb = (B-H).dot(DU);
    if ( pa < -l && -l < pb ) {
        IntPoint.push_back(H - DU*l);
    }
    if ( pa < l && l < pb ) {
        IntPoint.push_back(H + DU*l);
    }
    return IntPoint;
}
 
double IntTriCircle( const Vec2& A, const Vec2& B, double r )
{
    vector<Vec2> Int = IntSegCircle( A, B, r );
    if ( Int.empty() ) {
        return min( 0.5*r*r*DiffAngle(A,B), 0.5*A.length()*B.length()*sin(DiffAngle(A,B)) );
    } else if ( Int.size() == 1 ) {
        double area = 0.0;
        if ( A.length() > r ) {
            area += 0.5*r*r*DiffAngle(A,Int[0]);
        } else {
            area += 0.5*A.length()*r*sin(DiffAngle(A,Int[0]));
        }
        if ( B.length() > r ) {
            area += 0.5*r*r*DiffAngle(B,Int[0]);
        } else {
            area += 0.5*B.length()*r*sin(DiffAngle(B,Int[0]));
        }
        return area;
    } else {
        return 0.5*r*r*(sin(DiffAngle(Int[0],Int[1])) + DiffAngle(A,B) - DiffAngle(Int[0],Int[1]));
    }
}
 
double solve( int R, const vector<Vec2>& Poly )
{
    double area = 0.0;
    for ( size_t i = 0; i < Poly.size()-1; i++ ) {
        double coef = Poly[i].cross(Poly[i+1]) > 0 ? 1.0 : -1.0;
        area += coef * fabs(IntTriCircle(Poly[i], Poly[i+1], R));
    }
    return area;
}
 
int main()
{
    int N, R;
    cin >> N >> R;
 
    vector<Vec2> Poly;
    for ( int i = 0; i < N; i++ ) {
        double x, y;
        cin >> x >> y;
        Poly.push_back( Vec2(x,y) );
    }
    Poly.push_back( Poly.front() );
 
    printf( "%.10f\n", solve( R, Poly ) );
    return 0;
}


Measured memory_bytes: 3700
ant =[]
ind = 0

for i in range(5):
    ant.append(int(input()))
k = int(input())

for i in range(5):
    for j in range(i,5):
        if ant[j] - ant[i] > k:
            ind += 1
if ind <= 0:
    print('Yay!')
else:
    print(':(')



Measured memory_bytes: 2940
#include <stdio.h>


int main()
{
	int a, b, c, d, e, f, delta;
	double x, y;

	while(scanf("%d %d %d %d %d %d", &a, &b, &c, &d, &e, &f) != EOF){
		delta = a * e - b * d;
		x = (double)(c*e-b*f)/delta;
		y = (double)(a*f-c*d)/delta;

		if(x == 0){ x = 0; }
		if(y == 0){ x = 0; }
		printf("%.3lf %.3lf\n", x, y);
	}
	
    return 0;
}

Measured memory_bytes: 636
#include <iostream>
#include <istream>
#include <vector>
#include <functional>
#include <algorithm>

using namespace std;

int main() {
  string S;
  
  cin >> S;
  
  int hug = 0;
  for (int i = 0; i < (S.size() + 1) / 2; ++i) {
    int fidx = i;
    int lidx = S.size() - 1 - i;
    if (S[fidx] != S[lidx]) {
      hug++;
    }
  }

  cout << hug << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &vec){ os << "["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const deque<T> &vec){ os << "deq["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa){ os << "(" << pa.first << "," << pa.second << ")"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const unordered_map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename T> void ndarray(vector<T> &vec, int len) { vec.resize(len); }
template<typename T, typename... Args> void ndarray(vector<T> &vec, int len, Args... args) { vec.resize(len); for (auto &v : vec) ndarray(v, args...); }
template<typename T> void Max(T &m, const T q) { if (m < q) m = q; }
template<typename T> void Min(T &m, const T q) { if (m > q) m = q; }
template<typename T1, typename T2> pair<T1, T2> operator+(pair<T1, T2> &l, pair<T1, T2> &r) { return make_pair(l.first + r.first, l.second + r.second); }
template<typename T1, typename T2> pair<T1, T2> operator-(pair<T1, T2> &l, pair<T1, T2> &r) { return make_pair(l.first - r.first, l.second - r.second); }
#define dbg(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ") " << __FILE__ << endl;

string s;
int K;

int main()
{
    cin >> s >> K;
    REP(i, s.length())
    {
        if (s[i] == 'a') continue;
        if ('z' - s[i] + 1 <= K)
        {
            K -= 'z' - s[i] + 1;
            s[i] = 'a';
        }
    }
    s.back() = (char)((s.back() + K - 'a') % 26 + 'a');
    cout << s << endl;
}


Measured memory_bytes: 592
#include <cmath>
#include <cstdio>
#include <algorithm>
using namespace std;
const int dx[8] = { 0, 1, 1, 1, 0, -1, -1, -1 };
const int dy[8] = { -1, -1, 0, 1, 1, 1, 0, -1 };
char c[8][9];
int place(int x, int y, char t, bool m) {
	int ret = 0;
	for (int i = 0; i < 8; i++) {
		int px = x + dx[i], py = y + dy[i];
		bool flag = false;
		while (0 <= px && px < 8 && 0 <= py && py < 8) {
			if (c[py][px] == '.') break;
			if (c[py][px] == t) {
				flag = true; break;
			}
			px += dx[i];
			py += dy[i];
		}
		if (flag) {
			int qx = x, qy = y, q = 0;
			while (qx != px || qy != py) {
				if(m) c[qy][qx] = t;
				qx += dx[i];
				qy += dy[i];
				if (q++ > 0) ret++;
			}
		}
	}
	return ret;
}
int main() {
	for (int i = 0; i < 8; i++) scanf("%s", &c[i]);
	int t = 0, v = 0;
	while (true) {
		int x = -1, y = -1, r = 0;
		for (int i = 0; i < 8; i++) {
			for (int j = 0; j < 8; j++) {
				if (c[i][j] == '.') {
					int p = place(j, i, t % 2 == 0 ? 'o' : 'x', false);
					if (p >= r && p >= 1 && t % 2 == 1) { x = j; y = i; r = p; }
					else if (p > r && p >= 1) { x = j; y = i; r = p; }
				}
			}
		}
		if (r == 0) { if (v == 0) { v = 1; t++; continue; } break; }
		else { place(x, y, t++ % 2 == 0 ? 'o' : 'x', true); v = 0; }
	}
	for (int i = 0; i < 8; i++) printf("%s\n", c[i]);
	return 0;
}

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

#define ll long long 

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

    int n; cin >> n;
    vector<int> a(n);
    for (auto& x : a) cin >> x;
    int sieve[1000010] = {0};
    sort(a.begin(), a.end());
    int ones = 0;
    for (auto x : a) {
        if (x == 1) ones++;
        sieve[x]++;
    }

    if (ones == 1) {
        cout << 1 << endl;
        return 0;
    }
    if (ones > 1) {
        cout << 0 << endl;
        return 0;
    }

    for (auto x : a) {
        for (int y = x+x; y <= 1000000; y += x) 
            sieve[y] = 0;
    }

    int ans = 0;
    for (int i = 1; i <= 1000000; i++){
        if (sieve[i] == 1) ans++;
    }

    cout << ans << endl;



    return 0; 
}



Measured memory_bytes: 7940
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>

using namespace std;

void max_heapify(vector<int> &A, size_t i) {
    size_t l=i<<1, r=i<<1|1;
    size_t largest=(l<A.size()&&A[l]>A[i]? l:i);
    if (r<A.size() && A[r]>A[largest])
        largest = r;

    if (largest != i) {
        swap(A[i], A[largest]);
        max_heapify(A, largest);
    }
}

void max_heapify(vector<int> &A) {
    for (size_t i=(A.size()>>1)+1; --i;)
        max_heapify(A, i);
}

int main() {
    size_t H;
    scanf("%zu", &H);

    vector<int> A(H+1);
    for (size_t i=1; i<=H; ++i)
        scanf("%d", &A[i]);

    max_heapify(A);

    for (size_t i=1; i<=H; ++i)
        printf(" %d", A[i]);

    printf("\n");

    return 0;
}

Measured memory_bytes: 4136
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <numeric>

using namespace std;
int gcd(int a,int b){
   if(b==0)return a;
   return gcd(b,a%b);
}
long long lcm(int a,int b){
   return (long long)a*b/(long long)gcd(a,b);
}


int main(){
    int n;
    cin>>n;
    cout<<lcm(2,n)<<endl;
    
    
}


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

int GCD(int x,int y){
  if(y == 0) return x;
  return GCD(y,x%y);
}

int main() {
  int n;
  cin >> n;
  vector<int>a(n);
  rep(i,0,n) cin >> a[i];
  int gcd = a[0];
  rep(i,1,n) gcd = GCD(gcd,a[i]);
  cout << gcd << endl;
}

Measured memory_bytes: 3740
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <cmath>
#include <tuple>
#include <bitset>
#include <utility>
#include <climits>
#include <iomanip>
#include <queue>
 
#define push emplace_back
#define each(i, x) for (auto i=0; i < x; i++)
using ull = unsigned long long;
constexpr auto mod = 1000000007;
constexpr auto INF = ULLONG_MAX;
 
using namespace std;
template <typename T> inline void dump(const T& x) { cout << "[" << x << "]" << endl; }
template <typename T> inline void dump(const vector<T>& x) { for (const auto v : x) { cout << v << " "; } cout << endl; }
template <typename T> inline void sort_asc(vector<T>& x) { std::sort(x.begin(), x.end()); }
template <typename T> inline void sort_desc(vector<T>& x) { std::sort(x.begin(), x.end(), greater<T>()); }
template <typename T> inline T max_value(vector<T>& x) { return *max_element(x.begin(), x.end()); }
template <typename T> inline T min_value(vector<T>& x) { return *min_element(x.begin(), x.end()); }
template <typename T> inline T sum_value(vector<T>& x) { return accumulate(x.begin(), x.end(), 0ULL); }

int main() {
  //std::cout << std::fixed << std::setprecision(10);
  ull n;
  cin >> n;

  vector<ull> d = {};
  each(i, n) {
    ull tmp;
    cin >> tmp;
    d.push(tmp);
  }

  sort_asc(d);

  const auto f = d[(d.size() / 2) - 1];
  const auto b = d[(d.size() / 2)];

  cout << b - f << endl;

  return 0;
}


Measured memory_bytes: 1528
#include<bits/stdc++.h>
using namespace std;
int a[102];
int main(){
    /// input
    int n,x;
    cin>>x>>n;
    for(int i=0;i<n;i++)cin>>a[i];
    /// process
    int dis = 1e9;
    int ans = 1000;
    for(int i=0;i<=101;i++){
        bool found = false;
        for(int j=0;j<n;j++){
            if(i==a[j]){
                found = true;
                break;
            }
        }
        if(found)continue;
        int tmp = abs(x-i);
        if(tmp<dis){
            dis = tmp;
            ans = i;
        }
    }


    /// output

    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3640
#include <algorithm>
#include <stack>
#include <queue>
#include <deque>
#include <vector>
#include <string>
#include <string.h>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <map>
#include <set>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <numeric>
#include <cctype>
#include <bitset>
#include <cassert>
#define fi first
#define se second
#define pb push_back
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const int MX = 100005, INF = 1001001001;
const ll LINF = 1e18;
const double eps = 1e-10;
const int DIV = 1e9+7;

int n;
vi a;

int main(){
  cin >> n;
  a.resize(n);
  rep(i, n) cin >> a[i];
  sort(a.begin(), a.end());

  vector<vector<int>::iterator > v;
  for(auto it = a.begin() + 1; it != a.end(); it++){
    if(*it == *(it-1))v.pb(it);
  }

  while(v.size()){
    if((int)v.size() == 1){
      if(v[0] + 1 < a.end()){
        a.erase(a.end() - 1);
        a.erase(v[0]);
      }
      else {
        a.erase(v[0]);
        a.erase(a.begin());
      }
      break;
    }
    a.erase(v[(int)v.size()-1]); a.erase(v[(int)v.size()-2]);
    v.erase(v.end()-1); v.erase(v.end()-1);
  }
  cout << (int)a.size() << endl;

  return 0;
}


Measured memory_bytes: 1912
N,M=map(int,input().split())
X=list(map(int,input().split()))
Y=[]
X.sort()
ans=0
if N>=M:
    print(0)
    exit()
for i in range(M-1):
    Y.append(X[i+1]-X[i])
Y.sort(reverse=True)
for j in range(N-1):
    ans+=Y[j]-1

print(X[M-1]-X[0]+1-ans-N)


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

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

	for(int i=0; i<=n; i++){
		if(int(i*1.08)==n){
			cout<<i<<endl;
			return 0;
		}
	}

	cout<<":("<<endl;

	return 0;
}

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

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

    int ma = 0, a;
    rep(i, N) {
        cin >> a;
        ma = max(ma, a);
    }

    cout << max(2 * ma - 1 - K, 0) << endl;

    return 0;
}


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


int main() {
    vector<string> s(10);
    s[0]="pon";
    s[1]="pon";
    s[2]="hon";
    s[3]="bon";
    s[4]="hon";
    s[5]="hon";
    s[6]="pon";
    s[7]="hon";
    s[8]="pon";
    s[9]="hon";

    int n; cin >> n;
    cout << s[n%10] << endl;
    return 0;
}

Measured memory_bytes: 3624
// -*- mode:c++; coding:utf-8; c-basic-offset:2; -*-
// ALDS1_11_B: Depth First Search

#include <algorithm>
#include <cstdio>
#include <stack>
#include <utility>

using uint = unsigned int;

class Graph {
  const uint n_;
  uint* const g_;
  std::pair<uint, uint>* const visited_;
  uint time_;
  
public:
  Graph(uint n) : n_(n),
                  g_(new uint[(n_*n_)]),
                  visited_(new std::pair<uint, uint>[n_])
  {
    std::fill(g_, g_+(n_*n_), 0u);
  }

  ~Graph()
  {
    delete[] g_;
    delete[] visited_;
  }
  
  uint* operator [](uint i) const { return g_+(n_*i); }

  std::pair<uint, uint>* visited() const { return visited_; }

  void dfs()
  {
    init_visited();
    for (auto i = 0u; i < n_; ++i) {
      if (visited_[i].first) continue;
      inner_dfs(i);
    }
  }

private:
  void init_visited()
  {
    time_ = 0u;
    for (auto i = 0u; i < n_; ++i) {
      visited_[i].first = 0u;
    }
  }

  void inner_dfs(uint i)
  {
    std::stack<uint> s;
    s.push(i);
    visited_[i].first = time_++;
    auto last_visited = i;
  outer_loop:
    while (!s.empty()) {
      auto j = s.top();
      for (auto k = last_visited+1; k < n_; ++k) {
        if ((*this)[j][k] && !visited_[k].first) {
          s.push(k);
          visited_[k].first = time_++;
          goto outer_loop;
        }
      }
      s.pop();
      visited_[j].second = time_++;
      last_visited = j;
    }
  }
};

int main()
{
  uint n;
  std::scanf("%u", &n);

  Graph g(n);

  uint u, k, v;
  for (auto i = 0u; i < n; ++i) {
    std::scanf("%u %u", &u, &k);
    for (auto j = 0u; j < k; ++j) {
      std::scanf("%u", &v);
      g[u-1][v-1] = 1;
    }
  }

  g.dfs();
  auto visited = g.visited();
  for (auto i = 0u; i < n; ++i) {
    std::printf("%u %u %u\n", i+1, visited[i].first+1, visited[i].second+1);
  }
}

// eof

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

long long n, m = 0;

int main()
{
	cin >> n;

	m = (n / 15) * (n / 15) * 60;

	for (long long i = (n / 15) * 15; i <= n; i++) {
		if (i % 3 != 0 && i % 5 != 0)
			m += i;
	}

	cout << m << endl;
}

Measured memory_bytes: 3632
#define _CRT_SECURE_NO_WARNINGS
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<functional>
#include<iomanip>
#include<iostream>
#include<list>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<utility>
#include<vector>

#define ll long long
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define FORR(i,a,b) for(int i=(a);i>=(b);--i)
#define REPR(i,n)   FORR(i,n,0)

using namespace std;

int main() {
	int N, T, c[1000], t[1000], ans = 10000;
	cin >> N >> T;
	REP(i, N) {
		cin >> c[i] >> t[i];
	}

	REP(i, N) {
		if (t[i] <= T) {
			ans = min(ans, c[i]);
		}
	}
	if (ans == 10000) {
		cout << "TLE" << endl;
		return 0;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <string>
#include <string.h>
#include <vector>
#include <functional>

using namespace std;
typedef long long ll;

int main()
{
	int N, M;
	int A[1000];
	scanf("%d %d", &N, &M);
	for(int i = 0; i < N; i++){
		scanf("%d", &A[i]);
	}
	
	int sum = 0;
	for(int i = 0; i < N; i++){
		sum += A[i];
	}
	
	float limit = sum / (4.0 * M);
	int count = 0;
	for(int i = 0; i < N; i++){
		if(A[i] >= limit){
			count ++;
		}
	}
	
	if(count >= M){
		printf("Yes\n");
	}else{
		printf("No\n");
	}
}

Measured memory_bytes: 128
#include<stdio.h>

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

Measured memory_bytes: 128
import java.util.*;

public class Main{
  public static void main(String[]args){
    Scanner sc = new Scanner(System.in);
    int N = Integer.parseInt(sc.nextLine());
    int odd = 1;
    
    for(int i = 0; i < N; i++){
      int n = Integer.parseInt(sc.next());
      if(n%2 == 0){
        odd *= 2;
      }
    }
    int sum = (int)Math.pow(3,N);
    System.out.println(sum-odd);
  }
}

Measured memory_bytes: 21844
from itertools import permutations

a = list(map(int,input().split()))
permutation = list(permutations([0,1,2]))

ans = []
for i in range(len(permutation)):
    ans.append(abs(a[permutation[i][0]]-a[permutation[i][1]])+abs(a[permutation[i][1]]-a[permutation[i][2]]))

print(min(ans))

Measured memory_bytes: 38256
N = list(input())

if N[-1] == "2" or N[-1] == "4" or N[-1] == "5" or N[-1] == "7" or N[-1] == "9":
  print("hon")
elif N[-1] == "0" or N[-1] == "1" or N[-1] == "6" or N[-1] == "8":
  print("pon")
else:
  print("bon")

Measured memory_bytes: 9064
# -*- coding: utf-8 -*-


def main(n, D):
    D = set(D)
    while set(str(n)) & D:
        n += 1
    return n


if __name__ == '__main__':
    n, _ = [int(e) for e in input().split()]
    D = [e for e in input().split()]
    print(main(n, D))

Measured memory_bytes: 3060
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace AtCoder
{
	public class ABC
	{
		static readonly int mod = 1000000007;  // 10^9+7

		static void Main(string[] args)
		{
			Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });


			//string s = Console.ReadLine();
			int n = int.Parse(Console.ReadLine());
			//long x = long.Parse(Console.ReadLine());
			int[] p = Console.ReadLine().Split().Select(int.Parse).ToArray();
			int ans = 0;
			int min = int.MaxValue;
			for (int i = 0; i < n; i++) {
				min = Math.Min(min, p[i]);
				if (p[i] <= min) {
					ans++;
				}
			}
			Console.WriteLine(ans);


			Console.Out.Flush();
		}
	}
}


Measured memory_bytes: 33628
//
// Created by yamunaku on 2019/12/22.
//

#include <bits/stdc++.h>

using namespace std;

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repl(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perl(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD9 998244353
#define MOD1 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
#define SP <<" "<<
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define CFS cin.tie(0);ios::sync_with_stdio(false)
#define CST(x) cout<<fixed<<setprecision(x)

using ll = long long;
using ld = long double;
using vi = vector<int>;
using mti = vector<vector<int>>;
using vl = vector<ll>;
using mtl = vector<vector<ll>>;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
template<typename T>
using heap = priority_queue<T, vector<T>, function<bool(const T, const T)>>;

int main(){
    // CFS;
    ll n;
    cin >> n;
    if(n % 2){
        cout << 0 << endl;
        return 0;
    }
    ll ans = 0, ans2 = 0;

    ll m = n/2;
    while(m){
        ans += m / 5;
        m /= 5;
    }

    while(n){
        ans2 += n / 2;
        n /= 2;
    }
    cout << min(ans, ans2) << endl;
    return 0;
}

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

typedef long long ll;
//const int INF = 2e9;
//const ll INF = 9e18;


int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    string T;
    cin >> T;
    for (int i=0;i<T.size();i++){
        if (T[i] == '?') T[i] = 'D';
    }
    cout << T << "\n";
}

Measured memory_bytes: 3784
#include <iostream>
#include <string>
#include <cctype>
using namespace std;

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

int main(){
	string W,T;
	long long int c=0;
	cin >> W;
	for (int i = 0; i < W.length(); i++){
		if (isupper(W[i])){
			W[i] = tolower(W[i]);
		}
	}
	while (cin>>T){
		if (T == "END_OF_TEXT")break;
		for (int i = 0;i<T.length(); i++){
			if (isupper(T[i])){
				T[i] = tolower(T[i]);
			}
		}
		if (T == W)c++;
	}
	cout << c << '\n';
	return 0;
}

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

ll a[402];
ll prefix[402];
ll dp[402][402];
ll solve(ll l, ll r)
{
    if(l>=r)
        return 0;
    if(dp[l][r]!=-1)
        return dp[l][r];
    ll temp=LLONG_MAX;
    for(ll k=l;k<r;k++)
    {
        temp=min(temp,solve(l,k)+solve(k+1,r)-prefix[l-1]+prefix[r]);
    }
    return dp[l][r]=temp;
}

void test_case()
{
    memset(dp,-1,sizeof(dp));
    ll n;
    cin>>n;
    for(ll i=1;i<=n;i++)
    {
        cin>>a[i];
        prefix[i]=a[i]+prefix[i-1];
    }
    cout<<solve(1,n);
}

int main()
{
    fastio
//    int t;
//    cin>>t;
//    while(t--)
    test_case();
}


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


const long long INF = 1LL << 60;

int main() {
    INT n,k;
    cin >> n >> k;
    
    while (k < 2 * n) {
        if (n > k)n = n % k;
        else n = k - n;
    }

    cout << n << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define _h cout<<"here"<<endl;
#define fill(a,v) memset(a,v,sizeof(a));
#define all(v) v.begin(),v.end()
#define rep(i,n) for(int i=0;i<n;i+=1)
#define prarr(a,n) rep(i,n) cout<<a[i]<<" \n"[i==n-1];// printf("%s\n"," " );
#define ff first
#define ss second
#define pu push_back
const int inf = 1e9+10;
const ll INF = 1e16+10;
const int MOD = 1e9+7;
const int MAXN = 2e5+10;

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

Measured memory_bytes: 256
import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.List

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
    [s, w] <- getIntList
    putStrLn $ if w >= s then "unsafe" else "safe"

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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int n; cin>>n;
	int64_t ans=0;
	for(int i=1;i<n;++i){
		int64_t L=1,R=n;
		while(R-L>1){
			int64_t M=(L+R)/2;
			if(i*M<n)L=M;
			else R=M;
		}
		ans+=L;
	}
	cout<<ans<<"\n"s;
}


Measured memory_bytes: 3648
let print_array a = 
  let _ = Array.iter (Printf.printf "%d ") a in print_newline()

let () =
  let s = read_line() in
  let n = String.length s in
  let ans = Array.make n 0 in
  let rec for_loop i =
    if i = n-1 then ()
    else
      let _ =
        if s.[i] = 'R' && s.[i+1] = 'L' then
          let rec inner_loop_l j =
            if j < 0 || s.[j] != 'R' then ()
            else
              let k = i + (i-j) mod 2 in
              let _ = ans.(k) <- ans.(k) + 1 in
              inner_loop_l (j-1) in
          let rec inner_loop_r j =
            if j == n || s.[j] != 'L' then ()
            else
              let k = i + (j-i) mod 2 in
              let _ = ans.(k) <- ans.(k) + 1 in
              inner_loop_r (j+1) in
          let _ = inner_loop_l i in
          inner_loop_r (i+1) in
      for_loop (i+1) in
  let _ = for_loop 0 in
  print_array ans


Measured memory_bytes: 5632
#include <utility>
#include <vector>
#include <iostream>
#define REP(i,n) for(int i=0;i<n;i++)
typedef unsigned long ul;
using namespace std;
int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);
    int A, B, X;
    cin >> A >> B >> X;
    if(X >= A && (A+B) >= X){
        cout << "YES" <<endl;
    }else{
        cout<< "NO" << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int maxx = 2e3 + 7;
const int Inf = 1 << 30;
const LL INF = 1LL << 60;
int n, x, y;
int ans[maxx];

int main() {
	//暴力求每对点的最短距离, 要么就是i、j直达,要么就是i到x, x到y, y到j
	cin >> n >> x >> y;
	for(int i = 1; i <= n; i++) {
		for(int j = i + 1; j <= n; j++) {
			int pos = min(j - i, abs(x - i) + abs(j - y) + 1); //加边后x到y就一步
			ans[pos]++;
		}
	}
	for(int i = 1; i < n; i++) cout << ans[i] << endl;
	return 0;
}

Measured memory_bytes: 256