akhauriyash/Code-Regression huggingface dataset:
# kartikay26

from math import *
from collections import *
from itertools import *
from functools import *
from random import *
def getl(t=int): return [t(x) for x in input().split()]
def get(t=int): return t(input())
alphabet = [chr(x) for x in range(ord('a'), ord('z')+1)]
alnum = lambda x: ord(x) - ord('a')

def main():
	a = input()
	b = input()
	n = len(a)
	next_ = [next_arr(alphabet[i], a) for i in range(26)]
	ptr = -1
	ans = 0
	for ch in b:
		old_ptr = ptr
		ptr = next_[alnum(ch)][ptr]
		if ptr == -1:
			print(-1)
			exit()
		if ptr <= old_ptr:
			ans += n
	print(ans+ptr+1)

def next_arr(ch, a):
	n = len(a)
	i = a.find(ch)
	if i == -1:
		return [-1] * n
	ret = [-1] * n
	while ret[prev(i,n)] == -1:
		if a[i] == ch:
			ret[prev(i,n)] = i
		else:
			ret[prev(i,n)] = ret[i]
		i = prev(i,n)
	return ret


def next(i, n):
	return (i+1) % n
def prev(i, n):
	return (i-1+n) % n

if __name__ == "__main__":
	main()


Measured memory_bytes: 29736
#include <stdio.h>

int main(){
	int N;
	int K;
	scanf("%d",&N);
	scanf("%d",&K);
	double prob;
	prob=0;
	int i;
	for(i=1;i<=N;i++){
		int w;
		w=0;
		int j;
		j=i;
		double p;
		p=(double)1/N;
		while(w==0){
			if(j<K){
				j=2*j;
				p=p/2;
			}else{
				w=1;
			}
		}
		prob=prob+p;
	}
	printf("%.11f",prob);
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int a,b,c;
int main(){
	cin >> a >> b >> c;
	if(a>=c and c>=b)cout << "Yes";
	else if(c>=a and b>=c)cout << "Yes";
	else cout << "No";
    return 0;
}

Measured memory_bytes: 256
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
    return random.randint(ran1, ran2)
def rand_List(ran1, ran2, rantime):
    return [random.randint(ran1, ran2) for i in range(rantime)]
def rand_ints_nodup(ran1, ran2, rantime):
  ns = []
  while len(ns) < rantime:
    n = random.randint(ran1, ran2)
    if not n in ns:
      ns.append(n)
  return sorted(ns)

def rand_query(ran1, ran2, rantime):
  r_query = []
  while len(r_query) < rantime:
    n_q = rand_ints_nodup(ran1, ran2, 2)
    if not n_q in r_query:
      r_query.append(n_q)
  return sorted(r_query)

from collections import defaultdict, deque, Counter
from sys import exit
from decimal import *
import heapq
import math
from fractions import gcd
import random
import string
import copy
from itertools import combinations, permutations, product
from operator import mul
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7


#############
# Main Code #
#############

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def same(self, x, y):
        return self.find(x) == self.find(y)

N, M = getNM()
# 1 ~ 5の並び替え
# これを1, 2, 3, 4, 5にしたい
P = getList()
# Pのうちのペア
query = []
for i in range(M):
    a, b = getNM()
    query.append([a, b])

U = UnionFind(N)
for i in range(M):
    a, b = query[i]
    U.union(a - 1, b - 1)

cnt = 0
for i in range(N):
    if U.same(P[i] - 1, i):
        cnt += 1

print(cnt)

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

int n, a[300000];

int main(){
  cin >> n;
  rep(i, n){
    cin >> a[i];
  }
  //偶数で考える
  int right[200000], left[200000];
  rep(i, n){
    if(i % 2 == 0){
      right[i / 2] = a[i];
    }else{
      left[i / 2] = a[i];
    }
  }
  rep(i, n/2 + n%2) cerr << right[i] << " ";
  cerr << endl;
  rep(i, n/2) cerr << left[i] << " ";
  cerr << endl;
  if(n % 2 == 0){
    reverse(left, left + n / 2);
    rep(i, n / 2) cout << left[i] <<" ";
    rep(i, n / 2 - 1) cout << right[i] << " ";
    cout << right[n / 2 - 1] << endl;
  }else{
    reverse(right, right + n / 2 + 1);
    rep(i, n / 2 + 1) cout << right[i] << " ";
    rep(i, n / 2 - 1) cout << left[i] << " ";
    if(n == 1){
      cout << endl;
    }else{
      cout << left[n / 2 - 1] << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 3712
"use strict";
const input = require("fs").readFileSync("/dev/stdin", "utf8");

const inputs = input.split("\n");
const arr = inputs[1].split(" ").map(Number);

const main = arr => {
  let max = 0;
  for (let i = 0; i < arr.length; i++) {
    if (max < arr[i]) {
      max = arr[i];
    }
    if (max - arr[i] > 1) {
      return "No";
    }
  }
  return "Yes";
};

console.log(main(arr));

Measured memory_bytes: 17816
#include <iostream>
#include <vector>
#include <cstdio>
#include <memory>

const int MAXN = 200000 + 1;

std::vector<std::vector<int>> tree(MAXN);

// The tree has n nodes
// currently at node u, pre from pre to u
// dis(1, u) = dis
// return value: first = farthest_node, second = farthest_dis
std::pair<int,int> FindFarthestDistance(int n, int u, int pre, int dis) {
  auto res = std::make_pair(u, dis);
  for (const auto& v : tree[u]) {
    if (v == pre) continue;
      auto a = FindFarthestDistance(n, v, u, dis + 1);
      if (a.second > res.second) {
        res = a;
      }
  }
  return res;
} 

int CalcTreeDiameter(int n) {
  auto a = FindFarthestDistance(n, 1, 0, 0);
  // printf("v = %d dis = %d\n", v, dis);
  auto diameter = FindFarthestDistance(n, a.first, 0, 0);
  // printf("t = %d diameter = %d\n", t, diameter);
  return diameter.second;
}

bool Solve(int n) {
  int diameter = CalcTreeDiameter(n);
  return (diameter + 1) % 3 != 2;
}

int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1, u, v; i < n; ++i) {
    scanf("%d %d", &u, &v);
    tree[u].emplace_back(v);
    tree[v].emplace_back(u);
  }
  if (Solve(n)) printf("First\n");
  else printf("Second\n");
  return 0;  
}


Measured memory_bytes: 23680
#include<iostream>
#include<vector>
#include<string>
#include <queue>
#include<map>
#include<set>
#include <cstring>
using namespace std;
#define ll long long int


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

    ll maxi = a[0] , ans = 0 ;

    for(ll i = 1 ; i < n ; i++)
    {
        if(a[i] > maxi)
        {
            maxi = a[i] ;
        }
        else
        {
            ans += maxi - a[i] ;
        }
    }

    cout<<ans ;

}


Measured memory_bytes: 4832
<?php
// Your code here!
 fscanf(STDIN, "%d", $N);
     $S = strval($N);
    $arr = str_split($S);
        if ($arr[0] === $arr[1] || $arr[1] === $arr[2] || $arr[2] === $arr[3]){
        echo "Bad";
        exit;
}
        echo "Good";

?>


Measured memory_bytes: 3828
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <iostream>
#include <fstream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <sstream>
#include <iomanip>

using namespace std;

typedef long long ll;
typedef vector <int> vi;
typedef vector <vector <int>> vii;
typedef vector <long long> vll;
typedef vector <string> vs;
typedef vector <char> vc;
typedef set <int> si;
typedef set <string> ss;
typedef queue <int> qi;
typedef queue <long long> qll;
typedef queue <string> qs;
typedef queue <char> qc;
typedef struct board board;
typedef pair <int, int> pi;
typedef pair <long long, long long> pll;
typedef pair <int, pair<int, int>> pii;

#define eb emplace_back
#define ppb pop_back
#define clr(a) a.clear()
#define F first
#define S second
#define mkp make_pair

#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()

#define left(x) x * 2
#define right(x) x * 2 + 1

#define meme(a, b, c) fill(a + 1, a + 1 + b, c)

#define max(a, b) (a > b ? a : b)
#define min(a, b) (a > b ? b : a)
#define abs(a) (a > 0? a : -(a))

#define move(s) s += "#"

#define eprintf(...) fprintf(stderr, __VA_ARGS__);

template <typename T>
void printArr(const T * arr, int s, int fn) {
    for (int i = s; i <= fn; ++ i) cout << arr[i] << " ";
    cout << '\n';
}

template <typename T>
long long minArr(const T * arr, int s, int fn) {
    ll res = 1e16 + 1;
    for (int i = s; i <= fn; ++ i) {
        res = min(res, arr[i]);
    }
    return res;
}

template <typename T>
void printVec(const T * arr) {
    for (int i = 0; i < sz(arr); ++ i) cout << arr[i] << " ";
    cout << '\n';
}

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

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

void to_pray() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cerr << "Ready\n";
}

const int N = 4e6 + 10;
const int NN = 1e3 + 10;
const int NNN = 2e3 + 9;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 7;
const ll LLINF = 1e12 + 7;
const ll P = 53;
const int EPS = 1e-9 - 8;
const int vN = 2e4 + 10;
const int sz = (1 << 22) - 1;
const double PI = acos(-1);

int n, a[N], b[N], c[N], sum;

void solve() {
	int n;
	cin >> n;

	ll ans = 0;

	for (int i = 1; i < n; ++ i)
		cin >> b[i], ans += min(b[i - 1], b[i]);

	cout << ans + b[n - 1] + b[1];
}

main () {
    to_pray();
    
    do {
    	solve();
    } while(false);


    
    //eprintf("%.18lf seconds\n", (double)clock() / CLOCKS_PER_SEC);

    cerr << '\n';
    
    return 0;
}

Measured memory_bytes: 2304
void main() {
	auto ip = readAs!(int[]), A = ip[0], B = ip[1], K = ip[2];
	foreach(i; 0..K) {
		if(i % 2 == 0) {
			if(A & 1) A--;
			B += A / 2;
			A /= 2;
		} else {
			if(B & 1) B--;
			A += B / 2;
			B /= 2;
		}
	}
	writefln("%d %d", A, B);
}

// ===================================

import std.stdio;
import std.string;
import std.functional;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}

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

int tax(int a, int b) {
  return b*(100+a)/100;
}


int main() {
  int X,Y,S;
  while(cin >> X >> Y >> S && X>0){
    int maximum = 0;
    for(int i=1; i<S; ++i)
      for(int j=i; j<S; ++j)
	if(tax(X,i) + tax(X,j) == S)
	  maximum = max(maximum, tax(Y,i) + tax(Y,j));
    cout << maximum << endl;
  }

}

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

using namespace std;

#define int long long
#define MKP make_pair
#define fi first
#define se second
typedef pair<int, int> pii;

constexpr int MOD = 1e9 + 7;
constexpr int MAX_N = 205;
constexpr int MAX_W = 10005;
constexpr int INF = 1LL << 60;

int n, W, w[MAX_N], dp[MAX_N][MAX_W];

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

    cin >> n >> W;
    for (int i = 1; i <= n; ++i) {
        cin >> w[i];
    }

    sort(w + 1, w + n + 1);
    w[0] = INF;

    for (int i = 0; i <= n; ++i) {
        for (int j = 0; j <= W; ++j) {
            dp[i][j] = (j + w[i] <= W) ? 0 : 1;
        }
    }

    for (int i = n; 1 <= i; --i) {
        for (int j = 0; j <= n; ++j) {
            for (int k = 0; k <= W; ++k) {
                int tmp = min(W + 1, k + w[i]);
                if (j) {
                    dp[j][k] = (dp[j][tmp] + dp[j][k]) % MOD;
                } else {
                    dp[0][k] = (dp[0][tmp] + dp[i][k]) % MOD;
                }
            }
        }
    }

    cout << dp[0][0] << endl;
}



Measured memory_bytes: 18696
import java.util.*;
import static java.lang.Math.*;
import java.math.BigInteger;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int d = sc.nextInt();
		int g = sc.nextInt();
		int[][] pc = new int[d][2];
		for(int i = 0; i < d; i++){
		    pc[i][0] = sc.nextInt();
		    pc[i][1] = sc.nextInt();
		}
		
		// 計算
		int result = Integer.MAX_VALUE;
		for(int i = 0; i < 1<<d; i++){
		    int score = 0;
		    int cnt = 0;
		    int[] used = new int[d];
		    for(int j = 0; j < d; j++){
		        if((1 & i>>j) == 1){
		            score += (j+1)*100 * pc[j][0] + pc[j][1];
		            cnt += pc[j][0];
		            used[j] = 1;
		        }
		    }
		    for(int j = d-1; j >= 0; j--){
		        if(score >= g) break;
		        if(used[j] == 0){
		            for(int k = 0; k < pc[j][0] - 1; k++){
		                if(score >= g) break;
		                score += (j+1)*100;
		                cnt++;
		            }
		            break;
		        }
		    }
		    if(score >= g) result = min(result, cnt);
		}
		
		// 出力
		System.out.println(result);
	}
}


Measured memory_bytes: 21844
// #pragma GCC optimize("unroll-loops", "omit-frame-pointer", "inline")
// #pragma GCC option("arch=native", "tune=native", "no-zero-upper")
// #pragma GCC
// target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
// #pragma GCC optimize("Ofast")
// #pragma GCC optimize("tree-vectorize","openmp","predictive-commoning")
// #pragma GCC option("D_GLIBCXX_PARALLEL","openmp")

#pragma GCC optimize("O3")
#pragma GCC target("avx2")

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<ll> vll;
// #define int long long
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000               // 2e9
#define LLINF 2000000000000000000ll  // 2e18 (llmax:9e18)
#define fi first
#define sec second
#define all(x) (x).begin(), (x).end()
#define sq(x) ((x) * (x))
#define dmp(x) cerr << #x << ": " << x << endl;

template <class T>
void chmin(T &a, const T &b) {
  if (a > b) a = b;
}
template <class T>
void chmax(T &a, const T &b) {
  if (a < b) a = b;
}

template <class T>
using MaxHeap = priority_queue<T>;
template <class T>
using MinHeap = priority_queue<T, vector<T>, greater<T>>;
template <class T>
vector<T> vect(int len, T elem) {
  return vector<T>(len, elem);
}

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << p.fi << ',' << p.sec;
  return os;
}
template <class T, class U>
istream &operator>>(istream &is, pair<T, U> &p) {
  is >> p.fi >> p.sec;
  return is;
}
template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  for (int i = 0; i < vec.size(); i++) {
    os << vec[i];
    if (i + 1 < vec.size()) os << ' ';
  }
  return os;
}
template <class T>
istream &operator>>(istream &is, vector<T> &vec) {
  for (int i = 0; i < vec.size(); i++) is >> vec[i];
  return is;
}
void fastio() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  cout << fixed << setprecision(20);
}

#define endl "\n"

void solve() {
  int N, M;
  cin >> N >> M;
  int n = N;
  vector<vector<int>> g(N);
  for (int i = 0; i < M; i++) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  vector<int> dist(n, INF);
  queue<int> q;
  dist[0] = 0;
  q.push(0);
  while (!q.empty()) {
    int a = q.front();
    q.pop();
    for (int u : g[a]) {
      if (dist[u] != INF) continue;
      dist[u] = dist[a] + 1;
      q.push(u);
    }
  }
  vector<int> ans(n, -1);
  for (int i = 1; i < n; i++) {
    for (int j : g[i]) {
      if (dist[j] == dist[i] - 1) { ans[i] = j; }
    }
  }
  cout << "Yes" << endl;
  for (int i = 1; i < n; i++) { cout << ans[i] + 1 << endl; }
  return;
}

signed main() {
  fastio();
  solve();
  // int t; cin >> t; while(t--)solve();

  // int t; cin >> t;
  // for(int i=1;i<=t;i++){
  //   cout << "Case #" << i << ": ";
  //   solve();
  // }
  return 0;
}


Measured memory_bytes: 10540
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		int c,code;

		Scanner sc = new Scanner(System.in);

		c=sc.nextInt();

		if(c>=65 && c<=90)
			code=1;
		else if(c>=97 && c<=122)
			code=2;
		else
			code=0;
		System.out.println(code);

	}
}



Measured memory_bytes: 26360
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sys/time.h>
#include <cmath>

using namespace std;

void solve(string s) {
    vector<int> m(26, -1);
    vector<int> l(26, -1);
    string sv = s;
    reverse(sv.begin(), sv.end());
    int c = 0;
    while (!s.empty()) {
        if (m[s.back()-'a'] < c - l[s.back()-'a'] - 1) {
            m[s.back()-'a'] = c - l[s.back()-'a'] - 1;
        }
        l[s.back()-'a'] = c;
        c++;
        s.pop_back();
    }
    vector<int> lv(26, -1);
    c = 0;
    while (!sv.empty()) {
        if (m[sv.back()-'a'] < c - lv[sv.back()-'a'] - 1) {
            m[sv.back()-'a'] = c - lv[sv.back()-'a'] - 1;
        }
        lv[sv.back()-'a'] = c;
        c++;
        sv.pop_back();
    }
    sort(m.begin(), m.end(), greater<int>());
    while (m.back() == -1) {
        m.pop_back();
    }
    std::cout << m.back() << std::endl;
}

int main() {
    struct timeval start,end;
    long long span;
    string s;

    gettimeofday(&start,NULL);

    std::cin >> s;
    solve(s);

    gettimeofday(&end,NULL);
    span = (end.tv_sec -start.tv_sec)*1000000LL + (end.tv_usec - start.tv_usec);
    std::cerr << "--Total Time: " << span/1000 << "ms" << endl;
    return 0;
}


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

using namespace std;

int main(){
  int N, M;
  cin >> N >> M;
  
  vector<pair<long long int, int>> AB(N);
  
  for(int i = 0; i < N; i++){
    long long int A;
    int B;
    cin >> A >> B;
    AB[i] = make_pair(A,B);
  }
  sort(AB.begin(), AB.end());
  long long int budget = 0LL;
  
  for(int i = 0; i < N; i++){
    if(M >= AB[i].second){
      budget += AB[i].first * AB[i].second;
      M -= AB[i].second;
    }else{
      budget += AB[i].first * M;
      break;
    }
  }
  cout << budget;
 }


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

using namespace std;

typedef long long ll;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	ll N, M;
	cin >> N >> M;
	if (N > M) swap(N,M);
	if (N == 1){
		if (M == 1) cout << 1 << '\n';
		else cout << M - 2 << '\n';
	}
	else if (N == 2){
		cout << 0 << '\n';
	}
	else{
		cout << (N-2)*(M-2) << '\n';
	}
}

Measured memory_bytes: 256
line = input()
X, Y = [int(n) for n in line.split()]

broken_steps = set()
for _ in range(Y):
    line = input()
    broken_steps.add(int(line))

if 1 not in broken_steps:
    if 2 not in broken_steps:
        stairs = [1, 2]
    else:
        stairs = [1, 0]
elif 2 not in broken_steps:
    stairs = [0, 1]
else:
    stairs = [0, 0]

for i in range(2, X):
    number_of_steps = 0
    if i+1 not in broken_steps:
        number_of_steps = stairs[i - 1] + stairs[i-2]
    stairs.append(number_of_steps)
predicted_value = stairs[X-1]
print(predicted_value % 1000000007)

Measured memory_bytes: 460020
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <cmath>
#include <deque>
#include <iterator>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
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)
template<class T> inline bool chmax(T& a, T b) {if (a<b) {a=b; return true;} return false;}
template<class T> inline bool chmin(T& a, T b) {if (a>b) {a=b; return true;} return false;}

const ll MOD = 1000000007;
const ll HIGHINF = (ll)1e18;

int main() {
  string s; cin >> s;
  if (s.size()%2==1) {
    if (s[0] == s[s.size()-1]) cout << "Second" << endl;
    else cout << "First" << endl;
  } else {
    if (s[0] == s[s.size()-1]) cout << "First" << endl;
    else cout << "Second" << endl;
  }
  return 0;
}


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

int main() {
    string s;
    int n, x;

    cin >> s;
    while (s != "-") {
        cin >> n;
        for (int i=0; i<n; i++) {
            cin >> x;
            s = s.substr(x) + s.substr(0, x);
        }
        cout << s << endl;

        cin >> s;
    }
}


Measured memory_bytes: 3196
#include <bits/stdc++.h>
#define div1 1000000007
const long long INF = 1LL << 60;
using namespace std;
typedef long long ll;
typedef long double ld;
// a>b -> a==b;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
// a<b -> a==b;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

int main(void)
{
    set<string> se;

    ll N, i;
    string S[200001];

    cin >> N;

    for(i=1; i<=N; i++){
        cin >> S[i];
        se.insert(S[i]);
    }

    cout << se.size() << endl;

    return 0;
}

Measured memory_bytes: 25480
#pragma comment(linker, "/STACK: 1024000000,1024000000")
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define em emplace
#define pii pair<int,int>
#define de(x) cout << #x << " = " << x << endl
#define dd(x) cout << #x << " = " << x << " " << endl
#define clr(a,b) memset(a,b,sizeof(a))
#define INF (0x3f3f3f3f)
#define LINF ((long long)(0x3f3f3f3f3f3f3f3f))
#define F first
#define S second
using namespace std;

const int N = 50;
int a[N], c[N];

int main() {
	int n;
	scanf("%d", &n);
	for ( int i = 1; i <= n; i ++ )
		scanf("%d", &a[i]);
	memcpy( c, a, sizeof(a) );
	sort( c+1, c+1+n );
	bool flg = 1;
	for ( int k = 1; k <= n; k ++ )
		if ( c[k] != a[k] ) flg = 0;
	if ( flg ) {
		puts("YES");
		return 0;
	}
	for ( int i = 1; i <= n; i ++ )
		for ( int j = i+1; j <= n; j ++ ) {
			swap( a[i], a[j] );
			flg = 1;
			for ( int k = 1; k <= n; k ++ )
				if ( c[k] != a[k] ) flg = 0;
			if ( flg ) {
				puts("YES");
				return 0;
			}
			swap(a[i],a[j]);
		}
	puts("NO");
	return 0;
}

Measured memory_bytes: 256
input1 = gets.chomp.to_i
x = []
if input1 == 2
  for i in 1..2
    i = gets.chomp.to_i
    x.push(i)
  end
end

if input1 == 1
  puts 'Hello World'
else
  puts x[0].to_i + x[1].to_i
end


Measured memory_bytes: 1788
N = int(input())
A = list(map(int, input().split()))
list_cnt = [0] * N

ans = 0
for a in A:
    if a > N:
        ans += 1
    else:
        list_cnt[a-1] += 1

for i in range(N):
    if list_cnt[i] >= i + 1:
        ans += (list_cnt[i] - i - 1)
    else:
        ans += list_cnt[i]

print(ans)

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

int main(){
    int a,b;
    while(cin >> a >> b){
        int c = a + b;
        int cnt=1;
        while(c/10!=0){
            ++cnt;
            c/=10;
        }
        cout << cnt << endl;
    }
}


Measured memory_bytes: 3116
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

def solve():
	N, Q = MAP()
	ab = [LIST() for _ in range(N-1)]
	tree = defaultdict(list)
	par = [-1]*N
	par[0] = 0
	for a, b in ab:
		tree[a-1].append(b-1)
		tree[b-1].append(a-1)
		par[b-1] = a-1

	px = [LIST() for _ in range(Q)]

	ans = [0] * N  # 答え入れる

	for p, x in px:
		ans[p-1] += x

	
	for i in range(1, N):
		ans[i] += ans[par[i]]

	print(*ans, sep=" ")

if  __name__ == "__main__":
	solve()


Measured memory_bytes: 168316
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = int(input())
As = list(mapint())

from collections import Counter
c = Counter(As)

area = 0
for n, c in sorted(c.most_common())[::-1]:
    if c<2:
        pass
    elif c>=4:
        area = max(area*n, n**2)
        break
    else:
        if area:
            area = area*n
            break
        else:
            area = n

print(area)

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

//{{{
#if ((_WIN32 || __WIN32__) && __cplusplus < 201103L)
#define lld I64d
#else
#define lld lld
#endif
using namespace std;
typedef long long LL;
typedef vector<int> vi;
typedef pair<int, int> pii;
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define clr(a, b) memset(a, b, sizeof(a))
#ifdef LOCAL
#include "prettyprint.hpp"
#endif
// clang-format off
void _print() { cerr << "]\033[0m\n"; }
template <typename T> void __print(T x) { cerr << x; }
template <typename T, typename... V> void _print(T t, V... v) { __print(t); if (sizeof...(v)) cerr << ", "; _print(v...); }
#ifdef LOCAL
#define debug(x...) cerr << "\033[1;34m[" << #x << "] = \033[1;32m["; _print(x)
#define debug_arr(x...) cerr << "\033[1;34m[" << #x << "] = \033[1;32m" << (x) << "\033[0m\n"
#else
#define debug(x...)
#define debug_arr(x...)
#endif
// clang-format on
//}}}

int T;

const int mod = 1e9 + 7;
const int N = 1e4 + 10;
const int K = 110;
LL p[22];
LL n, d;

int k;

int main()
{
#ifdef LOCAL
    freopen("in", "r", stdin);
    // freopen("out", "w", stdout);
#endif

    // p[0] = 7ll;
    // for (int i = 1; i <= 17; i++) p[i] = p[i - 1] * 10 + 7;

    // for (int i = 1; i <= 1111; i++)
    //{
    // bool find = false;
    // LL v = -1;
    // for (int j = 0; j <= 17; j++)
    //{
    // if (p[j] % i == 0)
    //{
    // find = true;
    // v = p[j];
    // break;
    //}
    //}
    // if (find)
    //{
    // debug(i, find, v);
    //}
    //}

    while (cin >> k)
    {
        if (k % 2 == 0)
        {
            puts("-1");
            continue;
        }

        LL cur = 1;
        bool find = false;
        for (int i = 1; i <= 2 * k; i++)
        {
            LL val = cur * 7 % k;

            if (val == 0)
            {
                cout << i << endl;
                find = true;
                break;
            }
            cur = (cur * 10 + 1) % k;
        }
        if (find == false) puts("-1");
    }
    return 0;
}


Measured memory_bytes: 3580
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] sa = br.readLine().split(" ");
		int h = Integer.parseInt(sa[0]);
		int w = Integer.parseInt(sa[1]);
		int m = Integer.parseInt(sa[2]);

		int[] x = new int[h];
		int[] y = new int[w];
		List<Set<Integer>> list = new ArrayList<>();
		for (int i = 0; i < h; i++) {
			list.add(new HashSet<>());
		}
		for (int i = 0; i < m; i++) {
			sa = br.readLine().split(" ");
			int a = Integer.parseInt(sa[0]) - 1;
			int b = Integer.parseInt(sa[1]) - 1;
			x[a]++;
			y[b]++;
			list.get(a).add(b);
		}
		br.close();

		int xx = 0;
		for (int i = 0; i < x.length; i++) {
			xx = Math.max(xx, x[i]);
		}
		Set<Integer> sx = new HashSet<>();
		for (int i = 0; i < x.length; i++) {
			if (x[i] == xx) {
				sx.add(i);
			}
		}

		int yy = 0;
		for (int i = 0; i < y.length; i++) {
			yy = Math.max(yy, y[i]);
		}
		Set<Integer> sy = new HashSet<>();
		for (int i = 0; i < y.length; i++) {
			if (y[i] == yy) {
				sy.add(i);
			}
		}

		for (int i : sx) {
			for (int j : sy) {
				if (!list.get(i).contains(j)) {
					System.out.println(xx + yy);
					return;
				}
			}
		}
		System.out.println(xx + yy - 1);
	}
}


Measured memory_bytes: 143464
#pragma region _head

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<map>
#include<set>
#include<iomanip>
#include<queue>
#include<stack>
#include<numeric>
#include<utility>
#include<regex>

#pragma region _define

#define f(i,a,b) for(int i=a;i<b;i++)
#define f_vI(v,n) f(i,0,n)cin>>v[i]
#define f_v2I(v1,v2,n) f(i,0,n)cin>>v1[i]>>v2[i]
#define f_v3I(v1,v2,v3,n) f(i,0,n)cin>>v1[i]>>v2[i]>>v3[i]
#define f_vO(v,n) f(i,0,n)cout<<v[i]<<endl
#define all(a) a.begin(),a.end()
#define size(s) s.size()
#define check() cout<<"! ! !"
#define endl "\n"
#define _y() cout<<"Yes"<<endl
#define _Y() cout<<"YES"<<endl
#define _n() cout<<"No"<<endl
#define _N() cout<<"NO"<<endl

#pragma endregion

#pragma region _using

using namespace std;

using LL = long long;
using st = string;
using vi = vector<LL>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vc = vector<char>;
using vs = vector<st>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvvb = vector<vvb>;
using si = stack<LL>;
using ss = stack<st>;
using pi = pair<LL, LL>;
using v_pi = vector<pi>;

#pragma endregion

#pragma region _graph

#define node 50  //グラフの最大位数　適宜変更
//bool graph[node][node]; bool visited[node] = { false };
#define link(a,b,m) f(i,0,m){cin>>a[i]>>b[i]; a[i]--; b[i]--; graph[a[i]][b[i]]=graph[b[i]][a[i]]=true;}

#pragma endregion

LL gcd(LL a, LL b) {
	LL r;
	while ((r = a % b) != 0) {
		a = b;
		b = r;
	}
	return b;
}
LL lcm(LL a, LL b) {
	return (a / gcd(a, b) * b);
}

#pragma endregion 

/*****************************************************************************/

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

	int n;
	cin >> n;
	vi l(n);
	f_vI(l, n);
	sort(all(l), greater<LL>());
	int sum = 0;
	f(i, 1, n)sum += l[i];
	if (l[0] < sum) {
		_y();
	}
	else {
		_n();
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 1000000000

int main(){
	
	int N;
	cin>>N;
	
	vector<int> cnt(10001,0);
	
	for(int i=1;i<=100;i++){
		for(int j=1;j<=100;j++){
			for(int k=1;k<=100;k++){
				int t = i*i + j*j + k*k + i*j + j*k + k*i;
				if(t<=10000)cnt[t]++;
			}
		}
	}
	
	for(int i=1;i<=N;i++)cout<<cnt[i]<<endl;
	
	return 0;
}


Measured memory_bytes: 3560
#pragma warning(disable:4996)

#include "bits/stdc++.h"
using namespace std;

typedef long long ll;
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define pb push_back
#define mp make_pair
#define fill(x,y) memset(x,y,sizeof(x))

const ll INF = (1ll << 60);
const int INF_CONST = (int)1e9;
const ll MOD_CONST = (ll)(1e9 + 7);

int main(void)
{
	cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(20);

	string s; cin >> s;
	set<char> ex;
	int iy, iz;
	REP(i, s.size()) {
		if (s[i] == 'y') iy = i;
		if (s[i] == 'z') iz = i;
		ex.insert(s[i]);
	}

	string maxA = "zyxwvutsrqponmlkjihgfedcba";
	if (ex.size() == 26) {
		if (s == maxA)
			cout << "-1" << endl;
		else {
			int cidx = 0;
			int okay = -1;
			while (cidx < 25) {
				if (s[cidx] < s[cidx + 1]) {
					okay = cidx;
				}
				cidx++;
			}
			if (okay == 0) {
				cout << (char)(s[0] + (char)1) << endl;
				return 0;
			}
				FOR(i, 0, okay) {
					cout << s[i];
					ex.erase(s[i]);
				}
				ex.erase(s[okay]);
				for (auto ch : ex) {
					if (ch > s[okay]) {
						cout << ch << endl;
						return 0;
					}

				}
			
		}
	}
	else {
		cout << s;
		char c = 'a';
		REP(i, 26) {
			char cx = c + (char)i;
			if (ex.find(cx) == ex.end()) {
				cout << cx << endl;
				return 0;
			}
		}
	}

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,b[100010],s;
int main()
{
	cin>>n;
	for(int i=1;i<n;i++)
	{
		cin>>b[i];
	}
	s+=b[1]+b[n-1];
	for(int i=1;i<n;i++)
	{
		s+=min(b[i],b[i+1]);
	}
	cout<<s;
	return 0;
}

Measured memory_bytes: 256
N, T = map(x -> parse(Int64,x), split(readline(STDIN)))
data = [map(x -> parse(Int64,x), split(readline(STDIN))) for _ in 1:N]
answer = "TLE"
for (c, t) in data
    if t <= T
        if answer == "TLE"
            answer = c
        else
            if answer > c
                answer = c
            end
        end
    end
end
print(answer)

Measured memory_bytes: 121472
#!/usr/bin/python

import sys

def main(argv):
    line = sys.stdin.readline()
    while line:
        N = int(line)
        sheet = set()
        for i in xrange(N):
            a = sys.stdin.readline()
            if a in sheet:
                sheet.remove(a)
            else:
                sheet.add(a)
        print(len(sheet))
        line = sys.stdin.readline()
        

if __name__ == "__main__":
    main(sys.argv)

Measured memory_bytes: 12924
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(obj) (obj).begin(),(obj).end()
typedef long long ll;
ll mod=2e12;
ll cnt=0;
#define max 100005
#define nil -1
int white=0;
int gray=1;
int black=2;
int n,t=0;
int color[101],d[101],f[101],m[101][101];

void DFS(int i){
  color[i]=gray;
  d[i]=++t;
  for(int j=0;j<=n;j++){
    if(m[i][j]==1&&color[j]==white)DFS(j);
  }
  color[i]=black;
  f[i]=++t;
}

int main(){
  int q,w,e;
  cin>>n;
  for(int i=1;i<=n;i++){
    cin>>q>>w;
    for(int j=1;j<=n;j++)m[i][j]=0;
    for(int j=1;j<=w;j++){
      cin>>e;
      m[i][e]=1;
    }
  }

  rep(i,100)color[i]=white;

  for(int i=1;i<=n;i++){
    if(color[i]==white)DFS(i);
  }
  for(int i=1;i<=n;i++){
    cout<<i<<" "<<d[i]<<" "<<f[i]<<endl;
  }

   return 0;
}



Measured memory_bytes: 3104
# N: 処理する区間の長さ
N, Q = map(int, input().split())
N0 = 1<<(N.bit_length())
INF = (1<<31)-1
data = [INF]*(2*N0)
# a_k の値を x に更新
def update(k, x):
  k += N0-1
  data[k] = x
  while k >= 0:
    k = (k - 1) // 2
    data[k] = min(data[2*k+1], data[2*k+2])
# 区間[l, r)の最小値
def query(l, r):
  L = l + N0-1; R = r + N0-1
  s = INF
  while L < R:
    if R%2==0:
      R -= 1
      s = min(s, data[R])
    if L%2==0:
      s = min(s, data[L])
      L += 1
    L //= 2; R //= 2
  return s

ans = []
for i in range(Q):
  com,x,y = map(int, input().split())
  if com==0:
    update(x,y)
  else:
    ans.append(query(x,y+1))
print(*ans, sep='\n')


Measured memory_bytes: 10868
#include <iostream>
#include <algorithm>
#include <vector>
#include <tuple>
#include <queue>
#include <cassert>

template <class Cost = int>
struct Edge {
    int src, dst;
    Cost cost;
    Edge(int src = -1, int dst = -1, Cost cost = 1)
        : src(src), dst(dst), cost(cost){};

    bool operator<(const Edge<Cost>& e) const { return this->cost < e.cost; }
    bool operator>(const Edge<Cost>& e) const { return this->cost > e.cost; }
};

template <class Cost = int>
using Edges = std::vector<Edge<Cost>>;

constexpr int INF = 1 << 30;

void solve() {
    int n, m;
    std::cin >> n >> m;

    std::vector<int> ds(n);
    std::vector<std::pair<int, int>> sds(n);
    for (int i = 0; i < n; ++i) {
        auto& d = ds[i];
        std::cin >> d;
        sds[i] = std::make_pair(d, i);
    }
    std::sort(sds.begin(), sds.end());

    Edges<int> es(m);
    std::vector<std::vector<int>> graph(n);
    for (int i = 0; i < m; ++i) {
        auto& e = es[i];
        std::cin >> e.src >> e.dst;
        --e.src, --e.dst;
        e.cost = 1e9;
        graph[e.src].push_back(i);
        graph[e.dst].push_back(i);
    }

    std::vector<std::vector<int>> forest(n);
    for (auto p : sds) {
        int v = p.second;

        int eid = -1, dmin = INF;
        for (int i : graph[v]) {
            const auto& e = es[i];
            int u = e.src;
            if (u == v) u = e.dst;

            if (e.cost == ds[v]) {
                eid = i;
                dmin = e.cost;
                break;
            }

            if (ds[u] < dmin) {
                eid = i;
                dmin = ds[u];
            }
        }

        if (ds[v] < dmin) {
            std::cout << -1 << std::endl;
            return;
        }

        auto& e = es[eid];
        int u = e.src;
        if (u == v) u = e.dst;

        e.cost = ds[v];
        forest[v].push_back(u);
        forest[u].push_back(v);
    }

    std::vector<int> cs(n, -1);
    for (int r = 0; r < n; ++r) {
        if (cs[r] >= 0) continue;

        std::queue<int> que;
        que.push(r);
        cs[r] = 0;
        while (!que.empty()) {
            int v = que.front();
            que.pop();

            for (int u : forest[v]) {
                if (cs[u] >= 0) continue;
                cs[u] = 1 - cs[v];
                que.push(u);
            }
        }
    }

    for (int v = 0; v < n; ++v) {
        int min = INF;
        for (int i : graph[v]) {
            const auto& e = es[i];
            int u = e.src;
            if (u == v) u = e.dst;
            if (cs[u] != cs[v]) min = std::min(min, e.cost);
        }
        assert(min == ds[v]);
    }

    for (auto c : cs) std::cout << "BW"[c];
    std::cout << std::endl;

    for (const auto& e : es) std::cout << e.cost << std::endl;
}

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

    solve();

    return 0;
}


Measured memory_bytes: 18048
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        
        int n = sc.nextInt();
        int b = sc.nextInt();
        
        if(b*2 >= n){
            System.out.println(0);
        } else {
            System.out.println(n - 2*b);
        }
    }
}

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

int main() {
  string n;
  cin >> n;
  for(int i=0;i<3;i++){
    if(n.at(i)=='1'){
      n.at(i)='9';
    }else{
      n.at(i)='1';
    }
  }
  cout << n << endl;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.*;
import java.util.*;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Collections;
import java.util.Arrays;

public class Main {
	public static void main(final String[] args){
    
    final Scanner sc = new Scanner(System.in);
    final List<Integer> list = new ArrayList<>();
    //final List<Integer> list2 = new ArrayList<>();
    //final List<Long> list3 = new ArrayList<>();

    int a = sc.nextInt();
    int b = sc.nextInt();

    if(a < 9 && b < 9){
        System.out.println("Yay!");
    }else{
        System.out.println(":(");
    }

    

    




    







}
}

Measured memory_bytes: 35860
import copy
s = int(input())
l =[s]
lold = copy.deepcopy(l)

for i in range(1000000):

    if l[-1]%2 == 0:
        l.append(l[-1]//2)
    else:
        l.append(3*l[-1] + 1)
    if l[-1] in lold:
        print(len(l))
        exit()
    lold = copy.deepcopy(l)


Measured memory_bytes: 3444
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;

int main(){
	int n;
	double total;
	double average;
	int dataset[1000];
	double result;

	cout << fixed << setprecision(8);
	while(1){
		cin >> n;
		if( n == 0 ) break;
		total = 0;
		for(int i = 0; i < n; i ++){
			cin >> dataset[i];
			total += dataset[i];
		}
		average = (double)(total / (double)n);
		
		result = 0;
		for(int i = 0; i < n; i ++){
			result += pow((dataset[i] - average),2);
		}
		result /= n;
		result = sqrt(result);
		cout << result << endl;
	}
	return 0;
}


Measured memory_bytes: 3280
def f(m,b):
  s=0
  for k in N[j:]:
    s+=A[k]
    b[k]=max(b[k],0)+s
    m=max(b[k],m)
  return m,b

m=-1e9
n=int(raw_input())
N=range(n)
B=[[0]*(n+1) for _ in range(n+1)]
for _ in N:
  A=map(int,raw_input().split())
  for j in N: m,B[j]=f(m,B[j])
print m

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

int main()
{
  long long n, k, i = 0,ans = 0;
  cin >> n >> k;
  vector<int> h(n);
  while(cin >> h[i])
    i++;
  
  for(int i=0; i<n; i++)
  {
    if(h[i]>=k)
      ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3608
N,M = map(int,input().split())
K = [[0, 0] for i in range(M)]
for i in range(M) :
    a,b = map(int,input().split())
    cx = tuple(map(int,input().split()))
    s = 0
    for c in cx :
        s = s | (1 << (c-1))
    K[i] = [s, a]

INF = 10**12
dp = [INF]*(1 << N)
dp[0] = 0

for bit in range(1 << N) :
    for i in range(M) :
        s,a = K[i]
        t = bit | s
        cost = dp[bit] + a
        dp[t] = min(dp[t], cost)

ans = dp[-1] if dp[-1] != INF else -1

print(ans)


Measured memory_bytes: 45416
#[allow(dead_code)]
fn main() {
    let n = i::i();
    let mut g = Vec::new();

    for i in 1..n + 1 {
        for j in (i + 1)..n + 1 {
            let t = if n % 2 == 0 { n + 1 } else { n };
            if i + j == t {
                continue;
            }
            g.push((i, j));
        }
    }

    println!("{}", g.len());
    for (a, b) in g {
        println!("{} {}", a, b);
    }
}

#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::{HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::io::*;
#[allow(unused_imports)]
use std::num::*;
#[allow(unused_imports)]
use std::str::*;

#[allow(dead_code)]
mod i {
    use super::*;

    pub fn read<T: FromStr>() -> T {
        stdin()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>()
            .parse::<T>()
            .ok()
            .unwrap()
    }

    pub fn str() -> String {
        read()
    }

    pub fn s() -> Vec<char> {
        str().chars().collect()
    }

    pub fn i() -> i64 {
        read()
    }

    pub fn u() -> usize {
        read()
    }

    pub fn u2() -> (usize, usize) {
        (read(), read())
    }

    pub fn u3() -> (usize, usize, usize) {
        (read(), read(), read())
    }

    pub fn f() -> f64 {
        read()
    }

    pub fn c() -> char {
        read::<String>().pop().unwrap()
    }

    pub fn iv(n: usize) -> Vec<i64> {
        (0..n).map(|_| i()).collect()
    }

    pub fn iv2(n: usize) -> Vec<(i64, i64)> {
        (0..n).map(|_| iv(2)).map(|a| (a[0], a[1])).collect()
    }

    pub fn uv(n: usize) -> Vec<usize> {
        (0..n).map(|_| u()).collect()
    }

    pub fn uv2(n: usize) -> Vec<(usize, usize)> {
        (0..n).map(|_| uv(2)).map(|a| (a[0], a[1])).collect()
    }

    pub fn uv3(n: usize) -> Vec<(usize, usize, usize)> {
        (0..n).map(|_| uv(3)).map(|a| (a[0], a[1], a[2])).collect()
    }

    pub fn fv(n: usize) -> Vec<f64> {
        (0..n).map(|_| f()).collect()
    }

    pub fn cmap(h: usize) -> Vec<Vec<char>> {
        (0..h).map(|_| s()).collect()
    }
}


Measured memory_bytes: 4352
#include <stdio.h>
#include <iostream>
#include <string.h>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <stdlib.h>
#include <time.h>
#include <limits.h>
#include <assert.h>
using namespace std;
int n;
int main() {
	scanf("%d", &n);
	for(int i = n; i <= 999; i++) {
		int digit = i % 10;
		bool valid = 1;
		for(int j = i; j > 0; j /= 10) {
			if(j % 10 != digit) {
				valid = 0;
			}
		}
		if(valid) {
			printf("%d\n", i);
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<bitset>
#include<deque>
#include<functional>
#include<iterator>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<utility>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define a first
#define b second
#define sz(x) (ll)((x).size())
#define pb push_back
#define mp make_pair
#define bg begin()
#define ed end()
#define all(x) (x).bg,(x).ed
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep1(i,n) for(ll i=1;i<=(n);i++)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(ll i=(n);i>=1;i--)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
const ll MOD=1000000007;
const ll INF=1000000000000000;
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;}
ll maxx(ll x,ll y,ll z){return max(max(x,y),z);}
ll minn(ll x,ll y,ll z){return min(min(x,y),z);}
ll gcd(ll x,ll y){if(x%y==0) return y;else return gcd(y,x%y);}
ll lcm(ll x,ll y){return x*(y/gcd(x,y));}
ll digsz(ll x){if(x==0) return 1;else{ll ans=0;while(x){x/=10;ans++;}return ans;}}
ll digsum(ll x){ll sum=0;while(x){sum+=x%10;x/=10;}return sum;}
vector<ll> pw3(15,1);vector<ll> pw10(19,1);


int main(){
    {rep1(i,14) pw3[i]=3*pw3[i-1];}
    {rep1(i,18) pw10[i]=10*pw10[i-1];}
    string s; cin>>s;
    ll A=0,B=0,C=0;
    rep(i,sz(s)){
        if(s[i]=='a') A++;
        else if(s[i]=='b') B++;
        else C++;
    }
    
    if(abs(maxx(A,B,C)-minn(A,B,C))<=1) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
}


Measured memory_bytes: 3732
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(long long i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) {rep(_,v.size())cout<<" "<<v[_];cout<<endl;}
#define show2d(v) {rep(__,v.size())show1d(v[__]);}
using namespace std;
//kaewasuretyuui
typedef long long ll;
#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int,int> tp;
typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={-1,0,1,0};
int dy[]={0,1,0,-1};
#define yes cout<<"Yes\n"
#define no cout<<"No\n"

signed main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int n,x,y;
	cin>>n>>x>>y;x--;y--;
	vi out(n-1);
	rep(i,n)loop(j,i+1,n){
		int c=min(j-i,abs(i-x)+1+abs(j-y));
		out[c-1]++;
	}
	rep(i,n-1)cout<<out[i]<<endl;
}












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

using namespace std;

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

    int a[3];
    for(int i=0;i<3;i++)
        cin>>a[i];
    
    sort(a,a+3);
    
    cout<<a[0]+a[1];
    return 0;
}


Measured memory_bytes: 256
//#pragma GCC optimize(2)
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int maxn=1e5+5;
const int mod=1e9+7;
ll n,m;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
	cin>>n>>m;
    cout<<n*(n-1)/2+m*(m-1)/2<<endl;
    return 0;
}


Measured memory_bytes: 256