akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <list>
#include <cstdint>
#include <bits/stdc++.h>
#include <queue>
#include <set>

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep_r(i, n) for (int i = n - 1; i >= 0; i--)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define all(x) (x).begin(), (x).end()
#define SZ(x) ((ll)(x).size())
#define bit(n) (1LL << (n))
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());

#define INF bit(60)
#define pb push_back
#define mod 1000000007

template <class T>
bool chmax(T &a, const T &b)
{
  if (a < b)
  {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
  if (b < a)
  {
    a = b;
    return 1;
  }
  return 0;
}

using namespace std;
using uif = uint_fast64_t;
using ll = long long int;

int qp(int a, ll b)
{
  int ans = 1;
  do
  {
    if (b & 1)
      ans = 1ll * ans * a % mod;
    a = 1ll * a * a % mod;
  } while (b >>= 1);
  return ans;
}
int qp(int a, ll b, int mo)
{
  int ans = 1;
  do
  {
    if (b & 1)
      ans = 1ll * ans * a % mo;
    a = 1ll * a * a % mo;
  } while (b >>= 1);
  return ans;
}

int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

#define FACSIZE 200002

ll invfac[FACSIZE];
ll fac[FACSIZE];

ll mod_pow(ll, ll);
ll mod_add(ll, ll);
ll mod_mul(ll, ll);
ll mod_div(ll, ll);
void make_fact(ll);
void make_invfact(ll);

int main(void)
{

  ll n, m, k;
  cin >> n >> m >> k;

  make_fact(200003);
  make_invfact(200002);

  ll ans = 0;
  ll comb = mod_mul(fac[n * m - 2], mod_mul(invfac[k - 2], invfac[(n * m - 2) - (k - 2)]));

  for (ll d = 1; d < n; d++)
  {

    ll tmp = 0;
    tmp = mod_mul(d, comb);
    tmp = mod_mul(tmp, n - d);
    tmp = mod_mul(tmp, m);
    tmp = mod_mul(tmp, m);

    ans = mod_add(ans, tmp);
  }
  for (ll d = 1; d < m; d++)
  {

    ll tmp = 0;
    tmp = mod_mul(d, comb);
    tmp = mod_mul(tmp, m - d);
    tmp = mod_mul(tmp, n);
    tmp = mod_mul(tmp, n);

    ans = mod_add(ans, tmp);
  }

  cout << ans << endl;

  return 0;
}

ll mod_pow(ll x, ll r)
{
  if (r == 0)
    return 1;
  else if (r == 1)
    return x % mod;
  else if (r % 2 == 0)
  {
    ll t = mod_pow(x, r / 2) % mod;
    return t * t % mod;
  }
  else
  {
    ll t = mod_pow(x, r / 2) % mod;
    ll k = t * t % mod;
    return k * x % mod;
  }
}
ll mod_add(ll a, ll b)
{
  return (a + b) % mod;
}

ll mod_mul(ll a, ll b)
{
  return (a * b) % mod;
}

ll mod_div(ll a, ll b)
{
  return mod_mul(a, mod_pow(b, mod - 2));
}

void make_fact(ll n)
{
  fac[0] = 1;
  rep(i, n)
  {
    fac[i + 1] = mod_mul(fac[i], i + 1);
  }
}

void make_invfact(ll n)
{
  invfac[n] = mod_pow(fac[n], mod - 2);
  for (int i = n - 1; i >= 0; i--)
  {
    invfac[i] = mod_mul(invfac[i + 1], i + 1);
  }
}

Measured memory_bytes: 3328
#include <iostream>
#include <fstream>

#include <cmath>

using namespace std;

int main(){

    double x1,y1,x2,y2;

    cin >> x1 >> y1 >> x2 >> y2;

    double ans = sqrt(pow(fabs(x1-x2),2) + pow(fabs(y1-y2),2));
    printf("%.5f\n",ans);
    
    return 0;
}


Measured memory_bytes: 3208
/* include */
#include "bits/stdc++.h"
/* namespace */
using namespace std;

/* typedef */
/* long系 */
typedef long long ll;	// long long
typedef long double ld;	// long double
/* vector系 */
typedef vector<int> vint;	// intのvector
typedef vector<double> vdouble;	// doubleのvector
typedef vector<ll> vll;	// llのvector
typedef vector<ld> vld;	// ldのvector
typedef vector<pair<int, int>> vi_i;	// i_iのvector
typedef vector<pair<double, double>> vd_d;	// d_dのvector
typedef vector<pair<ll, ll>> vl_l;	// l_lのvector
typedef vector<pair<ld, ld>> vld_ld;	// ld_ldのvector
typedef vector<string> vstring;	// stringのvector
/* pair系 */
typedef pair<int, int> i_i;	// int同士のpair
typedef pair<double, double> d_d;	// double同士のpair
typedef pair<ll, ll> l_l;	// ll同士のpair
typedef pair<ld, ld> ld_ld;	// ld同士のpair

/* define */
#define pb push_back	// push_back
#define all(v) v.begin(),v.end()	// コンテナ全体
#define PI (acos(-1))  // 円周率pi

/* 変数入出力 read, write */
template <typename T>	// 1変数
void read(T& x) {
	cin >> x;
}
template <typename T, typename T0>	// 2変数
void read(T& x, T0& y) {
	cin >> x >> y;
}
template <typename T, typename T0, typename T1>	// 3変数
void read(T& x, T0& y, T1& z) {
	cin >> x >> y >> z;
}
template <typename T, typename T0, typename T1, typename T2>	// 4変数
void read(T& x, T0& y, T1& z, T2& w) {
	cin >> x >> y >> z >> w;
}
template <typename T>	// 1変数
void write(T& x) {
	cout << x << endl;
}
template <typename T, typename T0>	// 2変数
void write(T& x, T0& y) {
	cout << x << " " << y << endl;
}
template <typename T, typename T0, typename T1>	// 3変数
void write(T& x, T0& y, T1& z) {
	cout << x << " " << y << " " << z << endl;
}
template <typename T, typename T0, typename T1, typename T2>	// 4変数
void write(T& x, T0& y, T1& z, T2& w) {
	cout << x << " " << y << " " << z << " " << w << endl;
}
// vectorの出力
template <typename T>
void printvec(const vector<T> &data) {
    		    for (const auto elm : data) {
      		    	cout << elm << " ";
    		    }
    		    cout << endl;
}


// 最大公約数
ll gcd(ll a, ll b) {
	if (a % b == 0) {
		return b;
	}
	else {
		return gcd(b, a % b);
	}
}


int main(void) {
    ll k; read(k);
    ll ans = 0;
    for (ll i = 1; i <= k; i++) {
        for (ll j = 1; j <= k; j++) {
            for (ll l = 1; l <= k; l++) {
                ll reg = gcd(i, j);
                reg = gcd(reg, l);
                ans += reg;
            }
        }
    }
    write(ans);

    return 0;
}


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

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int a, b;
    cin >> a >> b;
    cout << a*b <<" " << (a+b) * 2 << endl;
    return 0;
}



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


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

    string s;
    cin >> s;
    int l;
    l = s.size();
    for(int i = 0; i < l; i++){
        cout << "x";
    }
    cout << endl;
    
}

Measured memory_bytes: 256
#define TST 0
#include <iostream>
#include <fstream>
#include <string>
#include <cmath>
#include <vector>
#include <algorithm>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <cctype>
#include <bits/stdc++.h>
#include <queue>

using namespace std;
// for loop
#define F(i, L, R) for(long i = L; i < R; i++)
#define FE(i, L, R) for(long i = L; i <= R; i++)
// for (reversed)
#define FR(i, L, R) for(long i = L; i > R; i--)
#define FRE(i, L, R) for(long i = L; i >= R; i--)

// data types
#define Int long
#define ul unsigned long
#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define us unsigned shoft

// vectors
typedef vector<int> vi;
typedef vector<long> vl;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
#define ALL(c) (c).begin(),(c).end()
#define last(vec) vec.size()-1
#define lastEle(vec) vec[last(vec)]
#define pb push_back
#define InputV(a, n) F(i,0,n){long l; cin >> l; a.pb(l);}

// debug
#define DBG(vari) cerr<<#vari<<" = "<<(vari)<<endl;
#define printA(a, L, R) FE(i, L, R) cout << a[i] << (i==R?'\n':' ')
#define printAF(a, L) printA(a, 0, L-1)
#define printV(a) printA(a, 0, a.size()-1)
#define printM(a, n, m) F(i, 0, n){ FE(j, 0, m) cout << a[i][j] << (i==m?'\n':' ');}

// utils
#define char2int(c) (c-'0')
#define bit(x, i) (x&(1<<i))
#define space ' '
#define PI 3.14159265358979323

template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

#define printMatrix(mat,n,m){ \
    F(i, 0, n){               \
        F(j, 0, m){           \
            cout << mat[i][j] << space;\
        }\
        cout << endl;\
    }\
}
struct Proc {
    string name;
    long time;
};

int main() {
#if TST==1
    ifstream in ("input.txt");
    cin.rdbuf(in.rdbuf());
#endif
    int n;
    cin >> n;
    vector<int> order;
    pair<int, int> coordinate[8];
    F(i, 0, n){
        cin >> coordinate[i].first;
        cin >> coordinate[i].second;
    }
    F(i, 0, n)order.pb(i); 
    double ans = 0;
    int count = 0;
    do{
        count ++;
        FE(i, 0, n-2){
            double x = pow(abs(coordinate[order[i]].first - coordinate[order[i+1]].first),2);
            double y = pow(abs(coordinate[order[i]].second - coordinate[order[i+1]].second), 2);
            ans += sqrt(x + y);
        }
    }while(next_permutation(order.begin(), order.end()));

#if TST==1
#endif
    printf("%1.10lf\n",ans/count);
}


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

int main() {
   int n, m;

   cin >> n >> m;

   if(n == 0){
     cout << "No" << endl;
     return 0;
   }

   if(n==m){
     cout << "Yes" << endl;
   }else{
     cout << "No" << endl;
   }

   return 0;
  }




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

public class Main {

 private BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 1);

 private String inputData = null;

 private String[] data;

 private int left;

 private int center;

 private int right;

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

 public void start() {
  try {
   this.inputData = reader.readLine();
  } catch (IOException e) {
   e.printStackTrace();
  }

  this.data = this.inputData.split(" ");

  this.left = Integer.parseInt(this.data[0]);
  this.center = Integer.parseInt(this.data[1]);
  this.right = Integer.parseInt(this.data[2]);

  if (this.left < this.center &&
  this.center < this.right &&
  this.left < this.right) {
   System.out.println("Yes");
  } else {
   System.out.println("No");
  }

 }

}

Measured memory_bytes: 17072
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <utility>
#include <queue>
#include <set>
#include <map>

using namespace std;
typedef  long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
#define  MP make_pair
#define  PB push_back
#define inf  1000000007
#define rep(i,n) for(int i=0;i<(int)(n);++i)

int main(){
	int w,h;
		while(cin >> w >> h&&w!=0){
		vector<string>v(h);
		rep(i,h){
			cin >> v[i];
		}
		vector<int> p;
		int s;
		rep(i,h){
			rep(j,w){
				if(v[i][j]=='o'){
					s = i*w+j;
					v[i][j] = '.';
				}
				if(v[i][j]=='*'){
					p.PB(i*w+j);
					v[i][j] = '.';
				}
			}
		}
		vector<vector<long long> > d(h*w,vector<long long>(h*w,inf));
		rep(i,h){
			rep(j,w){
				if(i!=0){
					if(v[i][j]=='.'&&v[i-1][j]=='.'){
						d[i*w+j][(i-1)*w+j]=1;
						d[(i-1)*w+j][i*w+j]=1;
					}
				}
				if(i!=h-1){
					if(v[i][j]=='.'&&v[i+1][j]=='.'){
						d[i*w+j][(i+1)*w+j]=1;
						d[(i+1)*w+j][i*w+j]=1;		
					}
				}
				if(j!=0){
					if(v[i][j]=='.'&&v[i][j-1]=='.'){
						d[i*w+j][i*w+j-1]=1;
						d[i*w+j-1][i*w+j]=1;		
					}
				}
				if(j!=w-1){
					if(v[i][j]=='.'&&v[i][j+1]=='.'){
						d[i*w+j][i*w+j+1]=1;
						d[i*w+j+1][i*w+j]=1;		
					}
				}
			}
		}
		rep(k,h*w){
			rep(i,h*w){
				rep(j,h*w){
					d[i][j] = min(d[i][j],d[i][k]+d[k][j]);
				}
			}
		}
		ll ans = inf+inf;
		do{
			ll tmp=0;
			tmp += d[s][p[0]];
			for(int i=0;i<p.size()-1;i++){
				tmp += d[p[i]][p[i+1]];
			}
			ans = min(ans,tmp);
		}while(next_permutation(p.begin(),p.end()));
		if(ans>=inf)cout << -1 << endl;
		else cout << ans << endl;
	}
	return 0;
}

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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s;
  cin >> s;
  if(s[2] == s[3] && s[4] == s[5])
  {
    cout << "Yes" << endl;
  }
  else cout << "No" << endl;
  return 0;
}


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

typedef long long llong;
typedef unsigned long long ullong;
// -2.1e-9 <= int <= 2.1e9
// -9.2e-18 <= long long <= 9.2e18
// 0 <= unsigned int <= 4.2e9
// 0 <= unsigned long long <= 18.4e18
// cout << fixed << setprecision(10);

int main() {
    llong a, b, c, d;
    cin >> a >> b >> c >> d;
    llong z1 = a * c;
    llong z2 = a * d;
    llong t1 = max(z1, z2);

    llong z3 = b * c;
    llong z4 = b * d;
    llong t2 = max(z3, z4);

    llong ans = max(t1, t2);
    cout << ans << endl;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define l long
#define pb push_back
#define mp make_pair
#define mt make_tuple
int main() {
	// your code goes here
	//ifstream cin("input.txt");
	//ofstream cout("output.txt");
	ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
	string s; cin>>s;
	if(s[0]=='7'||s[1]=='7'||s[2]=='7') cout<<"Yes";
	else cout<<"No";
	return 0;
}


Measured memory_bytes: 3648
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
      	String s = sc.next();
      	int M = Integer.parseInt(s);
      	int x = 48 - M;
      	System.out.println(x);
      	sc.close();
    }
}

Measured memory_bytes: 21588
import math

n, q = map(int, input().split())

# make a list whose length is 2^i - 1.
n = 2 ** math.ceil(math.log(n, 2))
max_v = 2147483647

A = [max_v for i in range(2 * n - 1)]


def update(i, x):
    i += n - 1
    A[i] = x

    while i > 0:
        i = (i - 1) // 2
        A[i] = min(A[i * 2 + 1], A[i * 2 + 2])

def find(a, b, k, l, r):
    if r <= a or b <= l:
        return max_v
    elif a <= l and r <= b:
        return A[k]
    else:
        vl = find(a, b, k * 2 + 1, l, (l + r) // 2)
        vr = find(a, b, k * 2 + 2, (l + r) // 2, r)
        return min(vl, vr)


for i in range(q):
    com, x, y = map(int, input().split())
    if com == 0:
        update(x, y)
    else:
        ans = find(x, y + 1, 0, 0, n)
        print(ans)

Measured memory_bytes: 11220
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[][]A = new int[2][N];
		for(int i = 0; i < N; i++) {
			A[0][i] = sc.nextInt();
		}
		for(int i = 0; i < N; i++) {
			A[1][i] = sc.nextInt();
		}
		sc.close();
		if(N == 1) {
			System.out.println(A[0][0] + A[1][0]);
			System.exit(0);
		}
		int[][]B = new int[2][N];
		B[0][0] = A[0][0];
		B[1][0] = A[1][0] + A[0][0];
		for(int i = 1; i < N; i++) {
			B[0][i] = B[0][i - 1] + A[0][i];
			B[1][i] = B[1][i - 1] + A[1][i];
		}
		for(int i = 1; i < N; i++) {
			B[1][i] = Math.max(B[1][i - 1], B[0][i]) + A[1][i];
		}
		System.out.println(B[1][N - 1]);
	}
}

Measured memory_bytes: 25172
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

const pi = math.Pi

var mod int = pow(10, 9) + 7
var Umod uint64 = 1000000007
var cnt int

func main() {
	reader.Split(bufio.ScanWords)
	K, _ := strconv.Atoi(read())
	X, _ := strconv.Atoi(read())

	for i := -1000000; i <= 1000000; i++ {
		if X-K < i && i < X+K {
			fmt.Printf("%d ", i)
		}
	}
	fmt.Printf("\n")
}

/*  ----------------------------------------  */

var reader = bufio.NewScanner(os.Stdin)

func read() string {
	reader.Scan()
	return reader.Text()
}

func lcm(x, y int) int {
	return (x / gcd(x, y)) * y
}

func gcd(x, y int) int {
	if x%y == 0 {
		return y
	} else {
		r := x % y
		return gcd(y, r)
	}
}

var fac [1000000]int
var finv [1000000]int
var inv [1000000]int

func combination_init() {
	fac[0], fac[1] = 1, 1
	finv[0], finv[1] = 1, 1
	inv[1] = 1

	// invは a^(-1) mod p
	// pをaで割ることを考える

	// p/a*(a) + p%a = p
	// p/a*(a) + p%a = 0          (mod p)
	// -p%a = p/a*(a)             (mod p)
	// -p%a *a^(-1)= p/a          (mod p)
	// a^(-1)= p/a * (-p%a)^(-1)  (mod p)
	// a^(-1) =

	for i := 2; i < 1000000; 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
	}
}

func combination(x, y int) int {
	if x < y {
		return 0
	}
	if fac[0] != 1 {
		combination_init()
	}
	return fac[x] * (finv[y] * finv[x-y] % mod) % mod
	//return fac[x] / (fac[y] * fac[x-y])
}

func permutation(x, y int) int {
	if x < y {
		return 0
	}
	if fac[0] != 1 {
		combination_init()
	}
	return fac[x] * (finv[x-y] % mod) % mod
	//return fac[x] / fac[x-y]
}

func max(x ...int) int {
	var res int = x[0]
	for i := 1; i < len(x); i++ {
		res = int(math.Max(float64(x[i]), float64(res)))
	}
	return res
}

func min(x ...int) int {
	var res int = x[0]
	for i := 1; i < len(x); i++ {
		res = int(math.Min(float64(x[i]), float64(res)))
	}
	return res
}
func pow(x, y int) int { return int(math.Pow(float64(x), float64(y))) }
func abs(x int) int    { return int(math.Abs(float64(x))) }
func floor(x int) int  { return int(math.Floor(float64(x))) }
func ceil(x int) int   { return int(math.Ceil(float64(x))) }

type SortBy [][]int

func (a SortBy) Len() int           { return len(a) }
func (a SortBy) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
func (a SortBy) Less(i, j int) bool { return a[i][0] < a[j][0] }

type PriorityQueue []int

func (h PriorityQueue) Len() int            { return len(h) }
func (h PriorityQueue) Less(i, j int) bool  { return h[i] < h[j] }
func (h PriorityQueue) Swap(i, j int)       { h[i], h[j] = h[j], h[i] }
func (h *PriorityQueue) Push(x interface{}) { *h = append(*h, x.(int)) }
func (h *PriorityQueue) Pop() interface{} {
	old := *h
	n := len(old)
	x := old[n-1]
	*h = old[0 : n-1]
	return x
}


Measured memory_bytes: 640
#include<stdio.h>
#include<stdlib.h>
#include<stdbool.h>
#include<limits.h>
#include<float.h>

int main(){
	int n, p, max = 0, sum = 0;
	scanf("%d\n", &n);
	for(int i=0; i<n; i++){
		scanf("%d\n", &p);
		sum += p;
		if(p > max) max = p;
	}
	sum -= max / 2;
	printf("%d\n", sum);
	return 0;
}

Measured memory_bytes: 128
n = int(input())
a_list = list(map(int, input().split()))
ans_len = 10**6+10
is_ans = [0]*(ans_len)

for a in a_list:
    is_ans[a] += 1
    if is_ans[a] == 1:
        b = 2*a
        while b < ans_len:
            is_ans[b] += 2
            b += a

ans = 0
for a in a_list:
    # print(a, is_ans[a])
    ans += (is_ans[a] == 1)
print(ans)


Measured memory_bytes: 32220
#include <bits/stdc++.h>
#define range(i, l, r) for(int (i) = (l); (i) < (r); (i)++)
#define reversed_range(i, l, r) for (int (i) = (r) - 1; (i) >= l; (i)--)
using namespace std;
template <typename T>
using vec = vector<T>;
using lint = long long;
using ulint = unsigned long long;
using pint = pair<int, int>;
using plint = pair<lint, lint>;

template <typename S, typename T>
ostream& operator <<(ostream& os, pair<S, T> p) {
    os << "(";
    os << p.first << ", " << p.second;
    return os << ")";
}

template <typename T>
ostream& operator <<(ostream& os, vec<T> v) {
    os << "[";
    for (int i = 0; i < v.size() - 1; i++) {
        os << v.at(i) << ", ";
    }
    return os << v.at(v.size() - 1) << "]";
}

template <typename T>
ostream& operator <<(ostream& os, set<T>& s) {
    os << "{";
    auto it_first_item = s.begin();
    cout << *it_first_item;
    for (auto it = ++it_first_item; it != s.end(); it++) {
        cout << ", " << *it;
    }
    return cout << "}";
}

template <typename T>
ostream& operator <<(ostream& os, unordered_set<T>& s) {
    os << "{";
    auto it_first_item = s.begin();
    cout << *it_first_item;
    for (auto it = ++it_first_item; it != s.end(); it++) {
        cout << ", " << *it;
    }
    return cout << "}";
}

template <typename K, typename V>
ostream& operator <<(ostream& os, map<K, V> m) {
    os << "{";
    auto it_first_item = m.begin();
    cout << it_first_item->first << ": " << it_first_item->second;
    for (auto it = ++it_first_item; it != m.end(); it++) {
        cout << ", " << it->first << ": " << it->second;
    }
    return os << "}";
}

template <typename K, typename V>
ostream& operator <<(ostream& os, unordered_map<K, V> m) {
    os << "{";
    auto it_first_item = m.begin();
    cout << it_first_item->first << ": " << it_first_item->second;
    for (auto it = ++it_first_item; it != m.end(); it++) {
        cout << ", " << it->first << ": " << it->second;
    }
    return os << "}";
}

int main() {
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);
    lint x, a, b;
    cin >> x >> a >> b;
    cout << (abs(x - a) < abs(x - b) ? "A" : "B") << "\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;


typedef tree<int, null_type, less<int>, rb_tree_tag,
        tree_order_statistics_node_update>
        new_data_set;


#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define PSET(x,y) fixed<<setprecision(y)<<x
#define pb push_back
#define pii pair<int,int>
#define pf push_front
#define mp make_pair
#define vi vector<int>
#define vip vector<pair<int,int> >
#define ff first
#define ss second
#define int long long
#define mod 1000000007
#define BIG 998244353
#define s(t) scanf("%lld",&t)
#define p(t) printf("%lld\n",t)
#define mii map<int,int>
#define MSET(table,i) memset(table, i, sizeof(table))
#define endl '\n'
#define tc int t;cin>>t;while(t--)
#define pi  3.1415926358
#define bits(x) __builtin_popcount(x)
#define minimum(a,n) min_element(a,a+n)-a
#define maximum(a,n) max_element(a,a+n)-a
#define pqbig priority_queue<int>
#define pqsmall priority_queue<pair<int,pii>,vector<pair<int,pii> >,greater<pair<int,pii> > >
#define all(v) v.begin(),v.end()
#define sitr set<int>:: iterator
#define spitr set<pii>:: iterator
#define mitr map<string,int>:: iterator

int toint(const string &s) {stringstream ss; ss << s; int x; ss >> x; return x;}
string tostring ( int number ) {stringstream ss; ss << number; return ss.str();}

#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl


int32_t main() 
{ 
    fast;
    int n,r;cin>>n>>r;
    if(n>=10)
        cout<<r;
    else
        cout<<r+100*(10-n);
} 

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

int main(){
    int n;
    cin >> n;
    vector<int>value(n);
    vector<int>cost(n);
    for (int i = 0; i < n; i++) {
        cin >> value.at(i);
    }
    int ans = 0;
    for (int i = 0; i < n; i++) {
        cin >> cost.at(i);
        int by = value.at(i) - cost.at(i);
        if (by > 0) {
            ans += by;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 998244353;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
//x,yがax+by=gcd(a,b)の解になる
ll extgcd(ll a, ll b, ll& x, ll& y) {
	ll d = a;
	if (b != 0) {
		d = extgcd(b, a%b, y, x);
		y -= (a / b)*x;
	}
	else {
		x = 1; y = 0;
	}
	return d;
}
//aのmod mでの逆元を求める
ll mod_inverse(ll a, ll m) {
	ll x, y;
	extgcd(a, m, x, y);
	return (m + x % m) % m;
}
const int N_MAX = 1 << 18;
ll p[N_MAX];
void init() {
	p[0] = 1;
	rep1(i, N_MAX - 1) {
		p[i] = p[i - 1] * i%mod;
	}
}
//xCyを求める
ll comb(ll x, ll y, ll m) {
	if (x < y)return 0;
	ll res = p[x];
	(res *= mod_inverse(p[y], m)) %= mod;
	(res *= mod_inverse(p[x - y], m)) %= mod;
	return res;
}
ll mod_pow(ll x, int n) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * x%mod;
		x = x * x%mod; n >>= 1;
	}
	return res;
}
int n, m;
int a[300][300];
int calcrank() {
	int res = 0;
	int le = 0;
	rep(i, m) {
		bool ansed = false;
		Rep(j,le, n) {
			if (a[j][i]) {
				swap(a[j], a[le]);
				ansed = true;
				break;
			}
		}
		if (ansed) {
			Rep(j, le + 1, n) {
				if (a[j][i]) {
					rep(l, m) {
						a[j][l] ^= a[le][l];
					}
				}
			}
			res++; le++;
		}
	}
	return res;
}
ll inv2 = (1 + mod) / 2;
ll inv4 = inv2 * inv2%mod;
ll inv34 = 3 * inv4%mod;
int main() {
	init();
	cin >> n >> m;
	int num = 0;
	rep(i, n) {
		rep(j, m) {
			cin >> a[i][j];
		}
	}
	int r = calcrank();
	ll ans = 0;
	for (int j = 1; j <= r; j += 2) {
		ll csum = mod_pow(2, (n - r)+(m - r));
		csum = csum * comb(r, j, mod) %mod*mod_pow(3, r - j) % mod;
		(ans += csum) %= mod;
	}
	cout << ans << endl;
	//stop
	return 0;
}

Measured memory_bytes: 2688
#include<set>
#include<iostream>
using namespace std;
int main(){
int i=2,N,h,m;
set<pair<int, int>> t;
while(i--&&cin>>N)while(N--&&cin>>h>>m)t.insert(make_pair(h,m));
  for(auto i=t.begin();i!=t.end();)printf("%d:%02d",i->first,i->second),cout<<(++i!=t.end()?" ":"");
cout<<endl;
}

Measured memory_bytes: 1228
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=100005;
const ll INF=1LL<<60;

int main(){
    
    
    int M;cin>>M;
    vector<ll> A(M),B(M);
    ll sum=0,digit=0;
    for(int i=0;i<M;i++){
        cin>>A[i]>>B[i];
        sum+=A[i]*B[i];
        digit+=B[i];
    }
    
    cout<<(sum-1)/9+digit-1<<endl;
}



Measured memory_bytes: 3328
#include<stdio.h>
void swap(int *a,int *b,int *c){
	int temp=*a;
	*a=*b;
	*b=temp;
	(*c)++;
}

int main(){
	int i,n,j,k,count=0;
	int a[101];
	scanf("%d",&n);
	for(i=0;i<n;i++)	scanf("%d",&a[i]);
	for(i=0;i<n-1;i++)
		for(j=n-1;j>i;j--){
			if(a[j]<a[j-1])	{
				swap(&a[j],&a[j-1],&count);
			}
		}
	for(i=0;i<n-1;i++){
		printf("%d ",a[i]);
	}
	printf("%d\n",a[i]);
	printf("%d\n",count);
} 


Measured memory_bytes: 2760
#include<iostream>
#include<string>
#include<algorithm>
#include<bits/stdc++.h>
#include<vector>
 
using namespace std;
 

int main(){
	long long N,sum=1,T;
	cin >> N;
  for(int j=0; j<N; j++){
    cin >> T;
    sum = T/__gcd(T,sum)*sum;
  }cout << sum << endl;
}

Measured memory_bytes: 256
import sys
import heapq
from collections import deque
input = sys.stdin.readline

def main():        
    h,w=map(int,input().split())
    s=[input() for _ in range(h)]

    def bfs(x,y):
        dist=[[-1]*w  for _ in range(h)]
        seen=[[False]*w for _ in range(h)]
        stk=[(x,y,0)]
        while stk:
            px,py,dst=stk.pop(0)
            if seen[px][py]:
                continue
            seen[px][py]=True
            
            if s[px][py]=='#':
                dist[px][py]=0
                continue
            
            for x,y in [(-1,0),(1,0),(0,-1),(0,1)]:
                if px+x<0 or px+x>=h or py+y<0 or py+y>=w:
                    continue
                else:
                    stk.append((px+x,py+y,dst+1))
            dist[px][py]=dst
        ans=0
    
        for i in range(h):
            ans=max(max(dist[i]),ans)
        return ans
    
    ans=0
    for i in range(h):
        for j in range(w):
            if s[i][j]=='#':
                continue
            ans=max(ans,bfs(i,j))
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 43996
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
#define INF 1000000000000000000

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

    ll N;
    cin >> N;
    ll ans = 0;
    int MAX = N + 1;
    vector<ll> cnt(MAX, 1);

    for (int i = 2; i < MAX; i++) {
        for (int j = i; j < MAX; j += i) {
            cnt[j]++;
        }
    }

    for (int i = 1; i < MAX; i++) {
        ans += i * cnt[i];
    }

    cout << ans << endl;
}

Measured memory_bytes: 81308
import java.io.IOException;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.List;
import java.util.Queue;
import java.util.Scanner;

public class Main {

	static int n, m;

	public static void main(String[] args) throws IOException {

		Scanner in = new Scanner(System.in);
		List<List<Vertex>> G = new ArrayList<>();
		n = in.nextInt();
		m = in.nextInt();
		for (int i = 0; i <= n; i++) {
			List<Vertex> v = new ArrayList<>();
			G.add(v);
		}

		// グラフを構成
		for (int i = 0; i < m; i++) {
			int l = in.nextInt();
			int r = in.nextInt();
			int d = in.nextInt();
			G.get(l).add(new Vertex(r, d));
			G.get(r).add(new Vertex(l, (-1)*d));
		}

		// 各ノードから全探索(bfs)
		int[] dist = new int[n+1];
		boolean[] visited = new boolean[n+1];
		Queue<Integer> q = new ArrayDeque<>();

		for (int from = 1; from <= n; from++) {
			if (visited[from]) {
				continue;
			}
			visited[from] = true;
			dist[from] = 0;
			q.add(from);

			while (!q.isEmpty()) {
				int fromNode = q.remove();
				List<Vertex> toList = G.get(fromNode);
				for (Vertex vertex : toList) {
					int v = vertex.nodeNumber;
					int d = vertex.weight;

					if (!visited[v]) {
						visited[v] = true;
						dist[v] = dist[fromNode] + d;
						q.add(v);
					} else if (dist[v] != dist[fromNode] + d) {
						System.out.println("No");
						return;
					}
				}
			}
		}
		System.out.println("Yes");
	}

	static class Vertex {
		int nodeNumber;
		int weight;

		public Vertex(int nodeNumber, int weight) {
			this.nodeNumber = nodeNumber;
			this.weight = weight;
		}
	}

}


Measured memory_bytes: 174280
def main():
    from sys import stdin
    input = stdin.buffer.readline

    n, m = map(int, input().split())
    x, y, z = [0] * n, [0] * n, [0] * n
    for ind in range(n):
        i, j, k = map(int, input().split())
        x[ind] = i
        y[ind] = j
        z[ind] = k

    from itertools import product
    ans = 0
    for i, j, k in product([True, False], repeat=3):
        l = [0] * n
        if i:
            for ind in range(n):
                l[ind] += x[ind]
        else:
            for ind in range(n):
                l[ind] -= x[ind]
        if j:
            for ind in range(n):
                l[ind] += y[ind]
        else:
            for ind in range(n):
                l[ind] -= y[ind]
        if k:
            for ind in range(n):
                l[ind] += z[ind]
        else:
            for ind in range(n):
                l[ind] -= z[ind]

        l.sort(reverse=True)
        candidate = sum(l[:m])
        if ans < candidate:
            ans = candidate
    
    print(ans)

main()

Measured memory_bytes: 69652
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		final int mod = (int)Math.pow(10, 9) + 7;
		
		int n = scan.nextInt();
		int k = scan.nextInt();
		
		long[] gdc = new long[k+1]; //gdc[i]は最大公約数がiである数列の個数
		for(int i = k; i > 0; i--) {
			gdc[i] = pow(k/i, n, mod);
			for(int j = 2; (long)i*j < k+1 ;j++)
				gdc[i] = (gdc[i] - gdc[i*j] + mod) % mod;
		}
		
		long ans = 0;
		for(int i = 1; i < k+1; i++) {
			ans += (long)i*gdc[i];
			ans %= mod;
		}
		
		System.out.println((ans+mod)%mod);
	}
	
	static long pow(long a, long n,final int mod) {
		long ans = 1;
		while(n > 0) {
			if((n&1) == 1) ans = ans * a % mod;
			a = a*a%mod;
			n >>= 1;
		}
		return ans;
	}
}


Measured memory_bytes: 36480
def resolve():
    S = input()
    chk = set(S)
    if len(chk) != 4:
        if ("N" in chk and "S" not in chk) or ("E" in chk and "W" not in chk) or (
                "S" in chk and "N" not in chk) or ("W" in chk and "E" not in chk):
            print("No")
            return
    print("Yes")


resolve()


Measured memory_bytes: 9028
MAX = 3000
leap = (4...MAX).step(4).select{|n| n % 100 > 0 || n % 400 == 0}
while gets
  a, b = $_.split.map(&:to_i)
  break if a == 0 && b == 0
  puts if $<.lineno > 1

  ret = [*a..b] & leap
  puts (ret.empty? ? "NA" : ret)
end

Measured memory_bytes: 6244
#define _GLIBCXX_DEBUG
#include <iostream>
#include <cmath>
#include <vector>
#include <string>

typedef long long ll;

const ll INF = 1e10;
int main(int argc, char* argv[])
{
  ll N;
  std::cin >> N;

  ll ans = INF;
  for (ll a = 1; a < N; a++) {
    ll sum = 0;
    ll val_a = a;
    while (val_a > 0) {
      sum += val_a % 10;
      val_a /= 10;
    }

    ll val_b = N - a;
    while (val_b > 0) {
      sum += val_b % 10;
      val_b /= 10;
    }

    ans = std::min(ans, sum);
  }

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


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

using namespace std;

#define	numberof(a)	(sizeof(a) / sizeof(a[0]))
#define	INF		(1000000)
#define Rep(i,n) for(int i = 0; i < (n); i++ )

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define	show(x)	 copy( (x).begin(), (x).end(), ostream_iterator<int>(cout, ",") );	// container<int>を全て表示

using namespace std;

typedef long long ll;

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);


map<ll, ll> prime_factor2(ll N)
{
	map<ll, ll> ret;

	for (ll i = 2; i * i <= N; ++i ) {
		while ( N % i == 0 ) {
			ret[i]++;
			N /= i;
		}
	}

	if (N != 1) ret[N]++;
	return ret;
}

int main()
{
	ll K, S;
	ll ans;

	cin >> K >> S;

	// X + Y + Z = S
	// (0 <= X,Y,Z <= K)
	for (ll X = 0; X <= K; ++X) {
		for	(ll Y = 0; Y <= K; ++Y) {
			ll Z = S - X - Y;
			if ( 0 <= Z && Z <= K) {
				ans++;
			}
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

type SortBy [][2]int

func (a SortBy) Len() int           { return len(a) }
func (a SortBy) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
func (a SortBy) Less(i, j int) bool { return a[i][0] < a[j][0] }

func main() {
	r := bufio.NewReader(os.Stdin)
	w := bufio.NewWriter(os.Stdout)
	defer w.Flush()

	var n int
	fmt.Fscan(r, &n)
	a := make(SortBy, n)
	for i := 0; i < n; i++ {
		var x int
		fmt.Fscan(r, &x)
		a[i] = [2]int{x, i + 1}
	}

	sort.Sort(a)
	for i := 0; i < n; i++ {
		fmt.Print(a[i][1])
		if i == n-1 {
			fmt.Print("\n")
		} else {
			fmt.Print(" ")
		}
	}
}


Measured memory_bytes: 5632
#include<bits/stdc++.h>
#define Rint register int
using namespace std;
const int N = 503;
int n, k, a[N][N];
inline void AMOD(int &x){++ x; if(x == n) x = 0;}
int main(){
	scanf("%d", &k);
	n = min(k, 500);
	for(Rint i = 0;i < n;i ++){
		int x = 0, y = i;
		for(Rint j = 0;j < n;j ++){
			a[x][y] = i;
			AMOD(x); AMOD(y);
		}
	}
	for(Rint i = n;i < k;i ++){
		int x = 0, y = i - n;
		for(Rint j = 0;j < n;j ++){
			if(y & 1) a[x][y] = i;
			AMOD(x); AMOD(y);
		}
	}
	printf("%d\n", n);
	for(Rint i = 0;i < n;i ++){
		for(Rint j = 0;j < n;j ++)
			printf("%d ", a[i][j] + 1);
		putchar('\n');
	}
}

Measured memory_bytes: 2176
#if __has_include("../library/Basic/Debug.hpp")

#include "../library/Basic/Debug.hpp"

#else

/* ----- Header Files ----- */
// IO
#include <cstdio>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm
#include <algorithm>
#include <cmath>
#include <numeric>

// container
#include <vector>
#include <string>
#include <tuple>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>

// others
#include <random>
#include <limits>
#include <functional>
#include <ctime>
#include <cassert>
#include <cstdint>


/* ----- Type Alias ----- */
using Bool = bool;
using Int = long long int;
using Real = long double;
using Char = char;
using String = std::string;
template <class... Ts>
using Tuple = std::tuple<Ts...>;

template <class T>
using Vector = std::vector<T>;
template <class T>
using Matrix = Vector<Vector<T>>;
template <class T>
using Queue = std::queue<T>;
template <class T>
using Stack = std::stack<T>;
template <class T>
using Deque = std::deque<T>;

template <class T>
using MaxHeap = std::priority_queue<T>;
template <class T>
using MinHeap = std::priority_queue<T, std::vector<T>, std::greater<T>>;
template <class T>
using Set = std::set<T>;
template <class T, class U>
using Map = std::map<T, U>;

template <class T, class... Us>
using Func = std::function<T(Us...)>;

template <class T>
T genv(T v) { return v; }

template <class T, class... Ts>
auto genv(size_t l, Ts... ts) {
    return Vector<decltype(genv<T>(ts...))>(l, genv<T>(ts...));
}

template <class Cost = Int>
struct Edge {
    Int src, dst;
    Cost cost;
    Edge(Int src = -1, Int dst = -1, Cost cost = 1)
        : src(src), dst(dst), cost(cost){};

    bool operator<(const Edge<Cost>& e) const { return this->cost < e.cost; }
    bool operator>(const Edge<Cost>& e) const { return this->cost > e.cost; }
};

template <class Cost = Int>
using Edges = Vector<Edge<Cost>>;
template <class Cost = Int>
using Graph = Vector<Vector<Edge<Cost>>>;

#endif

/* ----- Misc ----- */
void fastio() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
}

struct Fout {
    Int precision;
    Fout(Int precision) : precision(precision) {}
};
std::ostream& operator<<(std::ostream& os, const Fout& fio) {
    os << std::fixed << std::setprecision(fio.precision);
    return os;
}


/* ----- Constants ----- */
// constexpr Int INF = std::numeric_limits<Int>::max() / 3;
// constexpr Int MOD = 1000000007;
// constexpr Real PI = acos(-1);
// constexpr Real EPS = 1e-10;
// std::mt19937 mt(int(std::time(nullptr)));

Bool solve() {
    Int p, q, a, n;
    std::cin >> p >> q >> a >> n;
    if (p == 0) return false;

    Func<Int, Int, Int, Int, Int> dfs = [&](Int r, Int s, Int max, Int num) {
        Int ret = 0;
        if (p * s == q * r) ++ret;

        if (num == n) return ret;

        for (Int i = max; s * i <= a; ++i) {
            Int rs = r * i + s, ss = s * i;
            ret += dfs(rs, ss, i, num + 1);
        }
        return ret;
    };

    Vector<Int> v;
    std::cout << dfs(0, 1, 1, 0) << std::endl;
    return true;
}

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



Measured memory_bytes: 2996
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            new Program().Solve(new MyInputStream(Console.In, ' '));
            Console.Out.Flush();
        }

        public void Solve(MyInputStream cin)
        {
            var H = cin.ReadInt();
            var W = cin.ReadInt();
            var S = cin.ReadStrArray(H);
            var dx = new [] { 0, 1, 1, 1, 0,-1,-1,-1 };
            var dy = new [] {-1,-1, 0, 1, 1, 1, 0,-1 };

            for (int y = 0; y < H; ++y)
            {
                for (int x = 0; x < W; ++x)
                {
                    if (S[y][x] == '#') { Write("#"); continue; }
                    var sum = 0;
                    for (int i = 0; i < 8; ++i)
                    {
                        var nx = x + dx[i];
                        var ny = y + dy[i];
                        if (nx < 0 || nx >= W) continue;
                        if (ny < 0 || ny >= H) continue;
                        if (S[ny][nx] == '#') sum++;
                    }
                    Write(sum);
                }
                WriteLine();
            }
        }
    }

    public class MyInputStream
    {
        private readonly System.IO.TextReader _stream;
        private char separator = ' ';
        private Queue<string> inputStream;
        public MyInputStream(System.IO.TextReader s, char separator = ' ')
        {
            this.separator = separator;
            this._stream = s;
            inputStream = new Queue<string>();
        }
        public string Read()
        {
            if (inputStream.Count != 0) return inputStream.Dequeue();
            string[] tmp = _stream.ReadLine().Split(separator);
            for (int i = 0; i < tmp.Length; ++i)
                inputStream.Enqueue(tmp[i]);
            return inputStream.Dequeue();
        }
        public string ReadLine() { return _stream.ReadLine(); }
        public int ReadInt() { return int.Parse(Read()); }
        public long ReadLong() { return long.Parse(Read()); }
        public double ReadDouble() { return double.Parse(Read()); }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read(); return ret;}
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt(); return ret;}
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong(); return ret;}
    }
}

Measured memory_bytes: 11220
#include<iostream>
using namespace std;
#include<cmath>
#include<map>
#include<set>
#define int long long int
#define mod 1000000007
int function(int arr[],int initial,int final)
{
	if(initial>final)
	    return 0;
	else
	{
		if(arr[initial]==0)
		{
			return function(arr,initial+1,final);
		}
		else
		{
			int x=arr[initial]-1+9*(final-initial);
			int y=arr[initial]+function(arr,initial+1,final);
			return max(x,y);
		}
	}
}
int32_t main()
{ 
     int n;
     cin>>n;
     cout<<(n-1)/2<<endl;
}


Measured memory_bytes: 256
//Subhash Suman
//Description : Matrix Exponentiation
//problem link : https://cses.fi/problemset/result/242211/

#include <bits/stdc++.h>
#define ll long long int
#define pll pair<ll, ll>
#define pii pair<int, int>

using namespace std;
const int N = 100;
const ll mod = 1e9 + 7;
ll Temp[N][N], R[N][N], A[N][N], V[N]; //temporary helper matrix,(initially identity)resultant matrix,initial matrix,initial vector;

ll sum(ll a, ll b)
{
    ll x = a + b;
    if (x >= mod)
    {
        x -= mod;
    }
    return x;
}

int dim; //square matrix dimension
void multiplyAR()
{
    for (int i = 0; i < dim; i++)
    {
        for (int j = 0; j < dim; j++)
        {
            Temp[i][j] = 0;
        }
    }
    for (int i = 0; i < dim; i++)
    {
        for (int j = 0; j < dim; j++)
        {
            for (int k = 0; k < dim; k++)
            {
                ll x = (A[i][k] * R[k][j]) % mod;
                Temp[i][j] = sum(x, Temp[i][j]);
            }
        }
    }
    for (int i = 0; i < dim; i++)
    {
        for (int j = 0; j < dim; j++)
        {
            R[i][j] = Temp[i][j];
        }
    }
}

void multiplyRR()
{
    for (int i = 0; i < dim; i++)
    {
        for (int j = 0; j < dim; j++)
        {
            Temp[i][j] = 0;
        }
    }
    for (int i = 0; i < dim; i++)
    {
        for (int j = 0; j < dim; j++)
        {
            for (int k = 0; k < dim; k++)
            {
                ll x = (R[i][k] * R[k][j]) % mod;
                Temp[i][j] = sum(x, Temp[i][j]);
            }
        }
    }
    for (int i = 0; i < dim; i++)
    {
        for (int j = 0; j < dim; j++)
        {
            R[i][j] = Temp[i][j];
        }
    }
}

void multiplyVR()
{
    for (int i = 0; i < dim; i++)
    {
        Temp[i][0] = 0;
    }
    for (int i = 0; i < dim; i++)
    {
        for (int k = 0; k < dim; k++)
        {
            ll x = (R[i][k] * V[k]) % mod;
            Temp[i][0] = sum(x, Temp[i][0]);
        }
    }
    for (int i = 0; i < dim; i++)
    {
        V[i] = Temp[i][0];
    }
}

void matrix_exponentiation(ll e)
{
    if (e == 0)
    {
        return;
    }
    if (e & 1)
    {
        matrix_exponentiation(e - 1);
        multiplyAR();
    }
    else
    {
        matrix_exponentiation(e / 2);
        multiplyRR();
    }
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n;
    ll k;
    cin >> n >> k;
    dim = n;
    //creating Identity Matrix
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < n; j++)
        {
            R[i][j] = 0;
            if (i == j)
            {
                R[i][j] = 1;
            }
        }
    }

    //Initialising A
    for (int i = 0; i < dim; i++)
    {
        for (int j = 0; j < dim; j++)
        {
            bool bo;
            cin >> bo;
            if (bo)
            {
                A[j][i] = 1;
            }
        }
    }

    // creating Initial Vector
    fill(V, V + n, 1);

    matrix_exponentiation(k);
    multiplyVR();
    ll ans = 0;
    for (int i = 0; i < n; i++)
    {
        ans = sum(ans, V[i]);
    }
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 512
#include<iostream>
using namespace std;
int main(){
	int w,h,x,y,r;
	cin>>w>>h>>x>>y>>r;
	if(x+r<=w && x-r>=0){
		if(y+r<=h && y-r>=0){
			cout<<"Yes"<<endl;
		}
		else{
		cout<<"No"<<endl;
		}
	}
	else{
		cout<<"No"<<endl;
	}
}

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

#define sws ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define INFINITO 1000000000
#define ll long long
#define vi vector<int>
#define pb push_back
#define pii pair<int, int>
#define mp make_pair
#define ff first
#define ss second
#define vvi vector<vi>
#define all(x) x.begin(), x.end()
#define fo(i, n) for( int i = 0; i < n; i++ )


int main() {

    string s;
    cin >> s;

    int tam = 0;
    int maior = 0;
    for( auto l : s ) {
        if ( l == 'A' or l == 'C' or l == 'G' or l == 'T' ) {
            tam++;
            maior = max(maior, tam);
        } else tam = 0;
    }

    cout << maior << endl;

    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cmath>
#include <vector>
#include <stack>
#include <set>
#include <map>
#define sf scanf
#define pf printf
#define show(x) cout<<"x:"<<x<<endl;
using namespace std;
typedef long long ll;
const int maxn=5e5+5;
const ll infll=2000000000;

int l[maxn/2],r[maxn/2];

ll merg(int a[],int left,int right)
{
    int mid=(left+right)/2;
    int n1=mid-left,n2=right-mid;
    l[n1]=r[n2]=infll;
    for(int i=0;i<n1;i++)l[i]=a[left+i];
    for(int i=0;i<n2;i++)r[i]=a[mid+i];
    int i=0,j=0;
    ll cnt=0;
    for(int k=left;k<right;k++)
    {
        if(l[i]>r[j])
        {
            cnt+=n1-i;
            a[k]=r[j++];
        }
        else a[k]=l[i++];
    }

    return cnt;
}

ll mergesort(int a[],int left,int right)
{
    ll v=0;
    if(left+1<right)
    {
        int mid=(left+right)/2;
        v+=mergesort(a,left,mid);
        v+=mergesort(a,mid,right);
        v+=merg(a,left,right);

    }
    return v;
}

int main()
{
    int a[maxn],n;
    sf("%d",&n);
    for(int i=0;i<n;i++)
        sf("%d",&a[i]);
    ll ans=mergesort(a,0,n);
    pf("%lld\n",ans);
    return 0;
}



Measured memory_bytes: 4760
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define str to_string
#define endl "\n"
#define PI 3.141592653589
using namespace std;
using lint = long long;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

//AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC
int main(){
    int n;cin>>n;
    vector<lint> vec(n);for(int i=0;i<n;i++)cin>>vec[i];
    sort(all(vec));
    vector<lint> ruiseki(1,0);
    for(int i=0;i<n;i++)ruiseki.pb(ruiseki[i]+vec[i]);
    int ans=1;
    for(int i=n-1;i>=0;i--){
        if(ruiseki[i]*2>=vec[i])ans++;
        else break;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 5052