akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
int main() {
    vector<vector<char>> data(2, vector<char>(3));
    for (int i = 0; i < 2; i++) {
        for (int j = 0; j < 3; j++) {
            cin >> data.at(i).at(j);
        }
    }

    if (data[0][0] == data[1][2] && data[0][1] == data[1][1] && data[1][0] == data[0][2]) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main() {
  int n, b, i;
  int cnt = 0;
  scanf("%d", &n);
  for (i=0; i<n; i++) {
    scanf("%d", &b);
    while (b % 2 == 0) {
        cnt++;
        b/=2;
    }
  }
  printf("%d\n", cnt);
  return 0;
}

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

string s;
int map_[1500];

int main()
{
	cin>>s;
	for(int i=0;i<s.size();i++)
		map_[s[i]]=1;
	
	if(map_['N']&&!map_['S']) cout<<"No\n";
	else if(map_['S']&&!map_['N']) cout<<"No\n";
	else if(map_['E']&&!map_['W']) cout<<"No\n";
	else if(map_['W']&&!map_['E']) cout<<"No\n";
	else cout<<"Yes\n";
	return 0;
}

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

int solve(int H,int W, vector<vector<int> > &dp){
  for(int i=0;i<W-1;i++) dp[0][i+1] += dp[0][i];
  for(int i=0;i<H-1;i++) dp[i+1][0] += dp[i][0];

  for(int i=1;i<H;i++){
    for(int j=1;j<W;j++){
      dp[i][j]+=min(dp[i-1][j],dp[i][j-1]);
    }
  }
  return dp.back().back();
}

int main(){
  int H,W;
  cin>>H>>W;
  vector<string> map(H);
  for(int i=0;i<H;i++) cin>>map[i];
  vector<vector<int> > dp(H,vector<int>(W));
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      dp[i][j]=map[i][j]-'0';
    }
  }
  cout<<solve(H,W,dp)<<endl;

}

Measured memory_bytes: 1252
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <climits>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <cctype>
#include <complex>
#include <regex>

using namespace std;

#define C_MAX(a, b) ((a)>(b)?(a):(b))
#define SHOW_VECTOR(v) {std::cerr << #v << "\t:";for(const auto& xxx : v){std::cerr << xxx << " ";}std::cerr << "\n";}
#define SHOW_MAP(v) {std::cerr << #v << endl; for(const auto& xxx: v){std::cerr << xxx.first << " " << xxx.second << "\n";}}

#define EPS 1e-8
#define EQ(a, b) (abs((a)-(b)) < EPS)

typedef complex<double> P;

P dot(P a, P b) {
    return a.real() * b.real() + a.imag() * b.imag();
}

int main() {

    double xp1, yp1, xp2, yp2;
    cin >> xp1 >> yp1 >> xp2 >> yp2;

    P a(xp1, yp1);
    P b(xp2, yp2);

    int Q;
    cin >> Q;

    while (Q--) {

        double x, y;
        cin >> x >> y;

        P c(x, y);

        P X = b - a;
        P Y = c - a;

        P ans = a + (X / abs(X)) * dot(X, Y) / abs(X);

        cout << fixed << setprecision(10) << ans.real() << " " << ans.imag() << endl;

    }

    return 0;
}














































Measured memory_bytes: 3348
#include <bits/stdc++.h>
using namespace std;
#define PI 3.14159265358979323
#define ll long long int
#define vi vector <int>
#define vl vector <ll>
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define MOD 1000000007
ll power(ll a, ll b) { //a^b
	ll res = 1;
	a = a % MOD;
	while (b > 0) {
		if (b & 1) {res = (res * a) % MOD; b--;}
		a = (a * a) % MOD;
		b >>= 1;
	}
	return res;
}

ll gcd(ll a, ll b) {return (b == 0) ? a : gcd(b, a % b);}

ll n, k;

bool check(ll x, vector <ll>& v) {
	ll c = 0;
	for (ll i = 0; i < n; i++) {
		ll d = 1;
		ll t = v[i];
		c = c + t / x;
		if (t % x == 0)
			c--;
	}
	return (c <= k);
}

int main() {
#ifndef ONLINE_JUDGE
	// for getting input from input.txt
	freopen("input.txt", "r", stdin);
	// for writing output to output.txt
	freopen("output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> n >> k;
	vl v(n);
	for (ll i = 0; i < n; i++)
		cin >> v[i];
	sort(all(v));
	ll l = 1, r = v[n - 1];
	ll ans = 1;
	while (l <= r) {
		ll mid = l + (r - l) / 2;
		if (check(mid, v)) {
			ans = mid;
			r = mid - 1;
		}
		else
			l = mid + 1;
	}
	cout << ans << "\n";
}


Measured memory_bytes: 4748
#include <iostream>
#include <vector>
#include <algorithm>
#include <string.h>
#include <stdio.h>
#include <cmath>
#include <math.h>
#include <sstream>
#include <iomanip>
#include <time.h>
#include <fstream>
#include <map>

using namespace std;

int main(){
	int n, a,b;
	cin>>n>>a>>b;
	if ( (b - a + 1)%2 == 1){
		cout<<"Alice"<<endl;
		return 0;
	}
	if ((b - a + 1)%2 == 0){
		cout<<"Borys"<<endl;
		return 0;
	}
	return 0;
}


Measured memory_bytes: 256
open Printf
open Scanf

let tax x = x * 108 / 100
  
let solve n =
  let rec f s l =
    let m = (s + l) / 2 in
    let t = tax m in
    if s + 1 = l then ":("
    else if t = n then string_of_int m
    else if t > n then f s m
    else f m l
  in f 0 50000

let () =
  scanf "%d " solve |> printf "%s\n"


Measured memory_bytes: 384
import itertools

N = int(input())
Ali = list(map(int,input().split()))
C = [0,0,0]

for i in range(N):
  n = 0
  for j in range(3):
    if C[j] == Ali[i]:
      C[j] += 1
      break
  
Ali = Ali[::-1]
if C[0] == C[1] == C[2]:
  r = 1
elif C[0] == C[1] or C[1] == C[2] or C[2] == C[0]:
  r = 3
else:
  r = 6

  
for i in range(N):
  n = 0
  ta = 0 
  for j in range(3):
    if C[j]-1 == Ali[i]:
      n += 1
      ta = j
  r *= n
  C[ta] = Ali[i]
  
print(r%1000000007)

Measured memory_bytes: 14260
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pp pair<pair<ll, ll>,pair<ll, ll>>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define vii vector<int>
#define vll vector<ll>
#define mat vector<vector<ll>>
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define eb emplace_back
#define fi first
#define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (ll) (x).size()
#define pq priority_queue<ll>
#define pqg priority_queue<ll,vector<ll>,greater<ll>>
#define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
#define ERASE(v) sort(v.begin(),v.end());v.erase(unique(v.begin(),v.end()),v.end())
#define int ll
// #define ll int
using namespace std;
const ll INF = (1 << 30 ) - 1;
const ll LLINF = (1LL << 60LL);
const ll MOD = 1000000007;
const ll mod = 998244353;
const ll MAX = 1100000;
const double pi = acos(-1);
const double eps = 1e-10;
ll dx[8] ={1,0,-1,0,1,-1,1,-1};
ll dy[8] ={0,1,0,-1,1,-1,-1,1};
 
template<class T> 
inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> 
inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
 
struct Timer{
    chrono::system_clock::time_point start, end;
    Timer(){ start = chrono::system_clock::now(); }
    ~Timer(){
        end = chrono::system_clock::now();
        auto msec = chrono::duration_cast<chrono::milliseconds>(end - start).count();
        cerr<<"time : "<<msec<<" ms"<<endl;
    }
};
 
 
void solve(){
    ll a,b;
    cin>>a>>b;
    cout<<(a+b)%24<<endl;
} 
 
signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    // Timer TM;
     
    ll Q=1;
    // cin>>Q;
    rep(_,Q){
 
        solve();
 
    }
   
 
 
    return 0;
}

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

#define MIN_INT -2147483648
#define MAX_INT 2147483647
#define MIN_LONG -9223372036854775808L
#define MAX_LONG 9223372036854775807L

#define long long long int

using namespace std;

// @author: pashka

int main() {
    ios::sync_with_stdio(false);

    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        int x;
        cin >> x;
        x--;
        a[x]++;
    }
    sort(a.begin(), a.end());
    
    vector<int> ps(n + 1);
    for (int i = 0; i < n; i++) {
        ps[i + 1] = ps[i] + a[i];
    }
    
    int x = n;
    for (int k = 1; k <= n; k++) {
        while (true) {
            // sum min(a[i], x);
            int l = -1;
            int r = n;
            while (l < r - 1) {
                int m = (l + r) / 2;
                if (a[m] < x) {
                    l = m;
                } else {
                    r = m;
                }
            }
            int s = ps[r] + (n - r) * x;
            if (s < k * x) {
                x--;
            } else {
                break;
            }            
        }
        cout << x << "\n";
    }
    

    return 0;
}

Measured memory_bytes: 3200
def findbomb(x,y,H,W):
    bombnum=0
    #up
    if x!=0:
        bombnum+=(table[x-1][y]=="#")
        if y!=0:
            bombnum+=(table[x-1][y-1]=="#")
        if y!=W-1:
            bombnum+=(table[x-1][y+1]=="#")
    #side
    if y!=0:
        bombnum+=(table[x][y-1]=="#")
    if y!=W-1:
        bombnum+=(table[x][y+1]=="#")
    #bottom
    if x!=H-1:
        bombnum+=(table[x+1][y]=="#")
        if y!=0:
            bombnum+=(table[x+1][y-1]=="#")
        if y!=W-1:
            bombnum+=(table[x+1][y+1]=="#")
    return(bombnum)
H,W=map(int,input().split())
table=[]
for i in range(H):
    table.append(list(input()))
result=[[0]*W for hoge in range(H)]

for x,row in enumerate(table):
    for y,b in enumerate(row):
        if b=="#":result[x][y]="#"
        else:result[x][y]=findbomb(x,y,H,W)
for t in result:
    print(*t,sep="")

Measured memory_bytes: 3572
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int h = sc.nextInt();
        int a = sc.nextInt();
        int ans = 0;
        if (h % a == 0) ans = h / a;
        else ans = h / a + 1;

        System.out.println(ans);
    }
}


Measured memory_bytes: 22356
#include <iostream>

using namespace std;

int main(int argc, char const* argv[])
{
	int x,y;
	int stage[17][17][2];

	while( cin >> x >> y && x != 0 && y != 0 ){
		for( int i = 0;i < 17;i++ ){
			for( int j = 0;j < 17;j++ ){
				stage[i][j][0] = stage[i][j][1] = 0;
			}
		}
		
		
		for( int i = 1;i <= y;i++ ){
			for( int j = 1;j <= x;j++ ){
				cin >> stage[j][i][0];
			}
		}

		for( int i = 0;i < 17;i++ ) if(stage[i][1][0] != 1 ) stage[i][1][1] = 1;

		for( int j = 1;j < y;j++ ){
			for( int i = 1;i <= x;i++ ){
				if( stage[i][j][0] == 1 ) continue;
				if( stage[i][j][0] == 0 ){
					if( stage[i][j + 1][0] != 1 ) stage[i][j + 1][1] += stage[i][j][1];
					
					if( stage[i + 1][j + 1][0] == 0 && ( i + 1 ) <= x ) stage[i + 1][j + 1][1] += stage[i][j][1];
					if( stage[i - 1][j + 1][0] == 0 && ( i - 1 ) >= 1 ) stage[i - 1][j + 1][1] += stage[i][j][1];

				}
				if( stage[i][j][0] == 2 ){
					if( stage[i][j + 2][0] != 1 ) stage[i][j + 2][1] += stage[i][j][1];
				}
			}
		}
		int count = 0;
		for( int i = 1;i <= x;i++ ){
			count += stage[i][y+1][1];
			if( stage[i][y][0] != 1 ) count += stage[i][y][1];
		}
		cout << count << endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <algorithm>
#include <vector>
#include <numeric>
#include <tuple>

using namespace std;

struct UnionFind {
    vector<int> par, sz;

    UnionFind(int N) : par(N), sz(N, 1) {
        iota(par.begin(), par.end(), 0);
    }

    int find(int v) {
        return par[v] == v ? v : par[v] = find(par[v]);
    }

    void unite(int u, int v) {
        u = find(u);
        v = find(v);
        if (sz[u] < sz[v]) swap(u, v);

        sz[u] += sz[v];
        par[v] = u;
    }
};

bool solve() {
    int N, M;
    cin >> N >> M;
    if (N == 0) return false;

    vector<tuple<int, int, int>> edges(M);
    for (auto& e : edges) {
        int u, v, c;
        cin >> u >> v >> c;
        --u, --v;
        e = make_tuple(c, u, v);
    }

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

    UnionFind uf(N);
    int cnt = 0;
    for (auto e : edges) {
        int u, v, c;
        tie(c, u, v) = e;
        if (uf.find(u) == uf.find(v)) continue;
        if (++cnt == N / 2) {
            cout << c << endl;
            break;
        }
        uf.unite(u, v);
    }
    return true;
}

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



Measured memory_bytes: 3228
from itertools import permutations

N, M, R = map(int,input().split())
r = [i - 1 for i in map(int,input().split())]

d = [[float('inf')] * N for _ in range(N)]

for i in range(N):
    d[i][i] = 0

for i in range(M):
    a, b, c = map(int,input().split())
    d[a - 1][b - 1] = c
    d[b - 1][a - 1] = c

for k in range(N):
    for i in range(N):
        for j in range(N):
            if d[i][j] > d[i][k] + d[k][j]:
                d[i][j] = d[i][k] + d[k][j]

ans = 10 ** 12

for each in permutations(r):
    t_dis = 0
    for i in range(R - 1):
        t_dis += d[each[i]][each[i + 1]]

    ans = min(ans, t_dis)

print(ans)


Measured memory_bytes: 53592
#include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>
#include <cmath>
#include <cassert>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main(){
    string s;
    cin >> s;
    vector<int> v(3, 0);
    rep(i, (int)s.size()) {
        ++v[s[i]-'a'];
    }
    if (s.size() == 1) {
        cout << "YES" << endl;
        return 0;
    }
    //cout << v[0] << " " << v[1] << " " << v[2] << endl;
    if ( s.size() == 2 ) {
        if ( v[0] == 0 && v[1] == 0 ||
             v[1] == 0 && v[2] == 0 ||
             v[2] == 0 && v[0] == 0 ) {
            cout << "NO" << endl;
        }
        else {
            cout << "YES" << endl;
        }
        return 0;
    }
    if (v[0] == 0 || v[1] == 0 || v[2] == 0) {
        cout << "NO" << endl;
    }
    else {
        //cout << "test" << endl;
        sort(v.begin(), v.end());
        if (v[2] - v[0] >= 2) cout << "NO" << endl;
        else                  cout << "YES" << endl;
    }
    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define ll long long
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
using namespace std;
const int tINF = (int)INT_MAX;
const long long lINF = (long long)LLONG_MAX;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	#ifdef DEBUG
			assert(freopen("inp", "r", stdin));
			assert(freopen("out", "w",stdout));
	#else
			#define cerr if(false)cerr
	#endif
    int n,m ;
    cin >> n >> m;
    map <int,int> mp;
    vector <int> used(n + 1);
    int ac = 0,wa = 0;
    for(int i = 0; i < m; ++i){
        int num;
        string ver;
        cin >> num >> ver;
        if(used[num] == 1)
            continue;
        else if(ver == "WA"){
            ++mp[num];
        }
        else if(ver == "AC"){
            used[num] = 1;
            
        }
    }
    for(int i = 1; i <= n; ++i){
        if(used[i]){
            ++ac;
            wa += mp[i];
        }
    }
    cout << ac << " "<< wa << '\n';
   cerr << "Time execute: " << (double)clock() / (double)CLOCKS_PER_SEC 
    << " sec" << endl;
}

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

using namespace std;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rrep(i, n) for (ll i = (n - 1); i >= 0; --i)
#define blank(ans) cout << (ans) << " ";
#define mp(p, q) make_pair(p, q)
#define mt(p, q, r) make_tuple(p, q, r)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef string str;

typedef vector<ll> vll;
typedef vector<ld> vd;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<str> vs;
typedef vector<vector<ll>> vvll;
typedef vector<vector<ld>> vvd;
typedef vector<vector<bool>> vvb;
typedef vector<vector<char>> vvc;
typedef vector<vector<str>> vvs;
typedef vector<pair<ll, ll>> vpll;
typedef vector<tuple<ll, ll, ll>> vtlll;

const ld PI = acos(-1.0);
const ll MAX = 9000000000000000000;
const ll MIN = -9000000000000000000;
const ld DMAX = 4500;
const ld DMIN = -4500;
const ll MOD = 1000000007;

template <typename T>
void fin(T a)
{
  cout << a << endl;
  exit(0);
}

//桁数
ll GetDigit(ll num)
{
  return log10(num) + 1;
}

//約数全列挙
vector<ll> enum_div(ll n)
{
  vector<ll> ret;
  for (ll i = 1; i * i <= n; ++i)
  {
    if (n % i == 0)
    {
      ret.push_back(i);
      if (i * i != n)
      {
        ret.push_back(n / i);
      }
    }
  }
  sort(begin(ret), end(ret));
  return ret;
}

//累乗(xのn乗%mod)
ll modpow(ll x, ll n, ll mod = MAX)
{
  ll res = 1;
  while (n > 0)
  {
    if (n & 1)
      res = res * x % mod;
    x = x * x % mod;
    n >>= 1;
  }
  return res;
}

//階乗
ll factorial(ll n)
{
  if (n > 0)
    return n * factorial(n - 1);
  else
    return 1;
}

ll modinv(ll a, ll mod)
{
  ll b = mod, u = 1, v = 0;
  while (b)
  {
    ll t = a / b;
    a -= t * b;
    swap(a, b);
    u -= t * v;
    swap(u, v);
  }
  u %= mod;
  if (u < 0)
    u += mod;
  return u;
}

void Main()
{
  ll x, y; cin >> x >> y;
  ll flag = 0;
  if(abs(x) == abs(y))
  {
    if(x == y) fin(0);
    else fin(1);
  }

  if(x >= 0&&y > 0)
  {
    if(x > y) fin(2 + max(x, y) - min(x, y));
    else fin(max(x, y) - min(x, y));
  }

  if(x < 0&&y < 0)
  {
    if(abs(x) < abs(y)) fin(2 + max(abs(x), abs(y)) - min(abs(x), abs(y)));
    else fin(max(abs(x), abs(y)) - min(abs(x), abs(y)));
  }

  if(x < 0&&y > 0)
  {
    if(abs(x) < abs(y)) fin(1 + max(abs(x), abs(y)) - min(abs(x), abs(y)));
    else fin(1 + abs(x) - y);
  }

  if(x > 0&&y < 0)
  {
    if(x < abs(y)) fin(1 + abs(y) - x);
    else fin(1 + x - abs(y));
  }

  if(x == 0)
  {
    if(x < y) fin(y);
    else fin(abs(y) + 1);
  }

  if(y == 0)
  {
    if(x > y) fin(1 + x);
    else fin(abs(x));
  }
}

//前処理
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(20); //高精度少数表示
  //cout << setfill('0') << internal << setw(4); 0埋め４桁
  Main();
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
#define ll long long
#define lf long double
#define pb push_back
#define mp make_pair
#define F first
#define S second
typedef pair <ll,ll> ii;
typedef vector <ll> vi;
typedef vector <ii> vii;
typedef vector <bool> vb;
typedef vector <vector <ll> > vv;
typedef vector <vector <vector<ll> > > vvv;
typedef vector <string> vs;
typedef vector <lf> vf;
#define tr1(x) cerr << #x << ": " << x << endl
#define tr2(x, y) cerr << #x << ": " << x << " | " << #y << ": " << y << endl
#define tr3(x,y,z) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trv(a) cerr<<#a<<":\n";for(ll zz=0;zz<a.size();zz++) cerr<<a[zz]<<" ";cerr<<endl
#define mod 1000000007
#define inf 1000000000000000000ll

bool possible(ll x,vi &a,ll k)// number of pairs whose product is <=x is >= k
{
	ll n=a.size();
	ll num=0;
	for(ll i=0;i<n;i++)
	{
		if(a[i]>0)
		{
			ll maxp=x/a[i];
			if(maxp*a[i]>x)
			{
				maxp--;
			}
			ll ind=upper_bound(a.begin(),a.end(),maxp)-a.begin();
			if(a[i]*a[i]<=x)
			{
				ind--;
			}
			num+=ind;
		}
		else if(a[i]<0)
		{
			ll minp=x/a[i];
			if(minp*a[i]>x)
			{
				minp++;
			}
			ll ind=lower_bound(a.begin(),a.end(),minp)-a.begin();
			num+=n-ind;
			if(a[i]*a[i]<=x)
				num--;
		}
		else
		{
			if(x>=0)
				num+=n-1;
		}
	}
	num/=2;
	if(num>=k)
	{
		return true;
	}
	return false;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ll n,k;
	cin>>n>>k;
	vi a(n);
	for(ll i=0;i<n;i++)
	{
		cin>>a[i];
	}
	ll low=-inf;
	ll high=inf;
	sort(a.begin(),a.end());
	vi b=a;

	// tr2(low,high);

	while(low<high)
	{
		ll mid=(low+high)/2;
		if(possible(mid,a,k))
		{
			if(possible(mid-1,a,k))
			{
				high=mid-1;
			}
			else
				low=high=mid;
		}
		else
		{
			low=mid+1;
		}
	}
	cout<<low<<endl;
}


Measured memory_bytes: 3456
N = input()
A = [input() for _ in range(N)]
ans = 0
for i in range(N)[::-1]:
  if i==N-1:
    ans += A[i]
  elif A[i]<A[i+1]-1:
    ans = -1
    break
  elif A[i]==A[i+1]-1:
    pass
  else:
    ans += A[i]
if A[0]>0:
  ans = -1
print ans


Measured memory_bytes: 16876
import java.util.Scanner;

//Joseph's Potato
public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(true){
			int n = sc.nextInt();
			int m = sc.nextInt();
			if((n|m)==0)break;
			int k = n-1;
			int r = n;
			boolean[] f = new boolean[n];
			while(r>1){
				int c = 0;
				while(c<m){
					k=(k+1)%n;
					if(!f[k])c++;
				}
				f[k]=true;
				r--;
			}
			for(int i=0;i<n;i++)if(!f[i])System.out.println(i+1);
		}
	}
}

Measured memory_bytes: 12000
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define pi pair<ll, ll>
#define mp make_pair
#define pb push_back
#define vi vector<ll>
#define pd pair<double, double>
#define vp vector<pi>
#define f(i, n) for(int i = 0; i < n; i++)
#define fo(i, a, n) for(int i = a; i < n; i++)
#define mod (1000*1000*1000+7)
#define sz(x) int((x).size())
#define all(x) x.begin(),x.end()
#define DBG(v) cerr << #v << " = " << (v) << endl;
ll INF = (1ll<<61);

using namespace std;

int main(int argc, char* argv[])
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    int n; cin >> n;
    cout << (n+1)/2 << endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#define RE 100
#define RED 0
#define YELLOW 1
#define BLUE 2

int n, A[RE][RE];
int co[RE],de[RE],or[RE],t;

void dvisi(int k)
{
  int i;
  co[k]=YELLOW;
  de[k]=++t;
  for(i=0;i<n;i++)
    {
      if(A[k][i]==0)continue;
      if(co[i]==RED)
	{
	  dvisi(i);
	}
    }
  co[k]=BLUE;
  or[k]=++t;
}

void dep()
{
  int i;
  for(i=0;i<n;i++)co[i]=RED;
  t=0;
  for(i=0;i<n;i++)
    {
      if(co[i]==RED)dvisi(i);
    }
  for(i=0;i<n;i++)
    {
      printf("%d %d %d\n",i+1,de[i],or[i]);
    }
}

int main()
{
  int i,j,ver,dnum,adver;

  scanf("%d",&n);
  for(i=0;i<n;i++)
    {
      for(j=0;j<n;j++)A[i][j]=0;
    }

  for(i=0;i<n;i++)
    {
      scanf("%d %d",&ver,&dnum);
      ver--;
      for(j=0;j<dnum;j++)
	{
	  scanf("%d",&adver);
	  adver--;
	  A[ver][adver]=1;
	}
    }
  dep();
  return 0;
}

Measured memory_bytes: 636
k, n = input().split()
house_list = list(map(int, input().split()))

distances = []
for i in range(int(n)-1):
    distances.append(house_list[i+1] - house_list[i])
distances.append(int(k) - house_list[int(n)-1] + house_list[0])
print(int(k) - max(distances))


Measured memory_bytes: 26444
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <vector>
#include <regex>
#include <map>
#include <set>
#include <iomanip>

using namespace std;
using ll = long long;

int main() {
    int r;
    cin >> r;
    
    cout << r*r << endl;
    return 0;
}




Measured memory_bytes: 256
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = int(input())
Ts = list(mapint())
As = list(mapint())
mod = 10**9 + 7

maxi = [10**18]*N
confirmed = [-1]*N

now = 0
for i in range(N):
    t = Ts[i]
    if t>now:
        now = t
        confirmed[i] = t
    else:
        maxi[i] = t

now = 0
for i in range(N-1, -1, -1):
    a = As[i]
    if a>now:
        now = a
        if maxi[i]<a:
            print(0)
            exit()          
        if confirmed[i]==-1:
            confirmed[i] = a
        elif confirmed[i]!=a:
            print(0)
            exit()
    else:
        maxi[i] = min(maxi[i], a)

ans = 1
for i in range(N):
    if confirmed[i]!=-1:
        continue
    ans *= maxi[i]
    ans %= mod

print(ans)

Measured memory_bytes: 97964
a,b,k=map(int, input().split())
wk=a-k
if wk>=0:
  print(str(wk)+" "+str(b))
else:
  wk=b+wk
  if wk>=0:
    print(str(0)+" "+str(wk))
  else:
    print(str(0)+" "+str(0))  

Measured memory_bytes: 3060
S = input()

max_length = 0
max_length_current = 0
for s in S:
    if s in ['A', 'C', 'G', 'T']:
        max_length_current += 1
    else:
        max_length = max(max_length, max_length_current)
        max_length_current = 0
else:
    max_length = max(max_length, max_length_current)


print(max_length)

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

using namespace std;

int main()
{
    char arr[3];

    for(int i=0; i<3; i++)
    {
        scanf("%c", &arr[i]);
    }

    if(arr[0]=='a' && arr[1]=='b' && arr[2]=='c')
        printf("Yes\n");
    else if(arr[0]=='a' && arr[1]=='c' && arr[2]=='b')
        printf("Yes\n");
    else if(arr[0]=='b' && arr[1]=='a' && arr[2]=='c')
        printf("Yes\n");
    else if(arr[0]=='b' && arr[1]=='c' && arr[2]=='a')
        printf("Yes\n");
    else if(arr[0]=='c' && arr[1]=='b' && arr[2]=='a')
        printf("Yes\n");
    else if(arr[0]=='c' && arr[1]=='a' && arr[2]=='b')
        printf("Yes\n");
    else
        printf("No\n");

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(){
    int i,n[6],q,a,b;
    for(i=0;i<6;i++) scanf("%d",&n[i]);

    scanf("%d",&q);
    for(i=0;i<q;i++){
        scanf("%d %d",&a,&b);
        if(a==n[0]){
            if(b==n[1]){
                printf("%d\n",n[2]);
            }else if(b==n[2]){
                printf("%d\n",n[4]);
            }else if(b==n[3]){
                printf("%d\n",n[1]);
            }else if(b==n[4]){
                printf("%d\n",n[3]);
            }
        }else if(a==n[1]){
            if(b==n[0]){
                printf("%d\n",n[3]);
            }else if(b==n[2]){
                printf("%d\n",n[0]);
            }else if(b==n[3]){
                printf("%d\n",n[5]);
            }else if(b==n[5]){
                printf("%d\n",n[2]);
            }
        }else if(a==n[2]){
            if(b==n[0]){
                printf("%d\n",n[1]);
            }else if(b==n[1]){
                printf("%d\n",n[5]);
            }else if(b==n[4]){
                printf("%d\n",n[0]);
            }else if(b==n[5]){
                printf("%d\n",n[4]);
            }
        }else if(a==n[3]){
            if(b==n[0]){
                printf("%d\n",n[4]);
            }else if(b==n[1]){
                printf("%d\n",n[0]);
            }else if(b==n[4]){
                printf("%d\n",n[5]);
            }else if(b==n[5]){
                printf("%d\n",n[1]);
            }
        }else if(a==n[4]){
            if(b==n[0]){
                printf("%d\n",n[2]);
            }else if(b==n[2]){
                printf("%d\n",n[5]);
            }else if(b==n[3]){
                printf("%d\n",n[0]);
            }else if(b==n[5]){
                printf("%d\n",n[3]);
            }
        }else if(a==n[5]){
            if(b==n[1]){
                printf("%d\n",n[3]);
            }else if(b==n[2]){
                printf("%d\n",n[1]);
            }else if(b==n[3]){
                printf("%d\n",n[4]);
            }else if(b==n[4]){
                printf("%d\n",n[2]);
            }
        }
    }


    return 0;
}



Measured memory_bytes: 2088
let levenshtein_distance s t =
  let m = String.length s in
  let n = String.length t in
  let d = Array.make_matrix (m + 1) (n + 1) 0 in
  for i = 1 to m do
    d.(i).(0) <- i
  done;
  for j = 1 to n do
    d.(0).(j) <- j
  done;
  for j = 1 to n do
    for i = 1 to m do
      d.(i).(j) <-
        min (d.(i-1).(j) + 1)
          (min (d.(i).(j-1) + 1) (d.(i-1).(j-1) + (if s.[i-1] = t.[j-1] then 0 else 1)))
    done
  done;
  d.(m).(n)

let () =
  let s1 = read_line () in
  let s2 = read_line () in
  Printf.printf "%d\n" (levenshtein_distance s1 s2)

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

typedef long long lli;

bool isValid(lli S) {
  lli lim = (lli)(sqrt(1+2*S));
  for(lli x = 1; 2*x+1 <= lim; ++x) {
    if((S-x)%(2*x+1) == 0) return true;
  }
  return false;
}

void gen() {
  int n = 100000;
  cout << n << endl;
  for(int i = 0; i < n; ++i) {
    cout << "2147483645" << endl;
  }
}

int main() {
#ifdef DEBUG
  gen();
  return 0;
#endif

  int n;
  cin >> n;
  int res = 0;
  while(n--) {
    lli t;
    cin >> t;
    res += !isValid(t);
  }
  cout << res << endl;
  return 0;
}

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

int main()
{
    int A[3][3];
    bool T[3][3];
    int N;
    int b[11];

    cin >> A[0][0] >> A[0][1] >> A[0][2];
    cin >> A[1][0] >> A[1][1] >> A[1][2];
    cin >> A[2][0] >> A[2][1] >> A[2][2];
    cin >> N;
    for (int i=0; i<N; i++) {
        cin >> b[i];
    }

    for (int j = 0; j < 3; j++) {
        for (int k = 0; k < 3; k++) {
            T[j][k] = false;
        }
    }

    for(int j=0; j<3; j++) {
        for(int k=0; k<3; k++) {
            for (int i = 0; i < N; i++) {
                if (A[j][k] == b[i]){
                    T[j][k] = true;
                }
            }
        }
    }


    for(int j=0; j<3; j++) {
        if(T[j][0]&&T[j][1]&&T[j][2]) {
            cout << "Yes" << endl;
            return 0;
        }
    }

    for (int k = 0; k < 3; k++) {
        if (T[0][k] && T[1][k] && T[2][k]) {
            cout << "Yes" << endl;
            return 0;
        }
    }

    if (T[0][0] && T[1][1] &&T[2][2]) {
        cout << "Yes" << endl;
        return 0;
    }

    if (T[0][2] && T[1][1] && T[2][0]) {
        cout << "Yes" << endl;
        return 0;
    }

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

Measured memory_bytes: 256
// #define DEBUGGING
#include <bits/stdc++.h>
#define endl '\n'
#define ALL(V) (V).begin(), (V).end()
#define ALLR(V) (V).rbegin(), (V).rend()
using ll = std::int64_t;
using ull = std::uint64_t;
using PLL = std::pair<ll, ll>;
using TLL = std::tuple<ll, ll, ll>;
template <typename T> using V = std::vector<T>;
template <typename T> using VV = V<V<T>>;
template <typename T> const T& var_min(const T &t) { return t; }
template <typename T> const T& var_max(const T &t) { return t; }
template <typename T, typename... Tail> const T& var_min(const T &t, const Tail&... tail) { return std::min(t, var_min(tail...)); }
template <typename T, typename... Tail> const T& var_max(const T &t, const Tail&... tail) { return std::max(t, var_max(tail...)); }
template <typename T, typename... Tail> void chmin(T &t, const Tail&... tail) { t = var_min(t, tail...); }
template <typename T, typename... Tail> void chmax(T &t, const Tail&... tail) { t = var_max(t, tail...); }
template <typename T> const T& clamp(const T &t, const T &low, const T &high) { return std::max(low, std::min(high, t)); }
template <typename T> void chclamp(T &t, const T &low, const T &high) { return t = clamp(t, low, high); }
namespace init__ { struct InitIO { InitIO() { std::cin.tie(nullptr); std::ios_base::sync_with_stdio(false); std::cout << std::fixed << std::setprecision(30); } } init_io; }
#define mv_rec make_v(init, tail...)
template <typename T> T make_v(T init) { return init; }
template <typename T, typename... Tail> auto make_v(T init, size_t s, Tail... tail) { return V<decltype(mv_rec)>(s, mv_rec); }
#undef mv_rec
using namespace std;

const size_t SIZE = 2e5 + 10;
ll A[SIZE], B[SIZE], C[3 * SIZE], Z[3 * SIZE];
ll N;

void z() {
    Z[0] = 3 * SIZE;
    ll i = 1, j = 0;
    while (i < 3 * SIZE) {
        while (i+j < 3 * SIZE && C[j] == C[i+j]) ++j;
        Z[i] = j;
        if (j == 0) { ++i; continue;}
        ll k = 1;
        while (i+k < 3 * SIZE && k+Z[k] < j) Z[i+k] = Z[k], ++k;
        i += k; j -= k;
    }
}

int main() {
    cin >> N;
    for (ll i = 0; i < N; i++) cin >> A[i];
    for (ll i = 0; i < N; i++) cin >> B[i];
    for (ll i = 0; i < N; i++) {
        C[i] = A[i] ^ A[(i + 1) % N];
        C[i + N] = C[i + 2 * N] = B[i] ^ B[(i + 1) % N];
    }

    z();
    V<PLL> ans;
    for (ll i = N; i < 2 * N; i++) {
        if (Z[i] < N) continue;
        ll a = A[0], b = B[i % N];
        ans.emplace_back((N - i % N) % N, (a ^ b));
    }
    sort(ALL(ans));
    for (PLL p : ans) {
        ll a, b;
        tie(a, b) = p;
        cout << a << ' ' << b << endl;
    }
    return 0;
}


Measured memory_bytes: 19180
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define f first
#define s second
#define go ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define mem(arr,v) memset(arr,v,sizeof(arr))
/*bool sortbysec(const pair<int,int> &a,
              const pair<int,int> &b)
{
    return (a.second < b.second);
} */
int main()
{
     ll t,cnt=0,pk;
     string str;
     cin>>str;
     if(str[0]=='A')
     {
         pk=str.size();
         for(int i=1;i<pk;i++)
         {
             if(i>=2 && i<pk-1)
             {
                 if(str[i]=='C')
                    cnt++;
                 else if(str[i]<'a' || str[i]>'z')
                 {
                     cout<<"WA"<<endl;
                     return 0;
                 }
                 else
                    continue;
             }
             else if(str[i]<'a' || str[i]>'z')
                 {
                     cout<<"WA"<<endl;
                     return 0;
                 }
            else continue;
         }
         if(cnt==1)
            cout<<"AC"<<endl;
         else
            cout<<"WA"<<endl;
     }
     else
        cout<<"WA"<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL));
#define MOD 1000000007
#define INF LONG_LONG_MAX
#define MINF LONG_LONG_MIN


void init(){
}

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



void solve(){
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    ll t = (c-1)/b + 1;
    ll tt = (a-1)/d + 1;
    if( tt < t ) cout<<"No"<<endl;
    else cout<<"Yes"<<endl;
    return;
}

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

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

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

    int sum = 0;
    vector<int> a(n);
    for(int i=0; i<n; i++){
        cin >> a[i];
        sum += a[i];
    }
    sort(a.begin(), a.end());
    reverse(a.begin(), a.end());

    if(a[m-1] < sum/(double)(4*m)) cout << "No" << endl;
    else cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << (x) << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){return o<<"("<<p.fs<<","<<p.sc<<")";}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){o<<"sz = "<<vc.size()<<endl<<"[";for(const T& v:vc) o<<v<<",";o<<"]";return o;}
using ll = long long;
int main(){
	int N;
	cin>>N;
	ll S = 0;
	ll inf = 1e10;
	ll mn = inf;
	rep(i,N){
		ll a,b;
		cin>>a>>b;
		S += a;
		if(a>b) chmin(mn,b);
	}
	if(mn==inf){
		puts("0");
		return 0;
	}
	cout<<S-mn<<endl;
}


Measured memory_bytes: 256
N, K = map(int, input().split())
num = [0] * (10**5 + 1)

for _ in range(N):
    a, b = map(int, input().split())
    num[a] += b

ans = 1
while K > 0:
    K -= num[ans]
    ans += 1
print(ans-1)

Measured memory_bytes: 5748
#include<stdio.h>
int main()
{
	long long x,y,i,a;
	while(scanf("%lld %lld",&x,&y)!=EOF)
	{
		if(x%y==0)
		printf("-1\n");
		else
		{
			for(i=2;;i++)
			{
				a=x*i;
				if(a%y!=0)
				break;
			}
			printf("%lld\n",a);
		}
	}
	return 0;
 } 

Measured memory_bytes: 128
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<vector>
#include<algorithm>
#include<stack>
using namespace std;
const int maxn = 100000 + 10;
#define INF 0x7fffffff
#define clr(x,y) memset(x,y,sizeof(x))
typedef long long ll;
#define eps 10e-10
const ll Mod = 1000000007;
char s[100000 + 10];

ll pows(ll x,ll n)
{
    ll ret = 1;
    while(n)
    {
        if(n & 1)
            ret = ret * x % Mod;
        n >>= 1;
        x = x * x % Mod;
    }
    return ret;
}
int a[maxn];
int n;
int cnt[maxn];
int main()
{
    while( ~ scanf("%d",&n))
    {
        clr(cnt,0);
        for(int i = 1; i <= n;i ++)
        {
            scanf("%d",&a[i]);
            cnt[a[i]] ++;
        }
        int cnt1 = 0,cnt2 = 0;
        for(int i = 0; i < n; i ++)
        {
            if(cnt[i] == 1)cnt1 ++;
            else cnt2 ++;
        }
        if(n % 2 && cnt[0] != 1)
        {
            puts("0");continue;
        }
        if(cnt2 != n / 2 * 2)
        {
            puts("0");continue;
        }
        cout << pows(2,n/2) << endl;
    }
    return 0;
}


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

int main(void){

	int a,b,c;
	cin >> a>>b>>c;

	 if(b<c){
	 }else{         swap(b,c);
	 }
	 if(a<b){
	 }else{         swap(a,b);     
	 }
	 if(b<c){
	 }else{         swap(b,c);
	 } 

	
	cout << a << " " << b << " " << c << endl; 

return 0;
}

Measured memory_bytes: 1164
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <functional>

using namespace std;

#define fst first
#define scd second
#define PB push_back
#define MP make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define omajinai ios::sync_with_stdio(false);cin.tie(0)
#define rep(i,x) for(int i=0;i<(int)(x);++i)
#define rep1(i,x) for(int i=1;i<=(int)(x);++i)

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;

template<typename T>T& max(T&a,T&b){if(a>=b)return a;return b;}
template<typename T>T& min(T&a,T&b){if(a<b)return a;return b;}
template<typename T>bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<typename T>bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<typename T>T get(){T a;cin>>a;return a;}
template<typename T>T rev(T a){reverse(all(a));return a;}
template<typename T>vector<T>&sort(vector<T>&a){sort(all(a));return a;}

const int inf = 1e9;
const ll linf = 3e18;
const double eps = 1e-9;

struct edge { int to, cost; edge(int to, int cost) : to(to), cost(cost) {} };
typedef vector<edge> edges;

edges G[3010];
int d[100010];

void dijkstra(int s)
{
    priority_queue<pii, vpii, greater<pii> > pq;
    d[s] = 0;
    pq.push(pii(0, s));
    
    while (pq.size()) {
        pii p = pq.top(); pq.pop();

        int v = p.scd;

        if (d[v] < p.fst) continue;

        for (edge &e : G[v]) {
            if (d[e.to] > d[v] + e.cost) {
                d[e.to] = d[v] + e.cost;
                pq.push(pii(d[e.to], e.to));
            }
        }
    }
}

signed main()
{
    int N, M, K; cin >> N >> M >> K;

    fill_n(d, N + 1, inf);

    rep(i, M) {
        int a, b, l; cin >> a >> b >> l;
        a--, b--;

        G[a].PB(edge(b, l));
        G[b].PB(edge(a, l));
    }

    rep(i, K) {
        int s; cin >> s;
        s--;
        dijkstra(s);
    }

    int ma = -1;

    rep(i, N) {
        for (edge &e : G[i]) {
            ma = max(ma, (int)(d[i] + round(1. * (d[e.to] - d[i] + e.cost) / 2)));
        }
    }

    cout << ma << endl;
}

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

int main(){
  int height;
  int width;
  while(true){
    cin >> height >> width;
    if(height == 0 && width == 0)
      break;
    for (int i = 0; i < height; i++){
      for (int j = 0; j < width; j++){
        if (i == 0 || i == height - 1){
          cout << "#";
        }
        else if (j == 0 || j == width - 1){
          cout << "#";
        }
        else {
          cout << ".";
        }
      }
      cout << "\n";
    }
    cout << "\n";
  }
  return 0;
}



Measured memory_bytes: 3068
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#define SIZE 1000000002

typedef long long int ll;

using namespace std;

// グローバル変数
ll n;
ll ret;

int main(void) {
// 入力
	cin >> n;
	
// 処理
	ret = n * (n - 1) / 2;

// 出力
	cout << ret;

	return 0;
}

Measured memory_bytes: 256
#define r return
i,j,n,f[6];
dx[8]={1,1,0,-1,-1,-1,0,1};
dy[8]={0,1,1,1,0,-1,-1,-1};
char t[10][10],mark[2]={'o','x'};
 
int l(int dx,int dy,int x,int y,char m,int c){
  if(t[x][y]=='.'||t[x][y]=='0')r 0;
  if(t[x][y]==m)r c;
  r l(dx,dy,x+dx,y+dy,m,c+1);
}
int s(int x,int y,char m){
  int k,c;
  c = 0;
  if(t[x][y]!='.')r 0;
  for(k=0;k<8;k++){
    c += l(dx[k],dy[k],x+dx[k],y+dy[k],m,0);
  }
  r c;
}
int p(int dx,int dy,int x,int y,char m){
  if(t[x][y]=='0'||t[x][y]=='.')r 0;
  else if(t[x][y]==m)r 1;
  else if(p(dx,dy,x+dx,y+dy,m)){
    t[x][y]=m;
    r 1;
  }
  else r 0;
}
int o(int x,int y,char m){
  int k;
  t[x][y]=m;
  for(k=0;k<8;k++){
    p(dx[k],dy[k],x+dx[k],y+dy[k],m);
  }
  r 0;
}
 
int main(){
  for(i=0;i<10;i++)t[0][i]=t[9][i]='0';
  for(i=1;i<9;i++){
    scanf("%s",&t[i][1]);
    t[i][0]='0';
    t[i][9]='0';
  }
  f[1]=-1;
  for(n=0;;n=(n+1)%2){
    f[n]=-1;
    for(i=n?8:1;n?i>-1:i<9;n?i--:i++){
      for(j=n?8:1;n?j>-1:j<9;n?j--:j++){
        if(f[n]<s(i,j,mark[n])){
          f[2+n]=i;
          f[4+n]=j;
          f[n]=s(i,j,mark[n]);
        }
      }
    }
    if(f[n]!=0)o(f[2+n],f[4+n],mark[n]);
    if(f[0]==0&&f[1]==0)break;
  }
  for(i=1;i<9;i++){
    for(j=1;j<9;j++){
      printf("%c",t[i][j]);
    }
    puts("");
  }
  r 0;
}

Measured memory_bytes: 524
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <map>

using namespace std;

typedef long long ll;
const int N = 1e5+10;
const ll Maxn = 1e16;

char s[N],ss[N];
int a[N], b[N];
//97 122;
int main(){
	ll k;
	scanf("%s",s);
	scanf("%lld", &k);
	int l = strlen(s);
	for(int i = 0; i < l; i++){
			if(s[i] == 'a') continue;
			else{
			ll x = s[i] - '0' + '0';
			ll y = x - 123;
			ll z = y + k;
		//	printf("%d %d\n", z, y);
			
			if(z >= 0){
				s[i] = 'a';
				k += y;
		//		printf("%d\n", k);
			}
			else if(z < 0){
				continue;
			}
			}
	}
	ll x = s[l - 1] - '0' + '0';
	ll y = x - 123;
	ll z = y + k;
	if(z < 0)
		s[l - 1] += k, k = 0;
	while(k > 0){
		if(k - 26 >= 0){
			s[l - l] = 'a';
			k -= 26;
		}
		else{
			s[l - 1] += k;
			k = 0;
		}
	}
	for(int j = 0; j < l; j++)
		printf("%c", s[j]);
	printf("\n");
}

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

char s[100];
char buf[100];

int main(){
	scanf("%s",s);
	int len = strlen(s);
	int i;
	int cnt = 0;
	for(i = 0 ;i<len;i++){
		if(s[i] == 'B'){
			if(cnt > 0){
				buf[--cnt] = 0;
			}
		}else
			buf[cnt++] = s[i];
	}
	printf("%s\n",buf);
}


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

using namespace std;

#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)((x).size()))

typedef pair<int, int> PII;
typedef vector<int> VI;
typedef long long int64;
typedef unsigned int uint;
typedef unsigned long long uint64;

#define gi(x) ((x) = F())
#define gii(x, y) (gi(x), gi(y))
#define giii(x, y, z) (gii(x, y), gi(z))

int F()
{
	char ch;
	int x, a;
	while (ch = getchar(), (ch < '0' || ch > '9') && ch != '-');
	if (ch == '-') ch = getchar(), a = -1;
	else a = 1;
	x = ch - '0';
	while (ch = getchar(), ch >= '0' && ch <= '9')
		x = (x << 1) + (x << 3) + ch - '0';
	return a * x;
}

int n, m;

char str[510][510];

int main()
{
	gii(n, m);
	for (int i = 1; i <= n; ++i) scanf("%s", str[i] + 1);
	for (int i = 1; i <= n; ++i)
	{
		for (int j = 1; j <= m; ++j)
		{
			if (((j == 1 || (i & 1)) && j != m) || str[i][j] == '#')
				putchar('#');
			else
				putchar('.');
		}
		putchar('\n');
	}
	for (int i = 1; i <= n; ++i)
	{
		for (int j = 1; j <= m; ++j)
		{
			if (((j == m || !(i & 1)) && j != 1) || str[i][j] == '#')
				putchar('#');
			else
				putchar('.');
		}
		putchar('\n');
	}
}



Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i,n,k) for(ll i=(n);i<(k);i++)
#define ALL(a)  (a).begin(),(a).end()
const ll MAX = 2000000;
const ll MOD = 1000000007;
ll ans=0;
ll fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll 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;
    }
}

void fact(ll m,map<ll,ll> &X){//素因数-指数のmapを返す
    X[1]=0;
    bool flag;
    while(m){
        flag=false;
        For(i,2,sqrt(m)+2){
            if(m%i==0){
                flag=true;
                m/=i;
                X[i]++;
                break;
            }
        }
        if(flag) continue;
        X[m]++;
        break;
    }
}

//べき乗計算
ll modpow(ll a,ll n,ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

void Main(){
    COMinit();
    ll n;cin>>n;
    vector<ll> a(n);
    vector<map<ll,ll>> mp(n);
    For(i,0,n) cin>>a[i];
    ll LCM=1;
    map<ll,ll> all;
    For(i,0,n) {
        fact(a[i],mp[i]);
        for(auto p:mp[i]){
            all[p.first]=max(all[p.first],p.second);
        }
    }
    for(auto p:all){
        ll num=p.second;
        ll cnt=modpow(p.first,num,MOD);
        LCM*=cnt;
        LCM%=MOD;
    }    
    For(i,0,n){
        ll b;
        b=LCM*inv[a[i]];
        ans+=b;
        ans%=MOD;
    }
    cout<<ans<<endl;
}
int main(){
    Main();
    return 0;
}

Measured memory_bytes: 51456
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = 1e10

#solve
def solve():
    n, m = LI()
    ok = [1] * n
    ans = [0] * n
    ans[0] = 1
    for _ in range(m):
        x, y = LI_()
        ok[x] -= 1
        ok[y] += 1
        if ans[x]:
            ans[y] = 1
        if ok[x] == 0:
            ans[x] = 0
    print(sum(ans))
    return


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


Measured memory_bytes: 44908
#include <iostream>

using namespace std;

int main() {
    int z; 
    while (cin >> z) {
        if (z == 0) break;
        int max_x_y = 0;
        for (int x = 1; x < z; x++) {
            for (int y = x; y < z; y++) {
                if (x*x*x + y*y*y > z*z*z) break;
                if (max_x_y < x*x*x + y*y*y)
                    max_x_y = x*x*x + y*y*y;
            }
        }
        cout << z*z*z - max_x_y << endl;
    }
    return 0;
}

Measured memory_bytes: 864