akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
using namespace std;
typedef long long lng;
#define FOR(i,a,b) for(int i=(a); i<=(b); ++i)
#define FORD(i,b,a) for(int i=(b); i>=(a); --i)
#define REP(i,n) FOR(i,0,n-1)
#define ALL(a) (a).begin(), (a).end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end()) //ATTENTION: <a> must be sorted in advance

lng power(lng b, lng n) {lng sol=1; while(n>0) {if(n&1) {sol=sol*b;} n>>=1; b*= b;} return sol;} //calculate b^n

const int MOD = 1000000007; //10^9+7


/*********** variables ************/
int r, g, b;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> r >> g >> b;
    if((g*10+b)%4==0) {
        cout << "YES" << endl;
    }
    else cout  << "NO" << endl;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <cmath>

using namespace std;
vector<int> g[100010];
int arr[200010], c[200010], h[100010];
bool used[100010];

int dfs(int v = 0, int d = 0) {
	h[v] = d;
	used[v] = true;
	int sum = 1;
	for (int to : g[v]) {
		if (!used[to]) {
			sum += dfs(to, d + 1);
		}
	}
	c[v] = sum;
	return sum;
}

int getP(int v, int d) {
	if (d == h[v]) {
		return c[v];
	}
	for (int to : g[v]) {
		if (h[to] < h[v]) {
			return getP(to, d);
		}
	}
}

int main() {
	int n, m, a, b;
	cin >> n;
	for (int i = 0; i < n - 1; ++i) {
		cin >> a >> b;
		--a;
		--b;
		g[a].push_back(b);
		g[b].push_back(a);
	}
	dfs(0);
	int nh = ceil(double(h[n - 1] + 1) / 2);
	int x = getP(n - 1, nh);
	cout << (x >= n - x ? "Snuke" : "Fennec");
	return 0;
}

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

// #undef DEBUG  // Uncomment this line to forcefully disable debug print.
#if DEBUG
template <typename T>
void debug(T value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define dbg(...)                              \
  do {                                        \
    cerr << #__VA_ARGS__ << ": ";             \
    debug(__VA_ARGS__);                       \
    cerr << " (L" << __LINE__ << ")" << endl; \
  } while (0)
#else
#define dbg(...)
#endif

void read_from_cin() {}
template <typename T, typename... Ts>
void read_from_cin(T& value, Ts&... args) {
  std::cin >> value;
  read_from_cin(args...);
}
#define in(type, ...) \
  type __VA_ARGS__;   \
  read_from_cin(__VA_ARGS__);

template <typename T>
void write_to_cout(const T& value) {
  std::cout << value << std::endl;
}
template <typename T, typename... Ts>
void write_to_cout(const T& value, const Ts&... args) {
  std::cout << value << ' ';
  write_to_cout(args...);
}
#define out(...) write_to_cout(__VA_ARGS__);

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

using ll = long long;

using namespace std;

int main() {
  in(string, s, t);
  s = s + s;
  vector<ll> last(26, -1);
  vector<vector<ll>> next(s.size(), vector(26, 0LL));
  for (int i = s.size() - 1; i >= 0; --i) {
    last[s[i] - 'a'] = i;
    rep(j, 26) {
      // dbg((char)('a'+j), last[j]);
      next[i][j] = last[j] == -1 ? -1 : last[j] - i;
    }
  }
  ll ans = 0;
  ll si = 0;
  rep(i, t.size()) {
    ll n = next[si][t[i] - 'a'];
    // dbg(t[i], n);
    if (n == -1) {
      out(-1);
      return 0;
    }
    ans += n + 1;
    si = (si + n + 1) % (s.size() / 2);
    // dbg(si);
  }
  out(ans);
}


Measured memory_bytes: 52100
s = input()
ans = [0]*len(s)
counter = 1
RLSwitch = 0 # if start from "R" 0 else 1
for i in range(1, len(s)):
    if RLSwitch == 0: # start from "R"
        if s[i] == "L":
            pos = i
            if counter % 2 == 1:
                ans[i-1] += counter // 2 + 1
                ans[i] += counter // 2
            else:
                ans[i-1] += counter // 2
                ans[i] += counter // 2
            counter = 1
            RLSwitch = 1
            
            if i == len(s)-1:
                ans[i] += 1
        else:
            counter += 1
    
    else: # start from "L"
        if s[i] == "R":
            if counter % 2 == 1:
                ans[pos-1] += counter // 2 
                ans[pos] += counter // 2 + 1
            else:
                ans[pos-1] += counter // 2
                ans[pos] += counter // 2
            counter = 1
            RLSwitch = 0
        else:
            counter += 1
            
        if i == len(s)-1:
            if counter % 2 == 1:
                ans[pos-1] += counter // 2 
                ans[pos] += counter // 2 + 1
            else:
                ans[pos-1] += counter // 2
                ans[pos] += counter // 2            

print(*ans)

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

const long long INF = (long long) 1e18 + 1ll;
 
int main(){
  long long n, k;
  cin >> n >> k;
  long long a[n];
  for ( int i = 0; i < n; i++ ) {
    cin >> a[i];
  }
  sort(a, a+n);

  long long left = -INF, right = INF;
  while ( right - left > 1 ) {
    long long mid = (right+left) / 2;
    long long s = 0, t = 0;

    for ( int i = 0; i < n; i++ ) {

      if ( a[i] > 0 ){

        int l = -1, r = n;
        while ( r - l > 1) {
          int m = (r + l) / 2;
          if ( a[i] * a[m] <= mid ) { l = m; } else { r = m; }
        }
        s += r;

      } else if ( a[i] < 0 ) {

        int l = -1, r = n;
        while ( r - l > 1 ) {
          int m = (r + l) / 2;
          if(a[i] * a[m] <= mid) { r = m; } else { l = m; }
        }
        s += n - r;

      } else if ( mid >= 0 ) {

        s += n;

      }

      if ( a[i] * a[i] <= mid ) { t++; }

    }

    long long num = (s - t) / 2;
    if ( num >= k ) { right = mid; } else { left = mid; }
  }

  cout << right << endl;
}

Measured memory_bytes: 5200
#include "bits/stdc++.h"

#define debug(x) cout<<#x<<": "<<x<<endl
#define rep(i,n) for (int i=0;i<(n);i++)
#define FOR(i,a,b) for (int i=(a);i<=(b);i++)
#define all(a) (a).begin(),(a).end()
using namespace std;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef long long ll;

void solve() {
#ifdef _WIN32
	istream &cin = ifstream("input.txt");
#endif
	int a, b;
	cin >> a >> b;
	vector<string> v1(a), v2(b);
	rep(i, a) cin >> v1[i];
	rep(i, b) cin >> v2[i];

	rep(i, a - b + 1) {
		rep(j, a - b + 1) {
			bool flag = true;
			rep(k, b) {
				rep(l, b) {
					if (v1[i + k][j + l] != v2[k][l]) {
						flag = false;
						break;
					}
				}
			}
			if (flag) {
				cout << "Yes" << endl;
				return;
			}
		}
	}
	cout << "No" << endl;
}




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


	solve();
#ifdef _WIN32
	system("PAUSE");
#endif
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long n,i;
    cin>>n;
    char a[n],b[n];
    for(i=0;i<n;i++)
    cin>>a[i];
    for(i=0;i<n;i++)
    cin>>b[i];
     for(i=0;i<n;i++)
    cout<<a[i]<<b[i];
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
int n,m,c;
vector <int> b;
vector <vector<int>> avv;
bool isValid(int target){
    bool ret = false;
    int value = c;
    for(int i = 0; i < avv[target].size(); i++){
        value += b[i]*avv[target][i];
    }
    if(value>0)ret=true;
    return ret;
}
int main(){
    cin >> n >> m >> c;
    b = vector <int> (m);
    for(int i = 0; i < m; i++){
        cin >> b[i];
    }
    avv = vector<vector<int>>(n);
    int ans = 0;
    for(int i = 0; i < n; i++){
        avv[i] = vector<int>(m);
        for(int j = 0; j < m; j++){
            cin >> avv[i][j];
        }
        if(isValid(i))ans++;
    }
    cout << ans << endl;
    #if 0
    cout << endl;
    for(int i = 0; i < m; i++){
        cout << b[i] << " ";
    }
    cout << endl;
    for(int i = 0; i < n; i++){
        for(int j = 0; j < m; j++){
            cout << avv[i][j] << " ";
        }
        cout << endl;
    }
    #endif
    return 0;
}

Measured memory_bytes: 3640
# frozen_string_literal: true

n = gets.to_i
h = gets.split.map(&:to_i)

(n - 1).times do |i|
  diff = h[-(i + 2)] - h[-(i + 1)]
  if diff > 1
    puts :No
    exit
  elsif diff == 1
    h[-(i + 2)] -= 1
  end
end

puts :Yes

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

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

  int index = 0;
  for (int i = a; i <= b; i++) {
    if (index < k) {
      cout << i << endl;
      index++;
    } else if (i > b - k) {
      cout << i << endl;
    }
  }
}

Measured memory_bytes: 256
#include <stdio.h>
#define N 101

int g[N][N];
int d[N];
int t,n;
int f[N];

void visit(int u) {
  int i;
  t++;  
  d[u] =t;

  for(i=0;i<n;i++) {
    if(g[u][i] == 1 && d[i] == 0 ) {
      visit(i);
    }
  }
  t++;
  f[u] = t;
}

int main() {
  int i,j,k,m,x;

  for(i=0;i<n;i++) d[i] = 0;

  scanf("%d",&n);

  for(i=0;i<=n;i++){
    for(j=0;j<=n;j++) {
      g[i][j] = 0;
    }
  }

  for(i=0;i<n;i++){
    scanf("%d %d ",&k,&m);
    for(j=0;j<m;j++) {
      scanf("%d",&x);
      g[k-1][x-1]=1;
    }
  }
  
  for(i=0;i<n;i++) {
    if(d[i] == 0) 
      visit (i);
  }
    
  for(i=0;i<n;i++) {
    printf("%d %d %d\n",i+1,d[i],f[i]);
  }
  
  return 0;
}



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

using namespace std;

int main()
{
	int n;
	cin >> n;
	
	long long ans = 0;
	for (int i = 1; i <= n; i++) {
		if (i % 3 != 0 && i % 5 != 0) {
			ans += i;
		}
	}
	cout << ans << endl;	

	return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>  // ver1.9.5
#define int long long
#define ALL(v) (v).begin(),(v).end()
#define Vi vector<int>
#define Pii pair<int,int>
#define pb push_back
#define mp make_pair
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repeq(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(int i=a;i>b;i--)
#define repreq(i,a,b) for(int i=a;i>=b;i--)
#define leng(n) (int)(log10(n)+1)
#define Vout(a) rep(i,0,a.size()-1)cout<<a[i]<<' ';cout<<a[a.size()-1]<<endl
#define INF 9000000000000000000  //  9.0 * 10^18
#define MOD 1000000007  //  10^9 + 7
using namespace std;

signed main() {
  cout << fixed << setprecision(8);
  string s;
  cin >> s;
  reverse(ALL(s));
  int b = 0;
  b = count(ALL(s), 'B');
  if(b==0) {cout << 0 << endl;return 0;}
  int ans = 0;
  rep(i,0,s.size()){
    if(s[i]=='B') ans += i;
  }
  ans -= b*(b-1)/2;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 644
import java.lang.*;
import java.io.*;
import java.util.*;

public class Main {
  public static void main(String arg[]) throws IOException { new Main().bw.close(); }

  BufferedReader br= new BufferedReader(new InputStreamReader(System.in));
  BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));

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

  int nxtint() { return  Integer.parseInt(nxttok()); }
  long nxtlong() { return Long.parseLong(nxttok()); }

  int maxm = 5050;
  int inf = 101010101;
  int n;
  ArrayList<Integer> gr[];
  int a[];
  int dp[][];

  Main() throws IOException {
    n = nxtint();
    gr = new ArrayList[n];
    gr[0] = new ArrayList<Integer>();
    for (int i = 0; ++i < n; ) {
      int u = nxtint() - 1;
      //System.err.println(u);
      gr[u].add(i);
      gr[i] = new ArrayList<Integer>();
    }
    a = new int[n];
    for (int i = -1; ++i < n; ) a[i] = nxtint();
    dp = new int[n][2];

    for (int u = n; u-- > 0; ) {
      int min0[][] = new int[maxm][2];
      int min1[][] = new int[maxm][2];

      for (int i = 0; ++i < maxm; ) 
          min0[i][1] = min1[i][1] = inf;

      int s = 0;
      for (int v : gr[u]) {
        for (int i = -1; ++i < maxm; ) min0[i][s] = min1[i][s] = inf;
        for (int i = 0; i <= 1; ++i) {
          int t[] = new int[2];
          t[i] = a[v];
          t[i ^ 1] = dp[v][i];
          
          for (int f = maxm; f-- > 0; ) {
            if ((long)f + t[0] < maxm && min0[f][s ^ 1] != inf)
              min0[f + t[0]][s] = Math.min(min0[f + t[0]][s], min0[f][s ^ 1] + t[1]);
            if ((long)f + t[1] < maxm && min1[f][s ^ 1] != inf)
              min1[f + t[1]][s] = Math.min(min1[f + t[1]][s], min1[f][s ^ 1] + t[0]);
          }
        }
        s ^= 1;
      }
      
      s ^= 1;
      dp[u][0] = dp[u][1] = inf;
      for (int i = 0; i <= a[u]; ++i) {
        dp[u][0] = Math.min(dp[u][0], min0[i][s]);
        dp[u][1] = Math.min(dp[u][1], min1[i][s]);
      }
      if (dp[u][0] == inf && dp[u][1] == inf) {
        bw.write("IMPOSSIBLE");
        return;
      }
    }
    bw.write("POSSIBLE");
  }
}


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

int main() {
    using P = pair<string, int>;

    int n, q;
    cin >> n >> q;
    queue<P> que;
    for(int i=0; i<n; ++i) {
        string name;
        int time;
        cin >> name >> time;
        que.push(make_pair(name, time));
    }
    int now = 0;
    while(!que.empty()) {
        P p = que.front();
        que.pop();
        if(p.second <= q) {
            now += p.second;
            cout << p.first << " " << now << endl;
        } else {
            p.second -= q;
            now += q;
            que.push(p);
        }
    }
}


Measured memory_bytes: 6300
//
//  main.cpp
//  ABC156E

#include <iostream>
#include<vector>
using namespace std;

typedef long long ll;
// modを自動で計算させる
const int mod = 1000000007;
struct mint {
  ll x;
  mint(ll x=0):x(x%mod){}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};
struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};
int main(int argc, const char * argv[]) {
    int n,k;
    cin>>n>>k;
    k=min(k,n-1); // 0がn個以上あることはない
    combination c(n);
    mint all;
    for (int i=0; i<=k; i++) {
        all += c(n,i).x*c(n-1,i).x;
    }
    cout<<all.x<<endl;
    return 0;
}


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

typedef long long ll;

ll gcd(ll a, ll b){
    if(b == 0){
        return a;
    }else{
        gcd(b, a%b);
    }
}

int main(void){
    int n;
    cin >> n;
    ll ans = 1;
    for(int i=0; i<n; i++){
        ll t;
        cin >> t;
        ans = ans/gcd(ans,t)*t;
    }
    cout << ans << endl;
    return 0;
}

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

// #define multitest 1
// #define Debug 1
#ifdef Debug
#define db(...) ZZ(#__VA_ARGS__, __VA_ARGS__);
template <typename Arg1>
void ZZ(const char *name, Arg1 &&arg1)
{
	std::cerr << name << " = " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void ZZ(const char *names, Arg1 &&arg1, Args &&... args)
{
	const char *comma = strchr(names + 1, ',');
	std::cerr.write(names, comma - names) << " = " << arg1;
	ZZ(comma, args...);
}
#else
#define db(...)
#endif

typedef long long ll;
typedef long double ld;
#define f first
#define s second
#define pb push_back
const long long mod = 1000000007;

void solve()
{
	int n;
	cin >> n;
	vector<ld> Dp(n + 1);
	ld x;
	Dp[0] = 1;
	db("start");
	for (int i = 1; i <= n; ++i)
	{
		cin >> x;
		for (int j = i; j >= 0; --j)
		{
			db(j);
			Dp[j] = Dp[j] * (1 - x) + (j == 0 ? 0 : (Dp[j - 1] * x));
		}
	}
	db("here");
	ld ans = 0;
	for (int i = 0; i <= n; ++i)
	{
		int j = n - i;
		if (i > j)
			ans += Dp[i];
	}
	cout << fixed << setprecision(10);
	cout << ans;
}

int main()
{
#ifndef Debug
	ios_base::sync_with_stdio(0);
	cin.tie(0);
#endif
	int t = 1;
#ifdef multitest
	cin >> t;
#endif
	while (t--)
		solve();
	return 0;
}

Measured memory_bytes: 384
from collections import deque
N,M = map(int,input().split())
cnct = [[] for i in range(N+1)]
for _ in range(M):
  A,B = map(int,input().split())
  cnct[A].append(B)
  cnct[B].append(A)
Q = deque()
Q.append(1)
ans = [0]*(N+1)
vstd = [0]*(N+1)
# ans[1]を出力しない以上、vstd[1]=1にしておく必要はない
#（vstd[1]=0のままなら、ans[1]に余計な道しるべが追加されるだけ）
while Q:
  temp = Q.popleft()
  for a in cnct[temp]:
    if vstd[a] == 0:
      ans[a] = temp
      vstd[a] = 1
      Q.append(a)
print('Yes')
for a in ans[2:]:
  print(a)

Measured memory_bytes: 35464
using System;
using System.Collections.Generic;


namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            HashSet<string> s = new HashSet<string>();
            for (int i = 0; i < N; i++) s.Add(Console.ReadLine());
            Console.WriteLine(s.Count);
        }
    }
}

Measured memory_bytes: 47168
from itertools import accumulate

mod = 10 ** 9 + 7

N, K = map(int, input().split())

A = [0] + list(accumulate(range(N + 1)))
B = [0] + list(accumulate(reversed(range(N + 1))))

print(sum(b - a + 1 for a, b in zip(A[K:], B[K:])) % mod)

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

using namespace std;

int main()
{
    string s; cin >> s;

    int ans = 0;
    if (s[0] == 'o') ans++;
    if (s[1] == 'o') ans++;
    if (s[2] == 'o') ans++;

    cout << 700 + 100 * ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define show(x) cout << #x << " = " << (x) << endl
#define show2(x,y) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl
#define show3(x,y,z) cout << #x << " = " << (x) << ", " << #y << " = " << (y) <<  ", " << #z << " = " << (z) << endl
#define showv(v) rep(i,v.size()) printf("%d%c", v[i], i==v.size()-1?'\n':' ')
#define showv2(v) rep(j,v.size()) showv(v[j])
#define showt(t,n) rep(i,n) printf("%f%c", t[i], i==n-1?'\n':' ')
#define showt2(t,r,c) rep(j,r) showt(t[j],c)
#define showvp(p) rep(i,p.size()) printf("%d %d\n", p[i].first, p[i].second);
#define printv(v) rep(i,v.size()) printf("%d\n", v[i])
#define printt(t,n) rep(i,n) printf("%d\n", t[i])
#define incl(v,x) find(rng(v),x)!=v.end()
#define incls(s,c) s.find(c)!=string::npos
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vs = vector<string>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
typedef vector<pii> vp;
typedef vector<tiii> vt;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = (1<<30)-1;
const ll INFLL = (1LL<<62)-1;
#define dame { puts("No"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

double dp[3010][3010];

int main () {
  int n;
  cin >> n;
  vector<double> p(n);
  rep(i,n) cin >> p[i];

  dp[0][0] = 1;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j <= i; ++j) {
      dp[i+1][j+1] += dp[i][j]*p[i];
      dp[i+1][j] += dp[i][j]*(1-p[i]);
    }
  }

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

Measured memory_bytes: 69120
// inputに入力データ全体が入る
function Main(input) {
  // inputを行ごとに分割しarrayに入れる	
  input = input.split("\n");
  // input2行目の数字を個別に分けてarrayに入れる
  var num = input[1].split(" ");
  // setオブジェクトを作成
  var set = new Set(num);
  if (num.length == set.size) {
    console.log("YES");
  } else {
    console.log("NO");
  };
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 42652
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
template<class T>inline bool chmax(T &a, const T &b){if(a < b){a = b; return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if(a > b){a = b; return 1;}return 0;}
typedef long long ll;
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N; cin >> N;
  map<int, int> mp;
  REP(i, N){
    int tmp; cin >> tmp;
    mp[tmp] += 1;
  }
  for(auto &i : mp){
    int a = i.second;
    if(a >= 2){
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
}


Measured memory_bytes: 9600
// Package main provides
//
// File:  d.go
// Author: ymiyamoto
//
// Created on Sun Dec  9 22:40:43 2018
//
package main

import (
	"fmt"
	"sort"
)

type bridge struct {
	from, to int
}

type bridges []bridge

func (b bridges) Len() int {
	return len(b)
}

func (b bridges) Swap(i, j int) {
	b[i], b[j] = b[j], b[i]
}

func (b bridges) Less(i, j int) bool {
	return b[i].to < b[j].to
}

func main() {
	var N, M int
	fmt.Scan(&N, &M)

	b := make(bridges, M)
	for i := range b {
		fmt.Scan(&b[i].from, &b[i].to)
	}

	sort.Sort(b)
	last := 0
	ans := 0
	for i := range b {
		if last < b[i].from {
			last = b[i].to - 1
			ans++
		}
	}

	fmt.Println(ans)
}


Measured memory_bytes: 5760
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <utility>
#include <cmath>
#include <iomanip>

using namespace std;
typedef long long ll;
typedef pair<int, int> ii;

const ll MOD = 1e9+7;

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define REP2(i,s,e) for(int i=(int)(s);i<(int)(e);++i)
#define RREP(i,s,e) for(int i=(int)(s);i>=(int)(e);--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin(),ie=(c).end();i!=ie;++i)
#define ALL(c) (c).begin(), (c).end()

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

    std::vector<int> a(n);
    REP(i, n) {
        cin >> a[i];
    }

    int mini = a[0];
    int cnt = 1;
    REP2(i, 1, n) {
        if (mini >= a[i]) {
            cnt += 1;
            mini = a[i];
        }
    }

    std::cout << cnt << '\n';

    return 0;
}


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

int main()
{
	#ifdef ARTHUR_LOCAL
		ifstream cin("input.txt");
	#endif

	int a,b;
	cin>>a>>b;

	if((a+b)%2 == 0)
	{
		cout << int((a+b)/2) << endl;
	}

	else cout << "IMPOSSIBLE" << endl;
}

Measured memory_bytes: 256
s=input()
t=input()
S,T=len(s),len(t)

dp=[[0]*(T+1) for _ in range(S+1)]
for i in range(S):
    for j in range(T):
        if s[i]==t[j]:
            dp[i+1][j+1]=dp[i][j]+1
        else:
            dp[i+1][j+1]=max(dp[i][j+1],dp[i+1][j])

len=dp[S][T]
x,y=S-1,T-1
ans=[0]*len
while len>0:
    if s[x]==t[y]:
        ans[len-1]=s[x]
        x-=1
        y-=1
        len-=1
    else:
        if dp[x+1][y+1]==dp[x][y+1]: x-=1
        else: y-=1

print("".join(ans))

Measured memory_bytes: 144688
import java.util.*;
	import java.util.Map.Entry;
	 
	 
	 class Main {
		 static int mod =  (int) (Math.pow(10,9)+7);
//		 static int mod =  (int) 998244353;
		 static List<ArrayList<Integer>> list= new ArrayList<ArrayList<Integer>>();
		 static int a_dist[];
		 public static void main(String[] args) {
	    	
	        Scanner sc = new Scanner(System.in);
	        int H = sc.nextInt();
	        int W = sc.nextInt();
	        int sx = sc.nextInt()-1;
	        int sy = sc.nextInt()-1;
	        int gx = sc.nextInt()-1;
	        int gy = sc.nextInt()-1;
	        
	        int[][] m = new int[H][W];
	        for(int i=0;i<H;i++) {
		        String S = sc.next();
		        char[] c = S.toCharArray();
		        for(int j=0;j<W;j++) {
		        	if(c[j]=='#')m[i][j]=-1;
		        	else m[i][j]=10000000;
		        }
	        }
	        
			LinkedList<Integer> q= new LinkedList<Integer>();
			LinkedList<Integer> q2= new LinkedList<Integer>();
			q.add(1000*sy+sx);
			q2.add(1000*sy+sx);
			m[sx][sy]=0;
	        while(!q.isEmpty()) {
		        while(!q2.isEmpty()) {
		        	int now = q2.poll();
		        	int x = now%1000;
		        	int y = now/1000;
		        	for(int i=x-2;i<=x+2;i++) {
		        		for(int j=y-2;j<=y+2;j++) {
		        			if(i==x&&j==y)continue;
		        			if(i>=H||i<0||j>=W||j<0)continue;
		        			if(m[i][j]<=m[x][y])continue;
		        			if(Math.abs(x-i)+Math.abs(y-j)==1) {
		        				m[i][j]=m[x][y];
		        				q.add(1000*j+i);
		        				q2.add(1000*j+i);
		        			}
		        		}
		        	}
		        }
	        	int now = q.poll();
	        	int x = now%1000;
	        	int y = now/1000;
	        	for(int i=x-2;i<=x+2;i++) {
	        		for(int j=y-2;j<=y+2;j++) {
	        			if(i==x&&j==y)continue;
	        			if(i>=H||i<0||j>=W||j<0)continue;
	        			if(m[i][j]<=m[x][y]+1)continue;
	    				m[i][j]=m[x][y]+1;	        				
	    				q.add(1000*j+i);
	    				q2.add(1000*j+i);
	        		}
	        	}
	        }
        	int ans=0;
        	if(m[gx][gy]==10000000) {
        		ans=-1;
        	} else {
        		ans=m[gx][gy];
        	}
	        
	        System.out.println(ans);
		 }
		 
	}

Measured memory_bytes: 68996
import java.util.*;

public class Main {
	public static void main(String args[]) {
    	Scanner sc = new Scanner(System.in);
      	String input = sc.nextLine();
      	String inputs[] = input.split(" ");
      	int N = Integer.valueOf(inputs[0]);
      	int K = Integer.valueOf(inputs[1]);
      	int possible = (N+1)/2;
      	if(possible>=K) {
        	System.out.println("YES");
        }
      	else {
        	System.out.println("NO");
        }
    }
}

Measured memory_bytes: 21972
#include <iostream>
#include <cstdio>
#include <cmath>

using namespace std;

int main() {
    while(true) {
        int x, h;
        cin >> x >> h;
        if(!x && !h) break;
        printf("%.6f\n", x*x + x*2*sqrt(x*x/4.+h*h));
    }
    return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
constexpr int MOD = 1000000007;

int mod(const ll &x){
    return x > 0 ? x % MOD : (x+MOD) % MOD;
}

int modm(const ll &x,const ll &m){
    return (x % MOD) * (m % MOD) % MOD;
}

int modpow(ll x, ll p) {
    int ret = 1;
    while(p > 0) {
        if (p & 1) ret = modm(ret,x);
        x = modm(x,x);
        p >>= 1;
    }
    return ret;
}

// x * modinv(d)
int modd(ll x,ll d) {
    return modm(x,modpow(d,MOD-2));
}

int main(void)
{
    IOS
    const string S = "AGCT";

    int n; cin >> n;

    vector<map<string,int>> dp(n+1);

    vector<string> agct({""});
    REP(i,3) {
        vector<string> tmp;
        swap(tmp,agct);
        for (auto s:tmp) {
            for (auto c: S) {
                agct.push_back(s+c);
            }
        } 
    }

    map<string,bool> memo;
    auto isok = [&](string s) {
        auto it = memo.find(s);
        if (it != memo.end()) {
            return it->second;
        }
        bool ret = true;
        REP(i,s.size()) {
            if (i == 0) {
                if (s.find("AGC") != string::npos) ret = false;
            } else {
                string t = s;
                swap(t[i],t[i-1]);
                if (t.find("AGC") != string::npos) ret = false;
            }
        }
        memo[s] = ret;
        return ret;
    };

    for (auto s:agct) {
        if (isok(s)) dp[3][s] = 1;
        else dp[3][s] = 0; 
    }

    FOR(i,4,n+1) {
        for(auto s:agct) {
            for(auto c:S) {
                string t = s+c;
                if (isok(t)) dp[i][t.substr(1,3)] = mod(dp[i][t.substr(1,3)] + dp[i-1][s]);
            }
        }
    }

    int ans = 0;
    for(auto v:dp[n]) ans = mod(ans + v.second);

    cout << ans << '\n';


    return 0;
}

Measured memory_bytes: 896
N, T = map(int, input().split())
AB = [tuple(map(int, input().split())) for _ in range(N)]
AB.sort()
INF = float('inf')

dp = [-INF] * (T + 1)
dp[0] = 0

for a, b in AB:
    for t in range(T)[:: -1]:
        dp[min(T, t + a)] = max(dp[min(T, t + a)], dp[t] + b)

print(max(dp))

Measured memory_bytes: 48616
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
string s1;
int ans;
int main() {
	cin>>s1;
	int len=s1.length();
	for (int i=0; i<len/2; i++) {
		if (s1[i]!=s1[len-i-1]) ans++;
	}
	cout<<ans<<endl;
	return 0;
}

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

lst = [0]*N
for i in range(N, 0, -1):
    tmp = 0
    for j in range(i-1, N, i):
        tmp += lst[j]
    if A[i-1]!=tmp%2:
        lst[i-1]=1
print(sum(lst))
for idx, e in enumerate(lst):
    if e==1:
        print(idx+1, end= ' ')

Measured memory_bytes: 7148
import java.util.Scanner;

public class Main {
    public static void main(final String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final int n = scanner.nextInt();
        for (int i = 0; i <= n; i++) {
            if (n == (int) ((double) i * 1.08d)) {
                System.out.println(i);
                return;
            }
        }

        System.out.println(":(");
    }
}


Measured memory_bytes: 21844
n, k = map(int, input().split())
h = list(map(int, input().split()))

h.sort()
n -= k
if k > len(h):
    for i in range(len(h)):
        h.pop()
else:
    for i in range(k):
        h.pop()

ans = 0
for i in range(len(h)):
    ans += h[i]

print(ans)

Measured memory_bytes: 26024
s = [x for x in input()]
k = int(input())
l = len(s)
for i,c in enumerate(s):
	x = (123-ord(c))%26
	if x <= k:
		k -= x
		s[i] = "a"
	if i+1==l:
		s[i] = chr(ord(s[i])+k%26)
print("".join(s))

Measured memory_bytes: 4160
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  int s1000;
  int s100;
  int s10;
  int s1;
  cin >> N;
  s1000 = N / 1000;
  s100 = (N - 1000 * s1000) / 100;
  s10 = (N - 1000 * s1000 - 100 * s100) / 10;
  s1 = (N - 1000 * s1000 - 100 * s100 - 10 * s10);
  if (s1 == s10 && s1 == s100){
  cout << "Yes";
  }
  else if (s10 == s100 && s10 == s1000){
  cout << "Yes";
  }else{
    cout << "No";
}
}

Measured memory_bytes: 3588
import java.io.InputStream
import java.io.PrintStream
import java.util.*

class Arc089A(
    val input: InputStream,
    val output: PrintStream
) {
    data class Pos(val t: Int, val x: Int, val y: Int)

    /**
     * 指定した２つのポイント間で移動が可能か
     * 移動可能か?
     *
     * abs(x - x), abs(y - y) <= t
     * 偶数のときと奇数のときで移動できる座標に制約がある
     */
    fun calc(a: Pos, b: Pos): Boolean {
        // 移動距離が範囲内であれば基本的には問題ないが
        val dis = Math.abs(b.x - a.x) + Math.abs(b.y - a.y)
        val td = b.t - a.t
        if (dis > td) {
            return false
        }

        // 移動量が奇数の場合、同じ位置には戻ってこれない
        // もうちょっと一般化すると
        // x + y の偶数の場合、移動量が偶数なら x + y が偶数の位置にのみ移動できる
        // 奇数の場合も同様
        // x + y が偶数の場合、移動量が奇数なら x + y が奇数の位置にのみ移動できる
        if (dis % 2 != td % 2) {
            return false
        }

        return true
    }

    fun proc() {


        val sc = Scanner(input)
        val n = sc.nextInt()

        val posList = listOf(Pos(0, 0, 0)) +
                generateSequence {
                    Pos(
                        t = sc.nextInt(),
                        x = sc.nextInt(),
                        y = sc.nextInt()
                    )
                }.take(n).toList()

        var i = 0
        while (i < posList.size - 1) {
            if (calc(posList[i], posList[i + 1])) {
                // ok
            } else {
                output.print("No")
                return
            }
            ++i
        }
        output.print("Yes")
        return
    }
}

fun main(args: Array<String>) {
    Arc089A(System.`in`, System.out).proc()
}


Measured memory_bytes: 100604
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int ,int> pii;
typedef pair<ll ,ll> pll;
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define all(X) (X).begin(), (X).end()
#define sll(n) scanf("%lld",&n)
#define sll2(x,y) scanf("%lld%lld",&x,&y)
#define sll3(x,y,z) scanf("%lld%lld%lld",&x,&y,&z)
#define REP(i,x,y) for(ll i = x;i <= y;++i)
#define debug(x) cerr<<#x<<"::"<<x<<endl
#define debug2(x,y) cerr<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\n"
#define debug3(x,y,z) cerr<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\n"
#define debug4(x,y,z,w) cerr<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\t"<<#w<<" :: "<<w<<"\n"
ll power(ll x,ll y,ll z) {
	ll ret = 1;
	while(y > 0) {
		if(y & 1) ret = (ret*x)%z;
		x = (x*x)%z;
		y >>= 1;
	}
	return ret;
}
const ll N = 1e6, buffer = 3e5;
char s[N];
int main() {
	
	string str;
	cin >> str;
	ll t, fl = 0;
	cin >> t;
	ll n = str.size();
	ll st = buffer, en = buffer + n - 1;
	for(ll i = 0;i < n;++i) s[buffer + i] = str[i];
	while(t--) {
		ll ty, op;
		string aux;
		cin >> ty;
		if(ty == 1) fl ^= 1;
		else {
			cin >> op >> aux;
			if(op == 1) {
				if(!fl) s[--st] = aux[0];
				else s[++en] = aux[0];
			} else {
				if(!fl) s[++en] = aux[0];
				else s[--st] = aux[0];
			}
		}
	}
	if(!fl) REP(i,st,en) cout << s[i];
	else for(ll i = en;i >= st;--i) cout << s[i];
	cout << "\n";

	

	return 0;
}

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

#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n,s) for(int i=(s);i<(n);i++)
#define rrep(i,n) for(int i=(n-1);i>=0;i--)
#define rreps(i,n,s) for(int i=s;i>=n;i--)
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

using ll = long long;
using namespace std;
constexpr long long MAX = 5100000;
constexpr long long INF = 1LL << 60;
constexpr int MOD = 1000000007;

int main(){
cin.tie(0);
ios::sync_with_stdio(false);
string s;
cin>>s;
int n=s.size();
int dp[n][2];
dp[0][0]=1;
dp[0][1]=0;
dp[1][0]=s[1]!=s[0]?2:1;
dp[1][1]=1;

reps(i,n-1,1){
    int dp_0 = s[i+1]!=s[i]?1:0;
    dp[i+1][0]=max(dp[i][0]+dp_0,dp[i][1]+1);
    
    if(i+1>3){
        string s1=s.substr(i-1,2);
        string s2=s.substr(i-3,2);
        int dp_1= s1!= s2?1:0;
        dp[i+1][1]=max(dp[i-1][0]+1,dp[i-1][1]+dp_1);
    }
    else{
        dp[i+1][1]=dp[i-1][0]+1;
    }
}
cout<<max(dp[n-1][0],dp[n-1][1])<<endl;
return 0;
}

Measured memory_bytes: 2196
def get_i() #空白区切の入力を数値(整数)の配列で返す
  return gets.chomp.split(" ").map(&:to_i)
end
def get_f() #空白区切の入力を数値(実数)の配列で返す
  return gets.chomp.split(" ").map(&:to_f)
end
def get() #空白区切の入力を文字列の配列で返す
  return gets.chomp.split(" ")
end
def get_nsp() #入力されたものを一文字ずつに区切った文字列の配列で返す
  return gets.chomp.split("")
end
def yn_judge(bool,y="Yes",n="No") #boolに真偽を投げることで、trueならy、falseならnの値を出力する
  return bool ? y : n 
end
def array(size1,init=nil,size2=-1) #size2に二次元配列時の最初の要素数、size1に次の配列の大きさ、initに初期値を投げることでその配列を返す
  if size2==-1
    return Array.new(size1){init}
  else
    return Array.new(size2){Array.new(size1){init}}
  end
end

N,A,B=get_i
if A>B or (N==1 and A !=B)
    puts 0
    exit
end
puts B*(N-1)+A-(A*(N-1)+B)+1

Measured memory_bytes: 1788
# なんか図書いてたら思いついた。託宣？
# 最初はk種類からえらび、残りは（k-1）種類から選ぶ
n, k = gets.chomp.split.map(&:to_i)
ans = k
(n-1).times do
  ans *= (k-1)
end
puts ans

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

using namespace std;

struct Data {
  int cur,weight;
  bool operator < ( const Data &data ) const {
    return weight > data.weight;
  }
};

const int IINF = INT_MAX;
int V,E,r;

vector<int> G[110000];
vector<int> W[110000];
int mindist[110000];

void dijkstra(){
  for(int i=0;i<V;i++) mindist[i] = IINF;
  mindist[r] = 0;
  priority_queue<Data> Q;
  Q.push((Data){r,0});
  while( !Q.empty() ){
    Data data = Q.top(); Q.pop();
    int cur = data.cur;
    if( mindist[cur] < data.weight ) continue;
    for(int i=0;i<(int)G[cur].size();i++){
      int next   = G[cur][i];
      if( mindist[next] > data.weight + W[cur][i] )  {
	mindist[next] = data.weight + W[cur][i];
	Q.push((Data){next,mindist[next]});
      }
    }
  }
}

int main(){

  cin >> V >> E >> r;

  for(int i=0;i<E;i++) {
    int s,t,d;
    cin >> s >> t >> d;
    G[s].push_back(t);
    W[s].push_back(d);
  }

  dijkstra();
  
  for(int t=0;t<V;t++) {
    if( mindist[t] != IINF ) cout << mindist[t] << endl;
    else                     cout << "INF" << endl;
  }

  return 0;
}

Measured memory_bytes: 15796
#include<iostream>
using namespace std;
int main()
{
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    while(a>0&&c>0)
    {
        c-=b;
        if(c<=0)
        {
            cout<<"Yes";
            return 0;
        }
        a-=d;
        if(a<=0)
        {
            cout<<"No";
            return 0;
        }
    }
}

Measured memory_bytes: 3652
package main

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

func main() {
	nextReader = NewScanner()
	line1 := nextInt()

	var sum float64
	for i := 0; i < line1[0]; i++ {
		line := nextString()
		m, _ := strconv.ParseFloat(line[0], 32)
		if line[1] == "JPY" {
			sum += m
		} else {
			sum += m * 380000.0
		}
	}

	fmt.Println(sum)
}

// ------ Mathライブラリ ---------------------------------//
func max(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r < a[i] {
			r = a[i]
		}
	}
	return r
}

func maxIdx(a ...int) int {
	r := a[0]
	index := 0
	for i := 0; i < len(a); i++ {
		if r < a[i] {
			r = a[i]
			index = i
		}
	}
	return index
}

func min(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r > a[i] {
			r = a[i]
		}
	}
	return r
}

func minIdx(a ...int) int {
	r := a[0]
	index := 0
	for i := 0; i < len(a); i++ {
		if r > a[i] {
			r = a[i]
			index = i
		}
	}
	return index
}

func sum(a []int) (r int) {
	for i := range a {
		r += a[i]
	}
	return r
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

// ------ Mathライブラリ ---------------------------------//

// ----- 標準入力用の関数 ----------------------------------//
var nextReader func() []string

func NewScanner() func() []string {
	r := bufio.NewScanner(os.Stdin)
	r.Buffer(make([]byte, 1024), int(1e+11))
	return func() []string {
		r.Scan()
		return strings.Fields(r.Text())
	}
}

func nextString() []string {
	return nextReader()
}

func nextInt() []int {
	var intArray []int
	strArray := nextReader()
	for _, v := range strArray {
		i, _ := strconv.Atoi(v)
		intArray = append(intArray, i)
	}
	return intArray
}

func nextFloat64() []float64 {
	var floatArray []float64
	strArray := nextReader()
	for _, v := range strArray {
		f, _ := strconv.ParseFloat(v, 64)
		floatArray = append(floatArray, f)
	}
	return floatArray
}

// ------ 標準入力用の関数 ---------------------------------//

// ------ あまり使わない -----------------------------------//
func nextInt64() []int64 {
	var int64Array []int64
	strArray := nextReader()
	for _, v := range strArray {
		i, _ := strconv.ParseInt(v, 10, 64)
		int64Array = append(int64Array, i)
	}
	return int64Array
}

// ------ あまり使わない -----------------------------------//


Measured memory_bytes: 640
#include "bits/stdc++.h"
using namespace std;
const int MAX = 700000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
/*第二引数で第一引数を割ったときの切り上げの計算*/
long long int maxtime(long long int x, long long int y) {
	return(x + y - 1) / y;

}
/*最大公約数*/
long long int lcm(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;

	if (number2 > number1) {
		m = number2;
		n = number1;
	}
	long long int s = -1;
	while (s != 0) {
		s = m % n;
		m = n;
		n = s;
	}
	return m;
}
/*最大公倍数*/
long long int gcd(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;
	return m / lcm(m, n) * n;
}

int main() {
	long long int a, b;
	cin >> a >> b;
	long long int okasi = gcd(a, b);
	cout << okasi;
}

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

using ll = long long;
using ull = unsigned long long;
using st = string;
using ch = char;
using db = double;
using bl = bool;
using vll = vector<long long>;
using vdb = vector<db>;
using vst = vector<st>;
using vch = vector<char>;
using vbl = vector<bl>;
using vvll = vector<vll>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
using vvpll = vector<vpll>;
#define rep(i, m, n) for (ll i = (ll)(m); i < (ll)(n); i++)
#define vrep(i, vec) for(auto& i : vec)
#define vin(vec) for(auto& i : vec) cin >> i
#define all(v) v.begin(), v.end()
#define mkp(a, b) make_pair(a, b) 
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;}
const ll mod = 1000000007;
const ll inf = 1LL << 60;
const db pi = acos(-1.0L);

int main(){
  ll h1, m1, h2, m2, k;
  cin >> h1 >> m1 >> h2 >> m2 >> k;
  cout << (h2 - h1) * 60 + m2 - m1 - k << endl;
}

Measured memory_bytes: 3620
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <numeric> // accumulate(v.begin(), v.end(), 0)                                                         

using namespace std;
#define ll long long

int main(){
  int N;
  ll Y;
  cin >> N >> Y;
  for(int y=0; y<=N; y++){
    for(int z=0; z<=N-y; z++){
      if(5000 * y + 9000 * z == 10000 * N - Y){
        cout << N-y-z << ' ' << y << ' ' << z << endl;
        return 0;
      }
    }
  }
  cout << -1 << ' ' << -1 << ' ' << -1 << endl;
  return 0;
}

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

namespace ProCon
{
    class Program
    {
        static void Main(string[] args)
        {

            string[] inputs = Console.ReadLine().Split(' ');
            int a1 = int.Parse(inputs[0]);
            int a2 = int.Parse(inputs[1]);
            int a3 = int.Parse(inputs[2]);
            string retStr = string.Empty;

            int sumA = a1 + a2 + a3;

            if(sumA >= 22)
            {
                retStr = "bust";
            }
            else
            {
                retStr = "win";
            }

            Console.WriteLine(retStr);
        }

    }
}


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

using namespace std;

#define IoFast ios_base::sync_with_stdio(0);cin.tie(0);
#define ll long long int
#define float long double
#define foor(i, a, b) for ( int (i) = (a); (i)<(b); (i)++ )
#define foor2(i, a, b) for( int (i) = (a); (i)>(b); (i)-- )
#define foorl(i, a, b) for ( ll (i) = (a); (i)<(b); (i)++ )
#define foorl2(i, a, b) for( ll (i) = (a); (i)>(b); (i)-- )
#define mp make_pair
#define f1 first
#define f2 second
#define pb push_back
#define pii pair<int,int>
#define vpii vector <pii>
#define vi vector<int>
#define sz(a) (int) a.size( )
#define fillArr(n, a) foor(i, 0, n) cin >> a[i];
#define print(a) cout << #a << endl;
#define umax(a,b) a = max ( a, b )
#define umin(a,b) a = min ( a, b )
#define all(k) k.begin ( ), k.end( )
#define rall(k) k.rbegin ( ), k.rend( )
#define clean(k) memset( k, 0, sizeof(k) )
#define endl '\n'


int main(){
	IoFast;
	ll a,b;
	cin >> a >> b;
	if ( 0 >= a && 0 <= b)
		cout << "Zero" << endl;
	else if (a > 0 && b > 0){
		cout << "Positive" << endl;
	}
	else{
		ll ans = abs(a - b + 1);
		if (ans % 2 == 0)
			cout << "Positive" << endl;
		else
			cout << "Negative" << endl;
	}
}



Measured memory_bytes: 256
def Upper(s) :
    New = []
    i = 0
    while True :
        if i == 0 :
            New.append(s[i].upper())
        elif s[i] == "_" :
            i += 1
            New.append(s[i].upper())
        elif 65 <= ord(s[i]) <= 90 :
            New.append(s[i].upper())
        else :
            New.append(s[i].lower())
        i += 1
        if i >= len(s) :
            break
    return New

def Lower(s) :
    New = []
    i = 0
    while True :
        if s[i] == "_" :
            i += 1
            New.append(s[i].upper())
        elif 65 <= ord(s[i]) <= 90 and i != 0:
            New.append(s[i].upper())
        else :
            New.append(s[i].lower())
        i += 1
        if i >= len(s) :
            break
    return New

def Under_Score(s) :
    New = []
    i = 0
    while True :
        if 65 <= ord(s[i]) <= 90 and i != 0:
            New.append("_")
            New.append(s[i].lower())
        else :
            New.append(s[i].lower())
        i += 1
        if i >= len(s) :
            break
    return New

while True :
    l, x = map(str, input().split())
    if x == "X" :
        break
    
    elif x == "U" :
        print(*Upper(l), sep="")
    elif x == "L" :
        print(*Lower(l), sep="")
    elif x == "D" :
        print(*Under_Score(l), sep="")
        
            


Measured memory_bytes: 5588
#include <bits/stdc++.h>
using namespace std;
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,n1,n2) for(int i=n1;i<n2;i++)
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

typedef long long int ll;
typedef pair<ll,ll> Pi;
const int INF=(ll)(1LL<<31)-1;
const ll INFl=(ll)9223372036854775807;
const int MAX=10000;
const ll MOD=(ll)1e9+7;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a, b)*b;}
//int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int n;
ll a[100100];
ll ans=0;

int main(){
	cin>>n;
	REP(i,n)
		cin>>a[i];
	
	int ch=0;
	for(int i=0;i<n;i++){
		if(ch&&a[i]){
			a[i]--;
			ans++;
		}
		ch=0;
		ans+=a[i]/2;
		if(a[i]%2)ch=1;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1024