akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
import java.lang.*;
import java.math.*;

public class Main {
	Scanner sc = new Scanner(System.in);
	class Cir{
		Double x;
		Double y;
		Double r;
		Cir(Double x, Double y , Double r){
			this.x = x;
			this.y = y;
			this.r = r;
		}
		Cir(){}
		Double dist2(Cir c){
			Double ret = (this.x -c.x)* (this.x -c.x) + (this.y -c.y) * (this.y -c.y);
			return ret;
		}
		
	}
	void run(){
		int n = sc.nextInt();
		for(int i = 0; i < n ; i ++){
			Cir a = new Cir(sc.nextDouble(),sc.nextDouble(),sc.nextDouble());
			Cir b = new Cir(sc.nextDouble(),sc.nextDouble(),sc.nextDouble());
			Double dist  = Math.sqrt(a.dist2(b));
			if(dist+b.r < a.r ){
				System.out.println("2");
				continue;
			}
			if(dist+a.r < b.r ){
				System.out.println("-2");
				continue;
			}
			if(dist > b.r + a.r ){
				System.out.println("0");
				continue;
			}
			System.out.println("1");			
		}
	}
	public static void main(String[] args){
		Main m = new Main();
		m.run();
		
	}
}

Measured memory_bytes: 12000
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    VI a(3);
    cin >> a[0] >> a[1] >> a[2];
    sort(ALL(a));
    cout << a[2] - a[0] << endl;
    return 0;
}


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

using namespace std;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;

void ABC142B()
{
	int N, K;
	cin >> N >> K;
	vi h(N);
	for (auto& x : h)
		cin >> x;
	sort(h.begin(), h.end());
	auto x = distance(lower_bound(h.begin(), h.end(), K), h.end());
	cout << x << endl;
}


int main()
{
	ABC142B();
	return 0;
}

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

using namespace std;
typedef long long ll;
typedef pair<ll, ll> p_ll;

template<class T>
void debug(T itr1, T itr2) { auto now = itr1; while(now<itr2) { cout << *now << " "; now++; } cout << endl; }
#define repr(i,from,to) for (int i=(int)from; i<(int)to; i++)
#define all(vec) vec.begin(), vec.end()
#define rep(i,N) repr(i,0,N)
#define per(i,N) for (int i=(int)N-1; i>=0; i--)

const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;

vector<ll> fac;
void c_fac(int x=pow(10,6)+10) { fac.resize(x,true); rep(i,x) fac[i] = i ? (fac[i-1]*i)%MOD : 1; }
ll inv(ll a, ll m=MOD) { ll b = m, x = 1, y = 0; while (b!=0) { int d = a/b; a -= b*d; swap(a,b); x -= y*d; swap(x,y); } return (x+m)%m; }
// ll nck(ll n, ll k) { return fac[n]*inv(fac[k]*fac[n-k]%MOD)%MOD; }
ll gcd(ll a, ll b) { if (a<b) swap(a,b); return b==0 ? a : gcd(b, a%b); }
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; }


int main() {
  int N, K; cin >> N >> K;
  int a[K]; rep(i,K) cin >> a[i];

  ll dp[K+1][N+1] = {}; dp[0][0] = 1;
  ll nck[1010][1010] = {};
  rep(i,1010) rep(j,i+1) {
    if (j==0||j==i) nck[i][j] = 1;
    else nck[i][j] = (nck[i-1][j] + nck[i-1][j-1]) % MOD;
  }
  rep(i,K) rep(j,N+1) {
    rep(k,j+1) {
      ll pos = nck[N-k][N-a[i]] * nck[j][k] % MOD;
      dp[i+1][j] += dp[i][j-k] * pos;
      dp[i+1][j] %= MOD;
    }
  }
  // rep(i,K+1) debug(dp[i],dp[i]+(N+1));
  ll result = dp[K][N];
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 8320
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <complex>
#include <math.h>
#include <ctype.h>
using namespace std;
int n,A[1000];
int main() {
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> A[i];
	}
	for (int ii = 0; ii < n - 1; ii++)
	{
		cout << A[ii] << " ";
	}
	cout << A[n - 1] << endl;

	for (int i = 1; i < n; i++) {
		int v = A[i];
		int j = i - 1;
		while (j >= 0 && A[j] > v) {
			A[j + 1] = A[j];
				j--;
				A[j + 1] = v;
		}

		for (int ii = 0; ii < n - 1; ii++)
		{
			cout << A[ii] << " ";
		}
		cout << A[n - 1] << endl;
	}
	return 0;
}


Measured memory_bytes: 1164
# coding: utf-8
n, q = map(int,input().split())
par=[0]
rank=[0]
for i in range(1, n+1):
    par.append(i)
    rank.append(0)

def find(x):
    if par[x]==x:
        return x
    else:
        par[x] = find(par[x])
        return par[x]

def unite(x, y):
    root_x = find(x)
    root_y = find(y)
    if root_x == root_y:
        return
    if rank[root_x] < rank[root_y]:
        par[root_x] = root_y
    else:
        par[root_y] = root_x
    
    if rank[root_x] == rank[root_y]:
        rank[root_x] += 1
def same(x, y):
    return find(x) == find(y)


for i in range(q):
    t, u, v = map(int,input().split())
    if t == 0:
        unite(u, v)
    else:
        if same(u, v):
            print(1)
        else:
            print(0)

Measured memory_bytes: 17808
#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/03/12  Problem: ABC 079 B / Link: http://abc079.contest.atcoder.jp/tasks/abc079_b  ----- */


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

	VL L(90);
	L[0] = 2, L[1] = 1;
	FOR(i, 2, 90) {
		L[i] = L[i - 1] + L[i-2];
	}

	LL N; 
	cin >> N;
	
	LL ans = L[N];
	
	
	cout << (ans) << "\n";

	return 0;
}


Measured memory_bytes: 256
import sys
from fractions import gcd
from itertools import permutations, combinations, accumulate
from collections import deque
from heapq import heappush, heappop, heapify
import math
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
MOD = 10**9 + 7

def main():
    n,m = list(map(int,input().split()))
    if n == m:
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()

Measured memory_bytes: 5052
import java.util.*;

public class Main {
    public static void main(String args[]) {
  Scanner sc=new Scanner(System.in);
        
       long n=sc.nextLong();
     
       HashMap<Long,Long> map=new HashMap<>();
       long sum=0;
       for(long i=0;i<n;i++)
       {
           long k=sc.nextLong();
           sum+=k;
           if(map.containsKey(k))
           {
              long b=map.get(k);
               map.put(k,b+1);
           }
           else
           map.put(k,1L);
       }
       
       long q=sc.nextLong();
       
        for(long i=0;i<q;i++)
        {
            
            long b=sc.nextLong();
         long  c=sc.nextLong();
            
            if(map.containsKey(b))
            {
                
                long k=map.get(b);
                
                sum=sum- (long)k*b+ (long)k*c;
                map.remove(b);
                
                    if(map.containsKey(c))
                    {
                      long v=map.get(c);
                        map.put(c,v+k);
                    }
                    else
                    map.put(c,k);
          
            }
            System.out.println(sum);
            
        }

    }
}

Measured memory_bytes: 67340
import sys
inp=sys.stdin.readline()
K,S=map(lambda x: int(x), inp.split(' '))
K,S

if S<=K:
    ret=(S+1)*(S+2)/2
elif S>=K*2:
    S=K*3-S
    ret=(S+1)*(S+2)/2
else:
    ret=(S+1)*(S+2)/2-(S-K)*(S-K+1)/2*3
print(int(ret))

Measured memory_bytes: 3192
#include <bits/stdc++.h>
using namespace std;
const int INF=1e9;
const int MOD=1e9+7;
//const int MOD=998244353;
const long long LINF=1e18;
#define int long long
//template
int red[505][505],blue[505][505];
//main
signed main(){
  int H,W;cin>>H>>W;
  std::vector<string> s(H);
  for(int i=0;i<H;i++)cin>>s[i];
  for(int i=0;i<H;i++){
    red[i][0]++;blue[i][W-1]++;
    for(int j=0;j<W-1;j++){
      if(i&1)red[i][j]++;
      else blue[i][j+1]++;
    }
  }
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      red[i][j]+=s[i][j]=='#';
      blue[i][j]+=s[i][j]=='#';
    }
  }
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      if(red[i][j])cout<<"#";
      else cout<<".";
    }
    cout<<endl;
  }
  cout<<endl;
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      if(blue[i][j])cout<<"#";
      else cout<<".";
    }
    cout<<endl;
  }
}


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


struct Dsu {
  struct node_struct {
    int par, size;
    node_struct(int p, int s) : par(p), size(s) {}
    void merge(node_struct &b) {
      b.par = par;
      size += b.size;
    }
  };
  vector<node_struct> nodes;
  stack<tuple<int, int, node_struct, node_struct>> stk;
  Dsu(int n) {
    nodes.reserve(n);
    for (int i = 0; i < n; ++i) nodes.emplace_back(i, 1);
  }
  int anc(int x) {
    while (x != nodes[x].par) x = nodes[x].par;
    return x;
  }
  bool unite(int x, int y) {
    int a = anc(x);
    int b = anc(y);
    stk.emplace(a, b, nodes[a], nodes[b]);
    if (a == b) return false;
    if (nodes[a].size < nodes[b].size) swap(a, b);
    nodes[a].merge(nodes[b]);
    return true;
  }
  void revert(int version = -1) {  // 0 index
    if (version == -1) version = stk.size() - 1;
    for (; stk.size() != version; stk.pop()) {
      nodes[get<0>(stk.top())] = get<2>(stk.top());
      nodes[get<1>(stk.top())] = get<3>(stk.top());
    }
  }
};


vector<tuple<int, int, int, int>> E;

vector<vector<pair<int, int>>> g;


int ans[1<<17], pa[1<<17], paid[1<<17];
int tin[1<<17], tout[1<<17];

void dfs(int u, int p) {
  static int cur = 0;
  tin[u] = cur++;
  for (auto P : g[u]) {
    int v, i; tie(v, i) = P;
    if (v == p) continue;
    pa[v] = u, paid[v] = i;
    dfs(v, u);
  }
  tout[u] = cur;
}
 

bool anc(int u, int p) {
  return tin[p] <= tin[u] and tout[u] <= tout[p];
}
  

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0);
	int n, m; cin >> n >> m;
  fill(ans, ans + m, INT_MAX);
  g.resize(n);
  for (int i = 0; i < m; ++i) {
    int u, v, w; cin >> u >> v >> w;
    --u, --v;
    E.emplace_back(w, v, u, i);
  }
  sort(E.begin(), E.end());
  Dsu djs(n);
  for (auto T : E) {
    int u, v, w, i;
    tie(w, u, v, i) = T;
    if (djs.unite(u, v)) {
      g[u].emplace_back(v, i);
      g[v].emplace_back(u, i);
    }
    else ans[i] = w;
  }
  dfs(0, 0);
  for (auto T : E) {
    int u, v, w, i; tie(w, u, v, i) = T;
    if (pa[u] == v or pa[v] == u) continue;
    for (int _ = 0; _ < 2; ++_, swap(u, v)) {
      while (not anc(u, v)) {
        ans[paid[v]] = min(ans[paid[v]], w);
        v = pa[v];
      }
    }
  }
  int ansnum = 0, answ = 0;
  for (auto T : E) {
    int u, v, w, i; tie(w, u, v, i) = T;
    if (ans[i] > w) ++ansnum, answ += w;
  }
  cout << ansnum << ' ' << answ << '\n';
}



Measured memory_bytes: 5216
<?php
$a=array();
for($i=0;$i<3;$i++){
    $query = trim(fgets(STDIN));
    $a[$i] = sscanf($query,"%d %d %d");
}
$N = trim(fgets(STDIN));
for($i=0;$i<$N;$i++){
    $b = trim(fgets(STDIN));
    for($j=0;$j<3;$j++){
        for($m= 0;$m<3;$m++){
            if ($b == $a[$j][$m]){
                $a[$j][$m] = -1;
            }
        }
    }
}
for($i=0;$i<3;$i++){
    if(($a[$i][ 0] == $a[$i][1])&&($a[$i][1] == $a[$i][2])){
        printf("Yes");
        exit;
    }
}
for($i=0;$i<3;$i++){
    if(($a[ 0][$i] == $a[1][$i])&&($a[1][$i] == $a[2][$i])){
        printf("Yes");
        exit;
    }
}
if(($a[ 0][ 0] == $a[1][1])&&($a[1][1] == $a[2][2])){
        printf("Yes");
        exit;
}
if(($a[ 0][2] == $a[1][1])&&($a[1][1] == $a[2][ 0])){
    printf("Yes");
    exit;
}

printf("No");


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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

#define MOD 1000000007
#define INF 1000000007
#define REP(i, N) for (int i = 0; i < N; ++i)
#define REP1(i, N) for (int i = 1; i <= N; ++i)
#define RREP(i, N) for (int i = N - 1; i >= 0; --i)
#define ALL(a) a.begin(), a.end()

int main() {
  int n;
  while (cin >> n && n) {
    vector<int> a(n);
    REP(i, n) cin >> a[i];
    sort(ALL(a));
    int ans = INF;
    REP(i, n - 1) ans = min(ans, a[i + 1] - a[i]);
    cout << ans << endl;
  }
  return 0;
}


Measured memory_bytes: 3152
/* Alohomora */
#include<bits/stdc++.h>
#define ll         long long
#define fl(i,n)    for(i=0;i<n;i++)
#define fld(i,a,b) for(i=a;i>b;i--)
#define fli(i,a,n) for(i=a;i<n;i++)
#define inp(i,a,n) for(i=0;i<n;i++) {cin>>a[i];}
#define op(i,a,n)  for(i=0;i<n;i++) {cout<<a[i]<<" ";}
#define pb         push_back
#define mp         make_pair
#define F          first 
#define S          second
#define mod        1000000007
#define all(x)     x.begin(),x.end()  
#define speedup    ios_base::sync_with_stdio(false),cin.tie(0)
using namespace std;
void comp() {
  ll i,j,k,l,m,n,r;
  cin>>k;
  ll temp,ans=0;
  fli(i,1,k+1) {
  	fli(j,1,k+1) {
  		temp=__gcd(i,j);
  		fli(l,1,k+1) {
  			ans+=__gcd(temp,l);
  		}
  	}
  }
  cout<<ans<<"\n";
}

int main() {
    speedup;
    ll i=0,t;
    //cin>>t;
    t=1;
    while(t--) {
        comp();
    }
    return 0;
}


Measured memory_bytes: 3648
#include <algorithm>
#include <array>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <limits>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>

using namespace std;

typedef long long ll;

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

  if (x == 0) {
    cout << 1 << endl;
  } else {
    cout << 0 << endl;
  }

  return 0;
}


Measured memory_bytes: 3192
#include <stdio.h>
#include <string.h>

#define KUGIRI_MODE 1
#define INPUT_MODE 2


int main(int argc,char* argv[]){
  
  char str[1025];

  while(scanf("%[^\n]%*c",str) != EOF){
    int i = 0,j;
    int first = -1,last;
    int state = KUGIRI_MODE;
    int len = strlen(str);
    int f_time = 1;
    
    for(i = 0; i < len; i++){
      switch(state){
      case KUGIRI_MODE:
	if(str[i] == ' ' || str[i] == ',' || str[i] == '.'){
	}else{
	  first = i;
	  state = INPUT_MODE;
	}
	break;
      case INPUT_MODE:
	if(str[i] == ' ' || str[i] == ',' || str[i] == '.'){
	  last = i-1;

	  if((last - first) >= 2 && (last - first) <= 5){
	    
	    if(f_time != 1){
	      printf(" ");
	    }

	    for(j = first; j <= last; j++){
	      printf("%c",str[j]);
	    }

	    if(f_time == 1){
	      f_time = 0;
	    }
	    
	    
	    first = -1;
	  }

	  state = KUGIRI_MODE;
	}else{
	}
	break;
      default:
	break;
      }
    }

    if(first != -1){
      last = len - 1;
      
      if((last - first) >= 2 && (last - first) <= 5){
	if(f_time != 1){
	  printf(" ");
	}
	for(j = first; j <= last; j++){
	  printf("%c",str[j]);
	}
	
	if(f_time == 1){
	  f_time = 0;
	}
	
      }
    }
    
    if(f_time != 1){
      printf("\n"); 
    }
  }

  return 0;
  
}

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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template < typename T >
void vprint(T &v){
	REP(i, v.size()){
		cout << v[i] << " ";
	}
	cout << endl;
}

int main(){
	ll N, M;
	cin >> N >> M;
	vector<pll> C;
	REP(i, N){
		ll AA, BB;
		cin >> AA >> BB;
		C.push_back({AA, BB});
	}
	sort(C.begin(), C.end());
	vector<ll> A(N), B(N);
	REP(i, N) A[i] = C[i].first;
	REP(i, N) B[i] = C[i].second;

	ll tmp = 0;
	ll res = 0;
	REP(i, N){
		if(tmp + B[i] < M){
			res += A[i]*B[i];
			tmp += B[i];
		}else{
			ll sa = M - tmp;
			res += A[i]*sa;
			break;
		}
	}
	cout << res << endl;
    return 0;
}

Measured memory_bytes: 3312
using System;
using System.Linq;

namespace atcoder {
    class Program 
    {
        static void Main (string[] args)
        {
            ABC140.Buffet();
        }
    }

    class ABC140
    {
        public static void Password()
        {
            double n = double.Parse(Console.ReadLine());
            Console.WriteLine(Math.Pow(n, 3));
        }

        public static void Buffet()
        {
            int n = int.Parse(Console.ReadLine());
            var dish = Input.getIntArray();
            var satisfaction = Input.getIntArray();
            var addSatisfaction = Input.getIntArray();
            int result = satisfaction.Sum(x=>x);

            for (int i = 0; i < n-1; i++)
            {
                if(dish[i+1]-dish[i]==1)
                {
                    result = result + addSatisfaction[dish[i] - 1];
                }
            }
            Console.WriteLine(result);
        }

    }
  
      class Input
    {
        public static int[] getIntArray()
        {
            string[] s = Console.ReadLine().Split(' ');
            int[] num = s.Select(x => int.Parse(x)).ToArray();
            return num;
        }
    }
}

Measured memory_bytes: 13396
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <math.h>
#include <cmath>
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include<bitset>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
using namespace std;
using ll = long long;
using R = double;
using Data = pair < ll, vector <ll>>;
template<typename T>using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll MOD = 1e9 + 7;
const ll inf = 1LL << 60;
struct edge { ll from; ll to; ll cost; };
typedef pair<ll, ll>pll;
#define all(x) (x).begin(),(x).end()
#define rep(i,m,n) for(ll i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(ll i = m;i >= n;--i)
#define INF INT_MAX/2



int main() {
	ll N;
	cin >> N;
	ll ng = 0, ok = 1e6;
	while (ok - ng > 1) {
		ll mid = (ok + ng) / 2;
		if (mid*(mid + 1) / 2 >= N)ok = mid;
		else ng = mid;
	}
	for (ll i = 1; i <= ok; i++) {
		if (i == (ok*(ok+1)/2)-N) {
			continue;
		}
		else {
			cout << i << endl;
		}
	}


	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin >> n;
    string arr[n];
    map<string,int>m;
    for(int i=0;i<n;i++)
     {  cin>>arr[i];
       m[arr[i]]++;
     }
     int max=0;
     for(auto it = m.begin();it!=m.end();it++)
     {
         if(it->second>max)
            max = it->second;
     }
     vector<string>v;
    

         for(auto it = m.begin();it!=m.end();it++)
         {
             if(it->second==max)
                v.push_back(it->first);
         }
         sort(v.begin(),v.end());
         for(unsigned int i=0;i<v.size();i++)
           cout<<v[i]<<endl;
         v.clear();
        
}

Measured memory_bytes: 28404
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define mod ((lli)1e9+7)
lli dp[1010][1010],n,m;
char c[1010][1010];
lli solve(lli i,lli j)
{
    if(dp[i][j]!=-1)
        return dp[i][j];
    lli ans;
    if(i>n||j>m||c[i][j]=='#')
        ans=0;
    else
        ans=(solve(i+1,j)+solve(i,j+1))%mod;
    dp[i][j]=ans;
    return ans;
}
int main()
{
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
    lli i,j;
    cin>>n>>m;
    for(i=1;i<=n+1;i++)
    {
        for(j=1;j<=m+1;j++)
        {
          	if(i<=n&&j<=m)
	            cin>>c[i][j];
          	dp[i][j]=-1;
        }
    }
    dp[n][m]=1;
    cout<<(lli)solve(1,1)<<"\n";
    return 0;
}

Measured memory_bytes: 9216
#include<iostream>
#include<algorithm>
using namespace std;
#define Max 500001
void maxheapify(int a[],int i,int h){
int r,l,largest,k;
	l=i*2;r=i*2+1;
	if(l<=h&&a[l]>a[i])
	 largest=l;
	else
	 largest=i;
	if(r<=h&&a[r]>a[largest])
	 largest=r;
	if(largest!=i){
	    k=a[i];
		a[i]=a[largest];
		a[largest]=k;
		maxheapify(a,largest,h);
	}
}
void buildmaxheap(int a[],int h){
int i;
for(i=h/2;i>0;i--)
maxheapify(a,i,h);
}
main(){
int h,i,a[Max];
	scanf("%d",&h);
	for(i=1;i<=h;i++)
	scanf("%d",&a[i]);
	buildmaxheap(a,h);
	for(i=1;i<=h;i++)
	printf(" %d",a[i]);
	printf("\n");
	return 0;
}



Measured memory_bytes: 5156
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define PI 2*acos(0.0)
#define boost ios::sync_with_stdio(false);cin.tie(0)
/*ll arr[1000000];void seive(){memset(arr,1,sizeof(arr));arr[0]=arr[1]=0;for(ll i=2;i<=(sqrt(1000000));i++){if(arr[i]){for(ll j=(i+i);j<=1000000;j+=i){arr[j]=0;}}}}*/
int main()
{
 boost;
 ll t;
 cin>>t;
 map <string,int> mp;
 while(t--)
 {
     string str;
     cin>>str;
     mp[str]++;
 }
 cout<<"AC x "<<mp["AC"]<<endl<<"WA x "<<mp["WA"]<<endl<<"TLE x "<<mp["TLE"]<<endl<<"RE x "<<mp["RE"]<<endl;
 
}

Measured memory_bytes: 3680
#include <bits/stdc++.h>
   
using namespace std;
     
#define PB(x) push_back(x)
#define ALL(x) (x).begin(), (x).end()
#define ALLR(x) (x).rbegin(), (x).rend()
#define MP(x) make_pair(x);
    
#define debug(x) cerr << #x << '=' << x << endl;
#define debug2(x, y) cerr << #x << '=' << x << ' ' << #y << '=' << y << endl;
#define debugn(a) for (int x: a) cerr << x << ' '; cerr << endl;
     
#define int long long
     
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<pair<int, int>> vii;
typedef vector<string> vs;
typedef unsigned long long ull;

const int INF = 1e13;
const int mmod = 1000000007;

int32_t main()
{	
	int n;
	cin >> n;
	int b[n-1];
	for (int& x: b) cin >> x;
	
	int a[n];
	a[0] = b[0];
	a[1] = b[0];
	for (int i = 1; i < n-1; i++) {
		if (b[i] >= a[i]) {
			a[i+1] = b[i];
		} else {
			a[i+1] = a[i] = b[i];
		}
	}
	
	int sum = 0;
	for (int i = 0; i < n; i++) {
		sum += a[i];
	}
	cout << sum << endl;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
"""
https://beta.atcoder.jp/contests/abc079/tasks/abc079_d

"""
import sys
from sys import stdin
input = stdin.readline


def warshallFloyd(V, dp):
    for k in range(V):
        for i in range(V):
            for j in range(V):
                if dp[i][k] + dp[k][j] < dp[i][j]:
                    dp[i][j] = dp[i][k] + dp[k][j]


def main(args):
    H, W = map(int, input().split())
    dp = []
    for i in range(10):
        temp = [int(x) for x in input().split()]
        dp.append(temp)

    warshallFloyd(10, dp)

    costs = [dp[i][1] for i in range(10)]
    total_cost = 0
    for h in range(H):
        itr = map(int, input().split())
        for i in itr:
            if i != -1:
                total_cost += costs[i]
    print(total_cost)


if __name__ == '__main__':
    main(sys.argv[1:])
    


Measured memory_bytes: 3064
#include<bits/stdc++.h>
const int M=1e9+7;// M=1e9+7;//M=300000;//
const int N=1e5+5;
typedef long long int ll;
using namespace std;
 
ll cnt(0),n,m,x,y,i,j,temp,t,k,ans(0),sum(0),mn(M),mx(-9e9);

bool isPrime(ll a)     //efficient
{
	if(a<=1)
	{
		return false;
	}
	if(a<=3)
	{
		return true;
	}
	if(a%2==0 || a%3==0)
	{
		return false;
	}
		for(int j=5;j*j<=a;j+=6)
		{
			if(a%j==0||a%(j+2)==0)
			{
				return false;
				break;
			}
		}
		return true;
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	cin>>n;
	for(i=n;i<=N;i++)
	{
		if(isPrime(i))
		{
			cout<<i;
			return 0;
		}
	}
	
}

Measured memory_bytes: 3620
#include <iostream>
using namespace std;
#define MAX 100000
#define SENTINEL 2000000000

struct Card {
    char suit;
    int value;
};

void merge(struct Card a[], int left, int mid, int right) {
    struct Card L[MAX / 2 + 2], R[MAX / 2 + 2];
    int n1 = mid - left;
    int n2 = right - mid;
    for (int i = 0; i < n1; i++) L[i] = a[left + i];
    for (int i = 0; i < n2; i++) R[i] = a[mid + i];
    L[n1].value = R[n2].value = SENTINEL;
    int i = 0, j = 0;
    for (int k = left; k < right; k++) {
        if(L[i].value <= R[j].value) {
            a[k] = L[i++];
        } else {
            a[k] = R[j++];
        }
    }
}

void mergeSort(struct Card a[], int n, int left, int right) {
    if (left + 1 < right) {
        int mid = (left + right) / 2;
        mergeSort(a, n, left, mid);
        mergeSort(a, n, mid, right);
        merge(a, left, mid, right);
    }
}

int partition(struct Card a[], int p, int r) {
    struct Card x = a[r];
    int i = p - 1;
    for (int j = p; j < r; j++) {
        if (a[j].value <= x.value) {
            i++;
            swap(a[i], a[j]);
        }
    }
    swap(a[i+1], a[r]);
    return i + 1;
}

void quickSort(struct Card a[], int p, int r) {
    if (p < r) {
        int q = partition(a, p, r);
        quickSort(a, p, q - 1);
        quickSort(a, q + 1, r);
    }
}

int main() {
    int n, v;
    struct Card a[MAX], b[MAX];
    string s;
    int stable = true;

    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> s >> v;
        a[i].suit = b[i].suit = s[0];
        a[i].value = b[i].value = v;
    }

    mergeSort(a, n, 0, n);
    quickSort(b, 0, n - 1);

    for (int i = 0; i < n; i++) {
        if (a[i].suit != b[i].suit) {
            stable = false;
            break;
        }
    }

    if (stable) {
        cout << "Stable" << endl;
    } else {
        cout << "Not stable" << endl;
    }
    for (int i = 0; i < n; i++) {
        cout << b[i].suit << " " << b[i].value << endl;
    }
}



Measured memory_bytes: 5488
#include<bits/stdc++.h>
using namespace std;
int main(void){
  
  int h, w, i, j;
  cin>>h>>w;
  string s1;
  for(i=0;i<(h+2)*(w+2);i++)s1+="#";
  
  for(i=0;i<h;i++){
    for(j=0;j<w;j++){
      cin>>s1.at((i+1)*(w+2)+(j+1));
    }
  }
  
  for(i=0;i<h+2;i++){
    for(j=0;j<w+2;j++){
		cout<<s1.at((i)*(w+2)+(j));
    }
    cout<<endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long llong;
int main() {
    llong a;
    int b;
    char c,d,e;
    scanf("%lld ",&a);
    c=getchar();
    getchar();
    d=getchar();
    e=getchar();
    b=(c-'0')*100+(d-'0')*10+(e-'0');
    a=a*b;
    a=a/100;
    cout<<a;

    return 0;
}


Measured memory_bytes: 3744
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define lli long long int   //used int to avoid mle
#define ulli unsigned long long int 
#define ld long double
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define loop(i,a,b) for(lli i=a;i<b;i++)
#define initialize(array,size,value) for(lli i=0;i<size;i++) array[i]=value
#define couta(array,size) for(lli i=0;i<size;i++) cout<<array[i]<<" "
#define vl vector<lli>
#define vp vector< pair <lli,lli> >
#define sl set<lli>
#define spl set<pll>
#define msl multiset <lli>
#define msp multiset <pll>
#define pll pair<lli, lli>
#define mll map<lli, lli>              //for( map<lli, lli>::iterator i=temp.begin();i!=temp.end();i++)cout<<i->fi<<" "<<i->se<<endl;
#define mvl map<lli, vl>
#define umll unordered_map<lli, lli>
#define vt vector<pair<lli, pll >  >
#define vf vector<pair<pll,pll > >
#define qu queue<lli>
#define pq priority_queue<lli>
#define dq deque <lli>
#define ptr vector<lli>::iterator
#define bs(array,x) binary_search(array.begin(),array.end(),x)
#define lb(array,x) lower_bound(array.begin(),array.end(),x)
#define ub(array,x) upper_bound(array.begin(),array.end(),x)
#define nobw(array,i,j) upper_bound(array.begin(), array.end(), j)-lower_bound(array.begin(), array.end(), i) //number of numbers between i & j
#define vc clear()
#define fbo find_by_order //returns iterator
#define fok order_of_key //return index
#define endl '\n'
#define sp system("pause");
#define INF 9223372036854775807
#define MINF -9223372036854775808
#define start_routine() int begtime = clock();
#define end_routine() int endtime = clock(); cerr << endl << "Time elapsed: " << (endtime - begtime)*1000/CLOCKS_PER_SEC << " ms"; return 0
lli mod=1000000007;
//string s=bitset<32>(n).to_string();
typedef tree<lli,null_type,less<lli>,rb_tree_tag, // change both to lli if set is req insted of multiset
tree_order_statistics_node_update> indexed_set;
int main()
{
     ios::sync_with_stdio(0);
    cin.tie(0);
    
        lli n,r;
        cin>>n>>r;
        if(n>10)cout<<r;
        else cout<<r+(100)*(10-n);




}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i = 0;i<((ll)(n));i++)
#define reg(i,a,b) for(ll i = ((ll)(a));i<=((ll)(b));i++)
#define irep(i,n) for(ll i = ((ll)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(ll i = ((ll)(b));i>=((ll)(a));i--)
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;
template<class T = int> void print(vector<T> v){for(auto a:v)cout<<a<<" ";cout<<endl;}

/*
*/

ll n,ans=0;

int main(void){
	cin>>n;
	ans+=n/500*1000;
	n%=500;
	ans+=n/5*5;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<typename T> using gpp_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T, typename L> using gpp_map = tree<T, L, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T> using gpp_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;*/
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) { cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl; }
#define mdebug(m) { cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;} }
#define Return(ans) { cout << (ans) << endl; return 0; }
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p){ cout << '(' << p.first << ',' << p.second << ')'; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }
 
using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;
 
//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};
 
const int mod = 1000000007;
//const int mod = 998244353;
//#define Add(x, y) x = (x + (y)) % mod
//#define Mult(x, y) x = (x * (y)) % mod


#include <bits/stdc++.h>
using namespace std;
signed main(){
    string S; cin>>S;
    bool ans = true;
    REP(i,S.size()){
        if(i%2==0){
            if(S[i]!='R'&&S[i]!='U'&&S[i]!='D') ans = false;
        }
        if(i%2==1){
            if(S[i]!='L'&&S[i]!='U'&&S[i]!='D') ans = false;
        }
    }
    if(ans) Out("Yes");
    else Out("No");
}


Measured memory_bytes: 256
import numpy as np
n, q = map(int, input().split())
s = input()
ans = np.zeros(n, dtype=int)

for i in range(1, n):
    if s[i - 1:i + 1] == "AC":
        ans[i] = 1

ans = ans.cumsum()

result = []

for i in range(q):
    l, r = map(int, input().split())
    result.append(ans[r - 1] - ans[l - 1])

print(*result, sep="\n")

Measured memory_bytes: 20020
#include <stdio.h>

#define MAX 251

static int parent(int i)
{
    return i / 2;
}

static int left(int i)
{
    return 2 * i;
}

static int right(int i)
{
    return 2 * i + 1;
}

int main()
{
    int H;
    int A[MAX];

    scanf("%d", &H);
    for (int i = 1; i <= H; i++) {
        scanf("%d", &A[i]);
    }

    for (int i = 1; i <= H; i++) {
        printf("node %d: key = %d, ", i, A[i]);
        if (parent(i) >= 1)
            printf("parent key = %d, ", A[parent(i)]);
        if (left(i) <= H)
            printf("left key = %d, ", A[left(i)]);
        if (right(i) <= H)
            printf("right key = %d, ", A[right(i)]);
        printf("\n");
    }
}


Measured memory_bytes: 2104
#include<iostream>
using namespace std;
const int inf = 10e7;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
int dp[100000];
int main(){
  int hp,m;
  cin>>hp>>m;
  int ats[m];
  int mps[m];
  rep(i,m){int a,s;cin>>a>>s;ats[i]=a;mps[i]=s;}
  
  rep(i,hp+1){dp[i]=inf;}dp[0]=0;
  rep(j,hp+1){
    rep(k,m){
      int at=ats[k],mp=mps[k];
      if (j>at-1){ dp[j]=min(dp[j],dp[j-at]+mp);}
      else{dp[j]=min(dp[j],mp);}
  }
}
  cout<<dp[hp]<<endl;}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>

using namespace std;

string S;


int main()
{
	int ans = 0;
	cin >> S;

	int n = S.size();
	for (int i; i < n/2; i++) {
		if (S[i] != S[n - i - 1]) {
			ans++;
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define invrepr(i,a,b) for(int i=b-1;i>=a;i--)
#define invrep(i,n) invrepr(i,0,n)
#define repitr(itr,a) for(auto itr=a.begin();itr!=a.end();++itr)
const ll MOD=1e9+7;



int main() {
    ios_base::sync_with_stdio(false);
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    int f=(c-1)/b,l=(a-1)/d;
    if (f<=l) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 3600
#include<stdio.h>
int max(int a, int b){
  return a > b ? a:b;
}
int main(void){
  int n,k;
  scanf("%d%d",&n,&k);
  char s[n+1];
  scanf("%s",&s);
  int two=0,one=0,ord=1;
  for(int i=1;i<n;i++){//孤立集団数をカウント
	if(s[i]!=s[i-1])ord++;
  }
 printf("%d",n-max((ord-2*k),1));
  return 0;
}

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

using namespace std;
char s[200007];
//WWRRWRR
int main()
{
    int n; cin >> n;
    cin >> s;
    int r=0;
    for(int i=0; i<n; i++) {
        if(s[i]=='R') r++;
    }
    int ans=r;
    for(int i=0; i<r; i++) {
        if(s[i]=='R') ans--;
    }
    cout << ans << '\n';
}


Measured memory_bytes: 3800
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        @SuppressWarnings("resource")
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        char[] s = sc.next().toCharArray();
        char[] t = sc.next().toCharArray();
        StringBuilder sb = new StringBuilder();
        for (int i = 0 ; i < s.length ; i++) {
            sb.append(s[i]);
            sb.append(t[i]);
        }
        System.out.println(sb.toString());
    }

}

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

#define For(i, l, r) for (register int i = (l), i##end = (int)(r); i <= i##end; ++i)
#define Fordown(i, r, l) for (register int i = (r), i##end = (int)(l); i >= i##end; --i)
#define Rep(i, r) for (register int i = (0), i##end = (int)(r); i < i##end; ++i)
#define Set(a, v) memset(a, v, sizeof(a))
#define Cpy(a, b) memcpy(a, b, sizeof(a))
#define debug(x) cout << #x << ": " << (x) << endl

using namespace std;

template<typename T> inline bool chkmin(T &a, T b) { return b < a ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, T b) { return b > a ? a = b, 1 : 0; }

inline int read() {
    int x(0), sgn(1); char ch(getchar());
    for (; !isdigit(ch); ch = getchar()) if (ch == '-') sgn = -1;
    for (; isdigit(ch); ch = getchar()) x = (x * 10) + (ch ^ 48);
    return x * sgn;
}

inline int read_opt() {
	char ch(getchar());
	for (; !islower(ch); ch = getchar());
	return ch == 'x';
}

void File() {
#ifdef zjp_shadow
    freopen ("D.in", "r", stdin);
    freopen ("D.out", "w", stdout);
#endif
}

const int N = 1e5 + 1e3;

int n, a[N], opt[N];

inline bool check(int pos) {
	int lst = pos - 1 ? pos - 1 : n, nxt = pos % n + 1;
	return (a[lst] ^ a[nxt] ^ a[pos]) == opt[pos];
}

int main() {

	File();

	n = read();

	For (i, 1, n) opt[i] = read_opt();

	for (a[1] = 0; a[1] < 2; ++ a[1])
		for (a[2] = 0; a[2] < 2; ++ a[2]) {
			bool flag = true;
			For (i, 3, n) {
				a[i] = 0; if (check(i - 1)) continue;
				a[i] = 1; if (!check(i - 1)) { flag = false; break; }
			}
			if (!flag) continue;
			if (check(n) && check(1)) {
				For (i, 1, n) 
					putchar (a[i] ? 'W' : 'S');
				return 0;
			}
		}
	puts("-1");

	return 0;

}

Measured memory_bytes: 1152
object Main extends App {
	val sc = new java.util.Scanner(System.in)
	val pw = new java.io.PrintWriter(System.out)
	
	val n, a, b = sc.nextInt
	
	val M = BigInt(1000000007)
	
	def cmb(k: Int): BigInt =
		(BigInt(1) to BigInt(k)).foldLeft(BigInt(1))((z, i) => (n - k + i) * i.modInverse(M) * z % M)
		
	def pow2(k: Int): BigInt =
		if (k == 0) 1
		else if (k % 2 == 0) {
			val r = pow2(k/2)
			r * r % M
		} else BigInt(2) * pow2(k-1) % M

	val r = (pow2(n) - BigInt(1) - cmb(a) - cmb(b)) % M
	
	pw.println(r + (if(r < 0) M else 0))
	pw.flush()
}

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

int main() {
  int A, B, C;
  cin >> A >> B >> C;
  
 if(A == B && B == C || A != B && B != C && C != A){
  cout << "No" << endl;
 }
  
 else{
  cout << "Yes" << endl;
 }
}


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

class Program
{
    static void Main(string[] args)
    {
        var ha = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();

        Console.WriteLine(Math.Ceiling((double)ha[0] / ha[1]));
    }
}

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

int main(){
    long long X;
    long long T;
    cin >> X;
    T = 100;
    for (int i = 1; ; i++) {
        T = T + T * 1 / 100;
        if (X <= T) {
            cout << i << endl;
            return 0;
        }
    }
}


Measured memory_bytes: 3600
n,m = map(int,input().split())
h = [int(i) for i in input().split()]
nn = [1]*n
for _ in range(m):
    a,b = map(int,input().split())
    if h[a-1] ==h[b-1]:
        nn[a-1]=0
        nn[b-1]=0
    elif h[a-1] < h[b-1]:
        nn[a-1]=0
    else:
        nn[b-1]=0

print(sum(nn))


Measured memory_bytes: 85104
#include <bits/stdc++.h>
using namespace std;
#define int long long
using P = pair<int,int>;
const int INF = 1e18;
#define put(n) cout<<(n)<<endl
#define rep(i,N) for(int(i)=0;(i)<(N);++(i))
#define all(v) (v).begin() , (v).end()
#define rall(v) (v).rbegin() , (v).rend()
#define pb(n) push_back(n)

signed main(){
    string S;
    cin >> S;
    set<char> st({'A','G','C','T'});

    int ans = 0;
    rep(i,S.size()){
        rep(j,S.size()+1-i){
            string t = S.substr(i,j);
            bool ok = true;
            for(char c : t){
                if(st.count(c) == 0) ok = false;
            }
            if(ok) ans = max(ans,(int)t.size());
        }
    }

    put(ans);

}


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

#define rep(i,n)  for(int i = 0; i < (int)(n); i++)
#define sz(x)     ((int)(x).size())
#define all(x)    (x).begin(),(x).end()

using ll = long long;

ll gcd ( ll a, ll b ) { if ( b == 0 ) return a; else return gcd ( b, a%b ); }
ll lcm ( ll a, ll b ) { return a * b / gcd(a, b); }

using namespace std;

struct UnionFind {
  vector<int> par; 
  vector<int> rank; 

  UnionFind(int n = 1) {
    init(n);
  }

  void init(int n = 1) {
    par.resize(n); rank.resize(n);
    for (int i = 0; i < n; ++i) par[i] = i, rank[i] = 0;
  }

  int root(int x) {
    if (par[x] == x) {
      return x;
    }
    else {
      int r = root(par[x]);
      return par[x] = r;
    }
  }

  bool issame(int x, int y) {
    return root(x) == root(y);
  }

  bool merge(int x, int y) {
    x = root(x); y = root(y);
    if (x == y) return false;
    if (rank[x] < rank[y]) swap(x, y);
    if (rank[x] == rank[y]) ++rank[x];
    par[y] = x;
    return true;
  }
};

int main (void) {
  std::cin.tie(0);  std::ios::sync_with_stdio(false);
  int n, m; std::cin >> n >> m;
  UnionFind uf(n);
  rep(i,m) {
    int a,b; std::cin >> a >> b; a--,b--;
    uf.merge(a,b);
  }

  std::unordered_map<int,int> mp;
  rep(i,n) mp[uf.root(i)]++;

  int ans = -1;
  for(auto&& u : mp) ans = std::max<int>(ans,u.second);
  std::cout << ans << std::endl;

  return 0;
}



Measured memory_bytes: 12964
#include <iostream>
//#include <iomanip>
//#include <string>
#include <vector>
//#include <algorithm>
//#include <utility>
//#include <set>
//#include <map>
//#include <queue>
//#include <deque>
//#include <bitset>
#include <math.h>
using namespace std ;
using ll = long long ;
//using ld = long double ;
using vll = vector<ll> ;
using vvll = vector<vll> ;
//using vc = vector<char> ;
//using vvc = vector<vc> ;
//using vb = vector<bool> ;
//using vvb = vector<vb> ;
//using pll = pair<ll,ll> ;

//ll mod = 1000000007 ;
//long double pie = acos(-1) ;

//string yorn(bool a){if(a) return"Yes" ; return "No" ;}
//string YorN(bool a){if(a) return"YES" ; return "NO" ;}
//ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
//ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
//ll sa(long long a,long long b){if(a>b) return a-b ; return b-a ;}
//void mysort(vector<long long> &a){sort(a.begin(),a.end()) ;}
//void myrev(vector<long long> &a){reverse(a.begin(),a.end()) ;}

int main(){
	vvll ncr(51,vll(51,0)) ;
	for(int i=0;i<51;i++){
		for(int j=0;j<i+1;j++){
			if(j==0||j==i) ncr.at(i).at(j) = 1 ;
			else ncr.at(i).at(j) = ncr.at(i-1).at(j-1)+ncr.at(i-1).at(j) ;
		}
	}
	ll n,p ;
	cin >> n >> p ;
	vll cnt(2,0) ;
	for(int i=0;i<n;i++){
		ll a ; cin >> a ;
		if(a&1) cnt.at(1)++ ;
		else cnt.at(0)++ ;
	}
	ll ans = pow(2,cnt.at(0)) ;
	ll sub = 0 ;
	for(int i=0;i<=cnt.at(1);i++){
		if(i%2!=p) continue ;
		sub += ncr.at(cnt.at(1)).at(i) ;
	}
	cout << ans*sub << endl ;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <cassert>
#include <fstream>
#include <iomanip>
 
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
 
const ll mod = 1e9 + 7;
 
int main() {
    long double a, b, c;
    cin >> a >> b >> c;
    if (sqrt(a) + sqrt(b) + (long double)3e-15 < sqrt(c))
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cmath>
#define mm(a,x) memset(a,x,sizeof(a))
#define sync std::ios::sync_with_stdio(false);std::cin.tie(0)
#define ll long long
using namespace std;
int main(void)
{
    sync;
    bool flag=0;
    int n;
    cin>>n;
    while(n)
    {
        if(n%10==7)
            flag=1;
        n/=10;
    }
    if(flag)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 3132
#include<iostream>
#include<cmath>
#include<vector>
#include<queue>
#include<algorithm>
#include <stack>
#include<set>
#include<cstring>
#include<iterator>
#include <map>
using namespace std;

int main() {
    long long ch, ans = 0, i = 1, n, q, k;
    long long r = -1e9, l = 0;
    long long j;
    cin >> n >> k;
    long long* arr = new long long[n];
    for (i = 0; i < n; i++) {
        cin >> arr[i];
        r = max(r, arr[i]);
    }
    double middle;
    while(r > l + 1) {
        ans = 0;
//        cout << l << " " << r << endl;
        middle = (r + l) / 2;
        for (i = 0; i < n; i++) {
            ans += ceil((double) arr[i] / middle);
//            cout << ans << " " << ceil((double) arr[i] / middle) << " " << l << " " << middle << " " << r << endl;
        }
        if (ans <= n + k)
            r = middle;
        else
            l = middle;
    }
    ch = ceil(r);
    cout << ch;
    return 0;
}

Measured memory_bytes: 5152
N,M=map(int,input().split())

graph=[[] for _ in range(N+1)]
for i in range(M):
  a,b=map(int,input().split())
  graph[a].append(b)
  graph[b].append(a)
#print(graph)  

for i in range(1,N+1):
  print(len(graph[i]))

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

int main(){
    int N;
    // int64_t res;
    vector<int> vP(55);
    // int64_t vp[100010];
    string res;


    cin >> N;

    int nOffPos = 0;
    int nToBeSwap = 0;
    for (int i=1; i<=N; i++){
        cin >> vP.at(i);
        if (vP.at(i) != i) {
            nToBeSwap = (nToBeSwap == 0)? vP.at(i): nToBeSwap;
            nOffPos++;
        }
    }

    if (nOffPos == 0) {
        res = "YES";
    }
    else if (nOffPos != 2) {
        res = "NO";
    }
    else{
        // nOffPos == 2
        res = (vP.at(vP.at(nToBeSwap)) == nToBeSwap)?
                "YES": "NO";
    }

    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N = 1000111;
const int INF = 1<<30;
int m[N];
int a[N];

int main() {
    int n;
    scanf("%d", &n);
    for (int i = 0; i < n; i++) {
        scanf("%d", &a[i]);
        a[i] = -a[i];
        m[i + 1] = INF;
    }
    for (int i = 0; i < n; i++) {
        int lo = 0, hi = n;
        while (hi - lo > 1) {
            int md = lo + hi >> 1;
            (m[md] <= a[i] ? lo : hi) = md;
        }
        m[hi] = a[i];
    }
    int ans = 0;
    while (ans < n && m[ans + 1] < INF) ans++;
    printf("%d\n", ans);
}

Measured memory_bytes: 4736