akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define all(v) v.begin(),v.end()
using namespace std;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,x[105],ans=100000000;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>x[i];
    }
    for(int i=1;i<=100;i++){
        int sum=0;
        for(int j=0;j<n;j++){
            sum+=abs(i-x[j])*abs(i-x[j]);
        }
        if(ans>sum){
            ans=sum;
        }
    }
    cout<<ans<<endl;
    return(0);
}


Measured memory_bytes: 3652
def rm_123(A):
	if len(A) == 0: return 1
	for a in set(A):
		if set([a,a+1,a+2]) <= set(A):
			if len(A) == 3: return 1
			A1 = A[:]
			for i in range(3): A1.remove(a+i)
			return judge(A1)

def rm_111(A):
	if len(A) == 0: return 1
	for a in set(A):
		if A.count(a) >= 3:
			if len(A) == 3: return 1
			A1 = A[:]
			for i in range(3): A1.remove(a)
			return judge(A1)

def judge(A):
	return rm_123(A) or rm_111(A)
	
for _ in range(input()):
	n = map(int,raw_input().split())
	R = []; G = []; B = []
	s = raw_input().split()
	for i in range(len(n)):
		if   s[i] == "R": R.append(n[i])
		elif s[i] == "G": G.append(n[i])
		elif s[i] == "B": B.append(n[i])
	print 1 if judge(R) and judge(G) and judge(B) else 0
	

Measured memory_bytes: 4280
#include<bits/stdc++.h>
using namespace std;
using I = long long;
struct Point {I x, y, z;};
int main() {
  I N, M;
  cin >> N >> M;
  vector<Point> P(N);
  for(auto& p: P) cin >> p.x >> p.y >> p.z;
  auto sum = [](auto p, auto x, auto y, auto z) {
    return p.x * x + p.y * y + p.z * z;
  };
  I ans = 0;
  for(I x: {1, -1}) for(I y: {1, -1}) for(I z: {1, -1}) {
    sort(begin(P), end(P), [&](auto l, auto r) {return sum(l, x, y, z) > sum(r, x, y, z);});
    I a = 0, b = 0, c = 0;
    for(auto i=0; i<M; ++i) {
      a += P[i].x * x;
      b += P[i].y * y;
      c += P[i].z * z;
    }
    ans = max(ans, abs(a) + abs(b) + abs(c));
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
use proconio::input;

fn main() {
    input! {
        n: usize,
        m: usize,
        k: u64,
        a: [u64;n],
        b: [u64;m]
    }

    let mut a: Vec<u64> = a.iter().scan(0, |acc, v| {
        *acc += v;
        Some(*acc)
    }).filter(|v| *v <= k).collect();
    a.insert(0,0);

    let mut b: Vec<u64> = b.iter().scan(0, |acc, v| {
        *acc += v;
        Some(*acc)
    }).collect();
    b.insert(0,0);
    b.reverse();

    let mut cnt = 0;
    let mut j = 0;
    for i in 0..a.len() {
        while j < b.len() {
            if k >= a[i] + b[j] {
                cnt = std::cmp::max(cnt, i + (b.len() - j - 1));
                break;
            }
            j += 1;
        }
    }
    println!("{}", cnt);
}


Measured memory_bytes: 11124
S = list(input())

flag = 0
flag2 = 0

for i in range(len(S)):
  if i == 0:
    if S[i] != "A":
      print("WA")
      flag2 = 1
      break
  elif i == 1:
    if ord(S[i]) >= 65 and ord(S[i]) <= 90:
      print("WA")
      flag2 = 1
      break
  elif i >= 2 and i <= len(S) - 2:
    if ord(S[i]) >= 65 and ord(S[i]) <= 90:
      if flag == 0:
        if S[i] == "C":
          flag = 1
        else:
          print("WA")
          flag2 = 1
          break
      else:
        print("WA")
        flag2 = 1
        break
  else:
      if ord(S[i]) >= 65 and ord(S[i]) <= 90:
        print("WA")
        flag2 = 1
        break

if flag == 1 and flag2 == 0:
  print("AC")
elif flag == 0 and flag2 == 0 :
  print("WA")


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

using namespace std;
typedef long long ll;

int match_num[10] = {1<<30,2,5,5,4,5,6,3,7,6};
string num_string[10] = {"0","1","2","3","4","5","6","7","8","9"};
string dp[12500] = {};

string calc_bigger(const string &a, const string &b) {
    if(a.size()==b.size()) {
        for(int i = 0; i < a.size(); i++) {
            if(a[i]!=b[i]) {
                return (a[i]>b[i])?a:b;
            }
        }
        return a;
    }
    return (a.size()>b.size())?a:b;
}

int main() {
    int n,m;
    cin >> n >> m;
    vector<int> cda;
    for(int i = 0; i < m; i++) {
        int a;
        cin >> a;
        cda.push_back(a);
        dp[match_num[a]] = calc_bigger(dp[match_num[a]],num_string[a]);
    }
    for(int i = 0; i < n; i++) {
        if(dp[i].size()==0) continue;
        for(int j = 0; j < m; j++) {
            dp[i+match_num[cda[j]]] = calc_bigger(dp[i+match_num[cda[j]]],num_string[cda[j]]+dp[i]);
        }
    }
/*
    for(int i = 0; i <= n; i++) {
        cout << dp[i] << endl;
    }
*/
    cout << dp[n] << endl;
}

Measured memory_bytes: 32512
s = input()
MOD = 10**9 + 7
memo = [0]*13
memo[0] = 1

c = 1
for d in reversed(s):
    if d == '?':
        nmemo = [0]*13
        for i in range(10):
            r = (i*c)%13
            for j in range(13):
                nmemo[(j+r)%13] += memo[j]
        for i in range(13):
            nmemo[i] %= MOD
        memo = nmemo
    else:
        d = (-int(d)*c)%13
        memo = memo[d:] + memo[:d]

    c *= 10
    c %= 13
print(memo[5])

Measured memory_bytes: 45420
from bisect import bisect_right

N, D, A = map(int, input().split())
M = []
for i in range(N):
  x, h = map(int, input().split())
  M.append((x, -(-h//A)))
M.sort(key=lambda x: x[0])
X = list(map(lambda x: x[0], M))
H = list(map(lambda x: x[1], M))

dmg = [0] * (N+1)
ans = 0

for i in range(N):
  x, h = M[i]
  h = max(0, h - dmg[i])
  dmg[i] += h
  dmg[bisect_right(X, x + 2*D)] -= h
  dmg[i+1] += dmg[i]
  ans += h
print(ans)

Measured memory_bytes: 88884
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <numeric>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <time.h>

using namespace std;
typedef long long ll;
#define pl pair<ll,ll>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define foreach(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); itr++)
#define dbg(x) cout << #x"="<< (x) << endl
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back(a) 
#define in(x) cin >> x;
#define all(x) (x).begin(), (x).end()
#define INF 2147483600
#define fi first
#define se second

int main(){
	ll n;
	cin>>n;
	ll ans=n;
	rep(i,sqrt(n)+1){
		if(n%(i+1)==0){
			ans=n/(i+1);
		}
	}
	ll keta=0;
	while(ans){
		ans/=10;
		keta++;
	}
	cout<<keta<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#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 SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())//vectorの降順ソート
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;

typedef tuple<ll, ll, ll> T;

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

string MINUSINF = "-";
long long match[10] = {2,5,5,4,5,6,3,7,6};
string dp[11000];

void chmax(string &a, string b){
    if(a == MINUSINF) a=b;
    else if(a.size() < b.size()) a=b;
    else if(a.size()==b.size()){
        if(a<b) a=b;
    }
}
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,m;cin>>n>>m;
    vector<int> a(m);
    REP(i,m)cin>>a[i];
    REP(i,11000) dp[i]=MINUSINF;
    dp[0]="";
    for(int i=0;i<=n;i++){
        if(dp[i] == MINUSINF) continue;
        for(auto b : a) chmax(dp[i+match[b-1]], dp[i] + (char)('0' + b));
    }
    cout<<dp[n]<<endl;
}

Measured memory_bytes: 43776
#define _CRT_SECURE_NO_WARNINGS

#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_set>
#include <unordered_map>
#include <array>
#include <cassert>
#include <bitset>
#include <cstdint>
using namespace std;
using LL = long long;



int main() {
	int N;
	cin >> N;
	vector<int>a, d;
	for (int i = 0; i < N; ++i) {
		int tmp; cin >> tmp;
		a.push_back(tmp);
	}
	for (int i = 1; i < N; ++i) {
		d.push_back(a[i] - a[i - 1]);
	}
	for (int i = N - 2; i >= 1; --i) {
		if (d[i] < 0) {
			d[i]++;
			d[i - 1]--;
		}
	}
	for (int i = 0; i < N - 1; ++i) {
		if (d[i] < 0) {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 1400
/* -*- C -*- */

#include <stdio.h>

int main()
{
	int a,b,keep;
    while(1){
        scanf("%d %d",&a,&b);
		if (a == 0 && b == 0) break;
        if( a > b){
            keep = a;
            a = b;
            b = keep;
        }
            printf("%d %d\n",a,b);
    }
    return 0;
}


Measured memory_bytes: 1972
#include <bits/stdc++.h>
#define FIXED_FLOAT(x)  std::fixed <<std::setprecision(7)<<(x)
#define all(v) (v).begin(), (v).end()
using namespace  std;

using ll = long long;
const int mod = 1e9+7;
typedef pair<int , int> pairs;
typedef complex<ll> G;


const int INF = 1e9+2;
const int SIZE = 200000;
int p[SIZE];
int ans[SIZE][2];
int ans_cnt;
bool judge(int a[], int n){
    static int used[SIZE+1];
    for(int i = 1; i <= n; i++) used[i] = 0;
    for(int i = 0; i < n; i++) used[a[i]] = 1;
    for(int i = 1; i <= n; i++) {
        if(!used[i]) return 0;
    }
    return 1;
}
bool judge(int len1, int n){
    return judge(p, len1) && judge(p + len1, n - len1);
}
int power(int a,int b){
    if(!b)
        return 1;
    int c=power(a,b/2);
    c=(1LL*c*c)%mod;
    if(b%2)
        c=(1LL*c*a)%mod;
    return c;
}
int mark[1002][1002];
void  done() {
    bool flag=1;
    int h,w,r,tot=0,ans;
    scanf("%d %d",&h,&w);
    for(int i=0;i<h;++i){
        scanf("%d",&r);
        tot+=r;
        for(int j=0;j<r;++j)
            mark[i][j]=1;
        if(r<w){
            mark[i][r]=-1;
            tot++;
        }
    }
    for(int i=0;i<w;++i){
        scanf("%d",&r);
        for(int j=0;j<r;++j){
            if(!mark[j][i]){
                mark[j][i]=1;
                tot++;
            }
            else if(mark[j][i]==-1)
                flag=0;
        }
        if(r<h){
            if(!mark[r][i]){
                mark[r][i]=-1;
                tot++;
            }
            else if(mark[r][i]==1)
                flag=0;
        }
    }
    if(!flag)
        ans=0;
    else
        ans=power(2,h*w-tot);
    printf("%d\n",ans);
}
bool isp(int n) {
    return floor(log2(n)) == ceil(log2(n));
}
void solve(){
    int n;
    cin >> n ;
    string s;cin >> s;
    int cnt = 0;
    int c = 0;
    for(int i = 0;i < n;++i) {
        if(s[i] == 'R')cnt++;
    }
    for(int i = 0;i < cnt;++i) {
        if(s[i] == 'R')c++;
    }
    cout << cnt-c << '\n';

}

void another() {

}
void test_case() {
    int t;
    cin >> t;
    while(t--)another();
}
int main() {

   ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    solve();
}


Measured memory_bytes: 3756
#include <stdio.h>
#include <math.h>
 
int	main(void)
{
	long long int a,b,c;
 
	scanf("%lld %lld %lld", &a, &b, &c);
 
	if (c-a-b <= 0)
	{
		printf("No");
	}
	else if (a*a+b*b+c*c-2*(a*b)-2*(b*c)-2*(c*a)>0)
	{
		printf("Yes");
	}
	else
		printf("No");
 
	return(0);
}

Measured memory_bytes: 128
#include<stdio.h>
#include<stdlib.h>

int table[101][101];
int PPP[100][2];

int check(int r,int c){
  int kari;
  int num=c-r;
  int i;
  int min=100000001;
  for(i=0;i<num;i++){
    kari=(table[r][r+i]+table[r+i+1][c]+(PPP[r-1][0]*PPP[r+i][0]*PPP[c-1][1]));
    if(min>kari)min=kari;
  }
  return min;
}

int main(){
  int n;
  int i,j;
  int a;
  int *AA;
  
  scanf("%d",&n);

  for(i=0;i<n;i++){
    scanf(" %d",&PPP[i][0]);
    scanf(" %d",&PPP[i][1]);
  }


  for(i=0;i<=n;i++)table[i][i]=0;

  for(i=1;i<n;i++){
    table[i][i+1]=PPP[i-1][0]*PPP[i][0]*PPP[i][1];
  }

  for(i=0;i<=n-3;i++){
    for(j=3+i;j<=n;j++){
      table[j-2-i][j]=check(j-2-i,j);
      //rintf("%d\n",table[j-2-i][j]);
    }
  }

  printf("%d\n",table[1][n]);

  return 0;
}
  
  



Measured memory_bytes: 2112
#include<cstdio>
#include<iostream>
#include<fstream>
#include<cmath>
#include<cstring>
#include<algorithm>
using namespace std;
#define Set(a) memset(a,0,sizeof(a))
#define F(i,a,b) for(register int i=a;i<=b;++i)
#define UF(i,a,b) for(register int i=a;i>=b;--i)
#define openf(a) freopen(#a".in","r",stdin);freopen(#a".out","w",stdout)
typedef long long LL;
typedef long long ll;
typedef unsigned long long ULL;
typedef unsigned long long ull;
inline int r(int &x)
{
    int f=1;x=0;
    char c=getchar();
    for(;!isdigit(c);c=getchar()) if(c=='-') f=-1;
    for(; isdigit(c);c=getchar()) x=(x<<3)+(x<<1)+c-'0';
    return x*=f;
}
inline ll r(ll &x)
{
    ll f=1ll;x=0ll;
    char c=getchar();
    for(;!isdigit(c);c=getchar()) if(c=='-') f=-1ll;
    for(; isdigit(c);c=getchar()) x=(x<<3)+(x<<1)+(ll)(c-'0');
    return x*=f;
}
inline ull r(ull &x)
{
    x=0ull;
    char c=getchar();
    for(;!isdigit(c);c=getchar());
    for(; isdigit(c);c=getchar()) x=(x<<3)+(x<<1)+(ull)(c-'0');
    return x;
}
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define mp(a,b) make_pair(a,b)
inline int max(int a,int b){return a>b?a:b;}
inline int min(int a,int b){return a<b?a:b;}
const int inf=1<<30;

int prime_have[10];
int prime_num[10];
int primes=0;
ll ni[100020];
int nownum=0;
const ll mod=1000000007ll;
ll qp(ll a,ll b)
{
	if(b==1ll) return a;
	ll w=qp(a,b/2);
	if(b&1) return ((w*w)%mod)*a%mod;
	else return (w*w)%mod;
}
ll _ni(ll a){return qp(a,mod-2);}
void prework()
{
	ni[0]=1;
	ll a=1;
	F(i,1,100010)
	{
		a=a*i%mod;
		ni[i]=_ni(a);
	}
	return;
}
int m,n;
void solve()
{
	F(i,2,100000)
	{
		nownum=0;
		while(m%i==0) {m/=i;++nownum;}
		if(nownum!=0) {prime_have[++primes]=i;prime_num[primes]=nownum;}
	}
	if(m!=1) {prime_have[++primes]=m;prime_num[primes]=1;}
	ll ans=1;
	F(i,1,primes)
	{
		F(j,1,n-1) ans=ans*(prime_num[i]+j)%mod;
		ans=ans*ni[n-1]%mod;
	}
	printf("%lld\n",ans);
	return;
}
int main()
{
	prework();
	r(n),r(m);
	solve();//ok
	return 0;//ok
}

Measured memory_bytes: 1024
a = []
while True:
    b = map(int, raw_input().split())
    if b == [0, 0]:
        break
    a.append(b)
for list in a:
    h, w = list
    k = 0
    l = 0
    x = []
    y = []
    while k < w:
        x.append('#')
        k = k + 1
    k = 0
    while k < w:
        if k == 0 or k == w - 1:
            y.append('#')
        else:
            y.append('.')
        k = k + 1
    while l < h:
        if l == 0 or l == h - 1:
            print ''.join(x)
        else:
            print ''.join(y)
        l = l + 1
    print 

Measured memory_bytes: 6364
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define All(x) (x).begin(),(x).end()
using namespace std;

int main(){
    constexpr long long mod=1e9+7;
    int N;cin>>N;
    vector<int> x(N);
    REP(i, N) cin >> x[i];
    vector<int> A(N),rank(N);
    A[0]=(x[0]-1);rank[0]=1;
    REP(i,N-1){
        A[i+1]=A[i]+x[i+1]-x[i]-1;
        rank[i+1]=max(rank[i],x[i]/2-A[i]+1);
    }
    long long ans=1;
    REP(i,N){
        long long k=upper_bound(All(rank),i+1)-rank.begin();
        ans=ans*(k-i)%mod;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
#define ll long long
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define setbits __builtin_popcount 
#define big 1e9+7
using namespace std;
ll n,k,m,flag,mod,cnt;
double a[100005],ans = 0.0;
double dp[3005][3005];
string s;
int main()
{
	IOS
	ll x,y;
	cin>>n;

	for(int i = 0; i < n; ++i)
		cin>>a[i];
	dp[0][0] = 1-a[0];
	dp[0][1] = a[0];
	// for(int i = 0; i < n+1; ++i)
	// 	cout<<dp[0][i]<<" ";
	// cout<<endl;
	for(int i = 1; i < n; ++i)
	{
		for(int j = 0; j < n+1; ++j)
		{
			if(j == 0)
				dp[i][j] = dp[i-1][j]*(1-a[i]);
			dp[i][j] = dp[i-1][j]*(1-a[i]) + dp[i-1][j-1]*a[i];
			// cout<<dp[i][j]<<" ";
		}
		// cout<<endl;
	}

	for(int i = n/2+1; i <= n; ++i)
		ans += dp[n-1][i];
	cout<<setprecision(12)<<ans<<endl;
    return 0;
}

Measured memory_bytes: 70656
n,m=map(int,input().split())

x = list(map(int,input().split()))

x.sort()
y = x[1::]
dlt = [i-j for (i,j) in zip(y,x)]
dlt.sort()
if n==1:
  print(sum(dlt))
else:
  print(sum(dlt[0:-1*n+1]))



Measured memory_bytes: 13968
#include <stdio.h>
int main(){
  int A[3];
  int i,a;
  scanf("%d",&a);
  int x=a;
  int y=0;
  while(x>=1){
    if(x%10==1){y+=1;}
      x=x/10;
  }
  printf("%d",y);
  
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
/* constant */
const int INF = 1 << 30;
const int NIL = -1;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;
struct mint {
    ll x;
    mint(ll x = 0):x((x % mod + mod) % mod) {}
    mint operator-() const { return mint(-x); }
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) {
        (x *= a.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(ll 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;
    }
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
struct Partition {
    vector<vector<mint> > P;
    Partition(int m) : P(m + 1, vector<mint>(m + 1, 0)) {
        for (int k = 0; k <= m; ++k) P[0][k] = 1;
        for (int n = 1; n <= m; ++n) {
            for (int k = 1; k <= m; ++k) {
                P[n][k] = P[n][k-1] + (n-k >= 0 ? P[n-k][k] : 0);
            }
        }
    }
    mint operator()(int n, int k) {
        if (n < 0 || k < 0) return 0;
        return P[n][k];
    }
};
/* global variables */
/* function */
/* main */
int main() {
    int n, k;
    cin >> n >> k;
    if (n < k) { cout << 0 << '\n'; return 0; }
    Partition p = Partition(max(n, k));
    cout << p(n - k, k) << '\n';
}


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

using namespace std;

#define OnlineJudge1

#define loop(x,a,n) for(int x = a;x < n;x++)
#define NumofDigits(n) ((int)log10(n)+1)
#define CountofNumber(array,n,x)  (upper_bound(array, array+n, x)-lower_bound(array, array+n, x))
#define readline(s) getline(cin,s)
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define EPS 1e-7
#define modulo ll (1e9 + 7)
const long double PI = 3.141592653589793238L;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<int,ll> pill;
typedef pair<ll,ll> pll;

#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)

#define time__(d) \
    for ( \
        auto blockTime = make_pair(chrono::high_resolution_clock::now(), true); \
        blockTime.second; \
        debug("%s: %lld ms\n", d, chrono::duration_cast<chrono::milliseconds>(chrono::high_resolution_clock::now() - blockTime.first).count()), blockTime.second = false \
    )

void init(){
    cin.tie(0);
    ios::sync_with_stdio(0);
#ifdef OnlineJudge
    freopen("in.in","r",stdin);
    freopen("out.txt","w",stdout);
#endif
}

const int N = 1e7 + 10, M = 55, OO = 0x3f3f3f3f;
const ll llOO = 1e18;


int main(){
    init();

    ll h;   cin >> h;
    ll ans = 1, cnt = 1;
    while(h > 1){
        h /= 2;
        cnt *= 2;
        ans += cnt;
    }

    cout << ans;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;
#define ff first
#define ss second
#define mp make_pair
#define pb push_back

int main(){
	int n;
	set<int> v;
	for(int i=0;i<3;i++){
		cin>>n;
		v.insert(n);
	}
	if(v.size()==2){
		cout<<"Yes";
	}else{
		cout<<"No";
	}
    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
INF = float("inf")


def solve(X: int):

    cand = [1]
    for i in range(2, 34):
        beki = i*i
        while beki*i <= X:
            beki *= i
        if beki <= X:
            cand.append(beki)
    print(max(cand))

    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = int(next(tokens))  # type: int
    solve(X)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <math.h>
#include <cmath>
 
using namespace std;
using std::cout;
using ll =long long;
bool is_int_lround(double x){
  return std::lround(x)==x;
}
int ketasuu(int x){
  int n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}
ll gcd11(ll x, ll y){
  long long a= max(x,y), b=min(x,y), c=a%b;
  while( c!=0){
    a =b;
    b =c;
    c = a%b;
  }
  return b;
}

int ab(int x, int y){
  if(x>=y){
    return x-y;
  }
  else if(y>x){
    return y-x;
  }
}
int main(){
  string S;
  cin>>S ;
  int np=0;
  int nm=0;
  for(int i=0; i<S.size();i++){
    if(S[i]== '+'){
      np ++;
    }
    else{
      nm ++;
    }
  }
  cout << np -nm<<endl;
  

}


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

int main() {
    int N; 
    cin >> N;
    int v[N];
    for (int i=0; i<N; i++) scanf("%d", &v[i]);
    sort(v, v+N);

    double ans = v[0];
    for (int i=1; i<N; i++) {
        ans = (ans + v[i]) / 2.0;
    }

    cout << ans << endl;

    return 0;
}



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

int main(void)
{
    //const double PI=3.141592653589793238;


    int N, K, X=0, i=0;
    cin >> N;

    int a[N];

    while(i < N)
    {
        cin >> K;
        if(K%2==0){
            X += 1;
        }
        i++;
    }


    cout << (pow(3, N) - pow(2, X)) << endl;

    return 0;
}

Measured memory_bytes: 4108
//Copied: https://www.codechef.com/viewsolution/21764904

#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;


#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << std::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...);
}
#else
#define trace(...)
#endif

#define rep(i, n)    for(int i = 0; i < (n); ++i)
#define repA(i, a, n)  for(int i = a; i <= (n); ++i)
#define repD(i, a, n)  for(int i = a; i >= (n); --i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
#define fill(a)  memset(a, 0, sizeof (a))
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
typedef long double ld;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

void pre(){


}
vector<pii> g[100009];
int ans[100009];
int deg[100009];
bool vis[100009];
void dfs(int v,int pr=-1){
	vis[v] = 1;
	trav(i,g[v]){
		if(!vis[i.fst]){
			dfs(i.fst,i.snd);
			if(deg[i.fst]%2) {
				if(i.snd<0) {
					ans[-i.snd] = 1;
					deg[i.fst]++;
					deg[v]--;
				}
				else{
					ans[i.snd]=1;
					deg[i.fst]--;
					deg[v]++;
				}
			}
		}
	}
}

int stu[100005], stv[100005];

void solve(){
	int n,m;cin>>n>>m;
	repA(i,1,n) g[i].clear();
	fill(ans);fill(deg);fill(vis);
	repA(i,1,m){
		int u,v;cin>>u>>v;
		stu[i] = u;
		stv[i] = v;
		g[u].pb(mp(v,i));
		deg[v]++;
		g[v].pb(mp(u,-i));
	}
	if(m%2) cout<<-1;
	else {
		dfs(1);
		repA(i,1,m) 
			if(ans[i])
				cout << stu[i] << ' ' << stv[i] << endl;
			else
				cout << stv[i] << " " << stu[i] << endl;
	}
}

int main() {
	cin.sync_with_stdio(0); cin.tie(0);
	pre();
	int n;
	n = 1;
	rep(i,n) solve(),cout<<'\n';;	
	
	
	
	
	return 0;
}



Measured memory_bytes: 11136
#include <bits/stdc++.h>
using namespace std;
int main() {
	int n;
	cin >> n;
	vector<int> a;
	vector<int> b;
	vector<int> c;
	a.resize(n);
	b.resize(n);
	c.resize(n);
	for(int i = 0; i < n; ++i) {
		cin >> a[i];
	}
	for(int i = 0; i < n; ++i) {
		cin >> b[i];
	}
	for(int i = 0; i < n; ++i) {
		c[i] = i + 1;
	}
	int cnt = 0;
	int ans = 0;
	do {
		++cnt;
		if(a == c) {
			ans += cnt;
		}
		if(b == c) {
			ans -= cnt;
		}
	} while(next_permutation(c.begin(), c.end()));
	cout << abs(ans) << '\n';
	return 0;
}


Measured memory_bytes: 256
n,k = map(int,input().split())
a = list(map(int,input().split()))
l = [0]*n
r = [0]*n
for i in range(n):
  for j in range(n):
    if a[i] > a[j]:
      if j < i:
        l[i] += 1
      if j > i:
        r[i] += 1
#print(l)
#print(r)
ans = 0
MOD = 1000000007
x = (k*(k-1)//2)%MOD
y = (k*(k+1)//2)%MOD
for i in range(n):
  ans = (ans + x*l[i] + y*r[i])%MOD
print(ans)

Measured memory_bytes: 9272
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int k=sc.nextInt();
		int a=sc.nextInt();
		int b=sc.nextInt();
		System.out.println((b-b%k>=a)?"OK":"NG");
	}
}

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

#define ff              first
#define ss              second
#define ll             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
//mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

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

int main()
{
	c_p_c();
	int n, k;
	cin >> n >> k;
	int* heights = new int[n + 1];
	for (int i = 1; i <= n; i++) {
		cin >> heights[i];
	}
	int* dp = new int[n + 1];
	dp[0] = 0;
	dp[1] = 0;
	dp[2] = abs(heights[1] - heights[2]);
	for (int i = 3; i <= n; i++) {
		int minn = INT_MAX;
		for (int j = 1; j <= k && i - j >= 1; j++) {
			minn = min(minn, dp[i - j] + abs(heights[i] - heights[i - j]));
		}
		dp[i] = minn;
	}
	cout << dp[n] << endl;
	return 0;
}

Measured memory_bytes: 1024
import java.util.*;
import java.io.*;

/**
 * C
 */
public class Main {

    void run() {
        
        Scanner sc = new Scanner(System.in);

        PriorityQueue<Integer> PQ = new PriorityQueue<>(1, Collections.reverseOrder());

        String doing;
        int key;

        StringBuilder sb = new StringBuilder();

        while(true) {

            doing = sc.next();

            if(doing.equals("insert")) {
                key = sc.nextInt();
                PQ.add(key);
            } else if(doing.equals("end")) {
                break;
            } else {
                sb.append(Integer.toString(PQ.peek())).append("\n");
                PQ.remove();
            }

        }

        sc.close();

        System.out.print(sb);

    }

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

}


Measured memory_bytes: 586600
class Node:
    def __init__(self, val=None, prev=None, nextNode=None):
        self.val = val
        self.prev = prev
        self.nextNode = nextNode

class LinkedList():
    def __init__(self):
        self.end = Node('END')
        self.cursol_node = self.end
    
    def insertBefore(self, x):
        new_node = Node(val=x, prev=self.cursol_node.prev, nextNode=self.cursol_node)
        if self.cursol_node.prev != None:
            self.cursol_node.prev.nextNode = new_node
        #現在のカーソルノードのprevを新しいノードとリンク
        self.cursol_node.prev = new_node
        #新しいノードをカーソルノードとする
        self.cursol_node = new_node

    def move(self, d):
        if d > 0:
            for i in range(d):
                #ノードのnextがENDになるまでカーソルノードを移動
                if self.cursol_node.nextNode == None:break
                self.cursol_node = self.cursol_node.nextNode
        elif d < 0:
            for i in range(abs(d)):
                if self.cursol_node.prev == None:break
                self.cursol_node = self.cursol_node.prev

    def erase(self):
        if self.cursol_node != self.end:
            if self.cursol_node.prev != None:
                #前提条件としてcursolがENDにある状態でeraseは行われないため、prevのみNoneチェック
                self.cursol_node.prev.nextNode = self.cursol_node.nextNode
            self.cursol_node.nextNode.prev = self.cursol_node.prev
            self.cursol_node = self.cursol_node.nextNode
    
    def print_nodes_val(self):
        ans_list = []
        target_node = self.end
        while True:
            if target_node.prev == None:break
            else:
                target_node = target_node.prev
                ans_list.append(target_node.val)
        ans_list = ans_list[::-1]
        return ans_list

linkedList = LinkedList()
n = int(input())
for i in range(n):
    q,*x = map(int, input().split())
    x = x[0] if x else None
    if q == 0:
        linkedList.insertBefore(x)
    elif q == 1:
        linkedList.move(x)
    elif q == 2:
        linkedList.erase()
print('\n'.join(map(str,linkedList.print_nodes_val())))



Measured memory_bytes: 125728
import { readFileSync } from "fs";

// eslint-disable-next-line @typescript-eslint/no-unused-vars
const range = (n: number | bigint) => [...Array(Number(n))].map((_, i) => i);
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const tuple = <T extends unknown[]>(...ts: T) => ts;
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const [cin, nCin, biCin] = (() => {
  const inputs = readFileSync("/dev/stdin", "utf-8").split(/[\n|\s]+/);
  let count = 0;
  const cin = () => inputs[count++];
  return tuple(
    cin,
    () => Number(cin()),
    () => BigInt(cin())
  );
})();

type Result = "AC" | "WA" | "TLE" | "RE";

{
  const n = nCin();
  const ss = range(n).map(() => cin() as Result);
  const map = (() => {
    const map: {
      [R in Result]: number;
    } = {
      AC: 0,
      WA: 0,
      TLE: 0,
      RE: 0,
    };
    ss.forEach((s) => map[s]++);
    return map;
  })();
  // (Object.keys(map) as Result[]).map((s) => `${s} x ${map[s]}`).forEach((msg) => console.log(msg));
  const results: Result[] = ["AC", "WA", "TLE", "RE"];
  results.map((s) => `${s} x ${map[s]}`).forEach((msg) => console.log(msg));
}


Measured memory_bytes: 42156
#include<bits/stdc++.h>
#define M 300005 
#define LL long long
using namespace std;
int A[M],B[M],C[M],sz[M],fa[M];
int P=1e9+7,n;
vector<int>edge[M];
LL F[M],dp[M],pre,Ft[M],T[M];
int fast(int x,int n){
	LL res=1,a=x;
	while(n){
		if(n&1)res=res*a%P;
		a=a*a%P;
		n>>=1;
	}
	return res;
}
void dfs(int x,int f){
	sz[x]=1;fa[x]=f;
	for(int i=0;i<edge[x].size();i++){
		int y=edge[x][i];
		if(y==f)continue;
		dfs(y,x);
		sz[x]+=sz[y];//儿子的数量  
	}
	dp[1]=dp[1]*T[sz[x]]%P;
} 
void rdfs(int x,int f,LL pre){ 
	 //pre记录x的祖先节点在把x变成根是的前缀积 
	for(int i=0;i<edge[x].size();i++){
		int y=edge[x][i];
		if(y==f)continue; 
		//y变成根之后，y在原树的所有祖先节点的 子树大小都发生变化 
		LL p=pre*sz[x]%P*T[n-sz[y]]%P; 
		LL tmp=p*sz[y]%P*T[n]%P; 
		dp[y]=dp[1]*tmp%P; 
		rdfs(y,x,p); 
	}
}
int main(){
	int a,b;
	cin>>n;
	F[0]=Ft[0]=1;
	for(int i=1;i<=n;i++)F[i]=F[i-1]*i%P;
	Ft[n]=fast(F[n],P-2); 
	T[n]=Ft[n]*F[n-1]%P;
	for(int i=n-1;i>=1;i--){
		Ft[i]=Ft[i+1]*(i+1)%P; 
		T[i]=Ft[i]*F[i-1]%P;
	}
	for(int i=1;i<n;i++){
		scanf("%d %d",&a,&b);
		edge[a].push_back(b);
		edge[b].push_back(a);
	}
	dp[1]=F[n];
	dfs(1,0); 
	rdfs(1,0,1);
	for(int i=1;i<=n;i++)printf("%lld\n",dp[i]);
	return 0; 
} 

Measured memory_bytes: 27124
def main():
  from itertools import groupby

  s = list(input())
  f = 0
  ans = 0

  for k,v in groupby(s):
    d = len(tuple(v))
    left = d if k==">" else 0
    right = d if k=="<" else 0
    if f>left:
      ans += d*(d+1)//2 - left
    else:
      ans += -1*f + d*(d+1)//2  
    f = right 

  print(ans) 

if __name__ == '__main__':
    main()

Measured memory_bytes: 12316
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace B
{
    class Program
    {
        static void Main(string[] args)
        {
            var time = int.Parse(Console.ReadLine());
            var info = Console.ReadLine().Split(' ');
            var nums = new int[time];
            bool check = true;
            for(int i = 0; i < time; i++)
            {
                nums[i] = int.Parse(info[i]);
            }
            foreach(int num in nums)
            {
                if(num % 2 == 0)
                {
                    if (num % 3 != 0 && num % 5 != 0)
                    {
                        check = false;
                    }
                }
            }
            if (check == true) Console.WriteLine("APPROVED");
            else Console.WriteLine("DENIED");
        }
    }
}

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

// TYPEDEF
// ----------------------------------------
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> Pair;
typedef vector<ll> vll;
typedef vector<vector<ll>> Graph;
typedef vector<string> vs;
typedef vector<pair<ll, ll>> Pll;
typedef queue<ll> qll;

// REPEAT
// ----------------------------------------
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define REPA(i,a) for(ll i=0;i<(ll)(a.size());i++);
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define COUT(a) cout << (a) << endl;
#define ENDL(a) cout << endl;
#define COUTA(i,a) for(ll i=0;i<(ll)(a.size());i++) {cout << (a)[i] << " ";} cout << endl;

// UTIL
// ----------------------------------------
#define pb push_back
#define paired make_pair
#define ALL(a) (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define RSORT(a) sort((a).rbegin(), (a).rend())

// DEBUG
// ----------------------------------------
#ifdef _DEBUG
#define debug(x) cout << "[debug] " << #x << ": " << x << endl
#else
#define debug(x)
#endif

template <typename T>
void debugV(const vector<T> v) {
#ifdef _DEBUG
  rep(i, v.size()) {
    cout << i << ":" << v[i] << " ";
  }
  cout << endl;
#else
  (void)v;
#endif
}

// BIT FLAG
// ----------------------------------------
const unsigned int BIT_FLAG_0 = (1 << 0); // 0000 0000 0000 0001
const unsigned int BIT_FLAG_1 = (1 << 1); // 0000 0000 0000 0010
const unsigned int BIT_FLAG_2 = (1 << 2); // 0000 0000 0000 0100
const unsigned int BIT_FLAG_3 = (1 << 3); // 0000 0000 0000 1000
const unsigned int BIT_FLAG_4 = (1 << 4); // 0000 0000 0001 0000
const unsigned int BIT_FLAG_5 = (1 << 5); // 0000 0000 0010 0000
const unsigned int BIT_FLAG_6 = (1 << 6); // 0000 0000 0100 0000
const unsigned int BIT_FLAG_7 = (1 << 7); // 0000 0000 1000 0000
const unsigned int BIT_FLAG_8 = (1 << 8); // 0000 0001 0000 0000
const unsigned int BIT_FLAG_9 = (1 << 9); // 0000 0010 0000 0000
const unsigned int BIT_FLAG_10 = (1 << 10); // 0000 0100 0000 0000
const unsigned int BIT_FLAG_11 = (1 << 11); // 0000 1000 0000 0000

// CONST
// ----------------------------------------
constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr double PI=3.14159265358979323846; // or M_PI
constexpr int MOD = 1000000007;


void Main() {
  ll a, b;
  cin >> a >> b;
  if (a >= 13) {
    COUT(b);
  }
  else if (6 <= a and a <= 12) {
    COUT(b/2);

  }
  else {
    COUT(0);
  }

}

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

/*

3 2
*/


Measured memory_bytes: 3584
// review
#include <iostream>
#include <cstring>

using namespace std;
typedef long long ll;
const int MAXN = 2010;
const ll INF = 1e16;

int n;
ll z, w;
ll a[MAXN];
ll dp[MAXN][2];

ll dfs(int pos, int turn, ll x, ll y) {
  if (dp[pos][turn] != -1) {
    return dp[pos][turn];
  }

  if (pos == n) {
    return abs(x - y);
  }

  if (turn == 0) {
    ll tmp = -INF;
    for (int i=pos;i<n;i++) {
      tmp = max(tmp, dfs(i+1, 1-turn, a[i], y));
    }
    return dp[pos][turn] = tmp;
  } else {
    ll tmp = INF;
    for (int i=pos;i<n;i++) {
      tmp = min(tmp, dfs(i+1, 1-turn, x, a[i]));
    }
    return dp[pos][turn] = tmp;
  }
}

void solve() {
  memset(dp, -1, sizeof(dp));
  cout << dfs(0, 0, z, w) << endl;
}

int main() {
  cin >> n >> z >> w;
  for (int i=0;i<n;i++) {
    cin >> a[i];
  }
  solve();
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <stdlib.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
const int INF = 1001001001;
const int MX = 200005;


int dp(int n, int k, vector<int> h){
	int cost[MX];
	rep(i,n) cost[i] = INF;
	cost[0]=0;
	for(int i=0; i<n; i++){
		for(int j=1;j<k+1;j++){
			if(i+j >= n) continue;
			cost[i+j]=min(cost[i]+abs(h[i+j]-h[i]),cost[i+j]);
		}
	}
	return cost[n-1];
}



int main(){
	int n,k;
	cin >>n >> k;
	vector<int> h(n);
	rep(i,n) cin >> h[i];
	int ans;
	ans = dp(n,k,h);
	cout << ans << endl;
	return 0;
}




Measured memory_bytes: 1408
#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
typedef long long ll;
#define N 5000100
char a[N];
char b[N];
ll k=0;
int deal()
{
    for (ll i=0,j=k-1;i<k/2;i++,j--)
            if (b[i]!=b[j])
          return 0;
    return 1;
}

int main()
{
    int flag=0;
    scanf("%s",a);
   ll len=strlen(a);
   ll num=0;
   for (ll i=0;i<len;i++)
      if (a[i]!='x')
         b[k++]=a[i];
   if (!deal())
       flag=1;
   else
   {
       int i=0,j=len-1;
     while (i<j)
       {
           if (a[i]==a[j])
            i++,j--;
           else if (a[i]=='x')
             i++,num++;
           else if (a[j]=='x')
              j--,num++;
       }
   }
   if (flag)
    cout << "-1" << endl;
   else
   cout << num << endl;

    return 0;
}


Measured memory_bytes: 2432
s=input()
s_int=int(s)
ans=0

for i in range(1,len(s)):
    if i%2==1:
        ans+=9*(10**(i-1))
if len(s)%2==0:
    print(ans)
else:
    ans+=s_int-10**(len(s)-1)+1
    print(ans)



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

#define faster     ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);
#define read       freopen("input.txt", "r", stdin);
#define write      freopen("output.txt", "w", stdout);
#define endd        '\n'
#define ll         long long
#define sq(a)      ((a) * (a))

using namespace std;
int main()
{
      faster;
      double pi = 2 * acos(0.0);
      ll int n,i,t,j,k,m=0,a,b,c,d,p,q,r,x=250,y=10,z,count=0;
      cin>>n;
      ll int ara[n+1]={};
      for(i=1;i<=n;i++){
            cin>>a;
            ara[a]=i;
      }
      for(i=1;i<=n;i++){
            cout<<ara[i]<<" ";
      }
      return 0;
}
//Sheikh Tafsir Rahman
//CSE IUT

Measured memory_bytes: 4404
#include<bits/stdc++.h>
#define _LIBCPP_DEBUG 0
using namespace std;
typedef long long int ll;
ll MOD = 1e9 + 7;
int INF = 1 << 30;
    
int main(void){

    double R; cin>>R;
    printf("%lf",R*2*3.14);

}


Measured memory_bytes: 3788
N=int(input())
P=list(input().split())
Q=list(input().split())

import itertools
arr = list(map(lambda x: ('').join(list(map(str,x))),list(itertools.permutations(range(1,N+1)))))

print(abs(arr.index(('').join(P))-arr.index(('').join(Q))))

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

using namespace std;

#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl

typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define rep1(i,n) for(ll i=1;i<=(ll)(n);i++)
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define rrep1(i,n) for(ll i=(ll)(n);i>0;i--)
#define REP(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(v) v.begin(),v.end()
#define UNIQUE(v) v.erase(unique(all(v)), v.end())
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a = b; return 1; } return 0; }
const ll inf = 1000000001;
const ll INF = 2e18;
const ll MOD = 1000000007;
const double pi = 3.14159265358979323846;
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx[4] = { 1,0, -1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);


int main() {
	int d, n;
	cin >> d >> n;
	ll now = 1;
	rep(i, d) {
		now *= 100;
	}
	ll t = 1;
	ll cnt = 0;
	while (cnt < n) {
		ll temp = now * t;
		int cnt2 = 0;
		while (temp % 100 == 0) {
			temp /= 100;
			cnt2++;
		}
		if (cnt2 == d) {
			cnt++;
		}
		t++;
	}
	t--;
	cout << now * t << endl;
}

Measured memory_bytes: 256
n ,d = map(int, input().split())
t = []
ans = 0

for i in range(n):
  c = list(map(int,input().split()))
  t.append(c)
  
for k in range(0, n-1):
  for j in range(k+1, n):
    sumsum = 0 
    for l in range(d):
      sumsum += (t[k][l]-t[j][l])**2
    dis = sumsum**(1/2)
    
    if dis.is_integer() == True:
        ans += 1
print(ans)  
  

Measured memory_bytes: 9296
#include<iostream>
using namespace std;
int n,p[20],ans=0;
int main(void){
	cin>>n;
	for(int i=0;i<n;i++)cin>>p[i];
	for(int i=1;i<n-1;i++)if((p[i]<p[i+1]&&p[i]>p[i-1])||(p[i]>p[i+1]&&p[i]<p[i-1]))ans++;
	cout<<ans;
	return 0;
} 


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

void insert(int);
void inorder(int);
void preorder(int);

typedef struct{
  int k, r, l;
}Node;

Node T[N+1];
int M;

void insert(int x){
  int n = 0;
  while(1){
    if(x < T[n].k){
      if(T[n].l == -1){
        T[n].l = M;
        T[M++].k = x;
        break;
      }
      else n = T[n].l;
    }
    else{
      if(T[n].r == -1){
        T[n].r = M;
        T[M++].k = x;
        break;
      }
      else n = T[n].r;
    }
  }
}

void inorder(int n){
  if(T[n].l != -1){
    inorder(T[n].l);
  }
  printf(" %d", T[n].k);
  if(T[n].r != -1){
    inorder(T[n].r);
  }
}

void preorder(int n){
  printf(" %d",T[n].k);
  if(T[n].l != -1){
    preorder(T[n].l);
  }
  if(T[n].r != -1){
    preorder(T[n].r);
  }
}



int main(){
  int n, i, x, first=1;
  char str[100];

  scanf("%d",&n);

  for(i=0; i<=n; i++){
    T[i].k = T[i].l = T[i].r = -1;
  }
  M = 0;
  while(n--){
    scanf("%s",str);
    if(!strcmp(str, "insert")){
      scanf("%d", &x);
      if(first){
        T[M++].k = x;
        first = 0;
      }
      else insert(x);
    }
    else{
      inorder(0);
      printf("\n");
      preorder(0);
      printf("\n");
    }
  }
  return 0;
}

Measured memory_bytes: 6748
A,B,C,X,Y=gets.split.map(&:to_i)

if A+B > C*2
  common = [X,Y].min
  ans = C*2*common
  if X > Y
    rest = X-Y
    ans += (A < 2*C ? rest*A : rest*2*C)
  elsif Y > X
    rest = Y-X
    ans += (B < 2*C ? rest*B : rest*2*C)
  end
  puts ans
else
  puts A*X+B*Y
end


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

int main()
{
	ll n, K; cin >> n >> K;
	vector<ll> a(n);
	for(int i=0; i<n; i++) cin >> a[i];
	// defining state of dp
	vector<bool> dp(K+1, false);
	for(int i=1; i<=K; i++)
	{
		for(int j=0; j<a.size(); j++)
		{
			if(i >= a[j] && !dp[i-a[j]])
			{
				dp[i] = true;
			}
 		}
	}
	
	if(dp[K]) cout << "First";
	else cout << "Second";
	
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int Maxn = 1e5 + 789;
int a[Maxn];
int m[Maxn];
int main() { 
	// your code goes here
	int n;
	cin >> n;
	vector <int> v,sasp;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
		m[a[i]]++;
		if (m[a[i]] == 1) {
			v.push_back(a[i]);
		}
	}
	int mx_cnt = 0;
	int mx = 0;
	for (int i = 0; i < v.size() ; i++) {
		int x = v[i]-1;
		int y = v[i]+1;
		int mx_san = v[i];
		mx = max(mx, max(m[mx_san]+m[x]+m[x-1], m[y] + m[mx_san] + m[y+1]) );
		mx = max(mx, m[mx_san] + m[mx_san-1]+m[mx_san+1]);
	}/*
	if (sasp.size() == 0) {
		int x, y;
		x = mx_san -1;
		y = mx_san +1;
		cout << max(m[mx_san] + m[x]+m[y], max(m[mx_san]+m[x]+m[x-1], m[y] + m[mx_san] + m[y+1]));
	} else {
		cout << "ZDES'";
		// 6 .. 9
		int mx = m[mx_san] + m[mx_san-1]+m[mx_san+1];
		for (int i = 0; i < sasp.size(); i++) {
			mx_san = sasp[i];
			int x = mx_san -1;
			int y = mx_san +1;
			mx = max(mx, max(m[mx_san]+m[x]+m[x-1], m[y] + m[mx_san] + m[y+1]) );
			mx = max(mx, m[mx_san] + m[mx_san-1]+m[mx_san+1]);
		}
		cout << mx;
	}*/
	cout << mx;
 	return 0;
}

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

using namespace std;

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

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

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

    int n, d;
    cin >> n >> d;
    int range = 2 * d + 1;
    int ans = (n + range - 1) / range;
    cout << ans << '\n';
    
    return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

    public static void main(String[] args) throws Exception {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String input;

        while ((input = reader.readLine()) != null) {
            int d = Integer.parseInt(input);
            int result = 0;

            for (int x = d; x < 600; x += d) {
                result += x * x * d;
            }

            System.out.println(result);
        }
    }
}

Measured memory_bytes: 23984