akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cmath>
#include<cctype>
#include<vector>
using namespace std;
int main(){
        int a;
        int taro=0;
        int hanako=0;
        cin >> a;
        for(int i=0;i<a;i++){
            string t,h;
                cin >> t >> h;
                for(int j=0;;j++){
                        if(t>h){
                                taro+=3;
                                break;
                        }else if(t<h){
                                hanako+=3;
                                break;
                        }else{
                                hanako+=1;
                                taro+=1;
                                break;
                        }
                }
        }
        cout << taro << " " << hanako << endl;
        return 0;
}

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

using namespace std;
using ll=long long;
using ull=unsigned long long;

typedef pair<int,int>Pi;
typedef pair<long long,long long>P;
typedef pair<long long,P>PP;
typedef pair<P,P>PPP;

const long long MOD=1e9+7;
const long long INF=5e18;
const int di[4]={1,0,-1,0};
const int dj[4]={0,1,0,-1};

#define fr first
#define sc second
#define pb push_back
#define eb emplace_back
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()

int a,b,c;

void input(){
	cin>>a>>b>>c;
	return;
}

void solve(){
	cout<<min(c,b/a)<<endl;
	return;
}

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
int gcd(ll a, ll b){
    if(b == 0) return a;
    gcd(b,a%b);
}


int main() {
 int N,K;
 cin >> N>> K;
 vector<int> h(N);
 for(int i = 0;i<N;i++){
   cin >> h[i];
 }
 sort(h.begin(),h.end());
 reverse(h.begin(),h.end());
 int ans  =0;

 for(int i = 0;i<N;i++){
   if(h[i]>=K) ans++;
   else break;
 }
 cout << ans << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr long long MOD = 1000000007;
constexpr long long INF = 1LL << 60;
const long double PI = acosl(-1.0);
constexpr long double EPS = 1e-11;
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
int main(){
ll n;
cin>>n;
vector<vector<pair<ll,ll>>> testify(n);
for(ll i=0;i<n;i++){
    ll a;
    cin>>a;
    testify[i].resize(a);
    for(ll j=0;j<a;j++){
        ll x,y;
        cin >> x >> y;
        x--;
        testify[i][j].first = x;
        testify[i][j].second = y;
    }
}
int ans = 0;
for (ll bit = 0; bit < (1 << n); bit++){
    bool flag = true;
    for (ll i = 0; i < n; i++) {
        if (!(bit & (1 << i))) continue;
        for(auto k:testify[i]){
            if (k.second && !(bit & (1 << k.first))) flag = false;
            if (!(k.second) && (bit & (1 << k.first))) flag = false;
        }
    }
    if (flag)chmax(ans, __builtin_popcountl(bit));
}
cout << ans << endl;
}


Measured memory_bytes: 256
A,B,C,D,E,F = map(int,input().split())
ans = []
for a in range(F // (A*100) + 1):
    for b in range(F // (B*100) + 1):
        water =  100*a*A + 100*b*B 
        if water <= F:
            for c in range(E*water//100//C+1):
                for d in range(E*water//100//D+1):
                    suger = C*c + D*d
                    if suger+water <= F and E*water//100 >= suger:
                        try:
                            n = suger / (suger+water)
                            ans.append([n,suger+water,suger])
                        except:
                            pass
ans.sort()
print(ans[-1][1],ans[-1][2])




Measured memory_bytes: 147936
import math
n,d = map(int,input().split())
x = [list(map(int,input().split())) for _ in range(n)]

ans = 0
for idx1,el1 in enumerate(x):
    for idx2, el2 in enumerate(x):
        dis = 0
        if idx1 < idx2:
            for i in range(d):
                dis += (el1[i] - el2[i])**2
            if math.sqrt(dis).is_integer():
                ans += 1
print(ans)

Measured memory_bytes: 3188
#include <iostream>
using namespace std;
#define MIN(X,Y) ((X)<(Y)?(X):(Y))

int main(void){
  int n,l,r,ans=0;
  
  cin >> n;
  cin >> l; ans+=l;
  for (int i=0; i<n-2; i++){
    cin >> r;
    ans += MIN(l,r);
    l=r;
  }
  ans += l;
  cout << ans << endl;
  return 0;
}


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

int main() {
  int w,h,n,x,y,a,x_l = 0,y_d = 0,ans;
  cin >> w >> h >> n;
  int x_r = w, y_u = h;
  for(int i = 0; i < n; i++){
    cin >> x >> y >> a;
    if(a == 1){
      if(x > x_l)
        x_l = x;
    }
    if(a == 2){
      if(x < x_r)
        x_r = x;
    }
    if(a == 3){
      if(y > y_d)
        y_d = y;
    }
    if(a == 4){
      if(y < y_u)
        y_u = y;
    }
  }
  if(x_r > x_l){
    ans = x_r - x_l;
  }else{
    ans = 0;
  }
  if(y_d < y_u){
    ans *= y_u - y_d;
  }else{
    ans = 0;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
using System;
using System.Linq;

namespace ITP1_2_C
{
    class Program
    {
        static void Main(string[] args)
        {
            var query = Console.ReadLine().Split(' ')
                .Select(s => int.Parse(s))
                .OrderBy(s => s);
            var ans = "";
            foreach (var s in query)
            {
                ans += " " + s;
            }
            Console.WriteLine(ans.TrimStart());
        }
    }
}

Measured memory_bytes: 10104
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

typedef struct node{
  int key;
  struct node *p, *l, *r;
}Node;

Node *tmp, *NIL;

void insert(int);
void inorder(Node *);
void preorder(Node *);

int main()
{
  int m, i, k;
  char c[1000];

  scanf("%d", &m);

  for( i = 0 ; i < m ; i++ ){
    scanf("%s", c);
    if( strcmp(c, "insert") == 0 ){
      scanf("%d", &k);
      insert(k);
    }
    else if( strcmp(c, "print") == 0 ){
      inorder(tmp);
      printf("\n");
      preorder(tmp);
      printf("\n");
    }
  }

  return 0;
}

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

  z = malloc(sizeof(Node));
  z->key = k;
  z->l = NIL;
  z->r = NIL;

  while( x != NIL ){
    y = x;
    if( z->key < x->key ) x = x->l;
    else x = x->r;
  }

  z->p = y;
  if( y == NIL ) tmp = z;
  else if( z->key < y->key ) {
    y->l = z;
  } else y->r = z;

}

void inorder(Node *u){
  if( u == NIL ) return;
  inorder(u->l);
  printf(" %d", u->key);
  inorder(u->r);
}

void preorder(Node *u){
  if( u == NIL ) return;
  printf(" %d", u->key);
  preorder(u->l);
  preorder(u->r);
}

Measured memory_bytes: 24040
/*
ID: learnin7
TASK: test
LANG: C++                 
*/
/* LANG can be C++11 or C++14 for those more recent releases */
#include<bits/stdc++.h>

/*  Macros from Endagorion */
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef double ld;


int main(){
        
    ios_base::sync_with_stdio(0);
    
    //ofstream fout ("test.out");
    //ifstream fin ("test.in");
    //fin >> a >> b;
    //fout << a+b << endl;
    int n;
    cin>>n;
    string s;
    cin>>s;
    for(int i=0;i<s.length();i++){
        int c = s[i]-'A'+1;
        c += n;
        if(c%26!=0) c = c%26;
        else        c = 26;
        s[i] = 'A'+(c-1);
    }
    cout<<s<<endl;
    return 0;
}



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

#define int long long
#define double long double

#define REP(i, b) for(int i = 0; i < (b); i++)
#define REPS(i, b) for(int i = 1; i <= (b); i++)
#define ALL(v) (v).begin(), (v).end()

#define fi first
#define se second
#define pb push_back
#define mp make_pair

using namespace std;

using pi = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vs = vector<string>;
using vb = vector<bool>;
using vpi = vector<pi>;
using vvi = vector<vi>;
using vvb = vector<vb>;

const int INF = 1e14;
const int MOD = 1e9+7;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

typedef struct
{
    int to;
    int cost;
}edge;


signed main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    int V, E, r; cin >> V >> E >> r;
    vector<vector<edge>> G(V);
    REP(i, E)
    {
        int s, t, d; cin >> s >> t >> d;
        G[s].pb(edge{t, d});
    }

    vi d(V, INF); d[r] = 0;
    priority_queue<pi, vector<pi>, greater<pi>> q;
    q.push(mp(d[r], r));
    while(!q.empty())
    {
        pi p = q.top(); q.pop();
        int dist = p.fi, n = p.se;
        if(dist > d[n]) continue;
        for(edge e : G[n])
        {
            if(chmin(d[e.to], dist + e.cost)) q.push(mp(d[e.to], e.to));
        }
    }
    REP(i, d.size()) (d[i] == INF) ? cout << "INF" << endl: cout << d[i] << endl;
}


Measured memory_bytes: 19356
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
//using ll=long long;
//#define int long long
#define _CRT_SECURE_NO_WARNINGS
#define rep(i, n) for (int i = 0; i < n; i++)
#define _GLIBCXX_DEBUG
const int MOD = 1e9 + 7;
const int INF = 1e18 + 9;
constexpr long double pi = 3.141592653589793238462643383279; //円周率
/*---------------------便利な関数--------------------------------------*/
int fact(int i) {       //階乗
    if (i == 0) return 1;
    return (fact(i - 1)) * i;
}

int gcd(int a, int b) {        //最大公約数
    if (b == 0) return a;
    return gcd(b, a % b);
}

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

int keta(int n) {        //桁数を求める
    if (n == 0) return 1;
    int count = 0;
    while (n != 0) {
        n /= 10;
        count++;
    }
    return count;
}

int ketasum(int n) {    //各桁の和
    int sum = 0;
    while (n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
//最小化問題(DP)
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
//最大化問題(DP)
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

//dp注意点
//問題の種類	 初期化する値	 備考
//最小化問題 	INF	
//最大化問題	    -INF	 テーブル全体で 00 以上の値しかとらないことがわかっていれば −1−1 でもいいですし、00 でもいい場合もあります
//数え上げ問題	00	
//確率問題	      00	
//Yes/No 判定問題	False
/*-------------ここまで---------------------------------------------*/

/*signed*/int main() {
    int a, b;
    cin >> a >> b;
    int sum = max({ a + b,a - b,a * b });
    cout << sum << endl;
    return 0;
}

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

int main() {
  long long int N;
  cin >> N;
  long long int ans = 0;
  for (long long int i = 1; i <= N; i++) {
    ans += i * (N - i + 1);
  }
  for (long long int i = 0; i < N - 1; i++) {
    long long int u, v;
    cin >> u >> v;
    ans -= min(u, v) * (N - max(u, v) + 1);
  }
  cout << ans << endl;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define bit(n) (1<<(n))
#define ii(x) int x; cin >> (x)
#define ii2(x, y) int x, y; cin >> (x) >> (y)
#define ii3(x, y, z) int x, y, z; cin >> (x) >> (y) >> (z)
#define yn(x, ok, ng) cout << ((x)?(ok):(ng)) << endl
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
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;}
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}
int const INF = 1001001001;


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

ll n,k;
cin >> n >> k;
vl a(n);
rep(i,n) cin >> a[i];

rep(q,1000) {
    vl table(n+1);
    rep(i,n) {
        if(i - a[i] < 0) {
            table[0]++;
        } else {
            table[i-a[i]]++;
        }
        if(i + a[i] + 1 < n) {
            table[i + a[i] + 1]--;
        }
    }
    ll cur = 0;
    rep(i,n) {
        cur += table[i];
        a[i] = cur;
    }
    if(q == k-1) break;
}

if(k <= 1000) {
    rep(i,n) {
        if(i == n-1) {
            cout << a[i] << endl;
        } else {
            cout << a[i] << ' ';
        }
    }
    return 0;
}

rep(i,n) {
    if(i == n-1) {
        cout << n << endl;
    } else {
        cout << n << ' ';
    }
}
return 0;
}

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

using namespace std;

int main(){
    vector<int> takoyaki;
    int n,sum=0;
    cin>>n;
    takoyaki.resize(n);
    for(int i=0; i<n; i++){
        cin>>takoyaki[i];
    }
    for(int i=0; i<n-1; i++){
        for(int j=i+1; j<n; j++){
            sum+=takoyaki[i]*takoyaki[j];
        }
    }
    cout<<sum<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#define ll long long
using namespace std;
int main(){
    ll a,b,c,x,y;
    cin>>a>>b>>c>>x>>y;
    ll min=10000000000;
    for(ll i=0;i<=max(x,y)*2;i+=2){
        ll pr=c*i+a*max((ll)0,x-i/2)+b*max((ll)0,y-i/2);
        if(min>pr){
            min=pr;
        }
    }
    cout<<min<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <vector>
#include <string>

using namespace std;

string correct(int i)
{
	if(i % 15 == 0)
	{
		return("FizzBuzz");
	}
	else if(i % 3 == 0) 
	{
		return("Fizz");
	}
	else if(i % 5 == 0) 
	{
		return("Buzz");
	}
	else
	{
		stringstream ss;
		ss << i;
		return ss.str();
	}
}

void solve()
{
	int n , m;
	while(cin >> m >> n, m || n)
	{
		int player[1001];
		for(int i = 0; i < 1000; ++i)
		{
			player[i] = 1;
		}
		int remain = m;
		int now_player = 0;
		for(int i = 0; i < n; ++i)
		{
			string s;
			cin >> s;
			if(remain <= 1) 
			{
				continue;
			}
			if(s != correct(i + 1))
			{
				player[now_player] = 0;
				--remain;
			}
			++now_player;
			if(now_player >= m) 
			{
				now_player = 0;
			}
			while(player[now_player] == 0)
			{
				++now_player;
				if(now_player >= m) 
				{
					now_player = 0;
				}
			}
		}
		bool first = false;
		for(int i = 0; i < m; ++i)
		{
			if(player[i] == 1) 
			{
				cout << (first ? " " : "") << i + 1;
				first = true;
			}
		}
		cout << endl;
	}
}

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

Measured memory_bytes: 1236
#include<stdio.h>
int main(void){
  char *s="python3 -c\""
"t=open(0).read();print('I mPp'[t.count('#')<int(t[0])+int(t[2])::2]+'ossible')\n"
"\"";
  system(s);
  return 0;
}            

Measured memory_bytes: 3280
#include "iostream"
#include "algorithm"
#include "string"
using namespace std;

int main() {
	int n, a[100005];
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	sort(a, a + n);
	int ans = a[n / 2] - a[n / 2 - 1];
	cout << ans << endl;
}

Measured memory_bytes: 640
<?php

//??????????????????
$inputLine = trim(fgets(STDIN));

//????§???????????????§?????????????§???¢???????¨???????
list($rectHeight,$rectWidth) = explode(" ", $inputLine);

//??¢????¨????
$area = $rectHeight * $rectWidth;

//??¨??????????¨????
$length = $rectHeight * 2 + $rectWidth * 2;

echo $area." ".$length;

?>

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

using namespace std;
#define ll long long
#define rep(i, n) for (int i = 0; i < (n); ++i)
double const PI = 3.1415926535897932384626433;

int main() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    int x = (a + d - 1) / d;
    int y = (b + c - 1) / b;
    if (x >= y) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <string>
#include <map>
#include <cmath>
#define f(i,n) for(int i=0;i<n;i++)
#define mod 1e9+7
#define chk(d) cout<<d<<endl
using namespace std;


int main()
{ int n,m,k;
  cin>>n>>k;
  vector<int>v;
  f(i,n)
  {
      int a;
      cin>>a;
      v.push_back(a);
  }
  int dp[n];
  f(i,n)dp[i]=mod;
  dp[0]= 0;
    dp[1] = abs(v[1]-v[0]);
  for(int i = 1;i<n-1;i++)
  {   for(int j=1;j<=k && j<=i +1;j++)
      dp[i+1] = min(dp[i-j+1]+abs(v[i-j+1]-v[i+1]), dp[i+1]);
     // dp[i+1] = min(dp[i]+abs(v[i-1]-v[i+1])-abs(v[i]-v[i-1]),dp[i+1]);

  }
  //f(i,n)cout<<dp[i]<<" ";
 cout<<dp[n-1];

}



Measured memory_bytes: 1144
#include <iostream>
#include <string>
#include <map>
using namespace std;

string convert(string str) {
  map<char, string> d;
  d[' '] = "101";
  d['\''] = "000000";
  d[','] = "000011";
  d['-'] = "10010001";
  d['.'] = "010001";
  d['?'] = "000001";
  d['A'] = "100101";
  d['B'] = "10011010";
  d['C'] = "0101";
  d['D'] = "0001";
  d['E'] = "110";
  d['F'] = "01001";
  d['G'] = "10011011";
  d['H'] = "010000";
  d['I'] = "0111";
  d['J'] = "10011000";
  d['K'] = "0110";
  d['L'] = "00100";
  d['M'] = "10011001";
  d['N'] = "10011110";
  d['O'] = "00101";
  d['P'] = "111";
  d['Q'] = "10011111";
  d['R'] = "1000";
  d['S'] = "00110";
  d['T'] = "00111";
  d['U'] = "10011100";
  d['V'] = "10011101";
  d['W'] = "000010";
  d['X'] = "10010010";
  d['Y'] = "10010011";
  d['Z'] = "10010000";

  map<string, char> e;
  e["00000"] = 'A';
  e["00001"] = 'B';
  e["00010"] = 'C';
  e["00011"] = 'D';
  e["00100"] = 'E';
  e["00101"] = 'F';
  e["00110"] = 'G';
  e["00111"] = 'H';
  e["01000"] = 'I';
  e["01001"] = 'J';
  e["01010"] = 'K';
  e["01011"] = 'L';
  e["01100"] = 'M';
  e["01101"] = 'N';
  e["01110"] = 'O';
  e["01111"] = 'P';
  e["10000"] = 'Q';
  e["10001"] = 'R';
  e["10010"] = 'S';
  e["10011"] = 'T';
  e["10100"] = 'U';
  e["10101"] = 'V';
  e["10110"] = 'W';
  e["10111"] = 'X';
  e["11000"] = 'Y';
  e["11001"] = 'Z';
  e["11010"] = ' ';
  e["11011"] = '.';
  e["11100"] = ',';
  e["11101"] = '-';
  e["11110"] = '\'';
  e["11111"] = '?';
  string str2 = "";
  for(int i = 0; i < str.length(); i++) {
    str2 += d[str[i]];
  }
  int n = 5 - str2.length() % 5;
  for(int i = 0; n < 5 && i < n; i++) {
    str2 += "0";
  }
  string str3;
  for(int i = 0; i < str2.length(); i += 5) {
    str3 += e[str2.substr(i, 5)];
  }
  return str3;
}

int main() {
  string str;
  while(getline(cin, str)) {
    cout << convert(str) << endl;
  }
  return 0;
}

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

using namespace std;

int main() {
    int n;
    cin >> n;
    vector<double> x(n), y(n);
    for (int i = 0; i < n; i++) {
        cin >> x[i];
    }
    for (int i = 0; i < n; i++) {
        cin >> y[i];
    }
    double d1 = 0.0, d2 = 0.0, d3 = 0.0, dinf = 0.0;
    for (int i = 0; i < n; i++) {
        double d = abs(x[i] - y[i]);
        d1 += d;
        d2 += d * d;
        d3 += d * d * d;
        dinf = max(d, dinf);
    }
    d2 = sqrt(d2);
    d3 = pow(d3, 1.0 / 3.0);
    cout << fixed << setprecision(6);
    cout << d1 << endl << d2 << endl << d3 << endl << dinf << endl;
    return 0;
}



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

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

int main() {
    int N, T, A, temp;
    
    std::cin >> N >> T >> A;

    int res = 0;
    int current = 0;
    int temp_diff = 0;
    for (int i=0; i<N; ++i) {
        std::cin >> temp;
        if (i==0) {
            current = abs_diff((T*1000 - temp*6), A * 1000);
            res = i + 1;
        } else {
            temp_diff = abs_diff((T*1000 - temp*6), A * 1000);
            if (temp_diff < current) {
                current = temp_diff;
                res = i + 1;
            }
        }
        //std::cout << "i=" << i << ", res=" << res << std::endl;
    }
    std::cout << res << std::endl;
}

Measured memory_bytes: 256
#include<vector>
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include <iostream>
#include <algorithm>
#include <map>
#include <cmath>
#include<queue>
#include <sstream>
#include <set>

const long long MOD = 1000000007;
using namespace std;
typedef long long llong;

//int isalpha(char ch): ch がアルファベットなら true を返す
//int isdigit(char ch): ch が数字なら true を返す
//int islower(char ch): ch が小文字なら true を返す
//int isupper(char ch): ch が大文字なら true を返す
//int tolower(char ch): ch の小文字を返す
//int toupper(char ch): ch の大文字を返す

//string型
//size()	文字数を返す
//Insert()	（指定した場所に）文字・文字列を挿入する
//erase()	（指定した場所の）文字・文字列を削除する
//clear()	すべての文字を削除する
//substr()	文字列の（指定した）部分文字列を返す
//replace()	（指定した）部分文字列を新しい文字列に置換する
//c_str()変換
//文字列の比較は、<=や==などを使え
//replace関数を使い、簡単に文字列を置換
//リバース関数：reverse(str.begin(), str.end());
//map<type, type> dict;で宣言
//グラフ理論用変数
//vector<vector<llong> > graph(N);

//ソート
//降順sort(v.begin(), v.end(), std::greater<Type>());

//大文字から小文字へんかん
//w[i] = w[i]-'A'+'a';

//vector
//assignメソッド　引数：サイズ、値
//与えられたサイズと値でvectorを初期化する

//queueクラス
//find()次に取り出す値の表示をする。
//pop()値を取り出す。戻り値はなし
//push()キューに値をプッシュする

//priority_queueクラス

//切り上げ
//ceil
//floor

bool check(vector<string> &MapA, vector<string> &MapB, int y, int x){
    for(int i=0; i<MapB.size(); i++){
        for(int j=0; j<MapB.size(); j++){
            if(MapA[y+i][x+j]!=MapB[i][j]){
                return false;
            }
        }
    }
    return true;
}

int main(){
    llong N,M;
    cin >> N >> M;
    vector<string> MapA;
    vector<string> MapB;
    string S;
    for(int i=0; i<N; i++){
        cin >> S;
        MapA.push_back(S);
    }
    for(int i=0; i<M; i++){
        cin >> S;
        MapB.push_back(S);
    }
    for(int i=0; i<N-M+1; i++){
        for(int j=0; j<N-M+1; j++){
            if(check(MapA, MapB, i, j)){
                cout << "Yes" << endl;
                exit(0);
            }
        }
    }
    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3100
#include<iostream>
#include<sstream>
#include<iomanip>
#include<bitset>
#include<map>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#define lli long long int
#define uli unsigned long long int
#define inf 999999999999999999
#define rep(i,n,m) for(lli i=(lli)(n);i<(lli)(m);++i)
#define reep(i,n,m) for(int i=(int)(n);i<=(int)(m);++i)
#define per(i,m,n) for(lli i=(int)(m)-1;i>=(int)(n);--i)
#define st(n) sort(n.begin(), n.end())
#define rev(n) reverse(n.begin(),n.end())
#define ou(S) cout << S << endl
#define pb(n) push_back(n)
#define ue(N) N.erase(unique(N.begin(),N.end()),N.end());
#define nou(S) cout << S
#define hou(S) cout << setprecision(30) << S << endl
#define vec(K,L,N,S) vector<L> K(N,S)
#define dv(K,L,N,M,S) vector<vector<L>> K(N,vector<L>(M,S))
#define tv(K,L,N,M,R,S) vector<vector<vector<L>>> K(N,vector<vector<L>>(M,vector<L>(R,S)))
#define pint pair<lli,lli>
#define paf(L,R) pair<L,R>
#define mod 1000000007
#define maxx 5100000
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
using namespace std;

int main(){
  int n;
  cin>>n;
  vector<int> p(n),q(n);
  for(int i=0;i<n;++i)
    cin>>p[i];
  for(int i=0;i<n;++i)
    cin>>q[i];
  vector<int> a(n);
  for(int i=0;i<n;++i)
    a[i]=i+1;
  int ansp=0,ansq=0;
  
  int cou=0;
  do{
    ++cou;
    bool pb=true,qb=true;
    for(int i=0;i<n;++i){
      if(a[i]!=p[i])
        pb=false;
      if(a[i]!=q[i])
        qb=false;
    }
    if(pb)
      ansp=cou;
    if(qb)
      ansq=cou;
  }while(next_permutation(a.begin(),a.end()));
  cout<<abs(ansp-ansq)<<endl;      
}

Measured memory_bytes: 3604
import sys
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mod = 10**9 + 7

H, N = rl()
A = rl()

s = sum(A)

if H <= s:
	print('Yes')
else:
	print('No')


Measured memory_bytes: 52316
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define INF 0x3f3f3f3f
#define lli long long int
#define ulli unsigned long long int
#define for0(i,n) for(long long int i=0;i<(long long int)n;i++)
#define for1(i,n) for(long long int i=1;i<=(long long int)n;i++)
#pragma GCC target ("sse4.2")
 
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    lli n;
    cin>>n;
    lli arr[n];
    for0(i,n)
        cin>>arr[i];
    lli ans=0;
    for0(i,n-2){
            for(lli j=i+1;j<n-1;j++){
                if(arr[j]!=arr[i]){
                    for(lli k=j+1;k<n;k++){
                        if(arr[k]!=arr[i] && arr[k]!=arr[j]){
                            if(arr[i]+arr[j]>arr[k] && arr[i]+arr[k]>arr[j] && arr[k]+arr[j]>arr[i])
                                ++ans;
                        }
                    }
                }
            }
        
    }
    cout<<ans<<"\n";
}

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

using namespace std;
vector<int> prime;

int main(){
	for(int i = 2;i < 300000;i++){
		if(i % 7 == 1 || i % 7 == 6){
			bool isPrime = true;
			for(int j = 0;j < prime.size();j++){
				if(prime[j]*prime[j] > i) break;
				if(i % prime[j] == 0){
					isPrime = false;
					break;
				}
			}
			if(isPrime) prime.push_back(i);
		}
	}
	
	while(true){
		int n;
		cin >> n;
		if(n == 1) break;
		
		cout << n << ":";
		for(int i = 0;i < prime.size();i++){
			if(n % prime[i] == 0) cout << " " << prime[i];
		}
		cout << endl;
	}
	
	return 0;
}


Measured memory_bytes: 3240
function main(input = "") {
    let lines = input.split("\n");
    let N = 0 | lines[0];
    let arr = lines[1].split(" ").map((v) => (0 | v));
    arr.sort((a, b) => b - a);

    let res = 0;
    for (let i = 1; i < N; i++) {
        res += arr[(0 | (i * 0.5))];        
    }

    return res;
}

//******************************
exports.main = main;

function Main(input) {
    console.log(main(input.trim()));
}

if (process.argv[2] !== "test") {
    Main(require("fs").readFileSync("/dev/stdin", "utf8"));
}

Measured memory_bytes: 52912
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 27 22:08:13 2019

@author: yuta
"""

N = int(input())
d = []
for i in range(int(N)):
    d.append(int(input()))

def main(d):
    d_uniq = list(set(d))
    print(len(d_uniq))

main(d)

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

int main(){
	int n;
	double s[1000];
	double m;
	double a;
	double b;
	while(true) {
		cin >> n;
		if ( n == 0 ) break;
		m=0;
		for (int i = 0 ;i<n ;i++ ) {
			cin >> s[i];
			m+=s[i];
		}
		m = m / n;
		a=0;
		for (int i = 0 ;i<n ;i++ ) {
			b = s[i] - m;
			a += b*b;
		}
		cout << fixed << sqrt( a/n ) << endl;
	}
	return 0;
}



Measured memory_bytes: 3224
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
#include<iterator>
#include<list>

using namespace std;

typedef  long long int lint;

#define rep(i, n) for (lint i = 0; i < n; i++)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define mp make_pair
#define enld endl
#define P pair<lint,lint>

int main() {
	lint N;
	cin >> N;
	if (N % 1000 == 0) {
		cout << 0 << enld;
	}
	else {
		cout << 1000 + (N - N % 1000)-N << enld;
	}
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
using ll= long long ;
using P = pair<ll,ll>;
#define rep(i,n) for (ll i = 0; i<(ll)(n); i++)
#define mod 998244353
#define pi 3.141592653589793
typedef vector<ll> vcl;

ll gcd(ll a,ll b){
    if(b>a) swap(a,b);
    if(b==0) return a;
    return gcd(b,a%b);
}
ll lcm(ll a, ll b){
    ll g=gcd(a,b);
    return a/g*b;
}
ll rep_jijo(ll n,ll x){
    if(x==0) return 1;
    if(x%2==0){
        ll t =rep_jijo(n,x/2);
        return t*t%mod;
  }
  return n*rep_jijo(n,x-1)%mod;
}
ll c2(ll n){
    return n*(n-1)/2;
}
  struct UnionFind {
  vector<int> d;
  UnionFind(int n=0): d(n,-1) {}
  int find(int x) {
    if (d[x] < 0) return x;
    return d[x] = find(d[x]);
  }
  bool unite(int x, int y) {
    x = find(x); y = find(y);
    if (x == y) return false;
    if (d[x] > d[y]) swap(x,y);
    d[x] += d[y];
    d[y] = x;
    return true;
  }
  bool same(int x, int y) { return find(x) == find(y);}
  int size(int x) { return -d[find(x)];}
};
int main(){
 ll n,x,m;
 cin>>n>>x>>m;
 map<ll,ll> mp;
 map<ll,ll> mq;
 ll p = min(n,m);
 vcl a(p);
 ll z = 0,y = 0,an = x;
 a[1]=x;
 mp[x]=1;
 mq[x]=1;
 for (ll i=2;i<=n;i++){
   x=(x*x)%m  ;
   a[i] = x;
   if(mp[x]==1){ 
     y = i;
     z = mq[x];
     
     break;
   }
    mq[x] = i;
    mp[x] = 1;
    an+=x;
 }

if(z==0){cout<<an<<endl; return 0;}

ll ans1=0,ans2=0;
 for(ll i=1;i<=z-1;i++){
   ans1+=a[i];
 }
 ll kk=(n+1-z)%(y-z);
 ll k =((n+1-z)-kk)/(y-z);

 for(ll i=z;i<=y-1;i++){
   ans2+=a[i];
 }

ll ans = ans1+k*ans2;
for(ll i=z;i<=z+kk-1;i++){
  ans+=a[i];}

cout<<ans<<endl;
}




Measured memory_bytes: 10292
#include<iostream>
using namespace std;
using ll = long long;

int main() {
	ll x, ans = 0;
	cin >> x;
	if (x > 11) { // x/11は5と6を繰り返したときの回数
		ans = (x / 11) * 2; x %= 11;
	}
	if (x > 0) {//11以下のときの処理
		x -= 6; ans++;
	}
	if (x > 0) {
		x -= 5; ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define endl "\n"
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

int main(){
    fast;
    
    ll x,y,a,b,c;
    cin>>x>>y>>a>>b>>c;
    
    vector<ll> arr(a), brr(b), crr(c);
    for(ll i=0;i<a;i++)
        cin>>arr[i];
    for(ll i=0;i<b;i++)
        cin>>brr[i];
    for(ll i=0;i<c;i++)
        cin>>crr[i];
    
    sort(arr.rbegin(), arr.rend());
    sort(brr.rbegin(), brr.rend());
    sort(crr.rbegin(), crr.rend());
    
    vector<ll> final;
    for(ll i=0;i<x;i++)
        final.push_back(arr[i]);
    for(ll i=0;i<y;i++)
        final.push_back(brr[i]);
    for(ll i=0;i<min(x+y,c);i++)
        final.push_back(crr[i]);
    
    sort(final.rbegin(), final.rend());
    
    ll ans = 0;
    for(ll i=0;i<x+y;i++)
        ans += final[i];
    
    cout<<ans<<endl;
    
    return 0;
}

Measured memory_bytes: 8944
import java.util.*;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    String ans = "";
    for (int i=0;i<S.length();i++){
      ans = ans + "x";
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 23252
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		String s = scan.next();
		int x =0;
		int maxX=0;

		for(int i=0;i<n;i++) {
			if(s.charAt(i)=='I') {
				x++;
				if(x>maxX) {
					maxX = x;
				}
			}else {
				x--;
			}
		}
		System.out.println(maxX);
	}

}


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

bool isprime(int p) {
	if (p == 1) return false;
	for (int i = 2; i <= sqrt(p); i++) {
		if (p%i == 0) return false;
	}
	return true;
}

int n;

int main() {
	cin >> n;
	for (int i = 11; i <= 55555; i += 10) {
		if (isprime(i) == true) {
			if (i != 11) cout << " ";
			cout << i; n--;
		}
		if (n == 0) break;
	}
	cout << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
const int N = 1e6 + 5, MOD = 1e9 + 7;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());



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

    int n, k;
    cin>>n>>k;
    if(k == 1){
        cout<<0;
    }
    else{
        int x = n/k;
        int rem = n%k;
        cout<<rem;
    }


    return 0;
}




Measured memory_bytes: 256
A = [0b11000000, 0b11000000]
B = [0b10000000, 0b10000000, 0b10000000, 0b10000000]
C = [0b11110000]
D = [0b01000000, 0b11000000, 0b10000000]
E = [0b11000000, 0b01100000]
F = [0b10000000, 0b11000000, 0b01000000]
G = [0b01100000, 0b11000000]

def match(source, target, width)
  return false  if source.length != target.length
  
  (9 - width).times{|n|
    found = true
    source.length.times{|l|
      found = false   if source[l] ^ target[l] >> n != 0
    }
    return true  if found
  }
  return false
end

def cutFigure(figure)
  subFigure = Array.new
  figure.each{|n|
    subFigure << n  if n != 0
  }
  return subFigure
end

def findFigure(source)
  return "A"  if match(source, A, 2)
  return "B"  if match(source, B, 1)
  return "C"  if match(source, C, 4)
  return "D"  if match(source, D, 2)
  return "E"  if match(source, E, 3)
  return "F"  if match(source, F, 2)
  return "G"  if match(source, G, 3)
end


begin
  figure = Array.new
  8.times{
    figure << $stdin.gets.to_i(2)
  }
  puts findFigure(cutFigure(figure))
end while $stdin.gets

Measured memory_bytes: 6108
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;   
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define sz(a) (ll)(a.size())
const int M = 102;
int a[M];
int main()
{
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int n;
	cin>>n;
	int sum = 0;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
		sum += a[i];
	}
	int df = 1e9,id = -1;
	for(int i=1;i<=n;i++)
	{
		int z = abs(sum-a[i]*n);
		if(z < df)
		{
			df = z;
			id = i;
		}
	}
	cout<<id-1<<"\n";
	return 0;
}

Measured memory_bytes: 3604
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <unordered_map>
#include <vector>

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

	struct Info {
		int index;
		int p;
		int birth;
		int numBirth;
	};
	std::vector<Info> info(M);

	for(int i = 0; i < M; i++) {
		info[i].index = i;
		std::cin >> info[i].p >> info[i].birth;
	}

	std::sort(info.begin(), info.end(), [](const Info &a, const Info &b) {
		return a.birth < b.birth;
	});
	std::stable_sort(info.begin(), info.end(), [](const Info &a, const Info &b) {
		return a.p < b.p;
	});

	int num = 1;
	int p = -1;
	for(int i = 0; i < M; i++) {
		if(p != info[i].p) {
			p = info[i].p;
			num = 1;
		}
		info[i].numBirth = num;
		num++;
	}

	std::sort(info.begin(), info.end(), [](const Info &a, const Info &b) {
		return a.index < b.index;
	});

	for(int i = 0; i < M; i++) {
		std::printf("%06d%06d\n", info[i].p, info[i].numBirth);
	}

	return 0;
}

Measured memory_bytes: 3064
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n: usize,
        k: usize,
        a: [usize; n],
    }
    let mut v = vec![0; n];
    for ai in a {
        v[ai - 1] += 1;
    }
    v.sort();
    v.reverse();
    let mut ans = 0;
    for i in k..v.len() {
        if v[i] == 0 {
            break;
        }
        ans += v[i];
    }
    println!("{}", ans);
}


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

typedef long long ll;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define each(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); ++itr)
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define fi first
#define se second

struct frac{
    ll n; //numerator
    ll d; //denominator
};

void printfrac(frac z)
{
    printf("%lld",z.n);
    if(z.d!=1) printf("/%lld",z.d);
    printf("\n");
}

inline ll gcd(ll x, ll y)
{
    if(x<y) swap(x,y);

    if(y==0) return x;
    else return gcd(y,x%y);
}

inline ll lcm(ll x, ll y)
{
    return x/gcd(x,y)*y;
}

frac add(frac a, frac b)
{
    ll G=lcm(a.d,b.d);
    ll g=a.n*(G/a.d)+b.n*(G/b.d);

    ll d=gcd(g,G);
    G/=d;
    g/=d;

    return frac{g,G};
}

int main()
{
    while(1)
    {
        string s;
        cin >>s;
        if(s=="#") break;

        int now=s.size()-1;
        ll pw=2;

        frac ans;

        //first word
        if(s[now]=='h')
        {
            now-=5;
            ans=frac{0,1};
        }
        else
        {
            now-=4;
            ans=frac{90,1};
        }

        //until end of word
        while(now>0)
        {
            if(s[now]=='h')
            {
                now-=5;
                ans=add(ans,frac{-90,pw});
            }
            else
            {
                now-=4;
                ans=add(ans,frac{90,pw});
            }
            pw*=2;
        }

        printfrac(ans);
    }
    return 0;
}

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

int main()
{
  int64_t n, q, T = 0;
  cin >> n >> q;
  queue<pair<string, int>> Q;
  for (int i = 0; i < n; i++)
  {
    string p;
    int t;
    cin >> p >> t;
    Q.push(make_pair(p, t));
  }
  do
  {
    pair<string, int> pt = Q.front();
    Q.pop();
    if (pt.second - q <= 0)
    {
      cout << pt.first << ' ' << T + pt.second << endl;
      T += pt.second;
    }
    else
    {
      Q.push(make_pair(pt.first, pt.second - q));
      T += q;
    }
  } while (!Q.empty());
}


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

#define int long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define uniqueV(x) sort(x.begin(), x.end()); x.erase(unique(x.begin(), x.end()), x.end());
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))
#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))
#define dbg(x) cerr << #x << ": " << x << endl;
#define dbg2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define dbg3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;
#define dbgB(value, size) cerr<<#value<<": "<<bitset<size>(value) << endl;
#define line() cerr << "---------------" << endl;

const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, -1, 1};
const double PI = 3.14159265358979323846;

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

template<typename T>
void print1(T begin, T end) {
  while (begin != end) {
    cerr << (*begin) << " ";
    *begin++;
  }
  cerr << endl;
}

template<typename T>
void print2(T Array, int height, int width) {
  for (int i = 0; i < height; i++) {
    for (int j = 0; j < width; j++) {
      cerr << " " << Array[i][j];
    }
    cerr << endl;
  }
}

void print() { std::cerr << endl; }
template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
  std::cerr << head << " ";
  print(std::forward<Tail>(tail)...);
}

template<class T>
void Add(T &a, const T &b, const T &mod=1000000007) {
  int val = ((a % mod) + (b % mod)) % mod;
  if (val < 0) { val += mod; }
  a = val;
}

template <typename X, typename T> auto vectors(X x, T a) { return vector<T>(x, a); }
template <typename X, typename Y, typename Z, typename... Zs> auto vectors(X x, Y y, Z z, Zs... zs) { auto cont = vectors(y, z, zs...); return vector<decltype(cont)>(x, cont); }

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

signed main() {
  int n;
  cin >> n;
  vec<int> a(n);
  rep (i, n) {
    cin >> a[i];
  }
  sort(all(a));
  int ans = 0;
  ans += a.back() / 2;
  rep (i, n-1) {
    ans += a[i];
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
typedef long long ll;
#define rep(i,a,n) for(int i=a;i<n;i++)
#define rrep(i,n,a) for(int i=n;i>=a;i--)
#define FOR(i,n) for(int i=0;i<n;i++)
#define all(s) s.begin(),s.end()
#define vi vector<int>
#define vvi vector<vector<int>>
#define pcnt(n) __builtin_popcount(n)
const int MOD = 2019;

int pw(int a, int x) {
    if (x == 0) return 1;
    int b = pw(a, x / 2);
    b = (b * b) % MOD;
    if (x % 2)
        return (a * b) % MOD;
    return b;
}

string s;
vector<int>r(200010,0);

void mod2019(){
    rep(i,1,200010){
        r[i] = r[i]*pw(10,i-1);
        r[i]%=MOD;
    }
}

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cin>>s;
    int n = s.length();
    int ans = 0;
    rep(i,1,n+1){
        r[n+1-i] = (int)(s[i-1]-'0');
    }
    mod2019();
    for(int i=1;i<n+1;i++){
        r[i]+=r[i-1];
        r[i]%=MOD;
    }
    map<int,int>resi;
    rep(i,0,n+1){
        resi[r[i]]++;
    }
    for(auto x:resi){
        ans += x.second*(x.second-1)/2;
    }
    cout<< ans <<endl;
}

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

using namespace std;

typedef long long int lld;
typedef pair<int, int> pii;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.precision(15);
    cout << fixed;

    int n = 0;
    cin >> n;

    int t = n / 2 + n % 2;

    cout << (double)t / n << '\n';



    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <stdlib.h>
using namespace std;
int main() {
  int x,k,n;
  vector<int> v,ans;
  cin>>x>>n;
  int r=x+1;
  int l=x-1;
  
  for(int j=0;j<n;j++){
      cin>>k;
      v.push_back(k);
  }
  
  if(find(v.begin(),v.end(),x)==v.end()){
          ans.push_back(x);
         // cout<<"x"<<endl;
  }
  
  while(ans.size()<=0){
      if(find(v.begin(),v.end(),r)==v.end()){
          ans.push_back(r);
                   // cout<<"r"<<endl;
      }
      
      if(find(v.begin(),v.end(),l)==v.end()){
          ans.push_back(l);
                   // cout<<"l"<<endl;
      }
      
      r+=1;
      l-=1;
  }
  stable_sort(ans.begin(),ans.end());
  cout<<ans[0]<<endl;
  return 0;
}

Measured memory_bytes: 3628
import java.util.*;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		if (a <= 9 && b <= 9) {
			System.out.println(a * b);
		} else {
			System.out.println(-1);
		}
		
	}
}

Measured memory_bytes: 21844
#include <cstdio>
#include <climits>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <string>
#include <cstdio>
#include <climits>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <utility>
#include <queue>
#include <cstring>
#include <set>
#define rep(i, n) for (int i = 0; i < int(n); i++)
using namespace std;
long long MOD = 1000000007;
long long INF = 1000000000000000; //10^15
typedef long long ll;
typedef unsigned long long ull;

ll powMod(ll x, ll n) {
  if (n == 0) return 1;
  ll r = powMod(x, n / 2);
  if (n % 2 == 0) return (r * r) % MOD;
  return (r * r % MOD) * x % MOD;
}

int main(void) {

  int n; cin >> n;
  vector< pair<int, int> > card(n);
  rep(i, n) {
    cin >> card[i].first;
  }
  rep(i, n)  {
    cin >> card[i].second;
  }

  ll q = 1LL << n;
  ll ans = LLONG_MAX;
  
  for (ll l = 0; l < q; l++) {
    int c[30];
    rep(i, n) {
      if ((l >> i) & 1) c[i] = card[i].second;
      else c[i] = card[i].first;
    }
    sort(c, c + n);
    vector<int> num(n, -1);
    int ch[30] = {};
    rep(i, n) {
      if ((l >> i) & 1) {
	rep(j, n) {
	  if (card[i].second == c[j] && abs(j - i) % 2 == 1 && ch[j] == 0) {
	    num[i] = j;
	    ch[j] = 1;
	    break;
	  }
	}
      } else {
	rep(j, n) {
	  if (card[i].first == c[j] && abs(j - i) % 2 == 0 && ch[j] == 0) {
	    num[i] = j;
	    ch[j] = 1;
	    break;
	  }
	}
      }
    }
    bool flag = false;
    rep(i, n) if (num[i] == -1) flag = true;
    if (flag) continue;
    //cout << l << endl;
    //rep(i, n) cout << num[i] << " ";
    //cout << endl;
    ll cnt = 0;
    rep(i, n) {
      rep(j, i) {
	if (num[i] < num[j]) cnt++;
      }
      for (int j = i + 1; j < n; j++) {
	if (num[i] > num[j]) cnt++;
      }
      //cout << i << " " << cnt << endl;
    }
    //cout << " " << cnt << endl;
    ans = min(ans, cnt / 2);
  }
  if (ans == LLONG_MAX) cout << -1 << endl;
  else cout << ans << endl;

  return 0;
}
    


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

using pii = pair<int,int>;
using ll = long long;
#define rep(i, j) for(int i=0; i < (int)(j); i++)
#define repeat(i, j, k) for(int i = (j); i < (int)(k); i++)
#define all(v) v.begin(),v.end()
#define debug(x) cerr << #x << " : " << x << endl

template<class T> bool set_min(T &a, const T &b) { return a > b  ? a = b, true : false; }
template<class T> bool set_max(T &a, const T &b) { return a < b  ? a = b, true : false; }
// vector
template<class T> istream& operator >> (istream &is , vector<T> &v) { for(T &a : v) is >> a; return is; }
template<class T> ostream& operator << (ostream &os , const vector<T> &v) { for(const T &t : v) os << "\t" << t; return os << endl; }
// pair
template<class T, class U> ostream& operator << (ostream &os , const pair<T, U> &v) { return os << "<" << v.first << ", " << v.second << ">"; }

const int INF = 1 << 30;
const ll INFL = 1LL << 60;


class Solver {
  public:
    bool solve() {
        int N; cin >> N;
        vector<ll> A(N); cin >> A;
        sort(all(A));
        int ans = 0;
        ll sum = 0;
        rep(i, N) {
            if(sum * 2 < A[i]) ans = N - i; 
            sum += A[i];            
        }
        cout << ans << endl;                       
        return 0;
    }
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    Solver s;
    s.solve();
    return 0;
}


Measured memory_bytes: 1024