akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << "\n";
}
template <typename Arg1, typename... Args>
void __f(const char* na, Arg1&& arg1, Args&&... args) {
  const char* c = strchr(na + 1, ',');
  cerr.write(na, c - na) << " : " << arg1 << " , ";
  __f(c + 1, args...);
}
#define SZ(v) (int)v.size()
#define endl "\n"
#define ALL(v) v.begin(), v.end()
#define UNIQUE(v) sort(ALL(v)),v.erase(unique(ALL(v)),v.end())
typedef long long LL;
typedef pair <int,int> pii;
const double pi = acos(-1.0);
const double eps = 1e-8;
const int inf = 1e9;
const LL INF = 1e18;
const int mod = 1e9 + 7;
const int N = 1e5 + 5;

int n, m, q, mx;
int a[ N ], b[ N ], c[ N ], d[ N ];
vector <int> have;

void backtrack(int num, int idx) {
  if (idx == n) {
    int cur = 0;
    for (int j = 1; j <= q; j++) {
      if (have[b[j]] - have[a[j]] == c[j]) cur += d[j];
    }
    mx = max(mx, cur);
    return;
  }
  for (int i = num; i <= m; i++) {
    have.push_back(i);
    backtrack(i, idx + 1);
    have.pop_back();
  }
}

void solve() {
  cin >> n >> m >> q;
  for (int i = 1; i <= q; i++) {
    cin >> a[i] >> b[i] >> c[i] >> d[i];
  }
  have.push_back(0);
  for (int i = 1; i <= m; i++) {
    have.push_back(i);
    backtrack(i, 1);
    have.pop_back();
  }
  cout << mx << endl;
}

int main() {
  ios_base::sync_with_stdio(0); cin.tie(0);
  #ifdef LOCAL
    freopen("input.txt", "r", stdin);
  #endif
  int t = 1;
  for (int tc = 1; tc <= t; tc++) solve();
  return 0;
}



Measured memory_bytes: 3668
#include <iostream>
#include<string>
#include <cstdio>
#include<utility>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<bitset>
#include<queue>
#include<set>
#include <limits>
#include <numeric>
#include<queue>
using namespace std;
typedef long long ll;
typedef pair<int,int>P;
typedef pair<double,double>P_D;
#define PI 3.1415926535897932384626433832795
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define reprev(i, n) for (int i = (int)n - 1; i >= 0; i--)
#define ALL(a)  (a).begin(),(a).end()
#define MAX 100100
#define MAX_N 200100
#define SENTINEL 2000000000
#define MAX_B 1001001
#define NIL -1
#define MOD 1000000007
#define INF 1 << 29
#define INFTY 1000000000000000000LL

int main(){
    ll x,y;cin>>x>>y;
    int ans=0;
    while(x<=y){
        x*=2;
        ans++;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
/*
 * @Author: Kaizyn
 * @Date: 2020-08-27 12:43:42
 * @LastEditTime: 2020-08-27 13:04:05
 */
#include <bits/stdc++.h>

// #define DEBUG

using namespace std;

const double eps = 1e-7;
const double PI = acos(-1);
typedef pair<int, int> pii;
const int MOD = 998244353;
const int INF = 0x3f3f3f3f;
const int N = 5e5+7;

template <typename T>
struct BinaryIndexedTree {
  int n;
  T tr[N];
  BinaryIndexedTree() { memset(tr, 0, sizeof tr); }
  void init(const int &_n) { n = _n; clear(); }
  void clear() { memset(tr+1, 0, sizeof(T)*n); }
  void add(const int &x, const T &v) { for (int i = x; i <= n; i += i&-i) tr[i] += v; }
  void add(const int &x, const int &y, const T &v) { add(x, v); add(y+1, -v); }
  T query(const int &x) { T res = 0; for (int i = x ; i; i -= i&-i) res += tr[i]; return res; }
  T query(const int &x, const int &y) { return query(y)-query(x-1); }
};

int n, q;
int c[N], res[N];
vector<int> col[N];
vector<pii> qqq[N];
BinaryIndexedTree<int> bit;

inline void solve() {
  cin >> n >> q;
  for (int i = 1; i <= n; ++i) {
    cin >> c[i];
    col[c[i]].emplace_back(i);
  }
  for (int i = 1, l, r; i <= q; ++i) {
    cin >> l >> r;
    qqq[l].emplace_back(r, i);
  }
  bit.init(n);
  for (int i = 1; i <= n; ++i) if (col[i].size()) {
    bit.add(col[i].front(), 1);
    reverse(col[i].begin(), col[i].end());
  }
  for (int i = 1; i <= n; ++i) {
    for (auto &qq : qqq[i]) {
      res[qq.second] = bit.query(qq.first);
    }
    bit.add(i, -1);
    col[c[i]].pop_back();
    if (col[c[i]].size()) bit.add(col[c[i]].back(), 1);
  }
  for (int i = 1; i <= q; ++i) {
    cout << res[i] << endl;
  }
}

signed main() {
  ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
  int T = 1;
  // cin >> T;
  for (int t = 1; t <= T; ++t) {
    solve();
  }
  return 0;
}

Measured memory_bytes: 58668
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
using namespace std;
using LL = long long;
constexpr long long MOD = 1000000000 + 7;
constexpr long long INF = 1000000000;
const double PI = acos(-1);

int main() {
	int n;
	cin >> n;
	string s;
	cin >> s;
	if (s == "Un") {
		cout << "NO" << endl;
		return 0;
	}
	int acount = 1;
	for (int i = 0; i < n-1; i++) {
		cin >> s;
		if (s == "A") {
			acount++;
		}
		else {
			acount--;
		}
		if (acount < 0) {
			cout << "NO" << endl;
			return 0;
		}
	}
	if (acount != 0) {
		cout << "NO" << endl;
		return 0;
	}
	cout << "YES" << endl;
}

Measured memory_bytes: 3152
import sys
sys.setrecursionlimit(10 ** 7)

direction = ((1, 0), (-1, 0), (0, 1), (0, -1), (1, 1), (-1, -1), (-1, 1), (1, -1))


def dfs(y, x):
    board[y][x] = 0

    for d in direction:
        nh = y + d[1]
        nw = x + d[0]

        if nh < 0 or nh >= h or nw < 0 or nw >= w:
            continue
        if board[nh][nw] == 0:
            continue
        dfs(nh, nw)

while True:
    w, h = map(int, input().split())
    if h == 0 and w == 0:
        break
    board = [list(map(int, input().split())) for i in range(h)]

    cnt = 0
    for y in range(h):
        for x in range(w):
            if board[y][x] == 0:
                continue
            dfs(y, x)
            cnt += 1
    print(cnt)



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

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		List<Integer> result = new ArrayList<Integer>();
		String[] n;

		while (true) {

			String line = sc.nextLine();
			n = line.split(" ");

			if (n[0].equals("0") && n[1].equals("0")) {
				break;
			}
			int a = Integer.parseInt(n[0]);
			int b = Integer.parseInt(n[1]);
			for (int i = 0; i < a; i++) {
				for (int j = 0; j < b; j++) {
					if (i + j == 0 || (i + j) % 2 == 0) {
						System.out.print("#");
					} else {
						System.out.print(".");
					}
				}
				System.out.println("");
			}

			System.out.println("");

		}

	}

}



Measured memory_bytes: 32540
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
#include<stdio.h>
#include<string.h>
#include <bitset>

using namespace std;
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(),(x).end()

// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e <<" ";}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class... Ts> void DEBUG(T d, Ts... e){if(DEBUG_OUT == false)return;DEBUG(d);DEBUG(e...);}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

void solve(void)
{
  int K;cin>>K;
  int N = 50;
  int Q =K/N;
  int R =K%N;
  vector<int> vec (N,Q);
  for (int i = 0; i < N; i++)
  {
    vec[i] += i;
  }
  for (int i = 0; i < R; i++)
  {
    for (int j = 0; j < N; j++)
    {
      if(i == j)
      {
        vec[j] += N;
      }
      else
      {
        vec[j]--;
      }
    }
    
  }
  cout<<N<<endl;
  for (int i = 0; i < N; i++)
  {
    if(i != 0)cout<<char(32);
    cout<<vec[i];
  }
  cout<<endl;
  
  

  

  return;
}

int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(15);
  solve();

  return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cstring>
#include <climits>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int u, v; ll w; };
 
int MOD = 1000000007;

int main() {
	for (;;) {
		int n; cin >> n;
		if (n == 0) break;
		vector<int> s(n);
		for (int i = 0; i < n; i++) cin >> s[i];
		int sum = 0;
		for (int i = 0; i < n; i++) sum += s[i];
		double m = (double)sum / n;
		double _sum = 0;
		for (int i = 0; i < n; i++) _sum += (s[i] - m) * (s[i] - m);
		printf("%.10f\n", sqrt(_sum / n));
	}
}

Measured memory_bytes: 1228
/* Author : Aaryan Srivastava ^__^ */ 
#include <bits/stdc++.h>
#include <random>
#include <chrono>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#define pb push_back
#define mp make_pair
#define ff first
#define ss second   
#define rep(i,n) for(int i = 0 ; i < (n) ; i++)
#define repA(i,x,y) for(int i = (x) ; i <= (y) ; i++)
#define repD(i,x,y) for(int i = (x) ; i >= (y) ; i--)
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define setval(a,val) memset(a,val,sizeof(a))
#define Randomize mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define trav(x , a) for(auto &x : a)
#define sz(a) ((int)a.size())
typedef long long ll ; 

#define int ll

using namespace std;

const int N = 3e5 +5 ;
const int mod = 1e9 + 7 ;
const ll inf = 1e18 ;
const int SZ = 101 ;
const double eps = 1e-9 ;
using namespace __gnu_pbds;
using ordered_set =  tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ;

typedef pair<int, int> pii; 
typedef pair<int , pii> ipii ;
typedef pair<pii , int> piii ; 
typedef unsigned long long ull ;
typedef long double ld;

ll po(ll x,ll y,ll p = mod) {ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}

int poA[N] , poB[N] , fac[N] , invfac[N] , ihun[N] , c;

void pre(int A , int B , int C){

    int tmp = po(100LL , mod - 2);
    c =  (100LL * po(100 - C , mod - 2)) % mod ;
    fac[0] = poA[0]  = ihun[0] = poB[0] = 1;

    for(int i = 1 ; i < N ; ++i){
        poA[i] = (poA[i-1] * A) % mod ;
        poB[i] = (poB[i-1] * B) % mod ;
        ihun[i] = (ihun[i - 1] * tmp) % mod;
        fac[i] = (i * fac[i - 1]) % mod;
    }
    invfac[N - 1] = po(fac[N-1] , mod - 2);
    for(int i = N - 2 ; i >= 0 ; --i){
        invfac[i] = (invfac[i + 1] * (i + 1)) % mod ;
    }
}

int ncr(int n , int r){
    if(r > n) return 0; 
    int res = (fac[n] * invfac[r]) % mod ;
    res = (res * invfac[n - r]) % mod ;
    return res;
}


int get_term(int K , int n){
    int res = ncr(K - 1 , n - 1);
    int res2 = ((poA[K-n] * poB[n]) % mod + (poA[n] * poB[K - n])%mod) % mod;
    res = ( res * res2 ) % mod ;
    res = (res * ihun[K]) % mod;
    res = (res * K) % mod ;
    res = (res * c) % mod ;
    return res;
}

void solve()
{
    int n , A , B , C ;
    cin >> n >> A >> B >> C ;
    int su = (100LL * po(A + B , mod - 2)) % mod;
    A = (su * A) % mod ;
    B = (su * B) % mod ;

    pre(A , B , C);
    int ans = 0;
    for(int K = n ; K <= 2 * n - 1 ; ++K) ans = (ans + get_term(K , n)) % mod ;
    cout << ans;
}   

     
int32_t main(int32_t argc, char *argv[])
{
    ios::sync_with_stdio(0);    
    cin.tie(0); cout.tie(0);
    int TC = 1, t = 0;
    //cin >> TC ;
    while(t++ < TC)
    {
        //cout << "Case #" << t << ": " ;
        solve();
        cout << "\n" ;
    }
    return 0;
}

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

using namespace std;

typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,n) for(int i=1;i<=(int)(n);i++)
#define rep3(i,n) for(int i=0;i<=(int)(n);i++)
#define REP(i,m,n) for(int i=m;i<(int)(n);i++)
#define repll(i,n) for(ll i=0;i<(ll)(n);i++)
#define repll2(i,n) for(ll i=1;i<=(ll)(n);i++)
#define REPLL(i,m,n) for(ll i=m;i<(ll)(n);i++)
#define INF (int)1e9  //
#define LINF (ll)4e18  //
#define MOD (1e9)+7
#define MP make_pair
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl

//------------------------------------------------------

int main() {
    int n, T;
    cin >> n >> T;
    int t[n];
    rep(i, n) cin >> t[i];

    int sum = 0;

    rep(i, n - 1) {
        sum += min(t[i + 1] - t[i], T);
    }

    sum += T;
    cout << sum << endl;

    return 0;
}



Measured memory_bytes: 1024
/*
 * 	If I got locked away
 * 		And we lost it all today
 * 			Tell me honestly 
 * 				Would you still love me the same?
*/

//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& STL DEBUGGER &&&&&&&&&&&&&&&&&&&&&&&&&&&

// #define _GLIBCXX_DEBUG       // Iterator safety; out-of-bounds access for Containers, etc.
// #pragma GCC optimize "trapv" // abort() on (signed) integer overflow.

//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& LIBRARIES &&&&&&&&&&&&&&&&&&&&&&&&&&&

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

/*#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
template<typename T, typename V = __gnu_pbds::null_type>
using ordered_set = __gnu_pbds::tree<T, V, less<T>, __gnu_pbds::rb_tree_tag, __gnu_pbds::tree_order_statistics_node_update>; 
*/
//find_by_order()->returns an iterator to the k-th largest element(0-based indexing)
//order_of_key()->Number of items that are strictly smaller than our item

//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& DEFINES &&&&&&&&&&&&&&&&&&&&&&&&&&&

#define int long long int
#define ld long double
#define X first
#define Y second
#define all(i) i.begin(), i.end()
#define sz(a) (int)a.size()
 
const ld PI  = 3.141592;
const int dx4[4] = {0, 1, 0, -1};
const int dy4[4] = {-1, 0, 1, 0};
const int dx8[8] = {-1, -1, -1, 0, 1, 1, 1, 0};
const int dy8[8] = {-1, 0, 1, 1, 1, 0, -1, -1};
 
//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& DEBUG &&&&&&&&&&&&&&&&&&&&&&&&&&&
 
#define XOX
vector<string> vec_splitter(string s) {
    for(char& c: s) c = c == ','?  ' ': c;
    stringstream ss; ss << s;
    vector<string> res;
    for(string z; ss >> z; res.push_back(z));
    return res;
}
 
void debug_out(vector<string> __attribute__ ((unused)) args, __attribute__ ((unused)) int idx) { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, Head H, Tail... T) {
    if(idx > 0) cerr << ", ";
    stringstream ss; ss << H;
    cerr << args[idx] << " = " << ss.str();
    debug_out(args, idx + 1, T...);
}
 
#ifdef XOX
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __VA_ARGS__)
#else
#define debug(...) 42
#endif
 
 
//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& CODE &&&&&&&&&&&&&&&&&&&&&&&&&&&


void solve(){
    int h1, m1, h2, m2, k;
    cin >> h1 >> m1 >> h2 >> m2 >> k;
    int min = 0;
    if(h1 == h2){
        min =  (m2 - m1);
        cout << min - k << '\n';
        return;
    }
    for(int H = h1 ; H <= h2; ++H){
        if(H == h1){
            for(int mn = m1; mn <= 59; ++mn){
                min++;
            }
        } else if(H == h2){
            for(int mn = 0; mn < m2; ++mn)
                min++;
        } else {
            min += 60;
        }
    }
    cout << min - k << '\n';
}

int32_t main(){
    ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr); 
    int T = 1; 
    // cin >> T;
    for(int i = 1; i <= T; ++i){
        solve();
    }
    return 0;
}

/*
Sample inp
*/

Measured memory_bytes: 3660
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse2")

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

#define int         long long
#define ll          long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define mp          make_pair
#define all(a)      (a).begin(),(a).end()
#define FF           first
#define SS           second
#define sz(x)       (int)x.size()
#define endl        '\n'
//#define hell          1000000007
#define rep(i,a,b)  for(int i=a;i<b;i++)
// mp::cpp_int
//#define pp pair<pii,pii>
const int hell=1000000007;



int power(int a,int b)
{
  if(b==0)return 1;
  if(b==1)return a;
  int t=power(a,b/2);
  t%=hell;
  t*=t;
  t%=hell;
  if(b%2)return (t*a)%hell;
  else
     return t;
}


int solve( ){

int a,b;
  cin>>a>>b;
if(a<=5)cout<<0;
else if(a>5&&a<13)
{
  cout<<b/2;
}
else
{
  cout<<b;
}


return 0;
}

signed main()
{  int t=1;
 ios::sync_with_stdio(false);
   cin.tie(0);
   cout.tie(0);
   cin.exceptions(cin.failbit);                                                                    

  

  clock_t time_req;

    // Without using pow function
                                                                                                                   

   // cin>>t;

    int k=1;
   while(t--)
     {
       //cout<<"case #"<<k<<":"<<" ";k++;
      solve();
     }

         time_req = clock() - time_req;
    //cout <<endl<< "Processor time taken is "
      //<< (double)time_req/CLOCKS_PER_SEC << " seconds" << endl;


    return 0;
} 

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define max(p,q) ((p)>(q)?(p):(q))
#define min(p,q) ((p)<(q)?(p):(q))
#define chmax(a,b) ((a)=(a)>(b)?(a):(b))
#define chmin(a,b) ((a)=(a)<(b)?(a):(b))
#define abs(p) ((p)>=(0)?(p):(-(p)))
#define MOD 1000000007
ll power(ll a,ll b){ll r=1;rep(i,b){r*=a;}return r;}
#define swap(a,b) do{ll w=(a);(a)=(b);(b)=w;}while(0)

//your code here!

int main(void){
    ll N;
    scanf("%lld", &N);
    ll i=0;
    while(power(2, i) <= N) i++;
    printf("%lld\n", power(2, --i));
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <iomanip>

int main() {
	
	int map[15][15];
	int num, x, y, c;

	while(1) {
		// Input a number
		std::cin >> num;
		if(num==0) break;
		
		// Initialize the 'map'
		for( int i=0; i<num*num; i++) map[i%num][i/num] = 0;
		
		// First Position( down one of the middle )
		x = (num-1) / 2; y = (num-1) / 2 + 1;
		c = 1;
		
		// Create 'Magic Square'
		while(1) {

			map[x][y] = c;
			
			if(c==num*num) break;
			c++;
			
			
			// Move Position
			x++; y++;
			
			// If Position is outside 'Magic Square'
			if(x<0) x = num-1;
			if(x>=num) x = 0;
			if(y>=num) y = 0;
			
			if(0<=x && 0<=y && x<num && y<num) {
				// If number is already inputting
				if(map[x][y]!=0) { x--; y++;}
			}
			
			// If Position is outside 'Magic Square'
			if(x<0) x = num-1;
			if(x>=num) x = 0;
			if(y>=num) y = 0;
		}
		
		// Output the 'Magic Square'
		for( int i=0; i<num*num; i++) {
			std::cout << std::setw(4) << map[i%num][i/num] << ( (i%num)==num-1 ? "\n" : "" );
		}
	}
	
	return 0;
}

Measured memory_bytes: 1176
//----------------------------templates
    #pragma GCC optimize ("Ofast")
    #pragma GCC target ("tune=native")
    #pragma GCC target ("avx")
    //----------------------------
    #include <bits/stdc++.h>
    using namespace std;

    typedef long long ll;
    typedef unsigned long long ull;
    #define int ll

    #define FOR(i,j,n) for (int i=(int)(j);i<(n);i++)
    #define REP(i,n) for (int i=0;i<(int)(n);i++)
    #define REPS(i,n) for (int i=1;i<=(int)(n);i++)
    #define REPN(i,n) for (int i=(int)(n)-1;i>=0;i--)
    #define REPNS(i,n) for (int i=(int)(n);i>0;i--)

    #define I(n) scanf("%lld", &(n))
    #define LL(n) scanf("%lld", &(n))
    #define pb(n) push_back((n))
    #define mp(i,j) make_pair((i),(j))
    #define eb(i,j) emplace_back((i),(j))
    #define y0 y3487465
    #define y1 y8687969
    #define j0 j1347829
    #define j1 j234892
    #define uniq(v) v.erase( unique(v.begin(), v.end()), v.end() )

    #define all(x) (x).begin(),(x).end()
    #define sz(x) ((int)(x).size())

    typedef vector<int> vi;
    typedef pair<int,int> pi;
    typedef vector<pi> vpi;
    typedef vector<vi> vvi;
    typedef vector<vpi> vvpi;
    typedef vector<vvi> vvvi;

    const int mod = 1000000007;

//--------------------------------------------

int n;
bool is_753(int x){
    bool seven = 0;
    bool five = 0;
    bool three = 0;
    while (x){
        int d0 = x % 10;
        seven |= d0 == 7;
        five |= d0 == 5;
        three |= d0 == 3;
        if (d0 != 3 && d0 != 5 && d0 != 7){
            return false;
        }
        x /= 10;
    }
    return seven && five && three;
}

int ret;
signed main(){
    I(n);
    int i = 353;
    for (; i <= n - 4; i += 20){
        ret += is_753(i);
        ret += is_753(i + 2);
        ret += is_753(i + 4);
    }
    if (i <= n) ret += is_753(i);
    if (i <= n+2) ret += is_753(i+2);
    cout << ret << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main () {
    int ans = 0;
    int n;
    cin >> n;
    vector<int> a(n), b(n), c(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        a[i]--;
    }
    for (int i = 0; i < n; i++) {
        cin >> b[i];
    }
    for (int i = 0; i < n-1; i++) {
        cin >> c[i];
    }
    for (int i = 0; i < n; i++) {
        if (i) {
            if (a[i-1] == a[i]-1) {
                ans += c[a[i-1]];
            }
        }
        ans += b[a[i]];
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdint.h>
#include <string>

using namespace::std;

int64_t gcd(int64_t x, int64_t y)
{
        return ((x % y == 0) ? y : gcd(y, x % y));
}

int main()
{
        string yes = "Yes";
        string no = "No";

        int T;
        cin >> T;

        for (int t = 0; t < T; t++)
        {
                int64_t A, B, C, D;
                cin >> A >> B >> C >> D;

                if (D < B)
                {
                        cout << no << endl;
                        continue;
                }

                if (A < B)
                {
                        cout << no << endl;
                        continue;
                }

                if (C >= B)
                {
                        cout << yes << endl;
                        continue;
                }

                int64_t d = gcd(B, D);
                int64_t r = (A - (C + 1)) / d;

                int64_t a = A - r * d;
                if (a >= B)
                        cout << yes << endl;
                else
                        cout << no << endl;
        }

        return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
constexpr ll mod=1e9+7;

struct UnionFind
{
    vector<int> Parent;
    UnionFind(int n)
    {
        Parent=vector<int>(n,-1);
    }
    
    int root(int a)
    {
        if(Parent[a]<0) return a;
        return root(Parent[a]);
    }
    
    int size(int a)
    {
        return -Parent[root(a)];
    }
    
    bool connect(int a,int b)
    {
        if(root(a)==root(b)) return false;
        if(size(a)<size(b)) swap(a,b);
        Parent[root(a)]-=size(b);
        Parent[root(b)]=root(a);
        return true;
    }
};

int main()
{
  int n,m;
  cin>>n>>m;
  UnionFind field(n);
  for (int i = 0; i < m; ++i)
  {
    int a,b;
    cin>>a>>b;
    a--;b--;
    field.connect(a, b);
  }
  int cnt=0;
  for (int i = 0; i < n; ++i)
  {
    if (field.Parent[i]<0) {
      cnt++;
    }
  }
  if (cnt==0) cout<<0<<endl;
  else cout<<cnt-1<<endl;
}

Measured memory_bytes: 3752
h,n = map(int,input().split())
data = []
ans = 0
M = -1
for _ in range(n):
    a,b = map(int,input().split())
    data.append((a,b))
    M = max(a,M)
dp = [float("inf") for _ in range(h+M)]
dp[0] = 0
for i,j in data:
    for k in range(h+M-1):
        if k+i <= h+M-1:
            dp[k+i] = min(dp[k]+j,dp[k+i])
print(min(dp[h:]))

Measured memory_bytes: 51036
s=gets.chomp

check=Array.new(4,0)
n=s.length
n.times do |i|
    case s[i]
    when "N"
        check[0]+=1
    when "W"
        check[1]+=1
    when "S"
        check[2]+=1
    when "E"
        check[3]+=1
    end
end
if check[0]>0 && check[2]>0 && check[1]>0 && check[3]>0
    puts "Yes"
elsif check[0]>0 && check[2]>0 && check[1]==0 && check[3]==0
    puts "Yes"
elsif check[1]>0 && check[3]>0 && check[0]==0 && check[2]==0
    puts "Yes"
else
    puts "No"
end


Measured memory_bytes: 14332
#include <iostream>
#include <cstdio>
#include <algorithm>
#define ll long long

using namespace std;

ll ans, n, cnt;
ll pos;

void dfs(ll ,ll , ll, ll);

int main(){
	cin >> n;
	if(n % 9){
		puts("0");
		return 0;
	}
	while(pos >= 0){
		pos = pos * 10 + 9, ++cnt;
		dfs(n, pos, 1, 100);
	}
	cout << ans << endl;
	return 0;
}

void dfs(ll u,ll d,ll sum, ll tmp){
	if(!d){
		if(u) return;
		if(cnt % 2 == 0) sum *= 10;
		ans += sum;
		return ;
	}
	ll tmp1 = u / d, tmp2 = u % d;
	if(tmp1 >= 10) return ;
	ll sum1 = 10 - tmp1, sum2 = 9 - tmp1;
	if(d == pos) sum1--, sum2--;
	dfs(tmp2, d / tmp * (tmp / 10), sum * sum1, tmp * 10);
	dfs(d - tmp2, d / tmp * (tmp / 10), sum * sum2, tmp * 10);
	return ;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = pow(10, 9) + 7;

int main(){
    int n;
    string s1, s2;
    cin >> n >> s1 >> s2;
    int check, s;
    ll ans;
    if(s1[0] == s2[0]){
        ans = 3;
        check = 0;
        s = 1;
    }
    else{
        ans = 6;
        check = 1;
        s = 2;
    }
    for(int i = s; i < n; i++){
        if(s1[i] == s2[i]){
            if(check == 0){
                ans *= 2;
                ans %= mod;
            }
            else if(check == 1){
                ans *= 1;
            }
            check = 0;
        }
        else{
            if(check == 0){
                ans *= 2;
                ans %= mod;
            }
            else if(check == 1){
                ans *= 3;
                ans %= mod;
            }
            check = 1;
            i++;
        }
    }
    cout << ans%mod <<endl;
}

Measured memory_bytes: 3444
#include <stdio.h>

int main(void)
{
    int A,B,kuti_count=1, tap_count=0;

    scanf("%d %d",&A, &B);

    while(kuti_count < B){
        kuti_count += A-1;
        tap_count++;
    }

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

    return 0;
}

Measured memory_bytes: 128
data = input().split(" ")
A = input().split(" ")
B = input().split(" ")
total = 1000000
a = 1000000
b = 1000000
j = 0
for i in data:
    data[j] = int(i)
    j += 1
j = 0
for i in A:
    A[j] = int(i)
    j += 1
j = 0
for i in B:
    B[j] = int(i)
    j += 1


for i in range(data[2]):
    data1 = input().split()
    j = 0
    for i in data1:
        data1[j] = int(i)
        j += 1
    data2 = A[data1[0]-1] + B[data1[1]-1] - data1[2]
    if total > data2:
        total = data2

for i in A:
    if a > i:
        a = i
for i in B:
    if b > i:
        b = i

if total > a+b:
    total = a+b

print(total)

Measured memory_bytes: 17736
#include <bits/stdc++.h>
#define div1 1000000007
const long long INF = 1LL << 60;
using namespace std;
typedef long long ll;
typedef long double ld;
// a>b -> a==b;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
// a<b -> a==b;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

int main(void)
{
    ll N, i, C[4]={0};
    string S[100001];

    cin >> N;

    for(i=1; i<=N; i++){
        cin >> S[i];
        if(S[i]=="AC") C[0]++;
        if(S[i]=="WA") C[1]++;
        if(S[i]=="TLE") C[2]++;
        if(S[i]=="RE") C[3]++;
    }

    cout << "AC x " << C[0] << endl << "WA x " << C[1] << endl << "TLE x " << C[2] << endl << "RE x " << C[3] << endl;

    return 0;
}

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

int main() {
	float N;
	cin >> N;
	if(floor(ceil(N / 1.08) * 1.08) == N){
		cout << int(ceil(N / 1.08)) << endl;
	}else{
		cout << ":(" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
N, H = map(int, input().split())
AB = []
for _ in range(N):
    a, b = map(int, input().split())
    AB.append((a, True))
    AB.append((b, False))
AB.sort(reverse=True)
n = 0
for h, isinf in AB:
    if not isinf:
        n += 1
        H -= h
    else:
        n += (H - 1) // h + 1
        H = 0
    if H <= 0:
        print(n)
        exit()


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






#define pf                  printf
#define sf(a)               scanf("%d",&a)
#define sfl(a)              scanf("%lld",&a)
#define sff(a,b)            scanf("%d %d",&a,&b)
#define sffl(a,b)           scanf("%lld %lld",&a,&b)
#define sfff(a,b,c)         scanf("%d %d %d",&a,&b,&c)
#define sfffl(a,b,c)        scanf("%lld %lld %lld",&a,&b,&c)
#define sffff(a,b,c,d)      scanf("%d %d %d %d",&a,&b,&c,&d)
#define sffffl(a,b,c,d)     scanf("%lld %lld %lld %lld",&a,&b,&c,&d)
#define sfffff(a,b,c,d,e)   scanf("%d %d %d %d %d",&a,&b,&c,&d,&e)
#define sfffffl(a,b,c,d,e)  scanf("%lld %lld %lld %lld %lld",&a,&b,&c,&d,&e)
#define sfc(a)              scanf("%c",&a)
#define pii                 pair<int,int>
#define ms(a,b)             memset(a,b,sizeof(a))
#define pb(a)               push_back(a)
#define pbp(a,b)            push_back({a,b})
#define db                  double
#define ft                  float
#define ll                  long long
#define ull                 unsigned long long
#define pii                 pair<int,int>
#define ff                  first
#define ss                  second
#define sz(x)               x.size()
#define all(x)              x.begin(),x.end()
#define CIN                 ios_base::sync_with_stdio(0); cin.tie(0)
#define max3(a, b, c)       max(a, b) > max(b, c) ? max(a, b) : max(b, c)
#define min3(a, b, c)       min(a, b) < min(b, c) ? min(a, b) : min(b, c)
#define for0(i,n)           for(int i=0;i<n;i++)
#define for1(i,n)           for(int i=1;i<=n;i++)
#define forrev(i,n)         for(int i=n-1; i>=0; i--)
#define forab(i,a,b)        for(int i=a;i<=b;i++)
#define forba(i,b,a)        for(int i=b;i>=a;i--)
#define stlloop(x)          for(__typeof(x.begin()) it=x.begin();it!=x.end();it++)
#define gcd(a, b)           __gcd(a, b)
#define lcm(a, b)           ((a)*((b)/gcd(a,b)))
#define case1(z)            cout<<"Case "<<z<<": "
#define case2(z)            printf("Case %d: ",z)
#define PI                  acos(-1) //3.14159265358979323846264338328
#define valid(tx,ty)        tx>=0 && tx<row && ty>=0 && ty<col
#define intlim              2147483648
#define N                   100007
#define inf                 100000008
#define mod                 1000000007

/*------------------------------Graph Moves----------------------------*/
//const int fx[]={+1,-1,+0,+0};
//const int fy[]={+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*---------------------------------------------------------------------*/




int main()
{

    ll q,i,j,a[N],b,k;
    cin>>q;
    if(q%2==0)
        cout<<q<<endl;
    else
        cout<<q*2<<endl;
    return 0;

}
































Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int inf = INT_MAX;
const ll INF = LLONG_MAX;
const ll MOD = 1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b, const ll mod=MOD) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b, const ll mod=MOD) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b, const ll mod=MOD) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b, const ll mod=MOD) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n; cin >> n;
    vi a(n); for(auto& e : a) cin >> e;

    int res = inf;
    for(auto e : a){
        int cnt = 0;
        while(e % 2 == 0){
            cnt++;
            e /= 2;
        }
        chmin(res, cnt);
    }

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<iomanip>
#include<algorithm>
using namespace std;

int main(){
    int n;
    double x[100] = {}, y[100] = {};
    cin >> n;
    for( int i = 0; i < n; i++){
        cin >> x[i];
    }
    for( int i = 0; i < n; i++){
        cin >> y[i];
    }
    double m = 0, e = 0, f = 0, t = 0;
    for(int i = 0; i < n; i++){
        m += abs(x[i] - y[i]);
        e += pow(x[i] - y[i], 2);
        f += pow(abs(x[i] - y[i]), 3);
        t = max(abs(x[i] - y[i]), t);
    }
    cout << fixed << setprecision(7);
    cout << m << endl;
    cout << sqrt(e) << endl;
    cout << pow(f, 1.0/3.0) << endl;
    cout << t << endl;
}
 


Measured memory_bytes: 3452
using System.Collections.Generic;
using System;


public class hello
{
    public static void Main()
    {
        var ope = new int[,] { { 3, 5, 2, 4, 1, 6 }, { 4, 6, 3, 2, 5, 1 }, { 6, 4, 3, 1, 5, 2 }, { 5, 3, 1, 4, 2, 6 }, { 1, 2, 4, 5, 6, 3 }, { 1, 2, 6, 3, 4, 5 } };
        var dict = new Dictionary<string, int>() { { "North", 0 }, { "East", 1 }, { "West", 2 }, { "South", 3 }, { "Right", 4 }, { "Left", 5 } };
        while (true)
        {
            var dice = new int[] { 1, 6, 5, 3, 2, 4 };
            var n = int.Parse(Console.ReadLine().Trim());
            if (n == 0) break;
            var ans = 1;
            for (int i = 0; i < n; i++)
            {
                var cmd = Console.ReadLine().Trim();
                ans += GetResult(ope, dice, dict[cmd]);
            }
            Console.WriteLine(ans);
        }
    }

    public static int GetResult(int[,] o, int[] d, int cmd)
    {
        var ary = new int[6];
        for (int i = 0; i < 6; i++)
            ary[o[cmd, i] - 1] = d[i];
        for (int i = 0; i < 6; i++)
            d[i] = ary[i];
        return d[0];
    }
}

Measured memory_bytes: 9344
#include <iostream>
#include <string>
#include <stdlib.h>
#include <stdio.h>      /* printf */
#include <math.h>       /* pow */
 
int main(void){
    int num;
    std::cin >> num;
 
    std::cout << num*num*num << std::endl;
 
    return 0;
}

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

using namespace std;
using ld=long double;

struct Graph {
    int n;
    const ld INF = 1e50;
    vector<vector<ld>> cost;
    bool is_digraph;

    Graph(int _n, bool _di=false) : n(_n) {
        cost.resize(n);
        for (int i = 0; i < n; i++) {
            cost[i].assign(n, INF);
        }
        for (int i = 0; i < n; i++) {
            cost[i][i] = 0;
        }
        is_digraph = _di;
        //input();
    }
    template <typename T>
    vector<T> dijkstra(int s){
        //const T INF = 0x3f3f3f3f3f3f3f3f; 
        vector<T> d(n, INF);
        vector<bool> trk(n, false);
        d[s] = 0;
        while (true) {
            T mindis = INF;
            int u = -1;
            for (int i = 0; i < n; i++) {
                if (!trk[i] && d[i] < mindis) {
                    u = i; mindis = d[i];
                }
            }
            if (!~u) break;
            trk[u] = true;
            for (int v = 0; v < n; v++) {
                if (!trk[v] && d[v] > d[u] + cost[u][v]) {
                    d[v] = d[u] + cost[u][v];
                }
            }
        }
        return d;
    }
};

struct Barrier {
    int x, y, r;
    Barrier() {}
    Barrier(int _x, int _y, int _r) : x(_x), y(_y), r(_r) {}
    ld dist(const Barrier _b) {
        ld dx = x - _b.x;
        ld dy = y - _b.y;
        return max((ld)0.0, sqrt(dx*dx+dy*dy) - r - _b.r);
    }
};

void solve() {
    vector<Barrier> a;
    int x,y;
    cin >> x >> y;
    a.emplace_back(x,y,0);
    cin >> x >> y;
    a.emplace_back(x,y,0);
    
    int n; cin >> n;
    for (int _ = 0; _ < n; _++) {
        int x,y,r;
        cin >> x >> y >> r;
        a.emplace_back(x,y,r);
    }
    Graph g(n+2);
    for (int i = 0; i <= n+1; i++) {
        for (int j = i+1; j <= n+1; j++) {
            g.cost[i][j] = g.cost[j][i] = a[i].dist(a[j]);
        }
    }
    auto d = g.dijkstra<ld>(0);
    ld res = d[1];
    cout << fixed << setprecision(10) << res;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    cout << endl;
}


Measured memory_bytes: 16000
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <queue>
#include <map>
#include <set>
using namespace std;
#define ll long long
#define rep(i, s, n) for(int i = s; i < n; i++)

int main() {
    ll k;
    cin >> k;
    queue<ll> que;
    rep(i, 1, 10) {
        que.push(i);
    }
    ll count = 0;
    for(int i = 0; i < k-1; i++) {
        ll x = que.front(); que.pop();
        if(x % 10 != 0) que.push(10*x+x%10-1);
        que.push(10*x+x%10);
        if(x % 10 != 9) que.push(10*x+x%10+1);
    }
    cout << que.front() << endl;
    return 0;
}

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

typedef long long ll;
typedef pair<int,int> pii;

long long MOD = 1000000000 + 7;

int main(){
  cout << setprecision(10);
  int N,M;
  cin >> N >> M;
  map<int,bool> m;

  for(int i = 1; i<= N; i++){
    m[i] = true;
  }

  map<int, int> h;
  for(int i = 1; i <= N; i++){
    int tmp_h;
    cin >> tmp_h;
    h[i] = tmp_h;
  }

  for(int i = 0; i < M; i++){
    int tmp1, tmp2;
    cin >> tmp1 >> tmp2;

    if(h[tmp1] <= h[tmp2]){
      m[tmp1] = false;
    }

    if(h[tmp1] >= h[tmp2]){
      m[tmp2] = false;
    }
  }

  int ans = 0;
  for(auto x: m){
    if(x.second) ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 12972
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;


class Triplet<T1, T2, T3> {

    public T1 x;
    public T2 y;
    public T3 z;

    public Triplet(T1 x, T2 y, T3 z) {
        this.x = x;
        this.y = y;
        this.z = z;
    }
    public String toString() {
        return "(" + x + ", " + y + "," + z + ")";
    }
}

 class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n= in.nextInt();
        Triplet<String, Integer, Integer>[] entries = new Triplet[n];

        for(int i=0;i<n;i++){
            entries[i] = new Triplet<>(in.next(), in.nextInt(), i+1);
        }

        Comparator<Triplet<String, Integer, Integer>> cmpx = Comparator.comparing(v -> v.x);
        Comparator<Triplet<String, Integer, Integer>> cmpy = Comparator.comparing(v->v.y);
        Arrays.sort(entries, cmpx.thenComparing(cmpy.reversed()));

        for(int i=0;i<n;i++){
            System.out.println(entries[i].z);
        }

    }
}


Measured memory_bytes: 27084
s = input()
ans = []

for i in range(2 ** (len(s) - 1)):
    f = s[0]
    for j in range(len(s) - 1):
        if (i >> j) & 1 == 1:
            f += "+" + s[j + 1]
        else:
            f += s[j + 1]
    #print(eval(f))
    ans.append(eval(f))

print(sum(ans))

Measured memory_bytes: 3060
#include <cstdio>
#include <algorithm>
using namespace std;
const int N=15;
int n;
int p[N],ans;
int main()
{
	scanf("%d",&n);
	for (int i=1;i<=n;i++)
		scanf("%d",&p[i]);
	sort(p+1,p+n+1);
	for (int i=n-1;i;i--)
		ans+=p[i];
	ans+=p[n]/2;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 128
N, A, B, C = map(int, input().split())
L = [int(input()) for _ in range(N)]

# 0, 1, 2, 3(使わない) で前通り試す
from itertools import product

answer = 10 ** 18
for pattern in product(range(4), repeat=N):
    X = [0] * 3
    MP = 0
    for take, length in zip(pattern, L):
        if take == 3:
            continue
        if X[take] != 0:
            MP += 10
        X[take] += length
    if X[0] == 0 or X[1] == 0 or X[2] == 0:
        continue
    MP += abs(A - X[0])
    MP += abs(B - X[1])
    MP += abs(C - X[2])
    answer = min(MP, answer)

print(answer)


Measured memory_bytes: 3064
#include <iostream>
using namespace std;
int main(){
  string S; cin >> S;
  int cnt = 0;
  
  for(int i = 0; i < S.size(); i++){
    if(S.at(0) != 'A'){
      cout << "WA" << endl;
      return 0;
    }
   	else if(i >=2 and i <= S.size() - 2 and S.at(i) =='C'){
      cnt++;
      if(cnt > 1){
        cout << "WA" <<endl;
        return 0;
      }
    }
    
 	else if(i != 0 and 'a' > S.at(i) or 'z' < S.at(i)){
     cout <<"WA" << endl;
     return 0;
   	}
  }
  if(cnt == 1)
  	cout << "AC" << endl;
  else
    cout <<"WA" <<endl;
}

Measured memory_bytes: 3624
S = int(input())
M = 10 ** 9 + 7
def mod_comb(n, k, mod):
	ret = 1
	for i in range(1, k+1):
		ret = (ret * (n+1-i)) % mod
		ret = (ret * pow(i, mod-2, mod)) % mod
	return ret
ans = 0
for K in range(1, S // 3 + 1):
  ans = (ans + mod_comb(S - 2 * K - 1, K - 1, M)) % M
print(ans)


Measured memory_bytes: 64352
#include <stdio.h>
int main(void){
	int n,m,i,j,k,t[16],c[16],p,d;
	for( t[0] = n = i = 1; i < 16; i++ )t[i] = n *= 3;
	for(;scanf("%d%d",&n,&m),n|m;){
		for( k = 0; k < 3; k++ )
			for( scanf("%d",&i); i--; c[j] = k )scanf("%d",&j);
		p = j = 0;
		for( k = 0; k++ < n;){
			j+=t[n-k]*abs(i=p-c[k]),p=i%2*2+p&3;
		}
		k = t[n] - 1 - j;
		if( j > k ) j = k;
		printf("%d\n", j > m ? -1 : j );
	}
	return 0;
}

Measured memory_bytes: 0
#pragma once
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <deque>
#include <numeric>
#include <iomanip>
#define M_PI acos(-1)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1000000007;
const int MAX_V = 201;
int now = 0;

const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
struct edge {
	int t;
	edge(int _t) : t(_t) {}
};
bool use[100010];


vector<edge> te[100010];
vector<edge> fe[100010];
int d[100100];
ll rec(int num) {
	if (num == 0) return 0;
	return rec(num - 1) + num;
}
ll gcd(int a, int b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

ll calc(ll b,ll n){
	if (n < b) return n;
	return calc(b, n / b) + n % b;
}

void Solve() {

	string s;
	cin >> s;
	
	int y = stoi(s.substr(0, 4)) * 10000;
	y += stoi(s.substr(5, 2)) * 100;
	y += stoi(s.substr(8,2));
	if (y <= 20190430) {
		cout << "Heisei" << endl;
	}
	else cout << "TBD" << endl;
}


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



Measured memory_bytes: 6016
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
 
int main() { 
	long double a, b, h, m;
    cin >> a >> b >> h >> m; 
    long double hour_angle = 0.5 * (h * 60 + m);  
    long double minute_angle = 6 * m;
    double angle = abs(hour_angle - minute_angle);
    angle = min(360 - angle, angle);
    angle = (angle*3.14159265358979323846);
    angle /= 180;
    double third = sqrt(a*a + b*b - 2*a*b*cos(angle));
    printf("%.20f\n", third);
	return 0; 
}

Measured memory_bytes: 4232
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n)for(int i=0;i<(n);i++)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
using ll = long long;
using P = pair<int, int>;
using Graph = vector<vector<int>>;

int main(){
    int n, m; cin >> n >> m;
    int max_l = 0, min_r = 1001001001;
    rep(i,m){
        int l, r; cin >> l >> r;
        max_l = max(max_l, l);
        min_r = min(min_r, r); 
    }
    //cout << max_l << min_r << endl;
    if(min_r < max_l) cout << 0 << endl;
    else cout << min_r - max_l + 1 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdio>
#include <string>
#include <cstring>

#define rep(i, n) REP(i, 0, n)
#define REP(i, a, n) for(int i = a ; i < (int)n ; i++)
#define ALL(v) v.begin(), v.end()
#define pii pair<int, int>
#define pb push_back
#define mp make_pair
#define eps 1e-14
#define m0(x) memset(x, 0, sizeof(x))

using namespace std;

int H, W;
string str[30][30];
char alpha[30];

signed main(){
  cin >> H >> W;
  int i_h, i_w;

  REP(i,'A','Z'+1){
    alpha[i-'A'] = i;
  }
  
  rep(i, H){
    rep(j, W){
      cin >> str[i][j];
      if(str[i][j] == "snuke"){
	i_h = i;
	i_w = j;
      }
    }
  }

  cout << alpha[i_w] << i_h+1 << '\n';
}


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

using namespace std;

int main() {
    string S;
    cin >> S;
    int blackOriginCount=0, whiteOriginCount=0;
    for (int i=0; i<S.size(); i++){
        if (i%2==0){
            if (S[i]=='0'){
                whiteOriginCount ++;
            }else{
                blackOriginCount ++;
            }
        }else{
            if (S[i]=='0'){
                blackOriginCount ++;
            }else{
                whiteOriginCount ++;
            }
        }
    }
    cout << min(blackOriginCount, whiteOriginCount) << endl;

    return 0;
}


Measured memory_bytes: 512
s=list(input())
t=list(input())

N=len(s)
M=len(t)

s_cho=[0]*N
t_cho=[0]*M

for i in range(N):
    s_cho[i]=ord(s[i])

for i in range(M):
    t_cho[i]=ord(t[i])

s_cho.sort()
t_cho.sort(reverse=True)

for i in range(N):
    s[i]=chr(s_cho[i])

for i in range(M):
    t[i]=chr(t_cho[i])

if "".join(s)<"".join(t):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
n = gets.to_i
arr = gets.split(' ').map(&:to_i)

a = nil
b = arr.pop

until arr.empty?
  a = arr.pop
  
  break if arr.empty?

  if (a - b) == 1
    a = b - 1
    next
  end
  
  if a <= b
    b = a
    next
  end

  puts 'No'
  exit 0
end


puts 'Yes'



Measured memory_bytes: 8580
def CountingSort(A, B, k):
    C = [0] * (k + 1)
    for a in A: C[a] += 1
    for i in range(1, k+1): C[i] = C[i] + C[i - 1]
    for j in range(n-1, -1, -1):
        B[C[A[j]] - 1] = A[j]
        C[A[j]] += -1
    
n = int(input())
A=[int(i) for i in input().split()]
B = [None] * n
CountingSort(A, B, max(A))
print(' '.join(map(str,B)))

Measured memory_bytes: 244456
#include<cstdio>
#include<functional>
#include<algorithm>
#include<cstring>
using namespace std;
int main(void)
{
	char s[101],t[101];
	int l1,l2,i;
	scanf("%s",s);
	scanf("%s",t);
	l1=strlen(s);
	l2=strlen(t);
	sort(s,s+l1);
	sort(t,t+l2,greater<char>() );
	if(strcmp(s,t)<0)	printf("Yes\n");
	else printf("No\n");
    return 0;
}

Measured memory_bytes: 128