akhauriyash/Code-Regression huggingface dataset:
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <string>
#include <queue>
#include <unordered_map>
#include <iterator>
#include <stack>
#include <unordered_set>
#include <iomanip>
#include <ctime>
#include <cstring>
#include <bitset>

#include <random>
#define all(x) (x).begin(), (x).end()


using namespace std;
void dout() { cerr << endl; }
typedef long long ll;
template <typename Head, typename... Tail>
void dout(Head H, Tail... T) {
    cerr << H << ' ';
    dout(T...);
}

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

using ll = long long;
using pii = pair<ll, ll>;
using ld = long double;
using pll = pair<long long, long long>;

template <typename T>
void do_uniq(vector<T> vec) {
    sort(all(vec));
    vec.resize(unique(all(vec)) - vec.begin());
}

#define solvsh
//#define multi
#ifdef solvsh

const int MAXN = 1e5 + 20;

ll mod = 1e9 + 7;

ll gcd(ll x, ll y) {
    return y == 0 ? x : gcd(y, x % y);
}

ll add(ll a, ll b){
    return (a + b) % mod;
}

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

ll bin_p(ll b, ll p) {
    if (p == 0)
        return 1;
    if (p % 2 == 1)
        return ml(b, bin_p(b, p - 1));
    ll v = bin_p(b, p >> 1);
    return ml(v, v);
}

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

    map<pair<ll, ll>, ll> mp1;
    ll cnt0 = 0;

    for (int i = 0; i < n; ++i) {
        ll a, b;
        cin >> a >> b;

        if (a < 0) {
            a *= -1;
            b *= -1;
        }
        if (abs(a) == 0) {
            if (b != 0)
                b = 1;
            else {
                ++cnt0;
                continue;
            }
        } else if (abs(b) == 0) {
            a = 1;
        } else {
            ll g = gcd(abs(a), abs(b));
            a /= g;
            b /= g;
        }
        mp1[{a, b}]++;
    }

    ll answr = 1;

    while (!mp1.empty()) {

        auto e = mp1.begin();
        ll x = e->first.first;
        ll y = e->first.second;
        ll cnt = e->second;

        ll cnt1 = mp1[{-y, x}] + mp1[{y, -x}];

        mp1.erase({x, y});
        mp1.erase({-y, x});
        mp1.erase({y, -x});

        if (cnt1 != 0) {
            ll curr = add(bin_p(2, cnt), bin_p(2, cnt1));
            answr *= (mod + curr - 1) % mod;
            answr %= mod;
        } else {
            answr *= bin_p(2, cnt);
            answr %= mod;
        }
    }
    
    answr = mod + answr - 1;
    answr %= mod;
    
    answr += cnt0;
    answr %= mod;
    
    cout << answr;
}

#else

void solve() {

}

#endif

void multisolve() {

    int t;
    cin >> t;

    int i = 1;
    while (t--) {
//        cout << "Case #" << (i++) << ": ";
        solve();
        cout << "\n";
    }
}


#define int int
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr), cout.tie(nullptr);
    cout << fixed << setprecision(20);


#ifdef multi
    multisolve();
#else
    solve();
    //    gen();
#endif

}


Measured memory_bytes: 16016
#include <iostream>
#include <string>

int main() {
    std::string S, T;
    std::cin >> S >> T;

    for (auto i = 0; i < S.length(); i++) {
        if (S[i] != T[i]) {
            std::cout << "No" << std::endl;
            return 0;
        }
    }
    std::cout << "Yes" << std::endl;
}


Measured memory_bytes: 3628
#[allow(dead_code)]
fn main() {
    let (n, m) = (i::u(), i::u());
    let (a, b) = (i::cmap(n), i::cmap(m));
    let k = n - m + 1;
    let mut has = false;
    for i in 0..k {
        'case: for j in 0..k {
            for x in 0..m {
                for y in 0..m {
                    if a[x + i][y + j] != b[x][y] {
                        continue 'case;
                    }
                }
            }
            has = true;
        }
    }
    println!("{}", if has { "Yes" } else { "No" });
}

#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::io::*;
#[allow(unused_imports)]
use std::num::*;
#[allow(unused_imports)]
use std::str::*;

#[allow(dead_code)]
mod i {
    use super::*;

    pub fn read<T: FromStr>() -> T {
        stdin()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>()
            .parse::<T>()
            .ok()
            .unwrap()
    }

    pub fn str() -> String {
        read()
    }

    pub fn s() -> Vec<char> {
        str().chars().collect()
    }

    pub fn i() -> i64 {
        read()
    }

    pub fn u() -> usize {
        read()
    }

    pub fn f() -> f64 {
        read()
    }

    pub fn c() -> char {
        read::<String>().pop().unwrap()
    }

    pub fn iv(n: usize) -> Vec<i64> {
        (0..n).map(|_| i()).collect()
    }

    pub fn iv2(n: usize) -> Vec<(i64, i64)> {
        (0..n).map(|_| iv(2)).map(|a| (a[0], a[1])).collect()
    }

    pub fn uv(n: usize) -> Vec<usize> {
        (0..n).map(|_| u()).collect()
    }

    pub fn uv2(n: usize) -> Vec<(usize, usize)> {
        (0..n).map(|_| uv(2)).map(|a| (a[0], a[1])).collect()
    }

    pub fn fv(n: usize) -> Vec<f64> {
        (0..n).map(|_| f()).collect()
    }

    pub fn cmap(h: usize) -> Vec<Vec<char>> {
        (0..h).map(|_| s()).collect()
    }
}


Measured memory_bytes: 4352
n = int(input())

book = []

for i in range(n):
    line = input().split()
    name = line[0]
    score = int(line[1])
    number = i+1
    list = [name,score,number]
    book.append(list)

#sort
'''
book.sort(key=lambda x: x[n])でソート
-マイナス指定している・・・
'''
book.sort(key=lambda x: (x[0], -x[1]))
print("")
[print(item[2]) for item in book]


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

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

Measured memory_bytes: 256
#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>>n>>t;
	string s;
	cin>>s;
	map<char,char>opp;
	opp['L']='R';
	opp['R']='L';
	char pr=(char)(s[0]);	
	rep(i,1,n){
		if(t==0) break;
		if(s[i]!=pr){
			j=i;
			t--;
			while(j<n && s[j]==s[i]) j++;
			// trace(i,j,pr);
			rep(k,i,j) s[k]=opp[s[k]];
			i=j-1;
		}
	}
	// trace(s);
	rep(i,1,n){
		if(s[i]==s[i-1]) ans++;
	}
	ret(ans)
	return 0;
}

Measured memory_bytes: 512
package main

import (
	"fmt"
	"math"
)

var X int

func main() {
	fmt.Scan(&X)

	/* 1+2+3+...+t >= X となる最小のtを考える */
	var i int
	for i*(i+1)/2 < X {
		i++
	}
	fmt.Println(i)
}

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

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

func combination(x, y int) int {
	return permutation(x, y) / permutation(y, y)
}

func permutation(x, y int) int {
	var ans int = 1
	for i := x - y; 0 < i; i-- {
		ans *= i
	}
	return ans
}

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

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

func pow(x, y int) uint64 { return uint64(math.Pow(float64(x), float64(y))) }
func abs(x int) int       { return int(math.Abs(float64(x))) }
func floor(x int) int     { return int(math.Floor(float64(x))) }
func ceil(x int) int      { return int(math.Ceil(float64(x))) }

type si struct {
	s int
	i int
}

type SortBy []si

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


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

vector<char> v;
ll rec(string s1,string s2,ll n,ll m,string &s){
   /* for(int i=0;i<n;i++) cout<<s1[i];
    cout<<" ";
    for(int i=0;i<m;i++) cout<<s2[i];
    cout<<"\n";*/
    if(n==0 || m==0) return 0;
    ll a,b,c;
    if(s1[n-1]==s2[m-1]){
        v.push_back(s1[n-1]);
        s+=s1[n-1];
        a=1+rec(s1,s2,n-1,m-1,s);
        return a;
    }
    b=rec(s1,s2,n-1,m,s);
    c=rec(s1,s2,n,m-1,s);
    return max(b,c);
}

int main() {
    string s1,s2,s="";
    cin>>s1>>s2;
    ll n=s1.length(),m=s2.length();
    ll dp[n+1][m+1];
    for(int i=0;i<=n;i++) dp[i][0]=0;
    for(int i=0;i<=m;i++) dp[0][i]=0;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            if(s1[i-1]==s2[j-1]) dp[i][j]=1+dp[i-1][j-1];
            else dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
        }
    }
    
   /* for(int i=0;i<=n;i++){
        for(int j=0;j<=m;j++){
            cout<<dp[i][j]<<" ";
        }
        cout<<endl;
    }*/
    ll idx=dp[n][m],i=n,j=m;
    vector<char> v(idx);
    while(i>0 && j>0){
        if(s1[i-1]==s2[j-1]){
            v[idx-1]=s1[i-1];
            idx--;
            i--;j--;
        }
        else if(dp[i-1][j]>dp[i][j-1]) i--;
        else j--;
    }
    for(auto x:v) cout<<x;
}

Measured memory_bytes: 73964
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define cinf(n,x) for(int i=0;i<(n);i++)cin>>x[i];
#define ft first
#define sc second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define mod 1000000007
using namespace std;
typedef long long ll;
template<class T> using V=vector<T>;
using Graph = vector<vector<int>>;
using P=pair<ll,ll>;
typedef unsigned long long ull;
typedef long double ldouble;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//V,P(大文字)使用不可

const ll INF=1e18;

signed main(){
    ll n,m;
    cin>>n>>m;
    if(abs(n-m)>1) cout<<0<<endl;
    else{
        ll c1=1,c2=1;
        for(ll i=1;i<=n;i++) c1=(c1*i)%mod;
        for(ll i=1;i<=m;i++) c2=(c2*i)%mod;
        if(m==n) cout<<(2*c1*c2)%mod<<endl;
        else cout<<(c1*c2)%mod<<endl;
    }
}

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

int main()
{
  int n;
  cin >> n;
  vector<int> v(n);
  rep(i, n)
  {
    cin >> v[i];
  }
  sort(v.begin(), v.end());
  reverse(v.begin(), v.end());
  int a = 0, b = 0;
  rep(i, n)
  {
    if (i % 2 == 0)
    {
      a += v[i];
    }
    else
    {
      b += v[i];
    }
  }
  cout << a - b << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <climits>
#include <cmath>
#include <utility>
#include <string>
#include <cstring>
#include <functional>

using namespace std;

int n;

int main() {

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	cin >> n;
	cout << 3 * n * n << endl;
	

	return 0;
}

Measured memory_bytes: 256
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n,m;cin>>n>>m;
  priority_queue<int>Q;
  rep(i,n){
    ll x;cin>>x;
    Q.push(x);
  }
  rep(i,m){
    ll x=Q.top();
    Q.pop();
    Q.push(x/2);
  }
  ll ans=0;
  rep(i,n){
    ans+=Q.top();
    Q.pop();
  }
  cout<<ans<<endl;
}

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

int main() {
  int a;
  cin >> a;
  if(a > 10) {
    a = a % 10;
  }
  if(a == 2 || a == 4 || a == 5 || a == 7 || a == 9) {
      cout << "hon" << endl;
  } else if(a == 0 || a == 1 || a == 6 || a == 8) {
    cout << "pon" << endl;
  } else {
	  cout << "bon" << endl;
  }
}

Measured memory_bytes: 3588
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define RREP(i,n) for(int i=n;i>=0;i--)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
typedef long long ll;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//const ll INF = 1LL << 60;
//const int INF = 1001001001;

int main(void){
    int n;
    cin >> n;
    map<string, int> mp;
    REP(i,n){
        string s;
        cin >> s;
        mp[s]++;
    }
    int maxi=0;
    for(auto i=mp.begin();i!=mp.end();i++) chmax(maxi,i->second);
    for(auto i=mp.begin();i!=mp.end();i++) 
        if(i->second == maxi) cout << i->first << endl;
    return 0;
}

Measured memory_bytes: 19264
import math

n = int(input())
x = input().split()
x_list = [int(xi) for xi in x]
y = input().split()
y_list = [int(yi) for yi in y]
dm, de, d3, dc = 0, 0, 0, 0
d = []

i = 0
while n > i:
    d.append(abs(x_list[i] - y_list[i]))
    dm += d[i]
    i += 1

i = 0
while n > i:
    de += (x_list[i] - y_list[i]) ** 2
    i += 1
de = math.sqrt(de)

i = 0
while n > i:
    d3 += abs(x_list[i] - y_list[i]) ** 3
    i += 1
d3 = d3 ** (1/3)

print(dm)
print(de)
print(d3)
print(max(d))



Measured memory_bytes: 5700
#include <iostream>
#include <cstdio>

using namespace std;

int main()
{
    int K, S;
    int ans = 0;
    
    cin >> K >> S;
    
    for (int x = 0; x <= K; x++)
    {
        for (int y = 0; y <= K; y++)
        {
            if (x + y > S)
            {
                break;
            }
            if (S - x - y <= K)
            {
//                printf("x=%d, y=%d\n", x, y);
                ans++;
            }
        }
    }
    
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 256
N,M=map(int,input().split())
out1=set()
inN=set()
for i in range(M):
    a,b=map(int,input().split())
    if a==1:
        out1.add(b)
    elif b==N:
        inN.add(a)

print('POSSIBLE' if len(out1 & inN)>0 else 'IMPOSSIBLE')

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

using namespace std;
typedef long long ll;
#define int ll

#define REP(i,n) for(int i=0;i<n;++i)
#define ALL(name) name.begin(),name.end()
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000000007;
#define MAX_N 100010

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

    string S;
    cin >> S;
    for(int i = S.length() / 2 - 1; i >= 1; --i) {
        string s1 = S.substr(0, i);
        string s2 = S.substr(i, i);
        if(s1 == s2) {
            printf("%lld\n", i * 2);
            return 0;
        }
    }

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long int
#define endl "\n"
#define arrinp(v) for(auto &i:v) cin>>i;
#define arrout(v) for(auto &i:v) cout<<i<<" ";
#define newline cout<<endl;
using namespace std;
signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int t=1;
    // cin >> t;
    while (t--) {
        int n;
        cin>>n;
        if(n>=30){
            cout<<"Yes"<<endl;
        }
        else{
            cout<<"No"<<endl;
        }
    }
    return 0;
}

Measured memory_bytes: 3644
#include <cstdio>

const int MAXN = 2e5 + 5;
int N;
long long num[MAXN], ans;

int main() {
	scanf("%d", &N);
	for (int i = 1; i <= N; i++) {
		scanf("%lld", &num[i]);
		if (num[i] < num[i - 1]) {
			ans = ans + num[i - 1] - num[i];
			num[i] = num[i - 1];
		}
	}
	printf("%lld", ans);
	return 0;
}


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

using ll = long long;

#define mod 1000000007
#define REP(i, n) for (int i = 0; i < n; i++)

using namespace std;

//long C(long n, long r);
//long long gcd(long long a, long long b);
//long long lcm(long long a, long long b);
 

void solve() {
    int N;
    cin >> N;
    string s1, s2;
    cin >> s1 >> s2;
    int i = 0;
    ll ans = 1;
    bool prev;
    if(s1[i] == s2[i]){
        ans *= 3ll;
        prev = true;
        i++;
    }
    else{
        ans *= 6ll;
        prev = false;
        i += 2;
    }

    for(i;i < N; i++){
        if(s1[i] == s2[i]){
            if(prev) {
                ans = (ans * 2ll) % mod;
            }
            else{
                ans = (ans * 1ll) % mod;
            }
            prev = true;
        }
        else{
            if(prev) {
                ans = (ans * 2ll) % mod;
            }
            else{
                ans = (ans * 3ll) % mod;
            }
            prev = false;
            i++;
        }
    }
    cout << ans << endl;
}
 
int main() {
    solve();
    return 0;
}


Measured memory_bytes: 256
h,w = gets.split.map(&:to_i)
n = gets.to_i
a = gets.split.map(&:to_i)

x = []
a.each_with_index do |e,i|
    x += [i+1] * e
end

h.times do |i|
    y = x[i*w,w]
    y.reverse! if i.odd?
    puts y.join(" ")
end

Measured memory_bytes: 67404
#include<algorithm>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<map>
#include<queue>
#include<stack>
#include<vector>
#define size 500010
#define debug(x) cerr<<#x<<"="<<x
#define gc getchar()
#define db double
#define ll long long
#define rep(i,s,n) for (register int i=s;i<=n;i++)
#define drep(i,n,s) for (register int i=n;i>=s;i--)
#define il inline
using namespace std;

il ll r()
{
	char c; ll x,f=1;
	for (c=gc;!isdigit(c);c=gc) if (c=='-') f=-1; x=c-'0';
	for (c=gc;isdigit(c);c=gc) x=(x<<1)+(x<<3)+c-'0';
	return f*x;
}

ll n,m;

int main()
{
	n=r(); m=r();
	if (n==2||m==2) {cout<<0<<endl;return 0;}
	else if (n==1&&m==1) {cout<<1<<endl;return 0;}
	else if (n==1) {cout<<m-2<<endl;return 0;}
	else if (m==1) {cout<<n-2<<endl;return 0;}
	else cout<<1ll*(n-2)*(m-2)<<endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		a = a-b;
		if(a >0)System.out.println(a);
			else System.out.println(0);
	}
}


Measured memory_bytes: 21204
#include<iostream>
#include<string>

using namespace std;

int main() {
	int N, K, X, Y;	cin >> N >> K >> X >> Y;
	int answer = 0;
	if (K <= N) {
		answer = X * K + Y * (N - K);
	}
	else {
		answer = X * N;
	}
	cout << answer << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        sc.next();
        String s = sc.next();
        int max = 0;
        for (int i = 1; i < s.length(); i++) {
            Set s1 = new HashSet<Character>();
            for (char c : s.substring(0, i).toCharArray()) {
                s1.add(c);
            }
            int count = s1.size();
            for (char c : s.substring(i).toCharArray()) {
                s1.remove(c);
            }
            if (max < count - s1.size()) {
                max = count - s1.size();
            }
        }
        System.out.println(max);

    }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define MOD 1000000007
#define INF 1000000000
#define LINF 1000000000000000000
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define bit(n) (1LL<<(n))
using namespace std;

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

int main() {
    int H, A;
    cin >> H >> A;
    if (H % A == 0) cout << H / A << endl;
    else cout << H / A + 1 << endl;
    return 0;
}

Measured memory_bytes: 256
import numpy as np
n = int(input())
a = list( map(int, input().split()))

p = np.mean(a)

p1 = int(p)
p2 = p1 + 1

ans1 = 0
ans2 = 0
for i in range(n):
    ans1 += (a[i] - p1)**2
    ans2 += (a[i] - p2)**2



print(min(ans1, ans2))

Measured memory_bytes: 21292
n = int(input())
ls = list(map(int, input().split()))

count = 0
flag = 1
while flag:
    flag = 0
    for i in range(len(ls)-1, 0, -1):
        if ls[i] < ls[i-1]:
            ls[i], ls[i-1] = ls[i-1], ls[i]
            count += 1
            flag = 1
print(' '.join(map(str, ls)))
print(count)


Measured memory_bytes: 5600
//بِسْمِ اللَّهِ الرَّحْمَٰنِ الرَّحِيمِ
#include <bits/stdc++.h>
using namespace std;
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int a, b, c;
    cin >> a >> b >> c;
    int x = max(max(a, b), c);
    int s = (x - a) + (x - b) + (x - c);
    if(s % 2) cout << (s + 3)/2;
    else cout << s/2;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        int D =  Integer.parseInt(sc.next());
        int ans = (int)Math.ceil(N / ((D * 2)+1.0));
        System.out.println(ans);
    }
}

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

int main(){

    string s; cin >> s;
    int n = (int)s.size();

    int ok = 1;
    int ng = n + 1;
    while(ng - ok > 1){
        int d = (ok + ng) / 2;
        
        vector<int> vec(n, false);
        for(int i = d; i < n; i++){
            vec[i] = vec[n - i - 1] = true;
        }

        set<char> S;
        for(int i = 0; i < n; i++) if(!vec[i]) S.insert(s[i]);

        if(S.size() <= 1) ok = d;
        else ng = d;
    }

    cout << ok << endl;
    return 0;
}

Measured memory_bytes: 896
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
input=input.replace(/\/|\:/g," ").replace(/I/g,"1").replace(/O/g,"0");
var arr=input.trim().split("\n");
while(true){
   var n=arr.shift()-0;
   if(n==0)break;
   var obj={};
   var flag=false;
   while(n--){
      var MDhmep=arr.shift().split(" ").map(Number);
      (function(M,D,h,m,e,p){
         var time=M*30*24*60+D*24*60+h*60+m;
         if(p==0){
            if(e==1){
               flag=true;
               for(var k in obj){
                  if(obj[k][0]!=0)obj[k][0]=time;
               }
            }
            if(e==0){
               flag=false;
               for(var k in obj){
                  if(obj[k][0]!=0)obj[k][1]+=time-obj[k][0];
               }
            }
         }
         if(p!=0){
            if(!obj.hasOwnProperty(p))obj[p]=[0,0];
            if(e==1)obj[p][0]=time;
            if(e==0 && flag){
               obj[p][1]+=time-obj[p][0];
               obj[p][0]=0;
            }
            if(e==0 && !flag)obj[p][0]=0;
         }
      }).apply(null,MDhmep);
   }
   var max=0;
   for(var k in obj){
      if(obj[k][1]>max)max=obj[k][1];
   }
   console.log(max);
}

Measured memory_bytes: 22232
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#define rep(i,n) for(int (i) = 0; (i) < (n); ++(i))
#define ALL(v) v.begin(),v.end()
#define _Pi 3.1415926535
#define _MOD = 1e9+7;
using namespace std;
template<class T> inline T GCD(T a, T b){return b?GCD(b,a%b):a;}
template<class T> inline T LCM(T a, T b){return a*b/GCD(a,b);}
typedef long long ll;

int main(){
    int n,m; cin >> n >> m;
    vector<int> l(m),r(m); rep(i,m) cin >> l[i] >> r[i];
    
    cout << max(0,*min_element(ALL(r)) - *max_element(ALL(l)) + 1) << endl;

    return 0;
}


Measured memory_bytes: 1152
n = gets.to_i
ary = []
ans = 0
for a in 1..9 do
  for b in 1..9 do
    ary << a * b
  end
end
ary.each do |a|
  if a == n
    ans += 1
  end
end

if ans >= 1
  puts "Yes"
else
  puts "No"
end

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

using namespace std;
using ll = long long;
using IP = pair<int, int>;

const ll INF = 1LL << 62;
#define atcoder(int)1e9+7
#define Endl endl
#define mp make_pair
#define all(v) v.begin(),v.end()
#define pb push_back

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

ll lcm(ll a, ll b) {//最小公倍数
	return (a / gcd(a, b))*b;
}

int main(){

	string s;

	cin >> s;

	for (int i = 0; i < 2; i++) {
		if (s[i] == s[i + 1] && s[i + 1] == s[i + 2]) {
			cout << "Yes" << endl;
			return 0;
		}
	}

	cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPLL(i, n) for (ll i = 0; i < (ll)(n); i++)
using namespace std;
template<class T>inline bool chmax(T &a, const T &b){if(a < b){a = b; return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if(a > b){a = b; return 1;}return 0;}
typedef long long ll;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N; cin >> N;
  string S; cin >> S;
  stack<char> st;
  deque<char> dq;
  REP(i, N){
    if(S[i] == '('){
      st.push('(');
      dq.push_back('(');
    }else if(S[i] == ')' && st.empty()){
      dq.push_front('(');
      dq.push_back(')');
    }else{
      dq.push_back(')');
      st.pop();
    }
  }
  if(!st.empty()){
    REP(i, st.size()){
      dq.push_back(')');
    }
  }
  while(!dq.empty()){
    char ans = dq.front(); dq.pop_front();
    cout << ans;
  }
  cout << endl;
}

Measured memory_bytes: 3624
if __name__ == '__main__':
    tmp = int(input())
    l = [2, 1]
    ans = 0
    if tmp <= 1:
        ans = l[tmp]
        print(ans)
        exit()
    for i in range(tmp - 1):
        ans = l[i] + l[i + 1]
        l.append(ans)
    print(ans)

Measured memory_bytes: 3060
import java.util.*;
class Main{
  public static void main(String[] args){
    Scanner scan=new Scanner(System.in);
    int N=scan.nextInt();
    int[] A=new int[N];
    int[] B=new int[N];
    int[] C=new int [N];
    for(int i=0;i<N;i++){
      A[i]=scan.nextInt();
    }
    for(int i=0;i<N;i++){
      B[i]=scan.nextInt();
    }
    for(int i=0;i<N-1;i++){
      C[i]=scan.nextInt();
    }
    int sum=0;
    int before=A[0];
    for(int i=0;i<N;i++){      
      sum+=B[A[i]-1];
      if(A[i]==before+1){
        sum+=C[before-1];
      }
      before=A[i];
    }
        System.out.println(sum);
      }
    }

Measured memory_bytes: 23252
#include<bits/stdc++.h>
typedef long long ll;
ll gi(){
	ll x=0,f=1;
	char ch=getchar();
	while(!isdigit(ch))f^=ch=='-',ch=getchar();
	while(isdigit(ch))x=x*10+ch-'0',ch=getchar();
	return f?x:-x;
}
std::mt19937 rnd(time(NULL));
#define rand rnd
#define pr std::pair<int,int>
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
template<class T>void cxk(T&a,T b){a=a>b?a:b;}
template<class T>void cnk(T&a,T b){a=a<b?a:b;}
#ifdef mod
int pow(int x,int y){
	int ret=1;
	while(y){
		if(y&1)ret=1ll*ret*x%mod;
		x=1ll*x*x%mod;y>>=1;
	}
	return ret;
}
template<class Ta,class Tb>void inc(Ta&a,Tb b){a=a+b>=mod?a+b-mod:a+b;}
template<class Ta,class Tb>void dec(Ta&a,Tb b){a=a>=b?a-b:a+mod-b;}
#endif
int h[100010],f[100010];
int main(){
#ifdef LOCAL
	freopen("in.in","r",stdin);
	//freopen("out.out","w",stdout);
#endif
	int n=gi(),k=gi();
	for(int i=1;i<=n;++i)h[i]=gi(),f[i]=1e9;
	f[1]=0;
	for(int i=1;i<=n;++i)
		for(int j=1;j<=k&&j+i<=n;++j)cnk(f[i+j],f[i]+abs(h[i]-h[i+j]));
	printf("%d\n",f[n]);
	return 0;
}



Measured memory_bytes: 1024
#include<stdio.h>
int main()
{
    int a,b,t,gcd;
    scanf("%d %d",&a,&b);
    if(a==0) gcd=a;
    else if(b==0) gcd=b;
    else
    {
        while(b!=0)
        {
            t=b;
            b=a%b;
            a=t;
        }
        gcd=a;
    }
    printf("%d\n",gcd);

    return 0;
}



Measured memory_bytes: 2140
package main

import "fmt"

func main() {
	var a, b, c, d, e, k int
	fmt.Scan(&a)
	fmt.Scan(&b)
	fmt.Scan(&c)
	fmt.Scan(&d)
	fmt.Scan(&e)
	fmt.Scan(&k)
	if e - a > k {
		fmt.Println(":(")
	} else {
		fmt.Print("Yay!")
	}
}

Measured memory_bytes: 512
<?php

$n = (int)trim(fgets(STDIN));
$a = (int)trim(fgets(STDIN));
$b = (int)trim(fgets(STDIN));
$c = (int)trim(fgets(STDIN));
$d = (int)trim(fgets(STDIN));
$e = (int)trim(fgets(STDIN));

$ary = [$a, $b, $c, $d, $e];

$min = min($ary);

echo (int)ceil($n / $min) + 4;

Measured memory_bytes: 4604
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String S = in.nextLine();
		int odd0 = 0;
		int odd1 = 0;
		int even0 = 0;
		int even1 = 0;
		for(int i=0;i<S.length();i++) {
			char c = S.charAt(i);
			if(i%2==0) {
				if(c=='0') even0++;
				else even1++;
			}else {
				if(c=='0') odd0++;
				else odd1++;
			}
		}
		System.out.println(Math.min(odd0+even1, odd1+even0));
		in.close();
	}

}


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

int main(){
    int h,w,k;
    cin >> h >> w >> k;
    vector<vector<int>> c(h, vector<int>(w));
    rep(i,h) {
        rep(j,w) {
            char s;
            cin >> s;
            if(s == '.') c[i][j] = 0;
            if(s == '#') c[i][j] = 1;
        }
    }
    vector<vector<int>> cc(h, vector<int>(w));
    vector<vector<int>> ccc(h, vector<int>(w));
    cc = c;
    ccc = c;

    int ans = 0;

    rep(s,1<<h) {
        rep(i,h) {
            if(s>>i&1){
                rep(j,w) c[i][j] = 2;
            }
        }
        cc = c;
        rep(t,1<<w) {
            rep(j,w) {
                if(t>>j&1){
                    rep(i,h) c[i][j] = 2;
                }
            }

            int count = 0;
            rep(i,h) {
                rep(j,w) {
                    if(c[i][j] == 1) count++;
                }
            }
            if(count == k) ans++;
            c = cc;
        }
        c = ccc;
        cc = ccc;
    }

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

Measured memory_bytes: 3628
#include "vector"
#include "set"
#include "map"
#include "unordered_set"
#include "unordered_map"
#include "string"
#include "iostream"
#include "algorithm"
#include "queue"

using namespace std;

#define ll long long
#define INF 2e9
#define MOD 998244353

typedef vector<int> vi;
typedef pair<int, int> pii;


template<typename T>
ostream& operator<<(ostream& os, const vector<T>& v) {
    bool first = true;
    for (const auto& x : v) {
        if (!first) {
            os << " ";
        }
        first = false;
        os << x;
    }
    return os;
}

template<typename T>
istream& operator>>(istream& is, vector<T>& v) {
    for (auto& elem : v) {
        is >> elem;
    }
    return is;
}


void solve() {
    int n, m;
    cin >> n >> m;
    vi a(n);
    cin >> a;

    sort(a.begin(), a.end());
    ll sum = 0;
    for (int i=0; i<n; i++) {
        sum += a[i];
    }

    if (a[n-m] * 4 * m >= sum) {
        cout << "Yes";
    } else {
        cout << "No";
    }
}

int main() {
    ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);

    if (0) {
        int tests;
        cin >> tests;
        for (int i=1; i<= tests; i++) {
            //cout << "Case #" << i << ": ";
            solve();
            cout << endl;
        }
    } else {
        solve();
        cout << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>

using namespace std;

int a, b, ans;

bool bl(int);

int main() {
  scanf("%d%d", &a, &b);
  for(int i = a; i <= b; i++) {
    if(bl(i)) ans++;
  }
  printf("%d\n", ans);
  return 0;
}

bool bl(int x) {
  if(x >= 10000) {
    if(x / 10000 == x % 10 && x % 10000 / 1000 == x % 100 / 10)
      return true;
  }
  return false;
}


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

using namespace std;

typedef long long ll;

#define sz(x) ((int)(x).size())
#define in(x) int x;cin>>x
#define inn(x, y) int x,y;cin>>x>>y
#define innn(x, y, z) int x,y,z;cin>>x>>y>>z
#define bit(n) (1<<(n))

#define out(x) cout<<(x)<<endl;
#define err(x) cerr<<(x)<<endl;
#define errr(x,y) cerr<<(x)<<" "<<(y)<<endl;

#define rep(i,n) for (int i=0;i<(n);i++)
#define repp(i,n) for (int i=1;i<=(n);i++)
#define reppp(j, i, n) for (int j=i+1; j<n; j++)

#define lim5 100002
#define lim9 1000000002

#define deg(rad) (((rad)/2/M_PI)*360)
#define pow(x) (x)*(x)
#define mid(min, max) ((min + max) / 2)

int main() {
	inn(a, b);

	out(6 - a - b);

	return 0;
}


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

using namespace std;

int main() {
	int N, M;
	cin >> N>>M;
	vector<vector<int>> data(N, vector<int>(3));
	for (int i = 0; i < N; i++) {
		cin >> data.at(i).at(0);
	}
	int A, B;
	for (int i = 0; i < M; i++) {
		cin >> A >> B;
		if (data.at(A - 1).at(0) > data.at(B - 1).at(0)) {
			data.at(A - 1).at(1)++;
			data.at(A - 1).at(2)++;
			data.at(B - 1).at(1)++;
			data.at(B - 1).at(2)--;
		}
		else if (data.at(A - 1).at(0) < data.at(B - 1).at(0)) {
			data.at(A - 1).at(1)++;
			data.at(A - 1).at(2)--;
			data.at(B - 1).at(1)++;
			data.at(B - 1).at(2)++;
		}
		else {
			data.at(A - 1).at(1)++;
			data.at(B - 1).at(1)++;
		}
	}
	int count = 0;
	for (int i = 0; i < N; i++) {
		if (data.at(i).at(1) == data.at(i).at(2)) {
			count++;
		}
	}
	cout << count << endl;
}

Measured memory_bytes: 8736
//পূর্ণিমা সন্ধ্যায় তোমার রজনী গন্ধায়
//রূপসাগরের পাড়ের পানে উদাসী মন ধায়
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define pii pair <int, int>
#define vi vector <int>
typedef long long ll;
const long long M = 1e5 + 20, MX = 1e6 + 20, mod = 998244353;
ll ara[2 * M], inv[MX];
vi dvs[MX];
void invrs (ll m) {
    inv[1] = 1;
    for (ll i = 2; i <= m; i++) {
        inv[i] = (mod - ((mod / i) * inv[mod % i]) % mod) % mod;
//        if (i == 2) cout << "inv " << inv[i] << endl;
    }
}
ll mx = 0, sm = 0, ans = 0, csm[MX], cnt[MX];
int main () {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> ara[i];
        cnt[ara[i]]++;
        sm = (sm + ara[i]) % mod;
        mx = max(mx, ara[i]);
    }
    invrs(mx);
    for (int i = 1; i <= mx; i++) {
        for (int j = i; j <= mx; j+= i) {
            dvs[j].pb(i);
            if (cnt[j] > 0) csm[i] = (csm[i] + (cnt[j] * j)) % mod;
        }
    }
    for (int i = 1; i <= mx; i++) {
        csm[i] = (csm[i] * csm[i]) % mod;
        //cout << i << " " << csm[i] << endl;
    }
    for (int i = mx; i >= 1; i--) {
        ans = (ans + csm[i] * inv[i]) % mod;
        //cout << i << " " << csm[i] << " " << inv[i] << endl;
        //cout << ans << endl;
        for (int j : dvs[i]) {
            csm[j] = (csm[j] + (mod - csm[i])) % mod;
        }
    }
    ans = ((ans + mod - sm % mod) * inv[2]) % mod;
    cout << ans << endl;
return 0;
}


Measured memory_bytes: 139776
#include<bits/stdc++.h> 
using namespace std; 
//python interactive_runner.py python3 local_testing_tool.py 0 -- ./Code
 
#define x first
#define y second
#define rep(i, a,b) for(int i = int(a); i < int(b); ++i)
#define forn(i,b) for(int i = 0; i < int(b); ++i)
const long long INF =1000000000000000000;

void solve(){
	int N;
	cin>>N;
	long long prod = 1;
    int f0 = 0;
	forn(i,N){
		long long a;
		cin>>a;
		if(a==0){
			cout<<0<<'\n';
			return;
		}
		
		if(INF/a<prod){
			f0 = 1;
		}	
		prod = prod * a;	
	}
	if(f0){
		cout<<-1<<'\n';
		return;
	} 
	cout<<prod<<'\n';
//	long long A;
//	string B;
//	cin>>A>>B;
//	int st = ((B[0]-'0')*100)+((B[2]-'0')*10)+((B[3]-'0'));
//	cout<<(A*st)/100<<'\n';
}
int main(){

	 solve();
	return 0;
}

Measured memory_bytes: 3648
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>

typedef long long ll;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	else { return b; }
}

ll min(ll a, ll b) {
	if (a < b) { return a; }
	else { return b; }
}
int main() {

	ll N, A, B;

	scanf("%lld %lld %lld",&N,&A,&B);

	if ((B - A) % 2ll == 0ll) {
		printf("%lld\n",(B-A)/2ll);
	}
	else {
		printf("%lld\n",min(((B-A-1ll)/2ll)+A,((B-A-1ll)/2ll)+(N-B+1ll)));
	}

	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(int)(a); (i)<(int)(b); ++(i))
#define rFor(i, a, b) for(int (i)=(int)(a)-1; (i)>=(int)(b); --(i))
#define rep(i, n) For(i, 0, n)
#define rrep(i, n) rFor(i, n, 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> pii;
typedef pair<lint, lint> pll;
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;}
template<class T> T div_floor(T a, T b){
    if(b < 0) a *= -1, b *= -1;
    return a>=0 ? a/b : (a+1)/b-1;
}
template<class T> T div_ceil(T a, T b){
    if(b < 0) a *= -1, b *= -1;
    return a>0 ? (a-1)/b+1 : a/b;
}

constexpr lint mod = 1000000007;
constexpr lint INF = mod * mod;
constexpr int MAX = 100010;

int n, m;

void solve(){
    int hp[n];
    rep(i, n) scanf("%d", &hp[i]);
    scanf("%d", &m);
    vector<pii> single, all; // (mp, damage)
    rep(_, m){
        string name, target;
        lint mp, damage;
        cin >> name >> mp >> target >> damage;
        if(target == "Single") single.emplace_back(mp, damage);
        else all.emplace_back(mp, damage);
    }

    lint all_cost[MAX];
    fill(all_cost, all_cost + MAX, INF);
    all_cost[0] = 0;
    rep(i, all.size()){
        rep(j, MAX)if(all_cost[j] < INF){
            chmin(all_cost[min(MAX - 1, j + all[i].se)], min(INF, all_cost[j] + all[i].fi));
        }
    }

    lint single_cost[MAX];
    fill(single_cost, single_cost + MAX, INF);
    single_cost[0] = 0;
    rep(i, single.size()){
        rep(j, MAX)if(single_cost[j] < INF){
            chmin(single_cost[min(MAX - 1, j + single[i].se)], min(INF, single_cost[j] + single[i].fi));
        }
    }
    rrep(i, MAX - 1) chmin(single_cost[i], single_cost[i + 1]);
    
    lint ans = INF;
    rep(all_damage, MAX){
        lint tmp = all_cost[all_damage];
        rep(i, n){
            tmp += single_cost[max(0, hp[i] - all_damage)];
            chmin(tmp, INF);
        }
        chmin(ans, tmp);
    }
    printf("%lld\n", ans);
}

int main(){
    while(scanf("%d", &n) && n){
        solve();
    }
}


Measured memory_bytes: 4740
#!/usr/bin/env python3
n = int(input())
a = list(map(int, input().split()))
l = [0] * (n + 2)
for i in range(n):
    l[i + 1] = l[i] ^ a[i]
r = [0] * (n + 2)
for i in range(1, n + 1)[::-1]:
    r[i] = r[i + 1] ^ a[i - 1]
ans = [0] * n
for i in range(n):
    ans[i] = l[i] ^ r[i + 2]
print(*ans, sep=" ")


Measured memory_bytes: 43496
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<numeric>
#include<iomanip>
#include<deque>
#include<tuple>
#include<queue>
#include<map>
#include<cstdint>
#include<unordered_map>
#include<boost/multiprecision/cpp_int.hpp>


#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define vi vector<int>
#define all(x) (x).begin(),(x).end()
#define Endl endl
#define F first
#define S second

namespace mp = boost::multiprecision;

using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;


int main() {
	vector<vi>c(3, vi(3));
	rep(i, 3) {
		rep(j, 3) {
			cin >> c[i][j];
		}
	}
	deque<int>aa, bb;
	rep(i, 2) {
		rep(j, 3) {
			aa.push_back(c[i][j] - c[i+1][j]);
		}
	}
	rep(j, 2) {
		rep(i, 3) {
			bb.push_back(c[i][j] - c[i][j + 1]);
		}
	}

	bool ans = true;
	rep(i, 2) {
		if (  (aa[i]     != aa[i + 1]) 
			or(aa[i + 3] != aa[i + 4])
			or(bb[i]     != bb[i + 1])
			or(bb[i + 3] != bb[i + 4]) ){
			ans = false;
		}
    }
	if (ans) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}



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

class Main{
    public static void main(String[] args){
        FastScanner fsc=new FastScanner();
        char a=fsc.next().charAt(0);
        char b=fsc.next().charAt(0);
        fsc.close();
        if(a=='H'){
            if(b=='H') System.out.println('H');
            else System.out.println('D');
        }
        else{
            if(b=='H') System.out.println('D');
            else System.out.println('H');
        }
    }
    static class FastScanner {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;
        private boolean hasNextByte(){
            if(ptr<buflen) return true;
            else{
                ptr = 0;
                try{
                    buflen = in.read(buffer);
                }
                catch(IOException e){
                    e.printStackTrace();
                }
                if(buflen<=0) return false;
            }
        return true;
        }
        private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
        private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
        public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
        public String next() {
            if (!hasNext()) throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while(isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }
        public long nextLong() {
            if (!hasNext()) throw new NoSuchElementException();
            long n = 0;
            boolean minus = false;
            int b = readByte();
            if (b == '-') {
                minus = true;
                b = readByte();
            }
            if (b < '0' || '9' < b) throw new NumberFormatException();
            while(true){
                if ('0' <= b && b <= '9') {
                    n *= 10;
                    n += b - '0';
                }
                else if(b == -1 || !isPrintableChar(b)) return minus ? -n : n;
                else throw new NumberFormatException();
                b = readByte();
            }
        }
        public int nextInt() {
            long nl = nextLong();
            if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
            return (int) nl;
        }
        public double nextDouble() { return Double.parseDouble(next());}
        public void close(){
            try{in.close();}
            catch(IOException e){e.printStackTrace();}
        }
    }
}


Measured memory_bytes: 23252
fun main(args: Array<String>) {
    var (H,W) = readLine()!!.split(" ").map(String::toInt)
    var a = (H/2).toInt()
    var b = (H/3).toInt()
    var c = (W/2).toInt()
    var d = (W/3).toInt()
    var pattern = mutableListOf(a+d+1,b+c+1,H,W)
    if(H%3 == 0 || W%3 == 0) pattern.add(0)
    if(H%2==0) pattern.add(a)
    if(W%2 == 0) pattern.add(c)
    
    println(pattern.min()!!)
}


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

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 FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define br() p("")
#define pn(s) cout << (#s) << " " << (s) << endl
#define p_yes() p("Yes")
#define p_no() p("No")

const ll mod = 1e9 + 7;
const ll inf = 1e18;

// a^b mod p
ll mod_pow(ll a, ll b){
    if(b==0) return 1;
 
    // 肩が奇数
    if(b%2==1){
        return a * mod_pow(a, b-1) % mod;
    }
    else{
        return mod_pow(a*a % mod, b/2) % mod;
    }
}

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

    // input
    string s;
    cin >> s;
    ll L = s.size();

    ll sum = 0;
    ll num = 0;
    FOR(i, 0, L){
        if(s[i]=='1'){
            ll len = L - i - 1;
            sum += mod_pow(2LL, num) * mod_pow(3LL, len) % mod;
            sum %= mod;
            num++;
        }
    }
    sum += mod_pow(2LL, num);
    sum %= mod;
    p(sum);
    
    return 0;
}

Measured memory_bytes: 512
/*input
100
200
300
400
500
600
700
800
900
900
*/
fn main() {
    let mut v: Vec<u16> = Vec::new();
    let mut input;
    for _ in 0..10 {
        input = format!("");
        std::io::stdin().read_line(&mut input).expect("");
        v.push(input.trim().parse().expect(""));
    }
    v.sort();
    v.reverse();
    for i in 0..3 {
        println!("{}", v[i]);
    }
}



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

int main(){

    int n,k;
    cin >> n >> k;
    vector<int> h(n);
    for(int i=0; i<n; i++) cin >> h.at(i);

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

    int ans=1e9,d;
    for(int i=0; i<n-k+1; i++){
        d=h.at(k+i-1)-h.at(i);
        ans=min(ans,d);
    }
    cout << ans << endl;
}


Measured memory_bytes: 3708
package main

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

var (
	scanner = bufio.NewScanner(os.Stdin)
	w       = bufio.NewWriter(os.Stdout)
)

func readInt() (read int) {
	scanner.Scan()
	read, err := strconv.Atoi(scanner.Text())
	if err != nil {
		panic(err)
	}
	return
}

func main() {
	scanner.Split(bufio.ScanWords)
	defer w.Flush()
	x := readInt()
	y := readInt()

	if y%2 == 1 {
		fmt.Println("No")
		return
	}

	if y >= 2*x && y <= 4*x {
		fmt.Println("Yes")
		return
	}

	fmt.Println("No")
}


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

#define int long long

vector<vector<int>>e(1e5);

vector<int>aoki(1e5,1e9), taka(1e5,0);

vector<bool>flag(1e5,false);



void aoki_bfs(int node,int cnt){
    aoki[node] = cnt;
    for(int i=0;i<e[node].size();i++){
        if(flag[e[node][i]]==false){
            flag[e[node][i]]=true;
            aoki_bfs(e[node][i],cnt+1);
        }
    }
}

void taka_bfs(int node,int cnt){
    taka[node] = cnt;
    for(int i=0;i<e[node].size();i++){
        if(flag[e[node][i]]==false){
            flag[e[node][i]]=true;
            taka_bfs(e[node][i],cnt+1);
        }
    }
}

signed main(void){
    int n,u,v; cin >> n >> u >> v;u--;v--;
    for(int i=0;i<n-1;i++){
        int a,b; cin >> a >> b; a--;b--;
        e[a].push_back(b);
        e[b].push_back(a);
    }

    // for(int i=0;i<n;i++){
    //     for(int j=0;j<e[i].size();j++){
    //         cout << e[i][j] << ' ';
    //     }cout << endl;
    // }


    for(int i=0;i<n;i++)flag[i] = false;
    flag[u]=true;
    taka_bfs(u,0);
    for(int i=0;i<n;i++)flag[i] = false;
    flag[v] = true;
    aoki_bfs(v,0);

    // cout << endl;
    // for(int i=0;i<n;i++){
    //     cout << aoki[i] << ' ' << taka[i] << endl;
    // }cout << endl;

    int ans = 0;
    for(int i=0;i<n;i++){
        if(taka[i]<aoki[i]){
            int tmp = aoki[i]-1;
            if(ans < tmp) ans = tmp;
        } 
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 9984
#include <stdio.h>

int main(void) {
  int H,W;
  int h,w;

  while (1) {
    scanf("%d %d", &H, &W);
    if (H == 0 && W == 0) break;

    for (h = 0; h < H; h++) {
      for (w = 0; w < W; w++) {
        printf("#");
      }
      printf("\n");
    }
    printf("\n");
  }
  return (0);
}



Measured memory_bytes: 2048