akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <algorithm>
#include <numeric>
#include <random>
#include <vector>
#include <array>
#include <bitset>
#include <queue>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
 
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;

int main() {
   string s, a;
   cin >> s >> a;
   int g = 0;
   if(s[0] == a[0]){
       g++;
   }
   if(s[2] == a[2]){
       g++;
   }
   if(s[1] == a[1]){
       g++;
   }
   cout << g;
    return 0;
}

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


if K > (N-1)*(N-2)//2:
    print(-1)
    exit()

#辺の数出すの忘れてた
#条件を満たす組が最大の時、N-1本の辺があり、組が一つ減るたびに一本追加
print((N-1) + ((N-1)*(N-2)//2 - K))

for i in range(1,N):
    print(i,N)
#この時点で (N-1)*(N-2)//2個の条件を満たす組がある

cnt = 0
for i in range(1,N):
    
    for j in range(i+1,N):
        if (N-1)*(N-2)//2 - cnt == K: exit()
        print(i,j)
        cnt += 1
        

Measured memory_bytes: 3616
import java.util.*;
 
 public class Main {
     public static void main(String args[] ) throws Exception {
		 Scanner sc = new Scanner(System.in);

		 String[] arr = sc.nextLine().split(" ") ;

		 int H = Integer.valueOf ( arr[0]  ) ;
		 int N = Integer.valueOf ( arr[1]  ) ;
			
		 List<List<Integer>> list = new ArrayList<>() ;
		 for ( int i=0 ; i<N ; i++ ) {
			  arr = sc.nextLine().split(" ") ;
			 int a = Integer.valueOf ( arr[0]  ) ;
			 int b = Integer.valueOf ( arr[1]  ) ;
			 list.add ( Arrays.asList ( a, b ) ) ;
		 }

		 long[] arr0 = new long[H+1] ; 
		 for ( int x=1 ; x<=H ; x++ ) {
			 long v0 = -1 ; 
			 for ( List<Integer> ll : list ) {
				 long v =  -1 ; 
				if ( x - ll.get(0).intValue() <= 0 ) {
					v = ll.get(1).intValue() ;
				} else {
					v = ll.get(1).intValue() + arr0[ x - ll.get(0).intValue() ] ;
				}

				 if ( v0 == -1 ) {
					 v0 = v ;
				 } else {

					v0 = Math.min ( v0 , v ) ;
				 }
			 }
			 arr0[x] = v0 ;
		 }
		 System.out.println( arr0[H] ) ;
	 }
}

Measured memory_bytes: 27000
package main

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

var reader = bufio.NewReaderSize(os.Stdin, 1000000)
var writer = bufio.NewWriter(os.Stdout)
func NextLine() string {
  buffer := make([]byte, 0)
  for true {
    line, isPrefix, err := reader.ReadLine()
    if err != nil { panic(err) }
    buffer = append(buffer, line...)
    if !isPrefix { break }
  }
  return string(buffer)
}
func NextInt() int {
  n, _ := strconv.Atoi(NextLine())
  return n
}
func Write(s interface{}) {
  fmt.Fprintln(writer, s)
}
func WriteIntVec(A []int) {
  S := make([]string, len(A))
  for i, a := range A {
    S[i] = strconv.Itoa(a)
  }
  Write(strings.Join(S, " "))
}
func Output() {
  _ = writer.Flush()
}

func Solve(N int) int {
  if 0 < N % 2 { return 0 }
  ans := 0
  d := 1
  for k := 1; k < 19; k++ {
    d *= 10
    ans += N / d
    v := 1
    for j := 1; v *d < N; j++ { 
      v *= 5
      ans += (N / (v * d) + 1) / 2
    }
  }
  return ans
}

func main() {
  N := NextInt()
  Write(Solve(N))
  Output()
}

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

int nlist[110];
int dp[110][110];

int main(){
  int n;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>nlist[i]>>nlist[i+1];
  }
  for(int i=1;i<n;i++){
    for(int j=0;j<n-i;j++){
      dp[j][j+i]=1<<30;
      for(int k=0;k<i;k++){
	dp[j][j+i]=min(dp[j][j+i],dp[j][j+k]+dp[j+k+1][j+i]+nlist[j]*nlist[j+k+1]*nlist[j+i+1]);
      }
    }
  }
  cout<<dp[0][n-1]<<endl;
  return 0;
}

Measured memory_bytes: 1208
#include<cstdio>
#include<cstring>
#include<cmath>
#include<bitset>
#include<iostream>
#include<algorithm>
#include<string>
#include<utility>
#include<tuple>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<numeric>
#include<functional>
#include<iomanip>
#include<random>

#define IOS ios::sync_with_stdio(false),cin.tie(0)
#define REP(i,n) for(int i = 0;i < n;i++)
#define FOR(i,a,b) for(int i = a;i < b;i++)
#define MEM(a,b) memset(a,b,sizeof(a))
#define ALL(x) (x).begin(),(x).end()
#define LMAX 9223372036854775807
#define LMIN -9223372036854775808

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ull, ull> UP;
typedef tuple<int, int, int> T;

struct UnionFind {
	vector<int> data;
	UnionFind(int size) : data(size, -1) {}
	void unionSet(int x, int y) {
		x = root(x), y = root(y);
		if (x != y) {
			if (data[y] < data[x])swap(x, y);
			data[x] += data[y]; data[y] = x;
		}
	}
	bool findSet(int x, int y) {
		return root(x) == root(y);
	}
	int root(int x) {
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	int size(int x) {
		return -data[root(x)];
	}
};

ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	int k = a % b;
	if (k == 1)return 1;
	if (k == 0)return b;
	int ans = gcd(b, k);
	return ans;
}
ll digisum(ll a) {
	int sum = 0;
	while (a) {
		sum += a % 10;
		a /= 10;
	}
	return sum;
}
ll countpow(ll a, ll b) {
	int ans = 0;
	if (b == 0)return -1;
	while (1) {
		if (a % b == 0) {
			a /= b;
			ans++;
		}
		else break;
	}
	return ans;
}


int main() {
	int a, b, n;
	cin >> n >> a >> b;
	cout << min(n * a, b) << endl;
}



Measured memory_bytes: 256
package main

import (
	"fmt"
)

func sum(a []int) int {
	sum := 0
	for _, v := range a {
		sum += v
	}
	return sum
}

func max(a []int) int {
	max := a[0]
	for _, v := range a {
		if max < v {
			max = v
		}
	}
	return max
}

func main() {
	var n int
	fmt.Scan(&n)

	p := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&p[i])
	}

	fmt.Println(sum(p) - max(p)/2)
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    long a , c = 0;
    
    cin >> a;
    vector<long> vec(a);


    for (long i = 0; i < a; i++) {
        cin >> vec.at(i);
    }
    
    sort(vec.begin(),vec.end());
    
    for (long i = 0; i < a; i++) {
        c += vec.at(i);
     
    } 
   
    cout << vec.at(0) << " "<< vec.at(a -1) <<" "<< c<<endl;
    return 0;
}



Measured memory_bytes: 3152
from bisect import bisect_left as bi
n = int(input())
a = [int(i) for i in input().split()]
a = sorted(a)
b,num = bi(a,0),a[0]
if b==n:
    q = n-1
    print(a[-1]-sum(a[:n-1]))
elif b:
    q = b
    print(sum(a[b:])-sum(a[:b]))
else:
    q = 1
    print(sum(a[1:])-a[0])
for i in range(q,n-1):
    print(num,a[i])
    num-=a[i]
print(a[-1],num)
num = a[-1]-num
for i in range(1,q):
    print(num,a[i])
    num-=a[i]

Measured memory_bytes: 14428
import java.util.Scanner;

public class Main {
	void run() {
		Scanner scan = new Scanner(System.in);
		while (true) {
			int n = scan.nextInt();
			if (n == 0)
				break;
			int[] a = new int[n];
			for (int i = 0; i < n; i++) {
				a[i] = scan.nextInt();
			}
			int ans = Math.abs(a[0] - a[1]);
			for (int i = 0; i < n; i++) {
				for (int j = 0; j < n; j++) {
					if (i == j) continue;
					ans = Math.min(ans, Math.abs(a[i] - a[j]));
				}
			}
			System.out.println(ans);
		}
	}
	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 47372
#define IO ios::sync_with_stdio(false);cin.tie();cout.tie(0)
#pragma GCC optimize(2)
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
const int N=2010;
const ll mod=1e9+7;
ll f[N];
int main()
{
    IO;
    int T=1;
    //cin>>T;
    while(T--)
    {
        int s;
        cin>>s;
        f[0]=1;
        for(int i=3;i<=s;i++)
            for(int j=3;j<=i;j++)
                f[i]=(f[i]+f[i-j])%mod;
        cout<<f[s]<<'\n';
    }
    return 0;
}


Measured memory_bytes: 3648
import sys
import math
def I():return int(sys.stdin.readline().replace("\n",""))
def I2():return map(int,sys.stdin.readline().replace("\n","").split())
def S():return str(sys.stdin.readline().replace("\n",""))
def L():return list(sys.stdin.readline().replace("\n",""))
def Intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def Lx(k):return list(map(lambda x:int(x)*-k,sys.stdin.readline().replace("\n","").split()))

n = I()
a = Intl()
cnt = 0
for i in range(n):
    if i+1 == a[a[i]-1]:cnt += 1
print(cnt//2)

Measured memory_bytes: 13812
#include<bits/stdc++.h>
using namespace std;
#define l1 long long
int main(){
  int n; cin>>n; string a="AC",c="TLE",b="WA",d="RE";
  int A=0,B=0,C=0,D=0;
  while(n--){
    string str;
    cin>>str;
    if(str==a)A++;
    else if(str==b)B++;
    else if(str==c)C++;
    else if(str==d)D++;
  }
  cout<<a<<" x "<<A<<endl;
  cout<<b<<" x "<<B<<endl;
  cout<<c<<" x "<<C<<endl;
  cout<<d<<" x "<<D<<endl;
}


Measured memory_bytes: 3624
import collections
n = int(input())
v = [int(x) for x in input().split()]
v_odd, v_evn = [], []
for i in range(n):
  if i%2==0:
    v_odd.append(v[i])
  else:
    v_evn.append(v[i])
v_odd_cnt = collections.Counter(v_odd)
v_evn_cnt = collections.Counter(v_evn)
if len(v_odd_cnt) == len(v_evn_cnt) == 1:
  if v[0] == v[1]:
    print(n//2)
    exit()
  else:
    print(0)
    exit()
max_kv_odd = max(v_odd_cnt.items(), key=lambda x: x[1])
max_kv_evn = max(v_evn_cnt.items(), key=lambda x: x[1])
if max_kv_odd[0] == max_kv_evn[0]:
  if len(v_odd_cnt) == 1:
    v_evn_cnt.pop(max_kv_evn[0])
    max_kv_evn_tmp = max(v_evn_cnt.items(), key=lambda x: x[1])
    print(n-max_kv_odd[1]-max_kv_evn_tmp[1])
    exit()
  if len(v_evn_cnt) == 1:
    v_odd_cnt.pop(max_kv_odd[0])
    max_kv_odd_tmp = max(v_odd_cnt.items(), key=lambda x: x[1])
    print(n-max_kv_odd_tmp[1]-max_kv_evn[1])
    exit()
  v_odd_cnt_tmp = v_odd_cnt
  v_evn_cnt_tmp = v_evn_cnt
  v_odd_cnt_tmp.pop(max_kv_odd[0])
  v_evn_cnt_tmp.pop(max_kv_evn[0])
  max_kv_odd_tmp = max(v_odd_cnt_tmp.items(), key=lambda x: x[1])
  max_kv_evn_tmp = max(v_evn_cnt_tmp.items(), key=lambda x: x[1])
  a = max_kv_odd[1] + max_kv_evn_tmp[1]
  b = max_kv_evn[1] + max_kv_odd_tmp[1]
  print(n-max(a, b))
  exit()
print(n-max_kv_odd[1]-max_kv_evn[1])


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


#define _USE_MATH_DEFINES_
#define ll long long
#define ld long double
#define Accepted 0
#define pb push_back
#define mp make_pair
#define sz(x) (int)(x.size())
#define every(x) x.begin(),x.end()
#define F first
#define S second
#define For(i,x,y)  for (ll i = x; i <= y; i ++) 
#define FOr(i,x,y)  for (ll i = x; i >= y; i --)
#define SpeedForce ios_base::sync_with_stdio(0), cin.tie(0)
// ROAD to...                                                                                                                                                                                                                Red

using namespace std;

inline bool isvowel (char c) {
	c = tolower(c);
    if (c == 'a' || c == 'e' || c == 'i' || c == 'y' || c == 'o' || c == 'u') return 1;
    return 0;
}

const double eps = 0.000001;
const ld pi = acos(-1);
const int maxn = 1e7 + 9;
const int mod = 1e9 + 7;
const ll MOD = 1e18 + 9;
const ll INF = 1e18 + 123;
const int inf = 2e9 + 11;
const int mxn = 1e6 + 9;
const int N = 6e5 + 123;                                          
const int M = 22;
const int pri = 997;
const int Magic = 2101;

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

int main () {
    int n;
    cin >> n;
    int a[n + 1];
    int ans = 0;
    For (i, 1, n) {
    	cin >> a[i];
	}
	
	For (i, 2, n) {
		if (a[i] == a[i - 1]) {
			ans ++;
			i ++;
		}
	}
	
	cout << ans;
	return Accepted;
}

// Coded By OB

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

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

  vector<char> S(N);

  for (int i = 0; i < N; i++)
    cin >> S.at(i);

  int ans = 1;

  for (int i = 1; i < N; i++)
  {
    if (S.at(i - 1) != S.at(i))
      ans++;
  }

  cout << ans << endl;
}


Measured memory_bytes: 3688
#include <bits/stdc++.h>
#define rep(i, n) for(int i= 0; i < (n); i++)
using ll= long long int;
using namespace std;
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; }
ll mod= 1e9 + 7;



int main(){
  int n;
  cin >>n;
  ll a[n];
  rep(i,n)cin >> a[i];
  sort(a,a+n);
  int count=0;
  ll g[2]={};
  for(int i=n-1;i>=1;i--){
    if(a[i]==a[i-1]){
      g[count]=a[i];
      count++;
      i--;
    }
    if(count==2)break;
  }
  cout << g[0]*g[1] << endl;
}

Measured memory_bytes: 4352
#include <stdio.h>

int main(void){
  int a, b, n, m;
  scanf("%d %d %d", &n, &a, &b);
  
  m = n * a;
  
  if (m < b)
    printf("%d", m);
  else
    printf("%d", b);
  
  return 0;
}

Measured memory_bytes: 128
/* ----------------------- reclone_rk --------------------------------------------*/ 
#include<bits/stdc++.h>
using namespace std;
#define int long long int
const int mod=1e9+7;

#define FastRead ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define prq priority_queue<int>
#define prqp priority_queue<pair<int,int>>
#define vtr vector<int>
#define INF INT_MAX
#define NINF INT_MIN
#define endl "\n"
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define pvtr vector<pair<int,int>>
#define FOR(i,a,n) for (int i=(a);i<=(n);++i)

int gcd(int a, int b){ if(a == 0) return b; return gcd(b%a, a);}
int MOD(int n){ return ((n%mod)+mod)%mod;}
int power(int a,int b){ if(b==0)return 1LL;int s=power(a,b/2LL);s*=s;s%=mod;if(b&1LL)return (s*a)%mod;return s;}
int inv(int a){return power(a,mod-2);}
int nCr(int n,int r){if(r>n)return 0LL;if(n-r<r)r=n-r;int ans=1;for(int i=0;i<r;i++){ans*=(n-i);ans=MOD(ans);ans*=inv(i+1);ans=MOD(ans);}return ans;}

const double pi = 3.14159265358979323846;
signed main()
{   
    string s;
    cin>>s;
    int a[26];
    for(int i=0; i<26; i++)
    	a[i] = 0;
    for(int i=0; i<s.length(); i++)
    {
    	a[s[i]-'a']++;
    }
    int flag = 0;
    for(int i=0; i<26; i++)
    {
    	if(a[i]%2 != 0)
    	{
    		flag = 1;
    		break;
    	}
    }
    if(flag == 0)
    	cout<<"Yes"<<endl;
    else
    	cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
package main

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

func main() {
	s := IOInitialize()
	s.Buffer([]byte{}, math.MaxInt64)
	n := Int(s)
	nums := scanNums(s, n)
	oddNums := []int{}
	oddMap := map[int]int{}
	evenNums := []int{}
	evenMap := map[int]int{}
	for i, num := range nums {
		if i%2 == 0 {
			oddNums = append(oddNums, num)
			if _, ok := oddMap[num]; ok {
				oddMap[num]++
			} else {
				oddMap[num] = 1
			}
		} else {
			evenNums = append(evenNums, num)
			if _, ok := evenMap[num]; ok {
				evenMap[num]++
			} else {
				evenMap[num] = 1
			}
		}
	}
	odd1 := 0
	odd1Cnt := 0
	odd2 := 0
	odd2Cnt := 0
	for k, v := range oddMap {
		if v > odd1Cnt {
			odd2Cnt = odd1Cnt
			odd2 = odd1
			odd1Cnt = v
			odd1 = k
			continue
		}
		if v > odd2Cnt {
			odd2Cnt = v
			odd2 = k
			continue
		}
	}

	even1 := 0
	even1Cnt := 0
	even2 := 0
	even2Cnt := 0
	for k, v := range evenMap {
		if v > even1Cnt {
			even2Cnt = even1Cnt
			even2 = even1
			even1Cnt = v
			even1 = k
			continue
		}
		if v > even2Cnt {
			even2Cnt = v
			even2 = k
			continue
		}
	}

	oddNum := odd1
	oddCnt := odd1Cnt
	evenNum := even1
	evenCnt := even1Cnt
	if oddNum == evenNum {
		if evenCnt == oddCnt {
			if even2Cnt > odd2Cnt {
				evenNum = even2
				evenCnt = even2Cnt
			} else {
				oddNum = odd2
				oddCnt = odd2Cnt
			}
		} else {
			if evenCnt > oddCnt {
				oddNum = odd2
				oddCnt = odd2Cnt
			} else {
				evenNum = even2
				evenCnt = even2Cnt
			}
		}
	}
	res := len(oddNums) - oddCnt + len(evenNums) - evenCnt
	fmt.Println(res)
}

func IOInitialize() *bufio.Scanner {
	s := bufio.NewScanner(os.Stdin)
	s.Split(bufio.ScanWords)
	return s
}

func Int(s *bufio.Scanner) int {
	if !s.Scan() {
		panic("scan error")
	}

	value, err := strconv.Atoi(s.Text())
	if err != nil {
		panic("text to int error")
	}
	return value
}

func String(s *bufio.Scanner) string {
	if !s.Scan() {
		panic("scan error")
	}

	return s.Text()
}

func scanNums(s *bufio.Scanner, len int) (nums []int) {
	for i := 0; i < len; i++ {
		num := Int(s)
		nums = append(nums, num)
	}
	return
}

func scanstrings(s *bufio.Scanner, len int) (strs []string) {
	for i := 0; i < len; i++ {
		str := String(s)
		strs = append(strs, str)
	}
	return
}

/*
8
1 1 1 1 2 2 2 2
1 2 1 2 1 2 1 2
*/


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

struct Card {
	char c;
	int v;
};

Card A[36];

void bubbleSort(Card A[], int n) {

	for (int i = 0; i < n; ++i) {
			for (int j = n - 1; j > i; --j) {
				if (A[j - 1].v > A[j].v) {
					Card t = A[j - 1];
					A[j - 1] = A[j];
					A[j] = t;
				}
			}
	}
}

void selectionSort(Card A[], int n) {
	for (int i = 0; i < n; ++i) {
		int minj = i;
		for (int j = i; j < n; ++j) {
			if (A[j].v < A[minj].v) {
				minj = j;
			}
		}
				Card t = A[minj];
				A[minj] = A[i];
				A[i] = t;
			
		
	}
}


void result(Card A[], Card B[], int n) {
	for (int i = 0; i < n; ++i) {
		if (A[i].c != B[i].c) {
			cout << "Not stable" << endl;
return;
		}
	}
	cout << "Stable" << endl;
return;
}



int main() {
	Card B[36], C[36];
	int n;
	cin >> n;
	for (int i = 0; i < n; ++i) {
		cin >> A[i].c >> A[i].v;
	}

	for (int i = 0; i < n; ++i) {
		B[i] = A[i];
	}

	bubbleSort(A, n);
	for (int i = 0; i < n; ++i) {
		if (i) {
			cout << " ";
		}
		cout << A[i].c << A[i].v;
	}
	cout << endl;
	cout << "Stable" << endl;

	selectionSort(B, n);
	for (int i = 0; i < n; ++i) {
		if (i) {
			cout << " ";
		}
		cout << B[i].c << B[i].v;
	}
	cout << endl;
	result(A, B, n);

}







Measured memory_bytes: 3088
#include<bits/stdc++.h>
using namespace std;
#define fastIO std::ios_base::sync_with_stdio(false); std::cin.tie(0); std::cout.tie(0)
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
typedef double db;
//mt19937 mrand(random_device{}()); 
const ll mod=1000000007;
const int INF = 0x3f3f3f3f;
//int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}

const int maxn = 2e5 + 10; 

int main()
{
	fastIO;
	int n,m; cin >> n >> m;
	int sum = 0;
	rep(i,0,m) {
		int x; cin >> x;
		sum += x;
	}	
	int ans = n - sum;
	if(ans < 0) ans = -1;
	cout << ans << endl;
	return 0;
}

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

// #include<iostream>
#define for0(i, n) for (int i = 0; i < (int)(n); ++i) 
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define forc(i, l, r) for (int i = (int)(l); i <= (int)(r); ++i) 
#define forr0(i, n) for (int i = (int)(n) - 1; i >= 0; --i) 
#define forr1(i, n) for (int i = (int)(n); i >= 1; --i) 
#define forrc(i,l,r) for (int i= (int)(r); i>= (int)(l); --i)

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

#define all(x) (x).begin(), (x).end() 
#define rall(x) (x).rbegin, (x).rend() 


#define tr(c,i) for(__typeof__((c)).begin() i = (c).begin(); i != (c).end(); i++)


#define present(c,x) ((c).find(x) != (c).end())


#define cpresent(c,x) (find(all(c),x) != (c).end())

#define sz(a) int((a).size())


 using namespace std;


typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef double ld;
typedef long long ll;
typedef unsigned long long int ull;
int main(){
  // #ifndef ONLINE_JUDGE
  //     // for getting input from input.txt
  //     freopen("input.txt", "r", stdin);
  //     // for writing output to output.txt
  //     freopen("output.txt", "w", stdout);
  // #endif
  int n,m,a,b;
  cin >> n >> m;
  int h[n+1];
  for1(i,n){
    cin >> h[i];
  }
  vector<set<int>> v(n+1);
  for0(i,m){
    cin >> a >> b;
    v[a].insert(b);
    v[b].insert(a);
  }
  int flag,count=0;
  for1(i,n){
    flag=0;
    for(auto j:v[i]){
      if(h[j]>=h[i]){
        flag=1;
        break;
      }
    }
    if(flag==0){
      count++;
    }
  }
  cout << count;
}

Measured memory_bytes: 17704
using System;

namespace A
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split(' ');
            int a = int.Parse(input[0]);
            int b = int.Parse(input[1]);

            int output;
            if(a > b)
            {
                output = a;
                a--;
            }
            else
            {
                output = b;
                b--;
            }

            if (a > b)
            {
                output += a;

            }
            else
            {
                output += b;

            }

            Console.WriteLine(output);
        }
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using ld = long double;
const int INF = (1<<30)-1;
const long long LINF = (1LL<<62)-1;
const long double PI = acos(-1.0L);
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
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; }

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s;
  cin >> s;
  for (int i = 0; i < s.size(); i+=2)
    cout << s[i];
  cout << endl;
  return 0;
}

Measured memory_bytes: 592
#coding: UTF-8

n = int(input())
point_t = 0
point_h = 0

for i in range(n):
    cards = list(map(str, input().split()))
    taro = cards[0]
    hanako = cards[1]
    if taro < hanako:
        point_h += 3
    elif taro > hanako:
        point_t += 3
    else:
        point_t += 1
        point_h += 1

print(point_t, point_h)


Measured memory_bytes: 5600
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
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; }
const long long INF = 1LL << 60;
 
typedef pair<ll,ll> pairs;
vector<pairs> p;
bool pairCompare(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.first < secondElof.first;
}
#define MAX_N 1000100
bool x[MAX_N];
ll num[MAX_N];
ll fibl[MAX_N]={0};
 
ll fib(ll a){
    if (fibl[a]!=0)return fibl[a];
    if (a==0){
        return 0;
    }else if (a==1){
        return 1;
    }
    return fibl[a]=fib(a-1)+fib(a-2);
}
 
ll eratosthenes(ll n) {
    int p = 0;
    for (ll i=0; i<=n; ++i) x[i] = true;
    x[0] = x[1] = false;
    for(int i=2; i<=n; ++i) {
        if(x[i]) {
            p++;
            for(int j=2*i; j<=n; j+=i) x[j] = false;
        }
        
        num[i] = p;
    }
    return p;
}
 
ll gcd(ll a,ll b){
    if (a%b==0)return(b);
    else return(gcd(b,a%b));
}
 
ll keta(ll N){
    int tmp{};
    while( N > 0 ){
        tmp += ( N % 10 );
        N /= 10;
    }
    N = tmp;
    return N;
}

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




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

#define rep(i,n) for(ll i = 0; i < n; i++)
#define per(i,n) for(ll i = n-1; i >= 0; i--)
#define REP(i,n) for(ll i = 1; i < n; i++)
#define PER(i,n) for(ll i = n; i >= 1; i--)
#define sz(x) int(x.size())
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define endl '\n'
#define fi first
#define se second
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vii = vector<vi>;
using vl = vector<ll>;
using vll = vector<vl>;
using vs = vector<string>;
using vb = vector<bool>;
using vc = vector<char>;
using vcc = vector<vc>;
using vP = vector<P>;
using vPP = vector<vP>;
using vPl = vector<Pl>;
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
const int inf = (1<<30)-1;
const ll infll = (1LL<<62)-1;
ll ceil(const ll &a, const ll &b){return ((a)+(b)-1)/b;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { 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; }

ll gcd (ll a, ll b) {
  if(a % b == 0) return b;
  return gcd(b, a%b);
} 

ll lcm (ll a, ll b) {
  return a * b / gcd(a,b);
}

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

  ll a, b, c, d;
  cin >> a >> b >> c >> d;
  ll e = lcm(c,d);
  ll ans = (b/c - (a-1)/c) + (b/d - (a-1)/d) - (b/e - (a-1)/e);
  ans = (b-a+1) - ans;
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <string.h>
#include <queue>
#include <math.h>
#include <cmath>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <bitset>
#include <list>
#include <ctype.h>
#include <cassert>
#include <stack>
#include <fstream>
#include <unordered_map>
#include <unordered_set>
#include <ctime>
#include <functional>
#include <ctime>
#include <limits>
#include <tuple>
#include <complex>
#include <numeric>
#include <future>

using namespace std;

#define snd second
#define fst first
#define mp make_pair
#define ll long long
#define ull unsigned long long
#define ld long double
#define pb push_back
#define left _left
#define right _right

const ld pi = acos(-1.0);

template<typename T>
T abs(T x) {
    return x > 0 ? x : -x;
}

template<typename T>
T sqr(T x) {
    return x * x;
}

template<typename T>
bool chmin(T &x, T y) {
    if (x > y) {
        x = y;
        return true;
    }
    return false;
}

template<typename T>
bool chmax(T &x, T y) {
    if (x < y) {
        x = y;
        return true;
    }
    return false;
}

template<typename U, typename V>
ostream &operator<<(ostream &s, const pair<U, V> &x) {
    s << "(" << x.fst << ", " << x.snd << ")";
    return s;
}

template<typename U>
ostream &operator<<(ostream &s, const vector<U> &x) {
    s << "[";
    bool was = false;
    for (auto it : x) {
        if (was) {
            s << ", ";
        }
        was = true;
        s << it;
    }
    s << "]";
    return s;
}

template<typename U>
ostream &operator<<(ostream &s, const set<U> &x) {
    s << "{";
    bool was = false;
    for (auto it : x) {
        if (was) {
            s << ", ";
        }
        was = true;
        s << it;
    }
    s << "}";
    return s;
}

template<int sz>
ostream operator<<(ostream &s, const bitset<sz> &x) {
    for (int i = 0; i < sz; i++) {
        s << x[i];
    }
    return s;
}


//--------------------------------------------------------------------------


int main() {

    srand(time(NULL));

#ifdef LOCAL
    freopen("a.in", "r", stdin);
    //freopen("a.in", "w", stdout);
#else
    //freopen("brackets.in", "r", stdin);
    //freopen("brackets.out", "w", stdout);
#endif

    vector<tuple<int,int,int>> ans;
    for (int i = 19; i >= 2; i--) {
        ans.emplace_back(i, i + 1, 0);
        ans.emplace_back(i, i + 1, 1 << (19 - i));
    }


    ll n;
    cin >> n;

    ll already = 0;

    if (n & (1 << 19)) {
        ans.emplace_back(1, 2, 0);
        ans.emplace_back(1, 2, 1 << 18);
        already += 1 << 19;
    }

    for (int i = 18; i >= 0; i--) {
        if (n & (1 << i)) {
            ans.emplace_back(1, 19 - i + 1, already);
            already += 1 << i;
        }
    }

    cout << 20 << " " << ans.size() << endl;
    for (auto x : ans) {
        cout << get<0>(x) << " " << get<1>(x) << " " << get<2>(x) << std::endl;
    }

    return 0;
}

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

int main(void) {
  int N;
  cin >> N;
  vector<pair<int, int>> work(N), priority(N);
  for (int i = 0; i < N; ++i) {
    int A, B;
    cin >> A >> B;
    work[i] = make_pair(A, B);
    priority[i] = make_pair(B, i);
  }
  sort(priority.begin(), priority.end());
  reverse(priority.begin(), priority.end());
  int time = 2000000010;
  bool success = true;
  for (int i = 0; i < N; ++i) {
    pair<int, int> next = work[priority[i].second];
    if (time < next.first || next.first > next.second) {
      success = false;
      break;
    }
    time = min(time, next.second) - next.first;
  }
  cout << (success ? "Yes" : "No") << "\n";
  return 0;
}


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

typedef long long ll;

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

bool compPair(const pair<int, int>& arg1, const pair<int, int>& arg2) {
    return arg1.first > arg2.first;
}

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

    int cnt = 0;
    char before = S.at(0);
    for(int i=1;i<S.size();i++) {
        if(before!=S.at(i)) cnt++;
        before = S.at(i);
    }

    cout << cnt << endl;

    return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <vector>

using namespace std;

int main() {
	int a, count = 0, modmin = 9;
	bool flag = false;
	for (int i = 0; i < 5; i++) {
		cin >> a;
		if (a % 10 > 0) {
			flag = true;
			modmin = min(modmin, a % 10);
			count += ((int)(a / 10)) * 10 + 10;
		}
		else {
			count += a;
		}
	}
	if (flag) {
		cout << count - 10 + modmin << endl;
	}
	else {
		cout << count << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0); 
    int d, t, s;
    cin >> d >> t >> s;
    if(s * t >= d) {
        cout << "Yes\n";
    } else {
        cout << "No\n";
    }
}

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

typedef long long ll;

int main(){
	int N;
	cin >> N;
	vector<string> S;
	rep(i,N){
		string s;
		cin >> s;
		sort(s.begin(),s.end());
		S.push_back(s);
	}

	sort(S.begin(),S.end());

	ll ans = 0;
	ll a = 1;
	vector<int> C;
	rep(i,N-1){
		if(S[i]==S[i+1]){
			a++;
		}else{
			C.push_back(a);
			a = 1;
		}
	}
	if(a>=2)C.push_back(a);
	for(int u : C){
		ll t = 1; int m=min(u,2);
		for(int i=0; i<m; i++){
			t *= u;
			u--;
		}
		t /= 2;
		ans += t;
	}

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

Measured memory_bytes: 6644
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
 
using namespace std;
using namespace __gnu_pbds;
 
#define debug(s) cout << #s << " = " << s << endl
#define all(v) (v).begin(), (v).end()
#define mem(a,val) memset(a, val, sizeof a)
 
#define maxn 100010
#define INF 1e15
#define ff first
#define ss second
#define endl '\n'
typedef long long ll;
 
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

int n, ans;
vector<int> adj[maxn];
vector<pair<int,int>> edges;
int col[maxn], par[maxn];

void dfs(int u, int p) {
  par[u] = p;
  int idx = 1;
  if (idx == col[u]) idx++;
  for (auto v: adj[u]) {
    if (v == p) continue;
    col[v] = idx++;
    if (idx == col[u]) idx++;
  }
  for (auto v: adj[u]) {
    if (v == p) continue;
    dfs(v, u);
  }
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  for (int i = 1; i < n; ++i) {
    int u, v;
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
    edges.push_back({u, v});
  }
  dfs(1, 1); 
  for (int i = 2; i <= n; ++i) ans = max(ans, col[i]);
  cout << ans << endl;
  for (auto p: edges) {
    if (p.ff == par[p.ss]) cout << col[p.ss] << endl;
    else cout << col[p.ff] << endl;
  }
}




Measured memory_bytes: 8188
#include<iostream>
using namespace std;
int main(){
    int x,i;
    
    for(i = 1; i <= 10000; i++){
        
        if(x = 0) break;
        
        cin >> x;
        cout << "Case " << i << ": " << x << endl;
        
    }
    
    return 0;
}


Measured memory_bytes: 3004
n = int(input())
H = list(map(int, input().split()))
tmp_max = 0
tmp = 0

for i in range(n-1):
    if H[i]>=H[i+1]:
        tmp += 1
    else:
        if tmp > tmp_max:
            tmp_max = tmp
        tmp=0
    if i == n-2:
        if tmp > tmp_max:
            tmp_max = tmp

print(tmp_max)
        

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

namespace codefes2017
{
    class Program
    {
        static void Main()
        {
            var s = Console.ReadLine().Split(' ').Select(st => int.Parse(st)).ToArray();

            int n = s[0];
            int m = s[1];
            int k = s[2];
            bool can = false;

            int all_panel = n * m;

            for(int r = 0; r <= n; r++){
                for(int c = 0; c <= m; c++){
                    int black = r * (m - c) + c * (n - r);
                    if(k == black || k == all_panel - black) {
                        can = true;
                        break;
                    }
                }
            }

            if (can){
                Console.WriteLine("Yes");
            } else {
                Console.WriteLine("No");
            }
        }
    }
}


Measured memory_bytes: 13268
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a,b,c;
    cin >> a >> b >> c;
    bool chk = false;
    for(int i=0;i<b;i++){
        if(a*i%b==c)chk=true;
    }
    if(chk)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
}

Measured memory_bytes: 256
# import numpy as np
# from collections import defaultdict
# from functools import reduce

import heapq

# s = input()
Q = int(input())
# A = list(map(int, input().split()))
# n, m, k = map(int, input().split())


A_left_sum = 0
A_left = []
A_right_sum = 0
A_right = []
A_med = None
query_size = 0
b_sum = 0

# n = len(As)
# n is odd:
# A_left + As[n//2] + B_left
# n is even:
# A_left + B_left

for i in range(Q):
    query = list(map(int, input().split()))

    if query[0] == 1:
      a =  query[1]
      if A_med is None:
        A_med = a
      else:
        if query_size%2 == 0: # even
          left_max = -A_left[0]
          right_min = A_right[0]
          if a < left_max:
            heapq.heappushpop(A_left, -a)
            A_left_sum += a - left_max
            A_med = left_max
          elif a > right_min:
            heapq.heappushpop(A_right, a)
            A_right_sum += a - right_min
            A_med = right_min
          else:
            A_med = a
        else: # odd
          if A_med <= a:
            heapq.heappush(A_left, -A_med)
            heapq.heappush(A_right, a)
            A_left_sum += A_med
            A_right_sum += a
          else:
            heapq.heappush(A_left, -a)
            heapq.heappush(A_right, A_med)
            A_right_sum += A_med
            A_left_sum += a

      # print(As)
      # print(A_left)
      # print(A_right)
      query_size += 1

      b_sum += query[2]
    else:
      if query_size%2 == 0: #even
        print(-A_left[0], A_right_sum - A_left_sum + b_sum)
      else:
        print(A_med, A_right_sum - A_left_sum + b_sum)


Measured memory_bytes: 11112
#include<iostream>
#include<algorithm>
#include<vector>
#include<stdio.h>
#include<cstring>
#include<math.h>
#include<map>
#include<bitset>
#include<iomanip>
#include<queue>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
using P = pair<int, int>;

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

int N, M;
pair<int, int> p[50];


int main() {
  cin >> N >> M;
  int ans = 0;
  rep(i, M) {
    cin >> p[i].first >> p[i].second;
    p[i].first--;p[i].second--;
  }
  rep(i, M) {
    UnionFind tree(N);
    rep(j, M) {
      if(i == j) continue;
      tree.unite(p[j].first, p[j].second);
    }
    bool f = tree.same(p[i].first, p[i].second);
    if(!f) ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
/*
ID: wangjun30
TASK:
LANG: C++
*/
#include<iostream>
#include<set>
using namespace std;
set<int> s;
int main(){
	int a,ans=1;
	cin>>a;
	while(1){
		int before=s.size();
		s.insert(a);
		if(s.size()==before)
			break;
		ans++;
		if(a%2==0)
			a=a/2;
		else
			a=a*3+1;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
typedef long long ll;
using namespace std;
const  ll INF = 1e9;
const  ll MOD = 1e9 + 7;
#define repi(i,n,init) for(ll i=init;i<(n);i++)

int main()
{
    string s;
    cin >> s;
    int n = s.size();
    char now = s[0];
    int ans = 0;
    repi(i,n,1){
        if(now != s[i]){
            ans++;
            now = s[i];
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 512
#include <string>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <iostream>
#include <functional>
#include <algorithm>
#include <sstream>
#include <iterator>
#include <cmath>
#include <limits>
#include <tuple>
#include <queue>
#include <stack>

using namespace std;
typedef long long ll;

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()

int main()
{
	int a, b;
	cin >> a >> b;
	a--;
	b--;
	int ans = a*b;
	cout << ans << endl;
	return 0;
}


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

namespace AtTest.ABC_104
{
    class B
    {
        static void Main(string[] args)
        {
            Method(args);
            Console.ReadLine();
        }

        static void Method(string[] args)
        {
            string s = Console.ReadLine();

            if (s[0] != 'A')
            {
                Console.WriteLine("WA");
                return;
            }

            bool hasC = false;
            int cIndex = -1;
            for(int i = 2; i <= s.Length-2; i++)
            {
                if (s[i] == 'C')
                {
                    if (hasC)
                    {
                        Console.WriteLine("WA");
                        return;
                    }
                    else
                    {
                        hasC = true;
                        cIndex = i;
                    }
                }
            }

            if (hasC == false)
            {
                Console.WriteLine("WA");
                return;
            }
            string newS = s.Substring(1, cIndex - 1);
            newS += s.Substring(cIndex + 1);

            for(int i = 0; i < newS.Length; i++)
            {
                if (!char.IsLower(newS[i]))
                {
                    Console.WriteLine("WA");
                    return;
                }
            }
            Console.WriteLine("AC");

            /*bool hasC = false;
            for(int i = 0; i < s.Length; i++)
            {
                if (i == 0)
                {
                    if (s[i] != 'A')
                    {
                        Console.WriteLine("WA");
                        return;
                    }
                    else
                    {
                        continue;
                    }
                }
                if (i >= 2 && i < s.Length - 2
                    &&s[i]=='C')
                {
                    if (hasC)
                    {
                        Console.WriteLine("WA");
                        return;
                    }
                    else
                    {
                        hasC = true;
                    }
                }
                else if (!char.IsLower(s[i]))
                {
                    Console.WriteLine("WA");
                    return;
                }
            }

            if (!hasC)
            {
                Console.WriteLine("WA");
            }
            else
            {
                Console.WriteLine("AC");
            }*/
        }
    }
}


Measured memory_bytes: 11092
n = gets.to_i
as = gets.split(" ").map(&:to_i)

two_count = 0
four_multiple = 0
as.each do |a|
  if a % 4 == 0
    four_multiple += 1
  elsif a % 2 == 0
    two_count += 1
  end
end

def check(n, two_count, four_multiple)
 if n == two_count
   return true
 elsif n == four_multiple
   return true
 end
 if two_count < 2
   if n.even?
     if n/2 <= four_multiple
       true
     else
       false
     end
   else
     if (n-1)/2 <= four_multiple
       true
     else
       false
     end
   end
 else
   n = n - two_count
   if n == 0
     false
   else
     if n.even?
       if n/2 <= four_multiple
         true
       else
         false
       end
     else
       if (n+1)/2 <= four_multiple
         true
       else
         false
       end
     end
   end
 end
end

if check(n, two_count, four_multiple)
  puts "Yes"
else
  puts "No"
end

Measured memory_bytes: 8460
def main(n):
	h = list(map(int, input().split())) + [0]
	ans = 0
	f, e = 0, 1
	while f != n:
		if h[f] == 0:
			f += 1
			if e == f:
				e += 1
		elif e == n or h[e] == 0:
			temp = min(h[f:e])
			for i in range(f, e):
				h[i] -= temp
			ans += temp
			e = f+1
		else:
			e += 1
	print(ans)
	return

main(int(input()))

Measured memory_bytes: 3064
/* Hardwork allways pays off */
//You never know how close to the solution you are ,so keep practicing
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define endl '\n'
#define mod 1000000007
#define REP(i,n) for(ll i=1;i<=n;i++)
#define tol(s) transform(s.begin(),s.end(),s.begin(),::tolower)
#define tou(s) transform(s.begin(),s.end(),s.begin(),::toupper)
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define all(x) (x).begin(), (x).end()
void make_unique(vector<ll> vec)
{
sort(all(vec));
vec.resize(unique(all(vec)) - vec.begin());
}

int main() 
 {   ios;
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    int t=1;
    //  cin>>t; 
    while(t--)
      {ll l,k,p,a,b,c,n,m,i,j,flag=0,count=0,move=0;
           string s;
           cin>>s;
           l=s.length();
           if(s[l-1]=='s')
            cout<<s<<"es"<<endl;
           else
            cout<<s<<"s"<<endl;  




        
      }
	return 0;
}


Measured memory_bytes: 3636
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int x = scanner.nextInt();
		int y = scanner.nextInt();
		System.out.println(gcd(x, y));
	}

	public static int gcd(int x, int y) {
		if (x % y == 0)
			return y;
		else
			return gcd(y, x % y);
	}
}

Measured memory_bytes: 17320
#include<stdio.h>

int main()

{
    int D;
    scanf("%d",&D);

    if(D==25)
        printf("Christmas\n");
    else if(D==24)
        printf("Christmas Eve\n");
    else if(D==23)
        printf("Christmas Eve Eve\n");
    else if(D==22)
        printf("Christmas Eve Eve Eve\n");

    return 0;
}


Measured memory_bytes: 128
#include <algorithm>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <list>
#define INF 10000000000ll
#define MOD 1000000007ll
#define EPS 1e-10
#define REP(i,m) for(long long i=0; i<m; i++)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define DUMP(a) for(long long dump=0; dump<(ll)a.size(); dump++) { cout<<a[dump]; if(dump!=(ll)a.size()-1) cout<<" "; else cout<<endl; }
#define ALL(v) v.begin(),v.end()
#define pb push_back
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef long double ld;
using namespace std;

int main(){
	int n;
	cin >> n;
	map<ll, ll> x;
	REP(i, n){
		ll a;
		cin >> a;
		x[a]++;
	}
	ll m1 = 0, m2 = 0;
	for(map<ll, ll>::iterator it = x.begin(); it != x.end(); ++it){
		if(it->second > 1){
			if(m1 <= it->first) m1 = it->first;
		}
	}
	x[m1] -= 2;
	for(map<ll, ll>::iterator it = x.begin(); it != x.end(); ++it){
		if(it->second > 1){
			if(m2 <= it->first) m2 = it->first;
		}
	}
	cout << m1 * m2 << endl;
	return 0;
}


Measured memory_bytes: 6528
package main

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

var points []point

func main() {

	sc := bufio.NewScanner(os.Stdin)
	sc.Scan()
	n, _ := strconv.Atoi(sc.Text())
	s := point{0, 0}
	e := point{100, 0}

	printLine(s)
	koch(s, e, 0, n)
	printLine(e)

}

func koch(p1 point, p2 point, depth int, maxDepth int) {
	if depth == maxDepth {
		return
	}

	// p1 left p3 p5 p4 p2 right
	x1 := (p1.x + (p2.x-p1.x)/3)
	y1 := (p1.y + (p2.y-p1.y)/3)
	p3 := point{x1, y1}
	points = append(points, p3)

	x2 := (p1.x + 2*(p2.x-p1.x)/3)
	y2 := (p1.y + 2*(p2.y-p1.y)/3)
	p4 := point{x2, y2}
	p5 := getVertex(p3, p4)

	koch(p1, p3, depth+1, maxDepth)
	printLine(p3)
	koch(p3, p5, depth+1, maxDepth)
	printLine(p5)
	koch(p5, p4, depth+1, maxDepth)
	printLine(p4)
	koch(p4, p2, depth+1, maxDepth)
}

func printLine(p point) {
	fmt.Printf("%.8f %.8f\n", p.x, p.y)
}

func getVertex(p1 point, p2 point) point {
	d60 := (1 / 3.0) * math.Pi // TODO about reverse
	x := (p2.x-p1.x)*math.Cos(d60) - (p2.y-p1.y)*math.Sin(d60) + p1.x
	y := (p2.x-p1.x)*math.Sin(d60) + (p2.y-p1.y)*math.Cos(d60) + p1.y
	return point{x, y}
}

type point struct {
	x float64
	y float64
}



Measured memory_bytes: 1248
#include <algorithm>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <ctime>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <memory.h>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <unordered_map>
#include <unordered_set>
using namespace std;
typedef long double LD;
typedef long long LL;
typedef pair<LL, LL> pll;
typedef pair<int, int> pii;
typedef vector<int> vi;
#ifdef LOCAL
#define DEBUG(x) { cerr << "# " << #x << ": " << x << endl;}
#else
#define DEBUG(x)
#endif
mt19937_64 mt(time(0));
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i
　　　　／　　　＼　 　  |　|
　　　 /　　 /￣￣￣￣/　　|
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿
　 　　　＼/＿＿＿＿/　（u　⊃
---------------------------------------------------------------------------------------------------*/






int main() {
  ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
  cout.precision(10); cout << fixed;
#ifdef LOCAL
  freopen("../test.txt", "r", stdin);
    // freopen("../output.txt", "w", stdout);
#endif
  string s, t; cin >> s >> t;
  int ret = s.size();
  for (int i = 0; i < s.size(); i++) {
    if (i+t.size() > s.size()) break;
    int tmp = 0;
    for (int j = 0; j < t.size(); j++) {
      if (s[i+j] != t[j]) tmp++;
    }
    ret = min(ret, tmp);
  }
  cout << ret << '\n';





/*---------------------------------------Coding Space End------------------------------------------*/
#ifdef LOCAL
  cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s." << endl;
#endif
  return 0;
}
/* author:  txingml */
/* picture is from hamayanhamayan(CF handle) */


Measured memory_bytes: 3192