akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#define N 50

void insertionsort_asc(int data[], int start, int end){
    int i,j,tmp;
    for(i = start + 1; i <= end; i++){
        tmp = data[i];
        if(data[i - 1] > tmp){
            j = i;
            do{
                data[j] = data[j - 1];
                j--;
            }while(j > start && data[j - 1] > tmp);
            data[j] = tmp;
        }
    }
}

int main(void){
    int n;
    int v[N];
    int i,base;
    double res = 0.0;
    
    scanf("%d", &n);
    
    for(i = 0; i < n; i++){
        scanf("%d", &v[i]);
    }
    
    insertionsort_asc(v, 0, n-1);
    res = (double)(v[0] + v[1])/2;
    for(i = 2; i < n; i++){
        res += v[i];
        res /= 2;
    }
    printf("%.14f\n", res);
    
    return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
#include <stdlib.h>
#define N 101

typedef struct al { // adjacency list
  int        id;
  struct al* next_p;
} al_s;

typedef enum {
  WHITE,
  GRAY,
  BLACK,
} color_t;

// stack
int stack[N] = {NULL};
int current = 0;

int time_g = 0;

void chkList(al_s**, int);
void visit(color_t*, int, int*, int*, al_s**);
void push(int);
int top();
int pop();

int main(){
  int    n = 0, u = 0, k = 0 ,v = 0;
  al_s* g_p[N] = {0}; // 1-origin
  int d[N] = {0}; // discovery time
  int f[N] = {0}; // finish time
  color_t color[N];
  int i, j;

  scanf("%d", &n);
  for ( i = 0; i < n; i++ ){
    scanf("%d%d", &u ,&k);
    al_s *node_p = g_p[u];
    for( j = 1 ; j <= k ; j++ ){
      scanf("%d" ,&v );
      al_s *aloc_p = (al_s*)malloc(sizeof(al_s));
      if( node_p == NULL ){
	node_p = aloc_p;
	g_p[u] = node_p;
      }else{
        node_p->next_p = aloc_p;
        node_p = node_p->next_p;
      }
      node_p->id = v;
      node_p->next_p = NULL;
    }
  }

  for(i = 0; i<N ; i++ ){
    color[i] = WHITE;
  }
  for( i=1 ; i<= n ; i++){
    if (color[i] == WHITE ){
      visit(color, i, d, f, g_p );
    }
  }

  for( i=1 ; i<= n; i++){
    printf("%d %d %d\n" ,i ,d[i] ,f[i] );
  }

  return 0; // Don't forget return 0  
}

//                color,  r:vertex,  discovery, finish, ,graph
void visit(color_t* clr_p, int r, int* d_p, int* f_p, al_s** g_pp){
  int i, j;
  int u, v;
  al_s* cur_p; // current node pointer
  al_s* nd_p;

  push(r);
  clr_p[r] = GRAY;
  d_p[r] = ++time_g;
  while( top() != NULL ){
    u = top();
    v = next(g_pp[u] ,clr_p);
    if( v != NULL){
      if( clr_p[v] == WHITE ){
	push(v);
	clr_p[v] = GRAY;
	d_p[v] = ++time_g;
      }
    }else{
      pop();
      clr_p[u] = BLACK;
      f_p[u] = ++time_g;
    }
  }
}

int next(al_s* g_p, const color_t* clr_p){
  int i;
  al_s* nd_p = g_p;

  if(nd_p==NULL){ // the u node has no next node.
    return NULL;
  }

  while(1){
    if(clr_p[nd_p->id]==WHITE){
      break;
    }
    nd_p = nd_p->next_p;
    if( nd_p == NULL ){
      return NULL;
    }
  }

  return nd_p->id;
  
}

void push(int r){
  stack[current] = r;
  current++;
}

int top(){
  if(current!=0){
    return stack[current-1];
  }else{
    return NULL;
  }
}

int pop(){
  if( current != 0 ){
    current--;
    return stack[current];
  }else {
    return NULL;
  }
}
void chkList(al_s** g_pp, int n){ // for debug
  int i;

  for( i=1 ; i <= n ; i++){
    al_s* nd_p = g_pp[i];
    printf("%d: g_p[%d] = 0x%x\n" ,__LINE__ ,i ,g_pp[i] );
    while( nd_p != NULL ){
      printf("%d: nd_p         = 0x%x\n" ,__LINE__ ,nd_p );
      printf("%d: nd_p->id     = %d\n"   ,__LINE__ ,nd_p->id);
      printf("%d: nd_p->next_p = 0x%x\n" ,__LINE__ ,nd_p->next_p);
      nd_p = nd_p->next_p;
    }
    printf("\n");
  }

}

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

const long long INF = 1e7 + 1;
const long long MOD = 1000000007;
const long double PI = 3.1415926;

#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); ++i)
#define RFOR(i,r,n) for(ll i = (ll)(n-1); i >= r; --i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()

#define cout cout << setprecision(12)

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using vi = vector<ll>;
using vvi = vector<vi>;
using vp = vector<pair<ll, ll>>;
using vs = vector<string>;
using vc = vector<char>;
using lst = list<ll>;
using pq = priority_queue<ll>;

template < typename T >
inline void dbg(T a) { cout << a << ' ' << endl; }

ll n, m, k, ans = 0, sum = 0, cnt = 0;
string s;
char c;

/*--------------------template--------------------*/

int main() {
    cin >> n;
	m = n % 100; k = n / 100;
	if (m <= k * 5) {
    	dbg(1);
    } else {
    	dbg(0);
    }
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

bool contains_3(int i) {
    return i % 10 == 3 || (i > 0 && contains_3(i / 10));
}

int main() {
  int x;
  cin >> x;
  for (int i = 1; i <= x; ++i) {
    if ((i % 3) == 0 || contains_3(i)) {
      cout << " " << i;
    }
  }
  cout << endl;
  return 0;
}





Measured memory_bytes: 3092
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O0")
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for (ll i = 0; i < (n); ++i)
#define Rep(i,a,n) for (ll i = (a); i < (n); ++i)
const ll mod = 1e9+7;
const ll INF = 1e18;
#define All(a) (a).begin(),(a).end()
#define Pi acos(-1)
using Graph = vector<vector<ll>>;

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << setprecision(15) << fixed;
  chrono::system_clock::time_point start,end;
  start = chrono::system_clock::now();

  ll ans = 1;
  ll n, k;
  cin >> n >> k;
  rep(i,n) {
    if (ans*2 > ans+k) {
      ans += k;
    }
    else ans *= 2;
  }
  cout << ans << '\n';

  end = chrono::system_clock::now();
  auto elapsed = chrono::duration_cast< chrono::milliseconds >(end - start).count();
  cerr << elapsed << "ms" << '\n';
}

Measured memory_bytes: 3656
a,b,c,x = 4.times.map{ gets.to_i }
x /= 50
puts (0 .. [x / 10, a].min).inject(0){|s, i| d = x - 10 * i; s + (0 .. [d / 2, b].min).count{|j| d - 2 * j <= c } }

Measured memory_bytes: 1788
N = int(input())
S = list(input())
R = S.count('R')
G = S.count('G')
B = S.count('B')
ans = R*G*B
for i in range(N):
    for k in range(i+1,N):
        if (k+i)%2 == 1:
            continue
        else:
            j = (k+i)//2
            if S[i] != S[j] and S[j] != S[k] and S[i] != S[k]:
                ans -= 1
print(ans)

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

vector<long long> divisor(long long n) {
  vector<long long> ret;
  for(long long i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

int main(){
  long long n;
  cin >> n;
  vector<long long> div = divisor(n);
  long long min = 9e+12;
  for(int i = 0; i < div.size(); i++){
    long long temp = div[i] + div[div.size() - 1 - i] - 2;
    if(temp < min) min = temp;
  }
  cout << min;
}

Measured memory_bytes: 384
N = int(input())
XL = [tuple(map(int, input().split())) for i in range(N)]

XL.sort(key=lambda x: x[0] + x[1])
ans = 0
prev = - 10**9
for x, l in XL:
    if prev <= x - l:
        ans += 1
        prev = x + l

print(ans)


Measured memory_bytes: 26980
def f_l1d(x0, y0, x1, y1):
    return abs(x0-x1)+abs(y0-y1)

n = int(input())
t0, x0, y0 = 0, 0, 0
r = 'Yes'
for i in range(n):
    t1, x1, y1 = map(int, input().split())
    l1d = f_l1d(x0, y0, x1, y1)
    t = t1-t0
    if l1d<=t and (l1d-t)%2==0:
        t0, x0, y0 = t1, x1, y1
    else:
        r = 'No'
print(r)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main()
{
    char a[2][3];
    for(int i=0;i<2;i++)
    {
        for(int j=0;j<3;j++)
        {
            cin>>a[i][j];
        }
    }
    vector<char>v;
    vector<char>v1;
    for(int i=0;i<3;i++)
    {
        v.push_back(a[0][i]);
        
    }
    for(int i=0;i<3;i++)
    {
        v1.push_back(a[1][i]);
        
    }
    reverse(v.begin(),v.end());
    int flag=0;
    for(int i=0;i<v.size();i++)
    {
        if(v[i]!=v1[i])
        {
            cout<<"NO";
            flag=1;
            break;
        }
    }
    if(flag==0)
    {
        cout<<"YES";
    }
    
}

Measured memory_bytes: 256
#include<stdio.h>
int MAX(int a,int b){return a<b?b:a;}
int main(){
  int n,i,a,m[2][2]={};
  int b[2][100010]={};
  int d[2][2]={};
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&a);
    b[i%2][a]++;
  }
  for(i=0;i<100005;i++){
    for(a=0;a<2;a++){
      if(m[1][a]<b[a][i]){
	d[1][a]=i;
	m[1][a]=b[a][i];
      }
      if(m[0][a]<b[a][i]){
	d[1][a]=d[0][a];
	m[1][a]=m[0][a];
	d[0][a]=i;
	m[0][a]=b[a][i];
      }
    }
  }
  //printf("%d %d %d %d\n",d[0][0],d[0][1],d[1][0],d[1][1]);
  if(d[0][0]==d[0][1])n-=MAX(m[0][0]+m[1][1],m[0][1]+m[1][0]);
  else n-=m[0][0]+m[0][1];
    //printf("%d %d\n",m[0],m[1]);
  printf("%d\n",n);
  return 0;
}


Measured memory_bytes: 896
import java.io.BufferedReader;
import java.io.*;
import java.util.*;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Collections;
import java.util.Arrays;

public class Main {
	public static void main(final String[] args){
    
    final Scanner sc = new Scanner(System.in);
    //final List<Integer> list = new ArrayList<>();
    //final List<Long> list2 = new ArrayList<>();

    long w = sc.nextLong();
    long h = sc.nextLong();
    int x = sc.nextInt();
    int y = sc.nextInt();

    long ans = w * h;
    System.out.print((double)ans / 2);
    if(w == x * 2 && h == y * 2){
        System.out.print(" " + 1);
    }else{
        System.out.print(" " + 0);
    }



    



   
    





}
}

Measured memory_bytes: 35872
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()

    var total = 0.0
    val btc = 380000.0
    for (i in 0 until n) {
        val suji: Double = sc.nextDouble()
        val unit: String = sc.next()

        if (unit == "JPY") {
            total += suji
        } else {
            total += (suji * btc)
        }
    }
    print(total)
}

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

#define LL long long
#define MAXN 10000

int main(){
	int n;
	int k;
	cin>>n;
	cin>>k;
	int sum = 0;
	for(int  i=0;i<n;i++){
		int x;
		cin>>x;
		if(k-x<x){
			sum+=2*(k-x);
		}else{
			sum+=2*x;
		}
	}
	cout<<sum;
	return 0;
}

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

using namespace std;

using LL = long long;
using vi = vector<int>;
using pii = pair<int,int>;
#define ST first
#define ND second
#define PB push_back

const int nax = 301;
const int mod = 998244353;
int n,a[nax];
int dp[nax][nax*nax];
int ans,sum,sub;

int main() {
	scanf("%d",&n);
	for(int i=1; i<=n;i++) {
		scanf("%d",&a[i]);
		sum+=a[i];
	}
	ans=1;
	for(int i=1; i<n;i++) {
		ans=((LL)ans*3)%mod;
	}
	dp[0][0] = 1;
	for(int i=1; i<=n;i++) {
		for(int s=0; s<=sum; s++) {
			dp[i][s] = (2*dp[i-1][s])%mod;
			if(s-a[i]>=0) {
				dp[i][s]= (dp[i][s]+dp[i-1][s-a[i]])%mod;
			}
		}
	}
	for(int i=1; i<=sum;i++) {
		if(i>=(sum+1)/2) {
			sub=(sub+dp[n][i])%mod;
		}
	}
	dp[0][0] = 1;
	for(int i=1; i<=n;i++) {
		for(int s=0; s<=sum;s++) {
			dp[i][s] = dp[i-1][s];
			if(s-a[i]>=0) {
				dp[i][s]= (dp[i][s]+dp[i-1][s-a[i]])%mod;
			}
		}
	}
	if(sum%2==0) {
		sub=(sub-dp[n][sum/2]+mod)%mod;
	}
	int res = (((ans-sub)%mod)+mod)%mod;
	res = ((LL)res*3)%mod;
	printf("%d",res);
}


Measured memory_bytes: 106368
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<unordered_map>
#include<array>
#include<map>
#include<iomanip>
using namespace std;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
#define dme cout<<-1<<endl;return 0
//ios::sync_with_stdio(false);
//<< setprecision(5)
const int mod=1e9+7;
const int big=1e8+100;
const long double pai=3.141592653589793238462643383279502884197;
const long double ena=2.71828182845904523536;
const long double eps=1e-7;
template <class T,class U>void mineq(T& a,U b){if(a>b){a=b;}}
template <class T,class U>void maxeq(T& a,U b){if(a<b){a=b;}}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){return a/gcd(a,b)*b;}
int main(void){
	static int dp[1<<26];
	int i,j;
	for(i=1;i<(1<<26);i++){dp[i]=big;}
	dp[0]=0;
	string str;cin>>str;
	int gen=0;
	for(i=0;i<str.size();i++){
		int mo=str[i]-'a';
		gen^=(1<<mo);
		int pot=dp[gen]-1;
		for(j=0;j<26;j++){
			mineq(pot,dp[gen^(1<<j)]);
		}
		dp[gen]=pot+1;
	}
	cout<<max(1,dp[gen])<<endl;
	return 0;
}

Measured memory_bytes: 262784
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		
		while(true){
			int n = stdIn.nextInt();
			int p = stdIn.nextInt();
			if((n|p)==0){
				return;
			}
			int[] a = new int[n];
			int i = 0;
			while(true){
				if(p>0){
					p--;
					a[i]++;
					if(p==0){
						boolean flag = true;
						for(int j=0;j<n;j++){
							if(i!=j&&a[j]>0){
								flag = false;
								break;
							}
						}
						if(flag){
							break;
						}
					}
				}
				else{
					p = a[i];
					a[i] = 0;
				}
				i++;
				if(i==n){
					i = 0;
				}
			}
			System.out.println(i);
		}
	}
}

Measured memory_bytes: 12000
#include <iostream>
#include <fstream>
#include <string> 
#include <cmath>  
#include <cstdlib>
#include <ctime>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <functional>

using namespace std;
using ll = long long;

#define FOR(i, m, n) for(int i = (m);i < (n);i++)
#define REP(i,n) for(int i = 0; i < int(n); i++)
#define VI vector<int>
#define VVI vector<vector<int>>
#define VVVI vector<vector<vector<int>>>
#define VL vector<ll>
#define VVL vector<vector<ll>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define PAIR pair<int,int>
#define MP make_pair
#define VP vector<pair<int,int>>
#define VS vector<string>
#define QUE queue<int>
#define DEQ deque<int>
#define PQUE priority_queue<int> //5,5,4,3,3,2,...
#define REPQUE priority_queue<int, vector<int>, greater<int>> //1,1,2,3,4,4,5,...
#define SUM(obj) accumulate((obj).begin(), (obj).end(), 0)
#define SORT(obj) sort((obj).begin(), (obj).end()) // 1,2,3,4,5...
#define RESORT(obj) sort((obj).begin(), (obj).end(), greater<int>()) // 5,4,3,2,1...
#define UB(obj,n) upper_bound((obj).begin(), (obj).end(), n) //itr > n
#define LB(obj,n) lower_bound((obj).begin(), (obj).end(), n) //itr>= n

const ll MOD = (ll)1e9 + 7;

int main() {
	int A, B, C;
	cin >> A >> B >> C;
	bool flag = false;
	if ((A <= C)&&(C <= B))flag = true;
	string S = (flag) ? "Yes" : "No";
	cout << S << endl;
	return 0;
}


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

#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pb push_back
#define fi first
#define se second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mii map<int,int>
#define mll map<ll,ll>
#define all(x) (x).begin(),(x).end()
#define S(x) (int)(x).size()
#define L(x) (int)(x).length()
#define ld long double
#define mem(x,y) memset(x,y,sizeof x)

#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<int , null_type , less<int> , rb_tree_tag , tree_order_statistics_node_update> ordered_set;

const int mod = 1e9+7;
const ll infl = 0x3f3f3f3f3f3f3f3fLL;
const int infi = 0x3f3f3f3f;
/*
 * Be careful of overflow
 * Array bounds
 * Assert a!=0 when performing x/a
 * Check base condition for recursion
 * Iterator -> O(1), Element -> O(log n) while using erase
 * 1LL<<x when x>32
 * Be sure of what you are going to code (exception dp)
 * Don't try fancy tricks during contest
 * You can always make a bad round to a good enough round
 */ 

void solve()
{
	string s;
	cin>>s;
	if(s=="SSS") cout<<0<<'\n';
	else if(s=="SRR" || s=="RRS") cout<<2<<'\n';
	else if(s=="RRR") cout<<3<<'\n';
	else cout<<1<<'\n';
}

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


Measured memory_bytes: 3592
#include<stdio.h>

int main(void){
  char S[3];
  int aflag=0,bflag=0;
  int i;
  scanf("%s",S);
  for(i=0;i<3;i++){
    if(S[i]=='A') aflag++;
    else bflag++;
  }
  if(aflag>0&&bflag>0) printf("Yes\n");
  else printf("No\n");
}


Measured memory_bytes: 128
//============================================================================
// Name        : receipt.cpp
// Author      : 
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
using namespace std;

int main() {
	while (1) {
		int n, price[9], sum = 0;
		cin >> n;
		if (n == 0)
			break;
		for (int i = 0; i < 9; i++) {
			cin >> price[i];
			sum = sum + price[i];
		}
		cout << n - sum << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
//                               //
    // author : samars_diary //
    // 16-09-2020 │ 18:15:57 //
//                               //

#include <iostream>
using namespace std;

void solve(){
    long long int a,b,c,d;
    cin>>a>>b>>c>>d;
    long long int p = max(max(a,b)*max(c,d),min(a,b)*min(c,d));
    long long int q= max(min(a,b)*max(c,d),max(a,b)*min(c,d));
    cout<<max(p,q);
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);

    // #ifndef ONLINE_JUDGE
    //     freopen("input.txt", "r", stdin);
    //     freopen("output.txt", "w", stdout);
    // #endif

    int t = 1;
    while(t--){
        solve();
    }

    return 0;
}

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

#define pb emplace_back
#define mk make_pair
#define sc second
#define fr first

using namespace std;

typedef int ll;

const int N = (int) 1e5 + 5;
const int mod = (int) 1e9 + 7;

int n,k,a[5001],dp[5001];

bool check(int x){
        memset(dp,0,sizeof(dp));
        dp[0] = 1;

        for(int i = 1; i <= n; i ++){
                if(i != x){
                        for(int j = k - a[i]; j >= 0; j --)
                                dp[j + a[i]] |= dp[j];
                }
        }
        for(int i = max(k - a[x],0); i < k; i ++)
                if(dp[i])
                        return true;
        return false;
}
int main () {
        cin >> n >> k;

        for(int i = 1; i <= n; i ++)
                cin >> a[i];

        sort(a + 1,a + n + 1);

        int l = 0,r = n + 1;

        while(r - l > 1){
                int m = (r + l) / 2;
                if(check(m))
                        r = m;
                else
                        l = m;
        }
        cout << l << endl;
        return 0;
}


Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
s = 1
over = False
zero = False

for i in range(N):
    if A[i] == 0:
        zero = True
        break

if zero:
    print(0)
else:
    for i in range(N):
        s *= A[i]
        if s > 10**18:
            over = True
            break
    if over :
        print('-1')
    else:
        print(s)
        

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

using namespace std;

typedef long long ll;

#define fo(i,a,b) for(ll i=(a);i<=(b);++i)
#define fd(i,b,a) for(ll i=(b);i>=(a);--i)


int main(void){
    ll a,b,c;cin>>a>>b>>c;
    ll res=0;
    
    fo(i,1,b)
    {
        res=(res+a)%b;
        if(res==c)
        {
            cout<<"YES";
            return 0;
        }
    }
    cout<<"NO";
}


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

using namespace std;

#define x first
#define y second
#define mp make_pair
#define pb push_back

typedef long long ll;

const ll MOD = 1e9+7;
const ll INF = 1e9+5;

int a[100005];
char ch[5];

int main() {
	int n, m;
	scanf("%d%d", &n, &m);
	int cnt = 0;
	int ac = 0;
	for (int i=0 ; i<m ; i++) {
		int x;
		scanf("%d %s", &x, ch);
		string s = ch;
		if (s == "AC") {
			if (a[x] != -1) {
				cnt += a[x];
				a[x] = -1;
				ac++;
			}
		} else {
			if (a[x] != -1) {
				a[x]++;
			}
		}
	}
	printf("%d %d\n", ac, cnt);
	return 0;
}

Measured memory_bytes: 640
#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;
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define REP(i,x,y) for(ll (i)=(x);(i)<(y);(i)++)
#define RREP(i,x,y) for(ll (i)=(x);(i)>=(y);(i)--)
#define REPIT(it,A) for(typeof(A.begin()) it = (A.begin()); it!=A.end();it++)
#define sqr(x) ((x)*(x))
#define mp(x,y) make_pair((x),(y))
#define mt(x,y,z) mp(x,mp(y,z))
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);
#define fst first
#define snd second
#define itm1 fst
#define itm2 snd.fst
#define itm3 snd.snd
#define sz(v) ((ll)v.size())
#define oo 200000000000
//#define EPS 1e-9
//#define pi acos(-1)
//#define MOD 999999999999999989
#define MAXN 999940960546LL
#define cot 20
//#define N 300005
//#define min -9042414321442
#define INF 1065435634
#define N1 900
typedef long double ld;
typedef  long long ll;
typedef short int si;
//typedef ll ll;
typedef pair<ll,ld> ii;
typedef vector<ii> vii;
typedef pair<ll,ii> tri;
typedef vector<ll> vi;

#define N 500001   
#define M 20
//#define cap 1000000000
//#define bas 100003

inline ll ma(ll a, ll b){ return ((a-b>0)? a:b);}
inline ll mi(ll a, ll b){return ((a-b>0)? b:a);}
 
#define TRACE
#ifdef TRACE
#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...);
}
#else
#define trace(...)
#endif

struct Dij{
  vii adj[N];
  ll dis[N],p[N];
  ll n;
  bool vis[N]={0};
  inline void go(ll ini,ll k){
    REP(i,0,n) dis[i]=MAXN;
    class priori{public: bool operator()(ii &p1, ii &p2) {return p1.snd>p2.snd;}};
    priority_queue<ii, vii, priori> pq;
    pq.push({ini,dis[ini]=1});
    while(!pq.empty()){
      ii cur=pq.top(); pq.pop();
      ll vi=cur.fst, w=cur.snd;
      ll t1=(vi*10)%k, t2=(vi+1)%k;
      if(dis[t1]>w) dis[t1]=w, pq.push({t1,w});
      if(dis[t2]-1>w) dis[t2]=w+1, pq.push({t2,w+1});
    }
  }
};

int main(){
  fastio;
  ll n; cin>>n;
  Dij dij; dij.n=n;
  dij.go(1,n);
  cout<<dij.dis[0]<<endl;
  return 0;
}

Measured memory_bytes: 18420
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using V = vector<int>;
using Vll = vector<ll>;
using Vld = vector<ld>;
using Vbo = vector<bool>;
using VV = vector<V>;
using VVll = vector<Vll>;
using VVld = vector<Vld>;
using VVbo = vector<Vbo>;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
using Pld = pair<ld, ld>;
#define rep2(i, m, n) for(ll i=int(m); i<int(n); ++i)
#define drep2(i, m, n) for(ll i=int(m)-1; i>=int(n); --i)
#define rep(i, n) rep2(i, 0, n)
#define drep(i, n) drep2(i, n, 0)
#define all(a) a.begin(), a.end()
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
template<typename T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
template<typename T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.first >> p.second; return is; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
template<typename T> istream &operator>>(istream &is, vector<T> &v) { for (auto &e : v) is >> e; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &v) { for (auto &e : v) os << e << " "; return os; }
template<typename T> inline int count_between(vector<T> &a, T l, T r) { return lower_bound(all(a), r) - lower_bound(all(a), l); } // [l, r)
inline int Log2(ll x) { int k; for (k = 0; x > 0; ++k) x >>= 1; return k; } // number of binary digits
const int INF  = 1<<30;
const ll INFll = 1ll<<62;
const ld EPS   = 1e-10;
const int MOD  = int(1e9)+7;


int main() {
  ll n, m; cin >> n >> m;
  string s; cin >> s;

  VV G(n);
  rep(i, m) {
    int u, v; cin >> u >> v;
    --u; --v;
    G[u].push_back(v);
    G[v].push_back(u);
  }

  VV deg(n, V(2));
  rep(u, n) for (auto v : G[u]) {
    int k = s[v] - 'A';
    ++deg[u][k];
  }

  Vbo rmv(n, false);
  queue<int> que;
  rep(u, n) if (deg[u][0] == 0 || deg[u][1] == 0) que.push(u);

  while (!que.empty()) {
    int u = que.front(); que.pop();
    int k = s[u] - 'A';
    rmv[u] = true;
    for (auto v : G[u]) {
      if (rmv[v]) continue;
      --deg[v][k];
      if (deg[v][k] == 0) que.push(v);
    }
  }

  int cnt = 0;
  rep(u, n) if (rmv[u]) ++cnt;
  if (cnt < n) cout << "Yes" << "\n";
  else cout << "No" << "\n";
  return 0;
}


Measured memory_bytes: 21072
#include<bits/stdc++.h>
#include<iostream>
#include<string>
#include<cmath>
#include<cstdio>
#include<cctype>
#include<cstring>
#include<iomanip>
#include<cstdlib>
#include<ctime>
#include<set>
#include<map>
#include<utility>
#include<queue>
#include<vector>
#include<stack>
#include<sstream>
#include<algorithm>
#define forn(i,a,b)for(int i=(a),_b=(b);i<=_b;i++)
#define fore(i,b,a)for(int i=(b),_a=(a);i>=_a;i--)
#define rep(i,n)for(int i=0,_n=n;i<n;i++)
#define ll long long
#define pii pair<int,int>
#define vi vector<int>
#define vpii vector<pii>
#define m_p make_pair
#define re return
#define pb push_back
#define si set<int>
#define ld long double
#define X first
#define Y second
#define st string
#define ull unsigned long long
#define mod 1000000007
#define INF 1000000007
#define x1 XZVJDFADSPFOE
#define y1 GASDIJSLDAEJF
#define x2 DFDAJKVOHKWIW
#define y2 PSFSAODSXVNMQ
#define LLINF 0x3f3f3f3f3f
using namespace std;
inline void read(int &x)
{
	short negative=1;
    x=0;
    char c=getchar();
    while(c<'0' || c>'9')
    {
		if(c=='-')
			negative=-1;
		c=getchar();
	}
    while(c>='0' && c<='9')
        x=(x<<3)+(x<<1)+(c^48),c=getchar();
    x*=negative;
}
ll quickpower(ll n,ll k){
	ll ans=1;
	while(k){
		if(k%2){
			ans*=n;
			ans%=mod;
		}
		n*=n;
		n%=mod;
		k/=2;
	}
	return ans;
}
string int_to_string(int n)
{
	string s="";
	while(n)
	{
		int now=n%10;
		s+=now+'0';
		n/=10;
	}
	reverse(s.begin(),s.end());
	return s;
}
int string_to_int(string s)
{
	int n=0;
	rep(i,s.size())
	{
		n*=10;
		n+=s[i]-'0';
	}
	return n;
}
int main()
{
	ios::sync_with_stdio(0);
	ll n;
	cin>>n;
	cout<<n/500*1000+(n%500)/5*5<<endl;
	return 0;
}



Measured memory_bytes: 256
#include<iostream>
using namespace std;
const int N=2e5+1,D=1e9+7;
int n,a[N],f[N],s[N];
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
		cin>>a[i];
	f[0]=1;
	for(int i=1;i<=n;i++)
	{
		f[i]=f[i-1];
		if(a[i]!=a[i-1])
			(f[i]+=s[a[i]])%=D,(s[a[i]]+=f[i-1])%=D;
	}
	cout<<f[n];
	return 0;
}

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

using namespace std;

template <class NODE, class LAZY, NODE UNITY_NODE, LAZY UNITY_LAZY>
struct LazySegTree {
// edit start
	NODE merge(NODE a, NODE b) {
		return a + b;
	}
	LAZY add(LAZY a, LAZY b) {
		return a + b;
	}
	NODE reflect(NODE a, LAZY b) {
		return a + b;
	}
	LAZY propagate(LAZY a, int len) {
//		return a;
		return a * len;
	}
// edit end
	int n;
	vector<NODE> node;
	vector<LAZY> lazy;
	LazySegTree(int n_) {
		init(n_);
	}
	inline void eval(int len, int k) {
		if (lazy[k] == UNITY_LAZY) return;
		if (k*2 + 1 < n*2 - 1) {
			lazy[k*2+1] = add(lazy[k*2+1], lazy[k]);
			lazy[k*2+2] = add(lazy[k*2+2], lazy[k]);
		}
		node[k] = reflect(node[k], propagate(lazy[k], len));
		lazy[k] = UNITY_LAZY;
	}
	void init(int n_) {
		n = 1;
		while (n < n_) n *= 2;
		node.clear();
		lazy.clear();
		node.assign(2*n-1, UNITY_NODE);
		lazy.assign(2*n-1, UNITY_LAZY);
	}
	void build(vector<NODE>& v, int n_ = -1) {
		if (n_ == -1) n_ = v.size();
		for (int i = 0; i < n_; i++) node[i+n-1] = v[i];
		for (int i = n-2; i >= 0; i--) node[i] = merge(node[i*2+1], node[i*2+2]);
	}
	NODE set(int a, int b, LAZY x, int k, int l, int r) {
		eval(r-l, k);
		if (b <= l || r <= a) return node[k];
		if (a <= l && r <= b) {
			lazy[k] = add(lazy[k], x);
			return reflect(node[k], propagate(lazy[k], r-l));
		}
		return node[k] = merge(set(a, b, x, k*2+1, l, (l+r)/2),
		                       set(a, b, x, k*2+2, (l+r)/2, r));
	}
	NODE set(int a, int b, LAZY x) {
		return set(a, b, x, 0, 0, n);
	}
	NODE get(int a, int b, int k, int l, int r) {
		eval(r-l, k);
		if (b <= l || r <= a) return UNITY_NODE;
		if (a <= l && r <= b) return node[k];
		NODE vl = get(a, b, k*2+1, l, (l+r)/2);
		NODE vr = get(a, b, k*2+2, (l+r)/2, r);
		return merge(vl, vr);
	}
	NODE get(int a, int b) {
		return get(a, b, 0, 0, n);
	}
/* Debug
	void print() {
		int x = 0;
		int nx = 2;
		cerr << "NODE" << endl;
		for (int i = 0; i < 2 * n - 1; i++) {
			cerr << node[i] << " ";
			if (i == x) {
				x += nx;
				nx *= 2;
				cerr << endl;
			}
		}
		x = 0;
		nx = 2;
		cerr << endl << endl;;
		cerr << "LAZY" << endl;
		for (int i = 0; i < 2 * n - 1; i++) {
			cout << lazy[i] << " ";
			if (i == x) {
				x += nx;
				nx *= 2;
				cerr << endl;
			}
		}
		cerr << endl << endl;
	}
*/
};

int main()
{
	int n, q;
	cin >> n >> q;
	LazySegTree<long long, long long, 0, 0> L(n);
	while (q--) {
		int a, s, t;
		cin >> a >> s >> t;
		if (a == 0) {
			int x;
			cin >> x;
			L.set(s-1, t, x);
		} else {
			cout << L.get(s-1, t) << endl;
		}
	}
}



Measured memory_bytes: 6996
n, m = map(int, input().split())
piyo = [list(map(int,input().split())) for i in range(m)]
k = 1
for i in range(m):
    if k < piyo[i][0]:
        k = piyo[i][0]
l = n
for i in range(m):
    if l > piyo[i][1]:
        l = piyo[i][1]
s = l - k + 1
print(max(0, s))

Measured memory_bytes: 27336
package main

import (
	"fmt"
)

func main() {
	var n, k int
	fmt.Scan(&n, &k)

	ans := 0.0
	for i := 1; i <= n; i++ {
		score := i
		cal := 1.0 / float64(n)
		for score < k {
			score *= 2
			cal *= 0.5
		}
		ans += cal
	}
	fmt.Print(ans)
}


Measured memory_bytes: 512
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {

        Scanner sc = new Scanner(System.in);
        
        int A1 = sc.nextInt();
        int A2 = sc.nextInt();
        int A3 = sc.nextInt();
        
        int max = Math.max(A1, Math.max(A2, A3) );
        int min = Math.min(A1, Math.min(A2, A3) );
        System.out.println(max - min);
    }
}


Measured memory_bytes: 21972
#include<iostream>
using namespace std;
int main()
{
int x,y,z,a=0;
cin >> x >> y >> z;
if(a<=x)
a=x;
if(a<=y)
a=y;
if(a<=z)
a=z;
cout << x+y+z-a << endl;
return 0;
}


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

int main(){
  int n;  cin >> n;
  vector<int> a(n+3);
  int ans = 0;
  for(int i=1; i<=n; i++){
    cin >> a[i];
    if(i%2 && a[i]%2)
      ans++;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3620
#include<iostream>
#include<cstdio>
using std::swap;

int selectionSort(int A[], int N){
  int sw = 0;
  for (size_t i = 0; i < N-1; i++) {
    int minj = i;
    for (size_t j = i+1; j < N; j++) {
      if (A[minj] > A[j]) {
        minj = j;
      }
    }
    swap(A[i],A[minj]);
    if (minj != i) {
      sw++;
    }
  }
  return sw;
}

int main() {
  int n; // a number of scores
  scanf("%d", &n);

  int arr[100];

  for (size_t i = 0; i < n; i++) {
    scanf("%d", &arr[i]);
  }

  int ans = selectionSort(arr, n);
  for (size_t k = 0; k < n; k++) {
      printf("%d%c",arr[k],(k==n-1)? '\n':' ');
  }
  printf("%d\n", ans);
  return 0;
}

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

const int INF = pow(2, 31) - 1;
#define ll long long
#define DEBUG(x) cout << "DEBUG>" << #x << ":" << x << endl;
#define REP(i,n) for(ll i=0;i<(n);i++)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}

int main() {
  ll N, M;
  cin >> N >> M;
  if(N == 1 && M == 1) {
    cout << 1 << endl;
    return 0;
  }
  if(N >= 2 && M >= 2) {
    ll ans = (N - 2) * (M - 2);
    cout << ans << endl;
  } else {
    ll ans = N * M - 2;
    cout << ans << endl;
  }
  return 0;
}


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

int main(void)
{
  int counter, n, m;
  char a[256], b[256], d[256];
  scanf("%s %s" ,a, b);
  scanf("%d %d", &n, &m);
  scanf("%s", d);
  
  if (strcmp(a, d) == 0) {
    n--;
  } else if (strcmp(b,d) == 0) {
    m--;
  }
  printf("%d %d", n, m);
}




Measured memory_bytes: 128
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

	int N= sc.nextInt();
	int M= sc.nextInt();
	int X= sc.nextInt();
	int a[]=new int[M];
    int cnt=0;
	for(int i=0;i<M;i++){
		a[i]=sc.nextInt();
	        if(a[i]<X){
	            cnt=cnt+1;
	        }
	    
	}

    

	System.out.println(Math.min(cnt,M-cnt));


	}

}


Measured memory_bytes: 23636
#define _USE_MATH_DEFINES
#define INF 10000000
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>

using namespace std;

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

static const double eps = 1e-8;

int path[101][101];

int main(){
	string str;
	int n,m;
	while(~scanf("%d %d",&n,&m)){
		if(n==m && m==0) continue;
		
		int* mincost = new int[n];
		bool* used = new bool[n];

		fill((bool*)used,(bool*)used + n,false);
		fill((int*)mincost,(int*)mincost+n,INF);
		fill((int*)path,(int*)path+101*101,INF);

		for(int i=0;i<m;i++){
			int a,b,cost;
			scanf("%d %d %d",&a,&b,&cost);
			path[a][b] = min(cost,path[a][b]);
			path[b][a] = min(cost,path[b][a]);
		}

		int res=0;
		mincost[0] = 0;

		while(1){
			int v=-1;
			for(int u=0;u<n;u++){
				if(!used[u] && (v==-1 || mincost[u] < mincost[v])){
					v = u;
				}
			}

			if(v==-1) break;
			used[v] = true;		

			res+=mincost[v];
			
			for(int u=0;u<n;u++){
				mincost[u] = min(mincost[u],path[v][u]);
			}
			
		}

		printf("%d\n",res);

		delete[] mincost;
		delete[] used;
	}
}

Measured memory_bytes: 0
#include<cstdio>
#include<algorithm>
#include<map>
#include<set>
#include<vector>
#include<string>
#include<iostream>
#include<sstream>

using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define reps(i,n) for(int i=1;i<=n;i++)

int main(){
	while(1){
		int n;
		string s;
		cin>>n;
		if(n==0)break;
		cin>>s;
		
		string s2;
		
		
		rep(p,n){
			s+="...";
			s2 = "";
			
			char ns = s[0];
			int cont=1;
			
			reps(i,s.size()+2){
				if(ns==s[i]){
					cont++;
				}else{
					stringstream ss;
					ss<<cont<<ns;
					s2+=ss.str();
					
					ns = s[i];
					cont=1;
					
					if(ns=='.')break;
				}
			}
			//printf("%s %s\n",s.c_str(), s2.c_str());
			s = s2;
		}
		
		cout<<s<<endl;
	}
	
}

Measured memory_bytes: 1012
#include <iostream>
#include <algorithm>
#include <math.h>
#define rep(i,o,u) for(int i = o;i <= u; i++)
using namespace std;
struct node{
	char name;
	int key;
};
int Partition(node a[],int p,int r){
	int i = p-1;
	for(int j = p;j <= r-1; j++){
		if(a[j].key <= a[r].key){
			i++;swap(a[i],a[j]);
		}
	}
	swap(a[i+1],a[r]);
	return i+1;
}
void Quicksort(node a[],int p,int r){
	if(p < r){
		int q = Partition(a,p,r);
		Quicksort(a,p,q-1);
		Quicksort(a,q+1,r);
	}
}
node L[100000],R[100000];
void merge(node a[],int left,int mid,int right){
	int n1 = mid - left;
	int n2 = right - mid;
	rep(i,0,n1-1) L[i] = a[left+i];
	rep(i,0,n2-1) R[i] = a[mid+i];
	L[n1].key = R[n2].key = 2000000000;
	int i = 0,j = 0;
	rep(k,left,right-1){
		if(L[i].key <= R[j].key){
			a[k] = L[i++];
		}else{
			a[k] = R[j++];
		}
	}
}
void mergeSort(node a[],int left,int right){
	if(left + 1 < right){
		int mid = (left + right)/2;
		mergeSort(a,left,mid);
		mergeSort(a,mid,right);
		merge(a,left,mid,right);
	}
}
int main(){
	int n;
	struct node a[100001],b[100001];
	cin >> n;
	rep(i,0,n-1){ cin >> a[i].name >> a[i].key; b[i] = a[i]; }
	Quicksort(a,0,n-1);
	mergeSort(b,0,n);
	int i;
	for(i = 0;i <= n-1; i++){if(a[i].name != b[i].name) break;}
	if(i != n) cout << "Not stable" << endl;
	else cout << "Stable" << endl;
	rep(i,0,n-1) cout << a[i].name << " " << a[i].key << endl;
	return 0;
}

Measured memory_bytes: 5440
#include<stdio.h>

int main(void)
{
  int i=0,j=0;
  char str[100001],ans[50001];
  scanf("%s",str);
  while(str[i] != '\0')
    {
      if(i % 2 == 0)
	{
	  ans[j] = str[i];
	  j++;
	}
      i++;
    }
  ans[j] = '\0';
  printf("%s\n",ans);
  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ll long long
#define lld long double
#define ALL(x) x.begin(), x.end()
using namespace std;

const int IINF = 1 << 30;
const ll INF = 1ll << 60;
const ll MOD = 1e9 + 7;

int main(int argc, char const *argv[])
{
    int n;
    cin >> n;
    int c[2][100];
    rep(i, n) cin >> c[0][i];
    rep(i, n) cin >> c[1][i];
    int sum[n + 1];
    sum[n] = 0;
    for (int i = n - 1; i >= 0; i--)
    {
        sum[i] = sum[i + 1] + c[1][i];
    }
    int cur = 0;
    int ans = -1;
    rep(i, n)
    {
        cur += c[0][i];
        ans = max(ans, cur + sum[i]);
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define vi vector<int>
#define vvi vector< vector <int> > 
#define vb vector<bool>
#define si set<int>
#define mii map<int, int>
#define mci map<char, int>
#define md 1000000007
#define pb push_back
#define eb emplace_back
#define f(i,a,b) for(int i=(int)a;i<=(int)b;i++)
#define r(i,a,b) for(int i=(int)a;i>=(int)b;i--)
#define qw1(x) cerr<<#x<<": "<<x<<" "<<endl
#define qw2(x, y) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define qw3(x, y, z) cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define qw4(a, b, c, d) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl

void sieve(int n, vb &prime)
{
    prime[0]=false;     prime[1]=false;
    for(int i=2;i*i<=n;i++){
         if(prime[i]==true){
            for(int j=i*i;j<=n;j+=i)    prime[j]=false;
             }
    }
}
int32_t main ()
{
  //ios_base::sync_with_stdio (false); cin.tie (NULL);  cout.tie (NULL);
   
   int n,k; cin>>n>>k;
   vi v(n); f(i,0,n-1) cin>>v[i];
   sort(v.begin(),v.end());
   int cnt=0;
   f(i,0,n-k-1) cnt+=v[i];
   cout<<cnt;
   
 
}






Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {

	@SuppressWarnings("resource")
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int[][] f = new int[n][10];
		int[][] p = new int[n][11];

		for (int i = 0; i < n; i++) {
			for (int j = 0; j < 10; j++) {
				f[i][j] = scanner.nextInt();
			}
		}

		for (int i = 0; i < n; i++) {
			for (int j = 0; j < 11; j++) {
				p[i][j] = scanner.nextInt();
			}
		}

		long max = -1000000000;
		long tmp = 0;
		for (int i = 1; i < Math.pow(2, 10); i++) {
			for (int k = 0; k < n; k++) {
				int count = 0;
				for (int j = 0; j < 10; j++) {
					if ((i >> j & 1) == 1 && f[k][j] == 1)
						count++;
				}
				tmp += p[k][count];
			}
			max = Math.max(max, tmp);
			tmp = 0;
		}

		System.out.println(max);
	}
}

Measured memory_bytes: 28004
#define FOR(i,j,n) for (int i=(j);i<(n);i++)
#define REP(i,n) for (int i=0;i<(n);i++)
#define REPN(i,n) for (int i=(n);i>=0;i--)
#define I(n) scanf("%d", &(n))
#define LL(n) scanf("%lld", &(n))
#define pb(n) push_back((n))
#define mp(i,j) make_pair((i),(j))
#include <bits/stdc++.h>
using namespace std;

//------------------------------typedef集
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
typedef vector<vi> vvi;
typedef vector<vpi> vvpi;
typedef vector<vvi> vvvi;

int n,k,tmp;
vi d;

bool isvalid(int h){
    while(h){
        if (find(d.begin(),d.end(),h%10) != d.end()) return false;
        h /= 10;
    }
    return true;
}

int main(){
    I(n); I(k);
    REP(i,k){
        I(tmp); d.pb(tmp);
    }

    while(1){
        if (isvalid(n)){
            cout << n << endl;
            return 0;
        }
        n++;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int a[2100];
int main(){
	int n;
	while(cin >> n){
		int x;
		for(int i = 1; i <= n; i++)
			scanf("%d",&a[i]);
		sort(a+1,a+n+1);
		int ans = 0;
		for(int i = 1; i <= n - 2; i++)
			for(int j = i + 1; j <= n - 1; j++){
				for(int k = j + 1; k <= n; k++){
					if((a[k] >= a[i] + a[j]) || (a[j] >= a[k] + a[j]) || (a[i] >= a[i] + a[k]))	break;
					ans++;
				}
			}
		cout << ans << endl;
	}
	
	return 0;
}

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

long long minbei(long long a, long long b)
{
	if (b == 0)
	{
		return a;
	}
	else
	{
		return minbei(b, a%b);
	}
}

int main()
{
	long double n, x;
	long long  result = 1;
	while (cin >> n)
	{
		result = 1;
		for (int i = 0; i < n; i++)
		{
			cin >> x;
			result = (long double)result*(long long)(x / minbei(x, result)) + 0.5;
		}
		cout << result << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main( int argc, char *argv[] ) {
    int a, b;
    scanf("%d%d", &a, &b);

    int sum = 0;
    for (int i=1; i<=999; i++) {
        sum += i;
        int dep = sum - a;
        if (sum + i + 1 == b + dep) {
            printf("%d\n", dep);
        }
    }
    return 0;
}


Measured memory_bytes: 128
/** 
 * Dont raise your voice, improve your argument.
 * --Desmond Tutu
 */

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

/* see https://github.com/pllk/cphb/ */
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag,
    tree_order_statistics_node_update> indexed_set;

typedef unsigned int uint;
typedef long long ll;
typedef __int128 lll;

#define fori(n) for(ll i=0; i<(n); i++)
#define forn(i, n) for(ll i=0; i<(n); i++)
#define forn3(i, x, n) for(ll i=(x); i<(n); i++)

int main() {
cin.tie(nullptr);
std::ios::sync_with_stdio(false);
    int n;
    cin>>n;
    vector<int> x(n);
    vector<int> y(n);

    fori(n)
        cin>>x[i]>>y[i];

    map<pair<int, int>, int> f;

    for(int i=0; i<n; i++)
        for(int j=0; j<n; j++)
            if(i!=j)
                f[{x[j]-x[i], y[j]-y[i]}]++;

    int mx=0;
    for(auto p=f.begin(); p!=f.end(); p++)
        mx=max(mx, p->second);

    int ans=n-mx;
    cout<<ans<<endl;
    

}



Measured memory_bytes: 384
def main():
    x,y = map(int,input().split())
    ans = 0
    if x == 1:
        ans += 300000
    elif x == 2:
        ans += 200000
    elif x == 3:
        ans += 100000
    else:
        pass

    if y == 1:
        ans += 300000
    elif y == 2:
        ans += 200000
    elif y == 3:
        ans += 100000
    else:
        pass
    
    if x==1 and y==1:
        ans += 400000
    
    print(ans)
    
if __name__ == "__main__":
    main()

Measured memory_bytes: 38384
from collections import deque

k = int(input())
limit = 10

start = [i for i in range(1, 10)]
q = deque(start)
ans = []

while q:
    cur = q.popleft()
    if len(str(cur)) > 11:
        continue
    ans.append(cur)
    r = str(cur)[-1]
    if r == '0':
        add = ['0', '1']
    elif r == '9':
        add = ['8', '9']
    else:
        add = [str(int(r) - 1), str(int(r)), str(int(r) + 1)]

    for i in add:
        q.append(int(str(cur) + i))

ans = sorted(ans)
print(ans[k - 1])

Measured memory_bytes: 153536
#pragma region Template
#include <bits/stdc++.h>
using namespace std;

#define rep(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define rng(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define rbf(i, v) for (auto& (i) : (v))
#define All(x) (x).begin(),(x).end()
#define COL(x) cout << x << endl
#define CO(x) cout << x
//#define int long long

using LL = long long;
using UL = unsigned long;
using ULL = unsigned long long;
using PII = pair<int, int>;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VS = vector<string>;
using VP = vector<PII>;

const double PI = 3.141592653589793;
const int MOD = 1000000007;
const LL INF64 = INT64_MAX >> 1;
const int INF = INT_MAX >> 1;

template<typename T> inline T sqr(T x) { return (x * x); }
inline void printd(double x) { printf("%.10lf\n", x); }
inline void upsort(VI& x) { sort((x).begin(), (x).end()); }
inline void downsort(VI& x) { sort((x).begin(), (x).end(), greater<int>()); }
inline int absdiff(int a, int b) { return (a - b) * (static_cast<int>(a > b)*2 - 1); }
int gcd(int a, int b) { // 最大公約数
	if (a < b) return gcd(b, a);
	int r;
	while ((r = a % b)) {
		a = b;
		b = r;
	}
	return b;
}
inline int lcm(int a, int b) { return a * b / gcd(a, b); } // 最小公倍数
#pragma endregion

signed main()
{
	LL A;
	string B;
	cin >> A >> B;
	B.erase(B.begin() + 1);
	LL B2 = stoll(B);
	LL ans = A * B2 / 100;
	COL(ans);

	return 0;
}

Measured memory_bytes: 3632
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, core.bitop;

enum inf3 = 1_001_001_001;
enum inf6 = 1_001_001_001_001_001_001L;
enum mod = 1_000_000_007L;



void main() {
    int n, a, b, c;
    scan(n, a, b, c);
    auto l = readArrByLines!(int)(n);

    // idx は今見ている竹の番号、 gc は合成に使った竹の本数
    int dfs(int idx, int la, int lb, int lc, int gc) {
        if (idx == n) {
            if (la == 0 || lb == 0 || lc == 0) {
                return inf3;
            }
            else {
                return abs(la - a) + abs(lb - b) + abs(lc - c) + 10 * (gc - 3);
            }
        }
        int res = inf3;
        // idx番目の竹を A のための合成に使う場合
        res = min(res, dfs(idx + 1, la + l[idx], lb, lc, gc + 1));
        // idx番目の竹を B のための合成に使う場合
        res = min(res, dfs(idx + 1, la, lb + l[idx], lc, gc + 1));
        // idx番目の竹を C のための合成に使う場合
        res = min(res, dfs(idx + 1, la, lb, lc + l[idx], gc + 1));
        // idx番目の竹は使わない場合
        res = min(res, dfs(idx + 1, la, lb, lc, gc));
        return res;
    }

    auto ans = dfs(0, 0, 0, 0, 0);

    writeln(ans);
}








int[][] readGraph(int n, int m, bool isUndirected = true, bool is1indexed = true) {
    auto adj = new int[][](n, 0);

    foreach (i ; 0 .. m) {
        int u, v;
        scan(u, v);
        if (is1indexed) {
            u--, v--;
        }
        adj[u] ~= v;
        if (isUndirected) {
            adj[v] ~= u;
        }
    }

    return adj;
}

alias Edge = Tuple!(int, "to", int, "cost");

Edge[][] readWeightedGraph(int n, int m, bool isUndirected = true, bool is1indexed = true) {
    auto adj = new Edge[][](n, 0);

    foreach (i ; 0 .. m) {
        int u, v, c;
        scan(u, v, c);
        if (is1indexed) {
            u--, v--;
        }
        adj[u] ~= Edge(v, c);
        if (isUndirected) {
            adj[v] ~= Edge(u, c);
        }
    }

    return adj;
}

void yes(bool b) {writeln(b ? "Yes" : "No");}
void YES(bool b) {writeln(b ? "YES" : "NO");}
T[] readArr(T)() {return readln.split.to!(T[]);}
T[] readArrByLines(T)(int n) {return iota(n).map!(i => readln.chomp.to!T).array;}

void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}

void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}


Measured memory_bytes: 256