akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;

/**
 * @author MS14A
 * @version 2017/03/21
 */
public class Main {

    /** Input：空白 */
    private static final String DELIMITER = " ";

    /**
     * メインメソッド
     *
     * @param args
     */
    public static void main(String[] args) {
        // ローカルテスト用。提出時は"System.in"に修正。
        InputStream input = System.in;
        // File input = new File("D:/Temp/AOJ/0282_ProgrammingContest.txt");

        try (InputStreamReader inputReader = new InputStreamReader(input);
                BufferedReader bufferedReader = new BufferedReader(inputReader)) {
            int firstLine[] = convertToIntArray(bufferedReader.readLine()
                    .split(DELIMITER));
            int numberOfTeam = firstLine[0];
            int numberOfRecord = firstLine[1];
            int timeOfContest = firstLine[2];

            // インデックスでチームIDを表し、得点・テレビに映った時間をそれぞれ配列で管理。
            int[] scores = new int[numberOfTeam];
            int[] times = new int[numberOfTeam];

            int highScoreTeam = 0;
            int now = 0;
            for (int i = 0; i < numberOfRecord; i++) {
                String line = bufferedReader.readLine();
                int[] record = convertToIntArray(line.split(DELIMITER));

                int teamNum = record[0] - 1;
                int gettingScore = record[2];
                scores[teamNum] += gettingScore;
                times[highScoreTeam] += (record[1] - now);

                if (0 < gettingScore) {
                    if (scores[highScoreTeam] < scores[teamNum]
                            || (scores[highScoreTeam] == scores[teamNum] && teamNum < highScoreTeam)) {
                        highScoreTeam = teamNum;
                    }
                } else if (teamNum == highScoreTeam) {
                    highScoreTeam = 0;
                    for (int j = 0; j < numberOfTeam; j++) {
                        if (scores[highScoreTeam] < scores[j]) {
                            highScoreTeam = j;
                        }
                    }
                }

                now = record[1];
            }

            // 最終処理
            times[highScoreTeam] += (timeOfContest - now);

            System.out.println(gettingResult(times));

        } catch (Exception e) {
            // 対応しない。
            e.printStackTrace();
        }
    }

    private static int[] convertToIntArray(String[] target) {
        int[] result = new int[target.length];

        for (int i = 0; i < target.length; i++) {
            result[i] = Integer.parseInt(target[i]);
        }

        return result;
    }

    private static int gettingResult(int[] times) {
        int result = 0;
        int max = 0;
        for (int i = 0; i < times.length; i++) {
            if (max < times[i]) {
                max = times[i];
                result = i;
            }
        }
        return result + 1;
    }
}

Measured memory_bytes: 97688
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <map>
#define ll long long
const int MOD = 1e9+7;
using namespace std;

int ctoi(char c){
	return c - '0';
}

bool can_make(string s, int p, int q, int r){
	int temp = -1, tempo = -1; 
	for (int i = 0; i < s.length()-2; i++){
		if (ctoi(s[i]) == p){
			temp = i;
			break;
		}
	}
	if (temp == -1) return false;
	for (int i = temp + 1; i < s.length()-1; i++){
		if (ctoi(s[i]) == q){
			tempo = i;
			break;
		}
	}
	if (tempo == -1) return false;
	for (int i = tempo + 1; i < s.length(); i++){
		if (ctoi(s[i]) == r){
			return true;
		}
	}
	return false;
}



int main(){
	int n, ans = 0;
	string s;
	cin >> n >> s;
	for (int i = 0; i <= 9; i++){
		for (int j = 0; j <= 9; j++){
			for (int k = 0; k <= 9; k++){
				if (can_make(s, i, j, k)){
					ans++;
				}
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include<math.h>
using namespace std;

int main() {
	int n; cin >> n;
	int r[n];
	for (int i = 0; i < n; i++) cin >> r[i];
	int minv = r[0], maxv = r[1] - r[0];
	for (int i = 1; i < n; i++) {
		maxv = max(maxv, r[i] - minv);
		minv = min(minv, r[i]);
	}
	cout << maxv << endl;
}


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

using ll = long long;
using ld = long double;
using vi = vector<int>;
using vll = vector<ll>;
using P = pair<int, int>;

const int INF = 1e9;
const ll INFLL = 1e18;
const int MOD = 1e9 + 7;
const int NIL = -1;
const ld PI = acos(-1);

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

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

int main()
{
	ios::sync_with_stdio(false); cin.tie(nullptr);
	//cout << fixed << setprecision(6);
	int n; cin >> n;
	int r = n % 100;
	int l = n / 100;

	bool rIsMonth = false;
	bool lIsMonth = false;

	if(1 <= r && r <= 12) rIsMonth = true;
	if(1 <= l && l <= 12) lIsMonth = true;

	if(rIsMonth && lIsMonth)
		cout << "AMBIGUOUS" << endl;
	else if(!rIsMonth && lIsMonth)
		cout << "MMYY" << endl;
	else if(rIsMonth && !lIsMonth)
		cout << "YYMM" << endl;
	else
		cout << "NA" << endl;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int main(){
  int n;
  cin >>n;
  while(n--){
    double p[3][2],m[2][2],mi[2][2],det,x[2],o[2];
    for(int i=0; i<3; i++) cin >>p[i][0]>>p[i][1];
    for(int i=1; i<3; i++) for(int j=0; j<2; j++) p[i][j]-=p[0][j];
    for(int i=0; i<2; i++) for(int j=0; j<2; j++) m[i][j] = 2*p[1+i][j];
    for(int i=0; i<2; i++) x[i] = p[i+1][0]*p[i+1][0]+p[i+1][1]*p[i+1][1];
    det = m[0][0]*m[1][1]-m[0][1]*m[1][0];
    mi[0][0] = m[1][1]/det;
    mi[0][1] = -m[0][1]/det;
    mi[1][0] = -m[1][0]/det;
    mi[1][1] = m[0][0]/det;
    for(int i=0; i<2; i++) o[i] = mi[i][0]*x[0]+mi[i][1]*x[1];
    printf("%.3lf %.3lf %.3lf\n",o[0]+p[0][0],o[1]+p[0][1],sqrt(o[0]*o[0]+o[1]*o[1]));
  }
  return 0;
}

Measured memory_bytes: 1244
import math
n, a, b=[int(i) for i in input().split()]
ab=a-b
t=[int(input()) for i in range(n)]
mx = sum([i//a +1 for i in t])
mi = 1

while mx - mi > 1:
  i = (mx + mi) // 2
    
  if sum([max(math.ceil((j- i * b) /ab),0) for j in t ]) <= i:
    mx = i
  else:
    mi = i
  
print(mx)

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

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) begin(r),end(r)
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)
#define vvl(v,w,h,init) vector<vector<ll>> v(w,vector<ll>(h,init))
#define mp(a,b) make_pair(a,b)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using pii = pair<int,int> ;
using pll = pair<ll,ll> ;

template<typename T>
void O(T t){
  cout << t << endl;
}

const ll mod = 1e9+7;
constexpr ll inf = ((1<<30)-1)*2+1 ;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0,1,-1,1,-1};
const int dx[] = {0,-1,0,1,1,-1,-1,1};

typedef complex<double> P;//????´???°????????¢?????????????????¨?§£???
namespace std {
  bool operator < (const P& a, const P& b) {//x????????????
    return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
  }
  bool sorty(const P& a, const P& b) {//y????????????
    return imag(a) != imag(b) ? imag(a) < imag(b) : real(a) < real(b);
  }
}
double cross(const P& a, const P& b) {//??????
  return imag(conj(a)*b);
}
double dot(const P& a, const P& b) {//??????
  return real(conj(a)*b);
}

double closestPair_calc(P *p,int n){
  if(n < 2) return inf;
  int m = n/2;
  double x=real(p[m]);
  double d = min(closestPair_calc(p,m),closestPair_calc(p+m,n-m));
  inplace_merge(p,p+m,p+n,sorty);
  vector<P> q;
  double dx,dy;
  rep(i,n) {
    if(abs(real(p[i])-x)>=d)continue;

    for(int j=q.size()-1;j>=0;j--)
    {
      dx=real(p[i])-real(q[j]);
      dy=imag(p[i])-imag(q[j]);
      if(dy>=d)break;
      d=min(d,sqrt(dx*dx+dy*dy));
    }
    q.push_back(p[i]);
  }
  return d;
}

double closestPair(vector<P> &p,int n) {
  if(n < 2) return 0.0;
  sort(all(p));
  double ans = closestPair_calc(&p[0],n);
  return ans == inf ? 0.0 : ans;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n;
  cin >>n;
  double x,y;
  vector<P> ps(n);
  rep(i,n){
    cin >> x >> y;
    ps[i] = P{x,y};
  }
  fcout(10) << closestPair(ps,n) << endl;
  return 0;
}

Measured memory_bytes: 7632
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <list>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <queue>
#define pye cout << "yes" << endl
#define pno cout << "no" << endl
#define pYe cout << "Yes" << endl
#define pNo cout << "No" << endl
#define pYE cout << "YES" << endl
#define pNO cout << "NO" << endl
#define prin(num) cout << num << endl
#define max(a, b) ((a)>(b) ? (a):(b))
#define min(a, b) ((a)<(b) ? (a):(b))
#define INF 1000000000000000000
#define MOD 1000000007LL
#define MAX 100010
#define BLACK 0
#define WHITE 1
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef map<ll, ll> Map;

int main(void) {
    ll a, b, k, i;
    cin >> a >> b >> k;
    
    ll r=0;
    for(i=0; i<k; i++) {
        if(r==0) {
            if(a%2==1) {
                a-=1;
            }
            b+=a/2;
            a/=2;
        }else {
            if(b%2==1) {
                b-=1;
            }
            a+=b/2;
            b/=2;
        }
        r=1-r;
    }
    
    cout << a << " " << b << endl;
    
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a;
  cin>>a;
  vector<double> b(a);
 for(int i=0;i<a;i++){
  cin>>b.at(i);
 }
  sort(b.begin(),b.end());
  double c=b.at(0);
  for(int i=1;i<a;i++){
    c=(c+b.at(i))/2;
  }
  cout<<c;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			// 整数の入力
			long a = sc.nextLong();
			long b = sc.nextLong();
			long c = sc.nextLong();
			long d = sc.nextLong();
			boolean result = true;
			while (true) {
				c = c - b;
				if (c <= 0) {
					break;
				}
				a = a - d;
				if (a <= 0) {
					result = false;
					break;
				}
			}
			System.out.println(result ? "Yes" : "No");
		}
	}

	/**
	 * 最小公倍数
	 */
	static long lcm(long a, long b) {
		long temp;
		long c = a;
		c *= b;
		while ((temp = a % b) != 0) {
			a = b;
			b = temp;
		}
		return c / b;
	}

	/**
	 * 最大公約数
	 */
	static long gcd(long a, long b) {
		long temp;
		while ((temp = a % b) != 0) {
			a = b;
			b = temp;
		}
		return b;
	}
}

Measured memory_bytes: 35792
n = int(input())
x_y_h_list = []
for i in range(n):
  x_y_h_list.append(list(map(int,input().split())))
x_y_h_list.sort(key=lambda x: x[2],reverse = True)
result = []
for x in range(101):
  for y in range(101):
    H = -1
    check = True
    for x_y_h in x_y_h_list:     
      if H == -1:
        H = x_y_h[2] + abs(x_y_h[0] - x) + abs(x_y_h[1] - y)
      else:
        if x_y_h[2] != 0:
          if H != x_y_h[2] + abs(x_y_h[0] - x) + abs(x_y_h[1] - y):
            check = False
            break
        else:
          if H > abs(x_y_h[0] - x) + abs(x_y_h[1] - y):
            check = False
            break
    if check == True:
      print(x,y,H)
     
        
     
   
        


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

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

  int h[n+1];
 for(int i=1;i<=n;i++){cin >> h[i];}

  

  int ans=0;

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

  rep(i,m) {
      int a,b;
      cin >> a >> b;

      if(h[a]>h[b]){
           A[b] +=1;
      }
      else if(h[b] > h[a]){
          A[a] +=1;
      }
      else if(h[b]==h[a]){
          A[a] +=1;
          A[b] += 1;
      }
  }

  for(int i=1;i<=n;i++){
      if(A[i]==0) ans++;
  }

  cout << ans << endl;

  

  



}

Measured memory_bytes: 4364
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;

#define IS_DEBUG true

#define DEBUG_OUTPUT(X) if (IS_DEBUG) cout << X << endl
#define RESULT_OUTPUT(X) cout << X << endl

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

  int tOld, xOld, yOld;
  tOld = xOld = yOld = 0;
  for (int i = 0; i < N; i++)
  {
    int t, x, y;
    cin >> t >> x >> y;
    int distance = abs(x - xOld) + abs(y - yOld);
    int time = t - tOld;
    if (distance > time || (time - distance) % 2 != 0)
    {
      RESULT_OUTPUT("No");
      return 0;
    }
    tOld = t;
    xOld = x;
    yOld = y;
  }
  RESULT_OUTPUT("Yes");
  
  
  if (IS_DEBUG)
  {
    int end;
    cin >> end;
  }
  return 0;
}

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

int main() {
  string s;
  cin >> s;
  int n = s.size();
  int count = 0;
  rep(i,n) {
    if((i%2 == 0 && s.at(i) == '0')||(i%2 == 1 && s.at(i) == '1')) count++;
  }
  cout << min(count, n - count) << endl;
  return 0;
}

Measured memory_bytes: 512
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,copy,time
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(input())
def inpl(): return list(map(int, input().split()))
def inpl_str(): return list(input().split())



N = inp()
MAX = 100005
imos = [0]*MAX
for _ in range(N):
    a,b = inpl()
    imos[a] += 1
    imos[b+1] -= 1

for i in range(1,MAX):
    imos[i] += imos[i-1]

#print(imos[:10])
ans = 0
for i in range(MAX):
    if imos[i] >= i-1:
        ans = max(ans,i-1)
print(ans)



Measured memory_bytes: 11072
def main():
    NAB = list(map(int,input().split()))

    # X = NAB[0]
    # a = 0
    # b = 0
    #
    # while X >= 0:
    #     X -= NAB[1]
    #     a += 1
    #     # print("go")
    #
    #     if X <= 0:
    #         break
    #
    #     X -= NAB[2]
    #     b += 1
    #
    # # print(a)
    # # print(b)
    #
    # if b < 0:
    #     print(NAB[1]*a - abs(X))
    # else:
    #     print(NAB[1]*a)

    b = 0

    tm = NAB[0] // (NAB[1] + NAB[2]) * NAB[1]
    amari = NAB[0] % (NAB[1] + NAB[2])
    tm += min(amari,NAB[1])

    print(tm)

    # if NAB[1] == 0:
    #     b = 0
    # elif NAB[2] == 0:
    #     b = NAB[1]
    #
    # elif NAB[0] < NAB[1]+NAB[2]:
    #     if NAB[0] < NAB[1]:
    #         b = NAB[0]
    #     else:
    #         b = NAB[1]
    #
    # else:
    #     tm = NAB[0]//(NAB[1]+NAB[2])
    #     amari = NAB[0] % (NAB[1]+NAB[2])
    #
    #     # print(tm)
    #     if NAB[1] < amari:
    #         b = (tm*NAB[1])+ NAB[1]
    #     else:
    #         b = (tm*NAB[1])+ amari

    # print(b)



            # cA = NAB[1]
    # cB = NAB[2]
    #
    # for i in range(NAB[0]):
    #
    #     if NAB[1] == 0:
    #         break
    #     if NAB[2] == 0:
    #         b = NAB[1]
    #         break
    #
    #     if cA != 0:
    #         b += 1
    #         cA -= 1
    #     elif cB != 0 and cA == 0:
    #         cB -=1
    #     else:
    #         cA = NAB[1]
    #         cB = NAB[2]
    #
    #         b += 1
    #         cA -= 1




if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
from collections import defaultdict

N = int(input())
a = [int(input()) for i in range(N)]

memo = defaultdict(int)

cnt = 1
current = 1
memo[current] += 1

while True:
    after = a[current-1]
    if after==2:
        print(cnt)
        break
    elif memo[after]==1:
        print(-1)
        break
    else:
        memo[after] += 1
        current = after
        cnt += 1

Measured memory_bytes: 16628
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <vector>
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
using namespace std;

char buf[100000+10];

int main(void) {
  int n;
  cin >> n >> buf;
  int res = 0;
  int last = -1;
  REP(i, n) {
    if(last != buf[i]) {
      ++res;
    }
    last = buf[i];
  }
  cout << res << endl;
  
  return 0;
}


Measured memory_bytes: 1016
#include <algorithm>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PI;
const ll mod = 1e9 + 7;

void fail(void) {
  cout << "No\n";
  exit(0);
}

int main(void) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int h, w;
  cin >> h >> w;
  vector<string> a(h);
  int freq[26] = {};
  REP(i, 0, h) {
    cin >> a[i];
    REP(j, 0, w) {
      freq[a[i][j] - 'a'] += 1;
    }
  }
  int f4 = (h / 2) * (w / 2);
  int f2 = (h / 2) * (w % 2) + (h % 2) * (w / 2);
  int f1 = (h % 2) * (w % 2);
  assert (4 * f4 + 2 * f2 + f1 == h * w);
  REP(i, 0, 26) {
    f4 -= freq[i] / 4;
    freq[i] %= 4;
    f2 -= freq[i] / 2;
    freq[i] %= 2;
    f1 -= freq[i];
  }
  // consistent?
  if (f4 > 0) {
    fail();
  }
  f2 += f4 * 2;
  if (f2 > 0) {
    fail();
  }
  cout << "Yes\n";
}


Measured memory_bytes: 256
import numpy as np
n, m, c = map(int, input().split())
#listを作成
B = list(map(int, input().split()))
count = 0
#Aの値を受け取る
for i in range(n):
    a = list(map(int, input().split()))
    s = np.dot(a, B) + c
    if s > 0:
        count = count + 1
    else:
        pass

print(count)
            

Measured memory_bytes: 12396
import java.util.*;


public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        String s = scan.next();
        String t = scan.next();
        int out = 0;
        for(int i = 0; i < s.length(); i++){
            if(s.charAt(i) != t.charAt(i)) out++;
        }
        System.out.println(out);
        scan.close();
    }
}

Measured memory_bytes: 32044
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <unordered_set>

int main(void) {
    unsigned long inputN = 0;
    unsigned long inputA = 0;
    char output[10] = "YES";
    scanf("%ld", &inputN);
    std::unordered_set<unsigned long> us{0};  
    for (auto i = 0; i < inputN; i++)
    {
        scanf("%ld", &inputA);
        auto result = us.emplace(inputA);
        if(!result.second) {
            strcpy(output, "NO");
        }
        
    }
    
    printf("%s\n", output);
    return 0;
}


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

int main() {
	int D;
cin>>D;
if(D==25){cout<<"Christmas"<<endl;}
else if(D==24){cout<<"Christmas Eve"<<endl;}
else if(D==23){cout<<"Christmas Eve Eve"<<endl;}
else if(D==22){cout<<"Christmas Eve Eve Eve"<<endl;}
	return 0;
}


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

using ll = long long;
using ld = long double;
using pii = pair<int, int>;

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

int dx4[4] = {1,0,-1,0}, dy4[4] = {0,1,0,-1};

ll mod = 1e9+7;
ll dp[100010][13];

int main()
{
    string s;
    cin>>s;
    int n = s.size();
    dp[0][0]=1;
    for (int i = 0; i < n; i++)
    {
        int c;
        if(s[i]=='?') c=-1;
        else c=s[i]-'0';
        for (int k = 0; k < 10; k++)
        {
            if(c!=-1 && c!=k) continue;
            for (int l = 0; l < 13; l++)
            {
                dp[i+1][(l*10+k)%13] += dp[i][l];
                dp[i+1][(l*10+k)%13]%=mod;
            }
        }
    }
    cout<<dp[n][5]<<endl;

    return 0;
}

Measured memory_bytes: 10624
#include<iostream>
#include<vector>
#include<queue>
#include<string>
#include<algorithm>
#include<map>
#include<cmath>
#include<cstring>
#include<iomanip>
#include<set>
using namespace std;

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

int main(){
    int K,X;
    cin >> K >> X;
    for(int i=X-(K-1);i<X+(K-1)+1;i++){
        cout << i << " ";
    }
    cout << endl;
    return 0;
}



Measured memory_bytes: 3164
from collections import Counter

N=int(input())
V=list(map(int,input().split()))

v1=V[::2]
v2=V[1::2]

cntV1,cntV2=Counter(v1),Counter(v2)
cntV1,cntV2=cntV1.most_common(2),cntV2.most_common(2)
cntV1.append((0,0))
cntV2.append((0,0))

if cntV1[0][0]!=cntV2[0][0]:
    ans=N-(cntV1[0][1]+cntV2[0][1])
else:
    ans=max(cntV1[0][1]+cntV2[1][1],cntV1[1][1]+cntV2[0][1])
    ans=N-ans

print(ans)

Measured memory_bytes: 19040
#include<iostream>
#include<string>
#include<vector>

using namespace std;

struct CHANGE{
  char before;
  char after;
};

int main(){
  int i, j, n, m;
  string s, t, str;
  CHANGE change;
  vector<CHANGE> Change;

  while(1){
    cin >> n;
    if(n == 0) break;

    for(i=0; i<n; ++i){
      cin >> s >> t;
      change.before = s[0];
      change.after = t[0];
      Change.push_back(change);
    }

    cin >> m;
    for(i=0; i<m; ++i){
      cin >> s;
      str.push_back(s[0]);
    }

    for(i=0; i<str.size(); ++i){
      for(j=0; j<Change.size(); ++j){
        if(str[i] == Change[j].before){
          str[i] = Change[j].after;
          break;
        }
      }
    }

    cout << str << endl;
    Change.clear();
    str.clear();
  }

  return 0;
}

Measured memory_bytes: 1140
import collections
s = input()
mods = [0]
crt = 0
ans = 0
if len(s) <= 4:
    print(0)
    exit()
# for i in range(len(s)):
#     crt = crt*10+int(s[i])
#     crt %= 2019
#     mods.append(crt)
# print(mods)
for i in range(len(s)-1,-1,-1):
    crt = crt+int(s[i])*pow(10, (len(s)-i-1), 2019)
    crt %= 2019
    mods.append(crt)
#print(mods)
mods_count = collections.Counter(mods)
mods_count = list(mods_count.values())
for i in range(len(mods_count)):
    tar = mods_count[i]
    ans += tar*(tar-1)//2
print(ans)




Measured memory_bytes: 78128
#include <iostream>
using namespace std;
int main (){
int a, b, c;
cin >> a >> b >> c;
if (a < b){
	if (b < c){
		cout << a << " " << b << " " << c << endl;
	}else{
		if (a < c){
			cout << a << " " << c << " " << b << endl;
		}else{
			cout << c << " " << a << " " << b << endl;
		}
	}
}else{
	if (b < c){
		if (a < c){
			cout << b << " " << a << " " << c << endl;
		}else{
			cout << b << " " << c << " " << a << endl;
		}
	}else{
		cout << c << " " << b << " " << a << endl;
	}
}

}



Measured memory_bytes: 3080
#include <stdio.h>
int main()
{
	int n,i,sum=0;
	int a[20];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
	}
	for(i=1;i<n-1;i++)
	{
		if(a[i]>a[i-1]&&a[i]<a[i+1]||a[i]<a[i-1]&&a[i]>a[i+1])
		sum++;
	}
	printf("%d",sum);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,a) for(int i=0;i<int(a);++i)
#define REP(i,a,b) for(int i=int(a);i<int(b);++i)
#define pb push_back
#define mp make_pair
#define F first
#define S second
using ll = long long;
using itn = int;
using namespace std;
static const long double GRATIO=(long double)(1+sqrt(5))/2;
ll GCD(ll a, ll b){
    return b ? GCD(b, a%b) : a;
}
ll LCM(ll a, ll b){
    return a/GCD(a,b)*b;
}
int main(){
    string s;
    cin>>s;
    cout<<s[0]<<s.size()-2<<s[s.size()-1]<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
 class Main {
    public static void main(String args[]) {
        Scanner scanner = new Scanner(System.in);
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        int c = scanner.nextInt();

         if(a<b && b<c){
            System.out.println("Yes");
        }
         else {
             System.out.println("No");
         }
        }
    }


Measured memory_bytes: 26148
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define si(x) scanf("%d",&x)
#define sl(x) scanf("%lld",&x)
#define pi(x) printf("%d",x)
#define pl(x) printf("%lld",x)
#define pb push_back
#define mkp make_pair
#define fi first
#define se second
#define re register
#define rep(i,m,n) for(int i=m;i<=n;i++)
#define per(i,n,m) for(int i=m;i>=n;i--)
#define rrep(i,m,n) for(register int i=m;i<=n;i++)
#define rper(i,n,m) for(register int i=m;i>=n;i--)
const int N = 2e5 + 10;
const ll mod = 1e9 + 7;
ll a[N];
signed main(){
   //ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
   int n;
   si(n);
   ll res=0;
   rep(i,1,n)sl(a[i]);
   rep(i,2,n){
       if(a[i]<a[i-1]){
           res+=a[i-1]-a[i];
           a[i]=a[i-1];
       }
   }
   pl(res);
   return 0;
}

Measured memory_bytes: 5316
n,m,x=map(int,input().split())
ca=[list(map(int,input().split())) for _ in range(n)]
ans=10**9
for i in range(1,2**n):
    a=[0]*m
    price=0
    for j in range(n):
        if i>>j&1:
            for k in range(m):
                a[k]+=ca[j][k+1]
            price+=ca[j][0]
    cnt=0
    for j in range(m):
        if a[j]>=x:
            cnt+=1
    if cnt==m:
        ans=min(ans,price)
if ans==10**9:
    print(-1)
else:
    print(ans)

Measured memory_bytes: 9224
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <climits>
#include <cassert>
using namespace std;

#define REP(i,n) for(int i=0;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define INF INT_MAX/3
#define LINF LLONG_MAX/3
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define ALL(v) (v).begin(),(v).end()

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

int main(){
    int n,m;
    int idx=1;
    while(cin>>n>>m){
        if(n==0 and m==0) break;
//        cout << "case " << idx << endl;
        idx++;
        vi taro(n),hanaoko(m);
        REP(i,n) cin >> taro[i];
        REP(i,m) cin >> hanaoko[i];
        sort(ALL(taro));
        sort(ALL(hanaoko));
        int t_s = 0,h_s=0;
        REP(i,n) t_s+=taro[i];
        REP(i,m) h_s+=hanaoko[i];
        int dif = t_s-h_s;
        if(dif%2!=0){
            cout << -1 << endl;
            continue;
        }


        dif = dif / 2;
//        cout << t_s << ":" << h_s << endl;
        int t=INF,h=INF;
        rep(i,n){
            rep(j,m){
                if(taro[i] == hanaoko[j]+dif){
                    if(t+h>taro[i]+hanaoko[j]){
                        t = taro[i];
                        h = hanaoko[j];
                    }
                }
            }
        }
        if(t==INF and h==INF) cout << -1 << endl;
        else cout << t << " " << h << endl;
    }
}

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

int main(void){
  int n, a;
  int max = INT_MIN, second_max = INT_MIN, max_i = 0;
  cin >> n;
  for(int i = 0; i < n; i++){
    cin >> a;
    if(max < a){
      second_max = max;
      max = a;
      max_i = i;
    } else if(max >= a && second_max < a){
      second_max = a;
    }
  }
  for(int i = 0; i < n; i++){
    if(i == max_i) cout << second_max << endl;
    else cout << max << endl;
  }
  return 0;
}


Measured memory_bytes: 1664
#include <iostream>
#include <vector>
#include <string>
#include <list>
#include <utility>
#include <algorithm>

using namespace std;

typedef long long ll;
typedef vector<ll> vl;
typedef list<ll> listl;
typedef string str;

#define min(A, B) min(static_cast<ll>(A), static_cast<ll>(B))
#define max(A, B) max(static_cast<ll>(A), static_cast<ll>(B))
#define all(x) (x).begin(), (x).end()
#define mp make_pair

#define _rep(i, m)		for(ll i = 0, i_max = m; i < i_max; i++)
#define _erep(i, m)		for(ll i = 0, i_max = m; i <= i_max; i++)
#define _brep(i, b, m)	for(ll i = b, i_max = m; i < i_max; i++)
#define _ebrep(i, b, m)	for(ll i = b, i_max = m; i <= i_max; i++)
#define _rrep(i, m)		for(ll i = m; i >= 0; i--)
#define _rerep(i, b, e)	for(ll i = b; i >= e; i--)

#define rep(m)			_rep(i, m)
#define erep(m)			_erep(i, m)
#define brep(b, m)		_brep(i, b, m)
#define ebrep(b, m)		_ebrep(i, b, m)
#define rrep(m)			_rrep(i, m)
#define rerep(b, e)		_rerep(i, b, e)

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a * b / gcd(a, b); }

void in(ll& I)
{
	cin >> I;
}

void in(vl& I)
{
	for (auto& i : I)
	{
		cin >> i;
	}
}

void in(listl& I)
{
	for (auto& i : I)
	{
		cin >> i;
	}
}

void in(str& s)
{
	cin >> s;
}

void out(ll O)
{
	cout << O;
}

void out(vl& O)
{
	for (auto& o : O)
	{
		cout << o;
	}
}

void rout(bool b, str True, str False)
{
	if (b) cout << True.c_str();
	else cout << False.c_str();
}


int main()
{
	ll N;
	cin >> N;

	ll a = 0;
	ll w = 0;
	ll t = 0;
	ll r = 0;

	for (int i = 0; i < N; i++)
	{
		str buf;
		cin >> buf;

		if (buf == "AC") a++;
		if (buf == "WA") w++;
		if (buf == "TLE") t++;
		if (buf == "RE") r++;
	}

	cout << "AC x " << a << endl;
	cout << "WA x " << w << endl;
	cout << "TLE x " << t << endl;
	cout << "RE x " << r << endl;
}


Measured memory_bytes: 3632
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

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


	string S[3];
	rep(i, 3) cin >> S[i];
	int L[3];
	rep(i, 3) L[i] = S[i].size();

	bool dame[3][3][4020] = {};
	rep(i, 3) rep(j, 3) if (i != j) {
		rep(k, L[i]) {
			rep(x, min(L[i] - k, L[j])) {
				if (S[i][k + x] != '?' && S[j][x] != '?' && S[i][k + x] != S[j][x]) {
					dame[i][j][k] = 1;
					break;
				}
			}
		}
	}

	int P[3] = { 0,1,2 };
	int saishou = 6000;
	rep(x, 6) {
		int i = P[0];
		int j = P[1];
		int k = P[2];

		rep(p, L[i] + 1) {
			int tmp = max(L[i], L[j] + p);
			if (tmp >= saishou) break;
			if (!dame[i][j][p]) {
				rep(q, saishou - L[k] - p) {
					if (!dame[j][k][q] && !dame[i][k][p + q]) {
						saishou = max(tmp, L[k] + p + q);
						break;
					}
				}
			}
		}
		next_permutation(P, P + 3);
	}

	co(saishou);


	Would you please return 0;
}

Measured memory_bytes: 384
N = int(input())
S = input()
dp = [[0]*(N+1) for _ in range(N+1)]
for i in reversed(range(N)):
    for j in reversed(range(N)):
        if S[i] == S[j]:
            dp[i][j] = dp[i+1][j+1] + 1
ans = 0
for i in range(N):
    for j in range(i, N):
        ans = max(min(dp[i][j], j-i), ans)
print(ans)

Measured memory_bytes: 230664
#include <stdio.h>
#include <algorithm>
using namespace std;
int main()
{
	long long n,m,s;
	scanf("%lld %lld",&n,&m);
	if(2*n<=m)
	{
		s=n;
		m=m-2*n;
		s+=m/4;
		printf("%lld\n",s);
	}
	else
		printf("%lld\n",m/2);
}

Measured memory_bytes: 128
# coding: UTF-8
import sys
#sys.setrecursionlimit(n)
import heapq
import re
import bisect
import random
import math
import itertools
from collections import defaultdict, deque
from copy import deepcopy
from decimal import *

readl= lambda: list(map(int, sys.stdin.readline().split()))
readt= lambda: tuple(map(int, sys.stdin.readline().split()))
read = lambda: sys.stdin.readline().rstrip()
readi = lambda: int(read())
readmi = lambda: map(int, sys.stdin.readline().split())
readms = lambda: map(str, sys.stdin.readline().split())

h = []
n = readi()
t = readl()
index = 1
for i in t:
    heapq.heappush(h, (i, index))
    index += 1
for i in range(n):
    p1, p2 = heapq.heappop(h)
    print(p2,end=" ")


Measured memory_bytes: 22420
#include<iostream>
#include<string>

using namespace std;

int main(){
	string s1;
	int k[10][10];
	while(cin>>s1){
		
		for(int i=0;i<10;i++)k[0][i]=s1[i]-'0';
		for(int i=1;i<10;i++){
			for(int j=0;j<10-i;j++){
				k[i][j]=(k[i-1][j]+k[i-1][j+1])%10;
				//cout<<k[i][j]<<i<<j;
			}
			//cout<<endl;
		}
		cout<<k[9][0]<<endl;
		
	}

}

Measured memory_bytes: 1180
package main

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

func solve() {
	n := getInt()
	as := getIntSlice(n)
	m := max(as...)

	c1, c2 := m/2, (m+1)/2
	minDist := inf
	ans := []int{m, 0}
	for _, a := range as {
		if m <= a {
			continue
		}

		d := min(abs(a-c1), abs(a-c2))
		if d < minDist {
			ans[1] = a
			minDist = d
		}
	}

	fmt.Fprintln(wr, ans[0], ans[1])
}

func max(ns ...int) int {
	max := ns[0]
	for i := 1; i < len(ns); i++ {
		if max < ns[i] {
			max = ns[i]
		}
	}
	return max
}

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

func abs(n int) int {
	if n < 0 {
		return -n
	}
	return n
}

// -----------------------------------------

const (
	inf = 1 << 60
	// mod = 1000000007
)

var (
	sc = bufio.NewScanner(os.Stdin)
	wr = bufio.NewWriter(os.Stdout)
)

func main() {
	maxBufSize := int(1e8)
	sc.Buffer(make([]byte, 4096), maxBufSize)
	sc.Split(bufio.ScanWords)
	solve()
	wr.Flush()
}

func getInt() (ret int) {
	sc.Scan()
	ret, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return
}

func getIntSlice(n int) (ret []int) {
	ret = make([]int, n)
	for i := range ret {
		ret[i] = getInt()
	}
	return
}

func getString() (ret string) {
	sc.Scan()
	ret = sc.Text()
	return
}

func getRunes() (ret []rune) {
	ret = []rune(getString())
	return
}


Measured memory_bytes: 3072
using System;
using System.Collections.Generic;
using System.Linq;
using static Input;
using static Prog;
using NX = System.Int64;

public class Solver
{
    public void Solve()
    {
        int N = NextInt();
        int R = NextInt();
        int ans = R;
        if (N < 10) {
            ans += 100 * (10 - N);
        }
        Console.WriteLine(ans);
    }
}

public class Prog
{
    public const long MOD = 1000000007;
    public const int INF = 1000000007;
    public struct Pair { public int x, y; public Pair(int a, int b) { x = a; y = b; } }
    static void Main()
    {
        var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        Console.SetOut(sw);
        new Solver().Solve();
        Console.Out.Flush();
        return;
    }
}

public class Input
{
    private static Queue<string> q = new Queue<string>();
    private static void Confirm() { if (q.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) q.Enqueue(s); }
    public static int NextInt() { Confirm(); return int.Parse(q.Dequeue()); }
    public static long NextLong() { Confirm(); return long.Parse(q.Dequeue()); }
    public static string NextString() { Confirm(); return q.Dequeue(); }
    public static double NextDouble() { Confirm(); return double.Parse(q.Dequeue()); }
    public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); }
    public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
    public long Abs(long a, long b) => Math.Abs(a - b);
}


Measured memory_bytes: 27836
package main

import "fmt"

func main() {
	var length, max, sumTop, sumBottom int
	fmt.Scan(&length)

	top := make([]int, length)
	bottom := make([]int, length)

	for i := 0; i < length; i++ {
		fmt.Scan(&top[i])
	}
	for i := 0; i < length; i++ {
		fmt.Scan(&bottom[i])
	}

	for i := 0; i < length; i++ {
		sumTop += top[i]
		sumBottom = 0
		for j := i; j < length; j++ {
			sumBottom += bottom[j]
		}
		if max < sumTop+sumBottom {
			max = sumTop + sumBottom
		}
	}

	fmt.Print(max)
}


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

bool check(vector<P> s) {
  int h = 0;
  for (P p : s) {
    int b = h+p.first;
    if (b < 0) return false;
    h += p.second;
  }
  return true;
}

int main() {
  int n;
  cin >> n;
  vector<P> ls, rs;
  int total = 0;
  rep(i,n) {
    string s;
    cin >> s;
    int h = 0, b = 0;
    for (char c : s) {
      if (c == '(') ++h; else --h;
      b = min(b, h);
    }
    if (h > 0) ls.emplace_back(b, h);
    else rs.emplace_back(b-h, -h);
    total += h;
  }
  sort(ls.rbegin(), ls.rend());
  sort(rs.rbegin(), rs.rend());
  if (check(ls) && check(rs) && total == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 18892
import bisect,collections,copy,heapq,itertools,math,string
import sys
def S(): return sys.stdin.readline().rstrip()
def M(): return map(int,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
N = I()
ans = 0
for i in range(N, 1000):
    s = str(i)
    if s[0] == s[1] == s[2]:
        ans = i
        break
print(ans)

Measured memory_bytes: 74440
def inner(i, j):
    return 0 <= i and i < H and 0 <= j and j < W

def ok(s):
    for i in range(H):
         for j in range(W):
             if s[i][j] == '#':
                 if inner(i-1, j) and s[i-1][j] == '#':
                     continue
                 if inner(i+1, j) and s[i+1][j] == '#':
                     continue
                 if inner(i, j-1) and s[i][j-1] == '#':
                     continue
                 if inner(i, j+1) and s[i][j+1] == '#':
                     continue
                 return 'No'
    return 'Yes'


H, W = map(int, input().split())
s = []
for i in range(H):
    s.append(input())
print(ok(s))

Measured memory_bytes: 3064
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define max0(a,b,c) max(max(a,b),c)
#define min0(a,b,c) min(min(a,b),c)
#define ft first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define all(v) (v).begin(),(v).end()
#define mod 1000000007
using namespace std;
using Graph = vector<vector<int>>;
typedef long long lint;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ldouble;
typedef vector<int> vec;
typedef vector<ll> lvec;
typedef vector<ull> ulvec;
typedef vector<pair<int,int>> pvec;
typedef vector<pair<ll,ll>> plvec;
typedef vector<tuple<ll,ll,ll>> tvec;
typedef vector<string> svec;

int main(){
    int a,b,k;
    cin>>a>>b>>k;
    priority_queue<int> que;
    for(int i=1;i<=min(a,b);i++){
        if(a%i==0&&b%i==0) que.push(i);
    }
    while(k>1){
        que.pop();
        k--;
    }
    cout<<que.top();
}

Measured memory_bytes: 256
def main():
    N, M = map(int, input().split())
    L = []
    R = []
    for i in range(M):
        l, r = map(int, input().split())
        L.append(l)
        R.append(r)
    lmax = max(L)
    rmin = min(R)
    if rmin - lmax + 1 <= 0:
        ans = 0
    else:
        ans = rmin - lmax + 1
    print(int(ans))


main()


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

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



Measured memory_bytes: 3968
import sys
import os


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = int(sys.stdin.readline().rstrip())
    ret = 'No'
    for i in range(10):
        if i == 0:
            continue

        q, mod = divmod(N, i)
        if q < 10 and mod == 0:
            ret = 'Yes'
            
    print(ret)

if __name__ == '__main__':
    main()

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

int main()
{
	int a, b;
	unsigned long int c;
	cin >> a >> b;
	std::vector<unsigned int> vec(a);
	for (int i = 0; i < a; i++) {
		cin >> vec.at(i);
	}
	sort(vec.begin(), vec.end());
	c = 0;
	for (int i = 0; i < a - b; i++) {
		c = c + vec[i];
	}
	cout << c;
	return 0;
}

Measured memory_bytes: 1024
using System;


    class Program
    {
        static void Main(string[] args)
        {
            string[] x = Console.ReadLine().Split(' ');
            int length = int.Parse(x[0]);
            int side = int.Parse(x[1]);

            int rectangleArea = length * side;
            int circumference = 2 * (length + side);

            Console.WriteLine(rectangleArea + " " + circumference);
        }
    }




Measured memory_bytes: 9088
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
from functools import reduce

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7


s = collections.Counter(rr())
print(min(s['0'], s['1']) * 2)















Measured memory_bytes: 27368
#include <bits/stdc++.h>
#define pb push_back
#define ff first
#define ss second
using namespace std;
using ll = long long;
using vi = vector<int>;
using pii = pair<ll, ll>;
int x[105];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++)
    cin >> x[i];
  int mn = 1e9;
  for (int i = 1; i <= 100; i++) {
    int tmp = 0;
    for (int j = 0; j < n; j++)
      tmp += (x[j] - i) * (x[j] - i);
    // cout << i << ' ' << tmp << endl;
    mn = min(mn, tmp);
  }
  cout << mn << endl;
}

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

//repetition
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

//const value
//const ll MOD = 1e9 + 7;
//const int dx[] = {0,1,0,-1};//{0,0,1,1,1,-1,-1,-1};
//const int dy[] = {1,0,-1,0};//{1,-1,0,1,-1,0,1,-1};

//conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
inline ll toLL(string s) {ll v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s;
  cin >> s;
  string fi = s.substr(0,2);
  string se = s.substr(2,2);
  bool fflag = false;
  bool sflag = false;
  //cerr << toInt(fi) << ' ' << toInt(se) << endl;
  if(toInt(fi) <= 12 && toInt(fi) >= 1) fflag = true;
  if(toInt(se) <= 12 && toInt(se) >= 1) sflag = true;

  if(fflag && sflag) cout << "AMBIGUOUS" << endl;
  else if(fflag) cout << "MMYY" << endl;
  else if(sflag) cout << "YYMM" << endl;
  else cout << "NA" << endl;

  return 0;
}


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


#define ff                first
#define ss                second
#define int               long long
#define pb                push_back
#define mp                make_pair
#define pii               pair<int,int>
#define vi                vector<int>
#define mii               map<int,int>
#define pqb               priority_queue<int>
#define pqs               priority_queue<int,vi,greater<int> >
#define setbits(x)        __builtin_popcountll(x)
#define zrobits(x)        __builtin_ctzll(x)
#define mod               1000000007   //10^9 + 7
#define inf               1e18
#define ps(x,y)           fixed<<setprecision(y)<<x
#define mk(arr,n,type)    type*arr = new type[n]
#define w(x)              int x;cin>>x;while(x--)
#define ti(n)             int n;cin>>n
#define rep(i,n)          for(int i=0;i<(n);++i)
#define repA(i,a,n)       for(int i=a;i<=(n);++i)
#define repD(i,a,n)       for(int i=a;i>=(n);--i)
#define itr(type,it,x)    for(type it = x.begin();it!=x.end();it++)
#define endl              "\n"
mt19937                  rng(chrono::steady_clock::now().time_since_epoch().count());  // to shuffle an array randomly viz. shuffle(arr,arr+n,rng)

//typedef tree<int , null_type , less<int> , rb_tree_tag, tree_order_statistics_node_update> pbds;  //policy based data structure


void c_p_c() {

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



}
//PROBLEM - FROG 1 & FROG 2 - ATCODER DP CONTEST

int minCostFrog1(vector<int> h, int n)
{

	vector<int> dp(n + 1);

	dp[1] = 0;

	for (int i = 2; i <= n; ++i)
	{
		int op1 = abs(h[i] - h[i - 1]) + dp[i - 1];
		int op2 = (i == 2) ? inf : abs(h[i] - h[i - 2]) + dp[i - 2];

		dp[i] = min(op1, op2);
	}

	return dp[n];
}



int minCostFrog2(vector<int> h, int n, int k)
{

	vector<int> dp(n + 1);
	dp[1] = 0;

	for (int i = 2; i <= n; ++i)
	{

		dp[i] = inf;
		for (int j = i - 1; j >= (i - k) && j >= 1; --j)
		{
			dp[i] = min(dp[i], abs(h[i] - h[j]) + dp[j]);
		}
	}

	return dp[n];
}

int32_t main(int32_t argc, char const *argv[]) {

	c_p_c();



	int n; cin >> n;
	int k; cin >> k;
	vector<int> h(n + 1);
	for (int i = 1; i <= n; ++i)
	{

		cin >> h[i];
	}

	//cout << minCostFrog1(h, n) << endl;
	cout << minCostFrog2(h, n, k) << endl;

	return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using i64 = long long;

long long *fact, *inv;

template <class T>
T pow(T x, T n, T mod) {
    T ret = 1;
    while(n > 0) {
        if ((n & 1) == 1) ret = (ret * x) % mod;
        x = (x * x) % mod;
        n >>= 1;
    }
    return ret;
}

template <class T>
T inverse(T x, T p) { return pow(x, p - 2, p); }

void init_factorial(int n, long long mod) {
    fact = new long long[n + 1];
    inv = new long long[n + 1];
    fact[0] = 1;
    for (long long i = 1; i <= n; i++) fact[i] = fact[i - 1] * i % mod;
    inv[n] = inverse(fact[n], mod);
    for (long long i = n; i > 0; i--) inv[i - 1] = inv[i] * i % mod;
}

int main() {
    constexpr i64 mod = 1000000007;
    i64 n, k;
    std::cin >> n >> k;
    init_factorial(2020, mod);

    auto getr = [&](i64 c) {
        if (c > n - k || c < 1) return 0ll;
        return fact[n - k - 1] * inv[c - 1] % mod * inv[n - k - c] % mod;
    };
    for (int i = 1; i <= k; i++) {
        i64 b = fact[k - 1] * inv[k - i] % mod * inv[i - 1] % mod;
        i64 r = (getr(i) * 2 % mod + getr(i - 1) + getr(i + 1)) % mod;
        std::cout << (n == k && i == 1 ? 1 : b * r % mod) << std::endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define all(x) (x.begin()),(x.end())
#define sz(x)  ((ll)x.size())
#define FAST_IO ios_base :: sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr);
using namespace std;
#ifdef LOCAL
#include "uj.h"
#endif
void tokenize(string str,const char delim,vector<string> & res){
	stringstream p(str);
	string token;
	while(getline(p,token,delim)){
		res.push_back(token);
	}
	return;
}

// Your workSpace ...
int N;
void test_case(){
	cin>>N;
	cout<<N+(N*N)+(N*N*N);
}	





int main(){
	FAST_IO;
	int tt;
	//cin>>tt;
	tt = 1;
	while(tt--){
		test_case();
	}
#ifndef ONLINE_JUDGE
 	cerr << "Running Time: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}


Measured memory_bytes: 3616