akhauriyash/Code-Regression huggingface dataset:
/*
ID: Sho10
LANG: C++
TASK:race
*/
#include <bits/stdc++.h> //Andrei Alexandru a.k.a Sho10
#define ll long long int
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#define all(a) (a).begin(), (a).end()
#define sz size
#define f first
#define s second
#define pb push_back
#define er erase
#define in insert
#define mp make_pair
#define pi pair
#define rc(s) return cout<<s,0
#define endl '\n'
#define mod 1000000007
#define PI 3.14159265359
#define CODE_START  ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
ll n,h,x;
int32_t main(){
CODE_START;
cin>>h>>n;
for(ll i=0;i<n;i++)
{
    cin>>x;
    h=h-x;
}
if(h>0){
        cout<<"No"<<endl;
}else cout<<"Yes"<<endl;
}




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

int main()
{
    int n;
    cin >> n;
    vector<pair<int, int>> p;
    int a;
    rep(i, n) {
        cin >> a;
        pair<int, int> q(a, i+1);
        p.push_back(q);
    }

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

    rep(i, n) {
        cout << p.at(i).second << " ";
    }
    cout << endl;
    return 0;
}

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

int main() {
  int k;
  cin >> k;
  int v[32] = { 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14,
               1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51 };
  cout << v[k - 1] << endl;
}


Measured memory_bytes: 256
num = 0
def marge_sort(array):
    global num
    if len(array) < 2: return array
    
    mid = len(array) // 2
    left = marge_sort(array[:mid])
    right = marge_sort(array[mid:])
    
    len_l, len_r = len(left), len(right)
    left += [float("inf")]
    right += [float("inf")]
    
    marray = [0] * (len_l + len_r)
            
    l, r = 0, 0
    for i in range(len_l + len_r):
        if left[l] <= right[r]:
            marray[i] = left[l]
            l += 1
            num += r
        else:
            marray[i] = right[r]
            r += 1

    return marray

n = int(input())
a = list(map(int, input().split()))

marge_sort(a)
print(num)



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

int main(){
    int a, b, sum=0;
    cin >> a >> b;
    a--, b--;
    if(a>0)sum += a*(a+1) / 2;
    if(b>0)sum += b*(b+1) / 2;
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 256
import std.algorithm, std.typetuple, std.stdio, std.string, std.conv;

immutable difs = [
    [[0, 0], [-1, 0], [0, -1], [1, 0], [0, 1]],
    [[0, 0], [-1, 0], [0, -1], [1, 0], [0, 1], [1, 1], [-1, -1], [1, -1], [-1, 1]],
    [[0, 0], [-1, 0], [0, -1], [1, 0], [0, 1], [1, 1], [-1, -1], [1, -1], [-1, 1], [-2, 0], [0, -2], [2, 0], [0, 2]],
];

void main()
{
    int[][] a = new int[][](10, 10);
    foreach(line;stdin.byLine)
    {
        auto input = line.split(",").map!(to!int);
        foreach(dif;difs[input[2] - 1])
        {
            int x = input[0] + dif[0],
                y = input[1] + dif[1];
            if(x < 0 || x >= 10 || y < 0 || y >= 10) continue;
            ++a[y][x];
        }
    }
    writeln(a.joiner.count(0), "\n", a.joiner.reduce!max);
}

Measured memory_bytes: 1084
import sys
a = input().strip()

b = ['+', '-']

for i in b:
    for j in b:
        for k in b:
            c = a[0] + i + a[1] + j + a[2] + k + a[3]
            ans = int(c[0])
            if c[1] == '+':
                ans += int(c[2])
            else:
                ans -= int(c[2])
            if c[3] == '+':
                ans += int(c[4])
            else:
                ans -= int(c[4])
            if c[5] == '+':
                ans += int(c[6])
            else:
                ans -= int(c[6])
            if ans == 7:
                print(c+'=7')
                sys.exit()

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
long long n,k,i,a[10005],ans;
int main(){
	cin>>n>>k;
	for(i=1;i<=n;i++)
	cin>>a[i];
	sort(a+1,a+n+1);
	for(i=1;i<=k;i++){
		ans+=a[i];
	}
	cout<<ans;
}

Measured memory_bytes: 3636
i = gets.split("").map(&:to_i)
k=0
l=0
(i.count-1).times{|n|
if i[n] != n%2 then
    k +=1
end
  m = n+1
if i[n] != m%2 then
    l +=1
end
}
  
if k > l then
    print l
else
    print k
end

Measured memory_bytes: 9596
import java.util.*;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int p = sc.nextInt();
    int q = sc.nextInt();
    int r = sc.nextInt();

    int[] data = new int[3];

    data[0] = p + q;
    data[1] = q + r;
    data[2] = r + p;

    int min = data[0];

    for(int i = 0;i < 3;i++) min = Math.min(min,data[i]);

    System.out.println(min);


  }

}


Measured memory_bytes: 21844
d = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k = gets.to_i
puts d[k-1]


Measured memory_bytes: 1788
#include <iostream>
#include <string>
#include <deque>

int main()
{
    std::string initial;
    std::cin >> initial;

    int queryCount = 0;
    std::cin >> queryCount;

    std::deque<std::string::value_type> work(initial.begin(), initial.end());
    auto inverted = false;
    for (auto count = 0; count < queryCount; ++count)
    {
        int instruction = 0;
        std::cin >> instruction;
        if (instruction == 1)
        {
            inverted = !inverted;
        }
        else
        {
            int option = 0;
            std::cin >> option;
            auto optionInvert = inverted;
            if (option == 1)
            {
                optionInvert = !optionInvert;
            }

            auto append = '\0';
            std::cin >> append;

            if (optionInvert)
            {
                work.push_front(append);
            }
            else
            {
                work.push_back(append);
            }
        }
    }

    if (inverted)
    {
        std::cout << std::string(work.rbegin(), work.rend());
    }
    else
    {
        std::cout << std::string(work.begin(), work.end());
    }
    
    return 0;
}

Measured memory_bytes: 1280
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define all(v) v.begin(), v.end()

ll mpow(ll a, ll b){
	if(b==0){
		return a;
	}else if(b%2==0){
		ll memo = mpow(a,b/2);
		return memo*memo%MOD;
	}else{
		return mpow(a,b-1) * a % MOD;
	}
}

vector<int> p;

int find(int a){
	if(p[a] == a) return a;
	return p[a] = find(p[a]);
}

void unite(int a, int b){
	p[find(a)] = find(b);

}



int main(void){
	ll n;
	cin>>n;
	ll x,y;
	vector<pair<ll,ll>> row;
	rep(i,n){
		cin>>x>>y;
		row.push_back(pair<ll,ll>{y,x});
	}


	sort(all(row));

	rep(i,100005){
		p.push_back(i);
	}
	ll memo = -1;
	rep(i,n){
		if(memo == row[i].first){
			unite(row[i].second, row[i-1].second);
		}
		memo = row[i].first;
	}

	vector<vector<pair<ll,ll>>> hoge;
	rep(i,100005){
		hoge.push_back(vector<pair<ll,ll>>());
	}

	rep(i,n){
		x = row[i].second;
		y = row[i].first;
		hoge[find(x)].push_back(pair<ll,ll>{x,y});
	}

	ll ans = 0;
	reps(i,hoge.size()-1){
		if(hoge[i].size() > 0){
			ll cx = 0, cy=0;
			vector<ll> X,Y;
			rep(j,hoge[i].size()){
				X.push_back(hoge[i][j].first);
				Y.push_back(hoge[i][j].second);
			}
			sort(all(X));
			sort(all(Y));
			ll memox=-1,memoy=-1;
			rep(j,X.size()){
				if(memox != X[j]){
					cx++;
					memox = X[j];
				}
				if(memoy != Y[j]){
					cy++;
					memoy = Y[j];
				}
			}
			ans += cx * cy - X.size();
			//cout<<cx<<" "<<cy<<" "<<X.size()<<endl;
		}
	}
	//cout<<find(1)<<find(5)<<endl;
	cout<<ans<<endl;


	return 0;
}


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

int main(){
    int N, M;
    cin >> N >> M;
    vector<pair<int, int>> cities[100001];
    for(int i=0; i<M; i++){
        int p, y;
        cin >> p >> y;
        cities[p].push_back({y, i});
    }

    pair<int, int> ans[100001];
    for(int i=1; i<=N; i++){
        sort(cities[i].begin(), cities[i].end());
        for(int j=0; j<cities[i].size(); j++){
            ans[cities[i][j].second] = {i, j+1};
        }
    }

    for(int i=0; i<M; i++){
        printf("%06d%06d\n", ans[i].first, ans[i].second);
    }
    return 0;
}

Measured memory_bytes: 7808
#pragma GCC optimize("Ofast")
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip> // setprecision
#include <complex> // complex
#include <functional>
#include <math.h> 
#define enld '\n'
using namespace std;
using ll = long long;
using P = pair<int,int>;
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
// constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const int dx[8] = {1, 0, -1, 0,1,1,-1,-1};
const int dy[8] = {0, 1, 0, -1,1,-1,1,-1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// ---------------------------------------------------------------------------



int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll N,K;
  cin >> N >> K;
  vector<int> p(N);
  for(int i=0; i<N; i++){
    cin >> p[i];
    p[i]--;
  }
  vector<ll> C(N);
  for(int i=0; i<N; i++){
    cin >> C[i];
  }
  ll ans = -INF;
  for(int i=0; i<N; i++){
    vector<bool> used(N,false);
    used[i] = true;
    ll cnt = 0;
    int now = i;
    ll sum = 0;
    while(cnt != K){
      // 移動
      now = p[now];
      // 移動先のを足す
      sum += C[now];
      cnt++;
      chmax(ans,sum);
      if(used[now]) break;
      used[now] = true;
    }
    if(cnt < K && sum > 0){
      // 回るほどお得なので極限まで回る
      ll temp = (K/cnt-1) * sum;
      // 回り切った後にシミュレーション
      cnt = K%cnt+cnt;
      chmax(ans,temp);
      now = i;
      while(cnt){
        now = p[now];
        temp += C[now];
        cnt--;
        chmax(ans,temp);
      }
    }
  }
  cout << ans << "\n";
  return 0;
}

Measured memory_bytes: 3692
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = n-1; i >= 0; 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;
using P = pair<int,int>;
using VI = vector<int>;
using VVI = vector<vector<int>>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using VP = vector<P>;
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; }

const ll INF = 1LL << 60;

int main(){
    int n;
    cin >> n;
    VL dis1, dis2;
    rep(i,n){
        ll x, y;
        cin >> x >> y;
        ll xx = x - y;
        ll yy = x + y;
        dis1.push_back(xx);
        dis2.push_back(yy);
    }
    sort(all(dis1));
    sort(all(dis2));
    ll ans = 0;
    ans = max(ans, dis1[n-1] - dis1[0]);
    ans = max(ans, dis2[n-1] - dis2[0]);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 6592
fn main() {
    const DIV: usize = 1000000007;
    let nm = read_vec::<usize>();
    let n = nm[0];
    let m = nm[1];
    let mut broken: Vec<bool> = vec![false; n+1];
    for _ in 0..m {
        let a = read::<usize>();
        broken[a] = true;
    }

    let mut dp: Vec<usize> = vec![0; n+1];
    dp[0] = 1;
    if !broken[1] {
        dp[1] = 1;
    }

    for i in 2..n+1 {
        if !broken[i-2] {
            dp[i] += dp[i-2];
            dp[i] %= DIV;
        }
        if !broken[i-1] {
            dp[i] += dp[i-1];
            dp[i] %= DIV;
        }
    }

    println!("{}", dp[n]);
}

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

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

Measured memory_bytes: 4352
N,K = map(int,input().split())
S = list(input())
if S[K-1] == "A":
  S[K-1] = "a"
  STR = "".join(S)
  print(STR)
elif S[K-1] == "B":
  S[K-1] = "b"
  STR = "".join(S)
  print(STR)
else:
  S[K-1] = "c"
  STR = "".join(S)
  print(STR)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vl vector<ll>
#define vii vector<pii>
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define forn(i, n) for(int i=0; i<(int)(n); i++)
#define forne(i, a, b) for(int i=a; i<=(int)(b); i++)

#define gottagofast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define endl "\n"
using namespace std;

#define MAX (int)(1e5+5)
int tabela[MAX];
vi g[MAX];

int dp(int v) {
  if(g[v].size() == 0) {
    return 0;
  }
  if(tabela[v] != -1)
    return tabela[v];

  int res = 0;
  for(auto prox : g[v]) {
    res = max(res, 1+dp(prox));
  }

  return tabela[v] = res;
}


int main() {
  int n, m;
  cin >> n >> m;

  memset(tabela, -1, sizeof(tabela));

  forn(i, m) {
    int a, b;
    cin >> a >> b;

    g[a].pb(b);
  }

  int res = 0;
  for(int i = 1; i <= n; i++) {
    res = max(res, dp(i));
  }

  cout << res << endl;

  return 0;
}


Measured memory_bytes: 8192
N, W = list(map(int, input().split()))
items = [[0, 0]]
for _ in range(N):
    v, w = list(map(int, input().split()))
    items.append([v, w])
'''
DP = [[0 for _ in range(W + 1)] for _ in range(N + 1)]
for i in range(1, N + 1):
    for j in range(W + 1):
        if items[i][1] > j:
            DP[i][j] = DP[i - 1][j]
        else:
            DP[i][j] = max(DP[i - 1][j], DP[i - 1][j - items[i][1]] + items[i][0])
print(DP[N][W])
'''
DP2 = [0 for _ in range(W + 1)]
for i in range(1, N + 1):
    for j in range(W, items[i][1] - 1, -1):
            DP2[j] = max(DP2[j], DP2[j - items[i][1]] + items[i][0])
print(DP2[W])



Measured memory_bytes: 5932
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		long a = scanner.nextLong();
		long b = scanner.nextLong();
		a -= b; 
		long[] point = new long[n];
		for (int i = 0; i < n; i++) {
			point[i] = scanner.nextLong();
		}
		long min = 0;
		long max = 1000000000;
		while (max > min) {
			long T = (min + max) / 2;
			long cnt = 0;
			for (int i = 0; i < point.length; i++) {
				long rest = point[i] - T*b;
				if (rest > 0) {
					cnt += (rest % a) == 0 ? (rest / a) : (rest / a) + 1;
				}
			}
			if (T >= cnt) {
				max = T;
			} else {
				min = T + 1;
			}
		}
		System.out.println(min);
		scanner.close();
	}
}


Measured memory_bytes: 49596
import sys
from collections import defaultdict
readline = sys.stdin.buffer.readline
#sys.setrecursionlimit(10**8)


def geta(fn=lambda s: s.decode()):
    return map(fn, readline().split())


def gete(fn=lambda s: s.decode()):
    return fn(readline().rstrip())


def main():
    h = gete(int)
    w = gete(int)
    n = gete(int)

    if h < w:
        h, w = w, h

    print((h + n - 1) // h)


if __name__ == "__main__":
    main()

Measured memory_bytes: 3316
#include <algorithm>
#include <cassert>
#include <cstring>
#include <iostream>
#include <vector>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define TRACE(x) cout << #x << " = " << x << endl
#define _ << " _ " <<

typedef long long llint;

const int mod = 1e9 + 7;

inline int add(int a, int b) { return a + b >= mod ? a + b - mod : a + b; }

inline int sub(int a, int b) { return a >= b ? a - b : a - b + mod; }

inline int mul(int a, int b) { return llint(a) * b % mod; }

int powmod(int a, llint b) {
  if (b == 0) return 1;
  if (b & 1) return mul(a, powmod(a, b - 1));
  return powmod(mul(a, a), b / 2);
}

const int MAX = 110;

int h[MAX], pw[MAX];

pair<int, int> solve(int a, int b, int s) {
  if (b - a == 1) {
    int w = powmod(2, h[a] - s);
    return {w, w};
  }

  int m = *min_element(h + a, h + b);

  vector<pair<int, int>> v;
  int i = a;
  while (i < b) {
    int j = i;
    while (j < b && (h[i] == m) == (h[j] == m)) j++;
    v.push_back({i, j});
    i = j;
  }

  int fTotal = 1;
  int fAlternate = 2;

  for (auto& p : v) {
    int x = p.first, y = p.second;
    if (h[x] != m) {
      auto g = solve(x, y, m);
      fTotal = mul(fTotal, add(g.first, g.second));
      fAlternate = mul(fAlternate, g.first);
    } else {
      fTotal = mul(fTotal, pw[y - x]);
    }
  }

  fTotal = sub(fTotal, fAlternate);
  fAlternate = mul(fAlternate, powmod(2, m - s - 1));
  fTotal = add(fTotal, fAlternate);
  return {fAlternate, fTotal};
}

int main(void) {
  int N;
  scanf("%d", &N);
  REP(i, N) scanf("%d", &h[i]);

  pw[0] = 1;
  REP(i, N) pw[i + 1] = mul(pw[i], 2);

  auto g = solve(0, N, 0);
  printf("%d\n", g.second);
  return 0;
}


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

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define FOR(i, a, b) for(int i = a; i < (int)b; ++i)

typedef long long ll;

const int Inf = 1e9;
const double EPS = 1e-9;

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

int lcm(int a, int b) {
    return a * b / gcd(a, b);
}

int bitCount(long bits) {
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
    return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, k;  cin >> n >> k;
    vector<int> h(n), dp(n + k, Inf);
    rep(i, n) {
      cin >> h[i];
    }
    dp[0] = 0;
    rep(i, n) {
      FOR(j, 1, k + 1) {
        dp[i + j] = min(dp[i + j], dp[i] + abs(h[i + j] - h[i]));
      }
    }
    cout << dp[n - 1] << '\n';

    return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<tuple>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
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 Per(i,sta,n) for(int i=n-1;i>=sta;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++)
typedef long double ld;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;

int n;
ll a[200010],c[200010];

void solve(){
    cin >> n;
    rep(i,n){
        cin >> a[i];
        c[a[i]]+=1;
    }
    ll ans=0;
    rep(i,n+1){
        ans+=c[i]*(c[i]-(ll)1)/(ll)2;
    }
    rep(i,n){
        cout << ans-c[a[i]]+(ll)1 << endl;
    }
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(50);
    solve();
}

Measured memory_bytes: 4736
N=int(input())
people=[]
test=[]
for i in range(N):
    a=int(input())
    bufs=[list(map(int,input().split())) for _ in range(a)]
    test.append(bufs)
#print(test)
num=0
for i in range(pow(2,N)):
    flag=1
    flag2=1
    truthtable=[0]*N
    honestunkind=[-1]*N
    for j in range(N):
        if (i>>j)&1:
            truthtable[j]=1
    #print(truthtable)#正直者なら0,嘘つきなら1のtable
    for j in range(N):
        if truthtable[j]==0:
            for k in test[j]:
                people=k[0]-1
                horu=k[1]
                if honestunkind[people]==-1:
                    honestunkind[people]=(horu+truthtable[j]+1)%2
                else:
                    if honestunkind[people]!=(horu+truthtable[j]+1)%2:
                        flag=0
                        break
            if flag==0:
                break
    if flag==1:
        for j in range(N):
            if (truthtable[j]!=honestunkind[j])and(honestunkind[j]!=-1):
                flag2=0
                break
        if flag2==1:
            #print(truthtable,honestunkind)
            num=max(num,truthtable.count(0))
        #print(num,truthtable)
print(num)

Measured memory_bytes: 51184
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>


using namespace std;
typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;

#define REP(i,n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i,a,b) for(int i = (a); i < (int)(b); ++i)
#define ALL(c) (c).begin(), (c).end()
#define SIZE(v) ((int)v.size())

#define pb push_back
#define mp make_pair
#define mt make_tuple

void dfs(ll N, vector<ll>& op, vector<vector<ll>>& edges, int v, int prev) {
    for(auto nei: edges[v]) {
        if(nei == prev) continue;
        op[nei] += op[v];
        dfs(N, op, edges, nei, v);
    }
}

int main(void)
{
    cin.sync_with_stdio(false);
    ll N, Q;
    cin >> N >> Q;
    vector<vector<ll>> edges(N);

    REP(n, N-1) {
        ll a, b;
        cin >> a >> b;
        --a; --b;
        edges[a].pb(b);
        edges[b].pb(a);
    }
    vector<ll> op(N);
    REP(q, Q) {
        ll p, x;
        cin >> p >> x;
        --p;
        op[p] += x;
    }

    dfs(N, op, edges, 0, -1);

    REP(i, N) {
        if (i != 0) cout << " ";
        cout << op[i];
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 30592
#include<bits/stdc++.h>
#define ll long long
#define fo(i,n) for(i=0;i<n;++i)
#define forr(i,n) for(i=n-1;i>=0;--i)
using namespace std;

ll gcd(ll a,ll b){while(a&&b)a>=b?a%=b:b%=a;return a+b;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}

int main(){
 ll n, i;
 cin>>n;
 ll a[n];
 fo(i,n)
    cin>>a[i];
 ll pairs = 0;
 fo(i,n-1){
    pairs = pairs + a[i]/2;
    a[i] = a[i]%2;
    if(a[i]==1){
        if(a[i+1]>0)
        {
            pairs++;
            a[i]=0;
            a[i+1]--;
        }
    }
 }
 pairs = pairs + a[n-1]/2;
 a[n-1] = a[n-1] % 2;
 fo(i,n-1){
    if(a[i]&&a[i+1]){
        pairs++;
        a[i]=0;
        a[i+1]=0;
    }
 }
 cout<<pairs<<endl;
 return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
#define int long long
int MOD = 1000000007;


signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	string S;
	cin >> S;
	S.push_back('T');
	int x, y;
	cin >> x >> y;
	set<int> vx;
	set<int> nvx;
	set<int> vy;
	set<int> nvy;
	vx.insert(0);
	vy.insert(0);
	int a = 2;
	int cnt = 0;
	for (int i = 0; i < S.size(); i++) {
		if (S[i] == 'T') {
			if (a == 0) {
				nvx.clear();
				for (auto j : vx) {
					nvx.insert(j - cnt);
					nvx.insert(j + cnt);
				}
				swap(vx, nvx);
			}
			else if (a == 1) {
				nvy.clear();
				for (auto j : vy) {
					nvy.insert(j - cnt);
					nvy.insert(j + cnt);
				}
				swap(vy, nvy);
			}
			else {
				vx.clear();
				vx.insert(cnt);
			}
			cnt = 0;
			a = 1 - (a % 2);
		}
		else {
			cnt++;
		}
	}
	int f = 0;
	for (auto i : vx) {
		//cerr << i << " ";
		if (i == x) {
			f++;
			break;
		}
	}
	//cerr << endl;
	for (auto i : vy) {
		//cerr << i << " ";
		if (i == y) {
			f++;
			break;
		}
	}
	//cerr << endl;
	if (f == 2) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

Measured memory_bytes: 1024
#include <iostream>

using namespace std;

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    int cnt = 0;
    if (a == b) cnt++;
    if (b == c) cnt++;
    if (c == a) cnt++;
    if (cnt == 1) {
        cout << "Yes";
    } else
        cout << "No";
    return 0;
}


Measured memory_bytes: 256
#include <functional>
#include <utility>
#include <numeric>
#include<set>
#include<map>
#include<list>
#include<iomanip>
#include<cmath>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<complex>
#include<sstream>
#include<iostream>
#include<algorithm>
using namespace std;


int main(){
	
int X,Y;
cin>>X;
long long eraned=0;
Y=(X%500);
eraned+=(X/500)*1000;
eraned+=(Y/5)*5;
cout<<eraned<<endl;


	
	
	
	
	return 0;
}

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

typedef vector<int> veci;
typedef pair<int,int> pii;
typedef vector<pii> vecii;
typedef long long ll;
typedef pair<ll,ll> pll;
typedef vector<ll> vecl;
typedef vector<pll> vecll;
#define EPS (1e-9)
#define MOD (1e9+7)
#define fi first
#define se second
#define endl '\n'

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
#ifdef LOCAL_TEST    
    int tcs;
    cin >> tcs;
    while (tcs-->0)
#endif        
{
    string s;
    cin >> s;

    int n = s.size();

    vector<veci> dp(n+1,veci(26,0));
    for (int i=1; i<=n; ++i) {
        for (int k=0; k<26; ++k) {
            dp[i][k] = dp[i-1][k];
        }
        dp[i][int(s[i-1]-'a')]++;
    }

    ll sum = 1;
    for (int i=0; i<n; ++i) {
        for (int k=0; k<26; ++k) {
            if (int(s[i]-'a')==k)
                continue;
            sum += dp[n][k]-dp[i][k];
        }
    }

    cout << sum << endl;
}}

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

int main(){
    int h , w;
    cin >> h >> w;
    const int INF = 1e4;
    vector<vector<int>> dp(10, vector<int>(10, INF));
    for(int i = 0; i < 10; i++){
        for(int j = 0; j < 10; j++){
            cin >> dp[i][j];
        }
    }

    for(int i = 0; i < 10; i++) dp[i][i] = 0;
    for(int k = 0; k < 10; k++){
        for(int i = 0; i < 10; i++){
            for(int j = 0; j < 10; j++){
                dp[i][j] = min(dp[i][j], dp[i][k] + dp[k][j]);
            }
        }
    }

    int ans = 0;
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            int a;
            cin >> a;
            if(a != -1){
                ans += dp[a][1];
            }
        }
    }

    cout << ans << endl;
}

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

int main(){
    int N,a,b,minB=1000000001;
    long long sum=0;
    bool same=true;
    cin >> N;
    for(int i=0; i<N; i++){
        cin >> a >> b;
        sum+=a;
        if(a!=b)
        same=false;
        if(a>b && minB>b)
        minB=b;
    }
    if(same==true)
    cout << 0 << endl;
    else
    cout << sum-minB << endl;
    return 0;
}

Measured memory_bytes: 384
import java.util.Scanner;
class Main{
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String a = scan.next();
        String b = scan.next();
        String c = b.substring(b.length() - 1);
        
        if(b.equals(a + c)){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
        
    }
}

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

#define MAX 500000
#define SENTINEL 2000000000

int L[MAX/2+2],R[MAX/2+2];
int cnt=0;

void merge(int A[],int n,int left,int mid,int right){
    int n1 = mid - left;
    int n2 = right - mid;
    for(int i=0;i<n1;i++) L[i] = A[left+i];
    for(int i=0;i<n2;i++) R[i] = A[mid+i];  //????????????????????\?????????????????????
    L[n1] = R[n2] = SENTINEL;   //????????????????????????????°???????????????????
    int i=0,j=0;
    for(int k=left;k<right;k++){    //??±???
        cnt++;
        if(L[i]<=R[j]){
            A[k] = L[i];
            i++;
        } else {
            A[k] = R[j];
            j++;
        }
    }
}

void mergeSort(int A[],int n,int left,int right){
    if((left+1)<right){
        int mid = (left + right) / 2;
        mergeSort(A,n,left,mid);
        mergeSort(A,n,mid,right);
        merge(A,n,left,mid,right);
    }
}

int main(){
    int A[MAX],n,i;
    scanf("%d",&n);
    for(i=0;i<n;i++) scanf("%d",&A[i]);
    mergeSort(A,n,0,n);
    for(i=0;i<n;i++){
        if(i) printf(" ");
        printf("%d",A[i]);
    }
    printf("\n");
    printf("%d\n",cnt);
}

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

public class Main {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int N = scan.nextInt();
        scan.nextLine();
        String V = scan.nextLine();
        String C = scan.nextLine();
        final List<Integer> v = Arrays.stream(V.split(" ")).mapToInt(Integer::parseInt).boxed().collect(
                Collectors.toList());
        final List<Integer> c = Arrays.stream(C.split(" ")).mapToInt(Integer::parseInt).boxed().collect(
                Collectors.toList());
        int max = 0;
        for (int i = 0; i < N; i++) {
            int n = v.get(i) - c.get(i);
            if (n > 0) {
                max += n;
            }
        }
        System.out.println(max);
    }
}


Measured memory_bytes: 28496
import math
import heapq
N,M = input().split()
N = int(N)
M = int(M)
A = [int(i) for i in input().split()]
A_ = []
#A = sorted(A, reverse=True)
for i in A:
  A_.append(i * -1)


heapq.heapify(A_)
for i in range(M):
  max_num = heapq.heappop(A_)
  #append_num = math.floor((max_num * -1) / 2)
  append_num = math.ceil(max_num / 2)
  heapq.heappush(A_,append_num)

  #print(A_)

print(sum(A_) * (-1))

Measured memory_bytes: 14380
#include<stdio.h>
int main(void)
{
	int a, b, c;
	scanf("%d %d %d", &a, &b, &c);
	if (c >= a&&c <= b)
	{
		printf("Yes\n");
	}
	else
	{
		printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        long N = sc.nextLong();
        long a, b, d;
        for (long i = 1; i <= 3500; i++) {
            for (long j = i; j <= 3500; j++) {
                a=4*i*j-N*i-N*j;
                if (a<=0) continue;
                b=N*i*j;
                d=gcd(a,b);
                a/=d;
                b/=d;
                if (a==1) {
                    System.out.println(i + " " + j + " " + b);
                    return;
                }
            }
        }
    }

    private static long gcd(long a, long b) {
        while (b > 0) {
            long temp = b;
            b = a % b;
            a = temp;
        }
        return a;
    }
}

Measured memory_bytes: 23764
#include <stdio.h>

int main(int argc, char const *argv[])
{
    int a, b, c, d;
    int turn;

    scanf("%d %d %d %d", &a, &b, &c, &d);
    turn = 1;
    while(1) {
        if(turn) {
            c -= b;
            turn = 0;
        } else {
            a -= d;
            turn = 1;
        }
        if(a <= 0) {
            printf("No\n");
            return 0;
        } else if(c <= 0) {
            printf("Yes\n");
            return 0;
        }
    }
}

Measured memory_bytes: 1616
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        int[][][] array = new int [4][3][10];
        Scanner scan = new Scanner(System.in);
        int number = scan.nextInt();
        for(int i = 0; i<number; i++){
            int building = scan.nextInt();
            int floor = scan.nextInt();
            int room_number = scan.nextInt();
            int change = scan.nextInt();
 
            array[building-1][floor-1][room_number-1] += change;
 
        }
        for(int j = 0; j<4; j++){
            for(int k = 0; k<3; k++){
                for(int l = 0; l<10; l++){
                    System.out.print(" "+array[j][k][l]);
                }
                System.out.println();
            }
            if(j!=3){
                System.out.println("####################");
            }
        }
        scan.close();  
    }
}



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

class Main {

    public static void main(String[] args) {

	Scanner stdin = new Scanner(System.in);

	while ( stdin.hasNextLine() ) {

	    final String[] input = stdin.nextLine().split(" ");

	    final int morning = Integer.parseInt( input[1] );
	    final int afternoon = Integer.parseInt( input[2] );
	    final int people = morning + afternoon;
	    final int kane = morning * 200 + afternoon * 300;

	    System.out.printf("%s %d %d\n", input[0], people, kane);
	    
	}
	
    }
    
}

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

using namespace std;

struct war {
  int a;
  int b;

  bool operator<(const war &o) const { return b < o.b; }
};

int main() {
  int n, m;
  cin >> n >> m;

  vector<war> var_vec = vector<war>(m);
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    var_vec[i].a = a;
    var_vec[i].b = b;
  }

  sort(var_vec.begin(), var_vec.end());
  int last = 0;
  int count = 0;
  for (war w : var_vec) {
    if (last < w.a) {
      last = w.b - 1;
      count++;
    }
  }

  cout << count << endl;
}


Measured memory_bytes: 1024
class UnionFind():
   # 作りたい要素数nで初期化
   # 使用するインスタンス変数の初期化
   def __init__(self, n):
       self.n = n
       # root[x]<0ならそのノードが根かつその値が木の要素数
       # rootノードでその木の要素数を記録する
       self.root = [-1]*(n+1)
       # 木をくっつける時にアンバランスにならないように調整する
       self.rnk = [0]*(n+1)
   # ノードxのrootノードを見つける
   def Find_Root(self, x):
       if(self.root[x] < 0):
           return x
       else:
           # ここで代入しておくことで、後の繰り返しを避ける
           self.root[x] = self.Find_Root(self.root[x])
           return self.root[x]
   # 木の併合、入力は併合したい各ノード
   def Unite(self, x, y):
       # 入力ノードのrootノードを見つける
       x = self.Find_Root(x)
       y = self.Find_Root(y)
       # すでに同じ木に属していた場合
       if(x == y):
           return
       # 違う木に属していた場合rnkを見てくっつける方を決める
       elif(self.rnk[x] > self.rnk[y]):
           self.root[x] += self.root[y]
           self.root[y] = x
       else:
           self.root[y] += self.root[x]
           self.root[x] = y
           # rnkが同じ（深さに差がない場合）は1増やす
           if(self.rnk[x] == self.rnk[y]):
               self.rnk[y] += 1
   # xとyが同じグループに属するか判断
   def isSameGroup(self, x, y):
       return self.Find_Root(x) == self.Find_Root(y)
   # ノードxが属する木のサイズを返す
   def Count(self, x):
       return -self.root[self.Find_Root(x)]

n,m=map(int,input().split())
p=[0]+list(map(int,input().split()))
h=UnionFind(n+1)
ans=0
for i in range(m):
    a,b=map(int,input().split())
    h.Unite(a,b)
for i in range(1,n+1):
    if h.isSameGroup(p[i],i):
        ans+=1
print(ans)

Measured memory_bytes: 13812
#!/usr/bin/env python3
import sys
line = sys.stdin.readline() 
word = line.rstrip('\r\n') 
sys.stdin.readline() 
while True:
    if not line: break 
    line = sys.stdin.readline() 
    line = line.rstrip('\r\n') 
    words = line.split()
    if len(line) == 0:
        break   
    else:
        words = line.split()
        if words[0] == "print":
            a = int(words[1])
            b = int(words[2])
            print(word[a:b+1])
        elif words[0] == "reverse":
            a = int(words[1])
            b = int(words[2])
            rep = ""
            for i in range(b,a-1,-1):
                rep += word[i]
            word = word[:a] + rep + word[b+1:] 
        elif words[0] == "replace":
            a = int(words[1])
            b = int(words[2])
            word = word[:a] + words[3] + word[b+1:]



Measured memory_bytes: 5628
import java.util.*;

public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int hugs = 0;
		String a = sc.next();
		char[] pal = a.toCharArray();
		for(int i=0,j=pal.length-1;i<=j;i++,j--)
		{
			
			if(pal[i]!=pal[j]) {
				hugs++;
				
			}
			
		}
		
		System.out.println(hugs);
	}	
}

Measured memory_bytes: 22868
#include <stdio.h>
#include <stdlib.h>

int main(void)
{
	int err;
	long n, m, q;
	err = scanf("%ld%ld", &n, &m);
	if (err != 2) exit(1);
	q = m/n;
	for (;;)
	{
		if (m%q == 0)	
		{
			if (m/q >= n)
			{
				printf("%ld\n", q);
				return 0;
			}else
			{
				q--;
			}
		}else
		{
			q--;
		}
	}
	return 0;
}

Measured memory_bytes: 128
package main

import (
	"fmt"
	"sort"
)

func main() {
	var a, b, c int
	fmt.Scan(&a, &b, &c)
	
	nums := []int{a, b, c}
	sort.Ints(nums)
	
	diff1 := nums[2] - nums[0]
	diff2 := nums[2] - nums[1]
	
	ans := 0
	if diff1 % 2 == 0 && diff2 % 2 == 0 {
		ans = (diff1 + diff2) / 2
	} else if diff1 % 2 != 0 && diff2 % 2 != 0 {
		ans += diff1 / 2
		ans += diff2 / 2
		ans++ //2つ選んで+1する
	} else if diff1 % 2 == 0 {
		ans++
		diff1++
		ans += diff1 / 2
		ans += diff2 / 2
		ans++
	} else if diff2 % 2 == 0 {
		ans++
		diff2++
		ans += diff1 / 2
		ans += diff2 / 2
		ans++
	}
	fmt.Println(ans)
}


Measured memory_bytes: 1836
MOD = 10**9 + 7
import sys
from collections import defaultdict, deque
input = sys.stdin.readline
N,K = map(int,input().split())

num = 100010
fact = [1] * (num+1)
ifact = [1] * (num+1)
inv = [pow(i,MOD-2,MOD) for i in range(num+1)]
for i in range(1,num+1):
    fact[i] = (fact[i-1] * i) % MOD
    ifact[i] = (ifact[i-1] * inv[i]) % MOD

def nPr(n,r):
    return (fact[n] * ifact[n-r]) % MOD

g = defaultdict(list)
for i in range(N-1):
    a,b = map(int,input().split())
    g[a].append(b)
    g[b].append(a)

for i in range(1,N+1):
    nnode = len(g[i])+1
    if nnode > K:
        print(0)
        exit()

dq = deque([1])

visited = [False] * (N+1)

ans = nPr(K,len(g[1])+1)
while dq:
    v = dq.popleft()
    visited[v] = True
    if v != 1:
        npattern = len(g[v])-1
        ans *= nPr(K-2,npattern)
        ans %= MOD
    for nv in g[v]:
        if visited[nv]:
            continue
        dq.append(nv)
print(ans)





Measured memory_bytes: 73816
#include <stdio.h>

using namespace std;


int main(){
	int debt = 100000,n;
	scanf("%d",&n);

	for(int i=0;i<n;i++){
		debt=(debt/100)*105;
		if((debt%1000)>0){
			debt+=(1000-(debt%1000));
		}
	}

	printf("%d\n",debt);

    return 0;
}



Measured memory_bytes: 2560
def f(v,i):s,n=4*2**v-3,2*2**v-1;m=s/2+1;return 0 if(i<1)+(i>s)else[f(v-1,i-1),f(v-1,i-m)+n/2+1,n,1][(i>=m)+(i>=s)+(v==0)]
print f(*map(int,raw_input().split()))

Measured memory_bytes: 2568
#include <bits/stdc++.h>
using namespace std;
int N,S,a,dp[3002][3002],ans=0,MOD=998244353;
int main(){
  cin>>N>>S;
  dp[0][0]=1;
  for(int i=1;i<=N;i++){
    cin>>a;
    for(int j=0;j<=S;j++){
      dp[i][j]=dp[i-1][j];
      if(j>=a)dp[i][j]+=dp[i-1][j-a];
      dp[i][j]%=MOD;
    }
    dp[i][0]++;
    ans+=dp[i][S];
    ans%=MOD;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 38732
#pragma once
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <deque>
#include <numeric>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1000000007;
const int MAX_V = 201;
ll dp[2][4];
int now = 0;
int t[3];
ll p2[32];
bool use[100010];
int arr[256];
void Sequence() {
	int a, b, c, d;
	cin >> a >> b >> c >> d;


	cout << max(a * b, c * d) << endl;

}
int main() {
	Sequence();
	return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main() {
  string str;
  while(getline(cin, str)) {
    for(string::iterator it = str.begin(); it != str.end(); ++it) {
      char r = *it;
    if (r >= 'A' && r <= 'Z') {
      cout << (char)(r+32) ;
    } else if (r >= 'a' && r <= 'z') {
      cout << (char)(r-32);
     } else {
      cout << r;
     }
  }
  }
  cout << endl;
}

Measured memory_bytes: 3200
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        int n = int.Parse(Console.ReadLine()); //標準入力
        List<int> list = new List<int>();
        list = Console.ReadLine().Split().Select(s => int.Parse(s)).ToList();
        int money = 0;

        list.Add(0);
        list.Insert(0, 0);

        //先にスキップしなかったときのお金を計算
        for(int j=0; j<list.Count-1; j++)
        {
            var prev = list[j];
            var next = list[j+1];
            money += Math.Abs(next - prev);
        }

        for(int i=1; i<list.Count-1; i++)
        {
            var newMoney = money;
            newMoney += Math.Abs(list[i-1] - list[i+1]) - Math.Abs(list[i-1] - list[i]) - Math.Abs(list[i] - list[i+1]);
            Console.WriteLine(newMoney);
        }
    }
}

Measured memory_bytes: 27740
use std::cmp::*;
const MAX_N: usize = 10001;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n: usize,
        h: [i32 ; n],
    }
    let mut dp = vec![0; n];

    dp[1] = (h[0] - h[1]).abs();
    for i in 2..n {
        let one = ((h[i] - h[i - 1])).abs() + dp[i - 1];
        let two = ((h[i] - h[i - 2])).abs() + dp[i - 2];
        dp[i] = min(one, two);
    }

    println!("{}", dp[n - 1]);
}


Measured memory_bytes: 4352
#include <iostream>
#include <stdio.h>

using namespace std;


int main() {
    int a, b, d, r;
    double f;
    cin >> a >> b;
    d = a / b;
    r = a % b;
    f = (double) a / b;
    printf("%d %d %.6f", d, r, f);
    return 0;
}

Measured memory_bytes: 1192
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
#define int long long
#define vel vector<long long>
#define vvel vector<vel>
void mmin(int &a, int b) {
	a = min(a, b);
}
void mmax(int &a, int b) {
	a = max(a, b);
}
int nibl(vel &v, int tan) {
	int up = v.size() - 1;
	int lo = 0;
	if (v[up] <= tan) return up;
	while (up - lo > 1) {
		int mi = (up + lo) / 2;
		if (v[mi] <= tan) lo = mi;
		if (tan < v[mi]) up = mi;
	}
	return lo;
}
signed main() {
	int h, w;
	cin >> h >> w;
	vvel c(h+2, vel(w+2, 2));
	for (int i = 1; i <= h; i++) {
		string s;
		cin >> s;
		for (int j = 1; j <= w; j++) {
			int mo = (i + j) % 2;
			if (s[j - 1] == '.') {
				mo = (mo + 1) % 2;
			}
			c[i][j] = mo;
		}
	}
	int ans = 0;
	vel nex(h*w);
	vel ney(h*w);
	int usin = 0;
	for (int i = 1; i <= h; i++) {
		for (int j = 1; j <= w; j++) {
			if (c[i][j] != 2) {
				int moc = c[i][j];
				c[i][j] = 2;
				int han0 = 0;
				int han1 = 0;
				if ((i + j) % 2 == 0) {
					han0 = 1;
				}
				else {
					han1 = 1;
				}
				int si = usin;
				nex[usin] = i;
				ney[usin] = j;
				usin++;
				while (si < usin) {
					int nusin = usin;
					for (int k = si; k < usin; k++) {
						int x = nex[k];
						int y = ney[k];
						for (int nx = x - 1; nx <= x + 1; nx++) {
							for (int ny = y - 1; ny <= y + 1; ny++) {
								if (abs(nx - x) + abs(ny - y) == 1 and c[nx][ny] == moc) {
									c[nx][ny] = 2;
									nex[nusin] = nx;
									ney[nusin] = ny;
									nusin++;
									if ((nx + ny) % 2 == 0) {
										han0++;
									}
									else {
										han1++;
									}
								}
							}
						}
					}
					si = usin;
					usin = nusin;
				}
				ans += han0 * han1;
			}
		}
	}
	cout << ans << endl;
	return 0;
}

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

int main() {
    int a,b,c;
    cin>>a>>b>>c;
    int m=max({a,b,c});
    if(2*m==a+b+c){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
}

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

int main() {
  int N;
  cin >> N;
  long long luc[N];
  luc[0]=2;
  luc[1]=1;
  for (int i=2;i<=N;i++) {
    luc[i]=luc[i-1]+luc[i-2];
  }
  cout << luc[N] << endl;
}


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

#define SZ(a) ((int)a.size())
#define ALL(a) a.begin(), a.end()
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define fst first
#define snd second

void dout() { cerr << endl; }

template <typename Head, typename... Tail>
void dout(Head H, Tail... T) {
    cerr << H << ' ';
    dout(T...);
}

const int maxN = 3000;
double dp[maxN][maxN];

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin >> n;
    vector<double> p(n);
    for (int i = 0; i < n; i++)
    {
        cin >> p[i];
    }
    dp[0][0] = 1;
    for (int i = 1; i <= n; i++)
    {
        dp[i][0] = dp[i - 1][0] * (1 - p[i - 1]);
        for (int j = 1; j <= i; j++)
        {
            dp[i][j] = dp[i - 1][j - 1] * p[i - 1] + dp[i - 1][j] * (1 - p[i - 1]);
        }
    }
    double ans = 0;
    for (int i = n / 2 + 1; i <= n; i++)
    {
        ans += dp[n][i];
    }
    cout << fixed << setprecision(9) << ans;
    return 0;
}

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

using namespace std;

int main(){
	int H, W;
	cin >> H >> W;
	int a[510][510];
	rep(i,H){
		rep(j,W) cin >> a[i][j];
	}
	int ans=0;
	vector<int> ys, xs, yg, xg;
	rep(i,H){
		rep(j,W){
			if(i==H-1 && j==W-1) break;
			if(a[i][j]%2==1){
				ans++;
				if(j!=W-1){
					a[i][j]--;
					a[i][j+1]++;
					ys.emplace_back(i+1);
					xs.emplace_back(j+1);
					yg.emplace_back(i+1);
					xg.emplace_back(j+2);
				}
				else{
					a[i][j]--;
					a[i+1][j]++;
					ys.emplace_back(i+1);
					xs.emplace_back(j+1);
					yg.emplace_back(i+2);
					xg.emplace_back(j+1);
				}
			}
		}
	}
	cout << ans << endl;
	rep(i,ans) cout << ys[i] << " " << xs[i] << " "
	<< yg[i] << " " << xg[i] << endl;

	return 0;
}

Measured memory_bytes: 5220