akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
const double PI = 3.141592653589793238;
const double EPS = 1e-10;
ll s[100000];
ll t[100000];
int sL[100000], sR[100000];
int tL[100000], tR[100000];
int main() {
	int A, B, Q;
	cin >> A >> B >> Q;
	for (int i = 0; i < A; i++) {
		cin >> s[i];
	}
	for (int i = 0; i < B; i++) {
		cin >> t[i];
	}
	for (int i = 0; i < A; i++) {
		sL[i] = upper_bound(t, t + B, s[i]) - t - 1;
		sR[i] = lower_bound(t, t + B, s[i]) - t;
	}
	for (int i = 0; i < B; i++) {
		tL[i] = upper_bound(s, s + A, t[i]) - s - 1;
		tR[i] = lower_bound(s, s + A, t[i]) - s;
	}
	for (int i = 0; i < Q; i++) {
		ll ans = 1LL << 60;
		ll x;
		cin >> x;
		int idx = lower_bound(s, s + A, x) - s;
		if (idx < A) {
			if (sL[idx] >= 0) ans = min(ans, abs(x - s[idx]) + abs(s[idx] - t[sL[idx]]));
			if (sR[idx] < B) ans = min(ans, abs(x - s[idx]) + abs(s[idx] - t[sR[idx]]));
		}
		idx = upper_bound(s, s + A, x) - s - 1;
		if (idx >= 0) {
			if (sL[idx] >= 0) ans = min(ans, abs(x - s[idx]) + abs(s[idx] - t[sL[idx]]));
			if (sR[idx] < B) ans = min(ans, abs(x - s[idx]) + abs(s[idx] - t[sR[idx]]));
		}
		idx = lower_bound(t, t + B, x) - t;
		if (idx < B) {
			if (tL[idx] >= 0) ans = min(ans, abs(x - t[idx]) + abs(t[idx] - s[tL[idx]]));
			if (tR[idx] < A) ans = min(ans, abs(x - t[idx]) + abs(t[idx] - s[tR[idx]]));
		}
		idx = upper_bound(t, t + B, x) - t - 1;
		if (idx >= 0) {
			if (tL[idx] >= 0) ans = min(ans, abs(x - t[idx]) + abs(t[idx] - s[tL[idx]]));
			if (tR[idx] < A) ans = min(ans, abs(x - t[idx]) + abs(t[idx] - s[tR[idx]]));
		}
		cout << ans << endl;
	}
}


Measured memory_bytes: 4480
#include<bits/stdc++.h>
//#include <ext/pb_ds/detail/standard_policies.hpp>
//#include <ext/pb_ds/assoc_container.hpp> 
//#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define int long long 
#define pb push_back
#define ins insert
#define rs resize
#define br break;
#define cont continue;
#define vi vector<int>
#define vll vector<long long>
#define vvi vector<vector<int>>
#define si set<ll>
#define sll set<long long>
#define pii pair<ll,ll>
#define pll pair<long long, long long>
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);
#define vec vector
#define cend cout<<endl;
#define sc second
#define fr first
#define retz return 0;
#define ll_MAX (ll)(1e9*1e9)
#define ll_MIN (ll)(-1e9*1e9)
#define lb lower_bound
#define ub upper_bound
#define rep(i,a,b)  for(int i=a; i<=b; i++)
#define repd(i,a,b) for(int i=a; i>=b; i--)
#define ps(arr, n) for(int i=1; i<n; i++)arr[i]+=arr[i-1];
#define inp(arr, n)for(int i=0; i<n; i++)cin>>arr[i];
#define out(arr, n)for(int i=0; i<n; i++)cout<<arr[i];
#define inp1(arr,n,m)for(int i=0; i<n; i++)for(int j=0;j<m;j++)cin>>arr[i][j];
#define out1(arr,n,m)for(int i=0; i<n; i++)for(int j=0;j<m;j++)cin>>arr[i][j];
#define loop(q) for(auto it:q)
#define loop1(q) for(auto&it:q)
#define db1 cout << "*" << endl
#define db2 cout << "YES" << endl
using namespace std;
//using namespace __gnu_pbds; 
#define oset(X) tree<X,null_type,less<X>, rb_tree_tag, tree_order_statistics_node_update> 
#define roset(X) tree<X,null_type,greater<X>, rb_tree_tag, tree_order_statistics_node_update>  
#define okey order_of_key //lower_bound_set
#define ofind find_by_order
#define cyes cout << "Yes" << endl; 
#define cno cout << "No" << endl;
#define mod (long long)1000000007
#define mod2 (long long)998244353
#define INT_MAX1 900000000
#define MAXN 2000000
#define INF INT_MAX
 
 
 
 
void solve()
{
    int l,r,d;
    cin >> l >> r >> d;
    int curr = d;
    int ans = 0;
    while(curr <= r)
    {
        ans += (curr >= l);
        curr += d;
    }

    cout << ans << endl;
}
 
 
signed main()
{
    
    speed;
    int t = 1;
    //cin >> t;
    while(t--)
        solve();
}

Measured memory_bytes: 3636
#include<iostream>
#include<algorithm>
#include<cmath>
#include<numeric>

using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;

int N;
ll A[100000];

int main() {
	cin >> N;
	for (int i = 0; i < N; i++)cin >> A[i];
	sort(A, A + N);
	ll M = 0;
	if (N == 2) {
		cout << A[1] - A[0] << endl;
		cout << A[1] << " " << A[0] << endl;
		
	}else 
	if (A[0] >= 0) {
		M -= A[0];
		M += accumulate(A + 1, A + N, 0);
		cout << M << endl;

		cout << A[0] << " " << A[2] << endl;
		ll cur = A[0] - A[2];
		for (int i = 3; i < N; i++) {
			cout << cur << " " << A[i] << endl;
			cur = cur - A[i];
		}
		cout << A[1] << " " << cur << endl;
	}
	else if (A[N - 1] <= 0) {
		M += A[N - 1];
		M += accumulate(A, A + N - 1, 0) * -1;
		cout << M << endl;

		ll cur = A[N - 1] - A[0];
		cout << A[N - 1] << " " << A[0] << endl;
		for (int i = 1; i < N - 1; i++) {
			cout << cur << " " << A[i] << endl;
			cur = cur - A[i];
		}
	}
	else {
		ll mm = A[N - 1], MM = A[0];
		for (int i = 0; i < N; i++)M += abs(A[i]);
		cout << M << endl;

		for (int i = 1; i < N - 1; i++) {
			if (A[i] < 0) {
				cout << mm << " " << A[i] << endl;
				mm -= A[i];
			}
			else {
				cout << MM << " " << A[i] << endl;
				MM -= A[i];
			}
		}
		cout << mm << " " << MM << endl;
	}
	return 0;
}

Measured memory_bytes: 2688
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <forward_list>

using namespace std;

typedef long long ll;
typedef vector<long long> vi;
typedef pair<long long, long long> ii;
typedef vector<pair<long long, long long>> vii;
typedef stringstream ss;
ll mil() { return numeric_limits<long long>::min(); }
ll mal() { return numeric_limits<long long>::max(); }

#define R3(i, a, b) for (long long i = (a); i < (b); ++i)
#define R2(i, b) for (long long i = 0; i < (b); ++i)
#define R1(b) for (long long i = 0; i < (b); ++i)
#define RR(i, a, b) for (long long i = a; i > b; --i)
#define PB(x) push_back(x)
#define MP(x, y) make_pair(x, y)

// build: ctrl + f9

// run: shift + f10
// sanitize: shift + f11
// debug: shift + f9

int main()
{
    ll K, A, B;
    cin >> K >> A >> B;

    for(ll i = A; i <= B; ++i) {
        if(i%K == 0) {
            cout << "OK" << endl;
            return 0;
        }
    }

    cout << "NG" << endl;
    return 0;
}

Measured memory_bytes: 3652
n = int(input())

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

ls = sorted(ls)
ans = 0
for i in range(n-2):
  for j in range(i+1,n-1):
    if ls[i]==ls[j]:
      continue
    for k in range(j+1,n):
      if ls[j]==ls[k]:
        continue
      if ls[i]+ls[j]>ls[k]:
        ans+=1
        
print(ans)
  
          

Measured memory_bytes: 9184
using System;

namespace ABC140
{
    class D
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            string s = Console.ReadLine();

            int N = int.Parse(input[0]);
            int K = int.Parse(input[1]);

            int socre = 0;
            for (int i = 1; i < N; i++)
            {
                if (s[i] == s[i - 1]) socre++;
            }

            Console.WriteLine(Math.Min(socre + 2 * K, N - 1));
        }
    }
}


Measured memory_bytes: 13280
n = int(input())
s = [0]
mins = 1000
for i in range(n):
    tmp = int(input())
    s.append(tmp)
    if tmp%10!=0:
        mins = min(mins,tmp)
if sum(s)%10==0:
    if mins == 1000:
        print(0)
    else:
        print(sum(s)-mins)
else:
    print(sum(s))
    

Measured memory_bytes: 9116
/*author* Priyanshu Shrivastav (from IIT Palakkad) *
 * *_ __ ___  _ ______ ___  _ ____   ___  ___| |_  *
 * | '_ ` _ \| '__/ __/ _ \| '_ \ \ / / |/ __| __| *
 * | | | | | | | | (_| (_) | | | \ V /| | (__| |_  *
 * |_| |_| |_|_|(_)___\___/|_| |_|\_/ |_|\___|\__| *
When I wrote this, only God and I understood what I was doing
 ** * * * * * * * Now, only God knows * * * * * * */
#include         <bits/stdc++.h>
using namespace std;
#pragma GCC      optimize ("Ofast")
#pragma GCC      optimize ("unroll-loops")
#pragma GCC      target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define IOS      ios_base::sync_with_stdio(false); cin.tie (nullptr)
#define PREC     cout.precision (10); cout << fixed
#define bg(x)    " [ " << #x << " : " << (x) << " ] "
#define x        first
#define y        second
using ll = long long;
using ff = long double;
using pii = pair<int,int>;

#define debug(args...) { \
/* WARNING : do NOT compile this debug func calls with following flags: // \
 * // -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC -D_FORTIFY_SOURCE=2*/ \
   string _s = #args; replace(_s.begin(), _s.end(), ',', ' ');\
   stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); \
}
void err(istream_iterator<string> it) { it->empty();
   cerr << " (Line : " << __LINE__ << ")" << '\n';
}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << fixed << setprecision(15) << " [ " <<  *it << " : " << a  << " ] "<< ' ';
	err(++it, args...);
}

const int N = 3004;
int dp[N][N], par[N][N];
string s, t;
int n, m;

void solve() {
   for (int i = 0; i <= n; ++i) dp[i][0] = 0, par[i][0] = -2;
   for (int j = 0; j <= m; ++j) dp[0][j] = 0, par[0][j] = -2;

   for (int i = 1; i <= n; ++i) {
      for (int j = 1; j <= m; ++j) {
         if (s[i] == t[j]) {
            dp[i][j] = dp[i-1][j-1] + 1;
            par[i][j] = 0;
         }
         else {
            if (dp[i-1][j] > dp[i][j-1]) {
               dp[i][j] = dp[i-1][j];
               par[i][j] = -1;
            }
            else {
               dp[i][j] = dp[i][j-1];
               par[i][j] = 1;
            }
         }
      }
   }

   string longest_ssq = "";
   int i = n, j = m;
   while (par[i][j] != -2) {
      if (par[i][j] == 0) {
         longest_ssq += s[i];
         --i, --j;
      }
      else if (par[i][j] == -1) --i;
      else if (par[i][j] == 1) --j;
   }
   reverse(longest_ssq.begin(), longest_ssq.end());
   cout << longest_ssq << '\n';
}

signed main() {
   IOS; PREC;
   cin >> s >> t;
   n = (int)s.size(), m = (int)t.size();
   s = " " + s, t = " " + t;
   solve();

   return EXIT_SUCCESS;
}


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

int main() {
    string S, T;
    cin >> S >> T;
    int s_len=S.size(), t_len=T.size();
    string s_copy;

    for (int i = s_len-t_len; i >= 0; i--) {
        s_copy = S.substr(0, s_len);
        bool f = true;

        for (int j = 0; j < t_len; j++) {
            if (s_copy.at(i+j) == T.at(j) || s_copy.at(i+j) == '?') {
                s_copy.at(i+j) = T.at(j);
            } else {
                f = false;
                break;
            }
        }

        if (f) {
            for (int j = 0; j < s_len; j++) {
                if (s_copy.at(j) == '?') {
                    s_copy.at(j) = 'a';
                }
            }

            cout << s_copy << endl;
            return 0;
        }
    }

    cout << "UNRESTORABLE" << endl;
    return 0;
}

Measured memory_bytes: 256
main :: IO()
main = do
    s <- getLine
    t <- getLine
    print $ getsolve s t
    
getsolve :: String -> String -> Int
getsolve s t
    | s == [] = 0
    | head s == head t = 1 + getsolve (tail s) (tail t)
    | otherwise = getsolve (tail s) (tail t)

Measured memory_bytes: 380
n = int(input())
arr = list(map(int, input().split()))
sorted_arr = sorted(arr)

counter = 0
for i in range(n):
    if arr[i] != sorted_arr[i]:
        counter += 1
    if counter > 2:
        break

if counter == 2 or counter == 0:
    print("YES")
else:
    print("NO")

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

int nis[12];

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

    for (int i = 0; i < d; i++) {
        int tmp;
        cin >> tmp;
        nis[tmp] = 1;
    }

    vector<int> num;
    while (n) {
        int rem = n % 10;
        num.push_back(rem);
        n /= 10;
    }

    reverse(num.begin(), num.end());

    bool hoyse = false;
    for (int i = 0; i < (int)num.size(); i++) {
        bool flg = false;
        for (int j = 0; j <= 9; j++) {
            if (!nis[j]) {
                if (j >= num[i] || hoyse) {
                    flg = true;
                    if (j > num[i]) hoyse = true;
                    cout << j;
                    break;
                }
            }
        }
        if (!flg) for (int jj = 0; jj <= 9; jj++) if (!nis[jj]) {cout << jj << jj; hoyse = true; break;}
    }
}


Measured memory_bytes: 256
// B.

#include <iostream>
#include <algorithm>

using namespace std;

int main(int argc, char *argv[]) {
	int n;
	cin >> n;
	int a[100000], b[100000];
	for (int i = 0; i < n; ++i) {
		cin >> a[i] >> b[i];
	}
	sort(a, a + n);
	sort(b, b + n);
	int ans = a[n - 1] + b[0];
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1024
#include<iostream>
int main()
{
	int a,b,c;
	std::cin>>a>>b>>c;
	
	int min;
	if(a<b&&a<c)min=a;
	else if(b<a&&b<c)min=b;
	else if(c<a&&c<b)min=c;
	
	int max;
	if(a>b&&a>c)max=a;
	else if(b>a&&b>c)max=b;
	else if(c>a&&c>b)max=c;
	
	std::cout<<min<<' '<<a+b+c-min-max<<' '<<max<<std::endl;
	return 0;
}


Measured memory_bytes: 3100
#include <bits/stdc++.h>
// #pragma GCC optimization ("O3,unroll-loops")
// #pragma GCC target ("avx,avx2,fma")
using namespace std;

#define _ << ": " <<
#define watch1(var1) (cerr << (#var1) _ var1 << '\n')
#define watch2(var1, var2) cerr << (#var1) _ var1 << ", " << (#var2) _ var2 << '\n';
#define watch3(var1, var2, var3) cerr << (#var1) _ var1 << ", " << (#var2) _ var2 << ", " << (#var3) _ var3 << '\n';
#define wloop(size, arr) cerr << (#arr) << ": "; for (int i = 0; i < size; i++) cerr << arr[i] << " \n"[i+1 == size];

template<typename... Args>
void read(Args&... args) { ((cin >> args), ...); }

template<typename... Args>
void show(Args... args) { ((cout << args << " "), ...); }

#define ints(a...) int a; read(a)
#define longs(a...) int64_t a; read(a)

const string A = "abcdefghijklmnopqrstuvwxyz";

void solve() {
    longs(n);
    array<short, 100000> v;
    int pos = 0;
    while (n) {
        n--;
        v[pos++] = n % 26;
        n /= 26;
    }
    for (int i = pos - 1; ~i; i--) cout << char(v[i] + 'a');
}

int32_t main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int T = 1; 
    // cin >> T;
    while (T--) solve();
    return 0;
}

Measured memory_bytes: 3696
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
using ll = long long;
using namespace std;
template <typename T>
using vec = std::vector<T>;

#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) { cout << #v << "=" << endl; rep(i_debug, v.size()) { cout << v[i_debug] << ",";}cout << endl; }
#define mdebug(m) { cout << #m << "=" << endl; rep(i_debug, m.size()) { rep(j_debug, m[i_debug].size()) { cout << m[i_debug][j_debug] << ","; } cout << endl; } }

int main() {
    ll N, C;
    cin >> N >> C;
    vec<ll> x(N);
    vec<ll> v(N);
    rep(i, N) cin >> x[i] >> v[i];

    vec<ll> lcal(N);
    vec<ll> rcal(N);
    lcal[0] = v[0] - x[0];
    rcal[0] = v[N-1] - (C - x[N-1]);
    for (int i = 1; i < N; ++i){
        lcal[i] = v[i] - (x[i]-x[i-1]) + lcal[i - 1];
        rcal[i] = v[N-1-i] - (x[N-i] - x[N-1-i]) + rcal[i-1];
    } 

    vec<ll> lcals(N);
    vec<ll> rcals(N);
    lcals[0] = lcal[0];
    rcals[0] = rcal[0];

    for (int i = 1; i < N; ++i){
        lcals[i] = max(lcals[i-1],lcal[i]);
        rcals[i] = max(rcals[i-1],rcal[i]);
    }

    ll mxl = lcals[N-1];
    ll mxr = rcals[N-1];
    ll mxlr = 0;
    ll mxrl = 0;

    rep(i,N-1){
        ll tmplr = lcal[i] - x[i] + rcals[N-1-i-1];
        ll tmprl = rcal[i] - (C- x[N-1-i]) + lcals[N-1-i-1];
        // printf("tmplr = %lld - %lld + %lld = %lld\n",lcal[i],x[i],rcals[N-1-i],tmplr);
        // printf("tmprl = %lld - %lld + %lld = %lld\n",rcal[i],(C- x[N-1-i]),lcals[i],tmprl);
        mxlr = max(mxlr,tmplr);
        mxrl = max(mxrl,tmprl);
    }
    cout << max({mxl,mxr,mxlr,mxrl}) << endl;

}


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

struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;

/* cpp template {{{ */

/* short */
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define X real()
#define Y imag()

/* REPmacro */
#define REPS(i, a, n) for (ll i = (a); i < (ll)(n); ++i)
#define rep(i, n) REPS(i, 0, n)
#define REP0(i,n) for (ll i = 0; i <= (ll)(n); ++i)
#define REP1(i,n) for (ll i = 1; i <= (ll)(n); ++i)
#define RREP(i, n) REPS(i, 1, n + 1)
#define DEPS(i, a, n) for (ll i = (a); i >= (ll)(n); --i)
#define DEP(i, n) DEPS(i, n, 0)
#define EACH(i, n) for (auto&& i : n)

/* debug */
#define debug(x) cerr << x << " " << "(L:" << __LINE__ << ")" << '\n';

/* alias */
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<int, int>;
using D = double;
using P = complex<D>;
using vs = vector<string>;
template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

/* const */
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;
const D EPS = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

/* func */
inline bool inside(int y, int x, int H, int W) {return y >= 0 && x >= 0 && y < H && x < W;}
inline int in() {int x; cin >> x; return x;}
inline ll IN() {ll x; cin >> x; return x;}
inline vs split(const string& t, char c) {vs v; stringstream s(t); string b; while(getline(s, b, c)) v.eb(b); return v;}
template <typename T> inline bool chmin(T& a, const T& b) {if (a > b) a = b; return a > b;}
template <typename T> inline bool chmax(T& a, const T& b) {if (a < b) a = b; return a < b;}
template <typename T, typename S> inline void print(const pair<T, S>& p) {cout << p.first << " " << p.second << endl;}
template <typename T> inline void print(const T& x) {cout << x << '\n';}
template <typename T, typename S> inline void print(const vector<pair<T, S>>& v) {for (auto&& p : v) print(p);}
template <typename T> inline void print(const vector<T>& v, string s = " ") {rep(i, v.size()) cout << v[i] << (i != (ll)v.size() - 1 ? s : "\n");}

signed main() 
{
  string s[3];
  rep(i,3) cin>>s[i];
  int now=0;
  while(1)
  {
    if(s[now].size()==0)
    {
      if(now==0) print('A');
      else if(now==1) print('B');
      else print('C');
      return 0;
    }
    int tmp=now;
    now=s[tmp][0]-'a';
    s[tmp].erase(s[tmp].begin());
  }

  return 0;
}

Measured memory_bytes: 256
n = int(input())
li = list(map(int, input().split(' ')))

cnt = 0
num = 1
for i in range(len(li)):
    if li[i] != num:
        cnt += 1
    else:
        num += 1

if len(li) != cnt:
    print(cnt)
else:
    print(int(-1))


Measured memory_bytes: 24744
#include<stdio.h>
int main(){
  int N,M;
  scanf("%d",&N);
  int T[N];
  int sum = 0;
  for(int i = 0;i < N;i++){
    scanf("%d",&T[i]);
    sum += T[i];
  }
  scanf("%d",&M);
  int P[M],X[M];
  for(int i = 0;i < M;i++){
    scanf("%d %d",&P[i],&X[i]);
    printf("%d\n",sum - T[P[i] - 1] + X[i]);
  }
  return 0;
}

Measured memory_bytes: 128
#include <algorithm>
#include <cassert>
#include <iostream>
#include <vector>
using namespace std;

int N;
vector<vector<int>> A;
vector<long long> mask_value, dp;

int main() {
    scanf("%d", &N);
    A.assign(N, vector<int>(N));

    for (int i = 0; i < N; i++)
        for (int j = 0; j < N; j++)
            scanf("%d", &A[i][j]);

    mask_value.assign(1 << N, 0);

    for (int mask = 0; mask < 1 << N; mask++)
        for (int i = 0; i < N; i++)
            if (mask >> i & 1)
                for (int j = i + 1; j < N; j++)
                    if (mask >> j & 1)
                        mask_value[mask] += A[i][j];

    dp = mask_value;

    for (int mask = 0; mask < 1 << N; mask++) {
        int sub_mask = mask;

        do {
            dp[mask] = max(dp[mask], dp[sub_mask] + dp[mask ^ sub_mask]);
            sub_mask = (sub_mask - 1) & mask;
        } while (sub_mask != mask);
    }

    printf("%lld\n", dp[(1 << N) - 1]);
}


Measured memory_bytes: 1408
s=input()
if s=="SUN":
  print(7)
elif s=="MON":
  print(6)
elif s=="TUE":
  print(5)
elif s=="WED":
  print(4)
elif s=="THU":
  print(3)
elif s=="FRI":
  print(2)
elif s=="SAT":
  print(1)

Measured memory_bytes: 2940
#define _USE_MATH_DEFINES

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>

using namespace std;

typedef pair<long long int, long long int> P;
long long int INF = 1e18;

double round_(double d){
	double ret = (int)(abs(d) * 1000 * 2 + 1) / 2 / 1000.0;
	ret *= d / abs(d);
	return ret;
}

int main()
{
    const double EPS = 1.0e-10;
    double a,b,c,d,e,f;
    double x1,x2,x3,y1,y2,y3;
    double x,y,r;
    int n;
	cin >> n;
    for(int i = 0; i < n; i++){
    	cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
        a = x1 - x2;
        b = y1 - y2;
        c = (x1 * x1 + y1 * y1 - x2 * x2 - y2 * y2) / 2;
        d = x1 - x3;
        e = y1 - y3;
        f = (x1 * x1 + y1 * y1 - x3 * x3 - y3 * y3) / 2;
        x = (e * c - b * f) / (a * e - b * d);
        y = (a * f - d * c) / (a * e - b * d);
    	r = sqrt((x1 - x) * (x1 - x) + (y1 - y) * (y1 - y));
    	x = round_(x);
    	y = round_(y);
    	r = round_(r);
//        if(-0.0005 < x && x < 0.0+EPS) x = 0.0;
//        if(-0.0005 < y && y < 0.0+EPS) y = 0.0;
 
        printf("%.3f %.3f %.3f\n",x,y,r);
    }
    return 0;
}


Measured memory_bytes: 3056
N, x = map(int, input().split())
a = list(map(int, input().split()))
ans = 0
if a[0] > x:
    ans = a[0] - x
    a[0] = x

for i in range(N-1):
    if a[i+1] + a[i] > x:
        ans += (a[i+1] + a[i] - x)
        a[i+1] = x - a[i]

print(ans)

Measured memory_bytes: 14540
#include <bits/stdc++.h>
using namespace std;
int main()
{	
	int w,x,y,z;
	cin >> w >> x >> y >> z;
	if(w+x<y+z){cout << "Right" << endl;}
    else if(w+x>y+z){cout << "Left" << endl;}
    else{cout << "Balanced" << endl;}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rrep(i,n) for(int i=(n)-1; i>=0; i--)
#define FOR(i,a,b) for(int i=(a); i<(b); i++)
#define RFOR(i,a,b) for(int i=(b-1); i>=(a); i--)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define pb push_back
using ll = long long;
using D = double;
using LD = long double;
using P = pair<int, int>;
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; }

int main(){
    ll x; cin >> x;
    ll vec[4005];
    vec[0] = 100;
    rep(i,4000){
        if(vec[i] >= x){
            cout << i << endl;
            return 0;
        }
        vec[i+1] = vec[i] * 1.01;
    }
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define hell 1000000007
#define PI 3.14159265358979323846
#include <fstream>
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t=1;
    //cin>>t;
    while(t--) {
     ll n,i,mx;
     cin>>n;
     ll arr[n+1];
     for(i=0;i<n;i++)
        cin>>arr[i];
     mx=arr[0];
     ll s=0;
     for(i=1;i<n;i++)
     {
         mx=max(mx,arr[i]);
         s+=mx-arr[i];
     }
     cout<<s;
    }
}


Measured memory_bytes: 5180
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int d[n];
    for(int i=0;i<n;i++)
    {
        cin>>d[i];
    }
    sort(d,d+n);
    cout<<d[n/2]-d[n/2-1];
    return 0;
}


Measured memory_bytes: 640
fun main(args : Array<String>){
    val s = readLine()
    var a = s!!.split("") //!!がないとよくないらしい

    for(i in 0..3) if (a[i] == "7") {       //[,1,2,3,]になる。ので４回まわす。よくわからない。よくない。
        println("Yes")
    return
    }
    println("No")
}

Measured memory_bytes: 39712
#include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;
using ll = long long;
ll t, n, d, ret;
const int N = 1010;
ll bus[N];
int main() {
    double r;
    cin >> r;
    cout << 3.1415926*r*2 << endl;
    return 0;
}

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

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    int n; cin >> n;
    int sum = 0;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        sum += a[i];
    }
    if (sum % 10 != 0) {
        cout << sum << '\n';
    }
    else {
        int mx = 0;
        for (int i = 0; i < n; i++) {
            mx = max(mx,(sum-a[i]) % 10 == 0 ? 0 : sum-a[i]);
        }
        cout << mx << '\n';
    }
}



Measured memory_bytes: 256
import java.io.*;
import java.util.*;

public class Main {
	static final int MOD = (int)1e9+7;

	public static void main(String[] args){
		FastScanner sc = new FastScanner(System.in);
		PrintWriter out = new PrintWriter(System.out);

		solve(sc,out);

		out.flush();
	}
	
	public static void solve(FastScanner sc, PrintWriter out) {
		int n = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();
		
		out.println(Math.min(n*a, b));
	}

	public static long gcd(long a, long b) {
		if(a < b) return gcd(b, a);
		if(b == 0) return a;
		return gcd(b, a % b);
	}

	public static long lcm(long a, long b) {
		return a / gcd(a, b) * b;
	}

	public static long factorial(int n) {
		long a;

		if(n > 0) {
			a = n * factorial(n - 1);
		}else{
			a = 1;
		}

		return a;
	}
}

class Pair<K, V> extends AbstractMap.SimpleEntry<K, V> {

    public Pair(K key, V value) {
        super(key, value);
    }

    public Pair<V, K> swap() {
    	return new Pair<V, K>(getValue(), getKey());
    }
 }

class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;

    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

    public String next() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }

        return tokenizer.nextToken("\n");
    }

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

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

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

    public int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = nextInt();
        return a;
    }

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++)
            a[i] = nextLong();
        return a;
    }
}

Measured memory_bytes: 21332
/*
    Life Before Death, Strength Before Weakness, Journey Before Destination
    ------------------------------------------------------------------------
    You don't become great by trying to be great.
    You become great by wanting to do something,
    and then doing it so hard that you become great in the process.
    */

    //#pragma comment(linker, ack:200000000")
    //#pragma GCC optimize ("Ofast")
    //#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
    #include <bits/stdc++.h>
    using namespace std;
    #define PI           3.141592653589793238462643383279502884197169399  /* pi */
    typedef long long ll;
    const int maxN = 100100;
    
    void solve() {
        ll n, cnt = 0;
	cin >> n;
	for(ll i=10; n >= i; i*=5) cnt += (n/i);
	cout << (n%2 ? 0 : cnt) << endl;
    }

    int main() {
      cin.sync_with_stdio(0); cin.tie(0);
      cin.exceptions(cin.failbit);
      //ll ti;   cin >> ti;  while(ti--)
      solve();
      return 0;
    }


Measured memory_bytes: 256
import qualified Data.ByteString.Char8 as B
import Data.Char
import Data.List

import Data.Array
import Data.Array.ST
import Control.Monad
import Control.Monad.ST

a#b = abs$a-b

main = B.interact$B.pack.show.f.unfoldr(B.readInt.B.dropWhile isSpace)
f (n:k:hr)=runST $ do
    dp <- newListArray (1,n) (0:repeat maxBound)::ST s (STUArray s Int Int)
    forM_ [(i,j)|i<-[1..n-1], j<-[i+1..min (i+k) n]] $ \(i,j)->do
        c <- (+ (hv ! j)#(hv ! i)) <$> readArray dp i
        writeArray dp j =<< min c <$> readArray dp j
    readArray dp n
    where
        hv = listArray (1,n) hr

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


#----------
N = int(input().strip())
A_list = list(map(int, input().rstrip().split()))
#----------

count=0
for i in A_list:
    if (i % 2) != 0:
        count += 1

if (count % 2) == 0:
    result = "YES"
else:
    result = "NO"

print(result)


Measured memory_bytes: 14108
#include<bits/stdc++.h>
#define cs const
#define pb push_back
using namespace std;
cs int Mod = 1e9 + 7;
int add(int a, int b){ return a + b >= Mod ? a + b - Mod : a + b; }
int dec(int a, int b){ return a - b < 0 ? a - b + Mod : a - b; }
int mul(int a, int b){ return 1ll * a * b % Mod; }
void Add(int &a, int b){ a = add(a,b); }
void Mul(int &a, int b){ a = mul(a,b); }
void Dec(int &a, int b){ a = dec(a,b); }
int ksm(int a, int b){ int as=1; for(;b;b>>=1,Mul(a,a))if(b&1)Mul(as,a); return as; }
cs int N = 5e3 + 50;
int n, A, B, dp[N][2], f[N][2];
int main(){
	#ifdef FSYolanda
	freopen("1.in","r",stdin);
	#endif
	scanf("%d%d%d",&n,&A,&B);
	if(A > B) swap(A,B);
	f[1][1] = 1;
	for(int i=2; i<B; i++){
		Add(f[i][1],add(f[i-1][0],f[i-1][1]));
		for(int j=A; j<i; j++)
		Add(f[i][0],f[i-j][1]);
	} dp[0][0] = dp[0][1] = 1;
	for(int i=1; i<=n; i++){
		for(int j=1; j<min(A,i+1); j++)
		Add(dp[i][0],dp[i-j][1]);
		for(int j=1; j<min(B,i+1); j++){
			if(i==n)Add(dp[i][0],mul(dp[i-j][0],f[j][0]));
			if(i==j)Add(dp[i][1],add(f[j][0],f[j][1]));
			else Add(dp[i][1],mul(dp[i-j][0],f[j][1]));
		}
	} cout<<dec(ksm(2,n),add(dp[n][0],dp[n][1]));
	return 0;
}

Measured memory_bytes: 3728
#include <iostream>
#include <vector>

using namespace std;

int main(){
    int N, H, W, i, j=0;

    cin >> N >> H >> W;

    vector< pair<int, int> > p(N);

    for (i=0; i<N; i++){
        cin >> p[i].first;
        cin >> p[i].second;
    }
    
    for (i=0; i<N; i++){
        if (p[i].first >= H && p[i].second >= W) j++;
    }

    cout << j << '\n';

}

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

#define rep(i, N) for (int i = 0; i < N; i++)

using ll = long long int;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
int main()
{
    int N;
    cin >> N;
    vector<int> B(N - 1);
    rep(i, N - 1) cin >> B[i];

    vector<int> A(N);
    A[0] = B[0];
    rep(i, N - 2)
    {
        A[i + 1] = min(B[i], B[i + 1]);
    }
    A[N - 1] = B[N - 2];

    cout << accumulate(A.begin(), A.end(), 0) << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>

int main(){
  int i,j,n,s[100],max,min,ans;

  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&s[i]);
  }
  max = 0;
  min = 1000;

  for(j=0;j<n;j++){
    if(s[j]>=max){
      max=s[j];
    }
    if(s[j]<=min){
      min = s[j];
    }
  }
  ans=max-min;
  printf("%d",ans);
}


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

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

    vector<int> a(n);
    for (int& x : a) cin >> x;
    sort(a.rbegin(), a.rend());

    int b = 0, c = 0;
    for (int i = 0; i < n; i++) {
        (i % 2 ? c : b) += a[i];
    }

    cout << b - c << endl;

    return 0;
}


Measured memory_bytes: 256
[X,Y] = list(map(int,input().split()))

n = (-1*X+2*Y)//3
m = (2*X-Y)//3

if (X+Y)%3 !=0:
    print(0)

elif n<0 or m<0:
    print(0)

else:
    MAXN = (10**6)+10
    MOD = 10**9 + 7
    f = [1]
    for i in range(MAXN):
        f.append(f[-1] * (i+1) % MOD)
    def nCr(n, r, mod=MOD):
        return f[n] * pow(f[r], mod-2, mod) * pow(f[n-r], mod-2, mod) % mod


    print(nCr(n+m,n,10**9 + 7))


Measured memory_bytes: 140700
N, K = [int(s) for s in raw_input().split(" ")]
S = raw_input()

res, same, diff = 0, 0, 0
for i in xrange(len(S)-1):
    if S[i+1] == S[i]:
        same += 1
    else:
        diff += 1

res = same + min(diff, K* 2)
print(res)

Measured memory_bytes: 2820
#include<bits/stdc++.h>
#define pb push_back
#define It set<node>::iterator
#define endl '\n'
#define fastio ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;

const int maxn=2e5+10;

int n;
string s;
int mx;
map<string,int> mp;
vector<string> v;

int main(){
	cin>>n;
	for(int i=1;i<=n;++i){
		cin>>s;
		mp[s]++;
		mx=max(mx,mp[s]);
	}
	for(map<string,int>::iterator it=mp.begin();it!=mp.end();++it){
		if(it->second==mx) v.pb(it->first);
	}
	sort(v.begin(),v.end());
	for(int i=0;i<v.size();++i) cout<<v[i]<<endl;
	return 0;
}

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

int main (){
  int D, L, n, m;
  cin>> D >> L >> n >> m;
  if ( D%L == 0 ){
    n=D/L;

    cout<< n << endl;
  }else{
    n=D/L;
    m=D-L*n;

    cout<< m+n << endl;
    }
  return 0;
}



Measured memory_bytes: 3112
n = int(input())
bL = list(map(int,input().split()))

aL = []
bL.reverse()
if len(bL) == 1:
    aL.append(bL[0]*2)
else:
    aL.append(bL[0])
    for i in range(len(bL)):
        if i == len(bL) - 1:
            aL.append(bL[i])
        else:
            aL.append(min(bL[i],bL[i+1]))
print(sum(aL))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <cstdio>
#include <cstdlib>
using namespace std;
int main() {
    char s[100];
    fgets(s,20,stdin);
    for(int i=0 ; s[i] ; i++){
        if(s[i]==',') printf(" ");
        else printf("%c",s[i]);
    }
    return 0;
}


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

typedef unsigned long long ll;
#define mod 1000000007
#define all(x) (x).begin(),(x).end()

void solve(){
	int n;
	cin>>n;
	vector<int> v(n);	
	long long ans=0;
	for(int &i:v){
		cin>>i;
		ans += i;
      	ans %= mod;
	}	
	long resp = 0;
	for(size_t i:v){
		ans -= i;      
		if(ans < 0) ans += mod;          
		resp += (i * ans);
        resp %= mod;
	}
	cout<<resp<<endl;
}


int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  solve();
  return 0;
}


Measured memory_bytes: 3992
package main

import "fmt"

func main() {

	var X int64
	fmt.Scan(&X)

	var r1, r2, ret int
	r1 = (int)(X / 500)
	r2 = (int)((X - int64(r1*500)) / 5)
	ret = r1*1000 + r2*5

	fmt.Println(ret)
}


Measured memory_bytes: 512
import java.util.Scanner;

// 基数変換　to-2進数
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        String s = "";

        while(N != 0) {
            int r = N % 2;
            if(r < 0) r += 2;
            N = (N - r) / (-2);

            s += r;
        }
        StringBuffer sb = new StringBuffer(s);
        String str = sb.reverse().toString();

        if(str.isEmpty()){
            str = "0";
        }
        System.out.println(str);
    }
}


Measured memory_bytes: 39228
#include <stdio.h>
main(){
  int i, a, b;

  scanf("%d %d", &a, &b);
  if(a > b)
    for(i = a % b;i > 1;i--){
      if( (a % i) == 0 && (b % i) == 0) break;
    }
  else if(b > a)
    for(i = b % a;i > 1;i--){
      if( (a % i) == 0 && (b % i) == 0) break;
    }
  else
    i = a;
  printf("%d\n", i);
  return 0;
}

Measured memory_bytes: 592
#include<bits/stdc++.h>
using namespace std;
int main()
{
    char s[100005],s1[100005];
    int a[100005],n,i;
    double c = 1.0,tot=0;
    scanf("%d",&n);
    for(i=0;i<n;i++)
    scanf("%d",&a[i]),tot+=c/a[i];
    printf("%lf",c/tot);
    
}

Measured memory_bytes: 256
while(True):
    s = input()
    t = s.split()
    H,W=int(t[0]),int(t[1])
    if H==W==0:
        break
    else:
        print('#'*W)
        for i in range(1,H-1):
            x = '#'+'.'*(W-2)+'#'
            print(x)
        else:
            print('#'*W)
            print('')
            


Measured memory_bytes: 5612
#include <iostream>
#include <string>
#include <vector>
using namespace std;
const string MINUSINF = "-";

void chmax(string &a, string b) {
    if (a == MINUSINF) a = b;
    else if (a.size() < b.size()) a = b;
    else if (a.size() == b.size()) {
        if (a < b) a = b;
    }
}

long long match[10] = {2,5,5,4,5,6,3,7,6};
string dp[11000];

int main() {
    int N, M; cin >> N >> M;
    vector<int> A(M);
    for (int i = 0; i < M; ++i) cin >> A[i];

    // 初期化
    for (int i = 0; i < 11000; ++i) dp[i] = MINUSINF;

    // 初期条件
    dp[0] = "";

    // DP ループ
    for (int i = 0; i <= N; ++i) {
        if (dp[i] == MINUSINF) continue;
        for (auto a : A)  chmax(dp[i+match[a-1]], dp[i] + (char)('0' + a));
    }
    cout << dp[N] << endl;
}

Measured memory_bytes: 30464
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef priority_queue<int> PQ;
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));
//priority_queue<int,vector<int>, greater<int> > q2;



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

	int N;
	string S;
	cin >> N >> S;

	int dp[5010][5010] = { 0 };
	REP(i, N) {
		int cnt = 1;
		FOR(j, i + 1, N) {
			if (i == 0) {
				if (S[i] == S[j]) {
					dp[i][j] = 1;
				}
				continue;
			}
			if (S[i] == S[j]) {
				dp[i][j] = min(dp[i - 1][j - 1] + 1, cnt);
			}
			cnt++;
		}
	}
	int ans = 0;
	REP(i, N) {
		REP(j, N) {
			ans = max(ans, dp[i][j]);
		}
	}
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 196480
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define MOD 1000000007
#define MAX 1000000007
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define ub upper_bound
#define lb lower_bound
#define zoom ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define precise cout.precision(8); cout << fixed;
#define seed srand(chrono::steady_clock::now().time_since_epoch().count());
const double PI = acos(-1);
using namespace std;

void solve() {
    int N, i; cin >> N;
    map<unsigned char, int> look;
    look['A'] = 0;
    look['W'] = 0;
    look['T'] = 0;
    look['R'] = 0;
    for(i = 0; i < N; i += 1) {
        string x; cin >> x;
        look[x[0]] += 1;
    }
    cout << "AC x " << look['A'] << endl;
    cout << "WA x " << look['W'] << endl;
    cout << "TLE x " << look['T'] << endl;
    cout << "RE x " << look['R'];
}

int main() {
    int t = 1;
    //cin >> t;
    while(t--) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 3632
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
#define FOR(i,a,b) for(int (i)=(a); (i)<=(b); (i)++)
#define REP(i,N) FOR((i), 0, (N)-1)

int main(){
    int N,M,C,ans=0;
    int A[30],B[30];
    cin >> N >> M >> C;
    REP(i,M) cin >> B[i];
    REP(i,N){
        int sum = 0;
        REP(i,M){
            cin >> A[i];
            sum += A[i]*B[i];
        }
        if(sum+C > 0) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
class Solve{
    public Solve(){}
    StringBuilder sb;
    public static int Main(){
        new Solve().Run();
        return 0;
    }
    void Run(){
        sb = new StringBuilder();
        Calc();
        Console.Write(sb.ToString());
    }
    void Calc(){
        string[] str = Console.ReadLine().Split(' ');
        int V = int.Parse(str[0]);
        int E = int.Parse(str[1]);
        long[,] cost = new long[V,V];
        for(int i=0;i<V;i++){
            for(int j=0;j<V;j++){
                cost[i,j] = 1000000;
            }
        }
        for(int i=0;i<E;i++){
            str = Console.ReadLine().Split(' ');
            int s = int.Parse(str[0]);
            int t = int.Parse(str[1]);
            int d = int.Parse(str[2]);
            cost[s,t] = d;
        }
        long[,] DP = new long[1<<V,V];
        for(int i=1;i<V;i++){
            DP[0,i] = 1000000;
        }
        for(int i=1;i<1<<V;i++){
            for(int j=0;j<V;j++){
                if(((1 << j) & i) != 0){
                    DP[i,j] = 1000000;
                }
                else{
                    long min = 1000000;
                    for(int k=0;k<V;k++){
                        if(((1 << k) & i) != 0){
                            min = Math.Min(min,DP[i-(1 << k),k]+cost[k,j]);
                        }
                    }
                    DP[i,j] = min;
                }
            }
        }
        {
            long min = 1000000;
            for(int i=1;i<V;i++){
                min = Math.Min(min,DP[(1<<V)-1-(1<<i),i]+cost[i,0]);
            }
            if(min == 1000000){
                min = -1;
            }
            sb.Append(min+"\n");
        }
    }
}

Measured memory_bytes: 13032
#include <stdio.h>

class Dice3{
public:
	Dice3(){
		number = new int[6];
		checkTable = new int[101];
		for(int i = 0; i < 101; i++) checkTable[i] = -1;
	};
	~Dice3(){
		delete[] number;
		delete[] checkTable;
	};

	void setLabel(int index,int num){
		number[index] = num;
		checkTable[num] = index;
	};

	void roll(char dst){
		switch(dst){
		case 'E':
			setNumber(number[3],number[1],number[0],number[5],number[4],number[2]);
			break;
		case 'N':
			setNumber(number[1],number[5],number[2],number[3],number[0],number[4]);
			break;
		case 'S':
			setNumber(number[4],number[0],number[2],number[3],number[5],number[1]);
			break;
		case 'W':
			setNumber(number[2],number[1],number[5],number[0],number[4],number[3]);
			break;
		}
	};

	bool isValidMember(int inputed[]){
		for(int i = 0; i < 6; i++)
		{
			if(checkTable[inputed[i]] == -1)
				return false;
		}
		return true;
	}
	bool isSameDice(int inputed[]){
		char order[25] = "NNNNWNNNWNNNENNNENNNWNNN";
		for(int i = 0; i < 24; i++){
			roll(order[i]);
			for(int j = 0; j < 6; j++){
				if(inputed[j] != number[j])
					break;
				if(j == 5)
					return true;
			}
		}
		return false;
	}

private:
	void setNumber(int n0,int n1,int n2,int n3,int n4,int n5){
		number[0] = n0;
		number[1] = n1;
		number[2] = n2;
		number[3] = n3;
		number[4] = n4;
		number[5] = n5;
	}

private:
	int* number;
	int* checkTable;
};

int main(){
	Dice3 dice3;
	int tmp,inputed[6];
	for(int i = 0; i < 6; i++){
		scanf("%d",&tmp);
		dice3.setLabel(i,tmp);
	}
	for(int i = 0; i < 6; i++) scanf("%d",&inputed[i]);

	if(dice3.isValidMember(inputed) && dice3.isSameDice(inputed))
		printf("Yes\n");
	else{
		printf("No\n");
	}
}



Measured memory_bytes: 2668
import java.io.*;
import java.util.*;

public class Main { // "Main" should be used for most online judges
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		int result = 0;
		int start = 0;
		boolean startFlag = true;
		int end = 0;
		
		for(int i = 0; i < s.length(); i++) {
			if(s.charAt(i) == 'A' && startFlag) {
				start = i;
				startFlag = false;
			} else if(s.charAt(i) == 'Z') {
				end = i;
			}
		}
		result = s.substring(start, end+1).length();
		System.out.println(result);

		sc.close();
	}
}

Measured memory_bytes: 27076
#include<stdio.h>
int main()
{
	char s[5];
	int i,flg=0;
	scanf("%s",s);
	for(i=0;i<3;i++){
		if(s[i]==s[i+1]){
			flg=1;
			break;
		}
	}
	if(flg==1) printf("Bad\n");
	else printf("Good\n");
	return 0;
}

Measured memory_bytes: 1636
#include <iostream>
using namespace std;
int main()
{
  int s, ans=0;
  bool arr[100000] = {false};
  cin >> s;
  arr[s] = true;
  for(ans=2;;++ans)
  {
    if(s%2==0) s = s/2;
    else s = 3*s+1;
    if(arr[s]) break;
    else arr[s] = 1;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 384
#include<stdio.h>
#include<stdlib.h>

int main(){
  int n,i;
  double num,min,max,sum=0.0;
  int count=0;
  scanf("%d",&n);
  //int a[n];
  /*for(i=1;i<=n;i++){
    scanf("%d",&a[i]);
  }

  min=a[1];
  for(i=2;i<=n;i++){
    if(a[i]<min){
      min = a[i];
    }
  }
  
  max=a[1];
  for(i=2;i<=n;i++){
    if(max<a[i]){
      max = a[i];
    }
  }
  
  for(i=1;i<=n;i++){
    sum += a[i];
  }*/
  
  for(i=1;i<=n;i++){
    scanf("%lf",&num);
    if(count==0){
      min = num;
      max = num;
      count++;
    }
    if(num<min){
      min = num;
    }
    if(max<num){
      max = num;
    }
    sum += num;
  }
  
  printf("%.0f %.0f %.0f\n", min, max, sum);
  return 0;
  
}



Measured memory_bytes: 2064
import bisect
A, B, Q = map(int,input().split())
INF = 10**11
S = [-INF] + [int(input()) for i in range(A)] + [INF]
T = [-INF] + [int(input()) for i in range(B)] + [INF]
#print(S,T)
for q in range(Q):
  x = int(input())
  i = bisect.bisect_right(S, x)
  j = bisect.bisect_right(T, x)
  d = INF
  for s in [S[i-1],S[i]]:
    for t in [T[j-1],T[j]]:
      d1 = abs(s-x)+abs(s-t)
      d2 = abs(t-x)+abs(s-t)
      d = min(d, d1, d2)
  print(d)

Measured memory_bytes: 13860
from fractions import gcd

def main():
    def fmin(m):
        return X * m + D * m *(m - 1)//2
    def fmax(m):
        return X * m + D * m * (2 * N - m - 1) // 2
    N, X, D = map(int, input().split())
    if D == 0:
        if X == 0:
            print(1)
        else:
            print(N + 1)
        exit(0)
    if D < 0:
        X, D = -X, -D
    if X > 0:
        ans = 0
        g = gcd(X, D)
        loop = D // g
        for d in range(N + 1):
            if loop <= d:
                mmin = max(fmin(d), fmax(d - loop) + D)
            else:
                mmin = fmin(d)
            mmax = fmax(d)
            ans += (mmax - mmin) // D + 1
        print(ans)
    elif X == 0:
        print(fmax(N) // D + 1)
    else:
        if X + D*(N - 1) >= 0:
            ans = 0
            g = gcd(-X, D)
            loop = D // g
            for d in range(N + 1):
                dmax = fmax(d)
                dmin = fmin(d)
                if d < loop:
                    ans += (dmax - dmin) // D + 1
                else:
                    pmax = fmax(d - loop)
                    pmin = fmin(d - loop)
                    if pmax < dmax and pmin <= dmin:
                        mmin = max(dmin, pmax + D)
                        ans += (dmax - mmin) // D + 1
                    elif pmax >= dmax and pmin > dmin:
                        mmax = min(dmax, pmin - D)
                        ans += (mmax - dmin) // D + 1
                    elif pmax < dmax and pmin > dmin:
                        ans += (dmax - pmax) // D + (pmin - dmin) // D
            print(ans)
                    
        else:
            ans = 0
            g = gcd(-X, D)
            loop = D // g
            for d in range(N + 1):
                if loop <= d:
                    mmax = min(fmax(d), fmin(d - loop) - D)
                else:
                    mmax = fmax(d)
                mmin = fmin(d)
                ans += (mmax - mmin) // D + 1
            print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 5368