akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;

#define ASC(vec) vec.begin(), vec.end()		// 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()	// 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(i = 0; i < n; i++)

const int inf = (int)1e9 + 7;
const long long INF = 1LL << 60;

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

typedef long long ll;

// 4,8方向に探索する際に用いる配列
//int dx[4] = { 0,  0, 1, -1 };
//int dy[4] = { 1, -1, 0,  0 };
//int dx[8] = { 1, 0, -1,  0, 1, -1, -1,  1 };
//int dy[8] = { 0, 1,  0, -1, 1,  1, -1, -1 };

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

	vector<int> A(N);

	int i;
	rep(i, N) cin >> A[i];

	int ans = ceil((double)(N - 1) / (double)(K - 1));

	cout << ans << endl;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;(i)--)
#define rrep1(i,n) for(int i=((int)(n));i>0;(i)--)
#define sz(c) ((int)(c).size())
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define fi first
#define se second

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> P;
typedef pair<int, pair<int, int> > PP;
const int MAX=2e5+10;
const ll MOD=1e9+7;

int N;
int x[100], y[100], h[100];
int mh=1e9+1e8;
void input(){
	cin>>N;
	rep(i,N)cin>>x[i]>>y[i]>>h[i];
	rep(i,N){
		mh=min(mh, h[i]);
	}
}

int ax, ay, ah;
void solve(){
	rep(i,101)rep(j,101)rep(k,201){
		int th=mh+k;
		bool ok=true;
		rep(p,N){
			if(max(0, th-abs(i-x[p])-abs(j-y[p]))!=h[p]){
				ok=false;
				break;
			}
		}
		if(ok){
			ax=i;
			ay=j;
			ah=th;
		}
	}
	cout<<ax<<" "<<ay<<" "<<ah<<endl;
}

void output(){
}

int main(){
  input();
  solve();
  output();
}

Measured memory_bytes: 256
N = int(input())
#1 - 9                  9
#100 - 999              900
#10000 - 99999          90000

#10 - 99                90
#1000 - 9999            9000

if N == 100000:
    print("90909")
elif N > 9999:
    print(N - 9090)
elif N > 999:
    print("909")
elif N > 99:
    print(N - 90)
elif N > 9:
    print("9")
else:
    print(N)

Measured memory_bytes: 2940
users = []
opened = false

user_line_count = gets.strip.to_i
user_line_count.times { users << gets.strip }

data_line_count = gets.strip.to_i
data_line_count.times do
  user = gets.strip
  if users.include?(user)
    opened = !opened
    puts "#{opened ? 'Opened' : 'Closed'} by #{user}"
  else
    puts "Unknown #{user}"
  end
end



Measured memory_bytes: 6876
/*
confirm 0LL and 1LL
confirm cornercases such as 0
confirm times of cin < 10^6
*/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Pld = pair<ld, ld>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecD = vector<ld>;
using VecS = vector<string>;
using Graph = vector<VecP>;
template <typename T>
using Vec1 = vector<T>;
template <typename T>
using Vec2 = vector<Vec1<T> >;
#define REP(i, m, n) for(ll (i) = (m); (i) < (n); ++(i))
#define REPN(i, m, n) for(ll (i) = (m); (i) <= (n); ++(i))
#define REPR(i, m, n) for(ll (i) = (m)-1; (i) >= (n); --(i))
#define REPNR(i, m, n) for(ll (i) = (m); (i) >= (n); --(i))
#define rep(i, n) REP(i, 0, n)
#define repn(i, n) REPN(i, 1, n)
#define repr(i, n) REPR(i, n, 0)
#define repnr(i, n) REPNR(i, n, 1)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define fs first
#define sc second
template <typename T>
bool chmax(T &a, const T b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T b){if(a > b){a = b; return true;} return false;}
template <typename T>
ll pow2(const T n){return (1LL << n);}
template <typename T>
void cosp(const T n){cout << n << ' ';}
void co(void){cout << '\n';}
template <typename T>
void co(const T n){cout << n << '\n';}
template <typename T1, typename T2>
void co(pair<T1, T2> p){cout << p.fs << ' ' << p.sc << '\n';}
template <typename T>
void co(const Vec1<T> &v){for(T i : v) cosp(i); co();}
template <typename T>
void co(initializer_list<T> v){for(T i : v) cosp(i); co();}
template <typename T>
void ce(const T n){cerr << n << endl;}
void sonic(){ios::sync_with_stdio(false); cin.tie(0);}
void setp(const ll n){cout << fixed << setprecision(n);}
constexpr int INF = 1e9+1;
constexpr ll LINF = 1e18+1;
constexpr ll MOD = 1e9+7;
//constexpr ll MOD = 998244353;
constexpr ld EPS = 1e-11;
const ld PI = acos(-1);

int main(void){
	ll n, k;
	cin >> n >> k;
	n -= n / k * k;

	co(min(n, abs(k - n)));

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <algorithm>

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

using namespace std;

int main() {
  int n,m;
  cin>>n>>m;
  vector<int> v(m);
  REP(i,m)cin>>v[i];
  vector<vector<int>> dp(m+1,vector<int>(n+10001,100000000));
  dp[0][0] = 0;
  REP(i,m){
    REP(j,n+1){
      dp[i+1][j] = min(dp[i+1][j], dp[i][j]);
      dp[i][j+v[i]] = min(dp[i][j+v[i]], dp[i][j]+1);
    }
  }
  cout << dp[m][n] << endl;
  return 0;
}

Measured memory_bytes: 6276
#include "bits/stdc++.h"
using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define LL long long

LL a[100000],b[100000];
int n;
vector<LL> v;

int main(){
  cin>>n;
  REP(i,n)
    cin>>a[i]>>b[i];
  REP(i,n){
    v.push_back(a[i]);
    v.push_back(b[i]);
  }
  sort(v.begin(),v.end());
  
  LL ret=LLONG_MAX,tmp=0;
  REP(i,n)
    tmp+=a[i];
  ret=min(ret,tmp);
  tmp=0;
  REP(i,n)
    tmp+=b[i];
  ret=min(ret,tmp);
  tmp=0;

  LL su=0;
  REP(i,n){
    su+=v[i];
  }
  REP(i,n){
    tmp=0;
    auto it = lower_bound(v.begin(),v.end(),a[i]);
    int d = distance(v.begin(),it);
    auto it2 = lower_bound(v.begin(),v.end(),b[i]);
    int d2 = distance(v.begin(),it2);
    if(d < n && d2 < n && !(d == n-1 && d2 == n-1)){
      tmp = su;
    }else if(d == n-1 && d2 == n-1){
      tmp = su + b[i] - v[n-2];
    }else{
      if(d >= n && d2 >= n){
	tmp = su + a[i] + b[i] - v[n-1] - v[n-2];
      }else if(d >= n){
	tmp =(d2==n-1)? su + a[i] - v[n-2]:su + a[i] - v[n-1];
      }else if(d2 >= n){
	tmp =(d==n-1)? su + b[i] - v[n-2]:su + b[i] - v[n-1];
      }
    }
    //cerr<<tmp<<endl;
    ret=min(ret,tmp);
  }
  cout<<ret<<endl;
  return 0;
}


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

int main() {
	int N,K; cin >> N >> K;
	vector<bool> A(N);
	for (int i = 0; i < N; i++)
	{
		A[i] = false;
	}
	for (int i = 0; i < K; i++)
	{
		int d; cin >> d;
		for (int j = 0; j < d; j++)
		{
			int a; cin >> a;
			for (int k = 0; k < N; k++)
			{
				if (a == k+1) {
					A[k] = true;
					break;
				}
			}
		}
	}
	int cnt = 0;
	for (int i = 0; i < N; i++)
	{
		if (A[i] == false)cnt++;
	}
	cout << cnt << endl;
}


Measured memory_bytes: 3628
/* --- author: dxm --- */
#include<bits/stdc++.h>
#pragma GCC optimize(2)
using namespace std;

#define INF 1e9
#define Inf 1e18
#define rep(i,n) for(int (i)=0;(i)<n;i++)
#define REP(i,n) for(int (i)=1;(i)<=n;i++)
#define mp make_pair
#define pb push_back
#define fst first
#define snd second
typedef long long ll;
typedef double db;
typedef long double ldb;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;

void qread(int &x){
	int neg=1;x=0;
	char c=getchar();
	while(c<'0'||c>'9'){if(c=='-')neg=-1;c=getchar();}
	while(c>='0'&&c<='9')x=10*x+c-'0',c=getchar();
	x*=neg;
}

const int maxn=200005;
int n;
ll c,h[maxn],dp[maxn];

class Line{
public:
	ll k,b;
	Line(ll _k=0,ll _b=0):k(_k),b(_b){}
};
db inter(Line a,Line b){
	return db(b.b-a.b)/db(a.k-b.k);
}

namespace Convex{
	int top;
	Line st[maxn];
	void add(Line x){
		while(top>=2&&inter(st[top-1],x)<inter(st[top-2],x))top--;
		st[top++]=x;
	}
	ll qry(ll x){
		int l=0,r=top;
		while(r-l>1){
			int mid=(l+r)>>1;
			if(x>inter(st[mid],st[mid-1]))l=mid;
			else r=mid;
		}
		return st[l].k*x+st[l].b;
	}
}

int main(){
#ifdef FILE
	freopen("FILE.in","r",stdin);
	freopen("FILE.out","w",stdout);
#endif
	scanf("%d%lld",&n,&c);
	REP(i,n)scanf("%lld",&h[i]);
	dp[1]=0;
	Convex::add(Line(-2*h[1],dp[1]+h[1]*h[1]));
	for(int i=2;i<=n;i++){
		dp[i]=Convex::qry(h[i])+h[i]*h[i]+c;
		Convex::add(Line(-2*h[i],dp[i]+h[i]*h[i]));
	}
	printf("%lld\n",dp[n]);
#ifdef TIME
	printf("Running Time = %d ms\n",int(clock()*1000.0/CLOCKS_PER_SEC));
#endif
	return 0;
}

/*
Input:
-----------------
Output:
*/


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

int main()
{
    int k, n;
    cin >> k >> n;
    int maxe = 0;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    rep(i, n - 1) {
        maxe = max(a[i + 1] - a[i], maxe);
    }
    maxe = max(maxe, k - a[n - 1] + a[0]);
    cout << k - maxe << endl;
    return 0;
}

Measured memory_bytes: 1024
;; -*- coding: utf-8 -*-
(eval-when (:compile-toplevel :load-toplevel :execute)
  (defparameter OPT
    #+swank '(optimize (speed 3) (safety 2))
    #-swank '(optimize (speed 3) (safety 0) (debug 0)))
  #+swank (progn (ql:quickload '(:cl-debug-print :fiveam))
                 (shadow :run)
                 (use-package :fiveam))
  #-swank (set-dispatch-macro-character #\# #\> (lambda (s c p) (declare (ignore c p)) (read s nil (values) t))))
#+swank (cl-syntax:use-syntax cl-debug-print:debug-print-syntax)

;; BEGIN_INSERTED_CONTENTS
(defmacro dbg (&rest forms)
  #+swank
  (if (= (length forms) 1)
      `(format *error-output* "~A => ~A~%" ',(car forms) ,(car forms))
      `(format *error-output* "~A => ~A~%" ',forms `(,,@forms)))
  #-swank (declare (ignore forms)))

(defmacro define-int-types (&rest bits)
  `(progn
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "UINT~A" b)) () '(unsigned-byte ,b))) bits)
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "INT~A" b)) () '(signed-byte ,b))) bits)))
(define-int-types 2 4 7 8 15 16 31 32 62 63 64)

(declaim (inline println))
(defun println (obj &optional (stream *standard-output*))
  (let ((*read-default-float-format* 'double-float))
    (prog1 (princ obj stream) (terpri stream))))

(defconstant +mod+ 1000000007)

;; Body
(defun find-optimum (sequence predicate &key (start 0) end)
  ;; wrong docs
  "Returns an index x that satisfies (FUNCALL PREDICATE SEQUENCE[x] SEQUENCE[y])
for all the indices y and returns SEQUENCE[x] as the second value."
  (declare ((or null (integer 0 #.most-positive-fixnum)) end)
           ((integer 0 #.most-positive-fixnum) start)
           (function predicate)
           (sequence sequence))
  (etypecase sequence
    (list (error "Not implemented yet."))
    (vector
     (let ((end (or end (length sequence))))
       (unless (<= start end)
         (error "Can't find optimal value in null interval [~A, ~A)" start end))
       (let ((optimal (aref sequence 0))
             (index 0))
         (dotimes (i (length sequence) (values index optimal))
           (unless (funcall predicate optimal (aref sequence i))
             (setq optimal (aref sequence i)
                   index i))))))))

(defun main ()
  (let* ((k (read))
         (base (make-array 50 :element-type 'uint62 :initial-element (+ 49 (floor k 50)))))
    (dotimes (_ (mod k 50))
      (let ((pos (find-optimum base #'<)))
        (incf (aref base pos) 50)
        (dotimes (i 50)
          (unless (= pos i)
            (decf (aref base i) 1)))))
    (println 50)
    (loop with init = t
          for a across base
          do (if init
                 (setq init nil)
                 (write-char #\ ))
             (write a))
    (terpri)))

#-swank(main)


Measured memory_bytes: 22116
#include<iostream>
#include<string>
#include<vector>
#include<cstdio>
#include<sstream>
#include<algorithm>
#include<cmath>
#include<map>
#include<functional>
using namespace std;
int stoi(string x){stringstream ss;ss<<x;int tmp;ss>>tmp;return tmp;}
string itos(int x){stringstream ss;ss<<x;return ss.str();}
//#define __int64 long long
#define ll __int64 
int main(){
	string n,a,b,c,tmp;
	int a1,a2=0,a3=0;
	cin>>n;
	cin>>a1;
	vector<string>ta,ta2;
	for(int i=0;i<n.size();i++){
	if(n[i]=='*'||n[i]=='+'){
	ta.push_back(tmp);
	if(n[i]=='*')ta.push_back("*");
	if(n[i]=='+')ta.push_back("+");
	tmp.clear();
	}
	else tmp.push_back(n[i]);
	}
	ta.push_back(tmp);
	a2=stoi(ta[0]);
	for(int i=1;i<ta.size();i++){
		if(ta[i]=="+"){
		a2+=stoi(ta[i+1]);
		i++;
		}
		if(ta[i]=="*"){
		a2*=stoi(ta[i+1]);
		i++;
		}
	}
	
	for(int i=0;i<ta.size();i++){
		if(ta[i]=="*"){
		ta[i]=( itos( stoi(ta[i-1])*stoi(ta[i+1]) ) );
		ta.erase(ta.begin()+i+1);
		ta.erase(ta.begin()+i-1);
		i--;
		}
	}
	for(int i=0;i<ta.size();i++){
	if(ta[i]!="+")a3+=stoi(ta[i]);
	}
	if(a1==a2&&a1==a3)cout<<"U";
	else if(a1==a2)cout<<"L";
	else if(a1==a3)cout<<"M";
	else cout<<"I";
	cout<<endl;
	return 0;
}

Measured memory_bytes: 1240
import java.util.Scanner;
 
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int D = sc.nextInt();
		int N = sc.nextInt();
		System.out.println((int)Math.pow(100,D) * ((N == 100) ? 101 : N));
	}
}

Measured memory_bytes: 23764
#include <algorithm>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

#define rep(i, n) for (int64_t i = 0; i < (n); i++)
#define irep(i, n) for (int64_t i = 0; i <= (n); i++)
#define rrep(i, n) for (int64_t i = (n)-1; i >= 0; i--)
#define rirep(i, n) for (int64_t i = n; i >= 0; i--)

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

  vector<int> a(n), b(n);
  rep(i, n) { cin >> a[i] >> b[i]; }
  sort(a.begin(), a.end());
  sort(b.begin(), b.end());

  int L = (a[(n + 1) / 2 - 1] + a[(n + 2) / 2 - 1]);
  int R = (b[(n + 1) / 2 - 1] + b[(n + 2) / 2 - 1]);
  if (n % 2 == 0) {
    cout << R - L + 1 << endl;
  } else {
    cout << R / 2 - L / 2 + 1 << endl;
  }

  return 0;
}

Measured memory_bytes: 4828
using System;
using System.Linq;

public class Program
{
    static void Main()
    {
        string s = Console.ReadLine();
        string[] str = { "eraser", "erase", "dreamer", "dream" };

        s = s.Replace(str[0], "");
        s = s.Replace(str[1], "");
        s = s.Replace(str[2], "");
        s = s.Replace(str[3], "");

        Console.WriteLine(s.Equals("") ? "YES" : "NO");
    }
}

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

typedef long long int ll;
typedef unsigned long long int ull;
#define rep(i,n) for(auto i=0;i<(n);i++)
#define rep1(i,n) for(auto i=1;i<=(n);i++)
#define all(x) (x).begin(),(x).end()

using namespace std;


struct init{ init(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20); }; }aaaaaaa;


int main(){
  ll a, b;
  cin >> a >> b;


  cout << max(a+b, max(a-b, a*b)) << endl;



  return 0;
}



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


void sort(int num[], int n);			// 配列を昇順に並び替える
long long int calcSum(int* num, int n); // 合計値を計算する

int main()
{
	int n, max, min;
	long long int sum = 0;

	cin >> n;
	
	int* num = new int[n];

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

	sort(num, n);

	min = num[0];
	max = num[n - 1];
	sum = calcSum(num, n);

	std::cout << min << ' ' << max << ' ' << sum << '\n';
	delete[] num;
}

void sort(int num[], int n)
{
	std::sort(num, num + n);
}

long long int calcSum(int* num, int n)
{
	long long int sum = 0;

	for (int i = 0;i < n;i++)
	{
		sum += num[i];
	}

	return sum;
}


Measured memory_bytes: 3172
#C

K=int(input())
ans=-1
if K==1:
    ans=1
elif K==2 or K==5 or K==10:
    ans=-1
else:
    p=0
    for i in range(1,K+1):
        p = (p*10+7)%K 
        #print(i,p)
        if p==0:
            ans=i
            break

print(ans)

Measured memory_bytes: 9072
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>

#include <cstdio>

using namespace std;

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

	int A, B, C, X, Y;
	cin >> A >> B >> C >> X >> Y;


	int money = 0;
	// Aピザ1枚最適
	bool buyA = true;
	if (C * 2 < A) {
		buyA = false;
	}

	// Bピザ1枚最適
	bool buyB = true;
	if (C * 2 < B) {
		buyB = false;
	}

	// AピザBピザ1枚ずつ最適
	bool buyAB = true;
	if (A + B < C * 2) {
		buyAB = false;
	}

	if (buyAB) {
		if (X < Y) {
			money += X * C * 2;
			Y = Y - X;
			X = 0;
		}
		else {
			money += Y * C * 2;
			X = X - Y;
			Y = 0;
		}
	}

	if (buyA) {
		money += X * A;
		X = 0;
	}
	else {
		money += X * C * 2;
		X = 0;
	}


	if (buyB) {
		money += Y * B;
		Y = 0;
	}
	else {
		money += Y * C * 2;
		Y = 0;
	}

	cout << money << '\n';


	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define f(i,n) for(int i=0;i<n;i++)
#define ll long long
#define inf LLONG_MAX
using namespace std;
int n,m,a[100004],b[100004],ans;
priority_queue<int> q;
vector<int> hi[100004];
signed main(){
	cin>>n>>m;
	for(int i=0;i<n;i++){
		cin>>a[i]>>b[i];
		if(m-a[i]>=0)hi[m-a[i]].push_back(b[i]);
	}
	for(int i=m-1;i>=0;i--){
		for(int j=0;j<(int)hi[i].size();j++){
			q.push(hi[i][j]);
		}
		if(q.size()){
			ans+=q.top();
			q.pop();
		}
	}
	cout<<ans<<endl;
}


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

int main(){
    string s;
    getline(cin, s);
    for(int i = 0; i < s.length(); i++){
        if(islower(s[i])) s[i] = toupper(s[i]);
        else if(isupper(s[i])) s[i] = tolower(s[i]);
    }
    cout << s << endl;
    return 0;
}


Measured memory_bytes: 3152
def main():
    N, X = map(int, input().split())
    p = [int(x) for x in input().split()]
    d = [abs(X-p[i]) for i in range(len(p))]
    v = d[0]
    for u in d[1:]:
        v = gcd(u, v)
    return v

def gcd(a, b):
    if a > b:
        a, b = b, a
    if a == 0: return b
    else: return gcd(b % a, a)

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

Measured memory_bytes: 14224
#include<bits/stdc++.h>
using namespace std;
int main(){
  int e,m;
  int E,z;
  int mn=1000000;
  while(1){
    mn=1000000;
    cin>>e;
    if(e==0) break;
    for(int i=0;i*i*i<=e;i++){
      for(int j=0;(j*j)+(i*i*i)<=e;j++){
	z=e-(i*i*i)-(j*j);
	mn=min(mn,i+j+z);
      }
    }	 
  cout<<mn<<endl;
  }
  return 0;
}



Measured memory_bytes: 3004
#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N,M;

template<int um> class UF {
	public:
	vector<int> par,rank,cnt;
	UF() {par=rank=vector<int>(um,0); cnt=vector<int>(um,1); for(int i=0;i<um;i++) par[i]=i;}
	void reinit() {int i; FOR(i,um) rank[i]=0,cnt[i]=1,par[i]=i;}
	int operator[](int x) {return (par[x]==x)?(x):(par[x] = operator[](par[x]));}
	int count(int x) { return cnt[operator[](x)];}
	int operator()(int x,int y) {
		if((x=operator[](x))==(y=operator[](y))) return x;
		cnt[y]=cnt[x]=cnt[x]+cnt[y];
		if(rank[x]>rank[y]) return par[x]=y;
		rank[x]+=rank[x]==rank[y]; return par[y]=x;
	}
};
UF<202020> uf;

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N>>M;
	FOR(i,M) {
		cin>>x>>y;
		uf(x-1,y-1);
	}
	int ret=0;
	FOR(i,N) ret=max(ret,uf.count(i));
	cout<<ret<<endl;
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 8656
using System;
using System.Collections.Generic;

class Program{
    static int[] A;
    static List<int> G=new List<int>();
    static int InsertionSort(int g){
        var cnt=0;
        for(var i=g; i<A.Length; i++){
            var v=A[i];
            var j=i-g;
            while(j>=0 && A[j]>v){
                A[j+g]=A[j];
                j=j-g;
                cnt++;
            }
            A[j+g]=v;
        }
        return cnt;
    }

    static int ShellSort(){
        var cnt=0;
        for(var g=1; g<=A.Length;){
            G.Add(g);
            g=3*g+1;
        }
        G.Reverse();
        foreach(var g in G){
            cnt+=InsertionSort(g);
        }
        return cnt;
    }

    public static void Main(){
        var n=int.Parse(Console.ReadLine());
        A=new int[n];
        for(var i=0; i<n; i++){
            A[i]=int.Parse(Console.ReadLine());
        }

        var cnt=ShellSort();
        var m=G.Count;

        Console.WriteLine(m);
        for(var i=0; i<m; i++){
            Console.Write(G[i]);
            if(i>=m-1){
                Console.WriteLine();
            } else{
                Console.Write(" ");
            }
        }
        Console.WriteLine(cnt);
        foreach(var a in A){
            Console.WriteLine(a);
        }
    }
}

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

int main() {
    int n;
    cin >> n;
    vector<char> stone(n);
    int r = 0;

    for (int i=0; i < n; i++) {
        cin >> stone.at(i);
        if (stone.at(i) == 'R') r++;
    }
    int cnt = 0;
    for (int i=0; i < r; i++) {
        if (stone.at(i) == 'R') cnt++;
    }

    cout << r-cnt << endl;
    return 0;
}


Measured memory_bytes: 3636
n = int(input())
li = list(map(int,input().split()))

ans_li = [0]*(n+10)

for i in li:
    ans_li[i] += 1
    
result = 0    
for i in ans_li:
    result += (i * (i-1)) // 2
    
for i in li:
    ans = result
    ans += ((ans_li[i] - 1) * (ans_li[i] - 2)) // 2- (ans_li[i] * (ans_li[i] - 1)) // 2
    print(ans)

Measured memory_bytes: 26268
#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define int long long int
#define mod 1000000007

void solve(int A[], int n)
{
    int i;
    int B[n];
    int x=0;
    for(i=0;i<n;i++)
        x = x^A[i];

    for(i=0;i<n;i++)
    {
        B[i] = x ^ A[i];
    }

    for(i=0;i<n;i++)
        cout<<B[i]<<" ";
    cout<<endl;
}

int32_t main()
 {
	//code
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    int t,n,w,k,x,i;
    //cin>>t;
    t=1;
    while(t--)
    {
        cin>>n;
        int A[n];

        for(i=0;i<n;i++)
            cin>>A[i];

        solve(A,n);
    }

	return 0;
}

Measured memory_bytes: 6676
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;

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

long long modinv(long long a, long long m=MOD) {
    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;
    /*MODの割り算の際に
    a/＝b;
    を
    a *= modinv(b,MOD);
    とする。
        */
}


bool ok(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}

void solve(){
int X;
    cin >> X;
    int ans = 0;
    for(int i=X;i<2*X;i++){
        if(ok(i)){
            cout << i << endl;
            return;
        }
    }
    return;
}

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

Measured memory_bytes: 256
// finish date: 2018/07/03
#include <iostream>
#include <cmath>
#include <vector>
#include <bitset>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <climits>
#include <functional>

using namespace std;

#define FOR(i, a, b) for(int (i)=a;(i)<(b);(i)++)
#define rep(i, n)  FOR(i,0,n)
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<long double> vd;
typedef vector<vector<long double>> vvd;
typedef vector<vector<vector<long double>>> vvvd;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<string> vs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef pair<int, int> pii;
const int bigmod = 1000000007;
const int INF = 1050000000;


int main() {
    int N;
    cin >> N;
    vi A(N);
    rep(i, N) cin >> A[i];
    vl acc(N, 0);
    rep(i, N) {
        acc[i] = A[i];
        if (i > 0) acc[i] += acc[i - 1];
    }
    ll ans = LONG_LONG_MAX;
    int posL = 0;
    int posR = 2;
    FOR(k, 1, N - 2) {
        ll sumL = acc[k];
        ll sumR = acc[N - 1] - acc[k];
//        while (posL <= k) posL++;
        while (posR <= k) posR++;
        while (abs(sumL / 2.0 - acc[posL]) >= abs(sumL / 2.0 - acc[posL + 1])) posL++;
        while (abs(sumR / 2.0 - (acc[posR] - sumL)) >= abs(sumR / 2.0 - (acc[posR + 1] - sumL))) posR++;
        ll sumB = acc[posL];
        ll sumC = sumL - sumB;
        ll sumD = acc[posR] - acc[k];
        ll sumE = sumR - sumD;

//        auto itr1 = upper_bound(acc.begin(), acc.end(), sumL / 2.0);
//        ll sumB = (abs(sumL - 2 * *itr1) < abs(sumL - 2 * *(itr1 - 1))) ? *(itr1) : *(itr1 - 1);
//        ll sumC = sumL - sumB;
//        auto itr2 = upper_bound(acc.begin(), acc.end(), sumL + sumR / 2.0);
//        ll sumD = (abs(acc[N] - 2 * *itr2) < abs(acc[N] - 2 * *(itr2 - 1))) ? *(itr2) - sumL : *(itr2 - 1) - sumL;
//        ll sumE = sumR - sumD;
        ans = min(ans, max({sumB, sumC, sumD, sumE}) - min({sumB, sumC, sumD, sumE}));
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 2560
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System.Text.RegularExpressions;

class Program
{
    const string Yes = "Yes";
    const string No = "No";
    const char White = '.';
    const char Black = '#';
    const long Mod = 1000000007;

    static void Main(string[] args) {
#if DEBUG
        MyDebugger.Test(process, "../TextFile1.txt");
#else
        object ret = process(new StreamReader(Console.OpenStandardInput()));
        Console.WriteLine(ret);
#endif
    }

    static object process(TextReader input) {
        var s = input.ReadLine();

        long scount = 0;
        long remove = 0;

        for(int i=0; i<s.Length; i++) {
            var c = s[i];

            if(c == 'T') {
                if(scount > 0) {
                    scount--;
                    remove+=2;
                }
            } else {
                scount++;
            }
        }

        return s.Length - remove;
    }

    static int[] ToIntArray(string strs, int n) {
        var ret = new int[n];
        var spl = strs.Split(' ');
        for (int i = 0; i < n; i++)
            ret[i] = int.Parse(spl[i]);
        return ret;
    }
}


Measured memory_bytes: 13112
parseInt(x) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
	n,q = readline() |> split |> parseMap
	e = [Int[] for i in 1:n]
	t = zeros(Int,n)
	t[1] = -1
	for i in 1:n-1
		a,b = readline() |> split |> parseMap
		push!(e[a],b)
		push!(e[b],a)
	end
	stack = Int[1]
	c = zeros(Int,n)
	for i in 1:q
		p,x = readline() |> split |> parseMap
		c[p]+=x
	end
	total = zeros(Int,n)
	while !isempty(stack)
		now = pop!(stack)
		for i in 1:length(e[now])
			if t[e[now][i]] == 0
				t[e[now][i]] = now
				c[e[now][i]] += c[now]
				push!(stack, e[now][i])
			end
		end
	end
	for i in 1:n-1
        print(c[i], " ")
    end
    println(c[n])
end

main()

Measured memory_bytes: 178184
#include <bits/stdc++.h>
#define SpeeD ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define ll long long
#define endl '\n'
//pair<int, int> *p=new pair<int, int>[n];
//std::vector<pair<int,int>> vp;
//v.push_back(make_pair(x,y))
//pair<int, int> p[1000001];
//string *s=new string [n];
//int freq[e];
//freq[a[i]-'a']++; freq[a[i]]++;
using namespace std;
ll n, t, m, c1, c2, c, x, y, sum, mn = 999999999, avg, pos, dif, j, dis, mx, xi, yi, q;
vector<ll>v;
set<int>s;
map<string, ll >mp;
bool PE ( int x )
{
    for ( int i = 2; i * i <= x; i++ )
        if ( x % i == 0 )
            return false;
    return true;
}
bool PR ( string s )
{
    int n = s.length();
    for ( int i = 0; i < n / 2; i++ )
        if ( s[i] != s[n - i - 1] )
            return false;
    return true;
}

int main ( void )
{ 
    SpeeD
    ll n;
    cin>>n;
    c=0;
 
   
   
   for (ll i = 2 ; i<=sqrtl(n);i++){
   c1=0;
    while (n%i == 0){
    c1++, n/=i;
    }
     c += (-1 + sqrt(1 + 8*c1)) / 2 ;}
       // cout<<n;
    if (n>2)
    c++;
    
    
cout<<c;
     
    
   
}


Measured memory_bytes: 3680
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <math.h>
#include <queue>
using namespace std;
typedef long long ll;



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

    if (s == "AAA" || s == "BBB") {
      cout << "No" << endl;
    } else {
      cout << "Yes" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env ruby

require 'pp'
attrs = Array.new
while line = $stdin.gets
  attrs << line.chomp.split
end

A = Array.new(3).map{Array.new(3,0)}
B = Array.new(3).map{Array.new(3,false)}
A[0] = attrs[0]
A[1] = attrs[1]
A[2] = attrs[2]

flatArray = A.flatten
N = attrs.length - 3
atari = 0
result = false

N.times do |n|
  num = attrs[n+3][0]
  next unless flatArray.include?(num)
  atari += 1
  index = flatArray.index(num)
  i = index / 3
  j = index % 3
  B[i][j] = true
  next if atari < 3
  # 横検索
  if (B[0].select{|b| b == true}).length == 3 then
    result = true
  end
  if (B[1].select{|b| b == true}).length == 3 then
    result = true
  end
  if (B[2].select{|b| b == true}).length == 3 then
    result = true
  end
  # 縦検索
  if B[0][0] == true && B[1][0] == true && B[2][0] == true then
    result = true
  end
  if B[0][1] == true && B[1][1] == true && B[2][2] == true then
    result = true
  end
  if B[0][2] == true && B[1][2] == true && B[2][2] == true then
    result = true
  end
  # 斜め
  if B[0][0] == true && B[1][1] == true && B[2][2] == true then
    result = true
  end
  if B[0][2] == true && B[1][1] == true && B[2][0] == true then
    result = true
  end

end

puts result ? "Yes" : "No"

Measured memory_bytes: 2044
S=input()

A="abcdefghijklmnopqrstuvwxyz"
if S=="zyxwvutsrqponmlkjihgfedcba":
    print(-1)
elif len(S)!=26:
    A=list(A)
    for i in range(len(S)):
        A.remove(S[i])
    print(S+A[0])
else:
    a=A.index(S[25])
    for i in range(24,-1,-1):
        b=A.index(S[i])
        if a>b:
            break
        a=b

    for j in range(b+1,26):
        if not A[j] in S[:i]:
            print(S[:i]+A[j])
            break

Measured memory_bytes: 9084
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        for(int i=0;i<n;i++){
            a[i] = sc.nextInt();
        }
        double[] b = new double[n];
        for(int i=0;i<n;i++){
            b[i] = (double)1.0/(double)a[i];
        }
        double c = 0;
        for(int i=0;i<n;i++){
            c += b[i];
        }
        System.out.println(1.0/c);
    }
}

Measured memory_bytes: 22996
#include <cstdio>

int f(int x){
    return (x==0) ? 1 : x;
}

int main(){
    int a, b, c;
    scanf("%d%d%d", &a, &b, &c);
    printf("%d\n", f(3-(a==b)-(b==c)-(c==a)));
    return 0;
}

Measured memory_bytes: 128
#include <stdio.h>

int main(){
	long long int L, R, i, j, min=2020;

	scanf("%lld %lld", &L, &R);

	if(R-L < 2019){
		for(i=L; i<R; i++){
			for(j=i+1; j<=R; j++){
				if(((i*j) % 2019)<min)
					min=(i*j)%2019;
			}
		}
	}

	else
		min = 0;

	printf("%lld\n", min);

	return 0;
}

Measured memory_bytes: 128
n=gets.to_i
s=gets.split.map &:to_i
c=0
M=->l,m,r{o=m-l
p=r-m
w=s[l,o]
e=s[m,p]
w<<1e10
e<<1e10
i=j=0
(l...r).map{|k|if w[i]<=e[j]
s[k]=w[i]
i+=1
else
s[k]=e[j]
j+=1
c+=o-i
end}}
S=->f,l,r{if l+1<r
m=(l+r)/2
f[f,l,m]
f[f,m,r]
M[l,m,r]
end}
S[S,0,n]
p c

Measured memory_bytes: 51632
while True:
    c = 0
    n,x = map(int, input().split())
    if n == x == 0:
        break
    for i in range(1, n+1):
        for j in range(i+1, n+1):
            if x - i - j in range(j+1, n+1):
                c += 1
    print(c)


Measured memory_bytes: 5596
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    
    int n;
    cin >> n;
    for (int i = -200; i <= 200; i++) {
        for (int j = -200; j <= 200; j++) {
            if (pow(i,5) - pow(j,5) == n) {
                cout << i << ' ' << j << endl;
                return 0;
            }
        }
    }
}

Measured memory_bytes: 4036
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main () {
	var n int
	const MAX_AMOUNT = 1e+18
	fmt.Scanf("%d", &n)

	sc.Split(bufio.ScanWords)

	a := make([]int64, n)
	for i := 0; i < n; i++ {
		a[i] = nextInt()
		if a[i] == 0 {
			fmt.Println("0")
			return
		}
	}

	var v int64 = 1
	for i := 0; i < n; i++ {
		if a[i] <= MAX_AMOUNT/v {
			v *= a[i]
		} else {
			fmt.Println("-1")
			return
		}
	}

	fmt.Printf("%d\n", v)
}

func nextInt() int64 {
  sc.Scan()
  i, e := strconv.ParseInt(sc.Text(), 10, 64)
  if e != nil {
      panic(e)
  }
  return i
}

Measured memory_bytes: 5944
def main():

    N,K = map(int,input().split())
    aList = list(map(int,input().split()))

    if N == K : print(1); exit()
    cnt = 1
    rem = len(aList)
    rem -= K
    decrease = K-1

    while(rem > 0):
        rem -= decrease
        cnt += 1
    print(cnt)

 





if __name__ == "__main__":
    main()

Measured memory_bytes: 14008
import java.util.Scanner;

public class Main {
    void run() {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int[][] a = new int[2][n];
        for (int i = 0; i < 2; i++) {
            for (int j = 0; j < n; j++) {
                a[i][j] = scan.nextInt();
            }
        }
        int ans = 0;
        for (int i = 0; i < n; i++) {
            int sum = 0;
            for (int j = 0; j < n; j++) {
                if (j <= i)
                    sum += a[0][j];
                if (j >= i)
                    sum += a[1][j];
            }
            ans = Math.max(ans, sum);
        }
        System.out.println(ans);
    }
    public static void main(String[] args) {
        new Main().run();
    }
}


Measured memory_bytes: 21972
#include <bits/stdc++.h>
using namespace std;
#define __ <<" "<<
#define ___ <<" "
#define bash push_back
#define ALL(x) x.begin(),x.end()

struct IoSetup {
    IoSetup() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(10);
        cerr << fixed << setprecision(10);
    }
}IoSetup;

typedef long long ll;
typedef pair < int , int >  pii;
static const signed int INF = 0x3f3f3f3f;
static const signed long long LINF = 0x3f3f3f3f3f3f3f3fLL;
static const signed int SMOD = 1000000007;
static const signed int NMOD = 998244353;
static const signed int dx[]={1,0,-1,0,1,1,-1,-1};
static const signed int dy[]={0,-1,0,1,-1,1,-1,1};

bool inside(int x,int y,int w,int h){return (x>=0 && y>=0 && x<w && y<h);}
template<class T>T abs(T &x){return x<0 ? -x : x;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int n;


signed main() {

	cin >> n;

	for(int i = 1; i <= 50000; i++) {
		if(int(i*1.08)== n) {
			cout << i << endl;
			return 0;
		}
	}

	cout << ":(\n";

    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl '\n'
#define F first
#define S second
#define all(c) c.begin(), c.end()
#define int long long
#define forn(i,a,b) for (int i=a; i<b; i++)
#define MOD 1000000000+7;

using namespace std;

void solve (){
	int n;
	cin>>n;
	string s;
	cin>>s;
	int ans=0;
	for(int i=0; i+2<n; i++) {
		if (s[i]=='A' && s[i+1]=='B' && s[i+2]=='C') ans++;
	}
	cout<<ans<<endl;
}

signed main(){
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    /*#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif*/
    int t=1;
    //cin>>t;
    while (t--) solve();
    return 0;
}

Measured memory_bytes: 764
#include<iostream>
#include<utility>
using namespace std;
 
int main(){
    
    int H, W, i, j;
    
    while (1){
        cin >> H >> W;
        if ( (H == 0) && (W == 0) ){
            break;
        }

        for ( int i = 0; i < H; i++ ){
            for ( int j = 0; j < W; j++ ){
                cout << "#";
            }
        cout << endl;
        }
    cout << endl;
    }
    
    return 0;
}
    


Measured memory_bytes: 3104
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
int main() {
    int n;
    cin >> n;
    vector<double> p(n);
    for(int i=0;i<n;i++) cin >> p[i];
    vector<double> dp(n+1);
    dp[0] = 1; 
    for(int i=0;i<n;i++){
        for(int j=i+1;j>=0;j--){
            dp[j] = ((j==0)?0:dp[j-1]*(p[i]))+dp[j]*(1-p[i]);
        }
    }
    double ans=0.0;
    for(int i=0;i<n+1;i++){
        if(i>n-i) ans+=dp[i];
    }
    cout<<setprecision(10)<<fixed<<ans;
    return 0;
}

Measured memory_bytes: 3852
#include <bits/stdc++.h>
#define itn int
#define REP(i, n) for (int i = 0; i < (n); i++)
#define IREP(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(i, k, n) for (int i = (k); i < (n); i++)
#define REPEACH(itr, k) for (auto &&itr : k)
#define MOD 1000000007

using namespace std;
typedef long long ll;

const ll INF = 1LL<<60;
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()
{
    int n, w;
    cin >> n >> w;
    vector<pair<int, int>> v(n);
    REP(i, n)
    {
        cin >> v[i].first >> v[i].second;
    }
    vector<vector<ll>> dp(n+1, vector<ll>(w + 1, 0));
    REP(j, w + 1)
    {
        REP(i, n+1)
        {
            if(i==0){
                continue;
            }
            if (j < v[i-1].first)
            {
                dp[i][j] = dp[i - 1][j];
            }
            else
            {
                dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - v[i-1].first] + v[i-1].second);
            }
        }
    }
    cout << dp[n][w] << endl;
}

Measured memory_bytes: 80256
/* ABC156_B
    Stuartyg */

#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdbool.h>


int main(void){
    int num,base_num;
    double ans = 0;

    scanf("%d %d",&num,&base_num);
    
    ans = log(num)/log(base_num);
    printf("%d",(int)ans+1); /*型キャスト*/

    return 0;
}


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

#define st first
#define nd second
typedef long long LL;
typedef pair <int, int> PII;
typedef pair <LL, LL> PLL;

int main()
{
    int a, b, c;
    scanf("%d %d %d", &a, &b, &c);
    vector <int> V = {a, b, c};
    sort(V.begin(), V.end());
    
    if ((V[0] & 1) == (V[1] & 1))
        printf("%d", (V[2] - V[1] + V[2] - V[0]) >> 1);
    else
        printf("%d", ((V[2] - V[1] + V[2] + 1 - V[0]) >> 1) + 1);

    return 0;
}

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

int main(void)
{
  int h, w;
  string c[101];
  string ans[202];
  cin >> h >> w;
  for ( int i=0; i<h; i++ ) {
    cin >> c[i];
  }
  
  for ( int i=0; i<h; i++ ) {
    for ( int j=0; j<2; j++ ) {
      ans[i*2+j] = c[i] + "\n";
    }
  }
  
  for ( int i=0; i<h*2; i++ ) {
    cout << ans[i];
  }
  
  return 0;
}


Measured memory_bytes: 256
#キーエンスプログラミングコンテスト2019-B
s = input()

target = 'keyence'
flg = False
for i in range(len(s)):
    for j in range(len(s)):
        tmp = s[0:i] + s[j:]
        if tmp == target and not flg:
            print('YES')
            flg = True
            break
if not flg:
    print('NO')

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

using ll = long long int;
using bigint = int64_t;

#define pll pair<ll, ll>
#define vll vector<ll>
#define vpll vector<pll>
#define lob lower_bound
#define upb upper_bound
#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define pf push_front
#define ins insert
#define mp make_pair
#define w(t) cin >> t;while(t--)
#define bitcount __builtin_popcount
#define endl "\n"
#define sz(s) (int)s.size()
#define mem(n,m) memset(n,m,sizeof(n))
#define deb(x) cout << #x << " = " << x << endl;
#define rep(i,n) for(ll i = 0; i < n; i++)
#define ren(i,n) for(ll i = n-1; i >= 0; i--)
#define all(x) x.begin(),x.end()
#define fo(i, a, b) for(ll i = a; i <= b; i++)
#define ffo(i, a, b) for(ll i = a; i >= b; i--)
#define ffi(i,a,b,c) for(ll i = a ; i <= b ; i += c)
#define IOS ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
const int MOD = 1000000007;

void io_set(){
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
}

void solve(){
   	ll n;
   	cin >> n;
   	map < string, ll > mpp;
   	string s[n];
   	ll m = INT_MIN;
   	rep(i, n){
   		cin >> s[i];
   		mpp[s[i]]++;
   		m = max(m,mpp[s[i]]);
   	}
   	set <string>st;
   	rep(i, n){
   		if(mpp[s[i]] == m){
   			st.ins(s[i]);
   		}
   	}
   	for(auto it : st){
   		cout << it << "\n";
   	}
}

int main(){
    IOS;
    //io_set();
    ll tt = 1;
    //cin >> tt;
    while(tt--){
        solve();
    }
    return 0;
} 


Measured memory_bytes: 34816
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i = (a); i <= (b); i++)
#define rng(a) a.begin(), a.end()
#define ina(n,a) cin >> n; for(int i = 1; i <= n; i++) cin >> a[i]
#define sz(x) (int)(x).size()
#define se second
#define fi first
#define prev            coyhhhhhhyoc    
#define next          sdNNNmNNNNNNNmds  
#define y0           hNNNNy_yNNNNNN_sNh
#define y1          mNNNNNdtdNNNNNNtsNNm
#define yn          mNNNNNNNNy___smNNNms
#define tm            oooooosyysooooot 
#define read               tyhyt        
#define rank              ytmNmo         
#define index              yyy
#define pb push_back
#define pcnt __builtin_popcountll
#define rrep(i,a,b) for(int i = (b); i >= (a); i--)
#define rall(x,a) for(auto x : a)
#define MOD 1000000007
#define endl "\n"
typedef long long ll;
using namespace std;

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int a, b;
    cin >> a >> b;
    int ans = max(a + b, max(a - b, a * b));
    cout << ans << endl;
    return 0;
}


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

//#define int long long
typedef long long ll;
//const int INF = 2e9;
//const ll INF = 9e18;


signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N, K;
    cin >> N >> K;
    ll ans = 0;
    for (int b=1;b<=N;b++){
        int p = N/b;
        int r = N%b;
        ans += max(0,b-K)*p + max(0,r-K+1);
    }
    if (K==0) ans -= N;

    cout << ans << "\n";
}

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

const int N = 1e3 + 1,
          MOD = 1e9 + 7;

char c[N][N];
int h, w, val[N][N];

int DFS(int i, int j) {
  if(i > h || j > w)
    return 0;
  if(val[i][j] != -1)
    return val[i][j];
  if(c[i][j] == '#')
    return 0;
  val[i][j] = (DFS(i+1, j) + DFS(i, j+1)) % MOD;
  return val[i][j];
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  
  cin >> h >> w;
  for(int i = 1; i <= h; i++)
    for(int j = 1; j <= w; j++) {
      cin >> c[i][j];
      val[i][j] = -1;
    }
  
  val[h][w] = 1;
  
  cout << DFS(1, 1);
}

Measured memory_bytes: 5248
import queue

H, W = map(int, input().split())

s = [list(input()) for _ in range(H)]

ini = 0
if s[0][0] == '#':
    ini = 1

dist = [[ini for _ in range(W)] for _ in range(H)]
start = (0,0)

qq = queue.Queue()

for i in range(H):
    for j in range(W):
        tgt = []
        if j == 0:
            pass
        else:
            if s[i][j-1] == '.' and s[i][j] == '#':
                tgt.append(dist[i][j-1] + 1)

            else:
                tgt.append(dist[i][j-1])

        if i == 0:
            pass
        else:
            if s[i-1][j] == '.' and s[i][j] == "#":
                tgt.append(dist[i-1][j] + 1)
            else:
                tgt.append(dist[i-1][j])
        if i + j == 0:
            continue
        dist[i][j] = min(tgt)

print(dist[H-1][W-1])



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

int main() {
    ll n;
    std::cin >> n;
    set<ll> nex;
    vector<queue<ll>> a(n);
    for (int i = 0; i < n; i++) {
        nex.insert(i);
        for (int j = 0; j < n-1; j++) {
            ll tmp;
            std::cin >> tmp;
            tmp--;
            a[i].push(tmp);
        }
    }
    ll cnt = 0;
    ll rem = n*(n-1)/2;
    while(true){
        ll now = 0;
        map<pair<ll,ll>,bool> match;
        set<ll> nnex;
        for (auto i : nex) {
            ll ai = a[i].front();
            // マッチが成立したら
            if(match[{min((ll)i,ai),max((ll)i,ai)}]){
                a[i].pop();
                a[ai].pop();
                now++;
                rem--;
                if(!a[i].empty()){
                    nnex.insert(a[i].front());
                    nnex.insert(i);
                }
                if(!a[ai].empty()){
                    nnex.insert(a[ai].front());
                    nnex.insert(ai);
                }
                // std::cout << i<<" "<<ai << std::endl;
            }else{
                match[{min((ll)i,ai),max((ll)i,ai)}] = true;
            }
        }
        nex.clear();
        for (auto i : nnex) {
            nex.insert(i);
        }
        cnt++;
        if(rem == 0){
            std::cout <<  cnt<< std::endl;
            return 0;
        }
        if(now == 0){
            std::cout << -1 << std::endl;
            return 0;
        }
    }
}


Measured memory_bytes: 4736
#include <iostream>
//#include <iomanip>
#include <string>
#include <vector>
//#include <algorithm>
//#include <utility>
//#include <set>
//#include <map>
//#include <queue>
//#include <deque>
//#include <bitset>
//#include <math.h>
using namespace std ;
using ll = long long ;
//using ld = long double ;
using vll = vector<ll> ;
using vvll = vector<vll> ;
//using vc = vector<char> ;
//using vvc = vector<vc> ;
//using vb = vector<bool> ;
//using vvb = vector<vb> ;
//using pll = pair<ll,ll> ;
//#define all(v) v.begin(),v.end()
//ll mod = 1e9+7 ;
//long double pie = acos(-1) ;
//ll INF = 1e15 ;

//void yorn(bool a){if(a) cout << "Yes" << endl ; else cout << "No" << endl ;}
//void YorN(bool a){if(a) cout << "YES" << endl ; else cout << "NO" << endl ;}
//ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
//ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
//ll sa(long long a,long long b){if(a>b) return a-b ; return b-a ;}
//void fix_cout(){cout << fixed << setprecision(20) ;}

int main(){
	string s ; cin >> s ;
	ll n = s.size();
	ll k ; cin >> k ;
	vvll dp1(n,vll(k+1,0)),dp2(n,vll(k+1,0)) ;
	dp1.at(0).at(0) = (s.at(0)!='0') ;
	dp1.at(0).at(1) = s.at(0)-'0'-1 ;
	dp2.at(0).at(1) = 1 ;
	for(int i=1;i<n;i++){
		if(s.at(i)=='0'){
			for(int j=0;j<=k;j++) dp2.at(i).at(j) += dp2.at(i-1).at(j) ;
			for(int j=1;j<=k;j++) dp1.at(i).at(j) += dp1.at(i-1).at(j-1)*9 ;
			for(int j=0;j<=k;j++) dp1.at(i).at(j) += dp1.at(i-1).at(j) ;
		}else{
			for(int j=1;j<=k;j++) dp2.at(i).at(j) += dp2.at(i-1).at(j-1) ;
			for(int j=0;j<=k;j++) dp1.at(i).at(j) += dp2.at(i-1).at(j) ;
			for(int j=1;j<=k;j++) dp1.at(i).at(j) += dp2.at(i-1).at(j-1)*(s.at(i)-'0'-1) ;
			for(int j=0;j<=k;j++) dp1.at(i).at(j) += dp1.at(i-1).at(j) ;
			for(int j=1;j<=k;j++) dp1.at(i).at(j) += dp1.at(i-1).at(j-1)*9 ;
		}
	}
	cout << dp1.at(n-1).at(k)+dp2.at(n-1).at(k) << endl ;
//	for(int j=0;j<=k;j++){
//		for(int i=0;i<n;i++) cout << dp1.at(i).at(j) << (i==n-1?"\n":" ") ;
//	}
//	for(int j=0;j<=k;j++){
//		for(int i=0;i<n;i++) cout << dp2.at(i).at(j) << (i==n-1?"\n":" ") ;
//	}
}


Measured memory_bytes: 3612