akhauriyash/Code-Regression huggingface dataset:
S = input()
l = list(set(S))
if len(l) == 0:
    print("Yes")
elif len(l) % 2 == 1 :
    print("No")
else :
    if ("N" in l and "S" in l) or ("W" in l and "E" in l) :
        print("Yes")
    else :
        print("No")


Measured memory_bytes: 3060
#include <stdio.h>
#define MAX 2000
int solve(int, int );
int n,A[MAX];
int main(){
  int q,i,S[MAX];
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  scanf("%d",&q);
  for(i=0;i<q;i++){
    scanf("%d",&S[i]);
  }
  for(i=0;i<q;i++){
    if(solve(0,S[i])==1) printf("yes\n");
    else printf("no\n");
  }
  return 0;
}


int solve(int i,int m){
  int res;
  if(m==0) return 1;
  else if(i>=n) return 0;
  res=solve(i+1,m) || solve(i+1,m-A[i]);
  return res;
}
  

Measured memory_bytes: 588
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
 
public class Main {
 
    void solve() throws IOException {
        int N = ni();
        int M = ni();
        ArrayList<Integer> d = new ArrayList<>();
        for (int i = 1; i*i <= M; i++) {
            if(M%i==0){
                d.add(i);
                d.add(M/i);
            }
        }
        Collections.sort(d, Comparator.reverseOrder());
        int ans = 0;
        for (Integer i : d) {
            if(M/i >= N) {
                ans = i;
                break;
            }
        }
        out.print(ans);
        
    }

    final int mod = 1000000007;
    int mul(int x, int y){
        return (int)((x * 1L * y) % mod);
    }
    int add(int x, int y) {
        x += y;
        return x >= mod ? (x - mod) : x;
    }
    int sub(int x, int y){
        x = add(x,mod-y);
        return x >= mod ? (x - mod) : x;
    }
    String ns() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine(), " ");
        }
        return tok.nextToken();
    }
 
    int ni() throws IOException {
        return Integer.parseInt(ns());
    }
 
    long nl() throws IOException {
        return Long.parseLong(ns());
    }
 
    double nd() throws IOException {
        return Double.parseDouble(ns());
    }
 
    String[] nsa(int n) throws IOException {
        String[] res = new String[n];
        for (int i = 0; i < n; i++) {
            res[i] = ns();
        }
        return res;
    }
 
    int[] nia(int n) throws IOException {
        int[] res = new int[n];
        for (int i = 0; i < n; i++) {
            res[i] = ni();
        }
        return res;
    }
 
    long[] nla(int n) throws IOException {
        long[] res = new long[n];
        for (int i = 0; i < n; i++) {
            res[i] = nl();
        }
        return res;
    }
 
    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;
 
    public static void main(String[] args) throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        tok = new StringTokenizer("");
        Main main = new Main();
        main.solve();
        out.close();
    }
}

Measured memory_bytes: 32792
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <unordered_map>

using namespace std;
typedef long long ll;

int main() {
    int N;
    cin >> N;
    for (int i = 1; i <= 9; i++) {
        if (N % i == 0 && (N / i) <= 9) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}

Measured memory_bytes: 256
import math
a,b,h,m = map(int, input().split())
s = 30 * h + m * 0.5
l = m*6
x = abs(s-l)
if x >= 180: x = 360-x
c = math.cos(math.radians(x))
print((a**2+b**2-2*a*b*c)**0.5)

Measured memory_bytes: 9552
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <typeinfo>
#include <math.h>

using namespace std;
using ll = long long;
const ll res = 1000000007;

bool k_judge(string s) {
	int n = s.size();
	int flag = 0;

	if (n == 1)
		return true;
	else if (n==2){
		if (s[0] == s[1])
			return true;
		else
			return  false;
	}
	else {
		for (int i = 0; i < n / 2; i++) {
			if (s[i] != s[n - i - 1])
				flag++;
		}
		if (flag == 0)
			return true;
		else
			return  false;
	}

}

int main() {
	string s;
	int n;
	cin >> s;
	n = s.size();

	if (k_judge(s) == false)
		cout << "No" << endl;
	else {
		if (k_judge(s.substr(0, n / 2)) == true and k_judge(s.substr((n + 1) / 2, n / 2)) == true)
			cout << "Yes" << endl;
		else
			cout << "No" << endl;
	}
}


Measured memory_bytes: 256
#include<iostream>                                        
using namespace  std;                                     
                                                          
int main(){                                               
  int n,x;                                                
  int i,j,k;                                              
                                                          
  while(1){                                               
    int counter = 0;                                      
    cin >> n >> x;                                        
    if(n==0 && x==0) break;                               
    for(i=1;i<=n;i++){                                    
      for(j=1;j<=n;j++){                                  
        for(k=1;k<=n;k++){                                
          if((i + j + k == x) && (i != j) && (j != k) && \
(k != i)) counter++;                                      
        }                                                 
      }                                                   
    }                                                     
    cout << counter / 6 << endl;                          
  }                                                       
                                                          
  return 0;                                               
                                                          
}                                                         
  

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

int main() {
  double R,G;          /*     ↓Aとする */
    cin>>R>>G;  /*　(R+つぎの得点)/2=G 　A＝(G*2-R) */
  cout<<G*2-R<<endl;
}

Measured memory_bytes: 3652
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <utility>
#include <tuple>
#include <algorithm>
#include <cstdio>
#include <cmath>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main() {
  int n, m;
  while(cin >> n >> m && (n || m)) {
    string beg(n, ' ');
    rep(i, 3) {
      int num;
      cin >> num;
      rep(j, num) {
        int tmp;
        cin >> tmp;
        beg[--tmp] = i+'0';
      }
    }
    queue<tuple<string, string, int>> que;
    que.push(make_tuple(beg, " ", 0));
    const string ans0(n, '0'), ans2(n, '2');
    while(true) {
      string now, prev;
      int num;
      tie(now, prev, num) = que.front();
      que.pop();
      if(now == ans0 || now == ans2) {
        if(num <= m)
          cout << num << endl;
        else
          cout << -1 << endl;
        break;
      }
      int top[3] = {-1, -1, -1};
      rep(i, n)
        top[now[i]-'0'] = i;
      rep(i, 3) rep(j, 3) {
        if(abs(i-j) > 1)
          continue;
        if(top[i] > top[j]) {
          string next = now;
          next[top[i]] = j+'0';
          if(next != prev)
            que.push(make_tuple(next, now, num+1));
        }
      }
    }
  }
  return 0;
}


Measured memory_bytes: 3176
#include <iostream>
#include <queue>
#include <string>
#include <utility>

using namespace std;

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

	typedef pair<string, int> process;
	queue<process> p;
	string name;
	int time;

	while (n--)
	{
		cin >> name >> time;
		p.push(process(name, time));
	}

	string ans;
	for (int i = q; !p.empty();)
	{
		name = p.front().first;
		time = p.front().second - q;

		if (time <= 0)
		{
			ans += p.front().first + " " + to_string(i + time) + "\n";
			p.pop(), i += (q + time);
		}
		else
			p.push(process(name, time)), p.pop(), i += q;
	}

	cout << ans;

	return 0;
}

Measured memory_bytes: 7076
#define _DEBUG 1
#define _GLIBCXX_DEBUG

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

using ll = long long;

#ifdef _DEBUG
#define dump(x) cerr << #x << "=" << x << endl
#define dump2(x, y) cerr << #x << "=" << x << "," << #y << "=" << y << endl
#define dump3(x, y, z)                                                     \
  cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z \
       << endl
#define check(s) cerr << s << endl
#else
#define dump(x)
#define dump2(x, y)
#define dump3(x, y, z)
#define check(s)
#endif

#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define unique(v) v.erase(unique(v.begin(), v.end()), v.end());

const ll LINF = 2e18;
const int INF = 1e9;

void yes() { cout << "Yes" << endl; }
void no() { cout << "No" << endl; }
void yesOrNo(bool flg) {
  if (flg)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

void solve(ll K, ll X) { yesOrNo(500 * K >= X); }

int main() {
  ll K;
  scanf("%lld", &K);
  ll X;
  scanf("%lld", &X);
  solve(K, X);
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main() {
	int h, w;
	cin >> h >> w;
	int field[10][10] = {};
	for (int i = 0; i < 10; i++) {
		for (int j = 0; j < 10; j++) {
			cin >> field[i][j];
		}
	}
	int a[205][205];
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			cin >> a[i][j];
		}
	}

	int count = 0; 
	for (int k = 0; k < 10; k++) {
		for (int i = 0; i < 10; i++) {
			for (int j = 0; j < 10; j++) {
				if (field[i][j] > field[i][k] + field[k][j]) {
					field[i][j] = field[i][k] + field[k][j];
				}
			}
		}
	}

	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			if (a[i][j] != -1) {
				count = count + field[a[i][j]][1];
			}
		}
	}
	cout << count << endl;
	return 0;
}

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

//{ START
using namespace std;
#define int int64_t
#define rep(i, a, n) for (int i = (a); i < (n); ++i)
#define reps(i, a, n) for (int i = (n - 1); i > (a - 1); --i)
#define arep(i, x) for (auto &&i : (x))
#define irep(i, x) for (auto i = (x).begin(); i != (x).end(); ++i)
#define rirep(i, x) for (auto i = (x).rbegin(); i != (x).rend(); ++i)
//降順はgreater<T>()
#define all(x) (x).begin(), (x).end()
#define rv(s) reverse((s).begin(), (s).end())
// gcd lcmはそのままok
#define gcd(a, b) __gcd(a, b)
#define bits(n) (1LL << (n))
#define pcnt(x) __builtin_popcountll(x)
//配列内等要素削除
#define Unique(x) (x).erase(unique((x).begin(), (x).end()), (x).end())
#define Fixed(n) fixed << setprecision(n)
//総和
#define sowa(n) (((n) * ((n) + 1)) / 2)
#define updiv(a, b) ((a + b - 1) / b)
#define cauto const auto &
using P = pair<int, int>;
using Graph = vector<vector<P>>;
template <class T>  //昇順
using min_heap = priority_queue<T, vector<T>, greater<T>>;
template <class T>  //降順
using max_heap = priority_queue<T>;
template <class A, class B>
using umap = unordered_map<A, B>;
template <class A>
using uset = unordered_set<A>;
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {  //多次元初期化
  std::fill((T *)array, (T *)(array + N), val);
}
template <class A, class B>
bool chmax(A &a, const B &b) {  //最大値更新 返り値はbool
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class A, class B>
bool chmin(A &a, const B &b) {  //最小値更新 返り値はbool
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, 1, 1, -1, -1};
constexpr int INF = 0x3f3f3f3f;
constexpr int LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod1 = 1e9 + 7;
constexpr int mod2 = 998244353;
//} END

signed main(void) {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);

  int h, w, m;
  cin >> h >> w >> m;
  set<P> se;
  int mx = 0, my = 0;
  vector<int> x(400000, 0), y(400000, 0);
  vector<int> nx, ny;
  rep(i, 0, m) {
    int X, Y;
    cin >> X >> Y;
    --X, --Y;
    se.insert(make_pair(X, Y));
    ++x[X];
    ++y[Y];
    chmax(mx, x[X]);
    chmax(my, y[Y]);
  }
  bool jud = false;
  rep(i, 0, h) if (x[i] == mx) nx.emplace_back(i);
  rep(i, 0, w) if (y[i] == my) ny.emplace_back(i);
  rep(i, 0, nx.size()) {
    rep(j, 0, ny.size()) {
      if (se.find(make_pair(nx[i], ny[j])) == se.end()) {
        cout << mx + my << '\n';
        return 0;
      }
    }
  }
  cout << mx + my - 1 << '\n';
  return 0;
}

Measured memory_bytes: 36492
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define fi first
#define se second
ll sieve[1000001]={0},i,j;
ll power(ll p, ll k)
{
ll a=1;
while(k)
{
if(k&1)
a=(a*p);
p=(p*p);
k>>=1;
}
return a;
}
using namespace std;
  ll countDivisors(ll n) 
{ 
    ll cnt = 0; 
    for (ll i = 1; i <= sqrt(n); i++) { 
        if (n % i == 0) { 
            if (n / i == i) 
                cnt++; 
  
            else 
                cnt = cnt + 2; 
        } 
    } 
    return cnt; 
} 
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
 int tc=1;
//cin>>tc;
ll cas=1;
 while(tc--)
 {
	string s;
	cin>>s;
	deque<char> st;
	for(i=0;i<s.length();i++)
	st.pb(s[i]);
	ll q;
	cin>>q;
	ll state=0;//normal 1 pe reverse
	while(q--)
	{
		ll t;
		cin>>t;
		if(t==1)
		{
			state=1-state;
		}
		else if(t==2 && state==0)
		{
			ll f;
			cin>>f;
			char c;
			cin>>c;
			if(f==1)
			st.push_front(c);
			else if(f==2)
			st.pb(c);
		}
		else if(t==2 && state==1)
		{
			ll f;
			cin>>f;
			char c;
			cin>>c;
			if(f==2)
			st.push_front(c);
			else if(f==1)
			st.pb(c);
		}
	}
	if (state) {
            while (!st.empty()) {
                cout << st.back();
                st.pop_back();
            }
        }
        else {
            while (!st.empty()) {
                cout << st.front();
                st.pop_front();
            }
        }
	cout<<"\n"; 
 } 
}


Measured memory_bytes: 976
H, W, A, B = map(int, input().split())
ans = []
for h in range(H):
    tmp = ""
    for w in range(W):
        if h < B:
            if w < A:
                tmp += "0"
            else:
                tmp += "1"
        else:
            if w < A:
                tmp += "1"
            else:
                tmp += "0"
    ans.append(tmp)
print("\n".join(ans))


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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    while (true) {
        ll N, X;
        cin >> N >> X;
        if (N == 0 && X == 0) break;
        ll ans = 0;
        rep2(i, 1, N + 1) {
            rep2(j, i + 1, N + 1) {
                rep2(k, j + 1, N + 1) {
                    if (i + j + k == X) ans++;
                }
            }
        }
        cout << ans << '\n';
    }
}

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



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

int main() {

    string n;
    cin >> n;

    char a = n[0];
    char b = n[1];

    int Q = 9;
    char q = '0' + Q;


    if(a != q && b != q) cout <<  "No" << endl;
    else cout << "Yes" << endl;

    return 0;

}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>
#include <deque>
#include <complex>

using namespace std;

/*
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
*/

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<long long, long long> pll;
typedef vector<pll> vpll;

typedef long double ld;
typedef vector<ld> vld;

typedef vector<bool> vb;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, n) for (ll i = 1; i <= (n); i++)
#define rrep(i, n) for (ll i = (n) - 1; i >= 0; i--)
#define rreps(i, n) for (ll i = (n); i >= 1; i--)
#define all(v) (v).begin(), (v).end()

template <class T> void chmin(T& a, T b) { a = min(a, b);}
template <class T> void chmax(T& a, T b) { a = max(a, b);}

constexpr int INF = 1 << 30;
constexpr ll INFL = 1LL << 60;
constexpr ll MOD = 1000000007;
constexpr ld EPS = 1e-12;
ld PI = acos(-1.0);

void solve() {
    ll n;
    cin >> n;
    vll a(n), b(n);
    for(ll i = 0; i < n; i++) cin >> a[i] >> b[i];
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    ll ans = b[n / 2] - a[n / 2] + 1;
    if(n % 2 == 0) ans += b[n / 2 - 1] - a[n / 2 - 1];
    cout << ans << endl;
    return;
}

int main() {
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
}

Measured memory_bytes: 6292
def candies(go_down_at):
    candies_count = 0
    candies_count += sum(map_[1][:go_down_at + 1])
    candies_count += sum(map_[2][go_down_at:])
    return candies_count


N = int()
map_ = [[0], [0], [0]]
def solve():
    global N
    global map_

    N = int(raw_input())
    map_[1].extend(map(int, raw_input().split()))
    map_[2].extend(map(int, raw_input().split()))
    print max(map(candies, xrange(1, N + 1)))


solve()


Measured memory_bytes: 2568
#include <iostream>
#include <string.h>
#include <string>
#include <algorithm>
#include <math.h>
using namespace std;

void b_palindromic_numbers(void) {
	int a, b;
	int cnt = 0;
	int t,rev;
	cin >> a >> b;
	rev = 0;
	for (int i = a; i <= b; i++) {
		t = i;
		rev = 0;
		while (t > 0) {
			rev = rev * 10 + t % 10;
			t /= 10;
		}
		if (rev == i) cnt++;
	}
	cout << cnt << endl;
}

int main()
{
	b_palindromic_numbers();
    return 0;
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
int a,c,i;string b[105];
int main()
{
    scanf("%d%d",&a,&c);
    for(i=0;i<a;i++)cin>>b[i];sort(b,b+a);
    for(i=0;i<a;i++)cout<<b[i];printf("\n");
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
    long long int A,B,C,K;
    cin>>A>>B>>C>>K;
    
    if(A>=K) cout<<K<<endl;
    else if(A<K&&K<=A+B)cout<<A<<endl;
    else if(A+B<K) cout<<A-(K-(A+B))<<endl;


    return 0;

}


Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N , M , s;
  cin >> N >> M;
  vector<int> nvec(N+1);
  
  for (int i = 0; i < 2 * M; i++) {
    cin >> s;
    nvec.at(s)++;
  }
  for (int i = 1; i < N + 1; i++) {
    cout << nvec.at(i) << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <iomanip>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <vector>
#include <cmath>
#include <math.h>
#include <stdexcept>
#include <algorithm>
#include <set>
#include <map>
#include <stdlib.h>
#include <cctype>
#include <bitset>
using namespace std;
int main(){
    int n,k,d,i,j,p;
    cin >> n >> k;
    int P[n + 1] = {};
    for(i = 0;i < k;i++){
        cin >> d;
        for(j = 0;j < d;j++){
            cin >> p;
            P[p]++;
        }
    }
    p = 0;
    for(i = 1;i <= n;i++){
        if(P[i] == 0) p++;
    }
    cout << p << endl;
}

Measured memory_bytes: 3640
#ifndef BZ
#pragma GCC optimize "-Ofast"
#endif
#include <bits/stdc++.h>

#define FASTIO
#define ALL(v) (v).begin(), (v).end()
#define rep(i, l, r) for (int i = (l); i < (r); ++i)

#ifdef FASTIO
#define scanf abacaba
#define printf abacaba
#endif

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

using namespace std;

const int MX = 307;

ld f[MX + 5][MX + 5][MX + 5];

int main() {
#ifdef FASTIO
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#endif
    int n;
    int c[4]={0};
    cin >> n;
    for (int i = 1; i <= n; i++) {
        int x;
        cin >> x;
        c[x]++;
    }

    for (int k = 0; k < MX; k++) {
        for (int j = 0; j + k < MX; j++) {
            for (int i = 0; i + j + k < MX; i++) {
                if (i == 0 && j == 0 && k == 0) {
                    continue;
                }
                if (i + j + k > MX) {
                    continue;
                }
                ld wait = 1.0 * n / (i + j + k);
                ld pi = 1.0 * i / (i + j + k);
                ld pj = 1.0 * j / (i + j + k);
                ld pk = 1.0 * k / (i + j + k);

               
                    
               
                
                    
                if(i) f[i][j][k] += pi * f[i - 1][j][k];
                if(j) f[i][j][k] += pj * f[i + 1][j - 1][k];
            	if(k) f[i][j][k] += pk * f[i][j + 1][k - 1];
                
                f[i][j][k] += wait;
            }
        }
    }

    cout.precision(10);
    cout << fixed << f[c[1]][c[2]][c[3]] << "\n";
    return 0;
}



Measured memory_bytes: 233728
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a,b;
		for(int i=1;;i++){
			a = sc.nextInt();
			b = sc.nextInt();
			if(a==0&&b==0)break;
			if(a<b)
				System.out.println(a+" "+b);
			else
				System.out.println(b+" "+a);
		}
	}

}

Measured memory_bytes: 36468
//#define _USE_MATH_DEFINES
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
#pragma GCC diagnostic ignored "-Wmissing-declarations"
#define FINAL_OUT(x) {cout << (x) << '\n'; exit(0); }
inline int safe_mul(const int x, const int y) __attribute__ ((warn_unused_result));


int main()
{
//    freopen("in.txt","r", stdin);
//    freopen("out.txt", "w", stdout);
//    cout << fixed << setprecision(20);
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int n;
    cin >> n;
    vector<int> a(n);
    for (int& x : a)
        cin >> x;

    map<int,int> cnt;
    for (int x : a)
        ++cnt[x];

    sort(begin(a), end(a));

    if (cnt.size() > 3)
        FINAL_OUT("No");

    for (const auto& xa : cnt)
    for (const auto& ya : cnt)
    for (const auto& za : cnt)
    {
        int x = xa.first;
        int y = ya.first;
        int z = za.first;
        if ((x ^ y) == z && (x ^ z) == y && (y ^ z) == x) {
            vector<int> b;
            for (int i = 0; i < n; ++i) {
                b.push_back(x);
                int t = x;
                x = y;
                y = z;
                z = t;
            }
            bool flag = true;
            for (int i = 0; i < n; ++i) {
                if ((b[(i + n - 1) % n] ^ b[(i + 1) % n]) != b[i]) {
                    flag = false;
                }
            }
            if (flag) {
                sort(begin(b), end(b));
                if (a == b)
                    FINAL_OUT("Yes");
            }
        }
    }
    FINAL_OUT("No")
}


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

int main() {
    int n, k, ans = 0;
    cin >> n >> k;
    int a[n];
    for(int i = 0; i < n; ++i) cin >> a[i];
    sort(a, a+n);
    for(int i = 0; i < k; ++i) ans += a[i];
    cout << ans << '\n';

}


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

int main() {
    string s;
    cin >> s;
    int a;
    if (s=="SUN")
        a=7;
    if (s=="MON")
        a=6;
    if (s=="TUE")
        a=5;
    if (s=="WED")
        a=4;
    if (s=="THU")
        a=3;
    if (s=="FRI")
        a=2;
    if (s=="SAT")
        a=1;
        
    cout << a;

    return 0;
}


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

int n,k;
set<int> dlike;

inline bool ok(int x)
{
	while(x>0)
	{
		if(dlike.count(x%10)) return 0;
		x/=10;
	}
	return 1;
}

int main()
{
	cin>>n>>k;
	for(int i=0;i<k;i++)
	{
		int a;
		cin>>a;
		dlike.insert(a);
	}
	
	for(int i=n;i<100000;i++) if(ok(i)) {cout<<i;exit(0);}
}

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

int main(void) {
    string S;
    string output = "Yes\n";

    cin >> S;
    for(int i=0;i<S.size();i++) {
        if(((i%2)==0) && (S[i] == 'L')) {
            output = "No\n";
            break;
        } 
        if((i%2) && (S[i] == 'R')) {
            output = "No\n";
            break;
        }
    }

    cout << output ;
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<cstdlib>
#include<queue>
#include<vector>
#include<map>
using namespace std;
typedef long long LL;
const int MaxN = 50;
LL a[MaxN + 5];
LL cnt[MaxN + 5];
int n;
 
int main(){
	while(~scanf("%d", &n)){
		for(int i = 1; i <= n; i++) scanf("%lld", &a[i]);
		LL tot = 0, ans = 0;
		bool flag = true;
		while(flag){
			flag = false;
			tot = 0;
			for(int i = 1; i <= n; i++){
				cnt[i] = a[i] / n;
				a[i] = a[i] % n;
				tot += cnt[i];
			}
			ans += tot;
			for(int i= 1; i <= n; i++){
				a[i] += tot - cnt[i];
				if(a[i] >= n) flag = true;
			}
		}
		printf("%lld\n", ans);
	}
	return 0;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
using P = pair<ll, ll>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep1(i, n) for(ll i=1;i<=(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define INF 1000000000

void solve_abc_a() {
	ll N;
	string S;
	string ans;
	cin >> N >> S;

	if (N % 2 == 1) {
		ans = "No";
	}
	else {
		ans = "Yes";
		rep(i, N / 2) {
			if (S[i] != S[N / 2 + i]) {
				ans = "No";
				break;
			}
		}
	}

	cout << ans << "\n";

	return;
}

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

	solve_abc_a();

	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)

int N;
int d[100];

int main()
{
  scanf( "%d", &N );
  rep( i, N )
    scanf( "%d", d+i );

  std::sort( d, d+N );
  
  int prv = 0, cnt = 0;
  rep( i, N )
  {
    if( prv < d[i] )
      ++cnt;

    prv = d[i];
  }

  printf( "%d\n", cnt );

  return 0;
}

Measured memory_bytes: 128
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a  = sc.nextInt();
        int b  = sc.nextInt();
        int k  = sc.nextInt();
        int big = 0;
        if(a<b){
            big = a;
        }else{
            big = b;
        }
        List<Integer> list = new ArrayList<>();
        for(int i=big;i>=1;i--) {
            if (a % i == 0 && b % i == 0) {
                list.add(i);

            }
        }
        if(list.size() != 0){
            System.out.println(list.get(k-1));
        }else{
            System.out.println(0);
        }
    }
}

Measured memory_bytes: 23124
n,m = map(int,input().split())
hyo = list(map(int,input().split()))
all_hyo = sum(hyo)

hyo.sort(reverse=True)

a = True

for x in range(m):
  if hyo[x] < all_hyo / 4 / m:
    a = False
    break

if a :
  print("Yes")
else:
  print("No")


Measured memory_bytes: 9120
#include<bits/stdc++.h>
using namespace std;
#define mp make_pair

#define ll long long
#define sc(n) int n; scanf("%d",&n);
#define mod 10000007
#define N 100001
#define MX 1000000001
#define log(n) (int)log2(n)
#define logg(a)(b) log(b)/log(a)
#define pb(x) push_back(x);
#define T int t, q=0; scanf("%d", &t); while(q++<t)
#define pi acos(-1)
#define flag bool fl=true;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
int main() {

    ll int n;
    cin>>n;
    ll int p=0;
    ll int i=100;
    while(1)
    {
      ///  cout<<"hi"<<" ";
        if(i>=n)
        {
            break;
        }
        ll int popo=(i*0.01);
        i+=popo;
        p++;

    }
    cout<<p<<endl;
    return 0;
}





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

const int MAXN = 6000;
vector<pair<long long, pair<int, int>>> adj;
vector<int> adj2[MAXN];
vector<int> adj3[MAXN];
long long dist[MAXN];
int pai[MAXN];
bitset<MAXN> mark, mark2;
int n, m;

void bfs2(int u){
	mark2[u] = 0;
	queue<int> Q;
	Q.push(u);
	while(!Q.empty()){
		int v = Q.front();
		Q.pop();

		for (int k = 0; k < adj3[v].size(); k++){
			int foco = adj3[v][k];
			if (mark2[foco]){
				mark2[foco] = 0;
				//cout << foco << " ---\n";
				Q.push(foco);
			}
		}
	}
}


void bfs(int u){
	mark[u] = 0;
	queue<int> Q;
	Q.push(u);
	while(!Q.empty()){
		int v = Q.front();
		Q.pop();

		for (int k = 0; k < adj2[v].size(); k++){
			int foco = adj2[v][k];
			if (mark[foco]){
				mark[foco] = 0;
				//cout << foco << " ---\n";
				Q.push(foco);
			}
		}
	}
}

int bellmanFord(int s){
	//bellman-ford
	dist[s] = 0;
	for (int i = 1; i < n; i++){
		for (int k = 0; k < adj.size(); k++){
			if (dist[adj[k].second.second] < dist[adj[k].second.first] + adj[k].first){
				dist[adj[k].second.second] = dist[adj[k].second.first] + adj[k].first;
				pai[adj[k].second.second] = adj[k].second.first;
			}
		}
	}
	for (int k = 0; k < adj.size(); k++){
		if (dist[adj[k].second.second] < dist[adj[k].second.first] + adj[k].first && 
			mark[adj[k].second.second] == 0 && mark[adj[k].second.first] == 0 && 
			mark2[adj[k].second.second] == 0 && mark2[adj[k].second.first] == 0){
			//cout << adj[k].second.second << " " << adj[k].second.first << endl;
			return 0;
		}
	}
	return 1;
}

int main(){
	memset(pai, 0, sizeof(pai));
	long long p, w;
	cin >> n >> m >> p;
	for (int i = 0; i <= n; i++)
		dist[i] = -1e9;
	int a, b;
	for (int i = 0; i < m; i++){
		cin >> a >> b >> w;
		a--;
		b--;
		adj.push_back({w-p, {a, b}});
		adj2[b].push_back(a);
		adj3[a].push_back(b);
	}
	mark.set();
	bfs(n-1);
	mark2.set();
	bfs2(0);
	if(!bellmanFord(0)){
		cout << "-1\n";
		return 0;
	}

	if (dist[n-1] < 0) cout << "0\n";
	else cout << dist[n-1] << "\n";

	return 0;
}

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

using namespace std;
typedef long long int lli;

int main()
{
    // Input numbers
    string s, t;
    cin >> s >> t;

    lli count = 0;
    for (lli i = 0; i < (lli)s.size(); ++i) {
        if (s[i] != t[i]) {
            count++;
        }
    }

    cout << count << endl;
    return 0;
}

Measured memory_bytes: 3924
# include <algorithm>
# include <cassert>
# include <cctype>
# include <cstdio>
# include <cstdlib>
# include <cstring>
# include <cmath>
# include <iostream>
# include <map>
# include <queue>
# include <set>
# include <sstream>
# include <stack>
# include <string>
# include <vector>
# include <iomanip>

# define rep(i, n) for (int i = 0; i < (int)(n); i++)
# define irep(i, n) for (int i = int(n) - 1; i >= 0; i--)
# define FOR(i, m, n) for (int i = int(m); i < (int)(n); i++)

using namespace std;

int ans;
int next_i[] = {0, 1, 0, -1};
int next_j[] = {1, 0, -1, 0};

template <typename T>
void show_all (T t) {
  rep (i, t.size()) {
    rep (j, t[0].size()) {
      cout << t[i][j] << ' ';
    }
    cout << endl;
  }
}


void dfs (int i, int j, vector<vector<char>> &maze) {
  rep (k, 4) {
    int ii = i + next_i[k];
    int jj = j + next_j[k];

    if (0 <= ii && 0 <= jj && maze.size() > ii && maze[0].size() > jj && maze[ii][jj] == '.') {
      maze[ii][jj] = '#';
      ans++;
      dfs(ii, jj, maze);
    }
  }
}

int main() {
  int w, h;
  int init_i, init_j;

  while (cin >> w >> h && w && h) {
    vector<vector<char>> maze;
    ans = 1;

    rep (i, h) {
      vector<char> row(w);
      maze.push_back(row);

      rep (j, w) {
        cin >> maze[i][j];
        if (maze[i][j] == '@') {
          init_i = i;
          init_j = j;
        }
      }
    }

    // cout << "before" << endl;
    // show_all(maze);
    dfs(init_i, init_j, maze);
    // cout << "after" << endl;
    // show_all(maze);
    cout << ans << endl;
  }
}

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

string s;


void run() {
    map<char, char> boin;
    boin['T'] = 'a';
    boin['L'] = 'i';
    boin['U'] = 'u';
    boin['R'] = 'e';
    boin['D'] = 'o';
    for (int i = 0; i < s.length(); i+=2) {
        int index = s[i];
        char dir = s[i+1];

        switch (index) {
            case '1':
                // do nothing
                putchar(boin[dir]);
                break;
            case '2':
                putchar('k');
                putchar(boin[dir]);
                break;
            case '3':
                putchar('s');
                putchar(boin[dir]);
                break;
            case '4':
                putchar('t');
                putchar(boin[dir]);
                break;
            case '5':
                putchar('n');
                putchar(boin[dir]);
                break;
            case '6':
                putchar('h');
                putchar(boin[dir]);
                break;
            case '7':
                putchar('m');
                putchar(boin[dir]);
                break;
            case '8':
                putchar('y');
                putchar(boin[dir]);
                break;
            case '9':
                putchar('r');
                putchar(boin[dir]);
                break;
            case '0':
                switch (dir) {
                    case 'T': 
                        putchar('w');
                        putchar('a');
                        break;
                    case 'U':
                        putchar('n');
                        putchar('n');
                        break;
                    case 'D':
                        putchar('w');
                        putchar('o');
                        break;
                }
                break;
        }
   }
}


int main() {
    cin >> s;
    run();
    putchar('\n');
    return 0;
}

Measured memory_bytes: 1156
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
using P = pair<string,int>;
const double PI = acos(-1);

int main() {
  int n;
  cin >> n;
  vector<int> even;
  vector<int> odd;
  rep(i,n){
    int a;
    cin >> a;
    if(i%2 == 0) odd.push_back(a);
    else even.push_back(a);
  }
  if(n%2 == 0){
    reverse(even.begin(),even.end());
    rep(i,even.size()) cout << even.at(i) << " ";
    rep(i,odd.size()) cout << odd.at(i) << " ";
  }
  else{
    reverse(odd.begin(),odd.end());
    rep(i,odd.size()) cout << odd.at(i) << " ";
    rep(i,even.size()) cout << even.at(i) << " ";
  }
}

Measured memory_bytes: 4252
/*ANKON GHOSH
  KUET,ECE 2K16*/
#include<bits/stdc++.h>
using namespace std;
#define ll unsigned long long
#define inf 1e18
#define MAX 4003
#define mod 1000000007
#define sf(a) scanf("%lld",&a)
#define sff(a,b) scanf("%lld %lld",&a,&b)
#define sfff(a,b,c) scanf("%lld %lld %lld",&a,&b,&c)
#define Case(i) cout<<"Case #"<<i<<": "
#define pf(a) printf("%lld\n",a)
#define pfsn printf("NO\n")
#define pfs  printf("YES\n")
#define pff(a,b) printf("%lld %lld\n",a,b)
#define pfff(a,b,c) printf("%lld %lld %lld\n",a,b,c)
#define pffff(a,b,c,d) printf("%lld %lld %lld %lld\n",a,b,c,d)
#define FOR(i,n) for(ll i=0;i<n;i++)
#define FOR1(i,n) for(ll i=1;i<=n;i++)
#define LOOP(x,y) for(ll r=x;r<=y;r++)
#define RFOR(i,n) for(ll i=n-1;i>=0;i--)
#define RFOR1(i,n) for(ll i=n;i>0;i--)
#define RLOOP(x,y) for(ll i=y;i>=x;i--)
#define m_p(a,b) make_pair(a,b)
#define p_b(a) push_back(a)
#define ff first
#define ss second
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL)
map<ll,ll>mp1,mp;
vector<pair<ll,pair<ll,ll> > >vpp,vpp1;
vector<pair<ll,ll> >vp,fin;
vector<ll>v,v1,v2,dummy;
map<pair<ll,ll>,bool>mbb;
map<ll,bool>mb;
ll n,k,a,b,c,d,ta,sum=0,cnt=0,m,l,req,sz,maxi;
bool sortbysec(const pair<pair<ll,ll>,ll> &a,const pair<pair<ll,ll>,ll> &b)
{
    return (a.second < b.second);
}
int main()
{
    fast;
    cin>>n;
    ll mul=1;
    ll gcd=0;
    FOR(i,n)
    {
        cin>>a;
        v.p_b(a);
    }
    ll ans=v[0];
    FOR1(i,n-1)
    {
        ///ll x=ans*v[i];
        ll y=ans/(__gcd(ans,v[i]));
        ans=v[i]*y;
        ///cout<<ans<<endl;
    }
    cout<<ans<<endl;
    return 0;
}


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

#define REP(i,n) for(int i=0;i<(n);++i)
#define ll long long
const long long INF = 1LL<<60;
const long long mod = 1e9 + 7;

int main(){
    int A, B, K;
    cin >> A >> B >> K;
    for(int i = A; i <= min(B, A + K - 1); i++) cout << i << endl;
    for(int i = max(B - K + 1, A + K); i <= B ; i++) cout << i << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a[100001],num[100001];
int main()
{
	int n;
	cin>>n;
	long long sum=0;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
		sum+=(long long)a[i];
		num[a[i]]++;
	}
	int Q;
	cin>>Q; 
	long long m,k;	
	while(Q--)
	{
		cin>>m>>k;	
		sum+=(long long)num[m]*(k-m);
		num[k]+=num[m];
		num[m]=0;
		cout<<sum<<endl;
	} 
	return 0;
}


Measured memory_bytes: 4412
import scala.io.StdIn.readLine;
object Main {
    def main(args: Array[String]): Unit = {
        val Array(x, y) = readLine.split(" ").map(_.toInt);
        println(gcd(x, y));
    }
    def gcd(x: Int, y: Int): Int = {
        if (x < y) {
            gcd(y, x);
        } else if (x % y == 0) {
            y;
        } else {
            gcd(y, x % y);
        }
    }
}


Measured memory_bytes: 43872
#include <iostream>
#include <string>
#include <utility>
#include <map>
#include <vector>
#include <functional>
#include <algorithm>

using namespace std;
using ll = long long;

#define reps(i,s,n) for(int (i) = (s) ;(i) < (n); (i)++)
#define rep(i,n) reps(i,0,n)

int main()
{
    string str;
    cin >> str;
    vector<ll> cnt(27,0);
    ll n = str.length();

    ll ans = (n * (n-1)) / 2 + 1;
    rep(i,n){
        cnt[str[i]-'a']++;
    }

    rep(i,26){
        //cout  <<cnt[i] << endl;
        ans -= (cnt[i] * (cnt[i] - 1)) / 2;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 640
// unolight {{{
#include <bits/stdc++.h>
#include <unistd.h>
#define SZ(x) ((int)(x).size())
#define ALL(c) begin(c),end(c)
#define REP(i,n) for ( int i=0; i<(int)(n); i++ )
#define REP1(i,a,b) for ( int i=(int)(a); i<=(int)(b); i++ )
#define FOR(it,c) for ( auto it=(c).begin(); it!=(c).end(); it++ )
#define MP make_pair
#define PB push_back
using namespace std;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef long long LL;

void RI() {}

template<typename... T>
void RI( int& head, T&... tail ) {
    scanf("%d",&head);
    RI(tail...);
}

template<typename T>
void _dump( const char* s, T&& head ) { cerr<<s<<"="<<head<<endl; }

template<typename T, typename... Args>
void _dump( const char* s, T&& head, Args&&... tail ) {
    int c=0;
    while ( *s!=',' || c!=0 ) {
        if ( *s=='(' || *s=='[' || *s=='{' ) c++;
        if ( *s==')' || *s==']' || *s=='}' ) c--;
        cerr<<*s++;
    }
    cerr<<"="<<head<<", ";
    _dump(s+1,tail...);
}

#define dump(...) _dump(#__VA_ARGS__, __VA_ARGS__);

template<typename A, typename B>
ostream& operator <<( ostream &s, const pair<A,B> &p ) { return s<<"("<<p.first<<","<<p.second<<")"; }

template<typename Iter>
ostream& _out( ostream &s, Iter b, Iter e ) {
    s<<"[";
    for ( auto it=b; it!=e; it++ ) s<<(it==b?"":" ")<<*it;
    s<<"]";
    return s;
}
template<typename T>
ostream& operator <<( ostream &s, const vector<T> &c ) { return _out(s,ALL(c)); }
template<typename T>
ostream& operator <<( ostream &s, const set<T> &c ) { return _out(s,ALL(c)); }
template<typename A, typename B>
ostream& operator <<( ostream &s, const map<A,B> &c ) { return _out(s,ALL(c)); }
// }}}

const int MAX_N = 100005;
int n, k, a[MAX_N], b[MAX_N];

void input() {
    RI(n, k);
    REP(i, n) RI(a[i]);
}

void solve() {
	LL cnt=0;
	for(int i=0; i<n;i++) b[i]=a[i];

	for(int i=1; i<n; i++) {
		if(b[i]+b[i-1]>k) {
			b[i] = max(0, k-b[i-1]);
		}
	}
	if(n>1 && b[1]+b[0]>k) {
		b[0] = max(0, k-b[1]);
	}
	for(int i=0;i<n; i++) {
		cnt = cnt + a[i]-b[i];
	}
	printf("%lld\n", cnt);
}

int main( int argc, char *argv[] ) {
	input();
	solve();
    return 0;
}

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

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

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

  int n;
  cin >> n;
  VI a(n);
  REP(i,n) cin >> a[i];
  int mi=2;
  LL ans=a[0]-1;
  REP1(i,1,n-1) {
    if ( a[i]<=mi ) {
      if ( a[i]==mi ) mi++;
      continue;
    }
    ans+=(a[i]-1)/mi;
  }
  cout << ans << '\n';
  return 0;
}











Measured memory_bytes: 3732
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define MOD 1000000007  
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;   
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
//find_by_order(k) - k is the kth element of the set
//order_of_key(k) - Number of elements striclty samller than k
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll a,p;
    cin>>a>>p;
    cout<<(a*3+p)/2<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int totalt;
int mint=0x7fffffff;
int t[5];
int main(){
	for(int i=0;i<5;++i)
		cin>>t[i];
	sort(t,t+5);
	do{
		totalt=0;
		for(int i=0;i<4;++i){
			totalt+=t[i];
			while(totalt%10)
				++totalt;
		}
		totalt+=t[4];
		mint=min(totalt,mint);
//		cout<<t[0]<<' '<<t[1]<<' '<<t[2]<<' '<<t[3]<<' '<<t[4]<<' '<<'	'<<totalt<<endl;
	}while(next_permutation(t,t+5));
	cout<<mint<<endl;
	return 0;
}

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

int main(){
    int n=0, s=0, w=0, M = -1;
    cin >> n;
    vector<vector<int>> a(2, vector<int>(n+2));

    for(int i = 0; i < 2; i++){
        for (int j = 1; j <= n; j++){
            cin >> w;
            s += w;
            a.at(i).at(j) = s;
        }
        s = 0;
    }

    for (int x = 1; x <= n; x++){
        w = a.at(0).at(x) + a.at(1).at(n) - a.at(1).at(x-1);
        if(M < w) M = w;
    }

    cout << M;
    
}

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

namespace ABC148A
{
    class Program
    {
        static void Main(string[] args)
        {
            int a, b, c;
            a =int.Parse(Console.ReadLine());
            b= int.Parse(Console.ReadLine());
            c = 6 - a - b;
            Console.WriteLine(c);
            Console.ReadKey();

        }
    }
}


Measured memory_bytes: 11092
import java.util.*;

public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        sc.close();

        // 主処理
        int result = Math.min(n * a, b);

        // 出力
        System.out.println(result);
    }
}


Measured memory_bytes: 21460
s = str(input().upper())

count = 0
while True:
  moji = str(input())
  if moji == "END_OF_TEXT":
    break;
  elif moji == "end_of_text":
    continue;
  else:
    let = moji.upper()
    lst = let.split()
    count += lst.count(s)
print(count)


Measured memory_bytes: 5556
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
using namespace std;
typedef double D;
typedef complex<D> P;
const D EPS = 1e-8;

int n,r,q,r2;
P p[30];
int cur;
D min_s[30],SIN[30],COS[30],x,y;

inline P rotate(const P &v, const D &s){
  return P(real(v)*cos(s) - imag(v)*sin(s), real(v)*sin(s) + imag(v)*cos(s) );
}

inline D arg(const P &a,const P &b,const P &c){return real(conj(b-a)*(c-a))/(abs(b-a)*abs(c-a));}

inline D rot_seta(const int &end){
  D seta = acos( 1 - norm(p[end]-p[cur])/r2 );
  P nxt = rotate(p[cur],-seta);
  return arg(p[cur],p[end],nxt);
}

int main(){
  while(scanf("%d%d%d",&n,&r,&q), n){
    r2 = 2*r*r;
    rep(i,n){
      scanf("%lf%lf",&x,&y);
      p[i] = P(x,y);
      if(abs(abs(p[i])-r)<EPS)cur = i;
    }
    
    vector<int> nxt(n,-1);
    bool f = false;

    rep(i,q){
      if(nxt[cur]>=0)f = true;

      if(!f){
	min_s[cur] = 5;
	rep(j,n){
	  if(cur==j)continue;
	  D s = rot_seta(j);
	  if(nxt[cur]<0 || s > min_s[cur]+EPS)nxt[cur] = j, min_s[cur] = s;
	}
	min_s[cur] = acos(min_s[cur]);
	SIN[cur] = sin(min_s[cur]); COS[cur] = cos(min_s[cur]);
      }

      rep(j,n){
	if((f&&nxt[j]<0) || j==cur)continue;
	x = p[j].real()-p[cur].real(); y = p[j].imag()-p[cur].imag();
	p[j] = P(x*COS[cur] - y*SIN[cur], x*SIN[cur] + y*COS[cur]) + p[cur];
      }
      printf("%.9lf %.9lf\n",p[nxt[cur]].real(), p[nxt[cur]].imag());

      if(!i){
	int tmp = nxt[cur];
	nxt[cur] = -1;
	cur = tmp;
      }else{
	cur = nxt[cur];
      }
    }
  }
}

Measured memory_bytes: 1336
#include <stdio.h>
#include <algorithm>
using namespace std;
int arr[101];
int main(){
  int N;scanf("%d",&N);
  int sum=0,num=N;
  for(int i=0;i<N;i++){
    scanf("%d",arr+i);
    sum+=arr[i];
  }
  int A=0,B=0;
  for(int i=0;i<N;i++){
  	A+=(sum/num-arr[i])*(sum/num-arr[i]);
    B+=(sum/num+1-arr[i])*(sum/num+1-arr[i]);
  }
  printf("%d",min(A,B));
}

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

int main() {
    int A, B, C, X;
    std::cin >> A >> B >> C >> X;

    int cnt = 0;
    for (int i = 0; i <= A; ++i) {
        for (int j = 0; j <= B; ++j) {
            for (int k = 0; k <= C; ++k) {
                if ((500 * i + 100 * j + 50 * k) == X) {
                    ++cnt;
                }
            }
        }
    }

    std::cout << cnt << std::endl;

    return 0;
}


Measured memory_bytes: 384