akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define vi vector<int>
#define pi pair<int, int>
#define pb push_back
#define fr first
#define sc second
#define endl '\n'

const int mxn = 1e6 + 5;
int arr[mxn];
int n, m, k;

void solve(){
    sort(arr, arr + n);
    int sum = 0;
    for(int i = 0; i < n; i++) sum += arr[i];
    double foo = (double) sum / (double) (4 * m);
    if((double) arr[n - m] >= foo){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

void read(){
    cin >> n >> m;
    for(int i = 0, u, v; i < n; i++){
        cin >> arr[i];
    }
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    int T = 1;
    //cin >> T;
    //init();
    while(T--) read(), solve();
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <ctype.h>
char alpha[26] = {'a','b','c','d','e','f','g','h','i','j','k','l','m',
		  'n','o','p','q','r','s','t','u','v','w','x','y','z'};
int  a_num[26];

int main(){
  char x;
  int i;

  while(scanf("%c", &x) != EOF){
    x = tolower(x);
      for(i=0; i<26; i++)
	if(x == alpha[i])
	  a_num[i]++;
  }
  
  for(i=0; i<26; i++)
    printf("%c : %d\n", alpha[i], a_num[i]);

  return 0;
}

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

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;

using namespace std;
map< int64_t, int > prime_factor(int64_t n);

int inputValue(){
    int a;
    cin >> a;
    return a;
};

void inputArray(int * p, int a){
    rep(i, a){
        cin >> p[i];
    }
};

void inputVector(vector<int> * p, int a){
    rep(i, a){
        int input;
        cin >> input;
        p -> push_back(input);
    }
}

template <typename T>
void output(T a, int precision) {
    if(precision > 0){
        cout << setprecision(precision)  << a << "\n";
    }
    else{
        cout << a << "\n";
    }
}

int main(int argc, const char * argv[]) {
    
    // source code
  int64_t a;
  int64_t b;
  cin >> a;
  cin >> b;
  
  map<int64_t,int> pa;
  map<int64_t,int> pb;
  pa = prime_factor(a);
  pb = prime_factor(b);
  int count = 1;
  for(auto i = pa.begin();i != pa.end();++i)
  {
    decltype(pb)::iterator it = pb.find(i->first);
    if(it != pb.end())
    {
      count++;
    }
  }
  cout << count;
  return 0;
}

map< int64_t, int > prime_factor(int64_t n) {
  map< int64_t, int > ret;
  for(int64_t i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1;
  return ret;
}



Measured memory_bytes: 256
n, m = map(int, input().split(' '))
a = list(map(int, input().split(' ')))

d = {0: 1}
asum = 0
for aa in a:
    asum = (asum + aa) % m
    if asum in d:
        d[asum] += 1
    else:
        d[asum] = 1


ans = 0
for v in d.values():
    ans += int(v * (v - 1) / 2)

print(ans)

Measured memory_bytes: 14252
#include<stdio.h>
int main(){
  int h,w,i,j,a,b,c=3;
  char s[20][20]={};
  scanf("%d %d",&h,&w);
  for(i=0;i<h;i++)scanf("%s",s[i+1]+1);
  for(i=1;i<=h;i++){
    for(j=1;j<=w;j++){
      if(i==1&&j==1||i==h&&j==w)continue;
      if(s[i][j]=='.')continue;
      a=b=0;
      if(s[i+1][j]=='#')a++;
      if(s[i][j+1]=='#')a++;
      if(s[i-1][j]=='#')b++;
      if(s[i][j-1]=='#')b++;
      c+=a;
      if(a-1||b-1){
	printf("Impossible\n");
	goto END;
      }
    }
  }
  printf("%s\n",c==h+w?"Possible":"Impossible");
 END:;
  return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
 
///for ordered set///
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/trie_policy.hpp>
///for ordered set///
 
using namespace std;
 
///for ordered set///
//using namespace __gnu_pbds;
//typedef tree< long long int , null_type, less_equal<long long int>, rb_tree_tag,tree_order_statistics_node_update> ordered_set;
///for ordered set///
 
///Compiler Optimizer///
//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
///Compiler Optimizer///
 
typedef long long           ll;
typedef unsigned long long  ull;
 
#define sf                  scanf
#define pf                  printf
#define pb                  push_back
#define ppb                 pop_back
#define MP                  make_pair
#define PF                  first
#define PS                  second
#define si(n)               scanf("%d",&n)
#define sii(x,y)            scanf("%d %d",&x,&y)
#define siii(x,y,z)         scanf("%d %d %d",&x,&y,&z)
#define sl(n)               scanf("%lld",&n)
#define sll(x,y)            scanf("%lld %lld",&x,&y)
#define slll(x,y,z)         scanf("%lld %lld %lld",&x,&y,&z)
#define FOR(i,x,y)          for(int i=x;i<y;i++)
#define RFOR(i,x,y)         for(int i=x;i>=y;i--)
#define CLR(arr,val)        memset(arr,val,sizeof arr);
#define vout(v)             for(int ind=0;ind<v.size();ind++){ cout<<v[ind]; if(ind<v.size()-1) cout<<' '; else cout<<endl;}
#define TCL(test,t)         for(test=1;test<=t;test++)
#define READ()              freopen("input.txt", "r", stdin)
#define WRITE()             freopen("output.txt", "w", stdout)
#define fastIO()            {ios_base::sync_with_stdio(false); cin.tie(NULL);}
#define MAXN                1000006
#define MAXP                1000006
#define MOD                 1000000007
#define PI                  acos(-1)

int arr[1005][1005];

int main(){
    #ifdef ELDUIVEL
        clock_t tStart = clock();
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    int a,c,b;
    cin>>a>>b>>c;
    swap(a,b);
    swap(a,c);
    cout<<a<<' '<<b<<' '<<c<<endl;
    #ifdef ELDUIVEL
        fprintf(stderr, "\n>> Runtime: %.10fs\n", (double) (clock() - tStart) / CLOCKS_PER_SEC);
    #endif
    return 0;
}


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

// 頂点s+1から出発する場合の幅優先探索
void bfs(int s, int n, vector<vector<int>>& M, vector<int>& d) {
    static const int INFTY = (1 << 21);

    // 今回は標準ライブラリのキューを使う
    queue<int> q;

    // 各種初期化処理
    // 出発する頂点をpush
    q.push(s);
    // 距離格納配列の初期化
    for (int i = 0; i < n; i++) {
        d[i] = INFTY;
    }
    // 出発点の距離は0
    d[s] = 0;

    // 探索開始
    int u;
    while (!q.empty()) {
        // 先頭を取り出してpopする(訪問)
        u = q.front();
        q.pop();

        // 隣接する訪問可能な頂点をpushする
        for (int v = 0; v < n; v++) {
            if (M[u][v] == 0) continue; //訪問不可
            if (d[v] != INFTY) continue; //訪問済み

            d[v] = d[u] + 1; //今回リンクのコストは1固定
            q.push(v);
        }
    }

    // 頂点1から各頂点までの距離を出力
    // INFTYが入っていた場合は到達不可能なので-1を出力
    for (int i = 0; i < n; i++) {
        cout << i + 1 << " " << ((d[i] == INFTY) ? (-1) : d[i]) << endl;
    }
}


int main() {
    static const int N = 110;
    // n : グラフの頂点数
    // M : 隣接行列(グラフを表現)
    // d : 任意の頂点から各頂点への距離格納配列(INFTYで初期化)
    int n, u, k, v;
    vector<int> d(N);
    vector<vector<int>> M(N, vector<int>(N));

    cin >> n;

    // グラフの初期化
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            M[i][j] = 0;
        }
    }
    // グラフの入力
    for (int i = 0; i < n; i++) {
        cin >> u >> k;
        u--;
        for (int j = 0; j < k; j++) {
            cin >> v;
            v--;
            M[u][v] = 1;
        }
    }

    bfs(0, n, M, d);

    return 0;
}


Measured memory_bytes: 3172
i = int(input())

h = 0
m = 0

if i/3600 >= 1:
    h = int(i/3600)
    i = i - 3600 * h
if i/60 >= 1:
    m = int(i/60)
    i = i - 60 * m
    
s = str(h) + ":" + str(m) + ":" + str(i)

print(s)


Measured memory_bytes: 5596
#include<iostream>
#include<string>

using namespace std;

int main() {
	// the, this, thatの後はスペースと仮定する
	const string str_the("the "), str_this("this "), str_that("that ");
	string line;
	while (getline(cin, line)) {
		while (true) {
			auto result_the = line.find(str_the, 0);
			auto result_this = line.find(str_this, 0);
			auto result_that = line.find(str_that, 0);
			if (string::npos != result_the || string::npos != result_this
				|| string::npos != result_that) {
				break;
			}
			for (auto& x : line){
				char result;
				if (x >= 'a' && x < 'z') {
					++x;
				}
				else if (x == 'z') {
					x = 'a';
				}
			}
		}

		cout << line << endl;
	}
	return 0;
}

Measured memory_bytes: 1184
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define invrepr(i,a,b) for(int i=b-1;i>=a;i--)
#define invrep(i,n) invrepr(i,0,n)
#define repitr(itr,a) for(auto itr=a.begin();itr!=a.end();++itr)
const int MOD=1e9+7;


int main() {
    ios_base::sync_with_stdio(false);

    ll x;
    cin >> x;
    ll ans=0;
    ll cnt=0;
    repr(i,1,x+1) {
        cnt+=i;
        if (x<=cnt) {
            ans=i;
            break;
        }
    }
    cout << ans << endl;

    return 0;   
}


Measured memory_bytes: 384
N = int(input())
K = []
for i in range(N):
    X,L = map(int,input().split())
    K.append([X-L,X+L])

T = sorted(K,key=lambda x:x[1])
a = T[0][1]

c = 1
for i in range(1,N):
    if T[i][0] >= a:
        c += 1
        a = T[i][1]
print(c)

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

typedef long long ll;
typedef pair<int,int> pii;

long long MOD = 10000000000 + 7;

int main(){
  cout << setprecision(10);
  int H, W;
  cin >> H >> W;
  vector<vector<int>> v(H,vector<int>(W,0));
  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){
      cin >> v.at(i).at(j);
    }
  }

  int x = 0; // たて
  int y = 0; // よこ
  int step = 0;
  int stock = 0;

  int nx;
  int ny;
  vector<pair<int,int>> before;
  vector<pair<int,int>> after;

  while(step < H*W-1){
    // 処理
    // cerr << x << " " << y << endl;
    // 奇数ならピック
    if(v.at(x).at(y) % 2 == 1 && stock == 0){
      stock++;
      //cout << x+1 << " " << y+1 << " "; 
      before.push_back(make_pair(x+1,y+1));
    } 

    // 次
    if(x % 2 == 0){
      if(y == W-1){
        nx = x + 1;
        ny = y;
      } else { 
        nx = x;
        ny = y + 1;
      }
    } else { 
      if(y == 0){
        nx = x + 1;
        ny = y;
      } else { 
        nx = x;
        ny = y - 1;
      }
    }

    x = nx;
    y = ny;
    if(stock > 0){
      // cout << nx+1 << " " << ny+1 << endl;
      after.push_back(make_pair(nx+1,ny+1));
      v.at(nx).at(ny) += 1;
      stock = 0;
    }
    step++;
  }

  cout << before.size() << endl;
  for(int i = 0; i < before.size(); i++){
    cout << before[i].first << " " << before[i].second << " ";
    cout << after[i].first << " "  << after[i].second << endl;
  }

}


Measured memory_bytes: 5228
#include <stdio.h>
#include <algorithm>
#include <vector>

const int kN = 100 + 5;
int a[kN][kN];
int cnt[26];

bool solve(int w2, int w4)
{
    std::vector<int> x(cnt, cnt + 26);
    for (int i = 0; i < 26; ++ i) {
        int tmp = std::min(x[i] / 4, w4);
        w4 -= tmp;
        x[i] -= tmp * 4;
    }
    for (int i = 0; i < 26; ++ i) {
        int tmp = std::min(x[i] / 2, w2);
        w2 -= tmp;
        x[i] -= tmp * 2;
    }
    return !w2 && !w4;
}

int main()
{
    int n, m;
    scanf("%d%d", &n, &m);
    for (int i = 0; i < n; ++ i) {
        char s[100 + 5];
        scanf("%s", s);
        for (int j  = 0; j < m; ++ j)
            cnt[s[j] - 'a'] ++;
    }
    for (int i = 1; i <= n; ++ i) {
        for (int j = 1; j <= m; ++ j) {
            a[std::min(i, n - i + 1)][std::min(j, m - j + 1)] ++;
        }
    }
    int w[5] = {};
    for (int i = 1; i <= n; ++ i) {
        for (int j = 1; j <= m; ++ j)
            if (a[i][j])
                w[a[i][j]] ++;
    }
    if (w[1]) {
        for (int i = 0; i < 26; ++ i) if (cnt[i]) {
            -- cnt[i];
            if (solve(w[2], w[4]))
                return puts("Yes"), 0;
            ++ cnt[i];
        }
    } else {
        if (solve(w[2], w[4]))
            return puts("Yes"), 0;
    }
    puts("No");
}

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

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

    vector<int> v;
    if (N==0){
        v.push_back(0);
    }

    while (N!=0){
    int t = N%(-2);
    if (t==-1){
        t+=2;
        v.push_back(t);
        N=N/(-2)+1;
    }
    else {
        v.push_back(t);
        N=N/(-2);
        }
    }

    for (int i=v.size()-1;i>=0;i--){
        cout << v[i];
    }
    cout << endl;
}

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

using namespace std;

typedef long long LL;
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)

int solve(int p, int q, int k, vector<vector<int>> &V){
	int ret = (k<0?1:0);
	for(auto u : V[q]) if(p != u){
		ret += solve(q,u,k-1,V);
	}
	return ret;
}

int main(){
	int N,K; cin >> N >> K;
	vector<vector<int>> V(N);
	repp(i,1,N){
		int A,B; cin >> A >> B;
		--A; --B;
		V[A].push_back(B);
		V[B].push_back(A);
	}
	int ans = N;
	if(K%2==1){
		repp(i,0,N) for(auto u : V[i]) if(i < u) ans = min(ans,solve(u,i,K/2,V)+solve(i,u,K/2,V));
	} else {
		repp(i,0,N) ans = min(ans,solve(-1,i,K/2,V));
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin>>N;
  
  int sw;
  
  if(N%1000==0){
    sw=0;
  }else{
    sw=1000-N%1000;
  }
  
  cout<<sw<<endl;
}


Measured memory_bytes: 3632
#define MAX 200100;
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

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

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

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


Measured memory_bytes: 256
#coding:utf-8
import sys
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = lambda *something : print(*something) if DEBUG else 0
DEBUG = False
def main(given = sys.stdin.readline):
    from math import floor
    input = lambda : given().rstrip()
    LMIIS = lambda : list(map(int,input().split()))
    II = lambda : int(input())
    XLMIIS = lambda x : [LMIIS() for _ in range(x)]

    N,K = LMIIS()
    A = LMIIS()
    F = LMIIS()


    F.sort()    
    A.sort(reverse=True)


    def f(x):
        sum_diff = 0
        for a,f in zip(A,F):
            if a*f-x > 0:
                sum_diff += a-x//f
        return True if sum_diff <= K else False
    l = -1
    r = 10**13
    while r-l>1:

        m = (l+r)//2
        if f(m):
            r = m
        else:
            l = m
    print(r)











if __name__ == '__main__':
    main()

Measured memory_bytes: 113708
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPS(I, a, b) for (int i = (a); i < (b); ++i)
using namespace std;
using ll = long long;

int main() {
  string s,t,u; 
  cin >> s >> t;
  int a,b;
  cin >> a >> b;
  cin >> u;
  
  if(s == u) a--;
  else if(t == u) b--;
  
  cout << a << " " << b << endl;

  
  
}

Measured memory_bytes: 3528
from copy import deepcopy
from sys import exit,setrecursionlimit
import math
from collections import defaultdict,Counter,deque
from fractions import Fraction as frac

setrecursionlimit(1000000)


def main():
	a,b,c = map(int,input().split())
	if(a<=c and c<=b):
		print('Yes')
	else:
		print('No')

def zip(a):
	mae = a[0]
	ziparray = [mae]
	for i in range(1,len(a)):
		if(mae != a[i]):
			ziparray.append(a[i])
			mae = a[i]
	return ziparray

def is_prime(n):
	if n < 2: return False

	for k in range(2, int(math.sqrt(n)) + 1):
		if n % k == 0:
			return False

	return True

def list_replace(n,f,t):
	return [t if i==f else i for i in n]

def base_10_to_n(X, n):
	X_dumy = X
	out = ''
	while X_dumy>0:
		out = str(X_dumy%n)+out
		X_dumy = int(X_dumy/n)
	if(out == ''): return '0'
	return out

def gcd(l):
	x = l.pop()
	y = l.pop()
	while(x%y!=0):
		z = x%y
		x = y
		y = z
	l.append(min(x,y))
	return gcd(l) if len(l) > 1 else l[0]

class Queue():
	def __init__(self):
		self.q = deque([])
	def push(self,i):
		self.q.append(i)
	def pop(self):
		return self.q.popleft()
	def size(self):
		return len(self.q)
	def debug(self):
		return self.q

class Stack():
	def __init__(self):
		self.q = []
	def push(self,i):
		self.q.append(i)
	def pop(self):
		return self.q.pop()
	def size(self):
		return len(self.q)
	def debug(self):
		return self.q

class graph():
	def __init__(self):
		self.graph = defaultdict(list)
	def addnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].append(t)
		self.graph[t].append(f)
	def rmnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].remove(t)
		self.graph[t].remove(f)
	def linked(self,f):
		return self.graph[f]

class dgraph():
	def __init__(self):
		self.graph = defaultdict(set)
	def addnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].append(t)
	def rmnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].remove(t)
	def linked(self,f):
		return self.graph[f]

main()


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

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define BIT(x,n) bitset<n>(x)
#define PI 3.14159265358979323846

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

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

int n;
ll x[200010],s[200010];

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

	cin>>n;
	REP(i,n) {
		cin>>x[i]>>s[i+1];
		s[i+1]+=s[i];
	}
	ll mi=LINF,ans=0;
	REP(i,n) {
		mi=min(mi,s[i]-x[i]);
		ans=max(ans,s[i+1]-x[i]-mi);
	}
	cout<<ans<<endl;

	return 0;
}


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

int main()
{
    int N, M;
    cin >> N >> M;
    int a, b;
    vector<vector<int>> worksDayReward(10e5 + 1);
    priority_queue<int> rewardQueue;
    for(int i = 0; i < N; i++){
        int a, b;
        cin >> a >> b;
        worksDayReward.at(a).push_back(b);
    }
    int answer = 0;
    for(int i = 1; i <= M; i++){
        for(int reward : worksDayReward.at(i)){
            rewardQueue.push(reward);
        }
        if(rewardQueue.size() == 0){
            continue;
        }
        answer += rewardQueue.top();
        rewardQueue.pop();
    }
    cout << answer << endl;
    return 0;
}

Measured memory_bytes: 26752
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
char s[10];
int main() {
	scanf("%s",s+1);
	int len=strlen(s+1),cck=false;
	if (len>1&&s[1]=='A'&&s[2]=='C') cck=true;
	if (len>2&&s[2]=='A'&&s[3]=='C') cck=true;
	if (len>3&&s[3]=='A'&&s[4]=='C') cck=true;
	if (len>4&&s[4]=='A'&&s[5]=='C') cck=true;
	puts(cck?"Yes":"No");
	return 0;
}

Measured memory_bytes: 256
N, A, B = map(int, input().split())
S = input()

for s in S:
    if s == 'a':
        if A > 0:
            print('Yes')
            A -= 1
        elif B > 0:
            print('Yes')
            B -= 1
        else:
            print('No')
    elif s == 'b':
        if B > 0:
            print('Yes')
            B -= 1
        else:
            print('No')
    else:
        print('No')


Measured memory_bytes: 4016
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
  int h,n;
  cin >> h >> n;
  int a[1000],b[1000];
  for (int i = 0; i < n; ++i)
  {
    cin >> a[i] >> b[i];
  }
  int dp[10001];
  memset(dp,0x3F,sizeof(dp));
  dp[0]=0;
  for (int i = 0; i < n; ++i)
  {
    for(int j=0;j<h;j++) {
      dp[min(a[i]+j,h)] = min(dp[min(a[i]+j,h)], dp[j]+b[i]);
    }
  }
  cout << dp[h];}

Measured memory_bytes: 256
while gets
  month,day = $_.chomp.split.map {|x| x.to_i}
  break if month == 0 && day == 0
  from_shougatu = day
  month -= 1
  while month > 0
    case month
    when 1,3,5,7,8,10,12
      from_shougatu += 31
    when 4,6,9,11
      from_shougatu += 30
    when 2
      from_shougatu += 29
    end
    month -= 1
  end
  which_day = ["Wednesday","Thursday","Friday","Saturday","Sunday","Monday","Tuesday"]
  puts which_day[from_shougatu%7]
end

Measured memory_bytes: 6104
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
  ll s, c;
  cin >> s >> c;

  if (2 * s <= c) {
    // cout << "aaa" << endl;
    cout << s + (c - 2 * s) / 4 << endl;
  } else {
    cout << c / 2 << endl;
  }
}

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

int ri() {
    int n;
    cin >> n;
    return n;
}


int main()
{
    int S,W;
    S = ri();
    W = ri();

    if (S <= W) {
        cout << "unsafe";
    }
    else {
        cout << "safe";
    }



    return 0;
}

Measured memory_bytes: 3624
import java.util.Scanner;

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

	String a = scan.next();
	String b = scan.next();

	if(a.charAt(0) == 'H'){
	    if(b.charAt(0) == 'H'){
		System.out.println("H");
	    }else{
		System.out.println("D");
	    }
	}else{
	    if(b.charAt(0) == 'D'){
		System.out.println("H");
	    }else{
		System.out.println("D");
	    }
	}
    }
}


Measured memory_bytes: 23252
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0; (i)<(n); (i)++)
#define each(i, c) for (auto& (i) : (c))

using namespace std;
typedef long long int lli;
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ","; os << ")"; return os; }

int main() {
    int n;
    cin >> n;
    if (n == 1) {
        cout << "Hello World" << endl;
    } else {
        int a, b;
        cin >> a >> b;
        cout << a+b << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>
#include <queue>
#include <tuple>
#include <cmath>
#include <bitset>
#include <cctype>
#include <set>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<typename T>
vector<T> table(int n, T v) { return vector<T>(n, v); }

template <class... Args>
auto table(int n, Args... args) {
    auto val = table(args...);
    return vector<decltype(val)>(n, move(val));
}
const ll INF = 1e17;
const ll MOD = 1000000007;
typedef pair<ll,ll> P;
const ll MAX = 200005;
bool kai(string s){
    bool res = 1;
    rep(i,s.length()/2){
        if (s[i] != s[s.length()-i-1]) res = 0;
    }
    return res;
}
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s,t = "",u = "";
    cin >> s;
    int n = s.length();
    rep(i,n){
        if (i <= (n-1)/2-1) t += s[i];
        if (i >= (n+3)/2-1) u += s[i];
    }
    if(kai(s) && kai(t) && kai(u)) PRINT("Yes");
    else PRINT("No");
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second

const int mx=200010;
const ll mod=1e9+7;

 
int main(){
  int h,w;
  cin >> h >> w;
  vector<vector<int>> c(10, vector<int>(10));
  rep(i,10)rep(j,10) cin >>c[i][j];
  rep(k,10)rep(i,10)rep(j,10) c[i][j] = min(c[i][j], c[i][k]+c[k][j]);

  int ans=0;
  rep(i,h)rep(j,w){
    int a; cin >> a;
    if(a==-1) continue;
    ans += c[a][1];
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <set>

using namespace std;
int main() {
	long long x;
	cin >> x;
	long long a = 100;
	int cnt = 0;
	while (x > a){
		cnt++;
		a += (long double)a * 0.01;
	}

	cout << cnt << endl;
}


Measured memory_bytes: 3564
n,h=map(int,input().split())
p=[]
for i in range(n):
    a,b=map(int,input().split())
    p.append([a,0])
    p.append([b,1])

p=sorted(p,key=lambda x:-x[0])

i=0
ans=0
while h>0:
    if p[i][1]==1:
        h-=p[i][0]
        ans+=1
        i+=1
    else:
        ans-=(-h//p[i][0])
        break

print(ans)

Measured memory_bytes: 40876
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

int main() {
	int a, b;

	scanf("%d %d", &a, &b);

	if (a >= -1000 && b <= 1000) {
		
		if (a == b) {
			printf("a == b\n");
		}
		else if (a > b) {
			printf("a > b\n");
		}
		else {
			printf("a < b\n");
		}
	}
	return 0;
}

Measured memory_bytes: 2576
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>

#define endl '\n'
#define fi first
#define se second
#define pb push_back
#define debug(x) cout << "[debug] " << #x << ": " << x << endl
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
const int MOD = 1e9 + 7;
const int maxn = 1e6 + 5;
const int inf = 0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-8;

int main() {
    int a, b; cin >> a >> b;
    int ans = -1;
    if(a >= 1 && a <= 9 && b >= 1 && b <= 9)
       ans = a * b;
    cout << ans << endl; 
	return 0;
}


Measured memory_bytes: 256
from itertools import accumulate
S=input()
l=len(S)
mod=998244353
R_cnt,B_cnt=[],[]
for i in S:
    R_cnt.append(2-int(i))
    B_cnt.append(int(i))
R_acc=[0]+list(accumulate(R_cnt))
R_acc+=[R_acc[-1]]*l
B_acc=[0]+list(accumulate(B_cnt))
B_acc+=[B_acc[-1]]*l
DP=[[0]*(2*l+1) for _ in range(2*l+1)]
DP[0][0]=1
for i in range(2*l):
    for r in range(i+1):
        if R_acc[i+1]>=r+1:
            DP[i+1][r+1]+=DP[i][r]
            DP[i+1][r+1]%=mod
        if B_acc[i+1]>=i+1-r:
            DP[i+1][r]+=DP[i][r]
            DP[i+1][r]%=mod
print(max(DP[-1]))

Measured memory_bytes: 166492
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Linq;

namespace contest_Csharp
{
    class Program
    {
        

        static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            var vals = Console.ReadLine().Split(' ').
                Select(x => long.Parse(x)).ToList();

            var N = vals[0];

            var A = Console.ReadLine().Split(' ').
                Select(x => long.Parse(x)).ToList();
            var NA = new List<long>(new long[N]);

            long divisor = 1;
            for (int i = 0; divisor <= (long)1e9+1; i++)
            {
                divisor *= 2;
                long flg = (A.Sum(x => (x >> i)%2)) % 2;
                for (int k = 0; k < N; k++)
                {
                    NA[k] += (divisor / 2)*((flg%2==0)? (A[k]>>i)%2 : 1- (A[k] >> i) % 2);
                }
                
            }
            foreach(long n in NA)
            {
                Console.WriteLine(n);
            }

            //Console.WriteLine();
            Console.Out.Flush();
        }




    }
}




Measured memory_bytes: 56292
#include <cstdio>
#include <vector>
using namespace std;

int n, m;
int a[100010];
vector<vector<int> > vi(100010);
vector<vector<int> > vi2(100010);
long long res;
int a1[100010];
int a2[100010];

void solve()
{
	int i, j, k;
	long long sum = 0;
	for(i=0; i<n-1; i++){
		a1[i] = a[i];
		a2[i] = a[i+1];
	}
	for(i=0; i<n-1; i++){
		if(a1[i] < a2[i])
			sum += a2[i] - a1[i];
		else
			sum += a2[i] - a1[i] + m;
	}
	for(i=0; i<n-1; i++){
		vi[a1[i]].push_back(i);
		vi2[a1[i]].push_back(0);
		vi[a2[i]].push_back(i);
		vi2[a2[i]].push_back(1);
	}
	int cnt = 0;
	for(i=0; i<n-1; i++){
		if(a2[i] < a1[i]){
			cnt ++;
			sum -= m-a1[i];
		}
	}
	res = sum;
	for(i=1; i<m; i++){
		for(j=0; j<vi[i].size(); j++){
			if(vi2[i][j] == 0){
				cnt ++;
				sum ++;
			}
			else{
				cnt --;
				k = vi[i][j];
				sum += (a2[k]-a1[k]+m) % m;
				sum --;
			}
		}
		sum -= cnt;
		if(res > sum)
			res = sum;
	}
	printf("%lld\n", res);
}

int main()
{
	int i;
	scanf("%d%d", &n, &m);
	for(i=0; i<n; i++)
		scanf("%d", &a[i]);
	solve();
	return 0;
}

Measured memory_bytes: 10752
#include<cstdio>
#include<vector>
#include<iostream>
#include<queue>
using namespace std;
int n,m,x,y,t,h,d[100001],in[100001],ans;
vector<int>r[100001];
queue<int>q;
int main(){
	scanf("%d%d",&n,&m);
	for(int i=1;i<=m;i++){
		scanf("%d%d",&x,&y);
		r[x].push_back(y);
		in[y]++;
	}
	for(int i=1;i<=n;i++){
		if(in[i]==0)q.push(i);
	}
	while(q.empty()==false){
		t=q.front();
		q.pop();
		for(int i=0;i<r[t].size();i++){
			h=r[t][i];
			in[h]--;
			if(in[h]==0){
				q.push(h);
				d[h]=d[t]+1;
			}
		}
	}
	for(int i=1;i<=n;i++){
		ans=max(ans,d[i]);
	}
	printf("%d",ans);
}

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

namespace _512_Caesar_Cipher
{
	class Program
	{
		static void Main ( string[] args )
		{
			char[] charArray = { 'X', 'Y', 'Z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W' };

			string inputStr = Console.ReadLine ();			

			foreach (var item in inputStr)
			{
				int index = item - 'A';
				Console.Write (charArray[index]);
			}
			Console.WriteLine ();

		}
	}
}

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

#define ll long long
#define deb(x) cerr << #x << ":" << x << "\n"

void solve()
{
    int n,k;
    cin>>n>>k;
    vector<int> v(n);
    for(auto &x:v)cin>>x;
    sort(v.begin(),v.end());
    ll sum=0;
    for(int i=0;i<k;i++){
        sum+=v[i];
    }
    cout<<sum;
}

int main()
{

    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t = 1;
    // cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 3640
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


n = int(input())
a = [None]*(n-1)
from collections import defaultdict
c = defaultdict(list)
for i in range(n-1):
    num = int(input())
    c[num].append(i+2)

def sub(winner):
    l = len(c[winner])
    vs = []
    for p in c[winner]:
        vs.append(sub(p))
    vs.sort()
    ans = max([l] + [(l-i+v) for i,v in enumerate(vs)])
    return ans
ans = sub(1)
print(ans)

Measured memory_bytes: 156072
#include <iostream>
using namespace std;
const long long INF = 1e18;

int main() {
    int n;
    cin >> n;
    bool is_z = false;
    bool is_r = false;
    long long a = 1;
    for (int i=0; i<n; ++i) {
        if (is_z) continue;
        long long num; cin >> num;
        if (num == 0) is_z = true;
        if (is_r) continue;
        if (num > (INF / a) || (a * num) > INF) is_r = true;
        a *= num;
    }
    if (is_z) cout << 0 << endl;
    else if (is_r) cout << -1 << endl;
    else cout << a << endl;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define REP(i, n) for (int i=0, i##_lim=(n); i<i##_lim; ++i)
#define FOR(i, a, b) for (int i=(a), i##_lim=(b); i<i##_lim; ++i)
#define mp make_pair
#define pb push_back
using namespace std;
using ll = long long;
using pi = pair<int, int>;

int main()
{
    int N;
    cin >> N;
    int U[N-1], V[N-1], W[N-1];
    REP(i, N-1) cin >> U[i] >> V[i] >> W[i];

    map<int, vector<pi>> neighbors;
    REP(i, N-1)
    {
        neighbors[U[i]].pb(mp(V[i], W[i]));
        neighbors[V[i]].pb(mp(U[i], W[i]));
    }

    int color[N+1];
    REP(i, N+1) color[i] = -1;
    color[1] = 0;

    stack<int> stk;
    stk.push(1);

    while (!stk.empty())
    {
        int i = stk.top();
        stk.pop();

        for (auto& v : neighbors[i])
        {
            int j = v.first; int w = v.second;
            if (color[j] != -1) continue;

            int c = color[i];
            if (w%2 != 0) c = c == 0 ? 1 : 0;
            color[j] = c;

            stk.push(j);
        }
    }

    FOR (i, 1, N+1)
    {
        cout << color[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 13440
package main

import "fmt"

func solve(n, a, b int) int {
	tr := a * n
	tx := b
	if tr < tx {
		return tr
	} else {
		return tx
	}
}

func main() {
	var n, a, b int
	fmt.Scan(&n)
	fmt.Scan(&a)
	fmt.Scan(&b)
	fmt.Println(solve(n, a, b))
}

Measured memory_bytes: 512
#include<set>
#include<map>
#include<deque>
#include<queue>
#include<stack>
#include<cmath>
#include<ctime>
#include<bitset>
#include<string>
#include<vector>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<complex>
#include<iostream>
#include<algorithm>
#define ll long long
using namespace std;

const int maxn = 52;

ll K,k;
ll a[maxn];

int main()
{
	scanf("%lld",&K); k=K%50ll;
	for(int i=50;i>50-k;i--) a[i]=i;
	for(int i=50-k;i>=1;i--) a[i]=50-k-1;
	k=K/50ll;
	for(int i=1;i<=50;i++) a[i]+=k;
	printf("50\n");
	for(int i=1;i<=50;i++) printf("%lld ",a[i]);
	
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<memory.h>
#include<string> 
#include<vector>
#include<map>
using namespace std;
typedef long long ll;
const int maxn=5e5+10;
int hang[maxn],lie[maxn];

int main()
{
	int h,w,m;scanf("%d%d%d",&h,&w,&m);
	int mxh=0,mxl=0;map<pair<int,int>,int> mp; 
	vector<int> a,b;
	while(m--){
		int hi,wi;scanf("%d%d",&hi,&wi);
		hang[hi]++;lie[wi]++;
		mxh=max(mxh,hang[hi]);
		mxl=max(mxl,lie[wi]);
		mp[make_pair(hi,wi)]=1;
	}
	for(int i=1;i<=h;i++) if(hang[i]==mxh) a.push_back(i);
	for(int i=1;i<=w;i++) if(lie[i]==mxl) b.push_back(i);
	for(int i=0;i<a.size();i++){
		for(int j=0;j<b.size();j++){
			if(mp[make_pair(a[i],b[j])]==0){
				printf("%d",hang[a[i]]+lie[b[j]]);
				exit(0);
			} 
		}
	}
	printf("%d",mxh+mxl-1);
	return 0;	
} 

Measured memory_bytes: 23348
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <iomanip>
using namespace std;

int main() {
	long N, A[5];
	cin >> N;
	for(int i=0; i<5; ++i) cin >> A[i];
	sort(A, A+5);
	cout << (N+A[0]-1)/A[0]+4 << endl;
	return 0;
}


Measured memory_bytes: 256
n = int(input())
score = [0,0]
for _ in range(n):
    tc, hc = input().split()
    if tc == hc:
        score[0] += 1
        score[1] += 1
    elif tc > hc:
        score[0] += 3
    else:
        score[1] += 3
print(*score)


Measured memory_bytes: 5596
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;

namespace atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var nums = Console.ReadLine().Split(' ').Select(num => int.Parse(num)).ToArray();
            var min = int.MaxValue;
            var cnt = 0;
            for (var i = 0; i < nums.Length; i++)
            {
                var num = nums[i];
                if (num <= min)
                {
                    cnt++;
                }

                if (min == 0 || num < min)
                    min = num;
            }

            Console.WriteLine(cnt);
        }
    }
}

Measured memory_bytes: 43052
N = int(input())
X = [0] * N
Y = [0] * N
for i in range(N):
    X[i], Y[i] = map(int,input().split())

MAX = float('-inf')
MIN = float('inf')

for i in range(N):
    MAX = max(MAX, X[i] - Y[i])
    MIN = min(MIN, X[i] - Y[i])

ans = MAX - MIN

MAX = float('-inf')
MIN = float('inf')

for i in range(N):
    MAX = max(MAX, X[i] + Y[i])
    MIN = min(MIN, X[i] + Y[i])

ans = max(ans, MAX - MIN)

print(ans)

Measured memory_bytes: 24608
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define in insert
#define all(x) (x).begin(), (x).end()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int INF = 1e9 + 5;
int main(){
    int a, b;
    cin >> a >> b;
    if(a > 8 || b > 8) cout << ":(";
    else cout << "Yay!";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int A,B,C,D;
    int l,r;

    cin >> A >> B >>C >> D;

    l = A + B;
    r = C + D;
    if (l > r){
        cout << "Left" << endl;
    }else if (r > l){
        cout << "Right" << endl;
    }else{
        cout << "Balanced " << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define Re real()
#define Im imag()
using namespace std;

const double eps = 1e-9;
typedef complex<double> Point;
typedef Point Vector;
Point P[50050];
int n, k;
vector<Point> qs;

bool cmp(Point a, Point b)
{
    if(fabs(a.Re - b.Re) < eps) return a.Im < b.Im;
    else return a.Re < b.Re;
}

double cross(const Point& a, const Point& b)
{
    return (conj(a) * b).Im;
}

int convex_hull()
{
    k = 0;
    for(int i = 0; i < n; i++)
    {
        while(k > 1 && cross(qs[k - 1] - qs[k - 2], P[i] - qs[k - 1]) <= 0) k--;
        qs[k++] = P[i];
    }
    for(int i = n - 2, t = k; i >= 0; i--)
    {
        while(k > t && cross(qs[k - 1] - qs[k - 2], P[i] - qs[k - 1]) <= 0) k--;
        qs[k++] = P[i];
    }
    return k - 1;
}

int main()
{
    while(~scanf("%d", &n))
    {
        for(int i = 0; i < n; i++)
        {
            double tx, ty;
            scanf("%lf%lf", &tx, &ty);
            P[i] = Point(tx, ty);
        }

        int flag = 1;
        for(int i = 0; i < n; i++)
        {
            Vector v1 = P[(i - 1 + n) % n] - P[i];
            Vector v2 = P[(i + 1) % n] - P[i];
            if(cross(v1, v2) > 0) flag = 0;
        }
        printf("%d\n",flag);
    }
    return 0;
}

/*

5
0 0
2 0
2 2
0 2
1 1

*/

Measured memory_bytes: 2008
#include <bits/stdc++.h>
using namespace std;
// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
// using namespace __gnu_pbds;   
#define ll long long
#define ull unsigned long long
// #define ordered_set tree<pair<ll, ll>, null_type, less<pair<ll, ll>>, rb_tree_tag, tree_order_statistics_node_update> 
ll mod=1e9+7;
#define PI 3.1415926535897932385
#define inf 9e18
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
string char_to_str(char c){string tem(1,c);return tem;}
typedef pair<long long, long long> ii;
#define S second
#define F first
ll max(ll a,ll b){if(a>b){return a;}return b;}
ll min(ll a,ll b){if(a<b){return a;}return b;}
#define MAXN 200005
// Comment this out for interactice problem
// #define endl '\n'
// string to integer stoi() Remember: it takes string not character
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();
 
// To compile--> g++ -std=c++0x -o output one.cpp
// To run--> ./output
ll n;
vector<ll> adj[100005];
ll given[100005];
ll goal[100005];
ll vis_bfs[100005];
ll vis_dfs[100005];
ll par[100005];
ll tu[100005];

void dfs(ll u){
    for (auto i = adj[u].begin(); i != adj[u].end(); ++i)
    {
        if(!vis_dfs[*i]){
            par[*i]=u;
            vis_dfs[*i]=true;
            dfs(*i);
        }
    }
}

int main() 
{ 
    fastio;
    // freopen("input.txt/","r",stdin);
    // freopen("ouptut.txt","w",stdout);
    ll n;
    cin>>n;
    long double p[n+1];
    for (int i = 1; i < n+1; ++i)
    {
        cin>>p[i];
    }

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

    for (int i = 1; i < n+1; ++i)
    {
        for (int j = 0; j<=i; ++j)
        {
            // This will give us exact j heads
            // with atmost ith coins
            if(j>0){
                // ith coin being the head
                dp[i][j] = dp[i][j] + (dp[i-1][j-1]*p[i]);
            }
            // Now ith being the tail
            dp[i][j] = dp[i][j] + (dp[i-1][j]*(1.0-p[i]));
        }
    }

    long double ans=0;
    for (int i = (n/2)+1; i<=n; ++i)
    {
        ans = ans + dp[n][i];
    }
    cout<<fixed<<setprecision(13)<<ans;

    return 0;
}

Measured memory_bytes: 146808
#include <iostream>
#include <cstdlib> // abs() for integer
#include <cmath>   // abs() for float, and fabs()
#include <algorithm>
#include <vector>
using namespace std;
using ll = long long;
using p = pair<int, int>;

int main()
{
  ll n, k;
  cin >> n >> k;
  n = (n % k);
  if (n > abs(n - k))
  {
    n = abs(n - k);
  }

  cout << n << endl;
  return 0;
}


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

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

	vector<vector<int>> r( W, vector<int>( H ) );
	for( int i = 0; i < N; i++ ) {
		if( a[i] == 1 ) {
			for( int j = 0; j < x[i]; j++ ) {
				for( int k = 0; k < H; k++ ) {
					r[j][k] = 1;
				}
			}
		}
		else if( a[i] == 2 ) {
			for( int j = x[i]; j < W; j++ ) {
				for( int k = 0; k < H; k++ ) {
					r[j][k] = 1;
				}
			}
		}
		else if( a[i] == 3 ) {
			for( int j = 0; j < W; j++ ) {
				for( int k = 0; k < y[i]; k++ ) {
					r[j][k] = 1;
				}
			}
		}
		else if( a[i] == 4 ) {
			for( int j = 0; j < W; j++ ) {
				for( int k = y[i]; k < H; k++ ) {
					r[j][k] = 1;
				}
			}
		}
	}

	int ans = 0;
	for( int i = 0; i < W; i++ ) {
		for( int j = 0; j < H; j++ ) {
			if( r[i][j] == 0 ) ans++;
		}
	}

	cout << ans << endl;
}


Measured memory_bytes: 3672
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>

#define doubled( x ) (x * x)

//?????????????¨????(2 * 2??£?????????)
int matrix_val(int a11, int a12, int a21, int a22);

//?????°?????°?????? (in:??´??° out:?????°)
int digit_count(int num);

using namespace std;

int main()
{
	int a, b, c, d, e, f;
	
	cin >> a >> b >> c ;
	cin >> d >> e >> f;
	do
	{
		int A_matrix_val = matrix_val(a, b, d, e);
		int elem_x = matrix_val(c, b, f, e);
		int elem_y = matrix_val(a, c, d, f);
		double ans_x, ans_y;
		
		if( elem_x == 0 )ans_x = 0;
		else ans_x = (double)elem_x / A_matrix_val;
		
		if( elem_y == 0 )ans_y = 0;
		else ans_y = (double)elem_y / A_matrix_val;
		
		printf("%.3f %.3f\n", ans_x, ans_y);

	}while( (cin >> a >> b >> c >> d >> e >> f) );
	
	return 0;
}

int matrix_val(
int a11, int a12,
int a21, int a22
){
	return ((a11 * a22) - (a12 * a21));
}

int digit_count(int num)
{
	if( num < 0 )num *= (-1);
	
	int count = 0;
	
	for(int i = 10; num != 0; i *= 10)
	{
		int diff = num % i;
		num -= diff;
		count++;
	}
		
	return count;
}

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

  int n;
  cin >> n;

  int num;
  bool finished = false;

  for (int i = 1; i < 10; i++) {
    for (int j = 1; j < 10; j++) {
      num = i * j;

      if (num == n) {
        finished = true;
        break;
      }
    }
    if (finished == true) {
      break;
    }
  }

  if (finished == true) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

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

using namespace std;
using ll = long long;
using pint = pair<int, int>;

int main() {
	int N;
	cin >> N;
	vector<int> L(N);
	for (int i = 0; i < N; i++) cin >> L[i];
	int count = 0;
	vector<int> num(3);
	for (int i = 0; i < N - 2; i++) {
		for (int j = i + 1; j < N - 1; j++) {
			for (int k = j + 1; k < N; k++) {
				num[0] = L[i];
				num[1] = L[j];
				num[2] = L[k];
				sort(num.begin(), num.end());
				if (num[2] < num[0] + num[1]) {
					if (L[i] != L[j] && L[i] != L[k] && L[j] != L[k]) count++;
				}
			}
		}
	}
	cout << count << endl;
	return 0;
}

Measured memory_bytes: 3548
import numpy as np
import math
N=int(input())
people_pm=[]
a=int(input())
people_pm.append(a)
b=int(input())
people_pm.append(b)
c=int(input())
people_pm.append(c)
d=int(input())
people_pm.append(d)
e=int(input())
people_pm.append(e)
wait_time = math.ceil(N/min(people_pm))
print(wait_time+4)


Measured memory_bytes: 20676
#include<iostream>
#include <queue>
#include <string>

using namespace std;
int main(){
	priority_queue<int,vector<int>,less<int> > r;
	string s;
	int key;
	while(true) {
		cin >> s;
		if (s == "insert") {
			cin >> key;
			r.push(key);
		} else if (s == "extract") {
			cout << r.top() << std::endl;
			r.pop();
		} else if (s== "end") {
			break;
		}
	}
}

Measured memory_bytes: 7028
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#define int long long
#define mod 1000000007
using namespace std;
int n, a[234567], b[234567], ans = 0;
signed main() {
	cin >> n;
	for (int i = 1; i <= n; i++)cin >> a[i];
	for (int i = n; i >= 1; i--) {
		int sum = 0;
		for (int j = i * 2; j <= n; j += i) sum += b[j];
		sum %= 2;
		b[i] = (a[i] != sum);
		ans += b[i];
	}
	cout << ans << endl;
	ans = 0;
	for (int i = 1; i <= n; i++) {
		if (b[i]) {
			if (ans)cout << ' ';
			cout << i;
			ans = 1;
		}
	}
	if(ans)cout << endl;
}

Measured memory_bytes: 3968
import static java.lang.System.out;
import java.util.Scanner;

public class Main {
	  public static void main(String...args) {
			    String str = new Scanner(System.in).nextLine();
			    String[] list = str.split(" ");
			    String x = list[0];
			    String y = list[1];

			    int a = Integer.parseInt(x);
			    int b = Integer.parseInt(y);

				int sum = a * b;
                int cm = (a + b) * 2;

                out.println(sum + " " + cm);

	  }


}

Measured memory_bytes: 26176
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

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

func main() {
	sc.Split(bufio.ScanWords)
	n := nextInt()
	k := nextInt()
	s := nextLine()
	front := s[0 : k-1]
	back := s[k:n]
	lower := strings.ToLower(string(s[k-1]))
	fmt.Println(front + lower + back)
}

Measured memory_bytes: 640
#include <stdio.h>

int main(void) {
	long long a[5000];
	long long ask[5000];
	int max;
	int i;
	int j;
	int k;
	int sign;
	long long saidaiti;
	long long now;
	while(1) {
		scanf("%d",&max);
		if(max==0)break;
		for(i=0;i<max;i++)scanf("%lld",&a[i]);
		for(i=0,j=-1,sign=0;i<max;i++) {
			if(a[i]*sign<=0 && a[i]!=0) {
				sign=(a[i]>0)?1:-1;
				j++;
				ask[j]=0;
			}
			ask[j]+=a[i];
		}
		for(i=0;i<=j;i++) {
			if(ask[i]>=0)break;
		}
		if(i>j) {
			saidaiti=a[0];
			for(i=1;i<max;i++) {
				if(a[i]>saidaiti)saidaiti=a[i];
			}
		} else {
			max=j+1;
			saidaiti=ask[0];
			for(i=1;i<=max;i++) {
				for(j=0;j<=max-i;j++) {
					now=0;
					for(k=j;k<j+i;k++)now+=ask[k];
					if(now>saidaiti)saidaiti=now;
				}
			}
		}
		printf("%d\n",saidaiti);
	}
	return 0;
}

Measured memory_bytes: 456
s = input()

def addAll(end):
  return (end * (end + 1)) // 2

total = 0
index = 0

while len(s) > index:
  leftCount = 0
  rightCount = 0
  while len(s) > index and s[index] == "<":
    leftCount += 1
    index += 1
  while len(s) > index and s[index] == ">":
    rightCount += 1
    index += 1
  maxCount = max(leftCount, rightCount)
  minCount = min(leftCount, rightCount)
  total += addAll(maxCount) + addAll(max(minCount - 1, 0))

print(total)

Measured memory_bytes: 74100
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define Rep(i,s,n) for(int i=s;i<n;i++)
#define fi first
#define se second
#define all(c) c.begin(),c.end()
typedef long long int ll;
typedef pair<int, int> P;
typedef long double ld;
string s;
void Ans(bool x){if(x) cout<<s<<endl;else cout<<"red"<<endl;}

const ll INF=1001001001;
const ll mod=10000000007;

int main(){
  int a;cin>>a;
  cin>>s;
  Ans(a>=3200);
}

Measured memory_bytes: 256