akhauriyash/Code-Regression huggingface dataset:
//Author: Fuadul Hasan(fuadul202@gmail.com)
#include<bits/stdc++.h>
using namespace std;

#define ll long long
const int N   = 2e5 + 5;

int main(){
	
	int x,c;
	for(int i=1;i<=5;i++){
		cin>>x;
		if(x==0)c = i;
	}

	cout<<c<<endl;

	

	return 0;
}

Measured memory_bytes: 3592
#include<iostream>
#include<string>
#include<string.h>
#include<algorithm>
#include<stdio.h>
#include<cmath>
#include<vector>
#include<utility>
#include<stack>
#include<queue>

#define FOR(i, a, b) for(int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for(int i=(a);i>=(b);i--)
#define MOD 1000000007

using namespace std;

int main(void) {
	int n;
	long long int count = 0;
	long long int p;

	cin >> n;
	vector<long long int>a(n + 1);
	vector<long long int>b(n + 1);

	FOR(i, 1, n) {
		cin >> a[i] >> b[i];
	}
	RFOR(i, n, 1) {
		a[i] += count;
		if (a[i] % b[i] == 0) {
			continue;
		}
		else {
			if (a[i] < b[i]) {
				p = b[i] - a[i];
			}
			else {
				p= b[i] - (a[i] % b[i]);
			}
			count += p;
		}
	}
	cout << count << endl;
	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int W, H, N;
  cin >> W >> H >> N;
  int min_x = 0, min_y = 0, max_x = W, max_y = H;
  for (int i=0; i<N; i++){
    int x, y, a;
    cin >> x >> y >> a;
    if (a==1) min_x = max(min_x, x);
    if (a==2) max_x = min(max_x, x);
    if (a==3) min_y = max(min_y, y);
    if (a==4) max_y = min(max_y, y);
  }
  cout << (max(0, max_x - min_x) * max(0, max_y - min_y)) << endl;
}

Measured memory_bytes: 256
import itertools
from collections import deque,defaultdict,Counter
from itertools import accumulate
import bisect
from heapq import heappop,heappush
from fractions import gcd
from copy import deepcopy
import math
import queue
#import numpy as np
#import sympy as syp(素因数分解とか)
Mod = 1000000007
import sys

sys.setrecursionlimit(100000) 
  
def sieve_of_eratosthenes(n):
    if not isinstance(n,int):
        raise TypeError("n is not int")
    if n<2:
        raise ValueError("n is not effective")
    prime = [1]*(n+1)
    for i in range(2,int(math.sqrt(n))+1):
        if prime[i] == 1:
            for j in range(2*i,n+1):
                if j%i == 0:
                    prime[j] = 0
    res = []
    for i in range(2,n+1):
        if prime[i] == 1:
            res.append(i)
    return res

def factorial(i):
    if i == 1:
        return 1
    else:
        return i*factorial(i-1)
 
class UnionFind:
    def __init__(self,n):
        self.parent = [i for i in range(n+1)]
        self.rank = [0 for i in range(n+1)]
    
    def findroot(self,x):
        if x == self.parent[x]:
            return x
        else:
            y = self.parent[x]
            y = self.findroot(self.parent[x])
            return y
    
    def union(self,x,y):
        px = self.findroot(x)
        py = self.findroot(y)
        if px < py:
            self.parent[py] = px
        else:
            self.parent[px] = py
 
    def same_group_or_no(self,x,y):
        return self.findroot(x) == self.findroot(y)




def main(): #startline--------------------------------------------
    n,m = map(int,input().split())
    xyz = [list(map(int,input().split())) for i in range(n)]
    ans = []
    for i in range(8):
        sub = []
        for j in range(n):
            cnt = 0
            for k in range(3):
                if ((i>>k)&1):
                    cnt -= xyz[j][k]
                else:
                    cnt += xyz[j][k]
            sub.append(cnt)
        sub.sort(reverse = True)
        ans.append(sum(sub[:m]))
    print(max(ans))

if __name__ == "__main__":
    main() #endline===============================================
    

Measured memory_bytes: 5684
var getValue = function(str) {
  return parseInt(str.slice(1), 10);
};

var bubbleSort = function(arr, n) {
  var c = arr.slice();
  for (var i = 0; i <= n - 1; i += 1) {
    for (var j = n - 1; j >= i + 1; j -= 1) {
      if (getValue(c[j]) < getValue(c[j - 1])) {
        var temp = c[j];
        c[j] = c[j - 1];
        c[j - 1] = temp;
      }
    }
  }
  return c;
};

var selectionSort = function(arr, n) {
  var c = arr.slice();
  for (var i = 0; i <= n - 1; i += 1) {
    var minj = i;
    for (var j = i; j <= n - 1; j += 1) {
      if (getValue(c[j]) < getValue(c[minj])) {
        minj = j;
      }
    }
    var temp = c[i];
    c[i] = c[minj];
    c[minj] = temp;
  }
  return c;
};

var input = require('fs').readFileSync('/dev/stdin', 'utf8');
input.split('\n').forEach(function(line, i) {
  if (line !== '' && i % 2 === 1) {
    var nums = line.split(' ');
    var bubbleSorted = bubbleSort(nums, nums.length);
    console.log(bubbleSorted.join(' '));
    console.log('Stable');
    var selectionSorted = selectionSort(nums, nums.length);
    console.log(selectionSorted.join(' '));
    if (selectionSorted.join(' ') === bubbleSorted.join(' ')) {
      console.log('Stable');
    } else {
      console.log('Not stable');
    }
  }
});

Measured memory_bytes: 15896
#include <algorithm>
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<string>

#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<limits.h>
using lll = long long;
using ull = unsigned long long;
using namespace std;



int main(){
  lll ii,jj,kk;
  lll n,num;
  cin >> n;
  vector<lll> p,s;
  p.resize(n);
  for(ii=0;ii<n;ii++){
    cin >> p[ii];
  }
  s = p;
  sort(s.begin(),s.end());
  //for(ii=0;ii<n;ii++){
  //  cout << s[ii] << " ";
  //}
  num = 0;
  for(ii=0;ii<n;ii++){
    if(s[ii] != p[ii]){
      num++;
    }
  }

  if(num <= 2){
    cout << "YES" << endl;
  }
  else{
    cout << "NO" << endl;
  }
  
  return 0;
  
}


Measured memory_bytes: 256
#include<iomanip>
#include<iostream>
#include<cstring>
#include<cmath>
#include<queue>
#include<vector>
using namespace std;
int n,m,S,c[55],d[55];
long long dis[55][2505],ans[55],minn[55];
struct E{
	int to,time,cost;
};
struct Node{
	int now,money;
	long long dis;
	bool operator <(const Node yy) const {
		return dis==yy.dis?money>yy.money:dis>yy.dis;
	}
};
vector<E> g[50];
int main(){
	cin>>n>>m>>S;
	S=min(S,2500); 
	for(int i=1;i<=m;i++){
		int x,y,z,w;
		cin>>x>>y>>z>>w;
		g[x].push_back({y,w,z});
		g[y].push_back({x,w,z});
	}
	for(int i=1;i<=n;i++)cin>>c[i]>>d[i],c[i]=min(c[i],2500);
	memset(dis,0x3f,sizeof(dis));
	memset(ans,0x3f,sizeof(ans));
	memset(minn,0x3f,sizeof(minn));
	dis[1][S]=0,minn[1]=-1ll*S*c[1];
	priority_queue<Node> q;
	q.push({1,S,0}); 
	while(!q.empty()){
		Node t=q.top();
		q.pop();
		if(t.dis!=dis[t.now][t.money])continue;
		for(E v:g[t.now]){
			int y=v.to;
			if(t.money-v.cost>=0){
				if(dis[y][t.money-v.cost]>t.dis+v.time){
					dis[y][t.money-v.cost]=t.dis+v.time;
					q.push({y,t.money-v.cost,t.dis+v.time});
					ans[y]=min(ans[y],t.dis+v.time);
				}
			}
		}
		for(int i=t.money+c[t.now],j=1,ii;i<=2500+t.money;i+=c[t.now],j++){
			//if(i%1000==0)cout<<i<<' '<<t.now<<endl;
			if(i>2500)ii=2500;
			else ii=i;
			//if(ii%1000==0)cout<<dis[t.now][ii]<<' '<<t.dis+1ll*j*d[t.now]<<' '<<i<<' '<<t.now<<endl;
			if(dis[t.now][ii]>t.dis+1ll*j*d[t.now]){
				dis[t.now][ii]=t.dis+1ll*j*d[t.now];
				q.push({t.now,ii,dis[t.now][ii]});
			}
			else break;
		}
	}
	for(int i=2;i<=n;i++)cout<<ans[i]<<endl;
    return 0;
}

Measured memory_bytes: 70040
def solve(n, d, m, t):
    d = sorted(d)
    t = sorted(t)
    i = 0
    for j in range(m):
        while (i < n) and (d[i] < t[j]):
            i += 1
        if (i == n) or (d[i] != t[j]):
            return "NO"
        i += 1
    return "YES"

n = int(input())
d = list(map(int, input().split()))
m = int(input())
t = list(map(int, input().split()))
print(solve(n, d, m, t))

Measured memory_bytes: 35324
(defun split (str delim)
  (let ((res (make-array 1 :element-type 'string
                           :fill-pointer 0
                           :adjustable t)))
    (loop for i from 0 below (length str)
          with start = 0
          when (eq (char str i) delim)
          do (vector-push-extend (subseq str start i) res)
             (setf start (1+ i))
          finally (let ((tail (subseq str start)))
                    (when tail
                      (vector-push-extend tail res))))
    res))

(let* ((in (split (read-line) #\Space))
       (a (parse-integer (aref in 0)))
       (b (parse-integer (aref in 1)))
       (x (parse-integer (aref in 2)))
       (a/x (ceiling (/ a x)))
       (b/x (floor (/ b x))))
  (format t "~A~%" (1+ (- b/x a/x))))

Measured memory_bytes: 4968
#include <bits/stdc++.h>
using namespace std;
int main ()
{
    int r, d, f;
    cin >> r >> d >> f;
    int q=1;
    for (int i=d; i<=f; ++i)
    {
        if (i%r==0)
        {
            q=0;
            break;
        }
    }
    if (q==1)
        cout << "NG" << endl;
    else
        cout << "OK" << endl;
}

Measured memory_bytes: 3636
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <algorithm>

#include <bits/stdc++.h>
#include <cmath>
#include <limits>

using namespace std;
typedef long long LL;
using Graph = vector<vector<int>>;

static long long INF = (1LL<<62);


long long N, Q;
vector<LL> P;
vector<LL> ANS;

void dfs(Graph &G, LL v, LL parent, vector<LL> &done){
	if(done[v] == 1) return;

	for(auto next_v : G[v]){
		if(next_v != parent){
			ANS[next_v] += ANS[v];
			dfs(G, next_v, v, done);
		}
	}
	done[v] = 1;
}

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

	cin >> N >> Q;
	Graph G(N);
	P.assign(N, 0);
	ANS.assign(N, 0);
	for(int i=0; i<N-1; i++){
		int a, b;
		cin >> a >> b;
		G[a - 1].push_back(b - 1);
		G[b - 1].push_back(a - 1);
	}

	for(int i=0; i<Q; i++){
		LL p, x;
		cin >> p >> x;
		P[p - 1] += x;
	}
	for(int i=0; i<N; i++){
		ANS[i] = P[i];
	}

	vector<LL> done;
	done.assign(N, 0);
	dfs(G, 0, 0, done);

	for(int i=0; i<N; i++){
		printf("%lld", ANS[i]);
		if(i < N - 1) printf(" ");
	}
	printf("\n");
	return 0;
}

Measured memory_bytes: 34652
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
	int N,M,p;
	cin >> N >> M >> p;
	int d[10001];
	d[0] = p;
	for(int i=1;i<=M;i++){
		cin >> d[i];
	}
	sort(d,d+M+1);
	int c_min = N-1;
	for(int i=0;i<M+1;i++){
		int q = d[i];
		int r1 = d[(i-1+M+1)%(M+1)];
		int r2 = d[(i+1)%(M+1)];

		int c1 = ((p-q+N)%N)*2+(r1-p+N)%N;
		int c2 = ((q-p+N)%N)*2+(p-r2+N)%N;
		c_min = min(c_min,min(c1,c2));
	}
	cout << c_min*100 << endl;
return 0;
}
		

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

int main(){
	int n;
	cin>>n;
	char a;
	for(int i=1; i<=n; i++){
		cin>>a;
		if(a=='Y'){
			cout<<"Four"<<endl;
			return 0;
		}
	}
	cout<<"Three"<<endl;
	
	return 0;
}

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

struct node {
	int key;
	struct node *right, *left, *parent;
};
typedef struct node *Node;
#define NIL NULL

Node root;

Node treeMaximum(Node x){
  while(x->right != NIL){
    x = x->right;
  }
  return x;
}
Node treeMinimum(Node x){
	while(x->left != NIL) x = x->left;
	return x;
}

Node treeSearch(Node u, int k){
  if(u == NIL || k == u->key) return u;
  if(k < u->key) return treeSearch(u->left, k);
  else return treeSearch(u->right, k);
}

Node treeSuccessor(Node x){
  Node y;
  if(x->right != NIL) return treeMinimum(x->right);
  y = x->parent;
  while((y != NIL) && x == y->right ){
    x = y;
    y = y->parent;
    return y;
  }
}

void treeDelete(Node z) {
	Node y;
	Node x;

	if ( z->left == NIL || z->right == NIL ) y = z;
	else y = treeSuccessor(z);
	if ( y->left != NIL ) {
		x = y->left;
	} else {
		x = y->right;
	}

	if ( x != NIL ) {
		x->parent = y->parent;
	}

	if ( y->parent == NIL ) {
		root = x;
	} else if ( y == y->parent->left) {
			y->parent->left = x;
		} else {
			y->parent->right = x;
		}


	if ( y != z) {
		z->key = y->key;
	}

	free(y);
}

void insert(int k) {
	Node y = NIL;
	Node x = root;
	Node z;

	z = malloc(sizeof(struct node));
	z->key = k;
	z->left = NIL;
	z->right = NIL;

	while(x != NIL){
		y = x;
		if(z->key < x->key)
			x = x->left;
		else
			x = x->right;
	}
	z->parent = y;
	if(y == NIL)
		root = z;
	else{
		if(z->key < y->key){
		y->left = z;
	}
	else
		y->right = z;
	}
}

void inorder(Node u){
  if(u != NIL){
    inorder(u->left);
    printf(" %d",u->key);
    inorder(u->right);
  }
  
}
void preorder(Node u){
  if(u != NIL){
    printf(" %d",u->key);
    preorder(u->left);
    preorder(u->right);
  }
}

int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    } else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      
      inorder(root);
      
       printf("\n");
       
      preorder(root);
     
      printf("\n");
      
    } else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }
  }

  return 0;
}



Measured memory_bytes: 20456
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <numeric>
#include <iomanip>
#include <map>
#include <set>
#include <deque>
#include <utility>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repk(i, k, n) for (int i = k; i < n; i++)
#define MOD 1e9 + 7
#define INF 1e9
#define PIE 3.14159265358979323

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;}
template <class T>
T GCD(T a, T b) {if (b == 0) return a; else return GCD(b, a % b);}
template <class T>
inline T LCM(T a, T b) { return (a * b) / GCD(a, b);}

int main() {
    double a,b,h,m;
    cin >> a >> b >> h >> m;
    double hr = (h+m/60.0) / 6.0 * PIE;
    double mr = m / 30.0 * PIE;
    double rad;
    rad = abs(hr - mr);
    double c2 = a * a + b * b - 2 * a * b * cos(rad);
    double c = sqrt(c2);
    cout << fixed << setprecision(12) << c << endl;
}

Measured memory_bytes: 4228
#include <bits/stdc++.h>
#define int long long
#define double long double
const int INF = (int)1e18 + 18;
const int maxn = (int) 1e6 + 6; 
using namespace std;

int n, countt = 0;
vector<int> inp, vec;

signed main() {

	cin >> n;

	for(int i = 0; i < n; i++){
		int x; cin >> x;
		inp.push_back(x);
		vec.push_back(x);
	}

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

	for(int i = 0; i < n; i++){
		if(inp[i] != i+1){
			countt++;
		}
	}

	if(countt == 0 || countt == 2){
		cout << "YES" << endl; return 0;
	}
	
	cout << "NO" << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int A,B,C,D;
  cin >> A >> B >> C >> D;
  if(A+B > C+D)
    cout << "Left" << endl;
  else if(A+B == C+D)
    cout << "Balanced" << endl;
  else if(A+B < C+D)
    cout << "Right" << endl;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)
input = sys.stdin.readline
INF = 2**62-1

def read_int():
    return int(input())


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


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


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


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


def eratosthenes(n):
    p = []
    t = [True] * n

    for i in range(2, int(math.ceil(math.sqrt(n)))):
        if t[i]:
            p.append(i)
            for j in range(2*i, n, i):
                t[j] = False

    for j in range(i+1, n):
        if t[j]:
            p.append(j)

    return p


@mt
def slv(X):
    P = eratosthenes(10**6)
    return P[bisect.bisect_left(P, X)]


def main():
    X = read_int()
    print(slv(X))


if __name__ == '__main__':
    main()


Measured memory_bytes: 73964
#include<stdio.h>

int main(void){
	int a, b;
	scanf("%d %d", &a, &b);
	if(a > b){
		printf("a > b\n");
	}else if(a < b){
		printf("a < b\n");
	}else{
		printf("a == b\n");
	}
	return 0;
}

Measured memory_bytes: 2676
using System;

public class Hello
{
    public static void Main()
    {
        var n = long.Parse(Console.ReadLine().Trim());
        var p = 1L;
        var w = 0L;
        var count = 0;
        while (w < n)
        {
            p *= 26;
            w += p;
            count++;
        }
        var t = n - (w - p);
        getAns(t, count);
    }
    static void getAns(long t, int count)
    {
        var a = "abcdefghijklmnopqrstuvwxyz";
        var a2 = a.ToCharArray();
        t--;
        var res = new char[count];
        for (int i = 0; i < count; i++)
        {
            var rt = (int)(t % 26);
            res[count - i - 1] = a[rt];
            t /= 26;
        }
        Console.WriteLine(new string(res));
    }
}


Measured memory_bytes: 27472
def main():
    N = int(input())
    P = [int(a) for a in input().split()]

    ans = 0
    for i in range(len(P)):
        if i == len(P) - 1:
            if P[i] == i + 1:
                P[i], P[i - 1] = P[i - 1], P[i]
                ans += 1
            else:
                pass

        else:
            if P[i] == i + 1:
                P[i], P[i + 1] = P[i + 1], P[i]
                ans += 1
            else:
                pass

    print(ans)
    
if __name__ == "__main__":
    main()

Measured memory_bytes: 20048
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]
 
a,b,n=n1()
import math
if b<=n:
    i=b-1
else:
    i=n
m=math.floor((a*i)/b)-a*math.floor(i/b)
print(m)


Measured memory_bytes: 9132
#include<stdio.h>
int main()
{
    long long int x,c,y,a,b,m,h;
    scanf("%lld",&x);
    c = x/500;
    y = c*1000;
    a = x%500;
    b = a/5;
    m  = b*5;
    h = y+m;

    printf("%lld\n",h);

    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <bitset>
#include <map>
#include <tuple>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <numeric>
#include <utility>
#include <iterator>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <ctime>
#include <cassert>
#include <random>
#include <cstring>


#define rep(i,n) for(int i=0;i<int(n);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back

using namespace std;
using ll = long long;

const ll mod = 1000000007;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int ddx[8]={-1,-1,0,1,1,1,0,-1};
int ddy[8]={0,1,1,1,0,-1,-1,-1};
bool debug=false;

/*---------------------------------------------------*/

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

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

  int ans = A[0];
  for(int i = 1; i < N; i++){
    ans = gcd(ans, A[i]);
  }

  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 640
n,m = map(int,input().split())
syou,dai = map(int,input().split())
for i in range(m-1):
    l,r = map(int,input().split())
    if syou < l:
        syou = l
    if r < dai:
        dai = r

if dai > n:
    dai = n
    
if syou <= dai:
    print(dai - syou + 1)
else:
    print(0)

Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <functional>
#include <stack>
#include <queue>
#include <map>
#include <unordered_map>
#include <bitset>
#include <numeric>
#include <unordered_set>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <numeric>
#include <cstdlib>
#include <random>
#include <bits/stdc++.h>


using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<ll> vec;
typedef vector<vec> mat;

const ll mod=1000000007ll;
const ll inf=1000000000000000ll;

const ll MAX_N=10;
ll N,pl[MAX_N];

int main(){
  cin>>N;
  for(ll i=0;i<N;i++){
    cin>>pl[i];
  }
  sort(pl,pl+N,greater<ll>());
  ll ans=0;
  for(ll i=0;i<N;i++){
    if(i==0)ans+=pl[i]/2;
    else ans+=pl[i];
  }
  cout<<ans<<endl;
  return 0;
}


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

int main() {

  int q;
  cin >> q;

  vector<int> A;
  for (int i = 0; i < q; i++) {
    int query, x;
    cin >> query;
    if (query == 0) {
      cin >> x;
      A.push_back(x);
    } else if (query == 1) {
      cin >> x;
      cout << A[x] << endl;
    } else {
      A.pop_back();
    }
  }

  return 0;

}


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

int main()
{
    int N,i,kisu;
    kisu = 0;
    double wariai;
    cin >>N;
    
    for(i=1;i<=N;i++)
    {
        if(i%2 ==1)
        {
            kisu ++;
        }
    }
    wariai = double(kisu)/double(N);
    cout<<wariai<<endl;
    return 0;
    
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<math.h>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<string>
#include<time.h>
#define INF 1000000000ll
#define MOD 1000000007ll
#define EPS 1e-10
#define REP(i,m) for(long long i=0; i<m; ++i)
#define FOR(i,n,m) for(long long i=n; i<m; ++i)
#define DUMP(n,a) for(long long dump=0; dump<n; ++dump) { cout<<a[dump]; if(dump!=n-1) cout<<" "; else cout<<endl; }
#define ALL(v) v.begin(),v.end()
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef long double ld;
 
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s;
	cin>>s;
	map<ll,ll> m;
	vector<ll> c(26,0);
	vector<ll> d((ll)s.size()+1);
	REP(i,(ll)s.size()) {
		ll buf1=1;
		ll buf2=0;
		REP(j,26) {
			if(c[j]%2==1) {
				buf2+=buf1;
			}
			buf1*=2;
		}
		d[i]=buf2;
		m[buf2]=INF;
		c[s[i]-'a']++;
	}
	ll buf1=1;
	ll buf2=0;
	REP(i,26) {
		if(c[i]%2==1) {
			buf2+=buf1;
		}
		buf1*=2;
	}
	d[(ll)s.size()]=buf2;
	m[buf2]=INF;
	m[0]=0;
	REP(i,(ll)s.size()+1) {
		ll ret=INF;
		ret=min(ret,m[d[i]]+1);
		REP(j,26) {
			ll buf=d[i];
			if(d[i]%(1<<(j+1))!=d[i]%(1<<(j))) {
				buf-=(1<<(j));
			} else {
				buf+=(1<<(j));
			}
			if(m.count(buf)!=0) ret=min(ret,m[buf]+1);
		}
		m[d[i]]=min(m[d[i]],ret);
	}
	if(d[(ll)s.size()]==0) cout<<1<<endl;
	else cout<<m[d[(ll)s.size()]]<<endl;
}

Measured memory_bytes: 15764
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		int A = Integer.parseInt(sc.next());
		int B = Integer.parseInt(sc.next());
		sc.close();
		
		if ((A == 1 && B == 2) || (B == 1 && A == 2) ) {
			
			System.out.print(3);
		}
		
		if ((A == 2 && B == 3) || (B == 2 && A == 3) ) {
			
			System.out.print(1);
		}

		if ((A == 1 && B == 3) || (B == 1 && A == 3) ) {
			
			System.out.print(2);
		}
		
	}

}

Measured memory_bytes: 23124
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <fstream>
#include <string>
#include <math.h>
#include <cstdlib>
#include <istream>
#include <sstream>
#include <cctype>
#include <iomanip>
//cout << fixed << setprecision(20) << *** << endl;
#define rep(i,N) for(int i=0;i<(int)N;++i)
typedef long long ll;
using namespace std;
int main()
{
	ll N,count=0;
	cin>>N;
	rep(i,N){
		ll t;
		cin>>t;
		if(t%2==1)count++;
	}
	if(count%2==1)cout<<"NO"<<endl;
	else cout<<"YES"<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
 
int main(){
	ll n,d;
	cin>>n>>d;
	int count =0;
	while(n--){
		double a,b;
		cin>>a>>b;
		if(sqrt(a*a + b*b) <= d)	count++;
	}
	cout<<count;
	return 0;
}




Measured memory_bytes: 3804
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
signed main(){
  int A,B,C;
  cin>>A>>B>>C;
  string ans="NO";
  if(B-A==C-B)
    ans="YES";
  cout<<ans;
  }


Measured memory_bytes: 256
//
//  main.cpp
//  Study
//
//  Created by 佐々木勇星 on 2020/03/12.
//  Copyright © 2020 佐々木勇星. All rights reserved.
//

#include <iostream>
#include <vector>
#include <cmath>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <map>

using namespace std;


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

    
    int a, b, ans;
    
    cin >> a >> b;
    
    ans = a + b;
    
    if (a - b > ans) ans = a - b;
    if (a * b > ans) ans = a * b;
    
    cout << ans << endl;
    
    return 0;
    
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
# AtCoder Beginner Contest


if __name__ == '__main__':
    from statistics import median

    n = int(input())
    a = list(map(int, input().split()))
    total = 0

    # See:
    # https://www.youtube.com/watch?v=UX4AuiCVtN4
    # https://beta.atcoder.jp/contests/abc102/submissions/2768315
    mod_a = sorted([ai - i for i, ai in enumerate(a, 1)])
    b = median(mod_a)

    for i in range(n):
        total += abs(mod_a[i] - b)

    print(int(total))


Measured memory_bytes: 27244
#include<iostream>
using namespace std;
int main(){
  int n;
  int a,b;
  int ak,bk;
  while(1){
    cin >> n;
    ak=0;
    bk=0;
    if(n==0) break;
    for(int i=0;i<n;i++){
      cin >> a >> b;
      if(a<b) bk+=a+b;
      else if(a>b) ak+=a+b;
      else if(b==a){
	ak+=a;
	bk+=b;
      }
    }
    cout <<ak<<" "<<bk<<endl;
  }
}

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

using namespace std;

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

	vector<vector<int> > d(n, vector<int> (2));
	for(int i = 0; i < n; ++i) {
		cin >> d[i][0] >> d[i][1];
	}

	bool ok = false;
	for(int i = 0; i + 2 < n; ++i) {
		if(d[i][0] == d[i][1] && d[i + 1][0] == d[i + 1][1] && d[i + 2][0] == d[i + 2][1]) {
			ok = true;
		}
	}

	if(ok) {
		cout << "Yes" << '\n';
	} else {
		cout << "No" << '\n';
	}

	return 0;
}

Measured memory_bytes: 3604
from sys import stdin
N,K = map(int,stdin.readline().split())
P = list(map(int,stdin.readline().split()))
B = sum(P[0:K])
A = B
for i in range(N-K):
	B = B - P[i] + P[i+K]
	A = max(A,B)
print((A+K)/2)

Measured memory_bytes: 24292
INF = 1000000007

N = int(input())
Alist = list(map(int, input().split()))

ans = 3
rgb = [1, 0, 0]

for i in range(1, N):
    a = Alist[i]
    temp = 0
    check = False
    for j in range(3):
        if rgb[j] == a:
            temp += 1
            if not check:
                rgb[j] += 1
                check = True
    ans = ans * temp
    ans = ans % INF


if Alist[0] != 0:
    print(0)
else:
    print(int(ans))


Measured memory_bytes: 13964
#include <bits/stdc++.h>
#define int long long
const int INF = 1e18L + 5;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using namespace std;

signed main() {

    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int n, d, x; cin >> n >> d >> x;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    int ans = x;
    rep(i,n) {
        ans += (d-1)/a[i] + 1;
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
  int N;
  cin >> N;
  int a, b, c, d;
  a = N/1000;
  b = (N%1000)/100;
  c = ((N%1000)%100)/10;
  d = (((N%1000)%100)%10);
  
  if (a == b && b == c){
   cout << "Yes" << endl;
  }
  else if (b == c && c == d){
   cout << "Yes" << endl;
  }
  else {
   cout << "No" << endl;
  }
}

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

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

#define m0(x) memset(x, 0, sizeof(x))
#define all(x) x.begin(), x.end()
#define rep(i, n) for(int i = 0; i < (n); i++)
#define asort(x) sort(all(x));
#define dsort(x, t) sort(x.begin(), x.end(), greater<t>());
#define vuni(v) v.erase(unique(v.begin(), v.end()), v.end());
#define mins(m, s) m.insert(make_pair(s, 1));
#define mfin(m, s) m.find(s) != m.end()

#define dump(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO" ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No" ) << endl

const int INF = 1e9;
const ll LINF = 1e18;
const int mod = 1e9+7;

int main(){
    string s;
    cin >> s;

    bool flag = true;
    for (int i = 0; i < 3; i++) {
        if(s[i] == s[i+1]){
            flag = false;
        }
    }

    if(flag) {
        cout << "Good" << endl;
    } else {
        cout << "Bad" << endl;
    }

    return 0;
}

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

// #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 FS              ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll              long long int
#define ld              long double
#define pb              push_back
#define bp              __builtin_popcount
#define sz              size()
#define ff              first
#define ss              second
#define vll             vector<ll>
#define vbool           vector<bool>
#define vpll            vector<pair<ll,ll>>
#define pll             pair<ll,ll>
#define vllv            vector<vector<ll>>
#define setpri(x)       cout<<setprecision(x)<<fixed;
#define all(v)          v.begin(),v.end()
#define allr(v)         v.rbegin(),v.rend()
#define yesr {cout<<"YES"<<endl;return;}
#define nor {cout<<"NO"<<endl;return;}
// getline (std::cin,name);
ll MOD=1e9+7;
ll ceil1(ll n,ll x){return (n-1)/x+(n>0);}

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

ll pow1(ll n,ll m ,ll mod=MOD );
ll pow2(ll n,ll k);

ll modinv(ll n,ll mod=MOD){  return pow1(n,mod-2,mod);}

bool func(pair<ll,ll> &a,pair<ll,ll> &b ){
        if(a.ff != b.ff)return a.ff < b.ff;
        return a.ss > b.ss;
}
ll const N=(ll)2e5+11;
ll const LG=(ll)log2(N)+1;

void solve(){
        ll i,j,k,l,n,m,x,y,z,r;
       
        cin>>n>>k;
        vll a(n);
        for(i=0;i<n;i++){
                cin>>a[i];
        }
        ll t1=1;
        ll t2=1;
        for(i=0;i<k;i++){
                t1*=a[i];
                t1%=MOD;
        }
        for(i=k;i<n;i++){
                t2=t1;
                t2*=modinv(a[i-k]);
                t2%=MOD;
                t2*=a[i];
                t2%=MOD;
                if(a[i]>a[i-k]){
                        cout<<"Yes\n";
                }else{
                        cout<<"No\n";
                }
                t1=t2;
        }
       
        
        
}       
int main(){
        FS;
        
        ll i,j,k,n,m,x,y,z,q;
        q=1;
        // cin>>q;
        for(ll tc=1;tc<=q;tc++){
                // cout<<"Case #"<<tc<<": ";
                solve();
        }
        return 0;
}


ll pow1(ll n,ll m,ll mod){
        if(m==0)return 1;
        
        if(m%2==0)return pow1((n*n)%mod,m/2,mod);
    	
    	return (pow1((n*n)%mod,m/2,mod)*n)%mod;
}

ll pow2(ll n,ll k){
        ll ans=1;
            while(k>0){
                if(k%2==1)ans=ans*n;
                n=n*n;
                k/=2;
            }
            return ans;
}


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

int main() {
	int map[14][14]={{0}};
	int x,y,s;
	while(scanf("%d,%d,%d",&x,&y,&s) != EOF)
	{
		x+=2;y+=2;
		switch(s)
		{
		case 3:
			map[x-2][y]++;
			map[x+2][y]++;
			map[x][y-2]++;
			map[x][y+2]++;
		case 2:
			map[x-1][y-1]++;
			map[x-1][y+1]++;
			map[x+1][y-1]++;
			map[x+1][y+1]++;
		case 1:
			map[x-1][y]++;
			map[x+1][y]++;
			map[x][y-1]++;
			map[x][y+1]++;
			map[x][y]++;
		default:
			break;
		}
	}
	int max=0,blank=0;
	for (int i=0+2; i<10+2; i++)
	{
		for (int j=0+2; j<10+2; j++)
		{
			if (map[i][j]==0)
			{
				blank++;
			} else {
				if (max<map[i][j])
				{
					max = map[i][j];
				}
			}
		}
	}
	cout << blank << endl << max << endl;
	return 0;
}

Measured memory_bytes: 0
mod io{
    use std::io::*;
    pub fn read<T: ::std::str::FromStr>()->T{
        let stdin=stdin();
        let ret=stdin.lock().bytes().map(|c|c.unwrap()as char)
        .skip_while(|c|c.is_whitespace())
        .take_while(|c|!c.is_whitespace())
        .collect::<String>().parse().ok().unwrap();
        ret
    }
}
use io::read;
fn main(){
    let n=read::<u32>();
    let m=read::<u32>();
    println!("{}",100*(n+m*18)*2u32.pow(m))
}


Measured memory_bytes: 4352
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <complex>
#include <ctime>
#include <cstdlib>

using namespace std;

inline int to_int(string s) {int v; istringstream sin(s); sin >> v; return v;}
template<class T> inline string to_str(T x) {ostringstream sout; sout << x; return sout.str();}

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

int main()
{
	long double T[128][128], dp[128][128];
	int n, m;

	while(cin >> n >> m)
	{
		if(n == 0 && m == 0)
		{
			break;
		}

		for(int i = 0; i < n; i++)
		{
			for(int j = 0; j < n; j++)
			{
				cin >> T[i][j];
			}
		}
		
		memset(dp, 0, sizeof(dp));
	
		for(int i = 0; i < n; i++)
		{
			dp[0][i] = 1.0;
		}

		for(int i = 1; i < m; i++)
		{
			for(int j = 0; j < n; j++)
			{
				for(int k = 0; k < n; k++)
				{
					//dp[i][j] : i回目で肥料jを使った時の最大の苗木の大きさ
					dp[i][j] = max(dp[i][j], dp[i-1][k]*T[k][j]);
				}
			}
		}

		long double res = -1; 
		for(int i = 0; i < n; i++)
		{
			res = max(res, dp[m-1][i]);
		}
	
		printf("%.2Lf\n",res);
	}
}

Measured memory_bytes: 1708
N,K=map(int,input().split())
z=[tuple(map(int,input().split()))for _ in range(N)]
x=[i for i,_ in z]
y=[j for _,j in z]
x.sort()
y.sort()
a=10**20
for i in range(N):
    for j in range(i+1,N):
        for k in range(N):
            for l in range(k+1,N):
                l,r,d,u=x[i],x[j],y[k],y[l]
                if sum([1for v,w in z if l<=v<=r and d<=w<=u])>=K:
                    a=min(a,(r-l)*(u-d))
print(a)

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

constexpr int MAX_N = 50;
constexpr int MAX_DAY = 30;

int solve(const int &n, const bool isFreeDay[MAX_DAY + 1][MAX_N]) { // O(MAX_DAY * n^2)
  const ll gathered = (1LL << n) - 1;

  // dp[i][j] := Set of maps available for person j on day i
  ll dp[MAX_DAY + 1][MAX_N] = {};
  for (int j = 0; j < n; j++) dp[0][j] |= 1LL << j;

  for (int i = 1; i <= MAX_DAY; i++) {
    for (int j = 0; j < n; j++) {
      dp[i][j] |= dp[i - 1][j];
      if (isFreeDay[i][j]) {
        for (int k = 0; k < n; k++) {
          if (isFreeDay[i][k]) dp[i][j] |= dp[i - 1][k];
        }
      }

      if (dp[i][j] == gathered) return i;
    }
  }
  return -1;
}

int main() {
  while (true) {
    int n;
    cin >> n;
    if (n == 0) break;
    // isFreeDay[i][j] := whether if day i is free for person j
    bool isFreeDay[MAX_DAY + 1][MAX_N] = {};
    for (int i = 0; i < n; i++) {
      int f;
      cin >> f;
      while (f--) {
        int d;
        cin >> d;
        isFreeDay[d][i] = true;
      }
    }
    cout << solve(n, isFreeDay) << endl;
  }
}



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

int main(){

    int num=0,a,b;
    std::vector<int> small,large;
    
    for(;;){
        cin >> a >> b;
        if(a==0&&b==0){
            break;
        }else{
            if(a>b){
                small.push_back(b);
                large.push_back(a);
            }else{
                small.push_back(a);
                large.push_back(b);
            }
            num++;
        }
    }

    for(int i=0;i<num;i++){
        cout << small[i] << " " << large[i] << endl;
    }

}


Measured memory_bytes: 3044
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.IO;
using System.Text;
using System.Diagnostics;

class Program
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        long[] a = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
        Dictionary<long, long> map = new Dictionary<long, long>();

        long first_pair = 0;
        long second_pair = 0;

        for(long i = 0; i < n; i++)
        {
            if (map.ContainsKey(a[i]))
            {
                map[a[i]]++;
            }
            else
            {
                map[a[i]] = 1;
            }
        }

        map = map.OrderByDescending(i => i.Key).ToDictionary(i => i.Key, i => i.Value);

        foreach (var item in map)
        {
            long key = item.Key;
            long value = item.Value;

            if (first_pair != 0 && second_pair != 0)
            {
                Console.WriteLine(first_pair * second_pair);
                return;
            }
            if(first_pair == 0)
            {
                if(value >= 2)
                {
                    first_pair = key;
                    value -= 2;
                }
            }

            if(second_pair == 0)
            {
                if (value >= 2)
                {
                    second_pair = key;
                }
            }
        }
        Console.WriteLine(first_pair * second_pair);
    }
}

Measured memory_bytes: 29408
import java.math.*;
import java.util.*;

class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int x = sc.nextInt();
        int y = sc.nextInt();
        int k[] = new int[n-1];
        int i = 0;
        while(i<k.length){
            k[i] = 0;
            i++;
        }
        int buf1 = 1;
        while(buf1<=n){
            int buf2 = buf1+1;
            while(buf2<=n){
                if(buf2>=y && buf1<=x){
                    k[(buf2-buf1-(y-x)+1)-1]++;
                    //System.out.println((buf2-buf1-(y-x)+2)-1);
                }
                else{
                    int k1[] = new int[2];
                    k1[0] = (buf2-buf1)-1;
                    k1[1] = (Math.abs(buf1-x)+1+Math.abs(y-buf2))-1;
                    Arrays.sort(k1);
                    k[k1[0]]++;
                    //System.out.println(k1[0]);
                }
                buf2++;
            }
            //System.out.println();
            buf1++;
        }
        
        int buf3 = 0;
        i = 0;
        while(i<k.length){
            buf3 = k[i];
            System.out.println(buf3);
            i++;
        }
    }
}

Measured memory_bytes: 43092
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vs = vector<string>;
using vvs = vector<vs>;
using pli = pair<long long, int>;
using vpli = vector<pli>;

int main() {
  ll A, B;
  cin >> A >> B;
  
  if (A != 1 && B != 1) cout << 1 << endl;
  else if (A != 2 && B != 2) cout << 2 << endl;
  else if (A != 3 && B != 3) cout << 3 << endl;
  
}

Measured memory_bytes: 256
use std::io;
//use std::collections::HashMap;
//use std::collections::BinaryHeap;
//use std::collections::HashSet;
//use std::mem; // mem::swap(&mut x,&mut y);
use std::cmp; // cmp::max,cmp::min

// Rust memo: https://hackmd.io/i0lQY1OKTDW1t66TECOmiw?both

#[allow(dead_code)]
fn read_line() -> String {
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

#[allow(dead_code)]
fn read_charvec() -> Vec<char> {
    read_line().chars().collect()
}

#[allow(dead_code)]
fn read_ints() -> Vec<i64> {
    let s = read_line();
    let split: Vec<&str> = s.split(" ").collect();
    split
        .iter()
        .map(|&x| x.to_string().parse().unwrap())
        .collect()
}

#[allow(dead_code)]
fn read_int() -> i64 {
    read_ints()[0]
}

#[allow(dead_code)]
fn reverse(s: &String) -> String {
    s.chars().rev().collect::<String>()
}

#[allow(dead_code)]
fn read_lines(n: i64) -> Vec<String> {
    let mut xs = Vec::new();

    for _i in 0..n {
        xs.push(read_line());
    }

    xs
}

#[allow(dead_code)]
fn read_ints2(n: i64) -> Vec<i64> {
    read_lines(n).iter().map(|x| x.parse().unwrap()).collect()
}

#[allow(dead_code)]
fn arange(start: i64, end: i64, step: i64) -> Vec<i64> {
    let mut ret = Vec::new();
    let mut i = start;

    while i < end {
        ret.push(i);
        i += step;
    }

    ret
}

#[allow(dead_code)]
const DXS: [i64; 4] = [0, 0, 1, -1];
#[allow(dead_code)]
const DYS: [i64; 4] = [1, -1, 0, 0];
#[allow(dead_code)]
const INF: i64 = 999999999;
#[allow(dead_code)]
const N_PRIME: i64 = 1000000007;

////////////////////////////////////////////////

fn main() {
    let xs = read_ints();
    let (n, k, s) = (xs[0] as usize, xs[1] as usize, xs[2]);

    let vs = {
        let mut ret = vec![];
        let buff = if s == 1000_000_000 { s - 1 } else { s + 1 };

        for i in 0..k {
            ret.push(s);
        }

        for i in 0..n - k {
            ret.push(buff);
        }
        ret
    };

    for i in 0..vs.len() - 1 {
        print!("{} ", vs[i]);
    }

    println!("{}", vs[vs.len() - 1]);
}


Measured memory_bytes: 5500
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#include <atcoder/all>
#define repi(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define repdi(i,a,b) for(ll i=(a)-1;i>=(b);--i)
#define repd(i,a) repdi(i,a,0)
#define itr(it,a) for( auto it = (a).begin(); it != (a).end(); ++it )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define endl '\n'
#define debug(x) std::cerr << #x << " = " << (x) << endl;

using ll = long long;
using P = std::pair<ll, ll>;

constexpr ll INF = 1ll<<60;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

template<class S, class T>
std::ostream& operator<< ( std::ostream& out, const std::pair<S,T>& a )
{ std::cout << '(' << a.first << ", " << a.second << ')'; return out; }

template<class T>
std::ostream &operator<< ( std::ostream& out, const std::vector<T>& a )
{ std::cout << '['; rep( i, a.size() ){ std::cout << a[i]; if( i != a.size()-1 ) std::cout << ", "; } std::cout << ']'; return out; }

ll N, K;
ll A[300010];
ll dp[300010];

ll op( ll a, ll b ) {
  return std::max(a,b);
}

ll e() {
  return 0;
}

int main() {
  std::cin >> N >> K;

  rep( i, N )
    std::cin >> A[i];

  ll M = 300001;

  atcoder::segtree<ll, op, e> seg( M );

  rep( i, N ) {
    ll lb = A[i]-K;
    ll ub = A[i]+K+1;

    chmax( lb, 0ll );
    chmin( ub, M );

    seg.set( A[i], seg.prod( lb, ub )+1 );
  }

  std::cout << seg.all_prod() << endl;

  return 0;
}

Measured memory_bytes: 16216
import sys

input = lambda: sys.stdin.readline().rstrip()


def solve():
    N = int(input())
    d = dict()

    for _ in range(N):
        s = str(sorted(input()))
        if s in d:
            d[s] += 1
        else:
            d[s] = 1

    ans = 0
    for k, v in d.items():
        ans += v * (v - 1) // 2

    print(ans)


if __name__ == '__main__':
    solve()


Measured memory_bytes: 21984
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC156_C
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var x = Console.ReadLine().Split().Select(int.Parse).ToArray();

            var p = (int)Math.Round(x.Average(), 0);

            var ans = 0;
            for (int i = 0; i < n; i++)
            {
                ans += (int)Math.Pow(Math.Abs(x[i] - p), 2);
            }

            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 13396
#include <bits/stdc++.h>
#define int long long
#define vi vector<int>
#define vvi vector<vector<int>>
#define pb push_back
#define For(i,n)  for(int i=0;i<n;i++)
#define MOD 1000000007
#define MAX 100005
#define MAX2 10000
#define endl '\n'
#define Sort(v) sort(v.begin(), v.end())
using namespace std;
void show(int a[MAX], int n)
{
    For(i,n)
        cout<<a[i]<<" ";
    cout<<"\n";
}

void show1(int a[MAX2][MAX2], int r, int c)
{
    For(i,r)
    {
        For(j,c)
        {
            cout<<a[i][j]<<" ";
        }
        cout<<endl;
    }
}



bool check(vi a ,int k)
{
    For(i,a.size())
    {
        if (a[i] == k)
            return true;
    }
    return false;
}

int32_t main()
{
    int t,n,c,ok;
    cin>>t>>n>>c>>ok;
    int sum = t*c;
    if (t*ok > sum)
    {
        sum = t*ok;
    }
    if (n*c > sum)
    {
        sum = n*c;
    }
    if (n*ok > sum)
    {
        sum = n*ok;
    }
    cout<<sum<<endl;
}



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

int main(){
  ll n; cin>>n;
  ll a[3*n];
  rep(i,0,3*n) cin>>a[i]; 
  sort(a,a+3*n);
  reverse(a,a+3*n);
  ll ans=0;
  int count=0;
  for(int i=1;i<3*n;i+=2){
      ans+=a[i];
      count++;
      if(count==n) break;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 2560
# Dinic's algorithm
from collections import deque
class Dinic:
    def __init__(self, N):
        self.N = N
        self.G = [[] for i in range(N)]

    def add_edge(self, fr, to, cap):
        forward = [to, cap, None]
        forward[2] = backward = [fr, 0, forward]
        self.G[fr].append(forward)
        self.G[to].append(backward)

    def add_multi_edge(self, v1, v2, cap1, cap2):
        edge1 = [v2, cap1, None]
        edge1[2] = edge2 = [v1, cap2, edge1]
        self.G[v1].append(edge1)
        self.G[v2].append(edge2)

    def bfs(self, s, t):
        self.level = level = [None]*self.N
        deq = deque([s])
        level[s] = 0
        G = self.G
        while deq:
            v = deq.popleft()
            lv = level[v] + 1
            for w, cap, _ in G[v]:
                if cap and level[w] is None:
                    level[w] = lv
                    deq.append(w)
        return level[t] is not None

    def dfs(self, v, t, f):
        if v == t:
            return f
        level = self.level
        for e in self.it[v]:
            w, cap, rev = e
            if cap and level[v] < level[w]:
                d = self.dfs(w, t, min(f, cap))
                if d:
                    e[1] -= d
                    rev[1] += d
                    return d
        return 0

    def flow(self, s, t):
        flow = 0
        INF = 10**9 + 7
        G = self.G
        while self.bfs(s, t):
            *self.it, = map(iter, self.G)
            f = INF
            while f:
                f = self.dfs(s, t, INF)
                flow += f
        return flow

N=int(input())
a=list(map(int,input().split()))

jew=Dinic(N+2)
ans=0
for i in range(N):
    if a[i]>=0:
        ans+=a[i]
        jew.add_edge(0,i+1,a[i])
    else:
        jew.add_edge(i+1,N+1,-a[i])

inf=10**15
for i in range(1,N+1):
    for j in range(1,N//i+1):
        jew.add_edge(i*j,i,inf)

f=jew.flow(0,N+1)
print(ans-f)

Measured memory_bytes: 41196
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
using ll = long long;

const long double PI = acos(-1.0);
const int MOD = 1e9 + 7;

int main() {
    int a, b;
    cin >> a >> b;
    cout << a * b << endl;

    return 0;
}

Measured memory_bytes: 3632