akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<vector>
#define LE(x) ((x)*2)
#define RI(x) ((x)*2+1)
#define PA(x) ((x)/2)
using namespace std;
vector<int> L;

/*void test(){
    printf("\n---------NOW TEST--------\n");
    for(int i=1;i<L.size();i++){
        printf("%d ", L[i]);
    }
    printf("\n----------------------%d\n", L.size());
}*/

void insert(int key){
    int flag = L.size();
    L.push_back(key);
    while(PA(flag) >= 1 && L[flag] > L[PA(flag)]) {
        int tempFlag = flag;
        flag = PA(flag);
        L[flag] ^= L[tempFlag];
        L[tempFlag] ^= L[flag];
        L[flag] ^= L[tempFlag];
    }
    //test();
}

void maxHeapify(int flag){
    int maxFlag = flag;
    int right = RI(flag);
    int left = LE(flag);
    if(left<L.size()&&L[left]>L[maxFlag]){
        maxFlag = left;
    }
    if(right<L.size()&&L[right]>L[maxFlag]){
        maxFlag = right;
    }
    if(maxFlag==flag){
        return;
    }else{
        L[flag] ^= L[maxFlag];
        L[maxFlag] ^= L[flag];
        L[flag] ^= L[maxFlag];
        maxHeapify(maxFlag);
    }
}

int extract(){
    L[0]=L[1];
    L[1]=L[L.size()-1];
    maxHeapify(1);
    L.pop_back();
    //test();
    return L[0];
}

int main(){
    char ope[10];
    L.push_back(999);//首尾占位
    scanf("%s", ope);
    while(ope[2]!='d'){
        if(ope[0]=='i'){
            int key;
            scanf("%d", &key);
            insert(key);
        }else{
            printf("%d\n", extract());
        }
        scanf("%s", ope);
    }

    return 0;
}



Measured memory_bytes: 6516
<>;$l=<>;chomp$l;@a=split/ /,$l;
while($#a>0){
  @a=sort{$a<=>$b}@a;
  $x=shift@a;
  $y=shift@a;
  $z=($x+$y)/2;
  unshift@a,$z;
}
print $a[0];

Measured memory_bytes: 512
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define repr(i,n) for(ll i=(n-1);i>=0;i--)
#define all(x) x.begin(),x.end()
#define br cout << "\n";
using namespace std;
const int INF = 1e9;
const int MOD = 1e9+7;
using Graph = vector<vector<ll>>;
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;}

// 0 false, 1 true 
// string to int : -48
// a to A : -32
// ceil(a)  1.2->2.0
// c++17	g++ -std=c++17 a.cpp

int main() {
    std::cout << std::fixed << std::setprecision(15);
    ll a, b;
    cin >> a >> b;
    cout << a * b << endl;

}

Measured memory_bytes: 3636
import math
import queue
import bisect
import heapq
import time
import itertools

mod = int(1e9+7)

def swap(a,b):
    return (b,a)

def my_round(a,dig=0):
    p = 10 ** dig
    return (a * p * 2 + 1) // 2 / p

def gcd(a,b): #最大公約数
    if (a<b):
        a,b = swap(a,b)
    if (b==0):
        return a
    else:
        return gcd(b,a%b)

def lcm(a,b): #最小公倍数
    return a/gcd(a,b)*b

def divisors(a): # 約数列挙
    divisors = []
    for i in range(1,int(a**0.5)+1):
        if a%i==0:
            divisors.append(i)
            if i!=a//i:
                divisors.append(a//i)
    return divisors

def is_prime(a): #素数判定
    if a<2:
        return False
    elif a==2:
        return True
    elif a%2==0:
        return False
    sqrt_num = int(a**0.5)
    for i in range(3,sqrt_num+1,2):
        if a%i==0:
            return False
    return True

def prime_num(a): #素数列挙
    pn = [2]
    for i in range(3,int(a**0.5),2):
        prime = True
        for j in pn:
            if i%j==0:
                prime = False
                break
        if prime:
            pn.append(i)
    return pn

def prime_fact(a): #素因数分解
    sqrt = math.sqrt(a)
    res = []
    i = 2
    if is_prime(a):
        res.append(a)
    else:
        while a!=1:
            while a%i==0:
                res.append(i)
                a //= i
            i += 1
    return res

def main():
    a,b = map(int,input().split())
    ans = max(a+b,a-b)
    ans = max(ans,a*b)
    print(ans)
    return

if __name__=='__main__':
    main()


Measured memory_bytes: 38508
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define SIZE 105
#define INF 1000000005LL
#define MOD 1000000007

using namespace std;
typedef long long int ll;
typedef pair <int,int> P;

int N;
ll W;
ll w[SIZE],v[SIZE];
ll dp[SIZE][SIZE*4][SIZE];

int main()
{
	cin >> N >> W;
	rep(i,1,N+1)cin >> w[i] >> v[i];
	ll w1 = w[1];
	rep(i,1,N+1)w[i] -= w1;
	rep(i,0,N+1) rep(j,0,4*N+1) rep(k,0,N+1) dp[i][j][k] = -1;
	dp[0][0][0] = 0;
	rep(i,1,N+1){
		rep(j,0,4*N+1) rep(k,0,N+1) dp[i][j][k] = dp[i-1][j][k];
		rep(j,0,4*N+1) rep(k,0,N+1) if(j-w[i]>=0) {
			if(dp[i-1][j-w[i]][k] == -1)continue;
			if(dp[i][j][k+1] < dp[i-1][j-w[i]][k]+v[i]){
				dp[i][j][k+1] = dp[i-1][j-w[i]][k]+v[i];
			}
		}
	}
	ll ans = 0;
	rep(j,0,4*N+1) rep(k,0,N+1){
		/*
		if(dp[N][j][k] != -1){
			cout << j << " " << k << " " << dp[N][j][k] << endl;
		}
		*/
		if(j <= W-(ll)k*w1) ans = max(ans,dp[N][j][k]);
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 34944
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <string.h>
#include <math.h>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#define mem(a,b) memset(a,b,sizeof(a))
#define ll long long
#define ull unsigned long long
#define EPS 1e-8
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
using namespace std;
typedef pair<int,int> pii;
typedef pair<long,long> pll;
const double pi = acos(-1.0);
inline ll read()
{
	ll x=0,f=1;char ch=getchar();
	while (ch<'0'||ch>'9'){if (ch=='-')f=-1;ch=getchar();}
	while (ch>='0'&&ch<='9'){x=(x<<1)+(x<<3)+ch-'0';ch=getchar();}
	return f*x;
}
inline void write(ll a){
    if (a<0) putchar('-'),a=-a;
    if (a>=10) write(a/10); putchar(a%10+'0');
}
const int MAX_N=1e5+10;
int a[MAX_N];
int n,ans1,ans2,tt;
int main()
{
 	#ifdef TEST
	 	freopen("input.txt","r",stdin);
	#endif
	scanf("%d",&n);
	for(int i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
		ans1=max(ans1,a[i]);
	}
	ans2=0;
	for(int i=0;i<n;i++)
	{
		int t=a[i];
		if(2*a[i]>ans1)
		{
			t=ans1-a[i];
		}
		if(t>tt)
		{
			tt=t;
			ans2=a[i];
		}
	}
	printf("%d %d",ans1,ans2);
	return 0;
}



Measured memory_bytes: 640
#include "algorithm"
#include "iostream"
#include "cmath"
#include "string"
#include "map"
using namespace std;


int main(){
  while(true){
  int n,min=1001,max=-1,sum=0,ten;
  cin >> n;
  if(!n)break;
  for(int i =0;i<n;i++){
    cin >> ten;
    sum+=ten;
    if(min>ten)min=ten;
    if(max<ten)max=ten;
  }
  cout << (sum-min-max)/(n-2) <<endl;
}
  return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rep(i,n) for(int (i)=1;(i)<=(int)(n);(i)++)
#define forn(i,n,m) for(int (i)=(n);i<=(int)(m);(i)++)
#define pb push_back
#define mp make_pair
#define re return
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()
using namespace std;
const int INF=1e9;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef queue <int> qi;
float n,m; 
int main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin>>n>>m;
	cout<<int(ceil(n/m));
	return 0;
}

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


int main() {

    vector<int> n(3);
    cin>>n.at(0)>>n.at(1)>>n.at(2);

    sort(n.begin(),n.end());

    cout<<n.at(2)*10+n.at(1)+n.at(0)<<endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double lf;
typedef pair<int,int> ii;
typedef pair<ii,int> iii;
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define RREP(i,n) for (int i=n-1;i>=0;i--)
#define RST(i,n) memset(i,n,sizeof i)
#define SZ(a) (ll)a.size()
#define ALL(a) a.begin(),a.end()
#define X first
#define Y second
#define mkp make_pair
#define pb push_back
#define eb emplace_back
#define pob pop_back
#ifdef cold66
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<", ";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#endif // cold66
//}
template<class T> inline bool chkmax(T &a, const T &b) { return b > a ? a = b, true : false; }
template<class T> inline bool chkmin(T &a, const T &b) { return b < a ? a = b, true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;

const ll MAXn=1e5+5,MAXlg=__lg(MAXn)+2;
const ll MOD=1000000007;
const ll INF=0x3f3f3f3f;

int main(){
    IOS();
    int n;
    cin >> n;
    set<int> st;
    REP (i,n) {
        int x;
        cin >> x;
        st.insert(x);
    }
    if (SZ(st) == n) cout << "YES" << endl;
    else cout << "NO" << endl;
}


Measured memory_bytes: 9600
// include all standard library.
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

int main(int argc, char const *argv[]) {
  int in;
  cin >> in;

  int amari = in % 10;

  switch (amari) {
  case 3:
    cout << "bon" << endl;
    break;
  case 2:
  case 4:
  case 5:
  case 7:
  case 9:
    cout << "hon" << endl;
    break;
  default:
    cout << "pon" << endl;
  }

  return 0;
}


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

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

    vector<int> b(n-1);
    for (int i = 0; i < n-1; i++) cin >> b.at(i);

    int sum = b.at(0);
    for (int i = 1; i < n-1; i++) {
        sum += min(b.at(i-1), b.at(i));
    }
    sum += b.at(n-2);

    cout << sum << endl;

    return 0;
}


Measured memory_bytes: 3628
n=int(input())
s=input()

r=0
g=0
b=0


for ss in s:
    if ss == "R":
        r+=1
    elif ss == "G":
        g+=1
    elif ss == "B":
        b+=1
ng=0
i=0    
while i<n:
    j=1
    while i+2*j<n:
        if s[i]!=s[i+j] and s[i+j] != s[i+2*j] and s[i]!= s[i+2*j] :
            ng+=1
        j+=1
    i+=1
print(r*g*b-ng)

Measured memory_bytes: 67744
let split_string ?(pattern="") = Str.split @@ Str.regexp pattern
let n = Scanf.sscanf (read_line ()) "%d" @@ fun n -> n
let s = read_line () |> split_string |> Array.of_list

let () =
  let black = Array.init n (fun i -> if s.(i) = "#" then 1 else 0) in
  let white = Array.init n (fun i -> if s.(i) = "." then 1 else 0) in
  for i = 1 to n - 1 do black.(i) <- black.(i) + black.(i - 1) done;
  for i = n - 2 downto 0 do white.(i) <- white.(i) + white.(i + 1) done;
  List.map2 (+) (Array.to_list black) (Array.to_list white)
    |> List.fold_left min max_int
    |> (fun i -> Printf.printf "%d\n" @@ i - 1)

Measured memory_bytes: 32796
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

using namespace std;
#define ll long long
#define rep(i,n) for (int i = 0; i < n; i++)
#define rrep(i,n) for (int i = n-1; i >= 0; i--)
#define MOD (1000000007)
#define vi vector<int>
#define vl vector<ll>
#define vb vector<bool>
#define vvi vector<vi>
#define vvl vector<vl>
#define pii pair<int, int>
#define pli pair<ll, int>a
#define pb push_back

#define mp make_pair
#define all(a) (a).begin(),(a).end()

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; }

ll gcd(ll a, ll b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}

ll keta(ll n){
  string s = to_string(n);
  ll num = s.size();
  return num;
}

const ll INF = 1LL << 60;

const int dh[4] = {1,0,-1,0};
const int dw[4] = {0,1,0,-1};

struct Edge{
  int to;
  int weight;
  Edge(int t, int w) : to(t), weight(w){}
};
using Graph = vector<vector<Edge>>;
using P = pair<ll, int>;

class UnionFind{
public:
  vi Parent;
  UnionFind(int n){
    Parent = vi(n,-1);
  }

  int root(int a){
    if(Parent[a] < 0) return a;
    return Parent[a] = root(Parent[a]);
  }

  int size(int a){
    a = root(a);
    return -Parent[a];
  }

  bool merge(int a, int b){
    a = root(a);
    b = root(b);
    if(a == b) return false;

    if(a < b) swap(a,b);
    Parent[a] += Parent[b];
    Parent[b] = a;

    return true;
  }

  bool issame(int a, int b){
    return root(a) == root(b);
  }
};

int main(){
  ll a,b; cin >> a >> b;
  if(a*b <= 0){
    cout << "Zero" << endl;
    return 0;
  }
  else if(a > 0){
    cout << "Positive" << endl;
    return 0;
  }
  else if(b < 0){
    ll sa = b - a;
    if(sa%2LL == 0) cout << "Negative" << endl;
    else cout << "Positive" << endl;
  }

  return 0;
}

Measured memory_bytes: 256
#define _USE_MA_DEFINES
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define inf (1ll<<60)
#define Yes(f) cout<<(f?"Yes":"No")<<endl
#define yes(f) cout<<(f?"yes":"no")<<endl
#define YES(f) cout<<(f?"YES":"NO")<<endl
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())

using namespace std;

const int mod=1e9+7;

void run();

void init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(12);
}

signed main(){
    init();
    run();
    return 0;
}

void run(){
    int n;
    cin>>n;
    vi v(n),c(n);
    rep(i,n)cin>>v[i];
    rep(i,n)cin>>c[i];
    int ans=0;
    rep(i,n)if(v[i]-c[i]>0)ans+=v[i]-c[i];
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<vector>
#include<map>
#include<stack>
#include<queue>
#include<string>
#include<utility>
#include<numeric>
#include<algorithm>
#include<cmath>
#include<climits>
using namespace std;

using ll = long long;

class Stream{
public:
    Stream(){

    }
    //配列以外の入力を受け取る
    void read(){

    }
    template<typename First, typename... Rest>
    void read(First& first, Rest&... rest){
        cin >> first;
        read(rest...);
    }
    //配列以外を出力する
    void write(){

    }
    template<typename First, typename... Rest>
    void write(First first, Rest... rest){
        cout << first << " ";
        write(rest...);
    }
    //配列を区切って出力する
    template<typename T>
    void write_vec(vector<T>& v, char divider){
        for(size_t i = 0; i < v.size(); i++){
            cout << v[i] << divider;
        }
    }
};

int main(){
    Stream io;

    int N, M;
    io.read(N, M);
    vector<int> A(N);
    vector<int> B(N);
    for(int i = 0; i < N; i++){
        io.read(A[i], B[i]);
    }
    priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> q; 
    for(int i = 0; i < N; i++){
        q.push(make_pair(A[i], B[i]));
    }
    ll ans = 0;
    while(M > 0){
        pair<int, int> p = q.top();
        q.pop();
        ll x = min(M, p.second);
        ans += p.first * x;
        M -= x;
    }
    io.write(ans);
    return 0;
}

Measured memory_bytes: 2168
#include<iostream>
#include<string>
#include<cstdlib>
using namespace std;
#define MAX_N 255

int ans = 0, n, tmpans = 0;
int map[MAX_N + 1][MAX_N + 1];

void makeMap();
void check();
void loop(int sum, int x, int y, int xm, int ym);
void disp();

int main(){
    while(cin >>n){
        if(n == 0) break;
        ans = 0;
        makeMap();
        check();
        cout <<ans <<endl;
    }
    return 0;
}

void makeMap(){
    for(int i = 0; i < n; i++){
        string tmp;
        cin >>tmp;
        for(int j = 0; j < n; j++){
            map[i][j] = tmp[j] - 48;
        }
    }
}

void check(){
    int xm[4][2] = {{0, 0}, {1, -1}, {1, -1}, {-1, 1}}, ym[4][2] = {{1, -1}, {0, 0}, {-1, 1}, {-1, 1}};
    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            if(map[i][j] == 1){
                for(int k = 0; k < 4; k++){
                    tmpans = 0;
                    for(int m = 0; m < 2; m++){
                        loop(0, j + xm[k][m], i + ym[k][m], xm[k][m], ym[k][m]);
                    }
                    tmpans++;
                    if(tmpans > ans){
                        ans = tmpans;
//                        disp();
//                        cout <<"(" <<i <<", " <<j <<") , " <<k <<" ans = " <<ans <<endl;
                    }
                }
            }
        }
    }
}

void loop(int sum, int x, int y, int xm, int ym){
    if(x >= n || y >= n || x < 0 || y < 0 || map[y][x] == 0){
//        cout <<"! (" <<y <<", " <<x <<") " <<sum <<endl;
        tmpans += sum;
    } else if(map[y][x] == 1){
//        map[y][x] = 0;
        loop(sum + 1, x + xm, y + ym, xm, ym);
//        map[y][x] = 1;
    }
}

void disp(){
    cout <<endl;
    for(int i = 0; i < n; i++){
        for(int j = 0; j < n ; j++){
            cout <<map[i][j] <<" ";
        }
        cout <<endl;
    }
}

Measured memory_bytes: 1184
#include <iostream>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <cstring>
#include <iomanip>
#include <cmath>
#include <tuple>
#include <map>
#include <unordered_map>
using namespace std;
typedef long long ll;

int main(int argc, char *argv[])
{
    int n, k, i, j, l;
	cin >> n >> k;
	vector<int> value(n);
	vector<int> invent;
	int mini = min(n, k);
	int answer = 0;
	int now = 0;
	for (i = 0; i < n; i++)
		cin >> value[i];

	for (i = 0; i <= mini; i++) {
		for (j = 0; j <= mini - i; j++) {
			now = 0;
			invent.erase(invent.begin(), invent.end());			
			for (l = 0; l < i; l++)
				invent.push_back(value[l]);
			for (l = 0; l < j; l++)
				invent.push_back(value[n - l - 1]);
			sort(invent.begin(), invent.end());
			for (l = 0; l < k - i - j && l < invent.size(); l++) {
				if (invent[l] <= 0) 
					invent[l] = 0;
				else
					break;
			}
			for (l = 0; l < invent.size(); l++)
				now += invent[l];
			if (now > answer)
				answer = now;
		}
	}
	cout << answer << endl;
						 
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main() {
  char char_arr[100];
  scanf("%s", char_arr);
  if(char_arr[2]==char_arr[3] && char_arr[4]==char_arr[5]){
     printf("Yes\n");
  }else{
      printf("No\n");
    }
  return 0;
}


Measured memory_bytes: 128
#    !/usr/bin/env python3
#    encoding: UTF-8
#    Modified: <20/Jul/2019 05:39:19 PM>


#    ✪ H4WK3yE乡
#    Mohd. Farhan Tahir
#    Indian Institute Of Information Technology (IIIT), Gwalior


import sys
import os
from io import IOBase, BytesIO


def main():
    n, d = get_ints()
    from math import ceil
    print(ceil(n / ((2 * d) + 1)))


BUFSIZE = 8192


class FastIO(BytesIO):
    newlines = 0

    def __init__(self, file):
        self._file = file
        self._fd = file.fileno()
        self.writable = "x" in file.mode or "w" in file.mode
        self.write = super(FastIO, self).write if self.writable else None

    def _fill(self):
        s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
        self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
        return s

    def read(self):
        while self._fill():
            pass
        return super(FastIO, self).read()

    def readline(self):
        while self.newlines == 0:
            s = self._fill()
            self.newlines = s.count(b"\n") + (not s)
        self.newlines -= 1
        return super(FastIO, self).readline()

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


class IOWrapper(IOBase):
    def __init__(self, file):
        py2 = round(0.5)
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        if py2 == 1:
            self.write = self.buffer.write
            self.read = self.buffer.read
            self.readline = self.buffer.readline
        else:
            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")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)


def get_array(): return list(map(int, sys.stdin.readline().split()))


def get_ints(): return map(int, sys.stdin.readline().split())


def input(): return sys.stdin.readline().strip()


if __name__ == "__main__":
    main()


Measured memory_bytes: 38384
S = list(map(int,input().split('/')))

if S[0] > 2019:
	print("TBD")
elif S[0] == 2019 and S[1] >= 5:
	print("TBD")
elif S[0] == 2019 and S[1] >= 4 and S[2] == 30:
	print("Heisei")
else:
	print("Heisei")


Measured memory_bytes: 2940
#include<iostream>
#include<stdio.h>
using namespace std;
int main() {


	int x, y;
	for (int i = 0; i < 3000; i++) 
	{
		cin >> x >> y;
		if (x == 0 && y == 0)
		{
			break;
		}
		if (x > y)
		{
			int a = x;
			x = y;
			y = a;
		}
		cout << x << " " <<  y << endl;
	}
	return 0;
}


Measured memory_bytes: 3112
#include <bits/stdc++.h>
using namespace std;
int main()
{
  string S;
  cin >> S;
  if(S == "Sunny"){
    cout << "Cloudy" << endl;
  }
  else if(S == "Cloudy"){
    cout << "Rainy" << endl;
  }
  else if(S == "Rainy"){
    cout << "Sunny" << endl;
  }
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
using System.Numerics;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            Solve();
            //Out.Flush();
            Read();
        }
        static void Solve()
        {
            (int N, int K) = Slice2<int>();
            var nums = new long[K + 1];
            var sum = 0L;
            for (var i = K; 0 < i; --i)
            {
                var mg = K / i;
                nums[i] = ModPow(mg, N, Mod);
                for (var j = 2; j <= mg; ++j)
                    nums[i] = (nums[i] - nums[j * i] + Mod) % Mod;
                sum = (sum + i * nums[i] % Mod) % Mod;
            }
            WriteLine(sum);
        }
        static long ModPow(long a, long n, long mod)
        {
            var res = 1L;
            while (0 < n)
            {
                if (n % 2 != 0) res = res * a % mod;
                a = a * a % mod;
                n >>= 1;
            }
            return res;
        }

        static long Mod = (long)1e9 + 7;
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static public (T1 a, T2 b) Slice<T1, T2>()
        {
            var t = ReadLine().Split();
            return (
            (T1)Convert.ChangeType(t[0], typeof(T1)),
            (T2)Convert.ChangeType(t[1], typeof(T2)));
        }
        static public (T a, T b) Slice2<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)));
        }
        static public (T a, T b, T c) Slice3<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)),
            (T)Convert.ChangeType(t[2], typeof(T)));
        }
    }
}

Measured memory_bytes: 28020
#include<bits/stdc++.h>
using namespace std;
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define rep(i,n) for(int i=0; i<(n); ++i)
#define per(i,n) for(int i=n-1;i>=0;++i)
#define rep1(i,n) for(int i=1; i<=n; ++i)
#define per1(i,n) for(int i=n; i>=1; ++i)
#define debug cout << "line : " << __LINE__ << " debug" << endl
#define Dcout(N) cout << setprecision(20) << N << endl
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() ) //被り削除
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define INF 1e8
#define MOD 1000000007
typedef long long ll;

ll gcd(ll a, ll b) {return b ? gcd(b,a%b) : a;}

ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

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


      ll ans = 0;
      int k; cin >> k;
      rep1(a,k){
            rep1(b,k){
                  ll tmp = gcd(a,b);
                  rep1(c,k){
                        ans += gcd(tmp,c);
                  }
            }
      }

      cout << ans << endl;



      return 0;
}


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

#ifdef _PRINTDEBUG
  #include "lib/printdebug.hpp"
#else
  #define printdebug(...) 1
#endif
#define MOD_1_000_000_007 (1000000007LL)
#define LINF (1LL<<60)
#define rep(i, n)   for (long long i = 0; i <  (long long)(n); i++)
#define rep1(i, n)  for (long long i = 1; i <  (long long)(n); i++)
#define rep2(i, n)  for (long long i = 2; i <  (long long)(n); i++)
#define rep0c(i, n) for (long long i = 0; i <= (long long)(n); i++)
#define rep1c(i, n) for (long long i = 1; i <= (long long)(n); i++)
#define rep2c(i, n) for (long long i = 2; i <= (long long)(n); i++)
#define repc0(n, i) for (long long i = (long long)(n); i >= 0; i--)
#define repc1(n, i) for (long long i = (long long)(n); i >= 1; i--)
#define repc2(n, i) for (long long i = (long long)(n); i >= 2; i--)
#define REP(i, n, m) for (long long i = (long long)(n); i < (long long)(m); i++)

namespace solver {
  using namespace std;
  typedef long long ll;

  ll A, B, K;

  void init() {
    scanf("%lld", &K);
    scanf("%lld %lld", &A, &B);
  }

  void yesno(bool cond) {
    if(cond) printf("OK\n");
    else printf("NG\n");
  }

  void solve() {
    ll n = A/K;
    if(A%K) n++;
    yesno(A <= K*n && K*n <= B);
  }
}

int main() {
  solver::init();
  solver::solve();
  return 0;
}

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

int main() {
    unsigned long long x, ans = 0;
    cin >> x;
    ans = x/11 * 2;
    if(x%11 == 0){}
    else if(x%11 <= 6) ans += 1;
    else if(x%11 > 6) ans += 2;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
  #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  #define int long long
  #define endl "\n"
  #define all(v) v.begin(),v.end()
  #define double long double
  #define trace1(x)                cerr<<#x<<": "<<x<<endl
  #define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
  #define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
  #define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
  #define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<< ": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
  #define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
  #define cases int testcases;cin>>testcases; while(testcases--)
  const int N = 200005;

  int ans;

    vector<int> adj[N];
    vector<int> vis(N,false);
    void dfs(int s)
    {
      if(!vis[s])
      {

        vis[s] = true;
  
        for(auto i : adj[s])
        {
          if(!vis[i])dfs(i);
        }
      }
    }


int32_t main()
{


    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    IOS


   	int n,m;
   	cin >> n >> m;


   	for(int i = 1; i <= m; i++)
   	{
   		int x,y;
   		cin >> x >> y;

   		adj[x].push_back(y);
   		adj[y].push_back(x);
   	}


   	for(int i = 1; i <= n; i++)
   	{
   		if(!vis[i])
   		{
   			dfs(i);
   			ans++;
   		}
   	}

   	cout << ans - 1;

   	
    return 0;
}


Measured memory_bytes: 13768
let () =
  let s = read_line () in
  print_endline @@
  if
    s.[0] = 'A' &&
    1 = List.length (List.filter (( = ) 'C') @@ Array.to_list @@ Array.init (String.length s - 3) @@ fun i -> s.[i + 2]) &&
    2 = List.length (List.filter (fun c -> Char.code 'A' <= Char.code c && Char.code c <= Char.code 'Z') @@ Array.to_list @@ Array.init (String.length s) @@ fun i -> s.[i])
  then "AC"
  else "WA"

Measured memory_bytes: 384
#include <string>
#include <vector>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <map>
#include <list>
#include <set>
#include <numeric>
#include <queue>
#include <stack>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <climits>
#include <cfloat>
#include <ctime>
#include <complex>
#include <cassert>
#include <array>
#include <bitset> 
#include <unordered_map>
#include <random>

using namespace std;
typedef long long LL;
typedef pair<int,int> P;

int main() {
	string s;
	int w;
	cin >> s >> w;
	for(int i=0;i<s.size();i+=w){
		cout << s[i];
	}
	cout << endl;

	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){return o<<"("<<p.fs<<","<<p.sc<<")";}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){o<<"sz = "<<vc.size()<<endl<<"[";for(const T& v:vc) o<<v<<",";o<<"]";return o;}
int main(){
	string s;
	int K;
	cin>>s>>K;
	int N=s.size();
	rep(i,N){
		int need=('z'-s[i]+1)%26;
		if(need<=K){
			s[i]='a';
			K-=need;
		}
	}
	s[N-1]='a'+(s[N-1]-'a'+K)%26;
	cout<<s<<endl;
}


Measured memory_bytes: 512
// 参考(AtCoder Beginner Contest 113 - 情報妖精の競プロ日記 https://31536000.hatenablog.com/entry/2018/11/04/233559)
#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <cstdlib>
#include <math.h>
#include <algorithm>
#include <numeric>
const int MAX = 100000;
using namespace std;

int main(){
  int N, M, P, Y;
  scanf("%d%d", &N, &M);
  static pair<pair<int, int>, int> city[MAX];
  static pair<int, int> num[MAX];
  for (int i = 0;i < M; i++) {
    scanf("%d%d", &P, &Y);
    city[i] = make_pair(make_pair(P, Y), i);
  }
  sort(city, city+M);
  for (int i = 0, c = 1;i < M; i++, c = i < M && city[i-1].first.first == city[i].first.first ? c + 1 : 1) {
    num[city[i].second] = make_pair(city[i].first.first, c);
  }
  for (int i = 0; i < M; i++) {
    printf("%06d%06d\n", num[i].first, num[i].second);
  }
  return 0;
}



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

int main(){
	int N;
	cin >> N;
	int p[N];
	for(int i = 0; i < N; i++) cin >> p[i];
	int argmax = 0;
	for(int i = 1; i < N; i++){
		if(p[argmax] < p[i]) argmax = i;
	}
	p[argmax] /= 2;
	int sum = 0;
	for(int i = 0; i < N; i++) sum += p[i];
	cout << sum << endl;
}


Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<cstring>
using namespace std;
typedef long long ll;
const int N=505;
ll a[N][N],b[N][N];
ll f[N][N],n;
ll sumA(int u,int v,int c,int d){
	u--,c--;
	return a[v][d]-a[u][d]-a[v][c]+a[u][c];
}
ll sumB(int u,int v,int c,int d){
	u--,c--;
	return b[v][d]-b[u][d]-b[v][c]+b[u][c];
}
ll move(ll &a,ll b){a=a>b?a:b;}
int main(){
	cin>>n;
	for (int i=1;i<=n;i++){
		for (int j=1;j<=n;j++){
			if (i>j)scanf("%lld",&b[i][j]);// 1
			if (i<j)scanf("%lld",&a[i][j]);// -1
		}
	}
	for (int i=1;i<=n;i++)
		for (int j=1;j<=n;j++)
			a[i][j]+=a[i-1][j]+a[i][j-1]-a[i-1][j-1],
			b[i][j]+=b[i-1][j]+b[i][j-1]-b[i-1][j-1];
	for (int i=1;i<n;i++){
		f[i][0]=sumB(1,i,1,i);
		for (int j=0;j<i;j++)
			for (int k=i+1;k<=n;k++)
				move(f[k][i],f[i][j]+sumA(1,i,i+1,k)+sumB(i+1,k,j+1,k));
	}
	ll ans=0;
	for (int i=0;i<n;i++)move(ans,f[n][i]);
	cout<<a[n][n]+b[n][n]-ans<<endl;
}

Measured memory_bytes: 6144
#include<stdio.h>
int main()
{
    char X,Y,v,n,q;
    int a,b,i;
    while(scanf("%c%c%c%c",&X,&v,&Y,&n)!=EOF)
    {
        q=X;
        for(i=1; i<=2; i++)
        {
            switch(q)
            {
            case 'A':
                q=10;
                break;
            case 'B':
                q=11;
                break;
            case 'C':
                q=12;
                break;
            case 'D':
                q=13;
                break;
            case 'E':
                q=14;
                break;
            case 'F':
                q=15;
                break;
            default:
                ;
            }
            if(i==1)
            {
                X=q;
            }
            else
            {
                Y=q;
            }
            q=Y;
        }
        if(X>Y)
        {
            printf(">\n");
        }
        else if(X<Y)
        {
            printf("<\n");
        }
        else if(X=Y)
        {
            printf("=\n");
        }
    }
}

Measured memory_bytes: 128
{-# LANGUAGE BangPatterns #-}

import qualified Data.ByteString.Char8 as C
import Data.Foldable
import Data.Maybe
import qualified Data.Vector as V
import qualified Data.Vector.Mutable as VM
import Data.Vector.Unboxed
import qualified Data.Vector.Unboxed.Mutable as UM
import Prelude hiding (drop, splitAt, tail, unfoldr)

main = C.interact $ put . sol . get

get = unfoldr (C.readInt . C.dropWhile (<'0'))

put = C.unlines . fmap (C.pack . show) . V.toList

sol v = fmap (\q -> ds!(q!0)+ds!(q!1)) qs
  where
  n = v!0
  (v0,v1) = splitAt (3*(n-1)) $! tail v
  es = V.unfoldrN (n-1) (Just . splitAt 3) v0
  q = v1!0
  k = v1!1
  qs = V.unfoldrN q (Just . splitAt 2) $! drop 2 v1
  tr = V.create $ do
    v <- VM.replicate (n+1) []
    let add x (y,z) = VM.unsafeRead v x >>= VM.unsafeWrite v x . ((y,z):) 
    V.forM_ es $ \e -> do
      add (e!0) (e!1,e!2)
      add (e!1) (e!0,e!2)
    return v
  ds = create $ do
    v <- UM.replicate (n+1) (-1)
    loop v (k,0)
    return v
  loop v !(nd,d) = do
    UM.unsafeWrite v nd d
    Data.Foldable.forM_ (tr V.! nd) $ \(nd',d') -> do
      x <- UM.unsafeRead v nd'
      if x<0 then loop v (nd',d+d') else return ()

Measured memory_bytes: 61308
#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;
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; }
ll MOD = 1000000007;

int main(void){
  ll n; cin >> n;
  vector<char> ans;
  while(n){
    n--;
    ans.push_back('a' + n%26);
    n/=26;
  }
  reverse(ans.begin(),ans.end());
  for(int i = 0; i < ans.size(); i++){
    cout << ans.at(i);
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 3580
#include<stdio.h>
int main(void) {
	int a, b,c;
	scanf("%d %d", &a, &b);
	if (a < 6) {
		c = 0;
	}
	else if (a < 13) {
		c = b / 2;
	}
	else {
		c = b;
	}
	printf("%d\n", c);
	return 0;
}

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


#define ALL(a) 		(a.begin() , a.end())
#define ll 			long long int
#define ff          first
#define ss          second
#define pb          push_back
#define ar 			array
#define mp 			make_pair
#define f(i,a,b)   	for(ll i =a;i<=b;i++)
#define inf 		INT_MAX
#define pll 		pair<ll,ll>
#define mat 		vector<vector<ll>>


#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifndef ONLINE_JUDGE
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
	*this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
 //debug & operator << (debug & dd, P p) { dd << "(" << p.x << ", " << p.y << ")"; return dd; }


 

const ll INF = 1e18;
void init(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE 
		freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#endif
}
 
bool checkp2(ll n){
	return n && !(n & (n-1));
}

ll numsetbit(ll n){
	ll count = 0;
	for(;n;count++){
		n = n & (n-1);
	}
	return count;
}
 
ll powe(ll x , ll n , ll mod){
    x = x % mod;
	ll po = 1;
	while(n){
		if(n & 1){
			po = (po*x) % mod;
		}
		n = n>>1;
		x = ((x % mod) * (x % mod)) % mod;
	}
	return po;
}

ll powm(ll x , ll n){
	ll po = 1;
	while(n){
		if(n & 1){
			po = (po*x);
		}
		n = n>>1;
		x = (x*x);
	}
	return po;
} 



bool isPrime(ll x){
	if(x < 2)
		return 0;
	for(ll y = 2; y * y <= x; y++){
		if(x % y == 0){
			return 0;
		}
	}
	return true;
}

void solve(){

		ll x;
		cin>>x;
		if(x == 1){
			cout<<"0"<<endl;
		}
		else{
			cout<<"1"<<endl;
		}
	

}

int main(){
	
	//init();
	ll t = 1;
	//cin>>t;
	for(ll i=1;i<=t;i++){
		//cout<<"Case #"<<i<<": ";
		solve();
	}
}

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

int main()
{
	while (true){
		int n;
		cin >> n;
		if (!n){ break; }

		long long int sold[4001];
		bool already[4001];
		queue<int> input;
		for (int i = 1; i <= 4000; i++){
			sold[i] = 0;
			already[i] = false;
		}
		for (int i = 0; i < n; i++){
			int number, yen, times;
			cin >> number >> yen >> times;
			if (already[number] == false){
				already[number] = true;
				input.push(number);
			}
			sold[number] += (long long int)yen * (long long int)times;
		}
		bool f = false;
		while (!input.empty()){
			if (sold[input.front()] >= 1000000){
				cout << input.front() << endl;
				f = true;
			}
			input.pop();
		}
		if (f == false){
			cout << "NA" << endl;
		}
	}
	return 0;
}

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

  using namespace std;

  const int INF = 1000000000;

  int c, n, m, s, d;
  int visited[100][11];
  int edge[100][100];

  void dfs(int p, int rem, int cost){
    if(visited[p][rem] < cost) return;
    visited[p][rem] = cost;
    if(p == d) return;
    for(int i=0;i<n;i++){
      if(edge[p][i] == INF) continue;
      if(rem > 0 ) dfs(i, rem-1, cost+(edge[p][i]/2));
      dfs(i, rem, cost+edge[p][i]);
    }
  }


 main(){
    while(cin >> c >> n >> m >> s >> d && (c || n || m || s || d)){
      fill(edge[0], edge[100], INF);
      fill(visited[0], visited[100], INF);
      --s; --d;
      for(int i=0;i<m;i++){
         int a, b, f;
         cin >> a >> b >> f;
         --a; --b;
         edge[a][b] = edge[b][a] = f;
      }

      dfs(s, c, 0);
      int ans = INF;
      for(int i=0;i<c;i++){
         ans = min(ans, visited[d][i]);
      }

      cout << ans << endl;
    }

    return 0;
} 

Measured memory_bytes: 1208
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <functional>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cassert>
#define InfL 2000000000
#define InfLL 4000000000000000000LL
#define mod 1000000007
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=(n-1);i>=0;i--)
using namespace std;
typedef long long ll;
typedef double db;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<db> vd;

int main() {
	int N;
	cin >> N;
	vi A(N), B(N);
	rep(i, N)
		cin >> A[i];
	rep(i, N)
		cin >> B[i];
	vi Al(N + 1, -1);
	vi Ar(N + 1, -1);
	vi Bl(N + 1, -1);
	vi Br(N + 1, -1);
	rep(i, N) {
		Ar[A[i]] = i;
		Br[B[i]] = i;
	}
	rrep(i, N) {
		Al[A[i]] = i;
		Bl[B[i]] = i;
	}
	vi X(N, 0);
	bool can = 1;
	rep(i, N + 1) {
		if (Al[i] == -1 || Bl[i] == -1)
			continue;
		int AL = Al[i];
		int AR = Ar[i];
		int BL = Bl[i];
		int BR = Br[i];
		int L = AL - BR;
		int R = BL - AR;
		if (AR - AL + 1 + BR - BL + 1 > N)
			can = 0;
		if (L > 0) {
			X[L]++;
			X[AR - BL + 1]--;
		}
		else if (R <= 0) {
			X[0]++;
			X[AR - BL + 1]--;
			X[L + N]++;
			X[N]--;
		}
		else {
			X[L + N]++;
			X[N]--;
		}
	}
	int n = -1;
	if (can) {
		int k = 0;
		rep(i, N) {
			k += X[i];
			if (k == 0)
				n = i;
		}
	}
	if (n == -1)
		cout << "No" << endl;
	else {
		cout << "Yes" << endl;
		rep(i, N)
			cout << B[(i - n + N) % N] << " ";
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 8804
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author dwij
 */


#include <bits/stdc++.h>


using namespace std;

/*******  All Required define Pre-Processors and typedef Constants *******/
#define endl '\n'

/**********************************************/




class ACirclePond {
public:
    void solve(istream &in, ostream &out) {
        double n;
        in >> n;

        out << 2 * M_PI * n << endl;


    }
};


int main() {
    ACirclePond solver;
    std::istream &in(std::cin);
    std::ostream &out(std::cout);

    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 3796
import math


def walk_on_multiplication_table(n: int) -> int:
    minimum = None
    for i in range(1, int(math.sqrt(n)) + 1):
        tmp = int(n % i)
        if tmp == 0:
            r = i + int(n / i) - 2
            if minimum is None:
                minimum = r
            else:
                minimum = min(minimum, r)
    return minimum

if __name__ == '__main__':
    N = int(input())
    result = walk_on_multiplication_table(N)
    print(result)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
int main(void){
    double N; cin >> N;
    int K; cin >> K;
    double Z = 0;  //勝つ確率
    int A = 0;
    double H;
    for(int i = 0 ; i < N ; i++){ //さいころの目の数
        H = 1;   //1 / H が何分の1かを表す。(Hが2のj乗)
        A++;     //一番初めの得点
        for(int j = 0 ; H*A < K ; j++)  H *= 2;
        H = 1 / H;      //1 / 2^j
        Z += H;
    }
    
    Z /= N;    //初めの得点の分の確率を考える
    printf("%.12f\n", Z);
}


Measured memory_bytes: 256
#include<iostream>
#include<fstream>
#include<cstdio>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<set>
#include<list>
#include<queue>
#include<deque>
#include<unordered_map>
#include<map>
#include<string>
#include<cstring>
#include<stack>
#include<cmath>
#include<utility>

#define vint vector<int>
#define vstr vector<string>
#define vll vector<long long>
#define ll long long
#define pf printf
#define sf scanf
#define sfd(n) scanf("%d", &n)
#define sflf(n) scanf("%lf", &n)
#define sfll(n) scanf("%lld", &n)
#define pfd(n) printf("%d", n)
#define pflf(n) printf("%lf", n)
#define pfll(n) printf("%lld", n)
#define pft	printf("\t")
#define pfn printf("\n")
#define pfk printf(" ")
#define PI 3.1415926
#define MAX 100000
#define M 1e9

using namespace std;

int main() {
	int n;
	sfd(n);
	int* num = new int[n+2];
	vector<int> travel;
	num[0] = 0;
	int sum = 0, m;
	for( int i=1; i<=n; i++ ) {
		sfd(num[i]);
		m = abs(num[i]-num[i-1]);
		travel.push_back(m);
		sum += m;
	}
	num[n+1] = 0;
	sum += abs(num[n]);
	travel.push_back(abs(num[n]));
//	cout << "len = " << travel.size() << endl;
	for( int i=0; i<n; i++ ) {
		pfd(sum-travel[i]-travel[i+1]+abs(num[i+2]-num[i]));
		pfn;
	}
	
	return 0;
}

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

int main()
{
    int n, m;
    cin >> n >> m;
    vector<int> x(m);
    rep(i, 0, m) cin >> x[i];
    sort(x.begin(), x.end());
    
    vector<int> edge;
    rep(i, 0, m - 1) edge.push_back(x[i + 1] - x[i]);
    sort(edge.begin(), edge.end());

    ll ans = 0;
    for (int i = 0; i + 1 + n <= m; i++)
        ans += edge[i];
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1276
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <set>
#include <string>
#include <vector>
#define SORT(a) sort((a).begin(), (a).end())
#define RSORT(a) sort((a).rbegin(), (a).rend())
#define REP(i, n) for (int i = 0; i < n; i++)
#define ALL(a) a.begin(), a.end()
typedef long long int ll;
using namespace std;

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

    int n, m;
    cin >> n >> m;
    vector<int> x(m);

    int ans = 0;
    REP(i, m) { cin >> x[i]; }

    if (n > m) {
        cout << "0" << endl;
        return 0;
    }

    SORT(x);

    int i = 0;

    vector<int> a(m);
    for (int i = 1; i < m; i++) {
        a[i - 1] = abs(x[i] - x[i - 1]);
        ans += abs(x[i] - x[i - 1]);
    }

    SORT(a);

    if (n > m) {
        n = m;
    }

    for (int i = m; i >= m - n + 1; i--) {
        ans -= abs(a[i]);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1024
import java.util.Scanner;
import java.util.Stack;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String x = sc.next();
		Stack<String> stack = new Stack<>();
		for(int i = 0 ; i < x.length() ; i++) {
			if(stack.size() > 0 && stack.peek().equals("S") && x.charAt(i) == 'T') {
				stack.pop();
			} else {
				stack.add(String.valueOf(x.charAt(i)));
			}
		}
		System.out.println(stack.size());
	}
}


Measured memory_bytes: 38868
import java.util.Scanner;
public class Main {
    public static void main(String[] defargs) {
        Scanner scanner = new Scanner(System.in);
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        int c = scanner.nextInt();
        if(a < b && b < c){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}


Measured memory_bytes: 26112
function Main(input) {
	input = input.trim().split("\n").map(function(x) { return x.split(" ")});
	let X = parseInt(input[0][0], 10);
	console.log(8 - Math.floor((X - 400) / 200));
}


Main(require("fs").readFileSync("/dev/stdin", "utf8"));


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


void solve(long long X, long long t){
    if(X <= t) cout << 0 << endl;
    else cout << X - t << endl;
}

int main(){
    long long X;
    scanf("%lld",&X);
    long long t;
    scanf("%lld",&t);
    solve(X, t);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define ALL(a) (a.begin(), a.end())
using ll = long long;
template<typename T> void Out(T x) { cout << x << endl; }

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, x, y;
  cin >> n >> x >> y;

  vector<int> cnt(n + 1, 0);

  for (int i = 1; i <= n; i++) {
    for (int j = i + 1; j <= n; j++) {
      int dist = (j - i);
      dist = min(dist, (abs(x - i) + 1 + abs(j - y)));
      dist = min(dist, abs(y - i) + 1 + abs(x - j));
      cnt[dist]++;
    }
  }
  for (int i = 1; i < n; i++) {
    cout << cnt[i] << endl;
  }

}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        if (s.charAt(0)=='9'||s.charAt(1)=='9') {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}


Measured memory_bytes: 21972