akhauriyash/Code-Regression huggingface dataset:
/* *****fireice**** */

#include<bits/stdc++.h>

#define ll long long int
#define ld long double
#define vi vector<int>
#define vc vector<char>
#define vl vector<ll>
#define vii vector<pair<int,int>>
#define vll vector<pair<ll,ll>>
#define pii pair<int,int>
#define pb push_back
#define eb emplace_back
#define el '\n'
#define N 1000000007
#define re return
#define F first
#define S second
#define L length
#define mp make_pair
#define PI 3.14159265
#define all(a) (a).begin(),(a).end()
#define forup(i,n) for(int i=0;i<n;i++)
#define forf(i,x,n) for(int i=x;i<n;i++)
#define ford(i,n) for(int (i)=(n)-1;i>=0;(i)--)
#define take(a,n) forup(i,n) cin>>a[i];
using namespace std;

int gcdExtended(int a, int b, int *x, int *y)
{
    // Base Case
    if (a == 0)
    {
        *x = 0, *y = 1;
        return b;
    }

    int x1, y1; // To store results of recursive call
    int gcd = gcdExtended(b%a, a, &x1, &y1);

    // Update x and y using results of recursive
    // call
    *x = y1 - (b/a) * x1;
    *y = x1;

    return gcd;
}

ll modInverse(int a, int m)
{
    int x, y;
    int g = gcdExtended(a, m, &x, &y);
        // m is added to handle negative x
    ll res = ((ll)x%m + (ll)m) % m;

    return res;
}

ll poww(ll x,ll n)
{
    if(n==0)
        return 1;
    else if(n==1) return x;
    else if(n%2 == 0)        //n is even
        return poww(x*x,n/2);
    else                              //n is odd
        return x*poww(x*x,(n-1)/2);
}

ll modularExponentiation(ll x,ll n,ll M)
{
    ll result=1;
    while(n>0)
    {
        if(n % 2 ==1)
            result=(result * x)%M;
        x=(x*x)%M;
        n=n/2;
    }
    return result;
}

template<typename T>
T maxx(T a,T b)
{
  if(a<b) re b;
  re b;
}
template<typename T, typename... Args>
T maxx(T a,T b, Args... args)
{
    re(maxx(maxx(a,b),args...));
}

template<typename T>
T minn(T a,T b)
{
  if(a<b) re a;
  re b;
}
template<typename T, typename... Args>
T minn(T a,T b, Args... args)
{
    re(minn(minn(a,b),args...));
}

inline ll min(ll a,ll b)
{
  if(a<b) re a;
  else re b;
}
inline ll max(ll a,ll b)
{
  if(a<b) re b;
  else re a;
}

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

    if (a == b)
        return a;

    if (a > b)
        return gcd(a-b, b);
    else return gcd(a, b-a);
}

ll ncr(int n,int r)
{
  ll ans=1;
  r=min(r,n-r);
  forup(i,r)
  {
    ans=(ans*(n-i)/(i+1))%N;
  }
  re ans;
}

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

  int t=1;
  //cin>>t;
  while(t--)
  {
    ll n,m,k;
    cin>>n;
    cout<<(n+1)/2;

  }


  return 0;
}


Measured memory_bytes: 256
x, n = map(int, input().split())
p = list(map(int, input().split()))
i, ans = 0, 0
a = 1
while a:
    if x not in p: print(x); break
    for i in range(max(p)+2):
        if x+i not in p:
            if x-i not in p:
                ans=x-i
                break
            ans=x+i
            break
        if x-i not in p:
            ans=x-i
            break
    print(ans)
    a = 0


Measured memory_bytes: 9160
import math
from functools import reduce


def gcd(*numbers):
    return reduce(math.gcd, numbers)


n = int(input())

ans = 0

for i in range(1, n + 1):
    for j in range(i, n + 1):
        for k in range(j, n + 1):
            cnt = gcd(i, j, k)
            if i == j and j == k:
                ans += cnt
            elif (i == j and i != k) or (i == k and i != j) or (j == k and j != i):
                ans += cnt * 3
            else:
                ans += cnt * 6

print(ans)


Measured memory_bytes: 9428
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>
#include <numeric>
#include <queue>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9) + 7;

int main(void) {
	ll a, b, c;
	cin >> a >> b >> c;
	
	ll x = c - a - b;
	
	if( (4LL * a * b) < x * x && x > 0 ) cout << "Yes" << endl;
	else cout << "No" << endl;
	
	return 0;
}


Measured memory_bytes: 256
/* ADLS1_6_A_CountingSort */
/* 20181121 AOJ */

#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <stdlib.h>
#define N 2000000
#define M 10000

void countingSort(int *A, int *B, int k);

int main(void){
	int n, i, A[N], B[N];

	i = 0;
	scanf("%d", &n);
	while(i < n) {
		scanf("%d", &A[i++]);
	}

	countingSort(A, B, n);

	i = 0;
	while(i < n) {
		if(i) printf(" ");
		printf("%d", B[i++]);
	}

	printf("\n");

	return 0;
}

void countingSort(int *A, int *B, int k) {
	int C[M + 1] = {0};
	int i = 0;

	i = 0;
	while(i < k) {
		C[A[i++]]++;
	}

	i = 1;
	while(i <= M ) {
		C[i] += C[i - 1];
		i++;
	}

	i = k;
	while(i--) {
		B[C[A[i]] - 1] = A[i];
		C[A[i]]--;
	}
}


Measured memory_bytes: 17384
#pragma GCC optimize(2)
#include<bits/stdc++.h>
#define ll long long
#define maxn 1000005
#define inf 1e9
#define eps 1e-10
using namespace std;

inline int read()
{
	int x=0,w=1; char c=getchar();
	while(c<'0'||c>'9') {if(c=='-') w=-1; c=getchar();}
	while(c<='9'&&c>='0') {x=(x<<1)+(x<<3)+c-'0'; c=getchar();}
	return w==1?x:-x;
}

int a[maxn],n,k,c,cnt,ans=1;
set <int> s;

int main()
{
	n=read(); k=read();
	for(int i=1;i<=n;i++) a[i]=read();
	for(int i=1;i<n;i++)
	{
		if(a[i]<a[i+1]) c++; else c=0;
		if(c==k-1) cnt++;
	}
	for(int i=1;i<=k;i++) s.insert(a[i]);
	for(int i=k+1;i<=n;i++)
	{
		s.erase(a[i-k]);
		if(a[i-k]>*s.begin()||a[i]<*s.rbegin()) ans++;
		s.insert(a[i]);
	}
	cout<<ans-max(0,cnt-1)<<endl;
	return 0;
}

Measured memory_bytes: 10368
def main():
  N = int(input())
  ans = 0
  
  for i in range(3, N+1, 2): #1は調べる必要がない
    count = 2 # 1と自分

    for j in range(3, (N + 1) // 2, 2):
      if(i % j == 0):
        count += 1
      
    if(count == 8):
      ans += 1

  print(ans)

if __name__ == "__main__":
  main()

Measured memory_bytes: 2940
N,D=map(int,input().split())

X=[list(map(int,input().split())) for i in range(N)]

ANS=0
import math

for i in range(N-1):
    for j in range(i+1,N):
        DIS=math.sqrt(sum([(X[i][k]-X[j][k])**2 for k in range(D)]))

        if DIS==int(DIS):
            ANS+=1

print(ANS)
        

Measured memory_bytes: 3060
(let* ((n (read))
       (m (read))
       (c (make-array n :initial-element 0)))
    (loop for i from 0 to (- m 1)
        do (let ((a (read)) (b (read)))
                (incf (aref c (- a 1)))
                (incf (aref c (- b 1)))))
    (loop for i from 0 to (- n 1)
        do (progn (princ (aref c i))
                  (princ #\LineFeed))))

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

int main(){
      int a = 1;
      int b = 2;
      int x,y;cin >> x >> y;
      int aa = 0;
      int bb = 0;
      while(aa - x != bb - y){
            aa = (a*(a - 1)) / 2;
            bb = (b*(b - 1)) / 2;
            a++;b++;
      }
      cout << aa - x;
}

Measured memory_bytes: 256
@D=map[glob<>],@@=0..$'-<>=~$";map{$j=0;for$x(split){$k=($i+$j++)%3;--$x;$$k[$_]+=$D[$x][$_]for@@}++$i}<>;$\=1e15;for$i(@@){for$j(@@){$\-=$-=$i-$j&&$i-$_&&$j-$_&&$\-$0[$i]-$1[$j]-$2[$_]for@@}}print

Measured memory_bytes: 1664
#include<bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
int n,c;
int a[33][33];
int b[514][514];
int cnt[4][33];
signed main(){
	cin>>n>>c;
	rep(i,c){
		rep(j,c){
			cin>>a[i][j];
		}
	}
	rep(i,n){
		rep(j,n){
			cin>>b[i][j];
			b[i][j]--;
			cnt[(i+j)%3][b[i][j]]++;
		}
	}
	int ans=1000000000;
	rep(i,c){
		rep(j,c){
			if(i==j)continue;
			rep(k,c){
				int mem=0;
				if(i==k||j==k)continue;
				rep(l,c)mem+=cnt[0][l]*a[l][i];
				rep(l,c)mem+=cnt[1][l]*a[l][j];
				rep(l,c)mem+=cnt[2][l]*a[l][k];
				ans=min(ans,mem);
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 2304
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,n) for(int i=0;i<n;i++)
#define why(n,x) int n;while(cin >>n,n!=x)
#define iFOR(i,x,n)for(int i=x;i<n;i++)
#define fin <<'\n'
#define __ <<" "<<
#define ___ <<" "
#define bash push_back
#define ALL(x) x.begin(),x.end()
#define SWAP(a,b) ((a != b) && (a += b,b = a - b,a -= b))
//#define int long long
typedef long long ll;
typedef pair < int , int >  pii;
typedef vector < int > vit;
typedef map < string , int > mstit;
typedef vector < pii > vpi ;
typedef greater < pii > gpi;
typedef priority_queue < pii , vpi , gpi > dijk ;
static const signed int INF = 0x3f3f3f3f;
static const signed long long LINF = 0x3f3f3f3f3f3f3f3fLL;
static const signed int SMOD = 1000000007;
static const signed int NMOD = 1000000009;
static const signed int dx[]={1,0,-1,0,1,1,-1,-1};
static const signed int dy[]={0,-1,0,1,-1,1,-1,1};

bool inside(int x,int y,int w,int h){return (x>=0 && y>=0 && x<w && y<h);}
template<class T>T abs(T &x){return x<0 ? -x : x;}
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; }
int qp(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}


inline void solve(){

    int n;
    int a[305][305];
    bool b[305][305]={};
    bool wf = false;
    long long ans = 0;
    cin >> n;
    for(int i = 0; i < n; i++) {
        for(int j = 0; j < n; j++){
            cin >> a[i][j];
        }
    }
    for(int i = 0; i < n; i++) {
        for(int j = 0; j < n; j++) {
            for(int k = 0; k < n; k++) {
                if(chmin(a[j][k],  a[j][i] + a[i][k])) wf = true;
                if(i==j||j==k||k==i) continue;
                if(a[j][k] == a[j][i] + a[i][k])
                    b[j][k] = true;
                
                
            }
        }
    }

    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            if(!b[i][j]) ans += a[i][j];
        }
    }
    if(wf) cout << -1;
    else   cout << ans/2;
    cout fin;
  

}
struct xyz{ xyz(){ cin.tie(0), ios::sync_with_stdio(false); cout <<fixed<<setprecision(12);};}xyzzy;signed main(){solve();return 0;}


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

int main() {
  int A, B, C, D;
  
  cin >> A >> B >> C >> D;
  int AB = A + B;
  int CD = C + D;

  if ( AB > CD ) {
    cout << "Left" << endl;
  }
  else if ( AB == CD ) {
    cout << "Balanced" << endl;
  }
  else {
    cout << "Right" << endl;
  }
 
}


Measured memory_bytes: 256
#include <queue>
#include <utility>
#include <vector>
#include <unordered_map>
#include <map>
// #include <fstream>
#include <iostream>
#include <algorithm>
#include <numeric>
#include <cmath>

using namespace std;
const long long mod = 1000000007;


int main() {
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    int n,m;
    cin >> n >> m;
    long long pen = 0;
    vector<int> R(n, 0);
    long long ac = 0;
    for (int i = 0; i < m; i++) {
        int x;
        string s;
        cin >> x >> s;
        x--;
        if (R[x] < 0) {
            continue;
        } else {
            if (s == "AC") {
                ac++;
                pen += R[x];
                R[x] = -1;
            } else {
                R[x]++;
            }
        }
    }
    cout << ac << " " << pen;
    return 0;
}


Measured memory_bytes: 640
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <string>
#include <cstring>
#include <queue>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <map>
#include <numeric>
#include <functional>
#include <cmath>
#include <cassert>
#include <string>
#include <iostream>

using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, ll> PL;
const ll mod = 1000000007;
const ll MOD = 1000000007;
const ll INF = 1LL << 60;
#define PI (acos(-1))

bool dp[81][81][16001];
ll a[81][81], b[81][81];
ll solve()
{

    ll h, w;
    cin >> h >> w;
    for(int i=0; i < h; i++){
        for(int j=0; j < w; j++){
            cin >> a[i][j];
        }
    }
    for(int i=0; i < h; i++){
        for(int j=0; j < w; j++){
            cin >> b[i][j];
        }
    }
    dp[0][0][abs(a[0][0] - b[0][0])] = true;
    for(int i=0; i < h; i++){
        for(int j=0; j < w; j++){
            for(int k=0; k < 16000; k++){
                if(i + 1 < h)
                    dp[i + 1][j][k] |= dp[i][j][k +
                                                abs(a[i + 1][j] - b[i + 1][j])] or
                                       dp[i][j][abs(k - abs(a[i + 1][j] - b[i + 1][j]))];
                if (j + 1 < w)
                    dp[i][j + 1][k] |= dp[i][j][k +
                                                abs(a[i][j + 1] - b[i][j + 1])] or
                                       dp[i][j][abs(k - abs(a[i][j + 1] - b[i][j + 1]))];
            }}}

    for(int i=0; i < 16000; i++){
        if(dp[h - 1][w - 1][i]) {
            cout << i << endl;

    break;
        }
}


    return 0;
}

int main()
{
    //cout.precision(10);
    ios::sync_with_stdio(false);
    cin.tie(0);

    solve();
}


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



void Naka(int W,int H){
    for(int i=1;i<=H;i++){
        for(int j=1;j<=W;j++){
            if(i==1||i==H){
                cout<<"#";
            }
            else if(j==1||j==W){
                cout<<"#";
            }
            else{
                cout<<".";
            }
        }
        cout<<endl; 
    }
    cout<<endl;
}

int main(){
    int W,H;
    while(true){
        cin>>H>>W;
        if(H==0&&W==0){
            break;
        }
        Naka(W,H);
    }
    
}


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


k, s = map(int, input().split())

ans = 0

if s == 3*k:
    ans = 1
elif s > 3*k:
    ans = 0
elif s == k:
    ans = int((k + 1) * (k + 2) / 2)
else:
    l = k
    
    while l >= 0:
        t_sum = s - l
        m = s - t_sum
        
        if t_sum > 2*k:
            break
        
        if m < k:
            m = k
            
        while m >= 0:
            n = s - l - m
            
            if n > k:
                break
            
            if n >= 0:
                ans += 1

            m -= 1
        l -= 1

print(ans)


Measured memory_bytes: 9124
import java.util.*;

public class Main {

  public static void main (String[] args) {

    Scanner sc = new Scanner(System.in);

    int N = sc.nextInt();
    int[] A = new int[N];

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

    sc.close();

    int gcd = gcd(A[0], A[1]);

    for (int i = 2; i < N-1; i++) {
      gcd = gcd(gcd, A[i]);
    }

    System.out.println(gcd);

  }

  public static int gcd(int x, int y){

    if (x < y) {
      int t = x;
      x = y;
      y = t;
    }

    while (y > 0) {
      int r = x % y;
      x = y;
      y = r;
    }

    return x;
    
  }

}

Measured memory_bytes: 50312
#include <iostream>
#include <queue>
#include <set>
#include <vector>
#include <algorithm>
using namespace std;

typedef long long ll;
ll k,n;
typedef pair<ll,ll> P;
set<ll> bonus;
vector<P> sushi;
int main() {
  cin >> n >> k;
  priority_queue<P,vector<P>,greater<P> > p1;
  priority_queue<P> p2;

  for(int i = 0; i < n; i++) {
    ll t,d;
    cin >> t >> d;
    sushi.push_back(P(d,t));
    p2.push(P(d,t));
  }

  sort(sushi.begin(),sushi.end(),greater<P>() );
  ll ans = 0;
  ll x = 0;
  for(int i = 0; i < k; i++) {
    if(bonus.find(sushi[i].second) == bonus.end()) {
      x++;
      bonus.insert(sushi[i].second);
     
    }
    else {
      p1.push(sushi[i]);
    }
    ans += sushi[i].first;
  }
  ans += x * x;
  //  cout << ans << endl;
  ll E = 1;
  ll tmp = ans - x * x;
  while(!p2.empty()) {
    if(p1.empty()) break;
    P a = p1.top();
    p1.pop();
    tmp -= a.first;
    while(!p2.empty()) {
      P b = p2.top();
      p2.pop();
      if(bonus.find(b.second) == bonus.end()) {
	bonus.insert(b.second);
	tmp += b.first;
	//	cout << tmp << endl;
	//	cout <<b.first<<"  "<<b.second<<endl;
	ans = max(ans,tmp + (x + E) * (x + E));
	E++;
	break;
      }
    }
  }
  cout << ans << endl;
}
  


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

typedef long long ll;
typedef unsigned long long ull;

ll conv(int station, int company){
    return station*10000000LL+company;
}

int main(){
    int N,M;
    cin >> N >> M;
    map<ll,vector<ll>> E;
    for(int i=0;i<M;i++){
        int p,q,c;
        cin >> p >> q >> c;
        E[conv(p,c)].push_back(conv(q,c));
        E[conv(p,c)].push_back(conv(p,0));
        E[conv(p,0)].push_back(conv(p,c));
        E[conv(q,c)].push_back(conv(p,c));
        E[conv(q,c)].push_back(conv(q,0));
        E[conv(q,0)].push_back(conv(q,c));
    }

    deque<pair<ll,ll>> Q;
    unordered_set<ll> checked;
    Q.push_back(make_pair(conv(1,0),0));
    while(!Q.empty()){
        auto t=Q.front();
        Q.pop_front();
        if(t.first/10000000LL==N){
            cout << t.second << endl;
            return 0;
        }
        if(checked.count(t.first)>0) continue;
        checked.insert(t.first);
        for(ll x:E[t.first]){
            if(checked.count(x)>0) continue;
            if(t.first%10000000LL==0){
                Q.push_back(make_pair(x,t.second+1));
            }else{
                Q.push_front(make_pair(x,t.second));
            }
        }
    }
    cout << "-1" << endl;
    return 0;
}

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

using namespace std;

long long getSum(vector<int> v)
{
	long long sum = 0;
	for(size_t i = 0; i < v.size(); i++){ sum += v[i]; }
	return sum;
}

int main()
{
	vector<int> list;
	int num = 0;
	cin >> num;

	int tmp = 0;
	for(int i = 0; i < num; i++)
	{
		cin >> tmp;
		list.push_back(tmp);
	}
	
	cout << *min_element(list.begin(), list.end()) << " "
		 << *max_element(list.begin(), list.end()) << " "
		 << getSum(list) << endl;

	return 0;
}

Measured memory_bytes: 3252
import java.util.*;

class Main {
    public static void main( String[] args){
        Scanner sc = new Scanner( System.in);
        int a =sc.nextInt();
        int b = sc.nextInt();
        if((a<1 || 100<a) || (b<1 || 100<b)){
            System.exit(-1);
        }
        int area = a*b;
        int length = 2*(a+b);
        System.out.println(area+" "+length);
    }
}

Measured memory_bytes: 26224
#include <iostream>
using namespace std;
int main(void){
   int a,b;
   cin>>a>>b;
   if (a<b){
       cout<<"a < b"<<endl;
   } 
   if (a>b){
       cout<<"a > b"<<endl;
   }
   if (a==b){
      cout<<"a == b"<<endl;  
   }
}



Measured memory_bytes: 3084
#include<cstdio>
#include<cstring>
#include<algorithm>
#define ll long long
using namespace std;
const int N=500100;
inline int read(){
	int x=0,f=0,c=getchar();
	for(;c>'9'||c<'0';f=c=='-',c=getchar());
	for(;c>='0'&&c<='9';c=getchar())
	x=(x<<1)+(x<<3)+c-'0';return f?-x:x;
}
inline void write(ll x){
	if(x<0)putchar('-'),x=-x;
	if(x>9)write(x/10);putchar(x%10+'0');
}
struct cqz{int l,r;}a[N];
ll ans;int n,m,i,sl,sm,x[N],t[N];
int main(){
	//freopen("1.out","w",stdout);
	n=read();m=read();m=m+m;ans=m;
	for(i=1;i<=n;i++)x[i]=read();
	for(i=1;i<=n;i++){
		t[i]=read();
		ans+=(t[i]/m)*m;t[i]=t[i]%m;
		if(t[i]==0)continue;
		a[i].l=(t[i]<=x[i]+x[i]);
		a[i].r=(t[i]<=m-x[i]-x[i]);ans+=m;
	}
	for(i=1;i<n;i++){
		if(sl&&a[i].r){
			if(a[i].l)sm++;
			sl--;ans-=m;
		}else if(!a[i].l&&a[i].r){if(sm)sm--,sl++;}
		else if(a[i].l)++sl;
	}if(a[n].r)ans-=m;write(ans);puts("");
	return 0;
}

Measured memory_bytes: 5632
my ($N, $Q) = split(' ', <>);
my $S = <>;

my @t = (0);

for my $i (0..$N) {
     $t[$i+1] = substr($S, $i,2) eq 'AC' ? $t[$i] + 1 : $t[$i]
}

for (1..$Q) {
    my ($L, $R) = split(' ', <>);
    print $t[$R-1] - $t[$L-1], $/;
}

Measured memory_bytes: 4352
#define _USE_MATH_DEFINES
#include  <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <string>
#include<math.h>
#include<iomanip>
#include<stdio.h>
#include <stdlib.h>
#include<stdio.h>
#include <queue>
#include<map>
#include <sstream>
#include<set>
#include<stack>

//#include<bits/stdc++.h>


using namespace std;



int main() {
	
	int n;
	cin >> n;
	int v = 0,c=0,d=0;
	vector<int>a;
	vector<pair<int, int>>g;
	for (int i = 0; i < n; i++) {
		int x, y, h;
		cin >> x >> y >> h;
		g.push_back(make_pair(x, y));
		a.push_back(h);
		if (h>v) { v = h; c = x, d = y; }
		if (n == 1) {
			cout << x << " " << y << " " << h << endl;
			return 0;
	}
	}
	

	
		
		for (int j = 0; j <= 100; j++) {
			
			for (int k = 0; k <= 100; k++) {
				set<int>p; int r;
				bool f = 0;
				int M = v + abs(c - j) + abs(d - k);
				for (int i = 0; i < n; i++) {
	
					
				int m = (abs(g[i].first - j) + abs(g[i].second - k));//, 0);
			//	m = abs(m);
				//int t = v + abs(c - j) + abs(d - k);
				if (max(M-m, 0) != a[i]) {
					p.insert(1); p.insert(100);
					f = 1;
				}
				
				if(m+a[i])p.insert(m+a[i]);
				r = m+a[i];
			//	if (p.size() > 2)break;
				//cout << r << endl;
			}
	//			if (j == 2 && k == 2)cout << j << " " << k << " "<<r;
			if (f==0) {
				cout << j << " " << k << " " << M << endl;
				return 0;
			}
		}
	}


	return 0;

}

Measured memory_bytes: 256
## for use in beginner level questions where speed is key
## and also for single test case code
## mastercopy for x,y,z

import sys
import heapq, functools, collections
import random
from collections import Counter, defaultdict

# read line as a string
# strr = input()

# read line as an integer
k = int(input())

# read one line and parse each word as a string
# lst = input().split()

# read one line and parse each word as an integer
# arr = list(map(int,input().split()))

print((2199-k)//200)


Measured memory_bytes: 76864
#include <cstdio>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <math.h>
#include <queue>
#define ll long long
#define pb push_back
#define vi vector<int>
#define vl vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define f first
#define s second
#define mp make_pair
#define forn(i,n) for(int i=0;i<n;i++)

using namespace std;

int main()
{
    int k,x;
    scanf("%d%d",&k,&x);
    if(k*500>=x)printf("Yes\n");
    else printf("No\n");
    return 0;
}

Measured memory_bytes: 128
a=raw_input()
b=raw_input()
if len(a)<len(b):
	print "LESS"
elif len(a)>len(b):
	print "GREATER"
else:
	p=0
	flag=True
	while flag and p<len(a):
		if a[p]<b[p]:
			print "LESS"
			flag=False
		elif a[p]>b[p]:
			print "GREATER"
			flag=False
		else:
			pass
		p+=1
	if flag:
		print "EQUAL"

Measured memory_bytes: 2568
#include<bits/stdc++.h>
using namespace std;
#define int int64_t
#define PB push_back
#define loop(i,x,y) for(int i=x;i<y;i++)
#define rloop(i,x,y) for(int i=x;i>y;i--)
#define NL cout<<"\n"
#define ans(x) cout<<x<<"\n"
#define out(x) cout<<x<<" "
#define F first
#define S second
#define ansf(x,y) cout<<fixed<<setprecision(y)<<x<<endl;
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);
void solve()
{
  int r;
  cin>>r;
  ans(r*r);
}
signed main()
{
  // FAST;
  int T=1;
  // cin>>T;
  while(T--) solve();
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF 1001001001
typedef long long ll;
using namespace std;
int ch, cw, dh, dw, h, w;
vector<string> s(1000);
int dist[1000][1000];
void bfs(int xx, int yy) {
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			dist[i][j] = INF;
		}
	}
	int vx[4] = {0, 1, 0, -1};
	int vy[4] = {1, 0, -1, 0};
	dist[yy][xx] = 0;
	deque<pair<int, int>> q;
	q.push_back(make_pair(xx, yy));
	while (!q.empty()) {
		pair<int, int> v = q.front();
		q.pop_front();
		for (int i = 0; i < 4; i++) {
			int nx = v.first + vx[i];
			int ny = v.second + vy[i];
			if (0 <= nx && nx < w && 0 <= ny && ny < h && s[ny][nx] == '.' &&
				dist[ny][nx] > dist[v.second][v.first]) {
				dist[ny][nx] = dist[v.second][v.first];
				q.push_front(make_pair(nx, ny));
			}
		}
		for (int i = -2; i <= 2; i++) {
			for (int j = -2; j <= 2; j++) {
				int nx = v.first + i;
				int ny = v.second + j;
				if (0 <= nx && nx < w && 0 <= ny && ny < h &&
					s[ny][nx] == '.' &&
					dist[ny][nx] > dist[v.second][v.first] + 1) {
					dist[ny][nx] = dist[v.second][v.first] + 1;
					q.push_back(make_pair(nx, ny));
				}
			}
		}
	}
}
int main() {
	cin >> h >> w >> ch >> cw >> dh >> dw;
	ch--;
	cw--;
	dh--;
	dw--;
	for (int i = 0; i < h; i++) {
		cin >> s[i];
	}
	bfs(cw, ch);
	if (dist[dh][dw] == INF)
		cout << -1 << endl;
	else
		cout << dist[dh][dw] << endl;
	return 0;
}


Measured memory_bytes: 9436
#include <stdio.h>

int main(void) {
  int a, b, c, max, min;
  scanf("%d %d %d", &a, &b, &c);

  if(a > b) {
    if(a > c) {
      max = a;
      if(b > c) min = c;
      else min = b;
    }
    else {
      max = c;
      min = b;
    }
  }
  else if(b > c) {
    max = b;
    if(a > c) min = c;
    else min = a;
  }
  else {
    max = c;
    min = a;
  }

  printf("%d %d\n", min, max);

  return 0;
}



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

#define INF 1001001001
#define MAX 200005

int main() {
  int n, q;
  cin >> n >> q;
  fenwick_tree<ll> fw(n);
  rep(i,n) {
    int x; cin >> x;
    fw.add(i,x);
  }
  vector<ll> ans;
  rep(i,q) {
    int t;
    cin >> t;
    if (t==0) {
      int p, x; cin >> p >> x;
      fw.add(p,x);
    } else {
      int l, r; cin >> l >> r;
      ans.push_back(fw.sum(l,r));
    }
  }
  for (auto a : ans) cout << a << endl;

  return 0;
}


Measured memory_bytes: 10232
#include <iostream>
#include <cstdio>
#include <cassert>
#include <cstring>
#include <vector>
#include <valarray>
#include <array>
#include <queue>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <complex>
#include <random>

using namespace std;
using ll = long long;
using ull = unsigned long long;
template<class T = ll> constexpr T TEN(int n) {return (n==0)?1:10*TEN<T>(n-1);}

const int MP = 100100;
vector<int> pr;
vector<ull> bpr;

void first() {
    bool used[MP] = {};
    for (int i = 2; i < MP; i++) {
        if (used[i]) continue;
        pr.push_back(i);
        ull x = ((__int128(1)<<64) + i-1 ) / i;
        bpr.push_back(x);
        for (int j = 2*i; j < MP; j += i) {
            used[j] = true;
        }
    }
}

map<ll, int> fact(ll n) {
    int pc = (int)pr.size();
    map<ll, int> mp;
    while (n % 2 == 0) {
        n /= 2;
        mp[2]++;
    }
    while (n % 3 == 0) {
        n /= 3;
        mp[3]++;
    }
    for (int i = 2; i < pc; i++) {
        ll d = pr[i]; ull rd = bpr[i];
        while (true) {
            ll nd = __int128(n)*rd >> 64;
            if (nd * d != n) break;
            n = nd;
            mp[d]++;
        }
    }
    if (n > 1) mp[n]++;
    return mp;
}


int main() {
    first();
    using F = vector<ll>;
    map<F, F> g;
    map<F, int> a;
    int n;
    scanf("%d", &n);
    bool one = false;
    for (int i = 0; i < n; i++) {
        if (i % 1000 == 0) {
//            cout << i << " " << gc << endl;
        }
        ll s;
        scanf("%lld", &s);
        map<ll, int> fac = fact(s);
        F d0, d1;
        for (auto p: fac) {
            p.second %= 3;
            if (p.second == 1) {
                d0.push_back(p.first);
                d1.push_back(p.first);
                d1.push_back(p.first);
            } else if (p.second == 2) {
                d0.push_back(p.first);
                d0.push_back(p.first);
                d1.push_back(p.first);
            }
        }
        sort(d0.begin(), d0.end());
        sort(d1.begin(), d1.end());
        if (d0.size() == 0) {
            one = true;
            continue;
        }
        g[d0] = d1; g[d1] = d0;
        a[d0]++;
    }

    int ans = 0;
    for (auto p: g) {
        ans += max(a[p.first], a[p.second]);
    }
    cout << ans/2 + (one ? 1 : 0) << endl;
    return 0;
}


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

using namespace std;

int main(){
    int n;
    cin >> n;
    auto a1s=vector<int>(n, 0);
    auto a2s=vector<int>(n, 0);
    for(int i=0; i<n; ++i){
        cin >> a1s[i];
    }
    int sum_a2s=0;
    for(int i=0; i<n; ++i){
        cin >> a2s[i];
        sum_a2s+=a2s[i];
    }
    int sum_a1s=a1s[0];
    int res=sum_a1s+sum_a2s;
    for(int i=1; i<n; ++i){
        sum_a1s+=a1s[i];
        sum_a2s-=a2s[i-1];
        res=max(res, sum_a1s+sum_a2s);
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.lang.StringBuilder;

/*Question
/??\?????????????????????????????????????????£???????????????????£??????????????????????
/insert x: ??£?????????????????????????????? x ?????????????´?????¶?????¶???????
/delete x: ?????? x ??????????????????????´??????£????????????????????????????????????????????????????´?????????¨???????????´????????????????????????
/deleteFirst: ?????????????????????????´???????????????????
/deleteLast: ????????????????°????????´??????????????????? 
*/

/*Input
/??\????????\????????¢?????§?????????????????????
/n
/command1
/command2
/...
/commandn
???????????????????????° n ?????????????????????????¶???? n ??????????????????????????????????????????????¨?4?????????????????????????????§?????????????????´??°??¨???????????? 
*/

//DLList???????????????????????£????????????????????????
public class Main {
	public static void main(String[] args) throws Exception {
		String i = DLList();
		System.out.print(i);
	}

	/*DLList????????????
	/??????????§£??????????????????????????????????????????
	/??¨????????????n???????´??????????n????????????????????????
	/?????????????????????????????????????????????????????????
	/delete?????\???????????????????????¢???????????????????????????????????????????????????
	/@return String
	*/

	static String DLList() throws Exception {
		BufferedReader sc = new BufferedReader(new InputStreamReader(System.in));
		//????????¨
		StringBuilder bu = new StringBuilder();
		//n?????\???
		int n = Integer.parseInt(sc.readLine());
		//??????????????\?????¨
		String[] s = new String[2];
		//??\?????¨
		ArrayDeque <String> x = new ArrayDeque <String>();
		//???????????\???
		for (int i = 0;i < n;i++) {
			s = sc.readLine().split(" ");
			//deleteFirst??¨Last?????????????????????????????????delete?????¨char?????°?????°?????£????????????????????????
			s[0] += "e";
			if (s[0].charAt(0) == 'i') x.addFirst(s[1]);
			else if (s[0].charAt(6) == 'F') x.removeFirst();
			else if (s[0].charAt(6) == 'L') x.removeLast();
			else x.remove(s[1]);
		}
		bu.append(x.poll());
		bu.append(" ");
		for (String st:x) 
			bu.append(st+" ");
		bu.deleteCharAt(bu.lastIndexOf(" "));
		bu.append("\n");
		return bu.toString();
	}
}

Measured memory_bytes: 331688
n=int(input())
a=list(map(int,input().split()))
q=int(input())
bc=[list(map(int,input().split())) for i in range(q)]
d=[0 for i in range(pow(10,5)+1)]
s=sum(a)
for i in range(n):
    d[a[i]]+=1
for i in range(q):
    s+=(bc[i][1]-bc[i][0])*d[bc[i][0]]
    print(s)
    d[bc[i][1]]+=d[bc[i][0]]
    d[bc[i][0]]=0


Measured memory_bytes: 32888
import math
sd_anss = []
while True:
    n = int(input())
    if n == 0:
        break
    s = list(map(int, input().split()))
    mean = sum(s)/n
    Sum = 0
    for i in range(n):
        Sum += (s[i]-mean)**2
    sd_anss.append(math.sqrt(Sum/n))
for sd in sd_anss:
    print(sd)


Measured memory_bytes: 5700
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mt make_tuple
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef pair<string,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef tuple<int,int,int> tp;
typedef vector<tp> vt;
typedef vector<vd> vvd;
typedef pair<int,pii> pip;
typedef vector<pip>vip;
const double PI=acos(-1);
const double EPS=1e-7;
const int inf=1e9;
const ll INF=2e18;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int n;
vi used;
bool H=false;
vvi G;
int dfs(int a){
	used[a]=true;
	vi t;
	rep(i,G[a].size())if(used[G[a][i]]==0)
		t.pb(dfs(G[a][i]));
	
	int co=0;
	rep(i,t.size())if(t[i]%2)co++;
	if(co>=2){
		H=true;
		return 0;
	}else if(co==1)return 0;
	else return 1;
}
int main(){
	cin>>n;
	G=vvi(n);
	rep(i,n-1){
		int a,b;
		cin>>a>>b;
		a--;b--;
		G[a].pb(b);
		G[b].pb(a);
	}
	used=vi(n);
	int t=dfs(0);
	if(t||H)cout<<"First"<<endl;
	else cout<<"Second"<<endl;
}






Measured memory_bytes: 6272
io = STDIN
n,m=io.gets.chomp.split.map(&:to_i)
a,b=[],[]
n.times do
  a<<io.gets.chomp.split(//)
end
m.times do
  b<<io.gets.chomp.split(//)
end
def check2(i,j,m,a,b)
  (m).times do |x|
    (m).times do |y|
       return false unless a[x+i][y+j]==b[x][y]
    end
  end
  true
end
def check(n,m,a,b)
  (n-m+1).times do |i|
    (n-m+1).times do |j|
      return 'Yes' if check2(i,j,m,a,b)
    end
  end
  return 'No'
end
puts check(n,m,a,b)

Measured memory_bytes: 1916
object Main {
  import scala.io.StdIn.readLine
  def main(args: Array[String]): Unit = {
    val stdinList = readLine.split(" ").map(_.toInt)
    val p: Int = stdinList.head.toInt
    val q: Int = stdinList.tail.head.toInt
    val r: Int = stdinList.tail.tail.head.toInt
    val min: Int = (abc _ :: acb _ :: bac _ :: bca _ :: cba _ :: cab _ :: Nil).map(_ (p, q, r)).min
    println(min)
  }

  def abc(p: Int, q: Int, r: Int) = p + q

  def acb(p: Int, q: Int, r: Int) = r + q

  def bac(p: Int, q: Int, r: Int) = p + r

  def bca(p: Int, q: Int, r: Int) = q + r

  def cba(p: Int, q: Int, r: Int) = q + p

  def cab(p: Int, q: Int, r: Int) = r + q
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vll;
const int SIZE = 100005;
const int INF = int (1e9) + int (1e5);
const ll INFL = ll(2e18) + ll(1e10);
const ll MOD = 1E9 + 7;
#define rep(i,n) for (long long i=0;i<(n);++i)
#define repp(i,a,b) for (long long i=(a);i<(b);++i)
#define per(i,x) for(long long i = (x) ; i >= 0 ; --i)
#define perr(i,x,y) for(long long i = (x) ; i >= (y) ; --i)
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define all(a) (a).begin(),(a).end()
#define lla(a) (a).rbegin(),(a).rend()
#define p(x) cout<<x<<" "
#define pn(x) cout<<x<<"\n"
#define p2(x,y) cout<<x<<" "<<y<<"\n"
#define p3(x,y,z) cout<<x<<" "<<y<<" "<<z<<"\n"
#define p4(x,y,z,w) cout<<x<<" "<<y<<" "<<z<<" "<<w<<"\n"
#define p5(x,y,z,w,s) cout<<x<<" "<<y<<" "<<z<<" "<<w<<" "<<s<<"\n"
#define FAST ios_base::sync_with_stdio(false); cin.tie(0)

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cout << name << " : " << arg1 << std::endl;
        //use cerr if u want to display at the bottom
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
#else
#define trace(...)
#endif


//template<class T>
//bool isPrime(T n){
//    if(n==1)return false;
//    T i = 2;
//    while(i*i<=n){
//       if(n%i==0)return false;
//       i+=1;
//    }
//    return true;
//}

// bool prime[100005];
// void seive()
// {
//     memset(prime,true,sizeof(prime));
//     prime[0]=0;
//     prime[1]=0;
//     for(ll p=2;p*p<=100000;p++)
//     {
//         if(prime[p]==true)
//         {
//             for(ll i=p*2;i<=100000;i+=p)
//             prime[i]=false;
//         }
//     }    
// }

// ll power(ll n,ll k, ll mod){
//     if(k==0)
//         return 1;
//     if(k==1)
//         return n%mod;

//     ll get=power(n,k/2,mod);
//     ll ret = ((get%mod)*(get%mod))%mod;

//     if(k%2)
//         ret = ((ret%mod)*(n%mod))%mod;

//     return ret%mod;
// }

int main(){
//    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);
    FAST;
    
    int n,k; cin>>n>>k;
    vll a(n);
    rep(i,n)cin>>a[i];
    vll dp(n);
    dp[0] = 0;
    dp[1] = abs(a[0]-a[1]);
    repp(i,1,n){
        dp[i] = dp[i-1] + abs(a[i]-a[i-1]);
        repp(j,2,k+1){
            if(i-j>=0){
                dp[i] = min(dp[i],dp[i-j]+abs(a[i]-a[i-j]));
            }else{
                break;
            }
        }
    }
    p(dp[n-1]);
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
	return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
	o<<"{";
	for(const T& v:vc) o<<v<<",";
	o<<"}";
	return o;
}
using ll = long long;
template<class T> using V = vector<T>;
template<class T> using VV = vector<vector<T>>;
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n-1); }

#ifdef LOCAL
#define show(x) cerr << "LINE" << __LINE__ << " : " << #x << " = " << (x) << endl
#else
#define show(x) true
#endif

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);		//DON'T USE scanf/printf/puts !!
	cout << fixed << setprecision(20);
	
	int N,K;
	cin >> N >> K;
	V<int> a(N);
	rep(i,N) cin >> a[i];
	int ans = 0;
	rep(l,N+1) rep(r,N+1){
		if(l+r > N) continue;
		if(l+r > K) continue;
		int del = K - (l+r);
		V<int> v;
		rep(i,l) v.pb(a[i]);
		rep(i,r) v.pb(a[N-1-i]);
		sort(all(v),greater<int>());
		while(!v.empty() && v.back() < 0 && del > 0){
			v.pop_back();
			del--;
		}
		int tmp = 0;
		for(int x: v) tmp += x;
		chmax(ans,tmp);
	}
	cout << ans << endl;
}


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

namespace CSharp_practice
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var p = new double[n][];
            for(int i = 0; i < n; i++)
            {
                p[i] = Console.ReadLine().Split(' ').Select(double.Parse).ToArray();
            }

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

            double ans = 0;
            var perm = new Permutation();
            var permArray = perm.Enumerate(array).ToArray();
            foreach(var item in permArray)
            {
                for (int i = 1; i < item.Length; i++)
                {
                    ans += Math.Sqrt(Math.Pow(p[item[i]][0] - p[item[i - 1]][0], 2.0) + Math.Pow(p[item[i]][1] - p[item[i - 1]][1], 2.0));
                }
            }

            var denominator = 1;
            for(int i = 1; i <= n; i++)
            {
                denominator *= i;
            }

            Console.WriteLine(ans / denominator);
        }

        public class Permutation
        {
            public IEnumerable<T[]> Enumerate<T>(IEnumerable<T> items)
            {
                return _GetPermutations<T>(new List<T>(), items.ToList());
            }

            private IEnumerable<T[]> _GetPermutations<T>(IEnumerable<T> perm, IEnumerable<T> items)
            {
                if (items.Count() == 0)
                {
                    yield return perm.ToArray();
                }
                else
                {
                    foreach (var item in items)
                    {
                        var result = _GetPermutations<T>(perm.Concat(new T[] { item }),
                                                            items.Where(x => x.Equals(item) == false)
                                        );
                        foreach (var xs in result)
                            yield return xs.ToArray();
                    }
                }
            }
        }
    }
}


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

constexpr ll A = 1e9 + 7;
// vector<ll> fac(300001);
// vector<ll> ifac(300001);

ll mpow(ll x, ll n) {
    ll ans = 1;
    while (n!=0)
    {
        if(n&1) ans = ans*x % A;
        x = x*x % A;
        n = n >> 1;
    }
    return ans % A;
}

// ll comb(ll a, ll b) {
//     if(a==0 && b==0) return 1;
//     if(a<b || a < 0) return 0;
//     ll tmp = ifac[a-b] * ifac[b] % A;
//     return tmp * fac[a] % A;
// }

int main(int argc, char const *argv[])
{
    ll n;
    int a, b;
    cin >> n >> a >> b;
    // fac[0] = ifac[0] = 1;
    // for (size_t i = 0; i < 300000; i++)
    // {
    //     fac[i+1] = fac[i] * (i+1) % A;
    //     ifac[i+1] = ifac[i] * mpow(i+1, M-2);  
    // }
    
    // 普通に考えれば2^n
    ll ans = mpow(2, n);
    // nCaの計算
    ll nCa = 1;
    ll divider = 1;
    if(a!=1) {
        for(int i=1; i<=a; i++) {
            nCa *= n - a + i;
            nCa %= A;
            divider *= i;
            divider %= A;
        }
        nCa *= mpow(divider, A-2);
        nCa %= A;
    } else nCa = n;
    
    ll nCb = 1;
    divider = 1;
    if(b!=1) {
        for(int i=1; i<=b; i++) {
            nCb *= n - b + i;
            nCb %= A;
            divider *= i;
            divider %= A;
        }
        nCb *= mpow(divider, A-2);
        nCb %= A;
    } else nCb = n;
    ans += (A-nCa);
    ans %= A;
    ans += (A-nCb);
    ans %= A;
    if (ans == 0) ans = A - 1;
    else ans--;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int a = in.nextInt(), b = in.nextInt(), c = in.nextInt();
            out.println(c >= a && c <= b ? "Yes" : "No");
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 21588
#include <iostream>
using namespace std;
int main(){
  int N;
  cin >> N;
  int X[N];
  for(int i=0;i<N;++i) {
    cin >> X[i];
  }
  int ans;
  int min = 9999999999;
  for(int j=1;j<=100;++j) {
    ans = 0;
    for(int k=0;k<N;++k) {
      if(j>=X[k]) ans += (j - X[k]) * (j - X[k]);
      if(j<X[k])  ans += (X[k] - j) * (X[k] - j);
    }
    if(min > ans) min = ans;
  }
  cout << min;
}


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

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

    vector<pair<int, int>> a(n);
    int weight, value;
    for (int i = 0; i < n; i++) {
        cin >> weight >> value;
        a[i] = make_pair(weight, value);
    }

    vector<vector<long long>> dp(n + 1, vector<long long>(w + 1, 0));
    for (int i = 0; i < n; i++) {
        for (int j = 0; j <= w; j++) {
            if (a[i].first <= j) {
                dp[i + 1][j] = max(dp[i + 1][j], dp[i][j - a[i].first] + a[i].second);
            }
            dp[i + 1][j] = max(dp[i + 1][j], dp[i][j]);
        }
    }

    cout << dp[n][w] << endl;
}

Measured memory_bytes: 80256
#include<bits/stdc++.h>
using namespace std;
#define lc "\n"
#define fast_io ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(0)
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define int long long
#define c(a,n) for(int i = 0; i < n; i++) cin >> a[i];
#define ffor(n) for(int i = 0; i < n; i++)
#define float long double
typedef vector<int> vi;
typedef vector<float> vf;
typedef vector<vi> vii;
typedef vector<string> vs;
typedef vector<long long> vll;
typedef map<string,int> msi;
typedef map<int,int> mii;
typedef unordered_map<string,int> umsi;
 
 
int32_t main()
{
    fast_io;
    int n,w;
    cin>>n>>w;
    vector<pair<int,int>>a(n);
    for(int i=0;i<n;i++) cin>>a[i].first>>a[i].second;
    vi dp(w+1,0);
    dp[0]=0;

    for(int i=0;i<n;i++)
    {
        for(int wj=w-a[i].first;wj>=0;wj--)
        {
            dp[wj+a[i].first]=max(dp[wj+a[i].first],dp[wj]+a[i].second);
        }
    }
    int ans=*max_element(dp.begin(),dp.end());
    cout<<ans<<lc;

    return 0;
}

Measured memory_bytes: 3924
N = int(input())
A = list(map(int, input().split()))
RedWine = 1
for i in range(N):
    RedWine *= A[i]
    if RedWine > 1000000000000000000:
        break
if RedWine > 1000000000000000000:
    if A.count(0) == 0:
        print(-1)
    else:
        print(0)
else:
    print(RedWine)


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

using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }

const ll mod = 1e9 + 7;
const ll INF = -1 * ((1LL << 63) + 1);
const int inf = -1 * ((1 << 31) + 1);
ll a4,a2,a24,a14,a74;
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    int N;
    cin >> N;
    map<int,int> mp;
    // N! の約数を全て列挙する
    for(int i=1;i<=N;i++){
        int t = i;
        for(int j=2;j<=N;j++){
            int cnt = 0;
            while(t%j==0 && t>0){
                cnt++;
                t/=j;
            }
            if(cnt)mp[j] += cnt;
        }
        if(t>1)mp[t]++;
    }
    
    ll ans = 0;
    for(auto x:mp){
        // cout << x.first << " " << x.second << endl;
        if(x.second>=4)a4++;
        if(x.second>=2)a2++;
        if(x.second>=14)a14++;
        if(x.second>=24)a24++;
        if(x.second>=74)a74++;
    }
    ans += a4*(a4-1)/2*(a2-2) + a14*(a4-1) + (a24)*(a2-1) + a74;
    cout << ans << endl;
}

Measured memory_bytes: 256