akhauriyash/Code-Regression huggingface dataset:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

from random import *
from functools import reduce,partial
from time import time
from pprint import pprint

def readln():
    return list(map(int,input().split(' ')))

def identity(x):
    """Return the input itself."""
    return x

def constant(c):
    """Return an function which always
    returns the input constant c."""
    def const_function(const,*args):
        return const
    return partial(const_function,c)

def inc(c = 1):
    """Return a function which reads an input x and returns x + c as output.
    By default, c equals 1."""
    return lambda x: x + c

def add(*args):
    """Return the sum of the input."""
    def add2(x,y): return x + y
    return reduce(add2,args)

def mapv(f,*lst):
    """Return a vector of the result of map."""
    return list(map(f,*lst))

def vector(*args):
    """Return a vector of input parameters."""
    return args

def sequence(n,f = constant(0)):
    """Return a vector of length n, and initialize the i'th
    item with f(i).By default the vector will initialized with 0."""
    return [f(i) for i in range(0,n)]

def matrix(n,m,f = constant(0)):
    """Return a 2-dim vector which contains n vectors with length m.
    The j's item of vector i will be initialized by f(i,j).By default,
    the vector will be initialized with 0."""
    return [[f(i,j) for j in range(0,m)] for i in range(0,n)]

def flat(v):
    """Return a flat vector which contains the elements of v in their
    origin order.If the input is not a vector, return a vector which
    only contains the input."""
    if not isinstance(v,list): return [v]
    if not v: return []
    return reduce(add,mapv(flat,v))

def partition(v,f = identity):
    """Partition vector v by f(v[i]).
    e.g. partition([1,2,3,1,2,3],identity()) == {1:[1,1,1], 2:[2,2], 3:[3]}
    By default, the vector will be partitioned by identity function."""
    result = {}
    for item in v:
        key = f(item)
        s = result.get(key)
        if s:
            s.append(item)
        else:
            result.update({key:[item]})
    return result

def getValue(key):
    """Return a function which returns the value of key in a hash-map.
    If the key do not exist, it will throw an error."""
    return lambda x: x[key]

def mapValue(f,m):
    """Replace each value in hash-map m with f(value).
    Return the new hash-map."""
    res = {}
    for key in m:
        res.update({key: f(m[key])})
    return res

p = 1000000000 + 7

n,w = readln()
f = [sequence(303) for i in range(0,n+1)]
w1 = -1
f[0] = sequence(303,constant(-1000))
f[0][0] = 0
for i in range(0,n):
    g = [row [:] for row in f]
    wi,vi = readln()
    if w1 < 0 : w1 = wi
    wi -= w1
    for count in range(0,i+1):
        for weight in range(0,303 - wi):
            f[count + 1][weight + wi] = max(
                f[count + 1][weight + wi],
                g[count][weight] + vi)
ans = 0
for count in range(0,n+1):
    for weight in range(0,303):
        if weight + count * w1 <= w:
            ans = max(ans,f[count][weight])
print(ans)


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

int main() {
    ll a,b,c,k;
    cin>>a>>b>>c>>k;
    ll res=min(a,k);
    k=max(0*1ll,k-a-b);
    res -= min(k,c);
    cout<<res<<endl;
}

Measured memory_bytes: 3640
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

var (
	read  = bufio.NewReader(os.Stdin)
	write = bufio.NewWriter(os.Stdout)
)

func min(a, b int) int {
	if a <= b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a >= b {
		return a
	}
	return b
}

func yesno(result bool) {
	if result {
		fmt.Fprintln(write, "Yes")
	} else {
		fmt.Fprintln(write, "No")
	}
}

func printansStr(result bool, a, b string) {
	if result {
		fmt.Fprintln(write, a)
	} else {
		fmt.Fprintln(write, b)
	}
}

func printansInt(result bool, a, b int) {
	if result {
		fmt.Fprintln(write, a)
	} else {
		fmt.Fprintln(write, b)
	}
}

type student struct {
	id int
	no int
}

type students []student

func (st students) Len() int {
	return len(st)
}

func (st students) Less(i, j int) bool {
	return st[i].no < st[j].no
}

func (st students) Swap(i, j int) {
	st[i], st[j] = st[j], st[i]
}

func main() {
	defer write.Flush()

	var n int
	fmt.Fscan(read, &n)

	st := make(students, n)
	for i := 0; i < n; i++ {
		fmt.Fscan(read, &st[i].no)
		st[i].id = i + 1
	}
	sort.Sort(st)
	for _, s := range st {
		fmt.Fprint(write, s.id, " ")
	}
	fmt.Fprintln(write, "")
}


Measured memory_bytes: 5248
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
#define REP(i,s,n) for(int i = s; i < n; i++)
#define all(a) (a.begin(),a.end())
typedef long long ll;
using Graph = vector<vector<int>>;
const int INF = 1000000007;
int main(){
  int n;
  cin >> n;
  vector<int>v(n);
  rep(i,n)cin >> v[i];
  int ans = 0;
  rep(i,n)ans ^= v[i];
  rep(i,n){
    int tmp = ans ^ v[i];
    if(i == n - 1)cout << tmp << endl;
    else cout << tmp << " ";
  }
  return 0;
}


Measured memory_bytes: 3980
#include <iostream>
#include <vector>
#include <string>
#include <ctype.h>
#include <sstream>
using namespace std;

bool in_word (string s1, string s2) {
    stringstream ss;
    ss << s1;
    while (ss >> s1) {
        if (s1 == s2) return true;
    }
    return false;
}

string affin (string str, int a, int b) {
    int tmp[26];
    for (int i = 0; i < 26; i++) tmp[i] = -1;
    for (int i = 0; i < str.size(); i++) {
        if (!(isalpha(str[i]))) continue;
        int s = str[i] - 'a';
        int g = (a * s + b) % 26;
        if (tmp[g] != -1 && tmp[g] != s) return "";
        else if (tmp[g] == -1) tmp[g] = s;
        str[i] = (char)(g + 'a');
    }
    
    return str;
}

int main ()
{
    int n;
    cin >> n;
    string str;
    getline(cin, str);
    while (n--) {
        getline(cin, str);
        for (int i = 0; i <= 26; i++) {
            for (int j = 0; j <= 26; j++) {
                string tmp = affin(str, i, j);
                if (tmp == "") continue;
                if (in_word(tmp, "this") || in_word(tmp, "that")) {
                    cout << tmp << endl;
                    goto escape;
                }
            }
        }
    escape:;
    }
    
    return 0;
}

Measured memory_bytes: 1232
#include<bits/stdc++.h>
 
using namespace std;
 
int main(){
 
     int x, y;
 
     cin >> x >> y;
 
     int ans = 1;
 
     for(int a = 0; a < x; a++) ans *= 100;
 
     if(y == 100) ans *= 101;
 
     else ans *= y;

     cout << ans << endl;
 
     return 0;
 
}     

Measured memory_bytes: 256
//Code by Mukul Totla
#include<bits/stdc++.h>
using namespace std;
#define ll long long

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

  ll n,i;
  cin>>n;
  string str;
  cin>>str;
 
  ll cnt1=0,cnt2=0;
  for(i=0; i<n; i++)
  {
    if(str[i]=='R')
      cnt1++;
    else
      cnt2++;
  }
  ll ans=min(cnt1,cnt2);

  ll r=n-1;
  ll cnt=0;
  
  ll l=0;

  while(l<r)
  {
     if(str[l]=='W' && str[r]=='R')
     {
       swap(str[l], str[r]);
      cnt++;
     }
    
    while(str[l]=='R')
      l++;
    while(str[r]=='W')
      r--;
  }
  ans=min(ans,cnt);
  cout<<ans;

  return 0;
}

Measured memory_bytes: 3756
#include<stdio.h>
int is_prime(int n)
{
	int i;
	for (i = 2; i*i <= n; i ++) {
		if (n%i == 0)
			return 0;
	}
	return 1;
}
int main()
{
	int n, m;
	while (scanf("%d", &n)>0) {
		for (m = n-1; !is_prime(m); m --);
		printf("%d ", m);
		for (m = n+1; !is_prime(m); m ++);
		printf("%d\n", m);
	}
	return 0;
}

Measured memory_bytes: 0
import java.lang.Integer;
import java.util.Arrays;
import java.util.stream.Stream;
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        Integer[] tiles = Stream.of(S.split("")).map(Integer::valueOf).toArray(Integer[]::new);

        if (tiles.length == 1) {
            System.out.println(0);
            return;
        }

        int answer = 0;
        for (int i = 1; i < tiles.length; i++) {
            // flip if next tile has the same color
            if (tiles[i] == tiles[i-1]) {
                answer++;

                switch (tiles[i]) {
                case 0:
                    tiles[i] = 1;
                    break;
                case 1:
                    tiles[i] = 0;
                    break;
                }
            }
        }

        System.out.println(Math.min(answer, tiles.length-answer));
    }
}


Measured memory_bytes: 33392
#include<bits/stdc++.h>
using namespace std;
int main() {
	string s;
	cin >> s;
	vector<int> cnt(27,0);
	for(int i=0; i<s.size(); i++) {
		cnt[s[i]-'a']++;
	}
	int odd = 0;
	for(int i=0; i<27; i++) {
		if(cnt[i] %2==1)odd++;
	}
	cout << odd /2 << endl;
	
	return 0;
}

Measured memory_bytes: 3136
import sys
n = int(input())
t,a = map(int, sys.stdin.readline().split())
h = list(map(int, sys.stdin.readline().split()))

ans = 0
temp = 100000000
for i in range(len(h)):
    temperature = t - h[i] * 0.006
    if abs(temperature - a) < temp:
        temp = abs(temperature - a)
        ans = i + 1
    

print(ans)

Measured memory_bytes: 3064
#include <stdio.h>

void showAbacus( int number );

int main( void )
{
	int number;
	
	scanf( "%d", &number );
	showAbacus( number );
	while( scanf( "%d", &number ) != EOF )
	{
		printf( "\n" );
		showAbacus( number );
	}
	return (0);
}

void showAbacus( int number )
{
	char char_Number[6];
	int i;
	int j;
	
	
	sprintf( char_Number, "%05d", number );
	
	for( i = 0; i < 5; i++ )
	{
		if( char_Number[i] > '4' )
		{
			printf( " " );
		}
		else
		{
			printf( "*" );
		}
	}
	printf( "\n" );
	for( i = 0; i < 5; i++ )
	{
		if( char_Number[i] > '4' )
		{
			printf( "*" );
		}
		else
		{
			printf( " " );
		}
	}
	printf( "\n" );
	for( i = 0; i < 5; i++ )
	{
		printf( "=" );
	}
	printf( "\n" );
	
	for( i = 0; i < 5; i++ )
	{
		for( j = 0; j < 5; j++ )
		{
			if( char_Number[j] - '0' == i || char_Number[j] - '0' == i + 5 )
			{
				printf( " " );
			}
			else
			{
				printf( "*" );
			}
		}
		printf( "\n" );
	}
}

Measured memory_bytes: 620
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
// *st.find_by_order(index), 0-based
// order_of_key(e)

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int N; string s; cin>>N>>s;
	vector<int> W,R;
	for (int i=0; i<N; i++)
		if(s[i]=='R') R.push_back(i);
		else W.push_back(i);
	reverse(R.begin(),R.end());
	int ret=0;
	int x=W.size(), y=R.size();
	for (int i=0; i<min(x,y); i++)
		if(W[i]<R[i])
			ret++;
	cout<<ret<<"\n";
	return 0;
}

Measured memory_bytes: 4748
def factorial(n):
  fact = 1
  for i in range(2, n+1):
    fact = fact * i % (10**9+7)
  return fact

N, M = map(int, input().split())
MOD = 10**9+7
if N == M:
  print(2*factorial(N)**2 % MOD)
elif abs(N-M) == 1:
  print(factorial(min(N, M))**2 * max(N, M) % MOD)
else:
  print(0)

Measured memory_bytes: 3064
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
	String A = sc.next();
    String B = sc.next();
      int count =0;
      for(int i=0;i<3;i++){
       if(A.substring(i,i+1).equals(B.substring(i,i+1))) {
         count++;
       }
      }
      

 
      System.out.println(count);
    }
  
  private static long lcm(long m, long n) {
    return m * n / gcd(m, n);
}
  
  private static long gcd(long m, long n) {
    if(m < n) return gcd(n, m);
    if(n == 0) return m;
    return gcd(n, m % n);
}
}

Measured memory_bytes: 22996
def main():
  n, d, mods = 0, 1, [1]+[0]*2019
  for i in reversed(input()):
    n = (n+int(i)*d)%2019
    d = d*10%2019
    mods[n] += 1
  print(sum([i*(i-1)//2 for i in mods]))
main()

Measured memory_bytes: 9308
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
ll x[1010],y[1010],z[1010];
int main(){
	ll n,m;
	cin>>n>>m;
	for(int i=0;i<n;i++){
		cin>>x[i]>>y[i]>>z[i];
	}
	ll ans=0;
	for(int i=0;i<7;i++){
		ll num[3]={1,1,1};
		for(int j=0;j<3;j++){
			if(i&(1<<j)){
				num[j]*=-1;
			}
		}
		vector<P>v;
		for(int i=0;i<n;i++)v.push_back({-(num[0]*x[i]+num[1]*y[i]+num[2]*z[i]),i});
		sort(v.begin(),v.end());
		ll sum[3]={};
		for(int i=0;i<m;i++){
			sum[0]+=x[v[i].second];
			sum[1]+=y[v[i].second];
			sum[2]+=z[v[i].second];
		}
		ans=max(ans,abs(sum[0])+abs(sum[1])+abs(sum[2]));
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 3680
#include <stdio.h>

int main(){
    int i, j;
    int h, w;

    while(scanf("%d%d", &h, &w), h != 0){
        for(i=0; i<h; i++){
            for(j=0; j<w; j++){
                printf("#");
            }
            printf("\n");
        }
        printf("\n");
    }
    return 0;
}



Measured memory_bytes: 2040
#n = int(input())
import random
import sys
sys.setrecursionlimit(10 ** 7)
n, m = map(int, input().split())
#n=200000
#m=200000
#al = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]
adjl = [[] for _ in range(n+1)]
NIL = -1
appear = {}
isalone = {}
for i in range(m):
    a, b = map(int, input().split())
    #a=random.randrange(1,n+1)
    #b=random.randrange(1,n+1)
    #while a==b:
    #    b=random.randrange(1,n+1)
    #print(a,b)
    if appear.get((a, b), False) or appear.get((a, b), False):
        continue
    appear[(a, b)] = True
    appear[(b, a)] = True
    isalone[a] = False
    isalone[b] = False
    adjl[a].append(b)
    adjl[b].append(a)

color = [NIL for i in range(n+1)]
color_id = 0


def dfs(u, color_id):
    global color
    color[u] = color_id
    for v in adjl[u]:
        if color[v] == NIL:  # 未到達なら再起呼び出し
            color[v] = color_id
            dfs(v, color_id)


for u in range(1, n+1):
    if color[u] == NIL:
        color_id += 1
        dfs(u, color_id)

group = {}
for i in range(1, n+1):
    if isalone.get(i, True):
        continue
    group[color[i]] = group.get(color[i], 0)+1

mx = 1
for k, v in group.items():
    mx = max(mx, v)

print(mx)


Measured memory_bytes: 267360
X = int(input())

for i in range(-118, 120):
  for j in range(-119, i):
    if i**5 - j**5 == X:
      A = i
      B = j
    if j**5 - i**5 == X:
      B = i
      A = i

print('{} {}'.format(A, B))

Measured memory_bytes: 9112
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
#define double long double
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef vector<pii> VP;
typedef vector<string> VS;
typedef priority_queue<int> PQ;
template<class T>bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
#define eps 1e-12 
//priority_queue<int,vector<int>, greater<int> > q2;



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

	int N; cin >> N;
	VI A(N);
	REP(i, N)cin >> A[i];
	int ans = 0;
	int ma = A[0];
	FOR(i, 1, N) {
		ans += max(0LL, ma -A[i]);
		chmax(ma, A[i]);
	}
	cout << ans << endl;
	return 0;
}



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

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

  double v[100];
  
  for(int i=0;i<n;i++){
  
    cin >> v[i];
  }

  sort(v,v+n);


  for(int i=0;i<n-1;i++){
    double d = v[i] + v[i+1]; 
    double x = d/2.0; 
    v[i+1] = x;
  }

  cout << fixed << setprecision(10);
  cout << v[n-1] << endl;

  
  


  return 0;
}


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

int main(){
    //入力
    int A,B,C,D;
    cin >> A >> B >> C >> D;

    //出力
    int ans=0;
    if(A<=C&&C<B){
        ans=min(B,D)-C;
    }else if(C<A&&D>A){
        ans=min(B,D)-A;
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main(){
  int n;
  int a[4];
  int i;
  
  cin >> n;

  for(i=0;i<4;i++){
    a[i] = n % 10;
    n /= 10;
  }

  int count = 1;
  int ans = 0;
  for(i=1;i<4;i++){
    if(a[i] == a[i - 1]){
      count += 1;
      ans = max(ans, count);
    }else{
      count = 1;
    }
  }

  if(ans >= 3){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }

  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
 
#define INF 1000000000
 
#define min(a,b) (((a)<(b))?(a):(b))
#define max(a,b) (((a)>(b))?(a):(b))

int main() {
	int N, M;
	int x, y;
	int check[100001] = {0};
	int count[100001];
	long ans = 0;
	long i, j;
	
	
	scanf("%d %d", &N, &M);
	for(i=1;i<=N;i++) count[i] = 1;
	check[1] = 1;
	for(i=1;i<=M;i++) {
		scanf("%d %d", &x, &y);
		check[y] |= check[x];
		count[x]--; count[y]++;
		if(count[x] == 0) check[x] = 0;
	}
	for(i=1;i<=N;i++) {
		//printf("%d ", check[i]);
		ans += check[i];
	}
	//printf("\n");
	
	printf("%ld\n", ans);
	
	return 0;
}

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

typedef long long ll;
using namespace std;
const ll mod = 1000000007;
const ll mod998 = 998244353;
const ll intmax = 2147483647;
const ll llmax = 9223372036854775807;
const char sp = ' ';



int r1, c1, r2, c2;
ll f[3000001], res;

inline ll pw(ll x, int y) {
	ll a = 1;
	while (y) {
		if (y & 1)a = a*x%mod;
		x = x*x%mod;
		y /= 2;
	}
	return a;
}

inline ll modinv(ll x) {
	return pw(x, mod - 2);
}

inline ll comb(int n, int r) {
	return f[n] * modinv(f[n - r] * f[r] % mod) % mod;
}

int main() {
	cin >> r1 >> c1 >> r2 >> c2;
	f[0] = 1;
	for (ll i = 1; i <= 3000000; i++) {
		f[i] = f[i - 1] * i%mod;
	}
	for (int i = r1; i <= r2; i++) {
		res += comb(i + 1 + c2, i + 1);
		res += mod - comb(i + c1, i + 1);
		res %= mod;
	}
	cout << res << endl;
}

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

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define mem(a,b) memset(a,b,sizeof(a))
#define eb emplace_back
#define mp make_pair
using namespace std;
int main(){
    int n;
    cin>>n;
    cout<<(n-1)/2<<endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder.Abc
{
    class QuestionB
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            // 整数の入力
            int n = int.Parse(Console.ReadLine());

            // 整数配列の入力
            var a = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();

            var flag = true;

            for(int i = 0; i < n; i++) {
                if(a[i] % 2 == 0) {
                    if(a[i] % 3 != 0 && a[i] % 5 != 0) {
                        flag = false;
                        break;
                    }
                }
            }

            Console.WriteLine(flag ? "APPROVED" : "DENIED");

            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 13396
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader r = new BufferedReader(new InputStreamReader(System.in),1);
		int[] rank3 = {0,0,0};
		int mountain;
		for(int i=0; i<10; i++){
			mountain = Integer.parseInt(r.readLine());
			if(rank3[0] < mountain){
				rank3[2] = rank3[1];
				rank3[1] = rank3[0];
				rank3[0] = mountain;
			}else if(rank3[1] < mountain){
				rank3[2] = rank3[1];
				rank3[1] = mountain;
			}else if(rank3[2] < mountain){
				rank3[2] = mountain;
			}
		}
		for(int i=0; i<3; i++){
			System.out.println(rank3[i]);
		}
	}

}

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

using namespace std;

int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    int n;
    cin >> n;

    vector<string> users(n);

    for( auto &x : users )
        cin >> x;

    int m;
    cin >> m;

    int state = 0;

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

        string t;
        cin >> t;

        if( find(users.begin(), users.end(), t) != users.end() ){

            state ^= 1;

            if(state)
                cout << "Opened by ";
            else
                cout << "Closed by ";

            cout << t << endl;

        } else {
            cout << "Unknown " << t << endl;
        }

    }

    return 0;

}


Measured memory_bytes: 3244
#include<bits/stdc++.h>
#include<vector>
#include<math.h>
#include<float.h>
#include<string>

#define llong long long;
using namespace std;

int main(){
  int a, b; cin >> a >> b;
  string s; cin >> s;
  string ans = "Yes";
  for(int i = 0; i < s.size(); i++){
    if(i == a){
      if(s[i] != '-'){
        cout << "No" << endl;
        return 0;
      }
    }else {
      if(s[i] == '-'){
        cout << "No" << endl;
        return 0;
      }
    }
  }
  cout << "Yes" << endl;
}


Measured memory_bytes: 256
char*p,E[200];M(){int r;r=T();for(;;){if(*p=='*'){p++;r*=T();}else if(*p=='/'){p++;r/=T();}else return r;}}A(){int r;r=M();for(;;){if(*p=='+'){p++;r+=M();}else if(*p=='-'){p++;r-=M();}else return r;}}T(){int r,l;if(*p=='('){p++;r=A();p++;}else{sscanf(p,"%d%n",&r,&l);p+=l;}return r;}main(){scanf("%*d\n");for(;~scanf("%[^=]=\n",E);){p=E;printf("%d\n",A());}}

Measured memory_bytes: 0
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i) 
#define PI acos(-1)
#define pcnt __builtin_popcountll
#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define sz(x) (int)(x).size()
#define v(T) vector<T>
#define vv(T) v(v(T))
#define fi first
#define se second

using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using LP = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;

template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) {if (a > b) { a = b; return true; } return false; }

ll INF = 1001001001;
ll LINF = 1001001001001001001ll;

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

    ll n, a, b;
    cin>>n>>a>>b;
    vl vs(n);
    cin>>vs;

    vector<vector<LP>> dp(n + 1, vector<LP>(n + 1));
    dp[0][0].se = 1;
    rep(i, n) rep(j, n) rep(k, j + 1) {
        ll temp = dp[i + 1][j + 1].fi - (dp[i][k].fi + vs[j]);
        if (temp > 0) continue;
        if (temp == 0) dp[i + 1][j + 1].se += dp[i][k].se;
        else dp[i + 1][j + 1] = LP(dp[i][k].fi + vs[j], dp[i][k].se);
    }

    priority_queue<pair<double, ll>> q;
    for (int i = a; i <= b; ++i) rep(j, n) {
        q.emplace((ld)dp[i][j + 1].fi / i, dp[i][j + 1].se);
    }
    double m = q.top().fi;
    ll cnt = 0;
    while (!q.empty() && q.top().fi == m) {
        cnt += q.top().se;
        q.pop();
    }
    printf("%.10f\n%ld\n", m, cnt);
}

Measured memory_bytes: 384
#include<iostream>
#include<iomanip>
using namespace std;
#include<vector>
#include<queue>
#include<limits>
template<typename T>
vector<int>dijkstra(int s,const vector<vector<pair<int,T> > >&G,T INF=numeric_limits<T>::max())
{
	int n=G.size();
	vector<T>d(n,INF);
	vector<int>parent(n,-1);
	priority_queue<pair<T,int>,vector<pair<T,int> >,greater<pair<T,int> > >P;
	d[s]=0;
	P.push(make_pair(d[s],s));
	while(!P.empty())
	{
		pair<T,int>p=P.top();P.pop();
		int v=p.second;
		if(d[v]<p.first)continue;
		for(const pair<int,T>&e:G[v])
		{
			int u=e.first;
			T cost=d[v]+e.second;
			if(d[u]>cost)
			{
				d[u]=cost;
				parent[u]=v;
				P.push(make_pair(d[u],u));
			}
		}
	}
	return parent;
}
#include<cmath>
#include<algorithm>
int x[100],y[100];
main()
{
	int N;
	while(cin>>N,N)
	{
		vector<vector<pair<int,double> > >G(N);
		for(int i=0;i<N;i++)
		{
			int b;cin>>b;b--;
			cin>>x[b]>>y[b];
		}
		for(int i=0;i<N;i++)for(int j=0;j<N;j++)
		{
			if(i==j)continue;
			double dis=hypot(x[i]-x[j],y[i]-y[j]);
			if(dis<=50)G[i].push_back(make_pair(j,dis));
		}
		int m;cin>>m;
		for(;m--;)
		{
			int s,g;cin>>s>>g;
			s--,g--;
			vector<int>p=dijkstra(s,G);
			if(p[g]==-1)cout<<"NA"<<endl;
			else
			{
				vector<int>ok;
				ok.push_back(g);
				while(ok.back()!=s)
				{
					ok.push_back(p[ok.back()]);
				}
				reverse(ok.begin(),ok.end());
				for(int i=0;i<ok.size();i++)
				{
					cout<<ok[i]+1<<(i+1==ok.size()?"\n":" ");
				}
			}
		}
	}
}



Measured memory_bytes: 3116
#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <bitset>
#include <fstream>
using namespace std;

#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
typedef long long ll;

#define INF 1000000000

// m??\????????°????????¨d?????\????????£???n?????????????????°
int dfs(int n, int m, int d){
    if(n==0) return 1;
    if(d==0) return 0;
    if(n<m*m) return 0;

    int res=0;
    if(n>=m*m) res += dfs(n-m*m, m, d-1);
    res += dfs(n, m+1, d);
    return res;
}

int main(){
    int n;
    while(cin>>n ,n){
        cout<<dfs(n,1,4)<<endl;
    }

    return 0;
}

Measured memory_bytes: 1160
#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#define ll long long int
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
int mx4[] = {0,1,0,-1};
int my4[] = {1,0,-1,0};


//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


int main(){
    string s; cin >> s;
    rep(i,3){
        if(s[i] =='7'){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}
    

Measured memory_bytes: 3624
#include <iostream>
#include <string>
#include <vector>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <stack>
#include <map>
#include <set>
#include <ios>
#include <cctype>
#include <cstdio>
#include <functional>
#include <cassert>

using namespace std;
using ll = long long;

#define REP(i,a) for(int i = 0;i < (a);++i)
#define FOR(i,a,b) for(int i = (a);i < (b); ++i)
#define FORR(i,a,b) for(int i = (a) - 1;i >=(b);--i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SIZE(obj) (int)(obj).sizeT()
#define YESNO(cond,yes,no){cout <<((cond)?(yes):(no))<<endl; }
#define SORT(list) sort(ALL((list)));
#define RSORT(list) sort((list).rbegin(),(list).rend())
#define ASSERT(cond,mes) assert(cond && mes)

constexpr int MOD = 1'000'000'007;
constexpr int INF = 1'050'000'000;

template<typename T>
T round_up(const T& a, const T& b) {
    return (a + (b - 1)) / b;
}

template <typename T1, typename T2>
istream& operator>>(istream& is, pair<T1, T2>& p) {
    is >> p.first >> p.second;
    return is;
}

template <typename T1, typename T2>
ostream& operator<<(ostream& os, pair<T1, T2>& p) {
    os << p.first << p.second;
    return os;
}

template <typename T>
istream& operator>>(istream& is, vector<T>& v) {
    REP(i, (int)v.size())is >> v[i];
    return is;
}

template <typename T>
ostream& operator<<(ostream& os, vector<T>& v) {
    REP(i, (int)v.size())os << v[i] << endl;
    return os;
}

template <typename T>
T clamp(T& n, T a, T b) {
    if (n < a)n = a;
    if (n > b)n = b;
    return n;
}

template <typename T>
static T GCD(T u, T v) {
    T r;
    while (v != 0) {
        r = u % v;
        u = v;
        v = r;
    }
    return u;
}

template <typename T>
static T LCM(T u, T v) {
    return u / GCD(u, v) * v;
}

std::vector<int> enum_div(int n) {
    std::vector<int> ret;
    for (int i = 1; i*i <= n; ++i) {
        if (n%i == 0) {
            ret.push_back(i);
            if (i != 1 && i*i != n) {
                ret.push_back(n / i);
            }
        }
    }
    return ret;
}

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

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

struct ToUpper {
    char operator()(char c) { return toupper(c); }
};

struct ToLower {
    char operator()(char c) { return tolower(c); }
};

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


    ll N, A, B;
    cin >> N >> A >> B;


    auto solve = [&]() {
        if (A == B)return 1LL;
        if (B < A)return 0LL;
        if (N == 1 && A != B)return 0LL;
        ll min = A * (N - 1) + B;
        ll max = A + (N - 1)*B;

        return max - min + 1;
    };

    cout << solve() << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vb = vector<bool>;
using vl = vector<long>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvb = vector<vector<bool>>;
using vvc = vector<vector<char>>;
using pii = pair<int, int>;
using pil = pair<int, long>;
using pll = pair<long, long>;
#define fix20 cout << fixed << setprecision(20)
#define YES cout << "Yes" << endl
#define NO cout << "No" << endl
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,s,t) for(int i=s; i<t; i++)
#define RNG(i,s,t,u) for(int i=s; i<t; i+=u)
#define MOD 1000000007
#define all(vec) vec.begin(), vec.end()

int main(){
  int n;
  cin >> n;
  vector<long> a(n);
  rep(i,n) cin >> a.at(i);
  vector<long> point(n,0);
  rep(i,n){
    int now = a.at(i) - 1;
    if(i - now < 0) continue;
    point.at(i-now)++;
  }
  long ans = 0;
  rep(i,n){
    int now = i + a.at(i) + 1;
    if(now >= n) continue;
    ans += point.at(now);
  }
  cout << ans << endl;
}

Measured memory_bytes: 6412
#include<bits/stdc++.h>
#define rep(m, n) for (int m = 0; m < (n); ++m) 
#define PI acos(-1)
#define pcnt __builtin_popcountll
#define rng(a) a.begin(), a.end()
#define sz(x) (int)(x).size()
#define v(T) vector<T>
#define vv(T) v(v(T))
#define fi first
#define se second

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;

template<typename T>inline istream& operator>>(istream&m,v(T)&v)
{rep(j,sz(v))m>>v[j];return m;}
template<typename T1,typename T2>inline istream& operator>>(istream&m,pair<T1,T2>&v)
{return m>>v.fi>>v.se;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) {if (a > b) { a = b; return true; } return false; }

ll INF = 1001001001;
ll LINF = 1001001001001001001ll;

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

    ll n, l;
    cin>>n>>l;
    vl as(n);
    cin>>as;

    ll ans = -1;
    rep(i, n - 1) {
        if (as[i] + as[i + 1] >= l) {
            ans = i + 1;
            break;
        }
    }
    if (ans == -1) {
        cout<<"Impossible"<<endl;
        return 0;
    }
    cout<<"Possible"<<endl;
    int m = 1;
    while (m < ans) {
        cout<<m<<endl;
        m++;
    }
    m = n - 1;
    while (ans <= m) {
        cout<<m<<endl;
        m--;
    }
}

Measured memory_bytes: 1664
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define per1(i,n) for(int i=n;i>0;i--)
#define all(v) v.begin(), v.end()
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<ll> vec;
typedef vector<vec> mat;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int L,R,d;
    cin>>L>>R>>d;
    cout<<R/d-(L-1)/d;
}

Measured memory_bytes: 3556
x, y = map(int, input().split())
group_1 = (1,3,5,7,8,10,12)
group_2 = (4,6,9,11)
group_3 = (2,)
if x in group_1 and y in group_1:
    print('Yes')
elif x in group_2 and y in group_2:
    print('Yes')
elif x in group_3 and y in group_3:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define f(i,x,n) for(int i=x;i<(int)(n);++i)
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=1005,INF=1<<29;
int dis[MAX][MAX];

void floyd(int si){
    for(int k=0;k<si;k++){
        for(int i=0;i<si;i++){
            for(int j=0;j<si;j++){
                dis[i][j]=min(dis[i][j],dis[i][k]+dis[k][j]);
            }
        }
    }
}

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int H,W;cin>>H>>W;
    
    vector<string> S(H);
    
    for(int i=0;i<H;i++) cin>>S[i];
    
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            for(int a=0;a<H*W;a++){
                dis[i*W+j][a]=INF;
            }
            dis[i*W+j][i*W+j]=0;
        }
    }
    
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            for(int a=0;a<H;a++){
                for(int b=0;b<W;b++){
                    if((i==a&&abs(j-b)==1)||(abs(i-a)==1&&j==b)){
                        if(S[i][j]=='.'&&S[a][b]=='.'){
                            dis[i*W+j][a*W+b]=1;
                        }
                    }
                }
            }
        }
    }
    
    floyd(H*W);
    
    int ans=0;
    
    for(int i=0;i<H*W;i++){
        for(int j=0;j<H*W;j++){
            if(dis[i][j]!=INF) ans=max(ans,dis[i][j]);
        }
    }
    
    cout<<ans<<endl;
}



Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>

using namespace std;

vector<vector<int>> g;
vector<int> num, low, was, p;
int cnt = 1, rc = 0;

void dfs(int u, int par) {
  num[u] = low[u] = cnt++;
  was[u] = true;
  for (auto& v : g[u]) {
    if (!was[v]) {
      p[v] = u;
      dfs(v, u);
      low[u] = min(low[u], low[v]);
    } if (v != par) {
      low[u] = min(low[u], num[v]);
    }
  }
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  g = vector<vector<int>>(n);
  num = vector<int>(n);
  low = vector<int>(n);
  was = vector<int>(n, false);
  p = vector<int>(n);
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  dfs(0, -1); 
  set<int> st;
  int rc = 0;
  for (int i = 1; i < n; i++) {
    if (p[i] == 0) {
      rc++;
    } else if (num[p[i]] <= low[i]) {
      st.insert(p[i]);
    }
  }
  if (rc > 1) {
    st.insert(0);
  }
  for (auto& x : st) {
    cout << x << '\n';
  }
  return 0;
}



Measured memory_bytes: 4440
import math

A, B, H, M = map(int, input().split())


dH = 360 / 720 # per minutes
dM = 360 / 60 # per minutes

delta = 60 * H + M # elapsed minutes

theta = delta * dH - M * dM

if theta < 0:
    theta = M * dM - delta * dH
if 180 < theta:
    theta = 360 - theta

C = math.sqrt(A**2 + B**2 - 2*A*B*math.cos(math.radians(theta)))

print(C)


Measured memory_bytes: 9524
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

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

//struct edge {int from, to, cost;};

constexpr double EPS = 1e-10;
//constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;
constexpr int MOD = 1'000'000'007;
//inline void modAdd(LL &l, LL &r) {l = (l + r) % MOD;}

template<class T> inline T sqr(T x) {return x*x;}

void solve() {
    int n;
    cin >> n;
    VLL d(n);
    REP(i,0,n) cin >> d[i];
    sort(all(d));
    cout << d[n/2] - d[n/2-1] << endl;
}

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

Measured memory_bytes: 1024
using namespace std;
#include<bits/stdc++.h>
#define BEGIN ios_base::sync_with_stdio(0);cin.tie(0);
#define END return EXIT_SUCCESS;
#define FOR(I,A,B) for((I)=(A);(I)<(B);(I)++)
#define REP(I,N) FOR((I),0,(N))
#define UP(I,A,B) for((I)=(A);(I)<=(B);(I)++)
#define DW(I,A,B) for((I)=(A);(I)>=(B);(I)--)
#define IN(P) cin>>(P)
#define IN2(P1,P2) cin>>(P1)>>(P2)
#define IN3(P1,P2,P3) cin>>(P1)>>(P2)>>(P3)
#define INS(I,N,V) REP((I),(N)) cin>>(V[I])
#define INS2(I,N,V1,V2) REP((I),(N)) cin>>(V1[I])>>(V2[I]);
#define INS3(I,N,V1,V2,V3) REP((I),(N)) cin>>(V1[I])>>(V2[I])>>(V3[I]);
#define OUT(P) cout<<(P)<<endl
#define OUT2(P1,P2) cout<<(P1)<<" "<<(P2)<<endl
#define OUT3(P1,P2,P3) cout<<(P1)<<" "<<(P2)<<" "<<(P3)<<endl
#define OUTS(I,N,V) REP((I),(N)) cout<<(V[i])<<endl
#define ALL(C) (C).begin(),(C).end()
#define RALL(C) (C).rbegin(),(C).rend()
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}

int N,i,ans;
deque<int> d(200);
inline void solve(){
  IN(N);
  REP(i,N)IN(d[i]);
  while(true){
    REP(i,N){
      if(d[i]&1){
        break;
      }
    }
    if(i==N){
      ans++;
      REP(i,N)d[i]=d[i]/2;
    }else{
      OUT(ans);
      return;
    }
  }
}

int main(int argc,char**argv){
  BEGIN
  solve();
  END
}


Measured memory_bytes: 256
from sys import stdin
import bisect

n = int(stdin.readline().rstrip())
li = list(map(int,stdin.readline().rstrip().split()))

li.sort()

ma = 0

if len(li) == 1:
    print(1)
elif len(li) == 2:
    if abs(li[0] - li[1]) <= 1:
        print(2)
    else:
        print(1)
else:
    for i in range(1,n-1):
        ma = max(ma,bisect.bisect(li,i+1)-bisect.bisect_left(li,i-1))

    print(ma)

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

int main(){
    int n,l,ans=0;
    cin >> n >> l ;
    
    for(int i=l;i<l+n;i++){
        ans+=i;
    }
    if(l<0&&n<=(-l)){
        ans-=l+n-1;
    }
    if(l>0){
        ans-=l;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
<?php

// init
$alphabets = array_flip(range('a', 'z'));
foreach ($alphabets as $key => $value) {
    $alphabets[$key] = 0;
}
$array_character = array();

// input
while ($strings = rtrim(fgets(STDIN))) {
    // count
    $array_character = str_split(strtolower($strings));
    foreach ($array_character as $character) {
        if (array_key_exists($character, $alphabets)) $alphabets[$character]++;
    }
}

// output
foreach ($alphabets as $key => $value) {
    printf("%s : %d\n", $key, $value);
}


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

int main() {
	string s;
	cin >> s;
	int n = s.size(), ans = 0;
	for (int i = 0;i < n;i++) {
		if (s[i] == 'A') {
			ans = i;
			break;
		}
	}
	for (int j = n;j > 0;j--) {
		if (s[j] == 'Z') {
			ans = j - ans;
			break;
		}
	}
	cout << ans+1 << endl;
}

Measured memory_bytes: 640
import java.util.Scanner;

public class Main {
public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	String input = sc.nextLine();
	sc.close();
	int count = 0;
	for(int i = 0; i < input.length(); i++) {
		if(input.charAt(i) == 'o') {
			count++;
		}
	}
	System.out.print(700 + (100 * count));
}
}

Measured memory_bytes: 21844
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <cstdio>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
using namespace std;

#define db(x) cerr << #x << " = " << x << endl;

typedef long long   ll;
typedef long double ld;
typedef pair < int, int > pii;
typedef pair < ll,  ll  > pll;

const ll   MOD       = 1000000007;
const ll   INF       = 1000000007ll*1000000007ll;
const ll   N         = 1000002;
const ll   logN      = 20;
const ld   PI        = acos(-1);
const ll   HashPrime = 31;

inline void No() {
    cout << "NO\n";
}
inline void Yes() {
    cout << "YES\n";
}

#define fi first
#define se second

int n, a, b;

void solve() {
  cin >> n >> a >> b;
  if ((a-b+n*2)&1) {
    cout << "Borys\n";
  }
  else {
    cout << "Alice\n";
  }
}

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


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

using namespace std;

int main(int argc, char *argv[]) {
	string S;
	cin >> S;

	int answer = 700;
	for (int i = 0; i < S.size(); i++) {
		if (S[i] == 'o') {
			answer += 100;
		}
	}

	cout << answer << endl;
	return 0;
}


Measured memory_bytes: 256
n=int(input())
s_dict={2:0,3:0,5:0,7:0,11:0,13:0,17:0,19:0,23:0,29:0,31:0,37:0,41:0,43:0,47:0,53:0,59:0,61:0,67:0,71:0,73:0,79:0,83:0,89:0,97:0}
for i in range(1,n+1):
    for j in s_dict:
        while i%j==0:
            s_dict[j]=s_dict[j]+1
            i=i//j
count3=0
count5=0
count15=0
count25=0
count75=0
for i in s_dict.values():
    if i>=2:
        count3=count3+1
    if i>=4:
        count5=count5+1
    if i>=14:
        count15=count15+1
    if i>=24:
        count25=count25+1
    if i>=74:
        count75=count75+1
a=count75
b=count25*(count3-count25)+count25*(count25-1)
c=count15*(count5-count15)+count15*(count15-1)
d=(count5*(count5-1)//2)*(count3-count5)+count5*(count5-1)*(count5-2)//2
print(a+b+c+d)



    


Measured memory_bytes: 38512
import math


def combination(n, r):
    return math.factorial(n) // (math.factorial(n-r) * math.factorial(r))


def is_prime(num):
    if (num < 2):
        return False
    elif(num == 2):
        return True
    elif (num % 2 == 0):
        return False
    sqrt_num = int(math.sqrt(num))
    for i in range(3, sqrt_num+1):
        if i % 2 == 0:
            continue
        if (num % i == 0):
            return False
    return True


N = int(input())
ans = N

m = {}
for i in range(2, N+1):
    for _i in range(2, i+1):
        if i % _i == 0:
            m.setdefault(i, 0)
            if not(is_prime(_i)):
                continue
            a = i
            b = _i
            while(True):
                m[_i] += 1
                n = a//b
                if n % _i != 0:
                    break
                a = n

ans = 1
for v in m.values():
    ans *= (v+1)
print(ans % 1000000007)


Measured memory_bytes: 3188
K=int(input())
u12 = [i for i in range(1,10)]
ans = 0
for i in range(K):
    if ans <=11:
        ans += 1
        continue
    flg = True
    l = len(str(ans))
    for j in range(l-1,-1,-1):
        if 0<j<l-1:
            x,y,z = map(int,str(ans)[j-1:j+2])
            if y!=9 and abs(x-(y+1))<=1 and abs((y+1)-z)<=1:
                ans = int(str(ans)[:j]+''.join([str(max(0,y+1-i)) for i in range(l-j)]))
                flg = False
                break
        elif j==0:
            x,y = map(int,str(ans)[:2])
            if x != 9 and abs(x+1-y) <=1:
                ans = int(''.join([str(max(0,x+1-i))for i in range(l)]))
                flg = False
                break
        else:
            x,y = map(int,str(ans)[-2:])
            if y != 9 and abs(x-(y+1))<=1:
                ans += 1
                flg = False
                break
    if flg:
        ans = 10**l
print(ans)

Measured memory_bytes: 52056
#include <iostream>

using namespace std;


int gcd(int a, int b)
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}

int gcd(int a,int b,int c){
    return gcd(a,gcd(b,c));
}

int main(){
    int K;
    cin>>K;
    long long sum=0;
    
    for(int a=1;a<=K;++a){
        for(int b=1;b<=K;++b){
            for(int c=1;c<=K;++c){
                sum+=gcd(a,b,c);
            }
        }
    }

    cout<<sum<<endl;

}


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

bool valid(string s){
    int n = s.size();
    for(int i = 0; i<n/2; i++) if(s[i]!=s[n-i-1]) return false;
    return true;
}

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

    //good luck kittu!
    string s; cin>>s;
    int n = s.size();
    string s1 = s.substr(0, (n-1)/2);
    string s2 = s.substr((n+1)/2);
    if(valid(s1) && valid(s2) && valid(s)) cout<<"Yes\n";
    else cout<<"No\n";
    return 0;
}

Measured memory_bytes: 256
import sys,collections,math;sys.setrecursionlimit(10**7)
def Is(): return [int(x) for x in sys.stdin.readline().split()]
def Ss(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

H,W = Is()
mat = ["."*(W+2)]
for i in range(H):
    mat.append("." + S() + ".")
mat.append("."*(W+2))
for h in range(1,H+1):
    for w in range(1,W+1):
        t = mat[h][w]
        if t == "#" and  (mat[h-1][w]+mat[h+1][w]+mat[h][w-1]+mat[h][w+1]).count("#") == 0 :
            print("No")
            exit()
print("Yes")

Measured memory_bytes: 3564
#include <stdio.h>

int main()
{
  char s[101];
  scanf("%s",&s);
  int i;
  i = 0;
  while (s[i])
  {
    if (i % 2 == 0)
    {
      if (s[i] == 'L')
      {
        printf("No");
        return (0);
      }
    }
    else
    {
      if (s[i] == 'R')
      {
        printf("No");
        return (0);
      }
    }
    i++;
  }
  printf("Yes");
}

Measured memory_bytes: 128
#演習2-22
def solve(w,h,tile):
    # スタート地点探索
    ok = False
    for y in range(h):
        for x in range(w):
            if tile[y][x] == "@":
                s_x = x
                s_y = y
                ok = True
                break
        if ok:
            break
    # 幅優先探索
    count = 0
    check = [[s_x, s_y]]
    check_map = [[False for j in range(w)] for i in range(h)]
    while len(check) > 0:
        x, y = check.pop(0)
        if x in range(w) and y in range(h):
            if check_map[y][x] == False:
                if tile[y][x] == "." or tile[y][x] == "@":
                    check_map[y][x] = True
                    count += 1
                    check.append([x, y-1])
                    check.append([x, y+1])
                    check.append([x+1, y])
                    check.append([x-1, y])
    return count

while True:
    try:
        w, h = map(int, input().split())
        if w == 0:
            break
        tile = [""] * h
        for i in range(h):
            tile[i] = input()

        print(solve(w,h,tile))
    except:
        break
    




Measured memory_bytes: 5628