akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define MAX 20

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};

typedef struct node Node;

Node *root,*NIL;

void insert(int k){
  Node *y=NIL;
  Node *x=root;
  Node *z;
  z=(Node *)malloc(sizeof(Node));
  z->key=k;
  z->left=NIL;
  z->right=NIL;
  
  while(x!=NIL){
    y=x;
    if(z->key < x->key)x=x->left;
    else x=x->right;
  }
 z->parent=y;
 
if(y==NIL)root=z;
else{ if(z->key < y->key)y->left=z;
else y->right=z;
 }
}


void inorder(Node *u){
  if(u==NIL)return;
  inorder(u->left);
  printf(" %d", u->key);
  inorder(u->right);
}
 
void preorder(Node *u){
  if(u==NIL)return;
  printf(" %d", u->key);
  preorder(u->left);
  preorder(u->right);
}


int main(){
  int m, i, x;
  char com[MAX];

  scanf("%d", &m);
 
  for (i=0; i<m; i++ ){
  scanf("%s", com);
 
  if(com[0]=='i'){
      scanf("%d", &x);
      insert(x);}
  else if(com[0]=='p'){
      inorder(root);
	printf("\n");
	preorder(root);
	printf("\n");
      }
  }

  return 0;
}



Measured memory_bytes: 25144
/*input
coffee
*/

#include <bits/stdc++.h>
#define ll long long

using namespace std;

void run() {
	string s;
	cin >> s;
	if(s[2]==s[3] && s[4]==s[5]) {
		cout <<"Yes" << endl;
	}
	else cout << "No" << endl;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);		
	int t = 1;
	// cin >> t;
	while(t--) {
		run();
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i=0; i<(int)(n); i++)
#define REP1(i,a,b) for(int i=a; i<=(int)(b); i++)
#define ALL(x) begin(x),end(x)
#define PB push_back
using namespace std;
typedef int64_t LL;
typedef vector<int> VI;
typedef pair<int,int> PII;

template<class T> inline bool chmax( T &a, const T &b ) { return b>a ? a=b,true : false; }
template<class T> inline bool chmin( T &a, const T &b ) { return b<a ? a=b,true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;
template<class T, class F=less<T>> void sort_uniq( vector<T> &v, F f=F() ) {
    sort(begin(v),end(v),f);
    v.resize(unique(begin(v),end(v))-begin(v));
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    LL x;
    cin >> x;
    for ( int a=0; a<=1000; a++ ) {
        LL res=1;
        for ( int j=0; j<5; j++ ) {
            res*=(LL)a;
        }
        LL y=res-x;
        bool sign=false;
        if ( y<0 ) {
            sign=true;
            y=-y;
        }
        for ( int b=0; b<=1000; b++ ) {
            LL res=1;
            for ( int j=0; j<5; j++ ) {
                res*=(LL)b;
                if ( res>y ) break;
            }
            if ( res==y ) {
                cout << a << ' ';
                if ( sign )  cout << -b << '\n';
                else cout << b << '\n';
                return 0;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 3640
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using static System.Console;
using static System.Math;


namespace AtCodeeeer
{
    class AtCOOOOOOOOOOOder
    {
        static void Main(string[] args)
        {
            string s = ReadLine();
            int Fans = 0;
            bool kuro = true;
            for (int j = 0; j < s.Length; j++)
            {
                if (kuro)
                {
                    if (s[j] == '1')
                    {
                        Fans++;
                    }
                    kuro = false;
                }
                else
                {
                    if (s[j] == '0')
                    {
                        Fans++;
                    }
                    kuro = true;
                }
            }
            WriteLine(Min(Fans, s.Length - Fans));
        }
    }
}


Measured memory_bytes: 13244
#include <string>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <string.h>
#include <utility>
#include <queue>
#include <stack>
#include <iomanip>
#include <ctype.h>
#include <map>
#include <set>
#include <stdio.h>
#include <assert.h>
#include <ctype.h>
#include <sstream>
#include <math.h>
#include <time.h>
#include <iostream>
#include <iomanip>
#include <unordered_set>
#include <unordered_map>
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <tuple>
#include <cmath>
#include <stdio.h>      /* printf, fgets */
#include <stdlib.h>
#include <fstream>

using namespace std;

typedef long long LL;

#define FOR(i,n) for(int i = 0;i < n;i++)
#define MP make_pair
#define PB push_back
#define ALL(a) (a).begin(),(a).end()
#define PII pair<int, int>
#define PLL pair<long long, long long>
#define CLEAR(a) memset(a, 0, sizeof(a))
#define ERASE(a) memset(a, -1, sizeof(a))
#define INF 2000000007LL
#define y1 uu1
#define y2 uu2
const double EPS = 1E-12;
const double PI = acos(-1.0);
const LL mod = 1000000007;

using namespace std;

int n;

void solve() {
  cin >> n;
  for (int i = 1; i <= 50000; i++) {
    if (int(i*1.08) == n) {
      cout << i << endl;
      return;
    }
  }
  cout << ":(" << endl;
}

int main(int argc, char* argv[]) {
  ios_base::sync_with_stdio(0);
  solve();
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define endl "\n"
#define ll long long
#define ld long double
#define l_b lower_bound
#define u_b upper_bound
#define vi vector<int>
#define vll vector<ll>
#define pii pair<int,int>
#define pll pair<ll, ll>
#define vpii vector<pii>
#define vpll vector<pll>
#define heap priority_queue
#define umap unordered_map
#define sz(a) int((a).size())
#define all(c) c.begin(),c.end()
#define test() ll t;cin>>t;while(t--)
#define mset(a,x) memset(a,x,sizeof(a))
#define rep(i,a,n) for(ll i = a; i < n; ++i) 
#define debug(x) cout<<(#x)<<" is "<<(x)<<endl
#define fastIO ios_base::sync_with_stdio(0);cin.tie(0)
 
const int inf = 1e9;
const int mod = 1e9 + 7;
const int N = 1e6 + 5;

int pt[20][20];

int check(float val){
	int x = sqrt(val);
	return (x*x == val);
}

int main() {
	// fastIO;
    int n, d;
    cin >> n >> d;
    rep(i, 0, n)
    	rep(j, 0, d)
    		cin >> pt[i][j];
    int ans = 0;
    rep(i, 0, n){
    	rep(j, i+1, n){
    		float dis = 0;
	    	rep(k, 0, d){
	    		dis += (pt[j][k]-pt[i][k])*(pt[j][k]-pt[i][k]);	
	    	}
	    	if(check(dis))
	    		ans++;
	    }
    }
    cout << ans;

	return 0;
}

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

int main() {
	clock_t start = clock();
	int D;
	cin >> D;

	vector<int> c(26);
	vector<vector<int>> s(D, vector<int>(26));
	vector<int> t(D);
	vector<vector<int>> last(D, vector<int>(26, 0));
	vector<int> sat(D);
	vector<int> sat_tmp(26);

	for (int i = 0; i < 26; i++) {
		cin >> c[i];
	}

	for (int i = 0; i < D; i++) {
		for (int j = 0; j < 26; j++) {
			cin >> s[i][j];
		}
	}

	/*********************************/
	for (int i = 0; i < D; i++) {
		for (int k = 0; k < 26; k++) {
			for (int j = 0; j < 26; j++) {
				if (i == 0) {
					last[i][j] = 0;
				} else {
					last[i][j] = last[i - 1][j];
				}
			}
			last[i][k] = i + 1;
			if (i == 0) {
				sat_tmp[k] = s[i][k];
			} else {
				sat_tmp[k] = s[i][k] + sat_tmp[i - 1];
			}
			int satisfaction = 0;
			for (int j = 0; j < 26; j++) {
				satisfaction += c[j] * (i + 1 - last[i][j]);
			}
			sat_tmp[k] -= satisfaction;
		}
		vector<int>::iterator iter = max_element(sat_tmp.begin(), sat_tmp.end());
		size_t index = distance(sat_tmp.begin(), iter);
		t[i] = index;

		for (int j = 0; j < 26; j++) {
			if (i == 0) {
				last[i][j] = 0;
			} else {
				last[i][j] = last[i - 1][j];
			}
		}
		last[i][t[i]] = i + 1;
		if (i == 0) {
			sat[i] = s[i][t[i]];
		} else {
			sat[i] = s[i][t[i]] + sat[i - 1];
		}
		int satisfaction = 0;
		for (int j = 0; j < 26; j++) {
			satisfaction += c[j] * (i + 1 - last[i][j]);
		}
		sat[i] -= satisfaction;
	}

	// for (int i = 0; i < D; i++) {
	// 	cout << sat[i] << endl;
	// }
	int max_sat = sat[D - 1];
	/*********************************/
	vector<int> t_new(D);
	std::srand(time(NULL));

	while (clock() - start < 1950000) {
		t_new = t;
		t_new[rand() % D] = rand() % 26;

		for (int i = 0; i < D; i++) {
			for (int j = 0; j < 26; j++) {
				if (i == 0) {
					last[i][j] = 0;
				} else {
					last[i][j] = last[i - 1][j];
				}
			}
			last[i][t_new[i]] = i + 1;
			if (i == 0) {
				sat[i] = s[i][t_new[i]];
			} else {
				sat[i] = s[i][t_new[i]] + sat[i - 1];
			}
			int satisfaction = 0;
			for (int j = 0; j < 26; j++) {
				satisfaction += c[j] * (i + 1 - last[i][j]);
			}
			sat[i] -= satisfaction;
		}
		if (sat[D - 1] > max_sat) {
			// cout << sat[D - 1] << endl;
			max_sat = sat[D - 1];
			t = t_new;
		}
	}

	/*********************************/

	for (int i = 0; i < D; i++) {
		cout << t[i] + 1 << endl;
	}
	// cout << sat[D - 1] << endl;
	// cout << clock() - start << endl;

	return 0;
}


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

int main(){
  int n,k;
  cin >> n >> k;
  double ans=0;
  for(int i=1; i<(n+1);i++){
    int count=0;
    int tot=i;
    while(tot < k){
      tot*=2;
      count +=1;
    }
    ans += double(1/pow(2,count));
//    cout << pow(2,count) << endl;
  }
  printf("%.20f\n", double(ans/n));
  return 0;
}


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

constexpr int INF = 1 << 30;

int N, A[100009];
int dp[100009];

int main() {
    cin >> N;
    for(int i = 0; i < N; i++)
        cin >> A[i];

    fill(dp, dp + N, INF);

    for(int i = 0; i < N; i++)
        *lower_bound(dp, dp + N, A[i]) = A[i];

    cout << lower_bound(dp, dp + N, INF) - dp << endl;

    return 0;
}


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

// int/long:		-2,147,483,648 - 2,147,483,647 (-2^31 <= int < 2^31)
// long/long long:	-9,223,372,036,854,775,808 - 9,223,372,036,854,775,807 (-2^63 <= long < 2^63)

#define	INF (1<<30)
//1,073,741,824
//= 536,870,912 *2

#define	MOD 1000000007

// lower_bound(A.begin(), A.end(), N)
// upper_bound(...

// A.erase(unique(A.begin(), A.end()), A.end())

// bit: &/and, |/or, ^/xor, ~/not

// getline(cin, String)
// while (getline(cin, S)) {}

// cout <<fixed <<setprecision(10)

// priority_queue<int> q;
// priority_queue<int, vector<int>, less<int>> q; // Default: vector, less
// priority_queue<vector<int>, vector<vector<int>>, greater<vector<int>>> q;

// Graph
// Warshall-Floyd: Distance between each node, N^3
// Dijkstra: Distance from the start node, N^2
// DFS(Depth-First Search)

//
// Notes
//
// When specified less than N, try full scan.
// RE: empty vector
// Check Qs
// long/int
// xor -> count each bit
// Check values
// 	1,000,000 -> Loop
// 	100,000	-> vector(int:400KB, long:800KB) 

long	F(long H) {
	if (1==H)
		return 1;
	return (F(H/2)*2+1);
}

int	main() {
	long H;
	cin >>H;
	cout <<F(H) <<endl;
	return 0;
}



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

int main()
{
    char o[51], e[51];
    scanf("%s", o);
    scanf("%s", e);
    int i;
    for (i=0; i<strlen(o); i++)
    {
        printf("%c", o[i]);
        if (e[i] != '\0')
        {
            printf("%c", e[i]);
        }
    }
    printf("\n");
    return 0;
}


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

int main() {
    string s,ans="No";
    int count=0;
    cin>>s;
    rep(i,s.size()) {
        if (i % 2 == 0 && (s[i] == 'R' || s[i]=='U' || s[i]=='D')) count++;
        else if(i % 2 == 1 && (s[i] == 'L' || s[i]=='U' || s[i]=='D')) count++;
    }

    if (count==s.size()) ans="Yes";

    cout<<ans<<endl;
}


Measured memory_bytes: 256
package main

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

func main() {
	max := int(1e5)
	isPrime, _ := Sieve(1e5)

	c := make([]int, max+1)
	for i := 3; i <= max; i += 2 {
		c[i] = c[i-2]
		if isPrime[i] && isPrime[(i+1)/2] {
			c[i]++
		}
	}

	Q := nextInt()
	for q := 0; q < Q; q++ {
		l, r := nextInt(), nextInt()
		if l%2 == 0 {
			l++
		}
		if r%2 == 0 {
			r--
		}
		var lc int
		if l-2 > 0 {
			lc = c[l-2]
		}
		fmt.Println(c[r] - lc)
	}
}

// Sieve returns isPrime, primes
func Sieve(max int) ([]bool, []int) {
	isPrime := make([]bool, max+1)
	for i := 2; i <= max; i++ {
		isPrime[i] = true
	}
	primes := []int{}
	for i := 2; i <= max; i++ {
		if !isPrime[i] {
			continue
		}
		for j := 2 * i; j <= max; j += i {
			isPrime[j] = false
		}
		primes = append(primes, i)
	}
	return isPrime, primes
}

var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Buffer(make([]byte, 256), 1e9)
	sc.Split(bufio.ScanWords)
}

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}


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

using namespace std;

int main()
{
    int n;
    cin >> n;
    int arr[n-1];
    for(int i=0; i<n-1; i++) cin >> arr[i];
    int sum=arr[0];
    for(int i=0; i<n-2; i++){
        sum+=min(arr[i], arr[i+1]);
    }
    sum+=arr[n-2];

    cout << sum << endl;
}


Measured memory_bytes: 256
N, M = map(int, input().split())
h = [int(c) for c in input().split()]
dic = [[] for i in range(N)]
for i in range(M):
  a,b = map(int, input().split())
  dic[a-1] += [b-1]
  dic[b-1] += [a-1]

ls = list(range(N))
ans = 0
for c in ls:
  flag = True
  for p in dic[c]:
    if h[c]<=h[p]:
      flag = False
  if flag:
    ans += 1
print(ans)

Measured memory_bytes: 94012
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

/**
 * equeue
 */
public class Main {

    public static void main(String[] args) throws Exception {
        try (Scanner sc = new Scanner(System.in)) {
            int N = sc.nextInt();
            int K = sc.nextInt();
            long[] V = new long[N];
            for (int i = 0; i < N; i++) {
                V[i] = sc.nextLong();
            }

            long max = 0;

            for (int i = 0; i < N; i++) {
                long sum = 0;
                List<Long> minus = new ArrayList<>();

                for (int j = 0; j < K; j++) {
                    if (j < N) {
                        int p = (i + j) % N;
                        long v = V[p];
                        sum += v;

                        if (v < 0) {
                            int pos = Collections.binarySearch(minus, v);
                            if (pos < 0) {
                                pos = -(pos + 1);
                            }
                            minus.add(pos, v);
                        }

                        if (i != 0 && i != N - 1 && p != N - 1 && p >= i) {
                            continue;
                        }
                    }

                    long value = sum;

                    for (int k = j + 1; k < K; k++) {
                        int p = k - j - 1;
                        if (minus.size() <= p) {
                            break;
                        }

                        value -= minus.get(p);
                    }

                    max = Math.max(max, value);

                    //System.out.println(i + " " + j + " " + value + " " + sum + " " + minus);
                }
            }

            System.out.println(max);
        }
    }

}


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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define each(i,c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define all(v) v.begin(), v.end()
#define mset(a, n) memset(a, n, sizeof(a))

typedef long long ll;

const int INF = 1000000000;
const int MOD = 1000000007;

int main(int argc, char *argv[]) {
    // cin.tie(0);
    // ios::sync_with_stdio(false);
    int n;
    cin >> n;

    int h, max_h = 0, pre = 0, ans = 0;
    rep(i, n) {
        cin >> h;
        if (pre > h) ans += max_h - h, max_h = 0;
        max_h = max(max_h, h);
        pre = h;
    }
    ans += max_h;

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

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

int int_len(int n) {
  int s=0;
  while(n!=0) s++, n/=10;
  return s;
}

int int_sum(int n) {
  int m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(int i=s-1;i>=0;i--) m+=n/((int)pow(10,i))-(n/((int)pow(10,i+1)))*10;
  return m;
}


int vec_sum(vector<int> v){
  int n=0;
  for(int i=0;i<v.size();i++) n+=v[i];
  return n;
}
///////////////////////////
int main() {
  long long int a=0,b=0,c=0,d=0,m=0,n=0,h=0,w=0,count=0,ans=0;
  string s;
  cin>>a>>b;
  if(a*b>0){
    if(b>=a) cout<<abs(abs(a)-abs(b))<<endl;
    else cout<<abs(abs(a)-abs(b))+2<<endl;
  }else if(a*b<0){
    cout<<abs(abs(a)-abs(b))+1<<endl;
  }else if(a*b==0){
    if(b>=a) cout<<abs(abs(a)-abs(b))<<endl;
    else cout<<abs(abs(a)-abs(b))+1<<endl;
  }
    
    
    
    
    
    
}
///////////////////////////

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

using namespace std;


int F(long long A, long long B) {
  int digitA = 0, digitB = 0;

  while (A != 0) {
    A = A / 10;
    digitA++;
  }
  
  while (B != 0) {
    B = B / 10;
    digitB++;
  }

  return max(digitA, digitB);
}

int main() {
  long long N;
  long double sqN;
  int mindigit;

  cin >> N;

  sqN =  sqrt(N);

  mindigit = F(N, 1);

  for (int i = 3; i < (long long)sqN + 1; i += 2) {
    if (N % i == 0) {
      int tmp;
      tmp = F(i, N / i);
      if (mindigit > tmp) mindigit = tmp;
    }
  }

  cout << mindigit << endl;

  return 0;
}


Measured memory_bytes: 256
#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 Set(a, v) memset(a, v, sizeof(a))
using namespace std;
 
inline bool chkmin(int &a, int b) {return b < a ? a = b, 1 : 0;}
inline bool chkmax(int &a, int b) {return b > a ? a = b, 1 : 0;}
 
inline int read() {
    int x = 0, fh = 1; char ch = getchar();
    for (; !isdigit(ch); ch = getchar()) if (ch == '-') fh = -1;
    for (; isdigit(ch); ch = getchar()) x = (x * 10) + (ch ^ 48);
    return x * fh;
}
 
void File() {
#ifdef zjp_shadow
    freopen ("E.in", "r", stdin);
    freopen ("E.out", "w", stdout);
#endif
}
 
typedef long long ll;
typedef pair<ll, ll> pll;
#define fir first
#define sec second
#define mp make_pair
const ll Mod = 1e9 + 7;
const int N = 201000;
 
ll ans = 0;
ll fpm(ll x, ll power) {
    ll res = 1;
    for (; power; power >>= 1, (x *= x) %= Mod)
        if (power & 1) (res *= x) %= Mod;
    return res;
}
 
int fa[N], n, tot[N];
vector<int> G[N];
 
int id[N], num = 0, d[N];
vector<pll> dp[N];
 
ll All[N], Zero[N], One[N];
 
void Dfs(int u) {
    int son = n + 1;
    for (int v : G[u]) { Dfs(v); if (d[v] > d[son]) son = v;}
    if (son != n + 1) id[u] = id[son], d[u] = d[son] + 1;
    else id[u] = ++num;
    dp[id[u]].push_back(mp(1, 1));
 
    if ((int)G[u].size() == 1) return ;
 
    For (i, 0, d[u] - 1)
        All[i] = 1, Zero[i] = 1, One[i] = 0;
 
    int nowdep;
    for (int v : G[u])
        For (i, 0, d[v]) {
            nowdep = (d[son] - d[v]) + i;
            pll sta = dp[id[v]][i];
            (All[nowdep] *= (sta.fir + sta.sec)) %= Mod;
            (Zero[nowdep] *= sta.fir) %= Mod;
        }
 
    for (int v : G[u])
        For (i, 0, d[v]) {
            nowdep = (d[son] - d[v]) + i;
            pll sta = dp[id[v]][i];
            (One[nowdep] += Zero[nowdep] * fpm(sta.fir, Mod - 2) % Mod * sta.sec % Mod) %= Mod;
        }
 
    For (i, 0, d[u] - 1) {
        dp[id[u]][i].fir = (All[i] - One[i] + Mod) % Mod;
        dp[id[u]][i].sec = One[i];
    }
}
 
int dep[N];
 
int main () {
    File();
    n = read();
    For (i, 1, n) {
        fa[i] = read();
        G[fa[i]].push_back(i);
        dep[i] = dep[fa[i]] + 1;
        ++ tot[dep[i]];
    }
    ++ tot[0];
    d[n + 1] = -1;
 
    Dfs(0);
 
    For (i, 0, d[0]) {
        pll sta = dp[id[0]][i];
        (ans += sta.sec * fpm(2, n + 1 - tot[d[0] - i]) % Mod) %= Mod;
    }
    printf ("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 52724
$\=8e18;<>=~$";@x=sort{$a-$b}<>;
until(@x<($k=$')){
	for($k..@x){
		@p=sort{$a-$b}map{/ /;$'}@x[0..--$_];
		$\-=$-=$\-($p[$k-1]-shift@p)*($x[$_]-"@x")until@p<$k
	}
	shift@x
}
print

Measured memory_bytes: 512
while True:
	m,f,r=map(int,input().split())
	if m==-1 and f==-1 and r==-1: break
	sum=m+f
	if m==-1 or f==-1:
		print("F")
	elif sum>=80:
		print("A")
	elif sum>=65:
		print("B")
	elif sum>=50:
		print("C")
	elif sum>=30:
		if r>=50:
			print("C")
		else:
			print("D")
	else:
		print("F")



Measured memory_bytes: 5592
N, K = list(map(int, input().split()))

nums = {}

for i in range(N):
  num, count = list(map(int, input().split()))
  if num in nums:
    nums[num] += count
  else:
    nums[num] = count

nums = sorted(nums.items(), key=lambda x:x[0])
count = 0
for num in nums:
  count += num[1]
  if K <= count:
    print(num[0])
    break

Measured memory_bytes: 54104
import           Control.Monad
import qualified Data.ByteString.Char8 as BS
import           Data.Maybe
import           Text.Printf

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
  l <- getInt
  let l' = fromIntegral l / 3.0 :: Double
      ans = l' ^ 3
  printf "%.12f" ans

Measured memory_bytes: 508
#include<bits/stdc++.h>
using namespace std;
#define MAX 200000
#define SENTINEL 2000000000
typedef long long llong;
int L[MAX/2+2];
int R[MAX/2+2];
/*
	5
	3 5 2 1 4 利用冒泡排序显然需要O(n^2)必然超时
	利用归并排序
	分别求每一段中的逆序数个数
	在合并时 R[j]中的逆序数为(n1-i) 
*/
llong mergeInversion(int A[],int left,int mid,int right){
	llong cnt=0;
	int n1 = mid - left;
	int n2 = right - mid;
	for(int i=0;i<n1;i++)
		L[i]=A[i+left];
	for(int i=0;i<n2;i++)
		R[i]=A[mid+i];
	L[n1]=SENTINEL;
	R[n2]=SENTINEL;
	int i=0;
	int j=0;
	for(int k=left;k<right;k++){
		if(L[i]<=R[j])
			A[k]=L[i++];
		else{
			A[k]=R[j++];
			cnt +=n1-i;//之后的所有数放入 
		}
	}
	return cnt; 
}
llong mergeSort(int A[],int left,int right){
	int mid;
	llong v1,v2,v3;
	if(left+1<right){
		mid = (left+right)/2;
		v1 = mergeSort(A,left,mid);
		v2 = mergeSort(A,mid,right);
		v3 = mergeInversion(A,left,mid,right);
		return v1+v2+v3;
	}
	else 
		return 0;
}
int main(){
	int A[MAX],n,i;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>A[i];
	}
	llong ans = mergeSort(A,0,n);
	cout<<ans<<endl;
	return 0;
}


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

typedef long lint;
typedef long long llint;
typedef pair<int, int> pint;
typedef pair<long long, long long> pllint;
typedef tuple<long long, long long, long long> tllint;

// static const int MAX = 1e6;
// static const int NIL = -1;
// static const llint INF = 1<<21;
// static const llint MOD = 1e9 + 7;

bool compPair(const pint& arg1, const pint& arg2) { return arg1.first > arg2.first; }
bool compTuple(const tllint& arg1, const tllint& arg2) { return get<2>(arg1) > get<2>(arg2); }
template<class T> bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main(void) {
    llint a, b, c, d;
    cin >> a >> b >> c >> d;

    llint ans = -1e18;
    chmax(ans, a*c);
    chmax(ans, b*c);
    chmax(ans, a*d);
    chmax(ans, b*d);
    if(a*b<=0||c*d<=0) chmax(ans, 0LL);

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


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

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 1000000007
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)

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

int dp[222222];
bool ok[222222];
int mp[222222][26];
int nxt[26];

int main(){
	
	string str;
	cin >> str;
	str = "X" + str + "X";
	
	REP(i,26)nxt[i] = str.size() - 1;
	for(int i = str.size() - 1;i >= 0;i--){
		REP(j,26)mp[i][j] = nxt[j];
		if(str[i] != 'X')nxt[str[i] - 'a'] = i;
	}
	
	REP(i,222222)dp[i] = INF;
	dp[0] = 0;
	REP(i,str.size()){
		REP(j,26){
			dp[mp[i][j]] = min(dp[mp[i][j]], dp[i] + 1);
		}
	}
	
	ok[str.size() - 1] = true;
	for(int i = str.size() - 1;i >= 0;i--){
		REP(j,26){
			if(dp[mp[i][j]] == dp[i] + 1 && ok[mp[i][j]])ok[i] = true;
		}
	}
	
	int now = 0;
	while(now != str.size() - 1){
		REP(j,26){
			if(dp[mp[now][j]] == dp[now] + 1 && ok[mp[now][j]]){
				char c = 'a' + j;
				cout << c;
				now = mp[now][j];
				break;
			}
		}
	}
	
	cout << endl;
			
	
	return 0;
}


Measured memory_bytes: 22080
# include "iostream"
# include "cstdio"
# include "cstring" 

using namespace std;

const int maxm=100000+10;
int f[maxm],n;
int thing[maxm],tot; 

int main(){
    thing[++tot]=1;   
    register int i,j;
    memset(f,0x3f,sizeof(f)); 
    scanf("%d",&n); 
    i=6; 
    while(i<=n){  
        thing[++tot]=i;
        i*=6; 
    }
    i=9; 
    while(i<=n){  
        thing[++tot]=i;
        i*=9; 
    }
    f[0]=0; 
    for(i=1;i<=tot;i++){ 
        for(j=thing[i];j<=n;j++){ 
            f[j]=min(f[j],f[j-thing[i]]+1); 
        } 
    }
    printf("%d",f[n]); 
    return 0; 
} 

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define ALL(obj) begin(obj), end(obj)
#define debug(x) cerr << #x << ": " << x << '\n'
using namespace std;
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
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;
}

using ll = long long;
using ull = unsigned long long;
const int INF = 1e9;
// const int MOD = 1e9 + 7;
using P = pair<int, int>;
int main() {
    int N, M;
    cin >> N >> M;
    int cnt = 0;

    vector<P> ans;
    int l = 1;
    int r = 1 + (N - 3) / 2;
    while (cnt < M && r - l >= 1) {
        cnt++;
        ans.push_back(P(l, r));
        l++, r--;
    }
    if (cnt == M) {
        for (int i = 0; i < M; i++) {
            cout << ans[i].first << " " << ans[i].second << "\n";
        }
        return 0;
    }
    l = N - (N - 1) / 2;
    r = N;
    while (cnt < M && r - l >= 1) {
        cnt++;
        ans.push_back(P(l, r));
        l++, r--;
    }
    if (cnt == M) {
        for (int i = 0; i < M; i++) {
            cout << ans[i].first << " " << ans[i].second << "\n";
        }
        return 0;
    }
}


Measured memory_bytes: 4252
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
	int n;
	cin>>n;
	int a[n];
	int dp[n+1];
	
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	memset(dp,0,sizeof(dp));
	dp[0]=0;
	dp[1]=abs(a[1]-a[0]);
	for(int i=2;i<n;i++){
		dp[i]=min(dp[i-1]+abs(a[i]-a[i-1]),dp[i-2]+abs(a[i]-a[i-2]));
	}
	cout<<dp[n-1]<<endl;
	}
	


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define int long long
using namespace std;
int mx;
vector<vector<pair<int,int> > >comb;
vector<int>vec;
void check(vector<int> v)
{
	int f =0;
//	for(int i=0;i<v.size();i++)
//	{
//		cout<<v[i]<<" ";
//	}
//	cout<<endl;
	for(int i=0;i<v.size();i++)
	{
		if(v[i] == 1)
		{
			for(int j=0;j<comb[i].size();j++)
			{
				int l = comb[i][j].first-1;
				int r = comb[i][j].second;
				if(v[l] != r)
				{
					f=1;
					break;
				}
			}
	    }
	}
	int count=0;
	if(f==0)
	for(int i=0;i<v.size();i++)
	{
		if(v[i] == 1)
		{
			count++;
		}
	}
	mx = max(mx,count);
}
void dfs(int n,vector<int>v,int i)
{
	if(v.size() == n)
	{
		check(v);
		return;
	}
	for(int i=0;i<2;i++)
	{
		v.push_back(i);
		dfs(n,v,i);
		v.pop_back();
	}
	return;	
}
main()
{
	//freopen("input.txt","rt",stdin);
	int n;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		vec.push_back(0);
		int p;
		cin>>p;
		vector<pair<int,int> >pa;
		for(int j=0;j<p;j++)
		{
			int a,b;
			cin>>a>>b;
			pa.push_back(make_pair(a,b));
		}
		comb.push_back(pa);
	}
	vector<int>v;
	dfs(n,v,0);
	cout<<mx<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
void prefix(ll arr[],ll n,vector<ll> &sum){
	ll s=0;
	for(ll i=0;i<n;i++){
		s=s+arr[i];
		sum[i]=s;
		//cout<<i<<" "<<sum[i]<<endl;
	}
}
int main(){
	ll n;
	cin>>n;
	ll arr[n];
	for(ll i=0;i<n;i++){
		cin>>arr[i];
	}
	ll dp[n][n];
	vector<ll> sum(n);
	//dp[i][j] ----minimum cost to combine from i to j
	prefix(arr,n,sum);
	//cout<<sum[0]<<" "<<sum[1]<<" "<<sum[2]<<endl; 
	for(ll i=n-1;i>=0;i--){
		for(ll j=i;j<n;j++){
			if(i==j) dp[i][j]=0;
			else{
				dp[i][j]=1e18+5;
				for(ll k=i;k<j;k++){
					if(i-1>=0)
						dp[i][j]=min(dp[i][j],dp[i][k]+dp[k+1][j]+sum[j]-sum[i-1]);
					else
						dp[i][j]=min(dp[i][j],dp[i][k]+dp[k+1][j]+sum[j]);
				}
			}
			//cout<<i<<" "<<j<<" "<<dp[i][j]<<endl;
		}
	}
	cout<<dp[0][n-1]<<endl;
}

Measured memory_bytes: 4856
macro_rules! get {
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
            get!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
            get!($($t),*)
        ).collect::<Vec<_>>()
    };
}

fn main() {
    let (n, m) = get!(usize, usize);
    let mut rs = vec![0; n];
    for _ in 0..m {
        let (a, b) = get!(usize, usize);
        rs[a-1] += 1;
        rs[b-1] += 1;
    }
    for r in rs.into_iter() {
        println!("{}", r);
    }
}

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

public class AtCoderA
{
    static void Main()
    {
        var sc = new Scanner();

        long n = sc.NextLong();

        long answer = n + n * n + n * n * n;

        Console.WriteLine(answer);
    }

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}


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

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	map<pair<string,int>,int> cnt[2];
	int n;
	string s;
	cin>>n>>s;
	for(int i=0;i<(1<<n);i++){
		string str[2][2];
		for(int j=0;j<n;j++)
			for(int k=0;k<2;k++)
				if((i>>j)&1)
					str[k][1]+=s[k*n+j];
				else
					str[k][0]+=s[k*n+j];
		reverse(str[0][1].begin(),str[0][1].end());
		reverse(str[1][1].begin(),str[1][1].end());
		int x = __builtin_popcount(i);
		cnt[0][make_pair(str[0][0]+str[0][1],x)]++;
		cnt[1][make_pair(str[1][1]+str[1][0],n-x)]++;
	}
	long long int ans = 0;
	for(auto it:cnt[0]){
		if(cnt[1].count(it.first))
			ans+=1LL*it.second*cnt[1][it.first];
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 68224
#include <bits/stdc++.h>
using namespace std;
#define rep(i, m, n) for (int i = m; i < n; ++i)
const int MOD = 1000000007;

int main() {
    int N;
    long long K;
    cin >> N >> K;
    vector<int> A(N);
    rep(i, 0, N) cin >> A[i];
    int a = 0, b = 0;
    rep(i, 0, N) rep(j, i + 1, N) {
        if(A[i] > A[j]) a++;
    }
    rep(i, 0, N) rep(j, 0, N) {
        if(A[i] > A[j]) b++;
    }
    long long ans1 = a * K % MOD;
    long long ans2 = (K * (K - 1) / 2) % MOD;
    ans2 = b * ans2 % MOD;
    long long ans = (ans1 + ans2) % MOD;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>
#include <string.h>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;


int main()
{

//整数値の入力
int n,x;
cin >> n >> x;
//行列の入力
int table[n]={};
for (int i = 0; i < n; ++i) {
    cin >> table[i];
}
for (int i = 0; i < n; ++i) {
    table[i]=abs(table[i]-x);
}
for (int i = 0; i < n-1; ++i) {
    table[i+1]=__gcd(table[i],table[i+1]);
}
//回答
cout << table[n-1] << endl;
return 0;
}




Measured memory_bytes: 640
package main

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

var sc = bufio.NewScanner(os.Stdin)

func scanInt() int {
	num, _ := strconv.Atoi(scanString())
	return num
}

func scanString() string {
	sc.Scan()
	return sc.Text()
}

func init() {
	sc.Split(bufio.ScanWords)
}

func main() {
	a, b, c := scanInt(), scanInt(), scanInt()
	a, b = b, a
	a, c = c, a

	fmt.Println(a, b, c)
}


Measured memory_bytes: 640
# 入力
s=input()

# 'A'と'Z'の位置を保存する変数
a=z=-1

for i in range(len(s)):
  if a==-1 and s[i]=='A':
    a=i
  if s[i]=='Z':
    z=i

# 出力
print(z-a+1)

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

using ll = long long;
using vi = vector<int>;
using vi2 = vector<vector<int>>;
#define MP(a,b) make_pair((a),(b))
#define MT(...) make_tuple(__VA_ARGS__)

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)

#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl;
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl;

#define DCOUT(x,n) cout << fixed << setprecision(n) << (x) << endl;

#define sz(x) (int)(x).size()
#define HOGE cout << "hoge" << endl;
using P = pair<ll,ll>;

template<typename T>inline istream& operator>>(istream&i,vector<T>&v)
{REP(j,sz(v))i>>v[j];return i;}

const int INF = 1e9;

int main(){
    ll a, b, v, w, t;
    cin >> a >> v >> b >> w >> t;
    if(a==b) cout << "YES" << endl;
    else if(v<=w) cout << "NO" << endl;
    else {
        ll v0 = v-w;
        ll time = abs(a/v0 - b/v0);
        if(a%v0!=b%v0) time ++;

        if(time <= t) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5+5;

int p[N], ans;

int find(int x)
{
	return x == p[x] ? x : p[x] = find(p[x]);
}

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int n, m;
	cin >> n >> m;
	for (int i = 1; i <= n; i++) p[i] = i;
	while (m--)
	{
		int x, y, z;
		cin >> x >> y >> z;
		int px = find(x);
		int py = find(y);
		p[px] = py;
	}
	for (int i = 1; i <= n; i++)
		if (p[i] == i) ans++;
	cout << ans;
	return 0;
 } 

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <queue>
#include <cstring>
#include <map>
#include <unordered_set>
#include <cmath>
#include <iomanip>
#include <unordered_map>
#include <stack>

typedef long long int ll;
#define IO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define linebreak "\n"
#define space " "
#define PI atan(1)*4
#define E 5
#define ACCURATE cout << fixed << setprecision(6)
#define MAX (int)2e5
#define MOD (int)(998244353  )
#define ExpMod (int)(1e9 + 6 )
#define vi vector<int>
#define vll vector<ll>
#define vvi vector<vector<int>>
#define vvll vector<vector<ll>>
#define MAT_SIZE 5

//#define _DEBUG
using namespace std;

//#define _DEBUG
//====================================================================================================

int inverse(ll, ll);

//====================================================================================================
//====================================================================================================
//====================================================================================================
int powmod(ll a, ll b, ll mod) {
    //if (b < 0) return inverse(powmod(a, -1 * b));
    a %= mod;
    // b %= (mod - 1);
    int res = 1;
    while (b > 0) {
        if (b & 1) {
            res = (res * 1ll * a) % MOD;
        }
        a = (a * 1ll * a) % MOD;
        b >>= 1;
    }
    return res % MOD;
}

int inverse(ll a, ll primemod) {
    return powmod(a, 500000002, primemod);
}

int nxt() {
    int x;
    cin >> x;
    return x;
}

int lcm(int a, int b) {
    return a * 1ll / __gcd(a, b) * b;
}

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



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

#define NREP() for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 0; i < n; i++)
#define ALL(x) (x).begin(), (x).end()
#define MSG(x) cout << x << endl;
#define IPT(x) ll t; cin >> t; x.push_back(t);
#define YN(x) x ? cout << "YES" << endl : cout << "NO" << endl;
#define Yn(x) x ? cout << "Yes" << endl : cout << "No" << endl;
#define yn(x) x ? cout << "yes" << endl : cout << "no" << endl;

using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<string> vs;
typedef vector<string> vvs;

const static ll MOD = 1e9 + 7;

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

    ll ans = 0;
    for (ll i = k; i <= n + 1; ++i) {
        ll tmp1 = (n * (n + 1) / 2);
        ll tmp2 = (((n - i) + 1) * (n - i)) / 2;
        ll tmp3 = i * (i - 1) / 2;
        ans += ((tmp1 - tmp2) - tmp3 + 1) % MOD;
    }

    MSG(ans % MOD)
}


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

int main()
{
    int A,B,C,K;
    cin >> A >> B >> C >> K;
    int mx = max(A,max(B,C));
    int co = mx;
    for(int i=0; i<K; i++){
        mx *= 2;
    }
    if(co == A){
        cout << mx+B+C << endl;
    }else if(co == B){
        cout << mx+A+C << endl;
    }else if(co == C){
        cout << mx+B+A << endl;
    }
    return 0;
}


Measured memory_bytes: 256
l = [int(input()) for i in range(5)]

sum = 0
m = 10
for i in l:
    if (i % 10 == 0):
        sum += i
    else:
        sum += i + 10 - (i % 10)
        if (i % 10 < m):
            m = i % 10

print(sum - 10 + m)


Measured memory_bytes: 2940
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n: usize = read();
    let m: usize = read();
    let observatory: Vec<u32> = (0..n).map(|_| read()).collect();
    let path:Vec<(usize,usize)> = (0..m).map(|_| (read(),read())).collect();
    let mut good: Vec<bool> = vec![true;n];

    for i in path.iter() {
        if observatory[i.0-1] == observatory[i.1-1] {
            good[i.0 - 1] = false;
            good[i.1 - 1] = false;
        }else if observatory[i.0-1] < observatory[i.1-1] {
            good[i.0 - 1] = false;
        }else{
            good[i.1 - 1] = false;
        }
    }

    let mut ans = 0;
    for i in good.iter(){
        if *i == true {
            ans += 1;
        }
    }
    println!("{}",ans);
    //println!("{:?}",good);

}


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

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)

using ll = long long;
using ld = long double;
ll INF = LLONG_MAX;

using vi = vector<int>;
using vll = vector<ll>;
using pii = pair<int, int>;

namespace output {
	void pr(int x) { cout << x; }
	void pr(long x) { cout << x; }
	void pr(ll x) { cout << x; }
	void pr(unsigned x) { cout << x; }
	void pr(unsigned long x) { cout << x; }
	void pr(unsigned long long x) { cout << x; }
	void pr(float x) { cout << x; }
	void pr(double x) { cout << x; }
	void pr(ld x) { cout << x; }
	void pr(char x) { cout << x; }
	void pr(const char* x) { cout << x; }
	void pr(const string& x) { cout << x; }
	void pr(bool x) { pr(x ? "true" : "false"); }
	template<class T> void pr(const complex<T>& x) { cout << x; }
	
	template<class T1, class T2> void pr(const pair<T1,T2>& x);
	template<class T> void pr(const T& x);
	
	template<class T, class... Ts> void pr(const T& t, const Ts&... ts) { 
		pr(t); pr(ts...); 
	}
	template<class T1, class T2> void pr(const pair<T1,T2>& x) { 
		pr("{",x.f,", ",x.s,"}"); 
	}
	template<class T> void pr(const T& x) { 
		pr("{"); // const iterator needed for vector<bool>
		bool fst = 1; for (const auto& a: x) pr(!fst?", ":"",a), fst = 0; 
		pr("}");
	}
	
	void print() { pr("\n"); } // print w/ spaces
	template<class T, class... Ts> void print(const T& t, const Ts&... ts) { 
		pr(t); if (sizeof...(ts)) pr(" "); print(ts...); 
	}
}

using namespace output;

int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	ll N; cin >> N;
	vll arr (N + 1);
	F0R(i, N + 1) cin >> arr[i];

	if (N == 0 && arr[0] == 1) {
		print(1); return 0;
	}
	vll free (N+1);
	free[0] = 2;
	
	vll nodes (N+1);
	nodes[0] = 1;
	FOR(i, 1, N+1) {
		if (nodes[i-1] > (1LL<<50)) {
			nodes[i] = nodes[i-1];
		} else {
			nodes[i] = 2 * (nodes[i-1] - arr[i-1]);
			if (nodes[i] < arr[i]) {
				print(-1);
				return 0;
			}
		}
	}

	ll cur = 0;
	ll ans = 0;
	F0R(i, N+1) {
		ll X = arr[i];
		while (X > 0 && X >= free[cur]) {
			if (cur >= i) {
				print(-1);
				return 0;
			}
			ll remove = free[cur];
			free[cur] = 0;
			X -= remove;
			ans += remove * (i - cur);
			++cur;
			free[cur] = nodes[cur] - arr[cur];
		}
		if (X > 0) {
			if (cur >= i) {
				print(-1);
				return 0;
			}
			ans += X * (i - cur);
			free[cur] -= X;
		}
	}
	print(ans + 1);
}


Measured memory_bytes: 5556
#include <cstdio>
 
int result;
char s[100];
 
int calc_ltor(char s[]){
    int res = s[0] - '0';
    for(int i=1;s[i]!='\0';i+=2){
        if(s[i] == '+'){
            res += s[i+1]-'0';
        }
        else if(s[i] == '*'){
            res *= s[i+1]-'0';
        }
    }
    return res;
}
int calc_mfirst(char s[]){
    int res = 0;
    int tmp = s[0] - '0';
    for(int i=1;s[i]!='\0';i+=2){
        if(s[i]=='+'){
            res += tmp;
            tmp = s[i+1] - '0';
        }else{
            tmp *= s[i+1] - '0';
        }
    }
    return res + tmp;
}
 
int main(){
    scanf("%s", s);
    scanf("%d", &result);
    int ltor = calc_ltor(s);
    int mfirst = calc_mfirst(s);
    //printf("%d %d\n", ltor, mfirst);
    if(ltor == result && mfirst == result){
        puts("U");
    }else if(ltor == result){
        puts("L");
    }else if(mfirst == result){
        puts("M");
    }else{
        puts("I");
    }
    return 0;
}

Measured memory_bytes: 1012
#include <bits/stdc++.h>
using namespace std;
int main ()
{
    long long n;
    cin >> n;
    if (n==1 && n==7)
        cout << 1 << endl;
    else
    {
        long long f=7%n;
        int t=1;
        while (n>t && f!=0)
        {
            t+=1;
            f=f*10+7;
            f=f%n;
        }
        if (f!=0)
            cout << -1 << endl;
        else
            cout << t << endl;
    }
}


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

typedef long long int ll;
#define endl "\n"
#define pll pair<ll, ll>
#define pii pair<int, int>
#define pb push_back
#define vi vector<int>
#define vl vector<ll>
#define vpii vector<pair<int, int>>
#define mems(x, y) memset(x, y, sizeof(x))
#define all(x) (x).begin(), (x).end()
#define forn(i, s, e) for (int i = s; i < (e); ++i)
#define FASTIO                        \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);
#define FILEIO                          \
    freopen("./input.txt", "r", stdin); \
    freopen("./output.txt", "w", stdout);
#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#define time__(d)                                                               \
    for (                                                                       \
        auto blockTime = make_pair(chrono::high_resolution_clock::now(), true); \
        blockTime.second;                                                       \
        debug("%s : %lld ms\n ", d, chrono::duration_cast<chrono::milliseconds>(chrono::high_resolution_clock::now() - blockTime.first).count()), blockTime.second = false)
const int M = 1e9 + 7;

template <class T>
T ABS(const T &x) { return x > 0 ? x : -x; }
ll gcd(ll n1, ll n2) { return n2 == 0 ? ABS(n1) : gcd(n2, n1 % n2); }
ll lcm(ll n1, ll n2) { return n1 == 0 && n2 == 0 ? 0 : ABS(n1 * n2) / gcd(n1, n2); }

int main()
{
    FASTIO
#ifdef LOCAL
    FILEIO
#endif
    int n, i, j;
    cin >> n;
    vi a, b;
    forn(l, 0, n)
    {
        cin >> i >> j;
        a.pb(i);
        b.pb(j);
    }
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    int X, Y;
    if (n % 2)
    {
        X = a[n / 2];
        Y = b[n / 2];
    }
    else
    {
        X = a[n / 2] + a[n / 2 - 1];
        Y = b[n / 2] + b[n / 2 - 1];
    }
    cout << Y - X + 1 << endl;
    return 0;
}

Measured memory_bytes: 5128
#include <iostream>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <math.h>
#include <string>
#include <cctype>
#include <map>

using namespace std;

const int mod = 1000000007;
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))
#define ll long long

int main()
{
    int X;
    cin >>X;
    vector <bool > expo(X+1);
    expo[1] = true;
    for(int b = 2; b <= X; b++)
    {
        int v = b*b;
        while(v <= X)
        {
            expo[v] = true;
            v *= b;
        }
    }
    
    for(int i = X; i >= 1; i--)
    {
        if(expo[i])
        {
            cout << i << endl;
            return 0;
        }
    }
}

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


using namespace std;
using ll = int64_t;
#define int int64_t

 
/* ==== declarations ====== */
// functions
void solve();
void getInput();
 
// global variables
int N;
vector<int> A;

/* ======================== */
void getInput() {
    cin>>N;
    A = vector<int>(N, 0);
    for (int i=0; i<N; ++i) {
        cin>>A[i];
    }
}
 
 
void solve() {
    __int128_t cal = 1;
    int lim = 1000000000000000000;
    for(auto a: A) {
        if (cal > lim and a != 0) continue;
        cal *= a;
    }
    
    if (cal > lim) {
        cout<<-1<<endl;
    } else {
        cout<<(int64_t)cal<<endl;
    }
}
 
 
 
signed main(){
    getInput();
    solve();
    return 0;
}

Measured memory_bytes: 4028