akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

class Main{
	static void merge(int arr[], int l, int m, int r) 
    { 
        // Find sizes of two subarrays to be merged 
        int n1 = m - l + 1; 
        int n2 = r - m; 
  
        /* Create temp arrays */
        int L[] = new int [n1]; 
        int R[] = new int [n2]; 
  
        /*Copy data to temp arrays*/
        for (int i=0; i<n1; ++i) 
            L[i] = arr[l + i]; 
        for (int j=0; j<n2; ++j) 
            R[j] = arr[m + 1+ j]; 
  
        /* Merge the temp arrays */
  
        // Initial indexes of first and second subarrays 
        int i = 0, j = 0; 
  
        // Initial index of merged subarry array 
        int k = l; 
        while (i < n1 && j < n2) 
        { 
            if (L[i] <= R[j]) 
            { 
                arr[k] = R[j]; 
                j++; 
            } 
            else
            { 
                arr[k] = L[i]; 
                i++; 
            } 
            k++; 
        } 
  
        /* Copy remaining elements of L[] if any */
        while (i < n1) 
        { 
            arr[k] = L[i]; 
            i++; 
            k++; 
        } 
  
        /* Copy remaining elements of R[] if any */
        while (j < n2) 
        { 
            arr[k] = R[j]; 
            j++; 
            k++; 
        } 
    } 
  
    // Main function that sorts arr[l..r] using 
    // merge() 
    static void sort(int arr[], int l, int r) 
    { 
        if (l < r) 
        { 
            // Find the middle point 
            int m = (l+r)/2; 
  
            // Sort first and second halves 
            sort(arr, l, m); 
            sort(arr , m+1, r); 
  
            // Merge the sorted halves 
            merge(arr, l, m, r); 
        } 
    } 

	public static void main(String args[]){
		Scanner scanner = new Scanner(System.in);
		int n,m;
		n = scanner.nextInt();
		m = scanner.nextInt();
		int polls[] = new int[n];
		int totalPoll = 0;
		boolean printed = false;
		for(int i = 0; i < n; i++){
			polls[i] = scanner.nextInt();
			totalPoll += polls[i];
		}
		double threshHold = (1.0 / (4.0 * (double) m));
		sort(polls, 0, polls.length-1);
		for(int i = 0; i < m; i++){
			double currentPollPercentage = (double) polls[i] / (double) totalPoll;
			if(currentPollPercentage < threshHold){
				System.out.println("No");
				printed = true;
				break;
			}
		}

		if(!printed){
			System.out.println("Yes");
		}
	}
}

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

H,W = map(int,input().split())
C = [list(input()) if i%2 == 0 else [0 for j in range(W)] for i in range(2*H)]
#print(C)
for i in range(2*H):
    if i % 2 == 1:
        for j in range(W):
            C[i][j] = C[i-1][j]
#print(C)
for i in range(2*H):
    for j in range(W):
        if j != W-1:
            print(C[i][j],end='')
        else:
            print(C[i][j])

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

#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, m, n) for(int i = (m); i < (int)(n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define INF 2000000000

#ifdef LOCAL
  #define eprintf(...) fprintf(stdout, __VA_ARGS__)
#else
  #define eprintf(...) 0
#endif

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef unsigned int uint;

int main() {
  int n;
  cin >> n;
  vector<int> v(9, 0);
  int a;
  REP(i, n) {
    cin >> a;
    if(a <= 399) v[0]++;
    else if(a <= 799) v[1]++;
    else if(a <= 1199) v[2]++;
    else if(a <= 1599) v[3]++;
    else if(a <= 1999) v[4]++;
    else if(a <= 2399) v[5]++;
    else if(a <= 2799) v[6]++;
    else if(a <= 3199) v[7]++;
    else v[8]++;
  }

  int colors = 0;
  int zero = 0;
  REP(i, v.size()-1) {
    if(v[i] > 0) colors++;
    else zero++;
  }
  int free = v[8];
  int maxc = colors + free;
  int minc = colors == 0 ? 1 : colors;
  eprintf("col,zero,free:%d,%d,%d\n", colors,zero,free);

  printf("%d %d\n", minc, maxc);

  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <complex>
#include <queue>
#include <map>
using namespace std;

#define REP(i,n) for(int i = 0; i < (int)(n); ++i)
#define pb push_back
#define ALL(a) (a).begin(),(a).end()

#define EPS (1e-10)
#define EQ(a,b) (abs((a)-(b)) < EPS)

typedef long long ll;
//struct edge {int to, cost;};
typedef pair<int, int> P;
typedef complex<double> C;

struct edge {
    int from, to, cost;
    edge() {}
    edge(int f, int t, int c) {
        from = f; to = t; cost = c;
    }
};

bool cmp (const edge& e1, const edge& e2) {
    return e1.cost < e2.cost;
}

int INF = 100000000;
const int MAX_V = 100000;
const int MAX_E = 100000;

int uni[MAX_V];
edge es[MAX_E];
int V, E;

void init_uf(int n) {
    REP(i, n) uni[i] = -1;
}

int root(int x) {
    if (uni[x] < 0) return x;
    else {
        return uni[x] = root(uni[x]);
    }
}

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

void unite(int x, int y) {
    x = root(x);
    y = root(y);

    if (x == y) return;

    if (uni[x] > uni[y]) swap(x, y);

    uni[x] += uni[y];
    uni[y] = x;
}

int kruskal() {
    sort(es, es + E, cmp);
    init_uf(V);
    int res = 0;
    REP(i, E) {
        edge e = es[i];
        if (!same(e.from, e.to)) {
            unite(e.from, e.to);
            res += e.cost;
        }
    }
    return res;
}

void solve() {
    printf("%d\n", kruskal() );
}

int main() {
    while (true) {
        scanf("%d", &V);
        if (!V) return 0;
        scanf("%d", &E);
        REP(i, E) {
            int f, t, c;
            scanf("%d,%d,%d\n", &f, &t, &c);
            es[i] = edge(f, t, c/100 - 1);
        }
        solve();
    }
}

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

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

  int cnt = 0;
  for(int x = a; x<= b; x++){
    if(c % x == 0) cnt++;
  }

  cout<<cnt<<endl;

  return 0;
}


Measured memory_bytes: 3100
n=int(input())
a=[0]*n
b=[0]*n
a[:]=map(int,input().split())
import itertools
c=list(itertools.permutations(a, n))
c.sort()
b[:]=map(int,input().split())
a=tuple(a)
b=tuple(b)
"""
print(a)
print(b)
print(c)
"""
print(abs(c.index(a)-c.index(b)))


Measured memory_bytes: 8052
n=int(input())
s=input()
list=["" for _ in range(1000)]
ans=0
for i in range(1000):
  t=str(i)
  u="0"*(3-len(t))+t
  j=0
  exi=0
  p=u[0]
  for x in s:
    if x==p:
      j+=1
      if j==3:
        ans+=1
        break
      p=u[j]
    

  









print(ans)

Measured memory_bytes: 3064
#include <stdio.h>

int dep(int u,int k);
void print(int u);

typedef struct Node{
  int parent;
  int left;
  int right;
} node;
  
node T[100000];
int n,Dp[100000];

int main(){
  int i,j,dg,v,c,left,right;

  scanf("%d",&n);
  for(i=0;i<n;i++){
    T[i].parent=-1;
    T[i].left=-1;
    T[i].right=-1;
  }
  
  for(i=0;i<n;i++){
    scanf("%d%d",&v,&dg); 
    for(j=0;j<dg;j++){
      scanf("%d",&c);
      if(j==0) T[v].left=c;
      else T[left].right=c;
      left=c;
      T[c].parent=v;
    }
  }
  for(i=0;i<n;i++){
    if(T[i].parent==-1) right=i;
  }

  dep(right,0);

  for(i=0;i<n;i++) print(i);

  return 0;
}

int dep(int u,int k){
  
  Dp[u]=k;
  if(T[u].right!=-1) dep(T[u].right,k);
  if(T[u].left!=-1) dep(T[u].left,k+1);
}

void print(int u){

  int i,c;
  printf("node %d: ",u);
  printf("parent = %d, ",T[u].parent);
  printf("depth = %d, ",Dp[u]);

  if(T[u].parent==-1) printf("root, ");
  else if(T[u].left==-1) printf("leaf, ");
  else printf("internal node, ");

  printf("[");
  for(i=0, c=T[u].left; c!=-1; i++, c=T[c].right){
    if(i) printf(", ");
    printf("%d",c);
  }
  printf("]\n");
}

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

int main() {
	int **squares;
	int H, W, h, w;
	int i, j;
	int count;

	scanf("%d", &H);
	scanf("%d", &W);
	scanf("%d", &h);
	scanf("%d", &w);

	squares = (int**)malloc(sizeof(int*) * H);
	for(i = 0;i < H;i++) {
		squares[i] = (int*)malloc(sizeof(int) * W);
	}
	for(i = 0;i < H;i++) {
		for(j = 0;j < W;j++) {
			squares[i][j] = 0;
		}
	}
	for(i = 0;i < h;i++) {
		for(j = 0;j < W;j++) {
			squares[i][j] = 1;
		}
	}
	for(i = 0;i < w;i++) {
		for(j = 0;j < H;j++) {
			squares[j][i] = 1;
		}
	}
	for(i = 0;i < H;i++) {
		for(j = 0;j < W;j++) {
			count += squares[i][j];
		}
	}
	printf("%d\n", H * W - count);
	return 0;
}


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

#define rep(i, n) for(int i = 0; i < n; ++i)
using ll = long long;

int main() {
  ll n;
  cin >> n;
  std::vector<ll> a(n);
  rep(i, n) cin >> a[i];
  sort(a.begin(), a.end());
  rep(i, n-1) {
    if(a[i] - a[i+1] == 0) {
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
}


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

using namespace std;

void solve()
{
	string S;
	cin >> S;
	vector<int> as(3);
	for (char c : S)
	{
		as[c-'a']++;
	}
	sort(as.begin(), as.end());
	int x = as[1]-as[0], y = as[2]-as[0];
	if ((x == y && x == 1) || (x == 0 && y == 1) || (x == y && y == 0))
	{
		cout << "YES" << endl;
	}
	else
	{
		cout << "NO" << endl;
	}
}

int main(void)
{
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <string>

using namespace std;

int main(){
    string s,t;
    bool ans = false;
    cin >> s >> t;
    int l = s.length();
    if(s == t){
            ans = true;
    }
    for(int i = 0;i < l;i++){
        s = s[l - 1] + s;
        s.pop_back();
        if(s == t){
            ans = true;
        }
        //cout << s << endl;
    }
    if(ans){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define REP(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, a, b) for(int i=(a); i<(b); ++i)
#define FORR(i, a, b) for(int i=(b)-1; i>=(a); --i)

#define DEBUG(x) cout<<#x<<": "<<x<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

#define CHMIN(a, b) a=min((a), (b))
#define CHMAX(a, b) a=min((a), (b))

const int MOD=1000000007;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-11;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

bool used[113];

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, a, b, c, d;
	pii ab[114], cd[114];
	cin>>n;
	REP(i, n){
		cin>>a>>b;
		ab[i]=pii(a, b);
	}
	REP(i, n){
		cin>>c>>d;
		cd[i]=pii(c, d);
	}
	sort(ab, ab+n);
	sort(cd, cd+n);
	REP(i, n){
		int cd1=cd[i].first, cd2=cd[i].second;
		int cnt=0;
		int cnt2=110;
		int y=-1;
		while(cd1>ab[cnt].first && cnt<n){
			if(y<ab[cnt].second  && cd2>ab[cnt].second && used[cnt]==false){
				y=ab[cnt].second;
				cnt2=cnt;
			}
			++cnt;
		}
		used[cnt2]=true;
		// DEBUG(cnt);
		// DEBUG(cnt2);
	}
	int ans=0;
	REP(i, n){
		if(used[i]) ++ans;
	}
	cout<<ans<<'\n';
	return 0;
}


Measured memory_bytes: 256
require 'pp'
$DEBUG ? define_method(:dpp){|e|pp e} : define_method(:dpp){|e|}

# 入力値を数値で返却する
def gets_i()
  gets.chomp.to_i
end

# 空白区切の入力値を数値の配列で返却する
def gets_i_list()
  gets.chomp.split(" ").map(&:to_i)
end


n = gets_i
tlist = gets_i_list
m = gets_i
plist, xlist = [], []

total = tlist.sum

m.times do
  p, x = gets_i_list
  puts total - tlist[p-1] + x
end


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

#define ll long long
using namespace std;
int main(){
	string s,t,u;
	ll a,b;
	cin >> s >> t;
	cin >> a >> b;
	cin >> u;
	if(s==u) cout << a-1 << " " << b;
	if(t==u) cout << a << " " << b-1;
	return 0;
}



Measured memory_bytes: 256
using System;

namespace AtCoderConsole
{
    class Program
    {
        static void Main(string[] args)
        {
            // 標準入力から1行ずつ取得
            int total = int.Parse(Console.ReadLine());
            int cake = int.Parse(Console.ReadLine());
            int donut = int.Parse(Console.ReadLine());

            // ケーキを1個買う
            total -= cake;

            // ドーナツを買えるだけ買った余り
            total = total % donut;

            // 標準出力に出力
            Console.WriteLine(total);
        }
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
 
#define int long long
 
#define rep(i,s,n) for(int i = (s);i<(n);i++)
#define repe(i,s,n) for(int i = (s);i<=(n);i++)
#define rrep(i,s,n) for(int i = (n)-1;i>=(s);i--)
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int,int>pint;
typedef vector<int>vint;
const ll MOD=1000000007,INF=1e18;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};



string s;

signed main(){
    cin>>s;
if(s[0]==s[1]&&s[1]==s[2]){
    cout<<"Yes"<<endl;
    return 0;
}
if(s[1]==s[2]&&s[2]==s[3]){
    cout<<"Yes"<<endl;
    return 0;
}
   cout<<"No"<<endl; 
    
    
    
    
    
    return 0;
    
}

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

string name[15];
int n;

void solve(){
	for( int i = 0; i < n; ){
		for( int j = i + 1; j < n; ){
			if( name[i].length() > name[j].length() ){
				if( name[i].find( name[j] ) != string::npos ){
					name[j].swap( name[--n] );
					continue;
				}
			}
			else{
				if( name[j].find( name[i] ) != string::npos ){
					name[i].swap( name[--n] );
					--i;
					break;
				}
			}
			++j;
		}
		++i;
	}
	
	int w[15][15];
	
	for( int i = 0; i < n; ++i ){
		for( int j = 0; j < n; ++j ){
			w[i][j] = 0;
			if( i != j ){
				int len1 = name[i].length();
				int len2 = name[j].length();
				for( int p = max( 0, len1 - len2 + 1 ); p < len1; ++p ){
					if( name[i].compare( p, len1 - p, name[j], 0, len1 - p ) == 0 ){
						w[i][j] = len1 - p;
						break;
					}
				}
			}
		}
	}
	
	int last = 1 << n;
	int sumlen = 0;
	vector< vector<int> > dp( n, vector<int>( last, -999 ) );
	for( int i = 0; i < n; ++i ){
		dp[i][1 << i] = 0;
		sumlen += name[i].length();
	}

	for( int S = 1; S < last - 1; ++S ){
		for( int f = 0; f < n; ++f ){
			if( S & 1 << f ){
				for( int t = 0; t < n; ++t ){
					if( !( S & 1 << t ) ){
						dp[t][S | 1 << t] = max( dp[t][S | 1 << t], dp[f][S] + w[f][t] );
					}
				}
			}
		}
	}
	
	int maxw = 0;
	for( int i = 0; i < n; ++i ){
		maxw = max( maxw, dp[i][last - 1] );
	}
	
	cout << sumlen - maxw << endl;
}

int main(){
	while( cin >> n, n != 0 ){
		for( int i = 0; i < n; ++i ){
			cin >> name[i];
		}
		
		solve();
	}
}

Measured memory_bytes: 1888
function Main(input) {
	input = input.trim();
  if(input.indexOf("1") != -1 && input.indexOf("9") != -1 && 
     input.indexOf("7") != -1 && input.indexOf("4") != -1){
     	console.log("YES");
     }else{
     console.log("NO");
     }
}

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


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

int main() {
	string n;
  	cin >> n;
   	int c = 0;
  	for(int i = 0;i < 4;i++){
      if(n.at(i) == '2'){
        c++;
      }
    }
  cout << c << endl;
  return 0;
}

Measured memory_bytes: 256
#encoding utf-8
from collections import Counter
def main(n,v):
    odd = Counter(v[0::2]).most_common(2) + [(0,0)]
    even = Counter(v[1::2]).most_common(2) + [(0,0)]

    if odd[0][0] == even[0][0]:
        ans = min(n-odd[0][1]-even[1][1],
        n-odd[1][1]-even[0][1])
    else:
        ans = n-odd[0][1]-even[0][1]
    print(ans)


if __name__ == "__main__":
    n = int(input())
    v = list(int(i) for i in input().split())
    main(n,v)

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

int main() {
    int W, H, x, y, r;
    cin >> W >> H >> x >> y >> r;
    /* code */
    if ((x - r >= 0 && y - r >= 0) && (x + r <= W && y + r <= H)) {
        cout << "Yes"
             << "\n";
    } else {
        cout << "No"
             << "\n";
    }

    return 0;
}



Measured memory_bytes: 3096
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<cstdio>

using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define pb push_back
#define pf push_front

typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;

ll gcd(ll x, ll y) {
	ll r;
	while ((r = x % y) != 0) {
		x = y;
		y = r;
	}
	return y;
}
ll lcm(ll x, ll y) {
	x /= gcd(x, y);
	y /= gcd(x, y);
	return (x*y);
}

int main()
{
	int cnt = 0;
	string s;
	cin >> s;
	for (int i = 'a'; i < 'z'; i++) {
		rep(j, s.size()) {
			if (s[j] == i) {
				cnt++;
			}
		}
		if (cnt % 2 != 0) {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
typedef long long int ll;

int powInt(int a, int b){
    return (int)pow((double)a, (double)b);
}

int main(void){
    int n;
    scanf("%d", &n);

    int a[5];
    for(int i=0; i<5; i++){
        a[i] = 0;
    }

    char s[11];
    for(int i=0; i<n; i++){
        scanf("%s", s);
        if(s[0]=='M'){
            a[0] += 1;
        }else if(s[0]=='A'){
            a[1] += 1;
        }else if(s[0]=='R'){
            a[2] += 1;
        }else if(s[0]=='C'){
            a[3] += 1;
        }else if(s[0]=='H'){
            a[4] += 1;
        }
    }

    int comb[5];
    int idx;
    int flag;
    ll ans = 0;
    for(int i=0; i<(powInt(2,5)); i++){
        flag = 1;
        idx = 0;
        for(int i=0; i<5; i++){
            comb[i] = 0;
        }

        for(int j=0; j<5; j++){
            if((1&i>>j)==1){
                comb[idx] = j;
                idx += 1;
            }
        }

        if(idx==3){
            ll tmp = 1;
            for(int i=0; i<3; i++){
                tmp *= a[comb[i]];
            }
            ans += tmp;
        }
    }

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

    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,n) for(int i=(0);i<(n);i++)

using namespace std;

typedef long long ll;

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

	int n;
	cin >> n;

	vector<int> to(n);
	rep(i, n){
		int a;
		cin >> a;
		to[i] = a - 1;
	}

	vector<bool> visited(n, false);
	
	int x = 0;
	int cnt = 0;
	while(!visited[x]){
		// cout << x << endl;
		visited[x] = true;
		x = to[x];
		if(x == 1){
			cout << cnt + 1 << endl;
			return 0;
		}
		cnt++;		
	}
	cout << -1 << endl;
}


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

int main(){
    string S;
    int s_l, i, j;
    bool dif_flag = false;

    cin >> S;
    s_l = S.length();
    
    for (i = 0; i < s_l-1; i++){
        for (j = i+1; j < s_l; j++){
            if ( S[i] == S[j])
                dif_flag = true;
            }
        if (dif_flag == true)
            break;
        }
    if (dif_flag == false)
        cout << "yes" << endl;
    else
        cout << "no" << endl;
    }



Measured memory_bytes: 256
n = int(input())
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr
fact = factorization(n)


ans = 0
for a,b in fact:
    count = 0
    while True:
        count +=1
        if count*(count+1)/2>b:
            count-=1
            break
    ans += count
if n ==1:
    print(0)
else: 
    print(ans)

Measured memory_bytes: 9484
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		double x1 = scn.nextDouble();
		double y1 = scn.nextDouble();
		double x2 = scn.nextDouble();
		double y2 = scn.nextDouble();
		double a = (x2 - x1) * (x2 - x1);
		double b = (y2 - y1) * (y2 - y1);
		System.out.println(Math.sqrt(a + b));
	}
}


Measured memory_bytes: 27896
#include <stdio.h>

int count_div(int x)
{
  int count = 1;
  while((x % 2) != 1){
    x /= 2;
    count++;
  }
  return count;
}

int main()
{
  int num, i;
  int divmax = 0, counter = 0;
  int ans;

  scanf("%d", &num);

  for(i = num; i > num / 2; i--){
    counter = count_div(i);
    if(divmax < counter){
      divmax = counter;
      ans = i;
    }
  }
  printf("%d\n", ans);
  
  return 0;
}

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

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

	int n,k;

	cin >> n >> k;

	for(int i=k-n+1;i<=n+k-1;i++)
	{
		cout << i << ' ';
	}
	cout << '\n';
	
	return 0;	
}

Measured memory_bytes: 256
import itertools

N = int(input())

ans = [0]*N

x = []


i=1
while 1:
    if (i+1)*(i+1)+2>=N:
        break
    i+=1
i+=1

for inputI in range(i):
    x.append(inputI+1)


S = list(itertools.combinations_with_replacement(x, 3))


for s in S:
    sum = (s[0]+s[1])*(s[0]+s[2])+pow(s[1],2)+pow(s[2],2)

    if sum <= N:
        if s.count(s[0])==3:
            ans[sum-1]+=1
        elif s.count(s[0])==2 or s.count(s[1])==2:
            ans[sum-1]+=3
        else:
            ans[sum-1]+=6


for a in ans:
    print(a)

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

#include <iostream>
#include <iomanip>
#include <sstream>
#include <stdint.h>
#include <string.h>

#include <unordered_set>

#define _USE_MATH_DEFINES
#include <math.h>


#include <vector>
#include <list>

#include <set>
#include <map>

#include <unordered_map>

#include <queue>

#include <string>

#include <vector>

#define sqr(x) (x) * (x)

#include <algorithm>
#include <functional>

#include <bitset>

#include <functional>

#include <chrono>

typedef unsigned int u32;
typedef int i32;

typedef unsigned long long int u64;
typedef long long int i64;

typedef uint16_t u16;
typedef int16_t i16;

typedef uint8_t u8;
typedef int8_t i8;


using namespace std;
using namespace std::chrono;

struct less_key
{
    bool operator() (pair<i64, i64> p1, pair<i64, i64> p2)
    {
        return p1.first < p2.first || (p1.first == p2.first && p1.second < p2.second);
    }
};

struct pair_hash {
public:
    std::size_t operator()(const std::pair<u64, u64> &x) const
    {
        return std::hash<u64>()(x.first) ^ std::hash<u64>()(x.second);
    }
};
#include <random>

const i64 mod = 1000000007ll;
const i64 smod = 999983;
const i64 inf = mod;

const double eps = 1e-10;

// del

i64 a, b;

int main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout.precision(15); cout.setf(ios::fixed);

    cin >> a >> b;
    if (a == b) {
        cout << a + b << endl;
    }
    else {
        i64 m = max(a, b);
        cout << 2 * m - 1 << endl;
    }

    return 0;
}


Measured memory_bytes: 256
import collections

n = int(input())
arr = list(map(int, input().split()))
cnt = collections.defaultdict(int)

for val in arr:
    cnt[val] += 1

sums = sum(arr)
q = int(input())
for _ in range(q):
    b, c = map(int, input().split())
    diff = (c-b)*(cnt[b])
    sums += diff
    print(sums)
    cnt[c] += cnt[b]
    cnt[b] = 0



Measured memory_bytes: 24264
using System;
using System.Linq;
using System.Collections.Generic;

namespace program
{
    class Program
    {
        static void Main()
        {
          int[] a = Input.ScanIntArray();
          string edge = new string(Enumerable.Range(0,a[1]+2).Select(x=>'#').ToArray());
          Out(edge);
          
          for(int i=0;i<a[0];i++){
            Out($"#{Input.ScanStr()}#");
          }
          
          Out(edge);
        }
        static public void Out(object s) { Console.WriteLine(s); }
    }
    
    static class Input {
        static public int ScanInt() { return int.Parse(Console.ReadLine()); }
        static public uint ScanUint() { return uint.Parse(Console.ReadLine()); }
        static public double ScanDouble() { return double.Parse(Console.ReadLine()); }
        static public long ScanLong() { return long.Parse(Console.ReadLine()); }
        static public ulong ScanUlong() { return ulong.Parse(Console.ReadLine()); }
        static public int[] ScanIntArray() { return Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray(); }
        static public uint[] ScanUintArray() { return Console.ReadLine().Split().Select(x => uint.Parse(x)).ToArray(); }
        static public double[] ScanDoubleArray() { return Console.ReadLine().Split().Select(x => double.Parse(x)).ToArray(); }
        static public long[] ScanLongArray() { return Console.ReadLine().Split().Select(x => long.Parse(x)).ToArray(); }
        static public ulong[] ScanUlongArray() { return Console.ReadLine().Split().Select(x => ulong.Parse(x)).ToArray(); }

        static public string ScanStr() { return Console.ReadLine(); }
        static public string[] ScanStrArray() { return ScanStr().Split(); }
    }

    static class MyMath {
        public static int DistanceL1(int[] a, int[] b){
            if(a.Length != b.Length) return -1;
            int[] c = new int[a.Length];
            for(int i=0;i<a.Length;i++)
              c[i] = Math.Abs(a[i]-b[i]);
            return c.Sum();
        }

        public static double DistanceL2(int[] a, int[] b){
            if(a.Length != b.Length) return -1;
            int[] c = new int[a.Length];
            for(int i=0;i<a.Length;i++)
              c[i] = (a[i]-b[i])*(a[i]-b[i]);
            return Math.Sqrt(c.Sum());
        }
        public static int GCD(int a, int b)
        {
            Func<int, int, int> gcd = null;
            gcd = (x, y) => y == 0 ? x : gcd(y, x % y);
            return a > b ? gcd(a, b) : gcd(b, a);
        }
        public static ulong GCD(ulong a, ulong b)
        {
            Func<ulong, ulong, ulong> gcd = null;
            gcd = (x, y) => y == 0 ? x : gcd(y, x % y);
            return a > b ? gcd(a, b) : gcd(b, a);
        }
        public static int LCM(int a, int b)
        {
            return a * b / GCD(a, b);
        }
        public static ulong LCM(ulong a, ulong b)
        {
            return a * b / GCD(a, b);
        }
    }
}


Measured memory_bytes: 13396
#include <cstdio>
#include <string>
using namespace std;

long long n;
string res;

long long getVal(int x) {
    long long ans = 1;

    for(int i = x, j = 2; i <= x + 6; ++i) {
        ans *= i;

        for(; j <= 7 && ans % j == 0; ++j)
            ans /= j;
    }

    return ans;
}

int main() {

    scanf("%lld", &n);

    for(int i = 600; i >= 1; --i) {
        long long x = getVal(i);
        int cntF = n / x;
        n %= x;

        if(cntF > 0)
            res += string(cntF, 'F');
        res += string("ESTIVAL");
    }

    printf("%s\n", res.c_str());

    return 0;
}

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();
        long K = sc.nextLong();
        Pair[] P = new Pair[N];
        for (int i = 0; i < N; i++) {
            P[i] = new Pair(sc.nextInt(), sc.nextInt());
        }
        System.out.println( solve(N, K, P) );
    }

    private static int solve(int N, long K, Pair[] P) {
        Arrays.sort(P, Comparator.comparingInt(p -> p.a));

        long current = 0;
        for (Pair p : P) {
            current += p.b;
            if( current >= K ) {
                return p.a;
            }
        }
        throw new RuntimeException("wtf");
    }

    private static class Pair {
        private final int a;
        private final int b;

        public Pair(int a, int b) {
            this.a = a;
            this.b = b;
        }
    }
}


Measured memory_bytes: 92852
def cin():
    in_ = list(map(int,input().split()))
    if len(in_) == 1:  return in_[0]
    else:  return in_

N, M = cin()
if M // 2 >= N:
    ans = N
    M -= 2 * N
else:
    ans = M // 2
    M = 0
ans += M // 4
print(ans)

Measured memory_bytes: 61472
#include "bits/stdc++.h"
using namespace std;
#define watch(x) cout << (#x) << " is " << (x) << endl

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

  map<string,int>m;
  int n;
  cin>>n;
  string s;
  for(int i=0;i<n;i++){
     cin>>s;
     m[s]++;
  }

  cout<<(int)m.size()<<endl;
      
     
  return 0;
}
  

Measured memory_bytes: 19216
use input::Input;

fn main() {
    let mut input = Input::new();

    let s: i32 = input.parse();
    let w: i32 = input.parse();

    if s <= w {
        println!("unsafe");
    } else {
        println!("safe");
    }
}

#[allow(dead_code)]
mod input {
    use std::io::{stdin, BufRead, StdinLock};

    pub struct Input<'a> {
        memory: Vec<String>,
        reader: StdinLock<'a>,
    }

    impl<'a> Input<'a> {
        pub fn new() -> Self {
            Self {
                memory: Vec::new(),
                reader: Box::leak(Box::new(stdin())).lock(),
            }
        }
        pub fn read_line(&mut self) -> String {
            let mut s = String::new();
            self.reader.read_line(&mut s).expect("read_line failed.");
            s
        }
        pub fn parse<T: std::str::FromStr>(&mut self) -> T {
            if self.memory.len() == 0 {
                let s = self.read_line();
                self.memory = s.split_whitespace().map(String::from).rev().collect();
            }
            self.memory.pop().unwrap().parse().ok().unwrap()
        }
    }
}


Measured memory_bytes: 2124
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<cstdio>
#define pb push_back
#define all(v) v.begin(),v.end()
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define eps 1e-6
#define INF 1e9
using namespace std;

int main(){
	int d,e;
	double ans=INF;
	while(cin>>d>>e,d||e){
		ans=INF;
		rep(x,d+1){
			int y=d-x;
			double per=abs(sqrt(x*x+y*y)-e);
			if(per<ans-eps)ans=per;
		}
		printf("%.7f\n",ans);
	}
	return 0;
}


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

typedef tuple<int, int, int> tup;
typedef long long ll;

bool comp(tup a, tup b)
{
	return get<0>(a) < get<0>(b);
}

int N;
vector<tup> app;

ll dp[366][366];
ll dp2[366][366];

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

	while (cin >> N)
	{
		if (N == 0) return 0;
		
		app.clear();
		rep(i, 0, N)
		{
			int a, b, c; cin >> a >> b >> c;
			app.push_back(tup(a, b, c));
		}
		sort(app.begin(), app.end(), comp);

		rep(i, 0, 366) rep(j, 0, 366) dp[i][j] = 0;

		for (auto p : app)
		{
			int a = get<0>(p) - 1;
			int b = get<1>(p);
			int c = get<2>(p);

			rep(i, 0, 366) rep(j, 0, 366) dp2[i][j] = dp[i][j];

			rrep(i, 365, 0) if (0 <= dp[a][i]) dp2[b][i] = max(dp2[b][i], dp[a][i] + c);
			rrep(i, 365, 0) if (0 <= dp[i][a]) dp2[i][b] = max(dp2[i][b], dp[i][a] + c);

			rep(i, 0, 366) rep(j, 0, 366)
			{
				if (i != 365) dp2[i + 1][j] = max(dp2[i + 1][j], dp2[i][j]);
				if (j != 365) dp2[i][j + 1] = max(dp2[i][j + 1], dp2[i][j]);
				if (i != 365 && j != 365) dp2[i + 1][j + 1] = max(dp2[i + 1][j + 1], dp2[i][j]);
			}

			swap(dp, dp2);
		}

		
		//rep(i, 0, 366) rep(j, 0, 366) printf("[%d,%d] = %lld\n", i, j, dp[i][j]);
		cout << dp[365][365] << endl;

		//return 0;
	}
}

Measured memory_bytes: 5284
#include<iostream>
#include<stdio.h>

using namespace std;

int main() {
	string S;

	cin >> S;
	int i = 0;

	if (S.at(2) == S.at(3)) {
		i ++;
	}
	if (S.at(4) == S.at(5)) {
		i++;
	}

	

	if (i == 2) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=500005;
int n,a[N];
char s[N];  

void solve()
{
    cin>>n;
    cout<<(n^1)<<endl;
}

int main()
{
    int TTT=1; //scanf("%d",&TTT);
    while(TTT--){solve();}
    return 0;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF=1001001001;
vector<pair<int64_t,int64_t>>func(int64_t x){
  vector<pair<int64_t,int64_t>>p;
  for(int64_t i=2;i*i<=x;i++){
    int cnt=0;
    if(x%i==0){
    while(x%i==0){cnt++;x/=i;}
    p.push_back(make_pair(i,cnt));
    }
  }
  if(x!=1){p.push_back(make_pair(x,1));}
  return p;
}


int main() {
  int x,n;
  cin>>x>>n;
  vector<int>p(n);
  for(int i=0;i<n;i++){
    cin>>p[i];
  }
  int ans=9999;
  for(int i=0;i<=101;i++){
    bool ok=true;
    for(int j=0;j<n;j++){
     if(i==p[j]){ok=false;}
    }
    if(ok){ans=min(ans,abs(i-x));}
  }
  
  for(int i=0;i<=101;i++){
    bool ok=true;
    for(int j=0;j<n;j++){
     if(i==p[j]){ok=false;}
    }
    if(ok&&abs(i-x)==ans){cout<<i<<endl;return 0;}
  }
  return 0;
}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
#define fastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define what_is(x) cerr << #x << " = " << x << endl;
ll p2[1009];
int main()
{
    fastIO
    int n;
    cin>>n;
    int x,y,ans=0;
    bool bo=0;

    for (int i=0; i<n; ++i)
    {
        cin>>x>>y;
        if (x==y)
        {
            ++ans;
        }
        else
            ans=0;
        if (ans>=3)
            bo=1;
    }
    bo?cout<<"Yes":cout<<"No\n";
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
void debug() { cerr << "\n"; }
template <class T> void debug(const T &x) { cerr << x << "\n"; }
template <class T, class... Args> void debug(const T &x, const Args &... args) {
    cerr << x << " ";
    debug(args...);
}
template <class T> void debugVector(const vector<T> &v) {
    for(const T &x : v) {
        cerr << x << " ";
    }
    cerr << "\n";
}
using ll = long long;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
constexpr int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<ll> a(n), sum(n + 1, 0);
    for(int i = 0; i < n; i++) {
        cin >> a[i];
        sum[i + 1] = sum[i] + a[i];
    }
    ll ans = LLINF;
    // [0, i), [i, n)
    for(int i = 0; i <= n; i++) {
        ll Lsum = sum[i];
        ll Rsum = sum[n] - Lsum;
        int it1 = lower_bound(ALL(sum), Lsum / 2) - sum.begin();
        int it2 = lower_bound(ALL(sum), Lsum + Rsum / 2) - sum.begin();
        for(int j = it1 - 1; j <= it1 + 1; j++) {
            for(int k = it2 - 1; k <= it2 + 1; k++) {
                if(0 <= j && j <= i && i + 1 <= k && k <= n) {
                    ll mx = -LLINF;
                    ll mn = LLINF;
                    chmax(mx, max({sum[j], sum[i] - sum[j], sum[k] - sum[i],
                                   sum[n] - sum[k]}));
                    chmin(mn, min({sum[j], sum[i] - sum[j], sum[k] - sum[i],
                                   sum[n] - sum[k]}));
                    chmin(ans, mx - mn);
                }
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 6372
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		new Main().run();
	}

	private void run() {
		Scanner scanner = new Scanner(System.in);
		int a = scanner.nextInt();
		int b = scanner.nextInt();
		int c = scanner.nextInt();
		int ans = a * 4 + b * 2 + c;
		System.out.println(ans == 6 || ans == 1 ? "Open" : "Close");
	}
}

Measured memory_bytes: 17308
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
    
int main(){
    string s;
    cin >> s;
    if(s.at(0) == s.at(2)){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int main(){
  int M = 1000000;
  bool P[M];
  for(int i = 0; i < M; ++i) P[i] = true;
  P[0] = false;
  P[1] = false;

  for(int i = 2; i*i < M; ++i){
    for(int j = i; i*j < M; ++j){
      P[i*j] = false;
    }
  }

  
  int N, p;
  while(cin >> N >> p, N != -1){
    int c = 0;
    vector<int> V;
    while(c < p){
      for(int i = N+1; i < M; ++i){
	if(P[i]){
	  V.push_back(i);
	  ++c;
	}
      }
    }
    vector<int> ans;
    for(int i = 0; i < p; ++i){
      for(int j = i; j < p; ++j){
	ans.push_back(V[i]+V[j]);
      }
    }
    sort(ans.begin(), ans.end());
    cout << ans[p-1] << endl;
  }
  return 0;
}

Measured memory_bytes: 4520
#include <stdio.h>
int main()
{
	int ss;
	int h, m, s;
	scanf("%d", &ss);

	h = ss / 3600;
	ss = ss - h * 3600;
	m = ss / 60;
	s = ss - m * 60;
	printf("%d:%d:%d\n", h, m ,s);
	return 0;
}


Measured memory_bytes: 2052
io = STDIN

n=io.gets.chomp.to_i

a=io.gets.chomp.split.map(&:to_i)
ans=(100*100)**2*100
(a.min..a.max).each do |i|
  tmp=a.map{|j|(i-j)**2}.inject(:+)
  ans=[tmp,ans].min
end
puts ans

Measured memory_bytes: 1916
#include<stdio.h>
int main(void){
	int x,y;
	int i,j;
	scanf("%d",&x);
	scanf("%d",&y);
	if(1<=x&&x<y&&y<=12){
		if(x==1||x==3||x==5||x==7||x==8||x==10){
			if(y==3||y==5||y==7||y==8||y==10||y==12){
			printf("Yes");
			}else{
				printf("No");
			}
		}else if(x==4||x==6||x==9){
			if(y==6||y==9||y==11){
				printf("Yes");
			}else{
			printf("No");
			}
		}else if(x==2||x==11){
			printf("No");
		}
	}
	
	return 0;
}
	

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

const int MOD = 1000000007;
const int INF = 1000000000;

//long long
using ll = long long;

//出力系
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
 
// begin() end()
#define all(x) (x).begin(),(x).end()

//for
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

//最大公約数 
unsigned gcd(unsigned a, unsigned b) {
  if(a < b) return gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

// 最小公倍数
unsigned lcm(unsigned a, unsigned b){
    return a / gcd(a, b) * b; 
}

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

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

int main(){
    ll N;
    cin >> N;
    ll w;
    REP(h, 3501)REP(n, 3501){
        if(h == 0 || n == 0) continue;
        ll bunbo = N * h * n, bunshi = 4 * h * n - N * (h + n);
        if (bunshi == 0) continue;
        if (bunbo % bunshi == 0) {
            ll w = bunbo / bunshi;
            if (w >= 0) {
                cout << h << " " << n << " " << bunbo / bunshi;
                return 0;
            }
        }
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < n; i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
typedef long long ll;

int main() {
    int N, M; cin >> N >> M;
    cout << (1900 * M + 100 * (N - M)) * pow(2, M) << endl;
    return 0;
}

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

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

const int INF = (1 << 30) - 1;
const ll INF64 = ((ll)1 << 62) - 1;
const ll MOD = 1e9 + 7;
const double PI = 3.1415926535897932384626433832795;

int main()
{
	ll a, b, x;
	cin >> a >> b >> x;
	if (a % x == 0)
	{
		cout << b / x - a / x + 1 << endl;
	}else{
		cout << b / x - a / x << endl;
	}
	
	return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;
import java.math.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        HashMap<String,Integer> map = new HashMap<String,Integer>();
        ArrayList<String> ans = new ArrayList<String>();
        int n = sc.nextInt();
        for(int i = 0; i < n; i++){
            String s = sc.next();
            if(map.containsKey(s)){
                
                map.put(s,map.get(s)+1);
            }else{
                map.put(s,1);
            }
        }
        
        List<Map.Entry<String, Integer>> list_entries = new ArrayList<Map.Entry<String, Integer>>(map.entrySet());
        Collections.sort(list_entries, new Comparator<Map.Entry<String, Integer>>() {
            public int compare(Map.Entry<String, Integer> obj1, Map.Entry<String, Integer> obj2)
            {
                return obj2.getValue().compareTo(obj1.getValue());
            }
        });
        int cnt = 0;
        int max = 0;
        for(Map.Entry<String, Integer> entry : list_entries) {
            if(cnt == 0){
                cnt++;
                max = entry.getValue();
                ans.add(entry.getKey());
            }else if(max == entry.getValue()){
                cnt++;
                ans.add(entry.getKey());
            }
        }
        Collections.sort(ans);
        for(String s : ans){
            System.out.println(s);
        }
    }
}

Measured memory_bytes: 82628
#include <stdio.h>
 
int main(void)
{
    
     
    unsigned int a=1;
    unsigned int d=0;
    unsigned long sum=0;
  
    scanf("%d",&d);
  
   while(a <= d){
    
     
    // aが3の倍数 または 5の倍数のとき
    if(a % 3 == 0 || a % 5 == 0) {

    }else{
      sum+=a;
    }
     
     a+=1;
     
   }
    printf("%lu\n",sum);
     
    return 0;
}

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

int main(){
    char s[100005];
    scanf("%s",s);
    long long int a=strlen(s);
    if(s[0]==s[a-1]){
        long long int i;
        long long int flag,count;
        flag=0;
        count=0;
        for(i=1;i<=a-1;i++){
            if(s[0]==s[i]){
                flag+=count-1;
               count=0;
            }else{
                count++;
            }
        }
        if(flag%2==1)printf("First");
        else printf("Second");
    }else{
        if(a%2==1)printf("First");
        else printf("Second");
    }
    return 0;
}

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

using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    int a, b, c;
    cin >> a >> b >> c;
    if (c < b) {
        swap(b,c);
    }
    cout << max(0,c - (a+b)) << endl;
    return 0;
}


Measured memory_bytes: 256
import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 19
MOD = 10 ** 9 + 7

def build_grid(H, W, intv, _type, space=True, padding=False):
    # 入力がスペース区切りかどうか
    if space:
        _input = lambda: input().split()
    else:
        _input = lambda: input()
    _list = lambda: list(map(_type, _input()))
    # 余白の有無
    if padding:
        offset = 1
    else:
        offset = 0
    grid = list2d(H+offset*2, W+offset*2, intv)
    for i in range(offset, H+offset):
        row = _list()
        for j in range(offset, W+offset):
            grid[i][j] = row[j-offset]
    return grid

def bfs(grid, src):
    """ BFS(グリッド、重みなし) """
    from collections import deque

    H, W = len(grid), len(grid[0])
    directions = ((1, 0), (-1, 0), (0, 1), (0, -1))
    dist = list2d(H, W, INF)
    que = deque()
    for h, w in src:
        que.append((h, w))
        dist[h][w] = 0
    while que:
        h, w = que.popleft()
        for dh, dw in directions:
            for k in range(1, K+1):
                h2 = h + dh*k
                w2 = w + dw*k
                if grid[h2][w2] == '@':
                    break
                if dist[h2][w2] < dist[h][w] + 1:
                    break
                elif dist[h2][w2] != INF:
                    continue
                dist[h2][w2] = dist[h][w] + 1
                que.append((h2, w2))
    return dist

H, W, K = MAP()
x1, y1, x2, y2 = MAP()
grid = build_grid(H, W, '@', str, space=0, padding=1)

res = bfs(grid, [(x1, y1)])
ans = res[x2][y2]
if ans == INF:
    print(-1)
else:
    print(ans)


Measured memory_bytes: 175268
#include <iostream>
#define loop(a,n) for(int i=a;i < n;i ++)

using namespace std;

int main()
{
	int a[12] = {0,2,0,1,0,1,0,0,1,0,1,0};

    int x,y;
    cin >> x >> y;
	if(a[x-1] == a[y-1])
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}
}


Measured memory_bytes: 256
#include "math.h"
#include <iostream>
#include "stdio.h"
using namespace std;

/** Problem0073 : Surface Area of Quadrangular Pyramid **/
int main()
{
	double x, h, S;
	
	while (cin >> x >> h) {
		if (x == 0 && h == 0) break;
		S = x*x + x*sqrt(x*x+4*h*h);
		printf("%.6lf\n", S);
	}
}

Measured memory_bytes: 1236
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <iomanip>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 998244353

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

ll seica[222222];
ll keymoon[222222];

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

	ll n;cin >> n;
	vector<P> v;
	REP(i, n){
		ll a, b;cin >> a >> b;
		v.EB(a, 1);
		v.EB(b, -1);
	}

	sort(ALL(v));
	ll s = 0;
	ll e = 0;
	REP(i, v.size()){
		if(v[i].SE == 1){
			seica[s] = v[i].FI;
			s++;
		}
		else{
			keymoon[e] = v[i].FI;
			e++;
		}
	}

	if(n % 2){
		cout << keymoon[n/2] - seica[n/2] + 1 << endl;
	}
	else {
		cout << (keymoon[n/2] + keymoon[n/2-1]) - (seica[n/2] + seica[n/2-1]) + 1 << endl;
	}

	return 0;
}


Measured memory_bytes: 12876