akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <deque>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <chrono>
#include <random>
#include <time.h>
#include <fstream>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb emplace_back
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define endl "\n"
#define all(c) begin(c),end(c)
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}
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;}
void print(vec v){for(auto e:v)cout<<e<<" ";cout<<endl;}
void print(vecll v){for(auto e:v)cout<<e<<" ";cout<<endl;}
void print(vector<vec> v){for(auto e:v){for(auto ee:e)cout<<ee<<" ";cout<<endl;}}
void print(map<int,int> mp){for(auto e:mp)cout<<e.first<<" "<<e.second<<endl;cout<<endl;}
const int INF=1e6;
const ll int MOD=998244353;

main(){
    int a=in();
    if(a<1200)cout<<"ABC";
    else cout<<"ARC";
}

Measured memory_bytes: 256
package main

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

// const abcd = "abcdefghijklmnopqrstuvwxyz"
// const ABCD = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

// var dy = [...]int{1, 1, 0, -1, -1, -1, 0, 1}
// var dx = [...]int{0, 1, 1, 1, 0, -1, -1, -1}

// var dx = [...]int{0, 1, 0, -1}
// var dy = [...]int{1, 0, -1, 0}

var inf int = 1e13
var mod = 1000000007

// ---------------------------------------------------------
func main() {
	log.SetFlags(log.Lshortfile)
	next := newScanner()
	N := next.Int()
	k := next.Int()
	ans := inf
	for a := 0; a <= N; a++ {
		b := N - a
		m := 1
		for i := 0; i < a; i++ {
			m *= 2
		}
		for j := 0; j < b; j++ {
			m += k
		}
		ans = min(ans, m)
	}
	fmt.Println(ans)
}

// ---------------------------------------------------------

// Pair is liked C++ pair
type Pair struct {
	a, b int
}

// Pairs is sorted by []Pair struct
type Pairs []Pair

func (p Pairs) Len() int {
	return len(p)
}
func (p Pairs) Swap(i, j int) {
	p[i], p[j] = p[j], p[i]
}

func (p Pairs) Less(i, j int) bool {
	if p[i].a < p[j].a {
		return true
	} else if p[i].a == p[j].a {
		return p[i].b < p[j].b
	}
	return false
}

// -------------------------------
func in(c, a, z int) bool {
	return c >= a && c < z
}

func btoi(b bool) int {
	if b {
		return 1
	}
	return 0
}

func itob(a int) bool {
	if a == 0 {
		return false
	}
	return true
}

func max(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r < a[i] {
			r = a[i]
		}
	}
	return r
}

func min(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r > a[i] {
			r = a[i]
		}
	}
	return r
}

func sum(a []int) int {
	r := 0
	for i := 0; i < len(a); i++ {
		r += a[i]
	}
	return r
}

func pro(a []int) int {
	r := 1
	for i := 0; i < len(a); i++ {
		r *= a[i]
	}
	return r
}

func fill(a []int, n int) []int {
	for i := 0; i < len(a); i++ {
		a[i] = n
	}
	return a
}

func minmax(a, b int) (int, int) {
	if a > b {
		return b, a
	}
	return a, b
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

// ---------- buffered scanner -----------------------------------------
type scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func newScanner() *scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 10000)
	return &scanner{r: rdr}
}
func (s *scanner) next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *scanner) Line() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *scanner) String() string {
	return s.next()
}
func (s *scanner) Int() int {
	v, _ := strconv.Atoi(s.next())
	return v
}
func (s *scanner) Ints(n int) []int {
	r := make([]int, n)
	for i := 0; i < n; i++ {
		r[i] = s.Int()
	}
	return r
}
func (s *scanner) Int64() int64 {
	v, _ := strconv.ParseInt(s.next(), 10, 64)
	return v
}
func (s *scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


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

int n;
int c[500], s[500], f[500];

int main() {
	int i, j;
	
	cin >> n;
	for (i = 0; i < n - 1; i++) cin >> c[i] >> s[i] >> f[i];
	
	for (i = 0; i < n; i++) {
		int t = 0;
		for (j = i; j < n - 1; j++) {
			t = max(s[j], (t + f[j] - 1) / f[j] * f[j]) + c[j];
		}
		cout << t << endl;
	}
	return 0;
}

Measured memory_bytes: 256
N=int(input())
a=list(map(int, input().split()))
b=list(map(int, input().split()))
c=list(map(int, input().split()))
s=0
pre=-3
for i in range(N):
    s+=b[a[i]-1]
    if a[i]==pre+1:
        s+=c[pre-1]
    pre=a[i]
print(s)


Measured memory_bytes: 3064
import itertools

N = input()
K = int(input())
lN = len(N)

if K == 1:
    ans = int(N[0])+9*(lN-1)
    print(ans)

elif K == 2:
    not0 = 1000
    for i in range(1,lN):
        if int(N[i]) != 0:
            not0 = i
            break

    ans = 0
    n = [i for i in range(lN)]

    for v in itertools.combinations(n,2):
        #print(v)
        if v[0] != 0:
            ans += 9*9
        else:
            if not0 >= v[1]:
                ans += (int(N[0])-1)*9 + int(N[v[1]])
            else:
                ans += int(N[0])*9
    print(ans)

else:
    not0f = 1000
    not0s = 1000
    for i in range(1,lN):
        if int(N[i]) != 0:
            not0f = i
            break
    for i in range(not0f+1,lN):
        if int(N[i]) != 0:
            not0s = i
            break
    ans = 0
    n = [i for i in range(lN)]
    for v in itertools.combinations(n,3):
        if v[0] != 0:
            ans += 9*9*9
        else:
            if not0f == v[1]:
                if not0s >= v[2]:
                    ans += max(0,int(N[0])-1)*9*9
                    ans += max(0,int(N[v[1]])-1)*9
                    ans += int(N[v[2]])
                else:
                    ans += max(0,int(N[0])-1)*9*9
                    ans += int(N[v[1]])*9
            elif not0f < v[1]:
                ans += int(N[0])*9*9
            else:
                ans += max(0,int(N[0])-1)*9*9

    print(ans)


Measured memory_bytes: 3188
//#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"

#define rep(i,n) for(ll (i)=0;(i)<(ll)(n);(i)++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007LL
#define INF (1LL<<60LL)
#define int long long
typedef long long ll;

using namespace std;


signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int w, a, b;
	cin >> w >> a >> b;
	int ans = 0;
	if (a + w <= b) ans = b - (a + w);
	else if (b + w <= a) ans = a - (b + w);
	cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
import java.util.HashMap;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner scan = new Scanner(System.in);
        int x = scan.nextInt();
        int y = scan.nextInt();
        
        HashMap<Integer, Integer> group = new HashMap<Integer, Integer>();
        group.put(1, 1);
        group.put(2, 3);
        group.put(3, 1);
        group.put(4, 2);
        group.put(5, 1);
        group.put(6, 2);
        group.put(7, 1);
        group.put(8, 1);
        group.put(9, 2);
        group.put(10, 1);
        group.put(11, 2);
        group.put(12, 1);
        
        System.out.println(group.get(x) == group.get(y) ? "Yes" : "No");
    }
}


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

#define PI 3.14159265359
#define INF 1e9
#define LINF 1e18
#define IMOD 1000000007 
#define irep(i,n) for(int i = 0; i < (int)(n); i++)
#define irep2(i,a,n) for(int i = (int)(a); i <= (int)(n); i++)
#define lrep(i,n) for(long long  i = 0; i < (long long)(n); i++)
#define lrep2(i,a,n) for(long long i = (long long)(a); i <= (long long)(n); i++)

#define irrep(i,n) for(int i = (int)(n-1); i > -1; i--)
#define irrep2(i,a,n) for(int i = (int)(n); i >= (int)(a); i--)

typedef long long ll;
typedef std::vector<char> v_char;
typedef std::vector<v_char > v2_char;
typedef std::vector<double> v_double;
typedef std::vector<v_double > v2_double;
typedef std::vector<int> v_int;
typedef std::vector<v_int > v2_int;
typedef std::vector<ll> v_ll;
typedef std::vector<v_ll > v2_ll;
typedef std::vector<std::string> v_string;
typedef std::vector<v_string > v2_string;
typedef std::vector<bool> v_bool;
typedef std::vector<v_bool > v2_bool;
typedef std::pair<ll, ll> pll;
typedef std::pair<int, int> pii;

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

int main(void)
{
    string s;
    cin >> s;

    set<char> alpha;
    irep(i, s.size()) {
        alpha.insert(s[i]);
    }
#if 1
    int ans = INF;
    for(auto target : alpha) {
        int cnt = 0;
        string org = s;
        while(1) {

            int n = org.size();
            bool loop = false;
            irep(i, n-1) {
                if(org[i] != org[i+1]) { 
                    loop = true;
                }
            }
            if(!loop) break;
            cnt++;

            string t;
            irep(i, n-1) {
                if(org[i] == target || org[i+1] == target) {
                    t += target;
                } else {
                    t += org[i];
                }
            }
            org = t;
        }
        ans = min(cnt, ans);
    }
    cout << ans;
#endif    
    return 0;
}
/** tcoder **/


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <cstdio>
#include<cstdint>
#include <utility>
#include <algorithm>
#include<map>
#include<cmath>
#include<vector>
#include<string>
#include<list>
#include<deque>
#include<stack>
#include<queue>
#include<set>
using namespace std;
typedef long long ll;
typedef pair<int,int>P;
typedef pair<double,double>P_D;
#define rep(i, n) for (int i = 0; i < n; i++)
#define reprev(i, n) for (int i = n - 1; i >= 0; i--)
#define MAX 100100
#define MAX_N 200100
#define SENTINEL 2000000000
const int MOD = 1e9+7;
#define NIL -1
const int INF = 1 << 29;
P s,t;
int main(){
    cin>>s.first>>s.second>>t.first>>t.second;
    const int dx=t.first-s.first,dy=t.second-s.second;
    cout<<string(dx,'R')<<string(dy,'U');
    cout<<string(dx,'L')<<string(dy,'D');
    cout<<'L'<<string(dy+1,'U')<<string(dx+1,'R')<<'D';
    cout<<'R'<<string(dy+1,'D')<<string(dx+1,'L')<<'U';
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

int r, g, b;

int main(void){
    std::cin >> r >> g >> b;
    int res = r*100 + g*10 + b;
    if(res%4 == 0){
        std::cout << "YES" << std::endl;
    }else{
        std::cout << "NO" << std::endl;
    }
}


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

long long n,k,i,j,res,d,A,B[101];

int main()
{
    cin>>n>>k;
    for (i=0;i<k;i++)
    {
        cin>>d;
        for (j=0;j<d;j++)
        {
            cin>>A;
            B[A]++;
        }
    }
    for (i=1;i<=n;i++)
    {
        if (B[i]==0) res++;
    }
    cout<<res;
    return 0;
}


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

int main(){
  int K;
  string S;
  
  cin >> K >> S;
  
  if(S.size() <= K){
    cout << S << endl;
  }else{
    for(int i = 0; i < K; i++){
      cout << S.at(i);
    }
    cout << "..." << endl;
  }
}
  
  

Measured memory_bytes: 3628
import sys
input = sys.stdin.readline
from collections import deque

def main():
    N = int(input())
    T = [[] for j in range(N + 1)]
    for i in range(N - 1):
        u, v, w = [int(x) for x in input().split()]
        T[u].append([v, w])
        T[v].append([u, w])

    ans = [0] * (N + 1)

    visited = set()
    visited.add(1)
    q = deque()
    q.append(1)

    while q:
        x = q.pop()
        for v in T[x]:
            if v[0] in visited:
                continue
            visited.add(v[0])
            q.append(v[0])
            if v[1] & 1:
                ans[v[0]] = (ans[x] + 1) % 2
            else:
                ans[v[0]] = ans[x]

    print("\n".join(map(str, ans[1:])))



        


if __name__ == '__main__':
    main()



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

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

    int ans = 0;
    for (int i = 0; i < s.size() / 2; i++)
    {
        if (s[i] != s[s.size() - 1 - i]) {
            ans++;
        }
    }

    std::cout << ans << "\n";
}

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

using namespace std;

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

	int tmp;

	tmp = n %10;

	if(tmp == 3) {
		printf("bon\n");
	} else if (tmp == 0 || tmp == 1 || tmp == 6 || tmp ==8 ) {
		printf("pon\n");
	} else
		printf("hon\n");



	return 0;
}

Measured memory_bytes: 3804
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main( int argc, char *argv[] )
{
    char s[200001];
    char t[200001];
    int n = 0;

    scanf( "%s %s", s, t );

    for( int i=0; i<strlen( s ); i++ )
        if( s[i] != t[i] ) n++;

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


Measured memory_bytes: 2076
#include <bits/stdc++.h>
using namespace std;
#define FAST ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define sz5 100005

int par[2*sz5];

int parent(int idx){
	if(par[idx]!=idx)
		par[idx]=parent(par[idx]);
	return par[idx];
}

int main() {
	FAST
	
	int n,q,x,y,ch,la;
	cin>>n>>q;
	for(la=1;la<=n;la++)
		par[la]=la;

	while (q--)
	{
		cin>>ch>>x>>y;
		if(ch==0){
			par[parent(x)]=parent(y);
		}else{
			if(parent(x) == parent(y))
				cout<<1<<endl;
			else
				cout<<0<<endl;
		}
	}
	return 0;
}

Measured memory_bytes: 4372
// Template from https://techracho.bpsinc.jp/jhonda/2019_08_05/78537

// input macro for competive-programming from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

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

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

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

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

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

    ($iter:expr, bytes) => {
        read_value!($iter, String).into_bytes()
    };

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

fn main() {
    use std::io::Read;
    let mut s = String::new();
    std::io::stdin().read_to_string(&mut s).unwrap();

    println!("{}", solve(&s));
}

macro_rules! test {
    ($($input:expr => $output:expr),* $(,)*) => {
        #[test]
        fn solve_test() {
            $(
                assert_eq!(solve($input), $output);
            )*
        }
    };
}

test! {
// r#"20"# => r#"15800"#,
}

fn solve(src: &str) -> String {
    input! {
        source = src,
        a: String,
        b: String,
    }

    if a == "H" && b == "H" {
        "H"
    } else if a == "D" && b == "D" {
        "H"
    } else {
        "D"
    }.to_string()
}

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

// 総数を1000000007で割った余り
const long long mod = 1e9 + 7;

using ll  = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

const long long MOD = 2;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    // cout << fixed << setprecision(5);

    int n, m;
    vi  vec[15];
    int w[15];

    // スイッチ 電球
    cin >> n >> m;
    rep(i, m) {
        int a;
        cin >> a;
        rep(j, a) {
            int x;
            cin >> x;
            x--;
            vec[i].push_back(x);
        }
    }

    rep(i, m) cin >> w[i];
    int ans = 0;
    rep(i, (1 << n)) {
        rep(j, m) {
            int x = 0;
            rep(k, vec[j].size()) {
                int a = vec[j][k];
                if (((i >> a) & 1)) x ^= 1;
            }
            if (x != w[j]) goto f;
        }
        ans++;
    f:;
    }
    cout << ans << endl;

    return 0;
}


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

typedef long long ll;
#define rep(i,n) for( ll (i)=0; (i)<(n); ++(i) )
#define rpv(d) for(auto& v:d)
#define co(n) cout << (n) << endl;
#define cn(n) cin >> n;
#define all(x) (x).begin(), (x).end()

int main(){
  int n;string s;cn(n)cn(s)
  if (n%2){
    puts("No");
  }else{
    if (s.substr(0,n/2)==s.substr(n/2,n/2)){
      puts("Yes");
    }else{
      puts("No");
    }
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;
inline int getInt() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
const int MX = 200005;



int main() {
  int n;
  scanf("%d",&n);
  vi a(n+1), b(n);
  cin>>a>>b;
  ll ans = 0;
  rep(i,n) {
    int x = min(a[i],b[i]);
    ans += x;
    b[i] -= x;
    x = min(a[i+1],b[i]);
    a[i+1] -= x;
    ans += x;
  }
  cout<<ans<<endl;
  return 0;
}






















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

using namespace std;

#define rep(i,n) for(int i=0;i<(n);++i)
#define out(S) cout<<(S)<<endl;
#define ShowAll(collection) for(auto i:collection){out(i);}
#define beginend(v) v.begin(),v.end()
#define Foreach(item,collection) for(auto item : collection)

using pii=pair<int,int>;
using vb=vector<bool>;
using ll=long long;
using ull=unsigned long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vvc=vector<vector<char>>;
using ti3=tuple<int,int,int>;
using ulong=unsigned long;
template<typename T> void removeAt(vector<T>& v, int index) { v.erase(v.begin() + index); }
#define OCB(c) (c&1)|(c&2)<<2|(c&4)<<4|(c&8)<<6|(c&16)<<8|(c&32)<<10|(c&64)<<12|(c&128)<<14

int main(){
    long a,b;
    cin >> a>>b;

    if(a>0&&b>0) {
        out("Positive")
        return 0;
    }
    if(a<=0&&b>=0){
        out("Zero")
        return 0;
    }
    auto cnt=abs(b-a) + 1;
    out((cnt%2==0)?"Positive":"Negative");
    
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    int N = scan.nextInt();
    scan.nextLine();
    String S = scan.nextLine();
    int K = scan.nextInt();

    char notReplaceChar = S.charAt(K - 1);
    StringBuilder sb = new StringBuilder();
    for (int i = 0; i < S.length(); i++) {
      char check = S.charAt(i);
      if(check == notReplaceChar) {
        sb.append(check);
      } else {
        sb.append('*');
      }
    }
    System.out.println(sb.toString());
  }
}


Measured memory_bytes: 22612
#!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    s = S()
    for i in range(3):
        if s[i] == s[i + 1]:
            print("Bad")
            return
    print("Good")
    return

#B
def B():
    n, l = LI()
    lis = [l + i for i in range(n)]
    s = sum(lis)
    a = inf
    for i in lis:
        if abs(a) > abs(i):
            a = i
    print(s-a)
    return

#C
def C():
    def gcd(a, b):
        a, b = max(a, b), min(a, b)
        while b:
            a, b = b, a % b
        return a
    def lcm(a, b):
        return a * b // gcd(a, b)
    a, b, c, d = LI()
    x = b // c - (a-1) // c
    y = b // d - (a-1) // d
    z = b // lcm(c , d) - (a-1) // lcm(c , d)
    print(b-a+1-(x+y-z))
    return

#D
def D():
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == '__main__':
    A()


Measured memory_bytes: 39408
#include<cstdio>
using namespace std;
int main(){
	int n,m;
	scanf("%d%d",&n,&m);
	for(int i=1;i<=(m+1)/2;i++)
		printf("%d %d\n",i,m+2-i);
	for(int i=1;i<=(m/2);i++)
		printf("%d %d\n",m+1+i,2*m+2-i);
	return 0;
}

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

const long long MOD = (long long)1e9 + 7;
const int h_max = 1001;
long long dp[h_max][h_max];
bool grid[h_max][h_max];

void add_self (long long &a, long long &b) {
  a += b;
  if (a >= MOD) {
    a -= MOD;
  }
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  #ifdef LOCAL_DEFINE
  freopen ("input.txt", "r", stdin);
  freopen ("output.txt", "w", stdout);
  #endif 
  int h, w;
  char cell;
  cin >> h >> w;
  for (int i = 0; i < h; ++i) {   
    for (int j = 0; j < w; ++j) {
      cin >> cell;
      grid[i][j] = cell == '.';
    }
  }
  dp[0][0] = 1L;
  for (int i = 0; i < h; ++i) {
    for (int j = 0; j < w; ++j) {
      if (i > 0 && grid[i - 1][j]) {
        add_self (dp[i][j], dp[i - 1][j]);
      }
      if (j > 0 && grid[i][j - 1]) {
        add_self (dp[i][j], dp[i][j - 1]);
      }
    }
  }
  cout << dp[h - 1][w - 1];
}

Measured memory_bytes: 9088
package main

import "fmt"

func main() {
	var N, M, p_tmp int
	var s_tmp string
	fmt.Scan(&N, &M)
	P := []int{}
	S := []string{}
	for m := 0; m < M; m++ {
		fmt.Scan(&p_tmp, &s_tmp)
		S = append(S, s_tmp)
		P = append(P, p_tmp)
	}
	already_AC := make([]bool, N+1)
	wrong_flag := make([]int, N+1)
	correct := 0
	wrong := 0
	for m := 0; m < M; m++ {
		if !already_AC[P[m]] {
			if S[m] == "AC" {
				already_AC[P[m]] = true
				correct++
			} else {
				wrong_flag[P[m]]++
			}
		}
	}
	for i := 0; i < len(wrong_flag); i++ {
		if already_AC[i] {
			wrong += wrong_flag[i]
		}
	}
	fmt.Println(correct, wrong)
}


Measured memory_bytes: 12804
#include  <bits/stdc++.h>
using namespace std;
static int fast_io = []() { std::ios::sync_with_stdio(false); cin.tie(nullptr); return 0; }();
bool isPalindrome(string s){
  string rev=string(s.rbegin(),s.rend());
  return s==rev;
}
int main(){
  string s;
  cin>>s;
  int n=s.size();
  string s1=s.substr(0,(n)/2);
  string s2=s.substr((n+2)/2,n-1);
  if(isPalindrome(s)&&isPalindrome(s1)&&isPalindrome(s2)){
    cout<<"Yes"<<"\n";  
  }
  else{
    cout<<"No"<<"\n";  
  }
  return 0;
}

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

int main(){
    string S; cin >> S;
    bool ans=true;
    if(S == "AAA" || S == "BBB")  ans=false;
    if(ans) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	static Scanner in = new Scanner(System.in);

	public static void main(String[] args) {
		int N = in.nextInt();
		int T = in.nextInt();

		int before = 0;
		long n = 0, sum = 0;

		for(int i = 0; i < N; i++){
			int t = in.nextInt();
			if(t - before > T){
				n += (t - before) - T;
			}
			sum += t;
			before = t;
		}
		System.out.println(before - n + T);

	}
}


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

int main(){
  
  int n;
  string s;
  
  cin >> n;
  
  bool flag;
  for(int i = 0; i < n; i++){
    cin >> s;
    
    if(s == "Y"){
      flag = 1;//Yがあればtrue
      break;
    }
    else flag = 0;
  }
  if(flag) cout << "Four";
  else cout << "Three";
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const int MOD2 = 998244353;


ll a[200010];

int main(){
    int n;
    cin >> n;
    rep(i, n) cin >> a[i];
    ll res = 0;
    int right = 0;
    ll now = 0;
    for (int left = 0; left < n; ++left) {
        while (right < n && (now ^ a[right]) == (now + a[right])) {
            now += a[right];
            ++right;
        }
        res += (right - left);
        if (right == left) ++right;
        else now -= a[left];
    }

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 5180
#include <bits/stdc++.h>
using namespace std;
using pint = pair<int, int>;
using ll = long long;
using ull = unsigned long long;
using vll = vector<long long>;
using pll = pair<ll, ll>;
#define FOR(i, begin, end) \
  for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) \
  for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define VREP(s, ite) for (auto ite = s.begin(); ite != s.end(); ++ite)
#define FI first
#define SE second
#define ALL(v) v.begin(), v.end()
//#define endl "\n"
#define ciosup \
  cin.tie(0);  \
  ios::sync_with_stdio(false);
#define eb emplace_back
#define vint vector<int>
constexpr ll INF = 1e15 + 7LL;
constexpr ll MOD = 1e9 + 7LL;
template <typename T>
istream &operator>>(istream &is, vector<T> &v) {
  for (int i = 0; i < v.size(); ++i) {
    is >> v[i];
  }
  return is;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  for (int i = 0; i < v.size() - 1; ++i) {
    os << v[i] << " ";
  }
  if (v.size() > 0) {
    os << v[v.size() - 1] << endl;
  }
  return os;
}

int main() {
  int h1,m1,h2,m2,k;
  cin >> h1 >> m1 >> h2 >> m2 >> k;
  int min1 = 60*h1 + m1, min2 = 60*h2 + m2;
  if (min1 > min2){
    min2 += 60 * 24;
  }
  cout << min2 - min1 - k << endl;
}

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

int main() {
    while(true) {
        int H, W;
        cin >>H >>W;
        if ((0==H)&&(0==W))
            break;
        for (int i=0; i<H; i++) {
            for (int j=0; j<W; j++)
                if (0==(i+j)%2)
                    cout <<'#';
                else
                    cout <<'.';
            cout <<endl;
        }
        cout <<endl;
    }
    return 0;
}


Measured memory_bytes: 3112
n, a, b, c, d = gets.chomp.split(' ').map{|i| i.to_i }
s = gets.chomp

a -= 1
b -= 1
c -= 1
d -= 1
success = true
if c < d
  sub_ac = s[a..c]
  sub_bd = s[b..d]
  #p sub_ac
  #p sub_bd
  success = false if sub_ac.match(/##/)
  success = false if sub_bd.match(/##/)
else
  sub_ac = s[a..c]
  sub_bd = s[b..d]
  sub_bd1 = s[b - 1..d + 1]
  #p sub_ac
  #p sub_bd
  #p sub_bd1
  success = false if sub_ac.match(/##/)
  success = false if sub_bd.match(/##/)
  success = false if !sub_bd1.match(/\.\.\./)
end

puts success ? 'Yes' : 'No'


Measured memory_bytes: 2428
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;

public class Main {

    public static void main(String[] args) {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        List<String> inputDataList = new ArrayList<String>();
        String input = null;

        try {
            while ((input = in.readLine()) != null) {
                inputDataList.add(input);
            }
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                in.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

        boolean firstTry = true;
        for (String inputData : inputDataList) {
            String[] years = inputData.split(" ");
            int start = Integer.parseInt(years[0]);
            int end = Integer.parseInt(years[1]);

            if (start == 0 && end == 0) {
                break;
            }

            if(firstTry) {
                firstTry = false;
            } else {
                System.out.println();
            }

            searchLeapYear(start, end);
        }
    }

    private static void searchLeapYear(int start, int end) {
        List<Integer> leapYearList = new LinkedList<Integer>();
        for (int i = start; i <= end; i++) {
            if (i % 4 == 0) {
                if (i % 100 != 0) {
                    leapYearList.add(i);
                } else {
                    if (i % 400 == 0) {
                        leapYearList.add(i);
                    }
                }
            }
        }

        if (leapYearList.size() != 0) {
            for (Integer year : leapYearList) {
                System.out.println(year);
            }
        } else {
            System.out.println("NA");
        }
    }
}

Measured memory_bytes: 20088
N = int(input())
A = list(map(int, input().split()))
M = 10**6 + 2
cnt = [0 for _ in range(M)]
A.sort()

for i in A:
    if cnt[i] != 0: # cnt[i]がそれまでに出てきた数値で割り切れていたとき
        cnt[i] = 2 # cnt[i]の倍数はどうせすでに1か2になっているので考慮しなくていい
        continue
    j = i
    while j < M:
        cnt[j] += 1
        j += i
ans = 0
for i in A:
    if cnt[i] == 1:
        ans += 1
print(ans)

Measured memory_bytes: 195124
#include<stdio.h>
int main(void){
  int i,t=0;
  char S[4];
  scanf("%s",S);
  for(i=0;i<4;i++){
    if(S[i]=='+'){
      t++;
    }else{
      t--;
    }
  }
  printf("%d\n",t);
  return 0;
}

Measured memory_bytes: 128
// #include<set>
// #include<vector>
// #include<algorithm>
#include<string>
#include<iostream>

using namespace std;

int A, B, C, K;
string s;

int main(){
    cin >> A>>B>>C >> K;
    if(K<=A+B){
      if(K<=A){
      	cout << K;
      }
      else cout << A;
    }
    else cout << 2*A + B - K; 
	return 0;
}

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

using namespace std;

int main() {
  int N, A, B, C, D;
  string S;
  cin >> N >> A >> B >> C >> D;
  --A; --B; --C; --D;  
  cin >> S;

  while (A != C) {
    if (S[A + 1] == '.') {
      A++;
    } else if (S[A + 2] == '.') {
      A += 2;
    } else {
      cout << "No" << endl;
      return 0;
    }
  }
  
  bool swappable = false;
  while (B != D) {
    if (S[B - 1] == '.' && S[B + 1] == '.') {
      swappable = true;
    }
    if (S[B + 1] == '.') {
      B++;
    } else if (S[B + 2] == '.') {
      B += 2;
    } else {
      cout << "No" << endl;
      return 0;
    }
  }

  if (S[B - 1] == '.' && S[B + 1] == '.') swappable = true;

  
  if (D < C && swappable) {
    cout << "Yes" << endl;
  } else if (D > C) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}



Measured memory_bytes: 640
import Control.Applicative

sort3 :: [Int]->[Int]

sort3 [x, y]
  | x <= y    = [x, y] 
  | otherwise = [y, x] 

sort3 [x, y, z]
  | x <= yy    = [x, yy, zz]
  | x <= zz     = [yy, x, zz]
  | otherwise  = [yy, zz, x]
  where
    [yy, zz] = sort3 [y, z]


main = do
  [str0, str1, str2] <- words <$> getLine
  let a = read str0 :: Int
  let b = read str1 :: Int
  let c = read str2 :: Int

  let dst_list = sort3 [a, b, c] 

  putStr $ show $ dst_list !! 0
  putChar ' '
  putStr $ show $ dst_list !! 1
  putChar ' '
  putStr $ show $ dst_list !! 2
  putChar '\n'

Measured memory_bytes: 3508
import java.util.Scanner;

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

		int N = sc.nextInt();
		int X = sc.nextInt();
		int[] D = new int[N+1];
		D[0] = 0;

		for (int i = 0; i < N; ++i) {
			D[i+1] = D[i] + sc.nextInt();
		}

		// X内でバウンドした回数
		int counter = 0;

		for(int coordinate : D) {
			if(X < coordinate) break;
			counter++;
		}

		System.out.println(counter);

		sc.close();
	}
}

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

int main(){
    ll n;
    cin >> n;

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

    ll Max=0, count=0;
   
    for (ll i=0; i<n-1; i++){
        if ( a[i+1] <= a[i]){
            count++;
        }
    
        Max = max(count, Max);
        if ( a[i+1] > a[i]){
            count=0;
        }
    }
    cout << Max << endl;
            
}


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

const int WIDTH = 600;
const int DEBUG = 0;

struct State {
	int score;
	int prevs;
	int sousa;
	int Last[29];
};

bool operator<(const State& a1, const State& a2) {
	if (a1.score < a2.score) return true;
	return false;
}

int N;
int C[29], S[409][29];
int cnts[409];
int Last[409];
State G[409][WIDTH + 9];
State H[(WIDTH * 26) + 9];

int getscore(vector<int> vec) {
	for (int i = 1; i <= 26; i++) Last[i] = 0;
	int t = 0;
	for (int i = 0; i < vec.size(); i++) {
		Last[vec[i]] = i + 1; t += S[i + 1][vec[i]];
		for (int j = 1; j <= 26; j++) t -= C[j] * ((i + 1) - Last[j]);
	}
	return t;
}

void solve(int pos, int num) {
	for (int i = 1; i <= 26; i++) {
		int NewScore = G[pos][num].score;
		NewScore += S[pos + 1][i];
		for (int j = 1; j <= 26; j++) {
			if (i != j) NewScore -= C[j] * ((pos + 1) - G[pos][num].Last[j]);
		}
		H[cnts[pos + 1]].score = NewScore;
		H[cnts[pos + 1]].prevs = num;
		H[cnts[pos + 1]].sousa = i;
		for (int j = 1; j <= 26; j++) H[cnts[pos + 1]].Last[j] = G[pos][num].Last[j];
		H[cnts[pos + 1]].Last[i] = pos + 1;
		cnts[pos + 1]++;
	}
}

int main() {
	// 入力
	if (DEBUG == 0) {
		cin >> N;
		for (int i = 1; i <= 26; i++) cin >> C[i];
		for (int i = 1; i <= N; i++) {
			for (int j = 1; j <= 26; j++) cin >> S[i][j];
		}
	}
	else {
		N = 365;
		for (int i = 1; i <= 26; i++) C[i] = rand() % 101;
		for (int i = 1; i <= N; i++) {
			for (int j = 1; j <= 26; j++) S[i][j] = ((rand() % 32768) * 32768 + (rand() % 32768)) % 20001;
		}
	}
	
	// ビームサーチ
	G[0][0].prevs = -1; cnts[0] = 1;
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < cnts[i]; j++) solve(i, j);
		sort(H, H + cnts[i + 1]);
		reverse(H, H + cnts[i + 1]);
		cnts[i + 1] = min(cnts[i + 1], WIDTH);
		for (int j = 0; j < cnts[i + 1]; j++) G[i + 1][j] = H[j];
	}

	// 復元
	vector<int> Answer; int cx = 0;
	for (int i = N; i >= 1; i--) {
		Answer.push_back(G[i][cx].sousa);
		cx = G[i][cx].prevs;
	}
	reverse(Answer.begin(), Answer.end());

	// 山登り法
	vector<int> R;
	for (int i = 1; i <= N; i++) R.push_back(Answer[i - 1]);
	int CurrentMax = getscore(R), S = 0;
	for (int t = 1; t <= 80000; t++) {
		if (rand() % 10 < 5) {
			int v1 = rand() % (N - 1);
			swap(R[v1], R[v1 + 1]);
			int CandMax = getscore(R);
			if (CurrentMax <= CandMax) { CurrentMax = CandMax; S = 0; }
			else { swap(R[v1], R[v1 + 1]); S += 1; }
		}
		else {
			int v1 = rand() % N, v2 = rand() % 26 + 1;
			int moto = R[v1];
			R[v1] = v2;
			int CandMax = getscore(R);
			if (CurrentMax <= CandMax) { CurrentMax = CandMax; S = 0; }
			else { R[v1] = moto; S += 1; }
		}
	}
	for (int i = 1; i <= N; i++) cout << R[i - 1] << endl;
	return 0;
}

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

using namespace std;

typedef long long ll;

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

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

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

	ll INF = 1e17;
	vector<vector<ll>> dp(n+1, vector<ll>(2, INF));
	dp[0][0] = 0;
	dp[0][1] = 1;

	rep(i, n){
		int x = s[i] - '0';
		chmin(dp[i+1][0], dp[i][0] + x);
		chmin(dp[i+1][1], dp[i][0] + (x + 1));
		chmin(dp[i+1][0], dp[i][1] + (10 - x));
		chmin(dp[i+1][1], dp[i][1] + (9 - x));
	}

	cout << dp[n][0] << endl;	
}


Measured memory_bytes: 58936
#include<iostream>
using namespace std;
class R
{
private:
	int *p;
	int n;
public:
	R(int n){
		this->n = n;
		p = new int[n];
	}
	void input(){
		int *s;
		for (s = p; s < p + n; s++){
			cin >> *s;
		}
	}
	void Display(){
		int *s;
		for (s = p; s < p + (n-1); s++){
			cout << *s << " ";
		}
		cout <<*s<< endl;
	}
	void reverse(int b, int e){
		int *s, *q, i = (e - b) / 2, x;
		for (s = p + b, q = p + e - 1, i; i>0; s++, q--, i--){
			x = *s;
			*s = *q;
			*q = x;
		}
	}

};
int main()
{
	int n, m, a, b;
	cin >> n;
	R r(n);
	r.input();
	cin >> m;
	for (int i = 0; i<m; i++)
	{
		cin >> a >> b;
		r.reverse(a, b);
	}
	r.Display();
	return 0;
}


Measured memory_bytes: 3108
#include <iostream>
#include <vector>
#include <cstdio>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <cmath>
#include <set>
#include <algorithm>

using namespace std;

typedef long long ll;

const int HOURS = 12;
const int MINUTES = HOURS * 60;
const double PI = atan(1) * 4;

#ifdef DEBUG
#define PRINT(v...) printf(v);
#else
#define PRINT(v...) ;
#endif

void solve(int A, int B, int H, int M){
	PRINT("%.12f\n", PI);
	PRINT("%d %d %d %d\n", A, B, H, M);
	double angle_minutes = M * 360.0 / 60;
	double angle_hour = H*(360.0/12) + M*(360.0/MINUTES);
	double angle_diff = abs(angle_minutes - angle_hour);
	// if (angle_diff > 180.0){
	// 	angle_diff -= 180.0;
	// }
	PRINT("%.12f, %.12f, %.12f\n", angle_minutes, angle_hour, angle_diff);
	double C = sqrt(A*A + B*B - 2*A*B*cos(angle_diff*2*PI/360));
	printf("%.20f\n", C);
}

void test(){
	int A = 3, B = 4;
	for(int H = 0; H < 12; H++){
		for(int M = 0; M < 60; M++){
			printf("%d %d ", H, M);
			solve(A, B, H, M);
		}
	}
}

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	int A, B, H, M;
	cin >> A >> B >> H >> M;
	solve(A, B, H, M);

	// test();

	return 0;
}


Measured memory_bytes: 4204
N = int(input())
S = input()

R = S.count("R")
G = S.count("G")
B = S.count("B")
ignore = 0
for i in range(N):
    a = S[i]
    for j in range(1,N):
        if i + j + j >= N:
            break
        b = S[i+j]
        c = S[i+j+j]
        if a != b and b != c and c != a:
            ignore += 1
print(R * G * B - ignore)

Measured memory_bytes: 9204
#include<stdio.h>
#include<math.h>

int main(){
  int n,t[100000],x[100000],y[100000],i,flag=1;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d %d %d",&t[i],&x[i],&y[i]);
  }
  for(i=0;i<n;i++){
    if((t[i]-x[i]-y[i])>=0&&(t[i]-x[i]-y[i])%2==0);
    else {
      flag=0;
      break;
    }
  }
  if(flag) printf("Yes\n");
  else printf("No\n");
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) FOR(i,0,n)
#define repr(i,n) for(int i=(n)-1;0<=i;--i)
#define each(e,v) for(auto&& e:(v))
#define all(v) begin(v),end(v)
#define dump(x) cerr<<#x<<": "<<(x)<<endl
#define INF 100000000
#define IINF 9999999999999;
using std::cin;
using std::cout;
using std::endl;
using std::ios;
using vint = std::vector<int>;
using ll = long long;
using vll = std::vector<ll>;
template <class T> void chmin(T& a, const T& b) { a = std::min(a, b); }
template <class T> void chmax(T& a, const T& b) { a = std::max(a, b); }

ll n, c, res = IINF;
ll ds[31][31];
ll cols[3][31];
ll wr[555][555];

int main()
{
    cin >> n >> c;

    FOR(i, 1, c + 1)
    {
        FOR(j, 1, c + 1)
        {
            cin >> ds[i][j];
        }
    }

    FOR(i, 1, n + 1)
    {
        FOR(j, 1, n + 1)
        {
            cin >> wr[i][j];
            FOR(t, 1, c + 1)
            {
                if (wr[i][j] == t) continue;
                cols[(i + j) % 3][t] += ds[wr[i][j]][t];
            }
        }
    }

    FOR(i, 1, c + 1)
    {
        FOR(j, 1, c + 1)
        {
            if (j == i) continue;
            FOR(t, 1, c + 1)
            {
                if (t == i || t == j) continue;
                res = std::min(res, cols[0][i] + cols[1][j] + cols[2][t]);
            }
        }
    }
    cout << res << endl;
}

Measured memory_bytes: 2432
#include <cstdio>
#include <cmath>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>

#ifdef _DEBUG
#define DMP(x) cerr << #x << ": " << x << "\n"
#else
#define DMP(x) ((void)0)
#endif

const int MOD = 1000000007, INF = 1111111111;
using namespace std;
typedef long long lint;

lint tran(vector<pair<int, int>> &vec, lint n) {

	lint res = n, tmp;
	if (vec.size() == 3) {
		for (lint i = 0; i * vec[0].first <= n; i++) {
			for (lint j = 0; i * vec[0].first + j * vec[1].first <= n; j++) {
				tmp = n - i * vec[0].first - j * vec[1].first;
				res = max(res, i * vec[0].second + j * vec[1].second +
					tmp / vec[2].first * vec[2].second +
					tmp % vec[2].first);
			}
		}
	}	

	if (vec.size() == 2) {
		for (lint i = 0; i * vec[0].first <= n; i++) {
			tmp = n - i * vec[0].first;
			res = max(res, i * vec[0].second +
				tmp / vec[1].first * vec[1].second +
				tmp % vec[1].first);
		}
	}

	if (vec.size() == 1) { res = max(res, n / vec[0].first * vec[0].second + n % vec[0].first); }
	return res;
}

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int N;
	cin >> N;

	vector<int> a(3), b(3);
	for (int i = 0; i < 3; i++) cin >> a[i];
	for (int i = 0; i < 3; i++) cin >> b[i];

	vector<pair<int, int>> ab, ba;
	for (int i = 0; i < 3; i++) {
		if (a[i] < b[i]) ab.emplace_back(make_pair(a[i], b[i]));
		if (a[i] > b[i]) ba.emplace_back(make_pair(b[i], a[i]));
	}

	cout << tran(ba, tran(ab, N)) << "\n";

	return 0;
}


Measured memory_bytes: 384
package main 

import "fmt"

func main() {
	var s string
	fmt.Scan(&s)
	length := len(s)
	count := 0
	if length % 2 == 0{
		for i := 0; i<(length/2) ; i++{
			if s[i] != s[length-1-i] {
				count++
			}
		}
		fmt.Printf("%d", count)
	} else {
		for i:=0; i < (length/2);i++{
			if s[i] != s[length-1-i] {
				count++
			}
		}
		fmt.Printf("%d",count)
	}
}

Measured memory_bytes: 512
n, m = gets.split.map(&:to_i)
pys = []
m.times do
  pys << gets.split.map(&:to_i)
end

res = pys.sort_by{|a,b|b}

count = 0

record = -1

i = 0

while i < m
	if record <= res[i][0]
		count += 1
		record = res[i][1]
	end
	i += 1
end

puts count

Measured memory_bytes: 14712
//
// Created by yamunaku on 2020/03/22.
//

#include <bits/stdc++.h>

using namespace std;

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repl(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perl(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD9 998244353
#define MOD1 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
#define SP <<" "<<
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define CFS cin.tie(0);ios::sync_with_stdio(false)
#define CST(x) cout<<fixed<<setprecision(x)

using ll = long long;
using ld = long double;
using vi = vector<int>;
using mti = vector<vector<int>>;
using vl = vector<ll>;
using mtl = vector<vector<ll>>;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
template<typename T>
using heap = priority_queue<T, vector<T>, function<bool(const T, const T)>>;

int main(){
    //CFS;
    double l;
    cin >> l;
    CST(10);
    cout << (l / 3) * (l / 3) * (l / 3) << endl;
    return 0;
}

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

using point = std::pair<int, int>;

int main(){
    int N, M;
    std::cin >> N >> M;
    std::vector<point> student(N), check(M);
    for(int i = 0; i < N; i++) std::cin >> student[i].first >> student[i].second;
    for(int i = 0; i < M; i++) std::cin >> check[i].first >> check[i].second;
    for(int i = 0; i < N; i++){
        int dist = 2000000001;
        int checPoint = 0;
        for(int j = 0; j < M; j++){
            int tmp = std::abs(student[i].first - check[j].first) + std::abs(student[i].second - check[j].second);
            if(tmp < dist){
                dist = tmp;
                checPoint = j + 1; // to 1 origin
            }
        }

        std::cout << checPoint << std::endl;
    }

    return 0;
}


Measured memory_bytes: 256
//JSD
#include<iostream>
#include<vector>
#include<map>
#define ll long long
using namespace std;
int main(){
	int n;
	cin>>n;
	ll sum=0;
	int a[n+1],b[n+1];
	for(int i=1;i<=n;i++) cin>>a[i],b[i]=a[i];
	for(int i=n/2;i>=1;i--){
		ll ans=0;
		for(int j=2;j*i<=n;j++){
			ans+=b[j*i];
		}
		ans=ans%2;
		if(a[i]==1){
			if(ans==1) b[i]=0;
			else b[i]=1;
		}
		else{
			if(ans==1) b[i]=1;
			else b[i]=0;
		}
	}
	vector<int > v;
	for(int i=1;i<=n;i++){
		if(b[i]==1)
		v.push_back(i);
	}
	cout<<v.size()<<"\n";
	for(int i=0;i<v.size();i++) cout<<v[i]<<" ";
	return 0;
}

Measured memory_bytes: 3064