akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
using namespace std;
 
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
 
    int64_t N;
    cin >> N;

    for(int64_t h = 1; h <= 3500; ++h){
        for(int64_t n = 1; n <= 3500; ++n){
            if(4 * h * n - N * n - N * h == 0){
                continue;
            }
            if(N * h * n % (4 * h * n - N * n - N * h) == 0 && 4 * h * n - N * n - N * h > 0 && N * h * n > (4 * h * n - N * n - N * h)){
                int64_t w = N * h * n / (4 * h * n - N * n - N * h);
                cout << h << " " << n << " " << w << endl;
                return 0;
            }
        }
    }
}

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

int main(void)
{
	int i,j,k,n,a = 0; int ans[55];

       scanf("%d",&n);

	for(i=3;i<=55555 && a < n;i+=2)
	{
		k=0;
		for(j=3;j<=sqrt(i);j+=2)
		{
			if(i%j==0)
			{
				k=1;
				break;
			}
		}

		if(k==0 && i % 5 == 1) {ans[a] = i; a++;}
	}

	for(i = 0; i <n; i++) printf("%d ",ans[i]);

	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <vector>
 
using namespace std;
 
int main() {
  int n;
  cin >> n;
 
  int ans = 0;
  for (int i = 0; i < n; i++) {
    int l, r;
    cin >> l >> r;
    ans += r - l + 1;
  }
 
  cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		ArrayList<Integer> num = new ArrayList<Integer>();
		ArrayList<String> param = new ArrayList<String>();
		int system = 0; // 文字を空白で区切るか　1:はい　2:いいえ

		while (sc.hasNext()) {
			if (sc.hasNextInt()) {
				num.add(sc.nextInt());
			} else {
				if(system==0) param.add(sc.next());
				if(system==1) param.add(sc.nextLine());
			}
		}
		Method(num, param);
	}

	static void Method(ArrayList<Integer> num, ArrayList<String> param) {
		System.out.println(param.get(0).charAt(0) + "" + param.get(1).charAt(0) + "" +  param.get(2).charAt(0));
	}
}

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

using namespace std;

#define SZ(x) (int)(x.size())

using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;

template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  int h, w; cin >> h >> w;
  vvi a(h, vi(w)), b(h, vi(w));
  for(int i=0;i<h;++i) {
    for(int j=0;j<w;++j) {
      cin >> a[i][j];
    }
  }
  for(int i=0;i<h;++i) {
    for(int j=0;j<w;++j) {
      cin >> b[i][j];
    }
  }

  vvi d(h, vi(w));
  for(int i=0;i<h;++i) {
    for(int j=0;j<w;++j) {
      d[i][j] = abs(a[i][j] - b[i][j]);
    }
  }

  vector<vector<vector<bool>>> dp(h, vector<vector<bool>>(w, vector<bool>(6401, false)));
  dp[0][0][d[0][0]] = true;
  for(int i=0;i<h;++i) {
    for(int j=0;j<w;++j) {
      for(int k=0;k<6401;++k) {
        if(!dp[i][j][k]) continue;

        if(i < h-1 && k + d[i+1][j] <= 6400) dp[i+1][j][k+d[i+1][j]] = true;
        if(i < h-1 && abs(k - d[i+1][j]) <= 6400) dp[i+1][j][abs(k-d[i+1][j])] = true;

        if(j < w-1 && k + d[i][j+1] <= 6400) dp[i][j+1][k+d[i][j+1]] = true;
        if(j < w-1 && abs(k - d[i][j+1] <= 6400)) dp[i][j+1][abs(k-d[i][j+1])] = true;
      }
    }
  }

  for(int i=0;i<6400;++i) {
    if(dp[h-1][w-1][i]) {
      cout << i << endl;
      break;
    }
  }
}


Measured memory_bytes: 5760
#pragma GCC optimize ("Ofast")
#pragma GCC target ("avx")
#pragma GCC optimize("unroll-loops")
#pragma region header
#include <bits/stdc++.h>
#define all(a) begin(a), end(a)
#define rep1(i, n) for (decltype(+n) i = 0; i < (n); i++)
#define rrep1(i, n) for (auto i = n - 1; i > static_cast<decltype(i)>(-1); i--)
#define rep2(i, a, b) for (auto i = (a); i < (b); i++)
#define rrep2(i, a, b) for (auto i = b - 1; i >= a; i--)
#define GET_MACRO(_1, _2, _3, NAME, ...) NAME
#define rep(...) GET_MACRO(__VA_ARGS__, rep2, rep1) (__VA_ARGS__)
#define rrep(...) GET_MACRO(__VA_ARGS__, rrep2, rrep1) (__VA_ARGS__)
#define each(i, a) for (auto &&i : (a))
using namespace std;

using vi = vector<int>;

template <class T>
void COUT(const T &x) { cout << x << endl; }

constexpr int lshift(const int &x) noexcept { return 1ll << x; }

#pragma endregion header

void solve(int N, vi a, vi b) {
  int ans = 0;
  vi t(29, 1), u(29);
  rep(i, 28) t[i + 1] = t[i] << 1;
  rep(i, 29) u[i] = t[i] * 2 - 1;
  rrep(k, 29) {
    each(x, a) x &= u[k];
    each(x, b) x &= u[k];
    sort(all(b));
    bool odd = false;
    int t1 = t[k], t2 = t[k] * 2, t3 = t[k] * 3, t4 = t[k] * 4;
    each(x, a) odd ^= ((lower_bound(all(b), t4 - x) - lower_bound(all(b), t3 - x)) ^ (lower_bound(all(b), t2 - x) - lower_bound(all(b), t1 - x))) & 1;
    if(odd) ans += lshift(k);
  }
  COUT(ans);
}


#pragma region main
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);

  int N;
  cin >> N;
  vi a(N);
  for(int i = 0 ; i < N ; i++){
    cin >> a[i];
  }
  vi b(N);
  for(int i = 0 ; i < N ; i++){
    cin >> b[i];
  }
  solve(N, move(a), move(b));
}
#pragma endregion main


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

int main(void){
	int N;
	scanf("%d",&N);
	int a[64],i;
	
	if(N!=0){
	
	for(i=0;i<64;i++){
		a[i]=abs(N%2);
		N-=a[i];
		N/=-2;
	}

	int check=0;
	
	for(i=64;i>=0;i--){
		
		if(a[i]!=0){
			check++;
		}
		
		if(check>0){
			printf("%d",a[i]);
		}
	}
	}
	else{
		printf("0");
	}
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
 
#define ff              first
#define ss              second
#define ll              long long
#define dd              double
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define vll             vector<long long>
#define vdd             vector<double>
#define vpii            vector<pair<int,int>>
#define vpll            vector<pair<long long,long long>>
#define vvi             vector<vector<int>>
#define vvl             vector<vector<long long>>
#define mii             map<int,int>
#define mll             map<long long,long long>
#define umii            unordered_map<int,int>
#define umll            unordered_map<long long,long long>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define rep(i,n)        for(int i=0;i<n;i++)
#define rep2(i,a,b)     for(int i=a;i<b;i++)
#define rev(i,n)        for(int i=n;i>=0;i--)
#define rev2(i,a,b)     for(int i=a;i>=b;i--)
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define inf             9e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define fio             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl            '\n'
#define all(x)          x.begin(),x.end()
#define d0(x)           cout <<x<<" "
#define d1(x)           cout <<x<<endl
#define d2(x,y)         cout <<x<<" "<<y<<endl
#define d3(x,y,z)       cout <<x<<" "<<y<<" "<<z<<endl
#define d4(x,y,z,w)     cout <<x<<" "<<y<<" "<<z<<" "<<w<<endl
#define read2(x,y)      cin>>x>>y
#define read3(x,y,z)    cin>>x>>y>>z
#define read4(x,y,z,w)  cin>>x>>y>>z>>w
#define read5(x,y,z,w,a)cin>>x>>y>>z>>w>>a
#define sz(a)           (int)a.size()
const ll mod=1e9+7;
const double PI = 3.14159265359;
const ll MOD=998244353;
void i_o()
{
   #ifndef ONLINE_JUDGE
   freopen("input.txt", "r", stdin);
   freopen("output.txt", "w", stdout);
   #endif
}

ll mod_exp(ll a,ll ex){
   ll ans=1;
   a=a%MOD;
   while(ex>0){
      if(ex&1){
         ans*=a;
         ans%=MOD;
         ex--;
      }
      a*=a;
      a%=MOD;
      ex=ex>>1;
   }
   return ans;
}

int main() {
   fio
   i_o();
   ll n,m,k;
   cin>>n>>m>>k;
   vll m1(n+1,1);
   ll ini=1;
   for(ll i=1;i<=n;i++){
      ini*=(m-1);
      ini%=MOD;
      m1[i]=ini;
   }
   vll fac(n+1,1);
   ini=1;
   for(ll i=1;i<=n;i++){
      ini*=i;
      ini%=MOD;
      fac[i]=ini;
   }
   ll ans=0;
   for(ll i=n-k;i<=n;i++){
      ll ncr= fac[n-1]*(mod_exp(fac[i-1],MOD-2));
      ncr%=MOD;
      ncr*=mod_exp(fac[n-i],MOD-2);
      ncr%=MOD;
      ncr*=m;
      ncr%=MOD;
      ncr*=m1[i-1];
      ncr%=MOD;
      ans+=ncr;
      ans%=MOD;
   }
   d1(ans); 
    return 0;
}



Measured memory_bytes: 6360
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rep1(i, n) for (ll i = 1; i <= (n); ++i)
#define rrep(i, n) for (ll i = (n - 1); i >= 0; --i)
#define ALL(obj) (obj).begin(), (obj).end()
#define pb push_back
#define to_s to_string
#define len(v) (ll)v.size()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define print(x) cout << (x) << '\n'
#define debug(x) cout << #x << ": " << (x) << '\n'
using namespace std;
using ll = long long;
typedef pair<ll, ll> P;
ll MOD = 1e9 + 7;
ll devc(ll x, ll y) { return 1 + (x - 1) / y; }

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(20);

    ll a, b, c;
    cin >> a >> b >> c;

    if(a + b == c || b + c == a || c + a == b) print("Yes");
    else print("No");

    return 0;
}

Measured memory_bytes: 256
import qualified Data.ByteString.Char8 as C
import Prelude hiding (head, tail, unfoldr)
import Data.Vector.Unboxed
import Data.Vector.Algorithms.Intro

main = C.interact $ C.pack . show . sol . get

get = unfoldr (C.readInt . C.dropWhile (<'0'))

sol v = med b - med a + 1
  where
  n = head v
  a = ifilter (const . even) (tail v)
  b = ifilter (const . odd) (tail v)
  h = n `div` 2
  med w
    | odd n     = u!h
    | otherwise = u!h + u!(h-1)
    where
    u = modify (flip partialSort (h+1)) w

Measured memory_bytes: 22816
package main

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

func max(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton max() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Max(float64(res), float64(nums[i])))
	}
	return res
}
func main() {
	sc := NewBufScanner(os.Stdin)
	n, m, k := sc.Int(), sc.Int(), sc.Int()


	a := make([]int, n+1)
	for i := 1; i <= n; i++ {
		tmp := sc.Int()
		a[i] = a[i-1] + tmp
	}

	b := make([]int ,m+1)
	for i := 1; i <= m; i++ {
		tmp := sc.Int()
		b[i] = b[i-1] + tmp
	}



	var ans int
	for i, _a := range a {
		if _a > k {
			continue
		}
		tmp := i + sort.SearchInts(b, k-_a+1) - 1
		if tmp > ans {
			ans = tmp
		}
	}

	
	// j := m
	// ans := 0
	// for i :=1; i <=n; i++ {
	// 	if a[i] > k {
	// 		continue
	// 	}
	// 	for b[j] > k - a[i] {
	// 		j--
	// 	}
	// 	ans = max(ans, i + j)
	// }

	fmt.Println(ans)
}


type BufScanner struct {
	*bufio.Scanner
}

func NewBufScanner(r io.Reader) *BufScanner {
	s := bufio.NewScanner(r)
	s.Split(bufio.ScanWords)
	// s.Split(scanWords)
	return &BufScanner{s}
}

func scanWords(data []byte, atEOF bool) (advance int, token []byte, err error) {
	start := 0
	for isSpace(data[start]) {
		start++
	}
	for i := start; i < len(data); i++ {
		if isSpace(data[i]) {
			return i+1, data[start:i], nil
		}
	}
	if atEOF && len(data) > start {
		return len(data), data[start:], nil
	}
	return start, nil, nil
}
func isSpace(b byte) bool {
	return b == ' ' || b == '\n' || b == '\r' || b == '\t'
}

func (s *BufScanner) String() string {
	s.Scan()
	return s.Text()
}

func (s *BufScanner) Int() int {
	return int(s.UInt())
}

func (s *BufScanner) UInt() uint64 {
	s.Scan()
	i, e := strconv.ParseUint(s.Text(), 10, 64)
	if e != nil {
		panic(e)
	}
	return i
}


Measured memory_bytes: 7828
#include<iostream>
#include<algorithm>
#include<vector>
#include<stdio.h>
#include<math.h>
using namespace std;
int main(){
    string str;
    int n,s=0;
    cin>>n>>str;
    for(int i=0;i<n;i++){
        if(str[i]!=str[i+1]&&i+1!=n){
            s++;
            i++;
        }
    }
    cout<<s<<endl;
}


Measured memory_bytes: 3332
#include<bits/stdc++.h>
using namespace std;
#define IO ios_base::sync_with_stdio(false)
#define ll long long
#define pi pair<ll,ll>
ll a[800001],  b[500009], lastcall[800000], value[500000];
string s;
vector<ll>v;
int main()
{
    IO;
    ll j=0, n, m, k, kk=1, m1=0, a1=8, grtr=0, a2=20, l, t, ds,r,mx=0, cnt=0, mn=INT_MAX, h=0, mod=1e9+7, i; char ch;
    cin>>ch;
    if(ch>='a') cout<<'a'<<endl;
    else cout<<'A'<<endl;
    return 0;
}


Measured memory_bytes: 3636
#include<stdio.h>
int main() {

	int count=0;
	char s[200001], t[200001];

	scanf("%s%s", s, t);

	for (int i = 0; i <= 200001; i++) {
		if (s[i] == '\0') {
			break;
		}
		if (s[i] != t[i]) {
			count++;
		}
	}

	printf("%d", count);

	return 0;
}

Measured memory_bytes: 2440
#include <cstdio>
int c[29]; long long ret; char s[200009];
int main() {
	scanf("%s", s);
	for (int i = 0; s[i]; i++) ret -= c[s[i] - 97], c[s[i] - 97]++, ret += i;
	printf("%lld\n", ret + 1);
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using ll = long long;
#define FOR(i, k, n) for(ll i = (k); i < (n); i++)
#define FORe(i, k, n) for(ll i = (k); i <= (n); i++)
#define FORr(i, k, n) for(ll i = (k)-1; i > (n); i--)
#define FORre(i, k, n) for(ll i = (k)-1; i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define ALLr(x) (x).rbegin(), (x).rend()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;

const int INF = 1001001001;

int main(void){
  string s;
  cin >> s;
  int n = s.size();
  string ans;
  for(int i = 0; i < n; i+=2) ans += s[i];
  cout << ans << endl;
  return 0;
}

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

int main(){
  int N;
  cin>>N;
  for(int i=0,sum=0;i<N;i++){
  	int l,r;
  	cin>>l>>r;
    sum += r-l+1;
    if(i==N-1){
      	cout<<sum<<endl; 
    }
  }
}

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

#define MAX ((int)2.0e5)

int n, q;
int S[MAX];
int T[MAX];

bool is_exists(int v) {
  return binary_search(S, S + n, v);
  // int l = 0, r = n;
  // while (r - l > 1) {
  // 	int mid = (l + r) / 2;
  // 	if (S[mid] <= v) l = mid;
  // 	else r = mid;
  // }
  // if (S[l] == v) return true;
  // else return false;
}

int main() {
  cin >> n;
  rep(i, n) cin >> S[i];
  cin >> q;
  rep(i, q) cin >> T[i];

  int cnt = 0;
  rep(i, q) {
	if (is_exists(T[i])) cnt++;
  }
  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
#define INF 1007654321
#define PI 3.14159265358979
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define repp(i, s, e) for(int i = (s); i <= (e); ++i)
#define sz(x) ((int)x.size())
#define all(x) x.begin(), x.end()
#define FAST_IO() ios::sync_with_stdio(0); cin.tie(0)
template<typename T>
ostream& operator<<(ostream &os, const vector<T> &v) { for (auto x : v) os << x << " "; return os << "\n"; }

int main() {
    FAST_IO();
    int A, B; cin >> A >> B;
    char C[100][100];
    rep(i, 100) rep(j, 100) {
        if(i < 50) C[i][j] = '#';
        else C[i][j] = '.';
    }
    A--; B--;
    rep(x, A) {
        C[(x/50)*2][(x%50)*2] = '.';
    }
    rep(x, B) {
        C[(x/50)*2 + 51][(x%50)*2] = '#';
    }
    cout << 100 << " " << 100 << "\n";
    rep(i, 100) {
        rep(j, 100) {
            cout << C[i][j];
        }
        cout << "\n";
    }
}

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

#define d(x) cerr << #x ":" << x << endl;
#define dd(x, y) cerr << "(" #x "," #y "):(" << x << "," << y << ")" << endl
#define rep(i, n) for (int i = (int)(0); i < (int)(n); i++)
#define repp(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define all(v) v.begin(), v.end()
#define dump(v)                  \
    cerr << #v ":[ ";            \
    for (auto macro_vi : v) {    \
        cerr << macro_vi << " "; \
    }                            \
    cerr << "]" << endl;
#define ddump(v)                           \
    cerr << #v ":" << endl;                \
    for (auto macro_row : v) {             \
        cerr << "[";                       \
        for (auto macro__vi : macro_row) { \
            cerr << macro__vi << " ";      \
        }                                  \
        cerr << "]" << endl;               \
    }
using lint       = long long;
const int INF    = 1e9;
const lint LINF  = 1e18;
const lint MOD   = 1e9 + 7;
const double EPS = 1e-10;

int main() {
    lint X;
    cin >> X;
    lint a = 100;
    int n = 0;
    while (1) {
        n++;
        a *= 1.01;
        if (a >= X) {
            cout << n << endl;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 3632
#include<iostream>
#include<stdint.h>
using namespace std;
int main() {
	int H, W;
	for (int j = 0;; j++) {
		cin >> H >> W;
		if (H == 0 && W == 0) {
			break;
		}
		for (int a = 0; a < H; a++) {
			for (int i = 0; i < W; i++) {
				if (i == 0 or a == 0 or i == W - 1 or a == H - 1) {
					cout << "#";
				}
				else {
					cout << ".";
				}
			}
			cout << endl;
		}
		cout << endl;
	}
	return 0;
}


Measured memory_bytes: 3096
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9;
using namespace std;
using ll = long long;
int main() {
    ll n , k;
    cin >> n >> k;
    vector <ll> a(n);
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    ll cnt1 = 0, cnt2 = 0;
    for(int i = 0; i < n; i++){
        for(int j = i + 1; j < n; j++){
            if(a[i] > a[j]){
                cnt1++;
            }
        }
    }
    for(int i = 0; i < n; i++) {
        for(int j = 0; j < n; j++) {
            if(a[i] > a[j]){
                cnt2++;
            }
        }
    }
    ll m1 = k;
    ll m2 = (k * (k - 1) / 2) % 1000000007;
    cout << (cnt1 * m1 + cnt2 * m2) % 1000000007 << endl;
}


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

struct SCORE {
    int id, ans, elapsed;
    std::vector<int> miss;
    SCORE() {
        id = 0;
        ans = 0;
        elapsed = 0;
        miss.resize(10);
    }
    bool operator > (const SCORE &y) const {
        if(ans > y.ans) return true;
        if(ans < y.ans) return false;
        if(elapsed < y.elapsed) return true;
        if(elapsed > y.elapsed) return false;
        return id > y.id;
    }

    bool operator == (const SCORE &y) const {
        return (ans == y.ans) && (elapsed == y.elapsed);
    }
};

int main() {
    int M, T, P, R;
    int m, t, p, j;
    int i;

    std::vector< SCORE > player(50);
    while(std::cin >> M >> T >> P >> R) {
        if(M == 0 && T == 0 && P == 0 && R == 0) break;
        
        for(i = 0; i < T; ++i) {
            player[i].id = i + 1;
            player[i].ans = 0;
            player[i].elapsed = 0;
            for(j = 0; j < 10; ++j) {
                (player[i]).miss[j] = 0;
            }
        }
        for(i = 0; i < R; ++i) {
            std::cin >> m >> t >> p >> j;
            if(j == 0) {
                player[t - 1].ans += 1;
                player[t - 1].elapsed += (m + 20*(player[t-1]).miss[p - 1]);
            } else {
                ++(player[t - 1]).miss[p - 1];
            }
        }
        std::sort(player.begin(), player.begin() + T, std::greater<SCORE>());

        SCORE old;
        for(int i=0; i<T; ++i) {
            if(i == 0) {
                std::cout << player[i].id;
                old = player[i];
                continue;
            }

            if(old == player[i]) {
                std::cout << "=" << player[i].id;
            } else {
                std::cout << "," << player[i].id;
            }
            old = player[i];
        }
        std::cout << std::endl;
    }

}


Measured memory_bytes: 3132
#include<iostream>
#include<vector>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>

using namespace std;

inline int read()
{
	int x=0,f=1;char ch=getchar();
	while(ch<'0' || '9'<ch){if(ch=='-')f=-1;ch=getchar();}
	while('0'<=ch && ch<='9')x=x*10+(ch^48),ch=getchar();
	return x*f;
}

const int N=59;

int n,a[N],maxv=-1e9,minv=1e9;
int ansx[N],ansy[N],tot;

int main()
{
	if(fopen("vj.in","r"))
	{
		freopen("vj.in","r",stdin);
		freopen("vj.out","w",stdout);
	}
	
	n=read();
	for(int i=1;i<=n;i++)
	{
		a[i]=read();
		minv=min(minv,a[i]);
		maxv=max(maxv,a[i]);
	}

	if(abs(minv)>abs(maxv))
	{
		int mp=0;
		for(int i=1;i<=n;i++)
		{
			if(a[i]==minv)
				mp=i;
			while(a[i]>0)
				tot++,ansx[i]++,a[i]+=minv;
		}
		for(int i=n-1;i>=1;i--)
			if(a[i]>a[i+1])
				tot++,ansy[i]++,a[i]+=a[i+1];
		printf("%d\n",tot);
		for(int i=1;i<=n;i++)
			while(ansx[i])
				printf("%d %d\n",mp,i),ansx[i]--;
		for(int i=n-1;i>=1;i--)
			while(ansy[i])
				printf("%d %d\n",i+1,i),ansy[i]--;
	}
	else
	{
		int mp=0;
		for(int i=1;i<=n;i++)
		{
			if(a[i]==maxv)
				mp=i;
			while(a[i]<0)
				tot++,ansx[i]++,a[i]+=maxv;
		}
		for(int i=2;i<=n;i++)
			if(a[i-1]>a[i])
				tot++,ansy[i]++,a[i]+=a[i-1];
		printf("%d\n",tot);
		for(int i=1;i<=n;i++)
			while(ansx[i])
				printf("%d %d\n",mp,i),ansx[i]--;
		for(int i=2;i<=n;i++)
			while(ansy[i])
				printf("%d %d\n",i-1,i),ansy[i]--;
	}

	return 0;
}


Measured memory_bytes: 256
s = input()
n = len(s)
acgt = ["A", "C", "G", "T"]
ans = 0
cnt = 0
for i in range(n):
    if s[i] in acgt:
        cnt += 1
        #print(ans, cnt, i)
    else:
        ans = max(ans, cnt)
        #print(ans, cnt, i)
        cnt = 0
print(max(ans, cnt))


Measured memory_bytes: 38384
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
main(){
    ll n,ans=0,i,j;
    cin>>n;
    for(i=2;i<=sqrt(n);i++){
        j=i;
        while(n%j==0) ans++,n/=j,j*=i;
        while(n%i==0) n/=i;
    }
    cout<<ans+(n>1);
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#include <string>
#include <algorithm>
using namespace std; //std::の省略のため
using ll = long long;

ll MOD = 1000000007;

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

    ll k[m], s[n][n];

    for (ll i = 0; i < m; i++)
    {
        cin >> k[i];

        for (ll j = 0; j < k[i]; j++)
        {
            cin >> s[i][j];
        }
    }

    ll p[m];

    for (ll i = 0; i < m; i++)
    {
        cin >> p[i];
    }

    ll bit[n];
    ll cnt[m] = {};
    bool ok;
    ll ans = 0;

    for (ll x = 0; x < (1 << n); x++)
    {
        for (ll i = 0; i < n; i++)
        {
            int div = (1 << i);
            bit[i] = (x / div) % 2;
        }

        ok = true;

        for (ll i = 0; i < m; i++)
        {

            for (ll j = 0; j < k[i]; j++)
            {
                if (bit[s[i][j] - 1] == 1)
                {
                    cnt[i]++;
                }
            }

            if ((cnt[i] % 2) != p[i])
            {
                ok = false;
                cnt[i] = 0;
                break;
            }

            cnt[i] = 0;
        }

        if (ok)
        {
            ans++;
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 3584
///Bismillahir Rahmanir Rahim
#define ll long long
#define ull unsigned long long
#define scf1(a)  scanf("%lld",&a)
#define scf2(a,b)  scanf("%lld %lld",&a,&b)
#define pf    printf
#define pb    push_back
#define rsrt(v) reverse(v.begin(),v.end())
#define srt(v) sort(v.begin(),v.end())
#define ff first
#define ss second
#define spd ios_base::sync_with_stdio(false)
#include<bits/stdc++.h>
using namespace std;
ll dirx[] = {1,-1,0,0};
ll diry[] = {0,0,1,-1};
bool visited[21][21];
string s[21];
ll n,m,mx;
ll level[21][21];
void bfs(ll i, ll j)
{
    queue<pair<ll,ll>>q;

    q.push({i,j});
    visited[i][j]=true;

    while(!q.empty())
    {
        pair<ll,ll>p;

        p = q.front();
       ll a = p.first;
       ll b = p.second;
       q.pop();

       for(ll k=0;k<4;k++)
       {

           ll nx = a+dirx[k];
           ll ny = b+diry[k];

           if(nx>=0&&nx<n&&ny>=0&&ny<m)
           {
               if(visited[nx][ny]==false&&s[nx][ny]=='.')
               {
                   level[nx][ny] = level[a][b]+1;

                   mx = max(mx,level[a][b]+1);
                   visited[nx][ny]=true;

                   q.push({nx,ny});
               }
           }
       }

    }
}
int main()
{
    spd;
    ll i,j,k,l;

    cin>>n>>m;

    for(i=0;i<n;i++)
    {
        cin>>s[i];
    }

    for(i=0;i<n;i++)
    {
        for(j=0;j<m;j++)
        {
            for(k=0;k<n;k++)
            {
                for(l=0;l<m;l++)
                {
                    visited[k][l]=false;
                    level[k][l]=0;
                }
            }

         if(s[i][j]=='.'){

             bfs(i,j);
         }
        }
    }

    cout<<mx<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("O3")

#define fi first
#define se second
#define mp make_pair
#define pi pair<int,int>
#define vi vector<int>
#define vpi vector<pair<int,int>>
#define vll vector<ll>
#define vpll vector<pair<ll,ll>>
#define endl '\n'

#define si(v) int((v).size())
#define all(v) (v).begin(), (v).end()
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i) 
#define rep2(i, n, m) for (ll i = n; i <= (ll)(m); ++i)
#define rep3(i, n, m) for (ll i = n; i >= (ll)(m); --i)

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

using ll = long long;
using ld = long double;
using namespace std;

constexpr ll MOD = 1000000007, INF = 1000000000;

int h, w;
int sx, sy, gx, gy;
char maze[1001][1001];
int dist[1001][1001];

int dijkstra()
{
  priority_queue<pair<int,pi>,vector<pair<int,pi>>,greater<pair<int,pi>>> que;
  que.emplace(0, mp(sx, sy));

  rep(i, 1001) rep(j, 1001) dist[i][j] = INF;
  dist[sy][sx] = 0;

  while (!que.empty()) {
    auto p = que.top(); que.pop();
    int x = p.se.fi, y = p.se.se, d = p.fi;

    if (dist[y][x] < d) continue;

    rep2(i, -2, 2) rep2(j, -2, 2) {
      int nx = x + i, ny = y + j;

      if (nx < 0 || ny < 0 || nx >= w || ny >= h || maze[ny][nx] == '#') continue;

      int nd = d + (abs(i) + abs(j) > 1);
      if (dist[ny][nx] > nd) {
        dist[ny][nx] = nd;
        que.emplace(nd, mp(nx, ny));
      }
    }
  }

  return (dist[gy][gx] == INF ? -1 : dist[gy][gx]);
}

signed main()
{
  cout << fixed << setprecision(20);
  ios::sync_with_stdio(false);
  cin.tie(0);

  cin >> h >> w;
  cin >> sy >> sx;
  cin >> gy >> gx;

  --sy, --sx;
  --gy, --gx;

  rep(i, h) rep(j, w) cin >> maze[i][j];

  cout << dijkstra() << endl;

  return (0);
}


Measured memory_bytes: 8552
n, k, s = map(int, input().split())
Ans = [s]*k
if s == 10**9:
  for i in range(n-k):
    Ans.append(s-1)
else:
  for i in range(n-k):
    Ans.append(s+1)

L=[str(a) for a in Ans]
L=" ".join(L)
print(L)

Measured memory_bytes: 15128
n, k = gets.split.map(&:to_i)

#p [n,k].inspect

alter_k = k%2==1 ? k : k/2

candidates = (1..n).to_a.keep_if {|e| e%alter_k==0 }

p candidates.size ** 3 and exit if k%2==1

p candidates.partition {|e| e%k==0 }.map {|e|e.count**3 }.inject(0){|m,e|m+e}


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

using namespace std;

bool cmp(pair<string, pair<int, int>> p1, pair<string, pair<int, int>> p2) {
	if(p1.first < p2.first) return true;
	else if(p1.first == p2.first) {
		if(p1.second.first > p2.second.first) return true;
	}
	return false;
}

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	
	int n;
	cin >> n;
	vector<pair<string, pair<int, int>>> v(n);
	string s;
	int score;
	for(int i = 0; i < n; i++) {
		cin >> s >> score;
		v[i] = {s, {score, i + 1}};
	}
	sort(v.begin(), v.end(), cmp);
	for(auto i : v) {
		cout << i.second.second << '\n';
	}

	return 0;
}

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

using namespace std;

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

typedef long long ll;

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

int dp[1005][1005];

int main() {
	int n, m;
	scanf("%d%d", &n, &m);
	for (int i=1 ; i<=n ; i++) {
		for (int j=1 ; j<=m ; j++) {
			char c;
			scanf(" %c", &c);
			if (c == '.') {
				dp[i][j] = (dp[i-1][j] + dp[i][j-1]) % MOD;
			}
			if (i==1 and j==1 and c=='.') dp[1][1] = 1;
		}
	}
	printf("%d\n", dp[n][m]);
	return 0;
}

Measured memory_bytes: 7724
s = input()
if s[0]=='R' and s[1]=='R' and s[2]=='R':
  print(3)
elif s[0]=='R' and s[1]=='R':
  print(2)
elif s[1]=='R' and s[2]=='R':
  print(2)
elif s[0]=='R' or s[1]=='R' or s[2]=='R':
  print(1)
else:
  print(0)

Measured memory_bytes: 9052
#include <iostream>
using namespace std;
int main()
{
	char c;
	cin >> c;
	if (c == 'a' || c == 'o' || c == 'e' || c == 'i' || c == 'u')
		cout << "vowel" << endl;
	else
		cout << "consonant" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, e) for (int i = (int)(s); i <= (int)(e); i++)
#define printYesNo(is_ok) puts(is_ok ? "Yes" : "No");
#define SORT(v) sort(v.begin(), v.end());
#define RSORT(v) sort(v.rbegin(), v.rend());
#define REVERSE(v) reverse(v.begin(), v.end());

template <typename T>
void printlnVector(T v)
{
  rep(i, v.size())
  {
    cout << v[i] << endl;
  }
}

template <typename T>
void printVector(T v)
{
  rep(i, v.size())
  {
    cout << v[i] << " ";
  }
  cout << endl;
}

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()
{
  int N, M;
  cin >> N >> M;
  UnionFind uf(N);
  rep(i, M)
  {
    int X, Y, Z;
    cin >> X >> Y >> Z;
    uf.unite(X - 1, Y - 1);
  }
  set<int> tree;
  rep(i, N)
  {
    tree.insert(uf.find(i));
  }
  int ans = tree.size();
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 5376
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n; cin >> n;
    vector<int> b(n-1);
    for(int i=0; i<n-1; i++){
        cin >> b.at(i);
    }

    vector<int> a(n);
    int sum = b.at(0);
    sum += b.at(n-2);

    for(int i=0; i<n-2; i++){
        sum += min(b.at(i), b.at(i+1));
    }

    cout << sum << endl;
}

Measured memory_bytes: 256
MOD = 10**9 + 7
n, a, b = map(int, input().split())

def C(n,r):
    p = n*pow(r,MOD-2,MOD)
    for i in range(1,r):
        p = p*(n-i)%MOD
        p = p * pow(i,MOD-2,MOD)
    return p%MOD



print((pow(2,n,MOD) - C(n,a) - C(n,b)-1)%MOD)

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

int main() 
{
  
  int n,t_score=0,h_score=0;
  cin >> n;

  for(int i=1; i<=n;i++)
  {
    string t_card,h_card;
    cin >> t_card >> h_card;

    if( t_card > h_card )
      t_score += 3;
    else if( t_card < h_card )
      h_score += 3;
    else
    {   
      t_score++;
      h_score++;
    }   
  }

  cout << t_score << " " << h_score << endl;

  return 0;
}



Measured memory_bytes: 3180
#include"bits/stdc++.h"
using namespace std;

//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;

struct _ { ios_base::Init i; _() { cin.sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(10); } } ___;
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
    cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " : " << arg1 << "  ";
    __f(comma + 1, args...);
}

#define ll long long int
#define pii pair<int,int>
#define oset tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define ff first
#define ss second
#define endll '\n'
#define rep(i,n) for(int i=0;i++<n;)
#define scl(i) scanf("%lld",&i)
#define int long long int
#define all(n) n.begin(),n.end()
#define mem(n,i) memset(n,i,sizeof n)
#define em(a) emplace_back(a)
#define pb(a) push_back(a)
#define srep(vv,it) for(auto &it : vv)
#define prep(vv,it) for(auto it : vv)
//vector<vector<int>>arr(n + 5, vector<int>(m + 5,0));

typedef vector<int> vii;
typedef vector<string> vss;
/*

*/

int arr[10000005];
void call()
{
    for (int i = 1; i < 10000002; i++)
        for (int j = i; j < 10000002; j += i)
            arr[j]++;
}

signed main()
{

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

    call();
    int n; cin >> n;
    int ans = 0;
    for (int i = 1; i <= n; i++)
    {
        ans += arr[i] * i;
    }
    cout << ans << endll;
}


Measured memory_bytes: 81776
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int A,B,C;cin>>A>>B>>C;
  int X=A*10+B+C;
  int Y=B*10+C+A;
  int Z=C*10+A+B;
  cout<<max(X,max(Y,Z))<<endl;}

Measured memory_bytes: 256
H, W = gets.split.map(&:to_i)
S = readlines.map(&:chomp)
require 'pp'

@m = ['#' * (W + 2)] + S.map{|l| ("#" + l + "#")} + ['#' * (W + 2)]

def bfs
  q = [[[1, 1]]]
  v = Array.new(H + 2){Array.new(W + 2, false)}
  v[1][1] = true
  while !q.empty?
    p = q.shift
    i, j = p.last
    [[1, 0], [-1, 0], [0, 1], [0, -1]].each do |di, dj|
      i1, j1 = i + di, j + dj
      next if @m[i1][j1] != '.' || v[i1][j1]
      return p.length + 1 if [i1, j1] == [H, W]
      v[i1][j1] = true
      q << (p + [[i1, j1]])
    end
  end
  false
end

a = bfs
puts a ? S.inject(0){|s, l| s + l.count('.')} - a : -1

Measured memory_bytes: 2812
#include <stdio.h>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define FILL(a,x) memset(a,x,sizeof(a))
#define foreach( gg,ii ) for( typeof(gg.begin()) ii=gg.begin();ii!=gg.end();ii++)
#define mp make_pair
#define pb push_back
#define X first
#define Y second
#define sz(a) int((a).size())
#define N 1000010
#define MAX 30
#define mod 1000000007
#define REP(i,a) for(int i=0;i<a;++i)
#define REPP(i,a,b) for(int i=a;i<b;++i)
#define all(a) a.begin(),a.end()
const ll INF = 1e18+1;

ll a[N];

int main()
{
	ll n,ans=0,x;
	scanf("%lld",&n);
	REP(i,n) scanf("%lld",&a[i]);
	REP(i,n)
	{
		x=a[i]/2;
		ans+=x;
		a[i]-=2*x;
		if (i!=n-1&&a[i]&&a[i+1])
		{
			ans++;
			a[i+1]--;
		}
	}
	printf("%lld\n",ans);
return 0;
}


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


template <typename T,typename U> class SegmentTree{
	public :
		virtual T get(U x) = 0;
		virtual T merge(T l,T r) = 0;
		SegmentTree(int size,T o):out(o){
			for(n=1;n<size;n<<=1);
			data=vector<T>(2*n,out);
			flag=vector<bool>(2*n,false);
			lazy=vector<U>(2*n);
		}

		void update(int a,int b,U x){return update(a,b,x,0,0,n);}
		T query(int a,int b) {return query(a,b,0,0,n);}

	private:
		int n;
		vector<T> data;
		vector<bool> flag;
		vector<U> lazy;
		const T out;

		void update(int a,int b,U x,int k,int l,int r){
			if(r<=a||b<=l) return;
			if(a<=l&&r<=b){data[k]=get(x),flag[k]=true,lazy[k]=true;return;}
			lazy_evaluate(k,l,r);
			update(a,b,x,k*2+1,l,(l+r)/2);
			update(a,b,x,k*2+2,(l+r)/2,r);
			data[k]=merge(data[k*2+1],data[k*2+2]);
		}

		T query(int a,int b,int k,int l,int r){
			if(r<=a||b<=l) return out;
			if(a<=l&&r<=b) return data[k];
			lazy_evaluate(k,l,r);
			T vl = query(a,b,k*2+1,l,(l+r)/2);
			T vr = query(a,b,k*2+2,(l+r)/2,r);
			return merge(vl,vr);
		}

		inline void lazy_evaluate(int k,int l,int r){
			if(flag[k]==false) return;
			U x=lazy[k];
			update(l,(l+r)/2,x,k*2+1,l,(l+r)/2);
			update((l+r)/2,r,x,k*2+2,(l+r)/2,r);
			flag[k]=false;
		}
};

template <typename T,typename U> class RMQ : public SegmentTree<T,U> {
	public:
		RMQ(int size,T o):SegmentTree<T,U>(size,o){}
		T get(U x){return x;}
		T merge(T l,T r){return min(l,r);}
};

RMQ<int,int> *rmq;

int main(void){
	int N,Q;
	cin >>  N >> Q;
	rmq= new RMQ<int,int> (N,INT_MAX);

	for(int i=0;i<Q;i++){
		int type;
		cin >> type;
		if(type){
			int s,t;
			cin >> s >> t;
			cout << rmq->query(s,t+1) << endl;
		}else{
			int a,x;
			cin >> a >> x;
			rmq->update(a,a+1,x);
		}
	}
	return 0;
}

Measured memory_bytes: 3288
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  vector<int>A(20);
  int N;
  int i, j, k, x, y;

  for (i = 1; i <= 3; i++){
    cin >> A.at(i);
  }

  for (j = 4; j <= 6; j++){
    cin >> A.at(j);
  }

  for (k = 7; k<= 9; k++){
    cin >> A.at(k);
  }

  cin >> N;
  vector<int>b(N);
 
  for (i = 0; i < N; i++){
    cin >> b.at(i);
  }


  for (x = 1; x <= 9; x++){
    for (y = 0; y < N; y++){
      if (A.at(x) == b.at(y)){
        A.at(x) = 1000;
      }
    }
  }
  
  if ((A.at(1) == 1000)&&(A.at(2) == 1000)&&(A.at(3) == 1000)){
    cout << "Yes" << endl;
    return 0;
  } else if ((A.at(4) == 1000)&&(A.at(5) == 1000)&&(A.at(6) == 1000)) {
    cout << "Yes" << endl;
    return 0;
  } else if ((A.at(7) == 1000)&&(A.at(8) == 1000)&&(A.at(9) == 1000)) {
    cout << "Yes" << endl;
    return 0;
  } else if ((A.at(1) == 1000)&&(A.at(4) == 1000)&&(A.at(7) == 1000)) {
    cout << "Yes" << endl;
    return 0;
  } else if ((A.at(2) == 1000)&&(A.at(5) == 1000)&&(A.at(8) == 1000)) {
    cout << "Yes" << endl;
    return 0;
  } else if ((A.at(3) == 1000)&&(A.at(6) == 1000)&&(A.at(9) == 1000)) {
    cout << "Yes" << endl;
    return 0;
  } else if ((A.at(1) == 1000)&&(A.at(5) == 1000)&&(A.at(9) == 1000)) {
    cout << "Yes" << endl;
    return 0;
  } else if ((A.at(3) == 1000)&&(A.at(5) == 1000)&&(A.at(7) == 1000)){
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod2 = 998244353;
const ll INF = 1e18;
const long double EPS = 1e-10;

int main() {
  vector<string> s(3);
  rep(i, 3) cin >> s[i];

  vector<int> n(3);
  rep(i, 3) n[i] = s[i].size() - 1;
  rep(i, 2) {
    if (s[i][n[i]] != s[i + 1][0]) {
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;


  
  return 0;
}

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

int main(){
	int P,Q,R;
	cin >> P >> Q >> R;
	int A = (P + Q);
	int B = (P + R);
	int C = (Q + R);

	if(A <= B && A <= C){
		cout << A << endl;
	}
	else if(B <= A && B <= C){
		cout  << B << endl;
	}
	else{
		cout  << C << endl;
	}
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
	int a,n;
	char word[10000];
	for(a=0;;a++){
		if(scanf("%c",&word[a])==EOF){break;}
		if(word[a]>=97 && word[a]<=122){word[a]-=32;}
	}
	for(n=0;n<a;n++){
		printf("%c",word[n]);
	}
	return 0;
}

Measured memory_bytes: 0
#include <stdio.h>
#include <vector>
#include <utility>
#include <algorithm>
using namespace std;


int main(){
    int n;
    scanf("%d",&n);
    vector<pair<int,int>> tasks(n);
    for(int i=0;i<n;i++){
        int a,b;
        scanf("%d %d",&a,&b);//a-締め切り　b-必要時間
        //tasks[i]=make_pair(b,a);
        tasks[i].first=b;
        tasks[i].second=a;
    }
    sort(tasks.begin(),tasks.end());
    int sum=0;
    bool j=true;
    for(int i=0;i<n;i++){
        sum+=tasks[i].second;
        if(sum>tasks[i].first) {
            j=false;
            break;
        }
    }
    if(j) printf("Yes\n");
    else printf("No\n");
}

Measured memory_bytes: 1792
[n,m] = [int(i) for i in input().split()]
a = []
for i in range(m):
    a.append(int(input()))
ok = [0] * (n+1)
for i in range(m):
    ok[a[i]] = 1
dp = [0] * (n+1)
dp[0] = 1
if n > 1:
    for i in range(1,n+1):
        if ok[i] != 1:
            if i == 1:
                dp[i] = 1
            else:
                dp[i] = (dp[i-2]+dp[i-1])%(10**9+7)
        else:
            dp[i] = 0
    print((dp[n])%(10 ** 9 + 7))
else:
    if 1 in a:
        print(0)
    else:
        print(1)


Measured memory_bytes: 50904
use std::io::Read;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

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

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

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

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

fn main() {
    input!{
        n: usize,
        v: [f32; n],
    }

    let mut a = 0f32;

    for i in 0..n {
        a = a + 1f32 / v[i];
    }

    println!("{}", 1f32 / a);

}

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

typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define dump(x)  cout << #x << " = " << (x) << endl;	//debug
#define SZ(x) ((int)(x).size())
#define REP(i, n) for(ll i = 0; i < (n); i++)
#define REPR(i, n) for (ll i = (n); i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define ps(s) cout << #s << endl;
#define pv(v) cout << (v) << endl;

int main() {
	string s;
	cin >> s;
	if (s[0] == s[1] || s[1] == s[2] || s[2] == s[3]) {
		ps(Bad)
	}
	else {
		ps(Good)
	}
	return(0);
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10 ** 7)
read = sys.stdin.buffer.read 
input = sys.stdin.buffer.readline
def inputS(): return input().rstrip().decode()
readlines = sys.stdin.buffer.readlines 

from collections import deque

def bfs(grid, start):
  dist = [[-1]*(W+2) for _ in range(H+2)]
  queue = deque([start])
  dist[start[0]][start[1]] = 0
  while queue:
    x, y = queue.popleft()
    
    for i, j in ((1, 0), (-1, 0), (0, 1), (0, -1)):
      nx, ny = x+i, y+j
      if grid[nx][ny] == "." and dist[nx][ny] == -1:
        dist[nx][ny] = dist[x][y]+1
        queue.append((nx, ny))
    if not queue:
      return dist[x][y]
    
H, W = map(int, input().split())
# 番兵
grid = [["#"] + list(inputS()) + ["#"] for _ in range(H)]
grid = ["#"*(W+2)] + grid + ["#"*(W+2)] # 上下に番兵

ans = 0
for i in range(1, H+1):
  for j in range(1, W+1):
    if grid[i][j] == "#":
      continue
    ans = max(ans, bfs(grid, (i, j)))  
    
print(ans)    
    

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

int main()
{
    int a,b,c,x,y;
    cin>>a>>b>>c>>x>>y;
    int m1,m2,s1,s2,s3,s4,min1,min2;
    m1=min(x,y);
    s1=m1*(a+b);
    s2=2*m1*c;
    min1=min(s1,s2);
    if(x>y)
        s3=abs(x-y)*a;
    else
        s3=abs(x-y)*b;
        s4=abs(x-y)*2*c;
        min2=min(s3,s4);
        cout<<min1+min2<<endl;
        return 0;
}


Measured memory_bytes: 256
package main

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

var scanner *bufio.Scanner

func nextInt() int {
	scanner.Scan()

	var i, _ = strconv.Atoi(scanner.Text())

	return i
}

func nextString() string {
	scanner.Scan()

	return scanner.Text()
}

func initScanner() {
	scanner = bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
}

// math functuon
func maxInt(a, b int) int {
	return int(math.Max(float64(a), float64(b)))
}
func minInt(a, b int) int {
	return int(math.Min(float64(a), float64(b)))
}

// 階乗
func factorial(n int64) int64 {
	if n < 1 {
		return 1
	}

	return n * factorial(n-1)
}

// 順列
func permutation(n, k int64) int64 {
	return factorial(n) / factorial(n-k)
}

// 組み合わせ
func combination(n, k int64) int64 {
	if k == 0 || k == n {
		return 1
	}

	return permutation(n, k) / factorial(k)
}

// logger
var isDebug = true

func log(format string, args ...interface{}) {
	if !isDebug {
		return
	}

	fmt.Printf(format+"\n", args...)
}

func main() {
	var debugFlag = flag.Bool("debug-mode", false, "debug flag")
	flag.Parse()
	isDebug = *debugFlag

	initScanner()

	var h, w = nextInt(), nextInt()

	var areas = [][]Area{}
	var input = [][]rune{}
	for i := 0; i < h; i++ {
		var s = nextString()
		log("%s", s)

		var rowArea = make([]Area, w)
		var row = make([]rune, w)

		for j := 0; j < w; j++ {
			var area = Area{X: j, Y: i}

			if s[j] == '#' {
				area.IsBlock = true
			}

			rowArea[j] = area
			row[j] = rune(s[j])
		}

		areas = append(areas, rowArea)
		input = append(input, row)
	}

	for i := 0; i < h; i++ {
		for j := 0; j < w; j++ {
			if input[i][j] == '#' {
				continue
			}

			if i == 0 || input[i-1][j] == '#' {
				areas[i][j].YGroup = &Group{Score: 0}
			} else {
				areas[i][j].YGroup = areas[i-1][j].YGroup
			}

			areas[i][j].YGroup.Score++

			if j == 0 || input[i][j-1] == '#' {
				areas[i][j].XGroup = &Group{Score: 0}
			} else {
				areas[i][j].XGroup = areas[i][j-1].XGroup
			}
			areas[i][j].XGroup.Score++
		}
	}

	var max = -1
	for i := 0; i < h; i++ {
		for j := 0; j < w; j++ {
			if areas[i][j].IsBlock {
				continue
			}

			max = maxInt(max, areas[i][j].Score())
			if max < areas[i][j].Score() {
				max = areas[i][j].Score()
			}
		}
	}

	fmt.Println(max)

}

type Area struct {
	X       int
	Y       int
	XGroup  *Group
	YGroup  *Group
	IsBlock bool
}

func (area Area) Score() int {
	if area.IsBlock {
		return 0
	}

	return area.XGroup.Score + area.YGroup.Score - 1
}

type Group struct {
	Score int
}


Measured memory_bytes: 198912