akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split(' ');
            int a = int.Parse(str[0]);
            int b = int.Parse(str[1]);
            int c = int.Parse(str[2]);

            int ans = c - (a - b);
            if (ans < 0)
                Console.WriteLine(0);
            else Console.WriteLine(ans);
        }
    }
}

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


int main() {
    int X;
    cin >> X;
    string ans = "NO";
    if (X == 3 || X == 5 || X == 7) ans = "YES";
    cout << ans << endl; 
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
struct Fast { Fast() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20);} } fast;

long long mod = 1000000007;

long long div(long long a, long long b, long long c){
    return b / c - (a - 1) / c;
}

int main() {
    int k, x;
    cin >> k >> x;
//    vector<long> as(n);
    for(int i = x - k + 1; i < k + x; i++){
        cout << i << " ";
    }
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

    public static void main(String[] args) throws IOException {

        BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
        String input = bf.readLine();

        String[] strArray = input.split(" ");

        int num1 = Integer.parseInt(strArray[0]);
        int num2 = Integer.parseInt(strArray[1]);
        int num3 = Integer.parseInt(strArray[2]);

//      ??°????????\??????????????????????????±
        int changeBox;

//      num1??????num2??????????°?????????´????????°????????\????????????
        if(num2 < num1){
            changeBox = num1;
            num1 = num2;
            num2 = changeBox;
        }

//      num2??????num3??????????°?????????´????????°????????\????????????
        if(num3 < num2){
            changeBox = num2;
            num2 = num3;
            num3 = changeBox;
        }

//      ?????????num1??????num2??????????°?????????´????????°????????\????????????
        if(num2 < num1){
            changeBox = num1;
            num1 = num2;
            num2 = changeBox;
        }

        System.out.println(num1 + " " + num2 + " " + num3);

    }
}

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

int main(){
    int k, x;
    cin >> k >> x;
    
    for (int i = x - k + 1; i < x + k; i++) {
        if (i == x + k) {
            cout << i << endl;
        } else {
            cout << i << " ";
        }
    }
}


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

int main()
{
    int n;
    cin >> n;
    int Ans = 1;
    for(int i = 0; i < 100000; i++)
    {
        if(pow(i, 2) <= n)
        {
            Ans = pow(i, 2);
        }
        else
        {
            break;
        }
    }
    
    cout << Ans << endl;



}

Measured memory_bytes: 256
import std.algorithm;
import std.range;
import std.stdio;
import std.math;
import std.array;
import std.string;
import std.conv;

/// 数列の読み込み
auto readNums(T = int)() {
	return readln().chomp.split.map!(to!T).array;
}

/// 数の読み込み
auto readNum(T = int)() {
	return readNums!T.front;
}

/// 指定行数読み込み
auto readRows(size_t rows) {
	return generate(() => readln().chomp).take(rows).array;
}

/// 範囲の計算
auto range(T)(T a, T b, T c, T d) {
    auto start = max(a, c);
    auto end = max(b, d);
    return (start < end) ? tuple(start, end) : tuple(cast(T) 0, cast(T) 0);
}

auto maxElement(R)(R r) {
    return r.reduce!((a, b) => max(a, b));
}

auto minElement(R)(R r) {
    return r.reduce!((a, b) => min(a, b));
}

void main() {
	auto nums = readNums();
	auto t = cast(real) nums[0];
	auto x = cast(real) nums[1];
	writefln("%s", t / x);
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
#include <cmath>
#include <set>
#include <stack>
#include <queue>
#include <numeric>
#include <deque>
#include <cstring>
#include <iterator>
#include <map>
#include <cstdlib>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <complex>
#include <bitset>
#include <chrono>
#include <random>
#include <assert.h>
#include <array>

using namespace std;

template<typename M, typename N>
istream& operator>>(istream&is, pair<M,N> & p){is >> p.first >> p.second; return is;}
template<typename M>
istream& operator>>(istream&is, vector<M> & v){for(auto &it:v) is >> it; return is; }
template<typename M>
istream& operator>>(istream&is, vector<vector<M>> & v){for(auto &it:v) is >> it; return is; }
template<typename M, typename N>
ostream& operator<<(ostream&os, const pair<M,N> &p){os << p.first << ' ' << p.second << '\n';return os;}
template<typename M>
ostream& operator<<(ostream&os, const vector<M> &v){for(auto it: v)os << it << ' ';cout << '\n';return os;}
template<typename M>
ostream& operator<<(ostream&os, const vector<vector<M>> &v){for(auto it: v)os << it;return os;}

#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define mn(x) *min_element((x).begin(),(x).end())
#define mx(x) *max_element((x).begin(),(x).end())
#define acc(x) accumulate((x).begin(),(x).end(),0ll)
#define eb emplace_back
#define el '\n'
typedef  long long  ll;
typedef  unsigned long long  ull;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<pll> vpll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<string> vs;

const ld pi=acos(-1);
const ll inf=(ll)1e9+10;
//const int mod=1000000007;
const int mod=998244353;

int n,m,k;
const int N=2e5+10;

vvi adj(N);
vb mark(N);


void dfs(int u, int p){
    mark[u]=true;
    for(auto it: adj[u]){
        if(it!=p&&!mark[it]){
            dfs(it, u);
        }
    }
    return ;
}



int main()
{   ios_base::sync_with_stdio(false);cin.tie(NULL);
    int n, m;
    cin >> n >> m;
    for(int i=0, u, v; i<m; i++){
        cin >> u >> v;
        adj[--u].pb(--v);
        adj[v].pb(u);
    }
    int ans=-1;
    for(int i=0; i<n; i++){
        if(!mark[i]){
            ans++;
            dfs(i,i);
        }
    }
    cout << ans << el;
    
    return 0;
}








Measured memory_bytes: 11912
import java.io.IOException;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

import static java.lang.StrictMath.sqrt;

/**
 * Wrong Answer
 */
class Main {
	public static void main(String[] args) throws IOException {
		double EPS = 1e-6;
		Scanner in = new Scanner(System.in);

		while(in.hasNext()) {
			Point p1 = new Point(in.nextDouble(), in.nextDouble());
			Point p2 = new Point(in.nextDouble(), in.nextDouble());
			Point p3 = new Point(in.nextDouble(), in.nextDouble());
			Point p = new Point(in.nextDouble(), in.nextDouble());

			double angle = 0.0;
			// angle of (p-p3, p-p1)
			angle += Math.abs(PointUtil.angleRad(p3, p1, p));

			// angle of (p-p1, p-p2)
			angle += Math.abs(PointUtil.angleRad(p1, p2, p));

			// angle of (p-p2, p-p3)
			angle += Math.abs(PointUtil.angleRad(p2, p3, p));

			// 360 degree
			if(2 * Math.PI - EPS <= angle && angle <= 2 * Math.PI + EPS) {
				System.out.println("YES");
			} else {
				System.out.println("NO");
			}
		}
	}
}

class Point {
	double x;
	double y;

	public Point(double x, double y) {
		this.x = x;
		this.y = y;
	}

	public double len() {
		return x*x + y*y;
	}

	public double getX() {
		return x;
	}

	public void setX(double x) {
		this.x = x;
	}

	public double getY() {
		return y;
	}

	public void setY(double y) {
		this.y = y;
	}
}

class PointUtil {
	/**
	 * angle of vec(p1-p) and vec(p2-p)
	 * @param p1
	 * @param p2
	 * @return
	 */
	public static double angleRad(Point p1, Point p2, Point p) {
		double a1 = p1.getX() - p.getX();
		double a2 = p1.getY() - p.getY();
		double b1 = p2.getX() - p.getX();
		double b2 = p2.getY() - p.getY();

		return Math.acos((a1*b1+a2*b2) / ( sqrt(a1*a1 + a2*a2) * sqrt(b1*b1 + b2*b2)));
	}
}

Measured memory_bytes: 32016
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <numeric>
#include <tuple>
#include <string>
#include <cassert>

template <class T, class U>
inline bool chmin(T &lhs, const U &rhs) {
  if (lhs > rhs) {
    lhs = rhs;
    return true;
  }
  return false;
}

template <class T, class U>
inline bool chmax(T &lhs, const U &rhs) {
  if (lhs < rhs) {
    lhs = rhs;
    return true;
  }
  return false;
}

// [l, r) from l to r
struct range {
  struct itr {
    int i;
    constexpr itr(int i_): i(i_) { }
    constexpr void operator ++ () { ++i; }
    constexpr int operator * () const { return i; }
    constexpr bool operator != (itr x) const { return i != x.i; }
  };
  const itr l, r;
  constexpr range(int l_, int r_): l(l_), r(std::max(l_, r_)) { }
  constexpr itr begin() const { return l; }
  constexpr itr end() const { return r; }
};

// [l, r) from r to l
struct revrange {
  struct itr {
    int i;
    constexpr itr(int i_): i(i_) { }
    constexpr void operator ++ () { --i; }
    constexpr int operator * () const { return i; }
    constexpr bool operator != (itr x) const { return i != x.i; }
  };
  const itr r, l;
  constexpr revrange(int l_, int r_): l(l_ - 1), r(std::max(l_, r_) - 1) { }
  constexpr itr begin() const { return r; }
  constexpr itr end() const { return l; }
};

bool ab[100000];
bool ac[100000];
bool bc[100000];

bool same(char c1, char c2){
  return (c1 == '?' || c2 == '?' || c1 == c2);
}

int main() {
  std::string a, b, c;
  std::cin >> a >> b >> c;
  int A = a.size();
  int B = b.size();
  int C = c.size();
  for (int i: range(0, A)) {
    for (int j: range(0, B)) {
      if (!same(a[i], b[j])) {
        ab[i - j + 50000] = true;
      }
    }
  }
  for (int i: range(0, A)) {
    for (int j: range(0, C)) {
      if (!same(a[i], c[j])) {
        ac[i - j + 50000] = true;
      }
    }
  }
  for (int i: range(0, B)) {
    for (int j: range(0, C)) {
      if (!same(b[i], c[j])) {
        bc[i - j + 50000] = true;
      }
    }
  }
  int ans = 3 * 2000;
  for(int i: range(-4000, 4001)) {
    for(int j: range(-4000, 4001)) {
      if (!ab[i + 50000] && !ac[j + 50000] && !bc[j - i + 50000]){
        int L = std::min(0, std::min(i, j));
        int R = std::max(A, std::max(B + i, C + j));
        chmin(ans, R - L);
      }
    }
  }
  std::cout << ans << '\n';
  return 0;
}


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

int main(){
  int N,K;
  cin >> N >> K;
  vector<bool> has(N,false);
  for(int i=0; i<K; i++){
    int num;
    cin >> num;
    for(int j=0; j<num; j++){
      int index;
      cin >> index;
      has[index-1] = true;
    }
  }
  int ans = 0;
  for(int i=0; i<N; i++)
    if(!has[i])
      ans++;
  cout << ans << endl;
}

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

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n-1;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define INF 999999999

typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
typedef unordered_map<ll, ll> ump;

const ll mod = 1e9+7;

ll max(ll a, ll b){
	if (a > b) return a;
	else return b;
}

unsigned getDigit(unsigned num){
    unsigned digit=0;
    while(num!=0){
        num /= 10;
        digit++;
    }
    return digit;
}

ll pow_2(ll a, ll b){
	ll dst = 1;
	REP(i, b){
		dst *= a;
	}
	return dst;
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n;
	cin >> n;
	vector<vector<ll>> vec(n, vector<ll>(3));
	REP(i, n){
		REP(j, 3){
			cin >> vec[i][j];
		}
	}
	REP(i, n){
		ll t_diff, x_diff, y_diff, diff;
		if (i == 0){
			t_diff = vec[i][0];
			x_diff = vec[i][1];
			y_diff = vec[i][2];
		} else {
			t_diff = vec[i][0] - vec[i-1][0];
			x_diff = abs(vec[i][1] - vec[i-1][1]);
			y_diff = abs(vec[i][2] - vec[i-1][2]);
		}
		diff = x_diff + y_diff;
		if (!((t_diff-diff >= 0) && ((t_diff-diff)%2 == 0))){
			cout << "No" << endl; return 0;
		}
	}
	cout << "Yes" << endl;
}


Measured memory_bytes: 5760
# -*- coding:utf-8 -*-

def solver():
    # mr.zehnpaard
    from statistics import median_low, median_high

    n = int(input())
    xs = [int(x) for x in input().split()]

    m1, m2 = median_low(xs), median_high(xs)

    medians = (str(m2 if x < m2 else m1) for x in xs)
    print('\n'.join(medians))

def main():
    from statistics import median_low, median_high

    N = int(input())
    Xs = list(map(int, input().split()))
    m_low, m_high = median_low(Xs), median_high(Xs)

    for x in Xs:
        ans = m_high if x <= m_low else m_low
        print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 27244
#include<bits/stdc++.h>
#include<atcoder/all>
using namespace std;
using namespace atcoder;
#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;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a,T b){return b?gcd(b,a%b):a;}
const ll mod=998244353;
const ll LINF=1ll<<60;
const int INF=1<<30;
int dx[]={1,0,-1,0,1,-1,1,-1};
int dy[]={0,1,0,-1,1,-1,-1,1};


struct S{
    ll in,nz,no;
};

struct F{
    ll cnt;
};


S e(){
    return {0,0,0};
}

F id(){
    return {0};
}

S op(S l, S r){
    return {l.in+r.in+l.no*r.nz, l.nz+r.nz, l.no+r.no};
}

S mapping(F f, S x){
    if(f.cnt % 2 == 0) return x;
    return {x.nz*x.no-x.in, x.no, x.nz};
}

F composition(F f, F node){
    return {f.cnt + node.cnt};
}


int main(){
    int n,q;cin >> n >> q;
    vector<S> a(n);
    for (int i = 0; i < n; i++) {
        ll x;cin >> x;
        a[i] = {0, not x, x};
    }
    lazy_segtree<S, op, e, F, mapping, composition, id> seg(a);
    while(q--){
        int t,l,r;cin >> t >> l >> r;
        l--;
        if(t == 1){
            seg.apply(l, r, {1});
        }
        else{
            cout << seg.prod(l, r).in << endl;
        }
    }
}


Measured memory_bytes: 22240
N, M = map(int, input().split())
AC = set()
wa = [0] * (N+1)

for _ in range(M):
    p, s = input().split()
    p = int(p)
    if not p in AC:
        if s == 'AC':
            AC.add(p)
        if s == 'WA':
            wa[p] += 1

wa_ans = 0
for i in range(1,N+1):
    if i in AC:
        wa_ans += wa[i]

print(len(AC), wa_ans)

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


int main(){
  int N;cin>> N;
  vector<int> H;
  for (int i=0;i<N;++i){
    int h;cin>>h;H.push_back(h);
  }

  int ans=1;
  for (int i=1;i<N;++i){
    int flag=1;
    for (int j=0;j<i;++j){
      if (H[j]>H[i]){flag=0;}
    }
    if (flag==1){ans++;}
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int lint
typedef long long lint;
typedef pair<int,int> P;
const int    INF=(int)1e9;
const int    MOD=(int)1e9+7;
const double EPS=(double)1e-10;
struct Accelerate_Cin{
    Accelerate_Cin(){
        cin.tie(0);ios::sync_with_stdio(0);cout<<fixed<<setprecision(20);
    };
};

//前計算量Ｏ(n)
//クエリ処理Ｏ(log n)

const int MAX_N=100010;
int bit[MAX_N+1],n;  //１-indexed

//1番目からi番目までの総和を求める。
int sum(int i){
  int res=0;
  while(i>0){
    res+=bit[i];
    i-=i&-i;
  }
  return res;
}

//i番目の値にxを加える。
void add(int i,int x){
  while(i<=n){
    bit[i]+=x;
    i+=i&-i;
  }
}


signed main(){
  memset(bit,0,sizeof(bit));
  int qq;cin>>n>>qq;
  queue<int>q;
  for(int i=0;i<qq;i++){
    int com,x,y;cin>>com>>x>>y;
    if(com==0){
      add(x,y);
    }else{
      int ans=sum(y)-sum(x-1);
      q.push(ans);
    }
  }

  while(!q.empty()){
    cout<<q.front()<<endl;
    q.pop();
  }
  return 0;
}



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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(a)     (a).begin(),(a).end()
#define VI         vector<int>
#define MOD 1000000007

typedef long long int ll;

const ll INF=(ll)1e19;
//const int INF=(1<<30);


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

  ll ans=0;
  ll cnt_r=0;
  ll cnt_g=0;
  ll cnt_b=0;
  REP(i,n){
    if(s[i]=='R'){
      cnt_r++;
    }else if(s[i]=='G'){
      cnt_g++;
    }else{
      cnt_b++;
    }
  }

  ans = cnt_r * cnt_g * cnt_b;

  REP(i,n){
    char c=s[i];
    if(c=='R'){
      FOR(j,1, min(n-i-1,i)+1){
        if(s[i-j] == 'G' && s[i+j] == 'B' || s[i-j] == 'B' && s[i+j] == 'G'){
          ans-=1;
        }
      }
    }else if(c=='G'){
      FOR(j,1, min(n-i-1,i)+1){
        if(s[i-j] == 'R' && s[i+j] == 'B' || s[i-j] == 'B' && s[i+j] == 'R'){
          ans-=1;
        }
      }

    }else{
      FOR(j,1, min(n-i-1,i)+1){
        if(s[i-j] == 'G' && s[i+j] == 'R' || s[i-j] == 'R' && s[i+j] == 'G'){
          ans-=1;
        }
      }
    }
  }

  cout << ans << endl;
}





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

int n, m = 0;

int main()
{
	cin >> n;

	if (n > 64 && n < 91)
		m = 1;
	else if (n > 96 && n < 123)
		m = 2;

	cout << m << endl;

	return 0;
}


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

int main() 
{
    string s,t;
    cin >> s >> t;
    sort(s.begin(), s.end());
    sort(t.rbegin(), t.rend());
    cout << (t>s?"Yes":"No");
    return 0;
}

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

int N, ans;
string a[103];
int main(){
	scanf("%d", &N);
	for (int i = 0; i < N; i++) {
		cin >> a[i];
	}
	for (int i = 1; i < N; i++) {
		if (a[i][0] != a[i - 1].back()) {
			printf("No\n");
			return 0;
		}
	}
	sort(a, a + N);
	for (int i = 0; i < N - 1; i++) {
		if (a[i].compare(a[i + 1]) == 0) {
			printf("No\n");
			return 0;
		}
	} 
	printf("Yes\n");
	return 0;
}

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

int main(){
	int H, W, M;
	queue<int> q1;
	queue<int> q2;
	cin  >> H >> W >> M;
	int h[M], w[M];
	long long r1[H], r2[W];
	long long MR1 = 0, MR2 = 0;
	for(int i=0;i<H;i++){
		r1[i] = 0;
	}
	for(int i=0;i<W;i++){
		r2[i] = 0;
	}
	for(int i=0;i<M;i++){
		cin >> h[i] >> w[i];
		h[i]--;
		w[i]--;
		r1[h[i]]++;
		r2[w[i]]++;
		MR1 = max(MR1, r1[h[i]]);
		MR2 = max(MR2, r2[w[i]]);
	}
	vector<int> A, B;
	long long ans = MR1 + MR2 - 1;
	for(int i=0;i<H;i++){
		if(r1[i] == MR1) A.push_back(i);
	}
	for(int i=0;i<W;i++){
		if(r2[i] == MR2) B.push_back(i);
	}
	long long num = (long long)A.size() * (long long)B.size();
	long long cnt = 0;
	for(int i=0;i<M;i++){
		bool chk1 = binary_search(A.begin(), A.end(), h[i]);
		bool chk2 = binary_search(B.begin(), B.end(), w[i]);
		if(chk1 && chk2) cnt++;
	}
	if(cnt < num)ans++;
	cout << ans << endl;
}


Measured memory_bytes: 14404
#include <cstdio>
#include <cmath>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <climits>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <algorithm>
#include <set>
#include <map>
#include <list>
#include <deque>
#include <vector>
#include <string>
#include <bitset>
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define INF 1000000001
#define endl "\n"
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define REP_R(i,n) for(int i=((int)(n)-1);i>=0;--i)
#define FOR(i,m,n) for(int i=((int)(m));i<(int)(n);++i)
#define FOR_R(i,m,n) for(int i=((int)(m)-1);i>=(int)(n);--i)
#define ALL(v) (v).begin(),(v).end()
#define SIZ(x) ((int)(x).size())
typedef long long int lli;
using namespace std;

// C problem

int main()
{
  int N , Q;
  string S;
  scanf("%d%d",&N,&Q);
  cin >> S;

  int l;
  int r;

  vector<int> ind;
  
  REP(j,N-1)
    {
      if( S[j] == 'A' and S[j+1] == 'C' )
	{
	  ind.push_back(j+1);
	  
	}
    }

  

  REP(i,Q)
    {
      scanf("%d%d",&l,&r);
      printf("%d\n",
	     lower_bound(ALL(ind), r) - lower_bound(ALL(ind), l)
	     );
      
      

      
    }
  
  
}


Measured memory_bytes: 1276
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define all(v) v.begin(), v.end()
#define ll long long
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<long long>;
using vvll = vector<vll>;

//snippets:tmp,cl,cvl,cs,co,coy,con,cov
//export PATH=-:~/.local/bin

int main(){
    ll n;
    cin >> n;
    ll minsum=0;
    ll maxsum=0;
    ll minimini=0;
    ll maxmax=0;
    vector<pair<ll,ll>> d(0);
    vector<pair<ll,ll>> d2(0);
    ll a=0;
    rep(i,n){
        string s;
        cin >> s;
        ll count=0;
        ll mini=0;
        ll maxi=0;
        rep(i,s.size()){
            if(s[i]=='('){
                count++;
            }
            else if(s[i]==')'){
                count--;
                mini=min(mini,count);
            }
        }
        maxi=mini-count;
        if(count>=0&&mini<0){
            d.push_back({count,mini});
        }
        if(count>0&&mini>=0){
            minsum+=count;
        }

        if(count<0&&maxi<0){
            d2.push_back({count*(-1),maxi});
        }
        if(count<0&&maxi>=0){
            maxsum-=count;
        }
        a+=count;
    }
    if(a!=0){
        cout << "No" << endl;
        return 0;
    }
    sort(all(d));
    reverse(all(d));
    ll now=minsum;
    rep(i,d.size()){
        rep(j,d.size()){
            if(d[j].first!=-1&&now+d[j].second>=0){
                now+=d[j].first;
                d[j].first=-1;
                break;
            }
            if(j==d.size()-1){
                cout << "No" << endl;
                return 0;
            }
        }
    }
    sort(all(d2));
    reverse(all(d2));
    now =maxsum;
    rep(i,d2.size()){
        rep(j,d2.size()){
            if(d2[j].first!=-1&&now+d2[j].second>=0){
                now+=d2[j].first;
                d2[j].first=-1;
                break;
            }
            if(j==d2.size()-1){
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
}

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

using ll = long long;

ll n, a;
std::vector<ll> vec;
ll ans = 0;
long median;
int main() {
    std::cin >> n;
    vec.assign(n, 0);
    for (int i = 0; i < n; i++) {
        std::cin >> a;
        vec[i] = a - (i+1);
    }
    std::sort(vec.begin(), vec.end());
    median = vec[vec.size() / 2];
    for (int i = 0; i < n; i++) {
        ans += std::abs(vec[i] - median);
    }
    std::cout << ans << std::endl;
}


Measured memory_bytes: 1792
import std.stdio, std.algorithm, std.array, std.ascii;

int main() {
	char a = scanChar();
	if('a'<=a && a<='z') {
		writeln("a");
	} else {
		writeln("A");
	}
	return 0;
} 

char scanChar() {
	import std.ascii;
	int c = ' ';
	while(isWhite(c) && c != -1) {
		c = getchar;
	}
	return cast(char)c;
	
}

Measured memory_bytes: 6876
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        Set<String> set = new HashSet<>();

        int num = sc.nextInt();

        for(int i=0; i<num; i++){
            String s = sc.next();
            set.add(s);
        }

        if(set.size() == 4){
            System.out.println("Four");
        } else {
            System.out.println("Three");
        }
    }
}


Measured memory_bytes: 21716
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<math.h>
#include<tuple>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
int main() {
	int a, b;
	cin >> a >> b;
	cout << (a - 1)*(b - 1) << endl;
	return 0;
}

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

int main(){
    long N;
    long long int H;
    long long int a,maxa=0;
    long long int b[100002];
    long long int count=0;

    cin >> N >> H;

    for(long i=0;i<N;i++){
        cin >> a >> b[i];
        if(a>maxa) maxa=a;
    }

    sort(b,b+N,greater<long long int>());
    
    for(long i=0;i<N;i++){
        if(H<=0) break;
        if(b[i]>maxa){
            H -= b[i];
            count++;
        }
    }
    if(H>0) count += H/maxa + ((H%maxa)? 1:0);
    cout << count << "\n";

    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cstdio>
#include <cstring>
#include <queue>
#include <stack>
#include <set>
#include <cmath>

typedef long long ll;
using namespace std;

#define FALSE printf("false\n");
#define TRUE printf("true\n");
#define all(x) (x).begin(),(x).end()
#define print(x) cout<<x<<endl
#define rep(i,n) for(int i = 0;i < ((int)(n));++i)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define SUM(vec) accumulate(all(vec),0LL)
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define test(a) cout<<(#a)<<':'<<(a)<<endl

const int INF = 1e9+7;
const ll INFL = 9*1e18;

ll inline digit(ll num){int tmp = 0;while(num){tmp++;num/=10;}return tmp;}
template<typename T>inline T digitSum(T num){T sum = 0;while(num){sum+=num%10;num/=10;}return sum;} // 各桁の和
template<typename T>inline T gcd(T a,T b){if(b == 0)return a;return gcd(b,a%b);}
template<typename T>inline T lcm(T a, T b){T g = gcd(a,b);return a/g*b;}
template<typename T>inline T power(T a,T b){T tmp=1;rep(i,b){tmp*=a;}return tmp;}

bool isOk(ll key,ll value){
  return key < value;
}

int binary_search(vector<ll> a,ll key){
  ll ok = a.size();
  ll ng = -1;

  while(abs(ok - ng) > 1){
    ll mid = (ok + ng) / 2;
    if(isOk(key,a[mid]))ok = mid;
    else ng = mid;
  }
  return ok;
}


int main() {
  cin.tie(0); ios::sync_with_stdio(0);
  int n,m;cin>>n>>m;
  vector<pair<int,bool> > chance(n,mp(1,false));
  chance[0].se = true;
  
  rep(i,m){
    int x,y;
    cin>>x>>y;

    chance[y-1].se = chance[y-1].se || chance[x-1].se;  
    chance[x-1].fi--;
    chance[y-1].fi++;
    if(chance[x-1].fi == 0)chance[x-1].se = false;
  }
  int ans = 0;
  rep(i,n){
    ans += chance[i].se;
  }
  print(ans);
  return 0;
} 


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int i,j,a,b,m,n;
int main(){
  cin>>a>>b>>m;
  vector<int> A(a),B(b);
  vector<int> x(m),y(m),c(m);
  int am=100000,bm=100000;
  for(i=0;i<a;i++)cin>>A[i],am=min(am,A[i]);
  for(i=0;i<b;i++)cin>>B[i],bm=min(bm,B[i]);
  for(i=0;i<m;i++)cin>>x[i]>>y[i]>>c[i];
  int ans=am+bm;
  for(i=0;i<m;i++)ans=min(ans,(A[x[i]-1]+B[y[i]-1]-c[i]));
  cout<<ans;
}

Measured memory_bytes: 2176
K = int(input())
def solve():
    n = min(50, max(2, K//(10**16) + 1))
    q = K//n
    r = K%n
    return [q-r + n-1] * (n-r) + [q-r + 2*n-1] * r

ans = solve()
print(len(ans))
print(' '.join(map(str,ans)))


Measured memory_bytes: 3060
#define scanf_s scanf
//#define gets_s gets
#include <stdio.h>
#include <string>
#include <iostream>
#include <math.h>
using namespace std;
#define MAX 1000//0
#define _MAX 81
int main(void)
{
	int s;
	double w, h;
	while (scanf_s("%d,%lf,%lf", &s, &w, &h) != EOF) {
		if (w / (h * h) >= 25) printf("%d\n", s);
	}
}

Measured memory_bytes: 1212
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

typedef long long ll;

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

int main(void) {
    int A, B, C;
    cin >> A >> B >> C;

    cout << max(0, C - (A - B)) << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <numeric>
#include <tuple>
#include <stack>

#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define print(s) cout << s << endl
typedef long long ll;
using namespace std;

int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}
char upper(char c){
	return c-0x20;
}
char lower(char c){
	return c+0x20;
}
int main() {
	string a,b; cin >> a >> b;
	rep(i,a.size()){
		cout << a[i];
		if (i > b.size()-1) break;
		cout << b[i];
	}
}

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(){
	
	string S;
	cin>>S;
	
	vector<int> dp(1<<26,Inf);
	dp[0] = 0;
	
	int now = 0;
	for(int i=0;i<S.size();i++){
		now ^= 1<<(S[i]-'a');
		for(int j=0;j<26;j++){
			dp[now] = min(dp[now],dp[now^(1<<j)]+1);
		}
	}
	
	if(now!=0)cout<<dp[now]<<endl;
	else cout<<1<<endl;

	return 0;
}

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

#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 ALL(obj) (obj).begin(), (obj).end()
#define INF 1e9
#define LINF 1e18
typedef long long ll;


int main() {
    int N; cin >> N;
    vector<int> L(N);
    REP(i,N) cin >> L[i];
    sort(ALL(L));
    ll ans = 0;
    REP(i,N-2){
        FOR(j,i+1,N-1){
            FOR(k,j+1,N){
                if(L[i]!=L[j] && L[j]!=L[k] && L[k]!=L[i]){
                    if(L[i]+L[j] > L[k]) ans++;
                }
            }
        }
    }
    cout << ans << endl;
    return 0;
}

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

int main(){
    int n;
    cin >> n;
    long long min_h = 0;
    bool ju = true;
    for(int i = 0;i < n;i++){
        long long h;
        cin >> h;
        if(h < min_h){
            ju = false;
            break;
        }
        min_h = max(min_h,h-1);
    }
    if(ju){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
package main

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

func main() {
	solve()
}

func solve() {
	s := readInput()
	for i := 0; i < len(s); i++ {
		if i+1 < len(s) && s[i] == s[i+1] {
			fmt.Printf("%d %d\n", i+1, i+2)
			return
		} else if i+2 < len(s) && s[i] == s[i+2] {
			fmt.Printf("%d %d\n", i+1, i+3)
			return
		}
	}
	fmt.Printf("%d %d\n", -1, -1)
}

func readInput() string {
	r := bufio.NewReader(os.Stdin)
	read := make([]byte, 0)
	for {
		l, p, _ := r.ReadLine()
		read = append(read, l...)
		if !p {
			break
		}
	}
	return string(read)
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
using ld = long double;
template<typename T> using V = vector<T>;
template<typename T> using VV = vector<vector<T>>;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,a,n) for(ll i=a;i<(ll)(n);i++)
#define repr(i,a,n) for(ll i=n-1;(ll)a<=i;i--)
#define lb lower_bound
#define ub upper_bound
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
const ll mod = 1000000007;
const ll INF = 1000000099;
const ll LINF = (ll)(1e18 +99);
vector<ll> dx={-1,1,0,0},dy={0,0,-1,1};
template<typename T,typename U> void chmin(T& t, const U& u){if(t>u)t=u;}
template<typename T,typename U> void chmax(T& t, const U& u){if(t<u)t=u;}
template<typename T>T gcd(T a,T b){return b?gcd(b,a%b):a;}
template<typename T>T mpow(T a, T n) {
  T res = 1;
  for(;n;n>>=1) {
    if (n & 1) res = res * a;
    a = a * a;
  }
  return res;
}



signed main(){
  cin.tie(0);ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);
  ll n,m;cin>>n>>m;
  string s;cin>>s;
  set<int> se;
  rep(i,0,siz(s)){
    if(s[i]=='0')se.insert(i);
  }

  int now=n;
  vector<int> ans(0);
  while(0<now){
    auto itr=se.lb(now-m);
    if(*itr==now){
      cout<<-1<<endl;
      return 0;
    }
    ans.pb(now-*itr);
    now=*itr;
  }

  reverse(all(ans));
  rep(i,0,siz(ans)){
    cout<<ans[i]<<" ";
  }cout<<endl;

}
//( ・ __ ・ ) KEEP BEING ORGANIZED
//CHECK overflow,vector_size,what to output?

Measured memory_bytes: 5708
n = int(input())
a = [list(map(int, input().split())) for _ in range(n)]

dp = [[0] * 3 for _ in range(n)]
dp[0] = a[0]

for i in range(n - 1):
    dp[i + 1][0] = a[i + 1][0] + max(dp[i][1], dp[i][2])
    dp[i + 1][1] = a[i + 1][1] + max(dp[i][2], dp[i][0])
    dp[i + 1][2] = a[i + 1][2] + max(dp[i][0], dp[i][1])
print(max(dp[-1]))


Measured memory_bytes: 74456
#pragma gcc optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V)) //小さい方からソート
#define REV(V) reverse(ALL(V)) //リバース
#define RSORT(V) SORT(V);REV(V) //大きい方からソート
#define NPN(V) next_permutation(ALL(V)) //順列
#define pb(n) push_back(n)
#define endl '\n'
#define Endl '\n'
#define DUMP(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define Yay(n) cout << ((n) ? "Yay!": ":(") << endl
#define RAPID cin.tie(0);ios::sync_with_stdio(false)
#define IN(n) cin >> n
#define IN2(a,b) cin >> a >> b
#define IN3(a,b,c) cin >> a >> b >> c 
#define IN4(a,b,c,d) cin >> a >> b >> c >> d
#define VIN(V) for(int i = 0; i < (V).size(); i++) {cin >> (V).at(i);}
#define OUT(n) cout << n << endl
#define VOUT(V) REP(i, (V).size()) {cout << (V)[i] << endl;}
#define VOUT2(V) REP(i, (V).size()) {cout << (V)[i] << " ";} cout<<endl;

// 型マクロ定義
#define int long long
#define P pair<ll,ll>
#define Vi vector<ll>
#define Vd vector<double>
#define Vs vector<string>
#define Vc vector<char>
#define M map<ll,ll>
#define S set<ll>
#define PQ priority_queue<ll>
#define PQG priority_queue<ll,V,greater<ll>
//

const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int gcd(int a,int b){return b?gcd(b,a%b):a;} //最小公倍数

// デフォルト変数定義
int n,m,a,b,c,d,x,y,z;
string s,t;
//

signed main() {
  RAPID;
  IN3(x,a,b);
  if(abs(b-x) >= abs(a-x)) OUT("A");
  else OUT("B");
}

Measured memory_bytes: 256
import collections
import sys

S=collections.deque(input())
Q=int(input())

r=0
for _ in range(Q):
    fs=next(sys.stdin).split()
    T=int(fs[0])
    if T==1:
        r^=1
    else:
        F,C=int(fs[1])-1,fs[2]
        if F==r:
            S.appendleft(C)
        else:
            S.append(C)

ans=''.join(reversed(S) if r else S)
print(ans)


Measured memory_bytes: 14124
#![allow(unused, non_snake_case, dead_code, non_upper_case_globals)]
use std::cmp::*;
use std::collections::*;
use std::mem::*;

fn main() {
    let (r, w, e) = (std::io::stdin(), std::io::stdout(), std::io::stderr());
    let mut io = IO::new(r.lock(), w.lock(), e.lock());
    let n = io.read::<usize>();
    let a = io.readn::<usize>(n);
    let mut sowa = 0f64;

    for &x in a.iter() {
        sowa += 1.0f64 / x as f64;
    }
    io.writeln(1f64 / sowa);
}

static MX: usize = 1010101;
static MOD: i64 = 1000000007;
static INF: i64 = std::i64::MAX >> 1;
// IO
use std::io::*;
struct IO<R: Read, W: Write, E: Write> {
    Read: R,
    Write: BufWriter<W>,
    Error: BufWriter<E>,
}
impl<R: Read, W: Write, E: Write> IO<R, W, E> {
    fn new(r: R, w: W, e: E) -> IO<R, W, E> {
        IO {
            Read: r,
            Write: BufWriter::new(w),
            Error: BufWriter::new(e),
        }
    }
    fn read<T>(&mut self) -> T
    where
        T: std::str::FromStr,
    {
        let next: String = self
            .Read
            .by_ref()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect();
        next.parse().ok().unwrap()
    }
    fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
    fn chari(&mut self) -> Vec<i64> {
        self.chars()
            .iter()
            .map(|&c| (c as u8 - b'0') as i64)
            .collect::<Vec<i64>>()
    }
    fn readn<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read::<T>()).collect::<Vec<_>>()
    }
    fn readmat<T: std::str::FromStr>(&mut self, n: usize, m: usize) -> Vec<Vec<T>> {
        (0..n).map(|_| self.readn(m)).collect()
    }
    fn write<S: ToString>(&mut self, val: S) {
        self.Write.write(val.to_string().as_bytes());
    }
    fn writeln<S: ToString>(&mut self, val: S) {
        self.Write.write(val.to_string().as_bytes());
        self.Write.write(b"\n");
    }
    fn debug<S: std::fmt::Debug>(&mut self, val: S) {
        writeln!(self.Error, "(debug) {:?}", &val);
    }
    fn debug2<S: std::fmt::Debug, T: std::fmt::Debug>(&mut self, val1: S, val2: T) {
        writeln!(self.Error, "(debug2) {:?} -> {:?}", val1, val2);
    }
    fn debug3<S: std::fmt::Debug, T: std::fmt::Debug, U: std::fmt::Debug>(
        &mut self,
        val1: S,
        val2: T,
        val3: U,
    ) {
        writeln!(
            self.Error,
            "(debug3) {:?} -> {:?} -> {:?}",
            val1, val2, val3
        );
    }
}


Measured memory_bytes: 2168
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>
 
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define _D(p) std::cout<<"L"<<__LINE__<<" : " #p " = "<<(p)<<std::endl;
#define _D2(p,q) std::cout<<"L"<<__LINE__<<" : " #p " = "<<(p) << ", " #q " = "<<(q)<<std::endl;
#define _DN(v) std::cout<<"L"<<__LINE__<<" : " #v " = ["; rep(i,(v).size()) {std::cout<<v[i]<<(i==v.size()-1?"":", ");}std::cout<<"]"<<std::endl;
#define _DNN(v) std::cout<<"L"<<__LINE__<<" : " #v " = [" << std::endl; rep(i,(v).size()) {std::cout<<"    [";rep(j,(v)[0].size()){std::cout<<v[i][j]<<(j==v[0].size()-1?"":", ");}std::cout<<"],"<<std::endl;}std::cout<<"]"<<std::endl;
 
using namespace std;
 
typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;
 
const int INF=1<<29;
const double EPS=1e-9;
 
const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};
int main(int argc, char const *argv[]) {
    int N, W;
    cin >> N >> W;
    vector<int> v(N), w(N);
    for (int i = 0; i < N; ++i) {
        cin >> v[i] >> w[i];
    }
    vector<vector<int>> dp(N + 1, vector<int>(10001, 1 << 30));
    dp[0][0] = 0;

    for(int i = 0; i < N; i++) {
        for(int j = 0; j < 10001; j++) {
            if (j + v[i] < 10001) dp[i + 1][j + v[i]] = min(dp[i + 1][j + v[i]], dp[i][j] + w[i]);
            dp[i + 1][j] = min(dp[i + 1][j], dp[i][j]);
        }
    }

    int ans;
    for (int i = 0; i < 10001; ++i) {
        if (dp[N][i] <= W) {
            ans = i;
        }
    }
    cout << ans << endl;
    return 0;
}


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

typedef long long int ll;

typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef pair<string,string> Pstring;
typedef pair<double,double> Pdouble;

#define REP(i,n) for(ll i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define Precision(i) cout << fixed << setprecision(i)

const double PI=3.14159265358979323846;
const int MOD = 1000000007;
const int INF = 1e9;
const ll LINF = 1e18;

int main() {

  int n;
  cin >> n;
  vector<Pll> a(n);
  REP(i,n) cin >> a.at(i).first >> a.at(i).second;
  vector<ll> v(n);
  REP(i,n) v.at(i) = i;
  double ans=0;
  ll count=0;
  do{
    REP(i,n-1){
      ll x1 = a.at(v.at(i)).first;
      ll y1 = a.at(v.at(i)).second;
      ll x2 = a.at(v.at(i+1)).first;
      ll y2 = a.at(v.at(i+1)).second;
      ans += sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
    }
    count++;
  }while(next_permutation(v.begin(),v.end()));

  ans /= (double)count;
  Precision(12);
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<cmath>
#include<algorithm>
using namespace std;
string ch;
int main()
{

    cin>>ch;
    int mls=ch.length();
        if((mls%2==0)&&(ch[0]==ch[mls-1])){
            cout<<"First"<<endl;return 0;
        }
        if((mls%2!=0)&&(ch[0]==ch[mls-1])){
            cout<<"Second"<<endl;return 0;
        }
        if((mls%2==0)&&(ch[0]!=ch[mls-1])){
            cout<<"Second"<<endl;return 0;
        }
        if((mls%2!=0)&&(ch[0]!=ch[mls-1])){
            cout<<"First"<<endl;return 0;
        }
    }


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

int main()
{
    int n;

    cin >>n;
    vector<long> v(n);
    
  for(int i=0;i<n;i++){
    cin >> v[i];
  }
  
  int count=0;
  
  for(int i=0;i<100000;i++){
    bool isdiv=true;
    for(int j=0;j<n;j++){
      if (v[j] %2==0){
        v[j]/=2;
      }else{
        isdiv=false;
      }
    }
    if (isdiv)count++;
    if (!isdiv)break;
  }


    cout <<  count;
    
    return 0;
}






Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#include <chrono>
#include <random>

using namespace std;

#define int long long
#define ll long long
//#define double long double
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()

const int INF = 2e9;
const int MB = 20;
const int MOD = 1e9 + 7;

void solve() {
    int n, x, y;
    cin >> n >> x >> y;

    vector<int> ans(n - 1);
    for (int i = 1; i <= n; i++) {
        for (int j = i + 1; j <= n; j++) {
            int d = min(j - i, abs(i - x) + 1 + abs(j - y));
            ans[d - 1]++;
        }
    }
    for (int i : ans) cout << i << "\n";
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    solve();
}

Measured memory_bytes: 256
#include <cassert>

#include <iostream>
#include <algorithm>
#include <deque>
#include <string>

using namespace std;

#define DEBUG(x) cerr << #x << " = " << x << endl

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

  int n; cin >> n;
  deque<int> l;
  while(n--) {
    string s;
    cin >> s;
    if(s == "insert") {
      int x;
      cin >> x;
      l.push_front(x);
    }
    else if(s == "delete") {
      int x;
      cin >> x;
      auto it = find(l.begin(), l.end(), x);
      if(it != l.end()) {
        l.erase(it);
      }
    }
    else if(s == "deleteFirst") {
      l.pop_front();
    }
    else if(s == "deleteLast") {
      l.pop_back();
    }
    else {
      assert(false);
    }
  }

  int k = 0;
  for(int item : l) {
    cout << item << " \n"[k++ == l.size() - 1];
  }
}

Measured memory_bytes: 5308
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <iostream>
#include <queue>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <string>
#include <random>
#include <stack>
#include <set>
#include <unordered_set>

using namespace std;
typedef long long ll;
const int maxn = 205;

int main() {
#ifdef suiyuan2009
  freopen("/Users/suiyuan2009/CLionProjects/icpc/input.txt", "r", stdin);
#endif
  int a,b,c;
  cin>>a>>b>>c;
  cout<<(c/a)*b<<endl;
  return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys, math, fractions, itertools


def solve(N: int, M: int, a: "List[int]", b: "List[int]"):
    G = [[] for _ in range(N)]
    for i in range(M):
        G[a[i]-1].append(b[i]-1)
        G[b[i]-1].append(a[i]-1)
    for i in range(N):
        print(len(G[i]))
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    a = [int()] * (M)  # type: "List[int]" 
    b = [int()] * (M)  # type: "List[int]" 
    for i in range(M):
        a[i] = int(next(tokens))
        b[i] = int(next(tokens))
    solve(N, M, a, b)

if __name__ == '__main__':
    main()


Measured memory_bytes: 5472
#include<bits/stdc++.h>
#define rep(i,n,m) for(int i = (n); i <(m); i++)
#define rrep(i,n,m) for(int i = (n) - 1; i >=(m); i--)
using namespace std;
using ll = long long;
const double INF = 1000000000;


void dynamic_programming(
    const vector<vector<int>> &edge, 
    vector<double>& dis, int cfrom, int cto)
{
    int n = edge.size();
    dis[0] = 0;
    for (int i=1; i<n; ++i)
    {
        double without = 0;
        double num = edge[i].size();
        for (auto to: edge[i])
        {
            if (cfrom == i and cto == to) continue;
            without += 1+dis[to];
        }

        if (i == cfrom)
            without /= num-1;
        else
            without /= num;
        dis[i] = without;
        // cout << without << endl;
    }
}

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

    vector<vector<int>> edge(n);
    rep(i, 0, m)
    {
        int s, t;
        cin >> s >> t;
        s = n-s;
        t = n-t;
        edge[s].push_back(t);
    }

    vector<double> dis(n);
    dynamic_programming(edge, dis, -1, -1);
    double ans = dis[n-1];
    // cout << "****** " << ans << endl;

    for (int i=1; i<=n-1;++i)
    {
        if (edge[i].size() <= 1) continue;
        int to = edge[i][0];
        for (auto t: edge[i])
            if (dis[t] > dis[to]) to = t;
        
        vector<double> now(n);
        dynamic_programming(edge, now, i, to);
        ans = min(ans, now[n-1]);
        // cout << "****** " << ans << endl;
    }
    printf("%.10f\n", ans);
    return 0;
}

Measured memory_bytes: 1408
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);
//cin.tie(0);
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
typedef tuple<ll,ll,ll> tl;
ll mod=1000000007;
ll mod2=998244353;
ll mod3=1000003;
ll mod4=998244853;
ll inf=1000000000000000000;
double pi=2*acos(0);
#define rep(i,m,n) for(ll i=m;i<n;i++)
#define rrep(i,n,m) for(ll i=n;i>=m;i--)
int dh[4]={1,-1,0,0};
int dw[4]={0,0,1,-1};
int ddh[8]={-1,-1,-1,0,0,1,1,1};
int ddw[8]={-1,0,1,-1,1,-1,0,1};
ll lmax(ll a,ll b){
    if(a<b)return b;
    else return a;
}
ll lmin(ll a,ll b){
    if(a<b)return a;
    else return b;
}
ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(a%b==0)return b;
    return gcd(b,a%b);
}
ll Pow(ll n,ll k){
    ll ret=1;
    ll now=n;
    while(k>0){
        if(k&1)ret*=now;
        now*=now;
        k/=2;
    }
    return ret;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;cin>>s;
    int c=0;
    rep(i,0,s.size()){
        if(i%2==0){
            if(s[i]=='L'){
                c=1;
                break;
            }
        }
        else{
            if(s[i]=='R'){
                c=1;
                break;
            }
        }
    }
    if(c)cout<<"No"<<endl;
    else cout<<"Yes"<<endl;
}


Measured memory_bytes: 256