akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define pint pair<int,int>
#define pll pair<ll,ll>
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
  ll n,m;
  cin >> n >> m;
  ll a[n]={};
  rep(i,n)cin >> a[i+1];
  ll l[n+1]={};
  rep(i,n){
    l[i+1]=l[i]+a[i+1];
  }
  rep(i,n+1)l[i]%=m;
  map<ll,ll> mp;
  rep(i,n+1){
    mp[l[i]]++;
  }
  ll ans=0;
  for(auto i=mp.begin();i!=mp.end();i++){
    ll x=i->second;
   ans+=x*(x-1)/2;
  }
  cout << ans << endl;
return 0;}

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

int main(){
  int x, count1, count2, count3;
  cin >> x;
  count1, count2, count3 = 0;
  
  count1 = x / 500;
  count2 = x - x / 500 * 500;
  count3 = count2 / 5;
  
  cout << count1 * 1000 + count3 * 5 << endl;
}

Measured memory_bytes: 256
package main

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

func main() {
	sc := NewScanner()
	D := sc.NextInt()

	fmt.Println("Christmas" + strings.Repeat(" Eve", 25-D))

}

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r: rdr}
}
func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}
func (s *Scanner) NextInt64() int64 {
	v, _ := strconv.ParseInt(s.Next(), 10, 64)
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 0)
			result = append(result, int(v))
			start = s.p + 1
		}
	}

	return result
}
func (s *Scanner) NextInt64Array() []int64 {
	s.pre()
	start := s.p
	result := []int64{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 64)
			result = append(result, v)
			start = s.p + 1
		}
	}
	return result
}

func (s *Scanner) NextMap() map[int]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true

	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>

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

  std::vector<std::string> t{"dream", "dreamer", "erase", "eraser"};

  while (!S.empty()) {
    bool updated = false;
    for (const auto& ti: t) {
      if (S.length() < ti.length()) continue;
      if (S.compare(S.length()-ti.length(), ti.length(), ti) != 0) continue;

      for (size_t i = 0; i < ti.length(); ++i) S.pop_back();
      updated = true;
      break;
    }
    if (!updated) break;
  }

  if (S.empty()) {
    std::cout << "YES" << std::endl;
  } else {
    std::cout << "NO" << std::endl;
  }
}


Measured memory_bytes: 512
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <iomanip>
using namespace std;
#define int long long

int gcd(int a,int b){
    return b ? gcd(b, a % b) : a;
}
int lcm(int a,int b){
    return b / gcd(a,b) * a;
}


signed main(){
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);

    int n; cin >> n;
    vector<string> s(n);
    for(int i = 0;i < n;i ++) cin >> s.at(i);

    vector<vector<int> > a(n,vector<int>(26));

    for(int i = 0;i < n;i ++){
        for(int j = 0;j < s.at(i).size();j ++){
            a.at(i).at(s.at(i).at(j) - 'a') ++;
        }
    }

    vector<int> count(26,100);
    for(int i = 0;i < 26;i ++){
        for(int j = 0;j < n;j ++){
            count.at(i) = min(count.at(i),a.at(j).at(i));
        }
    }

    string ans = "";
    for(int i = 0;i < 26;i ++){
        for(int j = 0;j < count.at(i);j ++){
//            char b = 'a' + i;
            ans += 'a' + i;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
n = int(input())
data = list(input())
w = 0
r = 0
for i in range(n):
    if data[i] == "W":
        w+=1
    else:
        r +=1
wW = 0
for i in range(r):
    if data[i] ==  "W":
        wW+=1
rW = 0
for i in range(r+1,n):
    if data[i] == "R":
        rW+=1
print(max(rW,wW))


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

int main() {
  int n;
  cin >> n;
  
  int a;
  vector<pair<int,int>> b(n);
  for(int i=0; i<n; i++) {
    cin >> a;
    b[i] = make_pair(a,i+1);
  }
  sort(b.begin(), b.end());
  
  for(auto p : b) {
    if(p.first!=n) cout << p.second << " ";
    else cout << p.second << endl;
  }
  
  return 0;
}

Measured memory_bytes: 3988
/************************************************************
/  AUTHOR :  DEVANSHU SINGLA                                /
/  NICK :  DSINGLA                                          /
/  INSTITUTE :  IITK                                        /
************************************************************/
//                     TEMPLATE                            //

#include <bits/stdc++.h>
#define ll long long
#define N 100005
#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define clr(x) x.clear()
#define F first
#define S second
#define MAX(x, y) (x) > (y) ? (x) : (y)
#define MIN(x, y) (x) < (y) ? (x) : (y)

using namespace std ;

void solve(){
    long n;
    cin>>n ;
    cin.ignore() ;
    string s;
    set<string> arr;
    for(long i=0; i<n; i++){
        getline(cin,s);
        //cout<<s<<endl ;
        arr.insert(s) ;
    }

    cout<<arr.size() ;
}

int main(){
    #ifndef ONLINE_JUDGE 
 
    freopen("/home/devanshu/Desktop/cp/cp_questions/input.txt", "r", stdin);  
    freopen("/home/devanshu/Desktop/cp/cp_questions/output.txt", "w", stdout); 

    #endif
    ios_base::sync_with_stdio(false) ;
    cin.tie(NULL) ;

    solve() ;
}

Measured memory_bytes: 19196
#ifdef LOCAL111
#else
	#define NDEBUG
#endif
#include <bits/stdc++.h>
const int INF = 1e8;
using namespace std;

#define endl '\n'
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define RBP(i,a) for(auto& i : a)
#ifdef LOCAL111
	#define DEBUG(x) cout<<#x<<": "<<(x)<<endl
#else
	#define DEBUG(x) true
#endif
#define F first
#define S second
#define SNP string::npos
#define WRC(hoge) cout << "Case #" << (hoge)+1 << ": "
#define rangej(a,b,c) ((a) <= (c) and (c) < (b))
#define rrangej(b,c) rangej(0,b,c)
template<typename T> void pite(T a, T b){ for(T ite = a; ite != b; ite++) cout << (ite == a ? "" : " ") << *ite; cout << endl;}
template<typename T> bool chmax(T& a, T b){if(a < b){a = b; return true;} return false;}
template<typename T> bool chmin(T& a, T b){if(a > b){a = b; return true;} return false;}

typedef pair<int,int> P;
typedef long long int LL;
typedef unsigned long long ULL;
typedef pair<LL,LL> LP;

void ios_init(){
	//cout.setf(ios::fixed);
	//cout.precision(12);
#ifdef LOCAL111
	return;
#endif
	ios::sync_with_stdio(false); cin.tie(0);	
}

const LL mod = 1e9+7;

//res.first*a+res.second*b == 1 となるresを返す (a,bは互いに素)
pair<long long, long long> extgcd(long long a,long long b)
{
	if(b==1){
		return pair<long long, long long>(0,1);
	}
	pair<long long, long long> t=extgcd(b,a%b);
	return pair<long long, long long>(t.second,t.first-a/b*t.second);
}

//modの逆元を返す
long long inverse(long long a,long long modl = mod)
{
	return (extgcd(modl,a).second+modl)%modl;
}

//xCyを返す
long long Cinv(long long x, long long y, const long long modl = mod){
	long long n = 1 ,r = 1;
	for(int i = 0; i < y; i++){
		n = n*(i+1)%modl;
		r = r*(x-i)%modl;
	}
	return r*inverse(n,modl)%modl;
}

int main()
{
	ios_init();
	int h,w,a,b;
	cin >> h >> w >> a >> b;
	w--; h--; a--; b--;
	b++;
	LL ans = 0;
	LL c1 = -1, c2 = -1;
	REP(i,h-a){
		if(i == 0){
			c1 = Cinv(b-1+i,i);
			c2 = Cinv(h-i+w-b,w-b);
		}else{
			c1 = c1*(b-1+i)%mod*inverse(i)%mod;
			c2 = c2*inverse(h-(i-1)+w-b)%mod*(h-i+1)%mod;
		}
		ans += c1*c2%mod;
		ans %= mod;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;
const ll INF = 1e9;
const ll MOD = 1e9 + 7;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define loop(i, a, n) for (int i = a; i < (n); i++)
#define all(in) in.begin(), in.end()
#define vint vector<int>

int main() {
    int N;
    cin >> N;
    vint A(N);
    rep(i, N) cin >> A[i];
    ll sum = 0;
    rep(i, N) sum += A[i];
    ll partial_sum = 0;
    ll ans = 4000000000000000000;
    rep(i, N - 1) {
        partial_sum += A[i];
        ans = min(ans, abs(2 * partial_sum - sum));
    }
    cout << ans << endl;
}

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


int main(){
    int N, H;
    int ans =0;
    int a[100005], b[100005];

    cin >> N >> H;

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

    std::sort(a, a+N, std::greater<int>());
    std::sort(b, b+N, std::greater<int>());

    for(int i =0 ; i <N; i++){
        if(a[0] > b[i]){
            break;
        }
        H -= b[i];
        ans++;
        if(H <=0){
            cout << ans << endl;
            return 0;
        }
    }
    ans += (H +a[0] -1)/ a[0];

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

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

using namespace std;

int main(void)
{
  int n,inp;
  
  cin>>n;
  int a[n+1];
  for(int i=0;i<=n;i++)
  {
    a[i]=0;
  }

  for(int i=1;i<n;i++)
  {
    cin>>inp;
    a[inp]++;
  }

  for(int i=1;i<=n;i++)
  {
    cout<<a[i]<<endl;
  }
}

Measured memory_bytes: 4424
import math

n = int(input())

ans = [0] * n

def baisuu(num, max):
    ret = []
    i = num
    while i <= max:
        ret.append(i)
        i = i + num
    return ret
    

# print("{}".format(baisuu(4,4)))

an = list(map(int, input().split()))

for i in range(n):
    sum = 0
    for mltp in baisuu(n-i, n):
        sum = sum+ans[mltp-1]
    if not sum % 2 == an[n-i-1]:
        ans[n-i-1] = 1
                     

ans = list(map(lambda x: x%2,ans))
print("{}".format(ans.count(1)))

for i in range(n):
    if ans[i] == 1:
        print("{}".format(i+1))



Measured memory_bytes: 14420
n = int(input())
town = []
for _ in range(n):
    xy = list(map(float, input().split()))
    town.append(xy)
    
from itertools import permutations
from math import sqrt
orders = list(permutations(range(n)))
dist_sum = 0
for order in orders:
    for i in range(n-1):
        a = town[order[i]]
        b = town[order[i+1]]
        dist = sqrt((a[0]-b[0])*(a[0]-b[0]) + (a[1]-b[1])*(a[1]-b[1]))
        dist_sum += dist
print(dist_sum/len(orders))

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

using namespace std;

void hawawa(){
	int a, b;
	cin >> a >> b;
	cout << (a - 1) * (b - 1) << "\n";
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	hawawa();
	return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
  int N,ans;
  char str[100005];
  
  cin>>N;
  cin>>str;
  
  ans=N;
  
  for(int i=0;i<N-1;i++){
    if(str[i]==str[i+1]){
      ans--;
    }
  }
  cout<<ans;
  
  return 0; 
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define all(x) (x).begin(),(x).end()
#define INF 10000000

using namespace std;

int main(){
    string s,t;
    cin >> s >> t;
    sort(all(s));
    sort(all(t));
    reverse(all(t)); 
    if (s<t) puts("Yes");
    else puts("No");
    
}

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

int main()
{
	int hand[ 5 ], ans[ 5 ];
	while( cin >> hand[ 0 ] && hand[ 0 ] ){
		int flag = ( 1 << ( hand[ 0 ] - 1 ) );
		for( int i = 1; i < 5; ++i ){
			cin >> hand[ i ];
			flag |= ( 1 << ( hand[ i ] - 1 ) );
		}
		if( flag == 1 || flag == 2 || flag == 4 || flag == 7 ){
			for( int i = 0; i < 5; ++i ){
				ans[ i ] = 3;
			}
		}else{
			int win = 0;
			if( flag == 3 ) win = 1;
			if( flag == 6 ) win = 2;
			if( flag == 5 ) win = 3;
			for( int i = 0; i < 5; ++i ){
				if( hand[ i ] == win ) ans[ i ] = 1;
				else ans[ i ] = 2;
			}
		}
		for( int i = 0; i < 5; ++i ){
			cout << ans[ i ] << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1164
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  int sub[n+1];
  memset(sub,0,sizeof sub);
  for(int i=2;i<=n;i++)
  {
    int c;
    cin>>c;
    sub[c]++;
  }
  for(int i=1;i<=n;i++)
    cout<<sub[i]<<" ";
  return 0;
}

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

const long long inf=1000000000000000000ll;

namespace flow
{
	struct node{int to,next,c; long long val;}e[200010];
	int n,cnt,hd[3010],q[3000010],l,r,x,la[3010];
	long long dis[3010];
	bool inq[3010];
	void init(int N)
	{
		n=N,cnt=1;
		for (int i=1; i<=n; i++) hd[i]=0;
	}
	void addedge(int x,int y,int c,long long v)
	{
		e[++cnt]=(node){y,hd[x],c,v},hd[x]=cnt;
		e[++cnt]=(node){x,hd[y],0,-v},hd[y]=cnt;
	}
	pair<int,long long> solve()
	{
		int f=0;
		long long ans=0;
		while (1)
		{
			dis[1]=0,q[l=r=1]=1,inq[1]=1,la[1]=0;
			for (int i=2; i<=n; i++) inq[i]=0,dis[i]=inf,la[i]=0;
			while (l<=r)
			{
				x=q[l++];
				for (int i=hd[x]; i; i=e[i].next)
					if (e[i].c&&dis[e[i].to]>dis[x]+e[i].val)
					{
						dis[e[i].to]=dis[x]+e[i].val,la[e[i].to]=i;
						if (!inq[e[i].to]) inq[e[i].to]=1,q[++r]=e[i].to;
					}
				inq[x]=0;
			}
			if (dis[n]==inf) break;
			x=n; int nw=1000000000;
			while (la[x]) nw=min(nw,e[la[x]].c),x=e[la[x]^1].to;
			x=n,f+=nw;
			while (la[x]) e[la[x]].c-=nw,e[la[x]^1].c+=nw,ans+=e[la[x]].val*nw,x=e[la[x]^1].to;
		}
		return make_pair(f,ans);
	}
}

int n,x,y,c;

int main()
{
	scanf("%d",&n);
	flow::init(2*n+6);
	for (int i=1; i<=n; i++) 
	{
		scanf("%d%d%d",&x,&y,&c);
		flow::addedge(1,i+1,c,0);
		flow::addedge(i+1,2*n+2,c,x+y);
		flow::addedge(i+1,2*n+3,c,x-y);
		flow::addedge(i+1,2*n+4,c,-x+y);
		flow::addedge(i+1,2*n+5,c,-x-y);
	}
	for (int i=1; i<=n; i++)
	{
		scanf("%d%d%d",&x,&y,&c);
		flow::addedge(i+n+1,2*n+6,c,0);
		flow::addedge(2*n+2,i+n+1,c,-x-y);
		flow::addedge(2*n+3,i+n+1,c,-x+y);
		flow::addedge(2*n+4,i+n+1,c,x-y);
		flow::addedge(2*n+5,i+n+1,c,x+y);		
	}
	printf("%lld\n",-flow::solve().second);
	return 0;
}

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

#define MOD 1000000007

int main(){
  int H, W;
  cin >> H >> W;

  char map[H + 1][W + 1];
  for (int i = 1; i <= H; i++) {
    for (int j = 1; j <= W; j++) {
      cin >> map[i][j];
    }
  }
  int dp[H + 1][W + 1];
  for (int i = 0; i <= H; i++) {
    for (int j = 0; j <= W; j++) dp[i][j] = 0;
  }
  for (int i = 1; i <= H; i++) {
    for (int j = 1; j <= W; j++) {
      if ( i == 1 && j == 1 ) {
        dp[i][j] = 1;
        continue;
      }
      if ( map[i][j] == '#' ) dp[i][j] = 0;
      else dp[i][j] = (dp[i-1][j] + dp[i][j-1]) % MOD;
    }
  }
  cout << dp[H][W] << endl;
}


Measured memory_bytes: 5120
#include<stdio.h>
int gcd(int,int);
void swap(int,int);
int main(){
    int a,b,i,j;
    scanf("%d",&a);
    scanf("%d",&b);
    printf("%d\n",gcd(a,b));
}

int gcd(int x,int y){
  int r;
  if(x<y){
    swap(x,y);
  }
  while(y>0){
    r=x%y;
    x=y;
    y=r;
  }
  return x;
}

void swap(int x,int y){
  int x2;
  x2=x;
  x=y;
  y=x2;
}


Measured memory_bytes: 2128
#include <bits/stdc++.h>
using namespace std;
int main() {
  int k,s;
  cin >> k >> s;
  long long int count = 0;
  for (int i=0; i<=k; i++) {
    for (int j=0; j<=k; j++) {
      int t = s-i-j;
      if (t>=0 && t<=k) {
        count++;
      }
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll MOD = 998244353;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-11;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
typedef pair<ld, ld> LDP;
LP a[5000];
ll dp[5001][5001];
bool op(LP x, LP y) {
	ll s1 = x.first + x.second;
	ll s2 = y.first + y.second;
	if (s1 < s2)return true;
	else return false;
}
int main() {
	int n; cin >> n;
	rep(i, n) {
		ll h, p; cin >> h >> p;
		a[i] = { p,h };
	}
	sort(a, a + n,op);
	rep(i, 5001) {
		rep(j, 5001) {
			dp[i][j] = INF;
		}
	}
	dp[0][0] = 0;
	rep(i, n) {
		rep(j, n) {
			if (dp[i][j] == INF)continue;
			if (dp[i][j] <= a[i].second) {
				dp[i + 1][j + 1] = min(dp[i + 1][j + 1], dp[i][j] + a[i].first);
			}
			dp[i + 1][j] = min(dp[i + 1][j], dp[i][j]);
		}
	}
	int out = n;
	rep(j, n + 1) {
		if (dp[n][j] != INF) {
			out = j;
		}
	}
	cout << out << endl;
	return 0;
}


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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N, K;
  cin >> N >> K;
  vector<int> h(N);
  REP(i, N) cin >> h[i];
  sort(h.begin(), h.end());
  vector<int> d(N - 1);
  REP(i, N - 1) d[i] = h[i + 1] - h[i];
  vector<int> sum(N - K + 1);

  for(int i = 0; i < N - K + 1; i++) {
    int tmp = 0;
    for(int j = 0; j < K - 1; j++) {
      tmp += d[i + j];
    }
    sum[i] = tmp;
  }

  sort(sum.begin(), sum.end());
  cout << sum[0] << endl;
  return 0;
}

Measured memory_bytes: 1408
#include <iostream>
using namespace std;
int main(void){
  int a,N;
  cin >> a >> N;
  
  int ans = 0;
  
  for(int i=0;i<=a;i++){
    for(int j=0;j<=a;j++){
        if(N - i - j <= a && N - i - j >= 0)
          ans++;
    }
  }
  
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;
#define rep(i, begin, n) for (int i = begin; i < n; i++)
#define repe(i, begin, n) for (int i = begin; i <= n; i++)
#define repr(i, begin, n) for (int i = begin; i > begin - n; i--)
#define repre(i, begin, end) for (int i = begin; i >= end; i--)

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

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

const int inf = INT_MAX;
const int MOD = 1000000007;
const long long INF = LLONG_MAX;

// -------------------------------------------------------

ll x;

int main() {
  cin >> x;
  ll q = x / 11;
  ll r = x % 11;
  if (r == 0) {
    cout << q * 2;
    return 0;
  }

  if (1 <= r && r <= 6) {
    cout << q * 2 + 1;
    return 0;
  }

  cout << q * 2 + 2;
}


Measured memory_bytes: 3644
#include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<algorithm>
#include<cmath>
using namespace std;
#define INF 0x3f3f3f3f
const int maxn=500000+10;
#define _rep(i,a,b) for(int i=(a);i<=(b);++i)
char s[maxn];
int n,Q,a[26][maxn];

int lowbit(int x) {return x&-x;}
void add(int x,int k,int c[])
{
    while(x<=n)
        c[x]+=k,x+=lowbit(x);
}
int getsum(int x,int c[])
{
    int ans=0;
    while(x>=1) 
        ans+=c[x],x-=lowbit(x);
    return ans;
}
void init()
{
    for(int i=1;i<=n;i++)
    {
        add(i,1,a[s[i]-'a']);
    }
}
int main()
{
    #ifdef __LOCAL__
        freopen("1.in","r",stdin);
        freopen("1.out","w",stdout);
    #endif
    int type,iq,lq,rq;
    char cq[2];
    scanf("%d%s%d",&n,s+1,&Q);
    init();
    while(Q--)
    {
        scanf("%d",&type);
        if(type==1)
        {
            scanf("%d%s",&iq,cq);
            if(s[iq]!=cq[0])
            {
                add(iq,-1,a[s[iq]-'a']);
                add(iq,1,a[cq[0]-'a']);
                s[iq]=cq[0];
            }
        }
        if(type==2)
        {
            int num=0;
            scanf("%d%d",&lq,&rq);            
            for(int i=0;i<26;i++)
                if(getsum(rq,a[i])-getsum(lq-1,a[i]))
                    num++;
            cout<<num<<endl;
        }
    }   
    
    return 0;
}

Measured memory_bytes: 51584
//写経
#include <bits/stdc++.h>

using namespace std;
using ll =long long;
#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cerr << #x << " = " << (x) << endl;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
void coY() {cout <<"Yes"<<endl;}
void coN(){cout <<"No"<<endl;}

//Write From this Line

const int mod = 1e9+7;
const ll INF = ll(1e18)+1;
int main()
{
	ll n, k;
	cin >> n>> k;
	vector<ll> a(n);
	rep(i,n) cin >> a[i]; 
	SORT(a);
	ll l = -INF, r = INF;
	while(l+1<r){//lとrが隣あったら終わり。rがギリギリだめ、lがギリギリおｋでlを出力する。
		ll x = (l+r)/2;
		bool ok = [&]{//xがokかどうかをラムダ式で関数にまとめる。
			ll tot = 0 ;//x未満が何個あるか。k個未満ならo
			rep(i,n){//全てのa[i]について、相方の個数をtotに足す。
				if (a[i] < 0){
					int l = -1 , r = n;
					while(l+1<r){
						int c = (l + r) / 2;
						if( a[c] *a[i] < x) r = c ; else l = c;
					}
					tot += n - r; 
				} else {
					int l = -1 , r= n;
					while(l+1<r){
						int c =  (l+r)/2;
						if(a[c]*a[i] < x) l = c ; else r = c ;
					}
					tot += r;
				}
				if(a[i]*a[i] < x ) tot -- ;
			}
			tot /= 2 ;
			return tot < k ;//kより小さいならo
		} ();
		if(ok) l = x ;else r = x ;
	}
	cout << l << endl;
}


Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <unordered_set>
#include <unordered_map>
#include <cstdint>
#include <string.h>
#include <queue>
#include <bitset>
#include <limits>
#include <list>
#include <array>

using namespace std;

#define N_MAX (100000)

int main()
{
    int N;
    cin >> N;
    int count = 0;
    while(N > 0) {
        if(N%10 == 2) count++;
        N /= 10;
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <climits>
#include <iomanip>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
int main(){
  ll n = 0;
  cin >> n;
  vector<ll> a(n);
  vector<ll> count(1000001);
  for(int i = 0;i < n;i++){
    cin >> a[i];
    count[a[i]]++;
  }
  if(count[1] == 1){
    cout << 1 << endl;
    return 0;
  }
  if(count[1] > 1){
    cout << 0 << endl;
    return 0;
  }
  ll res = 0;
  for(int i = 0;i < n;i++){
    if(count[a[i]] >= 2)continue;
    bool now = true;
    ll num = a[i];
    //ll nowmin = 1;
    for(int j = 2;j <= sqrt(a[i]);j++){
      if(num % j == 0){
        if(count[j] > 0 || count[num / j] > 0){
          now = false;
          //cout << "ok" << num << " " << j << endl;
          j = a[i];
        } 
        //if(nowmin == 1)nowmin = j;
      }
    }
    //cout << i << " " << num << endl;
    //if((count[num / nowmin] > 0 && nowmin != 1) || (count[num / nowmin] > 1 && nowmin == 1))now = false;
    //if(count[num] > 1)
    if(now){
      res++;
      //cout << a[i] << endl;
    }
  }
  cout << res << endl;
}

Measured memory_bytes: 12712
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner scan=new Scanner(System.in);
		int[] a=new int[26];
		while(scan.hasNext()){
		
			String str = scan.nextLine();
			str = str.toLowerCase();
		
			for(int i=0;i<str.length();i++)
				if(str.charAt(i) >= 'a' && str.charAt(i) <= 'z')
					a[str.charAt(i)-'a']++;
		}
		
		for(int i=0;i<26;i++)
			System.out.printf("%c : %d\n",i+'a',a[i]);
	}
}


Measured memory_bytes: 26352
#include <stdio.h>
#include <math.h>

int main()
{
  double A, B, H, M, min, time, dif;
  double ans2, ans;
  scanf("%lf", &A);
  scanf("%lf", &B);
  scanf("%lf", &H);
  scanf("%lf", &M);

  min = 360.0 * M / 60.0;
  time = 360.0 * (H / 12.0 + M / (60.0 * 12.0));

  dif = fabs(min - time);

  if(dif > 180.0){
    dif = 360.0 - dif;
  }

  ans2 = A*A + B*B - 2.0*A*B*cos(dif/180.0*M_PI);
  ans = sqrt(ans2);

  printf("%.10f\n", ans);

  return 0;
  }


Measured memory_bytes: 2600
#include <iostream>
using namespace std;
#include <algorithm>
#include <vector>
#include <math.h>

#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)

int main(){
    int N, out=0;
    cin >> N;

    REP(i,1,N+1){
        REP(j,2,N+1){
            int ii = pow(i,j);
            if(ii <= N && ii > out) out = ii;
        }
    }

    if(out == 0) out = 1;

    cout << out << endl;
return 0;
}


Measured memory_bytes: 384
#include<cstdio>

int main()
{
  int N, L, sum = 0, maxi = 0;

  scanf("%d", &N);
  for(int i = 0; i < N; i++) {
    scanf("%d", &L);
    sum += L;
    if(L > maxi) maxi = L;
  }

  sum -= maxi;
  puts(sum > maxi? "Yes" : "No");

  return 0;
}


Measured memory_bytes: 128
n,k=gets.split(" ").map(&:to_i)
h=gets.split(' ').map(&:to_i)
h.sort!

(0..k).each do |x|
    if h.size==0 || k==0
        break;
    end
    h.delete_at(n-1)
    n-=1
    k-=1
end
sum=h.inject(:+)
p h.size==0 ? 0 : sum

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

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef complex<double> point;
#define xx real()
#define yy imag()

#define REP(i, a, b) for(int i = (a); i < (int)(b); i++)
#define REPN(i, a, b) for(int i = (a); i <= (int)(b); i++)
#define FA(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define SZ(x) (int)(x).size()
#define BE(x) (x).begin(), (x).end()
#define SORT(x) sort(BE(x))
#define _1 first
#define _2 second

#define x1 gray_cat_x1
#define y1 gray_cat_y1

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

#define file "I1"

const double EPS = 1e-9;
const double PI = acos(-1.);
const int INF = 1e9;
const ll MOD = 998244353;

const int MAXN = 3e5 + 5;

ll pow_mod(ll a, ll st){
	ll ans = 1ll;
	for(; st; st /= 2ll){
		if (st & 1){
			ans = (ans * a) % MOD;
		}
		a = (a * a) % MOD;
	}
	return ans;
}

ll get_inv(ll a){
	return pow_mod(a, MOD - 2);
}

ll f[MAXN], f_inv[MAXN];

ll get_c(int i, int j){
	if (i < 0 || j < 0 || j > i){
		return 0ll;
	}
	ll ans = (f[i] * f_inv[j]) % MOD;
	ans = (ans * f_inv[i - j]) % MOD;
	return ans;
}

void solve(){
	int n;
	ll a, b, k;
	cin >> n >> a >> b >> k;
	f[0] = 1ll;
	REPN(i, 1, n){
		f[i] = (f[i - 1] * i) % MOD;
	}
	f_inv[n] = get_inv(f[n]);
	for(int i = n - 1; i >= 0; i--){
		f_inv[i] = (f_inv[i + 1] * (i + 1)) % MOD;
	}
	ll ans = 0ll;
	REPN(i, 0, n){
		ll v1 = i * a;
		ll v2 = k - v1;
		if (v2 < 0 || v2 % b != 0 || v2 / b > n){
			continue;
		}
		int j = v2 / b;
		ll tmp = (get_c(n, i) * get_c(n, j)) % MOD;
		ans = (ans + tmp) % MOD;
	}
	cout << ans << endl;
}   

int main(){

    //freopen(file".in", "r", stdin); freopen(file".out", "w", stdout);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();    
    }
}


Measured memory_bytes: 4992
import sys

read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    N, K = map(int, readline().split())
    if K==1:
        print(0)
    else:
        print(N-K)

if __name__ == '__main__':
    main()


Measured memory_bytes: 9112
/*Always success does not build on success,success build on failure and hardwork*/
#include <bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define vec         vector<int>
#define map         map<int,int>
#define scn(t)      scanf("%d",&t);
#define lscn(t)      scanf("%lld",&t);
#define mod         1000000007
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define endl        "\n"
using namespace std;
const int N=2e5+5;
ll fact[N];
ll invfact[N];
ll power(ll x,ll y)
{
    if(y==0)
    return 1;
    
    if(y%2==0)
    return power((x*x)%mod,y/2)%mod;
    else
    return (x*power((x*x)%mod,y/2))%mod;
}

ll ncr(ll n,ll r)
{
    ll ans=1;
    ans=(ans*fact[n])%mod;
    ans=(ans*invfact[r])%mod;
    ans=(ans*invfact[n-r])%mod;
    
    return ans;
}

int main()
{
      fact[0]=1;

      for(ll i=1;i<N;i++)
      {
             fact[i]=(i*fact[i-1])%mod;
      }

      invfact[N-1]=power(fact[N-1],mod-2)%mod;

      for(ll i=N-2;i>=0;i--)
      {
             invfact[i]=((i+1)*invfact[i+1])%mod;
      }

      ll ans=0;

      ll n,m,x,y;
      lscn(n);
      lscn(m);
      lscn(x);
      lscn(y);

      x=n-x+1;

      x--;
      y++;

      while(1)
      {
          if(x<1 || y>m)
          break;

          ll z=1;
          ll k=(x-1+y-1);

          z=(z*(ncr((x-1+y-1),(x-1))))%mod;

          z=(z*(ncr(n-x+m-y,n-x)))%mod;

          ans=(ans+z)%mod;

          x--;
          y++;
      }

      cout<<ans<<endl;
}



Measured memory_bytes: 6848
import bisect

n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

A.sort()
B.sort()
C.sort()

ans = 0

for b in B:
    a = bisect.bisect_left(A, b)
    c = bisect.bisect_right(C, b)
    #print("a:{0},c:{1}".format(a, c))
    ans += a*(len(C)-c)

print(ans)


Measured memory_bytes: 105304
#include <iostream>
#include <vector>
using namespace std;
int main(){
    long long N;
    cin >> N;
    if(N % 2 == 1){
        cout << 0 << endl;
        return 0;
    }
    N /= 2;
    long long cnt = 0;
    long long t = 5;
    while(N >= t){
        cnt += N / t;
        t *= 5;
    }
    cout << cnt << endl;
}

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

const int64_t MOD = 998244353;

//mod逆元を使ったnCkの計算(速)
const int64_t MAX = 510000;
//const int64_t MOD = 1000000007;

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

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

// 二項係数計算
int64_t COM(int64_t n, int64_t k){
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

//繰り返し二乗法
int64_t pown(int64_t x, int64_t n) { 
  int64_t ans = 1;
  while (n > 0) {
    if ((n & 1) == 1) {
      ans = ans * x;
      ans %= MOD;
    }
    x = x * x;//一周する度にx, x^2, x^4, x^8となる
    x %= MOD;
    n >>= 1; //桁をずらす n = n >> 1
  }
  return ans;
}


int main(){
  int64_t N, M, K;
  cin >> N >> M >> K;
  int64_t ans = 0;
  COMinit();
  for(int i=0; i<=K; i++){
    int64_t plus = M*pown(M-1,N-i-1);
    plus %= MOD;
    plus *= COM(N-1,i);
    plus %= MOD;
    ans += plus;
    ans %= MOD;
  }
  cout << ans << endl;
}

Measured memory_bytes: 15592
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <utility>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <istream>
#include <ostream>

#include <cstdlib>
#include <cmath>
#include <cstdio>

using namespace std;

#define fi first
#define se second
#define mkp make_pair
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define rep(i,n) for(ll i=0; i < (n); ++i)
#define rrep(i,n) for(ll i=((n)-1); i >= 0; --i)

#define OPLT(T) bool operator<(const T & lop_, const T & rop_)
#define OPEQ(T) bool operator==(const T & lop_, const T & rop_)

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

//istream& operator>>(istream& istr, __float128& obj) { double d; istr >> d; obj = d; return istr; };
//ostream& operator<<(ostream& ostr, __float128& obj) { ostr << static_cast<double>(obj); return ostr; };

ll dp[2][100100];

int main() {
	ll N, M, K;
	ll res = 0;
	cin >> N >> M >> K;
	vector<ll> A(N);
	rep(i,N) cin >> A[i];
	rep(i,K) {
		deque<ll> mx;
		rep(j,N) {
			while(mx.size() && mx.front() < j-M)
				mx.pop_front();

			ll m;
			if(mx.size() == 0)
				m = 0;
			else
				m = dp[(i+1)%2][mx.front()];
			//cout << i << "," << j << ":" << m << endl;
			dp[i%2][j] = m + A[j] * (i+1);
			if(j<i) dp[i%2][j] = 0;
			while(mx.size() && dp[(i+1)%2][mx.back()] <= dp[(i+1)%2][j])
				mx.pop_back();
			mx.push_back(j);
		}
		/*
		cout << i << ":";
		rep(j,N) cout << dp[i%2][j] << ",";
		cout << endl;
		// */
	}
	for(int j = 0; j < N; j++) {
		res = max(res, dp[(K-1)%2][j]);
	}
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 2560
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>

using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, f, n) for (int i = (f); i < (n); i++)
#define repv(v) for (auto it = (v).begin(); it != (v).end(); it++)
ll const INF = 1LL << 60;

int main() {
    ll x, y;
    cin >> x >> y;

    int grp[12] = {1, 3, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1};

    if (grp[x - 1] == grp[y - 1])
        cout << "Yes" << endl;
    else
        cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, n) for(int i = 0;i < (n);++i)
#define RREP(i, n) for(int i = (n)-1; i >= 0; --i)

#define endl '\n'
#define pb push_back
#define eb emplace_back
#define prique priority_queue
#define umap unordered_map
#define BIG 2000000000
#define VERYBIG 1000000000000000ll
#define PI 3.1415926
#define coutdb cout<<fixed<<setprecision(15)

const int dx[]={1,0,-1,0,1,1,-1,-1}, dy[]={0,-1,0,1,1,-1,1,-1};
const long long MOD = 1e9+7;

// typedef int_fast64_t ll;
#define int int_fast64_t

template<typename T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template<typename T> inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template<typename T> inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template<typename T> inline T nHr(T a,T b){return nCr(a+b-1,b);}

signed main(void){
  cin.tie(0);
  ios::sync_with_stdio(false);

  int N; cin >> N;
  cout << N*N*N << endl;
}

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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
//#pragma GCC optimize ("-O3") 
#ifdef YANG33
#include "mydebug.hpp"
#else
#define DD(x) 
#endif
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2019/02/28  Problem: ABC 107 C / Link: http://abc107.contest.atcoder.jp/tasks/abc107_c  ----- */
/* ------問題------



-----問題ここまで----- */
/* -----解説等-----



----解説ここまで---- */

LL ans = 0LL;

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

	LL N, K; cin >> N >> K;
	vector<LL> a(N);
	for (int i = 0; i < N; ++i) {
		cin >> a[i];
	}
	ans = LINF;
	FOR(i, 0, N) {
		if (i + K-1 >= N)continue;
		LL fpos = a[i];
		LL lpos = a[i + K-1];
		if (fpos*lpos < 0) {// -0+
			ans = min({ ans, abs(fpos) * 2 + abs(lpos), abs(fpos) + 2 * abs(lpos) });
		}
		else { // -0 or 0+
			ans = min(ans, max(abs(fpos), abs(lpos)));
		}
	}
	
	
	cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 1024
N = int(input())
P = list(map(int,input().split()))
S = []
a = 0
p = 0
s = 0
while True:
    
    for i in range(N):
        if P[i] % 2 == 1:
            s = 1
        else:
            P[i] = P[i] / 2
    if s == 1:
        break
    a += 1

print(a)


Measured memory_bytes: 3060
#include <cstdio>
#include <queue>
#include <algorithm>
#include <string>
#include <iostream>
using namespace std;
int main(){
  int n,q;
  int i,t;
  string name;
  char str[10];
  queue <pair<string,int> > Q;
  scanf("%d %d",&n,&q);
  for(i=0;i<n;i++){
    scanf("%s",str);
    name=str;
    scanf("%d",&t);
    Q.push(make_pair(name,t));
  }
  pair<string,int> u;
  int elaps=0,a;
  while(!Q.empty()){
    u=Q.front();Q.pop();
    a=min(u.second,q);
    u.second-=a;elaps+=a;
    if(u.second > 0){
      Q.push(u);
    } else {
      printf("%s %d\n",u.first.c_str(),elaps);
    }
  }
  return 0;
}

Measured memory_bytes: 6300
def solve():
  N = int(input())
  AB = [[int(i) for i in input().split()] for i in range(N)]
  AB.sort(key=lambda e: e[1])
  time = 0
  for ab in AB:
    a, b = ab
    time += a
    if time > b: return 'No'

  return 'Yes'

print(solve())


Measured memory_bytes: 41248
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	static int n;

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

		for (int i = 0; i < n; i++) {
			arrayA[i] = sc.nextInt();
		}
		for (int i = 0; i < n; i++) {
			arrayB[i] = sc.nextInt();
		}
		for (int i = 0; i < n; i++) {
			arrayC[i] = sc.nextInt();
		}
		//全探索すると間に合わない
		Arrays.sort(arrayA);
		Arrays.sort(arrayC);
		long ans = 0;
		for (int i = 0; i < n; i++) {
			ans += binary_search(arrayA, arrayB[i]) * (n - binary_search(arrayC, arrayB[i] + 1));
		}
		System.out.println(ans);
	}

	//arrayのうち、targetより小さい要素の数を数える
	//r-l=1になったとき、rはtarget以上の数のうち最大のものを持っているから、そのインデックスが所望の要素数に等しい
	public static long binary_search(int[] array, int target) {
		int l = -1;
		int r = n;
		while (r - l > 1) {
			int mid = (r + l) / 2;		//intの割り算はintの商
			if (array[mid] < target) {
				l = mid;
			} else
				r = mid;
		}
		return r;
	}

}


Measured memory_bytes: 93556
a = list(map(int, input().split()))
n = a[0]
y = a[1]
check =0

for i in range(n+1):
    for j in range(n+1-i):
        if i*10000 + j*5000 + (n-i-j)*1000 == y:
            if sum([i,j,n-i-j]) == n:
                print(i, j, n-i-j)
                exit()
print('-1 -1 -1')

Measured memory_bytes: 3064
N,Q=map(int,input().split())
S=input()
data=[0]*N
for i in range(1,N):
    if S[i-1:i+1]=='AC':
        data[i]=data[i-1]+1
    else:
        data[i]=data[i-1]
for q in range(Q):
    l,r=map(int,input().split())
    print(data[r-1]-data[l-1])

Measured memory_bytes: 6140
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		List<String> list = new ArrayList<>();
		for(int i=0;i<N;i++){
			String str = sc.next();
			char[] chars = str.toCharArray();
			Arrays.sort(chars);
			String sortedStr = new String(chars);
			list.add(sortedStr);
		}
		Collections.sort(list);
		String tmp = list.get(0);
		long sum = 0;
		long count = 1;
		for(int i=1;i<N;i++){
			if(tmp.equals(list.get(i))){
				sum += count++;
			}
			else{
				count = 1;
			} 
			tmp = list.get(i);
		}
		System.out.println(sum);
	}
}

Measured memory_bytes: 53152
#[allow(dead_code)]
fn rd() -> String {
    let mut input = String::new();
    std::io::stdin().read_line(&mut input).unwrap();
    input.trim().to_owned()
}

/// 1行の文字を空白で分割してVec<T>にする。
#[allow(dead_code)]
fn rd_vec<T : std::str::FromStr>() -> Vec<T> {
    rd().split_whitespace().map(|x| x.parse().ok().unwrap()).collect()
}

/// 1つの要素を入力で受け取る
#[allow(dead_code)]
fn rd_one<T : std::str::FromStr>() -> T {
    rd().parse().ok().unwrap()
}

/// 複数回read_splitを行う
#[allow(dead_code)]
fn rd_vec_mul<T : std::str::FromStr>(count : i32) -> Vec<Vec<T>> {
    (0..count).map(|_| rd_vec()).collect()
}

/// Vecを1列で出力する
#[allow(dead_code)]
fn op_vec<T : std::fmt::Display>(item : Vec<T>, splitter : char) {
    let cnt = item.len();
    let mut c = 0;
    for i in item.iter() {
        c+=1;
        if cnt > c {print!("{}{}", i, splitter);} else {println!("{}", i);}
    }
}

fn main() {
    let input : Vec<i32> = rd_vec();
    if input[1] == 1 {
        println!("0");
        return;
    }
    if input[0] >= input[1] {
        println!("1");
        return;
    }
    let mut pulug = input[0];
    let mut answer = 1;
    loop {
        answer += 1;
        pulug += input[0] - 1;
        if pulug >= input[1] {
            break;
        }
    }
    println!("{}", answer);
}


Measured memory_bytes: 4352
/*
   ~~~~~~~~~~~~~~~~~~~
   \  |\/| | |\ | |  /
   /  |  | | |/ |_|  \
   ~~~~~~~~~~~~~~~~~~~
*/
#include<iostream>
#include<string.h>
char s[2000200];
using namespace std;
int main()
{
	int i;
	cin>>s;
	int x=strlen(s);
	for(i=0;i<x;i++){
		if(s[i]=='?'){
			if(s[i-1]=='P') s[i]='D';
			else if(s[i+1]=='D') s[i]='P';
			else s[i]='D';
		}
	}
	cout<<s<<endl;
	return 0;
}

Measured memory_bytes: 3816
#pragma GCC optimize("O4")
#include <bits/stdc++.h>
#define For(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define sz(x) ((int)x.size())
#define MOD (ll)(1e9+7)
#define INF 1e17
#define int ll
#define EPS (1e-6)
using namespace std;
using ll=long long;
using pii=pair<int,int>;

int gcd(int a,int b) { return b==0?a:gcd(b,a%b); }
int lcm(int a,int b) { return a/gcd(a,b)*b; }

int fpow(int b,int p)
{
	if(p==0) return 1;
	int h=fpow(b,p/2);
	if(p%2) return h*b%MOD*h%MOD;
	return h*h%MOD;
}

int dp[5010][5010];



int32_t main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int n; cin>>n;
	string s; cin>>s;
	For(i,0,n){
		dp[i][n]=0;
		dp[n][i]=0;
	}
	int ans=0;
	for(int i=n-1;i>=0;i--){
		for(int j=n-1;j>=0;j--){
			if(i<j && s[i]==s[j]) dp[i][j]=min(dp[i+1][j+1]+1,j-i);
			else dp[i][j]=0;
			ans=max(ans,dp[i][j]);
		}
	}
	cout<<ans<<"\n";
	//For(i,0,n) For(j,0,n){
	//	cout<<dp[i][j]<<" \n"[j==n];
	//}
	return 0;
}





























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

int main() {
	ll n;
	cin >> n;

	vector<ll> a(n);
	vector<ll> b(n);
	for (ll i = 0; i < n; ++i) {
		cin >> a[i];
		cin >> b[i];
	}

	sort(a.begin(), a.end());
	sort(b.begin(), b.end());

	if (n % 2 == 1) {
		ll l = a[n / 2];
		ll r = b[n / 2];
 
		ll s = r - l + 1;
		cout << s;
		return 0;
	}

	ll l1 = a[n / 2 - 1];
	ll r1 = b[n / 2 - 1];
	ll l2 = a[n / 2];
	ll r2 = b[n / 2];

	ll s = (r1 + r2) - (l1 + l2) + 1;
	cout << s;
	
	return 0;
}
	

Measured memory_bytes: 6388
#include<bits/stdc++.h>
#define x first
#define y second
#define sqr(x) ((x)*(x))
#define mp(x,y) make_pair((x),(y))
using namespace std;
double m[1005][1005];
int main(){
	pair<double,double> p[1005]; 
	scanf("%lf %lf",&p[0].x,&p[0].y);
	scanf("%lf %lf",&p[1].x,&p[1].y);
	int n;
	double r[1005];
	r[0]=0,r[1]=0;
	scanf("%d",&n);
	for(int i=2;i<=n+1;i++)
	scanf("%lf %lf %lf",&p[i].x,&p[i].y,&r[i]);
	for(int i=0;i<n+2;i++)
	for(int j=0;j<n+2;j++){
		m[i][j]=max(sqrt(sqr(p[i].x-p[j].x)+sqr(p[i].y-p[j].y))-r[i]-r[j],0.0);
	}
	priority_queue< pair<double,int>,vector<pair<double,int> >,greater<pair<double,int> > > pq;
	pq.push(mp(0,0));
	int visit[1005];
	memset(visit,0,sizeof(visit));
	while(!pq.empty()){
		pair<double,int> p=pq.top();pq.pop();
		if(visit[p.y])
		continue;
		visit[p.y]=1;
		if(p.y==1){
		printf("%.10lf\n",p.x);
		return 0;
		}
		for(int i=0;i<n+2;i++){
			if(!visit[i])
			pq.push(mp(p.x+m[p.y][i],i));
		}
	}
} 

Measured memory_bytes: 16492
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define pb push_back
const int maxn = 10000;
const int INF32 = 1'050'000'000;
const long long INF64 = 4'000'000'000'000'000'000;
const int MOD7 = 1'000'000'007;
const int MOD9 = 1'000'000'009;
const int mod = MOD7;

void ERROR(int num) { printf("ERROR%d!\n",num); }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
int dx[8]={-1,0,1,0,1,1,-1,-1};
int dy[8]={0,-1,0,1,1,-1,1,-1};


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

  int N;
  cin >> N;

  map<pair<int,int>,ll> Map;
  vector<pair<int,int>> memo;
  for(int i=1; i<=N; i++){
    int num = i;
    int tmp = num;
    int a;
    while(1){
      a = tmp;
      tmp /= 10;
      if(tmp==0) break;
    }
    int b = num%10;
    //printf("(%d,%d)\n", a, b);
    if(Map[make_pair(a,b)]==0) {
      memo.pb(make_pair(a,b));
    }
    Map[make_pair(a,b)]++;
  }

  ll ans = 0;
  rep(i,memo.size()){
    int a = memo[i].first; 
    int b = memo[i].second;
    ans += Map[make_pair(b,a)] * Map[make_pair(a,b)];
  }
  cout << ans << endl;

}

Measured memory_bytes: 256
import java.util.ArrayDeque;
import java.util.Deque;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		int n = sc.nextInt();
		int m = sc.nextInt();
		int[] a = new int[m];
		int[] b = new int[m];
		int[][] map = new int[n][n];
		int bridge = 0;
		for (int i = 0; i < m; i++) {
			a[i] = sc.nextInt() - 1;
			b[i] = sc.nextInt() - 1;
			map[a[i]][b[i]] = 1;
			map[b[i]][a[i]] = 1;
		}
		for (int i = 0; i < m; i++) {
			Deque<Integer> deque = new ArrayDeque<>();
			boolean memo[] = new boolean[n];
			deque.add(0);
			memo[0] = true;
			map[a[i]][b[i]] = 0;
			map[b[i]][a[i]] = 0;
			int cnt = 1;
			while (!deque.isEmpty()) {
				int t = deque.poll();
				for (int j = 0; j < n; j++) {
					if (!memo[j] && map[t][j] == 1) {
						memo[j] = true;
						deque.add(j);
						cnt++;
					}
				}
			}
			if (cnt != n) {
				bridge++;
			}
			map[a[i]][b[i]] = 1;
			map[b[i]][a[i]] = 1;
		}
		System.out.println(bridge);
	}
}


Measured memory_bytes: 23508
{-# LANGUAGE ScopedTypeVariables #-}
module Main where
 
main :: IO ()
main = do
  n <- readLn
  xs :: [Int] <- (map read . words) <$> getLine
  print $ go 0 (take n xs)
  where
    go :: Int -> [Int] -> Int
    go n xs | all even xs = go (n+1) $ map (`div` 2) xs
            | otherwise   = n


Measured memory_bytes: 1020