akhauriyash/Code-Regression huggingface dataset:
#!/usr/bin/env python3


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    # Failed to predict input format
    N = int(input())
    A = list(map(int, list(input().split())))
    flag = True

    for a in A:
        if a % 2 == 0:
            if a % 3 == 0 or a % 5 == 0:
                flag=True
            else:
                flag=False
                break

    if flag == True:
        print('APPROVED')
    else:
        print('DENIED')
    pass

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define fr first
#define sc second
#define ll long long

using namespace std;
const int MN = 1e6+7;
const int MD = 1e9+7;
const ll BIG_INF = 1e18+7;
const int INF = 2147483645;

int a[MN], n;
string s;

int main()
{
    int a, b;
    cin >> a >> b;
    if(a > b)swap(a, b);
    if(a == 1 && b == 2){
        cout << 3;
        return 0;
    }
    if(a == 1 && b == 3){
        cout << 2;
        return 0;
    }
    if(a == 2 && b == 3){
        cout << 1;
        return 0;
    }

}


Measured memory_bytes: 256
import java.io.InputStream;
import java.io.PrintStream;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Scanner;
import java.util.concurrent.atomic.AtomicInteger;

public class Main {

  public static void main(String[] args) {
    resolve(System.in, System.out);
  }

  static void resolve(InputStream is, PrintStream pw) {
    Scanner sc = new Scanner(is);
    int n = Integer.parseInt(sc.next());
    Map<String, AtomicInteger> answers = new LinkedHashMap<>();
    answers.put("AC", new AtomicInteger(0));
    answers.put("WA", new AtomicInteger(0));
    answers.put("TLE", new AtomicInteger(0));
    answers.put("RE", new AtomicInteger(0));
    for (int i = 0; i < n; i++) {
      String s = sc.next();
      answers.get(s).incrementAndGet();
    }
    answers.entrySet().forEach(
      e -> {
        pw.println(e.getKey() + " x " + e.getValue());
      }
    );
  }
}


Measured memory_bytes: 58172
#include <bits/stdc++.h>
 
using namespace std;
 
const int N = 1 * 1000 + 17;
const int MOD = 1000 * 1000 * 1000 + 7;

struct tinder {
    int n, u;
    vector< vector<int> > g;
    vector<int> used, mt;

    tinder(int n) : n(n), u(1) {
        g.resize(n);
        used.resize(n, 0);
        mt.resize(n, -1);
    }

    void add_edge(int i, int j) {
        g[i].emplace_back(j);
    }
    
    bool dfs(int v) {
        if (used[v] == u)
            return false;

        used[v] = u;

        for (const auto& to : g[v])
            if (mt[to] == -1 || dfs(mt[to])) {
                mt[to] = v;
                return true;
            }

        return false;
    }

    vector<int> tyan() {
        for (int i = 0; i < n; ++i, ++u)
            dfs(i);

        assert(!count(mt.begin(), mt.end(), -1));
        vector<int> res(n);

        for (int i = 0; i < n; ++i)
            res[mt[i]] = i;

        return res;
    }
};

int n, m;
int a[N][N];

bool read() {
    if (!(cin >> n >> m))
        return false;

    for (int i = 0; i < n; ++i)
        for (int j = 0; j < m; ++j)
            cin >> a[i][j], --a[i][j];

    return true;
}

void solve() {
    for (int j = 0; j < m; ++j) {
        tinder T(n);

        for (int i = 0; i < n; ++i)
            for (int j1 = j; j1 < m; ++j1)
                T.add_edge(i, a[i][j1] / m);
        
        auto mt = T.tyan();
        
        for (int i = 0; i < n; ++i)
            for (int j1 = j; j1 < m; ++j1)
                if (mt[i] == a[i][j1] / m) {
                    for (int j2 = j1; j2 > j; --j2)
                        swap(a[i][j2], a[i][j2 - 1]);

                    break;
                }
    }

    for (int i = 0; i < n; ++i)
        for (int j = 0; j < m; ++j)
            cout << a[i][j] + 1 << " \n"[j == m - 1];

    for (int j = 0; j < m; ++j) {
        vector<int> sex;

        for (int i = 0; i < n; ++i)
            sex.emplace_back(a[i][j]);

        sort(sex.begin(), sex.end(), [] (int a, int b) {
            return a / m < b / m;
        });

        for (int i = 0; i < n; ++i)
            a[i][j] = sex[i];
    }

    for (int i = 0; i < n; ++i)
        for (int j = 0; j < m; ++j)
            cout << a[i][j] + 1 << " \n"[j == m - 1];
}
 
int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    while (read())
        solve();
 
    return 0;
}



Measured memory_bytes: 768
#include <iostream>
#include <iomanip>
// std::cout << std::setprecision(2) << 3.141; // "3.1"
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <map>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<double, double, double> tddd;

static const int giga = pow(10,9);
// double pi = 3.141592653589793238463;

int main(void){
  int n;
  cin >> n;

  int ans = 0;

  for(int i = 0; i < n; i++){
    int l,r;
    cin >> l >> r;
    ans += (r-l+1);
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<int,int> P;
const LL mod=1000000007;
const LL LINF=1LL<<62;
const LL INF=1<<17;



int main(){
    int n;cin >> n;
    char c[n-1];
    int a[n];
    for (int i = 0; i < 2*n-1; i++) {
        if(i%2==0) cin >> a[i/2];
        else cin >> c[i/2];
    }
    LL dp[n][3];
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < 3; j++) {
            dp[i][j]=-LINF;
        }
    }
    dp[0][0]=a[0];
    for (int i = 0; i < n-1; i++) {
        if(c[i]=='+'){
            dp[i+1][0]=max(dp[i][0]+a[i+1],dp[i][1]+a[i+1]);
            dp[i+1][1]=dp[i][1]-a[i+1];
            dp[i+1][2]=dp[i][2]+a[i+1];
        }
        else{
            dp[i+1][1]=dp[i][0]-a[i+1];
            dp[i+1][2]=max(dp[i][2]+a[i+1],dp[i][1]+a[i+1]);
        }
    }
    cout << max({dp[n-1][0],dp[n-1][1],dp[n-1][2]}) << endl;
    return 0;
}




Measured memory_bytes: 3072
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

static const double EPS = 1e-8;
static const double PI = 4.0 * atan(1.0);
static const double PI2 = 8.0 * atan(1.0);

#define REP(i,n)	for(int i=0;i<(int)n;++i)
#define ALL(c)		(c).begin(),(c).end()
#define CLEAR(v)	memset(v,0,sizeof(v))
#define MP(a,b)		make_pair((a),(b))
#define ABS(a)		((a)>0?(a):-(a))
#define FOR(i,s,n)	for(int i=s;i<(int)n;++i)

ll n;
ll a[50];

bool solve(ll k) {
	ll res = 0;
	REP(i, n) res += (a[i] + k - (n - 1) + n) / (n + 1);
	return res <= k;
}

int main(int argc, char **argv) {
	cin >> n;
	REP(i, n) cin >> a[i];
	ll l = -1, h = (10000000000000000 + 1000) * 50 + 1;
	while (l + 1 < h) {
		ll m = (l + h) / 2;
		ll res = -1;
		for (ll i = max(l + 1, m - n); i <= m; ++i) if (solve(i)) {
			res = i;
			break;
		}
		if (res >= 0) h = res;
		else l = m;
	}
	cout << h << endl;
	return 0;
}


Measured memory_bytes: 256
n, k = map(int, input().split())
a = list(map(int, input().split()))
first_visit = [-1] * n
first_visit[0] = 0
idx = 0
turn = 1
base = n
while True:
    # 今idx にいる。次の場所をidx にいれる。
    if first_visit[a[idx] - 1] == -1:
        first_visit[a[idx] - 1] = turn
        if turn == k:
            print(a[idx])
            exit()
    else:
        base = a[idx] - 1
        # 基準になるループの開始点
        break
    idx = a[idx] - 1
    turn += 1
#print(first_visit, turn, base)
mod = (k - first_visit[base]) % (turn - first_visit[base])
ans = first_visit.index(first_visit[base] + mod)
print(ans + 1)


Measured memory_bytes: 32336
#include<stdio.h>
#include <string.h>


int main(){
    char a[200001], b[200001];
    scanf("%s", a);
    scanf("%s", b);
    int ans = 0;
    int n = strlen(a);
    for(int i = 0; i < n; i++){
        if(a[i] != b[i]){
            ans++;
        }
    }

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

Measured memory_bytes: 2076
#pragma GCC optimize("O3") 

#include <bits/stdc++.h>
using namespace std;

typedef long long int           ll;
typedef unsigned long long int  ull;
typedef long double             ld;

typedef pair<int, int>          pii;
typedef pair<ll,ll>             pll;
typedef vector<int>             vi;
typedef vector<ll>              vll;
typedef vector<pii>             vpii;
typedef vector<pll>             vpll;

#define test(t)		        int t; cin >> t; while(t--)
#define f(i, a, b)	        for(int (i) = (a); (i) < (b); ++(i))
#define all(a)		        (a).begin(), (a).end()
#define endl 		        "\n"
#define maxvec(vec)             *max_element(all(vec))
#define minvec(vec)             *min_element(all(vec))
#define maxarr(arr)             *max_element(arr, arr + n)
#define minarr(arr)             *min_element(arr, arr + n)
#define deb(x)		        cout << #x << "--" << x << "--" << endl;
#define deb2(x,y)	        cout << #x << "-" << x << "-" << " ~~ " <<  #y << "-" << y << "-" << endl;
#define deba(arr)	        cout << #arr << " ~ [ "; for(auto n: arr) cout << n << " "; cout << "]" << endl;
#define debap(arr)	        cout << #arr << " ~ [ "; for(auto n: arr) cout << n.first << "-" << n.second << " "; cout << "]" << endl;
#define fast 		        ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

#define mx9		1000000007
#define mx7		10000007
#define mx6		1000006
#define mx5		200005
#define inf		1<<30                                 
#define eps		1e-9
#define mod		1000000007
#define PI		3.141592653589793238462643383279502884L

void solve()
{
  ll n;
  cin >> n;
  ll a[n], cnt = 0;
  f(i, 0, n)
  {
    	cin >> a[i];
    if(a[i] % 2 && (i + 1) % 2)
      cnt += 1;
  }
  cout << cnt << endl;
  
}

int main()
{
    fast;
    //test(t)
        solve();
    return 0;
}

Measured memory_bytes: 3608
a = input()
if (a[-1] == '0' and (int(a[0]) >= int(a[1]))):
    ans = int(a[0] * 3)
elif(int(a[0]) >= int(a[2]) and int(a[0]) >= int(a[1]) and a[-1] != '0'):
    ans = int(a[0] * 3)
else:
    ans = str(int(a[0])+1)*3
print(ans)


Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <array>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <list>
#include <numeric>
#include <stack>
#include <iomanip>
#include <random>
#include <complex>
#include <functional>
#include <tuple>

using namespace std;

#define Rep(i,a,b) for(ll i = a; i < b; ++i)
#define rep(i,b) Rep(i,0,b)
#define allof(a) (a).begin(), (a).end()

#define Yes(q) ((q) ? "Yes" : "No")
#define YES(q) ((q) ? "YES" : "NO")
#define Possible(q) ((q) ? "Possible" : "Impossible")
#define POSSIBLE(q) ((q) ? "POSSIBLE" : "IMPOSSIBLE")

using ll = long long;

constexpr int inf = 1e9 + 7;
constexpr ll infll = 1ll << 60ll;
constexpr ll mod = 1e9 + 7;
// 0~3までは右左下上 4~7までは斜め
constexpr int dx[] = { 1, 0, -1, 0, 1, 1, -1, -1 };
constexpr int dy[] = { 0, -1, 0, 1, 1, -1, -1, 1 };

namespace {
    template<typename T> void chmax(T& a, T b) { a = std::max(a, b); }
    template<typename T> void chmin(T& a, T b) { a = std::min(a, b); }
    template<typename T> void chadd(T& a, T b) { a = a + b; }

    void Cout(long long x, const char* end = "\n") { std::cout << x << end; }
    template <typename T> void Cout(const T& x, const char* end = "\n") { std::cout << x << end; }
    template <typename T> void Cout(const std::vector<T>& x, const char* sep = " ", const char* end = "\n") { for (std::size_t i = 0, sz = x.size(); i < sz; i++) { std::cout << x[i] << (i == sz - 1 ? end : sep); } }

    // 標準入出力
    struct inp {
        std::size_t sz;
        inp(std::size_t _sz = 1) : sz(_sz) {}
        template <typename T> operator T () const { T a; std::cin >> a; return a; }
        template <typename T> operator std::vector<T>() const { std::vector<T> a(sz); for (std::size_t i = 0; i < sz; i++) std::cin >> a[i]; return a; }
    };

    // 2次元用の標準入出力
    template<typename T>
    struct inpn {
        std::size_t szi, szj;
        inpn(std::size_t _szi, std::size_t _szj) : szi(_szi), szj(_szj) {}
        operator std::vector<std::vector<T>>() const {
            std::vector<std::vector<T>> a(szi, std::vector<T>(szj));
            for (std::size_t i = 0; i < szi; ++i)
                for (std::size_t j = 0; j < szj; ++j) cin >> a[i][j];
            return a;
        }
    };

    inp inp1; // input one
}

int main() {

    //int n, k;
    //cin >> n >> k;
    //int r, s, p;
    //cin >> r >> s >> p;
    //string t = inp1;

    int n, m;
    cin >> n >> m;
    vector<pair<ll, ll>> ab(n);
    rep(i, n) cin >> ab[i].first >> ab[i].second;

    sort(allof(ab));

    ll ans = 0LL;
    ll cnt = 0LL;
    rep(i, n) {
        if (cnt + ab[i].second >= m) {
            ans += (m - cnt) * ab[i].first;
            break;
        }
        else {
            ans += ab[i].first * ab[i].second;
            cnt += ab[i].second;
        }
    }

    Cout(ans);

    return 0;
}

Measured memory_bytes: 1792
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;

class C {
    static StreamWriter Out = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
    static void Main(string[] args) {
        long a, b, c;
        Input(out a, out b, out c);
        if(c - a - b < 0) {
            Print("No");
        } else {
            if(4 * a * b < (c - a - b) * (c - a - b)) {
                Print("Yes");
            } else {
                Print("No");
            }
        }
        Out.Flush();
    }
    static T ChangeT<T>(string s) => (T)Convert.ChangeType(s, typeof(T));
    static void Input<A>(out A a) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
    }
    static void Input<A, B>(out A a, out B b) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
        b = ChangeT<B>(words[1]);
    }
    static void Input<A, B, C>(out A a, out B b, out C c) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
        b = ChangeT<B>(words[1]);
        c = ChangeT<C>(words[2]);
    }
    static void Input<A, B, C, D>(out A a, out B b, out C c, out D d) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
        b = ChangeT<B>(words[1]);
        c = ChangeT<C>(words[2]);
        d = ChangeT<D>(words[3]);
    }
    static void Input<A, B, C, D, E>(out A a, out B b, out C c, out D d, out E e) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
        b = ChangeT<B>(words[1]);
        c = ChangeT<C>(words[2]);
        d = ChangeT<D>(words[3]);
        e = ChangeT<E>(words[4]);
    }
    static void Input<A, B, C, D, E, F>(out A a, out B b, out C c, out D d, out E e, out F f) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
        b = ChangeT<B>(words[1]);
        c = ChangeT<C>(words[2]);
        d = ChangeT<D>(words[3]);
        e = ChangeT<E>(words[4]);
        f = ChangeT<F>(words[5]);
    }
    static void Inputs<T>(out T[] array) {
        array = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries).Select(s => ChangeT<T>(s)).ToArray();
    }
    static void Print<T>(T s) => Out.WriteLine(s);
    static void Print<T>(params T[] s) => Out.WriteLine(string.Join(" ", s));
    static void Print<T>(IEnumerable<T> e) => Out.WriteLine(string.Join(" ", e));
}

Measured memory_bytes: 13268
import sys
sys.setrecursionlimit(10 ** 5)

X = int(input())

A = 0
k = 0
while True:
    a = X//(10**k)
    if a == 0:
        break
    A += a%10
    k += 1


if X % A == 0:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <algorithm>
#include <array>
#include <complex>
#include <utility>
#include <map>
int needleX[4] = { -1,0,1,0 };
int needleY[4] = { 0,1,0,-1 };

#define const INF=1<<21;
int main(){
	int N,T,A,ans=0;
    std::cin >> N;
    std::cin >> T >> A;
    int h;
    double ave,temp=1<<10;
    std::vector<double> res(N);
    for(int i=0;i<N;i++){
        std::cin >> h;
        ave=(double)T-(double)h*0.006;
        res[i]=ave;
    }
    for(int i=1;i<N;i++){
        if(fabs(res[i]-A)<=fabs(res[ans]-A)){
            ans=i;
        }
    }
    std::cout << ans+1 << std::endl;
}

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

template <typename T, typename E>
class lazy_segtree {
private:
    using Op = function<T(T, T)>;
    using Compose = function<E(E, E)>;
    using Act = function<T(T, E)>;
    using Power = function<E(E, int)>;

    size_t N;
    vector<T> data;
    vector<E> lazy;
    const T idT;
    const E idE;
    const Op op;
    const Compose compose;
    const Act act;
    const Power power;

    void eval(size_t k, size_t len) {
        if(lazy[k] == idE) return;
        if(2 * k + 1 < 2 * N) {
            lazy[2 * k] = compose(lazy[2 * k], lazy[k]);
            lazy[2 * k + 1] = compose(lazy[2 * k + 1], lazy[k]);
        }
        data[k] = act(data[k], power(lazy[k], len));
        lazy[k] = idE;
    }

    void update(size_t a, size_t b, size_t k, size_t l, size_t r, E x) {
        eval(k, r - l);
        if(r <= a || b <= l) return;
        if(a <= l && r <= b) {
            lazy[k] = compose(lazy[k], x);
            eval(k, r - l);
            return;
        }
        update(a, b, 2 * k, l, (l + r) / 2, x);
        update(a, b, 2 * k + 1, (l + r) / 2, r, x);
        data[k] = op(data[2 * k], data[2 * k + 1]);
    }

    T get(size_t a, size_t b, size_t k, size_t l, size_t r) {
        eval(k, r - l);

        if(r <= a || b <= l) return idT;
        if(a <= l && r <= b) return data[k];
        
        T vl = get(a, b, 2 * k, l, (l + r) / 2);
        T vr = get(a, b, 2 * k + 1, (l + r) / 2, r);
        if(2 * k + 1 < 2 * N) data[k] = op(data[2 * k], data[2 * k + 1]);
        return op(vl, vr);
    }

public:
    lazy_segtree(size_t n, T idT, E idE,
    const Op op, const Compose compose,
    const Act act, const Power power = [](E a, int){ return a; })
    : idT(idT), idE(idE), op(op), compose(compose), act(act), power(power) {
        for(N = 1; N < n; N <<= 1);
        data = vector<T>(2 * N, idT);
        lazy = vector<E>(2 * N, idE);
    }
    
    lazy_segtree(const vector<T> &init, T idT, E idE,
    const Op op, const Compose compose,
    const Act act, const Power power = [](E a, int){ return a; })
    : idT(idT), idE(idE), op(op), compose(compose), act(act), power(power) {
        for(N = 1; N < init.size(); N <<= 1);
        data = vector<T>(2 * N, idT);
        lazy = vector<E>(2 * N, idE);
        for(int i = 0; i < init.size(); ++i) data[i + N] = init[i];
        for(int i = N - 1; i >= 0; --i) data[i] = op(data[2 * i], data[2 * i + 1]);
    }

    void update(size_t left, size_t right, E x) {
        update(left, right, 1, 0, N, x);
    }

    T get(size_t left, size_t right) {
        return get(left, right, 1, 0, N);
    }

    T operator[](int k) {
        return get(k, k + 1);
    }
};


#include <iostream>

int main() {
    int n, q;
    cin >> n >> q;
    lazy_segtree<long long, long long> st(n, 0, 0,
    plus<long long>(), plus<long long>(), plus<long long>(), multiplies<long long>());

    while(q--) {
        int c, s, t; cin >> c >> s >> t;
        if(c == 0) {
            long long x; cin >> x;
            st.update(s - 1, t, x);
        } else {
            cout << st.get(s - 1, t) << endl;
        }
    }
}


Measured memory_bytes: 7056
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    if(a+b>=10){
      System.out.println("error");
    }else{
      System.out.println(a+b);
    }

  }
  

  
}


Measured memory_bytes: 21844
#include <algorithm>
#include <iostream>
#include <vector>
#include <array>
#include <string>
#include <cmath>
#include <iomanip>
#include <set>
#include <map>
#include <climits>
#include <utility>
#include <deque>
#include <list>
using namespace std;

int main()
{
	cout << fixed << setprecision(6);
	int n;
	cin >> n;
	vector<int> dls(n);
	for (auto& d : dls)cin >> d;

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

	cout << dls[n / 2] - dls[n / 2 - 1] << endl;

	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
#define pb push_back
#define mpr make_pair
#define pii pair<int, int>
#define pll pair<ll, ll>
#define ll long long
#define ld long double
#define all(arr) arr.begin(), arr.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define fo(i, l, r) for (int i = l; i <= r; i++)
#define INF 1000000001
#define inf1 1000000000000000001
#define mod 1000000007
#define pie 3.14159265358979323846264338327950L
#define N 100005
#define mid(l, r) l + (r - l) / 2
#define vec vector<int>
#define vecl vector<ll>
#define umap unordered_map<ll,ll>
#define yes cout << "Yes" << endl;
#define no cout << "No" << endl;
#define endl "\n"
using namespace std;

int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};  
int ddx[8]={1,1,0,-1,-1,-1,0,1},ddy[8]={0,1,1,1,0,-1,-1,-1};
ll gcd(ll a,ll b){ if(!a)return b;return gcd(b%a,a);}
ll lcm(ll a, ll b) { return (a*b)/ gcd(a,b);}



void test_case() {

    
	int n;
  cin>>n;
  
  cout<<(n+1)/2<<endl;


}


int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cout<<fixed<<setprecision(20);

    //    freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);


    int t = 1;
   //  cin >> t;
    while(t--)
    {   
        test_case();
    }
}


Measured memory_bytes: 3592
#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_C main
#include "bits/stdc++.h" 
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LONG_MAX/2)
const int MGN = 8;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
#endif

#ifdef _DEBUG
void init_global_C() {}
#else

#endif

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

    int A, B, C, D, E, F; cin >> A >> B >> C >> D >> E >> F;

    const int XAMAX = F / (100 * A);
    const int XBMAX = F / (100 * B);
    const int YAMAX = F / C;
    const int YBMAX = F / D;

    int total = 100*A, sugar = 0;
    REP(j, XBMAX+1) {
        REP(i, XAMAX+1){
            int wt = 100 * (A*i + B*j);
            if (wt > F) continue;

            REP(q, YBMAX+1){
                REP(p, YAMAX+1){
                    int sg = C * p + D * q;
                    if (wt + sg > F) continue;

                    // sg/(wt+sg) > sugar/total && sg/(wt+sg) <= E/(100+E)
                    if (sg*total > sugar*(wt+sg) && sg*(100+E) <= E*(wt+sg)) {
                        total = wt + sg;
                        sugar = sg;
                    }
                }
            }
        }
    }
    
    cout << total << " " << sugar << endl;

    return 0;
}

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

using namespace std;
typedef long long ll;
#define int ll

#define REP(i,n) for(ll i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const int MOD = 1000000007;
#define MAX_N 100010

ll N, M;

signed main()
{
    cin >> N >> M;
    if(N == 1 && M == 1) { printf("1\n"); }
    else if(N == 1 && M > 1) { printf("%lld\n", M - 2); }
    else if(M == 1 && N > 1) { printf("%lld\n", N - 2); }
    else { printf("%lld\n", (N-2) * (M-2)); }
    return 0;
}


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

int main() {

	int s;
	cin >> s;
	bool flag = true;
	int a=s;
	vector<int> backets(1000000);
	int i = 1;

	backets[s]++;

	while (flag)
	{
		i++;

		if (a % 2 == 0) {
			a = a / 2;
		}
		else if (a % 2 == 1) {
			a = 3 * a + 1;
		}

		if (backets[a] == 1) {
			flag = false;
		}
		else
		{
			backets[a]++;
		}
	}

	cout << i;

	return 0;
}

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

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

  cout << "Christmas";
  for(int i=0;i<25-D;i++) cout << " Eve";
  cout << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<ctype.h>
int main(void){
    int i, j, k;
    for(i=1; i<10; i++){
        for(j=1; j<10; j++){
                k = i*j;
            printf("%dx%d=%d\n", i, j, k);
        }
    }

    return 0;
}



Measured memory_bytes: 2044
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<stack>
#include<queue>
#include<cstring>
#include<vector>
using namespace std;
typedef long long ll;
#define N 5002
const int p=1e9+7;
struct edge{int to,nxxt;}e[N<<1];
int head[N],cnt=1,n,dp[N][N][2],f[N][2],siz[N],g[N];
inline void ins(int u,int v){e[cnt].to=v;e[cnt].nxxt=head[u];head[u]=cnt++;}
void dfs(int te,int la)
{siz[te]=1;dp[te][1][0]=1;
	for(int i=head[te];i;i=e[i].nxxt)
	{
		int j=e[i].to;if(j==la)continue;
		dfs(j,te);
		for(int ii=1;ii<=siz[te]+siz[j];ii++)f[ii][0]=f[ii][1]=0;
		for(int ii=1;ii<=siz[te];ii++)
		for(int jj=1;jj<=siz[j];jj++)
		{
			(f[ii+jj][0]+=(1ll*dp[te][ii][0]*dp[j][jj][0]%p+1ll*dp[te][ii][1]*dp[j][jj][1]%p)%p)%=p;
			(f[ii+jj][1]+=(1ll*dp[te][ii][0]*dp[j][jj][1]%p+1ll*dp[te][ii][1]*dp[j][jj][0]%p)%p)%=p;
			(f[ii][0]+=(1ll*dp[te][ii][0]*dp[j][jj][1]%p*g[jj]%p+
			1ll*dp[te][ii][1]*dp[j][jj][0]%p*g[jj]%p)%p)%=p;
			(f[ii][1]+=(1ll*dp[te][ii][0]*dp[j][jj][0]%p*g[jj]%p+
			1ll*dp[te][ii][1]*dp[j][jj][1]%p*g[jj]%p)%p)%=p;
		}
		for(int ii=1;ii<=siz[te]+siz[j];ii++)dp[te][ii][0]=f[ii][0],dp[te][ii][1]=f[ii][1];
		siz[te]+=siz[j];
	}
}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<n;i++)
	{
		int x,y;scanf("%d%d",&x,&y);
		ins(x,y);ins(y,x);
	}
	g[0]=1;for(int i=2;i<=n;i++)g[i]=1ll*g[i-2]*(i-1)%p;
	dfs(1,1);
	int ans=0;
	for(int i=2;i<=n;i+=2)ans=(1ll*ans+1ll*(dp[1][i][0]-dp[1][i][1]+p)*g[i]%p)%p;
	printf("%d\n",ans);
}


Measured memory_bytes: 194944
#include<stdio.h>
 int main()
 {
 	int n,res,i;
 	char str[3];
 	gets(str);
 	res=700;
 	for(i=0;i<3;i++)
 	{
 		if(str[i]=='o')
 		res+=100;
	 }
		printf("%d\n",res);
 	return 0;
  } 

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

using namespace std;

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

  int n;
  cin >> n;
  string s;
  cin >> s;
  int a = count(s.begin(), s.end(), 'W');
  int b = count(s.begin(), s.end(), 'R');
  int r = 0, w = 0;
  for (int i = 0; i < b; ++i) {
    r += s[i] == 'W';
  }
  for (int i = 0; i < a; ++i) {
    w += s[n - 1 - i] == 'R';
  }
  cout << min(w, r);

  return 0;
}


Measured memory_bytes: 3704
#pragma GCC target("sse,sse2,sse3,sse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast")

#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_dec_float.hpp>

using namespace std;
using ll = long long;

int main(){
    string s;cin >> s;
    if(s == "Sunny"){
        cout<<"Cloudy"<<endl;
    }
    if(s == "Cloudy"){
        cout<<"Rainy"<<endl;
    }
    if(s == "Rainy"){
        cout<<"Sunny"<<endl;
    }
}



Measured memory_bytes: 256
#設定
import sys
input = sys.stdin.buffer.readline

#ライブラリインポート
from collections import defaultdict

con = 10 ** 9 + 7
#入力受け取り
def getlist():
	return list(map(int, input().split()))

#処理内容
def main():
	A, B, C, D = getlist()
	while True:
		C -= B
		if C <= 0:
			print("Yes")
			break

		A -= D
		if A <= 0:
			print("No")
			break


if __name__ == '__main__':
	main()

Measured memory_bytes: 64744
/*  -*- coding: utf-8 -*-
 *
 * 2961.cc: 
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 100000;

/* typedef */

/* global variables */

bool primes[MAX_N + 1];
int pnums[MAX_N], asums[MAX_N + 1];

/* subroutines */

int gen_primes(int maxp, int pnums[]) {
  memset(primes, true, sizeof(primes));
  primes[0] = primes[1] = false;

  int p, pn = 0;
  for (p = 2; p * p <= maxp; p++)
    if (primes[p]) {
      pnums[pn++] = p;
      for (int q = p * p; q <= maxp; q += p) primes[q] = false;
    }
  for (; p <= maxp; p++)
    if (primes[p]) pnums[pn++] = p;
  return pn;
}

bool check(int pn, int pnums[], int n) {
  if (primes[n]) return false;

  int cnt = 0, e2 = 0;
  for (int i = 0; pnums[i] * pnums[i] <= n; i++)
    if (n % pnums[i] == 0) {
      cnt++;
      if (cnt >= 3 || e2 > 0) return true;
      int f = 1, &pi = pnums[i];
      n /= pi;
      while (n % pi == 0) f++, n /= pi;
      if (f >= 4) return true;
      if (f >= 2) {
	e2 = 1;
	if (cnt >= 2) return true;
      }
    }

  return (n > 1 && (cnt >= 2 || e2 > 0));
}

/* main */

int main() {
  int pn = gen_primes(MAX_N, pnums);
  //printf("pn=%d\n", pn);

  for (int n = 2; n <= MAX_N; n++) {
    bool c = check(pn, pnums, n);
    //printf("n=%d: c=%d\n", n, c);
    asums[n] = asums[n - 1] + (c ? 1 : 0);
  }

  int qn;
  scanf("%d", &qn);

  while (qn--) {
    int n;
    scanf("%d", &n);
    printf("%d\n", asums[n]);
  }
  return 0;
}



Measured memory_bytes: 3752
#include <stdio.h>

int main()
{
	int A, B;
	int flag = 1;
	char S[11] = {};

	scanf("%d %d",&A, &B);
	scanf("%s", S);
	
	for(int i = 0; i < A+B+1; i++){
		if((i==A)&&(S[i]!='-')){
			flag = 0;
		}
		if((i!=A)&&(S[i]=='-')){
			flag = 0;
		}
/*		if(S[A+B]!='\0'){
			flag = 0;
		}
*/	}

	if(1 == flag){
		printf("Yes\n");
	}else{
		printf("No\n");
	}

	return 0;
}

Measured memory_bytes: 128
using System;
using static System.Console;
using System.Collections.Generic;
using System.Linq;

namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var a = InputNumList();

            WriteLine(a[0] - a[1] >= 0 ? a[0] - a[1] : 0);
        }

        static List<int> InputNumList()
        {
            return ReadLine().Split(' ').Select(int.Parse).ToList();
        }
    }
}



Measured memory_bytes: 11220
#include <bits/stdc++.h>
using namespace std;
#define int         long long
#define endl        "\n"
#define P           pair<int, int>
#define dint        long double

const int mod = 998244353;

inline int add(int a, int b) { int res = a + b; if(res >= mod) res -= mod;  return res; }
inline int sub(int a, int b) { int res = a - b; if(res < 0) res += mod; return res;}
inline int mul(int a, int b) { return (a * b)%mod; }

int modpow(int a, int b) {
    if(a == 0 || a == 1 || b == 1) return a;
    int ans = 1;
    while(b) {
        if(b%2) ans = mul(ans, a);    
        b /= 2; a = mul(a, a);
    }   return ans;
}

const int N = 1e6+6;
int n;
int cnt[N];
int sum_prod[N];

int Inv(int a) {
    return modpow(a, mod - 2);
}

void solve() {
    cin >> n;
    for(int i=0; i<n; i++) {
        int x; cin >> x;
        cnt[x]++;
    }   
    int ans = 0;
    for(int g = N-1; g > 0; g--) {
        int sum1 = 0, sum2 = 0;
        for(int k=g; k<N; k+=g) {
            sum1 = add(sum1, mul(cnt[k], k));
            sum2 = add(sum2, mul(cnt[k], mul(k, k)));
            sum_prod[g] = sub(sum_prod[g], sum_prod[k]);
        }
        int sum_p = sub(mul(sum1, sum1), sum2);
        sum_p = mul(sum_p, Inv(2));
        sum_prod[g] = add(sum_p, sum_prod[g]);
        ans = add(ans, mul(sum_prod[g], Inv(g)));
    }
    cout << ans << endl;
}

signed main() {

    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    cout << fixed << setprecision(12);

    int T = 1;
    //cin >> T;

    while(T--) {
        solve();
    }
    return 0;
}



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

#define ll long long

using namespace std;

const int MAXN = 100010;
const int MAXM = 100010;
const int MAXINT = 2147483647;
const int INF = 0x3f3f3f3f;
const int mod = 1e9 + 7;

int n, m, k;
int ans, tot, cnt;

int a[MAXN];

string s;

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

map<string, int> mp;

int main(){
	int T;
	scanf("%d", &n);
	for (int i = 1; i <= n; i++) {
		cin >> s;
		mp[s]++;
	}
	printf("AC x %d\nWA x %d\nTLE x %d\nRE x %d\n", mp["AC"], mp["WA"], mp["TLE"], mp["RE"]);
	return 0;
}

/*

*/


Measured memory_bytes: 3796
#!/usr/bin/python3
# -*- coding:utf-8 -*-

def main():
  MAX = 10**9+7
  
  n, m = map(int, input().strip().split())
  As = set([int(input()) for _ in range(m)])
  
  dp = [0] * (n + 1)
  dp[0] = 1
  dp[1] = 1 if 1 not in As else 0
  for i in sorted(list(set(range(2, n+1)) - As)):
    dp[i] = (dp[i-1] + dp[i-2]) % MAX
  print(dp[-1] % MAX)
  
if __name__=='__main__':
  main()



Measured memory_bytes: 21132
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    int a, b, c, d, e;
    cin >> a >> b >> c >> d >> e;
    int val = (c-a)*60+(d-b)-e;
    cout << val << "\n";
    return 0;
}

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

const int maxn = 3005;

char s[maxn], t[maxn];

int dp[3005][3005];

int main()
{
    scanf("%s",s+1);
    scanf("%s",t+1);
    int n = strlen(s+1);
    int m = strlen(t+1);
    for(int i = 1; i <= n; i++)
    {
        for(int j = 1; j <= m; j++)
        {
            if(s[i] == t[j])
                dp[i][j] = dp[i-1][j-1] + 1;
            else
                dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
        }
    }

    string ans = "";
    int i = n, j = m;
    while(i && j)
    {
        if(s[i] == t[j])
        {
            ans += s[i];
            i--,j--;
        }
        else if(dp[i-1][j] > dp[i][j-1])
        {
            i--;
        }
        else
        {
            j--;
        }
    }
    reverse(ans.begin(),ans.end());
    printf("%s\n",ans.c_str());

    return 0;
}

Measured memory_bytes: 35456
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
typedef long double ld;
#define pb emplace_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define ALL(x) x.begin(), x.end() 
#define SZ(x) (int)x.size()
#define f first
#define s second
const int MAXN=7;
const int MAXK=18;
const int INF = 1e9;
const ll MOD = 998244353;

ll N,R,C;

int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);
	vi A;
	cin>>N;
	for(int i=0;i<N;++i){int a;cin>>a;A.pb(a);}
	sort(ALL(A));
	priority_queue<ll>pq;
	pq.push(A.back());A.pop_back();
	ll ans=0;
	while(SZ(A)){
		ans+=pq.top();pq.pop();
		pq.push(A.back());pq.push(A.back());
		A.pop_back();
	}
	cout<<ans;
}

Measured memory_bytes: 6116
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <string>

#define rep(i, a, b) for ( int i = (a); i < (b); i++ )
#define per(i, a, b) for ( int i = (b)-1; i >= (a); i--)
#define pb push_back
#define mp make_pair
#define bg begin()
#define en end()
#define all(v) (v).begin(), (v).end()
#define sz(v) (int)(v).size()

using namespace std;

typedef long long ll;
typedef long double ld;

using P = pair<int, int>;

static const long long MOD = 1000000007;
static const long long LINF = (ll)(1e18+99);
static const int INF = 1e9+99;

const int MAX = 40;

int ans;
int n;
int c[MAX];

int main(void) {
    cin >> n;
    vector<ll> a(n);
    rep(i, 0, n) cin >> a[i];

    rep(i, 0, MAX) {
        rep(j, 0, n) c[i] += ((a[j]>>i)&1LL);
    }

    rep(i, 0, n) {
        rep(j, 0, MAX) {
            if (c[j]%2==1) {
                if (a[i]&(1LL<<j)) a[i] -= (1LL<<j);
                else a[i] += (1LL<<j);
            }
        }

    }

    rep(i, 0, n) {
        if (i>0) printf(" ");
        printf("%lld", a[i]);
    }

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



Measured memory_bytes: 4856
using System;
using System.Collections.Generic;
class Solve{
    string s;
    int N;
    public Solve(){}
    public static int Main(){
        new Solve().Calc();
        return 0;
    }
    void Calc(){
        getinput();
        int p = N/2;
        int c = 0;
        for(int i=0;i<N;i++){
            if(s[i] == 'p'){
                c++;
            }
        }
        Console.WriteLine(p-c);
    }
    void getinput(){
        s = Console.ReadLine();
        N = s.Length;
    }    
}

Measured memory_bytes: 3032
fun main(args: Array<String>){

//    var (H, W) = readLine()!!.split(" ").map{it.toInt()}
    var N = readLine()!!.toInt()
    var S = readLine()!!.toCharArray()
    var whiteCount = IntArray(N){0}
    var blackCount = IntArray(N){0}

    if(S[0] == '.'){
        whiteCount[0] = 1
    } else {
        blackCount[0] = 1
    }

    for(i in 1 until N){
        if(S[i] == '.'){
            whiteCount[i] = whiteCount[i-1] + 1
            blackCount[i] = blackCount[i-1]
        } else {
            whiteCount[i] = whiteCount[i-1]
            blackCount[i] = blackCount[i-1] + 1
        }

    }

    var ans = whiteCount[N-1]
    for(i in S.indices){
        var tmpans = blackCount[i] + whiteCount[N-1] - whiteCount[i]
        ans = Math.min(ans,tmpans)
    }

    println(ans)


}

Measured memory_bytes: 40656
h, w = map(int, input().split())
s_input = []
for i in range(h):
    s_input.append(input())

s_output = []
for i in range(h):
    s_output_row = ''
    for j in range(w):
        if s_input[i][j] == '.':
            count = 0
            for i_add in range(3):
                if (i + i_add - 1) < 0 or (i + i_add - 1) >= h:
                    continue
                for j_add in range(3):
                    if (j + j_add - 1) < 0 or (j + j_add - 1) >= w:
                        continue
                    if s_input[i + i_add - 1][j + j_add - 1] == '#':
                        count += 1
            s_output_row += str(count)
        else:
            s_output_row += s_input[i][j]
    s_output.append(s_output_row)

for s_print in s_output:
    print(s_print)

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

int main() {
  string s;
  int n;
  cin >> s;
  
  n = s.size();
  bool a = false, b = false, c = false;
  
  for (int i = 0; i < s.size(); i++){
    if (s.at(i) == s.at(n-i - 1)){
      a = true;
    }
    else {
      a = false;
      break;
    }
  }
  for (int i = 0; i < (n-1)/2 ; i++){
    if (s.at(i) == s.at((n-1)/2 - i -1)){
      b = true;
    }
    else {
      b = false;
      break;
    }
  }
  for (int i = 0; i < (n-1)/2; i++){
    if (s.at((n-1)/2 + i + 1) == s.at(n-i-1)){
      c = true;
    }
    else {
      c = false;
      break;
    }
  }
  
  if (a == true && b == true && c == true){
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}
        

Measured memory_bytes: 256
using System;
using System.Text.RegularExpressions;
using System.Linq;
using System.Collections.Generic;
using System.IO;
using System.Numerics;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });

            var str = Console.ReadLine();

            if (((str.Count(c => c == 'E') == 0 && str.Count(c => c == 'W') == 0) || (str.Count(c => c == 'E') > 0 && str.Count(c => c == 'W') > 0)) &&
                ((str.Count(c => c == 'N') == 0 && str.Count(c => c == 'S') == 0) || (str.Count(c => c == 'N') > 0 && str.Count(c => c == 'S') > 0)) )
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }

            Console.Out.Flush();
        }


        static string ReadLine()
        {
            StringBuilder sb = new StringBuilder();
            while (true)
            {
                int ch = Console.Read();
                if (ch == -1) break;
                if (ch == '\r' || ch == '\n')
                {
                    if (ch == '\r') Console.Read();
                    return sb.ToString();
                }
                sb.Append((char)ch);
            }
            if (sb.Length > 0) return sb.ToString();
            return null;
        } 
    }
}

Measured memory_bytes: 2776
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
const ll mod=1e9+7;
ll mu(ll a,ll b){
  return (ll)a*b%mod;
}
ll ad(ll a,ll b){
  if((a+=b)>=mod)a-=mod;
  return a;
}
ll pw(ll a,ll b,ll c=1LL){
  for(;b;b>>=1,a=mu(a,a))if(b&1)c=mu(c,a);
  return c;
}
ll dv(ll a,ll b){
  return mu(a,pw(b,mod-2));
}

void comb(ll *c, ll n){
  c[0] = 1;
  rep1(i,n){
    c[i] = mu(c[i - 1], mu(n + 1 - i, dv(1,i)));
  }

}

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

  int n;
  cin >> n;
  int a[n];
  set<int> s;
  int d;
  rep(i,n+1){
    cin >> a[i];
    if(s.count(a[i])==1) d=i;
    s.insert(a[i]);
  }
  rep(i,n+1){
    if(a[i]==a[d]){
      d=d-i-1;
      break;
    }
    
  }
  // nCk を計算 comb()で初期化、計算やってくれる。
  ll nc = n+1;
  ll C[nc + 1];
  comb(C, nc);
  ll ncs = n+1-(d+2);
  ll Cs[ncs+1];
  comb(Cs, ncs);
  rep1(i,n+1){
    if(i>=n+1-d){
      cout << C[i] << endl;
    }
    else{
      ll ans = ad(C[i],-Cs[i-1]);
      if(ans<0) ans+=mod;
      cout << ans << endl;
    }
  }



  


  
  
  return 0;
    

}


Measured memory_bytes: 7808
#include<cstdio>
#include<algorithm>
int main(){
    int n,m,x[101],y[101];
    scanf("%d%d%d%d",&n,&m,&x[0],&y[0]);
    for(int i=1;i<=n;i++)scanf("%d",&x[i]);
    for(int i=1;i<=m;i++)scanf("%d",&y[i]);
    std::sort(x,x+n+1);
    std::sort(y,y+m+1);
    if(x[n]<y[0])printf("No War");
    else printf("War");
    return 0;
}

Measured memory_bytes: 128
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

public class Main {
	static BufferedReader br;
	static PrintWriter pw;
	static int inf = (int) 1e9;
	static long mod = (long) 1e9 + 7;

	public static void main(String[] args) throws NumberFormatException, IOException, InterruptedException {
		br = new BufferedReader(new InputStreamReader(System.in));
		pw = new PrintWriter(System.out);
		StringTokenizer st = new StringTokenizer(br.readLine());
		int s = Integer.parseInt(st.nextToken());
		int w = Integer.parseInt(st.nextToken());
		if(w>=s)
			pw.println("unsafe");
		else
			pw.println("safe");
		pw.flush();

	}

	static int n;
	static boolean[] visited;
	static ArrayList<Integer>[] g;

	static void bfs(int s, int[] arr) {
		Queue<Integer> q = new LinkedList<Integer>();
		q.add(s);
		visited = new boolean[n];
		visited[s] = true;
		arr[s] = 0;
		while (!q.isEmpty()) {
			int u = q.remove();

			for (int v : g[u])
				if (!visited[v]) {
					visited[v] = true;
					q.add(v);
					arr[v] = arr[u] + 1;
				}
		}
	}

	static class Edge implements Comparable<Edge> {
		int node, cost, con;

		Edge(int a, int b, int c) {
			node = a;
			cost = b;
			con = c;
		}

		public int compareTo(Edge e) {
			return cost - e.cost;
		}
	}

	static class pair implements Comparable<pair> {
		int x;
		int y;

		public pair(int d, int u) {
			x = d;
			y = u;
		}

		public int compareTo(pair o) {
			return y - o.y;
		}

	}

	static class triple implements Comparable<triple> {
		int x;
		int y;
		int z;

		public triple(int a, int b, int c) {
			x = a;
			y = b;
			z = c;
		}

		public int compareTo(triple o) {
			return x - o.x;
		}
	}

	static int[] nxtarr() throws IOException {
		StringTokenizer st = new StringTokenizer(br.readLine());
		int[] a = new int[st.countTokens()];
		for (int i = 0; i < a.length; i++) {
			a[i] = Integer.parseInt(st.nextToken());
		}
		return a;
	}

	static long pow(long a, long e) // O(log e)
	{
		long res = 1;
		while (e > 0) {
			if ((e & 1) == 1)
				res *= a;
			a *= a;
			e >>= 1;
		}
		return res;
	}

	static int gcd(int a, int b) {
		if (a == 0)
			return b;
		return gcd(b % a, a);
	}
}


Measured memory_bytes: 32832
k=int(input())
i=1
a=7%k
m=10
v=set()
while True:
    v.add(a)
    if a==0:
        print(i)
        exit()
    a += m*7 %k
    a %= k
    if a in v:
        print(-1)
        exit()
    i+=1
    m *= 10
    m %= k

Measured memory_bytes: 77992
#include<bits/stdc++.h>
using namespace std;
int main() {
    int n;
    char s[n+1];
    int k;
    cin >> n;
    for(int i=0;i<n;i++) {
        cin >> s[i];
    }
    cin >> k;
    for(int i=0;i<strlen(s);i++) {
        if(s[i]!=s[k-1]) {s[i]='*';}
    }
    for(int i=0;i<n;i++) {cout << s[i];}
}


Measured memory_bytes: 256
l = [[[0] * 10 for _ in range(3)] for _ in range(4)]
for _ in range(int(input())):
    b, f, r, v = map(int, input().split())
    l[b - 1][f - 1][r - 1] += v

for x in range(4):
    for y in range(3):
        print(end = " ")
        print(*l[x][y])
    if x != 3:
        print("####################")

Measured memory_bytes: 7732
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i, n) FOR(i, 0, (n))
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define LAR(a, b) ((a)=max((a),(b)))
#define SML(a, b) ((a)=min((a),(b)))
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pair<int, int>> vpii;
typedef pair<int, int> pii;
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define ALL(a) (a).begin(), (a).end()
#ifdef LOCAL_DEBUG
#define DEBUG(...) printf(__VA_ARGS__)
#else
#define DEBUG(...)
#endif

int main(){
	int a, b; scanf("%d%d", &a, &b);
	printf("%d\n", max(0, a-2*b));
}


Measured memory_bytes: 256