akhauriyash/Code-Regression huggingface dataset:
/*　　　　　　　{:i:i:|i:i:/l/l--　 　 　--l/li:i:i|i:i:i:i}
　　　　　　 　 {:rx|:i:i ィi芥ミ 　 　 .ィi芥ミｉ:ｉ|ﾍ:i:i:}
.　　　 　 　 　 ｛ﾏ|ｉ:  {::’:} 　 　 　{:‘::} :ｉ:i:|〉｝:/
　　 　 　 　 　 乂|:i:| ｀¨¨¨¨´ 　 　　｀¨¨¨´  :i:ｉ:|ｼ/
　 　 　 　 　 　 ﾉ:|:i|　　　　　　′　　　 　   |:i:i:|ﾂ
　　　　　　　　/:/|:i:| ､　　　 　_ _ 　　　　  |:i:i:|
　 　 　　 　 /:/ .|:i:|/ ＼　　　 　 　     ｨ〔|:i:/
　　 　 　  　 〈;/ く刈＿ 个 　   -   　＜}　./|/_〉
　　     　　 r-っ'~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ|___
　　 　     /／ニつ　　　　　　 ､　　　　　　　ノﾆﾆ　＼
.　　　     |　　ニ⊃ 　./　/　 ──   /　/　　..⊆ﾆﾆ　　:|
.　　　     |　　丁´　 /|￣|￣  ─‐ /|￣|￣ 　 .￣|丁 　|
.　　　     |　　ﾉ.  　 |￣|￣  ─‐  |￣|￣ 　 　.|八 　|
.　　　     |　　||. 　 |￣|￣ |￣| |￣|￣ 　   .|　|
.　 　 　   |  　||   　￣￣￣　￣ 　￣￣￣　　  .|　|  |
.　 　 　  　    ||＿＿＿＿＿＿＿＿＿＿＿＿______|__　　 ',
　 　      ,′　 | ７ﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆ}  ,′
.　　     {　　　|/　}ﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆ{/ 　 　
*///讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐讐。
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>
#include <limits>

using namespace std;

#define rep(b) for(int i=0;i<int(b);i++)
#define ll long long
#define fst first
#define snd second
#define pf(b) printf("%.12f\n",(double)b)
#define _GLIBCXX_DEBUG
const double pai = 3.1415926535897;
#define _cos(n) cos(n*pai/180)
#define l_b lower_bound
#define u_b upper_bound
#define b_s binary_search

//factorial(練習)　階乗
int fact(int n) {
	int a = 1;
	for (int i = 1;i <= n;i++) a *= i;
	return a;
}
int sa(int n, int m) {      //差！
	if (n < m)return m - n;
	else return n - m;
}
int keta(int num) {
	int n = 0;
	if (num == 0) {
		return 1;
	}
	while (num != 0) {
		num /= 10;
		n++;
	}
	return n;
}

ll n, a[123456], q, b[123456], c[123456],cn[123456],s[123456];
signed main() {
	cin >> n;
	rep(n) {
		cin >> a[i];
		cn[a[i]]++;
		s[0] += a[i];
	}
	cin >> q;
	for (int i = 1;i <= q;i++) {
		cin >> b[i] >> c[i];
		s[i] = s[i - 1] + (cn[b[i]] * (c[i] - b[i]));
		cn[c[i]] += cn[b[i]];
		cn[b[i]] = 0;
	}
	for (int i = 1;i <= q;i++) {
		cout << s[i] << endl;
	}
}

Measured memory_bytes: 7516
#include<iostream>

using namespace std;

int main(){
    long int a,b;
    cin>>a>>b;
    long int c=a*b;
    long int d=a+b;
    long int e=a-b;
    long int f=max(c,d);
    cout<<max(f,e)<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fod(i,a,b) for(int i=a;i>=b;i--)
#define me0(a) memset(a,0,sizeof(a))
#define me1(a) memset(a,-1,sizeof(a))
#define op freopen("in.txt", "r", stdin)
#define pii pair<int,int>
#define mp(x,y) make_pair(x,y)
using namespace std;
const int INF = 0x3f3f3f3f;
typedef long long LL;
void read(int& val) { int x = 0; int bz = 1; char c; for (c = getchar(); (c<'0' || c>'9') && c != '-'; c = getchar()); if (c == '-') { bz = -1; c = getchar(); }for (; c >= '0' && c <= '9'; c = getchar()) x = x * 10 + c - 48; val = x * bz; }
const int mod=998244353;
const int maxn = 1e5+7;

LL n,m,a[maxn];
char ans[maxn];
LL f[100],sum[100];
int main(){
    f[0]=1;
    fo(i,1,100) f[i]=f[i-1]*26;
    cin>>n;
    int len = 0;
    LL nw = 0;
    while (nw < n) {
        len++;nw += f[len];
    }
    nw-=f[len];
    n-=nw;



    fo(i, 1, len) {
        LL x=n/f[len-i];
        if(n%f[len-i]==0) x--;
        n-=x*f[len-i];
        ans[i]=x+'a';
    }

    fo(i, 1, len) cout << ans[i];
    cout << endl;
    return 0;
}


Measured memory_bytes: 3600
using System;

class MyClass
{
    static void Main(string[] args)
    {
        int t = int.Parse(Console.ReadLine());
        for (int i = 0; i < t; i++)
        {
            int n = int.Parse(Console.ReadLine());
            string[] str = Console.ReadLine().Split(' ');
            int[] h = new int[n];
            for (int j = 0; j < n; j++)
            {
                h[j] = int.Parse(str[j]);
            }
            int up = 0;
            int down = 0;
            for (int j = 0; j < n-1; j++)
            {
                int dif = h[j + 1] - h[j];
                if (dif > 0 && up < dif)
                {
                    up = dif;
                }
                else if (dif < 0 && down > dif)
                {
                    down = dif;
                }
            }
            Console.WriteLine("{0} {1}", up, -down);
        }
    }
}


Measured memory_bytes: 5804
#include <stdio.h>

int main (void)
{
    int N, K;
    int h[100000];
    scanf("%d%d", &N, &K);
    int i;
    int num = 0;
    for (i = 0; i < N; i++) {
        scanf("%d", &h[i]);
        if (h[i] >= K) num++;
    }
    
    printf("%d", num);

    return 0;
}

Measured memory_bytes: 512
using System;

class Fairness{
    static void Main(string[] args){
        var inputs = Console.ReadLine().Split(' ');
        var a = int.Parse(inputs[0]);
        var b = int.Parse(inputs[1]);
        var c = int.Parse(inputs[2]);
        var k = long.Parse(inputs[3]);

        var ans = 0;
        if(k%2==1){
            ans = b-a;
        }else{
            ans = a-b;
        }

        if(ans.ToString().Length > 20){
            Console.WriteLine("Unfair");
            return;
        }
        Console.WriteLine(ans);
    }
}

Measured memory_bytes: 13140
import java.io.IOException;
import java.io.InputStream;
import java.math.BigInteger;
import java.util.*;
public class Main
{
 static int lds(int arr[], int n) 
{ 
    
    int max = 0, len = 0; 
      
    
    for (int i=1; i<n; i++) 
    { 
        
        if (arr[i] <= arr[i-1]) 
            len++; 
        else
        { 
            
            if (max < len)     
                max = len; 
                  
            
            len = 0;     
        }     
    } 
  
    if (max < len) 
        max = len; 
      
    
    return max; 
} 
  
    public static void main(String[] args)throws IOException
    {
        FastReader in=new FastReader(System.in);
        StringBuffer st=new StringBuffer();
        
        int n=in.nextInt();
        int a[]=new int[n];
        for(int i=0;i<n;i++)
        a[i]=in.nextInt();
          
        System.out.println(lds(a,n));
    }
    static class FastReader{
 
        byte[] buf = new byte[2048];
        int index, total;
        InputStream in;
 
        FastReader(InputStream is) {
            in = is;
        }
 
        int scan() throws IOException {
            if (index >= total) {
                index = 0;
                total = in.read(buf);
                if (total <= 0) {
                    return -1;
                }
            }
            return buf[index++];
        }
 
        String next() throws IOException {
            int c;
            for (c = scan(); c <= 32; c = scan());
            StringBuilder sb = new StringBuilder();
            for (; c > 32; c = scan()) {
                sb.append((char) c);
            }
            return sb.toString();
        }
 
        int nextInt() throws IOException {
            int c, val = 0;
            for (c = scan(); c <= 32; c = scan());
            boolean neg = c == '-';
            if (c == '-' || c == '+') {
                c = scan();
            }
            for (; c >= '0' && c <= '9'; c = scan()) {
                val = (val << 3) + (val << 1) + (c & 15);
            }
            return neg ? -val : val;
        }
 
        long nextLong() throws IOException {
            int c;
            long val = 0;
            for (c = scan(); c <= 32; c = scan());
            boolean neg = c == '-';
            if (c == '-' || c == '+') {
                c = scan();
            }
            for (; c >= '0' && c <= '9'; c = scan()) {
                val = (val << 3) + (val << 1) + (c & 15);
            }
            return neg ? -val : val;
        }
    }
}      

Measured memory_bytes: 22740
import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        
        
        List<Long> number = new ArrayList<Long>(){
            {
                add(Long.parseLong(sc.next()));
                add(Long.parseLong(sc.next()));
                add(Long.parseLong(sc.next()));
            }
        };
        
        Collections.sort(number, Comparator.reverseOrder());
        
        long K = Long.parseLong(sc.next());
        
        for(long i=0; i<K; i++){
            number.set(0, number.get(0)*2);
        }
        
        System.out.println(number.get(0) + number.get(1) + number.get(2));
    }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())

using namespace std;
typedef long long ll;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const int INF = (1 << 29);
const long long INFL = (1LL<<60);
const double eps = (1e-9);

int main(int argc, char* argv[])
{
  int n, m;
  cin >> n >> m;
  set<int> from1;
  set<int> ton;
  rep(i, m) {
    int a, b;
    cin >> a >> b;
    if (a == 1) {
      from1.insert(b);
    } else if (b == n) {
      ton.insert(a);
    }
  }

  for (auto itr = from1.begin(); itr != from1.end(); itr++) {
    if (ton.find(*itr) != ton.end()) {
      cout << "POSSIBLE" << endl;
      return 0;
    }
  }

  cout << "IMPOSSIBLE" << endl;

  return 0;
}


Measured memory_bytes: 9600
#input of int(split by space)
def get_i()
  return gets.chomp.split(" ").map(&:to_i)
end
#input of float(split by space)
def get_f()
  return gets.chomp.split(" ").map(&:to_f)
end
#input of string(split by space)
def get()
  return gets.chomp.split(" ")
end
#input of string(split per one character)
def get_nsp()
  return gets.chomp.split("")
end
#yes or no decision
def yn_judge(bool,y="Yes",n="No")
  return bool ? y : n 
end
#create of array
def array(size1,init=nil,size2=-1)
  if size2==-1
      return Array.new(size1){init}
  else
      return Array.new(size2){Array.new(size1){init}}
  end
end

def max(a,b)
    return a>b ? a : b
end

def min(a,b)
    return a>b ? b : a
end

INF=Float::INFINITY

S=get_nsp
T=get_nsp
N=S.size
ab=Array.new(N){Hash.new(-1)}
N.times do|i|
  unless i.zero?
      ("a".."z").to_a.each do|c|
        ab[N-i-1][c]=ab[N-i][c] 
      end
  end
  ab[N-i-1][S[N-i-1]]=N-1-i
end
N.times do|i|
    ("a".."z").to_a.each do|c|
        ab[N-i-1][c]=ab[0][c] if ab[N-i-1][c]==-1
    end
end
prev=0
k=0
#p ab[0]
T.each do|t|
    if ab[prev][t]==-1
        puts "-1"
        exit
    elsif prev>ab[prev][t]
        prev=ab[prev][t]
        k+=1
    else
        prev=ab[prev][t]
    end
    prev+=1
    if prev>=N
        prev%=N
        k+=1
    end
end
puts k*N+prev

Measured memory_bytes: 132184
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>

#define FOR(i, a, b) for (int i = (a); i < int(b); ++i)
#define RFOR(i, a, b) for (int i = (b)-1; i >= int(a); --i)
#define REP(i, n) FOR(i, 0, n)
#define REP1(i, n) FOR(i, 1, int(n) + 1)
#define RREP(i, n) RFOR(i, 0, n)
#define RREP1(i, n) RFOR(i, 1, int(n) + 1)
#define ALL(c) begin(c), end(c)

int _ = (
#ifndef LOCAL
    std::cin.tie(nullptr), std::ios::sync_with_stdio(false),
#endif
    std::cout.precision(10), std::cout.setf(std::ios::fixed));

using ll = long long;
using ull = unsigned long long;
using ld = long double;
template <typename T> using vec = std::vector<T>;
using namespace std;

int main() {
  constexpr auto SELECTED = -1;

  array<array<ll, 3>, 3> A;
  REP(i, 3) {
    REP(j, 3) { cin >> A[i][j]; }
  }
  ll N;
  cin >> N;
  REP(i, N) {
    ll B;
    cin >> B;
    REP(i, 3) {
      REP(j, 3) {
        if (A[i][j] == B) {
          A[i][j] = SELECTED;
        }
      }
    }
  }

  if (A[0][0] == SELECTED && A[1][0] == SELECTED && A[2][0] == SELECTED) {
    cout << "Yes" << endl;
  } else if (A[0][1] == SELECTED && A[1][1] == SELECTED &&
             A[2][1] == SELECTED) {
    cout << "Yes" << endl;
  } else if (A[0][2] == SELECTED && A[1][2] == SELECTED &&
             A[2][2] == SELECTED) {
    cout << "Yes" << endl;
  } else if (A[0][0] == SELECTED && A[0][1] == SELECTED &&
             A[0][2] == SELECTED) {
    cout << "Yes" << endl;
  } else if (A[1][0] == SELECTED && A[1][1] == SELECTED &&
             A[1][2] == SELECTED) {
    cout << "Yes" << endl;
  } else if (A[2][0] == SELECTED && A[2][1] == SELECTED &&
             A[2][2] == SELECTED) {
    cout << "Yes" << endl;
  } else if (A[0][0] == SELECTED && A[1][1] == SELECTED &&
             A[2][2] == SELECTED) {
    cout << "Yes" << endl;
  } else if (A[0][2] == SELECTED && A[1][1] == SELECTED &&
             A[2][0] == SELECTED) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
from collections import deque
import math

def Next(): return input()
def NextInt(): return int(Next())
def NextInts(): return map(int,input().split())
def Nexts(): return map(str,input().split())
def NextIntList(): return list(map(int,input().split()))
def RowInts(n): return [input() for i in range(n)]

s = input()
print(s.replace('?', 'D'))


Measured memory_bytes: 9704
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE BinaryLiterals #-}
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE NumDecimals #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TupleSections #-}

import Control.Applicative
import Control.Arrow
import Control.Monad
import Control.Monad.ST

import Data.Char
import Data.List
import Data.Maybe

import qualified Data.ByteString.Char8 as B

import Data.Array.ST.Safe
import Data.STRef

import Debug.Trace
import Text.Printf

readInt = readLn :: IO Int
readInteger = readLn :: IO Integer
readInts = map ( fst . fromJust . B.readInt ) . B.words <$> B.getLine
readIntegers = map ( fst . fromJust . B.readInteger ) . B.words <$> B.getLine

which a b f = if f then a else b
mp [ a, b ] = ( a, b )

modifyArray a i f = writeArray a i =<< f <$> readArray a i

main = readInts >>= print . uncurry (*) . mp

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

int main() {
  int64_t N, D, sum = 0;
  cin >> N >> D;
  for (int i = 0; i < N; i++ ) {
    int64_t a, b, d2;
    cin >> a >> b;
    d2 = a*a + b*b;
    if (d2 <= D*D) {
      sum++;
    }
  }
  cout << sum << endl;
}

Measured memory_bytes: 3636
/*⠄⢰⣧⣼⣯⠄⣸⣠⣶⣶⣦⣾⠄⠄⠄⠄⡀⠄⢀⣿⣿⠄⠄⠄⢸⡇⠄⠄
⠄⠄⠄⣾⣿⠿⠿⠶⠿⢿⣿⣿⣿⣿⣦⣤⣄⢀⡅⢠⣾⣛⡉⠄⠄⠄⠸⢀⣿⠄
⠄⠄⢀⡋⣡⣴⣶⣶⡀⠄⠄⠙⢿⣿⣿⣿⣿⣿⣴⣿⣿⣿⢃⣤⣄⣀⣥⣿⣿⠄
⠄⠄⢸⣇⠻⣿⣿⣿⣧⣀⢀⣠⡌⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠿⠿⣿⣿⣿⠄
⠄⢀⢸⣿⣷⣤⣤⣤⣬⣙⣛⢿⣿⣿⣿⣿⣿⣿⡿⣿⣿⡍⠄⠄⢀⣤⣄⠉⠋⣰
⠄⣼⣖⣿⣿⣿⣿⣿⣿⣿⣿⣿⢿⣿⣿⣿⣿⣿⢇⣿⣿⡷⠶⠶⢿⣿⣿⠇⢀⣤
⠘⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣽⣿⣿⣿⡇⣿⣿⣿⣿⣿⣿⣷⣶⣥⣴⣿⡗
⢀⠈⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟⠄
⢸⣿⣦⣌⣛⣻⣿⣿⣧⠙⠛⠛⡭⠅⠒⠦⠭⣭⡻⣿⣿⣿⣿⣿⣿⣿⣿⡿⠃⠄
⠘⣿⣿⣿⣿⣿⣿⣿⣿⡆⠄⠄⠄⠄⠄⠄⠄⠄⠹⠈⢋⣽⣿⣿⣿⣿⣵⣾⠃⠄
⠄⠘⣿⣿⣿⣿⣿⣿⣿⣿⠄⣴⣿⣶⣄⠄⣴⣶⠄⢀⣾⣿⣿⣿⣿⣿⣿⠃⠄⠄
⠄⠄⠈⠻⣿⣿⣿⣿⣿⣿⡄⢻⣿⣿⣿⠄⣿⣿⡀⣾⣿⣿⣿⣿⣛⠛⠁⠄⠄⠄
⠄⠄⠄⠄⠈⠛⢿⣿⣿⣿⠁⠞⢿⣿⣿⡄⢿⣿⡇⣸⣿⣿⠿⠛⠁⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⠄⠉⠻⣿⣿⣾⣦⡙⠻⣷⣾⣿⠃⠿⠋⠁⠄⠄⠄⠄⠄⢀⣠⣴
⣿⣿⣿⣶⣶⣮⣥⣒⠲⢮⣝⡿⣿⣿⡆⣿⡿⠃⠄⠄⠄⠄⠄⠄⠄⣠⣴⣿*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;
#define ll long long
#define ii pair<ll,ll>
#define iii pair<ii,ll>
#define fi first
#define se second
#define endl '\n'
#define debug(x) cout << #x << " is " << x << endl;

#define rep(x,start,end) for(auto x=(start)-((start)>(end));x!=(end)-((start)>(end));((start)<(end)?x++:x--))
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()

ll MAX(ll a){return a;}
ll MIN(ll a){return a;}
template<typename... Args>
ll MAX(ll a,Args... args){return max(a,MAX(args...));}
template<typename... Args>
ll MIN(ll a,Args... args){return min(a,MIN(args...));}

#define indexed_set tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>

mt19937 rng(chrono::system_clock::now().time_since_epoch().count());

const int MOD=1000000007;

long long qexp(long long b,long long p,int m){
    long long res=1;
    while (p){
        if (p&1) res=(res*b)%m;
        b=(b*b)%m;
        p>>=1;
    }
    return res;
}

ll inv(ll i){
	return qexp(i,MOD-2,MOD);
}

ll fac[2000005];

ll nCk(int i,int j){
	return fac[i]*inv(fac[j])%MOD*inv(fac[i-j])%MOD;
}

int n;
string s;

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	fac[0]=1;
	rep(x,1,2000005) fac[x]=fac[x-1]*x%MOD;
	
	cin>>n>>s;
	
	ll ans=0;
	
	n+=sz(s);
	rep(x,sz(s),n+1){
		//cout<<x<<" "<<nCk(x-1,sz(s)-1)<<endl;
		ans+=qexp(26,n-x,MOD)*qexp(25,x-sz(s),MOD)%MOD*nCk(x-1,sz(s)-1);
		ans%=MOD;
	}
	
	cout<<ans<<endl;
}


Measured memory_bytes: 19928
#include<iostream>
#include<vector>
#include<cmath>

using namespace std;

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

typedef long double D;
typedef vector<D> V;
typedef vector<V> M;

const D EPS = 1e-8;

int sig(D a, D b = 0) {return a < b - EPS ? -1 : a > b + EPS ? 1 : 0;}

V gauss_jordan(M m, V v) {
  for (int r = m.size(); r--; ) {
    int p = r;
    rep (i, r) if (abs(m[i][r]) > abs(m[p][r])) p = i;
    swap(m[r], m[p]);
    swap(v[r], v[p]);
    v[r] /= m[r][r];
    rep (i, r) m[r][i] /= m[r][r];
    rep (i, m.size()) if(i != r) {
      v[i] -= m[i][r] * v[r];
      rep (k, r) m[i][k] -= m[i][r] * m[r][k];
    }
  }
  return v;
}

int main() {
  D in[5][3];
  rep (i, 5) rep (j, 3) cin >> in[i][j];
  M m(3, V(3));
  V v(3);
  rep (i, 3) rep (j, 3) m[j][i] = in[2 + i][j] - in[0][j];
  rep (i, 3) v[i] = in[1][i] - in[0][i];
  V r = gauss_jordan(m, v);
  rep (i, 3) if (sig(r[i]) < 0) {
    cout << "HIT" << endl;
    return 0;
  }
  if (sig(r[0] + r[1] + r[2], 1) < 0) cout << "HIT" << endl;
  else cout << "MISS" << endl;
}

Measured memory_bytes: 1240
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define Rep(i, N) for(int i = 0; i < N; i++)
#define Reps(i, x, N) for(int i = x; i < N; i++)

const int LLINF = 1LL << 60;

signed main()
{
  int N, M, P;
  while(cin >> N >> M >> P, N || M || P) {
    
    int A[105];
    P = 100 - P;

    Rep(i, N) cin >> A[i];
    --M;
    if(A[M]) cout << accumulate(A, A + N, 0LL) * 100 * P / A[M] / 100 << endl;
    else cout << 0 << endl;
  }

  return 0;
}
    

Measured memory_bytes: 3052
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		int K = sc.nextInt();
		int sum = 0;

		if(A>=K) {
			sum += K;
			K=0;
		}
		else if(A<K) {
			sum += A*1;
			K -= A;
		}

		if(B>=K && K != 0) {
			sum += K*0;
			K = 0;
		}
		else if(B<K) {
			sum += B*0;
			K -= B;
		}

		if(C>=K && K != 0) {
			sum += K*-1;
			K = 0;
		}
		else if(C<K) {
			sum += C*-1;
			K -= C;
		}

		System.out.println(sum);

    }
}


Measured memory_bytes: 35800
Scanf.scanf "%s" (fun s ->
    let h = Array.make 26 false in
    String.iter (fun c -> h.(int_of_char c - 97) <- true) s;
    let rec chl c s cnt =
        let n = String.length s in
        let rec loop i =
            if i = n then true else
                if s.[i] = c then loop (i + 1) else false
        in
        if loop 0 then cnt else
            let s = String.init (n - 1) (fun i ->
                if s.[i] = c || s.[i + 1] = c then c else s.[i])
            in
            chl c s (cnt + 1)
    in
    let rec loop i acc =
        if i = 26 then acc else
            if h.(i) then loop (i + 1) (min acc (chl (char_of_int (i + 97)) s 0))
                      else loop (i + 1) acc
    in
    loop 0 max_int |> Printf.printf "%d\n"
)

Measured memory_bytes: 3916
n = int(input())
l = list(map(int,input().split()))
ans = 0
now = 0
m = 0
c = 0
for i in l:
    if now == 0:
        now = i
    else:
        if m == 0:
            if now < i:
                m = 1
            elif now > i:
                m = -1
        elif m == 1:
            if now > i:
                ans += 1
                m = 0
            
        else:
            if now < i:
                ans += 1
                m = 0
        now = i

print(ans+1)

Measured memory_bytes: 20072
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<cmath>
#include<math.h>
#include<algorithm>
#include<string.h>
#include <iomanip>
#include <sstream>
using namespace std;

int main() {
  int D;

  cin >> D;

  cout << "Christmas" ;
  if(D <25 ){
  cout << " Eve" ;
  }
  if(D <24 ){
  cout << " Eve" ;
  }
  if(D <23 ){
  cout << " Eve" ;
  }
  cout << endl ;

}


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

int main() {
    int H, W; cin >> H >> W; 
    vector<string> S(H);
    rep(i,H) cin >> S.at(i);

    vector<string> s(H+3, "#");
    rep(i, W+1) {
        s.at(0) += '#';
        s.at(H+1) += '#';
    }

    rep(i, H){
        s.at(i+1) += S.at(i) + '#';
    }

    vector<vector<int>> map(H+2, vector<int>(W+2, -1));
    vector<vector<int>> map2(H+2, vector<int>(W+2, -1));

    #if 0
    rep(i, H+2) rep(j, W+2) {
        cout << s.at(i).at(j) << " ";
        if(j==W+1) cout << endl;
    }
    #endif

    for(int i=1; i<=H; i++){
        for(int j=1; j<=W; j++){
            if(map.at(i).at(j)!=-1) continue;
            if(s.at(i).at(j)=='#') continue;

            int k=1;
            while(j+k<=W){
                if(s.at(i).at(j+k)!='#'){
                    k++;
                }
                else break;
            }
            
            for(int l=j; l<j+k; l++){
                map.at(i).at(l) = k;
            }
        }
    }

    for(int j=1; j<=W; j++){
        for(int i=1; i<=H; i++){
            if(map2.at(i).at(j)!=-1) continue;
            if(s.at(i).at(j)=='#') continue;
            
            int k=1;
            while(i+k<=H){
                if(s.at(i+k).at(j)!='#'){
                    k++;
                }
                else break;
            }
            for(int l=i; l<i+k; l++){
                map2.at(l).at(j) = k;
            }
        }
    }

    #if 0
    rep(i, H) rep(j, W) {
        cout << map.at(i+1).at(j+1) << " ";
        if(j==W-1) cout << endl;
    }
    
    cout << endl;

    rep(i, H) rep(j, W) {
        cout << map2.at(i+1).at(j+1) << " ";
        if(j==W-1) cout << endl;
    }
    #endif

    int ans = 0;
    for(int i=1; i<=H; i++){
        for(int j=1; j<=W; j++){
            ans = max(ans, map.at(i).at(j)+map2.at(i).at(j)-1);
        }
    }

    cout << ans << endl;

}


Measured memory_bytes: 39808
#include<cstdio>
#include<set>
using namespace std;
int n;
set<int> s;
int main()
{
	scanf("%d",&n);
	for(int i = 1;i <= n;i++){
		int x;scanf("%d",&x);
		if(s.find(x) != s.end()) s.erase(s.find(x));
		else s.insert(x);
	}
	printf("%d\n",s.size());
	return 0;
}

Measured memory_bytes: 4864
// 居合を終え、青い絵を覆う
#include <iostream>
using namespace std;

char vowel[5]={'a','i','u','e','o'};

int main(){
    char c;
    cin>>c;
    bool b=false;
    for(int i=0;i<5;i++){
        if(c==vowel[i]) b=true;
    }
    cout<<(b?"vowel":"consonant")<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#include <ext/pb_ds/detail/standard_policies.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef tree<pair<int, int>, null_type, less<pair<int, int>>, rb_tree_tag,
		tree_order_statistics_node_update> ordered_set;

#define el				'\n'
#define sz(v)			((int)((v).size()))
#define all(v)          ((v).begin()),((v).end())
#define clr(v, d)		memset(v, d, sizeof(v))

double const EPS = 1e-8, PI = acos(-1);
const int N = 1e5 + 9, M = 1e5 + 9, OO = (int) 2e9 + 1;
const long long MOD = 1e9 + 7, INF = 1e18 + 9;

typedef long long ll;

void OUTPUT() {
	cout << fixed << setprecision(0);
	ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
}

void INPUT() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
#endif
}

int n, arr[N];
ll ans = 0;
string str;
int counter(string s) {
	int x = 0;
	for (int i = 0; i < sz(s) - 1; i++) {
		if (s[i] == 'A' && s[i + 1] == 'B') {
			x++;
		}
	}
	return x;
}

map<int, int> cnt;
vector<int> a, b;

int ttt, oooA, oooB;

int main() {
//	INPUT();
	OUTPUT();
	cin >> n;
	for (int i = 1; i <= n; ++i) {
		cin >> str;
		ans += counter(str);
		if (str[0] == 'B') {
			b.push_back(i);
			oooB++;
			cnt[i]++;
		}
		if (str[sz(str) - 1] == 'A') {
			a.push_back(i);
			cnt[i]++;
			oooA++;
		}
		if (cnt[i] == 2) {
			ttt++;
			oooA--;
			oooB--;
		}
	}
	ans += max(0, (ttt - 1));
	if (ttt) {
		if (oooA)
			oooB++;
		if (oooB)
			oooA++;
	}
//	oooA++, oooB++;
	ans += min(oooA, oooB);
	cout << ans << el;

	return 0;

}


Measured memory_bytes: 768
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s;
	cin>>s;
	for(int i=0;i<(int)s.length()-1;i++) if(s[i]=='A'&&s[i+1]=='C') return puts("Yes"),0;
	return puts("No"),0;
}

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

#define fastio {\
    ios::sync_with_stdio(0);\
    cin.tie(0);\
}

#define file {\
    freopen("io\\in.txt", "r", stdin);\
    freopen("io\\out.txt", "w", stdout);\
    freopen("io\\err.txt", "w", stderr);\
}

#ifdef LOCAL
#define debug(args...) {\
    string _s(#args);\
    replace(_s.begin(), _s.end(), ',', ' ');\
    stringstream _ss(_s);\
    istream_iterator<string> _it(_ss);\
    debug1(_it, args);\
}

#pragma GCC diagnostic ignored "-Wunused-parameter"
void debug1(istream_iterator<string> it) {
    cerr << endl;
}
#pragma GCC diagnostic pop

template<class T, class... Args>
void debug1(istream_iterator<string> it, T a, Args... args) {
    cerr << '>' << *it << " = " << a << "; ";
    debug1(++it, args...);
}
#else
#define debug(args...)
#define cerr if (false) cerr
#endif

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using si = set<int>;
using ii = pair<int, int>;
using vii = vector<ii>;

#define rep(i, n)   for (int i = 0; i < n; i++)
#define dotc()      int tcs; if (cin >> tcs) rep(tc, tcs)
#define sz(x)       (int)x.size()
#define eb          emplace_back
#define pb          push_back
#define mp          make_pair
#define mt          make_tuple
#define all(x)      x.begin(), x.end()
#define rall(x)     x.rbegin(), x.rend()
#define fi          first
#define se          second

const int inf(0x3fffffff);
const int mod(1000000007);
const double pi(acos(-1.0));

signed main() {
    fastio;
#ifdef LOCAL
    file;
#endif

    ll n;
    cin >> n;

    if (n & 1) cout << 0;
    else {
        n /= 2;
        ll cnt = 0;
        for (ll i = 5; i <= n; i *= 5) {
            cnt += n / i;
        }
        cout << cnt;
    }

    return 0;
}


Measured memory_bytes: 3588
mod prime_number {

use std::iter::Iterator;

type ValueType = usize;

pub struct PrimeFactorization {
    n: ValueType,
    cur: ValueType,
    limit: ValueType,
}

///素因数分解
impl PrimeFactorization {
    ///素因数を計算するイテレータを返す。
    pub fn calc(n: ValueType) -> PrimeFactorization {
        PrimeFactorization {
            n: n,
            cur: 1,
            limit: n,
        }
    }
}

impl Iterator for PrimeFactorization {
    type Item = ValueType;
    fn next(&mut self) -> Option<Self::Item> {
        loop {
            if self.cur == 0 || self.cur > self.n {
                return None;
            }

            self.cur += 1;

            if self.cur * self.cur > self.n {
                if self.n != 1 {
                    self.cur = 0;
                    return Some(self.n);
                }
                return None;
            }
            if self.n % self.cur == 0 {
                while self.n % self.cur == 0 {
                    self.n /= self.cur;
                }
                self.cur -= 1;
                return Some(self.cur + 1);
            }
        }
    }
}

}

#[allow(unused_imports)]
use proconio::{
    fastout, input,
    marker::{Bytes, Chars, Isize1, Usize1},
};

use prime_number::*;

use num::integer::gcd;
const INF: usize = 999999999999;
fn main() {
    input! {
        n:usize,
        a:[usize;n]
    }

    let mut sc = a[0];
    for i in 1..a.len() {
        sc = gcd(sc, a[i]);
    }
    let mut is_sc = sc == 1;
    let mut is_pc = true;
    let mut arr = vec![INF; 1000001];
    let mut idx = 0;
    for &i in &a {
        for q in PrimeFactorization::calc(i) {
            if arr[q] != idx && arr[q] != INF {
                is_pc = false;
            }
            arr[q] = idx;
        }
        idx += 1;
    }
    if is_pc {
        println!("pairwise coprime");
    } else if is_sc {
        println!("setwise coprime");
    } else {
        println!("not coprime");
    }
}



Measured memory_bytes: 25492
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>


using namespace std;

#ifdef _MSC_VER
#define __typeof__ decltype
template <class T> int __builtin_popcount(T n) { return n ? 1 + __builtin_popcount(n & (n - 1)) : 0; }
#endif

#define foreach(it, c) for (__typeof__((c).begin()) it=(c).begin(); it != (c).end(); ++it)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define clear(arr, val) memset(arr, val, sizeof(arr))

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

template <class T> void max_swap(T& a, const T& b) { a = max(a, b); }
template <class T> void min_swap(T& a, const T& b) { a = min(a, b); }

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

const double EPS = 1e-8;
const double PI = acos(-1.0);
const int dx[] = { 0, 1, 0, -1 };
const int dy[] = { 1, 0, -1, 0 };

struct P
{
	int x, y;
	P(int x, int y)
		: x(x), y(y) { }
	P operator-(const P& a) const { return P(x - a.x, y - a.y); }
	bool operator==(const P& a) const { return x == a.x && y == a.y; }
};
vector<P> tyokusen(const vector<P>& v)
{
	vector<P> res;
	res.push_back(v[0]);
	for (int i = 1; i < v.size() - 1; ++i)
		if ((v[i - 1].x != v[i].x || v[i].x != v[i + 1].x)
			&& (v[i - 1].y != v[i].y || v[i].y != v[i + 1].y))
			res.push_back(v[i]);
	res.push_back(v.back());
	return res;
}
vector<P> ori(const vector<P>& v)
{
	vector<P> res;
	P rela = v[0];
	for (int i = 0; i < v.size(); ++i)
		res.push_back(v[i] - rela);
	return res;
}
vector<P> rotate(const vector<P>& v)
{
	vector<P> res;
	for (int i = 0; i < v.size(); ++i)
		res.push_back(P(-v[i].y, v[i].x));
	return res;
}
vector<P> mirror(const vector<P>& v)
{
	vector<P> res;
	for (int i = 0; i < v.size(); ++i)
		res.push_back(P(-v[i].x, v[i].y));
	return res;
}
vector<P> input()
{
	int m;
	cin >> m;
	vector<P> res;
	while (m--)
	{
		int x, y;
		cin >> x >> y;
		res.push_back(P(x, y));
	}
	return res;
}
template <class T>
bool same(const vector<T>& a, const vector<T>& b)
{
	if (a.size() != b.size())
		return false;
	for (int i = 0; i < a.size(); ++i)
		if (!(a[i] == b[i]))
			return false;
	return true;
}
int main()
{
	int n;
	while (cin >> n, n)
	{
		vector<vector<P> > ok;
		ok.push_back(ori(input()));
		for (int i = 0; i < 3; ++i)
			ok.push_back(rotate(ok.back()));
		//for (int i = 0; i < 4; ++i)
		//	ok.push_back(mirror(ok[i]));
		for (int i = 0; i < 4; ++i)
		{
			vector<P> a = ok[i];
			reverse(all(a));
			ok.push_back(ori(a));
		}
		//ok.push_back(mirror(ok[0]));

		for (int T = 1; T <= n; ++T)
		{
			vector<P> t = ori(input());
			bool s = false;
			for (int i = 0; i < ok.size(); ++i)
				s |= same(t, ok[i]);
			if (s)
				cout << T << endl;
		}
		cout << "+++++" << endl;
	}
}

Measured memory_bytes: 0
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

// 一行読み出し
func nextLine() string {
	sc.Scan()
	return sc.Text()
}

// 文字列リバース関数
func strReverse(s string) string {
	rs := []rune(s)
	for i, j := 0, len(s)-1; i < j; i, j = i+1, j-1 {
		rs[i], rs[j] = rs[j], rs[i]
	}
	return string(rs)
}

// スペース区切りの文字列から int のスライスを得る
func intSlice(s string) []int {
	ss := strings.Split(s, " ")
	res := make([]int, len(ss))
	for i, v := range ss {
		iv, _ := strconv.Atoi(v)
		res[i] = iv
	}

	return res
}

func main() {
	s := nextLine()
	keiro := intSlice(s)
	ans := (1 << 30)
	for i := 0; i < len(keiro); i++ {
		for j := 0; j < len(keiro); j++ {
			if i != j {
				t := keiro[i] + keiro[j]
				if t < ans {
					ans = t
				}
			}
		}
	}

	fmt.Println(ans)
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-9;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

int n;
vi a;
vp b;

int main(){
	cin>>n;
	int S=0;
	a=vi(n);
	b=vp(n);
	for(int i=0;i<n;i++){
		cin>>a[i];
		S+=a[i];
	}
	for(int i=0;i<n;i++) b[i]={abs(n*a[i]-S),i};
	sort(b.begin(),b.end());
	cout<<b[0].second<<endl;
}

Measured memory_bytes: 256
#!/usr/bin/env python
from __future__ import division, print_function

import os
import sys
import itertools
import math
from io import BytesIO, IOBase

if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip


def main():
    n = int(input())
    cities = [[int(i) for i in input().split()] for _ in range(n)]

    dist = lambda p1, p2: ((p1[0] - p2[0]) ** 2 + (p1[1] - p2[1]) ** 2) ** 0.5

    t = 0
    for permutation in itertools.permutations(cities, n):
        prev = permutation[0]
        for city in permutation:
            t += dist(prev, city)

    print(t / math.factorial(n))


# region fastio

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()


if sys.version_info[0] < 3:
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)

input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    main()


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

// Abstract Lazy Segment Tree (????±?????±?????????¶?????°???????????¨)
const int SIZE = 1 << 17; // 2^17 = 131072
template<typename T>
struct lazysegtree {
    // ?????????????????????
    T node[2*SIZE], lazy[2*SIZE], I;
    bool need_upd[2*SIZE];

    // ????????¬????????§??? (update, query ??? 2 ???????????????)
    // update function ??????????????????????????¢????????????
    // upd_f(X, Y, l, r) -> ????????? [l, r) ??§???????????????????????? X ??? Y ????????????
    // lazy ???????????? update ??¨??????????????? 1 ??????????????¨?????°?????????
    T (*upd_f)(T, T, int, int), (*qry_f)(T, T);

    // ???????????¨?????????????????????????????¨?????? node ??¨ lazy ??????????????§?????????
    lazysegtree(T (*op1)(T, T, int, int), T (*op2)(T, T), T X) {
        upd_f = op1;
        qry_f = op2;
        I = X;
        fill(lazy, lazy+2*SIZE, I);
        fill(node, node+2*SIZE, I);
        fill(need_upd, need_upd+2*SIZE, false);
    }

    void lazy_eval(int k, int l, int r) {
        if(!need_upd[k]) return;
        node[k] = upd_f(node[k], lazy[k], l, r);
        if(r - l > 1) {
            lazy[2*k+1] = upd_f(lazy[2*k+1], lazy[k], 0, 1);
            lazy[2*k+2] = upd_f(lazy[2*k+2], lazy[k], 0, 1);
            need_upd[2*k+1] = need_upd[2*k+2] = true;
        }
        lazy[k] = I;
        need_upd[k] = false;
    }

    // ???????????? [a, b) ??????????????? val ??????????????????
    // (upd_f ?????¨????????????)
    void update(int a, int b, T val, int l=0, int r=SIZE, int k=0) {
        lazy_eval(k, l, r);
        if(b <= l || r <= a) return;
        if(a <= l && r <= b) {
            lazy[k] = upd_f(lazy[k], val, 0, 1);
            need_upd[k] = true;
            lazy_eval(k, l, r);
        }
        else {
            int mid = (l + r) / 2;
            update(a, b, val, l, mid, 2*k+1);
            update(a, b, val, mid, r, 2*k+2);
            node[k] = qry_f(node[2*k+1], node[2*k+2]);
        }
    }

    // ???????????? [a, b) ?????????????????¨???????????????
    // (qry_f ?????¨????????????)
    T query(int a, int b, int l=0, int r=SIZE, int k=0) {
        lazy_eval(k, l, r);
        if(b <= l || r <= a) return I;
        if(a <= l && r <= b) return node[k];
        int mid = (l + r) / 2;
        T vl = query(a, b, l, mid, 2*k+1);
        T vr = query(a, b, mid, r, 2*k+2);
        return qry_f(vl, vr);
    }
};

// [[???????????????]]
// update ??¨??¨ query ??¨?????¢??°??¨????????? (??¢??°????????????????????????????????????????????????) ?????¨???????????£?¨???????
// ??????????????¨???update ??¨?????¢??°??? upd ??§???query ??¨?????¢??°??? fnd ??§??????????????? INT_MAX

typedef long long int ll;
ll upd(ll a, ll b, int l, int r) {return b;}
ll fnd(ll a, ll b) {return min(a, b);}
lazysegtree<ll> seg(upd, fnd, INT_MAX);

int main() {
    int N, Q; scanf("%d%d", &N, &Q);
    while(Q--) {
        int c, x, y; scanf("%d%d%d", &c, &x, &y);
        if(c == 0) {
            seg.update(x, x+1, y);
        }
        else {
            printf("%lld\n", seg.query(x, y+1));
        }
    }
    return 0;
}

Measured memory_bytes: 7076
/*
ЗАПУСКАЕМ 
░ГУСЯ░▄▀▀▀▄░РАБОТЯГУ░░
▄███▀░◐░░░▌░░░░░░░
░░░░▌░░░░░▐░░░░░░░
░░░░▐░░░░░▐░░░░░░░
░░░░▐░░░░░▐░░░░░░░
░░░░▐░░░░░▐░░░░░░░
░░░░▐░░░░░▐░░░░░░░
░░░░▐░░░░░▐░░░░░░░
░░░░▐░░░░░▐░░░░░░░
░░░░▐░░░░░▐░░░░░░░
░░░░▐░░░░░▐░░░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░▄▀▒▒▀▀▀▀▄
░░░▐░░░░▐▒▒▒▒▒▒▒▒▀▀▄
░░░▐░░░░▐▄▒▒▒▒▒▒▒▒▒▒▀▄
░░░░▀▄░░░░▀▄▒▒▒▒▒▒▒▒▒▒▀▄
░░░░░░▀▄▄▄▄▄█▄▄▄▄▄▄▄▄▄▄▄▀▄
░░░░░░░░░░░▌▌░▌▌░░░░░
░░░░░░░░░░░▌▌░▌▌░░░░░
░░░░░░░░░▄▄▌▌▄▌▌░░░░░ 
 */
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>
 
using namespace std;

template<class T1, class T2> inline int chkmin(T1 &x, const T2 &y) {
    if (x > y) {
        x = y;
        return 1;
    }
    else {
        return 0;
    }
}

template<class T1, class T2> inline int chkmax(T1 &x, const T2 &y) {
    if (x < y) {
        x = y;
        return 1;
    }
    else {
        return 0;
    }
}

#define all(c) (c).begin(), (c).end()
#define sz(c) (int)(c).size()
#define mp make_pair
#define pb push_back
#define read(FILENAME) freopen((string(FILENAME) + ".in").c_str(), "r", stdin)
#define write(FILENAME) freopen((string(FILENAME) + ".out").c_str(), "w", stdout);

template<class iterator> void output(iterator begin, iterator end, ostream &out = cerr) {
    while (begin != end) {
        out << (*begin) << " ";
        begin++;
    }
    out << endl;
}

template<class T> void output(const T &x, ostream &out = cerr) {
    output(x.begin(), x.end(), out);
}

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


int main() {
    fast_io();
    //read("input");
    int n;
    cin >> n;
    int st = 1;
    while (st < n) {
        st *= 2;
    }
    if (n == st || n <= 2) {
        cout << "No\n";
        exit(0);
    }
    cout << "Yes\n";
    cout << 1 << ' ' << 3 << '\n';
    cout << 3 << ' ' << 2 << '\n';
    cout << 2 << ' ' << n + 1 << '\n';
    cout << n + 1 << ' ' << n + 3 << '\n';
    cout << n + 3 << ' ' << n + 2 << '\n';
    for (int i = 4; i < n; i+= 2) {
        cout << i + 1 << ' ' << i << '\n';
        cout << i << ' ' << 1 << '\n';
        cout << 1 << ' ' << n + i + 1 << '\n';
        cout << n + i + 1 << ' ' << n + i << '\n'; 
    }
    if (n % 2 == 0) {
        cout << n << ' ' << n - 2 << '\n';
        int x = n ^ (n - 2) ^ 1;
        if (x == 3) {
            cout << 3 << ' ' << 2 * n << '\n';
        } else {
            cout << x + n << ' ' << 2 * n << '\n';  
        }
    }
    return 0;
}   
    

Measured memory_bytes: 2304
#include <iostream>
#include <fstream>
#include <unistd.h>
#include <sys/stat.h>
#include <stdio.h>
#include <vector>
#include <cmath>
#include <random>
#include <string.h>      //文字列の代入に使う
#include <bits/stdc++.h> //piの利用で必要(M_PI)
#include <algorithm>
#include <climits>
#define rep(i, c) for (int i = 0; i < (int)c; i++) //atcoderの解説コードに利用されていたので，ある程度一般生があるかと思われる．
#define ll long long

int main()
{
    ll int N, M;
    std::cin >> N >> M;
    ll int p;
    std::string S;
    int A[N + 1];
    ll int W[N + 1];
    for (int i = 1; i <= N; i++)
    {
        A[i] = 0;
        W[i] = 0;
    }
    ll int counterA, counterW;
    counterA = 0;
    counterW = 0;

    for (int i = 1; i <= M; i++)
    {
        std::cin >> p >> S;
        if (S[0] == 'A')
        {
            if (A[p] == 0)
            {
                counterA += 1;
                counterW = counterW + W[p];
                A[p] = 1;
            }
           
        }
        else
        {
            if (A[p] == 0)
            {
                W[p] += 1;
            }
           
        }
    }

    std::cout << counterA << " " << counterW << std::endl;

    return 0;
}

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

#define rep(i,n) for(int i = 0;i<n;i++)
#define cint(a) int a; cin >> a;
#define cstr(str) string str; cin >> str;


using namespace std;
using ll = long long;

const ll mod = 1e9 + 7;

int main(void) {

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

	int n;	cin >> n;
	int m; cin >> m;
	vector<int> mem(n, -1);
	
	vector<pair<int, int>> sc(m);
	rep(i, m) cin >> sc[i].first >> sc[i].second;



	rep(i, 1000) {
		string str = to_string(i);
		if (str.size() != n) continue;
		bool flag = true;
		rep(j, m) {
			if (str[sc[j].first - 1] != sc[j].second + '0') {
				flag = false;
				break;
			}
		}
		if (flag) {
			cout << str << endl;
			return 0;
		}
	}
	
	cout << -1 << endl;


	return 0;
}


Measured memory_bytes: 3664
fun main(args: Array<String>) {
    val s = readLine()!!
    val s1 = s.substring(0, 2).toInt()
    val s2 = s.substring(2).toInt()
    val t1 = 1 <= s1 && s1 <= 12
    val t2 = 1 <= s2 && s2 <= 12
    val ans = if (t1 && t2) {
        "AMBIGUOUS"
    } else if (t1) {
        "MMYY"
    } else if (t2) {
        "YYMM"
    } else {
        "NA"
    }
    println(ans)
}


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

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(), (x).end()

typedef int64_t ll;
typedef long double ld;

const int INF = 1e9;
const ld EPS = 1e-8;

// MOD
const int64_t MOD = 1e9 + 7;
struct Fp {
  int64_t x;
  Fp() : x(0) {}
  Fp(int y) : x(y >= 0 ? y % MOD : (MOD - (-y) % MOD) % MOD) {}

  Fp &operator+=(const Fp &p) {
    x = (x + p.x) % MOD;
    return *this;
  }
  Fp &operator-=(const Fp &p) {
    x = (x + MOD - p.x) % MOD;
    return *this;
  }
  Fp &operator*=(const Fp &p) {
    x = x * p.x % MOD;
    return *this;
  }
  bool operator==(const Fp &rhs) const { return this->x == rhs.x; }
  Fp operator-() const { return Fp(-x); }
  Fp operator+(const Fp &rhs) const { return Fp(*this) += rhs; }
  Fp operator-(const Fp &rhs) const { return Fp(*this) -= rhs; }
  Fp operator*(const Fp &rhs) const { return Fp(*this) *= rhs; }
  Fp operator+(const int y) const { return Fp(*this) += Fp(y); }
  Fp operator-(const int y) const { return Fp(*this) -= Fp(y); }
  Fp operator*(const int y) const { return Fp(*this) *= Fp(y); }
};

Fp operator+(const int x, const Fp &rhs) { return Fp(x) += rhs; }
Fp operator-(const int x, const Fp &rhs) { return Fp(x) -= rhs; }
Fp operator*(const int x, const Fp &rhs) { return Fp(x) *= rhs; }

ostream &operator<<(ostream &out, const Fp &p) {
  out << p.x;
  return out;
}

int64_t inv(int64_t a, int64_t p) {
  // return x s.t. ax = 1 (mod p)
  if (a == 1) return 1;
  return ((1 - p * inv(p % a, a)) / a + p);
}

Fp operator/(const Fp &lhs, const Fp &rhs) {
  return lhs * Fp(inv(rhs.x, MOD));
}
Fp operator/(const Fp &lhs, const int x) { return (lhs / Fp(x)); }

#define MAX_FACT_N 10000

Fp fact[MAX_FACT_N], invfact[MAX_FACT_N];
void init_fact() {
  fact[0] = Fp(1);
  invfact[0] = Fp(1);
  for (int i = 1; i < MAX_FACT_N; i++) {
    fact[i] = fact[i - 1] * i;
    invfact[i] = invfact[i - 1] / i;
  }
}

Fp comb(int n, int k) {
  return fact[n] * invfact[k] * invfact[n - k];
}

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

  for(int i = 1; i <= K; i++) {
    if (N - K + 1 - i < 0) {
      cout << 0 << endl;
    } else {
      Fp ret = comb(K - 1, i - 1) * comb(N - K + 1, i);
      cout << ret << endl;
    }
  }
  return 0;
}



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

vector<long> ans;

void dfs(long n, int d) {
  if (d == 10) {
    ans.push_back(n);
    return;
  }
  ans.push_back(n);
  int end = n % 10;
  int mi = max(0, end - 1);
  int mx = min(9, end + 1);
  for (int i = mi; i <= mx; i++) dfs(n * 10 + i, d + 1);
}

int main() {
  int K;
  cin >> K;
  for (int i = 1; i <= 9; i++) dfs(i, 1);
  sort(ans.begin(), ans.end());
  cout << ans.at(K - 1) << "\n";
}

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

int main(int argc, const char * argv[]) {
    int a, b;
    cin >> a >> b;
    if (a + b > 16 || a > 8 || b > 8) {
        cout << ":(" << endl;
    }else{
        cout << "Yay!" << endl;
    }
    
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <vector>
#define int long long
typedef long long ll;
using namespace std;

ll N, count=0;

void check(ll num){
    map<ll, ll> M;
    if(num <= N){
        while(num>=1){
            M[num%10]++;
            num = num/10;
        }
        if(M[3]>0&&M[5]>0&&M[7]>0) count++;
    }
}

void dfs(ll num){
    if(num>10000000000) return;
    check(num);
    dfs(10*num+3);
    dfs(10*num+5);
    dfs(10*num+7);
}

signed main(){
    cin >> N;
    dfs(0);
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 256