akhauriyash/Code-Regression huggingface dataset:
import copy

n = int(input())
x = list(map(int,input().split()))
key = {}
base = copy.deepcopy(x)
base.sort()

for i in range(n):

  if n//2 > i:
    ans = base[n//2]
  elif n//2 <= i:
    ans = base[n//2-1]
   
  if not ("key" + str(base[i]) in key):
    key["key" + str(base[i])] = ans
    
for i in range(n):
  print(key["key" + str(x[i])])

Measured memory_bytes: 46632
#include<cstdio>
#include<iostream>
#include<cstring>
#define MAXN 100+10
using namespace std;
inline int read(){
    int out=0;
    char c=getchar();
    while(c<48||c>57) c=getchar();
    while(c<=57&&c>=48){
        out=(out<<1)+(out<<3)+c-48;
        c=getchar();
    }
    return out;
}
inline void write(int x){
    if(x>9) write(x/10);
    putchar(x%10+48);
}
int a[MAXN];
int b[MAXN];
int n;
int sum=0;
int main(){
    n=read();
    for(int i=1;i<=n;++i){
        a[i]=read();
        sum+=a[i];
    }
    int m=read();
    for(int i=1;i<=m;++i){
        int x=read();
        int y=read();
        int ans=sum;
        ans-=a[x];
        ans+=y;
        write(ans);
        putchar(10);
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <utility>
#include <vector>
#include <queue>
#include <functional>
#include <cassert>
#include <algorithm>

using namespace std;

const int INF = 1e7 + 10;


class Dijkstra {
#define MAX_V 101
  typedef pair<int, int> P;

private:
  struct Edge {
    int to, cost;
    Edge(int to, int cost): to(to), cost(cost) { }
  };

  int V;
  vector<Edge> G[MAX_V];
  int prev[MAX_V];

public:

  Dijkstra(int V): V(V) { 
    if (V >= MAX_V) {
      assert(false);
    }
  }

  void AddEdge(int from, int to, int cost) {
    G[from].push_back(Edge(to, cost));
  }

  vector<int> Solve(int s) {
    priority_queue<P, vector<P>, greater<P>> que;
    vector<int> d(V, INF);
    d[s] = 0;
    que.push(P(0, s));
    fill(prev, prev + V, -1);

    while (!que.empty()) {
      P p = que.top(); que.pop();
      int v = p.second;
      if (d[v] < p.first) {
        continue;
      }
      for (int i = 0; i < G[v].size(); i++) {
        Edge e = G[v][i];
        if (d[e.to] > d[v] + e.cost) {
          d[e.to] = d[v] + e.cost;
          que.push(P(d[e.to], e.to));
          prev[e.to] = v;
        }
      }
    }

    return d;
  }

  vector<int> GetPath(int t) {
    vector<int> path;
    for (; t != -1; t = prev[t]) {
      path.push_back(t);
    }
    reverse(path.begin(), path.end());
    return path;
  }
};

int main() {
  while (true) {
    int n, m, s, g1, g2;
    cin >> n >> m >> s >> g1 >> g2;
    if (n + m + s + g1 + g2 == 0) {
      break;
    }
    s--; g1--; g2--;
    Dijkstra dijkstra(n);
    for (int i = 0; i < m; i++) {
      int b1, b2, c;
      cin >> b1 >> b2 >> c;
      b1--; b2--;
      dijkstra.AddEdge(b1, b2, c);
    }


    int ans = INF;
    vector<int> sd = dijkstra.Solve(s);
    for (int i = 0; i < n; i++) {
      vector<int> d = dijkstra.Solve(i);
      ans = min(ans, sd[i] + d[g1] + d[g2]);
    }
    cout << ans << endl;
  }

  return 0;
}

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

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  bool poor = false;
  if (a == b && a != c) poor = true;
  if (b == c && b != a) poor = true;
  if (c == a && c != b) poor = true;
  if (poor) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3600
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a,x) for (auto& a : x)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert

template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const int MOD = 1000000007;
const char nl = '\n';
const int MX = 100001; //check the limits, dummy
 
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);    
	
    int N; cin >> N;
    ll A[N]; F0R(i, N) cin >> A[i];

    ll all = 0; F0R(i, N) all ^= A[i];

    F0R(i, N) {
        cout << (all ^ A[i]) << " ";
    }
    cout << nl;
	
	return 0;
}
 
// read the question correctly (ll vs int)
// template by bqi343


Measured memory_bytes: 5164
#include<algorithm>
#include<iostream>
#include<functional>
#include<cmath>
#include<iomanip>
using namespace std;
int main(){
  long int a,b;
  cin>>a>>b;
  if(a%b==0 or b==1)
    cout<<-1<<endl;
  else
    cout<<a*(b+1)<<endl;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.buffer.readline

H, W = map(int, input().split())
C = [list(map(int, input().split())) for _ in range(10)]
A = [list(map(int, input().split())) for _ in range(H)]

for k in range(10):
    for i in range(10):
        for j in range(10):
            C[i][j] = min(C[i][j], C[i][k] + C[k][j])

answer = 0
for a in A:
    for aa in a:
        if aa != -1:
            answer += C[aa][1]

print(answer)

Measured memory_bytes: 3316
#include<stdio.h>
#include<string.h>
#define N 100005

typedef struct pp{
  char name[100];
  int t;
}P;

P Q[N+1];
int head,tail,n;

void enqueue(P x){
  Q[tail]=x;
  tail=(tail+1)%N;
}

P dequeue(){
  P x =Q[head];
  head = (head+1)%N;
  return x;
}

int min(int x,int y){return x<y ?x:y;}

int main(){
  int elaps = 0,c;
  int i,q;
  P u;
  scanf("%d %d",&n,&q);

  for(i=1;i<=n;i++){
    scanf("%s",Q[i].name);
    scanf("%d",&Q[i].t);
  }
  head =1;tail=n+1;

  while(head!=tail){
    u=dequeue();
    c=min(q,u.t);
    u.t-=c;
    elaps+=c;
    if(u.t>0)enqueue(u);
    else{
      printf("%s %d\n",u.name,elaps);
    }
  }
  
  return 0;
}



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

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

  for (int i=0; i<S.size(); i++){
    if ((i % 2 == 1 && S[i] == 'R') || (i % 2 == 0 && S[i] == 'L')){
      cout << "No" << endl;
      return 0;
    }
  }

  cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair< ll, ll > Pi;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
const ll INF = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}
#define all(x) x.begin(), x.end()
#define mp make_pair
bool compare(Pi a, Pi b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}


bool In_map(ll y,ll x,ll h,ll w){
    if(y<0 || x<0 || y>=h || x>=w){
        return 0;
    }else{
        return 1;
    }
}
const vector<ll> dx{1,0,-1,0};
const vector<ll> dy{0,1,0,-1};

const int MAX = 100;
#define MOD 10000000

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
ll combination(ll n, ll r) {
  if ( r * 2 > n ) r = n - r;
  ll dividend = 1;
  ll divisor  = 1;
  vector<bool>flag(r+1);
  for ( ll i = 1; i <= r; ++i ) {
    dividend *= (n-i+1);
    if(dividend)
    //divisor  *= i;
    rep2(j,r){
        if(dividend%j==0 && flag[j]==0){
            dividend/=j;
            flag[j]=1;
        }
    }
  }
  return dividend;
}
int main() {
    COMinit();
    ll N,A,B;
    cin >>N>>A>>B;

    vector<ll>v(N);
    rep(i,N){
        cin>>v[i];
    }

    sort(all(v),greater<ll>());
    double ans1=0;
    vector<ll>mx(A);
    vector<ll>res(N-A);
    rep(i,A){
        mx[i]=v[i];
        ans1+=v[i];
    }
    rep(i,N-A){
        res[i]=v[A+i];
    }
    ll mn=mx[A-1];
    ll cnt1=0;
    rep(i,A){
        if(mx[i]==mn){
            cnt1++;
        }
    }
    ll cnt2=0;
    rep(i,N-A){
        if(res[i]==mn){
            cnt2++;
        }
    }
    //cout<<combination(50,1)<<endl;
    //cout<<cnt1<<" "<<cnt2<<endl;
    ll ans=0;
    if(cnt1==A){
        for(ll i=A;i<=min(B,cnt1+cnt2);i++){
            ans+=combination(cnt1+cnt2,i);
            //cout<<i<<endl;
            //cout<<combination(cnt1+cnt2,i)<<endl;
        }
    }else{
        ans=combination(cnt1+cnt2,cnt1);
    }
    cout << fixed << setprecision(15) << ans1/double(A) << endl;

    cout << ans << endl;

    return 0;
    

}

Measured memory_bytes: 3788
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N;
    cin >> N;
    vector<vector<int>> A(N, vector<int>(2));
    for(int i = 0; i < N; i++){
        cin >> A.at(i).at(0) >> A.at(i).at(1); 
    }
    bool ans = 0;
    for(int i = 0; i < N - 2; i++){
        if(A.at(i).at(0) == A.at(i).at(1) && A.at(i + 1).at(0) == A.at(i + 1).at(1) && A.at(i + 2).at(0) == A.at(i + 2).at(1)){
            ans = 1;
            break;
        }
    }
    if(ans){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 3616
#include<bits/stdc++.h>
#define vll vector<ll>
#define vi vector<int>
#define vpll vector<pair<ll,ll>>
#define pii pair<int,int>
#define REP(i,a) for(int (i)=0; (i)<(a); (i)++)
#define RREP(i,a) for(int (i)=a-1; (i)>=(0); (i)--)
#define REP2(i,a,b) for(int (i)=(a); (i)<(b); (i)++)
#define MOD 1000000007
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define m0(x) memset(x,0,sizeof(x))
typedef long long ll;

using namespace std;

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  string S; cin >> S;
  int N = S.size();
  vector<int> H;
  vector<int> ans(N,0);
  REP2(i,1,N) if(S[i-1] == 'R' && S[i] == 'L') H.push_back(i);
  for(int itr = 0; itr < H.size(); itr++){
    int left = H[itr] - 1;
    int right = H[itr];
    while(1){
      if(left - 1 >= 0 && S[left - 1] == 'R') left--;
      else break;
    }
    while(1){
      if(right + 1 < N && S[right + 1] == 'L') right++;
      else break;
    }
    //cout << left << "->" << H[itr] << "<-" << right << endl;
    for(int j = left; j <= right; j++){
     	 ans[H[itr] - abs(((H[itr] - j)%2))]++;
    }
  }
  
  REP(i,N) cout << ans[i] << " ";

  return 0;
}

Measured memory_bytes: 1232
#include<bits/stdc++.h>
using namespace std;
const double pi=acos(-1.0);
const int dx[]={0,1,0,-1};
const int dy[]={1,0,-1,0};
#define ll long long
#define inf int(2e5+7)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define l(s) s.size()
using namespace std;
int n,a[inf];
inline bool check(const int k)
{
    if((a[n-1]<=k&&a[n]<=k)||(a[n]<=k&&a[n+1]<=k))
		return 1;
    if((a[n-1]>k&&a[n]>k)||(a[n]> k&&a[n+1]> k))
		return 0;
    for(int i=1;i<n-1;i++){
        if((a[n+i]<=k&&a[n+i+1]<=k)||(a[n-i]<=k&&a[n-i-1]<=k))
			return 1;
        if((a[n+i]>k&&a[n+i+1]>k)||(a[n-i]>k&&a[n-i-1]>k))
			return 0;
    }
    return a[1]<=k;
}
int main()
{
    scanf("%d",&n);
    for(int i=1;i<n<<1;i++)
		scanf("%d",a+i);
    int l=1,r=(n<<1)-1;
    while(l<r){
        int mid=l+r>>1;
        if(check(mid))
			r=mid;
        else
			l=mid+1;
    }
    printf("%d",l);
    return 0;
}

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

X, Y = mapint()
if X*4-Y>=0 and X*2-Y<=0 and (X*4-Y)%2==0:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 9172
M=int(input())
N=list(input().split())
check=[0]*M
for i in range(M):
    check[int(N[i])-1]+=1
num=0
for i in range(M):
    num+=check[i]*(check[i]-1)//2
for i in range(M):
    #if check[int(N[i])-1]!=2:
    print(num-(check[int(N[i])-1]-1))
    #else:
       # print(num-1)

Measured memory_bytes: 20992
#define _CRT_SECURE_NO_WARNINGS
#include"bits/stdc++.h"
#ifdef _DEBUG
#define DBG(n) n
#else
#define DBG(n)
#endif
#define INF          1e9
#define INFLL        1e18
#define EPS          1e-9
#define MOD          1000000007
#define REP(i,n)     for(ll i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n)    for(ll i=1,i##_len=(n);i<=i##_len;++i)
#define REPR(i,n)    for(ll i=(n)-1;i>=0;--i)
#define REPR1(i,n)   for(ll i=(n);i>0;--i)
#define REPC(i,obj)  for(auto i:obj)
#define ALL(obj)     (obj).begin(),(obj).end()
#define SETP(n)      cout<<fixed<<setprecision(n)
#define VV(T,h,w)    move(vector<vector<T>>(h,move(vector<T>(w))))
#define VVI(T,h,w,i) move(vector<vector<T>>(h,move(vector<T>(w,i))))
using namespace std;
using ll = long long;
template<typename T = ll>inline T in() { T ret; cin >> ret; return ret; }

int main()
{
	char b; cin >> b;
	cout << (
		b == 'A' ? 'T'
		: b == 'C' ? 'G'
		: b == 'T' ? 'A'
		: 'C'
		) << endl;
}

Measured memory_bytes: 256
let main: () = {
    let N = nextInt()
    let A = listOfInt().enumerated().map { ($0.1, $0.0) }.sorted { $0.0 > $1.0 }
    var dp = Array(N + 2) { _ in Array(N + 2) { _ in -1001001009 } }
    dp[0][0] = 0
    repeate(N) { t in
        let (cost, n) = A[t]
        repeate(t + 1) { l in
            if dp[t][l] >= 0 {
                chmax(&dp[t + 1][l + 1], dp[t][l] + cost * abs(n - l))
                chmax(&dp[t + 1][l], dp[t][l] + cost * abs(N - 1 - (t - l) - n))
            }
        }
    }
    var ans = 0
    repeate(N + 1) { n in chmax(&ans, dp[N][n]) }
    print(ans)
}()

@inlinable func next() -> String { readLine()! }
@inlinable func nextInt() -> Int { Int(next())! }
@inlinable func listOfString() -> [String] { next().split(separator: " ").map(String.init) }
@inlinable func listOfInt() -> [Int] { listOfString().map { Int($0)! } }
extension Array {
    init(_ size: Int, _ initValue: ((Int) -> Element)) {
        self = [Element]()
        for index in 0 ..< size {
            let value = initValue(index)
            self.append(value)
        }
    }
}
extension Array where Element == Int {
    @inlinable func sum() -> Element { self.reduce(0, +) }
    init(_ size: Int) {
        self = [Element]()
        for _ in 0 ..< size {
            self.append(0)
        }
    }
}
prefix operator *
prefix func * <T> (a: [T]) -> (T, T) { (a[0], a[1]) }

@inlinable func repeate(_ times1: Int, _ action: (Int) -> Void) {
    for index1 in 0 ..< times1 {
        action(index1)
    }
}

@inlinable func chmax<T: Comparable>(_ m: inout T, _ q: T) { if (m < q) { m = q } }
@inlinable func chmin<T: Comparable>(_ m: inout T, _ q: T) { if (q < m) { m = q } }


Measured memory_bytes: 39740
package main

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

func main() {
	sc := bufio.NewScanner(os.Stdin)
	n := scanInt(sc)

	ns := make(map[int]int, n)
	flip := []int{-1, 1}
	total := 0

	for i := 0; i < n; i++ {
		a := scanInt(sc) - 1
		ns[a] = (ns[a] + 1) % 2
		total += flip[ns[a]]
	}

	fmt.Println(total)
}

func scanInt(sc *bufio.Scanner) int {
	sc.Scan()
	v, _ := strconv.Atoi(sc.Text())
	return v
}

Measured memory_bytes: 4608
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define sz size()
#define ll long long
#define all(_v) _v.begin(), _v.end()

int main() {
    ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	string s;
	cin >> s;
	if(s[1] == 'B') s[1] = 'R';
	else s[1] = 'B';
	cout << s;
	return 0;
}


Measured memory_bytes: 3600
#include<stdio.h>
 int main()
{
	int ww,hh,l,m,x;
	scanf("%d",&hh);
	scanf("%d",&ww);
	
	scanf("%d",&l);
	scanf("%d",&m);
	/*printf("%d%d%d%d",hh,ww,l,m);*/
	printf("%d",(hh-l)*(ww-m));
}
	

Measured memory_bytes: 128
#pragma GCC optimize("Ofast", "unroll-loops")

#include <bits/stdc++.h>

using namespace std;

#define ll long long

constexpr ll mod = 1000000007LL;

ll fact(ll k, int sgn = 0) {
	static vector<ll> fac(2, 1LL);
	static vector<ll> inv(2, 1LL);
	static vector<ll> finv(2, 1LL);
	static ll nx = 2LL;
	while (nx <= k) {
		fac.push_back(fac[nx - 1] * nx % mod);
		inv.push_back(mod - inv[mod % nx] * (mod / nx) % mod);
		finv.push_back(finv[nx - 1] * inv[nx] % mod);
		++nx;
	}
	if (sgn == 0)
		return fac[k];
	return finv[k];
}

ll comb(ll a, ll b) {
	if (b < 0 || b > a) return 0;
	return fact(a) * fact(b, 1) % mod * fact(a - b, 1) % mod;
}


int main(void){
    int N, M, K; cin >> N >> M >> K;
    ll tmp1 = 0;
    for (ll x = 0; x < N; ++x){
        tmp1 += (x * (x - N) % mod - ((x + N - 1) * (x - N)) / 2 % mod + mod) % mod;
        tmp1 %= mod;
    }
    ll tmp2 = 0;
    for (ll y = 0; y < M; ++y){
        tmp2 += (y * (y - M) % mod - ((y + M - 1) * (y - M)) / 2 % mod + mod) % mod;
        tmp2 %= mod;
    }
    ll res = (ll)M * M % mod * tmp1 % mod + (ll)N * N % mod * tmp2 % mod;
    res %= mod;
    res = res * comb(N * M - 2, K - 2) % mod;
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 5204
#include<bits/stdc++.h>
#define M 1000000007
#define pb push_back
#define ll long long int
using namespace std;

ll binexp(ll x)
{
	ll res = 1;
	ll y = M-2;
	while(y!=0)
	{
		if(y&1)
		{
			res *= x;
			res %=M;
		}
		x *=x;
		x%=M;
		y=(y>>1);
	}
	return res;
}

int main()
{
	int h,w;
	cin>>h>>w;
	string s[h];
	int i,j;
	for(i = 0;i<h;i++)
		cin>>s[i];
	ll dp[h][w];
	dp[h-1][w-1] = 1;
	for(i=h-1;i>=0;i--)
	{
		for(j=w-1;j>=0;j--)
		{
			if(i==h-1 && j==w-1)
				continue;
			if(s[i][j]=='#')
				dp[i][j] = 0;
			else
			{
				dp[i][j] = 0;
				int x,y;
				x = i+1, y = j;
				if(x<h)
				{
					dp[i][j] += dp[x][y];
					dp[i][j] %= M;
				}
				x = i,y = j+1;
				if(y<w)
				{
					dp[i][j] += dp[x][y];
					dp[i][j] %= M;
				}
			}			
		}
	}
	cout<<dp[0][0];
	return 0;
}


Measured memory_bytes: 13280
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC86_2
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split(' ');
            string s = str[0] + str[1];
            int c = int.Parse(s);
            Double d = Math.Sqrt(c);
            if(d % 1 != 0)
            {
                Console.WriteLine("No");

            }
            else
            {
                Console.WriteLine("Yes");
            }
        }
    }
}


Measured memory_bytes: 13140
#include<bits/stdc++.h>
#define ALL(v) std::begin(v),std::end(v)
using lint=long long;
using ld=long double;
template<class T>using numr=std::numeric_limits<T>;
int main(){
    std::cin.tie(nullptr);std::ios_base::sync_with_stdio(false);
    std::cout.setf(std::ios_base::fixed);std::cout.precision(15);
    lint n,q;std::cin>>n>>q;
    std::vector<lint>ans(q);
    std::vector<std::pair<lint,lint>>edges(q);
    for(lint i=0;i<q;i++){
        lint u,v;std::cin>>u>>v;u--,v--;
        edges.at(i)={u,v};
    }
    std::vector<lint>p(n,-1);
    auto find=[&](auto&&f,lint i)->lint{return p.at(i)<0?i:p.at(i)=f(f,p.at(i));};
    lint now=n*(n-1)/2;
    for(lint i=q-1;i>=0;i--){
        ans.at(i)=now;
        lint u,v;std::tie(u,v)=edges.at(i);
        u=find(find,u),v=find(find,v);
        if(u==v){
            ans.at(i)=now;
            continue;
        }
        now-=p.at(u)*p.at(v);
        p.at(u)+=p.at(v);
        p.at(v)=u;
    }
    for(lint i=0;i<q;i++){
        std::cout<<ans.at(i)<<'\n';
    }
}


Measured memory_bytes: 4480
#include<bits/stdc++.h>
using namespace std;
void solve(){
	long long a,b,c,d,x,y;
	cin>>a>>b>>c>>d;
	x=max(b*d,a*c);
	y=max(a*d,b*c);
	cout<<max(x,y);
}
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	solve();
 
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
int n, a[100020], b[100020];
long long z;
int main() {
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d%d", &a[i], &b[i]);
	}
	sort(a, a + n + 1);
	sort(b, b + n + 1);
	for (int i = 0; i <= n; i++) {
		z += max(0, a[i] - b[n - i]);
	}
	printf("%lld\n", z * 2);
	return 0;
}

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

int main() {
    int N;
    cin >> N;
    int a[] = {4, 7};
    vector<bool> dp(120, false);
    dp[0] = true;
    for (int i = 0; i <= 100; i++) {
        if (!dp[i]) continue;
        for (int j = 0; j < 2; j++) {
            dp[i + a[j]] = true;
        }
    }
    cout << (dp[N] ? "Yes" : "No") << endl;
}

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


#define vt vector
#define all(c) (c).begin(), (c).end()
#define sz(x) (int)(x).size()
#define ll long long
#define ld long double
#define ar array
#define inf() ifstream cin("d.txt")
#define onf() ofstream cout("test.txt")
#define mod 1000000007
#define pb push_back
#define endl cout<<"\n";
#define prt1(a) cout<<a<<" "
#define prt2(a,b) cout<<a<<" "<<b<<" "
#define prt3(a,b,c) cout<<a<<" "<<b<<" "<<c<<" "
#define in(a) cin>>a
#define inn(a,b) cin>>a>>b
#define innn(a,b,c) cin>>a>>b>>c 
#define rep(i,st,end) for(int i=st;i<end;i++)
#define repv(i,st,end) for( i=st;i>=end;i--)
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define TEST ll tc;cin>>tc;while(tc--)
#define EACH(x, a) for (auto& x: a)

template<class A> void read(vt<A>& v);
template<class A, size_t S> void read(ar<A, S>& a);
template<class T> void read(T& x) {
    cin >> x;
}
void read(double& d) {
    string t;
    read(t);
    d=stod(t);
}
void read(long double& d) {
    string t;
    read(t);
    d=stold(t);
}
template<class H, class... T> void read(H& h, T&... t) {
    read(h);
    read(t...);
}
template<class A> void read(vt<A>& x) {
    EACH(a, x)
        read(a);
}
template<class A, size_t S> void read(array<A, S>& x) {
    EACH(a, x)
        read(a);
}
#define debug(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a <<"\n";
    err(++it, args...);
}


void solve()
{
  ll d,t,s;
  read(d,t,s);
  ll di = s*t ;
  if(di>=d)
    cout<<"Yes";
  else
    cout<<"No";
}

 int main()
 {
    fio;
    ll k = 1;
    ll tc = 1;
    // cin>>tc;
    while(tc--){
       // cout<<"Case #"<<k<<": ";k++;
        solve();
        endl;
    }
    
 }




Measured memory_bytes: 3664
s = input()

s_list = list(s)

ans = 'No'

index3 = s_list[2]
index4 = s_list[3]
index5 = s_list[4]
index6 = s_list[5]

if index3 == index4 and index5 == index6 :
    ans = 'Yes'

print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
int n,m,q;
vector <int> a,b,c,d;
int ans;
void dfs(vector <int> A)
{
	if(A.size()==n+1)
	{
		int now=0;
		for(int i=0;i<q;i++)
		{
			if(A[b[i]]-A[a[i]]==c[i])
			now+=d[i];
		} 
		ans=max(ans,now);
		return;
	}
	A.push_back(A.back());
	while(A.back()<=m)
	{
		dfs(A);
		A.back()++;
	}
}
int main()
{
	cin>>n>>m>>q;
	a=b=c=d=vector<int>(q);
	for(int i=0;i<q;i++)
	{
		cin>>a[i]>>b[i]>>c[i]>>d[i];
	}
	dfs(vector<int>(1,1));
	cout<<ans<<" ";
	return 0;
}


Measured memory_bytes: 3584
#include <iostream>
#include <vector>
#include <cassert>
#include <algorithm>

using ll = long long;

#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#define MAX(a, b) (((a) < (b)) ? (b) : (a))

int const nmax = 5000;

int dp[5 + nmax][5 + nmax];

int main() {
  int n, modulo;
  std::cin >> n >> modulo;
  std::vector<int> v;
  dp[0][0] = 1;
  for(int i = 1; i < (n + 1) / 2; i++) {
    v.push_back(i);
    v.push_back(i - 1);
  }
  if(n % 2 == 0)
    v.push_back(n / 2 - 1);
  std::sort(v.begin(), v.end());
  std::reverse(v.begin(), v.end());

  for(int i = 0; i < v.size(); i++) {
    int lim = n;
    if(0 < v[i])
      lim = n / v[i];
    for(int j = 1; j <= lim; j++)
      for(int h = j * v[i]; h <= n; h++) {
        dp[j][h] += dp[j - 1][h - v[i]];
        if(modulo <= dp[j][h])
          dp[j][h] -= modulo;
      }
  }
  int result = 0;
  for(int i = 0; i < n; i++)
    for(int j = 0; j <= n; j++){
      if(j + 1 <= n - i) {
        result += 1LL * dp[i][j] * ((n - i) - j) % modulo;
        if(modulo <= result)
          result -= modulo;
      }
    }
  std::cout << result;
}




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

long long md(pair<long long,long long> x,pair<long long,long long> y){
    return max(x.first,y.first)-min(x.first,y.first)+max(x.second,y.second)-min(x.second,y.second);
}

int GCD(int x,int y){
    int temp;
    if(x<y){
        temp=x,x=y,y=temp;
    }
    if(y<1){
        return -1;
    }
    if(x%y==0){
        return y;
    }
    return GCD(x,x%y);
}

int main(){
    int N,flag=1;
    cin >> N;
    string S;
    cin >> S;
    if(N%2==1)
    flag=0;
    for(int i=0;i<N/2;i++){
        if(S[i]!=S[i+N/2])
        flag=0;
    }
    if(flag)
    cout << "Yes" << endl;
    else
    cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<n; ++i)
#define rep1(i, n) for (int i=1; i<=n; ++i)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
constexpr ll  MOD = (1e9+7);
constexpr int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
constexpr int lcm(int a, int b) { return a / gcd(a, b) * b; }

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 factorial(ll n, ll m=2) {
    // calculate n!
    m = max(2LL, m);
    ll rtn = 1;
    for (ll i=m; i<=n; i++) {
        rtn = (rtn * i) % MOD;
    }
    return rtn;
}
ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b;
        swap(a, b);
        u -= t * v;
        swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
ll modpow(ll a, ll n) {
    ll res = 1;
    while (n > 0) {
        if (n & 1)
            res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    set<string> st;
    rep(i, n) {
        string tmp; cin >> tmp;
        st.insert(tmp);
    }
    cout << (int)st.size() << endl;
    return 0;
}

Measured memory_bytes: 19196
N,A,B = gets.split(" ").map{|v|
	v.to_i
}
 
ar = gets.split(" ").map{|v|
	v.to_i
}
 
# 貪欲 上位A個を取る A個目とA+1個目が異なるなら1通り
ar.sort!.reverse!
sum = ar[0 .. A-1].inject{|s, v|
	s + v
}
ave = sum.to_f/ A 
puts ave

if ar[A-1] != ar[A] then
	puts 1
	exit
end
 
n0 = ar.select{|x| x == ar[A-1]}.length
nb = ar.select{|x| x > ar[A-1]}.length
 
def fac(i)
	return (1 .. i).inject(1) { |sum, j| sum * j }
end
 
 
# 上位A個が異なる値ならば
if ave != ar[0]
	# n0 C (A-nb)
	puts fac(n0) / (fac(A-nb) * fac(n0-A+nb))
else
	#上位A個が全て同じ→A+1個以上取っても良い
	m = [n0, B].min
	
	sum = 0
	A.upto(m) do |i|
		sum += fac(n0) / (fac(i) * fac(n0-i))
	end
	puts sum
end


Measured memory_bytes: 1788
using System;

namespace ITP1_7_B
{
    class Program
    {
        static void Main()
        {
            for (; ; )
            {
                string[] data = Console.ReadLine().Split(' ');
                int n = int.Parse(data[0]);
                int x = int.Parse(data[1]);
                int cnt = 0;

                if (n == 0 && x == 0) break;

                for (int i = 1; i <= n - 2; i++)
                {
                    for (int j = i + 1; j <= n - 1; j++)
                    {
                        for (int k = j + 1; k <= n; k++)
                        {
                            if (i + j + k == x) cnt++;
                        }
                    }
                }
                Console.WriteLine(cnt);
            }
        }
    }
}

Measured memory_bytes: 9208
// This amazing code is by Eric Sunli Chen.
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <vector>
using namespace std;
template<typename T> void get_int(T &x)
{
	char t=getchar();
	bool neg=false;
	x=0;
	for(; (t>'9'||t<'0')&&t!='-'; t=getchar());
	if(t=='-')neg=true,t=getchar();
	for(; t<='9'&&t>='0'; t=getchar())x=x*10+t-'0';
	if(neg)x=-x;
}
template<typename T> void print_int(T x)
{
	if(x<0)putchar('-'),x=-x;
	short a[20]= {},sz=0;
	while(x>0)a[sz++]=x%10,x/=10;
	if(sz==0)putchar('0');
	for(int i=sz-1; i>=0; i--)putchar('0'+a[i]);
}
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define get1(a) get_int(a)
#define get2(a,b) get1(a),get1(b)
#define get3(a,b,c) get1(a),get2(b,c)
#define printendl(a) print_int(a),puts("")
typedef long long LL;
typedef unsigned long long uLL;
typedef pair<int,int> pii;
const int inf=0x3f3f3f3f;
const LL Linf=1ll<<61;
const double pi=acos(-1.0);

const int mod=1e9+7;

void add(int&x,int y){x+=y;if(x>=mod)x-=mod;}

int n,c,a[411],b[411];
int dp[411][411],sum[411][411];
int main()
{
	for(int i=1;i<411;i++)
	{
		sum[i][0]=1;
		for(int j=1;j<411;j++)sum[i][j]=1ll*sum[i][j-1]*i%mod;
		for(int j=0;j<411;j++)sum[i][j]=(sum[i][j]+sum[i-1][j])%mod;
	}
	get2(n,c);
	for(int i=1;i<=n;i++)get1(a[i]);for(int i=1;i<=n;i++)get1(b[i]);
	
	dp[1][0]=1;
	for(int i=1;i<=n+1;i++)
	{
		for(int j=0;j<=c;j++)
		{
			if(dp[i][j]==0)continue;
			for(int nxt=0;nxt<=c-j;nxt++)
				add(dp[i+1][j+nxt],1ll*dp[i][j]*(sum[b[i]][nxt]-sum[a[i]-1][nxt]+mod)%mod);
//			printf("dp %d %d = %d\n",i,j,dp[i][j]);
		}
	}
	printendl(dp[n+1][c]);
	return 0;
}

Measured memory_bytes: 1536
L,R = map(int,input().split())

indexs = []
for index in range(L,min(R+1,L+2019)):
	indexs.append(index%2019)
	
#print(indexs)
	
indexs = sorted(indexs)

#print(indexs)

anss = []
for i in indexs:
	for j in indexs:
		if i >= j:
			continue
		
		anss.append((i*j)%2019)
	
#print(anss)
print(min(anss))

Measured memory_bytes: 99832
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] pos = new int[N];
    for (int i = 0; i < N; i++) {
      int P = sc.nextInt();
      P--;
      pos[P] = i;
    }
    
    int len = 1;
    int lenMax = 1;
    for (int i = 1; i < N; i++) {
      if (pos[i-1] < pos[i]) {
        len++;
        lenMax = Math.max(lenMax, len);
      } else {
        len = 1;
      }
    }
    
    System.out.println(N-lenMax);
  }
}


Measured memory_bytes: 65564
#include <algorithm>
#include <boost/optional.hpp>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iostream>
#include <limits>
#include <list>
#include <numeric>
#include <queue>
#include <sstream>
#include <string>
#include <tuple>
#include <type_traits>
#include <utility>
#include <vector>

#define REP(i, n) for(int i = 0, i##_MACRO = (n); i < i##_MACRO; i++)
#define RANGE(i, a, b) for(int i = (a), i##_MACRO = (b); i < i##_MACRO; i++)
#define EACH(e, a) for(auto&& e : a)
#define ALL(a) (a).begin(), (a).end()
#define AALL(a, n) (a), ((a) + (n))
#define FILL(a, n) memset((a), n, sizeof(a))
#define FILLZ(a) FILL(a, 0)
#define MODNUM (static_cast<int>(1e9 + 7))
#define MOD(x) ((x) % MODNUM)

using namespace std;

using ll = long long;
using VI = vector<int>;
using VI2D = vector<vector<int>>;

const int INF = 2e9;
const double EPS = 1e-10;
const double PI = acos(-1.0);

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

template <typename T>
int sign(T x) {
	return x < 0 ? -1 : x > 0 ? 1 : 0;
}

template <>
int sign(double x) {
	return x < -EPS ? -1 : x > EPS ? 1 : 0;
}

template <typename T>
T square(T x) {
	return x * x;
}

inline int toInt(string s) {
	int v;
	istringstream sin(s);
	sin >> v;
	return v;
}

int n;
VI a;
VI2D x;
VI2D y;

bool check(int set) {
	REP(i, n) {
		REP(j, x[i].size()) {
			if(set & (1 << i)) {
				if(y[i][j] == 1 && !(set & (1 << (x[i][j] - 1)))) {
					//					printf("y[i][j] == 1\n(1 << (x[i][j] - 1)):
					//%d\n", 						   (1 << (x[i][j] - 1)));
					return false;
				} else if(y[i][j] == 0 && (set & (1 << (x[i][j] - 1)))) {
					//					printf("y[i][j] == 0\n(1 << (x[i][j] - 1)):
					//%d\n", 						   (1 << (x[i][j] - 1)));
					return false;
				}
			}
		}
	}
	return true;
}

int main() {
	scanf("%d", &n);
	a.resize(n);
	x.resize(n);
	y.resize(n);

	REP(i, n) {
		scanf("%d", &a[i]);
		REP(j, a[i]) {
			int xx, yy;
			scanf("%d %d", &xx, &yy);
			x[i].push_back(xx);
			y[i].push_back(yy);
		}
	}

	int result = 0;
	int honest_set = 0;
	while(honest_set < (1 << n)) {
		if(check(honest_set)) {
			result = max(result, __builtin_popcount(honest_set));
			//			printf("popcount: %d\n",
			//__builtin_popcount(honest_set));
		}
		//		printf("set: %d\n", honest_set);
		honest_set++;
	}
	printf("%d\n", result);
	return 0;
}

Measured memory_bytes: 256
#include<iostream>

int n,m,l,r,ml=-1,mr=1000000;

int main(){

    std::cin>>n>>m;

    for(int i=0;i<m;i++){
        std::cin>>l>>r;
        if(ml<l)ml=l;
        if(r<mr)mr=r;
    }

    if(ml>mr)std::cout<<0<<std::endl;
    else std::cout<<mr-ml+1<<std::endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
  int n, a, b, c, d, sum, count;

  while (scanf("%d", &n) != EOF) {
    sum = 0; count = 0;
    for (a = 0; a < 10; a++) {
      for (b = 0; b < 10; b++) {
        for (c = 0; c < 10; c++) {
          for (d = 0; d < 10; d++) {
            sum = a + b + c + d;
            if (sum == n) count++;
          }
        }
      }
    }

    printf("%d\n", count);
  }

  return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define ll unsigned long long
using namespace std;
int main(){
    string S;
    cin>>S;
    if(S[0]==S[1]&&S[1]==S[2])cout<<"No"<<endl;
    else cout<<"Yes"<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cctype>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <iomanip>
#include <bitset>
#include <vector>
#define REP(i, n) for(int i = 0; i < (n); ++i)
typedef long long ll;
const ll MOD = 1e9+7;
using namespace std;

int main(){
    int x; cin >> x;
    cout << (x<1200 ? "ABC" : "ARC") << endl;
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <vector>
#include <tuple>

using namespace std;

using ll = long long;

ll xor_to(ll stop)
{
  switch (stop&3) {
  case 0:
    return stop;
    break;
  case 1:
    return 1;
    break;
  case 2:
    return stop^1;
    break;
  case 3:
    return 0;
  }
  return 0;
}

int main()
{
  ll l, r;
  scanf("%lld %lld", &l, &r);
  if (l==0) l=1;
  printf("%lld\n", xor_to(r)^xor_to(l-1));
  return 0;
}


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

public class SimpleCalculator
{
    //???????????????????????????????¨??????????
    static void Main(string[] args)
    {
        /*---??£?¨???¨---*/
        List<string> dataSetList = new List<string>();
        string[] dataSplit; //????????????????????????????????????
        int i = 0;
        int leftNum;
        int rightNum;
        /*---??£?¨???¨---*/

        /*???????????????????????????(A op B???op??¨???????????????????)*/
        while (true){
            dataSetList.Add(Console.ReadLine());
            dataSplit = dataSetList[i].Split(' ');
            if (dataSplit[1] == "?"){
                break;
            }
            i++;
        }

        /*----?¨??????¨???????????¨----*/
        for (i = 0; i < dataSetList.Count-1; i++){
            dataSplit = dataSetList[i].Split(' ');
            leftNum = int.Parse(dataSplit[0]);
            rightNum = int.Parse(dataSplit[2]);

            switch (dataSplit[1]){
                case "+":
                    Console.WriteLine(leftNum + rightNum);
                    break;
                case "-":
                    Console.WriteLine(leftNum - rightNum);
                    break;
                case "*":
                    Console.WriteLine(leftNum * rightNum);
                    break;
                case "/":
                    Console.WriteLine(leftNum / rightNum);
                    break;
            }
        }
        /*----?¨??????¨???????????¨----*/
    }
}

Measured memory_bytes: 9192
# ABC106-C

import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  #空白なし

S = LI2()
K = I()

for i in range(K):
    if S[i] != 1:
        print(S[i])
        break
    elif i == K-1 and S[i] == 1:
        print(1)


Measured memory_bytes: 61872
def solve(h,w)
  (1..h/2).each.map{|i|
    hh = h-i
    s1 = [i*w, w*(hh/2), w*(hh-hh/2)].minmax
    s2 = [i*w, hh*(w/2), hh*(w-w/2)].minmax
    [s1[1]-s1[0], s2[1]-s2[0]].min
  }.min
end
H,W=gets.split.map &:to_i
p [solve(H,W), solve(W,H)].min


Measured memory_bytes: 4348
#include <iostream>
using namespace std;
int main() {

    int n;
    cin >> n;
    int arr[n];

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

    int second= abs(arr[1]- arr[0]);

    for(int i=2;i<n;i++){
        int s = second;
        second = min(abs(arr[i]- arr[i-1])+second , abs(arr[i]- arr[i-2]) + first);
        first = s;
    }

    // dp[2] = 20 ;
    // dp[3] =
 // 30 10 60 10 60 50
 // 0  20 (30) 20
        cout << second;
    return 0;
}


Measured memory_bytes: 3964
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
    int N,sum;
    cin >> N;
    sum = 0;
    vector<int> vec(N);
    for(int i=0;i<N;i++){
        cin >> vec[i];
    }
    for(int i=0;i<N;i++){
        for(int x = i+1;x<N;x++){
            sum += vec[i] * vec[x];
        }
    }
    cout << sum << endl;
}

Measured memory_bytes: 256
a=input()
n=len(a)
m=int(input())
ans=""
for i in range(n-1):
  if a[i]=="a":
    ans += "a"
    continue
  x=ord(a[i])-97
  if m>=26-x:
    ans += "a"
    m -= 26-x
  else:
    ans += a[i]
ans += chr((ord(a[n-1])-97+m)%26+97)
print(ans)

Measured memory_bytes: 3444
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;


namespace abc168_c
{
    class Program
    {
        static void Main(string[] args)
        {
            var A = CIn.ReadInt();
            var B = CIn.ReadInt();
            var H = CIn.ReadInt();
            var M = CIn.ReadInt();
            var x = 30 * H + 0.5 * M;
            var y = 6 * M;
            var C = x - y;
            if (C < 180)
            {
                var D = C / 180 * Math.PI;
                var E = Math.Pow(A, 2) + Math.Pow(B, 2) - 2 * A * B * Math.Cos(D);
                var ans = Math.Sqrt(E);
                Console.WriteLine(ans);
            }
            else
            {
                var F = 360 - C;
                var G = F / 180 * Math.PI;
                var I = Math.Pow(A, 2) + Math.Pow(B, 2) - 2 * A * B * Math.Cos(G);
                var ans1 = Math.Sqrt(I);
                Console.WriteLine(ans1);
            }
        }    
    }
    class CIn
    {
        private static readonly Queue<string> fieldBuffer = new Queue<string>();

        public static string Read()
        {
            if (fieldBuffer.Count == 0)
            {
                foreach (var field in Console.ReadLine().Split())
                {
                    fieldBuffer.Enqueue(field);
                }
            }

            return fieldBuffer.Dequeue();
        }

        public static int ReadInt() => int.Parse(Read());
        public static long ReadLong() => long.Parse(Read());
        public static double ReadDouble() => double.Parse(Read());

        public static string[] ReadStringArray(long n)
        {
            var array = new string[n];

            for (var i = 0; i < n; i++)
            {
                array[i] = Read();
            }

            return array;
        }

        public static int[] ReadIntArray(long n)
        {
            var array = new int[n];

            for (var i = 0; i < n; i++)
            {
                array[i] = ReadInt();
            }

            return array;
        }

        public static long[] ReadLongArray(long n)
        {
            var array = new long[n];

            for (var i = 0; i < n; i++)
            {
                array[i] = ReadLong();
            }

            return array;
        }
        public static double[] ReadDoubleArray(long n)
        {
            var array = new double[n];

            for (var i = 0; i < n; i++)
            {
                array[i] = ReadDouble();
            }

            return array;
        }
    }

}


Measured memory_bytes: 28296
#include<iostream>
using namespace std;
int main() {
	int n;
	cin >> n;
	for (int i = 1; i <= 9; i++) {
		for (int j = 1; j <= 9; j++) {
			if (i * j == n) {
				cout << "Yes" << endl;
				return 0;
			}
		}
	}
	cout << "No" << endl;
	return 0;
}

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

int n, m, a, b, road[50];

int main() {
    cin >> n >> m;
    rep(i, m) {
        cin >> a >> b;
        road[a-1]++;
        road[b-1]++;
    }
    rep(i, n) {
        cout << road[i] << endl;
    }
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
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)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

n,k,l=map(int,input().split())
uf1=UnionFind(n)
for _ in range(k):
    p,q=map(int,input().split())
    uf1.union(p-1,q-1)
uf2=UnionFind(n)
for _ in range(l):
    p,q=map(int,input().split())
    uf2.union(p-1,q-1)
from collections import defaultdict
p=defaultdict(int)
for i in range(n):
    a=uf1.find(i)
    b=uf2.find(i)
    p[(a,b)]+=1
ans=[]
for i in range(n):
    ans.append(p[uf1.find(i),uf2.find(i)])
print(*ans)


Measured memory_bytes: 102624
import collections
N, M = map(int, input().split())
H_list = list(map(int, input().split()))
W_matrix = [sorted(list(map(int, input().split())), reverse=True) for i in range(M)]
W_matrix.sort(reverse=True)
towers = []
for i in range(M):
    if H_list[W_matrix[i][0] - 1] == H_list[W_matrix[i][1] - 1]:
        towers.append(W_matrix[i][0])
        towers.append(W_matrix[i][1])
    elif H_list[W_matrix[i][0] - 1] < H_list[W_matrix[i][1] - 1]:
        towers.append(W_matrix[i][0])
    else:
        towers.append(W_matrix[i][1])
print(N - len(collections.Counter(towers)))

Measured memory_bytes: 106884
from collections import deque

import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
input = sys.stdin.readline

H, W = map(int, input().split())
Ch, Cw = map(int, input().split())
Dh, Dw = map(int, input().split())
Ch -= 1
Cw -= 1
Dh -= 1
Dw -= 1
S = [input().rstrip() for _ in [0]*H]

INF = 10**10
D = [[INF]*W for _ in [0]*H]
used = set()

q = deque()
q.append((0, Ch*W+Cw))

while q:
    d, ij = q.popleft()
    i, j = divmod(ij, W)

    for di in range(-2, 3):
        for dj in range(-2, 3):
            if di == dj == 0:
                continue
            I = i+di
            J = j+dj
            if 0 <= I < H and 0 <= J < W and S[I][J] == '.':
                if abs(di)+abs(dj) == 1:
                    if D[I][J] <= d:
                        continue
                    D[I][J] = d
                    q.appendleft((d, I*W+J))
                else:
                    if D[I][J] <= d+1:
                        continue
                    D[I][J] = d+1
                    q.append((d+1, I*W+J))
ans = D[Dh][Dw]
print(ans if ans < INF else -1)

Measured memory_bytes: 86948
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
#ifndef FAST_IO
 #define IOS ios_base::sync_with_stdio(false);cin.tie(nullptr);
#endif

#define FILE_IO freopen("input.txt","r",stdin)
#define int long long
#define f first
#define s second
#define endl '\n'
#define all(c) c.begin(),c.end()
#define bp __builtin_popcount
#define debug(x) cerr << #x << " = " << x << endl;

const int MOD = 1e9 + 7;
const int INF = 1e18;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename T>void print(T t){for(auto &it : t)cout<<it<<" ";}
inline int powerexp(int a, int b, int m = MOD){ int res = 1;while(b){if(b&1)res = res * a % m;a = a * a % m,b >>= 1;}return res % m;}
inline int modinv(int a){ return powerexp(a,MOD-2,MOD);}
inline int lcm(int a, int b){ int g = __gcd(a,b);return a/g*b;}
inline int add(int x, int y){ x += y; if (x >= MOD) x -=  MOD; return x;}
inline int mul(int x, int y){ return (x * 1ll * y) % MOD;}
inline int sub(int x, int y){ x -= y; if (x<0) x += MOD; return x ;}

//-------------------< start here >-------------------------// 

void solve(){
   string str, check;
   cin >> str >> check;
   string ret = str + str;
   if (ret.find(check) == string::npos) cout << "No" << endl;
   else cout << "Yes" << endl;
}

//-----------------------------
//comment from here for TOPCODER 
int32_t main(){
   IOS;
   solve();
   //find();
   #ifdef LOCAL_DEFINE
   cerr << "time elapsed " << (double)clock()/CLOCKS_PER_SEC << endl;
   #endif
}



Measured memory_bytes: 3228
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ok() puts(ok?"Yes":"No");
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef set<int> si;
typedef map<string, int> msi;
typedef greater<int> gt;
typedef priority_queue<int, vector<int>, gt> minq;
typedef long long ll;
const ll LINF = 1e18L + 1;
const int INF = 1e9 + 1;
//clang++ -std=c++11 -stdlib=libc++ 

int main() {
  int a,b; cin>>a>>b; cout << max(a-2*b, 0) << endl;
  return 0;
}

Measured memory_bytes: 256