akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=5e18;

ll h,w;
vector<string> a;
const ll MAX_V=200;
const ll MAX=20;

ll sum[MAX_V][MAX_V];
ll dp1[MAX_V][MAX_V][MAX_V][2];
ll dp2[MAX_V][MAX_V][MAX_V][2];

ll solve() {
  sum[0][0]=0;
  for(ll i=0;i<h;i++) {
    for(ll j=0;j<w;j++) {
      sum[i+1][j+1]=-sum[i][j]+sum[i+1][j]+sum[i][j+1]+(a[i][j]=='#');
    }
  }
  for(ll h1=0;h1<=h;h1++) {
    for(ll h2=h1;h2<=h;h2++) {
      ll w2=0;
      for(ll w1=0;w1<=w;w1++) {
        if(w2<w1) w2=w1;
        while (w2<w&&
          (sum[h2][w2+1]-sum[h1][w2+1]-sum[h2][w1]+sum[h1][w1] == 0 ||
          sum[h2][w2+1]-sum[h1][w2+1]-sum[h2][w1]+sum[h1][w1] == (h2-h1)*(w2+1-w1))) {
          w2++;
        }
        dp1[h1][h2][w1][0] = w2;
      }
    }
  }

  for(ll w1=0;w1<=w;w1++) {
    for(ll w2=w1;w2<=w;w2++) {
      ll h2=0;
      for(ll h1=0;h1<=h;h1++) {
        if(h2<h1) h2=h1;
        while(h2<h&&
          (sum[h2+1][w2]-sum[h1][w2]-sum[h2+1][w1]+sum[h1][w1] == 0 ||
          sum[h2+1][w2]-sum[h1][w2]-sum[h2+1][w1]+sum[h1][w1] == (h2+1-h1)*(w2-w1))) {
          h2++;
        }
        dp2[h1][w1][w2][0] = h2;
      }
    }
  }

  ll res=MAX;
  for(ll k=0;k+1<MAX;k++) {
    for(ll h1=0;h1<=h;h1++) {
      for(ll h2=h1;h2<=h;h2++) {
        for(ll w1=0;w1<=w;w1++) {
          ll w2=dp1[h1][h2][w1][k%2];
          dp1[h1][h2][w1][(k+1)%2]=max(dp1[h1][h2][w1][(k+1)%2],dp1[h1][h2][w2][k%2]);
        }
        ll w2=0;
        for(ll w1=0;w1<=w;w1++) {
          if(w2<w1) w2=w1;
          while(w2<w&&dp2[dp2[h1][w1][w2+1][k%2]][w1][w2+1][k%2]>=h2) {
            w2++;
          }
          dp1[h1][h2][w1][(k+1)%2]=max(dp1[h1][h2][w1][(k+1)%2],w2);
        }
      }
    }

    for(ll w1=0;w1<=w;w1++) {
      for(ll w2=0;w2<=w;w2++) {
        for(ll h1=0;h1<=h;h1++) {
          ll h2=dp2[h1][w1][w2][k%2];
          dp2[h1][w1][w2][(k+1)%2]=max(dp2[h1][w1][w2][(k+1)%2], dp2[h2][w1][w2][k%2]);
        }
        ll h2=0;
        for(ll h1=0;h1<=h;h1++) {
          if(h2<h1) h2=h1;
          while(h2<h&&dp1[h1][h2+1][dp1[h1][h2+1][w1][k%2]][k%2]>=w2) {
            h2++;
          }
          dp2[h1][w1][w2][(k+1)%2]=max(dp2[h1][w1][w2][(k+1)%2], h2);
        }
      }
    }

    if(dp1[0][h][0][k%2]==w) res=min(res,k);
    if(dp2[0][0][w][k%2]==h) res=min(res,k);

    for(ll x=0;x<MAX_V;x++) {
      for(ll y=0;y<MAX_V;y++) {
        for(ll z=0;z<MAX_V;z++) {
          dp1[x][y][z][k%2]=0;
          dp2[x][y][z][k%2]=0;
        }
      }
    }
  }
  return res;
}

int main() {
  cin >> h >> w;
  for(ll i=0;i<h;i++) {
    string s;
    cin >> s;
    a.push_back(s);
  }
  cout << solve() << endl;
}

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

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

  for (int i = 0; i < N; ++i) {
  	int l, r;
    cin >> l >> r;
	sum += (r - l + 1);
  }
  cout << sum << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<numeric>
#define int long long
#define ld long double
#define all(x) x.begin(),x.end()
const int maxn=1000000;
#define what_is(x) cerr << #x << " is " << x << endl;
const int MOD = 1e9 + 7;
using namespace std;
string abc="abcdefghijklmnopqrstuvwxyz";
int powmod(int a, int b, int MOD = MOD){
    if(!a and !b)    return 1ll;
    if(!a)    return a;
    int res = 1ll;
    b %= (MOD - 1ll), a %= MOD;
    while(b){
        if(b%2 == 1)    res = (res * a) % MOD;
        a = (a * a) % MOD;
        b /= 2;
    }
    return res;
}
int popcount(uint32_t n)
{
    n = n - ((n >> 1) & 0x55555555);
    n = (n & 0x33333333) + ((n >> 2) & 0x33333333);
    return ((n + (n >> 4) & 0xF0F0F0F) * 0x1010101) >> 24;
}
bool check(int n) {return (((double)sqrt(n)-floor((double)sqrt(n)))==0);}
vector<bool> sieve(maxn + 1, true);
void fillprime() {
    sieve[0] = sieve[1] = false;
    for (int i = 2; i <= maxn; ++i) {
        if (sieve[i] && (int) i * i <= maxn) {
            for (int j = i * i; j <= maxn; j += i) {
                sieve[j] = false;
            }
        }
    }
}
const int nn=1e5+5;

void solve() {
     int n;
     cin>>n;
     int arr[n];
     int sum[n];
     for(int i=0;i<n;++i){
         cin>>arr[i];
         if(i>0){
             sum[i]=sum[i-1]+arr[i];
         }
         else sum[i]=arr[i];
     }
     int minm=INT_MAX;
     for(int i=0;i<n;++i){
         minm=min(minm,abs((sum[n-1]-sum[i])-sum[i]));
     }
     cout<<minm;
}
int32_t main() {
    ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
    //fillprime();

    //int t;cin>>t;while(t--)
        solve();
}

Measured memory_bytes: 3808
S=input()
T=S.replace("x","")
if all(s==t for s,t in zip(T,T[::-1])):
    ans=0
    i=0
    j=len(S)-1
    while i<j:
        pi=i
        pj=j
        while i<len(S) and S[i]=="x":
            i+=1
        while j>=0 and S[j]=="x":
            j-=1
        if i>j:
            break
        ans+=abs(i-pi-pj+j)
        i+=1
        j-=1
    print(ans)
else:
    print(-1)

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

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

  map<int, int> m;
  for (int i=0; i<n; i++) {
    int a;
    cin>>a;
    if (i == 0) {
      ++m[a];
      continue;
    }
    auto it = m.lower_bound(a);
    if (it == m.end()) {
      --it;
      int k = (*it).first;
      --m[k];
      if (m[k] == 0) {
        m.erase(k);
      }
      ++m[a];
    } else if (it == m.begin()) {
      ++m[a];
    } else {
      --it;
      int k = (*it).first;
      --m[k];
      if (m[k] == 0) {
        m.erase(k);
      }
      ++m[a];
    }
  }

  int cnt = 0;
  for (auto mi: m) {
    cnt += mi.second;
  }
  cout<<cnt<<endl;
}

Measured memory_bytes: 4864
macro_rules !input {(source =$s :expr ,$($r :tt ) *) =>{let mut iter =$s .split_whitespace () ;let mut next =||{iter .next () .unwrap () } ;input_inner !{next ,$($r ) *} } ;($($r :tt ) *) =>{let stdin =std ::io ::stdin () ;let mut bytes =std ::io ::Read ::bytes (std ::io ::BufReader ::new (stdin .lock () ) ) ;let mut next =move ||->String {bytes .by_ref () .map (|r |r .unwrap () as char ) .skip_while (|c |c .is_whitespace () ) .take_while (|c |!c .is_whitespace () ) .collect () } ;input_inner !{next ,$($r ) *} } ;}
macro_rules !input_inner {($next :expr ) =>{} ;($next :expr ,) =>{} ;($next :expr ,$var :ident :$t :tt $($r :tt ) *) =>{let $var =read_value !($next ,$t ) ;input_inner !{$next $($r ) *} } ;}
macro_rules !read_value {($next :expr ,($($t :tt ) ,*) ) =>{($(read_value !($next ,$t ) ) ,*) } ;($next :expr ,[$t :tt ;$len :expr ] ) =>{(0 ..$len ) .map (|_ |read_value !($next ,$t ) ) .collect ::<Vec <_ >>() } ;($next :expr ,chars ) =>{read_value !($next ,String ) .chars () .collect ::<Vec <char >>() } ;($next :expr ,usize1 ) =>{read_value !($next ,usize ) -1 } ;($next :expr ,$t :ty ) =>{$next () .parse ::<$t >() .expect ("Parse error" ) } ;}

fn main() {
   input! {
      _s: String,
      _t: String,
   }
   let mut s = _s.as_bytes().to_vec();
   let t = _t.as_bytes().to_vec();
   if s.len() < t.len() {
      println!("UNRESTORABLE");
      return;
   }
   let mut pos = 0;
   for i in 0..s.len() - t.len() + 1 {
      if check(i, &s, &t) {
         pos = i;
      }
   }
   if pos == 0 && !check(0, &s, &t) {
      println!("UNRESTORABLE");
   } else {
      for i in pos..pos + t.len() {
         s[i] = t[i - pos];
      }
      for &c in s.iter() {
         if c == b'?' {
            print!("a");
         } else {
            print!("{}", c as char);
         }
      }
      println!("");
   }
}
fn check(a: usize, s: &Vec<u8>, t: &Vec<u8>) -> bool {
   let mut flag = true;
   for i in a..a + t.len() {
      if s[i] != b'?' && s[i] != t[i - a] {
         flag = false;
         break;
      }
   }
   flag
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep2(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep_inv(i, n, m) for(int i = (int)(n); i > (int)(m); i--)
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vc = vector<char>;
using vvl = vector<vl>;
using vvc = vector<vc>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;

ll N, A, B, C;

void dfs(vl leng, vl &gr, ll ind, ll &cost){
  if(ind == N){
    map<ll, ll> cnt;
    map<ll, ll> L;
    
    rep(i, N){
      cnt[gr[i]]++;
      L[gr[i]] += leng[i];
    }
    
    if((L[1] == 0) || (L[2] == 0) || (L[3] == 0)) return;

    ll val = 0;
    val += 10 * (cnt[1] + cnt[2] + cnt[3] - 3);
    val += abs(L[1] - A) + abs(L[2] - B) + abs(L[3] - C);
    cost = min(cost, val);

    return;
  }

  rep(i, 4){
    gr[ind] = i;
    dfs(leng, gr, ind + 1, cost);
    gr[ind] = 0;
  }

  return;
}

int main(){
  cin >> N >> A >> B >> C;
  vl leng(N);
  rep(i, N) cin >> leng[i];

  ll cost = (ll)pow(10, 10);
  vl gr(N, 0);

  dfs(leng, gr, 0, cost);

  cout << cost << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#define REP(i, a, n) for(ll i = ((ll) a); i < ((ll) n); i++)
using namespace std;
typedef long long ll;

ll N, X;

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

  ll ans = N;
  ll a = max(X, N - X);
  ll b = min(X, N - X);
  while(b != 0) {
    ans += b * (a / b) * 2;
    swap(a, b);
    b %= a;
  }
  ans -= a;

  cout << ans << endl;
}


Measured memory_bytes: 256
#ifdef DEBUG

#else

#    pragma GCC optimize("O3,no-stack-protector")
#    pragma GCC optimize("unroll-loops")

#    if __cplusplus < 201703L
#        pragma GCC target("avx")
#    else
#        pragma GCC target("avx2")
#    endif

#endif
// 実数の場合
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
typedef int64_t Int;
typedef long double Ld;

using namespace std;
using Graph = vector<vector<Int>>;

const double pi = M_PI;
const Int MOD = 1000000007;

map<Int, int> prime_factor(Int n) {
    map<Int, int> ret;
    for (Int i = 2; i * i <= n; i++) {
        while (n % i == 0) {
            ret[i]++;
            n /= i;
        }
    }
    if (n != 1)
        ret[n] = 1;
    return ret;
}

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

    Int n;
    cin >> n;

    vector<int> p;
    for (int i = 0; i < 41; i++) {
        p.push_back((i * (i + 1)) / 2);
    }

    map<Int, int> m = prime_factor(n);

    int ans = 0;
    for (auto [x, y] : m) {
        int r = 0;
        for (int i = 0; i < 41; i++) {
            if (y < p[i]) {
                r = max(0, i - 1);
                break;
            }
        }

        ans += r;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3660
from sys import stdin
nii=lambda:map(int,stdin.readline().split())

n,m=nii()

tree=[[] for i in range(n)]
for i in range(m):
  a,b=nii()
  a-=1
  b-=1
  tree[a].append(b)
  tree[b].append(a)

for i in tree[0]:
  for j in tree[i]:
    if j==n-1:
      print('POSSIBLE')
      exit()
print('IMPOSSIBLE')

Measured memory_bytes: 38320
//
//  atcoder.cpp
//
//
///
#include <bits/stdc++.h>
#include <boost/optional.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/bimap/bimap.hpp>
#include <boost/bimap/multiset_of.hpp>
#include <boost/multi_array.hpp>
#include <boost/math/common_factor.hpp>
#include <boost/algorithm/string.hpp>

#define REP(i, N) for(int i=0; i<(N); i++)
#define REC(f, ...) (void)0; const auto f = [&](const auto f, __VA_ARGS__)
using namespace std;
using namespace boost::math;

using ll = long long;
namespace bst = boost;
template<typename T> class in {
    T value;
public:
    in() { cin >> value; }
    operator const T&() const { return value; }
    operator T&() { return value; }
    in& operator=(T source) { value = source; return *this; }
};
template<> class in<string> : public string {
public:
    in() { cin >> *this; }
};
template<class T> class inseq : public T {
public:
    template<typename... Arg> inseq(Arg... arg) : T(forward<Arg>(arg)...) { for (auto&& i : *this) cin >> i; }
};
template<class T> using invec = inseq<vector<T>>;

auto solve() {
  in<ll> N, K;

  ll r = 0;
  
  
  if (K == 1) {
    r += N + 1;
    K = 2;
  }
  ll all = N, low = 0;
  for(ll i = 2; i < K; i++) {
    all = (all + (N - i + 1)) % 1000000007;
    low = (low + i - 1) % 1000000007;
  }
  for (ll i = K; i <= N + 1; i++) {
    all = all + (N - i + 1);
    low = (low + i - 1) % 1000000007;

    ll tmp = (all - low + 1 + 1000000007) % 1000000007;
    r = (r + tmp) % 1000000007;
  }

  return r;
}

template<typename T> void plot(const T& func) { cout << func() << endl; }
template<> void plot<void()>(void(&func)()) { func(); }
template<> void plot<double()>(double(&func)()) { cout << setprecision(9) << func() << endl; }

int main() {
  plot(solve);

  return 0;
}




Measured memory_bytes: 3640
let check_bingo board hits =
  let check_list = [[0;1;2]; [3;4;5]; [6;7;8]; [0;3;6]; [1;4;7]; [2;5;8]; [0;4;8]; [2;4;6]] in
  let rec get_cell board l cell_values =
    match l with
    | [] -> cell_values
    | x::xs ->
       get_cell board xs ((Array.get board x)::cell_values)
  in
  let is_bingo l hits = List.for_all (fun x -> (List.mem x hits)) l in
  let rec check_bingo_sub board l =
    match l with
    | [] -> "No"
    | x::xs ->
       let check_cell_list = get_cell board x [] in
       let result = is_bingo check_cell_list hits in
       if result then "Yes" else check_bingo_sub board xs
  in
  check_bingo_sub board check_list

let rec input_boards n board =
  match n with
  | 0 -> Array.of_list (List.rev board)
  | m ->
     let new_board = Scanf.sscanf (read_line ()) "%d %d %d" (fun a b c -> c :: b :: a :: board) in
     input_boards (m-1) new_board

let input_hits n hits =
  let rec input_hits_sub n hits =
    match n with
    | 0 -> hits
    | m ->
       let hit = Scanf.sscanf (read_line ()) "%d" (fun x -> x) in
       input_hits_sub (m-1) (hit::hits)
  in
  input_hits_sub n hits

let board = input_boards 3 []
let n_hit = Scanf.sscanf (read_line ()) "%d" (fun x -> x)
let hits  = input_hits n_hit []
let ans = check_bingo board hits
let () = print_endline ans


Measured memory_bytes: 384
#include <iostream>

using namespace std;

int main() {
	int A, B, C, X, Y;
	int c;
	int total, min;

	cin >> A >> B >> C >> X >> Y;

	min = 3 * 5000 * 100000;
	for (c = 0; c <= (X < Y ? X : Y); c++) {
		total = A * (X - c) + B * (Y - c) + 2 * C * c;
		if (min > total) {
			min = total;
		}
	}
	
	for (; c <= (X < Y ? Y : X); c++) {
		if (X < Y) {
			total = B * (Y - c) + 2 * C * c;
		} else {
			total = A * (X - c) + 2 * C * c;
		}

		if (min > total) {
			min = total;
		}
	}

	cout << min << endl;

	return 0;
}


Measured memory_bytes: 256
#if defined(LOCAL)
#define PROBLEM_NAME "a"
const double _max_double_error = 1e-9;
#include "testutils.h"
#define L(x...) (debug(x, #x))
#define C(x...) CHECK(x)
#else
#define L(x, ...) (x)
#define C(x, ...) ;
#include <bits/stdc++.h>
#endif

using namespace std;
using vi = vector<int>; using vvi = vector<vi>;
using ii = pair<int,int>; using vii = vector<ii>;
using l = long long; using vl = vector<l>; using vvl = vector<vl>;
using ll = pair<l,l>; using vll = vector<ll>; using vvll = vector<vll>;
using lu = unsigned long long;
using vb = vector<bool>; using vvb = vector<vb>;
using vd = vector<double>; using vvd = vector<vd>;
using mll = unordered_map<l, l>;
const l INF = numeric_limits<l>::max();
const double EPS = 1e-10; static constexpr auto PI = acos(-1);
const l e0=1, e3=1000, e5=100000, e6=10*e5, e7=10*e6, e8=10*e7, e9=10*e8;
const char lf = '\n';
#define all(x) begin(x), end(x)
#define F(a,b,c) for (l a = l(b); a < l(c); a++)
#define B(a,b,c) for (l a = l(c) - 1; a >= l(b); a--)
#define MAX(a,b)({__typeof__(a)__x=(a);__typeof__(b)__y=(b);__x<__y?__y:__x;})
#define MIN(a,b)({__typeof__(a)__x=(a);__typeof__(b)__y=(b);__x<__y?__x:__y;})

void solve(istream& cin, ostream& cout) {
  string s; cin >> s;
  bool ok = false;
  F(i, 0, s.size() - 1) {
    ok = ok or (s[i] == 'A' and s[i + 1] == 'C');
  }
  cout << (ok ? "Yes" : "No") << lf;
}

int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);
  cout << fixed << setprecision(15);
#if defined(LOCAL)
  // _generate_random_test = generate_random;
  // _solve_brute = solve_brute;
  // _player_b = player_b;
  // _custom_solution_checker = solution_checker;
  maybe_run_tests(cin, cout);
#else
  solve(cin, cout);
#endif
}


Measured memory_bytes: 256
N,M = map(int,raw_input().split())

data = [map(int,raw_input().split()) for i in xrange(N)]

data.sort()

cnt = 0
ans = 0
i = 0

while cnt < M:
    if data[i][1] + cnt < M:
        ans += data[i][1]*data[i][0]
        cnt += data[i][1]
    else:
        ans += data[i][0]*(M-cnt)
        break
    i += 1
print ans

Measured memory_bytes: 18876
#include <iostream>
#include <algorithm>
#include <fstream>
#include <vector>
#include <deque>
#include <assert.h>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <stdio.h>
#include <string.h>
#include <utility>
#include <math.h>
#include <bitset>
#include <iomanip>
#include <complex>
using namespace std;
//#define int long long
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef long double ld;
typedef long long ll;
#define X first
#define Y second
#define all(o) o.begin(), o.end()
#define endl '\n'
#define IOS ios::sync_with_stdio(0), cin.tie(0)
const int maxn = 3e5 + 10;
const int mod = 998244353;
int fact[maxn], inv[maxn];
inline int mu(int x,int y){
	return 1LL * x * y % mod;
}
inline int ad(int x,int y){
	return (x + y) % mod;
}
inline int bpow(int x,int y){
	int ans = 1;
	while(y){
		if(y & 1)
			ans = mu(ans, x);
		x = mu(x, x);
		y >>= 1;
	}
	return ans;
}
void prep(){
	for(int i=0; i<maxn; i++)
		fact[i] = (!i ? 1 : mu(i, fact[i-1]));
	for(int i=0; i<maxn; i++)
		inv[i] = bpow(fact[i], mod - 2);
}
inline int C(int r,int n){
	if(r < 0 || r > n || n < 0) return 0;
	return mu(fact[n], mu(inv[r], inv[n-r]));
}
int32_t main(){
	IOS;
	prep();
	//cout << C(5, 10) << endl;
	//cout << fact[3] << endl;
	ll n, a, b, k;
	cin >> n >> a >> b >> k;
	int ans = 0;
	for(int i=0; i<=n; i++){
		ll rem = k - a * i;
		if(rem % b || rem < 0) continue;
		if(rem < b > n) continue;
		int z1 = C(i, n);
		int z2 = C(rem/b, n);
		ans = ad(ans, mu(z1, z2));
	}
	cout << ans << endl;
}

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

using namespace std;
using ll = long long int;

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

int main(){
    ll N,X;
    cin>>N>>X;
    vector<ll> x(N);
    for(int i=0;i<N;i++)cin>>x[i];
    
    vector<ll> distance(N);
    for(int i=0;i<N;i++){
        distance[i]=(ll)abs(X-x[i]);
    }
    
    ll ans=0;
    for(int i=0;i<N;i++){
        ans=GCD(ans,distance[i]);
    }
    
    cout<<ans<<endl;
    
    
    
    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const ll mod = 1000000007;
const int INF = 1001001001;

int main(){
    ll a,b; cin >> a >> b;
    ll c = __gcd(a,b);
    ll ans = 1, d = c;
    for(int i=2;i<=1e6;i++){
        if(c%i!=0) continue;
        while(c%i==0){
            c /= i;
        }
        ans++;
    }
    if(c!=1) ans++;
    cout << ans << endl;
}


Measured memory_bytes: 256
import numpy as np

def main():
	n,a,b,c=map(int,input().split())
	l=[]
	for i in range(n):
		l.append(int(input()))
	
	key=[[0],[1],[2],[3]]
	key_4=key[:]
	for i in range(n-1):
		temp=[]
		for elem1 in key:
			for elem2 in key_4:
				temp.append(elem1+elem2)
		key=temp[:]

	res=10**9
	for elem in key:
		res=min(res,judge(elem,l,a,b,c))
	print(res)
	
def judge(key,l,a,b,c):
	num=[0,0,0,0]
	array=[0,0,0,0]
	for i in range(len(key)):
		array[key[i]]+=l[i]
		num[key[i]]+=1
	if(num[0]==0 or num[1]==0 or num[2]==0):
		return 10**9
	result=0
	result=abs(array[0]-a)+abs(array[1]-b)+abs(array[2]-c)
	result+=(num[0]+num[1]+num[2]-3)*10

	return result

def inputList():
	a=list(map(int,input().split()))
	return a

def multisort(li,index):
	return sorted(li,key=lambda x: x[index])

if(__name__=='__main__'):
	main()


Measured memory_bytes: 24452
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author champon
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 9e18
#define ceill(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
#define sp << " " <<
ll mod = 1e9+7;
void ans(bool b, ostream& out=cout){ out << (b ? "Yes" : "No") << endl; }
void ans2(bool b, ostream& out=cout){ out << (b ? "YES" : "NO") << endl; }
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(b<a){a=b; return true;} return false; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val){fill((T*)array, (T*)(array+N), val);}
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};

#ifndef INCLUDE_DEBUG_HPP
#define INCLUDE_DEBUG_HPP

class debug
{
public:
    template<typename T> void vdeb(T vec);
    template<typename T1, typename T2> void adeb(T1 *arr, T2 n);
    template<typename T> void mdeb(T mp);
};

#endif //INCLUDE_DEBUG_HPP

template<typename T> void debug::vdeb(T vec)
{
    cout << "#vector set debug" << endl;
    for(auto vv : vec) cout << vv << " ";
    cout << endl;
}

template<typename T1, typename T2> void debug::adeb(T1 *arr, T2 n)
{
    cout << "#adebug" << endl;
    for(int i=0; i<=n; i++) cout << arr[i] << " ";
    cout << endl;
}

template<typename T> void debug::mdeb(T mp)
{
    cout << "#map pair debug" << endl;
    for(auto const& m : mp) cout << m.first sp m.second << endl;
}
debug dbg;

class BFrog2 {
public:
	void solve(std::istream& in, std::ostream& out)
	{
	    int n, k;
	    in >> n >> k;
	    vector<int> h(n);
	    for(int i=0; i<n; i++){
	        in >> h[i];
	    }

	    vector<ll> dp(n, inf);
	    dp[0] = 0;
	    for(int i=0; i<n; i++){
	        for(int j=1; j<=k; j++){
	            if(i+j < n) chmin(dp[i+j], dp[i]+abs(h[i+j] - h[i]));
	        }
	    }

	    out << dp[n-1] << endl;
	}
};


int main() {
	BFrog2 solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


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

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            int X = int.Parse(Console.ReadLine());

            while(true)
            {
                bool isNotPrime = false;

                for(int i = 2; i < Math.Sqrt(X); i++)
                {
                    if(X % i == 0)
                    {
                        isNotPrime = true;
                        break;
                    }
                }

                if(!isNotPrime)
                {
                    break;
                }

                X++;
            }

            Console.WriteLine(X);
        }
    }
}


Measured memory_bytes: 11092
#include <iostream>
#include <algorithm>
#include <vector>

int main() {
    int N, K, temp;
    std::cin >> N >> K;
    
    std::vector<int> l;
    for (int i=0; i<N; ++i) {
        std::cin >> temp;
        l.push_back(temp);
    }
    
    std::sort(l.begin(), l.end());
    
    int ans = 0;
    while (K > 0) {
        ans += l.back();
        l.pop_back();
        K--;
    }
    
    std::cout << ans << std::endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
typedef long long int lli;

int main() {
    int N, A, B;
    cin >> N >> A >> B;
    string S;
    cin >> S;
    int rank_A = 0;
    int rank_B = 0;
    for (int i = 0; i < N; i++) {
        if ((rank_A + rank_B) >= A + B) {
            cout << "No" << endl;
        } else if (S[i] == 'a') {
            cout << "Yes" << endl;
            rank_A++;
        } else if (S[i] == 'b') {
            if (rank_B < B) {
                cout << "Yes" << endl;
                rank_B++;
            } else {
                cout << "No" << endl;
            }
        } else if (S[i] == 'c') {
            cout << "No" << endl;
        }
    }
    return 0;
}



Measured memory_bytes: 3768
N = gets.to_i
as = [0]
as += gets.split.map(&:to_i)

sum  = 0
for i in 1..N do
  sum += (as[i] - as[i-1]).abs
end
sum += as[i].abs

for i in 1..N do
  if i == N
    puts sum - (as[i] - as[i-1]).abs - as[i].abs + as[i-1].abs
  else
    puts sum - (as[i] - as[i-1]).abs - (as[i+1] - as[i]).abs + (as[i+1] - as[i-1]).abs
  end
end


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

int main(int argc, char *argv[])
{
    char X;
    char Y;

    std::cin >> X >> Y;
    if (X > Y) {
        std::cout << '>' << std::endl;
    } else if (X < Y) {
        std::cout << '<' << std::endl;
    } else {
        std::cout << '=' << std::endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007LL
void dfs(int i,int last);
int n;
vector<int>node[100009];
long long dp[100009][3];

int main(){
  cin>>n;
  for(int i=0;i<n-1;i++){
    int x,y;
    cin>>x>>y;
    node[x].push_back(y);
    node[y].push_back(x);
  }

  dfs(1,0);

  cout<<(dp[1][0]+dp[1][1])%mod<<endl;
  return(0);
}

void dfs(int i,int last){
  dp[i][0]=dp[i][1]=1;
  for(int j=0;j<node[i].size();j++){
    int next=node[i][j];
    if(next==last)continue;
    dfs(next,i);
    dp[i][0]*=dp[next][0]+dp[next][1];
    dp[i][1]*=dp[next][0];
    dp[i][0]%=mod;
    dp[i][1]%=mod;
  }
}


Measured memory_bytes: 14976
#include <iostream>
#include <cstring>
#include <map>
#include <cmath>
#include <algorithm>
#include <string>
using namespace std;
int64_t max(int64_t a, int64_t b)
{
  if (a > b)
    return a;
  else
    return b;
}
int64_t min(int64_t a, int64_t b)
{
  if (a < b)
    return a;
  else
    return b;
}
void abc83d()
{
  string S;
  cin >> S;
  int64_t m = S.length();
  for (int i = 1; i < S.length(); i++)
  {
    if (S[i] != S[i - 1])
    {
      m = min(m, max(i, S.length() - i));
    }
  }
  cout << m;
}
int main(void)
{
  abc83d();
  return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define SORT(x) sort(x.begin(),x.end())
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
#define No cout<<"No"<<endl
#define Yes cout<<"Yes"<<endl
#define NO cout<<"NO"<<endl
#define YES cout<<"YES"<<endl;
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main(){
    int n;
    cin>>n;
    int f[n][10];ll p[n][11];
    rep(i,n){
        rep(j,10){
            cin>>f[i][j];
        }
    }
    rep(i,n){
        rep(j,11){
            cin>>p[i][j];
        }
    }
    ll ans=-LINF;
    for(int bit=0;bit<(1<<10);bit++){
        ll tmp=0;
        bool flag=false;
        for(int i=0;i<n;i++){
            int c=0;
            for(int j=0;j<10;j++){
                if(bit&(1<<j)){
                    c+=f[i][j];
                }
            }
            if(c>0) flag=true;
            tmp+=p[i][c];
        }
        if(flag)
        ans=max(ans,tmp);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
#define vv(T) vector<vector<T>>
using namespace std;
using ll = long long;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using vll = vector<long long>;
using vvll = vector<vector<long long>>;
using vbool = vector<bool>;
using vvbool = vector<vector<bool>>;
using qint = queue<int>;
using sint = stack<int>;
using pii = pair<int, int>;


int main(){
    int n;
    cin >> n;
    vector<long long> a(n);
    rep(i, n){
        cin >> a[i];
        if(a[i] == 0){
            cout << 0 << endl;
            return 0;
        }
    }

    long long ans = 1;
    const long long LIMIT = 1e18;

    rep(i, n){
        // long long tmp = ans;
        // ans *= a[i];
        // long long t1 = ans / a[i];
        // if(t1 != tmp or ans > LIMIT){
        //     cout << -1 << endl;
        //     return 0;
        // }
        long long tmp = LIMIT / ans;
        tmp++;
        // if(a[i] > tmp){
        //     cout << -1 << endl;
        //     return 0;
        // }
        ans *= a[i];
        if(ans > LIMIT || a[i] > tmp){
            cout << -1 << endl;
            return 0;
        }
    }

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 4060
from collections import defaultdict, deque
from heapq import heappop, heappush
import sys
input = sys.stdin.readline

N, M, P = map(int, input().split())
d = defaultdict(list)
e = defaultdict(list)
cd = defaultdict(list)
l = []

for _ in range(M):
    a, b, c = map(int, input().split())
    cd[a].append((b, P-c))
    d[a].append(b)
    e[b].append(a)

def check_visited(d, start):
    visited = [False]*(N+1)
    visited[start] = True
    q = deque([start])
    while q:
        s = q.popleft()
        for t in d[s]:
            if visited[t]:continue
            visited[t] = True
            q.append(t)
    
    s = set()
    for i in range(1, N+1):
        if visited[i]:
            s.add(i)
    return s

def shortest_path(s):
    INF = 10**18
    dist = [float("inf")]*(N+1)
    dist[s] = 0

    for i in range(N):
        for a, b, c in l:
            if dist[b]>dist[a]+c:
                dist[b] = dist[a]+c
                if i==N-1:
                    return dist, True
    return dist, False

add_l = check_visited(d, 1)&check_visited(e, N)
for a in add_l:
    for b, c in cd[a]:
        l.append((a, b, c))
d1, neg = shortest_path(1)
print(-1 if neg else max(0, -d1[N]))


Measured memory_bytes: 49888
module app;

import core.bitop;

import std.algorithm;
import std.array;
import std.bigint;
import std.conv;
import std.stdio;
import std.string;

struct Input
{
	int n;
	int[] a;
}

void parseInput(T)(out Input input, T file)
{
	with (file) with (input)
	{
		n = readln().strip().to!int;
		a = readln().strip().split().map!(a=>a.to!int).array;
	}
}

struct Output
{
}

void main2(Input* input)
{
	struct Shusseki
	{
		int no;
		int order;
	}

	Shusseki[] array;
	array.length = input.n;
	foreach (int no, order; input.a)
	{
		array[no].no = no + 1;
		array[no].order = order;
	}

	array.sort!((s1, s2)=>s1.order<s2.order);

	foreach (a; array)
		writef("%d ", a.no);
}

void parseExample(out Input input, string example)
{
	struct Adapter
	{
		string[] _lines;
		this(string input) { _lines = input.splitLines(); }
		string readln() { auto line = _lines[0]; _lines = _lines[1..$]; return line; }
	}
	parseInput(input, Adapter(example));
}

void main()
{
	Input input = void;
	parseInput(input, stdin);
	main2(&input);
}


Measured memory_bytes: 4668
N, Q = map(int, input().split())
S = input()

S = ['X'] + list(S)
count = [0]*(N+1)

for i in range(1, N+1):
  if S[i-1] == 'A' and S[i] == 'C':
    count[i] = count[i-1] + 1
  else:
    count[i] = count[i-1]

for _ in range(Q):
  l, r = map(int, input().split())
  print(count[r]-count[l])

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

using namespace std;

#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()
#define endl "\n"

#define aim_cpo do{ios::sync_with_stdio(false);\
cin.tie(nullptr);cout.precision(10);cout<<fixed;}while(0)

#define LOCAL_INPUT do{FILE *stream1;\
stream1=freopen("/Users/aim_cpo/CLionProjects/competitive/in.txt","r",stdin);\
if(stream1==nullptr)return 0;}while(0)

#define LOCAL_OUTPUT do{FILE *stream2;\
stream2 = freopen("out.txt", "w", stdout);\
if (stream2 == nullptr) return 0;}while(0)

#ifdef LOCAL_DEFINE
#define show(x) cerr << #x << " = " << x << endl
#else
#define show(x)
#endif

typedef long long ll;
typedef unsigned long long ull;

constexpr const int INT_INF=0x3f3f3f3f; // 1061109567
constexpr const ll LL_INF=0x3f3f3f3f3f3f3f3f; // 4557430888798830399

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

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

// INT
#define GCD(a, b) __gcd(a, b)
template <typename T> T LCM(T a, T b) {return a / GCD(a, b) * b;}
template <typename T> T EXTGCD(T a, T b, T& x, T& y) {
    T d = a;
    if (b != 0) {d=EXTGCD(b,a%b,y,x);y-=(a/b)*x;}
    else x=1,y=0;
    return d;
}
template <typename T> bool is_prime(T a) {
    for(int i=2;i*i<=a;i++)if(a%i==0)return 1;
    return 0;
}

// MOD
const ll MOD = (ll)1e9 + 7;
#define add(a, b) ((a % MOD) + (b % MOD)) % MOD
#define mul(a, b) ((a % MOD) * (b % MOD)) % MOD
#define sub(a, b) ((a % MOD) + MOD - (b % MOD)) % MOD
template <typename T> T mod_inverse(T a, T mod, bool prime){ // if mod is prime, "prime" is true.
    if(prime){
        T tmp=mod-2,now=a,res=1;while(tmp){if(tmp&1)res=mul(res,now);now=mul(now,now);tmp>>=1;}
        return res;
    }else{T x,y;EXTGCD(a,mod,x,y);return (mod+x%mod)%mod;}
}
#define divide(a, b) ((a % MOD) * (mod_inverse(b, MOD, true))) % MOD

//LLの数値をつかう時は最後にLをつける癖をつけよう
//
//  ┏┓┏┓　┓　┏┓
//  ┏┛┃┃　┃　┗┫
//  ┗┛┗┛　┻　┗┛
//
//   謹┃賀┃新┃年┃
//   ━┛━┛━┛━┛
//WWWWWWWWWWWWWWWWWWWWWW

int n, k;
ll a[100001];
ll b[100001];
ll c[100001];
ll dp[100001][3];

int main() {
    aim_cpo; // インタラクティブのときは消すように.
#ifdef LOCAL_DEFINE
    LOCAL_INPUT; // インタラクティブのときは消すように.
//    LOCAL_OUTPUT; // ファイルに出力したいときのみ
    show(MOD);
#endif
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> a[i] >> b[i] >> c[i];
    }
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < 3; j++) {
            if (j != 0) dp[i + 1][0] = max(dp[i + 1][0], dp[i][j] + a[i]);
            if (j != 1) dp[i + 1][1] = max(dp[i + 1][1], dp[i][j] + b[i]);
            if (j != 2) dp[i + 1][2] = max(dp[i + 1][2], dp[i][j] + c[i]);
        }
    }
    ll ans = 0;
    for (int i = 0; i < 3; i++) {
        chmax(ans, dp[n][i]);
    }
    cout << ans << endl;
#ifdef  LOCAL_DEFINE
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << "s." << endl;
#endif
    return 0;
}

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

int main(){
    int S[10000] = {0};
    int T[500] = {0};
    int n = 0;
    int q = 0;
    
    cin >> n;
    for (int i = 0; i < n; i++) cin >> S[i];
    cin >> q;
    for (int i = 0; i < q; i++) cin >> T[i];
    
    int count = 0;
    for (int i_t = 0; i_t < q; i_t++){
        for (int i_s = 0; i_s < n; i_s++){
            if (T[i_t] == S[i_s]){
                count++;
                break;
            }
        }
    }
    cout << count << endl;
}


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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using ll = long long int;
#define show(s)     cout<<s<<endl

int main() {

    ll N,M;
    cin >> N >> M;
    vector<pair<ll,ll>> P(N);

    for(ll i=0; i<N; i++){
        int A,B;
        cin >> A >> B;
        P[i] = make_pair(A,B);
    }

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

    ll ans = 0;
    for(ll i=0; i<N; i++){
        if(P[i].second <= M){
            ans+=(P[i].first * P[i].second);
            M-=P[i].second;
        }else{
            ans+=(P[i].first * M);
            break;
        }
    }

    show(ans);


    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define ll long long
#define db double
#define fr(i,x) for( int i=0;i<(x);i++)
#define io ios_base::sync_with_stdio(false); cin.tie(NULL);
using namespace std;

int main()
{
    ll n;
    cin>>n;
    double p=3.14159;
    cout <<setprecision(7)<<double(2*p*n)<<endl;
   
}

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

using namespace std;

#define MAX_N 21
#define MAX_M 21

int main()
{
	int N, M, C;
	int B[MAX_M];
	int A[MAX_N][MAX_M];

	cin >> N >> M >> C;

	for (int i = 0; i < M; i++) {
		cin >> B[i];
	}

	for (int i = 0; i < N; i++) {
		for (int j = 0; j < M; j++) {
			cin >> A[i][j];
		}
	}

  int ans = 0;

	for (int i = 0; i < N; i++) {
    int sum = 0;
		for (int j = 0; j < M; j++) {
      sum += A[i][j] * B[j];
		}
    sum += C;

    if (sum > 0) {
      ans++;
    }
	}

  cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
import numpy as np


def solve(w, items):
    dp = np.zeros(w + 1, dtype=int)

    for weight, value in items:
        dp[weight:] = np.maximum(dp[weight:], dp[:w-weight+1] + value)

    return dp[w]


def main():
    n, w = map(int, input().split())
    items = list(list(map(int, input().split())) for _ in range(n))

    ans = solve(w, items)
    print(ans)


main()


Measured memory_bytes: 20116
#include<map>
#include<iostream>
#include<deque>
#include<algorithm>
#include<string>
#include<cctype>
#include<iomanip>
#include<vector>
#include<queue>
#include<math.h>
#include<bitset>
#include<random>
 
using namespace std;
#define REP(i,b,e) for(ll i=(ll)b;i<(ll)e;i++)
#define rep0(i,n) REP(i,0ll,n)
#define rep1(i,n) REP(i,1ll,n+1)
 
#define shosu setprecision(17)
 
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<char,P> Q;
//ll longinf=1ll<<60;
int inf=1<<29;
ll longinf=(1ll<<60);

int dx[]={1,-1,0,0};
int dy[]={0,0,-1,1};

ll mod=1e9+7;
signed main(){
    int h,w;
    cin>>h>>w;
    char c[h][w];
    rep0(i,h)rep0(j,w) cin>>c[i][j];
    ll ans[h][w];
    rep0(i,h)rep0(j,w) ans[i][j]=0;
    rep0(i,h){
        if(c[i][0]=='.')ans[i][0]=1;
        else{
            break;
        }
    }
    rep0(j,w){
        if(c[0][j]=='.') ans[0][j]=1;
        else{
            break;
        }
    }
    rep1(i,h-1){
        rep1(j,w-1){
            if(c[i][j]=='.'){
                ans[i][j]=(ans[i-1][j]+ans[i][j-1])%mod;
            }
            //cout<<ans[i][j]<<" ";
        }
        //cout<<endl;
    }

    cout<<ans[h-1][w-1]<<endl;
    return 0;
}


Measured memory_bytes: 9088
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] a = new int[N];
		int minDistance = 0;
		int min = 1000;
		int max = 0;
		for(int i = 0  ; i  < N ; i++) {
			a[i] = sc.nextInt();
		}
		for(int i = 0 ; i < N ; i ++) {
			min = Math.min(min, a[i]);
			max = Math.max(max, a[i]);
		}
		minDistance = max - min;
		System.out.println(minDistance);
	}
}


Measured memory_bytes: 21716
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include <stdio.h>
#include <ctype.h>
#include <string>
#include <iostream>
#include <vector>
#include <stack>
#include <fstream>
#include <sstream>
#include <queue>
#include <exception>
#include <cmath>

using namespace std;

template <typename _Ty>
std::ostream& operator << (std::ostream& ostr, const std::vector<_Ty> v) {
	if (v.empty()) return ostr;
	for (auto itr = v.begin(); itr != v.end(); itr++) {
		if (itr == v.begin()) {
			std::cout << "{" << *itr;
		}
		else std::cout << ", " << *itr;
	}
	std::cout << "}";
	return ostr;
}

class Point2i {
public:
	int x;
	int y;

	Point2i() {
		this->x = x; this->y = y;
	}
	Point2i(int x, int y) {
		this->x = x; this->y = y;
	}

	friend std::ostream& operator << (std::ostream& ostr, const Point2i& p) {
		std::cout << "{" << p.x << ", " << p.y << "}";
		return ostr;
	}
};

class Point2f {
public:
	double x;
	double y;

	Point2f() {
		this->x = x; this->y = y;
	}
	Point2f(double x, double y) {
		this->x = x; this->y = y;
	}

	friend std::ostream& operator << (std::ostream& ostr, const Point2f& p) {
		std::cout << "{" << p.x << ", " << p.y << "}";
		return ostr;
	}
};

double distance(Point2f p1, Point2f p2) {
	return sqrt((p1.x - p2.x) * (p1.x - p2.x) + (p1.y - p2.y) * (p1.y - p2.y));
}

bool isOverlapped(Point2f p1, Point2f p2)
{
	return distance(p1, p2) <= 2.0 + 1e-6;
}

pair<Point2f, Point2f> intersection(Point2f p1, Point2f p2) {
	double dist = distance(p1, p2);
	double costheta = dist / 2;
	double sintheta = sqrt(1 - costheta * costheta);
	Point2f i1, i2;
	i1.x = p1.x + (costheta * (p2.x - p1.x) - sintheta * (p2.y - p1.y)) / dist;
	i1.y = p1.y + (sintheta * (p2.x - p1.x) + costheta * (p2.y - p1.y)) / dist;
	i2.x = p1.x + (costheta * (p2.x - p1.x) + sintheta * (p2.y - p1.y)) / dist;
	i2.y = p1.y + (-sintheta * (p2.x - p1.x) + costheta * (p2.y - p1.y)) / dist;
	return pair<Point2f, Point2f>(i1, i2);
}

bool AOJ0090()
{
	int n;
	cin >> n;
	if (n == 0) return false;
	vector<Point2f> p;
	vector<bool> b(n, false);
	vector<Point2i> pair;

	for (int i = 0; i < n; i++) {
		double x, y;
		scanf("%lf,%lf", &x, &y);
		p.push_back(Point2f(x, y));
	}

	for (int i = 0; i < p.size() - 1; i++) {
		for (int j = i + 1; j < p.size(); j++) {
			if (isOverlapped(p[i], p[j])) {
				pair.push_back(Point2i(i, j));
				b[i] = b[j] = true;
				//cout << "(" << i + 1 << ", " << j + 1 << ")" << endl;
			}
		}
	}

	//cout << pair << endl;
	//cout << b << endl;
	
	int maxOverlaps = 1;
	for (auto itr = pair.begin(); itr != pair.end(); itr++) {
		int np1 = itr->x, np2 = itr->y;
		auto inter = intersection(p[np1], p[np2]);
		
		int overlaps[2] = { 2, 2 };
		for (int i = 0; i < n; i++) {
			if (!b[i] || i == np1 || i == np2) continue;
			if (distance(inter.first, p[i]) <= 1.0 + 1e-6) overlaps[0]++;
			if (distance(inter.second, p[i]) <= 1.0 + 1e-6) overlaps[1]++;
		}
		maxOverlaps = max(maxOverlaps, max(overlaps[0], overlaps[1]));
	}

	cout << maxOverlaps << endl;

	return true;
}

int main()
{
	while (AOJ0090()) {

	}

	return 0;
}

Measured memory_bytes: 3200
#include <iostream>
#include <algorithm>
#include <complex>
#include <utility>
#include <vector>
#include <string>
#include <queue>
#include <tuple>
#include <cmath>
#include <bitset>
#include <cctype>
#include <set>
#include <map>
#include <unordered_map>
#include <numeric>
#include <functional>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
inline void Yes(bool condition){ if(condition) PRINT("Yes"); else PRINT("No"); }
template<class itr> void cins(itr first,itr last){
    for (auto i = first;i != last;i++){
        cin >> (*i);
    }
}
template<class itr> void array_output(itr start,itr goal){
    string ans = "",k = " ";
    for (auto i = start;i != goal;i++) ans += to_string(*i)+k;
    if (!ans.empty()) ans.pop_back();
    PRINT(ans);
}
ll gcd(ll a, ll b) {
    return a ? gcd(b%a,a) : b;
}
const ll INF = 1e18;
const ll MOD = 1000000007;
typedef pair<ll,ll> P;
const ll MAX = 100010;
constexpr ll nx[8] = {1,0,-1,0,-1,-1,1,1};
constexpr ll ny[8] = {0,1,0,-1,-1,1,-1,1};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,k,s;
    cin >> n >> k >> s;
    vector<ll> ans;
    rep(i,k) ans.push_back(s);
    if (s == 1e9){
        rep(i,n-k) ans.push_back(1);
    }
    else{
        rep(i,n-k) ans.push_back(1e9);
    }
    array_output(all(ans));
}    


Measured memory_bytes: 3316
#include <bits/stdc++.h>
#define INF 1e9
using namespace std;

#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a)  (a).begin(),(a).end()

template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
typedef long long ll;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}


int main() {
    string s;
    cin >> s;
    int count=0;
    REP (i,s.size()/2) {
        if (s[i]!=s[s.size()-1-i]) {
            count++;
        }
    }

    cout << count << endl;

    return 0;
}


Measured memory_bytes: 256
N = 100001
pr = [True]*(N+1)
c = [0]*(N+1)
pr[0] = pr[1] = False #exclude 0,1
for i in range(2,N) :
    if pr[i]:
        for j in range(i+i,N,i):#exclude mod i
            pr[j] = False

for i in range(3,N,2): # if L2017 -> c[i] +=1
    if pr[i] and pr[(i+1)//2]:
        c[i]+=1
for i in range(3,N):
    c[i]+=c[i-1]
Q = int(input())
for _ in range(Q):
    l, r = map(int, input().split())
    print(c[r]-c[l-1])


Measured memory_bytes: 54616
"use strict";

var main = function main(input) {
  var N = input.split(' ')[0];
  var Y = input.split(' ')[1];
  var flag = false;

  for (var i = 0; i <= N; i++) {
    for (var j = 0; j <= N - i; j++) {
      if (1000 * (N - i - j) + 5000 * j + 10000 * i == Y) {
        console.log("".concat(i, " ").concat(j, " ").concat(N - i - j));
        flag = true;
        break;
      }
    }

    if (flag) {
      break;
    }
  }

  if (!flag) {
    console.log("-1 -1 -1");
  }
};

main(require('fs').readFileSync('/dev/stdin', 'utf-8'));

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

using namespace std;

#define fr first
#define sc second
#define mp make_pair

typedef long long int64;
typedef pair< int, int > iP;
typedef pair< iP, int > iiP;

const int INF = 2 << 28;
const double EPS = 1e-10;

int main() {

    int n;
    string list = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
    while(cin >> n, n) {
        string s;
        vector< int > k(n);
        for(int i = 0; i < n; i++)
            cin >> k[i];
        cin >> s;

        for(int i = 0; i < s.size(); i++) {
            s[i] = list[(list.find(s[i]) - k[i % n] + list.size()) % list.size()];
        }
        cout << s << endl;
    }
}

Measured memory_bytes: 1216
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for (int i = (n)-1; i >= 0; i--)
#define rep2(i,s,n) for (int i = (s); i < (n); ++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vs vector<string>
#define vc vector<char>
#define vb vector<bool>
#define vp vector<P>
using namespace std;
using ll = long long;
using P = pair<int,int>;
using LP = pair<ll,ll>;
template<class T> istream& operator>>(istream& is,vector<T>& v) { for(T& t:v){is>>t;} return is; }
template<class T> ostream& operator<<(ostream& os,const vector<T>& v) { for(T t:v){os<<t<<" ";} os<<"\n"; return os; }
void Yes(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YES(bool b) { cout << (b ? "YES" : "NO") << endl; }
template<class T> inline bool chmin(T& a,T b) {if(a > b){a = b; return true;} return false;}
template<class T> inline bool chmax(T& a,T b) {if(a < b){a = b; return true;} return false;}
const int inf = 1001001001;
const ll linf = 1001001001001001001;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    int n,m;
    cin >> n >> m;
    vvi v(n);
    rep(i,m) {
        int a,b;
        cin >> a >> b;
        a--; b--;
        v[a].pb(b);
        v[b].pb(a);
    }
    vi ans(n);
    vi dist(n,-1);
    dist[0] = 0;
    queue<int> q;
    q.push(0);
    while(!q.empty()) {
        int now = q.front(); q.pop();
        for(int u : v[now]) {
            if(dist[u] != -1) continue;
            dist[u] = dist[now]+1;
            ans[u] = now;
            q.push(u);
        }
    }
    cout << "Yes" << endl;
    rep2(i,1,n) cout << ans[i]+1 << endl;
}


Measured memory_bytes: 10540