akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<functional>
#include<map>
#include<cstdlib>
#include<complex>
#include<numeric>
#include<set>
#include<deque>

using namespace std;
using Int = long long;
Int INF = 1LL << 60;
const Int MOD = 1000000000 + 7;

template<int Modulo = MOD> struct Mint {
	Int val;
	constexpr Mint(Int v = 0) noexcept : val(v% Modulo) {
		if (val < 0) v += Modulo;
	}
	constexpr int getmod() { return Modulo; }
	constexpr Mint operator - () const noexcept { return val ? Modulo - val : 0; }
	constexpr Mint operator + (const Mint& r) const noexcept { return Mint(*this) += r; }
	constexpr Mint operator - (const Mint& r) const noexcept { return Mint(*this) -= r; }
	constexpr Mint operator * (const Mint& r) const noexcept { return Mint(*this) *= r; }
	constexpr Mint operator / (const Mint& r) const noexcept { return Mint(*this) /= r; }
	constexpr Mint& operator += (const Mint& r) noexcept {
		val += r.val;
		if (val >= Modulo) val -= Modulo;
		return *this;
	}
	constexpr Mint& operator -= (const Mint& r) noexcept {
		val -= r.val;
		if (val < 0) val += Modulo;
		return *this;
	}
	constexpr Mint& operator *= (const Mint& r) noexcept {
		val = val * r.val % Modulo;
		return *this;
	}
	constexpr Mint& operator /= (const Mint& r) noexcept {
		Int a = r.val, b = Modulo, u = 1, v = 0;
		while (b) {
			Int t = a / b;
			a -= t * b; swap(a, b);
			u -= t * v; swap(u, v);
		}
		val = val * u % Modulo;
		if (val < 0) val += Modulo;
		return *this;
	}
	constexpr bool operator == (const Mint& r) const noexcept {
		return this->val == r.val;
	}
	constexpr bool operator != (const Mint& r) const noexcept {
		return this->val != r.val;
	}
	friend ostream& operator << (ostream& os, const Mint<Modulo>& x) noexcept {
		return os << x.val;
	}
	friend istream& operator >> (istream& is, Mint<Modulo>& x) noexcept {
		Int tmp; is >> tmp;
		x = Mint<Modulo>(tmp);
		return is;
	}
	friend constexpr Mint<Modulo> modpow(const Mint<Modulo>& a, Int n) noexcept {
		Mint res(1), tmp = a;
		while (n > 0) {
			if (n & 1) res *= tmp;
			tmp *= tmp;
			n >>= 1;
		}
		return res;
	}
};

using mint = Mint<>;

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	Int N, W;
	cin >> N >> W;

	vector<Int> w(N);
	vector<Int> v(N);

	for (Int i = 0; i < N; i++) {
		cin >> w[i] >> v[i];
	}

	vector<vector<Int>> dp(2, vector<Int>(W + 10));
	for (Int i = 0; i < N; i++) {
		for (Int j = 0; j <= W; j++) {
			if (j - w[i] >= 0) {
				dp[(i + 1)&1][j] = max(dp[i&1][j - w[i]] + v[i], dp[(i + 1)&1][j]);
			}
			dp[(i + 1)&1][j] = max(dp[(i + 1)&1][j], dp[i&1][j]);
		}
	}
	cout << dp[N&1][W] << "\n";

}


Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
 
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define RFOR(i, b, a) for(int i = (b) - 1; i >= (a); --i)
#define REP(i, N) FOR(i, 0, N)
#define RREP(i, N) RFOR(i, N, 0)
#define FILL(A,value) memset(A,value,sizeof(A))
#define endl '\n'
 
#define ALL(V) V.begin(), V.end()
#define SZ(V) (int)V.size()
#define watch(x) cout << (#x) << " is " << (x) << endl
#define pb push_back
#define mp make_pair
#define Pi 3.14159265358979
#define A first
#define B second
 
typedef long long ll;
typedef vector <int> vi;
typedef vector<ll> vl;
typedef pair <int, int> pi;
typedef pair <ll, int> pl;
typedef pair <ll, ll> pll;
typedef pair <double, double> pd;
 
//change these according to prob constraints
const int INF = 0x3f3f3f3f;
const int MAX = 100005;
const int MAX1 = 1005;
const int MAX2 = 105;
const int LEN = 105;
const int BASE = 1000000000;
const double EPS = 1e-7;
const int MOD = 1000000007;
//g++ -std=c++11 your_file.cpp -o your_program
 
ll mypow(ll a, ll b){
	ll ans=1;
	while(b){
		if(b&1)
			ans=(ans*a)%MOD;
		b/=2;
		a=(a*a)%MOD;
	}
	return ans;
}
 
int main(void){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ifstream in("");
	ofstream out("");
	clock_t begin = clock();
	int a, b, c;
	cin >> a >> b >> c;
	int tmp = __gcd(a, b);
	int ct = 0;
	RFOR(i, tmp + 1, 1){
		if (tmp % i == 0) ++ct;
		if (ct == c) {
			cout << i << endl;
			return 0;
		}
	}
	clock_t end = clock();
    double esecs = double(end - begin) / CLOCKS_PER_SEC;
    //cout << esecs << " seconds" << endl;
	return 0;	
}

Measured memory_bytes: 256
fn is_bomb(c: char) -> bool {
    c == '#'
}

fn main() {
    let v = read_vec::<usize>();
    let h = v[0];
    let w = v[1];

    let mut vv = vec![];
    for _ in 0..h {
        vv.push(read::<String>().chars().collect::<Vec<char>>());
    }
    for i in 0..h {
        for j in 0..w {
            if vv[i][j] != '#' {
                let mut count = 0;

                if i > 0 && j > 0 && is_bomb(vv[i - 1][j - 1]) {
                    count += 1;
                }
                if i > 0 && is_bomb(vv[i - 1][j]) {
                    count += 1;
                }
                if i > 0 && j < w - 1 && is_bomb(vv[i - 1][j + 1]) {
                    count += 1;
                }
                if j < w - 1 && is_bomb(vv[i][j + 1]) {
                    count += 1;
                }
                if i < h - 1 && j < w - 1 && is_bomb(vv[i + 1][j + 1]) {
                    count += 1;
                }
                if i < h - 1 && is_bomb(vv[i + 1][j]) {
                    count += 1;
                }
                if i < h - 1 && j > 0 && is_bomb(vv[i + 1][j - 1]) {
                    count += 1;
                }
                if j > 0 && is_bomb(vv[i][j - 1]) {
                    count += 1;
                }
                vv[i][j] = count.to_string().chars().nth(0).unwrap();
            }
        }
    }
    for i in 0..h {
        for j in 0..w {
            print!("{}", vv[i][j]);
        }
        println!("");
    }
}

#[allow(dead_code)]
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}
#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}
#[allow(dead_code)]
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
#[allow(dead_code)]
fn yn(result: bool) {
    if result {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 4352
n,a = map(int,input().split())
xx = list(map(int,input().split()))

sm = sum(xx)
dp = [[0 for j in range(sm+1)] for i in range(n+1)]
dp[0][0] = 1
for x in xx:
    for i in range(1,n+1)[::-1]:
        for j in range(x,sm+1)[::-1]:
            # if dp[i-1][j-x]:
            dp[i][j] += dp[i-1][j-x]

ans = 0
for i in range(1, min(sm // a,n) + 1):
    ans += dp[i][i*a]
print(ans)


Measured memory_bytes: 42092
class Set(): #BinaryIndexedTree
    def __init__(self, valuelist, INF=10**18+1):
        self.n = len(valuelist) + 1
        self.value = sorted(valuelist) + [INF]
        self.comp = {v : k for k, v in enumerate(self.value, 1)}
        self.bit = BinaryIndexedTree(self.n)

    def insert(self, x, k=1):
        self.bit.add(self.comp[x], k)

    def delete(self, x, k=1):
        self.bit.add(self.comp[x], -k)

    def count(self, x):
        return self.bit.get(self.comp[x])

    def sum(self, x):
        return self.bit.sum(self.comp[x])

    def get(self, k): #k個以下のときはINFを返す
        return self.value[self.bit.bisect_left(k) - 1]

class BinaryIndexedTree(): #1-indexed
    def __init__(self, n):
        self.n = n
        self.tree = [0 for _ in range(n + 1)]

    def sum(self, index):
        res = 0
        while index:
            res += self.tree[index]
            index -= index & -index
        return res

    def get(self, index):
        return self.sum(index) - self.sum(index - 1)

    def add(self, index, x):
        while index <= self.n:
            self.tree[index] += x
            index += index & -index

    def bisect_left(self, x):
        if x <= 0: return 0
        res, tmp = 0, 2**((self.n).bit_length() - 1)
        while tmp:
            if res + tmp <= self.n and self.tree[res + tmp] < x:
                x -= self.tree[res + tmp]
                res += tmp
            tmp >>= 1
        if res >= self.n:
            return self.n
        return res + 1

MOD = 10**9 + 7

N, M = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

S = Set(list(range(N * M + 1)))
T = Set(list(range(N * M + 1)))

res = 1

for i in range(N):
    if S.count(A[i]):
        res = 0
    S.insert(A[i])

for i in range(M):
    if T.count(B[i]):
        res = 0
    T.insert(B[i])

for i in range(N * M):
    k = N * M - i
    if S.count(k) and T.count(k):
        res *= 1
    elif S.count(k):
        res *= T.sum(N * M) - T.sum(k)
    elif T.count(k):
        res *= S.sum(N * M) - S.sum(k)
    else:
        res *= (S.sum(N * M) - S.sum(k)) * (T.sum(N * M) - T.sum(k)) - i
    res %= MOD

print(res)

Measured memory_bytes: 268512
h,w=map(int,input().split())
if (h%3)*(w%3)==0:
    print(0)
    exit()
else:
    hh=(h*w)//3//h
    ww=(h*w)//3//w
    a=max(hh*h,(w-hh)*(h//2),(w-hh)*(h-h//2))-min(hh*h,(w-hh)*(h//2),(w-hh)*(h-h//2))
    b=max(ww*w,(h-ww)*(w//2),(h-ww)*(w-w//2))-min(ww*w,(h-ww)*(w//2),(h-ww)*(w-w//2))
    c=max((hh+1)*h,(w-hh-1)*(h//2),(w-hh-1)*(h-h//2))-min((hh+1)*h,(w-hh-1)*(h//2),(w-hh-1)*(h-h//2))
    d=max((ww+1)*w,(h-ww-1)*(w//2),(h-ww-1)*(w-w//2))-min((ww+1)*w,(h-ww-1)*(w//2),(h-ww-1)*(w-w//2))
    print(min(a,b,c,d,h,w))

Measured memory_bytes: 3064
#include <iostream>
#include <sstream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <set>
#include <vector>
#include <utility>
#include <queue>
#include <cmath>

#define BEGIN(x) x.begin()
#define END(x) x.end()
#define ALL(x) BEGIN(x), END(x)
#define PAIR make_pair
#define VEC(type) vector<type >

#define FOR(i, A, B) for(auto i = (A);i != (B); i++)
#define FORD(i, A, B) for(auto i = (A);i != (B); i--)

#define READRANGE(begin, end) FOR(it, begin, end) cin >> *it
#define READVEC(V) READRANGE(BEGIN(V), END(V))

using namespace std;

typedef long long lint;
typedef pair<int, int> Pii;
typedef pair<int, lint> Pil;
typedef pair<lint, lint> Pll;
typedef pair<lint, int> Pli;

void io_init()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
};

int main(int argc, char **argv)
{
    io_init();

    // Actual program code starts here.
    int N, K;
    cin >> N >> K;
    int ret = K;
    FOR(i, 1, N)
        ret *= K - 1;
    cout << ret << endl;
    return 0;
};


Measured memory_bytes: 256
import math
def dist(a, b):
  ans = 0
  for i in range(len(a)):
    ans += (a[i]- b[i]) ** 2
  return math.sqrt(ans)

n, d = (int(i) for i in input().split())  
x = []
for i in range(n):
  t = [int(j) for j in input().split()] 
  x.append(t)
  
ans = 0
for i in range(n):
  for j in range(n)[i+1:]:
 #   print("("+str(i)+","+ str(j)+")")
    d = dist(x[i], x[j])
    if math.ceil(d) == d:
      ans += 1
print(ans)

Measured memory_bytes: 3064
typedef long long ll;
typedef long double ld;
#include <bits/stdc++.h>
using namespace std;

int main() {
    ll n,k;
    std::cin >> n>>k;
    vector<ll> p(n);
    for (int i = 0; i < n; i++) {
        std::cin >> p[i];
    }
    sort(p.begin(),p.end());
    ll ans = 0;
    for (int i = 0; i < k; i++) {
        ans += p[i];
    }
    std::cout << ans << std::endl;
}


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

int main()
{
    int N, M;
    cin >> N >> M;
    if(N == 1) {
        cout << M;
        return 0;
    }
    for(int i = M / 2 + 1; i >= 1; i--) {
        if(M % i == 0 && (M / i) >= N) {
            cout << i;
            return 0;
        }
    }
    return 0;
}


Measured memory_bytes: 256
#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++)
using ll = long long;
using VI = vector<int>;
using VVI = vector<vector<int>>;
using P = pair<int, int>;

int main(){
    string s;
    cin >> s;
    int n = s.size();
    
    // VI list = {0,1,2,3,4,5,5,4,3,2};
    // int ans = 0;
    // rep(i,n){
    //     int d = s[i] - '0';
    //     ans += list[d];
    // }

    // VI num(n+1, 0);
    // rep(i,n){
    //     int d = s[i] - '0';
    //     if(d > 5){
    //         num[i]++;
    //         num[i+1] = 10 - d;
    //     }else if(d==5){
    //         if(num[i] > 0){
    //             num[i]--;
    //             num[i+1] = 5;
    //         }else{
    //             num[i+1] = 5;
    //         }
    //     }else{
    //         num[i+1] = d;
    //     }
    // }

    // int ans = 0;
    // rep(i,n+1){
    //     ans += num[i];
    // }

    // cout << ans << endl;

    VI d(n+1, 0);
    rep(i,n){
        d[i] = s[n-1-i] - '0';
    }

    int ans = 0;
    rep(i,n+1){
        if(d[i] <= 4){
            ans += d[i];
        }else if(d[i] >= 6){
            ans += 10 - d[i];
            d[i+1] += 1;
        }else{
            if(d[i+1] <= 4){
                ans += d[i];
            }else{
                ans += 10 - d[i];
                d[i+1] += 1;
            }
        }
    }
	
    cout << ans << endl;

	return 0;
}

Measured memory_bytes: 5252
#include <cstdio>
#include <map>
#include <algorithm>

using ll = long long;
using namespace std;
map<int,int> ntok;
int a[123456];
int sa[123456];
int n;

int main()
{
	scanf("%d", &n);
	for (int i = 0; i < n; ++i)
	{
		scanf("%d",a + i);
		sa[i] = a[i];
	}
	sort(sa, sa + n);
	for (int i = 0; i < n; ++i)
	{
		ntok[sa[i]] = i;
	}
	for (int i = 0; i < n; ++i)
	{
		a[i] = ntok[a[i]];
	}
	int ans = 0;
	for (int i = 0; i < n; ++i)
	{
		if (a[i] % 2 != i % 2)++ans;
	}
	printf("%d\n",ans / 2);
	return 0;
}

Measured memory_bytes: 5888
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ll long long
#define lld long double
#define ALL(x) x.begin(), x.end()
#ifdef DEBUG
#define line() cerr << "[" << __LINE__ << "] ";
#define dump(i) cerr << #i ": " << i << " ";
#define dumpl(i) cerr << #i ": " << i << endl;
#else
#define line(i)
#define dump(i)
#define dumpl(i)
#endif
using namespace std;
const int IINF = (1 << 30);

const ll MOD = 1e9 + 7;

bool isok2(string s)
{
    assert(s.size() == 2);
    return s[0] == s[1];
}

bool isok3(string s)
{
    assert(s.size() == 3);
    return s[0] == s[1] || s[0] == s[2] || s[1] == s[2];
}

int main(int argc, char const *argv[])
{
    string s;
    cin >> s;
    rep(i, s.size())
    {
        if (i + 1 < s.size())
        {
            if (isok2(s.substr(i, 2)))
            {
                cout << i + 1 << " " << i + 2 << endl;
                return 0;
            }
        }
        if (i + 2 < s.size())
        {
            if (isok3(s.substr(i, 3)))
            {
                cout << i + 1 << " " << i + 3 << endl;
                return 0;
            }
        }
    }
    cout << -1 << " " << -1 << endl;
    return 0;
}


Measured memory_bytes: 512
#include<stdio.h>
int main()
{
    int A,B,r1,r2,r3;
    scanf("%d %d",&A,&B);

    r1=A+B;
    r2=A-B;
    r3=A*B;

    if(r1>=r2 && r1>=r3)
    {
        printf("%d\n",r1);
    }


    else if(r2>=r1 && r2>=r3)
    {
        printf("%d\n",r2);

    }

   else if(r3>=r1 && r3>=r2)
    {
        printf("%d\n",r3);

    }


    return 0;
}


Measured memory_bytes: 128
import java.util.*;
//import java.util.Arrays;

public class Main {
    public static void main(String[] args) {
        int i, count = 0;
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int a[] = new int[N];
        for (i = 0; i < N; i++) {
            if (sc.nextInt() % 2 == 1 && i % 2 == 0)
                count++;
        }

        System.out.println(count);
    }
}

Measured memory_bytes: 35804
#include <iostream>
#include <vector>

int main()
{
  //Digit=log2_10^18=59.7...
  constexpr int Digit=60;
  
  uint64_t N,K;
  std::cin>>N>>K;
  
  std::vector<std::vector<uint64_t>> a(Digit,std::vector<uint64_t>(N,0));
  for(uint64_t i=0;i!=N;i++)
  {
    std::cin>>a[0][i];
  }
  
  for(uint64_t i=1;i!=Digit;i++)
  {    
    for(uint64_t j=0;j!=N;j++)
    {
      a[i][j]=a[i-1][a[i-1][j]-1];
    }
  }
  
  uint64_t pos=1;
  for(uint64_t i=0;i!=Digit;i++)
  {
    if(K&(1ull<<i))
    {
      pos=a[i][pos-1];
    }
  }
  
  std::cout<<pos<<std::endl;
  
  return 0;
}

Measured memory_bytes: 98568
import java.util.Scanner;
 
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C =sc.nextInt();
      
      if(A%2==1 && B%2==1 && C%2==1){
        System.out.println(Math.min((long) A*B, Math.min((long) B*C, (long) A*C)));
      }else{
        System.out.println(0);
      }
    }
}
      

Measured memory_bytes: 35580
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <sstream>
#include <istream>

using namespace std;

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

int main(){
	int n;
	cin >> n;
	cout << n/2*((n+1)/2) << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
const int N = 2005;
using namespace std;
#define pb          push_back
#define m_p			make_pair
#define rep(i,a,b)	for(int i=a;i<b;i++)
#define sz(x)       (int)x.size()
#define f			first
#define debug		cout<<"##########3"<<endl
#define mod			1000000007
#define ll			long long int
#define lMax		LLONG_MAX
int n, m;
vector<int> g[N], gr[N],gv[N];
int used[N];
vector<int> order;
vector<int> comp;
int ans[N];
int dp[N][N];
int t = 0,f=0,v=0;
int vis[3005],rec[3005],par[3005];
void dfsi(int a){
//	cout<<a<<"ji"<<endl;
	vis[a]=++t;
	rec[a]=1;
	for(auto it:gv[a]){
		if(!vis[it]){
			par[it] = a;
			dfsi(it);
		}
		else if(rec[it] && f<vis[it])
		{
			f = vis[it];
			v=it;
			par[it] = a;
			//cycle
			
		}
	}
	rec[a]=0;
}
void dfs(int v)
{
	used[v] = 1;
	for (int i = 0; i < g[v].size(); i++)
	{
		int to = g[v][i];
		if (used[to])
			continue;
		dfs(to);
	}
	order.push_back(v);
}
void dfs2(int v)
{
	comp.push_back(v);
	used[v] = 1;
	for (int i = 0; i < gr[v].size(); i++)
	{
		int to = gr[v][i];
		if (used[to])
			continue;
		dfs2(to);
	}
}
int main(){
	ios_base::sync_with_stdio(0);
	cin >> n >> m;
	for (int i = 1; i <= m; i++)
	{
		int a, b;
		cin >> a >> b;
		dp[a][b]=1;
		g[a].push_back(b);
		gr[b].push_back(a);
	}
	for (int i = 1; i <= n; i++)
	{
		if (used[i])
			continue;
		dfs(i);
	}
	reverse(order.begin(), order.end());
	for (int i = 1; i <= n; i++)
	{
		used[i] = 0;
	}
	for (int i = 0; i < order.size(); i++)
	{
		int id = order[i];
		if (used[id])
			continue;
		comp.clear();
		dfs2(id);
		if (comp.size() == 1)
			continue;
		//cout<<comp.size()<<endl;
		for (int j = 0; j < comp.size(); j++)
		{
			for(int ii=1;ii<=n;ii++){
				if(dp[comp[j]][ii]==1 && used[ii]==1)
					gv[comp[j]].pb(ii);
			}
		}
		dfsi(comp[0]);
		int q=v;
		int	c=1;
			vector<int> an;
			an.pb(q);
			while(par[v]!=q){
				c++;
				v = par[v];
				an.pb(v);
			}
			cout<<an.size()<<endl;
			rep(i,0,an.size()){
				cout<<an[i]<<endl;
			}
			return 0;
	}

	cout << -1;
	return 0;
}

Measured memory_bytes: 7808
#include <bits/stdc++.h>
using namespace std;
using LL = long long; using PII = pair<LL, LL>; using VI = vector<LL>; using VVI = vector<VI>;
using VB = vector<bool>; using VS = vector<string>; using VP = vector<PII>;
#define VV(T)        vector<vector<T>>
#define PB           push_back
#define MP           make_pair
#define SZ(a)        LL((a).size())
#define EACH(x, c)   for (auto x : (c))
#define ALL(c)       (c).begin(), (c).end()
#define REVERSE(c)   reverse(ALL(c))
#define SORT(c)      stable_sort(ALL(c))
#define RSORT(c)     stable_sort((c).rbegin(), (c).rend())
#define FOR(i, a, b) for (LL i = (a); i < (b); ++i)
#define REP(i, n)    FOR(i, 0, n)
#define $(x)         {cout << #x << " = " << (x) << endl;}

const LL MOD = 1000000007;
inline LL mod_add(LL a, LL b) { return (a + b) % MOD; }
inline LL mod_sub(LL a, LL b) { return (a + MOD - b) % MOD; }
inline LL mod_mul(LL a, LL b) { return ((a % MOD) * (b % MOD)) % MOD; }
LL mod_bipow(LL x, LL y) {   // x^y by bisection method
    if (y == 0) return 1;
    else if (y == 1) return x % MOD;
    else if (y % 2 == 0) {
        LL val = mod_bipow(x, (LL)(y / 2));
        return mod_mul(val, val);
    } else {
        LL val = mod_bipow(x, (LL)(y / 2));
        return mod_mul(mod_mul(val, val), x);
    }
}
LL mod_inv(LL x) { return mod_bipow(x, MOD - 2); }   // x^{-1} = x^{MOD-2} (MOD: prime number)
LL mod_div(LL a, LL b) { return mod_mul(a, mod_inv(b)); }   // a/b = a*b^{-1}

class Combination {
    VI facts, inv_facts;
public:
    Combination(LL N) : facts(N + 1), inv_facts(N + 1) {
        REP(i, N + 1) facts[i] = i == 0 ? 1 : mod_mul(facts[i - 1], i);
        for (LL i = N; i >= 0; i--) inv_facts[i] = i == N ? mod_inv(facts[N]) : mod_mul(inv_facts[i + 1], i + 1);   // (i!)^{-1}=((i+1)!)^{-1}*(i+1)
    }
    LL nCr(LL n, LL r) {
        return mod_mul(facts[n], mod_mul(inv_facts[r], inv_facts[n - r]));
    }
};

void solve(long long N, long long K){ 
    Combination c(N);   // N は n の最大値
    FOR(i, 1, K + 1) {
        if (i > N - K + 1) {
            cout << "0" << endl;
        } else {
            cout << mod_mul(c.nCr(mod_sub(K, 1), mod_sub(i, 1)),
                            c.nCr(mod_add(mod_sub(N, K), 1), i)) << endl;
        }
    }
}

int main(){
    long long N;
    scanf("%lld",&N);
    long long K;
    scanf("%lld",&K);
    solve(N, K);
    return 0;
}


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

int main(){
    string s; cin >> s;

    int ans = 0;
    rep(i, 3){
        if(s[i] == 'R'){
            if(ans == 0) {
                ans++;
            } else if(s[i-1] == 'R') {
                ans++;
            } else {
                ans = 1;
            }
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3604
#include <iostream>
using namespace std;
int main()
{
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  if (A + B > C + D)
    cout << "Left" << endl;
  else if (A + B < C + D)
    cout << "Right" << endl;
  else
    cout << "Balanced" << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	int n;
	cin>>n;
	int m=n%100;
	int y=n/100;
	if(m>12||m==0){
		if(y>0&&y<=12) cout<<"MMYY"<<endl;
		else cout<<"NA"<<endl;
		return 0;
	}
	else{
		if(y>0&&y<=12) cout<<"AMBIGUOUS"<<endl;
		else cout<<"YYMM"<<endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr int INF = (1 << 30) - 1;

int main() {
        int N;
        int A[100005];
        int dp[100005][2];
        ll sum = 0;

        cin >> N;
        for ( int i = 0; i < N; i++ ) {
                cin >> A[i];
                sum += (A[i] - 1) / 2;
                A[i] = (A[i] & 1) ? 1 : min(2, A[i]);
        }

        fill_n(*dp, 100005 * 2, -INF);  
        dp[0][0] = 0;
        for ( int i = 0; i < N; i++ ) {
                for ( int j = 0; j < 2; j++ ) {
                        if ( dp[i][j] == -INF ) continue;
                        int a = A[i] - j;
                        dp[i + 1][0] = max(dp[i + 1][0], dp[i][j] + (a == 2));
                        if ( i < N - 1 ) {
                                if ( a >= 1 && A[i + 1] >= 1 ) {
                                        dp[i + 1][1] = max(dp[i + 1][1], dp[i][j] + 1);
                                }
                        }
                }
        }
        cout << dp[N][0] + sum << endl;
        return ( 0 );
}


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

int ctoi(char);

int main()
{
    string s;
    // char strs;    

    while (1)
    {
        cin >> s;
        if (s == "0") break;
        int digs = 0;
        for (long unsigned int i = 0; i < s.length(); i++) {
            // char strs = s[i];
            digs += ctoi(s[i]);
        }
        cout << digs << endl;
    }
    return 0;
}

int ctoi(char c)
{
    switch (c)
    {
    case '0':
        return 0;
    case '1':
        return 1;
    case '2':
        return 2;
    case '3':
        return 3;
    case '4':
        return 4;
    case '5':
        return 5;
    case '6':
        return 6;
    case '7':
        return 7;
    case '8':
        return 8;
    case '9':
        return 9;
    default:
        return 0;
    }
}


Measured memory_bytes: 3212
k, n = list(map(int, input().split()))
a = list(map(int, input().split()))
a.append(a[0])
m = 0
for i in range(0, n):
  d = abs(a[i+1] - a[i])
  x = min(d, k-d)
  if(x>m):
    m = x
    i1 = i
f = 0
for i in range(0, n):
  d = abs(a[i+1] - a[i])
  x = min(d, k-d)
  if(i!=i1):
    f+=x
print(f)

Measured memory_bytes: 79180
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;

int N, M;

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	cin >> N >> M;
	cout << N * (N - 1) / 2 + M * (M - 1) / 2;
}

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

#define rep(i,n) for(int (i)=0;(i)<(n);++(i))
#define FOR(i,a,b) for(int (i)=(a);i<(b);++(i))
#define ALL(obj) (obj).begin(),(obj).end()
#define space <<" "<<
#define ll long long
#define bpm %1000000007

using namespace std;

ll powAns(ll,ll);

int main(){
    int m,f,r;
    while(1<2){
    cin>>m>>f>>r;
    int t=m+f;
    if(m==-1&&f==-1&&r==-1)break;
    if(m==-1||f==-1)cout<<"F"<<endl;
    else if(t<30)cout<<"F"<<endl;
    else if(t<50)if(r<50)cout<<"D"<<endl;
    else cout<<"C"<<endl;
    else if(t<65)cout<<"C"<<endl;
    else if(t<80)cout<<"B"<<endl;
    else cout<<"A"<<endl;
    }
}

ll powAns(ll m ,ll n){
    ll res=1;
    while(n>0){
        if(n & 1)res = res*m bpm;

        m=m*m bpm;
        n>>=1;
    }

    return res;
}



Measured memory_bytes: 3076
#include<cstdio>

const int N=100000;
int n,a[N];
long long ans[N],sum;

int main() {
	scanf("%d",&n);
	for(int i=1;i<=n;i++) {
		scanf("%d",&a[i]);
		sum+=a[i];
		if(i%2==1&&i!=n)
			ans[n]+=2*a[i];
	}
	ans[n]=sum-ans[n];
	for(int i=n-1;i>=1;i--)
		ans[i]=2*a[i]-ans[i+1];
	for(int i=1;i<n;i++)
		printf("%lld ",ans[i]);
	printf("%lld\n",ans[n]);
	return 0;
}

Measured memory_bytes: 2432
N, K = [int(_) for _ in input().split()]
xs = [int(_) for _ in input().split()]
L = []
R = [0]
for i in range(N):
    if xs[i] < 0:
        L += [-xs[i]]
    elif xs[i] > 0:
        R += [xs[i]]
    else:
        K -= 1
L = [0] + L[::-1]

ans = 10 ** 9
for i in range(0, len(L)):
    if 0 <= K - i and K - i < len(R):
        ans = min(ans, 2 * L[i] + R[K - i], L[i] + 2 * R[K - i])
print(ans)

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

typedef long long ll;
#define PB push_back

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0);
	string s; cin >> s;
	bool ok = true;
	for (unsigned int i = 0; i < s.size(); i++) {
		if (i & 1) {
			if (!(s[i] == 'L' || s[i] == 'U' || s[i] == 'D')) ok = false;
		} else {
			if (!(s[i] == 'R' || s[i] == 'U' || s[i] == 'D')) ok = false;
		}
	}
	if (ok) cout << "Yes";
	else cout << "No";
}


Measured memory_bytes: 256
#import math
n = int(input())
l = [0 for i in range(n)]
for x in range(1, 101):
    for y in range(1, 101):
        for z in range(1, 101):
            s = x**2 + y**2 + z**2 + x*y + y*z + z*x
            if s <= n:
                l[s-1] += 1
for i in range(n):
    print(l[i])


Measured memory_bytes: 9144
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scn = new Scanner(System.in);
        String line = scn.nextLine();
        String end;
        if(line.endsWith("s")) {
            end = "es";
        } else {
            end = "s";
        }
        System.out.println(line + end);
    }
}

Measured memory_bytes: 39156
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <numeric>

using namespace std;

using ll = long long;
using ull = unsigned long long;

const ll inf = 1ll << 60;
const ll mod = (ll)1e9 + 7;

#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

#define print(s) cout << s;
#define println(s) cout << s << endl;
#define printd(s, f) cout << fixed << setprecision(f) << s << endl;


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

	ll res = 0;
	
	for (int i = 1; i < n; i++)
	{
		set<string> a;
		for (int j = 0; j < i; j++)
		{
			a.insert(s.substr(j, 1));
		}

		ll cnt = 0;
		for (int j = i; j < n; j++)
		{
			if (a.count(s.substr(j, 1)))
			{
				cnt++;
				a.erase(s.substr(j, 1));
			}
		}

		res = max(res, cnt);
	}

	println(res);
}

Measured memory_bytes: 256
import numpy as np

A,B,K=list(map(int,input().split(" ")))
a=np.arange(A,min(A+K,B+1)) # 小さい方から
b=np.arange(max(A,B-K+1),B+1) # 大きい方から
ab=np.append(a,b) # かぶりをなくす

# 小さい順に出力
for u in np.sort(np.unique(ab)):
    print(u)

Measured memory_bytes: 12396
#include <iostream>
using namespace std;
long long dp[2][100005];
int v[101],w[101],W,n;
int main()
{
    scanf("%d%d",&n,&W);
    for(int i=0;i<n;++i)
      scanf("%d%d",w+i,v+i);
    for(int i=0;i<n;++i)
        for(int j=0;j<=W;++j)
        {
            dp[i&1][j]=dp[(i+1)&1][j];
            if(j>=w[i])
            dp[i&1][j]=max(dp[i&1][j],dp[(i+1)&1][j-w[i]]+v[i]);
        }
    printf("%lld",dp[(n-1)&1][W]);
    return 0;
}

Measured memory_bytes: 5272
import java.io.BufferedReader;
import java.io.InputStreamReader;

class Main{

	public static void main(String[] args) throws Exception {
       BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
       String[] input = br.readLine().split(" ");
       int n = Integer.parseInt(input[0]);
       int m = Integer.parseInt(input[1]);
       int[] a = new int[m];
       int[] b = new int[m];
       for(int i = 0;i < m;i++){
       	input = br.readLine().split(" ");
       	a[i] = Integer.parseInt(input[0]);
       	b[i] = Integer.parseInt(input[1]);
       }
       int[] count = new int[n];
       for(int i = 0;i < n;i++){
       		count[i] = 0;
       }
       for(int i = 0;i < m;i++){
       		count[a[i]-1] += 1;
       		count[b[i]-1] += 1;
       }
       for(int i = 0;i < n;i++){
       	System.out.println(count[i]);
       }
    }

}

Measured memory_bytes: 22228
#include <iostream>
#include <string>
using namespace std;
 
char data[100000];
char type[2]={'S','W'};
int main(){
 
  int N;
  string s;
  cin>>N;
  cin>>s;
 
  string ans;
  bool exit=false;
  
  for (int first=0;first<2&&!exit;first++)
    for (int second=0;second<2&&!exit;second++)
      {
	data[0]=type[first];
	data[1]=type[second];
	for (int i=1;i<N-1;i++){
	  if(data[i]=='S'){
	    if(s[i]=='o')data[i+1]=data[i-1];
	    else data[i+1]=(data[i-1]=='S')?'W':'S';
	  } else {
	    if(s[i]=='o')data[i+1]=(data[i-1]=='S')?'W':'S';
	    else data[i+1]=data[i-1];
	  }
	}
	bool flag1 = false, flag2 = false;
	if (data[N-1]=='S'){
	  if(s[N-1]=='o'&&(data[N-2]==data[0]))flag1=true;
	  else if(s[N-1]=='x'&&(data[N-2]!=data[0]))flag1=true;
	} else {
	  if(s[N-1]=='o'&&(data[N-2]!=data[0]))flag1=true;
	  else if(s[N-1]=='x'&&(data[N-2]==data[0]))flag1=true;
	}
	if (data[0]=='S'){
	  if(s[0]=='o'&&(data[N-1]==data[1]))flag2=true;
	  else if(s[0]=='x'&&(data[N-1]!=data[1]))flag2=true;
	} else {
	  if(s[0]=='o'&&(data[N-1]!=data[1]))flag2=true;
	  else if(s[0]=='x'&&(data[N-1]==data[1]))flag2=true;
	}
	if (flag1&&flag2)exit=true;
      }
  
  if (exit) {
    for (int i=0;i<N;i++)
      cout<<data[i];
    cout<<endl;
  } else
    cout<<"-1"<<endl;
  
  return 0;
}

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

const int MOD = (int)1e9+7;

int main(){
	int K,X;
	cin >> K >> X;

	for(int i=X-K+1;i<X+K-1;i++){
		cout << i << " ";
	}
	cout << X+K-1 << endl;

	return 0;
}


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

int main(){
    int a, b, k;
    cin >> a >> b >> k;

    int count = 0;
    for(int i=max(a, b); i>=1; i--){
        if(a % i == 0 && b % i == 0) count += 1;
        if(count == k){
            cout << i << endl;
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const int INF=1e9;

int main(){
    int n,m;
    cin>>n>>m;
    ll x[n],y[m];
    for(int i=0;i<n;i++)cin>>x[i];
    for(int i=0;i<m;i++)cin>>y[i];
    ll xans=0,yans=0;
    for(ll i=1;i<n;i++){
        xans+=(x[i]-x[i-1])*i*(n-i);
        xans%=MOD;
    }
    for(ll i=1;i<m;i++){
        yans+=(y[i]-y[i-1])*i*(m-i);
        yans%=MOD;
    }
    cout<<(xans*yans)%MOD<<endl;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define sz(x) (int)(x).size()
#define For(i, a, b) for (int i = int(a); i < int(b); i++)
#define Dor(i, a, b) for (int i = int(b) - 1; i >= int(a); i--)
#define Foz(i, a) For(i, 0, a)
#define Doz(i, a) Dor(i, 0, a)
#define Trav(e, v) for (auto& e : v)
#define pb push_back
#define mp make_pair
#define all(x) begin(x), end(x)
using namespace std;
using ll = long long;
using ii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vii = vector<ii>;
template <typename T> bool ckmin (T& a, T b) { return (b < a) ? a = b, 1 : 0; }
template <typename T> bool ckmax (T& a, T b) { return (b > a) ? a = b, 1 : 0; }
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#ifdef XVENOM
	#define errp(...) fprintf(stderr, __VA_ARGS__)
	#define dbg(...) errp("[%s]: ", #__VA_ARGS__), dbg_str(__VA_ARGS__)
#else
	#define errp(...)
	#define dbg(...)
#endif
template <typename U, typename V> string to_string (pair<U, V>);
string to_string (string& e) { return "\"" + e + "\""; }
string to_string (char e) { return "\'" + string(1, e) + "\'"; }
string to_string (bool e) { return e ? "true" : "false"; }
template <typename T> string to_string (T e) {
	string s = "[ ";
	for (auto& x : e) s += to_string(x) + " ";
	return s + "]";
}
template <typename U, typename V> string to_string (pair<U, V> e) {
	return "(" + to_string(e.first) + ", " + to_string(e.second) + ")";
}
void dbg_str () { errp(" \n"); }
template <typename U, typename... V> void dbg_str (U u, V... v) {
 	errp(" %s", to_string(u).c_str()); dbg_str(v...);
}
/* --- */
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	/* --- */
	int k, n;
	cin >> n >> k;
	vi h(n);
	Foz(i, n) cin >> h[i];
	sort(all(h));
	int ans = (int)1e9 + 1;
	For(i, k - 1, n) ckmin(ans, h[i] - h[i - k + 1]);
	cout << ans << '\n';
}



Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i = 0; i < n; i++)
#define rep2(i,x,n) for (int i = x; i < n; i++)
using ll = long long int;
int main() {
    int n; cin >> n;
    if(n%10 == 3) cout << "bon" << endl;
    else if (n%10 == 0 || n%10 == 1 || n%10 == 6 || n%10 == 8) cout << "pon" << endl;
    else cout << "hon" << endl; 
    return 0;
}

Measured memory_bytes: 3568
#include <iostream>
using namespace std;
int main() { 
  int a, b;
  while(cin >> a >> b) { 
    while(a!=b) {  
      if(a > b) a-=b;   
      else b-=a; 
    } 
   cout << a << endl; 
  } 
  return 0;
}


Measured memory_bytes: 1156
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double D;
typedef pair<int,int> P;
typedef tuple<ll,ll,ll> T;
#define M 1000000007
#define F first
#define S second
#define PB push_back
#define INF 1000000000
struct SEG{
	int sma[1<<19],smi[1<<19];
	SEG(void){
		for(int i=0;i<1<<19;i++)sma[i]=0,smi[i]=INF;
	}
	void up(int a,int x){
		a+=(1<<18)-1;
		sma[a]=x,smi[a]=x;
		while(a>0){
			a=(a-1)/2;
			sma[a]=max(sma[a*2+1],sma[a*2+2]);
			smi[a]=min(smi[a*2+1],smi[a*2+2]);
		}
	}
	int qma(int a,int b,int l,int r,int k){
		if(r<a||b<l)return 0;
		if(a<=l&&r<=b)return sma[k];
		return max(qma(a,b,l,(l+r-1)/2,k*2+1),qma(a,b,(l+r+1)/2,r,k*2+2));
	}
	int qmi(int a,int b,int l,int r,int k){
		if(r<a||b<l)return INF;
		if(a<=l&&r<=b)return smi[k];
		return min(qmi(a,b,l,(l+r-1)/2,k*2+1),qmi(a,b,(l+r+1)/2,r,k*2+2));
	}
};
int n,k,a[200005],g[200005],ans,cnt;
SEG seg;
int main(void){
    scanf("%d%d",&n,&k);
    for(int i=0;i<n;i++){
		scanf("%d",&a[i]);
	}
	for(int i=1;i<n;i++){
		g[i]=g[i-1];
		if(a[i]<a[i-1])g[i]++;
	}
	ans=n-k+1;
	for(int i=0;i<n;i++)seg.up(i,a[i]);
	for(int i=0;i+k-1<n;i++){
		if(g[i+k-1]==g[i])cnt++;
	}
	if(cnt>0)ans-=(cnt-1);
	for(int i=0;i+1+k-1<n;i++){
		if(g[i+k-1]==g[i]||g[i+1+k-1]==g[i+1])continue;
		if(a[i]<seg.qmi(i+1,i+k-1,0,(1<<18)-1,0)&&a[i+k]>seg.qma(i+1,i+k-1,0,(1<<18)-1,0))ans--;
	}
	printf("%d\n",ans);
}


Measured memory_bytes: 5888
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,P> PP;
const long long int MOD = 1000000007;
const int INF = 1000000000;

struct segtree{
    ll n, dat[2*(1<<17)-1]; //(1<<17) = 130000

    void init(ll n_){
        n = 1;
        while(n < n_) n *= 2;
        for(ll i = 0; i < 2*n-1; i++) dat[i] = 0;
    }

    void update(ll k, ll a){
        k += n-1;
        dat[k] = a;
        while(k > 0){
            k = (k-1)/2;
            dat[k] = max(dat[k*2+1], dat[k*2+2]);
        }
    }

    ll query(ll a, ll b, ll k, ll l, ll r){
        if(r <= a || b <= l) return 0;
        if(a <= l && r <= b) return dat[k];
        else{
            ll vl = query(a,b,k*2+1,l,(l+r)/2);
            ll vr = query(a,b,k*2+2,(l+r)/2,r);
            return max(vl, vr);
        }
    }
} seg;

ll n;

int main(){
    cin >> n;
    seg.init(n);
    ll ans = 0;
    ll sum = 0;
    rep(i,n){
        ll x;
        cin >> x;
        sum += x;
        x--;
        ll v = seg.query(0,x,0,0,seg.n)+x+1;
        ans = max(ans,v);
        seg.update(x,v);
    }
    cout << sum-ans << endl;
}

Measured memory_bytes: 5172
from collections import defaultdict,deque
def main():
    N = int(input())
    depth = [-1 for _ in range(N)]
    tree = defaultdict(list)
    for _ in range(N-1):
        a,b,c = map(int,input().split())
        a -= 1
        b -= 1
        tree[a] += [[b,c]]
        tree[b] += [[a,c]]
    Q,K = map(int,input().split())
    K -= 1
    stack = deque([K])
    depth[K] = 0
    while stack:
        v = stack.popleft()
        for e in tree[v]:
            u,c = e
            if u == K:
                continue
            if depth[u] == -1:
                stack.appendleft(u)
                depth[u] = depth[v] + c

    for _ in range(Q):
        x,y = map(int,input().split())
        x -= 1
        y -= 1
        ans = depth[x]+depth[y]
        print(ans)

if __name__ == "__main__":
    main()

Measured memory_bytes: 55252
x = gets
y = x.split(" ")
a = y[0].to_i
b = y[1].to_i
until a == 0 && b == 0
 sss = []
 for i in a..b do 
  if i % 4 == 0
   if i % 100 == 0
     if i % 400 == 0
      sss << i 
     end
   else
    sss << i 
   end
  end
 end
 if sss.length == 0
  puts "NA"
 else
  sss.each do |n|
   puts n
  end
 end
 
 x = gets
 y = x.split(" ")
 a = y[0].to_i
 b = y[1].to_i
 if a == 0 && b == 0
 else
  puts ""
 end
end


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

typedef double du ;
typedef string st ;
typedef long long ll ;
typedef long double ld ;
typedef long long int lli ;

#define vi vector <lli>
#define loop(num) for (lli i = 0 ; i < num ; i ++ )
#define loopcin(num , ar ) for (lli i = 0 ; i < num ; i ++ ) {cin >> ar [i] ;}
#define loopcout(num , ar) for (lli i = 0 ; i < num ; i ++ ) {cout << ar [i] << ' '; }

#define forr(num1 , num2) for (lli i = num1 ; i < num2 ; i ++ )
#define forrcin(num1 , num2 , ar ) for (lli i = num1 ; i < num2 ; i ++ ) {cin >> ar [i] ;}
#define forrcout(num1 , num2 , ar) for (lli i = num1 ; i < num2 ; i ++ ) {cout << ar [i] << ' '; }

#define D2forrcin(num1_1 , num1_2 , num2_1 , num2_2 , A ) for (lli i = num1_1 ; i < num1_2 ; i ++){ for (lli j = num2_1 ; j < num2_2 ; j++){cin >> A[i][j] ;}}
#define D2forrcout(num1_1 , num1_2 , num2_1 , num2_2 , A ) for (lli i = num1_1 ; i < num1_2 ; i ++){ for (lli j = num2_1 ; j < num2_2 ; j++){cout << A[i][j] << ' ' ;}cout << endl ;}

#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl

#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

int main ()
{
    fastio
    lli num1 , num2 ;
    cin >> num1 >> num2 ;
    cout << max ({num1 * num2 , num1 + num2 , num1 - num2}) ;

    return 0 ;
}

/*___________________________________________________________________functions___________________________________________________________________________*/



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
#define e_b emplace_back
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
using namespace std;
using ll = long long;
using ld = long double;
template<class T> bool chmax(T &a,T b){if(a<b){a=b;return true;}return false;}
template<class T> bool chmin(T &a,T b){if(a>b){a=b;return true;}return false;}

int D;
vector<vector<int>> s(366,vector<int>(26));
vector<int> c(26);
vector<int> last(26,0);
vector<int> t(366,-1);

int calc_down(int d){
  int ans=0;
  for(int i=0;i<26;i++){
    ans+=c.at(i)*(d-last.at(i));
  }
  return ans;
}

int calc(int d,int now){
  int ans=s.at(d).at(now);
  int tmp=last.at(now);
  last.at(now)=d;
  ans-=calc_down(d);
  last.at(now)=tmp;
  return ans;
}

int calc_change(int d,int q){
  int old=t.at(d);
  int ans=s.at(d).at(q)-s.at(d).at(old);

  int old_l=0;
  int old_r=D+1;
  for(int i=1;i<d;i++)  if(t.at(i)==old)  old_l=i;
  for(int i=D;i>d;i--)  if(t.at(i)==old)  old_r=i;
  int now_l=0;
  int now_r=D+1;
  for(int i=1;i<d;i++)  if(t.at(i)==q)  now_l=i;
  for(int i=D;i>d;i--)  if(t.at(i)==q)  now_r=i;
  //cout << "old  " << old_l << " " << old_r << endl;
  //cout << "now  " << now_l << " " << now_r << endl;
  ans+=c.at(q)*(d-now_l)*(now_r-d);
  ans-=c.at(old)*(d-old_l)*(old_r-d);
  return ans;
}

int main(){
  ios_base::sync_with_stdio(false);cin.tie(0);
  cin >> D;
  for(int i=0;i<26;i++) cin >> c.at(i);
  for(int i=1;i<D+1;i++){
    for(int j=0;j<26;j++) cin >> s.at(i).at(j);
  }

  int total_v=0;
  for(int i=1;i<D+1;i++){
    int tmp_ma=-1e9;
    int tmp_t=-1;
    for(int j=0;j<26;j++){
      int tmp=calc(i,j);
      if(tmp>tmp_ma){
        tmp_ma=tmp;
        tmp_t=j;
      }
    }
    t.at(i)=tmp_t;
    last.at(t.at(i))=i;
    total_v+=s.at(i).at(t.at(i));
    total_v-=calc_down(i);
  }
  //for(int i=1;i<D+1;i++)  cout << t.at(i)+1 << endl;
  //cout << total_v << endl;

  clock_t start=clock();
  while(1){
    clock_t end=clock();
    double time=(double)(end-start)/CLOCKS_PER_SEC;
    //cout << time << endl;
    if(time>1.9)  break;

    int d=rand()%D+1;
    int q=rand()%26;

    int tmp=calc_change(d,q);
    //cout << tmp << endl;
    if(tmp<=0)  continue;
    t.at(d)=q;
    total_v+=tmp;
    //cout << total_v << endl;
  }
  for(int i=1;i<D+1;i++)  cout << t.at(i)+1 << endl;

  return 0;
}


Measured memory_bytes: 3640
#include<iostream>
using namespace std;
int main()
{
	int n,a,b;
	cin>>n;
	if(n == 1)
	{
		cout<<"Hello World"<<endl;
		return 0;
	}
	
	else if(n == 2)
	{
		cin>>a>>b;
		cout<<a+b<<endl;
	}
	return 0;
}


Measured memory_bytes: 256
def main
  while rows = gets.chomp.to_i and rows != 0
    matrix = []
    (1..rows).each do |row|
      nums = gets.chomp.split(/\s/).collect { |x| x.to_i}
      matrix << nums
    end
    solve(matrix, rows)
  end
end


def solve(matrix, n)
  matrix.each do |row|
    sum = row.inject(0) { |s, e| s + e}
    row << sum
  end
  sums = []
  (0..n).each do |col|
    tmp = 0
    (0..n-1).each do |row|
      tmp += matrix[row][col]
    end 
    sums << tmp
  end
  matrix << sums

  matrix.each do |row|
    puts row.collect { |x| ("%5d" % x).to_s }.join("")
  end
end

main

Measured memory_bytes: 6128
#include<bits/stdc++.h>
using namespace std;
int main() {
  string s; cin >> s;
  vector<int> rl;
  int r = 0;
  char c = s[0];
  for (char b : s) {
    if (c != b) {
      rl.push_back(r);
      c = b;
      r = 1;
    } else {
      r++;
    }
  }
  rl.push_back(r);
  vector<int> imos(rl.size()+1, 0);
  int k = s.size();
  for (size_t i = 0; i < rl.size(); i++) {
    imos[i+1] = imos[i] + rl[i];
    if (i != rl.size()-1) {
      int kc = max(imos[i+1], (int)s.size() - imos[i+1]);
      k = min(k, kc);
    }
  }
  cout << k << '\n';
}


Measured memory_bytes: 892
//Author:- Yatin Patel
//Mail:- yatinpatel.gt@gmail.com

#include <bits/stdc++.h>
#define FILEIN ifstream fin;fin.open("input.txt");
#define FILEOUT ofstream fout;fout.open("output.txt");

using namespace std;

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << endl;
    err(++it, args...);
}

#define FAST ios::sync_with_stdio(false);ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

#define ll long long
#define ld long double
#define pb push_back
#define ff first
#define ss second

#define precision(x,d) cout<<fixed<<setprecision(d)<<x
#define minQueue priority_queue<ll,vector<ll>,greater<ll> >
#define maxQueue priority_queue<ll,vector<ll>,less<ll> > 

#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define RFOR(i,a,b) for(ll i=a;i>b;i--)
#define FILL(a,b) memset((a),(b),sizeof((a)))

#define MOD 1000000007
#define INF LONG_MAX
#define MINF LONG_MIN

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

ll power(ll x, unsigned ll y){
    if (y == 0)
        return 1;
    else if (y%2 == 0)
        return power(x, y/2)*power(x, y/2);
    else
        return x*power(x, y/2)*power(x, y/2);
}

//#define fin cin
//#define fout cout

int main(){

    FAST;
    ll n;
    cin>>n;
    ll ans;
    for(ll i=0;i<n;i++){
        ll tmp;
        cin>>tmp;
        if(i==0){
            ans = tmp;
        }
        else{
            ans = __gcd(ans,tmp);
        }
    }    
    cout<<ans;
    return 0;
}






Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	char s[10]={};
	cin>>s;
	if(s[0]=='S'){
		cout<<"Cloudy"<<endl;
	}else if(s[0]=='C'){
		cout<<"Rainy"<<endl;
	}else if(s[0]=='R'){
		cout<<"Sunny"<<endl;
	}
}

Measured memory_bytes: 3568