akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <vector>
#include <algorithm>

#define INF 1000000000

using namespace std;

int n, a, b, c;
vector<int> l;

int dfs(int st, int ca, int cb, int cc) {
    if (st == n) return (ca && cb && cc ? abs(a - ca) + abs(b - cb) + abs(c - cc) : INF);
    return min({dfs(st + 1, ca, cb, cc), dfs(st + 1, ca + l.at(st), cb, cc) + 10, dfs(st + 1, ca, cb + l.at(st), cc) + 10, dfs(st + 1, ca, cb, cc + l.at(st)) + 10});
}

int main() {
    scanf("%d%d%d%d", &n, &a, &b, &c);
    l.resize(n);
    for (int i = 0; i < n; ++i) scanf("%d", l.begin() + i);
    printf("%d\n", dfs(0, 0, 0, 0) - 10 * 3);
    return 0;
}


Measured memory_bytes: 256
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cctype>
#include <cassert>
#include <limits>
#include <functional>
#include <iomanip>
#include <complex>
#include <bitset>
#include <stack>
 
using namespace std;
 
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset(m,v,sizeof(m))
#define INF 0x3f3f3f3f3f3f3f3fLL
#define SIZE 200105
#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
 
typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
typedef pair<int,ll> pill; typedef pair<ll,int> plli; 
typedef pair<double, int> pdi;
template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }
typedef complex<double> P;
const int MAX_N = 200010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = 1 << 29;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
ll MOD=998244353;
typedef ll Weight;
struct Edge {
	int src, dst;
	Weight weight;
};
bool operator < (const Edge &e, const Edge &f) {
	return e.weight != f.weight ? e.weight > f.weight : // !!INVERSE!!
	e.src != f.src ? e.src < f.src : e.dst < f.dst;
}
typedef vector<Edge> Edges;
int N,M;
string str;
vi Gr[MAX_N];
bool used[MAX_N];
int cntA[MAX_N]={0},cntB[MAX_N]={0};
int main(){
	cin>>N>>M;
	cin>>str;
	
	/*rep(i,N){
		if(!i)cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}*/
	
	rep(i,M){
		int a,b;
		cin>>a>>b;a--;b--;
		Gr[a].pb(b);
		Gr[b].pb(a);
	}
	queue<int> Q;
	rep(i,N)used[i]=false;
	rep(i,N){
		bool flagA=false,flagB=false;
		rep(j,Gr[i].size()){
			int to = Gr[i][j];
			if(str[to]=='A')flagA=true,cntA[i]++;
			else{
				flagB=true,cntB[i]++;
			}
		}
		if(!flagA||!flagB)Q.push(i),used[i]=true;
	}
	int num = N;
	while(!Q.empty()){
		int v = Q.front();Q.pop();
		num--;
		int ca = (str[v] == 'A');
		int cb = (str[v] == 'B');
		rep(i,Gr[v].size()){
			int to = Gr[v][i];
			if(used[to])continue;
			cntA[to]-=ca;
			cntB[to]-=cb;
			if(!cntA[to] || !cntB[to]){
				used[to]=true;
				Q.push(to);
			}
			
		}
	}
	if(num>0)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}

Measured memory_bytes: 12548
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define per(i,a,b) for(int i =(b)-1;i>=(a);--i)
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define sz(x) (int) (x).size()
#define mp make_pair
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
const int mod = 1e9 + 7;
const int maxn = 2e6 + 10;
ll f[maxn];
ll g[maxn];
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll n,k;
	cin >> n;
	ll p = 1;
	ll ans = 0,gg = 0;
	rep(i,0,n+1){
		cin >> f[i];
		if(p < f[i]){
			cout << "-1";
			return 0;
		}
		if(p < 1e17){
			p -= f[i];
			g[i] = p;
			p*=2;
		}
		else
			g[i] = p;
	}
	ans = f[n];
	ll now = (g[n-1] > f[n] ? f[n] : g[n-1]); 
	per(i,0,n){
		now += f[i];
		ans += now;
		
		now = (g[i-1] > now ? now : g[i-1]); 
	} 
	cout << ans;
	return 0;
}


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

using ll=long long;
const ll MOD=1000000007;

ll pow_mod(ll x, ll y){
  if(y==1){
    return x;
  }
  else if(y%2==1){
    return x*pow_mod(x,y-1)%MOD;
  }
  else
    return pow_mod(x,y/2)*pow_mod(x,y/2)%MOD;
}

ll c_mod(ll n, ll k){
  ll x=1,y=1;
  for(int i=n;i>=n-k+1;i--){
    x =x*i%MOD;
  }
  for(int i=k;i>=1;i--){
    y=y*i%MOD;
  }
  return x*pow_mod(y,MOD-2)%MOD;
}

int main() {
  ll n,a,b;
  cin >> n >> a >> b;
  ll k=0;
  k +=pow_mod(2,n)-1;
  k -=c_mod(n,a);
  k -=c_mod(n,b);
  cout << (2*MOD+k)%MOD << endl;
}

Measured memory_bytes: 256
def main():
    import fractions, functools
    def gcd(li):
        return functools.reduce(fractions.gcd, li)

    n, k, *a = map(int, open(0).read().split())
    g = gcd(a)
    if max(a)>=k and k%g==0:
        print("POSSIBLE")
    else:
        print("IMPOSSIBLE")

if __name__ == "__main__":
    main()


Measured memory_bytes: 16040
import sys
read = sys.stdin.readline
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
MOD = 10 ** 9 + 7

N, K = map(int, read().split())

k = np.arange(K, N + 2, dtype=np.int64)
low = (k - 1) * k // 2
high = N * k - low
cnt = high - low + 1
print(cnt.sum() % MOD)


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

int gcd(int x, int y) {
    return y == 0 ? x : gcd(y, x%y);
}

int P, Q;

int main() {
    cin >> P >> Q;
    int v = Q / gcd(P, Q);
    for (int d = 2; d*d <= v; ++d) {
        if (v % d == 0) {
            while ((v/d)%d == 0) { v /= d; }
        }
    }
    cout << max(2, v) << endl;
}

Measured memory_bytes: 3112
#!/usr/bin/env python3
import sys
MOD = 998244353  # type: int

def solve(N: int, S: int, A: "List[int]"):
    dp = [[0]*(S+1) for _ in range(N+1)]

    for i in range(N):
        for s in range(S+1):
            if s >= A[i]:
                dp[i+1][s] = dp[i][s]+dp[i][s-A[i]]+int(A[i]==s or s==0)
            else:
                dp[i+1][s] = dp[i][s]+int(A[i]==s or s==0)
            dp[i+1][s]%=MOD
    
    answer = 0
    for i in range(N):
        answer += dp[i+1][S]
    print(answer%MOD)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    S = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, S, A)

if __name__ == '__main__':
    main()


Measured memory_bytes: 112732
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

func main() {
	sc.Split(bufio.ScanWords)
	var h, w (int)
	fmt.Scan(&h, &w)

	a := make([][]string, 0, h)
	for i := 0; i < h; i++ {
		if s := rcvStr(); strings.IndexByte(s, '#') != -1 {
			a = append(a, strings.Split(s, ""))
		}
	}

	cal := make([]bool, w)
	for i := 0; i < w; i++ {
		for j := 0; j < len(a); j++ {
			if a[j][i] == "#" {
				cal[i] = true
				continue
			}
		}
	}

	for i := 0; i < len(a); i++ {
		for j, v := range cal {
			if v {
				fmt.Print(a[i][j])
			}
		}
		fmt.Print("\n")
	}
}


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

//#define Fast ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
typedef vector<int>Vl;
typedef pair<int,int>PII;
typedef vector<PII>Vll;
typedef vector<pair<int,pair<int,int> > >Vlll;
typedef priority_queue<int>PQL;
typedef map<int,int>MP;
#define S second
#define F first
#define mp make_pair
#define ms(x,y) memset(x,y,sizeof(x))
#define pb push_back
#define sl(n) scanf("%lld",&n)
#define pl(n) printf("%lld",n)
const int mod=1e9+7;
const int sze=1e5+2;
signed main(){
   int N,K,X,Y;
   sl(N);sl(K);sl(X);sl(Y);
   if(K>=N)cout<<X*N<<endl;
   else{
	   int k1=N-K;
	   cout<<X*K+Y*k1<<endl;
	   
   }
  return 0;
}


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


#define FOR(i, start, end) for(uint64_t i=start; i<end; i++)
#define REP(i, n) FOR(i, 0, n)

// 最大公約数gcd
// 最小公倍数lcm=m*n/gcd
uint64_t gcd(uint64_t m, uint64_t n) {
  uint64_t temp;
  while (m % n != 0){
    temp = n;
    n = m % n;
    m = temp;
  }
  return n;
}

uint64_t lcm(uint64_t m, uint64_t n) {
  return (m*n)/gcd(m,n);
}

// vector<vector<uint64_t> > v(n+1, vector<uint64_t>(n+1, 0))
// v[n][k]に組み合わせ数が入る。
void comb(vector<vector <uint64_t> > &v){
  for(uint64_t i = 0;i <v.size(); i++){
    v[i][0]=1;
    v[i][i]=1;
  }
  for(uint64_t k = 1;k <v.size();k++){
    for(uint64_t j = 1;j<k;j++){
      v[k][j]=(v[k-1][j-1]+v[k-1][j]);
    }
  }
}

// 掛け算オーバーフロー判定
bool is_product_overflow(uint64_t a, uint64_t b) {

	uint64_t prod = a * b;
	
	return (prod / b != a);
}

//素因数分解
void primeFactorization(uint64_t a, list<uint64_t> &factors){ //素因数分解を出力するプログラム
  long i,sq;
  if(a%2==0){ //偶数の場合
    factors.push_back(2);
    primeFactorization(a/2,factors); //2で割った値で再帰
    return;
  }
  sq = sqrt(a);
  for(i=3;i<=sq;i+=2){ //3以上√a以下の奇数の場合
	if(a%i==0){
	  factors.push_back(i);
      primeFactorization(a/i,factors); //割れた値で再帰
      return;
	}
  }
  //偶数でも3以上√a以下の奇数の場合でも割り切れない場合
  if(a!=1){ //aが1でないなら、a自身は素数
    factors.push_back(a);
  }
}

// フェルマーの小定理
// mod. m での a の逆元 a^{-1} を計算する
// (a/b)%m = a*movinv(b,m)%m  
int64_t modinv(int64_t a, int64_t m) {
    int64_t b = m, u = 1, v = 0;
    while (b) {
        int64_t t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

// 円周率
// M_PI

// #include <iomanip> // setprecisionを使用するのに必要
// cout << std::fixed << std::setprecision(15) << y << endl;

// 昇順
// priority_queue<int, vector<int>, greater<int> > queue;

signed main() {
  int64_t n;
  cin >> n;
  map<string,int> count;
  string s;
  int maxCount = 0;
  for(int i=0;i<n;i++){
    cin >> s;
    count[s]++;
    if(maxCount < count[s]){
      maxCount = count[s];
    }
  }
  priority_queue<string, vector<string>, greater<string>> q;
  for(auto x:count){
    if(x.second==maxCount) q.push(x.first);
  }
  while(!q.empty()){
    cout << q.top() << endl;
    q.pop();
  }
  return 0;
}



Measured memory_bytes: 27248
a = input()
b = 0
c = list("ACGT")
for i in range(len(a)):
    if a[i] in c:
        b = max(b, 1)
        for j in range(i + 1, len(a)):
            if a[j] in c:
                b = max(b, j - i + 1)
            else:
                break
print(b)


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

int main(){
    ll n,i;
    cin >> n;
    ll a[n];
    ll b[n];
    for(i = 0; i < n; i++){
        cin >> a[i];
        b[i] = a[i];
    }
    sort(a,a+n,greater<ll>());
    for(i = 0; i < n; i++){
        if(b[i] >= a[0]) cout << a[1] << endl;
        else cout << a[0] << endl;
    }
}

Measured memory_bytes: 4736
#include <stdio.h>

#define MAX_LEN 52

int main(){
  
  int H,W,i,j;
  scanf("%d%d",&H,&W);
  char s[MAX_LEN][MAX_LEN];
  for(i = 1; i <= H; i++){
    scanf("%s",&s[i]);
  }
              
  
  int ans = 1;
  for(i = 1; i <= H; i++){
    for(j = 1; j <= W; j++){
      if(s[i][j] == '#'&&s[i-1][j] != '#'&&s[i+1][j] != '#'&&s[i][j-1] != '#'&&s[i][j+1] != '#')
        ans = 0;
    }
  }
  
  if(ans == 0) printf("No");
  else printf("Yes");
  
  return 0;
}

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

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<ll> vll;
// #define int long long
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000               // 2e9
#define LLINF 2000000000000000000ll  // 2e18 (llmax:9e18)
#define fi first
#define sec second
#define all(x) (x).begin(), (x).end()
#define sq(x) ((x) * (x))
#define dmp(x) cerr << #x << ": " << x << endl;

template <class T>
void chmin(T &a, const T &b) {
  if (a > b) a = b;
}
template <class T>
void chmax(T &a, const T &b) {
  if (a < b) a = b;
}

template <class T>
using MaxHeap = priority_queue<T>;
template <class T>
using MinHeap = priority_queue<T, vector<T>, greater<T>>;
template <class T>
vector<T> vect(int len, T elem) {
  return vector<T>(len, elem);
}

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << p.fi << ',' << p.sec;
  return os;
}
template <class T, class U>
istream &operator>>(istream &is, pair<T, U> &p) {
  is >> p.fi >> p.sec;
  return is;
}
template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  for (int i = 0; i < vec.size(); i++) {
    os << vec[i];
    if (i + 1 < vec.size()) os << ' ';
  }
  return os;
}
template <class T>
istream &operator>>(istream &is, vector<T> &vec) {
  for (int i = 0; i < vec.size(); i++) is >> vec[i];
  return is;
}
void fastio() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  cout << fixed << setprecision(20);
}

#define endl "\n"

template <class T>
struct RangeSum {
  vector<T> vec;
  RangeSum() {}
  RangeSum(vector<T> elems) : vec(elems) {
    for (int i = 1; i < vec.size(); i++) { vec[i] += vec[i - 1]; }
  }
  T sum(int l, int r) {
    if (l > r) return T(0);
    if (l == 0)
      return vec[r];
    else
      return vec[r] - vec[l - 1];
  }
};

void solve() {
  string s;
  cin >> s;
  int ans = 0;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == '2') ans++;
  }
  cout << ans << endl;
  return;
}

signed main() {
  fastio();
  solve();
  //   int t;
  //   cin >> t;
  //   while (t--) solve();
  return 0;
}


Measured memory_bytes: 256
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_set>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<complex>
#include<tuple>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
typedef pair<double,ll> pdl;
#define F first
#define S second
const ll E=1e18+7;
const ll MOD=1000000007;





int main(){
    ll n;
    cin>>n;
    vector<ll> A;
    for(int i=0;i<n;i++){
        ll a;
        cin>>a;
        if(A.empty() || A.back()!=a){A.push_back(a);}
    }
    n=A.size();
    const ll MX=200001;
    vector<ll> cnt(MX,0);
    vector<ll> dp(n,0);
    cnt[A[0]]++;
    dp[0]=1;
    for(int i=1;i<n;i++){
        cnt[A[i]]+=dp[i-1];
        cnt[A[i]]%=MOD;
        dp[i]=cnt[A[i]];
    }
    cout<<dp.back()<<endl;
    
    
    return 0;
}


Measured memory_bytes: 5104
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define se second
#define fi first
#define ll long long
#define INF INT_MAX
#define mod 1000000007
#define chutiyaap ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;
ll pw(ll a, ll b) {
    if (b == 0) return 1;
    ll t = pw(a, b / 2);
    if (b % 2 == 0) return (t * t)%mod;
    else return ((t * t)%mod * a)%mod;
}
int main()
{
	int a, b;
    cin >> a >> b;
    if (a <= 8 && b <= 8) cout << "Yay!\n";
    else cout << ":(\n";
	
}


Measured memory_bytes: 3596
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
struct X{
	int c;
	int t;
	X(){
		c=0;
		t=0;
	}
	X(int c1,int t1){
		c=c1;
		t=t1;
	}
};
bool Comp(X&l,X&r){
	if (l.c<r.c){
		return true;
	}else{
		return false;
	}
}
int main(int argc, char* argv[])
{
	int N,T;
	cin>>N>>T;
	int i;
	vector<X> myVec(N);
	for (i=0;i<N;i++){
		cin>>myVec[i].c>>myVec[i].t;
	}
	sort(myVec.begin(),myVec.end(),Comp);	
	for (i=0;i<N;i++){
		if (myVec[i].t<=T){
			cout<<myVec[i].c<<endl;
			return 0;
		}
	}
	cout<<"TLE"<<endl;
	return 0;
}

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

int N, K;
int A[(int)1e5];

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

    int odd_cnt = 0;
    int even1_cnt = 0;
    int even2_cnt = 0;

    rep(i, N) {
        // 奇数
        if (A[i] % 2 == 1) {
            odd_cnt++;
            continue;
        }

        // 偶数
        if (A[i] % 4 == 0) {
            // 4の倍数 && 偶数
            even1_cnt++;
        } else {
            // not 4の倍数 && 偶数
            even2_cnt++;
        }
    }

    string ans = "No";
    if (odd_cnt == even1_cnt || 
        ((odd_cnt - 1 == even1_cnt) && (even2_cnt % 2 == 0)) || 
        (odd_cnt == 0 && (even1_cnt > 0) ||
        (odd_cnt == 0 && (even1_cnt == 0) && (even2_cnt % 2 == 0)))
    ) {
        ans = "Yes";
    }

    cout << ans << endl;
}

Measured memory_bytes: 640
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		
		if(a < b && b < c){
		    System.out.println("Yes");
		}else{
		    System.out.println("No");
		}
    }
}



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

int main()
{
    char str[4];
    int i;
    cin>>str;
    if((str[0]-'0')+(str[1]-'0')+(str[2]-'0')+(str[3]-'0') == 7)
        cout<<str[0]<<'+'<<str[1]<<'+'<<str[2]<<'+'<<str[3]<<'='<<'7'<<endl;
    else if((str[0]-'0')+(str[1]-'0')+(str[2]-'0')-(str[3]-'0') == 7)
        cout<<str[0]<<'+'<<str[1]<<'+'<<str[2]<<'-'<<str[3]<<'='<<'7'<<endl;
    else if((str[0]-'0')+(str[1]-'0')-(str[2]-'0')-(str[3]-'0') == 7)
        cout<<str[0]<<'+'<<str[1]<<'-'<<str[2]<<'-'<<str[3]<<'='<<'7'<<endl;
    else if((str[0]-'0')-(str[1]-'0')-(str[2]-'0')-(str[3]-'0') == 7)
        cout<<str[0]<<'-'<<str[1]<<'-'<<str[2]<<'-'<<str[3]<<'='<<'7'<<endl;
    else if((str[0]-'0')-(str[1]-'0')-(str[2]-'0')+(str[3]-'0') == 7)
        cout<<str[0]<<'-'<<str[1]<<'-'<<str[2]<<'+'<<str[3]<<'='<<'7'<<endl;
    else if((str[0]-'0')-(str[1]-'0')+(str[2]-'0')+(str[3]-'0') == 7)
        cout<<str[0]<<'-'<<str[1]<<'+'<<str[2]<<'+'<<str[3]<<'='<<'7'<<endl;
    else if((str[0]-'0')+(str[1]-'0')-(str[2]-'0')+(str[3]-'0') == 7)
        cout<<str[0]<<'+'<<str[1]<<'-'<<str[2]<<'+'<<str[3]<<'='<<'7'<<endl;
    else if((str[0]-'0')-(str[1]-'0')+(str[2]-'0')-(str[3]-'0') == 7)
        cout<<str[0]<<'-'<<str[1]<<'+'<<str[2]<<'-'<<str[3]<<'='<<'7'<<endl;

    return 0;
}


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

int f(int x){
  if (x == 4 || x == 6 || x == 9 || x == 11) x = 17;
  else if (x == 2) x = 19;
  else x = 13;
  //if (x == 1 || x == 3 || x == 5 || x == 7 || x == 8 || x ==10 || x == 12) x = 13;
  return x;
}


int main(){
  int x,y;
  cin >> x >> y;
  if (f(x) == f(y)) cout << "Yes" << endl;
  else cout << "No" << endl;

}

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

using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
signed main(){
  int h,n;cin>>h>>n;
  vector<int> a(n);
  rep(i,n)cin>>a[i];
  //sort(a.begin(),a.end());
  int sum=0;
  rep(i,n)sum+=a[i];
  if(sum>=h)cout<<"Yes";
  else cout<<"No";
  cout<<endl;
  return 0;
}

Measured memory_bytes: 1024
# でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..)
from heapq import heappush, heappop
import sys
def main(N, M, G, S, T):
    INF = 10**10
    dp = [[INF for _ in range(N)] for __ in range(3)]
    dp[0][S] = 0
    q = [(0, S)]
    while q:
        d, v = heappop(q)
        for to in G[v]:
            if d + 1 >= dp[(d + 1) % 3][to]: continue
            dp[(d + 1) % 3][to] = d + 1
            q.append((d + 1, to))
    print(dp[0][T] // 3 if dp[0][T] < INF else -1)

if __name__ == '__main__':
    input = sys.stdin.readline
    N, M = map(int, input().split())
    G = [[] for _ in range(N)]
    for _ in range(M):
        x, y = map(int, input().split())
        x, y = x - 1, y - 1
        G[x].append(y)
    S, T = map(lambda x: int(x) - 1, input().split())
    main(N, M, G, S, T)


Measured memory_bytes: 103580
using System;
using System.Linq;
using System.Collections.Generic;

namespace c
{
    class Program
    {
        static void Main(string[] args)
        {
            var _ = Console.ReadLine().Split();
            var n = long.Parse(_[0]);
            var q = long.Parse(_[1]);
            var s = Console.ReadLine().ToCharArray();

            var w = new long[s.Length];
            w[0] = 0;
            for(var i = 0; i < s.Length - 1; i++){
                w[i + 1] = w[i];
                if(s[i] == 'A' && s[i+1] == 'C'){
                    w[i + 1] += 1;
                }
            }

            for(var i = 0; i < q; i++){
                var t = Console.ReadLine().Split();
                var l = long.Parse(t[0]);
                var r = long.Parse(t[1]);

                Console.WriteLine(w[r-1] - w[l-1]);
            }
        }
    }
}


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

int main() {

	int a, b; cin >> a >> b;
	if (a % 3 == 0 || b % 3 == 0 || (a + b) % 3 == 0) {
		cout << "Possible" << endl;
	}
	else {
		cout << "Impossible" << endl;
	}	
	return 0;
}

Measured memory_bytes: 3500
#include <iostream>
#include <string>
using std::cin;
using std::cout;
using std::endl;
using std::string;

int main(void){
    string s;
    cin >> s;
    // 隣り合う文字を比較して判定
    bool isgood = true;
    if (s[0] == s[1]) isgood = false;
    if (s[1] == s[2]) isgood = false;
    if (s[2] == s[3]) isgood = false;
    if (isgood) { cout << "Good" << endl;
    } else {
            cout << "Bad" << endl;
    }
    return 0;
}

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

int main()
{
    int a, b, sum;
    cin >> a >> b;
    sum = a + b;

    if (a % 3 == 0) {
        cout << "Possible" << endl;
        return 0;
    }
    if (b % 3 == 0) {
        cout << "Possible" << endl;
        return 0;
    }
    if (sum % 3 == 0) {
        cout << "Possible" << endl;
        return 0;
    }
    else {
        cout << "Impossible" << endl;
        return 0;
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(),(x).end()
#define LL long long
#define pii pair<int,int>

using namespace std;

int N,K;
vector<int> edge[2001];
bool used[2001];
int remain =0;



void DFS(int v,int depth){
    used[v]=true;
    if(depth<=K/2)remain++;
    for(int u : edge[v])if(!used[u])DFS(u,depth+1);
}


int main(){

    cin>>N>>K;

    vector<pii> E;

    REP(i,N-1){
        int a,b;cin>>a>>b;
        edge[--a].push_back(--b);
        edge[b].push_back(a);
        E.push_back({a,b});
    }

    int ans=0;
    if(K%2==0){
        REP(i,N) {
            remain =0;
            fill_n(used, N, false);
            DFS(i, 0);
            ans = max(ans,remain);
        }
    }else{
        REP(i,N-1){
            remain =0;
            fill_n(used,N,false);
            used[E[i].first]=used[E[i].second]=true;
            DFS(E[i].first,0),DFS(E[i].second,0);
            ans = max(ans , remain);
        }
    }

    cout<<N-ans<<endl;


    return 0;
}

Measured memory_bytes: 384
from fractions import gcd
N = int(input())
a = list(map(int, input().split()))
lcm = a[0]
for i in range(1, N):
    lcm = lcm * a[i] // gcd(lcm, a[i])

ans = 0
for i in a:
    ans += (lcm-1) % i

print(ans)

Measured memory_bytes: 5344
#include <cstdio>
#include <cstring>

char S[100010];
int SL;

int calc(int kk)
{
	int i=0;
	int ch=0;
	while(i<SL-kk+1 && i<kk){
		if(S[i]=='0' && ch%2==0){
		}
		else if(S[i]=='1' && ch%2==1){
		}
		else{
			ch ++;
		}
		i ++;
	}
	if(i==kk)
		return 1;
	while(i<kk){
		if( (S[i]=='0' && ch%2==1) || (S[i]=='1' && ch%2==0) )
			return 0;
		i ++;
	}
	return 1;
}

void solve()
{
	SL = strlen(S);
	int l=1, r=SL+1;
	int m;
	while(l<r){
		m = (l+r)/2;
		if(calc(m) <= 0)
			r = m;
		else
			l = m+1;
	}
	l --;
	printf("%d\n", l);
}

int main()
{
	scanf("%s", &S);
	solve();
	return 0;
}

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

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

  int x_count = 0;
  for (int i = 0; i < S.size(); i++) {
    if (S.at(i) == 'x') {
      x_count++;
    }
  }

  if (x_count >= 8) {
    cout << "NO" << endl;
  }
  else {
    cout << "YES" << endl;
  }
}


Measured memory_bytes: 256
/*
    飲んだ魔剤で家が建つ。
    created at: 2020-05-03 20:53:34
*/

#include <bits/stdc++.h>
using namespace std;

#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define INF 1000000000

int main()
{
    string s;
    cin >> s;

    if (s == "ABC") cout << "ARC" << endl;
    else cout << "ABC" << endl;

    return 0;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;


int main(){
  int N;
  cin >> N;
  vector<int> v;
  rep(i,N){
    int tmp;
    cin >> tmp;
    if(v.size()>0 && v[v.size()-1]==tmp) continue;
    v.push_back(tmp);
  }

  if(N == 1){
    cout << 1 << endl;
    return 0;
  }
  
  int ret = 0;
  int base = 0;
  int id = 1;
  while(base < v.size()){
    if(v[base] < v[id]){
      while(id+1<v.size() && v[id]<v[id+1]) id++;
      ret++;
      base = id+1;
      id = base+1;
    }
    else{
      while(id+1<v.size() && v[id]>v[id+1]) id++;
      ret++;
      base = id+1;
      id = base+1;
    }
  }

  
  cout << ret << endl;
  
  return 0;
}



Measured memory_bytes: 892
#include <bits/stdc++.h>
using namespace std;
#define SORT(a) sort((a).begin(), (a).end())
#define RSORT(a) reverse((a).begin(), (a).end())
#define rep(i, n) for (int i = 0; i < n; i++)
#define all(a) ((a).begin(), (a).end())
typedef long long ll;
// const long long INF = 1LL << 60;
const int INF = 1010101010;
// using Graph = vector<vector<int>>;

int main() {
  int n;
  cin >> n;
  vector<int> dp(100010, INF);
  dp[0] = 0;
  for (int i = 1; i <= 100000; i++) {
    int now = 1;
    while (now <= i) {
      dp[i] = min(dp[i], dp[i - now] + 1);
      now *= 6;
    }
    now = 1;
    while (now <= i) {
      dp[i] = min(dp[i], dp[i - now] + 1);
      now *= 9;
    }
  }
  cout << dp[n] << endl;
  return 0;
}

Measured memory_bytes: 640
#define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include<cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include<iostream>
#include<list>
#include<map>
#include<queue>
#include<set>
#include<string>
#include<utility>
#include <vector>

#define ll long long
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define FORR(i,a,b) for(int i=(a);i>=(b);--i)
#define REPR(i,n)   FORR(i,n,0)

using namespace std;

int main() {
	ll H, W, N, a, b;
	ll ans[10] = { 0 };
	map<int, set<int>> mp;

	cin >> H >> W >> N;
	ans[0] = (H - 2)*(W - 2);
	REP(i, N) {
		cin >> a >> b;
		int A[5][5] = { 0 };
		FOR(j, a - 2, a + 3) {
			FOR(k, b - 2, b + 3) {
				if (mp[j].count(k)) {
					A[j - a + 2][k - b + 2] = 1;
				}
			}
		}


		
		REP(j, 3) {
			REP(k, 3) {
				int cnt = 0;
				REP(l, 9) {
					if (A[j + l % 3][k + l / 3] == 1) {
						cnt++;
					}
				}
				if (j + a - 2 < 1 || k + b - 2 < 1 || j + a  > H || k + b  > W) {
					continue;
				}
				ans[cnt + 1]++;
				ans[cnt]--;
			}
		}
		
		mp[a].insert(b);
	}


	REP(i, 10) {
		cout << ans[i] << endl;
	}

	return 0;
}

Measured memory_bytes: 51840
import collections
n,m=map(int,input().split())
l=list(map(int,input().split()))
L=[l[0]%m]
for i in range(1,n):
  L.append((L[i-1]+l[i])%m)
L.append(0)
L=collections.Counter(L)

ct=0
for i in L.values():
  ct+=i*(i-1)//2
print(ct)

Measured memory_bytes: 17368
#include<bits/stdc++.h>
using namespace std;
/**
******************* Author:Bisnu sarkar ****************************
**/
/*
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
*/
#define fRead(x)       freopen(x,"r",stdin)
#define fWrite(x)      freopen (x,"w",stdout)
#define ull            unsigned long long
#define ll             long long
#define pii            pair<int,int>
#define sit            set<int> :: iterator
#define vrit           vector<int> :: reverse iterator
#define ff             first
#define ss             second
#define endl           '\n';
#define sz(s)          (int)s.size()
#define all(s)         s.begin(),s.end()
#define IO             ios_base::sync_with_stdio(false),cin.tie(NULL);  
#define what_is(x)     cerr << #x << " is " << x << endl;
///*....Debugger....*///
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {cout << endl;}
template<typename T, typename... Args> void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << ", ";
  err(++it, args...);
}
///*....Input....*///
template <typename T> inline void Int(T &n) {
  n = 0; int f = 1; register int ch = getchar();
  for (; !isdigit(ch); ch = getchar()) if (ch == '-') f = -1;
  for (; isdigit(ch); ch = getchar()) n = (n << 3) + (n << 1) + ch - '0';
  n = n * f;
}
 
template <typename T, typename TT> inline void Int(T &n, TT &m) { Int(n); Int(m); }
template <typename T, typename TT, typename TTT> inline void Int(T &n, TT &m, TTT &l) { Int(n, m); Int(l);}
double ind(){double x; scanf("%lf",&x);return x;}

///*....Bitmask....*///
int set_1(int n,int pos){return n = (n | (1<<pos));}
int reset_0(int n,int pos){return n= n & ~(1<<pos);}
bool check_bit(int n,int pos){return n = n & (1<<pos);}

int dx[8]= {1,0,-1,0,-1,-1,1,1};
int dy[8]= {0,1,0,-1,-1,1,-1,1};

///*....Constraints....*///
const int N = (int) 1e6 + 5;
const int M = (int) 1e9 + 7;
const double pi=2* acos(0.0);
const double eps=1e-9;


int main()
{
    int t=1,te=0;
    //Int(t);
    while(t--){
        ll n,d;
        Int(n,d);
        int res=0;
        while(n--){
            ll x,y;
            Int(x,y);
            if(x*x + y*y <= d*d)++res;
        }      
        printf("%d\n", res);

        //printf("Case %d: ",++te);
    }
    return 0;
}






Measured memory_bytes: 3716
#include <stdio.h>
#include <vector>
#include <iostream>
#include <queue>
#include <bits/stdc++.h>
 
#define rep(i,n) for (int i=0;i<(n);++i)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<double> vd;
typedef pair<int, int> pi;


int main() {
  int a, b, c;
  cin >> a >> b >> c;
  string ans = "Yes";
  if (a!=b and a!=c and b!=c) ans = "No";
  if (a==b and a==c and b==c) ans = "No";
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <iomanip>
#include <random>
#include <cassert>
#include <cstring>
using namespace std;

#define GET_ARG(a,b,c,F,...) F
#define REP3(i,s,e) for (i = s; i <= e; i++)
#define REP2(i,n) REP3 (i,0,(int)(n)-1)
#define REP(...) GET_ARG (__VA_ARGS__,REP3,REP2) (__VA_ARGS__)
#define RREP3(i,s,e) for (i = s; i >= e; i--)
#define RREP2(i,n) RREP3 (i,(int)(n)-1,0)
#define RREP(...) GET_ARG (__VA_ARGS__,RREP3,RREP2) (__VA_ARGS__)
#define DEBUG(x) cerr << #x ": " << x << endl

int main(void) {
    string s;
    cin >> s;
    cout << s.substr(0,s.size()-8) << endl;
    return 0;
}

Measured memory_bytes: 256
#![allow(unused_imports)]
use itertools::Itertools;
use proconio::{input, marker::*};
use std::cmp::*;
use std::collections::*;
use superslice::*;

fn main() {
    input! {
        n: usize,
    }

    let mut ans: Vec<u64> = vec![0; n + 1];

    for x in 1..=100 {
        for y in 1..=100 {
            for z in 1..=100 {
                let a = x * x + y * y + z * z + x * y + y * z + z * x;
                if n < a {
                    continue;
                }
                ans[a as usize] += 1;
            }
        }
    }

    for i in 1..=n {
        println!("{}", ans[i]);
    }
}


Measured memory_bytes: 2200
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <set>
#include <map>
#define all(x) (x).begin(), (x).end()
typedef long long ll;
#define MOD 1000000007
using namespace std;
int main()
{
    int n;cin>>n;
    vector<vector<int>> edge(n);
    vector<bool> visited(n,false);
    vector<int> ans(n);
    for (int i = 0; i < n-1; i++)
    {
        int a,b;cin>>a>>b;
        a--;b--;
        edge[a].push_back(b);
        edge[b].push_back(a);
    }
    vector<int> c(n);
    ll sum=0;
    for (int i = 0; i < n; i++)
    {
        cin>>c[i];
        sum+=c[i];
    }
    sort(all(c));
    cout<<sum-c.back()<<endl;
    queue<int> que;
    que.push(0);
    while(!que.empty()){
        int now=que.front();
        ans[now]=c.back();
        c.pop_back();
        visited[now]=true;
        for(auto next:edge[now]){
            if(!visited[next]){
                que.push(next);
            }
        }
        que.pop();
    }
    for (int i = 0; i < n; i++)
    {
        cout<<ans[i]<<" ";
    }
    cout<<endl;
}

Measured memory_bytes: 1024
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    vector< vector<int> > A(2, vector<int>(N));
    rep(i, 2) rep(j, N) cin >> A[i][j];

    vector<int> score(N);

    rep(i, N) {
        score[i] += A[0][0];
        REP(j, 1, i) score[i] += A[0][j];
        REP(j, i, N-1) score[i] += A[1][j];
    }
    int ans = 0;
    rep(i, N) ans = max(ans, score[i]);
    cout << ans << endl;




    return 0;
}


Measured memory_bytes: 256
N,K=map(int,input().split())
h=list(map(int,input().split()))
dp=[0]*N
dp[0]=0
dp[1]=abs(h[1]-h[0])
for i in range(1,N-1):
    l=[]
    for j in range(1,K+1):
        if (i+1-j)<0:
            continue
        m=dp[i+1-j]+abs(h[i+1-j]-h[i+1])
        #print(i-j)
        l.append(m)
    #print(l)
    m=min(l)
    dp[i+1]=m
#print(dp)
print(dp[-1])

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

bool vecsort(const pair<int, int> &a, const pair<int, int> &b) {
	return a.second < b.second;
}



int main(void) {
	int N, x;
	int ans[500*500+1] = {0};
	vector <pair <int, int> > pairs;

	cin >> N;
	int min = 0, max = 0;

	for (int i = 1; i <= N; i++) {
		cin >> x;
		ans[x] = i;
		pairs.push_back(make_pair(i, x));
	}
	std::sort(pairs.begin(), pairs.end(), vecsort);

	int pos = 1;
	for (int i = 0; i < pairs.size(); i++) {
		int num = pairs.at(i).first;
		int left = num - 1;
		while (left > 0) {
			if (ans[pos] == 0) {
				ans[pos] = num;
				left--;
			}
			pos++;
		}
	}
	pos = N*N;
	for (int i = pairs.size()-1; i >= 0; i--) {
		int num = pairs.at(i).first;
		int left = N - num;
		while (left > 0) {
			if (ans[pos] == 0) {
				ans[pos] = num;
				left--;
			}
			pos--;
		}
	}

	// check
	vector <int> numpos[501];
	for (int num = 1; num <= N; num++) numpos[num].push_back(0);
	for (int i = 1; i <= N*N; i++) numpos[ans[i]].push_back(i);

	bool good = true;
	for (int i = 0; i < N; i++) {
		int num = pairs.at(i).first;
		if (numpos[num].at(num) != pairs.at(i).second) good = false;
	}
	if (good) {
		cout << "Yes" << endl;
		for (int i = 1; i <= N*N; i++) {
			if (1 < i) cout << " ";
			cout << ans[i];
		}
	} else {
		cout << "No" << endl;
	}
	
	return 0;
}


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

int main(void) {
  int i, j, n, now = 0;
  scanf("%d", &n);
  int a[n];
  for(i = 0; i < n; ++i) scanf("%d", &a[i]);
  for(i = n - 1; i >= 0; i -= 2, now++) printf("%d ", a[i]);
  for(i = n % 2; i < n; i += 2, now++) printf("%d ", a[i]);
  return 0;
}

Measured memory_bytes: 2816
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <stack>
#define rep(i, s, g) for ((i) = (s); (i) < (g); ++(i))
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll MOD = 1e9 + 7;
const ll INF = (1e18) + 1;

ll power(ll x, ll y)
{
    ll ans = 1;
    while (y)
    {
        if (y & 1)
            ans = (ans * x) % MOD;
        x = (x * x) % MOD;
        y >>= 1;
    }
    return ans;
}

int main(void)
{
    int n;
    ll a;
    int i, j;
    vector<int> digit(100, 0);
    ll ans = 0;

    cin >> n;

    rep(i, 0, n)
    {
        cin >> a;

        rep(j, 1, 70)
        {
            if (a & 1)
            {
                digit[j]++;
            }

            a >>= 1;

            if (a == 0)
            {
                break;
            }
        }
    }

    rep(i, 1, 70)
    {
        ans += (power(2, i - 1) * digit[i]) % MOD * (n - digit[i]);
        ans %= MOD;
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
value = input().split()
W = int(value[0])
H = int(value[1])
coordinate = [[0 for _ in range(W + 1)] for _ in range(H + 1)]
x = int(value[2])
y = int(value[3])
r =int(value[4])
try:
    if x < 0 or y < 0:
        print("No")
    else:     
            tmp = coordinate[y][x + r]
            tmp = coordinate[y][x - r]
            tmp = coordinate[y + r][x]
            tmp = coordinate[y - r][x]
            print("Yes")
except Exception:
    print("No")



Measured memory_bytes: 5644
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int maxn=2e5+10;
signed main(){
	int t,k;
	cin>>t>>k;
	int s=t,ans=0;
	int b[110]={0};
	while(k--){
		int d,a;
		cin>>d;
		for(int i=1;i<=d;i++)cin>>a,b[a]++;
	}
	for(int i=1;i<=s;i++)if(!b[i])ans++;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3572
#include <iostream>
#include <algorithm>
#include <math.h>
#include <string.h>
#include <iomanip>
#include <vector>

typedef long long ll;
using namespace std;

int main()
{
    double N, K;
    double sum = 0, ans;
    double y = 0;
    cin >> N >> K;

    for (double i = 1; i <= N; i++) {
        double x = i;
        y = 1.0;
        while (x < K) {
            x *= 2.0;
            y *= 1.0/2.0;
        }
        ans += 1.0/N*y;
    }
    cout << setprecision(12) << ans << endl;
    return 0;
}


Measured memory_bytes: 256
def main():
    import sys
    input = sys.stdin.buffer.readline
    N, M = (int(i) for i in input().split())
    H = [int(i) for i in input().split()]
    ans = [1]*N
    for _ in range(M):
        a, b = (int(i)-1 for i in input().split())
        if H[a] < H[b]:
            ans[a] = 0
        elif H[b] < H[a]:
            ans[b] = 0
        else:
            ans[a] = 0
            ans[b] = 0

    print(sum(ans))


if __name__ == '__main__':
    main()


Measured memory_bytes: 85560
let get_2_ints () = Scanf.scanf "%d %d " (fun u v -> u,v)
let input_int_array n =
	Array.init n (fun _ -> Scanf.scanf "%d " (fun v -> v))

let digits v =
  let rec f0 p a = if p=0 then a else f0 (p/10) ((p mod 10)::a)
  in f0 v []

let () = 
  let (n,k) = get_2_ints ()
  in let nums = input_int_array k |> Array.to_list
  in
  let f,i,v = ref true,ref n,ref 0
  in while !f do
    let dl = digits !i in
    if not @@ List.exists (fun v -> List.exists ((=) v) nums) dl
    then (
      v:=!i; f:=false
    ) else (
      i:=!i+1
    )
  done;
  !v |> string_of_int |> print_endline

Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int h, w;
  scanf("%d%d", &h, &w);
  string s[101];
  for(int i = 0; i < h; i++)cin >> s[i];
  for(int i = 0; i < h; i++)cout << s[i] << "\n" << s[i] << "\n";
  return 0;
}


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

#define ll     long long
#define fr     first
#define sec    second
#define rep(i,n)  for(i=0;i<n;i++)
#define vi     vector <int>
#define vc     vector <char>
#define vl     vector <ll>
#define vb     vector <bool>
#define pb     push_back
#define M      1000000007
#define ios    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define open   freopen("input.txt","r",stdin);
#define close  freopen("output.txt","w",stdout);
#define M_PI   3.14159265358979323846
#define pp     pair<int,int>
#define nn 100003
#define MM 1000000000
#define MN 1000000000000000000
int main()
{
    ios;
    ll a,c;
    float b;
    cin>>a>>b;
    c=b*1000;
    if(c%10>5)
        c+=10;
    c/=10;
    a*=c;
    a/=100;
    cout<<a;
    return 0;
}


Measured memory_bytes: 3704
n=int(input())
b=list(map(int,input().split()))
ans=[-1 for i in range(n)]
for i in range(len(b)):
    if ans[i] == -1 or ans[i] > b[i]:
        ans[i] = b[i]
    ans[i+1]=b[i]
#print(ans)
print(sum(ans))

Measured memory_bytes: 3060
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>

using namespace std;

const int MOD = 1000000007;
typedef pair<int, int> P;
typedef long long ll;
#define rep(i, m, n) for(int i=m;i<n;i++)
#define rrep(i, n, m) for(int i=n;i>=m;i--)

int main() {
    int a, b;
    cin >> a >> b;
    if (a + b == 15) {
        cout << "+" << endl;
    } else if (a * b == 15 ) {
        cout << "*" << endl;
    }else{
        cout << "x" << endl;
    }
}


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

struct edge {
    int from, to; long long cost;
};

int main() {
    int n, m; long long p; cin >> n >> m >> p;
    vector<edge> v;
    vector<long long> d(n, -1e12);
    d[0] = 0;
    for (int i = 0; i < m; i++) {
        int a, b; long long c; cin >> a >> b >> c;
        v.push_back({a-1, b-1, c-p});
    }
    for (int i = 0; i < n; i++) {
        for (auto &e: v) {
            d[e.to] = max(d[e.to], d[e.from] + e.cost);
        }
    }
    bool inf = false;
    for (int i = 0; i < n; i++) {
        long long prev = d[n-1];
        for (auto &e: v) {
            d[e.to] = max(d[e.to], d[e.from] + e.cost);
        }
        if (d[n-1] != prev) inf = true;
    }
    if (inf) cout << -1 << endl;
    else cout << max(0LL, d[n-1]) << endl;
}

Measured memory_bytes: 512
A,B=map(int,input().split())
if B==1:
    ans=0
elif 1<B and B<=A:
    ans=1
else :
    for k in range(2,100):
        if (k-1)*A-(k-2)<B and B<=k*A-(k-1):
            ans=k
        else:
            k=k+1
print(ans)


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

using namespace std;

typedef long long ll;

const int N = 2020;
const int Mod = 1e9 + 7;

int Inv[N];
int Fact[N];
int iFact[N];

void add_self(int& x, int y)
{
    if((x += y) >= Mod) x -= Mod;
}

int mul(int x, int y)
{
    return (ll) x * y % Mod;
}

int C(int n, int k)
{
    if(n < 0 || k < 0 || n < k) return 0;

    return mul(Fact[n], mul(iFact[k], iFact[n - k]));
}

int main()
{
    Inv[1] = 1;
    for(int i = 2; i < N; i++)  Inv[i] = (Mod - mul(Mod / i, Inv[Mod % i])) % Mod;

    Fact[0] = iFact[0] = 1;
    for(int i = 1; i < N; i++)  Fact[i] = mul(i, Fact[i - 1]);
    for(int i = 1; i < N; i++)  iFact[i] = mul(Inv[i], iFact[i - 1]);

    int n, k;   cin >> n >> k;

    for(int i = 1; i <= k; i++) printf("%d\n", mul(C(k - 1, i - 1), C(n - k + 1, i)));
}


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

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

long long MOD = 1000000000 + 7;

int main(){
  cout << setprecision(10);

  int K,T;
  cin >> K >> T;

  int max_val = 0;
  for(int i = 0; i < T; i++){
    int tmp;
    cin >> tmp;
    if(max_val < tmp) max_val = tmp;
  }

  int ans = 0;
  int tmp = max_val - 1 - (K-max_val);
  if(tmp > 0) ans = tmp;
  cout << ans << endl;
}


Measured memory_bytes: 256
a = int(input())
b = int(input())
c = int(input())
x = int(input())
ans = 0
for i in range(a+1):
  for j in range(b+1):
    for k in range(c+1):
      if 500*i+100*j+50*k == x:
        ans += 1
print(ans)

Measured memory_bytes: 3064
import math

a,b,x = map(int,input().split())
if x > (a**2 * b)/2:
    print(math.degrees(float(math.atan(2*(a**2 * b-x)/a**3))))
else:
    print(90-math.degrees(float(math.atan(2*x/(a*b**2)))))

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <cmath>
#include <deque>
#include <iterator>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
template<class T> inline bool chmax(T& a, T b) {if (a<b) {a=b; return true;} return false;}
template<class T> inline bool chmin(T& a, T b) {if (a>b) {a=b; return true;} return false;}

const ll MOD = 1000000007;
const ll HIGHINF = (ll)1e18;

int main() {
  string sa, sb, sc; cin >> sa >> sb >> sc;
  ll ai=0, bi=0, ci=0;
  ll nxt = 0;
  while (true) {
    if (nxt == 0) {
      if (ai == sa.size()) {cout << 'A' << endl; break;}
      else {
        if (sa[ai] == 'b') {nxt = 1; ai++;}
        else if (sa[ai] == 'c') {nxt = 2; ai++;}
        else ai++;
      }
    } else if (nxt == 1) {
      if (bi == sb.size()) {cout << 'B' << endl; break;}
      else {
        if (sb[bi] == 'a') {nxt = 0; bi++;}
        else if (sb[bi] == 'c') {nxt = 2; bi++;}
        else bi++;
      }
    } else {
      if (ci == sc.size()) {cout << 'C' << endl; break;}
      else {
        if (sc[ci] == 'a') {nxt = 0; ci++;}
        else if (sc[ci] == 'b') {nxt = 1; ci++;}
        else ci++;
      }
    }
  }
  return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.util.Arrays;

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();
		int [] x = new int[N];
		
		int [] count = new int[N];
		Arrays.fill(count, 0);

		for(int i=0;i<N;i++){
			++count[sc.nextInt()-1];
		}
		Arrays.sort(count);
		int i;
		for(i=0;i<N;i++){
			if(count[i]!=0){
				break;
			}
		}
		int ans =0;
		for(int j=i;j<N-K;j++){
			ans += count[j];
		}
		System.out.print(ans);
		

	}
}

Measured memory_bytes: 65312
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
 
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String str = scanner.next();
        List<Integer> list = new ArrayList<>();

        if(str.length() == 1) {
            System.out.println(0);
        } else {
            for(int i = 0; i < str.length(); i++) {
                char c = str.charAt(i);
                list.add(Character.getNumericValue(c));
            }
            int count = 0;
            for(int i = 0; i < list.size(); i++) {
                if(i == list.size() -1) break;
                int numA = list.get(i);
                int numB = list.get(i+1);
                if(numA == numB) {
                    count++;
                    if(numB == 0) {
                        list.set(i+1, 1);
                    } else {
                        list.set(i+1, 0);
                    }
                }
            }
            System.out.println(count);
        }

    }
}

Measured memory_bytes: 26180