akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
map<string,int> se;
int n;
string s;
long long cnt=0;
int main() {
	ios::sync_with_stdio(false);
	cin>>n;
	for(int i=1;i<=n;i++) {
		cin>>s;
		sort(s.begin(),s.end());
		cnt+=se[s];
		se[s]++;
	}
	cout<<cnt;
	return 0;
}

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

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
　　　　　　 string[] num = System.Console.ReadLine().Split(' ');
            int n = int.Parse(num[0]);
            int m = int.Parse(num[1]);

            if (n <= m * 2)
            {
                Console.Write(0);
            }
            else
            {
                Console.Write(n-(m*2));
            }
          }
    }
}

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

struct Item{
  int h,r;
};

int main() {
  Item A[201];
  int L[201],P[201];
  int n; 
  while ( cin >> n, n ) {
    A[0].h = A[0].r = L[0] = 0;
    P[0] = -1;
    
    for ( int i = 1; i <= n; i++ ) cin >> A[i].h >> A[i].r;
    int m; cin >> m;
    for ( int i = n+1; i <= n+m; i++ ) cin >> A[i].h >> A[i].r;

    for (int i = 1; i <= n+m; i++ ) {
      for ( int j = 1; j < n+m; j++ ) {
	if ( A[j].h > A[j+1].h ) swap( A[j],A[j+1] );
      }
    }

 
    for ( int i = 1; i <= n+m; i++ ) {
      int k = 0;
      for ( int j = 0; j <= i-1; j++ ) {
	if ( A[j].h < A[i].h && A[j].r < A[i].r &&
	     L[j] > L[k] ) {
	  k = j;
	}
	L[i] = L[k] + 1;
	P[i] = k;

	}
      }
    int maxv = 0;
    for ( int i = 1; i <= n+m; i++ ) maxv = max ( maxv, L[i] );
    cout << maxv << endl;
    //  for ( int i = 1; i <= n+m; i++ ){
    //     cout << "L[i]" << " " << L[i] << endl;

    //  }
  }
  return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
const int INF = 1<<29;
//struct from_to{int from,to;};
struct state{
  int cost,pos,rest;
  state(int c,int p,int r):cost(c),pos(p),rest(r){}
  bool operator>(const state &a) const{
    return cost > a.cost;
  }
};
//bool operator>(const state &a,const state &b){return a.cost > b.cost}
int dijkstra(vector<vector<int> > &dp,vector<int> &rest_pos,vector<vector<pair<int,int> > > &edge,int s,int m,int g){
  dp[s][m] = 0;
  priority_queue<state, vector<state > , greater<state > > que;
  que.push(state(0,s,m));
  while(!que.empty()){
    state c = que.top();que.pop();
    int pos = c.pos;
    int cost = c.cost;
    int rest = c.rest;
    if(dp[pos][rest] < cost)continue;
    if(pos == g)return cost;
    if(rest_pos[pos]){
      if(rest+1 <= m && dp[pos][rest+1] > cost+1){
	dp[pos][rest+1] = cost + 1;
	que.push(state(cost+1,pos,rest+1));
      }
    }
    for(int i = 0;i < edge[pos].size();i++){
      int next = edge[pos][i].first;
      int time = edge[pos][i].second;
      if(rest - time >= 0&&dp[next][rest-time] > cost+time){
	dp[next][rest-time] = cost + time;
	que.push(state(cost+time,next,rest-time));
      }
    }
  }
  return INF;
}
int main(){
  int n,m,l,k,a,h;
  while(cin >> n >> m >> l >> k >> a >> h, n | m | l | k | a | h){
    vector<vector<int> > dp(n,vector<int>(m+1,INF));
    vector<int> rest(n,0);
    for(int i = 0;i < l;i++){
      int tmp;
      cin >> tmp;
      rest[tmp] = 1;
    }
    vector<vector<pair<int,int> > > edge(n);
    for(int i = 0;i < k;i++){
      int f,t,time;
      cin >> f >> t >> time;
      edge[f].push_back(make_pair(t,time));
      edge[t].push_back(make_pair(f,time));
    }
    int tmp = dijkstra(dp,rest,edge,a,m,h);
    if(tmp == INF)cout << "Help!" << endl;
    else cout << tmp << endl;
  }
  return 0;
}

Measured memory_bytes: 1480
//g++ -std=gnu++14 a.cpp

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <iostream>
#include <istream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <tuple>
#include <iomanip>
#include <random>
#include <math.h>
#include <stdio.h>

using namespace std;

#define ll long long
#define rep(i, n) for(ll i = 0; i < (n); i++)
ll MOD = 1e9 + 7;
int INF = 1 << 30;
ll INFL = 1LL << 60;
ll MODP = 998244353;

ll kai(ll x,ll y){
  if(y == 0)return 1;
  if(y == 1)return x;
  if(y&1){
    return (x*kai(x,y-1))%MOD;
  }else{
    ll t = kai(x,y/2);
    return (t*t)%MOD;
  }
}

ll comb(ll a,ll b,vector<ll> &p){
  if(a == 0)return 1;
  if(b == 0)return 1;
  ll ans = p[a+b];
  ans = (ans*kai(p[a],MOD-2))%MOD;
  ans = (ans*kai(p[b],MOD-2))%MOD;
  return ans;
}

ll mind(int x,vector<int> &v){
  int ok = v.size()-1,ng = -1;
  while(ok - ng > 1){
    int next = (ok+ng)/2;
    if(v[next] > x){
      ok = next;
    }else{
      ng = next;
    }
  }
  return ok;
}

ll maxd(int x,vector<int> &v){
  int ok = 0,ng = v.size();
  while(ng - ok > 1){
    int next = (ok+ng)/2;
    if(v[next] < x){
      ok = next;
    }else{
      ng = next;
    }
  }
  return ok;
}


int main(){
  string S;
  cin >> S;
  char cur = S.at(0);
  ll ans = 0;
  ll count = 0;
  if(cur == 'R')count++;
  for(int i = 1;i <= S.size()-1;i++){
    if(cur == 'R' && S.at(i) == 'R'){
      count++;
    }else if(cur == 'R' && S.at(i) == 'S'){
      cur = 'S';
      if(ans < count)ans = count;
      count = 0;
    }else if(S.at(i) == 'R'){
      count++;
      cur = 'R';
    }else{
      continue;
    }
  }
  if(count > ans)ans = count;
  cout << ans << endl;


  return 0;
}


Measured memory_bytes: 3576
#include <stdio.h>

int main(int argc, const char * argv[]) {
    int count[4][3][10]={0};
    
    int i,j,k,n;
    
    int b,f,r,v;
    
    scanf("%d",&n);
    
    for(i=0;i<n;i++){
        scanf("%d %d %d %d",&b,&f,&r,&v);
        
        count[b-1][f-1][r-1]=count[b-1][f-1][r-1]+v;
    }
    
    for(i=0;i<4;i++){
        for(j=0;j<3;j++){
            for(k=0;k<10;k++){
                printf(" %d",count[i][j][k]);
            }
            printf("\n");
        }
        if(i<3){
            printf("####################\n");
        }
    }
    
    
    return 0;
}



Measured memory_bytes: 2048
import sys
from collections import defaultdict


def main():
    n, v = map(int, sys.stdin.readline().split())
    a = list(map(int, sys.stdin.readline().split()))
    b = list(map(int, sys.stdin.readline().split()))
    c = list(map(int, sys.stdin.readline().split()))
    d = list(map(int, sys.stdin.readline().split()))
    mp = defaultdict(int)
    for val1 in c:
        for val2 in d:
            mp[val1 + val2] += 1
    print(sum(mp[v - val1 - val2] for val1 in a for val2 in b))

if __name__ == '__main__':
    main()



Measured memory_bytes: 179204
#include <bits/stdc++.h>
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;

int main() {
  ll n,k,slen,ans=0,cnt=0,a=0,b=0;
  vector<ll>d;
	string s;
	char stmp;
  cin >> n >> k >> s;
  stmp=s.at(0);
  cnt=1;
	for(ll i=1;i<sz(s);i++){
	 if(stmp!=s.at(i)){
	 	 d.push_back(cnt-1);
	   stmp=s.at(i);
	 	 cnt=1;
	 }
	 else if(i==sz(s)-1){
    cnt++;
	 	d.push_back(cnt-1);
   }
	 else cnt++;
	}
	for(ll i=0;i<sz(d);i++){
		ans+=d.at(i);
	}
  if(sz(d)==2) ans+=1;
	else if(sz(d)/2>=k){
	  ans+=2*k;
	}
	else ans=n-1;
	cout << ans << endl;
}
 
 


Measured memory_bytes: 1528
#include <bits/stdc++.h>
using namespace std; inline void fileio(const char* in, const char* out) { freopen(in, "r", stdin); freopen(out, "w", stdout); } 
#define TD typedef
#define forx(i,n) for(int i = 0; i < (n); ++i)
TD long long ll; TD long double ld; TD pair<int,int> pii; TD pair<ll, ll> pll; TD vector<int> VI; TD vector<bool> VB; TD vector<ll> VL;
const char nl = '\n'; const int INF = 0x3f3f3f3f; const ll LINF = 0x3f3f3f3f3f3f3f3fll; const ld EPS = 1e-9, PI = acos(-1);
#define ff first
#define ss second

int main() {
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  // Emily <3
  int n;
  cin >> n;
  VI best(3, 0);
  forx(i,n) {
    VI temp(3);
    forx(i,3) cin >> temp[i];
    temp[0] += max(best[1], best[2]);
    temp[1] += max(best[0], best[2]);
    temp[2] += max(best[0], best[1]);
    temp.swap(best);
  }
  int ans = best[0];
  forx(i,3) {
    ans = max(best[i], ans);
  }
  cout << ans << nl;
  
  cerr << "Time: " << (ld)clock() / CLOCKS_PER_SEC << nl;
  return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
#define INF 100000000
#define MOD 1000000007
int dx[4]={1,0,-1,0},dy[4]={0,-1,0,1};
using namespace std;
int main(void){
    int k,x;
    cin>>k>>x;
    int l=x-(k-1);
    int r=x+(k-1);
    for(int i=l;i<=r;i++){
        cout<<i<<" ";
    }
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <iomanip>
#include <vector>
#include <string>
using namespace std;
int n;
int main ()
{
	scanf("%d",&n);
	while(n){
		if(n%10==9) {
			printf("Yes\n");
			return 0;
		}
		n/=10;
	}
	printf("No\n");
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n) for(int i=1;i<=(n);i++)
#define lol long long
#define SUM(n) ((n)+1)*(n)/2 //1〜nまでの総和を求める式
#define mp make_pair
#define fi first
#define se second
#define pu push_back
#define SYOU(x) fixed<<setprecision(x+1) //小数点桁数を指定する
#define abs(x,y) max(x,y)-min(x,y)
#define all(v) v.begin(),v.end()
#define UPDight(a,b) (a+b-1)/b //小数点切り上げ 
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const int MOD=int(1e9)+7; 
using namespace std;
using pii = pair<int, int>;
typedef vector<int> vit;

//最大公約数
lol gcd(lol x, lol y){
  if(x < y) swap(x, y);
  lol r = x % y;
  while(r != 0){
    x = y;
    y = r;
    r = x % y;
  }
  return y;
}

//最小公倍数
lol lcm(lol x, lol y){
  lol a = x * y;
  return (a / gcd(x, y));
}

signed main(void){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);

  int n, m, k;
  cin >> n >> m >> k;
  if(k == 0){
    cout << "Yes\n";
    return 0;
  }
  reps(i, n){
    reps(j, m){
      if(i * j + (n - i) * (m - j) == k){
	cout << "Yes\n";
	return 0;
      }
    }
  }
  cout << "No\n";
      
  return 0;
}


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


#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()


using namespace std;
using namespace __gnu_pbds;

template<class T> using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
using ll  = long long;

using point = complex<double>;


void err(istream_iterator<string> it) {cerr << endl;}
template<typename T, typename... Args>void err(istream_iterator<string> it, T a, Args... args) {cerr << *it << " = " << a << endl;err(++it, args...);}


const double EPS = 1e-8;
const long long mod = 1e9 + 7;

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

const int N = 1e5 + 5;
const long long INF = 1e18;




int main()
{

    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int n;
    cin >> n;
    vector<int>arr,v;
    int a;
    for(int i = 0; i < n; ++i){
        cin >> a;
        arr.push_back(a);
        v.push_back(a);
    }
    int f = -1,e=-1;
    sort(all(v));
    for(int i = 0; i < n; ++i){
        if(arr[i] != v[i]){
            if(f==-1)f=i;
            else e = i;
        }
    }
    if(e == -1 and f == -1){
        cout << "YES\n";
        return 0;
    }
    swap(arr[f],arr[e]);
    if(arr == v)cout << "YES\n";
    else cout << "NO\n";

    return 0;
}


Measured memory_bytes: 256
from math import sqrt
from scipy.sparse.csgraph import dijkstra, csgraph_from_dense
# https://atcoder.jp/users/nadare881

def calc_dist(p1,p2):
    return max(0, sqrt((p1[0]-p2[0])**2 + (p1[1]-p2[1])**2) - (p1[2]+p2[2]))

xs, ys, xg, yg = map(int, input().split())
n = int(input())
p = [list(map(int, input().split())) for i in range(n)]
p = [[xs,ys,0], [xg,yg,0]] + p
n += 2
edges = [[float("inf")]*n for i in range(n)]
for i in range(n):
    for j in range(i,n):
        if i == j :continue
        edges[i][j] = edges[j][i] = calc_dist(p[i], p[j])
edges = csgraph_from_dense(edges, null_value=float("inf"))
dist = dijkstra(edges, directed=False, indices=0)
print(dist[1])

Measured memory_bytes: 59492
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<utility>
#include<string>

using namespace std;
using vi = vector<int>;
using ll = long long;
using P = pair<int, int>;
int main() {
	vector<ll> v(30, 0);
	string s;
	cin >> s;
	ll n = s.size();
	for (char c : s) {
		v[(int)c - 'a']++;
	}
	ll ans = 1+n*(n - 1) / 2;
	for (ll x : v) {
		ans -= x*(x - 1) / 2;
	}
	cout << ans << endl;
}


Measured memory_bytes: 640
module Main where
import Debug.Trace
import Data.List
import Data.Array
import Data.Maybe
import Data.Ord
import Control.Monad

solve :: [[Int]] -> [Int]
solve [] = []
solve ([n, t]:ds) = length (traverse [] 3 [1..n]) : solve ds where
    traverse tc 0 xs = if sum tc == t then [tc] else []
    traverse tc _ [] = []
    traverse tc r (x:xs) = traverse (x:tc) (r-1) xs ++ traverse tc r xs 

readLine:: IO [Int]
readLine = fmap (map read . words) getLine

readUntil :: ([Int] -> Bool) -> IO [[Int]]
readUntil eof = iter where
    iter = readLine >>=
            (\a -> if eof a then return [] else fmap (a:) iter)
            
eof :: [Int] -> Bool
eof (n:x:xs) = all (== 0) [n, x] 

main :: IO() 
main = do
    l   <- readUntil eof
    mapM_ print (solve l)



Measured memory_bytes: 5048
#include "bits/stdc++.h"

#define MOD 1000000007
#define rep(i, n) for(ll i=0; i < (n); i++)
#define rrep(i, n) for(ll i=(n)-1; i >=0; i--)
#define ALL(v) v.begin(),v.end()
#define rALL(v) v.rbegin(),v.rend()
#define FOR(i, j, k) for(ll i=j;i<k;i++)
#define debug_print(var) cerr << #var << "=" << var <<endl;
#define DUMP(i, v)for(ll i=0;i<v.size();i++)cerr<<v[i]<<" "
#define fi first
#define se second

using namespace std;
typedef long long int ll;
typedef vector<ll> llvec;
typedef vector<double> dvec;
typedef pair<ll, ll> P;
typedef long double ld;
struct edge{ll x, c;};

ll mod(ll a, ll mod){
  ll res = a%mod;
  if(res<0)res=res + mod;
  return res;
}

ll modpow(ll a, ll n, ll mod){
  ll res=1;
  while(n>0){
    if(n&1) res=res*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return res;
}

ll modinv(ll a, ll mod){
  ll b=mod, u=1, v=0;
  while(b){
    ll t=a/b;
    a-=t*b; swap(a, b);
    u-=t*v; swap(u, v);
  }
  u%=mod;
  if(u<0)u+=mod;
  return u;
}

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

bool is_prime(ll n){
  ll i = 2;
  if(n==1)return false;
  if(n==2)return true;
  bool res = true;
  while(i*i <n){
    if(n%i==0){
      res = false;
    }
    i = i+1;
  }

  //if(i==1)res = false;
  if(n%i==0)res=false;
  return res;
}
/**************************************
** A main function starts from here  **
***************************************/
int main(){
  string A, B, C;
  cin >> A >> B >> C;
  if(A[A.size()-1]==B[0] and B[B.size()-1]==C[0]){
    cout << "YES";
  }else{
    cout << "NO";    
  }
  return 0;
}


Measured memory_bytes: 3620
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;

/*
<url:https://arc078.contest.atcoder.jp/tasks/arc078_a>
問題文============================================================
 すぬけくんとアライグマは N 枚のカードの山を作りました。
 カードの山の上から i 番目のカードには整数 ai が書かれています。
 
 N 枚のカードを分け合うことにしました。
 すぬけくんがカードの山の上から何枚かのカードを取ったあと、アライグマは残ったカード全てを取ります。
 このとき、すぬけくんもアライグマも 1 枚以上のカードを取る必要があります。
 
 すぬけくんとアライグマが持っているカードに書かれた数の総和をそれぞれ x,y として、
 |x−y| を最小化したいです。 |x−y| としてありうる値の最小値を求めなさい。

=================================================================

解説=============================================================

================================================================
*/
int main(void) {
	cin.tie(0); ios::sync_with_stdio(false);
    ll n; cin >> n;
    vector<ll> a(n);
    for(auto &in:a) cin >> in;
    vector<ll> cusum(n+1,0);
    for(int i = 0; i < n;i++){
        cusum[i+1] = cusum[i] + a[i];
    }
    ll ans = LINF;
    for(int i = 1; i < n;i++){
        ans = min(ans,abs(cusum[i] - (cusum[n] - cusum[i])));
    }
    cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3456
#define _CRT_SECURE_NO_WARNINGS

/* include ***********************/
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>

/* define *************************/
//for
#define REP(i,n) for(int i=0,i##_len=(int)(n);i<i##_len;i++)
#define REPS(i,n) for(int i=1,i##_len=(int)(n);i<=i##_len;i++)
#define RREP(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define RREPS(i,n) for(int i=(int)(n);i>0;i--)
#define FOR(i,s,n) for(int i=(int)(s),i##_len=(int)(n);i<i##_len;i++)
#define RFOR(i,s,n) for(int i=(int)(s)-1,i##_len=(int)(n);i>=i##_len;i--)

//printf
#define PRINTD(d) printf("%d\n",(d))
#define PRINTL(d) printf("%lld\n",(d))

//memset
#define m0(s) memset(s,0,sizeof(s))
#define ml(s) memset(s,63,sizeof(s))
#define fill(s,c) memset(s,c,sizeof(s))

#define INF 1e9
#define MOD 1000000007

typedef long long ll;
typedef unsigned long long ull;

int uf[200000];
ll a[200000];

int diff[4][2] = {
	{ 0, -1 },
	{ -1, 0 },
	{ 1, 0 },
	{ 0, 1 },
};

int Min(int a, int b) {
	return (a)<(b) ? (a) : (b);
}
int Max(int  a, int  b) {
	return (a) > (b) ? (a) : (b);
}
void Swap(int *a, int *b) {
	int tmp = *a;
	*a = *b;
	*b = tmp;
}

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

	PRINTD(a*b / 2);
}

Measured memory_bytes: 128
#include <stdio.h>
 
int main() {
  int num1 = 1, num2 = 1;
 
  for (num1 = 1; num1 <= 9; num1++) {
    for (num2 = 1; num2 <= 9; num2++) {
      printf("%dx%d=%d\n", num1, num2, num1 * num2);
    }
  }
 
  return 0;
}

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

int main()
{
    char a[11],b[11],c[11];
    cin>>a>>b>>c;
    if(a[strlen(a)-1]==b[0] && b[strlen(b)-1]==c[0])cout<<"YES"<<endl;
    else cout << "NO" << endl;
    return 0;
}


Measured memory_bytes: 256
from operator import mul
from functools import reduce

N, K = [int(n) for n in input().split()]
R = N - K

def cmb(n, r):
    r = min(n - r, r)
    if r == 0:
        return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1, r + 1))
    res = over // under
    return res

def calc(i):
    blue = i
    red = i - 1
    a = cmb(K - 1, blue - 1) if K >= blue else 0
    b = cmb(R + 1, red + 1) if R >= red else 0
    return a * b

M = 10**9 + 7
for i in range(1, K + 1):
    print(calc(i) % M)


Measured memory_bytes: 3944
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<set>
#include<iomanip>
#define rep(i, a, n) for(int i = a; i < n; i++)
using namespace std;
int main(){
  string r, s, t;
  cin >> r >> s >> t;
  cout << "A" << s[0] << "C\n";
}


Measured memory_bytes: 3596
def check_cf(s):
    try:
        idx_c = s.index('C')
        idx_f = s[idx_c:].index('F') + idx_c
    except:
        return 'No'

    if idx_c < idx_f:
        return 'Yes'

    return 'No'

if __name__ == '__main__':
    print check_cf(raw_input())

Measured memory_bytes: 2568
/*
  author: ruruvuvu
  GitHub account: colon-ku

  created at: 2020-03-01 17:31:53
*/

#include <bits/stdc++.h>
using namespace std;

#define all(x) (x).begin(),(x).end()
#define rep(x, y) for (int x = 0; x < y; x++)
#define MOD 1000000007

typedef long long LL;
typedef long double LD;

bool compare_by_b(pair<int, int> a, pair<int, int> b)
{
    if (a.second != b.second) {
        return a.second < b.second;
    } else {
        return a.first < b.first;
    }
}

ostringstream oss_global;
string s_global = oss_global.str();

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++)
        cin >> a[i];

    int ok = 1;
    for (int i = 0; i < n; i++) {
        int k = a[i];
        if (k % 2 == 0) {
            if (k % 3 == 0 || k % 5 == 0) {
                ;
            } else {
                ok = 0;
            }
        }
    }

    if (ok) {
        cout << "APPROVED" << endl;
    } else {
        cout << "DENIED" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
import math

N = int(input())
P = list(map(int, input().split(" ")))
Q = list(map(int, input().split(" ")))


def find_order(num_list):
    if len(num_list) == 1:
        return 0
    first = num_list[0]
    order = sorted(num_list).index(first)
    if order == 0:
        return find_order(num_list[1:])
    else:
        return order * math.factorial(len(num_list) - 1) + find_order(num_list[1:])


order_p = find_order(P)
order_q = find_order(Q)

print(abs(order_p - order_q))


Measured memory_bytes: 61964
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rrep(i,n) for(int (i)=((n)-1);(i)>=0;(i)--)
#define itn int
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
const long long INF = 1LL << 60;
const int MOD = 1000000007;
signed main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int h,w,n; cin>>h>>w>>n;
    vector <pair<int,int>> data(n);
    map <pair <int,int> , int> ma;
    rep(i,n) {int a,b; cin>>b>>a; a--; b--; ma[{a,b}]++; data[i] = {a,b};}
    vector <int> ans(10); 
    map <pair <int,int>, bool> done;
    rep(i,n){
        int nx = data[i].F, ny = data[i].S;
        for(int x=-1;x<=1;x++){
            for(int y = -1; y<=1; y++){
                int cx = nx+x, cy = ny+y;
                if(cx+1>= w|| cx-1<0||cy+1>=h||cy-1<0) continue;
                if(done[{cx, cy}]) continue;
                else done[{cx, cy}] = true;
                int cnt = 0;
                for(int ix=-1;ix<=1;ix++) for(int jy=-1;jy<=1;jy++) if(ma[{cx+ix, cy+jy}]) cnt++;
                ans[cnt]++;
            }
        }
    }
    rep(i,10) ans[0]-=ans[i];
    ans[0] += (h-2)*(w-2);
    
    rep(i,10) cout<<ans[i]<<endl;
}


Measured memory_bytes: 214272
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    ごちゃごちゃ場合分けを考える前に全探索は考えましたか？
*/

int main(){
    int N; cin >> N;
    vector<int> c(N-1), s(N-1), f(N-1);
    for(int i=0; i<N-1; ++i) cin >> c[i] >> s[i] >> f[i];

    for(int i=0; i<N-1; ++i){
        int time = 0;
        for(int j=i; j<N-1; ++j){
            if(time < s[j]){
                time = s[j] + c[j];
            }
            else{
                if(time%f[j] == 0){
                    time += c[j];
                }
                else{
                    time += f[j] - time%f[j];
                    time += c[j];
                }
            }
        }
        cout << time << endl;
    }
    cout << 0 << endl;
    return 0;
}

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

int main(){
  int N;
  cin >> N;
  vector<int64_t> v(1e5+5,0);
  int64_t sum=0;
  int A;
  for(int i=0;i<N;i++){
    cin >> A;
    sum+=A;
    v.at(A)++;
  }
  int Q;
  cin >> Q;
  int B,C;
  for(int i=0;i<Q;i++){
    cin >> B >> C;
    sum-=v.at(B)*B;
    sum+=v.at(B)*C;
    cout << sum << endl;
    v.at(C)+=v.at(B);
    v.at(B)=0;
  }
  return 0;
}


Measured memory_bytes: 4028
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define all(v) (v).begin(), (v).end()
#define fastIO ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);


signed main(){
    fastIO
    string s, t, u;
    cin >> s;
    for(int i =0 ; i<s.length(); i++){
        cout << "x";
    }
}

Measured memory_bytes: 256
s = gets.chomp.chars.sort
t = gets.chomp.chars.sort{|a, b| b <=> a}
f = false
([s.size, t.size].max).times do |i|
  if s[i].nil?
    f = true
    break
  elsif t[i].nil?
    break
  elsif s[i] > t[i]
    break
  elsif s[i] < t[i]
    f = true
    break
  end
end
puts (f ? "Yes" : "No")

Measured memory_bytes: 1788
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define ll long long int
#define mem(x) memset(x,0,sizeof(x))
#define setbits(x)  __builtin_popcount(x)
#define ull unsigned long long int
#define all(c) (c).begin(),(c).end()
#define debug(x) cout<<#x<<" :: "<<x<<endl;
#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<endl;
#define cps CLOCKS_PER_SEC
#define complex cerr << "Time (in ms): " << (double)(clock() - clk) * 1000.0 / cps << '\n';
#define db double
#define endl "\n"
#define  fbo(x) find_by_order(x)
#define  ook(x) order_of_key(x)

using namespace __gnu_pbds;
using namespace std;

typedef tree<int, null_type, less<int>, rb_tree_tag,
            tree_order_statistics_node_update>
    os1;
typedef tree<int, null_type, greater<int>, rb_tree_tag,
            tree_order_statistics_node_update>
    os2;
typedef vector< int > vi;
typedef vector< vi > vvi;
typedef pair<ll,ll > ii;
typedef pair<ll,int> li;
inline void fast()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}
const ll pi=31;
const ll MOD[2] = {1187278649, 1149736019};//for double hashing
const ll mod=(ll)(1e9)+7;
ll pmod(ll x,ll n){
  ll r=1;
  while(n)
  {
    if(n&1LL)
      r=(r*x)%mod;
    x=(x*x)%mod;
    n=n/2;
  }
  return r;
}

//think recursively also


void solve()
{   
    ll a,b,c,k;
    cin>>a>>b>>c>>k;

    ll ans=0;
    if(k>=a)
      {ans+=a;
        k-=a;
      }
    else
      {ans+=k;
        k=0;
      }
    if(k>=b)
    {
      
      k-=b;
    }
    else 
    {
      k=0;
    }
    if(k>=c)
    {
      ans-=c;
      k-=c;
    }
    else
    {
      ans-=k;
      k=0;
    }
    cout<<ans<<endl;
    
  
}
int main()
{
   fast();
  
   // int t;
   // cin>>t;
   // for(int casee=1;casee<=t;casee++)
  {// cout<<"Case #"<<casee<<": ";
    solve();
  }
 
 
 
}


Measured memory_bytes: 3660
#include <bits/stdc++.h>
 
#define rep(i,n) for(int i=0;i<(n);i++)
 
using namespace std;
using lint=long long;
 
int main(){
	int l[]={1,0,0,1,2,3,4,5,6,7,8,9,9,10};
	int r[]={9,9,19,29,39,49,59,69,79,89,99,99,109,119};
	vector<lint> ans;
	rep(i,14) for(int j=l[i];j<r[i];j++) {
		ans.emplace_back(stoll(to_string(j)+string(i,'9')));
	}
 
	int k; cin>>k;
	rep(i,k) cout<<ans[i]<<endl;
 
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring> 
#include<iostream>
#include<algorithm>
using namespace std;
int n;
struct st{
	char s[122];
	int t,p;
}a[121];
int cmp(st a,st b){
	int len=max(strlen(a.s),strlen(b.s));
	for(int i=0;i<len;i++) if(a.s[i]<b.s[i]) return 1;else if(a.s[i]>b.s[i]) return 0;
	if(a.p>b.p) return 1;
	return 0; 
}
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%s%d",a[i].s,&a[i].p);a[i].t=i;
		//printf("%s %d\n",a[i].s,a[i].p);
	}
	sort(a+1,a+n+1,cmp);
	for(int i=1;i<=n;i++) printf("%d\n",a[i].t);
}

Measured memory_bytes: 256
use std::io;
fn main() {
    let n = get_line().trim().parse().expect("number");
    let ns = read_ints();
    println!("{}", solve(n, &ns));
}

fn solve(n: usize, ns: &[i64]) -> i64 {
    let sum = ns.iter().fold(0, |acc, n| acc + n);
    ns.iter()
        .scan(0, |acc, &n| {
            *acc = *acc + n;
            Some(*acc)
        })
        .map(|sunuke| (sum - 2 * sunuke).abs())
        .take(n - 1)
        .min()
        .expect("No such thing")
}


fn read_ints() -> Vec<i64> {
    get_line()
        .trim()
        .split_whitespace()
        .map(|n| n.parse().unwrap())
        .collect()
}

fn get_line() -> String {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).ok();
    buf
}


Measured memory_bytes: 10492
a,b,c =map(int,input().split())
if a < b :
    if b<c:
        print(a,b,c)
    elif a < c:
        print(a,c,b)
    else :
        print(c,a,b)
else:
    if a <c:
        print(b,a,c)
    elif b < c:
        print(b,c,a)
    else:
        print(c,b,a)




Measured memory_bytes: 5592
fun main(args: Array<String>) {
    val (n, m) = readLine()!!.split(' ').map(String::toLong)
    val modNum = 1000000007L

    val subtract = Math.abs(n - m)
    when {
        subtract >= 2 -> {
            println(0)
            return
        }
        subtract == 1L -> {
            val larger = Math.max(n, m)
            println((calcFactorial(larger, modNum) * calcFactorial(larger - 1, modNum)) % modNum)
            return
        }
        else -> {
            println((calcFactorial(n, modNum) * calcFactorial(m, modNum) * 2) % modNum)
            return
        }
    }
}

fun calcFactorial(input: Long, modNum: Long): Long {
    var result = 1L
    for (i in 1L..input) {
        result = (result * i) % modNum
    }
    return result
}

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

using namespace std;
#define ll long long
#define rep(i, n) for (int i = 0; i < (n); ++i)
double const PI = 3.1415926535897932384626433;

int main() {
    int a, b;
    cin >> a >> b;
    cout << max(max(a + b, a - b), a * b) << endl;

    return 0;
}

Measured memory_bytes: 3644
#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<algorithm>
#include<map>
#include<cstdlib>
#include<cmath>
#include<numeric>
#include<iomanip>
using namespace std;
using ll =long long;
const int MOD = 1000000007;

int main() {
	ll N;
	cin >> N;
	cout << N * (N - 1) / 2;


}

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

class Main
{
  	static int gcd(int a, int b)
    {
      	int c = 0;
      while(b>0)
      {
        c = a;
        a = b;
        b = c%b;
      }
      return a;
    }
  	public static void main(String[] args)
    {
		Scanner s = new Scanner(System.in);
      	int n = s.nextInt();
      	int[] a = new int[n];
      	int[] b = new int[n];
      	int[] c = new int[n];
      	for(int i = 0 ; i<n ; i++)a[i] = s.nextInt();
      	int sum = 0;
      	b[0] = a[0];
      	for(int i = 1 ;  i<n ;i++)
        {
        	b[i] = gcd(b[i-1], a[i]); 	
        }
      	c[n-1] = a[n-1];
      	for(int i = n-2 ;  i>=0 ;i--)
        {
        	c[i] = gcd(c[i+1], a[i]); 	
        }
      	
      	int ans = 0;
		ans = Math.max(ans, c[1]);
      	ans = Math.max(ans, b[n-2]);
      	for(int i = 1 ;  i<n-1 ;i++)
        {
          	
        	ans = Math.max(ans, gcd(b[i-1], c[i+1]));
        }
      
      	System.out.println(ans);
    }
}

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

using namespace std;

vector<long long int > V;
vector<long long int >tmp;
long long int A, B, C;

int main(void) {

	cin >> A >> B >> C;

	V.push_back(A);
	V.push_back(B);
	V.push_back(C);

	tmp.push_back(0);
	tmp.push_back(0);
	tmp.push_back(0);

	int count = 0;
	while (1) {
		sort(V.begin(), V.end());
		/*cout << count << endl;
		for (int i = 0; i <= 2; i++) { cout << " " << V[i]; }
		cout << endl;
		*/
		if (V[0] % 2 == 1) { break; }
		if (V[1] % 2 == 1) { break; }
		if (V[2] % 2 == 1) { break; }

		tmp[0] = (V[0] + V[1]) / 2;
		tmp[1] = (V[1] + V[2]) / 2;
		tmp[2] = (V[2] + V[0]) / 2;

		sort(tmp.begin(), tmp.end());

		if (V == tmp) { count = -1; break; }

		V = tmp;
		count++;
	}

	cout << count << endl;

	//system("pause");
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
bool vis[100050],f[100050];
int n,a[105];
bool dfs(int k){
	if (vis[k])return f[k];
	vis[k]=1;
	if (k<a[1])return 0;
	for (int i=1;i<=n;i++)if (k>=a[i]&&!dfs(k-a[i]))return f[k]=1;
	return 0;
}
int main(){
	int k;
	scanf("%d%d",&n,&k);
	for (int i=1;i<=n;i++)scanf("%d",&a[i]);
	if (dfs(k))printf("First\n");else printf("Second\n");
}

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

typedef long long ll;

const int Maxb = 60;

ll A, B;

ll Solve(int b, ll A, ll B, ll lim)
{
    if (lim <= A) return 0;
    if (b < 0) return 1;
    if (!(B & 1ll << ll(b))) return Solve(b - 1, A, B, lim);
    if (A & 1ll << ll(b)) return Solve(b - 1, (A ^ 1ll << ll(b)), (B ^ 1ll << ll(b)), lim - (1ll << ll(b)));
    else {
        ll res = min(lim, (1ll << ll(b))) - A;
        ll lef = (1ll << ll(b)) + A, rig = min(lim, (1ll << ll(b + 1)));
        if (lef < rig) res += rig - lef;
        lim = min(lef, lim);
        res += Solve(b - 1, 0, (B ^ 1ll << ll(b)), lim - (1ll << ll(b)));
        return res;
    }
}

int main()
{
    cin >> A >> B;
    cout << Solve(Maxb - 1, A, B, (1ll << ll(Maxb))) << endl;
    return 0;
}


Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

func scanInt() int {
	iv, _ := strconv.Atoi(scanString())
	return iv
}

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

func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 100001), 100001*100)
}

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

func main() {
	n := scanInt()
	ans := 0
	cab, ca, cb := 0, 0, 0
	for i := 0; i < n; i++ {
		s := scanString()
		ans += strings.Count(s, "AB")
		if s[0] == 'B' && s[len(s)-1] == 'A' {
			cab++
		} else if s[0] == 'B' {
			cb++
		} else if s[len(s)-1] == 'A' {
			ca++
		}
	}
	if ca > 0 && cab > 0 {
		ca--
		ans++
	}
	if cb > 0 && cab > 0 {
		cb--
		ans++
	}
	if cab > 0 {
		ans += cab - 1
	}
	ans += min(ca, cb)
	fmt.Println(ans)
}


Measured memory_bytes: 768
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <queue>
#include <math.h>
#include <assert.h>
#include <set>
#include <map>
#include <bitset>
#include <ctime>
#include <time.h>
#include <algorithm>
#include <cstdio>
#include <fstream>
#include <stack>
#include <ctype.h>
#include <numeric>
#include <sstream>
#include <unistd.h>
#include <unordered_map>
#include <unordered_set>
#include <limits>
#include <random>
#include <chrono>
#include <iomanip>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef long long ll;
#define debug(name) DEBUG(#name, (name))
template<typename T>
void DEBUG(string label, T value) {
    cerr << "[" << label << " = " << value << "]\n";
}

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


    int n;
    cin >> n;
    const int N = 1e5 + 10;
    vector<int> arr(n), c1(N), c2(N);
    for(auto & i : arr){
        cin >> i;
    }
    int m1 = 0;
    int m2 = 0;
    int num1 = -1;
    int num2 = -1;
    int second_1 = 0;
    int second_2 = 0;
    for(int i = 1; i < n; i += 2){
        c1[arr[i]]++;
    }
    for(int i = 0; i < n; i += 2){
        c2[arr[i]]++;
    }
    for(int i = 0; i < N; ++i){
        if(c1[i] > m1){
            second_1 = m1;
            m1 = c1[i];
            num1 = i;
        }
        else if(c1[i] > second_1){
            second_1 = c1[i];
        }
    }
    for(int i = 0; i < N; ++i){
        if(c2[i] > m2){
            second_2 = m2;
            m2 = c2[i];
            num2 = i;
        }
        else if(c2[i] > second_2){
            second_2 = c2[i];
        }

    }
    //debug(m1);
    //debug(m2);
    //debug(second_1);
    //debug(second_2);
    if(num1 != num2){
        cout << n - m1 - m2 << endl;
    }
    else{
        if(m1 + m2 == n){
            cout << n/2 << endl;
            return 0;
        }
        int ans = n - m1 - second_2;
        ans = min(ans, n - m2 - second_1);
        cout << ans << endl;
    }







}



















Measured memory_bytes: 1408
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String a = sc.nextLine();
		if(a.equals("hi")){
			System.out.println("Yes");
		}else if(a.equals("hihi")) {
			System.out.println("Yes");
		}else if(a.equals("hihihi")){
			System.out.println("Yes");
		}else if(a.equals("hihihihi")) {
			System.out.println("Yes");
		}else if(a.contentEquals("hihihihihi")) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	}

}


Measured memory_bytes: 22612
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define repr(i, n) for (int i = (int)n - 1; i >= 0; --i)
#define ALL(a) (a).begin(), (a).end()
using ll = long long;
// using Graph = vector<vector<int>>;
const ll MOD = 1e9 + 7;
const ll INF = 1e9;
const ll LINF = 1LL << 60;

int main() {
  string s, t;
  cin >> s >> t;
  char c = t[t.length() - 1];
  s += c;
  if (s == t)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define int long long
#define x first
#define y second
#define pb push_back

#define speed ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;


signed main()
{
    int m,d;cin>>m>>d;
    int ans=0;
    for(int i=22;i<=d;++i)
    {
        int o=i%10;
        int t=((i-o)/10);
        if((o>=2)&&(t>=2)&&((o*t)<=m)){++ans;}
    }
    cout<<ans<<"\n";
}

Measured memory_bytes: 256
n=int(input())
dp=[None]*(n+1)
dp[0]=0

a=1

lst=[]

while a<=n:
  dp[a]=1
  lst+=[a]
  a*=6

a=1

while a<=n:
  dp[a]=1
  lst+=[a]
  a*=9

for i in range(n):
  if dp[i]!=None:
    for j in lst:
      if i+j<=n:
        if dp[i+j]!=None:
          dp[i+j]=min(dp[i+j],dp[i]+1)
        else:
          dp[i+j]=dp[i]+1

print(dp[n])

Measured memory_bytes: 68620
#include<bits/stdc++.h>
using namespace std;
#define sz(a) int((a).size())
#define pb push_back
#define all(c) c.begin(),c.end()
#define tr(c,i) for(i = c.begin(); i != c.end(); i++)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define forstl(i,v) for(auto &i: v)
#define forn(i,e) for(int i = 0; i < e;++i)
#define forsn(i,s,e) for(int i = s; i < e;++i)
#define rforn(i,s) for(int i = s; i >= 0;--i)
#define rforsn(i,s,e) for(int i = s; i >= e;--i)
# define INF 0x3f3f3f3f 
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll,ll> p64;
typedef pair<int,int> p32;
typedef pair<int,p32> p96;
typedef vector<ll> v64;
typedef vector<int> v32; 
typedef vector<v32> vv32;
typedef vector<v64> vv64;
typedef vector<p32> vp32;
typedef vector<p64> vp64;
typedef vector<vp32> vvp32;
typedef map<int,int> m32;
const int LIM=1e5+5,MOD=1e9+7;

ll dp[105][100005];
int main()
{
    ll i,j,k,m,n,wt;
    cin>>n>>wt;
    v64 v(n),w(n);
    forn(i,n)
        cin>>w[i]>>v[i];
    for(i=0;i<n;i++)
    {
        for(j=0;j<=100000;j++)
        {
            if(j==0)
            {
                dp[i][j]=0;
                continue;
            }
            if(i>0 && j>=v[i])
                dp[i][j]=min(dp[i-1][j],w[i]+dp[i-1][j-v[i]]);
            else if(i>0)
                dp[i][j]=dp[i-1][j];
            else
            {
                if(j<=v[i])
                    dp[i][j]=w[i];
                else
                    dp[i][j]=1e12;
            }
        }
    }
    for(i=100000;i>=0;i--)
        if(dp[n-1][i]<=wt)
            break;
    cout<<i<<"\n";
}

Measured memory_bytes: 81744
package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()

	a1, err := strconv.Atoi(strings.Split(scanner.Text(), " ")[0])
	if err != nil {
		fmt.Println(err)
		return
	}
	a2, err := strconv.Atoi(strings.Split(scanner.Text(), " ")[1])
	if err != nil {
		fmt.Println(err)
		return
	}
	a3, err := strconv.Atoi(strings.Split(scanner.Text(), " ")[2])
	if err != nil {
		fmt.Println(err)
		return
	}

	if a1+a2+a3 >= 22 {
		fmt.Println("bust")
	} else {
		fmt.Println("win")
	}
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define repr(i, a, b) for(ll i = (a); i < (b); i++)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((ll)(x).size())
const ll MOD = 1000000007;
const ll INF = 100000000000000000LL;
inline ll GCD(ll a, ll b){ return b?GCD(b, a % b):a; }
inline ll LCM(ll a, ll b){ return a/GCD(a, b)*b; }
inline ll powint(unsigned long long x, ll y){ ll r=1; while(y){ if(y&1) r*=x; x*=x; y>>=1; } return r; }
inline ll powmod(ll x, ll y, ll m = MOD){ ll r=1; while(y){ if(y&1) r*=x; x*=x; r%=m; x%=m; y>>=1; } return r; }
template<class T>bool chmax(T &a, const T &b){ if(a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b){ if(b<a) { a=b; return 1; } return 0; }
#ifdef OJ_LOCAL
#include "dump.hpp"
#else
#define dump(...) ((void)0)
#endif

// ベクトル
// 偏角[-Pi, Pi]でソートできる
struct Vec{
    ld x, y;
    Vec(ld _x, ld _y): x(_x), y(_y){}
};
bool operator<(const Vec& l, const Vec& r){
    return atan2(l.y, l.x) < atan2(r.y, r.x);
}

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    cout << fixed << setprecision(32);
    ll n;
    cin >> n;
    vll x(n), y(n);
    rep(i, n){
        cin >> x[i] >> y[i];
    }
    vi del(n, 0);
    rep(i, n){
        if(x[i] == 0 && y[i] == 0){
            del[i] = 1;
        }
    }
    vector<Vec> v;
    rep(i, n){
        if(!del[i]) v.emplace_back(x[i], y[i]);
    }
    n = SZ(v);
    sort(ALL(v));
    ll ans = 0;
    rep(i, n){
        ll cumx = 0;
        ll cumy = 0;
        rep(j, n){
            ll idx = (i+j)%n;
            cumx += v[idx].x;
            cumy += v[idx].y;
            chmax(ans, cumx*cumx+cumy*cumy);
        }
    }
    cout << sqrt(ld(ans)) << endl;
    return 0;
}

Measured memory_bytes: 256
using System;
class TEST
{
    public static void Main()
    {
        string[] value = Console.ReadLine().Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
   //     if (AllNum <= 0)

            int AllNum = int.Parse(value[0]);
        int MakeMax = int.Parse(value[1]);
        int MaxTime = int.Parse(value[2]);
        int time = 0;
        int temp = AllNum;

        while (temp > 0)
        {
            temp -= MakeMax;
            time += MaxTime;
        }
        Console.WriteLine(time);
       // Console.ReadKey();
    }
}

Measured memory_bytes: 27440
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(10000)


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


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


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, L, A):

    for i in range(N-1):
        if A[i] + A[i+1] >= L:
            print('Possible')
            for j in range(i):
                print(j+1)
            for j in reversed(range(i+1, N-1)):
                print(j+1)
            print(i+1)
            return

    else:
        print('Impossible')


def main():
    N, L = read_int_n()
    A = read_int_n()
    slv(N, L, A)


if __name__ == '__main__':
    main()


Measured memory_bytes: 84972
//abc166_a.cpp
//Sun May  3 20:54:12 2020

#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#define INTINF 2147483647
#define LLINF 9223372036854775807
#define MOD 1000000007

using namespace std;
using ll=long long;
typedef pair<int,int> P;

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

	if (s=="ABC"){
		cout << "ARC" << endl;
	}else {
		cout << "ABC" << endl;
	}
}

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

using namespace std;

using ll = long long;
constexpr ll MOD = 1e9 + 7;
constexpr ll INF = 1e18;

int main() {
    ll n, m, i, j, k,x;
    cin >>  n >> m >> x;
    ll c[n];
    vector<vector<ll>> A(n,vector<ll>(m));
    for(i=0;i<n;i++){
        cin >> c[i];
        for(auto &a:A[i]){
            cin >> a;
        }
    }
    ll ret = INF;
    for(i=1;i<1<<n;i++){
        ll und[m]={},cost=0;
        for(j=0;j<n;j++){
            if((i>>j) & 1){
                cost+=c[j];
                for(k=0;k<m;k++){
                    und[k] += A[j][k];
                }
            }
        }
        for(k=0;k<m;k++){
            if(und[k]<x)cost = INF;
        }
        ret = min(ret,cost);
    }
    if(ret==INF)ret = -1;
    cout << ret << endl;
    return 0;
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
#define INF 0x3f3f3f3f
const int MOD=1e9+7;
const double eps=1e-8;
typedef long long ll;
//orz yht
using namespace std;
int n,m,k;
char ch[11][1010];
int bel[11],tot,sum[11];
int nxt(int x){
    memset(sum,0,sizeof(sum));
    int p=x;
    while(x<=m){
        bool pd=1;
        for(int i=1;i<=n;i++){
            sum[bel[i]]+=ch[i][x]-'0';
            if(sum[bel[i]]>k) pd=0;
        }
        if(!pd) break;
        x++;
    }
    if(p==x) return -1;
    return x;
}
int main(){
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	int minn=2e9;
    scanf("%d %d %d",&n,&m,&k); 
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++) scanf(" %c",&ch[i][j]);
    }
    for(int i=(1<<(n-1))-1;i>=0;i--){
        bel[1]=tot=1;
        for(int j=2;j<=n;j++){
            if(i&(1<<(j-2))) bel[j]=bel[j-1];
            else bel[j]=++tot;
        }
        int x=1,ans=0;
        while(x!=-1&&x<=m) x=nxt(x),ans++;
        if(x!=-1) minn=min(minn,ans+tot-2);
    }
    printf("%d\n",minn);
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main(void){
    int A,B,C,D,E,x,y,cou=0,v[3];
    char S[3],s[3],X,Y;
    scanf("%d",&A);
    if(A/10==9){
        printf("Yes");
    }else if(A%10==9){
        printf("Yes");
    }else{
        printf("No");
    }
    return 0;
}

Measured memory_bytes: 128
N = int(input())
A = list(map(int, input().split()))


ans_n = max(A)
A.remove(ans_n)

ans_r = -1
diff_min = float('inf')

for a in A:
    diff = abs(ans_n / 2 - a)
    if diff < diff_min:
        diff_min = diff
        ans_r = a

print(ans_n, ans_r)


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

using namespace std;
#define TOSTRING(x) #x
#define SZ(x) (int)(x).size()
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REPR(i,n) for(int i=(n)-1;i>=0;i--)
#define ALL(s) (s).begin(), (s).end()
#define so(V) sort(ALL(V))
#define rev(V) reverse(ALL(V))
#define uni(v) v.erase( unique(ALL(v)) , v.end());
#define PAU system("pause")

typedef long long unsigned int llu;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<vb> vvb;
const int EPS = 1e-9;
const int MOD = 1e9 + 7;
const int INF = (1 << 30);
const double PI = acos(-1);

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int H, W;
	cin >> H >> W;
	vvb V;
	REP(i, H) {
		string s;
		cin >> s;
		bool white = true;
		REP(i, SZ(s)) {
			if (s[i] == '#') {
				white = false;
				break;
			}
		}
		if (white)continue;
		vb newv(W,false);
		REP(i, SZ(s)) {
			char c = s[i];
			if (c == '.')newv[i] = true;
		}
		V.push_back(newv);
	}
	vb VB(W,false);
	REP(i, W) {
		bool white = true;
		REP(j, SZ(V)) {
			if (!V[j][i]) {
				white = false;
				break;
			}
		}
		if (white)VB[i] = true;
	}
	REP(i, SZ(V)){
		bool white = true;
		REP(j, W) {
			if (VB[j])continue;
			if (V[i][j])cout << ".";
			else cout << "#";
			white = false;
		}
		if (!white)cout << endl;
	}
	PAU;
	return 0;
}


Measured memory_bytes: 504