akhauriyash/Code-Regression huggingface dataset:
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		int N = sc.nextInt();
		double ans = 0;
		for (int i = 0; i < N; i++) {
			double x = sc.nextDouble();
			if (sc.next().equals("JPY")) {
				ans += x;
			} else {
				ans += x * 380000;
			}
		}
		System.out.println(ans);
	}
}

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;

    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        } else {
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }

    private int readByte() {
        if (hasNextByte())
            return buffer[ptr++];
        else
            return -1;
    }

    private static boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }

    public boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(buffer[ptr]))
            ptr++;
        return hasNextByte();
    }

    public String next() {
        if (!hasNext())
            throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    public long nextLong() {
        if (!hasNext())
            throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while (true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if (b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }

    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
            throw new NumberFormatException();
        return (int) nl;
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }
}

Measured memory_bytes: 21332
// Problem : D - Knapsack 1
// Contest : AtCoder - Educational DP Contest
// URL : https://atcoder.jp/contests/dp/tasks/dp_d
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define vll vector<ll>
#define mll map<ll,ll>
#define pb push_back
#define w(t) while(t--)
#define fr(a,n,i) for(ll i=a; i<n; i++ )
#define frn(a,n,i) for(ll i=a; i>=n; i--)
#define fre(a,n,i) for(ll i=a; i<=n; i++)
ll t[101][100001];
int main(){
	ll N,W;
	cin>>N>>W;
	ll wv[101][3];
	for(ll i=0;i<N+1;i++){
		for(ll j=0;j<3;j++){
			if(i==0 || j==0)
			wv[i][j]=0;
			else
			cin>>wv[i][j];
		}
	}
/*fr(0,N+1,i){
		fr(0,3,j){
			cout<<wv[i][j]<<" ";
		}
		cout<<endl;
	}*/
	fr(0,N+1,i){
		fr(0,W+1,j){
			if(i==0 || j==0)
			t[i][j]=0;
		}
	}
	for(ll i=1;i<N+1;i++){
	//	cout<<"yo";
		for(ll j=1;j<W+1;j++){
		//	cout<<"yo";
			if(wv[i][1]<=j){//include/dont include
				t[i][j]=max(wv[i][2]+t[i-1][j-wv[i][1]],t[i-1][j]);
			}
            else{//dont include
				t[i][j]=t[i-1][j];
			}
		}
	}
	/*fr(0,N+1,i){
		fr(0,W+1,j){
			cout<<t[i][j]<<" ";
		}
		cout<<endl;
	}*/
	
	cout<<t[N][W];
	return 0;
}

Measured memory_bytes: 82360
""" AtCoder """

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

for i in range(N - M + 1):
    for j in range(N - M + 1):
        count = 0
        for jj in range(M):
            if A[i + jj][j:j + M] != B[jj]:
                break
            count += 1
        if count == M:
            print("Yes")
            exit()

print("No")


Measured memory_bytes: 3060
//
//  lib.cpp
//

#include <algorithm>
#include <array>
#include <assert.h>
#include <iostream>
#include <limits>
#include <math.h>
#include <memory>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

using ll = long long;
using ull = unsigned long long;

function<void()> createFunc() {
	int x = 1;
	return [&x](){cout << x << endl;};
}

int main() {
	int N;
	cin >> N;
	vector<ll> ais;
	for (int i = 0; i < N; i++) {
		ll ai;
		scanf("%lld", &ai);
		ais.push_back(ai);
	}
	vector<ll> dp, dp_neg;
	dp.resize(N);
	dp[N-1]=ais[N-1];
	dp_neg.resize(N);
	dp_neg[N-1]=-ais[N-1];
	for (int i = 1; i < N; i++) {
		dp[N-1-i] = max(ais[N-1-i]+dp[N-i], -ais[N-i-1]+dp_neg[N-i]);
		dp_neg[N-1-i] = max(-ais[N-1-i]+dp[N-i], ais[N-i-1]+dp_neg[N-i]);
	}
	cout << dp[0] << endl;
}


Measured memory_bytes: 2804
#ifndef _WIN32
#include<iostream>
#endif 
#include<cmath>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<string>
#include<map>
using namespace std;
typedef long long LL;
#define FOR(i,bg,ed) for(int i=(bg);i<(ed);i++)
#define REP(i,n) FOR(i,0,n)
template<typename T> bool chmin(T &l, T r) {
	bool res = l > r;
	if (res) {
		l = r;
	}
	return res;
}
/*
template<typename T>
istream& oprator>> (istream &is, vector<T>& v) {
	for (auto &it : v)is >> it;
	return is;
}*/

struct cww {
	cww() {
		cout << fixed;
		cout << setprecision(10);
	}
}star;

vector<LL> r, c;
int main() {
	int R, C;
	while (cin >> R >> C, R) {
		r.assign(R+1, 0);
		c.assign(C+1, 0);
		//cin >> r >> c;
		REP(i, R)cin >> r[i+1];
		REP(i, C)cin >> c[i+1];
		FOR(i, 1, R+1) {
			r[i] += r[i - 1];
		}
		FOR(i, 1, C+1) {
			c[i] += c[i - 1];
		}

		map<LL, LL> cnt;
		REP(x, R)FOR(y, x + 1, R+1) {
			LL len = r[y] - r[x];
			cnt[len]++;
		}
		LL res = 0;
		REP(x, C)FOR(y, x + 1, C+1) {
			LL len = c[y] - c[x];
			if(cnt.count(len))res+=cnt[len];
		}
		cout << res << endl;
	}

	return 0;
}

Measured memory_bytes: 20992
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {

    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;

    void solve() throws IOException {
        int n = ni();
        int[] a = new int[n];
        int[] b = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = ni();
            b[i] = ni();
        }

        int[] cnt = new int[86400];
        int time = 0;
        cnt[time]++;
        for (int i = 0; i < n - 1; i++) {
            time = (time + b[i] + a[i + 1]) % 86400;
            cnt[time]++;
        }

        int sum = 0;
        for (int i = 0; i <= 10800; i++) {
            sum += cnt[i];
        }

        int ans = sum;
        for (int i = 0; i < 86400; i++) {
            sum += cnt[(i + 10801 + 86400) % 86400];
            sum -= cnt[i];
            ans = Math.max(ans, sum);
        }

        out.println(ans);
    }

    String ns() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine(), " ");
        }
        return tok.nextToken();
    }

    int ni() throws IOException {
        return Integer.parseInt(ns());
    }

    long nl() throws IOException {
        return Long.parseLong(ns());
    }

    double nd() throws IOException {
        return Double.parseDouble(ns());
    }

    String[] nsa(int n) throws IOException {
        String[] res = new String[n];
        for (int i = 0; i < n; i++) {
            res[i] = ns();
        }
        return res;
    }

    int[] nia(int n) throws IOException {
        int[] res = new int[n];
        for (int i = 0; i < n; i++) {
            res[i] = ni();
        }
        return res;
    }

    long[] nla(int n) throws IOException {
        long[] res = new long[n];
        for (int i = 0; i < n; i++) {
            res[i] = nl();
        }
        return res;
    }

    public static void main(String[] args) throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        tok = new StringTokenizer("");
        Main main = new Main();
        main.solve();
        out.close();
    }
}

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

int main() {
 int n,cnt=0,ans=0;
 bool ok=true;
 cin >> n;
 vector<int> a(n);
  for(int i=0;i<n;i++){
   cin >> a[i];
  }
while(ok){
  for(int i=0;i<n;i++){
    if(a[i]%2==0){
     a[i]=a[i]/2;
     ans++;
      }
     else{
     a[i]=a[i]*3;
     cnt++;
      }
    }
    if(cnt==n){
      ok=false;
    }
    else{
      cnt=0;
    }
  }
  cout << ans << endl;
 }


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

public class Main{
    public static void main(String[] args)throws Exception{
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt(),k=sc.nextInt();
        int[] ary=new int[n];
        int max=0,memo=0;
        for(int i=0;i<n;i++){
            ary[i]=sc.nextInt();
            if(i<k){
                max+=ary[i];
            }
        }
        int tmp=max;
        for(int i=0;i<n-k;i++){
            tmp=tmp-ary[i]+ary[i+k];
            if(max<tmp){
                max=tmp;
                memo=i+1;
            }
        }
        double ans=0;
        for(int i=0;i<k;i++){
            ans+=(((double)ary[memo+i]*(1+ary[memo+i])/2)/ary[memo+i]);
        }
        System.out.printf("%.12f\n",ans);
    }
}

Measured memory_bytes: 85632
#include <iostream>
#include <fstream>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

#define INF 1e8
#define EPS 1e-9

#define rep2(i,m,n) for(int i=m;i<n;i++)
#define rep(i,n) rep2(i,0,n)
#define ll long long
#define P pair<int,int>
#define pb push_back

int N,l,used[10];
vector<P> v;

int pow10(int n){
	if(n)return pow10(n-1)*10;
	return 1;
}

bool islarger(P a,P b){
	return abs(a.first)>abs(b.first);
}

int f(int n,int s){
	if(n==l)return s?0:1;
	int res=0;
	rep(i,10)if(!used[i]&&(i||!v[n].second)){
		int x=s+v[n].first*i;
		if(x>0){
			rep2(j,n+1,l)if(v[j].first<0)x+=v[j].first*9;
			if(x>0)continue;
		}
		else if(x<0){
			rep2(j,n+1,l)if(v[j].first>0)x+=v[j].first*9;
			if(x<0)continue;
		}
		used[i]=1;
		res+=f(n+1,s+v[n].first*i);
		used[i]=0;
	}
	return res;
}

int main(){
	while(cin>>N&&N){
		map<char,int> M;
		map<char,int>::iterator it;
		set<char> S;
		rep(i,N){
			string s;
			cin>>s;
			int l=s.size();
			if(l>1)S.insert(s[0]);
			rep(j,l)M[s[j]]+=pow10(l-1-j)*(i<N-1?1:-1);
		}
		v.clear();
		for(it=M.begin();it!=M.end();it++){
			v.pb(P((*it).second,S.count((*it).first)?1:0));
		}
		sort(v.begin(),v.end(),islarger);
		l=v.size();
		fill(used,used+10,0);
		cout<<f(0,0)<<endl;
	}
}

Measured memory_bytes: 0
import math
N,M = map(int,input().split())
S = input()
T = input()
L = N * M // math.gcd(N,M)
NN = L // N
MM = L // M

for i in range(10**6):
    if MM*i > len(S)-1 or NN*i > len(T)-1:
        break
    if S[i*MM] != T[i*NN]:
        print(-1)
        exit()
print(L)

Measured memory_bytes: 9208
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <map>
#include <utility>

#define reps(i,s,n) for(int (i) = (s); (i) < (n); (i)++)
#define rep(i,n) reps(i,0,n)
using namespace std;
using ll = long long;
using pii = pair<int,int>;

bool comp(const pii &a, const pii &b){
    if(a.second > b.second )return true;
    return false;
}

int main(){
    int n;
    cin >> n;
    int tmp;
    map<int,int> odd,even;
    vector<pii> odd_,even_;

    rep(i,n){ 
        cin >> tmp;
        if(i % 2 == 0) odd[tmp]++;
        else even[tmp]++;
    }

    for(auto &e : odd){
        odd_.push_back({e.first,e.second});
    }
    odd_.push_back({0,0});
    for(auto &e : even){
        even_.push_back({e.first,e.second});
    }
    even_.push_back({0,0});

    sort(odd_.begin(),odd_.end(),comp);
    sort(even_.begin(),even_.end(),comp);

    // for(auto &e:odd_){
    //     cout << e.first << " " << e.second << endl;
    // }

    int ans=1e9;

    rep(i,2){
        rep(j,2){
            if(even_[i].first != odd_[j].first){
                ans = min(ans,n-(even_[i].second+odd_[j].second));
            }
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 6136
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
 
#define FOR(i,k,n) for (int (i)=(k); (i)<(n); ++(i))
#define rep(i,n) FOR(i,0,n)
#define all(v) begin(v), end(v)
#define debug(x) cerr<< #x <<": "<<x<<endl
#define debug2(x,y) cerr<< #x <<": "<< x <<", "<< #y <<": "<< y <<endl
 
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<ll> vll;
typedef vector<vector<ll> > vvll;
typedef deque<bool> db;
template<class T> using vv=vector<vector< T > >;

// cout vector
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size(); s << "\n";
  for (int i = 0; i < len; ++i) {
    s << v[i]; if (i < len - 1) s << "\t";
  }
  s << "\n"; return s;
}

// cout 2-dimentional vector
template<typename T> ostream& operator<<(ostream& s, const vector< vector<T> >& vv) {
  int len = vv.size();
  for (int i = 0; i < len; ++i) { s << vv[i]; }
  return s;
}

struct Node {
  int color;
  int weight;
  vi acc;
  Node() {
    color = 0;
    weight = 0;
    acc = vi(2, 0);
  }
};

int INF = INT_MAX / 2;
vi X;

vi par;
vvi child;

vvi acc;

bool possible(int u) {
  if (child[u].size() == 0) {
    acc[u][0] = X[u];
    return true;
  }

  int all_sum = 0;
  map<int, bool> mp;
  mp[0] = true;

  for (int v : child[u]) {
    possible(v);
    all_sum += acc[v][0];
    all_sum += acc[v][1];
    map<int, bool> mp_;
    for (auto elm : mp) {
      if (elm.first > X[u]) { break; }
      mp_[elm.first + acc[v][0]] = true;
      mp_[elm.first + acc[v][1]] = true;
    }
    swap(mp, mp_);
  }

  auto itr = mp.upper_bound(X[u]);
  if (itr == begin(mp)) {
    printf("IMPOSSIBLE\n");
    exit(0);
  }

  itr --;
  acc[u][0] = all_sum - (*itr).first;
  acc[u][1] = X[u];

  return true;
}

int main() {
  int n;
  scanf("%d", &n);
  par.assign(n, -1);
  child.resize(n);
  FOR (i, 1, n) {
    int p;
    scanf("%d", &p);
    p -= 1;
    par[i] = p;
    child[p].push_back(i);
  }

  X.resize(n);
  rep (i, n) {
    scanf("%d", &X[i]);
  }

  acc.assign(n, vi(2, 0));

  possible(0);
  printf("POSSIBLE\n");

  return 0;
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
int main () {
    int N;
    cin >> N;
    int S = 0;
    vector<int> a(N);
    for (int i = 0; i < N; i++) {
        cin >> a[i];
        S += a[i];
    }
    int k = INT_MAX;
    for (int i = 0; i < N; i++) {
        k = min(k, abs(S-a[i]*N));
    }
    for (int i = 0; i < N; i++) {
        if (abs(S-a[i]*N) == k) {
            cout << i << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <queue>
#include <stack>

using namespace std;

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

const ll mod = 1000000007;

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

  int n, r;
  cin >> n >> r;

  int ans = 0;
  if (n >= 10) ans = r;
  else ans = r + (100 * (10 - n));

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
def main():
    from bisect import bisect_left as bl
    from itertools import accumulate as ac

    n, m = map(int, input().split())
    a = sorted(list(map(int, input().split())))
    aa = [0]+list(ac(a))
    an = aa[n]

    ok = 0
    ng = 10**10
    while abs(ok-ng) > 1:
        mid = (ok+ng)//2
        q = 0
        for i in range(n):
            q += n-bl(a, mid-a[i])
        if q >= m:
            ok = mid
        else:
            ng = mid

    b = ok
    c = -m
    for i in range(n):
        c += n-bl(a, b-a[i])
    ans = -c*b
    for i in range(n):
        d = bl(a, b-a[i])
        ans += an-aa[d]+(n-d)*a[i]
    print(ans)


main()

Measured memory_bytes: 59872
Public Class Main  
  Public Shared Sub Main(ByVal args() As String)
        
    Dim tmp As String
    tmp = Console.ReadLine()
'    Console.writeLine(tmp)
    
    Dim a As Integer = tmp.Length()
'    Console.writeLine(a)
        
    Dim i As Integer
    Dim ans As String
    For i = 1 To a
    ans = ans & "x"
  Next i
  Console.writeLine(ans)
  
  End Sub
End Class


Measured memory_bytes: 13140
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
#include <stdio.h>
#include <ctype.h>
#include <random>
#include <string.h>
#include <cmath>
#include <unordered_map>
#include <cstdio>
using namespace std;
#define pie 3.141592653589793238462643383279
#define mod 998244353
#define int long long
#define P pair<int,int>
#define all(vec) vec.begin(),vec.end()

int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}

int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}

int n, m, q, a[100010], b[100010], c[100010];
vector<int> vec[100010];
int d[100010][15];

void dfs(int v, int k, int x) {
	if (k < 0 || d[v][k])return;
	d[v][k] = x;
	for (int i = 0; i < (int)vec[v].size(); i++) dfs(vec[v][i], k - 1, x);
}

signed main() {
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		int a, b; cin >> a >> b;
		vec[a].push_back(b);
		vec[b].push_back(a);
	}
	cin >> q;
	for (int i = 1; i <= q; i++) cin >> a[i] >> b[i] >> c[i];
	for (int i = q; i >= 1; i--)dfs(a[i], b[i], i);
	for (int i = 1; i <= n; i++) {
		int ans = 0;
		for (int j = 0; j <= 10; j++)ans = max(ans, d[i][j]);
		cout << c[ans] << endl;
	}
}

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


/* 
*    coder :: ATUL_PANDEY_2608
*        >>> INDIA <<<
*/
using namespace std;
using namespace __gnu_pbds;

// #define  part ..
#define pb(a) push_back(a)
#define all(a) a.begin(),a.end() 
#define mod 1000000007
//#define maxx 200006
#define ll long long 
#define quick    ios_base::sync_with_stdio(NULL),cin.tie(0);
#define listll vector< long long > 
#define listi vector< int> 
#define pii   pair<int , int> 
#define pll pair<long long , long long > 
#define minheap priority_queue<long long , vector< long long >, greater<long long > >
#define rep(i,a,b) for(int i=a;i<b;i++)
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}


template < class T > using oset = tree< T , null_type, less  < T  > , rb_tree_tag , tree_order_statistics_node_update > ;


// end of #define 

// define globals ...
const int maxx = 2e5+26;

//write function from here ...







int Main(){


int arr[3][3];

map < ll , pii > mp;
for( int  i =0 ;  i <3;i++)
for(int j  =0 ; j <3;j++)
{
	
	cin>>arr[i][j];
	mp[arr[i][j]] = {i,j};
	
	
}

int vis [3][3];
memset(vis , 0  , sizeof(vis));



int n;
cin>>n;
for(int i  =0 ; i <n ;i++){
	
  ll a;
  cin>>a;
  if(mp.count(a)){
	  vis[mp[a].first][mp[a].second]=1;
	  
	  }
	  
}
  
  
  for(int i=0 ; i < 3;i++){
	  
	  if( vis[i][0] && vis[i][1] &&vis[i][2]){
		  
		  cout<<"Yes\n";
		  return  0 ;
	  }
  }
  
  for(int i =0 ; i  <3;i++)
  if(vis[0][i] &&vis[1][i] && vis[2][i])
  {
	  cout<<"Yes\n";
	  return 0 ;
  }
  
  int j =2;
  int cnt = 0 , nt =0 ;
  for( int i= 0 ; i <3;i++){
	  if(vis[i][i])
	  cnt++;
	  
	  if(vis[i][j])
	  nt++;
	  
	  j--;
	  
  }

 if(cnt == 3 || nt == 3)
 {
	 cout<<"Yes\n";
	 
	 return 0 ;
 }
 
 cout<<"No\n";
 


return 0;

}






int main(){
 quick;
int t =1; 
//cin>>t;
while(t-- )
 Main();

 return 0;


}


Measured memory_bytes: 3668
#include<bits/stdc++.h>
using namespace std;
int main(){
  long long n,k,a,b,i;cin >> n >> k;long long c[100001] = {};
  while(cin >> a >> b) c[a-1] += b;
  for(i=0;i<=100000;i++){
    k -= c[i];
    if(k <= 0){
      cout << i+1 << endl;return 0;
    }
  }
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
const int Max_N=1e5;
int N,K,Num=0,lin[Max_N+10]={},Val[Max_N+10]={};
struct Pnt{
	int P,V;
} A[Max_N+10]={};
struct kk{
	int Id,Next;
} e[Max_N*2+10]={};
inline void insert(int x,int y){
	e[++Num].Next=lin[x]; lin[x]=Num; e[Num].Id=y;
}
inline bool mycmp(Pnt x,Pnt y){
	return x.V<y.V;
}
int main(){
	scanf("%d",&N);
	for(int i=1;i<N;i++){
		int x,y; scanf("%d%d",&x,&y);
		insert(x,y); insert(y,x);
	}
	scanf("%d",&K);
	priority_queue< pair<int,int> > Q;
	for(int i=1;i<=K;i++){
		scanf("%d%d",&A[i].P,&A[i].V);
		Val[A[i].P]=A[i].V+1;
		Q.push(make_pair(-A[i].V,A[i].P));
	}
	for(;Q.size();){
        int x=Q.top().second; Q.pop();
		for(int i=lin[x];i;i=e[i].Next){
			if(Val[e[i].Id]) continue;
			Val[e[i].Id]=Val[x]+1;
			Q.push(make_pair(-Val[e[i].Id],e[i].Id));
		}
	}
	for(int x=1;x<=N;x++){
		for(int i=lin[x];i;i=e[i].Next)
		 if(abs(Val[x]-Val[e[i].Id])!=1) {
		 	puts("No");
		 	return 0;
		 }
	} 
	puts("Yes");
	for(int i=1;i<=N;i++) printf("%d\n",Val[i]-1);
	return 0;
} 

Measured memory_bytes: 4980
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const long long MOD = 1e9+7, MAX = 1e18, larg = 1e5, INF = -1e9;
long long A,B,C,D,E,F,G,H,I,J,K,L,N,M,O,P,Q,R,S,T,U,V,W,X,Y,Z;
long long max_value = INF, max_index = -1;
long long min_value = MAX, min_index = -1;

typedef long long ll;
typedef pair<ll, ll> Pa;

int main() {
    cin >> A >> B >> C;
    if(A+B+C<=21) cout << "win";
    else cout << "bust";                                                                                          
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n; cin >> n;
    int r = 0,w = 0,r2 = 0;
    string s; cin >> s;
    for(int i=0;i<n;i++){
        if(s[i] == 'R')r++;
    }
    for(int i=0;i<r;i++){
        if(s[i] == 'W')w++;
        else r2++;
    }
    cout << max(w,r-r2) << endl;
}

Measured memory_bytes: 3720
S1 = list(map(int,input().split()))
S2 = list(map(int,input().split()))
S3 = list(map(int,input().split()))
List = []
if S3[2]-S3[1] == S2[2]-S2[1] == S1[2]-S1[1]:
        List.append(1)
if S3[1]-S3[0] == S2[1]-S2[0] == S1[1]-S1[0]:
        List.append(1)
if S2[0]-S1[0] == S2[1]-S1[1] == S2[2]-S1[2]:
        List.append(1)
if S2[0]-S3[0] == S2[1]-S3[1] == S2[2]-S3[2]:
        List.append(1)
print("Yes" if sum(List)==4 else "No")


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define ll long long
ll n, k;
struct Matrix {
    ll mat[50][50];
    void clear() { memset(mat, 0, sizeof(mat)); }
    void reset(int n) {
        clear();
        for (int i = 0; i < n; i++) mat[i][i] = 1;
    }
} a;
Matrix MatrixMul(Matrix x, Matrix y) {
    Matrix a;
    a.clear();
    for (int i = 0; i < n; i++)
        for (int k = 0; k < n; k++)
            for (int j = 0; j < n; j++)
                a.mat[i][j] = (a.mat[i][j] + x.mat[i][k] * y.mat[k][j]) % mod;
    return a;
}
ll MatrixQpow(Matrix a, ll P) {
    Matrix s;
    s.reset(n);
    while (P) {
        if (P & 1) s = MatrixMul(s, a);
        a = MatrixMul(a, a), P >>= 1;
    }
    ll sum = 0;
    for (int i = 0; i < n; i++)
        for (int j = 0; j < n; j++) sum = (sum + s.mat[i][j]) % mod;
    return sum;
}
int main() {
    scanf("%lld%lld", &n, &k);
    for (int i = 0; i < n; i++)
        for (int j = 0; j < n; j++) scanf("%lld", &a.mat[i][j]);
    printf("%lld\n", MatrixQpow(a, k));
    return 0;
}

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

int main()
{
  int n;
  cin >> n;
  string s = " Eve";
  cout << "Christmas";
  for (int i = 0; i < 25 - n; ++i)
  {
    cout << s;
  }
  cout << 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()
{
  ll n;
  cin>>n;
  vector<ll> a(n+1);
  for(auto&& e: a) 
  {
    cin>>e;
  }

  vector<ll> nodes(n+1);
  nodes.back()=a.back();
  for (int i = n-1; i >= 0; --i)
  {
    nodes[i]=nodes[i+1]+a[i];
  }

  vector<ll> ans=nodes;
  ans[0]=1;
  for (int i = 1; i < nodes.size(); ++i)
  {
    if (ans[i-1]-a[i-1]<0) {
      cout<<-1<<endl;
      return 0;
    }
    ans[i]=min(nodes[i],2*(ans[i-1]-a[i-1]));
  }
  if (ans.back()!=a.back()) cout<<-1<<endl;
  else cout<<accumulate(ans.begin(), ans.end(),0LL)<<endl;
}

Measured memory_bytes: 5556
//By TheOneYouWant
#pragma GCC optimize ("-O2")
#include <bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define memreset(a) memset(a,0,sizeof(a))
#define testcase(t) int t;cin>>t;while(t--)
#define forstl(i,v) for(auto &i: v)
#define forn(i,e) for(int i=0;i<e;++i)
#define forsn(i,s,e) for(int i=s;i<e;++i)
#define rforn(i,s) for(int i=s;i>=0;--i)
#define rforsn(i,s,e) for(int i=s;i>=e;--i)
#define bitcount(a) __builtin_popcount(a) // set bits (add ll)
#define ln '\n'
#define getcurrtime() cerr<<"Time = "<<((double)clock()/CLOCKS_PER_SEC)<<endl
#define dbgarr(v,s,e) cerr<<#v<<" = "; forsn(i,s,e) cerr<<v[i]<<", "; cerr<<endl
#define inputfile freopen("input.txt", "r", stdin)
#define outputfile freopen("output.txt", "w", stdout)
#define dbg(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); \
stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) { cerr<<endl; }
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << "\t"; err(++it, args...);
}
template<typename T1,typename T2>
ostream& operator <<(ostream& c,pair<T1,T2> &v){
	c<<"("<<v.fi<<","<<v.se<<")"; return c;
}
template <template <class...> class TT, class ...T>
ostream& operator<<(ostream& out,TT<T...>& c){
    out<<"{ ";
    forstl(x,c) out<<x<<" ";
    out<<"}"; return out;
}
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll,ll> p64;
typedef pair<int,int> p32;
typedef pair<int,p32> p96;
typedef vector<ll> v64;
typedef vector<int> v32; 
typedef vector<v32> vv32;
typedef vector<v64> vv64;
typedef vector<p32> vp32;
typedef vector<p64> vp64;
typedef vector<vp32> vvp32;
typedef map<int,int> m32;
const int LIM=2e5+5,MOD=1e9+7;
const ld EPS = 1e-9;

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

ll dp[4005][4005];
const ll SHIFT = 2002;
const ll MAXN = 4005;

ll fastpow (ll a, ll p){
	if(p == 0) return 1;
	ll z = fastpow(a,p/2);
	z = (z*z)%MOD;
	if(p%2) z = (a*z)%MOD;
	return z;
}

int main(){
	fastio;

	int n; cin>>n;
	vp32 v;

	forn(i,n){
		int a,b;
		cin>>a>>b;
		v.pb(mp(a,b));
		dp[SHIFT-a][SHIFT-b]++;
	}

	forn(i,MAXN-1){
		forn(j,MAXN-1){
			dp[i][j] %= MOD;
			dp[i+1][j] += dp[i][j];
			dp[i][j+1] += dp[i][j];
		}
	}

	ll ans = 0;
	forn(i,n){
		ans += dp[SHIFT+v[i].fi][SHIFT+v[i].se];
		ans %= MOD;
	}

	ll fact[LIM] = {0};
	ll invfact[LIM] = {0};

	fact[0] = 1;
	forsn(i,1,LIM) fact[i] = (fact[i-1]*i)%MOD;
	
	invfact[LIM-1] = fastpow(fact[LIM-1], MOD-2);
	rforn(i,LIM-2) invfact[i] = (invfact[i+1]*(i+1))%MOD;

	ll totsub = 0;
	forn(i,n){
		ll a = v[i].fi, b = v[i].se;
		ll sub = fact[2*a+2*b];
		sub = (sub * invfact[2*a])%MOD;
		sub = (sub * invfact[2*b])%MOD;
		totsub = (totsub+sub)%MOD;
	}

	ans -= totsub;
	ans %= MOD;
	if(ans < 0) ans += MOD;

	ans = (ans * invfact[2]) % MOD;
	cout<<ans<<ln;


	return 0;
}

Measured memory_bytes: 133428
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        long h = sc.nextLong();
        int n = sc.nextInt();
        int[] a = new int[n];
        for(int i = 0 ; i < n ; i++ ){
            a[i] = sc.nextInt();
            h -= a[i];
        }
        if(h <= 0){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
        sc.close();
    }
}

Measured memory_bytes: 59592
// D - Prediction and Restriction
#include <bits/stdc++.h>
using namespace std;

int main(){
	int ans=0,N,K,R,S,P; string T;
	cin>>N>>K>>R>>S>>P>>T;
	for(int i=0; i<N; ++i)
		if(i >= K && T[i-K] == T[i]) T[i] = '-';
		else ans += T[i]=='r'?P:T[i]=='s'?R:S;
	cout<< ans <<endl;
}

Measured memory_bytes: 512
package main

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

func binarySearch(target int, elems []int) bool {
	low := 0
	high := len(elems) - 1
	mid := (high + low) / 2
	for low <= high {
		midElem := elems[mid]
		if midElem == target {
			return true
		} else if midElem < target {
			low = mid + 1
			mid = (high + low) / 2
		} else {
			high = mid - 1
			mid = (high + low) / 2
		}
	}
	return false
}

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	n, _ := nextInt(sc)
	elems := make([]int, n)
	for i := 0; i < n; i++ {
		x, _ := nextInt(sc)
		elems[i] = x
	}
	q, _ := nextInt(sc)
	targets := make([]int, q)
	for i := 0; i < q; i++ {
		x, _ := nextInt(sc)
		targets[i] = x
	}

	count := 0
	for _, v := range targets {
		if binarySearch(v, elems) {
			count++
		}
	}
	fmt.Println(count)
}

func nextInt(sc *bufio.Scanner) (int, error) {
	sc.Scan()
	return strconv.Atoi(sc.Text())
}



Measured memory_bytes: 3076
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <bitset>
#include <queue>
using namespace std;
using ll = long long int;
using P = pair<int, int>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
const ll INF = 1LL << 60;
ll mod = 1000000007;

int main() {
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    sort(a.begin(),a.end());
    int sum = 0;
    rep(i,k) sum += a[i];
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 3612
#include <iostream>
#include <iomanip>
#include <cmath>

int main() {
    
    double PI = 3.14159265358979323846;    
    
    double radius = 0;
    std::cin >> radius;
    
    double area = PI * std::pow(radius, 2.0);
    double circumfrence = 2.0 * PI * radius;
    
    std::cout << std::fixed << std::setprecision(6) << area << " " << std::fixed << std::setprecision(6) << circumfrence << std::endl;
    
    return 0;
    
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)
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 ll MOD = 1e9+7;

ll DPX[20];
ll DPY[20];

int keta(ll n){
    int ret = 0;
    while(n > 0){
        ret += 1;
        n /= 10;
    }
    return ret;
}

int main(){
    ll N;
    cin >> N;

    int K = keta(N);

    DPX[0] = 0;
    DPY[0] = -100000;

    for(int i = 0; i < K; i++){
        int t = K-1-i;
        ll n = (N / (ll)pow(10, t));
        //ll n = N;
        //for(int m = 0; m < t; m++)
        //    n /= 10;

        //cout << (ll)pow(10, 17) << endl;
        n %= 10;

        DPX[i+1] = DPX[i] + n;
        if(n == 0) {
            DPY[i+1] = DPY[i] + 9;
        }
        else{
            DPY[i+1] = max(DPY[i] + 9, DPX[i] + n-1);
        }
    }

    ll ans;
    ans = max(DPX[K], DPY[K]);

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 512
def main():
    H,W = map(int,input().split())
    S = [[1 if s == "." else 0 for s in input()] for _ in range(H)]

    if H == 1:
        for w in range(1,W):
            if S[0][w] and S[0][w - 1]:
                S[0][w] += S[0][w - 1]
        print(max(S[0]))
        return
    if W == 1:
        ans = 0
        for h in range(1,H):
            if S[h][0] and S[h-1][0]:
                S[h][0] += S[h - 1][0]
                ans = max(ans,S[h][0])
        print(ans)
        return


    R = [[0]*W for _ in range(H)]
    L = [[0]*W for _ in range(H)]
    D = [[0]*W for _ in range(H)]
    U = [[0]*W for _ in range(H)]

    for h in range(H):
        for w in range(1,W - 1):
            if S[h][w] and S[h][w - 1]:
                L[h][w] += L[h][w - 1] + 1
            if S[h][W - w] and S[h][W - w - 1]:
                R[h][W - w - 1] += R[h][W - w] + 1
        if S[h][W -1] and S[h][W - 2]:
            L[h][W - 1] += L[h][W - 2] + 1
        if S[h][0] and S[h][1]:
            R[h][0] += R[h][1] + 1
    for w in range(W):
        for h in range(1,H-1):
            if S[h-1][w] and S[h][w]:
                U[h][w] += U[h-1][w] + 1
            if S[H - h][w] and S[H - h - 1][w]:
                D[H - h - 1][w] += D[H - h][w] + 1
        if S[H - 1][w] and S[H - 2][w]:
            D[H - 1][w] += D[H-2][w] + 1
        if S[0][w] and S[1][w]:
            U[0][w] += U[1][w] + 1
    ans = 0
    for h in range(H):
        for w in range(W):
            ans = max(ans,U[h][w] + D[h][w] + R[h][w] + L[h][w])
    print(ans + 1)
    return 

if __name__ == "__main__":
    main()

Measured memory_bytes: 198792
use std::io::prelude::*;

fn input<T: std::str::FromStr>() -> T {
    let stdin = std::io::stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}

fn main() {
    let n: usize = input();
    let w: Vec<i32> = (0..n).map(|_| input()).collect();

    let mut s = 0;
    let mut s1 = vec![0; n + 1];
    for i in 0..n {
        s += w[i];
        s1[i + 1] = s1[i] + w[i];
    }

    let mut ans = i32::max_value();
    for i in 0..n {
        let sl = s1[i + 1];
        let sr = s - sl;
        ans = std::cmp::min(ans, i32::abs(sl - sr));
    }

    println!("{}", ans);
}


Measured memory_bytes: 4352
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

X = int(input())

def is_prime(n):
    rn = int(n**0.5) + 1 
    for i in range(2, rn):
        if n % i == 0:
            return False
    return n != 1

while 1:
    if is_prime(X) == False:
        X = X+1
        continue
    else:
        print(X)
        break


Measured memory_bytes: 3060
n,m,f[2000];main(p){for(;scanf("%d%d",&n,&m),n;printf("%d\n",1+*f)){for(p=n;p--;)f[p]=p;for(p=0;n>1;memmove(f+p,f+p+1,4000))p=(p+m-1)%n--;}exit(0);}

Measured memory_bytes: 0
#include<iostream>
#include <algorithm>
#include<string>
#include <bitset>
#include <vector>
#include <functional>
#include <climits>
#include <iomanip>
#include <utility>
#include <stack>
#include <queue>
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <numeric>
#include <stack>
#include <map> // pair
typedef std::stack<int> IntStack;
typedef std::stack<char> charStack;

using namespace std;
//using ll = long long;
using ll = unsigned long long;
typedef pair <ll, ll > pll;

int main()
{
	ll a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0, ans = 0;
	ll n, m, K;
	ll memo[1003][1003] = { {} };
	ll memox[1003] = {};
	ll memoy[1003] = {};
	ll x[1000006] = {};
	ll y[100005] = {};
	ll z[100005] = {};
	string s;

	//IntStack yStack;
	//charStack Stack;

	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> x[i];
		if (x[i]%4==0)
		{
			a++;
		}
		else if (x[i]%2==0)
		{
			b++;
		}
		else
		{
			c++;
		}
	}
	if (n%2==1)
	{
		a++;
	}
	if (b%2!=0)
	{
		c++;
	}
	if (a>=c)
	{
		cout << "Yes" << endl;

	}
	else
	{
		cout << "No" << endl;

	}
	//cout << a << endl;


	////std::cout << std::fixed;
	//cout << std::setprecision(20) << << endl;
	//cout << d+1 << endl;
	//cout << "" << endl;

	return 0;
}
//char型の文字数字は、-'0'で数値に変換できる
//accumulate(x, x + a, 0);//int型までの配列の合計
//memcpy(x, visited, sizeof(ll)*n);
//void kansuu(ll num, ll visited[10]) {}
//kansuu(1, zz);
//cout << setprecision(15) << v << endl;
//cout << char(z - 'a');
//log10(i) + 1 //10進数の桁数を取得

//int temp;
//for (int i = 0; i < n - 1; i++) {
//	for (int j = n - 1; j > i; j--) {
//		if (w[j - 1] < w[j]) {  /* 前の要素の方が大きかったら */
//			temp = w[j];        /* 交換する */
//			w[j] = w[j - 1];
//			w[j - 1] = temp;
//		}
//	}
//}

//最小公倍数
//ll x = a * b;
//ll tmp;
///* 自然数 a > b を確認・入替 */
//if (a<b) {
//	tmp = a;
//	a = b;
//	b = tmp;
//}
///* ユークリッドの互除法 */
//ll r = a % b;
//while (r != 0) {
//	a = b;
//	b = r;
//	r = a % b;
//}
//a = x / b;//答え

Measured memory_bytes: 8064
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
using st=string;
using ch=char;
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vP;
typedef vector<ch> vc;
typedef vector<vc> vvc;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
#define ROF(i,a,b) for(ll i=a;i>=b;i--)
#define per(i,a) ROF(i,a,0)
#define pb push_back
#define mp make_pair
const ll MOD=1000000007;
const ll MOD2=998244353;
const ld PI=acos(-1);
const ll INF=1e18;
st abc="abcdefghijklmnopqrstuvwxyz";
st ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
struct edge{ll to,cost;};

int main() {
  ll N,k;
  cin >> N >> k;
  vl a(N);
  rep(i,N){
    cin >> a[i];
  }
  bool B=false;
  rep(i,k){
    if(!B){
      B=true;
      vl d(N),s(N);
      rep(j,N){
        ll K=max(ll(0),j-a[j]);
        d[K]++;
        ll z=a[j]+j+1;
        if(z>=N){
          continue;
        }
        else{
          d[z]--;
        }
      }
      rep(j,N){
        if(j==0){
          s[j]=d[j];
        }
        else{
          s[j]=s[j-1]+d[j];
        }
      }
      /*rep(j,N){
        cout << s[j] << endl;
      }*/
      rep(j,N){
        a[j]=s[j];
        if(a[j]<N){
          B=false;
        }
      }
      /*rep(j,N){
        cout << a[j] << endl;
      }*/
    }
    else if(B){
      break;
    }
  }
  rep(i,N){
    cout << a[i] << endl;
  }
}

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

int main()
{
  string s;
  int k;
  cin >> s >> k;
  int ans = 1;
  for (auto i = 0; i < s.size(); i++) {
    if (k - 1 == i || s[i] != '1') {
      ans = s[i] - '0';
      break;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 384
import numpy as np
N = int(input())
X = np.array(input().split(), dtype=np.int64)
argsort = X.argsort()
argsort_argsort = argsort.argsort()
X_sorted = X[argsort]
m1, m2 = N // 2 - 1, N // 2
print("\n".join(str(X_sorted[m2]) if idx <= m1 else str(X_sorted[m1]) for idx in argsort_argsort))


Measured memory_bytes: 35712
import java.util.*;
class Main{
	static Scanner s = new Scanner(System.in);
	public static void main(String[] args) {
		int
			a=s.nextInt(),
			b=s.nextInt(),
			c=s.nextInt(),
			d=s.nextInt(),
			p=s.nextInt(),
			z=Math.max(0, p-c);
		System.out.println(Math.min(a*p, b+z*d));
	}
}

Measured memory_bytes: 26060
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
namespace mp = boost::multiprecision;

int main() {
  mp::cpp_int x, k, d;
  cin >> x >> k >> d;
  if (x < 0)
    x = -x;
  if (x >= k * d) {
    cout << x - k * d;
    return 0;
  }
  mp::cpp_int a = x / d;
  k -= a;
  x -= d * a;
  if (x < 0)
    x -= x;
  if (k % 2 == 0)
    cout << x;
  else
    cout << d - x;
  return 0;
}

Measured memory_bytes: 3704
#include<iostream>
using namespace std;
int main()
{
    int n,r;
    cin>>n;
    r=n%10;
    if(r==2||r==4||r==5||r==7||r==9)
    {
        cout<<"hon"<<endl;
    }
  else  if(r==0||r==1||r==6||r==8)
    {
        cout<<"pon"<<endl;
    }
    else
    {
        cout<<"bon"<<endl;
    }

}



Measured memory_bytes: 3564
import java.io.IOException;

import java.io.BufferedReader;
import java.io.InputStreamReader;

import java.io.PrintWriter;

@SuppressWarnings("unchecked")
public class Main {
    static final int INF = 1000000007;
    static int[] FCT;

    public static void main(String[] args) throws IOException {
        final String s;

        try (
            BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in))) {
            s = reader.readLine();
        }

        PrintWriter out = new PrintWriter(System.out);

        final String[] sl = s.split(" ");
        int N = Integer.parseInt(sl[0]);
        int M = Integer.parseInt(sl[1]);

        if (M < N) {
            int tmp = M;
            M = N;
            N = tmp;
        }

        if (1 < M - N) {
            out.println(0);
            out.flush();
            return;
        }

        factorial(M);

        int ans = modmulti(FCT[N], FCT[M]);

        if (N != M) out.println(ans);
        else out.println(modmulti(2, ans));

        out.flush();
    }

    static void factorial(int x)
    {
        FCT = new int[x + 1];
        FCT[0] = 1;
        FCT[1] = 1;
        for (int i = 2; i <= x; i++)
        {
            FCT[i] = modmulti(FCT[i - 1], i);
        }
    }

    // aとbを掛けた値をmodする(a * b mod p)
    static int modmulti(int a, int b)
    {
        int res = 0;
        int mod = a % INF;
        while (b > 0)
        {
            if ((b & 1) == 1)
            {
                res += mod;
                if (res > INF)
                {
                    res -= INF;
                }
            }
            mod <<= 1;
            if (mod > INF)
            {
                mod -= INF;
            }
            b >>= 1;
        }
        return res;
    }
}


Measured memory_bytes: 21204
#include<cstring>
#include<cstdio>
#include<cmath>
#include<vector>
#include<queue>
#include<map>
#include<cstdlib>
#include<iostream>
#include<algorithm>
#define maxn 1005
#define INF 0x3f3f3f3f3f
#define eps 1e-6
using namespace std;
typedef long long ll;

int w, h, n, ans, tx, ty;
int lx[maxn], ly[maxn], rx[maxn], ry[maxn];
int hx[maxn], hy[maxn];
int fld[maxn * 2][maxn * 2];
int pos[4][2] = { 1,0,0,1,-1,0,0,-1 };
struct node
{
	int x, y;
};

bool judge(int x, int y)
{
	if (x < 0 || y < 0 || x >= w || y >= h)return false;
	if (fld[x][y] > 0)return false;
	return true;
}

void imos()
{
	memset(fld, 0, sizeof(fld));
	for (int i = 1; i <= n; i++)
	{
		fld[lx[i]][ly[i]]++;
		fld[lx[i]][ry[i]]--;
		fld[rx[i]][ly[i]]--;
		fld[rx[i]][ry[i]]++;
	}
	for (int i = 0; i < w; i++)
	{
		for (int j = 1; j < h; j++)
			fld[i][j] += fld[i][j - 1];
	}
	for (int j = 0; j < h; j++)
	{
		for (int i = 1; i < w; i++)
			fld[i][j] += fld[i - 1][j];
	}
}

void bfs(int sx, int sy)
{
	ans++;
	node st, now, nxt;
	queue<node>q;
	st.x = sx, st.y = sy;
	fld[sx][sy] = 1;
	q.push(st);
	while (!q.empty())
	{
		now = q.front();
		q.pop();
		for (int i = 0; i < 4; i++)
		{
			nxt.x = now.x + pos[i][0];
			nxt.y = now.y + pos[i][1];
			if (judge(nxt.x, nxt.y))
			{
				q.push(nxt);
				fld[nxt.x][nxt.y] = 1;
			}
		}
	}
}

int main()
{
	while (scanf("%d%d", &w, &h))
	{
		if (w == 0 && h == 0)break;
		scanf("%d", &n);
		for (int i = 1; i <= n; i++)
			scanf("%d%d%d%d", &lx[i], &ly[i], &rx[i], &ry[i]);
		tx = ty = 0;
		for (int i = 1; i <= n; i++)
		{
			hx[++tx] = lx[i], hx[++tx] = rx[i];
			hy[++ty] = ly[i], hy[++ty] = ry[i];
		}
		hx[++tx] = 0, hx[++tx] = w;
		hy[++ty] = 0, hy[++ty] = h;
		sort(hx + 1, hx + tx + 1);
		sort(hy + 1, hy + ty + 1);
		w = unique(hx + 1, hx + tx + 1) - (hx + 1);
		h = unique(hy + 1, hy + ty + 1) - (hy + 1);
		for (int i = 1; i <= n; i++)
		{
			lx[i] = lower_bound(hx + 1, hx + w + 1, lx[i]) - hx - 1;
			rx[i] = lower_bound(hx + 1, hx + w + 1, rx[i]) - hx - 1;
			ly[i] = lower_bound(hy + 1, hy + h + 1, ly[i]) - hy - 1;
			ry[i] = lower_bound(hy + 1, hy + h + 1, ry[i]) - hy - 1;
		}
		w--, h--;
		imos();
		ans = 0;
		for (int i = 0; i < w; i++)
		{
			for (int j = 0; j < h; j++)
			{
				if (fld[i][j] == 0)
					bfs(i, j);
			}
		}
		printf("%d\n", ans);
	}
	return 0;
}


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

int main(void){
    int n;
    double sum = 0;
    cin >> n;
    int a[n];
    for(int i=0; i < n; i++){
        cin >> a[i];
        sum = sum + 1.0 / a[i];
    }

    cout << 1.0 / sum << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;

typedef long long int ll;

ll X,Y,Z;
ll K;
ll A[1005],B[1005],C[1005];

vector<ll> AB;
ll sub[1000005];

int main(){
    cin>>X>>Y>>Z>>K;
    for(int i=0;i<X;++i)cin>>A[i];
    for(int i=0;i<Y;++i)cin>>B[i];
    for(int i=0;i<Z;++i)cin>>C[i];
    for(int i=0;i<X;++i)for(int j=0;j<Y;++j)AB.push_back(A[i]+B[j]);
    sort(C,C+Z,greater<ll>());
    sort(AB.begin(),AB.end(),greater<ll>());
    vector<ll> ans;
    for(int i=0;i<AB.size();++i){
        for(int j=0;j<Z;++j){
            if((i+1)*(j+1)>K)continue;
            else ans.push_back(AB[i]+C[j]);
        }
    }
    sort(ans.begin(),ans.end(),greater<ll>());
    for(int i=0;i<K;++i)cout<<ans[i]<<endl;
}

Measured memory_bytes: 10604
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define sz(x) (int)(x.size())
#define pii pair<int, int>
#define fi first
#define se second
signed main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int h, w, n;
    set<pii> st, black;
    int ans[10] = {0};
    cin >> h >> w >> n;
    for (int _ = 0; _ < n; _++) {
        int a, b;
        cin >> a >> b;
        black.insert({a, b});
        for (int i = -2; i <= 2; i++) {
            for (int j = -2; j <= 2; j++) {
                if (1 <= a + i && a + i <= h && 1 <= b + j && b + j <= w) {
                    st.insert({a + i, b + j});
                }
            }
        }
    }
    int nonzero = 0;
    for (auto &el : st) {
        int cnt = 0;
        bool dorost = true;
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                if (el.fi + i > h || el.se + j > w)
                    dorost = false;
                if(black.find({el.fi + i, el.se + j}) != black.end()) {
                    cnt++;
                }
            }
        }
        if (dorost && cnt > 0) {
            ans[cnt]++;
            nonzero++;
        }
    }
    ans[0] = (h - 2) * (w - 2) - nonzero;
    for (int j = 0; j <= 9; j++)
        cout << ans[j] << "\n";
}

Measured memory_bytes: 164864
N = int(input())
S = [input() for i in range(N)]
# print(N)
# print(S)

answer = {
    'AC': 0,
    'WA': 0,
    'TLE': 0,
    'RE': 0,
}

for Si in S:
    answer[Si] += 1

print('AC x ' + str(answer.get('AC')))
print('WA x ' + str(answer.get('WA')))
print('TLE x ' + str(answer.get('TLE')))
print('RE x ' + str(answer.get('RE')))


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

using namespace std;

int main(int, char**) {
        long long x;
        cin >> x;
        long long g = 100;
        long long c = 0;
        while (true) {
                c++;
                g = g * 1.01;
                if (g >= x) {
                        cout << c << endl;
                        return 0;
                }
        }
        return 0;
}


Measured memory_bytes: 3620