akhauriyash/Code-Regression huggingface dataset:
// SeeAlso: 

#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
#define NIL -1
#define MOD 1000000007

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 debig_vec(v) cout<<#v<<":";rep(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

// 最大公約数
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> inline void print(const T& x){cout << setprecision(12) << x << endl;}
template<class T, class... A> inline void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }
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; }

const long long INF = 1LL<<60;

int main() {
    int n, k;
    cin >> n >> k;
    vector<int> p;
    rep(i,n) {
        int t;
        cin >> t;
        p.push_back(t);
    }
    sort(p.begin(), p.end());

    ll ans = 0;
    rep(i, k) {
        ans+= p[i];
    }
    print(ans);
    return 0;
}


Measured memory_bytes: 3632
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<string.h>
#include<math.h>
#include<queue>
#include<iomanip>
//#include<bits/stdc++.h>
#define eps 1e-8
//#define inf 0x7f
#define inf 10000000
using namespace std;
int main()
{
    int n;
    while(~scanf("%d",&n))
    {
        if(n%10==9||n/10==9)
            printf("Yes\n");
        else
          printf("No\n");
    }
}


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

using namespace std;
using ll = long long;
using P = pair<ll, ll>;

const ll INF64 = 1LL << 60;
const int INF32 = 1 << 29;
const int MOD = 1000000007;

const int CASES = 3;

void solve() {
    ll N;
    cin >> N;
    ll root = sqrt(N);
    ll pair1 = 0;
    ll pair2 = 0;
    for (ll i = root; root > 0; --i) {
        if (N % i == 0) {
            pair1 = i;
            pair2 = N / i;
            break;
        }
    }
    ll ans = pair1 + pair2 - 2;
    cout << ans << endl;
}

int main() {
    #ifdef MYLOCAL
    vector<string> filenames {"input1.txt", "input2.txt", "input3.txt", "input4.txt"};
    cout << "------------\n";
    for(int i = 0; i < CASES; ++i){
        ifstream in(filenames[i]);
        cin.rdbuf(in.rdbuf());
        solve();
        cout << "------------\n";
    }
    #else

    solve();

    #endif
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
using namespace std;
#define FOR(i,from,to) for(i=(from);i<(to);i++)

int main() {
	int i, j, k, l;
	int N; cin >> N;
	int t = 0, x = 0, y = 0;
	FOR(i, 1, N + 1) {
		int tt, xx, yy;
		cin >> tt >> xx >> yy;
		int dt = tt - t;
		int dx = xx - x;
		int dy = yy - y;
		if (dx < 0) dx *= -1;
		if (dy < 0) dy *= -1;
		int dist = dx + dy;

		if (dt < dist || dt % 2 != dist % 2) {
			cout << "No" << endl;
			return 0;
		}
		t = tt;
		x = xx;
		y = yy;
	}
	cout << "Yes" << endl;
}

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

int main() {
  long long int n;
  	cin>>n;
  long long int a,b,c,d,e;
  	cin>>a>>b>>c>>d>>e;
  vector<long long int> vec={a,b,c,d,e};
  sort(vec.begin(), vec.end());
	if(vec[0]>=n) cout<<5<<endl;
    else if(vec[0]==1) cout<<4+n/vec[0]<<endl;
    else cout<<5+n/vec[0]<<endl;
}

Measured memory_bytes: 256
def main():
    import sys
    input = sys.stdin.buffer.readline
    def I(): return int(input())
    def MI(): return map(int, input().split())
    def LI(): return list(map(int, input().split()))
    
    class BIT:
        '''
        0-indexed
        '''
        def __init__(self, N):
            self.size = N
            self.tree = [0] * (N + 1)
            self.depth = N.bit_length()

        def _bitsum(self, i):
            ret = 0
            while i:
                ret += self.tree[i]
                i ^= i & -i
            return ret

        # [l,r)の和
        def bitsum(self, l, r=None):
            if r is None:
                return self._bitsum(l)
            else:
                return self._bitsum(r) - self._bitsum(l)

        # i番目にxを追加
        def add(self, i, x):
            i += 1
            while i <= self.size:
                self.tree[i] += x
                i += i & -i
            return

        def lower_bound(self, x):
            sum_ = 0
            pos = 0
            v = 1 << self.depth
            for i in range(self.depth, -1, -1):
                k = pos + v
                if k <= self.size and sum_ + self.tree[k] < x:
                    sum_ += self.tree[k]
                    pos += v
                v >>= 1
            return pos + 1, sum_

    
    N,Q=MI()
    C=LI()
    
    Query =[]
    
    M=10**6
    M2=10**12
    for i in range(Q):
        l, r = MI()
        l-=1
        r-=1
        Query.append(r*M2 + l*M + i)
    Query.sort()
    
    """
    事前処理 + クエリの高速処理
    or 
    クエリ先読み
    
    とりあえずrの昇順にクエリをソートしておく．
    結局，各色ごとに1つ前のやつがどこにあるかが問題=>各色ごとに最新の物だけを保持すれば良い．
    最終的にクエリに答えたいので，i番目が使えるかどうかBITで管理
    """
    bit=BIT(N+3)
    dd=[N+3]*(N+1)#多くとっておく
    
    ans=[0]*Q
    pre=-1
    for q in Query:
        r = q // 10 ** 12
        l = (q % 10 ** 12) // 10 ** 6
        i = q % 10 ** 6
        for j in range(pre+1,r+1):
            c=C[j]
            old=dd[c]#その色の古いやつ
            bit.add(old,-1)#もしまだ出てきていないなら，範囲外の使わないところを-1する
            #最新を追加
            dd[c]=j
            bit.add(j,1)
        pre=r
        ans[i]=bit.bitsum(l,r+1)
        
    for a in ans:
        print(a)
main()


Measured memory_bytes: 152780
import sys
a, v = list(map(lambda x: int(x), input().split(" ")))
b, w = list(map(lambda x: int(x), input().split(" ")))
t = int(input())

direction = 1 if b > a else - 1
if a == b:
  print('YES')
  sys.exit()


a = a + direction * v * t
b = b + direction * w * t
if direction == 1 and a >= b:
  print('YES')
  sys.exit()
if direction == -1 and a <= b:
  print('YES')
  sys.exit()

print('NO')

Measured memory_bytes: 9208
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<string>
#include<tuple>
#include<utility>
#include<stack>
#include<set>
#include<iomanip>
using namespace std;
using ll=long long int;

int main() {

	int n;
	while (cin >> n, n != 0) {
		int sum = 0;
		vector<int>a(n);
		for (int i = 0; i < n; i++) {

			cin >> a[i];
			sum += a[i];
		}
		int cnt = 0;
		for (int i = 0; i < n; i++) {
			if (n * a[i] <= sum) {
				cnt++;
			}
		}
		cout << cnt << endl;

	}
	return 0;
}



Measured memory_bytes: 3036
#include <stdio.h>
int main(void)
{
char x[2] = {'#', '.'};
int W, H, i, j, n;

while(1) {

scanf("%d %d",&H,&W);

if(H == 0 && W == 0)
   break;


for(j = 0; H > j; j++){

i = j % 2;

for(n = 0; W > n; n++){
printf("%c", x[i % 2]);
i++;
}
printf("\n");
}
printf("\n");
}
return 0;
}

Measured memory_bytes: 1000
/*

*/
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <ctype.h>

int main()
{
	int a,b;
	for(a=1; a<=9; a++){
		for(b=1; b<=9; b++){
			printf("%dx%d=%d\n",a,b,a*b);
		}
	}
	return 0;
}

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

using namespace std;

#define llint long long int
#define REP(i,s,l) for(llint i=s;i<l;i++)
#define DEBUG 0
#define INF (1LL<<50)
#define MOD 1000000007

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

    if(today == "Sunny") cout << "Cloudy" << endl;
    if(today == "Cloudy") cout << "Rainy" << endl;
    if(today == "Rainy") cout << "Sunny" << endl;

    return 0;
}

Measured memory_bytes: 256
import itertools
n, m, R = map(int, input().split())
r = list(map(int, input().split()))
INF = float("inf")
G = [[INF] * n for i in range(n)]

for i in range(m):
    a, b, c = map(int, input().split())
    G[a - 1][b - 1] = c
    G[b - 1][a - 1] = c

for k in range(n):
    for i in range(n):
        for j in range(n):
            G[i][j] = min(G[i][k] + G[k][j], G[i][j])

num = INF
for per in itertools.permutations(r):
    rec = 0
    pre = per[0] - 1
    for j in range(1, len(r)):
        rec += G[pre][per[j] - 1]
        pre = per[j] - 1
        if rec > num:
            break

    num = min(rec, num)

print(num)


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

int main(){
  int casenum;
  string val,pre,unit;
  int b;
  
  map<string,int> p;
  
  p["yotta"] = 24;
  p["zetta"] = 21;
  p["exa"] = 18;
  p["peta"] = 15;
  p["tera"] = 12;
  p["giga"] = 9;
  p["mega"] = 6;
  p["kilo"] = 3;
  p["hecto"] = 2;
  p["deca"] = 1;
  p["deci"] = -1;
  p["centi"] = -2;
  p["milli"] = -3;
  p["micro"] = -6;
  p["nano"] = -9;
  p["pico"] = -12;
  p["femto"] = -15;
  p["ato"] = -18;
  p["zepto"] = -21;
  p["yocto"] = -24;

  cin >> casenum;
  while(casenum--){
    cin >> val >> pre;
    b = p[pre];
    if(b)cin >> unit;
    else unit = pre;

    int pos = 0;

    while(pos<val.size()){
      if(val[pos] == '.'){
	val.erase(val.begin()+pos);
	break;
      }
      pos++;
    }

    while(val[0] == '0'){
      val.erase(val.begin());
      b--;
    }

    if(val.size()>1)val.insert(val.begin()+1,'.');

    cout << val << " * 10^" << b+(pos-1) << " " << unit << endl;
  }
}

Measured memory_bytes: 0
package main

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

func main() {
	var N int
	var D float64
	var X, Y float64
	var count int
	r := bufio.NewReader(os.Stdin)
	w := bufio.NewWriter(os.Stdout)
	defer w.Flush()
	fmt.Fscan(r, &N, &D)
	for i := 0; i < N; i++ {
		fmt.Fscan(r, &X, &Y)
		if d := math.Sqrt(X*X + Y*Y); d <= D {
			count++
		}
	}
	fmt.Fprintln(w, count)
}


Measured memory_bytes: 5052
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int h = sc.nextInt();
		int w = sc.nextInt();
		char[][] a = new char[h][w];
		for(int i = 0 ; i < h ; i++) a[i] = sc.next().toCharArray();
		int cnt = 0;
		for(int i = 0 ; i < h ; i++) {
			for(int j = 0 ; j < w ; j++) {
				if(a[i][j] == '#') cnt++;
			}
		}
		if(h + w - 1 == cnt) System.out.println("Possible");
		else System.out.println("Impossible");
	}
}


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

typedef long long LL;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
typedef vector<int> VI;
typedef unsigned long long ULL;

#define MP make_pair
#define PB push_back
#define EB emplace_back
#define FOR(i, a, b) for (int i = (a); i<(b); ++i)
#define RFOR(i, b, a) for (int i = (b)-1; i>=(a); --i)
#define ALL(a) a.begin(), a.end()
#define SZ(a) (int)a.size()
#define f first
#define s second
#define FILL(a, b) memset(a, b, sizeof(a))

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

int mex(const VI &a)
{
	set<int> st(ALL(a));
	for (int i = 0; ; ++i)
	{
		if (!st.count(i))
		{
			return i;
		}
	}
}

const int MOD = 998244353;

LL binpow(LL a, LL n)
{
	LL res = 1;
	while(n > 0)
	{
		if (n & 1)
		{
			res = res * a % MOD; 
		}
		a = a * a % MOD;
		n >>= 1;
	}
	return res;
}

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(nullptr);
	int n;
	cin >> n;
	VI d(n), cnt(n);
	for (int i = 0; i < n; ++i)
	{
		cin >> d[i];
		cnt[d[i]]++;
	}
	if (mex(d) < *max_element(ALL(d)))
	{
		cout << 0 << "\n";
		return 0;
	}

	for (int i = 1; i < n; ++i)
	{
		if (d[i] == 0)
		{
			cout << 0 << "\n";
			return 0; 
		}
	}

	LL ans = 1;
	for (int i = 1; i + 1 < n; ++i)
	{
		ans *= binpow(cnt[i], cnt[i + 1]);
		ans %= MOD;
	}
	cout << ans << "\n";

	return 0;
}


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

int main() {
    int64_t m;
    cin >> m;
    int64_t dsum = 0, csum = 0;
    for (int64_t i = 0; i < m; i++) {
        int64_t d, c;
        cin >> d >> c;
        dsum += c * d;
        csum += c;
    }

    cout << csum-1 + (dsum-1)/9 << endl;
}


Measured memory_bytes: 256
using System;

namespace AtCoderBeginnerContest165
{
    class Program
    {
        static void Main(string[] args)
        {
            Int64 X = Int64.Parse(Console.ReadLine());
            
            Int64 Y = 100;
            int year = 0;
            while(Y < X){
                year++; 
                Y = (Int64)(Y * 1.01);
            }
            Console.WriteLine(year);
        }
    }
}


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

using namespace std;

#define INF 2140000000
#define MOD 1000000007

int main() {
	int H, W, h, w;

	cin >> H >> W >> h >> w;

	cout << H*W -(h * W + w * H - h * w);


	return 0;
}


Measured memory_bytes: 256
/*
    Washief Hossain Mugdho
    19 September 2020
    Educational DP Candies
*/


#include <bits/stdc++.h>
#define ull unsigned long long
#define ll long long
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define fastio ios_base::sync_with_stdio(0)
#define untie cin.tie(0)
#define ms(a, b) memset(a, b, sizeof a)
#define mod 1000000007
using namespace std;

int prefix[103][100005];
int a[103], n, k;

inline int sub(int a, int b)
{
    int ans = a - b;
    return ans < 0 ? ans + mod : ans;
}

int main()
{
#ifdef LOCAL_OUTPUT
    freopen(LOCAL_OUTPUT, "w", stdout);
#endif
#ifdef LOCAL_INPUT
    freopen(LOCAL_INPUT, "r", stdin);
#endif
    fastio;
    untie;
    cin >> n >> k;
    for (int i = 1; i <= n; i++)
    {
        cin >> a[i];
        prefix[i][1] = 1;
    }

    for (int i = 1; i <= k + 1; i++)
        prefix[0][i] = 1;

    for (int i = 1; i <= n; i++)
        for (int j = 1; j <= k; j++)
        {
            int start = max(0, j - a[i]);
            int x = sub(prefix[i - 1][j + 1], prefix[i - 1][start]);
            prefix[i][j + 1] = (prefix[i][j] + x) % mod;
        }

    cout << sub(prefix[n][k + 1], prefix[n][k]) << endl;
}


Measured memory_bytes: 43048
h, w, d = gets.chomp.split(" ").map(&:to_i)

g = Array.new(h*w+1)
h.times do |i|
  row = gets.chomp.split(" ").map(&:to_i)
  w.times do |j|
    a = row[j]
    g[a] = [i, j]
  end
end

a = Array.new(h*w+1, 0)
1.upto(h*w-d) do |i|
  x0, y0 = g[i]
  x1, y1 = g[i+d]
  cost = (x1 - x0).abs + (y1 - y0).abs
  a[i+d] = a[i] + cost
end

q = gets.chomp.to_i

q.times do
  l, r = gets.chomp.split(" ").map(&:to_i)
  if l == r
    puts 0
  else
    puts a[r] - a[l]
  end
end

Measured memory_bytes: 11644
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
 
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }
typedef long long ll;

int main(){
    int a,b,c;
    cin>>a>>b>>c;
    cout<<max(0,c-(a-b))<<endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
	int i,j,hit,brow;
	int num[8];

	while(scanf("%d",&num[0]) != EOF){
		for(i = 1;i < 8;i++){
			scanf("%d",&num[i]);
		}

		hit = 0;
		brow = 0;

		for(i = 0;i < 4;i++){
			for(j = 0;j < 4;j++){
				if(num[i] == num[4+j]){
					brow++;
				}
			}
			if(num[i] == num[4+i]){
				hit++;
			}
		}

		brow -= hit;

		printf("%d %d\n",hit,brow);
	}

	return 0;
}

Measured memory_bytes: 596
#!/usr/bin/env python3
import sys


input = sys.stdin.readline
def IS(cb): return cb(input().strip())
def IL(cb): return [cb(s) for s in input().strip().split()]
def IR(cb, rows): return [IS(cb) for _ in range(rows)]
def ILL(cb, rows): return [IL(cb) for _ in range(rows)]


def solve():
    A, B, C, K = IL(int)
    if K <= A:
        print(K)
    elif K <= A + B:
        print(A)
    else:
        print(A - (K - A - B))


solve()


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

int query(int x, int y){
	cout << "? " << x << " " << y << endl;
	char c; cin >> c;
	return c == 'Y';
}

int main(){
	int a, b;
	cin >> a >> b;
	if(a <= b){
		puts("Impossible");
		return 0;
	}
	int cur = 0, ret = 0;
	for(int i=0; i<a+b; i++){
		if(ret == 0) cur = i;
		int q = query(i, cur);
		if(q == 0){ if(ret) ret--; }
		else ret++;
	}
	string dap = "! ";
	for(int i=0; i<a+b; i++){
		dap.push_back(query(cur, i) + '0');
	}
	cout << dap << endl;
}



Measured memory_bytes: 3916
import java.util.*;

class Main{
    public static void main(String[] args){
        
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        String S = sc.next();
        String a = "RGB";
        long ans = 0;
        long r = 0;
        long g = 0;
        long b = 0;

        for(int i=0; i<N; i++){
            if(S.charAt(i)==a.charAt(0)){
                r += 1;
            }
            else if(S.charAt(i)==a.charAt(1)){
                g += 1;
            }
            else{
                b += 1;
            }
        }
        ans = r * g * b;
        for(int i=0; i<N-2; i++){
            for(int j=i+1; j<N-1; j++){
                if(2*j-i>=N){
                    break;
                }
                if(S.charAt(i)!=S.charAt(j) && S.charAt(j)!=S.charAt(2 * j - i) && S.charAt(i)!=S.charAt(2 * j - i)){
                    ans -= 1;
                }
            }
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 37596
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <bitset>
#include <numeric>
#include <complex>
#include <iomanip>
#include <cassert>
#include <random>


int main() {
    long long x; std::cin >> x;
    long long cur = 100;
    int cnt = 0;
    while (cur < x) {
        cnt++;
        cur += cur / 100;
    }
    std::cout << cnt << std::endl;
    return 0;
}


Measured memory_bytes: 3624
import java.util.*;

public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        long x = Long.parseLong(sc.next());
        long y = Long.parseLong(sc.next());

        // 主処理
        long result = 0;
        long count = x;
        while (count <= y) {
            count *= 2;
            result++;
        }

        // 出力
        System.out.println(result);
        sc.close();
    }
}


Measured memory_bytes: 23764
def main():
    x, y = map(int, input().split())
    print(gcd(x, y))

def gcd(x, y):
    if(x < y):
        x, y = y, x
    while True:
        if(y == 0):
            return x
        else:
            x, y = y, x%y

if __name__ == '__main__':
    main()

Measured memory_bytes: 5600
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<int> v(n);
  for(int i=0;i<n;i++) cin >> v[i];

  sort(v.begin(),v.end());

  double ans = (double)(v[0]+v[1])/2;

  for(int i=2;i<n;i++){
    ans = (double)(ans+v[i])/2;
  }

  printf("%.7lf\n",ans);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a,b,c,d,e,f,g;
  string t,u,v;
  char s;
  cin >> s;
  if (isupper(s)){
    cout <<"A";
  }else{
    cout <<"a";
  }
}

Measured memory_bytes: 3564
#include <iostream>
#include <string>
#include <algorithm>
#include <iomanip>
using namespace std;

int main() {
	int H,W;
	cin>>H>>W;
	string s[H][W];
	for(int h=0; h<H; h++){
		for(int w=0; w<W; w++){
			cin >> s[h][w];
			if(s[h][w]=="snuke"){
				cout<<
				(char)('A'+w)<<h+1<<endl;
			}
		}
	}
	return 0;
}

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

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define MOD 1000000007
typedef long long ll;


int main() {
    string s;
    cin >> s;
    int len = (int)s.length();
    ll ans = 0;
    int b = pow(2, len-2);
    for(int bits = 0; bits < (1 << len-1); bits++){
        vector<string> sub(len);
        sub[0] = s[0];
        int idx = 0;
        rep(i, len-1){
            if(!(bits & b >> i)){
                sub[idx] += s[i+1];
            }else {
                idx++;
                sub[idx] = s[i+1];
            }
        }
        idx++;
        rep(i, idx){
            ans += stol(sub[i]);
        }
    }
    cout << ans << endl;
}



Measured memory_bytes: 512
n, k = map(int, raw_input().strip().split())
a = map(int, raw_input().strip().split())

ans = 0
cur = 0
for i in xrange(k):
  cur += a[i]

ans = max(ans, cur)
for i in xrange(k, n):
  cur -= a[i - k]
  cur += a[i]
  
  ans = max(ans, cur)

ans = ans + k
ans /= 2.0

print "{0:.9f}".format(ans)

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

string g[101010];
int main() {
    int n, k, r, s, p;
    string t;
    // vector<string> g(k);
    cin >> n >> k >> r >> s >> p >> t;
    rep(i, n) g[i % k] += t[i];
    int ans = 0;
    rep(i, k) {
        int m = g[i].size();
        int rr = 0;
        int ss = 0;
        int pp = 0;
        if (g[i][0] == 'r') pp = p;
        if (g[i][0] == 's') rr = r;
        if (g[i][0] == 'p') ss = s;

        for (int j=1;j<m;++j) {
            int rrr = max(ss, pp);
            int sss = max(rr, pp);
            int ppp = max(rr, ss);

            if (g[i][j] == 'r') ppp += p;
            if (g[i][j] == 's') rrr += r;
            if (g[i][j] == 'p') sss += s;

            rr = rrr;
            ss = sss;
            pp = ppp;
        }
        ans += max({rr, ss, pp});
    }
    cout << ans << endl;
}


Measured memory_bytes: 5248
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;

long long n, k;

int main(){

  cin >> n >> k;

  long long sum = 0;
  long max = pow(10,9)+7;
  for(int i=k; i<=n+1; ++i){
    sum += n*i + i - pow(i,2) + 1;
    while(sum >= max) sum -= max; 
  }
  cout << sum  << endl;

  return 0;
}


Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define in(x,y,h,w) x >= 0 && x < h && y >= 0 && y < w

#define int long long
//typedef    long long          ll;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      P;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
 
const int INF=1e+18;
const double EPS=1e-9;
const int MOD=1000000007;

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

int n,a[200010],ans[200010] = {};

signed main(){
	int r;
	cin >> r;
	cout << 3 * r * r << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
int main()
{
	double x,h;
	double S;
	while(1){
		scanf("%lf %lf",&x,&h);
		if(x==0&&h==0)
			break;
		S=x*x;
		S+=x*sqrt(x*x/4+h*h)*2;
		printf("%lf\n",S);
	}
	return 0;
}

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

using namespace std;
using ll = long long;
#define int ll
using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define PB push_back

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const int MOD = 1000000007;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template <typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }
template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a){
  out<<'('<<a.first<<','<<a.second<<')';
  return out;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
  out<<'[';
  REP(i, a.size()) {out<<a[i];if(i!=a.size()-1)out<<',';}
  out<<']';
  return out;
}

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

int dp[65][2];
VI v[3];
signed main(void)
{
  cin.tie(0);
  ios::sync_with_stdio(false);

  int n;
  cin >> n;
  VI a(n);
  REP(i, n) cin >> a[i];

  int cnt1 = 0, cnt2 = 0, cnt3 = 0;
  REP(i, n) {
    if(a[i]==2) cnt1++, v[0].PB(i);
    else if(a[i]==-2) cnt2++, v[1].PB(i);
    else if(a[i]==-1) cnt3++, v[2].PB(i);
  }
  if(cnt3==0 && cnt2%2) {
    cnt2--;
    cout << cnt1 + cnt2 << endl;
    VI ans;
    REP(i, v[0].size()) ans.PB(v[0][i]);
    REP(i, cnt2) ans.PB(v[1][i]);
    sort(ALL(ans));
    REP(i, ans.size()) {
      cout << ans[i]+1 << endl;
    }
    return 0;
  } else if(cnt2%2==0) {
    cout << cnt1 + cnt2 << endl;
    VI ans;
    REP(i, v[0].size()) ans.PB(v[0][i]);
    REP(i, cnt2) ans.PB(v[1][i]);
    sort(ALL(ans));
    REP(i, ans.size()) {
      cout << ans[i]+1 << endl;
    }
  } else if(cnt3>=1 && cnt2%2) {
    cout << cnt1 + cnt2 + 1 << endl;
    VI ans;
    REP(i, v[0].size()) ans.PB(v[0][i]);
    REP(i, cnt2) ans.PB(v[1][i]);
    ans.PB(v[2][0]);
    sort(ALL(ans));
    REP(i, ans.size()) {
      cout << ans[i]+1 << endl;
    }
  }

  return 0;
}



Measured memory_bytes: 3180
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
    int n, x, y;

    cin >> n >> x >> y;

    cout << min(x, y) << " ";

    if (n - max(x, y) >= min(x, y)) {
        cout << "0" << endl;
    }
    else {
        cout << min(x, y) - (n-max(x, y)) << endl;
    }
}


Measured memory_bytes: 256
#include <stdio.h>

int main()
{
    char str[20];
    int i = 0, count = 0;
    
    scanf("%s", str);
    while(str[i++]) count++;
    
    for (i = count - 1; i >= 0; i--){
        printf("%c", str[i]);
    }
    printf("\n");
    
    return 0;
}

Measured memory_bytes: 524
import sys
from collections import deque
from heapq import heappop, heappush

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n, k = map(int, input().split())
    TD = [list(map(int, input().split())) for _ in range(n)]
    TD.sort(key=lambda z: -z[1])
    TD_new = [[] for _ in range(n)]
    for t, d in TD:
        TD_new[t - 1].append([d, 0] if len(TD_new[t - 1]) else [d, 1])

    ALL = []
    for td in TD_new:
        ALL.extend(td)
    ALL.sort(reverse=True)
    que = deque(ALL)

    x = y = 0
    zero = []
    for _ in range(k):
        d, ex = que.popleft()
        x += d
        y += ex
        if ex == 0:
            heappush(zero, d)

    res = x + y ** 2
    while que:
        d, ex = que.popleft()
        if ex:
            if zero:
                x += d - heappop(zero)
                y += 1
                res = max(res, x + y ** 2)
            else:
                break

    print(res)


if __name__ == '__main__':
    resolve()


Measured memory_bytes: 47160
#include<iostream>
#include<stdio.h>//printf("%.*f\n",*********);
#include<vector>//s.erase(n),vector
#include<algorithm>//next_permutation
#include<set>
#include<string>//char('a'=32+'A')
                //to_string,string,substr
#include<sstream>
#include<complex>
#include<time.h>
#include<random>
#include<cmath>//min,max
#include<math.h>
#include<queue>
#include<time.h>
#include<iomanip>
#include<locale>
#include<utility>//swap

#define rt "\n"
#define rep(i,n) for(int i=0;i<n;i++)
#define rop(i,n) for(int i=1;i<=n;i++)//start==1
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define drop(i,n) for(int i=n;0<i;i--)//end==1
#define yes(ans) if(ans)cout<<"yes"<<rt;else cout<<"no"<<rt;
#define Yes(ans) if(ans)cout<<"Yes"<<rt;else cout<<"No"<<rt;
#define YES(ans) if(ans)cout<<"YES"<<rt;else cout<<"NO"<<rt;
#define Yay(ans) if(ans)cout<<"Yay!"<<rt;else cout<<":("<<rt;
#define sec(a,b,ans) if(ans)cout<<a<<rt;else cout<<b<<rt;
#define vcin(a,n) rep(i,n)cin>>a[i];//vcin(配列名),(繰り返し回数)
#define sort(s) sort(s.begin(),s.end())//昇順
#define reve(s) reverse(s.begin(),s.end())//反転
#define please return
#define AC 0
#define rapid_pleaseAC_fast cin.tie(0);ios::sync_with_stdio(false)
#define pi 3.1415926535897932384626//pi
#define nine 1000000000//10^9

using namespace std;
typedef vector<int> vint;
typedef long double ldouble;
typedef vector<string> vstr;
typedef vector<char> vchar;
typedef vector<double> vdou;
typedef vector<double> vdouble;
typedef long long int llint;
typedef pair<int, int> pint;
typedef pair<llint, llint> pllint;
typedef vector<llint> vllint;
typedef vector<pint> vpint;
typedef vector<pair<llint, llint>> vpllint;
typedef vector<vector<int>> vvint;
typedef vector<vector<char>> vvchar;
typedef vector<vector<double>> vvdouble;
typedef vector<vector<llint>> vvllint;
typedef vector<vector<string>> vvstr;
typedef vector<vector<bool>> vvbool;
typedef vector<vector<pint>> vvpint;
typedef vector<bool> vbool;

long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

long long LCM(long long a, long long b) {
	return a * b / GCD(a, b);
}

unsigned GetDigit(unsigned num) {
	return std::to_string(num).length();
}

int tow(int n) {//2のn乗
	if (n == 0)return 1;
	int x = tow(n / 2);
	x *= x;
	if (n % 2 == 1)x *= 2;
	return x;//@domino
}

int KETA(int n) { //Sum of Each Digit
	int sum = 0;
	while (n > 0) {
		sum += n % 10; n /= 10;
	}
	return sum;
}

unsigned ND(unsigned num) {//Number of Digits
	return std::to_string(num).length();//outmax=10
}

bool KIBN(string s) {
	rep(i, s.size() / 2) {
		if (s[i] != s[s.size() - 1 - i])return false;
	}
	return true;
}

/*

 (char)toupper(a[n])=文字列のn文字目を大文字で出力

  pow(a,b)=aのb乗

  */

bool ABC(int n) {
	if (0 < n && n < 13) {
		return true;
	}
	else {
		return false;
	}
}

int main(void) {
	rapid_pleaseAC_fast;

	int n;
	cin >> n;
	int ans = 1;
	while (ans <= n) {
		ans *= 2;
	}
	if (n == 1) {
		cout << 1 << rt;
	}
	else {
		cout << ans / 2 << rt;
	}

	please AC;
}
//参考：---

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

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

int main(){
	int n;
	cin >> n;
	string s[2*n];
	for(int i=0; i<n; i++){
		cin >> s[i];
		s[i]+=s[i];
		s[n+i]=s[i];
	}

	int ans=0;
	for(int i=0; i<n; i++){
		bool flg=true;
		for(int x=0; x<n; x++){
			for(int y=0; y<n; y++){
				flg&=(s[i+x][y]==s[i+y][x]);
			}
		}
		if(flg) ans++;
	}
	cout << ans*n << endl;
	return 0;
}

Measured memory_bytes: 768
import java.util.*;
import static java.lang.Math.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        double n = sc.nextInt();
        double k = sc.nextInt();
        double ans[] = new double[(int)n+1];
        for(int i=1; i<=(int)n; i++){
            double temp = (double)i;
            int memo = 0;
            while(true){
                
                if(temp > k-1){
                    break;
                }
                temp*=2;
                memo++;
            }
            ans[i] = 1/n * pow(0.5, memo);
        }
        double res = 0;
        for(int i =1; i<=(int)n; i++){
            res += ans[i]; 
        }
        System.out.println(res);

    }
}

Measured memory_bytes: 21844
#include<iostream>
using namespace std;
const int mod=1e9+7; 
int main(){
	long long res=0;
	long long n,k;
	cin>>n>>k;
	
	while(k<=n+1){
		long long qian=((k-1)*k/2)%mod,hou=((2*n%mod-k%mod+1)*k/2)%mod;
		res=(res+hou-qian+1+mod)%mod;
		k++;
	} 
	cout<<res;
} 

Measured memory_bytes: 3624
N = int(input())
MOD = 10**9+7

from collections import Counter
def factorize(n):
    d = Counter()
    m = 2
    while m*m <= n:
        while n%m == 0:
            n //= m
            d[m] += 1
        m += 1
    if n > 1:
        d[n] += 1
    return d

factors = Counter()
for n in range(1,N+1):
    factors += factorize(n)

ans = 1
for v in factors.values():
    ans *= (v+1)
    ans %= MOD
print(ans)

Measured memory_bytes: 3316
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<functional>
#include<algorithm>
#include<cstdio>
#include<unordered_map>
using namespace std;

typedef long long ll;
struct P{
	int pos,time;
};
bool operator<(P a,P b){return a.time<b.time;}
int a[100000],n,m,u1,u2;
P b[100000];
vector<int>e[100000];
int main() {
	cin>>m>>n;
	for(int i=0;i<m;i++){
		b[i]=P{i,-1};
		a[i]=0;
	}
	for(int i=0;i<n;i++){
		cin>>u1>>u2;
		e[u1].push_back(u2);
		a[u2]++;
	}
	queue<int>p;
	for(int i=0;i<m;i++){
		if(a[i]==0){
			p.push(i);
			b[i].time=0;
		}
	}
	while(!p.empty()){
		int t=p.front();p.pop();
		for(int i=0;i<e[t].size();i++){
			if(b[e[t][i]].time<b[t].time+1){
				b[e[t][i]].time=b[t].time+1;
				p.push(e[t][i]);
			}
		}
	}
	sort(b,b+m);
	for(int i=0;i<m;i++){
		cout<<b[i].pos<<endl;
	}
	//cout<<2<<endl;
}

Measured memory_bytes: 5924
#define _USE_MAT_DEFINES
#include<iostream>
#include <iomanip>
#include<stdio.h>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include <queue>
#include <utility>
#include <map>
#include <set>
#include <stack>
#include <deque>
#include <numeric>
#include <functional>
using namespace std;

#define INF 1e9
#define MOD 1000000007;//1e9+7

void solve() {
    long long H, N, sum = 0;
    cin >> H >> N;
    for (int i = 0; i < N; i++) {
        long long A;
        cin >> A;
        sum += A;
    }
    if (H <= sum)cout << "Yes";
    else cout << "No";
}

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

Measured memory_bytes: 384
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <set>
#include <map>
#include <algorithm>

#define int long long
#define MOD7 1000000007
#define MOD9 1000000009

#define rep(i, n) for (int i = 0; i < (n); i++)
#define REP(i, a, n) for (int i = (a); i <= (n); i++)
#define all(a) (a).begin(), (a).end()

using namespace std;

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

int nextInt() {int a; cin >> a; return a;}
char nextChar() {char a; cin >> a; return a;}
double nextDouble() {double a; cin >> a; return a;}
string nextString() {string a; cin >> a; return a;}

template<class T> void inputVector(vector<T>& v, int n) {
    v.resize(n);
    for (int i = 0; i < v.size(); i++) cin >> v[i];
}

int cnt[26];

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

    rep(i, S.size()) cnt[S[i] - 'a']++;

    bool ok = true;
    rep(i, 26) ok &= cnt[i] < 2;

    cout << (ok ? "yes" : "no") << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=1e6+7;
int n,m,f[N],g[N],ans[N]; char s[N],t[N];
inline void write(int u){
	if(u>9) write(u/10); putchar(u%10+'0');
}
int main(){
	cin>>n; int a=1,b=1;
	for(int i=1;i<=n/2;i++) a=a*3;
	for(int i=n/2+1;i<=n;i++) b=b*3;
	for(int i=0;i<a*b;i++){
		f[i]=f[i/3]*3,g[i]=(g[i]+1)%(a*b);
		if(i%3==1) f[i]+=2; else if(i%3==2) f[i]++;
	}
	scanf("%s",s+1),m=strlen(s+1);
	for(int i=0;i<a;i++){
		int u=i; int len=0;
		for(int z=1;z<=m;z++)
			if(s[z]=='S'){
				u=f[u];
				if(t[len]=='S') len--; else t[++len]='S';
			}
			else if(s[z]=='R'){
				if(u+1==a) t[++len]='R',u=0;
				else u++;
			}
		int v=u;
		for(int x=0;x<b;x++){
			int u=x;
			for(int z=1;z<=len;z++)
			if(t[z]=='S') u=f[u];
			else if(t[z]=='R'){
				if(u+1==b) u=0;
				else u++;
			}
			ans[i+x*a]=u*a+v;
		}
	}
	for(int i=0;i<a*b;i++) write(ans[i]),putchar(' ');
}

Measured memory_bytes: 10456
#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <string>
#include <functional>
#include <numeric>
#include <ctype.h>
#include <cstdlib>
#include <string.h>
#include <cmath>
#include <cstdio>





using namespace std;


int main()
{
	int a, b;

	string str;

	while (cin >> a >> b)
	{

		int sum = a + b;

		str = to_string(sum);

		cout << str.size() << endl;

		
	}


}

Measured memory_bytes: 3232
#include <bits/stdc++.h>
using namespace std;
 
int main() {
 int A,B,C,D;
  cin >> A >> B >> C >> D;
  if ( (A + B) > (C + D) ) {
    cout << "Left" << endl;
  }
  else if ((A + B) == (C + D)){
    cout << "Balanced" << endl;
  }
  else{
    cout << "Right" << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <sstream>
#include <algorithm>
using namespace std;
#define pb push_back
#define mp make_pair
#define ms(a, b)  memset((a), (b), sizeof(a))
#define eps 0.0000001
typedef long long LL;
typedef unsigned long long ULL;
const int inf = 0x3f3f3f3f;
const LL INF = 0x7fffffff;
const int maxn = 1e6+10;
const int mod = 1e9+7;

void init() {

}
void solve() {
    LL H, W;
    cin >> H >> W;
    if(H%3==0|| W%3==0) {
        cout << "0" << endl;
        return;
    } else {
        if(W>H)
            swap(H, W);
        LL ans = INF;
        LL s1, s2, s3, s4, s5, s6;
        for(LL i = 1; i<=H; i++) {
            s1 = i*W;
            if(W%2==0) {
                s4 = s3 = (H-i)*(W/2);
            } else {
                s3 = (H-i)*(W/2);
                s4 = (H-i)*((W+1)/2);
            }
//            s3 = (H-i)*(W/2);
//            s4 = s2 - s3;

            LL Min = min(min(s1, s3), s4);
            LL Max = max(max(s1, s3), s4);
            ans = min(ans, Max-Min);

            if((H-i)%2==0) {
                s5 = s6 = ((H-i)/2) * W;
            } else {
                s5 = ((H-i)/2)*W;
                s6 = ((H-i+1)/2)*W;
            }
//            s5 = ((H-i)/2) * W;
//            s6 = s2 - s5;
            Min = min(min(s1, s5), s6);
            Max = max(max(s1, s5), s6);
            ans = min(ans, Max-Min);
        }
        for(LL i = 1; i<=W; i++) {
           s1 = i*H;
            if(H%2==0) {
                s4 = s3 = (W-i)*(H/2);
            } else {
                s3 = (W-i)*(H/2);
                s4 = (W-i)*((H+1)/2);
            }
//            s3 = (H-i)*(W/2);
//            s4 = s2 - s3;

            LL Min = min(min(s1, s3), s4);
            LL Max = max(max(s1, s3), s4);
            ans = min(ans, Max-Min);

            if((W-i)%2==0) {
                s5 = s6 = ((W-i)/2) * H;
            } else {
                s5 = ((W-i)/2)*H;
                s6 = ((W-i+1)/2)*H;
            }
//            s5 = ((H-i)/2) * W;
//            s6 = s2 - s5;
            Min = min(min(s1, s5), s6);
            Max = max(max(s1, s5), s6);
            ans = min(ans, Max-Min);
        }
        cout << ans << endl;
    }

}
int main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
//      freopen("output.txt", "w", stdout);
#endif // LOCAL
    init();
    solve();
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <complex>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

// using
using namespace std;

// typedef
typedef long long ll;

// define
#define FOR(i, a, b, c) for (int i = (int)(a); i < (int)(b); i += (int)(c))
#define REP(i, n) FOR(i, 0, n, 1)
#define RFOR(i, a, b, c) for (int i = (int)(a); i >= (int)(b); i -= (int)(c))
#define RREP(i, n) RFOR(i, n, 0, 1)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REVERSE(c) reverse(ALL(c))
#define UNIQ(c) unique(ALL(c))
#define LB(c, x) lower_bound(c.begin(), c.end(), x)
#define UB(c, x) upper_bound(c.begin(), c.end(), x)
#define LI(c, x) distance(c.begin(), LB(c, x))
#define UI(c, x) distance(c.begin(), UB(c, x))

// functions
template <class T> T ceil(T a, T b) {
    return (a + b - 1) / b;
}
template <class T> T round(T a, T b) {
    return (a + b / 2) / b;
}
template <class T> T gcd(T a, T b) {
    return b ? gcd(b, a % b) : a;
}
template <class T> T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}
template <class T> bool amax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> bool amin(T& a, const T& b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

// main
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    double T, A, H;
    cin >> N >> T >> A;
    int res = 0;
    double d = 1e8;
    REP(i, N) {
        cin >> H;
        if (amin(d, abs(A - T + 0.006 * H))) {
            res = i + 1;
        }
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <stdlib.h> //rand() 0~RAND_MAX2147483647
#include <math.h>
#include <time.h>   //srand((unsigned int)time(NULL));
#include <unistd.h> //sleep
#include <algorithm>
#include <cmath>
#include <vector>
#include <regex> //正規表現
#include <map>
#include <unordered_map>
#include <set>
#include <cassert> //assart
#include <numeric>
#include <iterator>
#include <list>

using namespace std;
#define ll long long int
#define FOR(i,min,max) for(int i=(min);i<(max);i++)
#define FOReq(i,min,max) for(int i=(min);i<=(max);i++)
#define FORREV(i,max,min) for(int i=(max)-1;i>=(min);i--)
#define FORREVeq(i,max,min) for(int i=(max);i>=(min);i--)
const int MOD=1e9+7;
const int MOD2=998244353;

const int INF=2000000001;
const ll INFll=2e18;
//const int MAX_V=10000;
const double  Micro=1e-5;

int UnUsedVariable(){
    if(INF || Micro || MOD || INFll || MOD2){;}
    return 0;
}

#define pf printf
#define sf scanf
#define inarray(array,min,max) FOR(i,min,max){cin>>array[i];}
#define inarrayW(arrayA,arrayB,min,max) FOR(i,min,max){cin>>arrayA[i]>>arrayB[i];}
#define br printf("\n");
#define OutputAndReturn0(x) {cout<<(x)<<endl;return 0;}
#define elif else if

#define issame(a,b,c,d) ((a)==(b) and (b)==(c) and (c)==(d))
#define isdiff3(a,b,c) ((a)!=(b) and (b)!=(c) and (c)!=(a))
#define isdiff4(a,b,c,d) ((a)!=(b) and (b)!=(c) and (c)!=(a) and (d)!=(a) and (d)!=(b) and (d)!=(c))
inline int isEven(int x){return x%2==0;}
inline int isOdd (int x){return x%2==1;}
inline ll  gcd(ll a,ll b){ if(b==0)return a;else return gcd(b,a%b);}//最大公約数 なお一方が0なら答えは他方になるので番兵は０で良い また、負の数もOK -4%3=-1となるため
inline ll  lcm(ll a,ll b){return a*b/gcd(a,b);}//MODやオーバーフローには注意！
//inline ll  ceil(double a){return (ll)a+1;}


//Eと名のつくのはデバッグ用！
int EintN(ll array[],const ll num){
    for(int i=0;i<num;i++){cerr<<array[i]<<" ";}
    br;
    return 0;
}
int EintNN(const int heighth,const int width,int array[heighth][width]){
    FOR(i, 0, heighth){
        FOR(k, 0, width){
            {cerr<<array[i][k]<<" ";}
        }
        br;
    }
    br;
    return 0;
}
int Eint(string str,const ll num){
    cerr<<str<<" is "<<num<<" now."<<endl;
    return 0;
}





int prob(){
    ll ans;ans=0;
    string S;
    cin>>S;
    ll zero=0;
    ll one=0;
    FOR(i, 0, S.length()){
        if(S[i]=='0')zero++;
        else one++;
    }
    OutputAndReturn0(2*min(zero,one));
    return 0;
}


signed main(){
    prob();
    return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(v) (v).begin(),(v).end()
#define chmin(x,y) x = min(x,y)
typedef pair<int, int> P;
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
const ll MOD = 1e9+7;

const int MAXN = 50;
int N, M;
vector<int> a(MAXN), b(MAXN);
vector<vector<bool>> graph(MAXN, vector<bool>(MAXN));
vector<bool> visited(MAXN);

void dfs(int v) {
    visited[v] = true;
    rep(v2, N) {
        if (graph[v][v2] == false) continue;
        if (visited[v2] == true) continue;
        dfs(v2);
    }
}

int main() {
	cin >> N >> M;
    rep(i, M) {
        cin >> a[i] >> b[i];
        a[i]--, b[i]--;
        graph[a[i]][b[i]] = graph[b[i]][a[i]] = true;
    }

    int ans = 0;

    rep(i, M) {
        graph[a[i]][b[i]] = graph[b[i]][a[i]] = false;
        rep(j, N) visited[j] = false;
        dfs(0);
        bool bridge = false;
        rep(j, N) if(visited[j] == false) bridge = true;
        if(bridge) ans++;
        graph[a[i]][b[i]] = graph[b[i]][a[i]] = true;
    }

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


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<time.h>
#include<math.h>
#define MAX 100010
#define inf 2000000000
struct card
{
	char suit;
	int value;
};
struct card l[MAX/2+10],r[MAX/2+10];
struct card A[MAX],a[MAX];
int q;
void merge(int left,int mid,int right)
{
	int i,Lstart=1,Rstart=1;
	int n1=mid-left;
	int n2=right-mid;
	for(i=1;i<=n1;i++)
		l[i]=A[left+i-1];
	for(i=1;i<=n2;i++)
		r[i]=A[mid+i-1];
	l[n1+1].value=inf;
	r[n2+1].value=inf;
	for(i=left;i<=right-1;i++)
	{
		
		if(l[Lstart].value<=r[Rstart].value)
		{
			A[i]=l[Lstart];
			Lstart++;
		}
		else
		{
			A[i]=r[Rstart];
			Rstart++;
		}
	}
	return;
}
void mergesort(int left,int right)
{
	if(left+1>=right)
		return;
	int mid=(left+right)/2;
	mergesort(left,mid);
	mergesort(mid,right);
	merge(left,mid,right);
	return;
}
void swap(int g,int y)
{
	struct card t;
	t.value=a[g].value;
	t.suit=a[g].suit;
	a[g].value=a[y].value;
	a[g].suit=a[y].suit;
	a[y].value=t.value;
	a[y].suit=t.suit;
	return;
}
void partition(int p,int r)
{
	int i,j,k;
	struct card x;
	i=p-1;
	j=p;
	x=a[r];
	for(k=p;k<=r-1;k++)
	{
		if(x.value<a[j].value)
			j++;
		else
		{
			i++;
			swap(i,j);
			j++;
		}
	}
	swap(i+1,r);
	q=i+1;
	return;
}
void quicksort(int left,int right)
{
	if(left>=right)
		return;
	partition(left,right);
	quicksort(left,q-1);
	quicksort(q+1,right);
	return;
}
int main()
{
	int n,i,flag=1;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		getchar();
		scanf("%c %d",&A[i].suit,&A[i].value);
		a[i]=A[i];
	}
	mergesort(1,n+1);
	quicksort(1,n);
	for(i=1;i<=n;i++)
		if(A[i].suit!=a[i].suit)
			flag=0;
	if(flag)
		printf("Stable\n");
	else
		printf("Not stable\n");
	for(i=1;i<=n;i++)
		printf("%c %d\n",a[i].suit,a[i].value);
	
	return 0;
}


Measured memory_bytes: 4048