akhauriyash/Code-Regression huggingface dataset:
<?php

fscanf(STDIN, "%d", $input);

$a = ($input / 1000) % 10;
$b = ($input / 100) % 10;
$c = ($input / 10) % 10;
$d = $input % 10;

if ($a + $b + $c + $d === 7) {
	$op = ['+', '+', '+'];
}

if ($a + $b + $c - $d === 7) {
	$op = ['+', '+', '-'];
}

if ($a + $b - $c - $d === 7) {
	$op = ['+', '-', '-'];
}

if ($a + $b - $c + $d === 7) {
	$op = ['+', '-', '+'];
}

if ($a - $b - $c - $d === 7) {
	$op = ['-', '-', '-'];
}

if ($a - $b - $c + $d === 7) {
	$op = ['-', '-', '+'];
}

if ($a - $b + $c - $d === 7) {
	$op = ['-', '+', '-'];
}

if ($a - $b + $c + $d === 7) {
	$op = ['-', '+', '+'];
}

printf("%d%s%d%s%d%s%d=7", $a, $op[0], $b, $op[1], $c, $op[2], $d);

Measured memory_bytes: 4604
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <climits>
#include <iomanip>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
int main(){
  double n,m,d;
  cin >> n >> m >> d;
  double res = 0;
  if(d == 0){
    res = double(1 / n);
    res *= m - 1;
  }
  else{
    res = double((2 * n - 2 * d) / (n * n));
    res *= m - 1;
  }
  cout << fixed << setprecision(10) << res << endl;
  return 0;
}

Measured memory_bytes: 256
import sys


TEST_INPUT = [
    """
    sardine
    """,
    """
    xxxx
    """,
    """
    gone
    """
]
ANSWER = [
    "xxxxxxx",
    "xxxx",
    "xxxx"
]


class InputHandler:

    def __init__(self, text_lines="", is_test=False):
        self.data = list(text_lines.split("\n"))
        self.index = 0
        self.is_test = is_test

    def input(self):
        if self.is_test:
            self.index += 1
            return self.data[self.index].strip()
        else:
            return sys.stdin.readline().rstrip()


def solve(ih):
    s = ih.input()
    return "x" * len(s)


def main():
    ih = InputHandler()
    res = solve(ih)
    print(res)


def test():
    for test_input, ans in zip(TEST_INPUT, ANSWER):
        ih = InputHandler(test_input, True)
        res = solve(ih)
        assert str(res) == str(ans)


if __name__ == "__main__":
    test()
    main()


Measured memory_bytes: 3064
N,M,C=map(int,input().split())
T=[int(i) for i in input().split()]
A=[0]*N
for i in range(N):
    A[i]=[int(i) for i in input().split()]
mysum=0
ans=0
for i in range(N):
    for j in range(M):
        mysum+=A[i][j]*T[j]
    if mysum+C>0:
        ans+=1
    mysum=0
print(ans)

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

using ll = long long;
using Pii = std::pair<int, int>;
using Pll = std::pair<ll, ll>;

const ll INF = (ll)1e16;

using namespace std;

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

    ll n;
    cin >> n;
    ll a[5], m = INF;
    for (int i = 0; i < 5; ++i) {
        cin >> a[i];
        m = min(m, a[i]);
    }

    cout << (n + m - 1) / m + 4 << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <vector>
#include <string>
#include <utility>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>


using namespace std;

int main()
{
    int N;
    cin >> N;
    multiset<double> v;
    for(int i = 0; i < N; ++i){
        double x = 0;
        cin >> x;
        v.insert(x);
    }
    for(int i = 1; i < N; ++i){
        double x = *v.begin();
        v.erase(v.begin());
        x += *v.begin();
        v.erase(v.begin());
        v.insert(x/2.0);
    }
    printf("%.7f\n", *v.begin());
    
}


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

//定数
//円周率
const double pi = 3.141592653589793238462643383279;
//天井
const int INF = 1000000000; // = 10^9
const ll LINF = 100000000000000000; // = 10^17
//ABC文字列
const string ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZABC";
const string abc = "abcdefghijklmnopqrstuvwxyzabc";
//よくあるmodくん
const ll MOD = 1000000007; // = 10^9 + 7
//前処理テーブルの大きさ指定
const int MAX = 1200000; // = 10^6 + 2*(10^5)
//ちなみに、1024MBで持てる最大長の配列は10^8程度

//データ構造
//隣接リスト用構造体（有向グラフ向け）
struct edge {
  ll to; // E.toでその辺の終点へアクセスできる。
  ll cost; // e.costでその辺の重みにアクセスできる。
};
//Union_Find木
struct UnionFind {
  vector<int> UF; // UF.at(i) : iの親の番号
  vector<int> SIZE; // SIZE.at(root(i)) : iと連結されてる要素の数
  UnionFind(int N) : UF(N), SIZE(N, 1) { // 最初は全てが根であるとして初期化
    for(int i = 0; i < N; i++) {
      UF.at(i) = i;
    }
  }
  int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
    if (UF.at(x) == x) {
      return x;
    }
    return UF.at(x) = root(UF.at(x));
  }
  void unite(int x, int y) { // xとyの木を併合
    int rx = root(x); // xの根をrx
    int ry = root(y); // yの根をry
    if (rx == ry) {
      return; // xとyの根が同じ(=同じ木にある)時はそのまま
    }
    // xとyの根が同じでない(=同じ木にない)時：小さい方の根を大きい方の根につける。
    if (SIZE.at(rx) < SIZE.at(ry)) {
      UF.at(rx) = ry;
      SIZE.at(ry) += SIZE.at(rx);
      SIZE.at(rx) = 0;
    }
    else {
      UF.at(ry) = rx;
      SIZE.at(rx) += SIZE.at(ry);
      SIZE.at(ry) = 0;
    }
  }
  bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す。
    int rx = root(x);
    int ry = root(y);
    return rx == ry;
  }
  int size(int x) { // xと連結されてる要素の数を返す。
    return SIZE.at(root(x));
  }
};

//関数 (計算量)
//ctoi (O(1))
int ctoi(char c){
  if (c == '0') return 0;
  if (c == '1') return 1;
  if (c == '2') return 2;
  if (c == '3') return 3;
  if (c == '4') return 4;
  if (c == '5') return 5; 
  if (c == '6') return 6;
  if (c == '7') return 7;
  if (c == '8') return 8;
  if (c == '9') return 9;
  return -1;  
}
//to_char (O(1))
char to_char(int i){
  if (i == 0) return '0';
  if (i == 1) return '1';
  if (i == 2) return '2';
  if (i == 3) return '3';
  if (i == 4) return '4';
  if (i == 5) return '5';
  if (i == 6) return '6';
  if (i == 7) return '7';
  if (i == 8) return '8'; 
  if (i == 9) return '9';
  return ' ';  
}

//メイン処理
int main() {
  cout << fixed << setprecision(16); //精度向上
  //ここまでテンプレ
  int N;
  cin >> N;
  ll ans = 0;
  for (int i = 1; i <= N; i++) {
    for (int j = 1; j <= N; j++) {
      if (i * j < N) {
        ans++;
      }
      else {
        break;
      }
    }
  }
  cout << ans << endl;
}

  
  
  
  
  
  

Measured memory_bytes: 3636
#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, m, n) for(int i=(m); i<(n); ++i)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define Cout(x) cout << (x) << endl
#define Cout2(x, y) cout << (x) << " " << (y) << endl
#define dump(x) cerr << #x << " = " << (x) << endl;
typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
const int inf = 1e9;
const double pi = acos(-1.0);

//約数列挙
vector<long long> DivAll(long long n) {
	vector<long long> ret;
	long long i = 1;
	for (; i*i < n; ++i)
		if (n%i == 0)ret.push_back(i);
	bool flag = i * i == n;
	if (flag)ret.push_back(i);
	for (i = (int)ret.size() - 1 - flag; i >= 0; --i)
		ret.push_back(n / ret[i]);
	return ret;
}

int main() {
	LL n, m; cin >> n >> m;
	VL d = DivAll(m);

	int ans = 0;
	rep(i, sz(d)) {
		if (d[i] <= m / n) {
			ans = d[i];
		}
	}
	Cout(ans);
}

Measured memory_bytes: 256
n = int(input())

d = dict()
l = list()
c = list()
for i in range(n):
    s, p = input().split()
    p = int(p)
    c.append([s, p, i+1])
    d[p] = [s, i+1]
p_sort = sorted(d)

for i in p_sort:
    l.append([d[i][0], i, d[i][1]])

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

for i in l:
    print(i[2])



Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
//const int INF = 1e8;
using namespace std;

int main(){
	int n, m, k;
	cin >> n >> m >> k;
	rep(i,n + 1){
		rep(j,m + 1){
			//cout << m * i - i * j + (n - i) * j << endl;
			if(k == m * i - i * j + (n - i) * j){
				cout << "Yes" << endl;
				return 0;
			}
		}
	}
	cout << "No" << endl;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;

public class Main {

	BufferedReader br;
	PrintWriter out;
	StringTokenizer st;
	boolean eof;

	void solve() throws IOException {
		int n = nextInt();
		int k = nextInt();
		
		List<Integer>[] byRem = new List[k];
		for (int i = 0; i < k; i++) {
			byRem[i] = new ArrayList<>();
		}
		
		for (int i = 0; i < n; i++) {
			int x = nextInt();
			
			byRem[x % k].add(x);
		}
		
		int[] pairs = new int[k];
		int[] rest = new int[k];
		
		for (int i = 0; i < k; i++) {
			Collections.sort(byRem[i]);
			
			
			for (int j = 0; j < byRem[i].size(); ) {
				int nextJ = j;
				while (nextJ < byRem[i].size() && byRem[i].get(j).intValue() == byRem[i].get(nextJ).intValue()) {
					nextJ++;
				}
				
				int len = nextJ - j;
				
				pairs[i] += len / 2;
				rest[i] += len % 2;
				
				j = nextJ;
			}
		}
		
		int ans = 0;
		
		for (int i = 0; i < k; i++) {
			int j = (k - i) % k;
			if (j < i) {
				continue;
			}
			
			
			if (i == j) {
				
//				System.err.println(pairs[i] + " " + rest[i]);
				
				ans += (2 * pairs[i] + rest[i]) / 2;
			} else {
				
				int p1 = pairs[i];
				int r1 = rest[i];
				
				int p2 = pairs[j];
				int r2 = rest[j];
				
				if (2 * p1 + r1 < 2 * p2 + r2) {
					int tmp = r1;
					r1 = r2;
					r2 = tmp;
					
					tmp = p1;
					p1 = p2;
					p2 = tmp;
				}
				
//				System.err.println(p1 + " " + r1 + ", " + p2 + " " + r2);

				ans += 2 * p2 + r2;
				
				int rest1 = 2 * p1 + r1 - 2 * p2 - r2;
				
				ans += Math.min(rest1 / 2, p1);
				
			}
		}
		
		out.println(ans);
	}

	Main() throws IOException {
		br = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		solve();
		out.close();
	}

	public static void main(String[] args) throws IOException {
		new Main();
	}

	String nextToken() {
		while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (Exception e) {
				eof = true;
				return null;
			}
		}
		return st.nextToken();
	}

	String nextString() {
		try {
			return br.readLine();
		} catch (IOException e) {
			eof = true;
			return null;
		}
	}

	int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}
}

Measured memory_bytes: 34824
def main():
    n = int(input())
    words = []
    for i in range(n):
        word = input()
        if words.count(word) > 0:
            print("No")
            return

        if len(words) != 0:
            if words[-1][-1] != word[0]:
                print("No")
                return
        words.append(word)
    print("Yes")


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include <stdio.h>

int main(void) {
    int N, P, i, cake, my_cake;
    int cake_total = 0;
    
    scanf ("%d %d", &N, &P);
    
    for(i = 0; i < P; i++) {
        scanf("%d", &cake);
        cake_total += cake;
    }
    
    if ((cake_total % (N + 1)) == 0) {
        my_cake = cake_total / (N + 1); 
    }
    else {
        my_cake = cake_total / (N + 1) + 1;
    }
    
    printf("%d\n", my_cake);
    
    return 0;
}


Measured memory_bytes: 2112
import Data.List
import Control.Applicative
import Control.Monad
import Control.Monad.Writer
import Data.Monoid

main :: IO ()
main = do
    getLine
    input <- map read . words <$> getContents
    let result = runWriter $ solve input
    putStrLn . intercalate " " . map show $ fst result
    putStrLn . show . getSum $ snd result

-- 与えられたリストに現れる始めのaをbに置換したリストを返す
firstReplace :: Int -> Int -> [Int] -> [Int]
firstReplace a b (x:xs)
    | x == a = b:xs
    | otherwise = x:firstReplace a b xs

solve :: [Int] -> Writer (Sum Int) [Int]
solve [x] = return [x] -- 基底部
solve all@(x:_) = do
    let m = minimum all                       -- 先頭に来るべきもの
    when (m /= x) $ tell (Sum 1)              -- 交換が必要ならカウントする
    xs <- solve . tail $ firstReplace m x all -- tailに対して再帰的に適用する
    return (m:xs)



Measured memory_bytes: 4172
#include <iostream>
#include <vector>
#include <algorithm>

struct val
  {
  int a,b,c;
  };

int main()
{
 int n;
  std::vector<val> days {};
  std::vector<val> dp {};
  std::cin>>n;
  val cur {0,0,0};
  days.resize(n);
  dp.resize(n);
  
  for (int i {}; i < n; i++)
    {
      std::cin>>cur.a>>cur.b>>cur.c;
    days[i]=cur;
    dp[i]={-1000000000,-1000000000,-1000000000};
    }
  
  dp[0]=days[0];
  for (int d {1}; d < n; d++)
   {
       dp[d].a=days[d].a + std::max(dp[d-1].b, dp[d-1].c);
       dp[d].b=days[d].b + std::max(dp[d-1].a, dp[d-1].c);
    dp[d].c=days[d].c + std::max(dp[d-1].b, dp[d-1].a);
    }
  
  std::cout<<std::max(dp[n-1].a, std::max(dp[n-1].b, dp[n-1].c));
  
    
}

Measured memory_bytes: 2560
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<cstdio>
using namespace std;

const int N=100005;
const int inf=2000000000;

struct E{
	int to,next;
}mem[N<<1];
int n,x,y,num;
int head[N],dp[N];

void add(int x,int y){
	num++;
	mem[num].to=y; mem[num].next=head[x];
	head[x]=num;
}

void dfs(int k,int pre){
	int j,u;
	for (j=head[k];j;j=mem[j].next){
		u=mem[j].to;
		if (u==pre) continue;
		dfs(u,k);
		dp[k]^=dp[u]+1;
	}
}

int main(){
	int i;
	scanf("%d",&n);
	for (i=1;i<n;i++){
		scanf("%d%d",&x,&y);
		add(x,y); add(y,x);
	}
	dfs(1,0);
	if (dp[1]) printf("Alice\n");
	else printf("Bob\n");
	return 0;
} 

Measured memory_bytes: 7296
# include "bits/stdc++.h"
using namespace std;
using LL = long long;
using ULL = unsigned long long;
const double PI = acos(-1);
template<class T>constexpr T INF() { return ::std::numeric_limits<T>::max(); }
template<class T>constexpr T HINF() { return INF<T>() / 2; }
template <typename T_char>T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char>T_char TU(T_char cX) { return toupper(cX); };
const int vy[] = { -1, -1, -1, 0, 1, 1, 1, 0 }, vx[] = { -1, 0, 1, 1, 1, 0, -1, -1 };
const int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
int popcnt(unsigned long long n) { int cnt = 0; for (int i = 0; i < 64; i++)if ((n >> i) & 1)cnt++; return cnt; }
int d_sum(LL n) { int ret = 0; while (n > 0) { ret += n % 10; n /= 10; }return ret; }
int d_cnt(LL n) { int ret = 0; while (n > 0) { ret++; n /= 10; }return ret; }
LL gcd(LL a, LL b) { if (b == 0)return a; return gcd(b, a%b); };
LL lcm(LL a, LL b) { LL g = gcd(a, b); return a / g*b; };
# define ALL(qpqpq)           (qpqpq).begin(),(qpqpq).end()
# define UNIQUE(wpwpw)        sort(ALL((wpwpw)));(wpwpw).erase(unique(ALL((wpwpw))),(wpwpw).end())
# define LOWER(epepe)         transform(ALL((epepe)),(epepe).begin(),TL<char>)
# define UPPER(rprpr)         transform(ALL((rprpr)),(rprpr).begin(),TU<char>)
# define FOR(i,tptpt,ypypy)   for(LL i=(tptpt);i<(ypypy);i++)
# define REP(i,upupu)         FOR(i,0,upupu)

struct INIT{
    INIT(){
        std::ios::sync_with_stdio(false);
        std::cin.tie(0);
        cout << fixed << setprecision(13);
    }
}INIT;

struct UnionFind {
	UnionFind(size_t size){
        for(int i = 0;i < (int)size;i++){
            par.emplace_back(i);
            rnk.emplace_back(0);
        }
    }
	vector<int> par, rnk;

    int root(int x){
        if(par[x] == x)return x;
        else return par[x] = root(par[x]);
    }

    bool is_root(int x){
        return root(x) == x;
    }

    void unite(int x, int y){
        x = root(x);
        y = root(y);
        if(x == y)return;
        if(rnk[x] < rnk[y]){
            par[x] = y;
        }else{
            par[y] = x;
            if(rnk[x] == rnk[y])rnk[x]++;
        }
    }
    bool same(int x,int y){
        return root(x) == root(y);
    }
};

int n, m;
LL a[101010];
int main(){
    cin >> n >> m;
    int group = n;
    UnionFind forest(n);
    REP(i, n)cin >> a[i];
    REP(i, m){
        int x, y;
        cin >> x >> y;
        if(forest.same(x, y))continue;
        forest.unite(x, y);
        group--;
    }
    if(group == 1){
        cout << 0 << endl;
        return 0;
    }
    vector<LL> v[101010];
    REP(i, n)v[forest.root(i)].emplace_back(a[i]);
    REP(i, n)sort(ALL(v[i]));
    LL ans = 0;
    vector<LL> vec;
    REP(i, n)if((int)v[i].size()){
        ans += v[i][0];
        for(int j = 1;j < (int)v[i].size();j++){
            vec.emplace_back(v[i][j]);
        }
    }
    sort(ALL(vec));
    if((int)vec.size() < (group - 1) * 2 - group){
        cout << "Impossible" << endl;
        return 0;
    }
    REP(i, (group - 1) * 2 - group)ans += vec[i];
    cout << ans << endl;
}

Measured memory_bytes: 7284
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

struct node{
unsigned int key;
  struct node *next;
  struct node *prev;
};

typedef struct node * NodePointer;

NodePointer nil;

NodePointer listSearch(int key){
  NodePointer x;
  x = nil->next;
  while(x != nil && x->key != key) x = x->next;

  return x;
}

void init(){
  nil = malloc(sizeof(struct node));
  nil->next = nil;
  nil->prev = nil;
}

void printList(){
  NodePointer cur = nil->next;
  int isf = 1;
  while(1){
    if ( cur == nil ) break;
    if ( isf == 0)  printf(" ");
    printf("%d", cur->key);
    cur = cur->next;
    isf = 0;
  }
  printf("\n");
}

void deleteNode(NodePointer t){
  t->prev->next = t->next;
  t->next->prev = t->prev;
}

void deleteFirst(){
  NodePointer t = nil->next;
  if ( t == nil ) return;
  deleteNode(t);
}

void deleteLast(){
  NodePointer t = nil->prev;
  if(t == nil) return;

  deleteNode(t);
}

void delete(int key){
  NodePointer t;
  t = listSearch(key);
  if(t == nil) return;
  deleteNode(t);
}


void insert(int key){
  NodePointer x;
  x = malloc(sizeof(struct node));
  x->key = key;

  if(nil->next == nil) nil->prev = x;
  x->next = nil->next;
  nil->next->prev =x;
  nil->next = x;
  x->prev = nil;
}

int main(){
  int key, n, i;
  int size = 0;
  char com[20];
  int np = 0, nd = 0;
  scanf("%d", &n);
  init();
  for ( i = 0; i < n; i++ ){
    scanf("%s%d", com, &key);
    if ( com[0] == 'i' ) {insert(key); np++; size++;}
    else if ( com[0] == 'd' ) {
      if (strlen(com) > 6){
	if ( com[6] == 'F' ) deleteFirst();
	else if ( com[6] == 'L' ) deleteLast();
      } else {
	delete(key); nd++; 
      }
      size--;
    }
  }

  printList();
  return 0;
}



Measured memory_bytes: 36084
N = int(input())

num = [0 for _ in range(N+1)]
for i in range(2, N+1):
    cur = i
    for j in range(2, i+1):
        while cur % j == 0:
            num[j] += 1
            cur //= j


def Count(m):
    return len(list(filter(lambda x: x >= m - 1, num)))


ans = Count(75) + (Count(3)-1)*Count(25) + Count(15) * (Count(5)-1)\
      + Count(5)*(Count(5)-1)*(Count(3)-2)//2
print(ans)


Measured memory_bytes: 3064
#include <stdio.h>
#include <algorithm>
#include <math.h>

#define BUF 200002
#define LIM_N 100001

char str[BUF];

int N, K;

double pow_2[LIM_N];

void receive_input() {
	fgets(str, sizeof(str), stdin);
	sscanf(str, "%d %d", &N, &K);
}

void initialize() {
	pow_2[0] = 1.0;
	int lim_pow = log(LIM_N) / log(2) + 1;
	for (size_t i = 1; i <= lim_pow; i++) {
		pow_2[i] = pow_2[i-1] * 0.5;
	}
}

int search(int i) {
	double arg = (double)K / i;
	double ans = log(arg) / log(2);
	int result = ans;

	if (result < 0) {
		return 0;
	}

	if (ans > result) {
		return result+1;
	} else {
		return result;
	}
}

int main(void) {
	receive_input();
	initialize();

	double sum = 0.0;

	for (size_t i = 1; i <= N; i++) {
		// printf("%d %d %lf : %lf * %lf = %f\n", i, search(i), pow_2[search(i)], (double)1.0 / N, pow_2[search(i)], pow_2[search(i)] * (double)1.0 / (double)N);
		sum += (double)1.0 / N * pow_2[search(i)];
	}

	printf("%.10f\n", sum);

	return 0;
}


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


int main(){
	int N;
	cin >> N;
	vector<int> A(N);
	int tot = 0;
	rep(i,N){
		cin >> A[i];
		tot ^= A[i];
	}
	rep(i,N){
		cout << (tot^A[i]);
		if(i!=N-1) cout << " ";
		else cout << endl;
	}
	
}













Measured memory_bytes: 4004
import sys
import math
from collections import deque

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()
NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()


def make_grid(h, w, num): return [[int(num)] * w for _ in range(h)]


def main():
    N = NI()
    X = SI()
    X_pop = X.count("1")
    X_plus = X_pop + 1
    X_minus = X_pop - 1

    RP = [pow(2, i, X_plus) for i in range(N+1)]
    if X_minus > 0:
        RM = [pow(2, i, X_minus) for i in range(N+1)]
    else:
        RM = [0] * (N+1)

    X = X[::-1]
    rem_p = 0
    rem_m = 0
    for i in range(N):
        if X[i] == "1":
            rem_p += RP[i]
            rem_m += RM[i]

    for i in range(N-1, -1, -1):
        if X[i] == "0":
            tmp = (rem_p + RP[i]) % X_plus
        elif X_minus >= 1:
            tmp = (rem_m - RM[i]) % X_minus
        else:
            print(0)
            continue
        ans = 1
        while tmp > 0:
            tmp = tmp % bin(tmp).count("1")
            ans += 1
        print(ans)






if __name__ == "__main__":
    main()

Measured memory_bytes: 25480
#include <iostream>
#include <string>
#include <algorithm>

int main()
{
    std::string input;
    std::cin >> input;
    if (input == "RSR")
    {
        std::cout << 1 << std::endl;
    }
    else
    {
        std::cout << std::count(input.begin(), input.end(), 'R') << std::endl;
    }
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define REP(i, n) for(int i=0; i<(int)(n); i++)
#define REP1(i,a,b) for(int i=a; i<=(int)(b); i++)
#define ALL(x) begin(x),end(x)
#define PB push_back
using namespace std;
typedef int64_t LL;
typedef vector<int> VI;
typedef pair<int,int> PII;

template<class T> inline bool chmax( T &a, const T &b ) { return b>a ? a=b,true : false; }
template<class T> inline bool chmin( T &a, const T &b ) { return b<a ? a=b,true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;
template<class T, class F=less<T>> void sort_uniq( vector<T> &v, F f=F() ) {
    sort(begin(v),end(v),f);
    v.resize(unique(begin(v),end(v))-begin(v));
}

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

    int n;
    cin >> n;
    REP1(t,1,n) {
        int cnt=0;
        for ( int x=1; x*x<=t; x++ ) {
            for ( int y=1; x*x+y*y+x*y<=t; y++ ) {
                for ( int z=1; x*x+y*y+z*z+x*y+y*z+z*x<=t; z++ ) {
                    if ( x*x+y*y+x*y+z*z+y*z+z*x==t ) cnt++;
                }
            }
        }
        cout << cnt << '\n';
    }
    return 0;
}

Measured memory_bytes: 3532
#include<iostream>
#include<set>
#include<string>

using namespace std;

int main(int argc, char const *argv[]) {
  /* code */
  set<string> sset;
  int N;
  cin >> N;
  for(int i=0;i<N;i++) {
    string s;
    cin >> s;
    sset.insert(s);
  }
  cout << sset.size() << endl;
  return 0;
}


Measured memory_bytes: 19064
#include <stdio.h>

#define MAX 200000

int max(int a,int b) { return a>b ? a: b;}
int min(int a,int b) { return a<b ? a: b;}

int main(void) {
    int R[MAX], i, n;
    
    scanf("%d",&n);
    for(i=0;i<n;i++) scanf("%d",&R[i]);
    
    int maxv = -2000000000;
    int minv = R[0];
    
    for(int i=1; i<n; i++) {
        maxv = max(maxv, R[i] - minv);
        minv = min(minv, R[i]);
    }
    
    printf("%d\n",maxv);

    return 0;
}



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

// GNU C Compiler
//template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }


/*
--------------------------------------------

	type

--------------------------------------------
*/
using LL = long long;
using ULL = unsigned long long;
//using pair<T1, T2> = p12;

/*
--------------------------------------------

	container

--------------------------------------------
*/
#define PB emplace_back
#define MP make_pair 
#define SZ(a) int((a).size())

/*
--------------------------------------------

	repetition

--------------------------------------------
*/
#define REP(n) for(int i=0; i<n; i++)
#define REPj(n) for(int j=0; j<n; j++)
#define REPinit(a,n) for(int i=a; i<n; i++)
#define REPinitj(a,n) for(int j=a; j<n; j++)

//algorithm
//#define SORT(c) sort((c).begin(),(c).end())

/*
--------------------------------------------

	constant

--------------------------------------------
*/
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))



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

	LL x = A * B;

	LL tmp = 0;
	if (A < B) {
		tmp = A;
		A = B;
		B = tmp;
	}

	/* ユークリッドの互除法 */
	LL r = A % B;
	while (r != 0) {
		A = B;
		B = r;
		r = A % B;
	}

	cout << (LL)(x / B) << endl;

	
	return 0;
}


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

int main() {
	ios::sync_with_stdio(0); cin.tie(0);
	char a, b; cin >> a >> b;
	if(a == b) cout << "H" << '\n';
	else cout << "D" << '\n';
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main (void){
  char str[6]={};
  int num = 0;
  scanf("%s",str);
  for(int i=0; str[i] !='\0'; i++){
    if(str[i] == '1')
      num++;
  }
  printf("%d\n",num);
  return 0;
}


Measured memory_bytes: 128
using System;

namespace agc030_a
{
    class Program
    {
        static void Main(string[] args)
        {
            var textLength = Convert.ToInt32(Console.ReadLine());
            var text = Console.ReadLine();
            var index = Convert.ToInt32(Console.ReadLine());

            var sub = text.Substring(index - 1, 1);

            for(int i = 0; i < textLength; i++)
            {
                var subString = text.Substring(i, 1);

                if (subString == sub){
                    Console.Write(sub);
                }
                else{
                    Console.Write("*");
                }
            }
        }
    }
}


Measured memory_bytes: 11220
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
typedef long long int lli;

int main(){
    string s;
    cin >> s;
    int n=s.size();
    lli s_sum=0, s_prod=1;
    for(int i=0; i<n; i++){
        s[i] -= '0';
        s_sum += s[i];
        s_prod *= s[i]+1;
    }
    
    map<lli, lli> dp[14+1][9*14+1][3];
    dp[0][0][1][1] = 1;
    for(int i=0; i<n; i++){
        for(int j=0; j<=9*i; j++){
            for(int k=0; k<=9; k++){
                int next[3] = {0, (k<s[i])? 0: (k==s[i])? 1: 2, 2};
                for(int d=0; d<3; d++){
                    for(auto &p: dp[i][j][d]){
                        dp[i+1][j+k][next[d]][p.first*(k+1)] += p.second;
                    }
                }
            }
        }
    }
    
    lli ans=0;
    for(int j=0; j<=9*n; j++){
        for(int d=0; d<3; d++){
            for(auto &p: dp[n][j][d]){
                if(j<s_sum or (j==s_sum and (p.first<s_prod or (p.first==s_prod and d==0)))){
                    ans += p.second;
                }
            }
        }
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 74616
#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <numeric>
#include <iomanip>
#define ll long long int
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
using namespace std;
int mx4[] = {0,1,0,-1};
int my4[] = {1,0,-1,0};
int mx2[] = {1,0};
int my2[] = {0,1};

class B754 {
public:
	void solve(istream& in, ostream& out) {
        string s; in >> s;
        int n = s.size();
        int ans = 1e6;
        for(int i = 0; i < n - 2; i++){
            int a = ((int)s[i] - 48) * 100 + ((int)s[i+1] - 48) * 10 + (int)s[i+2] - 48;
            ans = min(ans, abs(a-753));
        }
        out << ans << endl;
	}
};

int main() {
	B754 solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}

Measured memory_bytes: 256
package main

import (
	f "fmt"
)

func main() {

	var s, t string
	f.Scan(&s, &t)

	var s_num, t_num int
	f.Scan(&s_num, &t_num)

	var line string
	f.Scan(&line)

	if line == s {
		f.Println(s_num-1, t_num)
	} else if line == t {
		f.Println(s_num, t_num-1)
	}

}


Measured memory_bytes: 512
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
using ll = long long;
const ll INF = 1e9 + 7;
typedef pair<int,int> P;// pair型は２つの値の組を表せる

int main(){
    int N; cin >> N;
    int ans=0;
    if (N%2==0) ans=N/2;
    else ans=N/2+1;
    cout << ans;
}

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

#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define ll long long
#define rep(i,j,n) for(int i=j; i<n; i++)
#define INF 1000000000000000000 // If you use it, make sure not to put in "int" type variable ;(, use long long int
void optimizeIO() { ios_base::sync_with_stdio(false); cin.tie(NULL); }
const ll mod=1000000007;

int main()
{
    optimizeIO();
    int nT; nT=1;
	while(nT--)
	{
		int a,b; cin>>a>>b;
		if(b==1) { cout<<"0"; return 0; }
		for(int i=1; i<=b; i++)
		{
			if(i*a-i+1>=b) { cout<<i; return 0; }
		}
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a),i##formax=(b);i<i##formax;i++)
#define FORR(i,a,b) for(int i=(a),i##formax=(b);i>=i##formax;i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pcnt __builtin_popcount
#define sz(x) (int)(x).size()
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)
#define show(x) cout<<#x<<" = "<<x<<endl;
#define all(a) (a.begin()),(a.end())
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define perm(c) sort(all(c));for(bool c##p=1;c##p;c##p=next_permutation(all(c)))
#define bitComb(a,n,k) for(int a##x,a##y,a=(1<<k)-1;a<(1<<n);a##x=a&-a,a##y=a+a##x,a=(((a&~a##y)/a##x)>>1)|a##y)
#define uniq(v) sort(all(v));v.erase(unique(all(v)), v.end())
#define bit(n) (1LL<<(n))
#define randInt(l,r) (uniform_int_distribution<ll>(l,r)(rnd))
#define randDouble(l,r) (uniform_real_distribution<double>(l,r)(rnd))
#define dout(d) printf("%.12f\n",d)

typedef long long ll;
typedef __int128_t lll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<class T>using V=vector<T>;
template<class T>using VV=V<V<T>>;
template<class T,class Y>ostream& operator<<(ostream& o,const pair<T,Y>& p){return o<<"("<<p.fi<<", "<<p.se<<")";}
template<typename A,size_t N,typename T>void Fill(A (&array)[N],const T&v){fill((T*)array,(T*)(array+N),v);}
lll gcd(lll a,lll b,lll &x,lll &y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll gcd(ll a,ll b){lll x=0,y=0;return gcd(a,b,x,y);}
ll modInv(ll a,ll m){lll x,y;gcd(a,m,x,y);return (x%m+m)%m;}
ll modPow(lll a,lll n,ll m){if(!a)return a;lll p=1;for(;n>0;n>>=1,a=a*a%m)if(n&1)p=p*a%m;return(ll)p;}
bool isPrime(ll n){if(n<2||n%2==0)return n==2;lll t=n-1,d=t/(t&-t);for(lll a:{2,325,9375,28178,450775,9780504,1795265022})if(a%n){for(t=d,a=modPow(a,t,n);t!=n-1&&a!=1&&a!=n-1;a=a*a%n,t=t*2%n);if(a!=n-1&&t%2==0)return 0;}return 1;}
const int IINF = 1e9+6;
const ll LINF = 1e18;
const int MOD = 1e9+7;
const double PI = acos(-1);
const double EPS = 1e-10;
static random_device rd;
static mt19937 rnd(rd());

const int N = 50;
int n, b, a[N];
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n >> b;
  FOR(i, 0, n) cin >> a[i];
  int ans = 0;
  FOR(i, 0, n+1)FOR(j, 0, n+1)if(i+j<=n && i+j<=b){
    V<int> v;
    FOR(k, 0, i) v.pb(a[k]);
    FOR(k, 0, j) v.pb(a[n-1-k]);
    sort(all(v));
    int s = 0;
    FOR(k, 0, i+j) if(v[k]>=0 || k>=b-i-j) s += v[k];
    maxs(ans, s);
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include "iostream"
#define STR_MAX_LEN 10
#define REPLACE_CHAR '*'

int main()
{
  int n, k;
  char str[STR_MAX_LEN];
  scanf("%d%s%d", &n, str, &k);
  
  char output[STR_MAX_LEN];
  int i=0;
  for (; str[i]!='\0'; i++)
  {
    if ( str[i] == str[k-1] )
      output[i] = str[i];
    else
      output[i] = REPLACE_CHAR;
  }
  output[i] = '\0';
  
  printf("%s", output);
}


Measured memory_bytes: 256
program green_bin
    implicit none
    integer(4):: n,i,j,k
    integer(4):: a(10)
    integer(8) :: count=0
    character(10):: c
    character(10),allocatable:: ca(:)
    character(26),parameter:: alpha='abcdefghijklmnopqrstuvwxyz'
    
    read*, n
    allocate(ca(n))

    do i=1,n
        read*,c(:)
        do j=1,10
            a(j) = ichar(c(j:j))
        end do
        call merge_sort(a(:),1,10)
        do j=1,10
            ca(i)(j:j) = char(a(j))
        end do
        
    end do

    call smerge_sort(ca(:), 1, n)

    block; integer(4):: fst, scd
        fst=1; scd=2
        do while (scd <= n)
            if (ca(fst)==ca(scd)) then
                count = count + scd-fst
                scd=scd+1
            else
                fst=scd
                scd=scd+1
            end if
        end do
    end block

    print*, count



contains
recursive subroutine merge_sort(ar,fst,lst)
    integer(4):: ar(:), fst, lst, mid, tmp

    if (lst-fst < 2)then
        if (ar(lst) < ar(fst)) then
            tmp = ar(fst)
            ar(fst) = ar(lst)
            ar(lst) = tmp
        end if
        return
    end if

    mid = (fst+lst)/2
    call merge_sort(ar,fst,mid)
    call merge_sort(ar,mid+1,lst)
    call merge(ar,fst,mid,lst)
end subroutine

subroutine merge(ar, fst, mid, lst)
    integer(4):: ar(:), fst, mid, lst
    integer(4),pointer:: tmp(:)
    integer(4):: it, il, ir
    
    allocate(tmp(lst-fst+1))
    it=1
    il=fst
    ir=mid+1

    do while(il <= mid .and. ir <= lst)
        if (ar(il) <= ar(ir)) then
            tmp(it)=ar(il)
            il=il+1
        else
            tmp(it)=ar(ir)        
            ir=ir+1
        end if
        it=it+1
    end do

    if(ir > lst) then
        tmp(it:) = ar(il:mid)
    else
        tmp(it:) = ar(ir:lst)
    end if

    ar(fst:lst) = tmp(:)
    deallocate(tmp)
    
end subroutine

recursive subroutine smerge_sort(ar, fst, lst)
    character(10):: ar(:), tmp
    integer(4):: fst, lst, mid

    if (lst-fst < 2) then
        if (ar(lst) < ar(fst)) then
            tmp = ar(fst)
            ar(fst) = ar(lst)
            ar(lst) = tmp
        end if
        return
    end if

    mid = (fst+lst)/2
    call smerge_sort(ar, fst, mid)
    call smerge_sort(ar, mid+1, lst)
    call smerge(ar, fst, mid, lst)
end subroutine

subroutine smerge(ar, fst, mid, lst)
    character(10):: ar(:)
    character(10),pointer:: tmp(:)
    integer(4):: fst, mid, lst
    integer(4):: it, il, ir

    allocate(tmp(lst-fst+1))
    it=1
    il=fst
    ir=mid+1

    do while(il <= mid .and. ir<=lst)
        if (ar(il) <= ar(ir)) then
            tmp(it) = ar(il)
            il=il+1        
        else
            tmp(it) = ar(ir)
            ir=ir+1
        end if
        it=it+1
    end do

    if (ir > lst) then
        tmp(it:) = ar(il:mid)
    else
        tmp(it:) = ar(ir:lst)
    end if
    ar(fst:lst) = tmp(:)
    deallocate(tmp)
end subroutine


    
end program green_bin

Measured memory_bytes: 2716
import math
import string


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


def nCr(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))


def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor


# coordinates
dx = [-1, -1, -1, 0, 0, 1, 1, 1]
dy = [-1, 0, 1, -1, 1, -1, 0, 1]

n = int(input())
d, x = map(int, input().split())
a = [int(input()) for i in range(n)]
# print(a)
ans = 0
for i in a:
    ans += (d-1)//i
    ans += 1
print(ans+x)


Measured memory_bytes: 3832
void main() {
	auto S = rs;
	ulong res = ulong.max;
	auto arr = ['0', '1'];
	foreach(k; 0..2) {
		ulong tmp;
		foreach(i; 0..S.length) {
			if(S[i] != arr[(k+i)%2]) {
				tmp++;
			}
		}
		res = min(res, tmp);
	}
	res.writeln;
}

// ===================================

import std.stdio;
import std.string;
import std.functional;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}


Measured memory_bytes: 508
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <cmath>
#include <map>
#include <tuple>
#include <numeric>

using namespace std;

int main()
{
    int n, m;
    cin >> n >> m;

    // nC2 + mC2でOKか?
    int n_temp = n * (n-1) / 2;
    int m_temp = m * (m-1) / 2;

    cout << n_temp + m_temp << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
#define endl '\n'
#define vec vector<ll>
#define mat vector<vector<ll> >
#define fi first
#define se second
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> pll;
typedef long double ld;
typedef complex<double> comp;
const ll inf=1e9+7;
const ll mod=1e9+7;
const int MAX=1010;


signed main(){
    ll h,w,m;cin>>h>>w>>m;
    vector<pll>p(0);
    vector<ll>x(h),y(w);
    ll mx=0,my=0;
    rep(i,m){
        ll a,b;cin>>a>>b;
        a--;b--;
        x[a]++;
        y[b]++;
        mx=max(mx,x[a]);
        my=max(my,y[b]);
        p.pb(mp(a,b));
    }
    ll cnt=0;
    rep(i,m){
        ll xx=p[i].fi;
        ll yy=p[i].se;
        if(x[xx]==mx&&y[yy]==my)cnt++;
    }
    ll cntx=0;
    ll cnty=0;
    rep(i,h){
        if(x[i]==mx)cntx++;
    }
    rep(i,w){
        if(y[i]==my)cnty++;
    }
    cout<<mx+my-(!(cntx*cnty>cnt))<<endl;
}

Measured memory_bytes: 16348
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define ll long long

char s[212345],t[212345];

int main(){
  scanf("%s",s);
  scanf("%s",t);

  int ans=0;
  int len=strlen(s);
  for(int i=0;i<len;i++){
    if(s[i]!=t[i]) ans++;}
 
  
  
  printf("%d\n",ans);
  
  return 0;
}


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

#ifdef LOCAL
#include "../../dump.hpp"
#else
#define dump(...)
#endif

#define int ll
#define rep(i,n) for(int i=0,i##_cond=(n);i<i##_cond;++i)
#define FOR(i,a,b) for(int i=(a),i##_cond=(b);i<i##_cond;++i)
#define ROF(i,a,b) for(int i=(a)-1,i##_cond=(b);i>=i##_cond;--i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend() //sortで大きい順
#define sz(x) ((int)(x).size())
#define pb push_back
#define fst first
#define snd second
#define mp make_pair
using ll  = long long;
using vi  = vector<int>;
using vvi = vector<vi>;
using vs  = vector<string>;
using pii = pair<int,int>;
constexpr ll inf = 1ll<<61;
constexpr ll mod = 1e9+7;
template<class T>bool chmax(T &a, const T &b){if(a<b){a=b; return true;} return false;}
template<class T>void add(T &a, const T &b){a += b; a %= mod;}

signed main(){
  int r,g,b,n; cin >> r >> g >> b >> n;
  int c = 0;
  rep(i,n/r + 2){
    rep(j,n/g + 2){
      if(n >= r*i + g*j and (n- r*i - g*j) % b == 0) c++;
    }
  }
				   
  cout << c << endl;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
#include <bits/stdc++.h>
using namespace std;
template<class t> inline t read(t &x){
	char c=getchar();bool f=0;x=0;
	while(!isdigit(c)) f|=c=='-',c=getchar();
	while(isdigit(c)) x=(x<<1)+(x<<3)+(c^48),c=getchar();
	if(f) x=-x;return x;
}
template<class t,class ...A> inline void read(t &x,A &...a){
	read(x);read(a...);
}
template<class t> inline void write(t x){
	if(x<0) putchar('-'),write(-x);
	else{if(x>9) write(x/10);putchar('0'+x%10);}
}

const int N=2005;
int n,m,ans[N][N];

void diq(int a,int b,int c,int d){
	if(a==c||b==d) return ;
	int x=a+c>>1,y=b+d>>1;
	ans[x][y]=0;
	diq(a,b,x-1,y-1);
	diq(a,y+1,x-1,d);
	diq(x+1,b,c,y-1);
	diq(x+1,y+1,c,d);
}

signed main(){
	read(n,m);
	n=1<<n;m=1<<m;n--;m--;
	for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) ans[i][j]=1;
	diq(1,1,n,m);
	for(int i=1;i<=n;i++,puts("")) for(int j=1;j<=m;j++) write(ans[i][j]);
}

Measured memory_bytes: 11360
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
int main()
{
	ll a,b,c,k;
	cin>>a>>b>>c>>k;
    if(a>=k)cout<<k;
    else if(a+b==k)cout<<a;
    else
       cout<<a-(k-a-b);
    return 0;
}

Measured memory_bytes: 3644
#include<stdio.h>
#include<string.h>
#include<math.h>
#define loop(i, l, r) for(i=l; i<r; i++)/*Instead of function, (for).*/
#define rep(i,r) for(i=0; i<r; i++)
#define Min(a, b) ((a < b)? a : b)
#define Max(a, b) ((a > b)? a : b)
#define Abs(x) ((x>=0)? x : -x)/*Return the absolute value of x.*/
typedef long long int lli;
/*Return Combination ,(nCr)*/
int combi(int n, int r)
{
	if(r==0 || r==n) return 1;
	else return combi(n-1,r) + combi(n-1,r-1);
}
/*Return gcd(a, b)*/
int gcd(int a, int b){
	if(b == 0) return a;
	else return gcd(b, a % b);
}
int main(void)
{
	lli a, b, k;
	scanf("%lld%lld", &a, &b);
	if((a+b)%2 != 0){
		puts("IMPOSSIBLE");
		return 0;
	}
	k = (a+b)/2;
	printf("%lld", k);
	return 0;
}

Measured memory_bytes: 128
#include <stdio.h>

int main(){
  char a;
  int i,n=0,s=0;
  while((a=getchar())!=EOF){
    if(a>='0' && a<='9') n=n*10+a-'0';
    else if(n!=0) {s+=n; n=0;}
  }
  printf("%d\n",s);
  return 0;
}

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

int main(){
	string S, T;
	cin >> S >> T;
	int N = S.size();

	rep(i,N){
		S = S[N-1] + S.substr(0,N-1);
		if (S == T) {
			cout << "Yes" << endl;
			return 0;
		}
	}

	cout << "No" << endl;

	return 0;
}


Measured memory_bytes: 3632
#include <stdio.h>
#include <string>
#include <iostream>
#include <iomanip>
#include <map>
#include <algorithm>
#include <vector>
using namespace std;

int main(void) {
	int n,m,x;
	cin >> n >> m >> x;
	int low=0,high=0,a;
	for(int i=0; i<m; i++){
		cin >> a;
		if(x<a)high++;
		else low++;
	}
	cout << min(high,low) << endl;
	return 0;
}

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

using namespace std;

typedef long long LL;
typedef pair<int , int> P2;
typedef pair<pair<int , int> , int> P3;
typedef pair<pair<int , int> , pair<int , int> > P4;
#define PB(a) push_back(a)
#define MP(a , b) make_pair((a) , (b))
#define M3P(a , b , c) make_pair(make_pair((a) , (b)) , (c))
#define M4P(a , b , c , d) make_pair(make_pair((a) , (b)) , make_pair((c) , (d)))
#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 n;
vector<int> a;

int main(){
	cin >> n;
	a.resize(n);
	repp(i,0,n) cin >> a[i];
	sort(a.begin(),a.end());
	int ans = a[0];
	repp(i,1,n-1){
		if(abs(a[n-1]-2*a[i])<abs(a[n-1]-2*ans)) ans = a[i];
	}
	cout << a[n-1] << ' ' << ans << endl;
	return 0;
}


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

using namespace std;

#define FOR(i, n) for(int i = 0; i < (int) n; i++)
#define PB push_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define F first
#define S second

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

const int MOD = 998244353;

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

	int cnt[4] = {0};
	int n; cin >> n;

	FOR(i, n){
		string x; cin >> x;
		if(x == "AC") cnt[0]++;
		else if(x == "WA") cnt[1]++;
		else if(x == "TLE") cnt[2]++;
		else cnt[3]++;
	}

	cout << "AC x " << cnt[0] << '\n';
	cout << "WA x " << cnt[1] << '\n';
	cout << "TLE x " << cnt[2] << '\n';
	cout << "RE x " << cnt[3] << '\n';

	return 0;
}


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

signed main(){
    ios::sync_with_stdio(false);
	cin.tie(0);
 
    ll n;
    cin>>n;
    ll a[n];
    ll b[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
        b[i]=a[i];
    }
    sort(b,b+n);
    for(int i=0;i<n;i++){
        if(a[i]==b[n-1]){
            cout<<b[n-2]<<endl;
        }
        else cout<<b[n-1]<<endl;
    }


}

Measured memory_bytes: 4736
#include <bits/stdc++.h>
#define fast ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define int long long
using namespace std;
 
const int N = 2e6 + 5;
const int mod = 1e9 + 7;

int a[N];
int occ[N];

int32_t main() {
	fast;
	int n;
	cin>>n;
	for(int i=0; i<n; i++) cin>>a[i];
	bool ok = true;
	for(int i=0; i<n; i++){
		int x = a[i];
		for(int i=2; i*i <=x; i++){
			if(x%i == 0){
				occ[i]++;
				if(occ[i]>1) ok = false;
				while(x%i == 0 ) x/= i;
			}
		}
		if(x!=1) occ[x]++;
		if(occ[x] > 1) ok = false;
	}
	if(ok){
		cout<<"pairwise coprime" <<endl;
		return 0;
	}
	for(int i=1; i<= 1000000; i++){
		if(occ[i] == n){
			cout<<"not coprime" <<endl;
			return 0;
		}
	}
	cout<<"setwise coprime"<<endl;
}





Measured memory_bytes: 19152
var lines: string[] = [];
var reader: any = require("readline").createInterface({
  input: process.stdin,
  output: process.stdout
});
reader.on("line", function(line: string) {
  lines.push(line);
});

reader.on("close", function() {
  var inputs: String[] = lines[1].split(" ");
  switch (new Set(inputs).size) {
    case 3:
      console.log("Three");
      break;
    case 4:
      console.log("Four");
      break;
  }
});


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

typedef long long LL;

const int N=10000000,mod=998244353;

int gcd(int a,int b){return b?gcd(b,a%b):a;}
int add(int a,int b,int p=mod){return a+b>=p?a+b-p:a+b;}
int sub(int a,int b,int p=mod){return a-b<0?a-b+p:a-b;}
int mul(int a,int b,int p=mod){return (LL)a*b%p;}
void sadd(int &a,int b,int p=mod){a=add(a,b,p);}
void ssub(int &a,int b,int p=mod){a=sub(a,b,p);}
void smul(int &a,int b,int p=mod){a=mul(a,b,p);}

int n;

void into(){
  scanf("%d",&n);
}

int inv[N+9],fac[N+9],ifac[N+9];

void Get_inv(){
  inv[1]=1;
  fac[0]=fac[1]=1;
  ifac[0]=ifac[1]=1;
  for (int i=2;i<=n;++i){
	inv[i]=mul(mod-mod/i,inv[mod%i]);
	fac[i]=mul(fac[i-1],i);
	ifac[i]=mul(ifac[i-1],inv[i]);
  }
}

int Get_c(int n,int m){return n<m||m<0?0:mul(fac[n],mul(ifac[m],ifac[n-m]));}

int ans;

void Get_ans(){
  ans=1;
  for (int i=1;i<=n;++i) smul(ans,3);
  int pw=2;
  for (int i=n;i>=n+2>>1;--i) ssub(ans,mul(pw,Get_c(n,i))),smul(pw,2);
}

void work(){
  Get_inv();
  Get_ans();
}

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

int main(){
  into();
  work();
  outo();
  return 0;
}

Measured memory_bytes: 120936
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <vector>
#include <cstdio>
using namespace std;
typedef pair<int ,int> P;
int main(){
	int n, m;
	P time[201];
	cin >> n;
	for(int i = 0; i < n; i++){
		int a, b;
		cin >> a >> b;
		time[i] = make_pair(a, b);
	}
	cin >> m;
	for(int i = n; i < n + m; i++){
		int a, b;
		cin >> a >> b;
		time[i] = make_pair(a, b);	
	}
	sort(time, time + n + m);
	for(int i = 0; i < n + m; i++){
		if(time[i] == time[i + 1])
			continue;
		cout << time[i].first << ":";
		if(!(time[i].second / 10))
			cout << 0;
		cout << time[i].second;
		if(i != n + m - 1)
			cout << ' ';
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 1168