akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
    int K,N; cin >> K >> N;
    vector<int> A(N);
    for (int i=0;i<N;i++) cin >> A[i];
    int res = 1e6;
    for (int i=0;i<N-1;i++){
        int x,y;
        if (i==0) x = A[0] + (K-A[N-1]);
        else x = A[i+1] - A[i];
        y = K - x;
        // cout << x  << " " << y << " " << res << endl;
        // res = min(x,res);
        res = min(y,res);
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 1024
use std::io::*;
use std::str::FromStr;
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n: u32 = read();
    let p: Vec<Vec<(u32, u32)>> = (0..n).map(|_|  {
        let a: usize = read();
        (0..a).map(|_| (read::<u32>() - 1, read())).collect()
    }).collect();
    let mut max = 0;
    for i in 0..(1 << n) {
        fn kind(i: u32, j: u32) -> bool {
            i & (1 << j) != 0
        }
        let (ok, count) = || -> (bool, u32) {
            let mut count = 0;
            for (j, wits) in p.iter().enumerate() {
                if !kind(i as u32, j as u32) {continue};
                count += 1;
                for wit in wits {
                    if kind(i as u32, wit.0 as u32) != (wit.1 != 0) {
                        return (false, 0);
                    }
                }

            }
            (true, count)
        }();
        max = if ok && count > max {
            count
        } else {
            max
        }
    }
    println!("{}", max);
}

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

if abs(a - b) % 2 == 0:
    ans = abs(a - b) // 2
else:
    ans = min(a + (b - a - 1) // 2, (n - b + 1) + (n - (a + n - b + 1)) // 2)

print(ans)


Measured memory_bytes: 2940
var x, y, z: integer;
    
procedure swap(var x, y : integer);
var t : integer;
begin
    t := x; x := y; y := t;
end;
    
begin
    readln(x, y, z);
    swap(x, y); swap(x, z);
    writeln(x, ' ', y, ' ', z);
end.

Measured memory_bytes: 128
#![allow(unused_imports)]
#![allow(unused_macros)]
use std::cmp::{ min, max };

macro_rules! ewriteln {
    ($($args:expr),*) => { let _ = writeln!(&mut std::io::stderr(), $($args),*); };
}
macro_rules! trace {
    ($x:expr) => { ewriteln!(">>> {} = {:?}", stringify!($x), $x) };
    ($($xs:expr),*) => { trace!(($($xs),*)) }
}
macro_rules! put {
    ($x:expr) => { println!("{}", $x) };
    ($x:expr, $($xs:expr),*) => { print!("{} ", $x); put!($($xs),*) }
}

#[allow(dead_code)]
const M: i64 = 1_000_000_007;

fn main() {
    let mut sc = Scanner::new();
    let n: usize = sc.cin();
    let x: Vec<usize> = (0..3).map(|_| sc.cin()).collect();
    let y: Vec<usize> = (0..3).map(|_| sc.cin()).collect();
    // trace!(n, &x, &y);

    let n_next = {
        let mut memo = vec![0; 5004];
        for d in 1..5002 {
            for i in 0..3 {
                if x[i] <= d {
                    memo[d] = max(memo[d], memo[d-x[i]] + y[i]);
                }
            }
        }
        let mut n_max = 0;
        for d in 0..n+1 {
            n_max = max(n_max, n - d + memo[d]);
        }
        n_max
    };
    trace!(n_next);

    let ans = {
        let mut memo = vec![0; 5000*5000+10];
        for d in 1..(5000*5000+10) {
            for i in 0..3 {
                if y[i] <= d {
                    memo[d] = max(memo[d], memo[d-y[i]] + x[i]);
                }
            }
        }
        let mut n_max = 0;
        for d in 0..n_next+1 {
            n_max = max(n_max, n_next - d + memo[d]);
        }
        n_max
    };
    put!(ans);
}

use std::io::{self, Write};
use std::str::FromStr;
use std::collections::VecDeque;

struct Scanner { stdin: io::Stdin, buffer: VecDeque<String>, }
impl Scanner {
    fn new() -> Scanner { Scanner { stdin: io::stdin(), buffer: VecDeque::new() } }
    fn cin<T: FromStr>(&mut self) -> T {
        while self.buffer.len() == 0 {
            let mut line = String::new();
            let _ = self.stdin.read_line(&mut line);
            for w in line.split_whitespace() {
                self.buffer.push_back(String::from(w));
            }
        }
        self.buffer.pop_front().unwrap().parse::<T>().ok().unwrap()
    }
}


Measured memory_bytes: 200956
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (a); i > (b); i--)
#define ALL(a) (a).begin(), (a).end()

int main() {
    int N, K, H[100000];
    cin >> N >> K;
    REP(i, N) cin >> H[i];
    sort(H, H + N);
    int ans = 1e9;
    FOR(i, K - 1, N) ans = min(H[i] - H[i - K + 1], ans);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
#include <stdio.h>
int main() {
	int n, m;
	scanf("%d %d",&n,&m);
	int sum = 0;
	for (int i = 1; i <= n-1; i++)
	{
		sum += i;
	}
	for (int i = 0; i <= m-1; i++)
	{
		sum += i;
	}
	printf("%d\n",sum);
	return 0;
}

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

using namespace std;

int main() {
    int N;
    int K;
    char S[100001];
    int X = 0;
    int O = 0;
    //int halfX = 0;
    int score = 0;

    cin >> N >> K;
    cin >> S;

    //if (S[0] == 'L') halfX++;
    //if (S[N-1] == 'R') halfX++;
    for (int i=0; i<N-1; i++) {
        if (S[i] == 'R' && S[i+1] == 'L') {
            X++;
        }
        if (S[i] == 'L' && S[i+1] == 'R') {
            O++;
        }
    }

    for (int i=0; i<N; i++) {
        if (S[i] == 'L') {
            if (i > 0 && S[i-1] == 'L') score++;
        }
        if (S[i] == 'R') {
            if (i < N-1 && S[i+1] == 'R') score++;
        }
    }

    // 2 point
    int r = min(X, O);
    score += 2 * min(r, K);

    if (r < K) {
        int leftK = K - r;
        int leftX = X - r;
        int leftO = O - r;
        int newR = min(leftX + leftO, 2);
        score += 1 * min(newR, leftK);
    }

    cout << score << endl;
    
        
    return 0;
}



Measured memory_bytes: 384
#include<iostream>
#include<cmath>
#include<vector>
#include<set>
#include<algorithm>
#include<tuple>
#include<utility>
#include<cctype>
#include<climits>
#include<map>
#include<queue>
#include<functional>
#include <ios>
#include <iomanip>

using namespace std;
template<class T> void chmax(T& a, T b) {if(a < b){a=b;}}
template<class T> void chmin(T& a, T b) {if(a > b){a=b;}}

#define REP(i,a,n) for(int i=a;i<n;++i)
#define RUP(a,b) ((a+b-1)/(b))
#define ENT "\n"
#define REV(v) reverse(v.begin(),v.end())
#define SRTV(v) sort(v.begin(),v.end())
#define SRTAG(a,n) sort(a,a+n,greater<>())
#define MOD 1000000007

typedef long long ll;
typedef tuple<int,int,bool> Tb;
typedef tuple<ll,ll,ll> Tl;

int atcoder(){
    //入力
    ll k,s;
    cin >> k >> s;
    ll ans=0;
    
    REP(i,0,s+1){
        REP(j,0,s-i+1){
            if(i<=k && j<=k && s-i-j<=k) ans++;
        }
    }

    cout << ans << ENT;
    return 0;
}

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


Measured memory_bytes: 256
package main

import (
	"fmt"
	"strconv"
	"strings"
)

func main() {
	var n int
	fmt.Scan(&n)

	a := make([]int, n)
	for i := range a {
		fmt.Scan(&a[i])
	}
	fmt.Println(printSlice(a))

	for i := 1; i < n; i++ {
		key := a[i]
		j := i - 1
		for j >= 0 && a[j] > key {
			a[j+1] = a[j]
			j--
		}
		a[j+1] = key
		fmt.Println(printSlice(a))
	}
}

func printSlice(slice []int) (s string) {
	for _, v := range slice {
		s += strconv.Itoa(v) + " "
	}
	return strings.TrimRight(s, " ")
}



Measured memory_bytes: 3320
import heapq
inf=float("inf")


def dijkstra(k):
    color=["white" for _ in range(n+1)]
    D=[inf for _ in range(n+1)]
    M=[[] for _ in range(n+1)]

    for a,b,c in ABC:
        M[a].append([c,b])
        M[b].append([c,a])

    D[k]=0
    color[k]="gray"
    queue=[[0,k]]
    heapq.heapify(queue)

    while len(queue)>0:
        u=heapq.heappop(queue)[1]
        color[u]="black"

        for i,j in M[u]:
            if color[j]!="black":
                if D[u]+i<D[j]:
                    D[j]=D[u]+i
                    color[j]="gray"
                    queue.append([D[j],j])

    return D


n=int(input())
ABC=[list(map(int,input().split())) for _ in range(n-1)]
q,k=map(int,input().split())
XY=[list(map(int,input().split())) for _ in range(q)]
D=dijkstra(k)

for x,y in XY:
    print(D[x]+D[y])

Measured memory_bytes: 127120
import queue
N,M = map(int, input().split())
r = [[] for _ in range(N)]
for i in range(M):
    A,B=map(int, input().split())
    r[A-1].append(B)
    r[B-1].append(A)
ans =[0]*(N+1)
q = queue.Queue()
q.put(1)
while not q.empty():
    qg = q.get()
    for ri in r[qg-1]:
        if ans[ri] == 0:
            ans[ri] = qg
            q.put(ri)
print("Yes")
for i in range(2,N+1):
    print(ans[i])

Measured memory_bytes: 97172
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define vvi vector< vector<int> >
#define vi vector<int>
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define pii pair<int,int>
#define mp make_pair
#define shosu(X) fixed << setprecision(X)
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
 
int main(){
  int k, x;
  cin >> k >> x;
  int t = (k - 1) * 2 + 1;
  REP(i, t){
    if(i != t - 1) cout << x + i - (k - 1) << " ";
    else cout << x + i - (k - 1) << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <cmath>
#include <string>
#include <algorithm>
#include <utility>
#include <vector>
#include <set>
#include <map>
#include <deque>
#include <tuple>
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using pll = pair<ll,ll>;
using tll = tuple<ll,ll,ll>;
#define pb push_back
#define for1(i,n) for (ll i=0;i<(n);(i)++)
#define for2(i,m,n) for (ll i=(m);(i)<(n);(i)++)
#define for3(i,m,n,d) for (ll i=(m);(i)<(n);(i)+=(d))
#define INF (1LL << 60)
#define DEBUG 0
#if DEBUG
    #define dump(v1) dump_1(#v1, v1)
    #define dump2(v1,v2) dump_2(#v1, v1, #v2, v2)
    #define dump3(v1,v2,v3) dump_3(#v1, v1, #v2, v2, #v3, v3)
#else
    #define dump(v1)
    #define dump2(v1,v2)
    #define dump3(v1,v2,v3)
#endif
#if DEBUG
template <typename T>
void dump_1(const string& n1, const T& v1)
{
    cerr << n1 << ": " << v1 << endl;
}
template <typename T1, typename T2>
void dump_2(const string& n1, const T1& v1, const string& n2, const T2& v2)
{
    cerr << n1 << ": " << v1 << "  " << n2 << ": " << v2 << endl;
}
template <typename T1, typename T2, typename T3>
void dump_3(const string& n1, const T1& v1, const string& n2, const T2& v2, const string& n3, const T3& v3)
{
    cerr << n1 << ": " << v1 << "  " << n2 << ": " << v2 << "  " << n3 << ": " << v3 << endl;
}
template <typename T1,typename T2>
ostream& operator << (ostream& os, const pair<T1,T2>& v)
{
    os << "(" << v.first << ", " << v.second << ")";
    return os;
}
template <typename T1,typename T2, typename T3>
ostream& operator << (ostream& os, const tuple<T1,T2,T3>& v)
{
    os << "(" << get<0>(v) << ", " << get<1>(v) << ", " << get<2>(v) << ")";
    return os;
}
template <typename T>
ostream& operator << (ostream& os, const vector<T>& v)
{
    os << "[";
    for (auto it = v.begin(); it != v.end(); it++) {
        if (it != v.begin()) {
            os << ", ";
        }
        os << *it;
    }
    os << "]";
    return os;
}
template <typename T>
ostream& operator << (ostream& os, const set<T>& v)
{
    os << "{";
    for (auto it = v.begin(); it != v.end(); it++) {
        if (it != v.begin()) {
            os << ", ";
        }
        os << *it;
    }
    os << "}";
    return os;
}
template <typename T1, typename T2>
ostream& operator << (ostream& os, const map<T1,T2>& v)
{
    os << "{";
    for (auto it = v.begin(); it != v.end(); it++) {
        if (it != v.begin()) {
            os << ", ";
        }
        os << it->first << ":" << it->second;
    }
    os << "}";
    return os;
}
#endif // DEBUG
template <typename T>
void print(const T& v)
{
    cout << v << endl;
}
//---------------------------------------------------------

void solve()
{
    ll ans = 0;
    ll N,D;
    cin >> N >> D;
    D = D * 2 + 1;
    if ((N % D) != 0) {
        ans = N / D + 1;
    } else {
        ans = N / D;
    }
    dump2(N,D);

    print(ans);
}

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


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

using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int D, N;
string S;
ll DP1[int(1e4+5)][105], DP2[int(1e4+5)][105];

int main(){
  cin >> S >> D;
  N = S.length();
  DP2[0][0] = 1;

  for (int i = 1; i <= N; i++){
    for (int j = 0; j < D; j++){
      for (int k = 0; k < 10; k++){
        DP1[i][(j+k)%D] += DP1[i-1][j];
        DP1[i][(j+k)%D] %= MOD;
      }
    }

    int now = S[i-1] - '0';
    for (int j = 0; j < D; j++){
      for (int k = 0; k < now; k++){
        DP1[i][(j+k)%D] += DP2[i-1][j];
        DP1[i][(j+k)%D] %= MOD;
      }
    }

    for (int j = 0; j < D; j++){
      DP2[i][(j+now) % D] = DP2[i-1][j];
    }
  }

  ll ans = DP1[N][0] + DP2[N][0] - 1;
  ans %= MOD; if (ans < 0) ans += MOD;
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 19992
#include <iomanip>
#include <iostream>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;

int main(void) {
  ios::sync_with_stdio(false);
  vector<int> x(5);
  rep(i, 5) cin >> x[i];
  rep(i, 5) {
    if (x[i] == 0) {
      cout << i + 1 << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 3608
#!/usr/bin/env ruby
require 'set'

n = gets.chomp.to_i

dict = Set.new
n.times do
  action, str = gets.chomp.split
  str = str.tr('ACTG', '1234').to_i
  if action == 'insert'
    dict << str
  else
    puts dict.include?(str) ? 'yes' : 'no'
  end
end

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

#define min(a, b) ((a) > (b) ? (b) : (a))
#define INT_MAX 0x7fffffff


int main(void) {
    int n;
    scanf("%d", &n);

    int *arr = malloc(sizeof(int) * n);
    for(int i = 0; i < n; i++)
        scanf("%d", &arr[i]);

    int dp[100001] = {
        [ 0 ... 100000 ] = INT_MAX
    };
    dp[0] = 0; 
    
    for(int i = 1; i < n; i++) {
        for(int j = i - 2; j < i; j++) 
            if(j >= 0)
                dp[i] = min(dp[i], dp[j] + abs(arr[j] - arr[i]));
    }
    
    printf("%d\n", dp[n - 1]);

    return 0;
}





Measured memory_bytes: 896
H,W=map(int,input().split())
s=[list(input()) for i in range(H)]
for i in range(H):
  ans=["0"]*W
  for j in range(W):
    if s[i][j]=="#":
      ans[j]="#"
      continue
    count=0
    if i > 0:
      if s[i-1][j]=="#":
        count+=1
      if j > 0:
        if s[i-1][j-1]=="#":
          count+=1
      if j < W-1:
        if s[i-1][j+1]=="#":
          count+=1
    if i<H-1:
      if s[i+1][j]=="#":
        count+=1
      if j >0:
        if s[i+1][j-1]=="#":
          count+=1
      if j<W-1:
        if s[i+1][j+1]=="#":
          count+=1
    if j>0:
      if s[i][j-1]=="#":
        count+=1
    if j<W-1:
      if s[i][j+1]=="#":
        count+=1
    ans[j]=str(count)
  print("".join(ans))
        
        

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

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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repto(i, n) for(int i = 0; i <= (n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
#define mp make_pair
#define INF 1145141919
#define MOD 1000000007
#define DEBUG(x) cout << #x << ": " << x << endl;
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }

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

  int N;
  cin >> N;
  vector<int> a(N);
  vector<vector<int> > v(N);
  rep(i, N) {
    cin >> a[i];
  }
  rep(i, N) {
    rep(j, 30) {
      if (a[i] != 0) {
        v[i].pb(a[i]%2);
        a[i] /= 2;
      }
      else
        v[i].pb(0);
    }
  }
  vector<int> s(30);
  rep(i, 30) {
    s[i] = v[0][i];
  }
  rep(j, 30) {
    for (int i = 1; i < N; i++) {
      s[j] ^= v[i][j];
    }
  }
  vector<vector<int> > b(N, vector<int>(30));
  vector<int> ans(N, 0);
  rep(i, N) {
    int cnt = 1;
    rep(j, 30) {
      b[i][j] = s[j]^v[i][j];
      ans[i] += b[i][j]*cnt;
      cnt *= 2;
    }
    cout << ans[i] << ' ';
  }
  cout << endl;
}


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

static int lc[1000][1000];
static std::string X, Y;

int count(int idx_x, int idx_y) {
    if (lc[idx_x][idx_y] != -1) {
        return lc[idx_x][idx_y];
    }

    int maximum = 0;
    
    if (X[idx_x] == Y[idx_y]) {
        if (idx_x > 0 && idx_y > 0) {
            maximum = std::max(maximum, count(idx_x - 1, idx_y - 1));
        }
        lc[idx_x][idx_y] = maximum + 1;
    } else {
        if (idx_x > 0) {
            maximum = std::max(maximum, count(idx_x - 1, idx_y));
        }
        if (idx_y > 0) {
            maximum = std::max(maximum, count(idx_x, idx_y - 1));
        }
        lc[idx_x][idx_y] = maximum;
    }
    return lc[idx_x][idx_y];
}

int LongestCommon() {
    for (int i = 0; i < X.length(); i++) {
        for (int j = 0; j < Y.length(); j++) {
            lc[i][j] = -1;
        }
    }
    return count(X.length() - 1, Y.length() - 1);
}

int main() {
    int q;
    std::cin >> q;
    for (int i = 0; i < q; i++) {
        std::cin >> X >> Y;
        std::cout << LongestCommon() << std::endl;
    }
}



Measured memory_bytes: 7076
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>

using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=b;i--)
#define ALL(x) x.begin(),x.end()
#define SIZE(x) ll(x.size())

#define INF 1000000000000 //10^12
#define MOD 1000000007 //10^9+7:合同式の法
 
int main(){
    ll n;
    cin >> n;

    string s;
    cin >> s;

    ll b=0,r=0;
    REP(i,n){
        if(s[i]=='R'){
            r++;
        }
        else if(s[i]=='B'){
            b++;
        }
    }
    if(r>b){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 3624
(N,M) = map(int,input().split())
r = int(-1)
for i in range(N):
  A = list(map(int,input().split()))
  A.pop(0)
  c = 0
  for a in A:
    c |= (1 << (a-1))
  r &= c

ans = sum([(r>>n)&1 for n in range(M)])
print(ans)

Measured memory_bytes: 3060
import java.util.*;

class Main {
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int a = stdIn.nextInt();
		int b = stdIn.nextInt();
		if (a < b) {
			System.out.println("a < b");
		}else if (b < a) {
			System.out.println("a > b");
		}else{
			System.out.println("a == b");
		}
	}
}

Measured memory_bytes: 17300
#include <bits/stdc++.h>
using namespace std;
vector<int> dx= {1, 0, -1, 0};
vector<int> dy = {0, 1, 0, -1};
const int INF=100000000;

int main(){
    int n, m;
    cin>>n>>m;
    int  l=0, r=n+1;
    for(int  i = 0; i< m ; i++){
        int le, ri;
        cin>>le>>ri;
        if(le>l) l = le;
        if(ri<r) r = ri;
    }
    cout<<max(0, r-l +1)<<endl;
}


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

using namespace std;
using ld = long double;

int n, one, two, three;
ld dp[305][305][305];

// Expected number of tries to get "i" ones, "j" twos, "k" threes
// E[i][j][k] = (1 / n) * (
//                (n - i - j - k) * (1 + E[i][j][k]) 
//                + i * (1 + E[i - 1][j + 1][k])
//                + j * (1 + E[i][j - 1][k + 1])
//                + k * (1 + E[i][j][k - 1])
//              )
ld solve(int i, int j, int k) {
  if (i < 0 || j < 0 || k < 0) { return 0.0L; }
  if (i == 0 && j == 0 && k == 0) { return 0.0L; }
  ld& res = dp[i][j][k];
  if (res > -1e-9) { return res; }
  res = 0.0L;
  assert(i + j + k > 0);
  int tot = i + j + k;
  int left = n - tot;
  res += (1.0L + solve(i - 1, j + 1, k)) * i / n;
  res += (1.0L + solve(i, j - 1, k + 1)) * j / n;
  res += (1.0L + solve(i, j, k - 1)) * k / n;
  res += 1.0L * left / n;
  res /= 1.0L * tot / n;
  return res;
}

int main() {
  fill(&dp[0][0][0], &dp[0][0][0] + 305 * 305 * 305, -1.0L);
  cin >> n;
  for (int i = 0; i < n; i++) {
    int x; cin >> x;
    (x == 1) ? one++ : (x == 2) ? two++ : three++;
  }
  cout << setprecision(30) << fixed << solve(three, two, one) << '\n';
  return 0;
}


Measured memory_bytes: 443648
#include <bits/stdc++.h>
#include<unordered_map>
#include<unordered_set>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

#define int long long
#define ff first
#define ss second
#define loop(i,k,n) for(int i=k;i<n;++i)
#define rloop(i,n,k) for(int i=n;i>=k;i--)
#define vi vector<int>
#define vvi vector<vector<int>>
#define vpii vector<pair<int,int>>
#define all(v) v.begin(),v.end()
#define mset(a,i) memset(a,i,sizeof(a))
#define mii map<int,int>  
#define pii pair<int,int>
#define deb(...) __f(#__VA_ARGS__, __VA_ARGS__)
#define mp make_pair
#define pb push_back
#define mod 1000000007  
#define endl "\n"
#define inf 1e18

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> pbds1;

template <typename Arg1>
void __f (const char* name, Arg1&& arg1) { if(0) return; cout << name << " : " << arg1 << endl; }
template <typename Arg1, typename... Args>
void __f (const char* names, Arg1&& arg1, Args&&... args){   
    if(0) return; 
    const char* comma = strchr (names + 1, ',');
    cout.write (names, comma - names) << " : " << arg1 << " | "; __f (comma + 1, args...);
}
void get_it_done(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
}
int gcd(int a,int b){
    if(b==0) return a;
    if(a<b) return gcd(b,a);
    return gcd(b,a%b);
}
const int N = 3e5+5;

void solve(){
    int x,y;
    cin>>x>>y;
    bool flag = 0;
    loop(i,0,x+1){
        int a = 2*i;
        int b = (x-i)*4;
        if(a+b==y){
            flag = 1;
        }
    }
    if(flag){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }


}

int32_t main(){
    get_it_done(); 
    int tc=1;
    // cin >> tc;
    while (tc--){
        solve();        
    }
}


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

using namespace std;

int main(void) {
	char a, b;
	cin >> a >> b;

	if ((a == 'H') && (b == 'H')) {
		cout << "H" << endl;
	}
	if ((a == 'H') && (b == 'D')) {
		cout << "D" << endl;
	}
	if ((a == 'D') && (b == 'H')) {
		cout << "D" << endl;
	}
	if ((a == 'D') && (b == 'D')) {
		cout << "H" << endl;
	}
}


Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 2e5+5;
long long n,a,b;
long long h[MAXN];
long long temph[MAXN];
bool check(long long x){


    for(long long i=1;i<=n;i++){
        temph[i] = h[i] - (x*b);

    }
    long long ans = 0;
    for(long long i=1;i<=n;i++){
        if(temph[i]>0){
            ans+=(temph[i])/(a-b);
            if(temph[i]%(a-b)){
                ans++;
            }
        }
    }

    return ans<=x;
}
int main(){
    cin>>n>>a>>b;
    for(long long i=1;i<=n;i++){
        cin>>h[i];
    }
    long long l=0;
    long long ans = -1;
    long long r = 1e9;
    while(l<=r){
        int mid = (l+r)/2;
        if(check(mid)){
            r=mid-1;
            ans= mid;
        }else{
            l = mid+1;
        }
    }
    cout<<ans<<endl;
}


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

int main()
{
    string S;
    cin >> S;
    string A = "Yes";
    int N = S.size();
    for (int i = 0; i < (N - 1) / 2; i++)
    {
        if (S.at(i) != S.at(N - i - 1))
        {
            A = "No";
            break;
        }
    }
    if (A == "Yes")
    {
        if (N % 4 == 1)
        {
            for (int i = 0; i < (N - 1) / 4; i++)
            {
                if (S.at(i) != S.at((N - 1) / 2 - i - 1) || S.at((N - 1) / 2 + i + 1) != S.at(N - i - 1))
                {
                    A = "No";
                    break;
                }
            }
        }
        if (N % 4 == 2)
        {
            for (int i = 0; i < (N - 2) / 4; i++)
            {
                if (S.at(i) != S.at(N / 2 - i - 1) || S.at(N / 2 + i) != S.at(N - i - 1))
                {
                    A = "No";
                    break;
                }
            }
        }
        if (N % 4 == 3)
        {
            for (int i = 0; i < (N - 3) / 4; i++)
            {
                if (S.at(i) != S.at((N - 1) / 2 - i - 1) || S.at((N - 1) / 2 + i + 1) != S.at(N - i - 1))
                {
                    A = "No";
                    break;
                }
            }
        }
        if (N % 4 == 0)
        {
            for (int i = 0; i < N / 4; i++)
            {
                if (S.at(i) != S.at(N / 2 - i - 1) || S.at(N / 2 + i) != S.at(N - i - 1))
                {
                    A = "No";
                    break;
                }
            }
        }
    }
    cout << A << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define MOD 1000000007
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
using P = pair<int,int>;

int main()
{
  ll N;
  cin >> N;
  vector<ll> A(N+1);
  REP(i, N+1) cin >> A[i];
  ll sum=0;
  vector<ll> C(N+1);
  REPR(i,N){
    sum+=A[i];
    C[i]=sum;
  }
  vector<ll> B(N+1);
  B[0]=1;
  FOR(i,1,N+1){
    if(B[i-1]>=A[i-1]){
      B[i]=min((B[i-1]-A[i-1])*2,C[i]);
    }
  }
  REP(i,N+1){
    if(B[i]<A[i]){
      cout << -1 << endl;
      return 0;
    }
  }
  ll ans = 0;
  REP(i,N+1){
    ans+=B[i];
  }
  cout << ans << endl;
}

Measured memory_bytes: 5636
#include<string>
#include<cstdio>
#include<map>

int main(){
	using namespace std;
	int a,b;
	char c,d,s[9];
	map<char,char> code;
	while(scanf("%d",&a),a){
		while(a--){
			scanf(" %c %c",&c,&d);
			code[c]=d;
		}		
		scanf("%d",&a);
		while(a--){
			scanf(" %c",&c);
			if(code.count(c)==1){
				putchar(code[c]);
			}
			else{
				putchar(c);
			}
		}
		printf("\n");
		code.clear();
	}
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
int main(){
    long double a, l;
    cin >> l;
    a = l/3;
    cout << fixed;
    cout << setprecision(12) << a*a*a << endl;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#pragma G++ optimize("O3")

#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/priority_queue.hpp>

//using namespace __gnu_pbds;
using namespace std;

#define ll long long
#define ld long double
#define ull unsigned long long
#define mst(a, b) memset((a), (b), sizeof(a))
#define mp(a, b) make_pair(a, b)
#define pi acos(-1)
#define endl '\n'
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pdd pair<double, double>
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define lson l, mid, rt << 1
#define rson mid + 1, r, rt << 1 | 1
#define lowbit(x) x &(-x)
#define all(x) (x).begin(), (x).end()
#define sf(x) scanf("%d", &x)
#define pf(x) printf("%d", x)
#define debug(x) cout << x << endl
#define mod(x) (x % mod + mod) % mod

template <typename T>
void read(T &x)
{
    x = 0;
    char ch = getchar();
    ll f = 1;
    while (!isdigit(ch))
    {
        if (ch == '-')
            f *= -1;
        ch = getchar();
    }
    while (isdigit(ch))
    {
        x = x * 10 + ch - 48;
        ch = getchar();
    }
    x *= f;
}

const int INF = 0x3f3f3f3f;
const ll inf = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-8;
const int maxn = 1e3 + 7;
const int maxm = 1e5 + 7;
const int mod = 1e9 + 7;

#define IO ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
//template<typename T> using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
ll qpow(ll a, ll n)
{
    ll re = 1;
    while (n)
    {
        if (n & 1)
            re = (re * a) % mod;
        n >>= 1;
        a = (a * a) % mod;
    }
    return re % mod;
}
ll jc[maxm];
void init()
{
    jc[0] = 1;
    for (int i = 1; i < maxn; ++i)
        jc[i] = jc[i - 1] * i % mod;
}
int main()
{
    init();
    ll n, k;
    cin >> n >> k;
    //init(n, k);
    ll ans = 0;
    if (n <= k)
        ans = jc[k] * qpow(jc[n] * jc[k - n] % mod, mod - 2) % mod;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3140
#include <iostream>
#include <cmath>

#define SIZE 10000

using namespace std;

bool isPrime(int);

int main(void) {
	int n, list[SIZE];
	int count = 0;

	cin >> n;

	for (int i = 0; i < n; i++) {
		cin >> list[i];
	}

	for (int i = 0; i < n; i++) {
		if (isPrime(list[i])) {
			count++;
		}
	}

	cout << count << "\n";
	cin >> n;
	return 0;
}

bool isPrime(int n) {
	if (n < 2) {
		return false;
	}
	else if (n == 2) {
		return true;
	}
	else if (n % 2 == 0) {
		return false;
	}
	else {
		int max = sqrt(n);
		for (int i = 3; i <= max; i += 2) {
			if (n%i == 0) {
				return false;
			}
		}
		return true;

	}

}

Measured memory_bytes: 3124
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
using in = int64_t;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
const double PI=3.14159265358979323846;
const in MOD = 1000000007;
const in INF=1e18+7;
const int inf=1e9+7;
using P=pair<int,int>;
vector<int> dx={0,1,-1,0};
vector<int> dy={1,0,0,-1};


int main(){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cout << fixed << setprecision(10);
    vector<int> a(5);
    rep(i,5) cin>>a[i];
    rep(i,5){
        if(a[i]==0){
            cout<<i+1<<endl;
            return 0;
        }
    }
}/*
./problem.exe
*/

Measured memory_bytes: 3636
#[allow(unused_imports)]
use proconio::{
    fastout, input,
    marker::{Bytes, Chars, Isize1, Usize1},
};

#[fastout]
fn main() {
    input! {
        _n:usize,a:usize,b:usize,
        s:Chars,
    }
    let mut rank = 0;
    let mut count = 0;
    for i in s {
        if i == 'b' {
            rank += 1;
            if rank <= b && count < a + b {
                count += 1;
                println!("Yes");
            } else {
                println!("No");
            }
        } else if i == 'a' {
            if count < a + b {
                count += 1;
                println!("Yes");
            } else {
                println!("No");
            }
        } else {
            println!("No");
        }
    }
}

Measured memory_bytes: 2500
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Linq;
using System.IO;
public class CodeForces
{
#if TEST
// To set this go to Project -> Properties -> Build -> General -> Conditional compilation symbols: -> enter 'TEST' into text box.
const bool testing = true;
#else
    const bool testing = false;
#endif

    private static int Next()
    {
        int c;
        int res = 0;
        do
        {
            c = reader.Read();
            if (c == -1)
                return res;
        } while (c < '0' || c > '9');
        res = c - '0';
        while (true)
        {
            c = reader.Read();
            if (c < '0' || c > '9')
                return res;
            res *= 10;
            res += c - '0';
        }
    }
    private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10);
    private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), Encoding.ASCII, 1024 * 10);

    static void program(TextReader input)
    {
        //var t = int.Parse(input.ReadLine());
        //for(var T = 0; T < t; T++)
        //{
            var data = input.ReadLine().Split(' ').Select(long.Parse).ToList();
        var n = data[0];
        var m = data[1];
        Console.WriteLine((1900 * m + (n - m) * 100) * Math.Pow(2, m));
        //}
        
        
    }

    public static void Main(string[] args)
    {
        if (!testing)
        { // set testing to false when submiting to codeforces
            program(Console.In); // write your program in 'program' function (its your new main !)
            return;
        }

        Console.WriteLine("Test Case(1) => expected :");
        Console.WriteLine("2\n");
        Console.WriteLine("Test Case(1) => found    :");
        program(new StringReader("abacaba\n"));
        Console.WriteLine();

        Console.WriteLine("Test Case(2) => expected :");
        Console.WriteLine("1\n");
        Console.WriteLine("Test Case(2) => found    :");
        program(new StringReader("zzzzz\n"));
        Console.WriteLine();

        Console.WriteLine("Test Case(3) => expected :");
        Console.WriteLine("3\n");
        Console.WriteLine("Test Case(3) => found    :");
        program(new StringReader("abcde\n"));
        Console.WriteLine();

    }
}

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

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

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

void Main() {
  ll n;
  cin >> n;
  cout << n*(n-1)/2 << endl;
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}


Measured memory_bytes: 256
//
//  main.cpp
//  B - 81
//
//  Created by Hashizo on 2019/10/27.
//  Copyright © 2019 Hashizo. All rights reserved.
//

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <regex>
#include <cmath>

using namespace std;
 
#undef LONG_MAX
#undef LONG_MIN
 
#define LONG_MAX    9223372036854775807
#define LONG_MIN    (-LONG_MAX  -1)
 
#define ll long long
 
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
 
#define SORT(c) sort((c).begin(), (c).end())
#define REVERSE(v) reverse((v).begin(), (v).end())

int main(int argc, const char * argv[]) {

	ll n;
	cin >> n;

	FOR(i, 1, 10) {
		if((n / i) < 10) {
			if (n % i == 0) {
				cout << "Yes" << endl;
				return 0;
			}
		}
	}
		
	cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
using static System.Math;
using System.Numerics;
static class Program{
	const int mod=(int)1e9+7;
	const double eps=1e-11;
	static int[] s,h;
	static int[][] a;
	static int ans=0;
	static void Main(){
		Sc sc=new Sc();
		s=sc.Ia;
		h=new int[s[0]];
		a=sc.Arr(s[2],()=>sc.Ia);
		for(int i = 1;i<=s[1];i++) {Fu(0,i);}
		Console.WriteLine("{0}",ans);
	}
	static void Fu(int n,int g){
		h[n]=g;
		if(n==s[0]-1){
			int p=0;
			for(int i = 0;i<s[2];i++) {
				if(h[a[i][1]-1]-a[i][2]==h[a[i][0]-1]){p+=a[i][3];}
			}
			ans=Max(ans,p);
			return;
		}
		for(int i = g;i<=s[1];i++) {Fu(n+1,i);}
	}
}
public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
	public object[] Oa{get{return Console.ReadLine().Split();}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),int.Parse);}}
	public int[] Ia3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),int.Parse);}
	public int[] Ia3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),int.Parse);}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),long.Parse);}}
	public long[] La3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),long.Parse);}
	public long[] La3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),long.Parse);}
	public double[] Da2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),double.Parse);}}
	public double[] Da3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),double.Parse);}
	public double[] Da3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),double.Parse);}
	public T[] Arr<T>(int n,Func<T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f();}return a;}
	public T[] Arr<T>(int n,Func<int,T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i);}return a;}
	public T[] Arr<T>(int n,Func<string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(Console.ReadLine().Split());}return a;}
	public T[] Arr<T>(int n,Func<int,string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i,Console.ReadLine().Split());}return a;}
}

Measured memory_bytes: 27564
#include<iostream>
#include<vector>
#include<set>
using namespace std;

#define MAX 100000

vector<int> G[MAX];
int N;
bool visited[MAX];
int prenum[MAX], parent[MAX], lowest[MAX], timer;

void dfs(int current, int prev){
    prenum[current] = lowest[current] = timer;
    timer++;

    visited[current] = true;

    int next;

    for (int i = 0; i < G[current].size(); i++)
    {
        next = G[current][i];
        if (!visited[next])
        {
            parent[next] = current;

            dfs(next, current);
            lowest[current] = min(lowest[current], lowest[next]);
        }
        else if (next != prev)
        {
            lowest[current] = min(lowest[current], prenum[next]);
        }
    }
}

void art_points(){
    for (int i = 0; i < N; i++) visited[i] = false;
    timer = 1;
    dfs(0, -1);

    set<int> ap;
    int np = 0;
    for (int i = 1; i < N; i++)
    {
        int p = parent[i];
        if (p == 0) np++;
        else if (prenum[p] <= lowest[i])ap.insert(p);
    }
    if (np > 1)ap.insert(0);
    for (set<int>::iterator it = ap.begin(); it != ap.end(); it++)
   cout << *it << endl;    
}

int main(){
    int m;
    cin >> N >> m;

    for (int i = 0; i < m; i++){
        int s, t;
        cin >> s >> t;
        G[s].push_back(t);
        G[t].push_back(s);
    }
    art_points();
}


Measured memory_bytes: 6992
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        B solver = new B();
        solver.solve(1, in, out);
        out.close();
    }

    static class B {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            int a[][] = new int[3][3];
            int c[][] = new int[3][3];
            for (int i = 0; i < 3; i++) {
                for (int j = 0; j < 3; j++) {
                    a[i][j] = Integer.parseInt(in.next());
                }
            }
            int n = Integer.parseInt(in.next());
            int b[] = new int[n];
            for (int i = 0; i < n; i++) {
                b[i] = Integer.parseInt(in.next());
            }

            for (int i = 0; i < 3; i++) {
                for (int j = 0; j < 3; j++) {
                    for (int k = 0; k < n; k++) {
                        if (a[i][j] == b[k]) {
                            c[i][j] = 1;
                            continue;
                        }
                    }
                }
            }

            for (int i = 0; i < 3; i++) {
                if (c[i][0] + c[i][1] + c[i][2] == 3) {
                    out.println("Yes");
                    return;
                }
            }
            for (int i = 0; i < 3; i++) {
                if (c[0][i] + c[1][i] + c[2][i] == 3) {
                    out.println("Yes");
                    return;
                }
            }
            if (c[0][0] + c[1][1] + c[2][2] == 3) {
                out.println("Yes");
                return;
            }
            if (c[2][0] + c[1][1] + c[0][2] == 3) {
                out.println("Yes");
                return;
            }
            out.println("No");
        }

    }
}



Measured memory_bytes: 21844
#include<iostream>
#include<string>
#include<map>
#include<algorithm>
using namespace std;
int main() {
	int N; cin >> N;
	map<string, int>mp;
	for (int i = 0;i < N;i++) {
		string s;
		cin >> s;
		sort(s.begin(), s.end());
		mp[s]++;
	}

	long long ans = 0;
	for (auto p: mp) {
		int a = p.second;
		ans += (long long)a * (a - 1) / 2;
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 11136
#include <stdio.h>
int main(void){
    int n, k, q, p[100000+5]={0};
    scanf("%d %d %d", &n, &k, &q);
    for(int i=0; i<q; i++){
        int a;
        scanf("%d", &a);
        p[a-1]++;
    }
    for(int i=0; i<n; i++){
        if(p[i]-(q-k)>0)printf("Yes\n");
        else printf("No\n");
    }
    return 0;
}


Measured memory_bytes: 2048
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <string>

using namespace std;
int main(int argc, const char * argv[]) {
    
    int x, y;
    cin >> x >> y;
    
    cout << x + y/2 << endl;
    return 0;
}

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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

template<class V, int ME> class BIT {
public:
    V bit[1<<ME];
    V total(int e) {V s=0;e++;while(e) s+=bit[e-1],e-=e&-e; return s;}
    void update(int e, V val) {e++; while(e<=1<<ME) bit[e-1]+=val,e+=e&-e;}
};

int main(){
    int N, tmp;
    cin >> N;
    vector<int> inputs(N), rank(N);
    vector<pii> x(N);
    REP(i, N){
        cin >> x[i].first;
        x[i].second = i;
    }
    sort(x.begin(), x.end());

    BIT<int, 19> bit;
    ll res = 0;
    REP(i, N){
        bit.update(x[i].second, 1);
        //cout << bit.total(N) - bit.total(inputs[i]) << endl;
        res += (bit.total(N) - bit.total(x[i].second));
    }
    cout << res << endl;
    return 0;
}


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

int M,K;

int main() {
	cin>>M>>K;
	if(M==1){
		if(K==0){
			cout<<"0 0 1 1"<<endl;
		}else{
			cout<<"-1"<<endl;
		}
	}
	else{
		if(K >= (1 << M)){
			cout<<"-1"<<endl;
		}else{
			vector<int>ans;
			ans.push_back(K);
			for(int i=0;i<(1<<M);++i){
				if(i!=K)ans.push_back(i);
			}
			ans.push_back(K);
			for(int i=(1<<M)-1;i>=0;--i){
				if(i!=K)ans.push_back(i);
			}
			for(int i=0;i<ans.size();++i){
				cout<<ans[i]<<" \n"[i==(int)ans.size()-1];
			}
		}
	}
	return 0;
}

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

// typedef
// -----------------------------------------------------------------------------
typedef long long ll;
typedef long double ld;

// container util
// -----------------------------------------------------------------------------
#define ALL(c)  (c).begin(),(c).end()
#define SZ(c) ((ll)(c).size())
#define MAX(c) *max_element(ALL(c))
#define MIN(c) *min_element(ALL(c))
#define SORT(c) sort((c).begin(),(c).end())

// repetition
// -----------------------------------------------------------------------------
#define FOR(i, a, b) for(ll i= (a); i < (ll)(b); ++i)
#define REP(i, n) FOR(i, 0, n)

// constant
// -----------------------------------------------------------------------------
const ll INF = 1e9;
const ll MOD = 1e9 + 7;
const double EPS = 1e-9;
const double PI = acos(-1.0);

// debug
// -----------------------------------------------------------------------------
#define DUMP(x)  cerr << #x << " = " << (x) << endl


int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(15);
    ll N; cin >> N;
    map<ll, ll> m;
    REP(i, N) {
        ll x; cin >> x;
        m[x + 1]++;
        m[x - 1]++;
        m[x]++;
    }
    ll ans = 0;
    for(auto x : m) {
        ans = max(ans, x.second);
    }
    cout << ans << "\n";
}

Measured memory_bytes: 9476
def main():
    from sys import stdin
    n = int(stdin.readline().rstrip())
    As = list(map(int,stdin.readline().rstrip().split()))

    k = 0
    for i in range(n):
        k = As[i]*2 - k
    
    k=k//2
    for i in range(n):
        print(k,end=" ")
        k = As[i]*2 - k
main()

Measured memory_bytes: 14028