akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

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

template<typename T>
using pq_gt = priority_queue<T, vector<T>, greater<T>>;
template<typename T>
using pq_lt = priority_queue<T, vector<T>, less<T>>;

#define se second
#define fi first
#define pb push_back

int a[200200];
int b[200200];

int main() {
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    for(int i = 0; i < n; ++i) {
    	cin>>a[i];
    }
    int m;
    cin>>m;
    for(int i = 0; i < m; ++i) {
    	cin>>b[i];
    }
    sort(a, a+n);
    sort(b, b+m);
    int cnter = 0;
    int i =0;
    while(i<m) {
    	if(cnter ==n) {
    		cout<<"NO\n";
    		return 0;
    	}
    	if(b[i]<a[cnter]) {
    		cout<<"NO\n";
    		return 0;
    	} else if(b[i]==a[cnter]) {
    		cnter++;
    		i++;
    	} else {
    		cnter++;
    	}
    }
    cout<<"YES\n";
}

Measured memory_bytes: 1792
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

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

    static class BPalindromePhobia {
        public void solve(int testNumber, Scanner in, PrintWriter out) {

            String s = in.next();
            int a = 0;
            int b = 0;
            int c = 0;
            int l = s.length();
            for (int i = 0; i < l; i++) {
                if (s.charAt(i) == 'a') {
                    a++;
                } else if (s.charAt(i) == 'b') {
                    b++;
                } else {
                    c++;
                }
            }
            l /= 3;
            if ((a == l || a == l + 1) &&
                    (b == l || b == l + 1) &&
                    (c == l || c == l + 1)) {
                out.println("YES");
            } else {
                out.println("NO");
            }

        }

    }
}



Measured memory_bytes: 26324
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
ll t,n,k;
ll A[105];
ll dp[100005];
ll max(ll a,ll b)
{
    return a>b?a:b;
}

int main()
{
    t=1;
    while(t--){
		ll q=0;
		memset(dp,-1,sizeof(dp));
		cin>>n>>k;
		for(int i=0; i<n; i++) cin>>A[i];
		for(int i=0; i<=k; i++) dp[i]=0;
		for(int i=0;i<=k;i++){
			if(!dp[i])
			for(int j=0; j<n;j++) {
				q=i+A[j];
				if(q<=k) dp[q]=1;
			} 
		}
		if(dp[k]) cout<<"First"<<"\n";
		else cout<<"Second"<<"\n";
	}    
}

Measured memory_bytes: 1024
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <unordered_map>
#define rep(i,n) for (int i=0; i<n;++i)
#define rep_down(i,n) for (int i=n-1; i>=0;--i)
#define ALL(a)  (a).begin(),(a).end()
typedef long long ll;
using namespace std;
const ll MOD = 1000000007LL;
const int INF = 1000000007;
int A, B;

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

  cin >> A >> B;
  int cnt = 0;
  int C = 1;
  while(B>C){
    C+=(A-1);
    cnt++;
  }
  cout << cnt << "\n";
  return 0;
}

Measured memory_bytes: 256
using System;

public class Test {
  public static void Main() {
    string S = Console.ReadLine().Trim();
    string T = Console.ReadLine().Trim();
    int count = 0;    
    
	for(var i = 0; i < S.Length; i++) {
      if(S[i] == T[i]) {
        count++;
      }
    }
    
    Console.WriteLine(count);
  }
}

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

int main(){
  int p, q, i, j, mod[100],place;
  while(scanf("%d%d", &p, &q) != EOF){
    memset(mod, 0, sizeof(mod));
    i = 0;
    p %= q;
    mod[i++] = p;
    p *= 10;

    place = -1;
    while(p){
      putchar((p / q) + '0');
      p %= q;
      for(j = 0;mod[j]; ++j){
	if(p == mod[j]){
	  place = j;
	  break;
	}
      } 
      if(place >= 0) break;
      mod[i++] = p;
      p *= 10;
    }
    puts("");
    if(p){
      i -= place;
      while(place--) putchar(' ');
      while(i--) putchar('^');
      puts("");
    }
  }
  return 0;
}

Measured memory_bytes: 584
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using P = pair<int, int>;
#define PI acos(-1)
#define Mod (int)1000000007
#define INFTY (int)INT_MAX
#define Rep(i, n) for (int i = 0; i < (int)(n); i++)
#define BitRep(i, n) for (int i = 0; i < (int)(1 << n); i++)
#define All(vec) vec.begin(), vec.end()
#define Part(vec, b, e) vec.begin() + b, vec.begin() + e
#define Sum(vec) accumulate(vec.begin(), vec.end(), 0)
#define Sort(vec) sort(vec.begin(), vec.end())
#define Reverse(vec) reverse(vec.begin(), vec.end())
#define Count(vec, x) count(vec.begin(), vec.end(), x)
#define Next_permutation(vec) next_permutation(vec.begin(), vec.end())
#define Find(vec, s) vec.find(s) != vec.end()
#define Set_union(A, B, res) set_union(A.begin(), A.end(), B.begin(), B.end(), inserter(res, res.end()));
#define Set_intersection(A, B, res) set_intersection(A.begin(), A.end(), B.begin(), B.end(), inserter(res, res.end()));
#define Set_difference(A, B, res) set_difference(A.begin(), A.end(), B.begin(), B.end(), inserter(res, res.end()));
#define Set_symmetric_difference(A, B, res) set_symmetric_difference(A.begin(), A.end(), B.begin(), B.end(), inserter(res, res.end()));

int main() {
	set<int> A, B;
	int n;
	cin >> n;
	Rep(i, n) {
		int a;
		cin >> a;
		A.insert(a);
	}
	int m;
	cin >> m;
	Rep(i, m) {
		int b;
		cin >> b;
		B.insert(b);
	}
	set<int> res;
	Set_difference(A, B, res);
	for (auto v : res) {
		cout << v << endl;
	}
	return 0;
}


Measured memory_bytes: 31220
#include <stdio.h>
#include <stdlib.h>

#define N 101
#define INF -1

typedef struct al { // adjacency list
  int        id;
  struct al* next_p;
} al_s;

typedef enum {
  WHITE,
  GRAY,
  BLACK,
} color_t;

// queue
int queue[N] = {NULL};
int first = 0;
int last  = 0;

int time_g = 0;

void chkList(al_s**, int);
int isEmpty();
void enq(int id);
int deq();
void setAdjs(al_s* g_p, int* adjs_p, color_t*);



int main(){
  int    n = 0, u = 0, k = 0 ,v = 0;
  al_s* g_p[N] = {0}; // 1-origin
  color_t color[N];   // 1-origin
  int d[N]={0};
  int i, j;
  int adjs[N] = {0};

  scanf("%d", &n);
  for ( i = 0; i < n; i++ ){
    scanf("%d%d", &u ,&k);
    al_s *node_p = g_p[u];
    for( j = 1 ; j <= k ; j++ ){
      scanf("%d" ,&v );
      al_s *aloc_p = (al_s*)malloc(sizeof(al_s));
      if( node_p == NULL ){
	node_p = aloc_p;
	g_p[u] = node_p;
      }else{
        node_p->next_p = aloc_p;
        node_p = node_p->next_p;
      }
      node_p->id = v;
      node_p->next_p = NULL;
    }
  }

  for( u=0 ; u<=n ; u++){
    color[u] = WHITE;
    d[u]     = INF;
  }
  color[1] = GRAY; // s is 1.
  d[1]     = 0;
  enq(1);
  
  while( isEmpty() != 0 ){
    u = deq();
    setAdjs(g_p[u] ,adjs ,color);
    for( i=0 ; adjs[i]!=0 ; i++ ){
      v = adjs[i];
      if( color[v] == WHITE ){
	color[v] = GRAY;
	d[v] = d[u] + 1;
	enq(v);
      }
    }
    color[u] = BLACK;
  }

  for( i=1; i<=n ; i++ ){
    printf("%d %d\n" ,i ,d[i] );
  }

  return 0; // Don't forget return 0  
}

int isEmpty(){
  return abs(first-last);
}

void enq(int id){
  queue[last] = id;
  last++; 
  if(last == N ){
    last = 0;
  }
}

int deq(){
  int ret;

  if(isEmpty()!=0){
    ret = queue[first];
    first++;
    return ret;
  }

  return NULL;
}

void setAdjs(al_s* g_p, int* adjs_p, color_t* clr_p){
  int i;
  al_s* nd_p = g_p;

  adjs_p[0] = 0;
  if(nd_p==NULL){ // the u node has no next node.
    return;
  }

  for(i=0 ; i < N ; i++){
    adjs_p[i] = nd_p->id;
    nd_p = nd_p->next_p;
    if( nd_p == NULL ){
      return;
    }
  }

  return;  
}


void chkList(al_s** g_pp, int n){ // for debug
  int i;

  for( i=1 ; i <= n ; i++){
    al_s* nd_p = g_pp[i];
    printf("%d: g_p[%d] = 0x%x\n" ,__LINE__ ,i ,g_pp[i] );
    while( nd_p != NULL ){
      printf("%d: nd_p         = 0x%x\n" ,__LINE__ ,nd_p );
      printf("%d: nd_p->id     = %d\n"   ,__LINE__ ,nd_p->id);
      printf("%d: nd_p->next_p = 0x%x\n" ,__LINE__ ,nd_p->next_p);
      nd_p = nd_p->next_p;
    }
    printf("\n");
  }

}

Measured memory_bytes: 608
from itertools import accumulate

MOD = 10 ** 9 + 7

n = int(input())

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

suffix_sum = list(accumulate(a[::-1]))[::-1]

req_arr = [x -  y for x, y in zip(suffix_sum, a)]

result = sum([(x * y) % MOD for x, y in zip(req_arr, a)])

print(result % MOD)


Measured memory_bytes: 44480
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, a, b) for (int i = a; i <= b; i++)
#define each(i, mp) for(auto& i:mp)

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


  ll ans = 0;
  repr(i,a,b){
    if (i%k == 0) {
      cout << "OK" << endl;
      return 0;
    }
  }
  cout << "NG" << endl;
  return 0;
}


Measured memory_bytes: 3624
#include "bits/stdc++.h"

using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

#define ll long long
#define li long int
#define ld long double
#define lld long long double

#define pb push_back
#define mk make_pair
#define F first
#define S second

#define all(v) (v).begin(),(v).end()
#define fill(a) memset(a, 0, sizeof(a))

const int MX = 1e6;
const int MI = -1e6;
const int MOD = 1e9 + 7;
const string ALPHA = "abcdefghijklmnopqrstuvwxyz";
const double PI = 3.1415926535;

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

const int mod=1e9+7;
inline int add(int x,int y)
{
  x+=y;
  if (x>=mod)
    return x-mod;
  return x;
}
inline int sub(int x,int y)
{
  x-=y;
  if (x<0)
    return x+mod;
  return x;
}
inline int mul(int x,int y)
{
  return (x*1ll*y)%mod;
}
inline int power(int x,int y)
{
  int ans=1;
  while(y)
    {
      if (y&1) ans=mul(ans,x);
      x=mul(x,x);
      y>>=1;
    }
  return ans;
}
inline int inv(int x)
{
  return power(x,mod-2);
}
inline int gcd(int x, int y)
{
  return(y!=0)?gcd(y, x%y):x;
}

/*------------CODE-----------*/

int main()
{
  IOS;
  int n, k;
  cin >> k >> n;
  int t=0;
  for (int i=0, x; i<n; i++)
    {
      cin >> x;
      t+=x;
    }
  int ans=k-t;
  if (ans>=0)
    cout << ans << endl;
  else
    cout << -1 << endl;
  return 0;
}


Measured memory_bytes: 3632
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int x;
    int y;
    for (int i = 0; i < 5; ++i)
    {
        cin >> x;
        
        if ( x == 0)
        {
            y = i + 1;
        }
    }
    cout << y << endl;
}


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

void b_ango(void) {
	string o, e;
	cin >> o >> e;
	int total_size = o.size() + e.size();
	bool odd_size = (total_size & 0x1) == 0x1 ? true : false;
	total_size = (total_size + 1) >> 1;
	for (int i = 0; i < total_size; i++) {
		cout << o[i];
		if (i != (total_size - 1)) cout << e[i];
		else {
			if (!odd_size) cout<<e[i];
		}
	}
	cout << endl;
}

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

Measured memory_bytes: 3592
#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<queue>
#include<stack>
#include<list>
#include<map>
#include<deque>
#include<math.h>
using namespace std;
#define ll long long
int main(){
    ll N;
    string S;
    cin >> N >> S;
    ll i,j;
    ll bad=0;
    ll r=0,g=0,b=0;
    for(i=0;i<N;i++){
        if(S[i]=='R')r++;
        if(S[i]=='G')g++;
        if(S[i]=='B')b++;
        for(j=0;j<N;j++){
            if(i+2*j<N&&S[i]!=S[i+j]&&S[i]!=S[i+2*j]&&S[i+j]!=S[i+2*j])bad++;
        }
    }
    cout << r*g*b-bad;
    return 0;
}


Measured memory_bytes: 3196
//I_F_A
#include "bits/stdc++.h"
using namespace std;

int main(){

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

	long long n;
	cin >> n;

	long long a = 0;
	while(n--){

		long long b;
		cin >> b;

		if(b & 1)
			a++;
	}
	if(a & 1)
		cout << "NO\n";
	else
		cout << "YES\n";
}

Measured memory_bytes: 256
import java.util.*;
class Main{
	public static final int INF=10000000;
	public static void main(String[] args){
		Scanner stdin=new Scanner(System.in);
		int coin[]=new int [1000];
		int dp[][]=new int[21][50001]; // m,n;
		int n=stdin.nextInt();
		int m=stdin.nextInt();
		for(int i=1;i<=m;i++) coin[i]=stdin.nextInt();

		for(int i=0;i<=n;i++){
			for(int j=0;j<=m;j++){
				dp[j][i]=INF;
			}
		}
		for(int j=0;j<=m;j++) dp[j][0]=0;

		//    ??????
		// ??¨ 0 M M M
		// ??? 0 M M M
		// ??? 0 M M M
		
		for(int i=1;i<=m;i++){
			for(int j=coin[i];j<=n;j++){
					if(dp[i][j-coin[i]]+1<dp[i-1][j]){
						for(int k=i;k<=m;k++) dp[k][j]=dp[i][j-coin[i]]+1;
					}
					else{
						for(int k=i;k<=m;k++) dp[k][j]=dp[i-1][j];
					}
			}
		}
		/*
		for(int i=0;i<=m;i++){
			System.out.print("col:");
			for(int j=0;j<=n;j++){
				System.out.print(dp[i][j]+" ");
			}
			System.out.println("");
		}
		*/
		//System.out.println("answer:"+m+" "+n+" "+dp[m][n]);
		System.out.println(dp[m][n]);
	}
}

Measured memory_bytes: 32740
H,W=map(int,input().split())
if H==1 or W==1:
  print(1)
  exit(0)
if W%2==0:
  w=W//2
  ans=w*H
else:
  w=W//2 + 1
  ans=w*H
  ans-=H//2
print(ans)

Measured memory_bytes: 3060
import sys
from datetime import datetime

def main():
    line = sys.stdin.readline().strip()
    today = datetime.strptime(line, "%Y/%m/%d")
    TBD = datetime(2019, 5, 1)
    if today < TBD:
        print("Heisei")
    else:
        print("TBD")

if __name__ == "__main__":
    main()

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

int main(){
  int N,X,T;
  cin >> N >> X >> T;
  int num;
  if(N%X == 0){
    num = N/X;
  }else{
    num = N/X+1;
  }
  cout << num*T ;
}

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

int main() {
  int s;
  cin >> s;
  vector<ll> dp(s+1);
  dp[0] = 1;
  for(int i = 1;i <= s;i++) {
    for(int j = 0;j <= (i-3);j++) {
      dp[i] += dp[j];
      dp[i] %= mod;
    }
  }
  cout << dp[s] << endl;
}

Measured memory_bytes: 3640
#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>
#include <cmath>
#include <climits>

constexpr int SINT_MAX = std::numeric_limits<int>::max();
constexpr int SINT_MIN = std::numeric_limits<int>::min();

using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;

template<class T>
T choose(bool b, T t, T f)
{
    if (b) return t;
    else return f;    
}

const char *YesNo(bool b)
{
    return choose(b, "Yes", "No");
}

const char *YESNO(bool b)
{
    return choose(b, "YES", "NO");
}

template<template<class...> class ContT, class ValueT, size_t Dim>
struct vec_type
{
    using type = ContT<typename vec_type<ContT, ValueT, Dim-1>::type>;
};

template<template<class...> class ContT, class ValueT>
struct vec_type<ContT, ValueT, 0>
{
    using type = ValueT;
};

template<class ValueT, size_t Dim = 1>
using vec_t = typename vec_type<std::vector, ValueT, Dim>::type;


template<class ValueT, size_t Dim, class = typename std::enable_if<Dim == 0>::type>
auto make_vec(ValueT value = ValueT()) -> ValueT
{
    return value;
}

template<class ValueT, size_t Dim, class... Rest>
auto make_vec(size_t size0, Rest... rest)
{
    auto vec = make_vec<ValueT, Dim-1>(rest...);
    return std::vector(size0, vec);
}

int diffabs(int l, int r)
{
    if (l < r) return r-l;
    else return l-r;    
}


///////////////////////////////////////////////////

int main()
{
    int X, Y;
    cin >> X >> Y;
    
    bool ans = false;
    for (int a = 0; a <= X; a++)
    {
        if (a*2 + 4*(X-a) == Y)
            ans = true;
    }

    cout << YesNo(ans) << endl;
    
}

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

int main(){
  string s,a;
  int n=0;
  bool f=true;
  getline(cin,s);
  for(string::iterator it=s.begin();it!=s.end();++it){
    if(*it==' '||*it==','||*it=='.'){
      if(n>2&&n<7){
	if(f){
	  cout<<a;f=false;
	}
	else cout<<' '<<a;
      }
      a="";
      n=0;
    }
    else{
      a+=*it;
      ++n;
    }
  }
  cout<<endl;
  return 0;
}

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

int main(){
    string s;
    cin>>s;
    int ans=700;
    rep(i,s.size()){
        if(s[i]=='o') ans+=100;
    }
    
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define si size()
#define bk back()
#define popb pop_back()
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define endl "\n"
#define lb lower_bound
#define ub upper_bound
#define emp empty()
#define beg begin()
#define en end()
#define ump unordered_map
#define forl(i,a,n) for(int i=a;i<n;i++)
#define rfor(i,n,a) for(int i=n;i>=a;i--)
#define fore(i,a,n) for(int i=a;i<=n;i++)
#define len length()
#define ld long double
int main()
{
    int n,w;
    cin>>n>>w;
    ll arr[n+1][2];
    forl(i,1,n+1) forl(j,0,2) cin>>arr[i][j];
    ll dp[w+1];
    forl(j,0,w+1) dp[j]=0;
    forl(i,1,n+1)
    {
        rfor(j,w,0)
        {
            if(j-arr[i][0]>=0) dp[j]=max(dp[j],dp[j-arr[i][0]]+arr[i][1]);
        }
    }
    ll maxi=0;
    forl(j,0,w+1) 
    {
        maxi=max(maxi,dp[j]);
    }
    cout<<maxi<<endl;
}

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

int main()
{
	int a, b;
	cin >> a;
	cin >> b;
	
	if (a == b)
	{
		cout << "Draw\n";
	}
	if (a == 13)
	{
		if (b == 1)
		{
			cout << "Bob\n";
		}
		else
		{
			cout << "Alice\n";
		}
	}
	else if (b ==13)
	{
		if (a ==1)
		{
			cout << "Alice\n";
		}
		else
		{
			cout << "Bob\n";
		}
	}
	else
	{
		if (a < b)
		{
			cout << "Bob\n";
		}
		else if(a > b)
		{
			cout << "Alice\n";
		}
	}
	return 0;
}


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

#define ll   long long

int main() {

    int A,B,price;
    cin >> A >> B;

    if(A>=13){
        price = B;
    }else if(A>=6){
        price = B / 2;
    }else{
        price = 0;
    }

    cout << price << endl;

    return 0;
}

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

int main(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  
  int m1,m2;
  int d1,d2;
  cin >> m1 >> d1 >> m2 >> d2;
  if(m1!=m2){
    cout << '1' << endl;
  }else{
    cout << '0' << endl;
  }
  return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args ) throws Exception {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        if(10 > N){
            if(N == 2 || N == 4 || N == 5 || N == 7 || N == 9){
                System.out.println("hon");
            } else if(N == 0 || N == 1 || N == 6 || N == 8) {
                System.out.println("pon");
            } else {
                System.out.println("bon");
            }
        } else {
            String num = "";
            String one = "";
            num = String.valueOf(N);
            if(100 > N) {
                one = num.substring(1, 2);
            } else {
                one = num.substring(2, 3);
            }
            N = Integer.parseInt(one);
            if(N == 2 || N == 4 || N == 5 || N == 7 || N == 9){
                System.out.println("hon");
            } else if(N == 0 || N == 1 || N == 6 || N == 8) {
                System.out.println("pon");
            } else {
                System.out.println("bon");
            }
        }
    }
}


Measured memory_bytes: 27080
S=input()
T=input()
L=len(S)

LISTS=[[] for i in range(30)]
LISTT=[[] for i in range(30)]

for i in range(L):
    LISTS[ord(S[i])-97].append(i)
    LISTT[ord(T[i])-97].append(i)


check=1
for i in range(30):
    if len(LISTS[i])>=2:
        for j in range(1,len(LISTS[i])):
            if T[LISTS[i][j]]!=T[LISTS[i][j-1]]:
                check=0


    if len(LISTT[i])>=2:
        for j in range(1,len(LISTT[i])):
            if S[LISTT[i][j]]!=S[LISTT[i][j-1]]:
                check=0

if check==1:
    print("Yes")

else:
    print("No")


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

#define MAX_Y 50
#define MAX_X 50
const int INF = 100000000;
typedef pair<int, int> P;
int d[MAX_Y][MAX_X];
char s[MAX_Y][MAX_X];
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
int H, W;

int bfs() {
	queue<P> que;
	for (int i = 0; i < H; i++)	for (int j = 0; j < W; j++) d[i][j] = INF;
	que.push(P(0, 0));
	d[0][0] = 0;
	while (que.size()) {
		P p = que.front(); que.pop();
		if (p.first == H-1 && p.second == W-1) break;

		for (int i = 0; i < 4; i++) {
			int ny = p.first + dy[i], nx = p.second + dx[i];
			if (0 <= ny && ny < H && 0 <= nx && nx < W && s[ny][nx] != '#' && d[ny][nx] == INF) {
				que.push(P(ny, nx));
				d[ny][nx] = d[p.first][p.second] + 1;
			}
		}
	}
	return d[H-1][W-1];
}


int main(){
	cin >> H >> W;
	int black = 0;
	for (int i=0; i<H; i++) {
		for (int j=0; j<W; j++) {
			cin >> s[i][j];
			if (s[i][j] == '#') black++;
		}
	}
	int b = bfs();
	if (b != INF) cout << H*W-(b+1)-black << endl; else cout << -1 << endl;

	return 0;
}


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

const int M = 1046527;
const int NIL = (-1);
const int L = 14;

char H[M][L];

int getChar(char ch){
    if(ch == 'A') return 1;
    else if(ch == 'C') return 2;
    else if(ch == 'G') return 3;
    else if(ch == 'T') return 4;
    else return 0;
}

long long getKey(char str[]){
    long long sum = 0, p = 1, i;
    for(i = 0; i < strlen(str); i++){
        sum += p*(getChar(str[i]));
        p *= 5;
    }
    return sum;
}

int h1(int key){return key % M;}
int h2(int key){return 1 + (key % (M - 1));}

int find(char str[]){
    long long key, i, h;
    key = getKey(str);
    for(i = 0;; i++){
        h = (h1(key) + i * h2(key)) % M;
        if(strcmp(H[h], str) == 0) return 1;
        else if(strlen(H[h]) == 0) return 0;
    }

    return 0;
}

int insert(char str[]){
    long long key, i, h;
    key = getKey(str);
    for(i = 0;; i++){
        h = (h1(key) + i * h2(key)) % M;
        if(strcmp(H[h], str) == 0) return 1;
        else if(strlen(H[h]) == 0){
            strcpy(H[h], str);
            return 0;
        }
    }

    return 0;
}


int main(){
    int i, n, j;
    char str[L], com[9];

    for(i = 0; i < M; i++) H[i][0] = '\0';
    scanf("%d", &n);
    for(i = 0; i < n; i++){
        scanf("%s %s", com, str);
        if(com[0] == 'i'){
            insert(str);
        }else {
            if(find(str)){
                printf("yes\n");
            }else{
                printf("no\n");
            }
        }
    }
    return 0;
}


Measured memory_bytes: 16996
#include <iostream>
#include <string>
using namespace std;
int main()
{
	string s, t;
	cin >> s >> t;
	int l1 = s.length(), l2 = t.length();
	for (int i = l1 - l2; i >= 0; i--)
	{
		bool match = true;
		for (int i1 = i, i2 = 0; i2 < l2; i1++, i2++)
			if (s[i1] != t[i2] && s[i1] != '?')
			{
				match = false;
				break;
			}
		if (match)
		{
			for (int j = 0; j < i; j++)
				if (s[j] == '?')
					cout.put('a');
				else
					cout.put(s[j]);
			cout << t;
			for (int j = i + l2; j < l1; j++)
				if (s[j] == '?')
					cout.put('a');
				else
					cout.put(s[j]);
			cout << endl;
			return 0;
		}
	}
	cout << "UNRESTORABLE\n";
	return 0;
}

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

using namespace std;

int n, x[100005], y[100005];
long long ans;

int main() {
	scanf("%d", &n);
	for (int i = 0; i < n; i++)
		scanf("%d%d", x + i, y + i);
	n++;
	sort(x, x + n);
	sort(y, y + n);
	for (int i = 0; x[n - 1 - i] > y[i]; i++)
		ans += x[n - 1 - i] - y[i];
	printf("%lld\n", ans * 2);
	return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll m = 1e9+7;
    ll inv[3001];
    inv[0]=1;
    inv[1] = 1;
    for(int i = 2; i < 3000; ++i)
    inv[i] = m - (m/i) * inv[m%i] % m;
    ll fact[3001],ifact[3001];
    fact[0]=1,ifact[0]=1;
    for(int i=1;i<3001;i++){
    	fact[i]=(i*fact[i-1])%m;
    	ifact[i]=(inv[i]*ifact[i-1])%m;
	}
    int s;
	cin>>s;
	ll ans = 0;
	for(int i=1;i<=1000;i++){
		if(3*i>s)break;
		int sum = s - 3*i;
		ll add = fact[sum + i -1];
		add = (add * ifact[i-1])%m;
		add = (add * ifact[sum])%m;
		ans = (ans + add )%m;
	}   
	cout<<ans;  
	return 0;
}

Measured memory_bytes: 3708
x, y = map(int, input().split())
group1 = [1, 3, 5, 7, 8, 10, 12]
group2 = [4, 6, 9, 11]
group3 = [2]
if x in group1 and y in group1:
    print('Yes')
elif x in group2 and y in group2:
    print('Yes')
elif x in group3 and y in group3:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 2940
#include <bits/stdc++.h>
 
using namespace std;
 
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define all(a) a.begin(), a.end()
#define rep(i, st, n) for (int i = (st); i < (n); ++i)
 
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<long long, long long>;
using ld = long double;
 
template <typename T1, typename T2> bool chkmin(T1 &x, T2 y) { return y < x ? (x = y, true) : false; }
template <typename T1, typename T2> bool chkmax(T1 &x, T2 y) { return y > x ? (x = y, true) : false; }
 
signed main()
{
#ifdef DEBUG
    freopen("in", "r", stdin);
#endif
    ios::sync_with_stdio(0);
    cin.tie(0);

    ll S;
    cin >> S;
    if (S % 1000000000 == 0)
    {
        cout << "0 0 " << "1000000000 0 0 " << S / 1000000000 << endl;
    }
    else
    {
        cout << "1 0 " << S / 1000000000 + 1 << ' ' << S % 1000000000 << ' ' << 0 << ' ' << 1000000000 << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long int
#define mod 1000000007
#define string_mod 2549536629329_base_255
#define pb push_back
#define F first
#define S second
#define ff first
#define endl "\n"
#define ss second
#define all(v) v.begin(), v.end()
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
int power(int x, unsigned int y, int p)
{
    int res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    return res % p;
}

int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int tc;
    tc = 1;
   //cin >> tc;
    while (tc--)
    {
        int a, b, c, k;
        cin >> a >> b >> c >> k;
        int ans = 0;
        ans += min(a, k);
        k -= a;
        if(k<=0){
            cout << ans << endl;
        }
        else{
            k -= b;
            if (k <= 0)
            {
                cout << ans << endl;
            }
            else{
                cout << ans - k << endl;
            }
        }
    }

    return 0;
}

Measured memory_bytes: 3652
#include <iostream>
#include <vector>
#include <queue>
#include <tuple>

using namespace std;

using ll =  long long;
using Pll = pair<ll, ll>;

constexpr int MAX_V = 100000;
constexpr ll INF = 1LL << 60;

int V, E, r;
vector<Pll> graph[MAX_V];
vector<ll> dist(MAX_V, INF);

void dijkstra(int start) {
    priority_queue<Pll, vector<Pll>, greater<Pll>> que;
    dist[start] = 0;
    que.emplace(0, start);
    int node; ll d;
    while(!que.empty()) {
        tie(d, node) = que.top(); que.pop();
        if(dist[node] < d) continue;
        for(Pll nxt: graph[node]) {
            if(dist[nxt.first] > dist[node] + nxt.second) {
                dist[nxt.first] = dist[node] + nxt.second;
                que.emplace(dist[nxt.first], nxt.first);
            }
        }
    }
}

int main() {
    cin >> V >> E >> r;
    int s, t; ll d;
    for(int i=0;i<E;++i){
        cin >> s >> t >> d;
        graph[s].emplace_back(t, d);
    }

    dijkstra(r);

    for(int i=0;i<V;++i) {
        if(dist[i] == INF) {
            cout << "INF\n";
        } else {
            cout << dist[i] << "\n";
        }
    }
}


Measured memory_bytes: 19416
args = input().split()
A = int(args[0])
B = int(args[1])
C = int(args[2])

bucket1_all = A
bucket1 = B
bucket2 = C

bucket1_nokori = bucket1_all - bucket1
ans = bucket2 - bucket1_nokori

if ans < 0:
    ans = 0
print(ans)

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

string S, T;

int main() {
    cin >> S >> T;

    int s_len = S.size(), t_len = T.size();

    // s0 + t0 + s1 + t1 + ...
    int ind = 0;
    int s_ind = 0, t_ind = 0;

    while (ind < s_len && s_ind < s_len && t_ind < t_len) {
        while (s_ind < s_len && S[s_ind++] != S[ind]);
        if (S[s_ind-1] != S[ind]) { break; }
        ++ind;
        while (t_ind < t_len && T[t_ind++] != S[ind]);
        if (T[t_ind-1] != S[ind]) { break; }
        ++ind;
    }
    if (ind == s_len) {
        cout << "Yes" << endl;
        return 0;
    }

    // t0 + s0 + t1 + s1 + ...
    ind = s_ind = t_ind = 0;
    while (ind < s_len && s_ind < s_len && t_ind < t_len) {
        while (t_ind < t_len && T[t_ind++] != S[ind]);
        if (T[t_ind-1] != S[ind]) { break; }
        ++ind;
        while (s_ind < s_len && S[s_ind++] != S[ind]);
        if (S[s_ind-1] != S[ind]) { break; }
        ++ind;
    }
    cout << (ind == s_len ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 3204
#include <stdio.h>
int main(void){
    // Your code here!
    int n,a=0;
    scanf("%d/n",&n);
    if(n>=105) a++;
    if(n>=135) a++;
    if(n>=165) a++;
    if(n>=189) a++;
    if(n>=195) a++;
    printf("%d\n",a);
}


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

int main()
{
  char s[10];
  cin >> s;
  for (int i = 0; i < 3; ++ i) {
    if (s[i] == s[i + 1]) {
      puts("Bad");
      return 0;
    }
  }
  puts("Good");
  return 0;
}


Measured memory_bytes: 256
n=int(input())
l=list(map(int,input().split()))
b=True
for i in range(1,n):
  if l[n-i]>=l[n-i-1]:
    pass
  elif l[n-i]==l[n-1-i]-1:
    p=l[n-1-i]
    l[n-1-i]=p-1
  else:
    b=False
    break
if b:
  print("Yes")
else:
  print("No")


Measured memory_bytes: 14396
#include<iostream>
#include<algorithm>
#include<vector>
#include<functional>
#include<string>
#include<cmath>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<cstdio>
using namespace std;
using ll = long long;
vector<bool> IsPrime;
 
void sieve(size_t max){
    if(max+1 > IsPrime.size()){     // resizeで要素数が減らないように
        IsPrime.resize(max+1,true); // IsPrimeに必要な要素数を確保
    } 
    IsPrime[0] = false; // 0は素数ではない
    IsPrime[1] = false; // 1は素数ではない
 
    for(size_t i=2; i*i<=max; ++i) // 0からsqrt(max)まで調べる
        if(IsPrime[i]) // iが素数ならば
            for(size_t j=2; i*j<=max; ++j) // (max以下の)iの倍数は
                IsPrime[i*j] = false;      // 素数ではない
}

int main(){
  int n;
  cin >> n;
  sieve(n + 5);
  ll tmp = 1;
  vector<int> a(n + 5, 0);
  for(int i = 0; i < n; i++) {
    int tmp = i + 1;
    int j = 2;
    while(tmp > 0) {
      if(tmp%j == 0){
        tmp /= j;
        a[j]++;
        continue;
      }
      j++;
      while(IsPrime[j] = false && j <= n + 1){
        j++;
      }
      if(j >= n + 1){
        break;
      }
    }
  }
  ll ans = 1;
  for(int i = 0; i <= n; i++){
    a[i]++;
    //cout << a[i] << " ";
    ans *= max(a[i], 1);
    ans %= 1000000007;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF (LLONG_MAX - 1e5)
#define fcout cout << fixed << setprecision(10)

using namespace std;

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

    string test = "keyence";

    string s;
    cin >> s;

    int l = 0;
    while (l < test.size()) {
        if (s[l] == test[l]) {
            l++;
        } else {
            break;
        }
    }

    if (l == test.size()) {
        cout << "YES" << endl;
        return 0;
    }

    int r = s.size() - 1;
    int tr = test.size() - 1;
    while (r >= 0 && tr >= 0) {
        if (s[r] == test[tr]) {
            r--;
            tr--;
        } else {
            break;
        }
    }

    if (l > tr) {
        cout << "YES" << endl;

    } else {
        cout << "NO" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define lli long long int
#define pb push_back
#define mod 1000000007
#pragma GCC optimize ("-O3")
#define mod2 998244353
#define MAXN 1000000000
#define v32 vector<int>
#define v64 vector<lli>
#define v1024 vector <vector <int>>
#define v4096 vector <vector <lli>>
#define vt vector
#define f(x, y, z) for (lli x = y; x < z; x++)
#define fd(x, y, z) for (lli x = y; x > z; x--)
#define lb lower_bound
#define ld long double
#define m64 map<lli,lli>
#define m32 map<int,int>
#define m64it map<lli,lli>::iterator
#define m32it map<int,int>::iterator
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define ist insert
#define endl "\n"
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
#define p_q priority_queue 
#define min_p_q priority_queue <int,vt <int>,greater <int>>
using namespace std;
using namespace __gnu_pbds; 
template <typename T> 
void DEBUG_ARR(vt<T> a,char c)
{
	f(i,0,a.size())cout<<a[i]<<c;
	cout<<"\n";
}

lli tmod(lli x,lli m){return (x%m+m)%m;}//USE AT YOUR OWN RISK
lli power(lli x, lli y) 
{
    lli res = 1;  
   
    while (y > 0) 
    { 
        if (y & 1) 
            res = (res*x)%mod; 
        y = y>>1; 
        x = (x*x)%mod;  
    }
    if(res<0)
       res+=mod; 
    return res; 
}
// lli fact[2000009];
// lli ncr(lli n,lli r){
//     lli ans=fact[n];
//     if(r>n)return 0;
//     ans=(ans*power(fact[n-r],mod-2))%mod;
//     ans=(ans*power(fact[r],mod-2))%mod;
//     return ans;
// }

int main() 
{ 
    fastio;
    // fact[0]=1;
    // f(i,1,2000009)fact[i]=(fact[i-1]*i)%mod;
    int t;
    // cin>>t;
    t=1;
    while(t--){
        lli a,b,c;
        cin>>a>>b>>c;
        if(a+b>=c)cout<<"No\n";
        else{
            if((c-a-b)*(c-a-b)>4*a*b)cout<<"Yes\n";
            else cout<<"No\n";
        }
    }
    return 0; 	
}



Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		int r = scan.nextInt();
		int c = scan.nextInt();

		int[][] Aay_rc;
		Aay_rc = new int[r][c];

		for (int i = 0; i < r; i++) {
			for (int j = 0; j < c; j++) {
				Aay_rc[i][j] = scan.nextInt();
			}
		}

		for (int i = 0; i < r; i++) {
			for (int j = 0; j < c; j++) {
				System.out.print(Aay_rc[i][j] + " ");
			}

			int sum_r = 0;
			for (int k = 0; k < c; k++) {
				sum_r = sum_r + Aay_rc[i][k];
			}
			System.out.println(sum_r);
		}

		int sum_all = 0;
		for (int L = 0; L < c; L++) {
			int sum_c = 0;
			for (int m = 0; m < r; m++) {
				sum_c = sum_c + Aay_rc[m][L];
				sum_all = sum_all + Aay_rc[m][L];
			}
			System.out.print(sum_c + " ");
		}
		System.out.println(sum_all);
	}
}

Measured memory_bytes: 42020
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string str;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector <pii> vpii;
typedef vector <pll> vpll;
typedef map <str,int> mapsi;
typedef map <str,int> :: iterator mapsitr;
typedef map <int , int> mint;
typedef map <ll , ll> mll;
typedef set <int> si;
typedef set <ll> sll;
typedef si :: iterator sitr;
typedef si :: reverse_iterator rsitr;
typedef sll :: iterator sltr;
typedef sll :: reverse_iterator rsltr;
#define mset multiset
typedef mset <int> msi;
typedef mset <ll> msll;
typedef msi :: iterator msitr;
typedef msi :: reverse_iterator msritr;
typedef msll :: iterator msltr;
typedef msll :: reverse_iterator mslritr;
#define mp make_pair
#define pb push_back
#define pob pop_back
#define fi first
#define se second
#define fs first.second
#define ss second.second
#define ff first.first
#define sf second.first
#define newl '\n'
char to_upper (char x){
    if( 97 <= int(x) && int(x) <= 126)return char(x-32);
    else if( 65 <= int(x) && int(x) <= 90)return x;
}
char to_lower (char x){
    if( 97 <= int(x) && int(x) <= 126)return x;
    else if( 65 <= int(x) && int(x) <= 90)return char(x+32);
}
int numerize (char x){
    if(48 <= int(x) && int(x) <= 57)return int(x-'0');
    else if( 97 <= int(x) && int(x) <= 126)return int(x-96);
    else if( 65 <= int(x) && int(x) <= 90)return int(x-64);
}
//void IO(){
//	#ifndef ONLINE_JUDGE
//	    freopen("input.txt", "r", stdin);
//	    freopen("output.txt", "w", stdout);
//	#endif
//}
// end of Template

int n,m,q;
pii city[300000];
vector <int> adj[600];
int binsearch (int start, int pi, int qi){
    if(start < pi || start > qi) return 0;
    else{
        int l=0;
        int r=(int) adj[start].size()-1;
        int idx=-1;
        while(l<=r){
            int mid = (l+r)/2;
            if(adj[start][mid]<=qi){
                idx = mid;
                l = mid+1;
            }
            else{
                r=mid-1;
            }
        }
        return idx + 1;
    }
}
int main(){
	//IO();
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin>>n>>m>>q;
    for(int i=1;i<=m;i++){
        int l,r; cin>>l>>r;
        city[i]=mp(l,r);
    }
    sort(city+1,city+1+m);

//    cout<<newl;
//    for(int i=1;i<=m;i++){
//        cout<<city[i].fi<<" "<<city[i].se<<newl;
//    }
//    cout<<newl;

    for(int i=1;i<=m;i++){
        adj[city[i].fi].pb(city[i].se);
    }

    for(int i=1;i<=q;i++){
        int sum = 0;
        int pi,qi;
        cin>>pi>>qi;
        for(int j=1;j<=n;j++){
            if(j<pi)continue;
            else if(j>qi)break;
            else{
                sum += binsearch(j,pi,qi);
                //cout<<j<<" "<<binsearch(j,pi,qi)<<newl;
            }
        }
        cout<<sum<<newl;
    }
}


Measured memory_bytes: 3712
#include <iostream>

using namespace std;

int main(int argc, char const *argv[])
{
    int a, b, t;
    cin >> a >> b >> t;
    int ans = 0;
    for (int i = 1; a*i < t+1; ++i) {
        ans += b;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
#define rep(i, a, n) for(int i=a; i<n; i++)
#define ll long long
#define all(x) begin(x), end(x)
#define toInt(x) (x - '0')
#define pll pair<ll, ll>
#define pli pair<ll, int>

const long long INF = 1LL<<60;
const int inf = 1 << 30;
const int mod = 1e9+7;


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


vector<pair<ll, int>> factrized(ll num){
  vector<pair<ll, int>>  res;
 
  for(ll i = 2; i * i <= num; i++){
    if(num % i)continue;
    res.emplace_back(i, 0);
    while(num % i == 0){
      num /= i;
      res.back().second++;
    }
  }
  if(num != 1) res.emplace_back(num, 1);
  return res;
}

bool solve(vector<pair<ll, int>> vp){

  if(vp.size() == 1 && (vp[0].first == 1 || vp[0].first == -1)){
    return true;
  }
  if(vp.size() == 1 && vp[0].second == 5){
    return true;
  }
  return false;
}

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

  // long long x_abs = abs(x);
  // long long ans_a = 0;
  // long long ans_b = 0;
  // for(int i=0; pow(i, 5) <= 1e+9; i++){
  //   long long a = pow(i, 5);
  //   long long b = a - x_abs;

  //   vector<pair<ll, int>> vp = factrized(b);

  //   if(solve(vp)){
  //     ans_a = i;
  //     ans_b = vp[0].first;
  //   }
  // }

  // if(x < 0){
  //   swap(ans_a, ans_b);
  // }
  // cout << ans_a << " " << ans_b << endl;

  // cout << pow(ans_a, 5) - pow(ans_b,5) << endl;
  int n, m;
  cin >> n >> m;
  vector<long long> h(n);
  rep(i, 0, n){
    cin >> h[i];
  }
  int ab[m][2];
  vector<vector<int>>  vv(n);
  rep(i, 0, m){
    int a, b;
    cin >> a >> b;
    a--; b--;
    ab[i][0] = a;
    ab[i][1] = b;
    vv[a].push_back(b);
    vv[b].push_back(a);
  }
  long long ans = 0;
  //  for(int i=0; i<n; i++){
  //   bool flag = true;
  //   cout << i + 1 << ":";
  //   for(int j=0; j<vv[i].size(); j++){
  //     cout << vv[i][j] + 1 << " ";
  //   }
  //   cout << endl;
  //  } 
  for(int i=0; i<n; i++){
    bool flag = true;
    for(int j=0; j<vv[i].size(); j++){
      if(h[i] <= h[vv[i][j]]){
        flag = false;
      }
    }
    if(flag){
      ans++;
    }
  }
  cout << ans << endl;
}





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



int main(int argc, char *argv[])
{
    
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N, W;
    cin >> N >> W;
    vector<int> v(N + 1), w(N + 1);
    for (int i = 1; i <= N; i++) {
        cin >> v[i] >> w[i];
    }
    
    vector<vector<int>> Value(N + 1, vector<int>(W + 1, 0));
    vector<vector<int>> selected(W + 1, vector<int>(N + 1, 0));
    
    for (int i = 1; i <= N; i++) {
        for (int j = 1; j <= W; j++) {
            if (j < w[i]) {
                Value[i][j] = Value[i - 1][j];
                continue;
            }
            if (Value[i - 1][j - w[i]] + v[i] > Value[i - 1][j]) {
                Value[i][j] = Value[i - 1][j - w[i]] + v[i];
                selected[j][i] = 1;
            } else {
                Value[i][j] = Value[i - 1][j];
            }
        }
    }
    
    cout << Value[N][W] << endl;
    
    return 0;
}



Measured memory_bytes: 11080
#include<stdio.h>
#define N 100000
typedef struct{
  int time;
  char name[11];
}pro;
main(){
  pro dat1[N],dat2[N];
  int i,q,stime = 0,count1 = 0,count2 = 0,count3;
  scanf("%d %d",&count1,&q);
  for(i = 0;i < count1;i++)
    scanf("%s %d",dat1[i].name,&dat1[i].time);

  count3 = count1;

  while(count3 > 0){
    count2 = 0;
    for(i = 0;i < count1;i++){
      if(dat1[i].time <= q){
	stime += dat1[i].time;
	printf("%s %d\n",dat1[i].name,stime);
	count3--;
      }
      else{
	stime += q;
	dat1[i].time -= q;
	dat2[count2] = dat1[i];
	count2++;
      }
    }
    count1 = 0;
    for(i = 0;i < count2;i++){
      if(dat2[i].time <= q){
	stime += dat2[i].time;
	printf("%s %d\n",dat2[i].name,stime);
	count3--;
      }
      else{
	stime += q;
	dat2[i].time -= q;
	dat1[count1] = dat2[i];
	count1++;
      }
    }
  }
  return 0;
}

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

using namespace std;

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

#define sz(a) int((a).size())
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define ini(a, i) memset(a, i, sizeof(a))
#define contains(c, i) ((c).find(i) != (c).end())
#define present(i, c) (find(all(c), i) != (c).end())

#define rep(i, n) for(int i = 0; i < n; i++)
#define rep1(i, n) for(int i = 1; i <= n; i++)
#define repa(i, a, b) for(int i = (a); i < (b); i++)
#define repd(i, n) for(int i = (n)-1; i >= 0; i--)

#define TRACE(x...) x
#define watch(x) TRACE(cerr << #x" = " << x << endl)
#define watch_all(x) TRACE(cerr << #x" = "; for(auto __i : x) cerr << __i << " "; cerr << endl)

//=========================

#define INF 0x3F3F3F3F

const int MAXN = (int) 1e6;

vector<int> mindiv; //menor divisor de cada numero

// calcula o menor divisor de cada numero ate 'n'
// utiliza a ideia do crivo de eratostenes
void getmindiv() {
    mindiv = vector<int>(MAXN+1, INF);
    mindiv[1] = 1;
    for(int i = 2; i <= MAXN; i += 2) mindiv[i] = 2;
    for(int i = 3; i <= MAXN; i += 2)
        if(mindiv[i] == INF) 
            for(int j = i; j <= MAXN; j += i)
                mindiv[j] = min(mindiv[j], i);
}

vector<int> p; // primos
vector<int> e; // expoentes

// fatoracao de 'n' em fatores p^e
// usa como base array com o menor divisor de cada numero ate 'n', baseado no crivo de eratostenes
void getfactors(int n) {
	if(mindiv.empty()) getmindiv();
    p.clear(); e.clear();
    while(n > 1) {
        if(p.empty() || mindiv[n] != p.back()) p.pb(mindiv[n]), e.pb(0);
        e.back()++;
        n /= mindiv[n];
    }
}

vector<int> d; // divisores

// all divisors of 'n'
void getdivisors(int n) {   
    getfactors(n);
    d.clear(); d.pb(1);
    rep(i, sz(p)) {
        int r = sz(d);
        rep(j, e[i]) rep(k, r) d.pb(p[i] * d[k+j*r]);
    }
}

const int MAXN2 = 200000;

int N;
int A[MAXN2+1];
int cnt[MAXN+1];
bool ok[MAXN+1];

void check_divisors() {
    rep(i, N) {
        ok[i] = true;
        getdivisors(A[i]);
        for(int x : d) {
            if(x == A[i]) ok[i] &= (cnt[x] == 1);
            else ok[i] &= (cnt[x] == 0);
        }
    }
}

void run_test() {
    cin >> N;
    ini(cnt, 0);
    rep(i, N) cin >> A[i], cnt[A[i]]++;
    check_divisors();
    int ans = 0;
    rep(i, N) ans += ok[i];
    cout << ans << endl;
}

//=========================

int main() {
	ios::sync_with_stdio(0); cin.tie(0);
	//int t = 1, _t; cin >> _t; while(t <= _t) { cout << "Case #" << t++ << ": "; run_test(); }
	// int t; cin >> t; while(t--) run_test();
	run_test();
	return 0;	
}



Measured memory_bytes: 11776
#include <bits/stdc++.h>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define FOR(i,a,b) for(int i=a; i<(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define CLR(a) memset((a), 0 ,sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
const int INF = 1001001001;
const ll LINF = 100100100100100100;
const double EPS = 1e-10;
const long double PI  = acos(-1.0L);
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
#define chmax(a,b) a = (((a)<(b))?(b):(a))
#define chmin(a,b) a = (((a)>(b))?(b):(a))

__attribute__((constructor))
void initial(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

signed main(){
	ll x,a,b; 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
using System;
class Program{
  static void Main(string[] args){
    int n = int.Parse(Console.ReadLine());
    string s = Console.ReadLine();
    long p=1;
    for(int i=0;i<26;i++){
      char c = Convert.ToChar(i+97);
      p*=(n-s.Replace(c.ToString(),"").Length+1);
      p%=1000000007;
    }
    Console.WriteLine(--p);
  }
}

Measured memory_bytes: 26464