akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>  
#include <complex>
#include <queue>
#include <set>
#include <unordered_set>
#include <list>
#include <chrono>
#include <random>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <stack>
#include <iomanip>
#include <fstream>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int,int> p32;
typedef pair<ll,ll> p64;
typedef pair<double,double> pdd;
typedef vector<ll> v64;
typedef vector<int> v32;
typedef vector<vector<int> > vv32;
typedef vector<vector<ll> > vv64;
typedef vector<vector<p64> > vvp64;
typedef vector<p64> vp64;
typedef vector<p32> vp32;
ll MOD = 1e9+7;
double eps = 1e-12;
#define forn(i,e) for(ll i = 0; i < e; i++)
#define forsn(i,s,e) for(ll i = s; i < e; i++)
#define rforn(i,s) for(ll i = s; i >= 0; i--)
#define rforsn(i,s,e) for(ll i = s; i >= e; i--)
#define ln "\n"
#define dbg(x) cout<<#x<<" = "<<x<<ln
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define INF 2e18
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((ll)(x).size())
 
ll mpow(ll a, ll b){
	if(a==0) return 0;
	if(b >= (MOD-1)) b %= (MOD-1);
	if(b==0) return 1;
	ll t1 = mpow(a,b/2);
	t1 *= t1;
	t1 %= MOD;
	if(b%2) t1 *= a;
	t1 %= MOD;
	return t1;
}
 
ll mpow(ll a, ll b, ll p){
	if(a==0) return 0;
	if(b==0) return 1;
	ll t1 = mpow(a,b/2,p);
	t1 *= t1;
	t1 %= p;
	if(b%2) t1 *= a;
	t1 %= p;
	return t1;
}
 
ll modinverse(ll a, ll m){
	ll m0 = m; 
    ll y = 0, x = 1; 
    if (m == 1) return 0; 
    while (a > 1){
        ll q = a / m; 
        ll t = m; 
        m = a % m, a = t; 
        t = y; 
        y = x - q * y; 
        x = t; 
    }
    if (x < 0) x += m0; 
    return x; 
}

mt19937_64 mt(chrono::steady_clock::now().time_since_epoch().count());
 
ll range(ll l, ll r){
	return l + mt()%(r-l+1);
}
 
ll rev(ll v){
	return mpow(v,MOD-2);
}

void solve(){
	ll h1,m1,h2,m2,k;
	cin >> h1 >> m1 >> h2 >> m2 >> k;
	ll ans = h2*60+m2-h1*60-m1;
	cout << max((ll)0,ans-k) << ln;
}
 
int main()
{
	fast_cin();
    ll t=1;
    // cin >> t;
    forn(i,t) {
    	// cout << "Case #" << i+1 << ": ";
    	solve();
    }
    return 0;
}

Measured memory_bytes: 3656
#!/usr/bin/env python3
import sys

YES = "YES"  # type: str
NO = "NO"  # type: str

def solve(X: int):
    if X in {7, 5, 3}:
        print("YES")
    else:
        print("NO")
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = int(next(tokens))  # type: int
    solve(X)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  ll n;
  cin >> n;
  vl a(3 * n);
  rep(i, 3 * n) cin >> a[i];
  sort(all(a));
  ll ans = 0;
  rep2(i, 1, n + 1) ans += a[3 * n - 2 * i];
  cout << ans << endl;
}

Measured memory_bytes: 2560
def solve(list)
  n = list.size
  dic = Hash.new {|h,k| h[k] = 0}
  list.each do |e|
    dic[e] += 1
  end
  sum = 0
  dic.each do |e,c|
    sum += (c - 1) if c > 1
  end
  if (sum % 2) == 0
    return (n - sum)
  else
    return (n - sum - 1)
  end
end

def main
  n = gets.to_i
  list = gets.split
  puts solve(list)
end

main

Measured memory_bytes: 18060
#include <bits/stdc++.h>
#define dum(x) cout<<#x<<'='<<x<<endl
#define ll long long
using namespace std;

int main() {
  ll n, m;
  cin >> n >> m;
  ll ans = 0;
  ll re = m - n * 2;
  if (re >= 0) {
    ans += n;
    ans += re / 4;
  } else {
    ans += m / 2;
  }
  cout << ans << endl;
  return 0;
}

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

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cerr<<*i<<" "; cerr<<endl; }
inline bool valid(int x, int y, int W, int H){ return (x >= 0 && y >= 0 && x < W && y < H); }

typedef long long ll;
const int INF = 100000000;
const double EPS = 1e-8;
const int MOD = 1000000007;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
typedef pair<int, int> P;
struct UnionFind{
  vector<int> data;
  UnionFind(int n) : data(n, -1) {}
  bool uni(int x, int y){
    x = root(x);
    y = root(y);
    if(x == y) return false;
    if(data[x] > data[y]) swap(x, y);
    data[x] += data[y];
    data[y] = x;
    return true;
  }
  int root(int x){
    if(data[x] < 0) return x;
    return data[x] = root(data[x]);
  }
};

int main(){
  int N, W, H;
  while(cin >> N >> W >> H){
    int id_x[100001];
    int id_y[100001];
    memset(id_x, -1, sizeof id_x);
    memset(id_y, -1, sizeof id_y);
    UnionFind uf(N);
    bool wall = false;
    int cnt = N;
    REP(i, N){
      int x, y;
      scanf("%d %d", &x, &y);
      if(x == 1 || x == W) wall = true;
      if(y == 1 || y == H) wall = true;
      if(id_x[x] == -1) id_x[x] = i;
      if(id_y[y] == -1) id_y[y] = i;
      if(uf.uni(i, id_x[x])) cnt--;
      if(uf.uni(i, id_y[y])) cnt--;
    }
    int ans = N - cnt;
    if(cnt > 1){
      if(!wall) ans++;
      ans += 2 * (cnt - 1);
    }
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 2060
#include <algorithm>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PI;

const ll inf = 1e16;

const int DEBUG = 0;

// !
void output(const VI &ans) {
  REP(i, 0, ans.size()) {
    cout << ans[i] << (i == (int) ans.size() - 1 ? "\n" : " ");
  }
  exit(0);
}

const int N = 315000;
ll x_tbl[N];

void init_x(int k) {
  ll prod = 1;
  ll lim = inf / k;
  REP(i, 0, N) {
    x_tbl[i] = prod;
    if (prod >= lim) {
      prod = inf;
    } else {
      prod = k * prod + 1;
    }
  }
}

void rec2(int k, int n, VI &ans, ll rank) {
  if (n <= 0) {
    return;
  }
  if (rank == 1) {
    return; // empty list
  }
  ll y = x_tbl[n - 1];
  int tip = (rank - 2) / y;
  ans.push_back(tip + 1);
  rec2(k, n - 1, ans, rank - 1 - y * tip);
}


// 0 <= length <= n, (x + delta) / 2 - th (exact division)
// x = 1 + k + ... + k^n
// (x + delta) / 2 is in [1, x]
void rec(int k, int n, VI &ans, int delta) {
  ll x = x_tbl[n];
  if (DEBUG) {
    cerr << "rec " << k << " " << n << " " << delta << endl;
    cerr << "x = " << x << endl;
  }
  if (n <= 0) {
    return;
  }
  assert (x + delta >= 2);
  assert (x + delta <= 2 * x);
  ll y = x_tbl[n - 1];
  int tip = k / 2;
  if (y <= 2 * abs(delta - 1)) {
    ll rank = (x + delta) / 2;
    assert ((x + delta) % 2 == 0);
    rec2(k, n, ans, rank);
    return;
  }
  ans.push_back(tip + 1);
  if (DEBUG) {
    cerr << "tip[" << n << "]=" << tip << endl;
  }
  rec(k, n - 1, ans, delta - 1);
}

int main(void) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int k, n;
  cin >> k >> n;
  init_x(k);
  VI ans;
  if (k % 2 == 0) {
    ans = VI(n, k);
    ans[0] = k / 2;
    output(ans);
  }
  rec(k, n, ans, n % 2 == 0 ? 1 : 2);
  output(ans);
}


Measured memory_bytes: 24816
import itertools
n = int(input())
xy = [[]]*n
for i in range(n):
  xy[i] = list(map(int,input().split()))
routes = list(itertools.permutations(list(range(n))))
routenum = len(routes)
routeavg = 0
for i in routes:
  curroute = 0
  for j in range(1,n):
    curroute += ((xy[i[j]][0]-xy[i[j-1]][0])**2+(xy[i[j]][1]-xy[i[j-1]][1])**2)**0.5
  routeavg += curroute/routenum
print(routeavg)

Measured memory_bytes: 8180
N = int(input())

A = list(map(int, input().split()))

total = 0
minus = 0

l = []
for i in range(N):
  total += abs(A[i])
  l.append(abs(A[i]))
  if A[i] < 0:
    minus += 1

ans = total
if minus % 2 == 1:
  ans = total - 2 * min(l)

print(ans)


Measured memory_bytes: 14412
#include <iostream>
#include <iomanip>
#include <list>
#include <map>
#include <algorithm>
#include <stack>
#include <string>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>

using namespace std;

int main(){
	vector<pair<int,int> > kanri;
	int n,tmpmax;
	bool flag;

	while(cin >> n){
		flag = false;

		if(kanri.empty()){
			kanri.push_back(pair<int,int>(n,1));
			tmpmax = 1;
		}
		else{
			for(vector<pair<int,int> >::iterator it = kanri.begin(); it != kanri.end(); it++){
				if(it->first == n){
					it->second++;
					if(tmpmax < it->second){
						tmpmax = it->second;
					}
					flag = true;
					break;
				}
			}
			if(flag == false){
				kanri.push_back(pair<int,int>(n,1));
				sort(kanri.begin(),kanri.end());
			}
		}
	}

	for(vector<pair<int,int> >::iterator it = kanri.begin(); it != kanri.end(); it++){
		if(it->second == tmpmax){
			cout << it->first << endl;
		}
	}
	

	return 0;
}

Measured memory_bytes: 1200
#include<iostream>
using namespace std;
int main(){
  int n,ans = 4;cin >> n;
  if(n==1 || n==2) cout << 4 << endl;
  else{
    while(n != 4){
      if(n%2) n = n*3+1;
      else n /= 2;
      ans++;
    }
    cout << ans << endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
#define show(obj) {for(auto x:obj)cout<<x<<' ';cout<<endl;}
#define line "----------"
typedef long long ll;
typedef pair<int,int> ip;
typedef pair<ll,ll> lp;
const int inf = 1001001000;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

int main(){
	int N; cin>>N;
	vector<int> order(N+1);
	rep(i,N)cin>>order[i+1];
	vector<int> ans(N+1,0);
	for(int i = N; i>0; --i){
		int cnt = 0;
		for(int j = 2; i*j<=N; ++j){
			if(ans[i*j] == 1)++cnt;
		}
		if(cnt % 2 != order[i]){
			ans[i] = 1;
		}
	}
	int M = 0;
	REP(i,N){if(ans[i] == 1)M++;}
	cout<<M<<endl;
	if(M>0){
		REP(i,N)if(ans[i] == 1)cout<<i<<endl;
	}
	return 0;
}

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

long long a[300010];

int main() {
	int n;
	cin >> n;
	for (int i = 0; i < 3 * n; i++) {
		cin >> a[i];
	}
	sort(a, a + 3 * n);
	int index = 3 * n - 2;
	long long ans = 0;
	for (int i = 0; i < n; i++) {
		ans += a[index];
		index -= 2;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 2560
#!/usr/local/bin/python3

X, K, D = map(int, input().split())

X = abs(X)
n = X // D
if K - n <= 0:
    n = K

K -= n
X -= D * n

if K % 2 == 0:
    print(X)
else:
    print(min(map(abs, (X-D, X+D))))


Measured memory_bytes: 9164
#include <stdio.h>

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

	if (N / 100 == 7){
		puts("Yes");
	}else if ((N % 100)/10 == 7){
		puts("Yes");
	}else if (N % 10 == 7){
		puts("Yes");
	}else{
		puts("No");
	}
return 0;
}

Measured memory_bytes: 1656
using System;
using System.Linq;

class Program
{
    static int X = 10;
    static int XN = 1<<X; // = 512
    static int LMAX = 100000;
    static int[,] dp = new int[XN, LMAX+1];
    
    static int[,] VW;

    static int Dfs(int i, int L)
    {
        if(L<0 ) return -100000000;
        if(i<XN) return dp[i,L];

        var par = i/2;
        var v = VW[i,0];
        var w = VW[i,1];
        
        return Math.Max(Dfs(par, L), Dfs(par, L-w) + v);
    }
    
    static void Main()
    {     
        var N = int.Parse(Console.ReadLine());
        VW = new int[N+1,2];
        for(int i=1; i<=N; ++i) {
            var vw = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var v = VW[i,0] = vw[0];
            var w = VW[i,1] = vw[1];

            if(i<XN) {
                for(int wi=0; wi<=LMAX; ++wi) {
                    dp[i,wi] = dp[i/2,wi];
                    if(wi-w>=0) dp[i,wi] = Math.Max(dp[i,wi], dp[i/2, wi-w]+v);
                }
            }
        }

        var Q = int.Parse(Console.ReadLine());
        for(int iq=0; iq<Q; ++iq) {
            var vL = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int v = vL[0], L = vL[1];

            Console.WriteLine(Dfs(v, L));
        }

    }
}


Measured memory_bytes: 444536
/*
           Nothing is absolute.
     This is the only absolute truth.
*/

#include<bits/stdc++.h>

using namespace std;

using ull = unsigned long long;
using ll = long long;

#define READ freopen("in.txt", "r", stdin)
#define ROUT freopen("out.txt", "w", stdout)
#define pb push_back
#define endl '\n'

#define REP(i,a,b) for(int i=a; i<=b; i++)
#define arrL(i,a,b) for(int i=a; i<b; i++)

void fasterIO()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
}

void fileIO()
{
    READ;
    ROUT;
}

void solve()
{
    int a, b, c;

    cin>>a>>b>>c;

    if((a-b)>c){
        cout<<0<<endl;
    }else{
        cout<<c-(a-b)<<endl;
    }
}

int main()

{
    ///fileIO();
    fasterIO();

    solve();

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

#include <fstream>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <functional>
#include <stack>
#include <queue>
#include <map>
#include <unordered_map>
#include <bitset>
#include <numeric>
#include <unordered_set>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <numeric>
#include <cstdlib>
#include <random>
#include <bits/stdc++.h>


using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
//typedef vector<ll> vec;
//typedef vector<vec> mat;

const ll mod=1000000007ll;
const ll inf=1000000000000000ll;


int main(){
  ll N,X;
  cin>>N>>X;
  ll m[N];
  ll mmin=inf,msum=0;
  for(ll i=0;i<N;i++){
    cin>>m[i];
    mmin=min(mmin,m[i]);
    msum+=m[i];
  }
  cout<<(int)((X-msum)/mmin) +N<<endl;

}


Measured memory_bytes: 256
let find_prime n =
  let b = ref true in
  let i = ref 3 in
  while (float_of_int !i) <= sqrt (float_of_int n) do
    if n mod !i = 0 then b := false;
    i := !i + 2
  done;
  !b


let is_prime n =
  match n with
  | 0 -> false
  | 1 -> false
  | 2 -> true
  | x when x mod 2 = 0 -> false
  | _ -> find_prime n


let () =
  let n = read_int () in
  let sum = ref 0 in
  for i = 1 to n do
    let num = read_int () in
    if is_prime num then sum := !sum + 1
  done;
  print_int !sum; print_newline ()

Measured memory_bytes: 2876
#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

#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

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define reps(i, j, k) for(auto i = j; i < k; ++i)
#define rep(i, j) reps(i, 0, j)
#define decs(i, j, k) for(auto i = j; i >= k; --i)
#define dec(i, j) decs(i, j, 0)
#define iter(i, j) for(auto i = j.begin(); i != j.end(); ++i)
#define pb push_back
#define vi vector<int>
#define vll vector<ll>
#define pi pair<int, int>
#define vpi vector<pi>
#define vb vector<bool>
#define F first
#define S second
#define mp make_pair
#define um unordered_map
#define all(x) (x).begin(), (x).end()  
#define fast_io ios::sync_with_stdio(0); cin.tie(0);
#define file_io freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#define IMAX std::numeric_limits<int>::max()
#define IMIN std::numeric_limits<int>::min()
using namespace std;

int main()
{
    string s, t, u; cin >> s >> t;
    int a, b; cin >> a >> b;
    cin >> u;
    if(u == s) cout << a - 1 << " " << b;
    else cout << a << " " << b - 1;
    return 0;
}

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

int main() {
  string S;
  int b = 0;
  cin >> S;
  for(int i = 0; i < S.size(); i += 2){
    if(S[i] == 'L'){
      cout << "No" <<endl;
      b = 1;
      break;
    }
  }
  for(int i = 1; i < S.size(); i += 2){
    if(b == 1){
      break;
    }
      if(S[i] == 'R'){
        cout << "No" <<endl;
        b = 1;
        break;
      }
    }
      if(b == 0){
        cout << "Yes" <<endl;
      }
}


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

int N;

int main()
{
    cin >> N;
    int x = 0, y = 0, t = 0;
    for (int i=0; i<N; i++)
    {
        int tn, xn, yn;
        cin >> tn >> xn >> yn;
        int distance = abs(x-xn) + abs(y-yn);
        if (tn - t < distance || ((tn - t - distance) & 1))
        {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
const long long INF = LLONG_MAX / 2;
const long long MOD = 1000000007;
const long double PI = 3.1415926;
#define FOR(i, r, n) for(int i=(ll)(r); i<(ll)(n); i++) 
#define REP(i, n) FOR(i, (0), n)
#define ALL(r) r.begin(), r.end()
#define ll long long int
using namespace std;

vector<pair<ll, ll>> vp;
vector<vector<ll>> vv(110, vector<ll>(50, 0));
vector<tuple<ll, ll, ll>> vt;
set<ll> st;
map<ll, ll> mp;

int main()
{
	string s;
	ll ans = 0;
	cin >> s;
	ll cnt = pow(2, s.size()-1);
	while (cnt--)
	{
		vector<ll> v;
		ll a = cnt*2+1;
		ll b = 0;
		while (a > 0)
		{
			if (a & 1)
			{
				if(b<s.size())v.push_back(b);
			}
			b++;
			a >>= 1;
		}
		vector<ll> sub, sum;
		REP(i, v.size() - 1) sub.push_back(v[i + 1] - v[i]);
		REP(i, v.size())
		{
			sum.push_back(atoll(s.substr(v[i], (i >= sub.size() ? s.size() - v[i] : sub[i])).c_str()));
		}
		ans += accumulate(ALL(sum), 0LL);
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
  int a, b, c;
  
  scanf("%d%d%d", &a, &b, &c);
  
  if ((a!=b && b!=c && c!=a) || (a==b && b==c))
    printf("No");
  else
    printf("Yes");
  
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pli = pair<ll, int>;
using pil = pair<int, ll>;
using uint = unsigned int;
template <typename T>
using Graph = vector<vector<T>>;
const int MOD = 1e9 + 7;
const ld PI = acosl(-1);

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

    int N;
    cin >> N;
    if (N & 1)
        cout << ((N - 1) * (N - 3) >> 1) + N - 1 << '\n';
    else
        cout << (N * (N - 2) >> 1) << '\n';

    for (int i = 1; i < N; ++i) {
        for (int j = i + 1; j <= N; ++j) {
            if (j == N - i + !(N & 1))
                continue;
            cout << i << ' ' << j << '\n';
        }
    }

    return 0;
}


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

int main() {
  int a,b;
  cin>>a>>b;
  string s;
  cin>>s;
  for(int i=0;i<a;i++){
    if(s[i]=='-'){
      cout<<"No"<<endl;
      return 0;
    }
  }
  if(s[a]!='-'){
    cout<<"No"<<endl;
    return 0;
  }
  for(int i=a+2;i<a+b+1;i++){
    if(s[i]=='-'){
      cout<<"No"<<endl;
      return 0;
    }
  }
  cout<<"Yes"<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
 
int main()
{
  int W,H,x,y,r;
  int  ans=1;
 
  scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
  if(x-r<0)ans=0;
  if(r+x>W)ans=0;
  if(y-r<0)ans=0;
  if(y+r>H)ans=0;
 
  if(ans)printf("Yes\n");
  else printf("No\n");
 
  return 0;

}


Measured memory_bytes: 2680
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    x = int(readline())
    s = set()

    for i in range(1, 1001):
        for j in range(2, 16):
            if i ** j <= x:
                s.add(i ** j)
            else:
                break

    l = list(s)
    l.sort(reverse=True)

    print(l[0])


if __name__ == '__main__':
    main()


Measured memory_bytes: 62304
#include <iostream>
#include <vector>
#include <queue>
#include <cmath>
#include <algorithm>

#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
using namespace std;

int main() {
  string s;
  int num[2] = {0,0};
  cin >> s;
  int ini = s.length();
  for (int i = 0; i < s.length(); i++) {
    if(s[i] == '0') {
      num[0]++;
    } else {
      num[1]++;
    }
  }
  int result = num[0] > num[1] ? num[0] - num[1] : num[1] - num[0];
  cout << ini - result << endl;

}


Measured memory_bytes: 512
# -*- coding: utf-8 -*-

# 入力の数値4つ
train1 = int(input())
train2 = int(input())
bus1 = int(input())
bus2 = int(input())

if train1 < train2:
	ans1 = train1
else:
	ans1 = train2

if bus1 < bus2:
	ans2 = bus1
else:
	ans2 = bus2

ans_sum = ans1 + ans2

print(ans_sum)

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


int main()
{   
	int n, m, x;
	cin>>n>>m>>x;
	int c[n];
	int a[n][m];
	for (int i=0; i<n; i++){
		cin>>c[i];
		for (int j=0; j<m; j++){
			cin>>a[i][j];
		}
	}
	int ans = 1e9;
	for (int k=0; k<(1<<n); k++){
		int curr = 0;
		vector<int> know(m, 0);
		for (int i=0; i<n; i++){
			if (k&(1<<i)) {
				curr+=c[i];
				for (int j=0; j<m; j++){
					know[j] += a[i][j];
				}
			}
		}
		bool ok = 1;
		for (int j=0; j<m; j++){
			ok &= (know[j]>=x);
		}
		if (ok) ans = min(ans, curr);
	}
	if (ans!=1e9) cout<<ans<<endl;
	else cout<<-1<<endl;
    return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
vector<int> stoneHeight;
vector<int> cost;
int main(){
        int N,K;
        scanf("%d%d",&N,&K);
        for(int i=0; i<N; i++) {
                int temp;
                scanf("%d",&temp);
                stoneHeight.push_back(temp);
                cost.push_back(INT_MAX);
        }
        cost[0]=0;
        for(int i=0; i<N; i++) {
                for(int j=1; j<=K; j++) {
                        if(i+j<N) {

                                int difcost=abs(stoneHeight[i]-stoneHeight[i+j])+cost[i];
                                if(cost[i+j]>difcost)
                                        cost[i+j]=difcost;

                        }
                        else{
                                break;
                        }
                }
        }
        cout<<cost[N-1]<<endl;


        return 0;
}


Measured memory_bytes: 1276
import java.util.*;

public class Main {
	private void doit(){
		
		Scanner sc = new Scanner(System.in);
		long mod = 1000000007;
		while(sc.hasNext()){
			int [] array = new int[3];
			array[0] = sc.nextInt();
			array[1] = sc.nextInt();
			array[2] = sc.nextInt();
			Arrays.sort(array);
			
			if(array[0] + array[1] == array[2]){
				System.out.println("Yes");
			}
			else
			{
				System.out.println("No");
			}
		}

	}

	private void debug(Object... o) {
		System.out.println("debug = " + Arrays.deepToString(o));
	}

	public static void main(String[] args) {
		new Main().doit();
	}

}


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

#define lli long long int 

int main () {

  lli A,B,C,D;
  
  cin >> A >> B >> C >> D;

  lli mcd = (D*C)/ __gcd(C,D);



  lli c = B/C - (A-1)/C;
  lli d = B/D - (A-1)/D;
  lli dc = B/mcd - (A-1)/mcd;

  lli All = B - A + 1;


  cout << All - (c+d - dc) << "\n";
       
  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int main()
{
	int x,y,ans;
	scanf("%d%d",&x,&y);
	if(x==y) ans=0;
	else if(x*(-1)==y) ans=1; 
	else if(x>=0&&y>=0&&y>x)
	{
		ans=y-x;
	}
	else if(x>0&&y>0&&y<x)
	{
		ans=x-y+2;
	}
	else if(x==0&&y<0)
	{
		ans=abs(y)+1;
	}
	else if(y==0&&x>0)
	{
		ans=x+1;
	}
	else if(y==0&&x<0)
	{
		ans=abs(x);
	}
	else if(y<0&&x<0&&y>x)
	{
		ans=y-x;
	}
	else if(y<0&&x<0&&x>y)
	{
		ans=x-y+2;
	}
	else if(x<=0&&y>=0&&abs(x)>=y)
	{
		ans=abs(x)-y+1;
	}
	else if(x<=0&&y>=0&&abs(x)<=y)
	{
		ans=y-abs(x)+1;
	}
	else if(x>=0&&y<=0&&x>=abs(y))
	{
		ans=x-abs(y)+1;
	}
	else if(x>=0&&y<=0&&x<=abs(y))
	{
		ans=abs(y)-x+1;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
local read = setmetatable({}, {__index = function(t, k) local a = {} for i=1,#k do table.insert(a, '*'..string.sub(k, i, i)) end local r = io.read local u = table.unpack or unpack return function() return r(u(a)) end end})
read.N = function(N) local t={} for i=1,N do t[i]=read.n() end return t end
string.totable = function(s) local t={} local u=string.sub for i=1,#s do t[i] = u(s, i, i) end return t end
string.split = function(s) local t={} for w in string.gmatch(s, "[^%s]+") do table.insert(t, w) end return (table.unpack or unpack)(t) end
local function array(dimension, default_val) assert(type(default_val) ~= 'table') local n=dimension local m={}if default_val~=nil then m[1]={__index=function()return default_val end}end for i=2,n do m[i]={__index=function(p, k)local c=setmetatable({},m[i-1])rawset(p,k,c)return c end}end return setmetatable({},m[n])end
local function tostringxx(o, depth) depth = depth or 0 if depth > 10 then return "<too deep!>" end if o == _G then return "<_G>" end local indent0 = (" "):rep((depth) * 2) local indent1 = (" "):rep((depth+1) * 2) local indent2= (" "):rep((depth+2) * 2) if type(o) == 'table' then local keys = {} local types = {} for k in pairs(o) do types[type(k)] = true table.insert(keys, k) end local types_count = 0 local lasttype for k in pairs(types) do types_count = types_count + 1 lasttype = k end if types_count == 1 and (lasttype == 'string' or lasttype == 'number') then table.sort(keys) end local inside = {} for i=1,#keys do local k = keys[i] local v = o[k] if type(k) == 'string' then k = string.format('%q', k) end table.insert(inside, indent1 .. '['..tostring(k)..'] = ' .. tostringxx(v, depth + 1)) end return '{\n' .. table.concat(inside, ',\n') .. '\n' .. indent0 .. '}' else if type(o) == 'string' then o = string.format('%q', o) end return tostring(o) end end
local function richtraceback() local x = 2 while true do local info = debug.getinfo(x) if not info then break end local fname = '<' .. info.short_src .. ":" .. info.linedefined .. ">" if info.name then fname = info.name end print(info.short_src .. ":" .. info.currentline .. ": in " .. ("%q"):format(fname)) print(" LOCALS:") local p = 1 while true do local name, val = debug.getlocal(x,p) if not name then break end print(" " .. name .. ": " .. tostringxx(val, 3)) p = p + 1 end print(" UPVALUES:") for p=1,info.nups do local name, val = debug.getupvalue(info.func,p) if not name then break end print(" " .. name .. ": " .. tostringxx(val, 3)) end x = x + 1 end end
local function myassert(b) if not b then richtraceback() error("assertion failed") end end 
-----------------------
local D = read.n()
local C = read.N(26)
local S = {}
for i=1,D do
    S[i] = read.N(26)
end
-----
local t = read.N(D)
local last = array(1, 0)
local ans = 0
for d=1,D do
    local i = t[d]
    ans = ans + S[d][i]
    last[i] = d
    for i=1,26 do
        ans = ans - C[i] * (d - last[i])
    end
    print(ans)
end

Measured memory_bytes: 3772
#include <iostream>
#include <string>
using namespace std;
int main() {
	string s;
    cin >> s;
    string t = "";
    for(int i = s.size()-1; i >= 0; --i) {
        t += s[i];
        if(t=="maerd" || t=="remaerd" || t=="esare" || t=="resare") {
            t = "";
        }
    }
    if(t == "") {
        cout << "YES" << endl;
    }
    else {
        cout << "NO" << endl;
    }
}


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

#define REP(i, n) for(int i = 0; i < n; ++i)

template<class T>
T read() {
    T x{};
    cin >> x;
    return x;
}
 
template<class T>
vector<T> read(int N){
    vector<T> x(N);
    for(int i = 0; i < N; ++i){
        cin >> x[i];
    }
    return x;
}
 
template<class T>
void write(const T &x){ cout << x << endl; }

int main(){
    auto N = read<ll>();
    auto K = read<ll>();
    auto h = read<ll>(N);
    
    ll ans = 0;
    for(auto x : h){
        if(x >= K) ans++;
    }
    write(ans);
}

Measured memory_bytes: 1024
#include<stdio.h>
#include<string.h>
int main()
{
	char a[100100];
	gets(a);
	int len = strlen(a); int sum1 = 0, sum2 = 0; int j = 0, q = 0; int t[100100]; a[len] = 'R'; a[len + 1] = '\0'; len++;
	for (int i = 0; i < len; i++)
	{
		if (a[i] == 'R')
		{
			sum1++; continue;
		}
		else
		{
			sum1--;
			for (; i < len; i++)
			{
				if (a[i] == 'L')
				{
					sum2++; continue;
				}
				else
				{
					sum2--;
					if (sum1 == sum2)
					{
						for (; j < q + sum1; j++)
							t[j] = 0;
						t[j] = sum1 + 1; j++;
						t[j] = sum1 + 1; j++;
						for (; j < q + sum1+sum2+2; j++)
							t[j] = 0;
					}
					if (sum1 > sum2)
					{
						int c = sum1 - sum2;
						
						for (; j < q + sum1; j++)
							t[j] = 0;
						if (c % 2 == 0)
						{
							t[j] = sum2 + 1 + c / 2; j++;
							t[j] = sum2 + 1 + c / 2; j++;
							for (; j < q + sum2+sum1+2; j++)
								t[j] = 0;
						}
						else
						{
							if (sum2 % 2 == 1)
							{
								t[j] = sum2 + 1 + c / 2+1; j++;
								t[j] = sum2 + 1 + c / 2; j++;
								for (; j < q + sum2+sum1+2; j++)
									t[j] = 0;
							}
							else
							{
								t[j] = sum2 + 1 + c / 2; j++;
								t[j] = sum2 + 1 + c / 2+1; j++;
								for (; j < q + sum2+sum1+2; j++)
									t[j] = 0;
							}
						}
					}
					if (sum1 < sum2)
					{
						int c = sum2 - sum1;
						for (; j < q + sum1; j++)
							t[j] = 0;
						if(c%2==0)
						{
							t[j] = sum1 + 1 + c / 2; j++;
							t[j] = sum1 + 1 + c / 2; j++;
							for (; j < q + sum2+sum1+2; j++)
								t[j] = 0;
						}
						else
						{
							if (sum1 % 2 == 1)
							{
								t[j] = sum1 + 1 + c / 2 ; j++;
								t[j] = sum1 + 1 + c / 2+1; j++;
								for (; j < q + sum2+sum1+2; j++)
									t[j] = 0;
							}
							else
							{
								t[j] = sum1 + 1 + c / 2 + 1; j++;
								t[j] = sum1 + 1 + c / 2 ; j++;
								for (; j < q + sum2+sum1+2; j++)
									t[j] = 0;
							}
						}
					}
					sum1 = 0; sum2 = 0; break;
				}
			}
		}
		j = i; q = i; i--;
	}
	printf("%d", t[0]);
	for (int i = 1; i < len-1; i++)
		printf(" %d", t[i]);
	return 0;
}

Measured memory_bytes: 2088
mod = 10 ** 9 + 7

N = int(input())
A = [(int(input()), 1) for _ in range(N)]
B = [(int(input()), -1) for _ in range(N)]

C = sorted(A + B)

res = 1
cnt = 0
for _, delta in C:
    if cnt * delta < 0:
        res *= abs(cnt)
        res %= mod
    cnt += delta

print(res)

Measured memory_bytes: 27652
#include <iostream>
#include <cstdio>
using namespace std;
int n, x, a, sum, ans = 1;
int main()
{
	cin >> n >> x;
	while(n--){
		cin >> a;
		sum += a;
		if(sum <= x){
			ans++;
		}else{
			break;
		}
	}
	cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
  public static void main(String [] args){
    Scanner sc=new Scanner(System.in);
    int W=sc.nextInt(),H=sc.nextInt(),x=sc.nextInt(),y=sc.nextInt(),r=sc.nextInt();
    int X=x+r;
    int Y=y+r;
    if((X>0)&&(Y>0)){
      if((X<=W)&&(Y<=H)){
        System.out.println("Yes");
      }
      else{
        System.out.println("No");
      }
    }
    else{
        System.out.println("No");
      }
  }
}


Measured memory_bytes: 26376
#include<iostream>
#include<queue>
#include<cstdio>

using namespace std;

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)

int g[100][100];
bool memo[100][1000];

typedef pair<int, pair<int, int> > data;
inline data makedata(int a, int b, int c){ return make_pair(a, make_pair(b, c)); }
inline int elim(data d){ return d.f; }
inline int cost(data d){ return d.s.f; }
inline int pos(data d){ return d.s.s; }

int main(){
  int n, m, c;
  while(scanf("%d%d%d", &n, &m, &c), n + m + c){
    REP(i,n) REP(j,n) g[i][j] = -1;
    REP(i,n) REP(j,m) memo[i][j] = false;

    REP(i,m){
      int a, b, d;
      scanf("%d%d%d", &a, &b, &d);
      g[a - 1][b - 1] = d;
    }

    priority_queue<data, vector<data>, greater<data> > pq;
    pq.push(makedata(0, 0, 0));

    while(pq.size()){
      data d = pq.top(); pq.pop();
      int ee = elim(d);
      int cc = cost(d);
      int pp = pos(d);

      if(memo[pp][ee]) continue;
      memo[pp][ee] = true;

      if(pp == n - 1 && cc <= c){
        printf("%d\n", ee);
        break;
      }

      REP(i,n) if(g[pp][i] >= 0){
        if(!memo[i][ee + 1]) pq.push(makedata(ee + 1, cc, i));
        if(!memo[i][ee])     pq.push(makedata(ee, cc + g[pp][i], i));
      }
    }
  }
  return 0;
}

Measured memory_bytes: 1132
S = input()
T = input()

N = len(T)

if (T in S):
    print(0)
    exit(0)

min_change = N
for i in range(len(S) - N+1):
    S_part = S[i:i + N]

    change = N
    for j in range(N):
        if (S_part[j] == T[j]):
            change = change - 1

    if (change < min_change):
        min_change = change

print(min_change)


Measured memory_bytes: 73548
/**
 *    Coded by : lucky_21
 *               --------Lokesh Singh
**/

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

#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template<class T> using oset=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

#define     F           first
#define     S           second
#define     pb          push_back
#define     lb          lower_bound
#define     ub          upper_bound
#define     pii         pair<int,int>
#define     all(x)      x.begin(),x.end()
#define     fix         fixed<<setprecision(10)
#define     rep(i,a,b)  for(int i=int(a);i<=int(b);i++)
#define     repb(i,b,a) for(int i=int(b);i>=int(a);i--)
#define     FastIO      ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)

typedef double db;
typedef long long ll;

const int N=2e5+5;
const int mod=1e9+7;

signed main(){
    FastIO;
    ll n,k;
    cin>>n>>k;
    cout<<min(n%k,(k-n%k)%k);
    return 0;
}


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

const int maxn = 3e5 + 6;
int n, k, cur;
long long ans[maxn];

void desc() {
	if(!--ans[cur]) {
		--cur;
	} else {
		while(cur + 1 < n)
			ans[++cur] = k;
	}
}

int main() {
	scanf("%d%d", &k, &n);
	if(k == 1) {
		for(int i = 1; i <= ((n >> 1) + (n & 1)); ++i) {
			printf("%d%c", 1, " \n"[i == ((n >> 1) + (n & 1))]);
		}
		return 0;
	}
	if((k & 1) == 0) {
		printf("%d", k >> 1);
		for(int i = 1; i < n; ++i) {
			printf(" %d", k);
		}
		putchar('\n');
		return 0;
	}
	for(int i = 0; i < n; ++i) {
		ans[i] = (k >> 1) + 1;
	}
	cur = n - 1;
	for(int i = 0; i < (n >> 1); ++i) {
		desc();
	}
	for(int i = 0; i <= cur; ++i) {
		printf("%d%c", ans[i], " \n"[i == cur]);
	}
	return 0;
}


Measured memory_bytes: 4608
#include <stdio.h>
int main() {
	int N, K;
	scanf("%d%d", &N, &K);
	int tmp = 1;
	int cnt = 0;
	while (N >= tmp) {
		tmp +=2;
		cnt++;
	}
	if (cnt>=K)
	{
		puts("YES");
		return 0;
	}
	else {
		puts("NO");
		return 0;
	}
}


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

const long long m=1e9+5;

int main()
{
 long long n,i,k,j;
  cin>>n>>k;
  vector<long long>v(n+1,0);
    long long a[n+1];
  a[0]=0;
  for(i=1;i<=n;i++)cin>>a[i];
  for(i=1;i<=n;i++)v[i]=m;

  v[0]=0;
    v[1]=0;
  for(i=2;i<=n;i++)
  {
      for(j=1;j<=k;j++)
      {
          if(i-j>0)
         v[i]=min(v[i],v[i-j]+abs(a[i]-a[i-j]));
      }
  }

  cout<<v[n]<<endl;



}


Measured memory_bytes: 1792
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
 
static const double EPS = 1e-8;
static const double PI = 4.0 * atan(1.0);
static const double PI2 = 8.0 * atan(1.0);
 
#define REP(i,n)	for(int i=0;i<(int)n;++i)
#define ALL(c)		(c).begin(),(c).end()
#define CLEAR(v)	memset(v,0,sizeof(v))
#define MP(a,b)		make_pair((a),(b))
#define ABS(a)		((a)>0?(a):-(a))
#define FOR(i,s,n)	for(int i=s;i<(int)n;++i)
 
string s;
 
int main(int argc, char **argv) {
	cin >> s;
	cout << s[0] << (s.length() - 2) << s[s.length() - 1] << endl;
	return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.text.DecimalFormat;

/**
 * Lesson7D n×m  の行列 A  と m×l  の行列 B  を入力し、
 * それらの積である n×l  の行列 C  を出力するプログラム
 * 行列 C  の各要素 c ij   は次の式で得られます：
 * c ij =? k=1 m a ik b kj
 * ここで、A 、B 、C  の各要素をそれぞれ a ij  、b ij  、c ij   とする
 *
 * @author Internship
 *
 */
public class Main{

	/**
	 * プログラムのエントリポイント
	 *
	 * @param args
	 */
	public static void main(String[] args) {

		//行や列の各数字の一時保管場所
				int intVector = 0;

		//入力値の各行の文字列の一時保管場所
				String strLineAll = "";

		//1行目を読み込む
		try {
			BufferedReader insBR = new BufferedReader(new InputStreamReader(System.in));

			String strLine1 = insBR.readLine();

			//ばらけさせる
			String[] strAryLine1 = strLine1.split(" ");

			//１つ目がN
			int intN = Integer.parseInt(strAryLine1[0]);

			//2つ目がM
			int intM = Integer.parseInt(strAryLine1[1]);

			//3つ目がL
			int intL = Integer.parseInt(strAryLine1[2]);

			//N,M,Lが決まったところで配列の大きさが決まる
			//行列A
			int[][] intTableA = new int[intN][intM];

			//行列B
			int[][] intTableB = new int[intM][intL];

			//行列C
			double[][] dbTableC = new double[intN][intL];

			//行列Aを読み込む
			//i行目
			for(int i = 0; i < intN; i++) {
				strLineAll = insBR.readLine();

				//ばらけさせる
				String[] strAryLineAll = strLineAll.split(" ");

				//int型にキャスト
				//j列目
				for(int j = 0; j < intM; j++) {
					intVector = Integer.parseInt(strAryLineAll[j]);

					//配列に格納
					//i行のj列
					intTableA[i][j] = intVector;
				}
			}


			//行列Bを読み込む
			//i行目
			for(int i = 0; i < intM; i++) {
				strLineAll = insBR.readLine();

				//ばらけさせる
				String[] strAryLineAll = strLineAll.split(" ");

				//int型にキャスト
				//j列目
				for(int j = 0; j < intL; j++) {
					intVector = Integer.parseInt(strAryLineAll[j]);

					//配列に格納
					//i行のj列
					intTableB[i][j] = intVector;
				}
			}
			//計算
			for(int i = 0; i < intN; i++) {
				for(int j = 0; j < intL; j++) {
					for(int k = 0; k < intM; k++) {
						dbTableC[i][j] += intTableA[i][k] * intTableB[k][j];
					}

				}
			}

			//小数5桁まで
		    DecimalFormat insdf = new DecimalFormat("0");


			//出力
			for(int i = 0; i < intN; i++) {
				for(int j = 0; j < intL; j++) {
					if(j != 0) {
						System.out.print(" ");
					}
				System.out.print(insdf.format(dbTableC[i][j]));
				}
				System.out.println();
			}



		} catch (IOException e) {
			System.out.println(e);
		} catch (NumberFormatException e) {
			System.out.println("数字で入力して下さい");
		}
	}
}

Measured memory_bytes: 37028
#include <iostream>
#include <cmath>
using namespace std;
#define FOR(i,s,e) for(int i = (s);i <= (e);i++)
typedef long long ll;

ll total[200001];

int N;



int main()
{
    cin >> N;

    ll a;

    FOR(i,1,N)
    {
        cin >> a;
        total[i] = total[i - 1] + a;
    }

    ll result = 10000000000000000;

    FOR(i,1,N - 1)
    {
        ll x = total[i];
        ll y = total[N] - total[i];

        ll te = abs(x-y);
        result = min(result,te);
    }

    cout << result << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main() {
    int N, L;
    cin >> N >> L;

    int i;
    string S[N];
    for(i=0; i<N; i++) {
        cin >> S[i];
    }

    sort(S, S+N);
    for(i=0; i<N; i++) {
        cout << S[i];
    }

    cout << endl;

    return 0;

}

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

using namespace std;

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

    vector<int> a(n);

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

    using ll = long long;

    vector<vector<ll>> dp(n, vector<ll>(n));

    for (int i = 0; i < n; i++) {
        dp[0][i] = (n % 2 ? 1 : -1) * a[i];
    }

    for (int i = 1; i < n; i++) {
        for (int j = 0; j + i < n; j++) {
            if ((n - i) % 2) {
                dp[i][j] = max(dp[i - 1][j] + a[j + i], dp[i - 1][j + 1] + a[j]);
            } else {
                dp[i][j] = min(dp[i - 1][j] - a[j + i], dp[i - 1][j + 1] - a[j]);
            }
        }
    }

    cout << dp[n - 1][0] << endl;
}


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

#define SORT(x) sort((x).begin(),(x).end())
#define RSORT(x) sort((x).begin(),(x).end(),greater<int>())
#define SZ(x) ((int)(x).size())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) " (L" << __LINE__ << ") " << __FILE__ << endl;

typedef long long ll;
const int mod = 1e9+7;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const int inf = 0x3f3f3f3f;

typedef pair<int, int> ii;

void solve()
{
  int n; cin>>n;
  string s; cin>>s;
  vector<ii> lv(n+2, ii(0,0));
  vector<ii> rv(n+2, ii(0,0));
  for (int i=0; i<n; i++) {
    lv[i+1] = lv[i];
    rv[n-i] = rv[n-i+1];
    if (s[i]=='E') lv[i+1].first++;
    else lv[i+1].second++;
    if (s[n-i-1]=='E') rv[n-i].first++;
    else rv[n-i].second++;
  }
  int ans=inf;
  for (int i=1; i<=n; i++) {
    ans = min(ans, lv[i-1].second+rv[i+1].first);
  }
  cout << ans << endl;
}

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


Measured memory_bytes: 5380
a =[chr(i) for i in range(65, 65+26)]
l=[]
N = int(input())
v = input()
for i in range(len(v)):
  if a.index(v[i])+N >= 26:
    l.append(a[a.index(v[i])+N-26])
  else:
    l.append(a[a.index(v[i])+N])
print(''.join(l))

Measured memory_bytes: 3064
import sys
import copy
def S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
INF = 1000000000000

n,d = LI()

c = 0
d2 = d*d
for i in range(n):
    x,y = LI()
    if(x*x + y*y <= d2):
        c += 1

print(c)

Measured memory_bytes: 69428
#include<bits/stdc++.h>
#define N 2005
#define ll long long
#define P 1000000007
using namespace std;
int n,k,inv[N*N],fac[N*N],ifac[N*N],dp[N][N];
int Get(int x,int y)
{
	return (ll)fac[x+y]*ifac[x]%P*ifac[y]%P;
}
int main()
{
	scanf("%d%d",&n,&k);
	if (k==1)
	{
		printf("%d\n",1);
		return 0;
	}
	inv[1]=fac[0]=fac[1]=ifac[0]=ifac[1]=1;
	for (int i=2;i<=n*k;i++)
	{
		inv[i]=(ll)(-P/i)*inv[P%i]%P;
		fac[i]=(ll)fac[i-1]*i%P;
		ifac[i]=(ll)ifac[i-1]*inv[i]%P;
	}
	dp[n+1][n+1]=1;
	for (int i=n+1;i>=1;i--)
	{
		for (int j=i;j>=1;j--)
		{
			if (i+j==n*2+2) continue;
			dp[i][j]=(dp[i+1][j]+(ll)dp[i][j+1]*Get((n-j)*(k-1)+n-i+1,k-2)%P)%P;
		}
	}
	printf("%lld\n",((ll)dp[1][1]*fac[n]%P+P)%P);
}

Measured memory_bytes: 62080
#include <bits/stdc++.h>
using namespace std;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
#define ld long double
#define all(a) (a).begin(),(a).end()
#define mk make_pair
ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=100000000000000000;


int main() {
    int n;
    cin >> n;
    vector<vector<char>> a(n,vector<char>(n));
    rep(i,n){
        rep(j,n) cin >> a[j][i];
    }
    int ans=n;
    rep(i,n){
        bool t=false;
        rep(j,n){
            rep(k,n){
                if (a[(j+i)%n][k]!=a[(k+i)%n][j]){
                    t=true;
                    ans--;
                    break;
                }
            }
            if (t) break;
        }
    }
    cout << n*ans << endl;
}


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

int n;
long long sum[1 << 16];
long long dp[1 << 16];

int a[16][16];

int main() {
	cin >> n;
	
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			cin >> a[i][j];
		}
	}
	
	for (int mask = 1; mask < (1 << n); mask++) {
		for (int i = 0; i < n; i++) {
			if (mask & (1 << i)) {
				for (int j = i + 1; j < n; j++) {
					if (mask & (1 << j)) {
						sum[mask] += a[i][j];
					}
				}
			}
		}
	}
	
	for (int mask = 1; mask < (1 << n); mask++) {
		dp[mask] = sum[mask];
		
		for (int sub = mask; sub > 0; sub = (sub - 1) & mask) {
			dp[mask] = max(dp[mask], sum[sub] + dp[mask ^ sub]);
		}
		
		//cerr << mask << " " << dp[mask] << endl;
	}
	
	cout << dp[(1 << n) - 1];
}


Measured memory_bytes: 1280