akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

#define DUMP(x) std::cerr << (#x) << " = " << (x) << "\n"
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP(i, k, n) for (int i = (k); i < (int)(n); ++i)
#define ALL(r) r.begin(), r.end()
#define YES puts("YES")
#define Yes puts("Yes")
#define NO puts("NO")
#define No puts("No")
#define IMP puts("IMPOSSIBLE")
#define Imp puts("Impossible")
#define imp puts("impossible")
#define M1 puts("-1")
#define pb push_back

template <typename T>
T dup(T x, T y)
{
    return (x + y - 1) / y;
};
template <typename A, size_t N, typename T>
inline void arrayFill(A (&array)[N], const T &val) { std::fill((T *)array, (T *)(array + N), val); }

using ll = int64_t;
using vint = vector<int32_t>;
using vvint = vector<vint>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pint = pair<int32_t, int32_t>;
using pll = pair<ll, ll>;
using setint = set<int32_t>;
using setstr = set<string>;
using qint = queue<int32_t>;
using qpint = queue<pint>;

constexpr std::int32_t INF = 1001001001;
constexpr std::int64_t LINF = 1001001001001001001;

//                  9876543210
constexpr int mod = 1000000007;
class mint
{
private:
    std::int64_t m_x;

public:
    mint(std::int64_t m_x = 0) : m_x(m_x % mod) {}
    std::int64_t get() { return m_x; }
    mint &operator+=(const mint a)
    {
        if ((m_x += a.m_x) >= mod)
            m_x -= mod;
        return *this;
    }
    mint &operator-=(const mint a)
    {
        if ((m_x += mod - a.m_x) >= mod)
            m_x -= mod;
        return *this;
    }
    mint &operator*=(const mint a)
    {
        (m_x *= a.m_x) %= mod;
        return *this;
    }
    mint operator+(const mint a) const
    {
        mint res(*this);
        return res += a;
    }
    mint operator-(const mint a) const
    {
        mint res(*this);
        return res -= a;
    }
    mint operator*(const mint a) const
    {
        mint res(*this);
        return res *= a;
    }

    mint pow(const std::int64_t t) const
    {
        if (!t)
            return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1)
            a *= *this;
        return a;
    }
    // for prime mod
    mint inv() const
    {
        return pow(mod - 2);
    }
    mint &operator/=(const mint a)
    {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const
    {
        mint res(*this);
        return res /= a;
    }
};

void Main()
{
    int n;
    string u, d;
    cin >> n >> u >> d;

    mint ans = 1;
    int tmp = 0;

    rep(i, n)
    {
        if (u[i] == d[i])
        {
            ans *= (3 - tmp);
            tmp = 1;
        }
        else
        {
            if (i == 0)
                ans *= 6;
            else if (tmp == 2)
            {
                ans *= 3;
            }
            else
            {
                ans *= 2;
            }
            tmp = 2;
            ++i;
        }
    }
    cout << ans.get() << endl;
}

int main()
{
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


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

#define ll long long
#define ull unsigned long long

// return a % b (positive value)
int mod(int a, int b) {
  return ((a%b)+b)%b;
}

// computes gcd(a,b)
int gcd(int a, int b) {
  int tmp;
  while(b){a%=b; tmp=a; a=b; b=tmp;}
  return a;
}

int main() {
  ull a, b, c, d;
  cin >> a >> b >> c >> d;
  ull x, y, z, gc;
  x = b/c - (a-1)/c;
  y = b/d - (a-1)/d;
  gc = (c*d) / gcd(c,d);
  z = b/gc - (a-1)/gc;
  cout << b - a + 1 - x - y + z << endl;
}


Measured memory_bytes: 256
#pragma GCC optimize ("Ofast")
#include"bits/stdc++.h"
using namespace std;

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

struct _ { ios_base::Init i; _() { cin.sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(10); } } ___;
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
	cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
	const char* comma = strchr(names + 1, ',');
	cerr.write(names, comma - names) << " : " << arg1 << "  ";
	__f(comma + 1, args...);
}

#define ll long long
#define pii pair<int,int>
#define oset tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define ff first
#define ss second
#define endll '\n'
#define rep(i,n) for(int i=0;i++<n;)
#define scl(i) scanf("%lld",&i)
#define int long long int
#define all(n) n.begin(),n.end()
#define mem(n,i) memset(n,i,sizeof n)
#define em(a) emplace_back(a)
#define pb(a) push_back(a)
#define srep(it,vv) for(auto &it : vv)
#define prep(it,vv) for(auto it : vv)
//vector<vector<int>>arr(n + 5, vector<int>(m + 5,0));

typedef vector<int> vii;
typedef vector<string> vss;
/*

*/
signed main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	int a, b, c, d; cin >> a >> b >> c >> d;
	int x = a * c;
	int y = a * d;
	int xx = b * c;
	int yy = b * d;

	cout << max(x, max(y, max(xx, yy)));
}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
#define FOR0(i,n) for(i=0;i<n;i++)
#define FOR(i,j,n) for(i=j;i<n;i++)
#define FORD(i,j,k) for(i=j;i>=k;i--)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define inf 1000000000
#define ninf -1000000000
#define endl '\n' 
#define she_told_me_dont_worry ios_base::sync_with_stdio (false) ; cin.tie(0) ; cout.tie(0) ;
// Use cout.flush() for interactive problems.
inline long long  MAX2(long long  a, long long int b){return (a)>(b)?(a):(b);}
inline long long  MAX3(long long  a, long long  b,long long  c){return (a)>(b)?((a)>(c)?(a):(c)):((b)>(c)?(b):(c));}
inline long long  MIN2(long long  a, long long  b){return (a)<(b)?(a):(b);}
inline long long  MIN3(long long  a, long long b,long long c){return (a)<(b)?((a)<(c)?(a):(c)):((b)<(c)?(b):(c));}
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector< ii > vii;
int main()
{
    she_told_me_dont_worry
    int n, h, w;
    cin>>n>>h>>w;
    int ans = (1+ (n-w))*(1+ (n-h));
    cout<<ans;
    cerr <<endl<< "Time elapsed : " << clock() * 1000.0 / CLOCKS_PER_SEC << " ms" << '\n';
}

Measured memory_bytes: 256
#include "iostream"
#include "iomanip"
using namespace std;
int main()
{
	long m, n, a, b, t, c;
	while(cin>>a>>b)
	{
		m=a;   n=b;  
		while(b!=0)  
		{
			c=a%b;
			a=b;
			b=c;
		}
		cout<<a<<' '<<(m/a)*n<<endl;
	}
} 

Measured memory_bytes: 3000
def solve(n, k):
    if k == 0:
        return n**2
    ans = 0
    for b in range(k+1, n+1):
        m = (n-k) / b
        if (m+1)*b <= n:
            ans += (m+1)*(b-k)
        else:
            ans += m*(b-k) + n - m*b - k + 1
    return ans
n, k = map(int, raw_input().split())
print solve(n, k)

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

const long long P = 998244353, MX = 3000000;
const int f[] = {2, 1};

int N, M;
long long fact[MX+10], invf[MX+10];

inline long long MOD(long long x, long long M=P) { return (x%M+M)%M; }
inline void SUB(long long &x, long long y) { x = MOD(x-y); }

int qpow(long long a, int k) {
//	printf("a=%lld; k=%d\n", a, k);
	return (k?(qpow(a*a%P, k/2)*((k&1)?a:1)):1)%P;
}

void init() {
	fact[0] = 1;
	for (int i = 1; i <= MX; ++i) fact[i] = fact[i-1]*i%P;
	invf[MX] = qpow(fact[MX], P-2);
	assert(invf[MX]*fact[MX]%P == 1);
	for (int i = MX; i; --i) invf[i-1] = invf[i]*i%P;
}

long long C(int k, int n) {
	assert(0 <= k && k <= n);
	return fact[n]*invf[k]%P*invf[n-k]%P;
//	else printf("%dC%d = %lld\n", k, n, fact[n]*invf[k]%P*invf[n-k]%P);
}

int main() {
	init();
	scanf("%d%d", &N, &M);
	long long ans = C(N-1, 3*M + N-1);
//	printf("%lld\n", ans);
	for (int i = 2*M+1; i <= 3*M; ++i) {
		SUB(ans, N*C(N-2, (3*M-i)+(N-2)));
	}
//	printf("%lld\n", ans);
	for (int i = M+2; i <= N && i <= 3*M; i+=2) {
		SUB(ans, C(i, N)*C(N-1, (3*M-i)/2+(N-1)));
	}
	printf("%lld\n", ans);
}


Measured memory_bytes: 47104
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map.Entry;
import java.util.PriorityQueue;
import java.util.Scanner;

class Main {
    static final int MOD = 1000000007;
    static final int INF = 1 << 30;
    static final int ALF = 26;

    Main() {
        Scanner sc = new Scanner(System.in);
        long ans = 0;
        int N = sc.nextInt();
        int K = sc.nextInt();
        int[] A = new int[N];
        for(int i=0;i<N;i++)A[i]=sc.nextInt();
        
        for(int i=K;i<N;i++){
            int prev = A[i-K];
            int now = A[i];
            System.out.println(prev<now?"Yes":"No");
        }

    }

    public static void main(String[] args) {
        new Main();
    }
}


Measured memory_bytes: 60120
#include<bits/stdc++.h>
using namespace std;
#define IO ios_base::sync_with_stdio(false)
#define ll long long
ll dp[5][521001], a[305011];

ll f(ll i, ll j)
{
    if(i==j) {dp[i][j]= a[i]; return a[i]; }
    if(dp[i][j]!=-1) return dp[i][j];
    dp[i][j] = f(i+1,j)^f(i,j-1);
    return dp[i][j];
}
int main()
{
    IO;
    ll j, n, m, k, m1, m2, a1, a2, l, t, cnt=0, mn, h=0, mod=1e7+7; int tc=0; ll i;
    //cin>>t;
    //while(t--){
        tc++;
        cin>>n;
        for(i = 1; i<=n; i++) {
            cin>>l>>j>>k;
            dp[1][i]=max(dp[2][i-1],dp[3][i-1])+l;
            dp[2][i]=max(dp[1][i-1],dp[3][i-1])+j;
            dp[3][i]=max(dp[2][i-1],dp[1][i-1])+k;
        }
        cout<<max(max(dp[1][n],dp[2][n]),dp[3][n])<<endl;
        //cout<<"Case "<<tc<<": "<<dp[2*n-1][1]<<endl;
    //}
    return 0;
}


Measured memory_bytes: 6400
#include <bits/stdc++.h>
#include <math.h>
#include <vector>
#include <iostream>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
/*vector<Type> v;
vector<Type> v();
vector<Type> v(n);
vector<Type> v(n, d);
vector<vector<Type>> vv;
vector<vector<Type>> vv();
vector<vector<Type>> vv(n);
vector<vector<Type>> vv(n, vector<Type>(m));
vector<vector<Type>> vv(n, vector<Type>(m, d));*/


int main() {
  long long N;
  cin >> N;
  vector<long long> A(N);
  long long Asum=0;
  long long mod = pow(10,9)+7;
  rep(i,N){
    cin>>A[i];
    Asum+=A[i];
    Asum%=mod;
  }
  long long sum=0;
  for(int i=0;i<N-1;i++){
    Asum-=A[i]%mod;
    if(Asum<0) Asum+=mod;
    sum+=(A[i]*Asum)%mod;
    sum%=mod;
  }
  cout<<sum;
  return 0;
}


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

using namespace std;

typedef long long ll;

const int MAXN=1e3+7;

int n;
struct node {
	int x,y;
}N[MAXN];

ll gd(ll i,ll x,ll y) {
	return abs(N[i].x-x)+abs(N[i].y-y);
}

int m=40,can;
ll d[40];
char ch[40];

void solve(int num) {
	ll X=0,Y=0;
	if(m==33) X=1;
	ch[33]='R';
	for(int i=1;i<=32;i++) {
		if(gd(num,X+d[i],Y)<=d[i]-1) {
			X=X+d[i];
			ch[i]='R';
			continue;
		}
		if(gd(num,X-d[i],Y)<=d[i]-1) {
			X=X-d[i];
			ch[i]='L';
			continue;
		}
		if(gd(num,X,Y+d[i])<=d[i]-1) {
			Y=Y+d[i];
			ch[i]='U';
			continue;
		}
		if(gd(num,X,Y-d[i])<=d[i]-1) {
			Y=Y-d[i];
			ch[i]='D';
			continue;
		}
	}
	for(int i=1;i<=m;i++) {
		cout<<ch[i];
	}
	cout<<endl;
}

int main() {
	cin>>n;
	for(int i=1;i<=n;i++) {
		cin>>N[i].x>>N[i].y;
		if(i==1) can=abs(N[i].x+N[i].y)%2;
		if(can!=abs(N[i].x+N[i].y)%2) {
			cout<<-1<<endl;
			return 0;
		}
	}
//	can=can^1;
	m=33-can;
	cout<<m<<endl;
	for(int i=1;i<=32;i++) {
		d[i]=(1ll<<(32-i));
		cout<<d[i]<<" ";
	}
	if(m==33) cout<<1<<endl;
	else cout<<endl;
	for(int i=1;i<=n;i++) {
		solve(i);
	}
}

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

int main(){
  int A,B,T;
  int ans= 0,Time ;

  cin >>A>>B>>T;
  Time = A;
  while(T+0.5 >= Time){
    ans += B;
    Time += A;
  }

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
bool IsPrime(int num){
    if(num<2) return false;
    if(num==2)return true;
    if(num%2==0)return false;
    double sqrt_num = sqrt(num);
    for(int i=3;i<=sqrt_num;i++){
        if(num%i==0) return false;
    }
    return true;
}
int main(){
    int X;
    cin >>X;
    for(int i=X;i<=100003;i++){
        if(IsPrime(i)){
            cout << i<<endl;
            return 0;
        }
    }
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
	 
	static String str;
	
	public static void main(String[] args) {
		Scanner cin=new Scanner(System.in);
		
		str=cin.next();
		StringBuffer sb=new StringBuffer(str);
		int n=cin.nextInt();
		
		for(int i=0;i<n;i++) {
			String odr=cin.next();
			
			if(odr.equals("print")) {
				int a=cin.nextInt(),b=cin.nextInt();
				String printstr=sb.substring(a, b+1);
				System.out.println(printstr);
			}
			else if(odr.equals("reverse")) {
				int a=cin.nextInt(),b=cin.nextInt();
				StringBuffer rsb=new StringBuffer(sb.substring(a, b+1));
				rsb.reverse();
				sb.replace(a, b+1, rsb.toString());
			}
			else if(odr.equals("replace")) {
				int a=cin.nextInt(),b=cin.nextInt();
				String rs=cin.next();
				sb.replace(a, b+1, rs);
			}
		}
	}
	
	
	
}


Measured memory_bytes: 29280
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int cap = scan.nextInt();
        int[] weights = new int[n];
        int[] values = new int[n];

        for(int i = 0 ; i < n ; i++) {
            weights[i] = scan.nextInt();
            values[i] = scan.nextInt();
        }
        System.out.println(helper(0, weights, values, cap, new Long[n+1][cap+1]));
    }
    private static long helper(int index, int[] weights, int[] values, int cap, Long[][] cache){
        long pick = 0;
        if(cache[index][cap] != null) return cache[index][cap];
        if(cap < 0) return 0;
        if(index == weights.length) return 0;
        if(cap >= weights[index]){
            pick = values[index]+helper(index+1, weights, values, cap-weights[index], cache);
        }
        long nopick = helper(index+1, weights, values, cap, cache);
        cache[index][cap] =  Math.max(pick, nopick);
        return cache[index][cap];
    }
}

Measured memory_bytes: 292580
#include <stdio.h>
int main()
{
    int x,n;
    scanf("%d %d",&x,&n);
    if(n%2==0)
    {
        if(n>=(x*2) && n<=(x*4))
            printf("Yes");
        else printf("No");
    }
    else
    {
        printf("No");
    }
    return 0;
}


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

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	int pn = 1;
	if (ci - cn + 16 > cm) {
		if ((ct = getcha()) == '-') { pn = -1; ct = getcha(); }
		A = ct - '0';
		while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';;
		return pn * A;
	}
	else {
		if ((ct = *ci++) == '-') { pn = -1; ct = *ci++; }
		A = ct - '0';
		while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';;
		return pn * A;
	}
}

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


	int N = getint();

	int s1 = 0;
	ll kotae1 = 0;
	int s2 = 0;
	ll kotae2 = 0;
	rep(i, N) {
		int a = getint();
		s1 += a;
		s2 += a;
		if (i & 1) {
			if (s1 <= 0) {
				kotae1 += 1 - s1;
				s1 = 1;
			}
			if (s2 >= 0) {
				kotae2 += s2 + 1;
				s2 = -1;
			}
		}
		else {
			if (s2 <= 0) {
				kotae2 += 1 - s2;
				s2 = 1;
			}
			if (s1 >= 0) {
				kotae1 += s1 + 1;
				s1 = -1;
			}
		}
	}
	co(min(kotae1, kotae2));

	Would you please return 0;
}

Measured memory_bytes: 384
n = int(input())
a = list(map(int, input().split()))

a = sorted(a)

dp  = [0] * (a[-1]+1)

for ai in a:
    if dp[ai]:
        dp[ai] += 1
        continue

    i = 1
    while True:
        if ai*i >= len(dp):
            break
        dp[ai*i] += 1
        i += 1

ans = 0
for ai in a:
    if dp[ai] == 1:
        ans += 1

print(ans)

Measured memory_bytes: 32064
//#include <bits/stdc++.h>
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <iomanip>

using namespace std;

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

    int N; 

    cin >> N;

    if(N % 2 == 0) {
        cout << N / 2 - 1;
    } else {
        cout << N / 2;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

#define ll long long

using namespace std;

int main(){
	int n;
	cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	int ans = 0;
	for (int i = 1; i < n - 1; i++) {
		if ((a[i - 1] < a[i] && a[i] < a[i + 1]) || (a[i - 1] > a[i] && a[i] > a[i + 1])) ans++;
	}
	cout << ans;
}



Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<utility>
#include<numeric>
#include<vector>
#include<map>
#include<unordered_map>
#include<set>
#include<tuple>
#include<stack>
#include<queue>
#include<tuple>
#include<functional>
#include<iterator>
#include<cmath>
#include<cctype>

using namespace std;

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

const int INF = 1e9;
const ll LINF = 1e18;
const int MOD = INF+7;

struct edge{int to,cost;};

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

	int n,a,b;
	cin >> n >> a >> b;

	int tmp,sum,ans=0;
	for(int i=1;i<=n;i++){
		tmp=i;
		sum=0;
		while(tmp>=1){
			sum+=tmp%10;
			tmp/=10;
		}
		if(a<=sum && sum<= b) ans+=i;
	}
	cout << ans << "\n";

	return 0;
}

Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))
x=0
for i in a:
    if i%2==0:
        if i%3==0 or i%5==0:
            x=0
        else:
            x=1
            break
if x==0:
    print('APPROVED')
else:
    print('DENIED')

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
using namespace std;
using ll = long long;

int main() {
    string s;
    ll k;
    cin >> s >> k;
    for (int i = 0; i < min(ll(s.length()), k); ++i) {
        if (s[i] >= '2') {
            cout << s[i] << endl;
            return 0;
        }
    }
    cout << '1' << endl;
}

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

#define int long long
#define endl "\n"
#define REP(i,a,n) for(int i=a;i<n;++i)
#define RUP(a,b) ((a+b-1)/(b))
#define SORTG(v) sort(v.begin(),v.end(),greater<>())
#define SORT(v) sort(v.begin(),v.end())
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define MOD 1000000007
#define INF LLONG_MAX/3

typedef long long ll;
typedef pair<int,int> Pii;
typedef tuple<int,int,int> Tiii;
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef vector<string> Vs;

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;}}
void YesNo(int a) {if(a){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}}
void YESNO(int a) {if(a){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}}
void AorB(int a,string b,string c) {if(a){cout<<b<<endl;}else{cout<<c<<endl;}}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
void start(){cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);}

signed main(){start();
    int n,ans=1;
    string s;
    cin>>n>>s;
    Vi a;
    REP(i,0,n){
        if(s[i]!=s[i+1]) a.pb(1);
        else{
            a.pb(2);
            i++;
        }
    }
    REP(i,0,a.size()){
        if(i==0){
            if(a[i]==1) ans=3;
            else ans=6;
        }else{
            if(a[i]==1 && a[i-1]==1) ans=(ans*2)%MOD;
            if(a[i]==2 && a[i-1]==1) ans=(ans*2)%MOD;
            if(a[i]==2 && a[i-1]==2) ans=(ans*3)%MOD;
        }
    }
    cout<<ans<<endl;
    return 0;
}



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

#define MOD (1000000007LL)

using namespace std;

int parent[100000];
int familysize[100000];
int ans[100000];

int root(int a){
    if(parent[a] == a) return a;
    return parent[a] = root(parent[a]);
}

void unite(int a, int b){
    int ra = root(a);
    int rb = root(b);
    if(ra != rb){
        parent[rb] = ra;
        familysize[ra] += familysize[rb];
    }
}

int main(void){
    int N, M, K;
    cin >> N >> M >> K;
    set<pair<int, int>> frnd, blk;
    for(int i = 0; i < N; i++){
        parent[i] = i;
        familysize[i] = 1;
    }
    for(int i = 0; i < M; i++){
        int A, B;
        cin >> A >> B;
        A--;
        B--;
        if(A < B) swap(A, B);
        frnd.insert(make_pair(A, B));
        unite(A, B);
    }
    for(int i = 0; i < K; i++){
        int A, B;
        cin >> A >> B;
        A--;
        B--;
        if(A < B) swap(A, B);
        auto itr = frnd.find(make_pair(A, B));
        if(itr == frnd.end()){
            blk.insert(make_pair(A, B));
        }
    }

    for(int i = 0; i < N; i++) ans[i] = familysize[root(i)];
    
    for(auto itr = frnd.begin(); itr != frnd.end(); itr++){
        ans[itr -> first] --;
        ans[itr -> second] --;
    }

    for(auto itr = blk.begin(); itr != blk.end(); itr++){
        if(root(itr -> first) == root(itr -> second)){
            ans[itr -> first] --;
            ans[itr -> second] --;
        }
    }

    for(int i = 0; i < N; i++) cout << ans[i] - 1 << endl;

    return 0;
}


Measured memory_bytes: 12160
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		String str1 = s.nextLine();
		StringBuffer strbRevese = (new StringBuffer(s.nextLine())).reverse();
		String strReverse = strbRevese.toString();
		if (str1.equals(strReverse)) {
			System.out.println("YES");
		}else{
			System.out.println("NO");
		}
		
	}
}


Measured memory_bytes: 21844
N = int(input())
H = [int(_) for _ in input().split()]

H.append(10**9+1)
cnt = 0
res = 0
for i in range(N):
    if H[i] >= H[i+1]:
        cnt += 1
    else:
        res = max(res,cnt)
        cnt = 0
print(res)

Measured memory_bytes: 14252
#include <bits/stdc++.h>
using namespace std;
int main () {
	int a,b;
	cin >> a >> b;
	if((a + b) % 2 == 1){
		cout << (int)((a + b)/2) + 1 << endl;
	}else{
		cout << (a + b)/2 << endl;
	}
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
#define ll long long

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  string s; cin >> s;
  vector<string> mm{"01","02","03","04","05","06","07","08","09","10","11","12"};
  string a = s.substr(0,2);
  string b = s.substr(2,2);
  bool is_mmyy = (find(mm.begin(),mm.end(),a) != mm.end());
  bool is_yymm = (find(mm.begin(),mm.end(),b) != mm.end());
  if (is_mmyy && !is_yymm) cout << "MMYY" << endl;
  else if (!is_mmyy && is_yymm) cout << "YYMM" << endl;
  else if (is_mmyy && is_yymm) cout << "AMBIGUOUS" << endl;
  else cout << "NA" << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String[] args) {  
  		Scanner sc = new Scanner(System.in);
		int price = sc.nextInt();
      	int moneyHold = sc.nextInt();
      	int satisNum = sc.nextInt();
      	int counter = 0;
      	
      	if(moneyHold < price) {
        	System.out.println(0);  
        } else {
        	if(moneyHold >= price * satisNum) {
            	System.out.println(satisNum); 
            } else {
              	for(int i = price; i <= moneyHold; i += price) {
                	counter++;
                }
            	System.out.println(counter);  
            }
        }
    }
}

Measured memory_bytes: 21716
#include <bits/stdc++.h>
using namespace std;
#define N_MAX 100005
#define NIL -1

struct Node {
    long parent;
    long left;
    long right;
};

struct Node T[N_MAX];
long n;
long D[N_MAX];

void print(long i) {
    cout << "node " << i << ": ";

    cout << "parent = " << T[i].parent << ", ";

    cout << "depth = " << D[i] << ", ";

    if (T[i].parent == NIL) {
        cout << "root, ";
    }
    else if (T[i].left == NIL) {
        cout << "leaf, ";
    }
    else {
        cout << "internal node, ";
    }

    cout << "[";
    long j = T[i].left;
    while (j != NIL) {
        cout << j;
        j = T[j].right;
        if (j != NIL) {
            cout << ", ";
        }
    }
    cout << "]";

    cout << endl;
}

void setDepth(long id, long d) {
    D[id] = d;
    if (T[id].right != NIL) {
        setDepth(T[id].right, d);
    }
    if (T[id].left != NIL) {
        setDepth(T[id].left, d + 1);
    }
}

int main() {
    cin >> n;
    for (long i = 0; i < n; i++) {
        T[i].parent = NIL;
        T[i].left = NIL;
        T[i].right = NIL;
    }

    long id, k, c, sel;
    for (long i = 0; i < n; i++) {
        cin >> id >> k;
        if (k != 0) {
            sel = id;
            for (long j = 0; j < k; j++) {
                cin >> c;
                if (j == 0) {
                    T[sel].left = c;
                }
                else {
                    T[sel].right = c;
                }
                T[c].parent = id;
                sel = c;
            }
        }
    }

    long id_root;
    for (long i = 0; i < n; i++) {
        D[i] = 0;
    }
    for (long i = 0; i < n; i++) {
        if (T[i].parent == NIL) {
            id_root = i;
            break;
        }
    }
    setDepth(id_root, 0);

    for (long i = 0; i < n; i++) {
        print(i);
    }
}



Measured memory_bytes: 9264
#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;
  vector<vector<int>> a(n, vector<int>(3));
  vector<vector<ll>> dp(n, vector<ll>(3));
  rep(i,n)rep(j,3) cin >> a[i][j];
  rep(i,3) dp[0][i] = a[0][i];
  for(int i=0; i<n-1; ++i) {
    for(int j=0; j<3; ++j) {
      for(int k=0; k<3; ++k) {
        if (j == k) continue;
        dp[i+1][k] = max(dp[i+1][k], dp[i][j]+a[i+1][k]);
      }
    }
  } 
  ll ans = 0;
  rep(i,3) ans = max(ans, dp[n-1][i]);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 13964
#include <stdio.h>

int main(void)
{
	int A[99][99] = { 0 }, i, j, N, t;
	char s, F[5] = "SHCD";

	scanf("%d\n", &N);

	for (i = 0; i < N; A[s][t] = 1, i++)
		scanf("%c %d\n", &s, &t);

	for (i = 0; i < 4; i++)
		for (j = 1; j < 14; j++)
			if (!A[F[i]][j])
				printf("%c %d\n", F[i], j);

	return 0;
}

Measured memory_bytes: 648
#include<iostream>
#include<algorithm>
#include<cstring>
#include<stack>
using namespace std;
typedef long long ll;
#define N 1005

int main(){
    string s;
    int n,a=0,b=0,c=0,d=0;
    cin>>n;
    while(n--){
        cin>>s;
        if(s[0]=='A')
            a++;
        else if(s[0]=='W')
            b++;
        else if(s[0]=='T')
            c++;
        else
            d++;
    }
    cout<<"AC x "<<a<<endl;
    cout<<"WA x "<<b<<endl;
    cout<<"TLE x "<<c<<endl;
    cout<<"RE x "<<d<<endl;
    
    return 0;
}


Measured memory_bytes: 3640
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#define rep(i,e)for(int i=0;i<e;i++)
#define PI acos(-1)
using namespace std;
#define toLower(str)transform(str.begin(),str.end(),str.begin(),::tolower)

int main(){
    int i, j;
    string w, t;
    int count=0;
    cin >> w;
    while(1){
        cin >> t;
        if(t=="END_OF_TEXT")break;
        toLower(t);
        if(t==w)count++;
    }
    cout << count << endl;
    return 0;
}


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

int main(){
  int n,k,p,ans=0,sum=0;
  cin>>n>>k;

  while(n!=0&&k!=0){
    vector<int> v;
    for(int i=0;i<n;i++){
      cin>>p;
      v.push_back(p);
    }
    for(int i=0;i<=n-k;i++){
      for(int j=0;j<k;j++){
        sum+=v[i+j];
      }
      if(sum>=ans){
        ans=sum;
      }
      sum=0;
    }
    cin>>n>>k;
    cout<<ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 3492
#include <cstdio>
#include <algorithm>
using namespace std;

int memo[101][10001],v[1001],w[1001];

int dp(int i,int j){
    if(i == 0)  return 0;
    if(memo[i][j] >= 0) return memo[i][j];
    if(j - w[i-1] < 0)  return memo[i][j] = dp(i-1,j);
    return  memo[i][j] = max(dp(i-1,j),dp(i-1,j-w[i-1]) + v[i-1]);
}

int main(){
    for(int i = 0;i < 101;i++)
        for(int j =0;j < 10001;j++)
           memo[i][j] = -1; 
    int N,W;
    scanf("%d%d",&N,&W);
    for(int i = 0;i <N;i++)
        scanf("%d%d",&v[i],&w[i]);
    dp(N,W);
    printf("%d\n",dp(N,W));

    return 0;
}


Measured memory_bytes: 6684
def roll_positive(list_a: list, list_b: list) -> list:
    list_a = list_a[1:] + list_a[0:1]  # Roll one unit in the positive direction.
    list_b[0] = list_a[0]  # Change the bottom face.
    list_b[2] = list_a[2]  # Change the top face.
    return [list_a, list_b]


def roll_negative(list_a: list, list_b: list) -> list:
    list_a = list_a[3:] + list_a[0:3]
    list_b[0] = list_a[0]  # Change the bottom face.
    list_b[2] = list_a[2]  # Change the top face.
    return [list_a, list_b]


if __name__ == "__main__":
    faces_int = list(map(lambda x: int(x), input().split()))  # 1,2,3,4,5,6
    SN_direction = [faces_int[5], faces_int[4], faces_int[0], faces_int[1]]  # 6,5,1,2
    WE_direction = [faces_int[5], faces_int[2], faces_int[0], faces_int[3]]  # 6,3,1,4
    commands = input()

    for command in commands:
        if ("N" == command):
            SN_direction, WE_direction = roll_positive(SN_direction, WE_direction)
        elif ("S" == command):
            SN_direction, WE_direction = roll_negative(SN_direction, WE_direction)
        elif ("E" == command):
            WE_direction, SN_direction = roll_positive(WE_direction, SN_direction)
        else:
            WE_direction, SN_direction = roll_negative(WE_direction, SN_direction)

    print(f"{SN_direction[2]}")  # Print the opposite face of the bottom.



Measured memory_bytes: 5624
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define IFOR(i, m, n) for (ll i = n - 1; i >= m; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define FOREACH(x, a) for (auto&(x) : (a))
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ll(x.size())

int main() {
  string s;
  cin >> s;
  ll n = SZ(s);
  ll ans = 1e18;
  REP(t, 2) {
    ll cnt = 0;
    REP(i, n) {
      ll x = s[i] - '0';
      if (x == (i + t) % 2) cnt++;
    }
    ans = min(ans, cnt);
  }
  cout << ans << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define INF 0x3f3f3f3f 
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)
#define ll long long int
#define pi 3.14159265358979
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define PI 3.1415926535897932384626
#define minn INT_MAX
#define maxx INT_MIN
#define fori(i, n) for (i = 0; i < n; i++)
typedef pair<int, int>  pii;
typedef vector<int>   vi;
typedef vector<pii>   vpii;
typedef vector<vi>    vvi;

 
 
int main() {
  #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
  #endif
  int d,t,c;
  cin>>d>>t>>c;
  if(c*t>=d)
    cout<<"Yes";
  else
    cout<<"No";
  return 0;
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
#define vll vector<ll>
#define vi vector<int>
#define vpll vector<pair<ll,ll>>
#define pii pair<int,int>
#define REP(i,a) for(int (i)=0; (i)<(a); (i)++)
#define RREP(i,a) for(int (i)=a-1; (i)>=(0); (i)--)
#define REP2(i,a,b) for(int (i)=(a); (i)<(b); (i)++)
#define MOD 1000000007
#define ALL(v) v.begin(), v.end()
#define m0(x) memset(x,0,sizeof(x))
typedef long long ll;

using namespace std;

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int A[3][3];
  REP(i,3)REP(j,3){
    cin >> A[i][j];
  }
  int N;
  cin >> N;
  int b[N];
  REP(i,N){
     cin >> b[i];
     REP(k,3)REP(l,3){
       if(A[k][l]==b[i]) A[k][l] = -1;
     }
  }
  bool ans = false;
  REP(i,3) if(A[i][0] + A[i][1] + A[i][2] == -3) ans = true;
  REP(i,3) if(A[0][i] + A[1][i] + A[2][i] == -3) ans = true;
  if(A[0][0] + A[1][1] + A[2][2] == -3) ans = true;
  if(A[2][0] + A[1][1] + A[0][2] == -3) ans = true;
  if(ans) cout << "Yes";
  else cout << "No";

  return 0;
}


Measured memory_bytes: 256
s = input()
n = len(s)

def dfs(tmp, s):
    if len(s) == 1:
        return int(tmp)+int(s)+int(tmp+s)
    
    return int(tmp)*2**(len(s)-1)+dfs(s[0], s[1:]) + dfs(tmp+s[0], s[1:])

if n > 1:
    print(dfs(s[0], s[1:]))
else:
    print(int(s))

Measured memory_bytes: 3064
import math
n=int(input())
factors=[]
n1=n
p=2
while p<=math.sqrt(n):
    if n%p==0:
        n//=p
        factors.append(str(p))
    else:
        p+=1
if n!=1:
    factors.append(str(n))
print(str(n1)+": "+" ".join(factors))


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

const int N=5e3+5;
string s;
string a[N*5];
int n,k;

bool cmp(const string &x,const string &y){
	for(register int i=0;i<(int)min(x.size(),y.size());i++)
	{
		if(x[i]<y[i]) return true;
		if(x[i]>y[i]) return false;
	}
	return x.size()<y.size();
}
bool operator ==(const string &x,const string &y){
	if(x.size()!=y.size()) return false;
	for(register int i=0;i<(int)x.size();i++)
		if(s[i]!=y[i]) return false;
	return true;
}

signed main()
{
	cin>>s>>k,n=0;
	for(register int i=0;i<(int)s.size();i++)	
		for(register int j=1;j<=5;j++)
			a[++n]=s.substr(i,j);
	sort(a+1,a+1+n,cmp);
	n=unique(a+1,a+1+n)-a-1;
	cout<<a[k]<<endl;
	return 0;
}

Measured memory_bytes: 1664
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<numeric>
#include<utility>
#include<queue>

using namespace std;

typedef long long int ll;
const int INF = 1<<30;
const long long LINF = 1LL<<60;

int main(){
    ll n;
    cin >> n;
    vector<vector<pair<ll, ll>>> e(n);
    vector<pair<ll, ll>> e2(n - 1);
    vector<pair<ll, ll>> c(n);
    for(ll i = 0; i < n; i++){
        c[i].second = i;
    }
    for(ll i = 0; i < n - 1; i++){
        ll x, y;
        cin >> x >> y;
        x--; y--;
        e2[i] = make_pair(x, y);
        c[x].first++;
        c[y].first++;
    }
    for(int i = 0; i < n - 1; i++){
        ll x = e2[i].first, y = e2[i].second;
        e[x].push_back(make_pair(c[y].first, y));
        e[y].push_back(make_pair(c[y].first, x));
    }
    for(int i = 0; i < n; i++){
        sort(rbegin(e[i]), rend(e[i]));
    }
    sort(rbegin(c), rend(c));
    vector<ll> d(n);
    for(ll i = 0; i < n; i++){
        cin >> d[i];
    }
    vector<ll> s(n, -1);
    sort(rbegin(d), rend(d));
    s[c[0].second] = d[0];
    queue<ll> q;
    q.push(c[0].second);
    int cnt = 1;
    while(!q.empty()){
        ll t = q.front();
        q.pop();
        for(int i = 0; i < e[t].size(); i++){
            ll to = e[t][i].second;
            if(s[to] == -1){
                s[to] = d[cnt];
                cnt++;
                q.push(to);
            }
        }
    }
    ll ans = 0;
    for(ll i = 0; i < n - 1; i++){
        ans += min(s[e2[i].first], s[e2[i].second]);
    }
    cout << ans << endl;
    cout << s[0];
    for(ll i = 1; i < n; i++){
        cout << " " << s[i];
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, from, to) for (int i = from; i < (to); ++i)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
using ll = long long;
using vin=vector<int>;
using vll=vector<ll>;
using P = pair<int, int>;
const int inf=1e9+7;
const ll INF=1e18;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

int main() {
  int n;
  cin>>n;
  string s;
  cin>>s;
  vin c(n);
  rep(i,1,n){
    c[i]=c[i-1];
   if(s[i-1]=='E'){
    c[i]++; 
   }
    //cout<<c[i]<<endl;
  }
  int ans=inf;
  rep(i,0,n){
    int cnt=0;
    cnt+=i-c[i];
    //if(i==8) cout<<cnt<<endl;
    cnt+=c[n-1]-c[i];
    if(s[n-1]=='E') cnt++;
    if(s[i]=='E') cnt--;
    ans=min(ans,cnt);
    
  }
  cout<<ans<<endl;
}

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

using namespace std;

int n,dp[100100],p[100100],k;

void mini(int &a, int b) {
	a = min(a, b);
}

int main() {
	
	scanf("%d %d", &n, &k);
	
	dp[0] = 0;
	
	for(int i = 0; i < n; i++) {
		scanf("%d", &p[i]);
		
		if(!i) continue;
		dp[i] = 1e9;
		for(int j = i - 1;j >= i - k&&j >= 0; j--) {
			mini(dp[i],dp[j] + abs(p[j] - p[i]));
		}
	}
	
	printf("%d",dp[n - 1]);
	
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#define REP(i, a, n) for(int i = ((int) a); i < ((int) n); i++)
#define MOD 1000000007
using namespace std;
typedef long long ll;

int N, A[100010];
ll fact[1000010];

ll pow_mod(ll a, ll b) {
  ll x = 1, y = a;
  while(b > 0) {
    if(b % 2) x = (x * y) % MOD;
    y = (y * y) % MOD;
    b /= 2;
  }
  return x % MOD;
}

ll mod_inv(ll n) {
  return pow_mod(n, MOD - 2);
}

ll comb_mod(ll n, ll k) {
  return (fact[n] * mod_inv(fact[k]) % MOD) * mod_inv(fact[n - k]) % MOD;
}

int main(void) {
  cin >> N;
  REP(i, 0, N + 1) cin >> A[i];

  int s;
  int pos[100010];
  REP(i, 0, N + 1) pos[i] = -1;
  REP(i, 0, N + 1) {
    if(pos[A[i]] == -1) pos[A[i]] = i;
    else s = pos[A[i]] + (N - i);
  }

  fact[0] = 1;
  REP(i, 1, 100010) fact[i] = (fact[i - 1] * i) % MOD;

  cout << N << endl;
  REP(i, 2, N + 2) cout << (comb_mod(N + 1, i) - (i - 1 <= s ? comb_mod(s, i - 1) : 0) + MOD) % MOD << endl;

  return 0;
}


Measured memory_bytes: 4480
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, m, n) for(int i = (int)(m); i < (int)(n); ++i)


int main()
{
    int N;
    cin >> N;
    int n = (1<<N);
    vector<int> S(n);
    REP(i, n) cin >> S[i]; 

    sort(S.begin(), S.end(), greater<int>());

    // check し終わったスライムを大きい順に入れる
    vector<int> s{S[0]};
    S[0] = -1;

    REP(i, N){ // 世代ごとに見ていく
        vector<int> tmp = s;
        sort(tmp.begin(), tmp.end()); // 大きい順に貪欲していけば良い
        int idx = 0;
        while(tmp.size() > 0 and idx < n){
            if(S[idx] == -1){
                ++idx;
                continue;
            }
            if(S[idx] < tmp.back()){
                s.push_back(S[idx]);
                tmp.pop_back();
                S[idx] = -1;
            }
            ++idx;
        }
        if(tmp.size() > 0){
            puts("No");
            return 0;
        }
    }
    cout << "Yes" << endl;
    
    return 0;
}

Measured memory_bytes: 2932
using System;

public class Test
{
	public static void Main()
	{
            string[] data;
            int x=0, y=0;
            while (true)
            {
                data = Console.ReadLine().Split();
                x = int.Parse(data[0]);
                y = int.Parse(data[1]);
                if (x == 0 && y == 0)
                {
                    break;
                }
                else
                {
                    if (x < y)
                    {
                        Console.WriteLine("{0} {1}",x,y);
                    }
                    else
                    {
                        Console.WriteLine("{0} {1}",y,x);
                    }
                }
            }
	}
}

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

typedef long lint;
typedef long long llint;

// static const int MAX = 1e6;
// static const int NIL = -1;
// static const ll INF = 1<<21;
// static const ll MOD = 1e9 + 7;

bool compPair(const pair<int, int>& arg1, const pair<int, int>& arg2) { return arg1.first > arg2.first; }
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; } }


int main(void) {
    double r;
    cin >> r;

    cout << 2*3.1415926535*r << endl;
    return 0;
}


Measured memory_bytes: 3788
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i,n) for (int i = 0; i < (n); ++i)
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;
const int inf=(1<<30)-1;
const int mod=1e9+7;
int dx[8]={1,0,-1,0,-1,-1,1,1};
int dy[8]={0,1,0,-1,-1,1,-1,1};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;cin >> n;
    vector<int> a(n),b(1000001);
    vector<bool> p(1000001,true);
    rep(i,n){
        cin >> a[i];
        b[a[i]]++;
    }
    for(int i=1;i<=1000000;i++){
        if(!p[i]||!b[i]){
            continue;
        }
        for(int j=2;j*i<=1000000;j++){
            p[i*j]=false;
        }
    }
    int ans=0;
    rep(i,n){
        if(b[a[i]]==1&&p[a[i]]){
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 8244
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();
// freopen("input.txt", "r", stdin);


int main() {
    int n, m, x;
    cin >> n >> m >> x;
    vector<vector<int>> mat(n, vector<int>(m, 0));
    vector<int> price(n, 0);
    for(int i = 0; i < n; i++) {
        cin >> price[i];
        for(int j = 0; j < m; j++) {
            cin >> mat[i][j];
        }
    }
    ll ans = INT_MAX;
    for(int state = 0; state < (1<<n); state++) {
        vector<int> crita(m, 0);
        ll p = 0;
        for(int i = 0; i < n; i++) {
            if ((state >> i)&1) {
                for(int j = 0; j < m; j++) {
                    crita[j] += mat[i][j];
                }
                p += price[i];
            }
        }
        int cnt = 0;
        for(int j = 0; j < m; j++) {
            if (crita[j] >= x)
                cnt += 1;
        }
        if (cnt == m)
            ans = min(ans, p);
    }
    if (ans == INT_MAX)
        cout << -1 << endl;
    else
        cout << ans << endl;
    return 0;
}



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

using namespace std;

int main() {
	int r, d, x;
	scanf("%d%d%d", &r, &d, &x);
	
	for (int i = 0; i < 10; i++) {
		x = r * x - d;
		printf("%d\n", x);
	}
}


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

using namespace std;

int main()
{

    int n,k;
    cin >> n  >> k;
    int a[n],temp =n,i=0,sum=0;
    while(temp--)
    {
        cin >> a[i];
        i++;
    }
    sort(a,a+n);
    for(i=0;i<k;i++)
    {
        sum+= a[i];
    }
    cout << sum;
    return 0;

}


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


int n;
int dp[100010][3];
int v[100010][3];


int main(){

    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> v[i][0] >> v[i][1] >> v[i][2];
    }

    dp[0][0] = v[0][0]; dp[0][1] = v[0][1]; dp[0][2] = v[0][2];

    for(int i = 1; i < n; i++){
        for(int j = 0; j < 3; j++){
            for(int k = 0; k < 3; k++){
                if(j == k) continue;

                dp[i][j] = max(v[i][j] + dp[i-1][k], dp[i][j]);
            }
        }
    }

    int ans = -1;

    for(int i = 0; i < 3; i++){
        ans = max(ans, dp[n-1][i]);
    }

    cout << ans << endl;

    return 0;
}

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

/*
絶対どこかでループになる
しかもループは一つ
だから行ったかどうかのflagを作って、flagが立ってるのにまた来たらvectorにつっこむ
*/

int	main(void)
{
	vector<int> normal;
	vector<int> loop;
	long long n, k;
	cin >> n >> k;
	int a;
	vector<int> next(n);
	for (int i = 0; i < n; i++)
	{
		cin >> a; a--;
		next[i] = a;
	}
	vector<bool> is_visit(n, false);
	vector<bool> is_double_visit(n, false);
	int now = 0;
	while (1)
	{
		if (is_double_visit[now]) break;
		if (is_visit[now]) 
		{
			loop.push_back(now);
			is_double_visit[now] = true;
		}
		else normal.push_back(now);
		is_visit[now] = true;
		now = next[now];
	}
	if (k < normal.size()) cout << normal[k] + 1 << endl;
	else cout << loop[(k - normal.size()) % loop.size()] + 1 << endl;
	return (0);
}


Measured memory_bytes: 6468
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define INF 2e9
#define MOD 1e9+7
#define ALL(v) v.begin(), v.end()

int ni() {
    int i;
    cin >> i;
    return i;
}

int main()
{
    ll N, K;
    cin >> N >> K;

    map<ll, ll> count;
    REP(i, N) {
        count[ni()]++;
    }

    vector<ll> v;
    for (auto itr=count.begin(); itr != count.end(); itr++) {
        v.push_back(itr->second);
    }
    sort(ALL(v));

    ll ans = 0;
    REP(i, (ll)v.size() - K) {
        ans += v[i];
    }

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

Measured memory_bytes: 14964
n,k=map(int,input().split())
a=[]
def x(t,k):
  c=0
  while t<k:
    t*=2
    c+=1
  return c

for i in range(n):
  a.append(x(i+1,k))

ans=0
for i in range(n):
  ans=ans+1/n*(1/2)**a[i]
print(ans)


Measured memory_bytes: 3864
k = int(input())
lst = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(lst[k-1])

Measured memory_bytes: 3060
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
const ll INF = 1LL << 60;
const ll MOD = 1000000007;
template <class T>
bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}

int main() {
    int r;
    cin >> r;
    cout << 3 * r * r << "\n";
    return 0;
}

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

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int[] A = new int[N];
        for (int i = 0; i < A.length; ++i) {
            A[i] = sc.nextInt();
        }

        System.out.println(solve(A));

        sc.close();
    }

    static int solve(int[] A) {
        Set<Integer> written = new HashSet<>();
        for (int Ai : A) {
            if (written.contains(Ai)) {
                written.remove(Ai);
            } else {
                written.add(Ai);
            }
        }

        return written.size();
    }
}

Measured memory_bytes: 53824
#include<bits/stdc++.h>
#define N 500005
using namespace std;
int n,K,x,y,kk,ans,t,opt,head[N];
struct Tree{int nxt,to,from;}e[N];
inline void add(int x,int y){e[++kk].nxt=head[x];e[kk].from=x;e[kk].to=y;head[x]=kk;}
void dfs(int u,int fa,int dep){
    if (dep>K) return;t++;
    for (int i=head[u];i;i=e[i].nxt){
        int v=e[i].to;
        if (v==fa) continue;
        dfs(v,u,dep+1);
    }
}
inline void sc(int x){
    t=0;dfs(x,-1,0);ans=min(ans,n-t);
}
inline void sc1(int x){
    t=0;dfs(e[x].to,e[x].from,0);
    dfs(e[x].from,e[x].to,0);
    ans=min(ans,n-t);
}
int main(){
    scanf("%d%d",&n,&K);
    int opt=(K&1);
    if (K%2==0) K/=2;
    else K=(K-1)/2;
    for (int i=1;i<n;i++){
        scanf("%d%d",&x,&y);
        add(x,y);add(y,x);
    }
    ans=1e9;
    if (!opt) for (int i=1;i<=n;i++) sc(i);
    if (opt) for (int i=1;i<=kk;i+=2) sc1(i);
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 2432