akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <algorithm>  
#include <set>
#include <queue>
#include <deque>
#include <cmath>
#include <stack>
#include <cmath>
#include <cstdio>
#include<unordered_set>
#include <cstring>
#include <iomanip>
#include <list>
typedef long long ll;
#define mp make_pair
#define pb push_back
#define vi vector <int>
#define ld long double
#define pii pair<int, int>
#define forn(i, n) for(int i = 0; i < int(n); i++) 
#define MAX 1000000 
using namespace std;
const ll INF = 1e18 + 1;
const ll N = 1e6;
vector<pair<string,int>> g[N];

int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  map<char, char> hm;
  char arr[] = { 'r','p','s' };

  hm['r'] = 'p';
  hm['p'] = 's';
  hm['s'] = 'r';
  int n,k,r,s,p; cin >> n >> k >> r >> s >> p;
  string comp; cin >> comp;
  int ans = 0;
  string hum = "";
  for (int i = 0; i < comp.size(); i ++) {
    char temp = hm[comp[i]];
    if (i - k >= 0 && hum[i - k] != temp) {
      hum += temp;
      if (temp == 'r') ans += r; else if (temp == 's') ans += s;
      else ans += p;
    }
    else if (i - k >= 0 && hum[i - k] == temp) {
        if (i + k < n) {
            char temp2 = hm[comp[i + k]];
            for (int j = 0; j < 3; j ++){
                if (arr[j] != temp && arr[j] != temp2) {
                    hum += arr[j];
                    break;
                }
            }
        }
        else {
          hum += comp[i];
        }
      }
      else {
              hum += temp;
              if (temp == 'r') ans += r; else if (temp == 's') ans += s;
              else ans += p;
      }
  }
  cout << ans << endl;


}    
                

Measured memory_bytes: 24064
N, M = map(int, input().split())
T = {}
for i in range(M):
    a, b = map(int, input().split())
    if a not in T:
        T[a] = []
    T[a].append(b)
    if b not in T:
        T[b] = []
    T[b].append(a)
# print(N, M, T)
FROM_1 = T[1]

for f in FROM_1:
    if N in T[f]:
        print('POSSIBLE')
        exit()
print('IMPOSSIBLE')


Measured memory_bytes: 100952
#include <bits/stdc++.h>
#pragma once
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
typedef long double lb;
#define int long long
#define double long double
typedef pair<int,int> P;
const int MOD = 1000000007;
const ll INF = 1e16;
const double EPS = 1e-10;
const double PI = 3.141592653589793;
template<class T> inline bool chmin(T& a, T b){if(a>b){a = b;return 1;}return 0;}
template<class T> inline bool chmax(T& a, T b){if(a<b){a = b;return 1;}return 0;}
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 


////////////////////////////////////////////////////////////////////
ll modpow(ll a,  ll n, const ll &MOD = MOD){
  ll ret = n == 0 ? 1 : modpow(a, n/2, MOD);
  (ret *= ret) %= MOD;
  if(n%2)((ret *= a) %= MOD);
  return ret;
}
vector<ll> fac, finv, inv;
void COMinit(const int MAX = 5000000, const ll &MOD = MOD){
  fac.resize(MAX);finv.resize(MAX);inv.resize(MAX);
  fac[0] = fac[1] = finv[0] = finv[1] = inv[1] = 1;
  repd(i,2,MAX){
    fac[i] = fac[i-1] * i % MOD;
    inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
    finv[i] = finv[i-1] * inv[i] % MOD;
  }
}
ll 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;
}
ll modinv(ll d, const ll &MOD = MOD){
  return modpow(d, MOD-2, MOD);
}
////////////////////////////////////////////////////////////////////

double n,k;
signed main(){
  cin>>n>>k;
  double a = log2l(n)/log2l(k);
  if(ceill(a) == a)a += 1.0;
  cout << ceill(a) << endl;
}



Measured memory_bytes: 256
k=int(input())
a,b=map(int,input().split())
aa=a//k
bb=b//k
aaa=a%k
bbb=b%k

if aa!=bb:
  print('OK')
elif aaa==0:
  print('OK')
elif bbb==0:
  print('OK')
else:
  print('NG')
      

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

const char wall = '#';
vector<vector<char>> fields;
vector<vector<bool>> used;
const int dx[4] = {0, -1, 0, 1};
const int dy[4] = {1, 0, -1, 0};

vector<ll> A;
// vectorのリサイズ
// A.resize(N);

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

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

  int n, x, y;
  cin >> n >> x >> y;
  x--; y--;

  map<int, int> mp;
  rep(i, n-1) {
    for(int j = i+1; j < n; j++) {
      int ans = min(j-i, min(abs(x-i)+1+abs(j-y), abs(y-i)+1+abs(j-x)));
      mp[ans]++;
    }
  }
  rep1(i, n-1) {
    cout << mp[i] << endl;
  }
  return 0;
}


Measured memory_bytes: 384
data = [str(i+1)*4 for i in range(9)]
while True:
    n = raw_input()
    if n == '0000': 
        break
    elif n in data:
        print 'NA'
        continue
    c = 0
    while n != '6174':
        L = int(''.join(sorted(n, reverse=True)))
        S = int(''.join(sorted(n)))
        n = str(L-S).zfill(4)
        c += 1
    else:
        print c

Measured memory_bytes: 4224
import math

def nCr(n,r):

    if n >= r:
        return math.factorial(n) // (math.factorial(n-r) * math.factorial(r))

    else:
        return 0



N = int(input())

slis = [2]

for i in range(N+1):

    if i <= 2:
        continue;

    flag = True

    for j in slis:

        if i % j == 0:

            flag = False

    if flag:
        slis.append(i)


num = [0] * len(slis)

up1 = 0
up2 = 0
up4 = 0
up14 = 0
up24 = 0
up74 = 0


for i in range(N):

    i += 1

    cnt = 0

    while True:

        if i == 1:
            break

        if i % slis[cnt] == 0:

            i = i // slis[cnt]
            num[cnt] += 1

            if num[cnt] == 74:
                up74 += 1
            elif num[cnt] == 24:
                up24 += 1
            elif num[cnt] == 14:
                up14 += 1
            elif num[cnt] == 4:
                up4 += 1
            elif num[cnt] == 2:
                up2 += 1
            elif num[cnt] == 1:
                up1 += 1
                
        else:
            cnt += 1

#print (slis)
#print (num)

ans = 0


ans += nCr(up74,1)

ans += nCr(up24,1) * nCr(up2-1,1)

ans += nCr(up14,1) * nCr(up4-1,1)

ans += nCr(up4,2) * nCr(up2-2,1)


print (ans)

Measured memory_bytes: 38896
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int X = scan.nextInt();
		int Y = scan.nextInt();
		
		if(Y % 2 == 0 && X * 2 <= Y && Y <= X * 4) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
		
	}

}

Measured memory_bytes: 26984
#include<cstdio>
#include<vector>
#include<cstring>
using namespace std;
#define L 503

struct Move {
	int x,y,tx,ty;
};
int n,m,r;
int num[L][L];
bool even[L];
vector<Move>ans;

int main() {
	scanf("%d %d",&n,&m);
	for(int i=1;i<=n;i++) {
		for(int j=1;j<m;j++) {
			scanf("%d",&r);
			num[i][j]+=r;
			if(num[i][j]%2==1) {
				num[i][j]--,num[i][j+1]++;
				ans.push_back((Move){i,j,i,j+1});
			}
		}
		scanf("%d",&r);
		num[i][m]+=r;
		if(num[i][m]%2==1) {
			if(i==n) continue;
			num[i][m]--,num[i+1][m]++;
			ans.push_back((Move){i,m,i+1,m});
		}
	}
	printf("%d\n",ans.size());
	for(int i=0;i<ans.size();i++)
		printf("%d %d %d %d\n",ans[i].x,ans[i].y,ans[i].tx,ans[i].ty);
	return 0;
}

Measured memory_bytes: 5232
#include <iostream>
using namespace std;
int main(void){
  int N;
  cin >> N;
  
  int a,b;
  a = N / 100;
  b = N % 100;
  
  if(a == 0 &&b == 0)
    cout << "NA" << endl;
  else if(a == 0 && b > 12)
    cout << "NA" << endl;
  else if(a > 12 &&  b == 0)
    cout << "NA" << endl;
  else if(a > 12 && b > 12)
    cout << "NA" << endl;
  
  else if(a > 12 || a == 0)
    cout << "YYMM" << endl;
  else if(b > 12 || b == 0)
    cout << "MMYY" << endl;
  else
    cout << "AMBIGUOUS" << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef vector<int> vi;




const ll unset = -1e18;
const ll inf = 1e15;


int N;
ll a[16][16];
ll total[(1<<16) + 5];
ll dp[(1<<16) + 5];

ll dfs(int msk) {
    ll& res = dp[msk];
    if (res == unset) {
        if (msk + 1 == (1 << N)) {
            res = 0;
        } else {
            res = -inf;
            vector<int> available;
//            cout << "msk=" << bitset<3>(msk) << " ; available:[";
            for (int i = 0; i < N; ++i) {
                if (!(msk & (1 << i))) {
                    available.push_back(i);
//                    cout << i << ' ';
                }
            }
//            cout << "]\n";
            int cnt = available.size();
            for (int opt = 1; opt < (1 << cnt); ++opt) {
                int msk1 = 0;
                for (int i = 0; i < cnt; ++i) {
                    if (opt & (1 << i)) {
                        msk1 |= (1 << available[i]);
                    }
                }
                ll score = total[msk1] + dfs(msk | msk1);
                res = max(res, score);
            }
        }
//        cout << "dp[" << bitset<3>(msk) << "] = " << res << "\n";
    }
    return res;
}


void Main() {
    cin >> N;
    for (int i = 0; i < N; ++i) {
        for (int j = 0; j < N; ++j) {
            cin >> a[i][j];
        }
    }
    for (int msk = 0; msk < (1 << N); ++msk) {
        dp[msk] = unset;
        ll score = 0;
        for (int i = 0; i < N; ++i) {
            if (!(msk & (1 << i))) continue;
            for (int j = i+1; j < N; ++j) {
                if (!(msk & (1 << j))) continue;
                score += a[i][j];
            }
        }
        total[msk] = score;
    }
    ll ans = dfs(0);
    cout << ans << '\n';
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    #ifndef _DEBUG
    #endif
    Main();
    return 0;
}


Measured memory_bytes: 1280
#include <cstdio>
#include <algorithm>

int main()
{
  int e;
  while (~scanf("%d", &e)) {
    if (e == 0)
      break;

    int ans = 1 << 30;
    for (int y = 0; y*y <= e; ++y) {
      for (int z = 0; z*z*z <= e; ++z) {
	if (y*y+z*z*z <= e)
	  ans = std::min(ans, y+z+(e-y*y-z*z*z));
      }
    }

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

Measured memory_bytes: 760
#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 SZ(a) int((a).size())
#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 SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) sort((c).rbegin(),(c).rend())
#define UNIQUE(c) SORT(c); (c).erase(unique((c).begin(), (c).end()), (c).end());
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
const double INF = 1e7;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
#define CLR(a) memset((a), 0 ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;


void solve(LL H, LL W, vector<vector<LL>> a){
	vector<PII> path;
	for (int i = 0; i < H; i++) {
		if (i % 2 == 0) {
			for (int j = 0; j < W; j++) {
				path.push_back(MP(i, j));
			}
		} else {
			for (int j = W - 1; j >= 0; j--) {
				path.push_back(MP(i, j));
			}
		}
	}
	VS ops;
	REP(i, SZ(path) - 1) {
		int h = path[i].first, w = path[i].second;
		if (a[h][w] % 2 == 1) {
			int h_next = path[i + 1].first, w_next = path[i + 1].second;
			a[h][w]--;
			a[h_next][w_next]++;
			string op = toString(h + 1) + " " + toString(w + 1) + " " + toString(h_next + 1) + " " + toString(w_next + 1);
			ops.push_back(op);
		}
	}
	cout << SZ(ops) << endl;
	REP(i, SZ(ops)) {
		cout << ops[i] << endl;
	}
}


int main(){	
	LL W;
	LL H;
	scanf("%lld",&H);
	scanf("%lld",&W);
	vector<vector<LL>> a(H-1+1,vector<LL>(W-1+1));
	for(int i = 0 ; i <= H-1 ; i++){
		for(int j = 0 ; j <= W-1 ; j++){
			scanf("%lld",&a[i][j]);
		}
	}
	solve(H, W, a);
	return 0;
}



Measured memory_bytes: 16752
// #pragma GCC optimize(3, "Ofast", "inline")
#include <bits/stdc++.h>
#define String std::string
#define fir first
#define sec second
#define mp std::make_pair
#define Pair std::pair<int, int>
#define Map std::map< int, int >
#define Vector std::vector<int>

typedef long long ll;
typedef unsigned long long ull;

const int N = 1e5 + 5;
const int MOD = 1e9 + 7;
const int dx[] = { 0, 1, -1, 0, 1, -1, 1, -1 };
const int dy[] = { 1, 0, 0, -1, 1, -1, -1, 1 };

inline int read() {
    int res = 0, f = 1;
    char ch = getchar();
    for (; !isdigit(ch); ch = getchar()) if (ch == '-') f = -1;
    for (; isdigit(ch); ch = getchar()) res = (res << 1) + (res << 3) + ch - '0';
    return res * f;
}

int n, ans;
// int a[N], ps[N];
char s[N];

int main() {
    std::cin >> n;
    scanf("%s", s);
    ans = 1;
    for (int i = 1; i < n; i++) {
        if (s[i] != s[i - 1]) ans++;
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 384
#include <stdio.h>

int main(void) {

int a;
int b[100];
int i;
int sumA = 0;
int sum = 0;
int sumsum = 0;
int K;
int x = 0;

scanf("%d", &a);

for (i = 0; i < a; i++){
  scanf("%d", &b[i]);
  /*
  if(b[i] < min){
    min = b[i];
  }
  if(b[i] > max){
    max = b[i];
  }
  */
 sumA += b[i];
}

K = sumA / a;

for (i = 0; i < a; i++){
  sum += (K - b[i]) * (K - b[i]);
  if(sumA % a != 0) {
    sumsum += (K + 1 - b[i]) * (K + 1 - b[i]);
  }
}

if ( sum > sumsum){
  sum = sumsum;
}
printf("%d", sum);

return 0;

}


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

using namespace std;

int main(){
    long long int a, b, c, k;
    cin >> a >> b >> c >> k;
    long long int d;
    if(k % 2 == 0){
        d = a - b;
    }
    else{
        d = b - a;
    }
    cout << d;
}


Measured memory_bytes: 256
// #pragma GCC optimize("Ofast")
// #pragma GCC target("avx,avx2,fma")
// #pragma GCC optimization ("unroll-loops")

#include<bits/stdc++.h>
#define ll long long
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define clr clear()
#define ins insert
#define tol(s) transform(s.begin(),s.end(),s.begin(),::tolower);
#define tou(s) transform(s.begin(),s.end(),s.begin(),::toupper);
#define rep(i,n) for(__typeof(n) i=0; i<(n); i++)
#define mem(x,val) memset((x),(val),sizeof(x));
#define cusmem(x,val) for(auto &i:x) i=val;
#define all(x) x.begin(),x.end()
#define fastio ios_base::sync_with_stdio(false);\
            cin.tie(NULL);\
            cout.tie(NULL);
using namespace std;
typedef pair<int,int> pii;
typedef pair<ll,ll>pll;
typedef pair<ll,int>pli;
typedef vector<ll> vl;
typedef vector<pll> vpll;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<pii> vpii;
string impossible;

mt19937 mt_rand(chrono::high_resolution_clock::now().time_since_epoch().count());
// const int N=6;
const int N=1e5+5;
const int L=31;
ll mod=1e9+7;
ll n,i,j,k,x,m,b,a,da,db,u,v;
bool f0,f1,f2;
const int MAXN=1e6+5;
string s;
vector<ll>dp;
int main(){
    #ifndef ONLINE_JUDGE
            freopen("input.txt","r",stdin); 
            freopen("output.txt","w",stdout);
    #endif
    fastio
    cout<<fixed<<setprecision(11);
    int tests=1;    
    // cin>>tests;
    for(int te=1;te<=tests;te++){
        cin>>n;
        ll mind=LLONG_MAX,maxd=LLONG_MIN;
        ll a=LONG_LONG_MAX,b=LONG_LONG_MIN;
        for(int i=0;i<n;i++){
            cin>>u>>v;
            mind=min(mind,u+v);
            maxd=max(maxd,u+v);
            a=min(a,u-v);
            b=max(b,u-v);
        }
        cout<<max(maxd-mind,b-a);
    }
    return 0;
}





Measured memory_bytes: 3652
#%%
import sys
def input():
    return sys.stdin.readline().rstrip()

def main():
    K, X = map(int, input().split())

    XL=max(X-K+1, -1000000)
    XR=min(X+K-1, 1000000)
    for i in range(XL, XR+1):
        print(i, end=" ")

# %%
if __name__ == '__main__':
    main()

# %%
# from atcoder_test import doTest
# doTest("abc137","b",main)

Measured memory_bytes: 3060
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <map>
#include <stack>
#include <algorithm>
#include <climits>
#include <cmath>
#include <functional>
#include <utility>
#include <numeric>
#define REP(i, n) for (int i = 0; i < (int)n; i++)
#define FOR(i, m, n) for (int i = (int)m; i < (int)n; i++)
#define REPvec(itr, mp) for (auto itr = mp.begin(); itr != mp.endl(); itr++)
#define REPe(e, mp) for (auto& e : mp)
#define all(x) x.begin(), x.end()
#define MOD 1000000007  // 1e9+7
using namespace std;
using ll = long long int;
using vecint = vector<int>;
using vecll = vector<ll>;
using vec2int = vector<vector<int>>;
using P = pair<int, int>;
////////////////////////////////////////////////
////////////////////////////////////////////////
int main() {
  ////////////////////////////////////////////////
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  ////////////////////////////////////////////////
  int n;
  cin >> n;
  n %= 10;
  if (n == 3) {
    cout << "bon" << endl;
  } else if (n == 0 || n == 1 || n == 6 || n == 8) {
    cout << "pon" << endl;
  } else {
    cout << "hon" << endl;
  }
}


Measured memory_bytes: 3656
parseInt(x)=parse(Int,x)
parseMap(x::Array{SubString{String},1})=map(parseInt,x)

function main()
	s = readline() |> chomp
	c = ["KIHBR","KIHBRA","KIHBAR","KIHABR","AKIHBR","AKIHBRA","AKIHBAR","AKIHABR","KIHABRA","KIHABAR","KIHBARA","AKIHBARA","AKIHABAR","AKIHABRA","KIHABARA","AKIHABARA"]
	f = 0
	for i in 1:16
		if s == c[i]
			f = 1
			break
		end
	end
	println(f==1?"YES":"NO")
end

main()

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

namespace kyoupuro
{
    class MainClass
    {
        public static void Main()
        {
            MainClass mainClass = new MainClass();
            mainClass.Start();
        }

        public void Start()
        {
            var line = Console.ReadLine();
            var tmp = new Char[4] { 'A', 'T', 'G', 'C' };
            int sum = 0, tsum = 0;
            bool start = tmp.Contains(line[0]);

            for (int i = 0; i < line.Length; i++)
            {
                if (!start)
                {
                    if (tmp.Contains(line[i]))
                    {
                        start = true;
                        tsum = 1;
                    }
                }
                else
                {
                    if (tmp.Contains(line[i]))
                    {
                        tsum++;
                    }
                    else
                    {
                        sum = Math.Max(tsum, sum);
                        tsum = 0;
                    }
                }
            }

            sum = Math.Max(tsum, sum);

            Console.WriteLine(sum);
        }

        List<List<int>> IntInit()
        {
            int maxindex = int.Parse(Console.ReadLine());

            List<List<int>> array = new List<List<int>>();

            for (int i = 0; i < maxindex; i++)
            {
                array.Add(new List<int>(
                Console.ReadLine().Split(' ').Select(int.Parse)));
            }

            return array;
        }
    }
}




Measured memory_bytes: 11220
#include  <stdio.h>

int main(){
    int a,b,c;
    scanf ("%d %d %d", &a,&b,&c);
    if (a==b&&b==c){
        printf("No\n");
    }
    else if(a==b||b==c||a==c){
        printf("Yes\n");
    }
    else{
        printf("No\n");
    }
    return 0;
}

Measured memory_bytes: 1604
use std::io;
use std::str::FromStr;
fn main() {
    let stdin = io::stdin();
    let mut s = String::new();
    stdin.read_line(&mut s).ok();
    s.pop();
    let mut abc : Vec<i32> = Vec::new();
    let it = s.trim().split_whitespace();
    for arg in it {
        abc.push(i32::from_str(&arg).expect("e"));
    }
    let a = abc[0];
    let b = abc[1];
    let c = abc[2];
    if b - a == c - b {
        println!("YES");
    } else {
        println!("NO");
    }
}

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

int main() {
   string S , T ;
  cin >> S >> T ;
  int A , B ;
  cin >> A >> B ;
  string U ;
  cin >> U ;
  
  if(U==S){
    cout << A-1 << endl;
    cout << B << endl;
  }
  else {
    cout << A << endl;
    cout << B-1 << endl;
  }
  
}


Measured memory_bytes: 256
#include <iostream>

int main(){
  int a, b;
  std::cin >> a >> b;
  if(a < 6)
    std::cout << 0 << std::endl;
  else if(a < 13)
    std::cout << b/2 << std::endl;
  else
    std::cout << b << std::endl;
  return 0;
}

Measured memory_bytes: 256
{-# LANGUAGE BangPatterns #-}
import Control.Monad
import Data.Maybe
import Debug.Trace
import Data.List
import qualified Data.Map.Strict as Map
import qualified Data.IntMap.Strict as IntMap
import qualified Data.Set as Set
import qualified Data.IntSet as IntSet
import Data.Functor
-- import Data.Array
import Data.Array.Unboxed

import Control.Monad.ST
import Data.Array.ST
import qualified Data.Vector as V
import qualified Data.Vector.Unboxed as VU
-- import qualified Data.Vector.Unboxed.Mutable as VM
import qualified Data.Vector.Mutable as VM

import Data.Array.IO
import Data.Array.ST

import qualified Data.ByteString.Char8 as B
import Data.Maybe (fromJust)
readInt = fst . fromJust . B.readInt
readInts = map (fst . fromJust . B.readInt) . B.words <$> B.getLine :: IO [Int]
read2dInts = map (map (fst . fromJust . B.readInt) . B.words) . B.lines <$> B.getContents

main :: IO ()
main = do
  n <- readLn :: IO Int
  as <- readInts
  putStrLn . unwords . map show $ solve as

solve = countingSort'' (0, 10000)

countingSort'' :: (Int, Int) -> [Int] -> [Int]
countingSort'' (s,e) as = concatMap (\i -> replicate (carr ! i) i) [0..(e-s)]
  where
    carr :: UArray Int Int
    carr = runSTUArray $ do
      arr <- newArray (s,e) 0
      forM_ as (\a -> do
        val <- readArray arr a
        writeArray arr a (val + 1) 
        )
      return arr



Measured memory_bytes: 24844
# coding:utf-8

INF = float('inf')


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


N = int(input())
A1 = inpl()
A2 = inpl()

A1_c = [0]
A2_c = [0]
for i in range(N):
    A1_c.append(A1_c[-1] + A1[i])
    A2_c.append(A2_c[-1] + A2[i])

ans = 0
for i in range(1, N + 1):
    ans = max(ans, A1_c[i] + (A2_c[N] - A2_c[i - 1]))

print(ans)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define BIT(n) (1LL << (n))
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPB(i, n) for (int i = 0; i < BIT(n); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORA(i, n) for (auto &&i : n)
#define FORS(i, m, n) for (int i = m; i <= n; i++)
#define DEBUG(x) cerr << #x << ": " << x << "\n"
#define DEBUG2(x, y) cerr << #x << ": " << x << " " << #y << ": " << y << "\n"
#define DEBUG3(x, y, z) cerr << #x << ": " << x << " " << #y << ": " << y << " " << #z << ": " << z << "\n"
#define PRINTALL(V)    \
  for (auto v : (V)) { \
    cerr << v << " ";  \
  }                    \
  cerr << "\n";
#define ALL(v) v.begin(), v.end()
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
#define epb emplace_back
#define int long long
#define pint pair<int, int>
#define ld long double
using namespace std;
template <class T> bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> using vec = std::vector<T>;
template <class T> void print(const T &x) { cout << x << "\n"; }
const int MOD = 1000000007, INF = 1061109567, INF2 = INF * INF;
const double EPS = 1e-10, PI = acos(-1.0);
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
signed main() {
  cin.tie(0), ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  int A, B, C;
  cin >> A >> B >> C;
  //  if (A % 2 == 1 || B % 2 == 1 || C % 2 == 1) print("0");
  if (A == B && B == C && A % 2 == 0)
    print(-1);
  else {
    int v[3] = {A, B, C};
    int w[3];
    int ans = 0;
    while (1) {
      REP(i, 3) {
        if (v[i] % 2 == 1) {
          print(ans);
          return 0;
        }
      }
      REP(i, 3) {
        w[i] = v[(i + 1) % 3] + v[(i + 2) % 3];
        w[i] /= 2;
      }
      swap(v, w);
      ans++;
    }
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define rep(i, a, b) for(int i=(a); i<(b); i++)

int main(){
    string S,T;
    cin >> S >> T;
    S += S;
  
    if(string(S).find(T)!=string::npos){
        cout << "Yes" << endl;
        return 0;
    }
        
    cout << "No" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define     ll              long long
#define     MAX             100000
#define     FI              freopen("input.txt","r",stdin)
#define     FO              freopen("output.txt","w",stdout)
#define     fast            ios_base::sync_with_stdio(false);cin.tie();cout.tie();
#define     sc(a)           scanf("%d",&a)
#define     sc2(a,b)        scanf("%d %d",&a,&b)


int main()
{
    string s,t;
    cin>>s>>t;
    if(s.size()<t.size())
    {
        string sub = t.substr(0,t.size()-1);
        if(sub==s)
            cout<<"Yes\n";
        else

            cout<<"No\n";
    }
    else
        cout<<"No\n";
    return 0;
}


Measured memory_bytes: 3596
n = int(input())
a,b = map(int,input().split())
p = list(map(int,input().split()))

x = 0
y = 0
z = 0

for i in range(n):
    if p[i] <= a:
        x += 1
    elif a + 1 <= p[i] <= b:
        y += 1
    elif  b + 1 <= p[i]:
        z += 1

#print(x,y,z)
print(min(x,y,z))


Measured memory_bytes: 3060
#include <bits/stdc++.h>
typedef long long ll; 

using namespace std;

int func(int n) {
	int res = 0;
	for (int i = 1; i <= n; i++) {
		if (n % i == 0) res++;
	}

	return res;
}

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

	int res = 0;
	for (int i = 1; i <= N; i++) {
		if ((i % 2 == 1) && (func(i) == 8)) {
			res++;
		}
	}

	cout << res << endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
ll a[200010];
ll n,k;
bool check(ll x)
{
    ll cnt=0;
    for(ll i=0;i<n;i++)
    {
        if(a[i]==0)
        {
            if(x>=0) cnt+=n-1;
            continue;
        }
        else if(a[i]<0)
        {
            ll tmp;
            if(x>=0) tmp=x/a[i];
            else
            {
                if(x%a[i]==0) tmp=x/a[i];
                else tmp=x/a[i]+1;
            }
            cnt+=n-(lower_bound(a,a+n,tmp)-a);
        }
        else
        {
            ll tmp;
            if(x>=0) tmp=x/a[i];
            else
            {
                if(x%a[i]==0) tmp=x/a[i];
                else tmp=x/a[i]-1;
            }
            cnt+=(upper_bound(a,a+n,tmp)-a);
        }
        if(a[i]*a[i]<=x) cnt--;
    }
    return cnt/2>=k;
}
int main()
{
    ios::sync_with_stdio(false);
    cin>>n>>k;
    for(ll i=0;i<n;i++) cin>>a[i];
    sort(a,a+n);
    ll l=-1e18,r=1e18,ans=-1;
    while(l<=r)
    {
        ll mid=(l+r)/2;
        if(check(mid)) ans=mid,r=mid-1;
        else l=mid+1;
    }
    cout<<ans;
    return 0;
}


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

int main() {
    int n; cin >> n;
    bool flg = false;
    vector<ll> a(n);
    rep(i,n) {
        ll x ;
        cin >> x;
        a[i] = x;
        if (x == 0) flg = true;
    }

    if (flg) {
        cout << 0 << endl;
        return 0;
    }

    const ll s = 1e18;
    ll ans = 1;
    rep(i,n) {
        if (ans > s/a[i]) {
            ans = -1;
            break;
        }
        ans *= a[i];
    }

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

Measured memory_bytes: 3976
#include <iostream>
#include <vector>
using namespace std;
int main() {
    vector<int> X = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int K; cin >> K;
    printf("%d\n", X[K - 1]);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iostream>
using namespace std;
#define mn 100005
#define FLN "code"
#define endl "\n"
#define int long long
#define fi first
#define se second
#define inf 4444444444444444444
#define mod 1000000009
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define FOR0(i, a) for (int i=0; i<(a); i++)
#define FOR1(i, a) for (int i=1; i<=(a); i++)
#define codenhanh(); ios_base::sync_with_stdio(0) ,cin.tie(0),cout.tie(0);

int n,m,a[mn];
int ttl=0;
signed main()
{
	codenhanh();
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
		ttl+=a[i];
		ttl-=1;
	}
	cout<<ttl;
	
	
return 0;
}


Measured memory_bytes: 256
N=int(input())
H=list(map(int,input().split(' ')))
dp=[]

for k in range(N):
	if k==0:
		dp.append(0)
	elif k==1:
		dp.append(abs(H[1]-H[0]))
	else:
		dp.append(min(dp[k-2]+abs(H[k]-H[k-2]), dp[k-1]+abs(H[k]-H[k-1])))
		
print(dp[N-1])

Measured memory_bytes: 13980
use proconio::input;
fn main (){
let mut _a: i128;
let mut _b: i128;


input! {
    a: i128,
    b: i128,

}
 

let x = a + b  ;
let y = a - (24 - b ) ; 


if x > 24  {
    println!("{}",y);
}else if x == 24 {
    println!("{}",0);
}else {
    println!("{}",x);
}
 
}


Measured memory_bytes: 2028
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>

#define ll long long
#define REP(i,n) for(int i = 0; i < n; i++)
#define PI 3.141592653589

using namespace std;

int gcd(int a, int b);
int lcm(int a, int b);

void solve_A(){
    
}

double Expect(int n){
    return (double) (n + 1) / 2;
}

void solve_D(){
    int n, k;
    cin >> n >> k;

    int p[n];
    double e[n];
    double sum = 0.0;
    REP(i,n){
        cin >> p[i];
        sum += Expect(p[i]);
        e[i] = sum;
    }

    double ans = 0;

    if(k != n){
        REP(i, n-k){
            if(ans <= e[i+k] - e[i]) ans = e[i+k] - e[i];
        }
    } else{
        ans = e[n-1];
    }
    
    printf("%.10f", ans);
}

int main(void){
    solve_D();
    return 0;
}

int gcd(int a, int b){
    if(a < b) swap(a, b);

    int r = a % b;
    while(r != 0){
        a = b;  b = r;  r = a % b;
    }
    return b;
}

int lcm(int a, int b){
    return a * b / gcd(a, b);
}

Measured memory_bytes: 2560
#include <stdio.h>
#include <math.h>
int main() {
    long long a, b, c, k;
    scanf("%ld%ld%ld%ld",&a,&b,&c,&k);
    if (k-a <= 0) printf("%d",k);
    else if (k-a-b <= 0) printf("%d",a);
    else printf("%d",a-(k-a-b));
}


Measured memory_bytes: 1736
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::iter::FromIterator;
#[allow(unused_imports)]
use std::io::stdin;

mod util {
    use std::io::stdin;
    use std::str::FromStr;
    use std::fmt::Debug;

    #[allow(dead_code)]
    pub fn line() -> String {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.trim().to_string()
    }

    #[allow(dead_code)]
    pub fn gets<T: FromStr>() -> Vec<T>
    where
        <T as FromStr>::Err: Debug,
    {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.split_whitespace()
            .map(|t| t.parse().unwrap())
            .collect()
    }
}

#[allow(unused_macros)]
macro_rules! get {
    ($t:ty) => {
        {
            let mut line: String = String::new();
            stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
                    get!($t)
                   ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
                    get!($($t),*)
                   ).collect::<Vec<_>>()
    };
    ($t:ty ;;) => {
        {
            let mut line: String = String::new();
            stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn main() {
    let m = get!(usize);

    println!("{}", 24 + (24 - m));
}


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

int main() {
vector<vector<int>> data(3, vector<int>(3));
  for(int i = 0; i < 3; i++){
  	for(int j = 0; j < 3; j++){
    	cin >> data[i][j];
    }
  }

  
  int N;
  cin >> N;
  int bin;
  for(int i = 0; i < N; i++){
  	cin >> bin;
    for(int j = 0; j < 3; j++){
    	for(int k = 0; k < 3; k++){
        	if(data[j][k] == bin){
            	data[j][k] = 0;
            }
        }
    }
  }
  int count = 0;
  if(data[0][0] == 0 && data[0][1] == 0 && data[0][2] == 0) {count++;}
  if(data[1][0] == 0 && data[1][1] == 0 && data[1][2] == 0) {count++;}
  if(data[2][0] == 0 && data[2][1] == 0 && data[2][2] == 0) {count++;}
  
  if(data[0][0] == 0 && data[1][0] == 0 && data[2][0] == 0) {count++;}
  if(data[0][1] == 0 && data[1][1] == 0 && data[2][1] == 0) {count++;}
  if(data[0][2] == 0 && data[1][2] == 0 && data[2][2] == 0) {count++;}
  
  if(data[0][0] == 0 && data[1][1] == 0 && data[2][2] == 0) {count++;}
  if(data[2][0] == 0 && data[1][1] == 0 && data[0][2] == 0) {count++;}
  
  if(count != 0){
  	cout << "Yes" << endl;
  }
  if(count == 0){
  	cout << "No" << endl;
  }
}

Measured memory_bytes: 3596
#include <iostream>
#include <sstream>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>
using namespace std;

typedef long long LL;
typedef unsigned long long ULL;

const double PI = 3.14159265358979323846264338327950;
const LL MOD = 1000000007;

#define PrintLn(X) cout << X << endl
#define Loop(n) for(int loop_ = n; loop_; --loop_)
#define Rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define For(i, a, b) for(int i = a; i < (int)(b); ++i)

int main(void)
{
	int a[3];
	cin >> a[0] >> a[1] >> a[2];
	sort(a, a+3);
	PrintLn(((a[0] == 5 && a[1] == 5 && a[2] == 7) ? "YES" : "NO"));
	return 0;
}


Measured memory_bytes: 256
fun main(args: Array<String>) {
    val s = readInputLine().toCharArray()
    val correctStr = "CODEFESTIVAL2016".toCharArray()

    var ans = 0
    
    for ((i, c) in s.withIndex()) {
        if (c != correctStr[i]) {
            ans++
        }
    }
    
    println(ans)
}
 
fun readInputLine(): String {
    return readLine()!!
}


Measured memory_bytes: 32540
using System;
using System.Collections.Generic;
using System.IO;

class Program
{
    static void Main()
    {
        string[] NK = Console.ReadLine().Split(' ');
        int N = int.Parse(NK[0]);
        int K = int.Parse(NK[1]);
        if (K > N) K = N;

        string[] Input = Console.ReadLine().Split(' ');
        int[] h = new int[N];

        //DPテーブル
        int[] dp = new int[N];

        for (int i = 0; i < N; i++)
        {
            h[i] = int.Parse(Input[i]);
        }
        //入力完了

//        dp[0] = 0;
//        dp[1] = Math.Abs(h[1] - h[0]);

        for (int i = 0; i < K; i++)
        {
            dp[i] = Math.Abs(h[i] - h[0]);
        }

        int tmp = 0;

        for (int i = K; i < N; i++)
        {
            //100回やる
            //tmp = 2147483647;
            for (int j = 1; j <= K; j++)
            {
                if (j == 1)
                {
                    tmp = dp[i - j] + Math.Abs(h[i] - h[i - j]);
                }

                if (tmp > dp[i - j] + Math.Abs(h[i] - h[i - j]))
                    tmp = dp[i - j] + Math.Abs(h[i] - h[i - j]);

                
            }
            dp[i] = tmp;
        }
        Console.WriteLine(dp[N - 1]);
    }
}

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

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

int main(){
  int64_t n;
  cin >> n;
  
  if (n == 1){
    cout << 1;
    return 0;
  }
  int64_t Li_1, Li_2, Li;
  Li_2 = 2;
  Li_1 = 1;
  rep(i, n-1){
    Li = Li_1 + Li_2;
    Li_2 = Li_1;
    Li_1 = Li;
  }
  cout << Li << endl;

}

Measured memory_bytes: 256
#include <cstdio>
int cnt[100005];
int main(){
	int n,a=0;
	scanf("%d\n",&n);
	for (int i=1;i<=n;i++){
		int x;
		scanf("%d",&x);
		cnt[x]++;
		if (x>a) a=x;
	}
	if ((cnt[a]+cnt[a-1]==n&&cnt[a-1]<a&&(a-cnt[a-1])*2<=cnt[a])
		||(cnt[a]==n && a==n-1)) printf("Yes\n");
		else printf("No\n");
}

Measured memory_bytes: 512
n,m = list(map(int,input().strip().split()))
p = 10**9+7

if abs(n-m) > 1:
  print(0)
  exit()

result = 1
for i in range(1,n+1):
  result = (result *i) % p
for j in range(1,m+1):
  result = (result *j)  % p
  
if n == m:
  result = (result *2) % p

print(result)  

  

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define int			long long
#define ll 			long long
#define pb          push_back
#define	endl		'\n'
#define pii         pair<int,int>
#define vi          vector<int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (int)x.size()
#define hell        1000000007
#define rep(i,a,b)	for(int i=a;i<b;i++)
#define dep(i,a,b)	for(int i=a;i>=b;i--)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
using namespace std;
 
#define N  10005
ll d;
ll a[N];
ll n;
ll dp[N][2][105];
 
ll calc(ll pos, ll f, ll mod){
	if(pos==n){
		return mod==0;
	}
	if(dp[pos][f][mod]!=-1)return dp[pos][f][mod];
	ll ret=0;
	ll mx=9;
	if(f==0)mx=a[pos];
	rep(i,0,mx+1){
		bool nf=f;
      	if(i<a[pos]){
          nf=1;
        }
		ret=(ret+calc(pos+1,nf,(mod+i)%d))%hell;
	}
	return dp[pos][f][mod]=ret;
}
 
 
void solve()
{
	string s;
	cin>>s;
	cin>>d;
	n=sz(s);
	rep(i,0,n)a[i]=s[i]-'0';
 	rep(i,0,N){
    	rep(j,0,2){
        	rep(k,0,105){
            	dp[i][j][k]=-1;
            }
        }	
    }
	cout<<(calc(0,0,0)-1+hell)%hell<<endl;
 
}
 
signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int TESTS=1;
//	cin>>TESTS;
	while(TESTS--)
	{
		solve();
	}
	return 0;
}


Measured memory_bytes: 20956
parseInt(x) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function abmp(a,b,p);if b==0;1;elseif b%2==0;k=abmp(a,div(b,2),p);(k*k)%p;else;(a*abmp(a,b-1,p))%p;end;end;;
function binarr(n,p);z=1;for i in 1:n;z=z*i%p;end;fac=Array{Int}(n+1);inv=Array{Int}(n+1);inv[n+1]=abmp(z,p-2,p)
for i in 0:n-1;inv[n-i]=(inv[n+1-i]*(n-i))%p;end;for i in 0:n;fac[i+1]=(((z*inv[i+1])%p)*inv[n+1-i])%p;end;fac;end;

function main()
	p = 10^9+7
	n,k = readline() |> split |> parseMap
	ba = binarr(n,p)
	bb = binarr(n-1,p)
	if k==1
		println(ba[2]*bb[2]%p)
	else
		s = 0
		for i in 1:min(k+1,n)
			s = (s+ba[i]*bb[i]%p)%p
		end
		println(s)
	end
end

main()

Measured memory_bytes: 166728
m=10**9+7;f=max;r=range
for _ in r(int(input())):
	x,y=sorted(map(int,input().split()));s=-1;i=j=1
	while j<=x and i+j<=y:i,j,s=j,i+j,s+1
	if x<2 or y<3:print(1,x*y%m);continue
	a=f(0,(y-j)//i+1)+f(0,(x-j)//i+1);i=j=1
	for c in r(s):
		k,l=j,i+j*2
		for _ in r(s-c):k,l=l,k+l
		a+=(y>=k)*f(0,(x-l)//k+1)+(x>=k)*f(0,(y-l)//k+1)
		i,j=j,i+j
	print(s+1,a%m)

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

using namespace std;
typedef long long ll;

#define MOD (long long)(1e9+7)
#define REP(i,n) for(ll i = 0; i < n; i++)
#define REP1(i,n) for(ll i = 1; i <= n; i++)

ll count(ll a, ll b)
{
  ll mi = 0, mx = 0;
  mi = b * (b - 1) / 2;
  mx = (a - b + 1 + a) * b / 2;
  
  return (mx - mi + 1) % MOD;

  
}


int main(void)
{
  ll n, k;
  cin >> n >> k;
  ll sum = 0;
  for(ll i = k; i <= n + 1; i++) {
    sum += count(n, i);
    sum %= MOD;
  }
  cout << sum << endl;

}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,a,b;
  cin>>n>>a>>b;
  long long v[50];
  for(int i=0;i<n;i++){
    cin>>v[i];
  }
  sort(v,v+n);
  double ans=0;
  for(int i=0;i<a;i++){
    ans+=v[n-1-i];
  }
  ans/=a;
  long long tmp=v[n-a];
  int cnt1=0;
  int cnt2=0;
  for(int i=0;i<n;i++){
    if(v[n-1-i]==tmp){
      cnt1++;
      if(i<a)cnt2++;
    } 
  }
  // cout<<cnt1<<" "<<cnt2<<endl;
  printf("%lf\n",ans);
  long long k=1;
  for(long long i=0;i<cnt2;i++)k*=cnt1-i,k/=i+1;
  if(a==cnt2){
    for(int i=a+1;i<=b;i++){
      //cout<<k<<endl;
      long long tk=1;
      for(long long j=0;j<i;j++)tk*=cnt1-j,tk/=j+1;
      k+=tk;
    }
  }
  cout<<k<<endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        HashMap<String,Integer> blue = new HashMap<>();
        HashMap<String,Integer> red = new HashMap<>();
        HashSet<String> items = new HashSet<>();
        int n = sc.nextInt();
        for(int i = 0; i < n; i++){
            String s = sc.next();
            if(blue.containsKey(s)){
                blue.put(s,blue.get(s)+1);
            }else{
                blue.put(s,1);
                items.add(s);
            }
        }
        int m = sc.nextInt();
        for(int i = 0; i < m; i++){
            String s = sc.next();
            if(red.containsKey(s)){
                red.put(s,red.get(s)+1);
            }else{
                red.put(s,1);
                items.add(s);
            }
        }
        int ans = 0;
        for(String i: items){
            int b = blue.containsKey(i) ? blue.get(i) : 0;
            int r = red.containsKey(i) ? red.get(i) : 0;
            ans = Math.max(ans,b-r);
        }
        System.out.println(ans >= 0 ? ans : 0);
    }
}


Measured memory_bytes: 20564
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e12;

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, 0, n){
        cin >> a[i];
    }
    vector<int> b = a;
    sort(all(b));
    int l = b[n / 2 - 1];
    int r = b[n / 2];
    rep(i, 0, n){
        if(a[i] <= l){
            cout << r << endl;
        }else{
            cout << l << endl;
        }
    }
}

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

int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  bool turn = true;
  while(a > 0 && c > 0) {
    if(turn) c -= b;
    else a -= d;
    turn = !turn;
  }
  if(turn) cout << "No" << endl;
  else cout << "Yes" << endl;
}


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

using namespace std;

typedef long long int ll;

#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const ll INF = 1e9;
const ll MAXN = 1e9;

int main()
{
    ll a,b,c;
    cin >> a >> b >> c;
    if(a+b<c){
        cout << a+b+b + 1 << endl;
    }else cout << b+c << endl;

    return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
# template: v1.3.1

import io
import sys
import math

### DEBUG ###
_DEB = 0   # 1:ON / 0:OFF

_INPUT = """\
3 0
0 0
0 0
1 1
"""
_EXPECTED = """\
2
"""
if _DEB:
    sys.stdin = io.StringIO(_INPUT)
    print("!! Debug Mode !!")

def logd(str):
    if _DEB: print(f"[deb] {str}")


### INPUT ####
n,d = map(int, input().split())



### Solve ####
def solve():
    # Process
    cnt=0
    for i in range(n):
        x,y = map(int, input().split())
        if math.sqrt(x**2+y**2) <= d:
            cnt+=1

    # OUPUT
    ans = str(cnt)
    print(ans)
    return ans

### MAIN ###
if __name__ == "__main__":
    ans = solve()

    # Checker
    if _DEB:
        if _EXPECTED.strip() == ans.strip(): print("\n!! Success !!")
        else: print(f"\n!! Failed... !!\nANSWER:   {ans}\nExpected: {_EXPECTED}")

Measured memory_bytes: 9188
#include <iostream>
#include <cmath>
#include <algorithm>

using namespace std;

int main() {
	double W, H, D, a, b, r, ab;

	while (cin >> W >> H >> D) {
		int n;
		if (W == 0 && H == 0 && D == 0) break;

		a = min(min(W, H), D);
		b = min(max(W, H), D);

		ab = a*a + b*b;

		cin >> n;
		for (int i = 0; i < n; i++) {
			cin >> r;

			r = (r * 2) * (r * 2);

			if (ab < r)
				cout << "OK" << endl;
			else
				cout << "NA" << endl;
		}
	}
}

Measured memory_bytes: 1220
#include <iostream>
#include <math.h>
#include <ctype.h>
#include <string.h>

using namespace std;

int main() {

    int k,a,b;
    cin>>k>>a>>b;

    int rem = a % k;

    if(rem == 0) {
        cout<< "OK";
    }
    else {

    rem = k - rem;

    if(rem + a <= b) {
        cout<< "OK";
    }
        else {
        cout<<"NG";
    }
    
    }

}



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

#define rep(i,m,n) for(int (i)=(int)(m);i<(int)(n);++i)
#define rep2(i,m,n) for(int (i)=(int)(n)-1;i>=(int)(m);--i)
#define REP(i,n) rep(i,0,n)
#define REP2(i,n) rep2(i,0,n)
#define FOR(i,c) for(decltype((c).begin())i=(c).begin();i!=(c).end();++i)
#define all(hoge) (hoge).begin(),(hoge).end()
#define en '\n'
using ll = long long;
using ull = unsigned long long;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;
typedef pair<ll, ll> P;
constexpr long long INF = 1LL << 60;
constexpr int INF_INT = 1 << 25;
constexpr long long MOD = (ll) 1e9 + 7;
//constexpr long long MOD = 998244353LL;
using ld=long double;
static const ld pi = 3.141592653589793L;
typedef vector<ll> Array;
typedef vector<Array> Matrix;


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

struct Edge {
	ll to, rev;
    long double cap;
	Edge(ll _to, long double _cap, ll _rev) {
	to = _to; cap = _cap; rev = _rev;
	}
};
using Edges = vector<Edge>;
using Graph = vector<Edges>;

void add_edge(Graph& G, ll from, ll to, long double cap, bool revFlag, long double revCap) {
	G[from].push_back(Edge(to, cap, (ll)G[to].size()));
	if (revFlag)G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}

void solve(){
	ll n;
	cin>>n;
	Array a(n);
	REP(i,n) cin>>a[i];
	ll max_a=1010101;
	Array con(max_a,0);
	REP(i,n) con[a[i]]++;
	for(ll i=1;i*2<max_a;i++){
		if(con[i]==0) continue;
		for(ll j=2;i*j<max_a;j++){
			con[i*j]=0;
		}
	}
	int ans=0;
	REP(i,max_a){
		if(con[i]==1) ans++;
	}
	cout<<ans<<en;
}

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

	solve();
	//ll t;cin>>t;REP(i,t) solve();

    return 0;
}


Measured memory_bytes: 12716