akhauriyash/Code-Regression huggingface dataset:
from __future__ import print_function
from sys import stdin
class Node:
    def __init__(self, id):
        self.id = id
        self.left = None
        self.right = None
        self.parent = None

def preorder_tree_walk(root):
    print('', root.id, end='')
    if root.left != None:
        preorder_tree_walk(root.left)
    if root.right != None:
        preorder_tree_walk(root.right)

def inorder_tree_walk(root):
    if root.left != None:
        inorder_tree_walk(root.left)
    print('', root.id, end='')
    if root.right != None:
        inorder_tree_walk(root.right)

def insert(root, z):
    y = None
    x = root
    while isinstance(x, Node):
        y = x
        if z.id < x.id:
            x = x.left
        else:
            x = x.right
    z.parent = y

    if y == None:
        root = z
    elif z.id < y.id:
        y.left = z
    else:
        y.right = z
    return root

def find(root, x):
    while root != None and x != root.id:
        if x < root.id:
            root = root.left
        else:
            root = root.right
    return root

def delete(root, z):
    # detect delete node y.
    if  z.left == None or z.right == None:
        y = z
    else:
        y = get_successor(z)

    # detect y's child x
    if y.left != None:
        x = y.left
    else:
        x = y.right

    if x != None:
        x.parent = y.parent

    if y.parent == None:
        root = x
    elif y == y.parent.left:
        y.parent.left = x
    else:
        y.parent.right = x

    if y != z:
        z.id = y.id


def get_successor(x):
    if x.right != None:
        return get_minimum(x.right)

    y = x.parent
    while y != None and x == y.right:
        x = y
        y = y.parent
    return y

def get_minimum(x):
    while x.left != None:
        x = x.left
    return x


n = int(raw_input())
root = None
for i in xrange(n):
    cmd = stdin.readline()
    if cmd.startswith('i'):
        num = int(cmd[7:])
        root = insert(root, Node(num))
    elif cmd.startswith('p'):
        inorder_tree_walk(root)
        print()
        preorder_tree_walk(root)
        print()
    elif cmd.startswith('d'):
        num = int(cmd[7:])
        node = find(root, num)
        if node != None:
            delete(root, node)
    else:
        # find
        num = int(cmd[5:])
        if find(root, num) != None:
            print('yes')
        else:
            print('no')
    

Measured memory_bytes: 158856
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#define INF         1e9
#define EPS         1e-9
#define REP(i,n)    for(lint i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n)   for(lint i=1,i##_len=(n);i<=i##_len;++i)
#define REPR(i,n)   for(lint i=(n)-1;i>=0;--i)
#define REPR1(i,n)  for(lint i=(n);i>0;--i)
#define REPC(i,obj) for(auto i:obj)
#define R_UP(a,b)   (((a)+(b)-1)/(b))
#define ALL(obj)    (obj).begin(),(obj).end()
#define SETP        cout << fixed << setprecision(8)
using namespace std;
using lint = long long;
template<typename T = lint>inline T in() { T x; cin >> x; return x; }

void sieve(int sup, vector<int>&result) {
	vector<bool>is_prime(sup - 1, true);
	REP(i, (int)sqrt(sup) - 1) {
		if (is_prime[i]) {
			int p = i + 2;
			for (int j = p * p; j <= sup; j += p) is_prime[j - 2] = false;
		}
	}
	REP(i, sup - 1) if (is_prime[i])result.push_back(i + 2);
}
signed main() {
	int n = in();
	int n_org = n;
	vector<int>primes;
	sieve(sqrt(n), primes);
	vector<int>prime_fuctors;
	REPC(i, primes) {
		if (n % i == 0) {
			prime_fuctors.push_back(i);
			while (n % i == 0)n /= i;
		}
	}
	if (n != 1)prime_fuctors.push_back(n);
	unsigned long long nume = 1, denom = 1;
	REPC(i, prime_fuctors) {
		nume *= i;
		denom *= i - 1;
	}
	denom *= n_org;
	cout << denom / nume << endl;
}


Measured memory_bytes: 3184
package main

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

var (
	readString func() string
	stdout     *bufio.Writer
)

func init() {
	readString = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = readInt()
	}
	return b
}

func readLengthAndSlice() []int {
	n := readInt()
	return readIntSlice(n)
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdout, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdout, args...)
}

func vi(n int, args ...int) []int {
	res := make([]int, n)
	if len(args) == 0 {
		return res
	}
	v := args[0]
	if v == 0 {
		return res
	}
	for i := 0; i < n; i++ {
		res[i] = v
	}
	return res
}

func vvi(n int, args ...int) [][]int {
	res := make([][]int, n)
	m := n
	if len(args) > 0 {
		m = args[0]
	}
	v := 0
	if len(args) > 1 {
		v = args[1]
	}
	for i := 0; i < n; i++ {
		res[i] = vi(m, v)
	}
	return res
}

// readString() string
// readInt() int
// readIntSlice(n int) []int
// readLengthAndSlice() []int
func main() {
	defer stdout.Flush()
	a := readInt()
	b := readInt()

	if a*b%2 == 0 {
		println("Even")
	} else {
		println("Odd")
	}

}


Measured memory_bytes: 640
from bisect import bisect_left
N = int(input())
L = list(map(int, input().split()))
L.sort()
ans = 0
for i in range(N-2):
    for j in range(i+1, N-1):
        ans += bisect_left(L, L[i]+L[j]) - 1 - j
print(ans)


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

#define PI acos(-1)
#define pb push_back
#define int long long int
#define mp make_pair
#define pi pair<int, int>
#define pii pair<pi, int>
#define fir first
#define sec second
#define MAXN 10000
#define MAXL 100
#define mod 1000000007

signed main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, ans = 1000;
  cin >> n;
  vector<int> v(n);
  for (int i = 0; i < n; i++)
    cin >> v[i];
  for (int i = 1; i < n; i++)
  {
    int at = ans / v[i - 1];
    int ans2 = ans - (at * v[i - 1]);
    ans2 = ans2 + (at * v[i]);
    ans = max(ans, ans2);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3556
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <algorithm>
#include <string>
#include <sstream>
 
#define INPUT_FROM_FILE (0) 
#if INPUT_FROM_FILE
#include <fstream>
#endif

int main(int argc, char **argv){
	int n;
	std::string buf;

#if INPUT_FROM_FILE
	std::ifstream ifs("test.txt");
	//FILE *fp = fopen("test.txt", "r");
#endif


#if INPUT_FROM_FILE
	while(std::getline(ifs, buf)){
#else
	while(std::getline(std::cin, buf)){
#endif
		n = std::stoi(buf);
		if(n == 0){ break; }
		std::vector<std::string> image;
		std::vector<std::vector<int> > dp(n, std::vector<int>(n, 0));
		int result = 0;


		for(int i = 0; i < n; i++){
#if INPUT_FROM_FILE
			std::getline(ifs, buf);
#else
			std::getline(std::cin, buf);
#endif
			image.push_back(buf);
		}

		for(int y = 0; y < n; y++){
			for(int x = 0; x < n; x++){
				if(image[y][x] == '*'){
					dp[y][x] = 0;
				}
				else if(y > 0 && x > 0){
					dp[y][x] = std::min({ dp[y - 1][x], dp[y][x - 1], dp[y - 1][x - 1] }) + 1;
				}
				else{
					dp[y][x] = 1;
				}
				result = std::max(result, dp[y][x]);
			}
		}
		std::cout << result << std::endl;
	}

#if INPUT_FROM_FILE
	//fclose(fp);
#endif
	return 0;
}


Measured memory_bytes: 7864
import math

A, B = map(int, input().split())
A_min = math.ceil(A/0.08)
A_upper = (A+1)/0.08
if (math.floor(A_upper) == A_upper) and (math.ceil(A_upper) == A_upper):
    A_max = math.floor(A_upper-1)
else:
    A_max = math.floor(A_upper)
    
B_min = math.ceil(B/0.1)
B_upper = (B+1)/0.1
if (math.floor(B_upper) == B_upper) and (math.ceil(B_upper) == B_upper):
    B_max = math.floor(B_upper-1)
else:
    B_max = math.floor(B_upper)

if (A_max < B_min) or (B_max < A_min):
    print(-1)
else:
    print(max(A_min, B_min))

Measured memory_bytes: 3064
#include <iostream>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <string.h>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <time.h>
#define int long long
#define ll long long
#define us unsigned
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = (n)-1; i >= 0; ++i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define nin(ary, n) for (int i = 0; i < (n); i++) cin >> ary[i]
#define nnin(ary, h, w) for (int i = 0; i < (h); ++i) for (int j = 0; j < (w); ++j) cin >> ary[i][j]
#define opt(conditions, a, b) cout << ((conditions) ? #a : #b) << endl
using namespace std;
const double PI = acos(-1.0);
const int MOD = 1e9 + 9;

int max_n(int ary[], int length) {
	int max = ary[0];
	for (int i = 1; i < length; i++)
		if (max < ary[i]) max = ary[i];
	return max;
}

int max_o(int ary[], int length) {
	int max;
	max = max_n(ary, length);
	for (int i = 0; i < length; i++) {
		if (ary[i] == max) return i;
	}
	return -1;
}

int min_n(int ary[], int length) {
	int min = ary[0];
	for (int i = 1; i < length; i++)
		if (min > ary[i]) min = ary[i];
	return min;
}

int min_o(int ary[], int length) {
	int min;
	min = min_n(ary, length);
	for (int i = 0; i < length; i++) {
		if (ary[i] == min) return i;
	}
	return -1;
}

int gcm(int a, int b) {
	int result = a;
	int k = 0;
	int n = b;
	do {
		k = result % n;
		result = n;
		n = k;
	} while (k != 0);
	return result;
}

int gcm_n(int ary[], int length) {
	int g = ary[0];
	for (int i = 0; i < length; i++)
		g = gcm(g, ary[i]);
	return g;
}

int lcm(int a, int b) {
	int g, n;
	g = gcm(a, b);
	n = gcm(a, g);
	a = a / n;
	b = b / (g / n);
	return a*b;
}

int lcm_n(int ary[], int length) {
	int l = ary[0];
	for (int i = 0; i < length; i++)
		l = lcm(l, ary[i]);
	return l;
}



int n, a[200000], ans, s, g;

signed main() {
	
	
	cin >> n;
	nin(a, n);

	sort(a, a + n);
	for (;;) {
		while (a[g] == a[g + 1] && g < n-1)
			g++;
		if ((g - s + 1) % 2 != 0) {
			ans++;
		}
		if (g < n-1) {
			g++;
			s = g;
		}
		else
			break;
	}

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

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

#define hell                         1000000007
#define lcm(a,b)                     (a*b)/__gcd(a,b)
#define ll                           long long
#define vll                          vector<ll>
#define vi                           vector<int>
#define pll                          vector< pair<ll,ll> >
#define pb                           push_back
#define mp                           make_pair
#define all(v)                       v.begin(),v.end()
#define lbnd                         lower_bound
#define ubnd                         upper_bound
#define bs                           binary_search
#define F                            first
#define S                            second
#define rep(i,a,b)                   for(i=a;i<b;i++)
#define parr(a,n)                    for(ll it=0;it<n;it++) cout<<a[it]<<" ";cout<<endl;
#define pcont(a)                     for(auto it:a) cout<<it<<" ";cout<<endl;
#define ret(x)                       return cout<<x,0;
#define endl                           '\n'

/*constants*/
#define MAXN                         100005
#define PI                           3.14159265358979323846

/*debug*/
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>void __f(const char* name, Arg1&& arg1){ std::cout << name << " : " << arg1 << '\n';}
    template <typename Arg1, typename... Args>void __f(const char* names, Arg1&& arg1, Args&&... args){const char* comma = strchr(names + 1, ','); std::cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);}
#else
#define trace(...)
#endif

using namespace std;


int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
	
	ll i,j,n,m,k,cnt=0,ans=0,t=1;
	cin>>i>>j>>k;
	if(i==j && j==k) ret("Yes")
	ret("No")	
	
	return 0;
}

Measured memory_bytes: 384
#include"bits/stdc++.h"

using namespace std;

long long N,ans;

void dfs(long long a, int f) {
	if (a > N) {
		return;
	}
	if (f == 7) {
		ans++;
	}
	a *= 10;
	dfs(a + 3, f | 1);
	dfs(a + 5, f | 2);
	dfs(a + 7, f | 4);
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> N;
	dfs(0, 0);
	cout << ans << endl;
	return 0;
}

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

using namespace std;

int main(){
    int n,m, x,y,suma = 0;
    vector<int> a;
    cin >> n;   
    for(int i = 0; i < n; i++){
        cin >> x;
        a.push_back(x);
        suma += x;
    }
    cin >> m;
    for(int i = 0; i < m; i++){
        cin >> x >> y;
        cout << suma - (a[x-1] - y) << endl;
    }

        
    return 0;
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
typedef long long LL;
int N;
int x,y;
int A[100001];
int B[100001];
vector<int>v[100001];
int a[100001];
int b[100001];
bool check[100001];
void dfs(int x,int p, int d){
	a[x]=d;
	REP(i,v[x].size()){
		if(v[x][i]!=p){
			dfs(v[x][i], x, d+1);
		}
	}
	if(v[x].size()==1){
		check[x]=false;
	}else{
		check[x]=true;
	}
}

void dfs2(int x, int p, int d){
	b[x]=d;
	REP(i,v[x].size()){
		if(v[x][i]!=p){
			dfs2(v[x][i], x, d+1);
		}
	}
}

int main(){
	cin>>N;
	cin>>x>>y;
	REP(i,N-1){
		cin>>A[i]>>B[i];
		A[i]--;
		B[i]--;
		v[B[i]].push_back(A[i]);
		v[A[i]].push_back(B[i]);
	}
	dfs(x-1,-1,0);
	dfs2(y-1,-1,0);
	int ans=0;
	REP(i,N){
		//cout<<a[i]<<" "<<b[i]<<endl;
		if(check[i]==true){
			if(a[i]==b[i]){
				//cout<<i<<" 11"<<endl<<endl;
				ans=max(ans,a[i]);
			}else if(a[i]>b[i]){
				//cout<<i<<" 12"<<endl<<endl;
				ans=max(ans,0);
			}else{
				//cout<<i<<" 13"<<endl<<endl;
				ans=max(ans,b[i]);
			}
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 12672
def minimize(H, W):
    ans = float('inf')
    for h in range(1, H):
        sa = h * W
        sb = (H - h) * (W // 2)
        sc = (H - h) * (W - W // 2)
        smax = max(sa, sb, sc)
        smin = min(sa, sb, sc)
        ans = min(ans, smax - smin)

        sb = W * ((H - h) // 2)
        sc = W * (H - h - (H - h) // 2)
        smax = max(sa, sb, sc)
        smin = min(sa, sb, sc)
        ans = min(ans, smax - smin)
    return ans

H, W = tuple(map(int, input().split()))
ans1 = minimize(H, W)
ans2 = minimize(W, H)
print(min(ans1, ans2))

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

#define ll long long
#define all(a) a.begin(),a.end()
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define Rep(i,n,m) for(int i=(int)(n);i<(int)(m);i++)

//library----------------------------------------------


int main(){
  int D; cin>>D;
  if(D==22){
    printf("Christmas Eve Eve Eve\n");
  }
  else if(D==23){
    printf("Christmas Eve Eve");
  }
  else if(D==24){
    printf("Christmas Eve");
  }
  else{
    printf("Christmas");
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N=505;
int n;
int ans[N*N];
struct number{int x,id;}num[N];

inline bool cmp(number a,number b){return a.x<b.x;}

int main(){
	scanf("%d",&n);
	for (register int i=1; i<=n; ++i) scanf("%d",&num[i].x),num[i].id=i;
	sort(num+1,num+n+1,cmp);
	
	int now=1;
	for (register int i=1; i<=n; ++i)
	{
		ans[num[i].x]=num[i].id;
		for (register int j=1; j<num[i].id; ++j)
		{
			while (ans[now]) 
			{
				if (now==num[i].x)
				{
					puts("No");
					return 0;	
				}
				now++;
			}
			ans[now]=num[i].id;
		}
	}
	now=n*n;
	for (register int i=n; i>=1; --i)
	{
		for (register int j=n; j>num[i].id; --j)
		{
			while (ans[now])
			{
				if (now==num[i].x)
				{
					puts("No");
					return 0;
				}
				now--;	
			}
			ans[now]=num[i].id;
		}
	}
	
	puts("Yes");
	for (register int i=1; i<=n*n; ++i) printf("%d ",ans[i]); 
return 0;
}

Measured memory_bytes: 2176
#include <stdio.h>

int main(void){
	int in, max = 0, count = 0;
	int n;
	scanf("%d", &n);
	for(int i = 0; i < n; i++){
		scanf("%d", &in);
		if(max <= in){
			max = in;
			count++;
		}
	}
	printf("%d\n", count);
	return 0;
}


Measured memory_bytes: 128
#include "bits/stdc++.h"

using namespace std;
#define rep(i, n) for (int64_t i = 0; i < n; i++)

const double PI = 3.14159265358979323846;

int main()
{
	string str;
	cin >> str;
	if (str == "ABC")
	{
		puts("ARC");
	}
	else
	{
		puts("ABC");
	}
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> pii;
typedef long long int lld;
const int MAX=30;
char s[MAX],d[MAX];
int p[MAX],n,fin;
void f(int x){
    int u=s[x]-'a';
    //printf("%d %d\n",x,u);
    if(p[u]) fin=1;
    for(;p[u];u++);
    if(u==26) {
        d[x]=0;
        f(x-1);
    }
    else{
        d[x]=u+'a';
        p[u]++;
    }
}
void asc(int x){
    int u=d[x]-'a';
    p[u]--;
    u++;
    for(;p[u];u++);
    if(u==26) {
        d[x]=0;
        asc(x-1);
    }
    else{
        d[x]=u+'a';
        p[u]++;
    }
}
int main(){
    scanf(" %s",s);
    n=strlen(s);
    int r=0;
    for(int i=0;i<n;i++) {
        if(s[i]<'z'-i) break;
        else if(s[i]>'z'-i){
            printf("-1\n");
            return 0;
        }
        else r++;
    }
    if(r==26){
        printf("-1\n");
        return 0;
    }
    for(int i=0;i<n;i++) if(!fin) f(i);
    if(!fin){
        for(int i=0;i<26;i++) {
            if(p[i]==0) {
                d[n]=i+'a';
                break;
            }
        }
        if(d[n]==0){
            asc(n-1);
        }
    }
    printf("%s\n",d);
}


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

int main() {
  int n;
  string s;
  cin >> n;
  cin >> s;
  int countl = 0;
  int countr = 0;
  stack<char> left;
  stack<char> right;
  for (auto i : s) {
    if (i==')') {
      if (left.size()==0) countl++;
      else left.pop();
    } else left.push(i);
  }
  
  for (int i=n-1; i>=0; i--) {
    if (s[i]=='(') {
      if (right.size()==0) countr++;
      else right.pop();
    } else right.push(s[i]);
  }
  string l(countl, '(');
  string r(countr, ')');
  cout << l << s << r;
  return 0;
}

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

int main() {
  int N;
  cin >> N;
  vector<int> d(N);
  for(int i = 0; i < N; i++) {
    cin >> d.at(i);
  }
  sort(d.begin(), d.end());
  int n = 1;
  for(int i = 0; i < N - 1; i++) {
    if(d.at(i) != d.at(i + 1)) {
      n++;
    }
  }
  cout << n << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int K = scan.nextInt();
		int nk=N%K;
		
		if(nk==0) {
			System.out.print(0);
		}else {
			System.out.print(1);
		}
		
	}
}

Measured memory_bytes: 22100
#include <iostream>

using namespace std;

int main(){
    int N;
    cin >> N;
    int H[N];
    for (int i = 0; i < N; ++i){
        cin >> H[i];
    }
    int count,ans;
    ans = -1;
    int j;
    for(int i = 0; i < N; i++){
        count = 0;
        j = i;
        while(H[j] >= H[j+1] && j < N-1){
            count += 1;
            j += 1;
        }
        if(count >= ans) ans = count;
        if(ans > N-i)break;
        
    }
    cout << ans << endl;
}

Measured memory_bytes: 640
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
 
void call(int n)
{
    int i = 1;
    int x;
 
    do {
        x = i;
        if (x % 3 == 0) {
            printf(" %d", i);
        }
        else {
            do {
                if (x % 10 == 3) {
                    printf(" %d", i);
                    x = 0;
                }
                else x /= 10;
            } while (x);
        }
    } while (++i <= n);
    putchar('\n');
}
 
#if 1
int main()
{
    int n;
 
    scanf("%d", &n);
    call(n);
    return 0;
}
#endif


Measured memory_bytes: 2760
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
//定数
#define INF 9000000000000000000 //9e18:極めて大きい値
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
#define LOGMAXR 18 // floor(log2(10^5)) + 1: 配列の最大のrangeのlog
//略記
//#define PB push_back //vectorヘの挿入
//#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素

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

int main(){
  ll K;
  cin >> K;
  map<ll, ll> ab;
  ll ret = 0;
  FOR(i, 1, K){
    FOR(j, 1, K){
      ll gab = gcd(i, j);
      if(ab.count(gab)){
	ab[gab] += 1;
      }else{
	ab[gab] = 1;
      }
    }
  }
  for(auto& p : ab){
    auto& ij = p.F;
    auto& cnt = p.S;
    //cout << ij << " " << cnt << endl;
    FOR(k, 1, K){
      ret += gcd(ij, k) * cnt;
    }
  }
  cout << ret << endl;
  return 0;
}


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

int main(){
    int A, B, C, D;
    cin >> A >> B >> C >> D;
    int turn_t = C / B;
    if (C % B != 0) turn_t ++;
    int turn_a = A/ D;
    if (A % D != 0) turn_a ++;
    if (turn_t <= turn_a) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3612
#include<stdio.h>
 
int main(){
  int a,b,c,d,e,f;
  float x,y;
  while(scanf("%d %d %d %d %d %d",&a,&b,&c,&d,&e,&f)!=-1){
    x = (float)(c*e-b*f)/(a*e-d*b);
    y = (float)(c*d-a*f)/(b*d-a*e);
    if(-0.0005<x && x<=0)
      x=0;
    if(-0.0005<y && y<=0)
      y=0;
    printf("%.3f %.3f\n",x,y);
  }
  return 0;
}
  

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

int main() {
	int a=0;
	double x = 0;
	long double ans = 0;
	cin >> a;
	while (a--) {
		double b = 0;
		string c;
		cin >> b >> c;
		if (c=="JPY") {
			
			ans += b;
		}
		else {
			 b *= 380000;
			ans += b;
		}
	}
	std::cout << ans << std::endl;
}

Measured memory_bytes: 256
import math

while True:
    n = int(input())
    if n == 0:
        break
    else:
        s = list(map(int, input().split()))
        m = sum(s) / n
        tmp = 0
        for i in range(n):
            tmp += (s[i] - m)**2
        a = math.sqrt(tmp/n)
        print('{:.5f}'.format(a))


Measured memory_bytes: 5704
#include<bits/stdc++.h>
int MOD = 1000000007;
using namespace std;
//g++ -std=c++14
//setprecision(10)
int main(){
	string s;
	cin >> s;
	for(int i = 0; i < s.size(); i++)
		if(s[i] == '9'){
			cout << "Yes" << endl;
			return 0;
		}
	cout << "No" << endl;
}

Measured memory_bytes: 256
fn main() {
  let n: usize = read();
  let ps: Vec<usize> = read_vec();
  
  let mut seqa: Vec<usize> = vec![];
  let mut seqb: Vec<usize> = vec![];
  let step = 30000;
  
  for d in 0 .. n {
    seqa.push(step * d + ps.iter().position(|&p|p==d+1).unwrap() + 1);
    seqb.push(step * (n - d));
  }
  
  print_vec(&seqa, " ");
  print_vec(&seqb, " ");
}

fn print_vec<T: std::string::ToString>(vec: &Vec<T>, sep: &str) {
  let out = vec.iter().map(|e| e.to_string()).collect::<Vec<_>>().as_slice().join(sep);
  println!("{}", out);
}

fn read<T: std::str::FromStr>() -> T {
  let mut buf = String::new();
  std::io::stdin().read_line(&mut buf).ok();
  buf.trim().parse::<T>().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
  let mut buf = String::new();
  std::io::stdin().read_line(&mut buf).ok();
  buf.trim().split_whitespace().map(|t| t.parse::<T>().ok().unwrap()).collect()
}


Measured memory_bytes: 6780
#include <iostream>

using namespace std;

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

  int ans = 0;
  for (int i = 0; i < 3; ++i) {
    ans += S % 10 != 0;
    S /= 10;
  }

  cout << ans << endl;

  return 0;
}


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

#define ld long double
#define sf scanf
#define pf printf
#define pb push_back
#define mp make_pair
#define PI ( acos(-1.0) )
#define IN freopen("input.txt","r",stdin)
#define OUT freopen("output.txt","w",stdout)
#define FOR(i,a,b) for(int i=a ; i<=b ; i++)
#define FORD(i,a,b) for(int i=a ; i>=b ; i--)
#define INF 1000000000
#define ll long long int
#define eps (1e-8)
#define sq(x) ( (x)*(x) )
#define all(x) x.begin(),x.end()
#define flog2(n) 64 - __builtin_clzll(n) - 1
#define popcnt(n) __builtin_popcountll(n)

using namespace std;

typedef pair < int, int > pii;
typedef pair < ll, ll > pll;

int a[105];
bool win[100005];

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(NULL);
    int n, k;
    
	cin >> n >> k;
	FOR (i, 1, n) cin >> a[i];

	win[0] = 0;

	FOR (i, 1, k) {
		win[i] = 0;
		FOR (j, 1, n) {
			if (a[j] <= i)	win[i] |= (!win[i - a[j]]);
		}
	}

	if (win[k]) {
		cout << "First" << endl;
	}
	else {
		cout << "Second" << endl;
	}
    
	
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
typedef long long int lli;
using namespace std;
#pragma region DEBUG
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
#pragma endregion DEBUG
#define MOD 1000000007
#define MAX 500005
#define endl "\n"
lli arr[MAX];
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);    
    lli t;
    t = 1;
    while(t--){
        lli n;
        cin>>n;
        if(n >= 30){
            cout<<"Yes"<<endl;
        }
        else{
            cout<<"No"<<endl;
        }
        
    }
}

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

int main() {
  int N;
  int i,j;
  cin>>N;
  vector<int> a(N);
  for(i=0;i<N;i++)cin>>a[i];
  bitset<32> ans;
  for(i=1;i<N;i++)ans^=a[i];
  cout<<ans.to_ullong()<<" ";
  for(i=1;i<N;i++){
    ans^=a[i];
    ans^=a[i-1];
    cout<<ans.to_ullong()<<" ";
  }
  cout<<endl;
}


Measured memory_bytes: 4048
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstring>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;
#define fst first
#define snd second

/* clang-format off */
template <class T, size_t D> struct _vec { using type = vector<typename _vec<T, D - 1>::type>; };
template <class T> struct _vec<T, 0> { using type = T; };
template <class T, size_t D> using vec = typename _vec<T, D>::type;
template <class T> vector<T> make_v(size_t size, const T& init) { return vector<T>(size, init); }
template <class... Ts> auto make_v(size_t size, Ts... rest) { return vector<decltype(make_v(rest...))>(size, make_v(rest...)); }
template <class T> inline void chmin(T &a, const T& b) { if (b < a) a = b; }
template <class T> inline void chmax(T &a, const T& b) { if (b > a) a = b; }
/* clang-format on */

using pii = pair<int, int>;

int main() {
#ifdef DEBUG
  ifstream ifs("in.txt");
  cin.rdbuf(ifs.rdbuf());
#endif
  int N;
  while (cin >> N) {
    map<pii, int> mp;
    for (int i = 1; i <= N; i++) {
      vector<int> dig;
      for (int j = i; j > 0; j /= 10) {
        dig.push_back(j % 10);
      }
      int a = dig.front();
      int b = dig.back();
      ++mp[make_pair(a, b)];
    }
    ll res = 0;
    for (auto& entry : mp) {
      auto p = entry.fst;
      ll cnt = entry.snd;
      auto q = make_pair(p.snd, p.fst);
      res += cnt * mp[q];
    }
    cout << res << endl;
  }
  return 0;
}


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

int main() {
  int N, K, dir;
  cin >> N >> K;
  for (int i = 0; i < N; i++) {
    int x;
  	cin >> x;
    if (x > K / 2)
      dir += (K - x) * 2;
    else
      dir += x * 2;
  }
  cout << dir << endl;
}

Measured memory_bytes: 256
// Problem : D - Sum of Large Numbers
// Contest : AtCoder - AtCoder Beginner Contest 163
// URL : https://atcoder.jp/contests/abc163/tasks/abc163_d
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)


#include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define modulo 1000000007

int main() 
{
	fastio;
	int n , k;
    int ans = 0;
	cin>>n>>k;
	int v[n+1];
	
	for(int i=0;i<=n;i++)
		v[i]=i;

	long long left[n+1]={0}, right[n+1]={0};
	
	
	for(int i=0;i<=n;i++)
	{
		if(i==0)
			left[i]=v[i];
		else 
			left[i]=left[i-1]+v[i];
	}
	
	for(int i=n;i>=0;i--)
	{
		if(i==n)
			right[i]=v[i];
		else 
			right[i]=right[i+1]+v[i];
	}
	
	int l=k-1;
	int r=n-k+1;
	
	while(l<=n && r>=0)
	{
		ans+=(right[r]-left[l]+1)%modulo;
		ans=ans%modulo;
		l++;
		r--;
	}
	
	cout<<ans<<"\n";
	return 0;
}

Measured memory_bytes: 7516
import java.util.Scanner;

public class Main {

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

        String S = sc.next();

        boolean ans = solve(S);
        System.out.println(ans? "AC" : "WA");
    }

    private static boolean solve(String S) {
        if (!S.startsWith("A")) return false;

        int idx = -1;
        for (int i=2; i<S.length()-1; i++) {
            if (S.charAt(i) == 'C') {
                if (idx != -1) return false;

                idx = i;
            }
        }
        if (idx == -1) return false;

        String conv = S.toLowerCase();
        char[] charS = conv.toCharArray();
        charS[0] = 'A';
        charS[idx] = 'C';
        conv = String.valueOf(charS);

        if (!conv.equals(S)) return false;

        return true;
    }

}


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

const int N = 20, INF = 1e9;
int odd[N], even[N];

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

    int n;
    cin>>n;

    for (int i=0; i<n; i++) cin>>even[i];
    for (int i=0; i<n; i++) cin>>odd[i];
    for (int i=1; i<n; i+=2)    swap(even[i], odd[i]);

    vector<int> perm;
    for (int i=0; i<(n+1)/2; i++)   perm.push_back(0);
    for (int i=0; i<n/2; i++)       perm.push_back(1);

    int ans = INF;
    do {
        vector<int> odds, evens;
        for (int i=0; i<n; i++) {
            if (perm[i])    odds.push_back(i);
            else            evens.push_back(i);
        }

        sort(odds.begin(), odds.end(),
             [](int x, int y) {return make_pair(odd[x], x) < make_pair(odd[y], y);}
            );
        sort(evens.begin(), evens.end(),
             [](int x, int y) {return make_pair(even[x], x) < make_pair(even[y], y);}
            );

        vector<int> tar, pp;
        for (int i=0; i<n; i++) {
            if (i%2==0) tar.push_back(evens[i/2]), pp.push_back(even[evens[i/2]]);
            if (i%2==1) tar.push_back(odds[i/2]),  pp.push_back(odd[odds[i/2]]);
        }

        bool sorted = true;
        for (int i=1; i<n; i++)
            if (pp[i] < pp[i-1])
                sorted = false;
        if (!sorted)    continue;



        int cnt = 0;
        for (int i=0; i<n; i++)
            for (int j=i+1; j<n; j++)
                if (tar[i] > tar[j])
                    cnt++;
        ans = min(ans, cnt);

    } while (next_permutation(perm.begin(), perm.end()));
    if (ans == INF) ans = -1;
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
typedef pair<int,int> P;
vector<int> v[5010];
int d[5010],n,m,c[5010],r[5010],vis[5010];
priority_queue<P,vector<P>,greater<P> >Q;
bool done[5010];

void DFS(int x,int cnt,int len,int lenmax){
	vis[x]=len;
	if(cnt==d[x])Q.push(make_pair(cnt,x));
	if(len==lenmax)return;
	for(int i=0;i<v[x].size();i++){
		d[v[x][i]]=min(cnt,d[v[x][i]]);
		if(vis[v[x][i]]>len+1)DFS(v[x][i],cnt,len+1,lenmax);
	}
}

int main(){
	cin>>n>>m;
	for(int i=0;i<n;i++){
		cin>>c[i]>>r[i];
		d[i]=1145141919;
		done[i]=false;
	}
	for(int i=0;i<m;i++){
		int a,b;cin>>a>>b;a--,b--;
		v[a].push_back(b);
		v[b].push_back(a);
	}
	Q.push(make_pair(0,0));d[0]=0;
	while(!Q.empty()){
		int x=Q.top().first,y=Q.top().second;Q.pop();//y???x??§
		if(done[y])continue;done[y]=true;
		for(int i=0;i<n;i++)vis[i]=1145141919;
		DFS(y,x+c[y],0,r[y]);
	}
	cout<<d[n-1]<<endl;
	return 0;
}

Measured memory_bytes: 4276
import math
n=int(input())
m=int(math.log10(n)+1)
ans=0
def count(x):
  global ans
  if x>0:
    ans+=10**(x)-10**(x-1)
    count(x-2)
  else:
    return ans
if m%2==0:
  count(m-1)
else:
  count(m-2)
  ans+=n-10**(m-1)+1
print(ans)

Measured memory_bytes: 3060
#include <iostream>
#include <sstream>
#include <cmath>
#include <string>
#include <array>
#include <vector>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <utility>
#include <iomanip>
#include <numeric>
#include <climits>
#include <algorithm>
#include <cstdint>
using namespace std;

int main()
{
    int a, b;
    string str;
    cin >> a >> b >> str;
    for (int i = 0; i < a; i++)
    {
        if (str[i] < '0' || str[i] > '9')
        {
            cout << "No";
            return 0;
        }
    }
    if (str[a] != '-')
    {
        cout << "No";
        return 0;
    }
    for (int i = a + 1; i < str.length(); i++)
    {
        if (str[i] < '0' || str[i] > '9')
        {
            cout << "No";
            return 0;
        }
    }
    cout << "Yes";
}

Measured memory_bytes: 3596
#include<iostream>
#include<climits>
#include<vector>
#include<list>
#include<functional>
#include<algorithm>
#include<string>
#include<cmath>
#include<complex>
#include<set>
#include<map>
#include<stack>
#include<queue>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int N, M;
	cin >> N >> M;
	map<int, set<P>> mp;
	vector<int> p(M), Y(M);
	REP(i, M) {
		cin >> p[i] >> Y[i];
		mp[p[i]].insert(P(Y[i], i));
	}
	vector<int> res(M);
	for (map<int, set<P>>::iterator itr = mp.begin();itr != mp.end();itr++) {
		int i = 1;
		for (set<P>::iterator it = (*itr).second.begin();it != (*itr).second.end();it++) {
			res[(*it).second] = i++;
		}
	}
	REP(i, M) {
		printf("%.6d%.6d\n", p[i], res[i]);
	}

	return 0;
}


Measured memory_bytes: 16768
n,a,b,c=map(int, input().split())
command = []
nums = {"A":a, "B":b, "C":c}
for i in range(n):
  command.append(input())

if a+b+c == 0:
  print("No")
  exit()
if a+b+c == 1:
  out = ["Yes"]

  for i in range(n):
    if nums[command[i][0]] == 0 and nums[command[i][1]] == 0:
      print("No")
      exit()
    elif nums[command[i][0]] == 0:
      out.append(command[i][0])
      nums[command[i][0]] = 1
      nums[command[i][1]] = 0
    elif nums[command[i][1]] == 0:
      out.append(command[i][1])
      nums[command[i][1]] = 1
      nums[command[i][0]] = 0
  for i in range(n+1):
    print(out[i])

if a+b+c >= 2:
  if nums[command[0][0]] == 0 and nums[command[0][1]] == 0:
    print("No")
    exit()
  print("Yes")
  for i in range(n):
    if nums[command[i][0]] == 0:
      print(command[i][0])
      nums[command[i][0]] = nums[command[i][0]] +1
      nums[command[i][1]] = nums[command[i][1]] -1
    elif nums[command[i][1]] == 0:
      print(command[i][1])
      nums[command[i][1]] = nums[command[i][1]]+1
      nums[command[i][0]] = nums[command[i][0]]-1
    elif a+b+c==2 and nums[command[i][0]] == 1 and nums[command[i][1]] == 1\
    and i < n-1 and command[i] != command[i+1]:
      if command[i][0] in command[i+1]:
        print(command[i][0])
        nums[command[i][0]] = nums[command[i][0]]+1
        nums[command[i][1]] = nums[command[i][1]]-1
      else:
        print(command[i][1])
        nums[command[i][1]] = nums[command[i][1]]+1
        nums[command[i][0]] = nums[command[i][0]]-1       
    else:
      if nums[command[i][0]] < nums[command[i][1]]:
        print(command[i][0])
        nums[command[i][0]] = nums[command[i][0]]+1
        nums[command[i][1]] = nums[command[i][1]]-1
      else:
        print(command[i][1])
        nums[command[i][1]] = nums[command[i][1]]+1
        nums[command[i][0]] = nums[command[i][0]]-1     


Measured memory_bytes: 85900
#include<iostream>
#include<algorithm>
using lint=int64_t;
using namespace std;

int main()
{
	string S;

	cin >> S;

	if(S=="Sunny")
		cout << "Cloudy";
	if(S=="Cloudy")
		cout << "Rainy";
	if(S=="Rainy")
		cout << "Sunny";
	cout << endl;
	return 0;
}



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

using namespace std;
 
#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

typedef int64_t ll; typedef vector<int> VI; typedef pair<int,int> pii;
const ll mod = 1e9+7;

void dbg(){ cerr << "\n"; }  
template <typename T,typename ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }


int main()
{
	
	//cin.tie(0); ios_base::sync_with_stdio(false);
	int n;
	cin >> n;
	VI a(n);
	rep(i,n) cin >>a[i];

	sort(all(a));
	reverse(all(a));
	
	ll sma=0, smb=0;
	rep(i,n){
		if(i%2) smb +=a[i];
		else sma +=a[i];
	}
	
	cout << sma - smb <<"\n";
	return 0;
	
}


Measured memory_bytes: 256
//
// Low-Link を用いた、橋・関節点列挙
//
// cf.
//   hos: グラフ探索アルゴリズムとその応用
//     http://hos.ac/slides/20110504_graph.pdf
//
// verified:
//   AOJ Course GRL_3_B Connected Components - Bridges
//     http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_3_B&lang=jp
//
//   Connected Components - Articulation Points
//     http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_3_A&lang=jp
//
//


/*
 
 
*/

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;


using Graph = vector<vector<int> >;
struct LowLink {
    // main results
    vector<int> aps; // articulation points
    vector<pair<int,int> > brs; // brideges
    
    // intermediate results
    vector<int> seen, ord, low;
    void dfs_lowlink(const Graph &G, int v, int p = -1) {
        static int time = 0;
        seen[v] = true;
        ord[v] = low[v] = time++;
        for (auto to : G[v]) {
            if (seen[to]) {
                if (to != p) low[v] = min(low[v], low[to]);
                continue;
            }
            dfs_lowlink(G, to, v);
            low[v] = min(low[v], low[to]);
            if (low[to] > ord[v]) brs.push_back(make_pair(v, to));
        }
    }
    void solve(const Graph &G) {
        int N = (int)G.size();
        seen.assign(N, 0); ord.resize(N); low.resize(N);
        aps.clear(); brs.clear();
        for (int v = 0; v < N; ++v) if (!seen[v]) dfs_lowlink(G, v);
    }
};


int main() {
    int V, E; cin >> V >> E;
    Graph G(V);
    for (int i = 0; i < E; ++i) {
        int s, t; cin >> s >> t;
        G[s].push_back(t);
        G[t].push_back(s);
    }
    LowLink ll;
    ll.solve(G);
    
    // 橋
    for (auto &br : ll.brs) if (br.first > br.second) swap(br.first, br.second);
    sort(ll.brs.begin(), ll.brs.end());
    for (auto br : ll.brs) cout << br.first << " " << br.second << endl;
}


Measured memory_bytes: 4340
import java.util.*;

class Main
{
	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);
		int a=sc.nextInt();
		int b=sc.nextInt();
		if((a*b)%2==0)
			System.out.println("Even");
		else
			System.out.println("Odd");

		


	}
}

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

int main() {
    string n;
    cin >> n;
    int ans = 0;
    rep(i, n.size()) {
        ans += n[i] - '0';
    }
    if (ans % 9 == 0) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3748
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    ll sum = 0;
    sum = b * d;
    sum = max(sum, a * c);
    sum = max(sum, a * d);
    sum = max(sum, b * c);
    cout << sum << "\n";
    return 0;
}


Measured memory_bytes: 3644
#pragma region template
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vld = vector<ld>;
using vvld = vector<vld>;
using vvvld = vector<vvld>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
template <typename T>
using pqrev = priority_queue<T, vector<T>, greater<T>>;
#define rep(i, n) for (ll i = 0, i##_end = (n); i < i##_end; i++)
#define repb(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repr(i, a, b) for (ll i = (a), i##_end = (b); i < i##_end; i++)
#define reprb(i, a, b) for (ll i = (b)-1, i##_end = (a); i >= i##_end; i--)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((ll)(x).size())
//*
constexpr ll MOD = 1e9 + 7;
/*/
constexpr ll MOD = 998244353;
//*/
constexpr ll INF = 1e+18;
constexpr ld EPS = 1e-12L;
constexpr ld PI = 3.14159265358979323846L;
constexpr ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
constexpr ll LCM(ll a, ll b) { return a / GCD(a, b) * b; }
template <typename S, typename T>
constexpr bool chmax(S &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename S, typename T>
constexpr bool chmin(S &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
#ifdef OJ_LOCAL
#include "dump.hpp"
#else
#define dump(...) ((void)0)
#endif
template <typename T>
bool print_(const T &a) {
  cout << a;
  return true;
}
template <typename T>
bool print_(const vector<T> &vec) {
  for (auto &a : vec) {
    cout << a;
    if (&a != &vec.back()) {
      cout << " ";
    }
  }
  return false;
}
template <typename T>
bool print_(const vector<vector<T>> &vv) {
  for (auto &v : vv) {
    for (auto &a : v) {
      cout << a;
      if (&a != &v.back()) {
        cout << " ";
      }
    }
    if (&v != &vv.back()) {
      cout << "\n";
    }
  }
  return false;
}
void print() { cout << "\n"; }
template <typename Head, typename... Tail>
void print(Head &&head, Tail &&... tail) {
  bool f = print_(head);
  if (sizeof...(tail) != 0) {
    cout << (f ? " " : "\n");
  }
  print(forward<Tail>(tail)...);
}
#pragma endregion

void Pr(bool f){
  cout << (f ? "Yes" : "No") << "\n";
  exit(0);
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  ll n;
  cin >> n;
  ll ans = 0;
  repr(a, 1, n){
    repr(b, 1, n){
      if(a*b>=n) break;
      ans++;
    }
  }
  print(ans);
}


Measured memory_bytes: 3648
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <stdio.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <set>
#include <sstream>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define FOR(i,a,b) for(int i=a; i<(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort(ALL(x))
#define CLR(a) memset((a), 0 ,sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
const int INF = 1001001001;
const ll LINF = 100100100100100100;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

__attribute__((constructor))
void initial(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

signed main(){
  ll a,b,c,k; cin>>a>>b>>c>>k;
  ll ans = a-b;
  if(k%2) ans *= -1;
  
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main()
{
    int a;
    cin >> a;
    
    int b;
    cin >> b;
    
    int c;
    cin >> c;
    
    if(a+b>=c){
        cout << "Yes"<<endl;
    }
    else{
        cout << "No"<<endl;
    }
    
    
    return 0;
}

Measured memory_bytes: 256
X, Y = map(int,input().split())

shokin = 0
if X == 1:
    shokin += 3*10**5
elif X == 2:
    shokin += 2*10**5
elif X == 3:
    shokin += 1*10**5

if Y == 1:
    shokin += 3*10**5
elif Y == 2:
    shokin += 2*10**5
elif Y == 3:
    shokin += 1*10**5

if X == 1 and Y == 1:
    shokin += 4 * 10 ** 5

print(shokin)

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

int main(){
    int cnt = 0;
    int n; cin >> n;
    string s, t; cin >> s >> t;
    
    for(int i = 0; i < n; i++){
        int k = 0, cnt = 0;
        for(int j = i; j < n; j++){
            if(s[j] == t[k++]){
                cnt++;
            }else{
                break;
            }
        }
        if(cnt == n - i){
            put(2 * n - cnt);
            return 0;
        }
    }
    put(2 * n);
}

Measured memory_bytes: 256