akhauriyash/Code-Regression huggingface dataset:
//
// Created by yamunaku on 2019/09/15.
//

#include <bits/stdc++.h>

using namespace std;

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repl(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perl(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD9 998244353
#define MOD1 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
#define SP <<" "<<
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define CFS cin.tie(0);ios::sync_with_stdio(false)
#define CST(x) cout<<fixed<<setprecision(x)

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<int>> mti;
typedef vector<ll> vl;
typedef vector<vector<ll>> mtl;

int main(){
    int n,k,q;
    cin >> n >> k >> q;
    vector<int> a(n,0);
    rep(i,q){
        int c;
        cin >> c;
        a[c-1]++;
    }
    rep(i,n){
        if(a[i]+k-q>0) CYES;
        else CNO;
    }
    return 0;
}


Measured memory_bytes: 1024
/*
PROG: abc079a
LANG: C++
    _____
  .'     '.
 /  0   0  \
|     ^     |
|  \     /  |
 \  '---'  /
  '._____.'
*/
#include <bits/stdc++.h>
 
using namespace std;
 
long long readi()
{
	long long input = 0;
	char c = ' ';
	while (c < '-')
	{
		c = getchar();
	}
	bool negative = false;
	if (c == '-')
	{
		negative = true;
		c = getchar();
	}
	while (c >= '0')
	{
		input = 10 * input + (c - '0');
		c = getchar();
	}
	if (negative)
	{
		input = -input;
	}
	return input;
}
void printi(long long output)
{
	if (output == 0)
	{
		putchar('0');
		return;
	}
	if (output < 0)
	{
		putchar('-');
		output = -output;
	}
	int aout[20];
	int ilen = 0;
	while(output)
	{
		aout[ilen] = ((output % 10));
		output /= 10;
		ilen++;
	}
	for (int i = ilen - 1; i >= 0; i--)
	{
		putchar(aout[i] + '0');
	}
	return;
}
string reads()
{
	string input = "";
	char c = ' ';
	while (c <= ' ')
	{
		c = getchar();
	}
	while (c > ' ')
	{
		input += c;
		c = getchar();
	}
	return input;
}
void prints(string output)
{
	for (int i = 0; i < output.length(); i++)
	{		
		putchar(output[i]);
	}
	return;
}
int sgn(long long x)
{
	if (x < 0) 
	{
		return -1;
	}
	if (x > 0) 
	{
		return 1;
	}
	return 0;
}
long long randomize(long long x)
{
	return (((1ll << 31) * rand()) + rand()) % x;
}

#define MP make_pair
#define PB push_back
#define PF push_front
#define MT make_tuple
#define LB lower_bound
#define UB upper_bound
#define fi first
#define se second

#define SINF 10007
#define MOD 1000000007
#define INF 1000000861
#define LLINF 1000000000000000861ll
#define CO 1000861
#define EPS 0.000000000000001
#define PI 3.141592653589793

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

string s;
bool good;

int32_t main()
{
	ios_base::sync_with_stdio(false);
	srand(time(NULL));
	//	cout << fixed << setprecision(10);	
	//	cerr << fixed << setprecision(10);
	//	if (fopen("abc079a.in", "r"))
	//	{	
	//		freopen ("abc079a.in", "r", stdin);
	//		freopen ("abc079a.out", "w", stdout);
	//	}
	cin >> s;
	for (int i = 0; i <= 1; i++)
	{
		if (s[i] == s[i + 1] && s[i + 1] == s[i + 2])
		{
			cout << "Yes\n";
			return 0;
		}
	}
	cout << "No\n";
	return 0;

}


Measured memory_bytes: 256
#include <stdio.h>

int main() {
	int r, d, x, y, n;

	scanf("%d%d%d", &r, &d, &x);
	n = 10;
	while (n--) {
		y = r * x - d;
		printf("%d\n", y);
		x = y;
	}
	return 0;
}


Measured memory_bytes: 128
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.util.Scanner;

public class Main {

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

//    Scanner cin = new Scanner(new FileReader("input.txt"));
    Scanner cin = new Scanner(System.in);

    int a = cin.nextInt();
    int b = cin.nextInt();
    int x = cin.nextInt();
    
    System.out.println(x/a*b);

  }

}


Measured memory_bytes: 23124
import math
K,T=map(int,input().split())
A=list(map(int,input().split()))
if T==1:
    print(K-1)
else:
    half=math.ceil(K/2)
    ans=0
    for a in A:
        if a>half:
            ans+=(a-1-(K-a))
    print(ans)
    

Measured memory_bytes: 62060
# -*- coding: utf-8 -*-
from sys import setrecursionlimit
setrecursionlimit(100000)
 
def inpl(): return tuple(map(int, input().split()))
 
N, M = inpl()
graph = [[] for k in range(N)]
 
for _ in range(M):
    s, t = inpl()
    s, t = s-1, t-1
    graph[s].append(t)
    graph[t].append(s)
 
prenum = [-1] * N
lowest = [float("inf")] * N
found = [False] * N
parent = [-1] * N
 
result = set()
bridges = set()
root = 0

def DFS(i, cur, prev):
    global root
    prenum[i] = cur
    lowest[i] = cur
    found[i] = True
    parent[i] = prev 
    for p in graph[i]:
        if found[p]:
            if p != prev:
                lowest[i] = min(lowest[i], prenum[p])
        else:
            cur = DFS(p, cur+1, i)
            lowest[i] = min(lowest[i], lowest[p])
    if prenum[prev] <= lowest[i]:
        result.add(prev)    
     
    return cur
DFS(0, 1, -1)
 
if parent.count(0) <= 2:
    result = result.difference([0])

bridges = set()

for i in range(1, N):
    p = parent[i]
    if prenum[p] < lowest[i]:
        if p > i:
            p, i = i, p
        bridges.add((p, i))

print(len(bridges))

Measured memory_bytes: 3064
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
#define int long long
#ifndef FAST_IO
 #define IOS ios_base::sync_with_stdio(false),cin.tie(nullptr);
#endif
#define ff first
#define ss second
#define endl '\n'
#define all(c) c.begin(),c.end()
template<typename T>void print(T t){for(auto &it:t)cout<<it<<" "; cout<<endl;}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
void solve(){
   int a,b,c,d;
   cin>>a>>b>>c>>d;
   if(a+b>c+d)cout<<"Left"<<endl;
   else if(a+b<c+d)cout<<"Right"<<endl;
   else cout<<"Balanced"<<endl;
}
int32_t main(){
  IOS;
  solve();
  //debug();
 #ifdef LOCAL_DEFINE
 cerr<<"time elapsed "<<(double)clock()/CLOCKS_PER_SEC<<endl;
 #endif	
}


Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <queue>
#include <string>
#include <unordered_map>

int main() {
  std::unordered_map<std::string, int> ss;
  std::queue<std::pair<std::string, int>> q;
  q.push(std::make_pair("123456780", 0));
  ss["123456780"] = 0;
  while (q.size()) {
    auto p = q.front();
    q.pop();
    auto s = p.first;
    auto d = p.second;
    auto z = std::find(s.begin(), s.end(), '0') - s.begin();
    auto x = z % 3, y = z / 3;
    int dxs[] = { 1, -1, 0, 0 }, dys[] = { 0, 0, 1, -1 };
    for (size_t i = 0; i < 4; i++) {
      int a = x + dxs[i], b = y + dys[i];
      if (0 <= a && a < 3 && 0 <= b && b < 3) {
        std::swap(s[3*y+x], s[3*b+a]);
        if (ss.find(s) == ss.end()) {
          ss[s] = d + 1;
          q.push(std::make_pair(s, d + 1));
        }
        std::swap(s[3*y+x], s[3*b+a]);
      }
    }
  }
  std::string s;
  for (size_t i = 0; i < 9; i++) {
    int c;
    scanf("%d", &c);
    s.push_back('0' + c);
  }
  printf("%d\n", ss[s]);
  return 0;
}

Measured memory_bytes: 21424
import java.util.Scanner;
import java.util.Stack;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();

		int answer = 0;
		Stack<Integer> st = new Stack<>();
		for (int i = 0; i < n; i++) {
			int x = sc.nextInt();
			if (st.isEmpty() || st.peek() <= x) st.push(x);
			else {
				int prev = st.pop();
				while (!st.isEmpty() && st.peek() > x) st.pop();
				answer += prev - x;
				st.push(x);
			}
		}

		if (!st.isEmpty()) answer += st.peek();
		System.out.println(answer);
	}

}


Measured memory_bytes: 23892
#include<bits/stdc++.h>
#define maxn 110
using namespace std;
typedef double ldb;
const ldb eps=1e-7;
const ldb pi=acos(-1.0);
ldb nx[maxn],ny[maxn];
int n;
int dcmp(ldb d){
    return fabs(d)<eps?0:(d<0?-1:1);
}
int main(){
    scanf("%d",&n);
    for(int i=1;i<=n;++i)
        scanf("%lf%lf",&nx[i],&ny[i]);
    for(int i=1;i<=n;++i){
        ldb mn=0,mx=pi;
        int id=(i==1?2:1);
        ldb ang=atan2(ny[id]-ny[i],nx[id]-nx[i]);
        for(int j=1;j<=n;++j)if(i!=j&&j!=id){
            ldb ang1=atan2(ny[j]-ny[i],nx[j]-nx[i]);
            ldb a=ang-ang1;
            if(dcmp(a-pi)==0||dcmp(a+pi)==0)mn=1e20;
            if(dcmp(a-pi)>0)a-=2*pi;
            else if(dcmp(-pi-a)>0)a+=2*pi;
            if(dcmp(a)<0)mn=max(mn,-a);
            else mx=min(mx,pi-a);
        }
//      printf("[%.3lf,%.3lf]",mn,mx);
        if(dcmp(mn-mx)>=0)puts("0.0");
        else printf("%.10lf\n",(mx-mn)/(2*pi));
    } 
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
const int MX = 2e5 + 10, MD = 1e9 + 7;
int n, m, a[MX], ans, tmp, mx1, mx2, mx3, t1, t2;
vector <pair <int, int>> num;
int main(){
    ios::sync_with_stdio(0) ; cin.tie(0) ;
    cin >> n;
    for(int i = 1; i <= n; i++){
        cin >> tmp;
        num.push_back({tmp, i});
    }
    sort(num.begin(), num.end());
    t1 = num[n / 2 - 1].F;
    t2 = num[n / 2].F;
    for(int i = 0; i < num.size(); i++){
        if(num[i].F < t2){
            a[num[i].S] = t2;
        }
        else if(num[i].F > t1){
            a[num[i].S] = t1;
        }
        else{
            a[num[i].S] = t1;
        }
    }
    for(int i = 1; i <= n; i++){
        cout << a[i] << endl;
    }
}




Measured memory_bytes: 4720
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MAX 207
#define INF (ll)1e12
int n,m,r;
ll dist[MAX][MAX];

void fw(){
	for(int k=1; k<=n; k++)
		for(int i=1; i<=n; i++)
			for(int j=1; j<=n; j++)
				dist[i][j]=min(dist[i][j],dist[i][k]+dist[k][j]);
}

// void display(){
// 	for(int i=1;i<=n;i++){
// 		for(int j=1;j<=n;j++)
// 			cout << dist[i][j] << " ";
// 		cout << endl;
// 	}
// }

int main(){
	scanf("%d %d %d",&n,&m,&r);
	for(int i=1;i<=n; i++)
		for(int j=1; j<=n; j++)
			if(i!=j)dist[i][j]=INF;
			else dist[i][j]=0; 
	int nodes[r];

	for(int i=0; i<r; i++)scanf("%d",nodes+i);


	for(int i=0; i<m; i++){
		int a,b;
		ll c;
		scanf("%d %d %lld",&a,&b,&c);
		dist[a][b]=min(dist[a][b],c);
		dist[b][a]=min(dist[b][a],c);
	}
	fw();
	ll res=(ll)1e18;
	// cout << "SP\n";
	// display();
	// cout << "\n";

	sort(nodes,nodes+r);
	do{
		ll s=0;
		// cout << "Perm : ";
		// for(int i=0; i<r; i++)cout << nodes[i] << " ";
		// cout << endl;

		for(int i=1; i<r; i++)s+=dist[nodes[i-1]][nodes[i]];
		res=min(res,s);
	}while(next_permutation(nodes,nodes+r));
	printf("%lld\n",res);
}

Measured memory_bytes: 512
N,K=map(int,input().split())
A=list(map(int,input().split()))
m,p,z=[],[],0
for a in A:
    if a<0:
        m.append(a)
    elif a>0:
        p.append(a)
    else:
        z+=1
m.sort()
p.sort()
mod=10**9+7
from functools import reduce
if (len(p) or K%2==0) and K<len(m)+len(p) or K==len(m)+len(p) and len(m)%2==0:
    r=1
    i,j=0,0
    while i+j<K:
        if i<len(m)-1 and i+j<K-1 and (j>=len(p)-1 or m[i]*m[i+1]>p[-j-1]*p[-j-2]):
            r=r*m[i]*m[i+1]%mod
            i+=2
        else:
            r=r*p[-j-1]%mod
            j+=1
    print(r)
elif z:
    print(0)
else:
    print(reduce(lambda x,y:x*y%mod,(m+p)[-K:]))

Measured memory_bytes: 31752
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

const ll mod = 1000000007;

int main() {
    int N, K;
    ll S, d;
    cin >> N >> K >> S;
    d = INF;
    if(S == INF){
        d = 1;
    }
    rep(i, K){
        cout << S << " ";
    }
    rep(i, N - K){
        cout << d << " ";
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 1280
#include<bits/stdc++.h>
#define Rushia_mywife ios::sync_with_stdio(0);cin.tie(0);
#define rep(i,head,n) for(int i=(head);i<n;i++)
#define int long long
#define F first
#define S second
#define pb push_back
#define p2(n) (1<<(n))
#define lg2(n) __lg(n)
using namespace std;
using pii = pair<long long,long long>;
using ld = long double;
mt19937 mt_rand(time(0));
const int mod = 1000000007;
const int hnum = 998244353;
const ld PI = acos(-1);

int n,x,t;

void solve(){
    cin >> n >> x >> t;
    cout << ((n-1)/x+1)*t << '\n';
}

signed main(){
    Rushia_mywife
    solve();
}

Measured memory_bytes: 3656
main = do
 [n,a,b] <- map read . words <$> getLine
 s <- getLine
 mapM_ putStrLn (sim s (a+b) b)

sim :: String -> Int -> Int -> [String]
sim [] _ _ = []
sim ('a':s) ab b
 | ab > 0 = "Yes" : sim s (ab-1) b
 | otherwise = "No" : sim s (ab-1) b
sim ('b':s) ab b
 | ab > 0 && b > 0 = "Yes" : sim s (ab-1) (b-1)
 | otherwise = "No" : sim s ab (b-1)
sim ('c':s) ab b = "No" : sim s ab b

Measured memory_bytes: 5372
st=input()
num=len(st)
for x in range(1,num+1):
    st = list(st)
    del st[-1:]
    st = "".join(st)
    n=len(st)
    if n%2==0:
        p=int(n/2)
        st1=st[:p]
        st2=st[-p:]
        if st1==st2:
            print(len(st))
            break
        else:
            continue
    else:
        continue


Measured memory_bytes: 3060
# coding: utf-8
# Your code here!
class UnionFind:
    def __init__(self, n):
        self.parent = list(range(n)) #親ノード
        self.size = [1]*n #グループの要素数
 
    def root(self, x): #root(x): xの根ノードを返す．
        while self.parent[x] != x:
            self.parent[x] = self.parent[self.parent[x]]
            x = self.parent[x]
        return x 
 
    def merge(self, x, y): #merge(x,y): xのいる組とyのいる組をまとめる
        x, y = self.root(x), self.root(y)
        if x == y: return False
        if self.size[x] < self.size[y]: x,y=y,x #xの要素数が大きいように
        self.size[x] += self.size[y] #xの要素数を更新
        self.parent[y] = x #yをxにつなぐ
        return True
 
    def issame(self, x, y): #same(x,y): xとyが同じ組ならTrue
        return self.root(x) == self.root(y)
        
    def getsize(self,x): #size(x): xのいるグループの要素数を返す
        return self.size[self.root(x)]

import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline #文字列入力のときは注意

n = int(input())
xyi = []
for i in range(n):
    x,y = [int(i) for i in readline().split()]
    xyi.append((x,y,i))


Xyi = sorted(xyi)
xYi = sorted(xyi, key=lambda x: x[1])

from heapq import *

a = []

for j in range(n-1):
    x,y,i = Xyi[j]
    xx,yy,ii = Xyi[j+1]
    heappush(a,(xx-x,ii,i))
    x,y,i = xYi[j]
    xx,yy,ii = xYi[j+1]
    heappush(a,(yy-y,ii,i))

#print(a)

uf = UnionFind(n)
c = 1
ans = 0
while c < n:
    d,ii,i = heappop(a)
#    print(d,ii,i)
    if uf.merge(ii,i):
        c += 1
        ans += d
#        print(c,ans,ii,i)

print(ans)    
    
    











Measured memory_bytes: 50508
#include <iostream>
#include <string>
using namespace std;
int main(){
	int n,a=0,w=0,t=0,r=0;
	string s;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> s;
		if (s == "AC")
			a++;
		else if (s == "WA")
			w++;
		else if (s == "TLE")t++;
		else r++;
	}
	cout << "AC x " << a<<endl;
	cout << "WA x " << w << endl;
	cout << "TLE x " << t << endl;
	cout << "RE x " << r << endl;
}

Measured memory_bytes: 3624
#include <iostream>
#include <cmath>
#include <iomanip>
#include <limits>
#include <string>
#include <vector>
#include <algorithm>
#include <list>
#include <map>
using namespace std;

struct node{
    int id,parent,sibling,degree,depth,height,lchild,rchild;
    string type;
};

node u[50];

void disp(node *v){
    cout << "node " << v->id << ": parent = " << v->parent
         << ", sibling = " << v->sibling << ", degree = " << v->degree << ", depth = " << v->depth
         << ", height = " << v->height << ", " << v->type << endl;
}

int depth(node *v){
    if(v->parent == -1) return 0;
    return depth(&u[v->parent])+1;
}
int height(node *v){
    if(v->degree == 0) return 0;
    if(v->lchild == -1) return height(&u[v->rchild])+1;
    if(v->rchild == -1) return height(&u[v->lchild])+1;
    return max(height(&u[v->lchild]), height(&u[v->rchild]))+1;
}

int main(){
    int n;
    cin >> n;
    for(int i=0;i<n;i++){
        u[i].parent = -1;
        u[i].sibling = -1;
        u[i].degree = 0;
    }
    for(int i=0;i<n;i++){
        int m;
        cin >> m;
        u[m].id = m;
        int left,right;
        cin >> left >> right;
        u[m].lchild = left;
        u[m].rchild = right;
        if(left != -1){
            u[m].degree++;
            u[left].parent = m;
            if(right != -1) u[left].sibling = right;
        }
        if(right != -1){
            u[m].degree++;
            u[right].parent = m;
            if(left != -1) u[right].sibling = left;
        }
    }
    for(int i=0;i<n;i++){
        u[i].depth = depth(&u[i]);
        u[i].height = height(&u[i]);
        if(u[i].parent == -1) u[i].type = "root";
        else if(u[i].degree == 0) u[i].type = "leaf";
        else u[i].type = "internal node";
    }
    for(int i=0;i<n;i++){
        disp(&u[i]);
    }
}


Measured memory_bytes: 3240
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cinttypes>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<string>
#include<stack>


#define FSCNd64 "%" SCNd64
#define FPRId64 "%" PRId64

using namespace std;

using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using pii=pair<int,int>;
using vll=vector<ll>;
using vvll=vector<vll>;
using vpii=vector<pii>;

#define PI 3.1415926535897932384626433832795

template<typename X>
bool max_u(X&m, X v)
{
	if(m<v)
	{
		m=v;
		return true;
	}
	return false;
}


template<typename X>
bool min_u(X&m, X v)
{
	if(m>v)
	{
		m=v;
		return true;
	}
	return false;
}


using ll=long long;

class mod_ll
{
public:
	ll m_v;
	static const ll m_m=1000000007; // prime value ex. 1000000009
	mod_ll(ll v=0) : m_v(v%m_m) {}
	mod_ll& operator = (ll rhs)
	{
		m_v=rhs%m_m;
		return *this;
	}
	ll operator ()(){return (m_v+m_m)%m_m;}
	mod_ll& operator += (const mod_ll rhs)
	{
		m_v=(m_v+rhs.m_v)%m_m;
		return *this;
	}
	const mod_ll operator + (const mod_ll rhs)
	{
		auto ret=*this;
		return ret+=rhs;
	}
	mod_ll& operator -= (const mod_ll rhs)
	{
		m_v=(m_v-rhs.m_v+m_m)%m_m;
		return *this;
	}
	const mod_ll operator - (const mod_ll rhs)
	{
		auto ret=*this;
		return ret-=rhs;
	}
	mod_ll& operator *= (const mod_ll rhs)
	{
		m_v=(m_v*rhs.m_v)%m_m;
		return *this;
	}
	const mod_ll operator * (const mod_ll rhs)
	{
		mod_ll ret=*this;
		return ret*=rhs;
	}
	const mod_ll operator ^ (ll rhs)
	{
		mod_ll t=*this;
		mod_ll ret(1LL);

		for(;rhs>0;rhs>>=1)
		{
			if(rhs&1) ret*=t;
			t*=t;
		}
		return ret;
	}
	mod_ll& operator /= (mod_ll rhs)
	{
		mod_ll t=rhs^(m_m-2);
		return *this*=t;
	}
	const mod_ll operator / (const mod_ll rhs)
	{
		mod_ll ret=*this;
		return ret/=rhs;
	}
};


mod_ll mod_fact(int n)
{
	static vector<mod_ll> memo(1);

	if((int)memo.size()<=n)
	{
		if(memo.size()==1)
		{
			memo[0]=1;
		}
		for(int i=memo.size();i<=n;i++)
		{
			memo.push_back(memo.back()*i);
		}
	}
	return memo[n];
}


mod_ll mod_nCr(int n, int r)
{
	if(n<=0) return 1;
	return mod_fact(n)/(mod_fact(n-r)*mod_fact(r));
}


mod_ll mod_nCr2(int n, int r)
{
	mod_ll bunsi(1);
	mod_ll bunbo(1);
	if(r*2>n) r=n-r;

	for(int i=0;i<r;i++)
	{
		bunsi*=(n-i);
		bunbo*=(i+1);
	}
	return bunsi/bunbo;
}


mod_ll mod_nPr(int n, int r)
{
	return mod_fact(n)/mod_fact(n-r);
}


struct solve
{
	solve(){}
	ll operator()(int n, int m)
	{
		mod_fact(n);
		mod_ll ans;
		for(int i=0;i<=n;i++)
		{
			mod_ll t=mod_nPr(m-i, n-i)*mod_nCr(n, i);
			if(i&1) ans-=t;
			else ans+=t;
		}
		ans*=mod_nPr(m, n);

		return ans();
	}
};

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

	for(;;)
	{
		int n, m;
		cin >> n >> m;
		if(cin.fail()) break;
		cout << solve()(n, m) << "\n";
	}
	return 0;
}


Measured memory_bytes: 7364
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		String[] line = sc.nextLine().split(" ", 2);
		long a = Long.parseLong(line[0]);
		long b = 0;
		for (int i = 0; i < line[1].length(); i++) {
		    if (line[1].charAt(i) == '.') {
		        continue;
		    }
		    b *= 10;
		    b += line[1].charAt(i) - '0';
		}
	    System.out.println(a * b / 100);
	}
}


Measured memory_bytes: 35748
from functools import reduce
from math import gcd
n = int(input())
aa = list(map(int, input().split()))
ma = max(aa)
cnt = [0] * (ma+1)

for a in aa:
    cnt[a] += 1

if reduce(gcd, aa) != 1:
    print('not coprime')
elif all(sum(cnt[i::i]) <= 1 for i in range(2, ma)):
    print('pairwise coprime')
else:
    print('setwise coprime')

Measured memory_bytes: 205104
n = int(input())
s = "SHCD"
cards = [[0] * 13 for i in range(4)]
for i in range(n):
  a, b = input().split()
  cards[s.find(a)][int(b)-1] = 1
for i in range(4):
  for j in range(13):
    if cards[i][j] == 0:
      print(s[i], j+1)


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

class Program
{
	static void Main(string[] args)
	{
		var S = Console.ReadLine();
		var K = long.Parse(Console.ReadLine());
		var firstchr = S[0];
		int firstcount = 0;
		int lastcount = 0;
		int chgcount = 0;
		double ans;
		
		for (int i = 0; i < S.Length; i++) {
			if (S[i] == firstchr) {
				firstcount++;
			} else {
				break;
			}
		}
//		Console.WriteLine(string.Format("firstcount:{0}", firstcount));
		
		for (int i = S.Length - 1; i > 0; i--) {
			if (S[i] == firstchr) {
				lastcount++;
			} else {
				break;
			}
		}

//		Console.WriteLine(string.Format("lastcount:{0}", lastcount));
		
		for (int i = firstcount; i < S.Length - 1 - lastcount; i++) {
			if (S[i] == S[i + 1]) {
				chgcount++;
				i++;
			}
		}
		
//		Console.WriteLine(string.Format("firstcountblock:{0}", firstcountblock));
//		Console.WriteLine(string.Format("lastcountblock:{0}", lastcountblock));
//		Console.WriteLine(string.Format("chgcountblock:{0}", chgcountblock));
//		Console.WriteLine(string.Format("lastblocak:{0}", lastblocak));
		if(firstcount == S.Length)
			lastcount =0;
		double firstcountblock = firstcount / 2;
		double lastcountblock = lastcount / 2;
		double chgcountblock = chgcount * K;
		double lastblocak = (firstcount + lastcount) / 2 * (K - 1);

		ans = firstcountblock + lastcountblock + chgcountblock+lastblocak;
		if(firstcount ==S.Length){
			ans = firstcount*K/2;
		}
		Console.WriteLine(ans);
//		Console.ReadLine();
	}
}

Measured memory_bytes: 11092
#include <bits/stdc++.h>
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>*/
 
#define pll              pair <long long,long long>
#define pb               push_back
#define ll               long long
#define ff               first
#define ss               second
#define D(x)             cerr<<#x " = "<<(x)<<endl
#define vll              vector <ll>
#define IOS              ios_base::sync_with_stdio(0); cin.tie(NULL);
#define endl             '\n'   
using namespace std;
int main()
{
    IOS
     // freopen("input.txt","r",stdin);
     // freopen("output.txt","w",stdout);
     // freopen("error.txt","w",stderr);
     ll a[5];
     for(ll i=0;i<5;i++)
     {
        ll x;
        cin>>x;
        if(x==0)
        {
            cout<<i+1<<endl;
            return 0;
        }
     }
    return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, M;
  cin >> N >> M;
  
  vector<int> Nmin(M);
  vector<int> Nmax(M);
  
  for (int i = 0; i < M; i++) {
    cin >> Nmin.at(i) >> Nmax.at(i);
  }
  
  int idmin = 1;
  int idmax = N;
  
  for (int i = 0; i < M; i++) {
    idmin = max(idmin, Nmin.at(i));
    idmax = min(idmax, Nmax.at(i));
  }
  
  int result = idmax - idmin + 1;
  if (result < 0) {
    result = 0;
  }
  
  cout << result << endl;
  
  return 0;
}

Measured memory_bytes: 4036
#include <stdio.h>

const int MOD = 10007;
const int MAX_N = 1010;

int N;
char S[1010];

int dp[1010][8];

int char_to_id(char c)
{
	switch (c) {
	case 'J': return 0;
	case 'O': return 1;
	case 'I': return 2;
	}
	return -1;
}

void exclude(int pos, int p)
{
	int i;
	for(i=0;i<8;i++) if((i & (1<<p)) == 0) dp[pos][i] = 0;
}

int main()
{
	int i,j,k;
	int sol = 0;
	scanf("%d%s", &N, S);

	for(i=0;i<N;i++){
		if(i == 0){
			for(j=0;j<8;j++) dp[i][j] = 1;

			exclude(i, 0);
		}else{
			for(j=0;j<8;j++) dp[i][j] = 0;

			for(j=0;j<8;j++)
				for(k=0;k<8;k++) if(j & k)
					dp[i][k] = (dp[i][k] + dp[i-1][j]) % MOD;
		}

		exclude(i, char_to_id(S[i]));
	}


	for(i=0;i<8;i++) sol = (sol + dp[N-1][i]) % MOD;

	printf("%d\n", sol);

	return 0;
}

Measured memory_bytes: 2736
#include<stdio.h>

int main(){
	int i;
	int a,b;
	int answer;
	while(scanf("%d %d",&a,&b)!=EOF){
		a = a + b;
		answer = 1;
		while(a/10){
			a /= 10;
			answer += 1;
		}
		printf("%d\n",answer);
	}
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
long long int dp[1000][1000];
long long int sum(int h,int w,vector< vector<char> > &arr)
{
    if(dp[h][w]!=-1)return dp[h][w]%1000000007;
    dp[h][w]=(sum(h,w-1,arr)%1000000007+sum(h-1,w,arr)%1000000007)%1000000007;
    return dp[h][w]%1000000007;
}
int main()
{
    memset(dp,-1,sizeof(dp));
    int h,w,flagi=0,flagj=0;
    long long int res;
    cin>>h>>w;
    vector<char> a(w);
    vector< vector<char> > arr(h,a);
    for(int i=0;i<h;i++)
    {
        for(int j=0;j<w;j++)
        {
            cin>>arr[i][j];
            if(i==0)
            {
                if(flagi==0)dp[i][j]=1;
                else dp[i][j]=0;
            }
            if(j==0)
            {
                if(flagj==0)dp[i][j]=1;
                else dp[i][j]=0;
            }
            if(arr[i][j]=='#')
            {
                dp[i][j]=0;
                if(i==0)flagi=1;
                if(j==0)flagj=1;
            }
            else if(j>0&&i>0)
            {
                dp[i][j]=(sum(i-1,j,arr)%1000000007+sum(i,j-1,arr)%1000000007)%1000000007;
            }
            
        }
    }
    cout<<dp[h-1][w-1]%1000000007;
}

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

typedef long long ll;
typedef long double ld;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

#define f first
#define s second
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define pb push_back

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define F0R(i, a) FOR(i, 0, a)
#define ROF(i, a, b) for (int i = (b); i >= (a); --i)
#define R0F(i, a) ROF(i, 0, a-1)
#define trav(x, a) for (auto& x: a)

const int MX  = 2e5+5;
const int MOD = 1e9+7;
const ll  INF = 1061109567; // 4557430888798830399LL
const ld  EPS = 1e-9;
const ld  PI  = acos(-1);

int main() {

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

    int a,b; cin >> a >> b;

    cout << a*b << "\n";

}


Measured memory_bytes: 3648
#include<stdio.h>
#include<stdlib.h>
#include<math.h>

int main(void){

  int N,A,B,train;
  scanf("%d%d%d",&N,&A,&B);
  train = N*A;

  if(train >= B){
    printf("%d\n",B);
  }else{
    printf("%d\n",train);
  }

  return 0;

}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <algorithm>
#include <array>
#include <complex>
#include <string>
#include <utility>
#include <map>
#include <queue>
#include <list>
#include <functional>
#include <numeric>
#include <stack>
#include <tuple>

using namespace std;
int dx[4] = { -1,0,1,0 };
int dy[4] = { 0,1,0,-1 };
const int INF = 100000000;
const long long LINF = 1000000000000000000;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-6;
using pii = std::pair<int, int>;
using pLL = std::pair<long long, long long>;
using ll = long long;
#define SORT(v) std::sort(v.begin(), v.end())

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int a,b,c,d;
	cin >> a >> b;
	if(a<=b) cout << a << endl;
	else cout << a - 1 << endl;
	return 0;
}


Measured memory_bytes: 256
/*suri_kumkaran*/

#include <bits/stdc++.h>

using namespace std;

#define UB upper_bound
#define LB lower_bound
#define BS binary_search
#define MP make_pair
#define EB emplace_back
#define endl "\n"
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define F first
#define S second
#define ALL(a) (a).begin(),(a).end()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)

typedef long long int int64;
typedef vector<int64> VI64;
typedef vector<pair<int64,int64>> VII64;
typedef vector<string> VS;
typedef vector<vector<int64>> VVI;

int main()
{
	IOS;
	int64 T=1;
	//cin>>T;
	while(T--)
	{
		int64 n;
		cin>>n;
		cout<<n*n*n;
	}

	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){

int j,i,a,n;

scanf("%d",&n);

int scan[n];

for(i = 0; i < n; i++){
scanf("%d",&a);
scan[i] = a;
}
for( j = n; j-1 >= 0; j--){

  printf("%d",scan[j-1]);
    if(j-1)printf(" ");
}
printf("\n");
return 0;
}


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

int main()
{
    int n;
    string s;
    cin>>n>>s;
    for(int i=0;i<s.size();i++)
    {
       int temp= s[i]+n;
       char ch=temp;
        if(temp>90)
        {
            temp=temp%90;
            temp+=64;
            ch=temp;
        }
            cout<<ch;
    }

    return 0;
}


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

int main() {
  int n,sum=0,ans,ex;
  cin >> n;
  r(i,n){
    sum+=i;
    if(sum>=n){
      ans=i;
      ex=sum-n;
      break;
    }
  }
  r(i,ans){
    if(i!=ex)cout<<i<<endl;
  }
}

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

using namespace std;

int main(){
    int H,W,sharp=0;
    cin >> H >> W;
    vector<string> s(H);
    vector<vector<int>> len(H,vector<int>(W,-1));
    for(int i=0;i<H;i++){
        cin >> s[i];
    }

    len[0][0] = 0;

    queue<pair<int,int>> Q;
    pair<int,int> P;

    Q.push({0,0});

    while(!Q.empty()){
        P = Q.front();
        Q.pop();
        int y=P.first,x=P.second;
        if(y!=0 && len[y-1][x]==-1 && s[y-1][x]!='#'){
            len[y-1][x] = len[y][x]+1;
            Q.push({y-1,x});
        }

        if(y!=H-1 && len[y+1][x]==-1 && s[y+1][x]!='#'){
            len[y+1][x] = len[y][x]+1;
            Q.push({y+1,x});
        }

        if(x!=0 && len[y][x-1]==-1 && s[y][x-1]!='#'){
            len[y][x-1] = len[y][x]+1;
            Q.push({y,x-1});
        }

        if(x!=W-1 && len[y][x+1]==-1 && s[y][x+1]!='#'){
            len[y][x+1] = len[y][x]+1;
            Q.push({y,x+1});
        }
    }


    if(len[H-1][W-1]==-1){
        cout << -1 << endl;
    }else{
        for(int i=0;i<H;i++){
            for(int j=0;j<W;j++){
                if(s[i][j]=='#'){
                    sharp++;
                }
            }
        }

        cout << H*W-sharp-len[H-1][W-1]-1 << endl;
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<numeric>
#include<math.h>
#include<algorithm>
#include<iomanip>
#include<list>
#include<bitset>
using namespace std;

// 動的計画法
class DP {
public:
	// コンストラクタ
	DP(const int dN, const vector<int>& da);
	// デストラクタ
	~DP();
	// メイン関数
	long long main_calc();
private:
	// 再帰関数
	long long rec(int irec);
private:
	// 段差の数
	const int N;
	// 壊れている段差
	const vector<int>& a;
	// 移動方法の総数
	vector<long long> ans;
	// 総数の除数
	const long long dval = 1000000007;
};

// コンストラクタ
DP::DP(const int dN, const vector<int>& da) : N(dN), a(da) {
	// 計算結果を格納するテーブルを初期化
	for (int i = 0; i <= N; i++) {
		// 負の値はまだ計算したことがないことを表す
		ans.push_back(-1);
	}
	// 漸化式の初期値（階段の上段の値）を格納
	ans[N] = 1;
	ans[N - 1] = 1;
	// 壊れている段差の情報を格納
	for (int i = 0; i < a.size(); i++) {
		ans[a[i]] = 0;
	}
}

// デストラクタ
DP::~DP() {
}

// 再帰関数
long long DP::rec(int irec) {
	// 計算したことがある場合
	if (ans[irec] > -1) {
		return ans[irec];
	}
	// 計算したことがない場合
	else {
		// 計算した結果を保存
		ans[irec] = rec(irec + 1) % dval + rec(irec + 2) % dval;
		ans[irec] = ans[irec] % dval;
		return ans[irec];
	}
}

// メイン関数
long long DP::main_calc() {
	return rec(0);
}

int main() {

	int N, M;
	cin >> N >> M;

	vector<int> a(M, 0);
	for (int i = 0; i < M; i++) {
		cin >> a[i];
	}

	DP dp(N, a);

	cout << dp.main_calc() << endl;

	return 0;
}



Measured memory_bytes: 5876
Module Module1
    Sub Main()
        Dim input As String() = Console.ReadLine.Split(" "c)

        Dim num1 As Integer = Convert.ToInt32(input(0))
        Dim num2 As Integer = Convert.ToInt32(input(1))

        Dim outPut As String = String.Empty

        For index As Integer = num2 - num1 + 1 To num2 + num1 - 1
            outPut &= index.ToString & " "
        Next

        Console.WriteLine(outPut)

    End Sub
End Module

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

const int maxn = 5010;

int n;
// dp[lst]
long long dp[maxn];
long long m;
long long arr[maxn];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n >> m;
    dp[0] = 1;
    for(int i = 1, j = n + 2; i <= j; i++, j--) {
        arr[i] = arr[j] = i - 1;
    }
    for(int i = 2; i <= n; i++) {
        for(int j = arr[i]; j <= n; j++) {
            dp[j] += dp[j - arr[i]];
            dp[j] %= m;
        }
    }
    long long ret = 0;
    for(int i = 0; i <= n; i++) {
        ret += i * dp[n - i];
        ret %= m;
    }
    cout << ret << endl;
}

Measured memory_bytes: 3716
n = int(input())
factors = []
for i in range(1, int(n**0.5)+1):
    if n%i==0:
        if n//i*2<(4*n+1)**0.5-1:
            factors.append(i)
        if i*2<(4*n+1)**0.5-1:
            factors.append(n//i)
print(sum(factors)-len(factors))

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main{
	public static void main(String args[]){

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] x = new int[N];

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

		String A = "";
		for (int j = N - 1; j >= 0; j--){

			A += (x[j]);
			if(j != 0){
				A += " ";
			}
		}
		System.out.println(A);
	}
}

Measured memory_bytes: 26540
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using Pair = pair<int, int>;
using Vec = vector<int>;
using Graph = vector<Vec>;

int		main(void)
{
	char c;
	cin >> c;
	c++;
	cout << c << endl;
}


Measured memory_bytes: 256
package main

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

func min(nums ...int) int {
	ret := nums[0]
	for _, v := range nums {
		if v < ret {
			ret = v
		}
	}
	return ret
}

func main() {
	sc.Split(bufio.ScanWords)
	s, k := next(), nextInt()

	iMax := min(k, len(s))
	for i := 0; i < iMax; i++ {
		if s[i] > '1' {
			fmt.Println(string(s[i]))
			return
		}
	}
	fmt.Println(1)
}

var (
	sc  = bufio.NewScanner(os.Stdin)
	rdr = bufio.NewReaderSize(os.Stdin, 1000000)
	wt  = bufio.NewWriter(os.Stdout)
)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	i, _ := strconv.Atoi(next())
	return i
}

func nextMega() string {
	buf := make([]byte, 0, 1000000)
	for {
		l, p, _ := rdr.ReadLine()
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}

func putf(format string, a ...interface{}) {
	fmt.Fprintf(wt, format, a...)
}

func puts(a ...interface{}) {
	fmt.Fprintln(wt, a...)
}


Measured memory_bytes: 640
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstring>
#include<string>
#include<vector>
#include<map>  
#include<set>
#include<iterator>
#include<list>
#include<utility>
#include<cstdlib>
#include<queue>
#include<stack>
#include<bitset>
//#include<bits/stdc++.h>

#define PI  2*acos(0.0)
#define pb push_back


using namespace std;
using ll = long long;
using lli = long long int;
using ld = long double;


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


ll n;
ll x,y;
cin>>n;
vector<ll>v;
while(n--)
{
	cin>>x>>y;
	v.pb(x);
	v.pb(y);
}

for(int i=0;i<v.size()-5;i++)
{
	if(v[i]==v[i+1])
	{
		if(v[i+2]==v[i+3])
		{
			if(v[i+4]==v[i+5])
			{
				cout<<"Yes"<<"\n";
				return 0;
			}
		}
	}
}

cout<<"No"<<"\n";









	
	
	return 0;
	
	
}

Measured memory_bytes: 3668
# include <bits/stdc++.h>
using namespace std;
const int maxn=100;
int main ()
{
	int n;
	int s[maxn];
	cin>>n;
	for (int i=0;i<n;++i)
	   	 cin>>s[i];
	sort (s,s+n);
	int ans=0;
	for (int i=0;i<n-1;++i)
	   	 ans+=s[i];
	printf ("%d\n",ans+(s[n-1]/2));
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize(3, "Ofast", "inline")

#include <bits/stdc++.h>

#define start ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long
#define int ll
#define ls st<<1
#define rs st<<1|1
#define pii pair<int,int>
#define rep(z, x, y) for(int z=x;z<=y;++z)
#define com bool operator<(const node &b)
using namespace std;
const int maxn = (ll) 3e5 + 5;
const int mod = 1e9 + 7;
const int inf = 0x3f3f3f3f;
int T = 1;
int cntb, cnta, cntab;
int fac[maxn];

void solve() {
    fac[0] = 1;
    rep(i, 1, maxn - 1)fac[i] = fac[i - 1] * 2 % mod;
    map<pii, int> mp;
    int n;
    cin >> n;
    rep(i, 1, n) {
        int a, b;
        cin >> a >> b;
        if (a * b == 0) {
            if (a == 0 && b == 0)
                ++cntab;
            else if (a == 0)
                ++cnta;
            else if (b == 0)
                ++cntb;
            continue;
        }
        int d = __gcd(a, b);
        a /= d, b /= d;
        if (a < 0) a = -a, b = -b;
        mp[{a, b}]++;
    }
    int ans = ((fac[cnta] + fac[cntb] - 1) % mod + mod) % mod;
//    for (auto &to:mp) {
//        if (to.second == 0)
//            continue;
//        int a = to.first.first, b = to.first.second;
//        int num = to.second;
//        pii j = a > 0 ? pii(-b, a) : pii(b, -a);
//        ans = ans * ((fac[num] + fac[mp[j]] - 1 + mod) % mod) % mod;
//        mp[j] = 0;
//    }
    for (auto it : mp) {
        if (it.second == 0) continue;
        ll a = it.first.first, b = it.first.second;
        ll d = fac[mp[{a, b}]];
        b = -b;
        if (b < 0) a = -a, b = -b;
        pii j = pii(b, a);
        if (mp.count(j)) {
            d = (d + fac[mp[j]] - 1) % mod;
            mp[j] = 0;
        }
        ans = ans * d % mod;
    }
    cout << (ans - 1 + cntab + mod) % mod;
}

signed main() {
    start;
    while (T--)
        solve();
    return 0;
}
/*
6
 1 4
 1 4
 -4 1
 -3 1
 1 3
 1 3
 */

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

#define ONLINE_JUDGE
#define pb(a) push_back(a)
#define all(a) (a.begin(), a.end())

using ll = long long;

const int E5 = 1e5;

//////////// Solution /////////////////////////////////

int ans = 0;
int n;

void dfs(ll cur, int mask) {
	if (cur > n)
		return;

	if (mask == 7) ++ans;
	dfs(cur*10+3, mask | 1);
	dfs(cur*10+5, mask | 2);
	dfs(cur*10+7, mask | 4);
}

void solve() {
	cin >> n;
	dfs(0,0);
	cout << ans << '\n';	
}	

/////////// End Solution ///////////////////////////////////////

//////// Initialization ////////////////////////////////////

int main() {

	#ifndef ONLINE_JUDGE
	FILE *FIN = freopen("/home/danil/prog/input.txt", "r", stdin);
	clock_t time_start = clock();
	#endif

	ios::sync_with_stdio(false);
	cin.tie(NULL);

	solve();

	#ifndef ONLINE_JUDGE
	fclose(FIN);
	cerr << "\x1b[031m\n-----------------\nTime=" << (ll)((double)(clock()-time_start) / CLOCKS_PER_SEC * 1000) << "ms\n\x1b[0m";
	#endif

	return 0;
}

//////// End Initialization ///////////////////////////////////////

Measured memory_bytes: 256
N=int(input())
T,A=map(int,input().split())
H=[int(x) for x in input().split()]
answer=0
deff=float('inf')
for i in range(N):
  deff=min(deff,abs(H[i]-(T-A)/0.006))
  if deff==abs(H[i]-(T-A)/0.006):
    answer=i+1
print(answer)

Measured memory_bytes: 3064
package main

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

func solve(sc *scanner, wr *bufio.Writer) {
	s, t := sc.getString(), sc.getString()

	ans := 0
	for i := 0; i < len(s); i++ {
		if s[i] != t[i] {
			ans++
		}
	}
	fmt.Fprintln(wr, ans)
}

func main() {
	sc := newScanner()
	wr := bufio.NewWriter(os.Stdout)
	maxBufSize := int(1e8)
	sc.Buffer(make([]byte, 4096), maxBufSize)
	sc.Split(bufio.ScanWords)

	solve(sc, wr)
	wr.Flush()
}

// input ------------------------
type scanner struct {
	*bufio.Scanner
}

func newScanner() *scanner {
	sc := bufio.NewScanner(os.Stdin)
	return &scanner{sc}
}
func (sc *scanner) getInt() int {
	sc.Scan()
	ret, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return ret
}
func (sc *scanner) getInt2() (int, int) {
	return sc.getInt(), sc.getInt()
}
func (sc *scanner) getInt3() (int, int, int) {
	return sc.getInt(), sc.getInt(), sc.getInt()
}
func (sc *scanner) getInt4() (int, int, int, int) {
	return sc.getInt(), sc.getInt(), sc.getInt(), sc.getInt()
}
func (sc *scanner) getInts(n int) []int {
	ret := make([]int, n)
	for i := range ret {
		ret[i] = sc.getInt()
	}
	return ret
}
func (sc *scanner) getString() string {
	sc.Scan()
	return sc.Text()
}
func (sc *scanner) getRunes() []rune {
	return []rune(sc.getString())
}
func (sc *scanner) getFloat() float64 {
	sc.Scan()
	ret, err := strconv.ParseFloat(sc.Text(), 64)
	if err != nil {
		panic(err)
	}
	return ret
}
func (sc *scanner) getFloats(n int) []float64 {
	ret := make([]float64, n)
	for i := range ret {
		ret[i] = sc.getFloat()
	}
	return ret
}

// math ----------------------------
func sum(ns ...int) int {
	var sum int
	for _, n := range ns {
		sum += n
	}
	return sum
}

func max(ns ...int) int {
	max := ns[0]
	for i := 1; i < len(ns); i++ {
		if max < ns[i] {
			max = ns[i]
		}
	}
	return max
}

func min(ns ...int) int {
	min := ns[0]
	for i := 1; i < len(ns); i++ {
		if min > ns[i] {
			min = ns[i]
		}
	}
	return min
}

func pow(a, b int) int {
	ret := 1
	for b > 0 {
		if b&1 > 0 {
			ret = ret * a
		}
		a = a * a
		b >>= 1
	}
	return ret
}


Measured memory_bytes: 2708
#include <algorithm>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <queue>
#include <stack>
#include <utility>
#include <vector>
using std::cerr;
using std::cin;
using std::cout;
using std::endl;

void OutputError(std::string s) {
  cerr << "\033[93m" << s << "\033[m" << endl;
  return;
}

int main(void) {
  cout << std::fixed << std::setprecision(10);
  cin.tie(0);
  std::ios::sync_with_stdio(false);
  int n;
  cin >> n;
  std::string s, t;
  cin >> s >> t;
  for (int i = 0; i < n; i++) {
    if (s[i] == t[0]) {
      bool is_same = true;
      for (int j = i; j < n; j++) {
        if (s[j] != t[j - i]) {
          is_same = false;
          break;
        }
      }
      if (is_same) {
        cout << n * 2 - (n - i) << endl;
        exit(0);
      }
    }
  }
  cout << n * 2 << endl;

  return 0;
}


Measured memory_bytes: 256
// Problem : A - A?C
// Contest : AtCoder - AtCoder Beginner Contest 166
// URL : https://atcoder.jp/contests/abc166/tasks/abc166_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include<bits/stdc++.h>
using namespace std;
#define fastIO std::ios_base::sync_with_stdio(false); std::cin.tie(0); std::cout.tie(0)
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
//#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
typedef double db;
//mt19937 mrand(random_device{}()); 
//int rnd(int x) { return mrand() % x;}
const ll mod=1000000007;
const int INF = 0x3f3f3f3f;
const double PI = acos(-1.0);
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}

const int maxn = 2e5 + 10; 

int main()
{
	fastIO;
	string s;
	cin >> s;
	if(s[1] == 'B') s[1] = 'R';
	else s[1] = 'B';
	cout << s << endl;	
	return 0;
}

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

typedef long long ll;
typedef long double ld;

#define pb push_back
#define sort(s) sort(s.begin(),s.end())
#define reverse(s) reverse(s.begin(),s.end())
#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)

const ll mod = 1e9+7;

//最大公約数
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;
}

//素数判定
bool isPrime(ll x){
    ll i;
    if(x < 2)return 0;
    else if(x == 2) return 1;
    if(x%2 == 0) return 0;
    for(i = 3; i*i <= x; i += 2) if(x%i == 0) return 0;
    return 1;
}

//桁和
int digsum(ll n) {
    int res = 0;
    while(n > 0) {
        res += n%10;
        n /= 10;
    }
    return res;
}

//桁数
int dignum(ll n) {
    int res = 0;
    while(n > 0) {
        res++;
        n /= 10;
    }
    return res;
}

//文字列中の特定の文字カウント
ll stringcount(string s,char c){
    return count(s.cbegin(),s.cend(),c);
}

//階乗
ll ka(ll i){
    ll res=1;
    while(i>0){
        res=res*i;
        i--;
    }
    return res;
}
 
//ncr
ll ncr(ll x,ll y){
    ll a = x;
    ll b = 1;
    if(y>(x/2)){
        y=x-y;
    }
    for(ll i=1;i<y;i++){
        a*=x-i;
        b*=i+1;
    }
    return a/b;
}

//フィボナッチ数列
ll f(ll x){
    ll dp[x+1];
    dp[1]=1;
    dp[2]=1;
    for(ll i=3;i<=x;i++){
        dp[i]=dp[i-1]+dp[i-2];
    }
    return dp[x];
}

//char->int
int ctoi(char c){
    return c-'0';
}



int main(){
    ll a(0),b(0);
    cin >> a >> b;
    cout << lcm(a,b) << endl;
}

Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
int main(){
 int n,ans=0;
  cin>>n;
  int arr[n];
  for(int i=0;i<n;i++){
    cin>>arr[i];
    if((i+1)%2!=0&&arr[i]%2!=0)
      ans++;
  }
  cout<<ans<<"\n";
  return 0;
}

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

int main(){
  string S;
  cin >> S;
  
  bool flag = false;
  
  for(int i = 1; i < S.size(); ++i) {
    if(S.at(i - 1) == S.at(i) && flag == false) {
      cout << "Bad" << endl;
      flag = true;
    }
  }
  
  if(!flag) {
    cout << "Good" << endl;
  }
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

const ll MAX = 1000000000000000LL;

ll s(ll n){
    ll tmp = 0;
    for(;n;n/=10)tmp+=n%10;
    return tmp;
}

bool mn(ll n, ll m){
    return n * s(m) < m * s(n);
}

void test(){
    vector<ll>v;
    v.push_back(1);
    for(ll i = 2; i < 1000000; i++){
        for(;;){
            if(mn(i, v.back())) v.pop_back();
            else break;
        }
        v.push_back(i);
    }
    for(ll i = 0; i < v.size(); i++){
        cout << v[i] << " : " << v[i] << " / " << s(v[i]) << " = " << (double)v[i] / s(v[i]) << endl;
    }
}

int main(){

    set<ll>S;
    for(ll i = 1; i <= 999; i++){
        for(ll j = i; j <= MAX; j = j * 10 + 9){
            S.insert(j);
        }
    }
    vector<ll>v;
    for(set<ll>::iterator it = S.begin(); it != S.end(); it++){
        ll n = *it;
        while(!v.empty()){
            if(mn(n, v.back()))v.pop_back();
            else break;
        }
        v.push_back(n);
    }

    ll K;
    cin >> K;
    for(ll i = 0; i < K; i++)cout << v[i] << endl;

    return 0;
}


Measured memory_bytes: 768
#include <cstdio>
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);++i)

inline ll read(){
  ll ans=0,c=getchar();
  while(c<'0'||c>'9'){c=getchar();}
  while(c>='0'&&c<='9'){ans=ans*10+(c-'0'); c=getchar();}
  return ans;
}

int main(){
  int n;
  scanf("%d",&n);
  int a,count4=0,odd=0;
  bool count2=false;
  rep(i,n){
    a=read();
    if(a%2){
      odd++;
    }else if(a%4==0){
      count4++;
    }else{
      count2=true;
    }
  }

  if(odd==0){
    printf("Yes\n");
    return 0;
  }

  if(odd+(count2?1:0)<=count4+1){
    printf("Yes\n");
    return 0;
  }
  printf("No\n");
  return 0;
}

Measured memory_bytes: 128
from collections import deque

N,C,K=map(int,input().split())
T=[]
for i in range(1,N+1):
    T.append(int(input()))
T.sort()

ans=0
q=deque()
q.append(T[0])
for Ti in T[1:]:
    if q[0]+K<Ti or len(q)==C:
        q.clear()
        ans+=1
    q.append(Ti)
ans+=1

print(ans)

Measured memory_bytes: 51288