akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Linq;

class prog{
  static void Main(){
    
    int N = int.Parse(Console.ReadLine());
    int[] A = Console.ReadLine().Split().Select(int.Parse).ToArray();
    
    int count = 0;
    while(A.All(x => x % 2 == 0)){
      count++;
      for(int i = 0; i < N; i++){
        A[i] /= 2;
      }
    }
    Console.WriteLine(count);
  }
}


Measured memory_bytes: 13396
#include <stdio.h>

int     main(void)
{
    int a;
    int b;
    int c;
    int x;
    
    a = 0;
    b = 0;
    c = 0;
    x = 0;
    scanf("%d %d %d",&a,&b,&c);
    if (a > b)
    {
        x = a;
        a = b;
        b = x;
    }
    if (b > c)
    {
        x = b;
        b = c;
        c = x;
    }
    if (a > b)
    {
        x = a;
        a = b;
        b = x;
    }
    printf("%d %d %d\n",a,b,c);
    return (0);
}


Measured memory_bytes: 2060
def main():
    from sys import setrecursionlimit, stdin, stderr
    from os import environ
    from collections import defaultdict, deque, Counter
    from math import ceil, floor
    from itertools import accumulate, combinations, combinations_with_replacement
    setrecursionlimit(10**6)
    dbg = (lambda *something: stderr.write("\033[92m{}\033[0m".format(str(something)+'\n'))) if 'TERM_PROGRAM' in environ else lambda *x: 0
    input = lambda: stdin.readline().rstrip()
    LMIIS = lambda: list(map(int,input().split()))
    II = lambda: int(input())
    P = 10**9+7
    INF = 10**18+10
    N = II()
    L = LMIIS()
    ans = 0
    for i in range(N):
        for j in range(i+1,N):
            for k in range(j+1,N):
                if L[i] != L[j] and L[j] != L[k] and L[k] != L[i] and L[i] + L[j] > L[k] and L[j] + L[k] > L[i] and L[k] + L[i] > L[j]:
                    ans += 1
    print(ans)


    
main()

Measured memory_bytes: 74152
#include<bits/stdc++.h>
using namespace std;
string s,t;
int main()
{
	cin>>s>>t;
	bool ok=false;
	for(int i=s.size()-1;i>=t.size()-1;i--)
	{
		int ii=i-t.size()+1;
		ok=true;
		for(int j=ii;j<=i;j++)
		{
			if(t[j-ii]!=s[j]&&s[j]!='?')
			{
				ok=false;
				break;
			}
		}
		if(ok)
		{
			for(int j=ii;j<=i;j++)s[j]=t[j-ii];
			break;
		}
	}
	if(!ok)
	{
		cout<<"UNRESTORABLE\n";
		return 0;
	}
	for(int i=0;i<s.size();i++)
		if(s[i]=='?')
			s[i]='a';
	cout<<s<<endl;
	return 0;
}
/*
?tc????
coder
*/

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
 int a,b,c;
  cin >> a >> b;
  if(a!=1&&b!=1){
  c=1;
  }
  else if(a!=2&&b!=2){
  c=2;
  }
  else if(a!=3&&b!=3){
  c=3;
  }
  cout << c;
}

Measured memory_bytes: 256
N=int(input())
S=[1,2,3,4,5,6,7,8,9,10,11,12,13]
H=[1,2,3,4,5,6,7,8,9,10,11,12,13]
C=[1,2,3,4,5,6,7,8,9,10,11,12,13]
D=[1,2,3,4,5,6,7,8,9,10,11,12,13]
for i in range(N):
    L=list(map(str,input().split()))
    
    if L[0]=="S":
        S.remove(int(L[1]))
    elif L[0]=="H":
        H.remove(int(L[1]))
    elif L[0]=="C":
        C.remove(int(L[1]))
    else:
        D.remove(int(L[1]))
for i in S:
    print("S",i)
for j in H:
    print("H",j)
for k in C:
    print("C",k)
for z in D:
    print("D",z)



Measured memory_bytes: 5620
n=int(input())
from collections import Counter as co
l=co(list(map(int,input().split())))
ans=len(l)
ng=set()
for k in l:
    if l[k]>=2:ng.add(k)
    for i in range(2*k,10**6+1,k):

        if i in l:
            ng.add(i)
            
            

print(ans-len(ng))

Measured memory_bytes: 129164
#pragma optimization_level 3
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
#include<bits/stdc++.h>

using namespace std;
 
#define  GODSPEED       ios:: sync_with_stdio(0);cin.tie(0);cout.tie(0);cout<<fixed;cout<<setprecision(15);
#define  f              first                 
#define  s              second
#define  newl           cout<<"\n";
#define  pb             push_back  
#define  mset(a,x)      memset(a,x,sizeof(a))
#define  debv(a)        for(auto it: a)cout<<it<<" ";newl;
#define  deb1(a)        cout<<a<<"\n";
#define  deb2(a,b)      cout<<a<<" "<<b<<"\n";
#define  deb3(a,b,c)    cout<<a<<" "<<b<<" "<<c<<"\n";
#define  deb4(a,b,c,d)  cout<<a<<" "<<b<<" "<<c<<" "<<d<<"\n";
#define  uniq(a)        a.resize(unique(a.begin(), a.end()) - a.begin());
#define  all(a)         a.begin(),a.end()           
 
typedef  long long             ll;
typedef  long double           ld;
typedef  pair<ll,ll>           pll;
typedef  vector<ll>            vll;
typedef  vector<pll>           vpll;

const ll   N     =  3e5+5;
const ll   mod   =  1e9+7;
const ll   INF   =  0x7f7f7f7f7f7f7f7f;
const int  INFi  =  0x7f7f7f7f;
const ll   LEVEL =  log2(N)+1;

ll test = 1, x, k, d;

void solve(){
	cin >> x >> k >> d; x = abs(x);
	ll mv = x/d;
	if(mv > k) deb1(x-k*d)
	else{
		x -= mv*d;
		if(mv%2 == k%2) deb1(x)
		else{
			x -= d;
			deb1(abs(x))
		}
	}
}

int main(){
	GODSPEED;
	//cin>>test;
	for(int i = 1; i <= test; i++){
		solve();
	}
	#ifndef ONLINE_JUDGE
	cout<<"\nTime Elapsed: " << 1.0*clock() / CLOCKS_PER_SEC << " sec\n";
	#endif
}

Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;

int main(){
	int A ,B;
	cin >> A >>B;
	if (A >0 && A <= 9 && B > 0 && B <= 9){
		cout << A * B <<endl;
	}
	else{
		cout << -1 <<endl;
	}
	return 0;
}

Measured memory_bytes: 256
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <queue>
# include <stack>
# define MOD 1000000000+7
# define INF 1000000000
#define rep(i,rept)	for(ll i = 0; i<rept;i++)
typedef long long ll;
using namespace std;
ll counter;
ll keta(ll i) {
	counter = 0;
	while (i > 10) {
		i /= 10;
		counter++;
	}
	return counter;
	
}
int main() {
	ll a = 0, b = 0, n = 0, counter=0,maxi=0;
	ll nums[100002];
	std::string str,str2;
	cin >> a;
	rep(i, a) {
		cin >> nums[i];
	}
	for (int i = 1; i < a; i++) {
		if (nums[i - 1] >= nums[i])counter++;
		else {
			maxi = max(maxi, counter);
			counter = 0;
		}
		if (i == a - 1)maxi = max(maxi, counter);
	}
	 cout << maxi << endl;
}


Measured memory_bytes: 1024
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <string>
#include <stack> // s.top()
#include <bitset>
#include <queue> // s.front()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define print(x) cout<<(x)<<endl
#define INF10 1001001001 
#define INF5 100000
#define EPS 1e-10



int main() {
	int N; cin >> N;
	vector<int> H(N);
	for (int i = 0; i < N; i++) {
		cin >> H[i];
		if (i == 0)H[0]--;
		else {
			if (H[i - 1] < H[i]) {
				H[i]--;
				continue;
			}
			else if (H[i - 1] == H[i]) {
				continue;
			}
			else {
				cout << "No" << endl;
				return 0;
			}
		}
	}
	cout << "Yes" << endl;



	return 0;
}


Measured memory_bytes: 768
#include<stdio.h>
#define p 1000000007
#define c(a,b) (1ll*fac[a]*inv[a-b]%p*inv[b]%p)
typedef int nlist[1000010];
nlist fac,p2,p3,inv;
int main(void){
	int n,m,k;
	scanf("%d%d%d",&n,&m,&k);
	p3[0]=p2[0]=1;
	int sum=n+m+k;
	for (int i=1;i<=sum;i++) p3[i]=3ll*p3[i-1]%p,p2[i]=2ll*p2[i-1]%p;
	inv[1]=1;
	for (int i=2;i<=sum;i++){
		inv[i]=1ll*(p-p/i)*inv[p%i]%p;
	}
	inv[0]=1;
	for (int i=1;i<=sum;i++){
		inv[i]=1ll*inv[i-1]*inv[i]%p;
	}
	fac[0]=1;
	for (int i=1;i<=sum;i++){
		fac[i]=1ll*i*fac[i-1]%p;
	}
	int  ans=0;
	if (m>k) {int t=m;m=k;k=t;} 
	for (int i=0;i<=m;i++){
		ans=(ans+1ll*fac[n-1+i]*inv[n-1]%p*inv[i]%p*p3[m+k-i]%p*p2[i]%p)%p;
	}
	int s1=1,x1=1;
	for (int i=m+1;i<=k;i++){
		int temp=(p2[i]-s1+p)%p;
		ans=(ans+1ll*fac[n-1+i]*inv[n-1]%p*inv[i]%p*p3[m+k-i]%p*temp%p)%p;
		s1=(2ll*s1%p+c(i,x1))%p;
		x1++;
	}
	int s2=1,x2=1;
	for (int i=k+1;i<=m+k;i++){
		int temp=(1ll*p2[i]-s1+p-s2+p)%p;
		ans=(ans+1ll*fac[n-1+i]*inv[n-1]%p*inv[i]%p*p3[m+k-i]%p*temp%p)%p;
		s1=(2ll*s1%p+c(i,x1))%p;
		s2=(2ll*s2%p+c(i,x2))%p;
		x1++,x2++;
	}
	printf("%d",ans);
}

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


int main(){
while(1){
int n,m;
cin>>n>>m;
if(n==0) break;
vector<int> mas(n+1,0),s(m+1);
int now = 1;
for(int i=1;i<=n;i++)cin>>mas[i];
int cnt = 0;
for(int i=0;i<m;i++) cin>>s[i];
for(int i=0;i<m;i++){
int t = s[i];
now += t;
//cout<<now<<' ';
cnt++;
if(now >= n) break;
now += mas[now];
//cout<<now<<endl;
if(now >= n) break;

}
	cout<<cnt<<endl;
}
	return 0;
}



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

#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define pb push_back
#define ss second
#define ff first
#define sz(s) (int)s.size()
#define all(a) a.begin(),a.end()

#ifndef ONLINE_JUDGE
#define trace(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

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

#else
#define trace(args...) { }
#endif

typedef long double ld;
typedef long long ll;
typedef pair<int,int> pii;

int main()
{
  IOS;
  string s;
  cin >> s;
  int n = sz(s);
  stack<char> st;
  for(char c : s){
    char rev = (c == '0' ? '1' : '0');
    if(!st.empty() && st.top() == rev)
      st.pop();
    else
      st.push(c);
  }
  cout << n - sz(st) << '\n';
  return 0;
}

Measured memory_bytes: 512
def valid?(a, b, c)
  a <= b + c && b <= c + a + 1 && c <= a + b + 1
end
 
def calc(rear, front, west, east, north, south, buffer)
  same = true
  buffer.size.times do |i|
    a = rear + front
    b = west + east
    c = north + south
 
    if east > 0 && valid?(b - 1, c, a)
      rear, front, west, east = east - 1, west, rear, front
      y = 69
    elsif north > 0 && valid?(c - 1, a, b)
      rear, front, north, south = north - 1, south, front, rear
      y = 78
    elsif south > 0 && valid?(c - 1, a, b)
      rear, front, north, south = south - 1, north, rear, front
      y = 83
    #elsif west > 0 && valid?(b - 1, c, a)
    else
      rear, front, west, east = west - 1, east, front, rear
      y = 87
    end
     
    if same
      x = buffer[i]
      return if x < y
      same = x == y
    end
    buffer[i] = y
  end
end
 
def find(target, limit)
  buffer = [99] * limit
  target.permutation(6).to_a.uniq.each do |rear, front, west, east, north, south|
    a = rear + front
    b = west + east
    c = north + south
    if valid?(a, b, c)
      calc(rear, front, west, east, north, south, buffer)
    end
  end
  buffer[0] == 99 ? nil : buffer
end
 
loop do
  target = gets.split.map!(&:to_i)
  break if target.all?(&:zero?)
  p, q = gets.split.map!(&:to_i)
  result = find(target, q)
  puts result ? result[p-1...q].pack('C*') : 'impossible'
end

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

// 全探索で解くべき問題だったが、数学的解法で解いてしまった
int main() {
  int n;
  cin >> n;
  string S;
  cin >> S;

  int ans = 0;
  for (int i = 0; i < 1000; i++) {
    string si = to_string(i);
    if (i < 10) si = "00" + si;
    if (10 <= i && i < 100) si = "0" + si;
    
    for (int j = 0; j < n - 2; j++) {
      if(S[j] == si[0]) {
        for (int k = j + 1; k < n - 1; k++) {
          if (S[k] == si[1]) {
            for (int l = k + 1; l < n; l++) {
              if (S[l] == si[2]) {
                ans++;
                break;
              }
            }
            break;
          }
        }
        break;
      }
    }
  }
  
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3752
import sys,bisect as bs,collections as cl
sys.setrecursionlimit(100000)
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

n = onem()

p = [0] + l() + [n+1]
ans = 0
a = [0 for i in range(n+2)]

for i in range(n+2):
    a[p[i]] = i

l = [set() for i in range(n+2)]
r = [set() for i in range(n+2)]

for i in range(n+2):
    l[i].add(max(0,i-1))
    l[i].add(max(0,i-2))
    r[i].add(min(n+1,i+1))
    r[i].add(min(n+1,i+2))


for i in range(n+1):
    m = a[i]
    x2,x1,y1,y2 = min(l[m]),max(l[m]),min(r[m]),max(r[m])
    hoge= i*(abs((m-x1)*(y2-y1)) + abs((y1-m)*(x1-x2)))
    ans += hoge

    r[x1].clear()
    r[x1].add(y1)
    r[x1].add(y2)

    l[y1].clear()
    l[y1].add(x1)
    l[y1].add(x2)
    
    r[x2].clear()
    r[x2].add(x1)
    r[x2].add(y1)

    l[y2].clear()
    l[y2].add(y1)
    l[y2].add(x1)
    

print(ans)




Measured memory_bytes: 132548
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<iomanip>
#include<list>
#include<deque>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define DEB2(X) cout<<X<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define DEB2(X) {}
#define END {}
#endif
typedef long long ll;
#define int ll
#define uset unordered_set
#define umap unordered_map
//typedef std::pair<int,int> P;
struct edge{int to,cost;};
const int INF=100000000000000000;
const int INF2=9223372036854775807;
const int MOD=1000000007;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define min(X,Y) (((int)(X)<(int)(Y))?(X):(Y))
#define max(X,Y) (((int)(X)>(int)(Y))?(X):(Y))
#define NP(X,Y) next_permutation(X,Y)
#define setdouble(X,Y) cout<<fixed<<setprecision(X)<<Y
int ceil2(int a,int b){if(a%b==0){return a/b;}else{return a/b+1;}}
int pow2(int a,int b){int r=1;for(int i=1;i<=b;i++){r*=a;}return r;}
int Log2(int a){int t=0;while(1){if(a==0||a==1){break;}a/=2;t++;}return t;}

int K;


signed main(){
	cin>>K;
	int t=7;
	set<int> U;
	t%=K;
	int cnt=0;
	while(U.find(t)==U.end()){
		cnt++;
		if(t==0){
			cout<<cnt<<endl;
			return 0;
		}
		U.insert(t);
		t*=10;
		t+=7;
		t%=K;
	}
	cout<<-1<<endl;
	return 0;
}


Measured memory_bytes: 50348
using System;
using System.Linq;

class Program
{
    static void Main()
    {
        int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
        int a = input[0];
        int b = input[1];
        int c = input[2];
        Console.WriteLine((a < b && b < c) ? "Yes" : "No");
    }
}

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

int main() {
    int n; cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    vector<int> b;

    for (int i = n-1; i >= 0; i-=2) {
        b.push_back(a[i]);
    }

    for (int i = (n%2 == 0) ? 0 : 1; i < n; i+=2) {
        b.push_back(a[i]);
    }

    rep(i, n) {
        cout << b[i];
        if (i != n-1) cout << " ";
    }
    cout << endl;
}

Measured memory_bytes: 3828
n,m = list(map(int ,input().split()))
x = []
y = []
z = []
for i in range(n):
    x1,y1,z1=[int(i) for i in input().split()]
    x.append(x1)
    y.append(y1)
    z.append(z1)
cnt = 0
a = []
b = []
c = []
d = []
e = []
f = []
g = []
h = []
for i in range(n):
    a.append(x[i]+y[i]+z[i])
    b.append(-x[i]+y[i]+z[i])
    c.append(x[i]-y[i]+z[i])
    d.append(x[i]+y[i]-z[i])
    e.append(-x[i]-y[i]+z[i])
    f.append(x[i]-y[i]-z[i])
    g.append(-x[i]+y[i]-z[i])
    h.append(-x[i]-y[i]-z[i])
a = sorted(a)[::-1]
b = sorted(b)[::-1]
c = sorted(c)[::-1]
d = sorted(d)[::-1]
e = sorted(e)[::-1]
f = sorted(f)[::-1]
g = sorted(g)[::-1]
h = sorted(h)[::-1]
am = sum(a[:m])
bm = sum(b[:m])
cm = sum(c[:m])
dm = sum(d[:m])
em = sum(e[:m])
fm = sum(f[:m])
gm = sum(g[:m])
hm = sum(h[:m])
cnt = max(am,bm,cm,dm,em,fm,gm,hm)
print(cnt)

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

using namespace std;

typedef long long ll;
typedef long double ld;

#define mp make_pair
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define all(v) v.begin(),v.end()

const int maxn = 1e5 + 100;
const ll inf = 2e18, mod = 1e9 + 7;

int n;
ll a[maxn], val[maxn];

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

	cin >> n;
	ll sum = 0;
	for (int i = 0; i < n; i++)
		cin >> a[i], sum += a[i];
	if (sum % ((ll)n * (n + 1) / 2))
	{
		cout << "NO" << endl;
		return 0;
	}
	ll k = sum / ((ll)n * (n + 1) / 2);
	for (int i = 0; i < n; i++)
		val[i] = a[(i + 1) % n] - a[i];

	ll cnt = 0;
	for (int i = 0; i < n; i++)
	{
		if ((val[i] - k) % n)
		{
			cout << "NO" << endl;
			return 0;
		}
		cnt += abs(val[i] - k) / n;
	}
	if (cnt != k)
	{
		cout << "NO" << endl;
		return 0;
	}
	cout << "YES" << endl;
}



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

int gcdLeft[100100];
int gcdRight[100100];
int a[100100];

int gcd ( int x, int y ) {
    return y == 0 ? x : gcd ( y, x % y );
}

signed main() {

    int n;
    scanf("%d", &n);
    for ( int i = 1; i <= n; i++ ) {
        scanf("%d", &a[i]);
        gcdLeft[i] = gcd ( a[i], gcdLeft[i-1] );
    }
    for ( int i = n; i > 0; i-- ) {
        gcdRight[i] = gcd ( a[i], gcdRight[i+1] );
    }
    int ma = 0;
    for ( int i = 1; i <= n; i++ ) {
        ma = max ( ma, gcd ( gcdLeft[i-1], gcdRight[i+1] ) );
    }
    printf("%d\n", ma);


    return 0;
}

Measured memory_bytes: 1408
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<vector>
#include<cstdlib>
#include<climits>
#include<cmath>
#define REP(i,m,n) for(int i = m; i < n; i++)
#define rep(i,n) REP(i,0,n)
template<class T> void chmax(T& a, T b) { if (a < b) { a = b; } }
template<class T> void chmin(T& a, T b) { if (a > b) { a = b; } }
using namespace std;

int main(void) {
	//n面サイコロ
	//得点の条件k
	double n, k;
	cin >> n >> k;

	double ans = 0;

	//サイコロで勝負が決まる場合を考慮
	ans += max((double)0, (n - k) / n);

	for (double i = 1; i <= min(n, k); i++) {
		double value = ceil(log2(k / i));
		ans += pow(0.5, value)*(1 / n);
	}

	printf("%.15lf", ans);
}

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

#define N (6)

int main(){
    char moji;

    cin >> moji;

    if(isupper(moji))
    {
        cout << 'A';
    }else
    {
        cout << 'a';
    }
    


    return 0;
}




Measured memory_bytes: 3680
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
int main(){
    int n,m;
    cin >> n >> m;
    vector<int> a(n);
    ll souhyou=0;
    rep(i,n) {
        cin>> a.at(i);
        souhyou += a.at(i);
    }
    
    double c = souhyou*1.0/ (4*m);
    
    int count = 0;
    rep(i,n){
        if(a.at(i)>= c) count++;
    }

    if(count>=m)cout << "Yes" << endl;
    else cout << "No" << endl;
    
    return 0;
}

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

bool dp[100005]={};
int main() {
	int x;
  	cin >> x;
   	for(int i=100; i<=105; i++) dp[i]=true;
  	for(int i=106; i<=x; i++) {
       for(int j=100; j<=105; j++) dp[i] |= dp[i-j];
    }


    cout << dp[x] << endl;
    return 0;
}

Measured memory_bytes: 764
#include <stdio.h> 
#define N 36
 
typedef struct{
  char suit;
  int value;
}Card;
 
int main(){
  int i, j, n, min, flag=0;
  Card a[N], b[N], a1, a2;
   
  scanf("%d", &n);
  for(i = 0; i < n; i++){
    scanf(" %c%d", &a[i].suit, &a[i].value);
    b[i].suit = a[i].suit;
    b[i].value = a[i].value;
  }
 
  for(i = 0; i < n-1; i++){
    for(j = n-1; j > i; j--){
      if(a[j].value < a[j-1].value){
	a1 = a[j];
	a2 = a[j-1];
	a[j] = a2;
	a[j-1] = a1;
      }
    }
  }

  for(i = 0; i < n; i++){
    min = i;
    for(j = i; j < n; j++){
      if(b[j].value < b[min].value){
	min = j;
      }
    }
    a1 = b[i];
    a2 = b[min];
    b[i] = a2;
    b[min] = a1;
  }

  for(i = 0; i < n-1; i++){
    printf("%c%d ", a[i].suit, a[i].value);
  }
  printf("%c%d\n", a[n-1].suit, a[n-1].value);
  printf("Stable\n");
  
  for(i = 0; i < n-1; i++){
    printf("%c%d ", b[i].suit, b[i].value);
  }
  printf("%c%d\n", b[n-1].suit, b[n-1].value);
    
  for(i = 0; i <= n-1; i++){
    if(a[i].suit != b[i].suit){
      flag = 1;
    }
  }
  
  if(flag == 1) 
    printf("Not stable\n");
  else
    printf("Stable\n");
   
  return 0;
}

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

using namespace std;
int a[4][4];
int b[20];
int book[4][4];
int main()
{
    for(int i=0; i<3; i++)
        for(int j=0; j<3; j++) cin>>a[i][j];
    int n;
    cin>>n;
    for(int i=0; i<n; i++) cin>>b[i];

    for(int i=0; i<3; i++)
        for(int j=0; j<3; j++)
        {
            for(int k=0; k<n; k++)
            {
                if(a[i][j]==b[k]) book[i][j]=1;
            }
        }
    if((book[0][0]&&book[1][1]&&book[2][2])||(book[0][2]&&book[1][1]&&book[2][0])){cout<<"Yes"<<endl;return 0;}
    for(int i=0;i<3;i++)
    {
        if(book[i][0]&&book[i][1]&&book[i][2]){cout<<"Yes"<<endl;return 0;} 
        if(book[0][i]&&book[1][i]&&book[2][i]){cout<<"Yes"<<endl;return 0;}

    }
    cout<<"No"<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using ll = long long;
#define FOR(i, k, n) for(ll i = (k); i < (n); i++)
#define FORe(i, k, n) for(ll i = (k); i <= (n); i++)
#define FORr(i, k, n) for(ll i = (k)-1; i > (n); i--)
#define FORre(i, k, n) for(ll i = (k)-1; i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define ALLr(x) (x).rbegin(), (x).rend()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;

const int INF = 1001001001;
using P = pair<ll, ll>;

int main(void){
  ll n, m;
  cin >> n >> m;
  vector<ll> a(n);
  REP(i, n) cin >> a[i];
  vector<P> d;
  REP(i, m){
    ll b, c;
    cin >> b >> c;
    d.emplace_back(c, b);
  }
  sort(ALL(a));
  sort(ALLr(d));
  ll ans = 0;
  ll i = 0;
  REP(j, m){
    ll c = d[j].first;
    ll b = d[j].second;
    ll k = 0;
    while(i < n && a[i] < c && k < b){
      ans += c;
      i++;
      k++;
    }
  }
  while(i < n){
    ans += a[i++];
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 6076
import sys
sys.setrecursionlimit(1000000)

h,w=map(int,input().split())
s=[input() for _ in range(h)]
t=[[None]*w for _ in range(h)]

def dfs(i,j,color):

  if not (0<=i<h and 0<=j<w):return 0,0
  if s[i][j]==color: return 0,0
  if t[i][j]:return 0,0

  t[i][j]=True
  wh,bl=0,0
  if s[i][j]=="#":
    bl+=1
  else:
    wh+=1

  tmp1,tmp2=dfs(i+1,j,s[i][j])
  wh,bl=wh+tmp1,bl+tmp2

  tmp1,tmp2=dfs(i-1,j,s[i][j])
  wh,bl=wh+tmp1,bl+tmp2
        
  tmp1,tmp2=dfs(i,j-1,s[i][j])
  wh,bl=wh+tmp1,bl+tmp2

  tmp1,tmp2=dfs(i,j+1,s[i][j])
  wh,bl=wh+tmp1,bl+tmp2

  return wh,bl

ans=0
for i in range(h):
  for j in range(w):
    a,b=dfs(i,j,"!")
    ans+=a*b

print(ans)


Measured memory_bytes: 138728
import sys
from heapq import heappop, heappush
from collections import defaultdict
input = sys.stdin.buffer.readline

INF = 10**20
N,M = map(int,input().split())
g = defaultdict(list)
for i in range(2,N+1):
    g[i].append((i-1,0))
for i in range(1,M+1):
    l,r,c = list(map(int,input().split()))
    g[l].append((r,c))

d = [INF] * (N+1)
d[1] = 0
que = []
heappush(que,(1,0))
while que:
    s, dist = heappop(que)
    if d[s] < dist:
        continue
    for t,c in g[s]:
        if d[t] > d[s] + c:
            d[t] = d[s] + c
            heappush(que,(t,d[t]))
if d[N] == INF:
    print(-1)
    exit()
print(d[N])
        



Measured memory_bytes: 123160
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int GCD(const int& a, const int& b){
   const int& _a = max(a,b);
   const int& _b = min(a,b);
   if(_a % _b == 0){
      return _b;
   }
   else{
      return GCD(_b, _a % _b);
   }
}

int LCM(const int& a, const int& b){
   const int& _a = max(a,b);
   const int& _b = min(a,b);
   return (_a*_b)/(GCD(_a, _b));
}

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

   cout << n*n - a << endl;

   return 0;
}

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

#define INF 1001001001
#define LINF 1001001001001001001
#define MOD 1000000007
#define MOD2 998244353

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

#define rep(i,n) for(int i=0,_i=(n);i<_i;++i)
#define rep1(i,a,b) for(int a_=(a),b_=(b),i=a_;i<b_;++i)
#define repr(i,n) for(int _i=(n),i=_i;i>0;--i)

#define db(x) cerr<<#x<<" = "<<x<<" ";
#define db2(x,y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<") ";
#define db3(x,y,z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = ("<<x<<", "<<y<<", "<<z<<") ";
#define ln cout<<endl;

#define all(a)  (a).begin(),(a).end()
#define dig(n)  to_string(n).length()

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define se second
#define fi first

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<pii,pii> ppii;

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

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

int main(){
    bool flag=false;
    ll ans=LINF,sum=0;

    int n,c;
    cin>>n>>c;

    vector<vector<int>>cnt(3,vector<int>(c,0));
    int d[c][c]={};
    int col[n][n]={};

    rep(i,c)rep(j,c)cin>>d[i][j];
    rep(i,n)rep(j,n){
        cin>>col[i][j];
        --col[i][j];
    }
    rep(i,n)rep(j,n){
        ++cnt[(i+j)%3][col[i][j]];
    }

    rep(i,c)rep(j,c){
        if(j==i)continue;
        
        rep(k,c){
            if(k==j || k==i)continue;
            int dtemp=0;
            
            rep(color,c){
                dtemp += cnt[0][color] * d[ color ][ i ];
                dtemp += cnt[1][color] * d[ color ][ j ];
                dtemp += cnt[2][color] * d[ color ][ k ];
            }

            //db3(i,j,k);db(dtemp);ln;

            chmin(ans,dtemp);
        }
    }


    //cout <<fixed<<setprecision(16)<< << endl;
    
    cout<<ans<<endl;
    
    //if(flag)cout << "Yes" <<endl;
    //else cout << "No" <<endl;
    
    return 0;
}


Measured memory_bytes: 1280
const log = console.log;

const findBestRecordInteger = (
  start: number,
  end: number,
  getRecord: (n: number) => number,
  isBetterRecord: (record: number, currentBestRecord: number) => boolean
) => {
  let bestRecord = getRecord(start);
  let bestRecordNumber = start;

  for (let i = start + 1; i < end; i += 1) {
    const currentRecord = getRecord(i);

    if (!isBetterRecord(currentRecord, bestRecord)) continue;

    bestRecord = currentRecord;
    bestRecordNumber = i;
  }

  return {
    record: bestRecord,
    num: bestRecordNumber
  };
};

const sumDigits = (v: number, base = 10) => {
  let accumulator = 0;

  while (v > 0) {
    accumulator += v % base;
    v = (v / base) | 0;
  }

  return accumulator;
};

// ----

function Main(input: string): void {
  const n = +input;

  const minValue = findBestRecordInteger(
    1,
    n,
    num => sumDigits(num) + sumDigits(n - num),
    (num, currentMinNum) => num < currentMinNum
  ).record;

  log(minValue);
}

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

Measured memory_bytes: 7500
#include <iostream>
#include <string>
#include <vector>
using ll=long long;
using namespace std;

int main(){
    int N,M;
    cin>>N>>M;

    if(N%2==0){
        int half=min(N/4,M);
        for(int i=0;i<half;i++){
            cout<<1+i<<" "<<N-i<<endl;
        }
        if(half<M){
            for(int i=half;i<M;i++){
                cout<<2+i<<" "<<N-i<<endl;
            }
        }

    }else{
        for(int i=0;i<M;i++){
            cout<<1+i<<" "<<N-i<<endl;
        }
    }

    return 0;
}

Measured memory_bytes: 3576
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <utility>
#include <numeric>

using namespace std;
typedef long long llong;
typedef unsigned long long ullong;

const ullong MOD = 1000000000 + 7;

int main()
{
	int n;
	for (cin >> n; n--;)
	{
		string a, b;

		cin >> a;

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

		b = a;
		reverse(b.begin(), b.end());

		cout << atoi(b.c_str()) - atoi(a.c_str()) << endl;

	}
}


Measured memory_bytes: 3128
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <math.h>
#include <sstream>
#include <numeric>
#include <string>

using namespace std;

int main() {
  int r, D, x;
  cin >> r >> D >> x;
  for (int i = 0; i < 10; ++i) {
    x = r * x - D;
    cout << x << endl;
  }    
  return 0;
}


Measured memory_bytes: 256
R, G, B, N = map(int, input().split())
ans = 0
for r in range(N // R + 1):
    for g in range(N // G + 1):
        dif = (N - R * r - G * g)
        if dif < 0:
            break 
        if dif % B == 0:
            ans +=1
print(ans)

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

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

int main(){
  int X,Y,Z;
  cin>>X>>Y>>Z;
  swap(X,Y);
  swap(X,Z);
  
  cout<<X<<" "<<Y<<" "<<Z<<endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
   string a;
   int c=0,i;
     cin>>a;
     int ln=a.length();
     int p=ln/2;
     int q=p;
     for(i = 0;i < p; i++){
         if(a[i]==a[q+1])
         {
                  c++;
                  q++;
         }
     }
     if(c==p) cout<<"Yes"<<endl;
     else cout<<"No"<<endl;
}




Measured memory_bytes: 256
n = gets.to_i
a = Array.new(n+1,0)

(1..100).each do |x|
(1..100).each do |y|
(1..100).each do |z|
  p = x**2 + y**2 + z**2 + x*y + y*z + z*x
  next if p>n
  a[p] += 1
end
end
end

(1..n).each do |i|
  puts a[i]
end


Measured memory_bytes: 14328
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <iomanip>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 998244353

typedef long long ll;
typedef pair<ll,ll> P;

ll dp[222222][4];

void chMax(ll &a, ll b){
	a = max(a, b);
}

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

	ll n;cin >> n;
	vector<ll> v(n);REP(i, n)cin >> v[i];

	REP(i, 222222)REP(j, 4)dp[i][j] = -LLINF;
	dp[0][0] = 0;

	REP(i, n){
		if(i == n-1){
			REP(j, 4){
				chMax(dp[i+1][min(3LL, j+1)], dp[i][j]);
				if(n % 2 && j == 0)continue;
				chMax(dp[min(n, i+2)][j], dp[i][j] + v[i]);
			}
		}
		else{
			REP(j, 4){
				chMax(dp[i+1][min(3LL, j+1)], dp[i][j]);
				chMax(dp[min(n, i+2)][j], dp[i][j] + v[i]);
			}
		}
	}

	if(n % 2){
		cout << max(dp[n][1], dp[n][2]) << endl;
	}
	else{
		cout << max(dp[n][0], dp[n][1]) << endl;
	}

	return 0;
}


Measured memory_bytes: 11648
/******************************************
* AHAM BRAHMASHMI ;) *
******************************************/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define vll vector<ll>
#define pll pair<ll,ll>
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define mod 1000000007


void print_vec(vll a)
{
	cout << "start printing the vector\n";
	for (ll i = 0; i < a.size(); i++)
		cout << a[i] << " ";
	cout << "\n";
}
void print_mat(vector<vll> a)
{
	cout << "start printing the matrix\n";
	for (ll i = 0; i < a.size(); i++)
	{
		for (ll j = 0; j < a[i].size(); j++)
		{
			cout << a[i][j] << " ";
		}
		cout << "\n";
	}
}

/******************************************
* NUMBER THEORY ;) *
******************************************/



ll powermod(ll x, ll y)
{
	ll res = 1;
	x = x % mod;
	while (y > 0)
	{
		if (y & 1)
			res = (res * x) % mod;
		y = y >> 1;
		x = (x * x) % mod;
	}
	res %= mod;
	return res;
}
ll factmod(ll n)
{
	ll res = 1;
	while (n > 1)
	{
		res = (res * ((n / mod) % 2 ?  mod - 1 : 1)) % mod;
		for (ll i = 2; i <= n % mod; ++i)
			res = (res * i) % mod;
		n /= mod;
	}
	res %= mod;
	return res;
}



void solve()
{
	ll n;
	cin >> n;
	ll out = n + n * n + n * n * n;
	cout << out << "\n";

}

int main()
{

#ifndef ONLINE_JUDGE
	// for getting input from input.txt
	freopen("input.txt", "r", stdin);
	// for writing output to output.txt
	freopen("output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	// ll t;
	// cin>>t;
	// while(t--)
	// {
	solve();
	// }

	return 0;
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define dbg(x) cerr << #x << " = " << x << endl
#define _ << ' ' <<
using namespace std;
using ll = long long;
using vi = vector<int>;

int a[200001], b[200001];

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    for (int i = 1; i <= n; ++i)
        cin >> a[i];

    vi sol;
    for (int i = n; i > 0; --i)
    {
        int sum = 0;
        for (int j = 2 * i; j <= n; j += i)
            sum += b[j];

        b[i] = (sum & 1) ^ a[i];
        if (b[i])
            sol.push_back(i);
    }
    cout << sol.size() << endl;
    for (int x : sol)
        cout << x << '\n';
}


Measured memory_bytes: 3192
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a=sc.nextInt(),b=sc.nextInt(),c=sc.nextInt(),k=sc.nextInt();

		for(int i=0; i<k;i++) {
			if(a>=b) {
				if(a>=c) {
					a*=2;
				}else {
					c*=2;
				}
			}else {
				if(b>=c) {
					b*=2;
				}else {
					c*=2;
				}
			}
		}
		System.out.println(a+b+c);

	}
}

Measured memory_bytes: 21460
n = int(input())
a_ls = list(map(int, input().split()))
mod = 1000000007
isOK = True
if n % 2 == 0:
    count_ls = [0] * n
    for a in a_ls:  
        count_ls[a] += 1
    suppose = [0,2] * (n//2)
    if not count_ls == [0,2] * (n//2):
        isOK = False
else:
    count_ls = [0] * n
    for a in a_ls:  
        count_ls[a] += 1
    suppose = [1] + [0,2] * (n//2)
    if not count_ls == suppose:
        isOK = False
if isOK:
    ans = (2 ** (n // 2)) % mod
else:
    ans = 0
print(ans)

Measured memory_bytes: 13880
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const static ll INF = 1e9;

int main() {
    ll N, ans = 0; cin >> N;
    vector<set<string>> st(5);
    for(int i = 0; i < N; i++){
        string S; cin >> S;
        if(S[0] == 'M') st[0].insert(S);
        else if(S[0] == 'A') st[1].insert(S);
        else if(S[0] == 'R') st[2].insert(S);
        else if(S[0] == 'C') st[3].insert(S);
        else if(S[0] == 'H') st[4].insert(S);
    } 
    for(int i = 0; i < 3; i++){
        for(int j = i+1; j < 4; j++){
            for(int k = j+1; k < 5; k++){
                ans += st[i].size() * st[j].size() * st[k].size();
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 9600
import sys
N, Y = map(int, input().strip().split())

for i in range(N+1):
  for j in range(i, N+1):
    x = i
    y = j - i
    z = (Y - (10000*x + 5000*y))//1000
    if x+y+z == N:
      print(x, y, z)
      sys.exit()
print(-1, -1, -1)

Measured memory_bytes: 3060
// KOI NI YAAR SAB SAHI HOEGA  BAS  CHORRO MAT
// ENJOR KARO YAAR
// HAAR MAT MAANO
// // APNA TIME AAYEGA
// BEILIEVE IN GOD
#include<bits/stdc++.h>
using namespace std;
#define lli int
#define loop(i,a,b) for(lli i=a;i<b;i++)
#define loopb(i,a,b) for (lli i=a;i>=b;i--)
#define pb push_back
#define mod 1000000007
#define fast() ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define mem(a,b) memset(a,b,sizeof(a))
#define gcd(a,b) (__gcd((a),(b)))
#define lcm(a,b)(((a)*(b))/gcd((a),(b)))
#define ma 1e18
#define bc __builtin_popcountll
#define vi vector<lli>
#define pr pair<lli,lli>
#define vp vector<pr>
#define F  first
#define S   second
#define lld long double
#define PI  3.14159265358979
#define pri  priority_queue<ll>
#define prim  priority_queue<ll,vector<ll>,greater<ll>>
#define flush  cout<<flush

const lli  N=3e3+10;
 
vector<vector<lld>> dp(N,vector<lld>(N,-1)); 
lli n;
vector<lld>a;



lld solve(lli index , lli tails)
{if(index == n)
{if(tails<=n/2)
{return 1;
}
else
{return 0;
}
}

if(dp[index][tails]!=-1)
{return dp[index][tails];
}
lld res=0;
res = (a[index] *  solve(index+1,tails)) + (1-a[index]) *   solve(index+1,tails+1);
return dp[index][tails] =  res;
}

int main()
{fast();
cin>>n;
a.resize(n);
loop(i,0,n)
{cin>>a[i];
}

cout<<fixed<<setprecision(10)<<solve(0,0)<<"\n";
}


Measured memory_bytes: 145844
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <cctype>
#include <cstring>
#include <set>
#include <map>
#define rep(i, m, n) for (int i = m; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define ll long long
#define ull unsigned long long
#define push(a) push_back(a)
#define pop(a) pop_back(a)
#define debug(x) cout << #x << ": " << x << endl
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

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

ll a,b,c,d,e,f,g;
ll ans=1;

int main(){
    cin >> a >> b;
    for(int i=0; i<a; i++){
        if(ans*2<ans+b){
            ans*=2;
        }else{
            ans+=b;
        }
    }
    cout<<ans<<endl;
}

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

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;


#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

int dx4[4] = {1,0,-1,0}, dy4[4] = {0,1,0,-1};


int main()
{
    int n;
    cin>>n;
    n%=10;
    string s="hon";
    if(n==3)
    {
        s="bon";
    }
    else if(n==0||n==1||n==6||n==8)
    {
        s="pon";
    }
    cout<<s<<endl;
    
    return 0;
}

Measured memory_bytes: 3624
#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;
	cin >> n;
	vector<int> b(n-1);
	rep(i,n-1) {
		cin >> b[i];
	}
	int sum = 0;
	rep(i,n) {
		if (i == 0) sum += b[0];
		else if (i == n-1) sum += b[n-2];
		else sum += min(b[i-1],b[i]);
	}
	cout << sum << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define All(v) (v).begin(),(v).end()
int dy[8] = {-1,0,1,0,-1,1,1,-1};
int dx[8] = {0,1,0,-1,1,1,-1,-1};
const int mod = 1000000007;
const int inf = mod*mod;
const int d5 = 100100;
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin>>n;
    vector<int> a(n);
    for(int i=0;i<n;i++)cin>>a[i];
    sort(All(a));
    int res=0,p,m;
    if(n%2==1){
        p=0;
        m=0;
        for(int i=0;i<n/2;i++)m+=2*a[i];
        for(int i=n/2+2;i<n;i++)p+=2*a[i];
        p+=a[n/2]+a[n/2+1];
        res=max(res,p-m);
        p=0;
        m=0;
        for(int i=0;i<(n-2)/2;i++)m+=2*a[i];
        for(int i=(n-2)/2+2;i<n;i++)p+=2*a[i];
        m+=a[(n-2)/2]+a[(n-2)/2+1];
        res=max(res,p-m);
    }else{
        p=0;
        m=0;
        for(int i=0;i<(n-2)/2;i++)m+=2*a[i];
        for(int i=(n-2)/2+2;i<n;i++)p+=2*a[i];
        p+=a[(n-2)/2+1];
        m+=a[(n-2)/2];
        res=max(res,p-m);
        p=0;
        m=0;
        for(int i=0;i<(n-2)/2;i++)m+=2*a[i];
        for(int i=(n-2)/2+2;i<n;i++)p+=2*a[i];
        p+=a[(n-2)/2+1];
        m+=a[(n-2)/2];
        res=max(res,p-m);
    }
    cout<<res<<endl;
}

Measured memory_bytes: 1024
import scala.io.StdIn

object Main extends App {

  val n = StdIn.readLine().trim.toInt
  val a = Array(0) ++ StdIn.readLine().split(' ').map(_.toInt)

  def parent(i: Int) = i/2
  def left(i: Int)  = 2*i
  def right(i: Int) = 2*i+1
  
  def swap(target: Array[Int], from: Int, to: Int): Unit = {
    val temp = target(to)
    target(to) = target(from)
    target(from) = temp
  }

  def maxHeapify(a: Array[Int], i: Int): Unit = {
    val p = parent(i)
    val l = left(i)
    val r = right(i)

    var largest = if(l <= n && a(l) > a(i)) l else i
    largest = if(r <= n && a(r) > a(largest)) r else largest
    
    if(i != largest){
      swap(a, i, largest)
      maxHeapify(a, largest)
    }
  }
  
  (n/2 to 1 by -1).foreach{ i =>
    maxHeapify(a, i)
  }

  println(" " + a.drop(1).mkString(" "))
}



Measured memory_bytes: 198412
from collections import Counter
N =int(input())
A = list(map(int,input().split()))

A = sorted(A)
C = Counter(A)
S=set(A)

dp=[True]*(A[-1]+1)

ans=0
for i in range(1,A[-1]+1):
    if dp[i]:
        if i in S:
            for j in range(i,A[-1]+1,i):
                dp[j]=False
            if C[i]==1:
                ans+=1
print(ans)



Measured memory_bytes: 153060
package main

import (
	"fmt"
	"io"
	"os"
	"sort"
	"strconv"
)

var pri = fmt.Println
var scan = fmt.Fscanln
var scanone = fmt.Fscan

func main() {
	solve(os.Stdin)
}

func min(a ...int) int {
	res := a[0]
	for i := 1; i < len(a); i++ {
		if res > a[i] {
			res = a[i]
		}
	}
	return res
}

func max(a ...int) int {
	res := a[0]
	for i := 1; i < len(a); i++ {
		if res < a[i] {
			res = a[i]
		}
	}
	return res
}

func mustint(a string) int {
	i, _ := strconv.Atoi(a)
	return int(i)
}

type P struct {
	x, y int
}

func (p *P) add(q *P) *P {
	return &P{p.x + q.x, p.y + q.y}
}

type SortBy []P

func (a SortBy) Len() int           { return len(a) }
func (a SortBy) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
func (a SortBy) Less(i, j int) bool { return a[i].x < a[j].x }

const huge = 1e10

func solve(rd io.Reader) {
	var n, t int
	scan(rd, &n, &t)
	items := make([]P, n)
	for index := 0; index < n; index++ {
		var a, b int
		scan(rd, &a, &b)
		items[index] = P{a, b}
	}
	sort.Sort(SortBy(items))
	dp := make([]int, t+1)
	for _, p := range items {
		for i := t - 1; i >= 0; i-- {
			ai := min(p.x+i, t)
			dp[ai] = max(dp[i]+p.y, dp[ai])
		}
	}
	pri(dp[t])
}


Measured memory_bytes: 896
N=int(input())
T,A=map(int,input().split())
h=list(map(int,input().split()))


H=(T-A)/0.006

l=list()
for i in range(N):
   lx=abs(h[i]-H)
   l.append(lx)
x=min(l)
print(l.index(x)+1)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i++)

int main() {
	string a, b;
	cin >> a >> b;
	rep(i,0,b.size()) {
		cout << a[i] << b[i];
	}
	if (a.size() != b.size()) {
		cout << a[a.size() - 1] << endl;
	}
	
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a), i##_max = (b); i < i##_max; ++i)
#define RFOR(i, a, b) for (int i = (b)-1, i##_min = (a); i >= i##_min; --i)
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define RREP(i, n) for (int i = (n)-1; i >= 0; --i)
#define ALL(obj) (obj).begin(), (obj).end()

#define pb push_back
#define mp make_pair
#define fst first
#define snd second

using namespace std;
using i64 = int64_t;
using u64 = uint64_t;
using vb = vector<bool>;
using vi = vector<int>;
using vl = vector<i64>;
using vd = vector<double>;
using pi = pair<int, int>;
using pl = pair<i64, i64>;
using pd = pair<double, double>;

constexpr int INF = 1 << 30;
constexpr int MOD = 1000000007;

template <typename T>
inline void chmin(T &a, T b) {
  a = min(a, b);
}
template <typename T>
inline void chmax(T &a, T b) {
  a = max(a, b);
}
template <typename T>
void print(T &v) {
  for (auto it = v.begin(); it != v.end(); ++it) {
    if (it != v.begin()) cout << " ";
    cout << *it;
  }
  cout << endl;
}

bool is_prime(int x) {
  if (x == 1)
    return false;
  else if (x == 2)
    return true;
  else if (x % 2 == 0)
    return false;
  for (int i = 3; i * i <= x; i += 2) {
    if (x % i == 0) return false;
  }
  return true;
}

int main() {
  int n, x, ans = 0;
  cin >> n;
  REP(i, n) {
    cin >> x;
    if (is_prime(x)) ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 3088
/* いもす法 */
#include <bits/stdc++.h>
using namespace std;

#define REP(i, n) for (ll (i) = 0 ; (i) < (ll)(n) ; ++(i))
#define REPN(i, m, n) for (ll (i) = m ; (i) < (ll)(n) ; ++(i))
#define REP_REV(i, n) for (ll (i) = (ll)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (ll (i) = (ll)(n) - 1 ; (i) >= m ; --(i))

#define INF 2e9
#define INF_LL 1LL<<60
#define ll long long

typedef pair<ll, ll> P;

int main(){
    int mizu1, mizu2, sato1, sato2, tokeru, jogen;
    cin >> mizu1 >> mizu2 >> sato1 >> sato2 >> tokeru >> jogen;
    int ans_gokei, ans_sato;
    double nodo = 0;

    mizu1 *= 100, mizu2 *= 100;

    for(int water1 = 0; water1 <= jogen; water1 += mizu1) {
        for(int water2 = 0; water1 + water2 <= jogen; water2 += mizu2) {
            int nokori = jogen - water1 - water2;
            int sato_kano = (water1 + water2) * tokeru / 100;
            sato_kano = min(sato_kano, nokori);
            int sato_max = 0;
            for(int sugar1 = 0; sugar1 <= sato_kano; sugar1 += sato1) {
                for(int sugar2 = 0; sugar2+sugar1 <= sato_kano; sugar2 += sato2) {
                    sato_max = max(sato_max, sugar1+sugar2);
                }
            }
            if(nodo <= (double)100*(double)sato_max / (double)(sato_max+water1+water2)){
                nodo = (double)100*(double)sato_max / (double)(sato_max+water1+water2);
                ans_gokei = sato_max+water1+water2;
                ans_sato = sato_max;
            }
        }
    }

    //cout << ans_gokei << " " << ans_sato;
    cout << ans_gokei << endl << ans_sato << endl;

    return 0;
}


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

int main() {
    int W, H, N;
    cin >> W >> H >> N;
    int wl = 0, wr = W, wb = 0, wt = H;
    int x, y, a, square;
    for (int i = 0; i < N; i++) {
        cin >> x >> y >> a;
        if (a == 1) {
            wl = max(wl, x);
        }
        else if (a == 2) {
            wr = min(wr, x);
        }
        else if (a == 3) {
            wb = max(wb, y);
        }
        else if (a == 4) {
            wt = min(wt, y);
        }
    }
    if (wr <= wl || wt <= wb) {
        square = 0;
    }
    else {
        square = (wr - wl) * (wt - wb);
    }
    cout << square << endl;
    return 0;
}


Measured memory_bytes: 256