akhauriyash/Code-Regression huggingface dataset:
#define DEBUG 0

/**
 * File    : A.cpp
 * Author  : Kazune Takahashi
 * Created : 5/4/2019, 9:01:22 PM
 * Powered by Visual Studio Code
 */

#include <iostream>
#include <iomanip>   // << fixed << setprecision(xxx)
#include <algorithm> // do { } while ( next_permutation(A, A+xxx) ) ;
#include <vector>
#include <string> // to_string(nnn) // substr(m, n) // stoi(nnn)
#include <complex>
#include <tuple>
#include <queue>
#include <stack>
#include <map> // if (M.find(key) != M.end()) { }
#include <set>
#include <functional>
#include <random> // auto rd = bind(uniform_int_distribution<int>(0, 9), mt19937(10101010));
#include <chrono> // std::chrono::system_clock::time_point start_time, end_time;
// start = std::chrono::system_clock::now();
// double elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(end_time-start_time).count();
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;

typedef long long ll;

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

// const int C = 1e6+10;
// const ll M = 1000000007;

int H, W;
string A[1010];
int visited[1010][1010];
typedef tuple<int, int, int> P;
queue<P> Q;

int main()
{
  cin >> H >> W;
  for (auto i = 0; i < H; i++)
  {
    cin >> A[i];
  }
  fill(&visited[0][0], &visited[0][0] + 1010 * 1010, -1);
  for (auto i = 0; i < H; i++)
  {
    for (auto j = 0; j < W; j++)
    {
      if (A[i][j] == '#')
      {
        Q.push(P(i, j, 0));
      }
    }
  }
  int ans = 0;
  while (!Q.empty())
  {
    int x = get<0>(Q.front());
    int y = get<1>(Q.front());
    int c = get<2>(Q.front());
    Q.pop();
    if (visited[x][y] == -1)
    {
      visited[x][y] = c;
      ans = max(ans, c);
      for (auto k = 0; k < 4; k++)
      {
        int nx = x + dx[k];
        int ny = y + dy[k];
        if (0 <= nx && nx < H && 0 <= ny && ny < W && visited[nx][ny] == -1)
        {
          Q.push(P(nx, ny, c + 1));
        }
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 29492
#include <iostream>
#include <string>
#include <cstring>
#include <cmath>
#include <cstdio>
#include <algorithm>
using namespace std;
#define int long long
signed main(){
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    cout<<max(a*b,c*d)<<endl;
    return 0;
}





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

string divide[4] = {"dream", "dreamer", "erase", "eraser"};

int main() {
  string S; cin >> S;
  
  reverse(S.begin(), S.end());
  for (int i = 0; i < 4; i++) reverse(divide[i].begin(), divide[i].end());
  
  //　端から切っていく
  bool can = true;
  for (int i = 0; i < S.size();) {
    bool can2 = false;
    for (int j = 0; j < 4; j++) {
      string d = divide[j];
      if (S.substr(i, d.size()) == d) { // 部分文字列がⅾと一致するか
        can2 = true;
        i += d.size();
      }
    }
    if (!can2) {
      can = false;
      break;
    }
  }
  
  if (can) cout << "YES" << endl;
  else cout << "NO" << endl;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

const long long mod = 1000000007;
const long long inf = 1e18;

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n;
    cin>>n;
    vi v;
    for(int i=1;i<=n;i++){
        int k;
        cin>>k;
        if(k==i){
            v.pb(1);        //change
        }
        else
            v.pb(0);
    }
    int ans=0;
    for(int i=0;i<n;i++){
        if(v[i]==1 && v[i+1]==0){
            v[i]=0;
            ans+=1;
        }
        else if(v[i]==1 && v[i+1]==1){
            v[i]=0;
            v[i+1]=0;
            ans+=1;
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 892
#include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
const double EPS = 1e-9;
typedef pair<int, int> P;
typedef unsigned int ui;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
const ld eps=1e-8;
struct edge { int to, cost; };
int V;
vector<edge> G[1000];
int d[1000][101];
int m, l, k, a, h;
int hos[1000];
int d2[1000];
void init(int n) {
	rep(i, n) {
		hos[i] = 0;
		G[i].clear();
	}
}
void dijkstra2(int s) {
	priority_queue<P, vector<P>, greater<P>>que;
	fill(d2, d2 + V, (int)MOD);
	d2[s] = 0;
	que.push(P(0, s));
	while (!que.empty()) {
		P p = que.top(); que.pop();
		int v = p.second;
		if (d2[v] < p.first)continue;
		for (int i = 0; i < (int)G[v].size(); i++) {
			edge e = G[v][i];
			if (d2[e.to] > d2[v] + e.cost) {
				d2[e.to] = d2[v] + e.cost;
				que.push(P(d2[e.to], e.to));
			}
		}
	}
}
void dijkstra(int s) {
	priority_queue<P, vector<P>, greater<P>>que;
	rep(i, 1000) {
		rep(j, 101) {
			d[i][j] = (int)MOD;
		}
	}
	d[s][m] = 0;
	que.push(P(0, s));
	while (!que.empty()) {
		P p = que.top(); que.pop();
		rep(j, m + 1) {
			if (d[p.second][j] == (int)MOD)continue;
			if (hos[p.second]) {
				d[p.second][m] = min(d[p.second][m], d[p.second][j] + m - j);
				if (j < m)continue;
			}
			int v = p.second;
			if (d[v][j] < p.first || v==h)continue;
			for (int i = 0; i < (int)G[v].size(); i++) {
				edge e = G[v][i];
				if (j - e.cost >= 0 && d[v][j] + e.cost < d[e.to][j - e.cost]) {
					d[e.to][j - e.cost] = d[v][j] + e.cost;
					que.push({ d[v][j] + e.cost, e.to });
				}
			}
		}
	}
}
int main() {
	while (cin >> V >> m >> l >> k >> a >> h, V) {
		init(V); int x,y,z;
		rep(i, l) {
			cin >> x; hos[x] = 1;
		}
		hos[h] = hos[a] = 1;
		rep(i, k) {
			cin >> x >> y >> z;
			G[x].push_back({ y,z });
			G[y].push_back({ x,z });
		}
		dijkstra2(a);
		if (d2[h] <= m) {
			cout << d2[h] << endl; continue;
		}
		dijkstra(a);
		if (d[h][m] == (int)MOD) {
			cout << "Help!" << endl;
		}
		else {
			cout << d[h][m]-m << endl;
		}
	}
	return 0;
}


Measured memory_bytes: 3688
// In the Name of God
#include<bits/stdc++.h>

#define test(t) int t; cin>>t; while(t--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORE(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int i=(a);i>=(b);i--)
#define ll long long int
#define em emplace_back
#define pb push_back
#define INF 1e7+5
#define MOD 1e9+7
#define print printf
#define in scanf
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);

using namespace std;

template<class type>
void displaySingle(type &arr)
{
	for(auto i:arr)
		cout<<i<<" ";
	cout<<endl;
}

template<class type>
void displayDouble(type &arr)
{
	for(auto &&i : arr) 
	{
    	for(auto &&j : i) 
    		cout << j << " ";
    	cout << std::endl;
  	}

}

int main()
{
	int n;
  	cin>>n;
  	if(n >= 400 && n <= 599)
      cout<<8<<endl;
  	else if(n >= 600 && n <= 799)
      cout<<7<<endl;
  	else if(n >= 800 && n <= 999)
      cout<<6<<endl;
  	else if(n >= 1000 && n <= 1199)
      cout<<5<<endl;
  	else if(n >= 1200 && n <= 1399)
      cout<<4<<endl;
  	else if(n >= 1400 && n <= 1599)
      cout<<3<<endl;
  	else if(n >= 1600 && n <= 1799)
      cout<<2<<endl;
  	else if(n >= 1800 && n <= 1999)
      cout<<1<<endl;
}

Measured memory_bytes: 3632
'''
制約
1≦N≦2000
1000≦Y≦2 * 10**7
N は整数である。
Yは1000の倍数である

'''
# from collections import deque # キュー、スタックに利用

# sys.stdin.readline() # 標準入力の高速化に利用
import sys
input = sys.stdin.readline

# import numpy as np


def main():
    '''メイン処理'''
    n, all_yen = map(int, input().split())

    is_OK = False
    # x,y,zを10000, 5000, 1000円札の枚数とする。
    # 10000x+5000y+1000z = all_yenかつx+y+z=nを満たす組み合わせを探す
    for x in range(n+1):
        if 10000*x > all_yen:
            # 合計が対象を超えたら、このforループでは条件を満たせないのでbreak
            break

        for y in range((n+1)-x):
            if (10000*x)+(5000*y) > all_yen:
                # 合計が対象を超えたら、このforループでは条件を満たせないのでbreak
                break
            
            # 3重ループではおそらくTLEになる。
            # 枚数条件を満たす値をzと置き、金額条件も満たせば正解とする
            z = n - x - y
            if 1000*z == (all_yen - (10000*x) - (5000*y)):
                is_OK = True
                print(x, y, z)
                break

        if is_OK:
            break
    
    if not is_OK:
        print('-1 -1 -1')


if __name__ == "__main__":
    # ファイル実行時に、main()関数を実行
    main()


Measured memory_bytes: 3064
/**
 *  author: mahfuzz
 *  created: 10.04.2020
**/
#include <bits/stdc++.h>
using namespace std;
#define all(a) (a).begin(), (a).end()
#define debug(x) cout << #x << ':' << x << "\n"
typedef long long ll;

int main(int argc, char* argv[]){
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);

    int k;
    cin >> k;
    int sum = 0;
    for(int i = 1; i <=k; ++i){
        for(int j = 1; j <= k; ++j){
            for(int l = 1; l <= k; l++){
                sum += __gcd(i, __gcd(j,  l));
            }
        }
    }
    
    cout << sum << "\n";

    return 0;
}



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

const int INF = 1e9;

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

  int m_sugar_water = 0;
  int m_sugar = 0;
  double degree = 0.0;

  for (int m_a = 0; m_a <= f; m_a+=100*a) {
    for (int m_b = 0; m_b <= f; m_b+=100*b) {
      if (m_a + m_b == 0) {
        continue;
      }
      for (int m_c = 0; m_c <= f; m_c+=c) {
        for (int m_d = 0; m_d <= f; m_d+=d) {
          if (m_a + m_b + m_c + m_d > f) {
            break;
          }
          if ((100+e)*(m_c+m_d) > e*(m_a+m_b+m_c+m_d)) {
            break;
          }
          double tmp_degree = (double)(m_c+m_d) / (m_a+m_b+m_c+m_d);
          if (tmp_degree > degree) {
            degree = tmp_degree;
            m_sugar_water = m_a + m_b + m_c + m_d;
            m_sugar = m_c + m_d;
          }
        }
      }
    }
  }
  if (m_sugar_water == 0) {
    m_sugar_water = 100 * a;
  }

  cout<<m_sugar_water<<" "<<m_sugar<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <sstream>
#include <cmath>
#include <math.h>
#include <string>
using namespace std;
typedef long long ll;
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, m, z = 0;
    string s[102] = {}, t[102] = {};
    cin >> n;
    for (int i = 0; i < n; i++) cin >> s[i];
    cin >> m;
    for (int i = 0; i < m; i++) cin >> t[i];
    for (int i = 0; i < n; i++) {
        int c = 0;
        int d = 0;
        for (int j = 0; j < n; j++) {
            if (s[i] == s[j]) c++;
        }
        for (int j = 0; j < m; j++) {
            if (s[i] == t[j]) d++;
        }
        z = max( z , c - d );
    }
    cout << z;
}


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

int main(int argc, char* argv[]) {
  queue<int> q;
  int x, y;

  cin >> x >> y;
  while(!(x == 0 && y == 0)){
    q.push(x);
    q.push(y);
    cin >> x >> y;
  }

  while(!q.empty()){
    x = q.front();
    q.pop();
    y = q.front();
    q.pop();
    for(int j = 0 ; j < x ; j++){
      for(int k = 0 ; k < y ; k++){
        if(j==0 || j==x-1 || k==0 || k==y-1){
          cout << "#";
        }else{
          cout << ".";
        }
      }
      cout << endl;
    }
    cout << endl;
  }

  return 0;
}

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

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

  int n, k;
  cin >> n >> k;

  vector<int> v(n, 0);
  for (int i = 0; i < k; i++)
  {
    int d;
    cin >> d;
    for (int j = 0; j < d; j++)
    {
      int a;
      cin >> a;
      v.at(a-1)++;
    }
  }
  int cnt = 0;
  for (int i = 0; i < v.size(); i++)
  {
    if(v.at(i) == 0)cnt++;
  }
  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 3664
#include <iostream>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <cassert>

#define REP(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define eb emplace_back

typedef long long ll;
using namespace std;

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    // cout << fixed << setprecision(20);
    int n,a,b;cin >> n >> a >> b;
    cout << min(n*a , b) << '\n';

    return 0;
}


Measured memory_bytes: 256
// 🐋💭
import Foundation

func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

func readInt() -> Int {
    return Int(readLine()!)!
}

func readDoubles () -> [Double] {
    return readLine()!.split(separator: " ").map { Double($0)! }
}

func readDouble() -> Double{
    return Double(readLine()!)!
}
///最大公約数を返す
func gcd(_ m:Int, _ n:Int) -> Int {
    if n == 0 {return m}
    return gcd(n, m % n)
}
///最小公倍数を返す
func lcm(_ m:Int, _ n:Int) -> Int {
    return m * n / gcd(m, n)
}

///素数判定(試し割り)
func isPrime(_ x:Int) -> Bool {
    if x <= 1 || x % 2 == 0 { return false }
    if x == 2 { return true }
    for i in stride(from: 3, to: Int(ceil(sqrt(Double(x)))), by: 2){
        if x % i == 0 {
            return false
        }
    }
    return true
}

//https://program-life.com/669
///実行速度の計測
func exectionTime(action: () -> Void) {
    let startDate = Date()
    action()
    let endDate = Date()
    print(endDate.timeIntervalSince(startDate))
}

// https://melheaven.hatenadiary.jp/entry/atcoder144
///約数の配列を返す
func makeDivisors(_ n:Int) -> [Int] {
    var divisors = [Int]()
    for i in 1..<Int(pow(Double(n), 0.5)) + 1 {
        if n % i == 0{
            divisors.append(i + n / i)
        }
    }
    
    return divisors
}

//https://riptutorial.com/ja/swift/example/14738/インデックスを知らずに配列から要素を削除する
extension Array where Element: Equatable {
    
    mutating func remove(_ element: Element) {
        _ = firstIndex(of: element).flatMap {
            self.remove(at: $0)
        }
    }
}

func binarySearch(rifgt:Int, key:Int, ary:[String]) -> Int{
    var left = 0
    var right = rifgt
    
    while abs(right - left) > 1 {
        let mid = left + (right - left) / 2
        
        if Int(ary[mid])! < key {
            left = mid
            
        } else {
            right = mid
        }
    }
    return left
}

func arrangement (prev:String, ary:[String], returnVal:[String]) -> [String] {
    var returnVal = returnVal
    if ary.count == 0 {
        returnVal.append(prev)
        return returnVal
    }
    
    for s in ary {
        let wprev = prev + s
        var wary = ary
        wary.remove(s)
        returnVal = arrangement(prev: wprev, ary: wary, returnVal: returnVal)
    }
    return returnVal
}

func main() {
    let nk = readInts()
    let (n, k) = (nk[0], nk[1])
    var aryH = [Int]()
    for _ in 0..<n {
        aryH.append(readInt())
    }
    
    aryH.sort(by: >)
    
    var mi = Int.max
    
    var left  = 0
    var right = k - 1
    
    while right < n && mi > 0{
        var m = 0
        m = aryH[left] - aryH[right]
        mi = min(mi, m)
        m -= aryH[left]
        left += 1
        right += 1
    }
    print(mi)
}
main()


Measured memory_bytes: 14308
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
using namespace std;
const long long mod=998244353;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-10;
const double INF=1e+10;
const double PI=acos(-1.0);
const int C_SIZE = 3121000;
long long fact[C_SIZE];
long long finv[C_SIZE];
long long inv[C_SIZE];
long long Comb(int a,int b){
 	if(a<b||b<0)return 0;
 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
}
void init_C(int n){
	fact[0]=finv[0]=inv[1]=1;
	for(int i=2;i<n;i++){
		inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
	}
	for(int i=1;i<n;i++){
		fact[i]=fact[i-1]*i%mod;
		finv[i]=finv[i-1]*inv[i]%mod;
	}
}
long long pw(long long a,long long b){
	long long ret=1;
	while(b){
		if(b%2)ret=ret*a%mod;
		a=a*a%mod;
		b/=2;
	}
	return ret;
}
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
double ABS(double a){return max(a,-a);}
// ここから編集しろ

int b[210000];
int ans[210000];
int main(){
	int a;scanf("%d",&a);
	for(int i=1;i<=a;i++)scanf("%d",b+i);
	for(int i=a;i>0;i--){
		int cur=0;
		for(int j=i+i;j<=a;j+=i){
			cur+=ans[j];
		}
		if(cur%2!=b[i])ans[i]=1;
	}
	vector<int>V;
	for(int i=1;i<=a;i++)if(ans[i]==1)V.push_back(i);
	printf("%d\n",V.size());
	for(int i=0;i<V.size();i++){
		if(i)printf(" ");
		printf("%d",V[i]);
	}printf("\n");
}

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

using namespace std;

int root(int i, vector<int> &par){
    if(par[i] == i) return i;
    return par[i] = root(par[i], par);
}

void unite(int i, int j, vector<int> &par){
    int ri = root(i, par);
    int rj = root(j, par);
    par[rj] = ri;
}

int main(void){
    int N, M;
    cin >> N >> M;
    vector<int> par(N);
    for(int i = 0; i < N; i++) par[i] = i;
    for(int i = 0; i < M; i++){
        int X, Y, Z;
        cin >> X >> Y >> Z;
        unite(X - 1, Y - 1, par);
    }
    set<int> s;
    for(int i = 0; i < N; i++) s.insert(root(i, par));
    cout << s.size() << endl;
    return 0;
}

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

using namespace std;
typedef long long ll;
typedef long double ld;

#define in(s) cin >> s
#define out(s) cout << s << endl
#define rep(i,n) for(int i=0; i<n; i++)
#define rept(i,a,b) for(int i=a; i<b; i++)
#define pcnt __builtin_popcount
#define pcntll(x) __builtin_popcountll(x)
#define DMAX DBL_MAX;
#define IMIN INT_MIN;
#define IMAX INT_MAX;

//const ll MOD = 1e9+7;
//const ll MOD = 998244353;
//const ll MAX = 3e5+1;
//const ll INF = 1e18;
//const ld PI = acos(-1L);

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    int N;
    in(N);
    vector<string> S(N);
    int a = 0, b = 0, c = 0, d = 0;
    rep(i, N) {
        in(S[i]);
        if(S[i] == "AC") a++;
        else if(S[i] == "WA") b++;
        else if(S[i] == "TLE") c++;
        else d++;
    }
    printf("AC x %d\nWA x %d\nTLE x %d\nRE x %d\n", a, b, c, d);

    return 0;
}


Measured memory_bytes: 6364
#include<bits/stdc++.h>
typedef long long ll;
const ll mod=1e9+7;
const ll inf=0x3f3f3f3f;
const int N=2e5+5;
using namespace std;
int a[N],b[N];
int main()
{
    int n;cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i]>>b[i];
    }
    sort(a+1,a+1+n);sort(b+1,b+1+n);
    int l,r;
    if(n%2==0)
    {
        l=a[n/2]+a[n/2+1];r=b[n/2]+b[n/2+1];
    }
    else
    {
        l=a[(n+1)/2];r=b[(n+1)/2];
    }
    cout<<r-l+1<<endl;
    return 0;
}


Measured memory_bytes: 5188
typedef long long ll;

#include <bits/stdc++.h>
using namespace std;
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int main(){
  ll a[3];
  cin>>a[0]>>a[1]>>a[2];
  sort(a,a+3);
  if(a[0] == 5 && a[1] == 5 && a[2] == 7){
    cout<<"YES"<<endl;
  }else{
    cout<<"NO"<<endl;
  }
}


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

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

bool find1fromcolumn(vector<vector<int> > vv, int c) {
    REP(i,vv.size()) {
        if (vv[i][c] == 1) return true;
    }
    return false;
}

int howmany2(int a, int b, int c) {
    int cnt = 0;
    if (a == 2) cnt++;
    if (b == 2) cnt++;
    if (c == 2) cnt++;
    return cnt;
}

void solve14(int a, int b, int c) {
    int n = a+b+c;
    int m;
    cin >> m;
    
    vector<int> ans;
    REP(i,n) ans.push_back(2);
    
    vector<vector<int> > vv;
    vv.resize(m);
    REP(i,m) vv[i].resize(n+3);
    REP(i,m) {
        REP(j,n+3) vv[i][j] = -1;
    }
    
    REP(i,m) {
        int p, q, r, s;
        scanf("%d%d%d%d", &p, &q, &r, &s);
        if (s) {
            vv[i][p-1] = 1; vv[i][n] = p;
            vv[i][q-1] = 1; vv[i][n+1] = q;
            vv[i][r-1] = 1; vv[i][n+2] = r;
            ans[p-1] = ans[q-1] = ans[r-1] = 1;
        }else {
            vv[i][p-1] = 2; vv[i][n] = p;
            vv[i][q-1] = 2; vv[i][n+1] = q;
            vv[i][r-1] = 2; vv[i][n+2] = r;
        }
    }
    
    REP(i,n) {
        if(find1fromcolumn(vv, i)) {
            REP(j,m) {
                vv[j][i] = 1;
            }
        }
    }
    
    REP(i,m) {
        //cout << howmany2(vv[i][vv[i][n]-1],vv[i][vv[i][n+1]-1],vv[i][vv[i][n+2]-1]) << endl;
        if (howmany2(vv[i][vv[i][n]-1],vv[i][vv[i][n+1]-1],vv[i][vv[i][n+2]-1]) == 1) {
            if (vv[i][vv[i][n]-1] == 2) {ans[vv[i][n]-1] = 0;}
            else if (vv[i][vv[i][n+1]-1] == 2) {ans[vv[i][n+1]-1] = 0;}
            else {ans[vv[i][n+2]-1] = 0;}
        }
    }
    
    REP(i,n) {
        if (ans[i] == 1 || ans[i] == 0) cout << ans[i] << endl;
        else cout << 2 << endl;
    }
}

int main() {
    int a, b, c;
    while(cin >> a >> b >> c, a+b+c) {
        solve14(a,b,c);
    }
    return 0;
}

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

int main(){
    string s;
    cin >> s;
    for(int i=0; i<s.size(); i++){
        if(s[i]=='?') s[i]='D';
    }
    
    cout << s << endl;
}


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

#define REP(i,n) for(int i=0;i<(n);++i)
#define ll long long
const long long INF = 1LL<<60;
const long long mod = 1e9 + 7;

int main(){
    int N;
    cin >> N;
    double x[10], y[10];
    REP(i,N) cin >> x[i] >> y[i];
    double G[N][N];
    REP(i,N){
        REP(j,N){
            if(i==j) continue;
            double dx = x[i]-x[j];
            dx *= dx;
            double dy = y[i]-y[j];
            dy *= dy;
            double d = dx + dy;
            d = sqrt(d);
            G[i][j] = d;
            G[j][i] = d;
        }
    }
    double sum = 0;
    double count = 0;
    int array[N];
    REP(i,N){
        array[i] = i;
    }
    do{
        REP(i,N-1){
            int p = array[i];
            int q = array[i+1];
            sum += G[p][q];
        }
        count++;
    }while(next_permutation(array,array+N));
    sum /= count;
    printf("%.10lf",sum);
    cout << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
 
int main(void)
{
    int n,p=0,w=0,g=0,y=0,ans=0;
    cin >> n;
    vector<char> b(n);
    for(int i = 0;i < n;i++){
        cin >> b[i];
        if(b[i] == 'P' && p==0)
            p=1;
        if(b[i] == 'W' && w==0)
            w=1;
        if(b[i] == 'G' && g==0)
            g=1; 
        if(b[i] == 'Y' && y==0)
            y=1;
    }
    ans = p + w + g + y;
    if(ans==4)
        cout << "Four" << endl;
    
    else
        cout << "Three" << endl;
    
    
    
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    
    int n;
    int a;
    int x=0,y=0,z=0;
    scanf("%d",&n);
    for(;~scanf("%d",&a);){
        if(a%2){
            z--;
        }else if(a%4){
            y++;
        }else{
            z++;
        }
    }
    //printf("%d %d\n",y,z);
    puts((!y&&z>-2||y&&z+1)?"Yes":"No");
}

Measured memory_bytes: 1636
#!/Library/Frameworks/Python.framework/Versions/3.5/bin/python3

n = int(input())

if n <= 111:
    print('111')
elif n <= 222:
    print('222')
elif n <= 333:
    print('333')
elif n <= 444:
    print('444')
elif n <= 555:
    print('555')
elif n <= 666:
    print('666')
elif n <= 777:
    print('777')
elif n <= 888:
    print('888')
else:
    print('999')


Measured memory_bytes: 3060
#include <stdio.h>
#include <string.h>

int main() {

    int x;
    scanf("%d", &x);
    
    if(x>=1800){
        printf("1");
    }else if(x>=1600) {
        printf("2");
        
    } else if (x >= 1400) {
        printf("3");

    } else if (x >= 1200) {
        printf("4");

    } else if (x >= 1000) {
        printf("5");

    } else if (x >= 800) {
        printf("6");

    } else if (x >= 600) {
        printf("7");

    } else if (x >= 400) {
        printf("8");
 
    }
    

    return 0;

}

Measured memory_bytes: 1660
import math

pi = 3.14159265358979
a, b, h, m = map(int, input().split())

hrad = math.radians(h*30+m*0.5)
mrad = math.radians(m*6)

if hrad >= mrad:
	rad = min(hrad-mrad, 2*pi-(hrad-mrad))
else:
	rad = min(mrad-hrad, 2*pi-(mrad-hrad))

ans = abs((a**2+b**2-2*a*b*math.cos(rad))**0.5)

print(ans)

Measured memory_bytes: 9524
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <cstring> //memset(dp,0,sizeof(dp))
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define repp(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
//小数点以下　cout << fixed << setprecision(10) << num << endl;
//桁数はlog10(mid)でやれ　log(mid)/log(10)はWA
//long*long<0で判定するな
//開区間と閉区間
//アルファベットが何番目かは x=s[i]-'a'
//bfsはmain()内で　rep(i,h)rep(j,w)rep(i,4)でバグ
//切り上げ：(a+(b-1))/b
//32bit以上は 1ull<<j]
// map 初期値0 for(auto itr=mp.begin();itr!=mp.end();++itr) itr->fi itr->se で全探索
// for(auto u:mp) u.fi u.se も可能
//n個のgcd,lcmは一つずつみて更新していく
const int ma=1000000000;
int main(){
    int n; cin >> n;
    int mi=-1;
    int ans=0;
    rep(i,n){
        int p; cin >> p;
        if(mi==-1){
            mi=p;
            ans++;
            continue;
        }
        if(mi>=p){
            mi=p;
            ans++;
        }
    }
    cout << ans;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
from sys import stdin

w,h,n = [int(x) for x in stdin.readline().rstrip().split()]
board = [[1] * w for i in range(h)]
ans = 0

for i in range(n):
    x,y,a = [int(x) for x in stdin.readline().rstrip().split()]
    if a == 1:
        for j in range(h):
            for k in range(x):
                board[j][k] = 0
    elif a == 2:
        for j in range(h):
            for k in range(x,w):
                board[j][k] = 0
    elif a == 3:
        for j in range(y):
            for k in range(w):
                board[j][k] = 0            
    elif a == 4:
        for j in range(y,h):
            for k in range(w):
                board[j][k] = 0

for i in range(h):
    ans += sum(board[i])

print(ans)

Measured memory_bytes: 3064
n=int(input())
s=input()
ans=0
def z_algo(S):
    N=len(S)
    A=[0]*N
    i=1;j=0
    A[0]=l=len(S)
    while i<l:
        while i+j<l and S[j]==S[i+j]:
            j+=1
        if not j:
            i+=1
            continue
        A[i]=j
        k=1
        while l-i>k<j-A[k]:
            A[i+k]=A[k]
            k+=1
        i+=k;j-=k
    return A

for i in range(n):
    l=z_algo(s[i:])
    m=len(l)
    for j in range(m):
        ans=max(ans,min(j,l[j]))
print(ans)







Measured memory_bytes: 49116
#include <iostream>
#include <iomanip>
#include <fstream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>

#define _GLIBCXX_DEBUG
#define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)
using namespace std;
using vi = vector<int64_t>;
using vvi = vector<vi>;

int main(int argc, const char * argv[]) {
    // fasten cin
    cin.tie(0);
    ios::sync_with_stdio(false);
    // implement
    int64_t a,b;
    cin >> a >> b;
    cout << (a+b>9?"error":to_string(a+b)) << endl;
}


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

ll INF = 1e+18;

struct UnionFind {
    vector<int> par, rank, sz;
    
    UnionFind(int n) : par(n), rank(n, 0), sz(n, 1) {
        for (int i = 0; i < n; ++i) par[i] = i;
    }
    void init(int n) {
        par.resize(n); rank.resize(n); sz.resize(n);
        for (int i = 0; i < n; ++i) par[i] = i, rank[i] = 0, sz[i] = 1;
    }

    int root(int n)
    {
      if(par[n] == n) return n;
      else {
        return par[n] = root(par[n]);
      }
    }

    bool is_same(int a, int b)
    {
      return root(a) == root (b); 
    }

    int size(int n)
    {
      return sz[root(n)];
    }

    bool merge(int a, int b)
    {
      int rt_a = root(a);
      int rt_b = root(b);
      if(rt_a == rt_b) return false;
      if (rank[rt_a] < rank[rt_b]) swap(rt_a, rt_b);
      if (rank[rt_a] == rank[rt_b]) ++rank[rt_a];
      par[rt_b] = rt_a;
      sz[rt_a] += sz[rt_b];
      return true;
    }

};


int 
main()
{
  int N, M; cin >> N >> M;
  vector<int> arr(N);
  rep(i, 0, N){
    int tmp; cin >> tmp;
    --tmp;
    arr[i] = tmp;
  }
  UnionFind uf(N);
  rep(i, 0, M){
    int x, y; cin >> x >> y;
    --x, --y;
    uf.merge(x, y);
  }

  int ans = 0;
  rep(i, 0, N){
    if(uf.is_same(i, arr[i])) ++ans;
  }

  cout << ans << endl;

}


Measured memory_bytes: 4724
#include <cstdio>
bool judge(int x){
    while(x){
        if(x%10==3) return true;
        x /= 10;
    }
    return false;
}
void call(int y){
    for(int i=1;i<=y;i++){
        if(i%3 == 0 || judge(i)){
            printf(" %d",i);
        }
    }
    printf("\n");
}
int main(){
    int n;
    scanf("%d",&n);
    call(n);
    return 0;
}


Measured memory_bytes: 2708
#include<iostream>
#include<string>
#include<cmath>
#include<cstdlib>
#include<vector>
#include<map>
#include<set>
#include<algorithm>
#include<queue>

using namespace std;

string s;

int main(){
  int n;cin>>n;
  int ans = 0;
  for(int i=0;i<n;i++){
    int r,l;cin>>r>>l;
    ans+=(l-r+1);
  }
  cout<<ans<<endl;
  return 0;
}


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

#define ms(s, n) memset(s, n, sizeof(s))
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FORd(i, a, b) for (int i = (a) ; i >= (b); i--)
#define FORall(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define sz(a) int((a).size())
#define present(t, x) (t.find(x) != t.end())
#define all(a) (a).begin(), (a).end()
#define uni(a) (a).erase(unique(all(a)), (a).end())
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define sp system("pause")
#define prec(n) fixed<<setprecision(n)
#define bit(n, i) (((n) >> (i)) & 1)
#define bitcount(n) __builtin_popcountll(n)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<pi> vii;
const int MOD = (int) 1e9 + 7;
const int INF = (int) 1e9;
const ll LINF = (ll) 1e18;
const ld PI = acos((ld) -1);
const ld EPS = 1e-9;
const int N = (int) 1e5 + 10;
void TimeExecution() {
    cout << "\n\n===>> Time Execution: " << clock() / (double)1000 << " sec(s).";
}
int t;
double cal(double a)
{
    return (a * a * a);
}
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    /*
    #ifndef ONLINE_JUDGE
        freopen("in.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
    #endif
    */
    double l;
    cin >> l;
    cout << prec(9) << cal(l / 3.0);
    return 0;
}


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

string Myshuffle(string str, int h)
{
	string s1, s2;
	int l = str.length();
	s1 = str.substr(0, h);
	s2 = str.substr(h, l-h);

	return (s2 + s1);
}

int main()
{
	while (true)
	{
		string str;
		cin >> str;
		if (str[0] == '-') break;

		int m = 0;
		cin >> m;

		for (int i = 0; i < m; i++) {
			int h = 0;
			cin >> h;
			str = Myshuffle(str, h);
		}

		cout << str << endl;
	}
	
	return 0;
}


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

#define pb push_back 

int main()
{	int ac=0,wa=0,tle=0,re=0 ; 
	
	vector<string> a ;
	string input ;
	int n ;
	
	cin >> n; 
	
	for(int i =0 ; i<n ; i++)
	{
		
		cin >> input ;  a.pb(input) ;
		if ( a[i]== "AC")
		ac++ ;
		else if ( a[i]== "WA")
		wa++;
		else if ( a[i]== "TLE")
		tle++ ;
		else if ( a[i]== "RE")
		re++;
		
		}
	
	cout << "AC x " << ac <<endl ;
	cout << "WA x " << wa << endl ;
	cout << "TLE x " << tle <<endl ;
	cout << "RE x " << re ;
	 
	
	
	}


Measured memory_bytes: 7420
#include <iostream>
#include <utility>
#include <vector>
#include <algorithm>
#include <functional>
#include <string>
#include <list>
#include <stack>
#include <set>
#include <cctype>
#include <cmath>

using namespace std;
typedef pair<int, int> P;
typedef pair<int, P> PP;

#define ll long long
#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)


int main() {

	string s;
	cin >> s;
	int ans = 0;

	for (int i = 0; i < s.size(); i++)
	{
		int x = 0;
		if (s[i] == 'A' || s[i] == 'C' || s[i] == 'G' || s[i] == 'T') {
			for (int j = i; j < s.size(); j++)
			{
				if (s[j] == 'A' || s[j] == 'C' || s[j] == 'G' || s[j] == 'T') {
					x++;
				}
				else {
					break;
				}
			}
			ans = max(ans, x);
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define mod 1000000007
#define fi first
#define se second
#define pii pair<int,int>
#define int long long
#define endl '\n'
#define pll pair<long long,long long>
//#define LONGLONG_MAX 10000000000000000
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
long long power(long long a,long long b){
    long long ans=1;
    while(b>0){
        if(b&1){ans=(ans*a)%mod;}
                a=(a*a)%mod;
                b>>=1;
        }
    return ans;
        
}

int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    string s,t;
    cin>>s>>t;
    int a,b;
    cin>>a>>b;
    string u;
    cin>>u;
    if(u==s)a--;
    else b--;
    cout<<a<<' '<<b;
    return 0;
}

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

#[allow(dead_code)]
fn getline() -> Vec<String> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok().unwrap();
    s.split(' ').map(|x| x.trim().to_string()).collect::<Vec<String>>()
}

#[allow(dead_code)]
fn get<T: std::str::FromStr>(s: &String) -> T {
    s.parse().ok().unwrap()
}

fn main() {
    let modulo = 1e9 as usize + 7;
    let n: usize = get(&getline()[0]);
    let mut is_prime = vec![true; n+1];
    is_prime[0] = false;
    is_prime[1] = false;
    for i in 2..n+1 {
        if !is_prime[i] {
            continue;
        }
        for j in 2.. {
            if i * j > n {
                break;
            }
            is_prime[i * j] = false;
        }
    }
    let primes: Vec<_> = (0..n+1).filter(|&x| is_prime[x]).collect();
    let mut count_prime = vec![1; n+1];
    for i in 1..n+1 {
        let mut x = i;
        for &p in primes.iter() {
            if x == 1 {
                break;
            }
            while x % p == 0 {
                count_prime[p] += 1;
                x /= p;
            }
        }
    }
    let ans = count_prime.iter()
        .fold(1, |prod, &x| (prod * x) % modulo);
    println!("{}", ans);
}


Measured memory_bytes: 4352
n = int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
# c.sort()
s = 0
j=0
for i in range(n):
  s+=b[a[i]-1]
  # print(a[i])
  try:
    if (a[i+1]-a[i])==1:
      s+=c[a[i]-1]
      j+=1
        # print(c[j],a[i],a[i-1])
  except:
    pass
print(s)


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main(void){
  long long n;
  cin >> n;
  vector<long long> a(n);
  long long ans=0;
  for(long long i=0; i<n; i++){
    cin >> a[i];
    ans ^= a[i];
  }
  long long k;
  for(long long i=0; i<n; i++){
    k = ans ^ a[i];
    cout << k << ' ';
  }
}

Measured memory_bytes: 4824
using System;

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {

            int a, b, A, B, C, max;

            var word = Console.ReadLine().Split(' ');
            a = int.Parse(word[0]);
            b = int.Parse(word[1]);

            A = a + b;
            B = a - b;
            C = a * b;

            if (A >= B && A >= C)
                max = A;
            else if (B >= A && B >= C)
                max = B;
            else
                max = C;


            Console.WriteLine(max);

            Console.ReadKey();
        }
    }
}


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

int main() {
	int a, b;
	cin >> a >> b;
	for (int i = 0; i < 20000; i++) {
		if (i * 8 / 100 == a && i / 10 == b) {
			cout << i << endl;
			return 0;
		}
	}
	cout << "-1" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<sstream>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<complex>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cassert>

#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define mp make_pair
#define pb push_back
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define dbg(x) cerr<<__LINE__<<": "<<#x<<" = "<<(x)<<endl

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
const int inf = (int)1e9;
const double INF = 1e12, EPS = 1e-9;

const int dy[] = {-1, 0, 1, 0}, dx[] = {0, -1, 0, 1};
int h, w;
int n[512][512][4];
char in[512][512];
inline int next(int y, int x, int d){
	if(y < 0 || y >= h || x < 0 || x >= w || n[y][x][d] == -2) return -2;
	if(in[y][x] != '.') return n[y][x][d] = y * w + x;
	if(n[y][x][d] >= 0 && in[n[y][x][d] / w][n[y][x][d] % w] != '.') return n[y][x][d];
	return n[y][x][d] = next(y + dy[d], x + dx[d], d);
}

int main(){
	cin >> h >> w;
	rep(i, h) cin >> in[i];
	memset(n, -1, sizeof(n));
	
	int ans = 0;
	while(1){
		bool update = 0;
		rep(i, h) rep(j, w) if(in[i][j] == '.'){
			rep(d, 4) rep(e, d){
				int a = next(i, j, d), b = next(i, j, e);
				if(a < 0 || b < 0) continue;
				int ay = a / w, ax = a % w;
				int by = b / w, bx = b % w;
				if(in[ay][ax] != in[by][bx]) continue;
				in[ay][ax] = in[by][bx] = '.';
				ans += 2;
				update = 1;
			}
		}
		if(!update) break;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 5532
# https://atcoder.jp/contests/abc159/tasks/abc159_a

N, M = map(int, input().split())

# 奇数同士の数
odd_odd = M * (M - 1) / 2

# 偶数同士の数
even_even = N * (N - 1) / 2

print(int(even_even + odd_odd))

Measured memory_bytes: 2940
#include<bits/stdc++.h>
#define ll long long
#define rgi register int
#define rgl register ll
#define maxn 100005
#define mod 998244353
#define inf 1000000007
namespace lib
{
	using namespace std;
	class fastio
	{
		private:
			#define _NUMLEN 111
			char _num[_NUMLEN],_ch;
			int _f,_head;
		public:
			inline void gc(char & _c) {_c=getchar();}
			template<typename _T> inline fastio & operator - (_T & _x)
			{
				_x=0;
				while(!isdigit(_ch)) _f|=_ch=='-',gc(_ch);
				while(isdigit(_ch)) _x=(_x<<1)+(_x<<3)+(_ch^48),gc(_ch);
				_f&&(_x=-_x,_f=0);
				return *this; 
			}
			inline void pc(char _c) {putchar(_c);}
			template<typename _T> inline fastio & operator + (_T _x)
			{
				_T _k;
				if(_x==0) {pc('0'),pc(' ');return *this;}
				if(_x<0) pc('-'),_x=-_x;
				while(_x>0) _k=_x/10,++_head,_num[_head]=(_x-(_k<<1)-(_k<<3))^48,_x=_k;
				while(_head>0) pc(_num[_head]),--_head;
				pc(' ');
				return *this; 
			}
			#define endl pc('\n')
		fastio() {_f=0,_head=0,_ch=' ';}
	}io;
}using namespace lib;

signed main()
{
//	freopen("ttin.in","r",stdin);
//	freopen("ttout.out","w",stdout);
//	ios::sync_with_stdio(false);
//	cin.tie(0),cout.tie(0);
	int a,b,c;
	io-a-b-c;
	if(a+b+c>=22)puts("bust");
	else puts("win");
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const long long MOD=1e9+7;

int main() {
  int n;
  string s;
  cin>>n>>s;
  char sw[]={'S','W'};
  rep(i,4){
    vector<int> animals(n);
    animals[0]=i/2;
    animals[1]=i%2;
    rep(j,n-2){
      if(s[j+1]=='o'){
        if(animals[j]==animals[j+1]) animals[j+2]=0;
        else animals[j+2]=1;
      }
      else{
        if(animals[j]==animals[j+1]) animals[j+2]=1;
        else animals[j+2]=0;
      }
    }
    
    bool ok=true;
    if(animals[0]==0){
      if(animals[n-1]==animals[1] && s[0]=='x') ok=false;
      if(animals[n-1]!=animals[1] && s[0]=='o') ok=false;
    }
    else{
      if(animals[n-1]==animals[1] && s[0]=='o') ok=false;
      if(animals[n-1]!=animals[1] && s[0]=='x') ok=false;
    }
    
    if(animals[n-1]==0){
      if(animals[n-2]==animals[0] && s[n-1]=='x') ok=false;
      if(animals[n-2]!=animals[0] && s[n-1]=='o') ok=false;
    }
    else{
      if(animals[n-2]==animals[0] && s[n-1]=='o') ok=false;
      if(animals[n-2]!=animals[0] && s[n-1]=='x') ok=false;
    }
    
    if(ok){
      rep(k,n) cout<<sw[animals[k]];
      cout<<endl;
      return 0;
    }
  }
  cout<<"-1"<<endl;
  return 0;
}


Measured memory_bytes: 1016
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <unordered_map>
#include <cmath>
#include <utility> // pair make_pair
#include <algorithm>
#include <iomanip>

#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,63,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define ll long long
//#define int ll

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


struct UnionFind {
  vector<int> par; // 親ノード
  vector<int> rank; // ランク

  UnionFind(int n = 1) {
    init(n);
  }

  void init(int n = 1) {
    par.resize(n);
    rank.resize(n);
    for (int i = 0; i < n; i++) {
      par[i] = i;
      rank[i] = 0;
    }
  }

  int root(int x) {
    if (par[x] == x) {
      return x;
    } else {
      int r = root(par[x]);
      return par[x] = r;
    }
  }

  bool issame(int x, int y) {
    return root(x) == root(y);
  }

  bool merge(int x, int y) {
    x = root(x); y = root(y);
    if (x == y) return false;
    if (rank[x] < rank[y]) swap(x, y); // y is smaller, x is bigger
    if (rank[x] == rank[y]) rank[x]++;
    par[y] = x; // parent of y is x
    return true;
  }
  
};

int Input[100100];

int main() {
  int N; cin >> N;
  UnionFind Forest(N);
  
  int M; cin >> M;
  for (int i = 0; i < N; i++) {
    cin >> Input[i];
    Input[i]--;
  }

  for (int i = 0; i < M; i++) {
    int a, b; cin >> a >> b;
    a--; b--;
    Forest.merge(a, b);
  }

  int cnt = 0;
  for (int i = 0; i < N; i++) {
    if (Forest.issame(i, Input[i])) cnt++;
  }

  cout << cnt << endl;
}

  


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

using namespace std;

#define MAX 301
 
int dp[MAX][MAX];
int arr[MAX][MAX];
 
void init(int N,int M){
  for(int i = 0 ; i <= N ; i++){
    for(int j = 0 ; j <= M ; j++){
      dp[i][j] = 0;
      arr[i][j] = MAX;
    }
  }
}

string getStr(string &L,string &R,int l,int r){
  for(int i = 0 ; i < l ; i++){
    for(int j = 0 ; j < r ; j++){
      if(L[i] == R[j]){
        dp[i+1][j+1] = dp[i][j]+1;
        arr[i+1][j+1] = 0;
      }else{
        if(dp[i][j+1] < dp[i+1][j]){
          dp[i+1][j+1] = dp[i+1][j];
          arr[i+1][j+1] = -1;
        }else{
          dp[i+1][j+1] = dp[i][j+1];
          arr[i+1][j+1] = 1;
        }
      }
    }
  }
  string res;
  for(int i = l, j = r ; i > 0 && j > 0 ; ){
    if(!arr[i][j]){
      res += L[i-1];
      i--; j--;
    }else if(arr[i][j] == 1){
      i--;
    }else{
      j--;
    }
  }
  reverse(res.begin(),res.end());
  return res;
}

int main(){
  string str;
  while(cin >> str, str != "#END"){
    int len = str.size(),res = 0;
    string res_str;
    for(int i = 1 ; i < len ; i++){
      string L = str.substr(0,i);
      string R = str.substr(i);
      int l = L.size(),r = R.size();
      init(l,r);
      string repS = getStr(L,R,l,r);
      l = repS.size();
      if(res < l){
        res = l;
        res_str = repS;
      }
    }
    cout << res_str << endl;
  }
  return 0;
}

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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define vi vector<ll>
#define sll(x) scanf("%lld",&x)
#define prll(x) printf("%lld ",x)
#define pri(x) printf("%d ",x)
#define si(x) scanf("%d",&x)
#define el printf("\n")
#define pb push_back
#define f first
#define s second
#define arrondi(a) (long long)floor(a+0.5);
#define NIL -1
ll N=500005;
ll MAX=9223372036854775807;
ll MOD=1000000007;
long double PI =4*atan(1);

int main()
{
	IOS;
    cout.precision(30);
    ll a,b; cin >> a >> b;
    if (a==b)
    {
        cout << 0 << "\n";
    }
    else
    {
        if ((a+b)%2==0)
            cout << (a+b)/2 <<  "\n";
        else cout << "IMPOSSIBLE\n";
    }
    return 0;
}


Measured memory_bytes: 256
function Main(input) {
  var lines = input.split('\n');
  var line_1 = lines[0].split(' ');
  var N = Number(line_1[0]);
  var M = Number(line_1[1]);
  var A = lines[1].split(' ');
  var holiday = N;
  for (var i = 0; i < M; i ++) {
    holiday = holiday - Number(A[i]);
  }

  if (0 <= holiday) {
    console.log(holiday);
  } else {
    console.log(-1);
  }
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 30788
import random as rng
import itertools as it
import collections as col
import heapq as hq
import sys
import copy as cp
sys.setrecursionlimit(10**9)


def dump_impl(*objects):
    print(*objects, file=sys.stderr)


def dump_dummy(*objects):
    pass


dump = dump_impl if "DEBUG" in sys.argv else dump_dummy

N, A, B, C = map(int, input().split())
l = [int(input()) for i in range(N)]
ans = 10**20
for use in it.product({0, 1, 2, 3}, repeat=N):
    ABC = {0: [], 1: [], 2: [], 3: []}
    for i, u in enumerate(use):
        dump(i, u, use)
        ABC[u].append(l[i])
    if any([len(ABC[u]) == 0 for u in {1, 2, 3}]):
        continue
    ans = min(ans, sum([abs(sum(ABC[i]) - x) + (len(ABC[i]) - 1)
                        * 10 for i, x in zip([1, 2, 3], [A, B, C])]))
print(ans)


Measured memory_bytes: 3828
#include<stdio.h>
#include<stdlib.h>
int main()
{
int n,k;
scanf("%d%d",&n,&k);
int *b=(int*)calloc(n,sizeof(int));

while(k--)
{
int d;
scanf("%d",&d);
int arr[d];
for(int i=0;i<d;i++)
{
scanf("%d",&arr[i]);
b[arr[i]-1]=1;

}
}
int sum=0;
for(int i=0;i<n;i++)
{
if(b[i]==0)
{
sum=sum+1;
}
}
printf("%d",sum);
return 0;

}

Measured memory_bytes: 1732