akhauriyash/Code-Regression huggingface dataset:
//  main.cpp
//  20191227lesson
//
//  Created by Priscilla Leang on 12/27/19.
//  Copyright  2019 Priscilla Leang. All rights reserved.
//

#include <iostream>
using namespace std;
int main(int argc, const char * argv[]) {
    //diverse strings
//    int a;
//    cin>> a;
//    string diverseStrings[a];
//    for (int i = 0; i< a; i++){
//        cin>> diverseStrings[i];
//    }
//    for (int n = 0; n< a; n++){
//
//        int m = 0;
//        string s = diverseStrings[n];
//        bool stringPass = true;
//
//        //change string into array of int
//        int charNum[s.length()];
//        for (int i = 0; i< s.length(); i++){
//            charNum[i] = (int)s[i];
//        }
//        //see if they are adjacent
//        //find smallest int
//        m = 123;
//        for (int i = 0; i< s.length(); i++){
//            if (charNum[i]<=m){
//                m = charNum[i];
//            }
//        }
//        //see if adjacent
//
//        for (int i = m; i< m+s.length(); i++){
//            //see if there is a match
//            bool pass = false;
//            for (int j = 0; j< s.length(); j++){
//                if (charNum[j] == i){
//                    pass = true;
//                    break;
//                }
//            }
//            if (pass == true){
//                continue;
//            }
//            else{
//                stringPass = false;
//            }
//        }
//        if (stringPass){
//            cout << "Yes"<< endl;
//        }
//        else{
//            cout<< "No"<< endl;
//        }
//    }
    //colorful transeivers
    bool pass = false;
    int a, b, c, d;
    int transceivers[3];
    cin>> a>>b>>c;
    cin>>d;
    //if dirrect
    int h = a-c;
    if (h<0){
        h*=-1;
    }
    if (h <=d){
        pass = true;
    }
    //if indirect;
     h = a - b;
    int g = b-c;
    if (h<0){
        h*=-1;
    }
    if (g<0){
        g*=-1;
    }
    if(h<=d && g<=d){
        pass = true;
    }
    if (pass){
        cout << "Yes";
    }
    else{
        cout << "No";
    }
    
    
    
    
    
    
    
    
    
    
    
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
// #define rep(i,n) for(int i=0;i<n;++i)
#define rep(i,i0,n) for(int i=i0;i<n;++i)
#define ALL(x) (x).begin(),(x).end()
#define pb(x)  push_back(x);
#define INF12 1000000000000 //10^12
#define INF9 1000000000 //10^9
#define MOD 1000000007 //10^9+7
using ll=long long;
using pii=pair<ll,ll>;
using vi=vector<int>;

int N,M;

int main() {
    cin >> N >> M;
    bool path[N+1][N+1];
    rep(i,0,N+1) rep(j,0,N+1) path[i][j] = false;
    rep(i,0,M) {
        int a, b;
        cin >> a >> b;
        path[a][b] = true;
        path[b][a] = true;
    } 

    vi nodes;
    rep(i,1,N+1) nodes.pb(i);
    int ans = 0;
    do {
        if(nodes.at(0) != 1) break;
        // for(auto v:nodes) cout << v;
        // cout << endl;
        bool visited[N+1];
        rep(i,0,N+1) visited[i] = false;
        bool ok = true;
        rep(i,0,N-1) {
            int src = nodes.at(i);
            int dst = nodes.at(i+1);
            if(!path[src][dst] || visited[dst]) {
                ok = false;
                break;
            }
            visited[src] = true;
        }
        if(ok) ans++;
    } while (next_permutation(ALL(nodes)));

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


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<cmath>
#define mod 998244853 
using namespace std;
int main()
{
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int a[3], x=1000;
	for(int i = 0; i < 3; i++)
	    cin >> a[i];
	for(int i = 0; i < 3; i++)
	    for(int j = i+1; j < 3; j++)
	        x=min(x, a[i]+a[j]);
	cout << x << '\n';
}


Measured memory_bytes: 256
import java.util.*
import kotlin.math.*

fun main(args: Array<String>) {
    val (a, b, c, d) = readLongList()

    val ans = max(max(a * c, a * d), max(b * c, b * d))
    println(ans)
}

// read
fun readString() = readLine()!!
fun readInt() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readStringList() = readLine()!!.split(" ")
fun readIntList() = readLine()!!.split(" ").map(String::toInt)
fun readLongList() = readLine()!!.split(" ").map(String::toLong)

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

const int MOD = 1e9+7 ;
long long n, arr[3009], X, Y;

long long mem[3009][3009][2];
long long solve( int i, int j, int turn ){
    if ( i > j ) return 0;
    long long& ret = mem[i][j][turn];
    if (~ret) return ret;
    if ( turn & 1 )
        return ret = max ( solve( i+1, j, !turn ) + arr[i] , solve( i, j-1, !turn ) + arr[j] );
    else
        return ret = min ( solve( i+1, j, !turn ) - arr[i] , solve( i, j-1, !turn ) - arr[j] );
}
int main(){
    memset( mem, -1, sizeof mem );
    scanf("%d", &n);
    for ( int i = 0 ; i < n ; ++i )
        scanf("%d", arr+i);
    printf("%lld\n", solve(0,n-1,1));
}


Measured memory_bytes: 141952
import sys

def main():
    input = sys.stdin.readline
    S = [str(c) for c in input().strip()]
    X, Y = map(int, input().split())
    move = []

    S.append('E')
    while len(S) > 0:
        f = 0
        while len(S) > 0 and S[0] == 'F':
            f += 1
            S.pop(0)
        move.append(f)
        S.pop(0)

    X -= move[0]
    move_x = []
    move_y = []
    for i in range(1, len(move)):
        if i % 2 == 0:
            move_x.append(move[i])
        else:
            move_y.append(move[i])

    move_x = sorted(move_x, key=lambda x: -x)
    move_y = sorted(move_y, key=lambda x: -x)
    
    for mv in move_x:
        if X > 0:
            X -= mv
        else:
            X += mv

    for my in move_y:
        if Y > 0:
            Y -= my
        else:
            Y += my

    if X == Y == 0:
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    main()


Measured memory_bytes: 3316
#include "bits/stdc++.h"
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;

typedef long long ll;

int main() {
    string S, T = "NWES";
    cin >> S;
    vector<int> d(4, 0);
    rep(i, S.size()) {
        rep(j, 4) {
            if (S[i] == T[j]) d[j]++;
        }
    }
    rep(i, 4) {
        if (d[i] == 0 && d[3 - i] > 0) {
            cout << "No\n";
            return 0;
        }
    }
    cout << "Yes\n";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
main(){
    string S,T;
    cin >> S >> T;
    vector<int> V[26];
    int used[26] = {};
    rep(i,0,S.size()){
        V[S[i] - 'a'].push_back(i);
        used[S[i] - 'a'] = 1;
    }
    rep(i,0,T.size()){
        if(used[T[i] - 'a'] == 0){
            cout << -1 << endl;
            return 0;
        }
    }
    ll sum = 0, idx = -1;
    rep(i,0,T.size()){
        char c = T[i] - 'a';
        auto itr1 = lower_bound(V[c].begin(), V[c].end(), idx + 1);
        auto itr2 = lower_bound(V[c].begin(), V[c].end(), 0);
        ll cost1 = INF, cost2 = INF;
        if(itr1 != V[c].end())cost1 = *itr1 - idx;
        cost2 = *itr2 + S.size() - idx;

        sum += min(cost1, cost2);
        if(cost1 <= cost2){
            idx = *itr1;
        }else{
            idx = *itr2;
        }
        //cout << cost1 << " " << cost2 << "," << idx <<  endl;
        //cout << S[*itr1] << " " << *itr1 << endl;
        //cout << S[*itr2] << " " << *itr2 << endl;
    }
    cout << sum << endl;
}

Measured memory_bytes: 1216
N=int(input())
A=[0,0]
A[0]=list(map(int,input().split()))
A[1]=list(map(int,input().split()))
count=[0]*N
for i in range(N) :
  count[i]+=sum(A[0][:i+1])+sum(A[1][i:])
print(max(count))

Measured memory_bytes: 9200
while True:
  m, f, r = map(int,input().split())
  if m == -1 and f == -1 and r == -1:
    break
  else:
    if m == -1 or f == -1:
      print('F')
    elif m + f >= 80:
      print('A')
    elif m + f >= 65:
      print('B')
    elif m + f >= 50:
      print('C')
    elif m + f >= 30 and r >= 50:
      print('C')
    elif m + f >= 30:
      print('D')
    else:
      print('F')
      





Measured memory_bytes: 5588
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <math.h>
#include <iomanip>
#include <bitset>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <utility>
#include <set>
using namespace std;
typedef long long int ll;
typedef long double ld;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
 
typedef pair<ll,ll> pairs;
vector<pairs> p;
bool pairCompare(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.first < secondElof.first;
}
#define MAX_N 1000100
bool x[MAX_N];
ll num[MAX_N];
ll fibl[MAX_N]={0};
 
ll fib(ll a){
    if (fibl[a]!=0)return fibl[a];
    if (a==0){
        return 0;
    }else if (a==1){
        return 1;
    }
    return fibl[a]=fib(a-1)+fib(a-2);
}
 
ll eratosthenes(ll n) {
    int p = 0;
    for (ll i=0; i<=n; ++i) x[i] = true;
    x[0] = x[1] = false;
    for(int i=2; i<=n; ++i) {
        if(x[i]) {
            p++;
            for(int j=2*i; j<=n; j+=i) x[j] = false;
        }
        
        num[i] = p;
    }
    return p;
}
 
ll gcd(ll a,ll b){
    if (a%b==0)return(b);
    else return(gcd(b,a%b));
}
 
ll keta(ll N){
    int tmp{};
    while( N > 0 ){
        tmp += ( N % 10 );
        N /= 10;
    }
    N = tmp;
    return N;
}

int main(){
    string s;
    cin >> s;
    if (s.size()%2!=0){
        cout << "No" << endl;
        return 0;
    }
    for (ll i=0;i<s.size();i++){
        if (i%2==0){
            if (s[i]!='h'){
                cout << "No" << endl;
                return 0;
            }
        }else{
            if (s[i]!='i'){
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(i,n) for(int i=0;i<n;i++)
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s;
    cin>>s;
    int cnt=0;
    int n=s.length();
    for(int i=0;i<n/2;i++)
    {
        if(s[i]!=s[n-i-1])
            cnt++;
    }
    cout<<cnt;
}


Measured memory_bytes: 3648
using System;

namespace _8_A
{
    class Program
    {
        static void Main(string[] args)
        {
            var s = Console.ReadLine();
            var cs = s.ToCharArray();
            for(var i=0;i<s.Length;i++)
            {
                if(char.IsUpper(cs[i]))
                {
                    cs[i] = char.ToLower(cs[i]);
                }
                else
                {
                    cs[i] = char.ToUpper(cs[i]);
                }
            }
            var s2 = new String(cs);
            Console.WriteLine(s2);
        }
    }
}



Measured memory_bytes: 17900
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define pb push_back
#define fr first
#define sc second
#define Rep(i,n) for(int i=0;i<(n);i++)
#define Rrep(i, m, n) for(int i=(m);i<(n);i++)
#define All(v) v.begin(),v.end()
#define Uniq(v) v.erase(unique(All(v)),v.end())
typedef pair<ll, ll> Pii;
typedef pair<ll, Pii> Pip;
typedef pair<string, int> Psi;
typedef vector<int> Vi;
const int INF = (1<<30);
const int dx[]={1,0,-1,0}, dy[]={0,-1,0,1};

const int MAX_N = 2000001;

ll n, d;
ll datx1[2 * MAX_N - 1];
ll datx2[2 * MAX_N - 1];
ll daty1[2 * MAX_N - 1];
ll daty2[2 * MAX_N - 1];

void init(ll n_, ll dat[]) {
  n = 1;
  while( n < n_ ) n *= 2;
  for(int i=0; i<2*n-1; i++) dat[i] = INT_MAX;
}

void update(ll k, ll a, ll dat[]) {
  k += n - 1;
  dat[k] = a;
  while( k > 0 ) {
    k = (k - 1) / 2;
    dat[k] = min(dat[k * 2 + 1], dat[k * 2 + 2]);
  }
}

int query(ll a, ll b, ll k, ll l, ll r, ll dat[]) {
  if( r <= a || b <= l ) return INT_MAX;
  if( a <= l && r <= b ) return dat[k];
  else {
    ll vl = query(a, b, k * 2 + 1, l, (l + r) / 2, dat);
    ll vr = query(a, b, k * 2 + 2, (l + r) / 2, r, dat);
    return min(vl, vr);
  }
}

int main()
{
  cin >> n >> d;
  ll N = n;
  init(N+1, datx1);init(N+1, datx2);init(N+1, daty1);init(N+1, daty2);
  vector<ll> bData;
  vector<Pip> allData;
  for(int i=0; i<N; i++) {
    ll a, b, c;
    cin >> a >> b >> c;
    bData.pb( c );
    allData.pb( Pip(c, Pii(a, b)) );
  }

  sort( All(allData) );

  for(int i=0; i<N; i++) {
    ll x = allData[i].sc.fr, y = allData[i].sc.sc;
    update(i, x, datx1);
    update(i, -x, datx2);
    update(i, y, daty1);
    update(i, -y, daty2);
  }

  ll s, t; s = t = 0;
  ll ma = 0;
  for(int i=1; i<N-1; i++) {
    t = i;
    while( 1 ) {
      if( allData[t].fr - allData[s].fr <= d ) break;
      s++;
    }
    ll x1 = query(s, t+1, 0, 0, n, datx1);
    ll x2 = query(s, t+1, 0, 0, n, datx2);
    ll y1 = query(s, t+1, 0, 0, n, daty1);
    ll y2 = query(s, t+1, 0, 0, n, daty2);

    ll tmp = ((-x2) - x1) * ((-y2) - y1);
    if( tmp > ma ) {
      ma = tmp;
    }
  }

  cout << ma << endl;
}

Measured memory_bytes: 34932
#include<iostream>
#include<limits>
#include<string>
#include<vector>
using namespace std;
int main()
{
	int num;
	cin >> num;

	vector<int> list;
	int retMax[2] = { 0, 0 };
	for (int idx = 0; idx < num; ++idx)
	{
		int ret;
		cin >> ret;
		list.push_back(ret);
		for (int idx2 = 0; idx2 < 2; ++idx2)
		{
			if (retMax[idx2] < ret)
			{
				retMax[idx2] = ret;
				break;
			}
		}
	}

	for (int idx = 0; idx < num; ++idx)
	{
		int ret = retMax[0];
		if (list[idx] == ret) 
		{
			ret = retMax[1];
		}
		cout << ret << endl;
	}
}


Measured memory_bytes: 2548
#include<stdio.h>

int main(void){

int name[5];
  int k;
  int i;
  
  for(i=0;i<5;i++){
  	scanf("%d", &name[i]);
  }
  scanf("%d", &k);
int ans[12];
  
  ans[0] = name[1] - name[0];
  ans[1] = name[2] - name[0];
  ans[2] = name[3] - name[0];
  ans[3] = name[4] - name[0];
  ans[4] = name[2] - name[1];
  ans[5] = name[3] - name[1];
  ans[6] = name[4] - name[1];
  ans[7] = name[3] - name[2];
  ans[8] = name[4] - name[2];
  ans[9] = name[4] - name[3];
  int t =0;
for(t-0;t<10;t++){
  if(ans[t] > k){
	printf(":(");
    return 0;
  }
}
printf("Yay!");
return 0;

}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
constexpr int INF = numeric_limits<int>::max()/2;
constexpr long long LINF = numeric_limits<long long>::max()/3;
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define sz(x) (int)(x).size()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
//struct fin{ fin(){ cin.tie(0); ios::sync_with_stdio(false); } } fin_;
struct Double{ double d; explicit Double(double x) : d(x){} };
ostream& operator<<(ostream& os,const Double x){ os << fixed << setprecision(20) << x.d; return os; }
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os, const map<T,U>& mp){ os << "{"; for(auto& p : mp){ os << p << ","; } os << "}"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os,const pair<T,U>& p){ os << "(" << p.first << ","<< p.second <<")"; return os; }
template<typename T> ostream& operator<<(ostream& os,const set<T>& st){ os<<"{"; for(T v:st) os<<v<<","; os <<"}"; return os; }
template<typename T,typename U> inline void chmax(T &x,U y){ if(y>x) x = y; }
template<typename T,typename U> inline void chmin(T &x,U y){ if(y<x) x = y; }
using ll = long long;
using ull = unsigned long long;
using pii = std::pair<int,int>;
using vi = std::vector<int>;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }
//constexpr double eps = 1e-14; 
constexpr double eps = 1e-10; 
constexpr ll mod = 1e9+7;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/
string N;
int K;

ll dp[128][4][2];

int main(){
    cin >> N;
    cin >> K;
    int n = N.size();


    dp[0][0][0] = 1;
    for(int i=0;i<n;i++){
        for(int j=0;j<=K;j++){
            for(int k=0;k<2;k++){
                int U = 9;
                if(k==0) U = N[i]-'0';
                for(int d=0;d<=U;d++){
                    int nxtc = j + (d != 0);
                    if(nxtc > K) continue;
//                    cout << "(" << i << "," << j << "," << k << ") & " << d << " " << dp[i][j][k]  << " --> " << "(" << i+1 << "," << nxtc << "," << (k || d < U) << ")" << endl;
                    dp[i+1][nxtc][k || d < U] += dp[i][j][k];
                }
            }
        }
    }

    /* for(int i=0;i<=n;i++){ */
    /*     cout << "i = " << i << endl; */
    /*     for(int j=0;j<=K;j++){ */
    /*         for(int k=0;k<2;k++){ */
    /*             cout << dp[i][j][k] << " "; */
    /*         } */
    /*         cout << endl; */
    /*     } */
    /* } */

    cout << dp[n][K][0] + dp[n][K][1] << endl;
}


Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

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

fn main(){
    let n = read();
    println!(
        "{}",
        (0..n)
        .map(|_| read::<u32>().trailing_zeros())
        .min()
        .unwrap()
    );
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define int long long
#define INT_MAX INT64_MAX
#define INT_MIN INT64_MIN
#define CLK clock_t clk = clock();//Start of main
#define OCLK cerr << "Time (in ms): " << (double)(clock() - clk) * 1000.0 / CLOCKS_PER_SEC << '\n';//End of main
#define MOD 1000000007
/* DEFINE cout */
#define pln cout << "===============================\n"
#define on cout<<"\n"
#define os cout<<" "
#define o2(a,b) cout<<a<<" "<<b
#define o(a) cout << a
#define bitcount __builtin_popcount
/* DEFINE cout */
#define endl "\n"
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);//fastio
using namespace std;
struct hash_pair { // use pair as key in unordered_map<pair<int,int>,int,hash_pair>;
    template <class T1, class T2>
    size_t operator()(const pair<T1, T2>& p) const
    {
        auto hash1 = hash<T1>{}(p.first);
        auto hash2 = hash<T2>{}(p.second);
        return hash1 ^ hash2;
    }
};
bool prime[10000001];
int P=MOD-2;
int factorial[10000001]={0};
int powerFunction(int x,int y){
    int res = 1;
    int p = MOD;
    x = x % p;
    while (y > 0){
        if (y & 1)
            res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}
void sieveFunction(int maxLimit){
    memset(prime, true, sizeof(prime));
    prime[0] = prime[1]=false;
    for(int i=2; maxLimit >= i ; i++){
        if(prime[i]){
            for(int j=2*i ; maxLimit >= j ; j+=i)
                prime[j]=false;
        }
    }
}
void factorialFunction(int maxLimit){
    factorial[0]=1;
    for(int i=1 ; i <= maxLimit ; i++)
        factorial[i]=(factorial[i-1]*i)%MOD;
    return;
}
int gcd(int a, int b){
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
signed main(){
    int n;
    cin >> n;
    int arr[n+1];
    memset(arr, 0, sizeof(arr));
    for(int i=0; n-1>i; i++){
        int temp;
        cin >> temp;
        arr[temp]++;
    }
    for(int i=1; n>=i; i++){
        cout << arr[i] << endl;
    }
}






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

int main(){
    int n,x[100],y[100],h[100],X,Y,x1=0,y1=0,h1=0;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>x[i]>>y[i]>>h[i];
        if(h1==0&&h[i]!=-0){
            x1=x[i]; y1=y[i]; h1=h[i];
        }
    }
    for(X=0;X<=100;X++){
        for(Y=0;Y<=100;Y++){
            int H=h1+abs(x1-X)+abs(y1-Y);
            for(int i=0;i<n;i++){
                if(max(H-abs(x[i]-X)-abs(y[i]-Y),0)!=h[i]){
                    break;
                }
                if(i==n-1){
                    cout<<X<<" "<<Y<<" "<<H<<endl;
                    return 0;
                }
            }
        }
    }
    return 0;
}

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

using namespace std;
#define sf(n) scanf("%d", &n)
#define pd(n) printf("%.12lf", n)
#define pf(n) printf("%d", n)
#define p() printf("\n")
#define ps() printf(" ")
#define ll long long
#define ull unsigned long long
#define MAX 1e9
#define mod 1000 * 1000 * 1000 + 7
#define pi 3.1415926536
#define ex 1e18
#define dbl 2e09
#define qu(q) queue<int> q
#define pqu(q) priority_queue<int> q
#define len(s) s.length()
#define sz(x) int(x.size())
#define pb(x) push_back(x)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define fir first
#define sec second

const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;

int main()
{
    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    s[k-1]=s[k-1]+32;
    cout<<s<<endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
    string S;
    cin >> S;
    for(int i = 1; i <= 3; i++){
        if(S[i] == S[i-1]){
            cout << "Bad" << endl;
            return 0;
        }
    }
    cout << "Good" << endl;
}

Measured memory_bytes: 764
/*又是一道神仙题。。

我开始的思路是枚举空位，但是还是不能做，GG

标算过于神仙，其中一些细节我也理解不了

题目给出的实际是一个首项为$d$，公差为$x$的等差数列

$sum = 2dn + \frac{2n(2n - 1)x}{2}$

此时的期望为$\frac{sum}{2n}$

考虑修改之后会有那些值发生改变

$d' = \frac{(2n - 2)d + d + 2x + 3d + 3x)}{2n}$(考虑第一个位置怎么变)

$sum' = \frac{d + (d + x) + (2n - 2)x + d + (2n - 1) x + d}{2n}$

$x' = \frac{sum -2nd}{n(2n - 1)}$

不断推下去即可
*/
#include<bits/stdc++.h>
using namespace std;
long double N, d1, x, ans;
int main() {
	cin >> N >> d1 >> x;
	for(int i = N; i >= 1; i--) {
		long double s = d1 * 2 * N + N * (2 * N - 1) * x;
		ans += s / 2 / N;
		s = s - (4 * d1 + 4 * N * x - 2 * x)  / 2 / N;
		d1 = ((2 * N - 2) * d1 + d1 + 2 * x + 3 * d1 + 3 * x) / 2 / N;
		N--;
		x = (s - 2 * N * d1) / N / (2 * N - 1);
	//	if(i > 990) printf("%.10lf\n", (double)x);
	}
	printf("%.15lf", (double)ans);
	return 0;
}
/*
1
2 21
*/


Measured memory_bytes: 256
#include <iostream>
#include <cctype>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <string>
#include <functional>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iomanip>
#include <bitset>
#define pb push_back
#define YES cout<<"YES"<<endl
#define Yes cout<<"Yes"<<endl
#define NO cout<<"NO"<<endl
#define No cout<<"No"<<endl
#define INF (1<<10)
#define MOD 1000000007
typedef long long ll;
using namespace std;

int main(){
  int a,b;
  cin>>a>>b;
  int amin=ceil(a/0.08);
  int amax=ceil((a+1)/0.08)-1;
  int bmin=ceil(b/0.1);
  int bmax=ceil((b+1)/0.1)-1;
  int ans=0;
  for(int i=amin;i<=amax;i++){
    for(int j=bmin;j<=bmax;j++){
      if(i==j){
        ans=i;
      }
    }
    if(ans)break;
  }
  if(ans)cout<<ans;
  else cout<<"-1";
  return 0;
}


Measured memory_bytes: 256
import scala.io.StdIn.readInt

object Main {

  def main(args:Array[String]) = {
    val n = readInt
    var a = 1;var b = 0
    for(i<-0 until n) {
      val c = a
      a = a+b
      b = c
    }
    println(a)
  }
}

Measured memory_bytes: 43676
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define x first
#define y second
typedef pair<int, int> pii;
typedef long long ll;
const int MOD = 1000000007;
const int N = 1e6 + 10;

int n;

void No() {
  puts("No");
  exit(0);
}
vector<pii> E;
void print() {
  puts("Yes");
  for (int i = 0; i < E.size(); ++i) {
    printf("%d %d\n", E[i].x, E[i].y);
  }
  exit(0);
}
long computeXOR(const int n) {
  switch (n & 3)
  {
  case 0: return n;
  case 1: return 1;
  case 2: return n + 1;
  case 3: return 0;
  }
}
int main() {
  cin >> n;
  E.clear();
  for (int i = 0 ; i <= 20; ++i) {
    if (n == (1 << i)) {
      No();
    }
  }
  int mx = ((n / 4) - 1) * 4 + 3;
  if (n % 4 == 3)mx = n;
  if (n % 4 == 0)mx = n - 1;
  for (int i = 1 ; i + 1 <= mx; ++i)E.push_back(make_pair(i, i + 1));
  E.push_back(make_pair(mx, n + 1));
  for (int i = 1 + n; i + 1 <= n + mx; ++i)E.push_back(make_pair(i, i + 1));
  if (n % 4 == 1) {
    E.push_back(make_pair(mx + 1, mx + 2));
    E.push_back(make_pair(mx + 2, 1));
    E.push_back(make_pair(1, mx + 1 + n));
    E.push_back(make_pair(mx + 1 + n, mx + 2 + n));
  }
  if (n % 4 == 2) {
    E.push_back(make_pair(mx + 1, mx + 3));
    E.push_back(make_pair(mx + 1, mx + 2));
    E.push_back(make_pair(mx + 1, 2));
    E.push_back(make_pair(2, mx + 3 + n));
    E.push_back(make_pair(mx + 3 + n, mx + 1 + n));
    E.push_back(make_pair(3, mx + 2 + n));
  }
  if (n % 4 == 0) {
    E.push_back(make_pair(mx - 1, mx + 1 + n));
    bool f = false;
    for (int i = 1 ; i < n; ++i) {
      if (i + 1 == 2 * n || i + 1 == n)continue;
      if (computeXOR(i) == (computeXOR(mx - 1) ^ (mx + 1))) {
        E.push_back(make_pair(i + 1, mx + 1));
        f = true;
        break;
      }
    }
  }
  print();

  return 0;
}

Measured memory_bytes: 4592
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;
typedef long long ll;
const ll inf = 1e18;
const int N = 15;
int a[N];
ll ans;
int n,m,book[N][N],x;

int main(){
	scanf("%d%d%d",&n,&m,&x);
	for(int i = 1;i <= n;i++){
		for(int j = 0;j <= m;j++){
			scanf("%d",&book[i][j]);
		}
	}
	ans = inf;
	for(int i = 1;i < (1<<n);i++){
		memset(a,0,sizeof(a));
		int state = i;
		ll tmp = 0;
		for(int j = 0;j < n;j++){
			if((state>>j)&1){
				for(int k = 1;k <= m;k++){
					a[k] += book[j+1][k];
				}
				tmp += book[j+1][0];
			}
		}
		bool f = 1;
		for(int j = 1;j <= m;j++){
			if(a[j] < x) {f = 0;break;}
		}
		if(f) ans = min(ans,tmp);
	}
	if(ans == inf) puts("-1");
	else printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 1728
#include <cstdio>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
using namespace std;
typedef long long ll;
queue<int> q;
const ll inf=1ll<<60;
const int N=400010,mod=(int)1e9+7;
int eg[N][3];
int e[N],nex[N],head[N],c[N],ed=0;
ll d1[N],d2[N];
int ind[N],inq[N],f[N],g[N];
int n,m;
void upd(int &x,int y){x=(x+y)%mod;}
void adde(int x,int y,int z){e[++ed]=y;nex[ed]=head[x];head[x]=ed;c[ed]=z;}
void spfa(int S,int T,ll *d,int *f){
    int i,t,x,y,z;
    for(i=1;i<=n;i++) d[i]=inf,ind[i]=0;
    d[S]=0;q.push(S);inq[S]=1;
    while(!q.empty()){
        t=q.front();q.pop();inq[t]=0;
        for(i=head[t];i;i=nex[i]){
            if(d[e[i]]>d[t]+c[i]){
                d[e[i]]=d[t]+c[i];
                if(!inq[e[i]]) inq[e[i]]=1,q.push(e[i]);
            }
        }
    }
    for(i=1;i<=m;i++){
    	x=eg[i][0];y=eg[i][1];z=eg[i][2];
    	if(d[x]+z==d[y]) ind[y]++;
    }
    q.push(S);f[S]=1;
    while(!q.empty()){
        t=q.front();q.pop();
        for(i=head[t];i;i=nex[i])
            if(d[e[i]]==d[t]+c[i]){
                upd(f[e[i]],f[t]);
                if(--ind[e[i]]==0) q.push(e[i]);
            }
    }
}
int main(){
    int i,x,y,z,S,T,t,ans;
    scanf("%d %d %d %d",&n,&m,&S,&T);
    for(i=1;i<=m;i++){
        scanf("%d %d %d",&x,&y,&z);
        eg[i][0]=x,eg[i][1]=y,eg[i][2]=z;
        eg[i+m][0]=y,eg[i+m][1]=x,eg[i+m][2]=z;
        adde(x,y,z);adde(y,x,z);
    }
    m*=2;
    spfa(S,T,d1,f);
    spfa(T,S,d2,g);
    ans=(ll)f[T]*f[T]%mod;
    for(i=1;i<=m;i++){
        x=eg[i][0];y=eg[i][1];z=eg[i][2];
        if(d1[x]*2<d1[T]&&d1[y]*2>d1[T]&&d1[x]+d2[y]+z==d1[T])
            ans=((ans-(ll)f[x]*f[x]%mod*g[y]%mod*g[y]%mod)%mod+mod)%mod;
    }
    for(i=1;i<=n;i++)
        if(d1[i]*2==d1[T]&&d2[i]*2==d1[T]) ans=((ans-(ll)f[i]*f[i]%mod*g[i]%mod*g[i]%mod)%mod+mod)%mod;
    printf("%d",ans);
    return 0;
}


Measured memory_bytes: 20812
#include <bits/stdc++.h>
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); i++) 
#define FOR(i, a, b) for(int (i) = a; (i) < (int)b; i++)
#define RREP(i, n) for(int (i)=((int)(n)-1); (i)>=0; i--)
#define RFOR(i, a, b) for(int (i) =((int)(b)-1); (i)>=(int)a; i--)
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
#define FI first
#define SC second
#define MP make_pair
#define PB push_back
#define SZ(x)  (int)x.size()
#define SP(x)  setprecision((int)x)


using namespace std ;
typedef long long ll;
typedef vector<int> vint;
typedef vector<vint> vvint;
typedef vector<string> vstr;
typedef pair<int, int> pii;
const int INF = 1e9;
const ll LINF = 1e18;
const double EPS = 1e-9;
ll gcd(ll a, ll b) {return b ? gcd(b, a % b) : a;}
ll lcm(ll a, ll b) {return a / gcd(a, b) * b;}


int main()
{
  int n ;
  cin >> n ;
  vector<int> vec(n) ;
  vint vecvec(n) ;
  REP(i,n){
    cin >> vec.at(i) ;
    vecvec.at(i) = vec.at(i) ;
  }
  
  sort(ALL(vec)) ;
  
  int a = vec.at(n/2-1) ;
  int b = vec.at(n/2) ;
  
  REP(i,n){
    if(vecvec.at(i)>=b){
      cout << a <<endl ;
    }
    else{
      cout << b <<endl ;
    }
  }

  return 0 ;
}






Measured memory_bytes: 3712
#include<bits/stdc++.h>
using namespace std;
int main(){
int i,a,b,d=0;
string s,n;
cin>>s>>n;
a=s.size();
b=n.size();
for(i=0;i<=a;i++){
    if(s[i]==n[i])
        d++;

}
   if(d==a)
    cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
return 0;}


Measured memory_bytes: 3624
#include <iostream>
#include <math.h>
#include <string>
#include <algorithm>
#include <ctype.h>
#include <vector>
using namespace std;

#define ll long long int

int main()
{
    int a[3];
    cin >> a[0] >> a[1] >> a[2];
    sort(a, a + 3);
    cout << a[0] + a[1] + 10 * a[2] << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define vi vector<int>
#define pii pair<int,int>
#define mem(a,b) memset(a,b,sizeof a)
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define all(a) (a).begin(),(a).end()
const ll mod=998244353;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
int main(){
    fast;
    int x,n;
    cin>>x>>n;
    int a[n];
    map<int,int> freq;
    for(int i=0;i<n;i++){
        cin>>a[i];
        freq[a[i]]++;
    }
    int mn=0;
    for(int i=0;i<=x;i++){
        if(freq[i]==0) mn=max(mn,i);
    }
    int mx=0;
    for(int i=x+1;i<=101;i++){
        if(freq[i]==0){
            mx=i;
            break;
        }
    }
    if(abs(x-mn)<=abs(x-mx)) cout<<mn;
    else cout<<mx;
}

Measured memory_bytes: 3624
using System;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var v = Console.ReadLine().Split(' ');
            var c = Console.ReadLine().Split(' ');

            var ans = 0;

            for (int i = 0; i < n; i++)
            {
                if (int.Parse(v[i]) > int.Parse(c[i]))
                {
                    ans += int.Parse(v[i]) - int.Parse(c[i]);
                }
            }
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 11092
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String s = sc.next();
		int ans = 0;
		for(int i = 1 ; i < n ; i++) {
			String x = s.substring(0, i);
			String y = s.substring(i);
			int nn = 0;
			Set<Character> set1 = new HashSet<>();
			Set<Character> set2 = new HashSet<>();
			for(int j = 0 ; j < x.length(); j++) {
				set1.add(x.charAt(j));
			}
			for(int j = 0 ; j < y.length() ; j++) {
				set2.add(y.charAt(j));
			}
			for(char key : set1) {
				for(char key1 : set2) {
					if(key == key1) {
						nn++;
						break;
					}
				}
			}
			ans = Math.max(ans, nn);
		}
		System.out.println(ans);
	}
}


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

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

#define pb push_back
#define mp make_pair

const int N = 1e5 + 10;

int n, m, q, a[N], b[N];
int x, y, z;

int main(){
    scanf("%d %d %d", &n, &m, &q);
    int A = N, B = N;
    for(int i=1; i<=n; i++){
        scanf("%d", a+i);
        A = min(A, a[i]);
    }
    for(int i=1; i<=m; i++){
        scanf("%d", b+i);
        B = min(B, b[i]);
    }
    int ans = A + B;
    while(q--){
        scanf("%d %d %d", &x, &y, &z);
        ans = min(ans, a[x] + b[y] - z);
    }
    printf("%d\n", ans);
    return 0;
}


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

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back

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

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;

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

int main(){
	int n,m;
	cin>>n>>m;
	vector<pii> p;
	for (int i = 0; i < m; i++){
		int a,b;
		cin>>a>>b;
		p.pb(pii(b,a));
	}

	sort(all(p));

	int ans=1;
	int x=p[0].first-1;
	for (int i = 1; i < m; i++){
		if(p[i].second<=x)continue;
		ans++;
		x=p[i].first-1;
	}

	cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 1400
#include <bits/stdc++.h>
using namespace std;
#define pi acos(-1)
#define IOS ios_base::sync_with_stdio(0); cin.tie(); cout.tie();
#define ff first
#define ss second
#define pf push_front
#define pb push_back
#define eb emplace_back
#define debug(val) cerr << "The Value Of " << #val << " is : " << val << '\n';
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
const ll mod = 1e9 + 7;
const ll inf = 0x3f3f3f3f;
const ll mininf = -922337203685477;
const ll nax = 1e5+5;
ll n, k;
unordered_map<ll, ll>cnt;	
	
int main(void){
	IOS
	cin >> n >> k;
	for(int i=1;i<=n;i++){
		ll a, b;
		cin >> a >> b;
		cnt[a]+=b;
	}
	for(int i=1;i<=nax;i++){
		if(cnt[i]>=k){
			cout << i << '\n';
			return 0;
		}
		k-=cnt[i];
	}
}


Measured memory_bytes: 7280
N,M=map(int,input().split())
b=[]
s=[0]*M
for i in range(N):
    a=list(map(int,input().split()))
    del a[0]
    a.sort()
    b.append(a)
for i in range(N):
    for j in range(len(b[i])):
        s[b[i][j]-1]+=1
print(s.count(N))

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

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

    vector<int> vec(n+1, 0);
    for(int i=1; i<=n; ++i) {
        cin >> vec[i];
    }

    int min_sum = 1e9;
    for(int i=1; i<=100; ++i) {
        int vec_sum = 0;
        for(int j=1; j<=n; ++j) {
            vec_sum += (abs(vec[j] - i) * abs(vec[j] - i));
        }
        if (vec_sum < min_sum) min_sum = vec_sum;
    }

    cout << min_sum << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  int N, M, X;
  cin>>N>>M>>X;
  map<int, int> amap;
  int tmp;
  for(int i=0;i<M;++i) {
    cin>>tmp;
    amap[tmp]++;
  }
  int ans1 = 0;
  for(int i=X+1;i<=N;++i) {
    ans1 += amap[i];
  }
  int ans2 = 0;
  for(int i=X-1;i>=0;--i) {
    ans2 += amap[i];
  }
  cout<<min(ans1, ans2)<<endl;
}



Measured memory_bytes: 3628
/*

                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                    prayer
*/

// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) rep(_,v.size())cout<<" "<<v[_];cout<<endl;
#define show2d(v) rep(__,v.size()){rep(_,v[__].size())cout<<" "<<v[__][_];cout<<endl;}
using namespace std;
//kaewasuretyuui
typedef long long ll;
#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
// #define mt make_tuple
// typedef tuple<int,int,int> tp;
// typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
signed main(){
	int in[2],k;
	cin>>in[0]>>in[1]>>k;
	rep(i,k){
		int t=i%2;
		in[t]-=in[t]%2;
		in[t^1]+=in[t]/2;
		in[t]/=2;
	}
	cout<<in[0]<<" "<<in[1]<<endl;
}















Measured memory_bytes: 256
fun main(args: Array<String>) {
    val (X, Y, Z, K) = listOfInt()
    val A = listOfLong().sortedDescending()
    val B = listOfLong().sortedDescending()
    val C = listOfLong().sortedDescending()
    val D = mutableListOf<Long>()
    for (x in 0 until X) {
        for (y in 0 until Y) {
            if ((x + 1) * (y + 1) > K) break
            for (z in 0 until Z) {
                if ((x + 1) * (y + 1) * (z + 1) > K) break
                D.add(A[x] + B[y] + C[z])
            }
        }
    }
    val ans = D.sortedDescending()
    for (k in 0 until K) println(ans[k])
}
fun next() = readLine()!!
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map(String::toInt)
fun listOfLong() = listOfString().map(String::toLong)

Measured memory_bytes: 44100
#if 0

#endif

#include <bits/stdc++.h>
#define REP(i, n) for(int i=0;i<int(n);++i)
using namespace std;
template<class A>void p(A a){cout << (a) << endl;}
template<class A,class B>void p(A a,B b){cout << a << " "  ;p(b);}
template<class A,class B,class C>void p(A a,B b,C c){cout << a << " " ;p(b,c);}
template<class A,class B,class C,class D>void p(A a,B b,C c,D d){cout << a << " " ;p(b,c,d);}
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
int INF=numeric_limits<int>::max();
// for copy
// for(int i=0;i<N;++i) {

int main(void) {
  int a1,a2,a3;cin>>a1>>a2>>a3;
  if(a1+a2+a3>=22) p("bust");
  else p("win");
  return 0;
}


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

void sepTwoNumbers(char*, int&, int&);
int char2Number(const char*, int, int);

bool inputNumber(char*);

int main(){
	double const PI = 3.141592653589793;
	double point[2] = { 0, 0 };
	int angle = 90;
	int d, a;
	char inputNumbers[10];
	while (inputNumber(inputNumbers)){
		sepTwoNumbers(inputNumbers, d, a);
		
		point[0] += d * std::cos(PI * angle / 180);
		point[1] += d * std::sin(PI * angle / 180);
		angle -= a;
	}
	std::cout << static_cast<int>(point[0]) << std::endl;
	std::cout << static_cast<int>(point[1]) << std::endl;
	return 0;
}

//入力文字から2つの文字を分離させる関数
void sepTwoNumbers(char* charOftwoNumber, int& number1, int& number2){
	int commaIndex;
	int endIndex;

	for (commaIndex = 0; charOftwoNumber[commaIndex] != ','; ++commaIndex);

	number1 = char2Number(charOftwoNumber, 0, commaIndex);

	for (endIndex = commaIndex; charOftwoNumber[endIndex] != '\0'; ++endIndex);

	number2 = char2Number(charOftwoNumber, commaIndex + 1, endIndex);
}

//文字列を数字に変換する関数
int char2Number(const char* charNumber, int startDigit, int endDigit){
	int number = 0;
	int sd = 1;
	if (charNumber[startDigit] == '-'){
		sd = -1;
		++startDigit;
	}
	for (int i = startDigit; i < endDigit; ++i){
		number *= 10;
		number += charNumber[i] - '0';
	}
	return number * sd;
}

bool inputNumber(char* inputNumbers){
	std::cin >> inputNumbers;
	if (inputNumbers[0] == '0' && inputNumbers[2] == '0'){
		return false;
	}
	else{
		return true;
	}
}


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

int main(){
    int n,k;
    cin >> n >> k;
    
    vv connect(n);
    int a,b;
    rep(i,n-1){
        cin >> a >> b;
        a--;b--;
        connect[a].push_back(b);
        connect[b].push_back(a);
    }
    
    v reach(n,0);
    
    ll ans = 1;
    
    queue<int> q;
    q.push(0);
    reach[0] = 1;
    ans *= k;
    
    int ane=0;
    for(auto d: connect[q.front()]){
        if(reach[d])continue;
        reach[d] = 1;
        q.push(d);
        ans *= k - ane - 1;
        ans %= MOD;
        ane++;
    }
    q.pop();
    
    while(!q.empty()){
        int now = q.front();
        ane=0;
        for(auto d: connect[now]){
            if(reach[d])continue;
            reach[d] = 1;
            q.push(d);
            ans *= k - ane - 2;
            ans %= MOD;
            ane++;
        }
        q.pop();
    }
    cout << ans << endl;
    
    return 0;
}

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

int main() {
  int N, l, r, sum, aida; // N組、l席からｒ席までの変数,合計
  sum = 0; aida = 0;
  cin >> N;
  
  for(int i = 0;N > i;i++ ) {
  cin >> l >> r;
  
  sum = r - l;
  aida += sum;
  
  }
  cout << aida + N << endl;
}

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

const int N = 1e5 + 10;

int p[N], rec[N];

int find(int x){
	if (p[x] == x) return x;
	int fa = find(p[x]);
	rec[x] += rec[p[x]];
	return p[x] = fa;
}

bool same(int x, int y){
	return find(x) == find(y);
}

void unite(int x, int y, int val){
	int fx = find(x), fy = find(y);
	p[fx] = fy;
	rec[fx] = rec[y] - rec[x] + val;
}

int main(){
	int n, m, x, y, d;
	scanf("%d %d",&n,&m);
	for (int i = 1; i <= n; i++){
		p[i] = i;
		rec[i] = 0;
	}
	for (int i = 1; i <= m; i++){
		scanf("%d %d %d",&x,&y,&d);
		if (same(x, y)){
			if (rec[x] - rec[y] != d){
				printf("No\n");
				return 0;
			}
		}
		else unite(x, y, d);
	}
	printf("Yes\n");
	return 0;
}

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

using namespace std;

int main()
{
   /*string s;
    cin>>s;
    cout <<s[0]<<s[1]<<s[2] << endl;*/
    long long A,B,V,W,T;
    cin>>A>>V>>B>>W>>T;
    if(abs(B-A)<=(V-W)*T)
        cout<<"YES"<<endl;
    else
        cout<<"NO"<<endl;
    return 0;
}


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

#define rep(i, n) for(int i = 0; i<(n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
using ll = long long;


int main() {
    ll N;
    cin >> N;
    string ans = "";

    while (N != 0) {
        N--;
        ans += N % 26 + 'a';
        N /= 26;
    }
    reverse(ans.begin(), ans.end());
    cout << ans << endl;
}


Measured memory_bytes: 3556
let rv f p q = f q p;;
Scanf.(Array.(scanf " %d" @@ fun n ->
  let a = init n @@ fun _ -> scanf " %d" @@ fun v -> v in
  let b = init n @@ fun _ -> scanf " %d" @@ fun v -> v in
  let tmp = init n (fun i -> b.(i) - a.(i)) |> to_list in
  let need = List.(map (max 0) tmp |> filter ((<>) 0)) in
  let feed = List.(map (min 0) tmp |> filter ((<>) 0)
  |> map (( * ) (-1)) |> sort (rv compare)) in
  let left,res = List.(fold_left (fun (need,res) v ->
    if need = 0 then (need,res)
    else if need <= v then (0,res+1)
    else (need-v,res+1)
  ) (fold_left (+) 0 need,length need) feed) in
  print_int @@ if left > 0 then -1 else res
))

Measured memory_bytes: 16128
//

#include <cstdio>
#include <iostream>
#include <algorithm>
#include <deque>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <map>
#include <cmath>
#include <stack>

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

using namespace std;

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

  int len = s.length();
  cout << "2018";
  for(int i = 4; i < len; i++){
    cout << s[i];
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
const input = require("fs").readFileSync("/dev/stdin", "utf8").trim();

const inp = input.split(' ').map(val => Number(val));

const alice = inp[0], bob = inp[1];

const tsuyosa = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 1];

const aliceT = tsuyosa.indexOf(alice), bobT = tsuyosa.indexOf(bob);

if(aliceT == bobT) {
  console.log('Draw');
} else if(aliceT > bobT) {
  console.log('Alice');
} else if (aliceT < bobT) {
  console.log('Bob');
}


Measured memory_bytes: 7372
def list_1d(d,v):
    return [ v for i in range(d)]

def abs(c): 
    if c > 0: 
        return c 
    else: 
        return -c

def distance_2d(a,b):
    return(abs(a[0]-b[0])+abs(a[1]-b[1]))

h,w,d = [int(i) for i in input().split()]
sa = list_1d(h*w+1,[])
da = list_1d(h*w+1,0)
for i in range(h):
    a = [int(k) for k in input().split()]
    for j in range(w):
        sa[a[j]] = [i,j]
q = int(input())
lr = [[int(i) for i in input().split()] for i in range(q)]

for i in range(d+1,h*w+1):
    da[i] = da[i-d] + distance_2d(sa[i],sa[i-d])

for i in range(0,q):
    print(da[lr[i][1]]-da[lr[i][0]])


Measured memory_bytes: 35192
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        ArrayList<Integer> list = new ArrayList<>();
        for (int i = 0; i < m; i++) {
            list.add(sc.nextInt());
        }
        Collections.sort(list);
        ArrayList<Integer> list2 = new ArrayList<>();
        for (int i = 1; i < m; i++) {
            list2.add(Math.abs(list.get(i -1) - list.get(i)));
        }
        if(list2.size() == 0) {
            System.out.println(0);
            return;
        }
        Collections.sort(list2);
        int ans = 0;
        for (int i = 0; i < m - n; i++) {
            ans += list2.get(i);
        }
        System.out.println(ans);
    }
}

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

using namespace std;

using ll = long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;

using _loop_int = int;
#define REP(i,n) for(_loop_int i=0; i<(_loop_int)(n); i++)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a); i<(_loop_int)(b); i++)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1; i>=(_loop_int)(a); i--)

#define CHMIN(a,b) (a)=min((a),(b))
#define CHMAX(a,b) (a)=max((a),(b))
#define ALL(v) (v).begin(),(v).end()

#define DEBUG(x) cerr<<#x<<": "<<(x)<<endl
#define DEBUG_VEC(v) cerr<<#v<<": ";REP(__i,(v).size())cerr<<((v)[__i])<<", ";cerr<<endl

const ll MOD = 1000000007ll;

int main(){
    int n;
    cin>>n;
    REP(x,50000){
        if((int)(x * 1.08) == n){
            cout << x << endl;
            return 0;
        }
    }
    puts(":(");
    return 0;
}


Measured memory_bytes: 256
@_[glob<>]=$x+0..($x+=512)for<>=~/ .* /..$`;$s[$_+$']=$s[$_]+abs((($b=$_[$_+$'])>>9)-(($a=$_[$_])>>9))+abs$b%512-$a%512for 1..$x;/ /&&print$s[$']-$s[$`],$/for<>

Measured memory_bytes: 24448