akhauriyash/Code-Regression huggingface dataset:
let levenshtein_distance (x, y) =
  if x = y then 0
  else begin
    let m = String.length x in
    let n = String.length y in
    if m = 0 then n
    else if n = 0 then m
    else begin
      let s = Array.init (n + 1) (fun i -> i) in
      let t = Array.make (n + 1) 0 in
      for i = 0 to m - 1 do
        t.(0) <- i + 1;
        for j = 0 to n - 1 do
          let c = if x.[i] = y.[j] then 0 else 1 in
          let d = 1 + (if t.(j) < s.(j+1) then t.(j) else s.(j+1)) in
          t.(j+1) <- if s.(j) + c < d then s.(j) + c else d;
        done;
        Array.iteri (fun i e -> s.(i) <- e) t;
      done;
      t.(n)
    end
  end

let () =
  Scanf.scanf "%s %s " (fun x y -> x, y)
  |> levenshtein_distance
  |> Printf.printf "%d\n"

Measured memory_bytes: 2424
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define srep(i,s,t) for(int i = s; i < t; ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005

int main() {
    string s;
    cin >> s;
    int ans = 0;
    rep(i,3) if(s[i] == 'R') ans++;
    if(ans == 2 && s[1] == 'S') ans--;
    cout << ans << endl;
    return 0;
}




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

int main(){
    int N,n,sum=0;
    cin >> N;
  	n= N;

    while(n>0){
        sum += n%10;
        n /= 10;
    }
    if(N%sum ==0) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void){
  double a, prev, sum;
  
  while(scanf("%lf\n", &a) != EOF) {
    sum = 0.0;
    
    prev = a;
    sum += a;
    
    for(int i = 1; i < 10; i++) {
      if((i + 1) % 2 == 0) {
        prev = prev * 2;
      } else {
        prev = prev / 3;
      }
      
      sum += prev;
    }
    
    printf("%lf\n", sum);
  }
}



Measured memory_bytes: 2040
from collections import defaultdict

h, w, n = map(int, input().split())
d = defaultdict(int)
for i in range(n):
    a, b = map(int, input().split())
    for k in range(max(1, a - 2), min(h - 2, a) + 1):
        for l in range(max(1, b - 2), min(w - 2, b) + 1):
            x = (k, l)
            d[x] += 1
ans = [0] * 10
for v in d.values():
    ans[v] += 1
ans[0] = (h - 2) * (w - 2) - sum(ans[1:])
for i in range(10):
    print(ans[i])


Measured memory_bytes: 152048
#include <iostream>
    using namespace std;
    
    void bubbleSort(string A[], int N) {
        for (int i = 0; i < N-1; ++i) {
            for (int j = N-1; j > i; --j) {
                if (A[j][1] < A[j-1][1]) swap(A[j], A[j-1]);
            }
        }
    }
    
    void selectionSort(string A[], int N) {
        for (int i = 0; i < N-1; ++i) {
            int minOfJ = i;
            for (int j = i + 1; j < N; ++j) {
                if (A[j][1] < A[minOfJ][1]) minOfJ = j;
            }
            if (minOfJ != i) swap(A[i], A[minOfJ]);
        }
    }
    
    bool isStable (string A1[], string A2[], int N) {
        for (int i = 0; i < N; ++i) {
            if (A1[i] != A2[i]) return false;
        }
        return true;
    }
    
    int main() {
        int N; cin >> N;
        string A1[N];
        string A2[N];
        for (int i = 0; i < N; ++i) cin >> A1[i];
        for (int i = 0; i < N; ++i) A2[i] = A1[i];
        
        bubbleSort(A1, N);
        selectionSort(A2, N);
        
        for (int i = 0; i < N; ++i) {
            if (i > 0) cout << " ";
            cout << A1[i];
        }
        cout << endl;
        cout << "Stable" << endl;
        
        for (int i = 0; i < N; ++i) {
            if (i > 0) cout << " ";
            cout << A2[i];
        }
        cout << endl;
        if (isStable(A1, A2, N)) cout << "Stable" << endl;
        else cout << "Not stable" << endl;
        return 0;
    }


Measured memory_bytes: 3176
use std::cmp::{max, min};
use std::error::Error;
use std::io;

pub fn main() {
    if let Err(e) = run() {
        panic!("failed.");
    }
}

fn run() -> Result<(), Box< Error>> {
    let mut input = String::new();
    io::stdin().read_line(&mut input);
    input.clear();
    io::stdin().read_line(&mut input);
    let slime: Vec<i64> = input.split_whitespace().map(|s| s.parse::<i64>().unwrap()).collect();
    if slime.len() <= 1{
        println!("0");
        return Ok(())
    }
    let mut dp = vec![vec![std::i64::MAX; slime.len()]; slime.len()];
    let mut prefix = vec![0; slime.len() + 1];
    for i in 0..slime.len() {
        prefix[i + 1] = prefix[i] + slime[i];
    }
    do_solve(0, slime.len() - 1, &mut dp, &slime, &prefix);
    println!("{}", dp[0][slime.len() - 1]);
    Ok(())
}

fn do_solve(from: usize, to: usize, dp: &mut Vec<Vec<i64>>, slime: &Vec<i64>, prefix_sum: &Vec<i64>) -> i64 {
    if dp[from][to] != std::i64::MAX {
        return dp[from][to];
    }
    if from + 1 == to {
        dp[from][to] = slime[from] + slime[to];
        return slime[from] + slime[to];
    }
    if from == to {
        dp[from][to] = 0;
        return 0;
    }
    let mut result = std::i64::MAX;
    for i in from..to {
        let cost = do_solve(from, i, dp, slime, prefix_sum) + do_solve(i + 1, to, dp, slime, prefix_sum);
        let final_cost = prefix_sum[to + 1] - prefix_sum[from];
        result = min(result, cost + final_cost);
    }
    dp[from][to] = result;
    result
}


Measured memory_bytes: 4352
N, K = map(int, input().split())
p = list(map(int, input().split()))

P = [0 for n in range(N - K + 1)]

P[0] = sum([p[i] for i in range(K)])

for i in range(N - K):
  P[i + 1] = P[i] - p[i] + p[i + K]

print((max(P) + K)/2)


Measured memory_bytes: 25060
import sys
from collections import Counter
from bisect import bisect_left

sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline

class BitSum:
    def __init__(self, n):
        self.n = n
        self.table = [0] * (n + 1)

    def update(self, i, x):
        i += 1
        while i <= self.n:
            self.table[i] += x
            i += i & -i

    def sum(self, i):
        i += 1
        res = 0
        while i > 0:
            res += self.table[i]
            i -= i & -i
        return res

def main():
    n = int(input())
    aa = list(map(int, input().split()))
    aa = list(Counter(aa).values())
    aa.sort()
    bit = BitSum(len(aa))
    for i, a in enumerate(aa):
        bit.update(i, a)
    # print(aa)
    for k in range(1, n + 1):
        l = 0
        r = n // k + 2
        while l + 1 < r:
            m = (l + r) // 2
            i = bisect_left(aa, m)
            s = bit.sum(i - 1) + m * (len(aa) - i)
            if s >= m * k:
                l = m
            else:
                r = m
        print(l)

main()


Measured memory_bytes: 119956
#include<stdio.h>
int main(){
  int h[8][3]={
    {1,2,3},
    {4,5,6},
    {7,8,9},
    {1,4,7},
    {2,5,8},
    {3,6,9},
    {1,5,9},
    {3,5,7}
  };
  int i,j;
  char s[12];
  while(fgets(s,11,stdin)!=NULL){
    if(s[0]!=10){
      for(i=0;i<8;i++){
	if(s[h[i][0]-1]==s[h[i][1]-1]&&s[h[i][0]-1]==s[h[i][2]-1]){
	  if(s[h[i][0]-1]!='s'){
	    printf("%c\n",s[h[i][0]-1]);
	    break;
	  }
	}
      }
    }
    if(i==8)printf("d\n");
  }
  return 0;
}

Measured memory_bytes: 524
#include <iostream>
#include <vector>
#include <algorithm> 
#include <cmath>
#include <numeric>
using namespace std;


int main(void){
    // Your code here!
    long long int n;
    cin >> n;
    
    int score = 0;
    
    int rest = n;
    int num = rest / 500;
    score += 1000 * num;
    rest -= 500*num;
    
    num = rest/5;
    score += 5*num;
    
    cout << score << endl;
    return 0;
}


Measured memory_bytes: 256
from collections import defaultdict

N = int(input())
s = []
for n in range(N):
    s.append(input())

M = int(input())
t = []
for m in range(M):
    t.append(input())

d = defaultdict(int)
for _s in s:
    d[_s] += 1
for _t in t:
    d[_t] -= 1

print(max(max(d.values()), 0))

Measured memory_bytes: 3444
#include <bits/stdc++.h>
#define rep(i, n) for (rint i = 1; i <= (int)(n); i ++)
#define re0(i, n) for (rint i = 0; i < (int) n; i ++)
#define travel(i, u) for (rint i = head[u]; i; i = e[i].nxt)
#define rint register int
using namespace std;

typedef long long lo;

template<typename tp> inline void read(tp &x) {
    x = 0; char c = getchar(); int f = 0;
    for (; c < '0' || c > '9'; f |= c == '-', c = getchar());
    for (; c >= '0' && c <= '9'; x = (x << 3) + (x << 1) + c - '0', c = getchar());
    if (f) x = -x;
}
namespace {
    const int mo = 1e9 + 7;
    inline int add(int x, int y) { x += y; return x >= mo ? x - mo : x; }
    inline int sub(int x, int y) { x -= y; return x < 0 ? x + mo : x; }
    inline int mul(int x, int y) { return (lo) x * y % mo; }
    inline int power(int a, int k = mo - 2) {
		int ans = 1;
		for (; k; k >>= 1, a = mul(a, a))
			if (k & 1) ans = mul(ans, a);
		return ans;
    }
	inline void U(int &x, int y) { x = add(x, y); } 
}

const int N = 3e5 + 233; 
int n, a[N], id[N], rnk[N], val[N], pre[N], pid[N], sum[N], isum[N];

struct bit_t {
	int tr[N];
	inline void init() {
		memset(tr, 0, sizeof tr);
	}
	inline void add(int x, int v) {
		for (; x < N; x += x & -x) U(tr[x], v);
	}
	inline int _query(int x) {
		if (x <= 0) return 0;
		int ans = 0;
		for (; x >= 1; x -= x & -x) U(ans, tr[x]);
		return ans;
	}
	inline int query(int l, int r) {
		return l > r ? 0 : sub(_query(r), _query(l - 1));
	}
} L, R;

int main(void) {
	read(n);
	rep (i, n) read(a[i]), id[i] = i;
	sort(id + 1, id + n + 1, [](int x, int y) {
			return a[x] < a[y];
		});
	rep (i, n) {
		rnk[id[i]] = i;
		val[i] = mul(a[id[i]] - (i - 1) - 1, power(a[id[i]] - (i - 1)));
		isum[i] = power(sum[i] = mul(sum[i - 1] == 0 ? 1 : sum[i - 1], val[i]));
		pre[i] = val[i] == 0 ? i : pre[i - 1];
		pid[i] = a[id[i]] == a[id[i - 1]] ? pid[i - 1] : i - 1;
	}
	int all = 1;
	rep (i, n) {
		if (a[i] - (rnk[i] - 1) <= 0)
			return puts("0"), 0;
		all = mul(all, a[i] - (rnk[i] - 1));
	}
	int ans = 0;
	{
		map <int, int> mp;
		rep (i, n) mp[a[i]]++;
		for (auto i : mp) U(ans, mul((lo) i.second * (i.second - 1) / 2, mul(power(2), all)));
	}
	{
		int coef = 0, tot = 0;
		L.init(); R.init();
		for (int i = n; i >= 1; i--) {
			int u = rnk[i];
			U(coef, mul(mul(sum[u - 1], L.query(pre[u - 1] + 1, pid[u])), power(a[i] - (u - 1))));
			L.add(u, mul(isum[u], a[i] - u));
			U(tot, R.query(1, pid[u]));
			R.add(u, 1);
		}
		U(ans, mul(all, sub(tot, mul(power(2), coef))));
	}
	{
		L.init();
		int coef = 0;
		for (int i = 1; i <= n; i++) {
			int u = rnk[i];
			U(coef, mul(mul(sum[u - 1], L.query(pre[u - 1] + 1, pid[u])), power(a[i] - (u - 1))));
			L.add(u, mul(isum[u], a[i] - u));
		}
		U(ans, mul(coef, mul(power(2), all)));
	}
	cout << ans << "\n";
}


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

#define fi first
#define se second
using P = pair<long long, long long>;
long long n;
vector<long long> l, r, num, sum;
vector<P> v;
map<long long, long long> mp;

int main() {
  cin >> n;
  l.resize(n);
  r.resize(n);
  v.resize(n);
  for (int i = 0; i < n; ++i) {
    cin >> v[i].fi >> v[i].se;
    l[i] = v[i].fi;
    r[i] = v[i].se;
    num.push_back(l[i]);
    num.push_back(r[i] + 1);
  }
  sort(num.begin(), num.end());
  sort(l.begin(), l.end());
  sort(r.begin(), r.end());
  num.erase(unique(num.begin(), num.end()), num.end());
  for (int i = 0; i < num.size(); ++i) mp[num[i]] = i;
  sum.assign(num.size() + 1, 0);
  for (int i = 0; i < n; ++i) {
    ++sum[mp[l[i]]];
    --sum[mp[r[i] + 1]];
  }
  for (int i = 1; i < sum.size(); ++i) sum[i] += sum[i - 1];
  if (n % 2) {
    long long res = 0, lid = mp[l[n / 2]], rid = mp[r[n / 2] + 1];
    for (int i = lid; i < rid; ++i)
      if (sum[i] > 0) res += num[i + 1] - num[i];
    cout << res << endl;
  } else {
    long long res = 0, lid = mp[l[n / 2 - 1]], rid = mp[r[n / 2] + 1], cnt = 0,
              lid2 = mp[l[n / 2]], rid2 = mp[r[n / 2 - 1] + 1], cnt2 = 0;
    for (int i = lid; i < rid2; ++i)
      if (sum[i] > 0) cnt += num[i + 1] - num[i];
    cout << (num[rid2] + num[rid] - 2) - (num[lid] + num[lid2]) + 1 << endl;
  }
  return 0;
}


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

int main(){
  int n,k;
  cin >> n >> k;
  set<int> dislike;
  for(int i = 0; i < k; i++){
    int tmp;
    cin >> tmp;
    dislike.insert(tmp);
  }
  //sort(like.begin(),like.end());
  for(int i = n; i < 1000000; i++){
    vector<int> num;
    int ni = i;
    while(ni>0){
      num.push_back(ni%10);
      ni /= 10;
    }
    int flag = 0;
    for( auto k : num){
      if(dislike.count(k)){
        flag = 1;
        break;
      }
    }
    if(flag)continue;
    else{
      cout << i << endl;
      break;
    }
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <random>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repp(i,n,m) for (int i = m; i < (n); ++i)
#define repl(i,n) for (long long i = 0; i < (n); ++i)
#define reppl(i,n,m) for (long long i = m; i < (n); ++i)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using PL = pair<long long, long long>;
using Pxy = pair<double, double>;
using T = tuple<int, int, bool>;
const int INF = 1001001007;
const int mod = 1000000007;
const int MOD = 998244353;
const ll inf = 1e18;
template <typename AT>
void printvec(vector<AT> &ar){
    rep(i,ar.size()-1) cout << ar[i] << " ";
    cout << ar[ar.size()-1] << endl;
}
template <typename Q>
void printvvec(vector<vector<Q>> &ar){
    rep(i,ar.size()){
        rep(j,ar[0].size()-1) cout << ar[i][j] << " ";
        cout << ar[i][ar[0].size()-1] << endl;
    }
}
template <typename S>
bool range(S a, S b, S x){
    return (a <= x && x < b);
}

void yes(int n){
    cout << "Yes" << endl;
}

void no (int n){
    cout << "No" << endl;
}

ll cel (ll a, ll b){
    if (a % b == 0) return a / b;
    else return a / b + 1;
}

int main() {
    vector<int> ar(5);
    rep(i,5) cin >> ar[i];
    bool t = true;
    int k; cin >> k;
    rep(i,4){
        repp(j,5,i+1){
            if (ar[j] - ar[i] > k) t = false;
        }
    }
    if (t) cout << "Yay!" << endl;
    else cout << ":(" << endl;
}

Measured memory_bytes: 3576
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) FOR(i,0,b)
#define INF mugen
#define dump(x) cerr<<#x<<"="<<x<<endl
#define all(a) (a).begin(),(a).end()
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<vii> viii;
typedef pair<int,int> P;
template <class T> void chmin(T & a, T const & b) { if (b < a) a = b; }
template <typename T>
string to_string(const T &n){ostringstream stm;stm << n;return stm.str();}
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
using ll = long long;
const ll mod = LLONG_MAX;
 
int N,W;
ll ans;
ll dp[212345];
ll w[110],v[110];
signed main(){
    cin>>N>>W; 
    rep(i,N)cin>>w[i]>>v[i];


    
    for(int j=0;j<N;j++){
        for(int i=W;i>=0;i--){
            dp[i+w[j]]=max(dp[i]+v[j],dp[i+w[j]]);
        }
    }


    for(int i=0;i<=W;i++){
       ans=max(ans,dp[i]);
    }
    cout<<ans<<endl;

 
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int i = (int)(n); i >= 0; i--)
#define all(v) v.begin(),v.end()
typedef long long ll;

int main(){
    ll n;
    cin >> n;
    ll m = 1;
    for (ll i = 1; i * i <= n; i++){
        if (n % i == 0) m = i;
    }
    ll x = m + n / m;
    cout << x - 2 << endl;
}


Measured memory_bytes: 256
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
using namespace std;
#define INF 100000000
#define MAX_STATE 65536
#define MAXN 100

typedef long long ll;
const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};

int N;
ll dp[MAX_STATE]; // 各状態において最大いくらの利益が得られるか
vector<int> date[MAXN];
ll L[MAXN];

ll dfs(int state) {
//    cout << state << endl;
    if (dp[state] != -1) return dp[state];
    ll ret = 0;
    for (int i = 0; i < N; i++) {
        bool flag = true;
        int next = state;
        for (int j = 0; j < date[i].size(); j++) {
            if (next & (1 << date[i][j])) {
                flag = false;
                break;
            } else {
                next |= 1 << date[i][j];
            }
        }
        if (flag) {
            ret = max(ret, dfs(next) + L[i]);
        }
    }
    return dp[state] = ret;
}

int main(void) {
    while (cin >> N) {
        if (N == 0) break;
        for (int i = 0; i < MAX_STATE; i++) dp[i] = -1;
        for (int i = 0; i < N; i++) {
            int M;
            cin >> M >> L[i];
            for (int j = 0; j < M; j++) {
                int s, e;
                cin >> s >> e;
                for (int k = s; k < e; k++) {
                    date[i].push_back(k-6);
                }
            }
        }
        cout << dfs(0) << endl;
        for (int i = 0; i < N; i++) date[i].clear();
    }
    return 0;
}

Measured memory_bytes: 1740
## coding: UTF-8
from itertools import permutations, combinations,combinations_with_replacement,product
s = input().split()
q = [int(p) for p in s]
#print(q)
K = q[0]
N = q[1]

t = input().split()
r = [int(p) for p in t]
#print(K)
#print(N)
#print(r)

#r = [2, 9 ,17]
dist = []

def calc_dist(a, b):
    if(a - b < 0):
        return a - b + K
    else:
        return a - b

for i in range(N):
    dist.append(calc_dist(r[i], r[i-1]))
#print(dist)

answer = K - max(dist)
print(answer)


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

int main(){
  long long k;
  string str;
  cin >> k >> str;
  if(str.size() <= k)
    cout << str;
  else{
    for(int i = 0;i < k;i++)
      cout << str[i];
    cout << "...";
  }
}


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

using namespace std;

int main() {
   // freopen("inp.inp", "r", stdin);
    int n;
    cin >> n;
    vector<int> a(3 * n);
    for (int& i : a) {
        cin >> i;
    }
    sort (a.begin(), a.end(), greater<int>());
    int s = 1;
    long long ans = 0;
    while (n--) {
        ans += a[s];
        s += 2;
    }
    cout << ans;
    return 0;
}




Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int MOD=998244353;

int w[1234567],v[1234567];
int pw(int n,int k){
  if(k<0)return pw(n,k+MOD-1);
  int res=1;
  while(k){
    if(k&1)res*=n;res%=MOD;
    n*=n;n%=MOD;
    k>>=1;
  }
  return res;
}
void mins(int &a,int b){
  if(a>MOD)a%=MOD;if(b>MOD)b%=MOD;
  a-=b;if(a<0)a+=MOD;
}
void add(int &a,int b){
  if(a>MOD)a%=MOD;if(b>MOD)b%=MOD;
  a+=b;if(a>=MOD)a-=MOD;
}
int kake(int a,int b){
  if(a>MOD)a%=MOD;
  if(b>MOD)b%=MOD;
  if(a*b>MOD)return a*b%MOD;
  return a*b;
}
int ru(int a){
  if(a>MOD)a%=MOD;
  if(a*a>MOD)return a*a%MOD;
  return a*a;
}

signed main(){
  int n;cin>>n;
  while(n--){
    int a;cin>>a;v[a]++;
  }
  for(int i=1;i<1234567;i++)w[i]=pw(i,MOD-2);
  int wa2=w[2];
  for(int i=1;i<1234567;i++)
    for(int j=i*2;j<1234567;j+=i)
      mins(w[j],w[i]);
  int ans=0;
  for(int i=1;i<1234567;i++){
    int tmp1=0,tmp2=0;
    for(int j=i;j<1234567;j+=i)add(tmp1,kake(j,v[j])),add(tmp2,kake(v[j],ru(j)));
    tmp1*=tmp1;tmp1%=MOD;
    mins(tmp1,tmp2);
    tmp1*=wa2;tmp1%=MOD;
    add(ans,kake(tmp1,w[i]));
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 19584
using System;

public class Test
{
	public static void Main()
	{
		string line = System.Console.ReadLine();
   		string[] ab = line.Split(' ');
   		int a = Convert.ToInt32(ab[0]);
   		int s = a%60;
   		int m = ((a-s)%3600)/60;
   		int h = (a - s - 60*m)/3600;
   		Console.WriteLine("{0}:{1}:{2}",h,m,s);
	}
}

Measured memory_bytes: 9260
A = int(input())
B = int(input())
C = int(input())
X = int(input())

counter = 0
for a in range(0,A+1):
	for b in range(0,B+1):
		for c in range(0,C+1):
		
			if(X == 500*a+100*b+50*c):
				counter += 1

print(counter)

Measured memory_bytes: 3060
def DP(s):
    N = len(s)
    dp = [[0] * (3) for i in range(N+1)]
    rsp = {'s':0, 'p':1, 'r':2}
    for i in range(N):
        for j in range(3):
            for k in range(3):
                win = int(rsp[s[i]] == k) * RSP[k]
                if j != k: dp[i+1][k] = max(dp[i+1][k], dp[i][j] + win)
    return max(dp[N])

N, K = map(int, input().split())
RSP = list(map(int, input().split()))
T = input()

ans = 0
for i in range(K): ans += DP(T[i:N:K])
print(ans)


Measured memory_bytes: 22652
from sys import exit

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

X = int(input())

lists = make_divisors(X) 

for i in range(-1000, 1000):
    for j in range(-1000, 1000):
        if i - j in lists and i**5 - j**5 == X:
            print(i, j)
            exit()






Measured memory_bytes: 9456
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>


using namespace std;
string yn(bool a)
{
  if (a){return "Yes";}
  else{return "No";}
}

bool nakayoshi(vector<int> a,vector<int> b)
{
  return a[0]<b[0] and a[1]<b[1];
}

int main()
{
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<vector<int>> p(n+2,vector<int>(2)),q(n+2,vector<int>(2));;
  for(int i=1;i<n+1;i++)
  {
    cin >> p[i][0]>>p[i][1];
  }
  for(int i=1;i<n+1;i++)
  {
    cin >> q[i][0]>>q[i][1];
  }
  vector<vector<int>> edge(2*n+2,vector<int>(2*n+2)),qedge(2*n+2,vector<int>(2*n+2));
  for(int i=1;i<n+1;i++)
  {
    for(int j=1;j<n+1;j++)
    {
      edge[i][n+j]=nakayoshi(p[i], q[j]);
      qedge[i][j]=nakayoshi(p[i], q[j]);
    }
  }
  for(int i=1;i<n+1;i++){edge[0][i]=true;edge[n+i][2*n+1]=true;}
  do{
      queue<int> que{};
      que.push(0);
      vector<int> flag(2*n+2);
      for(int i=0;i<2*n+2;i++){flag[i]=-1;}
      flag[0]=0;
      while(que.size()>0)
      {
        int tmp;
        tmp=que.front();
        que.pop();
        if(tmp==2*n+1){que.push(-1);break;}
        for(int i=0;i<2*n+2;i++)
        {
          if(edge[tmp][i] and flag[i]==-1 ){que.push(i);flag[i]=tmp;}
        }

      }
      if(que.empty()){break;}
      que.pop();
      vector<int>track;
      track.clear();
      int i=2*n+1;
      track.push_back(i);
      edge[i][flag[i]]=!edge[i][flag[i]];
      edge[flag[i]][i]=!edge[flag[i]][i];
      for(int j=0;j<3*n;j++)
      {

        i=flag[i];
        track.push_back(i);


        if(i==0){break;}

        edge[i][flag[i]]=!edge[i][flag[i]];
        edge[flag[i]][i]=!edge[flag[i]][i];
      }

  }while(1);
  int res=0;
  for(int i=1;i<n+1;i++){res+=!edge[0][i];}
  cout <<res<<endl;
  return 0;





}

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

namespace _0027
{
    class Program
    {
        static void Main(string[] args)
        {
            string str = "";
            while(!((str=Console.ReadLine())=="0 0"))
            {
                int[] line = str.Split(' ').Select(int.Parse).ToArray();
                DayOfWeek date = new DateTime(2004, line[0], line[1],0,0,0).DayOfWeek;
                Console.WriteLine(date);
            }
        }
    }
  
}



Measured memory_bytes: 16424
X = int(input())
prime_under_X = []
for i in range(2, int(X ** 0.5) + 1):
    flg = True
    for j in range(len(prime_under_X)):
        if i % prime_under_X[j] == 0:
            flg = False
            break
    if flg:
        prime_under_X.append(i)

while True:
    flg = True
    for j in range(len(prime_under_X)):
        if X % prime_under_X[j] == 0:
            flg = False
            break
    if flg:
        print(X)
        break
    X = X + 1


Measured memory_bytes: 9356
#include <cstdio>

int main(){
	int n;
	while(scanf("%d", &n),n){
		int ans = 1000000;
		for(int i = 0; i <= 100; i++){
			for(int j = 0; j <= 1000; j++){
				if(n-i*i*i-j*j >= 0){
					if(ans > i+j+n-i*i*i-j*j) ans = i+j+n-i*i*i-j*j;
				}
			}
		}
		printf("%d\n", ans);
	}
}

Measured memory_bytes: 1028
#include<bits/stdc++.h>
using namespace std;
int main(){
  int K ,N;
  cin >> K >> N;
  vector<int> A(N+1);
  for(int i=0; i<N; i++){
    cin >> A[i];
  }
  A[N] = A[0] + K;
  int max = 0;
  for(int i=1; i< N+1; i++){
    if(max < A[i] - A[i-1]){
      max = A[i] - A[i-1];
    }
  }
  cout << K - max << endl;
  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A,B,C,D;
  cin >> A >> B >> C >> D;
  if (A + B > C + D) cout << "Left" << endl;
  else if (A + B < C + D) cout << "Right " << endl;
  else cout << "Balanced " << endl;

}

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

int main() {
    map<string, int> mp;
    int n;
    cin >> n;
    string s[n];

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


    int ans = 0;
    
    for(auto x : mp) {
        ans++;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 25508
object Main{
    def main(args: Array[String]): Unit ={
        val scanner = new java.util.Scanner(System.in)
        val i = scanner.nextInt()
        val h = i/ 3600
        val hi = i - h*3600
        val m = hi/ 60
        val s = hi - m*60
        System.out.println(h + ":" + m + ":" + s)
    }
}

Measured memory_bytes: 44780
use std::io;


fn read_line() -> String {
    let mut line = String::new();

    io::stdin().read_line(&mut line)
        .expect("Failed to read line");
    return line;
}
fn to_i(s: &str) -> i64 {
    return s.trim().parse()
        .expect("Please type a number!");
}

fn main() {

    let l1 = read_line();
    
    let nx: Vec<&str> = l1.split(' ').collect();

    let n: i64 = to_i(nx[0]);
    let x: i64 = to_i(nx[1]);

    let l2 = read_line();
    

    let items: Vec<&str> = l2.split(' ').collect();
    //println!("items:{:?}", items);

    let mut nums: Vec<i64> = Vec::new();

    let mut sum = 0;
    for item in items {
        let num = to_i(item);
        nums.push(num);
        sum += num;
    }
    if sum == x {
        print!("{}", n);
        return;
    }
    nums.sort();
    //nums.reverse();

    //println!("nums:{:?}", nums);

    let mut sum = 0;
    let mut count = 0;
    for i in 0..nums.len() {
        let num = nums[i];
        //println!("{} {} {}", i, sum + num, x);
        if sum + num <= x {
            if i==nums.len()-1 {
                if sum + num == x {
                    count = i+1;
                    sum += num;
                } else{

                }
            } else {
                count = i+1;
                sum += num;
            }
        } else {
            break;
        }
    }
    
    //println!("count:{:?}", count);

    if count >= nums.len() {
        if n==0 {
            count = 0;
        } else {
            count = (n-1) as usize;
        }
    }
/*
    let mut count = check(0, &nums, x);
    if count <0 {
        count = 0;
    }
*/

    print!("{}", count);


}   

Measured memory_bytes: 4352
#include <iostream>
//#include <string>
//#include <iomanip>

using namespace std;
//#define

int main() {
	int n,value;
	bool cards[4][13]={0};
	char mark;

	cin >> n;

	for(int i=0;i<n;i++){
		cin >> mark >> value;
		switch(mark){
		case 'S':
			cards[0][value-1] = 1;
			break;
		case 'H':
			cards[1][value-1] = 1;
			break;
		case 'C':
			cards[2][value-1] = 1;
			break;
		case 'D':
			cards[3][value-1] = 1;
			break;
		default:
			break;
		}
	}

	for(int i=0;i<4;i++){
		for(int k=0;k<13;k++){
			if(cards[i][k]==0){
				int x = k;
				switch(i){
				case 0:
					cout << "S " << x+1 << endl;
					break;
				case 1:
					cout << "H " << x+1 << endl;
					break;
				case 2:
					cout << "C " << x+1 << endl;
					break;
				case 3:
					cout << "D " << x+1 << endl;
					break;
				default:
					break;
				}
			}
		}
	}

	return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int i,n,m;
	cin>>n>>m;
	int h[n+1],u,v,ans=0;
	for(i=1;i<=n;i++)
		cin>>h[i];
	bool b[n+1];
	memset(b,1,sizeof(b));
	for(i=1;i<=m;i++)
	{
		cin>>u>>v;
		if(h[u]<=h[v])
			b[u]=0;
		if(h[v]<=h[u])
			b[v]=0;
	}
	for(i=1;i<=n;i++)
		ans+=b[i];
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 4116
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
/*
DPぽいがむずいな
1箇所生成して流す
2箇所生成して流す
3箇所生成して流す
とかのいずれ。
全探索？
流す回数で探索か？
どうせN回生成はする。
それぞれの箇所について、最小手を計算する？
5 100
100 16 39 199 2
100 16 39 139 2
作って流す、のコストと、その場で作る、と。
N*Nで間に合いそう
//それぞれの値について。
どこで生成したか、と
何回動かしたか。
違ったか。
一番コストの低いのが作ってまわす
2番目にコストも作ってまわす。
もしコストふえたらそこで終了？
そんなことないか
魔法回数固定して全探索
*/

int main(){
  ll N,x; cin>>N>>x;
  vector<ll> Z(N,0), minbox(N,1e9);
  for(int i=0; i<N; i++){
    ll a; cin>>a;
    Z[i]=a;
  }
  ll ans=1e14;
  for(int i=0; i<N; i++){//魔法回数
    ll cost=0;
    for(int j=0; j<N; j++){
      ll pos=(N+j-i)%N;//生成ポジション
      minbox[j]=min(minbox[j], Z[pos]);
      cost+=minbox[j];
    }
    cost+=i*x;
    ans=min(ans,cost);
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
function Main(input) {
	input = input.trim().split("\n").map(function(x) { return x.split(" ")});
	var N = parseInt(input[0][0], 10);
	var A = parseInt(input[1][0], 10);
	var B = parseInt(input[1][1], 10);
	var vec_P = input[2].map(e => parseInt(e, 10));
	var vec_ans = [0, 0, 0];
	for (var i = 0; i < N; i++){
		if (vec_P[i] <= A) vec_ans[0]++;
		else if (vec_P[i] <= B) vec_ans[1]++;
		else vec_ans[2]++;
	}
	console.log(Math.min(vec_ans[0], vec_ans[1], vec_ans[2]));
}

Main(require("fs").readFileSync("/dev/stdin", "utf8")); 

Measured memory_bytes: 29496
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,count=0;
  	cin>>n;
  	vector<int>a(n);
  	for(int i=0;i<n;i++)cin>>a[i];
  	if(n%2!=0)cout<<0<<endl;
  	else
    {
      sort(a.begin(),a.end());
      cout<<a[n/2]-a[(n/2)-1]<<endl;
    }
 return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<vector>
using namespace std;
int main(){
  int n,m,k,i,j;
  cin >> n >> k >> m;
  while(n+k+m!=0){
    int o=0;
    vector<int> v;
    for(i=1;i<=n;i++) v.push_back(i);
    int a=0,b=m-1,c;
    while(v.size()!=1){
      //cout << v[b] << endl;
      v.erase(v.begin()+b);
      b+=k-1;
      b=b%v.size();
    }
    cout << v[0] << endl;
    cin >> n >> k >> m;
  }
}

Measured memory_bytes: 1324
#include <iostream>
#include <cctype>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
using namespace std;

char a[52];

char decode(char c, int k)
{
  int x = 0;
  while(a[x] != c)
    x++;
  x -= k;
  while(x < 0)
    x += 52;
  return a[x];
}

int main()
{
  REP(i,26)
    a[i] = 'a' + i;
  FOR(i,26,52)
    a[i] = toupper(a[i-26]);
  while(1){
    int n;
    cin >> n;
    if(n == 0) break;
    int k[n];
    REP(i,n)
      cin >> k[i];
    string s;
    cin >> s;
    int x = 0;
    REP(i,(int)s.size()){
      s[i] = decode(s[i],k[x]);
      x++;
      x %= n;
    }
    cout << s << endl;
  }
}

Measured memory_bytes: 1208
// C
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
// #include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

using namespace std;
typedef long long int ll;
typedef unsigned long long ull;
typedef long double ld;
#define REP(i,n) for(ll i=0; i<(n); i++)
#define REPR(i, n) for(ll i = n;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define ALL(n) begin(n),end(n)
#define IN(a, x, b) (a<=x && x<b)
#define INIT std::ios::sync_with_stdio(false);std::cin.tie(0);
template<class T> inline T CHMAX(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T CHMIN(T & a, const T b) { return a = (a > b) ? b : a; }

const long double EPS = 1e-10;
const long long INF = 1e18;
const long double PI = acos(-1.0L);

int main(void){
    string sdush;
    string t;
    cin >> sdush;
    cin >> t;

    ll max_point=-1;
    REP(i, sdush.size()-t.size()+1){
        REP(j, t.size()){
            // cout << sdush[i+j] << " " << t[j] << endl;
            if( (sdush[i+j] != t[j]) && (sdush[i+j] != '?')){
                goto label_ng;
            }
        }
        max_point = i;
        label_ng:
            ll tmp =0;
    }

    if(max_point == -1){
        cout << "UNRESTORABLE" << endl;
    }else{
        REP(i, t.size()){
            sdush[max_point+i] = t[i];
        }
        REP(i, sdush.size()){
            if(sdush[i] == '?'){
                sdush[i] = 'a';
            }
        }
        cout << sdush << endl;
    }

    return 0;
}

Measured memory_bytes: 256
/* 
	Author: ankrypt
*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define MOD 1000000007
#define ll long long int
#define u64 unsigned long long int
#define ff first
#define ss second
#define all(x) x.begin(), x.end() 
#define ub upper_bound
#define lb lower_bound
#define MAX_INT 10000005
#define PI 3.141592653589793
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
#define go ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define fi(a, b, c, d) for(int a = b; a < c; a += d)
#define fl(a, b, c, d) for(ll a = b; a < c; a += d)
#define fei(a, b, c, d) for(int a = b; a <= c; a += d)
#define fel(a, b, c, d) for(ll a = b; a <= c; a += d)
#define quit exit(0)
#define mem(x, a) memset(x, a, sizeof x)
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pcl pair<char, ll>
#define psl pair<string, ll>


ll X, M, A, B, C;
ll arr[MAX_INT], arr1[MAX_INT], data[MAX_INT];
vector<ll> V;
unordered_map<ll, ll> mp;
set<ll> s;
string S = "";
ll cases;

const ll N = 10000000;
ll fact[MAX_INT];
ll invfact[MAX_INT];

ll modMul(ll A, ll B) {
	return (A * B) % MOD;
}

ll modSum(ll A, ll B) {
	return (A + B) % MOD;
}
ll modDiff(ll A, ll B) {
	return (A - B + MOD) % MOD;
}

ll modPow(ll a, ll b, ll m)
{
	ll ans=1;
	while(b)
	{
		if(b&1)
			ans=(ans*a)%m;
		b/=2;
		a=(a*a)%m;
	}
	return ans;
}

ll modInv(ll x) {
	return modPow(x, MOD - 2, MOD);
}

void precompute() {
	fact[0] = 1;
	fei(i, 1, N, 1) {
		fact[i] = modMul(fact[i - 1], i);
	}
	invfact[N] = modInv(fact[N]);
	for(int i = N - 1; i >= 0; i--) {
		invfact[i] = modMul(invfact[i + 1], i + 1);
	}
}

ll ncr(ll n, ll r) {
	if(n < r) {
		return 0;
	}
	ll ans = fact[n];
	ans = modMul(ans, invfact[r]);
	ans = modMul(ans, invfact[n - r]);
	return ans;
} 


int main() {
	go;
    cin >> X >> M;
    fi(i, 0, X, 1) {
    	cin >> arr[i];
    }
    ll ans = 0;
    sort(arr, arr + X);
    precompute();
    for(int i = X - M; i >= 0; i--) {
    	ans = modDiff(ans, modMul(arr[i], ncr(X - i - 1, M - 1)));
    }
    // trace1(ans);
    fi(i, M - 1, X, 1) {
    	ans = modSum(ans, modMul(arr[i], ncr(i, M - 1)));
    }
    // trace1(ans);
    cout << ans << "\n";

    
	return 0;
}
/*
	Powered by Buggy Plugin
*/




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

using namespace std;
using ll = long long;
using ld = long double;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define reps(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
const ll mod = ll(1e9) + 7;
const int INF = int(1e9);

int main() {
	cin.sync_with_stdio(false);
	int N;
	double T, A;
	cin >> N >> T >> A;
	vector<double>H(N);
	rep(i, N)cin >> H[i];
	int ans = 0;
	double tmp = 1e6;
	rep(i, N) {
		if (tmp > abs(A - (T-H[i]*0.006))) {
			ans = i + 1;
			tmp = abs(A - (T-H[i]*0.006));
		}
	}
	cout << ans << endl;
	return 0;

}

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

using namespace std;

const int INF = 1e9;

int cnt[200005];
char s[200005];

int main() {
	int n, k, c;
	scanf("%d%d%d", &n, &k, &c);
	
	scanf("%s", s);
	
	vector <int> left;
	int cur = -INF;
	
	for (int i = 0; i < n; i++) {
		if (s[i] == 'x') continue;
		if (i - cur <= c) continue;
		left.push_back(i);
		cur = i;
	}
	
	vector <int> right;
	cur = INF;
	
	for (int i = n - 1; i >= 0; i--) {
		if (s[i] == 'x') continue;
		if (cur - i <= c) continue;
		right.push_back(i);
		cur = i;
	}
	
	if (left.size() != k) return 0;
	
	for (int i = 0; i < left.size(); i++) cnt[left[i]]++;
	for (int i = 0; i < right.size(); i++) cnt[right[i]]++;
	
	for (int i = 0; i < n; i++) {
		if (cnt[i] == 2) printf("%d\n", i + 1);
	}
}


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

int main(void) {
	int n, q, *T, *S, i, j;
	scanf("%d", &n);
	T = new int[n+1];
	for (i = 0; i < n; i++) {
		scanf("%d", &T[i]);
	}
	scanf("%d", &q);
	S = new int[q+1];
	for (i = 0; i < q; i++) {
		scanf("%d", &S[i]);
	}
	int count = 0;
	for (i = 0; i < q; i++) {
		T[n] = S[i];
		for (j = 0; T[j] != S[i]; j++);
		if (j != n)
			count++;
	}
	printf("%d\n", count);
}


Measured memory_bytes: 3228
while True:
    n = int(input())
    if n == 0:
        break
    matrix = [list(map(int, input().split())) for _ in range(n)]
    for i in range(n):
        sum_ = sum(matrix[i])
        print(str("{:>5d}" * (n+1)).format(*matrix[i], sum_))
    sum_ = [sum(e) for e in list(zip(*matrix))]
    print(str("{:>5d}" * (n+1)).format(*sum_, sum(sum_)))



Measured memory_bytes: 5620
#include <bits/stdc++.h> // Include every standard library
using namespace std;
#define sqr(x) ((LL)(x) * (x))
#define RESET(a, b) memset(a, b, sizeof(a))
#define ALLA(arr, sz) arr, arr + sz
#define REVERSE(v) reverse(ALL(v))
#define SORTA(arr, sz) sort(ALLA(arr, sz))
#define REVERSEA(arr, sz) reverse(ALLA(arr, sz))
#define TC(t) while (t--)
#define ms(s, n) memset(s, n, sizeof(s))
#define FORall(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define size(a) int((a).size())
#define present(t, x) (t.find(x) != t.end())
#define all(a) (a).begin(), (a).end()
#define uni(a) (a).erase(unique(all(a)), (a).end())
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define prec(n) fixed << setprecision(n)
#define bit(n, i) (((n) >> (i)) & 1)
#define bitcount(n) __builtin_popcountll(n)
#define IOS                  \
    ios::sync_with_stdio(0); \
    cin.tie(0);              \
    cout.tie(0);
typedef long long int ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pi> vii;
typedef vector<vi> vvi;
const int MOD = (int)1e9 + 7;
const int MOD2 = MOD + 2; //1007681537;
const int INF = (int)1e9;
const ll LINF = (ll)1e18;
const ld PI = acos((ld)-1);
const ld EPS = 1e-9;

vi graph[100005];
bool visited[100005];
int deg[100005]; //deg[v]= no of edges going into node v. 
int dist[1000005];

void dfs(int v) {
    visited[v] = 1;
    for (int a : graph[v]) {
        dist[a] = max(dist[a], dist[v] + 1);
        deg[a]--;
        if(deg[a]==0)
            dfs(a);
    }
}

int main()
{
    IOS;
    int n, m;
    scanf("%d%d", &n, &m);
    while (m--){
        int x,y;
        scanf("%d%d", &x, &y);
        graph[x].pb(y);
        deg[y]++;
    }
    for (int a = 1; a <=n; a++) {
        if (visited[a] == 0 && deg[a] == 0)
            dfs(a);
    }
    int res = 0;
    for (int a = 1; a <= n; a++)
        res = max(res, dist[a]);
    printf("%d", res);
}


Measured memory_bytes: 14772
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
using Graph = vector<vector<int>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Rep(i, k, n) for (int i = k; i < (int)(n); i++)
#define RRep(i, k, n) for (int i = k; i > (int)(n); i--)
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define ALL(a)  (a).begin(),(a).end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
const int MOD = 1000000007;
const double PI = acos(-1); //3.14~
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int main()
{
    ll n; cin >> n;
    vector<ll> a(5);
    ll mi = INF;
    rep(i, 5) cin >> a[i], mi = min(mi, a[i]);

    ll ans = ceil((double)n / (double)mi) + 4;
    cout << ans << endl;
    // COUT((double)(n / mi));
    // cout << fixed << setprecision(10) << ceil((double)(5.0 / 2.0)) << endl;
}

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

int main(){
  int w,h;
  cin>>w>>h;
  string c;
  cin>>c;
  for(int i=1;i<=h;i++){
    for(int j=1;j<=w;j++){
      if(i==1 || i==h){
	if(j==1 || j==w){
	  cout<<"+";
	}
	else{
	  cout<<"-";
	}
      }
      else if(j==1 || j==w){
	cout<<"|";
      }
      else if(i==(h+1)/2 && j==(w+1)/2){
	cout<<c;
      }
      else {
	cout<<".";
      }
    }cout<<endl;
  }
  return 0;
}
   
 
      
 
  
   
  
	
	  
	  
	  
	  
	  
	  
     
  
  
  
  
  

  

 
  


 

    
  



Measured memory_bytes: 3172
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
 
using namespace std;
 
#define PB push_back
#define MP make_pairA
#define REP(i,n) for(int i=0;i<(n);i++)
int main()
{
    int n,d;
    cin>>n>>d;
    cout<<(n+d*2)/(d*2+1)<<endl;
}


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

int main() {
  string s;
  cin >> s;
  
  int count = 0;
  for (char c = 'a'; c <= 'c'; c++) {
    if (c == s[0]) {
      count++;
      continue;
    }
    if (c == s[1]) {
      count++;
      continue;
    }
    if (c == s[2]) {
      count ++;
      continue;
    }
  }
  if (count == 3) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Comparator;
import java.util.StringTokenizer;

class Main{

	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}

	static int[] f = new int[1000001];
	static long ans = 0;

	public static void main(String[] args) {
		FastReader sc = new FastReader();
		int n = sc.nextInt();
		System.out.println(n%2==0?(n/2*n/2):((n/2)*(n/2+1)));
	}
}

Measured memory_bytes: 25428
package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func next() string {
	sc.Scan()
	return sc.Text()
}
func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}
func nextInts(n int) []int {
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}
func nextInt64() int64 {
	a, _ := strconv.ParseInt(next(), 10, 64)
	return a
}
func readLine(reader *bufio.Reader) string {
	str, _, err := reader.ReadLine()
	if err == io.EOF {
		return ""
	}
	return string(str)
}

func round(f float64) float64 {
	return math.Floor(f + .5)
}

func main() {
	defer out.Flush()
	sc.Split(bufio.ScanWords)
	k := nextInt()
	a := nextInt()
	b := nextInt()
	for i := 0; i*k <= b; i++ {
		target := i * k
		if target >= a && target <= b {
			fmt.Fprintln(out, fmt.Sprint("OK"))
			return
		}
	}
	fmt.Fprintln(out, fmt.Sprint("NG"))
}


Measured memory_bytes: 1764
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000000007
#define Nmax 200010
#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,n)  FOR(i,0,n)
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
typedef long long ll;

int main() {
	int N;
	ll a[Nmax]={};
	cin >> N;
	cin >> a[0];
	FOR(i,1,N){
		cin >> a[i];
		a[i]+=a[i-1];
	}
	ll mina=MOD;
	REP(i,N-1) mina=min(mina,abs(a[i]-(a[N-1]-a[i])));
	cout << mina << endl;
	
	return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i,n) for(ll i=0;i<n;i++)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define fi first
#define se second
#define endl "\n"

template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){int len=d.size();rep(i,len){s<<d[i];if(i<len-1) s<<" ";}return s;}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){int len=d.size();rep(i,len){s<<d[i]<<endl;}return s;}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){s<<"{"<<endl;for(auto itr=m.begin();itr!=m.end();++itr){s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;}s<<"}"<<endl;return s;}

const ll mod=1e9+7;
const ll inf=1e17;
const int INF=1e9;
const double PI=acos(-1);
const double EPS=1e-10;

int main(){
	cin.tie(0);ios::sync_with_stdio(false);
	double r;
	cin>>r;
	cout<<setprecision(10)<<2*PI*r<<endl;
}

Measured memory_bytes: 3816