akhauriyash/Code-Regression huggingface dataset:
S2 = input()
T = input()

t = float('inf')
for i in range(len(S2)-len(T), -1, -1):
    flag = True
    for j in range(len(T)):
        if S2[i+j] == '?':
            continue
        if S2[i+j] != T[j]:
            flag = False
            break
    if flag:
        t = i
        break
        
if t == float('inf'):
    print('UNRESTORABLE')
    exit()
else:
    S2 = S2.replace('?', 'a')
    answer = S2[:t] + T + S2[t+len(T):]
    print(answer)


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

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

    if (a < b){
        cout << "a" << " " << "<" << " " << "b" << '\n';
     }
    else if (a > b){
        cout << "a" << " " << ">" << " " << "b" << '\n';
    }
    else  cout << "a" << " " << "==" << " " << "b" << '\n';
    
    return 0;
}



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

const int N=100005;
const int MOD=1e9+7;
int n;
double a[3005],dp[3005][3005],ans;

int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%lf",&a[i]);
	dp[0][0]=1;
	for(int i=1;i<=n;i++)
	{
		dp[i][0]=dp[i-1][0]*(1-a[i]);
		for(int j=1;j<=i;j++)
		{
			dp[i][j]=dp[i-1][j]*(1-a[i])+a[i]*dp[i-1][j-1];
		}
	}
	for(int i=0;i<=(n-1)/2;i++) ans+=dp[n][n-i];
	printf("%.12lf\n",ans);
}

Measured memory_bytes: 68992
//Why 860?
#include <bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define sz(v) ((int)v.size())
#define fill(x, v) memset(x, v, sizeof(x))
#define trace(x) cout << #x << " = " << x << endl
#define FER(i,x,y) for(int (i)=(x);(i)<(y); (i) ++)
#define IFR(i,x,y) for(int (i)=(x);(i)>=(y); (i) --)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);
#define N 100002
using namespace std;
typedef long long ll;
typedef pair<ll, ll> ii;

const ll oo = 1e18;
const ll MOD = 1e9 + 7;

vector<int> match[N];
ll dp[21][1 << 21];
int n;

ll go(ll pos, ll mask){
	if(pos >= n) return 1;
	if(dp[pos][mask] != -1 )return dp[pos][mask];
	ll ret = 0;
	for(auto x: match[pos]){
		if(!(mask & (1 << x))) ret = (ret%MOD + go(pos + 1, (mask | (1 << x)))%MOD)%MOD;
	}
	return dp[pos][mask] = ret;
}

int main(){
	fastio;
	cin >> n;
	FER(i, 0, n) FER(j, 0, n){
		int x; cin >> x;
		if(x == 1) match[i].pb(j);
	}
	fill(dp, -1);
	cout << go(0, 0) % MOD << endl;
	return 0;
}

Measured memory_bytes: 346752
/// kazuki08
/*
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long
typedef long long ll;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
//#define inf 1000000000
#define mod 1000000007
#define dmp(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl
#define fs first
#define sc second
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define mt make_tuple
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
    return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
    o<<"{";
    for(const T& v:vc) o<<v<<",";
    o<<"}";
    return o;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

char str[55];

signed main(){
IOS;
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
  
  string s;
  cin >> s;
  int x = 0;
  x  = s[5]%48*10 + s[6]%48;
  if(x<=4){
    cout << "Heisei" << endl;
  }
  else {
    cout << "TBD" << endl;
  }


return 0;
}
///....


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<cmath>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

struct Edge{
	int to,cost;
	Edge(int t,int c){
		to=t;
		cost=c;
	}
};

typedef vector<vector<Edge> > AdjList;

AdjList graph;

const int INF=10000000;

vector<vector<int> > dist;

bool bellman_ford(int n,int s){
	dist[s][s]=0;
	for(int i=0;i<n;i++){
		for(int v=0;v<n;v++){
			for(int k=0;k<graph[v].size();k++){
				Edge e=graph[v][k];
				if(dist[s][v]!=INF && dist[s][e.to]>dist[s][v]+e.cost){
					dist[s][e.to]=dist[s][v]+e.cost;
				}
				if(i==n-1)return true;
			}
		}
	}
	return false;
}

int main(){
	while(1){
		int num,maximum=0;
		cin>>num;
		graph=AdjList(10);
		if(num==0)break;
		for(int i=0;i<num;i++){
			int from,to,cost;
			cin>>from>>to>>cost;
			graph[from].push_back(Edge(to,cost));
			graph[to].push_back(Edge(from,cost));
			maximum=max(maximum,to);
		}
		int sum[maximum+1];
		for(int i=0;i<=maximum;i++){
			sum[i]=0;
		}
		dist=vector<vector<int> >(maximum+1);
		for(int i=0;i<=maximum;i++){
			dist[i]=vector<int>(maximum+1,INF);
		}
		for(int i=0;i<=maximum;i++){
			bellman_ford(maximum+1,i);
			for(int j=0;j<=maximum;j++){
				sum[i]+=dist[i][j];
			}
		}
		int ansp=0,anssum=sum[0];
		for(int i=1;i<=maximum;i++){
			if(sum[i]<anssum){
				anssum=sum[i];
				ansp=i;
			}
		}
		cout<<ansp<<" "<<anssum<<endl;
	}
	return 0;
}

Measured memory_bytes: 1224
n, m = map(int, input().split())
arr_a = []
vec_b = []
for x in range(0, n):
    arr_a.append(list(map(int, input().split())))
for y in range(0, m):
    vec_b.append(int(input()))

for ni in range(0, n):
    s = 0
    for mi in range(0, m):
        s += (arr_a[ni][mi] * vec_b[mi])
    print(s)



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

int main() {
    ll N; cin >> N;
    ll a[30], b[30], c[30];
    for(int i = 1; i <= N; i++) {
        cin >> a[i];
    }
    for(int i = 1; i <= N; i++) {
        cin >> b[i];
    }
    for(int i = 1; i <= N; i++) {
        cin >> c[i];
    }

    ll ans = 0;
    for(int i = 1; i <= N; i++) {
        ll num = a[i];
        ans += b[num];
        if(a[i-1]+1 == a[i]){
            ans += c[num - 1];
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
ll N, K;
const int MOD = 1000000007;
int main() {
    cin >> N >> K;
    ll ans = 0;
    for (ll i = K; i <= N+1; i++)
    {
        ll smin = i * (i-1) / 2;
        ll smax = (N*2-i+1)*i/2;
        ans = (ans + (smax - smin + 1))%MOD;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3640
import bisect
import collections
import heapq
import math
import operator as op
from collections import Counter
from functools import reduce

import numpy as np


def get_inputs(cast_func=None):
    if cast_func is None:
        return input().split()
    else:
        return list(map(cast_func, input().split()))


def get_input(cast_func=None):
    if cast_func is None:
        return input()
    else:
        return cast_func(input())


def main():
    A, B, C, K = get_inputs(int)

    ans = 0
    if K > 0:
        N = min(K, A)
        ans += N
        K -= N

    if K > 0:
        N = min(K, B)
        K -= N

    if K > 0:
        N = min(K, C)
        ans -= N
        K -= N

    assert K == 0
    print(ans)


if __name__ == '__main__':
    main()


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

const int MAXN = 3E5+2;
const int MAXBIT = 60;
const long long MOD = 1E9+7;

long long a[MAXN];
int cnt[2];
int n;

long long ans = 0;

signed main(){
	cin >> n;
	for(int i=1; i<= n; ++i){
		cin >> a[i];
	}
	for(int j=MAXBIT-1; j>= 0; --j){
		memset(cnt, 0, sizeof cnt);
		for(int i=1; i<= n; ++i){
			++cnt[(a[i]>>j)&1];
		}
		ans*= 2LL; 
		ans += 1LL*cnt[0]*cnt[1];
		ans%= MOD;
	}
	cout << ans;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  vector<int> l(2 * N);
  for (int i = 0; i < 2 * N; i++) cin >> l.at(i);
  sort(l.begin(), l.end());
  int ans = 0;
  for (int i = 0; i < N; i++) ans += l.at(2 * i);
  cout << ans << endl;
}

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


int main(){
    int x;
    cin >> x;
    int n = 200000;
    vector<int> seive(200001);
    for(int i=2; i<=n; i++){
        int cnt = 1;
        while(i*cnt <= n){
            seive[i*cnt]++;
            cnt++;
        }
    }
    vector<int> prime;
    for(int i=2; i<n; i++){
        if(seive[i]==1) prime.push_back(i);
    }
    auto itr = lower_bound(prime.begin(),prime.end(),x);
    cout << *itr << endl;
    return 0;
}

Measured memory_bytes: 4388
#include <bits/stdc++.h>
 
#define fi first
#define se second
#define sz(a) (int)(a).size()
#define all(a) (a).begin(), (a).end()
#define reset(a, v) memset((a), v, sizeof(a))
 
using namespace std;
 
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ii> vii;

const int N = 200005;

int n, q;
int BIT[N][2];

int query(int k, int idx) {
	int ret = INT_MAX;
	for (; k > 0; k -= k & -k) ret = min(ret, BIT[k][idx]);
	return ret;
}

void update(int k, int v, int idx) {
	for (; k <= n-1; k += k & -k) BIT[k][idx] = min(BIT[k][idx], v);
}

int main() {
	scanf("%d %d", &n, &q);
	for (int i = 1; i < n; i++) {
		BIT[i][0] = n;
		BIT[i][1] = n;
	}
	ll whites = 0;
	while (q--) {
		int type, x; scanf("%d %d", &type, &x);
		if (type == 1) {
			int res = query(n-x, 0);
			// printf("res = %d\n", res);
			whites += res-2;
			update(n-(res-1), x, 1);
		}
		else {
			int res = query(n-x, 1);
			whites += res-2;
			update(n-(res-1), x, 0);
		}
	}
	printf("%lld\n", 1ll*(n-2)*(n-2) - whites);
	return 0;
}

Measured memory_bytes: 5368
#include<bits/stdc++.h>
#define int long long
using namespace std;

int32_t main()
{
    string s;
    cin>>s;
    int res=1;
    for(int i=0;i<s.size()-1;i++){
        if(s[i]!=s[i+1])res++;
    }
    cout<<res-1<<endl;

    return 0;
}


Measured memory_bytes: 3724
<?php

$n = fgets(STDIN);
$n = intval($n);
$countA = 0;
$countUn = 0;
for ($i = 0; $i < $n; $i++) {
    // fgets needs to have 'rtrim' to remove \n.
    $word = rtrim(fgets(STDIN));
    if($word == 'A'){
        $countA += 1;
    }
    if($word == 'Un'){
        $countUn += 1;
    }
    if($countA < $countUn){
        break;
    } 
}

if($countA != $countUn){
    print 'NO';
    print "\n";

} else {
    print 'YES';
    print "\n";

}



Measured memory_bytes: 9208
import java.util.Scanner;

// *** at 2018/**/**

public class Main {
	public static void main(String[] args) {
		Main main = new Main();
		main.solveB();
	}

	private void solveA() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		int x = sc.nextInt();
		int y = sc.nextInt();
		if (n < k) {
			System.out.println(n * x);
		} else {
			System.out.println((k * x) + ((n - k) * y));
		}
	}

	private void solveB() {
		Scanner sc = new Scanner(System.in);
		String w = sc.nextLine();
		char s;
		int a = 0;
		for (int i = 0; i < w.length(); i++) {
			s = w.charAt(i);
			a = rep(w, s);
			if (a % 2 == 1) {
				System.out.println("No");
				return;
			}
		}
		System.out.println("Yes");
	}
	private int rep(String str, char target) {
		return str.length() - str.replace(target + "", "").length();
	}

	private void solveC() {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		System.out.println(N);
	}

	private void solveD() {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		System.out.println(N);
	}

	private void solveE() {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		System.out.println(N);
	}

	private void solveF() {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		System.out.println(N);
	}

}

Measured memory_bytes: 23764
s = input()
k = int(input())
result = ""
i = 0
#a:97, z:122
while i < len(s)-1:
    s_i = ord(s[i])
    if s[i]=="a":
        result = result+"a"
    elif 123-s_i <= k:
        result = result+"a"
        k -= 123-s_i
    else:
        result = result+s[i]
    i += 1
if k>0:
    result = result + chr((ord(s[i])-97+k)%26+97)
else:
    result = result + s[i]

print(result)

Measured memory_bytes: 3444
//
//  main.cpp
//  test130
//
//  Created by  on 2019/06/16.
//  Copyright © 2 All rights reserved.
//
//
//  main.cpp
//  new
//
//  Created on 2019/06/09.
//  Copyright  All rights reserved.
//

// C++ includes used for precompiling -*- C++ -*-

// Copyright (C) 2003-2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library.  This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.

// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.

// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
// <http://www.gnu.org/licenses/>.

/** @file stdc++.h
 *  This is an implementation file for a precompiled header.
 */

// 17.4.1.2 Headers

// C
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
#define int long long
using namespace std;

int n,ans,m;

signed main(){
    cin>>n>>m;
    if (0<n&&n<=9&&0<m&&m<=9) {
        cout<<n*m<<endl;
    }else cout<<-1<<endl;
}






Measured memory_bytes: 256
#include <stdio.h>

int main (void) {
    int n;
    long long a[100010];
    long long result = 1;
    scanf("%d", &n);
    for (int i=0; i<n; i++) {
        long long input;
        scanf("%lld", &input);
        a[i] = input;
        if (input == 0) {
            result = 0;
        }
    }

    if (result == 0) {
        printf("%d\n", 0);
        return 0;
    }

    for (int i=0; i<n; i++) {
        if (a[i] <= 1000000000000000000/result) {
            result *= a[i];
        } else {
            printf("-1\n");
            return 0;
        }
    }

    printf("%lld\n", result);
    return 0;
}


Measured memory_bytes: 2472
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
 
int main() {
  int N;
  vector<int> A;
 
  int sum = 0;
 
  cin >> N;
  for(int i = 0; i < N; i++) {
    int a;
    cin >> a;
    A.push_back(a);
    sum += a;
  }
  sort(A.begin(),A.end());
 
  if(sum % 2 != 0)
    for(int i = 0; i < N; i++) {
      if(A[i] % 2 == 1) {
        sum = sum - A[i];
        break;
      }
    }
  cout << (sum/2) << endl;
 
  return 0;
}


Measured memory_bytes: 3152
#include <vector>
#include <list>
#include <map>
#include <set>
#include "queue"
#include <deque>
#include <stack>
#include <numeric>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <complex>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstring>
#include <climits>
#include <cassert>
#include <iostream>
using namespace std;
#define MOD 1000000007
#define MODSET(d) if ((d) >= MOD) d %= MOD;
#define MODNEGATIVESET(d) if ((d) < 0) d = (d % MOD + MOD) % MOD;
#define pii pair<long long ,long long >
#define ll  long long int
#define loop(i,n) for(ll i=0;i<n;i++)
#define loop2(i,n) for(ll i = 1;i<=n;i+=1)
#define pb push_back
#define mp make_pair
#define EPS 1e-7
using namespace std;
// JAI SHREE KRISHNA
//Winning is my right
//I.W.T.D.I.F.M.F


ll dp[101001];
string s;
ll len ;
ll solve(ll curr)
{
    if(dp[curr]!=-1)
        return dp[curr];
    if(curr==len)
        return 1;
    ll  ans = 0;
    string s1 = "";
    s1+=s[curr];
    s1+=s[curr+1];
    s1+=s[curr+2];
    s1+=s[curr+3];
    s1+=s[curr+4];
    if(s1=="dream"||s1=="erase")
    {
        ans = max(ans,solve(curr+5));
    }
    s1="";
    s1+=s[curr];
    s1+=s[curr+1];
    s1+=s[curr+2];
    s1+=s[curr+3];
    s1+=s[curr+4];
    s1+=s[curr+5];
    s1+=s[curr+6];
    if(s1=="dreamer")
    {
        ans = max(ans,solve(curr+7));
    }
    s1="";
    s1+=s[curr];
    s1+=s[curr+1];
    s1+=s[curr+2];
    s1+=s[curr+3];
    s1+=s[curr+4];
    s1+=s[curr+5];
   if(s1=="eraser")
   {
    ans = max(ans,solve(curr+6));
   }
    return dp[curr] = ans;
    
}


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    cin>>s;
    memset(dp, -1, sizeof(dp));
    len = s.length();
    if(solve(0))
    {
        cout<<"YES"<<endl;
    }
    else{
        cout<<"NO"<<endl;
    }
    
    
    return 0;
    
    
}


Measured memory_bytes: 3280
process.stdin.resume();
process.stdin.setEncoding('utf8');

process.stdin.on('data', function (chunk) {
    var data = chunk.replace(/\n/, '').split(' ');
    var
        W = +data[0],
        H = +data[1],
        x = +data[2],
        y = +data[3],
        r = +data[4];

    if (0 <= x - r && x + r <= W
     && 0 <= y - r && y + r <= H) {
        console.log('Yes');
    }
    else {
        console.log('No');
    }
});

Measured memory_bytes: 15632
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <climits>
#include <string>
#include <vector>
#include <utility>
#include <functional>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cassert>

using namespace std;

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

const ll MOD = ll(1e9) + 7;
const ll INF = LLONG_MAX;
const ll MAX_N = 1 << 12;
const double EPS = 10e-8;
const double PI = 3.14159265359;
int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};

#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (ll i = n; i >= 0; i--)
#define FOR(i, m, n) for (ll i = m; i < n; i++)

int main() {
    while (1) {
        int n;
        cin >> n;
        if (n == 0) break;
        map<char, int> cnt;
        pair<char, int> ans = {'0', 0}, fst = {'0', 0}, snd = {'0', 0};
        REP(i, n) {
            char c;
            cin >> c;
            cnt[c]++;
            if (fst.second < cnt[c]) {
                if (fst.first == c) {
                    fst.second++;
                } else {
                    snd = fst;
                    fst = {c, cnt[c]};
                }
            } else if (snd.second < cnt[c])
                snd = {c, cnt[c]};
            if (ans.second == 0 && fst.second > snd.second + n - i - 1) {
                ans = {fst.first, i + 1};
            }
        }
        if (fst.second == snd.second)
            cout << "TIE" << endl;
        else
            cout << ans.first << " " << ans.second << endl;
    }
    return 0;
}



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

int main() {
    int n, d;
    int ans;
    cin >> n >> d;

    if (n%(2*d+1) != 0) ans = n/(2*d+1)+1;
    else ans = n/(2*d+1);
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)

const ll MOD = (ll)1e9 + 7;
const ll HIGHINF = (ll)1e18;

int main() {
  ll h, w; cin >> h >> w;
  V<string> ss(h); REP(i, h) cin >> ss.at(i);
  V<V<bool>> visited(h, V<bool>(w, false));
  ll ans = 0;
  REP(i, h) {
    REP(j, w) {
      if (visited.at(i).at(j)) continue;
      queue<P<ll, ll>> que; que.push({i, j});
      visited.at(i).at(j) = true;
      ll bc=0, wc=0;
      while (!que.empty()) {
        P<ll, ll> yx = que.front(); que.pop();
        if (ss.at(yx.first).at(yx.second) == '#') bc++;
        else wc++;
        if (yx.first > 0 && !visited.at(yx.first-1).at(yx.second) && ss.at(yx.first).at(yx.second)!=ss.at(yx.first-1).at(yx.second)) {
          visited.at(yx.first-1).at(yx.second) = true;
          que.push({yx.first-1, yx.second});
        }
        if (yx.first < h-1 && !visited.at(yx.first+1).at(yx.second) && ss.at(yx.first).at(yx.second)!=ss.at(yx.first+1).at(yx.second)) {
          visited.at(yx.first+1).at(yx.second) = true;
          que.push({yx.first+1, yx.second});
        }
        if (yx.second > 0 && !visited.at(yx.first).at(yx.second-1) && ss.at(yx.first).at(yx.second)!=ss.at(yx.first).at(yx.second-1)) {
          visited.at(yx.first).at(yx.second-1) = true;
          que.push({yx.first, yx.second-1});
        }
        if (yx.second < w-1 && !visited.at(yx.first).at(yx.second+1) && ss.at(yx.first).at(yx.second)!=ss.at(yx.first).at(yx.second+1)) {
          visited.at(yx.first).at(yx.second+1) = true;
          que.push({yx.first, yx.second+1});
        }
      }
      ans += wc * bc;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 512
#include <iostream>

int calc_sum(int x) {
    int ret = 0;
    while (x) {
        ret += x % 10;
        x /= 10;
    }

    return ret;
}

int main() {
    int N, A, B;
    std::cin >> N >> A >> B;

    int ret = 0;
    for (int i = 1; i <= N; ++i) {
        const int sum = calc_sum(i);
        if (A <= sum && sum <= B) {
            ret += i;
        }
    }

    std::cout << ret << std::endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int> >
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define INF 1000000000
#define eps 1e-7
#define mod 1000000007
#define int ll
using namespace std;

signed main(void) {
    int N, A, B;
    cin >> N >> A >> B;
    int a=0, b=0, c=0;
    rep(i, N) {
        int P;
        cin >> P;
        if (P <= A) a++;
        else if (P <= B) b++;
        else c++;
    }

    cout << min(a, min(b, c)) << endl;


    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	char arr[4];
	cin>>arr[0]>>arr[1]>>arr[2]>>arr[3];
	sort(arr,arr+4);
	if(arr[0]==arr[1]&&arr[2]==arr[3]&&arr[1]!=arr[2])
		cout<<"Yes";
	else
		cout<<"No";
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
  int a,b;
  int ans=0;

bool p_5(int n) {
  bool b;
  int n1 = n%10;
  n /= 10;
  int n2 = n%10;
  n /= 10;
  int n3 = n%10;
  n /= 10;
  int n4 = n%10;
  n /= 10;
  int n5 = n%10;
  if (n1==n5 && n2==n4) b=true; else b=false;
  return b;
}

int main()
{
  cin >> a >> b;
  for(int i = a; i <= b; i++) {if(p_5(i)) ans++;}
  cout << ans;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N = 305;
double dp[N][N][N];
int mark[N][N][N];
int a[5],n;
double play(int x,int y,int z){
    if(x==0 && y==0 && z==0)    return 0;
    if(mark[x][y][z])           return dp[x][y][z];
    mark[x][y][z] = 1;
    double all = (double)x+y+z;
    double num = (n-x-y-z)/all;
    if(x!=0)    num+=x*((play(x-1,y,z)+1)/all);
    if(y!=0)    num+=y*((play(x+1,y-1,z)+1)/all);
    if(z!=0)    num+=z*((play(x,y+1,z-1)+1)/all);
    return dp[x][y][z] = num;
}
int main(){
    int num;
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        scanf("%d",&num);
        a[num]++;
    }
    printf("%.9lf",play(a[1],a[2],a[3]));
    return 0;
}


Measured memory_bytes: 329984
#include "bits/stdc++.h"

#define rep(j,n) for(int j=0;j<n;j++)
#define ll long long
#define MX 100005

#define pb .push_back

using namespace std;

int main(){
    int n;
    ll h[MX];
    cin>>n;
    rep(i,n)cin>>h[i];
    int i=0,ans=0,k=0;

    while(i<n-1){
        if(h[i]>=h[i+1])k++;
        else{
            ans=max(k,ans);
            k=0;
        }
        i++;
    }
    ans=max(k,ans);
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>

int main()
{
  int n,i,j,g,min,koukan,kaisu=0;

  scanf("%d",&n);

  int S[n];

  for(i=0;i<n;i++)scanf("%d",&S[i]);
  for(i=0;i<n;i++)
    {
      
      min=i;
      
      for(j=i+1;j<n;j++)
	{
	  if(S[j]<S[min])
	    {
	      min=j;
	    }
	}
      if(min!=i)
	{
	  koukan=S[min];
	  S[min]=S[i];
	  S[i]=koukan;
	  kaisu++;
	}
    }
  
  for(i=0;i<n-1;i++)printf("%d ",S[i]);
  printf("%d\n%d\n",S[n-1],kaisu);
  return 0;
}



Measured memory_bytes: 2104
#[allow(unused_imports)]
use std::cmp::{Ordering};

#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};

#[allow(unused_imports)]
use std::io::{stdin, stdout, BufWriter, Write};

#[allow(unused_imports)]
use std::iter::FromIterator;

#[allow(unused_macros)]
macro_rules! min {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::min($x, min!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! max {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::max($x, max!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! get { 
    ([$t: ty]) => { 
        { 
            let mut line = String::new(); 
            stdin().read_line(&mut line).unwrap(); 
            line.split_whitespace().map(|t|t.parse::<$t>().unwrap()).collect::<Vec<_>>()
        }
    };
    ([$t: ty];$n: expr) => {
        (0..$n).map(|_|get!([$t])).collect::<Vec<_>>()
    };
    ($t: ty) => {
        {
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t: ty),*) => {
        { 
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            ($(iter.next().unwrap().parse::<$t>().unwrap(),)*)
        }
    };
    ($t: ty; $n: expr) => {
        (0..$n).map(|_|get!($t)).collect::<Vec<_>>()
    };
    ($($t: ty),*; $n: expr) => {
        (0..$n).map(|_|get!($($t),*)).collect::<Vec<_>>()
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*).unwrap();
    }
}

const BIG_STACK_SIZE: bool = true;

#[allow(dead_code)]
fn main() {
    use std::thread;
    if BIG_STACK_SIZE {
        thread::Builder::new()
            .stack_size(32 * 1024 * 1024)
            .name("solve".into())
            .spawn(solve)
            .unwrap()
            .join()
            .unwrap();
    } else {
        solve();
    }
}

fn solve() {
    let (n,x) = get!(usize, usize);
    let l = get!([usize]);

    let mut d = 0;
    for i in 0..n {
        d += l[i];
        if d > x {
            println!("{}", i+1);
            return;
        }
    }
    println!("{}", n+1);
}


Measured memory_bytes: 8572
#include<stdio.h>
int main()
{
    int haiku[4],m=0,i,n=0;
    for(i=0;i<3;i++)
    {
        scanf("%d",&haiku[i]);
    }
    for(i=0;i<3;i++)
    {
        if(haiku[i] == 5)
        {
            m++;
        }
        else if(haiku[i] == 7)
        {
            n++;
        }
    }
    if(m==2 && n==1)
    {
        printf("YES\n");
    }
    else
    {
        printf("NO\n");
    }
    return 0;
    
}

Measured memory_bytes: 1664
import java.util.*

fun main(args:Array<String>){
    val n = readLine()!!.toInt()
    var m = HashMap<String, Long>()
    for(i in 1 .. n){
        val s = readLine()!!.toCharArray().sorted().joinToString("")
        m[s] = (m[s] ?: 0) + 1
    }
    println(m.values.map{it * (it - 1) / 2}.sum())
}

Measured memory_bytes: 79916
package main

import (
	"fmt"
	"math"
)

var A, B, C, ans int

func main() {
	fmt.Scan(&A, &B, &C)

	// A%B ==r

	for i := 0; i <= 100; i++ {
		if (A*i)%B == C {
			fmt.Println("YES")
			return
		}
	}
	fmt.Println("NO")
}

/*  ----------------------------------------  */

func gcd(x, y uint64) uint64 {
	if x%y == 0 {
		return y
	} else {
		r := x % y
		return gcd(y, r)
	}
}

func combination(x, y int) int {
	return permutation(x, y) / permutation(y, y)
}

func permutation(x, y int) int {
	var ans int = 1
	for i := x - y; 0 < i; i-- {
		ans *= i
	}
	return ans
}

func max(x ...int) int {
	var res int = x[0]
	for i := 1; i < len(x); i++ {
		res = int(math.Max(float64(x[i]), float64(res)))
	}
	return res
}

func min(x ...int) int {
	var res int = x[0]
	for i := 1; i < len(x); i++ {
		res = int(math.Min(float64(x[i]), float64(res)))
	}
	return res
}

func pow(x, y int) uint64 { return uint64(math.Pow(float64(x), float64(y))) }
func abs(x int) int       { return int(math.Abs(float64(x))) }
func floor(x int) int     { return int(math.Floor(float64(x))) }

type si struct {
	s int
	i int
}

type SortBy []si

func (a SortBy) Len() int           { return len(a) }
func (a SortBy) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
func (a SortBy) Less(i, j int) bool { return a[i].s < a[j].s }


Measured memory_bytes: 512
//g++ -std=gnu++14 a.cpp
//#include <bits/stdc++.h>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <iostream>
#include <istream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <tuple>
#include <iomanip>
#include <random>
#include <math.h>

using namespace std;

#define ll long long
#define rep(i, n) for(ll i = 0; i < (n); i++)
ll MOD = 1e9 + 7;
int INF = 1 << 30;
ll INFL = 1LL << 60;

int main(){

  int N;
  cin >> N;
  vector<ll> h(N+10);
  for(int  i = 1;i <= N; i++) cin >> h[i];
  vector<ll> sum(N+10, INFL);
  sum[0] = INFL;
  sum[1] = 0;

  for(int i = 1; i <= N; i++){
    //sum[i] = min( abs(h[i]-h[i-1])+sum[i-1] , abs(h[i]-h[i-2])+sum[i-2]);
    sum[i+1] = min(sum[i+1], sum[i]+abs(h[i+1]-h[i]));
    sum[i+2] = min(sum[i+2], sum[i]+abs(h[i+2]-h[i]));
  }

  cout << sum[N] << endl;

}


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

typedef complex<double> P;

const double eps = 1e-8;

double dot(P a, P b) {
  return a.real()*b.real() + a.imag()*b.imag();
}

double cross(P a, P b) {
  return a.real()*b.imag() - a.imag()*b.real();
}

P getCrossP(P a1, P a2, P b1, P b2) {
  P a = a2 - a1;
  P b = b2 - b1;
  return a1 + a * cross(b, b1 - a1) / cross(b, a);
}

int ccw(P p, P a, P b) {
  a -= p;
  b -= p;
  if (cross(a, b) > eps) return 1;
  if (cross(a, b) < -eps) return -1;
  if (dot(a, b) < -eps) return 2;
  if (norm(b) - norm(a) > eps) return -2;
  return 0;
}

vector<P> convex_cut(vector<P> ps, P p1, P p2, int dir = -1) {
  vector<P> v;
  for (int i = 0; i < ps.size(); ++i) {
    P a = ps[i];
    P b = ps[(i + 1) % ps.size()];
    if (ccw(p1, p2, a) != dir) v.push_back(a);
    if (ccw(p1, p2, a) * ccw(p1, p2, b) == -1)
      v.push_back(getCrossP(a, b, p1, p2));
  }
  return v;
}

const int MAXM = 33333;

int n, m;
double w, h, S;
P L[MAXM], R[MAXM];
vector<P> ps;

double area[MAXM];
int num[MAXM];

void assign(vector<P> ps, int l, int r) {
  if (r - l < 1) return;
  if (r - l == 1) {
    num[l] += ps.size();
    return;
  }
  vector<P> pl, pr;
  int x = (l + r) / 2;
  P a = L[x-1];
  P b = R[x-1];
  for (int i = 0; i < ps.size(); ++i) {
    if (ccw(a, b, ps[i]) == 1) {
      pr.push_back(ps[i]);
    } else {
      pl.push_back(ps[i]);
    }
  }
  assign(pl, l, x);
  assign(pr, x, r);
}

int main() {
  while (cin >> n >> m >> w >> h >> S &&
         (n|m|(int)w|(int)h|(int)S)) {
    for (int i = 0; i < m; ++i) {
      cin >> L[i].imag() >> R[i].imag();
      L[i].real() = 0, R[i].real() = w;
    }
    ps.resize(n);
    for (int i = 0; i < n; ++i) {
      cin >> ps[i].real() >> ps[i].imag();
    }

    area[0] = (L[0].imag() + R[0].imag()) * w / 2.0;
    for (int i = 1; i < m; ++i) {
      double hl= L[i].imag() - L[i-1].imag();
      double hr= R[i].imag() - R[i-1].imag();
      area[i] = (hl + hr) * w / 2.0;
    }
    fill(num, num + m, 0);
    assign(ps, 0, m);

    int ans = n;
    double ns = 0;
    for (int i = 0, j = 0, cnt = 0; i < m;) {
      while (j < m && h * w - (ns + area[j]) + eps > S) {
        cnt += num[j];
        ns += area[j];
        ++j;
      }
      if (i != j) {
        ans = min(ans, n - cnt);
        cnt -= num[i];
        ns -= area[i];
        i++;
      } else {
        j++;
        i++;
      }
    }
    cout << ans << endl;
  }
  return 0;
}

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

int main(){
    long long int N;
    long long int X;
    long long int T;

    //入力
    cin >> N >> X >>T;
    long long int ans;

    if(N%X==0){
        ans = N*T/X;
    }else{
        ans = ((N/X)+1)*T;
    }
    
    cout << ans << endl;
}


Measured memory_bytes: 3592
from collections import Counter

n = int(input())

a = []
for i in range(n):
    s = input()
    a.append(s)

count = Counter(a)
most = count.most_common()
tmp = []
mostidx = most[0][1]
for ss, ii in most:
    if ii == mostidx:
        tmp.append(ss)
tmp.sort()
for t in tmp:
    print(t)		

Measured memory_bytes: 47636
#include<stdio.h>
int main(void){
    int i,j;
    int count[101]={0};
    int number;
    int flag=0;
    int counta=0;

    while(scanf("%d",&number)!=EOF){
        counta++;
        count[number]++;
    }   
    for(i=counta;i>=0;i--){
        for(j=0;j<101;j++){
            if(count[j]==i){
                printf("%d\n",j);
                flag=1;
                break;
            }   
        }   
        if(flag)break;
    }   
    for(i=0;i<101;i++){
        if((count[i]==count[j])&&(i!=j)){
            printf("%d\n",i);
        }   
    }   
    return 0;
}

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

namespace _057
{
    class Program
    {
        static void Main(string[] args)
        {
            // B - Checkpoints
            var line = Console.ReadLine().Split(' ').Select(x=>int.Parse(x)).ToArray();
            var n = line[0];
            var m = line[1];

            var ab = new long[n,2];
            var cd = new long[m,2];
            var ans = new int[n];
            for (int i = 0; i < n; i++)
            {
                var line2 = Console.ReadLine().Split(' ').Select(x=>long.Parse(x)).ToArray();
                ab[i,0] = line2[0];
                ab[i,1] = line2[1];
            }
            for (int i = 0; i < m; i++)
            {
                var line2 = Console.ReadLine().Split(' ').Select(x=>long.Parse(x)).ToArray();
                cd[i,0] = line2[0];
                cd[i,1] = line2[1];
            }

            for (int i = 0; i < n; i++)
            {
                long min = 10000000000;
                for (int j = 0; j < m; j++)
                {
                    var w = Math.Abs(ab[i,0]-cd[j,0])+Math.Abs(ab[i,1]-cd[j,1]);
                    if(w < min)
                    {
                        min = w;
                        ans[i] = j;
                    }
                }
            }

            for (int i = 0; i < n; i++)
            {
                Console.WriteLine(ans[i] + 1);
            }
        }
    }
}


Measured memory_bytes: 13396
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const double pi = acos(-1);

int main() {
    ll n;
    cin >> n;
    ll m = n/2;

    vl a(n);
    rep(i, n) {
        cin >> a[i];
    }

    vl b(m);
    for(ll i = 0; i < n; i += 2) {
        b[i/2] = a[i];
    }
    vl c(m);
    for(ll i = 1; i < n; i += 2) {
        c[i/2] = a[i];
    }

    vl vb(100010);
    rep(i, m) {
        vb[b[i]]++;
    }
    vl vc(100010);
    rep(i, m) {
        vc[c[i]]++;
    }

    ll mab = 0;
    ll idb = 0;
    rep(i, 100010) {
        if(mab < vb[i]) {
            mab = vb[i];
            idb = i;
        }
    }
    ll mac = 0;
    ll idc = 0;
    rep(i, 100010) {
        if(mac < vc[i]) {
            mac = vc[i];
            idc = i;
        }
    }
    sort(rall(vb));
    sort(rall(vc));

    if(idb == idc) {
        out(n - max(vb[1] + vc[0], vb[0] + vc[1]));
    }   
    else {
        out(n - (vb[0] + vc[0]));
    }

    re0;
}

Measured memory_bytes: 3328
import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N, A, B = lr()
A -= B # 全員にBのダメージが加わるとする
H = np.array([ir() for _ in range(N)])

def check(x):
    hp = H - B*x
    hp = hp[hp>0]
    cnt = ((hp + A - 1) // A).sum()
    return cnt <= x

#二分探索
left = 0 #NG
right = 10 ** 9 #OK
while right > left + 1:
    mid = (left + right) // 2
    if check(mid):
        right = mid
    else:
        left = mid

print(right)
# 45

Measured memory_bytes: 17112
#include <iostream>
#include <cctype>
#include <cstdlib>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#define rep(i, n) for(int i = 0; i < n; ++i)
using namespace std;

int comp(const void* a, const void* b){
	return *(int*)a - *(int*)b;
}

int main() {
	int n;
	cin >> n;
	cout << n/3 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,l,n) for(int i=l;i<n;i++)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define int long long
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

signed main(){
	int n,k,x,y;
	cin>>n>>k;
	rep(i,0,k){
		cin>>x>>y;
		int tmp=min(x,min(y,min(n+1-x,n+1-y)));
		o((tmp%3==0?3:tmp%3));
	}
}

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

using namespace std;

int main() {
    int dict[26] = {};
    string s;
    cin >> s;
    for (char i : s) {
        dict[i - 'a']++;
    }
    for (int i = 0; i < 26; i++) {
        if (dict[i] == 0) {
            cout << char('a' + i) << endl;
            return 0;
        }
    }
    cout << "None" << endl;
    return 0;
}

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

#define rp(i, k, n) for (int i = k; i < n; i++)
typedef long long ll;
typedef double ld;

template<class T>inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>inline bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF = 1ll << 60;
const ll MOD = 1e9 + 7ll;
const double PI=3.14159265358979323846;

// struct UnionFind {
//     vector<int> par;
//     vector<int> siz;
//     UnionFind(int _sz) : par(_sz), siz(_sz, 1) {
//         rp(i, 0, _sz) par[i] = i;
//     }
//     int root(int a) {
//         while(a != par[a]) {
//             a = par[a] = par[par[a]];
//         }
//         return a;
//     }
//     bool unite(int a, int b) {
//         int root_a = root(a);
//         int root_b = root(b);
//         if(root_a == root_b) return false;
//         else {
//             par[b] = root_a;
//             siz[root_a] += siz[root_b]; 
//             return true;
//         }
//     }
// };

// union by size + path having
class UnionFind {
public:
    vector <ll> par; // 各元の親を表す配列
    vector <ll> siz; // 素集合のサイズを表す配列(1 で初期化)

    // Constructor
    UnionFind(ll sz_): par(sz_), siz(sz_, 1LL) {
        for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
    }
    void init(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1LL);  // resize だとなぜか初期化されなかった
        for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
    }

    // Member Function
    // Find
    ll root(ll x) { // 根の検索
        while (par[x] != x) {
            x = par[x] = par[par[x]]; // x の親の親を x の親とする
        }
        return x;
    }

    // Union(Unite, Merge)
    bool merge(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        // merge technique（データ構造をマージするテク．小を大にくっつける）
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool issame(ll x, ll y) { // 連結判定
        return root(x) == root(y);
    }

    ll size(ll x) { // 素集合のサイズ
        return siz[root(x)];
    }
};



int main() {
    int n, m;
    cin >> n >> m;
    UnionFind uf(n);
    rp(i, 0, m) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        uf.merge(a, b);
    }
    int res = 0;
    rp(i, 0, n) chmax(res, (int)uf.siz[uf.root(i)]);
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 6428
#include<bits/stdc++.h>
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast")
#define ll long long
#define ull unsigned long long
#define LLMax LLONG_MAX
#define LLMin LLONG_MIN
#define Max INT_MAX
#define Min INT_MIN
#define FOR1(i,a,b) for(int i=(a);i<(b);i++)
#define FOR2(i,a,b) for(int i=(a);i<=(b);i++)
#define DWN(j,b,a) for(int j=(b);j>=(a);j--) 
#define SET0(a) memset(a,0,sizeof(a))
#define SETN1(a) memset(a,-1,sizeof(a))
#define IOS ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
//#define int long long
const int INF=0x3f3f3f3f;
const int NINF=-INF-1;
const double PI=acos(-1); 
const int mod=1e9+7;
const int maxn=5e5+50;
using namespace std;
int main() {
	//IOS;
	int n;
	cin>>n;
	printf("%.9lf",PI*2*n);
	return 0;
}

Measured memory_bytes: 3764
### ----------------
### ここから
### ----------------

import sys
from io import StringIO
import unittest

def yn(b):
    print("Yes" if b==1 else "No")
    return

def resolve():
    readline=sys.stdin.readline

    #n,m,k=map(int, readline().rstrip().split())
    #arr=list(map(int, readline().rstrip().split()))
    n=int(readline())
    arr=list(map(int, readline().rstrip().split()))
    x=0
    for a in arr:
        x=x^a
    
    ans=[]
    for a in arr:
        ans.append(str(x^a))
    print(" ".join(ans))
    #ss=readline().rstrip()
    #yn(1)

    return

if 'doTest' not in globals():
    resolve()
    sys.exit()

### ----------------
### ここまで 
### ----------------


Measured memory_bytes: 43556
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int A, B, K, i;
    cin >> K;
    cin >> A >> B;
    for(i=A; i<=B; i++){
        if(i%K==0){
            break;
        }
    }
    cout << (i<=B?"OK":"NG");
}


Measured memory_bytes: 3624
/*input

*/


//assic value of ('0'-'9') is(48 - 57) and (a-z) is (97-122) and (A-Z) is(65-90) and 32 for space
#include<bits/stdc++.h>
using namespace std;
#define ll          long long
#define pb          push_back
#define pii         pair<ll int,ll int>
#define vpii        vector< pii >
#define vi          vector<ll int>
#define vs			vector< string >
#define vvi         vector< vector< ll > >
#define inf			(ll)1e18
#define all(it,a)   for(auto it=(a).begin();it!=(a).end();it++) 
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define rep(i,a,b)	for(ll int i=a;i<b;i++)
#define repr(i,a,b) for(ll int i=a;i>b;i--)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define mp          make_pair
#define whatis(x)   cout << #x << " is " << x << "\n";
#define graph(n)    adj(n,vector< ll > () )
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());


int solve()
{
	ll n;cin>>n;
	vi a(n);
	rep(i,0,n) cin>>a[i];
	ll f=0;
	rep(i,0,n)
	{
		if(a[i]%2==0)
		{
			if(!(a[i]%6==0 || a[i]%10==0)) f=1; 
		}
	}

	cout<<(f==1?"DENIED":"APPROVED");
	return 0;
}

int main()
{
	auto start = chrono::high_resolution_clock::now();

	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	ll test_cases=1;
	//cin>>test_cases;
	while(test_cases--)
		solve();

	auto stop = chrono::high_resolution_clock::now();
	auto duration = chrono::duration_cast<chrono::milliseconds>(stop-start);
	// cout<<"\nduration: "<<(double)duration.count()<<" milliseconds";
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>

int main(){

    int a, b;
    std::cin >> a >> b;

    if(a < b){
        std::cout << "a < b" << std::endl;
    }
    else if(a > b){
        std::cout << "a > b" << std::endl;
    }
    else{
        std::cout << "a == b" << std::endl;
    }

    return 0;
}


Measured memory_bytes: 3096
s=input()
if s=="MON":
  print("6")
elif s=="TUE":
  print("5")
elif s=="WED":
  print("4")
elif s=="THU":
  print("3")
elif s=="FRI":
  print("2")
elif s=="SAT":
  print("1")
else:
  print("7")
  

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

#define ll long long
#define MAX 300005
#define pp pair<int,int>
#define pb push_back
#define mod 10

using namespace std;
/*
 * author: Kruti_20
 */
ll power(ll x, ll y);

ll gcd(ll a, ll b) {
    if (b == 0) return a;
    return gcd(b, a % b);
}

ll cost[100005];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n, k;
    cin >> n >> k;
    int h[n];
    for (int i = 0; i < n; i++) cin >> h[i];
    for (int i = 0; i < n; i++) cost[i] = 2000000000;
    cost[0] = 0;
    for (int i = 1; i < n; i++) {
        for (int j = 1; j <= k; j++) {
            if (i - j >= 0) cost[i] = min(cost[i], cost[i - j] + abs(h[i] - h[i - j]));
        }
    }
    cout << cost[n - 1];
    return 0;
}


ll power(ll x, ll y) {
    ll res = 1;
    x = x % mod;
    while (y > 0) {
        if (y & 1) res = (res * x) % mod;
        y = y >> 1;
        x = (x * x) % mod;
    }
    return res;
}

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

using namespace std;

const int MAXN = 100001;

vector <int> adj[MAXN];
int memo[MAXN],N,M;

int dfs(int node){
	if(memo[node] != -1)return memo[node];
	int res = 0;
	for(int &i : adj[node]){
		res = max(res,dfs(i) + 1);
	}
	return memo[node] = res;
}

int main(){
	#ifdef EVAL 
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif
	cin >> N >> M;
	for(int i = 0,a,b; i < M; i++){
		cin >> a >> b;
		adj[a].push_back(b);
	}
	memset(memo,-1,sizeof(memo));
	int res = 0;
	for(int i = 1; i <= N; i++){
		res = max(res,dfs(i));
	}
	cout << res;
	return 0;
}

Measured memory_bytes: 8192