akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define reps(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; --i)
#define INF 1000000000000
#define MOD 1000000007
#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0, a1, a2, a3, a4, x, ...) x
#define debug_1(x1) cout << #x1 << ": " << x1 << endl
#define debug_2(x1, x2) \
    cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << endl
#define debug_3(x1, x2, x3)                                                 \
    cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
         << x3 << endl
#define debug_4(x1, x2, x3, x4)                                             \
    cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
         << x3 << ", " #x4 << ": " << x4 << endl
#define debug_5(x1, x2, x3, x4, x5)                                         \
    cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
         << x3 << ", " #x4 << ": " << x4 << ", " #x5 << ": " << x5 << endl
#ifdef _DEBUG
#define debug(...)                                                        \
    CHOOSE((__VA_ARGS__, debug_5, debug_4, debug_3, debug_2, debug_1, ~)) \
    (__VA_ARGS__)
#else
#define debug(...)
#endif

using namespace std;
using ll = long long;

int main() {
    ll n;
    double d;
    cin >> n >> d;
    vector<ll> x(n, 0), y(n, 0);
    rep(i, n) cin >> x[i] >> y[i];
    int cnt = 0;
    rep(i, n) {
        double ans = sqrt(x[i] * x[i] + y[i] * y[i]);
        debug(ans);
        if (ans <= d) cnt++;
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 6104
n=int(raw_input())
s=(raw_input()).split(" ")
q=int(raw_input())
t=(raw_input()).split(" ")

for i in range(n):
    s[i]=int(s[i])
for i in range(q):
    t[i]=int(t[i])
t=sorted(t)

#print(s)
#print(t)

s_index=0

rt=0

for i in range(q):
    while s[s_index]<=t[i]:
        #print("s_index="+str(s_index)+" s[s_index]="+str(s[s_index]))
        #print("i="+str(i)+" t[i]="+str(t[i]))
        #print("rt="+str(rt))
        #print(" ")
        if s[s_index]==t[i]:
            rt+=1
            break
        s_index+=1
        if s_index>=n:
            break
        
    if s_index>=n:
            break

print(rt)

Measured memory_bytes: 16296
N, M = map(int, input().split())
A = [list(input().split()) for i in range(M)]

starts = {}
goals = {}
for i in range(len(A)):
    s_num = A[i][0]
    g_num = A[i][1]
    if s_num == '1':
        starts[A[i][1]] = 0
    elif g_num == str(N):
        goals[A[i][0]] = 0

is_ok = False
for s in starts:
    if s in goals:
        is_ok = True
        break


# is_ok = False
# for j in range(len(start)):
#     for k in range(len(goal)):
#         if start[j][1] == goal[k][0]:
#             is_ok = True
#             break
#     if is_ok:
#         break

if is_ok:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

Measured memory_bytes: 58728
from collections import defaultdict
n = int(input())
ns = list(map(int, input().split()))
dic = defaultdict(int)
max_n = 0
for i in ns:
    dic[i] += 1
    max_n = max(max_n, i)
result = 0

for i in ns:
    result = max(result, dic[i]+dic[i+1]+dic[i-1])
print(result)


Measured memory_bytes: 19416
N = int(input())
a = [int(i) for i in input().split()]
b = [0 for i in range(N)]
c = []


for i in range(N-1, -1, -1):
    for j in [0, 1]:
        b[i] = j
        if sum(b[i::i+1]) % 2 == a[i]:
            break
    else:
        print("-1")
        exit()

M = sum(b)
print(M)

for index, value in enumerate(b):
    if value == 1:
        c.append(index + 1)

ans = ' '.join(map(str, c))
print(ans)

Measured memory_bytes: 19896
import itertools
N = int(input())
l = list(map(int,input().split()))
ans = 0
if N >= 3:
  l.sort()
  l2 = list(itertools.combinations(l, 3))
  for i in range(len(l2)):
    if (l2[i][0] + l2[i][1] > l2[i][2]) and (l2[i][0] != l2[i][1] != l2[i][2]):
      ans += 1
print(ans)

Measured memory_bytes: 20480
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <deque>

using namespace std;

int main()
{
    string s;
    cin >> s;
    int q;
    cin >> q;
    string t;
    for (int qi = 0; qi < q; ++qi)
    {
        int ty;
        cin >> ty;
        if(ty == 1){
            swap(s, t);
        }else if( ty ==2 ){
            int f;
            char c;
            cin >> f >> c;
            if( f == 1 ){
                t += c;
            }else if ( f==2 ){
                s += c;
            }
        }
    }
    reverse(t.begin(), t.end());
    cout << t << s << endl;

    return 0;
}

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

int main(){
    int x, y;
    std::cin >> x >> y;
    for(int turu = 0; turu <= x; turu++){
        int kame = x - turu;
        if(turu * 2 + kame * 4 == y){
            std::cout << "Yes" << std::endl;
            return 0;
        }
    }
    std::cout << "No" << std::endl;
    return 0;
}


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

using namespace std;

using ll = long long int;
using ld = long double;

using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vvvl = vector<vvl>;
using vd = vector<double>;
using vvd = vector<vd>;
using vs = vector<string>;
using vb = vector<bool>;
using vvb = vector<vb>;

const int INF = (1 << 30) - 1;
const ll INF64 = ((ll)1 << 62) - 1;
const double PI = 3.1415926535897932384626433832795;

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

int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
int lcm(int x, int y) { return x / gcd(x, y) * y; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }

using edge = struct {
	ll to;
	ll cost;
};
vector<edge> tree[100030];
ll depth[100030];

void dfs(ll u, ll p, ll v) {
	depth[u] = v;

	for (auto e : tree[u]) {
		if (e.to == p) {
			continue;
		}

		dfs(e.to, u, v + e.cost);
	}
}

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

	int n;
	cin >> n;
	for (int i = 0; i < n - 1; i++) {
		ll a, b, c;
		cin >> a >> b >> c;
		a--; b--;
		tree[a].push_back({ b, c });
		tree[b].push_back({ a, c });
	}


	ll q, k;
	cin >> q >> k;
	k--;

	dfs(k, -1, 0);

	for (int i = 0; i < q; i++) {
		ll x, y;
		cin >> x >> y;
		x--; y--;

		cout << depth[x] + depth[y] << endl;
	}
	return 0;
}

Measured memory_bytes: 14336
#include<iostream>
#include<string>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)

int main(){
  string s;
  cin >> s;
  bool b = true;
  rep(i, 3){
    if(s[i] == s[i+1]){
      b = false;
      break;
    }
  }
  if(b) cout << "Good" << endl;
  else cout << "Bad" << endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
using ll = long long;
int main(int argc, const char * argv[]) {
    ll a, b, c, k, x;
    cin >> a >> b >> c >> k;
    if (k % 2 == 0) {
        //x = - (a - b);
        x = a - b;
    }else{
        //x = a - b;
        x = - (a - b);
    }
    if (abs(x) > 1000000000000000000) {
        cout << "Unfair" << endl;
    }else{
        cout << x << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#define N 9
using namespace std;
void NP(int);
void check();
int flag;
pair<char,char> data[N],out[N];
bool used[N];
int main(){
  int T;
  cin >> T;
  for(int i=0;i<T;i++){
    for(int j=0;j<N;j++){
      cin >> data[j].first;
    }
    for(int j=0;j<N;j++){
      cin >> data[j].second;
    }
    flag=0;
    NP(0);
    if(flag==1) cout << 1 << endl;
    else cout << 0 << endl;
  }
  return 0;
}
void NP(int x){
  if(x<N){
    for(int i=0;i<N;i++){
      if(used[i]) continue;
      out[x]=data[i];
      used[i]=true;
      NP(x+1);
      used[i]=false;
    }
  }else{
    check();
  }
}
void check(){
  int flag1=0;
  for(int i=0;i<N;i+=3){
    if(out[i].second==out[i+1].second&&out[i+1].second==out[i+2].second){
      if(out[i].first==out[i+1].first-1&&out[i+1].first==out[i+2].first-1){
      }
      else if(out[i].first==out[i+1].first&&out[i+1].first==out[i+2].first){
      }
      else{
	flag1=1;
	break;
      }
    }else{
      flag1=1;
      break;
    }
  }
  if(flag1==0) flag=1;
}

Measured memory_bytes: 1156
def combnk_mod(n, k, p):
    # pが素数かつaとpが互いに素であるとき
    # フェルマーの小定理より以下が成り立つ.
    # 1 / a = a ** (p - 2) (mod p)
    # これを使って (1 / k!) mod p を計算する.

    if  2 * k > n:
        k = n - k
    x = 1 # 分母にあたる数 1 / n! mod p
    y = 1 # 分子にあたる数. n! / (n - k)! mod p
    for i in range(1, k + 1):
        x *= pow(i, p - 2, p)
        y *= n - i + 1
        x %= p
        y %= p
    return (x * y) % p

MOD = 10 ** 9 + 7
x, y = map(int, input().split())
m = 2 * x - y
n = 2 * y - x
if m < 0 or n < 0:
    ans = 0
elif m % 3 > 0 or n % 3 > 0:
    ans = 0
else:
    m = (2 * x - y) // 3
    n = (2 * y - x) // 3
    ans = combnk_mod(m + n, min(m, n), MOD)
print(ans)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
// Welcome to my source code!

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

int main() {
    ll h;
    cin >> h;
    ll t = h, cnt = 0;
    while (t / 2) {
        if (t & 1) t--;
        t /= 2;
        cnt++;
    }
    ll x = 1, ans = 0;
    for (ll i = 0; i <= cnt; i++) {
        ans += x;
        x *= 2;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
depth = int(input()) 
leaves = list(map(int, input().split(" ")))
limited = []
limited_a = []

def solve (depth) :
    cur = 1
    i = 0 
    while i <= depth :
        limited_a.append( cur )
        if cur <= 0 and leaves[i] != 0 :
            return False
        cur=(cur-leaves[i])*2
        i+=1 
    
    _min = _max = 0
    i = depth
    while i >= 0 :
        if i==depth: 
            if leaves[i] > limited_a[i] :
                return False
            limited.append(leaves[i])
            _max = leaves[i]
            _min = (leaves[i]+1)//2
        else :
            _max = min(limited_a[i], _max+leaves[i])
            _min = (_min+leaves[i]+1)//2
            if _max < _min :
                return False 
            limited.append(_max)
        i -= 1
    return True

if solve(depth) :
    print(sum(limited))
else :
    print (-1)

Measured memory_bytes: 680024
#include <iostream>
#include <algorithm>

using namespace std;

int main(){
    int N, M;
    cin >> N >> M;
    int ans = N;
    for(int i=0; i<M; i++){
        int a;
        cin >> a;
        ans -= a;
    }    
    if(ans >= 0) cout << ans << endl;
    else cout << -1 << endl;
    return 0;
}

Measured memory_bytes: 3624
from collections import defaultdict

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

di = defaultdict(int)
dj = defaultdict(int)
for i in range(1, N+1):
  di[i + A[i-1]] += 1
  dj[i - A[i-1]] += 1

ans = 0
for key in di.keys():
  ans += dj[key] * di[key]

print(ans)

Measured memory_bytes: 73596
N,M,X,Y = map(int,(input().split()))
x = list(map(int,(input().split())))
y = list(map(int,(input().split())))
l = max(x)
r = min(y)
if l >= r:
    print("War")
else:
    if X < r <= Y:
        print("No War")
    else:
        print("War")

Measured memory_bytes: 38256
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;

int main(){
	char a;
	int counter = 0;
	for (int i = 0;i<3;i++){
		cin >> a;
		if (a == 'o'){
			counter++;
		}
	}
	cout << 700 + 100*counter <<endl;
	return 0;
}

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

int INF=1e9+1;
vector<vector<long long int>> dp(200,vector<long long int>(20000,INF)) ;

int main(){
    long long int N,W;
    cin>>N>>W;
    int v[200],w[200];
    for(int i=0;i<N;i++){
        cin>>v[i]>>w[i];
    }
    dp[0][0]=0;
    //for(int i=0;i<20000;i++) dp[0][i]=0;

    for(int i=0;i<N;i++){
        for(int j=0;j<=19999;j++){
            if(j>=v[i]){
                dp[i+1][j]=min(dp[i][j],dp[i][j-v[i]]+w[i]);
            }else {
                dp[i+1][j]=dp[i][j];
            }
        }
    }
    for(int i=19999;i>=0;i--){
        //cout<<dp[N][i]<<" check"<<endl;
        if(dp[N][i]<=W) {
            cout<<i<<endl;
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 34936
//競技プログラミング用のテンプレート
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <string>
#include <math.h>
#include <stack>
#include <limits>

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define repr(i, n) for(int i = n - 1; i >= 0; i--)

using namespace std;
//エイリアス
using ll = long long int;
using p = pair<int, int>;
using pl = pair<ll, ll>;
using v = vector<int>;
using vd = vector<double>;
using vs = vector<string>;
using vl = vector<ll>;

//定数
const int intmax = numeric_limits<int>::max();
const ll llmax = numeric_limits<ll>::max();
const ll mod = 1e9 + 7;
const double pi = M_PI;

int main()
{
  int n;
  cin >> n;
  vl ls(n, 0);
  rep(i, n) cin >> ls[i];
  ll cnt = 0;
  for(int i = 0; i < n; i++) {
    for(int j = i + 1; j < n; j++) {
      for(int k = j + 1; k < n; k++) {
        if (ls[i] == ls[j] || ls[j] == ls[k] || ls[i] == ls[k]) continue;
        if (ls[i] + ls[j] > ls[k] && ls[j] + ls[k] > ls[i] && ls[k] + ls[i] > ls[j]) cnt++;
      }
    }
  }
  cout << cnt << endl;
}


Measured memory_bytes: 3612
#include <bits/stdc++.h>
#define N 100010
#define int long long
using namespace std;
typedef pair<int,int> P;
int n,m;
vector<int> G[N];
int flag;
int col[N];
 
P cnt;
void dfs(int pos,int c){
  if(col[pos]!=-1 && c!=col[pos]) flag = 1;
  if(col[pos]!=-1 && c==col[pos]) return; 
  if(flag) return;
  c? cnt.first++:cnt.second++;
  col[pos] = c;
  for(int nx:G[pos])dfs(nx,!c);
}
 
map<int,int> A;

int calc(int d){
  int a = (n-d)/2;
  int b = n - a;
  return a*b;
}

int dp[N] = {};
int DP(){
  int sum = 0;
  for(P a:A) sum+=a.first*a.second;

  for(P a:A){
    dp[0] = 1;
    for(int j=0;j<N;j++)if(dp[j]) dp[j] = a.second+1;
    for(int j=0;j<N;j++){
      if(j+a.first>=N)break;
      if(dp[j] == 0)continue;
      dp[j+a.first] = max(dp[j+a.first],dp[j] - 1);
    }
  }
  
  int res = 0;

  for(int i=0;i<N;i++){
    if(dp[i]>0) res = max(res,calc(abs(i-(sum-i))));
  }
  return res;
}

signed main(){
  cin>>n>>m;
  for(int i=0,a,b;i<m;i++){
    cin>>a>>b;a--,b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }
 
  memset(col,-1,sizeof(col));
  for(int i=0;i<n;i++) {
    if(col[i]!=-1)continue;
    cnt = P(0,0); 
    dfs(i,0);
    A[abs(cnt.first-cnt.second)]++;
  }

  if(flag) cout<<"-1"<<endl,exit(0);
  cout<<DP()-m<<endl;
  return 0;
}

Measured memory_bytes: 11368
input = gets.split(" ")

A = input[0].to_i
B = input[1].to_i
C = input[2].to_i
X = input[3].to_i
Y = input[4].to_i


#A_mai = 0
#B_mai = 0
#AB_mai = 0
#print((A+B)/2 < C)

if (A+B)/2 < C # Cが割高
#  print "1da"
  A_mai = X
  B_mai = Y
  AB_mai = 0
elsif A/2 > C && B/2 > C 
 # print "2da"
  max = [X,Y].max
  A_mai = 0
  B_mai = 0
  AB_mai = 2*max

elsif A/2 > C && X < Y # 
#  print "3da"
  AB_mai = 2*X
  B_mai = Y-X
  A_mai = 0

elsif A/2 > C && X >= Y #
 # print "4da"
  AB_mai = 2*X
  A_mai = 0
  B_mai = 0

elsif B/2 > C && X >= Y #
#  print "5da"
  AB_mai = 2*Y
  A_mai = X-Y
  B_mai = 0

elsif B/2 > C && X < Y
#  print "6da"
  AB_mai = 2*Y
  A_mai = 0
  B_mai = 0
else # 
  min = [X,Y].min
  AB_mai = 2*min
  if X < Y
    A_mai = 0
    B_mai = Y - min
  else
    A_mai = X - min
    B_mai = 0

   #print "7da"
  end
end
  
#print A_mai
#print B_mai
#print AB_mai

print A_mai * A + B_mai * B + AB_mai * C
print("\n")


Measured memory_bytes: 1788
N, K = map(int, input().split())
A = list(map(int, input().split()))

"""
dp[i]: 残りの石の個数がiの局面で手番が回ってきたときに勝つか負けるか。(boolean)
"""
dp = [False] * (K + 1)

for i in range(K+1):
    for a in A:
        if i - a >= 0:
            if not dp[i - a]:
                dp[i] = True
                continue
if dp[K]:
    print("First")
else:
    print("Second")


Measured memory_bytes: 41580
n, m = map(int, input().split())
g = [[] for _ in range(n)] # 隣接リスト

for _ in range(m):
    a, b = [int(x) for x in input().split()]
    g[a - 1].append(b - 1)
    g[b - 1].append(a - 1)

from collections import deque

def bfs(u):
    queue = deque([u])
    d = [None] * n # uからの距離の初期化
    d[u] = 0 # 自分との距離は0
    while queue:
        v = queue.popleft()
        for i in g[v]:
            if d[i] is None:
                d[i] = v
                queue.append(i)
    return d

# 0からの各頂点の距離
d = bfs(0)
print('Yes')
for i in range(1, n):
    print(d[i] + 1)

Measured memory_bytes: 33940
import java.util.Scanner;
  
public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int[] alpha = new int['z' - 'a' + 1];
        while (scan.hasNext()) {
            String str = scan.next().toLowerCase();
            for (int i = 0; i < str.length(); i++) {
                if (Character.isLetter(str.charAt(i))) {
                    alpha[str.charAt(i) - 'a']++;
                }
            }
        }
        for (int i = 0; i < alpha.length; ++i) {
            System.out.println((char)('a' + i) + " : " + alpha[i]);
        }
    }
}

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

int main() {
  int n,m,sub;
  cin >> n >> m;
  vector<int> t(n);
  for(int i = 0; i < m; i++){
    cin >> sub;
    t.at(sub - 1)++;
    cin >> sub;
    t.at(sub - 1)++;
  }
  for(int i = 0; i < n; i++){
    cout << t.at(i) << endl;
  }
}


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

using ll = long long;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)

#define rng(a) a.begin(), a.end()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  rep(i, (int)v.size()) {
    if (i)
      os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

template <typename T, size_t S> void printArray(const T (&array)[S]) {
  for (auto val : array)
    std::cout << val << ", ";
  std::cout << "\n";
}

const int mod = 1e9 + 7;
const int inf = 1e9 + 5;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << std::setprecision(10);

  ll n; std::cin >> n;
  ll tmp = n;
  vi vec;
  while (tmp!= 0) vec.pb(tmp%10), tmp/=10;
  reverse(rng(vec));
  ll ans = 0;
  int digitNum = vec.size() - 1, loopNum = 1 << digitNum;
  for (int i = 0; i < loopNum; i++) {
    ll sum = vec[0];
    rep(j, digitNum) {
      if ((i >> j) & 1)
        ans += sum, sum = vec[j+1];
      else
        sum *= 10, sum += vec[j+1];
    }
    ans += sum;
  }
  std::cout << ans << "\n";
}


Measured memory_bytes: 256
while 1:
	n3=mn=input()**3
	if n3==0:break
	i=0
	while 1:
		i+=1
		i3=i**3
		j=int((n3-i3)**(1/3.0))
		if j<i:break
		m=n3-i3-j**3
		if m<mn:mn=m
	print mn

Measured memory_bytes: 4292
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        // ??????????????????????????????.
        // ???????????????????????´??°??? 1 ???????????????.
        Scanner sc = new Scanner(System.in);
        double r = sc.nextDouble();

        //
        System.out.printf("%8.6f %8.6f\n", r * r * Math.PI, 2 * r * Math.PI);
    }
}

Measured memory_bytes: 28312
import java.util.Scanner;

public class Main
{
	public static void main(String[] args) 
	{
		Scanner scan = new Scanner(System.in);
		while(true)
		{
			int a = scan.nextInt();
			String op = scan.next();
			int b = scan.nextInt();
			switch(op)
			{
			case "+":
				System.out.println(a+b);
				break;
			case "-":
				System.out.println(a-b);
				break;
			case "*":
				System.out.println(a*b);
				break;
			case "/":
				System.out.println(a/b);
				break;
			default:
				break;
			}
			if(op.equals("?"))
			{
				break;
			}
		}
		
	}
}



Measured memory_bytes: 26276
program main
  implicit none
  integer*8 :: h, w, ans
  read *, h, w
  if (h == 1 .or. w == 1) then
    ans = 1
  else if (mod(h * w, 2) == 0) then
    ans = h * w / 2 
  else
    ans = (h * w + 1)/ 2
  end if
  print '(i0)', ans
end program

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(k,i,n) for(ll i=k;i<n;++i)
int main(void){
    ll a,b,k;
    cin>>a>>b>>k;
    vector<ll>x;
    rep(0,i,min(a,b)){
        if(a%(i+1)==0 && b%(i+1)==0)x.push_back(i+1);
    }
    cout<<x[x.size()-k]<<endl;
}


Measured memory_bytes: 256
import itertools

n, m, q = map(int, input().split())

l = []
for i in range(q):
    a, b, c, d = map(int, input().split())
    l.append([a-1, b-1, c, d])

ans = 0

for A in itertools.combinations_with_replacement(range(1, m+1), n):
    res = 0
    for i in range(q):
        if A[l[i][1]] - A[l[i][0]] == l[i][2]:
            res += l[i][3]
    ans = max(ans, res)

print(ans)

Measured memory_bytes: 8948
#include <bits/stdc++.h>
// Hey! 僕の提出を見てくれてありがとう.
// ロボ子さん可愛いぞ！！！！！君もV沼にはまろう↓
// https://www.youtube.com/channel/UCDqI2jOz0weumE8s7paEk6g
using namespace std;
using ll = long long;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}//a,bの最大公約数(gcd)を求める
ll lcm(ll a,ll b){return abs(a*b)/gcd(a,b);}//a,bの最小公倍数(lcm)を求める
vector<ll> enum_div(ll n){vector<ll> ret;for(int i=1 ; i*i<=n ; i++){if(n%i == 0){ret.push_back(i);if(i!=1 && i*i!=n)ret.push_back(n/i);}}ret.push_back(n);return ret;}
//↑nの約数を求める
vector<bool> IsPrime; void sieve(size_t max){if(max+1 > IsPrime.size())IsPrime.resize(max+1,true);IsPrime[0] = false;IsPrime[1] = false;for(size_t i=2; i*i<=max; ++i)if(IsPrime[i])for(size_t j=2; i*j<=max; ++j)IsPrime[i*j] = false;}
//↑エラトステネスの篩で素数を求める
#define roundup(divisor,dividend) (divisor + (dividend - 1)) / dividend //切り上げ割り算
#define all(x) (x).begin(),(x).end() //xの初めから終わりまでのポインタ
#define size_t ll //size_tは自動でllに変換される
#define pb(x) push_back(x)
#define pri_queue priority_queue //優先度付きキュー
#define syo(x) fixed << setprecision(x) //iostreamで小数をx桁表示
//sortを降順にする時は greater<型>()

void solve(long long K, std::string S){
  if(S.length() <= K){
    cout << S << endl;
  }else{
    for (int i = 0; i < K; i++) {
      cout << S[i];
    }
    cout << "..." << endl;
  }
}

int main(){
    long long K;
				scanf("%lld",&K);
				std::string S;
				std::cin >> S;
    solve(K, S);
    return 0;
}


Measured memory_bytes: 3648
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
   int A, B;
   cin >>A >>B;
   if(A < B)
   {
       if(A == 1)
       printf("Alice");
       
       else
       printf("Bob");
   }
   if(A > B)
   {
       if(B == 1)
       printf("Bob");
       else
       printf("Alice");
   }
   if(A == B)
   printf("Draw");
}



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

typedef long long ll;

int n, l[101], cnt;

int main()
{
    scanf("%d", &n);
    for(int i = 1; i <= n; i++)
        scanf("%d", l+i);

    for(int i = 1; i <= n; i++)
    {
        for(int j = i+1; j <= n; j++)
        {
            for(int k = j+1; k <= n; k++)
            {
                if(!(i==j && j==k))
                {
                    int a, b;
                    int c = max({l[i], l[j], l[k]});
                    if(c == l[i])
                    {
                        a = l[j]>=l[k] ? l[k] : l[j];
                        b = l[j]>=l[k] ? l[j] : l[k];
                    }

                    else if(c == l[j])
                    {
                        a = l[i]>=l[k] ? l[k] : l[i];
                        b = l[i]>=l[k] ? l[i] : l[k];
                    }

                    else if(c == l[k])
                    {
                        a = l[i]>=l[j] ? l[j] : l[i];
                        b = l[i]>=l[j] ? l[i] : l[j];
                    }

                    if(a+b>c && !(a==b || b==c)) cnt++;
                }
            }
        }
    }

    printf("%d", cnt);

    return 0;
}



Measured memory_bytes: 3836
#include <iostream>
#include <vector>
#include <string>
#include <unordered_map>
#include <math.h>
#include <algorithm>
#include <deque>
#include <climits>
using namespace std;
#define rep(i,l,r) for(int i=l;i<r;i++)
#define repb(i,r,l) for(int i=r;i>l;i--)
#define ll long long
#define ull unsigned long long
#define ve vector
#define umap unordered_map
#define iter iterator

const ll MOD = 1e9+7;

void solve() {
    ll n;cin>>n;
    ve<ll> dp(n+1);
    dp[0]=1; dp[1]=1;
    for(ll i=2;i<=n;i++) {
        dp[i] = (i*dp[i-1])%MOD;
    }
    cout<<dp[n]<<endl;

}

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

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

template<class Type>
Type TernarySearch(Type left,Type right,Type EPS,function<Type(Type)> f,bool isDownward){
  while(right - left > EPS){
    Type x1 = (left * 2 + right) / 3;
    Type x2 = (left + right * 2) / 3;
    if((!isDownward) != (f(x1) > f(x2))){
      left = x1;
    }
    else{
      right = x2;
    }
  }
  for(Type i = left;i <= right;i++){
    if((!isDownward) != (f(i) < f(left))){
      left = i;
    }
  }
  return left;
}


#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(int (i) = (s);(i) <= (e);(i)++)
#define all(x) x.begin(),x.end()

int main(){
  int N;
  cin >> N;
  vector<i64> A(N);
  rep(i,0,N - 1){
    cin >> A[i];
    A[i] -= i + 1;
  }
  auto f = [&](i64 k){
    i64 sum = 0;
    rep(i,0,N - 1) sum += abs(A[i] - k);
    return sum;
  };
  i64 INF = 1e9;
  cout << f(TernarySearch<i64>(-INF - 10,INF + 10LL,10,f,true)) << endl;
}


Measured memory_bytes: 1792
N, K = map(int, input().split())
A = list(map(int, input().split()))
A.sort()

p = 1000000007
X_max = 0
X_min = 0


def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n - r] % p


fact = [1, 1]  # fact[n] = (n! mod p)
factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1]  # factinv

for i in range(2, N + 1):
    fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)


for i in range(N-K+1):
    n = cmb(N-1-i, K-1, p)
    X_max += n*A[-(i+1)]
    X_max %= p
    X_min += n*A[i]
    X_min %= p

print(int((X_max - X_min) % p))


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

int N , t0 , tn , type[100000] ;
bool flag = false ; 
string s ;

void type_and_print(){
     if(flag) return ;
     
     for(int i=1;i<N;i++){
          if((type[i] == 1 && s[i] == 'o') || (type[i] == -1 && s[i] == 'x')){
               type[(i+1)%N] = type[i-1] ;
          }else{
               type[(i+1)%N] = -type[i-1] ;
          }
     }
     
     if(type[0] == t0 && type[N-1] == tn){
          
          flag = true ;
          
          for(int i=0;i<N;i++){
              if(type[i] == 1){
                   cout << 'S' ;
              }else{
                   cout << 'W' ;
              }
         }
        
     }
     
}

int main(void){
     
     cin >> N >> s ;
     
     if(s[0] == 'o'){
          type[0] = t0 = 1 ; type[1] = -1 ; tn = -1; 
          type_and_print() ;
          
          type[0] = t0 = 1 ; type[1] = 1 ; tn = 1 ; 
          type_and_print() ;
          
          type[0] = t0 = -1 ; type[1] = 1 ; tn = -1 ; 
          type_and_print() ;
          
          type[0] = t0 = -1 ; type[1] = -1 ; tn = 1 ; 
          type_and_print() ;
     }
     
    if(s[0] == 'x'){
          type[0] = t0 = -1 ; type[1] = 1 ; tn = 1 ;
          type_and_print() ;
          
          type[0] = t0 = 1 ; type[1] = -1 ; tn = 1 ; 
          type_and_print() ;
          
          type[0] = t0 = -1 ; type[1] = -1 ; tn = -1 ; 
          type_and_print() ;
          
          type[0] = t0 = 1 ; type[1] = 1 ; tn = -1 ; 
          type_and_print() ;
          
     }
     
     if(!flag) cout << -1 ;
}


Measured memory_bytes: 896
n,m=map(int,input().split())
ab=[list(map(int,input().split())) for i in range(m)]
ab.sort()
inf=float("inf")
t=inf
count=0
for i in range(m):
    a,b=ab[i]
    if a<t:
        t=min(t,b)
    else:
        count+=1
        t=b
count+=1
print(count)

Measured memory_bytes: 61828
#include <bits/stdc++.h>
using namespace std;
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define in(x,y,h,w) x >= 0 && x < h && y >= 0 && y < w

#define int long long
//typedef    long long          ll;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      P;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
 
const int INF=1e+18;
const double EPS=1e-9;
const int MOD=1000000007;
 
const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};

int par[100010];
int rnk[100010];

void init(int n){
	for(int i = 0;i < n;i++){
		par[i] = i;
		rnk[i] = 0;
	}
}

int find(int x){
	if(par[x] == x) return x;
	else return par[x] = find(par[x]);
}

void unite(int x,int y){
	x = find(x);
	y = find(y);
	if(x == y) return;
	if(rnk[x] < rnk[y]){
		par[x] = y;
	}else{
		par[y] = x;
		if(rnk[x] == rnk[y]) rnk[x]++;
	}
}

bool same(int x,int y){
	return find(x) == find(y);
}

signed main(){
	int n,m,a[100010],cnt = 0,ans = 0;
	vector<int> vec[100010],num;
	cin >> n >> m;
	init(n);
	for(int i = 0;i < n;i++) cin >> a[i];
	for(int i = 0;i < m;i++){
		int x,y;
		cin >> x >> y;
		unite(x,y);
	}
	for(int i = 0;i < n;i++) vec[find(i)].pb(a[i]);
	for(int i = 0;i < n;i++){
		if(vec[i].size()){
			cnt++;
			sort(all(vec[i]));
			ans += vec[i][0];
			for(int j = 1;j < vec[i].size();j++) num.pb(vec[i][j]);
		}
	}
	sort(all(num));
	for(int i = 0;i < cnt - 2;i++){
		if(i >= num.size()){
			cout << "Impossible" << endl;
			return 0;
		}
		ans += num[i];
	}
	if(cnt == 1) ans = 0;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 8064
n=int(input())
h=list(map(int,input().split()))
dp=[10**10]*n
dp[0]=0
for i in range(1,n):
    dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]))
print(dp[n-1])

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

class Program {
  static void Main() {
    int[] a = Console.ReadLine().Split().Select(int.Parse).OrderBy(x => x).ToArray();
    if (a[0] == 5 && a[1] == 5 && a[2] == 7) {
      Console.WriteLine("YES");
    } else {
      Console.WriteLine("NO");
    }
  }
}

Measured memory_bytes: 13396
def insertion_sort(lst):
    for i in range(1, len(lst)):
        v = lst[i]
        j = i - 1
        while j >= 0 and lst[j] > v:
            lst[j+1] = lst[j]
            j -= 1
        lst[j+1] = v
        print(*lst)

n = int(input())
lst = list(map(int, input().split()))
print(*lst)
insertion_sort(lst)


Measured memory_bytes: 5980
# include <bits/stdc++.h>
# define ll int64_t
# define rep(i,n) for(ll i=0;i<n;i++)
# define rrep(i,n) for(ll i=1;i<=n;i++)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define mod 1000000007

using namespace std;

bool compare_by_b(pair<string,ll> a,pair<string,ll> b){
    if(a.second != b.second) return a.second<b.second;
    else return a.first<b.first;
}

bool my_compare(pair<string,ll> a,pair<string,ll> b){
    
    if(a.first != b.first) return a.first<b.first;
    if(a.second != b.second) return a.second>b.second;
    else return true;
}

ll factorial(ll n){
    ll x=1;
    rrep(i,n) x *= i;
    return x;
}

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

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

int main(){
    ll n;
    cin>>n;
    vector<ll> a(n);
    rep(i,n) cin>>a[i];
    ll d=a[0];
    if(n==1){
        cout<<a[0]<<endl;
        return 0;
    }
    rrep(i,n-1){
        d=lcm(d,a[i]);
    }
    cout<<d<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF 1e18
#define MOD 1000000007
#define PI M_PI
#define ll long long
#define vi vector<int>
#define all(v) v.begin(), v.end()
#define FOR(i, a, b) for (int i=a; i<b; i++)
#define REP(i, n) for (int i=0; i<n; i++)
#define REPD(i, n) for (int i=n-1; i>=0; i--)
#define print(x) cout << x << endl;
#define debug(x) cout << #x << " = " << endl;

using namespace std;

void solve()
{
    int P, Q, R;
    cin >> P >> Q >> R;
    print(min({P+Q, Q+R, R+P}));
}

int main()
{
    solve();

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>


int main(void){

    int N;

    scanf("%d", &N);

    long int sum=0;

    for(int i=1;i<=N;i++){
        if(i%3==0&&i%5==0){
            
        }
        else if(i%3==0&&i%5!=0){

        }
        else if(i%3!=0&&i%5==0){

        }
        else{
            sum+=i;
        }
        
    }

    printf("%ld", sum);

    return 0;
}

Measured memory_bytes: 1724
#include <cstdio>
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <stack>
#include <functional>
#include <set>
#include <map>
#include <deque>
#include <cmath>
#define WMAX 10000
#define HMAX 10000
#define NMAX 102
#define MMAX 102

//コメントアウトするとdebug()を実行しない
#define DEBUG

using namespace std;
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

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

struct edge{
  int to,cost;
};

int A,C,N,M,W,H,ans = 0,dp[HMAX][WMAX];
vector<string> v;
int B[NMAX] = {};
static const int dx[8] = {0,1,1,1,0,-1,-1,-1},
					dy[8] = {1,1,0,-1,-1,-1,0,1};

void solve(){

}

void debug(){

}

void answer(){
	cout << ans << "\n";
}

int main(){
	cin >> N;
	for (int i = 0; i < N; ++i)
	{
		string S;
		cin >> S;
		bool t = false;
		for (int j = 0; j < v.size(); ++j)
		{
			if(v[j] == S){
				B[j]++;
				t = true;
				break;
			}
		}
		if(!t){
			B[v.size()]++;
			v.push_back(S);
		}
	}
	cin >> M;
	for (int i = 0; i < M; ++i)
	{
		string S;
		cin >> S;
		for (int j = 0; j < v.size(); ++j)
		{
			if(v[j] == S){
				B[j]--;
				break;
			}
		}
	}
	for (int i = 0; i < v.size(); ++i)
	{
		ans = max(ans,B[i]);
	}
	solve();
	#ifdef DEBUG
	debug();
	#endif
	answer();

	return 0;
}

Measured memory_bytes: 256
import Data.List
import qualified Data.ByteString.Char8 as B
import Data.Maybe (fromJust)

main :: IO ()
main = do
    [a, b, c, d] <- map (fst . fromJust . B.readInt) . B.words <$> B.getLine
    print $ max 0 (pred $ length $ [a..b] `intersect` [c..d])


Measured memory_bytes: 508
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int[] a = new int[3];

        for (int i = 0; i < 3; i++) {
            a[i] = sc.nextInt();
        }

        Arrays.sort(a);

        System.out.println(a[2] * 10 + a[1] + a[0]);
    }
}


Measured memory_bytes: 21844
import java.util.Scanner;
 
class Main{
  public static void main(String[] args){
    
    Scanner scan = new Scanner(System.in);
    int N = scan.nextInt();
    int K = scan.nextInt();
    int [] p = new int[N];
    for(int i = 0; i < N; i++){
      p[i] = scan.nextInt();
    }
    int k;
    for(int j = 0; j < N-1; j++){
      for(int l = j+1; l < N; l++){
        if(p[j] > p[l]){
          k = p[j];
          p[j] = p[l];
          p[l] = k;
        }
      }
    }
    
    int sum = 0;
    for(int m = 0; m < K; m++){
      sum += p[m];
    }
    
    System.out.println(sum);
    
    scan.close();
  }
}       

Measured memory_bytes: 38896
#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; 
typedef long long ll;
typedef unsigned long long int ull;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>  
#define ff first
#define ss second
#define pb push_back
#define Inf  1e18
#define inf -1e18
#define mod 1000000007
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using mll = map<ll,ll>;
using umll = unordered_map<ll,ll>;
using sll = set<ll>;
using msll = multiset<ll>;
 
 
ll MUL(ll A,ll B){
  return (A%mod*B%mod)%mod;
}
 
ll ADD(ll A,ll B){
  return (A%mod+B%mod)%mod;
}
 
ull power(ll A,ll B) { 
    ull RES = 1;      
    while (B > 0) 
    { 
        if (B & 1) 
            RES = RES*A;  
        B = B>>1;  
        A = A*A;  
    } 
  return RES; 
}

 
void testcases(int cases){
  
 char ch;
 cin >> ch;
  if(ch>='a'&&ch<='z')
    cout << 'a' << "\n";
  else{
    cout << 'A' << "\n";
  }
}
int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
    ll t;
    t = 1;
   // cin >> t;
    ll Case =1 ;
    while(t--)
    {
      testcases(Case++);
    }
}

Measured memory_bytes: 3648
#include<stdio.h>
#define V 100
int main(){
	int i,j,k;
	int n,m,l;
	int a[V][V],b[V][V];
	long int c[V][V];
	
	scanf("%d %d %d",&n,&m,&l);
	
	for(i=0;i<n;i++){
		for(j=0;j<m;j++){
			a[i][j]=0;
		}
	}
	for(i=0;i<m;i++){
		for(j=0;j<l;j++){
			b[i][j]=0;
		}
	}
	for(i=0;i<n;i++){
		for(j=0;j<l;j++){
			c[i][j]=0;
		}
	}
	
	for(i=0;i<n;i++){
		for(j=0;j<m;j++){
			scanf("%d",&a[i][j]);
		}
	}
	for(i=0;i<m;i++){
		for(j=0;j<l;j++){
			scanf("%d",&b[i][j]);
		}
	}
	
	for(i=0;i<n;i++){
		for(j=0;j<l;j++){
			for(k=0;k<m;k++){
				c[i][j] += a[i][k]*b[k][j];
			}
		}
	}
	for(i=0;i<n;i++){
		for(j=0;j<l;j++){
			if(j==0){
			printf("%li",c[i][j]);
			}else{
				printf("% li",c[i][j]);
			}
		}
		printf("\n");
	}

}
	

Measured memory_bytes: 1184
#include <bits/stdc++.h>
using namespace std;
// define
#define int long long
#define UNIQUE(v) v.erase(unique(all(v)), v.end());
#define ZIP(v) sort(all(v)),UNIQUE(v)
#define ADD(a, b) a = (a + b) % mod
#define SUB(a, b) a = (a+mod-b)%mod
#define MUL(a, b) a = (((a)%mod) * ((b)%mod)) % mod
#define rollcall cout << "I'm Sucu." << endl;
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define dmp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define fi first
#define se second
// typedef
typedef complex<double> Point;
typedef pair<int, int> P;
typedef pair<int, P> PP;
typedef pair<P, int> Pi;
typedef vector<int> vi;
typedef deque<int> dq;
const int inf = 1e9+7;
const int INF = 1e18+7;
const int mod = 1e9+7;
// int sum = accumulate(a, a+n, 0LL);
// int mx = max_element(a, a+n);
// int mn = min_element(a, a+n);
// int cnt = count(a, a+n, k);

int p,m,c;

signed main()
{
    cin >> p >> m >> c;

    cout << p+m+c << endl;

    return 0;
}


Measured memory_bytes: 3088
#include <bits/stdc++.h>
#define ALL(A) (A).begin(),(A).end()
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)

const ll mod = 1e9+7;
const ll INF = -1*((1LL<<63)+1);
const int inf = -1*((1<<31)+1);

using namespace std;

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll X,Y;
    cin >> X >> Y;
    if(abs(X-Y)>1)cout << "Alice" << endl;
    else cout << "Brown" << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
#define fst first
#define snd second
using ll = long long;
using I = pair<int, int>;
int dy[] = {0, 0, 1, -1};
int dx[] = {1, -1, 0, 0};

int main() {
  int H, W;
  while (cin >> H >> W) {
    vector<string> S(H);
    for (int i = 0; i < H; i++) cin >> S[i];
    bool pass = true;
    for (int y = 0; y < H; y++) {
      for (int x = 0; x < W; x++) {
        if (S[y][x] == '.') continue;
        bool found = false;
        for (int i = 0; i < 4; i++) {
          int ny = y + dy[i], nx = x + dx[i];
          if (ny < 0 || ny >= H || nx < 0 || nx >= W) continue;
          if (S[ny][nx] == '#') {
            found = true;
            break;
          }
        }
        pass &= found;
      }
    }
    cout << (pass ? "Yes" : "No") << endl;
  }
  return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main{
	public static void main(String[] args) {
		Scanner a = new Scanner(System.in);
		String p = a.nextLine();
		
		if (p.equals("ABC")) {
			System.out.println("ARC");
		}
		else {
			System.out.println("ABC");
		}
	}
}

Measured memory_bytes: 35656
#include <bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
#define emp emplace

using namespace std;
using ll = long long;
using ii = pair<int, int>;

const int N = 200010;
ll tree[4*N];

ll update(int start, int end, int upos, ll val, int pos)
{
	if (upos < start or upos > end)
		return tree[pos];
	
	if (start == end)
		return tree[pos] = val;
	
	int mid = (start+end)/2;
	ll l = update(start, mid, upos, val, 2*pos + 1);
	ll r = update(mid+1, end, upos, val, 2*pos + 2);
	return tree[pos] = max(l, r);
}

ll query(int start, int end, int qstart, int pos)
{
	if (qstart > end)
		return 0;
	
	if (start >= qstart)
		return tree[pos];
	
	int mid = (start+end)/2;
	ll l = query(start, mid, qstart, 2*pos + 1);
	ll r = query(mid+1, end, qstart, 2*pos + 2);
	return max(l, r);
}

int a[N], h[N];

int main()
{
	int n;
	scanf("%d", &n);
	for (int i = 0; i < n; i++)
		scanf("%d", h+i);
	for (int i = 0; i < n; i++)
		scanf("%d", a+i);
	ll ans = 0;
	for (int i = n-1; i >= 0; i--)
	{
		ll pd = a[i] + query(1, N-1, h[i], 0);
		update(1, N-1, h[i], pd, 0);
		ans = max(ans, pd);
	}
	printf("%lld\n", ans);
	return 0;
}



Measured memory_bytes: 6400
package main

import "fmt"

func abs_min(xs []int) int {
	ret := abs(xs[0])
	for _, x := range xs {
		if v := abs(x); v < ret {
			ret = v
		}
	}
	return ret
}

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

func main() {
	var n int
	fmt.Scan(&n)
	xs := make([]int, n)
	for i := range xs {
		fmt.Scan(&xs[i])
	}

	cnt_neg := 0
	for _, x := range xs {
		if x < 0 {
			cnt_neg++
		}
	}

	ans := 0
	for _, x := range xs {
		ans += abs(x)
	}

	if cnt_neg%2 == 1 {
		ans -= abs_min(xs) * 2
	}

	fmt.Println(ans)
}


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

typedef long long ll;
const int MAX_N = 1000, MAX_W = 2e4;

using namespace std;

const int W = 10000;

struct Block {
    int w;
    int s;
    int v;
};

Block blocks[1 + MAX_N];

bool operator < (Block a, Block b) {
    return a.w + a.s < b.w + b.s;
}

ll mxv[1 + MAX_W + 1];

int main () {
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++)
        cin >> blocks[i].w >> blocks[i].s >> blocks[i].v;
    sort (blocks + 1, blocks + n + 1);
    for (int i = 1; i <= n; i++)
        for (int j = W; j >= 0; j--)
            if (j <= blocks[i].s)
                mxv[j + blocks[i].w] = max (mxv[j + blocks[i].w],  mxv[j] + blocks[i].v);
    ll ans = 0;
    for (int i = 0; i <= W * 2; i++)
        ans = max (ans, mxv[i]);
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
int main(){
    FAST
    string s;
    cin>>s;
    auto pos1= s.find_first_of("A");
    auto pos2= s.find_last_of("Z");
    cout<<pos2-pos1+1;
    
    return 0;
}

Measured memory_bytes: 720
#include <bits/stdc++.h>
using namespace std;
typedef long long lint;
typedef pair<int, int> pi;
const int mod = 1e9 + 9;
const int MAXN = 200005;
int n, q;
int a[MAXN], cnt[MAXN];
int v[MAXN];
 
struct seg{
	int tree[530000], cnt[530000];
	void upd(int s, int e, int ps, int pe, int p, int v){
		if(e < ps || pe < s) return;
		if(s <= ps && pe <= e){
			tree[p] += v;
			if(tree[p] == 0){
				if(ps == pe) cnt[p] = 0;
				else cnt[p] = cnt[2*p] + cnt[2*p+1];
			}
			else cnt[p] = pe - ps + 1;
			return;
		}
		int pm = (ps + pe) / 2;
		upd(s, e, ps, pm, 2*p, v);
		upd(s, e, pm+1, pe, 2*p+1, v);
		if(!tree[p]) cnt[p] = cnt[2*p] + cnt[2*p+1];
	}
}seg;
 
void update(int s, int e, int x){
	s = max(s, 1);
	seg.upd(s, e, 1, n, 1, x);
}
 
int emptyspot(){
	return n - seg.cnt[1];
}
 
int main(){
	scanf("%d %d",&n,&q);
	for(int i=1; i<=n; i++){
		scanf("%d",&a[i]);
		cnt[a[i]]++;
	}
	for(int i=1; i<=n; i++){
		update(i - cnt[i] + 1, i, 1);
	}
	for(int i=1; i<=q; i++){
		int p, v;
		scanf("%d %d",&p,&v);
		update(a[p] - cnt[a[p]] + 1, a[p], -1);
		update(v - cnt[v] + 1, v, -1);
		cnt[a[p]]--;
		cnt[v]++;
		update(a[p] - cnt[a[p]] + 1, a[p], 1);
		update(v - cnt[v] + 1, v, 1);
		a[p] = v;
		printf("%d\n", emptyspot());
	}
}


Measured memory_bytes: 7936
/*{{{*/
#include<iostream>
#include<algorithm>
#include<string>
#include<sstream>

typedef long long ll;

#define REP(i,n) for(ll i=0;i<n;i++)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define FORR(i,a,b) for(ll i=b-1;i>=a;i--)

#define DEBUG(x) cout<<#x<<": "<<x<<endl

using namespace std;
/*}}}*/

int main() {
  string t;
  cin >> t;
  REP(i,t.length()){
    char c = t[i];
    if(c=='P') cout << 'P';
    else cout << 'D';
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 3752
#include<stdio.h>
#include<climits>
#include<algorithm>

using namespace std;
int main(){
    int n,x;
    int min_num = INT_MAX,max_num = INT_MIN;
    long long sum = 0;
    scanf("%d",&n);
    for(int i = 0;i < n;i++){
        scanf("%d",&x);
        min_num = min(min_num,x);
        max_num = max(max_num,x);
        sum += x;
    }
    printf("%d %d %lld\n",min_num,max_num,sum);
    return 0;
}



Measured memory_bytes: 2720