akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, a, b) for(int i = a; i < b; i++)
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
typedef long long ll;
typedef long long int lli;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }

int dx[] = {1, 1, 0, -1, -1, -1, 0, 1};
int dy[] = {0, 1, 1, 1, 0, -1, -1, -1};

string ans = "";


int main(){
    ll n;
    cin >> n;
    ll c = 26, cnt = 1;
    while(c < n){
        n -= c;
        c *= 26;
        cnt++;
    }
    string ans = "";
    rep(i, cnt){
        ans += "a";
    }
    n--;
    while(n){
        ans[cnt-1] += n % 26;
        n /= 26;
        cnt--;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3620
import java.util.Scanner;

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

			int[] kosuu = new int[100000 + 1];

			long sum = 0;
			for (int i = 0; i < n; i++) {
				int value = sc.nextInt();
				sum += value;
				kosuu[value]++;
			}

			int q = sc.nextInt();
			for (int i = 0; i < q; i++) {
				int b = sc.nextInt();
				int c = sc.nextInt();

				sum += (long)(c - b) * kosuu[b];
				System.out.println(sum);

				kosuu[c] += kosuu[b];
				kosuu[b] = 0;

			}

		} catch (Exception e) {
			e.printStackTrace();
		}

	}
}


Measured memory_bytes: 61136
#include <bits/stdc++.h>
using namespace std;
#define LIMIT 1000000000000000000
typedef long long ll;

int main(void){
    ll a, b, c, k;
    cin >> a >> b >> c >> k;
    if (abs(a-b) > LIMIT){
        cout << "Unfair" << endl;
    } else{
        cout << (k%2==1 ? -(a-b) : a-b) << endl;
    }
    return 0;
}

Measured memory_bytes: 3608
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
typedef long long LL;
const LL K = 750;
const LL MP = 20000;

LL pri[20005],pc = 0;
LL npr[20005] = {0};
LL w[505][505];

void sieve(LL x){
	for(LL i = 2;i <= x;i ++){
		if(npr[i]) continue;
		pri[++ pc] = i;
		for(LL j = i * i;j <= x;j += i){
			npr[j] = 1;
		}
	} 
}

LL gcd(LL x,LL y){
	if(!y) return x;
	return gcd(y,x % y);
}

LL lcm(LL x,LL y){
	return x / gcd(x,y) * y;
}

int main(){
	ios::sync_with_stdio(false);
	LL n; cin >> n;
	if(n == 2){
		cout << 4 << ' ' << 7 << endl;
		cout << 23 << ' ' << 10 << endl;
		return 0;
	}
	sieve(MP);
	for(LL i = 0;i <= n + 1;i ++){
		for(LL j = 0;j <= n + 1;j ++){
			w[i][j] = 1;
		}
	}
	for(LL i = 1;i <= n;i ++){
		for(LL j = 1;j <= n;j ++){
			if((i + j) & 1) w[i][j] = pri[(i + j) >> 1] * pri[((i - j) >> 1) + K];
		}
	}
	for(LL i = 1;i <= n;i ++){
		for(LL j = 1;j <= n;j ++){
			if(w[i][j] == 1) w[i][j] = lcm(lcm(w[i - 1][j],w[i][j - 1]),lcm(w[i + 1][j],w[i][j + 1])) + 1;
		}
	}
	for(LL i = 1;i <= n;i ++){
		for(LL j = 1;j <= n;j ++){
			cout << w[i][j] << (j == n ? '\n' : ' ');
		}
	}
	return 0;
}

Measured memory_bytes: 5376
import sys
import copy
import math
import itertools
import numpy as np
import re

N,T = [int(c) for c in input().split()]
t = [int(c) for c in input().split()]

ans = T
for i in range(1,N):
    if t[i]-t[i-1] < T:
        ans += t[i]-t[i-1]
    else:
        ans += T

print(ans)

Measured memory_bytes: 48768
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <vector>
#include <numeric>
using namespace std;


int main()
{
    int N;
    int A[100010];
    cin>>N;
    for(int i=1;i<N+1;++i){
        cin>>A[i];
    }
    int ans=A[1];
    for(int i=2;i<N+1;++i){
        int a=ans;
        int b=A[i];
        if(a<b){
            int tmp = a;
            a = b;
            b = tmp;
        }
        
        /* ユークリッドの互除法 */
        int r = a % b;
        while(r!=0){
            a = b;
            b = r;
            r = a % b;
        }
        
        ans=b;

}
    cout<<ans<<endl;


    
}


Measured memory_bytes: 640
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
const ld eps = 1e-9;


map<string, int>mp;
int num = 0;

int getnum(string st) {
	if (mp.find(st) == mp.end()) {
		mp[st] = num++;
	}
	return mp[st];
}



struct country {
	int num;
	int power;
	vector<int>connects;
};
int N;
vector<int>rests;
void getans(int now, const vector<country>&cs,vector<int>&oks,int n_power ,int&ans) {
	if (now == N-1) {
		ans = max(ans, n_power);
		return;
	}
	else if (rests[now] + n_power < ans) {
		return;
	}
	if (oks[cs[now].num]) {
		vector<int>nextoks(oks);
		for (auto con : cs[now].connects) {
			nextoks[con] = false;
		}
		getans(now + 1, cs, nextoks, n_power + cs[now].power, ans);
	}
	getans(now + 1, cs, oks, n_power, ans);
}

int main() {
	while (1) {cin >> N;
	if (!N)break;
	mp.clear();
	num = 0;
	rests.clear();
		vector<vector<int>>connects(N);
		vector<int>powers(N);
		for (int i = 0; i < N; ++i) {
			string name;
			int B, C; cin >> name>> B >> C;
			int from = getnum(name);
			powers[from] = B;
			for (int j = 0; j < C; ++j) {
				string d; cin >> d;
				int to = getnum(d);
				connects[from].push_back(to);
			}
		}
		vector<country>cs;
		for (int i = 1; i < N; ++i) {
			cs.push_back(country{ i,powers[i],connects[i] });
		}
		sort(cs.begin(), cs.end(), [](const country&l, const country&r) {
			return l.power > r.power;
		});

		vector<int>oks(N,1);
		for (auto con : connects[0]) {
			oks[con] = false;
		}
		rests=vector<int>(N);

		for (int i = N -2; i >= 0; --i) {
			rests[i] = rests[i + 1] + cs[i].power;
		}
		int ans = 0;
		
		getans(0, cs, oks, 0, ans);
		cout <<powers[0]+ ans << endl;
	}
	return 0;
}

Measured memory_bytes: 3156
#include<iostream>
#include<stack>
using namespace std;
#define NIL -1

struct Node {int left=NIL, right=NIL; bool visited=false;};

int findPos(int n, int in[], int target) {
	for (int i = 0; i < n; i++) {
		if (in[i] == target) return i;
	}
	return -1;
}

void reconstructTree(int n, Node T[], int pre[], int in[]) {
	int root = pre[0];
	for (int i = 1; i < n; i++) {
		int target = pre[i];
		int targetPos = findPos(n, in, target);
		stack<int> st;
		st.push(root);
		while (st.size() != 0) {
			int cur = st.top(); st.pop();
			int curPos = findPos(n, in, cur);
			if (targetPos < curPos) {
				if (T[cur].left == NIL) T[cur].left = target;
				else st.push(T[cur].left);
			} else {
				if (T[cur].right == NIL) T[cur].right = target;
				else st.push(T[cur].right);
			}
		}
	}
}

void preOrder(Node T[], int root) {
	stack<int> st;
	st.push(root);
	while (st.size() != 0) {
		int cur = T[st.top()].left;
		while (cur != NIL && !T[cur].visited) {
			st.push(cur);
			cur = T[cur].left;
		}
		int right = T[st.top()].right;
		if (right != NIL && !T[right].visited) {
			st.push(right);
		} else {
			cur = st.top(); st.pop();
			cout << cur;
			if (st.size() != 0) cout << " ";
			T[cur].visited = true;
		}
	}
	cout << endl;
}

int main() {
	int n;
	cin >> n;
	int pre[n], in[n];
	for (int i = 0; i < n; i++) cin >> pre[i];
	for (int i = 0; i < n; i++) cin >> in[i];
	Node T[n+1];
	reconstructTree(n, T, pre, in);
	preOrder(T, pre[0]);
	return 0;
}



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

using namespace std;

using ll = long long;

const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;

template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}

int main () {
  cin.tie(0);
  cout << fixed << setprecision(10);

  int r, g, b, n; cin >> r >> g >> b >> n;
  int cnt = 0;
  for(int i=0;i<=n/r;++i) {
    for(int j=0;j<=n/g;++j) {
      if((n - i * r - j * g) % b == 0 && (n-i*r-j*g)/b >= 0) {
        // cout << i << ":" << j << ":" << (n-i*r-j*g)/b << endl;
        cnt++;
      }
    }
  }
  cout << cnt << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <stdio.h>
#include <math.h>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
ll mm=1000000000;ll MM=mm+7;
#define rep(i, n) for(int i=0;i<n;i++)

int main(){
  int n;
  double m;
  cin >> n >> m;
 VI a(n);
  double sum=0;
  rep(i,n){
    cin >> a.at(i);
    sum+=a.at(i);
  }
  sort(a.begin(),a.end());
  reverse(a.begin(),a.end());
  double x=sum/(4*m);
  if(a.at(m-1) <x) cout << "No" <<endl;
  else cout << "Yes" << endl;

}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;

public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		Integer n=Integer.valueOf(sc.nextLine());
		List<Long> member=Arrays.asList(sc.nextLine().split(" "))
				.stream()
				.map(Long::valueOf)
				.sorted(Comparator.reverseOrder())
				.limit(n*2)
				.collect(Collectors.toList());
		Long result=0l;
		for(int i=0;i<n;i++) {
			result+=member.get(2*i+1);
		}
		System.out.println(result);
	}
}

Measured memory_bytes: 92780
// Born Sinner
// old but im not that old
// fuck all you hoes get a grip
import java.util.*;
import java.lang.*;
import java.io.*;

public class Main
{
    static class FastReader{
        BufferedReader br;
        StringTokenizer st;
        public FastReader(){
            br = new BufferedReader(new InputStreamReader(System.in));
        }
        String next(){
            while(st == null || !st.hasMoreElements()){
                try{
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e){
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
        int nextInt(){
            return Integer.parseInt(next());
        }
        long nextLong(){
            return Long.parseLong(next());
        }
        double nextDouble(){
            return Double.parseDouble(next());
        }
        String nextLine(){
            String str = "";
            try{
                str = br.readLine();
            } catch (Exception e){
                e.printStackTrace();
            }
            return str;
        }
    }
    static int modPower(int x, int y, int mod){
        int res = 1;
        x %= mod;
        if(x==0) return 0;
        while(y>0){
            if(y%2==1){
                res = (res*x)%mod;
            }
            y = y>>1;
            x = (x*x)%mod;
        }
        return res;
    }
    static class pair<T1, T2>{
        T1 first;
        T2 second;
        pair(T1 first, T2 second){
            this.first = first;
            this.second = second;
        }
    }
    
    public static void main (String[] args) throws java.lang.Exception
    {
        FastReader in = new FastReader();
        long[] a = new long[4];
        for(int i = 0; i < 4; i++) a[i]=in.nextLong();
        System.out.println(Math.max(a[0]*a[2], Math.max(a[1]*a[3], Math.max(a[0]*a[3], a[1]*a[2]))));
    }
}

Measured memory_bytes: 32668
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <iostream>
#include <string>
#include <list>
using namespace std;

    
int main(){
    int A,B;
    cin>>A>>B;
    int b=B*10,e=(B+1)*10;
    int i;
    for (i=b; i<e; i++) {
        if ((int)(i*0.08)==A&&(int)(i*0.1)==B) {
            break;
        }
    }
    if (i==e) {
        cout<<-1<<endl;
    }else{
        cout<<i<<endl;
    }
    return 0;
}


Measured memory_bytes: 888
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<algorithm>
#include<stdlib.h>
#define _USE_MATH_DEFINES
#include<math.h>
#include<numeric>
#include<iomanip>
#include<queue>
#include<stack>
using namespace std;






int main() {
	stack<int>a;
	int flag = 1;
	while (flag) {
		string t;
		cin >> t;
		int tp = 0;
		if (cin.eof()) {
			cout << a.top() << endl;
			a.pop();
			flag = 0;
		}
		if (t == "*") {
		
			int tmp = a.top();
			a.pop();
			int tmp2 = a.top();
			a.pop();
			a.push(tmp * tmp2);
			

		}
		else if (t == "+") {
			int tmp = a.top();
			a.pop();
			int tmp2 = a.top();
			a.pop();
			a.push(tmp + tmp2);
		}
		else if (t == "-") 
		{   
			int tmp = a.top();
			a.pop();
			int tmp2 = a.top();
			a.pop();
			a.push(tmp2-tmp);
			
		}
		else {
			int num = atoi(t.c_str());
			a.push(num);
			
		}
		//cout << a.top() << endl;
		
	}
}







Measured memory_bytes: 3148
import sys

fin = sys.stdin.readline
N = [int(elem) for elem in fin().split()][0]
a_list = [int(elem) for elem in fin().split()]


inv_a_list = a_list[::-1]

ball_list = [0 for _ in range(N)]
ball_idx = []
for i, each_a in enumerate(inv_a_list):
    current_idx = N-i
    sup_sum = sum([ball_list[j * current_idx-1] for j in range(2, int(N / current_idx)+1)])
    if (each_a + sup_sum) % 2 == 0:
        continue
    else:
        ball_list[current_idx-1] = 1
        ball_idx.append(str(current_idx))

print(sum(ball_list))

if len(ball_idx) > 0:
    print(' '.join(ball_idx))


Measured memory_bytes: 107972
n=int(input())
A1=list(map(int,input().split(' ')))
A2=list(map(int,input().split(' ')))
L=0
i=0
while i < n:
    l=sum(A1[:i+1])+sum(A2[i:])
    if L < l:
        L=l
    i+=1
print(L)

Measured memory_bytes: 3060
import sys
input = sys.stdin.readline

N, S = map(int, input().split())
A = [0] + list(map(int, input().split()))
mod = 998244353

"""
X = (1,2,...,N)の部分集合
Y = Xの部分集合

各i(1 ≤ i ≤ N) について、
1. XにもYにも入れる
2. Xには入れるがYには入れない
3. XにもYにも入れない

dp[i][j] = i番目までの選択をして、sum(Y)==jであるような場合の数
"""

dp = [[0 for _ in range(S + 1)]for _ in range(N + 1)]
dp[0][0] = 1
for i in range(1, N + 1):
    for j in range(S + 1):
        # YにA[i]を入れることが出来る場合（遷移元がある場合）
        # 選択肢2,3を選ぶ場合 + 選択肢1を選ぶ場合
        if j >= A[i]:
            dp[i][j] = 2 * dp[i - 1][j] + dp[i - 1][j - A[i]]
            dp[i][j] %= mod
        # 選択肢2,3を選ぶ場合(1は選べない)
        else:
            dp[i][j] = 2 * dp[i - 1][j]
            dp[i][j] %= mod

print(dp[N][S])


Measured memory_bytes: 153276
sx, sy, tx, ty = list(map(int, input().split()))

x_diff = tx - sx
y_diff = ty - sy

S = []
for i in range(x_diff):
    S.append("R")
for i in range(y_diff):
    S.append("U")
for i in range(x_diff):
    S.append("L")
for i in range(y_diff):
    S.append("D")
S.append("L")
for i in range(y_diff + 1):
    S.append("U")
for i in range(x_diff + 1):
    S.append("R")
S.append("D")
S.append("R")
for i in range(y_diff + 1):
    S.append("D")
for i in range(x_diff + 1):
    S.append("L")
S.append("U")
print(''.join(S))


Measured memory_bytes: 3188
# -*- coding: utf-8 -*-


def main():
    x = int(input())

    if x < 100:
        print(0)
        exit()

    p, q = divmod(x, 100)

    if q <= p * 5:
        print(1)
    else:
        print(0)


if __name__ == '__main__':
    main()


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

int main(int, char**) {
        std::string s;
        std::cin >> s;
        int l = s.size();
        std::map<int, int> mods;
        int prev = 0;
        int prev10 = 1;
        mods[0] = 1;
        for (int i=l; i>0; i--) {
                int digit = s.at(i - 1) - '0';
                int mod = (prev + prev10 * digit) % 2019;
                prev = mod;
                prev10 = prev10*10 % 2019;
                if (mods.count(mod)) {
                        mods.at(mod)++;
                } else {
                        mods[mod] = 1;
                }
        }
        int count = 0;
        for (auto x : mods) {
                int value = x.second;
                count += value * (value - 1) / 2;
        //      std::cout << x.first << " " << x.second << std::endl;
        }
        std::cout << count << std::endl;
        return 0;
}


Measured memory_bytes: 3712
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
int main(int argc,char *argv[]){
	int N,M,a,b;
	std::cin >> N >> M;
	std::vector<std::pair<int,int> > List;
	for(int i=0;i<M;++i){
		std::cin >> a >> b;
		List.push_back( std::pair<int,int>(a,b) );
	}
	std::sort(List.begin(),List.end());
	int cnt = M,bmin=1E6;
	for(int i=0;i<M-1;++i){
		//int ai = List[i].first;
		bmin = std::min(bmin,List[i].second);
		int an = List[i+1].first;
		//int bn = List[i+1].second;
		if(an < bmin){
			--cnt;
		}else{
			bmin = 1E6;
		}
	}
	std::cout << cnt << std::endl;
	return 0;
}

Measured memory_bytes: 1528
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    if len(x) == 0:
        return []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False
"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""


mod = 10**9+7 #出力の制限
N = 10**5+10**4
def cmb(n, r):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod
def p(n,r):
    if ( r<0 or r>n ):
        return 0
    return g1[n] * g2[n-r] % mod

g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )
# a = cmb(n,r)

N,M = m()

def prime_decomposition(n): #素因数分解
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n /= i
      table.append(i)
    i += 1
  if n > 1:
    table.append(int(n))
  return table

def make_divisors(n): #約数列挙
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

po = prime_decomposition(M)

po = s(po)


co = 1


for i in range(len(po)):
    co *= cmb(po[i][1]+N-1,N-1)
    co %= mod
print(co)


Measured memory_bytes: 60656
#include <bits/stdc++.h>
using namespace std;
int a, b, c, cnt = 0;
int main () {
	cin >> a >> b >> c;
	if(a == b || b == c) {
		cout << "NO";
		return 0;
	}
	while(cnt != a * b * c) {
		if(cnt % b == c && cnt % a == 0) {
			cout << "YES";
			return 0;
		}
		cnt++;
	}
	cout << "NO";
}

Measured memory_bytes: 256
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, std.random, core.bitop;

enum inf = 1_001_001_001;
enum inf6 = 1_001_001_001_001_001_001L;
enum mod = 1_000_000_007L;

alias Pair = Tuple!(int, "a", int, "b");

void main() {
    double a, b, x;
    scan(a, b, x);

    double ok = 0, ng = PI_2;

    bool check(double t) {
        if (b * tan(PI_2 - t) <= a) {
            return b^^2 * tan(PI_2 - t) * a / 2 >= x;
        }
        else {
            return a^^2 * b - a^^3 * tan(t) / 2 >= x;
        }
    }

    foreach (i ; 0 .. 1000) {
        auto mid = (ok + ng) / 2;
        (check(mid) ? ok : ng) = mid;
    }

    auto ans = rad2deg(ok);
    writefln("%.12f", ans);
}

double rad2deg(double t) {
    return t / PI * 180;
}





void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}

void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

bool chmin(T, U...)(ref T x, U args) {
    bool isChanged;

    foreach (arg; args) {
        if (x > arg) {
            x = arg;
            isChanged = true;
        }
    }

    return isChanged;
}

bool chmax(T, U...)(ref T x, U args) {
    bool isChanged;

    foreach (arg; args) {
        if (x < arg) {
            x = arg;
            isChanged = true;
        }
    }

    return isChanged;
}


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

using ll = long long;
using ld = long double;
using vi = vector<int>;
using vll = vector<ll>;
using P = pair<int, int>;

const int INF = 1e9;
const ll INFLL = 1e18;
const int MOD = 1e9 + 7;
const int NIL = -1;

#define rep(i,n) for(int i=0; i<(n); ++i)
#define all(n) n.begin(),n.end()

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

#define DEBUG

int main()
{
	ios::sync_with_stdio(false); cin.tie(0);
	int n;
	cin >> n;
	vi a(n);
	rep(i, n) cin >> a[i];
	sort(all(a));
	rep(i, n-1)
	{
		if(a[i] == a[i+1])
		{
			cout << "NO" << endl;
			return 0;
		}
	}
	cout << "YES" << endl;
	return 0;
}

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

int main()
{
	int N;
	cin >> N;
	double result = 0;

	if (N % 2 == 0) {
		result = 0.5;
	}
	else {
		result = (N / 2 + 1) / (double)N;
	}

	cout << result;

	return 0;
}

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


signed main(){
    ios::sync_with_stdio(false);
	cin.tie(0);
    cout << fixed << setprecision(20);

    int h,w;
    while(cin>>w>>h){
        if(h==0) break;
        string s[h];
        for(int i=0;i<h;i++){
            cin>>s[i];
        }
        int n = h*w;
        int dp[n][n]={};
        for(int i=0;i<n;i++){
            for(int j=0;j<n;j++){
                if(j==i) continue;
                dp[i][j] = 1e9;
            }
        }
        int dx[4] = {0,1,0,-1};
        int dy[4] = {1,0,-1,0};
        for(int i=0;i<h;i++){
            for(int j=0;j<w;j++){
                if(s[i][j] == 'x') continue;
                for(int k=0;k<4;k++){
                    int x = dx[k] + i , y = dy[k]+j;
                    if(x<0 || x>=h || y<0 || y>=w) continue;
                    if(s[x][y] == 'x') continue;
                    dp[i*w+j][x*w+y]=1;
                }
            }
        }
        for(int k=0;k<n;k++)for(int i=0;i<n;i++)for(int j=0;j<n;j++){
            dp[i][j] = min(dp[i][j], dp[i][k]+dp[k][j]);
        }
        vector<int> v;
        int now = 0;
        for(int i=0;i<h;i++){
            for(int j=0;j<w;j++){
                if(s[i][j]=='*'){
                    v.push_back(i*w+j);
                }
                if(s[i][j] == 'o') now = i*w+j;
            }
        }
        sort(v.begin(),v.end());
        int ans = 1e9;
        bool pos = true;
        do{
            int t = now;
            int ret = 0;
            for(int i:v){
                if(dp[t][i]==1e9){
                    pos = false;
                    break;
                }
                ret += dp[t][i];
                t = i;
            }
            if(pos == false) break;
            ans = min(ans,ret);
        }while(next_permutation(v.begin(),v.end()));

        if(ans == 1e9)ans = -1;
        cout << ans << "\n";
    }
}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
#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;
const int INF = 1e9;
const double PI = acos(-1.0);

int main(void) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int N;
	cin >> N;
	
	int L[200];
	REP(i, 2 * N) cin >> L[i];
	
	sort(L, L + 2 * N);
	
	int sum = 0;
	REP(i, 2 * N) if(!(i % 2)) sum += L[i];
		
	cout << sum << "\n";
	
	return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rep3(i, l, n) for (int i = l; i < n; ++i)
#define max(a, b) (a > b ? a : b)
#define min(a, b) (a < b ? a : b)
#define chmax(a, b) a = (a >= b ? a : b)
#define chmin(a, b) a = (a <= b ? a : b)
#define out(a) cout << a << endl
#define outa(a, n) { rep(_, n) cout << a[_] << " "; cout << endl; }
#define outp(a, n) { cout << endl; rep(_, n) cout << a[_].F << " " << a[_].S << endl; }
#define SZ(v) (int)v.size()
#define inf (int)(1e9+7)
#define abs(x) (x >= 0 ? x : -(x))
#define ceil(a, b) a / b + !!(a % b)
#define FIX(a) fixed << setprecision(a)
#define LB(v, n) (int)(lower_bound(all(v), n) - v.begin())
#define UB(v, n) (int)(upper_bound(all(v), n) - v.begin())

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    sort(all(a));
    
    vector<ll> acc(n + 1, 0);
    rep(i, n) acc[i + 1] = acc[i] + a[i];
    // outa(acc, n);
    
    int it = LB(acc, (a[n - 1] + 1) / 2);
    // out(it);
    
    // こっから遡るぞ
    for (int i = it - 1; i >= 0; --i) {
        if (acc[i] * 2 < a[i]) {
            out(n - i);
            return 0;
        }
    }
}



Measured memory_bytes: 1536
#include <iostream>
#include <vector>
#include <string>


using namespace std;


using ll = long long;


class node {
    public:
        ll p, l, r;

        node();
};


node::node()
    : p(-1), l(-1), r(-1)
{
}


ll height(ll now, vector<node> &nodes, vector<ll> &H)
{
    if (nodes[now].l == -1 && nodes[now].r == -1) {
        H[now] = 0LL;
        return 0LL;
    }

    ll lh, rh;
    lh = rh = -1;
    if (nodes[now].l != -1)
        lh = height(nodes[now].l, nodes, H);
    if (nodes[now].r != -1)
        rh = height(nodes[now].r, nodes, H);
    H[now] = max(lh, rh) + 1;
    return H[now];
}


void depth(ll now, vector<node> &nodes, vector<ll> &D, ll d)
{
    D[now] = d;
    if (nodes[now].l != -1) {
        depth(nodes[now].l, nodes, D, d + 1);
    }
    if (nodes[now].r != -1) {
        depth(nodes[now].r, nodes, D, d + 1);
    }
}


string node_type(ll now, vector<node> &nodes)
{
    if (nodes[now].p == -1)
        return string("root");
    else if (nodes[now].l == -1 && nodes[now].r == -1)
        return string("leaf");
    else
        return string("internal node");
}


int main()
{
    ll n;
    cin >> n;
    vector<node> nodes(n);
    for (ll i = 0; i < n; i++) {
        ll id, left, right;
        cin >> id >> left >> right;
        nodes[id].l = left;
        nodes[id].r = right;
        nodes[left].p = id;
        nodes[right].p = id;
    }

    ll r;
    for (ll i = 0; i < n; i++) {
        if (nodes[i].p == -1) {
            r = i;
            break;
        }
    }

    vector<ll> H(n);
    vector<ll> D(n);

    height(r, nodes, H);
    depth(r, nodes, D, 0);

    for (ll i = 0; i < n; i++) {
        ll sib;
        if (r == i)
            sib = -1;
        else
            sib = nodes[nodes[i].p].l == i ? nodes[nodes[i].p].r : nodes[nodes[i].p].l;
        ll deg = 0;
        deg += nodes[i].l == -1 ? 0 : 1;
        deg += nodes[i].r == -1 ? 0 : 1;

        cout << "node " << i << ": parent = " << nodes[i].p << ", sibling = " << sib;
        cout << ", degree = " << deg << ", depth = " << D[i] << ", height = " << H[i] << ", " << node_type(i, nodes) << endl;
    }
}



Measured memory_bytes: 3164
#023_B
n = int(input())
s = [input() * 2 for _ in range(n)]
ans = 0
for b in range(0, n):
    flg = True
    for i in range(n):
        for j in range(n):
            if s[i][b+j] != s[j][b+i]:
                flg = False
                break
    if flg:
        ans += 1

print(ans * n)

Measured memory_bytes: 42604
n=gets.to_i
a=n.times.map{gets.chomp}
m=a.sort
a.each{|e|
	idx1=(0...n).bsearch{|i|m[i]>=e}||n
	idx2=(0...n).bsearch{|i|m[i]>e}||n
	p idx1*3+(idx2-idx1-1)
}

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

int main(int argc, char const *argv[]) {
  char c;
  cin >> c;
  if(c == 'a'||c == 'i'||c == 'u'||c == 'e'||c == 'o')
    cout << "vowel" << '\n';
  else
    cout << "consonant" << '\n';
  return 0;
}

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

int main() {
    string s;
    cin >> s;
    vector<int> a(26);
    bool ans = true;
    for(char c : s){
        a[c-'a']++;
        if(a[c-'a'] > 1){
            ans = false;
            break;
        }
    }

    if(ans) cout << "yes" << endl;
    else cout << "no" << endl;
}


Measured memory_bytes: 256
# from math import factorial
# from collections import defaultdict, deque
#  from heapq import heappush, heappop, heapify

# A, B = [int(i) for i in input().split(" ")]
# A = int(input())
# As = [int(i) for i in input().split(" ")]
# Ss = ["".join(sorted(input())) for _ in range(N)]
# edges = defaultdict(list)
# for _ in range(N - 1):
#     a, b = [int(i) for i in input().split(" ")]
#     edges[a-1].append(b-1)

N = int(input())
odds = [i for i in range(1, N + 1) if i % 2 == 1]
print(len(odds) / N)


Measured memory_bytes: 2940
#include<bits/stdc++.h>
#define M 500000
#define MAX 10000000000000010
#define mod 1000000007
#define ss second
#define ff first
#define ll long long int
#define pb push_back
#define ld double
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL)
using namespace std;

int main()
{
	ll h;
	cin>>h;
	ll ans = 0,fr=1;
	while(h>0)
	{
		h/=2;
		ans += fr;
		fr *= 2;
	}	
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define pp pop_back
#define in insert
#define ff first
#define ss second
#define  show for(int j=0;j<v.size();j++) cout<<v[j]<<" ";
#define ld long double
#define e endl
#define bc __builtin_popcount
#define MOD 1000000007
#define MAXN 200005
#define INT_SIZE 32
#define debug cout<<"we are debugging"<<endl;
#define me(x) memset(x,0,sizeof(x))
ll fast_expo(ll x,ll p)
{if(p==0) return 1;
else if(p%2==0){ ll t=fast_expo(x,p/2)%MOD;return (t*t)%MOD;} else return (x*(fast_expo(x,p-1))%MOD)%MOD;}
int main(){
	char ch;
	cin>>ch;
	if(ch>='A'&&ch<='Z')
          cout<<"A";
     else
          cout<<"a";

}


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

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
const int INF_N = 1e+9;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

//繰り返し二乗法
ll mod_pow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

//逆元(Eucledean algorithm)
ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
using mP = pair<modint, modint>;

int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };




void solve() {
    int a, b, c; cin >> a >> b >> c;
    int ma = max({a, b, c});
    int mi = min({a, b, c});
    int sum = a+b+c;
    sum -= ma;
    cout << mi*(sum-mi)/2 << endl;
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout << fixed << setprecision(10);
  //init_f();
  //init();
  //int t; cin >> t; rep(i, t)solve();
  solve();
//   stop
    return 0;
}


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

#define get_variable_name(x) #x
#define debug(x) cout << #x << " = " << x << endl

#define ALL(x) (x).begin(), (x).end()
#define SORT(x) sort((x).begin(), (x).end())
#define REVERSE(x) reverse( (x).begin(),(x).end())
#define UNIQUE(x) (x).erase(unique(ALL((x))), (x).end())
#define PW(x) (1LL<<(x))

using namespace std;
using ll = int64_t;
using P = pair<int, int>;

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

template<class T>
ostream& operator <<(ostream& os, const vector<T> &v){
    cout << get_variable_name(v) << " = [";
    for(auto i : v) 
        os << " " << i;
    os << " ]";
    return os;
}


const int INF = 1e8;

int main() {
    ios::sync_with_stdio(false);
    int a, b, h;
    cin >> a >> b >> h;
    cout << (a+b)*h/2 << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string ss;
    cin>>ss;
    if(ss.size()%2==1)
    {
        if(ss[0]==ss[ss.size()-1])
            cout<<"Second"<<endl;
        else
            cout<<"First"<<endl;
    }
    else
    {
        if(ss[0]!=ss[ss.size()-1])
            cout<<"Second"<<endl;
        else
            cout<<"First"<<endl;
    }
    return 0;
}

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

int main(void){
  string s;
  cin >> s;
  if(s.at(2)==s.at(3)&&s.at(4)==s.at(5)){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b; cin >> a >> b;
    if (a * b % 2 == 0) {
        cout << "Even" << endl;
    } else {
        cout << "Odd" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
  int W, H, x, y, r;
  cin >> W >> H >> x >> y >> r;

  int a = r;
  int b = W - r;
  int c = r;
  int d = H - r;

  if (x >= a && x <= b && y >= c && y <= d) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 3124
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;

namespace AtCoderABC122
{
    class Program
    {
        static long mod = 1000000007;
        static int N;
        static Dictionary<string, long>[] memo;

        public static bool Ok(string s)
        {
            for (int i = 0; i < 4; i++)
            {
                char[] t = s.ToCharArray();
                if (i >= 1)
                {
                    char temp = t[i];
                    t[i] = t[i - 1];
                    t[i - 1] = temp;
                }
                string ss = new string(t);
                if (ss.IndexOf("AGC", 0) >= 0) return false;
            }
            return true;
        }

        static string chars = "ACGT";

        public static long Dfs(int cur, string s)
        {
            if (memo[cur].ContainsKey(s)) return memo[cur][s];
            if (cur == N) return 1;

            long ret = 0;

            for (int i = 0; i < 4; i++)
            {
                string c = chars[i].ToString();
                if (Ok(s + c)) ret = (ret + Dfs(cur + 1, s.Substring(1) + c)) % mod;
            }
            memo[cur][s] = ret;

            return ret;
        }

        public static void Main(string[] args)
        {
            N = int.Parse(Console.ReadLine());
            memo = new Dictionary<string, long>[N + 1];
            for (int i = 0; i < N + 1; i++) memo[i] = new Dictionary<string, long>();

            Console.WriteLine(Dfs(0, "TTT"));
        }
    }
}

Measured memory_bytes: 18136
#include <iostream>
#include <string>
using namespace std;
#define rep(i,n) for(int i = 0;i<n;i++)
int main(){
    int n;
    cin >> n;
    string s;
    cin >> s;
    int cnt = 0;
    int cntt = 0;
    rep(i,n){
        if(s[cnt]=='('){
            cntt++;
        }
        else{
            if(cntt>0) cntt--;
            else{
                s='('+s;
                cnt++;
            }
        }
        cnt++;
    }
    rep(i,cntt){
        s=s+')';
    }
    cout << s << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
using namespace std;
int n,m;
int main()
{
    cin>>n>>m;
    if (n < m)
        for (int i = 1;i <= m;i++)
            cout<<n;
    else
        if (n > m)
            for (int j = 1;j <= n;j++)
                cout<<m;
        else
            for (int i = 1;i <= m;i++)
                cout<<min(n,m);
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <string>
using namespace std;

int main() {
	string ch, x;
	int kai, shu;
	while (1) {
		cin >> ch;
		x = ch;
		if (ch == "-")break;
		cin >> kai;
		for (int i = 0; i < kai;i++) {
			cin >> shu;
			for (int j = 0; j < shu; j++) {
				x[j] = ch[j];
			}
			//cout << ch << endl;
			for (int j = 0; j < ch.size() - shu; j++) {
				ch[j] = ch[j + shu];
			}
			for (int j = 0; j < shu; j++) {
				ch[(ch.size() - shu) + j] = x[j];
			}
			//cout << ch << endl;
		}
		cout << ch << endl;
	}

	return 0;
}

Measured memory_bytes: 3196
import java.util.Scanner;

//Scanner sc = new Scanner(System.in);

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		
		if(B%A == 0) System.out.println(A + B);
		else System.out.println(B - A);
		
	}
}


Measured memory_bytes: 23636
#include<iostream>
using namespace std;
int main()
{
	int a,b;
	while(cin>>a>>b)
	{
		int sum = a+b;
		int count=0;
		while(sum>0)
		{
			count++;
			sum /=10;
		} 
		cout<<count<<endl;
	}
	return 0;
}

Measured memory_bytes: 1160
# -*- coding: utf-8 -*-
n = int(input())

def gcd(a,b):
    if b>a:
        a,b = b,a
    while b>0:
        a,b = b,a%b
    return a

def lcm(a,b):
    return a*b//gcd(a,b)

res = int(input())
for _ in range(n-1):
    t = int(input())
    res = lcm(res,t)

print(res)


Measured memory_bytes: 3060
#include<iostream>
#include<cmath>
#include<iomanip>
#include<string>
#include<vector>
#include<stack>
#include<cstdlib>
#include<queue>
#include<list>
#include<cctype>
using namespace std;

int main() {
    int a, b, c, d;
    cin>>a>>b>>c;
    d=b/a;
    if(d<=c)cout<<d<<endl;
    else cout<<c<<endl;
}


Measured memory_bytes: 256
#pragma GCC optimize("03")
#include <bits/stdc++.h>
#define ll long long

using namespace std;

int n, k, freq[200100];

int main(){
//	ifstream cin("tst.in");
//	ofstream out("tst.out");
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	cin >> n >> k;
	ll cnt = 0;
	ll cnt2 = 0;
	for(int i = 1; i <= n; i++)
		freq[i % k]++;
	for(int i = 1; i <= n; i++){
		int need = (k - (i % k)) % k;
		if((need + need) % k == 0){
			cnt += (ll) freq[need] * (ll) freq[need];
		//	cnt2 += (ll) freq[need];
		}
	}
	cout << cnt;
	return 0;
}

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

int main() {
    int A,B;
    cin >>A>>B;
    if(A>=13)cout<<B<<endl;
    else if(6<=A && A<=12)cout<<B/2<<endl;
    else cout<<0<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
#define VL vector<ll>
#define VS vector<string>
#define VB vector<bool>
#define VP vector<pair<ll,ll>>
#define VVL vector<vector<ll>>
#define VVP vector<vector<pair<ll,ll>>>
#define PL pair<ll,ll>
#define ALL(v) (v).begin(), (v).end()
ll d1[4] = {1, -1, 0, 0};
ll d2[4] = {0, 0, 1, -1};

int main(){
    ll H, W;
    cin >> H >> W;
    VVL a(H, VL(W));
    rep(h, 0, H){
        rep(w, 0, W) cin >> a[h][w];
    }
    vector<vector<ll>> ans;
    rep(h, 0, H){
        rep(w, 0, W-1){
            if(a[h][w] % 2 == 1){
                a[h][w+1]++;
                ans.push_back({h, w, h, w+1});
            }
        }
    }
    rep(h, 0, H-1){
        if(a[h][W-1] % 2 == 1){
            a[h+1][W-1]++;
            ans.push_back({h, W-1, h+1, W-1});
        }
    }
    cout << ans.size() << endl;
    for(auto e : ans){
        rep(i, 0, 4){
            cout << e[i]+1;
            if(i == 3) cout << "\n";
            else cout << " ";
        }
    }
    return 0;
}

Measured memory_bytes: 12848
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: 35736
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
#define ll  long long
#define endl '\n'
#define pi 3.14159265
ll h,w,a,b;
ll mod=1e9+7;
ll fact[500007];
ll p(ll a,ll b)
{
    ll res=1;
    while(b)
    {
        if(b%2!=0)
            res*=a;
        res%=mod;
        a*=a;
        a%=mod;
        b/=2;
    }
    return res;
}
ll modinv(ll x)
{
    return  p(x,mod-2);
}
ll f(ll a,ll b,ll c,ll d)
{
    ll ans=fact[c+d-a-b]*modinv(fact[c-a]);
    ans%=mod;
    ans*=modinv(fact[d-b]);
    return ans%mod;
}
int main()  
{     
    cin>>h>>w>>a>>b;
    fact[0]=1;
    for(ll i=1;i<=500006;i++)
    {
        fact[i]=i*fact[i-1];
        fact[i]%=mod;
    }
    ll ans=f(1,1,h,w);
    ll last=0;
    ll l=h-a+1;
    ll r=b;
    while(l<=h&&r>=1)
    {
        ll curr=f(1,1,l,r)*f(l,r,h,w);
        curr%=mod;
        curr=(curr-last+mod)%mod;
        ans=(ans-curr+mod)%mod;
        l++;
        r--;
    }
    cout<<ans;  
}   

Measured memory_bytes: 4096
// Created by Kshitij Anand NSIT
#include <bits/stdc++.h>
//#include <ext/numeric>
//using namespace __gnu_cxx;


using namespace std;


#define int long long
#define pb push_back
#define P pair<int,int>
#define F first
#define S second
#define vi vector<int>
#define vc vector<char>
#define vb vector<bool>
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define mp(a, b) make_pair(a, b)
#define min3(a, b, c) min(min(a, b), c)
#define min4(a, b, c, d) min(min(a, b), min(c, d))
#define max3(a, b, c) max(max(a, b), c)
#define max4(a, b, c, d) max(max(a, b), max(c, d))
#define fill(arr,val) memset(arr,val,sizeof(arr))
#define inf 1e18
#define ps(x,y) fixed<<setprecision(y)<<x
#define db(x)  cout<<#x<<" : "<<x<<endl


const int N = 1000000007;

void solve(){

    int n,a,b,c, ans=0, count=0, sum=0;
    cin>>n;
    int arr[n];

    if(n == 1){
        cout<<0<<endl;
    }

    else if(n == 0){

        cout<<1<<endl;
    }
    

}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    
    
   // int t; cin>>t; while(t--)
    {     
      solve();
    }

  return 0;
}


Measured memory_bytes: 3644
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
	int n;
	cin>>n;
	int a[n];
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
	}
	int dp[n];
	dp[0]=0;
	dp[1]=abs(a[1]-a[0]);
	for(int i=2;i<n;i++)
	{
		int sub1=abs(a[i]-a[i-1]);
		int sub2=abs(a[i]-a[i-2]);
		dp[i]=min(sub1+dp[i-1],sub2+dp[i-2]);
	}
	cout<<dp[n-1];
}

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

int main(){
  int N,Y;
  cin >> N >> Y;
  for (int a = 0; a <= N; a++){
    for (int b = 0; b <= N - a; b++){
      int total = 10000 * a + 5000 * b + 1000 * (N-a-b);
      if (total == Y) {
        cout << a << " " << b << " " << N-a-b << endl;
        return 0;
      }
    }
  }
  cout << "-1 -1 -1" << endl;
}

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

int main(void){
  char c;
  cin >> c;
  if(c == 'a' || c == 'i' || c == 'u' ||c == 'e' || c == 'o')cout << "vowel" << endl;
  else cout << "consonant" << endl;
}

Measured memory_bytes: 764