akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define MAX 100000
#define ll long long
#define upperlimit 1000100
#define INF 1e18
#define eps 1e-8
#define endl '\n'
#define pcc pair<char,char>
#define pii pair<ll,int>
#define pll pair<ll,ll>
#define tr(container,it) for(typeof(container.begin()) it=container.begin();it!=container.end();it++)
#define MOD 10000000000000007LL
#define slld(t) scanf("%lld",&t)
#define sd(t) scanf("%d",&t)
#define pd(t) printf("%d\n",t)
#define plld(t) printf("%lld\n",t)
#define mp(a,b) make_pair(a,b)
#define FF first
#define SS second
#define pb(x) push_back(x)
#define vi vector<int>
#define clr(a) memset(a,0,sizeof(a))
#define debug(a) printf("check%d\n",a)
#define csl ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
 
ll gcd(ll n1,ll n2){
	if(n1%n2==0)return n2;
	return gcd(n2,n1%n2);
}
ll powmod(ll base,ll exponent)
{
	ll ans=1;
	while(exponent){
		if(exponent&1)ans=(ans*base)%MOD;
		base=(base*base)%MOD;
		exponent/=2;
	}
	return ans;
}
ll arr[5][5];
ll mulr[5][5];
ll powr[5][5];
ll mul2[5][5];
ll fr[5][5];
void poww(int x)
{
	//cout<<"poww "<<k<<endl;
	if(x==1)
	{
		for(int i=0;i<3;i++)
			for(int j=0;j<3;j++)
				powr[i][j]=arr[i][j]%10;
			return;
	}
	if(x%2==0)
	{
		poww(x/2);
		for(int i=0;i<3;i++)
			for(int j=0;j<3;j++)
				{mulr[i][j]=0;for(int k=0;k<3;k++)
					mulr[i][j]+=powr[i][k]*powr[k][j];
					mulr[i][j]%=10;}
		for(int i=0;i<3;i++)
			for(int j=0;j<3;j++)
				powr[i][j]=mulr[i][j]%10;;
	}
	else
	{
		poww(x/2);
		for(int i=0;i<3;i++)
			for(int j=0;j<3;j++)
				{mulr[i][j]=0;for(int k=0;k<3;k++)
					mulr[i][j]+=powr[i][k]*powr[k][j];
					mulr[i][j]%=10;}

		for(int i=0;i<3;i++)
			for(int j=0;j<3;j++)
				{mul2[i][j]=0;for(int k=0;k<3;k++)
					mul2[i][j]+=mulr[i][k]*arr[k][j];
					mul2[i][j]%=10;}
		for(int i=0;i<3;i++)
			for(int j=0;j<3;j++)
				powr[i][j]=mul2[i][j]%10;
	}
}
void f(int x)
{
	//cout<<"here "<<k<<endl;
	if(x==1)
	{
		for(int i=0;i<3;i++)
			for(int j=0;j<3;j++)
				fr[i][j]=arr[i][j]%10;
			return;
	}
	else if(x%2==0)
	{
		f(x/2);
		poww(x/2);
		for(int i=0;i<3;i++)
			for(int j=0;j<3;j++)
				{mulr[i][j]=0;for(int k=0;k<3;k++)
					mulr[i][j]+=powr[i][k]*fr[k][j];
					mulr[i][j]%=10;}

		for(int i=0;i<3;i++)
			for(int j=0;j<3;j++)
				fr[i][j]=(fr[i][j]+mulr[i][j])%10;
	}
	else
	{
		f(x/2);
		poww(x/2);
		for(int i=0;i<3;i++)
			for(int j=0;j<3;j++)
				{mulr[i][j]=0;for(int k=0;k<3;k++)
					mulr[i][j]+=powr[i][k]*fr[k][j];
					mulr[i][j]%=10;}
		int temp[5][5];
		for(int i=0;i<3;i++)
			for(int j=0;j<3;j++)
				temp[i][j]=mulr[i][j];
		poww(x);
		for(int i=0;i<3;i++)
			for(int j=0;j<3;j++)
			{
					mul2[i][j]=temp[i][j]+powr[i][j];
					//cout<<x<<" "<<temp[i][j]<<endl;
					mul2[i][j]%=10;
					}
		for(int i=0;i<3;i++)
			for(int j=0;j<3;j++)
				fr[i][j]=(fr[i][j]+mul2[i][j])%10;
	}
}
int main()
{
	int a,b;
	cin>>a>>b;
	if(a==1&&b==1)
		cout<<"Draw"<<endl;
	else if(a==1||(a>b&&b!=1))
		cout<<"Alice"<<endl;
	else if(b==1||(b>a&&a!=1))
		cout<<"Bob"<<endl;
	else
		cout<<"Draw"<<endl;
}

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

#define X first
#define Y second
#define mp make_pair
#define pb pop_back
#define eb emplace_back
#define sz(v) (int) v.size()

using namespace std;

typedef long long LL;
typedef long double LD;

const LL INF = 1e18;

vector <vector <pair <int, int>>> g;
vector <LL> dist;
vector <vector <bool>> can;
vector <bool> on_cycle;

void dfs(int v, int s) {
	can[s][v] = true;
	for (auto &to : g[v]) {
		int u = to.X, w = to.Y;
		if (!can[s][u]) {
			dfs(u, s);
		}
	}
}

void solve() {
	int n, m, p;
	cin >> n >> m >> p;
	g.resize(n);
	for (int i = 0; i < m; ++i) {
		int v, u, w;
		cin >> v >> u >> w;
		--v, --u;
		g[v].eb(u, w);
	}
	dist.resize(n, -INF);
	dist[0] = 0;
	for (int i = 0; i < n; ++i) {
		for (int v = 0; v < n; ++v) {
			if (dist[v] == -INF) {
				continue;
			}
			for (auto &to : g[v]) {
				int u = to.X, w = to.Y;
				dist[u] = max(dist[u], dist[v] + 1LL * w - 1LL * p);
			}
		}
	}
	can.resize(n, vector <bool> (n, false));
	for (int v = 0; v < n; ++v) {
		dfs(v, v);
	}
	on_cycle.resize(n, false);
	for (int v = 0; v < n; ++v) {
		for (auto &to : g[v]) {
			int u = to.X, w = to.Y;
			if (dist[u] < dist[v] + 1LL * w - 1LL * p) {
				on_cycle[v] = true;
				on_cycle[u] = true;
			}
		}
	}
	for (int v = 0; v < n; ++v) {
		if (on_cycle[v] && can[0][v] && can[v][n - 1]) {
			cout << "-1\n";
			return;
		}
	}
	cout << max(0LL, dist[n - 1]) << "\n";
}

signed main() {
// #define TASK ""
#if !defined(LOCAL) && defined(TASK)
	// freopen(TASK".in", "r", stdin);
	// freopen(TASK".out", "w", stdout);
#endif
	ios::sync_with_stdio(0); cin.tie(0);
	int tests = 1;
	// cin >> tests;
	while (tests--) {
		solve();
	}
	return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e16;
const ll mod = 1000000007;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  ll n, m;
  cin >> n >> m;
  if (n >= 13) cout << m << endl;
  else if (n < 6) cout << 0 << endl;
  else cout << m/2 << endl;
}

Measured memory_bytes: 256
N, K = gets.split.map(&:to_i)
S = gets.chomp.chars
h = 0
rl = 0
lr = 0
0.upto(N - 2) do |i|
  h += 1 if S[i] == S[i + 1]
  rl += 1 if S[i] == 'R' && S[i + 1] == 'L'
  lr += 1 if S[i] == 'L' && S[i + 1] == 'R'
end
if (rl + 1) / 2 + (lr + 1) / 2 > K
  p h + K * 2
else
  p h + rl + lr
end


Measured memory_bytes: 9596
S=input()
T=input()
s=len(S)
t=len(T)
#dp[i][j] Sのi文字目までとTのj文字目までで最大共通文字数
dp=[[0]*(t+1) for i in range(s+1)]
for i in range(s):
    for j in range(t):
        if S[i]==T[j]:
            dp[i+1][j+1]=max(dp[i][j]+1, dp[i][j])
        else:
            dp[i+1][j+1]=max(dp[i+1][j], dp[i][j+1])
ans=''
while s>0 and t>0:
    if dp[s][t]==dp[s-1][t]:
        s-=1
    elif dp[s][t]==dp[s][t-1]:
        t-=1
    else:
        s-=1
        t-=1
        ans+=T[t]
ans=ans[::-1]
print(ans)

Measured memory_bytes: 112348
#include <bits/stdc++.h>
#define N 100020
#define ll long long
using namespace std;
inline int read() {
	int x = 0, f = 1;
	char ch = getchar();
	while (ch > '9' || ch < '0') ch == '-' && (f = 0) || (ch = getchar());
	while (ch <= '9' && ch >= '0')
		x = (x << 3) + (x << 1) + ch - '0', ch = getchar();
	return f ? x : -x;
}
int head[N], to[N << 1], nxt[N << 1], cnt;
void insert(int x, int y) {
	to[++cnt] = y;
	nxt[cnt] = head[x];
	head[x] = cnt;
	to[++cnt] = x;
	nxt[cnt] = head[y];
	head[y] = cnt;
}
int dfn[N], low[N], tot, ans;
void tarjan(int x, int fa) {
	dfn[x] = low[x] = ++tot;
	for (int i = head[x]; i; i = nxt[i]) {
		if (to[i] == fa) continue;
		if (!dfn[to[i]]) {
			tarjan(to[i], x);
			low[x] = min(low[x], low[to[i]]);
			if (low[to[i]] > dfn[x]) ans++;
		} else {
			low[x] = min(low[x], dfn[to[i]]);
		}
	}
}
int main(int argc, char const *argv[]) {
	int n = read(), m = read();
	for (int i = 1; i <= m; i++) insert(read(), read());
	for (int i = 1; i <= n; i++)
		if (!dfn[i]) tarjan(i, 0);
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <assert.h>
#include <memory.h>

using namespace std;

#define N 301
#define M 90001
#define mod 998244353

int add(int x,int y) {
  int ret = (x + y)%mod;
  if(ret<0) {
    ret += mod;
  }
  return ret;
}
int mul(int x,int y) {
  int ret = (long long)x*y%mod;
  if(ret<0) {
    ret += mod;
  }
  return ret;
}
int mypow(int x,int c) {
  int ret = 1;
  while(c>0) {
    if(c&1) {
      ret = mul(ret, x);
    }
    x = mul(x,x);
    c/=2;
  }
  return ret;
}
int a[N];
int dp[2][M];
void solve() {
  int n;scanf("%d",&n);
  int sum = 0,ret = 1;
  for(int i=1;i<=n;++i) {
    scanf("%d",&a[i]);
    sum += a[i];
    ret = mul(ret,3);
  }
  int curPos = 0;
  dp[curPos][0] = 1;
  int curSum = 0;
  for(int i=1;i<=n;++i) {
    int nextPos = curPos^1;
    curSum += a[i];
    memset(dp[nextPos],0,sizeof(dp[nextPos]));
    for(int s=0;s<=curSum;++s) {
      //don't choose
      dp[nextPos][s] = add(dp[nextPos][s], add(dp[curPos][s],dp[curPos][s]));
      //choose
      if(s + a[i]<=curSum) {
        dp[nextPos][s+a[i]] = add(dp[nextPos][s+a[i]], dp[curPos][s]);
      }
    }
    curPos = nextPos;
  }
  int limit = (sum + 1)/2;
  for(int i=limit;i<=sum;++i) {
    ret = add(ret, -mul(3,dp[curPos][i]));
  }
  if(sum%2==0) {
    memset(dp,0,sizeof(dp));
    curSum = 0;
    curPos = 0;
    dp[curPos][0] = 1;
    for(int i=1;i<=n;++i) {
      curSum += a[i];
      int nextPos = curPos^1;
      memset(dp[nextPos],0,sizeof(dp[nextPos]));
      for(int s=0;s<=curSum;++s) {
        dp[nextPos][s] = add(dp[nextPos][s], dp[curPos][s]);
        //choose
        if(s + a[i]<=curSum) {
          dp[nextPos][s+a[i]] = add(dp[nextPos][s+a[i]], dp[curPos][s]);
        }
      }
      curPos = nextPos;
    }
    int s = dp[curPos][sum/2];
    s = mul(s,3);
    ret = add(ret,s);
  }
  printf("%d\n",ret);
}

int main() {
  //freopen("input.txt","r",stdin);
  solve();
  return 0;
}


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

int main()
{
	int n;
	cin >> n;
	long long sum = 0, min = 100000000000, max = -100000000000;
	int a;
	for (int i = 0; i < n; i++)
	{
		cin >> a;
		sum = sum + a;

		if (a < min)
			min = a;
		if (a > max)
			max = a;
	}
	cout << min << " " << max << " " << sum << endl;
}


Measured memory_bytes: 3116
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;
typedef long long ll;
typedef pair<int, int> Pint;
typedef pair<ll, ll> Pll;
#define rep(begin, i, end) for (ll i = begin; i < (ll)(end); i++)
#define all(v) v.begin(), v.end()
const int MOD = 1000000007;

ll N, ans = 0;
string s;

void solve(ll n, ll now)
{
    if (n == 3)
    {
        ans++;
        return;
    }
    for (ll i = 0; i <= 9; i++)
    {
        for (ll j = now; j <= N - 3 + n; j++)
        {
            if (s.at(j) == (char)('0' + i))
            {
                solve(n + 1, j + 1);
                break;
            }
        }
    }
    return;
}

int main()
{
    cin >> N >> s;
    solve(0, 0);
    cout << ans << endl;
}

Measured memory_bytes: 3684
#include"bits/stdc++.h"
using namespace std;
typedef long long ll;
const ll MOD = (ll)(1e9+7);
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int (i)=0; (i)<(int)(n); (i)++)

int N;
ll W, w[200], v[200];

ll memo[200][200*2000+1];
ll solve(int n, int V){
    if(V < 0) return INT_MAX;
    if(n == N){
        if(V == 0) return 0LL;
        else return INT_MAX;
    }
    if(memo[n][V] != -1) return memo[n][V];
    return memo[n][V] = min(solve(n+1, V), solve(n+1, V-v[n])+w[n]);
}

signed main(){
    scanf("%d%d", &N, &W);
    assert(1 <= W && W <= 1000000000);
    assert(1 <= N && N <= 200);
    rep(i, N){
        scanf("%d%d", w+i, v+i);
        assert(1 <= w[i] && w[i] <= 1000000000);
        assert(1 <= v[i] && v[i] <= 2000);
    }
    memset(memo, -1, sizeof(memo));
    for(int i=400000; i>=0; i--){
        if(solve(0, i) <= W){
            printf("%d\n", i);
            break;
        }
    }
}

Measured memory_bytes: 625280
#include <iostream>
#include <iomanip>
#include <ios> 
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>
#include <map>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define sz(c) ((int)(c).size())

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
const int MAX=1e5+5;

int main(){
	string S,T;
	cin>>S;
	cin>>T;
	int s,t;
	s=sz(S);
	t=sz(T);
	int q;
	cin>>q;
	
	int sm3[MAX],tm3[MAX];
	sm3[0]=0;
	rep1(i,s){
		if(S[i-1]=='A')sm3[i]=(sm3[i-1]+1)%3;
		if(S[i-1]=='B')sm3[i]=(sm3[i-1]+2)%3;
	}
	tm3[0]=0;
	rep1(i,t){
		if(T[i-1]=='A')tm3[i]=(tm3[i-1]+1)%3;
		if(T[i-1]=='B')tm3[i]=(tm3[i-1]+2)%3;
	}
	
	rep(i,q){
		int a,b,c,d;
		cin>>a>>b>>c>>d;
		int sct=(sm3[b]-sm3[a-1]+3)%3;
		int tct=(tm3[d]-tm3[c-1]+3)%3;
		if(sct==tct)cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
}

Measured memory_bytes: 1664
#include <stdio.h>
 
int main(void){
 
  double r,are,circ;
 
  scanf("%lf",&r);
  are = r * r * 3.141592653589;
  circ = 2 * r * 3.141592653589;
  printf("%f %f\n",are,circ);
  return 0;
}

Measured memory_bytes: 648
from math import log2, ceil

N,K = map(int, input().split())

if N <= K:
	lis = [0]*N
	cnt = N + 1
	score = 0
else:
	lis = [0]*(K-1)
	cnt = K
	score = (N-K+1)/N

for i in range(1, cnt):
	lis[i-1] = (1/N) * pow(1/2, ceil(log2(K/i)))
print(sum(lis)+score)


Measured memory_bytes: 3316
N = int(input())
XL = []
for i in range(N):
    x,l = map(int,input().split())
    XL.append((x-l,x+l-1))

XL.sort(key=lambda x: x[1])

ans = 0
t = -10**10
for i in range(N):
    if t < XL[i][0]:
        ans += 1
        t = XL[i][1]
print(ans)

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

void func(string &s, int n, char c)
{
    for (int i = 0; i < n; ++i)
    {
        s.push_back(c);
    }
}

int main()
{
    int sx, sy, tx, ty;
    cin >> sx >> sy >> tx >> ty;
    int dx = tx - sx;
    int dy = ty - sy;

    string ans;
    func(ans, dx, 'R');
    func(ans, dy, 'U');
    func(ans, dx, 'L');
    func(ans, dy, 'D');
    func(ans, 1, 'D');
    func(ans, dx + 1, 'R');
    func(ans, dy + 1, 'U');
    func(ans, 1, 'L');
    func(ans, 1, 'U');
    func(ans, dx + 1, 'L');
    func(ans, dy + 1, 'D');
    func(ans, 1, 'R');
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, a, n) for(ll i = (ll)a; i < (ll)n; i++)
#define FORR(i, n) for(ll i = (ll)n - 1LL; i >= 0LL; i--)
#define rep(i, n) FOR(i, 0, n)
#define ALL(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
template <typename T> using V = vector<T>;

constexpr int Mod = 998244353;
constexpr int mod = 1e9 + 7;
constexpr ll inf = 1LL << 60;

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

/*-------------------------------------------*/

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

    int h, w;
    cin >> h >> w;
    V<string> a(h);
    queue<pair<int, int>> que;
    V<V<int>> d(h, V<int>(w, -1));
    rep(i, h) {
        cin >> a[i];
        rep(j, w) {
            if(a[i][j] == '#') {
                d[i][j] = 0;
                que.emplace(i, j);
            }
        }
    }
    const int dx[] = {0, 1, 0, -1};
    const int dy[] = {1, 0, -1, 0};
    int ans;
    while(!que.empty()) {
        int x = que.front().first, y = que.front().second;
        ans = d[x][y];
        que.pop();
        rep(i, 4) {
            int nx = x + dx[i];
            int ny = y + dy[i];
            if(nx < 0 || nx >= h || ny < 0 || ny >= w) continue;
            if(d[nx][ny] == -1) {
                d[nx][ny] = ans + 1;
                que.emplace(nx, ny);
            }
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 13456
k = int(input())
a, b = (int(x) for x in input().split())

ans = 'NG'

if k == 1 :
    ans = 'OK'
else :
    for i in range(a, b + 1):
        # print(i)
    
        if i % k == 0 :
            ans = 'OK'
            break

print(ans)

Measured memory_bytes: 9172
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
long long a[500001];
int main()
{
	long long n,k,sum=0;
	cin>>n>>k;
	for(int i=1;i<=n;i++) scanf("%lld",&a[i]);
	sort(a+1,a+n+1);
	for(int i=n-k;i>=1;i--) sum+=a[i];
	cout<<sum<<endl;
	return 0;
}


Measured memory_bytes: 1792
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
int main()
{
	lint x,i;
	cin>>x;
	for(i=0;i<114514;i++){
		lint ma=(i+1)*i/2;
		if(ma>=x){
			cout<<i<<endl;return 0;
		}
	}
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <cctype>
#define len length()
#define sz size()
#define rng(i, a, b) for(int i = a; i < b; i++)
#define rep(i, n) rng(i, 0, n)
#define srt(v) sort(v.begin(), v.end())
#define rev(s) reverse(s.begin(), s.end())
#define vi(a, n) vector<int> a(n)
#define vs(a, n) vector<string> a(n)
#define vc(a, n) vector<char> a(n)
#define psb(a) push_back(a)
#define ppb pop_back()
#define erc(S, i) S.erase(S.begin() + i)
#define ers(S, i, j) S.erase(S.begin() + i, S.begin() + j)
#define sp(n) cout << setprecision(n) << fixed
#define fst(s) s.at(0)
#define lst(s) s.at(s.len - 1)
using namespace std;

bool fnds(string s, char c){
    bool a=false;
    rep(i, s.len){
        if(s.at(i) == c){
            a=true;
            break;
        }
    }
    return a;
}

int main(){
    string S;
    cin >> S;
    string ans="Yes";
    if((!fnds(S,'N') && fnds(S,'S')) || (fnds(S,'N') && !fnds(S,'S')) || (!fnds(S,'W') && fnds(S,'E')) || (fnds(S,'W') && !fnds(S,'E'))) ans="No";
    cout << ans << endl;
    return 0;
}

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

#define ll long long

template<typename T> void drop(const T &x){cout<<x<<'\n';exit(0);}

void solve() {
  string a,b; cin >> a >> b;
  if(a.size()>b.size()) drop("GREATER");
  if(a.size()<b.size()) drop("LESS");
  if(a.size()==b.size()) {
    if(a.at(0) > b.at(0)) {
      drop("GREATER");
    } else if(a.at(0) < b.at(0)) {
      drop("LESS");
    } else {
      drop("EQUAL");
    }
  }

  return;
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int T=1;
  //cin >> T;
  while(T--) solve();

  return 0;
}


Measured memory_bytes: 3616
#include <stdio.h>
int main()
{
    int A,B;
    scanf("%d %d",&A,&B);
    if(A < 9 && A >= 0 && B >= 0 && B < 9){
        printf("Yay!\n");
    }else{
        printf(":(");
    }


    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
using ld=double;

int n,m;
ld p;
using Edge=int;
using Edges=vector<Edge>;
using Graph=vector<Edges>;
Graph g;
int tpow[15];
array<ld,15000000> table;
array<ld,1000000> dp;
ld solve(int st);
ld dfs(int inde,int mc,int st,int stt,array<int,14>& sts,array<int,14> &sttv){
    if(inde==n){
        if(mc==1) return 0;
        ld res=1.0;
        for(int i=0;i<mc;i++){
            if(i==0) res*=solve(sts[i])*table[sttv[i]+stt];
        }
        return res;
    }
    if(!((st>>inde)&1)) return dfs(inde+1,mc,st,stt,sts,sttv);
    ld res=0;
    
    for(int i=0;i<mc;i++){
        sts[i]|=(1<<inde);
        sttv[i]+=tpow[inde];
        res+=dfs(inde+1,mc,st,stt,sts,sttv);
        sttv[i]-=tpow[inde];
        sts[i]^=(1<<inde);
    }
    if(mc<=1){
    sts[mc]=(1<<inde);
    sttv[mc]+=tpow[inde];
    res+=dfs(inde+1,mc+1,st,stt,sts,sttv);
    
    sttv[mc]=0;
    sts[mc]=0;
    }
    return res;
}
ld solve(int st){
    if(dp[st]>-0.5) return dp[st];
    if(__builtin_popcount(st)<=1) return dp[st]=1.0;
    int stt=0;
    for(int i=0;i<n;i++){
        if((st>>i)&1) stt+=tpow[i];
    }
    array<int,14> sts;
    fill(sts.begin(),sts.end(),0);
    array<int,14> sttv;
    fill(sttv.begin(),sttv.end(),0);
    ld res=1.0-dfs(0,0,st,stt,sts,sttv);
    return dp[st]=res;
}
int main(){
    tpow[0]=1;
    for(int i=0;i<14;i++) tpow[i+1]=tpow[i]*3;
    fill(dp.begin(),dp.end(),-1);
    cin>>n>>m>>p;
    p/=100.;
    g.assign(n,Edges());
    for(int i=0;i<m;i++){
        int u,v;
        cin>>u>>v;
        u--,v--;
        g[u].push_back(v);
        g[v].push_back(u);
    }
    
    for(int i=0;i<(1<<n);i++){
        int sub=i;
        int it=0;
        for(int k=0;k<n;k++){
            if((i>>k)&1){
                it+=tpow[k];
            }
        }
        do{
            ld pc=1;
            for(int j=0;j<n;j++){
                if((sub>>j)&1){
                    for(int k=0;k<g[j].size();k++){
                        if(((i>>g[j][k])&1)&&(!((sub>>g[j][k])&1))){
                            pc*=p;
                        }
                    }
                }
            }
            int subt=0;
            for(int k=0;k<n;k++){
                if((sub>>k)&1){
                    subt+=tpow[k];
                }
            }
            table[it+subt]=pc;
            sub=(sub-1)&i;
        }while(sub!=i);
    }
    cout<<setprecision(15)<<fixed;
    cout<<solve((1<<n)-1)<<endl;
    return 0;
}


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

typedef long long ll;
using namespace std;
const ll m = 1e9 + 7;

int main() {
	int n; cin >> n;
	vector<int>vec(n);
	for (int i = 0; i < n; ++i) {
		cin >> vec[i];
	}
	int cnt = 0;
	sort(vec.begin(), vec.end());
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < i; ++j) {
			for (int k = 0; k < j; ++k) {
				if (vec[k] != vec[j] && vec[j] != vec[i] &&
					vec[k] + vec[j] > vec[i]) {
					cnt++;
				}

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

Measured memory_bytes: 3612
#include<bits/stdc++.h>
#define LL long long
using namespace std;
const int maxn=2e5+10;

typedef pair<int,pair<int,int> > triple;
int a[maxn];
int pos[maxn];
priority_queue<triple> q;
int D[maxn];
int dp[21][maxn];

int rmq(int l,int r)
{
    int c=(r-l)/2+1;
    int d=D[c];
    return min(dp[d][l],dp[d][r-2*((1<<d)-1)]);
}

void add(int l,int r)
{
    if(l>r)
        return ;
    int v=rmq(l,r-1);
    q.push(make_pair(-v,make_pair(l,r)));
}
int main()
{
    int n;
    scanf("%d",&n);
    for(int i=0;i<n;i++)
        scanf("%d",&a[i]),--a[i],pos[a[i]]=i;
    for(int i=1;i<=n;i++){
        int d=D[i-1];
        if(i>=1<<(d+1))d++;
        D[i]=d;
    }
    for(int i=0;i<n;i++)
        dp[0][i]=a[i];
    for(int d=1,len=2;d<=20;d++,len*=2){
        for(int i=0;i<n;i++){
            dp[d][i]=dp[d-1][i];
            if(i+len<n)
                dp[d][i]=min(dp[d-1][i],dp[d-1][i+len]);
        }
    }

    add(0,n-1);
    for(int i=0;i<n/2;i++){
        triple T=q.top();
        q.pop();
        int l=T.second.first,r=T.second.second;
        int v1=rmq(l,r-1);
        int pos1=pos[v1];
        int v2=rmq(pos1+1,r);
        int pos2=pos[v2];
        printf("%d %d ",v1+1,v2+1);
        add(l,pos1-1);
        add(pos1+1,pos2-1);
        add(pos2+1,r);
    }
    return 0;
}


Measured memory_bytes: 20856
#include<bits/stdc++.h>
using namespace std;
int main(){

	int a, b, c, d;
	cin>>a>>b>>c>>d;
	if(a == b && c == d || a == c && b == d || a == d || b ==c) cout<<"yes"<<endl;
	else cout<<"no"<<endl;
		
	
	return 0;
}



Measured memory_bytes: 3120
#include <iostream>
#include <vector>
#include <functional>
#include <algorithm>
#include <iomanip>
#include <math.h>
using namespace std;




int main() {
    
    int N, A, B;
    
    vector<long long> v;
    
    long long sum = 0;
	int count = 0;
    double ave;
	long long c = 0;
    bool v0_max = true;
	
    cin >> N;
    cin >> A;
    cin >> B;
    
	
	long long combination[N+1][N+1];
	
	for ( int i = 0; i <= N; i++ ) {
		for ( int j = 0; j <= i; j++ ) {
			
			if ( i == j || j == 0 ) { combination[i][j] = 1; }
			else {
				combination[i][j] = combination[i-1][j] + combination[i-1][j-1];
			}
		}
	}
	
	
    for ( int i = 0; i < N; i++ ) {
        long long l;
        cin >> l;
        v.push_back(l);
    }
    
    sort( v.begin(), v.end(), greater<long long>() );
    
    for ( int i = 0; i < A; i++ ) {
        sum += v[i];
		if ( i && v[i-1] != v[i] ) { v0_max = false; }
    }
    
	if ( v0_max ) {
		int count = 1;
		for ( int i = 1; i < v.size(); i++ ) {
			if ( v[i-1] == v[i] ) { count++; }
			else { break; }
		}
		
		for ( int i = A; i <= min(count,B); i++ ) {
			c += combination[count][i];
		}
	}
	else {
		int count1 = 1;
		int count2 = 0;
		for ( int i = A-1; i-1 >= 0; i-- ) {
			if ( i && v[i] == v[i-1] ) { count1++; }
			else { break; }
		}
		for ( int i = A; i < v.size(); i++ ) {
			if ( v[i] == v[i-1] ) { count2++; }
			else { break; }
		}
		
		c = combination[ count1 + count2 ][ count1 ];
	}
	
	
	
	
	
	
	
    
    ave = static_cast<double>(sum) / static_cast<double>(A);
    
    cout  << showpoint << fixed << setprecision(9) << ave << endl;
    
	
	
    cout << c << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define rep(i, n) for(int i=0; i<n; i++)
#define REP(i, n) for(int i=0; i<=n; i++)
#define repr(i, n) for(int i=n; i>0; i--)
#define REPR(i, n) for(int i=n; i>=0; i--)
const ll INF = 1e18;
const int INT_INF = 1e9;
const ll MOD = 1e9+7;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;

int N, A[200010];


int main() {
    cin >> N;
    rep(i, N) cin >> A[i];

    vector<int> lmax(N), rmax(N);
    lmax[0] = 0, rmax[N-1] = 0;

    for (int i = 1; i < N; i++) {
        lmax[i] = max(lmax[i-1], A[i-1]);
    }
    for (int i = N - 2; i>= 0; i--) {
        rmax[i] = max(rmax[i+1], A[i+1]);
    }

    //rep(i, N) cout << lmax[i] << " ";
    //cout << endl;
    //rep(i, N) cout << rmax[i] << " ";
    //cout << endl;

    for (int i = 0; i < N; i++) {
        cout << max(lmax[i], rmax[i]) << endl;
    }
}


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

int main() {
    int n;
    cin >> n;
    int a[n], count[n], on[n];
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        count[i] = 0;
        on[i] = 0;
    }
    on[0] = 1;
    count[0] = 1;
    int now = a[0]-1;
    int sum = 1;
    on[now] = 1;
    while (count[1] < 1) {
        if (on[1] == 1) {
            cout << sum << endl;
            return 0;
        }
        count[now]++;
        sum++;
        on[now] = (on[now]+1)%2;
        on[a[now]-1] = (on[a[now]-1]+1)%2;
        if (count[now] == 2) {
            cout << "-1" << endl;
            return 0;
        } else if (on[a[now]-1] == 0) {
            cout << "-1" << endl;
            return 0;
        }
        now = a[now]-1;
    }
}

Measured memory_bytes: 1536
#include<stdio.h>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<utility>
#include<memory>
#include<cmath>
#include<stack>
#include<tuple>
#include<numeric>
#include<cassert>

#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define pb push_back
#define DEBUG false

using namespace std;

using ll = long long;
using P = pair<int,int>;

const int mod=1e9+7,INF=1<<30;
const double EPS=1e-12,PI=3.1415926535897932384626;
const ll LINF=1LL<<60;
const int MAX_N= 200005;
const ll lmod = 1e9+7;

int main(){
  string S;
  cin >> S ;
  bool ans = false;
  rep(i,S.size()-1){
    if(S[i]=='A'&&S[i+1]=='C') ans = true;
  }
  if(ans) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
#[allow(dead_code)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(dead_code)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(dead_code)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        a: usize,
        p: usize
    }
    let n = 3 * a + p;
    let result = n / 2;
    println!("{}", result);
}


Measured memory_bytes: 4352
#include <iostream>
#include <cmath>
#include <set>
#include <string>
#include <algorithm>
#include <vector>
#include <bitset>
#include <iomanip>
#include <map>
#include <queue>
#include <numeric>

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;
using std::bitset;

#define rep(i,n)    for(int i=0; i<(int)n; i++)
#define reps(i,s,e) for(int i=s; i<(int)e; i++)
#define coutd(i) cout << std::fixed << std::setprecision(i)
typedef long double ld;
typedef long long ll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef std::pair<int, int> pii;
typedef std::pair<ll, ll> pll;

template<class T>
using Graph = vector<vector<T>>;

const int INT_BIG = 1<<28;

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

    vll As(N);
    rep(i, N) {
        ll x;
        cin >> x;
        As[i] = x;
    }
    ll min = std::abs(As[0]);
    // int minIndex = 0;
    ll sum = 0;

    int count = 0;
    rep(i, N) {
        if (As[i] <= 0) count++;
        sum += std::abs(As[i]);
        // cout << sum << endl;
        min = std::min(min, std::abs(As[i]));
    }

    // rep(i, N-1) {
    //     if (As[i] <= 0) {
    //         As[i] *= -1;
    //         As[i+1] *= -1;
            
    //         min = std::min(min, As[i]);
    //     }
    //     sum += As[i];
    // }

    // if (As[N-1] >= 0) {
    //     sum += As[N-1];
    // } else {
    //     if (min < -As[N-1]) {
    //         // cout << sum << endl;
    //         sum = sum - min - min - As[N-1];
    //     } else {
    //         sum += As[N-1];
    //     }
    // }
    cout << ((count % 2 == 0) ? sum : sum - 2*min) << endl;
}

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


int main() {
	int p[3] = {};
	string s[3];

	for (int i = 0; i < 3; i++) {
		cin >> s[i];
	}

	int turn = 0;

	while(true) {
		if (p[turn] == s[turn].length()) {
			char ans = 'A' + turn;
			cout << ans << endl;
			break;
		} 
		int prev = turn;
		turn = s[turn].at(p[turn]) - 'a';
		p[prev]++;

	}

	return 0;
}


Measured memory_bytes: 256
from collections import deque
H,W = map(int,input().split())
maze = []
for i in range(H):
    maze.append(input())
q = deque()
saitan = [1000000]*H*W
for i in range(H):
    for k in range(W):
        if maze[i][k] == '#':
            q.append(i*W+k)
            saitan[i*W+k] = 0
len_q = len(q)

#print(start)
def bfs(h,w,q,Saitan,len_Q):
    
    dx = [1,-1,0,0]
    dy = [0,0,1,-1]
    while len(q)>0 and len_Q < h * w:
        j = q.popleft()
        y = int(j/w)
        x = j%w
        #print(saitan)
        for k in range(4):
            my = y + dy[k]
            mx = x + dx[k]
            #print(sx,sy,j,x,y,mx,my)
            if not((0 <=my <= h-1) and (0 <= mx <= w-1)):
                #print('q')
                continue
            if saitan[(my*w + mx)] <= saitan[y*w + x] + 1:
                #print('c')
                continue
                
            saitan[(my*w + mx)] = saitan[y*w + x] + 1
            q.append(my*w + mx)
            len_Q += 1
            #Sumi.append(my*w + mx)
    return max(saitan)

print(bfs(H,W,q,saitan,len_q))
#print(saitan)

Measured memory_bytes: 79580
#ifndef LOCAL
#pragma GCC optimize("O3")
#endif
#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);
typedef long long ll;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> indexed_set; 
const ll INF = 1e9 + 10 ;
const int N = 110 ; 
int main(){
    fastio
    string s ; 
    cin >> s ; 
    int n = (int) s.size() ;
    for(int i = 0; i < n; i += 2){
        if ( s[i] == 'L' ) return cout << "No" << endl , 0;
    }
    for(int i = 1; i < n; i += 2){
        if ( s[i] == 'R' ) return cout << "No" << endl , 0;
    }
    cout << "Yes" << endl;
    return 0 ;
}





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

using namespace std;

int main()
{
    int n;
    cin>>n;
    long long int a[n],s=0;
    for(int i=0;i<n;i++)
    {cin>>a[i];}
    for(int i=0;i<n-1;i++)
    {
        if(a[i]>a[i+1])
        {
            s+=(a[i]-a[i+1]);
            long long int t=a[i+1];
            a[i+1]=a[i];
        }
    }
    cout<<s<<endl;

}


Measured memory_bytes: 5184
#include<bits/stdc++.h>
using namespace std;
#define int long long
int INF = 1e9+7;
typedef pair<int,int> P;
signed main(){
    int H,N;
    cin >> H >> N;
    vector<int>A(N);
    vector<int>B(N);
    vector<int>dp(H+1,INF);
    dp[0] = 0;
    for(int i = 0; i < N; i++) {
        cin >> A[i] >> B[i];
    }
    for(int i = 0; i < N; i++) {
        for(int j = 0; j < H+1; j++) {
            dp[min(j+A[i],H)] = min(dp[min(j+A[i],H)],dp[j]+B[i]);
        }
    }
    cout << dp[H] <<endl;
}

Measured memory_bytes: 384
#include<iostream>
#include<string>
#include<iostream>
#include<algorithm>
using namespace std;
int main() {
	string a;
	cin >> a;
	int b[4];

	b[0] = a[0] - '0';
	b[1] = a[1] - '0';
	b[2] = a[2] - '0';
	b[3] = a[3] - '0';
	sort(b, b + 4);
	if (b[0] == b[2])cout << "Yes" << endl;
	else cout << "No" << endl;
}


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

int main()
{
    ll X;
    cin >> X;

    ll money = 100;
    ll count = 0; 

    while(money < X)
    {
        money *= 1.01;
        count++;
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 3636
def main():
    n = int(input())
    *P, = map(int, input().split())

    def is_second_biggest(p0, p1, p2):
        return p1 != min(p0, p1, p2) and p1 != max(p0, p1, p2)

    cnt = 0
    for i in range(n-2):
        if is_second_biggest(P[i], P[i+1], P[i+2]):
            cnt += 1
    
    print(cnt)


main()

Measured memory_bytes: 3060
import java.util.Scanner;

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

		if (a % x == 0) {
			System.out.println(Math.floorDiv(b, x) - Math.floorDiv(a, x) + 1);
		} else {
			System.out.println(Math.floorDiv(b, x) - Math.floorDiv(a, x));
		}
	}
}


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

using namespace std;

using int64 = long long;

int main()
{
  int H, W, C[10][10];

  cin >> H >> W;
  for(int i = 0; i < 10; i++) {
    for(int j = 0; j < 10; j++) {
      cin >> C[i][j];
    }
  }

  for(int k = 0; k < 10; k++) {
    for(int i = 0; i < 10; i++) {
      for(int j = 0; j < 10; j++) {
        C[i][j] = min(C[i][j], C[i][k] + C[k][j]);
      }
    }
  }

  long long ret = 0;
  for(int i = 0; i < H; i++) {
    for(int j = 0; j < W; j++) {
      int x;
      cin >> x;
      if(~x) ret += C[x][1];
    }
  }

  cout << ret << endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i < n; ++i)
using namespace std;
 
int main() {
    int N,p;
    p=0;
    cin >> N;
    vector<int> A(N), B(N), C(N-1);
 
    rep(i, N) cin >> A[i];
    rep(i, N) cin >> B[i];
    rep(i, N - 1) cin >> C[i];

    rep(i,N){
        p += B[A[i]-1];
        if (A[i] + 1 == A[i + 1]){p += C[A[i]-1];}
    }
    cout << p << endl;
    return 0;
}

Measured memory_bytes: 256
n,m = map(int,input().split())
bottom = 0
up = 1000000
for i in range(m):
    l,r = map(int,input().split())
    if l > bottom:
        bottom = l
    if r < up:
        up = r
if up-bottom+1 >= 0:
    print(up-bottom+1)
else:
    print("0")

Measured memory_bytes: 3060
N = int(input())
A = list(map(int, input().split()))
S = sum(A)
ans = float("INF")
LS = [0]*(N+1)
LS[0] = 0
for i in range(N-1):
  LS[i+1] = A[i] + LS[i]
  ans = min(ans, abs(LS[i+1] - (S - LS[i+1])))
print(ans)

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

int main(){
    int n,ans = 0;
    cin >> n;
    int a[n];
    for(int i = 0;i < n;i++)cin >> a[i];
    for(int i = 0,k = 0;i < n;i++){
        if(a[k] == 2){
            ans = i+1;
            break;
        }
        k = a[k]-1;
    }
    if(ans == 0)cout << -1;
    else cout << ans;
    
}

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

int main()
{
 
 int n; cin>>n;
 vector<pair<int,int>> a(n);
 
 for(int i=0;i<n;i++)
 {
     int x;
     cin>>x;
     a[i]=make_pair(x,i+1);
 }
 
 sort(a.begin(),a.end());
 for(int i=0;i<n;i++)
 {
     cout<<a[i].second<<" ";
 }

}

Measured memory_bytes: 1536
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
#include<complex>
using namespace std;
 
#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)
 
typedef long long ll;
const ll INF = 1e17;
const ll MOD = 998244353;
const ll MAX = 4000001;
const long double eps = 1E-14;
 
ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}
 
ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}
 
ll gcd(ll a, ll b) {
	if (b == 0) { return a; }
	if (a < b) { return gcd(b, a); }
	return gcd(b, a % b);
}
 
ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}
 
struct edge {
	ll ind;
	ll fr;
	ll to;
	ll d;
};
 
class mint {
	long long x;
public:
	mint(long long 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;
	}
 
	friend ostream& operator<<(ostream& os, const mint& m) {
		os << m.x;
		return os;
	}
};
 
mint pw(mint a, ll b) {
	if (b == 0) { return 1; }
	mint ret = pw(a, b >> 1);
	ret *= ret;
	if (b & 1) { ret *= a; }
	return ret;
}
 
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;
 
typedef vector<mint> vmint;
typedef vector<vector<mint>> vvmint;
typedef vector<vector<vector<mint>>> vvvmint;
 
//////////////////////////////////////
 
string op(string s, ll x) {
	ll N = s.size();
	string t(N,'.');
	rep(i, N - x)t[i] = s[i + x];
	rep(i, x)t[N - x + i] = s[N - 1 - i];
 
	//cout << t << endl;
	return t;
}
 
int main() {
	ll N, K;
	string S;
	cin >> N >> K >> S;
 
	char top = 'z';
	rep(i, N) top = min(top, S[i]);
 
	string ans = S;
 
	rep(i, N+1) {
		string T = op(S, i);
 
		rep(k, min(K,30)-1) {
			ll x = 0;
			for (ll j = N ; j >= 1; j--) {
				if (T[j - 1] != top) { x = j; break; }
			}
			//cout << x << endl;
 
			if (x == 0) { break; }
			T = op(T, N-x);
		}
 
		reverse(T.begin(), T.end());
		ans = min(ans, T);
	}
 
	cout << ans << endl;
}

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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define all(a) (a).begin(), (a).end()
#define bit32(x) (1 << (x))
#define bit64(x) (1ll << (x))
#define sz(v) ((int) v.size())

using namespace std;

using i64 = long long;
using f80 = long double;
using vi32 = vector<int>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

void yes() { cout << "Yes" << endl; exit(0); }
void no() { cout << "No" << endl; exit(0); }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> void amax(T &x, T y) { x = max(x, y); }
template <typename T> void amin(T &x, T y) { x = min(x, y); }
template <typename T> T exp(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { for (auto &x : v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }

const int INF = 1001001001;
const double EPS = 0.000000001;
const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};

void solve() {
  int n;
  cin >> n;
  vi32 x(n), y(n);
  rep(i, n) {
    cin >> x[i] >> y[i];
  }
  rep(i, n) {
    vector<double> angles;
    rep(j, n) if (i != j) {
      angles.push_back(atan2(y[j] - y[i], x[j] - x[i]));
    }
    sort(all(angles));
    angles.push_back(angles[0] + 2 * M_PI);
    double ma = 0;
    rep(j, sz(angles) - 1) {
      amax(ma, angles[j + 1] - angles[j]);
    }
    double ans = (ma > M_PI ? (ma - M_PI) / 2 / M_PI : 0.0);
    cout << ans << endl;
  }
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int m = scanner.nextInt();
        Node root = null;
        for (int i = 0; i < m; i++) {
            String cmd = scanner.next();
            if ("insert".equals(cmd)) {
                Node node = new Node(scanner.nextInt());
                if (root == null) {
                    root = node;
                    continue;
                }
                insert(root, node);
            } else if ("find".equals(cmd)) {
                System.out.println(doesContain(root, scanner.nextInt())? "yes" : "no");
            } else {
                StringBuilder sb = new StringBuilder();
                root.inOrder(sb);
                sb.append("\n");
                System.out.print(sb.toString());
                sb = new StringBuilder();
                root.preOrder(sb);
                sb.append("\n");
                System.out.print(sb.toString());
            }
        }

    }

    private static boolean doesContain(Node node, int k) {
        while (node != null && node.key != k) {
            if (k < node.key) {
                node = node.left;
            } else {
                node = node.right;
            }
        }
        return node != null;
    }

    private static void insert(Node root, Node node) {
        Node parent = root;
        while (true) {
            if (node.key < parent.key) {
                if (parent.left == null) {
                    parent.left = node;
                    break;
                }
                parent = parent.left;
            } else {
                if (parent.right == null) {
                    parent.right = node;
                    break;
                }
                parent = parent.right;
            }
        }
    }

    private static class Node {
        int key;
        Node parent;
        Node left;
        Node right;

        private Node(int key) {
            this.key = key;
        }

        private void inOrder(StringBuilder sb) {
            if (left != null) {
                left.inOrder(sb);
            }
            sb.append(" " + String.valueOf(key));
            if (right != null) {
                right.inOrder(sb);
            }
        }

        private void preOrder(StringBuilder sb) {
            sb.append(" " + String.valueOf(key));
            if (left != null) {
                left.preOrder(sb);
            }
            if (right != null) {
                right.preOrder(sb);
            }
        }
    }
}

Measured memory_bytes: 314340