akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;

using vvll = vector< vector<ll> >;
using vll = vector<ll> ;
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>

const ll maxs = 1e6+5;
const ll lmaxs = 20;
ll mod = 1e9+7;
ll oo = 1e15;

#define IOS ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define I insert
#define endl '\n'

using vvll = vector< vector<ll> >;
using vll = vector<ll> ;
#define pbds tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define fastio(); ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);


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

ll inv(ll n){
    return fast(n,mod-2);
}

void pre(){
   
}


void solve(){

    ll k;
    cin >> k;
    string s;
    cin >> s;
    ll n = s.size();
    if(n<=k){
        cout << s;
    }
    else{
        for(ll i=0;i<k;i++)
            cout << s[i];
        cout << "...";
    }
    
}

int main(){
    // #ifndef ONLINE_JUDGE
    // freopen("input00.txt","r",stdin);
    // #endif
    IOS;
    pre();
    ll T = 1;   
    //cin>>T;
    ll tt=1;
    while(T--){
        //cout << "Case #" << tt << ": ";
        tt++;
        solve();
    }
    return 0;
}

Measured memory_bytes: 3588
import itertools

N = int(input())
P = [int(x) for x in input().split(" ")]
Q = [int(x) for x in input().split(" ")]
l = [x for x in range(1, N + 1)]
p = itertools.permutations(l, N)

P = tuple(P)
Q = tuple(Q)
p_index = 0
q_index = 0
for index, v in enumerate(p):
    if v == P:
        p_index = index
    if v == Q:
        q_index = index

print(abs(p_index - q_index))


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const ll mod = 1000000007;
//const ll mod = 998244353;
const int inf = 1e9 + 10;
const ll INF = 1e18;
const ld EPS = 1e-10;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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 (a>b) { a=b; return 1; } return 0; }

int h, w, k, sy, sx;
char a[808][808];

vector<vector<int>> d(808, vector<int>(808, inf));

void bfs() {
  d[sy][sx] = 0;
  queue<pair<int, int>> q;
  q.push({sy, sx});
  while (!q.empty()) {
    int y = q.front().first, x = q.front().second;
    q.pop();
    rep(i, 4) {
      int ry = y + dy[i], rx = x + dx[i];
      if (ry < 0 || ry >= h || rx < 0 || rx >= w || a[ry][rx] == '#') continue;
      if (chmin(d[ry][rx], d[y][x] + 1)) {
        q.push({ry, rx});
      }
    }
  }
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(25);

  cin >> h >> w >> k;
  rep(i, h) {
    rep(j, w) {
      cin >> a[i][j];
      if (a[i][j] == 'S') {
        sy = i;
        sx = j;
      }
    }
  }

  bfs();
  int ans = inf;
  rep(i, h) {
    rep(j, w) {
      if (d[i][j] > k) continue;
      int res = min({i, h - 1 - i, j, w - 1 - j});
      chmin(ans, (res + k - 1) / k + 1);
    }
  }
  cout << ans << '\n';




  
  return 0;
}

Measured memory_bytes: 3456
#include <iostream>
#include <vector>
#include <stdio.h>
#include <string.h>

using namespace std;

int N, S, ans;

void rec(int base, int x, int used) {
    if(x == S && used == N) {
        ans += 1;
        return;
    }
    if(x > S) return;
    for(int i = base; i <= 9; i++) {
        rec(i + 1, x + i, used + 1);
    }
}

int main(void) {
    while(1) {
        scanf("%d%d", &N, &S);
        if(N == 0 && S == 0) break;
        ans = 0;
        rec(0, 0, 0);
        printf("%d\n", ans);
    }
    return 0;
}

Measured memory_bytes: 1188
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n,a[10000],b,c[500],i,k=0,j;
  cin>>n;
  for(i=0;i<n;i++)cin>>a[i];
  cin>>b;
  for(i=0;i<b;i++)cin>>c[i];
  for(i=0;i<b;i++){
    for(j=0;j<n;j++){
      if(c[i]==a[j]){k++;break;}
    }
  }
  cout<<k<<endl;
}

Measured memory_bytes: 3136
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(int i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(int i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(int i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define uniq(x) (x).erase(unique((x).begin(), (x).end()), (x).end())

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // std::ifstream in("input.txt");
    // std::cin.rdbuf(in.rdbuf());
    const int mod = 1e9 + 7;
    string s;
    cin >> s;
    int sl = s.length();
    vector<vector<ll>> dp(2, vector<ll>(2, 0));
    rep(i, sl) {
        if (s[i] == '0') {
            dp[i % 2][0] = dp[(i + 1) % 2][0] * 3 % mod;
            dp[i % 2][1] = dp[(i + 1) % 2][1];
        }
        else {
            if (i == 0) {
                dp[i % 2][0] = 1;
                dp[i % 2][1] = 2;
            }
            else {
                dp[i % 2][0] = (dp[(i + 1) % 2][0] * 3 + dp[(i + 1) % 2][1]) % mod;
                dp[i % 2][1] = (dp[(i + 1) % 2][1] * 2) % mod;
            }
        }
    }
    cout << (dp[(sl - 1) % 2][0] + dp[(sl - 1) % 2][1]) % mod << endl;
    return 0;
}


Measured memory_bytes: 512
'use strict';
var output;
var input = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");
var obj = {
  "list" : input,
  "index" : 0,
  "max" : input.length,
  "next" : function(){
    if(!this.hasNext()){return null;}
    var returnObj = this.list[this.index];
    this.index++;
    return returnObj;
  },
  "hasNext" : function(){return (this.index < this.max);}
}
Main();
function next(){return obj.next();}
function hasNext(){return obj.hasNext();}
function myout(t){console.log(t);}//standard output
function myerr(t){console.error(t);}//standard error
//[no]param
//不明値:何もしない 異常時:文字列「error」を返す（できる？）
//1:数値へ変換 2:半角SPで分割 4:半角SPで分割し、数値配列へ
//6:1文字に分割 7:1文字に分割し、数値配列へ
//8:半角SPで結合 9:改行で結合 0:文字なしで結合
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map((a)=>Number(a));case 6:return i.split("");case 7:return i.split("").map((a)=>Number(a));case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return "error";}}
function Main() {
  var N = myconv(next(),1);
  input.shift();
  input = input.map((a)=>{var tmp = a.split(" ").map(Number);return [tmp[0]-tmp[1],tmp[0]+tmp[1]]});
  input.sort(function(a,b){
  	return a[1] - b[1]
  });
  output = N;
  var end = 0;
  for(var i = 0; i < N; i++){
    if(i == 0){
       end = input[i][1];
    }else{
      if(end > input[i][0]){
         output--;
      }else{
         end = input[i][1];
      }
    }
  }
  myout(output);
}


Measured memory_bytes: 52724
#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <algorithm>
#include <numeric>

typedef long long ll;
const ll INF = 1e18;

int main(int argc, char* argv[])
{
  int N;
  std::cin >> N;

  std::vector< std::string > vs(N, "");

  std::string str;
  char end = 'X';

  std::map< std::string, ll > mc;

  std::string judge = "Yes";
  for (ll i = 0; i < N; i++) {
    std::cin >> str;
    mc[str]++;

    if (mc[str] > 1) {
      judge = "No";
    }
    if (i > 0 && str[0] != end) {
      judge = "No";
    }
    end = str[str.size() - 1];
  }

  std::cout << judge << std::endl;  
  
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h> 
using namespace std;
 int main()
 { string t;
 cin >> t; 
 for(int i = 0; i < t.length(); i++)
 if(t[i] == '?')
 t[i] = 'D'; 
 cout << t << endl;  
 return 0;
 }


Measured memory_bytes: 3700
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,sse3,sse4,popcnt,abm,mmx")

#include <bits/stdc++.h>	
#include <stdio.h>    
 
using namespace std;
     
#define F first
#define S second
#define lb lower_bound          	
#define ub upper_bound
#define pb push_back
#define pf push_front  
#define ppb pop_back
#define mp make_pair
#define bpp __builtin_popcount                                                                                        
#define sqr(x) ((x) * (x))
#define al 0x3F3F3F3F
#define sz(x) x.size()
#define all(x) x.begin(), x.end()
#define in insert
#define ppf pop_front
#define endl '\n'
#define int long long
 
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
 
const int mod = (int)1e9 + 7;                                  
const int N = (int)4e6 + 123;
const ll inf = 3e18 + 1;
                                       
const double pi = acos(-1.0);
const double eps = 1e-7;
const int dx[] = {0, 0, 1, 0, -1};   																																					
const int dy[] = {0, 1, 0, -1, 0};                                                                                                                                                                                                                 

int n, a[N], timer;
int res = inf;

inline int check (int v) {
	int ans = 0;
	while (v) ans += v % 10, v /= 10;
	return ans;
}

inline void boost () {
	ios_base :: sync_with_stdio (NULL);
	cin.tie (NULL), cout.tie (NULL);                                                                                        
}        

inline void Solve () {  
//	boost ();
	cin >> n;
	for (int i = 1; i < n; i ++) {
		int A = i, B = n - i;
		res = min (res, check (A) + check (B));
	}
	cout << res;
}                
                 
main () { 
//	freopen("treasure.in", "r", stdin);    
//	freopen("treasure.out", "w", stdout);          
	int tt = 1;
//	cin >> tt;                        	
	while (tt --) {
		Solve ();
	}        
	return 0;
}

Measured memory_bytes: 256
n = int(input())
monsters = list(reversed(list(map(int,input().split()))))
savers = list(reversed(list(map(int,input().split()))))
kotae = 0
nokori = monsters[0]

for k,i in enumerate(savers):
    a = nokori + monsters[k+1]
    if i >= a:
        kotae = kotae + a
        nokori = 0
    else:
        kotae = kotae + i
        if i >= nokori:
            nokori = a - i
        else:
            nokori = a - nokori
print(kotae)

Measured memory_bytes: 18468
N = int(input())
a = []
for i in range(N):
    a.append(int(input()))

res = []
cnt = 0
i = 0
while True:
    cnt += 1
    i = a[i]-1
    if cnt > 10**5:
        print(-1)
        break
    if i == 1:
        print(cnt)
        break
    

Measured memory_bytes: 7084
#include <iostream>

using namespace std;

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

    int ma = 0, mi = 1e9+1;
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        if (a > ma) {
            ma = a;
        }
        if (a < mi) {
            mi = a;
        }
    }

    cout << ma - mi << 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 ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1e9;
const int MOD = 1000000007;
const double PI = acos(-1);
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};

void solve() {
  int n;
  cin >> n;
  vector<int> a(n), b(n);
  rep(i,n) cin >> a[i];
  rep(i,n) cin >> b[i];

  if (n == 1) {
    cout << a[0] + b[0] << endl;
    return;
  }

  int ans = 0;

  rep(i,n - 1) {
    int temp = a[0] + b[n-1];
    for (int j = 1; j < i + 1; j++) {
      temp += a[j];
    }
    for(int j = i; j < n - 1; j++) {
      temp += b[j];
    }
    ans = max(ans, temp);
  }
  cout << ans << endl;
}

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

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

class Program
{
    static void Main(string[] args) {
        int[] s = Console.ReadLine().Split().Select(int.Parse).ToArray();
        int n = 0;
        for(int i = 1; i <= s[1]-s[0]; i ++) {
            n += i;
        }
        Console.WriteLine(n-s[1]);
    }
}

Measured memory_bytes: 13268
import sys


def rec(length):
    if length == 1:
        return 9
    else:
        return 9 * 10**(length - 1) + rec(length - 2)


n = input()
length = len(n)

if length == 1:
    print(n)
    sys.exit()

if length % 2 == 0:
    ans = rec(length - 1)
else:
    ans = rec(length - 2) + int(n) - int("1" + "0" * (length - 1)) + 1

print(ans)

Measured memory_bytes: 9004
#include <bits/stdc++.h>
using namespace std;
#define DEBUG 0
#define nl          '\n'
#if     DEBUG
#define trace(var)  {cerr << "Line " << __LINE__ << ": " << #var << "=" << var << nl;}
#else
#define trace(var)	{}
#endif
#define fori(n)			for(int i = 0; i < n; ++i) 
#define forj(n)			for(int j = 0; j < n; ++j)
#define fork(n)			for(int k = 0; k < n; ++k)
#define forl(n)			for(int l = 0; l < n; ++l)
#define len length()

typedef long long ll;typedef pair<int,int> pii;typedef vector<bool> vbool;typedef vector<int> vint;typedef vector<ll> vll;typedef long double ld;typedef vector<vector<int>> vvi;

const ll N = 10010;
const ll INF = 0x3f3f3f3f;
const ll MOD = 1e9 + 7;

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	string s,t;
	cin >> s >> t;
	vvi dp(s.len+1, vint(t.len+1, 0));
	for(int i = 1; i <= s.len; ++i) {
		for(int j = 1; j <= t.len; ++j) {
			if (s[i-1] == t[j-1]) 
				dp[i][j] = 1 + dp[i-1][j-1];
			else
				dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
		}		
	}
	string ans;
	int i = s.len, j = t.len;
	cerr << dp[i][j] << nl;
	while(i > 0 && j > 0) {
		if (dp[i-1][j] == dp[i][j]) --i;
		else if (dp[i][j-1] == dp[i][j]) --j;
		else {
			--i; --j; ans = s[i] + ans;
		}
	}

	
	cout << ans << nl;
	#if DEBUG
	cerr << "Time: " << (ld)clock() / CLOCKS_PER_SEC << " s" << nl;
	#endif
	return 0;
}


Measured memory_bytes: 35584
#include<iostream>
#include<vector>
#include<ctype.h>
#include<string>
using namespace std;

string num;

int main(){
    
    while(1){
        cin>>num;
        if(num=="0")break;
        int sum=0;
        for(int i=0;i<num.size();++i){
            sum+=num[i]-'0';
        }
        cout<<sum<<endl;
    }
    return 0;
}




Measured memory_bytes: 3168
#include <iostream>
#include <cmath>

#define ll long long
#define MAX 3010
#define v 9000100
using namespace std;
ll m,mod,dp[3010][3010],f[3010]={0},bek1[v] = {0},bek[v]={0},cnk[3010][3010];
ll beki(ll x, ll a){
	if(a<v && bek[a]!=0){
		return bek[a];
	}
	if(a==0){
		bek[a] = 1;
		return 1;
	}else if(a%2==0){
		if(a<v){
			bek[a] = beki(x,a/2)*beki(x,a/2)%mod;
		}
		return beki(x,a/2)*beki(x,a/2)%mod;
	}else{
		if(a<v){
			bek[a] = beki(x,a/2)*beki(x,a/2)%mod*x%mod;
		}
		return beki(x,a/2)*beki(x,a/2)%mod*x%mod;
	}
}

ll beki1(ll x, ll a){
	if(bek1[a]!=0){
		return bek1[a];
	}
	if(a==0){
		bek1[a] = 1;
	}else if(a%2==0){
		bek1[a] = beki1(x,a/2)*beki1(x,a/2)%m;
	}else{
		bek1[a] = beki1(x,a/2)*beki1(x,a/2)%m*x%m;
	}
	return bek1[a];
}

ll pw(ll a, ll b) {
	ll ans = 1; 
	while (b) {
		while (b%2==0){
			b /= 2;
			a = (a * a) % mod;
		}
		ans = (ans * a) % mod;
		--b;
	}
	return ans;
}

int main(){
	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	ll i,j,n;
	cin >> n >> mod;
	m = mod - 1;
	for(i=0;i<=n;i++){
		for(j=0;j<=n;j++){
			dp[i][j] = 0;
		}
	}
	
	dp[0][0] = 1;
	for(i=1;i<=n;i++){
		for(j=0;j<=i;j++){
			if(j==0){
				dp[i][j] = 1;
			}else{
				dp[i][j] = (dp[i-1][j-1] + (j+1)*dp[i-1][j]%mod)%mod;
			}
		}
	}
	
	for(i=0;i<=n;i++){
		mod -= 1;
		ll x = pw(2,(n-i));
		mod += 1;
		ll y = pw(2,x);
		ll z = pw(2,(n-i));
		for(j=0;j<=i;j++){
			f[i] += y*pw(z,j)%mod*dp[i][j]%mod;
			f[i] = f[i]%mod;
		}
	}

	for (int i = 0; i <= n; ++i){
		for (int j = 0; j <= n; ++j) {
			if (i == j || j == 0)
				cnk[i][j] = 1;
			else if (j > i)
				cnk[i][j] = 0;
			else
				cnk[i][j] = (cnk[i - 1][j] + cnk[i - 1][j - 1]) % mod;
		}
	}
	
	ll ans = 0;
	for(i=0;i<=n;i++){
		ll k = cnk[n][i]*f[i]%mod;
		ans += pow(-1,i)*k;
		ans = (ans+mod)%mod;
	}
	
	cout << ans << endl;
}


Measured memory_bytes: 142976
#include <math.h>
#include <stdlib.h>
int main() {
	int n, t[100000], x[100000], y[100000], dis, dist;
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d%d%d", &t[i], &x[i], &y[i]);
		if (i != 0) {
			dist = t[i] - t[i - 1];
			dis = abs(x[i] - x[i - 1]) + abs(y[i] - y[i - 1]);
		} else {
			dist = t[i];
			dis = abs(x[i]) + abs(y[i]);
		}
		if (dis > dist || (dist - dis) % 2 == 1) {
			printf("No\n");
			return 0;
		}
	}
	printf("Yes\n");
	return 0;
}

Measured memory_bytes: 1280
S = input()
l = len(S)
if S[::-1] != S:
  print('No')
elif S[:int((l-1)/2)] != S[:int((l-1)/2)][::-1]:
  print('No')
elif S[int((l+3)/2-1):] != S[int((l+3)/2-1):][::-1]:
  print('No')
else:
  print('Yes')

Measured memory_bytes: 3064
#include<iostream>
#include<string>
using namespace std;
int main(){
	char ch;
	int counter[26];
	for(int i =0;i<26;i++){
		counter[i] = 0;
	}
	while(cin >> ch){
			ch = tolower(ch);
			int num = ch - 'a';
			counter[num]++;
	}

	for(int i = 0 ; i < 26 ; i++){
		int num = i + 'a';
		cout << (char)num << " "<<":"<<" " << counter[i] <<endl;
	}


	return 0;
} 

Measured memory_bytes: 1140
#include <bits/stdc++.h>
using namespace std;
 
int main() {

  int a, b, c, d;
  
  cin >> a >> b >> c >> d;
  
  if (a + b > c + d) {
    cout << "Left" << endl;
  }else if (a + b < c + d) {
    cout << "Right" << endl;
  }else{
    cout << "Balanced" << endl;
  }
  
}

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

int main(void)
{
  int n,m,p;
  char s[3];

  char *buf_ac = NULL;
  int  *buf_wa = NULL;
  int  sum_ac =0;
  int  sum_wa =0;
  
  
  scanf("%d %d", &n, &m);

  buf_ac = (char *)calloc(n, sizeof(char));
  buf_wa = (int *)calloc(n, sizeof(int));
  
  for (int i=0; i<m; i++){
    scanf("%d %s", &p, s);
    
    if (s[0] == 'A') {
      buf_ac[p-1] = 1;
    } else {
      if (!buf_ac[p-1])
        buf_wa[p-1]++;
    }
  }
  
  
  for (int i=0; i<n; i++) {
	if (buf_ac[i]) {
		sum_ac++;
		sum_wa += buf_wa[i];
	}
  }
  
  printf("%d %d\n", sum_ac, sum_wa);
  
  return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define P pair<int,int>
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000
#define MOD 1000000007
int gcd(int a,int b){
	if(b==0)return a;
	return gcd(b,a%b);
}
int lcm(int a,int b){
	return a/gcd(a,b)*b;
}
int kaijo(int n){
	int ans=1;
	for(int i=1;i<=n;i++){
		ans*=i;
		ans%=MOD;
	}
	return ans;
}
int modpow(int a,int b){
	if(b==0)return 1;
	if(b==1)return a%MOD;
	if(b%2)return modpow(a,b-1)*a%MOD;
	return modpow(a,b/2)*modpow(a,b/2)%MOD;
}
int comb(int a,int b){
	return kaijo(a)*modpow(kaijo(a-b),MOD-2)%MOD*modpow(kaijo(b),MOD-2)%MOD;
}
int n;
int a[100010],b[100010],ans=0;
pair<int,int>c[100010];
signed main(){
	cin>>n;
	rep(i,n){
		cin>>a[i]>>b[i];
		c[i]={a[i]+b[i],i};
	}
	sort(c,c+n);
	reverse(c,c+n);
	rep(i,n){
		if(i%2==0)ans+=a[c[i].second];
		else ans-=b[c[i].second];
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 3328
#include<bits/stdc++.h>
#define fo(i,a,b)for(int i=a,_e=b;i<=_e;++i)
using namespace std;
const int N=105;
int n,m,w,a[N][N],e[N][N];
int b[N][N],c[N][N],dy[N];
vector<int>ex[N][N];
bool us[N];
bool find(int x){
	if(us[x])return 0;
	us[x]=1;
	fo(i,1,n)if(e[x][i]&&(!dy[i]||find(dy[i]))){
		dy[i]=x;
		return 1;
	}
	return 0;
}
int main(){
	cin>>n>>m;
	fo(i,1,n)fo(j,1,m){
		scanf("%d",&a[i][j]);
		w=(a[i][j]+m-1)/m;
		e[i][w]++;
		ex[i][w].push_back(a[i][j]);
	}
	fo(i,1,m){
		fo(j,1,n)dy[j]=0;
		fo(j,1,n){
			fo(k,1,n)us[k]=0;
			find(j);
		}
		fo(j,1,n){
			c[j][i]=b[dy[j]][i]=ex[dy[j]][j].back();
			ex[dy[j]][j].pop_back();
			--e[dy[j]][j];
		}
	}
	fo(i,1,n){
		fo(j,1,m)printf("%d ",b[i][j]);
		printf("\n");
	}
	fo(i,1,n){
		fo(j,1,m)printf("%d ",c[i][j]);
		printf("\n");
	}
}

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {
    static int[] l;
    static int min = Integer.MAX_VALUE;
    static int N, A, B, C;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        N = sc.nextInt();
        A = sc.nextInt();
        B = sc.nextInt();
        C = sc.nextInt();
        l = new int[N];
        for (int i = 0; i < N; i++) {
            l[i] = sc.nextInt();
        }
        sc.close();
        dfs(0, 0, 0, 0, 0);
        System.out.println(min);
    }

    static void dfs(int n, int a, int b, int c, int d) {
        if (n == N) {
            if (a == 0 || b == 0 || c == 0) {
                return;
            }
            int cost = Math.abs(A - a) + Math.abs(B - b) + Math.abs(C - c);
            cost += d - 30;
            min = Math.min(min, cost);
            return;
        }
        dfs(n + 1, a, b, c, d);
        dfs(n + 1, a + l[n], b, c, d + 10);
        dfs(n + 1, a, b + l[n], c, d + 10);
        dfs(n + 1, a, b, c + l[n], d + 10);
    }
}

Measured memory_bytes: 23764
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define int ll
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;

int gcd(int a, int b){
    if(b==0) return a;
    return gcd(b,a%b);
}
int lcm(int a, int b){
    return a*b/gcd(a,b);
}


signed main(void) {
    int i,j;
    int a,b,d;
    while(cin >> a >> b >> d, a){
        int x = INF, y = INF;
        rep(i,3000000){
            if((i * a - d)%b == 0){
                j = (i * a - d)/b;
                if(j < 0);
                else if((x+y == i+j && a*x+b*y > a*i+b*j) || x+y > i+j){
                    x = i;
                    y = j;
                }
            }
            if((i * a + d)%b == 0){
                j = (i * a + d)/b;
                if(j < 0);
                else if((x+y == i+j && a*x+b*y > a*i+b*j) || x+y > i+j){
                    x = i;
                    y = j;
                }
            }
            if((d - i * a)%b == 0){
                j = (d - i * a)/b;
                if(j < 0);
                else if((x+y == i+j && a*x+b*y > a*i+b*j) || x+y > i+j){
                    x = i;
                    y = j;
                }
            }
        }
        cout << x << " " << y << endl;
    }

}



Measured memory_bytes: 3100
#include <stdio.h>
int main(){
  int N,W[200],M=1000000;
  scanf("%d",&N);
  W[0]=0;
  for(int i=1;i<=N;i++){
    scanf("%d",W+i);
    W[i]+=W[i-1]; 
  }
  int S;
  for(int i=1;i<N;i++){
    S=W[N]-2*W[i];
    if(S<0) S=-S;
    if(S<M) M=S;
  }
  printf("%d\n",M);
  return 0;
}

Measured memory_bytes: 1732
#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<string>
#include<algorithm>
using namespace std;
using ll = long long;

int main(){
    int N;
    cin >> N;
    vector<int> A(N), B(N), C(N);
    for(int i = 0; i < N; ++i) {
        cin >> A[i];
    }
    for(int i = 0; i < N; ++i) {
        cin >> B[i];
    }
    for(int i = 0; i < N; ++i) {
        cin >> C[i];
    }
    sort(A.begin(), A.end());
    sort(B.begin(), B.end());
    sort(C.begin(), C.end());
    ll ret = 0;
    // for(int i = 0; i < N; ++i) {
    //     auto iterA = lower_bound(A.begin(), A.end(), B[i]);
    //     auto iterC = upper_bound(C.begin(), C.end(), B[i]);
    //     ret += ll(iterA - A.begin()) * ll(C.end() - iterC);
    // }
    vector<ll> AB(N);
    for(int i = 0; i < N; ++i) {
        auto iter = lower_bound(A.begin(), A.end(), B[i]);
        AB[i] = ll(iter - A.begin());
    }
    for(int i = 1; i < N; ++i) {
        AB[i] += AB[i-1];
    }
    for(int i = 0; i < N; ++i) {
        auto iter = lower_bound(B.begin(), B.end(), C[i]);
        int abidx = int(iter - B.begin()-1);
        if(abidx >= 0)
            ret += AB[abidx];
    }
    cout << ret << endl;
    return 0;
}

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

struct UnionFind {
  vector<int> parent;
  vector<int> height;
  
  UnionFind(int n) {
    for (int i = 0; i < n; i++) {
      parent.push_back(i);
      height.push_back(0);
    }
  }
  
  int find(int x) {
    if (parent.at(x) == x) {
      return x;
    } else {
      parent.at(x) = find(parent.at(x));
      return parent.at(x);
    }
  }

  void unite (int x, int y) {
    int p = find(x);
    int q = find(y);
    if (p == q) return;

    if (height.at(p) < height.at(q)) {
      parent.at(p) = q;
    } else {
      parent.at(q) = p;
      if (height.at(p) == height.at(q)) height.at(p)++;
    }
  }

  bool same(int x, int y) {
    return find(x) == find(y);
  }
};

int main() {
  int N, K, L;
  cin >> N >> K >> L;
  
  UnionFind u1(N);
  for (int i = 0; i < K; i++) {
    int p, q;
    cin >> p >> q;
    
    u1.unite(p - 1, q - 1);
  }
  
  UnionFind u2(N);
  for (int i = 0; i < L; i++) {
    int r, s;
    cin >> r >> s;
    
    u2.unite(r - 1, s - 1);
  }
  
  map<pair<int, int>, int> m;
  
  for (int i = 0; i < N; i++) {
    m[make_pair(u1.find(i), u2.find(i))]++;
  }
  
  for (int i = 0; i < N; i++) {
    cout << m[make_pair(u1.find(i), u2.find(i))];
    
    if (i == N - 1) {
      cout << endl;
    } else {
      cout << " ";
    }
  }
  
  return 0;
}

Measured memory_bytes: 15124
var GET=(function(){function f(s){return new g(s);}function g(s){this._s=s.trim().split("\n");this._y=0;}g.prototype.a=function(f){var s=this._s, y=this._y, r;if(typeof s[y]==="string")s[y]=s[y].split(" ").reverse();r=s[y].pop();if(!s[y].length)this._y++;return f?r:+r;};g.prototype.l=function(f){var s=this._s[this._y++].split(" ");return f?s:s.map(a=>+a);};g.prototype.m=function(n,f){var r=this._s.slice(this._y,this._y+=n).map(a=>a.split(" "));return f?r:r.map(a=>a.map(a=>+a));};g.prototype.r=function(n,f){var r=this._s.slice(this._y,this._y+=n);return f?r:r.map(a=>+a);};return f;})();
var o=GET(require("fs").readFileSync("/dev/stdin","utf8"));
function xArray(v){var a=arguments,l=a.length,r="Array(a["+--l+"]).fill(0).map(x=>{return "+v+";})";while(--l)r="Array(a["+l+"]).fill(0).map(x=>"+r+")";return eval(r);}

console.log(main());
function main(){
  var n = o.a();
  var a = o.l();
  var ans = 0;
  for(var i = 0; i < n; i++){
    ans += 1/a[i];
  }
  return 1/ans;
}

Measured memory_bytes: 21192
#include <bits/stdc++.h>
using namespace std;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
   
    int n, d, x, y, cnt = 0;
    cin >> n >> d;
    for(int i = 0; i < n; i++)
    {
	cin >> x >> y;
	if(hypot(x,y) <= d) cnt++;
    }
    
    cout << cnt;
    
    return 0;
      
}





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

int main() {
    int N, i, count=0;
    cin >> N;
    string a;
    cin >> a;
    string b, c;
    b = a.substr(0, N / 2);
    c = a.substr(N/2, N / 2);
    if(N%2==1){
        cout << "No" << endl;
        return 0;
    }
    if (b==c){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#!/usr/local/bin python
# -*- coding: utf-8 -*-
#
# ~/PycharmProjects/atcoder/D-CaracalVsMonster.py
#
import math

h = int(input())
double_by_attack = int(1)
trial_of_attack = int(0)


for i in range(h):
    if h > 1:
        trial_of_attack = trial_of_attack + double_by_attack
        double_by_attack = double_by_attack * 2
        h = math.floor(h/2)
    else:
        trial_of_attack = trial_of_attack + double_by_attack
        print(trial_of_attack)
        break



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

#define pp push_back
#define pf push_front
#define mp make_pair
#define fs first
#define sc second
#define sf scanf

typedef long long ll;
typedef unsigned long long ull;

using namespace std;

const int N = (int) 1e9;

int main(int argc, char *argv[])
{
	// ios_base::sync_with_stdio(false);
	// cin.tie(NULL);

	int n;
	cin >> n;
	int ans = 0;
	for (int i = 1; i * i <= n; ++i) {
		ans = i * i;
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
program therefore
 implicit none
 integer a,b
 character(len = 3) c
 read *, a
 b = mod(a,10)
 select case (b)
   case (3)
     c = 'bon'
   case (0,1,6,8)
     c = 'pon'
   case default
     c = 'hon'
 end select
 print *,c
end program therefore
 

Measured memory_bytes: 2876
#include <bits/stdc++.h>
using namespace std;
#define inf 1000000007
#define deb(x) cout<<#x<<" : "<<x<<endl;
#define fo(i,n) for(long long int i=0;i<n;i++)
#define Fo(i,k,n) for(long long int i=k;i<n;i++)
#define ll long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define clr(x,y) fo(i,sizeof(x)/sizeof(x[0]))x[i]=y
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
#define uset unordered_set
#define umap unordered_map
#define endl "\n"
#define scanf(arr,n) fo(i,n)cin>>arr[i]
#define printf(x) cout<<x<<"\n"
typedef vector<int> vi;
typedef pair<int,int> pi;
void print (ll *arr, ll n) {fo(i,n){cout<<arr[i]<<" ";}cout<<"\n";}
bool isvaild (int i, int j, int n, int m) { return !( i < 0 or j < 0 or i > n-1 or j > m-1 );}

struct hash_pair {
    template<class T1, class T2>
    size_t operator()(const pair<T1,T2> &p) const 
    {
        auto hash1 = hash<T1>{}(p.first);
        auto hash2 = hash<T2>{}(p.second);

        return hash1^hash2;
    }
};
/*****************************MANASH**********************************/

umap<pi,int,hash_pair> m;

int main ()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    //int t; cin>>t;
    //while (t--)
    {
        ll n;
        cin>>n;
        ll sum = 0;
        Fo(i,1,n+1) Fo(j,1,n+1) Fo(k,1,n+1) sum+=__gcd(i,__gcd(j,k));
         
        cout<<sum;
    }
    
	return 0;
}

Measured memory_bytes: 3628
using System;
using System.Collections.Generic;
using System.Linq;

namespace ConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            var ss = Console.ReadLine().Split();
            var A = int.Parse(ss[0]);
            var B = int.Parse(ss[1]);
            var C = int.Parse(ss[2]);

            Console.WriteLine(A + B >= C ? "Yes" : "No");
        }
    }
}


Measured memory_bytes: 13140
import itertools as it

s = input()
l = [i for i in s]
ans = 7
op = 3

for (a, b, c) in it.product([0,1],repeat=op):
  eq = l[0]
  w = int(l[0])
  for i,x in enumerate((a, b, c)):
    if x == 0:
      eq += "+" + l[i+1]
      w += int(l[i+1])
    else:
      eq += "-" + l[i+1]
      w -= int(l[i+1])
  if w == ans:
    print(eq+"=7")
    break
    

Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

const ll mod = 998244353;

ll mod_pow(ll x, ll n){
    ll ret = 1;
    while(n){
        if(n&1) (ret *= x) %= mod;
        (x*=x)%=mod;
        n>>=1;
    }
    return ret;
}

ll mod_inv(ll x){
    return mod_pow(x,mod-2);
}

const int F = 300030;
ll f[F];

ll C(ll n, ll r){
    if(n-r<0) return 0;

    ll ret = f[n];
    (ret *= mod_inv(f[r])) %= mod;
    (ret *= mod_inv(f[n-r])) %= mod;
    return ret;
}

int main(){
    f[0] = 1;
    for(int i=1; i<F; ++i) f[i] = (f[i-1]*i)%mod;

    ll N,A,B,K;
    cin >>N >>A >>B >>K;

    ll ans = 0;
    rep(x,N+1){
        ll p = K-A*x;

        if(p<0) break;
        if(p%B!=0) continue;

        ll y = p/B;

        ans += C(N,x)*C(N,y);
        ans %= mod;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 2560
import java.util.Scanner;

public class Main {    
    public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
      	s.useDelimiter("\n");
      	int key = s.nextInt();
      	char[] planeChar = s.next().toCharArray();
      	
      	StringBuilder sb = new StringBuilder();
      	for (int i = 0; i < planeChar.length; i++) {
          int intCipher = (planeChar[i] + key);
          if (intCipher > 90) intCipher -= 26;
          sb.append((char)(intCipher));	
        }
        System.out.println(sb);
  }
}

Measured memory_bytes: 23764
#include<bits/stdc++.h>
using namespace std;
#define SORT(c) sort((c).begin(),(c).end());
#define pb push_back
#define MP make_pair
#define pii pair<int,int>
#define pcc pair<char,char>
#define pic pair<int,char>
#define pci pair<char,int>
#define VS vector<string>
#define VI vector<int>
#define VL vector < ll >
#define pi 3.141592653589793
#define ll long long
#define ull unsigned long long
#define w(x) int x;cin>>x;while(x--)
#define fast ios_base::sync_with_stdio(0)
#define sz size()
#define cu cout<<
#define en endl
#define sp " "
#include<cstdio>
#include<cstring>
void bug()
{
    cout << "here\n";
}
typedef unsigned long long UL;
template<typename T>inline T  S(T a)
{
    return a*a;
}
template<class T>inline string tostring(T a)
{
    ostringstream os("");
    os << a;
    return os.str();
}
template<typename T>inline ll tolong(T a)
{
    ll res;
    istringstream os(a);
    os>>res;
    return res;
}
template<typename T>inline T gcd(T a, T b)
{
    if (b == 0)return a;
    else return gcd(b, a % b);
}
template<typename T>inline T bigmod(T a, T b, T m)
{
    if (b == 0)return 1;
    else if (b % 2 == 0)return S(bigmod(a, b / 2, m)) % m;
    else return (a % m*bigmod(a, b - 1, m)) % m;
}
const int inf = (int)1e9 + 5;
const ll linf = (ll)1e16 + 5;
const ll modd = (ll)1e9 + 7;
const int mod = 10000007;
#define N 10000009
bool prime[N];
vector<ll> prm;
void seive ()
{
    memset(prime, true, sizeof(prime));

    for( ll i=2; i*i<=N; i++)
    {

        if (prime[i] == true)
        {
            prm.pb(i);
            for (ll j=i*i; j<=N; j += i)
                prime[j] = false;
        }
    }
}
void pr (int f)
{
    if(f==1)
        cout<<"YES\n";
    else
        cout<<"NO\n";
}
bool isprime(ll n)
{
    if(n<2) return 0;
    if(n==2) return 1;
    else
    {
        for(int i=2; i*i<=n; i++)
            if(n%i==0) return 0;
    }
    return 1;

}

ll countSum(ll x)
{
    ll res = 0;
    while (x != 0)
    {
        res += (x % 10);
        x /= 10;
    }
    return res;
}
const int nx = 2e5+5;
int us[nx];
string vowel = "aeiou";
int main()
{
    fast;
    int a,b;
    cin >> a >> b;
    if(a>=b)
    for ( int i=0;i<a;i++)
        cout <<b;
        else
            for ( int i=0;i<b;i++)
            cout <<a;

}








Measured memory_bytes: 3708
// ABC 88 B

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

typedef long long ll;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const long long INF = 1LL<<60;

int main()
{
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) {
    cin >> a[i];
  }
  sort(a.begin(), a.end(), greater<int>());
  int alice = 0;
  int bob = 0;
  rep(i, n) {
    if (i % 2 == 0) {
      alice += a[i];
    } else {
      bob += a[i];
    }
  }
  cout << alice - bob << endl;
  return 0;
}


Measured memory_bytes: 256
def solve(a, b):
    if (a * b < 0) or (a == 0) or (b == 0):
        return "Zero"
    elif (a < 0) and ((a-b+1) % 2 == 1):
        return "Negative"
    else:
        return "Positive"

a, b = map(int, input().split())
print(solve(a, b))

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

#define int long long

int32_t main(){
	int n; 
	cin >> n ;
	map<string,int> mp ;
	while(n--){
		string s; 
		cin >> s ;
		mp[s]++ ;
	}
	cout << "AC x " << mp["AC"] << endl ;
	cout << "WA x " << mp["WA"] << endl ;
	cout << "TLE x " << mp["TLE"] << endl ;
	cout << "RE x " << mp["RE"] << endl ;
	return 0 ;
}



Measured memory_bytes: 3628
#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, m, n) for(int i=(m); i<(n); ++i)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define Cout(x) cout << (x) << endl
#define dump(x) cerr << #x << " = " << (x) << endl;
typedef long long LL;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
const int inf = (int)1e9;
const long long mod = (long long)1e9 + 7;
const double pi = acos(-1.0);

int main() {
	int n, m, x;
	cin >> n >> m >> x;
	VI a(m); rep(i, m)cin >> a[i];

	int c1 = 0, c2 = 0;
	rep(i, m) {
		if (a[i] < x)c1++;
		if (a[i] > x)c2++;
	}
	cout << min(c1, c2) << endl;
}

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


using namespace std;

int N, K;

int main()
{

 //   std::cout << "Hello World!\n";

    cin >> N >> K ;
    int a  = 0;
    int a1 = 0;
    int b  = 0;

    int con = 0;
    
    a = N;

    while (true) {

        if (a < K) { break; }

        con++;

        a1 = a / K;
        b  = a % K;

        a = a1;


    }

    con++;



    cout << con << "\n";
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <string.h>
#include <vector>
#include <functional>
#include <queue>

using namespace std;
typedef long long ll;

int G[1000][1000];
int Horizontal[1000][1000];
int Vertical[1000][1000];
int HV[1000][1000];

int main()
{
	int H, W;
	
	cin >> H >> W;
	for(int i = 0; i < H; i++){
		char s[1001];
		cin >> s;
		for(int j = 0; j < W; j++){
			G[i][j] = s[j] == '#' ? 1 : 0;
		}
	}
	
	// 横移動の最短
	for(int i = 0; i < H; i++){
		int temp = 9999;
		for(int j = 0; j < W; j++){
			if(G[i][j] == 1) { temp = 0;}
			Horizontal[i][j] = temp;
			temp++;
		}
		for(int j = W-1; j >= 0; j--){
			if(G[i][j] == 1) { temp = 0;}
			if(Horizontal[i][j] > temp){ Horizontal[i][j] = temp; };
			temp++;
		}
	}
	
	// 縦移動の最短
	for(int j = 0; j < W; j++){
		int temp = 9999;
		for(int i = 0; i < H; i++){
			if(G[i][j] == 1) { temp = 0;}
			Vertical[i][j] = temp;
			temp++;
		}
		for(int i = H-1; i >= 0; i--){
			if(G[i][j] == 1) { temp = 0;}
			if(Vertical[i][j] > temp){ Vertical[i][j] = temp; };
			temp++;
		}
	}
	
	int ans = 0;
	
	// 縦、横合わせた最短
	for(int i = 0; i < H; i++){
		int min__ = 0;
		int temp = Horizontal[i][0];
		for(int j = 0; j < W; j++){
			int m = min(Vertical[i][j] , Horizontal[i][j]);
			temp = min(m, temp + 1);
			HV[i][j] = temp;
		}
		
		for(int j = W-1; j >= 0; j--){
			int m = min(Vertical[i][j] , Horizontal[i][j]);
			temp = min(m, temp + 1);
			if (HV[i][j] > temp) { HV[i][j] = temp; }
		}
	}
	
	for(int i = 0; i < H; i++){
		for(int j = 0; j < W; j++){
			if(ans < HV[i][j]){ ans = HV[i][j]; }
		}
	}
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 15872
#include<iostream>
#include <stdlib.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <vector>
#include <cmath>
typedef long long int ll;
using namespace std;

int main(){
	float a,b;
	float c;
	cin >> a>>b;
	c=(a+b)/2;
	cout << round(c) << endl;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int N = 3e5 + 10;
int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >> n;
    string s1 = "ACL",s = "";
    for(int i = 0;i < n;i++){
        s += s1;
    }
    cout << s << "\n";
    return 0;
}
 

Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define show(x) cout << #x << " = " << (x) << endl
#define show2(x,y) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl
#define show3(x,y,z) cout << #x << " = " << (x) << ", " << #y << " = " << (y) <<  ", " << #z << " = " << (z) << endl
#define showv(v) rep(i,v.size()) printf("%d%c", v[i], i==v.size()-1?'\n':' ')
#define showv2(v) rep(j,v.size()) showv(v[j])
#define showt(t,n) rep(i,n) printf("%d%c", t[i], i==n-1?'\n':' ')
#define showt2(t,r,c) rep(j,r) showt(t[j],c)
#define showvp(p) rep(i,p.size()) printf("%d %d\n", p[i].first, p[i].second);
#define printv(v) rep(i,v.size()) printf("%d\n", v[i])
#define printt(t,n) rep(i,n) printf("%d\n", t[i])
#define incl(v,x) find(rng(v),x)!=v.end()
#define incls(s,c) s.find(c)!=string::npos
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define bit(n,k) ((n>>k)&1) // nのk bit目
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vs = vector<string>;
using P = pair<int, int>;
using T = tuple<int, int, int>;
using vp = vector<P>;
using vt = vector<T>;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = (1<<30)-1;
//const ll INF = (1LL<<62)-1;
#define dame { puts("No"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
//inline int in() { int x; scanf("%d",&x); return x;}
template<class T = int> inline T in() { T x; cin >> x; return (x);}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main () {
  int n;
  cin >> n;
  int ans = 0;
  for (int i = 1; i <= n; i+=2) {
    int cnt = 0;
    for (int j = 1; j <= i; ++j) {
      if (i%j == 0) cnt++;
    }
    if (cnt == 8) ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
n=gets.to_i
numbers=gets.chomp.split.map(&:to_i)
loopCount=0
loopContinueFlag=true
loop do
  numbers.each_with_index do |number, index|
    if number%2 == 1
      loopContinueFlag=false
      break
    end
    numbers[index] = number/2
  end
  break if !loopContinueFlag
  loopCount+=1
end
puts loopCount

Measured memory_bytes: 1788
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            double max = 0, min = 0;
            int flag = 0;

            string input;
            while ((input = Console.ReadLine()) != null)
            {
                double h = double.Parse(input);
                if (flag == 0)
                {
                    max = h;
                    min = h;
                    flag = 1;
                }
                else if (h > max)
                {
                    max = h;
                }
                else if (h < min)
                {
                    min = h;
                }


            }

            Console.WriteLine(max - min);


        }
    }
}

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

typedef long long int ll;

int main(){
  ll n;
  cin>>n;
  ll i;
  set <string> s;
  for(i=0;i<n;i++){
    string st;
    cin>>st;
    s.insert(st);
  }
  cout<<s.size()<<endl;
return 0;
}


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

// #undef DEBUG  // Uncomment this line to forcefully disable debug print.
#if DEBUG
template <typename T>
void debug(T value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define dbg(...)                              \
  do {                                        \
    cerr << #__VA_ARGS__ << ": ";             \
    debug(__VA_ARGS__);                       \
    cerr << " (L" << __LINE__ << ")" << endl; \
  } while (0)
#else
#define dbg(...)
#endif

void read_from_cin() {}
template <typename T, typename... Ts>
void read_from_cin(T& value, Ts&... args) {
  std::cin >> value;
  read_from_cin(args...);
}
#define in(type, ...) \
  type __VA_ARGS__;   \
  read_from_cin(__VA_ARGS__);

template <typename T>
void write_to_cout(const T& value) {
  std::cout << value << std::endl;
}
template <typename T, typename... Ts>
void write_to_cout(const T& value, const Ts&... args) {
  std::cout << value << ' ';
  write_to_cout(args...);
}
#define out(...) write_to_cout(__VA_ARGS__);

#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

using ll = long long;

using namespace std;

int main() {
  in(string, s);
  out((s <= "2019/04/30") ? "Heisei" : "TBD");
}


Measured memory_bytes: 3568
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
static class Program{
	const int mod=1000000007;
	static void Main(){
		Sc sc=new Sc();
		int n=sc.I;
		StringBuilder sb=new StringBuilder();
		for(int i = 0;i<n;i++) {
			double[] q=sc.Da;
			double m=q[0]*q[1];
			long d=(long)Math.Sqrt(m);
			if(d*d==m){d--;}
			if(q[0]==q[1]){sb.Append((q[0]*2-2)+"\n");}
			else if(Math.Abs(q[0]-q[1])==1){sb.Append((Math.Min(q[0],q[1])*2-2)+"\n");}
			else if(d*(d+1)>=m){sb.Append((2*d-2)+"\n");}
			else{sb.Append((2*d-1)+"\n");}
		}
		Console.Write(sb);
	}
}

public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()).Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
}

Measured memory_bytes: 11220
K = int(input())

from collections import deque

d = deque()
d = deque([1,2,3,4,5,6,7,8,9])
n = 0

for i in range(K-1):
  x = d[0]
  if not x % 10 == 0:
    d.append((10 * x) + (x % 10) - 1)
    
  d.append((10 * x) + (x % 10))
  
  if not x % 10 == 9:
    d.append((10 * x) + (x % 10) + 1)
    
  d.popleft()

print(d[0])

Measured memory_bytes: 11908
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
namespace AtCoder
{
    class Program
    {
        static public int[] Sarray() { return ReadLine().Split().Select(int.Parse).ToArray(); }
        static public List<int> Slist() { return ReadLine().Split().Select(int.Parse).ToList(); }

        static readonly long Mod = 1000000000 + 7;
        static void Main(string[] args)
        {
            var N = Sarray()[0];
            var P = ReadLine().Split().Select(double.Parse).ToArray();
            
            var dp = new double[N + 1, N + 1];
            dp[0, 0] = 1;
            for (var i = 0; i < N; ++i)
                for (var j = 0; j <= i; ++j)
                {
                    dp[i + 1, j] += dp[i, j] * (1.0 - P[i]);
                    dp[i + 1, j + 1] += dp[i, j] * P[i];
                }
            double ans = 0.0;
            for (var i = N / 2 + 1; i <= N; ++i)
                ans += dp[N, i];
            WriteLine(ans);
        }
    }
}

Measured memory_bytes: 83168