akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define si(X) scanf("%d", &(X))
#define sll(X) scanf("%lld",&(X))
#define INFL 0x3f3f3f3f3f3f3f3fLL
const ll mod = 1e18 + 7;
 
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll expo(ll base,ll pow){ll ans = 1;
   while(pow!=0){if(pow&1==1){ans = ans*base;ans = ans%mod;}
   base *= base;base%=mod;pow/=2;}return ans;}
ll inv(ll x){return expo(x,mod-2);}
int dx[8] = {1 , 0 , -1 , 0 , 1 , -1 , -1 , 1};    // last 4 diagonal
int dy[8] = {0 , 1 , 0 , -1 , 1 , 1 , -1 , -1};
/*---------------------------------------------------------------------------------------------------------------------*/
 
const int M = 1e6 + 5;
 
double dis(double x1, double y1, double x2, double y2){
       double dist = (x1-x2)*(x1-x2)+(y1-y2)*(y1-y2);
       return sqrt(dist);
}
 
ll dp[123456][3];
 
int a[123], b[123456];
 
int main(){
 
 
   ll n;
   cin >> n;
 
   if(n < 10){
      cout << n;
      return 0;
   }
 
   int ind1 = 0;
 
   while(expo(10, ind1) <= n) ind1++;
   //cout << ind1 << endl;
   ind1--;
   ll ans = 9*ind1;
   int n1 = n/expo(10, ind1);
   ll n2 = n1;
   for(int i = 0; i < ind1; i++) n2 = 10LL*n2+9;
   if(n2 == n)
   ans += n1;
   else ans += (n1-1);
   cout << ans;
}


Measured memory_bytes: 256
n = int(input())
rc = []

for i in range(n):
    s,p = input().split()
    rc.append((str(s),int(p)))

rc = (list(enumerate(rc)))

rc.sort(key=lambda x:x[1][1], reverse=True)
rc.sort(key=lambda x:x[1][0], reverse=False)

for i in rc:
    print(i[0]+1)

Measured memory_bytes: 3064
using System;
using System.Collections.Generic;
using System.Linq;

class Procon
{
    public Procon() { }
    static void Main(string[] agrs)
    {
        new Procon().Do();
    }

    Scanner cin;

    public void Do()
    {
        cin = new Scanner();
        int N = cin.nextInt();
        int[] X = cin.arrayInt();
        int[] Y = new int[N];

        Array.Copy(X, Y, N);
        Array.Sort(Y);

        int ret1 = Y[N / 2 - 1];
        int ret2 = Y[N / 2];

        for (int i = 0; i < N; i++)
        {
            if (ret1 < X[i])
            {
                Console.WriteLine(ret1);
            }
            else
            {
                Console.WriteLine(ret2);
            }
        }
    }
}

class Scanner
{
    string[] s;
    int i;
    int max_i;

    public Scanner()
    {
        s = new string[0];
        max_i = 0;
        i = 0;
    }

    public string nextString()
    {
        if (i >= s.Length)
        {
            s = Console.ReadLine().Split(' ');
            max_i = s.Length;
            i = 0;
            if (max_i == 0)
            {
                return "";
            }
            return s[i++];
        }
        else
        {
            return s[i++];
        }
    }

    public int nextInt()
    {
        return int.Parse(nextString());
    }


    public long nextLong()
    {
        return long.Parse(nextString());
    }

    public double nextDouble()
    {
        return double.Parse(nextString());
    }

    public string[] arrayString()
    {
        return Console.ReadLine().Split(' ');
    }

    public int[] arrayInt()
    {
        string[] str = Console.ReadLine().Split(' ');
        int[] array = new int[str.Length];
        for (int i = 0; i < str.Length; i++)
        {
            array[i] = int.Parse(str[i]);
        }
        return array;
    }

    public long[] arrayLong()
    {
        string[] str = Console.ReadLine().Split(' ');
        long[] array = new long[str.Length];
        for (int i = 0; i < str.Length; i++)
        {
            array[i] = long.Parse(str[i]);
        }
        return array;
    }

    public double[] arrayDouble()
    {
        string[] str = Console.ReadLine().Split(' ');
        double[] array = new double[str.Length];
        for (int i = 0; i < str.Length; i++)
        {
            array[i] = double.Parse(str[i]);
        }
        return array;
    }
}

Measured memory_bytes: 36060
#include<bits/stdc++.h>
#define two(a) (1<<(a))
#define LINF (1ll<<61)
#define EPS (1e-14)
#define Lshift(a,b) ((a)<<(b))
#define Rshift(a,b) ((a)>>(b))
#define rep(a,b) for(a=0 ; a<b ; a++)
#define xrep(a,b,c) for(a=b ; a<c ; a++)
#define INF (1<<29)
#define sz(a) int(a.size())
#define mset(x) memset(x, 0, sizeof(x))
#define swap(a,b) ( (a^=b) , (b^=a) , (a^=b) )
#define GET(x) (mark[x>>5]>>(x&31)&1)
#define SET(x) (mark[x>>5]|=1<<(x&31))
#define maxL (10000000>>5)+1
#define mod 1000000007
#define vi vector<int>
#define pii pair<int, int>
#define mii map<int, int>
#define si set<int>
#define pb push_back
typedef long long ll;
using namespace std;


int main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    ll x, k, d;
    cin >> x >> k >> d;
    x = abs(x);
    ll w(x / d);
    if (w >= k) {
        cout << x - k * d << endl;
    } else {
        if ((k - w) % 2 == 0) {
            cout << x - w * d << endl;
        } else {
            cout << abs(x - ((w+1) * d)) << endl;
        }
    }
}


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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;

int const h = 2, w = 4, n = 8;

struct puzzle
{
    int f[n];
    int space;

    bool operator<(const puzzle &p) const
    {
        rep(i, n)
        {
            if (f[i] == p.f[i])
                continue;
            return f[i] > p.f[i];
        }
        return 0;
    }
};

map<puzzle, int> mp;
queue<puzzle> q;
pair<int, int> d[4] = {{-1, 0}, {0, -1}, {1, 0}, {0, 1}};

void bfs(puzzle s)
{
    mp[s] = 0;
    q.push(s);

    while (!q.empty())
    {
        puzzle u = q.front();
        q.pop();
        int x = u.space / w, y = u.space % w;

        rep(i, 4)
        {
            int nx = x + d[i].first, ny = y + d[i].second;

            if (!((0 <= nx && nx < h) && (0 <= ny && ny < w)))
                continue;

            puzzle u_copy = u;
            swap(u_copy.f[u.space], u_copy.f[w * nx + ny]);
            u_copy.space = w * nx + ny;

            if (!mp[u_copy])
            {
                mp[u_copy] = mp[u] + 1;
                q.push(u_copy);
            }
        }
    }
}

int main()
{
    puzzle in;
    rep(i, n) in.f[i] = i;
    in.space = 0;
    bfs(in);

    while (1)
    {
        puzzle ans;
        rep(i, n)
        {
            cin >> ans.f[i];
            if (ans.f[i] == 0)
                ans.space = i;
        }
        if (cin.eof())
            break;

        OP(mp[ans]);
    }

    return 0;
}


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

long long N;

int main(int argc, char* argv[]){
  cin >> N;
  int l = log10(N);
  long long p = pow(10,l);
  cout << l*9+((N%p==p-1)?N/p:N/p-1) << endl;
  return 0;
}

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

int main(){
    vector<string> S(100);
    int N,L;
    cin >> N >> L;
    for(int i=0;i<N;i++){
        cin >> S[i];
    }

    //bubble sort
    string tmp;
    for(int i=0;i<N;i++){
        for(int k=0;k<N-1-i;k++){
            if(S[k]>=S[k+1]){
                tmp = S[k+1];
                S[k+1] = S[k];
                S[k] = tmp;
            }
        }
    }
    for(int i=0;i<N;i++){
        cout << S[i];
    }
    return 0;
}

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

int main(){
        int N, M;
        cin >> N >> M;
        int i;
        int count = 0;
        std::vector<int> numbers;
        int total = 0;
        while(cin>>i){
                numbers.push_back(i);
                total += i;
        }
        for(int number : numbers){
                if(number >= total/(4.0*M)){
                        count++;
                }
        }

        if(count < M){
                cout << "No";
        }else{
                cout << "Yes";
        }
}

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

typedef long long ll;

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

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

int main() {
    int n; cin >> n;
    ll ans = 1;
    for (int i = 0; i < n; i++) {
        ll t; cin >> t;
        ans = lcm(t, ans);
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>

int main(void){

  int i, j, r, c, rs=0, cs=0, total=0;
  int *table;

  scanf("%d %d", &r, &c);

  table = (int *)malloc(sizeof(int) * (r+1)*(c+1));
  for(i=0;i<(r+1)*(c+1);i++){
    table[i] = 0;
  }

  for(i=0;i<r;i++){
    for(j=0;j<c;j++){
      scanf("%d", &table[i*(c+1)+j]);
      cs += table[i*(c+1)+j];
      total += table[i*(c+1)+j];
    }
    table[i*(c+1)+c] = cs;
    cs = 0;
  }

  for(i=0;i<c;i++){
    for(j=0;j<r;j++){
      rs += table[j*(c+1)+i];
    }
    table[r*(c+1)+i] = rs;
    rs = 0;
  }

  table[(r+1)*(c+1)-1] = total;

  for(i=0;i<r+1;i++){
    for(j=0;j<c+1;j++){
      printf("%d", table[i*(c+1)+j]);
      if(j != c){
        printf(" ");
      }
    }
    printf("\n");
  }

  free(table);

  return 0;
}



Measured memory_bytes: 2104
#include <bits/stdc++.h>
#define ll long long int
#define yorn(f) cout<<((f)?"Yes":"No")<<endl;
#define YORN(f) cout<<((f)?"YES":"NO")<<endl;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define put(x) cout << x << endl;
#define println(x) cout << x << endl;
using namespace std;
int main()
{
    int n;
    string s;
    cin >> n >> s;
    
    int sum = 0;
    rep(i, n - 2) {
        if (s[i] == 'A' && s[i + 1] == 'B' && s[i + 2] == 'C') {
            sum += 1;
        }
    }
    println(sum)
    return 0;
}

Measured memory_bytes: 3612
fn main() {
    let _: i32 = readln();
    let a: Vec<i64> = readln();
    let s: i64 = a.iter().sum();
    let mut t = 0i64;
    let mut answer = i64::max_value();
    for (i, x) in a.iter().enumerate() {
        t += *x;
        if i+1 != a.len() {
            answer = min(answer, (t - (s - t)).abs());
        }
    }
    println!("{}", answer);;
}

// --- template ---
#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::HashSet;

pub trait FromLn {
    fn fromln(s: &str) -> Self;
}
pub fn readln<T: FromLn>() -> T {
    let mut buf = String::new();
    let _ = ::std::io::stdin().read_line(&mut buf).unwrap();
    T::fromln(buf.trim())
}
pub fn readlns<T: FromLn>(n: usize) -> Vec<T> {
    let mut vs = vec![];
    for _ in 0..n { vs.push(readln()); }
    vs
}
macro_rules! fromln_primitives {
    ($($t:ty),*) => { $(
        impl FromLn for $t {
            fn fromln(s: &str) -> $t {
                s.parse().unwrap()
            }
        }
    )* }
}
fromln_primitives!(String, bool, f32, f64, isize, i8, i16, i32, i64, usize, u8, u16, u32, u64);
impl<T> FromLn for Vec<T> where T: FromLn {
    fn fromln(s: &str) -> Vec<T> {
        s.split_whitespace().map(T::fromln).collect()
    }
}
impl FromLn for Vec<char> {
    fn fromln(s: &str) -> Vec<char> {
        s.chars().collect()
    }
}
macro_rules! fromln_tuple {
    ($($t:ident),*) => {
        impl<$($t),*> FromLn for ($($t),*) where $($t: FromLn),* {
            fn fromln(s: &str) -> ($($t),*) {
                let mut it = s.split_whitespace();
                let t = ($($t::fromln(it.next().unwrap())),*);
                assert_eq!(it.next(), None);
                t
            }
        }
    }
}
fromln_tuple!(A, B);
fromln_tuple!(A, B, C);
fromln_tuple!(A, B, C, D);
fromln_tuple!(A, B, C, D, E);
fromln_tuple!(A, B, C, D, E, F);

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

string pad_line(int W) {
  string ret = "";
  for (int i = 0; i < W + 2; i++) {
    ret = ret + ".";
  }
  return ret;
}
string pad(string s) {
  return "." + s + ".";
}

int main() {
  int H, W;
  cin >> H >> W;
  vector<string> s(H + 2);
  for (int i = 0; i < H + 2; i++) {
    if (i == 0 || i == H + 1) {
      s.at(i) = pad_line(W);
	  continue;      
    }
    string x;
    cin >> x;
    s.at(i) = pad(x);
  }
    
  for (int i = 1; i < H + 1; i++) {
    for (int j = 1; j < W + 1; j++) {
      int count = 0;
      for (int p = i - 1; p < i + 2; p++) {
        for (int q = j - 1; q < j + 2; q++) {
          if (s.at(p).at(q) == '#') {
            count++;
          }
        } 
      }
      if (s.at(i).at(j) != '#') {
        s.at(i).at(j) = to_string(count).at(0);
      }
    }
    cout << s.at(i).substr(1, W) << endl;
  }
}


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author toshif
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        MyReader in = new MyReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, MyReader in, PrintWriter out) {
            int M = 100005;
            int[] cnt = new int[100005];
            int N = in.nextInt();
            for (int i = 0; i < N; i++) {
                int a = in.nextInt();
                cnt[a]++;
            }

            int ma = 0;
            for (int i = 0; i < M; i++) {
                int tot = cnt[i];
                if (i > 0) tot += cnt[i - 1];
                if (i + 1 < M) tot += cnt[i + 1];

                ma = Math.max(ma, tot);
            }

            out.println(ma);
        }

    }

    static class MyReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public MyReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 33984
import java.util.Scanner;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Map;
import java.util.HashMap;


public class Main
{
    String a, b;
    
    public static void main(String args[])
    {
	new Main().solve();
    }
    
    void solve()
    {
	in();

	out();
    }

    void in()
    {
	Scanner sc = new Scanner(System.in);
	a = sc.next();
	b = sc.next();
    }

    void out()
    {
	for(int i = 0; i < b.length(); i++) {
	    out(a.charAt(i));
	    out(b.charAt(i));
	}
	if(a.length() != b.length()) out(a.charAt(a.length() - 1));
	System.out.println();
    }
    
    void out(int ans)
    {
	System.out.println(ans);
    }

    void out(char ans)
    {
	System.out.print(ans);
    }
    
    void out(String ans)
    {
	System.out.println(ans);
    }
}


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

int main()
{
	int a,b;
	scanf("%d %d",&a,&b);
	int x,y,z;
	x=a+a-1;
	y=b+b-1;
	z=a+b;
	if(x>y&&x>z) printf("%d",x);
	else if(y>x&&y>z) printf("%d",y);
	else printf("%d",z);

	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;
typedef long long ll;
typedef long  l;
typedef pair<int,int> P;
#define rep(i,n) for(int i=0;i<n;i++)
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
const double PI=3.141592653589;
const int INF=1000000007;
const ll LMAX=1000000000000001;
ll gcd(ll a,ll b){if(a<b)swap(a,b);ll c=a%b;while(c!=0){a=b;b=c;c=a%b;}return b;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
int dx[]={-1,0,1,0};
int dy[]={0,1,0,-1};


int main(){
  ll n,k; cin>>n>>k;
  ll ans;
  if(n<k){
    ans=min(n,k-n);
  }else{
    ans=min(n-n/k*k,(n/k+1)*k-n);
  }
  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 256
day_all = int(input())
day_nor = int(input())
pay_nor = int(input())
pay_sar = int(input())
bonus = 0
if day_all > day_nor:
    bonus = pay_sar * (day_all - day_nor)
    pay_all = day_nor * pay_nor + bonus
else:
    pay_all = day_all * pay_nor
print(pay_all)

Measured memory_bytes: 2940
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.stream.Stream;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author dyominov
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ASomethingOnIt solver = new ASomethingOnIt();
        solver.solve(1, in, out);
        out.close();
    }

    static class ASomethingOnIt {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            out.print(Arrays
                    .stream(in.next().split(""))
                    .filter(i -> i.equals("o"))
                    .count() * 100 + 700);
        }

    }

    static class InputReader implements AutoCloseable {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public void close() {
        }

    }
}



Measured memory_bytes: 25808
N, M, C = map(int,input().split())
B = list(map(int,input().split()))

ans = 0
for _ in range(N):
    line = map(int,input().split())
    s = 0
    for i, l in enumerate(line):
        s += B[i] * l
    if s + C > 0:
        ans += 1

print(ans)

Measured memory_bytes: 3060
#include "bits/stdc++.h"
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <queue>
#include <set>
#include <tuple>
using namespace std;

#define FOR(i,init,a) for(int i=init; i<a; i++)
#define rep(i,a) FOR(i,0,a)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define rep1(i,a) for(int i=1; i<=a; i++)
#define cout1(a) cout << a << endl;
#define cout2(a,b) cout << a << " " << b << endl;
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl;
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl;
#define mem(a,n) memset( a, n, sizeof(a))
#define all(a) a.begin(),a.end()
#define chmin(a,b) a=min(a,b);
#define chmax(a,b) a=max(a,b);

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;
static const double pi = 3.141592653589793;

int N;
int nums[100009];

int up(int idx){
    int res=0;
    for(int i=idx;i+1<N;i++){
        if(nums[i]>nums[i+1]) break;
        res++;
    }
    return res+1;
}

int down(int idx){
    int res=0;
    for(int i=idx;i+1<N;i++){
        if(nums[i]<nums[i+1]) break;
        res++;
    }
    return res+1;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    cin>>N;
    rep(i,N) cin>>nums[i];
    
    int now=0, cnt=0;
    while(now<N){
        cnt++;
        int x=up(now);
        chmax(x,down(now));
        now+=x;
        //cout1(now)
    }
    cout1(cnt)
}

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

int main() {
    ll N,W;
    cin>>N>>W;
    V v(N),w(N);
    rep(i,N)cin>>v[i]>>w[i];
    V dp(W+1,0);
    rep(i,W){
        rep(j,N){
            if(i+w[j]<=W)dp[i+w[j]]=max(dp[i+w[j]],dp[i]+v[j]);
        }
    }
    cout<<dp[W]<<endl;
}



Measured memory_bytes: 3172
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <fstream>
#include <iomanip>
using namespace std;
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toStr(T x) { ostringstream sout; sout << x; return sout.str(); }
typedef vector<int> vi;
typedef vector<vi>  vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,(n)-1)
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = INT_MAX / 2;
const int MOD = 1000000007;

int main() {
	ll N;
	cin >> N;
	vi X(N), S(N);
	REP(i, N) {
		cin >> X[i];
		S[i] = X[i];
	}
	sort(ALL(S));
	REP(i, N) {
		if (X[i] <= S[N/2-1]) {
			cout << S[N/2] << endl;
		}
		else {
			cout << S[N/2-1] << endl;
		}
	}
	return 0;
}

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

int main() {
    int N;
    cin >> N;
    vector<int> X(N);
    for(int i = 0 ; i < N ; i++) cin >> X[i];

    long long ans = 1e9;
    for(int i = 0 ; i <= 100 ; i++){
        long long tot = 0;
        for( auto x : X){
            tot += (x-i) * (x-i);
        }
        if( tot < ans ){
            ans = tot;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#define INF 100000000
void dfs(int, int);

int n;
int k[100],dis[100];
int vat[100][100],edg[100][100];

main(){
  int u, i, j;
  
  scanf("%d", &n);//input
  for(i=0;i<n;i++){
    scanf("%d", &u);
    scanf("%d", &k[u]);
    
    for(j=0;j<k[u];j++){
      scanf("%d", &vat[u][j]);
      scanf("%d", &edg[u][j]);
    }
  }
  
  for(i=0;i<n;i++) dis[i] = INF;//すべてのノードを無限大に初期化
  
  dfs(0, 0);
  
  for(i=0;i<n;i++){//output
    printf("%d %d\n", i, dis[i]);
  }
  return 0;
}

void dfs(int x, int y){
  int i;
  dis[x] = y;
  for(i=0;i<k[x];i++){
    if(dis[vat[x][i]] > y + edg[x][i]) dfs(vat[x][i], y + edg[x][i]);
  }
}




Measured memory_bytes: 2044
# -*- coding:utf-8 -*
N = int(input())
nums = list(map(int, input().split()))
nums = [ nums[i]-i-1 for i in range(N) ]
nums_s = sorted(nums)
b1 = nums_s[N//2]
b2 = nums_s[N//2-1]
res = []
for b in [b1, b2]:
    result = 0
    for i in range(1,N+1):
        result += abs(nums[i-1]-b)
    res.append(result)
print(min(res))


Measured memory_bytes: 26708
"use strict";
// inputに入力データ全体が入る
const main = (input) => {
  //分割代入,1行目がq,2行目がb,3行目がcに代入される
  const array = input.trim().split(" ");
  const strAns = array.join("");
  const ans = Number(strAns);
  return ans % 4 == 0 ? "YES " : "NO";
};

// ※この行以降は編集しない (標準入力から一度に読み込みMainを呼び出します)
console.log(main(require("fs").readFileSync("/dev/stdin", "utf8")));


Measured memory_bytes: 29516
#include <iostream>
#include <vector>
using namespace std;
long long int N, D; vector<long long int> W; vector<long long int> V;
int main(){
    cin>>N>>D;
    W.assign(N, 0); V.assign(N,0);
    for(int i = 0; i < N; i++){
	cin>>W[i]>>V[i];
    }
    vector<vector<long long int> > dp(N+1, vector<long long int>(D+1, 0));
    for(int i = 1; i <= N; i++){
	for(int j = 0; j <= D && j<=D; j++){
	    // the item we are in: i
	    // the weight: j
	    if(j-W[i-1]>=0){
		dp[i][j] = max(dp[i-1][j], dp[i-1][j-W[i-1]]+V[i-1]);
	    }else{
		dp[i][j] = dp[i-1][j];
	    }
	}
    }
    cout<<dp[N][D]<<endl;;
}


Measured memory_bytes: 80256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
using namespace std;
#define lli long long int
#define all(x) x.begin(),x.end()
#define siz(x) x.size()
#define prs(x,y) x.find(y)!=x.end()
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int i=(a);i>=(b);i--)
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }
const int INF = 1<<29;
typedef long long ll;
inline int two(int n) { return 1 << n; }
inline int test(int n, int b) { return (n>>b)&1; }
inline void set_bit(int & n, int b) { n |= two(b); }
inline void unset_bit(int & n, int b) { n &= ~two(b); }
inline int last_bit(int n) { return n & (-n); }
inline int ones(int n) { int res = 0; while(n && ++res) n-=n&(-n); return res;}
inline int level(int n){int ans=0;while(n%2==0){n/=2;ans++;}return ans;}
lli a[100005][4];
lli dp[100005][4];
int main()
{	
	lli n;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<3;j++)
			cin>>a[i][j];
	}
	for(int i=n-1;i>=0;i--)
	{
		for(int j=0;j<3;j++)
		{
			int next1=(j+1)%3;
			int next2=3-(j+next1);
			dp[i][j]=a[i][j]+max(dp[i+1][next1],dp[i+1][next2]);
		}
	}
    cout<<max(dp[0][1],max(dp[0][2],dp[0][0]));
}



Measured memory_bytes: 6528
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for(int i = 0; i < n; i++)
#define all(a) a.begin(), a.end()
#define P pair<int, int>
#define F first
#define S second
#define mod 1000000007
#define INF 90000000000000000
signed main(void){
    int n,t;cin>>n>>t;
    P V[n];
    rep(i,n){
        int x,y;cin>>x>>y;
        V[i]=make_pair(x,y);
    }
    sort(V,V+n);
    int A[n],B[n];
    rep(i,n){
        A[i]=V[i].F;B[i]=V[i].S;
    }
    vector<vector<int>>dp(3010,vector<int>(6010,0));
    rep(i,n)rep(j,t){
        dp[i][j+1]=max(dp[i][j+1],dp[i][j]);
        dp[i+1][j]=max(dp[i+1][j],dp[i][j]);
        dp[i+1][j+A[i]]=max(dp[i+1][j+A[i]],dp[i][j]+B[i]);
    }
    int ans=0;
    rep(i,3010)rep(j,6010)ans=max(ans,dp[i][j]);
   // rep(i,n){
    //    rep(j,t)cout<<dp[i][j]<<' ';
//cout<<endl;
   // }
    cout<<ans<<endl;
    
}
        


Measured memory_bytes: 141824
R,G,B,N=map(int,input().split())

cnt=0
for r in range(N+1):
  for g in range(N+1):
    u=N-R*r-G*g
    if u<0:
      break
    if u%B!=0:
      continue
    if u//B>=0:
      cnt+=1
print(cnt)

Measured memory_bytes: 9160
#include <iostream>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <complex>
#include <cstdio>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

#define INF 1e9
#define rep(i,n) for(int i=0;i<n;i++)
typedef pair<int,int> P;
struct edge{int to;double cost;};

int N,M,L,d[10100];
vector<edge> g[10100];

void dijkstra(int s){
	priority_queue<P,vector<P>,greater<P> > q;
	fill(d,d+10100,INF);
	d[s]=0;
	q.push(P(0,s));
	while(!q.empty()){
		P p=q.top();q.pop();
		int v=p.second;
		if(d[v]<p.first)continue;
		rep(i,g[v].size()){
			edge e=g[v][i];
			if(d[e.to]>d[v]+e.cost){
				d[e.to]=d[v]+e.cost;
				q.push(P(d[e.to],e.to));
			}
		}
	}
}

int main(){
	while(cin>>N>>M>>L&&N){
		rep(i,10100)g[i].clear();
		rep(i,M){
			int A,B,D,E;
			cin>>A>>B>>D>>E;
			A--;B--;
			edge e;
			rep(m,L+1){
				e.to=100*m+B;
				e.cost=E;
				g[100*m+A].push_back(e);
				e.to=100*m+A;
				g[100*m+B].push_back(e);
				if(m>=D){
					e.to=100*(m-D)+B;
					e.cost=0;
					g[100*m+A].push_back(e);
					e.to=100*(m-D)+A;
					g[100*m+B].push_back(e);
				}
			}
		}
		dijkstra(100*L);
		int ans=INF;
		rep(m,L+1)ans=min(ans,d[100*m+N-1]);
		cout<<ans<<endl;
	}
}

Measured memory_bytes: 10000
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long num;
    while(cin>>num)
    {
        long long arr[num+5],count[num+5]={0};
        for(long long i=0;i<num-1;i++)
        {
            cin>>arr[i];
            count[arr[i]]++;
        }
        for(long long i=1;i<=num;i++)
        {
            cout<<count[i]<<endl;
        }
      break;
    }
}


Measured memory_bytes: 6744
#include <stdio.h>

using namespace std;

int f(int i){
    if(i==0){
        return 1;
    }else{
        return -1;
    }
}
char g(int i){
    if(i==0){
        return '+';
    }else{
        return '-';
    }
}

int main(){
    char a, b, c, d;
    scanf("%c%c%c%c", &a, &b, &c, &d);
    int i, j, k, l;
    i = a - '0';
    j = b - '0';
    k = c - '0';
    l = d - '0';

    for(int x=0; x < 2; x++){
        for(int y=0; y < 2; y++){
            for(int z=0; z < 2; z++){
                int res = i + f(x)*j + f(y)*k + f(z)*l;
                if(res == 7){
                    printf("%d%c%d%c%d%c%d=7\n", i, g(x), j, g(y), k, g(z), l);
                    goto DEATH;
                }
            }
        }
    }
    DEATH:
    // printf("%d%d%d%d\n", i, j, k, l);
    return 0;
}

Measured memory_bytes: 128
/**
 * File              : C.cpp
 * Author            : JCHRYS <jchrys@me.com>
 * Date              : 22.12.2019
 * Last Modified Date: 22.12.2019
 * Last Modified By  : JCHRYS <jchrys@me.com>
 */

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

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

int main() {
    ll a, b;
    cin >> a >> b;
    ll _gcd = gcd(a, b);
    cout << a*b/_gcd;
    return 0;
}


Measured memory_bytes: 384
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**9)


n = int(input())
G = [[] for i in range(n)]
for i in range(n-1):
    a,b = map(int, input().split())
    a,b = a-1,b-1
    G[a].append([b,i])

ans = [None]*(n-1)
def rec(cur,color):
    cnt = 1
    for (to, j) in G[cur]:
        if cnt == color:
            cnt += 1
        ans[j] = cnt
        rec(to, cnt)
        cnt += 1
rec(0, 0)
print(max(ans))
print(*ans, sep="\n")


Measured memory_bytes: 71032
N, L = map(int, input().split())
 
#標準入力からリストの作成
list = []
for _ in range(N):
 i = str(input())
 list.append(i)

#リストのソート
list_a = sorted(list)
 
#リストの結合
mojiretu = ''.join(list_a)
 
print(mojiretu)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
 
using namespace __gnu_pbds;
using namespace std;
 
typedef long long int ll;
typedef unsigned long long int sll;
typedef long double ld;
#define A 1000000007
#define D 100000000000000ll
#define B 998244353ll
#define C 1000000000000000000ll
#define M 4000
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define oset tree<pair<ll,ll>, null_type,less_equal<pair<ll,ll>>, rb_tree_tag,tree_order_statistics_node_update> 
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define mxe(v) *max_element(v.begin(),v.end())
#define mne(v) *min_element(v.begin(),v.end())
#define bs binary_search
#define lb lower_bound
#define ub upper_bound
#define ve vector
#define br break
#define PI acos(-1)
#define subt cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n" 

ll dp[3005][3005];

int main() 
{
    FAST;
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    dp[a][b]=1;
    for(int i=b+1;i<=d;i++)
        dp[a][i]=(dp[a][i-1]*a)%B;
    for(int i=a+1;i<=c;i++)
        dp[i][b]=(dp[i-1][b]*b)%B;
    for(int i=a+1;i<=c;i++)
        for(int j=b+1;j<=d;j++)
        {
            ll ans=(dp[i-1][j]*j) + (dp[i][j-1]*i) - (((i-1)*(j-1)*dp[i-1][j-1])%B);
            ans%=B;
            ans+=B;
            ans%=B;
            dp[i][j]=ans;
        }
    cout<<dp[c][d];
    subt;
    return 0;
}

Measured memory_bytes: 74144
#include <cstdio>
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <stack>
#include <functional>
#include <set>
#include <map>
#include <deque>
#define WMAX 10000
#define HMAX 10000

//コメントアウトするとdebug()を実行しない
#define DEBUG

using namespace std;
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

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

int A = 0,B,C,D,N,W,H,ans = 0,dp[HMAX][WMAX];
string S;
static const int dx[8] = {0,1,1,1,0,-1,-1,-1},
					dy[8] = {1,1,0,-1,-1,-1,0,1};

void solve(){
	for (int i = 0; i < N; ++i)
	{
		if(S[i] == 'I'){
			A++;
		}else{
			A--;
		}
		ans = max(ans,A);
	}
}

void debug(){

}

void answer(){
	cout << ans << "\n";
}

int main(){
	cin >> N;
	cin >> S;
	solve();
	#ifdef DEBUG
	debug();
	#endif
	answer();

	return 0;
}

Measured memory_bytes: 256
n = int(input())
memo = [[0] * (n+1) for x in range(n+1)]

def gcd(x,y):
  if y == 0:
    return x
  if not memo[x][y] == 0:
    return memo[x][y]
  memo[x][y] = gcd(y,x % y)
  return gcd(y,x % y)

res = 0
for i in range(1,n+1):
  for j in range(1,n+1):
    q = gcd(i,j)
    if q == 1:
      res += n
    else:
      for k in range(1,n+1):
        p = gcd(q,k)
        res += p
print(res)

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

using namespace std;

// Header files, namespaces,
// macros as defined above
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>


#define f first
#define s second
#define db long double
#define pb push_back
#define sz(c) (c).size()
#define all(c) (c).begin(),(c).end()

typedef long long ll;
typedef pair <int , int> ii;
typedef pair <ii , int> iii;
typedef vector <int> vi;
typedef vector <ii> vii;
typedef vector <iii> viii;
typedef vector <vi> vvi;
typedef vector <vii> vvii;

const ll mod = 1e9+7;
const int MAX = 2e5+5;
const db eps = 1e-13;

ll BIT[MAX];

void update( int x , ll v ) {

    for( ; x < MAX ; x += (x&-x) )
        BIT[x] = max( BIT[x] , v );
}

ll query ( int x ) {

    ll res = 0;
    for( ; x > 0 ; x -= (x&-x) )
        res = max( BIT[x] , res );
    return res;

}

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
    cout<<setprecision(11)<<fixed;

    int n;cin>>n;
    vi H(n+1);
    vi A(n+1);
    for( int i = 1 ; i <= n ; i++ )
        cin>>H[i];
    for( int i = 1 ; i <= n ; i++ )
        cin>>A[i];
    for( int i = 1; i <= n ; i++ ) {

        int h , a;
        h = H[i];
        a = A[i];

        ll best = query( h-1 );

        update( h , best+a );

    }
    cout<<query( n+1 )<<"\n";

}

Measured memory_bytes: 3328
def gcd(x,y):
    while y != 0:
        x,y = y,x%y
    return x
n = int(input())
a = list(map(int,input().split()))

L,R = [0],[0]
for i in range(1,n+1): #L[i]は左i個,R[i]は右i個
    L.append(gcd(L[-1],a[i-1]))
    R.append(gcd(R[-1],a[n-i]))
print(max(gcd(L[i],R[n-i-1]) for i in range(n)))

Measured memory_bytes: 14076
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
 
#include <bits/stdc++.h>
using namespace std;
 
//krishrawat 
 
 
//----------------------------MACROS-------------------------------------------------
#define pb insert//                                                                 |
#define eb emplace_back//                                                           |
#define ff first//                                                                  |
#define ss second//                                                                 |
typedef long long int ll;//                                                         |
typedef long double ld;//                                                           |
#define all(a) a.begin(), a.end()//                                                 |
#define show(x) cerr << #x << " is " << x << "\n"//                                 |
#define show2(x, y) cerr << #x << " " << #y << " " << x << " " << y << "\n"//       |
typedef vector<ll> vl;//                                                            |
typedef vector<vl> vvl;//                                                           |
typedef pair<ll, ll> pp;//                                                          |
typedef vector<pp> vp;//                                                            |
typedef map<pp, ll> ipi;//                                                          |
typedef map<pp, char> ipc;//                                                        |
typedef map<ll, ll> ii;//                                                           |
typedef set<ll> sl;//                                                               |
typedef multiset<ll> msl;//                                                         |
typedef map<char, ll> ci;//                                                         |
typedef set<pair<ll, ll>> sp;//                                                     |
const ll mod = 1e9 + 7;//                                                           |
const ll N = 1e3 + 1;//                                                             |
//----------------------------------------------------------------------------------
 

//solution
void solve(){
    ll n;cin>>n;
    ll ans=0;
    for(int i=1;i<=n;i++){
        for (int j=1;j<=n/i;j++){
            if(i*j<n){
                ans++;
            }
        }
    }
    cout<<ans<<"\n";
    
}
 
int main()
{   
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    
     
 
    ll t;
    t=1;
    //cin>>t;
    while(t--){
        solve();
    }
    
    return 0;
}

Measured memory_bytes: 3648
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <algorithm>

using namespace std;

template<class T>
struct Vec2
{
	Vec2(){}
	Vec2(T _x, T _y) : x(_x), y(_y) {}

	Vec2 operator+(const Vec2& rhs) const { return Vec2(x + rhs.x, y + rhs.y); }
	Vec2 operator-(const Vec2& rhs) const { return Vec2(x - rhs.x, y - rhs.y); }
	Vec2 operator*(T s) const { return Vec2(x*s, y*s); }
	Vec2 operator/(T s) const { return Vec2(x/s, y/s); }
	T dot(const Vec2& rhs) const { return x*rhs.x + y*rhs.y; }
	T cross(const Vec2& rhs) const { return x*rhs.y - y*rhs.x; }
	T sqlength() const { return x*x + y*y; }
	double length() const { return sqrt(sqlength()); }
	bool operator<(const Vec2& rhs) const
	{
		if (x != rhs.x) return x < rhs.x;
		return y < rhs.y;
	}

	T x;
	T y;
};

template<class T>
T cross(const Vec2<T> &O, const Vec2<T> &A, const Vec2<T> &B)
{
	return (A - O).cross(B - O);
}

template<class T>
bool IsIntSegments(const Vec2<T>& A1, const Vec2<T>& A2, const Vec2<T>& B1, const Vec2<T>& B2)
{
	return (cross(A1, A2, B1)*cross(A1, A2, B2) < 0 && cross(B1, B2, A1)*cross(B1, B2, A2) < 0);
}

template<class T>
bool IsPointOnSegment(const Vec2<T>& P, const Vec2<T>& S, const Vec2<T>& E)
{
	Vec2<T> dir = E - S;
	if ((P - S).cross(dir) != 0) {
		return false;
	}
	T prd = (P - S).dot(dir);
	if (prd < 0) {
		return false;
	}
	return prd <= dir.dot(dir);
}

int main()
{
	typedef Vec2<long long> Vec;

	int q;
	cin >> q;
	for (int i = 0; i < q; i++) {
		Vec P[4];
		for (int j = 0; j < 4; j++) {
			cin >> P[j].x >> P[j].y;
		}

		if (IsIntSegments(P[0], P[1], P[2], P[3]) ||
			IsPointOnSegment(P[0], P[2], P[3]) ||
			IsPointOnSegment(P[1], P[2], P[3]) ||
			IsPointOnSegment(P[2], P[0], P[1]) ||
			IsPointOnSegment(P[3], P[0], P[1])) {
			puts("1");
		}
		else {
			puts("0");
		}
	}
	return 0;
}


Measured memory_bytes: 3096
#include <bits/stdc++.h>
using namespace std;
#define pi 3.14159265359
#define int long long
#define pii pair<int, int>
#define ld long double
const int mod = 1e9 + 7;
 
int dx[] = {-1, 0, 1, 0};
int dy[] = {0, -1, 0, 1};



int32_t main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
 
 
  
 int n; cin>>n;
	int cnt[65]={0};
	int ans=0;
	for(int i=0;i<n;i++){
		int t; cin>>t;
		for(int j=0;j<60;j++){
			if(t&(1ll<<j)) ans+=(1ll<<j)%mod*(i-cnt[j]);
			else           ans+=(1ll<<j)%mod*(cnt[j]);
			if(t&(1ll<<j)) cnt[j]++;
			ans%=mod;
		}
	}
	cout<<ans<<"\n";
    
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,n)  FOR(i,0,n)
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<vector<P>> Graph;


int main(){


  int n,k;
  cin >> n >> k;
  
  int num[n];
  REP(i,n){
    cin >> num[i];
  }
  
  sort(num,num+n);
  
  int ans = 0;
  for(int i = n-1; k > 0; i--){
    ans += num[i];
    k--;
  }
  
  cout << ans << endl;

 return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n,a[205],k[205],sg[205];
int dfs(int A,int K){
	if(A%K==0) return A/K;
	if(A<K) return 0;
	int w=A/K+1,S=A/K*K;
	A-=(A-S)/w*w;
	if(A>S) A-=w;
	return dfs(A,K);
}
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%d%d",&a[i],&k[i]);
	int ans=0;
	for(int i=1;i<=n;i++){
		ans^=dfs(a[i],k[i]);
	}
	if(ans) puts("Takahashi");
	else puts("Aoki");
	return 0;
}

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

using namespace std;

#define ll long long
#define ini(arr, val) memset(arr, (val), sizeof(arr))
#define loop(i,n)  for(ll i=0; i<n; i++)
#define loop1(i,n)  for(ll i=1; i<=n; i++)

#define all(a)      (a).begin(),(a).end()
#define dupli(a)     unique(all(a)),(a).end()
#define exist(s,e)  (s.find(e)!=s.end())
#define dbg(x)  cout << #x << " is " << x << endl;
#define pt(x) cout<<x<<"\n"
#define pts(x) cout<<x<<" "

#define mp make_pair
#define pb push_back
#define F first
#define S second


#define inf (int)1e9
#define eps 1e-9
#define PI 3.1415926535897932384626433832795
#define mod 1000000007


#define fast    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define test   int t; cin>>t; while(t--)

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<pii> vpii;
typedef vector<vi> vvi;
typedef map<int,int> mii;
typedef set<int> si;

typedef pair<ll, ll> pll;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<pll> vpll;
typedef vector<vl> vvl;
typedef map<ll,ll> mll;
typedef set<ll> sl;


//////////////////////////////////////////////////////////////////////////////////////////
//                      main starts
//////////////////////////////////////////////////////////////////////////////////////////
int const lmt=1e5+5;


int main(){

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

    int k,x;
    cin>>k>>x;
    int p=x+1;
    vi v;
    loop(i,k){
    	v.pb(x);
    	x--;
    }
    loop(i,k-1){
    	v.pb(p);
    	p++;
    }
    int n=v.size();
    sort(all(v));
    for(auto c:v) pts(c);
    cout<<endl;
    
    

}


/*

// 

*/

Measured memory_bytes: 3640
import java.util.Arrays;
import java.util.Scanner;

public class Main {
public static void main(String[] args) {
		
		Scanner keyboard = new Scanner(System.in); 
		
        int a  = keyboard.nextInt();
		String S  = keyboard.next();
        int b  = keyboard.nextInt();

           if(S.equals("+")){
              System.out.println(a+b);
           }else{
              System.out.println(a-b);
           }
  }
}

Measured memory_bytes: 21844
#include <iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(void){
    // Your code here!
    int A,B,C;
    cin>>A>>B>>C;
    if(A<=C&&C<=B){
        cout<<"Yes"<<endl;
        }
        else{
            cout<<"No"<<endl;
        }
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <fstream>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <bitset>
#include <array>
#include <vector>
#include <queue>
#include <set>
#include <cmath> // 変数名にy1が使えなくなるかも…。
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <limits>
#include <functional>
#include <string>

typedef __int128_t int128_t;
std::istream &operator>>(std::istream& input, int128_t& value) { // int128_tの入力。入力が64bitに収まる前提。
    long long tmp; input >> tmp; value = tmp;
    return input;
}
std::ostream &operator<<(std::ostream& output, const int128_t value) { // int128_tの出力。出力が64bitに収まる前提。
    output << (long long)value;
    return output;
}

#define rep(i, begin, end) for(int64_t i = (begin); i <= (end); i++)
#define rev(i, begin, end) for(int64_t i = (begin); (end) <= i; i--)

void printvec(const std::vector<int>& vec) {
    for (int i = 0; i < vec.size(); i++) { std::cout << vec[i] << " "; } std::cout << std::endl;
}

const int MAX_N = 1e5 + 10;
const int MOD = 1e9 + 7;
std::string S;

int128_t dp[MAX_N][20] = {};

int main(int argc, char **argv) {
    std::cin >> S;
    
    dp[0][0] = 1;
    int128_t tmp = 1;
    
    rep (i, 1, S.size()) {
        char c = S[S.size() - i];

        if (c != '?') {
            int128_t num = c - '0';
            int m = (num * tmp) % 13;
            rep (j, 0, 12) {
                int prev = (j - m + 13) % 13;
                dp[i][j] = dp[i-1][prev];
            }
        } else {
            rep (x, 0, 9) {
                int m = (x * tmp) % 13;
                rep (j, 0, 12) {
                    int prev = (j - m + 13) % 13;
                    dp[i][j] += dp[i-1][prev];
                    dp[i][j] %= MOD;
                }
            }
        }
        tmp = (tmp * 10) % 13;
    }

    std::cout << dp[S.size()][5] << std::endl;
    

    return 0;
}

Measured memory_bytes: 31744
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
	vector<int> line;
	int pro;
	for(int i=0;i<10;++i)
	{
		cin>>pro;
		line.push_back(pro);
	}
	sort(line.begin(),line.end());
	for(int i=9;i>6;--i)
	{
		cout<<line[i]<<endl;
	}
	return 0;
}

Measured memory_bytes: 1216
#include <bits/stdc++.h>
using namespace std;
#define fori(i, a, b) for(int i = (int) a; i <= (int) b; ++i)
#define rofi(i, b, a) for(int i = (int) b; i >= (int) a; --i)
#define foreach(tt, a) for(auto &tt: a)
#define all(a) begin(a), end(a)
#define csz(a) (int) a.size()
#define pb push_back
#define epb emplace_back
#define mp make_pair
#define load(a, v) fill(begin(a), end(a), v)
#define load_mem(a, v) memset(a, v, sizeof(a));
#define iostream_optimize() ios::sync_with_stdio(false); cin.tie(0);
using ll = long long;
const ll MOD = 1e9+7, LINF = 1e16+1;
const int INF = 1e9+1;
const double EPS = 1e-10;
const int dx[4] = {-1, 0, 1, 0}, dy[4] = {0, 1, 0, -1};
const ll P1 = 31, P2 = 37, M1 = 1e9+7, M2 = 1e9+9;
 
// #include <ext/pb_ds/tree_policy.hpp>
// #include <ext/pb_ds/assoc_container.hpp>
// using namespace __gnu_pbds;
// template <typename T>
// using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
/* <<<<<<<<<<<<<<<<<<<<<<<<<<<< END TEMPLATE >>>>>>>>>>>>>>>>>>>>>>>>>>> */
const int N = 1 << 18;

int pw, n, a[N], mx1[N], mx2[N], res[N];

void update(int i, int v) {
	if(v > mx1[i]) mx2[i] = mx1[i], mx1[i] = v;
	else if(v > mx2[i]) mx2[i] = v;
}

int main() {
	iostream_optimize();
	cin >> pw;
	n = 1 << pw;
	fori(i, 0, n-1) cin >> a[i], mx1[i] = a[i];
	fori(j, 0, pw-1) fori(mask, 0, n-1) {
		if(mask >> j & 1) continue;
		update(mask | (1 << j), mx1[mask]);
		update(mask | (1 << j), mx2[mask]);
	}
	fori(k, 0, n-1) {
		if(k) res[k] = res[k-1];
		res[k] = max(mx1[k] + mx2[k], res[k]);
		if(k) cout << res[k] << '\n';
	}
}

Measured memory_bytes: 7168
#include <bits/stdc++.h>
using namespace std;
#define Sz(a) ((int)(a).size())
const int maxn = 200009;
const int MOD = 1e9 + 7;
int main(){
#ifdef LOCAL
  freopen("a.in", "r", stdin);
#endif
  ios_base::sync_with_stdio(false),cout.tie(0),cin.tie(0);
  int a;cin>>a;
  cout<<a+a*a+a*a*a<<'\n';
  
  return 0;
}
//2020.06.27 20:00:33


Measured memory_bytes: 3648