akhauriyash/Code-Regression huggingface dataset:
import itertools
list(itertools.permutations(range(4)))
n = int(input())
p = list(map(int, input().split()))
q = list(map(int, input().split()))

l = list(itertools.permutations(range(1, n+1)))

for i in range(len(l)):
  if list(l[i]) == p:
    a = i
  if list(l[i]) == q:
    b = i    
  
print(abs(a-b))
   

Measured memory_bytes: 8052
// https://atcoder.jp/contests/abc103/tasks/abc103_d

#include <bits/stdc++.h>

using namespace std;

#define REP(i,n)   for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for(int i=(b); i<=(int)(e); i++)
#define DUMP(a, n) REP(_i, n) printf("%d%c", a[_i], _i + 1 == n ? '\n' : ' ')
#define DUMP2D(a, n, m) REP(_i, n) REP(_j, m) printf("%d%c", a[_i][_j], _j + 1 == m ? '\n' : ' '); puts("")

const int N_MAX = 1e5;
const int M_MAX = 1e5;

int N, M;
int a[M_MAX];
int b[M_MAX];

pair<int, int> itv[M_MAX];

void solve() {
  REP(i, M) {
    itv[i].first = b[i];
    itv[i].second = a[i];
  }
  sort(itv, itv + M);

  int ans = 0;
  int t = 0;

  REP(i, M) {
    if (t <= itv[i].second) {
      ans++;
      t = itv[i].first;
    }
  }

  printf("%d\n", ans);
}

void input() {
  scanf("%d%d", &N, &M);
  REP(i, M) scanf("%d%d", a + i, b + i);
}

int main() {
  input();
  solve();
  return 0;
}


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

#define endl '\n'

// #define int long long

typedef long long ll;
typedef long double ld;

typedef vector<int> vi;
typedef pair<int, int> pii;

const int INF = 1000000000;
const int MOD = 1000000007; // 998244353

signed main() {  
   ios::sync_with_stdio(false);
   cin.tie(nullptr);
   int n, m;
   cin >> n >> m;
   cout << (n == m ? "Yes" : "No") << endl;  
   return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <numeric>
#include <vector>
#include <functional>

void brute() {
    int n;
    std::cin >> n;
    int k = (n + 1) / 2;
    std::cerr << n << " " << k << std::endl;

    std::vector<int> xs(n * 3);
    std::iota(xs.begin(), xs.end(), k);

    std::vector<bool> used(n * 3, false);
    std::vector<int> ans;
    std::function<void(int)> dfs = [&](int d) {
        if (d == 0) {
            for (int i = 0; i < n; ++i) {
                std::cout << ans[i * 3] << " "
                          << ans[i * 3 + 1] << " "
                          << ans[i * 3 + 2] << std::endl;
            }
            std::exit(0);
        }
        int i;
        for (i = 0; i < n * 3; ++i) {
            if (!used[i]) break;
        }
        for (int k = i + 1; k < n * 3; ++k) {
            if (used[k]) continue;
            for (int j = i + 1; j < k; ++j) {
                if (used[j]) continue;
                if (xs[i] + xs[j] > xs[k]) continue;

                ans.push_back(xs[i]);
                ans.push_back(xs[j]);
                ans.push_back(xs[k]);
                used[i] = used[j] = used[k] = true;

                dfs(d - 1);

                used[i] = used[j] = used[k] = false;
                for (int p = 0; p < 3; ++p) ans.pop_back();
            }
        }
    };
    dfs(n);
}

void solve() {
    int n, k;
    std::cin >> n >> k;
    if (k > (n + 1) / 2) {
        std::cout << -1 << std::endl;
        return;
    }

    int m = (n + 1) / 2;
    for (int i = 0; i < m; ++i) {
        std::cout << k + i << " "
                  << k + n * 2 - m + i << " "
                  << k + n * 2 + i * 2 << std::endl;
    }
    for (int i = 0; i < n - m; ++i) {
        std::cout << k + m + i << " "
                  << k + n + i << " "
                  << k + n * 2 + i * 2 + 1 << std::endl;
    }
}

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

    // brute();
    solve();

    return 0;
}


Measured memory_bytes: 2304
#include<stdio.h>

int main(void){

int a,b,c,d;

scanf("%d %d %d %d",&a,&b,&c,&d);

while(1){
c = c - b;
a = a - d;
if(c <= 0){
  printf("Yes\n");
  break;
}else if(a <= 0){
    printf("No\n");
    break;
}

}

return 0;
}


Measured memory_bytes: 1648
<?php

$sum = 0;
while (true) {
    $s = rtrim(fgets(STDIN));
    if (feof(STDIN)) {
        break;
    }
    if (preg_match_all('/[0-9]+/', $s, $a)) {
        foreach ($a[0] as $v) {
            $sum += (int) $v;
        }
    }
}

echo $sum . PHP_EOL;

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


signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
 
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    bool used[101]={};
    vector<int> v;
    int l = 0, r = 0;
    for(int i=0;i<n;i++){
        if(a[i]>0){
            if(used[a[i]]){
                cout << i+1 << endl;
                return 0;
            }
            if(v.size()==r){
                v.push_back(a[i]);
                used[a[i]]=1;
                r++;
            }
            else{
                v[r]=a[i];
                used[a[i]]=1;
                r++;
            }
        }
        else{
            a[i] = -a[i];
            if(!used[a[i]]){
                cout << i+1 << endl;
                return 0;
            }
            if(v[r-1]==a[i]){
                r--;
                used[a[i]]=false;
            }
            else{
                cout << i+1 << endl;
                return 0;
            }
        }
    }
    cout << "OK\n";
    
}


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

int main(){
  int H, W;
  cin >> H >> W;
  char C[H][W];
  for(int i=0; i<H; i++){
    for(int j=0; j<W; j++) cin >> C[i][j];
  }
  for(int i=0; i<H*2; i++){
    for(int j=0; j<W; j++) cout << C[i/2][j];
    cout << endl;
  }
}

Measured memory_bytes: 384
///بِسْمِ الّٰلهِ الرَّحْمٰنِ الرَحِيْمِ
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pi acos(-1.0)
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll int i,n,t,j=0,p,x,a=0,b,l=0,r=0,y,k,c,sum=0,m,d,z;
    cin>>a>>b>>c;
    p=a/b;
    if(a%b){
        p++;
    }
    cout<<p*c<<endl;
    return EXIT_SUCCESS;
}



Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define cina(a, n) for (int i = 0; i < n; ++i){ cin >> a[i]; }
#define ll long long
#define ld long double

using namespace std;

int main () {
	
	int x, n, p[102];
	memset(p, 0, sizeof(p));
	cin >> x >> n;
	for (int i = 0; i < n; ++i) {
		int s;
		cin >> s;
		p[s] = 1;
	}
	int i = 0;
	while (1) {
		if (p[x-i] == 0) {
			cout << x-i;
			break;
		} else if(p[x+i] == 0) {
			cout << x+i;
			break;
		}
		i++;
	}
	return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0;i<(n);i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
const ll INF = 1LL << 60;

int main() {
    
    ll D,T,S;
    cin >> D >> T >> S;

    if(D <= (T*S)){
        cout << "Yes" << endl;
        return 0;
    }

    cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 3628
#include <iostream>
#include <algorithm>

using namespace std;

int cnt[4];

int main(void)
{
	int a, b;
	for(int i = 0; i < 3; i++){
		cin >> a >> b;
		a--, b--;
		cnt[a]++, cnt[b]++;
	}
	sort(cnt, cnt+4);
	
	if(cnt[0] == 1 && cnt[1] == 1 && cnt[2] == 2 && cnt[3] == 2) cout << "YES" << endl;
	else cout << "NO" << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int n = stdIn.nextInt();
		int[]d = new int[n];
		for(int i = 0; i < n; i++) {
			d[i] = stdIn.nextInt();
		}
		
		Arrays.parallelSort(d);
		long cnt = 0;
		
		for(int i = d[n/2-1]+1; i <=d[n/2];i++) {
			cnt++;
		}
		
		System.out.println(cnt);
		
	}

}


Measured memory_bytes: 50260
def func(n):
    if n == N:
        p = 0
        for c in count:
            if c == 0:
                return
            p += 10 * (c - 1)
        p += abs(length[0] - A)
        p += abs(length[1] - B)
        p += abs(length[2] - C)
        global ans
        if p < ans:
            ans = p
    else:
        count[0] += 1
        length[0] += l[n]
        func(n + 1)
        count[0] -= 1
        length[0] -= l[n]
        count[1] += 1
        length[1] += l[n]
        func(n + 1)
        count[1] -= 1
        length[1] -= l[n]
        count[2] += 1
        length[2] += l[n]
        func(n + 1)
        count[2] -= 1
        length[2] -= l[n]
        func(n + 1)


N, A, B, C = map(int, input().split())
l = [int(input()) for _ in range(N)]

ans = 3000
count = [0, 0, 0]
length = [0, 0, 0]
func(0)
print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <cstdint>
#include <map>
 
using namespace std;
typedef long long ll;

ll ans,mx,mn=1e10,sum;
int main(){
	ll n;
	cin>>n;
	ll k=n;
	while(n!=0){
		sum += n%10;
		n /=10;
	}
	//cout<<sum<<endl;
	if(k%sum==0)cout<<"Yes";
	else cout<<"No";
} 

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

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

    int n, m;
    cin >> n >> m;
    vector<int> A[m];
    for(int i = 0; i < m; i++){
        int k;
        cin >> k;
        for(int j = 0; j < k; j++){
            int s;
            cin >> s;
            A[i].push_back(s - 1);
        }
    }
    vector<int> P(m);
    for(int i = 0; i < m; i++){
        cin >> P[i];
    }

    int ans = 0;
    for(int i = 0; i < (1 << n); i++){
        vector<int> OK;
        for(int j = 0; j < n; j++){
            if((i >> j) & 1){
                OK.push_back(j);
            }
        }
        int ccnt = 0;
        for(int j = 0; j < m; j++){
            int cnt = 0;
            for(int l = 0; l < A[j].size(); l++){
                for(int g = 0; g < OK.size(); g++){
                    if(OK[g] == A[j][l]){
                        cnt++;
                        break;
                    }
                }
            }
            if(cnt % 2 == P[j]){
                ccnt++;
            }
        }
        if(ccnt == m){
            ans++;
        }
    }

    cout << ans << endl;

    

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    ll i;
    string str;
    cin>>str;
    for(i=0;i<str.length()-1;i++){
        if(str[i]==str[i+1]){
            cout<<"Bad"<<endl;
            return 0;
        }
    }
    cout<<"Good"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <map>
#include <queue>
#define rep(i,n) for (ll i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
#define P_B push_back
#define PO_B pop_back
#define E_B emplace_back
#define fi first
#define se second
#define debug(x) cout << #x << ": " << x << endl

using namespace std;
using ll = long long;
using Pii = pair<int,int>;
using Pll = pair<ll,ll>;
using VI = vector<int>;
using VL = vector<ll>;
using VVI = vector<vector<int> >;
using VVL = vector<vector<ll> >;
//int dx[4] = {1, 0, -1, 0};
//int dy[4] = {0, 1, 0, -1};
const ll LINF = (ll)1e18 - 1;
//const int INF = 1e9 - 1;

bool judge(VL &s, VL &h, ll x) {
  int n = s.size();
  VL t(n);
  rep(i, n) {
    if (x < h[i]) return false;
    t[i] = (x - h[i]) / s[i];
  }
  sort(all(t));
  rep(i, n) {
    if (t[i] < i) return false;
  }
  return true;
}


void Main(){

  ll N, ans;
  cin >> N;
  vector<ll> A(N), B(N), C(N), bcsum(N+1);

  rep(i, N) cin >> A[i];
  rep(i, N) cin >> B[i];
  rep(i, N) cin >> C[i];

  sort(all(A));
  sort(all(B));
  sort(all(C));
;
  bcsum[N] = 0;
  for(int i = N-1; i >= 0; i--){
    bcsum[i] = N - distance(C.begin(), upper_bound(C.begin(), C.end(), B[i])) + bcsum[i+1];
  }

  ans = 0;
  rep(i, N){
    ans += bcsum[distance(B.begin(), upper_bound(B.begin(), B.end(), A[i]))];
  }

  cout << ans << endl;


}

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

  return 0;
}


Measured memory_bytes: 3456
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,h,k;
  cin >> a >> b >> h >> k;
  long double rad=((long double)h/12.0+((long double)k/60.0)/12.0-(long double)k/60.0);
  long double ans=(long double)sqrt(a*a+b*b-(long double)2.0*a*b*cos(2*rad*M_PI));
  printf("%.10Lf",ans);
}
  
              

Measured memory_bytes: 4084
#include <iostream>
using namespace  std;
int n;
double i,j,l,k;
int main() 
{
  cin>>n;
  l=n;
  if(n % 2==0)
  {
    k=n/2;
  }
  else
  {
    k=n/2+1;
  }
  
  cout<<k/l;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define inf 1000000000
#define eb emplace_back
#define pb push_back
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
int grid[101][101],dp[101][101];
int main()
{
    int i,j,k;
    int r,c;
    char str[101];
    scanf("%d %d",&r,&c);
    for(i=0;i<r;i++){
        scanf("%s",str);
        for(j=0;j<c;j++)
            grid[i][j]=str[j];
    }
    for(i=0;i<r;i++)
        dp[i][c]=inf;
    for(j=0;j<c;j++)
        dp[r][j]=inf;
    for(i=r-1;i>=0;i--){
        for(j=c-1;j>=0;j--){
            int temp1=(grid[i][j]=='#')+dp[i+1][j];
            int temp2=(grid[i][j]=='#')+dp[i][j+1];
            if(grid[i][j]=='#' && grid[i+1][j]=='#')
                temp1--;
            if(grid[i][j]=='#' && grid[i][j+1]=='#')
                temp2--;
            dp[i][j]=min(temp1,temp2);
            dp[r-1][c-1]=(grid[r-1][c-1]=='#');
        }
    }
    printf("%d\n",dp[0][0]);
}


Measured memory_bytes: 384
n = list(map(str,input().split()))
stack = []
for i in n:
    if i.isnumeric():
        stack.append(i)
    else:
        x_1 = stack.pop()
        x_2 = stack.pop()
        tmp = eval(x_2 + i + x_1)
        stack.append(str(tmp))
else:
    print(stack.pop())



Measured memory_bytes: 5564
integer(8) N
integer(8),allocatable,dimension(:)::a,b
integer(8) med_l,med_b
read*,N
allocate(a(N),b(N))
read*,a
b=a
call heapsort(n,b)
med_l=b(N/2)
med_b=b(N/2+1)

do i=1,N
  if(a(i)<=med_l)then
    print"(i0)",med_b
  else
    print"(i0)",med_l
  endif
end do

contains

subroutine heapsort(n,array)
  implicit none
!ここの入力は状況に応じて変更すること
  integer(8),intent(in) :: n
  integer(8),intent(inout) :: array(1:n)
  integer(8)::i,k,j,l
  integer(8):: t

  l=n/2+1
  k=n
  do while(k /= 1)
     if(l > 1)then
        l=l-1
        t=array(L)
     else
        t=array(k)
        array(k)=array(1)
        k=k-1
        if(k == 1) then
           array(1)=t
           exit
        endif
     endif
     i=l
     j=l+l
     do while(j<=k)
        if(j < k)then
           if(array(j) < array(j+1))j=j+1
        endif
        if (t < array(j))then
           array(i)=array(j)
           i=j
           j=j+j
        else
           j=k+1
        endif
     enddo
     array(i)=t
  enddo
  return
end subroutine heapsort

end

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


int main() {
    int K,X;
    cin >> K >> X;
    int st = X - K + 1;
    int ed = X + K - 1;

    for(int i = st; i < ed + 1; i++){
        cout << i << " ";
    }

    cout << endl;



}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)n; i++)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<pi, pi> pp;
typedef pair<ll, ll> pl;
const double EPS = 1e-9;
const ll MOD = 1000000007;
const int inf = 1 << 30;
const ll linf = 1LL << 60;

int n, m;
int st, en;
int dist[300000];
vector<int> e[300000];

int main() {
    cin >> n >> m;
    rep(i,m) {
        int u, v; cin >> u >> v;
        u--; v--;
        e[u].push_back(v);
    }
    cin >> st >> en;
    st--; en--;
    fill(dist, dist+3*n, inf);
    queue<int> que;
    dist[st] = 0;
    que.push(st);
    while (!que.empty()) {
        int p = que.front(); que.pop();
        int x = p/n, y = p%n;
        for (int to : e[y]) {
            to += ((x+1)%3)*n;
            if (dist[to] > dist[p] + 1) {
                dist[to] = dist[p] + 1;
                que.push(to);
            }
        }
    }
    cout << ((dist[en]==inf)?-1:dist[en]/3) << endl;
}

Measured memory_bytes: 11520
#include "iostream"
#include "cstdio"
#include "cstring"
#include "cstdlib"
#include "cmath"
#include "cctype"
#include "algorithm"
#include "ctime"
#include "iomanip"
#include "set"
#include "queue"
#include "map"
#include "vector"
#include "stack"
#include "deque"
#define R register
#define INF 0x3f3f3f3f
#define debug(x) printf("debug:%lld\n",x)
#define debugi(x) printf("debug:%d\n",x)
#define debugf(x) printf("debug:%llf\n",x)
typedef long long lxl;
const lxl maxn=20;
lxl n;
lxl a[maxn];
inline lxl read()
{
	char c=getchar();
	lxl f=1,x=0;
	for(;!isdigit(c);(c=='-')&&(f=-1),c=getchar());
	for(;isdigit(c);x=(x<<1)+(x<<3)+(c^48),c=getchar());
	return f*x;
}
lxl f(lxl l,lxl r,lxl x,lxl y)
{
	if(r-l<=1)return 0;
	lxl ans=1e20;
	for(R int i(l+1);i<=r-1;ans=std::min(ans,f(l,i,x,x+y)+f(i,r,x+y,y)+a[i]*(x+y)),++i);
	return ans;
}
int main(void)
{
	n=read();
	for(R int i(1);i<=n;a[i]=read(),++i);
	printf("%lld\n",a[1]+a[n]+f(1,n,1,1));
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
typedef long long ll;
typedef pair<int, int> P;
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
ll N, Q;
vector<vector<ll>> tree;
vector<ll> counter;
void dfs(int from, int now, int score) {
  score += counter[now];
  counter[now] = score;
  for(ll next : tree[now]){
    if (next != from) dfs(now, next, score);
  }
}
int main() {
  cin >> N >> Q;
  tree.resize(N);
  counter.resize(N, 0);
  REP(i, N - 1) {
    int a, b;
    cin >> a >> b, a--, b--;
    tree[a].push_back(b);
    tree[b].push_back(a);
  }
  REP(i, Q) {
    int p, x;
    cin >> p >> x, p--;
    counter[p] += x;
  }
  dfs(-1, 0, 0);
  REP(i, N) {
    if (1 <= i) cout << " ";
    cout << counter[i];
  }
  cout << endl;
}

Measured memory_bytes: 24320
n, k, q = map(int, input().split())
a = [int(input()) for _ in range(q)]
ans = [k - q] * n

for i in range(q):
    ans[a[i] - 1] += 1

for t in ans:
    if t > 0:
        print("Yes")
    else:
        print("No")


Measured memory_bytes: 81008
#include<cstdio>
using namespace std;
int n, a, b, p;
int ans[1001010];
int x, y, r;
int cal(int x, int y){
    return (x+y-1) / y;
}
int main(){
    scanf("%d%d%d", &n, &a, &b);
    if(a == 1 && b != n){
        printf("-1");
        return 0;
    }
    if(b == 1 && a != n){
        printf("-1");
        return 0;
    }
    if(a == 1){
        for(int i = n; i >= 1; i --)
            printf("%d ", i);
        return 0;
    }
    if(b == 1){
        for(int i = 1; i <= n; i ++)
            printf("%d ", i);
        return 0;
    }
    if(a+b > n+1){
        printf("-1");
        return 0;
    }
    if(cal(n-a, b-1) > a){
        printf("-1");
        return 0;
    }
    int cnt = n - a;
    x = (cnt-b+1) / (a-1);
    y = (cnt-b+1) % (a-1);
    int r1, r2 = n - a;
    for(int i = cnt+1; i <= n; i ++){
        ans[++p] = i;
    }
    for(int i = 1; i <= x; i ++){
        r1 = r2 - a + 1;
        for(int j = r1; j <= r2; j ++){
            ans[++p] = j;
        }
        r2 -= a;
    }
    r1 = r2 - y;
    for(int i = r1; i <= r2; i ++)
        ans[++p] = i;
    for(int i = r1 - 1; i >= 0; i --)
        ans[++p] = i;

    for(int i = 1; i <= n; i ++)
        printf("%d ", ans[i]);
    return 0;
}

Measured memory_bytes: 3328
#include<cmath>
#include<cstdio>
#include<algorithm>
using namespace std;
const int N=3010;
const double pi=acos(-1.0);
int n,L,t[N];
double ansx,ansy;
int main(){
	scanf("%d%d",&n,&L);
	for(int i=1;i<=n;i++)
		scanf("%d",t+i);
	for(int i=1;i<=n;i++){
		for(int j=i+1;j<=n;j++){
			if(i!=j){
				double tmp=pi*(t[i]+t[j])/L;
				ansx+=cos(tmp)*(n-(j-i-1)-2)-cos(tmp)*(j-i-1),ansy+=sin(tmp)*(n-(j-i-1)-2)-sin(tmp)*(j-i-1);
			}
		}
	}
	printf("%.9lf %.9lf",ansx/n/(n-1)/(n-2)*6,ansy/n/(n-1)/(n-2)*6);
	return 0;
}

Measured memory_bytes: 128
#ifdef DEBUG

#else

#    pragma GCC optimize("O3,no-stack-protector")
#    pragma GCC optimize("unroll-loops")

#    if __cplusplus >= 201703L
#        pragma GCC target("avx2")
#    else
#        pragma GCC target("avx")
#    endif

#endif
// 実数の場合
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
typedef int64_t Int;
typedef long double Ld;

using namespace std;
using Graph = vector<vector<Int>>;

const double pi = M_PI;
const Int MOD = 1000000007;

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

    int a, b, c;
    cin >> a >> b >> c;

    if (a == b) {
        cout << c << endl;
    } else if (b == c) {
        cout << a << endl;
    } else {
        cout << b << endl;
    }

    return 0;
}


Measured memory_bytes: 256
# Problem C - City Savers

# input
N = int(input())
a_nums = list(map(int, input().split()))
b_nums = list(map(int, input().split()))

# initialization
ans_monsters = 0

# count
for i in range(len(b_nums)):
    # round 1
    if b_nums[i]>=a_nums[i]:
        ans_monsters += a_nums[i]
        b_nums[i] -= a_nums[i]
    else:
        ans_monsters += b_nums[i]
        b_nums[i] = 0

    # round 2
    if b_nums[i]>0:
        if b_nums[i]>=a_nums[i+1]:
            ans_monsters += a_nums[i+1]
            a_nums[i+1] = 0
        else:
            ans_monsters += b_nums[i]
            a_nums[i+1] -= b_nums[i]

# output
print(ans_monsters)


Measured memory_bytes: 18752
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define VSORT(v) sort(v.begin(), v.end());
#define VREV(v) reverse(v.begin(), v.end());
using namespace std;
using ll = long long;
using pll = pair<ll,ll>;
using vll = vector<ll>;
using vdouble = vector<double>;
using vstr = vector<string>;
typedef pair<int,int> P;
int dx[4] = {1, 0, -1, 0},dy[4] = {0, 1, 0, -1};
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}
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; }
const ll INF = 1LL << 60;
const ll mod = 1000000007;

int main(){
	string S;cin>>S;
	ll ans=0;
	ll sub=0;
	rep(i,S.size()){
		if(S[i]=='A'||S[i]=='G'||S[i]=='C'||S[i]=='T')sub++;
		else{
			chmax(ans,sub);
			sub=0;
		}
	}
	chmax(ans,sub);
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    char c[3];
    bool ans = true;

    for (int i = 0; i < 3 && ans; i++) {
        cin >> c[i];
        for (int j = 0; j < i && ans; j++) {
            if (c[i] == c[j]) ans = false;
        }
    }

    cout << (ans ? "Yes" : "No") << endl;
}

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

int main() {

	int a, b, c, x, y; cin >> a >> b >> c >> x >> y;
	int ans = 0;
	if (a + b <= 2 * c) {
		ans = x * a + y * b;
	}
	else { // 2 * c < a + b
		ans += 2 * c * min(x, y);
		if (x <= y) {
			if (2 * c < b) {
				ans += (y - x) * 2 * c;
			}
			else {
				ans += (y - x) * b;
			}			
		}
		else { // y < x
			if (2 * c < a) {
				ans += (x - y) * 2 * c;
			}
			else {
				ans += (x - y) * a;
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3636
def main():
    import sys
    N,K,S=list(map(int,sys.stdin.readline().split()))
    if S==0:
        p=1/0
    
    if S==10**9:
        output=[1]*N
    elif S==1:
        output=[10**9]*N
        for i in range(K):
            output[i]=1
        print(' '.join(map(str,output)))
        return
    else:
        output=[10**9]*N
        
    if N==K:
        output=[S]*N
        print(' '.join(map(str,output)))
        return
    a=S//2
    if S%2==1:
        b=S//2+1
    else:
        b=S//2

    for i in range(K+1):
        if i%2==0:
            output[i]=a
        else:
            output[i]=b

    print(' '.join(map(str,output)))    



main()

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

vector<pair<ll, ll>> prime_factorization(ll x) {
  vector<pair<ll, ll>> res;
  for (ll i = 2; i * i <= x; ++i) {
    ll n = 0;
    while (x % i == 0)
      x /= i, ++n;
    if (n > 0)
      res.emplace_back(i, n);
  }
  if (x != 1)
    res.emplace_back(x, 1);
  return res;
}

int main() {
  ll n, p;
  cin >> n >> p;

  if (p == 1) {
    cout << 1 << endl;
    return 0;
  }

  auto v = prime_factorization(p);

  ll ans = 1;
  for (int i = 0; i < v.size(); ++i) {
    if (v[i].second >= n) {
      for (int j = 0; j < v[i].second / n; ++j)
        ans *= v[i].first;
    }
  }

  cout << ans << endl;
}

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

int a[27];

int main()
{
    string s;

    cin >> s;

    for(int i = 0 ; i<s.size() ; i++)
    {
        a[s[i]-'a']++;
    }
    int l = s.size();
    long long ans = (1ll*l*(l-1))/2;
    for(int i = 0 ; i<26 ; i++)
    {
        ans = ans - (1ll*a[i]*(a[i]-1))/2;
    }
    cout << ans+1;
    return 0;
}


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

int main() {
    int n;
    cin >> n;
    int tmp = n%10;
    if(tmp == 2 || tmp == 4 || tmp == 5 || tmp == 7 || tmp == 9) cout << "hon" << '\n';
    else if(tmp == 0 || tmp == 1 || tmp == 6 || tmp == 8) cout << "pon" << '\n';
    else cout << "bon" << '\n';
    return 0;
}

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

int main()
{
	int64_t n;
	cin >> n;
	vector<int64_t> as(n);
	for (auto &&a : as)
	{
		cin >> a;
	}

	int64_t mod = 1000000007;

	auto mod_rev = [](int64_t a, int64_t mod) {
		auto ext_gcd = [](auto &f, int64_t a, int64_t b, int64_t &x, int64_t &y) {
			if (b == 0)
			{
				x = 1;
				y = 0;
				return a;
			}

			int64_t g = f(f, b, a % b, x, y);

			int64_t tmp = x;
			x = y;
			y = tmp - a / b * y;

			return g;
		};

		int64_t x, y;

		assert(ext_gcd(ext_gcd, a, mod, x, y) == 1);

		if (x < 0)
		{
			x += (abs(x) + mod - 1) / mod * mod;
		}

		return x;
	};

	auto pow_mod = [](int64_t a, int64_t n, int64_t mod) {
		int64_t ret = 1;
		for (; n; n >>= 1)
		{
			if (n & 1)
			{
				(ret *= a) %= mod;
			}
			(a *= a) %= mod;
		}
		return ret;
	};

	map<int64_t, int64_t> l;
	for (auto a : as)
	{
		for (int64_t p = 2; p * p <= a; p++)
		{
			int64_t cnt = 0;
			while (a % p == 0)
			{
				cnt++;
				a /= p;
			}
			if (0 < cnt)
			{
				l[p] = max(l[p], cnt);
			}
		}
		if (1 < a)
		{
			l[a] = max<int64_t>(l[a], 1);
		}
	}

	int64_t lm = 1;
	for (auto &&p : l)
	{
		(lm *= pow_mod(p.first, p.second, mod)) %= mod;
	}

	int64_t ans = 0;

	for (auto &&a : as)
	{
		(ans += lm * mod_rev(a, mod) % mod) %= mod;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef double dd;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> ii;
typedef pair<ll, int> li;
typedef pair<int, ll> il;
typedef pair<ll , ll> lli;
typedef vector<ii> vii;
typedef vector<il> vil;
typedef vector<li> vli;
typedef vector<lli> vlli;
typedef pair < ll , pair < ll , ll > > cm;
 
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define in insert
#define f0(b) for(int i=0;i<(b);i++)
#define f00(b) for(int j=0;j<(b);j++)
#define f1(b) for(int i=1;i<=(b);i++)
#define f11(b) for(int j=1;j<=(b);j++)
#define f2(a,b) for(int i=(a);i<=(b);i++)
#define f22(a,b) for(int j=(a);j<=(b);j++)
#define sf(a) scanf("%lld",&a)
#define sff(a,b) scanf("%lld %lld", &a , &b)
#define pf(a) printf("%lld\n",a)
#define pff(a,b) printf("%lld %lld\n", a , b)
#define PI 3.14159265359
#define bug printf("**!\n")
#define mem(a , b) memset(a, b ,sizeof(a))
#define front_zero(n) __builtin_clzll(n)
#define back_zero(n) __builtin_ctzll(n)
#define total_one(n) __builtin_popcountll(n)
#define clean cout.flush()
 
const ll mod = (ll)1e9+7;
const ll maxn = (ll)200005;
const int nnn = 1048590;
const int inf = numeric_limits<int>::max()-1;
//const ll INF = numeric_limits<ll>::max()-1;
const ll INF = 1e18;
 
ll dx[]={0,1,0,-1};
ll dy[]={1,0,-1,0};
ll dxx[]={0,1,0,-1,1,1,-1,-1};
ll dyy[]={1,0,-1,0,1,-1,1,-1};
 
void solve(){
 
	ll x;
	cin >> x;
	ll a = 100;
	ll ans;
	for(ll i = 1; i <= 3760; i++){
		ll b = a/100;
		a += b;
		if(a >= x) ans = i, a = 0;
	}
	cout << ans;	
	return;
}
 
 
int main(int argc, char *argv[]) {
 
   ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
    ll T;
    T=1;
    //cin >> T;
    //scanf("%lld",&T);
    ll CT = 0;
    //work();
    while(T--){
    	//cout << "Case " << ++CT <<": " ;
    //	printf("Case %lld: \n",++CT);
		solve();
	}
 
    return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define pb push_back
#define sz(x) (int)(x).size()
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}

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

    int ans;
    ans = pow(n, 3);

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int mod=1e9+7;
int n,k;
char s[75],vis[75];
int len[75],tag[75];
ll ans,fac[205],finv[205],C[205][205];
inline bool check(int cnt){
	memset(vis,0,sizeof(vis));
	memset(tag,0,sizeof(tag));
	int fr=1,fb=1,now=0;
	for(int i=cnt;i;--i){
		if(len[i]==1){
			while(fr<=k&&s[fr]!='r') ++fr;
			if(fr>k) return 0;
			vis[fr++]=1;
		}
		else{
			while(fr<=k&&s[fr]!='r') ++fr;
			while(fb<=k&&(fb<=fr||s[fb]!='b')) ++fb;
			if(fr>k||fb>k) return 0;
			vis[fr++]=vis[fb++]=1; tag[max(fr,fb)-1]+=len[i]-2;
		}
	}
	for(int i=k;i;--i){
		if(!vis[i]) ++now;
		else now-=tag[i];
		if(now<0) return 0;
	}
	return 1;
}
bool dfs(int sum,int lst,int cnt,int tot){
	if(tot<0||!check(cnt)) return 0;
	int num=cnt+1;
	for(int i=1;i<=cnt;++i) num+=len[i]*2-1;
	ll now=C[tot+num-1][tot]*fac[cnt]%mod;
	for(int i=1,sz=len[cnt+1]=0;i<=cnt+1;++i) if(len[i]==len[i-1]) ++sz; else now=now*finv[sz]%mod,sz=1;
	(ans+=now)%=mod;
	for(int i=lst;i<=k-sum;++i){
		len[cnt+1]=i;
		if(!dfs(sum+i,i,cnt+1,tot-(i<=2?1:i*2-3)-(cnt>0))) return 1;
	}
	return 1;
}
inline ll qpow(ll x,int k,ll r=1){
	for(;k;k>>=1,x=x*x%mod) if(k&1) r=r*x%mod;
	return r;
}
int main(){
	scanf("%d%d%s",&n,&k,s+1);
	for(int i=fac[0]=1;i<=200;++i) fac[i]=fac[i-1]*i%mod;
	finv[200]=qpow(fac[200],mod-2);
	for(int i=200;i;--i) finv[i-1]=finv[i]*i%mod;
	for(int i=0;i<=200;++i) for(int j=C[i][0]=1;j<=i;++j) C[i][j]=(C[i-1][j-1]+C[i-1][j])%mod;
	dfs(0,1,0,n);
	return printf("%lld\n",ans),0;
}

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

#define inRange(x,a,b) (a <= x && x <= b)
typedef string::const_iterator State;

int bit;

bool NOT(bool x){
    return !x;
}
bool AND(bool x, bool y){
    return x&&y;
}
bool OR(bool x, bool y){
    return x||y;
}
bool IMP(bool x, bool y){
    return !x || y;
}

bool formula(State &begin){
    if(inRange(*begin, 'a', 'k') || inRange(*begin, 'F', 'T')){
        char c = *begin;
        begin++;
        if(c == 'T')    return true;
        else if(c == 'F')    return false;
        return (bit>>(c-'a'))&1;
    }
    if(*begin == '-'){
        begin++;
        return NOT(formula(begin));
    }
    if(*begin == '('){
        begin++;
        bool ret = formula(begin);
        char c = *begin;
        begin++;
        if(c == '*')        ret = AND(ret, formula(begin));
        else if(c == '+')   ret = OR(ret, formula(begin));
        else if(c == '-')   begin++, ret = IMP(ret, formula(begin));
        begin++; // ')'
        return ret;
    }
}

int main(){
    string s;
    while(cin >> s, s != "#"){
        int eq = 0;
        while(s[eq] != '=') eq++;
        string a = s.substr(0, eq), b = s.substr(eq+1);
        bool valid = true;
        for(bit = 0; bit < 1<<11; bit++){
            State ait = a.begin(), bit = b.begin();
            valid &= formula(ait)==formula(bit);
        }
        cout << (valid ? "YES" : "NO") << endl;
    }
    return 0;
}


Measured memory_bytes: 3168
N = int(input())
mod = 10**9+7
ans = 1
num = [0]*N
for i in range(1,N+1):
    for j in range(2,i+1):
        while i % j == 0:
            i //= j
            num[j-1] += 1
for i in range(N):
    if num[i] == 0:
        continue
    else:
        ans = ans * (num[i]+1) % mod
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
int main() 
{	
	ll a,b,d; cin>>a>>b>>d;
	int c=0;
	for(int i=a;i<=b;i++)
	{
		if(i%d==0)c++;
	}
cout<<c;

}

Measured memory_bytes: 3640
#define yuki(x, y) for(int i = x, __yuki = y; i < __yuki; ++i)
#define yukj(x, y) for(int j = x, __yukj = y; j < __yukj; ++j)
#define yukii(x, y) for(int i = x; __yukii = y; i <= __yukii; ++i)
#define yukji(x, y) for(int j = x; __yukji = y; j <= __yukji; ++j)
#define yuk(x, y, z) for(int x = y, __yuk = z; x < __yuk; ++x)
#define yui(x, y, z) for(int x = y, __yui = z; x >= __yui; --x)
#define sclr(x) memset(x, 0, sizeof(x))
#define sclr1(x) memset(x, -1, sizeof(x))
#define scl(x, y) memset(x, y, sizeof(x))
#define ft first
#define sc second
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
typedef long long lol;
int n, cnt[100100];
const int M = 1000000007;
void sread()
{
    scanf("%d", &n);
    int t;
    yuki(0, n)
    {
	scanf("%d", &t);
	++cnt[t];
    }
}
int snow(int x){return x < 0 ? -x : x;}
int main(int argc, char **argv)
{
    sread();
    int ans = 1;
    yuki(0, n)
    {
	int cur = snow(n-i-1-i);
	ans = (lol)ans*cnt[cur]--%M;
    }
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 512
a = int(input())
c = ''
while (a > 26):
    b = int(a) % 26
    c += chr(ord('a') + (25 if b == 0 else int(b) - 1))
    a = int(a / 26 - 1 if a % 26 == 0 else a / 26)
c += chr(ord('a') + int(a) - 1)
print(c[::-1])


Measured memory_bytes: 9132
#include<bits/stdc++.h>
#define endl '\n'
using namespace std;

long long n, tab[300010], ans, pos;
int main()
{
	ios_base::sync_with_stdio( 0 );
	cin.tie( 0 );
	cin>>n;
	for( int a = 1; a <= 3*n; a++ )cin>>tab[a];
	sort( tab + 1, tab + 3*n + 1 );
	pos = 3*n - 1;
	for( int a = 1; a <= n; a++ )ans += tab[pos], pos -= 2;
	cout<<ans<<endl;
	 
	
	return 0;
}

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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int g[5][5];
  memset(g, 0, sizeof(g));
  vector<int> path;
  path.push_back(0);
  path.push_back(1);
  path.push_back(2);
  path.push_back(3);
  for (int i = 0; i < 3; i++) {
    int x, y;
    cin >> x >> y;
    x--; y--;
    g[x][y] = 1;
    g[y][x] = 1;
  }
  int ok = 0;
  while (true) {
    int connected_roads = 0;
    for (int i = 0; i < 3; i++) {
      int u = path[i];
      int v = path[i + 1];
      if (g[u][v] || g[v][u]) {
        connected_roads++;
      }
    }
    if (connected_roads == 3) {
      ok = 1;
    }
    if (!next_permutation(path.begin(), path.end())) {
      break;
    }
  }
  cout << (ok ? "YES" : "NO") << '\n';
  return 0;
}

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

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

using namespace std;

int main()
{
    int n, q;
    while (cin >> n >> q, n) {
        vector<int> dt(101, 0); 
        rep(i, n) {
            int tmp;
            cin >> tmp;
            rep(j, tmp) {
                int t;
                cin >> t;
                dt[t]++;
            }
        }
        int max = 0;
        rep(j, 101) {
            if (dt[j] > dt[max]) {
                max = j;
            }
        }
        if (dt[max] >= q) {
            cout << max << endl;
        } else {
            puts("0");
        }
    }
    return 0;
}

Measured memory_bytes: 3028
#include <bits/stdc++.h>
using namespace std;
int main() {
	ios_base::sync_with_stdio(false);
    cin.tie(0);
	int n,arr[9],i,x;
    for (i=0;i<9;i++){
        cin>>arr[i];
    }
    cin>>n;
    bool mp[200]={0};
    for (i=0;i<n;i++){
        cin>>x;
        mp[x]=1;
        //cout<<x<<'\n';
    }
    if ((mp[arr[0]]==1&&mp[arr[1]]==1&&mp[arr[2]]==1)||(mp[arr[3]]==1&&mp[arr[4]]==1&&mp[arr[5]]==1)||(mp[arr[6]]==1&&mp[arr[7]]==1&&mp[arr[8]]==1)||(mp[arr[0]]==1&&mp[arr[3]]==1&&mp[arr[6]]==1)||(mp[arr[1]]==1&&mp[arr[4]]==1&&mp[arr[7]]==1)||(mp[arr[2]]==1&&mp[arr[5]]==1&&mp[arr[8]]==1)||(mp[arr[0]]==1&&mp[arr[4]]==1&&mp[arr[8]]==1)||(mp[arr[2]]==1&&mp[arr[4]]==1&&mp[arr[6]]==1)){
        cout<<"Yes\n";
    }
    else cout<<"No\n";
    
}

Measured memory_bytes: 256
N = int(input())
ans = []
while N > 0:
  N -= 1
  a = N%26
  ans.append(chr(97+a))
  N = N//26
#print(ans)
ret = ""
for i in range(len(ans)):
  ret += ans[-1-i]
  #print(ret)
print(ret)

Measured memory_bytes: 61632
#include<iostream>
using namespace std;
#define rep(i,j) for(i=0;i<j;i++)
int main()
{

  int n;

  while(cin>>n)
    {

      int a,b,c,d;
      int cnt=0;
      rep(a,10)rep(b,10)rep(c,10)rep(d,10)
        {
          if(a+b+c+d==n)cnt++;
        }
      cout << cnt<<endl;
    }
  return 0;

}

Measured memory_bytes: 1160
from collections import Counter
n,s=[int(i) for i in input().split(' ')]
a=[int(i) for i in input().split(' ')]

b=[]
counter = Counter(a)
for word, cnt in counter.most_common():
    b.append(int(cnt))
    
b.reverse()

x=0
if len(b)-s > 0:
  for i in range(len(b)-s):
    x+=b[i]
print(x)

Measured memory_bytes: 39296
#include<bits/stdc++.h>
#include<cstring>
using namespace std;
int main(void)
{
    char ch[11],chl[12];
    int i,count=0;
    cin>>ch>>chl;
    int length1 = strlen(ch);
    int length2 = strlen(chl);

    for(i=0;i<length1;i++)
    {
        if(ch[i]!=chl[i])
        {
            count = 2;
            break;
        }
        else count = 1;

    }



    if(count==1 && (length1==length2-1)) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;


}

Measured memory_bytes: 3592
// IO library
#include <cstdio>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>
#include <cmath>
#include <numeric>

// container library
#include <deque>
#include <list>
#include <map>
#include <set>
#include <string>
#include <vector>

// namespace
using namespace std;

// typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<VB> VVB;

// container
#define EACH(i, c) for (auto i = (c).begin(); i != (c).end(); i++)
#define SORT(c) sort((c).begin(), (c).end())
#define GSORT(c) sort((c).begin(), (c).end(), greater<decltype((c).front())>())
#define SZ(x) ((int)(x).size())
#define MEMSET(c, v) memset((c), v, sizeof(c))

// repetition
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define NREP(i, n) FOR(i, 1, n + 1)
#define RFOR(i, a, b) for (int i = (a); i >= (b); i--)
#define RREP(i, n) RFOR(i, n, 0)
#define RNREP(i, n) RFOR(i, n, 1)

// constant
// const ll MOD = 1e9 + 7;
// const int INF = 1e9;
// const ll INF = 1e15;
// const int dx[4] = {0, -1, 1, 0};
// const int dy[4] = {-1, 0, 0, 1};
// const int dx[8] = {-1, 0, 1, -1, 1, -1, 0, 1};
// const int dy[8] = {-1, -1, -1, 0, 0, 1, 1, 1};

// debug
#define test(x) cout << #x << " = " << x << endl

// answer output
#define Yes(c) cout << ((c) ? "Yes" : "No") << endl;
#define YES(c) cout << ((c) ? "YES" : "NO") << endl;
#define possible(c) cout << ((c) ? "possible" : "impossible") << endl;
#define POSSIBLE(c) cout << ((c) ? "POSSIBLE" : "INPOSSIBLE") << endl;


// --------------------------------------------------------


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

  string N;
  cin >> N;
  Yes(N[0] == N[2]);

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define pb push_back
#define IOS ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define Test int T;cin>>T;while(T--)
#define ls lower_bound
#define up upper_bound
#define bs binary_search
#define S second
#define F first
#define vi vector<int>  
#define pii pair<int,int>
#define vpi vector<pii>
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
#define m_n(v) *min_element(all(v))
#define m_x(v) *max_element(all(v))
/* 
#include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>indexed_set;
*/
int power(int x, int y,int mod){
    int res = 1;
    while (y)
    {
        if (y & 1)
        res = (res*x)%mod;
        y = y>>1;
        x = (x*x)%mod;
    }
    return res;
}
int modInverse(int a, int m){
    int m0 = m;
    int y = 0, x = 1;

    if (m == 1)
      return 0;

    while (a > 1)
    {
        int q = a / m;
        int t = m;
        m = a % m, a = t;
        t = y;
        y = x - q * y;
        x = t;
    }
    if (x < 0)
       x += m0;

    return x;
}
int binomial(int n,int k){
    int res = 1;
    if ( k > n - k )
        k = n - k;

    for (int i = 0; i < k; ++i)
    {
        res *= (n - i);
        res /= (i + 1);
    }

    return res;
}
/*vector<int> prime;
void sieve(){
    bool arr[300000]={0};
    prime.pb(2);
    for(int i=3;i<300000;i+=2){
        if(arr[i])continue;
        for(int j=i*i;j<300000;j+=i) arr[j]=1;
        prime.pb(i);
    }
}*/
const int mod=1e9+7;
int32_t main() {
    IOS;
    int x,n;
    cin>>x>>n;
    vi v(n);
    for(auto &i:v) cin>>i;
    sort(all(v));
    int i=x,j=x;
    while(1)
    {
        if(bs(all(v),i))
        {
            i--;
        }
        else{
            cout<<i;
            break;
        }
        if(bs(all(v),j))
        {
            j++;
        }
        else{
            cout<<j;
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 3648
#pragma GCC optimize("O3")
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
using P=pair<ll,ll>;
template<class T> using V=vector<T>; 
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
const ll mod=1000000007;
ll gcd(ll a,ll b) {return b ? gcd(b,a%b):a;}
ll lcm(ll c,ll d){return c/gcd(c,d)*d;}
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
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; }
struct mint{
    using ull=unsigned long long int;
    ull v;
    mint(ll vv=0){s(vv%mod+mod);}
    mint& s(ull vv){
        v=vv<mod?vv:vv-mod;
        return *this;
    }
    //オーバーロード
    mint operator-()const{return mint()-*this;}//符号反転
    mint&operator+=(const mint&val){return s(v+val.v);}
    mint&operator-=(const mint&val){return s(v+mod-val.v);}
    mint&operator*=(const mint&val){
        v=ull(v)*val.v%mod;
        return *this;
    }
    mint&operator/=(const mint&val){return *this*=val.inv();}
    mint operator+(const mint&val){return mint(*this)+=val;}
    mint operator-(const mint&val){return mint(*this)-=val;}
    mint operator*(const mint&val){return mint(*this)*=val;}
    mint operator/(const mint&val){return mint(*this)/=val;}
    mint pow(ll n)const{
        mint res(1),x(*this);
        while(n){
            if(n&1)res*=x;
            x*=x;
            n>>=1;
        }
        return res;
    }
     mint inv()const{return pow(mod-2);}
    //拡張ユークリッドの互除法
    /* mint inv()const{
        int x,y;
        int g=extgcd(v,mod,x,y);
        assert(g==1);
        if(x<0)x+=mod;
        return mint(x);
    }*/
    friend ostream& operator<<(ostream&os,const mint&val){
        return os<<val.v;
    }//出力
    bool operator<(const mint&val)const{return v<val.v;}
    bool operator==(const mint&val)const{return v==val.v;}
    bool operator>(const mint&val)const{return v>val.v;}
};
mint dp[3005][3005];
int main(){
   int n;
   cin>>n;
   string s;
   cin>>s;
   for(int i=0;i<n;i++)dp[0][i]=1;
   for(int i=1;i<n;i++){
       for(int j=1;j<n;j++)dp[i-1][j]+=dp[i-1][j-1];
       if(s[i-1]=='<'){
           for(int j=0;j<n-i;j++){
               dp[i][j]+=dp[i-1][n-i]-dp[i-1][j];
           }
       }else{
           for(int j=0;j<n-i;j++){
              dp[i][j]+=dp[i-1][j];
           }
       }
   }
cout<<dp[n-1][0]<<endl;
}

Measured memory_bytes: 70784
#include <bits/stdc++.h>
    #include <ext/pb_ds/assoc_container.hpp>
    #include <ext/pb_ds/tree_policy.hpp>
    #include <ext/pb_ds/detail/standard_policies.hpp>
    using namespace std;
    using namespace __gnu_pbds;
    #define ll long long
    #define int long long
    #define pb push_back
    #define For(i,n) for(ll  i=0;i<n;i++)
    #define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) ;clock_t clk = clock();
    #define f(a,b,c) for(ll a=b;a<c;a++)
    #define ld long double
    #define read(t) ll t;cin>>t;
    #define all(x) x.begin(),x.end()
    #define fi first
    #define se second
    #define pii pair<ll,ll>
    #define endl "\n"
    #define what_is(x) cerr << #x << " is " << x << endl;
    #define time cerr << "Time (in ms): " << double(clock() - clk) * 1000.0 / CLOCKS_PER_SEC << '\n';
    const double pi=3.14159265358979323846264;
    typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
    typedef tree<long long,null_type,greater<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set1;
/*.....................................................................................................................*/

    ll mod =(ll)1e9+7;
    ll add(ll x,ll y) {return (x+y)%mod;}
    ll mult(ll x, ll y){return ((x%mod )* (y%mod)) % mod;}
    long long binpow(long long x, long long p) 
    {
        if (p == 0) return 1;
    	if (p == 2 || (p & 1)) return mult(x, binpow(x, p - 1));
    	return binpow(binpow(x, p / 2), 2);
    }
    ll modinv(ll a) {return binpow(a,mod-2);}

    // bool check(ll y){}
    ll binsearch(ll l,ll r)
    {
        // while(r-l>1)
        // {
        //     ll mid=(l+r)/2;
        //     if(check(mid))l=mid;
        //     else r=mid;
        // }
        return l;
    }
    const ll man=(ll)1e5+5;
    // vector<ll>adj[man];
    // bool vis[man][man];
    // ll d[man],depth[man],par[man];
    // void addedge(ll u,ll v){adj[u].pb(v);adj[v].pb(u);}
    ll dx[4]={1,-1,0,0};ll dy[4]={0,0,1,-1};
/*........................................................................................................................*/
ll par[man],siz[man];
ll root(ll a)
{
    if(par[a]<0)return a;
    else return par[a]=root(par[a]);
}
void unite(int x, int y) 
{
        x = root(x);
        y = root(y);
        if(x==y) return ;
        if(x>y) swap(x, y);
        par[x]+=par[y];
        par[y] = x;
}
ll sz(ll x)
{
    return -par[root(x)];
}
bool check(ll a,ll b)
{
    return (root(a)==root(b));
}
signed main()/*Check flow...question galat mat padhna */
{
    fast;
    ll n,m;
    cin>>n>>m;
    vector<ll>ans;
    ll cur=(n)*(n-1);
    cur/=2;
    For(i,n)
    {
        par[i]=-1;
        siz[i]=1;
    }
    pii q[m];
    For(i,m)
    {
        read(x);
        read(y);
        q[i]={x,y};
    }
    For(i,m)
    {
        ans.pb(cur);
        ll a=q[m-1-i].fi,b=q[m-1-i].se;
        // cin>>a>>b;
        a--;
        b--;
        if(check(a,b))continue;
        cur-=(sz(a)*sz(b));
        unite(a,b);
    }
    reverse(all(ans));
    for(auto x:ans)cout<<x<<" ";
    cout<<endl;
}

Measured memory_bytes: 7432