akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const double PI=3.14159265358979323846;
const int64_t waru = 1000000007;
using in = int64_t;
const in INF=1<<30;
using vec = vector<vector<int>>;
#define ans(i,j) U[i][j]+S[i][j]+R[i][j]+L[i][j]-3

int main(){
int h,w;
  cin>>h>>w;
  vector<vector<char>> a(h,vector<char>(w));
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
       cin>>a[i][j];
    }
  }

  vec U(h,vector<int>(w));
  vec S(h,vector<int>(w));
  vec R(h,vector<int>(w));
  vec L(h,vector<int>(w));
        
  for(int i=0;i<w;i++){
    if(a[0][i]=='.') U[0][i]=1;
    else U[0][i]=0;
  }
  for(int i=1;i<h;i++){
    for(int j=0;j<w;j++){
       if(a[i][j]=='#'){ U[i][j]=0;continue;}
       U[i][j]=U[i-1][j]+1;
    }
  }
 //       
  for(int i=0;i<w;i++){
    if(a[h-1][i]=='.') S[h-1][i]=1;
    else S[h-1][i]=0;
  }
  for(int i=h-2;i>=0;i--){
    for(int j=0;j<w;j++){
       if(a[i][j]=='#'){ S[i][j]=0;continue;}
       S[i][j]=S[i+1][j]+1;
    }
  }
        
  for(int i=0;i<h;i++){
    if(a[i][w-1]=='.') L[i][w-1]=1;
    else L[i][w-1]=0;
  }
  for(int i=0;i<h;i++){
    for(int j=w-2;j>=0;j--){
       if(a[i][j]=='#'){ L[i][j]=0;continue;}
       L[i][j]=L[i][j+1]+1;
    }
  }
        
  for(int i=0;i<h;i++){
    if(a[i][0]=='.') R[i][0]=1;
    else R[i][0]=0;
  }
  for(int i=0;i<h;i++){
    for(int j=1;j<w;j++){
       if(a[i][j]=='#'){ R[i][j]=0;continue;}
       R[i][j]=R[i][j-1]+1;
    }
  } 
        
        int ret = ans(0,0);
 /* cout<<U[0][0]<<endl;
  cout<<S[0][0]<<endl;
  cout<<R[0][0]<<endl;
  cout<<L[0][0]<<endl;
  
         cout<<ret<<endl;   */   
  
        for(int i=0;i<h;i++){
           for(int j=0;j<w;j++){
              ret = max(ret,ans(i,j));
           }
        }
        
        cout<<ret<<endl;
}

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

int main(){
  ll N, M; cin >> N >> M;
  vector<ll> a(N), powcount(N);
  for(int i = 0; i < N; i++){
    ll x; cin >> x;
    a[i] = x/2;
    while(x % 2 == 0){
      powcount[i]++;
      x /= 2;
    }
  }
  ll number = a[0];
  for(int i = 1; i < N; i++){
    number = number / __gcd(number, a[i]) * a[i];
  }
  ll ans = M/number;
  bool ok = true;
  for(int i = 1; i < N; i++){
    if(powcount[i] != powcount[0]){
      ok = false;
    }
  }
  if(!ok) cout << 0 << endl;
  else cout << (ans + 1)/2 << endl;
}

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

#define fec(i, x, y) (int i = head[x], y = g[i].to; i; i = g[i].ne, y = g[i].to)
#define dbg(...) fprintf(stderr, __VA_ARGS__)
#define File(x) freopen(#x".in", "r", stdin), freopen(#x".out", "w", stdout)
#define fi first
#define se second
#define pb push_back

template<typename A, typename B> inline char smax(A &a, const B &b) {return a < b ? a = b , 1 : 0;}
template<typename A, typename B> inline char smin(A &a, const B &b) {return b < a ? a = b , 1 : 0;}

typedef long long ll; typedef unsigned long long ull; typedef std::pair<int, int> pii;

template<typename I>
inline void read(I &x) {
	int f = 0, c;
	while (!isdigit(c = getchar())) c == '-' ? f = 1 : 0;
	x = c & 15;
	while (isdigit(c = getchar())) x = (x << 1) + (x << 3) + (c & 15);
	f ? x = -x : 0;
}

#define lowbit(x) ((x) & -(x))

const int N = 20;
const int M = (1 << 16) + 7;
const int P = 1e9 + 7;

int n, m, S;
int a[N], dp[N][M];
int inv[M], fac[M], ifac[M];

inline int smod(int x) { return x >= P ? x - P : x; }
inline void sadd(int &x, int y) { x += y; x >= P ? x -= P : x; }
inline int fpow(int x, int y) {
	int ans = 1;
	for (; y; y >>= 1, x = (ll)x * x % P) if (y & 1) ans = (ll)ans * x % P;
	return ans;
}

inline void ycl(int n) {
	fac[0] = 1; for (int i = 1; i <= n; ++i) fac[i] = (ll)fac[i - 1] * i % P;
	inv[1] = 1; for (int i = 2; i <= n; ++i) inv[i] = (ll)(P - P / i) * inv[P % i] % P;
	ifac[0] = 1; for (int i = 1; i <= n; ++i) ifac[i] = (ll)ifac[i - 1] * inv[i] % P;
}
inline int C(int x, int y) {
	if (x < y) return 0;
	return (ll)fac[x] * ifac[y] % P * ifac[x - y] % P;
}

inline void DP() {
	S = (1 << n) - 1;
	dp[0][0] = 1;
	for (int i = 0; i < m; ++i) {
		for (int s = 0; s <= S; ++s) {
			int les = S + 1 - a[i + 1] - s;
			sadd(dp[i + 1][s], dp[i][s]);
			for (int j = 0; j < n; ++j) if (!((s >> j) & 1))
				sadd(dp[i + 1][s | (1 << j)], (ll)dp[i][s] * C(les, (1 << j) - 1) % P * fac[1 << j] % P);
//		dbg("dp[%d][%d] = %d\n", i, s, dp[i][s]);
		}
	}
}

inline void work() {
	ycl(1 << n);
	DP();
	int ans = 0;
	for (int i = 0; i <= S; ++i) {
		int cnt = 0, s = i;
		while (s) ++cnt, s -= lowbit(s);
		if (cnt & 1) sadd(ans, P - (ll)dp[m][i] * fac[S - i] % P);
		else sadd(ans, (ll)dp[m][i] * fac[S - i] % P);
//		dbg("dp[%d][%d] = %d, cnt = %d, %lld\n", m, i, dp[m][i], cnt, (ll)dp[m][i] * fac[S - i] % P);
	}
	ans = (ll)ans * (S + 1) % P;
	printf("%d\n", ans);
}

inline void init() {
	read(n), read(m);
	for (int i = 1; i <= m; ++i) read(a[i]);
	std::reverse(a + 1, a + m + 1);
}

int main() {
#ifdef hzhkk
	freopen("hkk.in", "r", stdin);
#endif
	init();
	work();
	fclose(stdin), fclose(stdout);
	return 0;
}

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

#define pb push_back
#define mp make_pair
#define f first
#define s second

using namespace std;

typedef vector<int> vi;
typedef pair<int, int> ii;
typedef long long ll;

int main(){

    ios_base::sync_with_stdio(0);
    cin.tie(0);

    int N;
    int K;
    cin >> N >> K;
    int h[N];

    for(int i=0; i < N; i++) cin >> h[i];

    int dp[N];
    for(int i=0; i < N; i++) dp[i] = 1e9 + 5;
    dp[0]=0;
    for(int i=0; i < N; i++){
        for(int j=i+1; j <= i+K; j++){
            if(j < N)
                dp[j] = min(dp[j], dp[i]+abs(h[i]-h[j]));
        }
    }

    cout << dp[N-1] << endl;

    return 0;
}

Measured memory_bytes: 1024
#include<stdio.h>
#define MAX 500000
#define SENTINEL 2000000000

int L[MAX/2+2],R[MAX/2+2];
int cnt;

void merge(int A[],int n,int left,int mid,int right){
	int i,j,k;
	int n1=mid-left;
	int n2=right-mid;
	for(i=0;i<n1;i++){
		L[i]=A[left+i];
	}
	for(i=0;i<n2;i++){
		R[i]=A[mid+i];
	}
	L[n1]=R[n2]=SENTINEL;
	i=0,j=0;
	for(k=left;k<right;k++){
		cnt++;
		if(L[i]<=R[j]){
			A[k]=L[i++];
		}else{
			A[k]=R[j++];
		}
	}
}

void mergeSort(int A[],int n,int left,int right){
	int mid;
	if(left+1<right){
		mid=(left+right)/2;
		mergeSort(A,n,left,mid);
		mergeSort(A,n,mid,right);
		merge(A,n,left,mid,right);
	}
}

int main(){
	int A[MAX],n,i;
	cnt=0;
	
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&A[i]);
	}
	mergeSort(A,n,0,n);
	for(i=0;i<n;i++){
		if(i)printf(" ");
		printf("%d",A[i]);
	}
	printf("\n%d\n",cnt);
	return 0;
}


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

using namespace std;

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

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

#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair
#define each(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define exist(s,e) ((s).find(e)!=(s).end())
#define range(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  range(i,0,n)
#define clr(a,b) memset((a), (b) ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

const double eps = 1e-10;
const double pi  = acos(-1.0);
const ll INF =1LL << 62;
const int inf =1 << 29;

int main(void){
    for(int n, k, t, u, v, l; cin >> n >> k >> t >> u >> v >> l;){
        vi d(n);
        rep(i, n) cin >> d[i];

        double res = 0.;
        double default_tpm = 1. / u, speedup_tpm = 1. / v;
        int numD = 0;
        bool isSpeedup = false;
        int speedup_m = t * v, spend_m = 0;
        int ind = 0;

        range(i, 1, l + 1){
            res += (isSpeedup ? speedup_tpm:default_tpm);
            if(isSpeedup) spend_m++;

            if(ind < d.size() && i == d[ind]){
                if(isSpeedup){
                    if(numD == k){
                        spend_m = 0;
                    }
                    else{
                        numD++;
                    }
                }
                else{
                    isSpeedup = true;
                    spend_m = 0;
                }
                ind++;
            }

            if(!isSpeedup) continue;

            if(spend_m == speedup_m){
                if(numD > 0){
                    numD--;
                    spend_m = 0;
                }
                else{
                    isSpeedup = false;
                }
            }
        }
        
        printf("%.9f\n", res);
    }

	return 0;
}

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

int main()
{
	char suit;
	int n, rank;
	int c[4][13];
	for (int x = 0; x < 4; x++)
	{
		for (int y = 0; y < 13; y++)
		{
			c[x][y] = 0;
		}
	}

	cin >> n;

	for (int a = 1; a <= n; a++)
	{
		cin >> suit >> rank;
		switch (suit)
		{
		case 'S':c[0][rank - 1] = 1; break;
		case 'H':c[1][rank - 1] = 1; break;
		case 'C':c[2][rank - 1] = 1; break;
		case 'D':c[3][rank - 1] = 1; break;
		}
	}


	for (int x = 0; x < 4; x++)
	{
		for (int y = 0; y < 13; y++)
		{
			switch (x)
			{
			case 0:if (c[x][y] == 0) cout << "S" << " " << y + 1 << endl; break;
			case 1:if (c[x][y] == 0) cout << "H" << " " << y + 1 << endl; break;
			case 2:if (c[x][y] == 0) cout << "C" << " " << y + 1 << endl; break;
			case 3:if (c[x][y] == 0) cout << "D" << " " << y + 1 << endl; break;
			}
		}
	}





}


Measured memory_bytes: 3096
using System;

class Atcoder100
{
    public static void Main()
    {
        int age = int.Parse(Console.ReadLine());

        if (age == 1)
            Console.WriteLine("Hello World");
        else
        {
            int a = int.Parse(Console.ReadLine());
            int b = int.Parse(Console.ReadLine());

            Console.WriteLine(a + b);
        }
    }
}

Measured memory_bytes: 11092
#include <stdio.h>
#include <iostream>
#include <vector>
#include <assert.h>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <stack>
#include <string>
#include <sstream>
#include <memory.h>
#include <time.h>
#include <string.h>
#include <stdlib.h>
#include <algorithm>
using namespace std;
typedef long long ll;
string s;
bool ask(int m) {
	string ret;
	//ret += s[m];
	cout << m << endl;
	cin >> ret;
	if (ret == "-" || ret == "Vacant") {
		//puts("YES");
		exit(0);
	}
	return ret == "1" || ret == "Male";
}
int main()
{
	int n;
	cin >> n;
	//cin >> s;
	int me = ask(0);
	int l = 1, r = n - 2, m;
	while (l <= r) {
		m = (l + r) / 2;
		int cur = ask(m);
		int should = (m & 1) ^ me;
		if (cur != should)
			r = m - 1;
		else
			l = m + 1;
	}
	ask(n - 1);
	return 0;
}

Measured memory_bytes: 852
package main

import "fmt"

func main() {
	var a, b, c int
	fmt.Scan(&a, &b, &c)

	var m [200]int

	m[a] = 1
	m[b] = 1
	m[c] = 1

	ans := 0
	for _, v := range m {
		if v == 1 {
			ans++
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 1792
#include<iostream>
#include<algorithm>
using namespace std;
#define MAX 1100
#define MAX_W 11000
 
 
int n, mimi = MAX_W;
bool used[MAX];
pair<int,int> w[MAX];
 
int hoge(int x,int sum, int mi,int count){
    if(used[x]){
        return min(sum+mi*(count-2), mi + sum + (count+1)*mimi);
    } else {
        used[x] = true;
        return hoge(w[x].second,sum+w[x].first,min(mi,w[x].first),count+1);
    }
}
 
int main(){
    int W, sum = 0;
     
    cin>>n;
     
    for(int i = 0; i < n; i++){
        cin>>W;
        w[i] = make_pair(W,i);
        mimi = min(W, mimi);
    }
     
    sort(w, w + n);
     
    for(int i = 0; i < n; i++){
        if(!used[i]) sum +=  hoge(i,0,w[i].first,0);
    }
     
    cout<<sum<<endl;
     
    return 0;
}


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

int main() {
  int n, sum=0;
  cin>>n;
  for(int i=0;i<n;i++){
    int a,b;
    cin>>a>>b;
    b-=a-1;
    sum+=b;
  }
  cout<<sum<<endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	private static final int MOD = 1000000007;

	public static void main(String[] args) {
		var sc = new Scanner(System.in);
		var n = sc.nextInt();
		var k = sc.nextInt();
		sc.close();

		var l = new int[n + 1];
		for (var i = 0; i < n + 1; i++) {
			l[i] = i == 0 ? 1 : (l[i - 1] + (i + 1)) % MOD;
		}

		var r = new int[n + 1];
		for (var i = 0; i < n + 1; i++) {
			r[i] = i == 0 ? n + 1 : (r[i - 1] + (n + 1 - i)) % MOD;
		}

		var sum = 0L;
		for (var i = k; i <= n + 1; i++) {
			sum = (sum + r[i - 1] - l[i - 1] + 1 + MOD) % MOD;
		}

		System.out.println(sum);
	}
}

Measured memory_bytes: 37272
n = int(input())
P = list(map(int, input().split()))

ans = 0
for i in range(n):
    if i == n-1 and P[i] == i+1:
        ans += 1
    elif P[i] == i+1:
        P[i], P[i+1] = P[i+1], P[i]
        ans += 1
print(ans)


Measured memory_bytes: 14008
#include<stdio.h>
int main(){
  char s[5];
  int n,c[4]={},i;
  scanf("%d",&n);
  for(i=0;i<n;i++){scanf("%s",s);c[s[0]=='A'?0:(s[0]=='W'?1:(s[0]=='T'?2:3))]++;}
  printf("AC x %d\nWA x %d\nTLE x %d\nRE x %d\n",c[0],c[1],c[2],c[3]);
}


Measured memory_bytes: 1736
import sys

input = sys.stdin.readline
N, x = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
ans = 0
for i in range(N-1):
    if x < A[i]:
        break
    x -= A[i]
    ans += 1
if A[-1] == x:
    ans += 1

print(ans)

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


using namespace std;

int main() {

	int n;
	cin >> n;

	int i = 1;
	while (1) {
		int x = i;
		if (x % 3 == 0) {
			cout << " " << i;
		}
		else {
			while(x){
				if (x % 10 == 3) {
					cout << " " << i;
					break;
				}
				x /= 10;
			}
		}

		i++;
		if (i > n) {break; }
	}
	cout << endl;

}


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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
  for(auto &e:u) fill_v<T>(e,v...);
}

int main(void) {
	int64 N, H, W;
	cin >> N >> H >> W;
	vector<int64> x(N);
	REP(i, N) cin >> x[i];
	vector<int64> sum(N*W+1, 0);
	REP(i, N) {
		if (i%2 == 0) {
			sum[W*i+x[i]]+=1;
			sum[W*i+x[i]+W] += -1;
		} else {
			sum[W*i-x[i]] += 1;
			sum[W*i-x[i]+W] += -1;
		}
	}
	int64 res = 0;
	REP(i, N*W) sum[i+1] += sum[i];
	REP(i, N*W) {
		if (sum[i] == 0)
			res += H;
	}
	cout << res << endl;
}



Measured memory_bytes: 3156
import java.util.*;
class Main{
    public static void main(String[] args){
        Scanner scan=new Scanner(System.in);
        double r;
        double area,cir;
        r=scan.nextDouble();
        area = Math.PI * r * r;
        cir= Math.PI * 2 * r;
        System.out.printf("%.5f %.5f\n",area,cir);
    }
}


Measured memory_bytes: 28256
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
const ll MOD = 1e9+7;
const ll INF = 1LL << 60;
const vi d8x = {1, 0, -1, 0, 1, -1, -1, 1};
const vi d8y = {0, 1, 0, -1, 1, 1, -1, -1};
const vi d4x = {1, 0, -1, 0};
const vi d4y = {0, 1, 0, -1};

//---------------from here-----------------

int main(){
    int a,b; cin>>a>>b;
    cout<< max(0, a-2*b)<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define pf push_front
#define all(t) t.begin(), t.end()
#define inrange(i, a, b) (((i)>= min((a), (b))) && ((i) <= max((a), (b))))
typedef vector<ll> vi;
typedef pair<ll, ll> pii;
#define fi first
#define se second
#define show(x) cout << #x << " is " << x << "\n";
const ll inf = 2e18;
const ll mod = 1e9 + 7;
const ld pi = 3.141592653589793238462643383279502884;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

void print(ll a[], ll n){for(ll i=0;i<n;i++){cout<<a[i]<<" ";}cout<<"\n";}
ll power(ll x, ll y, ll M = inf){
	if(y<=0) return 1;
    ll ans = 1;
    x %= M;
    while(y){
        if(y&1)
            ans = (x * ans) % M;

        x = (x * x) % M;
        y >>= 1;
    }
    return ans;
}
ll modInverse(ll n) {return power(n, mod-2, mod);}
inline ll mul(ll a, ll b){ return (a * b) % mod; }
inline ll sub(ll a, ll b){ ll c = a - b; if(c < 0) c += mod; return c; }
inline ll add(ll a, ll b){ ll c = a + b; if(c >= mod) c -= mod; return c; }
inline ll divi(ll a, ll b){ return mul(a, modInverse(b)); }

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

//const ll N = 1e5 + 1;
//vector<ll> adj[N];
//bool visited[N];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    cout<<fixed<<setprecision(10);

	ll n, m, k;
	cin>>n>>m>>k;
	char a[n][m];
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			cin>>a[i][j];
		}
	}
	ll ans=0;
	for(ll i=0;i<power(2, n+m);i++){
		vi r(n, 0);
		vi c(m, 0);
		for(int j=0;j<n;j++){
			if(i&(1<<j)) r[j] = 1;
		}
		for(int j=n;j<m+n;j++){
			if(i&(1<<j)) c[j-n] = 1;
		}
		int co=0;
		for(int i=0;i<n;i++){
			for(int j=0;j<m;j++){
				if(r[i]==0 && c[j]==0 && a[i][j]=='#') co++;
			}
		}
		if(co==k) ans++;
	}
	cout<<ans;

    return 0;
}


Measured memory_bytes: 3656
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader bw = new BufferedReader(new InputStreamReader(System.in));
		String s = bw.readLine();
		String[] w = s.split("\\s+");
		int healthA = Integer.parseInt(w[0]);
		int attackA = Integer.parseInt(w[1]);
		int healthB = Integer.parseInt(w[2]);
		int attackB = Integer.parseInt(w[3]); 
		
		int bitTimesA = healthA/attackB;
		bitTimesA+=(healthA%attackB)==0?0:1;
		int bitTimesB = healthB/attackA;
		bitTimesB+=(healthB%attackA)==0?0:1;
		
		if( bitTimesA >= bitTimesB) {
			System.out.println("Yes");
		}
		else if( bitTimesA < bitTimesB) {
			System.out.println("No");
		}
		
		bw.close();
	}
	 
	
}	



Measured memory_bytes: 33972
#include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define REP(i,num,n) for(ll i=num, i##_len=(n); i<i##_len; ++i)
#define repprev(i,a,b) for(ll i=b-1;i>=a;i--)
#define reprev(i,n) repprev(i,0,n)
using namespace std;
#define sz(x) ((int)(x).size())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define MEMSET(v, h) memset((v), h, sizeof(v))
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; }
#define pb push_back
#define mp make_pair
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define BIT_FLAG_0 (1<<0) // 0000 0000 0000 0001
#define BIT_FLAG_1 (1<<1) // 0000 0000 0000 0010
#define BIT_FLAG_2 (1<<2) // 0000 0000 0000 0100
#define BIT_FLAG_3 (1<<3) // 0000 0000 0000 1000
#define BIT_FLAG_4 (1<<4) // 0000 0000 0001 0000
#define BIT_FLAG_5 (1<<5) // 0000 0000 0010 0000
#define BIT_FLAG_6 (1<<6) // 0000 0000 0100 0000
#define BIT_FLAG_7 (1<<7) // 0000 0000 1000 0000
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
const ll INF = 1LL<<60;

const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int 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(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

struct UnionFind {
    vector<ll> par;

    UnionFind(ll n) : par(n, -1) { }
    void init(ll n) { par.assign(n, -1); }

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

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

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

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

ll calc(long long A) {
	ll cnt1 = (A + 1) / 2;
	ll ans = cnt1 % 2;
	if (A % 2 == 0) ans ^= A;
	return ans;
}

int main(){
    ll A, B;
  	cin >> A >> B;
  	ll ans = calc(B) ^ calc(A - 1);
	cout << ans << endl;
}

Measured memory_bytes: 256
import sys
import math
import itertools as it
def i():return int(sys.stdin.readline().replace("\n",""))
def i2():return map(int,sys.stdin.readline().replace("\n","").split())
def s():return str(sys.stdin.readline().replace("\n",""))
def l():return list(sys.stdin.readline().replace("\n",""))
def intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def lx():return list(map(lambda x:int(x)*-1,sys.stdin.readline().replace("\n","").split()))
def t():return tuple(map(int,sys.stdin.readline().replace("\n","").split()))

if __name__ == "__main__":pass
n, k = i2()
h = intl()
h.sort()
if n > k:
    print(sum(h[:n-k]))
else:
    print(0)

Measured memory_bytes: 25900
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;
using msi = map<string, int>;
using mii = map<int, int>;
using psi = pair<string, int>;
using pii = pair<int, int>;
using vlai = valarray<int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define INF (ll)1E9
#define EPS 1E-9
#define MOD 1000000007
#define PI 3.1415926535897932384

template <class T>ostream &operator<<(std::ostream &o, const vector<T> &v)
{
	rep(i, v.size()) {
		o << (i > 0 ? " " : "") << v[i];
	}
	return o;
}

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

//constexpr ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }

void solve(int m) {
	vs name(m);
	int low, high;
	vector<vector<bool>> val(m, vector<bool>(256, false));
	rep(i, m) {
		cin >> name[i] >> low >> high;
		rep(j, 256) {
			if (low <= j&&j <= high)val[i][j] = true;
		}
	}
	int n;
	cin >> n;
	string c;
	vs ex;
	rep(i, n) {
		cin >> c;
		ex.push_back(c);
	}


	stack<vector<bool>> s;
	rep(i, n) {
		//cout << ex[i] << endl;
		if (ex[i][0] - '0' >= 0 && ex[i][0] - '0' <= 9) {
			int num = stoi(ex[i]);
			vector<bool> vb(256, false);
			vb[num] = true;
			s.push(vb);
		}
		else if (ex[i][0]=='+') {
			vector<bool> b = s.top(); s.pop();
			vector<bool> a = s.top(); s.pop();
			vector<bool> r(256,false);
			rep(j, 256) {
				if (a[j]) {
					rep(k, 256) {
						if (b[k]) {
							r[(j + k) % 256] = true;
						}
					}
				}
			}
			s.push(r);
		}
		else if (ex[i][0] == '-') {
			vector<bool> b = s.top(); s.pop();
			vector<bool> a = s.top(); s.pop();
			vector<bool> r(256, false);
			rep(j, 256) {
				if (a[j]) {
					rep(k, 256) {
						if (b[k]) {
							r[(j - k+256) % 256] = true;
						}
					}
				}
			}
			s.push(r);
		}
		else if (ex[i][0] == '*') {
			vector<bool> b = s.top(); s.pop();
			vector<bool> a = s.top(); s.pop();
			vector<bool> r(256, false);
			rep(j, 256) {
				if (a[j]) {
					rep(k, 256) {
						if (b[k]) {
							r[(j * k + 256) % 256] = true;
						}
					}
				}
			}
			s.push(r);
		}
		else if (ex[i][0] == '/') {
			vector<bool> b = s.top(); s.pop();
			vector<bool> a = s.top(); s.pop();
			vector<bool> r(256, false);
			rep(j, 256) {
				if (a[j]) {
					rep(k, 256) {
						if (b[k]) {
							if (k == 0) {
								cout << "error" << endl;
								return;
							}
							r[(j / k + 256) % 256] = true;
						}
					}
				}
			}
			s.push(r);
		}
		else {//val
			rep(j, m){
				if (ex[i] == name[j]) {
					s.push(val[j]);
				}
			}
		}
	}
	cout << "correct" << endl;
}

int main(void) {
	int n;
	while(cin>>n){
		solve(n);
	}
}




Measured memory_bytes: 3244
#include<algorithm>     //sort,二分探索,など
#include<bitset>        //固定長bit集合
#include<cmath>         //pow,logなど
#include<complex>       //複素数
#include<deque>         //両端アクセスのキュー
#include<functional>    //sortのgreater
#include<iomanip>       //setprecision(浮動小数点の出力の誤差)
#include<iostream>      //入出力
#include<iterator>      //集合演算(積集合,和集合,差集合など)
#include<map>           //map(辞書)
#include<numeric>       //iota(整数列の生成),gcdとlcm(c++17)
#include<queue>         //キュー
#include<set>           //集合
#include<stack>         //スタック
#include<string>        //文字列
#include<unordered_map> //イテレータあるけど順序保持しないmap
#include<unordered_set> //イテレータあるけど順序保持しないset
#include<utility>       //pair
#include<vector>        //可変長配列

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
typedef vector<vector<string>> vvs;
typedef vector<vector<bool>> vvb;
const ll MOD = 1000000007;
const ll INF = 1000000000000000000;
#define rep(i,n) for(int i=0;i<n;i++)
#define repl(i,s,e) for(int i=s;i<e;i++)
#define reple(i,s,e) for(int i=s;i<=e;i++)
#define revrep(i,n) for(int i=n-1;i>=0;i--)
#define all(x) (x).begin(),(x).end()

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

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

    int N;
    cin >> N;

    vll plus, minus;
    rep(i, N)
    {
        ll a;
        cin >> a;

        if (a >= 0)
        {
            plus.push_back(a);
        }
        else
        {
            minus.push_back(a);
        }
    }

    sort(all(plus), greater<ll>());
    sort(all(minus));

    if (minus.empty())
    {
        minus.push_back(plus.back());
        plus.pop_back();
    }

    if (plus.empty())
    {
        plus.push_back(minus.back());
        minus.pop_back();
    }

    vector<pair<ll, ll>> v;
    ll accum = minus.front();
    
    rep(i, plus.size() - 1)
    {
        v.emplace_back(accum, plus[i]);
        accum -= plus[i];
    }

    v.emplace_back(plus.back(), accum);
    accum = plus.back() - accum;

    repl(i, 1, minus.size())
    {
        v.emplace_back(accum, minus[i]);
        accum -= minus[i];
    }

    cout << accum << endl;

    for (auto x : v)
    {
        cout << x.first << " " << x.second << endl;
    }

    return 0;
}

Measured memory_bytes: 7152
#include "bits/stdc++.h"

using namespace std;

int main(void){
int month1,month2,day1,day2;

cin >> month1 >> day1 >> month2 >> day2;

if(day2 == 1){
    cout << 1  << endl;
}else{
    cout << 0 << endl;
    
}
    return 0;
}

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

int main(){
  int N;
  cin >> N;
  vector<int> x(N), y(N), h(N);
  for (int i=0;i<N;i++){
    cin >> x[i] >> y[i] >> h[i];
  }

  int MAX = 100;
  for(int posY = 0; posY <= MAX; posY++){
    for(int posX =0;posX <= MAX;posX++){
      int needH =-1;

      
      for( int i = 0; i < N; i++)
      {
        if (h[i]>0){
          int tmp =h[i] +abs (posY - y[i]) + abs(posX-x[i]);
          
          if (needH == -1) {
            needH = tmp;
          }
          else{
            if(needH != tmp){
              needH =-2;
              break;
            }
          
          }
          
        }
      }
      if(needH == -2) continue;
      
      for( int i = 0; i < N; i++)
      {
        if(h[i]==0){
          int dist = abs(posY - y[i]) + abs(posX - x[i]);
          if (needH > dist){
            needH = -2;
            break;
          }
        }
      }
      if(needH == -2) continue;

      cout << posX << " " << posY << " " << needH << endl;
      return 0;
    }
  }
}

Measured memory_bytes: 256
/**
  * http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_2_B
  * ??????
  * ???????????´??°a, b, c?????????????????????????????? a < b < c????????¶????????????????????°"Yes"?????????????????????????????°"No"???????????????????????°?????????????????????????????????
  */
object Main {
  def main(args: Array[String]): Unit = {
    val seq = io.StdIn.readLine().split(" +").map(_.toInt).toSeq
    val (a, b, c) = seq match {
      case Seq(x, y, z) => (x, y, z)
    }
    val answer = if (a < b && b < c) {
      "Yes"
    } else {
      "No"
    }
    println(answer)
  }
}

Measured memory_bytes: 43828
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>

using namespace std;

int main() {
    int N , M , C;
    cin >> N >> M >> C;
    vector<int> B(M);
    for(int i = 0; i < M; i++){
        cin >> B[i];
    }
    int temp_ans = 0;
    int ans = 0;
    for(int j = 0; j < N; j++){
        for(int k = 0; k < M; k++){
            int temp;
            cin >> temp;
            temp_ans += temp * B[k];
//            cout << temp_ans << endl;
        }
        temp_ans += C;
//        cout << temp_ans << endl;
        if(temp_ans > 0){
            ans++;
        }
        temp_ans = 0;
    }
    cout << ans << endl;
}

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

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

	int dif = 99999;
	for(int i = 0; i < S.length() - 2; i++){
		int X = stoi(S.substr(i, 3));

		int d = 0;
		if(X > 753){
			d = X - 753;
		}
		else{
			d = 753 - X;
		}

		if(dif > d) dif = d;
	}

	cout << dif;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
 
using namespace std;
 
class MyStack {
private:
    int* list;
    int size;
 
public:
    MyStack() : list(new int[200]), size(0) {}
 
    void push(int val)
    {
        list[size++] = val;
    }
    int pop()
    {
        return list[--size];
    }
 
    ~MyStack()
    {
        delete[] list;
    }
};
 
void stack_1_3_A()
{
    MyStack stack;
 
    for (string str; cin >> str;) {
        if (str == "+") {
            stack.push(stack.pop() + stack.pop());
        }
        else if (str == "-") {
            int val = stack.pop();
            stack.push(stack.pop() - val);
        }
        else if (str == "*") {
            stack.push(stack.pop() * stack.pop());
        }
        else
        {
            stack.push(stoi(str));
        }
    }
     
    cout << stack.pop() << '\n';
}
 
int main()
{
    stack_1_3_A();
 
    return 0;
}


Measured memory_bytes: 3160
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
/* clang-format off */
#define MOD 1000000007
#define INF 1000000000
#define REP(i, n) for (ll i = 0, i##_len = (n); i < i##_len; ++i)
#define ALL(a) (a).begin(), (a).end()
#define __DEBUG__
#ifdef __DEBUG__
#define CH_P(a) cout <<"check_point("<<#a<<")" << "\n";
#define DEBUG(x) cout<<#x<<":"<<x<<"\n"
#define DEBUGS(v) cout << #v << ":";for(auto x:v){cout<<x<<" ";}cout<<"\n"
#endif
#ifndef __DEBUG__
#define CH_P(a) 
#define DEBUG(x) 
#define DEBUGS(v) 
#endif
#define TIMER_S(start) chrono::system_clock::time_point start = chrono::system_clock::now();
#define TIMER_E(end) chrono::system_clock::time_point end = chrono::system_clock::now();
#define TIME(start, end) cout << static_cast<double>(chrono::duration_cast<chrono::microseconds>(end - start).count()) << "ms" << "\n";
/* clang-format on */

int main() {
  int x,y;
  cin >> x >> y;
  if((y-2*x)%2==0&&(4*x-y)%2==0&&4*x>=y&&y>=2*x)cout << "Yes" << "\n";
  else cout << "No" << "\n";
  return 0;
}


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

int main() {
	int H, W, h, w, all=0, gyo, retsu, wl;
	cin >> H >> W >> h >> w;
	
	all =H * W;
	gyo = h*W;
	retsu = w*H;
	
	wl = all - (gyo+retsu) + w*h; //重なり部分を補う
	
	cout << wl;
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <cstring>

using namespace std;
// ascending order
#define vsort(v) sort(v.begin(), v.end())
// descending order
#define vsort_r(v) sort(v.begin(), v.end(), greater<int>())
#define vunique(v) unique(v.begin(), v.end())
#define mp make_pair
#define ts(x) to_string(x)
#define rep(i, a, b) for(int i = (int)a; i < (int)b; i++)
#define repm(i, a, b) for(int i = (int)a; i > (int)b; i--)
#define bit(a) bitset<8>(a)
#define des_priority_queue priority_queue<int, vector<int>, greater<int> >
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1e18;


ll N, M;
int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);

	cin >> N >> M;

	ll res = 0;
	if(N <= M / 2) {
		res += N;
		N = 0;
		M = M - 2 * res;
	} else {
		res += M / 2;
		M -= res * 2;
		N -= res;
	}

	res += M / 4;
	cout << res << endl;
	
}


Measured memory_bytes: 256
/*
 * @Author: goatzyq
 * @Date: 2020-09-19 20:02:11
 * @LastEditors: goatzyq
 * @LastEditTime: 2020-09-19 20:04:31
 * @Description: abc 179 A
 */

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using db = double;
using vi = vector<int>;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define debug(x) cout << #x <<"	"<< x <<endl
const int inf = 0x3f3f3f3f;
const db eps = 1e-8;
const int mod = 1e9+7;
ll qpow(ll a, ll b){
    ll ret = 1;
    while(b){
        if(b&1)ret = ret*a%mod;
        a = a*a%mod;
        b>>=1;
    }
    return ret;
}
const int maxn = 1<<10;
char s[maxn];
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> s;
    int len = strlen(s);
    if(s[len-1]=='s'){
        cout << s <<"es";
    }else{
        cout << s <<"s";
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 3644
# -*- coding: utf-8 -*-
import sys
from collections import deque, defaultdict
from math import sqrt, factorial, gcd, ceil, atan, pi
def input(): return sys.stdin.readline()[:-1] # warning not \n
# def input(): return sys.stdin.buffer.readline().strip() # warning bytes
# def input(): return sys.stdin.buffer.readline().decode('utf-8')
import string
# string.ascii_lowercase
from bisect import bisect_left
MOD = int(1e9)+7
INF = float('inf')


def solve():
    # n, m = [int(x) for x in input().split()]  
    n = int(input())
    a = []
    for _ in range(n-1):
        a.append([int(x) for x in input().split()])

    for i in range(n-1):
        c, s, f = a[i]

        cur = s + c
        for j in range(i+1, n-1):
            c, s, f = a[j]
            if s > cur:
                cur = s
            else:
                x = (cur + f - 1) // f
                cur = x * f

            cur += c
            
        print(cur)

    print(0)

t = 1
# t = int(input())
for case in range(1,t+1):
    ans = solve()


"""
a b a
d c d
a b a
"""


Measured memory_bytes: 9988
#include <cstdio>
#include <cmath>
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <algorithm>
using namespace std;
#define ll long long

int main(){
	string S;
	cin>>S;
	for(int i=0;i<S.length();i++){
		if(i%2==0){
			if(S[i]=='L')goto No;
		}else{
			if(S[i]=='R')goto No;
		}
	}
	Yes:
	cout<<"Yes";
	return 0;
	No:
	cout<<"No";
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstring>
#define inf 2147483647
#define N 1000010
#define p(a) putchar(a)
#define For(i,a,b) for(long long i=a;i<=b;++i)

using namespace std;
long long x,y,z;
long long ans;
void in(long long &x){
    long long y=1;char c=getchar();x=0;
    while(c<'0'||c>'9'){if(c=='-')y=-1;c=getchar();}
    while(c<='9'&&c>='0'){ x=(x<<1)+(x<<3)+c-'0';c=getchar();}
    x*=y;
}
void o(long long x){
    if(x<0){p('-');x=-x;}
    if(x>9)o(x/10);
    p(x%10+'0');
}

signed main(){
    in(x);in(y);in(z);
    ans=max(x*y,ans);
    ans=max(y*z,ans);
    ans=max(x*z,ans);
    ans=min(ans,x*y*(abs(z-z/2-z/2)));
    ans=min(ans,x*z*(abs(y-y/2-y/2)));
    ans=min(ans,z*y*(abs(x-x/2-x/2)));
    o(ans);
    return 0;
}

Measured memory_bytes: 256
n = gets.to_i
t = gets.chomp.split.map &:to_i
lis = Array.new(10**5+3,0)
t.each do |d|
  d += 1
  lis[d] += 1
  lis[d-1] += 1
  lis[d+1] += 1
end
p lis.max

Measured memory_bytes: 9476
#include <iostream>
#include <vector>
#include <algorithm>
#include <cassert>
#include <cstdlib>

using namespace std;

class range {
private:
  struct Iterator {
    int val;
    int operator*() {return val;}
    bool operator!=(Iterator &itr) {return val < itr.val;}
    void operator++() {++val;}
  };
  Iterator i, n;
public:
  range(int n) : i({0}), n({n}) {}
  range(int i, int n) : i({i}), n({n}) {}
  Iterator &begin() {return i;}
  Iterator &end() {return n;}
};

template<class T> T at(vector<T> v, int i) {return v[(i % (int)v.size() + v.size()) % v.size()];}

vector<int> mem[18];
vector<int> a(1 << 17, 1e9);

int solve(int a, int b, int d, int k, int l, int r) {
  assert(r - l == (1 << k));
  //cerr << a << " " << b << " " << l << " " << r << " " << k << endl;
  if (r <= a || b <= l) return 1e9;
  if (a <= l && r <= b) {
    auto p = lower_bound(mem[k].begin() + l, mem[k].begin() + r, d);
    int res = 1e9;
    auto p1 = p - 1, p2 = p;
    while (mem[k].begin() + l <= p1 && p1 < mem[k].begin() + r) {
      int r = abs(*p1 - d);
      if (r >= res) break;
      res = r;
      --p1;
    }
    while (mem[k].begin() + l <= p2 && p2 < mem[k].begin() + r) {
      int r = abs(*p2 - d);
      if (r >= res) break;
      res = r;
      ++p2;
    }
    return res;
  }
  return min(solve(a, b, d, k - 1, l, (l + r) / 2), solve(a, b, d, k - 1, (l + r) / 2, r));
}

int main() {
  int n;
  cin >> n;
  for (int i : range(n)) cin >> a[i];
  for (int i : range(18)) mem[i] = a;
  for (int i : range(18)) {
    for (int j = 0; j < (1 << 17); j += 1 << i) {
      sort(mem[i].begin() + j, mem[i].begin() + j + (1 << i));
    }
  }
  int q;
  cin >> q;
  for (int _ : range(q)) {
    int l, r, d;
    cin >> l >> r >> d;
    ++r;
    cout << solve(l, r, d, 17, 0, 1 << 17) << endl;
  }
}


Measured memory_bytes: 10772
#include<stdio.h>
int A[100][100];
int v[100];
void MST(int);
    
main(){
  int n, i, j;
  scanf("%d", &n);
  for(i = 0; i < n; i++){
    for(j = 0; j < n; j++){
      scanf("%d", &A[i][j]);
    }
  }
  MST(n);
  return 0;
}
    
void MST(int n){
  int i, j, k=1, X[100], minCost, min, sum=0;
      
  X[0] = 0;
  v[0] = 1;
  for(i = 1; i < n; i++){
    v[i] = 0;
  }
  while(1){
    minCost = 2001;
    for(i = 0; i < k; i++){
      for(j = 0; j < n; j++){
    if(A[X[i]][j] < minCost && A[X[i]][j] != -1 && v[j] != 1){
      minCost = A[X[i]][j];
      min = j;
    }
      }
    }
    if(k != n){
      X[k] = min;
      v[min] = 1;
      sum += minCost;
      k++;
    }
    else break;
  }
  printf("%d\n", sum);
}

Measured memory_bytes: 640
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>

using namespace std;

int Sum10(int n);

int main()
{
    // 入力
    int N;
    cin >> N;
    int ans = 0;
    for (int i=1;i<=N;i=i+2){
        int count = 0;
        for (int j=1;j<=i;j++){
            if (i%j==0){
                count++;
            }
        }
      	//cout << i << " " << count <<endl;
        if (count == 8){
            ans++;
        }
    }
    cout << ans <<endl;
    return 0;
}

int Sum10(int n){
    int sum = 0;
    while (n > 0){
        sum += n % 10;
        n /= 10;
    }
    return sum;
}


Measured memory_bytes: 256
gcd'::(Int,Int)->Int->Int
gcd' (a,b) 1 = 1
gcd' (a,b) n 
    | (a`mod`n==0)&&(b`mod`n==0) = n
    | otherwise                  = gcd' (a,b) (n-1)

solve::(Int,Int)->Int
solve (a,b) = gcd' (a,b) (min a b)

main = do
    ss <- getContents
    mapM_ print $ map solve $ map (\x->(\y->(y!!0,y!!1)) $ map (\y->read y::Int) $ words x)$ lines ss

Measured memory_bytes: 4036
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    long x = sc.nextLong();
    long k = sc.nextLong();
    boolean flag=true;
    long d=0;
    x=x%k;

    d=Math.min(x,Math.abs(x-k));

    System.out.println(d);
  }}
    

Measured memory_bytes: 22484
fun main(args: Array<String>) {
    val n = (readLine() ?: return).toInt()
    var successCount = 0
    var preZoromeCount = 0
    repeat(n) {
        val (dice1, dice2) = readLine()!!.split(" ").map(String::toInt)
        when (dice1 == dice2) {
            true -> {
                preZoromeCount += 1
                if (preZoromeCount == 3) {
                    successCount += 1
                    preZoromeCount = 0
                }
            }
            false -> preZoromeCount = 0
        }
    }
    print(when {
        successCount >= 1 -> "Yes"
        else -> "No"
    })
}

Measured memory_bytes: 37912
//A.cpp
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <stack>
#include <math.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b){return b!=0?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
const ll mod=1e9+7;

int main(){
  int n,d;
  cin >> n >> d;
  int ans = 0;
  ans = (n + 2*d)/(2*d+1);
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main{
    public static void main(String [] args){
        Scanner sc= new Scanner(System.in);
        String s= sc.nextLine();
        int count=0;
        int max=0;
        for(int i=0; i<s.length(); i++){
            char c= s.charAt(i);
            if(c=='A'||c=='C'||c=='G'||c=='T') count++;
            else count=0;
            
            if(count>max) max=count;
        }
        System.out.println(max);
    }
}

Measured memory_bytes: 22484
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
	int n, x, t; cin >> n >> x >> t;
	int res = 0;
	if (n % x == 0) {
		res = n / x;
	}
	else {
		res = n / x;
		res++;
	}
	cout << res * t;
	return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, D;
  cin >> N >> D;
  if ( N%(2*D+1) == 0)
    cout <<  N/(2*D+1) << endl;
  else
    cout << N/(2*D+1) + 1 << endl; 
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
typedef long long ll;
const int N=1e9;
int main()
{
    ll s;
    cin>>s;
    ll x2=N,x3=1,y2,y3;
    y3=s/N+1,y2=y3*N-s;
    if(y2==N)   {y3--;y2=0;}
    cout<<0<<" "<<0<<" "<<x2<<" "<<y2<<" "<<x3<<" "<<y3<<endl;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define p_b push_back
#define pll pair < ll , ll >

using namespace std;

int main()
{
    ios_base :: sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n,k;
    cin >> n >> k;
    if(n>=10)
    {
        cout << k;
    }
    else
    {
        cout << k+100*(10-n);
    }
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    long MOD = (long)Math.pow(10, 9) + 7;
    long t1 = 0;
    long t2 = 0;
    for(int i = 0; i < n; i++) {
      long a = sc.nextLong();
      t1 = (t1 + a) % MOD;
      t2 = (t2 + ((a * a) % MOD)) % MOD;
    }
    t1 = (t1 * t1) % MOD;
    long ans = (t1 - t2 + MOD) % MOD;
    long c = (MOD + 1) / (long)2;
    ans = (ans * c) % MOD;
    System.out.println(ans);
  }
}

Measured memory_bytes: 59116
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

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


func main() {
	sc.Split(bufio.ScanWords)

	n, k := nextInt(), nextInt()
	kb := 0
	for x := k; x > 0; x >>= 1 {
		kb++
	}
	a := make([]int, n)
	bits := make([]int, kb)
	for i := 0; i < n; i++ {
		a[i] = nextInt()
		for j := 0; j < kb; j++ {
			if a[i] & (1<< uint(j)) != 0 {
				bits[j]++
			}
		}
	}

	c := 0
	for i := kb-1; i >= 0; i-- {
		if bits[i] < n - bits[i] && c + 1 << uint(i) <= k {
			c += 1 << uint(i)
		}
	}

	sum := 0
	for i := 0; i < n; i++ {
		sum += a[i] ^ c
	}

	fmt.Println(sum)
}

Measured memory_bytes: 3072
d,n=map(int,input().split())
if d==0:
  if n==100:
    ans=101
  else:
    ans=n
elif d==1:
  if n==100:
    ans=10100
  else:
    ans=n*100
else:
  if n==100:
    ans=1010000
  else:
    ans=n*10000
print(ans)

Measured memory_bytes: 61980
#include <bits/stdc++.h>
using namespace std;
#define fore(i, a, b) for (int i = a, to = b; i < to; i++)
#define all(v) v.begin(), v.end()
#define SZ(v) (int)v.size()
#define pb push_back
typedef long long Long;
typedef pair<int, int> Pair;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(NULL);
  Long h,n;cin>>h>>n;
  vector<Long> v(n);
  fore(i,0,n)cin>>v[i];
  Long maxi = accumulate(all(v),0LL);
  if(h<=maxi){
	  cout<<"Yes\n";
  }else{
	  cout<<"No\n";
  }

  return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
    int n,l;
    string p;
    cin>>n>>l;
    vector<string>s(n);
    for(int i=0;i<n;i++)
    {
        cin>>s[i];
    }
    sort(s.begin(),s.end());
    for(int i=0;i<n;i++)
    {
        p+=s[i];
    }
    cout<<p<<endl;

    return 0;
}


Measured memory_bytes: 256
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
c = Counter(a)
p = [True] * (10 ** 6 + 1)
s = list(set(a))
for x in s:
    t = x * 2
    while t <= 10 ** 6:
        p[t] = False
        t += x
ans = 0
for x in a:
    if c[x] == 1 and p[x] == True:
        ans += 1
print(ans)


Measured memory_bytes: 52776