akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <cstdlib>  // abs() for integer 絶対値求めやつ
#include <cmath>    // abs() for float, and fabs()
#include <algorithm>
#include <vector>
#include <string>
#define rep(i,n) for(int i = 0; i< (n);i++)
#define SORT(a) sort((a).begin(),(a).end());
#define che(a,string) cout<<string<<":"<<(a)<<endl;
#define ch(a,string) cout<<string<<":"<<(a)<<" ";
using namespace std;
typedef pair<int,int> p;
int main(){
   int n;cin>>n;
   int ans = 100000000;
   rep(i,n){
	long long  a;cin>>a;	
	int b =0;
	while(a%2==0){
	  a/=2;
	  b++;
	  }
	  ans=min(b,ans);
	 }
	 cout<<ans<<endl;
 }



Measured memory_bytes: 256
import sys
import math

n,m = map(int, input().split())
ab = []

for i in range(n):
    ab.append(list(map(int,input().split())))
ab.sort()

ans = 0
for i in range(n):
    if m >= ab[i][1]:
        ans += ab[i][0] * ab[i][1]
        m = m - ab[i][1]
    else:
        ans += ab[i][0] * m
        break
print(ans)




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

using namespace std;
typedef long long LL;
const double pi=3.14159265359;

int main(){
  double R;
  cin >> R;
  cout << R*2*pi << endl;

  return 0;
}


Measured memory_bytes: 3788
using System;
using System.Linq;

namespace hogehoge
{
    class Program
    {
        static void Main(string[] args)
        {
            var s = Console.ReadLine();
            if(IsBatch(s) && IsBatch(s.Substring(0,(s.Length-1)/2)) && IsBatch(s.Substring((s.Length+3)/2-1,s.Length-(s.Length+3)/2+1)))
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }

        static bool IsBatch(string s)
        {
            return s.SequenceEqual(string.Join("",s.Reverse()));
        }
    }
}


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

#define sz(x) int(x.size())
#define pii pair<int, int>
#define Task "abc"
#define For(i, a, b) for(int i = (a), _b = (b); i <= b; ++i)
#define Debug(X) cout << #X << " = " << X << '\n'
#define All(x) (x).begin(), (x).end()
#define mp make_pair

typedef unsigned long long ull;
typedef long long ll;

const int maxn = 2e5 + 10;
const int inf = 0x3f3f3f3f;
const ll mod = 1e9 + 7;

char s[maxn];

ll my_pow(ll a, ll b, ll mod){
  if (b == 0) return 1 % mod;
  ll tmp = my_pow(a, b / 2, mod);
  tmp = (tmp * tmp) % mod;
  if (b % 2) return (tmp * a) % mod;
  return tmp;
}

int main(){
  ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0);
//  freopen(Task".inp", "r", stdin);
//  freopen(Task".out", "w", stdout);
  ll n, p;
  cin >> n >> p;
  cin >> s + 1;
  vector<ll> modd(p, 0);
  ll ans = 0;
  if (p == 2 || p == 5){
    for (int i = 1; i <= n; ++i){
      int d = s[i] - '0';
      if (d % p == 0) ans += i;
    }
  } else {
    ll suf = 0;
    modd[0] = 1;
    for (int i = n; i > 0; --i){
      int d = s[i] - '0';
      suf = my_pow(10, n - i, p) * d + suf;
      suf %= p;
//      cout << modd[suf] <<' ';
      ans = ans + modd[suf];
      modd[suf]++;
    }
  }
  cout << ans;
}



Measured memory_bytes: 512
#include<stdio.h>
#define MAX 100


void trace(int A[],int n){
  int i;

  for(i=0;i<n;i++){
    if(i>=1)printf(" ");
    printf("%d",A[i]);
  }
  printf("\n");
}

void ins(int A[],int n){
  int i,j;
  int v;

  for(i=1;i<n;i++){
    v=A[i];
    j=i-1;
    while(j>=0&&A[j]>v){
      A[j+1]=A[j];
      j--;
    }
    A[j+1]=v;

    trace(A,n);
  }
}

int main(){
  int A[MAX];
  int i,j;
  int n;

  scanf("%d",&n);
  for(i=0;i<n;i++)scanf("%d",&A[i]);

  trace(A,n);
  ins(A,n);

  return 0;
}



Measured memory_bytes: 2072
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;
const ll INF=0x3f3f3f3f;
ll a[105];
void solve(int T){
	int n,ans=0;
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%lld",&a[i]);
	}
	sort(a+1,a+n+1);
	for(int i=1;i<=n;i++){
		for(int j=i+1;j<=n;j++){
			for(int k=j+1;k<=n;k++){
				if(a[i]==a[j]||a[i]==a[k]||a[j]==a[k])continue;
				if(a[i]+a[j]>a[k])ans++;
			}
		}
	}
	printf("%d",ans);
}
signed main(){
	int t=1;
	//scanf("%d",&t);
	for(int i=1;i<=t;i++){
		solve(i);
	}
}

Measured memory_bytes: 3824
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <numeric>
#include <stdio.h>
#include <stack>
#include <queue>
#include <cstdio>
#include <cmath>
#include <iterator>
#include <map>

using namespace std;

#define Int int64_t

void printVec(std::vector<int>& vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}
void printVec1(std::vector<string>& vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}

template<typename T>
void remove(std::vector<T>& vector, unsigned int index)
{
	vector.erase(vector.begin() + index);
}




int main() {
	int n; cin >> n;
	int a[3];
	for (int i = 0; i < 3; i++) {
		a[i] = n % 10;
		n = n / 10;
	}

	if (a[2] == a[1] && a[0] <= a[1]) cout << a[2] * 100 + a[2] * 10 + a[2] << endl;
	if (a[2] == a[1] && a[0] > a[1]) cout << (a[2]+1) * 100 + (a[2] + 1) * 10 + (a[2] + 1) << endl;

	if (a[2] > a[1]) cout << a[2] * 100 + a[2] * 10 + a[2] << endl;
	if (a[2]< a[1]) cout << (a[2] + 1) * 100 + (a[2] + 1) * 10 + (a[2] + 1) << endl;

	return 0;
}

Measured memory_bytes: 256
// う　し　た　ぷ　に　き　あ　く　ん　笑
#include <algorithm>
#include <array>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
#define int long long

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

    int n;
    cin >> n;
    n %= 1000;
    if (n == 0) {
        cout << 0 << endl;
    } else
        cout << 1000 - n << endl;
}


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

long long N, dp[3009][3009], mod = 1000000007; string S;

int main() {
	cin >> N >> S;
	for (int i = 0; i < N; i++) dp[0][i] = i + 1;
	for (int i = 1; i < N; i++) {
		for (int j = 0; j < N - i; j++) {
			if (S[i - 1] == '<') {
				long long L = dp[i - 1][j];
				dp[i][j] = L;
			}
			if (S[i - 1] == '>') {
				long long R = dp[i - 1][N - i], L = dp[i - 1][j];
				dp[i][j] = (R - L + mod) % mod;
			}
		}
		for (int j = 1; j <= N; j++) { dp[i][j] += dp[i][j - 1]; dp[i][j] %= mod; }
	}
	cout << dp[N - 1][0] << endl;
	return 0;
}

Measured memory_bytes: 70784
package main

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

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

// Arithmetic
func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

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

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

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

func ceil(a, b int) int {
	if a%b == 0 {
		return a / b
	} else {
		return a/b + 1
	}
}

// Sort
type RuneSlice []rune

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

type Node struct {
	parent, left, right int
}

const NIL = -1

var T [100002]Node
var D [100002]int

func setDepth(u, p int) {
	D[u] = p
	if T[u].right != NIL {
		setDepth(T[u].right, p)
	}
	if T[u].left != NIL {
		setDepth(T[u].left, p+1)
	}
}

func printNode(w io.Writer, u int) {
	fmt.Fprint(w, "node ", u, ": ")
	fmt.Fprint(w, "parent = ", T[u].parent, ", ")
	fmt.Fprint(w, "depth = ", D[u], ", ")
	if T[u].parent == NIL {
		fmt.Fprint(w, "root, ")
	} else if T[u].left != NIL {
		fmt.Fprint(w, "internal node, ")
	} else {
		fmt.Fprint(w, "leaf, ")
	}
	c := T[u].left
	fmt.Fprint(w, "[")
	first := true
	for c != NIL {
		if !first {
			fmt.Fprint(w, ", ")
		} else {
			first = false
		}
		fmt.Fprint(w, c)
		c = T[c].right
	}
	fmt.Fprint(w, "]")
	fmt.Fprintln(w)
}

// Main
func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	N := sc.nextInt()
	for i := 0; i < N; i++ {
		T[i] = Node{NIL, NIL, NIL}
	}
	for i := 0; i < N; i++ {
		id, k := sc.nextInt(), sc.nextInt()
		var l int
		for j := 0; j < k; j++ {
			c := sc.nextInt()
			if j == 0 {
				T[id].left = c
			} else {
				T[l].right = c
			}
			l = c
			T[c].parent = id
		}
	}
	var root int
	for i := 0; i < N; i++ {
		if T[i].parent == NIL {
			root = i
		}
	}
	setDepth(root, 0)

	for i := 0; i < N; i++ {
		printNode(wtr, i)
	}
	wtr.Flush()
}



Measured memory_bytes: 13912
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
using ll=long long;
using ld=long double;
//#define int long long
#define _CRT_SECURE_NO_WARNINGS
#define rep(i, n) for (int i = 0; i < n; i++)
#define _GLIBCXX_DEBUG
#define ALL(x) (x).begin(), (x).end()
const int MOD = 1e9 + 7;
const int INF = 1e18 + 9;
constexpr long double pi = 3.141592653589793238462643383279;
int fact(int i) {
    if (i == 0) return 1;
    return (fact(i - 1)) * i;
}
int gcd(int a, int b) {
    if (b == 0) return a;
    return gcd(b, a % b);
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
int keta(int n) {
    if (n == 0) return 1;
    int count = 0;
    while (n != 0) {
        n /= 10;
        count++;
    }
    return count;
}
int ketasum(int n) {
    int sum = 0;
    while (n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
char toSmall(char c) { // 大文字を小文字へ
    return (c + 0x20);
}
char toLarge(char c) { // 小文字を大文字へ
    return (c - 0x20);
}
float myPower(int a, int n) { // aのn乗の計算
    float x = 1;
    while (n > 0) { // 全てのbitが捨てられるまで
        if (n & 1) { // 一番右のbitが１のとき
            x *= a;
        }
        a *= a;
        n >>= 1; // bit全体を右に1つシフトして一番右を捨てる
    }
    return x;
}
bool is_prime(const unsigned n) {
    switch (n) {
    case 0: // fall-through
    case 1: return false;
    case 2: // fall-through
    case 3: return true;
    } // n > 3 が保証された

    if (n % 2 == 0 || n % 3 == 0) return false;
    // n は 2 と 3 のいずれの倍数でもないことが保証された
    // これより n は (6の倍数)-1 か (6の倍数)+1 である
    // 6の倍数前後の数を使って試し割りをする
    for (unsigned i = 5; i * i <= n; i += 6) {
        if (n % i == 0) return false; // (6の倍数)-1
        if (n % (i + 2) == 0) return false; // (6の倍数)+1
    }

    return true;
}

int main(void){
    string s; cin >> s;
    vector<int> vec(30);
    rep(i, s.size()) {
        ++vec[s[i] - 'a'];
    }
    rep(i, 26) {
        if (vec[i] == 0) {
            cout << (char)(i + 'a') << endl;
            return 0;
        }
    }
    cout << "None" << endl;
    return 0;
}

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

typedef long long ll;
typedef pair<int, int> pii;
#define FOR(i, n) for(int (i)=0; (i)<(n); (i)++)
#define FOR1(i, n) for(int (i)=1; (i)<=(n); (i)++)
#define FORI(i, n) for(int (i)=n-1; (i)>=0; (i)--)

const ll MOD =  998244353;
template<class T> T powmod(T x, ll n, ll m)
{
    T r = 1;
    T a = x % m;
    while (n>0)
    {
        if (n & 1)
            r = (r*a)%m;
        a = (a*a)%m;
        n = n >> 1;
    }
    return r;
}

const int M = 3002;
ll dp[M][M];

int main(int argc, char** argv) {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout << setprecision(15);
    if (argc == 2 && atoi(argv[1]) == 123456789) freopen("d:\\code\\cpp\\contests\\stdin", "r", stdin);

    int n, s;
#if 1
    cin >> n >> s;
    vector<int> A(n);
    FOR(i, n) cin >> A[i];
#else
    n = 3000; s = n;
    vector<int> A(n);
    FOR(i, n) A[i] = i+1;//rand() % 3000;
#endif
    sort(A.begin(), A.end());

    //dp[s][k] - sum of contributions for each subset which sums to s
    vector<ll> v(s + 1);
    v[0] = powmod(2ll, n, MOD);
    const ll i2 = (MOD+1)/2;
    FOR(i, n){
        vector<ll> v2 = v;
        for(int x = s - A[i]; x >= 0; x--){
            v2[x + A[i]] += v[x] * i2 % MOD;
            v2[x+A[i]] -= MOD * (v2[x+A[i]] >= MOD);
        }
        v = v2;
    }
    cout << v[s] << endl;

    if (argc == 2 && atoi(argv[1]) == 123456789) cout << clock()*1.0/CLOCKS_PER_SEC << " sec\n";
    return 0;
}

Measured memory_bytes: 3680
#include <bits/stdc++.h>
#define pb push_back
#define int long long int
#define mod 1000000007
#define inf (1LL<<60)
#define f(i,a,b) for (int i= a; i <b; ++i)
using namespace std;
int dp1[100005];
int dp2[100005];
int vis[100005];
vector<int> v[100005];
int m;
void solve2(int src,int ans)
{

    vis[src]=1;
    dp2[src]=((ans+1)*dp1[src])%m;
    vector<int> p,s;
    for(int i=0;i<v[src].size();i++)
    {
        if(!vis[v[src][i]])
        {
            p.pb(dp1[v[src][i]]+1);
            s.pb(dp1[v[src][i]]+1);
        }
    }
    for(int i=1;i<p.size();i++)
        {
            p[i]=(p[i]*p[i-1])%m;
        }
    for(int i=s.size()-2;i>=0;i--)
        {
            s[i]=(s[i]*s[i+1])%m;
        }
    int cn=0;
    for(int i=0;i<v[src].size();i++)
    {
        if(!vis[v[src][i]])
        {
            int h=ans+1;
            if(cn>0)
                h=(h*(p[cn-1]))%m;
            if(cn<s.size()-1)
                h=(h*(s[cn+1]))%m;
            solve2(v[src][i],h);
            cn++;
        }
    }
}
void solve1(int src)
{
    vis[src]=1;
    dp1[src]=1;
    for(int i=0;i<v[src].size();i++)
    {
        if(!vis[v[src][i]])
        {
            solve1(v[src][i]);
            dp1[src]=(dp1[src]*(dp1[v[src][i]]+1))%m;
        }
    }
}
signed main()
{
	ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n,x,y;
    cin>>n>>m;
    for(int i=0;i<n-1;i++)
    {
        cin>>x>>y;
        v[x].push_back(y);
        v[y].push_back(x);
    }
    solve1(1);
    //for(int i=1;i<=n;i++)
      //cout<<dp1[i]<<" ";
    //cout<<endl;
    memset(vis,0,sizeof vis);
    solve2(1,0);
     for(int i=1;i<=n;i++)
       cout<<dp2[i]<<" ";
    cout<<endl;
}



Measured memory_bytes: 23936
/**
 * Title: D - Knapsack 1
 * Url: https://atcoder.jp/contests/dp/tasks/dp_d
 */
#include<bits/stdc++.h>

using namespace std;

#define ll long long

int N, W;
const int MAX_N = 100;
const int MAX_W = 100000;

int w[MAX_N+1], v[MAX_N+1];
ll dp[MAX_N+2][MAX_W+2];

ll rec(int i, int j) {
    if (dp[i][j] != -1) return dp[i][j];
    if (i==N+1) return dp[i][j] = 0;
    if (j < w[i]) return dp[i][j] = rec(i+1, j);
    return dp[i][j] = max(rec(i+1, j), rec(i+1, j-w[i])+v[i]);
}

int main() {
    cin >> N >> W;
    for(int i=0; i<N; i++) cin >> w[i+1] >> v[i+1];
    memset(dp, -1, sizeof(dp));
    cout << rec(1, W) << endl;
    return 0;
}

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

int main()
{
	int a, b, c, d; cin >> a >> b >> c >> d;

	int ans;

	if (b <= c || d <= a) ans = 0;
	else ans = min(b, d) - max(a, c);
	
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include<iostream> 
#include<iomanip> 
#include<vector> 
#include<map> 
#include<set> 
#include<algorithm> 
#include<numeric> 
#include<limits> 
#include<bitset> 
#include<functional> 
#include<type_traits> 
#include<queue> 
#include<stack> 
#include<array> 
#include<random> 
#include<utility> 
#include<cstdlib> 
#include<ctime>
//#define _LIBCPP_DEBUG 0
//#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define all(a) (a).begin(),(a),end()
#define rep(i,n) for (ll i = 0; i < (ll)(n); ++i)	

int max(ll a, ll b) {
	ll max;
	if (a > b) max = a;
	else max = b;
	return max;
}
int min(ll a, ll b) {
	ll min;
	if (a < b) min = a;
	else min = b;
	return min;
}


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

	rep(i, s.size()) {
		int x = s[i] - 'A';
		x = (x + n) % 26;
		s[i] = 'A' + x;
	}
	cout << s << endl;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <queue>
#include <vector>
#include <algorithm>
#include <math.h>
#include <map>
#include <list>
#include <iomanip>
#include <queue>
#include <cmath>
#include <numeric>
#define repl(i, l, r) for (ll i = l; i < r; i++)
#define rep(i, n) repl(i, 0, n)

using namespace std;
using ll = long long;
typedef pair<ll, ll> p;
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
const long long mod = 1e9 + 7;
ll gcd(ll a, ll b);
ll lcm(ll a, ll b);

int main() {
    string S, T;

    cin >> S >> T;

	int N = S.size();
	map<char, char> mp1, mp2;
	rep(i, N) {
		if (mp1.count(S[i])) {
			if (mp1[S[i]] != T[i]) {
				cout << "No" << endl;
				return 0;
			}
		}
		mp1[S[i]] = T[i];
		if (mp2.count(T[i])) {
			if (mp2[T[i]] != S[i]) {
				cout << "No" << endl;
				return 0;
			}
		}
		mp2[T[i]] = S[i];
	}

	cout << "Yes" << endl;

    return 0;
}


ll gcd(ll a, ll b) {
    if (a % b == 0)return(b);
    else return(gcd(b, a % b));
}
ll lcm(ll a, ll b) {
    return a * b / gcd(a, b);
}

Measured memory_bytes: 3916
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    string s;
    
    cin >>s;
    int ct=0;
    for(int i=0; i<s.size();i++){
        if(s[i]=='R'){
            ct++;
            if(s[i-1]!='R' && s[i+1]!='R') ct=1;
        }
    }
    
    cout<<ct<<endl;
}


Measured memory_bytes: 3592
#include<iostream>
using namespace std;
int main()
{ 
    int a,b;
    cin>>a;
    b=a%10;
    if(b==2||b==4||b==5||b==7||b==9)
	cout<<"hon";
    if(b==0||b==1||b==6||b==8)
	cout<<"pon";
    if(b==3)
	cout<<"bon";
}  

Measured memory_bytes: 3620
#include<bits/stdc++.h>
#define forinc(i,a,b) for(int i=a;i<=b;++i)
#define forout(i,a,b) for(int i=a;i>=b;--i)
#define forv(a,b) for(auto &a:b)
#define pii pair<int,int>
#define fi first
#define se second
#define sz(s) (int)(s.size())
#define pb push_back
#define int long long
char inchar() {char c=getchar();while(c==' '||c=='\n') c=getchar();return c;}
#define inchar inchar()
#define in ({int x=0;int c=getchar(),n=0;for(;!isdigit(c);c=getchar()) n=(c=='-');for(;isdigit(c);c=getchar()) x=x*10+c-'0';n?-x:x;})
#define bit(x,i) ((x>>i)&1)
#define batbit(x,i) (x|(1ll<<i))
#define tatbit(x,i) (x&~(1ll<<i))
using namespace std;
int a[300],b[300];
main()
{
	///freopen(task".inp","r",stdin);
	///freopen(task".out","w",stdout);
	int x,y;
	a[1]=300000,a[2]=200000,a[3]=100000;
    cin>>x>>y;
    int res=a[x]+a[y];
    if(x==y&&x==1) res+=400000;
    cout<<res;

}


Measured memory_bytes: 256
/**
 *   author: Shubham Srivastava
 *   created: 26 January 2020  00:55:11
**/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
string s;
int main(){
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
    string s1,s2;
    cin>>s1>>s2;
    ll n,m;
    n = s1.size();
    m = s2.size();
    long long dp[n+1][m+1];
    for(int i=0;i<=n;i++)
    {
    	for(int j=0;j<=m;j++)
    	{
    		if(i==0 || j==0)
    			dp[i][j] = 0;
    		else if(s1[i-1] == s2[j-1])
    		{
    			dp[i][j] = 1 + dp[i-1][j-1];
    		}
    		else
    		{
    			dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
    		}
    	}
    }
    if(dp[n][m] == 0)
    {
    	cout<<"";
    	return 0;
    }
    while(m && n)
    {
    	if(s1[n-1] == s2[m-1])
    	{
    		s += s1[n-1];
    		m--;
    		n--;
    	}
    	else if(dp[n][m-1] > dp[n-1][m])
    	{
    		m--;	
    	}
    	else
    		n--;
    }
    for(int i=s.length()-1;i>=0;i--)
    	cout<<s[i];
return 0;
}

Measured memory_bytes: 70656
#include <stdio.h>

int main()
{   long long a[200001],n,i,sum=0,snuke=0,min=1145141919810;
    scanf("%lld",&n);
    for(i=0;i<n;i++){
        scanf("%lld",&a[i]);
        sum+=a[i];
    }
    for(i=0;i<n-1;i++){
        snuke+=a[i];
        sum-=a[i];
        if(llabs(snuke-sum)<min){
            min=llabs(snuke-sum);
        }
    }
    printf("%lld",min);
    return 0;
}


Measured memory_bytes: 1664
a = []
3.times do |i|
  a[i] = gets.split.map(&:to_i)
end

bingo = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]

n = gets.to_i
n.times do
  b = gets.to_i
  3.times {|i| 3.times {|j| bingo[i][j] = 1 if a[i][j] == b}}
end

if bingo[0][0] * bingo[0][1] * bingo[0][2] == 1 ||
   bingo[1][0] * bingo[1][1] * bingo[1][2] == 1 ||
   bingo[2][0] * bingo[2][1] * bingo[2][2] == 1 ||
   bingo[0][0] * bingo[1][0] * bingo[2][0] == 1 ||
   bingo[0][1] * bingo[1][1] * bingo[2][1] == 1 ||
   bingo[0][2] * bingo[1][2] * bingo[2][2] == 1 ||
   bingo[0][0] * bingo[1][1] * bingo[2][2] == 1 ||
   bingo[0][2] * bingo[1][1] * bingo[2][0] == 1
  puts 'Yes'
else
  puts 'No'
end

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

int main()
{
  int N,M,C;
  cin>>N>>M>>C;
  int B[M];
  for(int i=0;i<M;i++){
    cin>>B[i];
  }
  int A[N][M];
  for(int i=0;i<N;i++){
    for(int j=0;j<M;j++){
      cin>>A[i][j];
    }
  }
  
  
  int cnt=0;
  
  for(int i=0;i<N;i++){
    int sum=0;
    for(int j=0;j<M;j++){
      sum+=A[i][j]*B[j];
    }
    cnt+=(sum+C>0)? 1:0;
  }
  cout<<cnt;
}

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

//#define int long long
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i < b; i++)
#define out(x) cout << x << endl
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<bool> > vvb;
typedef vector<vector<double> > vvd;
typedef vector<vector<string> > vvs;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
//ll MOD = 1000000007;
ll MOD = 998244353;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

signed main()
{   
  gearup;
  ll n; cin >> n;
  //先頭と末尾に注目する
  //B〇〇は,〇〇Aの後ろについた方がいい
  //B〇〇Aは上の足りない方につける
  deque<string> a,b,c,d;
  ll ans = 0;
  rep(i,n){
      string t; cin >> t;
      int m = t.size();
      if(t[0] == 'B' && t[m-1] == 'A')d.emplace_back(t);
      else if(t[0] == 'B')b.emplace_back(t);
      else if(t[m-1] == 'A')a.emplace_back(t);
      else c.emplace_back(t);
      rep(j,m-1)if(t[j] == 'A' && t[j+1] == 'B')ans++;
  } 
  ll as = a.size();
  ll bs = b.size();
  ll ds = d.size();
  if(as+bs == 0)ans+=max(0LL,ds-1);
  else ans+= ds+min(as,bs);
  out(ans);
}


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

int main() {
    ll n,k;
    std::cin >> n>>k;
    vector<ll> a(n);
    for (int i = 0; i < n; i++) {
        std::cin >> a[i];
    }

    for (int i = 0; i < k; i++) {
        vector<ll> imos(n+1,0);
        vector<ll> imos2(n+1,0);
        for (int j = 0; j < n; j++) {
            imos[max(0ll,j-a[j])]++;
            imos[min(n,j+a[j]+1)]--;
        }
        ll minv = 1e15;
        for (int j = 0; j < n; j++) {
            imos2[j+1] = imos2[j]+imos[j];
            a[j] = imos2[j+1];
            minv = min(minv,a[j]);
        }
        if(minv==n)break;
    }
    
    for (int i = 0; i < n; i++) {
        std::cout << a[i]<<" ";
    }
    std::cout  << std::endl;
}

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

#include <iostream>
#include <string>
#include <vector>
using namespace std;

int P[10]={0};
int Q[10]={0};

int kaijyo(int i){
	if(i==0 || i==1) return 1;
	return i*kaijyo(i-1);
}

int count_order(int* A, int N){
	int ret = 0;
	vector<int> v ;
	for(int i=1; i<=N; i++){ v.push_back(A[i]); }
	for(int i=1; i<=N; i++){
		int u = 0;
		for(int j=0; j<v.size(); j++){
			if(v[j]<A[i]){ u++; }
		}
		ret += u*kaijyo(N-i);
		v.erase(v.begin());
	}
	return ret;
}

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

	cin >> N;

	for(int i=1; i<=N; i++){ cin >> P[i]; }
	for(int i=1; i<=N; i++){ cin >> Q[i]; }

	int a = count_order(P, N);
	int b = count_order(Q, N);

	int ans = a - b;
	if(ans<0){ ans = 0 - ans; }
	printf("%d\n", ans);
	return 0;

}

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


void solve(long long a, long long b){
    long long pos = b - a -2;
    long long cnt = 0;
    for(long long i = 1; i <= pos+1; ++i) cnt = cnt + i;
    cout << cnt - a << endl;
}

int main(){
    long long a;
    scanf("%lld",&a);
    long long b;
    scanf("%lld",&b);
    solve(a, b);
    return 0;
}


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

int main() {

  int N = 0;
  cin >> N;
  vector<int> T(N);
  vector<int> U(N);
  for(int i = 0; i < N; i++){
    int cnt = 0;
    cin >> T.at(i);
  	while(T.at(i)%2 == 0 && T.at(i) > 0){
      T.at(i) = T.at(i)/2;
      cnt++;
    }
    U.at(i) = cnt;
  }
  int Min = U.at(0);
  for(int i = 0; i < N - 1 ; i++){
    if( Min >= U.at(i) ){
      Min = U.at(i);
    }
  }
  cout << Min << endl;
}



Measured memory_bytes: 256
#include <fstream>
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <sstream>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <queue>
#include <random>

using namespace std;

#define min(a,b) ((a)<(b) ? (a):(b))
#define max(a,b) ((a)>(b) ? (a):(b))

long long gcd(long long a, long long b){
    if(a<b){
        swap(a,b);
    }
    while(b){
        long long r = a%b;
        a=b;
        b=r;
    }
    return a;
}

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

int isPrim(int a){
    if(a==1){
        return 0;
    }
    for(int i=2;i<=(a+1)/2;i++){
        if(a%i==0){
            return 0;
        }
    }
    return 1;
}

long long mod_pow(long long x, long long n, long long mod){
    //xのn乗を計算するのにn乗を2進表記にして計算
    //x^22 = x^16 + x^4 + x^2
    long long ret=1;
    while(n>0){
        if(n%2==1){
            ret=(ret*x)%mod;//答えに付加
        }
        x=(x*x)%mod;//2乗
        n=n/2;
    }
    return ret;
}


struct XX{
    int d=0;
    int a=0;
    int k=0;
    int t=0;
};

class xxIntu {
public:
    bool operator()(const XX& riLeft, const XX& riRight) const {
        //第2条件
        if((riLeft.a+riLeft.k) == (riRight.a+riRight.k)){
            return riLeft.a < riRight.a;//<:昇順(小さいものから順番)、>:降順(大きいものから順番)
        }
        //第1条件
        return (riLeft.a+riLeft.k) < (riRight.a+riRight.k);
    }
};
/*bool operator< (const XX &riLeft, const XX &riRight){
    return riLeft.d < riRight.d;
};*/

string aaaa="abcdefghijklmnopqrstuvwxyz";

int main(int argc, const char * argv[])
{
    //std::ios::sync_with_stdio(false);
    //scanf("%s",S);
    //scanf("%d",&N);
    //getline(cin, target);
    //cin >> x >> y;
    //テスト用
    //ifstream ifs( "1_06.txt" );
    //ifs >> a;
    //ここから

    string s;
    cin >> s;
    int N;
    cin >> N;
    
    string ans="";
    
    for(int i=0;i<s.size();i++){

        if(s[i]=='a'){
            ans=ans+"a";
        }else if((abs(s[i]-122)+1)<=N){            
            N=N-(abs(s[i]-122)+1);
            ans=ans+"a";
        }else{
            ans=ans+s.substr(i,1);
        }
    }
    if(N>0){
        
        stringstream ss;
        ss.clear();
        ss.str()="";
        int tmp=ans[ans.size()-1];
        ss << (tmp+N%26);
        int s;
        ss >> s;
        if(s>122){
            s=s-123+97;
        }
        //cout << s << endl;
        
        ans=ans.substr(0,ans.size()-1);
        ans=ans+aaaa.substr(s-97,1);
    }
    
    
    cout << ans << endl;
    
    //ここまで
    //cout << "ans" << endl;改行含む
    //printf("%.0f\n",ans);//小数点以下表示なし
    //printf("%.7f\n",p);
    //printf("%f\n",pow(2,ans.size()));
    
    return 0;
}

Measured memory_bytes: 832
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0,i##_len=int(n);i<i##_len;++i)
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define All(x) (x).begin(),(x).end()
#define rAll(x) (x).rbegin(),(x).rend()
using namespace std;
using ll = long long;

int main(){
    string s,t,u;
    int a,b;
    cin>>s>>t;
    cin>>a>>b;
    cin>>u;
    if(s==u) a--;
    if(t==u) b--;
    cout<<a<<" "<<b<<endl;
}

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

#define F first
#define S second
#define pb push_back
#define ll long long
#define int long long

using namespace std ;

const int MAXN = 1001 * 1001 ; 

int a[MAXN] ; 

int32_t main()
{
	ios::sync_with_stdio(0) ; cin.tie(0) ; 
	int n , c , k ;
	cin >> n >> c >> k ; 
	for(int i = 0 ; i < n ; i ++ ) 
		cin >> a[i] ; 
	sort(a,a+n) ; 
	int ans = 1 , prv = a[0] + k , t = 1;
    for(int i = 1 ; i < n ; i ++ )
	{
		if(t==c|a[i]>prv)
		{
			ans ++ ; 
			prv = a[i] + k ;
			t = 1; 
		}
		else
			t ++ ; 
	}
	cout << ans << '\n' ;
}

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

using namespace std;

const int N = int(2e5) + 5;
const int MOD = int(1e9) + 7;
const int inf = int(2e9);



int main() {
    ios_base :: sync_with_stdio(0);
    cin.tie(0),cout.tie(0);

    int N,K;
    cin >> N >> K;
    int cnt = 0;
    while (N) {
        cnt++;
        N /= K;
    }
    cout << cnt;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <numeric>
#include <map>
#include <iomanip>
#include <limits.h>

using namespace std;    
typedef long long ll;
typedef pair<ll, ll> pll;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
const bool DEBUG = true;

int main(){

    int a1, a2, a3;
    cin >> a1 >> a2 >> a3;
    if(a1 + a2 + a3 >= 22){
        cout << "bust" << endl;
    }
    else{
        cout << "win" << endl;
    }

}

Measured memory_bytes: 256
n, m = map(int, input().split())
ks = [list(map(int, input().split())) for _ in range(m)] # ひとまず行ごと全部受け取っちゃう
p = list(map(int, input().split()))
ans=0

for i in range(2**n):
    on = [0 for _ in range(n)]
    
    for j in range(n):
        if ((i>>j)&1):
            on[j] = 1
    all_on = True
    for j in range(m):
        on_num = 0
        for s in ks[j][1:]:
            if on[s-1]==1:
                on_num = on_num + 1
                
        if on_num%2 != p[j]:
            all_on = False
            break
    if all_on:
        ans = ans+1
print(ans)

Measured memory_bytes: 3064
#include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define ALL(v) (v).begin(), (v).end()
#define SP cout << fixed << setprecision(10)
const int INF = (int)1e9;
const int MOD = (int)1e9 + 7;
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }

int main(void) {
        // code
        int n;
        cin >> n;

        if (n == 0) {
                cout << 0 << endl;
                return 0;
        } else {
                string ans = "";
                while (n != 0) {
                        if (n % 2 != 0) {
                                n -= 1;
                                ans = "1" + ans;
                        } else {
                                ans = "0" + ans;
                        }
                        n = n / -2;
                }
                cout << ans << endl;
                return 0;
        }

        return 0;
}

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

int N;
int p[15];

int main() {
    cin >> N;

    for (int i=0; i<N; ++i) cin >> p[i];

    sort(p, p+N);

    int ans = 0;
    for (int i=0; i<N-1; ++i) ans += p[i];
    ans += p[N-1]/2;

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
  ll a, b;
  cin >> a >> b;
  if ((a + b) % 2 == 0) {
    cout << (a + b) / 2 << endl;
  } else {
    cout << "IMPOSSIBLE" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define sz(x) int(x.size())

using namespace std;

int main(int argc, const char * argv[]) {
    // input from txt
    
    /////////
    //write//
    /////////
    
    int n;
    cin >> n;
    int b[101];
    for(int i=0; i<n-1; i++){
        cin >> b[i];
    }
    int res = 0;
    res += b[0];
    for(int i=0; i<n-2; i++){
        res += min(b[i], b[i+1]);
    }
    res += b[n-2];
    
    cout << res << endl;
    
    return 0;
}


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

struct Amida {
	int p1, p2, p3;
};
bool operator== (const Amida &a1, const Amida &a2) {
	if (a1.p1 == a2.p1 && a1.p2 == a2.p2 && a1.p3 == a2.p3) return true;
	return false;
}
bool operator<(const Amida &a1, const Amida &a2) {
	if (a1.p1 < a2.p1) return true; if (a1.p1 > a2.p1) return false;
	if (a1.p2 < a2.p2) return true; if (a1.p2 > a2.p2) return false;
	if (a1.p3 < a2.p3) return true; if (a1.p3 > a2.p3) return false;
	return false;
}

int n, w[109], c[109]; vector<int>a[109]; Amida S[109];
vector<Amida>I;

Amida solve(vector<int>v) {
	Amida F = Amida{ 1,2,3 };
	for (int i = 0; i < v.size(); i++) {
		if (v[i] == 0) swap(F.p1, F.p2);
		if (v[i] == 1) swap(F.p2, F.p3);
	}
	return F;
}
Amida gousei(Amida P1, Amida P2) {
	int r[3] = { 0,0,0 }, q[3] = { P1.p1,P1.p2,P1.p3 };
	r[0] = q[P2.p1 - 1];
	r[1] = q[P2.p2 - 1];
	r[2] = q[P2.p3 - 1];
	return Amida{ r[0],r[1],r[2] };
}
Amida toAmida(int p) {
	if (p == 0) return Amida{ 1,2,3 };
	if (p == 1) return Amida{ 1,3,2 };
	if (p == 2) return Amida{ 2,1,3 };
	if (p == 3) return Amida{ 2,3,1 };
	if (p == 4) return Amida{ 3,1,2 };
	if (p == 5) return Amida{ 3,2,1 };
}
int toNumber(Amida P) {
	if (P == Amida{ 1, 2, 3 }) return 0;
	if (P == Amida{ 1, 3, 2 }) return 1;
	if (P == Amida{ 2, 1, 3 }) return 2;
	if (P == Amida{ 2, 3, 1 }) return 3;
	if (P == Amida{ 3, 1, 2 }) return 4;
	if (P == Amida{ 3, 2, 1 }) return 5;
}

bool solve(vector<Amida>Z) {
	Amida ZZ = Amida{ 1,2,3 };

	for (int i = 0; i < Z.size(); i++) {
		ZZ = gousei(ZZ, Z[i]);
		if (ZZ == Amida{ 1,2,3 }) return true;
	}
	return false;
}

int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> w[i];
		for (int j = 0; j < w[i]; j++) {
			int p; cin >> p;
			a[i].push_back(p);
		}
		S[i] = solve(a[i]);
		c[toNumber(S[i])]++;
	}
	for (int i = 0; i < 6; i++) {
		for (int j = 0; j < min(2, c[i]); j++) I.push_back(toAmida(i));
	}

	if (n != I.size()) {
		cout << "yes" << endl;
	}
	else {
		bool flag = false;
		do {
			if (solve(I) == true) {
				flag = true;
				break;
			}
		} while (next_permutation(I.begin(), I.end()));

		if (flag == true) cout << "yes" << endl;
		else cout << "no" << endl;
	}
	return 0;
}


Measured memory_bytes: 3156
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

static const double EPS = 1e-8;
static const double PI = 4.0 * atan(1.0);
static const double PI2 = 8.0 * atan(1.0);

#define REP(i,n)	for(int i=0;i<(int)n;++i)
#define ALL(c)		(c).begin(),(c).end()
#define CLEAR(v)	memset(v,0,sizeof(v))
#define MP(a,b)		make_pair((a),(b))
#define ABS(a)		((a)>0?(a):-(a))
#define FOR(i,s,n)	for(int i=s;i<(int)n;++i)

int main(int argc, char **argv) {
	int a, b, c;
	cin >> a >> b >> c;
	REP(i, 100) if (a * (i + 1) % b == c) {
		cout << "YES" << endl;
		return 0;
	}
	cout << "NO" << endl;
	return 0;
}


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

#define ll long long
#define pb push_back
#define mp make_pair

void solve(){

    ll key = 0;

    while(1){
        ll a;

        cin >> a;
        key++;
        if(a == 0){
            cout << key;
            break;
        }
    }

    
}


int main()
{

    ios::sync_with_stdio(0);
    cin.tie(0);

    ll T;
    T = 1;
    //cin >> T;
    while(T--){
        solve();
    }

   
    

}


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

typedef long long ll;

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

int N;
int H[101];

int main() {
  scanf("%d", &N);
  REP(i, N) scanf("%d", &H[i]);
  int max = -1;
  int ans = 0;

  REP(i, N) {
    if (max <= H[i]) {
      ans++;
      max = H[i];
    }
  }
  printf("%d\n", ans);
  
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	char input[4];
	int cup[3] = {1};
	int p1, p2, c, i;
	
	while (scanf("%s", input) != EOF){
		p1 = input[0] - 'A';
		p2 = input[2] - 'A';
		
		c = cup[p1];
		cup[p1] = cup[p2];
		cup[p2] = c;
	}
	
	i = 0;
	while (1){
		if (cup[i] == 1){
			printf("%c\n", 'A' + i);
			break;
		}
		i++;
	}
	
	return (0);
}

Measured memory_bytes: 540
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.stream.IntStream;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.OptionalInt;
import java.io.InputStream;

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

    static class E {
        int N;
        int A;
        int B;
        int C;
        int[] l;

        public void solve(int testNumber, MyScanner in, PrintWriter out) {
            N = in.Int();
            A = in.Int();
            B = in.Int();
            C = in.Int();
            l = in.Int(N);

            int ans = calc(0, 0, 0, 0);
            out.println(ans);
        }

        private int calc(int i, int a, int b, int c) {
            if (i == N) {
                if (a > 0 && b > 0 && c > 0)
                    return Math.abs(a - A) + Math.abs(b - B) + Math.abs(c - C) - 30;
                return 1 << 30;
            }

            int n = l[i];
            int a1 = calc(i + 1, a, b, c);
            int a2 = calc(i + 1, a + n, b, c) + 10;
            int a3 = calc(i + 1, a, b + n, c) + 10;
            int a4 = calc(i + 1, a, b, c + n) + 10;
            return IntStream.of(a1, a2, a3, a4).min().getAsInt();
        }

    }

    static class MyScanner {
        private BufferedReader in;
        private StringTokenizer st;

        public MyScanner(InputStream stream) {
            in = new BufferedReader(new InputStreamReader(stream));
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String rl = in.readLine();
                    if (rl == null) {
                        return null;
                    }
                    st = new StringTokenizer(rl);
                } catch (IOException e) {
                    return null;
                }
            }
            return st.nextToken();
        }

        public int Int() {
            return Integer.parseInt(next());
        }

        public int[] Int(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = Int();
            }
            return a;
        }

    }
}



Measured memory_bytes: 31444
#include<stdio.h>
int main(void)
{
	int H,W,x,y,i;
	char op;
	op='#';
	scanf("%d %d",&H,&W);
	while(!(H==0 && W==0)){
		
			for(x=0;H>x;x++){
				
				for(y=0;W>y;y++){
				printf("%c",op);
				}
				printf("\n");
			}
			printf("\n");
			scanf("%d %d",&H,&W);
	}
	return 0;
}

Measured memory_bytes: 1000
// use proconio::marker::Chars;
use proconio::{fastout, input};
use std::cmp::{max, min};

#[fastout]
fn main() {
    input! {
        n: usize,
        t: i32,
        a: i32
    };

    let mut tt = std::f64::MAX;
    let mut result = 0;

    for i in 0..n {
        input! {
            h:i32
        }

        let x = t as f64 - h as f64 * 0.006;

        if tt > (x - a as f64).abs() {
            tt = (x - a as f64).abs();
            result = i + 1;
        }
    }

    println!("{}", result);
}


Measured memory_bytes: 2088
# coding:utf-8                                                                  

N = int(raw_input())

xtmp = 0
ytmp = 0
ttmp = 0
flag = True
allinfo = []
for i in range(N):
    t, x, y = map(int, raw_input().split())
    allinfo.append((t, x, y))

for t, x, y in allinfo:
    xdif = abs(x - xtmp)
    ydif = abs(y - ytmp)
    tdif = t - ttmp
    if tdif >= xdif + ydif:
        if tdif % 2 == (xdif + ydif) % 2:
            continue
        else:
            flag = False
            break
    else:
        flag = False
        break

if flag:
    print 'Yes'
else:
    print 'No'

Measured memory_bytes: 19344
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i,j,n) for(int i=j;i<n;++i)
#define all(i) i.begin(),i.end()
#define rall(i) i.rbegin(), i.rend()
#define INF 1e9
#define LINF 1e18
const int mod = 1e9 + 7;
 
typedef long long i64;
typedef pair<int, int> pi;
 
template <class T> using vt = vector<T>;
template <class T> using vvt = vector<vector<T>>;
 
i64 gcd(i64 n, i64 m) {return (m == 0? n : gcd(m, n % m));}
i64 lcm(i64 n, i64 m) {return (n / gcd(n, m) * m);}
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};

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

  int h, w;
  cin >> h >> w;
  vvt<int> a(h + 1, vt<int>(w + 1)), b(h + 1, vt<int>(w + 1));
  rep(i, 0, h) rep(j, 0, w) cin >> a[i + 1][j + 1];
  rep(i, 0, h) rep(j, 0, w) cin >> b[i + 1][j + 1];

  vvt<vt<bool>> dp(h + 1, vvt<bool>(w + 1, vt<bool>(14000, false)));
  dp[1][1][abs(a[1][1] - b[1][1])] = true;
  rep(i, 1, h + 1) {
    rep(j, 1, w + 1) {
      rep(k, 0, 13000) {
        if(!dp[i][j][k]) continue;
        if(i + 1 <= h) {
          dp[i + 1][j][k + abs(a[i + 1][j] - b[i + 1][j])] = true;
          dp[i + 1][j][abs(k - abs(a[i + 1][j] - b[i + 1][j]))] = true;
        }
        if(j + 1 <= w) {
          dp[i][j + 1][k + abs(a[i][j + 1] - b[i][j + 1])] = true;
          dp[i][j + 1][abs(k - abs(a[i][j + 1] - b[i][j + 1]))] = true;
        }
      }
    }
  }

  int ans;
  rep(i, 0, 13000) {
    if(dp[h][w][i]) {
      ans = i;
      break;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 12032
#include<cstdio>

using namespace std;

int main(){
    int n;
    scanf("%d", &n);
    for(int i = 0; i <= n / 7; i++){
        if((n - i * 7) % 4 == 0){
            puts("Yes");
            return 0;
        }
    }
    puts("No");
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
 using namespace std;
 int main()
{
    string s;
    cin>>s;
    int ok =1;
    map<char , int >m;
    map<char , int >::iterator itr;
       
    for(long i=0;i<s.length();i++)m[s[i]]++;
        
    for(itr=m.begin();itr!=m.end();itr++){  // cout<<itr->first<<" - "<<itr->second<<endl;
     if(itr->second%2==0)
         continue;
      else{
           cout<<"No";
           return 0;
          }
    }
    cout<<"Yes";
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
const int MAX = 700000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
/*第二引数で第一引数を割ったときの切り上げの計算*/
long long int maxtime(long long int x, long long int y) {
	return(x + y - 1) / y;

}
/*最大公約数*/
long long int lcm(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;

	if (number2 > number1) {
		m = number2;
		n = number1;
	}
	long long int s = -1;
	while (s != 0) {
		s = m % n;
		m = n;
		n = s;
	}
	return m;
}
/*最大公倍数*/
long long int gcd(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;
	return m / lcm(m, n) * n;
}

int main() {
	string s;
	string t;
	int n;
	cin >> n;
	cin >> s;
	cin >> t;
	string ans = "";
	for (int i = 0; i < s.size(); i++) {
		ans = ans + s[i] + t[i];
	}
	cout << ans;
}

Measured memory_bytes: 256
N = int(input())
M = []
for i in range(N):
  inp = list(input().split())
  M.append([inp[0], int(inp[1])])
res = [i[0]+1 for i in sorted(enumerate(M), key = lambda x : (x[1][0], -x[1][1]))]
# res = sorted(enumerate(M), key = lambda x : (x[1][0], -x[1][1]))
for item in res:
  print (item)

Measured memory_bytes: 3064
import sys
import collections

while True:
    n = int(raw_input())
    if n == 0:
        break
    
    state = []
    free = []
    for i in xrange(n):
        temp = map(int, raw_input().split())
        if temp[0] != 0:
            free.append(set(temp[1:]))
        else:
            free.append(set())
        state.append(set([i]))
    
    for i in xrange(1, 31):
        cand = []
        new = set()
        for j in xrange(n):
            if i in free[j]:
                cand.append(j)
                new |= state[j]
        for c in cand:
            state[c] = new
        if len(new) == n:
            print i
            break
    else:
        print -1

Measured memory_bytes: 4744
# include <iostream>

using namespace std;

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

    if(a+b<=k){
        cout << 0 << " " << 0 << endl;
        return 0;
    }

    if(a>=k){
        cout << a-k << " " << b << endl;
    }else{
        cout << 0 << " " << a+b-k << endl;
    }
    return 0;
}

Measured memory_bytes: 3640