akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
using namespace std;
//---------------------------------------
vector<string> BubbleSort(vector<string> a);
vector<string> SelectionSort(vector<string> a);
void Show(vector<string> a);
void ShowStable(const vector<string> sa, const vector<string> a);
bool IsStable(const vector<string> sa, const vector<string> a);
//---------------------------------------

int main(void)
{
	int n;
	vector<string> a;
	
	cin >> n;
	
	for(int i = 0; i < n; i++){
		string card;
		cin >> card;
		a.push_back(card);
	}
	
	//?????????
	vector<string> bs_a = BubbleSort(a);
	vector<string> ss_a = SelectionSort(a);
	
	//??¨???
	Show(bs_a);
	ShowStable(bs_a, a);
	Show(ss_a);
	ShowStable(ss_a, a);
	
	return 0;
}
//------------------------------------------
vector<string> BubbleSort(vector<string> a){
	
	for(int i = 0; i <= a.size() -1; i++){
		for(int j = a.size() -1; j >= i+1; j--){
			if(a[j][1] < a[j-1][1]){
				string temp = a[j];
				a[j] = a[j-1];
				a[j-1] = temp;
			}
		}
	}
	return a;
}
//------------------------------------------
vector<string> SelectionSort(vector<string> a){
	
	for(int i = 0; i < a.size(); i++){
		int minj = i;
		for(int j = i; j < a.size(); j++){
			if(a[j][1] < a[minj][1]){
				minj = j; //??????(i)??¨???????????§???????°????????????????????????????
			}
		}
		if(i == minj){
			continue; //??\???????????????for????????????
		}
		string temp = a[i];  //???????°???????????????????(i)????§?????????????
		a[i] = a[minj];
		a[minj] = temp;
	}
	return a;
}
//--------------------------------------------
void Show(vector<string> a){
	for(int i = 0; i < a.size() - 1; i++){
		cout << a[i] << ' ';
	}
	cout << a[a.size() - 1] << endl;
	
}
//--------------------------------------------
void ShowStable(const vector<string> sa, const vector<string> a){
	
	if(IsStable(sa, a)){
		cout << "Stable" << endl;
	}
	else{
		cout << "Not stable" << endl;
	}
	
}
//--------------------------------------------
bool IsStable(const vector<string> sa, const vector<string> a){

	string a_moji;
	
	for(int j = 1; j < 10; j++){
		for(int i = 0; i < a.size(); i++){
			if(a[i][1] == j+'0'){
				a_moji.push_back(a[i][0]);  //??°???????°?????????????a_moji?????\??????
			}
		}
	}
	for(int i = 0; i < a.size(); i++){
		if(a_moji[i] != sa[i][0]){
			return false;
		}
	}
	return true;

}

Measured memory_bytes: 3188
import java.util.*;

public class Main{
	private static final Scanner scan = new Scanner(System.in);

	public static void main(String[] args){
		while(scan.hasNext()){
			double[] x = new double[3];
			double[] y = new double[3];
			for(int i = 0; i < 3; i++){
				x[i] = scan.nextDouble();
				y[i] = scan.nextDouble();
			}

			double xp = scan.nextDouble();
			double yp = scan.nextDouble();

			for(int i = 0; i < 3; i++){
				x[i] = x[i] - xp;
				y[i] = y[i] - yp;
			}

			double[] gaiseki = new double[3];
			gaiseki[0] = x[0]*y[1] - y[0]*x[1];
			gaiseki[1] = x[1]*y[2] - y[1]*x[2];
			gaiseki[2] = x[2]*y[0] - y[2]*x[0];

			int plus = 0;
			int minus = 0;
			for(int i = 0; i < 3; i++){
				if(gaiseki[i] > 0)plus++;
				if(gaiseki[i] < 0)minus++;
			}

			String ans = "NO";
			if(plus == 3 || minus == 3)ans = "YES";
			System.out.println(ans);
		}
	}
}

Measured memory_bytes: 32532
N, A, B = map(int, input().split())
S = input()
a = b = 0
for s in S:
  if a + b == A + B:
    print('No')
  elif s == 'c':
    print('No')
  elif s == 'a':
    if a + b < A + B:
      print('Yes')
      a += 1
    else:
      print('No')
  else: # s == 'b'
    if a + b < A + B and b < B:
      print('Yes')
      b += 1
    else:
      print('No')


Measured memory_bytes: 4016
package main

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

var rdr = bufio.NewReaderSize(os.Stdin, 1000000)

func main() {
	var N, ans int
	fmt.Scan(&N)
	A := atoi(nextSlice())
	B := atoi(nextSlice())
	for i := 0; i < N; i++ {
		if A[i] >= B[i] {
			ans += B[i]
		} else {
			if B[i]-A[i] > A[i+1] {
				ans += A[i+1] + A[i]
				A[i+1] = 0
			} else {
				ans += B[i]
				A[i+1] -= B[i] - A[i]
			}
		}
	}
	fmt.Println(ans)
}

func readLine() string {
	buf := make([]byte, 0, 1000000)
	for {
		l, p, e := rdr.ReadLine()
		if e != nil {
			panic(e)
		}
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}

func nextSlice() []string {
	return strings.Split(readLine(), " ")
}

func atoi(a []string) (b []int) {
	b = make([]int, len(a))
	for i := range a {
		b[i], _ = strconv.Atoi(a[i])
	}
	return
}

func atof(a []string) (b []float64) {
	b = make([]float64, len(a))
	for i := range a {
		b[i], _ = strconv.ParseFloat(a[i], 64)
	}
	return
}

func scanSlice2(n int) (a []int, b []int) {
	a = make([]int, n)
	b = make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&a[i], &b[i])
	}
	return
}

func scanFloatSlice2(n int) (a []float64, b []float64) {
	a = make([]float64, n)
	b = make([]float64, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&a[i], &b[i])
	}
	return
}

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

func abs(a int) int {
	if a > 0 {
		return a
	}
	return -a
}

func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}

func larger(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func largest(a, b, c int) (lgst int) {
	if a > b {
		lgst = a
	} else {
		lgst = b
	}
	if c > lgst {
		lgst = c
	}
	return
}

func smaller(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func smallest(a, b, c int) (slst int) {
	if a < b {
		slst = a
	} else {
		slst = b
	}
	if c < slst {
		slst = c
	}
	return
}

func sum(a []int) (ans int) {
	for i := range a {
		ans += a[i]
	}
	return
}

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

func yesOrNo(b bool) {
	if b {
		fmt.Println("Yes")
		return
	}
	fmt.Println("No")
}

func yesorNO(b bool) {
	if b {
		fmt.Println("YES")
		return
	}
	fmt.Println("NO")
}

Measured memory_bytes: 11648
#include <bits/stdc++.h>
using namespace std;
int A,B,C;
int main(){
	cin>>A>>B>>C;
  
  	if (A == B && B != C){
		cout<<"Yes";
      	return 0;
    }
  	if (A == C && A != B){
		cout<<"Yes";
      	return 0;
    }
  	if (B == C && B != A){
		cout<<"Yes";
      	return 0;
    }
  	cout<<"No";
}


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

int main(void){
   string inp ="1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51";
   char separator = ',';
   vector<ll> res(32,0);
  ll prev=0;
  ll k=0;
  for(int i=0;i<inp.size();i++){
      if(inp[i]==separator){
      string a = inp.substr(prev, i - prev);
        prev = i+2;
        ll b=stoll(a);
        res[k] = b;
        k++;
      }
  }
  res[31]=51;
  
  ll K;cin>>K;
  cout<<res[K-1]<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <iomanip>

using namespace std;
typedef long long ll;
const int maxn=1e5+111;

int arr[maxn];
int dp[maxn];
int main(){
    int n;
    scanf("%d",&n);
    dp[1]=0;
    for(int i=1;i<=n;++i){
        scanf("%d",arr+i);
        if(i==2) dp[2]=abs(arr[2]-arr[1]);
        if(i>2){
            dp[i]=min(dp[i-1]+abs(arr[i]-arr[i-1]),dp[i-2]+abs(arr[i]-arr[i-2]));
        }
    }
    printf("%d\n",dp[n]);
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <string>
#include <numeric>
#include <algorithm>
using namespace std;

int main() {
	string S,T,U;
	int A,B;
	cin >> S >> T >> A >> B >> U;
	if(U==S){
		A--;
	}
	else{
		B--;
	}
	cout << A <<" "<< B <<endl;
	return 0;
}


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

int main(){
  int a,b;
  cin>>a>>b;
  if((a==1||b==1)&&(a==2||b==2))
    cout<<3;
  if((a==2||b==2)&&(a==3||b==3))
    cout<<1;
  if((a==3||b==3)&&(a==1||b==1))
    cout<<2;
  return 0;
}
  


Measured memory_bytes: 256
class BinarySearchTree:
    def __init__(self):
        self.root = None
        self.nodes = []
        self.keys = set()

    def insert(self, z):
        self.keys.add(z)
        z = Node(z)
        self.nodes.append(z)
        y = None
        x = self.root
        while x is not None:
            y = x
            if z.key < x.key:
                x = x.left
            else:
                x = x.right
            z.parent = y

        if y is None:
            self.root = z
        elif z.key < y.key:
            y.left = z
        else:
            y.right = z
    
    def dfs(self, node):
        self.preorder.append(node.key)
        if node.left is not None:
            self.dfs(node.left)

        self.inorder.append(node.key)

        if node.right is not None:
            self.dfs(node.right)

    def out(self):
        self.preorder = []
        self.inorder = []
        self.dfs(self.root)

        print("", *self.inorder)
        print("", *self.preorder)

    def find(self, key):
        if key in self.keys:
            print("yes")
        else:
            print("no")


class Node:
    def __init__(self, v):
        self.key = v
        self.left = None
        self.right = None
        self.parent = None


def main():
    T = BinarySearchTree()
    n = int(input())
    for i in range(n):
        command = input().split()
        if command[0] == "print":
            T.out()
        elif command[0] == "find":
            T.find(int(command[1]))
        else:
            T.insert(int(command[1]))


if __name__ == "__main__":
    main()


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

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

        int n = sc.NextInt();
        int[] l = sc.IntArray();

        int max = l.Max();
        int sum = l.Sum();

        bool ok = max < sum - max;

        string answer = ok ? "Yes" : "No";

        Console.WriteLine(answer);
    }

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

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

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

            return _line[_index++];
        }

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

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

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

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

using pii = pair<int,int>;
#define f(i,a,b) for (int i = a; i < b; i++)
#define IN(i,a,b) (a<=i && i<=b)

const int mxn = 800, oo = 1e9;
int n,m,k;
char board[mxn][mxn];
bool vis[mxn][mxn];
int di[] = {1,-1,0,0};
int dj[] = {0,0,1,-1};

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
#ifdef LOCAL
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	clock_t start = clock();
#endif

	cin>>n>>m>>k;
	f(i,0,n) f(j,0,m) cin>>board[i][j];
	int fi = 0, fj = 0;
	f(i,0,n) f(j,0,m) if (board[i][j] == 'S')
		fi = i, fj = j;	
	f(i,0,n) f(j,0,m) vis[i][j] = 0;
	queue<pii> pq;
	pq.push(pii(fi,fj));
	vis[fi][fj] = 1;
	f(_,0,k) {
		queue<pii> nxt;
		while (pq.size()) {
			pii pp = pq.front(); pq.pop();
			int i = pp.first, j = pp.second;
			f(t,0,4) {
				int ni = i+di[t], nj = j+dj[t];
				if (IN(ni,0,n-1)&&IN(nj,0,m-1)
						&& board[ni][nj] != '#' && !vis[ni][nj]) {
					vis[ni][nj] = 1;
					nxt.push({ni,nj});
				}
			}
		}	
		pq = nxt;
	}
	int ans = oo;
	f(i,0,n) f(j,0,m) if (vis[i][j]) {
		int dx = min(i,n-1-i), dy = min(j,m-1-j);
		ans = min(ans,1+int(min(ceil(1.00*dx/k),ceil(1.00*dy/k))));
	}
	cout << ans << endl;
	

#ifdef LOCAL
	cout << setprecision(12) << (long double)(clock()-start) / CLOCKS_PER_SEC << endl;
#endif
	
	return 0;
}



Measured memory_bytes: 1664
#include<bits/stdc++.h>
using namespace std;
int main(){
    string str;
    cin>>str;
    int w=0;
    int l = 0;
    int total = 15;

    for(int i=0;i<str.length();i++){
        if(str[i]=='o'){
            w++;
        }
        else{
            l++;
        }
    }
    int r = total-str.length();
    if((r+w)>=8){
        cout<<"YES"<<endl;
    }
    else{
        cout<<"NO"<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC optimize("no-stack-protector")
//#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("fast-math")
#pragma GCC target("sse,sse2,sse3,ssse3,popcnt,abm,mmx,tune=native")
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <stdio.h>
#include <cstdio>
#include <math.h>
#include <cmath>
#include <string>
#include <cstring>
#include <queue>
#include <deque>
#include <random>
#include <iomanip>
#include <bitset>
                        
using namespace std;
                        
template<typename T> void uin(T &a, T b) {
    if (b < a) {
        a = b;
    }
}
                        
template<typename T> void uax(T &a, T b) {
    if (b > a) {
        a = b;
    }
}

#define int long long
#define ghost signed
#define left left228
#define right right228
#define complex complex228
#define count count228
#define sin sin228
#define list list228

const int N = 55;

double a[N];

ghost main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
	int n;
	cin >> n;
	for (int i = 1; i <= n; ++i) cin >> a[i];
	sort(a + 1, a + n + 1);
	for (int i = 1; i < n; ++i) {
		a[i + 1] += a[i];
		a[i + 1] /= 2;
	}
	cout << setprecision(15) << a[n] << '\n';
    return 0;
} // kek ;
// Ого! Кажетсья это $#@!
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 


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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF 1e16

struct edge{
  ll f,t,c;
};

ll n,m;
vector<edge> es;
vector<P> g[101010];
bool used[101010];
ll d[101010];

int main(){
	cin>>n>>m;
  rep(i,m){
    ll a,b,c;
    cin>>a>>b>>c;
    a--; b--;
    g[a].push_back(P(b,c));
    used[b]=true;
    es.push_back((edge){a,b,c});
  }
  priority_queue<P,vector<P>,greater<P> > que;
  rep(i,n){
    d[i]=INF;
    if(used[i])continue;
    que.push(P(0,i));
  }
  while(que.size()){
    ll v=que.top().se;
    ll nd=que.top().fi;
    que.pop();
    if(d[v]!=INF)continue;
    d[v]=nd;
    for(P e : g[v]){
      que.push(P(nd+e.se,e.fi));
    }
  }
  bool ok=true;
  rep(i,m){
    ll v=es[i].f,u=es[i].t,nc=es[i].c;
    if(d[v]+nc!=d[u])ok=false;
  }
  if(ok)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
	return 0;
}


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

int main() {
  int h,w;cin>>h>>w;
  string hn[h];rep(i,h)cin>>hn[i];
  rep(i,h) rep(j,w){
    if (hn[i][j]=='#') continue;
    int cnt=0;
    for(int di=-1;di<2;di++) for(int dj=-1;dj<2;dj++) {
      if (i+di<0 or i+di>=h or j+dj<0 or j+dj>=w) continue;
      if (hn[i+di][j+dj]=='#') cnt++;
    }
    hn[i][j] = (char) (cnt+'0');
  }
  rep(i,h) cout<<hn[i]<<endl;
}


Measured memory_bytes: 256
N = int(input())
slimes = input().split()
slimes = list(map(int, slimes))

count = 1
count_list = []
ans = 0

for i in range(N-1):
    if slimes[i] - slimes[i+1] == 0:
        #print(slimes[i])
        count += 1
        #print(count)
    else:
        #print("change")
        count_list.append(count)
        count = 1
count_list.append(count)

for i in count_list:
    ans += int(i/2)
    
print(ans)

Measured memory_bytes: 3064
#include <cstdio>

int main(){
    char s[5];
    scanf("%s", s);
    bool flag = true;
    for(int i = 0; i < 4; i++){
        if(s[i] == s[i+1]){
            flag = false;
        }
    }

    if(flag){
        printf("Good\n");
    }else{
        printf("Bad\n");
    }

    return 0;
}

Measured memory_bytes: 128
include Math
def calc1(a, b)
  (a[0] - b[0]) ** 2 + (a[1] - b[1]) ** 2
end
def calc2(a, b)
  c = sqrt(calc1(a, b))
  d = sqrt(1.0 - (c/2) ** 2)
  [(a[0] + b[0]) / 2, (a[1] + b[1]) / 2, (a[1] - b[1]) / c * d, (b[0] - a[0]) / c * d]
end
while n = gets.to_i
  break if n == 0
  dots = Array.new(n)
  arc = Array.new
  n.times { |i| dots[i] = gets.split(",").map(&:to_f) }
  n.times do |i|
    ((i+1)...n).each do |j|
      if calc1(dots[i], dots[j]) <= 4.0 + 1e-6
        x, y, dx, dy = calc2(dots[i], dots[j])
        arc << [x + dx, y + dy] << [x - dx, y - dy]
      end
    end
  end
  ret = 1
  arc.each do |p|
    px, py = p
    cnt = 0
    dots.each do |d|
      dx, dy = d
      cnt += 1 if (dx - px) ** 2 + (dy - py) ** 2 <= 1.0 + 1e-6
    end
    ret = cnt if cnt > ret
  end
  p ret
end

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

using namespace std;
using ll = long long;

//container util
#define SORT(c) sort((c).begin(),(c).end())

//repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)


const int INF = 1010101100;

int main(void){

	int H, N; cin >> H >> N;
	vector<int> A(N);
	vector<int> B(N);
	REP(i,N) cin >> A[i] >> B[i];

	vector<int> HP(H+1, INF);

	HP[H] = 0;

	for(int i=H;i>=0;i--){
		REP(j,N){
			int idx = i - A[j];
			idx = max(idx, 0);
			HP[idx] = min(HP[idx], HP[i] + B[j]);
		}
	}

	cout << HP[0] << endl;
	return 0;

}


Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main(void){
    // Your code here!
    int n;
    cin >> n;
    string s,t;
    cin >>s>>t;
    for(int i=0;i<n;i++){
        cout << s[i]<<t[i];
    }
    cout << "\n";}


Measured memory_bytes: 256
#include<stdio.h>
#define MAX 200000000
#define INFTY 1000000000

int size, A[MAX+1];

void maxHeapify(int i) {
  int l, r, largest, t;
  l = 2 * i;
  r = 2 * i + 1;
  if ( l <= size && A[l] > A[i] ) largest = l;
  else largest = i;
  
  if ( r <= size && A[r] > A[largest] ) largest = r;
  if ( largest != i ) {
    t = A[i]; 
    A[i] = A[largest];
    A[largest] = t;
    maxHeapify(largest);
  }
}

int extract(){
	int maxv;
	if ( size < 1 ) return -INFTY;
	maxv = A[1];
  	A[1] = A[size--];
  	maxHeapify(1);
  	
  	return maxv;
}

void increaseKey(int i, int key) {
	int tmp;
	if ( key < A[i] ) return;
	A[i] = key;
	
	while ( i > 1 && A[i / 2] < A[i] ){
		tmp = A[i];
		A[i] = A[i / 2];
		A[i / 2] = tmp;
		i = i / 2;
	}
}

void insert(int key) {
	size++;
	A[size] = -INFTY;
	increaseKey(size, key);
}

int main() {
	int key;
	char com[20];
  
	while(1) {
		scanf("%s", com);
		
		if ( com[0] == 'i' ) {
			scanf("%d", &key);
			insert(key);
		} else if ( strcmp(com, "extract") == 0  ) {
			printf("%d\n", extract());
		} else break;
	}
  
  return 0;
}


Measured memory_bytes: 5604
#include<bits/stdc++.h>
#define int(x) int x; scanf("%d",&x);
#define lnt(x) long long x; scanf("%lld",&x);
#define dbl(x) double x; scanf("%lf",&x);
#define str(x) string x; cin >> x;
#define fo(i,a,b) for (int i=(a);i<(b);i++)
#define rf(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define rp(i,n) for (int i=0;i<(n);i++)
#define rrp(i,n) for (int i=(n)-1;i>=0;i--)
#define inf INT_MAX/3
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define pcc pair<char,char>
#define pci pair<char,int>
#define vs vector<string>
#define vi vector<int>
#define ll long long
#define in(x) cin>>x;
#define ot(x) cout<<x;
#define eot(x) cout<<x<<endl;
#define sot(x) cout<<x<<" ";
using namespace std;
int main(){
	string s1="yuiophjklnm";
	while(1){
		str(s)	
		if(s=="#")break;
		int c[33]={},ans=0;
		rp(i,s.size()){
			rp(j,s1.size()){
				if(s[i]==s1[j]){
					c[i]=1;
					break;
				}
			}
		}
		fo(i,1,s.size()){
			if((c[i]-c[i-1])!=0){
				ans++;
			}
		}
		eot(ans)
	}
	return 0;
}

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

int main() {
  string s;
  cin >> s;
  ll ans=0;
  ll tans=0;
  for(ll i=0;i<s.size();i++) {
    if(s[i]=='A'||s[i]=='T'||s[i]=='C'||s[i]=='G') {
      tans++;
    }
    else {
      ans=max(ans,tans);
      tans=0;
    }
  }
  ans=max(ans,tans);
  cout << ans << endl;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>
#include <map>

//LLONG_MAX
#define int long long
#define CONTAINS(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v) (reverse((v).begin(), (v).end()))
#define LOWER_BOUND(v,a) (lower_bound((v).begin(), (v).end(), (a)))
#define UPPER_BOUND(v,a) (upper_bound((v).begin(), (v).end(), (a)))
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define CONTAINS_MAP(m, a) (m).find((a)) != m.end()
using namespace std;

int N, M;
int A[100001];
int rui[100001];

signed main()
{
	cin >> N >> M;

	REP(i, N) cin >> A[i];

	rui[0] = (A[0] % M);
	for (int i = 1; i < N; i++)
	{
		rui[i] = (rui[i - 1] + A[i]) % M;
	}

	ARY_SORT(rui, N);

	int ans = 0;

	int cnt = 1;
	int cur = rui[0];
	for (int i = 1; i <= N; i++)
	{
		if (i == N || cur != rui[i])
		{
			int a = cnt;
			if (cur != 0)
			{
				a--;
			}
			if (a > 0)
			{
				int n = ((a) * (a + 1)) / 2;
				ans += n;
			}
			cur = rui[i];
			cnt = 1;
		}
		else
		{
			cnt++;
			continue;
		}
	}

	cout << ans << endl;
}







Measured memory_bytes: 1792
using System;

namespace pro
{




    class MainClass
    {
        public static void Main()
        {
            string[] str = Console.ReadLine().Split(' ');
            int k = int.Parse(str[0]);
            int x = int.Parse(str[1]);
            int min = x - k + 1;
            int max = x + k - 1;
            if (min >= -10000&&max<=100000)
            {
                for(int i = min; i <= max; i++)
                {
                    Console.Write(i);
                    Console.Write(" ");
                }
            }
            else if (min >= -10000 && max > 100000)
            {
                for (int i = min; i <= 10000; i++)
                {
                    Console.Write(i);
                    Console.Write(" ");
                }
            }
            else if (min < -10000 && max <= 100000)
            {
                for (int i = -10000; i <= max; i++)
                {
                    Console.Write(i);
                    Console.Write(" ");
                }
            }


        }
    }


}

Measured memory_bytes: 11092
#include "stdio.h"

int main()
{
	int N = 0;
	int A[21];
	int B[21];
	int C[21];
	int cnt;
	int sum = 0;


	
	scanf("%d", &N);
	
	
	for (cnt = 0; cnt < N; cnt++) {
		scanf("%d", &A[cnt]);

	}
	
	
	for (cnt = 0; cnt < N; cnt++) {
		scanf("%d", &B[cnt]);
	}
	
	for (cnt = 0; cnt < N - 1; cnt++) {
		scanf("%d", &C[cnt]);
	}



	for (cnt = 1; cnt <= N; cnt++) {
		sum = sum + B[A[cnt - 1] - 1];
		if (cnt - 1 >= 1) {
			if (A[cnt - 2] == A[cnt - 1] - 1) {
				sum = sum + C[A[cnt - 1] - 2];
			}

		}
		
	}
	printf("%d", sum);
	return 0;

}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int a[109];
main(){
    int n, x;
    cin >> n >> x;
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    sort(a, a+n);
    int s = 0;
    for(int i = 0; i < n; i++){
        s += a[i];
        if(s > x){
            cout << i<< endl;
            return 0;
        }
    }
    if(s == x) cout<<n<<endl;
    else cout << n -1 << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
typedef pair<int, int> pii;
int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    long long n, k; cin >> n >> k;
    int ans = 0, base = 1;
    while (base <= n)
        ans++, base *= k;
    cout << ans << '\n';
}


Measured memory_bytes: 256
n,x = (int(i) for i in input().split())
a = list(int(i) for i in input().split())
copy = []
for num in a:
    copy.append(num)
    
for i in range(n-1):
    if i==0:
        if a[i]>x:
            a[i]=x
    if a[i]+a[i+1]>x:
        a[i+1] = x-a[i]

print(sum(copy)-sum(a))


Measured memory_bytes: 14052
#include<bits/stdc++.h>
#define Fail puts("NO"),exit(0);
#define eps 1e-10
#define maxn 100010
#define maxm 100010
#define inf 1000000007
#define mod 1000000007
#define pi acos(-1)
#define mp(x,y) make_pair(x,y)
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int>pii;
typedef bitset<maxn> bit;
int read()
{
    int x=0,f=1;
    char ch=getchar();
    while(ch-'0'<0||ch-'0'>9){if(ch=='-') f=-1;ch=getchar();}
    while(ch-'0'>=0&&ch-'0'<=9){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
int n,K;
int p[maxn],q[maxn],inv_p[maxn],inv_q[maxn];
void inv(int *A,int *B)
{
    for(int i=1;i<=n;i++)  B[A[i]]=i;
}
void init(int *A)
{
    for(int i=1;i<=n;i++)  A[i]=i;
}
int tmp[maxn],tmpx[maxn];
void mul(int *A,int *B,int *C)
{
    for(int i=1;i<=n;i++)  tmp[i]=A[B[i]];
    for(int i=1;i<=n;i++)  C[i]=tmp[i];
}
int a[7][maxn];
void quick_pow(int *A,int p,int *C)
{
    init(C);
    while(p)
    {
        if(p&1)  mul(C,A,C);
        mul(A,A,A);
        p>>=1;
    }
}
int res[maxn];
int main()
{
    n=read();K=read();
    for(int i=1;i<=n;i++)  p[i]=read();
    for(int i=1;i<=n;i++)  q[i]=read();
    inv(p,inv_p);inv(q,inv_q);
    int A[maxn],B[maxn];
    init(A);
    mul(A,q,A);mul(A,inv_p,A);
    mul(A,inv_q,A);mul(A,p,A);
    for(int i=1;i<=n;i++)  a[1][i]=p[i],a[2][i]=q[i];
    for(int i=3;i<=6;i++)
    {
        inv(a[i-2],tmpx);
        mul(a[i-1],tmpx,a[i]);
    }
    int m=(K-1)/6;
    quick_pow(A,m,B);
    for(int i=1;i<=n;i++)  res[i]=B[i];
    mul(res,a[K-6*m],res);
    inv(B,A);
    mul(res,A,res);
    for(int i=1;i<=n;i++)  printf("%d ",res[i]);
    puts("");
    return 0;
}

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

void solve(){
	string s, temp;
	cin >> s;
	ll count = 0, check = 1;
	ll n = (ll)s.length();
        for(ll i = 0; i<n; i++)
        {
            temp.push_back(s[i]);
            if(temp.size()==1 &&(check==1||(check==0 && s[i]!=s[i-1]))){
                count++;
                temp.clear();
                check=0;
            }
            if(temp.size()==2){
            	
                count++;
                temp.clear();
                check=1;
            }
        }
        cout << count;
}


int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int t=1;
	//cin >> t;
	while(t--)
	{
		solve();
	}
		return 0;
}


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

#define rep(i, a) for (int i = 0; i < (a); ++i)
#define REP(i, a, b) for (int i = (a); i < (b); ++i)
#define FORV(a, A) for (auto &a : A)

using namespace std;
using ll = long long;
using P = pair<int, int>;

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

void Main() {
  ll a, b;
  cin >> a >> b;
  cout << a * b / euk(a, b) << endl;
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<string>
using namespace std;
int main()
{
    int a=1,b=0,c=0,now;
    char str[4];
    while(scanf("%s",str)!=EOF){
        if((str[0]=='A'&&str[2]=='B')||(str[0]=='B'&&str[2]=='A')){
            now=a;
            a=b;b=now;
        }
        else if((str[0]=='A'&&str[2]=='C')||(str[0]=='C'&&str[2]=='A')){
            now=a;
            a=c;c=now;
        }
        else{
            now=b;
            b=c;c=now;
        }
        
    }
    if(a==1)cout<<"A\n";
    else if(b==1)cout<<"B\n";
    else cout<<"C\n";
}

Measured memory_bytes: 1116
#include <iostream>
#include <string>
 
using namespace std;
 
int main(void){
  	string S, T;
  	cin >> S >> T;
  
  	int len = S.size(), counter = 0;
  	
	
  	for(int i = 0; i < len; i++){
      if(S[i] != T[i]) counter++;
    }
  	
  	cout << counter << endl;
}


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

int main(){
  int wait[5] = {0};

  int time = 0;

  for(int i  = 0;i < 5;i++){
    int tt; cin >> tt;
    if(tt % 10 != 0){
      wait[i] = (10 - tt % 10);
      time += tt + wait[i];
    }
    else time += tt;
  }

  cout << time - max({wait[0],wait[1],wait[2],wait[3],wait[4]}) << endl;

  return 0;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL,LL> P;
const LL mod=1e9+7;
const LL LINF=1LL<<62;


int main(){
    int W,B;
    cin >> W >> B;
    W--,B--;
    char s[100][100];
    for(int i=0;i<50;i++){
        for(int j=0;j<100;j++){
            s[i][j]='.';
            s[i+50][j]='#';
        }
    }
    for(int i=0;i<50;i+=2){
        if(B==0) break;
        for(int j=0;j<100;j+=2){
            s[i][j]='#';
            B--;
            if(B==0) break;
        }
    }
    for(int i=51;i<100;i+=2){
        if(W==0) break;
        for(int j=0;j<100;j+=2){
            s[i][j]='.';
            W--;
            if(W==0) break;
        }
    }
    cout << "100 100" << endl;
    for(int i=0;i<100;i++){
        for(int j=0;j<100;j++){
            cout << s[i][j];
        }
        cout << "\n";
    }
    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }

int N, M;
bool f(int x) {
	if (M - (x - N) * 2 >= 2 * x)return false;
	else return true;
}

template<class F>
int binary_search_(int l, int r, F f) {
	if (f(l))return l; //exception f(l):true
	while (l + 1 < r) {
		int m = (l + r) / 2;
		if (f(m))
			r = m;
		else
			l = m;
	}
	//f(l):false, f(r):true
	return r;
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> N >> M;
	if (N * 2 >= M)
		cout << M / 2 << endl;
	else {
		int a = binary_search_(N, 1e12 + 1, f);
		cout << a - 1 << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
using namespace std;
int main() {
	int n;
	while(scanf("%d",&n),n) {
		int s,sum=0,min_s=1<<30,max_s=0;
		for(int i=0;i<n;i++) {
			scanf("%d",&s);
			sum+=s;
			min_s=min(min_s,s);
			max_s=max(max_s,s);
		}
		printf("%d\n",(sum-min_s-max_s)/(n-2));
	}
}

Measured memory_bytes: 1028
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 1e9 + 7;
const ll inf = (1 << 30) - 1;
const ll infll = (1LL << 61) - 1;

int m, n, M;

int main()
{
    while (cin >> m >> n >> M)
    {
        if (m == 0 && n == 0 && M == 0)
            return 0;
        vector<int> a(m);
        for (int i = 0; i < m; i++)
        {
            cin >> a[i];
        }
        ll g = -inf, ans = 0;
        for (int i = n - 1; i < M; i++)
        {
            if (a[i] - a[i + 1] >= g)
            {
                g = a[i] - a[i + 1];
                ans = i + 1;
            }
        }
        cout << ans << endl;
    }
}


Measured memory_bytes: 3080
#include<bits/stdc++.h>
const int N=1003,M=200005;
using namespace std;
int n,m,eu[M],ev[M],u,st[N],t;
bool mp[N][N],rc[N][N],vis[N];
vector<int>ed[N];
void dfs(int x){
	if(!mp[u][x]){
		mp[u][x]=1;
		for(int i:ed[x])dfs(i);
	}
}
void dfss(int x){
	if(x^u&&!vis[x]){
		vis[x]=1;
		for(int i:ed[x])dfss(i);
	}
}
int main(){
	scanf("%d%d",&n,&m);
	for(int i=0;i<m;i++)
	scanf("%d%d",eu+i,ev+i),
	ed[eu[i]].push_back(ev[i]);
	for(int i=1;i<=n;i++)dfs(u=i);
	for(int i=1;i<=n;i++){
		u=i,t=0;
		for(int j:ed[i]){
			rc[i][j]=vis[j];
			dfss(st[++t]=j);
		}
		for(int j=1;j<=n;j++)vis[j]=0;
		for(int j=t;j;j--)
		rc[i][st[j]]|=vis[st[j]],dfss(st[j]);
		for(int j=1;j<=n;j++)vis[j]=0;
	}
	for(int i=0;i<m;i++)
	puts(mp[ev[i]][eu[i]]^rc[eu[i]][ev[i]]
	?"diff":"same");
}

Measured memory_bytes: 6272
using System;
using System.Collections.Generic;
using System.IO.Pipes;

namespace cswork
{
    class Program
    {
        class Scanner
        {
            string[] s;
            int i;

            char[] cs = new char[] { ' ' };

            public Scanner()
            {
                s = new string[0];
                i = 0;
            }

            public string next()
            {
                if (i < s.Length) return s[i++];
                string st = Console.ReadLine();
                while (st == "") st = Console.ReadLine();

                s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
                i = 0;
                return next();
            }

            public int nextInt()
            {
                return int.Parse(next());
            }

            public long nextLong()
            {
                return long.Parse(next());
            }

            public double nextDouble()
            {
                return double.Parse(next());
            }
        }

        public Program() { }

        static void Main(string[] args)
        {
            new Program().Omame();
        }

        Scanner cin;
        const int MAXIN = 1024;
        bool[] used = new bool[MAXIN];
        int[] perm = new int[MAXIN];

        List<int[]> permList = new List<int[]>();

        public void Permutation(int pos, int n, int length)
        {
            if (pos == n)
            {
                permList.Add((int[])perm.Clone());
            }

            for (int i = 0; i < n; i++)
            {
                if (!used[i])
                {
                    perm[pos] = i;
                    used[i] = true;
                    Permutation(pos + 1, n, length);
                    used[i] = false;
                }
            }
        }

        void Omame()
        {
            cin = new Scanner();
            int N = cin.nextInt();
            string S = cin.next();

            List<long> count = new List<long>();
            for (int i = 0; i < 3; i++)
            {
                count.Add(0);
            }
            for (int i = 0; i < S.Length; i++)
            {
                if (S[i] == 'R')
                {
                    count[0]++;
                }
                else if (S[i] == 'G')
                {
                    count[1]++;
                }
                else
                {
                    count[2]++;
                }
            }

            long ans = count[0] * count[1] * count[2];
            for (int j = 0; j < N; j++)
            {
                for (int i = 0; i < j; i++)
                {
                    int k = j + (j - i);
                    if (k < N)
                    {
                        if (S[i] != S[j] && S[j] != S[k] && S[k] != S[i])
                        {
                            ans--;
                        }
                    }
                }
            }
            Console.WriteLine(ans);
        }

    }
}


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

int main(){
	int n;
  	cin>>n;
  	char s[n];
  	cin>>s;
  	
  	int cnt=0;
  	for(int i=0;i<n-2;){
    	if(s[i]!='A'){
        	i++;
        }else{
          	
        	if(s[i+1]=='B'&&s[i+2]=='C'){
            	cnt++;
              	i+=3;
            }else {
            	i++;
            } 	
        }
    }
  	cout<<cnt<<endl;
  	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

using ll = long long;

const int INF = 1e9 + 5;

int main() {
    int n,k;
    scanf("%d%d",&n,&k);
    vector<int> a(n);
    for(int &x:a){
      cin>>x;
    }
    vector<bool> dp(k+1);
    for (int i = 0; i <= k; i++)
    {
      for(int x:a){
        if(i>=x && !dp[i-x]){
          dp[i] = true;
        }
      }
    }
    puts(dp[k] ? "First":"Second");
}

Measured memory_bytes: 256
function main()
  
  N = parse(Int,readline())
  
  sp = Tuple{String, Int64, Int64}[]
  
  for i in 1:N
    (s,p) = split(chomp(readline())," ")
    p = parse(Int,p)
    push!(sp, (s,-p,i))
  end
  
  sort!(sp)
  
  for i in 1:N
    println(sp[i][3])
  end
  
end

main()

Measured memory_bytes: 111384
a = 0
b = 0
c = 0
while b != "?" do
  a,b,c = gets.chomp.split
a = a.to_i
c = c.to_i
  if  b == "+"
    p a + c
  elsif b == "-"
    p a - c
  elsif b == "*"
    p a * c
  elsif b == "/"
    p a / c
  else
  end  
end


Measured memory_bytes: 6864
#include <iostream>
#include <set>
#include <string>
using namespace std;
int main(void){
    int N;
    cin >> N;
    std::set<std::string> s;
    
    for(int i=0; i < N; i++){
        std::string a;
        cin >> a;
        s.insert(a);
    }
    
    cout << s.size() << endl;
}


Measured memory_bytes: 19032
package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	var D int
	fmt.Sscanf(scanner.Text(), "%d", &D)

	var ans string
	switch D {
	case 22:
		ans = "Christmas Eve Eve Eve"
	case 23:
		ans = "Christmas Eve Eve"
	case 24:
		ans = "Christmas Eve"
	case 25:
		ans = "Christmas"
	}
	fmt.Println(ans)
}


Measured memory_bytes: 640
L = input()
lenl = len(L)
MOD = 10**9 + 7
# dp[is未満][bit]
dp = [[0] * len(L) for _ in range(2)]
dp[0][0] = 2
dp[1][0] = 1

for i in range(1,len(L)):
    b = L[i]
    if b == '1':
        dp[0][i] = dp[0][i-1]*2
        dp[1][i] = dp[0][i-1] + dp[1][i-1] * 3
    else:
        dp[0][i] = dp[0][i-1]
        dp[1][i] = dp[1][i-1] * 3
    dp[0][i] %= MOD
    dp[1][i] %= MOD

print((dp[0][-1] + dp[1][-1])%MOD)


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

const long MOD = 1000000007;

int main(){
	int n, k;
	scanf("%d%d", &n, &k);
	long ans = 0;
	for(long i = k; i <= n + 1; i++)
		ans += ((2*n-i+1)*i - (i-1)*i) / 2  + 1;
	printf("%ld\n", ans % MOD);
}

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

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP0(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REP1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)

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

const int INTINF = int(1e9) + 1;
const LL LLINF = LL(1e18) + 1;
long double eps = 1.0E-14;
#define pow10(n) int(1e##n + n)

void solve()
{
    int K, X;
    cin >> K >> X;
    cout << (500 * K >= X ? "Yes" : "No") << endl;
}

int main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(10);
    solve();
    return 0;
}


Measured memory_bytes: 256
import sys
import os
import math
import string

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: x * y / math.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    A, B, C, D = il()
    while True:
        C -= B
        if C <= 0:
            print('Yes')
            break

        A -= D
        if A <= 0:
            print('No')
            break


if __name__ == '__main__':
    main()


Measured memory_bytes: 10056
N, M = [int(i) for i in input().split()]
H = {i: int(h) for i, h in enumerate(input().split(), 1)}
t = {k: 0 for k in H.keys()}

for _ in range(M):
    A, B = [int(i) for i in input().split()]
    t[A] = max(H[B], t[A])
    t[B] = max(H[A], t[B])

print(sum(H[k] > v for k, v in t.items()))


Measured memory_bytes: 31060
#include <iostream>
using namespace std;
int main (){
    int a, b, i;
    for(i=0; i<3000; i++){
    cin>>a>>b;
    if(a==0&&b==0){
    return 0;
    }
    else if(b>=a){
    cout<<a<<" "<<b<<endl;
    }
    else{
    cout<<b<<" "<<a<<endl;
    }
    }
    cout<<endl;
}


Measured memory_bytes: 3120
#include<stdio.h>

int main(void){
  int a,b,x,y,z;
  scanf("%d%d",&a,&b);
  x=a*b;
  y=x/2;
  z=x-y*2;
  if(z==0){
    printf("Even\n");
  }else{
    printf("Odd\n");
  }
 
}

Measured memory_bytes: 128
//#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
#define mem(a,v) memset((a), (v), sizeof (a))
#define enl printf("\n")
#define case(t) printf("Case #%d: ", (t))
#define ni(n) scanf("%d", &(n))
#define nl(n) scanf("%lld", &(n))
#define nai(a, n) for (int i = 0; i < (n); i++) ni(a[i])
#define nal(a, n) for (int i = 0; i < (n); i++) nl(a[i])
#define pri(n) printf("%d\n", (n))
#define prl(n) printf("%lld\n", (n))
#define pii pair<int, int>
#define pil pair<int, long long>
#define pll pair<long long, long long>
#define vii vector<pii>
#define vil vector<pil>
#define vll vector<pll>
#define vi vector<int>
#define vl vector<long long>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef cc_hash_table<int,int,hash<int>> ht;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> oset;
const double pi = acos(-1);
const int MOD = 1e9 + 7;
const int INF = 1e9 + 7;
const int MAXN = 1e6 + 5;
const double eps = 1e-9;
int p[MAXN], a[MAXN];

int main() {
	int n, k;
	scanf("%d %d", &n, &k);
	nai(p, n);
	int col = 1;
	for (int i = 0; i < n; i++) {
		int j = i+1;
		a[i] = col++;
		while (j < n && p[j] > p[j-1]) {
			a[j] = a[i];
			j++;
		}
		i = j-1;
	}
	set<int> cur;
	int ans = 1, fl = a[0] == a[k-1];
	if (fl == 1) ans--;
	for (int i = 0; i < k; i++)
		cur.insert(p[i]);
	for (int i = k; i < n; i++) {
		if (*cur.begin() != p[i-k] || *(--cur.end()) > p[i]) {
			if (a[i-k+1] == a[i])
				fl = 1;
			else
				ans++;
		}
		cur.erase(cur.find(p[i-k]));
		cur.insert(p[i]);
	}
	ans += fl;
	pri(ans);
	return 0;
}

Measured memory_bytes: 14464
#include<stdio.h>

int main(void){
  int i,j;
  int t,n;
  int h[100];
  int maxU,maxD;

  scanf("%d",&t);
  for(i=0;i<t;i++){
    scanf("%d",&n);
    for(j=0;j<n;j++)
      scanf("%d",&h[j]);

    maxU=0;
    maxD=0;

    for(j=0;j<n-1;j++){
      if(h[j+1]-h[j]>0){
        if(maxU<h[j+1]-h[j])
          maxU=h[j+1]-h[j];
      }
      else if(h[j]-h[j+1]>0){
        if(maxD<h[j]-h[j+1])
          maxD=h[j]-h[j+1];
      }
    }

    printf("%d %d\n",maxU,maxD);
  }

  return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <vector>
using namespace std;
int main(void){
  int n,h,w;
  cin >> n >> h >> w;
  
  vector<vector<int>>ab(n,vector<int>(2,0));
  for(int i=0;i<n;i++){
    for(int j=0;j<2;j++){
      cin >> ab[i][j];
    }
  }
  
  int ans = 0;
  
  for(int i=0;i<n;i++){
    if(ab[i][0] >= h && ab[i][1] >= w) ans++;
  }
  
  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 256
import std.stdio, std.string, std.conv, std.bigint, std.typecons, std.algorithm, std.array, std.math, std.range;
 
void main() {
    auto tmp = readln.split.to!(long[]);
    auto N = tmp[0], K = tmp[1];
    long[][] points;
    long[] xs, ys;
    foreach (i; 0..N) {
        tmp = readln.split.to!(long[]);
        points ~= tmp;
        xs ~= tmp[0];
        ys ~= tmp[1];
    }
    xs = sort(xs).array;
    ys = sort(ys).array;

    ulong minS = ulong.max;
    foreach (i; 0..N) {
        foreach (j; i+1..N) {
            foreach (k; 0..N) {
                foreach (l; k+1..N) {
                    if (points.filter!(p => xs[i] <= p[0] && p[0] <= xs[j] && ys[k] <= p[1] && p[1] <= ys[l]).array.length < K) continue;
                    minS = min(minS, (xs[j] - xs[i]) * (ys[l] - ys[k]));
                }
            }
        }
    }
    writeln(minS);
}


Measured memory_bytes: 2172
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect

def LI(): return [int(x) for x in sys.stdin.readline().split()]


def I(): return int(sys.stdin.readline())


def LS(): return [list(x) for x in sys.stdin.readline().split()]


def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res


def IR(n):
    return [I() for i in range(n)]


def LIR(n):
    return [LI() for i in range(n)]


def SR(n):
    return [S() for i in range(n)]


def LSR(n):
    return [LS() for i in range(n)]


sys.setrecursionlimit(1000000)
mod = 1000000007


def solve():
    s = S()
    if s == ['A','B','C']:
        print('ARC')
    else:
        print('ABC')
    return


if __name__ == "__main__":
    solve()


Measured memory_bytes: 83512
#include <bits/stdc++.h>
using namespace std;
//再帰関数を使った例　今後使っていきたい
int func(int x){
  if( x < 10) return x;
  return x%10 + func(x/10);
}

int main() {
  int n;
  cin >> n;
  int S = func(n);
  
  if( n%S == 0 ){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  
  return 0;
  
}

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

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

string c = "";

if(a > b)
c += '>';
else if ( a < b)
c += '<';
else
c += "==";

cout << "a " << c << " b"<<endl;

return 0;
}


Measured memory_bytes: 3160
process.stdin.resume();
process.stdin.setEncoding('utf8');

var g_input = '';
process.stdin.on('data', function(chunk) {
    g_input += chunk;
});

process.stdin.on('end', function() {
    Main(g_input.split(/\r?\n/));
});

function Main(input) {
    var n = parseInt(input[0], 10);
    var a = new Array(n);
    for (var i = 0; i < n; i++) {
        a[i] = parseInt(input[i + 1], 10);
    }

    var num = {};
    var numCount = 0;
    for (var i = 0; i < n; i++) {
        if (num[a[i]]) {
            num[a[i]] = false;
            numCount--;
        }
        else {
            num[a[i]] = true;
            numCount++;
        }
    }

    console.log(numCount);

    return 0;
}



Measured memory_bytes: 39484