akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<char> vc;
typedef queue<ll> ql;
typedef deque<ll> dql;
typedef priority_queue<ll/*, vl, greater<ll>*/> pql; //降順(/*昇順*/)
typedef set<ll> sl;
typedef pair<ll, ll> pl;
typedef pair<pl, ll> ppl;
typedef vector<vl> vvl;
typedef vector<pl> vpl;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
#define rep2(i, k, n) for(ll i = ll(k); i <= ll(n); i++)
#define rep3(i, n, k) for(ll i = ll(n); i >= ll(k); i--)
#define all(v) (v).begin(), (v).end()
ll mod(ll a, ll b) {if(b == 0) return 0; return (a % b + b) % b;}
bool chmin(ll &a, ll b) {if(b < a) {a = b; return 1;} return 0;}
bool chmax(ll &a, ll b) {if(b > a) {a = b; return 1;} return 0;}
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;
const ll MAX = 1e9;
const char newl = '\n';

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

  ll k;
  cin >> k;
  rep(_, k) cout << "ACL";
  cout << newl;
  return 0;
}

Measured memory_bytes: 3528
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#define ll long long
#define rep(i, n) for (int i=0; i < (n); i++)
using namespace std;

int main() {
  string s, t;
  cin >> s >> t;
  int ans = 0;
  rep(i, s.size()) {
    if (s[i] != t[i]) ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3844
n,m = map(int, input().split())
s = []
for i in range(m):
    s.append(list(map(int,input().split())))
p = list(map(int,input().split()))

ans = 0
for i in range(1 << n):
    sw = set()
    count = 0
    for j in range(n):
        if ((i >> j) & 1):
            sw.add(j+1)
    for k,si in enumerate(s):
        num_on = len(sw & set(si[1:]))
        if num_on % 2 ==  p[k]:
            count += 1
    if count == m :
        ans += 1

print(ans)

Measured memory_bytes: 3064
#include <stdio.h>
#define MAX 2000


int solve(int i, int m, int n, int A[])
{
	int res;
	if(m==0){
		return 1;
	}
	if(i>=n){
		return 0;
	}
	res = solve(i+1, m, n, A) || solve(i+1, m- A[i],n,A);
	return res;
}

int main(void)
{
	int a, i, n, q;
	int A[MAX];
	
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d", &A[i]);
	}
	scanf("%d",&q);
	for(i=0; i<q; i++){
		scanf("%d", &a);
		if(solve(0,a,n,A)){printf("yes\n");}
		else{printf("no\n");}
	}
	
	return 0;
}



Measured memory_bytes: 2084
package main

import (
	"fmt"
	"strings"
)

type Line struct {
	letters [26]int
}

func (l *Line) analyze(s string) {
	info := strings.Split(s, "")
	for _, tmpS := range info {
		l.letters[letterToNUM(tmpS)] += 1
	}
}
func NumToLetter(i int) string {
	switch {
	case i == 0:
		return "a"
	case i == 1:
		return "b"
	case i == 2:
		return "c"
	case i == 3:
		return "d"
	case i == 4:
		return "e"
	case i == 5:
		return "f"
	case i == 6:
		return "g"
	case i == 7:
		return "h"
	case i == 8:
		return "i"
	case i == 9:
		return "j"
	case i == 10:
		return "k"
	case i == 11:
		return "l"
	case i == 12:
		return "m"
	case i == 13:
		return "n"
	case i == 14:
		return "o"
	case i == 15:
		return "p"
	case i == 16:
		return "q"
	case i == 17:
		return "r"
	case i == 18:
		return "s"
	case i == 19:
		return "t"
	case i == 20:
		return "u"
	case i == 21:
		return "v"
	case i == 22:
		return "w"
	case i == 23:
		return "x"
	case i == 24:
		return "y"
	case i == 25:
		return "z"
	}
	return ""
}

func letterToNUM(s string) int {
	switch {
	case s == "a":
		return 0
	case s == "b":
		return 1
	case s == "c":
		return 2
	case s == "d":
		return 3
	case s == "e":
		return 4
	case s == "f":
		return 5
	case s == "g":
		return 6
	case s == "h":
		return 7
	case s == "i":
		return 8
	case s == "j":
		return 9
	case s == "k":
		return 10
	case s == "l":
		return 11
	case s == "m":
		return 12
	case s == "n":
		return 13
	case s == "o":
		return 14
	case s == "p":
		return 15
	case s == "q":
		return 16
	case s == "r":
		return 17
	case s == "s":
		return 18
	case s == "t":
		return 19
	case s == "u":
		return 20
	case s == "v":
		return 21
	case s == "w":
		return 22
	case s == "x":
		return 23
	case s == "y":
		return 24
	case s == "z":
		return 25
	}
	return 0
}

func main() {
	var n int
	var s string
	fmt.Scan(&n)
	lines := make([]Line, 0, 0)
	for i := 0; i < n; i++ {
		line := Line{}
		fmt.Scan(&s)
		line.analyze(s)
		lines = append(lines, line)
	}
	var ansNums [26]int
	for i := 0; i < 26; i++ {
		ansNums[i] = lines[0].letters[i]
	}

	for j := 0; j < 26; j++ {
		for i := 1; i < len(lines); i++ {
			if ansNums[j] > lines[i].letters[j] {
				ansNums[j] = lines[i].letters[j]
			}
		}
	}

	s = ""
	for i := 0; i < 26; i++ {
		for j := 0; j < ansNums[i]; j++ {
			s += NumToLetter(i)
		}
	}
	fmt.Println(s)
}

Measured memory_bytes: 768
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
    
        var sc = new Scanner(System.in);
    
        int D = Integer.parseInt(sc.next());
        var c = new int[27];
        for(int i = 1; i <= 26; i++){
            c[i] = Integer.parseInt(sc.next());
        }
        var s = new int[D+1][27];
        for(int d = 1; d <= D; d++){
            for(int i = 1; i <= 26; i++){
                s[d][i] = Integer.parseInt(sc.next());
            }
        }
    
        var last = new int[27];
        var sb = new StringBuilder();
        for(int d = 1; d <= D; d++){
            int max = Integer.MIN_VALUE;
            int contest = 1;
            for(int i = 1; i <= 26; i++){
                int score = s[d][i];
                for(int j = 1; j <= 26; j++){
                    if(i == j) continue;
                    score -= c[i] * (d - last[i]);
                }
                if(score > max){
                    max = score;
                    contest = i;
                }
            }
            last[contest] = d;
            sb.append(contest).append(System.lineSeparator());
        }
        System.out.print(sb);
    }
}

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

public class Main {
	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		char s1[] = sc.nextLine().toCharArray();
		char s2[] = sc.nextLine().toCharArray();
		char s3[] = sc.nextLine().toCharArray();
		System.out.println("" + s1[0] + s2[1] + s3[2]);
	}
}

Measured memory_bytes: 22096
#include <iostream>
#include <iomanip>
#include<math.h>
#include<list>
#include <algorithm>
#include<set>
#include<vector>
#include<math.h>
#include<map>
#include<string>
#include <numeric>
#include <queue>
#include <sstream>
#include <bitset>

using namespace std;
using ll = long long;
using vll = vector<long long>;
using sll = set<long long>;

template<typename T>
T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<typename T>
T lcm(T a, T b) { return a / gcd(a, b) * b; }

template<typename T>
map<T, T> primeFactor(T n) {
	map<T, T> res;
	for (T i = 2; i * i <= n; ++i) {
		while (n % i == 0) {
			res[i] ++;
			n /= i;
		}
	}
	if (n != 1) res[n] = 1;
	return res;
}

template<typename T>
bool IsPrimeNumber(T num)
{
	if (num <= 2) return true;
	else if (num % 2 == 0) return false;

	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2)
	{
		if (num % i == 0)
		{
			return false;
		}
	}

	return true;
}

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


#define in(x) cin >> x
#define out(x) cout << x
#define outn(x) cout << x << '\n'
#define outs(x) cout << x << ' '
#define rep(i,s,e) for(ll i=s;i<e;i++)
#define repeq(i,s,e) for(ll i=s;i<=e;i++)


int main() {
	string x;
	ll cnt = 0, ans;
	std::cin >> x;
	ans = x.size();
	rep(i, 0, x.size()) {
		if (x[i] == 'S') {
			cnt++;
		}
		else if(cnt>0) {
			cnt--;
			ans -= 2;
		}
	}

	outn(ans);
	return 0;
}


Measured memory_bytes: 640
str = [input() for i in range(2)]
num = 0
if (str[0][0] == str[1][0]):
    num = num +1
if (str[0][1] == str[1][1]):
    num = num +1
if (str[0][2] == str[1][2]):
    num = num +1
print(num)

Measured memory_bytes: 3060
#include <iostream>
#include <string.h>
#include <stack>
#include <queue>
#include <math.h>
#include <algorithm>
#include <stdio.h>
using namespace std;
template<typename _TP> inline void read(_TP &x){
	x = 0;bool f = true;char c = getchar();
	for(;c < '0' || c > '9'; c = getchar()) if(c == '-') f = false;
	for(;'0' <= c && c <= '9'; c = getchar()) x = (x << 1) + (x << 3) + (c ^ 48);
	x *= f ? 1 : -1;return;
}
template<typename _TP> inline void print(_TP x){
	if(x < 0) putchar('-'),x = -x;
	if(x > 9) print(x / 10);
	putchar(x % 10 + 48);
	return;
}
#define rg register
#define ll long long
#define r_2(a,b) read(a),read(b)
#define print_n(a) print(a),puts("")
#define print_(a) print(a),putchar(' ')
int a,b;
int main()
{
	r_2(a,b);
	a -= b << 1;
	print(a >= 0 ? a : 0);
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
using namespace std;
int kcal(int p,int q,int r){
    return (p+r)*4+q*9;
    }
int tyosa(int i,int p,int q,int r,int cal,int P,int Q,int R,int C){
        if(P>=p&&Q>=q&&R>=r&&C>=cal) return i;
        else return 0;
        }
int main(){
    int n,i[1000],p[1000],q[1000],r[1000],P,Q,R,C,cal[1000],flag;
    while(cin>>n){
    if(n==0) break;
    flag=0;
    for(int j=0;j<n;j++){
        cin>>i[j]>>p[j]>>q[j]>>r[j];
        cal[j]=kcal(p[j],q[j],r[j]);
        }
    cin>>P>>Q>>R>>C;
    for(int j=0;j<n;j++){
            if(tyosa(i[j],p[j],q[j],r[j],cal[j],P,Q,R,C)!=0){
            cout<<tyosa(i[j],p[j],q[j],r[j],cal[j],P,Q,R,C)<<endl;
            flag++;
            }
        }
        if(flag==0){
            cout<<"NA"<<endl;
        }
    }
    return 0;
}

Measured memory_bytes: 1176
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int findloc(char c)
{
	if(c=='R')return 0;
	else if(c=='G')return 1;
	else return 2;
}
string s;
int n,cnt[3];
int main()
{
	long long sum=0;
	cin>>n>>s;
	for(int i=0;i<n;i++)
	{
		cnt[findloc(s[i])]++;
	}
	sum=1ll*cnt[0]*cnt[1]*cnt[2];
	for(int i=0;i<n;i++)
		for(int j=1;j<n;j++)
			if(i+2*j<n)
			{
				if(s[i]!=s[i+j]&&s[i]!=s[i+2*j]&&s[i+j]!=s[i+2*j])
					sum--;
			}
	cout<<sum;
	return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
#define rep(i,n) for (int i = 0; i < (n); ++i)
using ll = long long;
using P = pair<int,int>;

int main() {
  int N, M;
  cin >> N >> M;
  dsu d(N);
  rep(i, M){
    int a, b;
    cin >> a >> b;
    --a;
    --b;
    d.merge(a, b);
  }

  cout << d.groups().size() - 1 << endl;
  return 0;
}


Measured memory_bytes: 8932
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define rep2(i, s, n) for (int i = s; i < (int)n; i++)
#define all(obj) obj.begin(), obj.end()
#define debug(x) cerr << #x << ":" << x << "\n"
#define vdebug(vec) cerr << #vec << ":"; for (auto e : vec) cerr << e << " "; cout << "\n"
#define YN(f) cout << (f ? "YES" : "NO") << endl
#define Yn(f) cout << (f ? "Yes" : "No") << endl
#define yn(f) cout << (f ? "yes" : "no") << endl
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;

static int MOD;

// factorial(mod) n!
ll fact(ll n) {
	ll res = 1;
	while (n > 1) {
		res = res * n % MOD;
		n--;
	}
	return res;
}

// power(mod) x^n
ll modpow(ll x, ll n) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % MOD;
		x = x * x % MOD;
		n >>= 1;
	}
	return res;
}

// inverse(mod) x^(-1)
ll inv(ll x) {
	return modpow(x, MOD - 2);
}

// permutation(mod) nPr
ll permu(ll n, ll r) {
	if (r < 0 || n < r) return 0;
	else {
		ll res = fact(n);
		res = res * inv(fact(n - r)) % MOD;
		return res;
	}
}

// combination(mod) nCr
ll combi(ll n, ll r) {
	ll res = permu(n, r);
	res = res * inv(fact(r)) % MOD;
	return res;	
}

int main () {
	MOD = 1000000007;
	int N, M, K; cin >> N >> M >> K;
	ll x = (N - 1);
	x = x * N % MOD;
	x = x * (N + 1) % MOD;
	x = x * inv(6) % MOD;
	x = x * M % MOD;
	x = x * M % MOD;
	ll y = (M - 1);
	y = y * M % MOD;
	y = y * (M + 1) % MOD;
	y = y * inv(6) % MOD;
	y = y * N % MOD;
	y = y * N % MOD;
	ll z = combi(M * N - 2, K - 2);
	ll ans = (x + y) * z % MOD;
	// debug(x); debug(y); debug(z);
	cout << ans << endl;
}

Measured memory_bytes: 256
// Author: HarshKumar

#include <bits/stdc++.h>
using namespace std;
#define ll int64_t
const ll N = 1e6 + 6, M = 1e9 + 7;
int main()
{
    ios::sync_with_stdio(false), cin.tie(nullptr);
    ll n, k;
    cin >> n >> k;
    vector<ll> a(n);
    for (ll &e : a)
        cin >> e;
    int l = 1, h = M;
    while (l < h)
    {
        int m = l + (h - l) / 2, s = 0;
        for (ll e : a)
            s += (e - 1) / m;
        if (s <= k)
            h = m;
        else
            l = m + 1;
    }
    cout << l;
}

Measured memory_bytes: 4756
#include<stdio.h>
#include<string.h>
int main(void) {
	char s[4];
	char week[7][4] = { "SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT" };
	int i;

	scanf("%s", s);
	for (i = 0; i < 7; i++) {
		if (!strcmp(s, week[i])) printf("%d\n", 7 - i);
	}
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
int main(){
  int N,K,i;char c;scanf("%d %d\n",&N,&K);
  vector<int> v;v.emplace_back(0);
  bool p = 1;
  for(i=0;i<N;i++){
    scanf("%c",&c);
    if((c == '1') == p) v.back()++;
    else{
      v.emplace_back(1);
      p ^= 1;
    }
  }
  if(v.size() <= K*2+1){
    printf("%d\n",N);return 0;
  }
  int now = accumulate(v.begin(),v.begin()+K*2+1,0),ans = now;
  if(v.size()%2 == 0) v.emplace_back(0);
  for(i=K*2+1;i<v.size()-1;i+=2){
    now -= v[i-K*2-1]+v[i-K*2];
    now += v[i]+v[i+1];
    ans = max(ans,now);
  }
  printf("%d\n",ans);
}

Measured memory_bytes: 3928
//Nihal Mittal - nihal_47
//Strike First , Strike Hard , No Mercy !!

/**⠀⠀⠀⠀⠀⠀⣀⣤⣤⣄⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⣠⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⣀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⣰⣿⣿⣿⣿⠿⠿⣿⣿⣿⣿⣿⣿⣿⣧⢀⠀⠀⠀⠀
⠀⠀⠀⣿⣿⣿⠋⠀⠀⠀⠀⠀⠙⠀⠙⣿⣿⣿⣷⢳⢀⠀⠀⠀
⠀⠀⣠⣿⣿⣿⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⣿⢀
⠀⠀⣸⣿⣿⣿⠸⠀⠀⠀⠒⠒⠒⠐⠀⠀⢿⣿⣿⣿⣿⣿⠀⠀
⠀⣴⣿⣿⣿⡿⠀⠒⣋⣙⡒⢰⠀⠤⣖⠒⢾⣿⣿⣿⣿⣧⠀⠀
⢺⣿⣿⣿⣿⢀⠀⠀⠉⠉⠉⠸⠀⡇⠉⠉⠀⢿⣿⣿⣿⣄⠀⠀
⠀⠙⣿⣿⣧⢻⠀⠀⠀⠀⠀⠠⠀⠰⠀⠀⠀⣸⠸⣿⣿⠿⠰⠀
⠀⠀⠀⠹⣿⣿⣿⣷⠀⡠⠙⣲⣔⣅⢡⣰⣷⣿⣿⣿⣧⠀⠀⠀
⠀⠀⠀⣼⣿⣿⣿⣿⠀⡿⠭⠭⠭⠭⢿⠀⣿⢻⣿⣿⠃⠀⠀⠀
⠀⠀⠀⠙⠛⣿⢻⠹⣿⠐⠙⠛⠟⠉⢀⣴⡟⢿⣿⡏⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⡟⠀⠀⠻⣦⣤⣶⠾⠋⠀⠀⠁⡦⢄⢀⠀⠀⠀
⠀⠀⠀⠀⡠⠁⡇⠑⢄⠀⠀⠀⠀⠀⠀⠔⠀⠀⠁⠀⠀⠀⠉⠁
⠀⠔⠊⠁⠀⠀⣇⠀⠀⠀⠑⡤⠤⢎⠁⠀⠀⡘⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⢢⠠⠀⡠⢆⠀⠀⡠⠙⢄⠀⡸⠀
**/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define ld long double
#define mk make_pair
#define pb push_back
#define in insert
#define se second
#define fi first
#define mod 1000000007
#define watch(x) cout << (#x) << " is " << (x) << "\n"
#define all(v) (v).begin(),(v).end()
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(0);
#define pii pair<ll,ll>
#define vi(x) vector<x>
#define maxn 100005
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
using namespace std;
using namespace __gnu_pbds;

signed main()
{
    fast;
  
    ld r;
    cin>>r;
    ld pi = 2*3.141592653589793238463;
    ld ans = pi * r;
    cout<<fixed<<setprecision(2)<<ans;
}

Measured memory_bytes: 3804
#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <algorithm>
#include <set>
#include <unordered_map>
#include <queue>
#include <iomanip>
#include <map>

#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define ll long long
#define P pair<int, int>

using namespace std;
int mod = 1000000007;

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;
}

ll mod_inverse(ll a, ll m) {
  ll x, y;
  extgcd(a, m, x, y);
  return (m + x%m)%m;
}

int n;
int main() {
  cin >> n;
  vector<int> a(n+1);
  bool used[n+1];
  int lastpos;

  rep(i, n+1) {
    used[i] = false;
  }

  int dup;
  rep(i, n+1) {
    cin >> a.at(i);
    if (used[a.at(i)]) {
      lastpos = i;
      dup = a.at(i);
    } else {
      used[a.at(i)] = true;
    }
  }

  int firstpos;
  rep(i, n+1) {
    if (a.at(i) == dup) {
      firstpos = i;
      break;
    }
  }

  int k = firstpos;
  int m = n-lastpos;
  int km = k+m;

  vector<ll> combn1(n+2);
  vector<ll> combkm(n+2);
  vector<ll> mod_inv(n+2);
  for(int i=1; i<=n+1; i++) {
    mod_inv.at(i) = mod_inverse(i, mod);
  }

  combn1.at(0) = 1;
  combkm.at(0) = 1;
  for(int i=1; i<=n+1; i++) {
    combn1.at(i) = combn1.at(i-1) * (n+2-i);
    combn1.at(i) %= mod;
    combn1.at(i) *= mod_inv.at(i);
    combn1.at(i) %= mod;
    if (i>km) {
      combkm.at(i) = 0;
    } else {
      combkm.at(i) = combkm.at(i-1) * (km+1-i);
      combkm.at(i) %= mod;
      combkm.at(i) *= mod_inv.at(i);
      combkm.at(i) %= mod;
    }
  }

  for(int i=1; i<=n+1; i++) {
    ll ans = combn1.at(i) - combkm.at(i-1) + mod;
    ans %= mod;
    cout << ans << endl;
  }
}

Measured memory_bytes: 4096
import numpy as np
H,W = map(int,input().split())
grid = []
for i in range(H):
    mojiretsu = input()
    moji = []
    for k in range(len(mojiretsu)):
        moji.append(mojiretsu[k])
    grid.append(moji)
grid = np.array(grid)
flug1 = True
flug2 = True
flug3 = False
flug4 = False
while flug1:
    for i in range(grid.shape[0]):
        if np.all(grid[i,:] == "."):
            grid = np.delete(grid, i, 0)
            flug3 = False
            break
        else:
            flug3 = True
    if flug3 == True:
        flug1 = False
while flug2:
    for j in range(grid.shape[1]):
        if np.all(grid[:,j] == "."):
            grid = np.delete(grid, j, 1)
            flug4 = False
            break
        else:
            flug4 = True
    if flug4 == True:
        flug2 = False
for height in range(grid.shape[0]):
    print("".join(list(grid[height,:]))) 

Measured memory_bytes: 27292
#!/usr/bin/env ruby
# require 'pry'

h,w = gets.split(' ').map(&:to_i)
ary = []
h.times do
  ary << gets.chomp
end
new_ary = []
h.times do
  new_ary << [0]*w
end
num = 0
ary.map.with_index do |rec,ary_i|
  w.times do |ary_w_i|
    if rec[ary_w_i] == '#'
      new_ary[ary_i][ary_w_i] = '#'
      (-1).upto(1) do |new_ary_i|
        # 最初のレコードは new_ary_i = -1をやらない
        next if ary_i == 0 && new_ary_i == -1
        # 最後のレコードは new_ary_i = 1 をやらない
        next if ary_i == (h-1) && new_ary_i == 1
        (-1).upto(1) do |new_ary_w_i|
          # 最初の文字は new_ary_w_i = -1をやらない
          next if ary_w_i == 0 && new_ary_w_i == -1
          # 最後の文字は new_ary_w_i = 1をやらない
          next if ary_w_i == (w-1) && new_ary_w_i == 1
          # 爆弾だったら計算しない
          next if new_ary[ary_i+new_ary_i][ary_w_i+new_ary_w_i] == '#'
          new_ary[ary_i+new_ary_i][ary_w_i+new_ary_w_i] += 1
        end
      end
    end
  end
end
new_ary.each {|out|puts out.join}


Measured memory_bytes: 2172
import java.io.IOException;
import java.util.Scanner;

public class Main {
    private static int gcd(int a, int b){ 
        if (b==0){
            return a;
        }else{
            return gcd(b,a%b);
        }
    }
    
    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()){
            int v1 = sc.nextInt();
            int v2 = sc.nextInt();
            if (v1>=v2){
                int ans = gcd(v1,v2);
                System.out.print(ans + " ");
                System.out.println(v1/ans*v2);
            }else{
                int ans = gcd(v2,v1);
                System.out.print(ans + " ");
                System.out.println(v1/ans*v2);
            }
        }
    }
}

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

int main(){
  long long x,k,d;	cin >> x >> k >> d;
  x=abs(x);
  
  long long step=min(k,x/d);
  x=x-step*d;
  
  if(step==k){
    cout << abs(x);
    return 0;
  }
  
  long long plus=abs(x);
  long long minus=abs(x-d);
  
  k-=step;
  if(k%2==0)	cout << plus;
  else if(k%2==1)	cout << minus;
  
  
  
}


Measured memory_bytes: 3628
#include<iostream>

int n,m,k[10],s[10][10],p[10],swi[10],res;

void rec(int num,int onoff){

    bool flag=false;

    swi[num]=onoff;

    if(num==n){
        for(int i=0;i<m;i++){
            int am=0;
            for(int j=0;j<k[i];j++){
                am+=swi[s[i][j]];
            }
            if(am%2!=p[i])flag=true;
        }
        if(flag==false)res++;
    }
    else{
    rec(num+1,1);
    rec(num+1,0);
    }

}

int main(){

    std::cin>>n>>m;

    for(int i=0;i<m;i++){
        std::cin>>k[i];
        for(int j=0;j<k[i];j++){
            std::cin>>s[i][j];
        }
    }

    for(int i=0;i<m;i++)
    std::cin>>p[i];

    rec(0,0);

    std::cout<<res<<std::endl;

    return 0;
}

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

const int oo = 1000000000 + 5;
const int N = 100000 + 5;

int n, k;
int a[N];
int dp[N];

int main() { 
	scanf("%d %d", &n, &k);
	for (int i = 0; i < n; ++i) {
		scanf("%d", &a[i]);
		dp[i] = oo;
	}
	dp[0] = 0;
	for (int i = 0; i < n; ++i) {
		for (int j = i + 1; j <= i + k; ++j) {
			if (j < n) {
				dp[j] = min(dp[j], dp[i] + abs(a[i] - a[j]));
			}
		}
	}
	printf("%d\n", dp[n - 1]);
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
using namespace std;
int main(){
    int n,m;
    cin >> n >> m;
    vector<vector<int>> g(n,vector<int>(n,0));
    for(int i = 0; i < m; i++)
    {
        int a,b;
        cin >> a >> b;
        g[a-1][b-1]++;
        g[b-1][a-1]++;
    }
    int ans = 0;
    while(true){
        bool update = false;
        for(int i = 0; i < n; i++)
        {
            int d = 0;
            int x,y;
            for(int j = 0; j < n; j++)
            {
                if (g[i][j] == 1) {
                    d++;
                    x = i;
                    y = j;
                }
            }
            if (d == 1) {
                g[x][y]--;
                g[y][x]--;
                ans++;
                update = true;
            }
        }
        if (!update) {
            break;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,k,mini;
	cin>>n>>k;
	int a[n];
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	int cost[n];
	cost[0]=0;
	for(int i=1;i<n;i++){
		mini=INT_MAX;
		for(int j=max(0,i-k);j<i;j++){
			mini=min(mini,cost[j]+abs(a[j]-a[i]));
		}
		cost[i]=mini;
	}
	cout<<cost[n-1]<<endl;
}

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

int main() {
    int N;
    cin >> N;
    vector<int64_t> Lucas(87);

    Lucas.at(0) = 2, Lucas.at(1) = 1;

    for (int i = 2; i <= N; i++) {
        Lucas.at(i) = Lucas.at(i - 1) + Lucas.at(i - 2);
    }

    cout << Lucas.at(N) << endl;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long long s;
  cin >>s;
  if(s==1000000000000000000){
    cout << "0 0 0 1000000000 1000000000 0"<<endl;
  }
  else{
  long x=s/1000000000 + 1;
  long y=1000000000 - s%1000000000;
  cout << "0 0 1 1000000000 "<<x <<" "<<y<<endl;
  }
  
  
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORR(i, m, n) for (int i = m; i >= n; i--)
#define pb(a) push_back(a)
using namespace std;
typedef long long ll;

int main()
{
    int N, M;
    cin >> N >> M;
    vector<int> x(M);
    REP(i, M)
    {
        cin >> x.at(i);
    }

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

    vector<int> d(M - 1);
    REP(i, M - 1)
    {
        d.at(i) = x.at(i + 1) - x.at(i);
    }

    sort(d.begin(), d.end());
    reverse(d.begin(), d.end());

    int ans = x.at(M - 1) - x.at(0);

    REP(i, min(N - 1, M - 1))
    {
        ans -= d.at(i);
    }

    cout << ans;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define int                 long long   
#define double              long double
#define endl                "\n"
#define pb                  push_back
#define PI                  3.1415926535897932384626433832795l
#define F                   first
#define S                   second
#define mp                  make_pair
#define f(i,n)              for(int i=0;i<n;++i)
#define loop(i,a,b)         for (int i=a ; i<b ;++i)
#define fastio              ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define all(v)              (v).begin(),(v).end()
#define rall(v)             (v).rbegin(),(v).rend()
#define gcd(a,b)            __gcd((a),(b))
#define fill(a,value)       memset(a,value,sizeof(a));
#define minn(v)             *min_element(v.begin(), v.end());
#define maxx(v)             *max_element(v.begin(), v.end());
#define print(x)            cout<<(x)<<endl;
#define sum(v)+x            accumulate(v.begin(), v.end(),x);
typedef pair<int,int> pii;  
typedef vector<int> vi;

  
signed main() 
{
    fastio;
    cout << fixed << setprecision(12);
    int n,m;
    cin>>n>>m;
    vector<vector<int>> a(100005);
    f(i,n)
    {
        int x,y;
        cin>>x>>y;
        a[x].pb(y);
    }
    multiset<int>s;
    int ans=0;
    for(int i=1;i<=m;i++)
    {
        for(auto p:a[i])
        {
            s.insert(p);
        }
        if(s.size())
        {
            ans+=*s.rbegin();
            s.erase(--s.end());
        }
        
    }
    cout<<ans<<endl;
    
    

    return 0;
}


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

template <class T>
void print(vector<T> &vec) {
  for (auto& a : vec) {
    cout << a;
    if (&a != &vec.back()) cout << " ";
  }
  cout << endl;
}

int main() {
  int n;
  cin >> n;
  vector<int> arr(n);
  for (int i = 0; i < n; ++i) {
    int a; cin >> a;
    arr[a - 1] = i + 1;
  }
  print(arr);
}


Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
*/

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

    if(N <= 999) cout << "ABC" << endl;
    else cout << "ABD" << endl;
}

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

int main(int argc, char *argv[]) {
  int N, K;
  cin >> N >> K;
  if(K % 2 == 1) {
    int count = 0;
    for(int i = K; i <= N; i++) {
      if(i % K == 0) {
        count++;
      }
    }
    long long ans = pow(count, 3);
    cout << ans << endl;
  } else {
    int count = 0;
    for(int i = 1; i <= N; i++) {
      if(i % K == K / 2) {
        count++;
      }
    }
    int count2 = 0;
    for(int i = K; i <= N; i++) {
      if(i % K == 0) {
        count2++;
      }
    }
    long long ans = pow(count, 3) + pow(count2, 3);
    cout << ans << endl;
  }
  return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define ALL(A) A.begin(), A.end()

using namespace std;

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

int main()
{
	const string target = "keyence";
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	string S; cin >> S;
	int n = (int)S.length();
	bool ok = false;

	ok = (S == target);
	if (!ok){
		rep (i, n){
			for (int j = i + 1; j < n; ++j){
				string s = S.substr(0,i);
				string t = S.substr(j);
				string u = s + t;
//				cerr << "s: " << s << " t: " << t << endl;
				if (u == target){
					ok |= true;
				} // end if
			} // end for
		} // end rep	
	} // end if

	cout << (ok ? "YES" : "NO") << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define mod 1000000007

int n,k,v[200005],ans = 0;
signed main(){
	cin >> n >> k;
	for(int i = 1 ; i <= n ; i ++) cin >> v[i];
	for(int lf = 0 ; lf <= min(k, n) ; lf ++)
		for(int rt = 0 ; rt + lf <= min(k, n) ; rt ++){
			vector<int> d;
			int sum = 0;
			for(int i = 1 ; i <= lf ; i ++){
				sum += v[i];
				d.push_back(v[i]);
			}
			for(int i = n - rt + 1 ; i <= n ; i ++){
				sum += v[i];
				d.push_back(v[i]);
			}
			sort(d.begin(),d.end());
			d.push_back(LLONG_MAX);
			int cur = 0;
			while(d[cur] < 0 && cur + 1 + lf + rt <= k)
				sum -= d[cur ++];
			ans = max(ans, sum);
		}
	cout << ans;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/range/adaptor/reversed.hpp>

using namespace std;
typedef long long int ll;

#define PI (acos(-1))
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define dumparr(x) cerr << #x ; for(auto elem: x){cerr << " " << elem;} cerr << endl;
#define dumppairs(x) cerr << #x ; for(auto elem: x){cerr << "(" << elem.first << " " << elem.second << ") ";} cerr << endl;
#define dumpline cerr << "**********************" << endl;
#define dumpwline(x) cerr << "******** " << #x << "=" << (x) << " ********" << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

int d = 998244353;

vector <long> gyakus(5e6+10, 0);
int gyaku(long num){
    int e = d - 2;
    long ret = 1;
    long keta = num;
    while (e > 0){
        if (e%2 == 1){
            ret = keta*ret % d;
        }
        e /= 2;
        keta = keta*keta % d;
    }
    return ret;
}

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

    REP(i, n/2 + 10){
        gyakus[i+1] = gyaku(i+1);
    }
    long ans = 1;
    long keta = 3;
    int m = n;
    while (m > 0){
        if (m%2 == 1){
            ans = keta*ans % d;
        }
        m /= 2;
        keta = keta*keta % d;
    }
    ll nozoku = 0;
    ll comb = 1;
    ll two = 1;
    REP(i, n/2){
        nozoku += comb * two;
        nozoku %= d;

        two *= 2;
        two %= d;

        comb *= n-i;
        comb %= d;
        comb *= gyakus[i+1];
        comb %= d;
    }
    ans = ans + d * 2 - nozoku * 2;
    cout << ans % d << endl;
    return 0;
}

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



int sc1(){int x; scanf("%d",&x); return x;}

long long sc2(){long long x;scanf("%lld",&x);return x;}

#define  gcd(a,b)         __gcd(a,b)
#define  lcm(a,b)         (a*b)/gcd(a,b)
#define  Int              sc1()
#define  LL               sc2()
#define  For(n)           for(int i=0;i<n;i++)
#define  Forj(n)          for(int j=0;j<n;j++)
#define  Fork(n)          for(int k=0;k<n;k++)
#define  For1(n)          for(int i=1;i<=n;i++)
#define  ll               long long
#define  vi               std::vector<int>
#define  vll              std::vector<ll>
#define  qui              qu
#define  pb               push_back
#define  mpsi             std::map<string, int>







int main()
{
	//freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    string s,t;
    cin>>s>>t;

    int cnt =0;
    if(s[0]==t[0]) cnt++;
    if(s[1]==t[1]) cnt++;
    if(s[2]==t[2]) cnt++;
    cout<<cnt<<endl;
    return 0;
}




Measured memory_bytes: 256
import itertools

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())

input = [a, b, c, d, e]
a = list(itertools.combinations(input, 2))
a = [True if (b - a) <= k else False for (a, b) in a]

if False in a:
  	print(':(')
else:
	print('Yay!')

Measured memory_bytes: 3064
import Control.Applicative

addcase :: (Int, String) -> String
addcase (x,y) = "Case " ++ show(x) ++ ": " ++ y

main = do
  inputs <- lines <$> getContents
  let valid = takeWhile (/= "0") $ inputs
  let cases = map addcase $ zip [1..] valid
  mapM_ putStrLn cases




Measured memory_bytes: 5052
#include<iostream>
#include<algorithm>
using namespace std;
int N_MAX = 200000;
typedef long long ll;
int main()
{
  int n,i,j;
  ll a[N_MAX],res;
  cin >> n;
  for(i=0;i<n;i++)
    cin >> a[i];
  sort(a,a+n,greater<ll>());
  res=a[0];
  j=n-2;
  for(i=1;i<n;i++){
    if(j==0)
      break;
    if(j==1){
      res+=a[i];
      j--;
    }else{
      res+=2*a[i];
      j-=2;
    }
  }
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 5172
#include<iostream> 
#include<cstdio> 
#include<cmath> 
#include<algorithm> 
#include<string> 
#include<vector> 
#include<map> 
#include<queue> 
using namespace std; 
vector<int> t(31); 
#define s(i,j) swap(i,j) 
#define P pair<int,vector<int> > 
void move1(){s(t[13],t[18]);s(t[7],t[22]);s(t[8],t[23]);s(t[9],t[24]);s(t[10],t[12]);} 
void move2(){s(t[15],t[16]);s(t[1],t[28]);s(t[2],t[29]);s(t[3],t[30]);s(t[19],t[21]);} 
void move3(){s(t[3],t[22]);s(t[6],t[25]);s(t[9],t[28]);s(t[13],t[15]);s(t[12],t[19]);} 
void move4(){s(t[7],t[30]);s(t[4],t[27]);s(t[1],t[24]);s(t[10],t[21]);s(t[16],t[18]);} 

bool ok(vector<int>x){ 
int m,s,e,sum=0; 
int table[]={9,3,3,3,3,9}; 
for(int i=0;i<6;i++){ 
	s=sum+1; 
	sum+=table[i]; 
	e=sum; 
	m=x[s]; 
	for(int j=s;j<=e;j++){ 
		if(x[j]!=m)return 0; 
	} 
} 
return 1; 
} 

int main(){ 
    int n; 
    cin>>n; 
    for(int i=0;i<n;i++){ 
        t[0]=0; 
        for(int j=1;j<=30;j++)cin>>t[j]; 
    queue<P>bfs; 
    bfs.push(P(0,t)); 
 
    while(!bfs.empty()){ 
    pair<int,vector<int> >tmp=bfs.front(); 
    vector<int>tt(31); 
    for(int k=1;k<=30;k++){tt[k]=tmp.second[k];t[k]=tmp.second[k];} 
    bfs.pop(); 
        int tf=tmp.first; 
        if(ok(tt)){ 
        cout<<tf<<endl; 
        break; 
        } 
        move1(); 
        bfs.push(make_pair(tf+1,t)); 
        for(int k=1;k<=30;k++)t[k]=tt[k]; 
        move2(); 
        bfs.push(make_pair(tf+1,t)); 
        for(int k=1;k<=30;k++)t[k]=tt[k]; 
        move3(); 
        bfs.push(make_pair(tf+1,t)); 
        for(int k=1;k<=30;k++)t[k]=tt[k]; 
        move4(); 
        bfs.push(make_pair(tf+1,t)); 
        for(int k=1;k<=30;k++)t[k]=tt[k]; 
    } 
} 
    return 0; 
}

Measured memory_bytes: 15864
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
int main(){
    //先週のD問題
    int a, b; scanf("%d%d", &a, &b);
    int w=100, h=100;
    char ans[1000][1000];
    for(int i = 0; i < 100; i++){
        for(int j = 0; j < 50; j++){
            ans[j][i] = '#';
            ans[j+50][i] = '.';
        }
    }
    /**for(int i = 0; i < 200; i++)
        printf("%s\n", ans[i]);
    printf("A\n\n\n\n");
    */
    a--; b--;
    for(int i = 0; i < a; i++){
        ans[(i/50) * 2][(i*2) % 100] = '.';
    }
    for(int i = 0; i < b; i++){
        ans[(i/50) * 2+51][(i*2) % 100] = '#';
    }
    printf("100 100\n");
    for(int i = 0; i < 100; i++)
        printf("%s\n", ans[i]);
    return 0;
}


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

int main(void) {
    int A, B, C;
    cin >> A >> B >> C;
    if ((A == B && B == C) || (A != B && B != C && C != A)) {
        printf("No\n");
    } else {
        printf("Yes\n");
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<stdio.h>
#include<cctype>
#include<algorithm>
#include<climits>
#include<cmath>
#include<map>
#include<vector>
#define INF INT_MAX
using namespace std;

long long X, K, D;
long long a;

int main(){
	cin >> X >> K >> D;
	X = abs(X);
	a = min(K, X / D);
	K -= a;
	X -= a*D;

	if (K % 2 == 0){
		cout << X << endl;
	}
	else{
		cout << D - X << endl;
	}

	return 0;
}

Measured memory_bytes: 3604
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    Scanner   sc   = new Scanner(System.in);

    void run() {
        int N = sc.nextInt();
        long[] A = new long[N];
        for (int i = 0; i < N; i++) A[i] = sc.nextLong();
        Arrays.sort(A);
        int cnt = 1;
        long w = A[0];
        for (int i = 0; i < N - 1; i++) {
            if (w * 2 >= A[i + 1]) cnt++;
            else cnt = 1;
            w +=  A[i + 1];
        }
        System.out.println(cnt);
    }

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

Measured memory_bytes: 51020
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
int GCD(int a,int b){return b?GCD(b,a%b):a;}
int LCM(int a,int b){return (a*b)/GCD(a,b);}
int abs(int x){return x>0?x:-x;}
 
//const int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
//const int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};

int main()
{
	int n;
	cin >> n;
	int a1[n], a2[n];
	int sum = 0;
	int max = 0;
	REP(i, n) cin >> a1[i];
	REP(i, n) cin >> a2[i];
	REP(i, n){
		sum = 0;
		REP(j, n){
			if (i == j)	sum += a1[j] + a2[j];
			else if (j > i) sum += a2[j];
			else sum += a1[j];
		}

		if (max < sum) max = sum;
	}

	cout << max << endl;
}


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

int main() {
    int N; cin >> N;
    int error_count = 0;
    for (int i = 1; i <= N; i++) {
        int p; cin >> p;
        if (p != i) {
            error_count++;
        }
    }
    if (error_count == 2 || error_count == 0) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
}


Measured memory_bytes: 256
import javax.print.DocFlavor;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.nio.charset.StandardCharsets;
import java.util.*;
import java.util.function.BiConsumer;

public class Main {

    //グローバル変数を定義

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

    void run() {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        boolean check = false;
        loop: for(int i=0; i<=100; i+=4){
            for(int j=0; j<=100; j+=7){
                int sum = i + j;
                if(sum == n){
                    check = true;
                    break;
                }
            }
        }

        if(check) System.out.println("Yes");
        else System.out.println("No");
//        int n = sc.nextInt();
//        int b = sc.nextInt();
//
//        int syou = n/b;
//        int amari = n%b;
//
//        if(amari == 0){
//            System.out.println(0);
//        } else {
//            System.out.println(syou-amari);
//        }
    }
}


Measured memory_bytes: 22612
package main

import "fmt"

func gcd(a, b int64) int64 {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}

func lcm(a, b int64) int64 {
	return a * b / gcd(a, b)
}

func main() {
	var a, b, c, d int64
	fmt.Scan(&a, &b, &c, &d)

	l := lcm(c, d)
	f := func(x int64) int64 {
		return x - (x/c + x/d - x/l)
	}
	ans := f(b) - f(a-1)
	fmt.Println(ans)
}


Measured memory_bytes: 512
from decimal import Decimal, ROUND_CEILING

N = int(input())
pairs = (map(Decimal, input().split()) for _ in range(N))

t = Decimal('1')
a = Decimal('1')
ceil = lambda d: d.to_integral_exact(rounding=ROUND_CEILING)

for ti, ai in pairs:
    mul = max(ceil(t / ti), ceil(a / ai))
    t = ti * mul
    a = ai * mul

print(int(t + a))

Measured memory_bytes: 5076
import java.util.Scanner;

public class Main
{
    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);

        while(true)
        {
            int H = sc.nextInt();
            int W = sc.nextInt();
            if(H==0 && W==0) break;

            int i,k;
            for(i=0; i<H; i++)
            {
                for(k=0; k<W; k++) System.out.printf("#");
                System.out.printf("\n");
            }
            System.out.printf("\n");
        }
        sc.close();
    }
}


Measured memory_bytes: 63104
#define MOD 1000000007
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
    int N; cin >> N;
    vector<int> B(N);
    for (int i = 0; i < N-1; i++) cin >> B[i];
    ll ans = B[0] + B[N-2];
    for (int i = 1; i < N-1; i++) {
        if (B[i-1] < B[i]) ans += B[i-1];
        else ans += B[i];
    }
    cout << ans << endl;
}

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

int main(){
  int w, h, x, y;
  cin >> w >> h >> x >> y;
  double ans = (double)w * h / 2;
  int cnt = 0;
  if (w % 2 == 0 && w / 2 == x && h % 2 == 0 && h / 2 == y) cnt = 1;
  cout << fixed << setprecision(10) << ans <<  " " << cnt << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void){
  long long int a,b,x,i,ans;
  scanf("%lld %lld %lld",&a,&b,&x);
  ans = (b/x)-(a/x);
  if(!(a%x)) ans++;
  printf("%lld\n",ans);
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using Graph=vector<vector<int>>;
#define MOD 998244353

int main(){
  int N,K;
  cin>>N>>K;
  vector<int> p(N);
  for(int i=0;i<N;i++){
    cin>>p.at(i);
  }
  sort(p.begin(),p.end());
  int ans=0;
  for(int i=0;i<K;i++){
    ans+=p.at(i);
  }
  cout<<ans<<endl;
}


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

int main() {
    int r,g,b,k;
    cin >> r >> g >> b >> k;
    int cnt = 0;
    while (g <= r) {
        g *= 2;
        cnt++;
    }
    while (b <= g) {
        b *= 2;
        cnt++;
    }
    if (cnt <= k) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 3632
#include <stdio.h>
#include <math.h>
#define EPS 0.0000000002
#define MAX 1010001000

typedef struct point{
    double x, y;
}point;

typedef struct line{
    point st, en;
}line;

double norm(point a);
double norm2(point a);
double distans(point a, point b);
point sum_vector(point a, point b);
point diff_vector(point a, point b);
point minus_vector(point a);
double dot(point a, point b);
double prod(point a, point b);

point reflection(line a, point p);
point projection(line a, point p);
int ccw(line a, point p);

point reflection(line a, point p)
{
    //直線aについて点pと線対称な点を返す
    return sum_vector(projection(a, p), diff_vector(projection(a, p), p));
}

point projection(line a, point p)
{
    //直線ab上に点pから垂線を下ろしたときの点h//
    point h;
    double k = dot(diff_vector(a.st, p), diff_vector(a.st, a.en))
                / dot(diff_vector(a.en, a.st), diff_vector(a.en, a.st));
    h.x = k * (a.en.x - a.st.x) + a.st.x;
    h.y = k * (a.en.y - a.st.y) + a.st.y;
    return h;
}

double norm(point a)
{
    //原点からの距離
    return sqrt((a.x * a.x) + (a.y * a.y));
}

double norm2(point a)
{
    //原点からの距離の二乗
    return (a.x * a.x) + (a.y * a.y);
}

double distans(point a, point b)
{
    //二点間の距離
    point tmp = sum_vector(b, minus_vector(a));
    return norm(tmp);
}

point sum_vector(point a, point b)
{
    //ベクトルの和
    a.x += b.x;
    a.y += b.y;
    return a;
}

point diff_vector(point a, point b)
{
    //ベクトルの差
    a.x -= b.x;
    a.y -= b.y;
    return a;
}

point minus_vector(point a)
{
    //逆ベクトル
    a.x *= -1;
    a.y *= -1;
    return a;
}

double dot(point a, point b)
{
    //内積
    return (a.x * b.x) + (a.y * b.y);
}

double prod(point a, point b)
{
    //外積
    return (a.x * b.y) - (b.x * a.y);
}

int ccw(line a, point p)
{
    //counter clockwise == 1
    //clockwise == 2
    //online back == 3
    //online front == 4
    //on segment == 5
    int cls = prod(diff_vector(a.en, a.st), diff_vector(p, a.st));
    if (cls > 0) {
        return 1;
    } else if (cls < 0) {
        return 2;
    } else if (dot(diff_vector(a.en, a.st), diff_vector(p, a.st)) < 0) {
        return 3;
    } else if (norm(diff_vector(a.st, a.en)) < norm(diff_vector(a.st, p))) {
        return 4;
    } else {
        return 5;
    }
}

///////////////////////////////////////

int main(void)
{
    point p;
    line ab;
    int n, i, a;

    scanf("%lf%lf%lf%lf%d", &ab.st.x, &ab.st.y, &ab.en.x, &ab.en.y, &n);
    for (i = 0; i < n; i++) {
        scanf("%lf%lf", &p.x, &p.y);
        a = ccw(ab, p);
        if (a == 1) {
            puts("COUNTER_CLOCKWISE");
        } else if (a == 2) {
            puts("CLOCKWISE");
        } else if (a == 3) {
            puts("ONLINE_BACK");
        } else if (a == 4) {
            puts("ONLINE_FRONT");
        } else {
            puts("ON_SEGMENT");
        }
    }
    return 0;
}

Measured memory_bytes: 616
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
ll mod=998244353;
ll mul(ll a, ll b)
{
	return ((a%mod)*(b%mod))%mod;
}
ll add(ll a, ll b)
{
	return ((a%mod)+(b%mod))%mod;
}
ll sub(ll a, ll b)
{
	return ((a%mod)-(b%mod)+mod)%mod;
}
int main() 
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ll k,a,b;
	cin>>k>>a>>b;
	ll tr=0;
	for(ll i=k;i<=b;i+=k)
	{
		if(i>=a && i<=b)
		{
			tr++;
		}
	}
	if(tr)
	{
		cout<<"OK";
		exit(0);
	}
	cout<<"NG";
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,b) FOR(i,0,b)
#define BE(c) c.begin(),c.end()
#define PB push_back
#define F first
#define S second
#define BEB(s) s
using namespace std;
string fld[8];
int dx[12]={-3,-2,-1,0,0,0,0,0,0,1,2,3},dy[12]={0,0,0,-3,-2,-1,1,2,3,0,0,0};
void bomb(int x,int y){
	fld[y][x]='0';
	REP(i,12){
		int nx=x+dx[i],ny=y+dy[i];
		if(nx>=0&&nx<8&&ny>=0&&ny<8&&fld[ny][nx]=='1')bomb(nx,ny);
	}
}
int main(){
	string s;
	int n;
	cin>>n;
	REP(i,n){
		REP(j,8)cin>>fld[j];
		int x,y;
		cin>>x;
		cin>>y;x--;y--;
		bomb(x,y);
		cout<<"Data "<<i+1<<":"<<endl;
		REP(j,8)cout<<fld[j]<<endl;
	}
	return 0;
}

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

using ll=long long;
#define int ll

#define FOR(i,a,b) for(int i=int(a);i<int(b);i++)
#define REP(i,b) FOR(i,0,b)
#define MP make_pair
#define PB push_back
#define ALL(x) x.begin(),x.end()
#define REACH cerr<<"reached line "<<__LINE__<<endl
//#define DMP(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl
#define DMP(x) 0
#define ZERO(x) memset(x,0,sizeof(x))

using pi=pair<int,int>;
using vi=vector<int>;
using ld=long double;

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

template<class T>
ostream& operator <<(ostream& os,const vector<T>& v){
	os<<"[";
	REP(i,(int)v.size()){
		if(i)os<<",";
		os<<v[i];
	}
	os<<"]";
	return os;
}

int read(){
	int i;
	scanf("%lld",&i);
	return i;
}

void printSpace(){
	printf(" ");
}

void printEoln(){
	printf("\n");
}

void print(int x,int suc=1){
	printf("%lld",x);
	if(suc==1)
		printEoln();
	if(suc==2)
		printSpace();
}

string readString(){
	static char buf[3341919];
	scanf("%s",buf);
	return string(buf);
}

char* readCharArray(){
	static char buf[3341919];
	static int bufUsed=0;
	char* ret=buf+bufUsed;
	scanf("%s",ret);
	bufUsed+=strlen(ret)+1;
	return ret;
}

template<class T,class U>
void chmax(T& a,U b){
	if(a<b)
		a=b;
}

template<class T,class U>
void chmin(T& a,U b){
	if(a>b)
		a=b;
}

template<class T>
T Sq(const T& t){
	return t*t;
}

const int inf=LLONG_MAX/3;

int Wafrelka(int,int,int);
int Joisino(int,int,int);

int Wafrelka(int a,int b,int d){
	DMP("W "<<a<<" "<<b<<" "<<d);
	if((b-a+1)==(1LL<<d))return b-a+1;
	assert(d-1>=0);
	int threshold=1LL<<(d-1);
	if(b<threshold)return Wafrelka(a,b,d-1);
	if(threshold<=a)return Wafrelka(a^threshold,b^threshold,d-1);
	return Joisino(b^threshold,a,d-1)+Wafrelka(a,threshold-1,d-1);
}
int Joisino(int a,int b,int d){
	DMP("J "<<a<<" "<<b<<" "<<d);
	if(b<=a+1)return (1LL<<d);
	assert(d-1>=0);
	int threshold=1LL<<(d-1);
	if(threshold<=a)return threshold*2;
	if(a<threshold&&threshold<=b)return Wafrelka(0,a,d-1)+Wafrelka(b^threshold,threshold-1,d-1);
	if(b<threshold)return Joisino(a,b,d-1)+threshold;
	assert(false);
	return 0;
}

signed main(){
	int a=read(),b=read();
	assert(a<=b);
	cout<<Wafrelka(a,b,60);
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
    string ans;
    int n,Red=0,Blue=0;
    cin >> n;
    char color[n];
    cin >> color;
    for (int i=0;i<n;i++){
        if (color[i] == 'R'){
            Red++;
        }else {
            Blue++;
        }
        }
        
        if (Red>Blue){
            ans = "Yes";
        }else {
            ans = "No";
        }
        cout << ans <<"\n";
    }

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define d long double

signed main() 
{
   // haha
    int n;
    cin>>n;
    int arr[n+1];
    memset(arr,0,sizeof(arr));
    for(int i=0;i<n-1;i++)
    {
        int x;
        cin>>x;
        arr[x]++;
    }
    for(int i=1;i<=n;i++)
    cout<<arr[i]<<" ";
    
   
}




Measured memory_bytes: 5188