akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#define ll long long

int n,ans=0;ll d;

int main()
{
	scanf("%d %lld",&n,&d);
	ll x,y;for(int i=1;i<=n;i++){
		scanf("%lld %lld",&x,&y);
		if(x*x+y*y<=d*d)ans++;
	}printf("%d",ans);
}

Measured memory_bytes: 1732
#include <bits/stdc++.h>
using namespace std;
typedef long long int llint;
typedef unsigned long long int ullint;
std::string YesNo[] = {"No","Yes"};
#define loop(i,N) for(int i=0; i<(N); i++)
template<typename T>
auto sort_all(T& v) { return std::sort(v.begin(),v.end()); }
template<typename T>
auto sum_all(const T& v) { auto z = v[0]; z = 0;
    return std::accumulate(v.begin(),v.end(),z); }
template<typename T>
auto input( std::size_t N,
            const std::vector<T>& head={},
            const std::vector<T>& tail={}) {
    auto s = head.size();
    auto t = tail.size();
    std::vector<T> v;
    v.reserve(s+N+t);
    v.insert(v.end(), head.begin(), head.end());
    v.resize(s+N);
    loop(i,N) std::cin >> v[s+i];
    v.insert(v.end(), tail.begin(), tail.end());
    return std::move(v);
}
class range {
    typedef int Int;
    Int start, stop, step;
    void initialize() {
        auto sign = (step >= 0) ? 1 : -1;
        stop = start + ((stop-start-sign)/step + 1) * step;
        if ((stop-start) * step <= 0) stop = start;
    }
public:
    range(Int start, Int stop, Int step=1) : start(start), stop(stop), step(step) {
        initialize();
    }
    range(Int stop) : start(0), stop(stop), step(1) { initialize(); }
    struct iterator {
        Int i, step;
        Int& operator*() { return i; }
        iterator& operator++() { i += step; return *this; }
        bool operator!=(const iterator& v) { return i != v.i; }
    };
    iterator begin() { return {start, step}; }
    iterator end()   { return {stop, step}; }
};
template<typename T1, typename T2>
std::pair<T1,T2> operator-(const std::pair<T1,T2>& x)
{
    return std::make_pair(-x.first, -x.second);
}
template<typename T1, typename T2>
std::pair<T1,T2> operator+(
    const std::pair<T1,T2>& x,
    const std::pair<T1,T2>& y)
{
    return std::make_pair(x.first+y.first, x.second+y.second);
}
template<typename T1, typename T2>
std::pair<T1,T2> operator-(const std::pair<T1,T2>& x, const std::pair<T1,T2>& y)
{
    return x + (-y);
}
template<typename T1, typename T2>
std::pair<T1,T2>& operator+=(std::pair<T1,T2>& x, const std::pair<T1,T2>& y)
{
    x.first += y.first;
    x.second += y.second;
    return x;
}
template<typename T1, typename T2>
std::pair<T1,T2>& operator-=(std::pair<T1,T2>& x, const std::pair<T1,T2>& y)
{
    return x += (-y);
}
template<typename T1, typename T2>
std::ostream& operator<<(std::ostream& cout, const std::pair<T1,T2>& data)
{
    cout << "(" << data.first << ", " << data.second << ")";
    return cout;
}
template<typename T>
std::ostream& operator<<(std::ostream& cout, const std::vector<T>& data)
{
    cout << "[";
    if (data.size() == 0) {}
    else if (data.size() == 1) { cout << data[0]; } 
    else {
        cout << data[0];
        for (auto itr=data.begin()+1; itr!=data.end(); ++itr) {
            cout << ", " << *itr;
        }
    }
    cout << "]";
    return cout;
}

typedef llint Int;

int main(void)
{
    Int N, ans = 0;
    cin >> N;
    for (auto i: range(1,N+1)) {
        Int m = N/i;
        ans += i * m * (m+1)/2;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3644
#include <iostream>

using namespace std;

int main()
{

int a,b;
cin>> a >> b;
if(a==1)
{
    a+=13;
}
if(b==1)
{
    b+=13;
}
if (a==1){
    a+=13;
}


if (a>b)
    cout << "Alice";
else if  (a == b)
cout << "Draw";
else
    cout <<"Bob";

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const double pi=3.141592653589793;
typedef unsigned long long ull;
typedef long double ldouble;
const ll INF=1e18;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
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; }


int main(){
    ll h, w, k, ans = 0;
    cin >> h >> w >> k;
    vector<vector<char> > c(w, vector<char>(h));
    rep(y, h){
        rep(x, w){
            cin >> c.at(x).at(y);
        }
    }
    rep(bit, (1<<(h+w))){
        bitset<12> tmp(bit);
        vector<vector<char> > m = c;
        rep(i, h){
            if(tmp.test(i)) {
                rep(x, w){
                    m.at(x).at(i) = '.';
                }
            }
        }
        rep2(i, h, h+w){
            if(tmp.test(i)) {
                rep(y, h){
                    m.at(i-h).at(y) = '.';
                }
            }
        }
        int count = 0;
        rep(y, h){
            rep(x, w){
                if(m.at(x).at(y) == '#'){
                    count++;
                }
            }
        }
        if(count == k){
            ans++;
        }
    }
    cout << ans << endl;
}

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

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

  for (int i = 1; i < 4; i++){
    if (A * B * i % 2 == 1){
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define sqr(x) (x)*(x)

using namespace std;

int n, d, ans;
int x[15][15];

long double D(int a, int b) {
	long double res = 0.0000;
	for (int i = 1; i <= d; ++i) res += sqr(x[a][i] - x[b][i]);
	return sqrt(res);
}

int main() {
	scanf("%d%d", &n, &d);
	for (int i = 1; i <= n; ++i)
		for (int j = 1; j <= d; ++j)
			scanf("%d", &x[i][j]);
	for (int i = 1; i <= n; ++i)
		for (int j = i + 1; j <= n; ++j)
			if ((int)D(i, j) == D(i, j)) ++ans;
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 256
from collections import defaultdict
from collections import Counter
n,m=map(int,input().split())
A=[int(i) for i in input().split()]
AA=dict(Counter(A))
D=defaultdict(int)
for i in range(m):
  b,c=map(int,input().split())
  D[c]+=b
for x in AA.keys():
  D[x]+=AA[x]
D=sorted(D.items(),key=lambda x:x[0],reverse=True)
ans,tot=0,0
for x,y in D:
  if tot+y<=n:
    ans+=x*y
    tot+=y
  else:
    ans+=x*(n-tot)
    tot+=n-tot
  if tot==n:
    break
print(ans)

Measured memory_bytes: 49432
#include<bits/stdc++.h>
using namespace std;
int main(){
  int c=0;
  char a[3],b[3];
  cin>>a>>b;
  for(int i=0;i<3;i++){
    if(a[i]==b[2-i])
      c++;
  }
  if(c==3)  
    cout<<"YES"<<endl;
  else
    cout<<"NO"<<endl;
  return(0);
}

Measured memory_bytes: 256
import java.util.Scanner;

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

    void solve(Scanner sc) {
        int a = sc.nextInt();
        int b = sc.nextInt();
        int count = 0;
        for (int i = a; i <= b; i++) {
            char[] tmp = String.valueOf(i).toCharArray();
            if (tmp[0] == tmp[4] && tmp[1] == tmp[3]) {
                count++;
            }
        }
        System.out.println(count);
    }
}

Measured memory_bytes: 29524
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int n = sc.nextInt();
		int[] num = new int[w];
		int i;
		for(i=0;i<w;i++){
			num[i]=i+1;
		}
		for(i=0;i<n;i++){
			String str = sc.next();
			String[] ab = str.split(",");
			int a = Integer.parseInt(ab[0]) - 1;
			int b = Integer.parseInt(ab[1]) - 1; 
			int c = num[a];
			num[a]=num[b];
			num[b]=c;
		}
		for(i=0;i<w;i++){
			System.out.println(num[i]);
		}
	}
}



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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)    FOR (i,0,n)
#define ALL(f,x,...) ([&](decltype((x)) ALL) {                          \
            return (f)(begin(ALL), end(ALL), ## __VA_ARGS__); })(x)

using namespace std;

vector<int> vi;

int main()
{
    int N, M ,X;
    cin >> N >> M >> X;

    vi.resize(N + 1);

    REP(i, N + 1) vi[i] = 0;

    REP(i, M)
    {
        int m;
        cin >> m;
        vi[m] = 1;
    }

    int ans = 101;
    int tmp = 0;
    FOR(i, X, N)
    {
        tmp += vi[i];
    }

    ans = min(ans, tmp);

    tmp = 0;
    for (int i = X; 0 <= i; i--)
    {
        tmp += vi[i];
    }

    ans = min(ans, tmp);

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>

using namespace std;
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define RREP(i, a) for(int (i) = (a) - 1; (i) >= 0; (i)--)
#define FORR(i, a, b) for(int (i) = (a) - 1; (i) >= (b); (i)--)
#define DEBUG(C) cerr << #C << " = " << C << endl;
using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<LL>;
using VVL = vector<VL>;
using VD = vector<double>;
using VVD = vector<VD>;
using PII = pair<int, int>;
using PDD = pair<double, double>;
using PLL = pair<LL, LL>;
using VPII = vector<PII>;
template<typename T> using VT = vector<T>;
#define ALL(a) begin((a)), end((a))
#define RALL(a) rbegin((a)), rend((a))
#define SORT(a) sort(ALL((a)))
#define RSORT(a) sort(RALL((a)))
#define REVERSE(a) reverse(ALL((a)))
#define MP make_pair
#define FORE(a, b) for (auto &&a : (b))
#define FIND(s, e) ((s).find(e) != (s).end())
#define EB emplace_back
template<typename T> inline bool chmax(T &a, T b){if (a < b){a = b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if (a > b){a = b;return true;}return false;}

const int INF = 1e9;
const int MOD = INF + 7;
const LL LLINF = 1e18;
const double EPS = 1e-9;
FILE *fp;

void init();
void last();

//#define MYLOCAL

const int MAX = 200010;
int n, m;
bool used[MAX];

void init() {
#ifdef MYLOCAL
    if ((fp = freopen("/Users/sekiya9311/Documents/comp_programming/comp_programming/in.txt", "r", stdin)) == NULL) {
        assert(false);
    }
#endif
    memset(used, false, sizeof(used));
    scanf("%d%d", &n, &m);
    stack<int> st;
    for (int i = n - 1; i >= 0; i--) {
        st.push(i + 1);
    }
    for (int i = 0; i < m; i++) {
        int e;
        scanf("%d", &e);
        st.push(e);
    }
    while (!st.empty()) {
        if (used[st.top()]) {
            st.pop();
            continue;
        }
        used[st.top()] = true;
        printf("%d\n", st.top());
        st.pop();
    }
    last();
}

void last() {
#ifdef MYLOCAL
    fclose(fp);
#endif
    exit(0);
}

void solve(int n) {
    
    last();
}

signed main(void) {
    LL n, m, p, a, b, c, x, y, z, q;
    string s;
    bool f = false;
    init();
    while (cin >> n, n) {
        solve(n);
        //return 0;
    }
    last();
}

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

main() {
    int N; cin >> N;
    map<string,int>m;
    rep(i,N){
        string S; cin >> S;
        m[S]++;
    }
    int M; cin >> M;
    rep(i,M){
        string S; cin >> S;
        m[S]--;
    }
    int ans=0;
    for(auto p:m){
        ans=max(ans,p.second);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
// C.cpp
#include <bits/stdc++.h>

using namespace std;

const int MAX_N = 1e5 + 200;

int n, m, head[MAX_N], current, deg[MAX_N], A, B;
bool vis[MAX_N];

struct edge
{
    int to, nxt;
} edges[MAX_N << 1];

void addpath(int src, int dst)
{
    edges[current].to = dst, edges[current].nxt = head[src];
    head[src] = current++;
}

void dfs(int u, int fa)
{
    vis[u] = true;
    for (int i = head[u]; i != -1; i = edges[i].nxt)
        if (i != fa && edges[i].to != B)
            if (!vis[edges[i].to])
                dfs(edges[i].to, i ^ 1);
            else
                puts("Yes"), exit(0);
    vis[u] = false;
}

int main()
{
    memset(head, -1, sizeof(head));
    scanf("%d%d", &n, &m);
    for (int i = 1, u, v; i <= m; i++)
        scanf("%d%d", &u, &v), addpath(u, v), addpath(v, u), deg[u]++, deg[v]++;
    int mdeg = 0;
    for (int i = 1; i <= n; i++)
        if (deg[i] & 1)
            puts("No"), exit(0);
        else
            mdeg = max(mdeg, deg[i]);
    if (mdeg == 4)
    {
        for (int i = 1; i <= n; i++)
            if (deg[i] == 4)
                if (A == 0)
                    A = i;
                else if (B == 0)
                    B = i;
                else
                    puts("Yes"), exit(0);
        if (B)
            dfs(A, 0);
        puts("No"), exit(0);
    }
    else if (mdeg > 4)
        puts("Yes"), exit(0);
    else
        puts("No"), exit(0);
    return 0;
}

Measured memory_bytes: 7384
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits.h>
#include <climits>
#include <map>
#include <unordered_map>
#include <cmath>
#include <set>
#include <iterator>
#include <deque>
#include <assert.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
ull min(ull x, ull y){ if (x<y) return x; return y;}
ull max(ull x, ull y){ if (x<y) return y; return x;}
ll min(ll x, ll y){ if (x<y) return x; return y;}
ll max(ll x, ll y){ if (x<y) return y; return x;}
double min(double x, double y){ if (x<y) return x; return y;}
double max(double x, double y){ if (x<y) return y; return x;}
ull gcd(ull x, ull y){
    if (!x) return y;
    if (!y) return x;
    if (x>y) swap(x,y);
    return gcd(x, y%x);
}
ull inv(ull a, ull c){ // a,c are coprime and a<c
    if (a==1){
        return 1;
    }
    return ((c-(c/a))*inv(c%a,c))%c;
}

ll n, k, M = 1e9+7, nf = 1, ans = 0;

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

    cin>>n>>k;
    k = min(k,n-1);

    vector<ll> ifact(n+1,1);
    for (int i = 1; i <= n; i++){
        nf = (nf*i)%M;
        ifact[i] = (ifact[i-1]*inv(i,M))%M;
    }

    for (ll z = 0; z <= k; z++){
        ll ncz = (((nf*ifact[n-z])%M)*ifact[z])%M;
        ll n1cz = (((ncz*(n-z))%M)*inv(n,M))%M;
        ans = ((ncz*n1cz)%M + ans)%M;
    }

    cout<<ans<<"\n";
    
    return 0;
    
}





Measured memory_bytes: 1792
#include<stdio.h>
int main(){
  int n,x,t;
  scanf("%d %d %d\n",&n,&x,&t);
  int time;
  int a,d;
  if(n<x) time = t;
  if(n>=x){
    a = n/x;
    time = a*t;
    d = n%x;
    if(d!=0) time = time + t;
  }
  printf("%d\n",time);
  return 0;
}

Measured memory_bytes: 1732
#include <bits/stdc++.h>
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define sz(A) int(A.size())
#define FIFO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define all(A) begin(A),end(A)
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<pair<ll,ll>> vll;
typedef vector<pair<int,int>> vii;
////////
ll mulmod(ll a, ll b, ll p){
	ll x = 0, y = a%p;
	while(b>0){
		if(b%2==1) x = (x+y)%p;
		y = (1LL*y*2)%p;
		b = b/2;
	}
	return x%p;
}
ll fastexp(ll x, ll y, ll p){
	ll ans = 1;
	while(y > 0){
		if(y&1) ans = (1LL*ans*x)%p;
		y = y>>1;
		x = (1LL*x*x)%p;
	}
	return ans%p;
}
ll fastexpp(ll x, ll y, ll p){
	ll ans = 1;
	while(y > 0){
		if(y&1) ans = mulmod(ans,x,p);
		y = y>>1;
		x = mulmod(x,x,p);
	}
	return ans%p;
}
ll invmod(ll x, ll p){
	return fastexp(x,p-2,p)%p;
}
/////////
const int N = 100005;
int MOD;
vi adj[N];
ll ways[N];
ll realways[N];
vl prefix[N];
vl sufix[N];
void reroot(int u, int parent) {
	realways[u] = ways[u];
	int nn = adj[u].size();
	for(int i = 0; i < adj[u].size(); i++) {
		int v = adj[u][i];
		if(v == parent)continue;
		ll waysu = ways[u];
		ll waysv = ways[v];
		ways[u] = (prefix[u][i] * sufix[u][nn - 1 - i]) % MOD;
		if(parent != -1)ways[u] = (ways[u] * (ways[parent] + 1)) % MOD;
	//	cout << i << " " << ways[u] << " " << waysu << " " << ways[v] << "uwu \n";
		ways[v] = (ways[v] * (ways[u] + 1)) % MOD;
		reroot(v, u);
		ways[u] = waysu;
		ways[v] = waysv;
	}
}
void dfs(int u, int parent) {
	ways[u] = 1;
	for(auto v : adj[u]) {
		if(v == parent)continue;
		dfs(v, u);
		ways[u] = (ways[u] * (1 + ways[v])) % MOD;
	}
	ll act = 1;
	for(int i = 0; i < adj[u].size(); i++) {
		int v = adj[u][i];
		prefix[u].pb(act);
		if(adj[u][i] == parent)continue;
		act = (act * (ways[v] + 1)) % MOD;
	}
	prefix[u].pb(act);
	act = 1;
	for(int i = adj[u].size() - 1; i >= 0; i--) {
		int v = adj[u][i];
		sufix[u].pb(act);
		if(adj[u][i] == parent)continue;
		act = (act * (ways[v] + 1)) % MOD;
	}
	sufix[u].pb(act);
}
int main() {
	int n;
	cin >> n >> MOD;
	for(int i = 0; i < n - 1; i++) {
		int x, y;
		cin >> x >> y;
		x--, y--;
		adj[x].pb(y);
		adj[y].pb(x);
	}
	dfs(0, -1);
	reroot(0, -1);
	for(int i = 0; i < n; i++) cout << realways[i] << "\n";
	return 0;
}

Measured memory_bytes: 29696
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;

struct Info{
	char map[10][10];
};

struct Data{
	Data(int arg_row,int arg_col){
		row = arg_row;
		col = arg_col;
	}
	int row,col;
};

int H,W;
int diff_row[4] = {-1,0,0,1},diff_col[4] = {0,-1,1,0};
bool FLG;

char to_color[3] = {'R','G','B'};

bool rangeCheck(int row,int col){
	if(row >= 0 && row <= H-1 && col >= 0 && col <= W-1)return true;
	else{
		return false;
	}
}

void back_track(Info info,int depth,int max_depth){

	if(depth == max_depth){
		bool is_cleared = true;
		for(int row = 0; row < H; row++){
			for(int col = 0; col < W; col++){
				if(info.map[row][col] != info.map[0][0]){
					is_cleared = false;
					break;
				}
			}
			if(!is_cleared)break;
		}

		if(is_cleared){
			FLG = true;
		}
		return;
	}

	char pre_color = info.map[0][0];

	queue<Data> Q;
	int adj_row,adj_col;

	for(int loop = 0; loop < 3; loop++){
		if(to_color[loop] == pre_color)continue;

		Info next_info;
		for(int row = 0;row < H; row++){
			for(int col = 0; col < W; col++){
				next_info.map[row][col] = info.map[row][col];
			}
		}

		next_info.map[0][0] = to_color[loop];

		Q.push(Data(0,0));

		while(!Q.empty()){

			for(int i = 0; i < 4; i++){
				adj_row = Q.front().row + diff_row[i];
				adj_col = Q.front().col + diff_col[i];

				if(!rangeCheck(adj_row,adj_col))continue;

				if(next_info.map[adj_row][adj_col] == pre_color){
					next_info.map[adj_row][adj_col] = to_color[loop];
					Q.push(Data(adj_row,adj_col));
				}
			}

			Q.pop();
		}
		back_track(next_info,depth+1,max_depth);
	}
}

void func(){

	char buf[2];
	Info first;

	for(int row = 0; row < H; row++){
		for(int col = 0; col < W; col++){
			scanf("%s",buf);
			first.map[row][col] = buf[0];
		}
	}

	FLG = false;
	int ans = 0;

	for(int i = 0; ; i++){

		back_track(first,0,i);

		if(FLG){
			ans = i;
			break;
		}
	}

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


int main(){

	while(true){
		scanf("%d %d",&W,&H);
		if(W == 0 && H == 0)break;

		func();
	}

	return 0;
}

Measured memory_bytes: 3220
#include <bits/stdc++.h>
using namespace std;
 
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
 
typedef long long LL;
 
const int INF = 0x3f3f3f3f;
 
 
double calc(int n) {
    double ans = 0.0;
    for (int i = 1; i <= n; ++i) {
        ans += i*1.0/n;
    }
    return ans;
}
 
int main(void) {
    std::ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
 
    int n, k, x;
    cin >> n >> k;
 
    double ans = 0.0;
    double a[n];
 
    for (int i = 0; i < n; ++i) {
        cin >> x;
        a[i] = calc(x);
    }
 
    double cur = 0.0;
    for (int i = 0; i < n; ++i) {
        cur += a[i];
        if (i >= k) {
            cur -= a[i-k];
        }
        ans = max(ans, cur); 
    }
    cout << fixed << ans << endl;
 
    return 0;
}

Measured memory_bytes: 1792
#include <stdio.h>
#define MAX 100
#define INFTY 1e8
#define WHITE 0
#define GRAY 1
#define BLACK 2
int n;
int m[MAX][MAX];
int prim();
int main()
{
    int e;
    scanf("%d",&n);
    for( int i = 0; i < n ; i++) 
    {
        for(int j = 0; j < n; j++)
        {
            scanf(" %d ",&e);
            if(e == -1)m[i][j] = INFTY; 
            else m[i][j] = e;
        }
    }
    printf("%d\n",prim());
}
int prim()
{
    int u, minv;
    int d[MAX], p[MAX], color[MAX];
    
    for( int i = 0; i < n; i++ ) 
    {
        d[i] = INFTY;
        p[i] = -1;
        color[i] = WHITE;
    }
    d[0] = 0;
    while(1)
    {
        minv = INFTY;
        u = -1;
        for( int i = 0; i < n; i++ ) 
        {
            if(minv >d[i] && color[i] != BLACK ) {
                u = i;
                minv = d[i];
            }
        }
        if( u == -1 )break;
        color[u] = BLACK;
        for( int v = 0; v < n; v++) 
        {
            if( color[v] != BLACK && m[u][v] != INFTY )
            {
                if(d[v] > m[u][v])
                {
                    d[v] = m[u][v];
                    p[v] = u;
                    color[v] = GRAY;
                }
            }
        }
    }
    int sum = 0;
    for( int i = 0; i < n; i++ ) 
    {
        if( p[i] != -1 )
        {
            sum +=m[i][p[i]];
        }
    }
    return sum;
}


Measured memory_bytes: 2072
#include<stdio.h>
int max(int a,int b){
  if(a>b)return a;
  else return b;
}
int main(){
  int n,w;
  scanf("%d %d",&n,&w);
  int dp[110][10010]={0};
  int i,j;
  for(i=1;i<1+n;i++){
    int a,b;
    scanf("%d %d",&a,&b);
    for(j=0;j<1+w;j++){
      if(j-b>=0)dp[i][j]=max(dp[i-1][j],dp[i-1][j-b]+a);
      else dp[i][j]=dp[i-1][j];
    }
  }
  printf("%d\n",dp[n][w]);

  return 0;
}

Measured memory_bytes: 4904
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <vector>
#include <math.h>
#include <bitset>
#include <queue>

using namespace std;

void solve() {
    int n;
    cin >> n;
    int count = 0;
    for(int i = 1; i <= n; i++) {
        if((int)(log10(i)+1) % 2 == 1) {
            count++;
        }
    }
    cout << count;
}

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

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

long tile_count(string tile, char s_color)
{
    char now_color = s_color;
    long count = 0;

    for(int i = 0; i < tile.size(); i++)
    {//white start

        if(tile[i] != now_color) count++;
        if(now_color == '0') now_color = '1';
        else if(now_color == '1') now_color = '0';
    }
    return count;
}

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

    long min_count = tile_count(S, '0');
    min_count = min(min_count, tile_count(S, '1'));
    cout << min_count << endl;
    return 0;  

}

Measured memory_bytes: 512
public class Main{
  public void run(java.io.InputStream in, java.io.PrintStream out){
    java.util.Scanner sc = new java.util.Scanner(in);
/*answer*/
    int[] count;
    int a, i, j, k;
    char[] ch;
    String str;

    count = new int[13];
    for(;sc.hasNext();){
      str = sc.next();
      ch = new char[str.length()];
      for(j = 0;j < str.length();j++)ch[j] = str.charAt(j);
      a = 0; k = 0;
      for(i = 0;i < 13;i++)count[i] = 0;

      j = 0;
      for(i = 0;i < 4;i++){
        for(;j < str.length();j++){
          if(ch[j] == ','){
            a = readint(ch, k, j);
            count[(a + 11) % 13]++;
            k = ++j; break;
          }
        }
      }
      a = readint(ch, k, str.length());
      count[(a + 11) % 13]++;

      a = 0;
      for(i = 0;i < 13;i++){
        if(count[i] == 4){
          out.println("four card"); a = -1; break;
        }else if(count[i] == 3){
          for(j = 0;j < 13;j++){
            if(count[j] == 2){
              out.println("full house"); a = -1; break;
            }
          }
          if(a != -1){
            out.println("three card"); a = -1; break;
          }
        }else if(count[i] == 2){
          for(j = 0;j < 13;j++){
            if(count[j] == 2 && j != i){
              out.println("two pair"); a = -1; break;
            }else if(count[j] == 3){
              out.println("full house"); a = -1; break;
            }
          }
          if(a != -1){
            out.println("one pair"); a = -1; break;
          }
        }else if(count[i] == 1){
          if(i < 9 && count[i + 1] == 1 && count[i + 2] == 1
           && count[i + 3] == 1 && count[i + 4] == 1){
             out.println("straight"); a = -1; break;
          }else if(i == 0 && count[1] == 1 && count[2] == 1
           && count[3] == 1 && count[12] == 1){
             out.println("straight"); a = -1; break;
          }
        }
        if(a == -1)break;
      }
      if(a == 0)out.println("null");
    }

    sc.close();
  }
  public static void main(String[] args){
    (new Main()).run(System.in, System.out);
  }
  private static int readint(char[] ch, int l, int r){
    int i, d, res;
    d = 1; res = 0;
    for(i = r - 1;i >= l;i--){
      res += d * (int)(ch[i] - '0');
      d *= 10;
    }
    return res;
  }
}

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

int main() {
	// your code goes here
	string s;
	cin>>s;
	int i=0;
	int n=s.size();
	int flag=0;
	while(i<n){
		if((i+1)%2==0){
			if(s[i]=='L'||s[i]=='U'||s[i]=='D'){
				
			}
			else{
				flag=-1;
			}
		}
		else{
			if(s[i]=='R'||s[i]=='U'||s[i]=='D'){
				
			}
			else{
				flag=-1;
			}
		}
      i++;
	}
	if(flag==-1){
		cout<<"No\n";
	}
	else
	cout<<"Yes\n";
	return 0;
}

Measured memory_bytes: 384
#include <algorithm>
//#include <cstdio>
//#include <functional>
#include <iostream>
//#include <cfloat>
//#include <climits>
//#include <cstdlib>
//#include <cstring>
#include <cmath>
//#include <map>
//#include <queue>
//#include <set>
//#include <sstream>
//#include <stack>
//#include <string>
//#include <time.h>
#include <vector>
//#include <random>
//#include <unordered_set>
//#include <complex>
//#include <string.h>

#define rt0 return 0
#define rep(i,n) for(int i=0;i<n;i++)
#define LL long long
#define pii pair<int,int>

using namespace std;

int main()
{
    int a,b,c;
	LL K;

	cin>>a>>b>>c>>K;

	cout<<((K%2==0)? (a-b):(b-a));
		
	rt0;
}


Measured memory_bytes: 256
S = list(input())
Sd = {i:S[i] for i in range(len(S))}
check = {i:0 for i in range(26)}
ans = -1

for k,v in Sd.items():
    check[ord(v)-ord('a')] = 1
    
for k,v in check.items():
    if v == 0:
        ans = k
        break
        
if ans == -1:
    print('None')
else:
    print(chr(ans+ord('a')))

Measured memory_bytes: 19940
n=input()
f=True
for i in range(len(n)):
  if len(n) %2 != 0:
    f=False
    break
  if i==0:
    if n[i]!="h":
      f=False
  if i==1:
    if n[i]!="i":
      f=False
  if i>1 and i%2 == 0:
    if n[i]==" ":
      break    
  if i%2 == 0:
    if n[i]!="h":
      f=False
  else:
    if n[i]!="i":
      f=False
if f:
  print("Yes")
else:
  print("No")
  

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main(){
	map<char,char> up, low;
	for(int i=0;i<26;i++){
		up[i+'A']='A';
		low[i+'a']='a';
	}
	char ch; cin>>ch;
	if(up.count(ch)){
		cout<<up[ch]<<endl;
	}
	else{
		cout<<low[ch]<<endl;
	}
	return 0;
}

Measured memory_bytes: 3628
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		//		new Main().solveA();
		//		new Main().solveB();
		new Main().solveC();
		// new Main().solveD();
	}

	private void solveA() {
		Scanner scanner = null;
		int numN = 0;
		int numA = 0;
		int numB = 0;

		try {
			scanner = new Scanner(System.in);
			numN = scanner.nextInt();
			numA = scanner.nextInt();
			numB = scanner.nextInt();

			System.out.println(Math.min(numA * numN, numB));

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private int addAllDigit(int num) {
		if (num < 10) {
			return num;
		}
		return addAllDigit(num / 10) + num % 10;
	}

	private void solveB() {
		Scanner scanner = null;
		int numN = 0;

		try {
			scanner = new Scanner(System.in);
			numN = scanner.nextInt();

			int res = addAllDigit(numN);

			if (numN % res == 0) {
				System.out.println("Yes");
			} else {
				System.out.println("No");

			}

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveC() {
		Scanner scanner = null;
		int numN = 0;

		try {
			scanner = new Scanner(System.in);
			numN = scanner.nextInt();

			int[][] shop = new int[numN][10];
			int[][] rieki = new int[numN][11];

			for (int j = 0; j < numN; j++) {
				for (int k = 0; k < 10; k++) {
					shop[j][k] = scanner.nextInt();
				}
			}

			for (int j = 0; j < numN; j++) {
				for (int k = 0; k < 11; k++) {
					rieki[j][k] = scanner.nextInt();
				}
			}
			int res = Integer.MIN_VALUE;
			//0000000000=0、1111111111=1023
			for (int i = 1; i < 1024; i++) {
				int wkRes = 0;
				int[] myShop = new int[10];
				int wkBit = i;
				//0000000000から、1111111111までの配列を作成。2の剰余を入れていけば2進数に変換できる。
				for (int j = 0; j < 10; j++) {
					myShop[j] = wkBit % 2;
					wkBit /= 2;
				}
				for (int j = 0; j < shop.length; j++) {
					int cnt = 0;
					for (int k = 0; k < myShop.length; k++) {
						if (myShop[k] == shop[j][k] && myShop[k] == 1) {
							cnt++;
						}
					}
					wkRes += rieki[j][cnt];
				}
				res = Math.max(res, wkRes);
			}

			System.out.println(res);

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveD() {
		Scanner scanner = null;
		int lineAB = 0;
		int lineBC = 0;
		int lineCA = 0;

		try {
			scanner = new Scanner(System.in);
			lineAB = scanner.nextInt();

			System.out.println("");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}
}

Measured memory_bytes: 27216
#include "bits/stdc++.h"
using namespace std; 

#define IOS {ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);}
#define ll long long 

ll powermod(ll x,ll ex,ll md){ll ans=1ll;while(ex>0){if(ex&1ll) ans=(ans*x)%md; ex>>=1ll;x=(x*x)%md;}return ans;}
inline ll gcd(ll a,ll b) {if(b==0)return a;a%=b;return gcd(b,a);}
inline ll max(ll a,ll b) {return((a>b)?a:b);}
inline ll min(ll a,ll b) {return((a>b)?b:a);}


int main(){
        IOS;
        ll n;
        cin>>n;
        ll a[n];
        ll index[n];
        for(ll i=0;i<n;i++){
                cin>>a[i];
                a[i]--;
                index[a[i]]=i;
        }
        sort(a,a+n);
        ll mx_unchanged=0,present_unchanged=0,previous_index=-1;
        for(ll i=0;i<n;i++){
                if(index[a[i]] > previous_index) present_unchanged++;
                else present_unchanged=1;
                mx_unchanged=max(mx_unchanged , present_unchanged);
                previous_index = index[a[i]];
        }
        cout<<n-mx_unchanged<<"\n";
}


Measured memory_bytes: 6780
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        int N = S.length();
        int g = 0;
        int p = 0;
        for (int i=0;i<N;i++) {
            if (S.charAt(i)=='g') g++;
            else p++;
        }
        System.out.println(N/2-p);
    }
}

Measured memory_bytes: 25812
N, M = gets.split.map(&:to_i)
edges = M.times.map { gets.split.map(&:to_i) }
graph = Array.new(N) { [] }
edges.each do |u, v|
  u -= 1
  v -= 1
  graph[u].push(v)
  graph[v].push(u)
end

require 'set'
def path_count(u, visited, graph)
  return 1 if visited.size == N
  ret = 0
  graph[u].each do |v|
    next if visited.include?(v)
    new_visited = visited | Set.new([v])
    ret += path_count(v, new_visited, graph)
  end
  ret
end
visited = Set.new([0])
ans = path_count(0, visited, graph)
puts ans

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

typedef long long ll;
typedef pair<ll, ll> P;

#define pb push_back
#define rep(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, n) for(int i = a; i < (n); i++)
#define mod (ll)(1e9+7)
#define int ll

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

signed main() {
	ll n, d, x;
  ll a[101] = {0};
  cin >> n >> d >> x;
  rep(i, n) {
    cin >> a[i];
    int days = 1;
    for (int j = 1; days <= d; j++) {
      x++;
      days = j * a[i] + 1;
    }
  }
  cout << x << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <queue>
using namespace std;
typedef unsigned int uint;
typedef long long ll;
typedef pair<int, int> P;
const int c_INF = 111111111;
const int c_mINF = -111111111;
const int c_YET = -1;
const int c_Dx[4] = { 0,0,1,-1 };
const int c_Dy[4] = { 1,-1,0,0 };


int main() {
	int N,M,C;
	scanf("%d%d%d", &N,&M,&C);
	int B[30];
	int A[30][30];
	for (int i = 0; i < M; i++)scanf("%d", &B[i]);
	for (int i = 0; i < N; i++)
		for (int j = 0; j < M; j++)
			scanf("%d", &A[i][j]);

	int ans = 0;

	for (int i = 0; i < N; i++) {
		int sum = 0;
		for (int j = 0; j < M; j++)sum += A[i][j] * B[j];
		if (sum + C > 0)ans++;
	}

	printf("%d", ans);
}

/*         提出前の確認事項

・デバッグ用の関数は＜＜コメント化＞＞しているか？
・すべての＜＜入力例＞＞は試したか？
・＜＜限界値分析＞＞はしたか？
・＜＜出力の改行＞＞の有無は確認したか？
・文字列の＜＜スペル＞＞は確認したか？
　　　　　　　　↓
	 ＜＜提出先＞＞に注意して提出！！
*/

Measured memory_bytes: 128
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N,D,A = map(int,readline().split())
m = map(int,read().split())
X, H = zip(*sorted(zip(m,m)))

Xs = sorted(set(X) | set(x + D + D for x in X))
x_to_i = {x:i for i,x in enumerate(Xs)}

L = len(Xs)
d_atk = [0] * L

HP = [0] * L
for x,h in zip(X,H):
    i = x_to_i[x]
    HP[i] = h

d_atk = [0] * L

atk = 0 # 予約済の値を管理
answer = 0
for i in range(L):
    x = Xs[i]
    h = HP[i]
    if h > atk:
        rest = h - atk
        n = (rest + A - 1) // A
        atk += n * A
        answer += n
        d_atk[x_to_i[x+D+D]] = -n * A
    atk += d_atk[i]

print(answer)

Measured memory_bytes: 99724
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main
{
	public static void main(String[] args)
	{
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		MyScanner in = new MyScanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		B solver = new B();
		solver.solve(1, in, out);
		out.close();
	}
	
	static class B
	{
		public void solve(int n, MyScanner in, PrintWriter out)
		{
			String S = in.next();
			String T = in.next();

			char[] s = S.toCharArray();
			char[] t = T.toCharArray();
			
			int min = t.length;
			for( int i=0; i<=s.length - t.length; i++ )
			{
				int cnt = 0;
				for( int j=0; j<t.length; j++ )
				{
					if( s[i+j] != t[j] ) cnt++;
				}
				min = Math.min(min, cnt);
			}
			out.println(min);
		}
	}
	
	static class A
	{
		int D;
		int T;
		int S;
		
		public void solve(int testNumber, MyScanner in, PrintWriter out)
		{
			D = in.Int();
			T = in.Int();
			S = in.Int();
			out.println(D <= T*S ? "Yes" : "No");
		}
	}
	
	static class MyScanner
	{
		private BufferedReader in;
		private StringTokenizer st;
		
		public MyScanner(InputStream stream)
		{
			in = new BufferedReader(new InputStreamReader(stream));
		}
		
		public String next()
		{
			while( st == null || !st.hasMoreTokens() )
			{
				try
				{
					String rl = in.readLine();
					if( rl == null )
					{
						return null;
					}
					st = new StringTokenizer(rl);
				}
				catch( IOException e )
				{
					return null;
				}
			}
			return st.nextToken();
		}
		
		public int Int()
		{
			return Integer.parseInt(next());
		}
	}
}


Measured memory_bytes: 32768
lines = $stdin.read
array = lines.split("\n")

X,Y,Z = array[0].split(" ").map(&:to_i)

sum   = 0
times = 1

while true
  sum = (Z + Y) * times
  break if sum > X
  #puts "#{sum} < #{X}"
  times += 1
end

times-=1

if (X - (Z + Y) * times) >= Z
  puts times
else
  puts times-1
end

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
#define ll unsigned long long
#define pb push_back



int main() {

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

	int n, w;
	cin >> n >> w;

	int weight[n];
	int val[n];

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

	ll dp[n + 1][w + 1];

	for (int i = 0; i <= w; ++i) {
		dp[0][i] = 0;
	}

	for (int i = 0; i <= n; ++i) {
		dp[i][0] = 0;
	}

	for (int i = 1; i <= n; ++i) {
		for (int j = 1; j <= w; ++j) {
			if (j < weight[i - 1]) {
				dp[i][j] = dp[i - 1][j];
			} else {
				dp[i][j] = max(dp[i - 1][j - weight[i - 1]] + val[i - 1], dp[i - 1][j]);
			}
		}
	}

	cout << dp[n][w] << endl;

	return 0;
}

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

class Cube {
public:
	int f[6];
	Cube() {}
	void roll_z() { roll(1, 2, 4, 3); }
	void roll_y() { roll(0, 2, 5, 3); }
	void roll_x() { roll(0, 1, 5, 4); }
	void roll(int i, int j, int k, int l) {
		int t = f[i]; f[i] = f[j], f[j] = f[k]; f[k] = f[l]; f[l] = t;
	}
};

int getRight(Cube c1, int f1, int f2) {
	for (int i = 0; i < 6; i++) {
		for (int j = 0; j < 4; j++) {
			if (c1.f[0] == f1&&c1.f[1] == f2)return c1.f[2];
			c1.roll_z();
		}
		if (i % 2 == 0)c1.roll_y();
		else c1.roll_x();
	}
	return -1;
}

int main() {
	Cube c;
	int f1, f2;

	for (int i = 0; i < 6; i++)cin >> c.f[i];
	int q; cin >> q;

	for (int i = 0; i < q; i++) {
		cin >> f1 >> f2;
		cout << getRight(c, f1, f2) << endl;
	}
	return 0;
}

Measured memory_bytes: 3072
/*  ex3_3
    ruuu0048 */
#include <stdio.h>

int main(void){

    int number,k,count; //NとKと割り算をした回数の変数を宣言

    scanf("%d",&number); //変数にNの数を入力する
    scanf("%d",&k); //変数にKの数を入力する

    count = 0; //初期値は0にする

    while(number >= k) //Nの値の方がKの値以上のとき割り算ができる
    {
        number = number / k; //割り算をして、その商をnumberに代入する
        count += 1; //割り算した数を数える
    }
    
    printf("%d\n",count+1); //K進表記したときの桁数は割り算した回数に1を足したものなので、それを出力
    
    return 0; 
}

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

int main()
{
    int A, B, M;
    cin >> A >> B >> M;
    vector<int> a(A);
    int min_ai = INT_MAX;
    for (int i = 0; i < A; i++)
    {
        cin >> a.at(i);
        min_ai = min(min_ai, a.at(i));
    }
    vector<int> b(B);
    int min_bi = INT_MAX;
    for (int i = 0; i < B; i++)
    {
        cin >> b.at(i);
        min_bi = min(min_bi, b.at(i));
    }

    int res = min_ai + min_bi;
    int xi, yi, ci;
    for (int i = 0; i < M; i++)
    {
        cin >> xi >> yi >> ci;
        xi--;
        yi--;
        res = min(res, a.at(xi) + b.at(yi) - ci);
    }
    cout << res << endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <algorithm>
#include <string>
#define rep(i, n) for (int i = 0; i < n; i++) 

using namespace std;

int main() {
    int k;
    cin >> k;
    int a[32] = {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};

    cout << a[k-1];
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main () {
  string S;
  cin >> S;
  long count = 0;
  string A =  "CODEFESTIVAL2016";
  for(int i = 0; i < 16; i++){
    if(A.at(i) != S.at(i)) count++;
  }
  cout << count << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n, a, b;
    cin>>n>>a>>b;
    if(a%2==0 && b%2==0 || a%2==1 && b%2==1)
        cout<<"Alice";
    else if(a%2==1 && b%2==0 || a%2==0 && b%2==1)
        cout<<"Borys";
    else
        cout<<"Draw";
}


Measured memory_bytes: 3596
package main

import "fmt"

func main() {
	var a int
	var s string

	fmt.Scanln(&a)
	fmt.Scanln(&s)

	fmt.Println(logic(a, s))
}

func logic(a int, s string) string {
	if a >= 3200 {
		return s
	}
	return "red"
}

Measured memory_bytes: 512
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int k = sc.nextInt();
    int ans = 1;

    for (int i = 0; i < n; i++) {
      if (ans < k) {
        ans *= 2;
      } else {
        ans += k;
      }
    }

    System.out.println(ans);

  }
}

Measured memory_bytes: 35704
#include <stdio.h>
int main(){
    char S[4];
    scanf("%s",S);
    if(S[0]==S[1]){
        if(S[2]==S[3]){
            if(S[0]!=S[2]){
                printf("Yes");
                return 0;
            }
        }
    }
    if(S[0]==S[2]){
        if(S[1]==S[3]){
            if(S[0]!=S[1]){
                printf("Yes");
                return 0;
            }
        }
    }
    if(S[0]==S[3]){
        if(S[1]==S[2]){
            if(S[0]!=S[1]){
                printf("Yes");
                return 0;
            }
        }
    }
    printf("No");
}

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

int main(){	
	int N, K;
	cin >> N >> K;
	int ans = 0;
	for (int i = 0; i < N; ++i){
		int h;
		cin >> h;
		if (h >= K) ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2e3+5;
const ll mod = 1000000000039ll, base = 9971ll;
int n,m;
ll r[N][N],c[N][N];
char s[N][N],t[N][N]; 
bool check(int x,int y)
{
	for(int i=1;i<=n;i++)
		if(r[x+i-1][y]!=c[x][y+i-1])
			return false;
	return true;
}
int main()
{
	//ios::sync_with_stdio(false);
	//cin.tie(0);
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%s",s[i]+1);
		for(int j=1;j<=n;j++)
			s[i][n+j]=s[i][j];
		for(int j=1;j<=2*n;j++)
			s[i+n][j]=s[i][j];
	}
	m=2*n;
	for(int i=1;i<=m;i++)
	{
		for(int j=1;j+n-1<=m;j++)
		{
			ll num=0;
			for(int k=1;k<=n;k++)
				num=(num*base+s[i][j+k-1]-'a'+1)%mod;			
			r[i][j]=num;
		}
	}
	for(int j=1;j<=m;j++)
	{
		for(int i=1;i+n-1<=m;i++)
		{
			ll num=0;
			for(int k=1;k<=n;k++)
				num=(num*base+s[i+k-1][j]-'a'+1)%mod;			
			c[i][j]=num;
		}
	}
	int res=0;
	for(int a=0;a<n;a++)
	{
		for(int b=0;b<n;b++)
		{
			if(check(a+1,b+1))
				res++;
		}
	}
	cout<<res<<'\n';
	return 0;
}

Measured memory_bytes: 22784
#include <bits/stdc++.h>
using namespace std;
int INF = 1000000007;
 
int main(){
  int N;
  cin >> N;
  int D, X;
  cin >> D >> X;
  int ans = X;
  int A[N];
  for(int i=0;i<N;i++){
    cin >> A[i];
  }
  for(int i=0;i<N;i++){
    int W = 1;
    while(W <= D){
      ans++;
      W += A[i];
    }
  }
  cout << ans << endl;
}

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

class Program
{
    static void Main(string[] args)
    {
        var N = sc.ReadInt();
        var K = sc.ReadInt();
        var ans = N - K + 1;
        Console.WriteLine(ans);
    }
    static Scanner sc = new Scanner();
}

class Scanner
{
    string[] S = new string[0];
    int Index = 0;
    char[] Separators = new char[] { ' ' };

    public string Next()
    {
        if (this.Index < this.S.Length) return this.S[this.Index++];
        var line = "";
        while (line == "") line = Console.ReadLine();
        this.S = line.Split(this.Separators, StringSplitOptions.RemoveEmptyEntries);
        if (this.S.Length == 0) return this.Next();
        this.Index = 0;
        return this.S[this.Index++];
    }
    public string ReadStr()
    {
        return this.Next();
    }
    public char ReadChar()
    {
        return this.Next()[0];
    }
    public int ReadInt()
    {
        return int.Parse(this.Next());
    }
    public uint ReadUInt()
    {
        return uint.Parse(this.Next());
    }
    public long ReadLong()
    {
        return long.Parse(this.Next());
    }
    public double ReadDouble()
    {
        return double.Parse(this.Next());
    }
    public int[] ReadIntArray(int n)
    {
        var array = new int[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadInt();
        }
        return array;
    }
    public long[] ReadLongArray(int n)
    {
        var array = new long[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadLong();
        }
        return array;
    }
    public double[] ReadDoubleArray(int n)
    {
        var array = new double[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadDouble();
        }
        return array;
    }
    public char[] ReadCharArray(int n)
    {
        var array = new char[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadChar();
        }
        return array;
    }
    public string[] ReadStrArray(int n)
    {
        var array = new string[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadStr();
        }
        return array;
    }
}


Measured memory_bytes: 11092
#include <iostream>
using namespace std;
long long  K, rec[60], ans[60];
const long long  N = 50;
int main() {
    cin >> K;
    long long  div = K / N, mo = K % N;
    for (long long  i=0;i<N;i++)
        rec[i] = div + (i < mo);
    for (long long  i=0;i<N;i++) {
        long long  sum = 0;
        for (long long  j=0;j<N;j++)
            if(i != j)
                sum += rec[j];
        ans[i] = N * (rec[i] + 1) - sum - 1;
    }
    cout << N << endl;
    for (long long  i=0;i<N;i++) cout << (i ? " " : "") << ans[i];
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
import math
import sys

def make_tree(a: list, default: int, op):
    real_size = len(a)
    elem_size = 1 << math.ceil(math.log2(real_size))
    tree = [default] * elem_size + a + [default] * (elem_size - real_size)

    for i in range(elem_size-1, 0, -1):
        left, right = tree[i << 1], tree[(i << 1) + 1]
        tree[i] = op(left, right)

    return tree

def get_min(tree: list, x: int, y: int):
    result, elem_size = float("inf"), len(tree)//2
    l, r = x + elem_size, y + elem_size

    while l < r:
        if l & 1:
            result = tree[l] if tree[l] < result else result
            l += 1
        if r & 1:
            r -= 1
            result = tree[r] if tree[r] < result else result
        l, r = l >> 1, r >> 1

    return result

def set_value(tree: list, i: int, value: int, op):
    k = len(tree)//2 + i
    tree[k] = value

    while k > 1:
        k >>= 1
        left, right = tree[k << 1], tree[(k << 1) + 1]
        tree[k] = op(left, right)

if __name__ == "__main__":
    n, q = map(int, input().split())
    tree = make_tree([2**31-1]*n, 2**31-1, min)
    ans = []
    append = ans.append
    for com, x, y in (map(int, l.split()) for l in sys.stdin.readlines()):
        if com == 0:
            set_value(tree, x, y, min)
        else:
            append(get_min(tree, x, y+1))
    print(*ans, sep="\n")


Measured memory_bytes: 16368