akhauriyash/Code-Regression huggingface dataset:
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {
	private static FastScanner sc = new FastScanner();

	public static void main(String[] args) {
		//??????https://www.ipsj.or.jp/07editj/promenade/4506.pdf
		int n = sc.nextInt();
		
		Weight[] w = new Weight[n];
		for(int i=0; i<n; i++) {
			w[i] = new Weight(sc.nextInt());
		}
		
		int min_all = 0;
		for(int i=0; i<n; i++) {
			int idx = i;
			boolean flag = false;
			for(int j=0; j<n; j++) {
				if(i != j && w[i].num > w[j].num) {
					w[i].idx_sort++;
					flag = true;
				}				
			}
			
			if(!flag) {
				min_all = w[idx].num;
			}
			
//			System.out.println(i + " " + w[i].num + " " + w[i].idx_sort);
		}
		
//		System.out.println(min_all);
		
		
		int cost = 0;
		for(int i=0; i<n; i++) {
			int min_cycle = Integer.MAX_VALUE;
			int sum_cycle = 0;
			int n_cycle = 0;
			int j = i;
			
			if(!w[j].flag) {
				if(w[j].idx_sort == j) {
					w[j].flag = true;
				} else {
					while(w[j].flag == false) {
						sum_cycle += w[j].num;
						n_cycle++;
						if(w[j].num < min_cycle) {
							min_cycle = w[j].num;
						}
						w[j].flag = true;
						j = w[j].idx_sort;	
					}
					
					int cost_1 = sum_cycle + (n_cycle - 2) * min_cycle;
					int cost_2 = sum_cycle + min_cycle + (n_cycle + 1) * min_all;
					
					cost += Math.min(cost_1, cost_2);
					
//					System.out.println(i + " " + n_cycle + " " + sum_cycle + " " + min_cycle + " " + cost_1 + " " + cost_2);
				}
			}
		}
		
		System.out.println(cost);
	}
	
	static class Weight {
		int num;
		boolean flag = false;
		int idx_sort = 0;
		Weight(int num) {
			this.num = num;
		}
	}

	static class FastScanner {
	    private final InputStream in = System.in;
	    private final byte[] buffer = new byte[1024];
	    private int ptr = 0;
	    private int buflen = 0;
	    private boolean hasNextByte() {
	        if (ptr < buflen) {
	            return true;
	        }else{
	            ptr = 0;
	            try {
	                buflen = in.read(buffer);
	            } catch (IOException e) {
	                e.printStackTrace();
	            }
	            if (buflen <= 0) {
	                return false;
	            }
	        }
	        return true;
	    }
	    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
	    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
	    private void skipUnprintable() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
	    public boolean hasNext() { skipUnprintable(); return hasNextByte();}
	    public String next() {
	        if (!hasNext()) throw new NoSuchElementException();
	        StringBuilder sb = new StringBuilder();
	        int b = readByte();
	        while(isPrintableChar(b)) {
	            sb.appendCodePoint(b);
	            b = readByte();
	        }
	        return sb.toString();
	    }
	    public long nextLong() {
	        return Long.parseLong(next());
	    }
	    public int nextInt(){
	    	return Integer.parseInt(next());
	    }
	}
}

Measured memory_bytes: 25336
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <memory>
#include <regex>
using namespace std;

int main()
{
    vector<int> v(3);
    for(int i=0; i<3; ++i)
        cin >> v[i];

    sort(v.begin(), v.end());
    int ans = v[0] + v[1] + v[2] * 10;
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include<math.h>
#include<limits.h>
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<sstream>
#include<list>
#include<queue>
#include<algorithm>
#include<functional>
#include<map>
#include<set>
#include<utility>
#include<initializer_list>
#include<tuple>
#include<regex>
using namespace std;
#define ull unsigned long long
#define ll long long
#define rep(i, n) for(int i=0;i<(int)(n);i++)
#define all(t) t.begin(), t.end()


int main() {
	int n, a, b;
	cin >> n >> a >> b;
	cout << min(a*n, b) << endl;

	return 0;
}





Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long n;
vector<long long>a;
vector<long long>b;
vector<long long>c;
long long mem[100001][3];
long long dp(long long i,long long k)
{
    if(i==n)
        return 0;
    if(mem[i][k]!=-1)
        return mem[i][k];
        if(k==0)
        mem[i][k]=max(b[i]+dp(i+1,1),c[i]+dp(i+1,2));
        else if(k==1)
        mem[i][k]=max(a[i]+dp(i+1,0),c[i]+dp(i+1,2));
        else if(k==2)
        mem[i][k]=max(b[i]+dp(i+1,1),a[i]+dp(i+1,0));
    return mem[i][k];
}
int main()
{
   memset(mem,-1,sizeof(mem));
   cin>>n;
   long long i;
   a.resize(n);
   b.resize(n);
   c.resize(n);
   for(i=0;i<n;i++)
   {
       cin>>a[i]>>b[i]>>c[i];
   }
   long long mem1,mem2,mem3;
   mem1=a[0]+dp(1,0);
   mem2=b[0]+dp(1,1);
   mem3=c[0]+dp(1,2);
   cout<<max(max(mem1,mem2),mem3);
}


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

typedef long long ll;
constexpr ll MOD = ll(1e9+7);

ll power(ll x, ll n){
    ll res = 1;
    while(n > 0){
        if(n&1){
            res *= x;
            res %= MOD;
        }
        x *= x;
        x %= MOD;
        n >>= 1;
    }
    return res;
}

int main(){
    string Z, O;
    ll n, m, l;
    cin >> Z >> O >> n;
    m = Z.size();
    l = O.size();
    if(n <= l){
        string s,h;
        s += O.substr(l-n,n);
        reverse(s.begin(), s.end());
        h = s;
        s += Z;
        s += h;
        s += O;
        bool ok = true;
        for(int i=0;i<int(s.size());i++){
            ok &= (s[i] == s[int(s.size())-1-i]);
        }
        cout << (ok ? 1 : 0) << endl;
    }
    else{
        if(Z.size() > O.size()){
            if(Z.substr(0,O.size())==O){
                bool ok = true;
                for(int i=l;i<m;i++){
                    ok &= (Z[i] == Z[m-1-(i-l)]);
                }
                if(ok){
                    cout << power(26, (n-l+1)/2) << endl;
                }
                else{
                    cout << 0 << endl;
                }
            }
            else{
                cout << 0 << endl;
            }
        }
        else{
            if(O.substr(0,Z.size())==Z){
                bool ok = true;
                for(int i=m;i<l;i++){
                    ok &= (O[i]==O[l-1-(i-m)]);
                }
                if(ok){
                    cout << power(26, (n-l+1)/2) << endl;
                }
                else{
                    cout << 0 << endl;
                }
            }
            else{
                cout << 0 << endl;
            }
        }
    }
    return 0;
}


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

const int inf = 1e9+5;
int main(void)
{
	int n;
	scanf("%d",&n);
	vector<int> h(n);
	for(int& x : h)
		scanf("%d",&x);
	vector<int> dp(n,inf);
	dp[0] = 0;
	for(int i=0;i<n;i++)
		for(int j : {i+1,i+2})
			if(j < n)
				dp[j] = min(dp[j],dp[i] + abs(h[i]-h[j]));

	printf("%d\n",dp[n-1]);
	return 0;
}

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

int main(){
	stack<int> s1;
	stack< pair<int, int> > s2;
	char ch;
	int sum = 0; 
	for (int i = 0; cin >> ch; i++) {
		if (ch == '\\') s1.push(i);
		else if (ch == '/'&& s1.size() > 0) {
			int j = s1.top(); s1.pop();
			sum += i - j;
			int a = i - j;
			while (s2.size() > 0 && s2.top().first > j) {
				a += s2.top().second; s2.pop();
			}
			s2.push(make_pair(j, a));
		}
	}

	vector<int> ans;
	while (s2.size() > 0) {
		ans.push_back(s2.top().second); s2.pop();
	}
	reverse(ans.begin(), ans.end());
	cout << sum << endl;
	cout << ans.size();
	for (int i = 0; i < ans.size(); i++) {
		cout << " ";
		cout << ans[i];
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 3208
#include<bits/stdc++.h>
#define MSET(x,y) memset(x,y,sizeof(x))
#define F first
#define S second
#define MP make_pair
#define PB push_back
#define SZ size()
#define M 100005
#define ll long long
#define ld long double
#define INF 1e18
#define endl "\n"
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using namespace std;
ll MOD = 1000000007;
string yes = "YES\n";
string no = "NO\n";
#define PI 3.1415926535


int main() {
    fastio;
    ll n;
    cin>>n;
    vector<ll> a(n);
    for(auto &itr : a) {
        cin>>itr;
    }
    vector<ll> dp(n,0);
    dp[0] = 0;
    dp[1] = abs(a[1]-a[0]);
    for(ll i=2;i<n;i++) {
        dp[i] = min(dp[i-1] + abs(a[i]-a[i-1]), dp[i-2] + abs(a[i]-a[i-2]));
    }
    cout<<dp[n-1]<<endl;
}

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

int main() {
    int time[5];
    int ans = 0;
    int last_dish;
    int last_dish_time = 0;
    int fixed_time[5];
    for (int i = 0; i < 5; i++) {
        cin >> time[i];
    }
    for (int i = 0; i < 5; i++) {
        if (time[i] % 10 == 0) {
            fixed_time[i] = time[i];
        } else {
            fixed_time[i] = 10 * (time[i] / 10 + 1);
        }
        if (last_dish_time < fixed_time[i] - time[i]) {
            last_dish_time = fixed_time[i] - time[i];
            last_dish = i;
        }
    }
    for (int i = 0; i < 5; i++) {
        if (i == last_dish) {
            ans += time[i];
        } else {
            ans += fixed_time[i];
        }
    }
    cout << ans << endl;
}


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

#define rep(i, N) for (int i = 0; i < N; i++)
const int intinf = numeric_limits<int>::max();

using ll = long long int;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

void solve()
{
    int N;
    int K;
    cin >> N >> K;
    vector<int> h(N);
    rep(i, N) cin >> h[i];

    int cnt = 0;
    rep(i, N)
    {
        if (h[i] >= K)
            cnt++;
    }

    cout << cnt << endl;
}

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

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

int main(){
    int N, A[100000];
    cin >> N;
    for(int i=0; i<N; i++) cin >> A[i];

    vector<int> cand;
    for(int i=0; i<=1; i++){
        for(int d=1; d*d<=A[i]; d++){
            if(A[i] % d == 0){
                cand.push_back(d);
                cand.push_back(A[i] / d);
            }
        }
    }

    int ans = 0;
    for(int d : cand){
        int num = 0;
        for(int i=0; i<N; i++) if(A[i] % d == 0) num++;
        if(num >= N-1) ans = max(ans, d);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
#define rep(i,x) for(ll i = 0; i < (ll)(x); i++)
#define pb push_back
#define eb emplace_back
#define debug(x) cerr << #x << ": " << (x) << "\n";
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<ll>>> vvvl;
const ll INF = numeric_limits<ll>::max()/4;
const ll MOD = 1e9+7;
const int n_max = 1e5+10;

int main(){
    string s;cin >> s;
    string t;cin >> t;
    ll n = s.size();
    vector<vector<ll>> ind_s(26), ind_t(26);
    ll cnt = 0;
    bitset<26> bs(0), bt(0);
    rep(i,n){
        ll temp = s[i] - 'a';
        ind_s[temp].emplace_back(i);
        bs[temp] = 1;
        temp = t[i] - 'a';
        ind_t[temp].emplace_back(i);
    }
    cnt = bs.count();
    bool ok = true;
    rep(i,26){
        bool temp = true;
        ll pre = -1;
        for(auto j : ind_s[i]){
            if(pre == -1)pre = t[j] - 'a';
            if(t[j] - 'a' != pre)temp = false;
        }
        ok &= temp;
    }
    rep(i,26){
        bool temp = true;
        ll pre = -1;
        for(auto j : ind_t[i]){
            if(pre == -1)pre = s[j] - 'a';
            if(s[j] - 'a' != pre)temp = false;
        }
        ok &= temp;
    }
    // rep(i,n)bt[t[i]-'a'] = 1;
    // if(cnt == 26){
    //     ok &= (bt.count() == 26);
    // }
    // else{
    //     ok &= (bt.count() <= cnt);
    // }

    cout << (ok ? "Yes" : "No") << endl;
}

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

class Potential_Union_Find{
  vector<int> par; vector<int> rank; vector<int> diff_weight;
public:
  Potential_Union_Find(int n) {
    par.assign(n,0); rank.assign(n,0); diff_weight.assign(n,0);
    rep(i,n) par[i] = i;
  }
  int find(int x) {
    if(par[x] == x) {
      return x;
    } else {
      int r = find(par[x]);
      diff_weight[x] += diff_weight[par[x]];
      return par[x] = r;
    }
  }
  int weight(int x){
    find(x);
    return diff_weight[x];
  }
  void unite(int x, int y, int w){
    w += weight(x); w -= weight(y);
    x = find(x); y = find(y);
    if(x == y) return;
    if(rank[x] < rank[y]) swap(x,y), w = -w;
    if(rank[x] == rank[y]) rank[x]++;
    par[y] = x;
    diff_weight[y] = w;
  }
  bool same(int x, int y){
    return find(x) == find(y);
  }
  int diff(int x, int y){
    return weight(y) - weight(x);
  }
};

int main() {
  int n, q;
  cin >> n >> q;
  Potential_Union_Find puf(n);
  rep(i,q) {
    int t;
    cin >> t;
    if(t == 0) {
      int x, y, z;
      cin >> x >> y >> z;
      puf.unite(x,y,z);
    } else {
      int x, y;
      cin >> x >> y;
      if(puf.same(x,y)) cout << puf.diff(x,y) << endl;
      else cout << "?" << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 3836
#!/usr/bin/env python

def count(arr,k,H,W):
    
    num_ans = 0

    for col in kumiawase(arr):
        countlist = [0]*W

        #print("col:")
        #printarr(col)
        #print()

        for i in range(len(col)):
            count = 0
            for j in range(len(col[0])):
                if col[i][j] == 1:
                    countlist[j]=countlist[j]+1
            #countlist.append(count)


        #print("countlist")
        #print(countlist)
        #print()
        for x in kumiawase(countlist):
            if sum(x) == k :
                num_ans += 1
        
    print(num_ans)

def kumiawase(list):
    #listから取り出すすべての組み合わせ：

    returnlist = []
    num_kumi = 2**len(list)
    for i in range(num_kumi):
        tmplist = []
        for j in range(len(list)):
            if (i >> j)%2 == 1:
                tmplist.append(list[j])

        returnlist.append(tmplist)
    
    return returnlist


def printarr(arr):
    for i in range(len(arr)):
        for j in range(len(arr[0])):
            print(arr[i][j],end=" ")
        print()

if __name__ == "__main__":
    H,W,K = map(int,input().split())

    arr = []
    count_H = []
    total = 0
    for i in range(H):
        list = []
        inp = input()
        for j in range(W):
            num = 0
            if "." == inp[j]:
                list.append(0)
            else:
                list.append(1)
                num += 1
                total += 1
        arr.append(list)
        count_H.append(num)
    
    count_W = []
    for i in range(W):
        num = 0
        for j in range(H):
            num += 1
        count_W.append(num)

#    printarr(arr)


    count(arr,K,H,W)


Measured memory_bytes: 9288
fn read<T: std::str::FromStr>() -> T {
  let mut s = String::new();
  std::io::stdin().read_line(&mut s).ok();
  s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
  let mut s = String::new();
  std::io::stdin().read_line(&mut s).ok();
  s.trim().split_whitespace()
    .map(|e| e.parse().ok().unwrap()).collect()
}

fn main() {
  let n: u32 = read();
  let mut ans = 0.0;
  for _ in 0..n {
    let input: Vec<String> = read_vec();

    ans += if input[1] == "JPY" { input[0].parse::<f64>().unwrap() } else { input[0].parse::<f64>().unwrap() * 380000.0 };
  }

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


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
using namespace std::chrono;
#define FASTIO std::ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl '\n'
#define hell        163577857
#define vi          vector<int>
// #define int         long long int
const long long INF = 1000 * 1000 * 1000 * 1ll * 1000 * 1000 * 1000;
typedef long long ll;
typedef pair<int, int> pairs;

int main () {
  int a, b, c, k, k1;
  cin >> a >> b >> c >> k;
  k1 = k;
  k -= a;
  if (k <= 0) {
    cout << k1 << endl;
    return 0;
  }
  k -= b;
  if (k <= 0) {
    cout << a << endl;
    return 0;
  }
  cout << a - k << endl;
}


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

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vector<vector<bool>>> vvvb;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;
typedef vector<double> vd;
typedef vector<vd> vdd;

#define FOR(i,x,y) for(ll i=(ll)x; i<(ll)y; ++i)
#define REP(i,y) FOR(i, 0, y)
#define RFOR(i,x,y) for(ll i=(ll)x; i>=(ll)y; --i)
#define RREP(i,x) RFOR(i, x, 0)
#define ALL(a) a.begin(), a.end()
#define pb push_back
#define debug_print(x...) cerr << "line " << __LINE__ << " : "; debug_print_in(x);

template <typename First>
void debug_print_in(First first){
  cerr << first << endl;
  return;
}

template <typename First, typename... Rest>
void debug_print_in(First first, Rest... rest){
  cerr << first << " ";
  debug_print_in(rest...);
  return;
}

void IN(void){
  return;
}

template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){
  cin >> first;
  IN(rest...);
  return;
}

template <typename First>
void OUT(First first){
  cout << first << endl;
  return;
}

template <typename First, typename... Rest>
void OUT(First first, Rest... rest){
  cout << first << " ";
  OUT(rest...);
  return;
}

template<class t, class u> void chmax(t&a,u b){if(a<b)a=b;};
template<class t, class u> void chmin(t&a,u b){if(a>b)a=b;};
int popcount(int t){return __builtin_popcount(t);} //GCC
int popcount(ll t){return __builtin_popcountll(t);} //GCC

template <typename T>
void vec_print(vector<T> VEC){
  REP(i, VEC.size()){
    cerr << VEC[i] << " ";
  }
  cerr << endl;
};

template <typename T>
void mat_print(vector<vector<T> > MAT){
  REP(i,MAT.size()){
    REP(j,MAT[i].size()){
      cerr << MAT[i][j] << " ";
    }
    cerr << endl;
  }
};

constexpr int INF = (1<<30);
constexpr ll INFLL = 1LL<<62;
constexpr long double EPS = 1e-12;
constexpr ll MOD = (ll)((1E+9)+7);

int main(){
  cin.tie(0); // cut the cin and cout (default, std::flush is performed after std::cin)
  ios::sync_with_stdio(false); // cut the iostream and stdio (DON'T endl; BUT "\n";)

  vll A(3);
  IN(A[0],A[1],A[2]);
  sort(ALL(A));

  ll ans = 0;
  while(A[0]+2<=A[2]){
    A[0]+=2;
    ans++;
  }
  while(A[1]+2<=A[2]){
    A[1]+=2;
    ans++;
  }

  if(A[0]==A[1] && A[1]==A[2]){
    OUT(ans);
    return 0;
  }
  if(A[0]<A[2] && A[1]<A[2]){
    OUT(ans+1);
    return 0;
  }
  OUT(ans+2);

  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#define MAXWI 100000
 
int gP,gSum,gMaxW;
int gw[MAXWI+1];
int gn,gk;
 
 
void carryPackage( int maxPackage )
{
    int i;
    int tmpk;
    int package;
      
    if( gMaxW <= maxPackage ) {
        tmpk=gk;
        package=i=0;
        while( i < gn ) {
            package+=gw[i];
            if( maxPackage <= package ) {
                if( maxPackage < package ) {
                    i--;
                }
                tmpk--;
                if( tmpk == 0 ) { break; }
                package=0;     
            }
            i++;
        }
        if( 1<=tmpk || (0==tmpk && i == (gn-1)) ) {
            gP=maxPackage;
        } else {
        	if( gMaxW < maxPackage ) {
        		gMaxW=maxPackage;
        	}
        }
    }
    
    return;
}
 
int main( void ) 
{
    int i,j;
    int end;
    int maxPackage;
         
    scanf( "%d%d", &gn, &gk );

    end=gn/gk;
    maxPackage=gMaxW=gSum=0;
   for( i=0; i<end; i++ ) {
        scanf( "%d", &gw[i] );
        maxPackage+=gw[i];
        gSum+=gw[i];
		if( gMaxW < gw[i] ) {
			gMaxW=gw[i];
		}
    }   
    for( i=end; i<gn; i++ ) {
        scanf( "%d", &gw[i] );
        gSum+=gw[i];
		if( gMaxW < gw[i] ) {
			gMaxW=gw[i];
		}
    }
 
    if( 1 == gk ) {
        gP=gSum;    
    } else if( gk < gn ) {
	    gP=gSum;
	  	i=0;
	  	j=end;
       if( gMaxW < gSum/gk ) { gMaxW=gSum/gk; }
        while( i < gn ) {
            while( end < gn ) {
                maxPackage+=gw[end];
                if(  maxPackage < gP ) {
                    carryPackage( maxPackage );
                } else {
                    break;
                }
                j++;
                end=i+j;
            }

            
            maxPackage-=gw[end];
            maxPackage-=gw[end-1];            
	        maxPackage-=gw[i];
           	end--;
            j-=2;
            i++;
            if( end <= i  ) {
                 j=maxPackage=0;
                end=i;
            }
        }
    } else {
		gP=gMaxW;
    }
    printf( "%d\n", gP );
 
    return 0;
}

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

int main() {
int n;
cin>>n;
int sum=0;
//double a[n-1];
priority_queue <double, vector<double>, greater<double> > a; 
for(auto i=0;i<n;i++){
  int x=0;

  cin>>x;
  a.push(x);
}
while(a.size()>1)
{
  double p=a.top();
  a.pop();
  double q=a.top();
  a.pop();
  a.push((p+q)/2);

}
cout<<a.top()<<endl;

}

Measured memory_bytes: 256
import bisect
N,M,V,P=map(int,input().split())
A=list(map(int,input().split()))
A.sort()

def is_ok(ind):
  bigs = bisect.bisect_right(A,A[ind]+M)
  if N-bigs >= P:
    return False
  votes = M*(V-1)
  j = 0
  for i in range(N-1,-1,-1):
    if i==ind:
      continue
    if j < P-1:
      votes = max(votes-M,0)
    else:
      cur = min(A[ind]+M,A[i]+M,A[i]+votes)
      votes -= max(0,cur-A[i])
    j += 1
  if votes == 0:
    return True
  else:
    return False

lo = 0
hi = N
mid = (lo+hi)//2
while lo < hi:
  mid = (lo+hi)//2
  if is_ok(mid):
    hi = mid
  else:
    lo = mid+1
print(N-hi)

Measured memory_bytes: 14964
#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(){
  int a,b;
  cin >> a >> b;
  a *= 500;
  if( a >= b ) cout << "Yes" << endl;
  else cout << "No" << endl;
}


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

int main() {
  int n, k;
  cin >> n >> k;
  
  int m = 1e9, s = 0;
  for (int i = 0; i < n; ++i) {
    int a;
    cin >> a;
    m = min(m, a);
    s += a;
  }
  cout << n + (k - s) / m << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
	int n=0,x=0,count=0,i,j,k;
	while(1){
		scanf("%d %d",&n,&x);
		if(n==0&&x==0) break;
		for(i=1;i<=n-2;i++){
			for(j=i+1;j<=n-1;j++){
				for(k=j+1;k<=n;k++){
					if((i+j+k)==x){
						count++;
					}
				}
			}
		}
		printf("%d\n",count);
		count=0;	//?????????
	}
	return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
//#define inf 0x3f3f3f3f3f3f3f3f
#define inf 0x3f3f3f3f
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define inv(x) Power(x, mod - 2)
#define fi first
#define se second
#define MP make_pair
#define PB push_back
#define N 200005

using namespace std;
typedef pair<int,int> Pair;
typedef long long ll;

const long double Pi = 3.14159265358979323846l;
const int mod = 1e9 + 7;
inline int add(int x, int y) { return (x += y) - (x >= mod ? mod : 0); }
inline void inc(int &x, int y) { (x += y) -= (x >= mod ? mod : 0); }
inline int mul(int x, int y) { return 1ll * x * y % mod; }
inline int Power(int x, int y) {
	int res = 1;
	while (y) {
		if (y & 1) res = mul(res, x);
		x = mul(x, x), y >>= 1;
	} return res;
}

template <class T> inline T	input() {
	T x; char ch; while (!isdigit(ch = getchar()));
	for (x = ch ^ 48; isdigit(ch = getchar()); x = x * 10 + (ch ^ 48));
	return x;
}

template <class T> inline void chkmin(T &x, T &y) { x = x < y ? x : y; }
template <class T> inline void chkmax(T &x, T &y) { x = x > y ? x : y; }

struct {
	inline operator int () { return input<int>(); }
	inline operator long long () { return input<long long>(); }
	template <class T> inline void operator () (T &x) { x = *this; }
	template<class T, class ...A> inline void operator () (T &x, A &...a)
	{ x = *this; this -> operator ()(a...); }
} read;

int n, k, flag;
int a[N], head;
char s[N];

int NEXT(int x) { return x == n ? 1 : x + 1; }

int main() {
	read(n, k);
	scanf("%s", s + 1);
	for (int i = 1; i <= n; ++i) a[i] = s[i] - 'A';
	head = 1;

	for (int i = 1; i <= k; ++i)
		if (!(a[head] ^ flag)) a[head] ^= 1;
		else head = NEXT(head), flag ^= 1;

	for (int i = 1, pos = head; i <= n; ++i, pos = NEXT(pos))
		putchar(a[pos] ^ flag ? 'B' : 'A');
	putchar('\n');
	return 0;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
#define int long long 
#define all(x) x.begin(),x.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
#define IOS ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);

signed main() {
	IOS;
	string a;
	cin>>a;
	if(a=="ABC"){
		cout<<"ARC"<<endl;
	}
	else{
		cout<<"ABC"<<endl;
	}
	

}


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

int main(){
    string s;
    cin>>s;
    long long int ans=0;
    vector<int>a(1000000);
    vector<pair <int,int>>b(1000000);
    for(long long int i=0;i<s.size()-1;i++){
        if(s[i]!=s[i+1]){
            ans++;
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 12160
"use strict";
function Main(input) {
    let cin = new Inputer(input);
    let N = cin.getInt();
    let A = cin.getIntArray(N);
    const gcd = (a, b) => b ? gcd(b, a % b) : a;
    let L = new Array(N + 1); L[0] = 0;
    let R = new Array(N + 1); R[N] = 0;
    for (let n = 0; n <= N; n++) {
        L[n + 1] = gcd(L[n], A[n]);
    }
    for (let n = N - 1; n >= 0; n--) {
        R[n] = gcd(R[n + 1], A[n]);
    }
    let M = new Array(N);
    for (let n = 0; n < N; n++) {
        M[n] = gcd(L[n], R[n + 1]);
    }
    console.log(Math.max(...M));
}
class Inputer{constructor(t){if(typeof t=='undefined')throw new Error('引数（stdin）を省略できません！');this.cnt=0,this.items=t.split(/\n|\s/)}getInt(){return this.items[this.cnt++]-0}getIntArray(t){if(typeof t=='undefined')throw new Error('引数（1以上）を省略できません！');let r=new Array(t);for(let e=0;e<t;e++)r[e]=this.getInt();return r}getStr(){return this.items[this.cnt++]}getStrArray(t){if(typeof t=='undefined')throw new Error('引数（1以上）を省略できません！');let r=new Array(t);for(let e=0;e<t;e++)r[e]=this.getStr();return r}}
if (typeof window == "undefined") Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 49460
#include <unordered_map>
#include <iostream>
#include <queue>
using namespace std;

constexpr int INF = 1<<25;

// 0..N-1: station (outside)
// N..N+2M-1: train have reached n-th station 
const int NL=100010, ML = 200010, L = NL+ML*2;
vector<pair<int,int>> edges[L];	// statio -out-> (station,cost)
int prices[L];

unordered_map<int64_t,int> dictionary; // station_company => node
int query(int station, int company) {
  static int id=0;
  auto& ret = dictionary[((station*1LL)<<32)+company];
  if (ret == 0) 
    ret = ++id;
  return ret+NL;
}
void add(int from, int to, int company) {
  int f  = query(from, company);
  int f0 = from;
  int t  = query(to, company);
  int t0 = to;

  edges[f].emplace_back(t, 0);
  edges[t].emplace_back(f, 0);
  edges[f].emplace_back(f0, 0);
  edges[f0].emplace_back(f, 1);
  edges[t].emplace_back(t0, 0);
  edges[t0].emplace_back(t, 1);
  prices[f] = INF;
  prices[f0] = INF;
  prices[t] = INF;
  prices[t0] = INF;
}

priority_queue<pair<int,int>> Q;

int main(int argc, char **argv) {
  int N, M;
  cin >> N >> M;

  prices[N-1] = INF;
  for (int i=0; i<M; i++) {
    int p, q, c;
    cin >> p >> q >> c; // 1-indexed
    add(p-1, q-1, c);
  }

  prices[0] = 0;
  Q.emplace(0,0);

  while (!Q.empty()) {
    auto n = Q.top(); Q.pop();
    int cur = n.second, current_price = -n.first;
    if (prices[cur] != current_price) continue;

    for (auto& next : edges[cur]) {
      int next_node = next.first, cost = next.second;
      int new_price = current_price + cost;
      if (prices[next_node] > new_price) {
        prices[next_node] = new_price;
        Q.emplace(-new_price, next_node);
      }
    }
  }

  int ret = prices[N-1];
  if (ret == INF) ret = -1;
  cout << ret << endl;

  return 0;
}




Measured memory_bytes: 50420
h, w = map(int, input().split())
s = [list(input()) for _ in range(h)]
ans = [[0]*w for _ in range(h)]
cnt=0
def dfs(x,y):
    if 0 <= x < h and 0 <= y < w:
        if s[x][y] == "#" and cnt<2 and ans[x][y]==0:
            ans[x][y] = 1 
            

for i in range(h):
    for j in range(w):
        if s[i][j] == '#':
            dfs(i+1, j)
            dfs(i, j+1)
            dfs(i, j-1)
            dfs(i-1, j)
        cnt=0
for i in range(h):
    for j in range(w):
        if s[i][j] == '#':
            if ans[i][j]!=1:
                print("No")
                exit()
print("Yes")


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

using namespace std;

int main() {
    std::ios::sync_with_stdio(false); 
    cin.tie(nullptr);
    
    int R, G, B, N;
    cin >> R >> G >> B >> N;
    int res = 0;
    for (int r = 0; r * R <= N; ++r) {
        for (int g = 0; r * R + g * G <= N; ++g) {
            int need = N - r * R - g * G;
            if (need % B == 0) {
                ++res;
            }
        }
    }
    cout << res << "\n";

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <cstdio>
using namespace std;

int main(){
	int n;
	double x1, y1, x2, y2, x3, y3, a, b, c, d, e, f, x, y, r;
	cin >> n;
	for (int i = 0; i < n; i++){
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
		a = sqrt((x3 - x2) * (x3 - x2) + (y3 - y2) * (y3 - y2));
		b = sqrt((x1 - x3) * (x1 - x3) + (y1 - y3) * (y1 - y3));
		c = sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
		d = acos((b * b + c * c - a * a) / (2 * b * c));
		e = acos((a * a + c * c - b * b) / (2 * a * c));
		f = acos((b * b + a * a - c * c) / (2 * b * a));
		x = (x1 * sin(d * 2) + x2 * sin(e * 2) + x3 * sin(f * 2)) / (sin(d * 2) + sin(e * 2) + sin(f * 2));
		y = (y1 * sin(d * 2) + y2 * sin(e * 2) + y3 * sin(f * 2)) / (sin(d * 2) + sin(e * 2) + sin(f * 2));
		r = a / (2 * sin(d));
		printf("%.3f %.3f %.3f\n",x,y,r);
	}
}

Measured memory_bytes: 1328
#include <stdio.h>
#include<string.h>
int main()
{
long int a=0,b=0,c=0,d=0,w=0,i,str1=0,str2=0,flag,j,count=0,k;
char x;
scanf("%ld %c %ld",&a,&x,&b);
switch(x)
{
    case '+':
              printf("%ld",a+b);
              break;
    case '-':
               printf("%ld",a-b);
               break;
}



 return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cstdlib>
#include <vector>
using namespace std;
int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);
	int x,y;
    cin >> x >> y;
	while(!(x==0 && y==0)){
        if(x <= y){
            cout << x << " " << y << "\n";
        }
        else {
            cout << y << " " << x << "\n";
        }
        cin >> x >> y;
    }
}


Measured memory_bytes: 3140
#include <bits/stdc++.h>
using namespace std;
int gcd(int a,int b) {
    if(a < b) {
        swap(a,b);
    }
    while(b != 0) {
        int tmp = a;
        a = b;
        b = tmp % b;
    }
    return a;
}
int main() {
    int a,b,c;
    cin >> a >> b >> c;
    for(int i = 1;i < b;i++) {
        if((a * i) % b == c) {
            cout << "YES" << endl;
            return 0;
        }
    }
    cout << "NO" << endl;
}


Measured memory_bytes: 256
import sys

N,M,L=map(int, sys.stdin.readline().split())

d=[  [ float("inf") for j in range(N+1) ]  for i in range(N+1) ]

for _ in range(M):
    a,b,c=map(int, sys.stdin.readline().split())
    d[a][b]=c
    d[b][a]=c
    d[a][a]=0
    d[b][b]=0

for k in range(1,N+1):
	for i in range(1,N+1):
		for j in range(1,N+1):
			d[i][j]=min(d[i][j], d[i][k]+d[k][j])

e=[  [ float("inf") for j in range(N+1) ]  for i in range(N+1) ]
for i in range(1,N+1):
    for j in range(i,N+1):
        if i==j:
            e[i][j]=0
            e[j][i]=0
        elif d[i][j]<=L:
            e[i][j]=1
            e[j][i]=1

for k in range(1,N+1):
	for i in range(1,N+1):
		for j in range(1,N+1):
			e[i][j]=min(e[i][j], e[i][k]+e[k][j])


Q=input()
for _ in range(Q):
    s,t=map(int, sys.stdin.readline().split())
    if e[s][t]==float("inf"):
        print -1
    else:
        print e[s][t]-1


Measured memory_bytes: 44444
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
const long long LINF=8931145141919364364,LMOD=998244353;
inline long long mod(long long n,long long m){return(n%m+m)%m;}
// const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};

int main(){
    int a,b,c; cin>>a>>b>>c;
    if((a<c&&c<b)||(b<c&&c<a)) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 256
import sys

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    A, B, C = map(int, input().split())
    if A <= C <= B:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    resolve()


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

using namespace std;
typedef long long ll;
typedef pair<ll, ll> p_ll;

template<class T>
void debug(T itr1, T itr2) { auto now = itr1; while(now<itr2) { cout << *now << " "; now++; } cout << endl; }
#define repr(i,from,to) for (int i=(int)from; i<(int)to; i++)
#define all(vec) vec.begin(), vec.end()
#define rep(i,N) repr(i,0,N)
#define per(i,N) for (int i=(int)N-1; i>=0; i--)

const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;

vector<ll> fac;
void c_fac(int x=pow(10,6)+10) { fac.resize(x,true); rep(i,x) fac[i] = i ? (fac[i-1]*i)%MOD : 1; }
ll inv(ll a, ll m=MOD) { ll b = m, x = 1, y = 0; while (b!=0) { int d = a/b; a -= b*d; swap(a,b); x -= y*d; swap(x,y); } return (x+m)%m; }
ll nck(ll n, ll k) { return fac[n]*inv(fac[k]*fac[n-k]%MOD)%MOD; }
ll gcd(ll a, ll b) { if (a<b) swap(a,b); return b==0 ? a : gcd(b, a%b); }
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; }


int main() {
  ll N, M; cin >> N >> M;
  ll dp1[M+1][N+1] = {}; repr(i,1,N+1) dp1[0][i] = 1;
  ll dp2[M+1][N+1] = {}; dp2[0][0] = 1;
  rep(m,M) {
    rep(n,N+1) {
      if (n==0) continue;
      else if (n==1) {
        if (N!=1) dp1[m+1][1] = (dp1[m+1][1] + dp1[m][1] + dp1[m][2]) % MOD;
        dp2[m+1][0] = (dp2[m+1][0] + dp1[m][1]) % MOD;
        dp2[m+1][1] = (dp2[m+1][1] + dp1[m][1]) % MOD;
      }
      else if (n==N) {
        dp1[m+1][N] = (dp1[m+1][N] + dp1[m][N] + dp1[m][N-1]) % MOD;
      }
      else {
        dp1[m+1][n] = (dp1[m+1][n] + dp1[m][n-1] + dp1[m][n]*2 + dp1[m][n+1]) % MOD;
      }
    }
    rep(n,N+1) {
      if (n==0) {
        dp2[m+1][0] = (dp2[m+1][0] + dp2[m][0] + dp2[m][1]) % MOD;
      }
      else if (n==N) {
        dp2[m+1][N] = (dp2[m+1][N] + dp2[m][N] + dp2[m][N-1]) % MOD;
      }
      else {
        dp2[m+1][n] = (dp2[m+1][n] + dp2[m][n-1] + dp2[m][n]*2 + dp2[m][n+1]) % MOD;
      }
    }
  }
  // rep(i,M+1) debug(dp1[i],dp1[i]+(N+1)); cout << endl;
  // rep(i,M+1) debug(dp2[i],dp2[i]+(N+1));

  ll result = 0;
  rep(i,N+1) result = (result+dp2[M][i]) % MOD;
  cout << result << endl;
  return 0;
}

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


int main(){
  ll t,d,l;
  while(cin>>t>>d>>l && t){
  ll count=0;
  ll b=-1000000;
  for(int i=0;i<t;i++){
    ll x;
    cin>>x;
    if(i+1==t){continue;}
    if(x>=l){
      b=i;
    }
    count+=i-b<d;
  }
  cout<<count<<endl;
  }





  return 0;
}



Measured memory_bytes: 3028
#include <iostream>
#include <typeinfo>

const int N[] = {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};

int main()
{
    int x;
    std::cin >> x;
    
    std::cout << N[--x] << std::endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
double a,b,h,m;
const double PI=acos(-1.0);
int main()
{
	scanf("%lf%lf%lf%lf",&a,&b,&h,&m);
	m+=h*60;
	double ang=(PI/30-PI/360)*m;
	printf("%.15lf",fabs(sqrt(a*a+b*b-2*a*b*cos(ang))));
	return 0;
}

Measured memory_bytes: 4256
N=int(input())
X=list(map(int,input().split()))

sort=sorted(X)

a=int(N/2-1)
b=int(N/2)

A=sort[a]
B=sort[b]

for i in range(N):
    if X[i]<=A:
        print(B)
    elif X[i]>=B:
        print(A)


Measured memory_bytes: 25228
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
struct edge { ll s, t, x; };
typedef pair<ll, ll> P;
typedef pair<ll,P> event;

const ll MAX = 510000;
const ll MOD = 1000000007;
//この設定だとn<10^7が限界。maxの０を一個増やせば100msかかるが一桁増やせる。
long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++) {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(ll n, ll k) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
  // 前処理
  COMinit();
  ll N,K;
  cin>>N>>K;
  ll ans=0ll;
  K=min(K,N-1ll);
  for(int i=0;i<=K;i++){
    ll g=COM(N,i)*COM(N-1ll,i);
    g%=MOD;
    ans+=g;
    ans%=MOD;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 15556
#include <cstdio>
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <string>
#include <cstring>
#include <sstream>
#include <queue>
#include <iomanip>
#include <algorithm>
#pragma comment(linker, "/STACK:16000000")
using namespace std;

typedef long long ll;

const int Maxn = 100005;

int n, m;
int a[Maxn];
bool tk[Maxn];
vector <int> neigh[Maxn];
int comp;
int seq[Maxn], slen;
vector <int> all;
ll res;

void Fill(int v)
{
	if (tk[v]) return;
	tk[v] = true; seq[slen++] = a[v];
	for (int i = 0; i < neigh[v].size(); i++)
		Fill(neigh[v][i]);
}

int main()
{
	scanf("%d %d", &n, &m);
	for (int i = 0; i < n; i++)
		scanf("%d", &a[i]);
	for (int i = 0; i < m; i++) {
		int x, y; scanf("%d %d", &x, &y);
		neigh[x].push_back(y);
		neigh[y].push_back(x);
	}
	for (int i = 0; i < n; i++) if (!tk[i]) {
		comp++; slen = 0;
		Fill(i);
		sort(seq, seq + slen);
		res += seq[0];
		for (int i = 1; i < slen; i++)
			all.push_back(seq[i]);
	}
	sort(all.begin(), all.end());
	if (comp == 1) { printf("0\n"); return 0; }
	int nd = comp - 2;
	if (all.size() < nd) { printf("Impossible\n"); return 0; }
	for (int i = 0; i < nd; i++)
		res += all[i];
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 7296
N = input()
H = [int(v) for v in input().split(' ')]

h0 = H[0] - 1
for i in range(1, len(H)):
    h = H[i]

    if h0 < h:
        h -= 1
    elif h0 > h:
        print("No")
        exit()

    h0 = h

   
print("Yes")

Measured memory_bytes: 14396
#include <bits/stdc++.h>
using namespace std;
int main(){
  int w, h, n;
  cin >> w >> h >> n;
  bool map[w][h];
  for(int i = 0; i < w; i++){
	  for(int j = 0; j < h; j++){
		  map[i][j] = false;
	  }
  }
  for(int i = 0; i < n; i++){
	  int x, y, a;
	  cin >> x >> y >> a;
	  switch (a)
	  {
	  case 1:
		  for(int j = 0; j < x; j++){
			  for(int k = 0; k < h; k++){
				  map[j][k] = true;
			  }
		  }
		  break;
	  case 2:
	  	for(int j = x; j < w; j++){
			  for(int k = 0; k < h; k++){
				  map[j][k] = true;
			  }
		  }
	  	
	  	break;
	  case 3:
	  for(int j = 0; j < w; j++){
			  for(int k = 0; k < y; k++){
				  map[j][k] = true;
			  }
		  }
	  	break;
	  case 4:
	  for(int j = 0; j < w; j++){
			  for(int k = y; k < h; k++){
				  map[j][k] = true;
			  }
		  }
	  	break;
	  }

  }
  int area = 0;
  for(int i = 0; i < w; i++){
	  for(int j = 0; j < h; j++){
		  if(!map[i][j]) area++;
	  }
  }
  cout << area << endl;
}


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

int main() {
	vector<bool> is_prime(100001, true);
	is_prime[0] = is_prime[1] = 0;
	for (int i = 2; i <= 100000; i++) {
		if (!is_prime[i]) continue;
		for (int j = 2 * i; j <= 100000; j += i) {
			is_prime[j] = 0;
		}
	}
	vector<int> sum(100001);
	for (int i = 0; i <= 100000; i++) {
		sum[i] = is_prime[i] && is_prime[(i + 1) / 2];
	}
	for (int i = 0; i < 100000; i++) {
		sum[i + 1] += sum[i];
	}
	int Q; cin >> Q;
	while(Q--) {
		int l, r; cin >> l >> r;
		cout << sum[r] - sum[l - 1] << "\n";
	}
}

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

int main(){
	long double A,B,H,M; cin>>A>>B>>H>>M;
	long double h_deg, m_deg, deg, rad, c2;
	long double PI = acos(-1);
	// 時針:30度/1時間 0.5度/1分
	h_deg = H*30 + M*0.5; // H時M分後の時針の角度(deg)
	h_deg = H*30 + M*0.5; // H時M分後の時針の角度(deg)
	// 分針:6度/1分
	m_deg = M*6; // M分後の分針の角度(deg)
	deg = h_deg - m_deg;
	rad = deg * PI / 180;
	c2 = A*A + B*B - 2*A*B*cos(rad);
	cout<<setprecision(20)<<fixed<< sqrt(c2) <<endl;
}


Measured memory_bytes: 4172
#include<stdio.h>
#include<algorithm>
#include<iostream>
using namespace std;
int n,i,k,sum,mn=0x3f3f3f3f;
int main() 
{
    cin>>n;
    for (i=1; i<=n; i++)
    {
        cin>>k;
        sum+=k;
        if (k<mn && k%10!=0) mn=k;
    }
    if (sum%10!=0) printf("%d",sum); 
	else if(mn!=0x3f3f3f3f) 
		printf("%d",sum-mn); 
	else printf("0");
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i,n) for(ll i=0;i<(int)(n);i++)
#define REP(i,m,n) for(ll i=m;i<(int)(n);i++)
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; }
typedef long long ll;
typedef pair<ll,ll> pint;
const long long INF = 1LL<<60;
const ll MOD = 1000000007;
ll gcd(ll a,ll b){
    if(b==0){
        return a;
    }
    else{
        return gcd(b,a%b);
    }
}
int main(){
    ll n,k;cin>>n>>k;
    vector<ll> ans(n,0);
    rep(i,k){
        ll d;cin>>d;
        rep(j,d){
            ll a;cin>>a;
            ans[a-1]+=1;
        }
    }
    ll cnt=0;
    rep(i,n){
        if(ans[i]==0){
            cnt+=1;
        }
    }
    cout<<cnt<<endl;
}


Measured memory_bytes: 3640
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<list>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<utility>
#include<vector>
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
namespace mp = boost::multiprecision;

typedef long long ll;
typedef unsigned long long ull;

// 最大公約数
ll gcd(ll a, ll b)
{
    if (a < 0)
        a = -a;
    if (b < 0)
        b = -b;
    if (b == 0)
        return a;
    else
        return gcd(b, a % b);
}

// 最小公倍数
ll lcm(ll a, ll b)
{
    ll g = gcd(a, b);
    return a / g * b;
}

int main()
{
    int a, b, c,d;
    cin >> a >> b >> c;
    if (a > c)
    {
        cout << "NG" << endl;
        return 0;
    }
    for (int i = 1; i <= c; i++)
    {
        d = a * i;
        if (b <= d && d <= c) {
            cout << "OK" << endl;
            return 0;
        }
    }
    cout << "NG" << endl;
    return 0;
}

Measured memory_bytes: 3632
using System;
using System.Collections.Generic;
using System.Linq;

namespace AOJ000
{
    class Program
    {
        static void Main(string[] args)
        {
            var str = Console.ReadLine();
            var list = new List<string>();

            foreach (var x in str.Split(' '))
            {
                list.Add(x);
            }

            list.Sort();

            Console.WriteLine(string.Join(" ", list.ToArray()));
        }
    }
}

Measured memory_bytes: 6416
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
using ll = long long;

ll gcd(ll a, ll b){
    if(b==0) return a;
    return gcd(b, a%b);
}
int arr[20];
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
    int n; cin >> n;
    for(int i=0; i<n; ++i){
        cin >> arr[i];
    }
    
    int maxV=0;
    int ans=0;
    for(int i=0; i<n; ++i){
        if(arr[i]>=maxV){
            maxV = arr[i];
            ans++;
        }
    }
    cout << ans << endl;
	int c; cin >> c;
	return 0;

}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    sumitrust2019e()
}

private const val MOD = (1000000007).toLong()

private enum class Color { R, G, B }

fun sumitrust2019e() {
    val n = readLine()!!.toInt()
    val aList = readLine()!!.split(' ').map { it.toLong() }.toLongArray()

    var answer = 1L
    val left = mutableMapOf<Color, Long>(Color.R to 0, Color.G to 0, Color.B to 0)
    aList.forEachIndexed { index, i ->
        val candidate = left.filterValues { it == i }
        answer = answer * candidate.size % MOD

        var changed = false
        candidate.forEach {
            val (t, u) = it
            if (!changed) left[t] = left[t]!! + 1
            changed = true
        }
    }

    println(answer)
}


Measured memory_bytes: 59572
package main

import (
	"fmt"
)

func main() {
	var a, b int
	fmt.Scanf("%d", &a)
	fmt.Scanf("%d", &b)
	if a > 9 || b > 9 {
		fmt.Printf("%d\n", -1)
	} else {
		fmt.Printf("%d\n", a*b)
	}
}


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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

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

#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

//-------------------------------------------------
//--Enum various numbers
//-------------------------------------------------
namespace Enum
{
    using fint = ::std::int_fast64_t;
    //素因数分解(素因数列挙)
    ::std::map<fint,int> factor(fint n)
    {
        ::std::map<fint,int> ret;
        for(fint i=2; i*i<=n; i++){
            while(n%i==0){
                ret[i]++;
                n/=i;
            }
        }
        if (n!=1) ret[n]++;
        return ret;
    }
    //約数列挙
    ::std::vector<fint> divisor(fint n)
    {
        ::std::vector<fint> ret;
        for(fint i=1; i*i<=n; i++){
            if (n%i==0){
                ret.push_back(i);
                if (i*i!=n) ret.push_back(n/i);
            }
        }
        return ret;
    }
    //商列挙(割る最小の数と商のペア)
    ::std::vector<::std::pair<fint,fint> > quotient(fint n)
    {
        ::std::vector<::std::pair<fint,fint> > ret;
        fint i=0;
        for(i=1; i*i<=n; i++){
            ret.emplace_back(i,n/i);
        }
        for(; i<=n; i++){
            fint d = n/i;
            ret.emplace_back(i,d);
            i+=(n-d*i)/d;
        }
        return ret;
    }
    //素数判定(おまけ)
    bool isprime(fint n)
    {
        for(fint i=2; i*i<=n; i++){
            if (n%i==0) return false;
        }
        return true;
    }
}

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

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n; cin>>n;
    auto div = Enum::divisor(n-1);
    ll ans=div.size()-1;
    for(ll i=1; i*i<=n; i++){
        if (n%i==0){
            if (i==1){ans++; continue;}
            ll j = n/i;
            ll m=j;
            while(m%i==0) m/=i;
            if (m%i==1) ans++;
            if (i*i==n) continue;
            m=i;
            while(m%j==0) m/=j;
            if (m%j==1) ans++;
        }
    }
    cout<<ans<<"\n";
    return 0;
}


Measured memory_bytes: 256