akhauriyash/Code-Regression huggingface dataset:
import numpy as np

bingo = np.zeros((3,3))
bin_bingo = np.zeros((3,3))

for i in range(3):
    bingo[i] = list(map(int, input().split()))



N = int(input())

for _ in range(N):
    num = int(input())
    bin_bingo = np.logical_or(bin_bingo, bingo == num)

# find bingo
lin1 = np.array([[True, True, True], [False, False, False], [False, False, False]])
lin2 = np.array([[False, False, False],[True, True, True], [False, False, False]])
lin3 = np.array([[False, False, False], [False, False, False], [True, True, True]])
col1 = lin1.T
col2 = lin2.T
col3 = lin3.T

sla1 = np.array([[True, False, False], [False, True, False], [False, False, True]])
sla2 = np.array([[False, False, True], [False, True, False], [True, False, False]])

def is_bingo(src, tmp):
    return (np.logical_and(src, tmp) == tmp).all()

flg = False
if is_bingo(bin_bingo, lin1):
    flg = True
elif is_bingo(bin_bingo, lin2):
    flg = True
elif is_bingo(bin_bingo, lin3):
    flg = True
elif is_bingo(bin_bingo, col1):
    flg = True
elif is_bingo(bin_bingo, col2):
    flg = True
elif is_bingo(bin_bingo, col3):
    flg = True
elif is_bingo(bin_bingo, sla1):
    flg = True
elif is_bingo(bin_bingo, sla2):
    flg = True

if flg:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 12448
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define endl '\n'
int main() {
	ll n, a, b;
	cin >> n >> a >> b;
	if (a + b == 0 || a == 0) {
		cout << 0 << endl;
		return 0;
	}
	ll iter = n / (a + b);
	ll ans = iter * a;
	n %= (a + b);
	ans += min(n, a);
	cout << ans << endl;
	return 0;

}

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

int main()
{
  int n,x,y;
  cin>>n>>x>>y;
  x--;y--;
  vector<vector<int>> graph(n);
  graph[0].push_back(1);
  graph[n-1].push_back(n-2);
  for (int i = 1; i < n-1; ++i)
  {
    graph[i].push_back(i-1);
    graph[i].push_back(i+1);
  }
  graph[x].push_back(y);
  graph[y].push_back(x);
  vector<int> ans(n,0);
  for (int start = 0; start < n; ++start)
  {
    queue<int> next;
    vector<int> dist(n,-1);
    dist[start]=0;
    next.push(start);
    while(!next.empty())
    {
      int tmp=next.front();
      next.pop();
      for(const auto& e: graph[tmp]) 
      {
        if(dist[e]!=-1) continue;
        dist[e]=dist[tmp]+1;
        next.push(e);
      }
    }
    for (int i = 0; i < n; ++i)
    {
      ans[dist[i]]++;
    }
  }
  for (int i = 1; i < ans.size(); ++i)
  {
    cout<<ans[i]/2<<endl;
  }
}

Measured memory_bytes: 384
#include<iostream>
#include<string>
#include<algorithm>	
#include<cmath>
using namespace std;
int main() {
	int n, a, sum = 0; cin >> n >> a;
	if (n + a == 15) {
		cout << '+' << endl;
	}
	else if (n * a == 15) {
		cout << '*' << endl;
	}
	else {
		cout << 'x' << endl;
	}
	cin >> n;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define endl              "\n"
#define fast               ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
int main()
{
    long long i,j,e=1,n,x,c=0,d=0;
    cin>>n;
    string a;
    set<string> s;
    map<string,int>  m;
    while(n--)
    {
        cin>>a;
        m[a]++;
    }
    for(auto x:m)
    {
        if(x.second>=c)
        {
            c=x.second;
        }
    }
    for(auto x:m)
    {
        if(x.second==c)
        {
            s.insert(x.first);
        }
    }
    for(auto x:s)
    {
        cout<<x<<endl;
    }
}


Measured memory_bytes: 34560
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <functional>
#include <numeric>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cassert>
#define bogo_sort   std::sort
#define bozo_sort   std::stable_sort
#define alles(obj)  obj.begin(), obj.end()
#define elif        else if
#define unless(flg) if(!(flg))
#define elless(flg) else if(!(flg))
#define echo        std::cout <<
#define read        std::cin >>
#define endl        std::endl
#define fin         << '\n'
#define bash        push_back
#define makePair    std::make_pair
#define _           << ' ' <<
// type-define
#define Stack       std::stack
#define Queue       std::queue
#define Set         std::set
#define PQueue      std::priority_queue
#define Vector      std::vector
#define Pair        std::pair
#define Map         std::map
#define HashMap     std::unordered_map
#define Greater     std::greater
using String  =     std::string;
using llong   =     long long;
using boolean =     bool;
using Pii     =     Pair<int, int>;
using Vi      =     Vector<int>;
using Vii     =     Vector<Pii>;
// utils
constexpr int   dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
constexpr int   dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
constexpr int   INF  = 0x3f3f3f3f;
constexpr llong LINF = 0x3f3f3f3f3f3f3f3fLL;

namespace {
    template<class A, class B> A power ( llong x, llong n, llong mod ) {
        llong ans = 1;
        while ( n > 0 ) {
            if ( n & 1 ) ans = ( ans * x ) % mod;
            x = ( x * x ) % mod;
            n >>= 1;
        }
        return ans;
    }
    template<class A, class B> A power ( A x, B n ) { return power( x, n, 1000000007 ); }
    template<class A> A gcd ( A x, A y ) { return x % y ? gcd( y, x % y ) : y; }
    template<class A, class B> A lcm   ( A x,  B y ) { return ( x / gcd(x, y) * y ); }
    template<class A> inline A abs ( A n ) { return ( n < 0 ) ? -n : n; }
    template<class A, class B> inline bool chmax ( A &a, const B &b ) { return b > a ? a = b, true : false; }
    template<class A, class B> inline bool chmin ( A &a, const B &b ) { return b < a ? a = b, true : false; }
    boolean isMovable ( int x, int y, int w, int h ) {
        return ( x >= 0 && y >= 0 && x < w && y < h );
    }
}

namespace Rlyeh {

    signed call_of_Cthulhu( signed datum ) {

        int n;
        read n;
        llong ans;
        read ans;
        for ( int i = 1; i < n; i++ ) {
            llong a;
            read a;
            ans = lcm(ans, a);
        }
        echo ans fin;

        return 0;
    }
}

signed main(){std::cin.tie(0); std::ios::sync_with_stdio(false); int main_result = Rlyeh::call_of_Cthulhu(114514); return 0;}


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

int main()
{
    ll grams;
    int types;
    int lessgrams;
    cin >> types >> grams;
    vector <int> recipe;
    for(int i=0;i<types;i++){
        int number;
        cin >> number;
        recipe.push_back(number);

        grams -= recipe.at(i);
        lessgrams = recipe.at(i);
    }
    for (auto i : recipe){
        if(i<lessgrams)
        lessgrams = i;
    }


    ll result = grams/lessgrams + types;

    cout << result << endl;

}

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

int main(){
  int n, k;
  cin >> n >> k;
  double p[n];
  vector<double> s(n+1,0);
  rep(i,n) {
    cin >> p[i];
    s[i+1] = s[i] + (p[i]+1.0)/2.0; 
  }
  double ans = 0.0;
  for(int i = k; i <= n; i++) {
    ans = max(ans,s[i]-s[i-k]);
  }
  printf("%.9lf\n",ans);
  return 0;
}

Measured memory_bytes: 3328
#include <iostream>
#include <string>
using namespace std;
bool isPalindrome(string s) {
    for (int i = 0; i < s.size() / 2; i++) if (s[i] != s[s.size() - 1 - i]) return false;
    return true;
}
int main() {
    int A, B, ans = 0;
    cin >> A >> B;
    for (int i = A; i <= B; i++) if (isPalindrome(to_string(i))) ans++;
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>  
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define REP(e,v) for(auto e:v)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define tii tuple<int,int,int>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define edge(v,a,b) v[a].pb(b);v[b].pb(a);
#define MAX_V 400010
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define endl "\n"
#define ALL(c) (c).begin(),(c).end()
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}

#define INF 1e9+7
#define LLINF 1e18+7
ll MOD=1e9+7;
#define N 1055050
ll s[N],t[N];
main(){

    ll a=in(),b=in(),q=in();
    rep(i,a)s[i]=lin();
    rep(i,b)t[i]=lin();
    rep(iii,q){
        ll x=lin();
        ll ans=LLINF;
        ll ans1=0,ans2=0;
        ll r[2];
        r[0]=lower_bound(s,s+a,x)-s;
        if(r[0]==0)r[1]=-1;
        else r[1]=r[0]-1;
        if(r[0]==a)r[0]=-1;
        ll l[2];
        l[0]=lower_bound(t,t+b,x)-t;
        if(l[0]==0)l[1]=-1;
        else l[1]=l[0]-1;
        if(l[0]==b)l[0]=-1;
        //cout<<r[0]<<" "<<r[1]<<" "<<l[0]<<" "<<l[1]<<endl;
        rep(i,2){
            rep(j,2){
                if(r[j]==-1||l[i]==-1)continue;
                ll xx=s[r[j]],yy=t[l[i]];
                //cout<<xx<<" "<<yy<<endl;
                ll tmp=min(abs(x-xx),abs(x-yy));
                //cout<<tmp<<endl;
                tmp=tmp+abs(xx-yy);
                ans=min(ans,tmp);
            }
        }
        cout<<ans<<endl;
    }
    return 0;
}

Measured memory_bytes: 4096
X = open(0).read().split()
d = {'AC':0, 'WA':0, 'TLE':0, 'RE':0}
for x in X[1:]:
    d[x] += 1
print('AC x ' + str(d['AC']))
print('WA x ' + str(d['WA']))
print('TLE x ' + str(d['TLE']))
print('RE x ' + str(d['RE']))

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

int main() {
  ll h,n;
  cin>>h>>n;
  vector<ll> a(n);
  for(ll i=0;i<n;++i)cin>>a[i];
  string s;
  if(h>accumulate(a.begin(),a.end(),0))s="No";
  else s="Yes";
  cout<<s<<endl;
}


Measured memory_bytes: 1024
from decimal import Decimal
T = tuple(map(Decimal, input().split()))

A = list(map(Decimal, input().split()))
B = list(map(Decimal, input().split()))


ans = 0
if A[0] < B[0]:
    tmp = (A[0], A[1])
    A[0], A[1] = B[0], B[1]
    B[0], B[1] = tmp[0], tmp[1]

a = abs(T[0]*A[0] - T[0]*B[0])

b = T[0]*(B[0]-A[0])+T[1]*(B[1]-A[1])


if b == 0:
    print("infinity")
elif b < 0:
    print(0)
    exit(0)
else:
    ans += 1
    if b > a:
        print(1)
    elif b == a:
        print("infinity")
    else:
        if a % b == 0:
            print((a//b)*2)
        else:
            print((a//b)*2 + 1)


Measured memory_bytes: 5076
n = int(input())
a = list(map(int, input().split()))
ans = [True] * n
for i in range(n):
    if a[i]%2==0:
        if a[i]%3!=0 and a[i]%5!=0:
        	ans[i] = False
if all(ans):
    print('APPROVED')
else:
    print('DENIED')

Measured memory_bytes: 3060
#include <iostream>
using namespace std;
int main()
{
	int H,N,A ;
	int c=0 ;
	cin >> H;
	cin >> N;
	while (c<N) {
		cin >> A ;
		H-=A ;
		c++ ;
	}
	if (H<=0) {
		cout << "Yes" ;
	}
	else {
		cout << "No" ;
	}
	return 0 ;
}

Measured memory_bytes: 256
while True:
    n, x = map(int, input().split())
    if n == 0 and x == 0:
        break
    ans = 0
    for i in range(1, n + 1):
        for j in range(i + 1, n + 1):
            for k in range(j + 1, n + 1):
                if i + j + k == x:
                    ans += 1
    print(ans)


Measured memory_bytes: 5588
//#include <bits/stdc++.h>                          //include all library  
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <sstream>
#include <vector>
#include <stack>
#include <string.h>
#include <functional> // greater<int> はfunctionalヘッダ
using namespace std;

#define REP(i, n) for(int i = 0;i < n;i++)          //REP(i, 10){...} //i=0～i=9までのループ
#define REPR(i, n) for(int i = n;i >= 0;i--)        //REPR(i, 10){...} //i=10～i=0までのループ
#define FOR(i, m, n) for(int i = m;i < n;i++)       //FOR(i, 3, 10){...} //i=3～i=9までのループ
#define FORR(i, m, n) for(int i = m;i >= n;i--)     //FORR(i, 10, 3){...} //i=10～i=3までのループ
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
#define PI 3.141592653589
#define npos -1


int main(){
  int a,b;
  cin >> a >> b;
  if(a-b>=0) cout << a-b;
  else cout<<0;
}

Measured memory_bytes: 256
//@truneo
//The purpose of computation is insight, not numbers...
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
	int t;
	//cin>>t;
	t=1;
	while(t--)
	{
		ll n,i,j,k;
		cin>>n;
		ll p[n][3],dp[n][3];
		for(int i=0;i<n;i++)
		{
			for(int j=0;j<3;j++)
			{
				cin>>p[i][j]; 
				if(i==0)
					dp[i][j]=p[i][j];
			}
		}
		for(int i=1;i<n;i++)
		{
			dp[i][0]=max(dp[i-1][1],dp[i-1][2])+p[i][0];
			dp[i][1]=max(dp[i-1][0],dp[i-1][2])+p[i][1];
			dp[i][2]=max(dp[i-1][0],dp[i-1][1])+p[i][2];
		}
		
		cout<<(ll)max(dp[n-1][0],(ll)max(dp[n-1][1],dp[n-1][2]))<<"\n";
		
	}
	return 0;
}

Measured memory_bytes: 4992
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
//const long long MOD = 998244353;
using namespace std;


int main(int argc, char* argv[])
{
    int n;
    scanf("%d", &n);

    int a=n/100;
    int b=n%100;

    if(b<=5*a) {
        printf("1\n");
    }
    else {
        printf("0\n");
    }



    return 0;
}


Measured memory_bytes: 128
n = int(input())
items = list(map(int, input().split()))
count = 0
while True:
    should_break = False
    for i in range(n):
        if items[i] % 2 == 0:
            items[i] = items[i] / 2
            continue
        else:
            should_break = True
            break
    if should_break:
        break
    count += 1
print(count)

Measured memory_bytes: 9116
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <sstream>
#include <set>
#include <tuple>
#include <algorithm>
#include <memory>
#include <numeric>
#include <queue>
#include <functional>
#include <cmath>
#include <cstring>
#include <map>
#include <unordered_map>
#include <sstream>
#include <iomanip>

using namespace std;
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; }

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;

const ll INF = 1LL << 60;
const ll MOD = 1000000007;

// https://ei1333.github.io/luzhiled/snippets/math/prime-table.html
vector< bool > prime_table(ll n) {
    vector< bool > prime(n + 1, true);
    if (n >= 0) prime[0] = false;
    if (n >= 1) prime[1] = false;
    for (ll i = 2; i * i <= n; i++) {
        if (!prime[i]) continue;
        for (int j = i + i; j <= n; j += i) {
            prime[j] = false;
        }
    }
    return prime;
}


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

	ll N;
	cin >> N;

    vector<ll> f(N+1);

    f[0] = 0;
    for (ll i = 1; i <= N; ++i)
    {
        ll j = 0;
        while (true)
        {
            j++;
            ll q = i * j;
            if (q > N)
                break;

            f[q]++;
        }
    }

    ll ans = 0;

    for (ll i = 1; i <= N; ++i)
    {
        ans += i * f[i];
    }

	cout << ans << endl;
}


Measured memory_bytes: 81328
#include <iostream>

using namespace std;

int main()
{


    string c;

    cin >> c;
    if (c == "a")
        cout << "vowel";
    else if (c == "e")
        cout << "vowel";
    else if (c == "i")
        cout << "vowel";
    else if (c == "o")
        cout << "vowel";
    else if (c == "u")
        cout << "vowel";
    else
        cout << "consonant";
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <sstream>
#include <vector>
#include <stack>
using namespace std;

stack<string> a;
int main(int argc, const char * argv[]) {
    //freopen("/Users/mac/Desktop/C++?¨????/test/test.txt", "r", stdin);
    string tem;
    while(cin>>tem){
        if (tem=="+") {
            string s1=a.top();
            a.pop();
            string s2=a.top();
            a.pop();
            int t=stoi(s1)+stoi(s2);
            string s=to_string(t);
            a.push(s);
        }
        else if (tem=="-") {
            string s1=a.top();
            a.pop();
            string s2=a.top();
            a.pop();
            int t=stoi(s2)-stoi(s1);
            string s=to_string(t);
            a.push(s);
        }
        else if (tem=="*") {
            string s1=a.top();
            a.pop();
            string s2=a.top();
            a.pop();
            int t=stoi(s1)*stoi(s2);
            string s=to_string(t);
            a.push(s);
        }
        else if (tem=="/") {
            string s1=a.top();
            a.pop();
            string s2=a.top();
            a.pop();
            int t=stoi(s2)/stoi(s1);
            string s=to_string(t);
            a.push(s);
        }
        else{
            a.push(tem);
        }
    }
    cout<<a.top()<<endl;
    return 0;
}

Measured memory_bytes: 3292
#include <bits/stdc++.h>
#define int long long
using namespace std;

signed main() {
    string a;
    cin >> a;
    if (a == "A") {
        cout << "T" << endl;
        return 0;
    };
    if (a == "T") {
        cout << "A" << endl;;
        return 0;
    };
    if (a == "C") {
        cout << "G" << endl;
        return 0;
    };
    cout << "C" << endl;
}

Measured memory_bytes: 256
import java.io.PrintWriter;
import java.util.*;

public class Main {

    Scanner sc = new Scanner(System.in);
    int h = sc.nextInt();
    int n = sc.nextInt();
    int[] power = new int[n];
    int[] cost = new int[n];
    int[][] arr = new int[n][2];

    int[] dp = new int[h+10001];

    PrintWriter out = new PrintWriter(System.out);


    public static void main(String[] args) {
        new Main().run();
    }

    void run() {
        for (int i=0; i<n; i++) {
            int pow = sc.nextInt();
            int cost = sc.nextInt();
            arr[i][0] = pow;
            arr[i][1] = cost;
//            Pair pair = new Pair(pow, cost);
        }
//        Arrays.sort(arr, (a, b) -> Integer.compare(a[0], b[0]));

//        for (int i=0; i<n; i++) {
//            System.out.print(arr[i][0]+" ");
//            System.out.println(arr[i][1]);
//        }




        for (int i=1; i<h+1; i++) {
            int idx = i+10000;
            dp[idx] = Integer.MAX_VALUE;
            for (int j=0; j<n; j++) {
                dp[idx] = Math.min(dp[idx], dp[idx-arr[j][0]]+arr[j][1]);
            }
        }

//        for (int i=0; i<n+1; i++) {
//            for (int j=0; j<h; j++) {
//                System.out.print(dp[i][j]+" ");
//            }
//            System.out.println(dp[i][h]);
//        }


        out.println(dp[h+10000]);
        out.flush();
    }

    void solve(int i, int m) {
    }

    class Pair {
        int power;
        int cost;
        public Pair(int p, int c) {
            this.power = p;
            this.cost = c;
        }

        public int compareTo(Pair p) {
            if (this.cost < p.cost) return -1;
            if (this.cost > p.cost) return -1;
            return 0;
        }
    }
}


Measured memory_bytes: 25548
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
const int MOD = 1000000007;
int main() {
    int n,m;
    cin>>n>>m;
    ll h[n],mi[n];
    REP(i,n){
        cin>>h[i];
        mi[i]=1;
    }
    ll a,b;
    REP(i,m){
        cin>>a>>b;
        if (h[a-1]>h[b-1])
        {
            /* code */
            mi[b-1]=0;

        }
        else if (h[a-1]<h[b-1])
        {
            /* code */
             mi[a-1]=0;
        }
        else
        {
            mi[b-1]=0;
            mi[a-1]=0;
        }
    }
    ll ans=0;
    REP(i,n){
        ans+=mi[i];
    }
    cout<<ans<<endl;
}

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

int main()
{
    int h, w;
    std::cin >> h >> w;
    char grid[h + 5][w + 5];
    for (int i = 1; i <= h; i++)
    {
        for (int j = 1; j <= w; j++) { std::cin >> grid[i][j]; }
    }
    int flg = 0;
    for (int i = 1; i <= h; i++)
    {
        for (int j = 1; j <= w; j++)
        {
            if (grid[i][j] == '#' && grid[i - 1][j] != '#' && grid[i + 1][j] != '#' && grid[i][j - 1] != '#' && grid[i][j + 1] != '#') { flg++; }
        }
    }
    if (flg == 0) { std::cout << "Yes" << std::endl; }
    else
    {
        std::cout << "No" << std::endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstdio>
#include <iomanip>
#include <cmath>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <stdlib.h>
#include <set>
typedef long long ll;
using namespace std;

int main() {
	string s="";
	cin>>s;
	if(s=="Sunny"){
		cout<<"Cloudy"<<endl;
	}else if(s=="Cloudy"){
		cout<<"Rainy"<<endl;
	}else{
		cout<<"Sunny"<<endl;
	}

	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (ll 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())
#define FORV(i, v) for (auto i = v.begin(); i != v.end(); i++)
using namespace std;

using ll = long long;

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 = 1001001001;
const long long INFLL = LLONG_MAX / 3;
const double eps = (1e-9);


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

  ll n;
  cin >> n;
  vector<int> nb(n, 0);
  rep(i, n-1) {
    int boss; cin >> boss; boss--;
    nb[boss]++;
  }
  rep(i, n) cout << nb[i] << endl;

  return 0;
}


Measured memory_bytes: 3964
n, w = map(int, input().split())
w_v = [list(map(int, input().split())) for _ in range(n)]
#import numpy as np
dp = [[0]*(w+1) for _ in range(n+1)]
for i in range(n):
    for j in range(w+1):
        dp[i+1][j] = max(dp[i][j], dp[i+1][j])
        if j-w_v[i][0] >= 0:
            dp[i+1][j] = max(dp[i+1][j], dp[i][j-w_v[i][0]] + w_v[i][1])

    
print(dp[n][w])



Measured memory_bytes: 147172
#include <stdio.h>
#include <vector>
#include <queue>
#include <algorithm>
#include<string.h>
#include <math.h>
#include <stack>
#define ll long long
using namespace std;

int main() {
	int r, d, n;;
	scanf("%d %d %d", &r, &d, &n);
	int res = r * n - d;
	printf("%d\n", res);
	for (int i = 1; i < 10; i++) {
		res = res * r - d;
		printf("%d\n", res);
	}
}

Measured memory_bytes: 128
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque, OrderedDict
from copy import deepcopy
from functools import lru_cache, reduce
from math import ceil, floor

import heapq
import itertools
import operator


def get_int():
    return int(input())


def get_str():
    return input().strip()


def get_int_list():
    return [int(i) for i in input().split()]


def get_char_list():
    return list(input().strip())


def main():
    n = get_int()
    hps = get_int_list()

    x = min(hps)
    while True:
        mod = [v % x for v in hps]
        mod = list(filter(lambda x: x > 0, mod))
        if mod and min(mod) < x:
            x = min(mod)
        else:
            print(x)
            return


if __name__ == '__main__':
    main()


Measured memory_bytes: 71276
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

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

    int n;
    cin >> n;

    //vector<ll> a(n);
    int p[19][19] = {};
    string s;
    ll r = 0;

    for (int i = 0; i < n; i++) {
        ll t = 0;
        int f = 0, k = 9;

        cin >> s;
        for (char c : s) {
            if (c == '.') {
                f = 1;
                continue;
            }
            if (f) {
                k--;
            }
            t *= 10;
            t += c - '0';
        }
        for (int j = 0; j < k; j++) {
            t *= 10;
        }

        int x = 0, y = 0;
        while (t % 2 == 0) t /= 2, x++;
        x = min(x, 18);
        while (t % 5 == 0) t /= 5, y++;
        y = min(y, 18);

        for (int x1 = 18 - x; x1 < 19; x1++) {
            for (int y1 = 18 - y; y1 < 19; y1++) {
                r += p[x1][y1];
            }
        }
        p[x][y]++;

        //a[i] = t;
        //cout << a[i] << endl;
    }

    cout << r << endl;

    //積が10^18の倍数になるもの

    return 0;
}

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

int main(){
    string O, E;
    cin >> O >> E;

    int j=0;
    int k=0;
    for(int i=0; i<O.size()+E.size(); i++){
        if((i+1)%2==0){
            cout << E[j];
            j++;
        }else{
            cout << O[k];
            k++;
        }
    }
    return 0;
}

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

int N, Q;
vector<int> S, T, X;
int main() {
  cin >> N >> Q;

  S.resize(N), T.resize(N), X.resize(N);

  vector<int> vals;
  rep(i, N) {
    cin >> S[i] >> T[i] >> X[i];
    vals.push_back(S[i] - X[i]);
    vals.push_back(T[i] - X[i]);
  }

  sort(all(vals));
  vals.erase(unique(all(vals)), vals.end());

  vector<vector<int>> starts(vals.size()), ends(vals.size());
  rep(i, N) {
    int j = distance(vals.begin(), lower_bound(all(vals), S[i] - X[i]));
    starts[j].push_back(i);
    j = distance(vals.begin(), lower_bound(all(vals), T[i] - X[i]));
    ends[j].push_back(i);
  }

  vector<int> mins(vals.size());
  set<pair<int, int>> s;
  rep(i, vals.size()) {
    for (int j : ends[i]) s.erase(make_pair(X[j], j));
    for (int j : starts[i]) s.insert(make_pair(X[j], j));
    mins[i] = s.empty() ? -1 : (*s.begin()).first;
  }

  rep(q, Q) {
    int D;
    cin >> D;
    int i = distance(vals.begin(), upper_bound(all(vals), D));
    if (i == 0 || i == vals.size()) {
      cout << -1 << endl;
      continue;
    }
    cout << mins[i - 1] << endl;
  }

  return 0;
}


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

int main() {
  long n,s,ans=0,mod=998244353;
  cin >> n >> s;
  vector<long> a(n);
  vector<long> wa(s-1);
  for(long i=0;i<n;i++) cin >> a[i];

  for(long i=0;i<n;i++) {
    for(long j=s-1;j>0;j--) {
      if(a[i]+j<s) wa[a[i]+j-1]=(wa[a[i]+j-1]+wa[j-1])%mod;
      else if(a[i]+j==s) ans=(ans+wa[j-1]*(n-i))%mod;
    }
    if(a[i]<s) wa[a[i]-1]=(wa[a[i]-1]+i+1)%mod;
    else if(a[i]==s) ans=(ans+(i+1)*(n-i))%mod;
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>

#define debug(x) cout << #x << "==" << x << endl;

const int INF = 1e+9 + 7;

using namespace std;

//入力
int a[3];

int main() {
  ios::sync_with_stdio(false);

  cin >> a[0] >> a[1] >> a[2];

  sort(a, a+3);


  if(a[2] == a[1] + a[0]) {
    cout << "Yes\n";
  } else {
    cout << "No\n";
  }


  return 0;
}



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

int n, k;
int a[1999], b[1999];
vector<int> et[2000];

int dfs(int p, int v, int remDep) {
	int i;
	
	if (remDep == 0) {
		return 1;
	}
	
	int ret = 1;
	for (i = 0; i < et[v].size(); i++) {
		int nv = et[v][i];
		if (nv == p) continue;
		int res = dfs(v, nv, remDep - 1);
		ret += res;
	}
	return ret;
}

int main() {
	int i;
	
	cin >> n >> k;
	for (i = 0; i < n - 1; i++) {
		cin >> a[i] >> b[i];
		a[i]--; b[i]--;
		et[a[i]].push_back(b[i]);
		et[b[i]].push_back(a[i]);
	}
	
	int maxV = 0;
	for (i = 0; i < n; i++) {
		int res = dfs(-1, i, k / 2);
		maxV = max(maxV, res);
	}
	
	for (i = 0; i < n - 1; i++) {
		int res1 = dfs(a[i], b[i], (k - 1) / 2);
		int res2 = dfs(b[i], a[i], (k - 1) / 2);
		maxV = max(maxV, res1 + res2);
	}
	cout << n - maxV << endl;
	return 0;
}

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

void solve(long long N, std::vector<long long> L) {
    long long ans = 0;
    for (size_t i = 0; i < N; i++) {
        for (size_t j = i + 1; j < N; j++) {
            for (size_t k = j + 1; k < N; k++) {
                if (L[i] == L[j] || L[j] == L[k] || L[k] == L[i]) {
                    continue;
                }
                if (L[i] + L[j] + L[k] > 2 * max({L[i], L[j], L[k]})) {
                    ans++;
                }
            }
        }
    }
    cout << ans << endl;
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main() {
    long long N;
    scanf("%lld", &N);
    std::vector<long long> L(N);
    for (int i = 0; i < N; i++) {
        scanf("%lld", &L[i]);
    }
    solve(N, std::move(L));
    return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    string s;
    cin >> n >> s;
    int ans = 0;
    for(int i = 0; i < n; i++)
    {
        vector<int> x(26);
        vector<int> y(26);

        for(int j = 0; j < i; j++)
        {
            x[s[j]-'a']++;
        }
        for(int j = i; j < n; j++)
        {
            y[s[j]-'a']++;
        }
        int count = 0;
        for(int j = 0; j < 26; j++)
        {
            if(x[j] != 0 && y[j] != 0) count++;
        }
        ans = max(ans, count);
    }
    cout << ans << endl;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b){return b!=0?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}

int main(){
    ll n,x,y;
    cin>>n>>x>>y;
    x--; y--;
    vector<ll> ans(n);
    queue<pair<ll,ll>> q;
    rep(i,n){
        vector<ll> dist(n,1e9);
        q.push(make_pair(i,0));
        dist[i]=0;
        while(!q.empty()){
            pair<ll,ll> v=q.front();
            q.pop();
            ll f=v.first,s=v.second;
            if(f-1>=0){
                if(dist[f-1]==1e9){
                    q.push(make_pair(f-1,s+1)); 
                    dist[f-1]=s+1;
                }
            }
            if(f+1<n){
                if(dist[f+1]==1e9){
                    q.push(make_pair(f+1,s+1));
                    dist[f+1]=s+1;
                }
            }
            if(f==x){
                if(dist[y]==1e9){
                    q.push(make_pair(y,s+1));
                    dist[y]=s+1;
                }
            }
            if(f==y){
                if(dist[x]==1e9){
                    q.push(make_pair(x,s+1));
                    dist[x]=s+1;
                }
            }
        }
        rep(j,n) ans[dist[j]]++;
    }
    for(ll i=1;i<n;i++) cout<<ans[i]/2<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,n) FOR(i,0,n)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const int INF = 1e9+1;
int dp[100005];
int n;
vector<int> a;
void solve(){
    fill(dp, dp+n, INF);
    dp[0] = a[0];
    FOR(i,1,n){
        int b = upper_bound(dp, dp+n, a[i]) - dp - 1;
        if (dp[b] <= a[i]) dp[b+1] = a[i];
        else dp[b] = a[i];
    }
    cout << lower_bound(dp, dp+n, INF) - dp << endl;
}
int main(){
    cin >> n;
    a.resize(n);
    rep(i,n) cin >> a[n-i-1];
    solve();
}


Measured memory_bytes: 1024
import java.util.Arrays;
import java.util.LinkedList;
import java.util.Scanner;

public class Main {
	private class Move {
		public char alpha;
		public char move;
		public Move(String alpha, String move) {
			this.alpha = alpha.charAt(0);
			this.move = move.charAt(0);
		}
	}
	
	private char getAlpha(String s, int index) {
		if (index < 0 || index >= s.length()) {
			return ' ';
		} else {
			return s.charAt(index);
		}
	}
	
	private int calcDropNum(String s, LinkedList<Move> moves, char left) {
		int pos = -1;
		
		for (Move move : moves) {
			if (move.move == left) {
				char srcAlpha = getAlpha(s, pos+1);
				if (srcAlpha == move.alpha) {
					pos++;
				}
			} else {
				// move right
				char srcAlpha = getAlpha(s, pos-1);
				char nowAlpha = getAlpha(s, pos);
				if (nowAlpha != move.alpha) {
					// do nothing.
				//} else if (srcAlpha == move.alpha) {
				} else {
						pos--;
				}
			}
		}
		
		return pos+1;
	}
	
	public void solve() {
		Scanner in = new Scanner(System.in);
		in.nextInt();
		int Q = in.nextInt();
		String s = in.next();
		
		LinkedList<Move> moves = new LinkedList<Move>();
		for (int i=0; i<Q; i++) {
			moves.addFirst(new Move(in.next(), in.next()));
		}
		in.close();
		
		int dropLeft = calcDropNum(s, moves, 'L');
		
		String invS = (new StringBuffer(s)).reverse().toString();
		int dropRight = calcDropNum(invS, moves, 'R');
		
		int totalDrop = Math.min(s.length(), dropLeft+dropRight);
		
		System.out.println(s.length() - totalDrop);
	}
	
	public void solve2() {
		Scanner in = new Scanner(System.in);
		in.nextInt();
		int Q = in.nextInt();
		String s = in.next();
		int[] nums = new int[s.length()];
		Arrays.fill(nums, 1);
		
		for (int i=0; i<Q; i++) {
			char alpha = in.next().charAt(0);
			char move = in.next().charAt(0);

			if (move == 'L') {
				for (int j=0; j<s.length(); j++) {
					if (s.charAt(j) == alpha) {
						if (j-1 >= 0) {
							nums[j-1] += nums[j];
						}
						nums[j] = 0;
					}
				}
			} else {
				for (int j=s.length()-1; j>=0; j--) {
					if (s.charAt(j) == alpha) {
						if (j+1 <= s.length()-1) {
							nums[j+1] += nums[j];
						}
						nums[j] = 0;
					}
				}
			}
		}
		in.close();

		System.out.println(sum(nums));
	}

	private int sum(int[] nums) {
		int sum = 0;
		for (int i=0; i<nums.length; i++) {
			sum += nums[i];
		}
		return sum;
	}
	
	public static void main(String[] args) {
		Main main = new Main();
		main.solve();
	}
}


Measured memory_bytes: 82376
using System;

namespace _0220
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                double n = double.Parse(Console.ReadLine());
                if (n < 0) break;
                n *= 16;
                if (n % 1 != 0 || n >= 4096)
                {
                    Console.WriteLine("NA");
                }
                else
                {
                    double i = double.Parse(Convert.ToString((int)n, 2));
                    i /= 10000;
                    string s = i.ToString("00000000.0000");
                    s.Insert(8, ".");
                    Console.WriteLine(s);
                }
            }
        }
    }
}

Measured memory_bytes: 9480
#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>
using namespace std;

int main()
{
  int n, v;
  long t = 0;
  int m = 0;
  int x = 1000000000;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> v;
    if (v < 0) {
      v = -v;
      m++;
    }
    t += v;
    x = min(x, v);
  }
  if (m & 0x01) {
    t -= x * 2;
  }
  cout << t << endl;
  return 0;
}

Measured memory_bytes: 256
N,A,B,C,D = map(int,input().split())
s = input()
if ('##' in s[A:C]) or ('##' in s[B:D]):
    print('No')
else:
    if C > D:
        if '...' in s[B-2:D+1]:
            print('Yes')
        else:
            print('No')
    else:
        print('Yes')

Measured memory_bytes: 3572
#  #16586869
n, k = map(int, input().split())
a = [0] + list(map(int, input().split()))
now = 1
check = [-1]*(n+1)
for i in range(k):
  if check[now] == -1:
    check[now] = i
    now = a[now]
  else:
    loop = i - check[now] # check?
    afterloop = (k-(i-loop))%loop
    print(check.index((i-loop)+afterloop))
    exit()
print(now)

Measured memory_bytes: 100152
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int gcd(int x, int y) { return (x % y) ? gcd(y, x % y) : y; }
const double PI = 3.14159265358979323846;
int vector_finder(vector<int> vec, int number) {
  auto itr = find(vec.begin(), vec.end(), number);
  size_t index = distance(vec.begin(), itr);
  if (index != vec.size()) {  // 発見できたとき
    return 1;
  } else {  // 発見できなかったとき
    return 0;
  }
}
unsigned GetDigit(unsigned num) { return log10(num) + 1; }
int main() {
  double d, t, s;
  cin >> d >> t >> s;
  if (d / s <= t) {
    cout << "Yes";
  } else {
    cout << "No";
  }
}

Measured memory_bytes: 3752
n = gets.to_i

@memo = {}
def lucas(n)
    if @memo[n]
        return @memo[n]
    end
    return 2 if n == 0
    return 1 if n == 1
    l = lucas(n - 1) + lucas(n - 2)
    @memo[n] = l
    return l
end

puts lucas(n)

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
 
int main() {
int N;
  cin >>N;
 
  for (int i = 0; i < 1000000; i++) {
 if(i*i>N){
   cout<< (i-1)*(i-1)<<endl;
   break;
 }   
}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N,X,L,a=0,MAX;cin>>N;
  vector<pair<int,int>>S(N);
  for(int i=0;i<N;i++){
    cin>>X>>L;
    S.at(i)=make_pair(X+L,X-L);
  }
  sort(S.begin(),S.end());
  MAX=S.at(0).second;
  for(int i=0;i<N;i++){
    if(MAX<=S.at(i).second){
      a++;
      MAX=S.at(i).first;
    }
  }
  cout<<a<<endl;
}

Measured memory_bytes: 1024
function MainA(input) {
	input = input.split(" ");

	var a = parseInt(input[0]);
	var b = parseInt(input[1]);
	var c = parseInt(input[2]);

  var product = (a - c) * (b - c);
  if(product > 0) console.log('%s',"No");
  else console.log("%s","Yes")
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
MainA(require("fs").readFileSync("/dev/stdin", "utf8"));

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

int main()
{
    int k, s;
    cin >> k >> s;

    int count = 0;
    for (int x=0; x <= k; x++)
    {
        for (int y=0; y <= k; y++)
        {
            int z = s - x - y;
            if (z >= 0 && z <= k)
            {
                count++;
            }
        }
    }
    cout << count << endl;
    
    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>

using namespace std;

#define ll long long
#define ull unsigned long long
const ll MOD = 1000000007;
#define rep(i,n) for (int i = 0; i < (n); ++i)

template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}
template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

int main() {
	int A, B, C;
	cin >> A >> B >> C;

	cout << min(C, B/A) << "\n";

	return 0;
}


Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll MOD = 1000000007;
constexpr ll INF = 1ll<<60;

int main(int argc, char **argv)
{
	ll N, M; cin >> N;
	map<ll, ll> D, T;
	for (ll i = 0; i < N; ++i)
	{
		ll t; cin >> t;
		++D[t];
	}
	cin >> M;
	for (ll i = 0; i < M; ++i)
	{
		ll t; cin >> t;
		++T[t];
	}

	bool ok{true};
	for (auto &p : T)
	{
		if (p.second > D[p.first])
		{
			ok = false;
			break;
		}
	}

	std::cout << (ok ? "YES" : "NO") << std::endl;
}

Measured memory_bytes: 25216
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-11;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
typedef pair<ld, ld> LDP;
typedef unsigned long long ul;
int a[5000], b[5000];
bool used[5000];
int n;
vector<int> u[5000];
void init() {
	rep(i, n) {
		Rep(j, i, n) {
			u[i].push_back(a[j]);
		}
	    sort(u[i].begin(), u[i].end());
	}
}
vector<P> v;
int calc(int id) {
	int c = 0; int le = u[id].size()-1;
	per(i, v.size()) {
		if (used[v[i].second])continue;
		while (le>=0 && u[id][le]>=v[i].first) {
			le--;
		}
		if (le<0)break;
		c++; le--;
	}
	return c;
}

int main() {
	cin >> n;
	rep(i, n) {
		cin >> a[i];
	}
	rep(i, n) {
		cin >> b[i];
		v.push_back({ b[i],i });
	}
	sort(v.begin(), v.end());
	init();
	vector<int> ans;
	rep(i, n) {
		int c = calc(i);
		int b = lower_bound(v.begin(), v.end(), P{ a[i] + 1,-1 }) - v.begin();
		int le = b; int ri = v.size();
		while (ri - le > 1) {
			int mid = (ri + le) >> 1;
			used[v[mid].second] = true;
			int z = calc(i + 1);
			used[v[mid].second] = false;
			if (a[i] < v[mid].first)z++;
			if (z == c) {
				le = mid;
			}
			else {
				ri = mid;
			}
		}
		if (le < v.size()) {
			used[v[le].second] = true;
			int cz = calc(i + 1);
			if (cz + 1 == c) {
				ans.push_back(v[le].first);
				v.erase(v.begin() + le);
				continue;
			}
		    used[v[le].second] = false;
		}
		ri = b; le = 0;
		while (ri - le > 1) {
			int mid = (ri + le) >> 1;
			used[v[mid].second] = true;
			int z = calc(i + 1);
			used[v[mid].second] = false;
			if (a[i] < v[mid].first)z++;
			if (z == c) {
				le = mid;
			}
			else {
				ri = mid;
			}
		}
		used[v[le].second] = true;
		ans.push_back(v[le].first);
		v.erase(v.begin() + le);
	}
	rep(i, n) {
		if (i > 0)cout << " ";
		cout << ans[i];
	}
	cout << endl;
	return 0;
}



Measured memory_bytes: 64620
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;
#define ll long long

vector<pair<ll, int>> findFactor(ll n) {
    vector<pair<ll, int>> v;
    for (ll i = 2; i <= sqrt(n); i++) {
        int cnt = 0;
        while (n % i == 0) {
            cnt++;
            n /= i;
        }
        if (cnt > 0)
            v.emplace_back(i, cnt);
    }
    if (n > 1)
        v.emplace_back(n, 1);
    return v;
}

int main()
{
    ll n;
    cin >> n;
    int cnt = 0;
    for (const auto p : findFactor(n)) {
        // cout << p.first << " " << p.second << endl;
        int i = 1, sum = 1;
        while (sum <= p.second) {
            i++;
            sum += i;
        }
        cnt += i - 1;
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 3732
#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  int n,x,t;
  cin >> n>>x>>t;
  int sum=n/x;
  if(n%x!=0){
    sum++;
  }
  cout<<sum*t<<endl;
  return 0;
}

Measured memory_bytes: 3644
// Problem : C - Replacing Integer
// Contest : AtCoder Beginner Contest 161
// URL : https://atcoder.jp/contests/abc161/tasks/abc161_c
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

//QWsin
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define rep(i,x,y) for(int i=x;i<=y;++i)
#define out(i,u) for(int i=first[u];i!=-1;i=nxt[i])
#define repvc(i,vc) for(int i=0,Sz=vc.size();i<Sz;++i)
using namespace std;
inline int read()
{
	char ch=getchar();int ret=0,f=1;
	while(ch<'0' || ch>'9') {if(ch=='-')f=-1;ch=getchar();}
	for(;ch>='0' && ch<='9';ch=getchar()) ret=ret*10+ch-'0';
	return ret*f;
}

typedef long long ll;
const int INF=1<<30;

int main()
{
	ll n,k;cin>>n>>k;
	cout<<min(n%k,k-n%k)<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

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

using namespace std;
#define int long long
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repr(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)
#define pb push_back

const long long MOD = 1000000007;
//const long long MOD = 998244353;
const long long INF = 1LL << 60;


long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	unsigned r;
	while ((r = a % b)) {
		a = b;
		b = r;
	}
	return b;
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a * g / b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}




const long double PI = 3.14159265359;
const int MAX_N = 100010;



signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int h, w; cin >> h >> w;
	int ans = INF;
	rep(i, 2) {
		rep(j, w - 1) {
			int a = (j + 1)*h;
			int b = ((h + 1) / 2)*(w - j - 1);
			int c = (h / 2)*(w - j - 1);
			chmin(ans, max({ a,b,c }) - min({ a,b,c }));
		}
		swap(h, w);
	}
	chmin(ans, min(((h + 2) / 3)*w-(h/3)*w ,((w+2)/3)*h-(w/3)*h));
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
H, W = map(int, input().split())
S = []
for i in range(H):
  ss = input()
  S.append(ss)
ok = True
for i in range(H):
  for j in range(W):
    if S[i][j] == "#":
      ok2 = False
      if j-1 >= 0 and S[i][j-1] == "#":
        ok2 = True
      if i-1 >= 0 and S[i-1][j] == "#":
        ok2 = True
      if j+1 < W and S[i][j+1] == "#":
        ok2 = True
      if i+1 < H and S[i+1][j] == "#":
        ok2 = True
      if not(ok2):
        ok = False
if ok:
  print("Yes")
else:
  print("No")


Measured memory_bytes: 3064