akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
// using ll = long long;
// using P = pair<int,int>;

int main() {
    int N;
    cin >> N;
    if (N % 2 == 0) {
        cout << N/2 << endl;
    }
    else {
        cout << N/2 + 1 << endl;
    }
}

Measured memory_bytes: 256
lines = readlines.map{|line| line.split(' ').map(&:to_i)}
a=lines[1].sort.permutation(lines[0][0]).to_a
b=0
c=0
for i in 0..a.length-1
  if a[i]==lines[1] then
    b=i
  end
  if a[i]==lines[2] then
    c=i
  end
end
puts (b-c).abs

Measured memory_bytes: 6780
import sys

line = sys.stdin.readline().strip()
N = int(line)

line = sys.stdin.readline().strip()
a = [int(x) for x in line.split()]

xs = {}
for i in a:
    xs[i] = xs.get(i, 0) + 1

r = 0
for k in xs:
    if xs[k] < k:
        r += xs[k]
    elif xs[k] > k:
        r += xs[k] - k

print(r)


Measured memory_bytes: 19092
def bubble(x):
    x = x + []
    n = len(x)
    for i in range(n):
        for j in range(i+1,n)[::-1]:
            if x[j] % 10 < x[j-1] % 10:
                x[j], x[j-1] = x[j-1], x[j]
    return x

def selection(x):
    x = x + []
    n = len(x)
    for i in range(n):
        mini = i
        for j in range(i, n):
            if x[j] % 10 < x[mini] % 10:
                mini = j
        if i != mini:
            x[i], x[mini] = x[mini], x[i]
    return x
    
def order(x):
    y = []
    for i in range(1,9):
        y.extend([e for e in x if e % 10 == i])
    return y

def output(x):
    for e in x:
        print 'SHDC'[e/10]+str(e % 10),
    print

def check(x, y):
    output(x)
    if y == order(x): 
        print 'Stable'
    else:
        print 'Not stable'
    return

n = input()
x = []
for s in raw_input().split():
    x.append('SHDC'.index(s[0])*10 + int(s[1]))
x0 = order(x)
check(bubble(x), x0)
check(selection(x), x0)

Measured memory_bytes: 4284
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var s = Read();
            var w = ReadInt();
            var ans = "";
            for (int i = 0; i < s.Count(); i+=w)
            {
                ans += s[i];
            }
            WriteLine(ans);
        }
        

        private static string Read() { return ReadLine(); }
        private static string[] Reads() { return (Read().Split()); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }

        //最大公約数
        
        public static int Gcd(int a, int b)
        {
            if (a < b)
            {
                return Gcd(b, a);
            }
            while (b != 0)
            {
                var reminder = a % b;
                a = b;
                b = reminder;
            }
            return a;
        }

        //最小公倍数
        public static int Lcm(int a, int b)
        {
            return a * b / Gcd(a, b);
        }

        //文字数を数える
        public static int CountChar(string s, char c)
        {
            return s.Length - s.Replace(c.ToString(), "").Length;
        }
    }
}


Measured memory_bytes: 13524
sentence = input().split()
longest = sentence[0]
dictionary = {}
for word in sentence:
    if word in dictionary:
        dictionary[word] += 1
    else:
        dictionary[word] = 0
    if len(word) > len(longest):
        longest = word
mode_value = 0
mode_key = 0
for word in dictionary:
    if mode_value < dictionary[word]:
        mode_value = dictionary[word]
        mode_key = word
print(mode_key, longest)

Measured memory_bytes: 5560
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define MOD2 998244353
float PHI = 1.6180339;
const float  PI_F=3.14159265358979f;
#define MAX 100000 
#define endl "\n"    
#define manhunt 32 
//typedef long long float;
#define int long long
typedef pair<int, int> pii;
//#define float unsigned long long
#define FAST ios_base::sync_with_stdio(false);cin.tie();cout.tie();
 
bool sortbysec(const pair<int,int> &a, 
                   const pair<int,int> &b) 
{ 
       return a.second<b.second; 
}
 
bool sortbysec1(const pair<int,int> &a, 
                   const pair<int,int> &b) 
{ 
       return a.second>b.second; 
}
 
bool isPrime(int n) 
{ 
    if (n <= 1) 
        return false; 
    if (n <= 3) 
        return true; 
 
    if (n % 2 == 0 || n % 3 == 0) 
        return false; 
  
    for (int i = 5; i * i <= n; i = i + 6) 
        if (n % i == 0 || n % (i + 2) == 0) 
            return false; 
  
    return true; 
} 

string query(int mid)
{
  cout << mid << endl;
  string s;
  cin >> s;
  return s;
}

int maxSubArraySum(int a[], int size) 
{ 
   int max_so_far = a[0]; 
   int curr_max = a[0]; 
  
   for (int i = 1; i < size; i++) 
   { 
        curr_max = max(a[i], curr_max+a[i]); 
        max_so_far = max(max_so_far, curr_max); 
   } 
   return max_so_far; 
} 

int32_t main()
{
    FAST
    cout << fixed << setprecision(17);

    char ch;
    cin>>ch;
    string s="abcdefghijklmnopqrstuvwxyz";
    for(int i=0;i<s.length();i++)
    {
        if(s[i]==ch)
        {
            cout<<s[i+1]<<endl;
        }
    }
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)
using namespace std;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll r,D,x;
	cin>>r>>D>>x;
	REP(i,10){
		x=r*x-D;
		cout<<x<<endl;
	}
}

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

using namespace std;

int main(){
    string hi1;
    string hi2;
    int counter = 0;
    cin >> hi1 >> hi2;
    for(int i =0; i < hi1.length();i++){
        if(hi1[i]==hi2[i]){counter+=1;}
    }
    cout << counter;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define itn int
#define REP(i, n) for (int i = 0; i < n; i++)
#define IREP(i, n) for (int i = n - 1; i >= 0; i--)
#define REPEACH(i,k) for(auto& i:k)
#define all(a) a.begin(),a.end()
#define MOD 1000000007
#define int long long
using namespace std;
typedef long long ll;

const ll INF = 1LL << 60;

signed main() {
	int n;
	cin >> n;
	vector<string> s(n);
	map<char,int> m;
	vector<map<char,int>> m2(n);
	REP(i,n){
		cin >> s[i];
		REP(j,s[i].size()){
			m2[i][s[i][j]]++;
		}
		REPEACH(j,m2[i]){
			if(m.find(j.first)==m.end()){
				if(i==0){
					m[j.first]=j.second;
				}
				else{
					continue;
				}
			}
			else{
				m[j.first]=min(j.second,m[j.first]);
			}
		}
	}
	string ans="";
	REPEACH(i,m){
		bool flag=true;
		REP(j,n){
			if(m2[j].find(i.first)==m2[j].end()){
				flag=false;
				break;
			}
		}
		if(flag){
			REP(j,i.second){
			ans+=i.first;
		}
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 384
from math import sin

N = int(input())
XY = [tuple(map(int, input().split())) for _ in range(N)]

def dist(x, y, u, v):
    return ((x - u)**2 + (y - v)**2)**0.5

ans = 10**10

for i in range(N):
    for j in range(i + 1, N):
        # 対辺
        xi, yi = XY[i]
        xj, yj = XY[j]
        cx = (xi + xj) / 2
        cy = (yi + yj) / 2
        d = 0
        for x, y in XY:
            d = max(d, dist(x, y, cx, cy))
        ans = min(ans, d)

        for k in range(j + 1, N):
            xi, yi = XY[i]
            xj, yj = XY[j]
            xk, yk = XY[k]
            c = dist(xi, yi, xj, yj)
            a = dist(xj, yj, xk, yk)
            b = dist(xk, yk, xi, yi)

            # 外心
            S = a**2 * (b**2 + c**2 - a**2) + b**2 * (c**2 + a**2 - b**2) + c**2 * (a**2 + b**2 - c**2)
            if S == 0:
                continue
            cx = a**2 * (b**2 + c**2 - a**2) * xi + b**2 * (c**2 + a**2 - b**2) * xj + c**2 * (a**2 + b**2 - c**2) * xk
            cy = a**2 * (b**2 + c**2 - a**2) * yi + b**2 * (c**2 + a**2 - b**2) * yj + c**2 * (a**2 + b**2 - c**2) * yk
            cx /= S
            cy /= S
            d = 0
            for x, y in XY:
                d = max(d, dist(x, y, cx, cy))
            ans = min(ans, d)

print(ans)


Measured memory_bytes: 3188
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <climits>
#include <cmath>
#include <complex>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <iomanip>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <cstdint>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
#define MP make_pair
#define PB push_back
#define inf 1000000007
#define rep(i,n) for(int i = 0; i < (int)(n); ++i)
#define all(x) (x).begin(),(x).end()

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}
 
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;
}

int main(){
    int a,b,c,k;
    cin >> a >> b >> c >> k;
    int sm = 0;
    while(k>0){
        if(a>0){
            sm += min(k,a);
            k -= min(k,a);
            a = 0;
        }else if(b>0){
            k -= min(k,b);
            b = 0;
        }else{
            sm -= min(k,c);
            c = 0;
            k = 0;
        }
    }
    cout << sm << endl;
    return 0;
}

Measured memory_bytes: 3160
#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <numeric>
#include <iomanip>
#define ll long long int
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
using namespace std;
int mx4[] = {0,1,0,-1};
int my4[] = {1,0,-1,0};
int mx2[] = {1,0};
int my2[] = {0,1};

class AHaiku {
public:
	void solve(istream& in, ostream& out) {
        string s; in >> s;
        rep(i,5) out << s[i];
        out << " ";
        for(int i = 6; i < 13; i++) out << s[i];
        out << " ";
        for(int i = 14; i < 19; i++) out << s[i];
        out << endl;
	}
};

int main() {
	AHaiku solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}

Measured memory_bytes: 256
require 'pp'
a, b, c, d = gets.chomp.chars.map(&:to_i)
[:+, :-].repeated_permutation(3) do |op1,op2,op3|
  res = a.send(op1,b).send(op2,c).send(op3,d)
  if res == 7
    puts "#{a}#{op1.to_s}#{b}#{op2.to_s}#{c}#{op3.to_s}#{d}=7"
    exit
  end
end


Measured memory_bytes: 2172
num = raw_input()
num_list = raw_input().split()
num_list = map(int, num_list)
count = 0 

def bubble_sort(num_list, count):
    flag = True
    i = 0 
    while flag:
        flag = False
        for j in range(len(num_list)-1, i, -1):
            if num_list[j-1] > num_list[j]:
                temp = num_list[j]
                num_list[j] = num_list[j-1]
                num_list[j-1] = temp
                count += 1
                flag = True
        i += 1
    return count

count = bubble_sort(num_list, count)

num_list =  map(str, num_list)
print " ".join(num_list)
print count

Measured memory_bytes: 6348
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;
import java.util.PriorityQueue;

public class Main {
	int N;
	char[] ch;
	boolean[] used;

	public int dfs(int n,int d){
		//System.out.println(n + " " + d);
		int depth = d + 1;
		int add = 1;
		PriorityQueue<Integer> pq = new PriorityQueue<Integer>();
		while(depth > d){
			if(ch[n + add] == '['){
				used[n + add] = true;
				pq.add(dfs(n + add,depth));
				while(used[n + add]){
					add++;
				}
			}else if(ch[n + add] == ']'){
				//System.out.println((n + add) + " " + d);
				used[n + add] = true;
				depth--;
			}else{
				StringBuilder sb = new StringBuilder();
				while(ch[n + add] != ']'){
					used[n + add] = true;
					sb.append(ch[n + add]);
					add++;
				}
				used[n + add] = true;
				depth--;
				add++;
				pq.add(Integer.parseInt(sb.toString()) / 2 + 1);
			}
		}
		int size = pq.size() / 2 + 1;
		int sum = 0;
		for(int j = 0;j < size;j++){
			sum += pq.poll();
		}
		return sum;
	}

	public void solve() {
		N = nextInt();
		while(N-- > 0){
			ch = next().toCharArray();
			used = new boolean[ch.length];
			used[0] = true;
			out.println(dfs(0,0));
		}
	}

    public static void main(String[] args) {
        out.flush();
        new Main().solve();
        out.close();
    }

    /* Input */
    private static final InputStream in = System.in;
    private static final PrintWriter out = new PrintWriter(System.out);
    private final byte[] buffer = new byte[2048];
    private int p = 0;
    private int buflen = 0;

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

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

    private boolean isPrint(int ch) {
        if (ch >= '!' && ch <= '~')
            return true;
        return false;
    }

    private int nextByte() {
        if (!hasNextByte())
            return -1;
        return buffer[p++];
    }

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

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

    public long nextLong() {
        return Long.parseLong(next());
    }

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

Measured memory_bytes: 41292
#include <bits/stdc++.h>
using namespace std;
#define LL long long
#define inf 0x3f3f3f3f3f3f3f3fll
LL sp[100100],val[200100];
int to[200100],nxt[200100],head[100100],tot,n,q,k;
bool done[100100];
struct node{int d;LL l;};
bool operator < (node a,node b){return a.l > b.l;}
inline void add(int s,int t,LL v){to[++tot] = t;val[tot] = v;nxt[tot] = head[s];head[s] = tot;}
inline void dijkstra(int s)
{
    priority_queue<node>q;
    memset(sp,0x3f,sizeof sp);memset(done,false,sizeof done);
    sp[s] = 0;q.push((node){s,0ll});
    while(!q.empty())
    {
        int wd = q.top().d;q.pop();if(done[wd])continue;
        done[wd] = true;
        for(int i = head[wd];i;i = nxt[i])if(sp[wd] + (LL)val[i] < sp[to[i]])
            sp[to[i]] = sp[wd] + (LL)val[i],q.push((node){to[i],sp[to[i]]});
    }
}
int main()
{
	scanf("%d",&n);
	for(int i = 1,p1,p2;i < n;i++)
	{
		LL v;
		scanf("%d%d%lld",&p1,&p2,&v),add(p1,p2,v),add(p2,p1,v);
	}
	scanf("%d%d",&q,&k);
	dijkstra(k);
	for(int i = 1,a,b;i <= q;i++)
	{
		scanf("%d%d",&a,&b);
		printf("%lld\n",sp[a] + sp[b]);
	}
}

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


int main(){
	ll n,k;
	string s;
	cin>>n>>s>>k;
	k--;
	char c=s[k];
	for(int i=0;i<s.size();i++)if(s[i]!=c)s[i]='*';
	cout<<s;
	return 0;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val an = readLine()!!.split(" ").map { it.toInt() }

    var x = 1
    var ans = 0
    for (a in an) {
        if (a == x) {
            x++
        } else {
            ans++
        }
    }
    if (ans == n) {
        ans = -1
    }
    println(ans)
}



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

#define pb push_back
#define mk make_pair
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define all(S) (S).begin(), (S).end()
#define debug(a) cerr << #a << " = " << a << endl;
#define debug2(a,b) cerr << #a << " = " << a << " --- " << #b << " = " << b << endl;
#define debugM(M, l, c ) rep( i, 0, l ){ rep( j, 0, c ){ cerr << M[i][j] << " "; } cerr << endl; }
#define debugP(p) cerr << #p << " = " << p.x << " --- " << #p << " = " << p.y << endl;
#define MOD 1000000007
#define MAX 1005

using namespace std;

typedef long long int ll;
typedef pair<int, int> ii;
const int INF = 0x3f3f3f3f;

int dx[] = {0, 1};
int dy[] = {1, 0};

int n, m;
char mat[MAX][MAX];
ll pd[MAX][MAX];

bool check(int i, int j) {
    if(i < 0 || i >= n || j < 0 || j >= m || mat[i][j] == '#') return false;
    return true;
}

ll solve(int i, int j) {
    if(i == n-1 && j == m-1) return 1;

    ll &ans = pd[i][j];
    if(ans != -1) return ans;

    ans = 0;

    rep(k, 0, 2) {
        int x = i + dx[k];
        int y = j + dy[k];

        if(check(x, y))
            ans = (ans%MOD + solve(x, y)%MOD)%MOD;
    }

    return ans;
}

int main(void) {
	cin >> n >> m;
	
    rep(i, 0, n)
        rep(j, 0, m)
            cin >> mat[i][j];

    memset(pd, -1, sizeof(pd));
    ll ans = solve(0, 0);
	cout << (ans == -INF ? 0 : ans) << endl;

	return 0;
}

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

using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<string> vs;
using pll = pair<ll, ll>;
using vl = vector<ll>;
using vll = vector<vl>;
using vpll = vector<pll>;
struct Edge {
	ll to;
 	ll cost;
 };
using Graph = vector<vector<Edge>>;

#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
/***** define constant start *******/
const ll MOD = 1000000007;
const double PI = 3.1415926535897932;
const ll INF = LLONG_MAX;
string ch = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
/****** define constant end ********/
/****** define variable start ******/
ll h, w;
/******* define variable end *******/
int solve() {
	string s;
	cin >> s;
	ll a = 0, b = 0, c = 0;
	REP(i, s.size()){
		if(s.substr(i, 1) == "a") a++;
		if(s.substr(i, 1) == "b") b++;
		if(s.substr(i, 1) == "c") c++;
	}
	ll n = s.size();
	if(n % 3 == 0){
		if(a != n/3 || b != n/3 || c != n/3){
			cout << "NO" << endl;
		}else{
			cout << "YES" << endl;
		}
	}else if(n % 3 == 1){
		if((a != n/3 + 1 || b != n/3 || c != n/3) && (a != n/3 || b != n/3 + 1|| c != n/3) && (a != n/3 || b != n/3 || c != n/3+1)){
			cout << "NO" <<endl;
		}else{
			cout << "YES" <<endl;
		}
	}else{
		if((a != n/3 + 1 || b != n/3 + 1 || c != n/3) && (a != n/3 || b != n/3 + 1 || c != n/3+1) && (a != n/3 + 1 || b != n/3 || c != n/3+1)){
			cout <<"NO" <<endl;
		}else{
			cout << "YES" <<endl;
		}
	}
	return 0;
}

int main() {
	// clock_t start = clock();
	cout << std::fixed << std::setprecision(10);
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int end_solve = solve();
	/*
	clock_t end = clock();
	const double time = static_cast<double>(end - start) / CLOCKS_PER_SEC *
	1000.0; printf("time %lf[ms]\n", time);
	*/

	return end_solve;
}


Measured memory_bytes: 512
#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl '\n'
#define ff first
#define ss second
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define int long long
#define all(a) a.begin(), a.end()
#define inf (1LL<<61)
#define print_time cerr << "Time elapsed: " << 1000.0 * clock() / CLOCKS_PER_SEC << "ms\n";
#define ull unsigned long long
#define debug1(x) cerr << #x << ": " << x <<'\n'
#define debug2(x, y) cerr << #x << ": " << x << '\t' << #y << ": " << y <<'\n'
#define debug3(x, y, z) cerr << #x << ": " << x << '\t' << #y << ": " << y << '\t' << #z << ": " << z <<'\n'
using namespace std;
int dx[]={1,0,-1,0};int dy[]={0,1,0,-1}; //4 Direction
//int dx[]={1,1,0,-1,-1,-1,0,1};int dy[]={0,1,1,1,0,-1,-1,-1};//8 direction
int gcd(int x,int y)
{
    if(y==0)
	return x;
    else
	return gcd(y,x%y);
}
int expo(int n,int m,int p)   //modULAR EXPONENTIATION
{
    int r=1;
    n=n%p;
    while(m>0)
    {
	if(m%2)
	    r=(r*n)%p;
	n=(n*n)%p;
	m=m/2;
    }
    return r%p;
}
bool isPrime(int n)
{
    // Corner cases
    if (n <= 1)  return false;
    if (n <= 3)  return true;
 
    // This is checked so that we can skip 
    // middle five numbers in below loop
    if (n%2 == 0 || n%3 == 0) return false;
 
    for (int i=5; i*i<=n; i=i+6)
	if (n%i == 0 || n%(i+2) == 0)
	   return false;
 
    return true;
}
vector<int> z_function(string s) {
    int n = (int) s.length();
    vector<int> z(n);
    for (int i = 1, l = 0, r = 0; i < n; ++i) {
	if (i <= r)
	    z[i] = min (r - i + 1, z[i - l]);
	while (i + z[i] < n && s[z[i]] == s[i + z[i]])
	    ++z[i];
	if (i + z[i] - 1 > r)
	    l = i, r = i + z[i] - 1;
    }
    return z;
}
int n,p;
int a[100];
int dp[100][2];
int solve(int i,int r)
{
	if(i==n)
	{
		if(r==p)
			return 1;
		return 0;
	}
	if(dp[i][r]!=-1)
		return dp[i][r];
	int ans=solve(i+1,r)+solve(i+1,(r+a[i])%2);
	dp[i][r]=ans;
	return ans;
}
int32_t main()
{
   IOS;
  /* #ifndef ONLINE_JUDGE
   freopen("input.txt","r",stdin); 
   freopen("output.txt","w",stdout);
   #endif
   /********************* Code starts here ***********************/     
   cin>>n>>p;
   memset(dp,-1,sizeof(dp));
   for(int i=0;i<n;i++)
   {
   	cin>>a[i];
   }
   cout<<solve(0,0)<<endl;
} 		 

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

int main() {
  while (1) {
    int n, x;
    cin >> n >> x;

    if (n == 0 && x == 0) { break; }

    int ans = 0;
    for (int i = 1; i <= n; i++) {
      for (int j = i + 1; j <= n; j++) {
        for (int k = j + 1; k <= n; k++) {
          int sum = i + j + k;
          if (sum == x) {
            ans++;
          }
        }
      }
    }

    cout << ans << endl;
  }

  return 0;
}



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

using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(int i=n; i>-1; --i)
#define ALL(a) (a).begin(),(a).end()
#define FILL(a,n,x); REP(i,(n)){ (a)[i]=(x); }
#define CINA(a,n); REP(i,(n)){ cin >> (a)[i]; }
#define FILL2(a,n,m,x); REP(i,(n)){ REP(j,(m)){(a)[i][j]=(x);} }
#define CINA2(a,n,m); REP(i,(n)){ REP(j,(m)){cin >> (a)[i][j];} }
#define Liny "Yes\n"
#define Linn "No\n"
#define LINY "YES\n"
#define LINN "NO\n"

#define umap unordered_map
//cout << setfill('0') << right << setw(4) << 12; // "0012"
int keta(ll x){ if(x<10){return 1;} else{return keta(x/10) + 1;}}
int keta_wa(ll x){ if(x<10){return x;} else{return keta_wa(x/10) + x%10;} }
int ctoi(char c){ return ( (c>='0' && c<='9')? c - '0': 0 );}
int __stoi(string s){ return atoi(s.c_str()); }
ll sum(ll a[],ll N){ return accumulate(a,a+N,0LL);}
ll gcd(ll a,ll b){if(a<b)swap(a,b); return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){if(a<b){swap(a,b);} return a/gcd(a,b)*b;}
template<class T> void chmax(T& a, T b){ if(a<b){a=b;} }
template<class T> void chmin(T& a, T b){ if(a>b){a=b;} }




int main(){
    int N,K; cin>>N>>K;
    umap<int,int> mp;
    REP(count,K){
        int d; cin>>d;
        REP(dount,d){
            int a; cin>>a;
            ++mp[a];
        }
    }
    int ans = 0;
    for(int i=1;i<=N;++i){
        if(mp[i]==0){++ans;}
    }
    cout << ans <<"\n";
}

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

int main(){
  long long H, W;
  cin >> H >> W;
  long long ans;
  if(H != 1 && W != 1){
    long long a = H*(W/2), b = (H/2 + H%2) * (W%2);
    ans = a + b;
  }else{
    ans = 1;
  }
  printf("%lld\n",ans);
}
  


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

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

    static class TaskAtCoder
    {
        public void solve(int testNumber, Scanner in, PrintWriter out)
        {
            int N = in.nextInt();
            int A[] = CPUtils.readIntArray(N, in);
            for (int el : A)
            {
                if (el % 2 == 0)
                {
                    if (el % 3 != 0 && el % 5 != 0)
                    {
                        out.print("DENIED");
                        return;
                    }
                }
            }
            out.print("APPROVED");
        }

    }

    static class CPUtils
    {
        public static int[] readIntArray(int size, Scanner in)
        {
            int[] array = new int[size];
            for (int i = 0; i < size; i++)
            {
                array[i] = in.nextInt();
            }
            return array;
        }

    }
}



Measured memory_bytes: 23892
#include <float.h>
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

// 内部定数
#define D_MOD			998244353								// 除数(10の9乗+7)
#define D_ARRAY_MAX		100005									// 最大配列数

// 内部変数
static FILE *szpFpI;											// 入力
static int si1LCnt[D_ARRAY_MAX];								// 個数[距離]
static int siACnt;												// 配列数

// 内部変数 - テスト用
#ifdef D_TEST
	static int siRes;
	static FILE *szpFpA;
	static int siTNo;
#endif

// １行出力
int
fOutLine(
	char *pcpLine				// <I> １行
)
{
	char lc1Buf[1024];

#ifdef D_TEST
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, pcpLine)) {
		siRes = -1;
	}
#else
	printf("%s", pcpLine);
#endif

	return 0;
}

// べき乗 - 取得
int
fGetModPower(
	int piBase					// <I> 基数
	, int piIdx					// <I> 指数
)
{
	// 平方リスト - 作成
	int li1Val[100];
	li1Val[0] = piBase;
	int liCnt = 1;
	int liIdx = 1;
	while (piIdx > liIdx) {
		li1Val[liCnt] = (int)((long long)li1Val[liCnt - 1] * (long long)li1Val[liCnt - 1] % D_MOD);
		liCnt++;
		liIdx += liIdx;
	}

	// べき乗 - 取得
	int liVal = 1;
	while (piIdx > 0) {
		if (piIdx >= liIdx) {
			piIdx -= liIdx;
			liVal = (int)((long long)liVal * (long long)li1Val[liCnt - 1] % D_MOD);
		}
		liCnt--;
		liIdx /= 2;
	}

	return liVal;
}

// 実行メイン
int
fMain(
)
{
	int i;
	char lc1Buf[1024];

	// 配列数 - 取得
	fgets(lc1Buf, sizeof(lc1Buf), szpFpI);
	sscanf(lc1Buf, "%d", &siACnt);

	// 頂点１ - 取得
	int liLen;
	fscanf(szpFpI, "%d", &liLen);
	if (liLen != 0) {
		return 0;
	}

	// 頂点２以降 - 取得
	int liMax = 0;
	for (i = 1; i < siACnt; i++) {
		fscanf(szpFpI, "%d", &liLen);
		si1LCnt[liLen]++;
		if (liMax < liLen) {
			liMax = liLen;
		}
	}
	fgets(lc1Buf, sizeof(lc1Buf), szpFpI);

	// 距離０
	if (si1LCnt[0] > 0) {
		return 0;
	}

	// パターン数 - 取得
	int liPCnt = 1;
	for (i = 2; i <= liMax; i++) {

		// 個数 - チェック
		if (si1LCnt[i - 1] < 1) {
			return 0;
		}

		// パターン数 - 乗算
		liPCnt = (int)((long long)liPCnt * (long long)fGetModPower(si1LCnt[i - 1], si1LCnt[i]) % D_MOD);
	}

	return liPCnt;
}

// １回実行
int
fOne(
)
{
	int liRet;
	char lc1Buf[1024];

	// データ - 初期化
	memset(si1LCnt, 0, sizeof(si1LCnt));						// 個数

	// 入力 - セット
#ifdef D_TEST
	sprintf(lc1Buf, ".\\Test\\T%d.txt", siTNo);
	szpFpI = fopen(lc1Buf, "r");
	sprintf(lc1Buf, ".\\Test\\A%d.txt", siTNo);
	szpFpA = fopen(lc1Buf, "r");
	siRes = 0;
#else
	szpFpI = stdin;
#endif

	// 実行メイン
	liRet = fMain();

	// 出力
	sprintf(lc1Buf, "%d\n", liRet);
	fOutLine(lc1Buf);

	// 残データ有無
#ifdef D_TEST
	lc1Buf[0] = '\0';
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, "")) {
		siRes = -1;
	}
#endif

	// テストファイルクローズ
#ifdef D_TEST
	fclose(szpFpI);
	fclose(szpFpA);
#endif

	// テスト結果
#ifdef D_TEST
	if (siRes == 0) {
		printf("OK %d\n", siTNo);
	}
	else {
		printf("NG %d\n", siTNo);
	}
#endif

	return 0;
}

// プログラム開始
int
main()
{

#ifdef D_TEST
	int i;
	for (i = D_TEST_SNO; i <= D_TEST_ENO; i++) {
		siTNo = i;
		fOne();
	}
#else
	fOne();
#endif

	return 0;
}



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

const int mod = 1000000007;

struct mint {
    ll x;

    mint(ll x = 0) : x((x % mod + mod) % mod) {}

    mint operator-() const { return mint(-x); }

    mint &operator+=(const mint a) {
      if ((x += a.x) >= mod) x -= mod;
      return *this;
    }

    mint &operator-=(const mint a) {
      if ((x += mod - a.x) >= mod) x -= mod;
      return *this;
    }

    mint &operator*=(const mint a) {
      (x *= a.x) %= mod;
      return *this;
    }

    mint operator+(const mint a) const {
      mint res(*this);
      return res += a;
    }

    mint operator-(const mint a) const {
      mint res(*this);
      return res -= a;
    }

    mint operator*(const mint a) const {
      mint res(*this);
      return res *= a;
    }

    mint pow(ll t) const {
      if (!t) return 1;
      mint a = pow(t >> 1);
      a *= a;
      if (t & 1) a *= *this;
      return a;
    }

    mint inv() const {
      return pow(mod - 2);
    }

    mint &operator/=(const mint a) {
      return (*this) *= a.inv();
    }

    mint operator/(const mint a) const {
      mint res(*this);
      return res /= a;
    }
};

const int N = 2000020;
mint table[N];

void init() {
  table[0] = table[1] = 1;
  for (ll i = 2; i < N; i++) {
    table[i] = table[i - 1] * i;
  }
}

mint nCr(int n, int r) {
  return table[n] / table[r] / table[n - r];
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  int x,y;
  cin >> x >> y;

  init();
  int steps = (x + y) / 3;
  int u = -1;
  int r = -1;
  for (int i = 0; i <= steps; i++) {
    int tmp_x = i + (steps - i)  * 2;
    int tmp_y = i * 2 + (steps - i);
    if(tmp_x == x && tmp_y == y) {
      u = i;
      r = (steps - i);
      break;
    }
  }

  if(u == -1) {
    cout << 0 << '\n';
    return 0;
  }

  mint answer = table[steps] / table[u] / table[r];
  cout << answer.x << '\n';
}


Measured memory_bytes: 19268
let () =
  let rec loop () =
    let a,b,c = Scanf.sscanf (read_line ()) "%d %d %d" (fun a b c -> a,b,c) in
    if a = -1 && b = -1 && c = -1 then ()
    else
      begin
        let grade =
          if a = -1 || b = -1 then 'F'
          else if a + b >= 80 then 'A'
          else if a + b >= 65 then 'B'
          else if a + b >= 50 then 'C'
          else if a + b >= 30 then if c >= 50 then 'C' else 'D'
          else 'F'
        in
        Printf.printf "%c\n" grade;
        flush stdout;
        loop ();
      end
  in
        
  loop ()
;;


Measured memory_bytes: 2252
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
#define bit(n) (1LL << (n))
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1000000007;

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

int main() {
  int n;
  cin >> n;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];
  sort(all(a));
  ll x = a[n - 1];
  ll y;

  double th = (double)x / 2.0;
  auto iter = lower_bound(all(a), th);
  int pos = distance(a.begin(), iter);
  ll cand1 = *iter;
  ll cand2 = (pos > 0) ? (*(iter - 1)) : -1;
  if (cand1 - th < th - cand2) {
    y = cand1;
  } else {
    y = cand2;
  }

  cout << x << ' ' << y << endl;
}

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

using namespace std;

vector<vector<int>> point;
vector<int> grap;
vector<int> beg;
int n,m,node;
int dist[100005];
int s[100004*4+20];
bool v[100005];
int form[100004];
int in[100004];
int spfa(int start)
{
    memset(dist,255,sizeof(dist));
    memset(s,0,sizeof(s));
    memset(v,true,sizeof(v));
    v[start]=false;
    dist[start]=0;
    int h,t;
    h=0;t=1;
    int len=100004*4;
    s[t]=start;
    int ans=0;
    do
    {
     h=(h%len)+1;
     int now=s[h];
     int p=grap[now];
     while (p!=0)
      {
        if (dist[point[p][0]]<dist[now]+1)
        {
         dist[point[p][0]]=dist[now]+1;
         if (dist[point[p][0]]>ans)ans=dist[point[p][0]];
         if (v[point[p][0]])
         {
          t=(t%len)+1;
          s[t]=point[p][0];
          v[s[t]]=true;
         }
        }
        p=point[p][1];
      }
    }while ((h!=t));
return ans;
}


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

    grap.resize(n+1,0);
    vector<int> TT;
    TT.resize(2,0);
    point.push_back(TT);
    node=0;
     memset(in,0,sizeof(in));
    memset(v,true,sizeof(v));
    for (int i=1;i<=m;i++)
    {
     int p,q;
     cin>>p>>q;
     node++;
     vector<int> temp;
     temp.resize(2);
     temp[0]=q;
     temp[1]=grap[p];
     grap[p]=node;
     point.push_back(temp);
     in[q]++;
     v[q]=false;
    }
    //for (int i=1;i<=n;i++) if (v[i]) beg.push_back(i);
   // cout<<endl;
    int ans=0;
    int h=0,t=0;
    memset(dist,255,sizeof(dist));
    memset(s,0,sizeof(s));
   // memset(v,true,sizeof(v));
    for (int i=1;i<=n;i++)
      if (v[i])
     {
       t++;
       s[t]=i;
       dist[i]=0;
     }
    while (h!=t)
    {
     h++;
     int p=grap[s[h]];
     while (p!=0)
     {
     int q=point[p][0];
      if (dist[q]<dist[s[h]]+1)dist[q]=dist[s[h]]+1;
      if (dist[q]>ans) ans=dist[q];
      in[q]--;
      if (!in[q])
      {
       t++;
       s[t]=q;
      // cout<<q<<' '<<dist[q]<<endl;
      }
      p=point[p][1];
     }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 8880
# abc153_c.py
# https://atcoder.jp/contests/abc153/tasks/abc153_c

# C - Fennec vs Monster /
# 実行時間制限: 2 sec / メモリ制限: 1024 MB
# 配点 : 300点

# 問題文
# フェネックは N体のモンスターと戦っています。
# i番目のモンスターの体力は Hiです。
# フェネックは次の 2種類の行動を行うことができます。
#     攻撃：モンスターを 1体選んで攻撃することで、そのモンスターの体力を 1減らす
#     必殺技：モンスターを 1体選んで必殺技を使うことで、そのモンスターの体力を 0にする
# 攻撃と必殺技以外の方法でモンスターの体力を減らすことはできません。
# 全てのモンスターの体力を 0以下にすればフェネックの勝ちです。
# フェネックが K回まで必殺技を使えるとき、モンスターに勝つまでに行う攻撃の回数 (必殺技は数えません) の最小値を求めてください。

# 制約
#     1≤N≤2×105
#     0≤K≤2×105
#     1≤Hi≤109
#     入力中のすべての値は整数である。

# 入力
# 入力は以下の形式で標準入力から与えられる。
# N K
# H1 ... HN

# 出力
# フェネックがモンスターに勝つまでに行う攻撃の回数 (必殺技は数えない) の最小値を出力せよ。

# 入力例 1
# 3 1
# 4 1 5

# 出力例 1
# 5

# 3番目のモンスターに必殺技を使い、1 番目のモンスターに 4 回、2 番目のモンスターに 1 回攻撃を行うことで、攻撃の回数を 5回にできます。

# 入力例 2
# 8 9
# 7 9 3 2 3 8 4 6

# 出力例 2
# 0

# 全てのモンスターに必殺技を使うことができます。

# 入力例 3
# 3 0
# 1000000000 1000000000 1000000000

# 出力例 3
# 3000000000

# オーバーフローに注意してください。


global FLAG_LOG
FLAG_LOG = False


def log(value):
    # FLAG_LOG = True
    # FLAG_LOG = False
    if FLAG_LOG:
        print(str(value))


def calculation(lines):
    # S = lines[0]
    # N = int(lines[0])
    N, K = list(map(int, lines[0].split()))
    values = list(map(int, lines[1].split()))
    # values = list(map(int, lines[2].split()))
    # values = list()
    # for i in range(N):
    #     values.append(int(lines[i]))
    # valueses = list()
    # for i in range(N):
    #     valueses.append(list(map(int, lines[i+1].split())))

    if K >= N:
        result = 0
    else:
        values.sort()
        values = values[::-1]
        for k in range(K):
            values[k] = 0
        result = sum(values)

    return [result]


# 引数を取得
def get_input_lines(lines_count):
    lines = list()
    for _ in range(lines_count):
        lines.append(input())
    return lines


# テストデータ
def get_testdata(pattern):
    if pattern == 1:
        lines_input = ['3 1', '4 1 5']
        lines_export = [5]
    if pattern == 2:
        lines_input = ['8 9', ' 7 9 3 2 3 8 4 6']
        lines_export = [0]
    if pattern == 3:
        lines_input = ['3 0', '1000000000 1000000000 1000000000']
        lines_export = [3000000000]
    return lines_input, lines_export


# 動作モード判別
def get_mode():
    import sys
    args = sys.argv
    global FLAG_LOG
    if len(args) == 1:
        mode = 0
        FLAG_LOG = False
    else:
        mode = int(args[1])
        FLAG_LOG = True
    return mode


# 主処理
def main():
    import time
    started = time.time()
    mode = get_mode()
    if mode == 0:
        lines_input = get_input_lines(2)
    else:
        lines_input, lines_export = get_testdata(mode)

    lines_result = calculation(lines_input)

    for line_result in lines_result:
        print(line_result)

    # if mode > 0:
    #     print(f'lines_input=[{lines_input}]')
    #     print(f'lines_export=[{lines_export}]')
    #     print(f'lines_result=[{lines_result}]')
    #     if lines_result == lines_export:
    #         print('OK')
    #     else:
    #         print('NG')
    # finished = time.time()
    # duration = finished - started
    # print(f'duration=[{duration}]')


# 起動処理
if __name__ == '__main__':
    main()


Measured memory_bytes: 33464
#include <stdio.h>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
#include <functional>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef vector<vector<int>> v2int;
typedef vector<ll> vll;
typedef vector<vector<ll>> v2ll;
typedef list<int> liint;
typedef pair<int, int> pint;
const int INF = int(2e9);
const ll LINF = ll(2e20);
#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++)
template<class T, class C> void chmax(T& a, C b) { a>b ? : a = b; }
template<class T, class C> void chmin(T& a, C b) { a<b ? : a = b; }


int main() {
    int N;
    cin >> N;
    int t = 3;
    int i = 0;
    if (N == 1) {
        cout << "Yes" << endl;
        cout << 2 << endl;
        cout << 1 << " " << 1 << endl;
        cout << 1 << " " << 1 << endl;
        return 0;
    }
    while (1) {
        if (t == N)
            break;
        if (t > N) {
            cout << "No" << endl;
            return 0;
        }
        t += (3 + i);
        i++;
    }
    int k = i + 3;
    int l = k - 1;
    v2int table(k, vint(l));
    int pivot = 1;
    rep(i, k) {
        REP(j, i, l) {
            table[i][j] = pivot + j;
            table[j + 1][i] = pivot + j;
        }
        pivot += (l - 1 - i);
    }

    cout << "Yes" << endl;
    cout << k << endl;
    rep(i, k) {
        cout << l << " ";
        rep(j, l) {
            cout << table[i][j] << " ";
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 2176
#include <iostream>
#include <stdio.h>

using namespace std;

int main(void) {

  int w, n, a[31], b[31];
  cin >> w;
  cin >> n;
  for(int i = 1; i <= n; i++) {
    scanf("%d,%d", &a[i], &b[i]);
  }

  int line[w+1], tmp = 0;
  for(int j = 1; j <= w; j++) {
    line[j] = j;
  }
  for(int k = 1; k <= n; k++) {
    tmp = line[a[k]];
    line[a[k]] = line[b[k]];
    line[b[k]] = tmp;
    tmp = 0;
  }

  for(int l = 1; l <= w; l++) {
    cout << line[l] << '\n';
  }

  return 0;
}

Measured memory_bytes: 3144
import math

class Pos:
  def init(x, y):
    self.x = x
    self.y = y

def kock(n, p1, p2):
  if n == 0: return

  s, t = Pos(), Pos()
  s.x = (2 * p1.x + 1 * p2.x) / 3
  s.y = (2 * p1.y + 1 * p2.y) / 3
  t.x = (1 * p1.x + 2 * p2.x) / 3
  t.y = (1 * p1.y + 2 * p2.y) / 3

  cos60 = math.cos(math.radians(60))
  sin60 = math.sin(math.radians(60))

  u = Pos()
  u.x = (t.x - s.x) * cos60 - (t.y - s.y) * sin60 + s.x
  u.y = (t.x - s.x) * sin60 + (t.y - s.y) * cos60 + s.y

  kock(n-1, p1, s)
  print("{:.5f} {:.5f}".format(s.x, s.y))
  kock(n-1, s, u)
  print("{:.5f} {:.5f}".format(u.x, u.y))
  kock(n-1, u, t)
  print("{:.5f} {:.5f}".format(t.x, t.y))
  kock(n-1, t, p2)

n = int(input())

p1, p2 = Pos(), Pos()
p1.x, p1.y = 0.0, 0.0
p2.x, p2.y = 100.0, 0.0

print("{:.5f} {:.5f}".format(p1.x, p1.y))
kock(n, p1, p2)
print("{:.5f} {:.5f}".format(p2.x, p2.y))


Measured memory_bytes: 5816
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#define IO(i, o) freopen(i, "r", stdin), freopen(o, "w", stdout)

using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count());

int a, b, x;

int main(){
	//IO("input.txt", "output.txt");
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> a >> b >> x;
	cout << ((b >= x - a && x - a >= 0) ? "YES\n" : "NO\n");
	return 0;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int,input().split()))
s = [0 for _ in range(n)]
a.sort()
t = 0
for i in range(n):
  t += a[i]
  s[i] = t
c = 1
for i in range(n-1,0,-1):
  if a[i] <= 2*s[i-1]:
    c += 1
  else:
    break
print(c)

    
    
  
  

Measured memory_bytes: 84960
import math
from math import gcd
INF = float("inf")

import sys
input=sys.stdin.readline
import itertools

def main():
    n = int(input())
    l = list(map(int, input().split()))
    ans = INF
    for i in range(1,101):
        trial = 0
        for k in l:
            trial += (k-i)**2
        ans = min(ans, trial)
    print(ans)

if __name__=="__main__":
    main()


Measured memory_bytes: 63524
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        String str = sc.next();
        int l = str.length();
        int x = (int)Math.pow(2, l - 1);
        List<Long> list = new ArrayList<Long>();
        
        if (l == 1) {
            System.out.println(Integer.parseInt(str));
            return;
        }
        
        for (int i = 0; i < x; i++) {
            String binaryNumber = Integer.toBinaryString(i);
            while (binaryNumber.length() < l - 1) {
                binaryNumber = "0" + binaryNumber;
            }
            
            
            int start = 0;
            String tmpstr = "";
            for (int j = 1; j < l; j++) {
                boolean plusExists = binaryNumber.charAt(j - 1) == '1';
                if (plusExists) {
                    String strNum = str.substring(start, j);
                    list.add(Long.parseLong(strNum));
                    start = j;
                }
                
                if (j == l - 1) {
                    String strNum = str.substring(start, l);
                    list.add(Long.parseLong(strNum));
                    start = j;
                }
            }
        }
        
        long sum = 0;
        for (Long n : list) {
            sum += n;
        }
        System.out.println(sum);
    }
}


Measured memory_bytes: 23764
import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N,num):
    if N<=0:
        return [[] for _ in range(num)]
    elif num==1:
        return [I() for _ in range(N)]
    else:
        read_all = [tuple(II()) for _ in range(N)]
        return map(list, zip(*read_all))

#################

def get_circle_center_and_radius(x1, y1, x2, y2, x3, y3):
    d = 2 * ((y1 - y3) * (x1 - x2) - (y1 - y2) * (x1 - x3))
    if abs(d)<10**(-16):
        return (0,0),float('inf')
    x = ((y1 - y3) * (y1 ** 2 - y2 ** 2 + x1 ** 2 - x2 ** 2) - (y1 - y2) * (y1 ** 2 - y3 ** 2 + x1 ** 2 - x3 ** 2)) / d
    y = ((x1 - x3) * (x1 ** 2 - x2 ** 2 + y1 ** 2 - y2 ** 2) - (x1 - x2) * (x1 ** 2 - x3 ** 2 + y1 ** 2 - y3 ** 2)) / -d
    r = math.sqrt((x - x1) ** 2 + (y - y1) ** 2)
    return (x, y), r

N = I()
x,y = Line(N,2)

if N==2:
    print((math.sqrt((x[0]-x[1])**2 + (y[0]-y[1])**2))/2)
    exit()

ans = float('inf')
for i in range(N-2):
    for j in range(i+1,N-1):
        for k in range(j+1,N):
            c,r = get_circle_center_and_radius(x[i],y[i],x[j],y[j],x[k],y[k])
            if r<ans:
                check = False
                for h in range(N):
                    if h in [i,j,k]:
                        continue
                    if math.sqrt((x[h]-c[0])**2 + (y[h]-c[1])**2)>r:
                        check = True
                if not check:
                    ans = r

for i in range(N-1):
    for j in range(i+1,N):
        c = ((x[i]+x[j])/2, (y[i]+y[j])/2)
        r = (math.sqrt((x[i]-x[j])**2 + (y[i]-y[j])**2))/2
        flag = False
        for k in range(N):
            if k in [i,j]:
                continue
            else:
                if math.sqrt((x[k]-c[0])**2 + (y[k]-c[1])**2)>r:
                    flag = True
                    break
        if not flag:
            if r<ans:
                ans = r

print(ans)

Measured memory_bytes: 55516
#include<string>
#include<string.h>
#include<map>
#include<set>
#include<vector>
#include<stdio.h>
#include<math.h>
#include<iostream>
#include<algorithm>
#include<queue>
using namespace std;
int main(){
    int a,b;
    cin>>a>>b;
    if (a<=b) cout<<a<<endl;
    else {a=a-1;cout<<a<<endl;}
    return 0;
} 

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

#define pb         push_back

typedef long long ll;
const ll INF = 1000000000ll;
const ll MOD = 1000000007ll;
const double EPS = 1e-8;

int main(void) {
	//ios_base::sync_with_stdio(false);
	//cin.tie(0);
	
	string s;
	cin >> s;

	int n = s.size();
	if(s[0] == s[n-1]){
		if(n % 2 == 1){
			puts("Second");
			return 0;
		}else{
			puts("First");
			return 0;
		}
	}else{
		int cnt = 0;
		for(int i=0; i<n; i++){
			if(s[i] != s[0] && s[i] != s[n-1]){
				cnt++;
			}
		}

		if(n % 2 == 0){
			puts("Second");
			return 0;
		}else{
			puts("First");
			return 0;
		}


	}

	

	return 0;
}


Measured memory_bytes: 640
input = require('fs').readFileSync('/dev/stdin', 'utf8')
lines = input.split('\n')
N = lines.shift() * 1
l = lines.shift().split(' ')
max = 0
for (i=0; i<N; i++) {
    l[i] = l[i] * 1
    if (max < l[i]) {
        max = l[i]
    }
}

cnt = 0
for (i = 1; i<=max; i++) {
    t = 0
    f = 1
    for (j = 0; j < N; j++) {
        if (f == 1) {
            if (l[j] >= i) {
                t++
                f = 0
            }
        } else {
            if (l[j] < i) {
                f = 1
            }
        }
    }
    if (t === 0) {
        t = 1
    }
    cnt += t
}
console.log(cnt)

Measured memory_bytes: 7500
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var x = input.split('\n');
var n = parseInt(x[0]);
var a = x[1].split(' ').map(Number);
var max = Math.max(...a);
var min = Math.min(...a);
var total = a.reduce((p, q) => p + q, 0);
console.log(min,max,total);


Measured memory_bytes: 18968