akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define PI 3.141592653589
#define ll long long
using namespace std;

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

  int a[n];
  int sum =0;

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

  if(h-sum <= 0){
    cout << "Yes";
  }
  else cout << "No";

}

Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>

#define forn(i,n) for(int i = 0;i<int(n);i++)
#define ll long long
#define BIG 1000000007

using namespace std;

int main(){
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(NULL);
  ll N,K;
  cin>>N>>K;
  ll sum = 0;
  for(ll i = K;i<=N+1;i++){
    ll min = (0+i-1)*i/2;
    ll max = (N+N-i+1)*i/2;
//    cout<<min<<" "<<max<<endl;
    sum+=max-min+1;
  }
  cout<<sum%BIG<<endl;
}


Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
#include<algorithm> 
#include <iomanip>
#include <math.h>

#define db double
#define vi vector<int>
#define pb push_back
#define fi first
#define se second
#define ll long long
#define ld long double
#define maxn 5005
#define mod 998244353
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vll vector<ll>
#define vpi vector<pii>
#define vpll vector<pll>
#define vv(z,a,b) vector<vector<int>>z(a,vector<int>(b))
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(c) begin(c),end(c)
using namespace std;


int main(){
   int x,n;cin>>x>>n;
   if(n==0){
       cout<<x<<endl;
       return 0;
   }
   vi a(n);
   rep(i,n)cin>>a.at(i);
    sort(all(a));
    int su=-1;
    rep(j,n){
        if(a.at(j)==x){
                su=j;
        }
    }
    if(su==-1){
        cout<<x<<endl;
        return 0;
    }
    int w=1;
    while(1){
        if(su-w<0){
            cout<<x-w<<endl;
            return 0;
        }
        if(a.at(su-w)!=x-w){
            cout<<x-w<<endl;
            return 0;
        }
        if(su+w>n-1){
            cout<<x+w<<endl;
            return 0;
        }
        if(a.at(su+w)!=x+w){
             cout<<x+w<<endl;
            return 0;
        }
        w++;
    }

}

Measured memory_bytes: 3632
import numpy as np

N = int(input())
dis = np.zeros((10,10))

for i in range(1,N+1):
  s = str(i)
  a = int(s[0])
  b = int(s[-1])
  if a != 0 and b != 0:
     dis[a][b] += 1

count = 0
for i in range(1,10):
  for j in range(1,10):
    count += int(dis[i][j] * dis[j][i])
    
print(count)

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

int main(){
    long e;
    int x,y,z;
    cin>>e;
    long min=e;
    while(e!=0){
        min=e;
        for(z=0;z*z*z<=e;++z){
            for(y=0;y*y+z*z*z<=e;++y){
                x=e-y*y-z*z*z;
                if(x>=0){
                    if(min>x+y+z) min=x+y+z;
                }
            }
        }
        cout<<min<<"\n";
        cin>>e;
    }
}

Measured memory_bytes: 2996
#include <iostream>
#include <algorithm>
#include <utility>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <math.h>
#include <string.h>
#include <iomanip>
#include <numeric>
#include <cstdlib>
#include <cstdint>
#include <cmath>
#include <functional>
#include <limits>
#include <cassert>

using namespace std;

using ll = long long;
using pll = pair<ll, ll>;
using vl = vector<ll>;
using vll = vector<vl>;
using vpll = vector<pll>;

void debug_out() { std::cout << endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cout << "debug: "; debug_out(__VA_ARGS__)
#else
#define debug(...) 
#endif

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define Rep(i, n) for (long long i = 0; i< (long long)(n); i++)
#define RRep(i,n) for (long long i = ((long long)(n)-1); i>=0; i--)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()

struct Edge{
    int to;
    int weight;
    Edge(int t, int w) : to(t), weight(w){ }
};

struct edge{
    int from;
    int to;
    int weight;
    edge(int f,int t,int w) : from(f), to(t), weight(w){ }
};


using Graph = vector<vector<Edge>>;
using graph = vector<vector<int>>;
using edges = vector<edge>;

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

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

template <class T>
T lcm(T a, T b){
    return (a*b)/gcd(a,b);
}

bool isPalindrome(string s){
    string t = s;
    reverse(all(t));
    return s==t;
}

constexpr ll INF = 1e9+7;

vector<int> dx = {-1,0,1,0};
vector<int> dy = {0,-1,0,1};

struct UnionFind{
private:
    vector<int> par;

public:
    UnionFind(int n=0): par(n,-1){ }

    int find(int x){
        if(par[x]<0) return x;
        else return par[x] = find(par[x]);
    }

    bool same(int x,int y){
        return find(x)==find(y);
    }

    bool unite(int x, int y){
        x = find(x); y = find(y);
        if(x==y) return false;
        if(par[x]>par[y]) swap(x,y);
        par[x]+=par[y];
        par[y] = x;
        return true;
    }

    int size(int x){
        return -par[find(x)];
    }

    int count_group(){
        int c = 0;
        rep(i,par.size()){
            if(par[i]<0) c++; 
        }
        return c;
    }

    int max_size(){
        int m = 0;
        for(auto x: par){
            m = max(m,-x);
        }
        return m;
    }
};

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    vector<int> p(n);
    rep(i,n) cin >> p[i];
    UnionFind uf(n);
    map<int,int> m;
    rep(i,n){
        m[p[i]]++;
        if(p[i]==1) continue;
        if(m[p[i]-1]==1){
            uf.unite(p[i]-1,p[i]-2);
        }
    }
    int ans = n-uf.max_size();
    cout << ans << endl;
}

Measured memory_bytes: 11264
import java.util.Arrays;

public class Main {

  private static void solve() {
    int n = ni();
    int[] a = new int[n];
    int[] b = new int[n];
    for (int i = 0; i < n; i++) {
      a[i] = ni();
      b[i] = ni();
    }

    Arrays.sort(a);
    Arrays.sort(b);

    if (n % 2 == 1) {
      System.out.println(b[n / 2] - a[n / 2] + 1);
    } else {
      int min = a[n / 2 - 1] + a[n / 2];
      int max = b[n / 2 - 1] + b[n / 2];

      System.out.println(max - min + 1);
    }
  }

  public static void main(String[] args) {
    new Thread(null, new Runnable() {
      @Override
      public void run() {
        long start = System.currentTimeMillis();
        String debug = args.length > 0 ? args[0] : null;
        if (debug != null) {
          try {
            is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));
          } catch (Exception e) {
            throw new RuntimeException(e);
          }
        }
        reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);
        solve();
        out.flush();
        tr((System.currentTimeMillis() - start) + "ms");
      }
    }, "", 64000000).start();
  }

  private static java.io.InputStream is = System.in;
  private static java.io.PrintWriter out = new java.io.PrintWriter(System.out);
  private static java.util.StringTokenizer tokenizer = null;
  private static java.io.BufferedReader reader;

  public static String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }

  private static double nd() {
    return Double.parseDouble(next());
  }

  private static long nl() {
    return Long.parseLong(next());
  }

  private static int[] na(int n) {
    int[] a = new int[n];
    for (int i = 0; i < n; i++)
      a[i] = ni();
    return a;
  }

  private static char[] ns() {
    return next().toCharArray();
  }

  private static long[] nal(int n) {
    long[] a = new long[n];
    for (int i = 0; i < n; i++)
      a[i] = nl();
    return a;
  }

  private static int[][] ntable(int n, int m) {
    int[][] table = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[i][j] = ni();
      }
    }
    return table;
  }

  private static int[][] nlist(int n, int m) {
    int[][] table = new int[m][n];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[j][i] = ni();
      }
    }
    return table;
  }

  private static int ni() {
    return Integer.parseInt(next());
  }

  private static void tr(Object... o) {
    if (is != System.in)
      System.out.println(java.util.Arrays.deepToString(o));
  }
}


Measured memory_bytes: 60556
#include <iostream>
#include <math.h>

using namespace std;

int  main(void){

	int A,B;
	cin >> A >> B ;

	int max;
	if(A*B > A + B){
		max = A*B;
	}else {
		max = A + B;
	}

	if(A - B > max)max = A - B;

	cout << max << endl;


}


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

using namespace std;

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template <typename T>void read(T &x){
	x = 0; int f(1); char c = getchar();
	for(;!isdigit(c);c = getchar()) if(c == '-') f = -1;
	for(;isdigit(c);c = getchar()) x = x*10+c-'0';
	x *= f;
}
int main(){
	int a,b,k;
	cin >> k >> a >> b;
	for(int i = k;i <= b;i += k)
		if(i >= a){puts("OK");return 0;}
	puts("NG");
	return 0;
}

Measured memory_bytes: 3620
// keyence2020_C
#include <iostream>
#include <string>
#include <vector>
#include <iterator>
#include <tuple>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <stack>
#include <queue>
#include <algorithm>
#include <functional>  // std::greater<T>()
#include <utility>  // std::swap()
#include <numeric>  // accumulate(ALL(vec), 0)  0 は初期値
#include <bitset>  // static_cast<std::bitset<8>>
#include <sstream>  // std::stringstream
#include <cmath>
#include <cstring>  // std::memset
#include <climits>  // INT_MIN
#include <cctype>  // std::isdigit()
#include <iomanip>
using namespace std;

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> pll;
#define rep(i, n) for (ll i=0; i < n; i++)  // 0 ~ n-1
#define rep1(i, n) for (ll i=1; i <= n; i++)  // 1 ~ n
#define all(vec) (vec).begin(), (vec).end()
#define sum(vec) accumulate(all(vec), 0LL)  // 0 は初期値
#define min_vec(vec) min_element(all(vec))  // iterator: * を先頭につける
#define max_vec(vec) max_element(all(vec))  // iterator: * を先頭につける
#define idx(vec, element_iter) distance((vec).begin(), element_iter)
const ll INF = 1LL<<60;  // 10^18（const int inf = 1<<29;）
const double PI = acos(-1);

template <class T>
void printVec(vector <T> &vec) {
    size_t len = vec.size();
    rep(i, len) {
        if (i) cout << " ";
        cout << vec[i];
    }
    cout << "\n";
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    // input(sunippets: inpv, inpn, inps)
    ll N, K, S;
    cin >> N >> K >> S;
    
    // calculation
    ll lim = 1000000000;  // 10^9
    ll key;
    if (S == lim) {
        key = lim - 1;
    } else {
        key = lim;
    }
    
    vector<ll> vec(N, key);
    
    rep(i, K) {
        vec[i] = S;
    }
    
    printVec(vec);
    
    return 0;
}

Measured memory_bytes: 2176
#include <iostream>
#include <cstdio>
#include <map>
using namespace std;

int main(){
    long long n, k;
    cin >> n >> k;
    map<long long, long long> T;

    for(long long i = 0; i < n; i++){
        long long a, b;
        cin >> a >> b;

        if(T.find(a) == T.end()){
            T[a] = b;
        }
        else{
            T[a] += b;
        }
    }

    map<long long, long long>::iterator it;

    long long count = 0;
    long long number;
    for(it = T.begin(); it != T.end(); it++){
        if(count <= k and k <= count + it->second){
            number = it->first;
            break;
        }
        count += it->second;
    }

    printf("%lld\n", number);

    return 0;
}

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

int main() {
  int N, K;
  cin >> N >> K;
  vector<ll> V(N);
  rep(i, 0, N) cin >> V[i];
  ll ans = 0;
  // 左からi個取り出す
  rep(i, 0, min(N + 1, K + 1)) {
    ll sum = 0;
    vector<ll> A;
    rep(j, 0, i) {
      sum += V[j];
      if(V[j] < 0) A.push_back(V[j]);
    }
    sort(A.begin(), A.end());
    priority_queue<ll,vector<ll>,greater<ll>> Q;
    // 右からj個取り出す
    rep(j, 0, min(N + 1, K + 1)) {
      if(i + j > min(N, K)) continue;
      ll sum2 = 0;
      rep(k, 0, j) {
        sum2 += V[N - 1 - k];
        if(V[N - 1 - k] < 0) Q.push(V[N - 1 - k]);
      }
      rep(k, 0, A.size()) Q.push(A[k]);
      rep(k, 0, K - i - j) {
        if(Q.empty()) break;
        ll t = Q.top(); Q.pop();
        if(t < 0) sum2 -= t;
      }
      ll tot = sum + sum2;
      ans = max(ans, tot);
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
N = int(input())
S = input()

b_from_l = [0 for _ in range(N)]
w_from_r = [0 for _ in range(N)]

for i in range(N):
    if i == 0:
        if S[i] == '#':
            b_from_l[i] = 1
    else:
        if S[i] == '#':
            b_from_l[i] = b_from_l[i - 1] + 1
        else:
            b_from_l[i] = b_from_l[i - 1]

for i in range(N - 1, -1, -1):
    if i == N - 1:
        if S[i] == '.':
            w_from_r[i] = 1
    else:
        if S[i] == '.':
            w_from_r[i] = w_from_r[i + 1] + 1
        else:
            w_from_r[i] = w_from_r[i + 1]

ans = min(S.count('.'), S.count('#'))
for i in range(N - 1):
    ans = min(ans, b_from_l[i] + w_from_r[i + 1])
print(ans)


Measured memory_bytes: 55036
from fractions import gcd

N = int(input())
T = [int(input()) for _ in range(N)]

def f(a, b):
    return (a * b) // gcd(a, b)

if N == 1:
    print(T[0])
    exit()

ans = f(T[0], T[1])

for i in range(2, N):
    ans = f(ans, T[i])

print(ans)


Measured memory_bytes: 5048
/*
	- 20.3.2
	C - Vacation
	Atcoder-Educational DP Contest-C - Vacation
	20.3.2-Atcoder-Educational DP Contest-C - Vacation-
	- 
	-
	- 
*/
#include <bits/stdc++.h>
using namespace std;
int f[100010][3],a[100010],b[100010],c[100010];
int n;

int main()
{
	cin>>n;
	for (int i=1;i<=n;++i)
	{
		cin>>a[i]>>b[i]>>c[i];
		f[i][0]=max(f[i-1][1],f[i-1][2])+a[i];
		f[i][1]=max(f[i-1][0],f[i-1][2])+b[i];
		f[i][2]=max(f[i-1][0],f[i-1][1])+c[i];
	}
	cout<<max(f[n][0],max(f[n][1],f[n][2]))<<endl;
	return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
#include<atcoder/all>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define all(x) (x).begin(), (x).end()
using namespace std;
using namespace atcoder;
using ll = long long;
using P = pair<int,int>;
using VI = vector<int>;
using VVI = vector<VI>;

int op(int a, int b) { return max(a, b); }
int e() { return 0; }

int main() {
    int n, k;
    cin >> n >> k;
    segtree<int, op, e> seg(600001);
    rep(_, n) {
        int a;
        cin >> a;
        int l = max(0, a-k), r = a + k + 1;
        int mx = seg.prod(l, r) + 1;
        seg.set(a, mx);
    }
    cout << seg.all_prod() << endl;
}

Measured memory_bytes: 13852
#include <stdio.h>

int main()
{
	int a,b,c,x,d;
	int T=0;

	scanf("%d %d %d",&a,&b,&c);
	for (x = a;x <= b;x++) {
		if (c%x == 0) {
			T++;
		}
	}
	printf("%d\n",T);

	return 0;
}

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

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

const long int MAX = 510000;
const long long int MOD = 998244353;

vector<long long int> fac(MAX);
vector<long long int> finv(MAX);
vector<long long int> inv(MAX);

void COMinit() {
    fac.at(0) = fac.at(1) = 1;
    finv.at(0) = finv.at(1) = 1;
    inv.at(1) = 1;
    for (int i = 2; i < MAX; i++){
        fac.at(i) = fac.at(i - 1) * i % MOD;
        inv.at(i) = MOD - inv.at(MOD%i) * (MOD / i) % MOD;
        finv.at(i) = finv.at(i - 1) * inv.at(i) % MOD;
    }
}

long long int COM(long long int n,long long int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac.at(n) * (finv.at(k) * finv.at(n - k) % MOD) % MOD;
}

int main(){
    long int N,M,K;
    cin >> N >> M >> K;

    COMinit();

    long long int sum = 0;

    rep(i,K+1) {
        sum += COM(N-1,i)%998244353*M%998244353*modpow(M-1,N-1-i,998244353)%998244353;
    }

    cout << sum%998244353 << endl;

}

Measured memory_bytes: 14996
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define o(a) cout << a << endl
#define int long long
#define first fi;
#define second se;
using namespace std;
typedef pair<int, int> P;

signed main(){
    int n, w;
    while(1){
        cin >> n >> w;
        if(n + w == 0) break;
        vector<int> d(n);
        int MAX = 0;
        rep(i, 0, n){
            cin >> d[i];
            MAX = max(MAX, d[i]);
        } 
        int sz = MAX / w + 1;
        vector<int> a(sz);
        rep(i, 0, n){
            a[d[i] / w]++;
        }
        int MAX2 = 0;
        rep(i, 0, sz){
            MAX2 = max(MAX2, a[i]);
        }
        double ans = 0.01;
        rep(i, 0, sz){
            double high = (double)a[i] / (double)MAX2;
            double dark = (double)(sz - 1 - i) / (double)(sz - 1);
            // cout << high << " " << dark << endl;
            ans += high * dark;
        }
        printf("%.15lf\n", ans);
    }
}

Measured memory_bytes: 3028
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
 
using namespace std;
 
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define rep(i,n) REP(i, 0, n)
#define pb push_back
#define mp make_pair
#define all(r) (r).begin(),(r).end()
#define rall(r) (r).rbegin(),(r).rend()
#define fi first
#define se second
#define DBG(X) cout<<" "<<#X<<" : "<<X<<endl
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;

const int INF = 1e9;
const double EPS = 1e-8;
const int mod = 1e9 + 7;
const ll LINF = 1e18;

struct Input
{
	int n;char c;char str[1024];string s;ll l;
	int nextInt(){scanf("%d", &n);return n;}
	ll nextLong(){scanf("%lld", &l);return l;}
	char nextChar(){scanf("%c", &c);return c;}
	string next(){scanf("%s", str);return string(str);}
	string nextLine(){getline(cin, s);return s;}
};
Input in;


string s[510];

int d[510][510];

int main(){
	while(1){
		int h = in.nextInt(), w = in.nextInt();
		if(h == 0 && w == 0) break;
		rep(i, h) s[i] = in.next();
		rep(i, h) rep(j, w) d[i][j] = 0;
		rep(i, w) d[h-1][i] = s[h-1][i] == '.' ? 1: 0;
		for(int i = h - 2; i >= 0; i--){
			rep(j, w) d[i][j] = (s[i][j] == '.' ? d[i + 1][j] + 1 : 0);
		}
		int ans = 0;
		rep(i, h) rep(j, w){
			int tmp = INF;
			for(int k = j; k < w; k++){
				if(d[i][k] == 0) break;
				tmp = min(tmp, d[i][k]);
				ans = max(ans, tmp * (k - j + 1));
			}
		}
		printf("%d\n", ans);
	}
}

Measured memory_bytes: 4272
import sys

sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
# debug = lambda *a, **kw: print(*a, **kw, file=sys.stderr)

S = ins()


def solve():
    N = len(S)
    i = 0
    j = 1
    flip = 0
    while j < N:
        while j < N and S[i] == S[j]:
            j += 1
        if j == N:
            break
        flip += 1
        i = j
        j += 1

    return flip


print(solve())


Measured memory_bytes: 3316
#include <iostream>

using namespace std;

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

        if(A==B)
            cout<<"Draw";
        else if(A>B){
            if(B==1)
                cout<<"Bob";
            else if(B!=1)
                cout<<"Alice";
        }
        else if(B>A){
            if(A==1)
                cout<<"Alice";
            else if(A!=1)
                cout<<"Bob";
        }


    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

public struct Edge
{
    public int U { get; }
    public int V { get; }

    public Edge Dual()
    {
        return new Edge(V, U);
    }

    public Edge(int u, int v)
    {
        U = u;
        V = v;
    }
}

public class Program
{
    #region Standard I/O
    readonly TextReader input;
    readonly TextWriter output;

    X[] ReadLine<X>(Func<string, X> func)
    {
        return input.ReadLine().Split(' ').Select(func).ToArray();
    }

    void WriteLineOne(object obj)
    {
        output.WriteLine("{0}", obj);
    }

    void WriteLineMany(params object[] objects)
    {
        output.WriteLine(string.Join(" ", objects.Select(obj => obj.ToString())));
    }
    #endregion

    int n, m;
    Edge[] es;

    void Read()
    {
        {
            var line = ReadLine(int.Parse);
            n = line[0];
            m = line[1];
        }

        es = new Edge[m];
        for (var i = 0; i < m; i++)
        {
            var line = ReadLine(int.Parse);
            var u = line[0] - 1;
            var v = line[1] - 1;
            es[i] = new Edge(u, v);
        }
    }

    bool[,] Graph()
    {
        var g = new bool[n, n];

        foreach (var e in es)
        {
            g[e.U, e.V] = true;
            g[e.V, e.U] = true;
        }

        return g;
    }

    int Dfs(bool[,] g, bool[] done, int u, int k)
    {
        if (k == n)
        {
            return 1;
        }
        else
        {
            var count = 0;

            for (var v = 1; v < n; v++)
            {
                if (!g[u, v] || done[v]) continue;

                done[v] = true;
                count += Dfs(g, done, v, k + 1);
                done[v] = false;
            }

            return count;
        }
    }

    int Solve()
    {
        var g = Graph();
        var done = new bool[n];
        return Dfs(g, done, 0, 1);
    }

    public void Run()
    {
        Read();
        WriteLineOne(Solve());
    }

    public Program(TextReader input, TextWriter output)
    {
        this.input = input;
        this.output = output;
    }

    public static void Main(string[] args)
    {
        new Program(Console.In, Console.Out).Run();
    }
}


Measured memory_bytes: 13396
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    int n;
    cin>>n;
    int sum1=0,sum2=0,f[n-1],s[n-1];
    int arr[2][n];

    for(int i=0;i<2;i++)
    {
        for(int j=0;j<n;j++)
        {
            cin>>arr[i][j];
            if(i==0 && j>0)
            {
                f[j-1]=arr[i][j];
            }
            else if(i==1 && j<n)
            {
                s[j]=arr[i][j];

            }

        }


    }
    for(int i=1;i<n-1;i++)
    {
        f[i]+=f[i-1];
        s[i]+=s[i-1];
    }
   vector<int>v;
    int q=n-1-1;
    v.push_back(s[n-1-1]);
    v.push_back(f[0]+s[q]-s[0]);
    for(int i=1;i<n-1;i++)
    {
        //cout<<f[i]+s[q]-s[i]<<" ";
        v.push_back(f[i]+s[q]-s[i]);


    }
    sort(v.begin(),v.end());
    printf("%d",v[v.size()-1]+arr[0][0]+arr[1][n-1]);

    return 0;
}


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

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

  if(a>b){
      if(a<c){
          cout << b;
          cout << " ";
          cout << a;
          cout << " ";
          cout << c;
     }
     else {
         if(b<c){
         cout << b;
         cout << " ";
         cout << c;
         cout << " ";
         cout << a;
         }
         else {
         cout << c;
         cout << " ";
         cout << b;
         cout << " ";
         cout << a;
         }
     }
  }
  else {
      if(b<c){
          cout << a;
          cout << " ";
          cout << b;
          cout << " ";
          cout << c;
      }
      else {
          if(c<a){
          cout << c;
          cout << " ";
          cout << a;
          cout << " ";
          cout << b;
          }
          else if(c<b){
          cout << a;
          cout << " ";
          cout << c;
          cout << " ";
          cout << b;
          }
      }
  }
  cout << endl;
}


Measured memory_bytes: 3100
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cmath>

using namespace std;

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

bool isPrime(ll num)
{
	if (num < 2) return false;
	else if (num == 2) return true;
	else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2)
	{
		if (num % i == 0)
		{
			// 素数ではない
			return false;
		}
	}

	// 素数である
	return true;
}

int main() {
	ll N;
	cin >> N;
	while(!isPrime(N)) {
		N++;
	}
	cout << N << endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;
static const int INI =  -1;
 int f[66];

int fib(int n){

  if(n == 0 || n == 1) return f[n] = 1;
  else if(f[n] != INI) return f[n];
  return f[n] =  fib(n - 1) + fib(n - 2);
}

int main(){

 
  int n;
  for(int i = 0;i <= 66; i++){
    f[i] = INI;
  }

  cin >> n;

  cout << fib(n) << endl;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using pll = pair<ll,ll>;
using vpl = vector<pll>;
using vb = vector<bool>;
using vs = vector<string>;

const ll oo = 0x3f3f3f3f3f3f3f3fLL;
const double eps = 1e-9;

#define sz(c) ll((c).size())
#define all(c) begin(c),end(c)
#define mp make_pair
#define pb push_back
#define xx first
#define yy second
#define has(c,i) (c.find() != end(c))
#define FOR(i,a,b) for (ll i=(a); i<(b); i++)
#define FORD(i,a,b) for (ll i=ll(b)-1; i>=(a); i--)

#define DBG 1
#define TR(X) ({ if(DBG) cerr << "TR: " << (#X) << " = " << (X) << endl; })

vb mark;
vvl children;
vl vals;

void rek(ll cur, ll val){
	mark[cur] = true;
	vals[cur] += val;
	for( const auto & it : children[cur]){
		if(!mark[it])
			rek(it, vals[cur]);
	}
}

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

	ll N, Q;
	cin >> N >> Q;

	children.assign(N, vl());
	vals.assign(N,0);

	mark.assign(N, false);

	FOR(i,0,N-1) {
		ll a, b;
		cin >> a >> b;
		a--;
		b--;

		children[a].pb(b);
		children[b].pb(a);
	}

	FOR(i,0,Q) {
		ll p, x;
		cin >> p >> x;
		p--;

		vals[p] += x;
	}

	rek(0, 0);

	FOR(i,0,N){
		cout << vals[i] << " ";
	}

	cout << endl;
}


Measured memory_bytes: 24320
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    n = I()
    a = sorted([I() for _ in range(n)])
    x = 0
    for c in a:
        x ^= c
    s = set()
    for c in a:
        s.add(c ^ (c-1))

    r = 0
    for c in sorted(s, reverse=True):
        cb = bin(c)
        xb = bin(x)
        if len(cb) == len(xb) and x > 0:
            x ^= c
            r += 1

    if x != 0:
        return -1

    return r




print(main())



Measured memory_bytes: 10772
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <locale>
#include <iostream>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(),(x).end()

using namespace std;

using ll = long long;
using ld = long double;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template <typename T> int len(const T &x) { return x.size(); }

template<typename T>
vector<T> table(int n, T v) { return vector<T>(n, v); }

template <class... Args>
auto table(int n, Args... args) {
  auto val = table(args...);
  return vector<decltype(val)>(n, move(val));
}

struct yes_no : numpunct<char> {
  string_type do_truename()  const { return "Yes"; }
  string_type do_falsename() const { return "No"; }
};

class UnionFind {
  vector<int> p;
public:
  UnionFind (int n) : p(n, -1) {}
  int root(int x) {
    return p[x] < 0 ? x : p[x] = root(p[x]);
  }
  bool same(int x, int y) {
    return root(x) == root(y);
  }
  bool unite(int x, int y) {
    x = root(x); y = root(y);
    if (x == y) return false;
    if (p[y] < p[x]) swap(x, y);
    if (p[x] == p[y]) --p[x];
    p[y] = x;
    return true;
  }
};

void solve(ll N, ll M, vector<ll> a, vector<ll> b) {
  int res = 0;
  REP(i,M) {
    UnionFind uf(N);
    int cnt = 0;
    REP(j,M) {
      if (i == j) continue;
      if (uf.unite(a[j] - 1, b[j] - 1)) ++cnt;
    }
    if (cnt < N - 1) ++res;
  }
  cout << res << endl;
}

int main() {
  locale loc(locale(), new yes_no);
  cout << boolalpha << setprecision(12) << fixed;
  cout.imbue(loc);
	ll M;
	ll N;
	scanf("%lld", &N);
	scanf("%lld", &M);
	vector<ll> a(M-1+1);
	vector<ll> b(M-1+1);
	for (int i = 0 ; i <= M-1 ; i++) {
	  scanf("%lld", &a[i]);
	  scanf("%lld", &b[i]);
	}
	solve(N, M, a, b);
	return 0;
}


Measured memory_bytes: 384
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;


public class Main {
  public static void main(String[] args) {
    FastScanner sc = new FastScanner();
    int N = sc.nextInt();
    char[] S = sc.next().toCharArray();
    
    int level = 0;
    int left = 0;
    for (int i = 0; i < N; i ++) {
      level += S[i] == '(' ? 1 : -1;
      
      if (level + left < 0) {
        left ++;
      }
    }
    
    StringBuilder sb = new StringBuilder();
    for (int i = 0; i < left; i ++) {
      sb.append("(");
    }
    sb.append(S);
    for (int i = 0; i < level + left; i ++) {
      sb.append(")");
    }
    System.out.println(sb);
  }

}


class FastScanner {
	public static String debug = null;

	private final InputStream in = System.in;
	private int ptr = 0;
	private int buflen = 0;
	private byte[] buffer = new byte[1024];
	private boolean eos = false;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				if (debug != null) {
					buflen = debug.length();
					buffer = debug.getBytes();
					debug = "";
					eos = true;
				} else {
					buflen = in.read(buffer);
				}
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen < 0) {
				eos = true;
				return false;
			} else if (buflen == 0) {
				return false;
			}
		}
		return true;
	}

	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	private void skipUnprintable() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
	}

	public boolean isEOS() {
		return this.eos;
	}

	public boolean hasNext() {
		skipUnprintable();
		return hasNextByte();
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}

	public int nextInt() {
		return (int) nextLong();
	}

	public long[] nextLongList(int n) {
		return nextLongTable(1, n)[0];
	}

	public int[] nextIntList(int n) {
		return nextIntTable(1, n)[0];
	}

	public long[][] nextLongTable(int n, int m) {
		long[][] ret = new long[n][m];
		for (int i = 0; i < n; i ++) {
			for (int j = 0; j < m; j ++) {
				ret[i][j] = nextLong();
			}
		}
		return ret;
	}

	public int[][] nextIntTable(int n, int m) {
		int[][] ret = new int[n][m];
		for (int i = 0; i < n; i ++) {
			for (int j = 0; j < m; j ++) {
				ret[i][j] = nextInt();
			}
		}
		return ret;
	}
}

Measured memory_bytes: 21332
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
const int INF = 1 << 28;
const ll MOD = 1000000007;
template <class T>
bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}

int main() {
    int d, n;
    cin >> d >> n;
    int ret;
    if (n < 100)
        ret = n;
    else
        ret = 101;
    if (d == 1) {
        ret *= 100;
    } else if (d == 2)
        ret *= 10000;
    cout << ret << "\n";
    return 0;
}

Measured memory_bytes: 256
n, m = map(int, input().split())
P = [list(map(int, input().split())) for i in range(n)]
P.sort(key=lambda x:(x[0]))
ans = 0
for p in P:
	if p[1] < m:
		ans += p[0] * p[1]
		m -= p[1]
	else:
		print(ans + p[0]*m)
		exit()

Measured memory_bytes: 64472
N, M, X = [int(_) for _ in input().split()]
CA = [[int(_) for _ in input().split()] for i in range(N)]

C = [row[0] for row in CA]
A = [row[1:] for row in CA]

def solve(N, M, X, C, A):
    result = -1
    for n in range(2**N):
        xs = [0] * M
        r = 0
        for i in range(N):
            if ((1 << i) & n):
                r += C[i]
                for j in range(M):
                    xs[j] += A[i][j]
        if all(X <= xs[j] for j in range(M)):
            if result == -1 or r < result:
                result = r
    return result

print(solve(N, M, X, C, A))

Measured memory_bytes: 9252
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

int main(){
  int n,y;
  bool truth = false;
  cin >> n >> y;
  int a=-1,b=-1,c=-1;
  for(int i=0;i<=n;i++){
    for(int j=0;j<=n;j++){
      if(n-i-j>=0&&10000*i+5000*j+1000*(n-i-j)==y){
        a=i;
        b=j;
        c=n-i-j;
        truth =true;
        break;
      }
    }
    if(truth)break;
  }
  cout << a << " " << b << " "  << c <<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define MOD 1000000007
using namespace std;
typedef long long ll;

int main(){
    string s;
    cin >> s;
    if(s[0] == s[2]) puts("Yes");
    else puts("No");
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;n>i;++i)
using namespace std;
using ll=long long;
using P=pair<int,int>;
//pとqの最大公約数
int gcd(int p,int q){
    if(p%q==0)
    return q;
    return gcd(q,p%q);
}
int main(){
    double a,b,h,m;
    cin>>a>>b>>h>>m;
    double C=fabs(30*h+m/2-6*m);
    cout<<setprecision(15)<<sqrt(a*a+b*b-2*a*b*cos(C*M_PI/180))<<endl;
}

Measured memory_bytes: 4216
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string str;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int,int> vii;
typedef vector<ll,ll> vll;
typedef vector <pii> vpii;
typedef vector <pll> vpll;
typedef map <str,int> mapsi;
typedef map <str,int> :: iterator mapsitr;
typedef set <int> :: iterator sitr;
typedef set <ll> :: iterator sltr;
#define mset multiset
typedef mset <int> msi;
typedef mset <ll> msll;
typedef mset <int> :: iterator msitr;
typedef mset <ll> :: iterator msltr;
#define mp make_pair
#define pb push_back
#define pob pop_back
#define fi first
#define se second
#define fs first.second
#define ss second.second
#define ff first.first
#define sf second.first
int depth[20],f;
vector <str> v;
str s;
void permute (int start, int x, int deep){
    if(deep>0){

    for(int i=start;i<=3;i++){
        depth[x]=i;
        if(x<deep){
            permute(i,x+1,deep);
        }
        else{
            str temp = "";
            for(int i=1;i<=deep;i++){
                temp += char(depth[i]+'0');
            }
            str z = temp + s;
            sort(z.begin(),z.end());
            v.pb(z);
            while(next_permutation(z.begin(),z.end())){
                v.pb(z);
            }
        }
    }

    }
}

void construct (int x){
    int add = x-3;
    s = "123";
    permute (1,1,add);
    if(x==3){
        v.pb(s);
        while(next_permutation(s.begin(),s.end())){
            v.pb(s);
        }
    }

}
int n;
ll numerize (str z){
    ll m=1;
    ll sum=0;
    for(int i=z.size()-1;i>=0;i--){
        int digit = int(z[i]-'0');
        digit = 1 + 2*digit;
        sum += digit*m;
        m*=10;
    }
    return sum;
}
int main(){
    for(int i=3;i<=9;i++)construct(i);
    cin>>n;
    for(int i=0;i<v.size();i++){
        ll temp = numerize(v[i]);
        if(temp<=n){
            //cout<<temp<<endl;
            f++;
        }
    }
    cout<<f<<endl;
}


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

#define int long long

inline int read()
{
	int x = 0, f = 1; char ch = getchar();
	for (; ch < '0' || ch > '9'; ch = getchar()) if (ch == '-') f = -1;
	for (; ch >= '0' && ch <= '9'; ch = getchar()) x = (x << 1) + (x << 3) + ch - '0';
	return x * f;
}

signed main()
{
	int n = read(), ans = n * (n + 1) / 2;
	for (int i = 1; i < n; ++i)
	{
		int u = read(), v = read();
		if (u > v) swap(u, v);
		
		ans += i * (i + 1) / 2 - u * (n - v + 1);
	}
	printf("%lld\n", ans);
	
	return 0;
}


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

typedef long long ll;
#define REP(i,n) for(ll i=0; i<(ll)(n); i++)
#define REPM(i,n) for(ll i=(n-1); 0=<i; i--)
#define VI vector<int>
#define VL vector<ll>
#define VD vector<double>
#define VS vector<string>
#define V_SORT_U(x) sort(x.begin(), x.end());
#define V_SORT_D(x) sort(x.begin(), x.end(),greater<int>());
#define V_SUM(x) accumulate(x.begin(), x.end(), 0)
#define STR_TRANS_UP(x) transform(x.begin(), x.end(), x.begin(), ::toupper);
#define STR_TRANS_LOW(x) transform(x.begin(), x.end(), x.begin(), ::tolower);

int main(void){
    ll N;
    ll count = 0;
    cin >> N;

    VS S_i(N);

    REP(i,N)
    {
        cin >> S_i.at(i);
    }

    V_SORT_U(S_i)

    REP(i,N)
    {
        if(i==0)
        {
            count ++;
        }
        else
        {
            if(S_i.at(i) != S_i.at(i-1)) count ++;
        }
    }

    //debug
    // REP(i,N)
    // {
    //     cout << S_i.at(i) << endl;
    // }
    
    cout << count << endl;

    return 0;
}

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

int main(){
    int N, date, remain;
    cin >> N >> date >> remain;
    
    int* mag = new int[N+1];
	for(int index = 1; index <= N; index++) {
		cin >> mag[index] ;
	}

	int sum = 0 ;
	for(int index = 1; index <= date; index++) {
		for(int player = 1; player <= N; player++) {
			sum += ( (index - 1) % mag[player] == 0 ? 1 : 0 ) ;
		}
	}
	sum += remain ;
	
	cout << sum << endl;
    return 0;
}

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

using namespace std;

#define pb push_back
#define int long long
#define ld long double

int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n, m, k;
    cin >> n >> m >> k;
    vector<int> cnt(n), cnt1(m);
    set<int> st;
    set<pair<int,int>> lol;
    vector<vector<int>> go(n);
    for (int i = 0; i < k; i++){
        int a, b;
        cin >> a >> b;
        a--, b--;
        go[a].pb(b);
        st.insert(a);
        cnt[a]++, cnt1[b]++;
    }
    for (int i = 0; i < m; i++){
        if (cnt1[i] != 0){
            lol.insert({cnt1[i], i});
        }
    }
    int anss = 0;
    for (auto to : st){
        int ans = 0;
        for (auto t : go[to]){
            lol.erase({cnt1[t], t});
            ans = max(ans, cnt1[t] - 1);
        }
        if (!lol.empty()){
            ans = max(ans, lol.rbegin()->first);
        }
        anss = max(anss, cnt[to] + ans);
        for (auto t : go[to]){
            lol.insert({cnt1[t], t});
        }
    }
    cout << anss << endl;
    return 0;
}


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

int main()
{
long double n,i,x,ans;
ll int a,b,c,sol;
cin>>n;
x=n/1.08;
a=ceil(x);
b=floor(x);
a=(long double)( a);
b=(long double)( b);
a=a-x;
b=b-x;
c=0;
 if(a<=b)
{
    c=1;
}
else
{
c=-1;
}
if(c==1)
{
    ans=ceil(x);
}
else
{
    ans=floor(x);
}
sol=(ll int)(1.08*ans);
if(sol!=n)
{
    c=-2;
}
if(c==1)
{
    cout<<ceil(x)<<endl;
}
else if(c==-1)
{
    cout<<floor(x)<<endl;
}
else
{
    cout<<":("<<endl;
}

return 0;
}


Measured memory_bytes: 256
/*
	ex2_3
	ruuu0048
*/
#include <stdio.h>

int main(void){

    int N,A; //マス目とAを宣言

    scanf("%d",&N); //マス目の入力
    scanf("%d",&A); //Aの入力

    printf("%d\n",N * N - A); //計算結果を出力

    return 0; 

}

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

int main(){
    int n,m,c;
    cin >> n >> m >> c;
    vector<int> b(m);
    rp(i,m) cin >> b.at(i);
    int ans=0;
    rp(i,n){
        int res=c;
        rp(i,m){
            int a;
            cin >> a;
            res += a*b.at(i);
        }
        if(res>0) ans++;
    }
    cout<< ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
using ll = long long ;
using ld=long double;
 
int main(){
    int n;
    cin>>n;
    vector<ll> h(n);
    for(int i=0;i<n;i++)
    cin>>h[i];
    int ans=-1,count=0;
    for(int i=0;i<n-1;i++){
        if(h[i]>=h[i+1])
        count++;
        else{
            ans=max(ans,count);
            count=0;
        }
    }
    ans=max(ans,count);
    cout<<ans;
    
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int main(){
	int N; long long K; cin >> N >> K; 
	long long A[214514] = {}; 
	long long S[214514] = {};  
	map<long long, bool> seen; 
	map<long long, long long> M; 
	int now = 1; 
	vector<int> T[214514] = {};
	seen[0LL] = true; T[0].push_back(0); M[0] = 0;   
	for(int i = 1; i <= N; i++){
		cin >> A[i]; A[i] --; 
		S[i] = S[i-1] + A[i]; 
		S[i] %= K; 
		if(!seen[S[i]]){
			seen[S[i]] = true; 
			T[now].push_back(i); 
			M[S[i]] = now; 
			now ++; 
		}
		else{
			T[M[S[i]]].push_back(i); 
		} 
	}
	long long ans = 0LL; 
	for(int i = 0; i < now; i++){
		for(int j = 0; j < T[i].size(); j++){
			int a = lower_bound(T[i].begin(), T[i].end(), T[i].at(j) + K) - T[i].begin(); 
			ans += (long long) a - j - 1; 
		}
	}
	cout << ans << endl; 
}

Measured memory_bytes: 39936
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1000000007LL;
int main() {
    int N,M,X,a,l=0,r=0;
    cin >> N >> M >> X;
    for ( int i = 0; i < M; i++ ) {
        cin >> a;
        if (a < X) l++;
        if (X < a) r++;
    }
    cout << min(l,r) << '\n';
    return 0;
}

Measured memory_bytes: 256
n= int(input())
a = list(int(i) for i in input().split())
import math
import sys

sta=sum(a)/2
sum=0
ans=0
for i in range(0,n-1):
    if sum==sta:
        print(0)
        sys.exit()
    elif sum<sta and sum+a[i]>sta:
        ans=min(sta-sum,sum+a[i]-sta)/0.5
        print(int(ans))
        sys.exit()
    else:
        sum+=a[i]

ans=min(sta-sum,sum+a[n-1]-sta)/0.5
print(abs(int(ans)))

Measured memory_bytes: 26220
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
const double PI=3.14159265358979323846;

int main(){
  int n;
  cin >> n;
  int h[n];
  for(int i = 0; i < n; i++){
    cin >> h[i];
  }
  reverse(h,h+n);
  int ans = 0;
  int temp = 0;
  for(int i = 1; i < n; i++){
    if(h[i-1] <= h[i]) temp++;
    else temp = 0;
    ans = max(ans, temp);
  }
  cout << ans << endl;
  return 0;
}

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

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

	int ans = 0;
	for (int i = N; i > 0; i--) {
		if (i % 2 != 0) {
			int A = 0;
			for (int j = 1; j <= i; j++) {
				if (i % j == 0) {
					A++;
				}
			}
			if (A == 8) {
				ans++;
			}
		}
	}
	
	cout << ans << endl;
	}

Measured memory_bytes: 256
/*** author: yuji9511 ***/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using lpair = pair<ll, ll>;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i=(m);i<(n);i++)
#define rrep(i,m,n) for(ll i=(m);i>=(n);i--)
#define printa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};
void print() {}
template <class H,class... T>
void print(H&& h, T&&... t){cout<<h<<" \n"[sizeof...(t)==0];print(forward<T>(t)...);}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll H,W, K;
    cin >> H >> W >> K;
    string S[15];
    rep(i,0,H) cin >> S[i];
    ll a[11][1010] = {};
    rep(i,0,H){
        rep(j,0,W){
            if(S[i][j] == '1') a[i][j]++;
        }
    }

    ll ans = INF;
    rep(bit,0,(1LL<<(H-1))){
        ll cnt = __builtin_popcount(bit);
        ll res = cnt;
        ll sum[11][1010] = {};
        rep(i,0,W){
            ll idx = 0;
            rep(j,0,H){
                sum[idx][i+1] += a[j][i];
                if((bit>>j)&1) idx++;
            }
        }
        rep(i,0,H){
            rep(j,0,W+1){
                sum[i][j+1] += sum[i][j];
            }
        }

        ll dp[1010] = {};
        rep(i,0,W+1) dp[i] = INF;
        dp[0] = 0;
        rep(i,1,W+1){
            ll lv = -1, rv = i;
            while(rv - lv > 1){
                ll mid = (rv + lv) / 2;
                bool ok = true;
                rep(k,0,cnt+1){
                    if(sum[k][i] - sum[k][mid] > K) ok = false;
                }
                if(ok){
                    rv = mid;
                }else{
                    lv = mid;
                }
            }
            if(rv == i) continue;
            dp[i] = min(dp[i], dp[rv] + 1);
        }
        if(dp[W] == INF) continue;
        // printa(dp, W+1);
        res += dp[W];
        // print(bit, res);
        ans = min(ans, res-1);


    }
    print(ans);


}

Measured memory_bytes: 512
n, k = list(map(int, input().split()))
exp = list(map(lambda x: (1+int(x))/2, input().split()))

c = sum(exp[:k])
cmax = c

for i in range(n-k):
    c -= exp[i]
    c += exp[i+k]

    if c > cmax:
        cmax = c

print(cmax)

Measured memory_bytes: 32140