akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <string.h>
#include <stdio.h>
#include <cmath>
#include <math.h>
#include <sstream>
#include <iomanip>
#include <time.h>
#include <fstream>

using namespace std;

int main(){
	int n;
	cin>>n;
	vector<int> c;
	vector<int> s;
	vector<int> f;
	c.resize(n-1);
	s.resize(n-1);
	f.resize(n-1);
	for(int i = 0;i < n - 1; i++){
		cin>>c[i]>>s[i]>>f[i];
	}
	for(int i = 0; i < n - 1; i++){
		int curr = i;
		int time = 0;
		while(curr != n-1){
			if (s[curr] > time) time = s[curr];
			if (time%f[curr] != 0) time += f[curr] - (time%f[curr]);
			time += c[curr];
			curr++;
		}
		cout<<time<<endl;
	}
	cout<<0<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int maxx = 1e5 + 7;
int n;
int a[maxx];
map <int, int> mp1;
map <int, int> mp2;

int main() {
	while(scanf("%d", &n) != EOF) {
		int d1 = 0, d2 = 0;
		mp1.clear();
		mp2.clear();
		int max1 = 0, max2 = 0;
		for(int i = 1; i <= n; i++) {
			scanf("%d", &a[i]);
			if(i & 1) {
				mp1[a[i]]++;
				if(mp1[a[i]] > max1) {
					max1 = mp1[a[i]]; //奇数角标对应的数的最多出现次数
					d1 = a[i]; //奇数角标出现次数最多的数
				}
			}
			else {
				mp2[a[i]]++;
				if(mp2[a[i]] > max2) {
					max2 = mp2[a[i]]; //偶数角标对应的数的最多出现次数
					d2 = a[i]; //偶数角标出现次数最多的数
				}
			}
		}
		if(d1 == d2) {
			if(max1 == max2) {
				int dd1 = 0, dd2 = 0;
				for(int i = 1; i <= n; i++) {
					if(a[i] == d1) continue;
					if(i & 1) dd1 = max(dd1, mp1[a[i]]); //奇数角标出现次数第二多的数
					else dd2 = max(dd2, mp2[a[i]]); //偶数角标出现次数第二多的数
				}
				if(dd1 >= dd2) max1 = dd1; //偶不动, 奇换第二多
				else max2 = dd2; //奇不动, 偶换第二多
			}
			else if(max1 > max2) { //奇不动, 偶换第二多
				max2 = 0;
				for(int i = 2; i <= n; i += 2){
					if(a[i] != d2) max2 = max(max2, mp2[a[i]]);
				}
			}
			else { //偶不动, 奇换第二多
				max1 = 0;
				for(int i = 1; i <= n; i += 2){
					if(a[i] != d1) max1 = max(max1, mp1[a[i]]);
				}
			}
		}
		printf("%d\n", n - max1 - max2);
	}
}

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

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define vi vector<int>
#define pb push_back
#define ff first
#define ss second
#define forn(i,n) for(int i=0;i<n;i++)
#define M 1000000007
#define fastio ios_base::sync_with_stdio(false);cin.tie(0)


void solve() {
       
       int x,y;
       cin>>x>>y;

       if(x>8 || y>8)
       cout<<":("<<endl;
       else
       cout<<"Yay!"<<endl;	




}





int32_t main() {

	fastio;

#ifndef ONLINE_JUDGE
	freopen("input1.txt", "r", stdin);
	freopen("output1.txt", "w", stdout);
#endif
	// int t; cin >> t;
	int t=1;

	while (t--) {
		solve();
	}


	return 0;
}

Measured memory_bytes: 3616
#include<bits/stdc++.h>
#define ll long long int
#define ld long long double

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,m;
    cin>>n>>m;
    cout<<(n-1)*(m-1)<<endl;
    return 0;
}


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

struct Node{
    int key;
    struct Node *parent,*left,*right;
};

struct Node *root,*NIL;

void insert(int k){
struct Node *y=NIL;
struct Node *x=root;
struct Node *z;

z=(struct Node *)malloc(sizeof(struct Node));
z->key=k;
z->left=NIL;
z->right=NIL;

while(x!=NIL){
    y=x;
    if(z->key<x->key){
        x=x->left;
    }
    else x=x->right;
}
z->parent=y;
if(y==NIL){
    root=z;
}
else{
    if(z->key<y->key){
        y->left=z;
    }
    else y->right=z;
}
}

void inorder(struct Node *u){
    if(u==NIL) return;
    inorder(u->left);
    printf(" %d",u->key);
    inorder(u->right);
}

void preorder(struct Node *u){
    if(u==NIL)return;
    printf(" %d",u->key);
    preorder(u->left);
    preorder(u->right);
}
int main(){
    int n,i,x;
    char str[10];
   scanf("%d",&n);

    for(i=0;i<n;i++){
        scanf("%s",str);
       
        if(str[0]=='i'){
            scanf("%d",&x);
            insert(x);
        }
        
        else if(str[0]=='p'){
            inorder(root);
            printf("\n");
            preorder(root);
            printf("\n");
        }
    }
    return 0;
}



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

int main(){
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++)cin>>a[i];
    sort(a,a+n);
    ll od=0,ev=0;
    for(int i=n-1;i>=0;i--){
        if(i%2==0)ev+=a[i];
        else od+=a[i];
    }
    cout<<abs(ev-od);
}


Measured memory_bytes: 256
//Created by Kira

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

#define IOS cin.sync_with_stdio(0);cin.tie(0); cout.tie(0);
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
#define pii pair<int,int> 
#define pb push_back
#define vi vector<int> 
using ll = long long;

const int mod = 1e9 + 7;

ll pwr(ll a, ll b);
    



int main(){
   IOS

   ll n, k; cin>>n>>k;

   ll a = n/k;

   cout<<min(abs((a+1)*k - n), abs(a * k - n))<<"\n";



    







}

ll pwr(ll a, ll b){
   a %= mod;	//Remove mod if not required
   ll res = 1;
   while(b > 0){
    if(b&1)
        res = res * a % mod;
        a = a * a % mod;
    b >>= 1;
    }

    return res;
}



Measured memory_bytes: 256
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <iostream>
#include <stdio.h>
#include <vector>
#include <functional>
#include <unordered_set>
#include <algorithm>
#include <set>
#include <map>
#include <cmath>
#include <string>
#include <cstring>
#include <ctime>
#include <cassert>
#include <queue>
#include <stack>
#include <bitset>

using namespace std;

const int N = 2e5 + 10;
const long long INF = 1LL << 60;

void xorVector(vector<char>& a, const vector<char>& b) {
	for (int i = 0; i < a.size(); ++i) {
		a[i] ^= b[i];
	}
}

const int MOD = 998244353;

int add(int a, int b) {
	a += b;
	if (a >= MOD)
		return a - MOD;
	return a;
}

int main()
{
	int n, m;
	cin >> n >> m;
	vector <vector<char>> v(n);
	for (int i = 0; i < n; ++i) {
		v[i].resize(m);
		for (int j = 0; j < m; ++j) {
			cin >> v[i][j];
			v[i][j] = (v[i][j] == '1');
		}
	}
	int r = 0;
	for (int i = 0; i < m; ++i) {
		int id = -1;
		for (int j = r; j < n; ++j) {
			if (v[j][i] == 1) {
				id = j;
				break;
			}
		}
		if (id == -1) {
			continue;
		}
		v[r].swap(v[id]);
		for (int j = r + 1; j < n; ++j) {
			if (v[j][i]) {
				xorVector(v[j], v[r]);
			}
		}
		++r;
	}
	int pw2 = 1;
	vector <int> pow2 = { 1 };
	for (int i = 1; i <= n + m; ++i) {
		pw2 = add(pw2, pw2);
		pow2.push_back(pw2);
	}
	int ans = pow2[n + m - 1] - pow2[n + m - r - 1];
	if (ans < 0) {
		ans += MOD;
	}
	cout << ans << "\n";
	return 0;
}

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

using namespace std;

typedef long long ll;

const int N = 200200;
const int Mod = 1e9 + 7;

int a[N];
int Inv[N];
int Fact[N];
int iFact[N];
int Two[2 * N];
int Four[2 * N];

void add_self(int& x, int y)
{
    if((x += y) >= Mod) x -= Mod;
}

int add(int x, int y)
{
    return add_self(x, y), x;
}

int mul(int x, int y)
{
    return (ll) x * y % Mod;
}

int main()
{
    Inv[1] = 1;
    for(int i = 2; i < N; i++)  Inv[i] = (Mod - mul(Mod / i, Inv[Mod % i])) % Mod;

    Fact[0] = iFact[0] = 1;
    for(int i = 1; i < N; i++)  Fact[i] = mul(i, Fact[i - 1]);
    for(int i = 1; i < N; i++)  iFact[i] = mul(Inv[i], iFact[i - 1]);

    Two[0] = 1;
    for(int i = 1; i < 2 * N; i++)  Two[i] = mul(2, Two[i - 1]);

    Four[0] = 1;
    for(int i = 1; i < 2 * N; i++)  Four[i] = mul(4, Four[i - 1]);

    int n;  cin >> n;

    for(int i = 0; i < n; i++)  scanf("%d", a + i);

    sort(a, a + n, greater <int> ());

    int Ans = 0;

    for(int i = 0; i < n; i++)
    {
        add_self(Ans, mul(mul(a[i], Four[n - i - 1]), add(Two[2 * i + 1], mul(i, Two[2 * i]))));
    }

    cout << Ans << endl;
}


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

int main(){
  int N;
  cin >> N;
  int ans=0;
  for(int i=1; i<10; i++){
    for(int j=1; j<10; j++){
      if(j*i==N) ans++;
    }
  }
  if(ans>0) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
using namespace std;

int W, H, x, y;
double s=0;
int c=0;

int main(){
  if(scanf("%d %d %d %d", &W, &H, &x, &y)==1);
  if( x+x==W && y+y==H )c++;
  s = double(W)*double(H)/2;
  printf("%lf %d", s, c);
  return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<iomanip>
#include<string>
#include<algorithm>
#include<vector>
#include<utility>
#include<tuple>
#include<map>
#include<queue>
#include<stack>
#include<deque>
#include<bitset>
#include<math.h>
using namespace std;
using ll = int64_t;
using Graph = vector<vector<int> >;
const ll M = 1000000007;

int main(){
    int n;
    cin >> n;
    vector<int> d;
    for(int i=0;i<n;i++){
        int e;
        cin >> e;
        d.push_back(e);
    } 

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

    cout << d.at(d.size()/2)-d.at(d.size()/2-1) << endl;
}

Measured memory_bytes: 3928
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<pair<int, int> > vpii;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
#define INF 1000000000
#define MOD 998244353
#define EPSILON 0.00001
#define f first
#define s second
#define pb push_back
#define mp make_pair
 
#define FOR(i, a, b) for (int i=(a); i<=(signed)(b); i++)
#define F0R(i, a) for (int i=0; i<(signed)(a); i++)
#define RFOR(i, a, b) for (int i=(a); i >= b; i--)

#define MN 200005
int m;
ll d[MN], c[MN];

pll calc(int d, ll c){ //dig, #its
    ll res = -1;
    int cur = 0;
    while(c != 1){
        if(c % 2 == 1){
            ++res;
            cur += d;
            if(cur >= 10){
                ++res;
                cur -= 9;
            }
        }
        res += c/2;
        d = d*2;
        if(d >= 10){
            res += c/2;
            d -= 9;
        }
        c /= 2;
    }
    ++res;
    cur = cur+d;
    if(cur >= 10){
        ++res;
        cur -= 9;
    }
    return {cur, res};
}

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

    cin >> m;
    ll tot = -1;
    int cur = 0;
    FOR(i, 1, m){
        cin >> d[i] >> c[i];
        pll res = calc(d[i], c[i]);
        //cout << "res was " << res.f << " " << res.s << "\n";
        tot += res.s;
        cur += res.f;
        ++tot;
        if(cur >= 10){
            ++tot;
            cur -= 9;
        }
    }

    cout << tot << "\n";


    return 0;
}


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

int main()
{
ll int n,i,p,j;
string s;
char a[100] ,b[100] ;
cin>>n;
cin>>s;
p=0;
if(n%2==0)
{
    p=1;
}
if(p==1)
{
for(i=0;i<n/2;i++)
{
    a[i]=s[i];
}
j=0;
for(i=n/2;i<n;i++)
{
    b[j]=s[i];
    j++;
}
p=strcmp(a,b);
if(p==0)
{
    cout<<"Yes"<<endl;
}
else
{
    cout<<"No"<<endl;
}
}
else
{
    cout<<"No"<<endl;
}

return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
using namespace std;
#define sz(x) ((int)(x).size())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define MEMSET(v, h) memset((v), h, sizeof(v))
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; }
#define pb push_back
#define mp make_pair
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
const ll INF = 1LL<<58;
 
int main(){
    int N, A, B;
  	cin >> N >> A >> B;
      if(A % 2 != 0 && B % 2 == 0){
        cout << "Borys" << endl;
        return 0;
      }
      else if(A % 2 == 0 && B % 2 == 0){
        cout << "Alice" << endl;
        return 0;
      }
      else if(A % 2 != 0 && B % 2 != 0){
        cout << "Alice" << endl;
        return 0;
      }
      else if(A % 2 == 0 && B % 2 != 0){
        cout << "Borys" << endl;
        return 0;
      }
 
}

Measured memory_bytes: 256
# 初期入力
import numpy as np
import sys
input = sys.stdin.readline
N = int(input())
A = list(map(int, input().split()))
A_np =np.array(A,dtype=np.int64)
ans =np.prod(A_np) #累積積
if 0 in A:
    print(0)
elif 0 < ans <=10**18:
    print(ans)
else:
    print(-1)

Measured memory_bytes: 40372
#include <bits/stdc++.h>
using namespace std;
#define int           long long
#define pb            push_back
#define x             first
#define y             second
#define sz(v)         (int)v.size()
#define all(x)        (x).begin(),(x).end()
#define PI            3.14159265358979
#define N             200005

int solve(){
    int n,w1; cin>>n>>w1;
    int w[n],v[n];
    for (int i = 0; i < n; ++i)
    {
        cin>>w[i]>>v[i];
    }
    int dp[w1+1]={};
    for(int j=0; j<n; j++){
        for(int i=w1; i>=0; i--){
            if(w[j]<=i){
                dp[i]=max(dp[i],dp[i-w[j]]+v[j]);
            }
        }
    }
    cout<<dp[w1];
    return 0;
}

signed main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int t=1;
    // cin>>t;
    while(t--) solve();
    return 0;
}

Measured memory_bytes: 4472
# coding: utf-8
# Here your code !
import sys
f = sys.stdin

def North(d):
    d = [d[1]] + [7 -d[0]] + [d[2]]
    return d
      
def East(d):
    d = [7-d[2]] + [d[1]] + [d[0]]
    return d
      
def South(d):
    d = [7-d[1]] + [d[0]] + [d[2]]
    return d
  
def West(d):
    d = [d[2]] + [d[1]] + [7-d[0]]
    return d
  
def Right(d):
    d = [d[0]] + [d[2]] + [7-d[1]]
    return d
  
def Left(d):
    d = [d[0]] + [7-d[2]] + [d[1]]
    return d
  
  
  
while True:
    n = int(f.readline())
    if n == 0:
        break
      
    dice = [1,2,3]
    result = 1
      
    for _ in range(n):
        direction = f.readline().rstrip()
   
        dice = eval(direction+"(dice)")
     
          
        result += dice[0]
      
    print(result)

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


#define rp(i, k, n) for (int i = k; i < n; i++)
typedef long long ll;
typedef double ld;

ll mod = 1e9 + 7ll;
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; }
const ll inf = 1ll << 60;

int main(){
    int a, b, k;
    cin >> a >> b >> k;
    for(int n=101; n > 0; n--){
        if(a%n == 0 and b%n == 0) k--;
        if(k == 0){
            cout << n << endl;
            return 0;
        }
    }
}


Measured memory_bytes: 256
n,t = map(int,input().split())
A = [list(map(int,input().split())) for _ in range(n)]
ans = 1000000000
for i in range(n):
    if A[i][1] <= t:
        ans = min(ans,A[i][0])
if ans == 1000000000:
    print('TLE')
else:
    print(ans)



Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = int(a), i##_len = (b); i < i##_len; ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define _repr(i, n) repri(i, n, 0)
#define repri(i, a, b) for(int i = int(a), i##_len = (b); i >= i##_len; --i)
/* 閉区間で定義しているので注意！repr(i,n,m)でn〜mまで */
#define repr(...) _overload3(__VA_ARGS__, repri, _repr, )(__VA_ARGS__)
/* 逆回しのループ。両閉区間であることに注意 */
#define all(x) (x).begin(), (x).end()
#define debug(x) cerr << #x << ": " << (x) << '\n'
typedef long long lint;
#define int lint
const int INF = (int)1145141919;
int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
const lint LINF = (lint)1e18;
typedef vector<int> vint;
typedef pair<int, int> pint;
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;
}
template <class T, class U>
std::ostream &operator<<(std::ostream &os, const std::pair<T, U> p) {
    os << "(" << p.first << "," << p.second << ")";
    return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
    os << p.first << " " << p.second;
    return os;
}

template <typename T1, typename T2>
istream &operator>>(istream &is, pair<T1, T2> &p) {
    is >> p.first >> p.second;
    return is;
}

template <typename T> ostream &operator<<(ostream &os, const vector<T> &v) {
    os << "[";
    for(int i = 0; i < (int)v.size(); i++) {
        os << v[i] << (i + 1 != v.size() ? ", " : "");
    }
    os << "]";
    return os;
}

template <typename T> istream &operator>>(istream &is, vector<T> &v) {
    for(T &in : v)
        is >> in;
    return is;
}

template <typename T = lint> vector<T> make_v(size_t a) { return vector<T>(a); }

template <typename T, typename... Ts> auto make_v(size_t a, Ts... ts) {
    return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}

template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type fill_v(T &t, const V &v) {
    t = v;
}

template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type fill_v(T &t, const V &v) {
    for(auto &e : t)
        fill_v(e, v);
}

bool pairCompare(pair<int, int> &firstElof, pair<int, int> &secondElof) {
    return firstElof.first > secondElof.first;
}

bool pairCompare2(pair<int, int> &firstElof, pair<int, int> &secondElof) {
    return firstElof.second > secondElof.second;
}

signed main() {
#ifdef LOCAL
    // ifstream in("in_1.txt");
    // cin.rdbuf(in.rdbuf());
#else
    cin.tie(0);
    ios::sync_with_stdio(false);
#endif

    /* input part */
    int N;
    cin >> N;
    vint s(N);
    cin >> s;
    int ans = 0;
    for(auto x : s) {
        ans += x;
    }
    if(ans % 10 != 0) {
        cout << ans << endl;
        return 0;
    }
    sort(all(s));
    for(auto x : s) {
        if(x % 10 != 0) {
            cout << ans - x << endl;
            return 0;
        }
    }
    cout << 0 << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long a[] = new long[n];
		long sum = 0;
		for(long i = 1 ; i <= n ; i++) {
			sum += (((n / i) * i) + i) * (n / i) / 2;
		}

		System.out.println(sum);

	}
}



Measured memory_bytes: 115876
#include"bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
using namespace std;

int main() {
	string s;
	cin >> s;
	int num = 8;
	while (num--) {
		s.pop_back();
	}
	cout << s << endl;
	return 0;
}

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

int a, b;

int main(){
	cin >> a >> b;
	if(a % 3 == 0 || b % 3 == 0 || (a + b) % 3 == 0) cout << "Possible" << endl;
	else cout << "Impossible" << endl;
	return 0;
}


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

#ifdef LOCAL
#include "prabh.hpp"
#endif

#define int long long
#define pb push_back
#define range(v) v.begin(),v.end()
#define mod (int)(1e9 + 7)
#define inf (int)(1e15)
#define N (int)(2e5 + 10)

using namespace std;

void solve() {
	string s; cin >> s;
	if (s[0] == s[1] and s[1] == s[2] and s[0] == 'R')
		cout << 3 << endl;
	else if ((s[0] == s[1] or s[1] == s[2]) and s[1] == 'R')
		cout << 2 << endl;
	else if (s[0] == 'R' or s[1] == 'R' or s[2] == 'R')
		cout << 1 << endl;
	else cout << 0 << endl;
}

// you should probably see down .. believe me it would help
int32_t main() {
	ios_base::sync_with_stdio(false), cin.tie(nullptr), cin.tie(nullptr);
	int t_c = 1;
//	cin >> t_c;
	while (t_c--)
		solve();
}

/*
 * COME ON DUDE .... DONT GET UP UNTIL U GET THE SOLUTION
 * GIVING UP NOT GONNA HELP .. JUST GET YOUR ASS TO WORK ALREADY ..
 * AND FOR FUCKING SAKE ... DONT PANIC !!
*/


Measured memory_bytes: 3548
a=[0,0,0]
a[0],a[1],a[2]=map(int,input().split())
a.sort()

if a[0]==a[1] or a[1]==a[2]:
    if a[0]==a[1] and a[1]==a[2]:
        print("No")
    else:
        print("Yes")
else:
    print("No")



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

using namespace std;
 
/// ----------------------------- (Debug) ------------------------------
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; }; sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0); sim > char dud(...);
struct debug {
#ifndef ONLINE_JUDGE
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i));}
sim, class b dor(pair < b, c > d) {ris << "(" << d.first << ", " << d.second << ")";}
sim dor(rge<c> d) {*this << "["; for (auto it = d.b; it != d.e; ++it) *this << ", " + 2 * (it == d.b) << *it; ris << "]";}
#else
sim dor(const c&) { ris; }
#endif
};
vector<char*> tokenizer(const char* args) {
  char *token = new char[111]; strcpy(token, args); token = strtok(token, ", ");
  vector<char*> v({token});
  while(token = strtok(NULL,", ")) v.push_back(token);
  return reverse(v.begin(), v.end()), v;
}
void debugg(vector<char*> args) { cerr << "\b\b "; }
template <typename Head, typename... Tail>
void debugg(vector<char*> args, Head H, Tail... T) {
  debug() << " [" << args.back() << ": " << H << "] ";
  args.pop_back(); debugg(args, T...);
}
#define harg(...) #__VA_ARGS__
#ifndef ONLINE_JUDGE
#define dbg(...) { debugg(tokenizer(harg(__VA_ARGS__, \b\t-->Line)), __VA_ARGS__, __LINE__); cerr << endl;}
#else
#define dbg(...) { }
#endif
/// -----------------------------------------------------------------------

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi; 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)    
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define REP(i,a,b) for(i=a;i<=b;i++)
#define RAP(i,a,b) for(i=a;i>=b;i--)
#define spa <<" "<<
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)x.size()
ll mod=1e9+7;
const int MX=0x3f3f3f3f;

int main() {
    IOS;
    string s,t;
    cin>>s>>t;
    int i,j,cnt=MX,temp;
    REP(i,0,sz(s)-sz(t)){
        temp=0;
        REP(j,0,sz(t)-1){
            if(s[i+j]!=t[j])
                temp++; 
        }
        cnt=min(cnt,temp);
    }
    cout<<cnt;
    return 0;   
}

Measured memory_bytes: 3680
import itertools
n,m,x=map(int,input().split())
c=[]
a=[]
ans=float("inf")

for i in range(n):
    tmp=list(map(int,input().split()))
    c.append(tmp[0])
    a.append(tmp[1:])
for i in itertools.product([0,1],repeat=n):
    understand=[0]*m
    tmp=0
    for t,j in enumerate(i):
        if j==1:
            for u,k in enumerate(a[t]):
                understand[u]+=k
            tmp+=c[t]
    if ans>tmp and min(understand)>=x:
        ans=tmp
print(ans) if ans != float("inf") else print(-1)

Measured memory_bytes: 9160
#include<stdio.h>
int main(void)
{
	int bus[24][60] = {0};
	int j, i, n,m,l,f=0;
	scanf("%d",&n);
	for (j = 1; j <= n; j++)
	{
		scanf("%d %d", &m, &l);
		bus[m][l] = 1;
	}
	scanf("%d", &n);
	for (j = 1; j <= n; j++)
	{
		scanf("%d %d", &m, &l);
		bus[m][l] = 1;
	}
	for (j = 0; j < 24; j++)
	{
		for (i = 0; i < 60; i++)
		{
			if (bus[j][i]==1)
			{
				if (f==1)
				{
					printf(" %d:%02d", j, i);
				}
				else
				{
					printf("%d:%02d", j, i);
					f =1;
				}
			}
		}
	}
	puts("");
	return 0;
}

Measured memory_bytes: 628
#include <iostream>
#include <vector>
#include <algorithm>
#include <string.h>

using namespace std;

typedef pair<int, int> obj;

int main(){
  int N, W, weight, value;
  char ch;
  int case_num = 1;

  while(1){
    cin >> W;
    if(W == 0) break;
    cin >> N;

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

    vector<obj> obj_list;
    int dp[2][1010];
    memset(dp, -1, sizeof(dp));
    
    for(int i = 0; i < N; i++){
      cin >> value >> ch >> weight;
      obj_list.push_back(obj(value, weight));
      //printf("value = %d weight = %d\n", value, weight);
    }

    dp[0][0] = 0;
    dp[1][0] = 0;

    for(int i = 0; i < N; i++){
      obj o = obj_list[i];

      for(int j = 0; j <= W; j++){
        if(dp[(i+1)%2][j] != -1){
          dp[i%2][j] = max(dp[i%2][j], dp[(i+1)%2][j]);
          if(j + o.second <= W){
            dp[i%2][j+o.second] = max(dp[i%2][j+o.second], dp[(i+1)%2][j] + o.first);
          }
        }
      }
    }
    int answer = 0;
    int answer_weight = 0;

    for(int i = 0; i <= W; i++){
      if(answer < dp[(N+1)%2][i]){
        answer = dp[(N+1)%2][i];
        answer_weight = i;
      }
      if(answer < dp[N%2][i]){
        answer = dp[N%2][i];
        answer_weight = i;
      }
    }

    cout << "Case " << case_num << ":" << endl;
    cout << answer << endl;
    cout << answer_weight << endl;

    case_num++;
  }

  return 0;
}

Measured memory_bytes: 1220
#include<stdio.h> 

int main (void) 
{   
	int m,f,r;  
	while(1)
	{     
		scanf("%d%d%d",&m,&f,&r);    
		if((m==-1)&&(f==-1)&&(r==-1))
			break;    
		if((m==-1||f==-1)||((m+f)<30))
		{       
			printf("F\n");    
		}
		else if(80<=(m+f))
		{      
			printf("A\n");          
		}
		else if(65<=(m+f))
		{       
			if((m+f)<80)
			{     
				printf("B\n");       
			}    
		}
		else if(50<=(m+f))
		{       
			if((m+f)<65)
			{    
				printf("C\n");       
			}     
		}
		else if(30<=(m+f))
		{      
			if(50<=r)
			{    
				printf("C\n");      
			}
			else if((m+f)<50)
			{    
				printf("D\n");       
			}    
		}   
	}     
	return 0;
}

Measured memory_bytes: 584
import numpy as np
from itertools import chain,combinations
def powerset(iterable):
    s = list(iterable)
    return chain.from_iterable(combinations(s, r) for r in range(len(s)+1))

def main():
    N, M, X = map(int, input().split())
    C = []
    A = []
    for _ in range(N):
        CA = list(map(int, input().split()))
        C.append(CA[0])
        A.append(CA[1:])
    score = [0] * M
    A = np.array(A)
    if np.sum(np.sum(A, axis=0) < X) > 0:
        print('-1')
    else:
        PS = list(powerset([i for i in range(N)]))
        min_money = 10**9
        for Set_list in PS:
            X_sum = np.zeros(M, dtype=int)
            money = 0
            for i in Set_list:
                X_sum += A[i]
                money += C[i]
            if np.sum(X_sum < X) == 0 and money < min_money:
                min_money = money
        print(min_money)
        

if __name__ == '__main__':
    main()

Measured memory_bytes: 27508
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

#define rep(i, N) for(int i = 0; i < N; ++i)

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL


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

    int N;
    cin >> N;
    vs32 h(N);
    rep (i, N) cin >> h[i];

    int lmin;
    int l, r;
    int ans = 0;
    while (1)
    {
        l = 0;
        while (l < N && h[l] == 0) ++l;
        r = l;
        while (r < N && h[r] != 0) ++r;

        if (l >= r) break;

        lmin = h[l];
        for (int i = l; i < r; ++i)
        {
            lmin = MIN(lmin, h[i]);
        }
        for (int i = l; i < r; ++i)
        {
            h[i] -= lmin;
        }
        ans += lmin;
    }

    cout << ans << "\n";

    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
using namespace std;
int main() {
  
  int N,D;
  cin>>N>>D;
  
  vector<vector<int>> vec(N,vector<int>(D));
  for(int i=0;i<N;i++){
    for(int j=0;j<D;j++){
      cin>>vec[i][j];
    }
  }
  
  int ans=0;
  
  
  for(int i=0;i<N;i++){
    for(int j=i+1;j<N;j++){
      int x=0;
      for(int k=0;k<D;k++){
        x+=(vec[i][k]-vec[j][k])*(vec[i][k]-vec[j][k]);
      }
      for(int l=0;l<=x;l++){
        if(x==l*l){
          ans++;
          break;
        }
      }
    }
  }
  
  cout<<ans<<endl;
}

Measured memory_bytes: 3656
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s1,s2;
	int s=0;
	cin>>s1;
	cin>>s2;
	for(int i=0;i<3;i++)
	{
		if(s1[i]==s2[i]) s++;
	}
	cout<<s;
    return 0;
}

Measured memory_bytes: 256
N = int(input())
H = list(map(int, input().split()))
ans = 0
for i in range(100):
  cnt = 0
  if H[0] != 0:
    cnt += 1
  for i in range(N-1):
    if (H[i] == 0) and (H[i+1] != 0):
      cnt += 1
  ans += cnt
  for j in range(N):
    if H[j] != 0:
      H[j] -= 1
print(ans)

Measured memory_bytes: 3064
use std::io::stdin;

fn main() {
    let mut s = String::new();
    stdin().read_line(&mut s).unwrap();
    let mut t = String::new();
    stdin().read_line(&mut t).unwrap();

    let n = s.len();
    let s1 = &s[0..n - 1];
    let s2 = &t[0..n - 1];

    if s1 == s2 {
        println!("Yes")
    } else {
        println!("No")
    }
}


Measured memory_bytes: 2084
#include<algorithm>
#include<climits>
#include<cmath>
#include<cstring>
#include<deque>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;

using lint = long long;
using P = pair<int, int>;
using LLP = pair<long long, long long>;

#define REP(i, x, n) for(int i = (x), i##_len = int(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = int(n) ; i < i##_len ; ++i)
#define reps(i, n) for(int i = 1, i##_len = int(n) ; i <= i##_len ; ++i)
#define rrep(i, n) for(int i = int(n) - 1 ; i >= 0 ; --i)
#define rreps(i, n) for(int i = int(n) ; i > 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())
#define TWINS(x) cout << ((x) ? "Yay!" : ":(") << endl

const int IINF = (1 << 30) - 1;
const long long LLINF = 1LL << 61;
const int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};
const double EPS = 1e-8;

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

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

void eratosthenes(int n, vector<bool> &isPrime){
    isPrime.clear();
    isPrime.resize(max(n + 1, 2), true);
    isPrime[0] = false;
    isPrime[1] = false;

    for(int i = 4 ; i <= n ; i += 2){
        isPrime[i] = false;
    }
    for(int i = 9 ; i <= n ; i += 6){
        isPrime[i] = false;
    }
    int s = 4;
    for(int i = 5 ; i * i <= n ; i += s){
        if(isPrime[i]){
            for(int j = i * i ; j <= n ; j += i){
                isPrime[j] = false;
            }
        }
        s ^= 6;
    }
    return;
}

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

    vector<bool> isPrime;
    eratosthenes(1 << 15, isPrime);

    int n;
    while(cin >> n, n){
        int ans = 0;
        REP(i, 2, n / 2 + 1){
            if(isPrime[i] && isPrime[n - i]){
                ++ans;
            }
        }

        cout << ans << endl;
    }

    return 0;
}


Measured memory_bytes: 3152
s = list(input())

li = []
result = []
pre = 0
n=0

for i in s:
	n=n+1
	if pre == 0 and (i == "A" or i == "C" or i == "G" or i == "T"):
		li.append(i)
		pre=1
		if n == len(s):
			if len(li)>len(result):
				result = li
	elif pre == 1 and (i == "A" or i == "C" or i == "G" or i == "T"):
		li.append(i)
		if n == len(s):
			if len(li)>len(result):
				result = li
	elif pre==1:
		if len(li)>len(result):
			result = li
		li=[]
		pre=0

print(len(result))

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

    cin>>n;
    rep(i,n)    cin>>l[i];

    sort(l,l+n);
    int ans=0;

    for(int i=0;i<n;i++) {
        for(int j=i+1;j<n;j++) {
            for(int k=j+1;k<n;k++) {
                if(l[k]>l[i]+l[j])  break;
                if(abs(l[i]-l[j])<l[k]&&l[k]<l[i]+l[j]) ans++;
            }
        }
    }

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

Measured memory_bytes: 256
alp = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
n = int(input())
s = input()
ans = []
for i in range(len(s)):
    for j in range(len(alp)):
        if s[i] == alp[j]:
            if j + n <= 25:
                ans.append(alp[j+n])
            else:
                ans.append(alp[j+n-26])
ans = "".join(ans)
print(ans)

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

using namespace std;

#define pb push_back
#define all(x) x.begin(),x.end()
#define sz(x) ((int)x.size())
#define fast_cin ios_base::sync_with_stdio(false)

const int MOD = 1e9+7;

typedef long long ll;

bool comp(ll a, ll b){

	return a > b;
}
int main(int argc, char const *argv[])
{
	char x,y; cin >> x >> y;
	if (x > y)
	{
		cout << ">" << endl;
	}
	else if (x < y)
	{
		cout << "<" << endl;
	}
	else
		cout << "=" << endl;
	return 0;
}

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

struct Team{
	string name;
	int win;
	int lose;
	int draw;
	int point;
};

void sort( Team* teams, int n )
{
	for( int i = 0; i < n; ++i ){
		for( int j = 0; j < n - 1; ++j ){
			if( teams[ j ].point < teams[ j + 1 ].point ){
				Team t = teams[ j ];
				teams[ j ] = teams[ j + 1 ];
				teams[ j + 1 ] = t;
			}
		}
	}
}

int main()
{
	int teamQuantity;
	bool first = true;

	while( cin >> teamQuantity ){
		if( teamQuantity == 0 ){
			break;
		}
		Team* teams = new Team[ teamQuantity ];
		for( int i = 0; i < teamQuantity; ++i ){
			cin >> teams[ i ].name >> teams[ i ].win >> teams[ i ].lose >> teams[ i ].draw;
			teams[ i ].point = teams[ i ].win * 3 + teams[ i ].draw;
		}
		sort( teams, teamQuantity );

		if( first ){
			first = false;
		}else{
			cout << endl;
		}

		for( int i = 0; i < teamQuantity; ++i ){
			cout << teams[ i ].name << "," << teams[ i ].point << endl;
		}
		delete[] teams;
	}
	return 0;
}

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

int main() {
  string s;
  cin>>s;
  int n = s.length();
  long long dp_a[n+1][4];
  long long mod = 1e9 + 7;

  for (int i=0; i<4; i++) {
    dp_a[0][i] = 0;
  }
  for (int i=0; i<n; i++) {
    dp_a[i+1][0] = dp_a[i][0];
    dp_a[i+1][1] = dp_a[i][1];
    dp_a[i+1][2] = dp_a[i][2];
    dp_a[i+1][3] = dp_a[i][3];
    if (s[i] == 'A') {
      dp_a[i+1][0] = dp_a[i][0] + 1;
    } else if (s[i] == '?') {
      dp_a[i+1][1] = dp_a[i][1] + 1;
    }
  }
  long long dp_ab[n+1][4];
  for (int i=0; i<4; i++) {
    dp_ab[0][i] = dp_ab[1][i] = 0;
  }
  for (int i=0; i<n-1; i++) {
    dp_ab[i+2][0] = dp_ab[i+1][0];
    dp_ab[i+2][1] = dp_ab[i+1][1];
    dp_ab[i+2][2] = dp_ab[i+1][2];
    dp_ab[i+2][3] = dp_ab[i+1][3];

    if (s[i+1] == 'B') {
      dp_ab[i+2][0] += dp_a[i+1][0];
      dp_ab[i+2][1] += dp_a[i+1][1];
    } else if (s[i+1] == '?') {
      dp_ab[i+2][1] += dp_a[i+1][0];
      dp_ab[i+2][2] += dp_a[i+1][1];
    }
  }

  long long dp_abc[n+1][4];
  for (int i=0; i<4; i++) {
    dp_abc[0][i] = dp_abc[1][i] = dp_abc[2][i] = 0;
  }
  for (int i=0; i<n-2; i++) {
    dp_abc[i+3][0] = dp_abc[i+2][0];
    dp_abc[i+3][1] = dp_abc[i+2][1];
    dp_abc[i+3][2] = dp_abc[i+2][2];
    dp_abc[i+3][3] = dp_abc[i+2][3];
    if (s[i+2] == 'C') {
      dp_abc[i+3][0] += dp_ab[i+2][0];
      dp_abc[i+3][1] += dp_ab[i+2][1];
      dp_abc[i+3][2] += dp_ab[i+2][2];
    } else if (s[i+2] == '?') {
      dp_abc[i+3][1] += dp_ab[i+2][0];
      dp_abc[i+3][2] += dp_ab[i+2][1];
      dp_abc[i+3][3] += dp_ab[i+2][2];
    }
    dp_abc[i+3][0] %= mod;
    dp_abc[i+3][1] %= mod;
    dp_abc[i+3][2] %= mod;
    dp_abc[i+3][3] %= mod;
  }
  int n_qmark = 0;
  for (int i=0; i<n; i++) {
    if (s[i] == '?') {
      ++n_qmark;
    }
  }
  long long ans = 0;
  for (int i=0; i<4; i++) {
    if (n_qmark < i) {
      break;
    }
    long long x = 1;
    for (int j=0; j<n_qmark-i; j++) {
      x *= 3;
      x %= mod;
    }
    ans += x * dp_abc[n][i];
    ans %= mod;
  }
  cout<<ans<<endl;
}

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

#define printl(s) cout << s << endl;
#define print(s) cout << s << endl; return 0;
#define printFix(n,i) cout << fixed << setprecision(i) << n << endl; return 0;
#define yes cout << "Yes" << endl; return 0;
#define no cout << "No" << endl; return 0;
#define pass cout << "PASS" << endl;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rep2(i,n) for (int i = 1; i < (n)+1; ++i)
#define bitrep(i,n) for (int i = 0; i < (1<<(n));i++)
#define isOne(bit,i) (bit & (1 << i))
using ll = long long;
using pii = pair<int, int>;
using si = set<int>;

const ll modSeed = pow(10,9) + 7;
const int INF = 100'000'000;

template <typename T>
vector<T> getValues(ll num){
    vector<T> values(num);
    for(ll i=0;i<num;i++){
        cin >> values.at(i);
    }
    return values;
}

string S;
int N,ans;

int main(){
  cin >> N;
  priority_queue<int,vector<int>,less<int>> que;
  int alice=0;
  int bob = 0;

  for(int i=0;i<N;i++){
    int a;
    cin >> a;
    que.push(a);
  }
  for(int i=0;i<N;i++){
    if(i%2==0){
      alice+=que.top();
    }else{
      bob+=que.top();
    }
    que.pop();
  }
  ans = alice - bob;
  printl(ans);
}


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

//a <= x <= b
//c <= y <= d

signed main() {
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	
	int x = max (a, b);
	int y = max (c, d);
	int product = x * y;
	
	x = min (a, b);
	y = min (c, d);
	product = max (product, x * y);
	
	x = max (a, b);
	y = min (c, d);
	product = max (product, x * y);
	
	x = min (a, b);
	y = max (c, d);
	product = max (product, x * y);
	
	cout << product << "\n";
	
	return 0;
}



Measured memory_bytes: 3632
use std::io::prelude::*;
use std::io::stdin;
use std::str::FromStr;

fn main() {
    let x: i64 = read();
    let y: i64 = read();

    let mut v = vec![];

    if x < y {
        v.push(y - x);
    }
    if -x >= y {
        v.push(1 - x - y);
    }
    if -x <= y {
        v.push(1 + x + y);
    }
    if x > y {
        v.push(2 + x - y);
    }

    println!("{}", v.iter().min().unwrap());
}

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|b| b.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}


Measured memory_bytes: 4352
#include <stdio.h>
 
int n,k;
int ans=1000000;
void dfs(int val,int cost){
    if(val==n){
        if(cost<ans)ans=cost;
        return;
    }
    dfs(val+1,cost*2);
    dfs(val+1,cost+k);
}
int main()
{
    scanf("%d",&n);
    scanf("%d",&k);
    dfs(0,1);
    printf("%d\n",ans);
}

Measured memory_bytes: 128
# coding:utf-8

import sys
import math
import time
import numpy as np
import collections


KX = str(raw_input()).split()
K = int(KX[0])
X = int(KX[1])

if(X <= 500*K):
  print("Yes")
else:
  print("No")
# print(str(poi1)+ " " + str(poi2));


Measured memory_bytes: 16272
#include <iostream>
#include <cstdio> 
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <complex>
using namespace std;

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

#ifndef typeof
#define typeof __typeof__
#endif // typeof
 
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define tr(c, i) for(typeof((c).begin()) i = (c).begin(); i != (c).end(); i++)
#define rtr(c, i) for(typeof((c).rbegin()) i = (c).rbegin(); i != (c).rend(); i++)
#define repby(i, a, b, step) for(typeof(b) i = (a); i < (b); i += (step))
#define repab(i, a, b) repby(i, (a), (b), 1)
#define rep(i, n) repab(i, 0, (n))
#define pb push_back
#define sz(c) int((c).size())

int digit_num(int x)
{
  int res = 0;

  do {
    res++;
    x /= 10;
  } while (x);

  return res;
}


int main(int argc, char **argv)
{
  int a, b;

  while (cin >> a >> b) {
    cout << digit_num(a+b) << endl;
  }

  return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#define vll vector<ll>
#define vvv vector<vvl>
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> >
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvvl(a, b, c, d) vector<vvl>(a, vvl(b, vll (c, d)));
#define rep(c, a, b) for(ll c=a;c<b;c++)
#define re(c, b) for(ll c=0;c<b;c++)
#define all(obj) (obj).begin(), (obj).end()
typedef long long int ll;
typedef long double ld;
using namespace std;

struct Bellman{
  ll INF=1000000000000000000;
  struct edge{ll from, to, cost;};
  vector<edge> es;
  vll d, pre;
  ll num = 0, E, V;
  Bellman(ll n){
    V = n+1;
    d.resize(V, INF);
    pre.resize(V, -1);
  }
  void insert(ll a, ll b, ll c){
    es.push_back(edge{a, b, c});
  }
  bool bellman(ll s){
    for(int i=0;i<V;i++) d[i] = INF;
    d[s] = 0, E = es.size(), num = 0;
    while(true){
      bool update = false;
      for(int i=0;i<es.size();i++){
        edge e = es[i];
        num++;
        if(d[e.from]!=INF&&d[e.to]!=-INF&&d[e.to]>d[e.from]+e.cost){
          if(num>V*E+10) d[e.to] = -INF;
          else d[e.to] = d[e.from]+e.cost;
          pre[e.to] = e.from;
          update = true;
        }
      }
      if(!update) break;
    }
    return true;
  }
};
int main(int argc, char const *argv[]) {
  ll a, b, c, n, m, p;std::cin >> n >> m >> p;
  Bellman be(n);
  re(i, m){
    std::cin >> a >> b >> c;
    c -= p;
    be.insert(a, b, -c);
  }
  be.bellman(1);
  if(be.d[n]==-be.INF){
    std::cout << -1 << '\n';
    return 0;
  }
  std::cout << max(-be.d[n], (ll)0) << '\n';
  return 0;
}


Measured memory_bytes: 704
#pragma GCC optimize("Ofast")

#include <bits/stdc++.h>
using namespace std;
using Int = long long;
typedef pair<int,int> P; typedef pair<Int,Int> Pl;
int const MOD = 1000000007;
#define END {cout<<END<<'\n'; return 0;}
#define ALL(vec) vec.begin(),vec.end()
#define Pr(type) priority_queue<type>
#define gPr(type) priority_queue<type,vector<type>,greater<type>>
#define V(type) vector<type>
#define rep(i,n) for(int i=0; i<n; i++)
#define rer(i,s,n) for(int i=s; i<n; i++)
#define gnr(i,l,r) for(int i=r; i>=l; i--)
#define eb emplace_back
#define pri1(a) cout<<a<<'\n'
#define pri2(a,n) rep(i,n-1)cout<<a[i]<<' '; cout<<a[n-1]<<'\n';
template<class T> inline bool cmin(T& a, T b) { if (a > b) { return a = b; } return false; }
template<class T> inline bool cmax(T& a, T b) { if (a < b) { return a = b; } return false; }

int n,m,q,_,x,y;
string s,t;
const char* sb;
bool ok;
char ch;

int main(){
  cin.tie(nullptr); ios::sync_with_stdio(false);
  
  stack<int>st;
  while(cin>>s){
    if(s=="+"||s=="-"||s=="*"){
      y=st.top(); st.pop();
      x=st.top(); st.pop();
      if(s=="+")st.push(x+y);
      else if(s=="-")st.push(x-y);
      else st.push(x*y);
    }
    else st.push(stoi(s));
  }
  pri1(st.top());
}


Measured memory_bytes: 3188
#include<bits/stdc++.h>
#define mod 1000000007
#define N 3009
#define ad(x,y) (x=(x+(y))%mod)
using namespace std;

int n,m,dp[N][N];
int calc(int n,int m){
	int i,j; memset(dp,0,sizeof(dp));
	for (i=0; i<=n; i++) dp[0][i]=1;
	for (i=1; i<=m; i++)
		for (j=0; j<n; j++){
			dp[i][j]=(dp[i-1][j]<<1)%mod;
			if (j) ad(dp[i][j],dp[i-1][j-1]);
			if (j+1<n) ad(dp[i][j],dp[i-1][j+1]);
		}
	int ans=0;
	for (i=0; i<n; i++) ad(ans,dp[m][i]);
	return ans;
}
int main(){
	scanf("%d%d",&n,&m); m--;
	printf("%lld\n",4ll*(calc(n,m)-calc(n-1,m)+mod)%mod);
	return 0;
}


Measured memory_bytes: 35712
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (int)(k); i < (int)(n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
typedef long long ll;
typedef long double ld;
typedef vector<ll> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
const int MOD = 1e9 + 7;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<class T>
istream& operator >> (istream& is, vector<T>& v)
{
	for (auto &i : v) is >> i;
	return is;
}
template<class T>
ostream& operator<<(ostream& os, vector<T>& v)
{
	const string delimiter = "\n";
	REP(i, v.size())
	{
		os << v[i];
		if (i != v.size() - 1) os << delimiter;
	}
	return os;
}
/*--------------------template--------------------*/

vector<vi> tree;
vi a;

ll dfs(int v)
{
	if (tree[v].size() == 0) return a[v];
	ll cnt = 0;
	ll mx = 0;
	for (auto u : tree[v])
	{
		ll tmp = dfs(u);
		if (tmp == -1) return -1;
		cnt += tmp;
		chmax(mx, tmp);
	}
	if (a[v] > cnt || a[v] * 2 < cnt || mx > a[v]) return -1;
	ll res = a[v] - (cnt - a[v]);
	return res;
}

int main()
{
	cin.sync_with_stdio(false); cout << fixed << setprecision(10); 
	int n; cin >> n;
	a.resize(n); cin >> a;
	if (n == 2)
	{
		if (a[0] == a[1]) cout << "YES" << endl;
		else cout << "NO" << endl;
		return 0;
	}
	vector<vi> g(n);
	REP(i, n - 1)
	{
		int a, b; cin >> a >> b;
		a--; b--;
		g[a].push_back(b);
		g[b].push_back(a);
	}
	int root = -1;
	/*
	REP(i, n)
	{
		if (g[i].size() > 1) root = i;
	}*/
	random_device rnd;
	mt19937 mt(rnd());
	uniform_int_distribution<> r(0, n - 1);
	while (1)
	{
		int v = r(mt);
		if (g[v].size() > 1)
		{
			root = v;
			break;
		}
	}
	if (root == -1) return 0;
	tree.resize(n);
	queue<int> que; que.push(root);
	vector<bool> vis(n); vis[root] = true;
	while (!que.empty())
	{
		int v = que.front();
		que.pop();
		for (auto u : g[v])
		{
			if (vis[u]) continue;
			vis[u] = true;
			tree[v].push_back(u);
			que.push(u);
		}
	}
	cout << (dfs(root) == 0 ? "YES" : "NO") << endl;
	return 0;
}

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

int main(void)
{
    int N;

    cin >> N;

    for(int i = 1; i <= N; ++i)
    {
        int ans = 0;
        for(int x = 1; x*x <= N; ++x)
        {
            for(int y = 1; x*x+y*y <= N && y <= x; ++y)
            {
                for(int z = 1; x*x+y*y+z*z <= N && z <= y; ++z)
                {
                    if(x*x+y*y+z*z+x*y+y*z+z*x==i)
                    {
                        if(x==y && x==z) ++ans;
                        else if(x==y || y==z || z==x) ans += 3;
                        else ans += 6;
                    }
                }       
            }
        }
        cout << ans << endl;
    }

    

    return 0;
}



Measured memory_bytes: 3520
#include<stdio.h>
int main(void){
        int c[100],t[100];
        int n,m,i,x=10001;
        scanf("%d %d",&n,&m);
        for(i=0;i<n;i++) scanf("%d %d",&c[i],&t[i]);
        for(i=0;i<n;i++) if((t[i]<=m)&&(c[i]<x)) x=c[i];
        if(x==10001) printf("TLE\n");
        else printf("%d\n",x);
        return 0;
}


Measured memory_bytes: 128
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	B
# CreatedDate:  2020-06-14 21:02:42 +0900
# LastModified: 2020-06-14 21:11:18 +0900
#


import os
import sys
#import numpy as np
#import pandas as pd
from numpy.linalg import solve

def main():
    x,y=map(int,input().split())
    left=[[1,1],[2,4]]
    right=[x,y]
    a=solve(left,right)
    if a[0].is_integer() and a[1].is_integer() and a[0]>=0 and a[1]>=0:
        print("Yes")
    else:
        print("No")



if __name__ == "__main__":
    main()


Measured memory_bytes: 27408