akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
//using namespace std;
#define rep(i,j,n) for(ll i=(ll)(j);i<(ll)(n);i++)
#define REP(i,j,n) for(ll i=(ll)(j);i<=(ll)(n);i++)
#define per(i,j,n) for(ll i=(ll)(j);(ll)(n)<=i;i--)
#define ll long long
#define ALL(a) (a).begin(),(a).end()
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(ll)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(ll)(key)))
#define pb push_back
#define mp std::make_pair
#define endl "\n"
using std::cin;
using std::cout;
using std::vector;
using std::string;
using std::upper_bound;
using std::lower_bound;
using vi=vector<ll>;
using vii=vector<vi>;
using pii=std::pair<ll,ll>;
const ll MOD=1e9+7;
//const ll MOD=998244353;
//const ll MOD=100000;
const ll MAX=500000;
const ll INF=(1ll<<60);
template<class T>
class prique :public std::priority_queue<T, std::vector<T>, std::greater<T>> {};
struct Binary_indexed_tree{
    int N;
    vi bit;
    Binary_indexed_tree(int n):N(n){
        bit.resize(N+1,0);
    }
    void add(int x,int a){
        for(x;x<=N;x+=(x&-x)) bit[x]+=a;
    }
    ll sum(int x){
        ll ret=0;
        for(x;x>0;x-=(x&-x)) ret+=bit[x];
        return ret;
    }
};
ll modpow(ll X,ll Y){
    ll sum=X,cnt=1;
    vi A;
    while(cnt<=Y){
        A.pb(sum);
        sum*=sum;
        sum%=MOD;
        cnt*=2;
    }
    int M=A.size();
    ll ret=1;
    REP(i,1,M){
        if(Y>=(1ll<<M-i)){
            Y-=(1ll<<M-i);
            ret*=A[M-i];
            ret%=MOD;
        }
    }
    return ret;
}
ll fac[MAX],finv[MAX],inv[MAX];
void COMinit(){
    fac[0]=fac[1]=finv[1]=finv[0]=inv[0]=inv[1]=1;
    rep(i,2,MAX){
        fac[i]=fac[i-1]*i%MOD;
        inv[i]=modpow(i,MOD-2);
        finv[i]=finv[i-1]*inv[i]%MOD;
    }
}
ll COM(ll n,ll r){
    if(n<r||n<0||r<0) return 0;
    return fac[n]*finv[r]%MOD*finv[n-r]%MOD;
}
signed main(){
    int N,M; cin>>N>>M;
  vector<ll> A(N);
  rep(i,0,N) cin>>A[i];
  vector<bool> F(N,1);
  rep(i,0,M){
    int X,Y; cin>>X>>Y;
    if(A[X-1]>A[Y-1]) std::swap(X,Y);
    F[X-1]=0;
    if(A[X-1]==A[Y-1]) F[Y-1]=0;
  }
  int ans=0;
  rep(i,0,N){
    if(F[i]) ans++;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 4048
#include <bits/stdc++.h>
#define rep(i, n) for(int (i)=0; (i)<(n); (i)++)

using namespace std;
typedef long long ll;

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, L;
  cin >> N >> L;

  ll sum = 0;
  vector<ll> A(N);
  A[0]=111111;
  for(int i=0; i<N; i++)
    {
      A[i] = L+i;
      sum += A[i];
    }

  
  ll ans = 0;
  ll sa = 1e9;
  ll bans = 0;
  for(int i=0; i<N; i++)
    {
      ans = sum-A[i];
      if(abs(sum-ans)<sa)
	{
	  sa = abs(sum-ans);
	  bans = ans;
	}
    }

  cout << bans << endl;
    

  return 0;
}
//cout << setprecision(13);
//next_permutation();
//__gcd();
//reverse();
//set ,tuple ,pair;
//bitset
//vector.find
//vector.count



Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String args[]) {
        String answer = "APPROVED";
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        for(int i = 0; i < n; i++) {
            int num = Integer.parseInt(sc.next());
            if(num % 2 != 0) {
                continue;
            } else {
                if (num % 3 != 0 && num % 5 != 0) {
                    answer = "DENIED";
                    System.out.println(answer);
                    break;
                } else {
                    continue;
                }
            }
        }
        if("APPROVED".equals(answer)) {
            System.out.println(answer);
        }
    }
}

Measured memory_bytes: 22100
/*
    Vora Mahammadasim
*/

#include<bits/stdc++.h>
#include<stdio.h>
#define int long long
#define pb emplace_back
#define Mod 1000000007
#define all(a) a.begin(),a.end()
using namespace std;
signed main(){

    ios::sync_with_stdio(false);
    cin.tie(0);
    int a;
    cin>>a;
    cout<<a*(1+(a*(1+a)));
}


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

int main() {
  string S;
  cin >> S;
  if (S.at(0) == S.at(1) && S.at(1) == S.at(2)) {
    cout << "Yes" << endl;
  } else if (S.at(1) == S.at(2) && S.at(2) == S.at(3)) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


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

K=int(input())
if K%2==0 or K%5==0:
    print(-1)
else:   

    NOW=0

    for i in range(1,10**6+3):
        NOW=NOW+7*pow(10,i,K)
        NOW%=K

        if NOW==0:
            print(i)
            break
    else:
        print(-1)
        


Measured memory_bytes: 9140
#include<iostream>
#include<cmath>
#include<iomanip>
using namespace std;
int main() {
    int n;
    while (1){
        double sum = 0.0, m, aa = 0.0;
        cin >> n;
        if (n == 0) break;
        int S[n];
        for (int i=0; i<n; i++){
            cin >> S[i];
            sum += S[i];
        }
        m = sum/n;
        for (int j=0; j<n; j++){
            aa += (S[j]-m)*(S[j]-m);
        }
        aa = aa/n;
        cout << fixed << setprecision(15) << sqrt(aa) << endl;

    }
    return 0;
}


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

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; }

#define rep(i,cc,n) for(int i=cc;i<n;++i)
#define lrep(i,cc,n) for(long long i=cc;i<n;++i)
#define sqrep(i,cc,n) for(long long i=cc;i*i<=n;++i)
#define rrep(i,cc,n) for(long i=cc;i>n;--i)
#define pii pair<int, int>
#define pll pair<long long, long long>
 
using ll = long long;

const vector<int> dx = {1, 0, -1, 0};
const vector<int> dy = {0, 1, 0, -1};
const ll inf = 1001001001;
const ll e9  = 1000000000;
const ll mod = 1000000007;


int main() {
    int x, n;
    cin >> x >> n;
    vector<bool>p(100,true);
    if(n==0){
        cout << x << endl;
        return 0;
    }
    rep(i, 0, n){
        int a;
        cin >> a;
        a--;
        p[a]=false;
    }
    int ans=10000,b=0;
    rep(i, 0, 100){
        if(!p[i])continue;
        int temp = ans;
        ans = min(ans,abs(x-(i+1)));
        if(ans < temp)b = i+1;
    }
    if(abs(x-b)>abs(101-x)){
        cout << 101 << endl;
    }
    else if(abs(b-x)<x){
        cout << b << endl;
    }else{
        cout << 0 << endl;
    }
    return 0;
}

Measured memory_bytes: 3632
import java.util.Scanner;
import java.io.IOException;

// ALDS1_9_A
public class Main {
	void run() throws IOException {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] A = new int[n+1]; A[0] = 0;
		for (int i = 1; i < n+1; i++) {
			A[i] = sc.nextInt();
		}
		for (int i = 1; i < n+1; i++) {
			System.out.print("node " + i + ": key = " + A[i] + ", ");
			if (i/2 > 0) System.out.print("parent key = " + A[i/2] + ", ");
			if (2*i < A.length) System.out.print("left key = " + A[2*i] + ", ");
			if (2*i+1 < A.length) System.out.print("right key = " + A[2*i+1] + ", ");
			System.out.println();
		}
	}
	
	public static void main(String[] args) throws IOException {
		new Main().run();
	}
}



Measured memory_bytes: 27276
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){return o<<"("<<p.fs<<","<<p.sc<<")";}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){o<<"sz = "<<vc.size()<<endl<<"[";for(const T& v:vc) o<<v<<",";o<<"]";return o;}

template<class D>
vector<D> dijkstra(const vector<vector<pair<int,D>>>& G, int s = 0){	//G:(v,cost)
	using P = pair<D,int>;
	priority_queue<P,vector<P>,greater<P> > que;
	int N = G.size();

	D inf = 1e9;
	vector<D> d(N,inf);
	d[s] = 0;
	que.push(P(0,s));

	while(!que.empty()){
		P p=que.top();
		que.pop();
		int v = p.sc;
		D c = p.fs;
		if(d[v]!=c) continue;
		for(auto p:G[v]){
			int to=p.fs;
			if(d[to]>d[v]+p.sc){
				d[to]=d[v]+p.sc;
				que.push(P(d[to],to));
			}
		}
	}

	return d;
}

const int X = 1000;
int H,W,N;
int x[100],y[100];
int getid(int i,int d){
	return i*X+d;
}
using P = pair<int,int>;
vector<vector<P>> G;
int main(){
	cin>>H>>W>>N;
	rep(i,N) cin>>x[i]>>y[i],x[i]--,y[i]--;
	G.resize(N*X+1);
	int S = N*X;
	rep(i,N){
		rep(d,X-1){
			G[getid(i,d)].pb(P(getid(i,d+1),1));
			G[getid(i,d+1)].pb(P(getid(i,d),0));
		}
		rep(d,X){
			rep(j,N) if(j!=i){
				int e = abs(x[i]-x[j])+abs(y[i]-y[j]) - d - 1;
				if(e<0) e = 0;
				G[getid(i,d)].pb(P(getid(j,e),e));
			}
		}
	}
	rep(i,N){
		int d = x[i]+y[i];
		G[S].pb(P(getid(i,d),d));
	}
	auto d = dijkstra(G,S);
	int ans = 1e9;
	rep(i,N){
		int p = (H-1-x[i])+(W-1-y[i]);
		chmin(ans,d[getid(i,p)]);
	}
	cout<<ans<<endl;
}



Measured memory_bytes: 107832
import java.math.BigDecimal;
import java.util.*;
public class Main{
    public static void main(String[] args)throws Exception{
        Scanner sc = new Scanner(System.in);

        long n = sc.nextInt();
        long m = sc.nextInt();
        long d = sc.nextInt();


//        System.out.println((2*(n-d)*Math.pow(n,(m-2))*(m-1)));
        if(d!=0)
            System.out.println(BigDecimal.valueOf((2*(n-d)*(m-1))/Math.pow(n,2)).toPlainString());

        else
            System.out.println(BigDecimal.valueOf(((n-d)*(m-1))/Math.pow(n,2)).toPlainString());

    }
}

Measured memory_bytes: 24020
#include<bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<ll, ll> pll;
#define mod 1000000007
#define all(x) (x).begin(), (x).end()
#define call(x) (x).cbegin(), (x).cend()
#define pb push_back
const long double PI = acos(-1);
const long long INF = (1 << 30);
ll gcd(ll a,ll b){return b ? gcd(b,a%b) : a;}
ll lcm(ll a,ll b){return a / gcd(a,b) * b;}
ll stringcount(string s, char c){return count(s.cbegin(), s.cend(), c);}
bool isInteger(double x){return floor(x) == x;}
ll ceil(const ll a, const ll b){return ((a)+(b)-1)/b;}


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

  ll n;
  cin >> n;
  ll sum = 0;
  for(ll i = 1; i <= n; i++){
    if(i % 3 == 0 || i % 5 == 0) continue;
    else sum += i;
  }

  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 3652
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
using namespace std;
int A[307][307];
int main()
{
	ios::sync_with_stdio(false);
	int n, m;
	while (cin >> n >> m) {
		for (int i = 1; i <= n; ++i) //ren
			for (int j = 1; j <= m; ++j) //比赛
				cin >> A[i][j];
		int vis[307], sum[307];
		//每个人都参赛，选择比赛个数，是每场比赛的人最少
		 //每场比赛最多有cnt个人参赛
		memset(vis, 1, sizeof vis);
		int cnt = 0, ans = n;
		while (true) {
			memset(sum, 0, sizeof sum);
			for (int i = 1; i <= n; ++i) {
				for (int j = 1; j <= m; ++j) {
					if (vis[A[i][j]]) {
						sum[A[i][j]]++;
						break;
					}
				}
			}
			int maxV = 0;
			for (int i = 1; i <= m; ++i) 
				maxV = max(maxV, sum[i]);
			for (int i = 1; i <= m; ++i) {
				if (sum[i] == maxV)
					vis[i] = 0, cnt++;
			}
			ans = min(ans, maxV);
			if (cnt == m) 
				break;
		}
		cout << ans << endl;
	}

	return 0;
}

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

int main()
{
	int a[3][3]={0};
	for(int i=0;i<3;i++)
	{
	    for(int j=0;j<3;j++)
	    {
	        cin>>a[i][j];
	    }
	}
	int x;
	cin>>x;
	while(x--)
	{
	    int m;
	    cin>>m;
	    for(int i=0;i<3;i++)
	{
	    for(int j=0;j<3;j++)
	    {
	        if(a[i][j]==m)
	         a[i][j]=-1;
	    }
	}
	}
	int flag=0;
	for(int i=0;i<3;i++)
	{
	    int flag1=0;
	    for(int j=0;j<3;j++)
	    {
	        if(a[i][j]!=-1)
	        {
	            flag1=1;
	            break;
	        }
	    }
	    if(flag1==0)
	    {
	        flag=1;
	    }
	}
	for(int i=0;i<3;i++)
	{
	    int flag2=0;
	    for(int j=0;j<3;j++)
	    {
	        if(a[j][i]!=-1)
	        {
	            flag2=1;
	            break;
	        }
	    }
	    if(flag2==0)
	    {
	        flag=1;
	    }
	}
	if(a[0][0]==-1 and a[1][1]==-1 and a[2][2]==-1)
	{
	    flag=1;
	}
	if(a[0][2]==-1 and a[1][1]==-1 and a[2][0]==-1)
	{
	    flag=1;
	}
	if(flag==1)
	{
	    cout<<"Yes"<<endl;
	}
	if(flag==0)
	{
	    cout<<"No"<<endl;
	}
	
}


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

int main() {
    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    int sum = 1;
    int l = 0, r = 0, cnt = 0;
    while (r < n) {
        if (s[r] == '0') {
            while (s[r] == '0') r++;
            cnt++;
        }
        while (s[r] == '1') r++;
        if (cnt <= k) sum = max(sum, r - l);
        if (cnt == k) {
            while (s[l] == '1') l++;
            while (s[l] == '0') l++;
            cnt--;
        }
    }
    if (cnt == k) sum = max(sum, r - l);
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 512
import itertools

N, X, Y = list(map(int, input().split()))

ans = [0] * N
comb = list(itertools.combinations(range(1,N+1),2))


for i in range(len(comb)):
    if comb[i][0] <= X and comb[i][1] >= Y:
        k = comb[i][1] - Y + X - comb[i][0]  + 1
        ans[k] += 1
    elif comb[i][0] <= X:
        k = X - comb[i][0] + min(comb[i][1] - X, Y - comb[i][1]+1)
        ans[k] += 1
    elif comb[i][1] >= Y:
        k = comb[i][1] - Y + min(Y - comb[i][0], comb[i][0] - X + 1)
        ans[k] += 1
    else:
        k = min(comb[i][1] - comb[i][0], comb[i][0] - X + Y - comb[i][1] + 1)
        ans[k] += 1
for i in range(1,N):
    print(ans[i])

Measured memory_bytes: 130248
N=int(input())
coins = [100,101,102,103,104,105]
dp = [int(i%coins[0]==0) for i in range(N+1)]
for coin in coins[1:]:
  for i in range(coin,N+1):
    dp[i] += dp[i - coin]
if dp[-1] != 0:
  print(1)
else:
  print(0)

Measured memory_bytes: 13688
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#define ll long long
#define fi first
#define se second
#define pb push_back
#define me memset
const int N = 1e6 + 10;
const int mod = 1e9 + 7;
const int INF = 0x3f3f3f3f;
using namespace std;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;

int h1,m1,h2,m2,k;

int main() {
    ios::sync_with_stdio(false);cin.tie(0);
    cin>>h1>>m1>>h2>>m2>>k;

    int cnt=60-m1;
    cnt+=(h2-h1-1)*60+m2;
    printf("%d\n",cnt-k);



    return 0;
}

Measured memory_bytes: 3784
A=int(input())
B=int(input())
C=int(input())
X=int(input())
count=0

for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            if 500*i+100*j+50*k==X:
                count+=1
            else:
                pass

print(count)

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

using namespace std;

#define all(x) (x).begin(), (x).end()

typedef long long ll;

void solve() {
  string s; cin >> s; int sum = 0;
  for (auto x : s) sum += x - '0';
  cout << (sum % 9 == 0 ? "Yes" : "No");
}

// CHECK LIMITS (n <= 10^5)
// CHECK CORNER CASES (n == 1)

int main() {
    ios::sync_with_stdio(NULL), cin.tie(0), cout.tie(0);
    cout.setf(ios::fixed), cout.precision(20);
    //cout << 1.0 * clock() / CLOCKS_PER_SEC << endl;
    solve();
}


Measured memory_bytes: 3752
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
REP(i,v.size()){if(i)os<<" ";os<<v[i];}return os;}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
REP(i,v.size()){if(i)os<<endl;os<<v[i];}return os;}

int main()
{
	int N;
	cin >> N;
	vector<int> price(N);
	rep(i, N) {
		cin >> price[i];
	}

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

	int sum = price[N - 1] / 2;

	rep(i, N - 1) {

		sum = sum + price[i];

	}

	cout << sum << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvec;
typedef vector<vector<bool>> vveb;
typedef vector<vector<string>> vves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pb push_back
#define pp pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
//const int64 INF = 1LL << 58;
#define dame { puts("-1"); return 0;}
#define YES { cout << "YES" << endl; return 0; }
#define NO { cout << "NO" << endl; return 0; }
#define Yes { cout << "Yes" << endl; return 0; }
#define No { cout << "No" << endl; return 0; }
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 (a>b) { a=b; return 1; } return 0; }
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};

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

	ll A, B, K; cin >> A >> B >>  K;
	if(A >= K) {
		cout << A - K << " " << B << endl;
	}
	else {
		K -= A;
		A = 0;
		if(B >= K) {
			cout << 0 << " " << B - K << endl;
		}
		else {
			cout << 0 << " " << 0  << endl;
		}
	}
}

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

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		String s = scan.next();
		int i = 0;
		int j = 0;
		int count = 0;
		int max = 0;
		for(i = 1; i < n; i++) {
			String x = s.substring(0, i);
			String y = s.substring(i);
			Set<String> set_x = new HashSet<String>();
			Set<String> set_y = new HashSet<String>();
			for(j = 0; j < x.length(); j++) {
				set_x.add(x.charAt(j) + "");
			}
			for(j = 0; j < y.length(); j++) {
				set_y.add(y.charAt(j) + "");
			}
			int before = set_y.size();
			set_y.removeAll(set_x);
			int after = set_y.size();
			if(max < before - after) {
				max = before - after;
			}
		}
		System.out.println(max);
	}
}

Measured memory_bytes: 25172
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
using ll=long long;

int main(){
    int a,b,h,m;
    cin>>a>>b>>h>>m;
    double deg;
    deg=M_PI*((h+m/60.0)*5-m)/30.0;
    cout<<fixed<<setprecision(15)<<sqrt(1.0*a*a+1.0*b*b-2.0*a*b*cos(deg));

    return 0;
}



Measured memory_bytes: 4164
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System.Text.RegularExpressions;

class Program
{
    const string Yes = "Yes";
    const string No = "No";
    const char White = '.';
    const char Black = '#';
    const long Mod = 1000000007;

    static void Main(string[] args) {
#if DEBUG
        MyDebugger.Test(process, "../TextFile1.txt");
#else
        object ret = process(new StreamReader(Console.OpenStandardInput()));
        Console.WriteLine(ret);
#endif
    }

    static object process(TextReader input) {
        var n = int.Parse(input.ReadLine());
        var s = input.ReadLine();

        var dic = new DefaultDectionary<char, int>(0);

        foreach(var c in s) {
            dic[c]++;
        }

        long y = 1;
        foreach(var ent in dic) {
            y *= (ent.Value + 1);
            y %= Mod;
        }

        y -= 1; //All0

        return y;
    }

    class DefaultDectionary<Tkey, TValue> : Dictionary<Tkey, TValue>
    {
        TValue DefaultValue;
        public DefaultDectionary(TValue defaultvalue) {
            this.DefaultValue = defaultvalue;
        }
        public new TValue this[Tkey key] {
            get {
                if (this.ContainsKey(key)) return base[key];
                else return DefaultValue;
            }
            set {
                base[key] = value;
            }
        }
    }

    static int[] ToIntArray(string strs, int n) {
        var ret = new int[n];
        var spl = strs.Split(' ');
        for (int i = 0; i < n; i++)
            ret[i] = int.Parse(spl[i]);
        return ret;
    }
}


Measured memory_bytes: 13140
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	int m;				// 駅の数
	int[] station;	// 最小値保管配列
	
	// sからgまでtypeに関して最小値を生成する
	// 　ダイクストラアルゴリズム
	void Solve(int s, int g, int[][] type){
		station = new int[m+1];
		Arrays.fill(station, Integer.MAX_VALUE);
		boolean[] enter = new boolean[m+1];		// 頂点確定保管
		station[s] = 0;		// スタート地点からスタート地点まで0
		while(true){
			int idx = -1;		// 最小値のインデックス
			int min = Integer.MAX_VALUE;
			// 頂点確定の最小値探索
			for(int i=1;i<=m;i++){
				if(!enter[i] && station[i]<min){
					min = station[i];
					idx = i;
				}
			}
			// idxの更新がない、つまり次の頂点確定がない
			if(min==Integer.MAX_VALUE){
				break;
			}
			enter[idx] = true;		// 頂点確定
			if(enter[g]==true){		// ゴール頂点が確定
				break;
			}
			for(int i=1;i<=m;i++){
				// 遷移先が確定済みもしくは接続されていない
				if(enter[i]||type[idx][i]==Integer.MAX_VALUE){
					continue;
				}
				// 遷移先への値合計が最小値なら更新
				station[i] = Math.min(station[i], station[idx]+type[idx][i]);
			}
		}
	}
	
	void run(){
		Scanner stdIn = new Scanner(System.in);
		while(true){
			int n = stdIn.nextInt();
			m = stdIn.nextInt();
			if((n|m)==0){
				return;
			}

			// init
			int[][] cost = new int[m+1][m+1];
			int[][] time = new int[m+1][m+1];
			for(int i=0;i<=m;i++){
				Arrays.fill(cost[i], Integer.MAX_VALUE);
				Arrays.fill(time[i], Integer.MAX_VALUE);
			}

			// input (line)
			for(int i=0;i<n;i++){
				int s = stdIn.nextInt();
				int g = stdIn.nextInt();
				cost[s][g] = stdIn.nextInt();
				cost[g][s] = cost[s][g];
				time[s][g] = stdIn.nextInt();
				time[g][s] = time[s][g];
			}

			// input (question)
			int k = stdIn.nextInt();
			for(int i=0;i<k;i++){
				int p = stdIn.nextInt();
				int q = stdIn.nextInt();
				int r = stdIn.nextInt();
				if(r<1){
					Solve(p,q,cost);
				}
				else{
					Solve(p,q,time);
				}
				System.out.println(station[q]);
			}
		}
	}
	
	public static void main(String[] args) {
		new Main().run();
	}
}

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

int main(void){
    int A,B;cin>>A>>B;
    if (A < B) swap(A, B);
    int result = 0;
    result += A;
    A--;
    if (A < B) swap(A, B);
    result += A;
    cout << result << endl;
    return 0;
}

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

int main(){
  int n;
  cin >> n;
  int l[n];
  for(int i=0;i<n;i++){
    cin >> l[i];
  }
  int sum = 0,max = -1,maxindex;
  for(int i=0;i<n;i++){
    if(max < l[i]){
      max = l[i];
      maxindex = i;
    }
  }
  for(int i=0;i<n;i++){
    if(i != maxindex){
      sum += l[i];
    }
  }
  if(max < sum){
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
a, b = list(map(int, input().split(' ')))
def gcd(l, s):
  return l if s == 0 else gcd(s, l % s)

temp = gcd(a, b)

ans = 0
for i in range(2,1000000):
  if temp % i == 0:
    ans += 1
    while temp % i == 0:
      temp = temp // i
  if temp == 1:
    break
if temp != 1:
  ans += 1

print(ans+1)

Measured memory_bytes: 40044
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define vi vector<int>
#define nl endl
#define tc    \
    ll t;     \
    cin >> t; \
    while (t--)
#define fastio                       \
    ios_base::sync_with_stdio(NULL); \
    cin.tie(NULL);                   \
    cout.tie(NULL);
using namespace std;
int main()
{
    fastio;
    string s;
    cin >> s;
    int n = s.size(), c = 0;
    for (int i = 0; i < n - 1; i++)
    {
        if (s[i] == '1' && s[i + 1] == '1')
        {
            c++;
            s[i + 1] = '0';
        }
        else if (s[i] == '0' && s[i + 1] == '0')
        {
            c++;
            s[i + 1] = '1';
        }
    }
    cout<<c;
}

Measured memory_bytes: 3784
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<cstdlib>
using namespace std;

int n,x;
int s[3];

int main(){
	int i;
	scanf("%d",&n);
	for (i=1;i<=n;i++) scanf("%d",&x),s[x&1]++;
	if (s[1]&1){
		printf("NO\n");
		return 0;
	}
	if (s[0]+s[1]/2==1){
		printf("YES\n");
		return 0;
	}
	printf("YES\n");
	return 0;
}

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

using namespace std;
#define ll long long

#define pii pair<int,int>
#define pll pair<ll,ll>
#define _ <<'\n'
#define __ << ' '
#define all(x) (x).begin(), (x).end()
#define gcd __gcd
int IT_MAX = 1 << 17;
int MOD = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const double PI = acos(-1);
const double ERR = 1e-10;
#define szz(x) (int)(x).size()
#define IOS ios_base::sync_with_stdio(false); cout.tie(0);cin.tie(0);
#define flush fflush(stdout)

ll mod(ll a, ll m) { return (a + (abs(a) / m) * m + m) % m; }

//****************************don't use int!!!!!!!****************************//
//***************************code starts here!!!!!****************************//

ll sm(ll x, ll y) {
    return (x + y) / 10 + (x + y) % 10;
}

pll cnt(ll x, ll n) {
    if (n == 1) {
        return {x, 0};
    }
    if (x < 5) {
        pll temp = cnt(2 * x, n / 2);
        temp.second += n / 2;
        if (n % 2 == 1) {
            if (x + temp.first < 10) {
                return {x + temp.first, temp.second + 1};
            } else {
                return {sm(x, temp.first), temp.second + 2};
            }
        }
        return temp;
    } else {
        pll temp = cnt(sm(x,x), n / 2);
        temp.second += (n / 2) * 2;
        if (n % 2 == 1) {
            if (x + temp.first < 10) {
                return {x + temp.first, temp.second + 1};
            } else {
                return {sm(x, temp.first), temp.second + 2};
            }
        }
        return temp;
    }
}

int main() {
    IOS

    ll m;
    cin >> m;
    vector<pll > v(m);
    for (int i = 0; i < m; ++i) {
        cin >> v[i].first >> v[i].second;
    }

    vector<ll> vec(m);
    ll ans = 0;
    for (int i = 0; i < m; ++i) {
        pll temp = cnt(v[i].first, v[i].second);
        ans += temp.second;
        vec[i] = temp.first;
    }

    ll cur = vec[0];
    for (int i = 1; i < m; ++i) {
        if (cur + vec[i] < 10) {
            ans += 1;
            cur = vec[i] + cur;
        } else {
            ans += 2;
            cur = sm(vec[i], cur);
        }
    }
    cout << ans;

    return 0;
}

Measured memory_bytes: 4992
#include <algorithm>
#include <cctype>
#include <iostream>
#include <string>

int main(void){
    std::string s;
    std::cin >> s;
    int first = std::stoi(s.substr(0,2));
    int second = std::stoi(s.substr(2,4));
    bool x = 0 < first && first < 13;
    bool y = 0 < second && second < 13;
    if(x && y){
        std:: cout << "AMBIGUOUS" << std::endl;
    } else if(x) {
        std::cout << "MMYY" << std::endl;
    } else if(y) {
        std::cout << "YYMM" << std::endl;
    } else {
        std::cout << "NA" << std::endl;
    }
    return 0;
}

Measured memory_bytes: 256
#!python3

import sys
iim = lambda: map(int, sys.stdin.readline().rstrip().split())

def resolve():
    a, b, c = iim()
    k = int(input())

    i = 0
    while a >= b:
        b *= 2
        i += 1
    while b >= c:
        c *= 2
        i += 1

    print("Yes" if i <= k else "No")

if __name__ == "__main__":
    resolve()


Measured memory_bytes: 61716
#include<bits/stdc++.h>
using namespace std;
const int MX=1e6+5;
set<int> s;
int n,x,k,y,f[MX];
bool b;
int main()
{
    for(int i=0; i<MX; i++) f[i]=i;
    for(int i=2; i*i<MX; i++){
        if(f[i]!=i) continue;
        for(int j=i*i; j<MX; j+=i){
            if(f[j]==j) f[j]=i;
        }
    }
    cin >> n;
    for(int i=0; i<n; i++){
        cin >> x;
        y=__gcd(y,x);
        while(x>1){
            k=f[x];
            if(s.find(k)!=s.end()) b=true;
            s.insert(k);
            while(x%k==0) x/=k;
        }
    }
    if(!b){
        cout << "pairwise coprime";
        return 0;
    }
    if(y>1) cout << "not coprime";
    else cout << "setwise coprime";
    return 0;
}

Measured memory_bytes: 11212
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(300000)


def solve(N: int, A: int, B: int, X: "List[int]"):
    ret = 0
    cur = X[0]
    for i in range(1, N):
        ret += min(A * (X[i] - X[i - 1]), B)
    print(ret)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    X = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"
    solve(N, A, B, X)

if __name__ == '__main__':
    main()


Measured memory_bytes: 15384
using System;
public class Hello
{
    public static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        string[] s=Console.ReadLine().Trim().Split(' ');
        string[] sa = new string[n];
        for(int i = 0; i < n; i++)
        {
            sa[int.Parse(s[i])-1] = (i+1).ToString();
        }
        for(int i=0;i<n;i++)
            Console.Write(sa[i]+" ");
    }
}

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

int H, N[5000000];

void MaxHeap(int i)
{
	int l = 2 * i;
	int r = l + 1;
	int largest = i;
	int temp;

	if (l <= H && N[l] > N[largest])   //---------
		largest = l;

	if (r <= H && N[r] > N[largest])
		largest = r;

	if (largest != i)
	{
		temp = N[i];
		N[i] = N[largest];
		N[largest] = temp;

		MaxHeap(largest);
	}
}

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

	cin >> H;
	for (int i = 1; i <= H; i++)
		cin >> N[i];

	for (int i = H / 2; i >= 1; i--)
		MaxHeap(i);
	
	for (int i = 1; i <= H; i++)
		cout << " " << N[i];

	cout << endl;
	return 0;
}


Measured memory_bytes: 5096
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll gcd(ll a, ll b){
  if(b == 0) return a;
  gcd(b,a%b);
}

int main() {
  ll N,X;
  cin >> N >> X;
  vector<ll> x(N);
  for(ll i = 0;i<N;i++){
    cin >> x[i];
  }
  sort(x.begin(),x.end());
  
  vector<ll> x2;
  ll c = 0;
  bool flag = false;
  for(ll i = 0;i<N;i++){
    if(x[i] < X){
      x2.push_back(x[i]);
    }
    else {
      x2.push_back(X);
      c = i;
      flag = true;
      break;
    }
  }
  if(flag){
  for(ll i = c;i<N;i++){
    x2.push_back(x[i]);
   }
  }
   if(X > x[N-1]){
    x2.push_back(X);
  }
 
  vector<ll> d(N);//x2の隣り合う二項の差の配列
  for(ll i = 0;i<N;i++){
    d[i] = x2[i+1]-x2[i];
  }
  
  ll ans = gcd(d[0],d[1]);
  for(ll i = 2;i<N;i++){ 
    ans = gcd(ans,d[i]);
  }
   cout << ans << endl;             
}


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

int main(){
    int n,m,k;
    cin>>n>>m>>k;
    vector<ll>a,b;
    a.push_back(0);
    b.push_back(0);
    ll sum=0;
    rep(i,n){
        int x; cin>>x;
        sum+=x;
        a.push_back(sum);
    }
    sum=0;
    rep(i,m){
        int x; cin>>x;
        sum+=x;
        b.push_back(sum);
    }
    int ans=0;
    rep(i,n+1){
        int l=0,r=m+1;
        while(r-l>1){
        int mid=(l+r)/2;
            if(a[i]+b[mid]-k<=0)l=mid;
            else r=mid;
        }
        if(a[i]-b[l]-k<=0)ans=max(ans,i+l);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 7988
#include<cstdio>
#include<string>
#include<iostream>
#include<algorithm>

using namespace std;

int main(void){
	int n;
	double stu[64];
	double shi[8]={0.0,165.0,170.0,175.0,180.0,185.0,2000000000.0};
	scanf("%d", &n);
	for(int i = 0; i < n; i++){
		scanf("%lf", &stu[i]);
	}
	
	sort(stu,stu+n);
	for(int i = 0; i < 6; i++){
		printf("%d:",i+1);
		for(int j = 0; j < n; j++){
			if(shi[i+1]>stu[j]&&shi[i]<=stu[j]){
				printf("*");
			}
		}puts("");
	}
	
	return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
int main(){
    string a,b;
    cin>>a>>b;
///    if(a[0]==b[2] && a[1]==b[1] && a[2]==b[0]) cout<<"Yes";
///   else cout<<"No";

      reverse(b.begin(),b.end());
       string c=b;
       if(a==c) cout<<"YES";
       else cout<<"NO";


}


Measured memory_bytes: 256
A, B = map(int, input().split())
S = input()

def isNum(c):
    return ord('0') <= ord(c) and ord('9') >= ord(c)
flag = True
for c in S[:A]:
    if not isNum(c):
        flag = False
        break
if S[A] != '-':
    flag = False
for c in S[A+1:]:
    if not isNum(c):
        flag = False
        break
if flag:
    print('Yes')
else:
    print('No')


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

int mod = 1000000007;

ll gcdx(ll m, ll n){
    if(n == 0){
        return 1;
    } else if(n % 2 == 0){
        ll res = gcdx(m, n/2);
        return res * res % mod;
    } else {
        ll res = gcdx(m, n-1);
        return m * res % mod;
    }
}

int main() {
    ll m, n; cin >> m >> n;
    cout << gcdx(m, n) << endl;

    return 0;
}


Measured memory_bytes: 3092
package main

import "fmt"

func main() {
	var W, H, x, y, r int

	fmt.Scanf("%d %d %d %d %d", &W, &H, &x, &y, &r)

	if x-r >= 0 && x + r <= W && y-r >= 0 && y+r <= H {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}



Measured memory_bytes: 1152
#coding:utf-8
import sys,os
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = (lambda *something: print(*something)) if 'TERM_PROGRAM' in os.environ else lambda *x: 0
def main(given=sys.stdin.readline):
    input = lambda: given().rstrip()
    LMIIS = lambda: list(map(int,input().split()))
    II = lambda: int(input())
    XLMIIS = lambda x: [LMIIS() for _ in range(x)]
    YN = lambda c : print('Yes') if c else print('No')
    MOD = 10**9+7

    ans = 6
    print(ans//II()//II())

if __name__ == '__main__':
    main()

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

int main() {
  int N,sum,dig;
  cin >> N;
  int N2 = N;
  while(N >= 1){
    dig = N%10;
    sum += dig;
    N = N/10;
  }
  if(N2%sum == 0){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
function Main(input) {
  input = input.split("\n");
  var N = parseInt(input[0]);
  var A = input[1].split(" ").map(i => parseInt(i));
  var ans = "APPROVED";
  for(var i=0;i<N;i++){
    if(A[i]%2==0&&(A[i]%3!=0&&A[i]%5!=0)){
      var ans ="DENIED";
    }
  }

  console.log('%s', ans);
  return ans;
}

function debug(n){
  var input = document.getElementById("input"+n).value;
  var ans=Main(input);
  var result="WA";
  if(ans==document.getElementById("output"+n).value.split("\n")[0]){
    result="AC";
  }
  document.getElementById("result"+n).innerHTML=result;
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
#include<iostream>
#include<set>
using namespace std;
int main()
{
	set<int> cpp;
	int q, com, o;
	cin >> q;
	bool x = true;
	while (q--)
	{
		cin >> com >> o;
		if (com)
		{
			if(com==1)
			cout << cpp.count(o) << endl;
			else cpp.erase(o);
		}
		else
		{
			cpp.insert(o);
			cout << cpp.size() << endl;
		}
	}
	return 0;
}


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

int main()
{

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int i,t,j=0;
    string str;
    cin>>t>>str;
    if(t&1){
      cout<<"No"<<endl;
                return 0;
    }


    for(i=t/2; str[i]; i++,j++)
        {
            if(str[i]!=str[j])
            {
                cout<<"No"<<endl;
                return 0;

            }

    }


cout<<"Yes"<<endl;



return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string>
#define ft first
#define sc second
#define pt(sth) cout << sth << "\n"
#define chmax(a, b) (a)=max(a, b);
#define chmin(a, b) (a)=min(a, b);
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
static const ll INF=1e18;
static const ll MAX=101010;
static const ll MOD=1e9+7;


/*
 for(i=0; i<N; i++)
   cin >> a[i];
*/



int main(void) {
  ll i, j, k;
  
  string s;
  cin >> s;
  ll N=s.size();
  ll cnt[26]={};
  
  for(i=0; i<N; i++) cnt[s[i]-'a']++;
  
  ll ans=N*(N+1)/2;
  for(i=0; i<26; i++) ans-=cnt[i]*(cnt[i]+1)/2;
  
  ans++;
  pt(ans);
  
}





Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;


int main()
{	
	const double pi = 3.141592653589793;
	double a,b,c,d;
	cin>>a>>b>>c>>d;
	//長針
	double x1=sin(pi*d/30)*b;
	double y1=cos(pi*d/30)*b;
	//短針
	double x2=sin(pi*(c*30+d/2)/180)*a;
	double y2=cos(pi*(c*30+d/2)/180)*a;
	cout<<setprecision(15)<<sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2))<<endl;
	return 0;
}

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

int main(void)
{
    int n;
    cin>>n;
    long long int max=0,ms=0,tot_player;
    long long int arr[n][2];
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<2;j++)
        {
            cin>>arr[i][j];
        }
        if(arr[i][0]>max)
        {
            max=arr[i][0];
            ms=arr[i][1];
        }
    }
    tot_player=max;
    while(ms--)
    {
        tot_player++;
    }

    cout<<tot_player<<endl;
    return 0;
}


Measured memory_bytes: 1792
from collections import Counter

H, W, K = [int(_) for _ in input().split()]

MOD = 1000000007

pats = [[0]]

for i in range(1, W):
    pats = [p + [i] for p in pats] + [p[:-1] + [i, i - 1] for p in pats if p[-1] == i - 1]

iws = [Counter(r) for r in zip(*pats)]

rs = [1] + [0] * (W - 1)

for j in range(H):
    rs = [sum(rs[i] * iw[i] for i in iw) % MOD for iw in iws]

print(rs[K - 1])


Measured memory_bytes: 3316
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int main()
{
    ll n,i,j,k,s=0,c=1,x=1,t;
    cin>>n;
    for(i=1;i<=n;i++)
    {
          for(j=1;j<=n;j++)
          {
                    for(k=1;k<=n;k++)
                              s+=__gcd(__gcd(i,j),k);
          }
    }
    cout<<s;
}


Measured memory_bytes: 3636
cnts = [0 for i in range(0, 10**5 + 1)]
sum = 0
N = int(input())
A = map(int, input().split())
for i in A:
    sum += i
    cnts[i] = cnts[i] + 1
Q = int(input())
for _ in range(0, Q):
    B, C = map(int, input().split())
    sum = sum - (cnts[B] * B)
    sum = sum + (cnts[B] * C)
    cnts[C] = cnts[B] + cnts[C]
    cnts[B] = 0
    print(sum)


Measured memory_bytes: 17972
W,H,c=map(str,input().split())
W,H=int(W),int(H)

for i in range(H):
    if i==0 or i==H-1:
        print("+"+"-"*(W-2)+"+")
    elif i==H//2:
        j=(W-2)//2
        print("|"+"."*j+c+"."*j+"|")
    else:
        print("|"+"."*(W-2)+"|")



Measured memory_bytes: 5600
M,K=map(int,input().split())
if 2**M<=K:
  print(-1)
  exit()
if K==0:
  ans=[]
  for i in range(2**M):
    ans.append(str(i))
    ans.append(str(i))
  print(" ".join(ans))
  exit()
if M==1:
  print(-1)
  exit()
ans=["0"]
for i in range(1,2**M):
  if i!=K:
    ans.append(str(i))
ans.append("0")
ans.append(str(K))
for i in range(1,2**M)[::-1]:
  if i!=K:
    ans.append(str(i))
ans.append(str(K))
print(" ".join(ans))

Measured memory_bytes: 70592
/*starting with the name of almighty ALLAH*/
/*solved by RAKIB JOY*/
// Practice is the only shortcut to improve
#include<bits/stdc++.h>
#define ll long long int
#define pb push_back
#define vc vector
#define vi vc<int>
#define vl vc<ll>
#define dbg(x) cout<<x<<endl;
#define mp(x,y) make_pair(x,y)
#define yes dbg("YES")
#define no dbg("NO")
#define tst int t;cin>>t;while(t--)
#define srt(v) sort(v.begin(),v.end());
#define rsrt(v) sort(v.begin(),v.end(),greater<int>());
#define rj ios::sync_with_stdio(false);cin.tie(0);
#define rvs(v) reverse(v.begin(),v.end());
#define F first
#define S second
#define mod 1000000007
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*b)/gcd(a,b)
#define PI 2*acos(0.0)
#define pii pair<int,int>
#define fr(i,a,b) for(ll i=a;i<=b;i++)
#define coutv(v) for(auto it:v)cout<<it<<' ';cout<<endl;
#define cinv(v) for(auto &it:v)cin>>it;
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<typename T> using ordered_set =tree<T, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>;
*/
//sieve bool b[1000005];void primenire(){int i, j;b[0]=true;b[1]=true;for(i=4; i<=1000000; i+=2){b[i]=true;}for(i=3; i<=1001; i+=2){if(!b[i]){for(j=i*i; j<=1000001; j+=2*i){b[j]=true;}}}}
//power ll power(ll a,ll b){if(b==0) return 1LL;if(b&1) return a*power(a,b-1);else return power(a,b/2)*power(a,b/2);}
//bigmod long long int m(long long int a,long long int b,long long int c){if(b==0)return 1;if(b%2==0){long long int  tmp=m(a,b/2,c);return ((tmp%c)*(tmp%c))%c;}elsereturn ((a%c)*(m(a,b-1,c)%c))%c;}
//MaxSubarraySum ll mss(vector<ll>v){ll mx=v[0];ll sz=v.size();for(int i=1;i<=sz;i++){ll t=v[i]+v[i-1];if(t>=v[i]) v[i]=t;mx=max(mx,v[i]*1LL);}return mx;}
//combination ll com[1001][1001];void combination(){com[1][1]=1;com[1][0]=1;for(ll i=2; i<=1000; i++){com[i][0]=1;for(ll j=1; j<=i; j++){com[i][j]=com[i-1][j]+com[i-1][j-1];}}}
///--------------Graph Moves--------------------------------------
///const int fx[] = {+1,-1,+0,+0};
///const int fy[] = {+0,+0,+1,-1};
///const int fx[] = {+0,+0,+1,-1,-1,+1,-1,+1}; ///King's move
///const int fy[] = {-1,+1,+0,+0,+1,+1,-1,-1}; ///king's Move
///const int fx[] = {-2,-2,-1,-1,+1,+1,+2,+2}; ///knight's move
///const int fy[] = {-1,+1,-2,+2,-2,+2,-1,+1}; ///knight's move
///---------------------------------------------------------------

void solve()
{
   string s;
   cin>>s;
   ll sum_of_digits=0;
   for(auto it:s) sum_of_digits+=(it-'0');
   if(sum_of_digits%9==0) cout<<"Yes"<<endl;
   else cout<<"No"<<endl;
}
int main()
{
    rj
    solve();



    return 0;
}



Measured memory_bytes: 3716
#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
#define rep(i, f, n) for (ll i = (f); i < (ll)(n); i++)
#define repe(i, f, n) for (ll i = (f); i <= (ll)(n); i++)
#define accum(x) accumulate((x).begin(), (x).end(), 0)
using namespace std;
using ll = long long;
using pint = pair<int, int>;

int main() {
  ll a, b, c, d;
  cin >> a >> b >> c >> d;
  ll a1 = a * c;
  ll a2 = a * d;
  ll a3 = b * c;
  ll a4 = b * d;
  ll ans = max(a1, max(a2, max(a3, a4)));
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
        using namespace std;
		typedef long long int ll; 

        int main() {
          int N, M;
          cin>> N >> M;
          vector<int> k(M+1);
          vector<vector<int>> l(12, vector<int>(12,0));
          vector<int> p(M+1); 
          // l(i,j)=1 iff i番目の電球がj番目のスイッチとつながっている
          
          for(int i=1; i<=M; i++){
            cin >> k.at(i);
            for(int j=1; j<=k.at(i); j++){
              int s; 
              cin>> s; 
              l.at(i).at(s)=1; 
            }
          }
          
          for(int i=1; i<=M; i++){
              cin >> p.at(i);
          }
          
          
         /* 
          for(int i=1; i<=M; i++){
            cout<< k.at(i)<<" ";
            for(int j=1; j<=N; j++){ 
              cout<< l.at(i).at(j)<<" "; 
            }
            cout<< endl; 
          }
          
           for(int i=1; i<=M; i++){
              cout<< p.at(i)<<" ";
            }
          */
          
          int counter = 0;
          
          for (int tmp = 0; tmp < (1 << N); tmp++) {
            bitset<11> s(tmp);
            
            int onoff;
            int flag=1;
            
            for(int i=1; i<=M; i++){
              onoff=0;
              for(int j=1; j<=N; j++){
                if( l.at(i).at(j)==1 && s.test(j-1)==1 ) onoff++; 
              }
              if((onoff%2)!=p.at(i)) flag=0;
            }
            
            if(flag==1) counter++; 
            
          }
          cout << counter << endl;
        }        


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

char a[55],b[55];
int A,B,C,n,m;
bool f;
void dfs(int x,int y,int z){
	memset(b,0,sizeof(b));
	int k=0;
	if(!y&&!z){
		k=x;for(int i=0;i<x;i++)b[i]='a';
	}else if(!x){
		dfs(y,z,0);
		k=m;
		for(int i=0;i<m;i++)if(a[i]=='a')b[i]='b';else if(a[i]=='b')b[i]='c';
	}else if(x<=z){
		dfs(x,y,z-x);
		for(int i=0;i<m;i++)if(a[i]=='a')b[k++]='a',b[k++]='c';else b[k++]=a[i];
	}else if(x<=y+z){
		dfs(x-z,z,y-x+z);
		for(int i=0;i<m;i++)if(a[i]=='a')b[k++]='a',b[k++]='b';else if(a[i]=='b')b[k++]='a',b[k++]='c';else b[k++]='b';
	}else{
		dfs(x-y-z,y,z);
		for(int i=0;i<m;i++)if(a[i]=='a')b[k++]='a';else if(a[i]=='b')b[k++]='a',b[k++]='b';else b[k++]='a',b[k++]='c';
	}
	memcpy(a,b,sizeof(a));m=k;
}
int main(){
	scanf("%d%d%d",&A,&B,&C);n=A+B+C;
	dfs(A,B,C);
	printf("%s\n",a);
	return 0;
}

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

int main() {
    for (;;) {
        int H, W;
        cin >> H >> W;

        if (H == 0 && W == 0) {
            break;
        } else {
            for (int i = 0; i < H; ++i) {
                for (int j = 0; j < W; ++j) {
                    cout << ((i + j) % 2 ? "." : "#");
                }
                cout << endl;
            }
            cout << endl;
        }
    }
}

Measured memory_bytes: 1152
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define db double
const int inf = 1 << 30;
const ll linf = 1e18;
template<class T> void chmin(T& x, T y){if(x > y) x = y;}
template<class T> void chmax(T& x, T y){if(x < y) x = y;}

ll N, K;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> N >> K;
    ll d = N / K;
    cout << min(N - d * K, d * K + K - N) << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	  public static void main(String[] args) {
	        Scanner scan = new Scanner(System.in);
	        int h,m,s;
	        s=scan.nextInt();
	        h =s/3600;
	        m =(s%3600)/60;
	        s =s%60;
	        System.out.println(h+":"+m+":"+s);
	    }
	}



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

int main() {
	int n,m;
	cin >> n >> m;
	vector<bool> ac(n+1);
	vector<int> cnt_wa(n+1,0);
	rep(i,n+1) ac[i] = false;
	rep(i,m) {
		int num;
		string r;
		cin >> num >> r;
		if (r == "AC") ac[num] = true;
		if (r == "WA" && ac[num] == false) cnt_wa[num]++; 
	}
	int cnt_ac = 0;
	int cnt_wa_all = 0;
	rep(i,n+1) {
		if (ac[i]) {
			cnt_wa_all += cnt_wa[i];
			cnt_ac++;
		}
	}
	cout << cnt_ac << " " << cnt_wa_all << endl;
	return 0;
}


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

        int main() {
          int N;
          cin >> N ;
          
          vector<string> S(N); 
          vector<int> P(N); 
       	  for (int i = 0; i < N; i++) {
    			cin >> S.at(i);
            	cin >> P.at(i); 
  	      }
          
          vector<tuple<string,int,int>> v(N); 
          for(int i = 0; i < N; i++) {
            tuple<string,int,int> a=make_tuple(S.at(i),-P.at(i),i);
            v.at(i)=a; 
          }
          sort(v.begin(),v.end()); 
          
          for(int i = 0; i < N; i++) {
            string s;
            int a, b;
            tie(s,a,b)= v.at(i); 
            cout<< b+1 << endl;
          }
          
          
          
        }

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

int main() {
  int n;cin>>n;
  set<string>st;
  rep(i,n){
    string s;cin>>s;
    st.insert(s);
  }
  cout<<st.size()<<endl;
}

Measured memory_bytes: 19200