akhauriyash/Code-Regression huggingface dataset:
import bisect
N=int(input())
L=list(map(int,input().split()))
L.sort()
ans = 0
for a in range(N):
  for b in range(a+1,N):
    c=bisect.bisect_left(L, L[a]+L[b])#第一条件(終点)
    if b<c:#第2条件（始点）
      ans+=c-b-1     
print(ans)#bisectのインデックスより一個前なら小さい

Measured memory_bytes: 42972
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

type Node struct {
	link []([]int)
}

func getInt(sc *bufio.Scanner) int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

var nodes []Node
var dArr []int

func dfs(nodeNum int) {
	for _, _v := range nodes[nodeNum].link {
		if _v[0] != 0 && dArr[_v[0]] <= 0 {
			dArr[_v[0]] = dArr[nodeNum] + _v[1]
			dfs(_v[0])
		}
	}
}

func main() {
	var n int
	var u, v, w int
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	n = getInt(sc)

	// Init
	nodes = make([]Node, n)
	// queue := make(chan int, n)
	dArr = make([]int, n)

	for i := 0; i < n-1; i++ {
		u = getInt(sc)
		v = getInt(sc)
		w = getInt(sc)
		// isContains := false
		// for _, _v := range nodes[u-1].link {
		// 	if _v[0] == v-1 {
		// 		isContains = true
		// 		break
		// 	}
		// }
		// if isContains {
		// 	continue
		// }
		nodes[u-1].link = append(nodes[u-1].link, []int{v - 1, w})
		nodes[v-1].link = append(nodes[v-1].link, []int{u - 1, w})
	}

	// queue <- 0

	// for len(queue) > 0 {
	// 	cur := <-queue
	// 	for _, _v := range nodes[cur].link {
	// 		if _v[0] != 0 && dArr[_v[0]] <= 0 {
	// 			dArr[_v[0]] = dArr[cur] + _v[1]
	// 			queue <- _v[0]
	// 		}
	// 	}
	// }

	dfs(0)

	for _, _v := range dArr {
		// fmt.Print(_v)
		// fmt.Print(" : ")
		if _v%2 == 0 {
			fmt.Println(0)
		} else {
			fmt.Println(1)
		}
	}
}


Measured memory_bytes: 27904
#include <iostream>

using namespace std;

int main()
{
    int r,c,x;
    cin >> r>> c;
    int a[r+1][c+1];
    for(int i=0;i<=r;i++){
        for(int j=0;j<=c;j++){
          a[i][j]=0;
        }
    }
    for(int i=0;i<r;i++){
        for(int j=0;j<c;j++){
            cin>>x;
            a[i][j]=x;
            a[i][c]+=x;
            a[r][j]+=x;
            a[r][c]+=x;
        }
    }
    for(int i=0;i<=r;i++){
        for(int j=0;j<=c;j++){
            if(j!=0){
                cout << " ";
            }
            cout << a[i][j];

        }
        cout <<endl;
    }
    return 0;

}



Measured memory_bytes: 3112
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<math.h>
#include<map>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<set>
#include<list>
#include<string>
#include<climits>
#define ll long long 
#define inf 0x7f7f7f7f
#define io ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
using namespace std;
typedef pair<int,int> p;
int main()
{
	int n;
	cin>>n;
	int a[200005],b[200005],ans=0;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
		if(i==0)
		b[i]=a[i];
		else
		b[i]=min(b[i-1],a[i]);
		if(b[i]>=a[i])
		ans++;
	}
	cout<<ans<<endl;
}

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

int main(void){
    int n;
    std::cin >> n;
    std::vector<int> h(n);
    for(int i = 0; i < n; i++){
        std::cin >> h.at(i);
    }

    int temp = -2;

    for(int i = 0; i < n; i++){
        if(temp < h.at(i)){
            temp = h.at(i) - 1;
        }
        else if(temp == h.at(i)){
            temp = h.at(i);
        }
        else{
            puts("No");
            return 0;
        }
    }
    puts("Yes");
    return 0;
}

Measured memory_bytes: 640
#include <stdio.h>

int capa(int w[],int n,int k,int p){ //最大積載量Pのとき荷物の数vを返す
	int i,j,rest; //restは一つのトラックの残り容量
	int first = 0; //m番目まで積み終わっているなら次のトラックはfirst番目の荷物から積む
	for(i = 0; i < k; i++){
		rest = p;
		for(j = first; j < n && rest >= w[j]; j++){
			rest = rest - w[j];
		}
		first = j;
	}
	return first;
}

int main(void){
	int n,k,i;
	scanf("%d %d",&n,&k);
	int w[n];
	for(i = 0; i < n; i++){
		scanf("%d",&w[i]);
	}
	
	int max = 100000 * 10000;
	int left = 0, right = max, mid;
	while(right - left > 1){ //二分探索
		mid = (left + right) / 2;
		int v = capa(w,n,k,mid);
		if(v >= n){
			right = mid;
		}
		else{
			left = mid;
		}
	}
	printf("%d\n",right);
	
	return 0;
}


Measured memory_bytes: 2172
#!/usr/bin/env python3


def main() -> None:
    N, K = rmi()
    A = rmi()
    route = []
    visited = [False] * N
    current = 1
    for n in range(N):
        route.append(current)
        if not visited[current - 1]:
            visited[current - 1] = True
            current = A[current - 1]
        else:
            break
    dup = route[-1]
    dup_index = route.index(dup)
    roop_range = len(route) - dup_index - 1
    if K < dup_index:
        w(route[K])
    else:
        w(route[dup_index:][(K - dup_index) % roop_range])


def r() -> str:
    return input().strip()


def ri() -> int:
    return int(r())


def rmi(delim: str = ' ') -> tuple:
    return tuple(map(int, input().split(delim)))


def w(data) -> None:
    print(data)


def wm(*data, delim: str = ' ') -> None:
    print(delim.join(map(str, data)))


if __name__ == '__main__':
    import sys
    sys.setrecursionlimit(10 ** 9)
    main()


Measured memory_bytes: 33476
#include <bits/stdc++.h>
#include <cstdio>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
vector<long> inputVector(long n)
{
    vector<long> vec(n);
    rep(i, n)
    {
        scanf("%d", &vec.at(i));
    }
    return vec;
}

int main()
{
    long n, m;
    long ans;

    // scanf("%d", &x);
    cin >> n >> m;
    vector<long> h = inputVector(n);
    h.insert(h.begin(), 0);
    set<long> s;
    rep(i, n)
    {
        s.insert(i + 1);
    }
    long a, b, idx;
    rep(i, m)
    {
        cin >> a >> b;
        if (h.at(a) > h.at(b))
        {
            s.erase(b);
        }
        else if (h.at(b) > h.at(a))
        {
            s.erase(a);
        }
        else if (h.at(a) == h.at(b))
        {
            s.erase(a);
            s.erase(b);
        }
    }
    ans = s.size();
    // printf("%d\n", x * x * x);
    cout << ans << endl;
}

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


int main(){
int a,b;
  cin>>a>>b;
  vector<int>op(a);
  vector<int>ap(a);
  for(int i=0;i<a;i++)
  {
  int x,y;
    cin>>x>>y;
    op.at(i)=x;
    ap.at(i)=y;
  
  }

sort(op.begin(), op.end());
  
sort(ap.begin(), ap.end());

  int t=op.at(a-1);
 
  int l,m;
  l=0;
  m=0;
  for(int j=a-1;j>=0;j--)
  {
  if(l<b && ap.at(j)>t) 
  {
    l=l+ap.at(j);
  m=m+1;
  }
    else break;
  }
  if(l>=b) cout<<m;
  else 
  {
  while(l<b)
  {
  l=l+op.at(a-1);
    m=m+1;
  
  }
  cout<<m;
  }
 
  
  
  
}

Measured memory_bytes: 1024
import collections
import sys
input = sys.stdin.readline
n = int(input())
s = []
for i in range(n):
  s.append(input())
#print(s)
c = collections.Counter(s)
#print(c.most_common())
x = c.most_common()
m = x[0][1]
l = len(x)
ans = []
for i in range(l):
  if x[i][1] == m:
    ans.append(x[i][0])
  else:
    break
ans0 = sorted(ans)
for i in range(len(ans0)):
  print(ans0[i],end="")

Measured memory_bytes: 49392
import math
import time
from collections import deque
from copy import deepcopy

t = time.time()
def iip():
    ret = [int(i) for i in input().split()]
    if len(ret) == 1:
        return ret[0]
    return ret

def makemaze(H, W):
    maze = []
    for i in range(H):
        s = input()
        a = []
        for c in s:
            if c == ".":
                a.append(1000)
            if c == "#":
                a.append(9999)
        maze.append(a)
        #print(maze)
    return maze

def maxroot(maze, x, y, w, h):
    sn = 0
    maxx = 0
    if maze[y][x] == 9999:
        return 0

    maze = deepcopy(maze)
    maze[y][x] = 0
    que = deque()
    que.append((y, x))


    while que:
        xy = que.pop()
        y = xy[0]
        x = xy[1]
        if maze[y][x] == 9999:
            continue

        minlist = []
        if x > 0:
            minlist.append((y, x-1))
        if y > 0:
            minlist.append((y-1, x))
        if x < w-1:
            minlist.append((y, x+1))
        if y < h-1:
            minlist.append((y+1, x))

        dd = min(maze[y][x] for y, x in minlist) + 1
        dd = min(dd, maze[y][x])
        maze[y][x] = dd

        for y, x in minlist:
            if maze[y][x] != 9999 and maze[y][x] > dd+2:
                que.append((y, x))
                sn += 1
            #print(sn)

    maxx = 0
    for line in maze:
        try:
            maxa = max([i for i in line if i < 1000])
        except:
            maxa = 0
        maxx = max(maxx, maxa)
    return maxx


def main():
    H, W = iip()
    maze = makemaze(H, W)

    maxx = 1
    for y in range(H):
        for x in range(W):
            maxx = max(maxx, maxroot(maze, x, y, W, H))
            pass

    print(maxx)
    #print(maxroot(maze, 0, 2, W, H))


main()

Measured memory_bytes: 54360
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
using ll = long long;
using p = pair<int,int>;
int main(int argc, const char * argv[]) {



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

    int n;
    cin>>n;
    if(n/100+((n/10)%10)*10+n%10*100==n)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;

    return 0;
}



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

int main(){
  int n,m,p;
  while(cin>>n>>m>>p){
    if(n==0)break;
    double G=0;
    int num[n];
    for(int i=0;i<n;i++){
      cin>>num[i];
      G+=num[i];
    }
    G*=(100.0-p);
    if(num[m-1]!=0){
      cout << (int)(G/num[m-1]) << endl;
    }else{
      cout << 0 << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
#define N 100010
#define ll long long
int main()
{
    string s;
    cin>>s;
    int ans = 0;
    int maxl = 0;
    for(int i = 0; i < s.size(); i++){
        if(s[i] == 'R'){
            ans++;
            maxl = max(maxl,ans);
        }
        else{
            ans = 0;
        }
    }
    cout<<maxl;
    return 0;
}


Measured memory_bytes: 3572
import statistics

def cal_hp(p, num_list):
    total = 0
    for num in num_list:
        temp = (num - p) ** 2
        total = total + temp
    return total

line1 = input()
line2 = input()

num_list = line2.split(" ")
num_list = [int(n) for n in num_list]
ans_list = []

for i in range(0, max(num_list)+1):
    ans_list.append(cal_hp(i, num_list))
print(min(ans_list))

Measured memory_bytes: 5232
import numpy as np

n = int(input())
raw = []
arr = []

for i in range(n):
    a = int(input())
    raw.append(a)
    arr.append(a)

arr.sort()

# print(arr)

key = arr[-1]
sec = arr[-2]

for i in range(n):
    if raw[i] == key:
        print(sec)
    else:
        print(key)

Measured memory_bytes: 23100
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define vd(T) vector<vector<T>>
#define v(T) vector<T>
#define mod (ll)(1e9+7)
#define pp(T) pair<T,T>
#define pb push_back
#define mp make_pair
#define NN 100005
#define IO ios_base::sync_with_stdio(NULL),cin.tie(0),cout.tie(0)
#define loop(i,a,b) for(ll i=a;i<b;i++)
#define DEBUG cout<<"***********DEBUGGING***********"<<endl
#include <ext/pb_ds/assoc_container.hpp> // Common file 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; 
ll power(ll a,ll b){ if(b==0) return 1; ll s=power(a,b/2); s*=s;if(b&1) return s*a; return s;}
ll powermod(ll a,ll b,ll m){ if(b==0) return 1; ll s=power(a,b/2);s*=s; s%=m; if(b&1) return (s*a)%m; return s;}
inline int add(ll a,ll b,ll m=0){
    if(m==0) return a+b;
    return (a%m+b%m)%m;
}

inline int sub(ll a,ll b ,ll m=0){
    if(m==0) return a-b;
    return ((a%m-b%m)%m+m)%m;
}

inline int mul(ll a,ll b,ll m=0){
    if(m==0)return (a*b);
    return ((a%m)*(b%m))%m;
}

inline int div(ll a,ll b,ll m=0){
    if(m==0) return a/b;
    return ((a%m)*(powermod(a,b,m-2)%m))%m;
}

bool isopen(char c){
    return ((c=='(')||(c=='{')||(c=='['));
}

ll longest_balanced_parenthesis(string a,ll n){
    stack<char> s;
    ll start=0;
    ll ans=0,m=0;
    for(ll i=0;i<n;i++){
        if(isopen(a[i])){
            s.push(a[i]);
        }
        else{
            if(isopen(a[i])|| s.empty()){
                m=max(m,ans);
                continue;
            }
            else{
                s.pop();
                ans+=2;
                m=max(ans,m);
            }
        }
    }

    return m;

}

ll setup_k(ll *a,ll k){
  ordered_set x;
  // Now , insert and then check number of integers less than k by just using x.order_of_key(k+1)
}

int main() {

    IO; 

    ll a,b,c;
    cin>>a>>b>>c;
    if(a+b==c || c+a==b || a==b+c){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
    

}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <queue>
#include <tuple>
#include <vector>

int main()
{
    using Grid = std::uint16_t;

    auto h = Grid(0);
    auto w = Grid(0);

    std::cin >> h >> w;

    auto white = Grid(0);
    auto s = std::vector<std::vector<char>>(h, std::vector<char>(w, 0));
    auto visited = std::vector<std::vector<bool>>(h, std::vector<bool>(w, false));
    for (Grid i = 0; i < h; ++i)
        for (Grid j = 0; j < w; ++j)
        {
            std::cin >> s[i][j];
            if (s[i][j] == '.') white++;
        }

    auto q = std::queue<std::tuple<Grid, Grid, Grid>>();

    auto sx = Grid(0);
    auto sy = Grid(0);
    auto gx = Grid(w - 1);
    auto gy = Grid(h - 1);

    auto dx = std::vector<int>({0, 1, 0, -1});
    auto dy = std::vector<int>({1, 0, -1, 0});

    auto goal_steps = std::vector<Grid>();
    visited[sy][sx] = true;
    q.emplace(sx, sy, 1);
    while (!q.empty())
    {
        auto px = std::get<0>(q.front());
        auto py = std::get<1>(q.front());
        auto steps = std::get<2>(q.front());
        q.pop();
        for (std::size_t i = 0; i < 4; ++i)
        {
            auto next_step = steps;
            auto tx = Grid(px + dx[i]);
            auto ty = Grid(py + dy[i]);

            if (tx < 0 || w <= tx || ty < 0 || h <= ty) continue;

            if (visited[ty][tx]) continue;

            if (!visited[ty][tx] && s[ty][tx] == '.')
            {
                if (tx == gx && ty == gy)
                {
                    goal_steps.emplace_back(++next_step);
                    continue;
                }

                visited[ty][tx] = true;
                q.emplace(tx, ty, ++next_step);
            }
        }
    }

    if (goal_steps.empty())
        std::cout << -1 << std::endl;
    else
        std::cout << white - *std::min_element(goal_steps.begin(), goal_steps.end()) << std::endl;
    return 0;
}

Measured memory_bytes: 256
S = input()
N = len(S)

a = (N-1)//2

def isKaibun(S):
    N = len(S)
    flag = 0
    for i in range((N//2)+1):
        if S[i] != S[N-1-i]:
            flag =1
    if flag == 1:
        return False
    else:
         return True

if isKaibun(S[0:a]) == True:
    if isKaibun(S[-1:-a-1:-1]) == True:
        if isKaibun(S) == True:
            print("Yes")
            exit()
print("No")

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

#define ll long long
#define fast_io ios::sync_with_stdio(0); cin.tie(0)
#define infl 1e18+9
#define sz(a) ((int)a.size())

ll mod=1e9+7;
const int nax=1e5+5; 
vector<int> adj[nax]; 

struct S{
  int black,white; 
};
vector<S> dp(nax); 
void self_mul(int &a, int b){
  a=(ll)a*b%mod; 
}
int add(int a, int b){
  return (a+b)%mod; 
}

void dfs(int u, int p){
  dp[u]={1,1}; 
  for(int v:adj[u]){
    if(v!=p){
      dfs(v,u); 
      self_mul(dp[u].black,dp[v].white); 
      self_mul(dp[u].white,add(dp[v].white,dp[v].black)); 
    }
  }
}

void solve(){
  int n; cin>>n; 
  for(int i=1;i<n;i++){
    int u,v; cin>>u>>v; 
    adj[u].push_back(v); 
    adj[v].push_back(u); 
  }
  dfs(1,0); 
  cout<<add(dp[1].black,dp[1].white)<<endl; 
}

int main(){
	fast_io;
	clock_t beg=clock();
  int t;
  t=1;
  while(t--){
	  solve();
  }
	clock_t end=clock();
	fprintf(stderr,"%.2lf sec\n",(double)(end-beg)/CLOCKS_PER_SEC);
	return 0;
}

Measured memory_bytes: 12032
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
const int INF = 1e9;
int main() {
	int N;
	cin >> N;
	int A[100010];
	int flag[100010] = {};
	for (int i = 0; i < N; ++i) {
		cin >> A[i];
		if (A[i] == 0) {
			flag[A[i]]++;
			flag[A[i] + 1]++;
		}
		else {
			flag[A[i] - 1]++;
			flag[A[i]]++;
			flag[A[i] + 1]++;
		}
	}
	int ans = 0;
	for (int i = 0; i < 100010; ++i) {
		ans = max(ans, flag[i]);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1024
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

const int MAX_N = 100005;

int n;
string s;
int res[MAX_N];
int nextL[MAX_N], nextR[MAX_N];

int main()
{
	ios::sync_with_stdio(false);
	cin >> s;
	n = (int)s.length();

	for (int i = 0; i < n; i++)
	{
		if (i == 0 || s[i] != s[i - 1])
			nextL[i] = i - 1;
		else
			nextL[i] = nextL[i - 1];
	}
	for (int i = n - 1; i >= 0; i--)
	{
		if (i == n - 1 || s[i] != s[i + 1])
			nextR[i] = i + 1;
		else
			nextR[i] = nextR[i + 1];
	}

	for (int i = 0; i < n; i++)
	{
		int cnt;
		if (s[i] == 'L')
			cnt = i - nextL[i];
		else
			cnt = nextR[i] - i;
		if (cnt % 2 != 0)
		{
			if (s[i] == 'L')
				res[nextL[i] + 1]++;
			else
				res[nextR[i] - 1]++;
		}
		else
		{
			if (s[i] == 'L')
				res[nextL[i]]++;
			else
				res[nextR[i]]++;
		}
	}

	for (int i = 0; i < n; i++)
		cout << res[i] << " ";
	cout << endl;
}

Measured memory_bytes: 1872
import sys
sys.setrecursionlimit(10 ** 9)
# input = sys.stdin.readline    ####
def int1(x): return int(x) - 1
def II(): return int(input())
def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())
def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def MS(): return input().split()
def LS(): return list(input())
def LLS(rows_number): return [LS() for _ in range(rows_number)]
def printlist(lst, k=' '): print(k.join(list(map(str, lst))))
INF = float('inf')
# from math import ceil, floor, log2
# from collections import deque, defaultdict
# from itertools import combinations as comb, combinations_with_replacement as comb_w, accumulate, product, permutations
# from heapq import heapify, heappop, heappush
# import numpy as np    # cumsum
# from bisect import bisect_left, bisect_right

def solve():
    s = input()
    if s[-1] == 's':
        print(s + 'es')
    else:
        print(s + 's')

if __name__ == '__main__':
    solve()



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

using namespace std;

#define rep(i,n) for(int i=0;i<(n);i++)
#define repa(i,a,n) for(int i=(a);i<(n);i++)
#define rrep(i,n) for(int i=n;i>=0;i--)
#define rrepa(i,a,n) for(int i=n;i>=(a);i--)
#define all(a) (a).begin(),(a).end()
#define MOD 1000000007
#define maxs(a,b) a=max(a,b)
#define mins(a,b) a=min(a,b)
#define vc vector

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<int,int> pi;

int main(){

    int n;cin>>n;
    vi a(n);rep(i,n)cin>>a[i];

    int ans=0,cnt=1;
    rep(i,n){
        if(a[i]==cnt)cnt++;
        else ans++;
    }

    if(cnt==1)cout<<-1<<"\n";
    else cout<<ans<<"\n";
    
    return 0;

}

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

int main() {
  vector<int> vec(3);
  for(int i = 0; i < 3; i++) {
    cin >> vec.at(i);
  }
  vector<int> ans(3);
  ans.at(0) = vec.at(2);
  ans.at(1) = vec.at(0);
  ans.at(2) = vec.at(1);
  for(int i = 0; i < 3; i++) {
    cout << ans.at(i) << ' ';
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
main(){
    ios_base::sync_with_stdio(false);
    long long n,m,ans;
    cin >> n >> m;
    ans = min(n,m/2);
    n-=ans;
    m-=2*ans;
    cout << ans + m/4 <<endl;
}


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

namespace AtTest.ABC_129
{
    class C
    {
        static void Main(string[] args)
        {
            Method(args);
        }

        static void Method(string[] args)
        {
            int[] nm = ReadInts();
            int n = nm[0];
            int m = nm[1];
            var dict = new HashSet<int>();
            for(int i = 0; i < m; i++)
            {
                dict.Add(ReadInt());
            }

            var dp = new long[n + 10];
            long mask = 1000000000 + 7;
            dp[0] = 1;
            for (int i = 0; i < n; i++)
            {
                if (dict.Contains(i))
                {
                    dp[i] = 0;
                    continue;
                }
                dp[i + 1] += dp[i];
                dp[i + 1] %= mask;
                dp[i + 2] += dp[i];
                dp[i + 2] %= mask;
            }

            WriteLine(dp[n]);
        }

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


Measured memory_bytes: 18144
//
// Created by yamunaku on 2019/10/05.
//

#include <bits/stdc++.h>

using namespace std;

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repl(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perl(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD9 998244353
#define MOD1 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
#define SP <<" "<<
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define CFS cin.tie(0);ios::sync_with_stdio(false)
#define CST(x) cout<<fixed<<setprecision(x)

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<int>> mti;
typedef vector<ll> vl;
typedef vector<vector<ll>> mtl;

int main(){
    int n;
    cin >> n;
    vector<string> s(n);
    rep(i,n) cin >> s[i];
    int ans=-1;
    rep(i,n){
        queue<int> q;
        vi c(n,-1);
        c[i]=1;
        q.push(i);
        while(!q.empty()){
            int now=q.front();
            q.pop();
            rep(j,n){
                if(s[now][j]=='1'){
                    if(c[j]==-1){
                        c[j]=c[now]+1;
                        q.push(j);
                    }else{
                        if(c[j]!=c[now]-1&&c[j]!=c[now]+1){
                            goto next;
                        }
                    }
                }
            }
        }
        rep(i,n){
            ans=max(ans, c[i]);
        }
        next:;
    }
    cout << ans << endl;
    return 0;
}


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

	vector<long long> data;

	UnionFind(long long size): data(size, -1) {}
	
	void unite(long long x, long long y){
		x = root(x);
		y = root(y);
		if( x != y ){
			if( data[y] < data[x] ) swap(x, y);
			data[x] += data[y];
			data[y] = x;
		}
	}

	bool same(long long x, long long y){
		return root(x) == root(y);
	}

	long long root(long long x){
		return (data[x] < 0) ? x : data[x] = root(data[x]);
	}

	long long size(long long x){
		return -data[ root(x) ];
	}
};

int main(){
    ll n,M,k; cin>>n>>M>>k;
    UnionFind tree(n+1);
    map<ll,ll> m;
    rep(i,M){
        ll a,b; cin>>a>>b;
        tree.unite(a,b);
        m[a]++; m[b]++;
    }
    rep(i,k){
        ll c,d; cin>>c>>d;
        if(tree.same(c,d)){
            m[c]++; m[d]++;
        }
    }
    for(ll i=1; i<=n; i++){
        if(i>1) cout<<' ';
        cout<<tree.size(i)-m[i]-1;
    }
    cout<<endl;
    return 0;
}

Measured memory_bytes: 7808
def solve(N, Y):
    # 成立する組み合わせが存在するか
    flag = False
    
    # 10000円札をx, 5000円札をy, 1000円札をzとする
    for x in range(N+1):
        for y in range(N+1-x):
            z = N - x - y
            
            if 10000*x + 5000*y + 1000*z == Y:
                flag = True
                print(x, y, z)
                break
                
        if flag:
            break
                
    if flag == False:
        print(-1, -1, -1)

if __name__ == '__main__':
    N, Y = map(int, input().split())
    solve(N, Y)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
 
void solve()
{
  int n, m;
  cin>>n>>m;
  if(n==m) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}
int main()
{
    int t;
    t=1;
    while(t--)
    {
        solve();
 
    }
return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cstdlib>  // abs() for integer 絶対値求めやつ
#include <cmath>    // abs() for float, and fabs()
#include <algorithm>
#include <vector>
#include <string>
#include<iomanip>//浮動小数点数を出力する制度の指定
//使い方　数値をnumとして　cout<<setprecision(n)<<num ;nは桁数
#define rep(i,n) for(int i = 0; i < (n);i++)
#define SORT(a) sort((a).begin(),(a).end())
#define REV(a) reverse((a).begin(),(a).end())
using namespace std;
using ll =long long;
using db = double;
#define INF 2000000000
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; }
#define che(a,string) cout<<"//"<<string <<"=="<<(a)<<"//" <<endl;
bool IsInt(double a){int b = a/1;if(a==b){return true;}else {return false;}}
/*覚えてないことメaモ
  数値型から文字列に変換　to_string(number);これは簡単
  文字列から数値型に変換　stoi(number)
  文字列からllに変換　stoll(number)
  __gcd(a,b)は最大公約数を取ってくれる、aとb
  の大きい方をNとしたとき、計算量は√N
 */
const int mod = 1e9 + 7;
//ここから書き始める


//関数の定義はここ

int main(){
	cout << setprecision(20);
	db n, k;
	cin >> n >> k;
	db ans = 0;
	db coin = 0 ;
	for(int i = 1; i <= n; i++){
		db p = 1; 
		int x = i ;
		while( x < k){
			p *= 0.5;
			x *= 2;
		}
		ans += p / n;
	}
	cout << ans << endl;
}



Measured memory_bytes: 256
N = int(input())
h = list(map(int,input().split()))
h.append(0)
maxh = max(h)
cnt = [0 for i in range(maxh)]
for i in range(maxh,-1,-1):
    for j in range(len(h)-1):
        if h[j]>= i and h[j+1]<i:
            cnt[i-1] += 1

print(sum(cnt))

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

int main(){
    int a;
    int x;
    int y;
    int z;
    
    cin >> x >> y >> z;
    if (x > y){
         a = x;
         x = y;
         y = a;
    }
    if (x > z){
         a = x;
         x = z;
         z = a;  
    }
    if (y > z){
         a = y;
         y = z;
         z = a;  
    }
    cout << x << " " << y << " " << z << endl;
    
    return 0;
}


Measured memory_bytes: 3116
#include <iostream>

using namespace std;

int main() {
    int total;
    int price[9];
    while (cin >> total, total != 0) {
        for (int i = 0; i < 9; i++) {
            cin >> price[i];
        }
        for (int i = 0; i < 9; i++) {
            total -= price[i];
        }
        cout << total << endl;
    }
    return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<string>
using namespace std;
int field[102][102] = {0};
int d[4][2] = {{0,1},{1,0},{-1,0},{0,-1}};
void dfs(int x, int y, int n);
int main(){
  int h,w;
  while(cin >>h>>w,h||w){
    int ans = 0;
    string s;
    for(int i=0; i<102; i++){for(int j=0; j<102; j++){field[i][j] = 0;}}
    for(int i=0; i<h; i++){
      cin >>s;
      for(int j=0; j<w; j++){
	if(s[j] == '#'){field[i+1][j+1] = 1;}
	if(s[j] == '*'){field[i+1][j+1] = 2;}
	if(s[j] == '@'){field[i+1][j+1] = 3;}
      }
    }
    for(int i=0; i<h+2; i++){
      for(int j=0; j<w+2; j++){
	if(field[i][j]!=0){
	  dfs(i,j,field[i][j]);
	  ans++;
	}
      }
    }
    cout <<ans<<endl;
  }
  return 0;
}
void dfs(int x, int y, int n){
  field[x][y] = 0;
  for(int i=0; i<4; i++){
    if(field[x+d[i][0]][y+d[i][1]] == n){dfs(x+d[i][0],y+d[i][1],n);}
  }
}

Measured memory_bytes: 1720
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,k,x=0;cin>>n>>k;
  vector<int>a(n);for(int i=0;i<n;i++)cin>>a[i];
  sort(a.begin(),a.end());
  for(int i=0;i<k;i++)x+=a[i];
  cout<<x<<endl;
}


Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i=0; i<n; ++i)
#define rep1(i,n) for(ll i=1; i<=n; ++i)
#define revrep(i,n) for(ll i=n-1; n>=0; --i)
inline constexpr ll Inf = (1ULL << 62) -1;
#define fastio cin.tie(nullptr); ios_base::sync_with_stdio(false);
#define endl '\n'
template <class T> bool updmax(T& a, T b) { if (b > a) { a = b; return true;} return false;}
template <class T> bool updmin(T& a, T b) { if (b < a) { a = b; return true;} return false;}

int main() {
    fastio;
    ll sum=0;
    ll N;
    cin >> N;
    vector<int> a(N);
    vector<int> c(N+1);
    rep(i,N) cin >> a[i];
    rep(i,N) c[a[i]]++;
    rep1(i,N) sum += (ll)c[i] * (c[i]-1)/ 2;
    rep(k,N) {
        ll ans;
        ll n = c[a[k]];
        if (n < 2) {
            ans = sum;
        } else {
            ans = sum - n * (n-1)/2 + (n-1)*(n-2)/2;
        }
        cout << ans << endl;
    }
}


Measured memory_bytes: 4712
#include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;
typedef unsigned long long ll;
int main()
{
	int n,m;
	cin>>n>>m;
	priority_queue<double> q;
	for(int i = 0; i < n; i++){
		double num;
		cin>>num;
		q.push(num);
	}
	for(int i = 0; i < m; i++){
		double topNum = q.top();
		topNum = topNum * 0.5;
		q.pop();
		q.push(topNum);
	}
	ll ans = 0;
	while( !q.empty()){
		ans += floor(q.top());
		q.pop();
	}
	cout<<ans<<endl;
	return 0;
}



Measured memory_bytes: 3912
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> mp;
ll inf =  1e9;

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

ll gcd(ll a,ll b ,ll c){
 return gcd(c,gcd(a,b));
}


int main(){
 ll n;
 cin>>n;
 ll s = 0;
 for(ll i=1;i<=n;i++)
  for(ll j=1;j<=n;j++)
   for(ll k=1;k<=n;k++)
    s += gcd(i,j,k);
 cout<<s<<endl;
    return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <bits/stdc++.h>
#define PB push_back
#define INF 1e9+5;
#define F(i,a,b)  for(i=a;i<b;i++)
#define FE(i,a,b)  for(i=a;i<=b;i++)
#define FR(i,a,b) for(i=a;i>b;i--)
#define LL long long
#define MAX(a,b) (a<b?b:a)
#define ABS(x) (x<0?(-x):x)
#define ALL(c) (c).begin(),(c).end()
#define WATCH(x) cout << (#x) << " is " << (x) << endl
#define vi vector<int>
#define vs vector<string>
#define d0(x) cout<<(x)<<" "
#define d1(x) cout<<(x)<<endl
#define d2(x,y) cout<<(x)<<" "<<(y)<<endl
#define d3(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl
#define d4(a,b,c,d) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<endl
#define d5(a,b,c,d,e) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<" "<<(e)<<endl
#define d6(a,b,c,d,e,f) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<" "<<(e)<<" "<<(f)<<endl
using namespace std;
string ConvertToBin(LL s)
{
    string res = "";
    while(s != 0) {
        res += (char)('0' + s % 2);
        s /= 2;
    }
    reverse(res.begin() , res.end());
    return res;
}

void PrintVec(vector<int> &v)
{
    for(vector<int>::iterator it = v.begin() ; it != v.end(); ++it)
    cout<<*it<<" ";
}

vector<int> Populate(vector<int> &v,int n)
{
    int num;
    for(int i=0;i<n;i++)
    {
        cin>>num;
        v.push_back(num);
    }
    return(v);
}

int sumofdigits(int n)
{
    int sm=0;
    while(n)
    {
        sm=sm+(n-(n/10)*10);
         n=n/10;
    }
    return(sm);
}

bool isprime(int n)
{
    int i=0;
    FE(i,2,sqrt(n))
    {
        if(n%i==0)
        return(false);
    }
    return(true);
}




int dp[1005][1005];
#define N 1005
int arr[N][N];
int fun(int row,int col,int i,int j) 
{
   if(i>=row || j>=col)
   return(0);
   if(i==row-1 && j==col-1)
   return(1);
   if(arr[i][j]==1)
   return(0);
   if(dp[i][j]!=-1)
   return(dp[i][j]);

   long long int ans=0;
   if((j+1<col) && arr[i][j+1] != 1) {
       if(dp[i][j+1]!=-1) ans+=dp[i][j+1];
       else 
       ans+=fun(row, col , i , j+1)%(1000000007);
   }
   if((i+1<row) && arr[i+1][j] !=1) {
       if(dp[i+1][j]!=-1) ans+=dp[i+1][j];
       else ans+=fun(row, col , i+1 , j)%(1000000007);
   }

   dp[i][j]=ans%(1000000007);
   //dp[i][j]=(((fun(arr,row,col,i,j+1)%(1000000007))+(fun(arr,row,col,i+1,j)%(1000000007)))%(1000000007));
   return(dp[i][j]);
}






/*--------------------------time to code-------------------------------*/



int main()
{
    int row,col;
    cin>>row>>col;
    //vector<vector<int>> arr(row,vector<int>(col));
    //int ar[N][N];
    char c;
    for(int i=0;i<row;i++)
    {
        for(int j=0;j<col;j++)
        {
            cin>>c;
            if(c=='.')
            arr[i][j]=0;
            else
            arr[i][j]=1;
        }
    }
    memset(dp,-1,sizeof(dp));
    cout<<fun(row,col,0,0);
    return(0);
}









Measured memory_bytes: 8320
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005

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

    map<pair<string, string>, ll> mp;

    rep(i,1 << n){
        int ii = i;
        int f[n] = {};
        rep(j,n){
            f[j] = ii % 2;
            ii /= 2;
        }
        string red, blue;
        drep(j,n){
            if(f[j] == 0){
                blue += s[n+j];
            }else{
                red += s[n+j];
            }
        }
        mp[{red, blue}]++;
    }

    ll ans = 0;

    rep(i,1<<n){
        int ii = i;
        int f[n] = {};
        rep(j,n){
            f[j] = ii % 2;
            ii /= 2;
        }
        string red, blue;
        rep(j,n){
            if(f[j] == 0){
                red += s[j];
            }else{
                blue += s[j];
            }
        }
        ans += mp[{red, blue}];
    }

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


Measured memory_bytes: 91904
"use strict";
function main(input) {
    const line = input.split("\n");
    const N = parseInt(line[0]);
    const p = line[1].split(" ").map(Number);
    let cnt = 0;
    for (let i = 0; i < N; i++) if (p[i] !== i + 1) cnt++;
    console.log(cnt <= 2 ? "YES" : "NO");
    return;
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 30296
#include <iostream>
#include <algorithm>
#include <utility>
#include <numeric>
#include <vector>
#include <array>

template <class T, class U>
inline bool chmin(T &lhs, const U &rhs) {
  if (lhs > rhs) { lhs = rhs; return true; }
  return false;
}

template <class T, class U>
inline bool chmax(T &lhs, const U &rhs) {
  if (lhs < rhs) { lhs = rhs; return true; }
  return false;
}

struct range {
  using itr = int64_t;
  struct iterator {
    itr i;
    constexpr iterator(itr i_) noexcept : i(i_) { }
    constexpr void operator ++ () noexcept { ++i; }
    constexpr itr operator * () const noexcept { return i; }
    constexpr bool operator != (iterator x) const noexcept { return i != x.i; }
  };
  const iterator l, r;
  constexpr range(itr l_, itr r_) noexcept : l(l_), r(std::max(l_, r_)) { }
  constexpr iterator begin() const noexcept { return l; }
  constexpr iterator end() const noexcept { return r; }
};

struct revrange {
  using itr = int64_t;
  struct iterator {
    itr i;
    constexpr iterator(itr i_) noexcept : i(i_) { }
    constexpr void operator ++ () noexcept { --i; }
    constexpr itr operator * () const noexcept { return i; }
    constexpr bool operator != (iterator x) const noexcept { return i != x.i; }
  };
  const iterator l, r;
  constexpr revrange(itr l_, itr r_) noexcept : l(l_ - 1), r(std::max(l_, r_) - 1) { }
  constexpr iterator begin() const noexcept { return r; }
  constexpr iterator end() const noexcept { return l; }
};

using i32 = int32_t;
using i64 = int64_t;
using u32 = uint32_t;
using u64 = uint64_t;

constexpr i32 inf32 = (i32(1) << 30) - 1;
constexpr i64 inf64 = (i64(1) << 62) - 1;

constexpr i64 mx = 300005;

int main() {
  i64 K, N;
  std::cin >> K >> N;
  if (K % 2 == 0) {
    std::cout << K / 2;
    while (--N) {
      std::cout << ' ' << K;
    }
    std::cout << '\n';
    return 0;
  }
  if (K == 1) {
    std::cout << 1;
    N = (N + 1) / 2;
    while (--N) {
      std::cout << ' ' << 1;
    }
    std::cout << '\n';
    return 0;
  }
  std::vector<i64> power(N);
  power[0] = 1;
  for (auto i: range(1, N)) {
    power[i] = power[i - 1] * K;
    chmin(power[i], mx * mx);
  }
  std::vector<i64> size(N);
  for (auto i: range(0, N)) {
    size[i] = (power[i] - 1) / (K - 1);
    chmin(size[i], mx);
  }
  std::cout << (K + 1) / 2;
  i64 dif = 0;
  while (--N) {
    std::cout << ' ';
    --dif; 
    i64 k = dif / (2 * size[N]);
    dif -= k * (2 * size[N]);
    if (dif > size[N]) {
      ++k;
      dif -= (2 * size[N]);
    }
    else if (dif <= -size[N]) {
      --k;
      dif += 2 * size[N];
    }
    i64 ans = (K + 1) / 2 + k;
    if (ans == 0) {
      break;
    }
    std::cout << ans;
  } 
  std::cout << '\n';
  return 0;
}


Measured memory_bytes: 7992
#include "bits/stdc++.h"
#define INF 0x7fffffff
using namespace std;
vector<int> a,f;
int main()
{
    int n,k;
    int i,j;
    scanf("%d %d",&n,&k);
    a.resize(n+1);
    f.resize(n+1);
    for(i=1;i<=n;i++)
    {
        scanf("%d",&a[i]);
    }
    f[1]=0;
    for(i=2;i<=n;i++)
    {
        f[i]=INF;
        for(j=1;j<=min(k,i-1);j++)
        {
            f[i]=min(f[i],f[i-j]+abs(a[i]-a[i-j]));
        }
    }
    printf("%d\n",f[n]);
    return 0;
} 

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

int main()
{
  string a;
  cin >> a;
  if(a == "ABC") cout << "ARC";
  else cout << "ABC";
  return 0;
}


Measured memory_bytes: 3596
#include<iostream>
#include <algorithm>
#include <string>
using namespace std;
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(int)(n); i++)
typedef long long ll;
const int INF = numeric_limits<int>::max();
const int MOD = (1e9 + 7);


int main(){
  string A, B, C;
  char now, ans;
  cin >> A;
  cin >> B;
  cin >> C;
  now = A[0];
  int i=1, j=0, k=0;
  while(1){
    if(now == 'a'){
       if(i == A.size()){
      ans = 'A';
      break;
    }
    now = A[i];
    i ++;
   
  }
    if(now == 'b'){
      if(j == B.size()){
      ans = 'B';
      break;
    }
    now = B[j];
    j ++;
    
  }
    if(now == 'c'){
       if(k == C.size()){
      ans = 'C';
      break;
    }
    now = C[k];
    k++;
    
  }
  
    
   
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
N = int(input())
H = list(map(int, input().split()))
mx = H[-1]
for i in range(N-1, -1, -1):
  if H[i] <= mx:
    mx = min(mx, H[i])
  elif H[i]-1 <= mx:
    mx = min(H[i]-1, mx)
  else:
    print('No')
    exit()
print('Yes')

Measured memory_bytes: 63856
n = gets.chomp.to_i
a = gets.chomp.split(" ").map(&:to_i)

h = Hash.new(0)
a.each do |i|
  h[i] += 1
end

ans = 0
h.each do |k, v|
  if k < v then
    ans += v - k
  elsif k > v then
    ans += v
  end
end

puts ans

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

int main(){
  string S;
  cin >> S;
  int ans = 700;
   if(S[0] == 'o') ans += 100;
   if(S[1] == 'o') ans += 100;
   if(S[2] == 'o') ans += 100;
     cout << ans << endl;
 }

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

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

    sort(d.begin(), d.end());
    int ans = n;
    for (int i = 1; i < n; i++) {
        if (d[i] == d[i-1]) ans--;
    } 
    cout << ans << endl;
}

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

int main()
{
  int N, Ai, pointer = 0;
  cin >> N;
  /*vector<int> A;
  vector<int>::iterator itr;*/

  int A[N];

  for (int i = 0; i < N; i++)
  {
    std::cin >> A[i];
  }

  sort(A, A+N);

  for (int i = 0; i < N-1; i++)
  {
    if (A[i] == A[i+1])
    {
      cout << "NO";
      return 0;
    }
    
  }
  
  cout << "YES";
  
}

Measured memory_bytes: 1024
function main(input){
 input = input.split("\n");
 var n = parseInt(input[0],10);
 var k = parseInt(input[1],10);
 var x = parseInt(input[2],10);
 var y = parseInt(input[3],10);
 var sum = 0;
  
 for(var i=0; i<n; i++){
  if(i<k){
    sum += x;
  }else{
    sum += y; 
  }
 }
 console.log(sum);  
}

main(require("fs").readFileSync("/dev/stdin","utf8"));

Measured memory_bytes: 7372
#include <vector>
#include <stack>
#include <iostream>
#include <unordered_map>
#include <map>
#include <iomanip>
#include <set>
#include <functional>
#include <algorithm>
#include <cassert>
#include <cmath>
#include <string>
#include <sstream>
#include <queue>
#include <bitset>

using namespace std;

constexpr int MOD = 1000000007;

using Long = long long;
template<typename T>
using V = vector<T>;
template<typename T>
using Vv = V<V<T>>;
using Vb = V<bool>;
using Vvb = V<Vb>;
using Vi = V<int>;
using Vvi = V<Vi>;
using Vl = V<Long>;
using Vvl = V<Vl>;
using Vd = V<double>;
using Vvd = V<Vd>;
using Vs = V<string>;

template<typename T>
T read() {
    T res;
    cin >> res;
    return res;
}

template<typename T>
V<T> readV(int n) {
    V<T> res((size_t) n);
    for (int i = 0; i < n; ++i) {
        res[i] = read<T>();
    }
    return res;
}

template<typename T>
Vv<T> readVv(int n, int m) {
    Vv<T> res((size_t) n, V<T>((size_t) m));
    for (int i = 0; i < n; ++i) {
        res[i] = readV<T>(m);
    }
    return res;
}

// *** SOLUTION BEGIN ***

void solve() {
    int n, a, b;
    cin >> n >> a >> b;
    if (a > n || b > n) {
        cout << -1;
        return;
    }
    vector<int> p(n);
    for (int i = 0; i < n; ++i) {
        p[i] = i + 1;
    }
    int inc = n - (b - 1);
    int i = b;
    reverse(begin(p), begin(p) + b);
    while (i < n && inc > a) {
        int len = min(n - i, min(b, inc - a + 1));
        reverse(begin(p) + i, begin(p) + i + len);
        inc -= len - 1;
        i += len;
    }
    if (inc != a) {
        cout << -1;
        return;
    }
    for (int i = 0; i < n; ++i) {
        cout << p[i] << ' ';
    }
}

// *** SOLUTION END ***

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cout.precision(10);
    cout << fixed;
    solve();
    return 0;
}


Measured memory_bytes: 3328
#include<bits/stdc++.h>
#include<cmath>
#define pb(i) push_back(i)
#define all(v) v.begin(),v.end()
#define max_pq priority_queue <lli>
#define min_pq priority_queue <lli,vector<lli>, greater<lli> >
#define setbits(x) __builtin_popcount(x)
#define tr(v,it) for(typeof(v.begin()) it = v.begin() ; it!=v.end();it++)
using namespace std;


typedef long long int lli;
typedef vector<lli> vi;
typedef pair<lli,lli> pi;
typedef map<lli,lli> map_i;

bool prime(lli n)
{
  for(lli i=2;i<sqrt(n);i++)
    {if(n%i==0)
      return false;
    }
  return true;
}
lli power(lli a, lli b)
{
    lli p=a;
    lli ans =1;
    while(b>0)
    {
        if((b&1)==1)
            ans = ans*p;
        p= p*a;
        b = b>>1;
    }
    return ans;
}

lli mod = 1e9 + 7;
lli infinity = 1e18;
int main()
{   ios::sync_with_stdio(0);
    double n,d,x,y;
    cin>>n>>d;
    lli count =0;
    for(int i=0;i<n;i++)
    {
        cin>>x>>y;
        double dist = sqrt(x*x + y*y);
        if(dist <= d)
            count+=1;
    }
    cout<<count;
    return 0;
}


Measured memory_bytes: 3856
#include "bits/stdc++.h"

using namespace std;

void Main() {
    int N;
    cin >> N;
    double ansD = N / 1.08;
    int ans = (int)ansD;
    if ((int)(ans * 1.08) == N) {
        cout << ans << endl;
    }
    else if ((int)((ans + 1) * 1.08) == N) {
        cout << ans + 1 << endl;
    }
    else {
        cout << ":(" << endl;
    }
}

int main() {
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 3612
#pragma GCC optimize ("O3")
#pragma GCC target ("avx2")

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

#define NMAX 200001

int a[NMAX], up[NMAX], bt[NMAX];
int imos[NMAX];
char c[NMAX][30];
int clen[NMAX];

void reset(int n) {
    for(int i = 0; i < n; i++) imos[i] = 0;
}

int get_int() {
    int res = 0;
    char c = getchar();
    while(c != EOF && c != ' ' && c != '\n') {
        res *= 10;
        res += c - '0';
        c = getchar();
    }
    return res;
}

void get_int_array(int *a, int n) {
    for(int i = 0; i < n; i++){
        int res = 0;
        char c = getchar();
        while(c != ' ' && c != '\n') {
            res *= 10;
            res += c - '0';
            c = getchar();
        }
        a[i] = res;
    }
}


void put_int(int *a, int n) {
    for(int i = 0; i < n; i++) {
        int sz = 0;
        int m = a[i];
        c[i][sz++] = (m % 10) + '0';
        m /= 10;
        while(m > 0) {
            c[i][sz++] = (m % 10) + '0';
            m /= 10;
        }
        clen[i] = sz-1;
    }
    for(int j = 0; j < n; j++) {
        for(int i = clen[j]; i >= 0; i--) {
            putchar(c[j][i]);
        }
        putchar('\n');
    }
}

int max(int a, int b) { 
    if(a > b) return a;
    else return b;
}

int min(int a, int b) { 
    if(a < b) return a;
    else return b;
}

int main(){

    int n, k;
    n = get_int();
    k = get_int();
    //for(int i = 0; i < n; i++) a[i] = get_int();
    get_int_array(a, n);

    for(int itr = 0; itr < k; itr++) {
        reset(n+1); 
        for(int i = 0; i < n; i++) {
            if(i > a[i]) bt[i] = i - a[i];
            else bt[i] = 0;
            if(n < i + a[i] + 1) up[i] = n;
            else up[i] = i + a[i] + 1;
        }
        for(int i = 0; i < n; i++){
            imos[bt[i]]++;
            imos[up[i]]--;
        }
        int acc = 0;
        for(int i = 0; i < n; i++){
            acc += imos[i];
            a[i] = acc;
        }
        int sum = 0;
        for(int i = 0; i < n; i++) sum += a[i];
        if(sum == n * n) break;
    }

    //    for(int i = 0; i < n; i++) put_int(a[i]);
    put_int(a, n);
    return 0;
}


Measured memory_bytes: 11472
import collections
S = input()
alp = 'abcdefghijklmnopqrstuvwxyz'
dic = collections.defaultdict(int)
ans = -1
if len(S) <= 25:
    for i in S:
        dic[i] += 1
    for i in alp:
        if dic[i] == 0:
            ans = S + i
            break
else:
    dic2 = {}
    dic3 = {}
    lst = []
    tmp = 0
    flag = False
    for i, j in zip(alp, range(1, 27)):
        dic2[i] = j
        dic3[j] = i
    for i in range(1, 27):
        a2 = S[-i]
        idx = dic2[a2]
        if idx < tmp:
            lst.sort()
            for j in lst:
                if j > idx:
                    ans = S[:-i] + dic3[j]
                    flag = True
                    break
        
        else:
            tmp = idx
            lst.append(idx)
        if flag:
            break

print(ans)

Measured memory_bytes: 3316