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

public class Main {
    private static Scanner sc = new Scanner(System.in);
    private static boolean[][] ary;
    private static boolean[][] b;
    public static void main(String[] args) throws Exception {
        while (sc.hasNext()) {
            ary = new boolean[12][12];
            b = new boolean[12][12];
            solve();
        }
    }
    
    private static void solve() {
        for (int i = 0;i < 12;i++) {
            String s = sc.next();
            for (int j = 0;j < 12;j++) {
                if (s.charAt(j)=='1') {
                    ary[i][j] = true;
                }
            }
        }
        
        int ans = 0;
        for (int i = 0;i < 12;i++) {
            for (int j = 0;j < 12;j++) {
                if (ary[i][j]&&!b[i][j]) {
                    move(i,j);
                    ans++;
                }
            }
        }
        
        System.out.println(ans);
    }
    
    private static void move(int x, int y) {
        int[] dx = {0, 1, 0, -1};
        int[] dy = {1, 0, -1, 0};
        
        b[x][y] = true;
        
        for (int i = 0;i < 4;i++) {
            int nx = x + dx[i];
            int ny = y + dy[i];
            if (range(nx,ny)) {
                if (ary[nx][ny]&&!b[nx][ny]) {
                    move(nx, ny);
                }
            }
        }
    }
    
    private static boolean range(int x, int y) {
        return 0<=x&&x<12&&0<=y&&y<12;
    }
}

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

int main(){
  string s;
  char c1,c2,c3,c4;
  cin >> s;
  c1 = s.at(0);
  c2 = s.at(1);
  c3 = s.at(2);
  c4 = s.at(3);
  
  bool flag = 0;
  
  if(c1 == c2 && c3 == c4) flag = 1;
  if(c1 == c3 && c2 == c4) flag = 1;
  if(c1 == c4 && c3 == c2) flag = 1;
  
  if(c1 == c2 && c1 == c3 && c1 == c4) flag = 0;
 
  if(flag){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

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

char s1[2000];
char s2[2000];
//int answer[100][100];

int LCS(int,int);

int main(){

  int sumstring;
  int i,j,k;
  scanf("%d",&sumstring);

  for(i = 0; i < sumstring; i++){

    
    scanf("%s",s1);
    scanf("%s",s2);
    // strcat(empty,s1);
    // strcat(empty,s2);
    // sprintf(s1,"%c%s",empty,s1);
    //sprintf(s2,"%c%s",empty,s2);
    //    printf("%c\n",s1[0]);
    // printf("%s\n",s2);

    // printf("%c*%c:%c\n",s1[0],s1[1],s1[2]);
    // printf("%c*%c:%c\n",s2[0],s2[1],s2[2]);

    printf("%d\n",LCS(strlen(s1),strlen(s2)));
  }

  /*  for(i = 0; i < sumstring; i++){

        printf("%d\n",ans[i]);

	}*/

  return 0;
}

int LCS(int length1, int length2){

  int i,j,x;
  int answer[1001][1001];

  x = 0;

  for(i = 0; i < length1; i++){

    answer[i][0] = 0;

  }

  for(i = 0; i < length2; i++){

    answer[0][i] = 0;

  }


  for(i = 0; i < length1; i++){

    for(j = 0; j < length2; j++){

      if(s1[i]==s2[j] && s1[i]!=' ' && s2[i] != ' '){

	if(i == 0 || j == 0){

	  answer[i][j] = 1;
     
	}
	else{
	  //	printf("%c:::%c\n",s1[0],s2[0]);
	answer[i][j] = answer[i-1][j-1]+1  ;
	
	
	}
      }


      else{


	if(i == 0 && j != 0){
	  answer[i][j] = answer[0][j-1];
	}
	
	else if(i !=0 && j == 0){

	  answer[i][j] = answer[i-1][0];

	}

	else if(i == 0 && j == 0){

	  answer[0][0] = 0;

	}

	else if(i != 0 && answer[i-1][j] > answer[i][j-1]){

	  //  printf("**%d::\n",answer[i-1][j]);
	  answer[i][j] = answer[i-1][j];
	  
	}

	else if(answer[i-1][j] <= answer[i][j-1]){

	  answer[i][j] = answer[i][j-1];

	}
	
      }
    }
  }

  return answer[length1-1][length2-1];


  /* for(i = 0; i < length1; i++){

    for(j = 0; j < length2; j++){

      //printf("%d\n",length2);
      //      printf("%d:%d:%d\n",i,j,answer[i][j]);
      if(x < answer[i][j]){

	x = answer[i][j];

      }

    }

  }

  return x;

  */
}
	
	

Measured memory_bytes: 4516
#include "bits/stdc++.h"
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(s) s.begin(), s.end()
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const int MX = 100005, INF = 1001001001;
const ll LINF = 1e18;
const double eps = 1e-10;
const ll mod = 1e9+7;

int a,b,c;

int main()
{
    cin >> a >> b >> c;
    if(a == b){
        if(b == c) cout << 1 << endl;
        else cout << 2 << endl;
        return 0;
    }
    if(b == c){
        if(b == a) cout << 1 << endl;
        else cout << 2 << endl;
        return 0;
    }
    if(c == a){
        if(b == a) cout << 1 << endl;
        else cout << 2 << endl;
        return 0;
    }
    cout << 3 << endl;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var N int
	fmt.Scan(&N)

	inputs := scanNums(N)
	var res float64 = 0
	for _, v := range inputs {
		res += 1 / v
	}

	fmt.Println(1 / res)

}

func scanNums(len int) (nums []float64) {
	var num float64
	for i := 0; i < len; i++ {
		fmt.Scan(&num)
		nums = append(nums, float64(num))
	}
	return
}


Measured memory_bytes: 512
#include <stdio.h>
int N, M, L, R, s[50003], t[50003], e[50003], c[10003]; long long d[10003];
int main() {
	scanf("%d%d", &N, &M);
	while(true) {
		scanf("%d%d%d", s + R, t + R, e + R); s[R]--, t[R]--;
		if (!e[R]) break; R++;
	}
	scanf("%d", &L);
	for (int i = 0; i < L; i++) {
		for (int j = 0; j < M; j++) scanf("%d", &c[j]);
		for (int j = 0; j < N; j++) d[j] = 0;
		for (int j = 0; j < R; j++) d[s[j]] += c[t[j]] * e[j];
		for (int j = 0; j < N; j++) printf(j ? " %d" : "%d", d[j]);
		printf("\n");
	}
}

Measured memory_bytes: 3364
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<map>
#include <algorithm>
#include<cstdlib>
#include<cmath>
#include<deque>
#include <numeric>
typedef long long ll;
// typedef std::pair<ll, ll> pair_ll;
int main() {
	
	ll t , x;
	
	std::cin >> t >> x;

	double out = (double)t / x;
	std::cout << out << std::endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h> //C++の標準ライブラリを一行で一括でインクルードする
#include <math.h> //数学関数と数学定数を利用する
#define rep(i,n) for (int i = 0; i < (n); i++)
#define PI 3.141592653589793
using namespace std;
typedef long long ll;
template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}
int gcd(int a, int b){//ユークリッドの互除法
  if (a < b) gcd(b,a); //aの方がbよりでかいのが前提
  if (b == 0) return a; //aをbで割り切れたらreturn
  else gcd(b, a % b);
}
const int INF = 1<<30;
const int MOD = 1000000007;
int dx[4] = {0,0,-1,1};
int dy[4] = {-1,1,0,0};

int main(){
  string s; cin >> s;
  int t = s.size();
  
  int ans = 0;
  rep(i,t/2){
    if(s[i] != s[t-1-i]) ans++;
  }
  
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 256
import std.functional,
       std.algorithm,
       std.container,
       std.typetuple,
       std.typecons,
       std.bigint,
       std.string,
       std.traits,
       std.array,
       std.range,
       std.stdio,
       std.conv;

void main() {
  string s = readln.chomp;
  int K = readln.chomp.to!int;
  int[string] h;

  foreach (i; 0..s.length+1) {
    foreach (j; i+1..s.length+1) {
      string sub = s[i..j];
      if (sub.length <= K) {
        h[sub] = 0;
      }
    }
  }

  string[] subs = h.keys;
  subs.sort!"a<b";
  writeln(subs[K - 1]);
}


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

int main() {
	string s;
	cin >> s;
	int n = 0;
	for (char c : s) {
		n = (n + (c - '0')) % 9;
	}
	string res = n == 0 ? "Yes" : "No";
	cout << res;
}


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

const int MAX_N = 86;

long long int luca[MAX_N + 3];

int main()
{
    int N;
    cin >> N;
    luca[0] = 2;
    luca[1] = 1;
    for (int i = 2; i <= N; i++)
    {
        luca[i] = luca[i - 1] + luca[i - 2];
    }
    cout << luca[N] << endl;
}


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

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

	int a = 0;
	int w = 0;
	int t = 0;
	int r = 0;

	for (int i = 0; i < n; ++i) {
		string s;
		cin >> s;
		if (s[0] == 'A') {
			++a;
		}else if (s[0] == 'W') {
			++w;
		}
		else if (s[0] == 'T') {
			++t;
		}
		else {
			++r;
		}
	}

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

	return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

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

    int cnt = 0;
    while (a != b || b != c) {
        for (int i = 0; i < 2; i++) {
            if (a == min({a, b, c})) a++;
            else if (b == min({a, b, c})) b++;
            else c++;
        }
        cnt++;
    }
    cout << cnt << endl;
    return 0;
}

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

#define rep(N,i) for(int i = 0; i < N; i++)
#define rrep(N,i) for(int i = N - 1; 0 <= i; i--)
#define all(a) a.begin(),a.end()
#define int long long

using namespace std;

int N;
int A[101010];

signed main(){
  cin >> N;
  rep(N, i) cin >> A[i];

  int oddCnt = 0;
  rep(N, i) if(A[i] % 2 == 1) oddCnt++;

  cout << (oddCnt % 2 == 0 ? "YES" : "NO") << endl;
    
  return 0;
}


Measured memory_bytes: 1024
import java.io.*;
import java.math.BigDecimal;
import java.util.Scanner;

/**
 * Created by xs on 8/18/2016.
 */
public class Main{
    public static void main(String[] args){
       // System.out.println("Hello World!");
        BigDecimal pi=new BigDecimal ("3.141592653589793238462643383279502884197169399375105820974944592307816406286");
        Scanner cin = new Scanner(new BufferedInputStream(System.in));
        while(cin.hasNext()){
            BigDecimal num=cin.nextBigDecimal();
            System.out.println(pi.multiply((num.multiply(num))).toPlainString() +' '+pi.multiply(num.multiply(new BigDecimal("2"))).toPlainString());
        }


    }
}

Measured memory_bytes: 28096
let content = '';
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', buf => {
  content += buf;
});
process.stdin.on('end', () => {
  const [, line] = content.trim().split('\n');
  console.log(line.split(' ').reverse().join(' '));
});



Measured memory_bytes: 15276
/*
	Name: B +/- A
	Author: TonyWu
	Date: 23/02/19 20:06
*/
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b;
	cin>>a>>b;
	if(b%a==0) cout<<a+b<<endl;
	else cout<<b-a<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(long long i=0; i<(n); i++)
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }


int main(){
    ll n; cin>>n;
    vector<ll> p(n);
    rep(i,n) cin>>p[i];
    ll res=0;
    for(ll i=1; i<n-1; i++){
        if(p[i-1]<p[i] && p[i]<p[i+1]) res++;
        else if(p[i-1]>p[i] && p[i]>p[i+1]) res++;
    }
    cout<<res<<endl;
    return 0;
}

Measured memory_bytes: 256
# coding: utf-8
# Your code here!

import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline #文字列入力のときは注意

#n = int(input())
x,y = [int(i) for i in readline().split()]

if abs(x-y) <= 1:
    print("Brown")
else:
    print("Alice")

"""
n = 50
dp = [[0]*n for i in range(n)]

dp[1][1] = -1 

def dfs(i,j):
    if dp[i][j] != 0: return dp[i][j]
    for k in range(1,i//2+1):
        if dfs(i-2*k,j+k) == -1:
            dp[i][j] = 1
            return 1
    for k in range(1,j//2+1):
        if dfs(i+k,j-2*k) == -1:
            dp[i][j] = 1
            return 1
    dp[i][j] = -1
    return -1
        
for i in range(10):
    for j in range(10):
        dfs(i,j)


print(*dp, sep="\n")
"""

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

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

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

    vector<long long int> sa(n+1);
    for(int i=0; i<n; i++){
        sa[i+1] = sa[i] + a[i];
    }

    vector<long long int> b;
    for(int i=0; i<=n; i++){
        for(int j=i+1; j<=n; j++){
            b.push_back(sa[j] - sa[i]);
        }
    }

    vector<long long int> c;
    bool flag = false;
    long long int ans = 0;
    for(int i=40; i>=0; i--){// 10^12 < 2^40
        vector<long long int> d;
        if(flag == false){
            for(long long int bb : b){
                if(bb >> i & 1) d.push_back(bb);
            }
            if((int)d.size() >= k){
                ans += (1LL << i);
                c = d;
                flag = true;
            }
        }
        else{
            for(long long int cc : c){
                if(cc >> i & 1) d.push_back(cc);
            }
            if((int)d.size() >= k){
                ans += (1LL << i);
                c = d;
            }
        }
        //cout << i << " : ";
        //for(long long int cc : c) cout << cc << " ";
        //cout << endl;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 8900
import warnings


number = input()

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

num_max = array[0]

num_min = array[0]

data_sum = 0

#print len(array)

for i in range(len(array)):
	
	data_sum = data_sum + array[i]

	if array[i] < num_min: 
		num_min = array[i]
	
	if array[i] > num_max:
		num_max = array[i]

print num_min, num_max, data_sum

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

int main() {
    string str1, str2;
    cin >> str1;
    int n = str1.size();
    str2 = str1;
    reverse(str2.begin(), str2.end());
    if(str1 == str2){
        string str3, str4;
        str3 = str1.substr(0, (n-1)/2);
        str4 = str3;
        reverse(str4.begin(), str4.end());
        if(str3 == str4){
            string str5, str6;
            str5 = str1.substr((n+3)/2-1);
            // cout << str5 << " " << str6 << endl;
            str6 = str5;
            reverse(str6.begin(), str6.end());
            if(str5 == str6) cout << "Yes" << endl;
            else cout << "No" << endl;

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
constexpr array<int, 4> dx = {1, 0, -1, 0};
constexpr array<int, 4> dy = {0, 1, 0, -1};
constexpr int MOD = 1000000000 + 7;
// constexpr int MOD = 998244353;
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;
}
constexpr int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int factorial(int n, int m = 2)
{
    m = max(2LL, m);
    int rtn = 1;
    for (int i = m; i <= n; i++)
    {
        rtn = (rtn * i) % MOD;
    }
    return rtn;
}
long long modinv(long long a, long long m)
{
    long long b = m, u = 1, v = 0;
    while (b)
    {
        long long t = a / b;
        a -= t * b;
        swap(a, b);
        u -= t * v;
        swap(u, v);
    }
    u %= m;
    if (u < 0)
        u += m;
    return u;
}
int modpow(int a, int n)
{
    int res = 1;
    while (n > 0)
    {
        if (n & 1)
            res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

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

    int x, y;
    cin >> x >> y;

    if ((x + y) % 3 != 0)
    {
        cout << 0 << endl;
    }
    else
    {
        const int a = (2 * x - y) / 3; // (i+1,j+2)へ移動
        const int b = (2 * y - x) / 3; //

        if (a >= 0 && b >= 0)
        {
            const int ans = factorial(a + b) * modinv(factorial(a), MOD) % MOD * modinv(factorial(b), MOD) % MOD;

            cout << ans << endl;
        }
        else
            cout << 0 << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/range/irange.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/algorithm_ext.hpp>
#include <boost/math/common_factor_rt.hpp>
using namespace std;
using namespace boost::range;
using boost::irange;
using boost::math::gcd;
using boost::math::lcm;

using ll = int64_t;
constexpr char LN = '\n';
template<class T> bool chmax(T& a, const T& b) {if(a<b){a=b;return true;}else{return false;}}
template<class T> bool chmin(T& a, const T& b) {if(b<a){a=b;return true;}else{return false;}}

#ifdef LOCAL
template<class H> void dump_(const char* s, H h) {cout<<s<<"="<<h<<LN; }
template<class H, class... T> void dump_(const char* s, H h, T... t) {for(;*s!=',';++s){cout<<*s;}cout<<"="<<h<<",";dump_(++s,t...);}
#define dump(...) dump_(#__VA_ARGS__, __VA_ARGS__)
#else
#define dump(...)
#endif

struct init_ {init_(){cin.tie(nullptr);ios::sync_with_stdio(false);}} init_;

template<class C> C scan(size_t n) {C c(n);for(auto& v:c){cin>>v;}return c;}
template<class C> C scan(size_t n, size_t m) {C vss(n);for(auto& vs:vss){vs.resize(m);for(auto& v:vs){cin>>v;}}return vss;}

template<class R> struct Joined { const R& r; const char* s; };
template<class R> Joined<R> joined(const R& r, const char* s = " ") {return{r,s};}
template<class R> ostream& operator<<(ostream& out, Joined<R> j) {bool f=true;for(const auto& v:j.r){if(f){f=false;}else{out<<j.s;}out<<v;}return out;}

template<class T> using matrix = vector<vector<T>>;
template<class T> matrix<T> make_matrix(size_t n, size_t m, const T& init = T()) {matrix<T> vss(n);for(auto& vs:vss){vs.resize(m,init);}return vss;}
template<class T> ostream& operator<<(ostream& out, Joined<matrix<T>> j) {bool a=true;for(const auto& vs:j.r){if(a){a=false;}else{out<<LN;}bool f=true;for(const auto& v:vs){if(f){f=false;}else{out<<j.s;}out << v;}}return out;}

template<class T> void show_(const T& t) {cout<<t;}
template<class T> void show_(const vector<T>& v) {cout<<joined(v);}
void show_(bool b) {cout<<(b?"Yes":"No");}
void show_(double d) {cout<<fixed<<setprecision(12)<<d;}
template<class T, class... TS> void show_(const T& t, TS... ts) {show_(t);cout<<' ';show_(ts...);}
template<class T> void show(const T& t) {show_(t);cout<<LN;}
template<class T, class... TS> void show(const T& t, TS... ts) {show_(t, ts...);cout<<LN;}

int main() {
    int N, X, Y;
    cin >> N >> X >> Y;
    vector<int> count(N);
    for (int i : irange(1, N)) {
        for (int j : irange(i+1, N+1)) {
            if (i <= X && Y <= j) {
                count[j - i - (Y - X) + 1]++;
            } else if (i <= X && X < j && j < Y) {
                count[min(j - i, X - i + Y - j + 1)]++;
            } else if (X < i && i < Y && Y <= j) {
                count[min(j - i, i - X + j - Y + 1)]++;
            } else if (X < i && j < Y) {
                count[min(j - i, i - X + Y - j + 1)]++;
            } else {
                count[j - i]++;
            }
        }
    }
    for (int i : irange(1, N)) {
        show(count[i]);
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <queue>
#include <stack>
#include <list>
#include <utility>
#include <vector>
#include <set>
#include <algorithm>
#include <cmath>
#include <climits>
#include <map>
#include <unordered_map>
#include <string.h>
#include<iomanip>
#include <iterator>
#include <locale>

#define all(a) a.begin(),a.end()
#define VV(T) vector<vector< T > >
#define rep(i,N) for(int i = 0; i <N; i++)
#define repsg(i,s,g) for(int i = s; i <g; i++)
#define name(x) #x
using namespace std;

const int INF = INT_MAX;
const long long INFL =LONG_LONG_MAX;
const double PI = atan(1)*4;
const int MOD = pow(10,9)+7;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

typedef long long ll,LL;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
typedef pair<int,int> pii;
typedef pair<LL, LL> pLL;


// vector入力
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
    for(T& x: vec) is >> x;
    return is;
}
// vector出力
template<typename T>
ostream& operator << (ostream& os, vector<T>& vec){
    for(int i=0; i<vec.size(); i++){
        os << vec[i] << ( i+1 == vec.size() ? "" : " " );
    }
    return os;
}



 int mi[100005];
int main() {
    int n,z,w;cin>>n>>z>>w;
    vector<int> a(n);cin>>a;
    
    if (n==1) { cout<<abs(a[n-1]-w)<<endl; return 0;}
    
    cout<< max(abs(a[n-1]-w), abs(a[n-2]-a[n-1]))<<endl;
    
    return 0;
}








Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <iomanip>
#include <algorithm>
#include <sstream>
#include <string>
#include <math.h>
#include <set>
#include <deque>
#include <queue>
#include <list>
using namespace std;
typedef long long ll;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
   	int n, ans = 0;
   	cin >> n;
   	string s[n];
   	for (int i = 0 ; i < n ; i++) cin >> s[i];
   	int m;
   	cin >> m;
   	string t[m];
   	for (int i = 0 ; i < m ; i++) cin >> t[i];
   	for (int i = 0 ; i < n ; i++) {
   		int blue = 0, red = 0;
   		for (int j = 0 ; j < n ; j++) if (s[i] == s[j]) blue++;
		for (int j = 0 ; j < m ; j++) if (s[i] == t[j]) red++;
		ans = max(ans, blue - red);
	}
	cout << ans;
}

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

using namespace std;
#define local
#ifdef local

template<class T>
void _E(T x) { cerr << x; }

void _E(double x) { cerr << fixed << setprecision(6) << x; }

void _E(string s) { cerr << "\"" << s << "\""; }

template<class A, class B>
void _E(pair<A, B> x) {
    cerr << '(';
    _E(x.first);
    cerr << ", ";
    _E(x.second);
    cerr << ")";
}

template<class T>
void _E(vector<T> x) {
    cerr << "[";
    for (auto it = x.begin(); it != x.end(); ++it) {
        if (it != x.begin()) cerr << ", ";
        _E(*it);
    }
    cerr << "]";
}

void ERR() {}

template<class A, class... B>
void ERR(A x, B... y) {
    _E(x);
    cerr << (sizeof...(y) ? ", " : " ");
    ERR(y...);
}

#define debug(x...) do { cerr << "{ "#x" } -> { "; ERR(x); cerr << "}" << endl; } while(false)
#else
#define debug(...) 114514.1919810
#endif
#define _rep(n, a, b) for (int n = (a); n <= (b); ++n)
#define _rev(n, a, b) for (int n = (a); n >= (b); --n)
#define _for(n, a, b) for (int n = (a); n < (b); ++n)
#define _rof(n, a, b) for (int n = (a); n > (b); --n)
#define oo 0x3f3f3f3f3f3f3f3f
#define ll  long long
#define db long double
#define eps 1e-3
#define bin(x) cerr << bitset<10>(x) << endl
#define what_is(x) cerr << #x << " is " << x << endl
#define met(a, b) memset(a, b, sizeof(a))
#define all(x) x.begin(), x.end()
#define pii pair<ll, ll>
#define pdd pair<db, db>
#define endl "\n"
const ll mod = 998244353;
const ll maxn = 1e5 + 10;
const db pi = acos(-1.0);

ll qpow(ll a, ll b) {
    ll ret = 1;
    for (; b; a = a * a % mod, b >>= 1) {
        if (b & 1) {
            ret = ret * a % mod;
        }
    }
    return ret;
}

vector<ll> f(maxn), invf(maxn);

ll inv(ll a) {
    return qpow(a, mod - 2);
}

void prework() {
    f[0] = 1;
    _rep(i, 1, maxn - 1) {
        f[i] = f[i - 1] * i % mod;
    }
    invf[maxn - 1] = qpow(f[maxn - 1], mod - 2);
    for (ll i = maxn - 2; i >= 0; i--) {
        invf[i] = invf[i + 1] * (i + 1) % mod;
    }
}

ll C(ll n, ll m) {
    if (n > m || m < 0)return 0;
    if (n == 0 || m == n) return 1;
    ll res = (f[m] * invf[m - n] % mod * invf[n]) % mod;
    return res;
}

int par[maxn];

int find(int a) {
    return a == par[a] ? a : par[a] = find(par[a]);
}

void merge(int a, int b) {
    par[find(a)] = find(b);
}

signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n, m;
    cin >> n >> m;
    _rep(i, 1, n) {
        par[i] = i;
    }
    _rep(i, 1, m) {
        int u, v;
        cin >> u >> v;
        merge(u, v);
    }
    int cnt = 0;
    _rep(i, 1, n) {
        if (par[i] == i) {
            cnt++;
        }
    }
    cout << cnt - 1 << endl;
}

Measured memory_bytes: 5284
<?php
//error_reporting(0);
//$N = trim(fgets(STDIN));
list($a,$b) = explode(" ",trim(fgets(STDIN)));
//$A  = explode(" ",trim(fgets(STDIN)));

$n = $b - $a;

for($i=1;$i<$n;$i++) {
  $nn+=$i;
}
printf("%d\n",$nn-$a);


Measured memory_bytes: 3828
import sys
from functools import reduce
import copy
import math
from pprint import pprint


sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def int_inputs(num_of_input):
    ins = [int(input()) for i in range(num_of_input)]
    return ins


def solve(inputs):
    A = [0] + string_to_int(inputs[0]) + [0]
    all_cost = 0
    position = 0
    for a in A:
        all_cost += abs(position - a)
        position = a
    all_cost += abs(position)

    costs = []
    # 0 3 5 -1 0
    for i, a in enumerate(A):
        if i == 0 or i == len(A) - 1:
            continue
        cost = all_cost \
            - abs(A[i] - A[i-1]) \
            - abs(A[i+1] - A[i]) \
            + abs(A[i+1] - A[i-1])
        costs.append(cost)
    return costs


def string_to_int(string):
    return list(map(int, string.split()))


if __name__ == "__main__":
    input()
    ret = solve(inputs(1))
    for r in ret:
        print(r)


Measured memory_bytes: 15568
use std::io::{BufRead, stdin};

fn main() {
    let stdin = stdin();
    let mut stdin = stdin.lock();

    loop {
        let mut buf = String::new();
        stdin.read_line(&mut buf).unwrap();
        let mut buf = buf.split_whitespace();

        let n: i32 = buf.next().unwrap().parse().unwrap();
        let x: i32 = buf.next().unwrap().parse().unwrap();

        if n == 0 && x == 0 {
            break;
        }

        let mut combinations_number = 0;

        for i in 1..(n + 1) {
            for j in (i + 1)..(n + 1) {
                for k in (j + 1)..(n + 1) {
                    if i + j + k == x {
                        combinations_number += 1;
                    }
                }
            }
        }

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


Measured memory_bytes: 5020
import sys
from collections import Counter
from collections import deque
import math
import fractions
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

n=int(input())
h=lmp()
h.append(0)
m=max(h)
ans=0
for i in range(m,0,-1):
    for k in range(n):
        if h[k]==i and h[k+1]!=i:
            ans+=1
        if h[k]==i:
            h[k]-=1
print(ans)

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

using namespace std;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	int r1,r2,c1,c2;
	cin >> r1 >> c1 >> r2 >> c2;
	
	long long mod=1000000007;
	
	int fs=2050502;
	vector<long long> fact(fs),ifact(fs),invs(fs);
	fact[0]=ifact[0]=fact[1]=ifact[1]=invs[1]=1;
	for(int i=2;i<fs;i++){
		fact[i]=fact[i-1]*i%mod;
		invs[i]=mod-invs[mod%i]*(mod/i)%mod;
		ifact[i]=ifact[i-1]*invs[i]%mod;
	}
	function<long long(int,int)> binom=[&](int a,int b){
		if(b==0) return 1LL;//
		if(a<b || b<0) return 0LL;
		return fact[a]*ifact[b]%mod*ifact[a-b]%mod;
	};
	
	long long res=0;
	for(int i=c1;i<=c2;i++){
		res=(res+binom(r2+i+1,r2)-binom(r1+i,r1-1)+mod)%mod;
	}
	cout << res << "\n";
	return 0;
}

Measured memory_bytes: 48256
#include<iostream>
#include<cstdlib>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
using namespace std;
int a,b; 
int read()
{
	int _=1,__=0;char ___;___=getchar();
	while(___>'9'||___<'0'){if(___=='-')_=-1;___=getchar();}
	while(___<='9'&&___>='0'){__=__*10+___-'0';___=getchar();}
	return _*__;
}
int main()
{
	a=read();b=read();
	printf("%d",max(a+b,max(a-b,a*b)));
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string n;
    long long s=0;
    cin>>n;
    if(n[0]!='C') s++;
    if(n[1]!='O') s++;
    if(n[2]!='D') s++;
    if(n[3]!='E') s++;
    if(n[4]!='F') s++;
    if(n[5]!='E') s++;
    if(n[6]!='S') s++;
    if(n[7]!='T') s++;
    if(n[8]!='I') s++;
    if(n[9]!='V') s++;
    if(n[10]!='A') s++;
    if(n[11]!='L') s++;
    if(n[12]!='2') s++;
    if(n[13]!='0') s++;
    if(n[14]!='1') s++;
    if(n[15]!='6') s++;
    cout<<s<<endl;
    return 0;
}

Measured memory_bytes: 256
//shan61916
#include <bits/stdc++.h>
  using namespace std;
typedef   long long ll;
typedef   unsigned long long ull ;
typedef   double dll ;

#define   mp make_pair
#define   pb push_back
#define   ff first 
#define   ss second
#define   IOS ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define   endl "\n" 
#define   pll pair<ll, ll>
#define   all(x) x.begin(), x.end()
#define   vll vector<ll> 

const ll inf = (ll)(1e17 + 17);
const ll mod = (ll)(1e9 + 7);


int main(){
 IOS
#ifdef SHAN
    freopen("input.txt" , "r" , stdin);  
#endif
  string s;
  cin >> s;
  ll n = s.length();
  ll x1 = 0;
  ll x2 = 0;
  for(ll i = 0; i < n; i++) {
    if(i%2) {
      if(s[i] == '1') x2++;
      else x1++;
    } else {
      if(s[i] == '1') x1++;
      else x2++;
    }
  }
  cout << min(x1, x2) << endl;
  return 0;
} //good night.

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

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

    string S;
    cin >> S;

    string ans;
    if (S.size() <= K) ans = S;
    else ans = S.substr(0, K) + "...";

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>
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; }

int N;
vector<long long> A, B;

int main() {
    while (cin >> N) {
        A.resize(N); B.resize(N);
        for (int i = 0; i < N; ++i) cin >> A[i];
        for (int i = 0; i < N; ++i) cin >> B[i];
        
        vector<long long> plus;
        long long sum = 0;
        int num = 0;
        for (int i = 0; i < N; ++i) {
            long long dif = A[i] - B[i];
            if (dif < 0) sum -= dif, ++num;
            else plus.push_back(dif);
        }
        
        if (num == 0) {
            cout << 0 << endl;
        }
        else {
            int res = num;
            sort(plus.begin(), plus.end(), greater<long long>());
            
            long long p = 0;
            for (int i = 0; i < plus.size(); ++i) {
                p += plus[i];
                ++res;
                if (p >= sum) break;
            }
            
            if (p >= sum) cout << res << endl;
            else cout << -1 << endl;
        }
    }
}















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

int main() {
	string s;
	cin >> s;
	int l = s.length();
	if (s[l - 1] == 's') cout << s + "es" << endl;
	else cout << s + "s" << endl;
	return 0;
}


Measured memory_bytes: 3628
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<algorithm>
#include<iostream>

using namespace std;

int main(void){
	long A,B,C,K,ans;
	
	scanf("%ld%ld%ld%ld",&A,&B,&C,&K);
	if(K%long(2) == long(1)) ans = B-A;
	else ans = A-B;
	if(ans > 1000000000000000000) {
		printf("unfair\n");
		fflush(stdout);
		return 0;
	}
	printf("%ld\n",ans);
	fflush(stdout);

	return 0;
}

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

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

    string S;
    cin >> S;
    
    vector<int>count;
    if(S[0]=='0') count.push_back(0);
    for(int i=0; i<N; i++){
        int j=i;
        while(j<N&&S[j]==S[i])++j;
        count.push_back(j-i);
        i=j-1;
    }
    if(S.back()=='0') count.push_back(0);

    vector<int> sums(count.size() + 1,0);
    for(int i=0; i<count.size(); i++) sums[i+1] = sums[i] + count[i];

    int res=0;
    for(int left=0; left<sums.size(); left+=2){
        int right=(left+K*2+1>=sums.size()?sums.size()-1:left+K*2+1);
        res = max(res, sums[right]-sums[left]);
    }
    cout << res << endl;
}


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

const int MAX = 510000;
const int MOD = 1000000007;
// const int MOD = 1e9 + 7;

long long fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++) {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

long long COM(int n, int k) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

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

    COMinit();

    int R = N - K;

    for (int i = 1; i <= K; i++) {
        cout << COM(R+1 ,i) * COM(K-1, i-1) % MOD << endl;
    }

    return 0;
}

Measured memory_bytes: 12160
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<iomanip>
#include<set>
#include<bitset>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define brep(index,num) for(int index=num-1;index>=0;index--)
#define brep1(index,num) for(int index=num;index>0;index--)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef long long ll;
typedef long double ld;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
int main(){
	ll N,A,B;
	scan(N>>A>>B);
	if((B-A)%2==0){
		prin((B-A)/2);
	}
	else{
	 	ll a=A,b=B;
		ll ans=INFl;
		a=1;
		b=B-A;
		ans=min(ans,A+(b-a)/2);
		b=N;
		a=A+(N-B)+1;
		ans=min(ans,N-B+1+(b-a)/2);
		prin(ans);
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
using namespace std;
 
int main()
{
  string s, t, u;
	int n, m;
	cin >> s >> t;
	cin >> n >> m;
  cin >> u;
  
  if(u == s){
    cout << n-1 << ' ' << m << endl;
  }else{
    cout << n << ' ' << m-1 << endl;
  }
	return 0;
}

Measured memory_bytes: 256
import itertools
n=int(input())
l=[list(map(int,input().split())) for i in range(n)]
L=list(itertools.permutations(range(n)))
ans=0
for i in range(len(L)):
  for j in range(n-1):
    ans+=((l[L[i][j+1]][0]-l[L[i][j]][0])**2+(l[L[i][j+1]][1]-l[L[i][j]][1])**2)**0.5
print(ans/len(L))

Measured memory_bytes: 8180
#include <iostream>
#include <algorithm>
#include <vector>
#include <numeric> // accumulate
#include <queue>
#include <string>
#include <cmath> // sqrt
#include <map>
using namespace std;
typedef long long ll;
const ll mod = 1e9 + 7;

ll dp[3010][3010][2];
int main() {
    int n, m;
    cin >> n >> m;

    for (int x = 0; x <= n; x++) {
        if (x == 0) dp[0][x][1] = 1;
        else dp[0][x][0] = 1;
    }

    for (int i = 0; i < m; i++) {
        for (int x = 0; x <= n; x++) {
            if (x <= n-1) {
                dp[i+1][x+1][1] += dp[i][x][1];
                dp[i+1][x+1][1] %= mod;

                dp[i+1][x][1] += dp[i][x][1];
                dp[i+1][x][1] %= mod;
            }
            if (x >= 1) {
                dp[i+1][x-1][1] += dp[i][x][1];
                dp[i+1][x-1][1] %= mod;

                dp[i+1][x][1] += dp[i][x][1];
                dp[i+1][x][1] %= mod;
            }


            if (x >= 2) {
                if (x <= n-1) {
                    dp[i+1][x+1][0] += dp[i][x][0];
                    dp[i+1][x+1][0] %= mod;

                    dp[i+1][x][0] += dp[i][x][0];
                    dp[i+1][x][0] %= mod;
                }
                if (x >= 1) {
                    dp[i+1][x-1][0] += dp[i][x][0];
                    dp[i+1][x-1][0] %= mod;

                    dp[i+1][x][0] += dp[i][x][0];
                    dp[i+1][x][0] %= mod;
                }
            }

            else if (x == 1) {
                if (x <= n-1) {
                    dp[i+1][x+1][0] += dp[i][x][0];
                    dp[i+1][x+1][0] %= mod;

                    dp[i+1][x][0] += dp[i][x][0];
                    dp[i+1][x][0] %= mod;
                }

                dp[i+1][x-1][1] += dp[i][x][0];
                dp[i+1][x-1][1] %= mod;

                dp[i+1][x][1] += dp[i][x][0];
                dp[i+1][x][1] %= mod;

            }
        }
    }

    ll ans = 0;
    for (int x = 0; x <= n; x++) {
        ans += dp[m][x][1];
        ans %= mod;
    }

    cout << ans << endl;
}

Measured memory_bytes: 141568
#include <stdio.h>
int map[40][2],num,i;
int snake(int x,int y,int a,int b){
    for(i=0;i<num;i++)
        if(x==map[i][0]&&y==map[i][1])
            return 0;
    if(x>a||x<1||y>b||y<1)
        return 0;
    if(x==a&&y==b)
        return 1;
    return snake(x+1,y,a,b)+snake(x,y+1,a,b);
}
int main(void){
    int a,b,sum;
    for(;sum=0,scanf("%d %d",&a,&b),b;){
        scanf("%d",&num);
        for(i=0;i<num;i++)
            scanf("%d %d",&map[i][0],&map[i][1]);
        sum=snake(1,1,a,b);
        printf("%d\n",sum);
    }
    return 0;
}

Measured memory_bytes: 600
/*
author: Apoorv Singh
*/
 
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace std;
using namespace __gnu_pbds;
 
typedef vector <int> vi;
typedef pair <int, int> pii;
typedef vector <long long> vll;
typedef pair <long long, long long> pll;
#define pb push_back   
#define all(c) c.begin(), c.end()
#define For(i, a, b) for (long long i = a; i < b; ++i)
#define Forr(i, a, b) for (long long i = a; i > b; --i)
#define um unordered_map
#define F first
#define S second
#define ll long long 
#define endl "\n"
#define min(a,b) (a < b ? a : b)
#define max(a,b) (a > b ? a : b)
#define fast_io() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

#define TRACE
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
	cout << name << " : " << arg1 << endl;  
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
	const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

template <class X>
void printarr(X arr[], int n) {
	for (int i = 0; i < n; ++i)
		cout << arr[i] << ' ';
	cout << endl;
}
 
template <class T, class cmp = less<T>> using ordered_set = tree<T, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
 
ll modulo = 1e9 + 7;

ll fpow(ll a, ll n) {
	ll ans = 1;
	while (n) {
		if (n&1) ans = (ans*a)%modulo;
		a = (a*a)%modulo; n = n >> 1;
	}
	return ans;
}

void solve() {
	int x,n;
	cin >> x >> n;
	int arr[n];
	for (int i = 0; i < n; ++i) {
		cin >> arr[i];
	}		
	int diff = INT_MAX;
	int ans;
	for (int i = x-150; i <= x+150; ++i) {
		bool present = 0;
		for (int j = 0; j < n; ++j) {
			if (arr[j] == i) {
				present = 1;
				break;
			}
		} 
		if (!present and diff > abs(i-x)) {
			diff = abs(i-x);
			ans = i;
		}
	}
	cout << ans << endl;
}

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

Measured memory_bytes: 3648
#include<iostream>
#include<string>
#include<queue>
#include<algorithm>
#include<map>
#include<set>
#include<vector>
#include<math.h>

using namespace std;

#define INF 1000000007
#define LINF (1LL << 62)

typedef long long i64;
typedef pair<i64,i64> P;


int n;

int main(){
	cin >> n;
	
	for(int i = 1; i <= n; i++){
		if(n == (int)(i * 1.08)){
			cout << i << endl;
			return 0;
		}
	}
	cout << ":(" << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n,m,sum=0;
	cin>>n>>m;
	int a[m+1],b[m+1],c[m+1][10005];
	for(int i=1;i<=m;i++){
		cin>>a[i];
		for(int j=1;j<=a[i];j++){
			cin>>c[i][j];
		}
	}
	for(int i=1;i<=m;i++){
		cin>>b[i];
	}
	int g[100005]={0},j=n;
	while(g[0]==0){
		bool false_true=true;
		for(int k=1;k<=m;k++){
			int s=0;
			for(int l=1;l<=a[k];l++){
				if(g[c[k][l]]){
					s++;
				}
			}
			if(s%2!=b[k]){
				false_true=false;
			}
		}
		if(false_true==true){
			sum++;
		}
		j=n;
		while(g[j]==1) j--;
		g[j]++;
		for(int i=j+1;i<=n;i++){
			g[i]=0;
		}
	}
	cout<<sum;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define M 100007
using namespace std;
const long long INF = 1e18;
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n,b, v;
    long long w;
    cin >> n >> b;
    long long tab[M];
    for(int i = 0; i < M; i++){
        tab[i] = INF;
    }
    for(int i = 0; i < n; i++){
        cin >> w >> v;
        for(int j = M; j>=v; j--){
            if(tab[j-v]!=INF){
                tab[j] = min(tab[j], tab[j-v]+w);
            }
        }
        tab[v] = min(tab[v], w);
    }
    /*for(int i = 0; i < M; i++){
        cout << tab[i] << " ";
    }
    cout << endl;*/
    int g = M-1;
    while(tab[g]>b){
        g--;
    }
    cout << g;
    return 0;
}


Measured memory_bytes: 1024
n,k,s=map(int,input().split())
a=s//2
b=s-a
x=[]
if s==10**9:
    import sys
    for i in range(n):
        if i>=k:
            x.append(1)
            continue
        x.append(s)
    print(' '.join([str(i) for i in x]))
    sys.exit()
for i in range(n):
    if i>=k:
        x.append(s+1)
        continue
    x.append(s)
print(' '.join([str(i) for i in x]))

Measured memory_bytes: 57120
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
    int n;
    cin >> n;
    int a[n],b[n],c[n];
    for (int i=0; i<n; i++){
        cin >> a[i];
    }
    for (int i=0; i<n; i++){
        cin >> b[i];
    }
    for (int i=0; i<n; i++){
        cin >>c[i];
    }
    long long ans=0;
    sort(a,a+n);
    sort(b,b+n);
    sort(c,c+n);
    for (int i=0; i<n; i++){
        int mid=b[i];
        int *a_bound=lower_bound(a,a+n,mid);
        int *c_bound=upper_bound(c,c+n,mid);
        long long x=(long long)(distance(a,a_bound));
        long long y=(long long)(distance(c_bound,c+n));
        ans+=x*y;
      
    }
    cout << ans << endl;
}

Measured memory_bytes: 1536
#include<bits/stdc++.h>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define rrep(i,a) for(int i=(int)a-1;i>=0;--i)
#define REP(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RREP(i,a,b) for(int i=(int)a-1;i>=b;--i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
typedef std::vector<int> vi;
typedef std::vector<std::vector<int>> vvi;
typedef std::vector<long long> vl;
typedef std::vector<std::vector<long long>> vvl;
#define out(x) cout<<x<<"\n";
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;

ll gcd(ll n, ll m) {
    ll tmp;
    while (m!=0) {
        tmp = n % m;
        n = m;
        m = tmp;
    }
    return n;
}

ll lcm(ll n, ll m) {
    return abs(n) / gcd(n, m)*abs(m);//gl=xy
}
 
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
 
using namespace std;

void solve(){
  int n,m;
  cin>>n>>m;
  vector<int>a(n);
  int sum=0;
  rep(i,n)cin>>a[i],sum+=a[i];
  int cnt=0;
  rep(i,n){
    if(a[i]*(4*m)>=sum)++cnt;
  }
  if(cnt>=m)cout<<"Yes";
  else cout<<"No";
}


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(15);
    solve();
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//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; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    ごちゃごちゃ場合分けを考える前に全探索は考えましたか？
*/

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

    s += "ABC";
    for(int i=0; i<s.size()-3; i++){
        if(s[i] == s[i+1]){
            cout << i+1 << " " << i+2 << endl;
            return 0;
        }
        else if(s[i] == s[i+2]){
            cout << i+1 << " " << i+3 << endl;
            return 0;
        }
    }

    cout << -1 << " " << -1 << endl;
    return 0;
}

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

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

void solve(void) {
  ll L; cin >> L;

  double l = (double)L / 3.0;

  cout << setprecision(16) << l * l * l << endl;
}

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <sstream>
#include <iomanip>
#define ll long long
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define vi vector <ll> 
#define qu queue <ll>
#define min_3(a,b,c) min(a,min(b,c))
#define max_3(a,b,c) max(a,max(b,c))
#define nout(ans) cout << (ans) << "\n"
#define sout(ans) cout << (ans) << " "
using namespace std;

/*
Decimal Places: cout << fixed << setprecision(n) << ans << endl

String to integer:
stringstream dark(s);
int x = 0; dark >> x;
*/

bool compare(const pair<int, int>&i, const pair<int, int>&j)
{
    return i.second < j.second;
}


void solve()
{
    string s, t; cin >> s >> t;
    string temp = s + t[t.size()-1];
    if (temp==t) nout("Yes");
    else nout("No");
    //nout(temp);
    
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    int t = 1;
    //cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
const int maxn = 10005;

int A[maxn], B[maxn], n;

int main(void){
	scanf("%d", &n);
	for (int i = 1; i <= n; ++i) scanf("%d", &A[i]);
	for (int i = 1; i <= n; ++i) scanf("%d", &B[i]);
	long long diff = 0;
	for (int i = 1; i <= n; ++i){
		if (A[i] > B[i]) diff -= (A[i] - B[i]);
			else diff += (B[i] - A[i])/2;
	}
	if (diff >= 0) return 0 * puts("Yes"); else return 0 * puts("No");
}

Measured memory_bytes: 384