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

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int k = Integer.parseInt(sc.next());
        int[] ary = new int[n];
        for (int i = 0; i < n; i++) {
            ary[i] = Integer.parseInt(sc.next());
        }
        int ans = 0;
        for (int a : ary) {
            if (a - k >= 0) {
                ans++;
            }
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 48508
# encoding: utf-8


def calc_area(startIndex, endIndex, terrain):
    level = terrain[startIndex]
    area = 0
    for i in xrange(startIndex, endIndex):
        area += (level - terrain[i]) + 0.5 * (terrain[i] - terrain[i + 1])
    return int(area)


def check_area(terrain):
    i = 0
    startIndex = 0
    endIndex = 0
    while i < len(terrain) - 1:
        if terrain[i + 1] - terrain[i] < 0:
            startIndex = i
            break
        i += 1
    for j in xrange(i + 1, len(terrain)):
        if terrain[i] == terrain[j]:
            endIndex = j
            return startIndex, endIndex
    else:
        return 0, 0


def main():
    string = list(raw_input())
    terrain = []
    height = 0
    for c in string:
        terrain.append(height)
        if c == "\\":
            height -= 1
        elif c == "/":
            height += 1
    terrain.append(height)

    waterAreaRight = []
    while True:
        i, j = check_area(terrain)
        if i == j:
            break
        waterAreaRight.append(calc_area(i, j, terrain))
        terrain = terrain[j:]

    terrain = terrain[::-1]
    waterAreaLeft = []
    while True:
        i, j = check_area(terrain)
        if i == j:
            break
        waterAreaLeft.append(calc_area(i, j, terrain))
        terrain = terrain[j:]
    waterAreaRight.extend(waterAreaLeft[::-1])

    print sum(waterAreaRight)
    print len(waterAreaRight),
    if len(waterAreaRight) > 0:
        print " ".join(map(str, waterAreaRight))

main()

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string a,b,c;
    cin >> a;
    cin >> b;
    cin >> c;

    if(a.back() == b.front() && b.back() == c.front()){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
}


Measured memory_bytes: 256
// Something on It

#include <iostream>
#include <algorithm>
#include <string>

using namespace std;

int main(){
	string S;
	cin >> S;

	int res = 700;

	for (int i = 0; i < S.length(); ++i)
		if (S[i] == 'o')
			res += 100;

	cout << res << endl;

	return 0;
}

Measured memory_bytes: 256
package main
import (
  "fmt"
)
func main() {
  var n int
  fmt.Scan(&n)
  hs := make([]int, n)
  for i := 0; i < n; i++ {
    fmt.Scan(&hs[i])
  }
  result := 0
  for {
    start := 0
    end := n-1
    shouldBreak := false
    for i, h := range hs {
      if h != 0 {
        start = i
        break
      }
      if i == n-1 {
        shouldBreak = true
      }
    }
    if shouldBreak {
      break
    }
    for i := start+1; i < n; i++ {
      if hs[i] == 0 {
        end = i-1
        break
      }
    }
    for i := start; i <= end; i++ {
      hs[i]--
    }
    result++
  }
  fmt.Println(result)
}


Measured memory_bytes: 512
#include <functional>
#include <algorithm>
#include <iostream>
#include <numeric>
#include <iomanip>
#include <utility>
#include <cstdlib>
#include <sstream>
#include <bitset>
#include <vector>
#include <cstdio>
#include <ctime>
#include <queue>
#include <deque>
#include <cmath>
#include <stack>
#include <list>
#include <map>
#include <set>

using namespace std;

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

#define dump(x)  cerr << #x << " = " << (x) << endl
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back

#define DIR second
#define P first


int main() {
    int n,m;
    while(cin>>n>>m){
        if(n==0 && m==0)break;
        vector<pii> data;
        data.clear();
        
        ll sum=0;
        
        rep(i,n){
            int b,a;
            cin>>b>>a;
            data.pb(pii(a,b));
            sum+=a*b;
        }
        
        sort(data.begin(),data.end(),greater<pii>());
        
        for(int i=0;i<n;i++){
            if(data[i].DIR<m){
                sum-=data[i].first*data[i].second;
                m-=data[i].DIR;
            }
            else{
                sum-=m*data[i].P;
                break;
            }
        }
        cout<<sum<<endl;

    }
    
    return 0;
}

Measured memory_bytes: 1324
#include<iostream>
using namespace std;
int main(){
    long long int dp[99][21];
    for(int i=0;i<99;i++)for(int j=0;j<21;j++)dp[i][j]=0;
    int P[100],N;
    cin>>N;
    for(int i=0;i<N;i++)cin>>P[i];
    dp[0][P[0]]=1;
    for(int i=1;i<N-1;i++){
        for(int j=0;j<=20;j++){
            if(j+P[i]<=20)dp[i][j+P[i]]+=dp[i-1][j];
            if(j-P[i]>=0)dp[i][j-P[i]]+=dp[i-1][j];
        }
    }
    cout<<dp[N-2][P[N-1]]<<endl;

    return 0;
}

Measured memory_bytes: 1168
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] arr = new int[n];
		for (int i = 0; i < n; i++) {
		    arr[i] = sc.nextInt();
		}
		long total = 0;
		for (int i = 0; i < n - 1; i++) {
		    for (int j = i + 1; j < n; j++) {
		        total += arr[i] * arr[j];
		    }
		}
		System.out.println(total);
	}
}


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

int main() {
    string s; cin >> s;
    set<char> abcz;
    for (char c : s) {
        if (abcz.count(c)) {
            cout << "no" << endl;
            return 0;
        } else {
            abcz.insert(c);
        }
    }
    cout << "yes" << endl;
}


Measured memory_bytes: 256
object Main extends App {

  def solve(sa: String, sb: String, sc: String): String = {
    def f(turn: Char, a: List[Char], b: List[Char], c: List[Char]): (Char, List[Char], List[Char], List[Char]) = {
      if (turn == 'a' && a.isEmpty) ('a', List(), List(), List())
      else if (turn == 'b' && b.isEmpty) ('b', List(), List(), List())
      else if (turn == 'c' && c.isEmpty) ('c', List(), List(), List())
      else {
        if (turn == 'a') f(a.head, a.tail, b, c)
        else if (turn == 'b') f(b.head, a, b.tail, c)
        else f(c.head, a, b, c.tail)
      }
    }
    val (whoWon, _, _, _) = f('a', sa.toCharArray.toList, sb.toCharArray.toList, sc.toCharArray.toList)
    whoWon.toString.toUpperCase
  }

  val scanner = new java.util.Scanner(Console.in)
  val sa = scanner.next()
  val sb = scanner.next()
  val sc = scanner.next()
  val ans = solve(sa, sb, sc)
  println(ans)
}

Measured memory_bytes: 25672
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
typedef long long ll;
const int N=3e5;
const ll p=1e9+7;
ll fac[N+10],ifac[N+10];

ll fpm(ll a,ll b)
{
	ll ret=1;
	for(;b;b>>=1) ret=(b&1)?ret*a%p:ret,a=a*a%p;
	return ret;
}

void init(void)
{
	fac[0]=1;
	for(int i=1;i<=N;++i) fac[i]=fac[i-1]*i%p;
	ifac[N]=fpm(fac[N],p-2);
	for(int i=N;i>=1;--i) ifac[i-1]=ifac[i]*i%p;
}

ll C(ll n,ll m){return fac[n]*ifac[m]%p*ifac[n-m]%p;}

ll f(ll h,ll w){return C(h-1+w-1,h-1);}

void add(ll &a,ll b){a=a+b>=p?a+b-p:a+b;}

int main()
{
	init();
	int h,w,a,b;scanf("%d %d %d %d",&h,&w,&a,&b);
	ll ans=0;
	for(int i=1;i<=h-a;++i) 
		add(ans,f(i,b)*f(h+1-i,w-b)%p);
	printf("%lld\n",ans);
	return 0;
}


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

using namespace std;

int main(){
    unsigned long long N, A, B, X, L1, LN, out;
    cin >> N >> A >> B;
    X = A - B;
    if(A<=B){
        X = B - A;
        L1 = A - 1;
        LN = N - B;
    }else{
        X = A - B;
        L1 = B - 1;
        LN = N - A;
    }
    if(X % 2 == 0){
        out = X / 2;
    }else{
        if(L1 <= LN){
            out = L1 + 1 + (X-1)/2;
        }else{
            out = LN + 1 + (X-1)/2;
        }
    }
    cout << out << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
using namespace std;
int main() {
    int s; cin >> s;
    vector<int> a(10e5, 0);
    a[0] = s;
    int ans = 0;
    if (s == 4 || s == 2 || s == 1) {
        printf("%d\n", 4);
        return 0;
    }
    for (int i = 1; i < 100000; ++i) {
        if (a[i - 1] % 2 == 0) a[i] = a[i - 1] / 2;
        else a[i] = a[i - 1] * 3 + 1;
        if (a[i] == 4) {
            ans = i + 1; break;
        }
        if (a[i] == 2) {
            ans = i; break;
        }
        if (a[i] == 1) {
            ans = i - 1; break;
        }
    }
    printf("%d\n", ans + 3);
    return 0;
}


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

bool isPalindrome(string x)
{
    for(int i=0; i<ceil(x.length()/2); i++)
    {
        if(x[i] != x[x.length()-i-1])
            return false;
    }    
    return true;
}

int main()
{
    string in;
    cin >> in;
    // cout << in.substr((in.length()+3)/2-1, in.length()) << endl;
    string f, t;
    f = in.substr(0, (in.length()-1)/2);
    t = in.substr((in.length()+3)/2-1, in.length());
    if (f.compare(t)==0)
        cout <<
            ((isPalindrome(f) && isPalindrome(t))? "Yes":"No") << endl;
    else
        cout << "No" << endl;

}

Measured memory_bytes: 256
#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
input:
5
0 3 2 3 3 1 1 2
1 2 0 2 3 4
2 3 0 3 3 1 4 1
3 4 2 1 0 1 1 4 4 3
4 2 2 1 3 3

output:
0 0
1 2
2 2
3 1
4 3
"""

import sys
import heapq as hp

WHITE, GRAY, BLACK = 0, 1, 2
D_MAX = int(5e10 + 1)


def generate_adj_matrix():
    for each in init_vertices_table:
        v_index, v_adj_length, *v_adj_list = map(int, each)
        # assert len(v_adj_list) == v_adj_length * 2
        for pair in zip(v_adj_list[::2], v_adj_list[1::2]):
            init_adj_matrix[v_index][pair[0]] = pair[1]

    return init_adj_matrix


def dijkstra_path():
    # path search init
    path_list[init_vertex_index] = 0
    path_heap = []
    # heapq: rank by tuple[0], here ranked by d[u]
    hp.heappush(path_heap, (0, init_vertex_index))
    while len(path_heap) >= 1:
        current_vertex_index = hp.heappop(path_heap)[1]

        color[current_vertex_index] = BLACK

        current_vertex_index_info = adj_table[current_vertex_index]
        for adj_vertex_index in current_vertex_index_info.keys():
            current_adj_weight = current_vertex_index_info.get(adj_vertex_index)
            if color[adj_vertex_index] is not BLACK:
                # alt: d[u] + w[u,v]
                alt_path = path_list[current_vertex_index] + current_adj_weight
                if alt_path < path_list[adj_vertex_index]:
                    # update path_list
                    path_list[adj_vertex_index] = alt_path
                    # update heap
                    hp.heappush(path_heap, (alt_path, adj_vertex_index))
                    parent_list[adj_vertex_index] = current_vertex_index
                    color[adj_vertex_index] = GRAY

    return path_list


if __name__ == '__main__':
    _input = sys.stdin.readlines()
    vertices_num = int(_input[0])
    init_vertices_table = map(lambda x: x.split(), _input[1:])
    # assert len(init_vertices_table) == vertices_num

    parent_list, path_list = [-1] * vertices_num, [D_MAX] * vertices_num
    color = [WHITE] * vertices_num
    init_adj_matrix = tuple(dict() for _ in range(vertices_num))
    init_vertex_index = 0

    adj_table = generate_adj_matrix()
    ans = dijkstra_path()
    for i, v in enumerate(ans):
        print(i, v)

Measured memory_bytes: 62836
// SeeAlso: https://atcoder.jp/contests/abc119/tasks/abc119_a

#include <bits/stdc++.h>

using namespace std;

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

#define MAX 100000

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

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

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

// 最大公約数
inline constexpr ll gcd(ll a,ll b){if(!a||!b)return 0;while(b){ll c=b;b=a%b;a=c;}return a;}
// 最小公倍数
inline constexpr ll lcm(ll a,ll b){if(!a||!b)return 0;return a*b/gcd(a,b);}

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
template<class T> void print(const T& x){cout << setprecision(12) << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }

int main() {
    int year, month, day;
    char c1, c2;
    cin >> year >> c1 >> month >> c2 >> day;

    if (year < 2019 || (year==2019 && month<5)) {
        print("Heisei");
    } else {
        print("TBD");
    }
    return 0;
}


Measured memory_bytes: 256
def c_kth_substring(S, K):
    tmp = []
    for i in range(len(S)):
        for j in range(i + 1, i + K + 1):
            if j <= len(S):
                tmp.append(S[i:j])
    tmp = sorted(set(tmp))
    ans = tmp[K - 1]
    return ans
 
S = input().strip()
K = int(input())
print(c_kth_substring(S, K))

Measured memory_bytes: 5068
class Array
  def cumsum; s = 0; map{|k| s += k } end
end

class String
  
  # t : 初項に0を置くならt=1
  def fd(x,t=0);
    res = Array.new(size+t,0);
    each_char.with_index{|c,i| res[i+t] += 1 if c == x }
    res
  end
  
  def cfd(x,t=0); fd(x).cumsum end
end

n = gets.to_i
s = gets.chomp

w2e = s.cfd('W')
e2w = s.reverse.cfd('E').reverse

ans = [w2e[-2], e2w[1]].min

(1..(n-2)).each do |i|
  t = w2e[i-1] + e2w[i+1]
  ans = t if ans > t
end

puts ans

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

#define pb push_back
#define all(v) v.begin(), v.end()
#define sz(v) int(v.size())
#define pii pair<int, int>
#define mp make_pair
#define f first
#define ll long long
#define ld long double
#define s second
#define vec vector<int>

using namespace std;

const int N = (int) 1e5 + 10;
const int M = (int) 1e6 + 10;
const int K = (int) 500 + 10;
const int INF = (int) 1e9 + 7;
const int mod = (int) 1e9 + 7;
const ld EPS = (ld) 1e-9;
const ll LINF = (ll) 1e18;

int n;
int f[M], inv[M];

void add(int &x, int y) {
	x += y;
	if (x >= mod)
		x -= mod;
	if (x < 0)
		x += mod;
}

int mult(int x, int y) {
	return x * 1ll * y % mod;
}

int sum(int x, int y) {
	add(x, y);
	return x;
}

int bp(int x, int y) {
	int ans = 1;
	while (y) {
		if (y % 2) 
			ans = mult(ans, x);
		x = mult(x, x);
		y /= 2;
	}
	return ans;
}

int cnk(int n, int k) {
	return (k < 0 || k > n ? 0 : mult(f[n], mult(inv[n - k], inv[k])));
}

int calc(int k) {
	// k = length of A
	// sum of A[i] = n - 2, 1 <= A[i] <= 2
	int sum = n - 2 - k;
	return mult(cnk(k, sum), mult(f[n - 2 - k], f[k + 1]));
}

int main() {
	#ifdef sony
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif
	srand(time(0));
	cin >> n;
	for (int i = 0; i < M; i++) {
		f[i] = i ? mult(f[i - 1], i) : 1;
		inv[i] = bp(f[i], mod - 2);
	}
	int ans = 0;
	for (int i = 0; i <= n - 2; i++) {
		int cnt = sum(calc(i), -calc(i - 1));
		add(ans, mult(cnt, i + 1));
	}
	cout << ans;
	return 0;
}

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

int main(){
  char c;
  cin >> c;
  
  if(c=='a' || c=='i' || c=='u' || c=='e' || c=='o'){
    cout <<"vowel"<<endl;
  }
  
  else{
    cout << "consonant"<< endl;
  }
  
  
}

Measured memory_bytes: 3408
//#include "pch.h" 
#include <iostream>
#include <string>
#include <string.h>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <stdio.h>
#include <vector>
#include <time.h>
#include <iomanip>
#include <thread>
#include <atomic>
#include <mutex>
#include <future>
#define double long double
#define int long long
#define low lower_bound
#define upp upper_bound
#define mod (int)(1e9 + 7)
#define inf (int)1e16
#define rep(i,n) for(int i=0;i<n;i++)
#define all(vec) vec.begin(),vec.end()
#define vsort(vec) sort(all(vec))
#define vrever(vec) reverse(all(vec));
#define vunsort(vec) vsort(vec); vrever(vec);
#define bisea binary_search
using namespace std;
signed main() {
	int a, b, c;
	cin >> a >> b >> c;
	if (a == b && b == c) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

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

using namespace std;

void selectionSort(vector<int> &a, int n) {
    int count = 0;
    for (int i = 0; i < n; i++) {
        int minIdx = i;
        for (int j = i; j < n; j++) {
            if (a[minIdx] > a[j]) minIdx = j;
        }
        if (minIdx != i) {
            swap(a[i], a[minIdx]);
            count++;
        }
    }

    for (int i = 0; i < n; i++) {
        if (i > 0) cout << " ";
        cout << a[i];
    }
    cout << endl << count << endl;
}


int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }

    selectionSort(a, n);

    return 0;
}


Measured memory_bytes: 3104
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class MainClass
{
	public const long Giri = 1000000007;
	
	public static void Main(string[] args)
	{
		var n = Console.ReadLine().ToInt();
		var p = Input().ToInt();
		int wa = 0;
		int min = 999999;
		for(int i = 0; i< n;i++)
		{
			if(p[i] <= min)
			{
				min = Math.Min(min, p[i]);
				wa++;
			}
		}
		Console.WriteLine(wa);
	}


	static long GCD(long a, long b)
	{
		var v = new[] { a, b };
		while (v[1] != 0) { v = new[] { v[1], v[0] % v[1] }; }
		return v[0];
	}
	public static string[] Input() { return Console.ReadLine().Split(' '); }
	public static int Clamp(int val, int max, int min = 0) { return Math.Min(max, Math.Max(min, val)); }
}

public static class Smarter
{
	public static int ToInt(this string str) { return int.Parse(str); }
	public static long ToLong(this string str) { return long.Parse(str); }
	public static int[] ToInt(this string[] str)
	{
		var r = new int[str.Length];
		for(int i = 0; i < str.Length; i++) r[i] = str[i].ToInt();
		return r;
	 }
}


Measured memory_bytes: 33116
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
template <class T>
using ordered_set = __gnu_pbds::tree<T, __gnu_pbds::null_type, less<T>, __gnu_pbds::rb_tree_tag, __gnu_pbds::tree_order_statistics_node_update>;
template <class T>
using ordered_multiset = __gnu_pbds::tree<T, __gnu_pbds::null_type, less_equal<T>, __gnu_pbds::rb_tree_tag, __gnu_pbds::tree_order_statistics_node_update>;

#define PI atan2(0, -1)
#define epsilon 1e-9
#define INF 5e18
#define MOD 1000000007

#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound

int N, M, s [2010], t [2010], dp [2010][2010];

int main(){
    //freopen("sort.in", "r", stdin); freopen("sort.out", "w", stdout);
    ios_base::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(10);
    cin >> N >> M;
    for(int i = 1; i <= N; i++) cin >> s[i];
    for(int j = 1; j <= M; j++) cin >> t[j];
    for(int i = 0; i <= N; i++) dp[i][0] = 1;
    for(int j = 0; j <= M; j++) dp[0][j] = 1;
    for(int i = 1; i <= N; i++)
        for(int j = 1; j <= M; j++){
            dp[i][j] = dp[i-1][j]+dp[i][j-1]; if(dp[i][j] >= MOD) dp[i][j] -= MOD;
            if(s[i] != t[j]){
                dp[i][j] -= dp[i-1][j-1];
                if(dp[i][j] < 0) dp[i][j] += MOD;
            }
        }
    cout << dp[N][M] << '\n';
    return 0;
}

/******************************
Kateba ii dake no hanashi darou
Success is only a victory away
- No Game No Life Opening
******************************/

Measured memory_bytes: 16000
#include <bits/stdc++.h>
/* Uncomment only if you are not using GNU compiler->
*/
#include <map>
#include <algorithm> 
#include <vector> 
#include <string.h> 
#include <math.h> 
#include <stdio.h> 
#include <stdlib.h> 
#include <chrono> 
#include <thread> 
#include <iomanip>
/**/ 
//define
#define rep(i,n)    for(int i=0;i<n;i++)
#define repu(i,k,n) for(int i=k;i<=n;i++)
#define repd(i,k,n) for(int i=k;i>=n;i--)
#define se second
#define fi first
#define pb push_back
#define mp make_pair
#define all(v)  v.begin(), v.end()

//typedef
typedef long long int ll;
typedef long double ld;
typedef std::pair<int, int> pii;
typedef std::vector<int> vi;
typedef std::vector< pii > vii;
typedef std::vector< ll > vll;
typedef std::vector< std::pair < pii, int > > vpp;
 
const long long MOD = 1000000007;
const long long inf = 1e18;
 
using namespace std;

int t=0;

ll modpow(ll x,ll n){
    ll res=1;
    while(n>0){
        if(n&1) res=res*x%MOD;
        x=x*x%MOD;
        n>>=1;
    }
    return res;
}

ll power(ll x, ll n)
{
    ll res=1;
    while(n>0){
        if(n&1) res=res*x;
        x=x*x;
        n>>=1;
    }
    return res;
}

void solve()
{
    int n=5;
    int ans=0;
    rep(i,n)
    {
        int x;
        cin>>x;
        if(x==0)
            ans=i+1;
    }
    cout<<ans<<endl;
}
 
int main() {
    #ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("ggg.txt", "w", stdout);
    #endif
    
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    int t = 1, tt=1;
    // cin>>t;
    while(tt<=t)
    {
        // cout<<"Case #"<<tt<<": ";
        solve();
        tt++;
    } 
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}

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

typedef complex<double> P;
typedef pair<P, double> C;
#define X real()
#define Y imag()
#define EPS (1e-10)

// ??? c1 ??¨??? c2 ???????????¢???
int intersectCC(C c1, C c2){
    P c1p = c1.first, c2p = c2.first;
    double c1r = c1.second, c2r = c2.second;
    long double d = abs(c1p - c2p), r1 = c1r, r2 = c2r;
    if(r1 + r2 < d)            return  0; // ??¢????????????
    if(abs(r1 + r2 - d) < EPS) return +1; // ?????\
    if(d + r1 < r2)            return -2; // c1 ??? c2 ??????
    if(d + r2 < r1)            return +2; // c2 ??? c1 ??????
    return +1; // 2?????????????????????
}

int main() {
    C a,b;
    int n; cin >> n;
    for(int i=0; i<n; i++) {
        cin >> a.first.X >> a.first.Y >> a.second;
        cin >> b.first.X >> b.first.Y >> b.second;

        cout << intersectCC(a,b) << endl;
    }
    return 0;
}

Measured memory_bytes: 1248
let n=Int(readLine()!)!
var arr=readLine()!.characters.split{$0==" "}.map{Int(String($0))!}
var r=1<<30
for i in 0..<n {
	var r0=0
	while (arr[i]%2)<1 {
		arr[i]/=2
		r0+=1
	}
	if r>r0 {r=r0}
}
print(r)

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

int main(){
    ll n,k;
    cin>>n>>k;
    vector<long double>c(n+1,1.0);
    long double ans=0;
    for(int i=1;i<=n;++i){
        ll s=i;
        while(s<k){
            s*=2;
            c[i]/=2.0;
        }
        ans+=c[i];
    }
    cout<<fixed<<setprecision(10);
    cout<<ans/n<<endl;
}

Measured memory_bytes: 1792
S = input()

ans = 0
tmp = 0
l = len(S) - 1
i = 0
while i < l:
  x = S[i]
  y = S[i:i+2]
  if x == 'A':
    tmp += 1
  elif y == 'BC':
    ans += tmp
    i += 1
  else:
    tmp = 0
  i += 1

print(ans)

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

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

  int N;
  cin >> N;

  vector<int> X(N), Y(N);
  for (int i = 0; i < N; ++i) cin >> X[i] >> Y[i];

  for (int i = 0; i < N; ++i) {
    if ((X[i] + Y[i] & 1) != (X[0] + Y[0] & 1)) {
      cout << -1 << endl;
      return 0;
    }
  }

  int special = 0;

  if (~X[0] + Y[0] & 1) {
    special = 1;
    for (int i = 0; i < N; ++i) ++X[i];
  }

  cout << 31 + special << endl;
  for (int i = 0; i < 31; ++i) cout << (1 << i) << " \n"[i + 1 == 31 + special];
  if (special) cout << 1 << endl;

  for (int i = 0; i < N; ++i) {
    int u = X[i] + Y[i];
    int v = X[i] - Y[i];
    vector<int> x(31); {
      for (int j = 0; j < 31; ++j) {
        int tu = (1LL << 31) - 1 + u >> 1;
        int tv = (1LL << 31) - 1 + v >> 1;
        x[j] += (tu >> j & 1) * 2 + (tv >> j & 1);
      }
    }
    string ans;
    for (int i = 0; i < 31; ++i) ans += "LDUR"[x[i]];
    if (special) ans += "L";
    cout << ans << endl;
  }

  return 0;
}


Measured memory_bytes: 256
import numpy as np

n = map(int, raw_input().split())

x = map(int, raw_input().split())
n = n[0]
ans = []

x = np.asarray(x)
double_x = 2 * x
x0 = 0
multiple = 1
for j in range(n):
    x0 += x[j] * multiple
    multiple *= -1
ans.append(x0)
for i in range(0, n-1):
    ans.append(double_x[i] - ans[i])

print ' '.join(map(str, ans))


Measured memory_bytes: 24960
import java.util.Scanner;
public class Main{
 int tate;
 int yoko;
 int seki=0;
 int syu=0;
  
  public void solve(){
    Scanner sc= new Scanner(System.in);
    tate= sc.nextInt();
    yoko= sc.nextInt();
    seki=tate*yoko;
    syu=tate*2+yoko*2;
    System.out.println(seki+" "+syu);
}


public static void main(String[] args){
    Main obj=new Main();
    obj.solve();
}
}

Measured memory_bytes: 17156
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using P = pair<int, int>;
#define PI acos(-1)
#define Mod (int)1000000007
#define INFTY (int)INT_MAX
#define Rep(i, n) for (int i = 0; i < (int)(n); i++)
#define BitRep(i, n) for (int i = 0; i < (int)(1 << n); i++)
#define All(vec) vec.begin(), vec.end()
#define Sum(vec) accumulate(vec.begin(), vec.end(), 0)
#define Sort(vec) sort(vec.begin(), vec.end())
#define Reverse(vec) reverse(vec.begin(), vec.end())
#define Count(vec, x) count(vec.begin(), vec.end(), x)
#define Next_permutation(vec) next_permutation(vec.begin(), vec.end())
#define Find(S, s) S.find(s) != string::npos

int main() {
	int N, q;
	cin >> N >> q;
	vector<stack<int>> S(N);
	Rep(i, q) {
		int n;
		cin >> n;
		if (n == 0) {
			int t, x;
			cin >> t >> x;
			S[t].push(x);
		}
		else if (n == 1) {
			int t;
			cin >> t;
			if (!S[t].empty()) {
				cout << S[t].top() << endl;
			}
		}
		else if (n == 2) {
			int t;
			cin >> t;
			if (!S[t].empty()) {
				S[t].pop();
			}
		}
	}
	return 0;
}


Measured memory_bytes: 4328
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define scan(a,n) for(int i=0;i<n;i++)cin>>a[i]
#define scan1(a,n) for(int i=0;i<n;i++){  int z; cin>>z; a.pb(z);}
#define print(a) for(int i=0;i<a.size();i++){    cout<<a[i]<<" " ;}
#define for1(i,n) for(int i=0;i<n;i++)
#define pi 6.28318530717958623200
int main() 
{
    ll n,m;
    cin>>m>>n;
    ll a[n];
    scan(a,n);
    ll sum=accumulate(a+0,a+n,0);
    if(sum>m)
      cout<<-1<<endl;
    else
      cout<<m-sum<<endl;
 	return 0;
} 

Measured memory_bytes: 3676
#include <bits/stdc++.h>
#define DUMP(x)  cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define IFOR(i, m, n) for(int i = n - 1; i >= m; i-- )
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
const ll INF = 1e18;
/* テンプレートここまで */

int main() {
  ll a,b,c,d; cin >> a >> b >> c >> d;
  cout << min(a,b) + min(c,d) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000007;
int main(){

  //input
  int N,K;
  cin >> N >> K;
  int A[N];
  for(int i=0;i<N;i++) cin >> A[i];
  
  //dp_setup
  //define:dp[i]=0-indexedでi番目のマスに辿り着くまでの最小コスト
  int dp[N+K];
  for(int i=1;i<N+K;i++) dp[i]=INF;
  dp[0]=0;
  
  //dp_onwork
  for(int i=0;i<N;i++){
    for(int j=1;j<=K;j++)dp[i+j]=min(dp[i+j],dp[i]+abs(A[i+j]-A[i]));
  }
  
  //output
  cout << dp[N-1] << endl;

}

Measured memory_bytes: 1024
/* 	* In the name of GOD 
 	* Thanks God */
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
#define F first
#define S second

int32_t main(){
	map <string, int> mp;
	int n;
	cin >> n;
	for (int i = 0; i < n; i++){
		string s;
		cin >> s;
		mp[s] ++;
	}
	cout << "AC x " << mp["AC"] << endl;
	cout << "WA x " << mp["WA"] << endl;
	cout << "TLE x " << mp["TLE"] << endl;
	cout << "RE x " << mp["RE"] << endl;
}


Measured memory_bytes: 3632
#include<iostream>
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int64_t N, K;
    cin >> N >> K;
    int64_t ori_N;
    int64_t minN;
    minN = N % K;
    int64_t ori_minN = minN;
    if(ori_minN > abs(minN - K)) cout << abs(minN - K) << endl;
    else cout << minN << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
int M,N,K[100],lb[100][100],ub[100][100];
bool cant(int a,int b){
	rep(i,N){
		if(lb[a][i]>ub[b][i]) return 1;
	}
	return 0;
}
bool e[100][100];
int main(){
	cin>>M>>N;
	rep(i,M) rep(j,N) ub[i][j]=1e9;
	rep(i,M){
		cin>>K[i];
		rep(j,K[i]){
			int s,t;
			string st;
			cin>>s>>st>>t;
			if(st[0]=='>') chmax(lb[i][s-1],t);
			else chmin(ub[i][s-1],t);
		}
		rep(j,N){
			if(lb[i][j]>ub[i][j]){
				puts("No");
				return 0;
			}
		}
	}
	rep(i,M) rep(j,M){
		if(i!=j&&cant(i,j)) e[i][j]=1;
	}
	rep(i,M) rep(j,M) rep(k,M) if(e[j][i]&&e[i][k]) e[j][k]=1;
	rep(i,M) if(e[i][i]){
		puts("No");
		return 0;
	}
	puts("Yes");
}

Measured memory_bytes: 1236
#include<bits/stdc++.h>
using namespace std;
int main(void)
{
	long long n;
	cin>>n;
	long long m=n;
	int s;
	while(m>0)
	{
		s+=m%10;
		m/=10;
	}
	if(n%s==0)
	cout<<"Yes\n";
	else
	cout<<"No\n";
}

Measured memory_bytes: 3532
// Best practice

#include<bits/stdc++.h>

#define int         long long
#define pb          push_back
#define pf          emplace_front
#define all(a)      (a).begin(),(a).end()
#define rall(a)     (a).rbegin(),(a).rend()
#define pii 		pair<int,int>
#define psi 		pair<string,int>
#define vi 			vector<int>
#define vpii  		vector<pii>
#define vvi 		vector<vi>
#define sz(x)	    (int)(x).size()
#define x           first
#define y           second
#define endl        '\n'
#define tezz        ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define MOD         1000000007
#define hell        998244353
#define output(x)   cout << (x ? "YES" : "NO")<<endl;
using namespace std;


// Code from Here -------------------------------------------------------------------------------


signed main() {
	tezz


	int a,b;
	cin >> a >> b;
	cout << a*b;

	return 0;
}  


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

int main() {
  int n,m,x,ans;
  cin>>n>>m>>x;
  vector<int> a(m);
  for(int i=0;i<m;i++)cin>>a.at(i);
  sort(a.begin(),a.end());
  for(int i=0;i<m;i++){
    if(x<a.at(i)){
      ans=min(i,m-i);
      cout<<ans<<endl;
      return 0;
    }
  }
}


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

int main(){
  int n;
  cin >> n;
  vector<int> d(n);
  for(int i=0;i<n;i++)
    cin >> d.at(i);
  
  int k=0;
  for(int i=0;i<n-1;i++){
    for(int j=1;j<n;j++){
      if(i<j){
        k+=d.at(i)*d.at(j);
      }
    }
  }
  
  cout << k << endl;
}

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 int ll;
const ll MOD = 1000000007;

int c[50];

int main() {
  int n, m, a, b;
  cin >> n >> m;
  REP(i, m) {
    cin >> a >> b;
    c[a - 1]++;
    c[b - 1]++;
  }
  REP(i, n) {
    cout << c[i] << endl;
  }
  return 0;
}

Measured memory_bytes: 256
def get_i() #空白区切の入力を数値(整数)の配列で返す
  return gets.chomp.split(" ").map(&:to_i)
end
def get_f() #空白区切の入力を数値(実数)の配列で返す
  return gets.chomp.split(" ").map(&:to_f)
end
def get() #空白区切の入力を文字列の配列で返す
  return gets.chomp.split(" ")
end
def get_nsp() #入力されたものを一文字ずつに区切った文字列の配列で返す
  return gets.chomp.split("")
end
def yn_judge(bool,y="Yes",n="No") #boolに真偽を投げることで、trueならy、falseならnの値を出力する
  return bool ? y : n 
end
def array(size1,init=nil,size2=1) #size2に二次元配列時の最初の要素数、size1に次の配列の大きさ、initに初期値を投げることでその配列を返す
  if size2==1
    return Array.new(size1){init}
  else
    return Array.new(size2){Array.new(size1){init}}
  end
end

def max(a,b)
    return a>b ? a : b
end
N,K=get_i
A=get_i
bit=array(40,0)
A.each do|a|
    a=a.to_s(2).split("").map(&:to_i)
    a.reverse.each_with_index do|v,i|
        bit[i]+=v
    end
end
res=0
bit.reverse.each_with_index do|b,i|
    if res+2**(40-1-i)<=K and b<=N/2
        res+=2**(40-1-i)
    end
end
ans=0
A.each do|a|
  ans+=a^res
end
puts ans

Measured memory_bytes: 26360
import java.util.*;

public class Main {
    public static void main(String[] args) {	
	Main main = new Main();
    	main.solveC();
    }
    
    private void solveA() {
    	Scanner sc = new Scanner(System.in);
    	String s = sc.next();
	int top = 0;

	for(int i=0; i < 3; i++){
	    if (s.charAt(i) == 'o') top += 100;
	}
	
    	System.out.println(700 + top);
    }

    private void solveB() {
	Scanner sc = new Scanner(System.in);
	int n = sc.nextInt();
    	int x = sc.nextInt();
	int cnt = 0;

	int[] m = new int[n];

	for(int i=0; i < n; i++){
	    m[i] = sc.nextInt();	    
	}

	Arrays.sort(m);

	for(int i=0; i < n; i++){
	    x -= m[i];
	    cnt++;
	}

	System.out.println(cnt + x/m[0]);
    }
    private void solveC() {
	Scanner sc = new Scanner(System.in);
	int a = sc.nextInt();
	int b = sc.nextInt();
	int c = sc.nextInt();
	int x = sc.nextInt();
	int y = sc.nextInt();
	int max = Math.max(x,y);

	int ans1 = a * x + b * y;
	int ans2 = max == x ? c*y*2 + a*(x-y) : c*x*2 + b*(y-x);
	int ans3 = c * max * 2;

	System.out.println(Math.min(Math.min(ans1,ans2),ans3));
       
    }
    private void solveD() {
	Scanner sc = new Scanner(System.in);
	int n = sc.nextInt();
	int[] a = new int[n];
    }
	
}


Measured memory_bytes: 23764
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#define INF 1000000009
#define LINF 1000000000000000009
#define all(a) a.begin(),a.end()
#define rep(i, n) for (ll i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;
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 (a > b) { a = b; return 1; } return 0; }
ll gcd(ll n, ll m) { return (m ? gcd(m, n%m) : n); }
ll lcm(ll n, ll m) { return n / gcd(n, m)*m; }

ll mod = 1000000007;

ll modpow(ll a, ll b) {
	ll ans = 1;
	a %= mod;
	while (b) {
		if (b & 1) ans = ans * a%mod;
		a = a * a%mod;
		b >>= 1;
	}
	return ans;
}

ll modinv(ll a) {
	ll b = mod, u = 1, v = 0;
	while (b) {
		ll t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= mod;
	if (u < 0) u += mod;
	return u;
}

int main() {
	ll n;
	cin >> n;
	vector<ll> a(n);
	for (int i = 0; i < n; i++) cin >> a[i];
	vector<ll> cnts(1000010);
	for (int i = 0; i < n; i++) {
		ll x = a[i];
		for (int j = 2; j*j <= a[i]; j++) {
			ll cnt = 0;
			while (x%j == 0) {
				x /= j; cnt++;
			}
			chmax(cnts[j], cnt);
		}
		if (x != 1) chmax(cnts[x], 1LL);
	}
	ll bs = 1;
	for (ll i = 1; i < 1000010; i++) {
		bs *= modpow(i, cnts[i]);
		bs %= mod;
	}
	ll ans = 0;
	for (ll i = 0; i < n; i++) {
		ans += bs * modinv(a[i]) % mod;
		ans %= mod;
	}
	cout << ans << endl;
}

Measured memory_bytes: 8192
from functools import reduce
from operator import add
N = int(input())
A = list(map(int, input().split()))
A_max = max(A)
A.remove(A_max)
#print(A)
#print(A_max)
#print(reduce(add ,A))
if A_max < reduce(add ,A):
    print('Yes')
else:
    print('No')


Measured memory_bytes: 3684
#include <bits/stdc++.h>
#define fi first
#define se second

using namespace std;

// typedef pair<int,int> pii;

int main(){
	long long x, y, cnt = 0;
	cin >> x >> y;
	while (x <= y){
		x *= 2;
		cnt++;
	}
	cout << cnt << "\n";
}

Measured memory_bytes: 256
use std::io;

fn read_line()-> String {
    let mut s = String::new();
    let _ = io::stdin().read_line(&mut s).unwrap();
    s
}

fn main() {
    let s = vec!["a","e","i","o","u"];
    let s2 = read_line();
    if s.contains(&s2.trim()) {
        println!("vowel");
    }else{
        println!("consonant");
    }

}

Measured memory_bytes: 4352
const fs = require('fs');

function main(input) {
  var input = input.split(' ');
  var a = parseInt(input[0])
  var b = parseInt(input[1])
  var ans = ""
  if (a * b & 1) {
    ans = 'Odd'
  } else {
    ans = 'Even'
  }
  console.log(ans);
}

input = fs.readFileSync('/dev/stdin', 'utf8');
main(input);

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

using namespace std;

/* g++ -g -fsanitize=address -lasan -std=c++11 -Dfoo_ */

/* freopen("input.txt", "rt", stdin); */
/* freopen("output.txt", "wt", stdout); */

#define ALL(c)          (c).begin(), (c).end()
#define ALLR(c)         (c).rbegin(), (c).rend()
#define FOR(i,a,b)      for (int i=(a); i < (b); ++i)
#define FORR(i,a,b)     for (int i=(a); i > (b); --i)
#define FOR_ALL(i,c)    for (__typeof((c).begin()) i=(c).begin();   \
                             i != (c).end(); ++i)
#define FOR_ALLR(i,c)   for (__typeof((c).rbegin()) i=(c).rbegin(); \
                             i != (c).rend(); ++i)
#define SZ(array)       (sizeof(array)/sizeof(array[0]))
#define lc(x)           (x<<1)     /* 2*x */
#define rc(x)           (x<<1 | 1) /* 2*x+1 */
#define lowbit(x)       (x & (-x)) /* 0b10100 -> 0b100 */

typedef long long       LL;
typedef map<int,int>    MII;
typedef pair<int,int>   PII;
typedef set<int>        SI;
typedef vector<bool>    VB;
typedef vector<double>  VD;
typedef vector<int>     VI;
typedef vector<string>  VS;

/* check if a key is in container C */
template <class C>
inline bool in_(const typename C::key_type& k, const C& A)
{ return A.find(k) != A.end(); }
inline bool in_(const string& s, const string& S)
{ return S.find(s) != string::npos; }

LL n,a,b;

LL dfs(const LL a, const LL b)
{
    if (a == b)
        return 0;
    LL ans = min(b-1,n-a);
    if ((b-a-1)&1) 
        return min(ans,(b-a)/2);
    if (a == 1) {
        ans = min(ans, 1+dfs(a,b-1));
    }
    else if (b == n) {
        ans = min(ans, 1+dfs(a+1,b));
    }
    else {
        const LL to1 = a-1;
        const LL ton = n-b;
        ans = min(to1+dfs(1,b-to1), ton+dfs(a+ton,n));
    }
    return ans;
}

int main()
{
#ifdef foo_
    freopen("foo", "rt", stdin);
#endif
    while (cin >> n >> a >> b) {
        cout << dfs(a,b) << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <numeric>
#include <cmath>

#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
using P = pair<ll, ll>;

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

const ll MOD = 1000000007;
const int INF = 1<<30;
//const ll INF = (ll)1e18 + 1;

int main(){
  int N; cin >> N;
  vector<P> a(N);
  rep(i, N) {
    cin >> a[i].first;
    a[i].second = i + 1;
  }
  sort(a.begin(), a.end());
  ll ans = 0;
  //rep(i, N) cout << a[i].first << " " << a[i].second << endl;
  rep(i, N){
    if (a[i].second % 2 == 0 && (i + 1) % 2 != 0) ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 1792
;; C - Low Elements

(defun solve (ps)
  "all(ps[i] <= ps[j] for j in range(i))が真であるiの個数.
   言い換えると, ps[i] <= min(ps[j] for j in range(i))であるiの個数."
  (let ((mins (loop for m = (first ps) then (min m p)
                    for p in ps collect (min m p))))
    (count t (mapcar #'<= ps mins))))

(let* ((n (read))
       (ps (loop repeat n collect (read))))
  (princ (solve ps)))


Measured memory_bytes: 61800
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
int main(){
    string s;
    cin >> s;
    map<char,int>cnt;
    bool hantei = true;

    rep(i,s.size()){
        cnt[s[i]]++;
    }
    rep(i,s.size()){
        if(cnt[s[i]]>1) hantei =false;
    }
    if(hantei) cout << "yes" << endl;
    else        cout << "no" << endl;
}

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

int main(int argc, char const *argv[])
{
	int n, k; cin >> n >> k;
	cout << n - k + 1 << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
    #include<vector>
    #include<algorithm>
    #define vi vector<int>
    #define all(v) v.begin(), v.end()
    #define ll long long int
    using namespace std;
    int main()
    {
        int n,cnt=0;
        cin>>n;
        if(n%1000!=0){
            cnt++;
        }
        cout<<((n/1000)+cnt)*1000 - n;
    }


Measured memory_bytes: 3620
N = int(input())
A = list(map(int,input().split()))

X = [0]*N
Y = [0]*N

import fractions

X[0]=A[0]
for i in range(1,N):
    X[i] = fractions.gcd(X[i-1], A[i])

Y[N-1]=A[N-1]
for i in range(1,N):
    Y[N-1-i] = fractions.gcd(Y[N-i], A[N-1-i])

cand = []
cand.append(X[N-2])
cand.append(X[N-1])#=Y[0]
cand.append(Y[1])
for i in range(1,N-1):
    cand.append(fractions.gcd(X[i-1],Y[i+1]))

print(max(cand))


Measured memory_bytes: 89312
import collections
import math
N,M=map(int,input().split())
A=list(map(int,input().split()))
F_a=[]
count=0
for a in A:
  count+=a
  count%=M
  F_a.append(count)
F = collections.Counter(F_a)
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
ans=F[0]
for f in F.values():
  if f>=2:
    ans+=combinations_count(f, 2)
print(ans)

Measured memory_bytes: 63640
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Math;
 
public class Hello{
    public static void Main(){
        int[] read= inta();
        int total = read[0]*3 + read[1];
        WriteLine(total/2);
    
    }
    //各種読取
    static string rstr(){
        return ReadLine();
    }
    static int rint(){
        return int.Parse(ReadLine());
    }
    static long rlong(){
        return long.Parse(ReadLine());
    }
    static string[] stra(){
        return ReadLine().Split(' ');
    }
    static int[] inta(){
        string[] read_str_array = ReadLine().Split(' ');
        int[] return_int_array = new int[read_str_array.Length];
        for(int countup_i=0;countup_i<read_str_array.Length;countup_i++){
            return_int_array[countup_i] = int.Parse(read_str_array[countup_i]);
        }
        return return_int_array;
    }
    static int[,] inta2(int num_array,int in_array){
        int[,] int_array2 = new int[num_array,in_array];
        for(int i=0;i<num_array;i++){
            int[] temp_array = inta();
            for(int j=0;j<in_array;j++){
                int_array2[i,j] = temp_array[j];
            }
        }
        return int_array2;
    }
    static long[] longa(){
        string[] read_str_array = ReadLine().Split(' ');
        long[] return_long_array = new long[read_str_array.Length];
        for(long countup_i=0;countup_i<read_str_array.Length;countup_i++){
            return_long_array[countup_i] = long.Parse(read_str_array[countup_i]);
        }
        return return_long_array;
    }
    static double[] doublea(){
        string[] read_str_array = ReadLine().Split(' ');
        double[] return_double_array = new double[read_str_array.Length];
        for(long countup_i=0;countup_i<read_str_array.Length;countup_i++){
            return_double_array[countup_i] = long.Parse(read_str_array[countup_i]);
        }
        return return_double_array;
    }
    // A/B小数点以下切上
    static long divideup(long divided,long divid){
        long temp_divide = divided/divid;
        if(divided % divid > 0){
            temp_divide++;
        }
        return temp_divide;
    }
    static long GCD(long a,long b){
        if(a < b){
            long temp = a;
            a = b;
            b = temp;
        }
        if(a % b == 0){ return b; }
        else{
            long temp = b;
            b = a%b;
            a = temp;
            return GCD(a,b);
        }
    }
    static long LCM(long a,long b){
        return a * b / GCD(a,b);
    }
}
//知見
// (string) hogestr -> (char[]) hoge
    // char hoge = hogestr.ToCharArray();
// (char[]) hoge -> (string) hogestr
    // string hoge = new string(hoge);
// Hashtable ×  Dictionary ○
// Dictionary hoge<string,int>
    // hoge.ContainsKey(string) -> return boolean
    // hoge[string] -> return int
    // hoge[int] -> CE
// Dictionary hoge<int1,int2>
    // hoge<int1,int2>: hoge[int1] -> return int2
    // KeyValuePair<int,int> k <-> k.Key == int1 / k.Value == int2
// SortedDictionary() > SortedList() ???
// キュー　-> 幅優先 ???
// スタック -> 深さ優先 ???


Measured memory_bytes: 11092
_n = gets.to_i
s = gets.chomp
count = 0

'0'.upto('9') do |i|
  '0'.upto('9') do |j|
    '0'.upto('9') do |k|
      next unless (idx_i = s.index(i))
      next unless (idx_j = s.index(j, idx_i + 1))
      next unless s.index(k, idx_j + 1)

      count += 1
    end
  end
end

puts count

Measured memory_bytes: 14456
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n
    
    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]
    
    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x
        
        self.parents[x] += self.parents[y]
        self.parents[y] = x
    
    def size(self, x):
        return -self.parents[self.find(x)]
    
    def isSame(self, x, y):
        return self.find(x) == self.find(y)

from collections import defaultdict
def solve():
    N, K, L = map(int, input().split())
    road_uf = UnionFind(N)
    train_uf = UnionFind(N)

    for i in range(K):
        p, q = map(lambda x: int(x)-1, input().split())
        road_uf.unite(p, q)

    for i in range(L):
        r, s = map(lambda x: int(x)-1, input().split())
        train_uf.unite(r, s)

    ma = defaultdict(int)
    for v in range(N):
        root_road = road_uf.find(v)
        root_train = train_uf.find(v)
        ma[str(root_road) + "_" + str(root_train)] += 1
    
    for v in range(N):
        root_road = road_uf.find(v)
        root_train = train_uf.find(v)
        print(ma[str(root_road) + "_" + str(root_train)], end=' ')

if __name__ == '__main__':
    solve()

Measured memory_bytes: 126808
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (true) {
			int H = sc.nextInt();
			int W = sc.nextInt();
			if (H == 0 && W == 0) {
				break;
			}
			for (int i = 0; i < H; i++) {
				for (int j = 0; j < W; j++) {
					if (i % 2 == 0 && j % 2 == 0 || i % 2 == 1 && j % 2 == 1) {
						System.out.print("#");
					} else {
						System.out.print(".");
					}
				}
				System.out.println();
			}
			System.out.println();
		}
	}
}



Measured memory_bytes: 33608