akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;

namespace ITP1_1_A
{
    class Program
    {

        static private List<int> ColumnVector_b = new List<int>();
        static private List<int> ranks_A = new List<int>();
        static private List<int> ColumnVector_c = new List<int>();
        static private string[] number = null;
        static void Main(string[] args)
        {
            string[] ranks_A_count = Console.ReadLine().Split();
            int ranks_A_CountRow = int.Parse(ranks_A_count[0]);
            int ranks_A_CountColumn = int.Parse(ranks_A_count[1]);

            input_Ranks_A(ranks_A_CountRow, ranks_A_CountColumn);
            input_ColumnVector(ranks_A_CountColumn);
            Calculate_Ranks_C(ranks_A_CountRow, ranks_A_CountColumn);
            output_Ranks(ColumnVector_c);

        }
        static void input_Ranks_A(int countRow, int CountColumn)
        {
            for (int i = 0; i < countRow; i++)
            {
                number = Console.ReadLine().Split();
                for (int j = 0; j < CountColumn; j++)
                {
                    ranks_A.Add(int.Parse(number[j]));
                }
            }
        }

        static void input_ColumnVector(int countRow)
        {
            for (int k = 0; k < countRow; k++)
            {
                ColumnVector_b.Add(int.Parse(Console.ReadLine()));
            }
        }

        static void Calculate_Ranks_C(int countRow, int countColumn)
        {
            int ranks_C_Row = 0;
            for (int i = 0; i < countRow; i++)
            {
                ranks_C_Row = 0;
                for (int j = 0; j < countColumn; j++)
                {
                    ranks_C_Row += ranks_A[i * countColumn + j] * ColumnVector_b[j];
                }
                ColumnVector_c.Add(ranks_C_Row);
            }
        }
        static void output_Ranks(List<int> ranks)
        {
            for (int i = 0; i < ranks.Count; i++)
            {
                Console.WriteLine(ranks[i]);
            }
        }
    }
}



Measured memory_bytes: 8840
#include <iostream>
#include <vector>
using namespace std;
int main() {
  int n, m, x;
  cin >> n >> m >> x;

  vector<int> c(n);
  vector<vector<int>> a(n, vector<int>(m));

  for (int i = 0; i < n; ++i) {
    cin >> c.at(i);
    for (int j = 0; j < m; ++j) {
      cin >> a.at(i).at(j);
    }
  }

  int ans = 1000000000;
  for (int i = 0; i <= (1<<n)-1; ++i) {
    int sum_c = 0;
    vector<int> sum_a(m, 0);
    for (int j = 0; j < n; ++j) {
      if (i>>j & 1) {
        sum_c += c.at(j);
        for (int k = 0; k < m; ++k) {
          sum_a.at(k) += a.at(j).at(k);
        }
      }
    }
    bool f = true;
    for (int k = 0; k < m; ++k) {
      if (sum_a.at(k) < x) {
        f = false;
        break;
      }
    }
    if (f && sum_c < ans) {
      ans = sum_c;
    }
  }
  if (ans == 1000000000) {
    cout << -1 << endl;
  } else {
    cout << ans << endl;
  }
  return 0;
}



Measured memory_bytes: 3628
#include <iostream>
#include <set>
#include <queue>
#include <algorithm>
#include <vector>
using namespace std;

typedef long long i64;

i64 x,y;

i64 cal(i64 a,i64 b)
{
	if(b - a < 0)
	{
		return 1LL << 60;
	}
	return b - a;
}

#define ANS(N) (ans = min(ans , (N)))

int main()
{
	cin >> x >> y;

	i64 ans = (1LL << 60);

	ANS(cal(x,y));
	ANS(cal(-x,y) + 1);
	ANS(cal(x , -y) + 1);
	ANS(cal(-x,-y) + 2);
	cout << ans << endl;
	return 0;
}


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

int main(void){
    int N, K;
    cin >> N >> K;
    double prob = 0;
    for(int x = 1; x <= N; x++){
        int n = ceil(log2(K) - log2(x));
        double win = 0;
        if(n > 0){
            win = 1.0 / (1 << n);
        }

        prob += win;
    }

    double result = 1.0/N * prob + max(0.0, (N - K + 1.0)/N);

    cout << fixed << setprecision(10) << result << endl;

    return 0;
}


Measured memory_bytes: 3856
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<list>
#include<set>
#include<string>
using namespace std;
int gcd(int a, int b) {
	int c = a % b;
	while (c != 0) {
		a = b;
		b = c;
		c = a % b;
	}
	return b;
}
struct UnionFind {
	vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

	UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
		for (int i = 0; i < N; i++) par[i] = i;
	}

	int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
		if (par[x] == x) return x;
		return par[x] = root(par[x]);
	}

	void unite(int x, int y) { // xとyの木を併合
		int rx = root(x); //xの根をrx
		int ry = root(y); //yの根をry
		if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
		par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
	}

	bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
		int rx = root(x);
		int ry = root(y);
		return rx == ry;
	}
};
typedef long long ll;

ll M = 1000000007;

vector<ll> fac(300001); //n!(mod M)
vector<ll> ifac(300001); //k!^{M-2} (mod M)

ll mpow(ll x, ll n) {
	ll ans = 1;
	while (n != 0) {
		if (n & 1) ans = ans * x % M;
		x = x * x % M;
		n = n >> 1;
	}
	return ans;
}
ll comb(ll a, ll b) {
	if (a == 0 && b == 0)return 1;
	if (a < b || a < 0)return 0;
	ll tmp = ifac[a - b] * ifac[b] % M;
	return tmp * fac[a] % M;
}
// mod. m での a の逆元 a^{-1} を計算する
long long modinv(long long a) {
	long long b = M, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= M;
	if (u < 0) u += M;
	return u;
}
vector<vector<ll>> mul(vector<vector<ll>> a, vector<vector<ll>> b, int n) {
	int i, j, k, t;
	vector<vector<ll>> c(n);
	for (i = 0; i < n; i++) {
		for (j = 0; j < n; j++) {
			t = 0;
			for (k = 0; k < n; k++)
				t = (t + a[i][k] * b[k][j] % M) % M;
			c[i].push_back(t);
		}
	}
	return c;
}

template< typename Monoid >
struct SegmentTree {

	int sz;
	vector< Monoid > seg;

	const Monoid M1;

	SegmentTree(int n, const Monoid &M1) : M1(M1) {
		sz = 1;
		while (sz < n) sz <<= 1;
		seg.assign(2 * sz, M1);
	}

	void set(int k, const Monoid &x) {
		seg[k + sz] = x;
	}

	void build() {
		for (int k = sz - 1; k > 0; k--) {
			seg[k] = f(seg[2 * k + 0], seg[2 * k + 1]);
		}
	}

	void update(int k, const Monoid &x) {
		k += sz;
		seg[k] = x;
		while (k >>= 1) {
			seg[k] = f(seg[2 * k + 0], seg[2 * k + 1]);
		}
	}

	Monoid query(int a, int b) {
		Monoid L = M1, R = M1;
		for (a += sz, b += sz; a < b; a >>= 1, b >>= 1) {
			if (a & 1) L = f(L, seg[a++]);
			if (b & 1) R = f(seg[--b], R);
		}
		return f(L, R);
	}

	Monoid value(const int &k) const {
		return seg[k + sz];
	}

	Monoid f(Monoid a, Monoid b) {
		return a + b;
	}
};

int main() {
	int n, i, m, k, j, l;
	cin >> n >> m;
	UnionFind uf(n + m);
	for (i = 0; i < n; i++) {
		cin >> k;
		for (j = 0; j < k; j++) {
			cin >> l;
			uf.unite(m + i, l - 1);
		}
	}
	for (i = 0; i < n - 1; i++) {
		if (!uf.same(m + i, m + i + 1)) {
			cout << "NO" << endl;
			return 0;
		}
	}
	cout << "YES" << endl;
}

Measured memory_bytes: 5760
#include<iostream>
#include<algorithm>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;

int main(){
    int n;
    cin >> n;
    if(n%3 != 0) cout << n/3 << endl;
    else cout << n/3 << endl;
    
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
const int Maxv=100005;
int fa[Maxv];

int find(int x){
	if(fa[x]!=x) fa[x]=find(fa[x]);
	return fa[x];
}

bool visited[Maxv];
int main()
{
	int n,m,i,j,x,y,z;
	cin>>n>>m;
	
	for(i=1;i<=n;i++) fa[i]=i;
	
	for(i=1;i<=m;i++){
		cin>>x>>y>>z;
		if(find(x)!=find(y))
			fa[find(y)]=find(x);
	}
	
	int ans=0;
	for(i=1;i<=n;i++)
		if(!visited[find(i)]){
			ans++;visited[find(i)]=true;
		}
	cout<<ans;
	return 0;
}

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

#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 drrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)

#define rng(a) a.begin(), a.end()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using ll = long long;
using ld = long double;

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

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
	os << "{";
	rep(i, (int)v.size()) {
		if (i)
			os << ",";
		os << v[i];
	}
	os << "}";
	return os;
}

template <typename T, size_t S> void printArray(const T (&array)[S]) {
	for (auto val : array)
		std::cout << val << ", ";
	std::cout << "\n";
}

const int MOD = 1'000'000'000 + 7;
const int INF = 1'000'000'000 + 5;

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

	int x; std::cin >> x;
	int cnt = x / 100;
	x %= 100;
	for (int i = 5; i > 0; i--) {
		while(cnt > 0 && x >= i)
			x -= i, cnt--;
	}
	if (x > 0)
		std::cout << 0 << "\n";
	else
		std::cout << 1 << "\n";
}


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

#define FOR(i,b,e) for(int i=(b); i <= (e); ++i)
#define FORD(i,b,e) for(int i=(b); i >= (e); --i)
#define SIZE(c) (int) (c).size()
#define FORE(i,c) FOR(i,0,SIZE(c)-1)
#define FORDE(i,c) FORD(i,SIZE(c)-1,0)

#define pb push_back
#define mp make_pair
#define st first
#define nd second


using namespace std;

typedef long long ll;
typedef pair <int,int> pii;
typedef pair <ll,ll> pll;

typedef vector <int> VI;
typedef vector <bool> VB;
typedef vector <pii> VP;
typedef vector <ll> VL;
typedef vector <pll> VPL;

typedef vector <VI> VVI;
typedef vector <VL> VVL;
typedef vector <VB> VVB;
typedef vector <VP> VVP;

const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000000000000001LL;


/*************************************************************************/

int main() {
    ios_base::sync_with_stdio(0);
    
    int n;
    ll l, t;
    
    cin >> n >> l >> t;
    
    VL x(n), dir(n);
    
    FOR(i,0,n-1) {
        cin >> x[i] >> dir[i];
        
        if (dir[i] == 2) {
            dir[i] = -1;
        }
    }
    
    VL after(n);
    FOR(i,0,n-1) {
        after[i] = x[i] + t * dir[i];
        
        after[i] %= l;
        if (after[i] < 0) after[i] += l;
    }
    
    sort(after.begin(), after.end());
    
    ll shiftNow = 0;
    FOR(i,0,n-1) shiftNow += after[i] - x[i];
    
    ll shiftWanted = 0;
    FOR(i,0,n-1) shiftWanted += t * dir[i];
    
    ll off = shiftWanted - shiftNow;
    assert(off % l == 0);
    
    ll offInd = off / l;
    
    FOR(i,0,n-1) {
        int j = (i + offInd) % n;
        if (j < 0) j += n;
        
        cout << after[j] << '\n';
    }

    return 0;
}

/*************************************************************************/


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

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

const int INF = 1e9;
const int MOD = 1e9 + 7;
 
// 4近傍、8近傍
int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};

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

  int ans = 0;
  for (int i = 0; i < s.size(); i++) if (s[i] == '2') ans++;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 768
#include<iostream>
#include <bits/stdc++.h>
using namespace std;
int main()
{
  int n ;
  cin >> n ;
  int t[n],x[n],y[n];
   t[0] = x[0] = y[0] = 0;
    for(int i=0;i<n; i++){
    cin >> t[i+1] >> x[i+1] >> y[i+1] ;
  }//for(i)
  
  bool can = true;
  for(int i=0;i<n;i++){
    int dt = t[i+1]-t[i];
    int dist = abs(x[i+1] - x[i]) + abs(y[i+1] - y[i]);
    if (dt < dist) can = false;
        if (dist % 2 != dt % 2) can = false;  // dist と dt の偶奇は一致する必要あり
  }
  
    if (can) cout << "Yes" << endl;
    else cout << "No" << endl;
  }


Measured memory_bytes: 1408
package main

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

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func main() {
	/*/TODO:!!!!!!!テスト用!!!!!!!!!
	sc = bufio.NewScanner(strings.NewReader(`
										`))
	//TODO:!!!!!!!テスト用!!!!!!!!!*/

	buf := make([]byte, 1024*1024)
	sc.Buffer(buf, bufio.MaxScanTokenSize)
	sc.Split(bufio.ScanWords)
	defer out.Flush() // !!!!caution!!!! you must use Fprint(out, ) not Print()
	/* --- code --- */
	//fmt.Fprintln(out, "[DEBUG]", time.Now())

	n := nextInt()
	f := make([]int, n+1)

	nf := func(x int, y int, z int) int {
		return x*x + y*y + z*z + x*y + y*z + z*x
	}

	xf := true
	for x := 1; xf; x++ {
		xf = false
		yf := true
		for y := 1; yf; y++ {
			nw := 0
			yf = false
			for z := 1; nw <= n; z++ {
				nw = nf(x, y, z)
				if nw <= n {
					xf = true
					yf = true
					f[nw]++
				}
			}
		}
	}
	for i := 1; i <= n; i++ {
		fmt.Fprintln(out, f[i])
	}

	//fmt.Fprintln(out, "[DEBUG]", a)
	//fmt.Fprintln(out, ans)

}

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

// -*-*-*-*-*-*-*-*-
// * I/O utilities *
// -*-*-*-*-*-*-*-*-

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

func nextFloat64() float64 {
	a, _ := strconv.ParseFloat(next(), 64)
	return a
}

func nextInts(n int) []int {
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}
func nextFloats(n int) []float64 {
	ret := make([]float64, n)
	for i := 0; i < n; i++ {
		ret[i] = nextFloat64()
	}
	return ret
}
func nextStrings(n int) []string {
	ret := make([]string, n)
	for i := 0; i < n; i++ {
		ret[i] = next()
	}
	return ret
}

func chars(s string) []string {
	ret := make([]string, len([]rune(s)))
	for i, v := range []rune(s) {
		ret[i] = string(v)
	}
	return ret
}

func printArray(a []int) {
	for i := 0; i < len(a); i++ {
		if i >= 1 {
			fmt.Fprint(out, " ")
		}
		fmt.Fprint(out, a[i])
	}
	fmt.Fprintln(out)
}

func absInt(x int) int {
	return int(math.Abs(float64(x)))
}
func minInt(x, y int) int {
	if x < y {
		return x
	}
	return y
}
func maxInt(x, y int) int {
	if x > y {
		return x
	}
	return y
}
func log10(x int) float64 {
	return math.Log10(float64(x))
}

// 挿入ソート配列
type slist struct {
	l []int
}

func makeSlist() slist {
	return slist{[]int{}}
}

func (s *slist) add(a int) {
	pos := sort.Search(len(s.l), func(i int) bool { return s.l[i] >= a })
	if pos < len(s.l) {
		s.l = append(s.l[:pos+1], s.l[pos:]...)
		s.l[pos] = a
	} else {
		s.l = append(s.l, a)
	}
}
func (s slist) contains(a int) bool {
	pos := sort.Search(len(s.l), func(i int) bool { return s.l[i] >= a })
	return pos < len(s.l) && s.l[pos] == a
}


Measured memory_bytes: 1960
import sys

# sys.stdin = open('a1.in')


def read_int_list():
    return list(map(int, input().split()))


def read_str_list():
    return input().split()


def read_int():
    return int(input())


def read_str():
    return input()


def main():
    n = read_str()
    if '9' in n:
        print('Yes')
    else:
        print('No')


main()


Measured memory_bytes: 2940
#include<iostream>
using namespace std;
#include <vector>
#include <algorithm> // sort
#include <map> // pair

main(){
  int n,i;
  cin >> n;
  int a[n];
  vector<pair<int, int> > pairs(n);
  
  for(i=0;i<n;i++){
    cin >> a[i];
    pairs[i]=make_pair(a[i],i);
  }
  sort(pairs.begin(), pairs.end());
  for(i=0;i<n;i++) cout << pairs[i].second+1 << endl;
  
}


Measured memory_bytes: 2048
// In the name of God

#include <bits/stdc++.h>

using namespace std;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	string s;
	cin >> s;

	if(s == "Sunny") cout << "Cloudy";
	else if(s=="Cloudy") cout << "Rainy";
	else cout << "Sunny";

	return 0;
}


Measured memory_bytes: 256
package main

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

const (
	initialBufSize = 1e4
	maxBufSize     = 1e6 + 7
)

var buf []byte = make([]byte, maxBufSize)
var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(buf, maxBufSize)
}

// 排他的論理和（XOR）の練習
// a^a = 0とか、交換法則が成り立つとか、a^0 = aとか。

func main() {
	N := nextInt()
	an := make([]int, N)
	ans := make([]int, N)
	var xorall int
	for i := range an {
		an[i] = nextInt()
		xorall ^= an[i]
	}
	for i := 0; i < N; i++ {
		ans[i] = xorall ^ an[i]
	}
	fmt.Println(strings.Trim(fmt.Sprint(ans), "[]"))
}

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

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

func pow(p, q int) int {
	res := p
	if q == 0 {
		return 1
	}
	for i := 0; i < q-1; i++ {
		res *= p
	}
	return res
}

func MinOf(vars ...int) int {
	min := vars[0]
	for _, i := range vars {
		if min > i {
			min = i
		}
	}
	return min
}

func MaxOf(vars ...int) int {
	max := vars[0]
	for _, i := range vars {
		if max < i {
			max = i
		}
	}
	return max
}

func gcdof2numbers(a int, b int) int {
	if b == 0 {
		return a
	}
	return gcdof2numbers(b, a%b)
}

func lcmof2numbers(a int, b int) int {
	return a / gcdof2numbers(a, b) * b
}

// マイナスの場合は考慮していない
func fuctorial(a int) int {
	if a == 1 || a == 0 {
		return 1
	} else {
		return fuctorial(a-1) * a
	}
}

func NextPermutation(x sort.Interface) bool {
	n := x.Len() - 1
	if n < 1 {
		return false
	}
	j := n - 1
	for ; !x.Less(j, j+1); j-- {
		if j == 0 {
			return false
		}
	}
	l := n
	for !x.Less(j, l) {
		l--
	}
	x.Swap(j, l)
	for k, l := j+1, n; k < l; {
		x.Swap(k, l)
		k++
		l--
	}
	return true
}

// 素因数分解したmapを返す
func primeFuctorize(n int) map[int]int {
	pf := map[int]int{}
	for i := 2; i*i <= n; i++ {
		for n%i == 0 {
			pf[i]++
			n /= i
		}
	}
	if n != 1 {
		pf[n]++
	}
	return pf
}


Measured memory_bytes: 19052
#include <iostream>
using namespace std;
typedef long long ll;

ll k;
ll a[100005];

ll simulate(ll n);

int main()
{
    cin >> k;
    for (int i = 0; i < k; i++) {
        cin >> a[i];
    }
    
    ll valid, invalid;
    ll minv, maxv;

    //min
    valid = 1ll << 60ll;
    invalid = 0;

    while (valid - invalid > 1) {
        ll mid = (valid + invalid) / 2;

        if (simulate(mid) >= 2) {
            valid = mid;
        }
        else {
            invalid = mid;
        }
    }

    if (simulate(valid) != 2) {
        cout << -1 << endl;

        return 0;
    }
    minv = valid;

    //max
    valid = 0;
    invalid = 1ll << 60ll;
    while (invalid - valid > 1) {
        ll mid = (valid + invalid) / 2;

        if (simulate(mid) >= 3) {
            invalid = mid;
        }
        else {
            valid = mid;
        }
    }
    maxv = valid;

    cout << minv << ' ' << maxv <<  endl;
        
    return 0;
}

ll simulate(ll n)
{
    for (int i = 0; i < k; i++) {
        n -= n % a[i];
    }

    return n;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int mod=1e9+7;
int n,chara[26],ans=1;
int main()
{
	string s;
	cin>>n>>s;
	for(int i=1;i<=n;i++) chara[s[i-1]-'a']++;
	for(int i=1;i<=26;i++) ans=1ll*ans*(chara[i-1]+1)%mod;
	cout<<(ans+mod-1)%mod<<endl;
}

Measured memory_bytes: 512
MOD = 1000000007

n , m = map(int,input().split())

a = [0 for i in range(n+1)]
for i in range(m):
    a[int(input())] = 1

count = [0 for i in range(n+1)]
for i in range(1,n+1):
    if a[i] == 1:
        continue
    
    if i == 1:
        count[i] = 1 
    elif i == 2:
        count[i] = count[i-1] + 1
    else:
        count[i] = (count[i-1] + count[i-2]) % MOD

print(count[n])


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

using namespace std;

int main(){
  int A,B,C;

  cin >> A >> B >> C;
  int c_5=0;
  int c_7=0;

  if(A == 5) c_5++;
  if(B == 5) c_5++;
  if(C == 5) c_5++;

  if(A == 7) c_7++;
  if(B == 7) c_7++;
  if(C == 7) c_7++;

  if(c_5 == 2 && c_7 == 1) cout << "YES" << endl;
  else cout << "NO" << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <climits>
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <stack>
#include <algorithm>
#include <iomanip>
#include <map>
#include <queue>
#include <functional>
#include <numeric>
#include <chrono>
#include <cstdlib>
using ll = long long;
using namespace std;

const ll MOD = 1e9 + 7;
const double pi = acos(-1);
typedef pair<int, int> P;
#define REP(i, n) for (int(i) = 0; (i) < (n); ++(i))
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define EPS 1e-4
#define OUTPUT(i) (cout << (ll)i << endl)
#define ALL(a) ((a).begin(), (a).end())

bool operator<(const pair<ll, ll> &a, const pair<ll, ll> &b)
{

    if (a.first == b.first)
        return a.second < b.second;

    return a.first < b.first;
}

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

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

    //cout << fixed << setprecision(15);

    string s;
    cin >> s;
    map<char, int> mp;
    for (int i = 0; i < s.size(); ++i)
    {
        mp[s[i]]++;
    }

    cout << min({mp['K'], mp['U'], mp['P'], mp['C']}) << endl;
    return 0;
}



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

ac = 0
wa = 0
tle = 0
re = 0

for i in range(n):
  s = input()
  if s == 'AC':
    ac = ac + 1
  elif s == 'WA':
    wa = wa + 1
  elif s == 'TLE':
    tle = tle + 1
  elif s == 'RE':
    re = re + 1

print('AC x '+str(ac))
print('WA x '+str(wa))
print('TLE x '+str(tle))
print('RE x '+str(re))

Measured memory_bytes: 9248
#include <stdio.h>
int main(void){
    int n;
    scanf("%d",&n);

    if(n == 1)
    {
        printf("Hello World");
    }

    else
    {
        int a, b, c;
        scanf("%d %d", &a, &b);
        c = a + b;
        printf("%d",c);
    }
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
   
using namespace std;
  
#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define Fixed fixed << setprecision(14)
#define int int64_t
using pii = pair<int,int>;
constexpr int INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod = 1e9+7; 
constexpr int MOD = 998244353;
 
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
 
template <class T> using min_heap = priority_queue<T,vector<T>,greater<T> >;
template <class T> using max_heap = priority_queue<T>;
   
int gcd(int a,int b){ return b ? gcd(b,a % b) : a;}
int lcm(int a,int b){ return a / gcd(a,b) * b;}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,k,x = 0,high = 0,res = 0;
    cin >> n >> k;
    while(k >= (1ll << high)){
        ++high;
    }
    vector<int> a(n),cnt(64);
    rep(i,n){
        cin >> a[i];
        if(k == 0) res += 0 ^ a[i];
        int tmp = a[i];
        for(int i = 0;tmp;++i){
            cnt[i] += tmp & 1;
            tmp >>= 1;
        }
    }
    if(k == 0) return cout << res << '\n',0;
    for(int i = high;i >= 0;--i){
        if(n - cnt[i] > cnt[i] && k >= x + (1ll << i)){
            x |= 1ll << i;
        }
    }
    rep(i,n){
        res += x ^ a[i];
    }
    cout << res << '\n';
    return 0;
}
    

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

int main(){
  long long x;
  cin>>x;
  int add=0;
  if(1<=x%11&&x%11<=6)add=1;
  if(7<=x%11&&x%11<=10)add=2;
  cout<<2*(x/11)+add<<endl;
  return 0;
}


Measured memory_bytes: 256
// READ & UNDERSTAND
// ll, int overflow, array bounds, memset(0)
// special cases (n=1?), n+1 (1-index)
// do smth instead of nothing & stay organized
// WRITE STUFF DOWN

#include <bits/stdc++.h>

using namespace std;

#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end() 
#define MOD 1000000007

typedef long long ll;
typedef pair <int, int> ii;
typedef pair <ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef long double ld;

ll INF=LLONG_MAX;

int const mxn=2e5+5;
map<pll,ii>mp;

ll modpow(ll a, ll b) // put b = mod-2, calc for (x!)^(mod-2) % mod only, [use x^(mod-2) when x^-1] 
{
	ll r=1;
	while(b)
	{
		if(b&1)r=(r*a)%MOD;
		a=(a*a)%MOD;
		b>>=1;
	}
	return r;
}

void multi(ll &a, ll b){
	a%=MOD; b%=MOD; a*=b; a%=MOD; return;
}

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    //freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
	ll a,b,n; cin >> n;
	int zero = 0;
	for(int i=0; i<n; i++){
		cin >> a >> b;
		if(a==0&&b==0){
			zero++;
			continue;
		}
		ll g = __gcd(a,b);
		a/=g; b/=g;
		if(b<0)a=-a,b=-b;
		if(b==0&&a<0)a=-a;
		if(a<=0){
			swap(a,b);
			b*=-1;
			mp[{a,b}].fi++;
		}else{
			mp[{a,b}].se++;
		}
	}
	ll ans = 1LL;
	for(auto p:mp){
		a = p.se.fi;
		b = p.se.se;
		ll now = 1LL;
		now += modpow(2,a)-1;
		now += modpow(2,b)-1;
		multi(ans,now);
	}
	ans--;
	ans += zero;
	ans = (ans+MOD)%MOD;
	cout << ans << endl;
}	


Measured memory_bytes: 16104
/*
 *  Created on: 13-July-2020
 *      Author: ankur314
 */
#include <bits/stdc++.h>
#define lli long long int
#define li long int
#define db double
#define ldb long double
#define vr vector
#define it iterator
#define fi(i,a,n) for(int i=a;i<n;i++)
#define fli(i,a,n) for(long int i=a;i<n;i++)
#define flli(i,a,n) for(long long int i=a;i<n;i++)
#define pb push_back
#define ppf() pop_front()
#define pii pair<int,int>
#define MOD 1000000007
#define INF 1000000005
#define PI acos(-1)
#define maxn 1000005

#define debug1(x) cerr<<x<<"\n"
#define debug2(x,y) cerr<<x<<" "<<y<<"\n"
#define debug3(x,y,z) cerr<<x<<" "<<y<<" "<<z<<"\n"
#define debug4(x,y,z,w) cerr<<x<<" "<<y<<" "<<z<<" "<<w<<"\n"

#define prAr(a, n) {for(int i = 0; i < n; i++) {cout<<a[i]<<" ";} cout<<"\n";}
#define inAr(a, n) for(int i = 0; i < n; i++) cin>>a[i];
#define prMat(a, n, m) {for(int i = 0; i < n; i++) {for(int j = 0; j < m; j++) {cout<<a[i][j]<<" ";} cout<<"\n";} }
#define inMat(a, n, m) {for(int i = 0; i < n; i++) for(int j = 0; j < m; j++) cin>>a[i][j]; }
#define nl cout<<"\n";

using namespace std;

void solve()
{
    int N, W; cin >> N >> W;
    lli w[N+1], v[N+1];
    fi(i,1,N+1) cin >> w[i] >> v[i];
    lli dp[N+1][W+1];
    fi(i,0,N+1)
    {
        fi(j,0,W+1)
        {
            if(i == 0 || j == 0) dp[i][j] = 0;
            else if(j-w[i] >= 0) dp[i][j] = max(dp[i-1][j], v[i] + dp[i-1][j-w[i]]);
            else dp[i][j] = dp[i-1][j];
        }
    }
    cout << dp[N][W];
}

int main(){
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    // freopen("/Users/administrator/Desktop/CODES/compile/testcase","r",stdin);
    // freopen("output.txt","w",stdout);
    // time_t start, end;
    int t = 1;
    // cin >> t;
    // time(&start);
    while(t--)
    {
        solve();
    }
    // time(&end);
    // double time_taken = double(end - start);
    // cerr << "Time taken by program is : " << fixed << time_taken << setprecision(5) << "seconds";
    return 0;
}


Measured memory_bytes: 82396
import java.util.*;

public class Main {
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int K = sc.nextInt();
        int C = sc.nextInt();
        char[] S = sc.next().toCharArray();
        int[] lf = new int[N];
        int[] rf = new int[N];
        int nowDay = 0;
        Arrays.fill(lf, -1);
        Arrays.fill(rf, -1);
        for(int i=0;i<N;i++){
            if(S[i] == 'o'){
                lf[i] = nowDay;
                i = i+C;
                nowDay++;
            }
        }
        nowDay = K-1;
        for(int i=N-1;i>=0;i--){
            if(S[i] == 'o'){
                rf[i] = nowDay;
                i = i-C;
                nowDay --;
            }
        }
        for(int i=0;i<N;i++){
            if(lf[i] != -1 && lf[i] == rf[i] && S[i] == 'o'){
                System.out.println(i+1);
            }
        }
    }

    private static void showArr(int[] a){
        for(int p:a){
            System.out.print(p);
        }
        System.out.println();
    }

}


Measured memory_bytes: 58456
import java.util.Scanner;
class Main
{
  public static void main(String[] args)
  {
    int[] p = new int[1000], s = new int[1000], vote = new int[1000];
    int n, m, ans = 0;
    Scanner scan = new Scanner(System.in);
    n = Integer.parseInt(scan.next());
    m = Integer.parseInt(scan.next());
    for(int i = 0; i < n; i++)
      p[i] = Integer.parseInt(scan.next());  
    for(int i = 0; i < m; i++)
    {
      s[i] = Integer.parseInt(scan.next());
      for(int j = 0; j < n; j++)
      {
        if(p[j] <= s[i])
        {
          vote[j]++;
          if(vote[j] > vote[ans])
            ans = j;
          break;
        }
      }
    }
    System.out.println(ans + 1);
  }
}

Measured memory_bytes: 22496
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0;i < n;i++)
#define rev(i, n) for(int i = n;i >= 0;i--)
#define Rep(i, m, n) for(int i = m;i < n;i++)
#define repeatrev(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
#define itn int

using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
typedef priority_queue<int> Pr;

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

vector<ll int> enum_div(ll int n)//nの約数を列挙
{
    vector<ll int> ret;
    for(ll int i=1 ; i*i<=n ; ++i)
    {
        if(n%i == 0)
        {
            ret.push_back(i);
            if(i!=1 && i*i!=n)
            {
                ret.push_back(n/i);
            }
        }
    }
    return ret;
}


ll int euclidean_gcd(ll int a, ll int b) {
    if(a < b) euclidean_gcd(b, a);
    ll int r;
    while ((r=a%b)) {
        a = b;
        b = r;
    }
    return b;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll int N;
    cin >> N;
    ll int a[N];
    rep(i, N) cin >> a[i];
    vector<ll int> r = enum_div(a[0]);
    r.push_back(a[0]);
    ll int max1 = 0;
    rep(i, r.size()){
        ll int g = 0;
        rep(j, N){
            if(a[j] % r[i] != 0) g ++;
            if(g == 2) break;
        }
        if(g == 0 || g == 1){
            if(r[i] > max1) max1 = r[i];
        }
    }
    ll int max2 = 0;
    vector<ll int> r1 = enum_div(a[1]);
    r1.push_back(a[1]);
    rep(i, r1.size()){
        ll int g = 0;
        rep(j, N){
            if(a[j] % r1[i] != 0) g ++;
            if(g == 2) break;
        }
        if(g == 0 || g == 1){
            if(r1[i] > max2) max2 = r1[i];
        }
    }
    cout << max(max1, max2) << endl;

}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int n,W;
int dp2[20000][20000];
int w[20000],v[20000];
int main(){
  cin >> n >> W;
  for (int i = 0; i < n; i++) {
    cin >> v[i] >> w[i];
  }
  for (int j = 0; j <= W; j++) dp2[n][j] = 0;

  for (int i = n - 1; i >= 0; i--) {
    for (int j = 0; j <= W; j++) {
      if (j < w[i])
      dp2[i][j] = dp2[i + 1][j];
      else
      dp2[i][j] = max(dp2[i + 1][j], dp2[i + 1][j - w[i]] + v[i]);
    }
  }
  cout << dp2[0][W] << endl;
}



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

int main() {
    multiset<int> set;

    int n; cin >> n;

    while(n--){
        int a; cin >> a;
        if(set.size() == 0) {
            set.insert(a);
            continue;
        }
        
        auto itr = set.lower_bound(a);
        if(itr != set.begin()){
            --itr;
            set.erase(itr);
        }
        set.insert(a);
    }

    cout << set.size() << endl;
}


Measured memory_bytes: 4992
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;



int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int x, a;
    cin >> x >> a;
    if (x < a) {
        cout << 0 << "\n";
    } else {
        cout << 10 << "\n";
    }


    return 0;
}

Measured memory_bytes: 256
def to_lower(x):
  if x == "A":
    return "a"
  elif x == "B":
    return "b"
  else:
    return "c"

n, k = map(int, input().split())
line = input()
s = [i for i in line]
s[k-1] = to_lower(s[k-1])
print("".join(s))

Measured memory_bytes: 3068
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AOJALDS15A
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var A = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            var q = int.Parse(Console.ReadLine());
            var mi = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            for (int i = 0; i < q; i++)
            {
                Console.WriteLine(solve(0, mi[i], A, n) ? "yes" : "no");
            }

            Console.ReadLine();
        }

        private static bool solve(int i, int m, int[] A, int n)
        {
            if (m == 0)
            {
                return true;
            }
            else if (i >= n)
            {
                return false;
            }
            else
            {
                var res = solve(i + 1, m, A, n) || solve(i + 1, m - A[i], A, n);
                return res;
            }
        }
    }
}



Measured memory_bytes: 18276
#include <iostream>
#include <climits>
#include <cmath>
#include <algorithm>

using namespace std;

long search(long n) {
    long d = sqrt(n)+1;
    long ans = LONG_MAX;

    for (long i=1; i<=d; i++) {
        if (n%i == 0) {
            ans = min(i+(n/i)-2, ans);
        }
    }

    return ans;
}

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

    cout << search(n) << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define maxn 3000
int main()
{
	int n;
	scanf("%d",&n);
	double dp[maxn] = {1.0};
	for(int i=1; i<=n; i++)
	{
		double p;
		scanf("%lf",&p);
		for(int j=min(i,n/2); j>0; j--)
			dp[j] = dp[j]*(1-p) + dp[j-1]*p;
		dp[0] = dp[0]*(1-p);
	}
	double ans = 1;
	for(int i=0; i<=n/2; i++)
		ans -= dp[i];
	printf("%.9f\n",ans);
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0;i<n;i++)
#define erep(i,n) for(int i = 0;i<=n;i++)
#define rep1(i,n) for(int i = 1;i<n;i++)
#define erep1(i,n) for(int i = 1;i<=n;i++)
typedef long long ll;
#define vint vector<int>
#define vvint vector<vector<int>>
#define vstring vector<string>
#define vdouble vector<double>
#define vll vector<ll>
#define vbool vector<bool>
#define INF 100000000000000009
#define int long long
using P = pair<int,int>;

int dfs(int a,int n,bool flag1,bool flag2,bool flag3,int count);

signed main(){
  int n;
  cin >> n;
  int ans = 0;
  cout << dfs(0,n,false,false,false,ans) << endl;
}

int dfs(int a,int n,bool flag1,bool flag2,bool flag3,int count){
    if(a > n) return count;
    if(a % 10 == 3) flag1 = true;
    if(a % 10 == 5) flag2 = true;
    if(a % 10 == 7) flag3 = true;
    if(flag1 && flag2 && flag3) count++;
    //cout << a << " " << count << endl;
    count = dfs(a*10 + 3,n,flag1,flag2,flag3,count);
    count = dfs(a*10 + 5,n,flag1,flag2,flag3,count);
    count = dfs(a*10 + 7,n,flag1,flag2,flag3,count);
    return count;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>  
using namespace std;
int a[4];
char f[4];
void dfs(int dep,int res){
	if(dep==3){
		if(res==7){
			printf("%d%c%d%c%d%c%d=7",a[0],f[0],a[1],f[1],a[2],f[2],a[3]);
			exit(0);
		}
		return;
	}
	f[dep]='-';
	dfs(dep+1,res-a[dep+1]);
	f[dep]='+';
	dfs(dep+1,res+a[dep+1]);
}
int main(){
	char s[4];
	scanf("%s",&s);
	a[0]=s[0]-48,a[1]=s[1]-48,a[2]=s[2]-48,a[3]=s[3]-48;
	dfs(0,a[0]);
}

Measured memory_bytes: 256
import sys
import math
import collections
from collections import deque
from functools import reduce
import heapq
n = int(input())
#n, m = map(int, sys.stdin.readline().split())
#s = input()
#a = list(map(int, sys.stdin.readline().split()))

ans = 0
for i in range(1, n+1):
    if i % 2 == 0:
        continue

    an = 0
    for j in range(1, i+1):
        if i % j == 0:
            an += 1

    if an == 8:
        ans += 1

print(ans)




            


        


Measured memory_bytes: 3564
from math import sqrt

n = int(input())
s = int(input())

#nをb進法表記したときの桁和
def f(b, n):
    res = 0
    while n:
        res += n % b
        n //= b
    return res
    
# s = n
if s == n:
    print(n+1)
    exit()

 
# 2 <= b <= sqrt(n)
for b in range(2, int(sqrt(n))+1):
    if f(b, n) == s:
        print(b)
        exit()
 
# sqrt(n) <= b <= n
for p in range(int(sqrt(n)), 0, -1):
    if (n - s) % p > 0:
        continue
    b = (n - s) // p + 1
    if b*b <= n:
        continue
    if f(b, n) == s:
        print(b)
        exit()
print(-1)

Measured memory_bytes: 3188
def main():
    x,y = map(int,input().split())
    ans = 0
    for i in range(100):
        for j in range(100):
            if i * 2 + j * 4 == y and i + j == x:
                ans = 1
    if ans == 1:
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    main()


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

template <typename T> using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define ull unsigned long long int
#define ll long long int
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(),x.end()
#define MOD (ull)(double)(1e9 + 7)
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vb vector<bool>
#define vd vector<double>
#define vll vector<ll>
#define vpii vector<pii>
#define vpll vector<pll>
#define vvi vector<vi>
#define vvll vector<vll>
#define vs vector<string>
#define pull pair<ull, ull>
#define F first
#define S second
#define m_p make_pair
#define debug(x) cout << #x << " " << x << endl
#define printArr(a, start, end)for(int i=start ; i<end ; ++i)cout << a[i] << " ";cout << '\n';
#define readArr(a, start, end)for(int i=start ; i<end ; ++i)cin >> a[i];
#define read2D(mat, n, m)for(int i=0 ; i<n ; ++i)for(int j=0 ; j<m ; ++j)cin >> mat[i][j];

const long double PI = 3.141592653589793238462643383279502884197169399;

// Find Set LSB = (x&(-x)), isPowerOfTwo = (x & (x-1))

void solve(){
	ll n, x, m;
	cin >> n >> x >> m;
	
	vll seq;
	seq.pb(x);
	set<ll> s;
	s.insert(x);
	
	while(1){
		x *= x;
		x %= m;
		if(s.find(x) != s.end())break;
		seq.pb(x);
		s.insert(x);
	}
	
	ll sum=0, cycleSize;
	vll cycleSum;
	ll c=0;
	for(int i=0 ; i<seq.size()&&i<n ; ++i){
		if(seq[i] == x){
			cycleSize = seq.size() - i;
			cycleSum.pb(seq[i]);
			for(int j=i+1 ; j<seq.size() ; ++j){
				cycleSum.pb(cycleSum.back() + seq[j]);
			}
			break;
		}
		++c;
		sum += seq[i];
	}
	
	if(c < n){
		ll left = n - c;
		ll cyclesNeeded = left / cycleSize;
		sum += cyclesNeeded * cycleSum.back();
		
		left = left % cycleSize;
		if(left)sum += cycleSum[left-1];
	}
	
	cout << sum;
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	cout << fixed << setprecision(10);
	
	int tt=1;
	//cin >> tt;
	
	while(tt--){
		solve();
	}
}


Measured memory_bytes: 6740
#include<iostream>
using namespace std;;
int main(){
int a,b,c,d;
cin >> a>>b>>c>>d;
int left=a+b;
int right = c+d;
if(left<right){
cout<<"Right";
}
else if(left==right){
cout <<"Balanced";

}
else
cout<<"Left";
return 0;
}

Measured memory_bytes: 768
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<queue>
#include<stack>
#include<cmath>

using namespace std;

int main() {
	int a, b;
	cin >> a >> b;
	if (a <= b) {
		cout << a << endl;
	}
	else {
		cout << a - 1 << endl;
	}

	return 0;
}

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

int main() {
	string S;
  	cin >> S;
  
    if (S[0]=='R' && S[1]=='R' && S[2]=='R') {
        cout << 3 << endl;
        return 0;
    } else if (S[0]=='R' && S[1]=='R') {
        cout << 2 << endl;
        return 0;
    } else if (S[1]=='R' && S[2]=='R') {
        cout << 2 << endl;
        return 0;
    } else if (S[0]=='R' || S[1]=='R' || S[2]=='R') {
        cout << 1 << endl;
        return 0;
    }
  
  	cout << 0 << endl;
    return 0;
}

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

const long long MOD = 1000000007;
const long long INF = 1LL << 60;
const int INT_INF = 1000000000;

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

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int N;
  cin >> N;
  vector<ll> A(N), B(N);
  for (int i = 0; i < N; i++)
  {
    cin >> A[i] >> B[i];
  }
  vector<pair<ll, int>> sum;
  for (int i = 0; i < N; i++)
  {
    sum.push_back(make_pair(A[i] + B[i], i));
  }
  sort(sum.begin(), sum.end(), greater<pair<ll, int>>());
  ll tsum = 0, asum = 0;
  for (int i = 0; i < N; i++)
  {
    if (i % 2 == 0)
      tsum += A[sum[i].second];
    else
      asum += B[sum[i].second];
  }
  cout << tsum - asum << endl;
  return 0;
}

Measured memory_bytes: 3956
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <math.h>
using namespace std;

int main(void){
    int n, d;

    cin >> n >> d;
    vector< vector<int> > v (n, vector<int>(d));

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

    int ans = 0;
    for(int i = 0; i < n; i++){
        for(int j = i+1; j < n; j++){
            int norm = 0;

            for (int k = 0; k < d; k++) {
                int diff = abs(v[i][k] - v[j][k]);
                norm += diff * diff;
            }
            
            bool flag = false;

            for (int k = 0; k <= norm; k++) {
                if(k * k == norm){
                    flag = true;
                }
            }

            if (flag == true){
                ans++;
            }
        }
    }
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<map>
#include<cstdio>
using namespace std;
int main(){
    map<char,bool>M;
    M['A']=true;
    M['B']=M['C']=false;
    char a,b;
    while(scanf("%c,%c",&a,&b)!=EOF){
        swap(M[a],M[b]);
    }
    for(map<char,bool>::iterator ite=M.begin();ite!=M.end();ite++){
        if(M[ite->first]){
            cout<<ite->first<<endl;
            break;
        }
    }

    return 0;
}

Measured memory_bytes: 1188
#include<bits/stdc++.h>
using namespace std;
#define int long long int
const int N = 1e+6;
const int mod = 1000000007;
int v[3005];
int dp[3005][3005];
int helper(int s,int e)
{
	if(s==e)
	{
		return v[s];
	}

	if(dp[s][e]!=INT_MIN)
	{
		return dp[s][e];
	}

	return dp[s][e] = max(v[s] - helper(s+1,e),v[e]-helper(s,e-1));
}
int32_t main()
{
	int n;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>v[i];
	}
	for(int i=0;i<3005;i++)
	{
		for(int j = 0;j<3005;j++)
		{
			dp[i][j] = INT_MIN;
		}
	}

	cout<<helper(0,n-1)<<endl;

	return 0;
}

Measured memory_bytes: 70912
#include<iostream>
#include<vector>
#include<algorithm>

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

using namespace std;

typedef long long ll;
const ll M = 1000000007;
const int N = 100000;

int n,r,s,t;
ll fact[N+1];
ll bit[N+1];

void init_bit(int n){
  for(int i=0;i<=n;i++)bit[i]=0;
}

ll sum(int i){
  ll res = 0;
  while(i > 0){
    res += bit[i];
    i -= i & -i;
  }
  return res;
}
 
void add(int i, ll x){
  while(i <= n){
    bit[i] += x;
    i += i & -i;
  }
}

int main(){
  fact[0] = 1;
  rep(i,N)fact[i+1] = (fact[i]*(i+1)) % M;

  while(cin >> n,n){
    cin >> r;
    vector<int> v(n);
    rep(i,n)v[i] = i+1;
    rep(i,r){
      cin >> s >> t; s--; t--;
      swap(v[s],v[t]);
    }

    init_bit(n);
    ll ans = 0;
    rep(i,n){
      ans += fact[i]*sum(v[n-1-i]);
      ans %= M;
      add(v[n-1-i],1);
    }
    cout << ans << endl;
  }
}

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

int main(){
    long long N;
    cin >> N;
    long long A[N];
    for(int i=0;i<N;i++) A[i]=i+1;
    long long sum=0;
    for(int i=0;i<N;i++){
        if(A[i]%3==0 || A[i]%5==0) A[i]=0;

        sum += A[i];
    }
    cout << sum << endl;
    
}



Measured memory_bytes: 11364
// template version 1.6
// {{{ define basic macro
using namespace std;
#include <iostream>
#include <bits/stdc++.h>
// varibable settings
#define int long long
#define INF 1000000000000000000LL
// #define INF 2147483647
#define MOD 1000000007LL
// #define MOD 998244353LL
#define infile "../test/sample-1.in"

#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)(b-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define ten(n) ((int)1e##n)
template<class T, size_t N> size_t sza(const T (&array)[N]) { return N; }
template<class T> inline void chmax(T &a, const T &b) { if(a < b) a = b; }
template<class T> inline void chmin(T &a, const T &b) { if(a > b) a = b; }
template<class T=int> T in() {T x; cin>>x; return (x);}
struct Fast { Fast(){ std::cin.tie(0); ios::sync_with_stdio(false); } } fast;

// dump macro
#ifdef PCM
  #include "dump.hpp"
#else
  #define dump(...) 42
  #define dump_1d(...) 42
  #define dump_2d(...) 42
#endif

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;
template<typename T> using PQ = priority_queue<T, vector<T>, greater<T>>;
int dx[]={1, -1, 0, 0};
int dy[]={0, 0, 1, -1};
#define fi first
#define se second

// }}}
string to_bin(int n, int d){
  // nをd桁の2進数で表示する。
  stringstream ss;
  ss << bitset<20>(n);
  return ss.str().substr(20-d, d);
}
bool is_valid(int i){
  bool flag=false;
  rep(j, 8){
    if (!flag and i>>j&1){
      flag=true;
    }
    else if (flag and i>>j&1) {
      return false;
    }
    if (!(i>>j&1)) flag=false;
  }
  return true;
}

int solve(){
  int H,W,K;cin>>H>>W>>K;

  int dp[H+1][W]={};
  dp[0][0] = 1;

  rep(h, H){
    rep(w, W){
      // dp[h][w]を飛ばす;
      rep(i, 1<<(W-1)){
        if (is_valid(i)){
          dump(to_bin(i, W-1));
          // stay
          if (!(i>>w&1) and !(i>>(w-1)&1)){
            dp[h+1][w] += dp[h][w];
            dp[h+1][w] %= MOD;
          }
          // right
          if (w<=W-2 and i>>w&1){
            dp[h+1][w+1] += dp[h][w];
            dp[h+1][w+1] %= MOD;
          }
          // left
          if (w>=1 and i>>(w-1)&1){
            dp[h+1][w-1] += dp[h][w];
            dp[h+1][w-1] %= MOD;
          }
        }
      }
    }
  }
  dump_2d(dp, H+1, W);
  cout << dp[H][K-1]%MOD << endl;

  return 0;
}

signed main() { //{{{
#ifdef INPUT_FROM_FILE
  std::ifstream in(infile);
  std::cin.rdbuf(in.rdbuf());
#endif
  solve();
  return 0;
} //}}}


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

const int MAXN = 3e5 + 10;

int n;
int a[MAXN], sum[MAXN];

inline bool check(int QAQ) {
	int min = 0;
	for (int i = 1; i < n; i += 2) sum[i] - min >= QAQ && (min = std::min(min, sum[i + 1]));
	return sum[n] - min >= QAQ; 
}

int main() {
	scanf("%d", &n);
	for (int i = 1; i <= n; ++i) scanf("%d", a + i);
	if (n % 2 == 0) {
		int A = 0, B = 0;
		for (int i = 1; i <= n >> 1; ++i) A += a[i * 2 - 1], B += a[i * 2];
		return printf("%d %d\n", std::max(A, B), std::min(A, B)), 0;
	}
	int A = 0, B = 0;
	for (int i = 1; i <= n; ++i) {
		if (i & 1) A += a[i], sum[i] = sum[i - 1] + a[i];
		else B += a[i], sum[i] = sum[i - 1] - a[i];
	}
	int ans = 0;
	for (int L = 0, R = n * 1000, mid = (L + R) >> 1; L <= R; mid = (L + R) >> 1) check(mid) ? L = (ans = mid) + 1 : R = mid - 1;
	ans = std::max(A, ans + B);
	printf("%d %d\n", ans, A + B - ans);
	return 0;
}
// A: odd, B: even

Measured memory_bytes: 6132