akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
import java.io.*;
import static java.lang.System.in;

public class Main {
    static int n,k;
    static long mod = 1000000000+7;
    static long[] fac,inv;
    static int[] id,size;
    //static long mod = 1000000000+7;
    //static HashSet<Integer>[] graph;
    //static ArrayList<Integer>[] rec = new ArrayList[3];
    public static void main(String[] args)throws IOException {
        //BufferedReader reader = new BufferedReader(new InputStreamReader(in));
        //String[] buf = reader.readLine().split(" ");
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        PrintWriter out = new PrintWriter(System.out);
        HashSet<String> res = new HashSet<>();
        if(n%2==0){
            for(int i=1;i<=n;i++){
                for(int j=1;j<n;j++){
                    if(i==j||i+j==n+1) continue;
                    res.add(getKey(i,j));
                }
            }
        }else{
            for(int i=1;i<n;i++) res.add(getKey(i,n));
            for(int i=1;i<n;i++){
                for(int j=1;j<n;j++){
                    if(i==j||i+j==n) continue;
                    res.add(getKey(i,j));
                }
            }
        }
        out.println(res.size());
        for(String w:res) out.println(w);
        out.flush();
    }
    static String getKey(int i, int j){
        if(i>j){
            int c = i;
            i = j; j = c;
        }
        return Integer.toString(i)+" "+Integer.toString(j);
    }
}

Measured memory_bytes: 24020
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main() {
  string str = "";
  cin >> str;
  string cp = "";
  for (char c : str) {
    if (c != 'x') {
      cp.push_back(c);
    }
  }
  string cp_rev = cp;
  reverse(cp_rev.begin(), cp_rev.end());
  if (cp != cp_rev) {
    cout << -1 << endl;
  } else {
    auto iter = str.begin(), iter_rev = str.end()-1;
    int cnt = 0;
    while (true) {
      if (iter >= iter_rev) {
        break;
      }
      if (*iter == *iter_rev) {
        iter++; iter_rev--;
      } else {
        cnt++;
        if (*iter == 'x') {
          iter++;
        } else {
          iter_rev--;
        }
      }
    }
    cout << cnt << endl;
  }
  return 0;
}


Measured memory_bytes: 512
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AtCoder
{
	class Program
	{
		static void Main(string[] args)
		{
			var s = Console.ReadLine();

			var isOK = false;

			var dream = "dream";
			var dreamLength = dream.Length;
			var dreamer = "dreamer";
			var dreamerLength = dreamer.Length;
			var erase = "erase";
			var eraseLength = erase.Length;
			var eraser = "eraser";
			var eraserLength = eraser.Length;

			var index = s.Length;

			while(index > 0)
			{
				if(index - dreamLength >= 0 && s.Substring(index - dreamLength, dreamLength) == dream)
				{
					index -= dreamLength;
				}
				else if(index - dreamerLength >= 0 && s.Substring(index - dreamerLength, dreamerLength) == dreamer)
				{
					index -= dreamerLength;
				}
				else if (index - eraseLength >= 0 && s.Substring(index - eraseLength, eraseLength) == erase)
				{
					index -= eraseLength;
				}
				else if (index - eraserLength >= 0 && s.Substring(index - eraserLength, eraserLength) == eraser)
				{
					index -= eraserLength;
				}
				else
				{
					break;
				}

				if(index == 0)
				{
					isOK = true;
				}
			}

			if(isOK)
			{
				Console.WriteLine("YES");
			}
			else
			{
				Console.WriteLine("NO");
			}
		}
	}
}


Measured memory_bytes: 11232
#include <iostream>
using namespace std;
int main(void){
    
    int a, b;
    char op;
    cin>>a>>op>>b;
    while(op!='?'){
        switch(op){
            case'+':
            cout<<a+b<<endl;
            break;
            case'-':
            cout<<a-b<<endl;
            break;
            case'*':
            cout<<a*b<<endl;
            break;
            case'/':
            cout<<a/b<<endl;
            break;
        }
        cin>>a>>op>>b;
    }
    
    
    
}


Measured memory_bytes: 3084
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
 
int calc(int p[], ll c[], int D, ll G) {
    int minCount = INT_MAX;
    for (int bit = 0; bit < (1 << D); ++bit) {
        int maxIdx = 0;
        ll total = 0;
        int count = 0;
        for (int i = 0; i < D; i++) {
            if (bit & (1 << i)) {
                total += (i + 1) * 100 * p[i] + c[i];
                count += p[i];
            } else {
                maxIdx = i;
            }
        }
        int plus = 0;
        int maxN = p[maxIdx];
        while (total < G && plus < maxN - 1) {
            plus++;
            total += (maxIdx + 1) * 100;
        }
        count += plus;
 
        if (G <= total && count < minCount) minCount = count;
    }
    return minCount;
}
 
void solve() {
    int D;
    ll G;
    cin >> D >> G;
 
    int p[D];
    ll c[D];
    for (int i = 0; i < D; ++i) {
        cin >> p[i] >> c[i];
    }
 
    cout << calc(p, c, D, G) << endl;
}
 
int main() {
    solve();
    return 0;
}

Measured memory_bytes: 256
s = input()
s = s[::-1]
n = len(s)

# stmp = s[::-1]
# for i in range(len(s)):
#     for j in range(i,len(s)):
#         sint = int(stmp[i:j+1])
#         if sint % 2019 == 0: 
#             print(n-j,n-i)
#             print(sint)
#             print()


rem2019_cnts = [0]*2019
rem2019_cnts[0] = 1
curr_rem = int(s[0])
rem2019_cnts[curr_rem] = 1
curr_10_rem = 1
ans = 0
for i,si in enumerate(s[1:]):
    sint = int(si)

    next_10_rem = (curr_10_rem*10)%2019
    next_rem = (next_10_rem*sint + curr_rem)%2019

    ans += rem2019_cnts[next_rem]
    rem2019_cnts[next_rem] += 1
    
    curr_10_rem = next_10_rem
    curr_rem = next_rem
    # print(i+2, curr_rem)

print(ans)

Measured memory_bytes: 74404
#include <iostream>

using namespace std;

int main(void){
  int data;
  int data_set;
  int box1,box2;
  int i,j,k,l;
  bool f;

  cin>>data_set;
  for(i=0;i<data_set;i++){
    box1=0;
    box2=0;
    f=false;
    for(j=0;j<10;j++){
      cin>>data;
      if(data>box1&&data>box2){
	if(box1<box2){
	  box2=data;
	}else{
	  box1=data;
	}
      }
      else if(data>box1){
	box1=data;
      }
      else if(data>box2){
	box2=data;
      }
      else{
	f=true;
      }
    }
    if(f){
      cout<<"NO"<<endl;
    }else{
      cout<<"YES"<<endl;
    }
  }
  return(0);
}

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

using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(int i=n; i>-1; --i)
#define ALL(a) (a).begin(),(a).end()
#define FILL(a,n,x); REP(i,(n)){ (a)[i]=(x); }
#define CINA(a,n); REP(i,(n)){ cin >> (a)[i]; }
#define FILL2(a,n,m,x); REP(i,(n)){ REP(j,(m)){(a)[i][j]=(x);} }
#define CINA2(a,n,m); REP(i,(n)){ REP(j,(m)){cin >> (a)[i][j];} }
#define Liny "Yes\n"
#define Linn "No\n"
#define LINY "YES\n"
#define LINN "NO\n"

#define umap unordered_map
//cout << setfill('0') << right << setw(4) << 12; // "0012"
int keta(ll x){ if(x<10){return 1;} else{return keta(x/10) + 1;}}
int keta_wa(ll x){ if(x<10){return x;} else{return keta_wa(x/10) + x%10;} }
int ctoi(char c){ return ( (c>='0' && c<='9')? c - '0': 0 );}
int __stoi(string s){ return atoi(s.c_str()); }
ll sum(ll a[],ll N){ return accumulate(a,a+N,0LL);}
ll gcd(ll a,ll b){if(a<b)swap(a,b); return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){if(a<b){swap(a,b);} return a/gcd(a,b)*b;}
template<class T> void chmax(T& a, T b){ if(a<b){a=b;} }
template<class T> void chmin(T& a, T b){ if(a>b){a=b;} }


int main(){
    int K; cin>>K;
    int A,B; cin>>A>>B;
    
    bool ok = false;
    for(int i=A;i<=B;++i){
        if(i%K==0){
            ok = true;
        }
    }
    
    cout << (ok?"OK":"NG") <<"\n";
}

Measured memory_bytes: 3632
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <math.h>
#include <numeric>
using namespace std;

int main() {

    int N;
    cin >> N;
    vector<pair<int, int>> balls;
    for(int i = 0; i < N; ++i)
    {
        pair<int, int> pos;
        cin >> pos.first >> pos.second;
        balls.push_back(pos);
    }

    map<pair<int, int>, int> costs;
    for(int i = 0; i < N; ++i)
    {
        for(int j = 0; j < N; ++j)
        {
            if(i == j)
            {
                continue;
            }
            pair<int, int> pq = {
                balls[i].first - balls[j].first,
                balls[i].second - balls[j].second
            };
            if(costs.find(pq) != costs.end())
            {
                costs[pq] += 1;
            }
            else
            {
                costs.insert({pq, 1});
            }            
        }
    }

    int min = N - max_element(costs.begin(), costs.end(), [&] (const auto& lhs, const auto& rhs) { return lhs.second < rhs.second; })->second;
    cout << min;
    return 0;
}

Measured memory_bytes: 384
#include "bits/stdc++.h"
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>

using namespace std;

#ifndef _DEBUG
#define main_ main
#endif
#define FOR(i,s,e) for (int i = int(s); i != int(e); i++)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LONG_MAX/2)

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;

template <typename T>
using keyVal = pair<string, T>;
template<typename T>
bool val_greater(const keyVal<T>& left, const keyVal<T>& right) {
	return left.second > right.second;
}

void init_global() {}

int main_() {
	int N;
	cin >> N;
	string S;
	cin >> S;

	int ans = 0;
	int x = 0;
	FOR(i, 0, N) {
		if (S[i] == 'I') x++;
		else x--;
		ans = max(ans, x);
	}

	cout << ans << endl;
	return 0;
}


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

int main(){
  int n,r[N];
  cin>>n;
  for(int i=0;i<n;i++)
    cin>>r[i];
  double x[N],ans=r[0]*2;
  x[0]=r[0];
  for(int i=1;i<n;i++){
    double maxx=0;
    for(int j=0;j<i;j++){
      int A=r[i]+r[j];
      int B=r[i]-r[j];
      maxx=max(maxx,max(x[j]+sqrt(A*A-B*B),1.0*r[i]));
    }
    x[i]=maxx;
    ans=max(ans,x[i]+r[i]);
  }
  printf("%.8f\n",ans);
  return 0;
}

Measured memory_bytes: 3248
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <list>
#include <numeric>
#include <map>	
#include <cmath>
#include <string>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define Cout(s) cout<<s<<endl
using namespace std;
typedef long long ll;
string Yes(bool b) { if (b) { return "Yes"; } else { return "No"; } }
string YES(bool b) { if (b) { return "YES"; } else { return "NO"; } }
//================================================
int ketawa(int a) {
	if (a < 10)return a;
	else return a % 10 + ketawa(a / 10);
}

int a = 1, b = 0, c, d, n, k = 0, ans = 0;
string s, t;

int main()
{
	double n;
	cin >> n;
	printf("%.4f\n", n*2 * 3.141592);

	return 0;
}


Measured memory_bytes: 3804
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#include<algorithm>//next_permutation
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
#define dec(n) cout << fixed << setprecision(n);
#define large "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
#define small "abcdefghijklmnopqrstuvwxyz"
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;

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

const ll MOD = 1000000007;
const ll MAX = 2000001;

ll mod(ll a){
  return a % MOD;
}

ll lcm(ll a,ll b){
  return (a*b)/gcd(a,b);
}

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

void nCrprep() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

ll nCr(ll n, ll r){
    if (n < r) return 0;
    if (n < 0 || r < 0) return 0;
    return fac[n] * (finv[r] * finv[n - r] % MOD) % MOD;
}

ll nCrcheep(ll n,ll r){
  if(r == 0) return 1;
  else if(r == 1) return n;
  else return nCrcheep(n-1,r-1)*n/r;
}

vector<pair<ll,ll>> prime_factorize(ll n){
  vector<pair<ll,ll>> res;
  
  for(ll i=2; i*i <= n; i++){
    if(n % i != 0) continue;
    
    ll ex = 0;
    while(n % i == 0){
      ex++;
      n /= i;
    }
    
    res.push_back({i,ex});
  }
  
  if(n != 1) res.push_back({n,1});
  
  return res;
  
}




int main(){
  ll n,m,k; cin >> n >> m >> k;
  vl asum(n+1); vl bsum(m+1);
  
  rep(i,n){
    ll x; cin >> x;
    asum[i+1] = asum[i] + x;
  }
  rep(i,m){
    ll x; cin >> x;
    bsum[i+1] = bsum[i] + x;
  }
  
  ll nowa = 0; ll nowb = m; ll ans = 0;
  
  while(nowa != n+1 and nowb >= 0){
    if(asum[nowa] + bsum[nowb] <= k){
      ans = max(ans,nowa + nowb);
      nowa++;
    }
    else{
      nowb--;
    }
  }
  
  cout << ans << endl;
  
  
}

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

#define ll long long 
#define pii pair<int, int>
#define ull unsigned ll
#define f first
#define s second
#define FOR(i,a,b) for (int i=(a); i<(b); i++)
#define REP(i,n) for (int i=0; i<(n); i++)
#define RREP(i,n) for (int i=(n-1); i>=0; i--)
#define ALL(x) x.begin(),x.end()
#define SZ(x) (int)x.size()
#define SQ(x) (x)*(x)
#define MN(a,b) a = min(a,(__typeof__(a))(b))
#define MX(a,b) a = max(a,(__typeof__(a))(b))
#define pb push_back
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define bug(x) cerr<<#x<<" is "<<x<<endl

using namespace std;

// #define int ll

const int iinf = 1<<29;
const ll inf = 1ll<<60;
const ll mod = 1e9+7;


void GG(){cout<<"-1\n"; exit(0);}

ll mpow(ll a, ll n, ll mo = mod){ // a^n % mod
    ll re=1;
    while (n>0){
        if (n&1) re = re*a %mo;
        a = a*a %mo;
        n>>=1;
    }
    return re;
}

ll inv (ll b, ll mo = mod){
    if (b==1) return b;
    return (mo-mo/b) * inv(mo%b) % mo;
}

const int maxn = 2e3+5;
const int mxn = 1e5+10;
const int K = 2002;
ll nway[4005][4005];
int C[4005][4005];

main(){
    ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    int n; cin>>n;
    vector<pii> v;
    REP(i,n){
        int a, b; cin>>a>>b; v.pb({a,b});
        nway[K-a][K-b]+=1;
    }
    ll re = 0;
    C[0][0]=1;
    REP(i,4005) REP(j,4005){
        if (i) C[i][j] += C[i-1][j];
        if(C[i][j]>=mod) C[i][j]-=mod;
        if (j) C[i][j] += C[i][j-1];
        if(C[i][j]>=mod) C[i][j]-=mod;
    }
    FOR(i,1, 4005) FOR(j,1,4005){
        nway[i][j] += nway[i-1][j] + nway[i][j-1]; while(nway[i][j]>=mod) nway[i][j]-=mod;
    }

    REP(i,n){
        int a = v[i].f; int b = v[i].s;
        re += nway[a+K][b+K]; 
        re -= C[a*2][b*2]; if (re<0) re += mod;else if (re >= mod) re -= mod;
    }
    re *= inv(2); re %= mod;
    cout<<re<<endl;
} 

Measured memory_bytes: 189936
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int M = sc.nextInt();
    
    if(M==0 && N==1){
   		System.out.println(0);
        return;
    }
    
    
    int[] s = new int[M];
    int[] c = new int[M];
    
    for(int i=0;i<M;i++){
      s[i] = sc.nextInt();
      c[i] = sc.nextInt();
      
      if(N!=1 && s[i] ==1 && c[i] == 0){
   		System.out.println("-1");
        return;      
      }
    }
    
    int[] a = new int[N];
    for(int i=0;i<N;i++){
      a[i] = -1;
    }
    
    for(int k=0;k<M;k++){   
      if(a[s[k]-1] == -1){
        a[s[k]-1] = c[k];
      }
      else if(a[s[k]-1] != c[k]){
        System.out.println("-1");
        return;        
      }

    }
     if(N==1 && a[0]==0){
   		System.out.println(0);
        return;     
     }
     if(a[0]== 0){
   		System.out.println("-1");
        return;
      }
      
      int ans = 0;
    if(a[0] == -1)
      ans += Math.pow(10,N-1);
      for(int j=0;j<N;j++){
        if(a[j] != -1)
      		ans += a[j] * Math.pow(10,N-j-1);
      }
      
      System.out.println(ans);
      return;
  }
}


Measured memory_bytes: 23764
#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define f first
#define s second
#define pb push_back
#define eb emplace_back
#define mk make_pair
#define mt make_tuple
#define MOD 1000000007
#define fo(i,a,b) for(i=a;i<b;i++)
#define foe(i,a,b) for(i=a;i<=b;i++)
#define all(x) x.begin(), x.end()
#define vi vector<int>
#define vl vector <long long int>
#define pii pair <int,int>
#define pll pair <long long int, long long int>
#define vpii vector< pair<int,int> >
#define vpll vector < pair <long long int,long long int> >
#define boost ios::sync_with_stdio(false); cin.tie(0)
using namespace std;
const int inf = 1e9 + 5;
const ll inf64 = 1e18 + 5;
int main()
{
	boost;
	int n, i;
	cin >> n;
	int x[n], y[n];
	fo(i, 0, n)
	cin >> x[i] >> y[i];
	sort(x, x + n);
	sort(y, y + n, greater <int>());
	if(n & 1)
	cout << y[n / 2] - x[n / 2] + 1;
	else {
		int a = y[n / 2 - 1] + y[n / 2];
		int b = x[n / 2 - 1] + x[n / 2];
		cout << a - b + 1;
	}
}


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


int main()
{
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    cout << (max(a,c) < min(b,d) ?  min(b,d)-max(a,c): 0) << endl;
    return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
n,m = list(map(int,input().split()))
sc = [input().split() for i in range(m)]
def main():
    ret = -1
    md = 0
    if n == 1:
        md = -1
    for i in range(10**(n-1)+md,10**n):
        flg = True
        i=str(i)
        for s,c in sc:
            s = int(s)
            if i[s-1]!=c:
                flg = False
                break
        if flg:
            ret = i
            return ret
    return ret

if __name__ == '__main__':
    print(main())



Measured memory_bytes: 3316
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define DEBUG
#ifdef DEBUG
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
	template <typename Arg1>
	void __f(const char* name, Arg1&& arg1){
		cerr << name << " : " << arg1 << std::endl;
	}
	template <typename Arg1, typename... Args>
	void __f(const char* names, Arg1&& arg1, Args&&... args){
		const char* comma = strchr(names + 1, ','); cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
	}
#else
#define debug(...)
#endif
#define FOR(i,a,b) 	for(int i=a;i<b;++i)
#define RFOR(i,a,b) 	for(int i=a;i>=b;--i)
#define ln 		"\n"
#define mp make_pair
#define pb push_back
#define sz(a)	ll(a.size())
#define F first
#define S second
#define all(c)	c.begin(),c.end()
#define rall(c) c.rbegin(), c.rend()
#define trace(c,x) for(auto &x:c)
#define pii pair<ll,ll>
#define init(a, x) memset(a,x,sizeof(a))
typedef long long ll;
typedef long double ld;
typedef	priority_queue<pii,std::vector<pii>,greater<pii> > revpr;

typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> pbds;
// ordered_set X
//K-th smallest
//*X.find_by_order(k-1)
//NO OF ELEMENTS < A
//X.order_of_key(A)
const int L=3e3+7;
ll dp[L][L][4], r, c, k, v[L][L];
ll solve(int x, int y, int co)
{
	// debug(co,x,y,r,c,dp[x][y][co]);
	if(co > 3)return -1e18;
	if(x>r || y>c)return -1e18;
	if(x == r && y == c)
	{
		if(co<3)return v[x][y];
		return 0;
	}
	ll &ret = dp[x][y][co];
	if(ret != -1)return ret;
	ret = 0;
	if(v[x][y])
	{
		if(co<3)
		{
			ret  = solve(x+1,y,0) + v[x][y];
			ret = max(ret, solve(x,y+1,co+1) + v[x][y]);
		}
		ret = max(ret, solve(x+1,y,0));
		ret = max(ret, solve(x,y+1,co));
	}
	else
	{
		ret = max(ret, solve(x+1,y,0));
		ret = max(ret, solve(x,y+1,co));
	}
	// debug(x, y, ret);
	return ret;
}
void fff()
{
	ll a, b, xx;
	cin >> r >> c >> k;
	FOR(i,0,k)
	{
		cin >> a >> b >> xx;
		v[a][b] = xx;
	}	
	FOR(i,1,r+1)FOR(j,1,c+1)FOR(k,0,4)dp[i][j][k] = -1;
	cout << solve(1,1,0) << ln;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	//int t;cin >> t;while(t--)
	fff();
	return 0;
}

Measured memory_bytes: 356508
#include<bits/stdc++.h>
#define EPS (1e-8)
using namespace std;
typedef complex<double> P;

struct Circle{
  P c; //中心点
  double r; //半径
  Circle(P c=P(0,0), double r=0):c(c),r(r){}
};

int IntersectionCC(Circle a,Circle b){
  int res=0;
  double dis=abs(a.c-b.c),R=a.r+b.r;
  if(dis>R+EPS)res++;
  if(dis>R-EPS)res++;
  if(dis>abs(a.r-b.r)+EPS)res++;
  if(dis>abs(a.r-b.r)-EPS)res++;
  return res;
}

int main(){
  int a,b;
  Circle c[2];
  for(int i=0;i<2;i++){
    cin>>a>>b>>c[i].r;
    c[i].c=P(a,b);
  }
  cout<<IntersectionCC(c[0],c[1])<<endl;
  return 0;
}



Measured memory_bytes: 3280
import qualified Data.ByteString.Char8 as B
import qualified Data.IntSet as S
import Data.Maybe
import Data.Array.IArray

data Player = Fennec | Snuke deriving (Eq,Show)

type Vertex = Int
type Vertexes = S.IntSet
type Edge = (Vertex,Vertex)
type Graph = Array Vertex [Vertex]

buildG :: Int -> [Edge] -> Graph
buildG n es = accumArray (flip (:)) [] (1,n) es

main :: IO ()
main = do
 n <- readLn
 es <- concatMap readEdge . B.lines <$> B.getContents
 let g = buildG n es
 print (versus n g)

readEdge :: B.ByteString -> [Edge]
readEdge = (\[a,b] -> [(a,b),(b,a)]) . map (fst . fromJust . B.readInt) . B.words

versus :: Vertex -> Graph -> Player
versus n g = if nf > div n 2 then Fennec else Snuke
 where nf = bfs g Fennec (S.singleton 1, S.singleton 1) (S.singleton n, S.singleton n)

transMap :: Graph -> Vertexes -> Vertexes
transMap g = S.fromList . concatMap (g!) . S.toList

bfs :: Graph -> Player -> (Vertexes,Vertexes) -> (Vertexes,Vertexes) -> Int
bfs g Fennec (sf,sfb) (ss,ssb)
 | S.null sfb = S.size sf
 | otherwise = bfs g Snuke (S.union sf sfb2, sfb2) (ss,ssb)
 where sfb2 = S.difference (S.difference (transMap g sfb) sf) ss
bfs g Snuke (sf,sfb) (ss,ssb)
 | S.null ssb = bfs g Fennec (sf,sfb) (ss,ssb)
 | otherwise = bfs g Fennec (sf,sfb) (S.union ss ssb2, ssb2)
 where ssb2 = S.difference (S.difference (transMap g ssb) sf) ss

Measured memory_bytes: 21884
#include <stdio.h>
#include <algorithm>
#include <vector>
using namespace std;
using ll = long long;

using pii = pair<int, ll>;
int n;
ll d[100010];
vector<pii> e[100010];
void dfs(int x, ll p) {
	if (d[x])
		return;
	d[x] = p;
	for (pii next : e[x])
		dfs(next.first, p + next.second);
	return;
}
int main() {
	scanf("%d", &n);
	for (int i = 0; i < n - 1; i++) {
		int u, v, w;
		scanf("%d %d %d", &u, &v, &w);
		e[u].emplace_back(v, w);
		e[v].emplace_back(u, w);
	}
	dfs(1, 1);
	for (int i = 1; i <= n; i++)
		printf("%d\n", d[i] & 1);
}

Measured memory_bytes: 9344
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <fstream>
#include <vector>
#include <memory>
#include <map>
#include <random>
#include <set>
#include <numeric>
#include <iomanip>
#include <bitset>

using namespace std;

void run(istream &cin, ostream &cout){
    string s;
    cin >> s;
    int w;
    cin >> w;
    for(int i = 0; i < s.length(); i+=w){
        cout << s[i];
    }
}

int main() {
#ifdef  LOCAL
    ifstream cin("input.txt");
    ofstream cout("output.txt");
#else
    cin.tie(0);
    ios::sync_with_stdio(0);
#endif
    run(cin, cout);
    return 0;
}

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


using namespace std;



int main()
{

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

    vector <int> dp(n);

dp[0] = 0;
dp[1] = dp[0] + abs(a[1]-a[0]);
dp[2] = dp[0] + abs(a[2] - a[0]);

for (int i=3; i<n; i++)
dp[i] = min( dp[i-2] + abs(a[i] - a[i-2]), dp[i-1] + abs(a[i]-a[i-1]));

//for (auto x:dp) cout << x << " ";
cout << dp[n-1];

}























Measured memory_bytes: 1024
#include <string.h>
#include <stdio.h>
#include <iostream>
#include <stdlib.h>
typedef long long ll;
using namespace std;
#define REP(i,n) for(int i=0; i<n;i++)


int main()
{
    char s[102],t[102];
    char as[26]={0},bs[26]={0};
    char ss[102]={1},tt[102]={0};
    int j=0,check=1;
    
    cin >> s >> t;
    
    if(strlen(s)==strlen(t) && strcmp(s,t) == 0)
    {
        cout << "No" << endl;
        return 0;
    }
    
    
    
    REP(i,strlen(s))
    {
        as[s[i]-'a']++;
    }
    REP(i,strlen(t))
    {
        bs[t[i]-'a']++;
    }
    
    
    REP(i,100)
    {
        if(as[j]>0)
        {
            ss[i]='a'+j;
            as[j]--;
        }
        else
        {
            j++;
            i--;
            if(j==26)
            {
                i=100;
            }
        }
    }
    
    j=25;
    REP(i,100)
    {
        if(bs[j]>0)
        {
            tt[i]='a'+j;
            bs[j]--;
        }
        else
        {
            j--;
            i--;
            if(j==-1)
            {
                i= 100;
            }
        }
    }

    int i=0;
    while(i<100)
    {
        if(ss[i]<tt[i])
        {
            i=999;
        }
        else if(ss[i]>tt[i])
        {
            check=0;
            i=999;
        }
        else
        {
            i++;
        }
    }
    
    /*cout << ss << endl;
    REP(i,strlen(t))
    {
        cout << tt[i];
    }
    cout << endl;*/
    
    if(check==1)
    {
        cout <<"Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<vector>
#include<queue>
#include<algorithm>
#include<string.h>

using namespace std;

int main(int argc, char* argv[]){
  long long int a,b,c,k;
  scanf("%d%d%d%d",&a,&b,&c,&k);
  long long int ans;
  if(k%2 == 0)ans=a-b;
  else ans =b-a; 
  if(abs(ans)>1000000000000000000){
    puts("Unfair");
    return 0;
  }
  printf("%lld\n",ans);
  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <complex>
#include <iomanip>
#include <iostream>
#include <queue>
#include <set>
#include <string>
#include <vector>

using std::cin;
using std::cout;
using std::endl;

using std::string;
using std::to_string;
using std::vector;
using std::set;
using std::queue;
using std::priority_queue;

using std::min;
using std::max;
using std::sort;
using std::abs;

int main(void) {
    int a, b, c;
    cin >> a >> b >> c;
    cout << (a + b + c - max(max(a, b), c)) << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>							
typedef long long ll;
#define pb push_back
#define mod 1000000007ll
const ll maxn = 9e18;
using namespace std;
const ll maxsize = 100000009;


void solve() {
	string s;
	cin >> s;
	int n = s.length();	
	for(int i = 0; i < n; ++i) {
		if(1 & i) {
			if(s[i] == 'R') {
				cout << "No" << endl;
				return;
				}
			}
			else {
				if(s[i] == 'L') {
					cout << "No" << endl;
					return;
					}
				}	
		}
		cout << "Yes" << endl;
}	


int main() {
	ios_base :: sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cout.precision(35);
	solve();
	return 0;
}
 
 
 



Measured memory_bytes: 3644
function Main(input) {
    const lines = input.split('\n')
    const s = lines[0];
    const t = lines[1];

    let result = (s == t.slice(0, t.length - 1)) ? "Yes" : "No";
    // console.log("");
    console.log(result);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 29472
#include <stdio.h>
int n,sign,count,sign1;
void convert(int target[],int setline[]){
    int i,o,sum=0,t=0;
    sign=0;
    for(i=0;sum=0,i<n;i++){
        for(o=0;o<n;o++)
            if(target[i]==target[o])
                sum++;
        setline[t++]=sum;
        if(target[i]!=sum)
            sign=1;
    }
    count++;
    sign1=1-sign1;
}
int main(void){
    int i,line[12],line1[12];
    for(;sign=sign1=1,count=0,scanf("%d",&n),n;){
        for(i=0;i<n;i++)
            scanf("%d",&line[i]);
        while(sign)sign1?convert(line,line1):convert(line1,line);
        printf("%d\n",count-1);
        for(i=0;i<n;i++)
            printf("%d%s",line[i],i==n-1?"\n":" ");
    }
    return 0;
}

Measured memory_bytes: 600
import sys
input = sys.stdin.readline
from collections import *

N = int(input())
A = list(map(int, input().split()))
low = [0]*(N+1)
high = [0]*(N+1)
low[N] = A[N]
high[N] = A[N]

if A[N]>2**N:
    print(-1)
    exit()

for i in range(N-1, -1, -1):
    low[i] = (low[i+1]+1)//2+A[i]
    high[i] = high[i+1]+A[i]
    lim = 2**i
    
    if low[i]>lim:
        print(-1)
        exit()
    
    high[i] = min(high[i], lim)

now = 1
ans = now

#print(low)
#print(high)

for i in range(N):
    now = min(high[i+1], 2*now)
    ans += now
    now -= A[i+1]
    
print(ans)

Measured memory_bytes: 89740
import scala.io.StdIn._
object Main extends App {
  val Array(l, r) = readLine.split(" ").map(_.toLong)
  var min = Long.MaxValue
  for {
    i <- l to math.min(r - 1, l + 2019)
    j <- l + 1 to math.min(r, l + 2019)
  } min = math.min(min, i * j % 2019)
  
  println(min)
}


Measured memory_bytes: 63340
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define pi 3.141592653589793238
#define int long long
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

const int mod=1e9+7;
int dp[2005][2005];

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);  
    cout.tie(0);   
#ifndef ONLINE_JUDGE
    if(fopen("INPUT.txt","r"))
    {
    freopen ("INPUT.txt" , "r" , stdin);
    freopen ("OUTPUT.txt" , "w" , stdout);
    }
#endif

// -------------------------------------Code starts here---------------------------------------------------------------------     

  int n;
  cin>>n;
  pair<int,int>p[n+1];
  for(int i=1;i<=n;i++)
  {
    cin>>p[i].first;
    p[i].second=i;
  }
  fill_n(&dp[0][0],2005*2005,-1e17);
  dp[0][0]=0;
  sort(p+1,p+n+1,greater<>());
  for(int i=1;i<=n;i++)
  {
    for(int j=0;j<=n;j++)
    {
      int z;
      if(j!=0)
      {
        z=abs(j-p[i].second);
        dp[i][j]=max(dp[i][j],dp[i-1][j-1]+z*p[i].first);
      }
      if(j!=n)
      {
        z=abs(n-(i-j)+1-p[i].second);
        dp[i][j]=max(dp[i][j],dp[i-1][j]+z*p[i].first);
      }
    }
  }
  int mx=0;
  for(int i=0;i<=n;i++)
    mx=max(mx,dp[n][i]);
  cout<<mx;
 
// -------------------------------------Code ends here------------------------------------------------------------------
    clock_t clk;
  clk = clock();

    clk = clock() - clk;
  cerr << fixed << setprecision(6) << "Time: " << ((double)clk)/CLOCKS_PER_SEC << "\n";
  return 0;
}


Measured memory_bytes: 35248
use proconio::input;
use proconio::marker::Chars;
fn main() {
    input! {
        chars: Chars,
    };
    let mut count = 0;
    if chars[0] == '1' {
        count += 1
    };
    if chars[1] == '1' {
        count += 1
    };
    if chars[2] == '1' {
        count += 1
    };

    println!("{}", count);
}


Measured memory_bytes: 2060
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define pb push_back
#define mp make_pair
#define M 1000000007
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
const int N=2e5+5, mod=998244353;
int main(){
	string s;
	cin>>s;
	if(s[2]==s[3] && s[4]==s[5] )puts("Yes");
	else puts("No");	
}

Measured memory_bytes: 256
local DBG = false
local function dbgpr(...)
    if DBG then
        io.write("[dbg]")
        print(...)
    end
end

local function dbgpr_t(tbl, use_pairs)
    if DBG then
        local enum = ipairs
        if use_pairs then
            enum = pairs
        end
        dbgpr(tbl)
        io.write("[dbg]")
        for i,v in enum(tbl) do
            io.write(i)
            io.write(":")
            io.write(tostring(v))
            io.write(" ")
        end
        print("")
    end
end

--

local N, M = io.read("n", "n")
local L = {}
for i=1, M do
    local k = io.read("n")
    local li = {}
    for j=1,N do
        li[j] = false
    end
    for j=1,k do
        local s = io.read("n")
        li[s] = true
    end
    table.insert(L, li)
    dbgpr("light", i)
    dbgpr_t(li)
end
local p = {}
for i=1, M do
    p[i] = io.read("n")
end
dbgpr("p")
dbgpr_t(p)
local ans = 0
for i=0,2^N-1 do
    local sw_states = {}
    for j=1,N do
        local state = (i >> (j - 1)) & 1
        sw_states[j] = state
    end
    local on = true
    for j=1,M do
        local sw_count = 0
        for k=1,N do
            if L[j][k] then
                sw_count = sw_count + sw_states[k]
            end
        end
        dbgpr("L", j, "sw_count", sw_count, "p", p[j])
        if sw_count % 2 ~= p[j] then
            on = false
        end
    end
    dbgpr_t(sw_states)
    dbgpr(on)
    if on then
        ans = ans + 1
    end
end
print(ans)


Measured memory_bytes: 1008
#include <stdio.h>
int main(void)
{
	int a, b, c=4280, d, e, f;
	while (1)
	{
		scanf("%d", &a);
		if (a == -1)
		{
			break;
		}
		if (a <= 10)
		{
			b = c - 1150;
			printf("%d\n",b);
		}
		else if (a <= 20)
		{
			b = c  -1150- 125 * (a-10);
			printf("%d\n", b);
		}
		else if (a <= 30)
		{
			b = c -1150-1250-140*(a-20);
			printf("%d\n", b);
		}
		else
		{
			b = c - 1150-1250 - 1400 - 160 * (a - 30);
			printf("%d\n", b);
		}

	}
	return  0;
}

Measured memory_bytes: 600
#include<bits/stdc++.h>
  using namespace std;
  int main()
  {
   string s;
   cin>>s;
  
   int l=s.length();
   int i=0;
   while(i!=l-1)
   {
          if(s[i]=='S'&&s[i+1]=='T')
          {
          s.erase(i,2);
          i--;
          }
          else
                  i++;
  
   }
   cout<<s.length();
  }


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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FORD(i, a, b) for(int i = (a); i >= (b); --i)
#define VAR(v, i) __typeof(i) v=(i)
#define FORE(i, c) for(VAR(i, (c).begin()); i != (c).end(); ++i)
#define all(v) (v).begin(),(v).end()

#define PII pair<int,int>
#define mp make_pair
#define st first
#define nd second
#define pb push_back
#define lint long long int
#define VI vector<int>

#define debug(x) {cerr <<#x <<" = " <<x <<endl; }
#define debug2(x,y) {cerr <<#x <<" = " <<x << ", "<<#y<<" = "<< y <<endl; } 
#define debug3(x,y,z) {cerr <<#x <<" = " <<x << ", "<<#y<<" = "<< y << ", " << #z << " = " << z <<endl; } 
#define debugv(x) {{cerr <<#x <<" = "; FORE(itt, (x)) cerr <<*itt <<", "; cerr <<endl; }}
#define debugt(t,n) {{cerr <<#t <<" = "; FOR(it,0,(n)) cerr <<t[it] <<", "; cerr <<endl; }}

#define make( x) int (x); scanf("%d",&(x));
#define make2( x, y) int (x), (y); scanf("%d%d",&(x),&(y));
#define make3(x, y, z) int (x), (y), (z); scanf("%d%d%d",&(x),&(y),&(z));
#define make4(x, y, z, t) int (x), (y), (z), (t); scanf("%d%d%d%d",&(x),&(y),&(z),&(t));
#define makev(v,n) VI (v); FOR(i,0,(n)) { make(a); (v).pb(a);} 
#define IOS ios_base::sync_with_stdio(0)
#define HEAP priority_queue

#define read( x) scanf("%d",&(x));
#define read2( x, y) scanf("%d%d",&(x),&(y));
#define read3(x, y, z) scanf("%d%d%d",&(x),&(y),&(z));
#define read4(x, y, z, t) scanf("%d%d%d%d",&(x),&(y),&(z),&(t));
#define readv(v,n) FOR(i,0,(n)) { make(a); (v).pb(a);}


using namespace std;


int main() {
	make2(n, k);
	lint ans = 0;
	if (k == 0) {
		ans = n * 1LL * n;
		printf("%lld\n", ans);
		return 0;
	}
	for (int b = k+1; b <= n; b++) {
		int l = k; int r = b;
		while (l <= n) {
			ans += (min(r, n+1) - l);
			l += b;
			r += b;
		}
	}
	printf("%lld\n", ans);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const ll mod = 1000000007;
const int INF = 1001001001;
const ll LINF = 1001001001001001001;

int main(){
    ll n ; cin >> n;
    vector<tuple<ll,ll,ll>> xyh(n);
    tuple<ll,ll,ll> one;
    rep(i,n){
        cin >> get<0>(xyh.at(i)) >> get<1>(xyh.at(i)) >> get<2>(xyh.at(i));
        if(get<2>(xyh.at(i))!=0) one=xyh.at(i);
    }
    tuple<ll,ll,ll> ans;
    rep(i,101) rep(j,101){
        bool flag = true;
        ll peakheight = get<2>(one) + abs(get<0>(one) - i) + abs(get<1>(one) - j);
        rep(k,n){
            if(get<2>(xyh.at(k)) != max(peakheight - abs(get<0>(xyh.at(k))-i) - abs(get<1>(xyh.at(k))-j),(ll)0)){
                flag = false;
            }
        }
        if(flag) cout << i << " " << j << " " << peakheight << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
using namespace std;
int main(){
  int n,m;
  int sn=0,sm=0,a;
  while(cin >> n >> m && n){
    sn = 0,sm = 0;
    bool vn[101]={},vm[101]={};
    for(int i=0;i<n;i++){
      cin >> a;
      vn[a] = true;
      sn += a;
    }
    for(int i=0;i<m;i++){
      cin >> a;
      vm[a] = true;
      sm += a;
    }
    for(int i=1;i<=100;i++){
      if(vn[i]){
        for(int j=1;j<=100;j++){
          if(vm[j]){
            if(sn - i + j == sm - j + i){
            cout << i << " " << j << endl;
            goto exit;
          }
        }
      }
    }
    }
    cout << -1 << endl;
  exit:;
  }
}

Measured memory_bytes: 1160
using System;
using System.Collections.Generic;
using System.Linq;

namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var a = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            Console.WriteLine(a[0] <= a[2] && a[0] + a[1] >= a[2] ? "YES" : "NO");
        }
    }
}



Measured memory_bytes: 13268
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int h = scan.nextInt();
        int w = scan.nextInt();
        String[] c = new String[h];
        for(int i = 0; i < h; i++) c[i] = scan.next();
        for(int i = 0; i < h; i++){
            System.out.println(c[i]);
            System.out.println(c[i]);
        }
        scan.close();
    }
}

Measured memory_bytes: 30688
def main():
    input()
    a = [int(x) for x in input().split(' ')]
    q = int(input())
    for i in range(q):
        cmd, b, e = [int(x) for x in input().split(' ')]
        if cmd == 0:
            print(min(a[b:e]))
        else:
            print(max(a[b:e]))


if __name__ == '__main__':
    main()



Measured memory_bytes: 5640
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <bitset>
#include <random>
#include <chrono>
#include <complex>
#include <algorithm>
#include <utility>
#include <functional>
#include <cmath>
#include <cstring>
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iomanip> 

using namespace std;

#define sqr(x) ((x)*(x))
#define mp make_pair
#define pb push_back
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define RE(i, n) FOR(i,1,n)
#define REP(i,n) FOR(i, 0, (int)(n)-1)
#define fst first
#define snd second

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef long double ld;
typedef tuple<int,int,int> iii;

string to_string(string s) {
    return '"' + s + '"';
}
    
string to_string(const char* s) {
    return to_string((string) s);
}
    
string to_string(bool b) {
    return (b ? "true" : "false");
}
    
template <typename A, typename B>
string to_string(pair<A, B> p) {
    return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
    
template <typename A>
string to_string(A v) {
    bool first = true;
    string res = "{";
    for (const auto &x : v) {
        if (!first) {
            res += ", ";
        }
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << to_string(H);
    debug_out(T...);
}

void fastIO() {
    cin.sync_with_stdio(false);
    cin.tie(0);
}


int XMOV[4] = {0, 0, 1, -1};
int YMOV[4] = {1, -1, 0, 0};

//#############################
const int MAXN = 1000005;

vector<pair<double, double>> p(9, pdd());
int n, counter = 0;
bool visited[9];
double sum = 0;

void bt(int idx, int path, double acum, string ph) {
    if (path == n-1){
        sum += acum;
        counter++;
        return;
    }
    else{
        for(int i = 0; i < n; i++) {
            // if (!visited[i] && idx == i)
            //     visited[i] = true, ph.pb(i + '0');
            if (!visited[i]){
                visited[i] = true;
                if (idx > -1)
                    acum += hypot((p[idx].fst - p[i].fst), p[idx].snd-p[i].snd);
                ph.pb(i+'0');
                bt(i, (idx > -1? path+1 : path), acum, ph);
                visited[i] = false;
                ph.pop_back();
                if (idx > -1)
                acum -= hypot((p[idx].fst - p[i].fst), p[idx].snd-p[i].snd);
            }
        }
    }
}

int main() {
    cin >> n;

    memset(visited, 0, sizeof(visited));
    for (int i = 0; i < n; i++){
        cin >> p[i].fst >> p[i].snd;
    }

    bt(-1, 0, 0, "");
    double d = 1;
    for(int i = 2; i <= n; i++)
        d *= i;

    cout.precision(17);
    cout << sum / d << endl; 
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;

namespace Atcoder
{
    class Program2
    {
        public static void Main(string[] args)
        {
            int a = int.Parse(Console.ReadLine());
            if(a==3||a==5||a==7){
                Console.WriteLine("YES");
            }else{
                Console.WriteLine("NO");
            }

        }
    }
}


Measured memory_bytes: 11092
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int d = sc.nextInt();
        if (d == 25) {
            System.out.println("Christmas");
        } else if(d == 24) {
            System.out.println("Christmas Eve");
        } else if(d == 23) {
            System.out.println("Christmas Eve Eve");
        } else if(d == 22) {
            System.out.println("Christmas Eve Eve Eve");
        }
    }
}


Measured memory_bytes: 21716
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <map>
using namespace std;

const int maxN = 2 * 1e5 + 5;
int N, a[maxN], b[maxN]; 
map<int, int> mp;
int main() {
	scanf("%d", &N);
	for(int i = 1; i <= N; ++i) scanf("%d", &a[i]), b[i] = a[i];
	sort(a + 1, a + 1 + N);
	for(int i = 1; i <= N; ++i) mp[a[i]] = N - i + 1;
	for(int i = 1; i <= N; ++i) {
		if(mp[b[i]] <= N / 2) printf("%d\n", a[N / 2]);
		else printf("%d\n", a[N / 2 + 1]);
	} 
	return 0;
}

Measured memory_bytes: 12928
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<cmath>
using namespace std;

int read(){
    int s = 0,ne = 1; char c = getchar();
    while(c < '0' || c > '9') ne = c == '-' ? -1 : 1, c = getchar();
    while(c >= '0' && c <= '9') s = (s << 1) + (s << 3) + c - '0', c = getchar();
    return s * ne;
}

double n, x; int t;

int main()
{
    // freopen("_in.in", "r", stdin);
    n = read(), x = read(), t = read();
    printf("%d", (int)ceil(n / x) * t);
}

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

using namespace std;

using Graph = vector<vector<int>>;

int G[10][10];

int main() {
    int N, M;
    cin >> N >> M;

    memset(G, 0, sizeof(G));

    for (int i = 0; i < M; ++i) {
        int a, b;
        cin >> a >> b;
        --a;
        --b;
        G[a][b] = G[b][a] = 1;
    }


    // 0 -> [1 -> ... -> N - 1]
    vector<int> B(N - 1);
    for (int i = 0; i < N - 1; ++i) B[i] = i + 1;

    int ans = 0;
    do {
        bool ok = true;
        int cur = 0;
        for (int next : B) {
            if (G[cur][next]) {
                cur = next;
            } else {
                ok = false;
                break;
            }
        }
        if (ok) ++ans;

    } while (next_permutation(B.begin(), B.end()));

    cout << ans << endl;
}

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

int main(){
    int n;cin>>n;
    vector<int> H(n);
    for(int i=0;i<n;i++){
        int h;cin>>H[i];
    }

    int m=0;
    for(int i=0;i<n-1;){
        int count=0;
        while(H[i]>=H[i+1]&&i+1<=n-1){
            i++;
            count++;
        }
        m=max(m,count);
        i++;
    }

    cout<<m<<endl;
}




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

int main() {
  int N,num,sum,i,dig;
  cin >> num;
  N = num;
  
  while(num){
    dig = num % 10;
    sum = sum + dig;
    num = num / 10;
  }
  if (N % sum == 0){
    cout << "Yes";
  }else{
    cout << "No";
  }
}


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

int main(){
    ll h;
    scanf("%lld",&h);
    ll ant = 1;
    ll t = 1;
    bool v = false;
    while(h>=2){
        t*=2;
        ant+=t;
        h/=2;
    }
    printf("%lld",ant);
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define REP(i,n) for(int i=0;i<(int)(n);i++)

using namespace std;
vector<int> b;
vector<int> a;
int main(){ _;
  int n,t;cin>>n;
  REP(i,n){
    cin>>t;
    b.push_back(t);
  }

  REP(i,n){
    for(auto it=b.rbegin();;it++){
      if(it==b.rend()){
	cout<<-1<<endl;
	return 0;
      }
      int index=distance(b.begin(),it.base());
      if(*it==index){
	a.push_back(*it);
	b.erase((++it).base());
	break;
      }
    }
  }
  for(auto it=a.rbegin();it!=a.rend();it++){
    cout<<*it<<endl;
  }
}


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

int main() {
	string S, F="keyence"; cin >> S;
	int a, b=0;
	for(a=0; a<7; ++a) if(S[a]!=F[a]) break;
	for(b=0; b<7; ++b) if(S[S.size()-1-b]!=F[6-b]) break;
	if(a+b<7) cout << "NO" << endl;
	else cout << "YES" << endl;
	return 0;
}


Measured memory_bytes: 256
//高知能系Vtuberの高井茅乃です。
//Twitter: https://twitter.com/takaichino
//YouTube: https://www.youtube.com/channel/UCTOxnI3eOI_o1HRgzq-LEZw

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

#define INF 1999999999
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define MODA 1000000007 

int main() {
	int ans = 0;
	int tmp;
	char i;
	cin >> i;

	cout << (char)(i+1) << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>

using namespace std;

int main(){
//	freopen("in","r",stdin);
	int a,b; cin >> a >> b;
	int al = (a*25+1)/2, ar = ((a+1)*25+1)/2;
	int bl = b * 10, br = (b+1) * 10;
	if(br <= al || ar <= bl) cout << -1 << endl;
	else {
		int m = max(al,bl);
		cout << m << endl;
	} 
}

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

long long par[ 100000+99 ];
long long blo[ 100000+99 ];

long long Root(long long x) {
	if ( par[ x ] == x ) {
		return x;
	}
	else {
		return par[ x ] = Root( par[ x ] );
	}
}

void Union(long long x, long long y) {
	par[ Root(y) ] = Root(x);
}

int main() {
	long long n, m;
	while ( cin >> n >> m ) {
		long long con[ m ][ 2 ];
		
		for (long long i = 0; i < 100099; ++i) {
			par[ i ] = i; blo[ i ] = 1;
		}
		
		for (long long i = 0; i < m; ++i) {
			cin >> con[ i ][ 0 ] >> con[ i ][ 1 ];
		}
		
		long long groupAns = n*(n-1)/2;
		vector<long long> ans; ans.push_back( groupAns );
		
		for (long long i = m-1; i >= 1; --i) {
			long long x = con[ i ][ 0 ], y = con[ i ][ 1 ];
			
			if ( Root(x) != Root(y) ) {
				groupAns -= blo[ Root(x) ] * blo[ Root(y) ];
				blo[ Root(x) ] += blo[ Root(y) ];
				Union( x, y ); // union y to x :: Root(y) -> x
			}
			
			ans.push_back( groupAns );
		}
		
		for (long long i = m-1; i >= 0; --i) {
			cout << ans[ i ] << '\n';
		}
	}
	return 0;
}

Measured memory_bytes: 5364
"""
author : halo2halo
date : 9, Jan, 2020
"""

import sys

# import numpy as np
import itertools

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

N, X, *L = map(int, read().split())

Lcum = itertools.accumulate(L)

answer = sum(i <= X for i in Lcum)
print(answer + 1)


Measured memory_bytes: 3060
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
 
 
 
int main(){
int a,b,c,d;
int temp1,temp2;

scanf("%d%d%d%d",&a,&b,&c,&d);
if(a>=b){
	
	temp1=b;
}else{
	temp1=a;
	
}
if(c>=d){
	temp2=d;
}else{
	temp2=c;
}

printf("%d\n",temp2+temp1);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>

using namespace std;

int main()
{
    int length = 5;
    int x[length];
    for (int i = 1; i <= length; i++)
    {
        scanf("%d", &x[i]);
        if (x[i] == 0)
        {
            cout << i;
            return 0;
        }
    }

    return 0;
}

Measured memory_bytes: 3656