akhauriyash/Code-Regression huggingface dataset:
#include <map>
#include <set>
#include <ctime>
#include <queue>
#include <stack>
#include <cmath>
#include <vector>
#include <bitset>
#include <cstdio>
#include <cctype>
#include <string>
#include <numeric>
#include <cstring>
#include <cassert>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std ;
#define int long long
#define rep(i, a, b) for (ll i = (a); i <= (b); ++i)
#define per(i, a, b) for (ll i = (a); i >= (b); --i)
#define loop(it, v) for (auto it = v.begin(); it != v.end(); it++)
#define cont(i, x) for (ll i = head[x]; i; i = edge[i].nex)
#define clr(a) memset(a, 0, sizeof(a))
#define ass(a, cnt) memset(a, cnt, sizeof(a))
#define cop(a, b) memcpy(a, b, sizeof(a))
#define lowbit(x) (x & -x)
#define all(x) x.begin(), x.end()
#define SC(t, x) static_cast <t> (x)
#define ub upper_bound
#define lb lower_bound
#define pqueue priority_queue
#define mp make_pair
#define pb push_back
#define pof pop_front
#define pob pop_back
#define fi first
#define se second
#define y1 y1_
#define Pi acos(-1.0)
#define iv inline void
#define enter putchar('\n')
#define siz(x) ((ll)x.size())
#define file(x) freopen(x".in", "r", stdin),freopen(x".out", "w", stdout)
typedef double db ;
typedef long long ll ;
typedef unsigned long long ull ;
typedef pair <ll, ll> pii ;
typedef vector <ll> vi ;
typedef vector <pii> vii ;
typedef queue <ll> qi ;
typedef queue <pii> qii ;
typedef set <ll> si ;
typedef map <ll, ll> mii ;
typedef map <string, ll> msi ;
const ll maxn = 2e6 + 100 ;
const ll inf = 0x3f3f3f3f ;
const ll iinf = 1 << 30 ;
const ll linf = 2e18 ;
const ll mod = 998244353 ;
const double eps = 1e-7 ;
template <class T = ll> T chmin(T &a, T b) { return a = min(a, b);}
template <class T = ll> T chmax(T &a, T b) { return a = max(a, b);}
template <class T = ll> T read()
{
	T f = 1, a = 0;
	char ch = getchar() ;
	while (!isdigit(ch)) { if (ch == '-') f = -1 ; ch = getchar() ; }
	while (isdigit(ch)) { a =  (a << 3) + (a << 1) + ch - '0' ; ch = getchar() ; }
	return a * f ;
}

ll n, m;

ll sz[maxn];

vi edge[maxn], p;

ll flag;

void dfs(ll now, ll last)
{
	if(now == p[1]) return;
	if(now == p[0] && last) return (void)(flag = 1);
	for(ll to : edge[now]) if(to != last) dfs(to, now);
}

signed main()
{
	n = read(), m = read();
	rep(i, 1, m)
	{
		ll u = read(), v = read();
		edge[u].pb(v), edge[v].pb(u);
		sz[u] ++, sz[v] ++;
	}
	rep(i, 1, n)
	{
		if(sz[i] & 1) return puts("No"), 0;
		if(sz[i] == 4) p.pb(i);
	}
	rep(i, 1, n) if(sz[i] > 5) return puts("Yes"), 0;
	if(siz(p) <= 1) return puts("No"), 0;
	if(siz(p) > 2) return puts("Yes"), 0;
	dfs(p[0], 0);
	if(flag) puts("Yes");
	else puts("No");
	return 0;
}

Measured memory_bytes: 55492
import java.io.PrintWriter;
import java.util.*;

public class Main {

    static String br = System.getProperty("line.separator");
    static Scanner sc  = new Scanner(System.in);

    public static void main(String[] args){
        Long A = nextLong();
        Long B = nextLong();
        Long C = nextLong();

        Long max = B+C;

        if(C >= B) {
            C -= B;
            B = 0L;
        }else{
            B -= C;
            C = 0L;
        }

        if(C >= A){
            C -= A;
        }else{
            C = 0L;
        }

        println(C>0 ? max-C+1 : max);
    }

    static int nextInt(){
        return Integer.parseInt(next());
    }
    static Long nextLong(){
        return Long.parseLong(next());
    }
    static String next(){
        return sc.next();
    }
    static void println(Object o){
        PrintWriter out = new PrintWriter(System.out);
        out.println(o);
        out.flush();
    }
   static void print(Object o){
       PrintWriter out = new PrintWriter(System.out);
       out.print(o);
       out.flush();
    }
}


Measured memory_bytes: 22996
/*	MASTER HAS FAILED MORE TIMES
	THAN BEGINNER HAS EVER TRIED
*/

#include <bits/stdc++.h>

using namespace std;

#define endl            '\n'
#define mem(a, n)       memset(a, n, sizeof(a))
#define repeat(n)       for(int i=0; i<n; i++)
#define Unique(n)       (n).erase(unique(all(n)), (n).end())
#define isPowerOfTwo(n) (n && !(n & (n - 1)))
#define NumofDigits(n)  ((int)log10(n)+1)
#define all(a)          a.begin(), a.end()

unsigned long long pow(long long base, long long power);

long long gcd(long long a, long long b){ return a%b ? gcd(b, a%b) : b; }
long long lcm(long long a, long long b){ return a*b/gcd(a, b); }

void quicken(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); }

/*
    Special functions:
        find_by_order(k) --> returns iterator to the kth largest element counting from 0
        order_of_key(val) --> returns the number of items in a set that are strictly smaller than our item
*/

int main(){
    quicken();

    int a, b, c; cin >> a >> b >> c;
    if(a+b+c >= 22) cout << "bust";
    else cout << "win";

    return 0;
}

unsigned long long pow(long long base, long long power){
    if(power==0) return 1;
    if(power==1) return base;

    unsigned long long ans = pow(base, power/2);
    ans *= ans; /// ans = (ans%mod)*(ans%mod);

    if(power&1) return ans*base; /// (ans%mod)*(base%mod);
    return ans;
}


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


def get_candidate(K):
    l = []
    b = 0
    for i in range(30)[::-1]:
        if K&(1<<i):
            l.append(b + (1<<i) - 1)
            b += (1<<i)
    return l+[K]


def get_ans(K, l):
    ans = 0
    for i, j in l:
        if i|K==K:
            ans += j
    return ans


def solve():
    N, K = map(int, input().split())
    l = [tuple(map(int, input().split())) for _ in range(N)]
    ans = 0
    for k in get_candidate(K):
        ans = max(ans, get_ans(k, l))
    print(ans)


if __name__ == "__main__":
    solve()


Measured memory_bytes: 85168
#include <iostream>
#include <algorithm>
#include <vector>
#define flush fflush(stdout)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pl;
const int mod = (int)1e9 + 7, INF = (int)1e9;
const int di[4] = { 1,0,-1,0 }, dj[4] = { 0,1,0,-1 };


int main(void) {
	int n, k, i, j;
	vector<int> a, b;

	scanf("%d%d", &n, &k);

	for (i = 1; i < n; i++) {
		a.push_back(0);
		b.push_back(i);
	}

	for (i = 1; i < n - 1; i++) for (j = i + 1; j < n; j++) {
		if (k > 0) {
			k--;
		}
		else {
			a.push_back(i);
			b.push_back(j);
		}
	}

	if (k > 0) {
		printf("-1\n");
	}
	else {
		printf("%d\n", a.size());
		for (i = 0; i < a.size(); i++) {
			printf("%d %d\n", a[i] + 1, b[i] + 1);
		}
	}

	return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<stack>
#include<set>
#include<climits>
#include<cstdlib>
#include<cmath>
#include<string>

using namespace std;

#define INF 1 << 29
#define LL long long int

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

    int n;
    cin >> n;
    string str;
    cin >> str;

    vector<int> w(n+2,0),e(n+2,0);

    for(int i = 1; i < n+1; i++){
        e[i] = e[i-1];
        w[i] = w[i-1];
        if(str[i-1] == 'E'){
            e[i]++;
        }else{
            w[i]++;
        }
    }

    e[n+1] = e[n];
    w[n+1] = w[n];

    LL min = INF;

    for(int i = 1; i < n+1; i++){
        if(min > w[i-1] + e[n+1] - e[i]){
            min = w[i-1] + e[n+1] - e[i];
        }
    }

    cout << min << endl;
    
    return 0;
}

Measured memory_bytes: 2964
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <numeric>
using namespace std;

int main(void){
    long long int n;
    cin >> n;
    long long int num[5], check[5];
    long long int ans = 0;
    long long int MIN;
    int a = 0;
    for(int i = 0; i < 5; i++)
        cin >> num[i];
    MIN = num[0];
    for(int i = 0; i < 5; i++)
        MIN = min(MIN, num[i]);
    ans = (n/MIN)+4;
    if(n%MIN!=0) ans++;
    cout << ans << endl; 
    return 0;
}

Measured memory_bytes: 256
n,q = map(int,input().split())
s = input()
lr = [list(map(int,input().split()))for i in range(q)]

a = [0]*n
p = 0
for i in range(1,n):
    if s[i-1] == 'A' and s[i] == 'C':
        p += 1
    a[i] = p
ans = []
for i in range(q):
    ans.append(a[lr[i][1]-1]-a[lr[i][0]-1])
for i in range(q):
    print(ans[i])

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

#ifndef DEBUG
#define DEBUG false
#endif

#define REP(t,i,a,b) for(t i = a; i < b; ++i)

typedef long long ll;

using namespace std;

long compute_cost(
    const int n, const int a, const int b, const int c,
    const int index, vector<int>& l
) {
    vector<int> l_ret(3, 0);
    vector<long> cost_(3, 0);
    int tmp = index;
    REP(int, i, 0, n) {
        int use = tmp % 4;
        tmp /= 4;

        if (use == 0) continue;
        
        if (l_ret[use-1] > 0) cost_[use - 1] += 10;
        l_ret[use - 1] += l[i];
    }

    int l_min = *min_element(l_ret.begin(), l_ret.end());
    if (l_min <= 0) return LONG_MAX;

    long sum_cost = cost_[0] + cost_[1] + cost_[2];
    sum_cost += abs(l_ret[0] - a) + abs(l_ret[1] - b) + abs(l_ret[2] - c);
    return sum_cost;
}

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

    int n, a, b, c;
    cin >> n >> a >> b >> c;
    vector<int> l(n);
    REP(int, i, 0, n) {
        cin >> l[i];
    }

    int num_all = pow(4, n);
    long cost_min = LONG_MAX;
    REP (int, i, 0, num_all) {
        long cost = compute_cost(n, a, b, c, i, l);
        cost_min = min(cost_min, cost);
    }
    cout << cost_min << endl;

    return 0;
}

Measured memory_bytes: 512
#include<stdio.h>
int main(){
   int a,b,c;
   scanf("%d %d %d",&a,&b,&c);
   if(a<b){
     if(b<c){
        puts("Yes");
     }else{
        puts("No");
     }
   }else{
         puts("No");
   }
   return 0;
}

Measured memory_bytes: 580
#include <stdio.h>

int max(int x,int y){
  if(x > y){
    return x;
  }
  return y;
}

int main(void){
  int n, m, i, j, ans = 0;
  scanf("%d%d",&n,&m);
  for(i = 0;i < n;i++){
    int tmp = 0;
    for(j = 0;j < m;j++){
      int x;
      scanf("%d",&x);
      if(x){
	tmp++;
      }
    }
    ans = max(ans,tmp);
  }
  printf("%d\n",ans);
  return 0;
}

Measured memory_bytes: 1028
#define _CRT_SECURE_NO_WARNINGS

#include<iostream>
#include<functional>
#include<algorithm>
#include<stack>
#include<queue>
#include<iomanip>
#include<set>
#include<map>
#include<utility>
#include<string>
#include<vector>

using namespace std;

#define LL long long
const int dx[4] = { 1,-1,0,0 };
const int dy[4] = { 0,0,1,-1 };
bool OOA(int x, int y, int H, int W) { return (0 <= x && x<H) && (0 <= y && y<W); }

struct Edge{
	int fr,to,val;
	bool operator < (Edge x){
		return (val<x.val);
	}
};

struct Graph {
	struct Edge {
		int fr, to, val;
		Edge(int f, int t, int v) :fr(f), to(t), val(v) {}
	};

	int V, E, t;
	vector<int>cost;
	vector<bool>vzt;
	vector<vector<pair<int,int>>>adj;//to,val
	void init(int n,int dflt) {//dflt!=0
		t = 1;
		V = n;
		adj = vector<vector<pair<int,int>>>(V + 1);
		cost = vector<int>(V + 1, dflt);
		vzt = vector<bool>(V + 1, false);
		return;
	}

	void Dijkstra(int s){
		priority_queue<pair<int,int>>pq;
		pq.push({s,0});
		cost[s]=0;
		while(!pq.empty()){
			auto now=pq.top().first,ncos=pq.top().second;
			pq.pop();
			for(int i=0;i<adj[now].size();i++){
				if(cost[adj[now][i].first]>cost[now]+adj[now][i].second){
					cost[adj[now][i].first]=cost[now]+adj[now][i].second;
					pq.push({ adj[now][i].first,cost[adj[now][i].first] });
				}
			}
		}
		return;
	}
};

int n;
Graph G;

int main() {
	cin >> n;
	G.init(n,(1<<30));
	for(int i=0;i<n;i++){
		int u,k;
		cin>>u>>k;
		for(int j=0;j<k;j++){
			int v,c;
			cin>>v>>c;
			G.adj[u].push_back({v,c});
		}
	}
	G.Dijkstra(0);
	for(int i=0;i<n;i++){
		cout<<i<<" "<<G.cost[i]<<endl;
	}
	return 0;
}



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

// #define multitest 1
// #define Debug 1
#ifdef Debug
#define db(...) ZZ(#__VA_ARGS__, __VA_ARGS__);
template <typename Arg1>
void ZZ(const char *name, Arg1 &&arg1)
{
	std::cerr << name << " = " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void ZZ(const char *names, Arg1 &&arg1, Args &&... args)
{
	const char *comma = strchr(names + 1, ',');
	std::cerr.write(names, comma - names) << " = " << arg1;
	ZZ(comma, args...);
}
#else
#define db(...)
#endif

typedef long long ll;
typedef long double ld;
#define f first
#define s second
#define pb push_back
const long long mod = 1000000007;

void solve()
{
	string code;
	cin >> code;
	if (code[0] == code[1] || code[2] == code[1] || code[2] == code[3])
		cout << "Bad";
	else cout << "Good";
}

int main()
{
#ifndef Debug
	ios_base::sync_with_stdio(0);
	cin.tie(0);
#endif
	int t = 1;
#ifdef multitest
	cin >> t;
#endif
	while (t--)
		solve();
	return 0;
}

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

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

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	string base="Christmas";
	int d; cin>>d;
	for (int i=0; i<25-d; i++)
		base+=" Eve";
	cout << base << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include <map>
#include <cmath>
#include <string>
#include <algorithm>
#include <math.h>
using namespace std;

#define rep(i, o) for (ll i = 0; i < (o);i++)
#define rep_s(i, o) for (int i = 1; i <= (o);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<(int)(b);i++)
#define NUM 1e5

typedef long long ll;
typedef unsigned long long ull;

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll c, ll d) { return c / gcd(c, d) * d; }


template<class T>
bool chmax(T &a, const T &b) { if (a < b) { return b; } return a; }

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

int main() {
    ll x, n; cin >> x >> n;
    if (n == 0) { cout << x << endl; return 0; }

    vector<ll> p(n); 
    rep(i, n) cin >> p[i];

    list<ll> v(102, 0); ll count = 0;
    for (auto itr = v.begin(); itr != v.end(); ++itr) { 
        *itr = count;
        count++;
        // cout << *itr << " ";
    }
    // cout << endl;
    // for (auto itr = v.begin(); itr != v.end(); itr++)
    //     cout << *itr << " ";
    rep(i, n) {
        for (auto itr = v.begin(); itr != v.end(); ++itr) { 
            if (p[i] == *itr) itr = v.erase(itr);
            // cout << *itr << " ";
        }
    }
    
    // for (auto itr = v.begin(); itr != v.end(); itr++)
    //     cout << *itr << " ";
    // cout << endl;

    ll min_elem = 1000;
    for (auto itr = v.begin(); itr != v.end(); itr++) {
        if (min(abs(min_elem-x), abs(*itr-x)) == abs(*itr-x))
        {
            if (abs(min_elem-x) == abs(*itr-x)) min_elem = (min_elem < *itr) ? min_elem : *itr;
            else min_elem = *itr;
        }
    }
    cout << min_elem << endl;
    return 0;
}

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

typedef long long  ll;

ll MOD = 1000000007;
ll INF = 100000000;
double PI = 3.1415926535;

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

using Graph = vector<vector<pair<ll,ll>>>;

int main(){
  ll A,B,C;
  cin >> A >> B >> C;
  if(A+B+1 >= C){
    cout << B + C << endl;
  }else{
    cout << B + B + A + 1 << endl;
  }
}

Measured memory_bytes: 256
main = do
    ss <- getLine
    putStrLn $ solve ss

solve ss | odcheck ss = "Yes"
         | otherwise = "No"

odcheck [] = True
odcheck (s:ss) | check s = evcheck ss
               | otherwise = False
    where check s = s == 'R' || s == 'U' || s == 'D'

evcheck [] = True
evcheck (s:ss) | check s = odcheck ss
               | otherwise = False
    where check s = s == 'L' || s == 'U' || s == 'D'

Measured memory_bytes: 380
import java.util.Scanner;

public class Main{
 public static void main(String[] args){
  Scanner sc = new Scanner(System.in);
  int a = sc.nextInt();
  int b = sc.nextInt();
  int c = sc.nextInt();
  if(a<b){
   if(b<c){
    System.out.printf("%d %d %d\n",a,b,c);
   }
   else if(a<c){
    System.out.printf("%d %d %d\n",a,c,b);
   }
   else{
    System.out.printf("%d %d %d\n",c,a,b);
   }
  }
  else{
   if(a<c){
    System.out.printf("%d %d %d\n",b,a,c);
   }
   else if(b<c){
    System.out.printf("%d %d %d\n",b,c,a);
   }
   else{
    System.out.printf("%d %d %d\n",c,b,a);
   }
  }
 }
}

Measured memory_bytes: 26144
'use strict';
process.stdin.on('data', function(chunk) {
    var inputs = chunk.toString().trim().split('\n');
    for (var i = 0; i < inputs.length; i++) {
        if (inputs[i] === '0') {
            break;
        }
        console.log('Case ' + (i + 1) + ': ' + inputs[i]);
    }

});
process.stdin.resume();
process.stdin.setEncoding('utf8');

Measured memory_bytes: 20772
#include<bits/stdc++.h>
using namespace std;
int divcount(int n){
	int res=0;
  	for(int i=1;i<=n;i++){
    	res+=(!(n%i)); 
    }
  	return res;
}
int main(){
  	int n;cin>>n;int ans=0;
  	for(int i=1;i<=n;i+=2){
      //cout<<i<<" "<<divcount(i)<<"\n";
      ans+=(divcount(i)==8);
    }
  	cout<<ans;
}

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

using namespace std;
long long  n,w[1000],val[1009];
long long k,dp[1000][100090];
int main()
{
    cin>>n>>k;
    for(int i=1;i<=n;i++)
    {
        cin>>w[i]>>val[i];
    }
    memset(dp,-1,sizeof(dp));
    dp[0][0]=0;
    for(int i=1;i<=n;i++)
    {
        for(int j=0;j<=k;j++)
        {
            if(dp[i-1][j]==-1)continue;
            dp[i][j]=max(dp[i-1][j],dp[i][j]);
            if(j+w[i]<=k)dp[i][j+w[i]]=max(dp[i][j+w[i]],dp[i-1][j]+val[i]);
        }
    }
    long long ans=0;
    for(int i=0;i<=k;i++)
    {
        ans=max(ans,dp[n][i]);
    }
    cout<<ans;
}


Measured memory_bytes: 782208
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<cmath>
#define mod 998244853 
using namespace std;
int main()
{
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int n, a, b;
  cin >> n >> a >> b;
  cout << min(a*n, b) << '\n';
}

Measured memory_bytes: 256
import math
A, B, H, M = map(int, input().split())

h = H % 12
m = M % 60

rh = (h/12+M/60*1/12)*2*math.pi
rm = (m/60)*2*math.pi
r = min(rh - rm, 2*math.pi - (rh - rm))

c = A**2 + B**2 - 2*A*B*math.cos(r)
print(math.sqrt(c))

Measured memory_bytes: 9512
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
#include <set>
#include <map>
#include <time.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


struct Info{
	Info(int arg_to,int arg_cost){
		to = arg_to;
		cost = arg_cost;
	}
	int to,cost;
};

struct Data{
	Data(int arg_node_id,int arg_ball_state,int arg_total_cost){
		node_id = arg_node_id;
		ball_state = arg_ball_state;
		total_cost = arg_total_cost;
	}
	bool operator<(const struct Data &arg) const{
		return total_cost > arg.total_cost;
	}
	int node_id,ball_state,total_cost;
};

int N,M,L,K;
int POW[8],min_cost[50][10][128],index[50][128],exist_ball[50];
vector<Info> G[50];


void func(){

	for(int i = 0; i < N; i++)G[i].clear();

	int from,to,cost;
	for(int i = 0; i < M; i++){
		scanf("%d %d %d",&from,&to,&cost);
		from--;
		to--;
		G[from].push_back(Info(to,cost));
		G[to].push_back(Info(from,cost));
	}

	int start,goal;
	scanf("%d %d",&start,&goal);
	start--;
	goal--;

	for(int i = 0; i < N; i++)exist_ball[i] = -1;

	int tmp;
	for(int i = 0; i < L; i++){
		scanf("%d",&tmp);
		tmp--;
		exist_ball[tmp] = i;
	}

	for(int i = 0; i < N; i++){
		for(int state = 0; state < POW[L]; state++)index[i][state] = 0;
	}

	for(int i = 0; i < N; i++){
		for(int a = 0; a < K; a++){
			for(int state = 0; state < POW[L]; state++)min_cost[i][a][state] = BIG_NUM;
		}
	}

	priority_queue<Data> Q;

	int first_state;

	if(exist_ball[start] != -1){
		first_state = POW[exist_ball[start]];
	}else{
		first_state = 0;
	}
	min_cost[start][index[start][first_state]++][first_state] = 0;

	int next_node,next_state;

	for(int i = 0; i < G[start].size(); i++){
		next_node = G[start][i].to;

		if(exist_ball[next_node] != -1){
			next_state = first_state|POW[exist_ball[next_node]];
		}else{
			next_state = first_state;
		}
		if(index[next_node][next_state] >= K)continue;

		Q.push(Data(next_node,next_state,G[start][i].cost));
	}


	while(!Q.empty()){

		if(index[Q.top().node_id][Q.top().ball_state] >= K){
			if(Q.top().node_id == goal && Q.top().ball_state == POW[L]-1)break;
			Q.pop();
			continue;
		}

		min_cost[Q.top().node_id][index[Q.top().node_id][Q.top().ball_state]++][Q.top().ball_state] = Q.top().total_cost;

		for(int i = 0; i < G[Q.top().node_id].size(); i++){
			next_node= G[Q.top().node_id][i].to;

			if(exist_ball[next_node] != -1){
				next_state = Q.top().ball_state|POW[exist_ball[next_node]];
			}else{
				next_state = Q.top().ball_state;
			}

			if(index[next_node][next_state] >= K)continue;

			Q.push(Data(next_node,next_state,Q.top().total_cost+G[Q.top().node_id][i].cost));
		}
		Q.pop();
	}

	if(min_cost[goal][K-1][POW[L]-1] == BIG_NUM){
		printf("NA\n");
	}else{
		printf("%d\n",min_cost[goal][K-1][POW[L]-1]);
	}
}


int main(){

	for(int i = 0; i < 8; i++)POW[i] = pow(2,i);

	while(true){
		scanf("%d %d %d %d",&N,&M,&L,&K);
		if(N == 0 && M == 0 && L == 0 && K == 0)break;

		func();
	}

	return 0;
}

Measured memory_bytes: 41112
import Control.Applicative ((<$>), (<*>))
import Control.Monad
import Data.List

main :: IO ()
main = do
  [n,m] <- getl $ wrds toInt
  unless (n == 0 && m == 0) $ do
    solve m <$> getl (wrds toInt) >>= print
    main
  
solve :: Int -> [Int] -> Int
solve m = sum . map snd . filter (\x -> fst x `mod` m /= 0) . zip [1..] . sortBy (flip compare)

toInt :: String -> Int
toInt = read

wrds :: (String -> a) -> String -> [a]
wrds f = map f . words

getl :: (String -> a) -> IO a
getl f = f <$> getLine

Measured memory_bytes: 5548
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

int main() {
    int n; cin >> n;
    vector<int> a(n);
    int k = 1;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        if (a[i] == k) k++;
    }
    if (k == 1) cout << -1 << endl;
    else cout << n - (k - 1) << endl;
    return 0;
}

Measured memory_bytes: 1024
def _main(x, y):
    b = (y - 2 * x) // 2
    a = x - b

    if 0 <= a and 0 <= b and a + b == x and (2 * a + 4 * b) == y:
        print("Yes")
    else:
        print("No")


_main(*map(int, input().split()))


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

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>
#include<unordered_set>
#include<bitset>
#include<complex>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

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

	int N;
	string S, T;

	cin >> N;
	cin >> S >> T;

	string ans;
	rep(i, 0, N)
	{
		ans += S[i];
		ans += T[i];
	}

	cout << ans << endl;

	return 0;
}

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

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

  char cN[5];
  int N;
  fgets(cN, 5, stdin);
  sscanf(cN, "%d", &N);

  //printf("N = %d\n", N);

  char str1[120];
  //fgets(str1, sizeof(str1), stdin);

  char str2[120];
  //fgets(str2, sizeof(str2), stdin);

  char strb[250];

  fgets(strb, 250, stdin);
  sscanf(strb, "%s %s", str1, str2);

  //printf("str1 = %s\n", str1);
  //printf("str2 = %s\n", str2);

  /*
  for (int i = 0; i < 100; i++) {
    str1[i] = 'a';
    str2[i] = 'b';
  }
  */

  char str3[250];

  for (int i = 0; i < N; i++) {
    //printf("str1[%d] = %c\n", i, str1[i]);
    //printf("str2[%d] = %c\n", i, str2[i]);
    str3[2 * i] = str1[i];
    str3[2 * i + 1] = str2[i];
    //printf("str3[%d] = %c\n", 2 * i, str3[2 * i]);
    //printf("str3[%d] = %c\n", 2 * i + 1, str3[2 * i + 1]);
  }

  str3[2 * N] = '\0';

  printf("%s\n", str3);

  return 0;

}


Measured memory_bytes: 128
#include <iostream>
#include <vector>

using namespace std;

int main()
{
	int N, M;
	cin >> N >> M;
	vector<int> a(N), b(N), c(M), d(M);
	auto dist = [&](int i, int j) {
		return abs(a[i] - c[j]) + abs(b[i] - d[j]);
	};
	for (int i = 0; i < N; ++i) {
		cin >> a[i] >> b[i];
	}
	for (int j = 0; j < M; ++j) {
		cin >> c[j] >> d[j];
	}
	for (int i = 0; i < N; ++i) {
		int k = 0;
		for (int j = 0; j < M; ++j) {
			if (dist(i, j) < dist(i, k) || j < k) {
				k = j;
			}
		}
		cout << k + 1 << endl;
	}
}


Measured memory_bytes: 256
N,X,Y=map(int,input().split())
ans=[0 for i in range(1,N)]
 
for i in range(1,N):
    for j in range(i+1,N+1):
        k=min(abs(j-i),abs(X-i)+1+abs(Y-j),abs(Y-i)+1+abs(X-j))
        ans[k-1]+=1
 
for i in ans:
    print(i)

Measured memory_bytes: 47708
#include <iostream>

using namespace std;

const int num[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
int ans = 0, n, s, sum = 0;

void subsetsum(int n, int k)
{
  for(int i = n; i < 10; i++){
    if(k){
      sum += num[i];
      subsetsum(i + 1, k - 1);
      if(sum == s && k == 1)
	ans++; 
      sum -= num[i];
    }else{
      break;
    }
  }
}
	

int main()
{
  while(1){
    cin >> n >> s;
    if(n == 0 && s == 0){
      break;
    }else{
      subsetsum(0, n);
      cout << ans << endl;
      ans = 0;
    }
  }
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

ll mod = 1e9 + 7;
ll modpow(ll A, ll B) {
	if (B == 0) return 1;
	if (B % 2) return A * modpow(A, B - 1) % mod;
	ll half = modpow(A, B / 2);
	return half * half % mod;
}

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


	int N, A, B, C;
	cin >> N >> A >> B >> C;

	ll Pkake[100000], Pwaru[100000];
	Pkake[0] = 1;
	Pwaru[0] = 1;
	rep(i, N - 1) {
		Pkake[i + 1] = Pkake[i] * (i + N) % mod;
		Pwaru[i + 1] = Pwaru[i] * (N - i - 1) % mod;
	}

	ll AA[100001], BB[100001], AB[200001];
	AA[0] = 1;
	BB[0] = 1;
	AB[0] = 1;
	rep(i, N) AA[i + 1] = AA[i] * A % mod;
	rep(i, N) BB[i + 1] = BB[i] * B % mod;
	rep(i, 2 * N) AB[i + 1] = AB[i] * (A + B) % mod;

	ll kari1 = 0, kari2 = 0;
	rep(i, N) {
		ll kari = Pkake[i] * Pwaru[N - 1 - i] % mod;
		kari = kari * AB[N - i] % mod;
		kari = kari * 100 * (N + i) % mod;

		kari1 += kari * BB[i] % mod;
		kari2 += kari * AA[i] % mod;
	}

	ll Esum = kari1 % mod * AA[N] % mod;
	Esum += kari2 % mod * BB[N] % mod;
	Esum = Esum * modpow(100 - C, mod - 2) % mod;
	Esum = Esum * modpow(Pwaru[N - 1], mod - 2) % mod;
	Esum = Esum * modpow(AB[2 * N], mod - 2) % mod;
	co(Esum);

	Would you please return 0;
}

Measured memory_bytes: 4992
n, k = map(int, input().split())
a = list(map(int, input().split()))
new_balls = []
a.sort()
if k > a[-1]:
    print('IMPOSSIBLE')
    exit()
if k in a:
    print('POSSIBLE')
    exit()
for i in range(1, n):
    diff = a[i] - a[i - 1]
    if diff > 0:
        new_balls.append(diff)
for nb in new_balls:
    if (a[-1] - k) % nb == 0:
        print('POSSIBLE')
        exit()
print('IMPOSSIBLE')

Measured memory_bytes: 14224
#include <bits/stdc++.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <algorithm>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define acc(v) accumulate(v.begin(), v.end(), 0)

using namespace std;
typedef long long ll;
const int INF = 1e9;
const ll LINF = 1e18;
const ll MOD = 1e9 + 7;

int m[110];
int main()
{
	int n, k;
	cin >> n >> k;
	rep(i,k){
		int d;
		cin >> d;
		rep(j,d){
			int a;cin>>a;
			a--;
			m[a] = 1;
		}
	}
	int ans = 0;
	rep(i,n){
		if (!m[i])
			ans++;
	}
	cout << ans << endl;
}


Measured memory_bytes: 3624
N, M = map(int,input().split())
p = list(map(int,input().split()))

def find(x, U):
  if x == U[x]:
    return x
  else:
    k = find(U[x], U)
    U[x] = k
    return k

U = [i for i in range(N)]
for _ in range(M):
  x, y = map(int,input().split())
  x -= 1
  y -= 1
  a = find(p[x]-1, U)
  b = find(p[y]-1, U)
  U[a] = b
  
for i in range(N):
  find(i, U)

ans = 0
for i in range(N):
  if U[i] == U[p[i]-1]:
    ans += 1
   
print(ans)
  

Measured memory_bytes: 20404
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define vi vector<int>
#define all(x) (x).begin(),(x).end()
#define INF 1e9
using ll = long long;
using namespace std;
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; }

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

  ll ans = 1;
  rep(i,n){
    ll t; cin >> t;
    ans = ans*(t/__gcd(ans,t));
  }
  cout << ans;
  cout << "\n";
  return 0;
}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
#include <assert.h>
using namespace std;
using i64 = long long;

int main()
{
  i64 n, m;
  cin >> n >> m;
  vector<bool> c(n);
  vector<i64> cnt(n, 1);
  c[0] = true;
  for (i64 i = 0; i < m; i++)
  {
    i64 x, y;
    cin >> x >> y;
    cnt[x - 1]--;
    cnt[y - 1]++;
    if (c[x - 1])
      c[y - 1] = true;
    if (cnt[x - 1] == 0)
      c[x - 1] = false;
  }
  i64 ans = 0;
  for (i64 i = 0; i < n; i++)
    if (c[i])
      ans++;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1024
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
void *wmem;
char memarr[96000000];
template<class T> inline void walloc1d(T **arr, int x, void **mem = &wmem){
  static int skip[16] = {0, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1};
  (*mem) = (void*)( ((char*)(*mem)) + skip[((unsigned long long)(*mem)) & 15] );
  (*arr)=(T*)(*mem);
  (*mem)=((*arr)+x);
}
template<class T1> void sortA_L(int N, T1 a[], void *mem = wmem){
  sort(a, a+N);
}
inline int my_getchar_unlocked(){
  static char buf[1048576];
  static int s = 1048576;
  static int e = 1048576;
  if(s == e && e == 1048576){
    e = fread_unlocked(buf, 1, 1048576, stdin);
    s = 0;
  }
  if(s == e){
    return EOF;
  }
  return buf[s++];
}
inline void rd(int &x){
  int k;
  int m=0;
  x=0;
  for(;;){
    k = my_getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = my_getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
struct MY_WRITER{
  char buf[1048576];
  int s;
  int e;
  MY_WRITER(){
    s = 0;
    e = 1048576;
  }
  ~MY_WRITER(){
    if(s){
      fwrite_unlocked(buf, 1, s, stdout);
    }
  }
}
;
MY_WRITER MY_WRITER_VAR;
void my_putchar_unlocked(int a){
  if(MY_WRITER_VAR.s == MY_WRITER_VAR.e){
    fwrite_unlocked(MY_WRITER_VAR.buf, 1, MY_WRITER_VAR.s, stdout);
    MY_WRITER_VAR.s = 0;
  }
  MY_WRITER_VAR.buf[MY_WRITER_VAR.s++] = a;
}
inline void wt_L(char a){
  my_putchar_unlocked(a);
}
inline void wt_L(int x){
  int s=0;
  int m=0;
  char f[10];
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    my_putchar_unlocked('-');
  }
  while(s--){
    my_putchar_unlocked(f[s]+'0');
  }
}
int N;
int A[100];
int main(){
  int i;
  wmem = memarr;
  int res = 0;
  rd(N);
  {
    int Lj4PdHRW;
    for(Lj4PdHRW=(0);Lj4PdHRW<(N);Lj4PdHRW++){
      rd(A[Lj4PdHRW]);
    }
  }
  sortA_L(N,A);
  for(i=(0);i<(N);i++){
    int j;
    for(j=(i+1);j<(N);j++){
      int k;
      for(k=(j+1);k<(N);k++){
        if(A[i]==A[j] || A[j]==A[k] || A[k]==A[i]){
          continue;
        }
        if(A[k] >= A[i] + A[j]){
          continue;
        }
        res++;
      }
    }
  }
  wt_L(res);
  wt_L('\n');
  return 0;
}
// cLay varsion 20200813-1 [beta]

// --- original code ---
// int N, A[100];
// {
//   int res = 0;
//   rd(N,A(N));
//   sortA(N,A);
//   rep(i,N) rep(j,i+1,N) rep(k,j+1,N){
//     if(A[i]==A[j] || A[j]==A[k] || A[k]==A[i]) continue;
//     if(A[k] >= A[i] + A[j]) continue;
//     res++;
//   }
//   wt(res);
// }


Measured memory_bytes: 3640
#include<iostream>
#include<map>
#include<vector>
using namespace std;
class Graph{
    private:
        map<int,vector<int> >adj;
        map<int,bool>visited;
        map<int,int>dp;
        int n;
    public:
        Graph(int n){
            this->n = n;
        }
        void add_edge(int a,int b){
            adj[a].push_back(b);
        }
        void dfs(int s=0){
            visited[s] = 1;
            for(int i:adj[s]){
                if(!visited[i])
                    dfs(i);
                dp[s] = max(dp[s],dp[i]+1);
            }
        }
        int val(){
            int maxm = 0;
            for(int i=1;i<=n;i++){
                if(!visited[i])
                    dfs(i);
            }
            for(pair<int,int>i:dp)
                maxm = max(maxm,i.second);
            return maxm;
        }
};
int main(){
    int n,e;
    cin>>n>>e;
    Graph g = n;
    while(e--){
        int a,b;
        cin>>a>>b;
        g.add_edge(a,b);
    }
    cout<<g.val()<<endl;
}

Measured memory_bytes: 29936
import sys

w = int(sys.stdin.readline())
n = int(sys.stdin.readline())
lines = list()
for line in xrange(n):
    line = sys.stdin.readline()
    line = line.strip()
    lines.append(map(int, line.split(",")))

def swap(yoko, nums):
    a, b = yoko
    a -= 1
    b -= 1
    tmp = nums[a]
    nums[a] = nums[b]
    nums[b] = tmp

nums = range(1, w+1)
for yoko in lines:
    swap(yoko, nums)

for i in nums:
    print i

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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

#define faster  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

#define sq(x)   (x)*(x)
#define PI      acos(-1.0)
#define all(x) x.begin(),x.end()
#define nl      '\n'

typedef long long int ll;
typedef unsigned long long int  llu;


int main()
{
	faster
	string s;
	cin>>s;
	cout<<s;
	if(s[s.size()-1]=='s')cout<<"es"<<nl;
	else cout<<"s"<<nl;
	return 0;
}


Measured memory_bytes: 3648
#include<stdio.h>
#include<stdlib.h>
int main()
{
  int x,y,i,j,a,b;
  scanf("%d%d",&x,&y);
  a=x-2*y;;
  if(a<=0)
  {
    printf("0");
  }
  else
  {
    printf("%d",a);
  }
  return 0;
}

Measured memory_bytes: 128
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Kishan Sairam Adapa
 */

#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define ll long long int
#define MOD ((int)(1e9) + 7)

using namespace std;

class BLucasNumber {
public:
    void solve(istream& cin, ostream& cout) {
        int n; cin >> n;
        vector<ll> a(n+1);
        a[0] = 2; a[1]  = 1;
        for(int i=2; i<=n; i++) {
            a[i] = a[i-1] + a[i-2];
        }
        cout << a[n] << '\n';
    }
};


int main() {
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(NULL);
    BLucasNumber solver;
    std::istream& in(std::cin);
    std::ostream& out(std::cout);
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int main() {
	int A, B, C;
	cin >> A >> B >> C;
	int D;
	D = B / A;
	if (D <= C) {
		cout << D << endl;
	}
	else if (C < D) {
		cout << C<< endl;
	}
	system("pause");
	return 0;
}

Measured memory_bytes: 504
#include<iostream>
using namespace std;
double N;
int func(int i, int sum){
    if(i < 10){
        return(sum + i % 10);
    }
    else {
        sum += i % 10;
        return func(i / 10,sum);
    }
}

int main(){
    cin >> N;    int A, B;
    cin >> A >> B;
    
    int ans = 0;
    for(int i = 1;i <= N;i++){
        if(func(i, 0) >= A && func(i, 0) <= B)ans += i;
    }
    cout << ans;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
typedef long long ll;
using namespace std;
const ll INF = 1e9;
const ll MOD = 1e9 + 7;
#define repi(i, n, init) for (ll i = init; i < (n); i++)

int main()
{
    int n, m = 101, M = 0;
    cin >> n;
    int x[n];
    repi(i, n, 0)
    {
        cin >> x[i];
        m = min(m, x[i]);
        M = max(M, x[i]);
    }
    int ans = INF;
    repi(j, M+1, m)
    {
        int s = 0;
        repi(i, n, 0)
        {
            s += (j - x[i]) * (j - x[i]);
        }
        ans = min(ans,s);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main() {
	int N, M;
	scanf("%d %d", &N, &M);
	int H[100001] = { 0 };
	int T[100001] = { 0 };
	int s;
	for (s = 1; s < N + 1; s++)
		scanf("%lld", &H[s]);
	
	int i = 0;
	for (i = 0; i < M; i++) {
		int a = 0, b = 0;
		scanf("%d %d", &a, &b);
		if (H[a] >= H[b]) {
			T[b] = T[b] + 1;
		}
		if (H[a] <= H[b]) {
			T[a] = T[a] + 1;
		}
	
	}
	int t;
	int sum = 0;
	for (t = 1; t < N + 1; t++) {
		if (T[t] == 0) {
			sum = sum + 1;
		}
	}
	int ans = N - sum;
	printf("%d", sum);
	return 0;
}


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

int main()
{
  int N;
  int A[200];
  int count = 0;

  cin >> N;

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

  while (true)
  {
    bool flag = true;
    for (int i = 0; i < N; i++)
    {
      if (A[i] % 2 == 0)
      {
        A[i] = A[i] / 2;
      }
      else
      {
        flag=false;
        break;
      }
    }

    if(flag){
      count++;
    }else{
      break;
    }
  }

  cout << count << endl;

  return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    if(s[0] == s[1] && s[1] == s[2]) cout << "No" << endl;
    else cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
//#define double long double
#define endre getchar();getchar();return 0
#define moder (int)(1e9+7)
#define inf (int)(5*1e18)
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define P pair<int,int>
#define all(v) v.begin(),v.end()
#define prique(T) priority_queue<T,vector<T>,greater<T>>
#define vecunique(vec) sort(vec.begin(), vec.end());decltype(vec)::iterator result = std::unique(vec.begin(), vec.end());vec.erase(result, vec.end())
using namespace std;

int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int kai(int x) {
	if (x == 0)return 1;
	return kai(x - 1)*x;
}
int mod_pow(int x, int y, int mod) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x%mod;
		}
		x = x * x%mod;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	return kai(x)*mod_pow(kai(x - y), moder - 2, moder) % moder*mod_pow(kai(y), moder - 2, moder) % moder;
}
/*--------Library Zone!--------*/

int n, a[114514], sum;
signed main() {
	cin >> n;
	rep(i, n) {
		cin >> a[i];
		sum += a[i];
	}
	if (sum % ((1 + n)*n / 2)) {
		cout << "NO" << endl;
		endre;
	}
	int k = sum / ((1 + n)*n / 2);
	//N個取り除く回数
	int cnt = 0;
	rep(i, n) {
		int x = a[i], y = a[(i + 1) % n];
		if (y - x > k) {
			cout << "NO" << endl;
			endre;
		}
		if ((k - (y - x)) % n) {
			cout << "NO" << endl;
			endre;
		}
		cnt += (k - (y - x)) / n;
	}
	if (cnt != k)cout << "NO" << endl;
	else cout << "YES" << endl;
	endre;
}

Measured memory_bytes: 1024
import java.util.*;

class Main{
	public static void main(String[]args){
		Scanner s = new Scanner(System.in);
		double r = s.nextDouble();
		double a, b;
		
		a = (double)r * r * 3.141592653589;
		b = (double)r * 2 * 3.141592653589;
		
		System.out.println(String.format("%.6f", a) + " " + String.format("%.6f", b));
	}
}


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

int main()
{
	long long N, h, n, w, waru;
	cin >> N;

	for (h = 1; h <= 3500; h++) {
		for (n = 1; n <= 3500; n++) {
			waru = 4 * h*n - N*n - N*h;
			if (waru > 0 && N*h*n%waru == 0) {
				w = N*h*n / waru;
				cout << h << " " << n << " " << w << endl;
				return 0;
			}
		}
	}

	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(0); cin.sync_with_stdio(false);
  int n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  vector<int> opr;
  vector<bool> req(n, false);
  auto merge = [&] (int i) {
    opr.push_back(i);
    int n = a.size();
    assert(0 <= i && i < n);
    assert(!req[i]);
    req.erase(req.begin() + i);
    a.erase(a.begin() + i);
    if (0 < i && i < n - 1) {
      a[i - 1] += a[i];
      assert(req[i - 1] == req[i]);
      req.erase(req.begin() + i);
      a.erase(a.begin() + i);
    }
  };
  
  long long sum[2] = {};
  int cnt[2] = {};
  for (int i = 0; i < n; i++) {
    long long crr = a[i];
    if (crr >= 0) {
      sum[i % 2] += a[i];
      cnt[i % 2]++;
    }
  }
  long long ret = 0;
  if (cnt[0] == 0 && cnt[1] == 0) {
    auto i = max_element(a.begin(), a.end()) - a.begin();
    req[i] = true;
    ret = a[i];
    sum[0] = a[i];
  } else {
    if (cnt[0] == 0 || sum[0] < sum[1]) {
      merge(0);
      sum[0] = sum[1];
      n--;
    }
    for (int i = 0; i < n; i += 2) {
      if (a[i] >= 0) {
        req[i] = true;
        ret += a[i];
      }
    }
  }
  while ((int)a.size() >= 2) {
    if (!req[0]) merge(0);
    else if (!req.back()) merge(req.size() - 1);
    else if (req[2]) merge(1);
    else merge(2);
  }
  assert((int)a.size() == 1);
  assert(sum[0] == ret);
  assert(a[0] == ret);
  cout << ret << endl;
  cout << opr.size() << endl;
  for (auto e : opr) {
    cout << e + 1 << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <random>
#include <iomanip>
#include <unordered_set>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<pair<ll,ll> > vpll;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<vc> vvc;
typedef vector<vs> vvs;
typedef vector<vll> vvll;
typedef map<int,int> mii;
typedef set<int> si;
#define rep(i,n) for(ll i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define arep(i,v) for(auto i : v)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define STLL(s) strtoll(s.c_str(), NULL, 10)
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define fi first
#define se second
constexpr int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;}
template <class T> inline void dump(T &v){irep(i, v){cout<<*i<<((i==--v.end())?'\n':' ');}}
inline string getline(){string s; getline(cin,s); return s;}
inline void yn(const bool b){b?fin("yes"):fin("no");}
inline void Yn(const bool b){b?fin("Yes"):fin("No");}
inline void YN(const bool b){b?fin("YES"):fin("NO");}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
constexpr ll LLINF = 1LL<<60;
constexpr ll MOD = 1000000007;
constexpr ld EPS = 1e-11;



int main() {
    
    int n;
    cin>>n;
    set<int> s;
    rep(i,n){
        int a;
        cin>>a;
        s.insert(a);
    }
    int m;
    cin>>m;
    rep(i,m){
        int a;
        cin>>a;
        s.erase(a);
    }
    irep(i,s){
        fin(*i);
    }
}


Measured memory_bytes: 12424
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <algorithm>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;

// to container
template <class C>
void input(C &c)
{
    for_each(c.begin(), c.end(), [](auto &i) { cin >> i; });
}

// to number, string
template <class T>
T input()
{
    T data;
    cin >> data;
    return data;
}

ll mpow(ll a, ll n, ll p)
{
    ll x = 1;
    while (n > 0)
    {
        if (n & 1)
        {
            x = a * x % p;
        }
        a = a * a % p;
        n >>= 1;
    }

    return x;
}

ll mfact(ll n, ll p)
{
    ll res = 1;
    for (ll i = 2; i <= n; i++)
    {
        res = res * i % p;
    }
    return res;
}

ll mcomb(ll n, ll r, ll p)
{
    if (n == 0 && r == 0)
    {
        return 1;
    }
    if (n < r || n < 0 || r < 0)
    {
        return 0;
    }

    ll a = mfact(n, p);
    ll b = mfact(n - r, p);
    ll c = mfact(r, p);
    return (((a * mpow(b, p - 2, p)) % p) * mpow(c, p - 2, p)) % p;
}

int main()
{
    const ll MOD = 1e9 + 7;
    ll N, K;
    cin >> N >> K;

    for (ll i = 1; i <= K; i++)
    {
        ll c = mcomb(N - K + 1, i, MOD);
        ll d = mcomb(K - 1, i - 1, MOD);

        cout << c * d % MOD << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
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)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

int main() {
    int n;
    cin >> n;
    map<ll, ll> mp;
    set<ll> st;
    REP(i,n){
        ll x = lin();
        mp[x]++;
        st.insert(x);
    }

    ll ans = 0;
    FORR(b,34,0){
        ll s = (1LL << b);
        for (ll x : st){
            if (2 * x > s) break;
            if (2 * x == s){
                ans += mp[x] / 2;
                mp[x] %= 2;
            }else{
                if (!mp.count(s - x)) continue;
                ll y = min(mp[x], mp[s - x]);
                ans += y;
                mp[x] -= y;
                mp[s - x] -= y;
            }
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 22144