akhauriyash/Code-Regression huggingface dataset:
#[allow(dead_code)]
fn scan<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

#[allow(dead_code)]
fn scan_split<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace()
        .map(|t| t.parse().ok().unwrap()).collect()
}

#[allow(dead_code)]
fn scan_split_with<T: std::str::FromStr>(ch: char) -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split(ch)
        .map(|t| t.parse().ok().unwrap()).collect()
}

#[allow(dead_code)]
fn scan_lines<T: std::str::FromStr>(n: usize) -> Vec<T> {
    (0..n).map(|_| scan::<T>()).collect()
}

#[allow(unused_macros)]
macro_rules! scan_as_tuple {
    ( $t:ty ) => {
        (scan::<$t>(),)
    };
    ( $( $t:ty ),* ) => {
        {
            let mut s = String::new();
            std::io::stdin().read_line(&mut s).ok();
            let v = s.trim().split_whitespace();
            let mut it = v;
            let ret = ( $(it.next().unwrap().parse::<$t>().ok().unwrap()),* );
            assert!(it.next() == None, "not all tokens consumed");
            ret
        }
    };
}

fn main() {
    let (a, b, c, d) = scan_as_tuple!(i32, i32, i32, i32);
    println!("{}", std::cmp::max(a*b ,c*d));
}

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
typedef pair<int,int> pii;
typedef pair<long long, int> pli;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

ll mod = 1000000007;

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

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

  int n;
  cin >> n;
  set<int> st;
  map<int,int> cnt;

  ll s = 0;
  rep(i,n){
    int a;
    cin >> a;
    st.insert(a);
    cnt[a]++;
    s += a;
  }

  int q;
  cin >> q;
  rep(i,q){
    int b,c;
    cin >> b >> c;
    if(cnt[b] == 0){
      cout << s << endl;
      continue;
    }
    s += (ll)(c-b) * cnt[b];
    cout << s << endl;
    cnt[c] += cnt[b];
    cnt[b] = 0;
    st.erase(b);
    st.insert(c);
  }
}

Measured memory_bytes: 9736
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(void)
{
    IOS
    int a, b, c;
    cin >> a >> b >> c;
    int x, y;
    cin >> x >> y;

    int ans = 0;
    if (a+b > c*2) {
        int z = min(x,y);
        ans += z * c * 2;
        x -= z;
        y -= z;
        if (x > 0) {
            if (c * 2 < a) ans += c * x * 2;
            else ans += a * x;
        }
        if (y > 0) {
            if (c * 2 < b) ans += c * y * 2;
            else ans += b * y;
        }
    } else {
        ans += a * x + b * y;
    }

    cout << ans << '\n';

    return 0;
}

Measured memory_bytes: 256
use proconio::input;

fn main() {
    input! {
        n: usize,
        mut aa: [usize; n],
    }
    aa.sort();
    aa.reverse();

    let mut total: usize = 0;
    total += aa[0];
    for i in 1..(aa.len() / 2) {
        total += aa[i] * 2
    }
    if aa.len() % 2 == 1 {
        total += aa[aa.len() / 2];
    }
    print!("{}", total);
}


Measured memory_bytes: 6208
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e18;
const int inf = 1e9;
double pi = 3.14159265359;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define per(i, b, a) for (int i = a - 1; i >= b; i--)
using Graph = vector<vector<int>>;
using pint = pair<int, int>;
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
int dxx[8] = {1, 1, 1, 0, 0, -1, -1, -1}, dyy[8] = {-1, 0, 1, -1, 1, -1, 0, 1};

int main() {
    string s;
    cin >> s;
    int nl = 0, nr = s.size() - 1;
    int ans = 0;
    while (nl < nr) {
        if (s[nl] == s[nr]) {
            nl++, nr--;
        } else if (s[nl] == 'x') {
            nl++;
            ans++;
        } else if (s[nr] == 'x') {
            nr--;
            ans++;
        } else {
            cout << -1 << endl;
            return 0;
        }
    }
    cout << ans << "\n";
}

Measured memory_bytes: 512
#include <stdio.h>
#include <algorithm>
 
using namespace std;
 
int main(){
    int H,W;
    while(true){
        scanf("%d %d",&H,&W);
        if(H == 0 && W == 0) break;
        for(int i = 0; i < H; i++){
            for(int j = 0; j < W; j++){
                if((i+j)%2 == 0) printf("#");
                else{
                    printf(".");
                }
            }
            printf("\n");
        }
        printf("\n");
    }
}


Measured memory_bytes: 2684
#include <iostream>
#include <sstream>
#include <string>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <list>
#include <algorithm>
#include <ctime>
#include <limits>
#include <iomanip>
#include <functional>
#include <array>
#include <climits>
#include <cmath>

using namespace std;
using ll = long long;
const ll MOD = (ll)1e9 + 7;

int main()
{
    ll a, b, c;
    cin >> a >> b >> c;
    ll num = b / a;
    if (num > c) num = c;
    cout << num;
    return 0;
}



Measured memory_bytes: 256
n=int(input())
count=0
maxlen=[]
xlist=list(map(int,input().split()))
if n==1:
    print(0)
elif n==2:
    if xlist[0]>=xlist[1]:
        print(1)
    else:
        print(0)
else:
    for i in range(n - 1):
        if xlist[i] >= xlist[i + 1]:
            count += 1
            if i==n-2:
                maxlen.append(count)
        else:
            maxlen.append(count)
            count = 0
    print(max(maxlen))










Measured memory_bytes: 63856
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define rep(i,n) for (int i=0; i<(int)(n); i++)
#define ct(string) cout << string << endl

int main() {
    int n;
    cin >> n;
    vector<int> cost(n);
    vector<int> dp(n+1);
    rep(i,n) cin >> cost.at(i);
    dp.at(0) = 0;
    rep(i,n) {
        if (i == 0) {dp.at(1) = 0; continue;}
        if (i == 1) {dp.at(2) = abs(cost.at(i-1)-cost.at(i)); continue;}
        dp.at(i+1) = min(dp.at(i)+abs(cost.at(i)-cost.at(i-1)), dp.at(i-1)+abs(cost.at(i)-cost.at(i-2)));
    }
    ct(dp.at(n));
}

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

#ifdef DEBUG
#include "inc/debug.hpp"
#else
#define debug(...) 42
#endif

map<string, int> ans = {
    {"SUN", 7},
    {"MON", 6},
    {"TUE", 5},
    {"WED", 4},
    {"THU", 3},
    {"FRI", 2},
    {"SAT", 1}
};

int main() {
    string S;
    cin >> S;
    cout << ans[S] << endl;

    return 0;
}

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

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

int A, B;
set<int> SA, SB;

signed main()
{
    cin >> A >> B;

    SA.insert(1);
    SB.insert(1);

    for(int i = 2; i <= 1000000; i++)
    {
        while (A % i == 0)
        {
            SA.insert(i);
            A /= i;
        }
        
        while(B % i == 0)
        {
            SB.insert(i);
            B /= i;
        }
    }
    SA.insert(A);
    SB.insert(B);

    vector<int> v;
    set_intersection(SA.begin(), SA.end(), SB.begin(), SB.end(), back_inserter(v));

    cout << v.size() << endl;

    return 0;
}

Measured memory_bytes: 3608
# coding: utf-8
# Your code here!

S = list(map(int, list(input())))
K = int(input())

for i in range(len(S)):
    if S[i] != 1:
        if i < K:
            print(S[i])
        else:
            print(1)
        exit()
else:
    print(1)

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

int main() {
  int n, m;
  cin >> n >> m;
  vector<pair<int, int>> ans(m);
  for (int i = 0; i < m; i++) {
    cin >> ans.at(i).first;
    cin >> ans.at(i).second;
  }
  vector<int> second;
  vector<int> third;
  for (int i = 0; i < m; i++) {
    if (ans.at(i).first == 1) {
      second.push_back(ans.at(i).second);
    }
    if (ans.at(i).second == n) {
      third.push_back(ans.at(i).first);
    }
  }
  sort(second.begin(), second.end());
  sort(third.begin(), third.end());
  for (int i = 0; i < second.size(); i++) {
    if (binary_search(third.begin(), third.end(), second.at(i))) {
      cout << "POSSIBLE";
      return 0;
    }
  }

  cout << "IMPOSSIBLE";
  return 0;
}

Measured memory_bytes: 2812
#include <iostream>

using namespace std;

void solve()
{
	int q;
	cin >> q;
	long int sum = 0;
	for (int i = 0; i < q; ++i)
	{
		long int p, n;
		char c;
		cin >> p >> c >> n;
		if (c == '(')
		{
			sum += n;
		}
		else
		{
			sum -= n;
		}
		if (sum == 0)
		{
			cout << "Yes" << endl;
		}
		else
		{
			cout << "No" << endl;
		}
	}
}

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

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

int main() {
  int x, n;
  cin >> x >> n;
  vector<int> p(n);
  for (int i = 0; i < n; i++) {
    cin >> p.at(i);
    p.at(i) -= x;
  }
  
  for (int i = 0; i < 101; i++) {
    bool finish = false;
    bool key1 = true;
    bool key2 = true;
    for (int j = 0; j < n; j++) {
      if (p.at(j) == i)
        key1 = false;
      if (p.at(j) == i * -1)
        key2 = false;
    }
    if (key2) {
      cout << x - i << endl;
      break;
    }
      
    else if (key1) {
      cout << x + i << endl;
      break;
    }
  }
}

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

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
//#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;


int main(){
    int N; cin >> N;
    cout << (N+1)/2 << endl;
}

    



Measured memory_bytes: 256
#include <iostream>
#include<sstream>
#include<vector>
#include<iterator>
using namespace std;

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

	vector<long long> table(N+1);
	table[0] = 2;
	table[1] = 1;

	for(int i=2; i<=N; i++)
		table[i] = table[i-1] + table[i-2];

	cout << table[N] << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define omar main
#define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
//push_back make_pair emplace vector double float _unordered_map unodered_set queue stack sort begin end clear second first
using namespace std;

int omar() { fastIO
	int n; cin >> n;
	vector<int> arr, piv; 
	for (int i = 0 ; i < n ; i ++){
		int e; cin >> e;
		arr.push_back(e);
		piv.push_back(e);
	}
	int dif = 0;
	sort(arr.begin(), arr.end());
	for (int i = 0 ; i < n ; i++){
		if (arr[i] != piv[i])dif++;
	} cout << ((dif <= 2)? "YES" : "NO") << endl;
}


Measured memory_bytes: 3644
N=list(map(int, input().split()))
N=N[0]
A=list(map(int, input().split()))
B=list(map(int, input().split()))
B.append(0)
kill=0

temp=min(A[0],B[0])
kill+=temp
A[0]-=temp
B[0]-=temp

for i in range(1,N+1):
	temp=min(A[i],B[i-1])
	kill+=temp
	A[i]-=temp
	B[i-1]-=temp
	
	temp=min(A[i],B[i])
	kill+=temp
	A[i]-=temp
	B[i]-=temp

print(kill)

Measured memory_bytes: 18476
#include<queue>
#include<stack>
#include<math.h>
#include<cmath>
#include<bitset>
#include<stdio.h>
#include<string>
#include<map>
#include<algorithm>
#include<vector>
#include<iostream>
#include<utility>
#include<functional>
#include<deque>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int main(){
  ll w,h,x,y;
  cin >> w >> h >> x >> y;
  printf("%lld.",w*h/2);
  if(w*h%2==1){
    printf("5");
  }
  for(int i=0;i<12;i++){
    printf("0");
  }
  printf(" ");
  ll ans2=0;
  if(x*2==w && y*2==h){
    ans2=1;
  }
  printf("%d\n",ans2);
  return 0;
}

Measured memory_bytes: 3724
#include <bits/stdc++.h>
#define X first
#define Y second
typedef long long ll;
using namespace std;

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

int main () {

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

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
	int a;
	int b;
	int c;
	scanf("%d %d %d", &a, &b, &c);

	if((a < b) && (b < c))
	{
		printf("Yes\n");
	}
	else
	{
		printf("No\n");
	}

	return 0;
}



Measured memory_bytes: 2100
#include <iostream>
#include <stdexcept>
#include <cassert>
#include <cmath>
#include <vector>
#include <string>
using namespace std;


int main() {
  string S;
  cin >> S;

  int ans = 0, cur = 0;
  for (char c : S) {
    if (c == 'R') {
      cur++;
      ans = max(ans, cur);
    } else {
      cur = 0;
    }
  }

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


Measured memory_bytes: 3584
/*Bismillahir Rahmanir Rahim*/
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int d;
    cin>>d;
    if(d==25)
        cout<<"Christmas"<<endl;
    else if(d==24)
        cout<<"Christmas Eve"<<endl;
    else if(d==23)
        cout<<"Christmas Eve Eve"<<endl;
    else
        cout<<"Christmas Eve Eve Eve"<<endl;

    return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <complex>
#include <algorithm>
#include <vector>
#include <stack>
#include <string>
#include <queue>
#include <cmath>
#include <math.h>
#include <numeric>
#include <list>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <climits>
#include <set>
#include <memory.h>
#include <memory>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cassert>
#include <map>
#include <cassert>
#include <time.h>
#include <ctime>

using namespace std;

typedef complex<double> xy_t;
typedef pair<xy_t, xy_t> line;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<int , P> PP;
typedef pair<int, string> Ps;
typedef vector<int> vec;
typedef vector<vec> mat;
const int INF = 1 << 27;
const double EPS = 1e-9;
const double PI = 3.1415926535897932384626433832795;
const int CLK = CLOCKS_PER_SEC;

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

int main(){
	int n, m;
	while(cin>> n >> m && (n || m)){
		string chair(n, '#');
		char ch;
		rep(i, m){
			cin >> ch;
			if(ch == 'A'){
				rep(j, n){
					if(chair[j] == '#'){
						chair[j] = ch;
						break;
					}
				}
			}else if(ch == 'B'){
				bool ok = false;
				rep(j, n){
					if(chair[n-j-1] == '#' && 
						(j == 0 || chair[n-j] != 'A' 
						&& j == n - 1 || chair[n-j-2] != 'A')){
						chair[n-j-1] = ch;
						ok = true;
						break;
					}
				}
				if(!ok){
					rep(j, n){
						if(chair[j] == '#'){
							chair[j] = ch;
							break;
						}
					}
				}
			}else if(ch == 'C'){
				if(i == 0){
					chair[n/2] = ch;
				}else{
					rep(j, n){
						if(chair[j] != '#'){
							if(chair[j+1] == '#'){
								chair[j+1] = ch;
								break;
							}else if(j > 0 && chair[j-1] == '#'){
								chair[j-1] = ch;
								break;
							}
						}
					}
				}
			}else{
				if(i == 0){
					chair[0] = ch;
				}else{
					int best = 0;
					int dis = 0;
					rep(i, n){
						if(chair[i] != '#') continue;
						int d = INF;
						rep(j, n){
							if(chair[j] != '#'){
								d = min(abs(j - i), d);
							}
						}
						if(d > dis){
							dis = d;
							best = i;
						}
					}
					chair[best] = ch;
				}
			}
		}
		cout << chair << endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define ll long long
#define name "loz"
#define fastio ios_base::sync_with_stdio(false); cin.tie(nullptr);
#define ini freopen(name".inp","r",stdin);
#define ii pair<int,int>
using namespace std;

const double PI = acos(-1);
const ll INF = 1e9;
const int MOD = 1e9+7;
const int MAXK = 1e4+5, MAXD = 100;
int dp[MAXK][2][MAXD];

int main(){
    fastio
    int d; string k;
    cin>>k>>d; int n=k.size();
    dp[0][0][0]=1;
    for (int i=1; i<=n; i++){
        for (int mod=0; mod<d; mod++){
            for (int lss=0; lss<=1; lss++){
                for (int x=0; x<10; x++){
                    if (x>k[i-1]-'0'&&!lss) break;
                    dp[i][(x<k[i-1]-'0'||lss)][(mod+x)%d]+=dp[i-1][lss][mod];
                    dp[i][(x<k[i-1]-'0'||lss)][(mod+x)%d]%=MOD;
                    //cout<<(x<k[i-1]-'0'||lss)<<' '<<(mod+x)%d<<'\n';
                }
            }
        }
    }
    cout<<(dp[n][0][0]+dp[n][1][0]>0?(dp[n][0][0]+dp[n][1][0]-1)%MOD:MOD-1);
    return 0;
}


Measured memory_bytes: 11424
#include <bits/stdc++.h>
using i64 = int_fast64_t;
#define repeat(i, a, b) for(int i = (a); (i) < (b); ++(i))
#define rep(i, n) repeat(i, 0, n)

void solve() {
    i64 a, b, k;
    std::cin >> a >> b >> k;
    if(a + b <= k) {
        std::cout << "0 0" << std::endl;
    } else if(a <= k) {
        b = (a + b) - k;
        a = 0;
        std::cout << a << " " << b << std::endl;
    } else {
        std::cout << a - k << " " << b << std::endl;
    }
}

int main() {
    // std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    solve();
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
  int n;
  int i=0;
  int a;
  int min=1000000;
  int max=-1000000;
  long long int sum=0;

  scanf("%d", &n);

  for(i=0;i<n;i++){
    scanf("%d",&a);
    if(min>a) min=a;
    if(max<a) max=a;
    sum=sum+a;
  }

  printf("%d %d %lld\n", min, max, sum);
  return 0;
}


Measured memory_bytes: 2104
<?php
list($n,$m) = explode(" ",trim(fgets(STDIN)));
while($m > 0){
list($a,$b) = explode(" ",trim(fgets(STDIN)));
$s = min($a,$b);
$g = max($a,$b);
$r[$s][$g] = 1;
--$m;
}
$ans = 0;
foreach($r[1] as $key => $val){
if(isset($r[$key])){
foreach($r[$key] as $k => $v){
if($k == $n){
++$ans;
break;
}
}
}
}
if($ans == 0){
echo "IMPOSSIBLE";
}else{
echo "POSSIBLE";
}

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

int main(){
    int n,a,b;
    int c;
    int q;
    int cnt=0;
    int v;
    cin>>n>>a>>b;

    for(int i=1;i<=n;i++){
        c=i;
        v=0;
        for(;;){
            q=c%10;
            c=(c-q)/10;
            v+=q;
            if(!c)break;
        }
        if(a<=v && v<=b)cnt+=i;
    }
    cout<<cnt;
    return 0;
}

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


int main() {
    set<int> prime;
    prime.insert(2);
    prime.insert(3);
    prime.insert(5);
    prime.insert(7);
    prime.insert(11);
    prime.insert(13);
    prime.insert(17);
    prime.insert(19);
    prime.insert(23);
    prime.insert(29);
    prime.insert(31);
    prime.insert(37);
    prime.insert(41);
    prime.insert(43);
    prime.insert(47);

    int n;
    cin >> n;

    vi yy(5);
    for(int x:prime) {
        int i=0;
        int n_ = n;
        while(n_) {
            i += n_/x;
            n_ /= x;
        }
        if(i >= 2) {
            yy[0]++;
        }
        if(i >= 4) {
            yy[1]++;
        }
        if(i >= 14) {
            yy[2]++;
        }
        if(i >= 24) {
            yy[3]++;
        }
        if(i >= 74) {
            yy[4]++;
        }
    }

    int ans=0;
    ans += (yy[0]-2)*(yy[1]*(yy[1]-1)/2);
    ans += (yy[0]-1)*yy[3];
    ans += (yy[1]-1)*yy[2];
    ans += yy[4];

    //cout << yy[0] << yy[1] << yy[2] << yy[3] << yy[4] << endl;

    cout << ans << endl;

}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>


using namespace std;

#define foreach(it, c) for (__typeof__((c).begin()) it=(c).begin(); it != (c).end(); ++it)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define clear(arr, val) memset(arr, val, sizeof(arr))


struct P
{
	int x, y;
	P(int x, int y)
		: x(x), y(y) { }
	P operator-(const P& a) const { return P(x - a.x, y - a.y); }
	bool operator==(const P& a) const { return x == a.x && y == a.y; }
};
vector<P> ori(const vector<P>& v)
{
	vector<P> res;
	P rela = v[0];
	for (int i = 0; i < v.size(); ++i)
		res.push_back(v[i] - rela);
	return res;
}
vector<P> rotate(const vector<P>& v)
{
	vector<P> res;
	for (int i = 0; i < v.size(); ++i)
		res.push_back(P(-v[i].y, v[i].x));
	return res;
}
vector<P> input()
{
	int m;
	cin >> m;
	vector<P> res;
	while (m--)
	{
		int x, y;
		cin >> x >> y;
		res.push_back(P(x, y));
	}
	return res;
}
int main()
{
	int n;
	while (cin >> n, n)
	{
		vector<vector<P> > ok;
		ok.push_back(ori(input()));
		for (int i = 0; i < 3; ++i)
			ok.push_back(rotate(ok.back()));
		for (int i = 0; i < 4; ++i)
		{
			vector<P> a = ok[i];
			reverse(all(a));
			ok.push_back(ori(a));
		}

		for (int T = 1; T <= n; ++T)
		{
			vector<P> t = ori(input());
			bool s = false;
			for (int i = 0; i < ok.size(); ++i)
				s |= t == ok[i];
			if (s)
				cout << T << endl;
		}
		cout << "+++++" << endl;
	}
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
using llong = long long;
using P = pair<int, int>;
const int inf = 1 << 20;
const int mod = 1e9 + 7;

vector<int> primes(1e6 + 1, 0);
llong mod_pow(llong x, int y) {
   llong res = 1;
   while (y) {
      if (y & 1) {
         res *= x;
         res %= mod;
      }
      x *= x;
      x %= mod;
      y >>= 1;
   }
   return res;
}

llong inv(llong x) {
   return mod_pow(x, mod - 2);
}
void factor(int x) {
   int cnt = 0;
   int i;
   for (i = 2; i * i <= x; i++) {
      while (x % i == 0) {
         cnt++;
         x /= i;
      }
      primes[i] = max(cnt, primes[i]);
      cnt = 0;
   }
   if (x != 1) {
      primes[x] = max(1, primes[x]);
   }
}
int main() {
   int n;
   cin >> n;
   vector<int> a(n);
   rep(i, n) cin >> a[i];
   rep(i, n) { factor(a[i]); }
   llong lcm = 1;
   rep(i, primes.size()) {
      lcm *= mod_pow(i, primes[i]);
      lcm %= mod;
   }
   llong ans = 0;
   rep(i, n) {
      ans += lcm * inv(a[i]);
      ans %= mod;
   }
   cout << ans << endl;

   return 0;
}


Measured memory_bytes: 4224
s = input()


if s == "hi":
  print("Yes")
elif s == "hihi":
  print("Yes")
elif s == "hihihi":
  print("Yes")
elif s == "hihihihi":
  print("Yes")
elif s == "hihihihihi":
  print("Yes")
else:
  print("No")

Measured memory_bytes: 2940
def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    # divisors.sort()
    return divisors


def is_prime(p):
    if p == 1:
        return False
    for i in range(2, int(p ** 0.5) + 1):
        if p % i == 0:
            return False
    return True


A, B = map(int, input().split())

g = gcd(A, B)
d = make_divisors(g)

ans = 1
for i in d:
    if is_prime(i):
        ans += 1

print(ans)

Measured memory_bytes: 3268
n = int(input())
cs = [1111, 999, 888, 777, 666, 555, 444, 333, 222, 111]
f = False
for i, c in enumerate(cs):
    if (c+1) <= n:
        print(cs[i-1])
        f = True
        break
if not f:
    print(cs[len(cs)-1])

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define ull unsigned long long int
#define forn(i,n)for(ll i=0;i<(n);i++)
#define forn_rev(i,n)for(ll i=(n)-1;i>=0;i--)
#define for1n(i,n) for(ll i=1;i<=(n);i++)
#define ARRAY_SIZE(a) sizeof(a)/sizeof(*a)
#define MOD 1000000007
#define MAXN 1000005

using namespace std;






int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(NULL); cout.tie(NULL);
    ll T=1;
    //cin>>T;
    while(T--)
    {
        string s,t;
        cin>>s>>t;
        forn(i,s.length()){
            if(s[i]!=t[i]){
                cout<<"No";
                return 0;
            }
        }
        cout<<"Yes";




    }



    return 0;
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
 
#define rep(i, a, n) for(int i=a; i<n; i++)
#define ll long long
#define all(x) begin(x), end(x)
#define toInt(x) (x - '0')
#define pll pair<ll, ll>
#define pli pair<ll, int>

const long long INF = 1LL<<60;
const int inf = 1 << 30;
const int mod = 1e9+7;


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; }

int main(){
  int n; cin >> n;
  long long a, b;
  cin >> a >> b;

  int t = b / a;

  vector<long long> v(n);
  rep(i, 0, n){
    cin >> v[i];
  }
  long long ans = 0;
  rep (i, 0, n-1){
    if (v[i+1] - v[i] <= t){
      ans += (v[i+1] - v[i]) * a;
    } else{
      ans += b;
    }
  }
  cout << ans << endl;
}


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

#define NOMAL ((5*19)+(5*20)) 
#define THREE__YEAR (10*20)
using namespace std;

int main(){
	int date;

	cin>>date;
	for(int i=0;i<date;i++){
		int year,month,day;
		long int ans=196470;
		int n3years,nomal_years;
		int nissu=0;

		cin>>year>>month>>day;

		n3years=(year-1)/3;
		nomal_years=(year-1)-n3years;
		nissu+=(n3years*THREE__YEAR+nomal_years*NOMAL);

		if(year%3==0){
			nissu+=((day-1)+(month-1)*20);
		}
		else{
			if((month-1)%2==0)
				nissu+=((day-1)+((month-1)/2)*20+((month-1)/2)*19);
			else
				nissu+=((day-1)+(month/2)*20+((month-1)/2)*19);
		}

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

Measured memory_bytes: 1160
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

P v[100100];

bool comp(P a, P b){
	return a.first+a.second < b.first+b.second;
}

int main(void){
	int n,i,j,t;
	bool flag = false;
	ll k;
	cin >> n >> k;
	for(t=0; t<2; ++t){
		j = (n+t)/2;
		for(i=0; i<n; ++i){
			j%=n;
			v[i].first = k+i;
			v[i].second = k+n+j;
			++j;
		}
		sort(v,v+n,comp);
		for(i=0; i<n; ++i){
			if(v[i].first+v[i].second > k+n*2+i){
				flag = true;
				break;
			}
		}
		if(!flag){
			for(i=0; i<n; ++i){
				cout << v[i].first << " " << v[i].second << " " << k+n*2+i << endl;
			}
			return 0;
		}
		j = (n+1)/2;
		for(i=0; i<n; ++i){
			j%=n;
			v[i].first = k+i;
			v[i].second = k+n+j;
			++j;
		}
	}
	cout << "-1" << endl;
	return 0;
}


Measured memory_bytes: 3840
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
import java.util.stream.Collectors;

public class Main {
    
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        
        List<String> list = new ArrayList<String>();
        for (int i = 0; i <N ; i++) {
            char[] chars = sc.next().toCharArray();
            Arrays.sort(chars);
            list.add(new String(chars));
        }
        
        Map<String, Long> map =  list.stream().collect(
                Collectors.groupingBy(x -> x, Collectors.counting())
        );
        
        Long cmb = 0L;
        for(Long c: map.values()) {
            if(c <= 1) continue;
            cmb += c*(c-1)/2;
        }
                
        System.out.println(cmb);



    }
}

Measured memory_bytes: 61064
[x,y]=list(map(int,input().split()))

#nCrのmodを求める
def nCrmod(n,r,mod):
	if r<0 or r>n:
		ans=0
	else:
		if r>n-r:
			r=n-r
		kaijo=[1] #階乗リスト作成
		for i in range(1,n+1):
			kaijo.append(kaijo[-1]*i%mod) #これで、kaijo[i]≡i!となる。
		gyakugen=[pow(kaijo[n-r],mod-2,mod)] #逆限リスト作成
		for i in reversed(range(1,n-r+1)):
			gyakugen.append(gyakugen[-1]*i%mod) #これで、gyakugen[i]=n-r-iの逆元 となる。
		ans=kaijo[n]*gyakugen[0]*gyakugen[n-2*r]%mod
	return(ans)


if ((x%3)+(y%3))%3!=0:
	print(0)
else:
	n=int((x+y)/3)
	r=y-n
	mod=1000000007
	print(nCrmod(n,r,mod))

Measured memory_bytes: 42668
#include<bits/stdc++.h>
using namespace std;
bool ispal(string a)
{
    long long int n=a.length();
    if(n==1)
        return true;
    else{
    int i=0,j;
    j=n-1;
    while(1)
    {
        if(a[i]!=a[j])
        {
            cout<<i<<" "<<j;
           return false;
        }
        i++,j--;
        if(i==j)
         {
        //     cout<<i<<" ";
             break;
        }
    }
    return true;
}}
int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin>>n;
    string a;
  cin>>a;
  int c=0;
  for(int i=0;i<n-2;i++)
  {
  	if(a[i]=='A' && a[i+1]=='B' && a[i+2]=='C')
    {
    	c++;
    }
  }
  cout<<c;

}


Measured memory_bytes: 3612
from heapq import heappop, heappush

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

N, M = getlist()
A = getlist()

Q = []
for i in range(N):
	heappush(Q, -A[i])

for i in range(M):
	val = heappop(Q)
	if val % 2 == 0:
		heappush(Q, val // 2)
	else:
		heappush(Q, (val + 1) // 2)

print(-sum(Q))

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

struct S{
    int t, d;
    S(int t, int d) : t(t), d(d){}
    bool operator<(const S& s) const {
        if(d != s.d) return d > s.d;
        return t < s.t;
    }
};

int main() {
    int n, k;
    vector<S> ssh;
    long long ans = 0;
    cin >> n >> k;
    ssh.reserve(n);
    for(int i=0;i<n;i++){
        int t, d;
        cin >> t >> d;
        ssh.push_back(S(--t, d));
    }
    sort(ssh.begin(), ssh.end());
    long long sum = 0, srt = 0;
    vector<bool> usd(n, false);
    priority_queue<int, vector<int>, greater<int> > q;
    for(int i=0;i<k;i++){
        int t = ssh[i].t;
        int d = ssh[i].d;
        sum += d;
        if(usd[t]){
            q.push(d);
        }else{
            usd[t] = true;
            srt++;
        }
    }
    ans = sum + srt * srt;
    for(int i=k;i<n;i++){
        if(q.empty()) break;
        int t = ssh[i].t;
        int d = ssh[i].d;
        if(usd[t]) continue;
        int out = q.top(); q.pop();
        sum += d - out;
        usd[t] = true;
        srt++;
        long long tmp = sum + srt*srt;
        if(ans < tmp) ans = tmp;
    }
    cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1408
import System.IO (isEOF)
import Text.Printf (printf)

main = do
    quit <- isEOF
    if quit then return () else do
        line <- getLine
        let
            [a,b,s,c,d,t] = map read $ words line :: [Int]
            (x,y) = solve (Equation a b s) (Equation c d t)
        output x y
        main

output :: Double -> Double -> IO ()
output x y = printf "%.3f %.3f\n" x' y'
    where
    x' = if x == -0.0 then 0.0 else x
    y' = if y == -0.0 then 0.0 else y

data Equation = Equation Int Int Int

solve :: Equation -> Equation -> (Double, Double)
solve e1 e2 = (x,y)
    where
    x = fromIntegral (d * s + (-b) * t) / det
    y = fromIntegral ((-c) * s + a * t) / det
    det = fromIntegral (a * d - b * c)
    Equation a b s = e1
    Equation c d t = e2

Measured memory_bytes: 4324
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn solve(ns: Vec<(i64, i64)>, ms: Vec<(i64, i64)>) -> Vec<usize> {
    let mut res = Vec::with_capacity(ns.len());
    for n in ns {
        let mut current = 1;
        let x = n.0;
        let y = n.1;
        let m = ms[0];
        let mut min = (x-m.0).abs() + (y - m.1).abs();
        for (i, m) in ms.iter().enumerate().skip(1) {
            let dist = (x - m.0).abs() + (y - m.1).abs();
            if dist < min {
                current = i + 1;
                min = dist;
            }
        }
        res.push(current);
    }
    res
}



fn main() {
    input! {
        n: usize,
        m: usize,
        ns: [(i64, i64); n],
        ms: [(i64, i64); m],
    };
    for i in solve(ns, ms) {
        println!("{}", i);
    }
}


Measured memory_bytes: 4352
H,W=input().split()
H=int(H)
W=int(W)
import math

if H%2==0:
    Ha="even"
else:
    Ha="odd"

if W%2==0:
    Wa="even"
else:
    Wa="odd"

if H==1 or W==1:
    print(1)
elif Ha=="even"or Wa=="even":
    print(math.floor(H*W/2))
else:
    print(math.floor(H*W/2+0.5))


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

using namespace std;

template< typename T >
struct PrioritySumStructure
{
  static const bool INCREASE = false;
  static const bool DECREASE = true;

  bool order;
  int k, sz;
  T sum;
  set< pair< T, int > > add, pend;
  map< int, T > adding, pending;

  PrioritySumStructure(int k, bool order = INCREASE) : k(k), sum(0), sz(0), order(order) {}

  void Sweep()
  {
    while(sz < k && !pend.empty()) {
      auto p = order ? --pend.end() : pend.begin();
      sum += p->first;
      ++sz;
      add.emplace(*p);
      adding.emplace(p->second, p->first);
      pending.erase(p->second);
      pend.erase(p);
    }
    while(sz > k) {
      auto p = order ? add.begin() : --add.end();
      sum -= p->first;
      --sz;
      pend.emplace(*p);
      pending.emplace(p->second, p->first);
      adding.erase(p->second);
      add.erase(p);
    }
  }

  T getSum()
  {
    if(sz < k) throw ("get Sum Exception");
    return (sum);
  }

  void addElement(int k, T x)
  {
    if(adding.count(k) || pending.count(k)) {
      throw ("Add Element Exception");
    }
    ++sz;
    add.emplace(x, k);
    adding[k] = x;
    sum += x;
    Sweep();
  }

  void deleteElement(int k)
  {
    if(pending.count(k)) {
      pend.erase({pending[k], k});
      pending.erase(k);
    } else if(adding.count(k)) {
      --sz;
      sum -= adding[k];
      add.erase({adding[k], k});
      adding.erase(k);
      Sweep();
    } else {
      throw ("delete Element Exception");
    }
  }

  void incrementSize()
  {
    ++k;
    Sweep();
  }

  void decrementSize()
  {
    if(k == 0) throw ("decrement Size Exception");
    --k;
    Sweep();
  }
};

typedef long long int64;

int main()
{
  int N, A[300000];

  scanf("%d", &N);
  for(int i = 0; i < 3 * N; i++) scanf("%d", &A[i]);

  PrioritySumStructure< int64 > sum1(N, PrioritySumStructure< int64 >::DECREASE);
  PrioritySumStructure< int64 > sum2(N, PrioritySumStructure< int64 >::INCREASE);
  for(int i = 0; i < N - 1; i++) sum1.addElement(i, A[i]);
  for(int i = N - 1; i < 3 * N; i++) sum2.addElement(i, A[i]);

  int64 ret = numeric_limits< int64 >::min();
  for(int i = N - 1; i < 2 * N; i++) {
    sum1.addElement(i, A[i]);
    sum2.deleteElement(i);
    ret = max(ret, sum1.getSum() - sum2.getSum());
  }
  printf("%lld\n", ret);
}

Measured memory_bytes: 38912
/*
    JAI JAGANNATH!
*/
//@Author : zanj0
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long int lli;
#define ff              first
#define ss              second
#define pb              push_back
#define mp              make_pair
#define pii             pair<lli,lli>
#define vi              vector<lli>
#define mii             map<lli,lli>
#define pqb             priority_queue<lli>
#define pqs             priority_queue<lli,vi,greater<lli> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            lli x; cin>>x; while(x--)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef tree<lli, null_type, less<lli>, rb_tree_tag, tree_order_statistics_node_update> pbds;


void zanj0()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}

int main()
{
	zanj0();
	string s;
	cin >> s;
	bool ok = false;
	for (lli i = 0; i < s.size(); i++) ok = ok || (s[i] == '7');
	if (!ok) {
		cout << "No" << endl;
	} else cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i <= n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
 
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;

int main(){
    ll n, k;
    cin >> n >> k;
    vector<P> p(n);
    vll x(n), y(n);
    REP(i, n){
        cin >> x[i] >> y[i];
        p[i] = P(x[i], y[i]);
    }
    VSORT(x);
    VSORT(y);
    vll rect(4);
    ll res = 1e18 * 5;
    REP(l, n){
        REP(r, n){
            if(r <= l) continue;
            REP(d, n){
                REP(u, n){
                    if(u <= d) continue;
                    rect[0] = x[l];
                    rect[1] = x[r];
                    rect[2] = y[d];
                    rect[3] = y[u];
                    ll cnt = 0;
                    REP(i, n){
                        ll px = p[i].first, py = p[i].second;
                        if(px >= rect[0] && px <= rect[1] && py >= rect[2] && py <= rect[3]) cnt++;
                    }
                    if(cnt >= k) res = min(res, (rect[1] - rect[0]) * (rect[3] - rect[2]));
                }
            }
        }
    }
    cout << res << endl;
}

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

// g++ -std=c++17 -O2 -Wall template.cpp -o template
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    // i where P[i] is less than everything left of it
    int n;
    cin >> n;
    int p[n];
    int dp[n];
    int m = INT_MAX;
    for (int i = 0; i < n; i++) {
        cin >> p[i];
        dp[i] = m;
        m = min(m, p[i]);
    }
    int c = 0;
    for (int i = 0; i < n; i++) {
        if (p[i] <= dp[i]) {
            c++;
        }
    }
    cout << c << endl;
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    // Solution
}


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

int main(){
  int N,M,a,b;
  cin >> N >> M;
  vector <int> city(N);
  for(int i = 0;i < M;i++){
  	cin >>a >> b;
    city.at(a-1) += 1;
    city.at(b-1) += 1;
  }
  for(int i = 0;i < N;i++){
  	cout << city.at(i) << endl;
  }
}

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

struct POS {
	int x, y;
	POS(int x, int y) : x(x), y(y) {}
};

int main()
{
	const int dx[2][6] = { { -1, -1, 0, 1, 0 -1 }, { -1, 0, 1, 1, 1, 0 } };
	const int dy[6]    =   { 0, -1, -1, 0, 1, 1 };

	int W, H;
	cin >> W >> H;
	vector< vector<int> > b(H+2, vector<int>(W+2, 0));
	int ans = 0;

	for (int y=0; y<H; y++)
	for (int x=0; x<W; x++)
	{
		cin >> b[y+1][x+1];
		if (b[y+1][x+1] == 1)
			ans += 6;
	}

	queue<POS> q;
	q.push(POS(0,0));
	while (!q.empty())
	{
		POS now = q.front(); q.pop();
		if (b[now.y][now.x] == -1) continue;
		b[now.y][now.x] = -1;
		for (int i=0; i<6; i++)
		{
			int nx = now.x + dx[now.y%2][i];
			int ny = now.y + dy[i];
			if (nx < 0 || nx > W+1 || ny < 0 || ny > H+1) continue;
			if (b[ny][nx] != 0) continue;
			q.push(POS(nx, ny));
		}
	}

	for (int y = 1; y <= H; y++)
	for (int x = 1; x <= W; x++)
		if (b[y][x] == 1)
		{
			for (int i=0; i<6; i++)
			{
				int nx = x + dx[y%2][i];
				int ny = y + dy[i];
				if (nx < 0 || nx > W+1 || ny < 0 || ny > H+1) continue;
				if (b[ny][nx] < 0) continue;
				ans--;
			}
		}

	cout << ans << endl;

}

Measured memory_bytes: 1268
#include<bits/stdc++.h>
using namespace std;
string S;
vector<int> abc = vector<int>(26, 0);

int  main(){
    cin >> S;
    for(char c : S){
        abc.at(c - 'a') = 1;
    }

    char s = 'a';

    for(int i = 0; i<26; i++){
        if(abc.at(i) != 1){
            s +=i;
            cout << s << endl;
            break;
        }else if(i == 25){
            cout << "None" << endl;
        }
    }

}

Measured memory_bytes: 512
import java.util.*;
import java.math.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        double[] p = new double[N];
        for (int i = 0; i < N; i++) {
            p[i] = sc.nextDouble();
        }

        Map<Integer, Double> map = new HashMap<>();
        map.put(0, 1.0);
        for (int i = 0; i < N; i++) {
            Map<Integer, Double> tmp = new HashMap<>();
            for (int key : map.keySet()) {
                double last = map.get(key);
                tmp.put(key + 1, tmp.getOrDefault(key + 1, 0.0) + last * (1 - p[i]));
                tmp.put(key + 10000, tmp.getOrDefault(key + 10000, 0.0) + last * p[i]);
            }
            map = tmp;
        }

        double res = 0.0;

        for (int key : map.keySet()) {
            if (key / 10000 > key % 10000) {
                res += map.get(key);
            }
        }

        System.out.println(res);
    }
}


Measured memory_bytes: 227900
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <cstring>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<long long, long long> P;
#define rep(i, n) for(long long i=0; i<n; i++)
#define reps(i, s, e) for(long long i=s; i<e; i++)
#define repr(i, n) for(long long i=n-1; i>=0; i--)
#define reprs(i, s, e) for(long long i=e-1; i>=s; i--)

int main(){

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

    double r; cin >> r;

    cout << setprecision(12);
    cout << 2 * M_PI * r << endl;

    return 0;
}

Measured memory_bytes: 3748
K = int(input())
all_list = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

print(all_list[K-1])

Measured memory_bytes: 2940
#include <cstdio>
#include <iostream>
#include <cstring>
#include <string>
#include <cmath>
#include <algorithm>
using namespace std;
const int MAXN = 105;
string x[MAXN];
int main(){
	int n,l;
	cin>>n>>l;
	for(int i=1;i<=n;++i) cin>>x[i];
	sort(x+1,x+1+n);
	for(int i=1;i<=n;++i) cout<<x[i];
	return 0;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)  
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define RVSORT(v) sort(v.rbegin(), v.rend());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int gcd(int a,int b){return b?gcd(b,a%b):a;}

ll modpow(ll n,ll k){
  if(k == 1){
    return n;
  }else if(k == 0){
    return 1;
  }else if(k%2==0){
    ll memo = modpow(n,k/2)%MOD;
    return memo*memo%MOD;
  }else{
    return n * modpow(n,k-1)%MOD;
  }
}

int main(){

  int a;cin>>a;
  string s;cin>>s;
  if(a>=3200){
    cout<<s<<endl;
  }else{
    cout<<"red"<<endl;
  }

 

  return 0;
}

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

int main() {
    int n;
    int a[202000];
    int b[202000] = { 0 };
    int max;

    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        b[i] = a[i];
    }

    sort(b, b + 202000, greater<int>());

    for (int i = 0; i < n; i++) {
        max = ((a[i] == b[0]) ? b[1] : b[0]);
        cout << max << endl;
    }

    return 0;
}

Measured memory_bytes: 3200
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> pii;
const ll INF = 1e9+100;
const ll MOD = 1e9+7;
const bool debug = 0;
//-----------------------------------------------//

int main() {
	string s;
	cin >> s;
	
	int num = atoi(s.c_str());
	int fnum = 0;
	REP(i, s.size()) fnum += s[i] - '0';
	
	if (num % fnum == 0) puts("Yes");
	else puts("No");
	
	return 0;
}

Measured memory_bytes: 256