akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <memory.h>
#include <cstring>
#include <vector>
#include <deque>
#include <cstdlib>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cassert>
#include <functional>
#include <set>
#include <list>
#include <map>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
using namespace std;

typedef unsigned long long llu;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;
const ll MOD = 1e9 + 7;
const long double PI = 3.141592653589793238462643383279502884197;

priority_queue<int, vector<int>, greater<int> > pq;
vector<int> v;

int vec[3][100001];
ll dp[3][100001];

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

	for (int i = 1; i <= n; i++) scanf("%d", &vec[0][i]);
	for (int i = 1; i <= n; i++) scanf("%d", &vec[1][i]);
	for (int i = 1; i <= n; i++) scanf("%d", &vec[2][i]);

	sort(vec[0] + 1, vec[0] + n + 1);
	sort(vec[1] + 1, vec[1] + n + 1);
	sort(vec[2] + 1, vec[2] + n + 1);

	for (int i = 1; i <= n; i++)
		dp[0][i] += dp[0][i - 1] + 1;

	for (int i = 1; i <= n; i++) {
		int t = lower_bound(vec[0] + 1, vec[0] + n + 1, vec[1][i]) - vec[0] - 1;
		dp[1][i] += dp[1][i - 1] + dp[0][t];
	}

	for (int i = 1; i <= n; i++) {
		int t = lower_bound(vec[1] + 1, vec[1] + n + 1, vec[2][i]) - vec[1] - 1;
		dp[2][i] += dp[2][i - 1] + dp[1][t];
	}

	printf("%lld", dp[2][n]);
}

Measured memory_bytes: 3712
# -*- coding: utf-8 -*-

import sys, re
from collections import deque, defaultdict, Counter
from math import sqrt, hypot, factorial, pi, sin, cos, radians
from heapq import heappop, heappush, heapify, heappushpop
from bisect import bisect_left, bisect_right
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from functools import reduce, partial
from fractions import Fraction
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
def ceil(a, b=1): return int(-(-a // b))
def round(x): return int((x*2+1) // 2)
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N = INT()
aN = LIST()

ans = 0
for i in range(1, max(aN)+1):
    l = r = 0
    # 外ループで左を動かす
    while l < N:
        # 内ループは条件を満たす限り右を動かす
        while r < N and aN[r] >= i:
            r += 1
        if l != r:
            ans += 1
            l = r
        else:
            l += 1
            r += 1
print(ans)


Measured memory_bytes: 5204
#include<stdio.h>
int main()
{
    int n1,n2,as;
    scanf("%d %d",&n1,&n2);
    as=n1*n2+n1+n2+1;
    int i,j,s=0,t=0,arr[as],sum[n1];

     for(i=0;i<n1*n2;i++)
    {
            scanf("%d",&arr[i]);
    }
    for(i=0,j=1;i<n1*n2;i++,j++)
    {
            printf("%d ",arr[i]);
            s=s+arr[i];
            if(j==n2)
            {
                j=0;
                printf("%d",s); printf("\n"); sum[t]=s; t++; s=0;
            }
    }
   int ls=0 ;
for(i=0;i<n1;i++)  ls=ls+sum[i];
    for(i=0;i<n2;i++)
    {
        for(j=i,t=1;t<=n1;t++,j=j+n2) s=s+arr[j];
        printf("%d ",s); s=0;
    }
    printf("%d\n",ls);



}



Measured memory_bytes: 2728
#include <bits/stdc++.h> 
using namespace std;
#define rep(i, N) for(int i=0; i<N; i++)
typedef long long ll;
#define dump(x) cerr<<#x<<"="<<x<<endl
using P = pair<int, int>;

int main() {
   long long n;
   cin >> n;

   vector<ll> a(n+1, 1);
   for(int i=2; i<=n; i++){
      ll tmp = i;
      while(tmp<=n){
         a.at(tmp)++;
         tmp+=i;
      }
   }

   ll ans = 0; 
   for(int i=1; i<=n; i++){
      ans += i*a.at(i);
   }

   cout << ans << endl;


   return 0;
}


Measured memory_bytes: 81412
#include <stdio.h>

int main(void) {
	int n;
	char s[51];
	int a = 0;
	scanf("%d", &n);
	scanf("%s", s);
	for (int i = 0;i < n-2;i++) {
		if (s[i] == 'A' && s[i + 1] == 'B' && s[i + 2] == 'C') a++;
	}
	printf("%d", a);
	return 0;
}

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

int main(){
    int N,D,X;
    cin>>N>>D>>X;
    vector<int> v;
    int tmp;
    
    for(int i=0;i<N;i++){
        cin>>tmp;
        v.push_back(tmp);
    }
    int ans=X+N;
    for(int i=0;i<N;i++){
        ans+=(D-1)/v[i];
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int inf = 1001001001;

ll c(ll x){
  return x*(x-1)/2;
}

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  map<int,int> mp;
  
  rep(i,n) {
    cin >> a.at(i);
    mp[a.at(i)]++;
  }
  
  ll tot = 0;
  for(auto p : mp){
    tot += c(p.second);
  }
  
  rep(i,n){
    ll ans = tot;
    ll m = mp[a.at(i)];
    ans -= c(m)-c(m-1);
    cout << ans << endl;
  }

}

Measured memory_bytes: 9856
from copy import *
from sys import *
import math
import queue
from collections import defaultdict,Counter,deque
from fractions import Fraction as frac

setrecursionlimit(1000000)


def main():
	n = int(input())
	a = list(map(int,input().split()))
	color = [0 for i in range(8)]
	free = 0
	for i in a:
		if(i//400>7):
			free+=1
		else:
			color[i//400] = 1
	print(str(max(1,sum(color)))+' '+str(min(10**100,sum(color)+free)))


def zip(a):
	mae = a[0]
	ziparray = [mae]
	for i in range(1,len(a)):
		if(mae != a[i]):
			ziparray.append(a[i])
			mae = a[i]
	return ziparray

def is_prime(n):
	if n < 2: return False

	for k in range(2, int(math.sqrt(n)) + 1):
		if n % k == 0:
			return False

	return True

def list_replace(n,f,t):
	return [t if i==f else i for i in n]

def base_10_to_n(X, n):
	X_dumy = X
	out = ''
	while X_dumy>0:
		out = str(X_dumy%n)+out
		X_dumy = int(X_dumy/n)
	if(out == ''): return '0'
	return out

def gcd(m,n):
	x = max(m,n)
	y = min(m,n)
	while(x%y!=0):
		z = x%y
		x = y
		y = z
	return y

class Queue():
	def __init__(self):
		self.q = deque([])
	def push(self,i):
		self.q.append(i)
	def pop(self):
		return self.q.popleft()
	def size(self):
		return len(self.q)
	def debug(self):
		return self.q

class Stack():
	def __init__(self):
		self.q = []
	def push(self,i):
		self.q.append(i)
	def pop(self):
		return self.q.pop()
	def size(self):
		return len(self.q)
	def debug(self):
		return self.q

class graph():
	def __init__(self):
		self.graph = defaultdict(list)
	def addnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].append(t)
		self.graph[t].append(f)
	def rmnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].remove(t)
		self.graph[t].remove(f)
	def linked(self,f):
		return self.graph[f]

class dgraph():
	def __init__(self):
		self.graph = defaultdict(set)
	def addnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].append(t)
	def rmnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].remove(t)
	def linked(self,f):
		return self.graph[f]

main()

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

int main() {
  int N;
  cin >> N;
  string S;
  for(int i=0;i<N;i++){
   cin >> S;
    if (S=="Y"){
     break;
    }
  }
 if (S=="Y"){
   cout << "Four" << endl;
 }
 else{
   cout << "Three" << endl;
}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <stdio.h>
#pragma optimize("O3")
#define sync                    \
ios_base::sync_with_stdio(0); \
cin.tie(0);                   \
cout.tie(0)
#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define RFOR(i,a,b) for (int i = (a - 1); i >= (b); i--)
#define all(a) (a).begin(), (a).end()
#define endl "\n"
#define ll long long
#define pb push_back
#define PII pair<int, int>
#define PLL pair<long long, long long>
#define vi vector<int>
#define vb vector<bool>
#define vc vector<char>
#define vll vector<long long>
#define mii map<int, int>
#define mll map<long long, long long>
#define MOD 1000000007
#define MAX 1000000007
#define MOD2 1234567891
#define SZ(a) (int) a.size()
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define TIE(l, r) Node *l, *r; tie(l, r)
#define EPS 0.00000001
#define PI 3.14159265359
void dout() { cerr << endl; }
#define MAXN 100001

template <typename Head, typename... Tail>
void dout(Head H, Tail... T) {
    cerr << H << ' ';
    dout(T...);
}

/*,--. ,--.
  |  .'   /  ,--,--.  ,---.   ,---.   ,--,--.
  |  .   '  ' ,-.  | | .-. | | .-. | ' ,-.  |
  |  |\   \ \ '-'  | | '-' ' | '-' ' \ '-'  |
  `--' '--'  `--`--' |  |-'  |  |-'   `--`--'
                     `--'    `--'             */





void solve() {
    int n, l;
    cin >> n >> l;
    vector<string> res(n);
    FOR (i, 0, n)
        cin >> res[i];
    sort(all(res));
    string ans;
    FOR (i, 0, n)
        ans += res[i];

    cout << ans;


}

int main() {
    sync;


    solve();
    cerr << "Time elapsed: " << clock() / (double) CLOCKS_PER_SEC << endl;
    return 0;
}



Measured memory_bytes: 3736
import bisect
from collections import deque
from fractions import gcd
#from math import factorial
from math import sqrt
from math import ceil
from itertools import permutations
from copy import deepcopy

#S=input()
#s=input()
from collections import defaultdict

N=int(input())
A=list(map(int,input().split()))
B=list(A)
B.reverse()
l=[0]*(N+1)
for i in range(N):
    l[i+1]=l[i]+A[i]
r=[0]*(N+1)
for i in range(N):
    r[i+1]=r[i]+B[i]
ans=10**9
for i in range(2,N-1):
    S=l[i]
    a=bisect.bisect_left(l,S/2)
    b=a-1
    if abs(l[a]-S/2)<=abs(l[b]-S/2):
        c=a
    else: c=b
    T=l[-1]-S
    a=bisect.bisect_left(r,T/2)
    b=a-1
    if abs(r[a]-T/2)<=abs(r[b]-T/2):
        d=a
    else: d=b
    p=[l[c],S-l[c],r[d],T-r[d]]
    p.sort()
    ans=min(ans,p[-1]-p[0])
print(ans)


Measured memory_bytes: 117236
#include <bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define RS(X) scanf("%s", (X))
#define CASET int ___T, case_n = 1; scanf("%d ", &___T); while (___T-- > 0)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define PII pair<int,int>
#define VI vector<int>
#define VPII vector<pair<int,int> >
#define PLL pair<long long,long long>
#define VPLL vector<pair<long long,long long> >
#define F first
#define S second
typedef long long LL;
using namespace std;
const int MOD = 1e9+7;
const int SIZE = 1e6+10;
int A[SIZE];
bool Go(int N){
    LL sum=0;
    REPP(i,1,N+1){
        sum+=A[i];
    }
    if(sum%2!=N%2)return 1;
    else{
        int odd=0;
        REPP(i,1,N+1){
            if(A[i]%2==1){
                if(odd)return 0;
                odd=i;
            }
        }
        if(A[odd]==1)return 0;
        A[odd]--;
        int gg=A[1];
        REPP(i,2,N+1){
            gg=__gcd(gg,A[i]);
        }
        REPP(i,1,N+1){
            A[i]/=gg;
        }
        return !Go(N);
    }
}
int main(){
    DRI(N);
    REPP(i,1,N+1){
        RI(A[i]);
    }
    if(N==1){
        if(A[1]==1)puts("Second");
        else puts("First");
        return 0;
    }
    puts(Go(N)?"First":"Second");
    return 0;
}


Measured memory_bytes: 768
n,h = map(int,input().split())
a,b = [],[]
for i in range(n):
    c,d = map(int,input().split())
    a.append(c)
    b.append(d)
a_max = max(a)
b = sorted(b, reverse = True)

piv = 0
res = 0
while h > 0 and piv < n and b[piv] > a_max:
    res += 1
    h -= b[piv]
    piv += 1
if h > 0:
    res += (h + a_max - 1) // a_max
print(res)


Measured memory_bytes: 12116
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cctype>
#include <stdio.h>
using namespace std;
int main() {
    string s;
    int times, h;
    while(cin >> s){
        if(s == "-") break;
        cin >> times;
        for(int i = 0; i < times; i++){
            cin >> h;
            string right = s.substr(h);
            string left = s.substr(0, h);
            s = right + left;
        }
        cout << s << endl;
    }
    
    return 0;
}

Measured memory_bytes: 3168
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#define dlog(str) cout << "====" << str << endl;
#else
#define dlog(str)
#endif
#define INF 999999999
#define MOD 1000000007
#define REP(i, n) for(int i = 0, i##_l = (n); i < i##_l; i++)
#define FOR(i, s, e) for(int i = s, i##_l = (e); i < i##_l; i++)
#define LLI long long int
#define _min(a,b) ((a<b)?a:b)
#define _max(a,b) ((a<b)?b:a)
#define chmax(a, b) a = _max(a, b)
#define chmin(a, b) a = _min(a, b)
#define bit(a, shift) ((a>>shift)&1))
#define pm(a) ((a)?1:-1)
#define SORT(v) sort(v.begin(),v.end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
// int 2.14E±9    lli 9.2E±18    double 1.7E±380


int main()
{
    cout << fixed << setprecision(10);

    string s;
    cin >> s;

    int ans = 3;
    int cnt = 0;
    if (s == "RRR")
    {
        cout << 3;
        return 0;
    }
    if (s == "RRS")
    {
        cout << 2;

        return 0;
    }
    if (s == "SRR"){
        cout << 2;
        return 0;
    }
    if (s == "SSS")
    {
        cout << 0;
        return 0;
    }
    cout << 1;
    return 0;
}

Measured memory_bytes: 3616
#include<bits/stdc++.h>
#define ll long long int
#define ld long double
#define pl pair<ll,ll>
#define plp pair<ll,pl>
#define ppl pair<pl,ll>
#define pb push_back
#define pi acos(-1.0)
#define eb emplace_back
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define vl vector<ll>
#define mp make_pair
#define rep(i,a,b)  for(ll i=a;i<=b;i++)
#define vll vector<vector<ll>>
#define all(a) a.begin(),a.end()
#define INF 1e9+5
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
using namespace std;
 
 //ll n,m;
ll MOD1=1000000007;
ll MOD2=998244353;
 
 
void yes() {cout<<"YES"<<endl;}
void no() {cout<<"NO"<<endl; }
/*
ll gcd(ll a,ll b);
ll lcm(ll a, ll b);
ll mod_exp(ll x,ll power,ll m);
ll ext_gcd(ll a,ll b,ll& x,ll& y);
void swap(ll& a,ll& b);
ll root(vector<ll>& arr,ll a);
void Union(vector<ll>& arr,ll a,ll b);
const ll N=32001;
vl fenwick(N,0);
void update(ll index,ll add);
ll sum(ll index);
ll find_kth_smalest(ll k);
ll find(ll k);
ll ETF(ll n);
*/
 
 
ll gcd(ll a,ll b)
{
    if(a==0)
        return b;
    return gcd(b%a, a);
}
 
ll lcm(ll a, ll b)
{
    return ( a*b/(gcd(a,b)));
}
 
//void sieve();
//vector<ll> factorise(1000+2,-1);
//vector<ll> prime(20005,1);
//vl fug;
//void p();
//void fact();
 
 
/*
void sieve()
{
    prime[0]=prime[1]=0;
    for(ll i=2;i<=sqrt(2005);i++)
    {
        if(prime[i]==1)
        {
            for(ll j=i*i;j<2005;j+=i)
                prime[j]=0;
        }
    }
}
*/


ll lcs(string& a,string& b,ll n,ll m)
{
    if(n==0 || m==0) return 0;
    
    if(a[n-1]==b[m-1])
        return 1 + lcs(a, b, n-1, m-1);
    else
        return max(lcs(a, b, n-1, m),lcs(a, b, n, m-1));
}


void solve()
{
    string a,b;
    cin>>a;
    cin>>b;
    ll n=a.length(),m=b.length();
    
    vll dp(n+1,vl(m+1,0));
    //cout<<lcs(a, b, n, m)<<endl;
   
    for(ll i=1;i<=n;i++)
    {
        for(ll j=1;j<=m;j++)
        {
            if(a[i-1]==b[j-1])
                dp[i][j]=1+dp[i-1][j-1];
            else
                dp[i][j]=max(dp[i-1][j], dp[i][j-1]);
        }
    }
    
   // cout<<dp[n][m]<<endl;
    
    //ll mx=dp[n][m];
    
    string ans="";
    
    ll i=n,j=m;
    
    while (i>0 && j>0) {
        
        if(a[i-1]==b[j-1])
        {
            ans+=a[i-1];
            i--; j--;
        }
        else if(dp[i][j]==dp[i-1][j])
        {  i--; }
        else
            j--;
            
            
            
            
    }
    
    reverse(all(ans));
    cout<<ans<<endl;
    

}
 
int main(int argc, const char * argv[]) {
    
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll tests=1;
   // cin>>tests;
    while (tests--) {
        solve();
    }
    return 0;
}
 
 

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

int main() {
	int dp[4][4001]={0};
	for(int j=0;j<=1000;j++) dp[0][j]=1;
	for(int i=0;i<3;i++){
		for(int j=0;j<=1000*(i+1);j++){
			for(int k=0;k<=1000;k++) if(j+k<=4000) dp[i+1][j+k]+=dp[i][j];
		}
	}
	int n;
	while(cin>>n) cout << dp[3][n] << '\n';
}

Measured memory_bytes: 1228
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt(),k = sc.nextInt();
		int[] h = new int[n];
		int[] d = new int[n-k+1];
		for(int i = 0;i < n;i ++) {
			h[i] = sc.nextInt();
		}
		Arrays.sort(h);
		for(int i = 0;i <= n - k;i++) {
			//System.out.println(h[i+k-1]+" " +h[i]);
			d[i] = h[i+k-1] - h[i];
			//System.out.println(d[i]);
		}
		Arrays.sort(d);
		System.out.println(d[0]);
	}
}

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

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let answer = solve(&buf);

    println!("{}", answer);
}

fn solve(input: &str) -> String {
    let mut iterator = input.split_whitespace();

    let s: Vec<char> = iterator.next().unwrap().chars().collect();
    let mut ans = String::new();
    for i in 0..3 {
        ans.push(s[i]);
    }
    return ans;
}


Measured memory_bytes: 2136
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<queue>
#include<climits>
#include<set>
#include<map>
#define ll long long
using namespace std;

int main() {
	ll a, b, c,x;
	cin >> a >> b >> c;
	x = max({ a,b,c });
	if (x==a+b+c-x) {
		cout << "Yes" << endl;

	}
	else {
		cout<<"No"<<endl;
	}
}

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

using namespace std;

#define reep(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) reep((i),0,(n))

typedef complex<double> P;
#define EPS (1e-10)
#define INF (0x3f3f3f3f)
#define EQ(a,b) (abs((a)-(b)) < EPS)


double dot(P a,P b){
	return a.real()*b.real() + a.imag()*b.imag();
}

double cross(P a,P b){
	return a.real()*b.imag()-a.imag()*b.real();
}

int ccw(P a,P b,P c){
	P d = b-a;
	c-=a;
	double cr = cross(d,c);
	if(cr < -EPS) return 1;
	if(cr > EPS) return -1;
	if(dot(d,c) < -EPS) return 2;
	if(norm(d) < norm(c) - EPS) return -2;
	return 0;
}

int is_intersected_ls(P a1,P a2,P b1,P b2){
	return ccw(a1,a2,b1)*ccw(a1,a2,b2) <= 0 && ccw(b1,b2,a1)*ccw(b1,b2,a2) <= 0;
}

int main(){
	int n,m;
	cin>>n>>m;
	vector<vector<double>> a(n,vector<double>(n,INF));
	vector<vector<double>> b(m,vector<double>(m,INF));
	vector<P> v(n);
	vector<P> w(m);
	rep(i,n){
		double aa,bb;
		cin>>aa>>bb;
		v[i] = P(aa,bb);
	}
	rep(i,m){
		double aa,bb;
		cin>>aa>>bb;
		w[i] = P(aa,bb);
	}
	rep(i,n){
		rep(j,n){
			if(i==j) a[i][j] = 0;
			else{
				if(is_intersected_ls(w[0],w[1],v[i],v[j])){
					a[i][j] = INF;
				}
				else{
					a[i][j] = abs(v[i]-v[j]);
				}
			}
		}
	}
	rep(i,m){
		rep(j,m){
			if(i==j) b[i][j] = 0;
			else{
				if(is_intersected_ls(v[0],v[1],w[i],w[j])){
					b[i][j] = INF;
				}
				else{
					b[i][j] = abs(w[i]-w[j]);
				}
			}
		}
	}
	priority_queue<pair<double,int>> pq;
	double ans = INF;
	vector<int> used(n);
	vector<double> d(n,INF);
	pq.push(make_pair(-0.0,0));
	while(pq.size()){
		auto top = pq.top();
		pq.pop();
		if(d[top.second] < -top.first) continue;
		used[top.second] = 1;
		rep(i,n){
			if(used[i]) continue;
			if(d[i] < -top.first + a[top.second][i]) continue;
			d[i] = -top.first + a[top.second][i];
			pq.push(make_pair(top.first - a[top.second][i],i));
		}
	}
	ans=min(ans,d[1]+abs(w[0]-w[1]));
	pq.push(make_pair(-0.0,0));
	d.assign(m,INF);
	used.assign(m,0);
	while(pq.size()){
		auto top = pq.top();
		pq.pop();
		if(d[top.second] < -top.first) continue;
		used[top.second] = 1;
		rep(i,m){
			if(used[i]) continue;
			if(d[i] < -top.first + b[top.second][i]) continue;
			d[i] = -top.first + b[top.second][i];
			pq.push(make_pair(top.first - b[top.second][i],i));
		}
	}
	ans=min(ans,d[1]+abs(v[0]-v[1]));
	cout<<fixed<<setprecision(10);
	if(ans>=INF) cout<<-1<<endl;
	else{
		cout<<ans<<endl;
	}
}

Measured memory_bytes: 19084
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ll a,b,c,x,y;
    cin>>a>>b>>c>>x>>y;
    ll ans=max(x,y)*2*c;
    ans=min(ans,min(x,y)*2*c+(y>x?(y-x)*b:(x-y)*a));
    ans=min(ans,a*x+b*y);
    cout<<ans;
    return 0;
}


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

const int N = 200054;

int n, B;
int a[N];

inline void up(int &x, const int y) {x < y ? x = y : 0;}

inline bool check(int x) {
	for (int i = x * 2, j = n - 1; i < j; ++i, --j) if (a[i] + a[j] < B) return false;
	return true;
}

int main() {
	int i, j, L, R, M, ans = 0;
	scanf("%d%d", &n, &B), n *= 2;
	for (i = 0; i < n; ++i) scanf("%d", a + i);
	std::sort(a, a + n);
	for (L = 0, R = n / 2; L < R; ) check(M = (L + R) / 2) ? R = M : L = M + 1;
	for (i = 0, j = L * 2 - 1; i < j; ++i, --j) up(ans, a[i] + a[j]);
	for (i = L * 2, j = n - 1; i < j; ++i, --j) up(ans, a[i] + a[j] - B);
	printf("%d\n", ans);
	return 0;
}

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

// int/long:		-2,147,483,648 - 2,147,483,648 (-2^31 <= int < 2^31)
// long/long long:	-9,223,372,036,854,775,808 - 9,223,372,036,854,775,807 (-2^63 <= long < 2^63)

#define	INF (1<<29)
//536,870,912

// lower_bound(A.begin(), A.end(), N)
// upper_bound(...

// A.erase(unique(A.begin(), A.end()), A.end())

// bit: &/and, |/or, ^/xor, ~/not

// getline(cin, String)

// Graph
// Warshall-Floyd: Distance between each node, N^3
// Dijkstra: Distance from the start node, N^2
// DFS(Depth-First Search)

#define	MOD 1000000007

int	main() {
	int N, K;
	cin >>N >>K;
	int S=(N-1)*(N-2)/2;
	if (K>S) {
		cout <<-1 <<endl;
		return 0;
	}
	cout <<N-1+(S-K) <<endl;
	for (int i=2; i<=N; i++)
		cout <<1 <<' ' <<i <<endl;
	for (int i=2; i<N; i++)
		for (int j=i+1; j<=N; j++) {
			if (S==K)
				return 0;
			cout <<i <<' ' <<j <<endl;
			S--;
		}
	return 0;
}



Measured memory_bytes: 256
// AtCoder Beginner Contest 115 - Problem B: Christmas Eve Eve (https://atcoder.jp/contests/abc115/tasks/abc115_b)
#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using ii = pair<ll, ll>;

#define REP(i, a, b) for (int (i) = (a); (i) <= (b); (i)++)
#define REPN(i, N) for (int (i) = 0; (i) < N; (i)++)
#define DEC(i, b, a) for (int (i) = (b); (i) >= (a); (i)--)
#define DECN(i, N) for (int (i) = N - 1; (i) >= 0; (i)--)

#define LOG(var, sep) (cerr << #var << " = " << (var) << (sep))
#define LOGM(msg) (cerr << (msg))
#define LOGV(vec, sep) { cerr << #vec << " ="; for (const auto& v : (vec)) cerr << " " << v; cerr << (sep); }
#define LOGA(arr, N, sep) { cerr << #arr << " ="; for (int i = 0; i < N; ++i) cerr << " " << (arr)[i]; cerr << (sep); }
#define LOGA2(arr, N, M, sep) { cerr << #arr << " =\n"; for (int i = 0; i < N; ++i) { for (int j = 0; j < M; ++j) cerr << (arr)[i][j] << " "; cerr << endl; } cerr << (sep); }

ostream& operator<<(ostream& os, const ii& p)
{
    os << "(" << p.first << ", " << p.second << ")";
    return os;
}

const int MAX { 20 };

int ps[MAX];

void solve(int N)
{
    sort(ps, ps + N);

    auto ans = ps[N - 1]/2;

    REPN(i, N - 1)
        ans += ps[i];

    cout << ans << endl;
}

int main()
{
    ios::sync_with_stdio(false);

    int N;
    cin >> N;

    REPN(i, N)
        cin >> ps[i];

    solve(N);

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <cmath>
#include <vector>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#include <queue>

typedef long long ll;
const ll LL_MAX (1LL<<60);

#define rep(i,s,e) for(ll i=(s); i<(e); i++) 

using namespace std;

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

    string s;
    cin >> s;

    //vector<string> date ({"MON","TUE","WED","THU","FRI","SAT","SUN"});
    ll count(0);

    if ("MON" == s) count = 6;
    if ("TUE" == s) count = 5;
    if ("WED" == s) count = 4;
    if ("THU" == s) count = 3;
    if ("FRI" == s) count = 2;
    if ("SAT" == s) count = 1;
    if ("SUN" == s) count = 7;

    cout << count << endl;

    return 0;
}


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

#include <algorithm>
#include <cassert>
#include <cfloat>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define repLRE(i, l, r) for (ll i = (l); i <= (r); ++i)
#define rrepLRE(i, l, r) for (ll i = (l); i >= (r); --i)
#define Sort(v) sort(v.begin(), v.end())
#define rSort(v) sort(v.rbegin(), v.rend())
#define Reverse(v) reverse(v.begin(), v.end())
#define Lower_bound(v, x) \
  distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) \
  distance(v.begin(), upper_bound(v.begin(), v.end(), x))

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;
using T = tuple<ll, ll, ll>;
using vll = vector<ll>;
using vP = vector<P>;
using vT = vector<T>;
using vvll = vector<vector<ll>>;
using vvP = vector<vector<P>>;
using dqll = deque<ll>;

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

/* Macros reg. ends here */

const ll INF = 1LL << 50;

int main() {
  // ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cout << fixed << setprecision(15);

  ll n;
  cin >> n;

  vll xs(n), ys(n);
  rep(i, n) { cin >> xs[i] >> ys[i]; }

  map<P, ll> mp;
  rep(i, n) rep(j, n) {
    if (i == j)
      continue;
    else
      mp[P(xs[i] - xs[j], ys[i] - ys[j])]++;
  }

  ll ans = 0;
  for (auto& x : mp) chmax(ans, x.second);

  cout << n - ans << endl;

  return 0;
}


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

using namespace std;
using ll = long long;

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

#define READ(x) (cin >> (x))

#define WRITE_N(x) (cout << (x) << endl)
#define WRITE(x) (cout << (x))

int main() {
  // get values from input
  cin.tie(0);
  ios::sync_with_stdio(false);

  int K;
  string S;

  cin >> K >> S;

  // main procedure
  string output_str;

  if (S.size() > K) {
    output_str = S.substr(0, K);
    output_str += "...";
  } else {
    output_str = S;
  }

  // output
  WRITE_N(output_str);

  return 0;
}


Measured memory_bytes: 3676
import sys
import math
import bisect
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop


def LI(): return [int(x) for x in sys.stdin.readline().split()]


def I(): return int(sys.stdin.readline())


def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res


def IR(n):
    return [I() for i in range(n)]


# A
def A():
    S = input()
    if S == 'AAA' or S == 'BBB':
        print('No')
    else:
        print('Yes')
    return


# B
def B():
    return


# C
def C():
    return


# D
def D():
    return


# E
def E():
    return


# F
def F():
    return


# Solve
if __name__ == "__main__":
    A()


Measured memory_bytes: 38384
//auto 関数名 = [(&:ラムダ外の引数をとる時))](引数の型1 引数名1, 引数の型2, 引数名2, ...) { 関数の処理 }; //inside main() define function. take care of };
// for (int tmp = 0; tmp < (1 << ビット数); tmp++) {
//   bitset<ビット数> s(tmp);
//   // (ビット列sに対する処理)
// }
// sort(配列変数.begin(), 配列変数.end());
// do {
//   // 順列に対する処理
// } while (next_permutation(配列変数.begin(), 配列変数.end()));
//const double PI = acos(-1); M_PI
// cout << fixed << setprecision(10);
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG /GCC環境下で[]による配列要素参照のエラーを出す
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end() //sort(all(vec)); ,reverse(all(vec));etc
int main(){
  int a,b,k;
  cin>>a>>b>>k;
  if(a>b){
    swap(a,b);}
  vector<int> vec(a);
  for(int i=1;i<=a;i++){
    if((a%(i)==0)&&(b%(i)==0)){
      vec.push_back(i);
    }}
 reverse(all(vec));
 cout<<vec.at(k-1)<<endl;
}

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

#define FOR(i, a, b) for(int i = a;i < b;i++)
#define For(i, a) FOR(i, 0, a)
#define REV(i, a, b) for(int i = b-1;i >= a;i--)
#define Rev(i, a) REV(i, 0, a)
#define REP(a) For(i, a)
#define DEBUG_PRINT(...) fprintf(stderr, __VA_ARGS__)

using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef vector<int> vi;
void print_pair(pi a){
  cerr<<"("<<a.first<<", "<<a.second<<") ";
}
template<int T1, int T2>
void print_2d(int a[T1][T2], int x, int y){
  For(i, x){
    For(j, y){
      cerr<<a[i][j]<<" ";
    }
    cerr<<endl;
  }
}

template<typename T>
int sgn(T val){
  return (T(0)<val)-(val<T(0));
}

tuple<long long,long long,long long> egcd(long long a,long long b){
  if(a==0||b==0)return std::make_tuple(0LL,0LL,0LL);
  long long sa=sgn(a),sb=sgn(b);
  a=std::abs(a);b=std::abs(b);
  long long p=1,q=0,r=0,s=1;
  while(b>0){
    long long c=a/b;
    long long d;
    d=a;a=b;b=d%b;
    d=p;p=q;q=d-c*q;
    d=r;r=s;s=d-c*s;
  }
  return std::make_tuple(a,p*sa,r*sb);
}

long long inverse(long long a,long long m){
  auto b=egcd(a,m);
  if(std::get<0>(b)!=1)return 0;
  return (std::get<1>(b)<0)?std::get<1>(b)+m:std::get<1>(b);
}

long long factorial(long long a,long long m){
  long long ret=1;
  for (long long i = 1; i <= a; i++) {
    ret*=(i%m);
    ret%=m;
  }
  return ret;
}
long long partial_factorial(long long a,long long n,long long m){
  long long ret=1;
  for (long long i = 0; i < n; i++) {
    ret*=(a-i)%m;
    ret%=m;
  }
  return ret;
}
long long combination_prime(long long n,long long r,long long m){
  long long ret;
  long long fact_r=factorial(r,m);
  ret=inverse(fact_r,m);
  long long pfact_n=partial_factorial(n,r,m);
  ret*=pfact_n;
  ret%=m;
  return ret;
}
long long cache_cmb[1000000],cache_inv_fact[1000000];
bool cached=false;
long long combination_cached(long long n,long long r,long long m){
  if(cached==false){
    cached=true;
    cache_inv_fact[1]=1;
    for (long long i = 2; i <= n; i++) {
      cache_inv_fact[i]=(m-m/i)*cache_inv_fact[m%i]%m;
    }
    cache_cmb[0]=1;
    for (long long i = 1; i <= n/2; i++) {
      cache_cmb[i]=cache_cmb[i-1]*(n-i+1)%m*cache_inv_fact[i]%m;
    }
  }
  r=min(r,n-r);
  return cache_cmb[r];
}

ll N,A,B,K;
vector<pair<ll,ll> > pat;
const long long mod=998244353;
int main()
{
        ll n,a,b,k,ans=0;
  cin>>n>>a>>b>>k;
  for(ll i=0;i<=n;i++)
  {
    if(a*i>k) break;
    if((k-a*i)%b!=0)continue;
    ll j=(k-a*i)/b;
    if(j>n) continue;
    ans+=combination_cached(n,i,mod)*combination_cached(n,j,mod)%mod;
    ans%=mod;
  }
        printf("%lld\n",ans);
        return 0;
}


Measured memory_bytes: 8448
#include <iostream>
#include <cstring>
#include <cstdio>
#include <string>
using namespace std;
int main(){
  int n ,cnt=0 ,cnt2=0;
  string s;
  while( 1 ){
    cin >> s;
    if( cin.eof() ){
      break;
    }
    n = s.size();
    
    for( int i=0 ; i<n ; i++ ){
      if( s[i] == 'J' ){
	if( s[i+1] == 'O' ){
	  if( s[i+2] == 'I' ){
	    cnt++;
	  }
	}
      }
      if( s[i] == 'I' ){
	if( s[i+1] == 'O' ){
	  if( s[i+2] == 'I' ){
	    cnt2++;
	  }
	}
      }
    }
    printf( "%d\n%d\n" ,cnt ,cnt2 );
    cnt = 0;
    cnt2 = 0;
  }
  
  return 0;
}

Measured memory_bytes: 1192
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
 
using namespace std;
 
#define PB push_back
#define MP make_pairA
#define REP(i,n) for(int i=0;i<(n);i++)
int main()
{
    int a,b;
    cin>>a>>b;
    cout<<max(a+b,max(a-b,a*b))<<endl;
}


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

#define infile "../test/sample-3.in"
#define int long long
// #define INF 2147483647
#define INF 1000000000000000000LL
#define MOD 1000000007LL

// {{{ define basic macro
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) repi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)(b-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)

#define foreach(x,a) for(auto& (x) : (a) )
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)

#define all(x) (x).begin(),(x).end()
#define sum(v) accumulate(all(v), 0)
#define sz(x) ((int)(x).size())
template<class T> inline void chmax(T &a, const T &b) { if(a < b) a = b; }
template<class T> inline void chmin(T &a, const T &b) { if(a > b) a = b; }
// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}
#define fill(x,y) memset(x,y,sizeof(x))
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define ten(n) ((int)1e##n)

template <class T = int>
T in() {T x; cin>>x; return (x);}

struct Fast {
  Fast(){
    std::cin.tie(0);
    ios::sync_with_stdio(false);
  }
} fast;
// }}}
//{{{ dump macro
#ifdef PCM
  #include "dump.hpp"
#else
  #define dump(...) 42
  #define dump_1d(...) 42
  #define dump_2d(...) 42
#endif
//}}}
//{{{ others
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;
template<typename T>
using PQ = priority_queue<T, vector<T>, greater<T>>;

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

// Combination Table{{{
int C[51][51]; // C[n][k] -> nCk
void comb_table(int N){
  for(int i=0;i<=N;++i){
    for(int j=0;j<=N;++j){
      if(j==0 or j==i){
        C[i][j]=1LL;
      }else{
        C[i][j]=(C[i-1][j-1]+C[i-1][j]);
      }
    }
  }
}/*}}}*/

int solve(){
  int n,a,b;cin>>n>>a>>b;
  int v[n]; rep(i, n){ cin>>v[i]; }
  sort(v, v+n, greater<int>());
  comb_table(50);

  dump_1d(v, n);

  double s = 0;
  rep(i, a){ s += v[i]; }
  double av = s/a;

  printf("%.7f\n", av);

  if (v[a-1]!=v[0]) {
    int cnt = 0;
    int incnt = 0;
    rep(i, n){
      if (v[i]==v[a-1]){
        cnt++;
        if (i <= a-1) incnt++;
      }
    }
    printf("%lld\n", C[cnt][incnt]);
  }
  else{
    int num=n;  // v[0]と同じ数の個数
    rep(i, n){
      if (v[i]!=v[0]) {
        num = i;
        break;
      }
    }
    dump(num);

    int ans = 0;
    rep(k, a, min(b, num)+1){
      ans += C[num][k];
    }
    printf("%lld\n", ans);
  }
  return 0;

}

int test(){ //{{{
  return 0;
}
//}}}

signed main() { //{{{
#ifdef INPUT_FROM_FILE
  std::ifstream in(infile);
  std::cin.rdbuf(in.rdbuf());
#endif
#ifdef PCM
  test();
#endif
  solve();
  return 0;
} //}}}


Measured memory_bytes: 256
public class Main {

	public static void main(String[] args) {
		String s = new java.util.Scanner(System.in).nextLine();
		boolean bool = true;
		
		for (int i = 0; i < s.length(); i++) {
			char c = s.charAt(i);
			if((i + 1) % 2 == 1 && c == 'L') {
				bool = false;
				break;
			}
			if((i + 1) % 2 == 0 && c == 'R') {
				bool = false;
				break;
			}
		}

		if(bool == true) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}

}

Measured memory_bytes: 23764
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws Exception {
        // TODO ?????????????????????????????????????????????
        boolean[] arg = null;
        int[] states=null;
        int kouho=0,member=0;
        int i=0;
        //int state=0;
        
        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            String line;
            while ((line = br.readLine()) != null) {
            	String[] tokens = line.split(" ");
                if(tokens.length==2){
                    member=Integer.parseInt(tokens[0]);
                    kouho=Integer.parseInt(tokens[1]);
                    states=new int[kouho];
                    if(member==0&&kouho==0)break;
                    i=0;
                }else{
                    for(int k=0;k<kouho;k++){
                    	states[k]+=Integer.parseInt(tokens[k]);
                    }
                    i++;
                    if(i==member){
                    	int[] score=new int[kouho];
                    	int count=0;
                    	for(int l=member;-1<l;l--){
                    		for(int j=0;j<kouho;j++){
                    			if(states[j]==l){
                    				score[count]=j+1;
                    				count++;
                    			}
                    			if(count==kouho){
                        			break;
                        		}
                    		}
                    		if(count==kouho){
                    			break;
                    		}
                    	}
                    	String[] str=new String[kouho];
                    	for(int l=0;l<kouho;l++){
                    		str[l]=Integer.toString(score[l]);
                    	}
                    	System.out.print(String.join(" ", str));
                    	System.out.println();
                    }
                }
            }
        }
    }

}

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

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rept(i,n) for(int (i)=0;(i)<=(int)(n);(i)++)
#define reps(i,s,n) for(int (i)=(s);(i)<(int)(n);(i)++)
#define repst(i,s,n) for(int (i)=(s);(i)<=(int)(n);(i)++)
#define repr(i,n) for(int (i)=(n);(i)>=0;(i)--)
#define each(itr,v) for(auto (itr):(v))
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define mp(x,y) make_pair((x),(y))
#define fi first
#define se second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln "\n"
#define show(x) cout << #x << " = " << x ln
#define dbg(x) cout<<#x"="<<x ln

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

const int inf = (int)1e9;
const ll linf = (ll)1e18;
const int mod = (int)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;

// ━━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…
// .｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋
// ・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・

int m1, m2, s1, s2, thaw, mx, ans1, ans2;

int main() {
	cin >> m1 >> m2 >> s1 >> s2 >> thaw >> mx;
	m1 *= 100, m2 *= 100;
	
	for (int i = 0; i*m1 <= mx; ++i) {
		for (int j = 0; i*m1 + j*m2 <= mx; ++j) {
			for (int k = 0; i*m1 + j*m2 + s1*k <= mx; ++k) {
				for (int l = 0; i*m1 + j*m2 + s1*k + s2*l <= mx; ++l) {
					int m = m1*i + m2*j;
					int s = s1*k + s2*l;
					// 水mに対して砂糖sが溶けきらない場合
					if (s > m/100*thaw) break;
					if (ans2*(m+s) <= ans1*s) {
						ans1 = m + s;
						ans2 = s;
					}
				}
			}
		}
	}
	cout << ans1 << " " << ans2 << ln;
}

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

int main() {
    int n,m;
    cin >> n >> m;
    vector<int> a(n,-1);
    int ans=0;
    for(int i = 0; i < m; i++) {
        int s,c; cin >> s >> c;
        if(a[s-1]==-1) a[s-1]=c;
        else{
            if(a[s-1]!=c) {
                cout << -1 << endl;
                return 0;
            }
        }
        if(n!=1 && a[0]==0){
            cout << -1 << endl;
            return 0;
        }
    }
    if(a[0]==-1) {
        if(n==1) a[0]=0;
        else a[0]=1;
    }
    for(int i = 1; i < n; i++) {
        if(a[i]==-1) a[i]=0;
    }
    for(int i = 0; i < n; i++) {
        cout << a[i];
    }
    cout << endl;


    return 0;
}

Measured memory_bytes: 3576
import sys
sys.setrecursionlimit(10**7)

N = int(input())
edge = [[] for _ in range(N)]
v_dic = {}
b_l = []
for i in range(N-1):
    a, b = map(lambda x:int(x)-1, input().split())
    edge[a].append(b)
    if a not in v_dic:
        v_dic[a] = 1
    else:
        v_dic[a] += 1
    if b not in v_dic:
        v_dic[b] = 1
    else:
        v_dic[b] += 1
    b_l.append(b)
colors = [0 for _ in range(N)]


def bfs(p_node, p_color):
    children_node = edge[p_node]
    c_color = 1
    for child_node in children_node:
        if c_color == p_color:
            c_color += 1
        colors[child_node] = c_color
        bfs(child_node, c_color)
        c_color += 1


def solve():
    bfs(0, 0)

    print(max(v_dic.values()))
    for b in b_l:
        print(colors[b])


if __name__ == '__main__':
    solve()

Measured memory_bytes: 68576
// Last Change: 07/07/2019 21:01:05.
#include <algorithm>
#include <array>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

int main() {
  int N, A, B;
  cin >> N >> A >> B;

  cout << min(A * N, B) << endl;
}


Measured memory_bytes: 888
#include <iostream>

int main() {
    unsigned long long int n;
    std::cin >> n;

    if (n & 1)
    {
        std::cout << 0 << std::endl;
    }
    else
    {
        n /= 2;
        unsigned long long int count = 0;
        unsigned long long int k = 5;
        while (k <= n)
        {
            count += n / k;
            k *= 5;
        }
        std::cout << count << std::endl;
    }

    return 0;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std::literals::string_literals;
using i64 = std::int_fast64_t;
using std::cout;
using std::endl;
using std::cin;

template<typename T>
std::vector<T> make_v(size_t a){return std::vector<T>(a);}

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

int main() {
	int n; scanf("%d", &n); std::vector<int> a(n);
	for(int i = 0; i < n; i++) scanf("%d", & a[i]);
	sort(begin(a), end(a), std::greater<int>());
	
	i64 ans = 0;
	for(int i = 0; i < n; i++) {
		int k = n - 1;
		for(int j = i + 1; j < n; j++) {
			while(j < k and a[i] >= a[j] + a[k]) k--;
			if(i < j and j < k) ans += k - j;
		}
	}
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 256
using System;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using System.Text.RegularExpressions;
using static System.Math;
using MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions;
using MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute;

public static class P
{
    public static void Main()
    {
        var nm = Console.ReadLine().Split().Select(int.Parse).ToArray();
        PriorityQueue<int> pqueue = new PriorityQueue<int>(true);
        foreach (var item in Console.ReadLine().Split().Select(int.Parse))
        {
            pqueue.Push(item);
        }
        for (int i = 0; i < nm[1]; i++)
        {
            pqueue.Push(pqueue.Pop() >> 1);
        }
        long sum = 0;
        while (pqueue.Count > 0)
        {
            sum += pqueue.Pop();
        }
        Console.WriteLine(sum);
    }
}


class PriorityQueue<T> where T : IComparable<T>
{
    public int Count { get; private set; }
    private bool Descendance;
    private T[] data = new T[65536];
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public PriorityQueue(bool descendance = false) { Descendance = descendance; }
    public T Top
    {
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        get { ValidateNonEmpty(); return data[1]; }
    }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public T Pop()
    {
        var top = Top;
        var elem = data[Count--];
        int index = 1;
        while (true)
        {
            if ((index << 1) >= Count)
            {
                if (index << 1 > Count) break;
                if (elem.CompareTo(data[index << 1]) > 0 ^ Descendance) data[index] = data[index <<= 1];
                else break;
            }
            else
            {
                var nextIndex = data[index << 1].CompareTo(data[(index << 1) + 1]) <= 0 ^ Descendance ? (index << 1) : (index << 1) + 1;
                if (elem.CompareTo(data[nextIndex]) > 0 ^ Descendance) data[index] = data[index = nextIndex];
                else break;
            }
        }
        data[index] = elem;
        return top;
    }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public void Push(T value)
    {
        int index = ++Count;
        if (data.Length == Count) Extend(data.Length * 2);
        while ((index >> 1) != 0)
        {
            if (data[index >> 1].CompareTo(value) > 0 ^ Descendance) data[index] = data[index >>= 1];
            else break;
        }
        data[index] = value;
    }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    private void Extend(int newSize)
    {
        T[] newDatas = new T[newSize];
        data.CopyTo(newDatas, 0);
        data = newDatas;
    }
    private void ValidateNonEmpty() { if (Count == 0) throw new Exception(); }
}

Measured memory_bytes: 25564
import java.util.*;
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    
    String S = sc.next();
    
    String first = S.substring(0, 1);
    String second = S.substring(1, 2);
    String third = S.substring(2, 3);
    String fourth = S.substring(3, 4);

    int a = 0;
    int b = 0;
    int c = 0;
    int d = 0;

    if (first.equals("+")) {
      a = 1;
    } else {
      a = -1;
    }
    if (second.equals("+")) {
      b = 1;
    } else {
      b = -1;
    }
    if (third.equals("+")) {
      c = 1;
    } else {
      c = -1;
    }
    if (fourth.equals("+")) {
      d = 1;
    } else {
      d = -1;
    }

    System.out.println(a + b + c + d);
  }
}

Measured memory_bytes: 23380
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define endl '\n'
const int inf = 1000000007;
const ll INF = 1e18;
// int mod = 998244353;
int mod = 1000000007;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a % b); }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
template<typename T1, typename T2> T1 pow_(T1 a, T2 b) { return b ? pow_(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
ll modpow(ll a, ll b, ll _mod) { return b ? modpow(a * a % _mod, b / 2, _mod) * (b % 2 ? a : 1) % _mod : 1; }
template<class T, class U> ostream& operator << (ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; return os; }
template<class T> ostream& operator << (ostream& os, const vector<T>& vec) { rep(i, sz(vec)) { if (i) os << " "; os << vec[i]; } return os; }
template<typename T> inline istream& operator >> (istream& is, vector<T>& v) { rep(j, sz(v)) is >> v[j]; return is; }
template<class T, class T2> inline void add(T &a, T2 b) { a += b; if (a >= mod) a -= mod; }


void solve();

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout << fixed << setprecision(10);
  int T;
  T = 1;
  while (T--) solve();
}

void solve() {
  string s;
  cin >> s;
  if (s == "ARC") cout << "ABC" << endl;
  else cout << "ARC" << endl;
}


Measured memory_bytes: 3612