akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdio>
#define N 1000
using namespace std;
int r[N],h[N];

int syori(int,int);
void sort(int,int);

int main(){
  int n1,n2,i,ans;
  
  while(1){
  
    for(i=1;i<=N;i++){
      r[i]=0;
      h[i]=0;
    }


    r[0]=-1;
    h[0]=-1;
    
    cin >> n1; 
    if(n1==0)break;
    
    for(i=1;i<=n1;i++){    // 1©çÍ¶ßÄ¢éÉÓ
      cin >> h[i] >> r[i];
    }
    
    cin >> n2;
    
    for(i=n1+1;i<=n1+n2;i++){ // P©çÍ¶ßÄ¢éÉÓ
      cin >> h[i] >> r[i];
    }
    
    sort(n1,n2);

    ans=syori(n1,n2);
    
    cout << ans << endl;
  }
  
  
}

void sort(int n1,int n2){
  int i,j,max,rr;

  for(i=1;i<=(n1+n2);i++){
    for(j=1;j<=(n1+n2);j++){
      if(h[j] > h[i]){
	
	rr=h[i];
	h[i]=h[j];
	h[j]=rr;
	
	rr=r[i];
	r[i]=r[j];
	r[j]=rr;
	
	
      }
    }
    
    
  }
  
}



int syori(int n1,int n2){
  int ANS[N],i,j; //ANS[N]Í·³ð²×ézñ 
  int max=0,res=0;
  
  for(i=0;i<N;i++){
    ANS[i]=0;
   
  }
 
  
  for(i=1;i<=(n1+n2);i++){
    max=0;
    //  cout <<endl<< "h["<<i<<"]--"<<h[i]<<endl;     
    // cout << "r["<<i<<"]--"<<r[i]<<endl;
    // cout << "ANS["<<i<<"]--"<<ANS[i]<<endl;
   


    for(j=0;j<i;j++){
      if(h[j]<h[i] && r[j]<r[i] && ANS[j]>ANS[max]){
	max=j;    
      }
    
    }
 ANS[i]=ANS[max]+1;
       
  }

  //  for(i=1;i<=(n1+n2);i++){
  //  cout << "ANS[" << i << "]--" << ANS[i]<< endl;
  // }


  for(i=1;i<=(n1+n2);i++){
      if(res<=ANS[i]){
	res=ANS[i];
    }
  }
  return res;
}

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

void solve(std::string S, std::string T)
{
    cout << T + S << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main()
{
    std::string S;
    std::cin >> S;
    std::string T;
    std::cin >> T;
    solve(S, T);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

int main() {
    int A, B, C, K;
    std::cin >> A >> B >> C >> K;
    
    int ans = 0;

    int a = std::min(A, K);
    K -= a;
    ans += a;

    int b = std::min(B, K);
    K -= b;

    int c = std::min(C, K);
    ans -= c;

    std::cout << ans << "\n";
}

Measured memory_bytes: 3596
// {{{
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdint>
#include <cstdio>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;
// }}}

using ll = long long;

int A, B, C, X, Y;

int main() {
    cin >> A >> B >> C >> X >> Y;

    int AB = min(A+B, 2*C);

    int mXY = min(X, Y);

    int ans = 0;

    ans += AB * mXY;
    X -= mXY;
    Y -= mXY;

    int nX = min(A, 2*C);
    int nY = min(B, 2*C);

    ans += X * nX;
    ans += Y * nY;

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<climits>
#include<iostream>
#include<sstream>
#include<utility>
#include<map>
#include<vector>
#include<queue>
#include<algorithm>
#include<set>
#include<stack>
using namespace std;
typedef long long ll;
typedef pair<int,int>P;

int main()
{
	int N,s=10000,g=-1,t;
	scanf("%d",&N);
	for(int i=0;i<N;i++)
	{
		scanf("%d",&t);
		s=min(s,t);
		g=max(g,t);
	}
	printf("%d\n",g-s);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=(ll)1e9+7;




int main() {
    int N; cin>>N;
    vector<pair<int,char>> card(N);

    string tmp;
    for (int i = 0; i < N; i++){
      cin>>tmp;
      card[i].first=tmp[1]-'0';
      card[i].second=tmp[0];
    }

    

    vector<pair<int,char>> cardb=card,cardi=card,stable=card;

    stable_sort(stable.begin(),stable.end(),[](pair<int,char> a,pair<int,char> b){
      return a.first<b.first;
    });

    for(int i=0; i<N;++i){
      for(int j=N-1; j>i;--j){
        if(cardb[j].first<cardb[j-1].first) swap(cardb[j],cardb[j-1]);
      }
    }

    bool s1=true;

    for(int i=0;i<N;++i){
      cout<<cardb[i].second<<cardb[i].first;
      if(i<N-1) cout<<" ";
      if(cardb[i].second!=stable[i].second) s1=false;
    }
    cout<<endl;

    cout<<((s1)?"Stable":"Not stable")<<endl;
    
    for(int i=0;i<N;++i){
      int mini=i;
      for(int j=i;j<N;++j){
        if(cardi[j].first<cardi[mini].first) mini=j;
      }
      swap(cardi[i],cardi[mini]);
    }
    

    bool s2=true;

    for(int i=0;i<N;++i){
      cout<<cardi[i].second<<cardi[i].first;
      if(i<N-1) cout<<" ";
      if(cardi[i].second!=stable[i].second) s2=false;
    }
    cout<<endl;
    cout<<((s2)?"Stable":"Not stable")<<endl;

    return 0;
}


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

int main(){
  int n;
  cin >> n;
  vector<int> a(3*n);
  rep(i,n) cin >> a[i];
  rep(i,n){
    a[n+i] = a[i] + 1;
    a[2*n+i] = a[i] - 1;
  }
  sort(a.begin(),a.end());
  //rep(i,3*n) cout << a[i];
  int count = 1;
  int ans = 1;
  rep(i,3*n-1){
    if(a[i] == a[i+1])
    count++;
    else{
      ans = max(ans,count);
      count = 1;
    }
  }
  cout << ans << endl;
  return 0;
}


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

int main(){
    int l,r;
    cin >> l >> r;

    if(r - l >= 2019){
        l = 0;
        r = 2018;
    }else{
        l %= 2019;
        r %= 2019;
    }

    int ans = 2019;

    for(int i = l; i <= r; ++i){
        for(int j = i + 1; j <= r; ++j){
            if(ans > (i * j) % 2019) ans = (i * j) % 2019;
        }
    }


    cout << ans << endl;

    return 0;
}

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

const int C = (int)1e7+10;

bool isprime[C];
int prime[C];

void init() {
  fill(isprime, isprime+C, true);
  isprime[0] = isprime[1] = false;
  for (auto i=2; i<C; i++) {
    if (isprime[i]) {
      for (auto j=2; i*j<C; j++) {
	isprime[i*j] = false;
      }
    }
  }
  prime[0] = 0;
  for(auto i=1; i<C; i++) {
    prime[i] = ((isprime[i]) ? prime[i-1]+1 : prime[i-1]);
  }
}

int main() {
  init();
  int n;
  while (cin >> n) {
    cout << prime[n] << endl;
  } 
}

Measured memory_bytes: 49988
#include <stdio.h>

int main(void){
    int i,j,N,K,d,A[100] = {0},tmp,ans=0;
    scanf("%d %d",&N,&K);

    for(i=0;i<K;i++){
        scanf("%d",&d);
        for (j = 0; j < d; j++){
            scanf("%d",&tmp);
            A[tmp-1] = 1;
        }
    }

    for(i=0;i<N;i++){
        if(A[i]==0) ans++;
    }
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 1736
n1 = int(input())
cnt_dict = {}
for _ in range(n1):
  s = input()
  if s not in cnt_dict:
    cnt_dict[s] = 1
  else:
    cnt_dict[s] += 1
n2 = int(input())
for _ in range(n2):
  s = input()
  if s not in cnt_dict:
    cnt_dict[s] = -1
  else:
    cnt_dict[s] -= 1
print(max(max(cnt_dict.values()),0))

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int>pint;
typedef vector<int>vint;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);i++)
template<class T,class U>void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>void chmax(T &t,U f){if(t<f)t=f;}

int N;

int main(){
    scanf("%d",&N);

    if(N==0)puts("1");
    else if(N==1)puts("2");
    else if(N==2)puts("1");
    else puts("0");
    return 0;
}

Measured memory_bytes: 1168
#include <iostream>
#define MAX 100000
#include <vector>
using namespace std;

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

  int n, c;
  cin >> n >> c;
  int s[n];
  int t[n];
  int ch[n];
  for(int i = 0; i < n; i++){
    cin >> s[i] >> t[i] >> ch[i];
  }

  int table0[c][MAX + 1];
  for(int i = 0; i < c; i++){
    fill(table0[i], table0[i] + (MAX + 1), 0);
  }
  for(int i = 0; i < n; i++){
    ++table0[ch[i] - 1][s[i]];
    --table0[ch[i] - 1][t[i]];
  }
  vector< int > s0, t0;
  for(int i = 0; i < c; i++){
    int u = 0;
    for(int j = 0; j <= MAX; j++){
      int v = u + table0[i][j];
      if(u == 0 && v == 1){
        s0.push_back(j);
      }
      else if(u == 1 && v == 0){
        t0.push_back(j);
      }
      u = v;
    }
  }

  int table[MAX * 2 + 1];
  fill(table, table + (MAX * 2 + 1), 0);
  for(int i = 0; i < s0.size(); i++){
    ++table[2 * s0[i] - 1];
    --table[2 * t0[i]];
  }

  int ans = 1;
  int sum = 0;
  for(int i = 0; i <= 2 * MAX; i++){
    sum += table[i];
    ans = max(ans, sum);
  }

  cout << ans << endl;

  return 0;
}

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

using namespace std;
#define PB push_back
#define MP make_pair
#define LL long long
#define int __int128_t
#define FOR(i,a,b) for(int i = (a); i <= (b); i++)
#define RE(i,n) FOR(i,1,n)
#define REP(i,n) FOR(i,0,(int)(n)-1)
#define R(i,n) REP(i,n)
#define VI vector<int>
#define PII pair<int,int>
#define LD long double
#define FI first
#define SE second
#define st FI
#define nd SE
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())

template<class C> void mini(C &a4, C b4) { a4 = min(a4, b4); }
template<class C> void maxi(C &a4, C b4) { a4 = max(a4, b4); }

template<class TH> void _dbg(const char *sdbg, TH h){ cerr<<sdbg<<'='<<h<<endl; }
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')cerr<<*sdbg++;cerr<<'='<<h<<','; _dbg(sdbg+1, a...);
}

template<class T> ostream &operator<<(ostream& os, vector<T> V) {
  os << "["; for (auto vv : V) os << vv << ","; return os << "]";
}
template<class L, class R> ostream &operator<<(ostream &os, pair<L,R> P) {
  return os << "(" << P.st << "," << P.nd << ")";
}

#ifdef LOCAL
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (__VA_ARGS__)
#define cerr if(0)cout
#endif

const int P = 998244353;
string z;
map<int,int> pam[101];
int one = 1;

void add(int &a,int b){
  a += b;
  if(a >= P)
    a -= P;
}

int mul(int a,int b){
  return a * b % P;
}

int licz(int mb,int dl){
  auto xxx = pam[dl].find(mb);
  if(xxx != pam[dl].end())return xxx->SE;
  
  int &res = pam[dl][mb];
  //debug(dl,mb);
  for(int i = 1; i < dl; i++){
    int mask = (one << i) - 1;
    int ak = mb & mask;
    for(int kr = 1; kr * i <= dl; kr ++){
    //  debug(kr,i,dl,licz(ak,i),licz(mb >> (kr * i), dl - kr * i));
      if(kr > 1 || i == 1)
        add(res,mul(licz(ak,i), licz(mb >> (kr * i), dl - kr * i)));
      ak &= mb >> (kr * i);
    }
  }
  //debug(mb,dl,res);
  return res;
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(11);
  cerr << fixed << setprecision(6);
  pam[0][0] = 1;
  pam[1][1] = 2;
  pam[1][0] = 1;
  cin >> z;
  int pom = 0;
  R(i,SZ(z)){
    pom *= 2;
    pom += z[i] - '0';
  }
  cout << (LL)licz(pom,SZ(z)) << "\n";
}


Measured memory_bytes: 3712
N = int(input())
A = [int(x) for x in input().split()]
B = [0]*N
for k in range(N):
    B[k] = [k+1]*2
    B[k][0] = A[k]
B = sorted(B)
ans = [0]*N
for i in range(N):
    ans[i] = B[i][1]
print(*ans)
#print(B)


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

int main(){

	int n;
	scanf("%d", &n);
	
	long long sum = 0;
	for(int i = 1; i <= n; ++i){
		if(i%3 != 0 && i%5 != 0){
			sum+= i;
		}
	}
	printf("%lld", sum);
	
	return 0;

}

Measured memory_bytes: 3828
S = input()
lst = ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"]

up = S[0:2]
low = S[2:4]


if up in lst and low in lst:
    ans = "AMBIGUOUS"
elif up in lst and low not in lst:
    ans = "MMYY"
elif up not in lst and low in lst:
    ans = "YYMM"
else:
    ans = "NA"


print(ans)

Measured memory_bytes: 3064
#include "bits/stdc++.h"
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#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 all(s) s.begin(), s.end()
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 int MX = 100005, INF = 1001001001;
const ll LINF = 1e18;
const double eps = 1e-10;
const int DIV = 1e9+7;

int main()
{
    int n;
    cin >> n;
    vi r[101010];
    rep(i,n){
        int a,b;
        cin >> a >> b;
        r[a].pb(b);
        r[b].pb(a);
    }
    // gets distance from 1
    queue<int> q;
    int d1[101010];
    fill(d1+1,d1+n+1,INF);
    q.push(1);
    d1[1] = 0;
    while(!q.empty()){
        int v = q.front(); q.pop();
        rep(i, r[v].size()){
            int nv = r[v][i];
            if(nv == n || d1[nv] != INF) continue;
            d1[nv] = d1[v] + 1;
            q.push(nv);
        }
    }

    // gets distance from n
    while(!q.empty()) q.pop();
    int dn[101010];
    fill(dn+1,dn+n+1,INF);
    q.push(n);
    dn[n] = 0;
    while(!q.empty()){
        int v = q.front(); q.pop();
        rep(i, r[v].size()){
            int nv = r[v][i];
            if(nv == 1 || dn[nv] != INF) continue;
            dn[nv] = dn[v] + 1;
            q.push(nv);
        }
    }

    int black=0;
    int white=0;
    rrep(i,n){
        if(d1[i] <= dn[i]) black++;
        else white++;
    }
    if(black > white) puts("Fennec");
    else puts("Snuke");
}


Measured memory_bytes: 6656
require 'prime'
require 'set'
require 'tsort'
include Math
def max(a,b);              a > b ? a : b                              end
def min(a,b);              a < b ?  a : b                             end
def swap(a,b);             a, b = b, a                                end
def gif;                   gets.to_i                                  end
def gff;                   gets.to_f                                  end
def gsf;                   gets.chomp                                 end
def gi;                    gets.split.map(&:to_i)                     end
def gf;                    gets.split.map(&:to_f)                     end
def gs;                    gets.chomp.split.map(&:to_s)               end
def gc;                    gets.chomp.split('')                       end
def pr(num);               num.prime_division                         end
def digit(num);            num.to_s.length                            end
def array(s,ini=nil);      Array.new(s){ini}                          end
def darray(s1,s2,ini=nil); Array.new(s1){Array.new(s2){ini}}          end
def rep(num);              num.times{|i|yield(i)}                     end
def repl(st,en,n=1);       st.step(en,n){|i|yield(i)}                 end

st = []
n = gif
str = gc
str.each do |s|
  if s == ')'
    if st.last == '('
      st.pop
    else
      st << s
    end
  else
    st << s
  end
end

st.each do |s|
  if s == '('
    str << ')'
  else
    str.unshift '('
  end
end

puts str.join


Measured memory_bytes: 2428
from collections import defaultdict
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpl_str(): return list(input().split())

a,b = inpl_str()
if a == 'H':
    print(b)
else:
    if b == 'H':
        print('D')
    else:
        print('H')


Measured memory_bytes: 4212
#include <stdio.h>

int main(void) {
int w,h,x,y,r;
 scanf("%5d",&w);
 scanf("%5d",&h);
 scanf("%5d",&x);
 scanf("%5d",&y);
 scanf("%5d",&r);
 if(w>=x+r&&h>=y+r&&x+r>0&&y+r>0){
  printf("Yes\n");
 }
  else {
  printf("No\n");
 }
}


Measured memory_bytes: 2612
#include <iostream>
#include <cstdio>
#include <algorithm>

#define debug 0

using namespace std;
typedef long long lint;
const int maxn = 2e5+5, inf = 0x3f3f3f3f;

int i, n;
int v[maxn], neg, poz, zero;
lint sum;

int bs(int x) {

    int p = 1 << 25;
    int r = 0;
    while(p > 0)
    {
        if(p + r <= n && v[p + r] < x)
            r += p;
        p >>= 1;
    }
    return r + 1;
}

int main()
{
    #if debug == 1
    freopen("f.in", "r", stdin);
    freopen("f.out", "w", stdout);
    #endif // debug

    scanf("%d", &n);
    for(i = 1; i <= n; i ++) {
        scanf("%d", &v[i]);
        v[i] -= i;
        if(v[i] < 0)
            neg ++;
        else if(v[i] > 0)
            poz ++;
        else
            zero ++;
        sum += 1LL * abs(v[i]);
    }
    sort(v+1, v+n+1);

    if(neg > poz + zero) {
        int first = bs(0) - 1;
        int leftAt = 0;
        while(neg > poz + zero) {
            sum -= 1LL * (leftAt - v[first]) * (neg - (poz + zero));
            leftAt = v[first];
            first --;
            poz ++;
            neg --;
            if(first <= 0)
                break;
        }
        printf("%lld", sum);
    }
    else if(poz > neg + zero) {
        int first = bs(1);
        int leftAt = 0;
        while(poz > neg + zero) {
            sum -= 1LL * (v[first] - leftAt) * (poz - (neg + zero));
            leftAt = v[first];
            first ++;
            poz --;
            neg ++;
            if(first > n)
                break;
        }
        printf("%lld", sum);
    }
    else {
        printf("%lld", sum);
    }

    return 0;
}


Measured memory_bytes: 1024
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repk(i, k, n) for (int i = k; i < n; i++)
#define MOD 1000000007
#define INF 1e9
#define PIE 3.14159265358979323

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;
}
template <class T>
T GCD(T a, T b) {
    if (b == 0)
        return a;
    else
        return GCD(b, a % b);
}
template <class T>
inline T LCM(T a, T b) {
    return (a * b) / GCD(a, b);
}

ll modpow(ll a, ll n) {
    a %= MOD;
    if (n == 0)
        return 1;
    if (n == 1)
        return a % MOD;
    if (n % 2)
        return a * modpow(a, n - 1) % MOD;
    else
        return (modpow(a, n / 2) * modpow(a, n / 2)) % MOD;
}

ll culc(ll a, ll n) {
    ll up = 1;
    ll down = 1;
    for (ll i = n - a + 1; i <= n; i++) {
        up *= i % MOD;
        up %= MOD;
    }
    for (ll i = 1; i <= a; i++) {
        down *= i % MOD;
        down %= MOD;
    }
    down = modpow(down, MOD - 2);
    return up * down % MOD;
}

int main() {
    ll n, a, b;
    cin >> n >> a >> b;
    ll ans = modpow(2, n) - 1 - culc(a, n) - culc(b, n);
    while (ans < 0) {
        ans += MOD;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
using System;

namespace abc124_c
{
    class Program
    {
        static void Main(string[] args)
        {
            var S = Console.ReadLine();
            int r1 = 0;
            int r2 = 0;

            for (int i = 0; i < S.Length; i++)
                if (S[i] == char.Parse((i % 2).ToString())) r1++;

            for (int i = 0; i < S.Length; i++)
                if (S[i] == char.Parse(((i+1) % 2).ToString())) r2++;

            Console.WriteLine(r1 < r2 ? r1 : r2);

        }
    }
}


Measured memory_bytes: 13280
n,k = list(map(int,input().split()))
p=0
for i in range(1,n+1):
    nage=0
    for j in range(19):
        if i>=k:
            nage = 0
        elif k<=i*2**j and i*2**(j-1)<k:
            nage=j
    p=p+(1/n)*(1/2**nage)
print(p)

Measured memory_bytes: 3060
N = int(input())
A = list(map(int, input().split()))
S = sum(A)
if S % (N*(N+1)//2):
  print('NO')
  quit()

k = S // (N*(N+1)//2)
d = [A[0] - A[-1] - k]
for i in range(N-1):
  d.append(A[i+1] - A[i] - k)

time = 0
for di in d:
  if di <= 0 and (-di) % N == 0:
    time += -di // N
  else:
    print('NO')
    quit()

if time == k:
  print('YES')
else:
  print('NO')

Measured memory_bytes: 14436
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
const int64_t LINF=8931145141919364364,LMOD=998244353;
// const int dy[]={0,-1,0,1,1,-1,-1,1};
// const int dx[]={1,0,-1,0,1,1,-1,-1};

int main() {
	int n; cin >> n;
	double x[n], y[n]; rep(i,n) cin >> x[i] >> y[i];
	vector<int> v;
	rep(i,n) v.push_back(i);
	double ans = 0;
	do {
		double sum = 0;
		for(int i = 1; i < n; ++i) {
			sum += sqrt((x[v[i]] - x[v[i - 1]]) * (x[v[i]] - x[v[i - 1]]) + (y[v[i]] - y[v[i - 1]]) * (y[v[i]] - y[v[i - 1]]));
		}
		ans += sum;
	} while(next_permutation(all(v)));
	rep(i,n) ans /= (double)(i + 1);
	printf("%.10f\n", ans);
	return 0;
}

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

int main(){
  int n,m,d;
  cin >> n >> m >> d;
  int kaijou[100][100];
  char c;
  for(int i=0;i<n;i++){
    for(int j=0;j<m;j++){
      cin >> c;
      if(c=='.'){
        kaijou[i][j]=1;
      }else if(c=='#'){
        kaijou[i][j]=0;
      }
    }
  }

  int ans=0;
  int nagasa;
  for(int i=0;i<n;i++){
    nagasa=0;
    for(int j=0;j<m;j++){
      if(kaijou[i][j]){
        nagasa++;
      }else{
        ans+=(nagasa-d+1>0)?(nagasa-d+1):0;
        nagasa=0;
      }
    }
    ans+=(nagasa-d+1>0)?(nagasa-d+1):0;
  }
  for(int i=0;i<m;i++){
    nagasa=0;
    for(int j=0;j<n;j++){
      if(kaijou[j][i]){
        nagasa++;
      }else{
        ans+=(nagasa-d+1>0)?(nagasa-d+1):0;
        nagasa=0;
      }
    }
    ans+=(nagasa-d+1>0)?(nagasa-d+1):0;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3108
#include <bits/stdc++.h>
#define INF 2e9
#define MOD 1000000007
#define MOD9 998244353
#define intMAX 51000;
#define PI 3.14159265359
using namespace std;
typedef long long llong;
typedef long double ldouble;

using Graph = vector<vector<int>>;

int main(){
	int N;
	cin >> N;
	vector<int> a(N);
	for(int i=0; i<N; ++i) cin >> a[i];
	sort(a.rbegin(), a.rend());
	int A = 0;
	int B = 0;
	for(int i=0; i<N; ++i){
		if(i%2==0) A += a[i];
		else B += a[i];
	}
	cout << A-B << endl;
}

Measured memory_bytes: 3556
import sys
from bisect import *
from heapq import *
from collections import *
from itertools import *
from functools import *
from math import *

sys.setrecursionlimit(100000000)
input = lambda: sys.stdin.readline().rstrip()

N, M = map(int, input().split())
l, r = None, None
for _ in range(M):
    L, R = map(int, input().split())
    if l is None or l < L:
        l = L
    if r is None or R < r:
        r = R
print(max(0, r - l + 1))



Measured memory_bytes: 40684
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <queue>

using namespace std;

void solve()
{
	int N;
	string S, T;

	cin >> N;
	cin >> S >> T;

	for (int i = 0; i < N; i++) {
		cout << S[i] << T[i];
	}
	cout << endl;
}

int main()
{
	solve();

	return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;

public class Main {
    public static void main(String args[]){
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        try{
            String line;
            ArrayList<Double> hi = new ArrayList<Double>();
            while((line=br.readLine())!=null){  //if(line.equals(""))break;
                hi.add(Double.parseDouble(line));
            }
            double min=Double.MAX_VALUE,max=-1;
            for(double d : hi){
                if(d<min) min=d;
                if(d>max)max=d;
            }
            System.out.println(max-min);
        }catch(Exception e){e.printStackTrace();}        
    }
    
}

Measured memory_bytes: 16920
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define uniq(v) v.erase(unique(v.begin(),v.end()),v.end())
#define lb(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define ub(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
using Pair = pair<ll,pair<int,int>>;
#define pq priority_queue<Pair, vector<Pair>, greater<Pair>> 
const ll mod=1000000007;
//const ll mod=998244353;
const ld pi=acos(-1.0);
const ll INF = 1LL<<61;
template<class T>bool chmax(T &a, const T &b) { 
  if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) {
  if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//  cout << fixed << setprecision (20);   小数点以下2０桁まで
//実行時間制約2秒では２×10^8回くらいまで計算できる



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

  int n,m;
  cin>>n>>m;
  
  vector<ll> a(n);
  vector<ll> b(n);
  vector<ll> c(n);
  vector<pair<ll,ll>> d(n);
  rep(i,n) cin>>a[i]>>b[i]>>c[i];

  ll ans=0;

  rep(i,n) d[i]={a[i]+b[i]+c[i],i};
  sort(all(d));
  ll asum=0,bsum=0,csum=0;
  rep(i,m) asum+=a[d[i].se],bsum+=b[d[i].se],csum+=c[d[i].se];
  chmax(ans,abs(asum)+abs(bsum)+abs(csum));

  rep(i,n) d[i]={a[i]+b[i]-c[i],i};
  sort(all(d));
  asum=0,bsum=0,csum=0;
  rep(i,m) asum+=a[d[i].se],bsum+=b[d[i].se],csum+=c[d[i].se];
  chmax(ans,abs(asum)+abs(bsum)+abs(csum));

  rep(i,n) d[i]={a[i]-b[i]+c[i],i};
  sort(all(d));
  asum=0,bsum=0,csum=0;
  rep(i,m) asum+=a[d[i].se],bsum+=b[d[i].se],csum+=c[d[i].se];
  chmax(ans,abs(asum)+abs(bsum)+abs(csum));

  rep(i,n) d[i]={a[i]-b[i]-c[i],i};
  sort(all(d));
  asum=0,bsum=0,csum=0;
  rep(i,m) asum+=a[d[i].se],bsum+=b[d[i].se],csum+=c[d[i].se];
  chmax(ans,abs(asum)+abs(bsum)+abs(csum));

  rep(i,n) d[i]={-a[i]+b[i]+c[i],i};
  sort(all(d));
  asum=0,bsum=0,csum=0;
  rep(i,m) asum+=a[d[i].se],bsum+=b[d[i].se],csum+=c[d[i].se];
  chmax(ans,abs(asum)+abs(bsum)+abs(csum));

  rep(i,n) d[i]={-a[i]+b[i]-c[i],i};
  sort(all(d));
  asum=0,bsum=0,csum=0;
  rep(i,m) asum+=a[d[i].se],bsum+=b[d[i].se],csum+=c[d[i].se];
  chmax(ans,abs(asum)+abs(bsum)+abs(csum));

  rep(i,n) d[i]={-a[i]-b[i]+c[i],i};
  sort(all(d));
  asum=0,bsum=0,csum=0;
  rep(i,m) asum+=a[d[i].se],bsum+=b[d[i].se],csum+=c[d[i].se];
  chmax(ans,abs(asum)+abs(bsum)+abs(csum));

  rep(i,n) d[i]={-a[i]-b[i]-c[i],i};
  sort(all(d));
  asum=0,bsum=0,csum=0;
  rep(i,m) asum+=a[d[i].se],bsum+=b[d[i].se],csum+=c[d[i].se];
  chmax(ans,abs(asum)+abs(bsum)+abs(csum));

  cout << ans << endl;
}

Measured memory_bytes: 3696
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>

using namespace std;

int a[100050];
int hah(int);

int main() {
	int n,a,b,i,j,k,x;
	cin>>n>>a>>b;
	int s=0;
	for(i=1;i<=n;i++) {
        x=hah(i);
	    if(a<=hah(i)&&hah(i)<=b)
     	s+=i;
	 }
	 cout<<s;
}

int hah(int a) {
	int s=0;
	while(a) {
 	    s+=a%10;
 	    a/=10;
	}
	return s;
}

Measured memory_bytes: 256
#include<stdio.h>

#define NIL -1
#define A 101
#define N 2000

void MSTPrim();

static const int MAX=500;
static const int INFTY=(1<<21);

int key[A], M[A][A], p[A], n, sum;

int main(){
  int i, j, e;
  scanf("%d", &n);
  for (i=0; i<n; i++ ){
    for (j=0; j<n; j++ ){
      scanf("%d", &e);
      M[i][j]=(e==-1)?INFTY:e;
    }
  }
  sum=0;
  MSTPrim();
  printf("%d\n", sum);
  return 0;
}

void MSTPrim(){
  int i, v, u;

  for(u=0;u<n;u++){
    key[u]=INFTY;
    p[u]=NIL;
  }

  key[0]=0;

  while(1){
    int minv=INFTY;
    u=NIL;

    for(i=0;i<n;i++){
      if(key[i] < minv && p[i]==NIL ){
	u=i;
	minv=key[i];
      }
    }
    if(u==NIL) break;
    p[u]=1;
    sum+=key[u];
    for(v=0;v<n;v++){
      if(M[u][v]<key[v]){
	key[v]=M[u][v];
      }
    }
  }
}

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

int main() {
  int n;
  cin >> n;
  map<string, int> mp;
  int mx = 0;
  for ( int i = 0; i < n; i++ ) {
    string s;
    cin >> s;
    mp[s]++;
    mx = ( mp[s] > mx ) ? mp[s] : mx;
  }

  for ( const auto& m : mp ) {
    if ( m.second == mx ) {
      cout << m.first << endl;
    }
  }

  return 0;
}


Measured memory_bytes: 19168
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vs = vector<string>;
using vll = vector<long long>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
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 (b<a) {a=b; return 1;} return 0;}

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

    queue<ll> q;
    for (int i = 1; i <= 9; ++i) {
        q.push(i);
    }
    int cnt = 0;
    while (!q.empty()) {
        ll v = q.front();
        q.pop();
        cnt++;
        if (cnt == k) {
            cout << v << endl;
            return 0;
        }
        int n = v%10;
        if (n != 0) q.push(v*10 + n-1);
        q.push(v*10 + n);
        if (n != 9) q.push(v*10 + n+1);
    }
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define n 1000000
int lowestp[n+1];
bool prime[n+1];
int ans=0; 
long long int count_p(long long int a,long long int b){
    int c=0;
    while(a%b==0) a=a/b,c++;
    int i=0,j=1;
    while(1){
        i+=j;
        j++;
        if(i+j>c) break;
    }
    ans+=j-1;
    return a;
}
int main(){
    int t;
    
    memset(prime, true, sizeof(prime)); 
  
    for (int p=2; p*p<=n; p++) 
    { 
        // If prime[p] is not changed, then it is a prime 
        if (prime[p] == true) 
        { 
            // Update all multiples of p greater than or  
            // equal to the square of it 
            // numbers which are multiple of p and are 
            // less than p^2 are already been marked.  
            lowestp[p]=p;
            for (int i=p*p; i<=n; i += p) 
                if(prime[i]) prime[i] = false,lowestp[i]=p; 
        } 
    }   
    for (int p=2; p<=n; p++)
    if(prime[p]) lowestp[p]=p;
    lowestp[1]=1;
    long long int a;
    cin>>a;
    if(a==1) {cout<<0<<endl;return 0;}
    long long int b=-1;
    for(long long int i=2;i*i<=a;i++){
        if(a%i==0) {b=i;break;}
    }
    //cout<<b<<"b"<<endl;
    if(b==-1) cout<<1;
    else{
        while(a!=1){
            //cout<<a<<"a "<<b<<endl;
            a=count_p(a,b);
            
            if(a<=1000000)
            b=lowestp[a];
            else{
                b=a;
                for(long long int i=2;i*i<=a;i++){
                    if(a%i==0) {b=i;break;}
                }           
            }
        }
        cout<<ans;
    }
    cout<<endl;
    return 0;

}

Measured memory_bytes: 8504
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb(x) push_back(x)
#define mp make_pair
#define sz(x) ((int)(x).size())
#define endl "\n"
#define fastio ios_base::sync_with_stdio(false); cin.tie(nullptr);
#define all(x) x.begin(),x.end()
#define y1 omg
#define INF 1000000010
#define FOR(x, n) for(int x=0; x<n; x++)
#define ini(x, n) memset(x, n, sizeof(x));
#define ctoi(x) (x - '0')
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;

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

int x, n, t;
map<int, int> M;

int main() {
	cin >> x >> n;
	FOR(i, n) {
		cin >> t;
		M[t] = 1;
	}
	for (int i = 0; ; i++) {
		if (M[x - i] == 0) {
			cout << x - i;
			return 0;
		}
		if (M[x + i] == 0) {
			cout << x + i;
			return 0;
		}
	}
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define int long long
#define endl '\n'
#define pii pair<int, int>
#define ff first
#define ss second
using namespace std;

const int INF = 1LL << 40;
const int MOD = 1e9 + 7;
const int N = 101;
const int K = 100001;
int a[N], n, k;
int dp[K][3];

#define first 1
#define second 2

//f takes no of stones left, player yet to play, returns winning player 

int f(int stones, int cur) {
    if(stones < 0) return cur;   //invalid move by prev player, so cur player is winner
    
    int &ans = dp[stones][cur];
    if(ans != -1) return ans;
    ans = 3 - cur;
    for(int i = 1; i <= n; i++) 
        if(f(stones - a[i], 3 - cur) == cur) 
            ans = cur;
    return ans;
}

signed main() {
    
    cin >> n >> k;

    for(int i = 1; i <= n; i++)
        cin >> a[i];
    
    for(int i = 0; i < K; i++) 
        dp[i][0] = dp[i][1] = dp[i][2] = -1;
    
    int winner = f(k, 1);
    
    if(winner == 1) cout << "First" << endl;
    else cout << "Second" << endl;
    
    return 0;
}

Measured memory_bytes: 7296
using System;
using System.Linq;
using System.Collections.Generic;

namespace ABC
{
    class ProgramD
    {
        static void Main(string[] args)
        {
            var n = long.Parse(Console.ReadLine());
            var s = Console.ReadLine().Select(x => x).ToArray();

            var result = 0;
            var j = s.Length - 1;
            for (var i = 0; i < n; i++)
            {
                if (s[i] == 'W')
                {
                    for (; j > i; j--)
                    {
                        if (s[j] == 'R')
                        {
                            s[i] = 'R';
                            s[j] = 'W';
                            result++;
                            // Console.WriteLine(string.Join(",", i, j));
                            // Console.WriteLine(string.Join("", s));
                            break;
                        }
                    }
                }
            }
            Console.WriteLine(result);
        }
    }
}


Measured memory_bytes: 29892
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int INF=1001001001;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
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; }

int main(){
    int k; cin >> k;
    vector <ll> a;
    for (int i=1; i<=9; i++) a.push_back(i);
    while(1){
        if (k<=a.size()){
            cout << a[k-1] << endl;
            return 0;
        }
        k-=a.size();
        vector <ll> old;
        swap(old,a);
        for (ll x:old){
            for (int i=-1; i<=1; i++){
                int d=x%10+i;
                if (d<0 || d>9) continue;
                ll nx=x*10+d;
                a.push_back(nx);
            }
        }
    }
    return 0;
}

Measured memory_bytes: 1712
// WeirdBugsButOkay

#include <bits/stdc++.h>
 
#define ll long long
#define ld long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
 
using namespace std;

ll pow3(ll a,ll b,ll m=1000000007)
{
    ll res=1;
    while(b>0)
    {
        if(b&1)
            res=(res*a)%m;
        a=(a*a)%m;
        b>>=1;
    }
    return res;
}

void solve()
{
    ll a,b,c;
    cin>>a>>b>>c;
    swap(a,b);
    swap(a,c);
    cout<<a<<" "<<b<<" "<<c<<endl;
}
 
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll q=1;
    //cin>>q;
    for(ll i=0;i<q;i++)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 764
#include<stdio.h>
int main()
{
	int L,R,d,x,i;
    
    do{
	scanf("%d",&L);
	scanf("%d",&R);
	scanf("%d",&d);
    }while(L<0 || L>100 || R<0 || R>100 || d<0 || d>100 || L>R );
  
  	i=0;
  	
	for(x=L;x<=R;x++)
	{
		if(x%d==0)
			i++;
	}
	
    printf("%d",i);
  
    return 0;
}

Measured memory_bytes: 1732
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n,a[100009],mmax=-1,temp;
	scanf("%d",&n);
	for (int i=0;i<n;i++)
		scanf("%d",&a[i]);
	for (int i=0;i<n;)
	{
		int temp=a[i];
		int ans=0;
		while (temp>=a[i]&&i<n)
		{
			temp=a[i];
			ans++;
			i++;
		}
		mmax=max(ans,mmax);
	}
	printf("%d\n",mmax-1);
	return 0;
}

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

int main()
{
    string s;
    cin >> s;
    int n = s.size();
    rep(i, n)
    {
        if(s[i] == '?')
        {
            s[i] = 'D';
        }
    }
    pri(s);
    return 0;
}


Measured memory_bytes: 3752
A, B, C = map(int, input().split())


def cf(x1, x2):
    cf = []
    for i in range(1, min(x1, x2) + 1):
        if x1 % i == 0 and x2 % i == 0:
            cf.append(i)
    return cf


cf_list = cf(A, B)
print(cf_list[-C])

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

int main(){
  int s;
  cin>>s;
  int a=s/100;
  int b=s-a*100;
  if(a>=1&&a<=12&&b<=12&&b>=1)
    cout<<"AMBIGUOUS"<<endl;
  else if(a>=1&&a<=12&&(b>12||b==0))
    cout<<"MMYY"<<endl;
  else if(b>=1&&b<=12&&(a>12||a==0))
    cout<<"YYMM"<<endl;
  else
    cout<<"NA"<<endl;
 }
    
  
  


Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std;
typedef long long ll;
const int MM = 1000000000;
const int MOD = MM + 7;
const int MAX = 510000;
#define rep(i, n) for(ll i=0; i<n; i++)
#define Rep(i, j, n) for(ll i=j; i<n; i++)
#define all(vec) vec.begin(), vec.end()
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() {
    int n, m, k; cin >> n >> m >> k;
    vector<ll> a(n), b(m);
    rep(i, n) cin >> a[i];
    rep(i, m) cin >> b[i];
    vector<ll> a_sum(n+1);
    rep(i, n) a_sum[i+1] = a_sum[i] + a[i];
    vector<ll> b_sum(m+1);
    rep(i, m) b_sum[i+1] = b_sum[i] + b[i];

    ll ans = 0;
    ll b_max = m;
    rep(i, n+1) {
        if(a_sum[i] > k) break;
        while(b_max > 0 && a_sum[i] + b_sum[b_max] > k) b_max--;
        ans = max(ans, i + b_max);
        // cout << i << ' ' << b_max << endl;
    }

    cout << ans << endl;
}

Measured memory_bytes: 9568
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>

typedef long long ll;

const ll mod=1e9+7;

#define all(x) x.begin(),x.end()
#define allr(x) x.rbegin(),x.rend()
#define rc(x)  return cout<<x<<"\n",0
#define sz(s)  (int) s.size()
#define pb push_back
#define mp make_pair
#define fr first
#define sc second

using namespace std;

ll n,x,k;
bool dp[100005];

int main() {
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin >> n >> k;
	ll a[k+2];
	for (int i=1; i<=n; i++) {
		cin >> a[i];
	}
	for (int stones=0; stones<=k; stones++) {
		for (int x=1; x<=n; x++) {
			if (stones>=a[x] && dp[stones-a[x]]==0) {
				dp[stones]=true;
				break;
			}
		}
	}
	if (dp[k]==true) {
		cout << "First";
	}
	else cout << "Second";
}


Measured memory_bytes: 384
/******************************************************************************

Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl,
C#, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog.
Code, Compile, Run and Debug online from anywhere in world.

*******************************************************************************/
#include <bits/stdc++.h>
using namespace std;

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

    return 0;
}


Measured memory_bytes: 3580
#include <iostream>

using namespace std;

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

    int c = a + b;
    int d = a - b;
    int e = a * b;
    if (c > d && c > e) cout << c;
    else if (d > e) cout << d;
    else cout << e;
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair < int,int > PII;
typedef pair < ll,ll > PLL;
#define pb push_back
//#all(x) (x).begin(),(x).end()

//int const N = 1;
int const MOD = 1e9 + 7;

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

int const N = 21;

ll dp[(1<<N)+10] ;
int ara[N+1][N+1];
int n;

ll F(int mask)
{
    if(mask == ((1<<n) -1) ) return 1;
    ll &r = dp[mask];

    if(r != -1) return r;
    r = 0;
    int manid = __builtin_popcount(mask);
    for(int i = 0; i < n; i++)
    {
        if(!(mask & (1<<i)) and ara[manid][i]){
            r = (r + F(mask | (1<<i))) % MOD;
        }
    }
    return r;
}
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin >> n ;

    for(int i = 0; i < n; i++)
        for(int j = 0; j < n; j++)
            cin >> ara[i][j] ;
    memset(dp,-1,sizeof dp);
    cout << F(0) << endl;

    return 0;
}




Measured memory_bytes: 16768
#ifdef __GNUC__ 
#include <bits/stdc++.h>
auto & in = std::cin;
#else
std::istringstream in;
#endif
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/dynamic_bitset.hpp>
using namespace std;
#define ALL(v) std::begin(v),std::end(v)
using u6 = std::uint64_t;
using u3 = std::uint32_t;
constexpr u6 moduloNo = 1'000'000'000 + 7; //'
constexpr u3 maxA = 0x10'0000;
struct State {
	array<u3, 3> buf;
	//State() :buf{ 1,0,1 } {}
	constexpr State() :buf{1,0,0}{}
	State(u3 zerocount) :buf{ 1,0,zerocount } { addX(zerocount); }
	void addX(u3 zero) {
		if (zero != buf[2]) {
			u6 zerodiff = zero - buf[2];
			buf[0] = (u3)(((u6)buf[0] + zerodiff * buf[1]) % moduloNo);
			buf[2] = zero;

		}

		buf[1] = buf[0] + buf[1];
		buf[1] = (buf[1] >= moduloNo) ? buf[1] - moduloNo : buf[1];
	}
};
u6 pow2(u6 n) {
	if (n < 64)return (u6(1) << n) % moduloNo;
	else if (n == 64)return (u6(0) - moduloNo) % moduloNo;
	u6 tmp = pow2(n / 2);
	tmp = tmp * tmp;
	if (n & 1)tmp *= 2;
	return tmp % moduloNo;
}

struct Calc {
	u6 N;

	//unordered_map<u3, State> stmap;
	State stmap[maxA];
	//set <u3> nums;
	u6 calc(u6 N_) {
		N = N_;
		u3 st = 0;
		u3 tmp;
		u3 zerocount = 0;
		for (u3 index = 0; index < N; ++index) {
			in >> tmp;
			st ^= tmp;
			if (!st) {
				++zerocount;
				//cout << index << endl;
			}
			else {
				/*
				auto ite = stmap.find(st);
				if (ite == stmap.end()) {
					stmap.emplace(st, zerocount);
				}
				else {
					ite->second.addX(zerocount);
				}*/
				stmap[st].addX(zerocount);
				//nums.insert(st);
			}
		}
		if (st != 0) {
			return stmap[st].buf[0];
		}
		else {
			u6 result = pow2(zerocount - 1);
			//for (auto & num : nums) {
			for (auto & stv : stmap) {
				result = (result + stv.buf[1]) % moduloNo;
				//result = (result + stmap[num].buf[1]) % moduloNo;
			}

			/*u6 sum0 = 0, sum1 = 0;
			for (auto & stv : stmap) {
				cout << stv.second.buf[0] << " " << stv.second.buf[1]  <<  " " << stv.second.buf[2] << endl;
				sum0 += stv.second.buf[0];
				sum1 += stv.second.buf[1];
			}
			cout << sum0 << " " << sum1 << endl;*/
			return result;
		}
	}
};
Calc calc;

int main() {

#ifndef __GNUC__ 
	in.str("32\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0");
#endif
	u6 N;
	cin >> N;
	cout << calc.calc(N) << endl;
	/*
	u6 i = 0; u6 maxnum = 0;
	for (auto & v : tbl.buf) {
		for (auto n : v.buf) {
			if (n > maxnum)maxnum = n;
		}
	}
	cout << maxnum << endl;
	for (auto & v : tbl.buf) {
		cout << i << "=" << v << endl;
		++i;
	}
	cout << maxnum << endl;*/
}


Measured memory_bytes: 12672
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define de(x) cout << #x << "=" << x << endl
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define lb(x) (x&-(x))
const int N = 101010;
int n,x;
int a[105];
int main(){
	scanf("%d%d",&n,&x);
	rep(i,0,n) scanf("%d",&a[i]);
	sort(a,a+n);
	int sum=0;
	int cnt=0;
	rep(i,0,n)
	{
		if(x-sum>0) {sum+=a[i];cnt++;}
	}
	int res=x-sum;
	printf("%d\n",cnt+res/a[0]);
    return 0;
}


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

signed main() {
    int n,m;
    cin >> n >> m;

    map<int,int> mp;
    for(int i = 0; i < m; i++){
        int a,b;
        cin >> a >> b;
        mp[a]++;
        mp[b]++;
    }

    bool flag = true;
    for(auto it : mp){
        if(it.second % 2 != 0) flag = false;
    }
    if(flag) cout << "YES" << endl;
    else cout << "NO" << endl;
}

Measured memory_bytes: 5632
#include<iostream>
using namespace std;
int main() {
	long int L[100];
	int N;
	cin >> N;
	L[0] = 2;
	L[1] = 1;

	for (int i = 2; i <= N; i++)
		L[i] = L[i - 1] + L[i - 2];
	cout << L[N] << endl;
}

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

int main () {
  int n;
  int a[100];
  int c = 0;

  scanf("%d", &n);
  rep(i,n) scanf("%d", &a[i]);

  rep(i,n) {
    int k = i;
    for(int j = i; j < n; j++){
      if(a[j] < a[k]) k = j;
    }
    if(i != k) {
      swap(a[k], a[i]);
      c++;
    }
  }

  rep(i,n) {
    if(i > 0) printf(" ");
    printf("%d", a[i]);
  }
  printf("\n%d\n", c);

  return 0;
}

Measured memory_bytes: 3200
#include "bits/stdc++.h"
using namespace std;

int main() {
	long long N;
	vector<pair<long long, long long> > V;
	cin >> N;
	vector<vector<long long> > NOW(2, vector<long long>(N, 0));
	vector<vector<vector<vector<long long> > > > COUNT(2, vector<vector<vector<long long> > >(N, vector<vector<long long> >(2)));
	V.resize(N * 2);
	for (int i = 0; i < N * 2; i++) {
		char C;
		cin >> C >> V[i].first;
		V[i].first--;
		if (C == 'B') V[i].second = 0;
		else V[i].second = 1;
	}
	for (int i = 0; i < N * 2; i++) {
		COUNT[V[i].second][V[i].first][0] = NOW[0];
		COUNT[V[i].second][V[i].first][1] = NOW[1];
		NOW[V[i].second][V[i].first]++;
	}
	for (int i = 0; i < 2; i++) {
		for (int j = 0; j < N; j++) {
			for (int k = 0; k < 2; k++) {
				for (int l = N - 2; l >= 0; l--) {
					COUNT[i][j][k][l] += COUNT[i][j][k][l + 1];
				}
			}
		}
	}
	long long INF = 1000000000000;
	vector<vector<long long> > DP(N * 2 + 1, vector<long long>(N + 1, INF));
	DP[0][0] = 0;
	for (int i = 0; i < N * 2; i++) {
		for (int j = 0; j <= N; j++) {
			long long NOWB = j, NOWW = i - j;
			if (0 <= NOWB && NOWB < N && 0 <= NOWW && NOWW <= N) {
				long long PB, PW;
				PB = COUNT[0][NOWB][0][NOWB];
				if (NOWW >= N) PW = 0;
				else PW = COUNT[0][NOWB][1][NOWW];
				DP[i + 1][j + 1] = min(DP[i + 1][j + 1], DP[i][j] + PB + PW);
			}
			if (0 <= NOWB && NOWB <= N && 0 <= NOWW && NOWW < N) {
				long long PB, PW;
				PW = COUNT[1][NOWW][1][NOWW];
				if (NOWB >= N) PB = 0;
				else PB = COUNT[1][NOWW][0][NOWB];
				DP[i + 1][j] = min(DP[i + 1][j], DP[i][j] + PB + PW);
			}
		}
	}
	cout << DP[N * 2][N] << endl;
}

Measured memory_bytes: 188544
object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val n = sc.nextLong()
  val x, m = sc.nextInt()

  val a = Array.fill(m)(0L)
  val idx = Array.fill(m)(-1)

  var i = 0
  var now = x.toLong
  while (idx(now.toInt) == -1) {
    idx(now.toInt) = i
    a(i) = now
    now = (now * now) % m
    i += 1
  }

  val s = idx(now.toInt)
  val e = i - 1
  val l = e - s + 1
  val ac = a.scanLeft(0L)(_+_)
  var ans = 0L

  if (n < s) {
    ans += ac(n.toInt)
  } else {
    var r = n
    ans += ac(s)
    r -= s

    ans += (ac(e+1) - ac(s)) * (r / l)
    ans += ac(s + (r % l).toInt) - ac(s)
  }

  println(ans)
}


Measured memory_bytes: 58840