akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>

using namespace std;

int dp[1000001];
int kind[31];


const int MAX_SIZE = 10000;
const int MAX_PRIME = 1000000;


int prime[MAX_PRIME+1];
bool isPrime[MAX_PRIME+1];
int p;

void erats(){
	// primeXgðú»
	fill(isPrime,isPrime+MAX_PRIME,true);
	p = 0;
	isPrime[0] = isPrime[1] = false;

	for(int i = 2; i <= MAX_PRIME; i++){
		if(isPrime[i]){
			prime[p++] = i;
		}
		else
			continue;

		// Óé¢É©¯é
		for(int j = 2*i; j <= MAX_PRIME; j+=i){
			isPrime[j] = false;
		}
	}
}


int main(){

	int n;
	int x;
	erats();
	while(cin>>n>>x&&!(n==0&&x==0)){
		for(int i = 0; i < n; i++){
			cin>>kind[i];
		}
		// eàzÌ¥¢ûª½íÞ é©ðßé
		//fill(dp,dp+1000001,0);
		dp[0]=1;
		int maxCost=-1;

		//for(int j = 0; j < n; j++){
		//	for(int i = kind[j]; i <= x; i++){
		//		dp[i]+=dp[i-kind[j]];
		//	}
		//}

		for(int i = 1; i <= x; i++){
			dp[i]=0;
			for(int j = 0; j < n; j++){
				if(i-kind[j]>=0){
					dp[i]+=dp[i-kind[j]];
				}
			}
			if(dp[i]&&(isPrime[i]||i==1)){
				maxCost=i;
			}
		}
		//for(int i = 0; i <= x; i++){
		//	if(dp[i]&&isPrime[i])
		//		maxCost=i;
		//}


		if(maxCost==-1)
			cout<<"NA"<<endl;
		else
			cout<<maxCost<<endl;
	}

	return 0;
}

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

typedef struct node {
    node *prev;
    int v;
    node *next;
} Node;

Node *hd;

void insert(int);
void deleteNode(Node *);

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    hd = (Node *)malloc( sizeof(Node) );
    hd->prev = hd;
    hd->next = hd;

    char command[12];
    
    int n, num;
    cin>>n;
    for(int i = 0; i < n; i++) {
        cin>>command;

        if( command[0] == 'i') {
            cin>>num;
            insert(num);

        } else if( command[0] == 'd' && command[6] == 'L' ) {
            
            deleteNode(hd->prev);
        } else if( command[0] == 'd' && command[6] == 'F' ) {
            
            deleteNode(hd->next);
        } else if( command[0] == 'd' ) {
            cin>>num;
            Node *a = hd->next;
            while(1) {
                if(a->v == num) {
                    deleteNode(a);
                    break;
                }
                if(a->next == hd) break;
                a = a->next;
            }
        }
    }
    
    Node *a = hd;
    while(1) {
        a = a->next;
        if(a == hd->prev) break;
        cout<<a->v<<' ';
    }
    cout<<a->v<<endl;
    
    return 0;
}

void insert(int v) {
    Node *newnode = (Node *)malloc( sizeof(Node) );
    newnode->v = v;
    newnode->prev = hd;
    newnode->next = hd->next;
    hd->next->prev = newnode;
    hd->next = newnode;
    return;
}

void deleteNode(Node *n) {
    n->next->prev = n->prev;
    n->prev->next = n->next;
    free(n);
    return;
}



Measured memory_bytes: 34364
#include <iostream>
#include <vector>
#include <limits>
#include <boost/range/irange.hpp>
#include <boost/range/adaptors.hpp>

using namespace std;
using namespace boost;
using uint = unsigned int;
using ll = long long int;
using ull = unsigned long long int;

int main() {
    ll X, A, B;
    cin >> X >> A >> B;
    if (A >= B){
        cout << "delicious" << endl;
    } else if ((B - A) <= X){
        cout << "safe" << endl;
    } else {
        cout << "dangerous" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    a, b, c = LI()
    print(min(a+b,b+c,c+a))
    return

#B
def B():
    def check(s):
        x = len(s)
        if x % 2:
            return False
        if s[:x // 2] == s[x // 2:]:
            return True
    s = S()
    for i in range(1,len(s)):
        if check(s[: - i]):
            print(len(s) - i)
            return

#C
def C():
    II()
    a = LI()
    ans1 = a[-1::-2]
    ans2 = a[-2::-2][::-1]
    ans = ans1 + ans2
    print(*ans)
    return

#D
def D():
    return

#Solve
if __name__ == '__main__':
    C()


Measured memory_bytes: 89552
#include <bits/stdc++.h>
#include <iostream>
#include <sstream>
#include <string>
#define f first
#define s second
 
#define pb push_back
#define mp make_pair
 
#define ll long long
#define pii pair<int, int>
#define all(v) v.begin(), v.end()
#define sz(v) int(v.size())
using namespace std;
 
const int N = (int) 4e5 + 10;
const int MAX_LEN = (int) 2e6 + 10;
const int SQRT = 400;
 
const int INF = (int) 1e9 + 7;
const ll LINF = (ll) 1e18 + 7;
 
const double PI = acos(-1);
ll const MOD = 998244353;
 
void yes(){
    cout<<"YES"<<'\n';
}
 
void no(){
    cout<<"NO"<<'\n';
}
 
ll fact(int n){
    ll ans = 1;
    for(int i=2;i<=n;i++){
        ans = (ans*i)%MOD;
    }
 
    return ans;
}
 
ll powM(int n, int x){
    if(x==0){
        return 1;
    }
    if(x==1){
        return n%MOD;
    }
 
    if(x%2==0){
        ll a = powM(n,x/2);
        return (a*a)%MOD;
    }else{
        return (n*powM(n,x-1))%MOD;
    }
}
 
ll C(int n, int k){
    return (fact(n) * powM((fact(k)*fact(n-k))%MOD,MOD-2))%MOD;
}
 
ll A(int n, int k){
    return (fact(n) * powM(fact(n-k)%MOD,MOD-2))%MOD;
}
string st(int temp){
    string str="";
    while(temp != 0){
			if(temp % 2 == 0){
				str += "0";
			}else{
				str += "1";
			}			
			temp /= 2;
		}
    return str;
}
const int nx[4] = {1, 0, -1, 0};
const int ny[4] = {0, 1, 0, -1};
 
int t,n,m,k;
char se;
void solve(){
    cin>>n>>k;
    vector<int> a(n);
    for (int i=0;i<n;i++){
        cin>>a[i];
    }
    sort(a.begin(),a.end());
    m=0;
    for(int i=0;i<k;i++){
        m+=a[i];
    }
    cout<<m;
  
}
    


int main() {
    t=1;
    // cin>>t;
    while (t--){
        solve();

    }
    return 0;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
double dp[3001][3001];
double solve(vector<double> &ar, int i, int x)
{
    if(x==0)
    {
        return 1;
    }
    if(i==0)
    {
        return 0;
    }
    if(dp[i][x]>-0.9)
    {
        return dp[i][x];
    }
    return dp[i][x] = ar[i]*solve(ar,i-1,x-1) + (1-ar[i])*solve(ar,i-1,x);
}

int main() {
    int n;
    cin>>n;
    memset(dp,-1,sizeof dp);
    vector<double> ar(n+1);
    for(int i=1;i<=n;i++)
    {
        cin>>ar[i];
    }
    cout<<fixed<<setprecision(10)<<solve(ar,n,(n+1)/2);
}


Measured memory_bytes: 74336
using System;
using System.IO;
using System.Linq;
using static System.Console;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            ReadLine();
            var list = ReadLine().Split(' ').Select(int.Parse).ToList();
            list.Sort();
            var result = (list[0] + (double)list[1]) / 2;
            for(int i = 2; i < list.Count; ++i)
            {
                result = (result + list[i]) / 2;
            }
            WriteLine(result);
        }
    }
}


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

int main() {
  int n, x, t;
  cin >> n >> x >> t;
  
  if (n % x == 0){
    cout << n / x * t << endl;
  }
  else{
    cout << (n / x + 1) * t << endl;
  }
}


Measured memory_bytes: 3616
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <math.h>
#include <queue>
#include <set>
#include <map>
#include <stack>
#include <iomanip>
#include <numeric>
 
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
ll N,K;
ll m;
string S;
ll d;
ll M = 1000000007;
vector<ll> fac(5000001); //n!(mod M)
vector<ll> ifac(5000001); //k!^{M-2} (mod M)
//a,bの範囲的にこれだけ配列を用意していけば十分

ll mpow(ll x, ll n){ //x^n(mod M) ←普通にpow(x,n)では溢れてしまうため，随時mod計算
    ll ans = 1;
    while(n != 0){
        if(n&1) ans = ans*x % M;
        x = x*x % M;
        n = n >> 1;
    }
    return ans;
}

ll comb(ll a, ll b){ //aCbをmod計算
    if(a == 0 && b == 0)return 1;
    if(a < b || a < 0)return 0;
    ll tmp = ifac[a-b]* ifac[b] % M;
    return tmp * fac[a] % M;
}
int main() {
    fac[0] = 1;
    ifac[0] = 1;
    for(ll i = 0; i<2000000; i++){
        fac[i+1] = fac[i]*(i+1) % M; // n!(mod M)
        ifac[i+1] = ifac[i]*mpow(i+1, M-2) % M; // k!^{M-2} (mod M) ←累乗にmpowを採用
    }
    cin >> K >> S;
    N = S.size();
    for(ll i=0;i<=K;i++){
        d = comb(i+N-1,N-1);
        d = (d*mpow(25,i))%M;
        d = (d*mpow(26,(K-i)))%M;
        m = (m + d)%M;
    }
    cout << m << endl;
    
    }


Measured memory_bytes: 83396
N = 4
ARR = [2, 2, 1, 3]

N = 7
ARR = [1, 1, 1, 1, 1, 1, 1]

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

# 3 2 2 1
def calculate(n, arr):
    endIndex = 0
    ans = 0

    arr = sorted(arr, reverse=True)
    for i in range(n):

        if i == 0:
            ans += arr[i]
            endIndex += 1
            continue

        endIndex += 1
        if endIndex >= n:
            break
        ans += arr[i]

        endIndex += 1
        if endIndex >= n:
            break
        ans += arr[i]

    print(ans)


calculate(N, ARR)


Measured memory_bytes: 31408
IDENTIFICATION DIVISION.
PROGRAM-ID. GUESSNUM.
 
DATA DIVISION.
WORKING-STORAGE SECTION.

01 INP1.
    03 N      PIC 9.
    03 FILLER PIC X.
    03 M      PIC 9.
01 INP2.
    03 S      PIC 9.
    03 FILLER PIC X.
    03 C      PIC 9.
01  I         PIC 9.
01  TBL.
    03 T-N    PIC 9 OCCURS 3.
01  OUT-N     PIC ZZ9.
01  SW-ERR    PIC X.

PROCEDURE DIVISION.
MAIN-010.
  MOVE SPACE TO TBL.
  MOVE '0'   TO SW-ERR.

  ACCEPT INP1.
  PERFORM VARYING I FROM 1 BY 1 UNTIL I > M
    ACCEPT INP2
    IF (T-N(S) = ' ')
      IF (C = '0') AND (S = 1) AND (N > 1)
        MOVE '1' TO SW-ERR
      ELSE
        MOVE C   TO T-N(S)
      END-IF
    ELSE 
      IF (T-N(S) NOT = C)
        MOVE '1' TO SW-ERR
      END-IF
    END-IF
  END-PERFORM.

  IF (SW-ERR = '1')
    DISPLAY '-1'
  ELSE
    IF (N > 1) AND (T-N(1) = ' ') 
      MOVE '1' TO T-N(1)
    END-IF
      
    PERFORM VARYING I FROM 1 BY 1 UNTIL I > N
      IF (T-N(I) = ' ')
        MOVE '0' TO T-N(I)
      END-IF
    END-PERFORM

    MOVE TBL(1:N) TO OUT-N
    DISPLAY OUT-N
  END-IF. 
  
MAIN-EXIT.
  STOP RUN.


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i,n,k) for(int i=(n);i<(k);i++)
#define ALL(a)  (a).begin(),(a).end()
int ans=0;
void Main(){
    int n;
    string s;
    cin >> n >> s;
    int rred = count(ALL(s), 'R');
    int lwhite = 0;
    ans = rred;
    For(i,0,n){
        if(s[i] == 'R'){
            rred--;
        }
        else{
            lwhite++;
        }
        ans = min(ans, max(rred, lwhite));
    }
    cout << ans << endl;
}
int main(){
    Main();
    /*
    東方風神録は神が出てくるので当然神ゲー
    */
    return 0;
}

Measured memory_bytes: 3712
N = int(input())

ctr = [1] * (N + 1)
for n in range(2, N + 1):
    for v in range(n, N + 1, n):
        ctr[v] += 1

ans = 0
for n in range(1, N + 1):
    ans += n * ctr[n]
print(ans)


Measured memory_bytes: 151600
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<cmath>
using namespace std;
int main() {
	long long n, ans = 0; string s; cin >> n >> s;
	for (int h = 0; h < n - 1; h++) {
		if (s[h] == s[h + 1]) {
			ans++;
		}
	}
	cout << n - ans << endl;
	cin >> n;
}

Measured memory_bytes: 512
W = []
K = []
for i in range (10):
    W.append(int(input()))
for i in range (10):
    K.append(int(input()))
W.sort(reverse = True)
K.sort(reverse = True)
point_W = sum(W[:3])
point_K = sum(K[:3])
print(point_W,point_K)



Measured memory_bytes: 5600
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 1000000000000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;



#define SIZE 100005

struct Info{
	Info(int arg_node_id,int arg_sum_dist){
		node_id = arg_node_id;
		sum_dist = arg_sum_dist;
	}
	bool operator<(const struct Info &arg) const{

		return sum_dist > arg.sum_dist;
	}

	int node_id,sum_dist;
};

int N,M;
int min_dist[SIZE];
int pre_node[SIZE];
vector<int> G[SIZE];


int main(){

	scanf("%d %d",&N,&M);

	int from,to;

	for(int i = 0; i < M; i++){

		scanf("%d %d",&from,&to);
		from--;
		to--;

		G[from].push_back(to);
		G[to].push_back(from);
	}

	min_dist[0] = 0;
	for(int i = 1; i < N; i++){

		min_dist[i] = BIG_NUM;
	}

	priority_queue<Info> Q;
	Q.push(Info(0,0));

	while(!Q.empty()){

		if(Q.top().sum_dist > min_dist[Q.top().node_id]){

			Q.pop();

		}else{

			for(int i = 0; i < G[Q.top().node_id].size(); i++){

				int next_node = G[Q.top().node_id][i];
				int next_dist = Q.top().sum_dist+1;

				if(min_dist[next_node] > next_dist){

					min_dist[next_node] = next_dist;
					pre_node[next_node] = Q.top().node_id;

					Q.push(Info(next_node,next_dist));
				}
			}
			Q.pop();
		}
	}

	printf("Yes\n");
	for(int i = 1; i < N; i++){

		printf("%d\n",pre_node[i]+1);
	}

	return 0;
}


Measured memory_bytes: 11208
package main

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

func main() {
  sc := bufio.NewScanner(os.Stdin)
  sc.Split(bufio.ScanWords)

  sc.Scan()
  n, _ := strconv.Atoi(sc.Text())

  d := make([]int, n)

  for i := 0; i < n; i++ {
    sc.Scan()
    d[i], _ = strconv.Atoi(sc.Text())
  }

  sort.Ints(d)

  fmt.Println(d[n / 2] - d[n / 2 - 1])

}



Measured memory_bytes: 2048
#include <bits/stdc++.h>
    #define REP(i, n) for(int i = 0;i < n;i++)
    #define REPR(i, n) for(int i = n;i >= 0;i--)
    #define FOR(i, m, n) for(int i = m;i < n;i++)
    #define FORR(i, m, n) for(int i = m;i >= n;i--)
    #define SORT(v, n) sort(v, v+n);
    #define VSORT(v) sort(v.begin(), v.end());
    #define llong long long
    #define pb(a) push_back(a)
    #define INF 999999999
    using namespace std;
    typedef pair<int, int> P;
    typedef pair<llong, llong> LP;
    typedef pair<int, P> PP;
    typedef pair<llong, LP> LPP;
    //vector<tuple<long long, long long, long long>>vec;

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


    int main()
    {
    int n;
    cin>>n; int cnt=1;
    vector<int> h(n,0);
    REP(i,n)
    {
        cin >> h[i];
    }
        int d=h[0];
    for(int i=0; i<n-1; i++)
    {
       d=max(d,h[i]);
       if(d<=h[i+1]) ++cnt;
    }
    cout<<cnt<<endl;
    }

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <numeric>
typedef long long ll;
#define rep(i,a,b) for(int i=a;i<b;++i)
#define rrep(i,a,b) for(int i=a;i>=b;--i)
using namespace std;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int X; cin >> X;
    int res = 1;
    int now = 1;

    while(true) {
        if (X <= now) {
            cout << res << endl;
            return 0;
        }
        ++res;
        now += res;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pii pair<int,int>
#define ll long long
#define cl(x,y) memset(x,y,sizeof(x))
#define ct cerr<<"Time elapsed:"<<1.0*clock()/CLOCKS_PER_SEC<<"s.\n";
const int N=1e6+10;
const int mod=1e9+7;
const int inf=0x3f3f3f3f;
using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	string s;
	cin>>s;
	if(s[2]==s[3] && s[4]==s[5])
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

char s[212345];


int main(void){
  
  scanf("%s", s);
  
  int i;
  int A, Z;
  int x=1;
  for( i = 0; i < 200000; i++ ){
    if( x && s[i] == 'A' ){
       x = 0;
       A = i;
    }
    if( s[i] == 'Z' ) Z = i+1;
    if( s[i] == '\0' ) break;
  }
  
  printf("%d\n", Z-A);
  
  return 0;
}

Measured memory_bytes: 384
using System;

class main
{
    public static int n = 1000001;
    static void Main()
    {
        string s;
        int q;
        int[] p = new int[n];
        for (int i = 2; i < n; ++i)
                for (int j = i * 2; j < n; j += i)
                    p[j] = 1;
        while ((s = Console.ReadLine()) != null){
                q = 0;
                for (int i = 2; i <= int.Parse(s); ++i)
                    if (p[i] != 1) ++q;
                Console.WriteLine("{0}", q);
        }    
    }
}

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

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

Node root;

Node treeMinimum(Node x){


}

Node treeMaximum(Node x){


}

Node treeSearch(Node u, int k){


}

Node treeSuccessor(Node x){


}

void treeDelete(Node z){
  Node y; // node to be deleted
  Node x; // child of y



}

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

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

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

  if(y == NIL) root = z;
  else if (z->key < y->key) y->left = z;
  else y->right = z;

}

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

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


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

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

  return 0;
}



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

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

    int sum = 0;
    for(int i=0; i<=N; ++i) sum += abs(A[i] - A[i+1]);

    for(int i=1; i<=N; ++i) {
        cout << sum + abs(A[i+1] - A[i-1]) - abs(A[i+1] - A[i]) - abs(A[i] - A[i-1]) << endl;
    }
    return 0;
}

Measured memory_bytes: 1664
(setq a (read) b (read))
(let ((tmpa a) (tmpb b))
  (setq tmpa (min a b))
  (setq tmpb (max a b))
  (setq a tmpa b tmpb))
(if (>= (- b a) 1) (princ (- (* 2 b) 1)) (princ (+ a b)))

Measured memory_bytes: 11240
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include <numeric>
#include<map>
#include<unordered_map>
#include <queue>
 
using namespace std;
using ll=long long;
#define rep(i,n) for(ll i=0;i<n;++i)
#define all_map(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define ALL(a) (a).begin(),(a).end()

int main(){
    ll n, m;
    cin >> n >> m;
    ll cnt[100010] = {};
    rep(i, m){
        ll a, b;
        cin >> a >> b;
        cnt[a]++;
        cnt[b]++;
    }
    rep(i, n+1)if(cnt[i]%2 != 0){
        cout << "NO";
        return 0;
    }
    cout << "YES";
}

Measured memory_bytes: 1024
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b){ a>b?:a=b; }
template<class T, class C> void chmin(T& a, C b){ a<b?:a=b; }


int main(){
    int N;
    cin>>N;
    cout<<N*(N-1)/2-N/2<<endl;
    REP(i, 1, N){
        int cut = N+1-N%2-i;
        REP(j, i+1, N+1){
            if(j!=cut){
                cout<<i<<" "<<j<<endl;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#define _GLIBCXX_DEBUG // check []
#define DIVISOR 1000000007

using namespace std;
typedef pair<int,int> pii;
typedef pair<int64_t, int64_t> pII;

template<typename T>
void cins(vector<T>& arr) { for(T& e: arr) cin >> e; }

template<typename T>
void p(T elem) {cout << elem << endl;}
template<typename T>
void ps(vector<T>& arr) { for(T e: arr) p(e); }

#ifdef DEBUG
#define debug(fmt, ...) \
    printf("[debug: %s] " fmt, __func__, __VA_ARGS__)
#else
#define debug(fmt, ...)
#endif

int main(void) {
    int num;
    cin >> num;
    vector<int> arr(num+1);
    for(int i = 1; i <= num; i++) {
        int val;
        cin >> val;
        arr[i] = val;
    }

    vector<int> ans(num+1);
    for(int i = num; i >= 1; i--) {
        int mmax = sqrt(0.5+i);
        debug("%d -> %d-%d\n", i, ans[i], arr[i]);
        int cur = abs(ans[i] - arr[i]);
        ans[i] = cur;
        if(i == 1) break;
        for(int div = 1; div <= mmax; div++) {
            if(i%div) continue;
            ans[div] = (ans[div] + cur)%2;
            if(div*div==i) continue;
            if(div>1) ans[i/div] = (ans[i/div] + cur)%2;
        }
    }

    int cnt = 0;
    for(int i = 1; i <= num; i++) {
        cnt += ans[i];
    }

    cout << cnt << endl;
    for(int i = 1; i <= num; i++) {
        if(!ans[i]) continue;
        cnt--;
        cout << i;
        cout << ((cnt==0) ? '\n' : ' ');
    }
    return 0;
}

Measured memory_bytes: 4724
#include "bits/stdc++.h"
#define DEBUG(x) cout<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cout<<#v<<":";for(int i=0;i<v.size();i++) cout<<" "<<v[i]; cout<<endl
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define MOD 1000000007
#define mod 1000000009
#define pi 3.14159265358979323846
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
typedef long long ll;
const int inf = 1000000001;
const ll INF = 1e18 * 4;
#define maxW 100001
using namespace std;
vi w(101);
vi v(101);
ll dp[101][maxW];
int main(){
    int N, W;
    cin >> N >> W;
    rep(i, 0, N){
        int x, y;
        cin >> w[i] >> v[i];
    }
    rep(i, 0, maxW) dp[0][i] = INF;
    rep(j, 0, N+1) dp[j][0] = 0;
    rep(i, 0, N){
        rep(j, 0, maxW){
            if(j-v[i] >= 0) dp[i+1][j] = min(dp[i][j-v[i]] + w[i], dp[i][j]);
            else dp[i+1][j] = dp[i][j];
        }
    }
    int ans = 0;
    rep(i, 0, N+1){
        rep(j, 0, maxW){
            if(dp[i][j] <= W){
                ans = max(ans, j);
            }
        }
    }
    cout << ans << endl;
    return 0;
}




Measured memory_bytes: 79104
import sys
sys.setrecursionlimit(10**7)
# 再帰的に求められる
memo = [-1] * 110000

# ベキ乗は英語でpower
def withdrawals(n):
    if n == 0:  # 最後まで下ろせたら完了である
        return 0
    if memo[n] != -1:  # すでに最適解がもとまっているならばその解を返す
        return memo[n]
    res = n  # すべて1円で支払ったと仮定する
    pow6 = 1
    while pow6 <= n:
        res = min(res, withdrawals(n - pow6) + 1)
        pow6 *= 6

    pow9 = 1
    while pow9 <= n:
        res = min(res, withdrawals(n - pow9) + 1)
        pow9 *= 9

    memo[n] = res
    return res


N = int(input())
withdrawals(N)
print(memo[N])


Measured memory_bytes: 89716
program maximal_value
  implicit none
  integer :: n, b(100) = 0, a(100) = 0, ans, i
  read(*,*) n
  read(*,*) b(1:n-1)
  a(1) = b(1)
  a(n) = b(n-1)
  do i = 2, n-1
    a(i) = min(b(i-1),b(i))
  end do
  write(*,'(i0)') sum(a(1:n))
end program maximal_value

Measured memory_bytes: 384
from itertools import product

N = int(input())
F = []
P = []

for i in range(N):
    F.append(list(map(int,input().split())))
for i in range(N):
    P.append(list(map(int,input().split())))


def main():
    open_count = [0 for i in range(N)]
    cnt = 0
    max_profit = - float('inf')

    for sister_store in list(product((0,1), repeat=10))[1:]:
        profit = 0
        for store_num in range(N):
            profit += calc_profit(sister_store, store_num)
        if profit > max_profit:
            max_profit = profit
    print(max_profit)

def calc_profit(sister, store_num):
    co_open = 0
    #print("store_num", store_num)
    for i in range(10):
        """
        print("{0:<10} {1:d}".format("sister :",sister[i]))
        print("{0:<10} {1:d}".format(" store :",F[store_num][i]))
        """
        co_open += sister[i] * F[store_num][i]

    return P[store_num][co_open]
main()

Measured memory_bytes: 3188
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define ll long long
#define ll_MAX LONG_LONG_MAX
#define ll_MIN LONG_LONG_MIN
#define pi pair<int,int>
#define endl "\n"
#define MAXN 100005
#define mod 1000000007
using namespace std;

void solve()
{
    
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	cout.tie(NULL);
    solve();
    ll n;
    cin>>n;
    ll a[n];
    for (ll i = 0; i < n; i++)
    {
        /* code */
        cin>>a[i];
    }
    vector<ll> pref(n, 0);
    pref[0] = a[0];
    for (ll i = 1; i < n; i++)
    {
        /* code */
        pref[i] = (pref[i-1] + a[i])%mod;
    }
    ll ans = 0;
    for(ll i=0; i<n; i++)
    {
        ans = (ans + (a[i]*pref[n-1])%mod - (a[i]*pref[i])%mod + mod )%mod;
    }
    cout<<ans<<'\n';
}

Measured memory_bytes: 6376
#include <iostream>
#include <bits/stdc++.h>
#include <set>
#define isPowerOfTwo(S) (!(S & (S - 1)))
#define ll long long
#define ull unsigned long long
#define MAXN 1000000007
#define INF 1e12
using namespace std;
typedef pair<int,int> pi;
typedef pair<pi,int> trip;
typedef pair<ll int,ll int> pli;
typedef vector<int> vi;
typedef vector<ll int> vli;
typedef vector<vi> vvi;
string getString(char x)
{
    string s(1, x);

    return s;
}
int highestPowerof2(ll int n)
{if(n==0)
    return 0;
   int p = (int)log2(n);
   //cout<<p<<"highest"<<endl;
   return p;
}


int main()
{ios::sync_with_stdio(0);
	cin.tie(0);
    int test=1;
    //int cas=
    //cin>>test;
    while(test--)
    {
       string s1,s2;cin>>s1>>s2;
       int ans=s2.length();
       for(int i=0;i<s1.length()-s2.length()+1;i++)
       {
           int change=0;
           for(int j=0;j<s2.length();j++)
           {
               if(s2[j]!=s1[i+j])
                change++;
           }
           ans=min(ans,change);

       }
       cout<<ans<<endl;

    }

}


Measured memory_bytes: 3496
#include <bits/stdc++.h>
#define Inf 0x3f3f3f3f
#define rg register
using namespace std;
typedef long long ll;
inline ll min(ll x, ll y) { return x < y ? x : y; }
inline ll max(ll x, ll y) { return x > y ? x : y; }
const int Maxn = 1e5 + 5;
inline int read()
{
	rg int res = 0, sign = 1;
	rg char ch = getchar();
	while (!isdigit(ch))
	{
		if (ch == '-')
			sign = -1;
		ch = getchar();
	}
	do
	{
		res = (res << 3) + (res << 1) + (ch ^ 48);
		ch = getchar();
	} while (isdigit(ch));
	return res * sign;
}
int n, a[Maxn], ans;
int main()
{
	rg int nt;
	cin >> n;
	for (int i = 1; i <= n; i++)
		a[i] = read();
	nt = n;
	for (int i = n; i >= 1; i--)
		if (a[i] < a[i + 1])
		{
			ans = max(ans, nt - i);
			nt = i;
		}
 	ans = max(ans, nt);
	cout << ans - 1 << endl;
	return 0;
}


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

typedef long long ll;
#define MOD1 1000000007
#define MOD2 1000000009
#define fr(a,b) for(ll i=a;i<b;i++)
#define end "\n"


int32_t main(){
#ifdef _MSC_VER
    _CRT_SECURE_NO_WARNINGS
#endif
#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
#endif
#pragma warning(suppress: 4101) srand(time(nullptr));
    cout << setprecision(20) << fixed;
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
   ll n;
   cin>>n;
   ll a[n];
   fr(0,n)
    cin>>a[i];
   sort(a,a+n);
   ll count=0;
   fr(0,n)
   {
       for(ll j=i+1;j<n;j++)
       {
           for(ll k=j+1;k<n;k++)
           {
               if(a[i]!=a[j] && a[i]!=a[k]&& a[j]!=a[k] && a[j]+a[i]>a[k])
                   count++;
           }
       }
   }
   cout<<count<<endl;
    return 0;
}

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

int main() {
	int n;
	cin>>n;
	bool found = false;
	for(int i=1;i<=9;i++){
		if(n/i<10 && n%i==0){
			found = true;
		}
	}
	if(found){
		cout<<"Yes";
	}else{
		cout<<"No";
	}
	return 0;
}

Measured memory_bytes: 3616
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=2e5+10;
ll a[maxn];
ll f[maxn][35];
int main(){
    int n,step,q,i,j,p;
    scanf("%d",&n);
    for (i=0;i<n;i++)  scanf("%lld",&a[i]);
    scanf("%d%d",&step,&q);
    for (i=0;i<n;i++)  {
        p=upper_bound(a,a+n,a[i]+step)-a;
        f[i+1][0]=p;
    }
    for (int j=1;j<=30;j++)
        for (int i=1;i<=n;i++)
            f[i][j]=f[f[i][j-1]][j-1];
    int l,r;
    while (q--){
        scanf("%d%d",&l,&r);
        if (l>r) swap(l,r);
        ll ans=0;
        for (int i=30;i>=0;i--){
            if (f[l][i]<r){
                ans+=(ll)(1<<i);
                l=f[l][i];
            }
        }
        printf("%lld\n",ans+1);
    }
    return 0;
}

Measured memory_bytes: 31744
#include <bits/stdc++.h>
using namespace std;
const uint64_t seed = std::chrono::system_clock::now().time_since_epoch().count();
mt19937_64 rnd(seed);
const int MOD = 998244353;

#ifdef VIPJML_LOCAL
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v)
{
    os << "{";
    for (typename vector<T>::const_iterator vi = v.begin(); vi != v.end(); ++vi)
    {
        if (vi != v.begin())
            os << ", ";
        os << *vi;
    }
    os << "}";
    return os;
}
template <typename A, typename B>
ostream &operator<<(ostream &os, const vector<pair<A, B>> &v)
{
    os << "{";
    for (typename vector<pair<A, B>>::const_iterator vi = v.begin(); vi != v.end(); ++vi)
    {
        if (vi != v.begin())
            os << ", ";
        os << '(' << vi->first << " " << vi->second << ")";
    }
    os << "}";
    return os;
}

template <typename A, typename B>
ostream &operator<<(ostream &os, const pair<A, B> &p)
{
    os << '(' << p.first << ", " << p.second << ')';
    return os;
}

void dbg_out() { cerr << endl; }
template <typename Head, typename... Tail>
void dbg_out(Head H, Tail... T)
{
    cerr << ' ' << H;
    dbg_out(T...);
}
#define dbg(...) cerr << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__)
#else
#define dbg(...)
#endif

vector<int> tree;
const int N = 300005;

int get(int node, int ts, int te, int s, int e)
{
    if (ts >= e || te <= s)
        return 0;
    if (ts >= s && te <= e)
    {
        return tree[node];
    }
    int m = (ts + te) / 2;
    return max(get(2 * node + 1, ts, m, s, e), get(2 * node + 2, m, te, s, e));
}

void update(int node, int ts, int te, int p, int v)
{
    if (ts > p || te <= p)
        return;
    if (ts + 1 == te)
    {
        tree[node] = max(tree[node], v);
    }
    else
    {
        int m = (ts + te) / 2;
        update(2 * node + 1, ts, m, p, v);
        update(2 * node + 2, m, te, p, v);
        tree[node] = max(tree[node * 2 + 1], tree[node * 2 + 2]);
    }
}

void solve()
{
    int n, k;
    cin >> n >> k;
    int ans = 0;
    tree.assign(4 * N, 0);
    for (int i = 0; i < n; i++)
    {
        int a;
        cin >> a;
        int t1 = a - k, t2 = a + k;
        int r = get(0, 0, N, t1, t2 + 1) + 1;
        ans = max(r, ans);
        update(0, 0, N, a, r);
    }
    cout << ans << "\n";
}

int main()
{
    std::ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.precision(10);
    int T = 1;
    //cin >> T;
    for (int i = 1; i <= T; i++)
    {
        solve();
    }
    cout.flush();
    return 0;
}


Measured memory_bytes: 7984
#include <iostream>
#include <bits/stdc++.h>
#define ll long long int
#define scanLl(n) scanf("%lli", &n)
using namespace std;

int main() {
	ll n;
	scanLl(n);
	
	vector <ll> height(n), maxHeight(n);
	
	for(ll i = 0; i < n; i++) {
		scanLl(height[i]);
		if(i != 0)
			maxHeight[i] = max(maxHeight[i - 1], height[i]);
		else
			maxHeight[i] = height[i];
	}
	
	ll minTotalHeight = 0;
	
	for(ll i = 0; i < n; i++)
		minTotalHeight += (maxHeight[i] - height[i]);
	
	cout << minTotalHeight << endl;
	
	return 0;
}

Measured memory_bytes: 6404
#include<bits/stdc++.h>
using namespace std;  
#pragma GCC optimize("Ofast") 
#define int long long
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back 
#define eb emplace_back
#define fn for(int i =0 ;i <n;i++)
#define fn1 for( int i =1;i<=n; i++)
#define fm for(int j =0 ;j <m;j++)
#define fm1 for(int j =1;j<=m;j++)
#define fi first
#define se second
#define endl '\n'
#define PI  3.14159265358979323846
#define MOD 1000000007
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
const int N = 2e6+5;
const int INF = 1e18L;
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}
int A[N];
int dp[N];
inline int mul(int x, int y, int mod) {
  if (x >= mod) x %= mod;
  if (y >= mod) y %= mod;
  return (x*y) % mod;
}
int solve( int n, int k) 
{ 
    sort(A, A + n); 
    int product = 1; 
   if (A[n - 1] == 0 && (k & 1)) 
        return 0; 
    if (A[n - 1] < 0 && (k & 1)) { 
        for (int i = n - 1; i >= n - k; i--) 
            product = mul(product, A[i],MOD); 
        return product; 
    } 
   int i = 0; 
    int j = n - 1; 
     if (k & 1) { 
        product = mul(product, A[j] , MOD); 
        j--; 
        k--; 
    } 
   k >>= 1; 
    for (int itr = 0; itr < k; itr++) { 
        int left_product = A[i] * A[i + 1]; 
        int right_product = A[j] * A[j - 1]; 
     if (left_product > right_product) { 
            product = mul(product, left_product,MOD); 
            i += 2; 
        } 
        else { 
            product = mul(product, right_product,MOD); 
            j -= 2; 
        } 
    } 
    return product; 
} 
signed main(){
  #ifndef ONLINE_JUDGE
  freopen("input.txt","r",stdin);
  freopen("output.txt","w",stdout);
  #endif
  IOS;
  int T=1;
  // cin >> T;
  while(T--){
    int n ,k;
    cin >> n >> k;
    fn{
      cin >>A[i];
    }
    int ans = solve(n,k);
    if(ans<0)ans+=MOD;
    cout<<ans;
  
  
  }
  return 0;
}


Measured memory_bytes: 5192
#![allow(unused_imports, unused_macros, dead_code)]

macro_rules! min {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        it.next().map(|z| it.fold(z, |x, y| min!(x, y)))
    }};
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = min!($($ys),*);
        if $x < t { $x } else { t }
    }}
}
macro_rules! max {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        it.next().map(|z| it.fold(z, |x, y| max!(x, y)))
    }};
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = max!($($ys),*);
        if $x > t { $x } else { t }
    }}
}
macro_rules! ewriteln {
    ($($args:expr),*) => { let _ = writeln!(&mut std::io::stderr(), $($args),*); };
}
macro_rules! trace {
    ($x:expr) => {
        #[cfg(debug_assertions)]
        eprintln!(">>> {} = {:?}", stringify!($x), $x)
    };
    ($($xs:expr),*) => { trace!(($($xs),*)) }
}
macro_rules! flush {
    () => {
        std::io::stdout().flush().unwrap();
    };
}
macro_rules! put {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        if let Some(x) = it.next() { print!("{}", x); }
        for x in it { print!(" {}", x); }
        println!("");
    }};
    ($x:expr) => { println!("{}", $x) };
    ($x:expr, $($xs:expr),*) => { print!("{} ", $x); put!($($xs),*) }
}

const M: i64 = 1_000_000_007;

fn main() {
    let mut sc = Scanner::new();
    let n: usize = sc.cin();
    let ps: Vec<_> = (0..n)
        .map(|_| {
            let x: i64 = sc.cin();
            let y: i64 = sc.cin();
            (x, y)
        })
        .collect();

    fn dist(x: &(i64, i64), y: &(i64, i64)) -> i64 {
        (x.0 - y.0).abs() + (x.1 - y.1).abs()
    }
    let mut ans = 0;
    for u in 0..min!(n, 10) {
        let mut u = u;
        for _ in 0..2 {
            let mut ds: Vec<_> = (0..n).map(|i| (dist(&ps[i], &ps[u]), i)).collect();
            ds.sort();
            ds.reverse();
            u = ds[0].1;
            ans = max!(ans, ds[0].0);
        }
    }
    put!(ans);
}

use std::collections::VecDeque;
use std::io::{self, Write};
use std::str::FromStr;

struct Scanner {
    stdin: io::Stdin,
    buffer: VecDeque<String>,
}
impl Scanner {
    fn new() -> Self {
        Scanner {
            stdin: io::stdin(),
            buffer: VecDeque::new(),
        }
    }
    fn cin<T: FromStr>(&mut self) -> T {
        while self.buffer.is_empty() {
            let mut line = String::new();
            let _ = self.stdin.read_line(&mut line);
            for w in line.split_whitespace() {
                self.buffer.push_back(String::from(w));
            }
        }
        self.buffer.pop_front().unwrap().parse::<T>().ok().unwrap()
    }
    fn chars(&mut self) -> Vec<char> {
        self.cin::<String>().chars().collect()
    }
    fn vec<T: FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.cin()).collect()
    }
}


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

int main() {
  
  int N;
  cin >> N;
  
  int N1 = N % 1000;
  int N2 = N % 10;
  if ( N1 % 111 == 0 ) cout << "Yes" << endl;
  else if ( ( N - N2 ) % 1110 == 0 ) cout << "Yes" << endl;
  
  else cout << "No"<< endl;
}
  
  


Measured memory_bytes: 256
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int cnt = N / 100;
    //System.out.println(cnt); >6
    int n = N % 100;
    //System.out.println(n); >15
    cnt -= n / 5;
    n %= 5;
    cnt -= n / 4;
    n %= 4;
    cnt -= n / 3;
    n %= 3;
    cnt -= n / 2;
    n %= 2;
    cnt -= n / 1;
    n %= 1;
    //System.out.println(cnt);
    //System.out.println(n);
    if (cnt - n >= 0) {
      System.out.println(1);
      return;
    }
    System.out.println(0);
  }
}

Measured memory_bytes: 35724
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
	int n,m,a,b;
	int sum=0,big=0;
	cin>>n>>m;
	for(int u=0;u<m;u++){
		cin>>a>>b;
		sum+=max(0,n-a);
		big=max(max(0,n-a),big);
	}
	cout<<sum-big<<endl;
	return 0;
}

Measured memory_bytes: 3104
#include <iostream>
#include <algorithm>

int main()
{
    // input
    int N, T, A;
    std::cin >> N;
    std::cin >> T >> A;
    
    int v[N];
    for (int i = 0; i < N; i++)
    {
        scanf("%d", &v[i]);
    }

    // find answer
    int diff_min = 1000000000;
    int ans = 1;
    for (int i = 0; i < N; i++)
    {
        int temp = T * 1000 - v[i] * 6;
        int diff = abs(temp - A * 1000);

        if (diff_min > diff)
        {
            diff_min = diff;
            ans = i + 1;  // one-based indexing
        }

    }

    std::cout << ans << std::endl;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
#define pb push_back
#define f first
#define s second
#define fr(i, n) for(int i = 0; i < n; i++)
#define frr(i, n) for(int i = 1; i<= n; i++)
#define MOD 1000000007
const int MAX = 2123;
string str;
ll l, r, n;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> str;
	n = str.size();
	for(l = 0; l < n; l++){
		if(str[l] == 'A') break;
	}
	for(r = n-1; r >= 0; r--){
		if(str[r] == 'Z') break;
	}
	cout << r-l+1 << endl;
}


Measured memory_bytes: 720
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main(){
    int n, k; cin >> n >> k;
    vector<int> d(k);
    for(int i = 0; i< k; i++) {
        cin >> d[i];
    }
    
    while(true) {
        bool f = false;
        string sn = to_string(n);
        for(int dn : d) {
            if(sn.find(to_string(dn)) != string::npos) {
                f = true;
            }
        }
        if(f) {
            n++;
            continue;
        }
        break;
    }
    cout << n << endl;
}


Measured memory_bytes: 384
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include <vector>
#include <functional>
#include <stack>
#include <utility>
#include <map>
#include <queue>
#include <set>
#include <climits>

using namespace std;

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

const ll MOD = 1000000007;
const ll INF = LLONG_MAX;
const ll MAX_N = 100000;
const double EPS = 10e-8;

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


int main() {
	string s, ans = "yes";
	bool used[26]{};
	cin >> s;
	for (int i = 0; i < s.size(); i++) {
		if (!used[s[i] - 'a'])used[s[i] - 'a'] = true;
		else ans = "no";
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
"use strict";
const main = arg => {
    var lines = arg.split('\n');

    var money = 100;

    var year = 0;

    for(year = 0; money < Number(lines[0]); year++){
        money = money + parseInt(money * 0.01);
    }

    console.log(year);
}
 
main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 30132
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2e5+7;
int a[10];
int main()
{
     for(int i=1;i<=3;i++)
     cin>>a[i];
     sort(a+1,a+4);
     cout<<a[3]*10+a[1]+a[2]<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<deque>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)

typedef int long long ll;
using namespace std;
typedef pair<int,int> P;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
const ll MOD=1e9+7;
static const int MAX = 100;
static const int INF = (1<<23);
template<class T> T gcd(T a, T b){return b? gcd(b,a%b) : a;}
template<class T> T lcm(T a,T b){return a / gcd(a,b)*b;}

int main(){

    ll h,w,m;
    cin>>h>>w>>m;
    vector<ll> hi(h,0);
    vector<ll> wi(w,0);
   // set<pair<int,int>> s;
   vector<pair<int,int>> ms;
    rep(i,m){
        ll hii,wii;
        cin>>hii>>wii;
        hii--;
        wii--;
       // s.insert({hii,wii});
         ms.push_back({hii,wii});
        hi[hii]++;
        wi[wii]++;
    }

    ll maxhi = 0;ll maxwi = 0;
    rep(i,h){if(hi[i]>=maxhi)maxhi=hi[i];}
    rep(i,w){if(wi[i]>=maxwi)maxwi=wi[i];}

    //cout<<maxhi<<" "<<maxwi<<endl;
    ll ans = maxhi + maxwi;

    set<ll> hii;
    set<ll> wii;
    rep(i,h){if(hi[i]==maxhi){hii.insert(i);}}
    rep(i,w){if(wi[i]==maxwi){wii.insert(i);}}
    ll sum = 0;

    rep(i,m){
        int s1 = ms[i].first;
        int s2 = ms[i].second;
      //  cout<<s1<<s2<<endl;
        if((hii.find(s1)!=hii.end())&&(wii.find(s2)!=wii.end())){
            sum++;
        }
    }

    //cout<<sum<<endl;
    if(hii.size()*wii.size()==sum){
        ans--;
    }
    cout<<ans<<endl;



























    return 0;
}


Measured memory_bytes: 38404
### subroutines

def xy2id(ai, bi)
  (ai * (ai + 1) / 2) + bi
end

def print_pl(n, pl)
  for ai in (0...n)
    id0 = xy2id(ai, 0)
    id1 = id0 + ai
    p pl[id0..id1]
  end
end

### main

n, m = gets.strip.split(' ').map{|s| s.to_i}

nn = n * (n + 1) / 2
pl = nn.times.map{0}

m.times do
  ai, bi, xi = gets.strip.split(' ').map{|s| s.to_i}
  pl[xy2id(ai - 1, bi - 1)] = xi + 1
  #p [ai, bi, xi]
end
#print_pl(n, pl)

count = 0

for ai in (0...n)
  nxta = (ai < (n - 1))
  for bi in (0..ai)
    id  = xy2id(ai, bi)
    plid = pl[id]
    if plid > 0
      count += 1
      if plid > 1 && nxta
        plid -= 1
        id0 = xy2id(ai + 1, bi)
        pl[id0] = plid if pl[id0] < plid
        id1 = id0 + 1
        pl[id1] = plid if pl[id1] < plid
      end
    end
  end
end
#print_pl(n, pl)

puts count

Measured memory_bytes: 105876
program main

  implicit none
  integer :: a,b
  integer :: aa, bb
  integer :: i, j, k
  character(9) :: caa, cbb

  read(*,*) a, b
  
  aa = 0 
  do i = 1, a 
    aa = aa+b*10**(i-1)
  end do

  bb = 0 
  do i = 1, b 
    bb = bb+a*10**(i-1)
  end do
  
  
  if( a > b ) then
    print*, aa 
  else 
    print*, bb 
  end if 
    
end program main


Measured memory_bytes: 768
/*
 * じょえチャンネル
 * 高評価・チャンネル登録よろしくおねがいします！
 * https://www.youtube.com/channel/UCRXsI3FL_kvaVL9zoolBfbQ
 */

#include <bits/stdc++.h>

using namespace std;


using int64 = long long;
const int mod = 1e9 + 7;

const int64 infll = (1LL << 58) - 1;
const int inf = (1 << 30) - 1;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;


template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 > &p) {
  os << p.first << " " << p.second;
  return os;
}

template< typename T1, typename T2 >
istream &operator>>(istream &is, pair< T1, T2 > &p) {
  is >> p.first >> p.second;
  return is;
}

template< typename T >
ostream &operator<<(ostream &os, const vector< T > &v) {
  for(int i = 0; i < (int) v.size(); i++) {
    os << v[i] << (i + 1 != v.size() ? " " : "");
  }
  return os;
}

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

template< typename T = int64 >
vector< T > make_v(size_t a) {
  return vector< T >(a);
}

template< typename T, typename... Ts >
auto make_v(size_t a, Ts... ts) {
  return vector< decltype(make_v< T >(ts...)) >(a, make_v< T >(ts...));
}

template< typename T, typename V >
typename enable_if< is_class< T >::value == 0 >::type fill_v(T &t, const V &v) {
  t = v;
}

template< typename T, typename V >
typename enable_if< is_class< T >::value != 0 >::type fill_v(T &t, const V &v) {
  for(auto &e : t) fill_v(e, v);
}

template< typename F >
struct FixPoint : F {
  FixPoint(F &&f) : F(forward< F >(f)) {}

  template< typename... Args >
  decltype(auto) operator()(Args &&... args) const {
    return F::operator()(*this, forward< Args >(args)...);
  }
};

template< typename F >
inline decltype(auto) MFP(F &&f) {
  return FixPoint< F >{forward< F >(f)};
}

int main() {
  int N;
  cin >> N;
  vector< int > X(N);
  cin >> X;
  int64 ret = infll;
  for(int i = 0; i <= 100; i++) {
    int64 add = 0;
    for(int j = 0; j < N; j++) {
      add += (X[j] - i) * (X[j] - i);
    }
    chmin(ret, add);
  }
  cout << ret << endl;
}





Measured memory_bytes: 256