akhauriyash/Code-Regression huggingface dataset:
/* monkukui 競技プログラミング用のテンプレート  (ここから) */
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
#include <bitset>

using namespace std;
using lint = long long int;
using ll = long long int;
using lnt = long long int;
using Graph = vector<vector<int>>;
using Wgraph = vector<vector<pair<int, long long int>>>;
constexpr long long int INF = 1001001001001001LL;
constexpr long long int MOD = 1000000007LL;
constexpr double PI = 3.1415926535897932;
constexpr long long int di[] = {-1, 0, 1, 0, -1, 1, 1, -1};
constexpr long long int dj[] = {0, 1, 0, -1, 1, 1, -1, -1};

template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
inline void yes(){ cout << "yes" << endl; }
inline void Yes(){ cout << "Yes" << endl; }
inline void YES(){ cout << "YES" << endl; }
inline void no(){ cout << "no" << endl; }
inline void No(){ cout << "No" << endl; }
inline void NO(){ cout << "NO" << endl; }
inline void possible(){ cout << "possible" << endl; }
inline void Possible(){ cout << "Possible" << endl; }
inline void POSSIBLE(){ cout << "POSSIBLE" << endl; }
inline void impossible(){ cout << "impossible" << endl; }
inline void Impossible(){ cout << "Impossible" << endl; }
inline void IMPOSSIBLE(){ cout << "IMPOSSIBLE" << endl; }

#define REP(i,n) for(int i = 0; i < (n); i++)
#define RREP(i,n) for(int i = 1; i <= (n); i++)
#define DREP(i,n) for(int i = (n)-1; i >= 0; i--)
#define SREP(i,s,t) for(int i = s; i < t; i++)
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define PB push_back

/* monkukui 競技プログラミング用のテンプレート (ここまで)*/

int main(){
  
  lint n, t; cin >> n >> t;
  vector<lint> a(n);
  vector<lint> b(n);
  for(int i = 0; i < n; i++) cin >> a[i] >> b[i];
  vector<pair<lint, lint>> vec(n);
  for(int i = 0; i < n; i++) vec[i] = {a[i], b[i]};
  sort(ALL(vec));
  for(int i = 0; i < n; i++) { 
    a[i] = vec[i].first;
    b[i] = vec[i].second;
  }
  vector<vector<lint>> dp(n + 1, vector<lint> (3 * t + 5000, -1));
  dp[0][0] = 0;
  for(int i = 0; i < n; i++) {
    for(int j = 0; j < 3 * t + 5000; j++) {
      if(dp[i][j] == -1) continue;
      
      dp[i + 1][j] = max(dp[i + 1][j], dp[i][j]);
      if(j < t) dp[i + 1][j + a[i]] = max(dp[i + 1][j + a[i]], dp[i][j] + b[i]);

      /* dp[i + 1][j] = max(dp[i + 1][j], dp[i][j]);
      dp[i + 1][j + a[i]] = max(dp[i + 1][j + a[i]], dp[i][j] + b[i]); */
    }
  }


  lint ans = 0;
  for(int i = 0; i <= n; i++) for(int j = 0; j < 3 * t + 5000; j++) ans = max(ans, dp[i][j]);
  cout << ans << endl;
   
  return 0;
}


Measured memory_bytes: 328832
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner kb = new Scanner( System.in);	
		
		while( true ) {
			int H = kb.nextInt();
			int W = kb.nextInt();
			
			if( 0==W && 0==H ) { break; }
			
			boolean cPattern=true;
			for( int i=0; i<H; i++ ) {
				cPattern= (0==(i%2))? true: false;
				for( int j=0; j<W; j++ ) {
					if( cPattern ) {
						System.out.print( "#" );
						cPattern=!cPattern;
					} else {
						System.out.print( "." );
						cPattern=!cPattern;
					}
				}
				System.out.print( "\n" );
			}
			System.out.print( "\n" );
		}
	}
}

Measured memory_bytes: 31952
#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, X;
  cin >> N >> X;
  vector<int> v;
  rep(i,N){
    int a;
    cin >> a;
    v.push_back(a);
  }

  int ret = 1;
  ll now = 0;
  rep(i,N){
    now += v[i];
    if(now <= X) ret++;
  }

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


Measured memory_bytes: 256
// 200219.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>

using namespace std;

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

    bool is_approved = true;
    for (int i = 0; i < N; i++) {
        if (A[i] % 2 == 0) {
            if (A[i] % 3 != 0 && A[i] % 5 != 0) {
                is_approved = false;
                break;
            }
        }
    }
    
    if (is_approved) {
        cout << "APPROVED" << endl;
    }
    else {
        cout << "DENIED" << endl;
    }
}

// プログラムの実行: Ctrl + F5 または [デバッグ] > [デバッグなしで開始] メニュー
// プログラムのデバッグ: F5 または [デバッグ] > [デバッグの開始] メニュー

// 作業を開始するためのヒント: 
//    1. ソリューション エクスプローラー ウィンドウを使用してファイルを追加/管理します 
//   2. チーム エクスプローラー ウィンドウを使用してソース管理に接続します
//   3. 出力ウィンドウを使用して、ビルド出力とその他のメッセージを表示します
//   4. エラー一覧ウィンドウを使用してエラーを表示します
//   5. [プロジェクト] > [新しい項目の追加] と移動して新しいコード ファイルを作成するか、[プロジェクト] > [既存の項目の追加] と移動して既存のコード ファイルをプロジェクトに追加します
//   6. 後ほどこのプロジェクトを再び開く場合、[ファイル] > [開く] > [プロジェクト] と移動して .sln ファイルを選択します


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

#define ll long long
#define pb push_back
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}


int main(){
    IOS;
    int r;
    cin >> r;
    cout << pow(r, 2) << endl;

    return 0;
}



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

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll N, A, B;
    cin >> N >> A >> B;

    ll sum_max = A + B * (N-1);
    ll sum_min = A * (N-1) + B;
    cout << max(0LL, sum_max - sum_min + 1) << endl;

    return 0;
}


Measured memory_bytes: 3584
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;

int main()
{
    int N, M;
    cin >> N >> M;
    cout << ((N * (N - 1)) / 2) + ((M * (M - 1)) / 2) << endl;
    return 0;
}


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

void merge(long long arr[], long long arr2[], long l, long m, long r)
{
    long i, j, k;
    long n1 = m - l + 1;
    long n2 =  r - m;

    /* create temp arrays */
    long L[n1], R[n2], L2[n1], R2[n2];

    /* Copy data to temp arrays L[] and R[] */
    for (i = 0; i < n1; i++){
        L[i] = arr[l + i];
        L2[i] = arr2[l + i];
    }
    for (j = 0; j < n2; j++){
        R[j] = arr[m + 1 + j];
        R2[j] = arr2[m + 1 + j];
    }

    /* Merge the temp arrays back into arr[l..r]*/
    i = 0; // Initial index of first subarray
    j = 0; // Initial index of second subarray
    k = l; // Initial index of merged subarray
    while (i < n1 && j < n2)
    {
        if (L2[i] <= R2[j])
        {
            arr[k] = L[i];
            arr2[k] = L2[i];
            i++;
        }
        else
        {
            arr[k] = R[j];
            arr2[k] = R2[j];
            j++;
        }
        k++;
    }

    /* Copy the remaining elements of L[], if there
       are any */
    while (i < n1)
    {
        arr[k] = L[i];
        arr2[k] = L2[i];
        i++;
        k++;
    }

    /* Copy the remaining elements of R[], if there
       are any */
    while (j < n2)
    {
        arr[k] = R[j];
        arr2[k] = R2[j];
        j++;
        k++;
    }
}

/* l is for left index and r is right index of the
   sub-array of arr to be sorted */
void mergeSort(long long arr[], long long comp[], long l, long r)
{
    if (l < r)
    {
        // Same as (l+r)/2, but avoids overflow for
        // large l and h
        long m = l+(r-l)/2;

        // Sort first and second halves
        mergeSort(arr, comp, l, m);
        mergeSort(arr, comp, m+1, r);

        merge(arr, comp, l, m, r);
    }
}

int main() {
    long n, m;
    long long a[100010], b[100010];
    cin >> n >> m;
    for (int i = 0; i < n; ++i) cin >> a[i] >> b[i];

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

    long m2 = 0;
    long long ans = 0;
    for (int i = 0; i < n; ++i) {
        if(b[i] >= (m - m2)) {
            ans += a[i]*(m - m2);
            m2 += (m - m2);
        } else {
            ans += a[i]*b[i];
            m2 += b[i];
        }

        if(m2 == m) break;
    }
    cout << ans;

    return 0;
}


Measured memory_bytes: 3328
#include<iostream>
#include<cstring>
#include<algorithm>
#include<vector>
#include<cmath>
#include<queue>
#include<string>
#include<stack>
#include<limits>
#include<map>
#define ll long long
#define ALL(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define int_INF 2147483647
#define ll_INF 	9223372036854775807
const static ll MOD = 1e9 + 7;
#define vi vector<int>
#define vvi vector<vector<int>>
#define vll vector<long long>
#define pii pair<int,int>
#define vpii vector<pair<int,int>>
using namespace std;

string solve(ll K) {
	vector<vector<vector<string>>> vec(10, vector<vector<string>>(10));
	int cnt = 0;
	vec[0][0].push_back(to_string(0));
	for (int i = 1; i < 10; i++) {
		vec[0][i].push_back(to_string(i));
		cnt++;
		if (cnt == K) {
			return to_string(i);
		}
	}

	for (int i = 1; i < 10; i++) {
		for (int j = 0; j < 10; j++) {
			if (j == 0) {
				for (int k = 0; k < vec[i - 1][j].size(); k++) {
					string temp = to_string(j) + vec[i - 1][j][k];
					vec[i][j].push_back(temp);
				}
				for (int k = 0; k < vec[i - 1][j + 1].size(); k++) {
					string temp = to_string(j) + vec[i - 1][j+1][k];
					vec[i][j].push_back(temp);
				}
			}
			else if (j > 0 and j < 9) {
				for (int k = 0; k < vec[i - 1][j - 1].size(); k++) {
					string temp = to_string(j) + vec[i - 1][j-1][k];
					cnt++;
					if (cnt == K) {
						return temp;
					}
					vec[i][j].push_back(temp);
				}
				for (int k = 0; k < vec[i - 1][j].size(); k++) {
					string temp = to_string(j) + vec[i - 1][j][k];
					cnt++;
					if (cnt == K) {
						return temp;
					}
					vec[i][j].push_back(temp);
				}
				for (int k = 0; k < vec[i - 1][j + 1].size(); k++) {
					string temp = to_string(j) + vec[i - 1][j+1][k];
					cnt++;
					if (cnt == K) {
						return temp;
					}
					vec[i][j].push_back(temp);
				}
			}
			else {
				for (int k = 0; k < vec[i - 1][j - 1].size(); k++) {
					string temp = to_string(j) + vec[i - 1][j-1][k];
					cnt++;
					if (cnt == K) {
						return temp;
					}
					vec[i][j].push_back(temp);
				}
				for (int k = 0; k < vec[i - 1][j].size(); k++) {
					string temp = to_string(j) + vec[i - 1][j][k];
					cnt++;
					if (cnt == K) {
						return temp;
					}
					vec[i][j].push_back(temp);
				}
			}
		}
	}
}
int main() {
	ll K; cin >> K;
	string ans = solve(K);

	cout << ans << endl;
}


Measured memory_bytes: 6272
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;

template<typename T>
void print(const vector<T> &x) {
    int n = x.size();
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x) {
    int n = x.size();
    rep(i,n) {
        rep(j,x[i].size()) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

template<typename T>
void print(const vector<T> &x, int n) {
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x, int n, int m) {
    rep(i,n) {
        rep(j,m) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

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

void input_init() {
    cin.tie(0); ios::sync_with_stdio(false);
}

int main(int argc, char const *argv[]) {
    int h,w,m; cin>>h>>w>>m;
    vector<ll> a(m), b(m);
    map<ll, ll> my, mx;
    set<P> st;
    rep(i,m) {
        cin>>a[i]>>b[i];
        st.emplace(a[i],b[i]);
        my[a[i]]++; mx[b[i]]++;
    }

    ll Y = 0; ll X = 0;
    for (auto &&e: my) chmax(Y, e.second);
    for (auto &&e: mx) chmax(X, e.second);

    vector<ll> cx,cy;
    for (auto &&e: my) if (e.second==Y) cy.push_back(e.first);
    for (auto &&e: mx) if (e.second==X) cx.push_back(e.first);

    ll ans = 0;
    rep(i,cy.size()) {
        rep(j,cx.size()) {
            if (st.count(make_pair(cy[i], cx[j]))) {
                chmax(ans, X+Y-1);
            }
            else {
                chmax(ans, X+Y);
                cout << ans << '\n';
                return 0;
            }
        }
    }

    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 72560
N, A, B = map(int, input().split())
S = 0
for i in range(1, N+1):
    sum = 0
    for j in range(len(str(i))):
        if sum > B:
            break
        sum += int(str(i)[j])
    if sum >= A and sum <= B:
        S += i
print(S)

Measured memory_bytes: 2940
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;

int main() {
    int n, d;
    cin >> n >> d;
    int p = 1+2*d;
    int q = 0;
    if(n%p == 0) {
        //
    }
    else {
        q = 1;
    }
    cout << n/p + q << endl;


    return 0;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(500000)

def gcd(a, b):
	# while b:
	# 	a, b = b, a % b
	# return a

	if b:
		return gcd(b, a % b)
	else:
		return a

def gcd_list(li):
	if len(li) > 2:
		x = gcd(li[-1], li[-2])
		li = li[:-2] + [x]
		return gcd_list(li)
	else:
		return gcd(li[0], li[1])

N, X = map(int, input().split())

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

li = [abs(i - X) for i in x]

# li = [i for i in li if i]
# li = sorted(li)
if len(li) == 1:
	print(li[0])
else:
	ans = li[0]
	for i in range(1,N):
		ans = gcd(ans, li[i])
	print(ans)


Measured memory_bytes: 14480
#include<bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
using namespace std;

//ループマクロ
#define FOR(i , a , b)  for(int i = (a) ; i < (b) ; i++)
#define REP(i , n)      for(int i = 0 ; i < n ; i++)
#define REPR(i , n)     for(int i = n ; 0 <= i ; i--)
#define ROP(i, n)       for(int i = 1 ; i <= n ; i++)

//入出力
#define SCOUT(x) cout << (x) << " "
#define VECCIN(x) for(auto& ele : (x) ) cin >> ele
#define VECOUT(x) for(auto& ele : (x) ) cout << ele << " "; cout << endl;

//その他
#define ALL(obj) (obj).begin() , (obj).end() 
#define SORT(obj) sort(ALL(obj))
#define GSORT(obj) sort(ALL(obj) , greater<int>())
#define P pair<int , int>
#define V vector<int>
#define VLL vector<long long>
#define M map<int, int>
#define S set<int>
#define PQ priority_queue<int>
#define PQG priority_queue<int , V , greater<int>>

int main(void) {

	ios::sync_with_stdio(false);	cin.tie(0);
    int N;  cin >> N;
    if(N % 10 == 0 || N % 10 == 1 || N % 10 == 6 || N % 10 == 8)
      cout << "pon" << endl;
    else if(N % 10 == 3)
      cout << "bon" << endl;
    else
      cout << "hon" << endl;
    return 0;
}


Measured memory_bytes: 3652
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
	Scanner scan = new Scanner(System.in);

	long N = scan.nextLong();
	int F = -1;
	for(int i = 1; i <= Math.sqrt(N); i++){
	    if(N % i == 0){
		F = String.valueOf(N/i).length();
	    }
	}

	System.out.println(F);
    }
}


Measured memory_bytes: 21844
import collections
def main():
    H, W = map(int, input().split())
    grid = []
    for _ in range(H):
        grid.append(input())

    rows = []
    rows_val = dict()
    id = 0
    for i in range(H):
        count = 0
        temp = []
        id += 1
        for j in range(W):
            if grid[i][j] == "#":
                if count > 0:
                    rows_val[id] = count
                count = 0
                id += 1
                temp.append(None)
            else:
                temp.append(id)
                count += 1
        if count > 0:
            rows_val[id] = count
        rows.append(temp)
    # print(rows)

    cols = []
    cols_val = dict()
    id = 0
    for j in range(W):
        count = 0
        temp = []
        id += 1
        for i in range(H):
            if grid[i][j] == "#":
                if count > 0:
                    cols_val[id] = count
                count = 0
                id += 1
                temp.append(None)
            else:
                count += 1
                temp.append(id)
        if count > 0:
            cols_val[id] = count
        cols.append(temp)

    max_v = 0
    for i in range(H):
        for j in range(W):
            if grid[i][j] == ".":
                v = rows_val[rows[i][j]]
                v += cols_val[cols[j][i]] - 1 # -1 for overlap
                max_v = max(max_v, v)
    return max_v


if __name__ == '__main__':
    print(main())

Measured memory_bytes: 303988
#ifndef ONLINE_JUDGE
    #include "debug.cpp"
#endif

#include <bits/stdc++.h>

using namespace std;

#define int long long
#define ar array
const int mxN = (int)1e7;

// stores smallest prime factor for every number 
int spf[mxN]; 
  
// Calculating SPF (Smallest Prime Factor) for every 
// number till MAXN. 
// Time Complexity : O(nloglogn) 
void sieve() 
{ 
    spf[1] = 1; 
    for (int i=2; i<mxN; i++) 
  
        // marking smallest prime factor for every 
        // number to be itself. 
        spf[i] = i; 
  
    // separately marking spf for every even 
    // number as 2 
    for (int i=4; i<mxN; i+=2) 
        spf[i] = 2; 
  
    for (int i=3; i*i<mxN; i++) 
    { 
        // checking if i is prime 
        if (spf[i] == i) 
        { 
            // marking SPF for all numbers divisible by i 
            for (int j=i*i; j<mxN; j+=i) 
  
                // marking spf[j] if it is not  
                // previously marked 
                if (spf[j]==j) 
                    spf[j] = i; 
        } 
    } 
} 
  
// A O(log n) function returning primefactorization 
// by dividing by smallest prime factor at every step 
set<int> getFactorization(int x) 
{ 
    set<int> ret; 
    while (x != 1) 
    { 
        ret.insert(spf[x]); 
        x = x / spf[x]; 
    } 
    return ret; 
} 
  

void solve(){
	sieve();
	int n;
	cin >> n;
	vector<int> arr(n,0);
	for(auto& e : arr) cin >> e;
	vector<int> freq(mxN,0);
	bool ans = 1;
	for(auto& e : arr){
		set<int> fact = getFactorization(e);
		for(auto itr : fact){
			if(freq[itr] >= 1) {
				ans = 0;
				break;
			}else{
				freq[itr] = 1;
			}
		}
		if(!ans) break;
	}
	if(ans == 1){
		cout << "pairwise coprime\n";
		return;
	}
	int gcd = arr[0];
	for(int i = 1;i < n; i++){
		gcd = __gcd(gcd,arr[i]);
	}
	if(gcd==1) cout << "setwise coprime\n";
	else cout << "not coprime\n";
	
}

int32_t main()
{
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    int TC = 1;
    //cin>>TC;
    while(TC--)
        solve();        
    
    return 0;
}



Measured memory_bytes: 167376
#include <bits/stdc++.h>
#define REP(i,a,b) for(int i=(a);i<(b);i++)
#define RREP(i,a,b) for(int i=(a);i>=(b);i--)
#define pq priority_queue
#define P pair<int,int>
#define P2 pair<int,P>
#define P3 pair<int,P2>
typedef long long ll; typedef long double ld;
using namespace std;
const int INF=1e9, MOD=1e9+7, around[]={0,1,1,-1,-1,0,-1,1,0,0};
const ll LINF=1e18;
const ld PI=abs(acos(-1));
int n,a[100010],b[100010],c[100010];

int main(){
	cin >> n; a[0]=b[0]=c[0]=0;
	REP(i,1,n+1) cin >> a[i] >> b[i] >> c[i];
	
	REP(i,0,n){
		if(abs(b[i+1]-b[i])<=a[i+1]-a[i] and abs(c[i+1]-c[i])<=a[i+1]-a[i]){
			if(abs(b[i+1]-b[i])+abs(c[i+1]-c[i])<=a[i+1]-a[i]){
				if((abs(b[i+1]-b[i])+abs(c[i+1]-c[i]))%2==(a[i+1]-a[i])%2){
					continue;
				}
				else{cout << "No" << endl; return 0;}
			}
			else{cout << "No" << endl; return 0;}
		}
		else{cout << "No" << endl; return 0;}
	}
	
	cout << "Yes" << endl;
	return 0;
}


Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
int n, m, ans;
int fact(int n)
{
    if(n < 2) return 0;
    return n * (n-1) / 2;
}

int main ()
{
    cin >> n >> m;
    ans = fact(n) + fact(m);
    cout << ans << endl;
}


Measured memory_bytes: 256
program main
	implicit none
	integer(8) :: N, a(1:5), ans
	integer :: i, temp
	read(*, *) N
	do i = 1, 5
		read(*, *) a(i)
	end do
	
	temp = 1
	do i = 2, 5
		if(a(temp) > a(i)) then
			temp = i
		end if
	end do
	ans = 4
	if(mod(N, a(temp)) == 0) then
		ans = ans + N
	else
		ans = ans + N/a(temp) + 1
	end if
	

	write(*, *) ans 

end program main

Measured memory_bytes: 256
use std::vec::Vec;
use std::collections::VecDeque;

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>().split_whitespace().map(|e| e.parse().ok().unwrap()).collect()
}


fn bfs(n: usize, root: usize, to: &Vec<Vec<(usize, i64)>>) -> Vec<i64> {
  // n is number of node
  // root is start node
  // res is legth of root
  let mut res = vec![-1; n];

  let mut q: VecDeque<usize> = VecDeque::new();
  q.push_back(root);
  res[root] = 0;

  while !q.is_empty() {
    let a: usize = match q.pop_front() {
      Some(i) => i,
      None => 1,
    };
    // 参照外しをやるとREになる
    // ヒープ上に確保してメモリを圧迫する？
    for e in &to[a] {
      if res[(*e).0] != -1 {
        continue;
      }
      else {
        res[(*e).0] = (res[a] + (*e).1) % 2;
        q.push_back((*e).0);
      }
    }
  }
  return res;
}


fn main() {
    let n: usize = read();
    let mut to: Vec<Vec<(usize, i64)>> = vec![Vec::new(); n];
    for _ in 0..n-1 {
      let a: Vec<usize> = read_vec();
      to[a[0] - 1].push((a[1] - 1, a[2] as i64));
      to[a[1] - 1].push((a[0] - 1, a[2] as i64));
    }

    let v: Vec<i64> = bfs(n, 0, &to);
    for &e in &v {
      println!("{}", e);
    }
}


Measured memory_bytes: 14716
import numpy as np

lst = [[int(i) for i in input().split()] for _ in range(3)]
arr = np.array(lst)
if len(set(arr[1,:] - arr[0,:])) == 1 and len(set(arr[2,:] - arr[0,:])) == 1:
  print('Yes')
else:
  print('No')

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

int main(){
  string s,t;
  cin >> s >> t;
  int count=0;
  rep(i,s.size()){
    if(s[i]!=t[i]) count++;
  }
  cout << count << endl;
  return 0;
}

Measured memory_bytes: 3912
w = input()
cnt = 0
while True:
    str = input()
    if str == 'END_OF_TEXT':
        break
    str = str.lower()
    lst = str.split()

    #print(str)
    #print(lst)

    for i in range(len(lst)):
        if w == lst[i]:
            cnt += 1

print(cnt)


Measured memory_bytes: 5556
#include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>
using namespace std;
int gcd(int a, int b) {
    if (a < b) {
        int t = a;
        a = b;
        b = t;
    }
    int r = a % b;
    while (r != 0) {
        a = b;
        b = r;
        r = a % b;
    }
    return b;
}

int main() {
    int N, x;
    vector<int> v;
    cin >> N;
    for (int i = 0; i <= N; ++i) {
        cin >> x;
        v.push_back(x);
    }
    sort(v.begin(), v.end());
    if (N == 1) {
        cout << v[1] - v[0] << endl;
        return 0;
    }
    int res = gcd(v[1] - v[0], v[2] - v[1]);
    for (int i = 2; i < N; ++i) {
        res = gcd(res, v[i + 1] - v[i]);
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 892
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main(){
  ll N; cin>>N;
  map<string,bool> M;
  ll ans=0;
  for(int i=0; i<N; i++){
    string s; cin>>s;
    if(M[s]==false) ans++;
    M[s]=true;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 19148
let s = read_line ()
let t = read_line ()
let fs, ts = Array.(make 26 ~-1, make 26 ~-1)
let g c = Char.(code c - code 'a')
let f i c = let a, b = g c, g t.[i] in
  if fs.(a) <> -1 || ts.(b) <> -1 then if fs.(a) <> b || ts.(b) <> a then (print_endline "No"; exit 0); fs.(a) <- b; ts.(b) <- a
let _ = String.iteri f s; print_endline "Yes"

Measured memory_bytes: 4736
#include <bits/stdc++.h>
using namespace std;
const long long mod = pow(10, 9) + 7;
const long long INF = 1LL << 60;
template <class T> bool chmin(T& a, T b){if (a > b) {a = b; return true;} return false;}
template <class T> bool chmax(T& a, T b){if (a < b) {a = b; return true;} return false;}
int divCeil(int A, int B) {return (A + (B - 1)) / B;}
long long divCeil(long long A, int B) {return (A + (B - 1)) / B;}
long long divCeil(int A, long long B) {return (A + (B - 1)) / B;}
long long divCeil(long long A, long long B) {return (A + (B - 1)) / B;}

int main()
{
  vector<int> N(4);
  for (int i = 0; i < 4; i++) cin >> N.at(i);
  
  int a = 0, b = 0, c = 0, d = 0;
  
  for (int i = 0; i < 4; i++)
  {
    if (N.at(i) == 1) a++;
    else if (N.at(i) == 9) b++;
    else if (N.at(i) == 7) c++;
    else if (N.at(i) == 4) d++;
  }
  
  string ans = "NO";
  if (a == b && b == c && c == d && d == 1) ans = "YES";
  
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    int N;
    cin>>N;
    vector<vector<int>>v;
    int x,y,h;
    int spx,spy,sph;
    for(int i=0;i<N;i++){
        cin>>x>>y>>h;
        v.push_back({x,y,h});
        if(h!=0){
            spx=x;
            spy=y;
            sph=h;
        }
    }
    int high;
    for(int i=0;i<101;i++){
        for(int j=0;j<101;j++){
            high=sph+abs(i-spx)+abs(j-spy);
            bool flag=true;
            for(int k=0;k<N;k++){
                if(max(high-abs(v[k][0]-i)-abs(v[k][1]-j),0)!=v[k][2]){flag=false;break;}
            }
            if(flag==true){
                cout<<i<<" "<<j<<" "<<high<<endl;
                exit(0);
            }
        }
    }
}

Measured memory_bytes: 256
bingo=[list(input().split()) for i in range(3)]
n=int(input())
ans=[[0,0,0],[0,0,0],[0,0,0]]
for i in range(n):
    a=input()
    for j in range(3):
        for k,l in enumerate(bingo[j]):
            if a==l:
                ans[j][k]=1 
if (ans[0][0]==1 and ans[0][1]==1 and ans[0][2]==1) or (ans[1][0]==1 and ans[1][1]==1 and ans[1][2]==1) or (ans[2][0]==1 and ans[2][1]==1 and ans[2][2]==1) or (ans[0][0]==1 and ans[1][0]==1 and ans[2][0]==1) or (ans[0][1]==1 and ans[1][1]==1 and ans[2][1]==1) or (ans[0][2]==1 and ans[1][2]==1 and ans[2][2]==1) or (ans[0][0]==1 and ans[1][1]==1 and ans[2][2]==1) or (ans[0][2]==1 and ans[1][1]==1 and ans[2][0]==1):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
#include<iostream>

using namespace std;

int main(){

	int n, m, A[100][100], b[100], c[100];

	cin >> n >> m;

	for ( int i = 0; i < n; i++ )

		for ( int j = 0; j < m; j ++ ) cin >> A [i][j];

	for ( int i = 0; i< m; i++ ) cin >> b[i];


	for ( int i = 0; i < n; i++ ){

		c[i] = 0;

		for ( int j = 0; j < m; j++ ){

			c[i] += A[i][j]*b[j];

		}

	}

	for ( int i = 0; i < n; i++ ) cout << c[i] << endl;

	return 0;

}

Measured memory_bytes: 1200
#include <bits/stdc++.h>
using namespace std;
string s;
int l;
int main()
{
    cin>>s;
    l=s.size();
    for(register int i=0;i<l;i++)
    {
        if(s[i]=='C')
        {
            for(register int j=i+1;j<l;j++)
            {
                if(s[j]=='F')
                {
                    cout<<"Yes";
                    return 0;
                }
            }
        }
    }
    cout<<"No";
    return 0;
}

Measured memory_bytes: 256
/*   ꧁༒☬महाकाल☬༒꧂ ꧁༒ঔमहाकालঔ༒꧂
                   
                   ঔৣ۝महाकालᴳᵒᵈ۝ঔৣ            
 
 */ 
#include<bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//template <typename T, typename cmp=less<T>> using oset =tree<T, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
#define ll long long 
#define mod 1000000007
#define inf 100000000000000000
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define _it iterator
#define all(_x) _x.begin(),_x.end()
#define f first
#define s second
#define pb push_back
void mahakal(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	freopen("error.txt","w",stderr);
	#endif
}
int main(){
	//mahakal(),fast;
	
	ll n ;
	cin>> n ;
	ll sum=0;
	for(ll i=1;i<=n ;i++){
		if(i%3==0 || i%5==0){}
		else sum+=i;
	}

	cout<<sum<<endl;
	return 0;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
int a,b,c,lh;
int main()
{
   cin>>a>>b;
    c=b;
    while(c>0)
    {
        c/=10;
        lh++;
    }
    a=a*pow(10,lh)+b;
    if(sqrt(a)==floor(sqrt(a))) cout<<"Yes";
    else cout<<"No";
}

Measured memory_bytes: 256
<?php
$n=trim(fgets(STDIN));
$a=explode(" ",trim(fgets(STDIN)));
$ans=$a[0];
$i=0;
while($i<$n){
  $ans=gcd($ans,$a[$i]);
  ++$i;
}
echo $ans;
function gcd($a,$b) {
    return ($a % $b) ? gcd($b,$a % $b) : $b;
}


Measured memory_bytes: 12920
#include<cstdio>

int main() {
    int n;
    scanf("%d",&n);
    int a[n];
    for(int i = 0;i < n;i++) {
        scanf("%d",&a[i]);
    }
    for(int i = n - 1;i >= 0;i--) {
        if(i <= n - 1 && i > 0) {
        printf("%d ",a[i]);
        }
        if(i == 0) {
            printf("%d\n",a[i]);
        }
    }
}


Measured memory_bytes: 2600
import bisect

N = int(input())
L = list(map(int, input().split()))
L.sort()
L2 = L[::-1]
ans = 0
for i in range(N):
    long = L2[i]
    for j in range(i + 1, N):
        d = long - L2[j]
        ans += max(N - 1 - j - bisect.bisect_right(L[:N - j], d), 0)

print(ans)


Measured memory_bytes: 51932
N = int(input())
P = list(map(int,input().split()))
cnt = 0
for i in range(N-1):
  if P[i] == i+1:
    P[i],P[i+1] = P[i+1],P[i]
    cnt += 1
if P[-1] == N:
  cnt += 1
print(cnt)

Measured memory_bytes: 14008
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;

#define ll long long
const long long llINF = 1LL << 60;
const int iINF = 0x20000000;
template<class T> inline bool chmin(T& a, T b) { if (b < a) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

void execute();
int main() 
{
    cin.tie(nullptr);
    ios::sync_with_stdio(false);// cin と scanfの併用禁止
    cout << fixed << setprecision(15);
    execute();
    return 0;
}


void execute()
{
    int K;
    cin >> K;

    string S;
    cin >> S;

    if(S.size() <= K){
        cout << S << endl;
        return;
    }

    cout << S.substr(0, K) << "..." << endl;
}


Measured memory_bytes: 3644
#include <algorithm>
#include <bitset>
#include <boost/dynamic_bitset.hpp>
#include <cfloat>
#include <cmath>
#include <ctime>
#include <deque>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <typeindex>
#include <typeinfo>
#include <vector>

#define DEBUG(x) cout << #x << ": " << x << endl
#define INFILE() freopen("input.txt", "r", stdin)
#define REP(i, a, b) for (int i = a; i < b; i++)
#define ALL(s) begin(s), end(s)
#define RALL(s) rbegin(s), rend(s)

using namespace std;

using ll = long long;
using ull = unsigned long long;
using i_i = pair<int, int>;
using ll_i = pair<ll, int>;
using i_ll = pair<int, ll>;
using d_i = pair<double, int>;
using ll_ll = pair<ll, ll>;
using d_d = pair<double, double>;

static constexpr ll LL_MOD = 1000000009;
static constexpr int I_MOD = 1000000007;
static constexpr double EPS = numeric_limits<double>::epsilon();
static constexpr double PI = 3.14159265358979323846264338327950288;

template <class T> static void scan(vector<T> &v);
static void scan(vector<string> &v, bool isWord = true);
static boost::dynamic_bitset<> scan(char trueValue = 'o');

int main(int argc, char *argv[]) {
  // INFILE();
	int sx, sy, tx, ty;
	cin >> sx >> sy >> tx >> ty;

	cout << string(tx - sx, 'R') << string(ty - sy, 'U');
	cout << string(tx - sx, 'L') << string(ty - sy, 'D');
	cout << "L" << string(ty - sy + 1, 'U') << string(tx - sx + 1, 'R') << "D";
	cout << "R" << string(ty - sy + 1, 'D') << string(tx - sx + 1, 'L') << "U" << "\n";
  return 0;
}

template <class T> static void scan(vector<T> &v) {
  map<type_index, const char *const> m = {{typeid(int), "%d"},
                                          {typeid(ll), "%lld"},
                                          {typeid(double), "%lf"},
                                          {typeid(char), "%c"}};

  auto tFormat = m[typeid(T)];

  for (T &n : v) {
    scanf(tFormat, &n);
  }
}

static void scan(vector<string> &v, bool isWord) {
  if (isWord) {
    for (auto &n : v) {
      cin >> n;
    }
    return;
  }

  int i = 0, size = v.size();
  string s;
  getline(cin, s);

  if (s.size() != 0) {
    i++;
    v[0] = s;
  }

  for (; i < size; ++i) {
    getline(cin, v[i]);
  }
}

static boost::dynamic_bitset<> scan(char trueValue) {
  string s;
  getline(cin, s);

  if (s.size() == 0) {
    getline(cin, s);
  }

  for_each(begin(s), end(s),
           [trueValue](char &c) { c = (c == trueValue) ? '1' : '0'; });
  return boost::dynamic_bitset<>(string(rbegin(s), rend(s)));
}


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

int main(void){
    int a,p;
    scanf("%d%d",&a,&p);
    printf("%d\n",((a*3)+p)/2);    
    return 0;   
}

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

using namespace std;

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  
  constexpr int64_t INF{1'00'000'000'000};
  int N, W;
  cin >> N >> W;
  vector<int> w(N), v(N);
  int V{};
  for(int i = 0; i < N; ++i)
  {
    cin >> w[i] >> v[i];
    V += v[i];
  }
  vector<int64_t> dp(V + 1, INF);
  dp[0] = 0;
  for(int i = 0; i < N; ++i)
  {
    for(int j = V; j >= v[i]; --j)
    {
      dp[j] = min(dp[j], dp[j - v[i]] + w[i]);
    }
  }
  
  int res{};
  
  for(int i = 0; i <= V; ++i)
  {
    if(dp[i] <= W)
    {
      res = max(res, i);
    }
  }
  
  cout << res << "\n";
  
  return 0;
}

Measured memory_bytes: 1024
# E - Max GCD ★

def slvDivisor(summary):
    divisor = set()
    for d in range(1, int(summary ** 0.5) + 1):
        if summary % d == 0:
            divisor.add(d)
            divisor.add(summary // d)
    return divisor



input1 = list(map(int, input().split()))
n = input1[0]
k = input1[1]
a = list(map(int, input().split()))

# 和の約数を求める
sumA = sum(a)
divisor = slvDivisor(sumA)

# 各値を約数で割った際の余りも約数の整数倍（i倍とする）になるはず
# → ＋－する操作はその余りを他の値に移動して約数を作る操作になる
# → 余りが小さい値から大きい値へ余りを寄せていくのが効率的
# → 寄せきると約数 * i個、0 * (N - i)個の2ブロックに分かれる
# → 寄せきるまでの回数がk以下ならOK
for d in sorted(divisor, reverse=True):
    modA = [x % d for x in a]
    modA.sort()
    i = sum(modA) // d
    cnt = sum(modA[:-i])
    if cnt <= k:
        print(d)
        break

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

#define forn(i,n) for(int i=0;i<(int)(n);i++)
#define si(c) ((int)(c).size())
#define forsn(i,s,n) for(int i = (int)(s); i<((int)n); i++)
#define dforsn(i,s,n) for(int i = (int)(n)-1; i>=((int)s); i--)
#define all(c) (c).begin(), (c).end()
#define D(a) cerr << #a << "=" << a << endl;
#define pb push_back
#define eb emplace_back
#define mp make_pair

#ifdef LOCAL
#define i64 "%lld"
#else
#define i64 "%I64d"
#endif

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

const int N = 1e5 + 10;

int n, k, p[N];
vi adj[N];

int res;
int dfs(int u) {
    int dep = 0;
    for (int v : adj[u]) dep = max(dep, dfs(v));
    dep++;
    if (p[u] != 0 && dep == k) {
        res++;
        //D(u+1);
        return 0;
    }
    return dep;
}

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

    cin >> n >> k;
    res = 0;
    forn(i,n) {
        cin >> p[i];
        p[i]--;
    }
    if (p[0] != 0) {
        p[0] = 0;
        res++;
    }
    forsn(i,1,n) adj[p[i]].pb(i);

    dfs(0);
    cout << res << endl;

    return 0;
}


Measured memory_bytes: 10752
package main

import (
  "fmt"
)

func main() {
  var a, b, c int
  
  fmt.Scanf("%d %d %d", &a, &b, &c)
  
  ans := "Impossible"
  if a % 3 == 0 {
    ans = "Possible"
  }
  if b % 3 == 0 {
    ans = "Possible"
  }
  if (a + b) % 3 == 0 {
    ans = "Possible"
  }
  fmt.Printf("%s", ans)
}

Measured memory_bytes: 1860
#include<iostream>
#include<fstream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>

using namespace std;
long long n,m;
int main()
{
	cin>>n>>m;
	cout<<(n+m+1)/2<<endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

/**
 * A - Password
 * 高橋君は 3桁のパスワードを設定しようとしています。
 *
 * 使える文字が 1 以上N 以下の数字のみであるとき、設定できるパスワードが全部で何種類であるかを答えてください。
 *
 * 制約
 * 1≤N≤9N
 * は整数である。
 */
public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner( System.in );
        int passNum = sc.nextInt();

        double result = Math.pow( passNum, 3 );
        System.out.println( ( int ) result );
    }
}

Measured memory_bytes: 21844
local a, b = io.read("*n", "*n")
if(1 < math.abs(a - b)) then print(0)
else
  local min = math.min(a, b)
  local ret = 1
  local mod = 1000000007
  for i = 2, min do
    ret = (ret * i) % mod
  end
  ret = (ret * ret) % mod
  if(a == b) then
    ret = (ret * 2) % mod
  else
    ret = (ret * (min + 1)) % mod
  end
  print(ret)
end


Measured memory_bytes: 1012
import math

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors

def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True

A, B = map(int, input().split())

cnt = 1
A_list = make_divisors(A)
B_list = make_divisors(B)

for a in A_list:
    if a in B_list:
        if is_prime(a):
            cnt += 1

print(cnt)


Measured memory_bytes: 3516
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, K = MAP()
H = LIST()
c = 0
for i in range(N):
    if K <= H[i]:
        c += 1

print(c)

Measured memory_bytes: 14076
#include <bits/stdc++.h>
using namespace std;
int n,a;
set<int> s;
int main()
{
  scanf("%d",&n);
  for(int i=0;i<n;++i)
  {
    scanf("%d",&a);
    s.insert(a);
  }
  if(s.size()==n) printf("YES");
  else printf("NO");
  return 0;
}

Measured memory_bytes: 9600
#include <stdio.h>
int main(void)
{

   int n,i,j,a[100];


	scanf("%d",&n);

 	 for(i=0;i<n;i++)
  	{
		scanf("%d",&a[i]);
	}

	for(j=n;j>0;j--)
  	{
		printf("%d",a[j-1]);

		if(j!=1)
		{
			printf(" ");
		}	
	}

	printf("\n");

	
	return 0;
	
} 

Measured memory_bytes: 600
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
using namespace std;
using Graph = vector<vector<int>>;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;

const double PI=acos(-1.0);

int N,M; vll H; vi A,B;
void input()
{
    cin>>N>>M;
    for(int i=0;i<N;++i){
        ll h; cin>>h; H.emplace_back(h);
    }
    for(int i=0;i<M;++i){
        int a,b; cin>>a>>b; 
        A.emplace_back(a); B.emplace_back(b);
    }
}

void solve()
{
    Graph G(N+1);
    for(int i=0;i<M;++i) {
        G[A[i]].push_back(B[i]);
        G[B[i]].push_back(A[i]);
    }

    int ans=0;
    for(int i=1;i<N+1;++i){
        ll height=H[i-1];
        bool flag=true;
        for(auto p: G[i]){
            if(height<=H[p-1]){
                flag=false; break;
            }
        }
        if(flag) ++ans;
    }
    cout<<ans<<endl;
}

int main()
{
    cin.tie();
    ios::sync_with_stdio(false);
    input();
    solve();
    return 0;
}

Measured memory_bytes: 10076
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <unordered_map>
#include <vector>

using namespace std;

// BEGIN NO SAD
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
typedef vector<int> vi;
// END NO SAD

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

int n, m;
int lhs[5005];
int rhs[5005];
int w[5005];

ll dp[5005];
const ll B = -1e18;
void solve() {
  int p;
  cin >> n >> m >> p;
  for(int i = 0; i < m; i++) {
    cin >> lhs[i] >> rhs[i] >> w[i];
    w[i] -= p;
  }
  for(int i = 2; i <= n; i++) dp[i] = B;
  for(int qq = 0; qq < 2*m; qq++) {
    for(int i = 0; i < m; i++) {
      if(dp[lhs[i]] == B) continue;
      if(dp[rhs[i]] < dp[lhs[i]] + w[i]) {
        dp[rhs[i]] = dp[lhs[i]] + w[i];
        if(qq >= m) dp[rhs[i]] = 1e18;
      }
    }
  }
  if(dp[n] >= 1e18) cout << "-1\n";
  else if(dp[n] < 0) cout << "0\n";
  else cout << dp[n] << "\n";
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);
  solve();
}


Measured memory_bytes: 512
#include <iostream>
#include <stdio.h>
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
#define N 100

int main(){
    long n;
    cin>>n;
    //体力が2**k乗のモンスターを倒すのに必要な手数
    long need[N];
    need[0]=1;
    for (int i=1; i<N; i++){
        need[i]=(need[i-1])*2+1;
    }
    
    //cout<<need[1]<<endl;
    long pp[N];
    pp[0]=1;
    for (int i=1; i<N; i++){
        pp[i]=pp[i-1]*2;
    }
    
    long q=0;
    while (true){
        if (pp[q]<=n && pp[q+1]>n){
            cout<<need[q]<<endl;
            break;
        }
        else q++;
    }
    
}

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

using namespace std;

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

    if (a % 2 == 0 || b % 2 == 0 || c % 2 == 0) {
        cout << 0 << endl;
    } else {
        cout << min({a * b, b * c, c * a}) << endl;
    }
    return 0;
}

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

#define get(a) scanf("%lld", &a);
#define print(a) printf("%lld",a)
#define println(a) printf("%lld\n",a)

#define do(a) for(long long i = 0; i < a; i++)
#define loop() for(;;) 
#define done return 0
long long n,ans;

int main() {
    get(n);
    ans = n*(n+1)/2;
    ans -= 3*(n/3)*(n/3+1)/2;
    ans -= 5*(n/5)*(n/5+1)/2;
    ans += 15*(n/15)*(n/15+1)/2;
    print(ans);
}

Measured memory_bytes: 3816
#include<iostream>
#include<algorithm>
#define INF 50000000
using namespace std;

int graf[110][110];
int s[110];
bool used[110];

void dijk(int st, int ve) {
	fill(s,s + ve, INF);
	fill(used, used + ve, false);
	s[st] = 0;

	while (1) {
		int v = -1;

		for (int i = 0;i < ve;i++) {
			if (!used[i] && (v == -1 || s[i] < s[v]))v = i;
		}
		if (v == -1)break;
		used[v] = true;

		for (int i = 0;i < ve; i++) {
			s[i] = min(s[i], s[v] + graf[v][i]);
		}
	}
	return;
}

int main() {
	int n, k;
	while (cin >> n >> k, n, k) {
		for (int i = 0;i < n;i++)
			for (int j = 0;j < n;j++)graf[i][j] = INF;

		for (int x = 0;x < k;x++) {
			int a;
			cin >> a;
			if (a == 1) {
				int b, c, d;
				cin >> b >> c >> d;
				if (graf[b - 1][c - 1] > d) {
					graf[b - 1][c - 1] = d;
					graf[c - 1][b - 1] = d;
				}
			}
			else {
				int b, c;
				cin >> b >> c;
				dijk(b-1, n);
				int f = s[c - 1];
				if (f == INF)cout <<"-1"<< endl;
				else cout << f << endl;
			}
}
	}
	return 0;
}

Measured memory_bytes: 3100
import sys
input = sys.stdin.readline

def matDot(A,B,MOD):
    N,M,L = len(A),len(A[0]),len(B[0])
    
    res = [[0]*L for i in range(N)]

    for i in range(N):
        for j in range(L):
            s = 0
            for k in range(M):
                s = (s + A[i][k]*B[k][j]) % MOD
            res[i][j] = s
    
    return res

def matPow(A,x,MOD):
    N = len(A)
    res = [[0]*N for i in range(N)]
    
    for i in range(N):
        res[i][i] = 1
    
    for i in range(x.bit_length()):
        if (x>>i) & 1:
            res = matDot(res,A,MOD)
        A = matDot(A,A,MOD)
    
    return res

n,k = map(int,input().split())
mod = 10**9+7

a = [list(map(int,input().split())) for i in range(n)]

b = matPow(a,k,mod)

ans = 0
for i in range(n):
    for j in range(n):
        ans = (ans+b[i][j])%mod

print(ans)

Measured memory_bytes: 41324
//yukicoder@cpp14
//author:luckYrat(twitter:@luckYrat_)
//<ここに一言>

//せんげん！
#include <iostream>

#include <cmath>
#include <algorithm>
#include <iomanip>

#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <bitset>

#include <cctype>
#include <utility>
#include <climits>


//なまえくーかん！
using namespace std;
using ll = long long;
using P = pair<ll,ll>;

//てーすう！
const int mod = 1000000007;
const int inf = (1<<30)-1;
const ll linf = (1LL<<62LL)-1;
const double EPS = (1e-10);

//でふぁいん！
#define anyfill(n,s) setw(n) << setfill(s)
#define loop(s) for(int i = 0; s > i; i++)
#define rep(i,q) for(int i = 0; (q) > i; i++)
#define repp(i,n,q) for(int i = n; (q) > i; i++)
#define dep(i,q) for(int i = (q); 0 < i; i--)

//みじかく！
#define pb push_back
#define fir first
#define scn second
#define ednl endl

//いぇすのー！
#define YesNo(a) (a?"Yes":"No")
#define YESNO(a) (a?"YES":"NO")
#define yesno(a) (a?"yes":"no")

//きんぼーnほーこー！！
P ar4[4] = {{0,1},{0,-1},{1,0},{-1,0}};
P ar8[8] = {{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,-1},{1,0},{1,1}};
/*
確認ポイント
cout << fixed << setprecision(n) << 小数計算//n桁の小数表記になる

計算量は変わらないが楽できるシリーズ
min(max)_element(iter,iter)で一番小さい(大きい)値のポインタが帰ってくる
count(iter,iter,int)でintがiterからiterの間にいくつあったかを取得できる
*/
template <typename T>
T gcd(T a,T b){
  if(a%b==0)return b;
  else return gcd(b,a%b);
}
template <typename T>
T lcm(T a,T b){
  return a/gcd(a,b)*b;
}
__attribute__((constructor))
void initial() {
 cin.tie(0);
 ios::sync_with_stdio(false);
}
int main(){
  int n;cin>>n;
	int a[n][3];
	int r[n];
	for(int i = 0; n > i; i++){
		r[i]=0;
	}
	for(int i = 0; n > i; i++){
		for(int j = 0; 3 > j; j++){
			cin>>a[i][j];
		}
	}
	for(int j = 0; 3 > j; j++){
		for(int i = 0; n > i; i++){
			bool ok = false;
			for(int k = 0; n > k; k++){
				if(i==k)continue;
				if(a[i][j]==a[k][j]){
					ok=true;
					break;
				}
			}
			if(!ok){
				r[i]+=a[i][j];
			}
		}
	}
	for(int i = 0; n > i; i++){
		cout << r[i] << endl;
	}
}


Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
int main(){
	string o,e;
	cin>>o>>e;
	int O=(o.size()),E=(e.size());
	for(int i=0;i<E;i++)cout<<o[i]<<e[i];
	if(O!=E)cout<<o[(O-1)]<<endl;
}



Measured memory_bytes: 256