akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main() {
	int n;
	cin >> n;
	vector<ll> sum(n), a(n);
	for(int i = 0; i < n; i++) cin >> a[i];
	sum[0] = a[0];
	for(int i = 1; i < n; i++) sum[i] = sum[i - 1] + a[i];
	ll out = (ll)1e18 + 10;
	for(int i = 0; i < n - 1; i++){
		out = min(out, (ll)abs(sum[i] - (sum[n - 1] - sum[i])));
	}
	cout << out << endl;
}


Measured memory_bytes: 6296
#include <iostream>
#include <cmath>
#include <vector>
#include <cstdlib>
#include <algorithm>

#include <stdio.h>
#include <stdlib.h>

using namespace std;

int f(string S){
  int n = 0;
  for(int i = 0; i < S.length(); i++){
    char a = S[i];
    char b = '0';
    //printf("0 : %d\n", b);
    n += (int)a - 48;
  }
  return n;
}

int main(int argc, char *argv[]){

  string N;
  cin >> N;
  int n = f(N);
  int NN = atoi(N.c_str());
  if((NN % n) == 0)
    printf("Yes\n");
  else
    printf("No\n");

  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void){
  int n,a,b;
  scanf("%d %d %d",&n,&a,&b);
  int r=0;
  for(int loop=0;loop<=n;loop++){
    int c=0;
    int t=loop;
    for(int loop2=0;loop2<5;loop2++){
      c+=t%10;
      t/=10;
    }
    if(a<=c && c<=b){
      r+=loop;
    }
  }
  printf("%d",r);
  return 0;
}

Measured memory_bytes: 128
N,K = map(int,input().split())
A = list(map(int,input().split()))
F = list(map(int,input().split()))

A.sort()
F.sort(reverse= True)

def det(x):
    KK = K
    for i in range(N):
        if int(max(0,A[i]-x/F[i])) == max(0,A[i]-x/F[i]):
            KK -= int(max(0,A[i]-x/F[i]))
        else:
            KK -= int(max(0,A[i]-x/F[i])) + 1
        if KK < 0:
            return False
        #print(KK)
    return True

if det(0):
    print(0)
else:
    R = [0,10**12]

    while R[1] - R[0] > 1:
        if det(int((R[0]+R[1])//2)):
            R[1] = int((R[0]+R[1])//2)
        else:
            R[0] = int((R[0]+R[1])//2)
        #print(R)

    print(R[1])#R[0]はFalse, R[1]はTrueが基本

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

long long a, b, n, x;

long long read() {
    long long x = 0, f = 1; char s;
    while((s = getchar()) < '0' || s > '9') if(s == '-') f = -1;
    while(s >= '0' && s <= '9') {x = (x << 1) + (x << 3) + (s ^ 48); s = getchar();}
    return x * f;
}

int main() {
    a = read(), b = read(), n = read();
    x = min(n, b - 1);
    printf("%lld\n", x * a / b);
    return 0;
}


Measured memory_bytes: 3764
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stdlib.h>
#include <cmath>
#include <numeric>
#include <functional>
#include <stack>
#include <iomanip>
#include <map>

int main() {
	long long n, r;

	std::cin >> n >> r;

	if (n >= 10) {
		std::cout << r << std::endl;
	}
	else {
		std::cout << r + 100 * (10 - n) << std::endl;
	}

	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int IsPrime(int n)
{
	int i;
	if(n<2)return 0;
	if(n==2)return 1;
	if(n%2 == 0)return 0;
	for(i=3; i*i<=n; i++)
		if(n%i == 0)return 0;
	return 1;
}

int main(void)
{
	int n, tmp;
	while(scanf("%d", &n)!=EOF)
	{
		tmp=n-1;
		while(!IsPrime(tmp))tmp--;
		printf("%d ",tmp);
		tmp=n+1;
		while(!IsPrime(tmp))tmp++;
		printf("%d\n", tmp);
	}
	return 0;
}

Measured memory_bytes: 1024
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;

#define FOR(i,n) for(int i=0;i<n;i++)
#define PRINT(a) cout<<a<<"\n"
 
int main(){

	int a,b,h;
	cin>>a>>b>>h;


	PRINT((a+b)*h/2);

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=998244353,MAX=3105,INF=1<<30;
char S[MAX][MAX],ans[MAX][MAX];

int main(){
    
    int H,W,D;cin>>H>>W>>D;
    string T="RYGB";
    
    for(int i=100;i<=2000;i+=D){
        for(int j=100;j<=2000;j+=D){
            int c=((i-100)/D)%2*2+((j-100))/D%2;
            for(int x=0;x<D;x++){
                for(int y=0;y<D;y++){
                    S[i+x][j+y]=T[c];
                }
            }
        }
    }
    
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            ans[i][j]=S[i+1000+j][i+1000-j];
        }
    }
    
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            cout<<ans[i][j];
        }
        cout<<endl;
    }
    
    
}


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

int main() {
    ll n,k; cin >> n >> k;
    vector<ll> v(n);
    for (ll i = 0; i < n; i++ ) cin >> v[i];

    ll ans = 0;
    for (ll l = 0; l <= min(n,k); l++) {
        for (ll r = 0; r + l <= min(n,k); r++) {
            vector<ll> take;
            ll tot = 0;

            for (ll i = 0; i < l ; i++) {
                tot += v[i];
                take.push_back(v[i]);
            }
            for (ll i = 0; i < r; i++) {
                tot += v[n-i-1];
                take.push_back(v[n-i-1]);
            }
            
            sort(take.begin(),take.end());
            ll lim = take.size();
            for (ll i = 0; i < min(k - r - l, lim); i++) {
                if (take[i] < 0) tot -= take[i];
            }         
            ans = max(ans,tot);
        }
    }
    cout << ans << endl; 
}



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

int main() {
  int N;
  string S;
  cin >> N >> S;
  int x = 0, maxx = 0;
  for (int i=0; i<S.size(); i++) {
    if (S.at(i) == 'I') {
      x++;
      maxx = max(maxx, x);
    } else {
      x--;
    }
  }
  cout << maxx << endl;
}


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

using namespace std;

void solve()
{
    string s, t;
    cin >> s >> t;
    int ans = 0;
    for (int i = 0; i < s.size(); i++)
    {
        ans += s[i] == t[i];
    }
    cout << ans << endl;
}

int main()
{
    solve();
    cerr << "\"努力不足ですね！\"" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

int n;
string s;

int getValue(int v, int i) {
    if(i == 0) return v%3;
    if(i == 1) return (v/3)%3;
    if(i == 2) return (v/9)%3;
    assert(false);
}

bool isNum(int i) {
    return s[i] >= '0' && s[i] <= '9';
} 
bool isAlpha(int i) {
    return s[i] >= 'A' && s[i] <= 'Z';
}

int fomula(int& i, int v) {
    if(i == n) assert(false);
    if(isNum(i)) return s[i++] - '0';
    if(isAlpha(i)) return getValue(v, s[i++] - 'P');
    if(s[i] == '-') return 2 - fomula(++i, v);
    assert(s[i] == '(');
    ++i;
    int x = fomula(i, v);
    char op = s[i++];
    int y = fomula(i, v);
    assert(s[i] == ')');
    ++i;
    if(op == '+') return max(x, y);
    else if(op == '*') return min(x, y);
    else assert(false);
    assert(false);
}

int main(){
    while(cin >> s) {
        if(s == ".") break;
        n = s.size();
        int ans = 0;
        rep(i, 27) {
            int id = 0;
            if(fomula(id, i) == 2) ++ans;
        }
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 3132
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i, n) for(int i = 0; i < (int)n; ++i)
int main()
{
    int N, M;
    scanf("%d %d", &N, &M);
    int a[N], b[N];
    REP(i, N) scanf("%d %d", &a[i], &b[i]);
    int c[M], d[M];
    REP(i, M) scanf("%d %d", &c[i], &d[i]);
    REP(i, N) {
        int res = -1;
        int dis = 1e9;
        REP(j, M) {
            int tmp = abs(c[j] - a[i]) + abs(d[j] - b[i]);
            if(tmp < dis) dis = tmp, res = j + 1;
        }
        printf("%d\n", res);
    }
    return 0;
}

Measured memory_bytes: 384
#atcoder template
def main():
    import sys
    imput = sys.stdin.readline
    #ここにコード
    #input
    A, B, N = map(int, input().split())

    #output
    #x = B*k + C (0 <= C < B)
    #A*x/B = A*k + C/B
    #x/B = k + C/B

    #floor(A*x/B) = floor(A*k + A*C/B)
    #floor(x/B) = k
    #eq = A*k + floor(A*C/B) - A*k = floor(A*C/B)
    import math
    D = min(N, B-1)
    print(math.floor(A*D/B))

if __name__ == "__main__":
    main()

Measured memory_bytes: 9144
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#include <unistd.h>
#include <cassert>
#include <cctype>
#include <random>
#define _USE_MATH_DEFINES
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<double, double, double> tddd;
typedef complex<double> xy_t;
#define REP(i, x, y) for(ll i = x; i < y; i++)
#define PER(i, x, y) for(ll i = x; i > y; i--)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
int iinf = intmax / 8;
ll inf = llmax / 8;
double eps = 1e-11;

vector<int> eratos(int n) {
    vector<int> primes(n);
    for (int i = 2; i < n; i++) {
        primes[i] = i;
    }
    for (int i = 2; i * i < n; i++) {
        if (primes[i]) {
            for (int j = i * i; j < n; j += i) {
                primes[j] = 0;
            }
        }
    }
    return primes;
}

vector<int> era;

ll num[1000010];

int main() {
    ll N, P;
    cin >> N >> P;
    if (N == 1) {
        cout << P << endl;
        return 0;
    }
    era = eratos(1e6 + 10);
    ll len = era.size();
    fill(num, num + len, 0);
    REP(i, 2, len) {
        if (era[i] > 0) {
            while (P % i == 0) {
                P /= i;
                num[i]++;
            }
        }
    }
    ll ans = 1;
    REP(i, 2, len) {
        if (era[i] > 0) {
            ll p = num[i] / N;
            REP(j, 0, p) {
                ans *= i;
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 11904
i = input().split(" ")

N = int(i[0])
M = int(i[1])

mi = 0
ma = N

for j in range(M):
	i = input().split(" ")
	l = int(i[0])
	r = int(i[1])
	if l >= mi:
		mi = l
	if r <= ma:
		ma = r

r = ma - mi + 1

if r > 0:
	print(r)
else:
	print(0)


Measured memory_bytes: 3064
//競技プログラミング用のテンプレート
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <string>
#include <math.h>
#include <stack>
#include <limits>

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define repr(i, n) for(int i = n - 1; i >= 0; i--)

using namespace std;
//エイリアス
using ll = long long int;
using p = pair<int, int>;
using pl = pair<ll, ll>;
using v = vector<int>;
using vd = vector<double>;
using vs = vector<string>;
using vl = vector<ll>;

//定数
const int intmax = numeric_limits<int>::max();
const ll llmax = numeric_limits<ll>::max();
const ll llmin = numeric_limits<ll>::min();
const ll mod = 1e9 + 7;
const double pi = M_PI;

v ps(5000, 0);
vl c(5000, 0);

void dfs(int start, int current, int &len, ll &max_score, ll &loop_score) {
  int next = ps[current];
  len++;
  loop_score += c[next];
  max_score = max(max_score, loop_score);
  if (start == next) return;
  dfs(start, next, len, max_score, loop_score);
}

void consume(int start, int steps, ll &max_score, ll &loop_score) {
  if (steps == 0) return;
  steps--;
  int next = ps[start];
  loop_score += c[next];
  max_score = max(max_score, loop_score);
  consume(next, steps, max_score, loop_score);
}

int main()
{
  int n;
  ll k;
  cin >> n >> k;
  rep(i, n) {
    cin >> ps[i];
    ps[i]--;
  }
  rep(i, n) cin >> c[i];

  ll ans = llmin;
  rep(i, n) {
    int len = 0;
    int start = i;
    ll max_score = llmin;
    ll loop_score = 0;
    dfs(start, start, len, max_score, loop_score);
    ll possible = max_score;
    if (loop_score > 0) {
      ll loop_count = k / len;
      possible = loop_score * (loop_count - 1) + max_score;
      if (k % len != 0) {
        ll tmp = loop_score * (k / len);
        max_score = llmin;
        loop_score = 0;
        consume(start, k % len, max_score, loop_score);
        tmp += max_score;
        possible = max(possible, tmp);
      } 
    }
    ans = max(ans, possible);
  }
  cout << ans << endl;
}


Measured memory_bytes: 3692
using System;

namespace ABC147_A
{
    class Program
    {
        static void Main(string[] args) {
            string[] input = Console.ReadLine().Split();
            string ans = "bust";

            int ans2 = 0;
            for (int i = 0; i < input.Length; i++) {
                ans2 += int.Parse(input[i]);
            }

            if (ans2 >= 22) {
                Console.WriteLine("bust");
                return;
            }
            ans = "win";

            Console.WriteLine(ans);
        }
    }
}

Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000000000000
#define MOD 1000000007
#define all(v) v.begin(),v.end()
#define pb push_back
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int kaijo[2000010];
struct edge{int to,cost;};
int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
bool prime(int a){
    if(a==1)return false;
    for(int i=2;i*i<=a;i++){
        if(a%i==0)return false;
    }
    return true;
}
void init_fact(){
    kaijo[0]=1;
    for(int i=1;i<=2000000;i++){
        kaijo[i]=kaijo[i-1]*i;
        kaijo[i]%=MOD;
    }
}
int modpow(int a,int b){
    if(b==0)return 1;
    if(b%2)return modpow(a,b-1)*a%MOD;
    int memo=modpow(a,b/2);
    return memo*memo%MOD;
}
int comb(int a,int b){
    if(!kaijo[0])init_fact();
    return kaijo[a]*modpow(kaijo[a-b],MOD-2)%MOD*modpow(kaijo[b],MOD-2)%MOD;
}
int inv(int x){
    x=modpow(x,MOD-2);
    return x;
}
bool kosa(double ax,double ay,double bx,double by,double cx,double cy,double dx,double dy){
    double ta=(cx-dx)*(ay-cy)+(cy-dy)*(cx-ax);
    double tb=(cx-dx)*(by-cy)+(cy-dy)*(cx-bx);
    double tc=(ax-bx)*(cy-ay)+(ay-by)*(ax-cx);
    double td=(ax-bx)*(dy-ay)+(ay-by)*(ax-dx);
    return tc*td<0&&ta*tb<0;
}
double dist(double ax,double ay,double bx,double by){
    return sqrt((bx-ax)*(bx-ax)+(ay-by)*(ay-by));
}
int a,b;
signed main(){
    cin>>a>>b;
    rep(i,max(a,b))cout<<min(a,b);
    cout<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void)

{

int W,H,x,y,r;

scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);

if(H>=y+r&&W>=x+r&&x-r>=0&&y-r>=0)

{

printf("Yes\n");

}else{

printf("No\n");

}

return 0;

}
 

Measured memory_bytes: 1012
fun main() {
    val (a, b, c, d) = readLine()?.split(" ")?.map(String::toInt) ?: return

    var aa = a
    var cc = c

    while (true) {
        cc -= b
        if (cc <= 0) {
            println("Yes")
            return
        }
        aa -= d
        if (aa <= 0) {
            println("No")
            return
        }
    }
}

Measured memory_bytes: 36440
import java.util.*;

/**
 * Created by DELL on 2017/7/15.
 */
public class Main {




    public static void main(String[] args) {
        Scanner  in=new Scanner(System.in);
        int A=in.nextInt();
        int B=in.nextInt();
        if(A%3==0||B%3==0||(A+B)%3==0){
            System.out.println("Possible");
        }
        else System.out.println("Impossible");


    }
}

Measured memory_bytes: 21972
# ABC088 B Card Game for Two
def main():
    n = int(input().strip())
    a = [int(x) for x in input().split()]

    a.sort(reverse=True)
    alice, bob = 0, 0
    for i, m in enumerate(a):
        if i % 2 == 0:
            alice += m
        else:
            bob += m

    print(alice - bob)
    

if __name__ == '__main__':
    main()


Measured memory_bytes: 38256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	int ans=0;
	for(int i=1;i<=n;i++)
	{
		int j=n/i;
		ans+=j;
		if(i*j==n)
			ans--;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 3608
nums = list(map(int, input().split(" ")))

for i in range(len(nums)-1):
    for j in range(len(nums)-1):
        if nums[j] > nums[j+1]:
            nums[j], nums[j+1] = nums[j+1], nums[j]
            
for i in range(len(nums)):
    nums[i] = str(nums[i])

string = " ".join(nums)

print(string)


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

bool checkPoor(int a, int b, int c)
{
    if(a == b && a != c)
    {
        return true;
    }
    return false;
}

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

    bool result = checkPoor(a,b,c) || checkPoor(a,c,b) || checkPoor(b,c,a);
    if(result)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <climits>
#include <cstring>
#include <string>
#include <set>
#include <bitset>
#include <map>
#include <queue>
#include <stack>
#include <vector>
#include <list>
#define rep(i,m,n) for(i=m;i<=n;i++)
#define mod 1000000007
#define inf 0x3f3f3f3f
#define vi vector<int>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define ll long long
#define pi acos(-1.0)
#define pii pair<int,int>
#define Lson L, mid, ls[rt]
#define Rson mid+1, R, rs[rt]
#define sys system("pause")
#define intxt freopen("in.txt","r",stdin)
const int maxn=1e3+10;
using namespace std;
ll gcd(ll p,ll q){return q==0?p:gcd(q,p%q);}
ll qpow(ll p,ll q){ll f=1;while(q){if(q&1)f=f*p%mod;p=p*p%mod;q>>=1;}return f;}
inline void umax(int &p,int q){if(p<q)p=q;}
inline void umin(int &p,int q){if(p>q)p=q;}
inline ll read()
{
    ll x=0;int f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
int n,m,k,t,a,b,c,d;
ll C[maxn][maxn],dp[2][maxn];
void init()
{
    C[0][0]=1;
    for(int i=1;i<=n;i++)
    {
        C[i][0]=1;
        for(int j=1;j<=i;j++)
        {
            C[i][j]=(C[i-1][j-1]+C[i-1][j])%mod;
        }
    }
}
int main()
{
    int i,j;
    scanf("%d%d%d%d%d",&n,&a,&b,&c,&d);
    init();
    dp[t][n]=1;
    for(int i=a;i<=b;i++)
    {
        for(int j=0;j<=n;j++)dp[t^1][j]=dp[t][j];
        ll tmp=1;
        for(int j=1;j<=d;j++)
        {
            if(j*i>n)break;
            tmp=tmp*C[i*j][i]%mod*qpow(j,mod-2)%mod;
            if(j<c)continue;
            for(int k=i*j;k<=n;k++)
            {
                dp[t^1][k-i*j]=(dp[t^1][k-i*j]+dp[t][k]*C[k][i*j]%mod*tmp%mod)%mod;
            }
        }
        t^=1;
    }
    printf("%lld\n",dp[t][0]);
    //system("Pause");
    return 0;
}


Measured memory_bytes: 7168
import java.util.Scanner;

public class Main {
	private Scanner sc;
	
	int[][] map;
	public static void main(String[] args) {
		new Main();
	}
	
	public Main() {
		sc = new Scanner(System.in);
		
		while (sc.hasNextLine() == true) {
			int lines = Integer.parseInt(sc.nextLine());
			if (lines == 0) break;
			
			double[][] points = new double[lines][2];
			for (int i = 0; i < lines; i++) {
				String[] nico = sc.nextLine().split(",");
				
				for (int j = 0; j < nico.length; j++) {
					points[i][j] = Double.parseDouble(nico[j]);
				}
			}
			
			boolean[] flag = new boolean[points.length];
			for (int i = 0; i < flag.length; i++) {
				flag[i] = true;
			}
			
			for (int i = 0; i < points.length; i++) {
				for (int j = (i + 1); j < points.length; j++) {
					double dx = points[j][0] - points[i][0];
					double dy = points[j][1] - points[i][1];
					
					boolean judge = true;
					if (dx != 0.0) {
						double a = dy / dx;
						double b = points[i][1] - a * points[i][0];

						double side = 0.0;
						for (int k = 0; k < points.length; k++) {
							double nside = 0.0;
							
							if ((k != i) && (k != j)) {
								nside = points[k][1] - (a * points[k][0] + b);
							} else {
								continue;
							}
							
							if ((side != 0.0) && ((side * nside < 0.0) || (nside == 0.0))) {
								judge = false;
								break;
							}
							side = nside;
						}
					} else {
						double side = 0.0;
						for (int k = 0; k < points.length; k++) {
							double nside = 0.0;
							
							if ((k != i) && (k != j)) {
								nside = points[k][0] - points[i][0];
							} else {
								continue;
							}

							if ((side != 0.0) && ((side * nside < 0.0) || (nside == 0.0))) {
								judge = false;
								break;
							}
							
							side = nside;
						}
					}
					
					if (judge == true) {
						flag[i] = false;
						flag[j] = false;
					}
				}
			}
			
			int cnt = 0;
			for (int i = 0; i < flag.length; i++) {
				if (flag[i] == true) cnt++;
			}
			
			System.out.println(cnt);
		}
	}
}

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

using namespace std;

typedef long long ll; 
typedef long double ld;

int main() {
	
	// make input and output more efficient
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
	
	
	// to read whole line
	//string s;
	//getline(cin, s);
	
	int A, B;
	
	cin >> A >> B;
	cout << A*B << "\n";
	
	return 0;
}

Measured memory_bytes: 3648
(let* ((a (read))
       (v (read))
       (b (read))
       (w (read))
       (time (read))
       (l (abs (- a b)))
       (x (- v w)))
  (if (and (> x 0) (<= (/ l x) time))
      (format t "YES~%")
      (format t "NO~%")))


Measured memory_bytes: 23188
#include<stdio.h>
#include<math.h>

int main()
{

	double r,distance,surface_area;

	scanf("%lf",&r);
	distance=2 * M_PI * r;
	surface_area=r*r*M_PI;
	printf("%lf %lf\n",surface_area,distance);

	return 0;
}

Measured memory_bytes: 648
import java.io.*;
import java.util.ArrayDeque;
import java.util.Deque;

public class Main {
    //    \:0  /:1 _:-1
    static class M {
        Integer flag;
        Integer loc;

        public M(Integer flag, Integer loc) {
            this.flag = flag;
            this.loc = loc;
        }
    }

    public static void main(String[] args) throws IOException {
        BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
        Deque<M> deque = new ArrayDeque<M>();
        Deque<M> deque1 = new ArrayDeque<M>();
        int po = 0;//记录位置
        int sum = 0;
        String s = bf.readLine();
        bf.close();
        for (int i = 0; i < s.length(); i++) {
            char a = s.charAt(i);
            if (a == '\\') {
                deque.push(new M(0, po));
                po++;
            } else if (a == '/') {
                while (!deque.isEmpty()) {
                    M pop = deque.pop();
                    if (pop.flag == 0) {
                        int area = po - pop.loc;
                        sum += area;
                        while (!deque1.isEmpty()){
                            M pop1 = deque1.peek();
                            if (pop1.flag>pop.loc){
                                pop1=deque1.pop();
                                area+=pop1.loc;
                            }else {
                                break;
                            }
                        }
                        deque1.push(new M(pop.loc, area));
                        break;
                    }
                }
                po++;
            } else {
                po++;
            }
        }
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        StringBuilder sb = new StringBuilder();

        System.out.println(sum);
        sb.append(deque1.size()+" ");
        while (!deque1.isEmpty()){
            sb.append(deque1.removeLast().loc+" ");
        }
        sb.deleteCharAt(sb.lastIndexOf(" ") );
        bw.write(sb.toString());
        bw.newLine();
        bw.close();

    }
}



Measured memory_bytes: 26248
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using ld = long double;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define REPS(c, s) for (char c : s)
#define ALL(c) (c).begin(), (c).end()
#define sz(v) (int)v.size()
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
const char EOL = '\n';
 
void solve();
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

ll gcd(ll m, ll n) {
    return n != 0 ? gcd(n, m % n) : m;
}

vector<ll> divisors(ll n) {
    vector<ll> v;
    for (ll i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            v.push_back(i);
            if (i * i != n) {
                v.push_back(n / i);
            }
        }
    }
    return v;
}

void solve() {
    int a, b, k;
    cin >> a >> b >> k;
    vector<ll> d = divisors(gcd(a, b));
    sort(ALL(d));
    reverse(ALL(d));
    cout << d[k - 1] << EOL;
}



Measured memory_bytes: 256
#include<iostream>
#include<string>
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
typedef long long ll;

int main(){
    int x=0, ans=0;
    int N;
    string s;
    cin >> N;
    cin >> s;
    for(int i=0; i<N; i++){
        if(s[i]=='I'){
            x++;
            if(ans<x){
                ans=x;
            }
        }else{
            x--;
        }
    }
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long LL;
const int N = 2e5 + 10;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
int k;
int gcd(int a,int b){
	return b==0?a:gcd(b,a%b);
}
int main() {
  	ios::sync_with_stdio(false);
  	cin>>k;LL ans=0;
  	for(int i=1;i<=k;i++){
  		for(int j=1;j<=k;j++){
  			for(int f=1;f<=k;f++){
  				ans+=gcd(i,gcd(j,f));
  			}
  		}
  	}
  	cout<<ans<<'\n';
 	return 0;
}

Measured memory_bytes: 3196
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
ll w,h,n;
cin >> w >> h >> n;
ll mnx = 0 , mny = 0 , mxx = w ,mxy = h;


for(int i=0; i<n; i++)
{
    ll x,y,a;
    cin >> x >> y >> a;
    if(a==1)
    {
     mnx = max(x,mnx) ;

    }
    else if(a==2)
    {
     mxx = min(x,mxx);
    }
    else if(a==3)
    {
        mny = max(y,mny);
    }
    else if(a==4)
    {
        mxy = min(y,mxy);
    }

}

ll hi = mxx - mnx , wi = mxy - mny;

if(mxx<mnx || mxy<mny)
cout << 0 << endl;
else
    cout << hi*wi << endl;

  }


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

int main()
{
	long long N, A, B;
	cin >> N >> A >> B;

	long long ans = 0;
	long long d = B - A;
	if( d < 0 ) {
	}
	else if( N == 1 ) {
		if( A == B ) ans = 1;
	}
	else {
		long long mi = A * ( N - 1) + B;
		long long ma = A + B * (N - 1);
		ans = ma - mi + 1;
	}

	cout << ans << endl;
}


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

using namespace std;
typedef long long ll;

int main(){
	int n, m;
	cin >> n;
	vector<string>S(n);
	for(int i = 0; i < n; i++){
		cin >> S[i];
	}
	cin >> m;
	vector<string>T(m);
	for(int i = 0; i < m; i++){
		cin >> T[i];
	}

	int ans = 0;
	for(int i = 0; i < n; i++){
		int cnt = 0;
		for(int j = 0; j < n; j++){
			if(S[i] == S[j]){
				cnt++;
			}
		}
		for(int k = 0; k < m; k++){
			if(S[i] == T[k]){
				cnt--;
			}
		}
		ans = max(ans , cnt);
	}

	cout << ans << endl;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

const long long INF=INT_MAX/4;
const long long MOD=1'000'000'007;
const double EPS=1e-14;
const bool DEBUG=true;

const string YES = "YES";
const string NO = "NO";
const string Yes = "Yes";
const string No = "No";

template<class T>
void debug(T head){
    if(DEBUG){
        cout<<head<<endl;
    }
}

template <class Head, class... Body>
void debug(Head head, Body... body){
    if(DEBUG){
        cout<<head<<" ";
        debug(body...);
    }
}

void answer(){
    int N;
    cin>>N;

    vector<long> x(N), y(N), z(N), w(N);
    for(int i=0; i<N; ++i){
        cin>>x[i]>>y[i];
        z[i] = x[i] + y[i];
        w[i] = x[i] - y[i];
    }

    auto z_max_itr = max_element(z.begin(), z.end());
    auto z_min_itr = min_element(z.begin(), z.end());
    auto w_max_itr = max_element(w.begin(), w.end());
    auto w_min_itr = min_element(w.begin(), w.end());

    cout<<max(*z_max_itr-*z_min_itr, *w_max_itr-*w_min_itr)<<endl;

    return;
}

/////

int main(int argc, char* argv[]){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout.precision(16);

    answer();

    return 0;
}


Measured memory_bytes: 9544
#include <iostream>
#include <vector>

using namespace std;

int main() {
    int K, S;
    int count = 0;
    cin >> K >> S;
    for (int i = 0; i <= K; i++) {
        for (int j = 0; j <= K; j++) {
            int t = S - (i + j);
            if (0 <= t && t <= K) count++;
        }
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 256
/* Author - thiolhub */

#include <bits/stdc++.h>

using namespace std;

#define ll              long long int
#define ld              long double
#define db              double
#define pi              3.1415926535897932384626
#define PI              acos(-1.0)
#define endl            "\n"
#define mod             1000000007
#define mk              make_pair
#define pb              push_back
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define ps(x,y)         fixed<<setprecision(y)<<x
#define w(t)            ll t; cin>>t; while(t--)
#define sc(a)	        scanf("%lld",&a);
#define pr(a)	        printf("%lld\n",a)
#define f(i,a,n)		for(ll i=a;i<n;i++)
#define m(a)		    memset(a,0,sizeof(a))
#define FastIO          ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0)



int main(){ FastIO;

string s;cin>>s;
int n=s.length();
string t=string(n,'x');
cout<<t;

return 0;
}

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

#define ll              long long
#define LMx             LLONG_MAX
#define LMn             LLONG_MIN
#define PI              3.14159265
#define endl            '\n'
#define cd              cout << '\n';
#define ys              cout << "YES"; return;
#define no              cout << "NO"; return;
#define pii             pair<int,int>
#define IOS             ios::sync_with_stdio(0);
#define vi              vector<int>
#define vll             vector<long long>
#define vpii            vector<pair<int,int>>
#define vpll            vector<pair<long long, long long>>
#define pb              push_back
#define in              insert
#define mp              make_pair
#define all(a)          a.begin(),a.end()
#define rall(a)         a.rbegin(),a.rend()
#define fr              first
#define sc              second
#define sz(a)           a.size()
#define min3(a,b,c)     min(a,min(b,c))
#define max3(a,b,c)     max(a,max(b,c))
#define min4(a,b,c,d)   min(a,min(b,min(c,d)))
#define max4(a,b,c,d)   max(a,max(b,max(c,d)))
#define MEM(a,x)        memset(a,x,sizeof(a))
#define SORT(v)         sort(v.begin(),v.end())
#define REV(v)          reverse(v.begin(),v.end())
#define buga(i,n,a)     for(i = 0; i < n; ++i) cout << a[i] << " ";
#define bugv(i,n,v)     cout << endl; for(i = 0; i < n; ++i) cout << v[i].first << " " << v[i].second << endl; cout << endl;

//#pragma GCC optimize("O3,unroll-loops")
//#pragma GCC target("avx,avx2,fma")

using namespace std;

/*ll myceil(ll a, ll b)
{
	return ((a+b-1)/b);
}

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


void solve()
{
	ll c, d, i, j, k, l, m, n, x, y, z, r, sum = 0, ans = 0, tmp, cnt = 0;
	//string s, t;
	ll a, b;
	char ch;
	cin >> a >> ch >> b;
	if(ch == '+')
		cout << a+b;
	else
		cout << a-b;
}


int main()
{
    IOS;
    int t = 1;
    //cin >> t;
    while (t--) {
        solve();
        cout << endl;
    }
    return 0;
}

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

using ll = long long;
using namespace std;
const int INFint = 1e9+1;
const ll INFll = (ll)1e18+1;
ll MOD=1e9+7;


int main(){
  ll N;
  cin>>N;
  int cnt(1);
  ll tmp(1);
  ll base(1);
  while(N - (base*26 + tmp) >= 0){
    tmp = base * 26 + tmp;
    base *= 26;
    cnt++;
  }
  N -= tmp;
  vector<char> ans;
  //cout << tmp << endl;
  for(int i(0);i<cnt;i++){
  //  cout <<N << " " <<  base <<" " << N/base << endl;
    ans.push_back((char)(N/base+'a'));
    N %= base;
    base /= 26;
  }
  for(auto a:ans){
    cout << a;
  }
  cout << endl;
  return 0;
}



Measured memory_bytes: 3588
#include <iostream>
#include <math.h>
#include <vector>
#include <stack>
#include <cstdio>
#include <string>
#include <bitset>
#include <list>
#include <set>
#include <algorithm>
#include <numeric>
#include <unordered_map>
#include <functional>
#include <queue>
#include <regex>
#include <cassert>
#include <map>
// #include "bits/stdc++.h"

using namespace std;
//debug

#define rep(i, N, M) for (ll i = N; i < M; ++i)
#define rrep(i, N, M) for (ll i = N; i > M; --i)
#define pb push_back


typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<string> vs;
typedef priority_queue<ll> pqll;
typedef priority_queue<pll, vector<pll>> pqpll;
typedef priority_queue<ll, vll, greater<ll>> pqll_greater;
typedef priority_queue<pll, vector<pll>, greater<pll>> pqpll_greater;


#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define vec(a) vector<a>
#define _CRT_SECURE_NO_WARNINGS

template<class T, class S>
T atbit(T n, S i) {
	return (n >> i) % i;
}

template<class T>
T getbit(T i) {
	return 1LL << i;
}
template<class T>
T POW(T n, T m) {
	T res = 1;
	rep(i, 0, m) {
		res *= n;
	}
	return res;
}

ll power(ll x, ll y, ll mod) {
	if (y == 0)return 1;
	if (y == 1)return x % mod;
	if (y % 2 == 0)return POW(power(x, y / 2, mod), 2LL) % mod;
	return ((POW(power(x, y / 2, mod), 2LL) % mod)*(x%mod)) % mod;
}
ll div(ll a, ll  b, ll mod) {
	return (a* power(b, mod - 2, mod)) % mod;
}

//#define TRANSFORM(v,w,func) decltype(v) w ; transform((v).begin(),(v).end(),back_inserter(w),func);

using namespace std;

ll MOD_NUM = POW(10LL, 9LL) + 7;

vector<pll >prime_factorize(ll n) {
	vector<pll> res;
	for (ll p = 2; p*p <= n; ++p) {
		if (n%p != 0)continue;
		ll num = 0;
		while (n%p == 0) { ++num; n /= p; }
		res.push_back({ p,num });
	}
	if (n != 1) res.push_back(make_pair(n, 1));
	return res;
}

class Combination {
	// this calculates combination (nCk).
	// Constructor runs in O(MAX).
	// get(n,k) returns nCk in O(1).

	ll MAX, MOD;
	vll fac;
	vll finv;
	vll inv;
public:
	Combination(ll MAX = 210000, ll MOD = 1000000007)
		:MOD(MOD), MAX(MAX), fac(vll(MAX)), finv(vll(MAX)), inv(vll(MAX)) {
		fac[0] = fac[1] = 1;
		finv[0] = finv[1] = 1;
		inv[1] = 1;
		rep(i, 2, MAX) {
			fac[i] = fac[i - 1] * i % MOD;
			inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
			finv[i] = finv[i - 1] * inv[i] % MOD;
		}
	}

	ll get(ll n, ll k) {
		if (n < k)return 0;
		if (n < 0 || k < 0)return 0;
		return fac[n] * (finv[k] * finv[n - k]%MOD )% MOD;
	}
};

int main() {
	ll n, m;
	cin >> n >> m;
	auto fac = prime_factorize(m);
	auto cb = Combination();
	ll res=1LL;
	for(auto  i : fac)
	{
		auto num = i.second;
		res = res * cb.get(num + n - 1, n - 1)%MOD_NUM;
		
	}
	
	cout << res;
}


Measured memory_bytes: 5120
#
# Written by NoKnowledgeGG @YlePhan
# ('ω')
#
#import math
#mod = 10**9+7
#import itertools
#import fractions
#import numpy as np
#mod = 10**4 + 7
"""def kiri(n,m):
  r_ = n / m
  if (r_ - (n // m)) > 0:
    return (n//m) + 1
  else:
    return (n//m)"""

""" n! mod m 階乗
mod = 1e9 + 7
N = 10000000
fac = [0] * N
def ini():
  fac[0] = 1 % mod
  for i in range(1,N):
    fac[i] = fac[i-1] * i % mod"""

"""mod = 1e9+7
N = 10000000
pw = [0] * N
def ini(c):
  pw[0] = 1 % mod
  for i in range(1,N):
    pw[i] = pw[i-1] * c % mod"""

"""
def YEILD():
  yield 'one'
  yield 'two'
  yield 'three'
generator = YEILD()
print(next(generator))
print(next(generator))
print(next(generator))
"""
"""def gcd_(a,b):
  if b == 0:#結局はc,0の最大公約数はcなのに
    return a
  return gcd_(a,a % b) # a = p * b + q"""
"""def extgcd(a,b,x,y):
  d = a
  if b!=0:
    d = extgcd(b,a%b,y,x)
    y -= (a//b) * x
    print(x,y)
  else:
    x = 1
    y = 0
  return d"""


def readInts():
  return list(map(int,input().split()))

def main():
  s = input()
  ans = 0
  slen = len(s)
  COMP = s[slen-1]
  for i in range(slen-2, -1,-1):
    if COMP != s[i]:
      COMP = s[i]
      ans += 1
  print(ans)
if __name__ == '__main__':
  main()

Measured memory_bytes: 3188
#include<iostream>
#define N 20 
using namespace std;

int main(){
    int n=N,i,m=0;
    double array[N];
    cin>>n;

for(i=0;i<n;i++){
cin>>array[i];
}
for(i=1;i<n-1;i++){
    if((array[i-1]<array[i]&&array[i]<array[i+1])||(array[i+1]<array[i]&&array[i]<array[i-1])){
        m++;
    }
}
cout<<m<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
	long long n,k;
	scanf("%lld %lld",&n,&k);
	long long sum = 0;
	long long  i;
	for(i = k;i <= n+1;i++){
		sum += (n - i + 1)*i + 1;
	}
	
	printf("%lld",sum%1000000007);
} 

Measured memory_bytes: 1704
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define set_bits(a) __builtin_popcount(a)
#define pb push_back
#define pf push_front
#define mod 1000000007
#define M 998244353
#define fi first
#define se second
#define endl '\n'
#define INF 1e18
#define PI 3.14159265358979323846
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);


int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);

   freopen("output.txt", "w", stdout);
    #endif

    ll n,d,i,j;
    cin>>n>>d;

    vector< pair<ll,ll> >v(n);
    for(i=0;i<n;i++)
    {
        cin>>v[i].fi>>v[i].se;
    }

    ll k = d*d;
    ll ans=0;

    for(i=0;i<n;i++)
    {
        ll p = v[i].fi * v[i].fi;
        ll q = v[i].se * v[i].se;

        if(p+q <=k)
        {
            ans++;
        }
    }
    cout<<ans<<endl;
}

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

using Weight = long long;
using Vertex = int;
struct Edge {Vertex from, to; Weight weight;};
using Graph = std::vector<std::vector<Edge>>;

std::vector<Weight> BellmanFord(const Graph& G, Vertex s, Weight INF = 1e18) {
  std::vector<Weight> d(G.size(), INF);
  d[s] = 0;
  for(auto k = 0; k < 2*G.size(); ++k) for(const auto& E: G) for(const auto& e: E) if(d[e.from] != INF) {
    if(d[e.to] > d[e.from] + e.weight) {
      d[e.to] = d[e.from] + e.weight;
      if(k >= G.size()) d[e.to] = -INF;
    }
  }
  return d;
}

int main() {
  int N, M; Weight P;
  cin >> N >> M >> P;

  Graph G(N);
  for(auto i = 0; i < M; ++i) {
    Vertex A, B; Weight C;
    cin >> A >> B >> C;
    --A; --B;
    G[A].push_back({A, B, P-C});
  }

  Weight INF = 1e18;
  auto d = -BellmanFord(G, 0, INF)[N-1];
  if(d < 0)    d = 0;
  if(d == INF) d = -1;
  cout << d << endl;
}


Measured memory_bytes: 512
#include <stdio.h>

int main(void) {
	int W, H;
	int x, y, r;
	scanf("%d %d %d %d %d", &W, &H, &x, &y, &r);
	if (H<y+r) puts("No");
	else if (0>y-r)
	           puts("No");
	else if (W<x+r)
		       puts("No");
	else if (0>x-r)
		       puts("No");
	else puts("Yes");
	return 0;
}


Measured memory_bytes: 584
#include<bits/stdc++.h>
using namespace std;
typedef long long unsigned int ll;

// definition {{{ 1

// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)

#define Scll(x) scanf("%llu", &x)
#define Scll2(x,y) scanf("%llu%llu", &x, &y)
#define Scll3(x,y,z) scanf("%llu%llu%llu", &x, &y, &z)

#define Scc(c) scanf("%c", &c);
#define Scs(s) scanf("%s", s);
#define Scstr(s) scanf("%s", &s);
// }}} 2

// constants {{{ 2
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
// }}} 2

// systems {{{ 2
#define Rep(x,y) for(int x = 0; x < y; x++)
#define Repe(x,y,z) for(int x = z; x < y; x++)
// }}} 2

// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n");
// }}} 2

// }}} 1

int main() {

    int n,x;
    vector<int> v;
    vector<int> s;

    Scd(n);
    Rep(i,n){
        Scd(x);
        v.push_back(x);
        s.push_back(x);
    }

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

    int below = v[n/2-1];
    int above = v[n/2];

    Rep(i,n){
        if(s[i] <= below ){
            printf("%d\n", above);
        }else{
            printf("%d\n", below);
        }
    }


    return 0;
}



Measured memory_bytes: 3948
S=input()
N=len(S)
mod=10**9+7

list_=[[0,0,0,0]]*(N+1)
for cur in range(N,-1,-1):
    for i in range(4):
        if cur==N:
            if i==3:
                list_[N][i]=1
            else:
                list_[N][i]=0
        else:
            if S[cur]=='ABCD'[i]:
                list_[cur][i]=(list_[cur+1][i+1]+list_[cur+1][i])%mod
            elif S[cur]=='?' and i!=3:
                list_[cur][i]=(list_[cur+1][i+1]+3*list_[cur+1][i])%mod
            elif S[cur]=='?':
                list_[cur][i]=3*list_[cur+1][i]%mod
            else:
                list_[cur][i]=list_[cur+1][i]%mod

print(list_[0][0]%mod)

Measured memory_bytes: 4084
using namespace std;
#include<bits/stdc++.h>
#define BEGIN ios_base::sync_with_stdio(0);cin.tie(0);
#define END return EXIT_SUCCESS;
#define FOR(I,A,B) for((I)=(A);(I)<(B);(I)++)
#define REP(I,N) FOR((I),0,(N))
#define UP(I,A,B) for((I)=(A);(I)<=(B);(I)++)
#define DW(I,A,B) for((I)=(A);(I)>=(B);(I)--)
#define IN(P) cin>>(P)
#define IN2(P1,P2) cin>>(P1)>>(P2)
#define IN3(P1,P2,P3) cin>>(P1)>>(P2)>>(P3)
#define INS(I,N,V) REP((I),(N)) cin>>(V[I])
#define INS2(I,N,V1,V2) REP((I),(N)) cin>>(V1[I])>>(V2[I]);
#define INS3(I,N,V1,V2,V3) REP((I),(N)) cin>>(V1[I])>>(V2[I])>>(V3[I]);
#define OUT(P) cout<<(P)<<endl
#define OUT2(P1,P2) cout<<(P1)<<" "<<(P2)<<endl
#define OUT3(P1,P2,P3) cout<<(P1)<<" "<<(P2)<<" "<<(P3)<<endl
#define OUTS(I,N,V) REP((I),(N)) cout<<(V[i])<<endl
#define ALL(C) (C).begin(),(C).end()
#define RALL(C) (C).rbegin(),(C).rend()
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
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;}

string s;
long L,i,S,G;
inline void solve(){
  IN(s);
  L=s.size();
  REP(i,L)if(s[i]=='A'){S=i;break;}
  DW(i,L-1,0)if(s[i]=='Z'){G=i;break;}
  OUT(G-S+1);
}

int main(int argc,char**argv){
  BEGIN
  solve();
  END
}


Measured memory_bytes: 720
#include<iostream>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
#include<map>
#include<cmath>
#include<string>
#include<bitset>
#include <sstream>
#include<queue>
#include<set>
#include<iomanip>
#define rep(i,n) for(ll i=0;i<(n);++i)
using namespace std;
typedef long long ll;
typedef pair<double,double>P;

int main()
{
    int n,a,b,c,d;
    cin>>n>>a>>b>>c>>d;
    string s;
    cin>>s;
    a--,b--,c--,d--;
    bool aflag=true;
    bool bflag=true;
    bool take=true;
    int apos=a;
    int bpos=b;
    while(bflag)
    {
        if(bpos==d)break;
        
        if(bpos==n-1)bflag=false;

        if(s[bpos+1]!='#')
        {
            bpos+=1;
        }
        else if(s[bpos+2]!='#')
        {
            bpos+=2;
        }
        else
        {
            bflag=false;
            break;
        }

    }
    while(aflag)
    {
        if(apos==c)break;

        if(apos==n-1)aflag=false;

        if(s[apos+1]!='#')
        {
            apos+=1;
        }
        else if(s[apos+2]!='#')
        {
            apos+=2;
        }
        else
        {
            aflag=false;
            break;
        }

    }
    int count=0;
    if(c>d)
    {
        for(int i=b-1;i<=d+1;i++)
            {
                if(s[i]=='.')
                {
                    count++;
                }
                else
                {
                    count=0;
                }
                if(count==3)break;
                
            }
        if(count<3)take=false;

    }
            
    

    
    if(aflag && bflag && take)
    {
        
        cout<<"Yes";
    }
    else
    {
        cout<<"No";
    }

    
}

Measured memory_bytes: 640
#define TEMPLATE_USED
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pl;
typedef vector<pl> vp;
const ll INF=1001001001;
const ll LINF=1001001001001001001;
const ll D4[]={0,1,0,-1,0};
const ll D8[]={0,1,1,0,-1,-1,1,-1,0};
#define _overload3(_1,_2,_3,name,...) name
#define _rep2(i,n) for(ll i=0;i<(n);++i)
#define _rep3(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(...) _overload3(__VA_ARGS__,_rep3,_rep2)(__VA_ARGS__)
#define _repe2(i,n) for(ll i=0;i<=(n);++i)
#define _repe3(i,a,b) for(ll i=(a);i<=(b);++i)
#define repe(...) _overload3(__VA_ARGS__,_repe3,_repe2)(__VA_ARGS__)
#define _rrep2(i,n) for(ll i=(n)-1;i>=0;i--)
#define _rrep3(i,a,b) for(ll i=(b)-1;i>=(a);i--)
#define rrep(...) _overload3(__VA_ARGS__,_rrep3,_rrep2)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
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;}
template<class T>
using pq=priority_queue<T,vector<T>,greater<T>>;
const string YES = "Yes";
const string NO = "No";

string S;
string T;

void solve();

int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cin >> S;
    cin >> T;
    solve();
}

// S, T は英小文字列
// 1 <= |S| <= 10
// |T| = |S| + 1

// string S, string T
// T が問の条件を満たすならば Yes と、そうでないならば No と出力せよ。
void solve(){
    cout<<(S==T.substr(0,T.size()-1)?YES:NO)<<endl;
}


Measured memory_bytes: 3652
def calc(T, bam):
    mix = len(bam) - 1
    total = sum(bam)
    return mix * 10 + abs(T - total)


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


var = [[] for _ in range(N + 1)]
var[0].append('')

for i in range(N):
    for j in var[i]:
        for c in '0abc':
            var[i + 1].append(j + c)

V = var[N]

ans = 10 ** 6
for v in V:
    a = []
    b = []
    c = []
    cost = 0
    for i, m in enumerate(v):
        if m == 'a':
            a.append(L[i])
        elif m == 'b':
            b.append(L[i])
        elif m == 'c':
            c.append(L[i])
    if len(a) and len(b) and len(c):
        CA = calc(A, a)
        CB = calc(B, b)
        CC = calc(C, c)
        cost = CA + CB + CC
        if cost == 5:
            print('hello')
        ans = min(ans, cost)

print(ans)


Measured memory_bytes: 55536
#include <stdio.h>
#include <string.h>
#define S_MAX 10000

char s[S_MAX + 1];

void solve(const int l){
	int j = 0, i = 0;
	int n = 1;
	while(n + 1 < l){
		if(s[n] == 'O' && s[n + 1] == 'I'){
			switch(s[n - 1]){
			case 'J':
				j++;
				break;
			case 'I':
				i++;
				break;
			}
		}
		n++;
	}
	printf("%d\n%d\n", j, i);
	return;
}

int main(void){
	while(scanf("%s",s) != EOF){
		solve(strlen(s));
	}
	return 0;
}

Measured memory_bytes: 544
//「方眼紙と線分」(https://beta.atcoder.jp/contests/cf16-relay-open/tasks/relay_e)

#include<iostream>
#include<vector>

int main(){
	//標準入力
	int A,B,C,D;
	std::cin>>A>>B>>C>>D;

	//処理
	//dxとdyについて、通る格子点が何個あるかを求める
	//ある格子点から次の格子点までに横切るマスは、右にx上にy進んだときはx+y-1個である。
	//このxとyは互いに素
	int dx=std::abs(A-C),dy=std::abs(B-D);
	int count=0;
	if(dx==0 || dy==0){
		count=0;
	} else{
		//最大公約数を求める
		int large=(dx<dy?dy:dx);
		int small=dx+dy-large;
		while(large%small!=0){
			int pal=large-small*(large/small);
			large=small;
			small=pal;
		}
		//計算(smallが最大公約数)
		count=(dx/small+dy/small-1)*small;
	}

	//出力
	std::cout<<count<<std::endl;


	return 0;
}


Measured memory_bytes: 256