akhauriyash/Code-Regression huggingface dataset:
N, A, B, C, D = map(int, input().split())
A -= 1
B -= 1
C -= 1
D -= 1

s = input()

for i in range(A + 1, C - 2 + 1):
    if s[i] == '#' and s[i + 1] == '#':
        print('No')
        exit()
for i in range(B + 1, D - 2 + 1):
    if s[i] == '#' and s[i + 1] == '#':
        print('No')
        exit()

if A < C < B < D:
    # ふぬけとすぬけは独立
    # 先にふぬけ(B,D)から処理
    print('Yes')
    exit()
elif A < B < C < D:
    # ふぬけから移動させる
    print('Yes')
    exit()
else:
    # A < B < D < C:
    # すぬけから移動させる
    # 3連続空欄が必要で
    # boo
    # obo
    # ならOK
    # oDoまでOKで、ooDはダメ
    for i in range(B - 1, D - 1 + 1):
        # 連続3マスの起点マス
        if s[i] == '.' and s[i + 1] == '.' and s[i + 2] == '.':
            print('Yes')
            exit()
print('No')


Measured memory_bytes: 40560
object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val rates = List.fill(sc.nextInt())(sc.nextInt() / 400)
  val groupedCounts = rates.groupBy(identity).view.mapValues(_.length)
  val colored = 0.to(7).count(groupedCounts.contains)
  val (min, max) = (colored.max(1), colored + 8.to(12).flatMap(groupedCounts.get).sum)
  println(s"$min $max")
}


Measured memory_bytes: 55812
#include <iostream>
#include <vector>

using namespace std;

int main()
{
	vector<int> a(5);
	for (auto &x : a) {
		cin >> x;
	}
	int k;
	cin >> k;

	for (int i = 0; i + 1 < a.size(); ++i) {
		for (int j = i + 1; j < a.size(); ++j) {
			if (abs(a[i] - a[j]) > k) {
				cout << ":(" << endl;
				return 0;
			}
		}
	}
	cout << "Yay!" << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
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> ans(n);
  for (int i = 0; i < n; i++)
  {
    ans[a[i] - 1] = i + 1;
  }
  for (int i = 0; i < n; i++)
  {
    cout << ans[i] << ' ';
  }
  cout << endl;
}

Measured memory_bytes: 1664
#include <stdio.h> 
int main(){
    int n,i,sum=100000;
    
    scanf("%d",&n);
    
    for(i=1;i<=n;i++){
        sum*=1.05;
        
        if(sum%1000>=1)
            sum=sum-(sum%1000)+1000;
            
        
    } 
    
    printf("%d\n",sum);
    
    return 0; 
    
} 


Measured memory_bytes: 2040
/*
Character Drawing Adapted from FAKEUPDATE.NET
		   _    _____         _
		   \`,""   ,'7"r-..__/ \
		  ,'\ `, ,',','    _/   \
		 /   \, 7 / /     (   \ |
		J     \/ j  L______\  / |
		L   __JF"""/""\"\_,    /
		L,-"| O|  f O |  L_  _/
		F   \_ /  \__/   `-  j|
			.-'    `"""    ,' |          _..====.._
			\__/         r"_  A        ,' _..---.._`,
			 `-.______,,-L// / \  ___,' ,'_..:::.. `,`,
					  j   / / / 7"    `-<""=:'  '':. \ \
					 /   <,' /  F  . i , \   `,    :T W I
					 |    \,'  /    >X<  |     \   :| | L
					 |     `._/    ' ! ` |      I  :| |  G
					  \           \     /       |  :H T  |
					 __>-.__   __,-\   |        |  S P   |
					/     /|   | \  \  \_       | 'A R   |
				   /   __/ |   |  L  L   \      K./ /    L
				  /   |    |   4  I  I    |    E./ /   ,'
				 J    \    I    L F  I    |    // / _,'
		_________|     |   F    |J   F    |   //_/-'
		\   __   |    /   J     |/  J     |  /="
		\\  \_\  \__,' \  F     |   F     |
		\\\_____________\/      F__/      F
		 \\| 计算机编程 |_____/  (______/
		  \/从入门到入土/
*/
#include <iostream>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <vector>
#include <sstream>
#include <set>
#include <queue>
#include <stack>
#include <cctype>
#include <map>
#include <climits>
#include <bitset>
#include <functional>
using namespace std;
#define MATH_PI 3.14159265358979323846
int main(){
	ios::sync_with_stdio(false);
	int iLength, iPeople, iSpan;
	cin >> iLength >> iPeople >> iSpan;
	cout << (iLength - iSpan) / (iPeople + iSpan) << endl;
endapp:
	//system("pause > nul");
	return 0;
}

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

int main() {
    int a, b;
    cin >> a >> b;

    if (a <= 9 && b <= 9) cout << a * b << endl;
    else cout << -1 << endl;
    
    return 0;
}

Measured memory_bytes: 256
/**
 *  winners never quit
**/

#include <bits/stdc++.h>

using namespace std;

#define pb push_back
#define mp make_pair
typedef long long Long;
void FastIO(){
  ios::sync_with_stdio(0);
  cin.tie(0);cout.tie(0);
}

const int N = 1e4;

int main()
{
  FastIO();
  int tc, ca = 0;
  string s;
  cin >> s;
  vector <int> v(26, 0);
  for (int i = 0;i < int(s.size());i++){
    v[int(s[i]-97)]++;
  }
  string ans = "Yes";
  for (int i = 0;i < 26;i++){
    if (v[i]%2){
      ans = "No";
      break;
    }
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,m;
const int Maxn=3e7;
int a[500005],li[500005];
int was[500005];
int last[500005];
struct t{
	int ls,rs,sum;
}tree[Maxn];
int root[500005];
int tot=0;
int build(int l,int r){
	int now=++tot;
	if(l==r)return now;
	int mid=(l+r)/2;
	tree[now].ls=build(l,mid);
	tree[now].rs=build(mid+1,r);
	return now;
}
int modify(int now,int l,int r,int goal,int sum){//
	int pos=++tot;
	tree[pos]=tree[now];
//	cout<<"l:"<<l<<" r:"<<r<<endl;
	if(l==r){
		tree[pos].sum+=sum;
		return pos;
	}
	int mid=(l+r)>>1;
	if(goal<=mid){
		tree[pos].ls=modify(tree[now].ls,l,mid,goal,sum);
	}
	else if(goal>mid){
		tree[pos].rs=modify(tree[now].rs,mid+1,r,goal,sum);
	}
	tree[pos].sum=tree[tree[pos].ls].sum+tree[tree[pos].rs].sum;
	return pos;
}
int anss=0;
void query(int pos1,int pos2,int gl,int gr,int l,int r){
//	cout<<"l:"<<l<<" r:"<<r<<"gl:"<<gl<<"gr:"<<gr<<endl;
	if(gl<=l&&r<=gr){
		anss=anss+tree[pos2].sum-tree[pos1].sum;
		return ; 
	}
	int mid=(l+r)>>1;
	if(mid>=gl){
		query(tree[pos1].ls,tree[pos2].ls,gl,gr,l,mid);
	}
	if(mid<gr)query(tree[pos1].rs,tree[pos2].rs,gl,gr,mid+1,r);
}
int main(){
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++){
		scanf("%d",&a[i]);
		was[i]=last[a[i]];
		last[a[i]]=i;
	}
	root[0]=build(0,n);
//	cout<<"alive"<<endl; 
	for(int i=1;i<=n;i++){
		root[i]=modify(root[i-1],0,n,was[i],1);
	}
	int l,r;
	for(int i=1;i<=m;i++){
		scanf("%d%d",&l,&r);
		anss=0;
		query(root[l-1],root[r],0,l-1,0,n);
		cout<<anss<<endl;
	}
	return 0;
} 

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

int main() {
  int N;
  cin >> N;
  vector<long> a(N);
  vector<long> b(N);
  vector<long> c(N);
  for(int i=0;i<N;i++)cin >> a[i];
  for(int i=0;i<N;i++)cin >> b[i];
  for(int i=0;i<N;i++)cin >> c[i];
  sort(a.begin(),a.end());
  sort(b.begin(),b.end());
  sort(c.begin(),c.end());
  vector<long> ba(N);
  vector<long> bc(N);
  int right=0;
  for(int i=0;i<N;i++){
    while(right<N && a[right]<b[i]){
      right++;
    }
    ba[i]=right;
  //  if(right==i)right++;
  }
  int left=N-1;
  for(int i=N-1;i>=0;i--){
    while(left>=0 && c[left]>b[i]){
      left--;
    }
    bc[i]=N-1-left;
 //   if(left==i)left--;
  }
  long sum;
  for(int i=0;i<N;i++){
    sum+=ba[i]*bc[i];
  }
  cout << sum;
    
    
}






Measured memory_bytes: 4224
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
using namespace std;
#define MAX 1000000007
typedef long long ll;



int main(){
  int N;
  cin>>N;
  if(N%2==0) cout<<N<<endl;
  else cout<<2*N<<endl;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

var H, W int
var S = [20][20]string{}

func main() {
	fmt.Scanf("%d %d\n", &H, &W)

	for i := 0; i < H; i++ {
		var s string
		fmt.Scanf("%s", &s)
		rs := []rune(s)
		for j := 0; j < W; j++ {
			s := string(rs[j])
			S[i][j] = s
		}
	}
	var max int

	for i := 0; i < H*W; i++ {
		h := i / W
		w := i % W
		start := S[h][w]
		if start == "#" {
			continue
		}
		r := bfs(i)
		for j := i + 1; j < H*W; j++ {
			gh := j / W
			gw := j % W
			goal := S[gh][gw]
			if goal == "#" {
				continue
			}
			if r[j] > max {
				max = r[j]
			}
		}
	}
	fmt.Println(max)
}

func bfs(s int) map[int]int {
	t := map[int]int{}
	queue := []int{s}
	for len(queue) > 0 {
		q := queue[0]
		queue = queue[1:]
		x := q % W
		y := q / W
		if x > 0 {
			nx := x - 1
			if S[y][nx] == "." {
				nq := nx%W + q - x
				if _, e := t[nq]; !e {
					t[nq] = t[q] + 1
					queue = append(queue, nq)
				}

			}
		}
		if x < W-1 {
			nx := x + 1
			if S[y][nx] == "." {
				nq := nx%W + q - x
				if _, e := t[nq]; !e {
					t[nq] = t[q] + 1
					queue = append(queue, nq)
				}
			}
		}
		if y < H-1 {
			ny := y + 1
			if S[ny][x] == "." {
				nq := ny*W + x
				if _, e := t[nq]; !e {
					t[nq] = t[q] + 1
					queue = append(queue, nq)
				}

			}
		}
		if y > 0 {
			ny := y - 1
			if S[ny][x] == "." {
				nq := ny*W + x
				if _, e := t[nq]; !e {
					t[nq] = t[q] + 1

					queue = append(queue, nq)
				}
			}
		}
	}

	return t
}


Measured memory_bytes: 5504
#include <bits/stdc++.h>
template <typename T>
class SegmentTreeUpdAdd {
public:
    int n;
    std::vector<T> node;
    SegmentTreeUpdAdd(std::vector<T> v) {
        int sz = v.size();
        n = 1; while(n < sz) n *= 2;
        node.resize(2*n, 0);
        for(int i=0;i<sz;++i) node[i+n-1] = v[i];
        for(int i=n-2;i>=0;--i) node[i] = node[2*i+1] + node[2*i+2];
    }
    void update(int idx, T val) {
        assert(0 <= idx && idx < n);
        node[idx + n - 1] = val;
        idx = idx + n - 1;
        while(idx > 0) {
            idx = (idx - 1) / 2;
            node[idx] = node[2*idx + 1] + node[2*idx + 2];
        }
    }
    T query(int a, int b, int k, int l, int r) {
        if(r <= a || b <= l) {
            return 0;
        }
        if(a <= l && r <= b) return node[k];
        T vl = query(a, b, k*2+1, l, (l+r)/2);
        T vr = query(a, b, k*2+2, (l+r)/2, r);
        return vl + vr;
    }
    T query(int a, int b) {
        return query(a, b, 0, 0, n);
    }
};
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const ll MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;
template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}
template<typename T1, typename T2>
ostream& operator<<(ostream &os, const pair<T1, T2> p) {
  os << p.first << ":" << p.second;
  return os;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  int n, q; string s; cin >> n >> s >> q;
  vector<SegmentTreeUpdAdd<int>> v;
  for(int i=0;i<26;++i) {
    vi tmp(n, 0);
    v.emplace_back(SegmentTreeUpdAdd<int>(tmp));
  }
  for(int i=0;i<n;++i) {
    int val = s[i]-'a';
    v[val].update(i, 1);
  }
  while(q) {
    q--;
    int ty; cin >> ty;
    if(ty == 1) {
      int idx; char c; cin >> idx >> c;
      idx--;
      int prev = s[idx] - 'a';
      int nxt = c - 'a';
      v[prev].update(idx, v[prev].node[v[prev].n-1+idx]-1);
      v[nxt].update(idx, v[nxt].node[v[nxt].n-1+idx]+1);
      s[idx] = c;
    } else {
      int l, r; cin >> l >> r;
      l--;
      int cnt = 0;
      for(int i=0;i<26;++i) {
        int res = v[i].query(l, r);
        if(res > 0) cnt++;
      }
      cout << cnt << endl;
    }
  }
}


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

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String  s  = sc.next();
		String  t  = sc.next();
		char[]  new_s = s.toCharArray();
		char[]  new_t = t.toCharArray();
		Arrays.sort(new_s);
		Arrays.sort(new_t);
		String _s = new String(new_s);
		String _t = new StringBuffer( new String(new_t) ).reverse().toString();
		if(_s.compareTo(_t)<0) System.out.println("Yes");
		else	                   System.out.println("No");
	}

}


Measured memory_bytes: 21972
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i=0; i<n; ++i)
#define rep1(i,n) for(ll i=1; i<=n; ++i)
#define revrep(i,n) for(ll i=n-1; n>=0; --i)
inline constexpr ll Inf = (1ULL << 62) -1;
#define fastio cin.tie(nullptr); ios_base::sync_with_stdio(false);
#define endl '\n'
template <class T> bool updmax(T& a, T b) { if (b > a) { a = b; return true;} return false;}
template <class T> bool updmin(T& a, T b) { if (b < a) { a = b; return true;} return false;}

const ll Mod = (ll)1e9+7;
int main() {
    fastio;
    ll ans=0;
    ll N;
    cin >> N;
    vector<ll> a(N);
    rep(i,N) cin >> a[i];
    ll base=1;
    rep(i,60) {
        int zero=0;
        rep(j,N) zero += !(a[j] & (1LL << i));
        ans += (zero*(N-zero) % Mod)*base % Mod;
        ans %= Mod;
        base = base * 2 % Mod;
    }
    cout << ans << endl;
}


Measured memory_bytes: 5536
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>

using namespace std;

#define int long long
#define endl "\n"

constexpr long long INF = (long long)1e18;
constexpr long long MOD = 1'000'000'007; 

string yn(bool f){return f?"Yes":"No";}
string YN(bool f){return f?"YES":"NO";}



signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	string S, T;
	
	cin>>S>>T;
	
	cout<<T + S<<endl;
	
	return 0;
}

Measured memory_bytes: 764
package main

import (
	"fmt"
)

func gcd(a int64, b int64) int64 {
	if a < b {
		a, b = b, a
	}
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}

func lcm(a int64, b int64) int64 {
	return (a / gcd(a, b)) * b
}

func main() {
	var n int
	var m int64
	fmt.Scan(&n)
	fmt.Scan(&m)
	var b []int64
	lcmAll := int64(1)
	for i := 0; i < n; i++ {
		var a int64
		fmt.Scan(&a)
		bi := a / 2
		b = append(b, bi)
		lcmAll = lcm(lcmAll, bi)
		if lcmAll > m {
			fmt.Println(0)
			return
		}
	}
	for i := 0; i < n; i++ {
		if (lcmAll/b[i])%2 == 0 {
			fmt.Println(0)
			return
		}
	}
	var ans int64
	ans = (m/lcmAll + 1) / 2
	fmt.Println(ans)
}


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

int main()
{
    bool S=true;
    string a,b;
    cin >> a >> b ;
    int N=a.size();
    for(int i=0; i<N; i++)
    {
        if(!(a.at(i)==b.at(i)))
        {
            S=false;
        }
    }
    if(S)
    {
        cout << "Yes" <<endl;
    }
    else
    {
        cout << "No" <<endl;
    }
    
}

Measured memory_bytes: 3628
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define MAX 8

int main()
{
	int val = 0, tmp = 0, i = 0, j = 0, diff = 0;
	char str[9], tmpstr[5];

	scanf( "%d", &val );
	for ( int i = 0 ; i < val ; i++ ) {
		scanf( "%d", &tmp );	
		printf( "Case %d:\n", i+1 );
		for ( int k = 0 ; k < 10 ; k++ ) {
			tmp = tmp * tmp;

			memset( str, 0, strlen( str ) );
			memset( tmpstr, 0, strlen( tmpstr ) );
			sprintf( str, "%d", tmp );

			diff = MAX - strlen( str );
			for ( j = strlen( str )-1 ; j >= 0 ; j-- ) {
				str[j+diff] = str[j];	
			}	

			for ( j = 0 ; j < diff ; j++ ) {
				str[j] = '0';
			}

			for ( j = 0 ; j < 4 ; j++ ) {
				tmpstr[j] = str[j+2];
			}
			tmp = atoi( tmpstr );
			printf( "%d\n", tmp );
		}
	}

	return 0;
}



Measured memory_bytes: 1968
#include <bits/stdc++.h>
using namespace std;
int main()
{
    long long w,a,b,x,y,r,s;
    cin>>w>>a>>b;
    r=a+w;
    s=b+w;

    x=max(a,b);
    y=min(r,s);

    if(x>=y)
        cout<<x-y;
        else
         cout<<0;
   return 0;
   }





Measured memory_bytes: 3580
N = int(input())
S = [str(input()) for i in range(N)]

ac = 0
wa = 0
tle = 0
re = 0
for i in S:
    if i=='AC':
        ac+=1
    elif i=='WA':
        wa+=1
    elif i=='TLE':
        tle+=1
    else:
        re+=1
print('AC x '+str(ac))
print('WA x '+str(wa))
print('TLE x '+str(tle))
print('RE x '+str(re))

Measured memory_bytes: 16268
import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;

import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main{

	Scanner sc=new Scanner(System.in);

	int INF=1<<28;
	double EPS=1e-9;

	int m, n;
	int[][] a;

	void run(){
		for(;;){
			m=sc.nextInt();
			n=sc.nextInt();
			if((m|n)==0){
				break;
			}
			a=new int[n][m];
			for(int j=0; j<n; j++){
				for(int i=0; i<m; i++){
					a[j][i]=sc.nextInt();
				}
			}
			solve();
		}
	}

	void solve(){
		long[][] dp=new long[n+1][m];
		for(int i=0; i<m; i++){
			if(a[0][i]==0){
				dp[0][i]=1;
			}
		}
		for(int j=0; j<n-1; j++){
			for(int i=0; i<m; i++){
				switch(a[j][i]){
				case 0:
					if(i-1>=0&&a[j+1][i-1]==0)
						dp[j+1][i-1]+=dp[j][i];
					if(a[j+1][i]!=1)
						dp[j+1][i]+=dp[j][i];
					if(i+1<m&&a[j+1][i+1]==0)
						dp[j+1][i+1]+=dp[j][i];
					break;
				case 2:
					if(j>=n-2||a[j+2][i]!=1)
						dp[j+2][i]+=dp[j][i];
					break;
				}
			}
		}
		long ans=0;
		for(int j=n-1; j<n+1; j++){
			for(int i=0; i<m; i++){
				ans+=dp[j][i];
			}
		}
		println(ans+"");
	}

	void debug(Object... os){
		System.err.println(Arrays.deepToString(os));
	}

	void print(String s){
		System.out.print(s);
	}

	void println(String s){
		System.out.println(s);
	}

	public static void main(String[] args){
		// System.setOut(new PrintStream(new BufferedOutputStream(System.out)));
		new Main().run();
	}
}

Measured memory_bytes: 12000
for i in range(4):
    t,n = map(int, input().split())
    if t==1:
        print(6000*n)
    if t==2:
        print(4000*n)
    if t==3:
        print(3000*n)
    if t==4:
        print(2000*n)
    else:
        pass


Measured memory_bytes: 5596
#include <iostream>
#include <cstdio>
#include <fstream>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <limits.h>
#include <math.h>
#include <functional>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <float.h>
#include <random>

#define repeat(i,n) for (int i = 0; (i) < (n); ++ (i))
#define debug(x) cerr << #x << ": " << x << '\n'
#define debugArray(x,n) for(long long hoge = 0; (hoge) < (n); ++ (hoge)) cerr << #x << "[" << hoge << "]: " << x[hoge] << '\n'
#define debugArrayP(x,n) for(long long hoge = 0; (hoge) < (n); ++ (hoge)) cerr << #x << "[" << hoge << "]: " << x[hoge].first<< " " << x[hoge].second << '\n'

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> Pii;
typedef vector<int> vint;
typedef vector<ll> vll;
const ll INF = LLONG_MAX/10;
const ll MOD = 1e9+7;


int N;
ll dp[410][410];
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin>>N;
  int a[N];
  ll sum[N+1];
  repeat(i,N){
    repeat(j,i+1){
      dp[j][i] = INF;
    }
  }
  sum[0]=0;
  repeat(i,N){
    cin>>a[i];
    dp[i][i]=0;
    sum[i+1] = sum[i]+a[i];
  }
  for(int i=1;i<N;i++){
    repeat(j,N-i){
      for(int k=j;k<j+i;k++){
        dp[j][j+i] = min(dp[j][j+i],dp[j][k]+dp[k+1][j+i]+sum[j+i+1]-sum[j]);
        //debug(dp[j][j+i]);
      }
    }
  }
  cout<<dp[0][N-1]<<endl;
  return 0;
}


Measured memory_bytes: 1536
#include<iostream>
#define mod 1000000007
#define int long long
using namespace std;
int dp[10001][10001]; //Stores number of ways to reach (x,y) from (0,0)
int n,m;
int solve(int n,int m){

	dp[0][0] =1;

	for(int i=0;i<n;i++){
		if(dp[i][0]!=-1)
			dp[i][0]=1;
		else
			break;
	}

	for(int i=1;i<m;i++){
		if(dp[0][i] !=-1)
			dp[0][i] =1;
		else 
			break;
	}

	for(int i=1;i<n;i++)
	{
		for(int j=1;j<m;j++)
		{
			if(dp[i][j]==-1)
				continue;

			if(dp[i-1][j]!=-1)
				dp[i][j] = dp[i-1][j];
			if(dp[i][j-1]!=-1)
				dp[i][j] = (dp[i][j]+dp[i][j-1])%mod;
		}
	}


return dp[n-1][m-1];
}


int32_t main(){

#ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    freopen("output.txt", "w", stdout);
#endif


	//int n,m;
	cin>>n>>m;

	for(int i=0;i<n;i++)
	{
		string s;
		cin>>s;
		for(int j=0;j<m;j++)
		{
			dp[i][j] = ((s[j]=='.')?0:-1);
		}
	}


	cout<<solve(n,m)<<endl;








}

Measured memory_bytes: 15372
#include <stdio.h>
int main(void){
    int n;
    int a[100000+5];
    scanf("%d", &n);
    for(int i=1; i<=n; i++){
        int n;
        scanf("%d", &n);
        a[n]=i;
    }
    for(int i=1; i<=n; i++){
        printf("%d ", a[i]);
    }
    return 0;
}


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

int main()
{
  int N;
  long long A[200000];
  
  cin >> N;
  
  for (int i = 0; i < N; i++)
  {
    cin >> A[i];
  }
  
  int NowSin = 0;
  long long MinFumi = 0;
  
  for (int i = 0; i < N; i++)
  {
    if(A[i] > NowSin) NowSin = A[i];
    else MinFumi += (NowSin - A[i]);
    
    //cout << NowSin << "  " << MinFumi << endl;
  }
  
  
  cout << MinFumi << endl;
    
}

Measured memory_bytes: 5184
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
typedef long long ll;
typedef long double ld;
using namespace std;
const ll MOD=pow(10,9)+7;
const ll INF=(1LL<<62);
const int dx[4]={0,1,0,-1};
const int dy[4]={1,0,-1,0};
const int ddx[8]={1,0,-1,-1,-1,0,1,1};
const int ddy[8]={1,1,1,0,-1,-1,-1,0};
void init(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
}

template< typename Monoid >
class SegmentTree {
public:
  using F = function< Monoid(Monoid, Monoid) >;

  int sz;
  vector< Monoid > seg;

  const F f;
  const Monoid M1;

  SegmentTree(int n, const F f, const Monoid &M1) : f(f), M1(M1) {
    sz = 1;
    while(sz < n) sz <<= 1;
    seg.assign(2 * sz, M1);
  }

  void set(int k, const Monoid &x) {
    seg[k + sz] = x;
  }

  void build() {
    for(int k = sz - 1; k > 0; k--) {
      seg[k] = f(seg[2 * k + 0], seg[2 * k + 1]);
    }
  }

  void update(int k, const Monoid &x) {
    k += sz;
    seg[k] = x;
    while(k >>= 1) {
      seg[k] = f(seg[2 * k + 0], seg[2 * k + 1]);
    }
  }

  Monoid query(int a, int b) {
    Monoid L = M1, R = M1;
    for(a += sz, b += sz; a < b; a >>= 1, b >>= 1) {
      if(a & 1) L = f(L, seg[a++]);
      if(b & 1) R = f(seg[--b], R);
    }
    return f(L, R);
  }

  Monoid operator[](const int &k) const {
    return seg[k + sz];
  }

  template< typename C >
  int find_subtree(int a, const C &check, Monoid &M, bool type) {
    while(a < sz) {
      Monoid nxt = type ? f(seg[2 * a + type], M) : f(M, seg[2 * a + type]);
      if(check(nxt)) a = 2 * a + type;
      else M = nxt, a = 2 * a + 1 - type;
    }
    return a - sz;
  }


  template< typename C >
  int find_first(int a, const C &check) {
    Monoid L = M1;
    if(a <= 0) {
      if(check(f(L, seg[1]))) return find_subtree(1, check, L, false);
      return -1;
    }
    int b = sz;
    for(a += sz, b += sz; a < b; a >>= 1, b >>= 1) {
      if(a & 1) {
        Monoid nxt = f(L, seg[a]);
        if(check(nxt)) return find_subtree(a, check, L, false);
        L = nxt;
        ++a;
      }
    }
    return -1;
  }

  template< typename C >
  int find_last(int b, const C &check) {
    Monoid R = M1;
    if(b >= sz) {
      if(check(f(seg[1], R))) return find_subtree(1, check, R, true);
      return -1;
    }
    int a = sz;
    for(b += sz; a < b; a >>= 1, b >>= 1) {
      if(b & 1) {
        Monoid nxt = f(seg[--b], R);
        if(check(nxt)) return find_subtree(b, check, R, true);
        R = nxt;
      }
    }
    return -1;
  }
};

ll check(vector<pair<ll,ll>>&v,ll X){
    ll N=v.size();
    ll ret=0;
    for(int i=0;i<N;i++){
        ret+=v[i].first*(X-v[i].second);
    }
    return ret;
}

ll check2(vector<pair<ll,ll>>&v,ll X){
    ll N=v.size();
    ll ret=0;
    for(int i=0;i<N;i++){
        ret+=v[i].first*abs(X-v[i].second);
    }
    return ret;
}


int main(){
    init();
    ll N,M;cin>>N>>M;
    if(N==M)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

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

int main(){
    int a, b, x;
    cin >> x >> a >> b;

    if(b <= a) cout << "delicious" << endl;
    else if(b - a <= x) cout << "safe" << endl;
    else cout << "dangerous" << endl;    

    return 0;
}

Measured memory_bytes: 256
def dfs(a)
	a.map!{|e|e.is_a?(Array) ? dfs(e) : e}
	x,y=a.minmax
	raise if x!=0
	y-1
end
s=gets.tr('-',',')
$<.each{|e|s.sub!(*e.split)}
puts dfs(eval s)==0?:Yes: :No rescue puts :No

Measured memory_bytes: 6892
#include <stdio.h>


int main()
{
  int k, a, b;
  int amod;
  
  scanf("%d",&k);
  scanf("%d %d", &a, &b);
  
  amod = a%k;
  a = a/k;
  b = b/k;

  if (amod == 0 || b > a) {
    printf("OK\n");
  } else {
    printf("NG\n");
  }

  return 0;
}

Measured memory_bytes: 1644
a, b, c = gets.chomp.split.map(&:to_f)
puts 1.0/2.0 * a * b * Math::sin(c/180*Math::PI)
puts a + b + Math::sqrt(a**2 + b**2 - 2.0*a*b*Math::cos(c/180*Math::PI))
puts b * Math::sin(c/180*Math::PI)

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

int main() {
  int N, K, pre = 0;
  vector<int> needtry(100000);
  
  double wr;
  cin >> N >> K;
  
  for(int dice=1; dice<=N; dice++){
    pre = 0;
    while(pre < K){
      pre = dice * pow(2, needtry.at(dice-1));
      if(pre < K) needtry.at(dice-1)++;
    }
    wr += (1.0/N)*pow(1/2.0,needtry.at(dice-1));
  }
  cout << fixed << setprecision(10);
  cout << wr << endl;
}

Measured memory_bytes: 640
/* atcoder */
#include "bits/stdc++.h"
using namespace std;

/* typedef */
/* long系 */
typedef long long ll;   // long long
typedef long double ld; // long double
/* vector系 */
typedef vector<int> vi;                    // intのvector
typedef vector<double> vd;                 // doubleのvector
typedef vector<ll> vll;                    // llのvector
typedef vector<ld> vld;                    // ldのvector
typedef vector<vector<int>> vvi;           // intの2次元vector
typedef vector<vector<double>> vvd;        // doubleの2次元vector
typedef vector<vector<ll>> vvll;           // llの2次元vector
typedef vector<vector<ld>> vvld;           // ldの2次元vector
typedef vector<pair<int, int>> vi_i;       // i_iのvector
typedef vector<pair<double, double>> vd_d; // d_dのvector
typedef vector<pair<ll, ll>> vl_l;         // l_lのvector
typedef vector<pair<ld, ld>> vld_ld;       // ld_ldのvector
typedef vector<string> vs;                 // stringのvector
/* pair系 */
typedef pair<int, int> i_i;       // int同士のpair
typedef pair<double, double> d_d; // double同士のpair
typedef pair<ll, ll> l_l;         // ll同士のpair
typedef pair<ld, ld> ld_ld;       // ld同士のpair

/* define */
#define all(v) v.begin(), v.end() // コンテナ全体
#define PI (acos(-1))             // 円周率pi

/* stringstream */
stringstream ss;
stringstream init_ss; // save default formatting

/* upper, lower */
struct ToUpper
{
    char operator()(char c)
    {
        return toupper(c);
    }
};
struct ToLower
{
    char operator()(char c)
    {
        return tolower(c);
    }
};

//素因数分解
vector<l_l> factorsize(ll n)
{
    vector<l_l> res;
    for (ll i = 2; i * i <= n; i++)
    {
        if (n % i != 0)
        {
            continue;
        }
        else
        {
            l_l fs{i, 0};
            while (n % i == 0)
            {
                n /= i;
                fs.second++;
            }
            res.push_back(fs);
        }
    }
    if (n != 1)
    {
        l_l gs{n, 1};
        res.push_back(gs);
    }
    return res;
}

/* main */
void Main(void)
{
    ll n;
    cin >> n;
    vl_l a = factorsize(n);
    ll sum = 0;
    for (ll i = 0; i < a.size(); i++)
    {
        ll j = 1;
        for (;; j++)
        {
            ll num = j * (j + 1) / 2;
            if (num > a[i].second)
            {
                j--;
                break;
            }
        }
        sum += j;
    }
    cout << sum << endl;
}

int main(void)
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();

    return 0;
}


Measured memory_bytes: 3656
fn main() {
  let n = get::val::<usize>();
  let xs = get::list::<usize>();
  
  let mut freq = vec![0; n];
  for x in xs {freq[x] += 1}
  
  let map = (0..).zip(freq.into_iter()).filter(|&(_,x)|x!=0).collect::<Vec<_>>();
  
  if map.len() == 1 && (map[0].0 == n-1 || map[0].0 <= n/2) {
    println!("Yes");
    return
  }
  
  if map.len() == 2 {
    let (imin, xmin) = map[0];
    let (imax, xmax) = map[1];
    if imin+1 == imax && xmin <= imin && xmin > imin - xmax / 2 {
      println!("Yes");
      return
    }
  }

  println!("No")
} 

#[allow(dead_code)]
mod get {
  use std::io::*;
  use std::str::*;

  pub fn val<T: FromStr>() -> T {
    let mut buf = String::new();
    let s = stdin();
    s.lock().read_line(&mut buf).ok();
    buf.trim_right().parse::<T>().ok().unwrap()
  }

  pub fn vals<T: FromStr>(n: usize) -> Vec<T> {
    let mut vec: Vec<T> = vec![];
    for _ in 0 .. n {
      vec.push(val());
    }
    vec
  }

  pub fn tuple<T1: FromStr, T2: FromStr>() -> (T1, T2) {
    let mut buf = String::new();
    let s = stdin();
    s.lock().read_line(&mut buf).ok();
    let mut it = buf.trim_right().split_whitespace();
    let x = it.next().unwrap().parse::<T1>().ok().unwrap();
    let y = it.next().unwrap().parse::<T2>().ok().unwrap();
    (x, y)
  }

  pub fn tuples<T1: FromStr, T2: FromStr>(n: usize) -> Vec<(T1, T2)> {
    let mut vec: Vec<(T1, T2)> = vec![];
    for _ in 0 .. n {
      vec.push(tuple());
    }
    vec
  }

  pub fn tuple3<T1: FromStr, T2: FromStr, T3: FromStr>() -> (T1, T2, T3) {
    let mut buf = String::new();
    let s = stdin();
    s.lock().read_line(&mut buf).ok();
    let mut it = buf.trim_right().split_whitespace();
    let x = it.next().unwrap().parse::<T1>().ok().unwrap();
    let y = it.next().unwrap().parse::<T2>().ok().unwrap();
    let z = it.next().unwrap().parse::<T3>().ok().unwrap();
    (x, y, z)
  }

  pub fn tuple3s<T1: FromStr, T2: FromStr, T3: FromStr>(n: usize) -> Vec<(T1, T2, T3)> {
    let mut vec: Vec<(T1, T2, T3)> = vec![];
    for _ in 0 .. n {
      vec.push(tuple3());
    }
    vec
  }

  pub fn list<T: FromStr>() -> Vec<T> {
    let mut buf = String::new();
    let s = stdin();
    s.lock().read_line(&mut buf).ok();
    buf.trim_right().split_whitespace().map(|t| t.parse::<T>().ok().unwrap()).collect()
  }

  pub fn lists<T: FromStr>(h: usize) -> Vec<Vec<T>> {
    let mut mat: Vec<Vec<T>> = vec![];
    for _ in 0 .. h {
      mat.push(list());
    }
    mat
  }

  pub fn chars() -> Vec<char> {
    let mut buf = String::new();
    let s = stdin();
    s.lock().read_line(&mut buf).ok();
    buf.trim_right().chars().collect()
  }
}


Measured memory_bytes: 10492
function calc(index, l, cost, Ai, C, X) {
  const A = Ai[index]
  const c = C[index]
  // console.log('input:', index, A, l, cost)
  cost += c
  let ok = true
  for(let i = 0; i < l.length; i++) {
    l[i] += A[i]
    if (l[i] < X) {
      ok = false
    }
  }
  // それ以下のものを計算

  // console.log('calced', index, A, l, cost, ok)

  if (ok) {
    return cost
  }
  if (index === C.length - 1) {
    return -1
  }

  let min = -1
  for (let i = index + 1; i < C.length; i++) {
    // console.log('recursive', index, i)
    let _min = calc(i, Array.from(l), cost, Ai, C, X)
    if (_min === -1) continue
    if (min === -1) {
      min = _min
    }
    min = min < _min ? min : _min
    // console.log('min:', min)
  }
  return min
}

function main(input) {
  const inputs = input.trim().split('\n')
  let [N, M, X] = inputs[0].split(' ').map(Number)
  let C = []
  let Ai = inputs.slice(1).map(e => {
    const [c, ...ai] = e.split(' ').map(Number)
    C.push(c)
    return ai
  })

  // console.log('log')
  // console.log(N, M, X)
  // console.log(C)
  // console.log(Ai)
  // 総当り 12冊しかないの

  let min = -1

  // すべての本について1冊からM冊まで計算、 最小の値を取得する/
  for(let i = 0; i < N; i++) {
    let _min = calc(i, Array.from(new Array(M)).map(e => 0), 0, Ai, C, X)
    // console.log('root:', _min)
    if (_min === -1) continue
    if (min === -1) {
      min = _min
    }
    min = min < _min ? min : _min
  }
  console.log(min)
}

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


Measured memory_bytes: 33612
n, m = map(int, input().split())
py = [tuple(map(int, input().split())) for _ in range(m)]

spy = sorted(py, key=lambda x: x[1])
ids = {}
maxy = [1] * (n + 1)
for p, y in spy:
    ids[(p, y)] = maxy[p]
    maxy[p] += 1
for p, y in py:
    print('{:0=6}'.format(p) + '{:0=6}'.format(ids[p,y]))




Measured memory_bytes: 35708
#include <iostream>
#include <unordered_map>

using namespace std;

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

    unordered_map<int, int> m;
    while (n--) {
        int a;
        cin >> a;
        if (m[a]) ++m[a];
        else m[a] = 1;
    }
    int ans = 0;
    for (auto& p : m) {
        if (p.second % 2 != 0) ++ans;
    }
    cout << ans << endl;
}

Measured memory_bytes: 4388
#include <bits/stdc++.h>
#define FI first
#define SE second
#define EPS 1e-9
#define ALL(a) a.begin(),a.end()
#define SZ(a) int((a).size())
#define MS(s, n) memset(s, n, sizeof(s))
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORE(i,a,b) for (int i = (a); i >= (b); i--)
#define FORALL(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define WHATIS(x) cout << #x << " is " << x << endl;
#define ERROR(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
//__builtin_ffs(x) return 1 + index of least significant 1-bit of x
//__builtin_clz(x) return number of leading zeros of x
//__builtin_ctz(x) return number of trailing zeros of x

using namespace std;
using ll = long long;
using ld = double;
typedef pair<int, int> II;
typedef pair<II, ll> III;
typedef complex<ld> cd;
typedef vector<cd> vcd;

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

const ll MODBASE = 1000000007LL;
const int MAXN = 100010;
const int MAXM = 35;
const int MAXK = 510;
const int MAXQ = 200010;

int n, a[MAXN];
stack<int> s;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    cin >> n;
    FOR(i,1,n) cin >> a[i];
    int res = 0;
    FOR(i,1,n)
        if (i == a[i]) {
            if (s.empty()) s.push(i);
            else {
                if (s.top() == i-1) {
                    s.pop();
                    res++;
                }
                else s.push(i);
            }
        }
    res += SZ(s);
    cout << res;
    return 0;
}

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

void chmax(ll& a, ll b) { a = max(a, b); }
void chmin(ll& a, ll b) { a = min(a, b); }

using P = pair<int, int>;

const int MAX_N = 1e5+5;
const int INF = 1001001001;

vector<int> a, ans;
vector<int> to[MAX_N];
int dp[MAX_N];

ll modnum = 1e9+7;

using Graph = vector<vector<int>>;
Graph G(MAX_N);

ll dfs(int k, int now, int from=-1) {
    int use_num = k;
    if(from == -1) {
        // 根だけは特別
        use_num = k-1;
    } else {
        use_num = k-2;
    }
    if(k < G[now].size()) {
        // 色が足りない場合
        return 0;
    }
    ll case_num=1;
    for(auto e : G[now]) {
        if(e == from) continue;

        case_num *= use_num;
        use_num--;
        case_num %= modnum;
    }

    for(auto e : G[now]) {
        if(e == from) continue;
        case_num *= dfs(k, e, now);
        case_num %= modnum;
    }
    return case_num;
}

int main() {
    int n,k; cin >> n >> k;
    rep(i, n-1) {
        int a,b; cin >> a >> b;
        a--;
        b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }

    ll ans = k*dfs(k,0);
    ans %= modnum;
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 13952
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  ll n;
  cin >> n;
  deque<ll> dq;
  rep(i, n) {
    ll a;
    cin >> a;
    if(i % 2)
      dq.push_front(a);
    else
      dq.push_back(a);
  }
  while(!dq.empty()) {
    if(n % 2) {
      cout << dq.back() << ' ';
      dq.pop_back();
    } else {
      cout << dq.front() << ' ';
      dq.pop_front();
    }
  }
  cout << endl;
}

Measured memory_bytes: 3840
#include <iostream>
#include <math.h>
#include <stdio.h>
using namespace std;

int main() {
	// your code goes here
	long long h;
	long long res = 1;
	int respower;
	cin>>h;
	respower = (int)ceil(log2(h+1));
	for(int i=0;i<respower;i++)
		res = res * 2;
	cout<<res-1;
	return 0;
}

Measured memory_bytes: 384
import sys
input=sys.stdin.readline
sys.setrecursionlimit(10 ** 8)
from itertools import accumulate
from itertools import permutations
from itertools import combinations
from collections import defaultdict
from collections import Counter
import fractions
import math
from collections import deque
from bisect import bisect_left
from bisect import insort_left
import itertools
from heapq import heapify
from heapq import heappop
from heapq import heappush
import heapq
#import numpy as np
INF = float("inf")
#d = defaultdict(int)
#d = defaultdict(list)
#N = int(input())
#A = list(map(int,input().split()))
#S = list(input())
#S.remove("\n")
#N,M = map(int,input().split())
#S,T = map(str,input().split())
#A = [int(input()) for _ in range(N)]
#S = [list(input())[:-1] for _ in range(N)]
#A = [list(map(int,input().split())) for _ in range(N)]
t = int(input())
for _ in range(t):
    n, a, b, c, da = map(int, input().split())
    hq = [(0, n)]
    d = defaultdict(lambda: 10 ** 25)
    d[n] = 0
    while hq:
        cs, p = heapq.heappop(hq)
        if d[p] < cs:
            continue
        if d[p // 2] > cs + a + (p % 2) * da:
            heapq.heappush(hq, (cs + a + (p % 2) * da, p // 2))
            d[p // 2] = cs + a + (p % 2) * da
        if d[p // 2 + 1] > cs + a + da:
            heapq.heappush(hq, (cs + a + da, p // 2 + 1))
            d[p // 2 + 1] = cs + a + da
        if d[p // 3] > cs + b + (p % 3) * da:
            heapq.heappush(hq, (cs + b + (p % 3) * da, p // 3))
            d[p // 3] = cs + b + (p %3) * da
        if d[p // 3 + 1] > cs + b +  (1+(p%3)%2)* da:
            heapq.heappush(hq, (cs + b + (1+(p%3)%2) * da, p // 3 + 1))
            d[p // 3 + 1] = cs + b + (1+(p%3)%2) * da
        ccc = p % 5
        if ccc <= 2:
            if d[p//5] > cs+c+ccc*da:
                heapq.heappush(hq,(cs+c+ccc*da,p//5))
                d[p//5] = cs+c+ccc*da
            if d[p//5 +1] > cs+c+(ccc+1)*da:
                heapq.heappush(hq,(cs+c+(ccc+1)*da,p//5 +1))
                d[p//5 +1] = cs+c+(ccc+1)*da
        else:
            if d[p//5] > cs+c+(6-ccc)*da:
                heapq.heappush(hq,(cs+c+(6-ccc)*da,p//5))
                d[p//5] = cs+c+(6-ccc)*da
            if d[p//5 +1] > cs+c+(5-ccc)*da:
                heapq.heappush(hq,(cs+c+(5-ccc)*da,p//5 +1))
                d[p//5 +1] = cs+c+(5-ccc)*da
    ans = 10 ** 25
    for k, v in d.items():
        ans = min(ans, k * da + v)
    print(ans)

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

int main() {
    int n,k;
    cin >> n >> k;
    cout << n-(k-1) << endl;
    return 0;
}

/*
やっほい！
　　　　　　　やほほい！
　　　　+　　 　*
　　　 ∧∧　　. ∧∞∧　*
*　ヽ(=´ω｀)人(´ω｀*)ﾉ
　.～（ O x.） （ 　 O)～　+
。*　 　∪　　　　∪
*/

Measured memory_bytes: 256
#include <vector>
#include <iostream>
#include <cmath>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <fstream>
#include <unistd.h>
#include <string>
#include <numeric>
#include <queue>
#include <deque>
#include <sstream>
#include <iomanip>
#include <set>
#include <stack>
#include <cassert>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vvb> vvvb;
typedef vector<vvvb> vvvvb;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<vvd> vvvd;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
typedef vector<P> vp;
typedef vector<PL> vpl;
typedef vector<vector<P>> vvp;
typedef vector<vector<PL>> vvpl;
const int INF = 1001001001;
const ll LINF = 1e16;
const double pi = 3.1415926535897932;
const string endstr = "\n";
#define FOR(i, a, b) for(ll i = (a); i < b; i++)
#define REP(i, n) for(ll i = 0; i < n; i++)
#define FORMAP(it, m) for(auto it = m.begin(); it != m.end(); it++)
#define ff first
#define ss second
#define pb push_back

template <typename T>
T gcd(T a, T b) {
    return (a == 0) ? b : gcd(b%a, a);
}
template <typename T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}

bool p_comp_fs(const PL p1, const PL p2){ return p1.first < p2.first;};
bool p_comp_fg(const PL p1, const PL p2){ return p1.first > p2.first;};
bool p_comp_ss(const PL p1, const PL p2){ return p1.second < p2.second;};
bool p_comp_sg(const PL p1, const PL p2){ return p1.second > p2.second;};
template <typename T>
vector<T> uniquen(vector<T> vec){
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
    return vec;
}

vl A, sum;
ll N;

bool ok(ll idx){
    ll now = A[idx] + sum[idx];
    FOR(k, idx+1, N){
        if(now*2 < A[k]) return false;
        now += A[k];
    }
    return true;
}

int main(){
    cin >> N;
    REP(i, N) {ll a; cin >> a; A.pb(a);};
    sort(A.begin(), A.end());
    sum = vl(N+1, 0);
    REP(i, N) sum[i+1] = sum[i] + A[i];
    
    ll l = 0, r = N-1;
    while(abs(r-l) > 1){
        ll mid = (r+l)/2;
        bool flag = ok(mid);
        if(flag) r = mid;
        else l = mid;
    }
    ll st = 0;
    if(ok(l)) st = l;
    else if(ok(r)) st = r;
    
    cout << N-st << endl;
    return 0;
}


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

using namespace std;

int main() {
	int w, h, cenX, cenY;;
	char c;
	char flag[21][21];

	fill_n(&flag[0][0], 21 * 21, '.');
	cin >> w >> h >> c;
	cenX = w / 2;
	cenY = h / 2;
	for (int i = 0; i < h; ++i) {
		for (int j = 0; j < w; ++j) {
			if (i == 0 || i == h - 1) {
				if (j == 0 || j == w - 1) {
					flag[i][j] = '+';
				} else {
					flag[i][j] = '-';
				}
				continue;
			}
			if (j == 0 || j == w - 1) {
				if (i > 0 && i < h - 1) {
					flag[i][j] = '|';
					continue;
				}
			}
			if (i == cenY && j == cenX) {
				flag[i][j] = c;
				continue;
			}
		}
	}
	for (int i = 0; i < h; ++i) {
		for (int j = 0; j < w; ++j) {
			cout << flag[i][j];
		}
		cout << endl;
	}

	return 0;
}


Measured memory_bytes: 3088
#include <stdio.h>

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

int main(void)
{
  int a, b;
  while (~scanf("%d %d", &a, &b)){
    printf("%d %d\n", gcd(a, b), lcm(a, b));
  }
  return (0);
}

Measured memory_bytes: 596
// Problem : C - Good Sequence
// Contest : AtCoder - AtCoder Beginner Contest 082
// URL : https://atcoder.jp/contests/abc082/tasks/arc087_a
// Memory Limit : 256 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

//#pragma GCC optimize("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define eb emplace_back
#define pb push_back
#define size(s) (int)s.size()
#define int long long
#define vi vector<int>
#define vs vector<string>
#define vv vector<vector<int>>
#define pii pair<int,int>
#define m_p(x,y) make_pair(x,y)
#define vp vector<pair<int,int>>
#define setbits(x) __builtin_popcountll(x)
#define f first
#define se second
#define inc(v,n,x) v.assign(n,x)
#define incd(v,n) v.resize(n)
#define iniz(n) memset(n,0,sizeof(n))
#define inin(n) memset(n,-1,sizeof(n))
#define inimi(n) memset(n,0xc0,sizeof(n))
#define inima(n) memset(n,0x3f,sizeof(n))
#define all(v) (v).begin(),(v).end()

using namespace std;

template<typename T1,typename T2>istream &operator>>(istream &is, vector<pair<T1,T2>> &v) { for (pair<T1,T2> &t : v) is >> t.f>>t.se; return is; }
template<typename T>istream &operator>>(istream &is, vector<T> &v) { for (T &t : v) is >> t; return is; }
template<typename T>ostream &operator<<(ostream &os, const vector<T> &v) { for (const T &t : v) {os << t <<" ";} os << '\n'; return os; }

const int N=200001;
double pi=acos(-1.0);
int md=1e9+7;
const int INF=1e15;
int dx1[]={0,0,-1,1};
int dy1[]={1,-1,0,0};

template<class T>
T abst(T a)
{return a<0?-a:a;}

void solve()
{
	int n;cin>>n;
	vi v(n);cin>>v;
	map<int,int> mp;
	for(int i:v)
	mp[i]++;
	int cnt=0;
	for(pii p:mp)
	{
		if(p.se>=p.f)
		{
			cnt+=(p.se-p.f);
		}
		else
		cnt+=p.se;
	}
	cout<<cnt;
}

int32_t main(){
ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
int t=1;
//cin>>t;
for(int i=1;i<=t;i++)
{
    solve();
}
return 0;
}


Measured memory_bytes: 9992
#include<stdio.h>
#include<algorithm>
using namespace std;
int mod=10000;
int dp[110][3][3];
int p[110];
int main(){
	int a,b;
	scanf("%d%d",&a,&b);
	for(int i=0;i<110;i++)p[i]=-1;
	for(int i=0;i<b;i++){
		int s,t;scanf("%d%d",&s,&t);
		s--;t--;
		p[s]=t;
	}
	for(int i=0;i<3;i++){
		for(int j=0;j<3;j++){
			if(p[0]!=-1&&p[0]!=i)continue;
			if(p[1]!=-1&&p[1]!=j)continue;
			dp[2][i][j]=1;
		}
	}
	for(int i=2;i<a;i++){
		for(int j=0;j<3;j++)for(int k=0;k<3;k++)for(int l=0;l<3;l++){
			if(j==k&&k==l)continue;
			if(p[i]!=-1&&l!=p[i])continue;
			dp[i+1][k][l]=(dp[i+1][k][l]+dp[i][j][k])%mod;
		}
	}
	int ret=0;
	for(int i=0;i<3;i++)for(int j=0;j<3;j++){
		ret=(ret+dp[a][i][j])%mod;
	}
	printf("%d\n",ret);
}

Measured memory_bytes: 1032
N=int(input())
li = [input() for i in range(N)]
a=b=c=d=0
for j in range(0,N):
  item=li[j]
  if item=="AC":
    a+=1
  elif item=="WA":
    b+=1
  elif item=="TLE":
    c+=1
  elif item=="RE":
    d+=1
print("AC x {}\nWA x {}\nTLE x {}\nRE x {}".format(a,b,c,d))

Measured memory_bytes: 16328