akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
template <typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
const int INT_INF = 1LL << 30;

int main(){
  int N;
  cin >> N;
  vi A(N);
  for(int i = 0; i < N; i++){
    cin >> A.at(i);
    A.at(i) -= i+1;
  }
  sort(ALL(A));
  int x = N/2;
  int y = (N-1)/2;
  ll ans1 = 0, ans2 = 0;
  for(int i = 0; i < N; i++){
    ans1 += abs((ll)A.at(i) - (ll)A.at(x));
    ans2 += abs((ll)A.at(i) - (ll)A.at(y));
  }
  cout << min(ans1, ans2) <<endl;

}

Measured memory_bytes: 1024
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
int cmp(const void *c1, const void *c2 )
{
  int tmp1 = *(int *)c1;
  int tmp2 = *(int *)c2;

  if( tmp1 < tmp2 )  return -1;
  if( tmp1 == tmp2 ) return  0;
  if( tmp1 > tmp2 )  return  1;
}
int main(void)
{
    int N;
    int score;
    int sum = 0;
    bool flag = true;

    scanf("%d", &N);
    int *scores;
    scores = malloc(sizeof(int) * N);
    for (int i = 0; i < N; ++i) {
        scanf("%d", &score);
        sum += score;
        scores[i] = score;
        if (flag && score % 10 != 0)
            flag = false;
    }
    if (flag) {
        puts("0");
        return 0;
    }
    if (sum % 10 == 0) {
        qsort(scores, N, sizeof(int), cmp);
        //for (int i = 0; i < N; i++)
        //    printf("%d ", scores[i]);
        for (int i = 0; i < N && sum % 10 == 0; i++) {
            //printf("[[%d\n", scores[i]);
            if ((sum - scores[i]) % 10 != 0) {
                sum -= scores[i];
                break;
            }
        }
    }
    printf("%d\n", sum);
    return 0;
}
//#include <stdbool.h>

//int main(void)
//{
//    char str[28];
//    bool flags[27];
//    for (int i = 0; i < 27; i++)
//        flags[i] = false;
//
//    fgets(str, 28, stdin);
//    for (int i = 0; str[i] != '\n'; i++) {
////        printf("[%d]", str[i] - 'a');
//        if (flags[str[i] - 'a']) {
//            puts("no");
//            return 0;
//        }
//        flags[str[i] - 'a'] = true;
//    }
//    puts("yes");
//    return 0;
//}


Measured memory_bytes: 128
def warshall_floyd(d):
    for k in range(n):
        for i in range(n):
            for j in range(n):
                d[i][j] = min(d[i][j],d[i][k]+d[k][j])
    return d

n,w = map(int,input().split(" "))

a = []

d = [[10 ** 10] * n for i in range(n)]
k = [n for i in range(n)]

for i in range(w):
    x,y,z = map(int,input().split(" "))
    d[x-1][y-1] = z
    d[y-1][x-1] = z
    a.append([x,y,z])
for i in range(n):
    d[i][i] = 0

d = warshall_floyd(d)

ans = w
for i in range(len(a)):
    for s in range(n):
        if d[s][a[i][1]-1] + a[i][2] == d[s][a[i][0]-1]:
            ans -= 1
            break

print(ans)

Measured memory_bytes: 9332
//#include "stdafx.h"
#include <iostream>
#include <set>
#include <queue>
#include <vector>
#include <algorithm>
#include <math.h>
#include <cmath>
#include <string>
#include <cstring>
#include <functional>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
#include <tuple>
#include <numeric>
#include <assert.h>
#include <functional>
#include <unordered_map>

using namespace std;

/*-----------------------------------------------------------------------------
　定義
 -------------------------------------------------------------------------------*/
#define REP(i, n)				for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n)			for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define INF						2e9
#define MOD						(1000 * 1000 * 1000 + 7)
#define Ceil(x, n)				(((((x))+((n)-1))/n))		/* Nの倍数に切り上げ割り算 */
#define CeilN(x, n)				(((((x))+((n)-1))/n)*n)		/* Nの倍数に切り上げ */
#define FloorN(x, n)			((x)-(x)%(n))				/* Nの倍数に切り下げ */
#define IsOdd(x)				(((x)&0x01UL) == 0x01UL)			
#define IsEven(x)				(!IsOdd((x)))						
#define	BitSetV(Val,Bit)		((Val) |= (Bit))			
#define	BitTstV(Val,Bit)		((Val) & (Bit))				
#define ArrayLength(x)			(sizeof( x ) / sizeof( x[ 0 ]))
#define	MAX_QWORD				((QWORD)0xFFFFFFFFFFFFFFFF)
#define	MIN_QWORD				((QWORD)0x0000000000000000)
#define	MAX_SQWORD				((SQWORD)0x7FFFFFFFFFFFFFFF)
#define	MIN_SQWORD				((SQWORD)0x8000000000000000)
#define M_PI					3.14159265358979323846
typedef long long				ll;
typedef unsigned long			DWORD;
typedef unsigned long long int	QWORD;
typedef pair<ll, ll>			P;

/*-----------------------------------------------------------------------------
　処理
 -------------------------------------------------------------------------------*/
// メイン
int main()
{
	// 入力
	int N;
	cin >> N;
	vector<int> a(N);
	REP(i, N) cin >> a[i];

	ll ans = 0;
	REP(i, N) ans += (a[i] - 1);
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 256
/* C++14 (Clang 3.8.0) for AtCoder */

#include <iostream>
#include <vector>
#include <string>
// #include <cmath>
// #include <math.h>
// #include <algorithm>

namespace AtCoder {
	using Str = std::vector<std::string>;
	using Num = std::vector<int>;

	class Ans {
	public:
		void showResult(void);
		void increment(void);
		void increment(double);
		void decrement(void);
		void decrement(double);
		double getResult(void);
	private:
		double result;
	};
	void Ans::showResult(void) {
		printf("%.0lf\n", this->result);
	}
	void AtCoder::Ans::increment(void) {
		this->result++;
	}
	void AtCoder::Ans::increment(double value) {
		this->result += value;
	}
	void AtCoder::Ans::decrement(void) {
		this->result--;
	}
	void AtCoder::Ans::decrement(double value) {
		this->result -= value;
	}
	double AtCoder::Ans::getResult(void) {
		return this->result;
	}

	void input(Str* str) {
		str->clear();
		std::string buf = "", row = "";
		std::getline(std::cin, buf);
		for (unsigned int i = 0; i < buf.size(); i++) {
			if (' ' == buf[i]) {
				str->push_back(row);
				row = "";
			} else {
				row += buf[i];
			}
		}
		str->push_back(row);
	}
	void input(Num* num) {
		num->clear();
		std::string buf = "", row = "";
		std::getline(std::cin, buf);
		for (unsigned int i = 0; i < buf.size(); i++) {
			if (' ' == buf[i]) {
				num->push_back(std::atoi(row.c_str()));
				row = "";
			} else {
				row += buf[i];
			}
		}
		num->push_back(std::atoi(row.c_str()));
	}
	void exp(std::string* str,  Str* newStr) {
		std::string pre = *str;
		newStr->clear();
		for (unsigned int i = 0; i < pre.length(); i++) {
			newStr->push_back(pre.substr(i, 1));
		}
	}
}

int main(void) {

	AtCoder::Num s;
	AtCoder::input(&s);

	AtCoder::Str s2;
	AtCoder::input(&s2);

	if (3199 < s[0]) {
		printf("%s\n", s2[0].c_str());
	} else {
		printf("red\n");
	}

	return 0;
}


Measured memory_bytes: 256
from bisect import bisect_left
from string import ascii_lowercase

s = input()
t = input()
n = len(s)

dict_s = {c: [] for c in ascii_lowercase}
for i, c in enumerate(s * 2):
    dict_s[c].append(i)

for c in ascii_lowercase:
    if not dict_s[c]:
        del dict_s[c]


dict_next_i = {
    c: [dict_s[c][bisect_left(dict_s[c], i + 1)] for i in range(n)]
    for c in dict_s.keys()
}


def next_i(i, c):
    return n * (i // n) + dict_next_i[c][i % n]


def answer():
    if not all(c in s for c in t):
        return -1
    i = -1
    for c in t:
        i = next_i(i, c)
    return i + 1  # 1-origin


print(answer())


Measured memory_bytes: 39184
search = raw_input().upper()
sentence = []
while 1:
    input_data = raw_input()
    if input_data == 'END_OF_TEXT':
        break   
    sentence += [s.upper() for s in input_data.split()]

ret = 0
for word in sentence:
    ret += 1 if word == search else 0
print ret

Measured memory_bytes: 6436
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		String strS = scan.next()
				,strT = scan.next();
		int countA = scan.nextInt()
				, countB = scan.nextInt();
		String u = scan.next();

		scan.close();
		if (u.equals(strS)) {
			countA--;
		} else {
			countB--;
		}

		System.out.println(countA + " " + countB);
	}

}


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

using namespace std;

#define REP(i,m) for(ll i=0; i<m; i++)
#define FOR(i,n,m) for(ll i=n; i<m; i++)
#define INF 1000000007
#define INFL (1LL << 60)
#define MOD 998244353
#define ALL(v) v.begin(),v.end()
#define pb push_back
#define ll long long int
#define P pair<ll, ll>

ll POW(ll a, ll b){
	if(b==1) return a;
	if(b%2==0) return POW(a*a%INF, b/2);
	return a*POW(a, b-1)%INF;
}

int main(){
	int n;
	cin >> n;
	int dp[100][100] = { };
	dp[0][1] = 1;
	int p[100];
	p[0] = -1;
	p[1] = -1;
	REP(i, 100){
		if(p[i] == 0){
			p[i] = 1;
			FOR(j, i, 100){
				if(j*i > 100) break;
				p[j*i] = -1;
			}
		}
	}
	FOR(i, 1, 100){
		if(p[i] == 1){
			int d = 0;
			int t = n;
			while(t != 0){
				d += t/i;
				t/=i;
			}
			REP(j, d+1){
				REP(k, 100){
					if((j+1)*k > 100) break;
					dp[i][(j+1)*k] += dp[i-1][k];
				}
			}
		}
		else{
			REP(j, 100) dp[i][j] = dp[i-1][j];
		}
	}
	cout << dp[99][75] << endl;
	return 0;
} 


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<cctype>
using namespace std;
#define rep(i,n) for (int i=0;i<(n);i++)
#define all(v) (v).begin(),(v).end()
typedef long long int ll;
#define pi 3.1415926535897932384
#define E9 1000000000
#define eps 1e-4
#define pii pair<int,int>

int main(){
  string s; cin >> s;
  int K; cin >> K;
  int N = s.size();

  ll cnt_1 = 0, cnt_2 = 0,cnt_3 = 0;
  rep(i,N){
    if (i+1<N && s[i]==s[i+1]){
      cnt_1++;
      i++;
    }
  }
  s += s;
  rep(i,s.size()){
    if (i+1<2*N && s[i]==s[i+1]){
      cnt_2++;
      i++;
    }
  }
  s += s;
  rep(i,s.size()){
    if (i+1<3*N && s[i]==s[i+1]){
      cnt_3++;
      i++;
    }
  }
  if (K%2) cout << cnt_1 + (cnt_3-cnt_1)*(K/2) << endl;
  else cout << cnt_2 + (cnt_3-cnt_1)*(K/2-1) << endl;




  
  
  // cout << fixed << setprecision(10);
  
  return 0;
}


Measured memory_bytes: 3596
// AOJ DSL_2_A Range Minimum Query (RMQ)
// 2018.5.5 bal4u

#include <stdio.h>
#include <stdlib.h>

#if 1
#define gc() getchar_unlocked()
#define pc(c) putchar_unlocked(c)
#else
#define gc() getchar()
#define pc(c) putchar(c)
#endif
int in()
{
	int n = 0, c = gc();
	do n = 10*n + (c & 0xf), c = gc(); while (c >= '0');
	return n;
}

void out(int n)
{
	int i;
	char ob[20];

	if (!n) pc('0');
	else {
//		if (n < 0) pc('-'), n = -n;
		i = 0; while (n) ob[i++] = n%10 + '0', n/=10;
		while (i--) pc(ob[i]);
	}
	pc('\n');
}

#define INF 0x7fffffff

// セグメント木の初期化：配列の確保と初期値による初期化
int *seg; int sz;
void segtree(int n, int init_val)
{
	int i;

	sz = 1; while (sz < n) sz <<= 1;
	n = sz << 1;
	seg = malloc(n << 2);
	for (i = 0; i < n; i++) seg[i] = init_val;
//	memset(seg, init_val, sz << 2);
}

// k番目（0-index）の値を v に変更
void update(int k, int v)
{
	int p;

	k += sz - 1;
	seg[k] = v;
	while (k > 0) {
		k = (k-1) >> 1;
		p = (k << 1)+1;
		v = seg[p+1];
		if (v > seg[p]) v = seg[p];
		seg[k] = v;
	}
}

int query2(int a, int b, int k, int l, int r) 
{
	int m, lmin, rmin;

	if (r <= a || b <= l) return INF;
    if (a <= l && r <= b) return seg[k];
	k <<= 1, m = (l+r) >> 1;
    lmin = query2(a, b, k+1, l, m);
    rmin = query2(a, b, k+2, m, r);
    return (lmin <= rmin)? lmin: rmin; 
}

// 空間 [a, b)　内の最小値
int range_min_query(int a, int b)
{
	return query2(a, b+1, 0, 0, sz);
}


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

	n = in(), q = in();
	segtree(n, INF);

	while (q--) {
		op = in(), x = in(), y = in();
		if (op) out(range_min_query(x, y));
		else update(x, y);
	}
	return 0;
}



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

using namespace std;

void hawawa()
{
  string str;
  cin >> str;
  int ans = 0;
  for (int i = 1; i < str.size(); i++) {
    ans += str[i - 1] != str[i];
  }
  cout << ans << "\n";
}

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

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define F first
#define S second
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define Red ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define rep(i, n) for(int i =0 ; i < n; ++i)
#define pii pair < int, int >
typedef vector<int> vi;
typedef   long long ll;
const int mod =1e9+7;




void solve(){
	int a,b;
	cin>>a>>b;
	for(int i=1;i<=100000;i++){
		int x=i*0.08,y=i*0.1;
		if(x==a && y==b){
			cout<<i;
			return;
		}
	}
	cout<<-1;


}


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

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<bitset>
#include<algorithm>
#include<map>
#include<queue>
#include<cmath>
#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;

int main() {
	int n;
	cin >> n;
	vector<int> h(n);
	rep(i, n)
		cin >> h[i];

	int max=h[0];
	long long sum = 0;
	for (int i = 1; i < n; i++) {
		if (h[i] < max) {
			sum += max - h[i];
		}
		else
			max = h[i];
	}
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 4040
#include <stdio.h>

int gcd(int a, int b);

int main(void)
{
	int a, b, c, GCD, lcm;
	while (scanf("%d %d",&a ,&b)!= EOF){
		GCD = gcd(a, b);
		lcm = a / GCD * b;
		printf("%d %d\n", GCD, lcm);
	}
	return (0);
}
int gcd(int a, int b)
{
	if (b == 0) return (a);
	return (gcd(b, a % b));
}

Measured memory_bytes: 596
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 1000000010
#define N 10010
char getc(){char c=getchar();while ((c<'A'||c>'Z')&&(c<'a'||c>'z')&&(c<'0'||c>'9')) c=getchar();return c;}
int gcd(int n,int m){return m==0?n:gcd(m,n%m);}
int read()
{
	int x=0,f=1;char c=getchar();
	while (c<'0'||c>'9') {if (c=='-') f=-1;c=getchar();}
	while (c>='0'&&c<='9') x=(x<<1)+(x<<3)+(c^48),c=getchar();
	return x*f;
}
int n,ans,f[N][2];
char s[N][12];
signed main()
{
	n=read();
	for (int i=1;i<=n;i++) scanf("%s",s[i]+1);
	for (int i=1;i<=n;i++)
	{
		int m=strlen(s[i]+1);
		for (int j=1;j<m;j++)
		if (s[i][j]=='A'&&s[i][j+1]=='B') ans++;
		if (s[i][1]=='A') f[i][0]=0;
		else if (s[i][1]=='B') f[i][0]=1;
		else f[i][0]=2;
		if (s[i][m]=='A') f[i][1]=0;
		else if (s[i][m]=='B') f[i][1]=1;
		else f[i][1]=2;
	}
	int cnt0=0,cnt1=0,cnt10=0;
	for (int i=1;i<=n;i++)
	{
		if (f[i][0]==1&&f[i][1]==0) cnt10++;
		else if (f[i][1]==0) cnt0++;
		else if (f[i][0]==1) cnt1++;
	}
	if (cnt10) ans+=cnt10-1,cnt10=1;
	if (cnt0&&cnt10) ans++,cnt10=0;
	ans+=min(cnt0+cnt10,cnt1);
	cout<<ans;
	return 0;
	//NOTICE LONG LONG!!!!!
}

Measured memory_bytes: 384
#include <iostream>
#include <stdio.h>
using namespace std;
int a,b[50];
int solve(int i,int m,int k){
            if (m==0)return 1;
            if (i>=k)return 0;
            int res=solve(i+1,m,a)||solve(i+1,m-b[i],a);
            return res;
        }
        
int main(void){
    // Your code here!
    int c,d=0;
    scanf("%d", &a);
  
    for (int i=0;i<a;i++){
        scanf("%d",&b[i]);
    }
    scanf("%d",&c);
    for (int i=0;i<c;i++){
        scanf("%d",&d);
        if(solve(0,d,a))cout<<"yes"<<endl;
        else cout<<"no"<<endl;
    }
    return 0;
}


Measured memory_bytes: 3168
#include <bits/stdc++.h>
#define err(args...) {}
#ifdef DEBUG
#include "_debug.cpp"
#endif
using namespace std;
using ll = long long;
using ld = long double;
template <typename T> using lim = numeric_limits<T>;
template <typename T> istream& operator>>(istream& is, vector<T>& a) { for(T& x : a) { is >> x; } return is; }
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    ll x;
    cin >> x;
    cout << 2 * (x / 11) + x % 11 / 6 + (x % 11 % 6 > 0) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define FORR(i ,m, n) for(int i = m; i >= n; i--)
#define pb(a) push_back(a)
#define mk(a,b) make_pair(a,b)
#define ll long long
#define INF 999999999
#define IOS cin.tie(0); ios::sync_with_stdio(false)
using namespace std;
typedef pair<int, int> P;
typedef pair<int, P> PP;
typedef pair<ll,ll> LP;
typedef pair<ll,LP> LPP;

int dy[] = {0, 0, 1, -1};
int dx[] = {1, -1, 0, 0};
int gcd(int a,int b){return b ? gcd(b,a%b) : a;}
int lcm(int a,int b){return a/gcd(a,b)*b;}

int main() {
    int N; cin >> N;
    int H[N+10]; rep(i,N) cin >> H[i];
    bool can = true;
    rep(i,N){
        if(i==0){
            H[0]--;
        }
        else{
            if(H[i]>H[i-1]){
                H[i]--;
            }
            else if(H[i]!=H[i-1]){
                can=false; break;
            }
        }
    }
    if(can) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
const int N(111111);
int x[N];
int main() {
	int n, a, b;
	long long ans(0);
	scanf("%d%d%d", &n, &a, &b);
	for(int i(1); i <= n; i++) {
		scanf("%d", &x[i]);
		if(i > 1) {
			ans = ans + min((long long)a * (x[i] - x[i - 1]), (long long)b);
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 640
use std::io;


fn main() {
    let b = read_one::<String>();
    match b.as_str() {
        "A" => println!("T"),
        "C" => println!("G"),
        "G" => println!("C"),
        "T" => println!("A"),
        _ => unreachable!(),
    }

}


#[allow(dead_code)]
fn read<T>() -> Vec<T>
where T:
std::str::FromStr,
T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.split_whitespace()
        .map(|s| s.trim().parse().unwrap())
        .collect()
}

#[allow(dead_code)]
fn read_one<T>() -> T
where T:
std::str::FromStr,
T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.trim().parse().unwrap()
}

Measured memory_bytes: 4352
import sys

def main():
    input = sys.stdin.readline
    K = int(input())
    A, B = map(int, input().split())
    for i in range(A, B+1):
        if i % K == 0:
            return 'OK'
    else:
        return 'NG'

if __name__ == '__main__':
    print(main())



Measured memory_bytes: 9168
#include <algorithm>
#include <cstdint>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <cfloat>
#include <bitset>

using namespace std;

using lint=int64_t;
using uint=uint32_t;
using ulint=uint64_t;

template<class T>
using vector2d=vector<vector<T>>;

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

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

template <class T>
void OutVec(const vector<T>& vec){
  for(int i = 0; i < vec.size() - 1; ++i){
    cout<<vec[i]<<" ";
  }
  cout<<vec.back()<<endl;
}

template <class T>
void OutVec2d(const vector2d<T>& vec){
  for(auto v:vec){
    OutVec(v);
  }
}

using bs=bitset<32>;

int main(){
  cout << std::fixed << std::setprecision(16);
  cin.tie(nullptr);
  std::ios::sync_with_stdio(false);

  int n;
  cin>>n;

  vector<bs> a(n);
  for(int i=0;i<n;i++){
    int v;
    cin>>v;
    a[i]=bs(v);
  }
  vector<bs> result(n);
  for(int b=0;b<32;b++){
    int cnt=0;
    for(auto v:a){
      if(v[b]){
        cnt++;
      }
    }

    if(cnt%2==0){
      for(int i=0;i<n;i++){
        result[i][b]=a[i][b];
      }
    }else{
      for(int i=0;i<n;i++){
        result[i][b]=!a[i][b];
      }
    }
  }

  for(int i=0;i<n-1;i++){
    cout<<result[i].to_ulong()<<" ";
  }
  cout<<result.back().to_ulong()<<endl;


  return 0;
}




Measured memory_bytes: 6212
def do_calc(data):
    from collections import deque
    s = deque()  # ??????????????¨??????????????????
    while data:
        elem = data[0]  # ?????????????????????????????????

        # ???????????§????????°?????´??????????????????pop??§????????????????¨????????????????????????????????????????
        if elem == '+' or elem == '-' or elem == '*':
            a = s.pop()
            b = s.pop()
            if elem == '+':
                s.append(b + a)
            elif elem == '-':
                s.append(b - a)
            elif elem == '*':
                s.append(b * a)
        # ??°?????§????????°????????????????????????
        else:
            s.append(int(elem))

        # ?¬??????????????????????????????????????????????????????¨??????
        data = data[1:]
    return s.pop()


if __name__ == '__main__':
    # ??????????????\???
    data = [x for x in input().split(' ')]
    # data = ['1', '2', '+', '3', '4', '-', '*']

    # ???????????????
    result = do_calc(data)

    # ???????????????
    print(result)

Measured memory_bytes: 8024
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_set>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<complex>
#include<tuple>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef long double D;
typedef complex<D> P;
#define F first
#define S second
const ll E=1e18+7;
const ll MOD=1000000007;


template<typename T,typename U>istream & operator >> (istream &i,pair<T,U> &A){i>>A.F>>A.S; return i;}
template<typename T>istream & operator >> (istream &i,vector<T> &A){for(auto &I:A){i>>I;} return i;}
template<typename T,typename U>ostream & operator << (ostream &o,pair<T,U> &A){o<<A.F<<" "<<A.S; return o;}
template<typename T>ostream & operator << (ostream &o,vector<T> &A){ll i=A.size(); for(auto &I:A){o<<I<<(--i?" ":"");} return o;}
template<typename T>vector<T> & cset(vector<T> &A,T e=T()){for(auto &I:A){I=e;} return A;}



int main(){
    ll h,w;
    cin>>h>>w;
    vector<string> A(h);
    cin>>A;
    vector<vector<ll>> dp(h,vector<ll>(w,h));
    for(ll i=h-2;i>=0;i--){
        for(int j=0;j<w;j++){dp[i][j]=(A[i+1][j]=='#'?i+1:dp[i+1][j]);}
    }
    ll ans=0;
    vector<ll> dp3(w,-1);
    for(ll i=0;i<h;i++){
        vector<ll> dp2(w,w);
        for(ll j=w-2;j>=0;j--){dp2[j]=(A[i][j+1]=='#'?j+1:dp2[j+1]);}
        ll le=-1;
        for(int j=0;j<w;j++){
            if(A[i][j]=='#'){
                dp3[j]=i;
                le=j;
            }
            else{
                ans=max(ans,dp2[j]-le-1+dp[i][j]-dp3[j]-1-1);
            }
        }
    }
    cout<<ans<<endl;
    
    return 0;
}


Measured memory_bytes: 35712
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
#define int long long
#define ull unsigned long long
#define ld long double
#define rep(a) rep1(i,a)
#define rep1(i,a) rep2(i,0,a)
#define rep2(i,b,a) for(int i=(b); i<((int)(a)); i++)
#define rep3(i,b,a) for(int i=(b); i>=((int)(a)); i--)
#define all(a) a.begin(),a.end()
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define sz(a) ((int)a.size())
#define pow2(x) (1ll<<(x))
#define ceiling(a,b) (((a)+(b)-1)/(b))
#define print0(a) cout << (a) << ' '
#define print1(a) cout << (a) << '\n'
#define print2(a,b) cout << (a) << ' ',print1(b)
#define print3(a,b,c) cout << (a) << ' ',print2(b,c)
#define print4(a,b,c,d) cout << (a) << ' ',print3(b,c,d)
#ifdef i_am_noob
#define debug(a) print2(#a,a)
#else
#define debug(a) 
#endif
#define ordered_set tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>
 
using namespace std;
using namespace __gnu_pbds;
 
const int Mod=1000000007,Mod2=998244353;
const int MOD=Mod2;
 
inline int add(int a, int b){return (a+b>=MOD?a+b-MOD:a+b);}
inline int sub(int a, int b){return (a+MOD-b>=MOD?a-b:a+MOD-b);}
int Pow(int a, int b){
	if(!b) return 1;
	int tmp=Pow(a*a%MOD,b>>1);
	return (b&1?tmp*a%MOD:tmp);
}
inline int inverse(int n){return Pow(n,MOD-2);}
 
const int maxn=100005;
//i_am_noob
int n,a[105],cnt1,cnt2,ans=4e18;

signed main(){
	ios_base::sync_with_stdio(0),cin.tie(0);
	cin >> n;
	rep(n) cin >> a[i];
	rep(n-1){
		cnt1=cnt2=0;
		rep1(j,n) j>i?cnt1+=a[j]:cnt2+=a[j];
		ans=min(ans,abs(cnt1-cnt2));
	}
	print1(ans);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize ("Ofast")
#define int long long 
#define ld long double
#define pb push_back
#define vi vector<int>
#define pii pair<int,int>
#define ff first
#define ss second
#define endl '\n'
#define all(v) v.begin(),v.end()
#define sz(v) (int)v.size()
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n;i>=0;i--)
#define loop(i,l,r) for(int i=l;i<r;i++)
#define rloop(i,r,l) for(int i=r;i>=l;i--)
#define watch(x) cerr<<(#x)<<"= "<<(x)<<endl;
#define watcharr(a) cerr<<(#a)<<"("<<sz(a)<<")= ";rep(i,sz(a))cerr<<a[i]<<",";cerr<<'\n';
#define inf 2000000000000000000LL
#define mod 1000000007
#define mod1 998244353
#define FASTIO std::ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
using namespace std;

int n,w;
int dp[105][100005];

signed main() {
    FASTIO;
    // #ifndef ONLINE_JUDGE
    //     freopen("input.txt", "r", stdin);
    //     freopen("output.txt", "w", stdout);
    //     freopen("stderr.txt", "w", stderr);
    // #endif

    // int tt=1;
    // cin>>tt;
    // while(tt--){
        // int n,w;
        cin>>n>>w;
        vi a(n),b(n);
        rep(i,n) cin>>a[i]>>b[i];
        
        rep(i,n+1){
            rep(j,w+1){
                if(i==0 or j==0) 
                    dp[i][j]=0;
                else if(a[i-1]<=j) 
                    dp[i][j]=max(b[i-1]+dp[i-1][j-a[i-1]],dp[i-1][j]);
                else dp[i][j]=dp[i-1][j];
            }
        }
        // rep(i,n+1){ rep(j,w+1) cerr<<dp[i][j]<<' '; cerr<<endl;}
        cout<<dp[n][w]<<endl;
        
        
    // }
    cerr<<"Time Elapsed: "<<1.0*clock()/CLOCKS_PER_SEC<<" sec";
    return 0;
}

Measured memory_bytes: 80128
#include <bits/stdc++.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

using namespace std;

typedef long long int lli;

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;}

#ifdef LOCAL
	#define eprintf(...) printf(__VA_ARGS__)
#else 
	#define eprintf(...) 1
#endif

#define ROUNDUP(a, b) 		( ((a) + ((b) - 1) ) / b)
#define SET_ZERO(a)	 		( memset((a), 0, sizeof(a)))
#define SET_NUM_ARRAY(a,b)	( memset((a), b, sizeof(a)))

int main() {
	int N, M;
	scanf("%d %d", &N, &M);
	vector<int> vec1, vecN;
	for (int i = 0; i < M; i++) {
		int a, b;
		scanf("%d %d", &a, &b);
		if (a == 1)vec1.push_back(b);
		if (b == 1)vec1.push_back(a);
		if (a == N)vecN.push_back(b);
		if (b == N)vecN.push_back(a);
	}
	sort(vec1.begin(), vec1.end());
	sort(vecN.begin(), vecN.end());
	if (!(vec1.empty() || vecN.empty())) {
		for (vector<int>::iterator it = vec1.begin(); it != vec1.end(); ++it) {
			int i = *it;
			vector<int>::iterator ans = lower_bound(vecN.begin(), vecN.end(), i);
			if (*ans == i) {
				printf("POSSIBLE\n");
				return 0;
			}
		}
	}
	printf("IMPOSSIBLE\n");
	return 0;
}


Measured memory_bytes: 1276
#include<iostream>
using namespace std;
int main(void)
{
    int n,x,y,b,p,A,B;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>x>>y>>b>>p;
        A=x*b+y*p;
        if(b>=5&&p>=2){
            A=A*0.8;
            B=1000000;
        }
        else if(b>=5) B=(x*b+y*2)*0.8;
        else if(p>=2) B=(x*5+y*p)*0.8;
        else B=0.8*(x*5+y*2);
        if(A>B)cout<<B<<"\n";
        else cout<<A<<"\n";
    }
}

Measured memory_bytes: 1160
class Segtree:
    def __init__(self, original, func, element):
        self.n = len(original)
        self.element = element
        self.func = func
        self.N0 = 1 << (n-1).bit_length()
        self.seg = [element]*(self.N0 << 1)
        for i, j in enumerate(original, self.N0):
            self.seg[i] = j
        for i in range(self.N0-1, 0, -1):
            self.seg[i] = func(self.seg[2*i], self.seg[2*i+1])

    def get(self, i):
        return self.seg[i+self.N0]
        
    def update(self, i, x):
        i += self.N0
        self.seg[i] = x
        while i > 1:
            y = self.seg[i ^ 1]
            if y <= x:
              break
            i >>= 1
            x = self.func(x, y)
            self.seg[i] = x
                
    def query(self, l, r):
        res = self.element
        l += self.N0
        r += self.N0
        while l < r:
            if r & 1:
                res = self.func(res, self.seg[r-1])
            if l & 1:
                res = self.func(res, self.seg[l])
                l += 1
            l >>= 1
            r >>= 1
     
        return res

    
import sys
input = sys.stdin.readline
from fractions import gcd
n = int(input())
A = list(map(int, input().split()))
seg = Segtree(A, gcd, 0)
ans = 0
for i in range(n):
  left = seg.query(0, i)
  right = seg.query(i+1, n)
  temp = gcd(left, right)
  ans = max(ans, temp)
print(ans)

Measured memory_bytes: 16168
/// Ernestico
#include <bits/stdc++.h>
#define maxn 500005

using namespace std;

typedef long long ll;
typedef pair <int,int> par;

char cad[maxn];
int num[maxn], l, K[maxn], lk, sum[maxn];

bool check ( int k ) {
    memset ( K, 0, sizeof K );
    int tmp = 9*k;
    lk = 0;
    while ( tmp ) {
        K[++lk] = tmp%10;
        tmp /= 10;
    }
    int maxl = max ( l, lk ), s = 0, a;
    for ( int i = 1; i <= maxl; i ++ ) {
        a = ( num[i] + K[i] + s );
        sum[i] = a % 10;
        s = a/10;
    }
    if ( s ) sum[++maxl] = s;
    int acc = accumulate ( sum+1, sum+1+maxl, 0 );

    return acc <= 9*k;
}

int main () {
    #ifdef home
    freopen ("a.in", "r", stdin );
    freopen ("a.out", "w", stdout );
    #endif // home
    ios_base::sync_with_stdio(0), cin.tie(0);

    cin >> cad+1;
    l = strlen(cad+1);
    reverse ( cad+1, cad+1+l );
    for ( int i = 1; i <= l; i ++ )
        num[i] = cad[i]-'0';

    int s = 0, a;
    for ( int i = 1; i <= l; i ++ ) {
        a = (num[i] * 9 + s);
        num[i] = a%10;
        s = a/10;
    }
    if ( s ) num[++l] = s;

    int ini = 1, fin = l, piv;
    while ( ini != fin ) {
        piv = (ini+fin)>>1;
        if ( check(piv) ) fin = piv;
        else ini = piv+1;
    }
    cout << ini;
    return 0;
}


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

int main()
{
    int H, W;
    cin >> H >> W;
    int aij;
    vector<vector<int>> A(H, vector<int>(W, 0));
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            cin >> aij;
            if(i%2==0) A[i][j]     = aij%2;
            else       A[i][W-j-1] = aij%2;
        }
    }
    vector<array<int,4>> res;
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            if(A[i][j]==0) continue;
            if(j==W-1){
                if(i==H-1) break;
                A[i+1][0]++;
                A[i+1][0]%=2;
                res.push_back(array<int,4>{i,j,i+1,0});
            }else{
                A[i][j+1]++;
                A[i][j+1]%=2;
                res.push_back(array<int,4>{i,j,i,j+1});
            }
        }
    }
    cout<<res.size()<<endl;
    for(auto r : res){
        cout << 1 + r[0] << " "
             << 1 + (r[0]%2==0? r[1] : W-r[1]-1) << " "
             << 1 + r[2] << " "
             << 1 + (r[2]%2==0? r[3] : W-r[3]-1)
             << endl;
    }

    return 0;
}


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

int main() {
    int N; cin >> N;
    char S[N]; for (int i = 0; i < N; ++i) cin >> S[i];

    int r[N], g[N], b[N];
    int sr = 0;
    int sg = 0;
    int sb = 0;
    for (int i = 0; i < N; ++i) {
        if (S[i] == 'R') sr++;
        if (S[i] == 'G') sg++;
        if (S[i] == 'B') sb++;
        r[i] = sr;
        g[i] = sg;
        b[i] = sb;
    }

    ll res = 0;
    for (int i = 0; i < N - 2; ++i) {
        char refi = S[i];
        for (int j = i + 1; j < N - 1; ++j) {
            char refj = S[j];
            if (refj != refi) {
                if (refi == 'R') {
                    if (refj == 'G') {
                        res += sb - b[j];
                        int t = 2 * j - i;
                        if (t < N) {
                            if (S[t] == 'B') res--;
                        }
                    } else {
                        res += sg - g[j];
                        int t = 2 * j - i;
                        if (t < N) {
                            if (S[t] == 'G') res--;
                        }
                    }
                } else if (refi == 'G') {
                    if (refj == 'B') {
                        res += sr - r[j];
                        int t = 2 * j - i;
                        if (t < N) {
                            if (S[t] == 'R') res--;
                        }
                    } else {
                        res += sb - b[j];
                        int t = 2 * j - i;
                        if (t < N) {
                            if (S[t] == 'B') res--;
                        }
                    }
                } else if (refi == 'B') {
                    if (refj == 'R') {
                        res += sg - g[j];
                        int t = 2 * j - i;
                        if (t < N) {
                            if (S[t] == 'G') res--;
                        }
                    } else {
                        res += sr - r[j];
                        int t = 2 * j - i;
                        if (t < N) {
                            if (S[t] == 'R') res--;
                        }
                    }
                }
            }
        }
    }
    cout << res << endl;
    return 0;
}

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

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

  int ac = 0 , wa = 0 ,tle = 0, re  = 0;
  for(int i=0;i<n;i++){
    if(s[i] == "AC"){
      ac++;
    }
    else if(s[i] == "WA"){
      wa++;
    }
    else if(s[i] == "TLE"){
      tle++;
    }
    else if(s[i] == "RE"){
      re++;
    }
  }

  cout<<"AC x "<<ac<<"\n";
  cout<<"WA x "<<wa<<"\n";
  cout<<"TLE x "<<tle<<"\n";
  cout<<"RE x "<<re<<"\n";

  return 0;
}

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

#define ll long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define uniqueV(x) sort(x.begin(), x.end()); x.erase(unique(x.begin(), x.end()), x.end());
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))
#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define debug3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;
#define debugB(x, y) cerr<<#x<<": "<<bitset<y>(x) << endl;
#define line() cerr << "---------------" << endl;

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

template<typename T>
void printA(vector<T> &printArray, char between = ' ') {
   int paSize = printArray.size();
   for (int i = 0; i < paSize; i++) { cerr << printArray[i] << between;}
   if (between != '\n') {cerr << endl;}
}

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

int main() {
   int n;
   cin >> n;
   vec<int> v(n);
   rep (i, n) {
      cin >> v[i];
   }

   rep (i, n) {
      repp (j, 1, n) {
         if (i == j) continue;
         if (abs(v[i]-v[j])%(n-1) == 0) {
            printf("%d %d\n", v[i], v[j]);
            return 0;
         } 
      }
   }

   return 0;
}


Measured memory_bytes: 3220
import java.util.*;

class Main{
    static int Palindromic(int n){
        int ans;
        int[] t = new int[5];
        for(int i = 0; i < 5; i++){
            t[i] =  n % 10;
            n /= 10;
        }
        ans = 10000 * t[0] + 1000 * t[1] + 100 * t[2] + 10* t[3] + t[4];
        return ans;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();

        int count = 0;
        for(int i = A; i <= B; i++){
            if(i == Palindromic(i)) count++;
        }

        System.out.println(count);
    }
}

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

int N;
long double t[110], v[110], lim[110];

signed main() {
    cin.tie(0); ios::sync_with_stdio(false);
    cin >> N;
    rep(i, N) cin >> t[i];
    rep(i, N) cin >> v[i];
    for (int i=N-2; i>=0; i--) lim[i] = min({lim[i+1]+t[i+1], v[i], v[i+1]});
    double ans = 0, now_spe = 0;
    rep(i, N) {
        if (now_spe+t[i]<lim[i]) {
            ans += (2*now_spe+t[i])*t[i]/2.0;
            now_spe += t[i];
        }
        else {
            double max_spe = min(v[i], (t[i]+lim[i]+now_spe)/2);
            ans += (now_spe+max_spe)*(max_spe-now_spe)/2;
            ans += (lim[i]+max_spe)*(max_spe-lim[i])/2;
            ans += max_spe*(t[i]-(max_spe-now_spe)-(max_spe-lim[i]));
            now_spe = lim[i];
        }
    }
    cout << fixed << setprecision(10) << ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int a;
        int b;
        int c;
        a = scan.nextInt();
        b = scan.nextInt();
        c = scan.nextInt();

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

Measured memory_bytes: 21844
#include <stdio.h>
#include <stdlib.h>
#define NIL NULL
struct node{
  int key;
  struct node *parent, *left, *right;
};
typedef struct node * Node;
Node root;

void insert(int);
void inorder(Node);
void preorder(Node);
Node treeSearch(Node,int);

int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ )
  {
    scanf("%s", com);
    if ( com[0] == 'f' )
    {
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    }
    if ( com[0] == 'i' )
    {
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' )
    {
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
  }
  return 0;
}

void insert(int k){
  Node y = NIL; 
  Node x = root;
  Node z;
  z=malloc(sizeof(struct node));
  z->key=k;
  z->left=NIL;
  z->right=NIL;
  while (x != NIL)
  {
    y = x;
    if( z->key < x->key) x = x->left; 
    else x = x->right; 
  }
  z->parent = y;
  if (y == NIL) 
    root = z;
  else if (z->key < y->key)
    y->left = z; 
  else 
    y->right = z; 
}
void inorder(Node u)
{
  if(u==NIL) return;
  inorder(u->left);
  printf(" %d",u->key);
  inorder(u->right);
}
void preorder(Node u)
{
  if(u==NIL) return;
  printf(" %d",u->key);
  preorder(u->left);
  preorder(u->right);
}

Node treeSearch(Node u, int k)
{
  while(u != NIL && k != u->key)
  {
    if(k < u->key) u=u->left;
    else u=u->right;
  }
  return u;
}


Measured memory_bytes: 20452
h,w=map(int,input().split())
a=[list(map(int,input().split()))for _ in range(h)]
b=[list(map(int,input().split()))for _ in range(h)]
c=[[abs(a[i][j]-b[i][j]) for j in range(w)]for i in range(h)]
dp=[[0]*(w+1)for _ in range(h+1)]
dp[0][1]=1<<12800
for i in range(1,h+1):
    for j in range(1,w+1):
        t=c[i-1][j-1]
        dp[i][j]=(dp[i][j-1]<<t)|(dp[i][j-1]>>t)|(dp[i-1][j]<<t)|(dp[i-1][j]>>t)
ans=10**20
for i in range(25601):
    if dp[h][w]&(1<<i):
        ans=min(ans,abs(12800-i))
print(ans)


Measured memory_bytes: 90160
// 🐋💭
import Foundation

func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

func readInt() -> Int {
    return Int(readLine()!)!
}

func readDoubles () -> [Double] {
    return readLine()!.split(separator: " ").map { Double($0)! }
}

func readDouble() -> Double{
    return Double(readLine()!)!
}
///最大公約数を返す
func gcd(_ m:Int, _ n:Int) -> Int {
    if n == 0 {return m}
    return gcd(n, m % n)
}
///最小公倍数を返す
func lcm(_ m:Int, _ n:Int) -> Int {
    return m * n / gcd(m, n)
}

///素数判定(試し割り)
func isPrime(_ x:Int) -> Bool {
    if x <= 1 || x % 2 == 0 { return false }
    if x == 2 { return true }
    for i in stride(from: 3, to: Int(ceil(sqrt(Double(x)))), by: 2){
        if x % i == 0 {
            return false
        }
    }
    return true
}

//https://program-life.com/669
///実行速度の計測
func exectionTime(action: () -> Void) {
    let startDate = Date()
    action()
    let endDate = Date()
    print(endDate.timeIntervalSince(startDate))
}

// https://melheaven.hatenadiary.jp/entry/atcoder144
///約数の配列を返す
func makeDivisors(_ n:Int) -> [Int] {
    var divisors = [Int]()
    for i in 1..<Int(pow(Double(n), 0.5)) + 1 {
        if n % i == 0{
            divisors.append(i + n / i)
        }
    }
    
    return divisors
}

//https://riptutorial.com/ja/swift/example/14738/インデックスを知らずに配列から要素を削除する
extension Array where Element: Equatable {
    
    mutating func remove(_ element: Element) {
        _ = index(of: element).flatMap {
            self.remove(at: $0)
        }
    }
}

func binarySearch(rifgt:Int, key:Int, ary:[String]) -> Int{
    var left = 0
    var right = rifgt
    
    while abs(right - left) > 1 {
        let mid = left + (right - left) / 2
        
        if Int(ary[mid])! < key {
            left = mid
            
        } else {
            right = mid
        }
    }
    return left
}

func arrangement (prev:String, ary:[String], returnVal:[String]) -> [String] {
    var returnVal = returnVal
    if ary.count == 0 {
        returnVal.append(prev)
        return returnVal
    }
    
    for s in ary {
        let wprev = prev + s
        var wary = ary
        wary.remove(s)
        returnVal = arrangement(prev: wprev, ary: wary, returnVal: returnVal)
    }
    return returnVal
}

func main() {
    let (n, a, b, c, d, e) = (readDouble(), readDouble(), readDouble(), readDouble(), readDouble(), readDouble())
    
    print(Int(ceil(n / min(a, b, c, d, e))) + 4)
}
main()


Measured memory_bytes: 13320
package main

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

func main() {
	N := ReadInt()
	m := make(map[string]bool)
	prev := ReadString()
	m[prev] = true
	for i := 1; i < N; i++ {
		next := ReadString()
		if m[next] {
			fmt.Println("No")
			return
		}
		m[next] = true
		if prev[len(prev)-1] != next[0] {
			fmt.Println("No")
			return
		}
		prev = next
	}
	fmt.Println("Yes")
}

var reader = bufio.NewReader(os.Stdin)

func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}
func ReadInt() (i int)       { Scan(&i); return }
func ReadString() (s string) { Scan(&s); return }


Measured memory_bytes: 1860
import java.util.Scanner;

class Main
{
    public static void main( String[] args ) {
    	Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        long j = 0;
        for (long i = 1;i <= Math.floor(Math.sqrt(n));i ++) {
        	if (n % i == 0) {
        		j = i;
        	}
        	
        }
        System.out.println(j + (n/j) - 2);
          
    }
}

Measured memory_bytes: 22996
#include<iostream>
#include<algorithm>
#include<math.h>
#include<queue>
#include<vector>
#include<climits>
#include<map>
#include<string>
#include<functional>
#include<iomanip>
#include<deque>
#include<random>
#include<set>
#include<bitset>

using namespace std;
typedef long long ll;
typedef double lldo;
#define mp make_pair
#define pub push_back
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
ll gcd(ll a, ll b) { if (a % b == 0) { return b; } else  return gcd(b, a % b); }
ll lcm(ll a, ll b) { if (a == 0) { return b; }return a / gcd(a, b) * b; }
template<class T>ll LBI(vector<T>& ar, T in) { return lower_bound(ar.begin(), ar.end(), in) - ar.begin(); }
template<class T>ll UBI(vector<T>& ar, T in) { return upper_bound(ar.begin(), ar.end(), in) - ar.begin(); }

const ll INF = (ll)1e18 + 1;
ll n, k, Minus = 0, zero = 0, Plus = 0, a[200000] = {}, ans = 0, ans2 = 0;
bool isPlus = true;

int main() {
	random_device seed_gen;
	mt19937_64 rnd(seed_gen());
	uniform_int_distribution<int> dist_N(4, 10), dist_A(-20, 20);
	cin >> n >> k;
	rep(i, n) {
		cin >> a[i];
		if (a[i] > 0) {
			Plus++;
		}
		else if (a[i] == 0) {
			zero++;
		}
		else {
			Minus++;
		}
	}
	stable_sort(a, a + n);
	if (Plus * Minus >= k) {
		isPlus = false;
	}
	else if (Plus * Minus + zero * (n - 1) - zero * (zero - 1) / 2 >= k) {
		cout << 0 << endl;
		return 0;
	}
	if (isPlus) {
		ll l = 0, r = INF;
		while (l + 1 < r) {
			ll mid = (l + r) / 2, cur = 0, sum = 0;
			for (int i = Minus - 1; i >= 0; i--) {
				while (a[i] * a[cur] >= mid && cur < Minus - 1) cur++;
				if (a[i] * a[cur] < mid) {
					sum += n - cur - zero;
					if (i >= cur)sum--;
				}
				else {
					sum += Plus;
				}
			}
			cur = n - 1;
			for (int i = Minus + zero; i < n; i++) {
				while (a[i] * a[cur] >= mid && cur > Minus + zero)cur--;
				if (a[i] * a[cur] < mid) {
					sum += cur - zero + 1;
					if (i <= cur)sum--;
				}
				else {
					sum += Minus;
				}
			}
			sum /= 2;
			sum += (n - 1) * zero - zero * (zero - 1) / 2;
			if (sum < k) {
				l = mid;
			}
			else {
				r = mid;
			}
		}
		ans = l;
	}
	else {
		ll l = -INF, r = 0;
		while (l + 1 < r) {
			ll mid = (l + r) / 2, cur = Minus + zero, sum = 0;
			rep(i, Minus) {
				while (a[i] * a[cur] >= mid && cur < n - 1)cur++;
				if (a[i] * a[cur] < mid)sum += n - cur;
			}
			if (sum < k) {
				l = mid;
			}
			else {
				r = mid;
			}
		}
		ans = l;
	}
	cout << ans << endl;
	return 0;
}

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

#define fi first
#define se second

const int N = 55;

using namespace std;

int n;
int p[N];
int x[N];
int y[N];

int get(int x)
{
        return x == p[x] ? x : p[x] = get(p[x]);
}

int solve(int a, int b)
{
        for(int i = 1; i <= n; i++){
                p[i] = i;
        }
        for(int i = 1; i <= n; i++){
                for(int j = 1; j <= n; j++){
                        if(x[i] + a == x[j] && y[i] + b == y[j]){
                                int A = get(i);
                                int B = get(j);
                                if(A != B){
                                        p[A] = B;
                                }
                        }
                }
        }
        int res = 0;
        for(int i = 1; i <= n; i++){
                res += get(i) == i;
        }
        return res;
}

int main()
{
        //freopen("input.txt", "r", stdin);
        //freopen("output.txt", "w", stdout);
        ios_base::sync_with_stdio(0);

        cin >> n;
        for(int i = 1; i <= n; i++){
                cin >> x[i] >> y[i];
        }
        int res = n;
        for(int i = 1; i <= n; i++){
                for(int j = 1; j <= n; j++){
                        res = min(res, solve(x[i] - x[j], y[i] - y[j]));
                }
        }
        cout << res << "\n";
}


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

using namespace std;

int n;

signed main() {
	cin >> n;
	string bla;
	cout << 0 << "\n";
	cout.flush();
	cin >> bla;
	if (bla == "Vacant") {
		return 0;
	}
	int res = 0;
	string temp;
	for (int i = 30; i >= 0; i--) {
		if ((1<<i) <= n-1 && res + (1<<i) <= n-1 ) {
			cout << res + (1<<i) << "\n";
			cout.flush();
			cin >> temp;
			if (temp == "Vacant"){
				return 0;
			}
			else {
				if (temp == bla) {
					res += (1<<i);
				}
			}
		}
	}
	cout << res + 1 << "\n";
	cin >> temp;
	return 0; 
}

Measured memory_bytes: 852
<?php
list($N, $C) = ints();
$T = 10 ** 5;
$cusum = array_fill(0, $C, array_fill(0, $T, 0));
for ($i = 0; $i < $N; ++$i) {
    list($s, $t, $c) = ints();
    --$s;
    --$t;
    --$c;
    ++$cusum[$c][$s];
    if ($t + 1 < $T) --$cusum[$c][$t + 1];
}
$max = 0;
for ($i = 0; $i < $T; ++$i) {
    $cnt = 0;
    for ($j = 0; $j < $C; ++$j) {
        $cusum[$j][$i] += $cusum[$j][$i - 1] ?? 0;
        $cnt += min(1, $cusum[$j][$i]);
    }
    $max = max($max, $cnt);
}
echo $max;
function ints()
{
    return array_map('intval', explode(' ', trim(fgets(STDIN))));
}


Measured memory_bytes: 109752