akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<sstream>
#include<fstream>
#include<cstdio>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<algorithm>
#include<cmath>
#include<cstdlib>
#include<string>
using namespace std;

int main(){
	int n,r;
	while(scanf(" %d ",&n)!=EOF){
		scanf("%d",&r);
		vector<int> args;
		for(int x=0;x<r;++x){	
			int j;scanf("%d",&j);
			args.push_back(j);
		}
		vector<int> deck;
		for(int x=0;x<n;++x)deck.push_back(x);
		
		queue<int> A,B;
		for(int w=0;w<args.size();++w){
			int i = n-(n+1)/2;
			for(int x=0;x<i;++x)B.push(deck[x]);
			for(int x=i;x<n;++x)A.push(deck[x]);
			i = args[w];
			deck.clear();
			while(A.size()>=i && B.size()>=i){
				for(int x=0;x<i;++x){
					deck.push_back(A.front());
					A.pop();
				}
				for(int x=0;x<i;++x){
					deck.push_back(B.front());
					B.pop();
				}
			}
			while(!A.empty()){
				deck.push_back(A.front());
				A.pop();
			}
			while(!B.empty()){
				deck.push_back(B.front());
				B.pop();
			}
		}
		cout<<deck[n-1]<<endl;
	}
	return 0;
}

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

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

  int r = 0;
  while (a >= b) {
    b *= 2;
    r++;
  }
  while (b >= c) {
    c *= 2;
    r++;
  }
  cout << (r <= k ? "Yes" : "No") << endl;
}


Measured memory_bytes: 3596
//大文字->小文字 tolower(),逆はtoupper()
//int a = stoi(c); 文字列をintへ
//途中の出力をそのまま残さない
//数値計算 個数以外はdouble
//map<キー,値> p は辞書。p[キー] = 値
//map 全探索
//auto begin = p.begin(), end = p.end();
//for (auto it = begin; it != end; i++) {}
//mapのキー：it->first mapのバリュー：it->second
//絶対値 abs()
//入力は空白で切れる
//大文字判定 isupper(文字) 小文字判定 islower(文字)
//do{}while(next_permutation(ALL(配列)))
#include <bits/stdc++.h>
#define rep(i,N) for(int i = 0; i < N;i++)
#define ALL(a) (a).begin(),(a).end()
#define ll long long int
using namespace std;

// K進数でのNの桁数
ll dig(ll N,ll K) {
	ll dig = 0;
	while (N) {
		dig++;
		N /= K;
	}
	return dig;
}
// x,yの最大公約数
ll gcd(ll x, ll y) {
	ll r;
	while (x%y) {
		r = x % y;
		x = y;
		y = r;
	}
	return y;
}

int main() {
	int N, A, B; cin >> N >> A >> B;
	cout << min(A * N, B) << endl;
}

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

void insert(int _value);
void delete(int _value);
void deleteFirst(void);
void deleteLast(void);

struct Node{

  struct Node* next;
  struct Node* prev;
  int value;

};

struct Node* head;
struct Node* tail;
main(){

  int i;
  int n;
  int tmpValue;
  char str[20];
  struct Node* node;

  head = (struct Node*)malloc(sizeof(struct Node));
  tail = (struct Node*)malloc(sizeof(struct Node));
  head->next = tail;

  scanf("%d",&n);

  for(i=0; i<n; i++){
    scanf("%s",str);
    if(!strcmp(str,"insert")){
      scanf("%d",&tmpValue);
      insert(tmpValue);
    }else if(!strcmp(str,"deleteFirst")){
      deleteFirst();
    }else if(!strcmp(str,"deleteLast")){
      deleteLast();
    }else if(!strcmp(str,"delete")){
      scanf("%d",&tmpValue);
      delete(tmpValue);
    }
  }

  for(node=head->next; node != tail; node=node->next){
    printf("%d",node->value);
    if(node->next!=tail){
      printf(" ");
    }
  }
  printf("\n");

  return 0;

}

void insert(int _value){

  struct Node* newNode;
  struct Node* tmpNode;

  newNode = (struct Node*)malloc(sizeof(struct Node));

  tmpNode = head->next;
  if(tmpNode != NULL){
    tmpNode->prev = newNode;
  }
  head->next = newNode;
  newNode->next = tmpNode;
  newNode->prev = head;

  newNode->value = _value;

}

void delete(int _value){

  struct Node* node;
  struct Node* tmpNode;
  for(node=head->next; node != NULL; node=node->next){
    if(node->value == _value){
      tmpNode = node->prev;
      if(tmpNode != NULL){
	tmpNode->next = node->next;
      }
      if(node->next != NULL){
	node->next->prev = tmpNode;
      }
      break;
    }
  }

}

void deleteFirst(){

  struct Node* node;
  node=head->next;

  if(head != NULL){
    head->next= node->next;
  }
  if(node->next != NULL){
    node->next->prev = head;
  }
  free(node);

}

void deleteLast(){

  struct Node* tmpNode;

  tmpNode=tail->prev;
  tail->prev=tmpNode->prev;
  tmpNode->prev->next=tail;

  free(tmpNode);

}

Measured memory_bytes: 15000
#include <iostream>
#include <algorithm>
#include <vector>

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

  std::vector<long long> cities;
  for(int i=0; i<=N; i++)
  {
    long long c;
    std::cin >> c;
    cities.push_back(c);
  }

  std::vector<long long> slayers;
  for(int i=0; i<N; i++)
  {
    long long s;
    std::cin >> s;
    slayers.push_back(s);
  }

  long long killed = 0;

  for(int i=N-1; 0<=i; i--)
  {
    long long kill1 = std::min(cities[i+1], slayers[i]);
    killed += kill1;
    cities[i+1] -= kill1;
    slayers[i] -= kill1;
    long long kill2 = std::min(cities[i], slayers[i]);
    killed += kill2;
    cities[i] -= kill2;
    slayers[i] -= kill2;
  }

  std::cout << killed;
}


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

long long fact[1000000] = {0};
int MOD = 1000000007;

long long factorial(int n){
  if(n == 1) return 1;
  if(fact[n] != 0) return fact[n];
  return fact[n] = n * (factorial(n-1) % MOD);
}

int main(void){
  int n ; cin >> n;
  cout << factorial(n) % MOD << endl;

  return 0;
}

Measured memory_bytes: 2560
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<queue>
typedef long long ll;
using namespace std;



int main(){
	int n; cin >> n;
	string s; cin >> s;
	ll count = 0;
	for (int i = 0; i < 10; ++i){
		for (int j = 0; j < 10; ++j){
			for (int k = 0; k < 10; ++k){
				bool f1 = 0;
				bool f2 = 0;
				bool f3 = 0;
				for (int l = 0; l < n; ++l){
					if (!f1 && (int)(s[l] - '0') == i){
						f1 = 1;
						continue;
					}
					if (!f2 && f1 && (int)(s[l] - '0') == j){
						f2 = 1;
						continue;
					}
					if (f2 && (int)(s[l] - '0') == k){
						f3 = 1;
						break;
					}
				}
				if (f3) count++;
			}
		}
	}
	cout << count << endl;
	return 0;
}




Measured memory_bytes: 256
n, k = map(int, input().split())
a = list(map(int, input().split()))
s = sum(a)

cands = []
for x in range(1, int(s ** 0.5) + 1):
    if s % x == 0:
        cands.append(x)
        if x != s // x:
            cands.append(s // x)

cands.sort(reverse=True)
#print(cands)

ans = 0
for cand in cands:
    b = [a[i] % cand for i in range(n)]
    b.sort()
    sb = [0 for _ in range(n+1)]
    for i in range(n):
        sb[i+1] = sb[i] + b[i]
    #print(cand, sb)

    flg = False
    for i in range(n+1):
        x = max(sb[i], cand * (n - i) - (sb[n] - sb[i]))
        #print(i, sb[i], cand * (n - i) - (sb[n] - sb[i]))
        if x <= k:
            flg = True
            break

    if flg:
        print(cand)
        break

Measured memory_bytes: 3188
package main

import (
	"bufio"
	"container/heap"
	"fmt"
	"os"
	"strconv"
)

var sc *bufio.Scanner = func() *bufio.Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	return sc
}()

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

// IntHeap ...
type IntHeap []int

func (h IntHeap) Len() int           { return len(h) }
func (h IntHeap) Less(i, j int) bool { return h[i] > h[j] }
func (h IntHeap) Swap(i, j int)      { h[i], h[j] = h[j], h[i] }

// Push is pointer receiver
func (h *IntHeap) Push(x interface{}) {
	*h = append(*h, x.(int))
}

// Pop is pointer receiver
func (h *IntHeap) Pop() interface{} {
	old := *h
	n := len(old)
	x := old[n-1]
	*h = old[0 : n-1]
	return x
}

func (h *IntHeap) discount(m int) {
	for i := 0; i < m; i++ {
		maxPrice := heap.Pop(h).(int)
		heap.Push(h, maxPrice/2)
	}
}

func (h *IntHeap) sum() (price int) {
	for _, p := range *h {
		price += p
	}
	return
}

func main() {
	n, m := nextInt(), nextInt()
	prices := make(IntHeap, n)
	for i := 0; i < n; i++ {
		prices[i] = nextInt()
	}
	heap.Init(&prices)
	prices.discount(m)
	r := prices.sum()
	fmt.Println(r)
}


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

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


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

    cout << 3*(N - gcd(N,X)) << endl;

    return 0;
}

Measured memory_bytes: 256
import sys
from collections import deque

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, K, *A = map(int, read().split())

    pos = [a for a in A if a >= 0]
    neg = [a for a in A if a < 0]

    pos.sort()
    neg.sort(reverse=True)

    if N == K:
        vec = A
    elif N == len(neg):
        if K & 1:
            vec = neg[:K]
        else:
            vec = neg[-K:]
    else:
        ans_pos = []
        ans_neg = []
        for _ in range(K):
            if not pos:
                ans_neg.append(neg.pop())
            elif not neg:
                ans_pos.append(pos.pop())
            elif pos[-1] > -neg[-1]:
                ans_pos.append(pos.pop())
            else:
                ans_neg.append(neg.pop())

        if (len(ans_neg) & 1) and ((not ans_pos) or (ans_pos[-1] != 0)):
            if not pos or not ans_neg:
                drop_pos = True
            elif not neg or not ans_pos:
                drop_pos = False
            else:
                drop_pos = pos[-1] * ans_pos[-1] < neg[-1] * ans_neg[-1]

            if drop_pos:
                ans_neg.append(neg.pop())
                ans_pos.pop()
            else:
                ans_pos.append(pos.pop())
                ans_neg.pop()

        vec = ans_pos + ans_neg

    ans = 1
    for a in vec:
        ans = ans * a % MOD

    print(ans)
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 131116
import java.util.*;

public class Main {
  public static void main (String args[]){
    Scanner sc = new Scanner(System.in);
    int cnt = 0;
	int n = sc.nextInt();
    boolean[] used = new boolean[n];
    int [][] red = new int [n][2];
    int [][] blue = new int [n][2];
    
    for(int i=0;i<n;i++){
      red[i][0] = sc.nextInt();
      red[i][1] = sc.nextInt();
    }
    
    for(int j=0;j<n;j++){
      blue[j][0] = sc.nextInt();
      blue[j][1] = sc.nextInt();
    }
    
    Arrays.sort(red, (x,y) -> x[1] - y[1]);
    Arrays.sort(blue, (x,y) -> x[0] - y[0]);
		for(int k=0; k<n; k++) {
			for(int l=n-1; l>=0; l--) {
				if(blue[k][0]>red[l][0]&&blue[k][1]>red[l][1]&&!used[l]) {
					cnt += 1;
					used[l] = true;
					break;
				}
			}
		}
		System.out.println(cnt);
    
  }
}

Measured memory_bytes: 28112
r, g, b, n = map(int, input().split())

ans = 0

for i in range(n + 1):
    if i * r > n:
        break
    for j in range(n + 1):
        if i * r + j * g > n:
            break
        bnum = n - i * r - j * g
        if bnum % b == 0:
            ans += 1
print(ans)


Measured memory_bytes: 8976
/**
 * @author pr4shan7 (प्रशांत)
 */
// everything has a cost!

#ifdef _MAVERICK
#define _DEBUG
#else
#pragma GCC optimize("O2", "unroll-loops", "omit-frame-pointer", "inline")
#pragma GCC option("arch=native", "tune=native", "no-zero-upper")
#pragma GCC target("avx,avx2,fma")
// #pragma GCC reset_options
#endif

#ifndef _DEBUG
#define NDEBUG
#endif

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

#define endl '\n'
// #define cerr cout
// #define int long long
// #define double long double

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pb_set;
typedef unordered_set<int> usi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef set<int> si;
typedef long long ll;
#define pb push_back
#define x first
#define y second
#define cai static_cast<int>
#define cad static_cast<double>
#define cal static_cast<long long>
#define all(z) z.begin(), z.end()
#define tr(cont, itm) for (auto&& itm : cont)
#define rep(in, beg, sz) for (int in = beg; in < sz; in++)
#define rrep(in, sz, beg) for (int in = sz - 1; in >= beg; in--)
#define rtr(cont, itr) for (auto itr = cont.end() - 1; itr >= cont.begin(); itr--)

#ifdef _DEBUG
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

template <typename... T> inline void debug_out(const T&...);
#else
#define debug(...) 42
#endif

template <typename T> inline istream& operator>>(istream& in, vector<T>& ar);
template <typename T> inline ostream& operator<<(ostream& out, const vector<T>& ar);
template <typename T> constexpr inline T pow(long long, long long, const T);

const int N = 1e5 + 5;
const int INF = 1e9;
const int MV = 1e9 + 7;

// beautiful things don't ask for attention



int32_t main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

#ifdef _MAVERICK
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
	freopen("err.txt", "w", stderr);
#endif

	int l; cin >> l;
	double d=1.0*l/3;
	cout <<fixed<<setprecision(8)<< pow(d,3);

	return 0;
}


#ifdef _DEBUG
template <typename... T>
inline void debug_out(const T&... args) { ((cerr << ' ' << args), ...); cerr << endl; }
#endif

template <typename T>
inline istream& operator>>(istream& in, vector<T>& ar) {
	for (auto& i : ar) in >> i;
	return in;
}

template <typename T>
inline ostream& operator<<(ostream& out, const vector<T>& ar) {
	for (int i = 0; i < ar.size() - 1; i++) out << ar[i] << ' ';
	out << ar[ar.size() - 1];
	return out;
}

template <typename T>
constexpr inline T pow(long long a, long long b, const T mv) {
	long long res = 1;
	a %= mv;
	while (b) {
		if (b & 1)
			res = (res * a) % mv;
		b >>= 1;
		a = (a * a) % mv;
	}
	return res;
}

// get busy living or get busy dying


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    long long int d;
    cin >> n >> d;
    int ans = 0;
    for (int i = 0; i < n; i++){
        long long int x,y;
        cin >> x >> y;
        if (x*x+y*y <= d*d){
            ans++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3644
#include <iostream>

using namespace std;

int main() {
    int d[50];
    int n;

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

    int total = 0;

    for (int i=0; i<n; i++) {
        for (int j=i; j<n; j++) {
            if (i==j) continue;
            total += d[i] * d[j];
        }
    }

    cout << total << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

// (1) ??¨????????°r???????????????
// (2) ??¨????????°c???????????????
// (3) r + 1??¨c + 1???????¬??????????((r + 1) ?? (c + 1))?????¨?????????

// (4) r - 1????????\?????????????????????
	// (4.1) c - 1????????\?????????????????????
		// (4.1.1) ??°??????????????????
		// (4.1.2) ?????????????????°??????????¬??????????((r + 1) ?? (c + 1))???????´???????

// (5) r - 1????????\?????????????????????
	// (5.1) c - 1????????\?????????????????????
		// (5.1.1) (4.1.2)??§????´?????????°????????¨?????????
		// (5.1.2) ????´??????????????????§?????£???????????°???????¶?????????????(c[0] + c[1] + ?????????c[n])
		// (5.1.3) c - 1?????°???????????´????????\?????????????????????
			// (5.1.3.1) c - 1?????§???????¨???????c????????¨?????????
	// (5.2) ?????????r - 1????????£???????????\?????????????????????
		// (5.2.1) ?????????????????????
	// (5.3) ??????????????????

// (6) c????????\?????????????????????
	// (6.1) r - 1????????\?????????????????????
		// (6.1.1) ????´??????????????????§????¬??????????????´?????????°???????¶?????????????(r[0] + r[1] + ?????????r[n])
	// (6.2) c??????????????????r??????r - 1?????§???????¨?????????¨?????????

public class Main {

	public static void main(String[] args) {

		int r = 0;
		int c = 0;

		Scanner scan = new Scanner(System.in);

		r = scan.nextInt();
		c = scan.nextInt();

		int[][] matrix = new int[r + 1][c + 1];

		for (int i = 0; i < r; i++) {
			for (int j = 0; j < c; j++) {
				int matNum = scan.nextInt();
				matrix[i][j] = matNum;
			}
		}
		for (int i = 0; i < r; i++) {
			for (int j = 0; j < c; j++) {
				System.out.print(matrix[i][j]);
				System.out.print(" ");

				matrix[i][c] += matrix[i][j];

				matrix[r][j] += matrix[i][j];

				matrix[r][c] += matrix[i][j];
			}
			System.out.print(matrix[i][c]);
			System.out.println();
		}
		for (int j = 0; j < c + 1; j++) {
			System.out.print(matrix[r][j]);
			if (j == c) {
				break;
			}
			System.out.print(" ");
		}
		System.out.println();
		scan.close();
	}
}

Measured memory_bytes: 41848
#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <algorithm>
#include <set>

using namespace std;

int main() {
  int N;
  cin >> N;
  vector<long> A(N+1);
  A.at(0) = 0;
  for (int i=1; i<N+1; i++) {
    long tmp;
    cin >> tmp;
    A.at(i) = A.at(i-1) + tmp;
  }

  sort(A.begin(), A.end());
  long tmp = A.at(0);
  long n = 1;
  long ans = 0;
  for (int i=1; i<N+1; i++) {
    if (A.at(i) == tmp) {
      n++;
    } else {
      ans += n*(n-1)/2;
      n = 1;
    }
    tmp = A.at(i);
  }
  ans += n*(n-1)/2;
  cout << ans << endl;
}

Measured memory_bytes: 1792
import Control.Monad
import Control.Applicative
import Data.Functor
import Data.List
import Data.Char

readInt = readLn :: IO Int
readInts = map read . words <$> getLine :: IO [Int]
cond t f c = if c then t else f
-- end of templete

ceil1e3 x = (x `div` 1000 + (if ((/=0) . flip mod 1000) x then 1 else 0)) * 1000
f x = ceil1e3 . (flip div 100 . (*105)) $ x

main = readInt >>= print . foldr ($) 100000 . flip replicate f

Measured memory_bytes: 3672
#include<stdio.h>
int main(void)
{
	int a, b, c;

	scanf("%d %d %d", &a, &b, &c);
    if (a < c && c < b) {
        printf("Yes");
    }
    else if (b < c && c < a)
    {
        printf("Yes");
    }
    else
        printf("No");
	return 0;

}



Measured memory_bytes: 128
import std.algorithm, std.container, std.conv, std.math, std.range, std.typecons, std.stdio, std.string;

auto rdsp(){return readln.splitter;}
void pick(R,T)(ref R r,ref T t){t=r.front.to!T;r.popFront;}
void readV(T...)(ref T t){auto r=rdsp;foreach(ref v;t)pick(r,v);}
void readA(T)(size_t n,ref T[]t){t=new T[](n);auto r=rdsp;foreach(ref v;t)pick(r,v);}

void main()
{
  int n; readV(n);
  int t, a; readV(t, a); t *= 1000; a *= 1000;
  int[] h; readA(n, h);

  auto d = 10^^9, p = 0;
  foreach (int i, hi; h) {
    auto e = (t-hi*6-a).abs;
    if (e < d) {
      p = i+1;
      d = e;
    }
  }
  writeln(p);
}



Measured memory_bytes: 256
def pal(t):
  return t == t[::-1];


s = input();
f = pal(s) and pal(s[0:len(s)//2:]) and pal(s[(len(s)//2 + 1)::]);
#f = pal(s);
if f == True:
  print("Yes");
else:
  print("No");


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

int main() {
  string a,b;
  cin >> a >> b;
  
  int count = 0;
  for(int i = 0; i < a.size(); i++) {
    if(a.at(i) == b.at(i)) {
      count++;
    }
  }
  if(a.size() == count) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3544
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define fi first
#define se second
typedef long long ll;
typedef pair<int,int> P;
#define MOD 1000000007
#define INF 1000000000
#define int long long
int gcd(int a,int b){
	if(b==0)return a;
	return gcd(b,a%b);
}
int lcm(int a,int b){
	return a/gcd(a,b)*b;
}
int modpow(int a,int b){
    if(!b)return 1;
    if(b%2)return modpow(a,b-1)*a%MOD;
    return modpow(a,b/2)*modpow(a,b/2)%MOD;
}
int fac(int a){
    int Ans=1;
    for(int i=1;i<=a;i++){
        Ans*=i;
        Ans%=MOD;
    }
    return Ans;
}//kaijo
int comb(int a,int b){
    return fac(a)*modpow(fac(a-b),MOD-2)%MOD*modpow(fac(b),MOD-2)%MOD;
}
int n;
int a[1145141];
int b[1145141];
int cnt=0;
int ans=0;
signed main(){
	cin>>n;
	rep(i,n)cin>>a[i];
	b[0]=0;
	rep(i,n)b[i+1]=b[i]+a[i];
	sort(b,b+n+1);
	rep(i,n){
		if(b[i+1]==b[i])cnt++;
		else{
			ans+=(cnt+1)*cnt/2;
			cnt=0;
		}
	}
	ans+=(cnt+1)*cnt/2;
	cout<<ans<<endl;
	return 0;
}


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

int main(){
	int a,b,x;
	cin >> a >> b >> x;
	string ans = "NO";
	if(a <= x && a+b >= x){
		ans = "YES";
}
	cout << ans << endl;
	return 0;

}




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

int main(){
    string S;
    cin >> S;
    int flag=0;
    
    for(int i=0; i<S.size(); i++){
        for(int j=0; j<S.size(); j++){
            if(i != j && S[i]==S[j]){
                flag = 1;
                cout << "no" << endl;
                break;
            }
        }
        if(flag) break;
    }
    if(flag==0) cout << "yes" << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bits/stdc++.h>
#include <cstdint>
#include <iostream>
#include <iterator>
#include <vector>

// lib/util.hpp
#ifndef UTIL_HPP
#define UTIL_HPP


typedef ::std::int_fast64_t i64;
typedef ::std::uint_fast64_t u64;
typedef ::std::int_fast32_t i32;
typedef ::std::uint_fast32_t u32;

namespace tools {
  template <typename T>
  void read(::std::istream& is, ::std::vector<T>& vector, const typename ::std::vector<T>::size_type size) {
    vector.reserve(size);
    ::std::copy_n(::std::istream_iterator<T>(is), size, ::std::back_inserter(vector));
  }
  template <typename T>
  void read(::std::vector<T>& vector, const typename ::std::vector<T>::size_type size) {
    ::tools::read(::std::cin, vector, size);
  }

  template <typename T, ::std::size_t N>
  void read(::std::istream& is, ::std::array<T, N>& array) {
    ::std::copy_n(std::istream_iterator<T>(is), N, array.begin());
  }
  template <typename T, ::std::size_t N>
  void read(::std::array<T, N>& array) {
    ::tools::read(::std::cin, array);
  }
}

#endif

// main.cpp

int main() {
  i64 X;
  std::cin >> X;
  std::cout << (X % 100 <= X / 100 * 5) << std::endl;
  return 0;
}

Measured memory_bytes: 256
// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<chrono>
#include<iomanip>
#include<map>
#include<set>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using TP = tuple<ll,ll,ll>;
void init_io(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(18);
}
ll n;
const ll MAX =17;
const ll INF = 1e18;
vector<ll> ans(MAX,INF);
vector<ll> x(MAX),y(MAX),p(MAX);
void solve(ll t,ll c,vector<ll> &xv,vector<ll> &yv){
  if(t==n){
    ll sum = 0;
    for(int i=0;i<n;i++){
      ll tmp = min(abs(x[i]),abs(y[i]));
      for(auto lx: xv){
        tmp = min(tmp,abs(x[i]-lx));
      }
      for(auto ly: yv){
        tmp = min(tmp,abs(y[i]-ly));
      }
      sum += tmp*p[i];
    }
    ans[c] = min(ans[c],sum);
    return;
  }
  xv.push_back(x[t]);
  solve(t+1,c+1,xv,yv);
  xv.pop_back();

  yv.push_back(y[t]);
  solve(t+1,c+1,xv,yv);
  yv.pop_back();

  solve(t+1,c,xv,yv);
}
signed main(){
  init_io();
  cin >> n;
  for(int i=0;i<n;i++){
    cin >> x[i] >> y[i] >> p[i];
  }
  vector<ll> tx,ty;
  solve(0,0,tx,ty);
  for(int i=0;i<=n;i++){
    cout << ans[i]<<endl;
  }
}


Measured memory_bytes: 3636
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		Map<Integer, Integer> map = new HashMap<Integer, Integer>();
		for(int i=0;i<n;i++){
			int a = sc.nextInt();
			if(map.containsKey(a))
				map.put(a, map.get(a)+1);
			else
				map.put(a, 1);
		}
		
		
		int r = 0;
		for(Map.Entry<Integer, Integer> m : map.entrySet()){
			int key = m.getKey();
			int cnt = m.getValue();
			
			if(cnt<key)
				r+=cnt;
			else if(cnt>key)
				r+=(cnt-key);
		}
		
		System.out.println(r);
	}

}


Measured memory_bytes: 63392
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<limits.h>

#define rep(i,begin,end) for(int i=begin; i<end; i++)
#define lld long long int

int main(){
    int n, a[26]={0}, b[26]={0}, ans = 0, count;
    scanf("%d", &n);
    char s[n+1];
    scanf("%s", s);
    rep(i, 0, n){
        a[s[i] - 'a']++;
    }
    rep(i, 0, n){
        a[s[i] - 'a']--;
        b[s[i] - 'a']++;
        count = 0;
        rep(j, 0, 26){
            if(a[j]>0 && b[j]>0){
                count++;
            }
        }
        if(ans < count){
            ans = count;
        }
    }
    printf("%d", ans);

    return 0;
}

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

int n, arr[1111];

signed main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  int res = 0;
  while (1) {
    for (int i = 0; i < n; i++) {
      if (arr[i] & 1) {
        cout << res << endl;
        return 0;
      }
    }
    for (int i = 0; i < n; i++) {
      arr[i] >>= 1;
    }
    res += 1;
  }
  return 0;
}


Measured memory_bytes: 256
#pragma region
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define repc(i, m, n) for (int i = m; i < n; i++)
#define reprc(i, m, n) for (int i = m; i > n; i--)
#define all(v) v.begin(), v.end()
#define INF 1e9
#define EPS 1e-10
using namespace std;
typedef long long ll;
#pragma endregion

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

    cout << N / 2 + N % 2 << endl;
}

Measured memory_bytes: 256
import java.util.HashSet;
import java.util.Scanner;

public class Main {

	private static final String POSSIBLE = "POSSIBLE";
	private static final String IMPOSSSIBLE = "IMPOSSIBLE";

	public static void main(String[] args) {
		new Main().execute();
	}

	public void execute() {
		Scanner sc = new Scanner(System.in);
		final int N = sc.nextInt();
		final int M = sc.nextInt();
		HashSet<Integer> fromOne = new HashSet<>();
		HashSet<Integer> toN = new HashSet<>();
		
		for (int i=0; i<M; i++) {
			int ai = sc.nextInt();
			int bi = sc.nextInt();
			if(ai ==1) {
				fromOne.add(bi);
			}
			if(bi == N) {
				toN.add(ai);
			}
		}
		
		sc.close();
		
		for(Integer n: fromOne) {
			if(toN.contains(n)) {
				System.out.println(POSSIBLE);
				return;
			}
		}
		System.out.println(IMPOSSSIBLE);
	}

}


Measured memory_bytes: 112728
//2018年  3月 24日 土曜日 02:59:05 JST-03:14:20
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cout << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cout<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 200010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = 1 << 29;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
///////////////////////////////////////////////////////////////////////////////////////////////////

int N;
multiset<int> A;

void solve() {
	cin >> N;
	if(N == 2) {
		int a, b;
		cin >> a >> b;
		if(a == 1 && b == 1) cout << "Possible\n";
		else cout << "Impossible\n";
		return;
	}
	int big = 0;
	rep(i, 0, N) {
		int a; cin >> a;
		A.insert(a);
		MAX(big, a);
	}
	if(big % 2 == 1) {
		rep(i, 0, (big + 1) / 2) {
			if(A.count(big - i) < 2) {
				cout << "Impossible\n";
				return;
			}
			A.erase(A.find(big - i));
			A.erase(A.find(big - i));
		}
		int low = big - ((big + 1) / 2 - 1) + 1, high = big;
		for(int v : A) {
			if(v < low || high < v) {
				cout << "Impossible\n";
				return;
			}
		}
	}
	else {
		rep(i, 0, big / 2) {
			if(A.count(big - i) < 2) {
				cout << "Impossible\n";
				return;
			}
			A.erase(A.find(big - i));
			A.erase(A.find(big - i));
		}
		if(A.count(big / 2) != 1) {
			cout << "Impossible\n";
			return;
		}
		A.erase(A.find(big / 2));
		int low = big / 2 + 1, high = big;
		for(int v : A) {
			if(v < low || high < v) {
				cout << "Impossible\n";
				return;
			}
		}
	}
	cout << "Possible\n";
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
	srand((unsigned int)time(NULL));
#ifdef LOCAL
	//freopen("in.txt", "wt", stdout); //for tester
    freopen("in.txt", "rt", stdin);
#endif	
	solve();
#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}



Measured memory_bytes: 256
import sys
s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in ss]
ss2nnn = lambda ss: [s2nn(s) for s in ss]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [sys.stdin.readline().rstrip() for _ in range(n)]
ii2sss = lambda n: [list(sys.stdin.readline().rstrip()) for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

import math

def main():
    N, D = i2nn()
    n = int(math.ceil(N / (2*D+1)))
    print(n)

main()


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

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

  for (long long a = 1; a <= 3500; ++a) {
    for (long long b = 1; b <= 3500; ++b) {
      long long d = 4 * a * b - n * b - n * a;
      long long e = n * a * b;
      if (d > 0 && e % d == 0) {
        cout << a << " " << b << " " << e / d << endl;
        return 0;
      }
    }
  }
}


Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int a, b, c, d;
  
  scanf("%d %d %d %d", &a, &b, &c, &d);
  
  if(a + b > c + d){
    printf("Left\n");
  } else if(a + b == c + d){
    printf("Balanced\n");
  } else {
    printf("Right\n");
  }
  
  return 0;
}

Measured memory_bytes: 128
/*+lmake
 * STD = c++14
 * DEFINE += WAAUTOMATON
 */
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
#ifdef WAAUTOMATON
#define debug(args...)                                                                             \
    {                                                                                              \
        dbg, args;                                                                                 \
        cerr << endl;                                                                              \
    }
#define massert(x) assert(x)
#else
#define debug(args...) // Just strip off all debug tokens
#define massert(x)
#endif
struct debugger
{
    template <typename T>
    debugger &operator,(const T &v)
    {
        cerr << v << " ";
        return *this;
    }
} dbg;
const int MAXN = 200000;
vector<int> g[MAXN + 10];
int cnt[MAXN + 5][2];
bool vis[MAXN + 10];
void solve(long long n, long long m, string s, vector<long long> a, vector<long long> b)
{
    for (int i = 0; i < m; ++i) {
        g[a[i]].push_back(b[i]);
        g[b[i]].push_back(a[i]);
        if (s[a[i] - 1] == 'A')
            cnt[b[i]][0]++;
        else
            cnt[b[i]][1]++;
        if (s[b[i] - 1] == 'A')
            cnt[a[i]][0]++;
        else
            cnt[a[i]][1]++;
    }
    queue<int> q;
    memset(vis, true, sizeof(vis));
    for (int i = 1; i <= n; ++i) {
        if (cnt[i][0] == 0 || cnt[i][1] == 0) {
            q.push(i);
            vis[i] = false;
        }
    }
    while (!q.empty()) {
        int now = q.front();
		q.pop();
        for (auto i : g[now]) {
            int t = (s[now - 1] == 'A') ? 0 : 1;
            cnt[i][t]--;
            if (cnt[i][t] == 0 && vis[i]) {
                q.push(i);
                vis[i] = false;
            }
        }
    }
	for(int i=1; i<=n; ++i) {
		if (vis[i]) {
			puts("Yes");
			return;
		}
	}
	puts("No");

}

int main()
{
#ifdef WAAUTOMATON
    // freopen("in.txt","r",stdin);
#endif
    long long M;
    long long N;
    string s;
    scanf("%lld", &N);
    scanf("%lld", &M);
    vector<long long> b(M - 1 + 1);
    vector<long long> a(M - 1 + 1);
    cin >> s;
    for (int i = 0; i <= M - 1; i++) {
        scanf("%lld", &a[i]);
        scanf("%lld", &b[i]);
    }
    solve(N, M, s, a, b);
    return 0;
}


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

long long fn[200001];
long long sumn[200001];
const long long mod = 1000000000 + 7;

int main() {
    int N, c, lastc;
    std::cin >> N >> lastc;
    fn[0] = 1;
    sumn[lastc] = 1;
    for (int i = 1; i < N; i++, lastc = c) {
        std::cin >> c;
        if (c == lastc) {
            fn[i] = fn[i-1];
            continue;
        }
        fn[i] = fn[i-1] + sumn[c];
        sumn[c] += fn[i-1];
        sumn[c] %= mod;
    }
    std::cout << fn[N-1] % mod << std::endl;
    return 0;
}


Measured memory_bytes: 3328
n = int(input())
a = list(map(int, input().split(" ")))
a.sort(reverse=True)
alice = 0
bob = 0
for i in range(0, n):
    if i % 2 == 0:
        alice += a[i]
    else: 
        bob += a[i]
print(int(alice - bob))

Measured memory_bytes: 9116
import sys
sys.setrecursionlimit(10**7)

readline = sys.stdin.buffer.readline
def readstr():return readline().rstrip().decode()
def readstrs():return list(readline().decode().split())
def readint():return int(readline())
def readints():return list(map(int,readline().split()))
def printrows(x):print('\n'.join(map(str,x)))
def printline(x):print(' '.join(map(str,x)))

from math import ceil

n = readint()
a = readints()

ans = 0
for i in range(n):
    a.sort()
    if a[-1]<n:
        break
    ans += 1
    for j in range(n-1):
        a[j]+=1
    a[-1]-=n

a.sort()
while a[-1]-a[0]>n+1:
    x = ceil((a[-1]-a[0]-n-1)/(n+1))
    ans += x
    for j in range(n-1):
        a[j] += x
    a[-1] -= n*x
    a.sort()
if a[-1]>n:
    ans += (a[0]-n+1)*n
    A = a[0]
    for i in range(n):
        a[i] -= A-n+1

while a[-1]>=n:
    ans += 1
    for j in range(n-1):
        a[j]+=1
    a[-1]-=n
    a.sort()

print(ans)




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

int main() {
  int d, n;
  cin >> d >> n;
  int ans = 0;
  if (d == 0) {
    if (n == 100) {
      ans = 101;
    } else {
      ans = n;
    }
  }
  if (d == 1) {
    if (n == 100) {
      ans = 10100;
    } else {
      ans = n * 100;
    }
  }
  if (d == 2) {
    if (n == 100) {
      ans = 1010000;
    } else {
      ans = n * 10000;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3156
#include<bits/stdc++.h>
#include<string.h>
 
typedef long long int ll;
#define all(x) (x).begin(), (x).end()
 
using namespace std;

int nxt() {
    int x;
    cin >> x;
    return x;
}

ll nxtl(){
    ll x;
    cin>>x;
    return x;
}
 
void SieveOfEratosthenes(int n,vector <int> &primes) 
{ 
    // Create a boolean array "prime[0..n]" and initialize 
    // all entries it as true. A value in prime[i] will 
    // finally be false if i is Not a prime, else true. 
    bool prime[n+1]; 
    memset(prime, true, sizeof(prime)); 
  
    for (int p=2; p*p<=n; p++) 
    { 
        // If prime[p] is not changed, then it is a prime 
        if (prime[p] == true) 
        { 
            // Update all multiples of p greater than or  
            // equal to the square of it 
            // numbers which are multiple of p and are 
            // less than p^2 are already been marked.  
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
  
    // Print all prime numbers 
    for (int p=2; p<=n; p++) 
       if (prime[p]) 
          primes.push_back(p);
} 
 
ll max(ll a,ll b)
{
    if(a>b)
        return a;
    return b;
}
 
ll power(ll x, ll y,ll mod) 
{ 
    ll temp; 
    if( y == 0) 
        return 1; 
    temp = power(x, y/2,mod); 
    if (y%2 == 0) 
        return (temp*temp)%mod; 
    else
        return (((x*temp)%mod)*temp)%mod; 
} 

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s;
    cin>>s;
    int test=0;
    if(s=="MON")
        test=6;
    else if(s=="TUE")
        test=5;
    else if(s=="WED")
        test=4;
    else if(s=="THU")
        test=3;
    else if(s=="FRI")
        test=2;
    else if(s=="SAT")
        test=1;
    else 
        test=7;
    cout<<test<<endl;



    
    

    return 0;   
}


 
 


Measured memory_bytes: 256
/*************************************************************************
    > File Name: aoj2249.cpp
    > Author:    WArobot 
    > Blog:      http://www.cnblogs.com/WArobot/ 
    > Created Time: 2017??´06???20??\ ????????? 15??¶23???28?§?
 ************************************************************************/

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

const int MAX_N = 12345;
const int MAX_M = 20010;
const int INF = 1e9;

struct edge{
	int to , cost , money;
	edge(int tt , int tc , int tm) : to(tt) , cost(tc) , money(tm) {} ;
};
typedef pair<int,int> P;

vector< edge > G[MAX_N];
int dis[MAX_N];
int n , m;

void Dijkstra(){
	fill(dis,dis+n+1,INF);
	dis[1] = 0;
	priority_queue< P , vector<P> , greater<P> >	que;
	que.push( P(0,1) );
	while(!que.empty()){
		P p = que.top();	que.pop();
		int v = p.second;
		if( dis[v] < p.first )	continue;
		for(int i = 0 ; i < G[v].size() ; i++){
			edge e = G[v][i];
			if( dis[e.to] > dis[v] + e.cost ){
				dis[e.to] = dis[v] + e.cost;
				que.push( P(dis[e.to] , e.to) );
			}
		}
	}
}
int main(){
	int u , v , cost , money;
	while(~scanf("%d%d",&n,&m) && (n+m)){
		for(int i = 0 ; i <= n ; i++)	G[i].clear();
		for(int i = 0 ; i < m ; i++){
			scanf("%d%d%d%d",&u,&v,&cost,&money);
			G[u].push_back( edge(v,cost,money) );
			G[v].push_back( edge(u,cost,money) );
		}
		Dijkstra();
		int ans = 0;
		for(int i = 2 ; i <= n ; i++){
			int min_money = 0x3f3f3f3f;
			// ????????????????¶???????????????¶????´???¨???????????£??????????´???¨
			for(int j = 0 ; j < G[i].size() ; j++){
				edge e = G[i][j];
				if( dis[ e.to ] + e.cost == dis[i] && min_money > e.money ){
					min_money = e.money;
				}
			}
			//if( min_money != 0x3f3f3f3f )
				ans += min_money;
		}
		printf("%d\n",ans);
	}
	return 0;
}

Measured memory_bytes: 5124
#include<stdio.h>                                                 
#include<math.h>                                                  
                                                                  
int main(void){                                                   
   double R;                                                      
   scanf("%lf",&R);                                               
                                                                  
   printf("%lf",2*R*M_PI);                                        
   return 0;                                                      
}  

Measured memory_bytes: 1752
#include <cstdio>
#include <algorithm>

using namespace std;

struct Stu
{
    int num, rank;
    bool operator < (const Stu& x)const {
        return rank < x.rank;
    }
}stu[100010];
int n;

int main()
{
    scanf("%d", &n);
    for(int i = 0; i < n; i++)
    {
        scanf("%d", &stu[i].rank);
        stu[i].num = i + 1;
    }
    sort(stu, stu + n);
    printf("%d", stu[0].num);
    for(int i = 1; i < n; i++)printf( " %d", stu[i].num);
}

Measured memory_bytes: 1536
cs = [list(map(int, input().split())) for i in range(3)]

for i in range(2):
    d = []
    for j in range(3):
        d += [cs[i + 1][j] - cs[i][j]]

    if len(set(d)) > 1:
        print('No')
        exit()

for j in range(2):
    d = []
    for i in range(3):
        d += [cs[i][j + 1] - cs[i][j]]

    if len(set(d)) > 1:
        print('No')
        exit()

print('Yes')


Measured memory_bytes: 3064
#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<ll,ll>;
//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define inf 2147483647 //int値の最大値
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define CST(x) cout<<fixed<<setprecision(x)//小数点以下の桁数指定
#define debug(x) cerr << #x << ": " << x << "\n"
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 gcd(int a, int b) {
    if (b==0) return a;
    else return gcd(b, a%b);
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
int two(int n){
	ll ans=1;
	rep(i,n){
		ans*=2;
	}
	return ans;
}


int main() {
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);
    
    
    int n;
    cin>> n;
    vector<double>x(n);
    vector<double>y(n);
    rep(i,n)cin>>x.at(i);
    rep(i,n)cin>>y.at(i);

    double sum =0.0;
    rep(i,n) sum+= fabs(x.at(i)-y.at(i));

    double cnt =0.0;
    rep(i,n)cnt += (x.at(i)-y.at(i))*(x.at(i)-y.at(i));

    double tri =0.0;
    rep(i,n) tri += fabs((x.at(i)-y.at(i))*(x.at(i)-y.at(i))*(x.at(i)-y.at(i)));

    //double  infinity =0.0;
    vector<double> t(n);
    rep(i,n) t.at(i)= fabs((x.at(i)-y.at(i)));

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


    cout<<fixed<<setprecision(6);
    cout<<sum<<endl;
    cout<<sqrt(cnt)<<endl;
    cout<<pow(tri,1.0/3.0)<<endl;
    //rep(i,n)cout<<t.at(i)<<endl;
    cout<<t.at(n-1)<<endl;


}


Measured memory_bytes: 3500
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdint>

using std::cin;
using std::cout;
using std::endl;

using std::string;
using std::pair;

using std::vector;
using std::sort;

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

    sort(s.begin(),s.end());
    sort(t.begin(),t.end(),std::greater<char>());

    if(s<t){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    return 0;
}



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

#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 rep(i, n) FOR(i, 0, n)
#define rrep(i, n) RFOR(i, n, 0)
#define dump(x)  cout << #x << " = " << (x) << endl;

typedef long long ll;
typedef pair<int, int> ii;
const int mod = 1e9+7;
const ll INF = 1e18;
const int inf = 1e9;

void solve()
{
  ll n,k; cin>>n>>k;
  vector<ll> a(n);
  rep(i,n) cin>>a[i];
  vector<ll> count(42,0);
  rep(i,42) {
    rep(j,n) {
      count[i] += (a[j]>>i)&1;
    }
  }
  ll x = 0;
  rrep(i, 41) {
    ll c = count[i];
    if (c > n-c) continue;
    ll t = 1LL<<i;
    if (x+t > k) continue;
    x += t;
  }
  ll ans = 0;
  rep(i,n) ans += a[i]^x;
  cout << ans << endl;
}

int main()
{
  solve();
  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
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; }

const long long INF = 1LL << 60;

int n;
long long a[100010][3];

long long dp[100010][3];

int main() {
  cin >> n;
  rep(i,n) rep(j,3) cin >> a[i][j];
  for(int i = 0;i < n;i++) {
    for(int j = 0;j < 3;j++) {
      for(int k = 0;k < 3;k++) {
        if(j == k) continue;
        chmax(dp[i+1][k],dp[i][j] + a[i][k]);
      }
    }
  }
  long long int res = 0;
  for(int i = 0;i < 3;i++) chmax(res,dp[n][i]);
  cout << res << endl;
}

Measured memory_bytes: 8272
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (long long i = j; i < (long long)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
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; }
//(a+b-1)/b


signed main(){
	ll n; cin>>n;
	ll ans=0;
	vl v(n);
	rep(i,0,n)cin>>v[i];
	rep(i,0,n){
		ll a=v[i];
		bool ok=true;
		for(ll i=2;i*i<=a;i++){
			if(a%i==0){
				ok=false;
			}
		}
		if(ok)ans++;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 3136
n,a = map(int,input().split())
dp = [[0]*2000 for _ in range(n+1)]
dp[0][1000] = 1
x = list(map(int,input().split()))
for i in range(n):
  x[i] -= a
for i in range(n):
  for j in range(2000):
    dp[i+1][j] += dp[i][j]
    if 0<=j+x[i]<2000:
      dp[i+1][j+x[i]] += dp[i][j]
print(dp[n][1000]-1)

Measured memory_bytes: 4340
#include "bits/stdc++.h"
using namespace std;
#define INF 1e9
#define rep(i, n) for(int i = 0; i < n; i++)
#define ALL(x) (x).begin(), (x).end()  //昇順
#define RALL(x) (x).rbegin(), (x).rend() // 降順
const long long mod = 1e9+7;
typedef priority_queue<int> PQ;
typedef vector<long long> VL;
typedef vector<int> VI;  // VI a(n);
typedef vector<string> VS;  
typedef vector<char> VC; 
typedef vector<VS> VSS;
typedef vector<VC> VCC;    
typedef vector<VI> VII;   // VII a(n,vector<int>(m)) n * m 
typedef vector<VL> VLL;
typedef pair<int, int> PII;
typedef map<int, int> MP;   //MP a;
typedef vector<pair<int, int> > PS;
typedef long long ll;  //ll とdoubleは違う
template <class T>  // chmax(max, a);
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> //chmin(min,a)
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
template<typename T>   // operator << (cout,a);
ostream& operator << (ostream& os, vector<T>& v) {
    os << "{";
    rep(i, (int)v.size()) { os << v[i] << (i < v.size() - 1 ? ", " : ""); }
    os << "}";
    return os;
}
template<typename T>
bool all_same(vector<T> v1,vector<T> v2)
{
    sort(ALL(v1));
    sort(ALL(v2),greater<T>());
    return v1 == v2;
}
// g++ -std=c++11 prac.cpp
ll Max=-1e9,Min=1e9+1;
 
int main(){
    ll x,c,y=0,n,m,l,w,sum=0,sum2=0,ans=0;
    string s,t;
    bool f=false;
    cin >> n;
    VI a(n);
    rep(i,n){
        cin >> a[i];
	}
    if(all_same(a,a)){
        cout << 0 << endl;
        return 0;
    }
    sort(ALL(a));

    for(int i=a[0];i<a[n-1];i++){
        for(int j=0;j<n;j++){
            ans += pow(a[j]-i,2);
        }
        chmin(Min,ans);
        ans=0;
    }
    cout << Min << endl;
    return 0;
}

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

int main()
{
	int powersOf2[10];
	for (int i = 0; i < 10; ++i)
	{
		powersOf2[i] = pow(2,i);
	}
	int n;
	cin >> n;

	for (int i = 9; i >= 0; --i)
	{
		if (powersOf2[i] <= n)
		{
			cout << powersOf2[i];
			break;
		}
	}

	return 0;
}

Measured memory_bytes: 512
#include <stdio.h>

int main()
{
    int current,expected,required;
    do{
        scanf("%d",&current);
    }while(current<0);
    do{
        scanf("%d",&expected);
    }while(expected>4500);
    required = (2*expected) - current;
    printf("%d",required);
    return 0;
}

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

int cntdigit(int x){
int a = 0;
  while(x){
    a++;
    x /= 10;
  }
  return a;
}

int main() {
  ll n;
  cin >> n;
  ll ans = cntdigit(n);
  for(ll i = 1; i*i <= n; i++){
    if(n % i != 0) continue;
    ll temp = n / i;
    ll m = max(cntdigit(i), cntdigit(temp));
    ans = min(m, ans);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256