akhauriyash/Code-Regression huggingface dataset:
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <utility>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
#define all(c) (c).begin(), (c).end()
#define loop(i,a,b) for(ll i=a; i<ll(b); i++)
#define rep(i,b) loop(i,0,b)
#define each(e,c) for(auto&e:c)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define lb lower_bound
#define ub upper_bound
#ifdef DEBUG
#define dump(...) (cerr<<#__VA_ARGS__<<" = "<<(DUMP(),__VA_ARGS__).str()<<" ["<<__LINE__<<"]"<<endl)
struct DUMP:ostringstream{template<class T>DUMP &operator,(const T&t){if(this->tellp())*this<<", ";*this<<t;return *this;}};
#else
#define dump(...)
#endif

#include <set>

typedef vector<string> vs;

bool ok(string s){
    rep(i,s.size()/2) if(s[i]!=s[s.size()-1-i]) return false;
    return true;
}

int main(){
    string line;
    while(getline(cin,line)){
        string s;
        for(char c : line) if(isalpha(c)) s += toupper(c);
        vs cand;
        int n=s.size();
        for(int i=n;i>=3;i--){
            rep(j,n-i+1){
                if(ok(s.substr(j,i))) cand.eb(s.begin()+j, s.begin()+j+i);
            }
        }
        cand.erase(unique(all(cand)), cand.end());
        bool used[1111]={};
        rep(j,cand.size()){
            rep(i,j){
                int diff=abs((int)cand[j].size()-(int)cand[i].size());
                diff/=2;
                if(cand[i].size()<cand[j].size()){
                    if(cand[j].substr(diff,cand[i].size())==cand[i]) used[i]=true;
                }
                else{
                    if(cand[i].substr(diff,cand[j].size())==cand[j]){
                        used[j]=true;
                    }
                }
            }
        }
        vs ans;
        rep(i,cand.size()) if(!used[i]) ans.eb(cand[i]);
        ans.erase(unique(all(ans)), ans.end());
        rep(i,ans.size()){
            cout << ans[i];
            if(i+1!=(int)ans.size()) cout << " ";
        }
        cout << endl;
    }
}

Measured memory_bytes: 1220
import sys, math
def input():
    return sys.stdin.readline()[:-1]
from itertools import permutations, combinations
from collections import defaultdict, Counter
from math import factorial
from bisect import bisect_left # bisect_left(list, value)
#from fractions import gcd

sys.setrecursionlimit(10**7)
N = int(input())

if N < 105:
    print(0)
    exit()

cntt = 0
for i in range(1, N+1, 2):
    cnt = 0
    for j in range(1, N+1, 2):
        if i%j==0:
            cnt += 1
    if cnt == 8:
        cntt += 1
print(cntt)


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

using namespace std;
#define endl "\n"

const int MOD = 1e9 + 7;

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

    int64_t n , k;
    cin >> n >> k;
    int64_t arr[n];
	for(int64_t i=0; i<n; i++)
		cin >> arr[i];
    sort(arr,arr+n);

    int64_t sum = 0;
    for(int64_t i=0; i<n-k; i++){
		sum += arr[i];
    }

    cout << sum << endl;


	return 0;
}


Measured memory_bytes: 1792
H, W, m = map(int, input().split())

H_bomb = [0]*H
W_bomb = [0]*W
S = set()

for _ in range(m):
    h, w = map(int, input().split())
    h, w = h-1, w-1
    S.add(tuple([h, w]))
    H_bomb[h] += 1
    W_bomb[w] += 1

H_max = max(H_bomb)
W_max = max(W_bomb)

H_memo = set()
W_memo = set()

for i in range(H):
    if H_bomb[i] == H_max:
        H_memo.add(i)

for j in range(W):
    if W_bomb[j] == W_max:
        W_memo.add(j)

ans = H_max + W_max

# for i in H_memo:
#     for j in W_memo:
#         if tuple([i, j]) not in S:
#             print(ans)
#             exit()

cnt = 0
for s in S:
    if s[0] in H_memo and s[1] in W_memo:
        cnt += 1

if cnt == len(H_memo)*len(W_memo):
    print(ans-1)
else:
    print(ans)

Measured memory_bytes: 194048
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <functional>
#include <ctime>
#include <cmath>
#include <limits>
#include <numeric>
#include <type_traits>
using namespace std;
using ll = long long;

unsigned euclidean_gcd(unsigned a, unsigned b) {
    if (a < b) return euclidean_gcd(b, a);
    unsigned r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

class UnionFind {
public:
    vector <ll> par;
    vector <ll> siz;
    UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL) {
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    void init(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1LL);
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    ll root(ll x) {
        while (par[x] != x) {
            x = par[x] = par[par[x]];
        }
        return x;
    }
    bool merge(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

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

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

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}

int main() {
    int a,b;
    cin >> a >> b;
    UnionFind x(13);
    x.merge(1, 3);
    x.merge(5, 3);
    x.merge(5, 7);
    x.merge(8, 7);
    x.merge(8, 10);
    x.merge(10, 12);
    x.merge(4, 6);
    x.merge(6, 9);
    x.merge(9, 11);
    string ans = "No";
    if (x.issame(a, b))ans = "Yes";
    cout << ans << endl;
}

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

using namespace std;
typedef unsigned long long ll;
const ll mx = 1000000000000000000;

ll a[100006];
int main(){
    ll t;
    cin>>t;
    bool flag = 0;
    for(ll i=1;i<=t;i++){
    	cin>>a[i];
    	if(a[i]==0) flag = 1;
	}
	if(flag ==1){
		cout<<0<<endl;
		return 0;
	}
	ll sum = 1;
	for(ll i=1;i<=t;i++){	
		sum =  sum* a[i];
		if(sum >mx||sum==0){
			cout<<"-1"<<endl;
			return 0;
		}
	}
	cout<<sum<<endl; 
	return 0;
	
} 

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

if __name__ == "__main__":pass
n ,m = i2()
l = [0]*n
for i in range(m):
    s,c = i2()
    if s == 1 and c == 0 and n != 1:
        print(-1)
        exit()
    if l[s-1] == 0 or l[s-1] == c:
        l[s-1] = c
    else:
        print(-1)
        exit()
num = ""
for i in range(n):
    if i == 0 and l[i] == 0 and n != 1:
        num = num + "1"
    else:
        num = num + str(l[i])
num = int(num)
print(num if len(str(num)) == n else -1)

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;

ll nChoose2(ll n){
    return n*(n-1)/2;
}
int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n) {
        cin >> a[i];
    }
    vector<int> tmp(n);
    rep(i,n){
        tmp[a[i]-1]++;
    }
    ll sum = 0;
    vector<ll> ans(n);
    rep(i,n){
        sum += nChoose2(tmp[i]);
    }
    rep(i,n){
        // ll ans = sum;
        // ans -= nChoose2(tmp[a[i]-1]);
        // ans += nChoose2(tmp[a[i]-1]-1);
        // cout << ans << endl;
        ans[i] = sum - nChoose2(tmp[a[i]-1]);
        ans[i] += nChoose2(tmp[a[i]-1]-1);
        cout << ans[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 5760
#include <iostream>
#include <vector>
#include <bitset>
#include <utility>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
 
using namespace std;
typedef long long ll;
 
const ll MOD=1000000007;

int main(){
  int N;
  cin >> N;
  string s;
  cin >> s;
  vector<vector<ll>> dp(N,vector<ll>(N));

  dp[0][0]=1;
  for (int i = 1; i < N; i++){
    if(s[i-1]=='<'){
      for (int j = 1; j <=i; j++){
        dp[i][j]+=dp[i][j-1]+dp[i-1][j-1];
        dp[i][j]%=MOD;
      }
    }else{
      for (int j = i-1; 0<=j; j--){
        dp[i][j]+=dp[i][j+1]+dp[i-1][j];
        dp[i][j]%=MOD;
      }
    }
  }
  
  ll ans=0;
  for (int i = 0; i < N; i++)
  {
    ans+=dp[N-1][i];
    ans%=MOD;
  }
  

  cout << ans << endl;

  return 0;
}


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

using namespace std;

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

    sort(p.begin(), p.end());

    int sum = 0;
    for(int i = 0; i < K; ++i)
    {
        sum += p[i];
    }

    cout << sum << endl;

    return 0;    
}

Measured memory_bytes: 3628
#include <iostream>

using namespace std;

int color[9] = {0};
int ratesup[9] = {400,800,1200,1600,2000,2400,2800,3200,4801};

int main(){
	int N;
	cin >> N;
	int a[N];
	for (int i=0; i<N; i++) {
		cin >> a[i];
		for (int j=0; j<9; j++) {
			if (a[i] < ratesup[j]) {
				color[j]++;
				break;
			}
		}
	}

	int min = 0, max = 0;

	for (int i=0; i<8; i++) {
		if (color[i] > 0) {
			min++;
		}
	}

	
	max = min+color[8];
if (min == 0 && color[8] > 0) min = 1;
	cout << min << " " << max << endl;

	return 0;
}


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

int main() {
  string s;
  int k;
  cin >> s >> k;
  int dp[s.size() + 1][k + 1][2];
  for (int i = 0; i <= k; ++i) {
    dp[0][i][0] = 0;
    dp[0][i][1] = 0;
  }
  dp[0][0][1] = 1;
  for (int i = 1; i <= s.size(); ++i) {
    dp[i][0][0] = 1;
    dp[i][0][1] = 0;
    for (int j = 1; j <= k; ++j) {
      dp[i][j][0] = dp[i - 1][j][0] + dp[i - 1][j - 1][0] * 9;
      if (s[i - 1] == '0') {
        dp[i][j][1] = dp[i - 1][j][1];
      } else {
        dp[i][j][1] = dp[i - 1][j - 1][1];
        dp[i][j][0] += dp[i - 1][j - 1][1] * (s[i - 1] - '0' - 1) + dp[i - 1][j][1];
      }
    }
  }
  cout << dp[s.size()][k][0] + dp[s.size()][k][1];
  return 0;
}


Measured memory_bytes: 384
#include <string.h>
#include <stdio.h>
#define N 100000
int main(void){
    char s[N];
    int i,miss=0;
    scanf("%s",s);
    int len=strlen(s);
    i=len-1;
    while(i>=0){
        if(s[i]=='m'){
            if(s[i-1]=='a'&&s[i-2]=='e'&&s[i-3]=='r'&&s[i-4]=='d'&&i>=4){
                i-=5;
            }else{
                miss=1;
                break;
            }
        }else if(s[i]=='e'){
            if(s[i-1]=='s'&&s[i-2]=='a'&&s[i-3]=='r'&&s[i-4]=='e'&&i>=4){
                i-=5;
            }else{
                miss=1;
                break;
            }
        }else if(s[i]=='r'){
            if(s[i-1]=='e'&&s[i-2]=='s'&&s[i-3]=='a'&&s[i-4]=='r'&&s[i-5]=='e'&&i>=5){
                i-=6;
            }else if(s[i-1]=='e'&&s[i-2]=='m'&&s[i-3]=='a'&&s[i-4]=='e'&&s[i-5]=='r'&&s[i-6]=='d'&&i>=6){
                i-=7;
            }else {
                miss=1;
                break;
            }
        }else{
            miss=1;
            break;
        }
    }
    if(miss)printf("NO\n");
    else printf("YES\n");
    return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
N = int(input())
a = list(map(int, input().split()))
inf = 10 ** 16
if N % 2:
  dp = [[-inf] * 3 for _ in range(N + 2)]
  dp[0][0] = 0
  dp[1][1] = 0
  dp[2][2] = 0
  if N > 4: dp[4][2] = a[0]
  for i in range(N):
    for j in range(3):
      if dp[i][j] == -inf: continue
      if i + 2 <= N + 1: dp[i + 2][j] = max(dp[i + 2][j], dp[i][j] + a[i])
      if i + 3 <= N + 1 and (j < 2): dp[i + 3][j + 1] = max(dp[i + 3][j + 1], dp[i][j] + a[i])
      if i + 4 <= N + 1 and (j == 0): dp[i + 4][j + 1] = max(dp[i + 4][j + 1], dp[i][j] + a[i])
  print(max(dp[-1][-1], dp[-2][-2], dp[-3][-3]))
  #print(dp)
else:
  dp = [[-inf] * 2 for _ in range(N + 2)]
  dp[0][0] = 0
  dp[1][1] = 0
  for i in range(N):
    for j in range(2):
      if dp[i][j] == -inf: continue
      if i + 2 <= N + 1: dp[i + 2][j] = max(dp[i + 2][j], dp[i][j] + a[i])
      if i + 3 <= N + 1 and (j < 1): dp[i + 3][j + 1] = max(dp[i + 3][j + 1], dp[i][j] + a[i])
  print(max(dp[-1][-1], dp[-2][-2]))
  #print(dp)

Measured memory_bytes: 112340
#include <bits/stdc++.h>
#define deb(x) cout << #x << " --> " << x << endl;
#define print(x)                         \
    for (auto _x : x) cout << _x << " "; \
    cout << endl
#define pb push_back
typedef long long ll;
using namespace std;

int main() {
    int a[200] = {};
    bool hash[200] = {};
    int x, n;
    cin >> x >> n;
    for (int i = 0; i < n; ++i) cin >> a[i], hash[a[i]] = true;
    int left = x - 1, right = x + 1;  // BUG : x could no be forbidden
    left = right = x;
    if (n == 0) {
        cout << x << endl;
        return 0;
    } else {
        while (true) {
            if (!hash[left]) {
                cout << left << endl;
                break;
            }
            left--;
            if (!hash[right]) {
                cout << right << endl;
                break;
            }
            right++;
        }
    }
}

Measured memory_bytes: 3572
#include<stdio.h>
int main(void){
	int a,b;
	char op;
	for(;;){
			scanf("%d %c %d",&a,&op,&b);
	if(op=='+'){
		printf("%d\n",a+b);
	}
	else if(op=='-'){
		printf("%d\n",a-b);
	}
	else if(op=='*'){
		printf("%d\n",a*b);
	}
	else if(op=='/'){
		printf("%d\n",a/b);
	}
	else if(op=='?'){
		break;
	}
	}
	return 0;
	
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int inf=1e5+9,I=109,mod=1e9+7;
ll a[I],dp[inf][I],par[inf][I];
///partial sum of the dp array where par[i][j] sum of dp[0][j] dp[1][j].. to dp[i][j]
int main(){

    ll n,k;
    cin>>n>>k;
    for(ll i=1;i<=n;i++)
        cin>>a[i];

    for(ll i=0;i<=k;i++){
        for(ll j=1;j<=n;j++){

            if(j==1)
                dp[i][j]=(a[j]>=i);
            else {
                ll x=min(i,a[j]);
                dp[i][j]=(par[i][j-1]-par[i-x][j-1]+dp[i-x][j-1]+mod)%mod;;
            }
            if(i)
                par[i][j]=(dp[i][j]+par[i-1][j])%mod;
            else
                par[i][j]=dp[i][j];
        }
    }
    cout<<dp[k][n]<<endl;
}


Measured memory_bytes: 170624
#include <algorithm>
#include <iterator>
#include <iostream>
#include <iomanip>
#include <cassert>
#include <utility>
#include <string>
#include <vector>
#include <limits>
#include <queue>
#include <cmath>
#include <map>
#include <set>

using namespace std;

using ll = long long;

int main()
{
    static const vector<string> w = { "Sunny", "Cloudy", "Rainy" };
    string s;
    cin >> s;

    auto it = find(w.begin(), w.end(), s);
    int pos = distance(w.begin(), it);

    cout << w[(pos + 1) % w.size()] << endl;


    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void){
    int coordinate[5];
    int able = 1, k, i;

    for(i=0; i<5; i++){
        scanf("%d", &coordinate[i]);
        getchar();
    }
    scanf("%d", &k);

    able = (coordinate[4] - coordinate[0] <= k);

    if(able) printf("Yay!");
    else printf(":(");

    return 0;
}

Measured memory_bytes: 128
S = $stdin.gets.chomp

k0 = S.size/2
#p k0

ans = k0
all_zero = true
all_one = true
((k0+1)..S.size).each { |k|
  iu = 0+k-1
  id = (S.size-1)-(k-1)
  if id <= iu 
    all_zero = all_zero && S[iu] == "0" && S[id] == "0"
    all_one  = all_one  && S[iu] == "1" && S[id] == "1"
    #p [k,id,iu,S[id..iu],all_zero,all_one]
    break if !(all_zero or all_one)
  end
  ans = k
}

puts ans



Measured memory_bytes: 3964
import numpy as np
import sys
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
 
num_str = input()

num_sum = 0
for i in range(len(num_str)):
  num_sum+=int(num_str[i])
 
if num_sum%9 == 0:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 27096
#include<iostream>
#include<string.h>
#include<ctype.h>
#include<string>
#include<math.h>
#define pi 3.141592653589
#include<iomanip>
#include<vector>
using namespace std;
#include<algorithm>
#define rep(i,a,n) for(int i=a;i<n;i++)
#define INF 1e9
#define LINF 1e17
#define ll long long
#define MOD (int)(1e9+7)

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


int main() {

	int a, b, c, d;

	cin >> a >> b >> c >> d;
	if (a <= c) {
		if (b <= c)cout << "0" << endl;
		else if (b <= d)cout << b - c << endl;
		else cout << d - c << endl;
	}
	else {
		if (d <= a)cout << "0" << endl;
		else if (d <= b)cout << d - a << endl;
		else cout << b - a << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<int, int> P;
typedef pair<ll, P> E;
#define cost first
#define from second.first
#define to second.second
#define MOD (1000000007ll)
#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

int main(void){
	int n,i,l=0,r=0;
	string s;
	cin >> n;
	cin >> s;
	for(i=0; i<n; i++){
		if(s[i]=='('){
			r++;
			continue;
		}
		if(r>0){
			r--;
		}else{
			l++;
		}
	}
	for(i=0; i<l; ++i){
		cout << "(";
	}
	cout << s;
	for(i=0; i<r; ++i){
		cout << ")";
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define double long double
#define rep(i, a, n) for(int i = (int)(a);(i) < (int)(n);++(i))
#define repe(i, a, n) for(int i = (int)(a);(i) <= (int)(n);++(i))
#define repif(i, a, x) for(int i = (int)(a);(x);++(i))
#define repr(i, a, n) for(int i = ((int)(a)-1);(i) >= (int)(n);--(i))
#define reper(i, a, n) for(int i = (int)(a);(i) >= (int)(n);--(i))
#define SZ(x) ((int)(x).size())
#define ALL(x) begin(x), end(x)
#define CEIL(x) ((int)ceil(((double)x)))
#define POW(x, y) ((int)pow(x, y))
#define UNIQUE(x) (x).erase(unique(ALL((x))), end(x))
#define gcd(x, y) __gcd(x, y)
#define lcm(x, y) ((x)/gcd(x,y)*(y))
using namespace std;
using VI = vector<int>;
using VVI = vector<vector<int>>;
using PII = pair<int, int>;
using TIII = tuple<int, int, int>;
using VPII = vector<pair<int, int>>;
using VTIII = vector<tuple<int, int, int>>;
using Complex = complex<double>;
template<typename T> inline bool chmax(T& a, const T& b, bool t = false){ if(a<b or (t and a==b)){ a=b; return true; } return false; }
template<typename T> inline bool chmin(T& a, const T& b, bool t = false){ if(a>b or (t and a==b)){ a=b; return true; } return false; }
template<typename T> inline bool isin(const T& x, const T& l, const T& r){ return l <= x and x < r; }
inline ostream& fcout(int n = 10){ return cout << fixed << setprecision(n); }
inline ostream& rcout(int n = 2){ return cout << right << setw(n); }
constexpr int64_t INF = numeric_limits<int64_t>::max();
constexpr int32_t INF32 = numeric_limits<int32_t>::max();
constexpr int64_t MOD = 1000000007LL;
constexpr double PI = 3.14159265358979323846264338327950288;
constexpr double EPS = 1e-10;


int32_t main(){
    int n;
    while(cin >> n, n){
        vector<int> s(24*3600+10);
        rep(i, 0, n){
            string t1, t2;
            stringstream ss;
            cin >> t1 >> t2;
            replace(ALL(t1), ':', ' ');
            replace(ALL(t2), ':', ' ');
            ss << t1;
            int a, b, c;
            ss >> a >> b >> c;
            s[a*3600+b*60+c]++;
            ss.clear();
            ss << t2;
            ss >> a >> b >> c;
            s[a*3600+b*60+c]--;
        }
        int ans = 1;
        rep(i, 0, 24*3600){
            s[i+1] += s[i];
            chmax(ans, s[i]);
        }
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 3820
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def main():
    n=int(input())
    floor=n*100//108
    ceil=(n*100+107)//108
    if floor*108//100==n:
        print(floor)
    elif ceil*108//100==n:
        print(ceil)
    else:print(":(")
main()

Measured memory_bytes: 3064
#import numpy as np

def knapsack2(N,W,weight,value,WW):
  #初期化
  inf=float("inf")
  dp=[[-inf for i in range(WW)] for j in range(N+1)]
  for i in range(WW):
      dp[0][i]=0
  maxval = 0
  #DP
  for i in range(N):
    for w in range(WW):
      if weight[i]<=w:
        if w-weight[i]>=W: #時間切れ
          dp[i+1][w]=dp[i][w]
        else: #注文可能
          dp[i+1][w]=max(dp[i][w-weight[i]]+value[i], dp[i][w])
      else: #NG
        dp[i+1][w]=dp[i][w]
    maxval = max([maxval, max(dp[i+1])])
#  for elem in dp:
#    print(elem[:2*W])
  return maxval
  #return np.max(np.array(dp))
  #return dp[N][2*W]

N, T = map(int,input().split())
WW = T+3000
ab = []
for i in range(N):
    ab.append(tuple(map(int,input().split())))

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

weight = [elem[0] for elem in ab]
value = [elem[1] for elem in ab]
res = knapsack2(N,T,weight,value,WW)
print(res)


Measured memory_bytes: 361392
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stdlib.h>
#include <map>
#include <cmath>
#define MOD_P 1000000007
#define MOD_Q 998244353
#define PI 3.14159265358979
#define ll long long
using namespace std;

void swap(int& a, int& b)
{
	int tmp;
	tmp = a;
	a = b;
	b = tmp;
}

struct UnionFind {
	vector<int> d;
	UnionFind(int n) :d(n, -1) {};

	int root(int x)
	{
		if (d[x] < 0)return x;
		return d[x] = root(d[x]);
	}

	bool Union(int x, int y)
	{
		x = root(x);
		y = root(y);
		if (x == y)return false;
		if (d[x] > d[y]) swap(x, y);
		d[x] += d[y];
		//printf("d[%d] = %d, d[%d] = %d\n", x, d[x], y, d[y]);
		d[y] = x;
		return true;
	}
	bool same(int x, int y)
	{
		return root(x) == root(y);
	}
	int size(int x)
	{
		return -d[root(x)];
	}
};



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

	for (int i = 0; i < m; i++) {
		int x, y;
		cin >> x >> y;
		x--;
		y--;
		ob.Union(x, y);
	}
	int ans = 0;

	for (int i = 0; i < n; i++) {
		int s = ob.size(i);
		if (ans < s)ans = s;
	}

	printf("%d", ans);

	return 0;
}


Measured memory_bytes: 4056
import java.util.*;
import static java.lang.System.*;

class Main {
	public static Scanner sc = new Scanner(in);
	public static Random rand=new Random();

	public int parse(String str){
		String[] l=str.split(":");
		return Integer.parseInt(l[0])*3600+Integer.parseInt(l[1])*60+Integer.parseInt(l[2]);
	}

	public void run() {
		while(true){
			int n=sc.nextInt();
			if(n==0)return;
			int[] imos=new int[3600*24];
			while(n--!=0){
				int from=parse(sc.next());
				int to=parse(sc.next());
				imos[from]++;
				imos[to]--;
			}
			int max=0;
			int now=0;
			for(int i=0;i<imos.length;i++){
				now+=imos[i];
				max=Math.max(now,max);
			}
			ln(max);

		}
	}
	public static void main(String[] args) {
		new Main().run();
	}

	public int[] nextIntArray(int n){
		int[] res=new int[n];
		for(int i=0;i<n;i++){
			res[i]=sc.nextInt();
		}
		return res;
	}
	public static void pr(Object o) {
		out.print(o);
	}
	public static void ln(Object o) {
		out.println(o);
	}
	public static void ln() {
		out.println();
	}
}

Measured memory_bytes: 101044
from functools import reduce

mod = 10**9+7

def modcumprod(*args):
    return reduce(lambda x, y: x*y%mod, args)

n, k = map(int, input().split())
a = list(map(int, input().split()))

if n == k:
    print(modcumprod(*a))
elif max(a) < 0 and k % 2 == 1:
    a.sort(reverse=True)
    print(modcumprod(*a[:k]))
else:
    a.sort(key=abs, reverse=True)
    res = 1
    cnt_neg = 0
    pos1 = neg1 = 0
    for e in a[:k]:
        res *= e
        res %= mod
        if e > 0:
            pos1 = e
        else:
            cnt_neg += 1
            neg1 = e

    if res == 0 or cnt_neg % 2 == 0:
        print(res)
    else:
        pos2 = neg2 = 0
        for e in a[k:]:
            if e > 0 and not pos2:
                pos2 = e
            elif e < 0 and not neg2:
                neg2 = e
            if pos2 and neg2:
                break
        if abs(pos1 * pos2) < abs(neg1 * neg2) and pos1:
            res *= pow(pos1, -1, mod)
            res *= neg2
            res %= mod
        else:
            res *= pow(neg1, -1, mod)
            res *= pos2
            res %= mod
        print(res)


Measured memory_bytes: 32248
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<iomanip>
#include<math.h>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
#define LINF (long long)4e18

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;


int main(){
    int K,X; cin >> K >> X;
    repr(i,X-K+1,X+K){
        cout << i;
        if(i != X+K-1) cout << " ";
    }
    cout << endl;
  
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define M 200005
#define D long double
#define PI acos(-1)
#define y1 XFZSBSBSBSBSBSBBSBSBSBSBSBSBSBSBSBSBSBSBSBSBSBSBSBSBSBSBSBSBSB
using namespace std;
int x1,x2,y1,y2,n;
struct node{int x,y;friend bool operator <(node a,node b){return a.x<b.x;}}a[M];
int s[M]={0},m=0;
int main(){
	scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
	int X=x1>x2?-1:1,Y=y1>y2?-1:1;
	x1*=X; x2*=X; y1*=Y; y2*=Y;
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d%d",&a[i].x,&a[i].y);
		a[i].x*=X; a[i].y*=Y;
		if(!(x1<=a[i].x&&a[i].x<=x2&&y1<=a[i].y&&a[i].y<=y2)) 
		{i--; n--; continue;}
	}
	sort(a+1,a+n+1);
	for(int i=1;i<=n;i++){
		if(m==0||s[m]<a[i].y) s[++m]=a[i].y;
		else{
			int cnt=lower_bound(s+1,s+m+1,a[i].y)-s;
			s[cnt]=a[i].y;
		}
	}
	D ans=100.*((x2-x1)+(y2-y1));
	ans=ans-(20.-5.*PI)*m;
	if(m==min((x2-x1)+1,(y2-y1)+1)) ans+=5*PI;
	printf("%.20Lf\n",ans);
}

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

vector<int> to[200005];
vector<int> ans;
void dfs(int v, int p=-1) {
  for (int u : to[v]) {
    if (u == p) continue;
    ans[u] += ans[v];
    dfs(u,v);
  }
}

int main() {
  int n, q;
  cin >> n >> q;
  rep(i,n-1) {
    int a, b;
    cin >> a >> b;
    --a; --b;
    to[a].push_back(b);
    to[b].push_back(a);
  }
  ans.resize(n);
  rep(i,q) {
    int p, x;
    cin >> p >> x;
    --p;
    ans[p] += x;
  }
  dfs(0);
  rep(i,n) {
    cout << ans[i] << endl;
  }
  return 0;
}

Measured memory_bytes: 23424
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())

using namespace std;
using ll = long long;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
constexpr int INF = 1001001001;
constexpr long long INFL = (1LL<<60);
constexpr double eps = (1e-9);

int solve(vector<string> c, set<int> hh, set<int> ww) {
  int h = c.size();
  int w = c[0].size();
  for (int i = 0; i < h; i++) {
    if (hh.count(i) == 0) continue;
    for (int j = 0; j < w; j++) c[i][j] = '.';
  }

  for (int j = 0; j < w; j++) {
    if (ww.count(j) == 0) continue;
    for (int i = 0; i < h; i++) c[i][j] = '.';
  }
  int ans = 0;
  rep(i, h) rep(j, w) if (c[i][j] == '#') ans++;
  return ans;
}

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

  int h, w, k;
  cin >> h >> w >> k;
  vector<string> c(h);
  rep(i, h) cin >> c[i];

  int ans = 0;

  for (int b1 = 0; b1 < (1<<h); ++b1) {
    for (int b2 = 0; b2 < (1<<w); b2++) {
      set<int> bh, bw;
      for (int i = 0; i < h; i++) if ((b1 >> i) & 1) bh.insert(i);
      for (int i = 0; i < w; i++) if ((b2 >> i) & 1) bw.insert(i);
      int num = solve(c, bh, bw);
      if (num == k) ans++;
    }
  }

  cout << ans << endl;

  return 0;
}


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

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i = 0;i < n - 1;i++){
        int aa;
        cin >> aa, aa--;
        a[aa]++;
    }
    for(auto& e : a) cout << e << endl;
}

Measured memory_bytes: 4052
use std::collections::BTreeMap;

fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let n = sc.read();
    let a: Vec<usize> = sc.vec(n);

    if (1..n).all(|i| a[i] > a[i - 1]) {
        println!("1");
        return;
    }

    let mut ok = n;
    let mut ng = 0;
    while ok - ng > 1 {
        let x = (ok + ng) / 2;
        if solve(&a, x) {
            ok = x;
        } else {
            ng = x;
        }
    }

    println!("{}", ok + 1);
}

fn solve(a: &Vec<usize>, limit: usize) -> bool {
    let mut state = State {
        map: BTreeMap::new(),
        limit: limit,
    };

    let n = a.len();
    let mut start = 0;
    for i in 1..n {
        if a[i] <= a[i - 1] {
            state.increment(a[i]);
            start = i + 1;
            break;
        }
    }

    for i in start..n {
        if a[i] <= a[i - 1] {
            state.resize(a[i]);
            if !state.increment(a[i]) {
                return false;
            }
        }
    }
    true
}

struct State {
    map: BTreeMap<usize, usize>,
    limit: usize,
}

impl State {
    fn increment(&mut self, i: usize) -> bool {
        if let Some(&cur) = self.map.get(&i) {
            if cur == self.limit {
                self.map.remove(&i);
                if i == 1 {
                    false
                } else {
                    self.increment(i - 1)
                }
            } else {
                *self.map.get_mut(&i).unwrap() += 1;
                true
            }
        } else {
            self.map.insert(i, 1);
            true
        }
    }
    fn resize(&mut self, size: usize) {
        while let Some(&key) = self.map.keys().next_back() {
            if key > size {
                self.map.remove(&key);
            } else {
                break;
            }
        }
    }
}

pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n')
            .take_while(|&b| b != b' ' && b != b'\n')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 6524
#include <iostream>
#include <vector>
#include <utility>
#include <set>
#include <algorithm>
using namespace std;

int n, m, k; 
vector<int> f[100010];
int res[100010], id[100010];

void dfs(int v, int i, set<int>& vis)
{
    vis.insert(v);
    id[v]=i;
    for(int u: f[v]) if (!vis.count(u)) dfs(u, i, vis);
}

int main()
{
    cin>>n>>m>>k;
    for(int i=0; i<m; ++i) {
        int a, b; cin>>a>>b;
        --a, --b;
        f[a].push_back(b);
        f[b].push_back(a);
    }

    for(int i=0; i<n; ++i) id[i]=i;
    for(int i=0; i<n; ++i) if (id[i]==i) {
        set<int> vis;
        dfs(i, i, vis);
        for(int v: vis) res[v]=vis.size()-1-f[v].size();
    }

    for(int i=0; i<k; ++i) {
        int c, d; cin>>c>>d;
        --c, --d;
        if (id[c]==id[d])
            --res[c], --res[d];
    }

    for(int i=0; i<n; ++i) cout<<res[i]<<' ';
    cout<<endl;
}


Measured memory_bytes: 12152
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#define MOD 1000000007
#define mkp make_pair
typedef long long ll;
using namespace std;

class DisjointSet{
public:
  vector<int> rank,p;
  vector<int> sz;
 
  DisjointSet(){}
  DisjointSet(int size){
    rank.resize(size,0);
    p.resize(size,0);
    sz.resize(size,0);
    for(int i=0;i<size;i++) makeSet(i);
  }
 
  void makeSet(int x){
    p[x]=x;
    rank[x]=0;
    sz[x]=1;
  }
 
  bool same(int x,int y){
    return findSet(x)==findSet(y);
  }
 
  void unite(int x,int y){
    link(findSet(x),findSet(y));
  }
 
  void link(int x,int y){
    if(rank[x]>rank[y]){
      p[y]=x;
      sz[x]+=sz[y];
    }else{
      p[x]=y;
      sz[y]+=sz[x];
      if(rank[x]==rank[y]){
        rank[y]++;
      }
    }
  }
 
  int findSet(int x){
    if(x!=p[x]){
      p[x]=findSet(p[x]);
    }
    return p[x];
  }
 
  int findSize(int x){
    return sz[findSet(x)];
  }
};

int N,K,L;

int main(){
  cin>>N>>K>>L;
  DisjointSet usk(N),usl(N);
  for(int i=0;i<K;i++){
      int a,b;
      cin>>a>>b;
      a--;
      b--;
      if(usk.same(a,b));
      else usk.unite(a,b);
  }
  for(int i=0;i<L;i++){
      int a,b;
      cin>>a>>b;
      a--;
      b--;
      if(usl.same(a,b));
      else usl.unite(a,b);
  }

  map<pair<int,int>,int> mp;
  for(int i=0;i<N;i++){
      int x=usk.findSet(i);
      int y=usl.findSet(i);
      mp[mkp(x,y)]++;
  }

  vector<int> ans(N,0);
  for(int i=0;i<N;i++){
      int x=usk.findSet(i);
      int y=usl.findSet(i);
      ans[i]=mp[mkp(x,y)];
  }

  for(int i=0;i<N;i++) cout<<ans[i]<<" ";
  cout<<endl;

  return 0;
}


Measured memory_bytes: 17408
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i,n,m) for(int i=(n);i<(m);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
#define REPR(i,n) for(int i=(n);i>=0;i--)
#define all(vec) vec.begin(),vec.end()
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using P=pair<ll,ll>;
using PP=pair<ll,P>;
using vp=vector<P>;
using vpp=vector<PP>;
using vs=vector<string>;
#define fi first
#define se second
#define pb push_back
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}
template<typename A,typename B>istream&operator>>(istream&is,pair<A,B> &p){is>>p.fi>>p.se;return is;}
template<typename A,typename B>ostream&operator<<(ostream&os,const pair<A,B> &p){os<<"("<<p.fi<<","<<p.se<<")";return os;}
template<typename T>istream&operator>>(istream&is,vector<T> &t){REP(i,t.size())is>>t[i];return is;}
template<typename T>ostream&operator<<(ostream&os,const vector<T>&t){os<<"{";REP(i,t.size()){if(i)os<<",";os<<t[i];}cout<<"}";return os;}
const ll MOD=1000000007LL;
const int INF=1<<30;
const ll LINF=1LL<<60;
int main(){
    int n,k;
    cin>>n>>k;
    cout<<n-k+1<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long n,ans;
int main(){
  cin >> n;
  for(long long int i = 2; i <= sqrt(n); i++){
    long long x = i;
    while(n % x == 0){
      n = n/x;
      x = x*i;
      ans++;
    }
    while(n%i == 0) n = n/i;
  }
  if(n != 1) ans++;
  cout << ans << endl;
}

Measured memory_bytes: 3680
#include <bits/stdc++.h>
using namespace std;
using lint = long long;

lint Power(lint n, lint x, lint mod) {
  if (x == 0) return 1;
  lint res = Power(n, x / 2, mod);
  res = res * res % mod;
  if (x & 1) res = res * n % mod;
  return res;
}

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

  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(begin(a), end(a), [&](int i, int j) { return abs(i) < abs(j); });
  reverse(begin(a), end(a));
  lint ans = 1;
  const lint mod = 1e9 + 7;
  int neg = 0;
  for (int i = 0; i < k; i++) {
    ans *= abs(a[i]);
    ans %= mod;
    if (a[i] < 0) {
      neg++;
    }
    if (a[i] == 0) {
      cout << 0 << "\n";
      return 0;
    }
  }
  if (neg & 1) {
    int lastneg = -1;
    int lastpos = -1;
    int nextneg = -1;
    int nextpos = -1;
    for (int i = 0; i < k; i++) {
      if (a[i] < 0) {
        lastneg = i;
      }
      if (a[i] > 0) {
        lastpos = i;;
      }
    }
    for (int i = k; i < n; i++) {
      if (nextneg == -1 && a[i] < 0) {
        nextneg = i;
      }
      if (nextpos == -1 && a[i] > 0) {
        nextpos = i;
      }
    }
    vector<pair<lint, lint>> ratios;
    if (lastneg != -1 && nextpos != -1) {
      ratios.emplace_back(abs(a[nextpos]), abs(a[lastneg]));
    }
    if (lastpos != -1 && nextneg != -1) {
      ratios.emplace_back(abs(a[nextneg]), abs(a[lastpos]));
    }
    sort(begin(ratios), end(ratios), [&](pair<lint, lint> p, pair<lint, lint> q) {
      return p.first * q.second < q.first * p.second;
    });
    if (!ratios.empty()) {
      ans *= Power(ratios.back().second, mod - 2, mod);
      ans %= mod;
      ans *= ratios.back().first;
      ans %= mod;
    } else {
      ans = 1;
      sort(begin(a), end(a));
      reverse(begin(a), end(a));
      for (int i = 0; i < k; i++) {
        ans *= a[i];
        ans %= mod;
      }
    }
  }
  if (ans < 0) ans += mod;
  cout << ans << "\n";
  return 0;
}


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

int main() {
    int a,b,h,m;cin>>a>>b>>h>>m;
    double min_x=b,min_y=0,hour_x=a,hour_y=0;
    double pi=3.14159265358979;
    hour_x=a*cos(2*pi*(60*h+m)/720);
    hour_y=a*sin(2*pi*(60*h+m)/720);
    min_x=b*cos(2*pi*m/60);
    min_y=b*sin(2*pi*m/60);
    double dis=sqrt(pow(abs(hour_x-min_x),2)+pow(abs(hour_y-min_y),2));
    printf("%.15lf",dis);
}

Measured memory_bytes: 4100
import java.util.*;

public class Main{
	public static void main(String[] $){
		System.err.println();
		Scanner s=new Scanner(System.in);
		int n=s.nextInt();
		int m=s.nextInt();
		//int[] a=new int[n];
		//Arrays.setAll(a,i->s.nextInt());

		System.out.println(500*n>=m?"Yes":"No");
	}
}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
typedef  long long  ll;
ll inf=1000000000000000000,mod=1000000007,BS,k;
ll fun(ll l,ll r){
    if(l>r)return 0;
    ll num;
    num=(r-l)/3+1;
    return num;
}
int main(){
    ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        
        ll x,n;map<ll,ll> mp;
        ll num;cin>>x>>n;
        for(ll i=0;i<n;i++){
            cin>>num;
            mp[num]=1;
        }
        for(ll i=0;;i++){
            if(mp[x-i]==0){
            cout<<x-i;return 0;}
            if(mp[x+i]==0){
            cout<<x+i;return 0;}
        }
}


Measured memory_bytes: 3624
import bisect

n=int(input())
a=list(map(int, input().split())) 
b=list(map(int, input().split())) 
c=list(map(int, input().split())) 

a.sort()
b.sort()
c.sort()
count1=0
count2=0
ans=0

for i in range(n):
    count1 = bisect.bisect_left(a, b[i])
    count2 = n-bisect.bisect_left(c, b[i]+1)
    ans+=count1*count2
    count1=0
    count2=0
print(ans)
    

Measured memory_bytes: 23360
from scipy.sparse.csgraph import dijkstra

# 二部グラフ完全マッチング
# 最大フロー
N = int(input())
NN = N * 2
XY = [[int(x) for x in input().split()] for _ in range(NN)]
graph = [[0] * (NN+2) for _ in range(NN+2)]
start = NN
goal = NN+1

for i,(a,b) in enumerate(XY[:N]):
  for j,(c,d) in enumerate(XY[N:], N):
    if a < c and b < d:
      graph[i][j] = 1

for i in range(N):
  graph[start][i] = 1
for i in range(N,NN):
  graph[i][goal] = 1
  
INF = 10 ** 9

def max_flow(graph):
  dist, pred = dijkstra(graph, indices = start, return_predecessors = True)
  if dist[goal] > INF:
    return 0
  y = goal
  while y != start:
    x = pred[y]
    graph[x][y] -= 1
    graph[y][x] += 1
    y = x
  return 1 + max_flow(graph)
 
answer = max_flow(graph)
print(answer)

Measured memory_bytes: 17824
#include<bits/stdc++.h>
using namespace std;
#define N 1000 + 5
#define Mod 1000000007
#define rep(i, l, r) for(int i = l; i <= r; ++i)
int n, A, B, C, D, fac[N], inv[N], c[N][N], P[N][N], dp[N][N];
int read(){
    char c; int x = 0, f = 1;
    c = getchar();
    while(c > '9' || c < '0'){ if(c == '-') f = -1; c = getchar();}
    while(c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
    return x * f;
}
int Inc(int a, int b){
    return (a += b) >= Mod ? a - Mod : a;
}
int Mul(int a, int b){
    return 1ll * a * b % Mod;
}
int Qpow(int a, int b){
    int ans = 1;
    while(b){
        if(b & 1) ans = Mul(ans, a);
        a = Mul(a, a), b >>= 1;
    }
    return ans;
}
int main(){
    n = read(), A = read(), B = read(), C = read(), D = read();
    fac[0] = inv[0] = 1;
    rep(i, 1, n) fac[i] = Mul(fac[i - 1], i), inv[i] = Qpow(fac[i], Mod - 2);
    rep(i, 0, n) c[i][0] = 1;
    rep(i, 1, n) rep(j, 1, i) c[i][j] = Inc(c[i - 1][j - 1], c[i - 1][j]);
    rep(i, 1, n) rep(j, 1, n) P[i][j] = Qpow(Qpow(fac[i], j), Mod - 2);
    dp[A - 1][0] = 1;
    rep(i, A, B) rep(j, 0, n){
        dp[i][j] = dp[i - 1][j];
        rep(k, C, min(D, j / i))
            dp[i][j] = Inc(dp[i][j], Mul(dp[i - 1][j - i * k], Mul(fac[i * k], Mul(Mul(P[i][k], inv[k]), c[n - j + i * k][i * k]))));
    }
    printf("%d", dp[B][n]);
    return 0;
}

Measured memory_bytes: 15356
const main = stdin => {
    const input = stdin.trim().split('\n')
    //ここにかく
    //A円で一回聞ける
    const A = parseInt(input[0].split(" ")[0]);
    //所持金
    const B = parseInt(input[0].split(" ")[1]);
    //最大値Cと比較
    const C = parseInt(input[0].split(" ")[2]);
    
    const sound = Math.floor(B/A);
    let Maxsound;
    if (sound < C){
        Maxsound = sound;
    } else {
        Maxsound = C;
    }
    console.log(Maxsound);
    }
    // 標準入力
    main(require("fs").readFileSync("/dev/stdin", "utf8"))

Measured memory_bytes: 29588
#include<stdio.h>

int main(void){
    int a, b, ans;

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

    if(a > b){
        ans = 2 * a -1;
    }
    else if(a == b){
        ans = 2 * a;
    }
    else{
        ans = 2 * b - 1;
    }

    printf("%d", ans);

    return 0;
}

Measured memory_bytes: 128
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <map>
#include <numeric>
#include <queue>
#include <sstream>
#include <string>
#include <string.h>
#include <tuple>
#include <vector>

#define REP(i,x) for(int i{ 0 }; i < (int)(x); i++)
#define REPC(i,x) for(int i{ 0 }; i <= (int)(x); i++)
#define RREP(i,x) for(int i{ (int)(x) - 1 }; i >= 0 ;i--)
#define RREPC(i,x) for(int i{ (int)(x)}; i >= 0; i--)
#define REP1O(i,x) for(int i{ 1 }; i < (int)(x); i++)
#define REP1C(i,x) for(int i{ 1 }; i <= (int)(x); i++)

#define PB push_back
#define MP make_pair
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()

using namespace std;

typedef int64_t ll;
typedef double dbl;
typedef vector<bool> Vb;
typedef vector<char> Vc;
typedef vector<double> Vd;
typedef vector<int> Vi;
typedef vector<ll> Vl;
typedef vector<string> Vs;
typedef vector<vector<int>> VVi;
typedef vector<vector<ll>> VVl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;

template<class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
inline void swap(ll& a, ll& b) { a ^= b; b ^= a; a ^= b; }
inline void swap(int& a, int& b) { a ^= b; b ^= a; a ^= b; }
inline void YES() { cout << "YES" << endl; } inline void Yes() { cout << "Yes" << endl; }
inline void NO() { cout << "NO" << endl; } inline void No() { cout << "No" << endl; }

const int inf = 1 << 30;
const ll linf = 1LL << 60;
const int MOD = 1000000007;


int main()
{
	int a, b; cin >> a >> b;

	int ans = -inf;
	chmax(ans, a + b);
	chmax(ans, a - b);
	chmax(ans, a * b);

	cout << ans << endl;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i))
#define rep(i,j) FOR(i,0,j)
#define each(x,y) for(auto &(x):(y))
#define mp make_pair
#define MT make_tuple
#define all(x) (x).begin(),(x).end()
#define debug(x) cout<<#x<<": "<<(x)<<endl
#define smax(x,y) (x)=max((x),(y))
#define smin(x,y) (x)=min((x),(y))
#define MEM(x,y) memset((x),(y),sizeof (x))
#define sz(x) (int)(x).size()
#define RT return
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vll = vector<ll>;

template<int MOD>
class ModInt {
public:
    ModInt() :value(0) {}
    ModInt(long long val) :value((int)(val<0 ? MOD + val % MOD : val % MOD)) { }

    ModInt& operator+=(ModInt that) {
        value = value + that.value;
        if (value >= MOD)value -= MOD;
        return *this;
    }
    ModInt& operator-=(ModInt that) {
        value -= that.value;
        if (value<0)value += MOD;
        return *this;
    }
    ModInt& operator*=(ModInt that) {
        value = (int)((long long)value * that.value % MOD);
        return *this;
    }
    ModInt &operator/=(ModInt that) {
        return *this *= that.inverse();
    }
    ModInt operator+(ModInt that) const {
        return ModInt(*this) += that;
    }
    ModInt operator-(ModInt that) const {
        return ModInt(*this) -= that;
    }
    ModInt operator*(ModInt that) const {
        return ModInt(*this) *= that;
    }
    ModInt operator/(ModInt that) const {
        return ModInt(*this) /= that;
    }
    ModInt pow(long long k) const {
        ModInt n = *this, res = 1;
        while (k) {
            if (k & 1)res *= n;
            n *= n;
            k >>= 1;
        }
        return res;
    }
    ModInt inverse() const {
        long long a = value, b = MOD, u = 1, v = 0;
        while (b) {
            long long t = a / b;
            a -= t * b;
            swap(a, b);
            u -= t * v;
            swap(u, v);
        }
        return ModInt(u);
    }
    int toi() const { return value; }

private:
    int value;
};
typedef ModInt<1000000007> mint;
ostream& operator<<(ostream& os, const mint& x) {
    os << x.toi();
    return os;
}

const int R = 100005;
int N;
vi G[R];

mint dp[R][2];

mint f(int u, int b, int p) {
    mint &re = dp[u][b];
    if (re.toi() != -1)RT re;
    re = 0;
    rep(bb, 2) {
        if (b&&bb)continue;
        mint x = 1;
        each(v, G[u])if (v != p) {
            x *= f(v, bb, u);
        }
        re += x;
    }
    RT re;
}

void solve() {
    MEM(dp, -1);

    cin >> N;
    rep(i, N - 1) {
        int x, y;
        cin >> x >> y;
        --x;
        --y;
        G[x].push_back(y);
        G[y].push_back(x);
    }
	
    cout << f(0, 0, -1) << endl;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(15);
	solve();
	return 0;
}

Measured memory_bytes: 17664
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<string>
#include<iostream>
using namespace std;

const int MOD=1e9+7;
const int MAXN=5005;
typedef long long ll;

int n,m;
ll d[MAXN][MAXN];

int main(){
    string s;
    scanf("%d",&n);
    cin >> s; m=s.length();
    d[0][0]=1;
    for(int j=1;j<=n;j++)
        for(int i=0;i<=n;i++){
            if(i!=n) d[i][j]+=2ll*d[i+1][j-1];
            if(i!=0) d[i][j]+=d[i-1][j-1];
            if(i==0) d[i][j]+=d[i][j-1];
            d[i][j]%=MOD;
        }
    printf("%lld",d[m][n]);
}


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

int main() {
    int n;
    cin >> n;
    priority_queue<int, vector<int>, greater<int>> vq;
    rep(i,n) {
        int v;
        cin >> v;
        vq.push(v);
    }

    double ans = vq.top();
    vq.pop();

    while(!vq.empty()){
        ans = (ans + (double)vq.top())/2;
        vq.pop();
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
    long long h;
    cin >> h;
    long long ans = 1;
    long long now = 1;
    long long add = 1;
    while(now < h){
        add *= 2;
        ans += add;
        h /= 2;
    }
    cout << ans << "\n";
}

Measured memory_bytes: 256