akhauriyash/Code-Regression huggingface dataset:
// 基本テンプレート

#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
using namespace std;

#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define int long long int

template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}

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

int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
constexpr ll INF = 1001001001001001LL;
constexpr ll MOD = 1000000007LL;

int a[100010];
signed main() {
    int N, L; cin >> N >> L;

    bool ok = false;
    int A = -1, B = -1, prev = -1;
    rep(i,0,N) {
        cin >> a[i];
        if(prev < 0) prev = a[i];
        else {
            if(prev + a[i] >= L) {
                ok = true;
                A = i-1, B = i;
            }
            prev = a[i];
        }
    }

    if(!ok) cout << "Impossible" << endl;
    else {
        cout << "Possible" << endl;
        int M = N - 2, lb = 0, ub = N-1;
        while(M--) {
            if(lb != A) cout << lb+1 << endl, lb++;
            else if(ub != B) cout << ub << endl, ub--;
        }
        cout << B << endl;
    }
    return 0;
}

Measured memory_bytes: 1536
#include<bits/stdc++.h>
using namespace std;
double ans=999999999;
double inf=999999999;
int n,m;
double dp[601];
vector<int>e[601];
void get_dp(int x)
{
	memset(dp,0,sizeof(dp));
	dp[n]=0;
	for(int i=n-1;i>=1;i--)
	{
		int tot=0;
		double mx=0;
		for(int j=0;j<e[i].size();j++)
			tot++,mx=max(mx,dp[e[i][j]]),dp[i]+=dp[e[i][j]];
		if(i==x)
		{
			if(tot==1)
				dp[i]=inf;
			else if(tot>=2)
				dp[i]-=mx,dp[i]/=tot-1,dp[i]++;
			else
				dp[i]=inf;
		}
		else if(tot)
			dp[i]/=tot,dp[i]++;
		else
			dp[i]=inf;
	}
	ans=min(ans,dp[1]);
}
signed main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=m;i++)
	{
		int u,v;
		scanf("%d%d",&u,&v);
		if(u>v) swap(u,v);
		e[u].push_back(v);
	}
	for(int i=1;i<=n;i++)
		get_dp(i);
	printf("%lf",ans);
	return 0;
}
/*
5 5
1 2
1 3
2 3
3 5
2 5
*/

Measured memory_bytes: 1408
#[allow(unused_imports)]
use std::cmp;

// Input macro from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
  (source = $s:expr, $($r:tt)*) => {
    let mut iter = $s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
  ($($r:tt)*) => {
    #[allow(unused_mut)]
    let mut s = {
      use std::io::Read;
      let mut s = String::new();
      std::io::stdin().read_to_string(&mut s).unwrap();
      s
    };
    let mut iter = s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
}

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

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

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

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

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

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

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

fn main() {
  input! {
    w: usize,
    h: usize,
    x: usize,
    y: usize,
  }
  let area = (w * h) as f64 / 2.0;
  let count = if x * 2 == w && y * 2 == h { 1 } else { 0 };

  println!("{:.15} {}", area, count);
}


Measured memory_bytes: 4352
import sys
input = sys.stdin.readline

def main():
  n, m = map(int, input().split())
  road = [[100000]*n for _ in range(n)]
  count = [[-1]*n for i in range(n)]
  for _ in range(m):
    a, b, c = map(int, input().split())
    road[a-1][b-1] = c
    road[b-1][a-1] = c
    count[a-1][b-1] = 0
    count[b-1][a-1] = 0
  for k in range(n):
    for i in range(n):
      for j in range(n):
        if road[i][k]+road[k][j] < road[i][j]:
          if count[i][j] == 0:
            count[i][j] = 1
          road[i][j] = road[i][k]+road[k][j]
  ans = 0
  for i in range(n):
    ans += count[i].count(1)
  print(ans//2)
if __name__ == "__main__":
  main()

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

using namespace std;

int main()
{
    long long n,m;
    cin>>n>>m;
    long long w[n+1],v[n+1];
    for(long long i=1; i<=n; i++)
    {
        cin>>w[i]>>v[i];
    }
    long long dp[n+1][m+1];
    memset(dp,0,sizeof(dp));
    for(long long i=1; i<=n; i++)
    {
        for(long long j=0; j<=m; j++)
        {
            if(!i||!j)
            {
                dp[i][j]=0;
            }
            if(w[i]>j)
            {
                dp[i][j]=dp[i-1][j];
            }
            else
            {
               dp[i][j]=max(dp[i-1][j],v[i]+dp[i-1][j-w[i]]);
            }
        }
    }
    cout<<dp[n][m]<<endl;
    return 0;
}


Measured memory_bytes: 79104
#include<stdio.h>
int main(){
  int a,b;

  scanf("%d%d",&a,&b );
  if(a < b){
    printf("a < b\n");
  }
  else if(a > b){
    printf("a > b\n");
  }
  else printf("a == b\n");
 return 0;
}

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

void solve() {
  int n;
  cin >> n;
  vector<int> ans(n+1);
  for (int i = 1; i * i <= n; ++i) {
    for (int j = 1; j * j <= n; ++j) {
      for (int k = 1; k * k <= n; ++k) {
        int t = i*i + j*j + k*k + i*j + j*k + k*i;
        if (t <= n) ++ans[t];
      }
    }
  }
  for (int i = 1; i <= n; ++i) cout << ans[i] << endl;
}
void solve(bool tests) {
  int t;
  cin >> t;
  while (t--) solve();
}

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

Measured memory_bytes: 3636
#include<stdio.h>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<utility>
#include<memory>
#include<cmath>
#include<stack>
#include<tuple>
#include<numeric>
#include<cassert>

#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define pb push_back
#define DEBUG false

using namespace std;

using ll = long long;
using P = pair<int,int>;
using Pl = pair<int,ll>;
using Pd = pair<double,double>;
using T = tuple<double,double,int>;

const int mod=1e9+7,INF=1<<30;
const double EPS=1e-12,PI=3.1415926535897932384626;
const ll LINF=1LL<<60;
const int MAX_N = 100005;
const ll lmod = 1e9+7;

int N,p[MAX_N];

int main(){
  cin >> N ;
  rep(i,N) scanf("%d",p+i);
  int ans = 0;
  rep(i,N){
    if(p[i]==i+1) swap(p[i],p[i+1]),ans++;
  }
  cout << ans << endl;
  return 0;
}

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

#define ll long long
#define ld long double
#define db double
#define str string
#define pb push_back
#define nl '\n'
#define X first
#define Y second
#define nimble ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define all(v) (v).begin(),(v).end()
#define rall(v) rbegin(v),rend(v)
#define selp(a) for(auto i:a)cout<<i<<" ";cout<<nl;
#define mod(x,m) ((((x)%(m))+(m))%(m))
#define _sz(x) (int)x.size()
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repv(v) for(int i=0;i<_sz(v);i++)
#define rep1(i,b,a) for(int i=b;i>=a;i--)
#define preci(x) fixed<<setprecision(x)
//ll MLG(ll n,ll b){ll a=0;while(n)a++,n/=b;return a-1;}

#define TRACE
#ifdef TRACE
#define see(...) __f(#__VA_ARGS__,__VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr<<name<<" : "<<arg1<<nl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma=strchr(names+1,',');cerr.write(names,comma-names)<<" : "<<arg1<<" | ";__f(comma+1, args...);
}
#else
#endif

int inf=0x3f3f3f3f;
ll infl=0x3f3f3f3f3f3f3f3fLL;
ld infd=1.0/0.0;
const ll MOD=1e9+7;// 998244353 // = (119<<23)+1
const db pi=2*acos(0.0);

int main(){
    nimble;
    int tt=1;//cin>>tt;
    while(tt--){
        string s;
        cin>>s;
        if(s[2]==s[3]&&s[4]==s[5]){
            cout<<"Yes";
        }
        else cout<<"No"<<nl;
    }

    return 0;
}


Measured memory_bytes: 256
package main

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

func max(a, b int) int {
	if a < b {
		return b
	}
	return a
}

/*
    dp[i][k]: 表示fs[0~i]之间, 有k个正面的概率
    初始值:
        dp[0][0]=1-fs[0]
        dp[1][1]=fs[i]
    转移方程:
        dp[i][k]=fs[i]*dp[i-1][k-1]+(1-fs[i])*dp[i-1][k]
*/
func solve(fs []float64, N int) float64 {
    dp := make([][]float64, N)
    for i := range dp {
        dp[i] = make([]float64, N+1)
    }
    dp[0][0] = 1-fs[0]
    dp[0][1] = fs[0]

    for i:=1; i<N; i++ {
        for k:=0; k<=i+1; k++ {
            if k > 0 {
                dp[i][k] += fs[i]*dp[i-1][k-1]
            }
            dp[i][k] += (1-fs[i])*dp[i-1][k]
        }
    }

    k := 0
    if N%2 == 0 {
        k = N/2
    } else {
        k = (N/2)+1
    }

    ans := 0.0
    for ; k<=N; k++ {
        ans += dp[N-1][k]
    }
    return ans
}

func readLineNum(bf *bufio.Reader) int {
	line, _ := bf.ReadString('\n')
	line = strings.Trim(line, "\n")
	N, _ := strconv.Atoi(line)
	return N
}

func readLineNums(bf *bufio.Reader) []int {
	line, _ := bf.ReadString('\n')
	line = strings.Trim(line, "\n")
	fields := strings.Split(line, " ")
	nums := []int{}
	for _, field := range fields {
		num, _ := strconv.Atoi(field)
		nums = append(nums, num)
	}
	return nums
}

func readLineFloats(bf *bufio.Reader) []float64 {
	line, _ := bf.ReadString('\n')
	line = strings.Trim(line, "\n")
	fields := strings.Split(line, " ")
	fs := []float64{}
	for _, field := range fields {
		f , _ := strconv.ParseFloat(field, 64)
		fs = append(fs, f)
	}
	return fs
}

func readLineStrs(bf *bufio.Reader) []string {
	line, _ := bf.ReadString('\n')
	line = strings.Trim(line, "\n")
	return strings.Split(line, " ")
}

func main() {
	bf := bufio.NewReader(os.Stdin)
    N := readLineNum(bf)
    ps := readLineFloats(bf)
    fmt.Println(solve(ps, N))
}


Measured memory_bytes: 44928
#include <iostream>
#include <cstdio>
#include <vector>
using namespace std;

int main(){
    int a[5];
    while(scanf("%d,%d,%d,%d,%d", &a[0], &a[1], &a[2], &a[3], &a[4])!=EOF){
        vector<int> hand(15, 0);
        for(int i=0; i<5; i++){
            hand[a[i]]++;
        }
        hand[14] = hand[1];
        int fs=0, sc=0;
        for(int i=1; i<=13; i++){
            if(hand[i] >= fs){
                sc = fs;
                fs = hand[i];
            }else if(hand[i] > sc){
                sc = hand[i];
            }
        }
        bool straight = false;
        for(int i=1; i<=10; i++){
            bool continued = true;
            for(int j=0; j<5; j++){
                if(hand[i+j]==0){
                    continued = false;
                    break;
                }
            }
            if(continued){
                straight = true;
                break;
            }
        }
        if(fs == 4){
            cout << "four card" << endl;
        }else if(fs==3 && sc==2){
            cout << "full house" << endl;
        }else if(straight){
            cout << "straight" << endl;
        }else if(fs==3){
            cout << "three card" << endl;
        }else if(fs==2 && sc==2){
            cout << "two pair" << endl;
        }else if(fs == 2){
            cout << "one pair" << endl;
        }else{
            cout << "null" << endl;
        }
    }
    return 0;
}



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

int main()
{
    int N, X;
    cin >> N >> X;

    vector<int> L(N);
    for(int i = 0; i < N; i++)
    {
        cin >> L[i];
    }

    vector<int> D(N + 1, 0);
    for(int i = 1; i <= N; i++)
    {
        D[i] = D[i - 1] + L[i - 1];
    }

    int cnt = 0;
    for(int i = 0; i <= N; i++)
    {
        if(D[i] <= X)
        {
            cnt++;
        }
    }

    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 764
#include <iostream>

using namespace std;

int main()
{
  int64_t q, h, s, d;
  cin >> q >> h >> s >> d;

  int64_t n;
  cin >> n;

  int64_t cost = n * 4 * q;
  cost = min(cost, n * 2 * h);
  cost = min(cost, n * s);
  cost = min(cost, n / 2 * d + (n % 2) * s);
  cost = min(cost, n / 2 * d + (n % 2) * 2 * h);
  cost = min(cost, n / 2 * d + (n % 2) * 4 * q);

  cout << cost << "\n";
  return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<cctype>
#include<cstring>
#include<map>
#include<bitset>
#include<stack>
#include<queue>
#include<set>
#include<cmath>
#include<vector>

using namespace std;

#define bomb exit(1)
#define INF 1000000000
#define LINF 1000000000000000000ll
#define pprint(x) print(x),putchar(' ')
#define fprint(x) print(x),putchar('\n')
#define EE(x); struct edge { int nxt,to,w; }e[M << 1]; int head[N],cnt = x ^ 1;\
	void add(int u,int v,int w = 0) { e[++cnt].w = w,e[cnt].to = v,e[cnt].nxt = head[u];head[u] = cnt; }\
	void add_edge(int u,int v,int w = 0) { add(u,v,w),add(v,u,w * x); }
#define Mod(x) ((x) >= mod ? x - mod : x)
#define eps 0.0000000001
#define sqr(x) ((x) * (x))
#define iter iterator
#define fi first
#define se second
#define ll long long
//#define getchar() (SS == TT && (TT = (SS = BB) + fread(BB,1,1 << 15,stdin),TT == SS) ? EOF : *SS++)
//char BB[1 << 15],*SS = BB,*TT = BB;
inline ll read()
{
	ll x = 0;int f = 1;char ch = getchar();
	for(;!isdigit(ch);ch = getchar()) if(ch == '-') f = -1;
	for(;isdigit(ch);ch = getchar()) x = x * 10 + (ch ^ 48);
	return x * f;
}
void print(ll x)
{
	if(x < 0) putchar('-'),x = -x;
	if(x > 9) print(x / 10);
	putchar(x % 10 + '0');
}

const int N = 21;

int n,k,s[1 << N],tr[1 << N][2];
int f[N][1 << N],ans;

int main() {
	n = read(),k = read();
	for(int i = 0;i <= n;i++)
		for(int x = 0;x < 1 << i;x++)
			scanf("%1d",&f[i][1 << i ^ x]);
	s[0] = -1;
	for(int i = 1;i < 2 << n;i++) s[i] = s[i >> 1] + 1;
	for(int i = 2;i < 2 << n;++i)
		if(i >> (s[i] - 1) & 1)
		{
			tr[i][1] = i ^ 1 << s[i];
			tr[i][0] = tr[tr[i][1]][0];
		}
		else
		{
			tr[i][0] = i ^ 3 << (s[i] - 1);
			tr[i][1] = tr[tr[i][0]][1];
		}
	for(int i = n;i >= 1;--i)
		for(int j = 1 << i;j < 2 << n;++j) if(f[i][j])
		{
			int p = j >> i,now = (j & ((1 << i) - 1)) ^ 1 << i;
			if(tr[now][0]) f[s[tr[now][0]]][(p << 1 ^ 1) << s[tr[now][0]] ^ tr[now][0]] += f[i][j];
			if(tr[now][1]) f[s[tr[now][1]]][(p << 1 ^ 0) << s[tr[now][1]] ^ tr[now][1]] += f[i][j];
			f[0][p] += f[i][j];
		}
	ans = 1;
	for(int i = 2;i < 2 << n;i++) if(f[0][i] >= k && s[i] > s[ans]) ans = i;
	int j = n;
	while(~ans >> j & 1) j--;
	while(j--) print(ans >> j & 1);
	return 0;
}

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

int main() {
  int n;
  cin>>n;
  vector<int> a(n);
  double c=0;
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  for(int i=0;i<n;i++){
    c+=1.0/a[i];
  }
  double ans=1/c;
  cout<<ans<<endl;
}

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

int main(){
  int64_t n,m,gcd;
  string s,t;
  cin >> n >> m >> s >> t;
  {int64_t g=max(n,m),l=min(n,m);gcd=l;
   while(g%l!=0){
     gcd=g%l;
     g=l;
     l=gcd;
   }
  }
  bool ok=true;
  for(int i=0;i<gcd;i++){
    if(s.at((n/gcd)*i)!=t.at((m/gcd)*i))
      ok=false;
  }
  cout << (ok?gcd*n/gcd*m/gcd:-1) << endl;
  return 0;
}

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

class Main{
	public static void main(String[] args){
		int num;
		int[] a = new int[3];
		try{
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			String line = br.readLine();
			StringTokenizer st = new StringTokenizer(line," ");
			for(int i=0;i<a.length;i++){
				a[i] = Integer.parseInt(st.nextToken());
			}
			for(int i=0;i<a.length-1;i++){
				for(int j=1;j<a.length;j++){
					if(a[i] > a[j]){
						num = a[i];
						a[i] = a[j];
						a[j] = num;
					}
				}
			}
			System.out.println(a[0]+" "+a[1]+" "+a[2]);
		}
		catch(Exception e){
			System.out.println(e);
		}
	}
}

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


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

    int max = a+b;
    if(max < a-b)
        max = a-b;
    if(max < a*b)
        max = a*b;


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

    
    return 0;
} 



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








int main()
{

   
int n,s;

cin >> n >> s;

long long a[n + 1];

for(int i = 0 ; i < n ; i++){
	cin >> a[i];
	s-=a[i];
}
sort(a,a+n);

cout << 1LL * (n + (s / a[0]));



	return 0;
}		


Measured memory_bytes: 256
N,K = map(int, input().strip().split(' '))
x = list(map(int, input().strip().split(' ')))
min_cost = float('inf')
if N > 2*K:
  for i,d in enumerate(x):
    if d >= 0:
      break
  x = x[i-K:i+K]
for i in range(len(x)-K+1):
  n_cost = -min(x[i], 0)
  p_cost = max(0, x[i+K-1])
  cost = n_cost + p_cost + min(n_cost, p_cost)
  if min_cost > cost:
    min_cost = cost
print(min_cost)

Measured memory_bytes: 14224
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <functional>
#include <cmath>
#include <cstring>
#include <numeric>
#include <random>
#include <map>
#include <unordered_map>
#include <queue>
#include <regex>
#include <complex>
#include <list>
#include <cassert>
#include <deque>

#define addf(T) [](T a, T b){return (a + b);}
#define minf(T) [](T a, T b){return min(a, b);}
#define maxf(T) [](T a, T b){return max(a, b);}
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
#define INF 2147483647;

using namespace std;
using ll = long long;

/*
struct UnionFind {
    // union tree
    // used for tracking a set of elements partitioned into a number of disjoint subsets
    // rankなしでの実装

    vector<int> par;
    // par[i] means i's parent
    // (ex) par[3] = 2 means 2 is a parent of 3

    UnionFind(int N) : par(N) {
      //used for initialization
      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のtreeのmerge
      int rx = root(x); //xの根をrx
      int ry = root(y); //yの根をry
      if (rx == ry) return; //同じ時はそのままに
      par[rx] = ry; //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;
    }
};

template<typename T>
struct SegTree {
  //segment tree

  //木は配列で表現
  vector<T> seg;
  //木の1/2の大きさ
  int size;
  //単位元
  const T unit;
  //比較関数の型
  using F = function<T(T,T)>;
  //mergeする関数
  const F f;

  //単位元がaで大きさnのsegtreeの初期化を行う
  //大きさnとはすなわち葉の数がnであることをいう
  SegTree(int n, const T a, const F f) : unit(a), f(f) {
    size = 1;
    while(size < n) size <<= 1;
    seg.assign(2*size, unit);
    size--;
  }

  //k番目にtを代入する
  void set(int k, const T& t) {
    seg[k + size] = t;
  }

  //関数fによって木を構築する
  void build(){
    for (int i = size - 1; i >=0; i--){
      seg[i] = f(seg[i*2+1],seg[i*2+2]);
    }
  }

  //i番目の要素を返す
  T operator[](const int i){
    return seg[i + size];
  }

  //k番目の値をaに更新する
  void update(int k, T a){
    k = k + size;
    //必要ならばここを変えても良い
    seg[k] = a;
    //自分の親の情報を再帰的に更新していく
    while(k>0){
      k = ((k-1) >> 1);
      seg[k] = f(seg[k*2+1],seg[k*2+2]);
    }
  }

  //[a,b)についてfをした結果を返す
  //例えば、fがminだったらどうなるかを考えるとわかりやすい
  //unitについては足し算なら0,掛け算なら1,minならinf,どんな値が来てもその値を返すもの
  T query(int a, int b, int k, int l, int r) {
    if (r <= a || b <= l) {
      return unit;
    } else if (a <= l && r <= b) {
      return seg[k];
    } else {
      T lch = query(a, b, k * 2 + 1, l, (l + r) / 2);
      T rch = query(a, b, k * 2 + 2, (l + r) / 2, r);
      return f(lch, rch);
    }
  }
  T query(int a, int b) { return query(a, b, 0, 0, size+1); }
};
*/

/* --- ここからコード --- */

int main(){
  int N ;
  cin >> N;
  int X[100];
  rep(i,N) cin >> X[i];
  int ans = INF;
  for(int i = 1; i < 101; i++){
    int temp = 0;
    rep(j,N) temp += (X[j] - i) * (X[j] - i);
    ans = min(temp,ans);

  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
string s;
int i,j,k,n,m,l,flag,w,max;
vector<int> left(200000),right(20000000);
cin>>n >> k;
cin >> s ;
flag=1;
w=1;
if(s.at(0)=='1')
{
left.at(1)=0;
flag++;
}
for(i=0;i<n-1;i++)
{
if(s.at(i)=='0'&&s.at(i+1)=='1')
{
left.at(flag)=i+1;
flag++;
}
if(s.at(i)=='1'&&s.at(i+1)=='0')
{
right.at(w)=i;
w++;
}
}
if(s.at(n-1)=='1')
{
right.at(w)=n-1;
w++;
}
left.at(0)=0;
right.at(w)=n-1;
//cout << flag-1 << w-1 <<endl;
m=w-1;
max=0;
if(w>=k)
{
for(i=0;i<=w-k;i++)
{
l=right.at(i+k)-left.at(i)+1;
if(l>=max)
{
max=l;
}
}
}
else
{
max=n;
}
cout << max <<endl;
}

Measured memory_bytes: 79360
#include <stdio.h>

int arr[45];

int fib(int num)
{
    if (num == 0 || num == 1) {
        return 1;
    }

    if (arr[num] == 0) {
        arr[num] = fib(num - 1) + fib(num - 2);
    }
    return arr[num];
}

int main(int argc, char** argv)
{
    int num;
    memset(arr, 0, sizeof(arr));
    scanf("%d", &num);


    printf("%d\n", fib(num));
    return 0;
}

Measured memory_bytes: 596
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    // TODO 自動生成されたメソッド・スタブ
    Scanner sc = new Scanner(System.in);

    int h = sc.nextInt();
    int n = sc.nextInt();
    int a[] = new int[n];

    int sum = 0;
    for (int i = 0; i < n; i++) {
      a[i] = sc.nextInt();
      sum += a[i];
    }

    if (sum >= h) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
  }
}


Measured memory_bytes: 50312
#include<iostream>
using namespace std;
int gcd(int x,int y){return y?gcd(y,x%y):x;}
int N,K,A,ma,g;
int main(void){
    cin>>N>>K;
    for(int i=0;i<N;i++){cin>>A;ma=max(ma,A);g=(i?gcd(g,A):A);}
    cout<<(K<=ma&&K%g==0?"":"IM")<<"POSSIBLE"<<endl;
    return 0;
}

Measured memory_bytes: 3616
#include <stdio.h>

#include <stdbool.h>



int main(){

    int i, j, n;

    char mark;

    char marks[4]={'S', 'H', 'C', 'D'};

    int num;

    bool cards[4][13]={false};



    scanf("%d ", &n);

    for(i=0;i<n;i++){

        scanf("%c %d ", &mark, &num);

        for(j=0;j<4;j++){

            if(mark==marks[j]){

                cards[j][num-1]=true;

                break;

            }

        }

    }

    for(i=0;i<4;i++){

        for(j=0;j<13;j++){

            if(!cards[i][j]){

                printf("%c %d\n", marks[i], j+1);

            }

        }

    }

    return 0;

}


Measured memory_bytes: 2720
#include<bits/stdc++.h>
    using namespace std;
	
    int main(){
    	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
		long long n,w;
		cin>>n>>w;
		long long dp[n+1][1000*n+2];
		long long aw[n+1];
		long long av[n+1];
		for(long long i=1;i<=n;i++){
			cin>>aw[i]>>av[i];
		}
		for(long long i=0;i<=n;i++){
			dp[i][0]=0;
		}
		for(long long i=1;i<=1000*n+1;i++){
			dp[0][i]=w+1;
		}
		
		long long ll=1000*n+1;
		for(long long i=1;i<=n;i++){
			for(long long j=1;j<=ll;j++){
				if(av[i]<=j){
					dp[i][j]=min(dp[i-1][j],dp[i-1][j-av[i]]+aw[i]);
				}
				else{
					dp[i][j]=dp[i-1][j];
				}
			}
		}
		for(int i=ll;i>=0;i--){
			if(dp[n][i]<=w){
				cout<<i<<"\n";
				break;
			}
		}
		
		//cout<<dp[n][0]<<"\n";
        return 0;
    }

Measured memory_bytes: 79232
#入力高速化 + 再帰回数制限解除
import sys
input=sys.stdin.readline
sys.setrecursionlimit(10000000)
#ダイクストラ
#単一始点最短経路(正の辺のみ)
#s=始点 n=頂点数 edgeは隣接リスト(edge=[[[1,2],[2,4]],[[2,1]],[]])
#0-indexed
from heapq import heappop,heappush
def dijkstra(s,n,edge):
  inf=10**17
  ans=[inf]*n
  ans[s]=0
  h=[[0,s]]
  while h:
    c,v=heappop(h)
    if ans[v]<c:continue
    for u,t in edge[v]:
      if c+t<ans[u]:
        ans[u]=c+t
        heappush(h,[c+t,u])
  return ans
#solve
n,m,s,t=map(int,input().split())
s-=1
t-=1
yen_edge=[[]for _ in range(n)]
snuuk_edge=[[]for _ in range(n)]
for _ in range(m):
  u,v,a,b=map(int,input().split())
  u-=1
  v-=1
  yen_edge[u].append([v,a])
  yen_edge[v].append([u,a])
  snuuk_edge[u].append([v,b])
  snuuk_edge[v].append([u,b])
yen=dijkstra(s,n,yen_edge)
snuuk=dijkstra(t,n,snuuk_edge)
ans=[10**15-(yen[i]+snuuk[i])for i in range(n)]
for i in range(n-2,-1,-1):ans[i]=max(ans[i],ans[i+1])
for i in ans:print(i)


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

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1e9
typedef long long ll;

const int MAXR = 510000;
const int MOD = 1e9+7;
template<ll mod> class modint{
public:
    ll val=0;
    //コンストラクタ
    modint(ll x=0){while(x<0)x+=mod;val=x%mod;}
    //コピーコンストラクタ
    modint(const modint &r){val=r.val;}
    //算術演算子
    modint operator -(){return modint(-val);} //単項
    modint operator +(const modint &r){return modint(*this)+=r;}
    modint operator -(const modint &r){return modint(*this)-=r;}
    modint operator *(const modint &r){return modint(*this)*=r;}
    modint operator /(const modint &r){return modint(*this)/=r;}
    //代入演算子
    modint &operator +=(const modint &r){
        val+=r.val;
        if(val>=mod)val-=mod;
        return *this;
    }
    modint &operator -=(const modint &r){
        if(val<r.val)val+=mod;
        val-=r.val;
        return *this;
    }
    modint &operator *=(const modint &r){
        val=val*r.val%mod;
        return *this;
    }
    modint &operator /=(const modint &r){
        ll a=r.val,b=mod,u=1,v=0;
        while(b){
            ll t=a/b;
            a-=t*b;swap(a,b);
            u-=t*v;swap(u,v);
        }
        val=val*u%mod;
        if(val<0)val+=mod;
        return *this;
    }
    //等価比較演算子
    bool operator ==(const modint& r){return this->val==r.val;}
    bool operator <(const modint& r){return this->val<r.val;}
    bool operator !=(const modint& r){return this->val!=r.val;}
};

using mint = modint<MOD>;

//入出力ストリーム
istream &operator >>(istream &is,mint& x){//xにconst付けない
    ll t;is >> t;
    x=t;
    return (is);
}
ostream &operator <<(ostream &os,const mint& x){
    return os<<x.val;
}

//累乗
mint modpow(const mint &a,ll n){
    if(n==0)return 1;
    mint t=modpow(a,n/2);
    t=t*t;
    if(n&1)t=t*a;
    return t;
}

//二項係数の計算
mint fac[MAXR+1],finv[MAXR+1],inv[MAXR+1];
//テーブルの作成
void cominit() {
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    FOR(i,2,MAXR){
        fac[i]=fac[i-1]*mint(i);
        inv[i]=-inv[MOD%i]*mint(MOD/i);
        finv[i]=finv[i-1]*inv[i];
    }
}
//演算部分
mint com(ll n,ll k){
    if(n<k)return 0;
    if(n<0)return 0;
    if(k==0) return 1;
    return fac[n]*finv[k]*finv[n-k];
}


int main() {

    int N,M;
    cin >> N >> M;

    cominit();


    mint ans = 0;
    REP(k,N+1){
        ans += modpow(-1, k) * com(N,k) * fac[M] * finv[M-k] * modpow(fac[M-k] * finv[M-N], 2);
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 15584
import sys

def get_ints(): return map(int, sys.stdin.readline().strip().split())
def get_array(): return list(map(int, sys.stdin.readline().strip().split()))
def input(): return sys.stdin.readline().strip()

a, b, n = get_ints()
if n>=b:
  x = b-1
else:
  x = n

ans = (a*x)//b - a*(x//b)
print(ans)

Measured memory_bytes: 61864
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define rep(i, n) ;for (int i = 0;i < (int)(n);i++)
#define rep2(i, s, n) ;for (int i = s; i < (int)(n);i++)
#define ALL(vec)  (vec).begin(),(vec).end()
#define pi 3.1415926535897932384626433832795
#define MAX_INF 9223372036854775807
#define MIN_INF (922337203685477587+1)
#define sosuu 1000000007


int main()
{
  int A,B, K;
  vector<int> ans(0);
  cin >> A >> B>>K;
  rep(i, 100){
  if(A%(i+1)==0&&B%(i+1)==0)
    ans.insert(ans.begin(),i+1);
  }
  cout << ans[K-1] << endl;
}

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


int main() {
    int n,k;
    cin >> n >> k;
    vector<ll> h(n);
    rep(i,n) cin >> h[i];

    sort(h.begin(),h.end());
    ll ans=h.at(n-1);

    rep(i,n-k+1){
        // if(ans>x) ans=x;
        ans=min(h[i+k-1]-h[i],ans);
    }

    cout << ans << endl;
}

Measured memory_bytes: 1024
n = int(input())
p = list(map(int, input().split()))
ans = 0
for i in range(n - 2):
    minp = min(p[i], p[i + 1], p[i + 2])
    maxp = max(p[i], p[i + 1], p[i + 2])
    if p[i + 1] != minp and p[i + 1] != maxp:
        ans += 1
print(ans)


Measured memory_bytes: 9116
#include <bits/stdc++.h>
 
typedef long long ll;

using namespace std;
using Graph = vector<vector<int>>;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define COUT(a) cout << (a) << endl;
#define ENDL(a) cout << endl;

const unsigned int BIT_FLAG_0 = (1 << 0); // 0000 0000 0000 0001
const unsigned int BIT_FLAG_1 = (1 << 1); // 0000 0000 0000 0010
const unsigned int BIT_FLAG_2 = (1 << 2); // 0000 0000 0000 0100
const unsigned int BIT_FLAG_3 = (1 << 3); // 0000 0000 0000 1000
const unsigned int BIT_FLAG_4 = (1 << 4); // 0000 0000 0001 0000
const unsigned int BIT_FLAG_5 = (1 << 5); // 0000 0000 0010 0000
const unsigned int BIT_FLAG_6 = (1 << 6); // 0000 0000 0100 0000
const unsigned int BIT_FLAG_7 = (1 << 7); // 0000 0000 1000 0000
const unsigned int BIT_FLAG_8 = (1 << 8); // 0000 0001 0000 0000
const unsigned int BIT_FLAG_9 = (1 << 9); // 0000 0010 0000 0000
const unsigned int BIT_FLAG_10 = (1 << 10); // 0000 0100 0000 0000
const unsigned int BIT_FLAG_11 = (1 << 11); // 0000 1000 0000 0000


void Main() {
    int k, a, b;
    cin >> k >> a >> b;

    FOR(i, a, b) {
        if (i % k == 0) {
            COUT("OK");
            return;
        }
    }
    COUT("NG");
} 

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



Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
// clang-format off

using LL = long long;
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();i++)
#define RFOR(i,c) for(__typeof((c).rbegin())i=(c).rbegin();i!=(c).rend();i++)
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
 
template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
os<<"["; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"]"; return os;
}
template<class T> ostream& operator<<(ostream &os, const set<T> &t) {
os<<"{"; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"}"; return os;
}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}
// clang-format on

void solve(long long N, long long W, std::vector<long long> w, std::vector<long long> v) {
  // solver code

  LL dp[N + 1][W + 1];

  for (int i = 0; i <= W; i++) {
    dp[0][i] = 0;
  }

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

  cout << dp[N][W] << endl;
}

int main() {
  long long N;
  scanf("%lld", &N);
  long long W;
  scanf("%lld", &W);
  std::vector<long long> w(N);
  std::vector<long long> v(N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &w[i]);
    scanf("%lld", &v[i]);
  }
  solve(N, W, std::move(w), std::move(v));
  return 0;
}


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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(x) (x).begin(),(x).end()
#define endl "\n"

using ll = long long;
using P = pair<int,int>;
using mp =  map<char,int>;

const int MOD = 1e9 + 7;
const int INF = 1001001001;


int main() {
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

    int n, m;
    cin >> n;
    map<int, int> m1, m2;
    
    rep(i, n){
        int d;
        cin >> d;
        m1[d]++;
    }
    cin >> m;

    bool ok = true;
    rep(i, m){
        int t;
        cin >> t;
        m2[t]++;
    }

    for (auto& p : m2) {
        if(m1[p.first] < p.second){
            ok = false;
        }
    }

    cout << (ok ? "YES" : "NO") << endl;

    return 0;
}

Measured memory_bytes: 19072
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from itertools import permutations, accumulate, combinations, combinations_with_replacement
from math import sqrt, ceil, floor, factorial
from bisect import bisect_left, bisect_right
from copy import deepcopy
from operator import itemgetter
from functools import reduce
#from fractions import gcd
#from math import gcd
import sys
def I(): return int(input())
def Is(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def TI(): return tuple(map(int, input().split()))
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()
def LS(): return list(input())
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(10**6)
MOD = 10**9+7
INF = float('inf')


n = I()
P = LI()
T = sorted(P)
for i in range(n):
    for j in range(n):
        tmp = deepcopy(P)
        tmp[i], tmp[j] = tmp[j], tmp[i]
        if T == tmp:
            print("YES")
            exit()

print("NO")

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

int main()
{
  int N, L, R;
  cin >> N;
  int sum = 0;
  for (int i = 0; i < N + 1; i++)
  {
    if (i == N)
    {
      cout << sum << endl;
      break;
    }
    cin >> L >> R;
    if (L > R)
    {
      sum += (L - R + 1);
    }
    else if (R > L)
    {
      sum += (R - L + 1);
    }
    else
    {
      sum += 1;
    }
  }
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<functional>
#include<map>
#include<cstdlib>
#include<complex>
#include<numeric>

using namespace std;
using Int = long long;
Int INF = 1LL << 60;

int main() {

	Int a, b, c;
	cin >> a >> b >> c;

	int ans = c - (a - b);
	if (ans>=0)cout << ans << endl;
	else cout << 0 << endl;
}

Measured memory_bytes: 256
import sys
N = int(input())
l = list(map(int, input().split()))

if N == 1:
    print("Yes")
    sys.exit()


if l[0] - l[1] > 1:
    print("No")
    sys.exit()


for i in range(1, N-1):
    if l[i] - l[i-1] >= 1:
        l[i] -= 1
    if l[i] - l[i+1] >= 1:
        print("No")
        sys.exit()

print("Yes")


Measured memory_bytes: 63856
import java.util.*;
import java.lang.Math.*;
import java.util.Arrays;
import java.util.Collections;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// スペース区切りの整数の入力
      int x=sc.nextInt();
      int n=sc.nextInt();
      int bigans=x;
      int smlans=x;
      Integer ns[]=new Integer[n];
      for(int i=0;i<n;i++){
        ns[i]=sc.nextInt();
      }
      Arrays.sort(ns);
      for(int i=0;i<n;i++){
        int nx=ns[i];
        if(bigans==nx){
          bigans=nx+1;
        }
      }
      Arrays.sort(ns, Collections.reverseOrder());
      for(int i=0;i<n;i++){
        int nx=ns[i];
         if(smlans==nx){
          smlans=nx-1;
        }
      }
      if(Math.abs(bigans-x)<Math.abs(smlans-x)){
        System.out.println(bigans);
      }else{
        System.out.println(smlans);
      }
}
}

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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define LCM(a, b) (a) / __gcd((a), (b)) * (b)
#define CEIL(a, b) (a)/(b)+(((a)%(b))?1:0)
#define ln '\n'

using namespace std;

typedef long long LL;
typedef long double ldouble;
typedef pair<int, int> P;
typedef pair<LL, LL> LP;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1e9 + 7;
static const int SIZE = 200005;

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

LL fac[SIZE], finv[SIZE], inv[SIZE];
void combInit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for( int i = 2; i < SIZE; ++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;

    }
}

LL comb(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;

}

LL Bin(LL n, LL k) {
    if(k < 0 || n < k) {
        return 0;

    }
    LL ret = 1;
    for(LL i = 1; i <= k; ++i) {
        ret *= n--;
        ret /= i;

    }
    return ret;
}


vector<LL> Div(LL n) {
    vector<LL> ret;
    for(LL i = 1; i * i <= n; ++i) {
        if(n % i == 0) {
            ret.pb(i);
            if(i * i != n) ret.pb(n / i);
        }
    }
    sort(all(ret));
    return ret;
}

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

    int h, w, a, b;
    cin >> h >> w >> a >> b;
    combInit();

    LL res = 0;
    for(int i = 0; i < h - a; ++i) {
        res += comb(i + b - 1, i) * comb(h - i - 1 + w - b - 1, h - i - 1);
        res %= MOD;

    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 4992
#include <bits/stdc++.h>
#define REP(i, a, n) for (long long i = (a); i < (long long)(n); ++i)
#define REPC(i, a, n) for (long long i = (a); i <= (long long)(n); ++i)
#define ALL(t) t.begin(), t.end()
#define RALL(t) t.rbegin(), t.rend()
#define MATINIT(type, row, col, init)                                          \
  vector<vector<type>>(row, vector<type>(col, init));
#define Yes(cond) cout << (cond ? "Yes" : "No") << endl;
#define YES(cond) cout << (cond ? "YES" : "NO") << endl;
using namespace std;
using LL = long long;
using ULL = unsigned long long;
template <class T> using VEC = std::vector<T>;
template <class T> using MAT = std::vector<std::vector<T>>;
void DUMP() { cerr << endl; }
template <class Head, class... Tail> void DUMP(Head &&head, Tail &&... tail) {
  cerr << head << ", ";
  DUMP(std::move(tail)...);
}
template <typename T> ostream &operator<<(ostream &os, vector<T> &vec) {
  os << "{";
  for (auto v : vec)
    os << v << ",";
  os << "}";
  return os;
}
template <typename T> ostream &operator<<(ostream &os, set<T> &s) {
  os << "{";
  for (auto p : s)
    os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, map<T1, T2> &m) {
  os << "{";
  for (auto p : m)
    os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, pair<T1, T2> p) {
  os << "[" << p.first << " " << p.second << "]";
  return os;
}

int main() {
  int A,B,C;
  cin>>A>>B>>C;
  string ans;
  if(A+B+C>=22){
    ans="bust";
  }else{
    ans="win";
  }
  cout<<ans<<endl;


  return 0;
}


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

#define rep(i,n) for(i = 0;i < n;++i)
#define all(v) v.begin(), v.end()
using ll = long long;

int main()
{
    ll i,j;
    ll n,m;
    cin >> n >> m;
    vector<vector<ll>> graph(n);
    for(i = 0;i < m;++i){
        ll a,b;
        cin >> a >> b;
        --a;    --b;
        graph.at(a).push_back(b);
        graph.at(b).push_back(a);
    }
    queue<ll> que;
    vector<ll> vdis(n,-1);
    ll top = 0;
    vdis.at(top) = 0;
    que.emplace(top);
    while(!que.empty()){
        ll now = que.front();
        que.pop();
        for(i = 0;i < graph.at(now).size();++i){
            ll next = graph.at(now).at(i);
            if(vdis.at(next) == -1){
                vdis.at(next) = now;
                que.emplace(next);
            }
        }
    }
    cout << "Yes" << endl;
    for(i = 1;i < n;++i){
        cout << vdis.at(i)+1 << endl;
    }


    return 0;
}

Measured memory_bytes: 12940
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    string S,T;
    int counter = 0;

    cin >> S >> T;

    for(int i=0;i<S.size();i++){
        if(S.at(i) != T.at(i)){
            counter++;
        }
    }


    cout << counter << endl;

}

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

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

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

//const value
//const ll MOD = 1e9 + 7;
//const int dx[] = {0,1,0,-1};//{0,0,1,1,1,-1,-1,-1};
//const int dy[] = {1,0,-1,0};//{1,-1,0,1,-1,0,1,-1};

//conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
inline ll toLL(string s) {ll v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

const int mod = 1e9 + 7;
ll dp[1010101][2]; //dp[上から見た桁の数][nと比較し、その桁の数より小さい数が出たか？]
int main(){
  string n;
  cin >> n;
  ll len = n.length();

  dp[0][0] = 1;
  for(int i = 0; i < len; i++){
    for(int j = 0; j < 2; j++){

      int lim;
      if(j == 1)  lim = 1;          //これまでに小さい桁が存在したら、以降は何を選んでもOK
      else        lim = n[i] - '0'; //n[i]より小さい数を選んで来る

      for(int d = 0; d <= lim; d++){
        // 1を選ぶ場合
        // 0を選ぶ場合
        if(d == 0) (dp[i+1][j || d < lim] += dp[i][j]) %= mod;
        if(d == 1) (dp[i+1][j || d < lim] += dp[i][j]*2LL) %= mod;
      }
    }
  }

  ll ans = 0;
  for(int j = 0; j < 2; j++){
    ans += dp[len][j];
    ans  %= mod;
  }
  cout << ans << endl;
}


Measured memory_bytes: 2048
#include<iostream>
#include<queue>
#include<algorithm>
#include<map>
#include<vector>
#include<list>
using namespace std;
const int INF=99999999;
vector<int>gd;
vector<int>ta;
bool m[310000]={0};
bool ok(int n){//nが月曜土曜素数かどうかを調べる。
	
}
void elatos(){
int sosu=6;

for(int x=0;x<=300000;x++){
ta.push_back(sosu);
m[sosu]=0;
int i=2;
while(i*sosu<=300000){
m[i*sosu]=0;
i++;
}
for(int k=sosu;k<=300000;k++){
if(m[k]){
sosu=k;
break;
}
}
}


}
int main(){
	for(int i=2;i<=300000;i++){
	if(i%7==1||i%7==6)gd.push_back(i);
	}
	fill(m,m+310000,false);
	for(int i=0;i<gd.size();i++){
	m[gd[i]]=true;
	}
	elatos();
	//for(int i=0;i<200;i++)cout<<ta[i]<<" ";cout<<endl;
	int n;
	fill(m,m+310000,false);
	for(int i=0;i<ta.size();i++)m[ta[i]]=1;
	while(true){
	cin>>n;
	if(n==1)break;
	vector<int>anss;
	for(int i=2;i<=n;i++){
	if(n%i==0&&m[i])anss.push_back(i);
	}
	cout<<n<<": ";
	for(int i=0;i<anss.size();i++){cout<<anss[i];if(i==anss.size()-1)cout<<endl;else cout<<" ";}
	}
	return 0;
}

Measured memory_bytes: 3672
#include<stdio.h>
#include<iostream>
#include<string.h>
#include<algorithm>
#include<queue>
#include<stack>
#include<math.h>
#include<map>
typedef long long int ll;
using namespace std;
#define maxn 0x3f3f3f3f
const int mm=1e6;
ll d[mm];
int main()
{
	ll n,m,i,j,k,kk,a,b,t,ss,z,p,kkk;
	string s;
	cin>>n;
	cin>>s;
	k=0;kk=0;kkk=0;
	for(i=0;i<n;i++)
	{
		if(s[i]=='R')
		k++;
		if(s[i]=='G')
		kk+=k;
		if(s[i]=='B')
		kkk+=kk;
	}k=0;kk=0;
	for(i=0;i<n;i++){if(s[i]=='R')k++;if(s[i]=='B')kk+=k;if(s[i]=='G')kkk+=kk;}k=0;kk=0;
	for(i=0;i<n;i++){if(s[i]=='B')k++;if(s[i]=='G')kk+=k;if(s[i]=='R')kkk+=kk;}k=0;kk=0;
	for(i=0;i<n;i++){if(s[i]=='B')k++;if(s[i]=='R')kk+=k;if(s[i]=='G')kkk+=kk;}k=0;kk=0;
	for(i=0;i<n;i++){if(s[i]=='G')k++;if(s[i]=='R')kk+=k;if(s[i]=='B')kkk+=kk;}k=0;kk=0;
	for(i=0;i<n;i++){if(s[i]=='G')k++;if(s[i]=='B')kk+=k;if(s[i]=='R')kkk+=kk;}k=0;kk=0;
	for(i=1;i<=2000;i++)
	for(j=0;j<n;j++)
	{
		if(j+2*i>=n)
		break;
		if(s[j]!=s[j+i]&&s[j]!=s[j+2*i]&&s[j+i]!=s[j+2*i])
		kkk--;
	}
	cout<<kkk<<endl;
 
}


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

int main(){
    using namespace std;
    constexpr unsigned long MOD = 1000000007;
    auto f = [&MOD](auto& a, auto k){(a.second += (a.first += a.second * k) %= MOD) %= MOD; return a.first;};
    unsigned long N;
    cin >> N;
    vector<pair<pair<unsigned long, unsigned long>, unsigned long>> tapi(1048576, {{1, 0}, 0});
    unsigned long ans{0}, t{500000004}, a{0}, z{0};
    for(unsigned long i = 1, A; i <= N; ++i){
        cin >> A;
        z += !(a ^= A);
        if(a){
            ans += f(tapi[a].first, z - tapi[a].second);
            tapi[a].second = z;
        }else (t *= 2) %= MOD;
    }
    cout << (a ? tapi[a].first.first : (ans + t) % MOD) << endl;
    return 0;
}

Measured memory_bytes: 24832
#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
using namespace std;
#define rep(i,n) for(ll i=0;i<(n);++i)
#define rrep(i,n) for(ll i=(n)-1;i>=0;--i)
#define rep1(i,n) for(ll i=1;i<=(n);++i)
#define rrep1(i,n) for(ll i=(n);i>=1;--i)
#define fr first
#define sc second
#define pb push_back
#define INF 0xfffffff
typedef long long ll;
typedef pair<ll,ll> P;
typedef double db;
struct edge{ll to,cap,rev; }; // ????????????????????????

vector<edge> G[100];
vector<edge> rG[100];
ll d[100];
ll a[100];
ll cnt=0;
void add_edge(ll from,ll to,ll cap){
	G[from].pb((edge){to, cap, rG[to].size() });
	rG[to].pb((edge){from, 0, G[from].size()-1} );
}

ll calc(ll t){
	ll res = 0;
	rep(i,rG[t].size()){
		res+=rG[t][i].cap;
	}
	return res;
}

ll max_flow(ll V,ll E,ll s,ll t){
	ll res=0;
	memset( d, 0, sizeof(d) );
	memset( a, 0, sizeof(a) );
	d[s] = V;
	a[s]=-1;
	a[t]=-1;
	rep(i,G[s].size()){
		if(G[s][i].to!=t){
			edge &e = G[s][i];
			a[e.to] += e.cap;
			rG[e.to][e.rev].cap = e.cap;
			e.cap = 0;
		}
		else{
			res+=G[s][i].cap;
		}
	}

	for(;;){
		ll v = -1;  //1
		rep(i,V){
			if( a[i]>0 ){
				v = i;
				break;
			}
		}
		if(v < 0) return res+calc(t);
		ll J=0; //2
		ll id;
		rep(i,G[v].size()){
			if( G[v][i].cap>0 && d[v] - d[G[v][i].to] == 1 ){
				id = i;
				J=1;
				break;
			}
		}
		if(!J) rep(i,rG[v].size()){
			if( rG[v][i].cap>0 && d[v] - d[rG[v][i].to] == 1 ){
				id = i;
				J=2;
				break;
			}
		}
	
		if(J){  //3
			edge &e = (J==1?G[v][id]:rG[v][id]);
			if(J==1){
				ll f = min(a[v], e.cap );
				a[v] -= f;
				e.cap -= f;
				rG[e.to][e.rev].cap += f;
				if(a[e.to]>=0) a[e.to] += f;
			}
			else{
				edge &efor = G[e.to][e.rev];
				ll f = min(a[v], e.cap);
				a[v] -= f;
				e.cap -= f;
				efor.cap += f;
				if(a[e.to]>=0) a[e.to] += f;
			}
		}

		else{  //4
			ll dmin=0xfffffff;
			rep(i,G[v].size()){
				if(G[v][i].cap>0) dmin = min(dmin,d[G[v][i].to]);
			}
			rep(i,rG[v].size()){
				if(rG[v][i].cap>0) dmin = min(dmin,d[rG[v][i].to]);
			}
			d[v] = dmin + 1;
		}
	}
}

ll V,E,A[1000],B[1000],C[1000];

void input(){
	scanf("%lld%lld",&V,&E);
	rep(i,E){
		scanf("%lld%lld%lld",&A[i],&B[i],&C[i]);
	}
}

int main()
{
	input();
	rep(i,V){
		G[i].clear(); rG[i].clear();
	}
	rep(i,E) add_edge(A[i], B[i], C[i]);
	cout<<max_flow(V,E,0,V-1)<<endl;
}

Measured memory_bytes: 3292
#include <iostream>
#include <cstdio>
#include <vector>
#include <iomanip>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
using namespace std;

int main() {
    int A;
    int B;
    int C;
    int K;
    int need = 0;

    cin >> A >> B >> C;
    cin >> K;

    while (B <= A) {
        B *= 2;
        ++need;
    }

    while (C <= B) {
        C *= 2;
        ++need;
    }

    cout << (need <= K ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 3608
#include<iostream>
#include<algorithm>

using namespace std;
static const int MAX = 200000;

int main()
{
	int R[MAX], n;

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

	int maxv = -2000000000;	//十分小さい値を初期値に設定
	int minv = R[0];

	for (int i = 1; i < n; i++)
	{
		maxv = max(maxv, R[i] - minv);
		minv = min(minv, R[i]);
	}

	cout << maxv << endl;

	return 0;
}


Measured memory_bytes: 3852